Introduction to Virtual Device Drivers


Windows Calling Conventions



Download 274.5 Kb.
Page45/80
Date19.01.2022
Size274.5 Kb.
#58083
1   ...   41   42   43   44   45   46   47   48   ...   80
VXDS

Windows Calling Conventions


This manual presents the syntax of most functions in C-language notation. All such functions are assumed to be declared as FAR PASCAL functions, and Windows will call these functions as such. In general, exported functions in a device driver must execute the standard Windows prolog on entry and epilog on exit.

The following list highlights the calling conventions:



  • Set the DS register to the selector of the driver's automatic data segment.

  • Save and restore the following registers if used: SS, SP, BP, SI, DI, and DS.

  • Clear the direction flag if it has been set or modified.

  • Place 16-bit return values in the AX register; 32-bit values in the DX:AX register pair.

  • Execute a FAR return.

Windows pushes all parameters on the stack in a left to right order (the last parameter shown in the function syntax is closest to the stack pointer). Windows also passes pointer parameters as 32-bit quantities, pushing the selector first then the offset. This allows exported functions to use the lds or les instructions to retrieve pointers from the stack.

Download 274.5 Kb.

Share with your friends:
1   ...   41   42   43   44   45   46   47   48   ...   80




The database is protected by copyright ©ininet.org 2024
send message

    Main page