本文整理汇总了C++中PsGetCurrentThreadWin32Thread函数的典型用法代码示例。如果您正苦于以下问题:C++ PsGetCurrentThreadWin32Thread函数的具体用法?C++ PsGetCurrentThreadWin32Thread怎么用?C++ PsGetCurrentThreadWin32Thread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PsGetCurrentThreadWin32Thread函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UserSendMouseInput
/*
* UserSendMouseInput
*
* Process mouse input from input devices and SendInput API
*/
BOOL NTAPI
UserSendMouseInput(MOUSEINPUT *pmi, BOOL bInjected)
{
POINT ptCursor;
PSYSTEM_CURSORINFO pCurInfo;
MSG Msg;
DWORD dwFlags;
ASSERT(pmi);
pCurInfo = IntGetSysCursorInfo();
ptCursor = gpsi->ptCursor;
dwFlags = IntFixMouseInputButtons(pmi->dwFlags);
gppiInputProvider = ((PTHREADINFO)PsGetCurrentThreadWin32Thread())->ppi;
if (pmi->dwFlags & MOUSEEVENTF_MOVE)
{
/* Mouse has changes position */
if (!(pmi->dwFlags & MOUSEEVENTF_ABSOLUTE))
{
/* Relative move */
ptCursor.x += pmi->dx;
ptCursor.y += pmi->dy;
}
else if (pmi->dwFlags & MOUSEEVENTF_VIRTUALDESK)
{
/* Absolute move in virtual screen units */
ptCursor.x = pmi->dx * UserGetSystemMetrics(SM_CXVIRTUALSCREEN) >> 16;
ptCursor.y = pmi->dy * UserGetSystemMetrics(SM_CYVIRTUALSCREEN) >> 16;
}
else
{
示例2: UserUnregisterUserApiHook
BOOL
FASTCALL
UserUnregisterUserApiHook(VOID)
{
PTHREADINFO pti;
pti = PsGetCurrentThreadWin32Thread();
/* Fail if the api hook is not registered */
if(!(gpsi->dwSRVIFlags & SRVINFO_APIHOOK))
{
return FALSE;
}
/* Only the process that registered the api hook can uregister it */
if(ppiUahServer != PsGetCurrentProcessWin32Process())
{
return FALSE;
}
ERR("UserUnregisterUserApiHook. Server PID: %p\n", PsGetProcessId(pti->ppi->peProcess));
/* Unregister the api hook */
gpsi->dwSRVIFlags &= ~SRVINFO_APIHOOK;
ppiUahServer = NULL;
ReleaseCapturedUnicodeString(&strUahModule, UserMode);
ReleaseCapturedUnicodeString(&strUahInitFunc, UserMode);
/* Notify all applications that the api hook module must be unloaded */
return IntHookModuleUnloaded(pti->rpdesk, WH_APIHOOK, 0);
}
示例3: IntGetCaretBlinkTime
static
UINT FASTCALL
IntGetCaretBlinkTime(VOID)
{
PTHREADINFO pti;
PWINSTATION_OBJECT WinStaObject;
UINT Ret;
pti = PsGetCurrentThreadWin32Thread();
WinStaObject = pti->rpdesk->rpwinstaParent;
Ret = WinStaObject->CaretBlinkRate;
if(!Ret)
{
/* load it from the registry the first call only! */
Ret = WinStaObject->CaretBlinkRate = IntQueryCaretBlinkRate();
}
/* windows doesn't do this check */
if((Ret < MIN_CARETBLINKRATE) || (Ret > MAX_CARETBLINKRATE))
{
Ret = DEFAULT_CARETBLINKRATE;
}
return Ret;
}
示例4: IntGetAtomName
ULONG FASTCALL
IntGetAtomName(RTL_ATOM nAtom, LPWSTR lpBuffer, ULONG nSize)
{
NTSTATUS Status = STATUS_SUCCESS;
PTHREADINFO pti;
ULONG Size = nSize;
pti = PsGetCurrentThreadWin32Thread();
if (pti->rpdesk == NULL)
{
SetLastNtError(Status);
return 0;
}
Status = RtlQueryAtomInAtomTable(gAtomTable, nAtom, NULL, NULL, lpBuffer, &Size);
if (Size < nSize)
*(lpBuffer + Size) = 0;
if (!NT_SUCCESS(Status))
{
SetLastNtError(Status);
return 0;
}
return Size;
}
示例5: co_UserShowCaret
BOOL FASTCALL co_UserShowCaret(PWND Window OPTIONAL)
{
PTHREADINFO pti;
PUSER_MESSAGE_QUEUE ThreadQueue;
PWND pWnd = NULL;
if (Window) ASSERT_REFS_CO(Window);
if(Window && Window->head.pti->pEThread != PsGetCurrentThread())
{
EngSetLastError(ERROR_ACCESS_DENIED);
return FALSE;
}
pti = PsGetCurrentThreadWin32Thread();
ThreadQueue = pti->MessageQueue;
if(Window && ThreadQueue->CaretInfo->hWnd != Window->head.h)
{
EngSetLastError(ERROR_ACCESS_DENIED);
return FALSE;
}
if (!ThreadQueue->CaretInfo->Visible)
{
ThreadQueue->CaretInfo->Visible = 1;
pWnd = ValidateHwndNoErr(ThreadQueue->CaretInfo->hWnd);
if (!ThreadQueue->CaretInfo->Showing && pWnd)
{
IntNotifyWinEvent(EVENT_OBJECT_SHOW, pWnd, OBJID_CARET, OBJID_CARET, 0);
}
IntSetTimer(pWnd, IDCARETTIMER, gpsi->dtCaretBlink, CaretSystemTimerProc, TMRF_SYSTEM);
}
return TRUE;
}
示例6: NtUserCallNoParam
/*
* @unimplemented
*/
DWORD_PTR
APIENTRY
NtUserCallNoParam(DWORD Routine)
{
DWORD_PTR Result = 0;
DECLARE_RETURN(DWORD_PTR);
TRACE("Enter NtUserCallNoParam\n");
UserEnterExclusive();
switch(Routine)
{
case NOPARAM_ROUTINE_CREATEMENU:
Result = (DWORD_PTR)UserCreateMenu(FALSE);
break;
case NOPARAM_ROUTINE_CREATEMENUPOPUP:
Result = (DWORD_PTR)UserCreateMenu(TRUE);
break;
case NOPARAM_ROUTINE_DESTROY_CARET:
Result = (DWORD_PTR)co_IntDestroyCaret(PsGetCurrentThread()->Tcb.Win32Thread);
break;
case NOPARAM_ROUTINE_INIT_MESSAGE_PUMP:
Result = (DWORD_PTR)IntInitMessagePumpHook();
break;
case NOPARAM_ROUTINE_UNINIT_MESSAGE_PUMP:
Result = (DWORD_PTR)IntUninitMessagePumpHook();
break;
case NOPARAM_ROUTINE_GETMESSAGEEXTRAINFO:
Result = (DWORD_PTR)MsqGetMessageExtraInfo();
break;
case NOPARAM_ROUTINE_MSQCLEARWAKEMASK:
RETURN( (DWORD_PTR)IntMsqClearWakeMask());
case NOPARAM_ROUTINE_GETMSESSAGEPOS:
{
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
RETURN( (DWORD_PTR)MAKELONG(pti->ptLast.x, pti->ptLast.y));
}
case NOPARAM_ROUTINE_RELEASECAPTURE:
RETURN( (DWORD_PTR)IntReleaseCapture());
default:
ERR("Calling invalid routine number 0x%x in NtUserCallNoParam\n", Routine);
EngSetLastError(ERROR_INVALID_PARAMETER);
break;
}
RETURN(Result);
CLEANUP:
TRACE("Leave NtUserCallNoParam, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
}
示例7: co_IntSetCaretPos
BOOL FASTCALL
co_IntSetCaretPos(int X, int Y)
{
PTHREADINFO pti;
PWND pWnd;
PUSER_MESSAGE_QUEUE ThreadQueue;
pti = PsGetCurrentThreadWin32Thread();
ThreadQueue = pti->MessageQueue;
if(ThreadQueue->CaretInfo->hWnd)
{
pWnd = UserGetWindowObject(ThreadQueue->CaretInfo->hWnd);
if(ThreadQueue->CaretInfo->Pos.x != X || ThreadQueue->CaretInfo->Pos.y != Y)
{
co_IntHideCaret(ThreadQueue->CaretInfo);
ThreadQueue->CaretInfo->Showing = 0;
ThreadQueue->CaretInfo->Pos.x = X;
ThreadQueue->CaretInfo->Pos.y = Y;
IntSetTimer(pWnd, IDCARETTIMER, gpsi->dtCaretBlink, CaretSystemTimerProc, TMRF_SYSTEM);
IntNotifyWinEvent(EVENT_OBJECT_LOCATIONCHANGE, pWnd, OBJID_CARET, CHILDID_SELF, 0);
}
return TRUE;
}
return FALSE;
}
示例8: UserSetClipboardData
HANDLE NTAPI
UserSetClipboardData(UINT fmt, HANDLE hData, PSETCLIPBDATA scd)
{
HANDLE hRet = NULL;
PWINSTATION_OBJECT pWinStaObj = NULL;
pWinStaObj = IntGetWinStaForCbAccess();
if (!pWinStaObj)
goto cleanup;
/* If it's delayed rendering we don't have to open clipboard */
if ((pWinStaObj->fInDelayedRendering &&
pWinStaObj->spwndClipOwner->head.pti != PsGetCurrentThreadWin32Thread()) ||
!IntIsClipboardOpenByMe(pWinStaObj))
{
ERR("Access denied!\n");
EngSetLastError(ERROR_CLIPBOARD_NOT_OPEN);
goto cleanup;
}
if (scd->fIncSerialNumber)
pWinStaObj->iClipSerialNumber++;
/* Is it a delayed render? */
if (hData)
{
/* Is it a bitmap? */
if (fmt == CF_BITMAP)
{
/* Make bitmap public */
GreSetObjectOwner(hData, GDI_OBJ_HMGR_PUBLIC);
}
/* Save data in the clipboard */
IntAddFormatedData(pWinStaObj, fmt, hData, scd->fGlobalHandle, FALSE);
TRACE("hData stored\n");
pWinStaObj->iClipSequenceNumber++;
pWinStaObj->fClipboardChanged = TRUE;
/* Note: Synthesized formats are added in NtUserCloseClipboard */
}
else
{
/* This is a delayed render */
IntAddFormatedData(pWinStaObj, fmt, DATA_DELAYED, FALSE, FALSE);
TRACE("SetClipboardData delayed format: %u\n", fmt);
}
/* Return hData on success */
hRet = hData;
cleanup:
TRACE("NtUserSetClipboardData returns: %p\n", hRet);
if(pWinStaObj)
ObDereferenceObject(pWinStaObj);
return hRet;
}
示例9: co_IntLoadDefaultCursors
BOOL APIENTRY
co_IntLoadDefaultCursors(VOID)
{
NTSTATUS Status;
PVOID ResultPointer;
ULONG ResultLength;
BOOL DefaultCursor = TRUE;
/* Do not allow the desktop thread to do callback to user mode */
ASSERT(PsGetCurrentThreadWin32Thread() != gptiDesktopThread);
ResultPointer = NULL;
ResultLength = sizeof(HCURSOR);
UserLeaveCo();
Status = KeUserModeCallback(USER32_CALLBACK_LOADDEFAULTCURSORS,
&DefaultCursor,
sizeof(BOOL),
&ResultPointer,
&ResultLength);
UserEnterCo();
/* HACK: The desktop class doen't have a proper cursor yet, so set it here */
gDesktopCursor = *((HCURSOR*)ResultPointer);
if (!NT_SUCCESS(Status))
{
return FALSE;
}
return TRUE;
}
示例10: NtUserGetCaretPos
BOOL
APIENTRY
NtUserGetCaretPos(
LPPOINT lpPoint)
{
PTHREADINFO pti;
PUSER_MESSAGE_QUEUE ThreadQueue;
NTSTATUS Status;
DECLARE_RETURN(BOOL);
TRACE("Enter NtUserGetCaretPos\n");
UserEnterShared();
pti = PsGetCurrentThreadWin32Thread();
ThreadQueue = pti->MessageQueue;
Status = MmCopyToCaller(lpPoint, &(ThreadQueue->CaretInfo->Pos), sizeof(POINT));
if(!NT_SUCCESS(Status))
{
SetLastNtError(Status);
RETURN(FALSE);
}
RETURN(TRUE);
CLEANUP:
TRACE("Leave NtUserGetCaretPos, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
}
示例11: NtUserSetThreadState
DWORD
APIENTRY
NtUserSetThreadState(
DWORD Set,
DWORD Flags)
{
PTHREADINFO pti;
DWORD Ret = 0;
// Test the only flags user can change.
if (Set & ~(QF_FF10STATUS|QF_DIALOGACTIVE|QF_TABSWITCHING|QF_FMENUSTATUS|QF_FMENUSTATUSBREAK)) return 0;
if (Flags & ~(QF_FF10STATUS|QF_DIALOGACTIVE|QF_TABSWITCHING|QF_FMENUSTATUS|QF_FMENUSTATUSBREAK)) return 0;
UserEnterExclusive();
pti = PsGetCurrentThreadWin32Thread();
if (pti->MessageQueue)
{
Ret = pti->MessageQueue->QF_flags; // Get the queue flags.
if (Set)
pti->MessageQueue->QF_flags |= (Set&Flags); // Set the queue flags.
else
{
if (Flags) pti->MessageQueue->QF_flags &= ~Flags; // Clr the queue flags.
}
}
UserLeave();
return Ret;
}
示例12: NtUserGetKeyboardLayoutName
/*
* NtUserGetKeyboardLayoutName
*
* Returns KLID of current thread keyboard layout
*/
BOOL
APIENTRY
NtUserGetKeyboardLayoutName(
LPWSTR pwszName)
{
BOOL bRet = FALSE;
PKL pKl;
PTHREADINFO pti;
UserEnterShared();
pti = PsGetCurrentThreadWin32Thread();
pKl = pti->KeyboardLayout;
if (!pKl)
goto cleanup;
_SEH2_TRY
{
ProbeForWrite(pwszName, KL_NAMELENGTH*sizeof(WCHAR), 1);
wcscpy(pwszName, pKl->spkf->awchKF);
bRet = TRUE;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
SetLastNtError(_SEH2_GetExceptionCode());
}
_SEH2_END;
cleanup:
UserLeave();
return bRet;
}
示例13: UserGetKeyboardLayout
/*
* UserGetKeyboardLayout
*
* Returns hkl of given thread keyboard layout
*/
HKL FASTCALL
UserGetKeyboardLayout(
DWORD dwThreadId)
{
NTSTATUS Status;
PETHREAD pThread;
PTHREADINFO pti;
PKL pKl;
HKL hKl;
if (!dwThreadId)
{
pti = PsGetCurrentThreadWin32Thread();
pKl = pti->KeyboardLayout;
return pKl ? pKl->hkl : NULL;
}
Status = PsLookupThreadByThreadId((HANDLE)(DWORD_PTR)dwThreadId, &pThread);
if (!NT_SUCCESS(Status))
{
EngSetLastError(ERROR_INVALID_PARAMETER);
return NULL;
}
pti = PsGetThreadWin32Thread(pThread);
pKl = pti->KeyboardLayout;
hKl = pKl ? pKl->hkl : NULL;;
ObDereferenceObject(pThread);
return hKl;
}
示例14: co_UserHideCaret
BOOL FASTCALL co_UserHideCaret(PWND Window OPTIONAL)
{
PTHREADINFO pti;
PUSER_MESSAGE_QUEUE ThreadQueue;
if (Window) ASSERT_REFS_CO(Window);
if(Window && Window->head.pti->pEThread != PsGetCurrentThread())
{
EngSetLastError(ERROR_ACCESS_DENIED);
return FALSE;
}
pti = PsGetCurrentThreadWin32Thread();
ThreadQueue = pti->MessageQueue;
if(Window && ThreadQueue->CaretInfo->hWnd != Window->head.h)
{
EngSetLastError(ERROR_ACCESS_DENIED);
return FALSE;
}
if(ThreadQueue->CaretInfo->Visible)
{
PWND pwnd = UserGetWindowObject(ThreadQueue->CaretInfo->hWnd);
IntKillTimer(pwnd, IDCARETTIMER, TRUE);
co_IntHideCaret(ThreadQueue->CaretInfo);
ThreadQueue->CaretInfo->Visible = 0;
ThreadQueue->CaretInfo->Showing = 0;
}
return TRUE;
}
示例15: IntClipboardFreeWindow
/* IntClipboardFreeWindow it's called when a window was destroyed */
VOID FASTCALL
IntClipboardFreeWindow(PWND window)
{
/* called from co_UserFreeWindow in window.c */
/* check if clipboard is not locked by this window, if yes, unlock it */
if (ClipboardThread == PsGetCurrentThreadWin32Thread())
{
/* the window that opens the clipboard was destroyed */
ClipboardThread = NULL;
ClipboardWindow = NULL;
//TODO: free clipboard
}
if (window == ClipboardOwnerWindow)
{
/* the owner window was destroyed */
ClipboardOwnerWindow = NULL;
ClipboardOwnerThread = NULL;
}
/* remove window from window chain */
if (IntIsWindowInChain(window))
{
PCLIPBOARDCHAINELEMENT w = IntRemoveWindowFromChain(window);
if (w)
{
ExFreePool(w);
}
}
}