;
 ; ------------------------------------------------------
 ;        iChr = AscW(Right$(sStr, lLen))
 ;        iChr = RightI(sStr, lPosR)
 ; ------------------------------------------------------
 ;
 ; Property Get RightI(sStr As String, ByVal lPosR As Long) As Integer
 ;    CopyMemory RightI, ByVal StrPtr(sStr) + LenB(sStr) - lPosR - lPosR, 2&
 ; End Property
 ;
 ; ------------------------------------------------------
;
 .486            ; 32-bit instruction set
 .model flat     ; Protected memory, 4GB limit
 .code           ; Start of code

Get_RightI proc near

   push esi          ; preserve register
   xor eax, eax      ; zero default return
   mov esi,[esp+12]  ; copy string descriptor
   mov edx,[esp+16]  ; copy read pos parameter
   mov esi,[esi]     ; extract string pointer

   shl edx, 1        ; convert to byte read pos
   jbe _exitp        ; invalid pos param (jcz)
   test esi,esi      ; validate string pointer
   jz _exitp         ; exit null string passed

   mov ecx,[esi-4]   ; extract byte len of string
   sub ecx, edx      ; calc offset from str start
   js _exitp         ; exit outside string bounds

   mov ax,[esi+ecx]  ; extract specified wchar

  _exitp:
   mov edx,[esp+20]  ; address of return value
   mov [edx], ax     ; assign property result

   pop esi       ; restore pointer register
   xor eax, eax  ; clear eax tell VB all okay
   ret 16        ; cleanup (lpObj, p1, p2, rc)

Get_RightI endp  ; end of procedure
end Get_RightI   ; end of code, indicate entry point
