Hook_Device_Service

include vmm.inc

mov eax, Service ; specifies the service to hook

mov esi, OFFSET32 HookProc ; points to the hook procedure to install

VMMcall Hook_Device_Service

jc not_installed ; carry flag set if error

mov [Real_Proc], esi


The Hook_Device_Service service allows one virtual device to monitor or replace the services of another virtual device, or of the VMM itself.

Parameters

Service

Specifies the virtual device or VMM service to hook.

HookProc

Points to the hook procedure to install. The hook procedure is called with the same parameters as the service specified by the Service parameter.

Return Value

The carry flag is clear and the ESI register contains the address of the service specified by the Service parameter if this service is successful. Otherwise, the carry flag is set to indicate an error.

Comments

Virtual devices that use this service must use extreme care to preserve the full functionality of the virtual device whose services are monitored or replaced.

More than one virtual device can hook a device service. The last hook installed is the first one called.

The hook procedure must save and restore registers that are not modified by the hooked service. Also, if flags are a passed as an entry or exit parameter, the hook procedure must also preserve the flags.

If the hooked service uses the C calling convention, the hook procedure must copy the entire parameter stack frame before attempting to call the hooked service.

Uses

ESI, Flags