我用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