我已经用我自己的函数 MyNtUserShowWindow 替换了 ssdt shadow 中的 NtUserShowWindow 函数。但是在 MyNtUserShowWindow 函数中,我调用 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
}
......
}