SAMPLE: Calling PostMessage from a Virtual Device (VxD)Last reviewed: February 15, 1996Article ID: Q72899 |
The information in this article applies to:
SUMMARYIn the Microsoft Windows graphical environment, a virtual device (VxD) can indirectly call the PostMessage function. This enables any virtual machine (VM) to communicate with the system VM. The text below briefly describes the steps necessary for this communication. For more information, refer to the VPOSTD file, which implements the techniques discussed below. Download VPOSTD.EXE, a self-extracting file, from the Microsoft Software Library (MSL) on the following services:
MORE INFORMATIONAlthough a VxD cannot directly call the PostMessage function, a VxD can call a callback function in a Windows dynamic-link library (DLL), which can in turn call PostMessage. To accomplish this communication, the callback function called by the VxD must reside in a FIXED code segment of a DLL. Any data accessed by the callback routine must be placed in a FIXED data segment. This is necessary because the callback routine is very similar to an interrupt service routine (ISR). Required code and data must be available in memory at all times. FIXED code and data segments of a Windows DLL are page locked by the Windows memory manager, which keeps the segments present in memory. The callback routine can call only the PostMessage and PostAppMessage functions, because these are the only reentrant Windows functions. The DLL can't call any other Windows functions. To communicate with the system VM, the VxD must provide a protected mode API through which the DLL can register the address of its callback function. When the VxD receives an event that generates a message, the VxD schedules the system VM for execution. It may also be necessary to wait for the critical section to be free and for interrupts to be enabled. The virtual machine manager (VMM) provides a service called Call_Priority_VM_Event, which is designed for situations such as this. When the System VM is scheduled and is in an appropriate state, the VxD can use the VMM service Simulate_Far_Call to call the DLL, which can then call PostMessage. Refer to the "Microsoft Windows Device Driver Kit: Virtual Device Adaptation Guide" (VDAG) for documentation on the VMM services. VPOSTD provides the full source listing for a VxD and DLL, which demonstrates everything required to implement the architecture discussed above.
|
Additional reference words: 3.00 3.10 DDKVXD softlib VPOSTD.EXE
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |