VKD_Start_Paste

include vkd.inc

mov     eax, OFFSET32 paste_buf
mov     ebx, VMHandle
mov     ecx, entries
mov     esi, OFFSET32 PasteProc
mov     edx, refdata
VxDCall VKD_Start_Paste
jc      errorhandler

Puts a virtual machine into paste mode by simulating keyboard activity with key strokes taken from the specified paste buffer. Depending on the mode set with the VKD_Define_Paste_Mode service, VKD waits for the virtual machine to poll the keyboard BIOS through its Interrupt 16h interface. If the virtual machine does keyboard input through the BIOS, then VKD simulates the keyboard input at this high level (plugging in ASCII codes). If the virtual machine fails to perform any Interrupt 16h within in a time-out period, or the mode has been set to avoid Interrupt 16h pasting, the VKD simulates the necessary hardware interrupts to perform the pasting. Hot keys are still processed while pasting is in progress. Uses Flags. The carry flag is clear if the paste is started; otherwise, the carry flag is set to indicate an error, such as insufficient memory to copy from the buffer.

paste_buf
Address of a paste buffer that contain an array of key structures having the following form:
OEM_ASCII_value     db  ?
scan_code           db  ?
shift_state         dw  ?

The shift_state field is 02h if a shift key is down and 04h is a CTRL key is down.

The scan_code is 0FFh and the shift_state 0FFFFh, if the VKD should convert the key to a ALT+numpad sequence. This information is identical to what is given by the Window's keyboard routine OEMKeyScan.

WMHandle
Handle of the virtual machine.
entries
Number of paste entries in the paste buffer.
PasteProc
Points to callback procedure. This parameter can be 0. For more information about the callback procedure, see the following Comments section.
refdata
Address of reference data to pass to the callback procedure.

The callback procedure is called when the paste is complete or canceled. The callback receives the following input parameters:

EAX     ; Completion flags
        ; Paste_Complete - paste completed successfully
        ; Paste_Aborted  - paste canceled by user
        ; Paste_VM_Term  - paste canceled because virtual machine terminated
EBX     ; handle of virtual machine receiving the paste
EDX     ; reference data

The procedure can modify EAX, EBX, ECX, EDX, ESI, EDI, and Flags.

See Also

VKD_Define_Paste_Mode, OEMKeyScan