首页
社区
课程
招聘
[求助]NtUserQueryWindow的参数问题
发表于: 2014-1-7 00:13 7032

[求助]NtUserQueryWindow的参数问题

2014-1-7 00:13
7032
QUERY_WINDOW_UNIQUE_PROCESS_ID这个CASE和QUERY_WINDOW_REAL_ID
有啥不一样
我看到的都是返回一个进程的ID
我用这个的时候返回全部都是0

DWORD APIENTRY
NtUserQueryWindow(HWND hWnd, DWORD Index)
{
   PWND pWnd;
   DWORD Result;
   DECLARE_RETURN(UINT);

   TRACE("Enter NtUserQueryWindow\n");
   UserEnterShared();

   if (!(pWnd = UserGetWindowObject(hWnd)))
   {
      RETURN( 0);
   }

   switch(Index)
   {
      case QUERY_WINDOW_UNIQUE_PROCESS_ID:
         Result = (DWORD)IntGetWndProcessId(pWnd);
         break;

      case QUERY_WINDOW_UNIQUE_THREAD_ID:
         Result = (DWORD)IntGetWndThreadId(pWnd);
         break;

      case QUERY_WINDOW_ACTIVE:
         Result = (DWORD)(pWnd->head.pti->MessageQueue->spwndActive ? UserHMGetHandle(pWnd->head.pti->MessageQueue->spwndActive) : 0);
         break;

      case QUERY_WINDOW_FOCUS:
         Result = (DWORD)(pWnd->head.pti->MessageQueue->spwndFocus ? UserHMGetHandle(pWnd->head.pti->MessageQueue->spwndFocus) : 0);
         break;

      case QUERY_WINDOW_ISHUNG:
         Result = (DWORD)MsqIsHung(pWnd->head.pti->MessageQueue);
         break;

      case QUERY_WINDOW_REAL_ID:
         Result = (DWORD)pWnd->head.pti->pEThread->Cid.UniqueProcess;
         break;

      case QUERY_WINDOW_FOREGROUND:
         Result = (pWnd->head.pti->MessageQueue == gpqForeground);
         break;

      default:
         Result = (DWORD)NULL;
         break;
   }

   RETURN( Result);

CLEANUP:
   TRACE("Leave NtUserQueryWindow, ret=%i\n",_ret_);
   UserLeave();
   END_CLEANUP;
}

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费 0
支持
分享
最新回复 (0)
游客
登录 | 注册 方可回帖
返回
//