2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * PURPOSE: Native User stubs
5 * FILE: subsys/win32k/ntuser/stubs.c
6 * PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
8 * 04-06-2001 CSH Created
17 NtUserAssociateInputContext(
29 NtUserAttachThreadInput(
35 PETHREAD Thread
, ThreadTo
;
36 PTHREADINFO pti
, ptiTo
;
40 Status
= PsLookupThreadByThreadId((HANDLE
)idAttach
, &Thread
);
41 if (!NT_SUCCESS(Status
))
43 EngSetLastError(ERROR_INVALID_PARAMETER
);
46 Status
= PsLookupThreadByThreadId((HANDLE
)idAttachTo
, &ThreadTo
);
47 if (!NT_SUCCESS(Status
))
49 EngSetLastError(ERROR_INVALID_PARAMETER
);
50 ObDereferenceObject(Thread
);
54 pti
= PsGetThreadWin32Thread(Thread
);
55 ptiTo
= PsGetThreadWin32Thread(ThreadTo
);
56 ObDereferenceObject(Thread
);
57 ObDereferenceObject(ThreadTo
);
59 Ret
= UserAttachThreadInput( pti
, ptiTo
, fAttach
);
67 // Works like BitBlt, http://msdn.microsoft.com/en-us/library/ms532278(VS.85).aspx
84 Ret
= NtGdiBitBlt( hdc
,
114 NtUserConvertMemHandle(
125 NtUserCreateLocalMemHandle(
138 NtUserDdeGetQualityOfService(
141 OUT PSECURITY_QUALITY_OF_SERVICE pqosPrev
)
164 NtUserDdeSetQualityOfService(
166 IN PSECURITY_QUALITY_OF_SERVICE pqosNew
,
167 OUT PSECURITY_QUALITY_OF_SERVICE pqosPrev
)
191 NtUserDrawAnimatedRects(
214 NtUserExcludeUpdateRgn(
240 NtUserGetControlBrush(
252 * Called from PaintRect, works almost like wine PaintRect16 but returns hBrush.
256 NtUserGetControlColor(
260 UINT CtlMsg
) // Wine PaintRect: WM_CTLCOLORMSGBOX + hbrush
282 NtUserImpersonateDdeClientWindow(
293 NtUserInitializeClientPfnArrays(
294 PPFNCLIENT pfnClientA
,
295 PPFNCLIENT pfnClientW
,
296 PPFNCLIENTWORKER pfnClientWorker
,
299 NTSTATUS Status
= STATUS_SUCCESS
;
300 DPRINT("Enter NtUserInitializeClientPfnArrays User32 0x%x\n",hmodUser
);
302 if (ClientPfnInit
) return Status
;
304 UserEnterExclusive();
308 ProbeForRead( pfnClientA
, sizeof(PFNCLIENT
), 1);
309 ProbeForRead( pfnClientW
, sizeof(PFNCLIENT
), 1);
310 ProbeForRead( pfnClientWorker
, sizeof(PFNCLIENTWORKER
), 1);
311 RtlCopyMemory(&gpsi
->apfnClientA
, pfnClientA
, sizeof(PFNCLIENT
));
312 RtlCopyMemory(&gpsi
->apfnClientW
, pfnClientW
, sizeof(PFNCLIENT
));
313 RtlCopyMemory(&gpsi
->apfnClientWorker
, pfnClientWorker
, sizeof(PFNCLIENTWORKER
));
315 //// FIXME! HAX! Temporary until server side is finished.
316 //// Copy the client side procs for now.
317 RtlCopyMemory(&gpsi
->aStoCidPfn
, pfnClientW
, sizeof(gpsi
->aStoCidPfn
));
319 hModClient
= hmodUser
;
320 ClientPfnInit
= TRUE
;
322 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
324 Status
=_SEH2_GetExceptionCode();
328 if (!NT_SUCCESS(Status
))
330 DPRINT1("Failed reading Client Pfns from user space.\n");
331 SetLastNtError(Status
);
361 NtUserLockWorkStation(VOID
)
370 NtUserMNDragLeave(VOID
)
390 NtUserModifyUserStartupInfoFlags(
401 NtUserNotifyIMEStatus(
413 NtUserQueryUserCounters(
427 NtUserRegisterTasklist(
437 NtUserSetConsoleReserveKeys(
487 IN CONST INT
*lpaElements
,
488 IN CONST COLORREF
*lpaRgbValues
,
496 /* We need this check to prevent overflow later */
497 if ((ULONG
)cElements
>= 0x40000000)
499 EngSetLastError(ERROR_NOACCESS
);
503 UserEnterExclusive();
507 ProbeForRead(lpaElements
, cElements
* sizeof(INT
), 1);
508 ProbeForRead(lpaRgbValues
, cElements
* sizeof(COLORREF
), 1);
510 IntSetSysColors(cElements
, lpaElements
, lpaRgbValues
);
512 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
514 SetLastNtError(_SEH2_GetExceptionCode());
521 UserSendNotifyMessage(HWND_BROADCAST
, WM_SYSCOLORCHANGE
, 0, 0);
532 NtUserSetThreadState(
543 NtUserUpdateInputContext(
555 NtUserUpdateInstance(
567 NtUserUserHandleGrantAccess(
568 IN HANDLE hUserHandle
,
579 NtUserWaitForMsgAndEvent(
589 NtUserWin32PoolAllocationStats(
604 NtUserYieldTask(VOID
)
614 NtUserCheckImeHotKey(
624 NtUserConsoleControl(
635 NtUserCreateInputContext(
644 NtUserDestroyInputContext(
653 NtUserDisableThreadIme(
662 NtUserGetAppImeLevel(
691 NtUserGetRawInputBuffer(
702 NtUserGetRawInputData(
715 NtUserGetRawInputDeviceInfo(
728 NtUserGetRawInputDeviceList(
729 PRAWINPUTDEVICELIST pRawInputDeviceList
,
739 NtUserGetRegisteredRawInputDevices(
740 PRAWINPUTDEVICE pRawInputDevices
,
750 NtUserHardErrorControl(
763 UINT cmd
, // Wine SW_ commands
770 DPRINT("Enter NtUserMinMaximize\n");
771 UserEnterExclusive();
773 pWnd
= UserGetWindowObject(hWnd
);
774 if ( !pWnd
|| // FIXME:
775 pWnd
== IntGetDesktopWindow() || // pWnd->fnid == FNID_DESKTOP
776 pWnd
== IntGetMessageWindow() ) // pWnd->fnid == FNID_MESSAGEWND
781 if ( cmd
> SW_MAX
|| pWnd
->state2
& WNDS2_INDESTROY
)
783 EngSetLastError(ERROR_INVALID_PARAMETER
);
787 co_WinPosMinMaximize(pWnd
, cmd
, &NewPos
);
789 SwFlags
= Hide
? SWP_NOACTIVATE
|SWP_NOZORDER
|SWP_FRAMECHANGED
: SWP_NOZORDER
|SWP_FRAMECHANGED
;
791 co_WinPosSetWindowPos( pWnd
,
799 co_WinPosShowWindow(pWnd
, cmd
);
802 DPRINT("Leave NtUserMinMaximize\n");
804 return 0; // Always NULL?
809 NtUserNotifyProcessCreate(
821 NtUserProcessConnect(
823 PUSERCONNECT pUserConnect
,
826 NTSTATUS Status
= STATUS_SUCCESS
;
827 DPRINT("NtUserProcessConnect\n");
828 if (pUserConnect
&& ( Size
== sizeof(USERCONNECT
) ))
830 PPROCESSINFO W32Process
;
833 W32Process
= PsGetCurrentProcessWin32Process();
836 pUserConnect
->siClient
.psi
= gpsi
;
837 pUserConnect
->siClient
.aheList
= gHandleTable
;
838 pUserConnect
->siClient
.ulSharedDelta
= (ULONG_PTR
)W32Process
->HeapMappings
.KernelMapping
-
839 (ULONG_PTR
)W32Process
->HeapMappings
.UserMapping
;
841 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
843 Status
= _SEH2_GetExceptionCode();
846 if (!NT_SUCCESS(Status
))
848 SetLastNtError(Status
);
853 return STATUS_UNSUCCESSFUL
;
858 NtUserQueryInformationThread(
871 NtUserQueryInputContext(
881 NtUserRealInternalGetMessage(
895 NtUserRealWaitMessageEx(
905 NtUserRegisterUserApiHook(
906 PUNICODE_STRING m_dllname1
,
907 PUNICODE_STRING m_funname1
,
911 UserEnterExclusive();
919 NtUserRegisterRawInputDevices(
920 IN PCRAWINPUTDEVICE pRawInputDevices
,
921 IN UINT uiNumDevices
,
930 NtUserResolveDesktop(
942 NtUserSetAppImeLevel(
961 NtUserSetInformationProcess(
973 NtUserSetInformationThread(IN HANDLE ThreadHandle
,
974 IN USERTHREADINFOCLASS ThreadInformationClass
,
975 IN PVOID ThreadInformation
,
976 IN ULONG ThreadInformationLength
)
979 if (ThreadInformationClass
== UserThreadInitiateShutdown
)
981 DPRINT1("Shutdown initiated\n");
983 else if (ThreadInformationClass
== UserThreadEndShutdown
)
985 DPRINT1("Shutdown ended\n");
992 return STATUS_SUCCESS
;
997 NtUserSetThreadLayoutHandles(
1007 NtUserSoundSentry(VOID
)
1015 NtUserTestForInteractiveUser(
1022 /* http://www.cyber-ta.org/releases/malware-analysis/public/SOURCES/b47155634ccb2c30630da7e3666d3d07/b47155634ccb2c30630da7e3666d3d07.trace.html#NtUserGetIconSize */
1052 NtUserUnregisterUserApiHook(VOID
)
1060 NtUserGetLayeredWindowAttributes(
1072 NtUserValidateTimerCallback(
1081 Ret
= ValidateTimerCallback(PsGetCurrentThreadWin32Thread(), lParam
);
1089 NtUserRemoteConnect(
1100 NtUserRemoteRedrawRectangle(
1112 NtUserRemoteRedrawScreen(VOID
)
1120 NtUserRemoteStopScreenUpdates(VOID
)
1128 NtUserCtxDisplayIOCtl(
1142 NtUserDrawMenuBarTemp(
1149 /* we'll use this function just for caching the menu bar */
1155 * FillWindow: Called from User; Dialog, Edit and ListBox procs during a WM_ERASEBKGND.
1161 NtUserFillWindow(HWND hWndPaint
,
1175 NtUserFlashWindowEx(IN PFLASHWINFO pfwi
)
1186 NtUserLockWindowUpdate(HWND hWnd
)
1197 NtUserRealChildWindowFromPoint(HWND Parent
,
1210 NtUserSetImeOwnerWindow(DWORD Unknown0
,
1222 NtUserSetInternalWindowPos(
1237 NtUserSetLayeredWindowAttributes(HWND hwnd
,
1251 NtUserUpdateLayeredWindow(
1259 BLENDFUNCTION
*pblend
,
1272 NtUserWindowFromPhysicalPoint(POINT Point
)
1280 * NtUserResolveDesktopForWOW
1287 NtUserResolveDesktopForWOW(DWORD Unknown0
)
1307 /* NOTE: unused function */
1309 NtUserTrackPopupMenuEx(
1323 NtUserQuerySendMessage(DWORD Unknown0
)
1334 NtUserAlterWindowStyle(DWORD Unknown0
,
1344 * NtUserSetWindowStationUser
1351 NtUserSetWindowStationUser(
1362 BOOL APIENTRY
NtUserAddClipboardFormatListener(
1370 BOOL APIENTRY
NtUserRemoveClipboardFormatListener(
1378 BOOL APIENTRY
NtUserGetUpdatedClipboardFormats(
1393 NtUserGetCursorFrameInfo(
1409 NtUserSetSystemCursor(