我用ssdt陰影中的NtUserShowWindow函數替換了我自己的函數MyNtUserShowWindow。但在MyNtUserShowWindow函數中,我調用了NtUserInternalGetWindowText函數來嘗試獲取窗口標題,但它始終返回0(表示失敗)。 我不知道爲什麼?爲什麼NtUserInternalGetWindowText在內核模式下總是返回0
一些代碼的打擊:
BOOL MyNtUserShowWindow(
IN HWND hWnd,
IN int nCmdShow)
{
LPWSTR buffer = NULL;
SIZE_T memSize;
int strLen;
NTSTATUS status;
memSize = MAX_PATH + 1;
if (NT_SUCCESS(ZwAllocateVirtualMemory(ZwCurrentProcess(),
&buffer,
0,
&memSize,
MEM_COMMIT | MEM_RESERVE | MEM_TOP_DOWN,
PAGE_READWRITE)))
{
strLen = NtUserInternalGetWindowText(hWnd, buffer, MAX_PATH);
KdPrint(("the get window len is %d, buffer is %S\n", strLen, buffer)); // strLen = 0
}
......
}
謝謝。我正常操作窗口。糾正緩衝區大小後,仍然失敗。順便說一下,我認爲NtUserShowWindow或NtUserIntenalGetWindowText函數是在PASSIVE級別運行的,所以不需要在內核模式下創建內存,這些地址在同一個進程中。是嗎? – 2013-05-06 13:59:03