Xlat_API_Calc_Len Segment, Offset, Calc_Proc_Addr
Copies a calculated number of bytes from the protected-mode address to the translation copy buffer, and converts the address into a V86-mode address.
The V86MMGR_Xlat_API service fails if there is not enough room in the translation buffer to copy the specified number of bytes.
For example, Buffered Keyboard Input (Interrupt 21h Function 0Ah) can have a buffer size from 3 to 257 bytes; the size depends on the value of the first byte in the buffer. The following script and callback procedure translates this function:
VxD_DATA_SEG
Buff_Keyboard_Input_API:
Xlat_API_Calc_Len ds, dx, Calc_Input_Buff_Size
Xlat_API_Exec_Int 21h
VxD_DATA_ENDS
VxD_CODE_SEG
BeginProc Calc_Input_Buff_Size
movzx ecx, BYTE PTR fs:[esi]
add ecx, 2
ret
EndProc Calc_Input_Buff_Size
VxD_CODE_ENDS