游客
游客
阅读:2710回复:0

各位高手大哥,请您们救救我!(OpenVxDHandle)我的时间不多了!

楼主#
更多 发布于:2001-04-28 16:56
各位高手大哥,请您们救救我!OpenVxDHandle是否是Bill 的隐密私货?在VXD与Win32应用程序双向通信的设计中,我采用事件机制,在Ring3级我用以下代码将 事件 Handle 转换成Ring0级Handle ,但是我显示出来的Handle 确是下面这样:(屏幕数据)
--------------------------------
The EventHandle has casted
The hEventR3 is 20
The hEventR0 is -1051530960 //Note hEventR0 is negative
The child thread now runing
Press any key to exit . . .
.
.
.
---------------------------------
由与以上原因导致VxD无法唤醒(VWIN32_SetWin32Event) Ring3 级的Service Thread.
请各位高手尽可能的小弟详细解答。我在此向您们作揖了。

/// Ring3 apps


// -------------------------------------------------------------------------
// GetAddressOfOpenVxDHandle
//
// This function returns the address of OpenVxDHandle. OpenVxDHandle is a
// KERNEL32 function that returns a ring 0 event handle that corresponds to a
// given ring 3 event handle. The ring 0 handle can be used by VxDs to
// synchronize with the Win32 app.
//
HANDLE (WINAPI *GetAddressOfOpenVxDHandle(void))(HANDLE)
{
CHAR K32Path[MAX_PATH];
HINSTANCE hK32;

GetSystemDirectory(K32Path, MAX_PATH);
strcat(K32Path, "\\kernel32.dll");
if ((hK32 = LoadLibrary(K32Path)) == 0)
return NULL;

return (HANDLE(WINAPI *)(HANDLE))GetProcAddress(hK32, "OpenVxDHandle");
}


// -------------------------------------------------------------------------
// CreateCommonEvent
//
// This function creates a synchronization event, and obtains the
// corresponding ring 0 event handle.
//
// Parameters:
// pr3Evt location to receive ring 3 event handle
// pr0Evt location to receive ring 0 event handle
// bManualReset input TRUE if event should be reset only manually
// bInitialState input TRUE if event should be initially signalled,
//
// Returns:
// Returns TRUE if successful.
//
BOOL CreateCommonEvent(HANDLE* pr3Evt, HANDLE* pr0Evt, BOOL bManualReset,
BOOL bInitialState)
{
static HANDLE (WINAPI *pOpenVxDHandle)(HANDLE)=0;

*pr3Evt = CreateEvent(0, bManualReset, bInitialState, NULL);

if (pOpenVxDHandle == 0)
pOpenVxDHandle = GetAddressOfOpenVxDHandle();

if (pOpenVxDHandle && *pr3Evt)
*pr0Evt = pOpenVxDHandle(*pr3Evt);
else
*pr0Evt = 0;

return ( (*pr3Evt != 0) && (*pr0Evt != 0) );
}

//////////////////
游客

返回顶部