mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 18:01:07 +00:00
indent with astyle v1.15.3: --style=ansi -c -s3 -S --convert-tabs
svn path=/trunk/; revision=17730
This commit is contained in:
parent
5d8ed11b10
commit
7c6de62098
|
@ -59,13 +59,13 @@
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
InitAcceleratorImpl(VOID)
|
InitAcceleratorImpl(VOID)
|
||||||
{
|
{
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
CleanupAcceleratorImpl(VOID)
|
CleanupAcceleratorImpl(VOID)
|
||||||
{
|
{
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ static
|
||||||
PACCELERATOR_TABLE FASTCALL UserGetAccelObject(HACCEL hAccel)
|
PACCELERATOR_TABLE FASTCALL UserGetAccelObject(HACCEL hAccel)
|
||||||
{
|
{
|
||||||
PACCELERATOR_TABLE Accel= UserGetObject(&gHandleTable, hAccel, otAccel);
|
PACCELERATOR_TABLE Accel= UserGetObject(&gHandleTable, hAccel, otAccel);
|
||||||
|
|
||||||
if (Accel)
|
if (Accel)
|
||||||
{
|
{
|
||||||
ASSERT(USER_BODY_TO_HEADER(Accel)->RefCount >= 0);
|
ASSERT(USER_BODY_TO_HEADER(Accel)->RefCount >= 0);
|
||||||
|
@ -92,132 +92,132 @@ PACCELERATOR_TABLE FASTCALL UserGetAccelObject(HACCEL hAccel)
|
||||||
int
|
int
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserCopyAcceleratorTable(
|
NtUserCopyAcceleratorTable(
|
||||||
HACCEL hAccel,
|
HACCEL hAccel,
|
||||||
LPACCEL Entries,
|
LPACCEL Entries,
|
||||||
int EntriesCount)
|
int EntriesCount)
|
||||||
{
|
{
|
||||||
PWINSTATION_OBJECT WindowStation;
|
PWINSTATION_OBJECT WindowStation;
|
||||||
PACCELERATOR_TABLE Accel;
|
PACCELERATOR_TABLE Accel;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
int Ret;
|
int Ret;
|
||||||
DECLARE_RETURN(int);
|
DECLARE_RETURN(int);
|
||||||
|
|
||||||
DPRINT("Enter NtUserCopyAcceleratorTable\n");
|
DPRINT("Enter NtUserCopyAcceleratorTable\n");
|
||||||
UserEnterShared();
|
UserEnterShared();
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(UserGetProcessWindowStation(),
|
Status = IntValidateWindowStationHandle(UserGetProcessWindowStation(),
|
||||||
UserMode,
|
UserMode,
|
||||||
0,
|
0,
|
||||||
&WindowStation);
|
&WindowStation);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
SetLastNtError(STATUS_ACCESS_DENIED);
|
|
||||||
RETURN(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(Accel = UserGetAccelObject(hAccel)))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ObDereferenceObject(WindowStation);
|
SetLastNtError(STATUS_ACCESS_DENIED);
|
||||||
RETURN(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Entries)
|
|
||||||
{
|
|
||||||
Ret = min(EntriesCount, Accel->Count);
|
|
||||||
Status = MmCopyToCaller(Entries, Accel->Table, Ret * sizeof(ACCEL));
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
ObDereferenceObject(WindowStation);
|
|
||||||
SetLastNtError(Status);
|
|
||||||
RETURN(0);
|
RETURN(0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Ret = Accel->Count;
|
|
||||||
}
|
|
||||||
|
|
||||||
ObDereferenceObject(WindowStation);
|
if (!(Accel = UserGetAccelObject(hAccel)))
|
||||||
|
{
|
||||||
|
ObDereferenceObject(WindowStation);
|
||||||
|
RETURN(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Entries)
|
||||||
|
{
|
||||||
|
Ret = min(EntriesCount, Accel->Count);
|
||||||
|
Status = MmCopyToCaller(Entries, Accel->Table, Ret * sizeof(ACCEL));
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ObDereferenceObject(WindowStation);
|
||||||
|
SetLastNtError(Status);
|
||||||
|
RETURN(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Ret = Accel->Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
ObDereferenceObject(WindowStation);
|
||||||
|
|
||||||
|
RETURN(Ret);
|
||||||
|
|
||||||
RETURN(Ret);
|
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserCopyAcceleratorTable, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserCopyAcceleratorTable, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
HACCEL
|
HACCEL
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserCreateAcceleratorTable(
|
NtUserCreateAcceleratorTable(
|
||||||
LPACCEL Entries,
|
LPACCEL Entries,
|
||||||
SIZE_T EntriesCount)
|
SIZE_T EntriesCount)
|
||||||
{
|
{
|
||||||
PWINSTATION_OBJECT WindowStation;
|
PWINSTATION_OBJECT WindowStation;
|
||||||
PACCELERATOR_TABLE Accel;
|
PACCELERATOR_TABLE Accel;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HACCEL hAccel;
|
HACCEL hAccel;
|
||||||
DECLARE_RETURN(HACCEL);
|
DECLARE_RETURN(HACCEL);
|
||||||
|
|
||||||
DPRINT("Enter NtUserCreateAcceleratorTable(Entries %p, EntriesCount %d)\n",
|
DPRINT("Enter NtUserCreateAcceleratorTable(Entries %p, EntriesCount %d)\n",
|
||||||
Entries, EntriesCount);
|
Entries, EntriesCount);
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(UserGetProcessWindowStation(),
|
Status = IntValidateWindowStationHandle(UserGetProcessWindowStation(),
|
||||||
UserMode,
|
UserMode,
|
||||||
0,
|
0,
|
||||||
&WindowStation);
|
&WindowStation);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
SetLastNtError(STATUS_ACCESS_DENIED);
|
|
||||||
RETURN( FALSE );
|
|
||||||
}
|
|
||||||
|
|
||||||
Accel = ObmCreateObject(&gHandleTable, (PHANDLE)&hAccel, otAccel, sizeof(ACCELERATOR_TABLE));
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
if (Accel == NULL)
|
SetLastNtError(STATUS_ACCESS_DENIED);
|
||||||
{
|
RETURN( FALSE );
|
||||||
ObDereferenceObject(WindowStation);
|
}
|
||||||
SetLastNtError(STATUS_NO_MEMORY);
|
|
||||||
RETURN( (HACCEL) 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
Accel->Count = EntriesCount;
|
Accel = ObmCreateObject(&gHandleTable, (PHANDLE)&hAccel, otAccel, sizeof(ACCELERATOR_TABLE));
|
||||||
if (Accel->Count > 0)
|
|
||||||
{
|
|
||||||
Accel->Table = ExAllocatePoolWithTag(PagedPool, EntriesCount * sizeof(ACCEL), TAG_ACCEL);
|
|
||||||
if (Accel->Table == NULL)
|
|
||||||
{
|
|
||||||
ObmDeleteObject(hAccel, otAccel);
|
|
||||||
ObDereferenceObject(WindowStation);
|
|
||||||
SetLastNtError(Status);
|
|
||||||
RETURN( (HACCEL) 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = MmCopyFromCaller(Accel->Table, Entries, EntriesCount * sizeof(ACCEL));
|
if (Accel == NULL)
|
||||||
if (!NT_SUCCESS(Status))
|
{
|
||||||
{
|
|
||||||
ExFreePool(Accel->Table);
|
|
||||||
ObmDeleteObject(hAccel, otAccel);
|
|
||||||
ObDereferenceObject(WindowStation);
|
ObDereferenceObject(WindowStation);
|
||||||
SetLastNtError(Status);
|
SetLastNtError(STATUS_NO_MEMORY);
|
||||||
RETURN((HACCEL) 0);
|
RETURN( (HACCEL) 0 );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ObDereferenceObject(WindowStation);
|
Accel->Count = EntriesCount;
|
||||||
|
if (Accel->Count > 0)
|
||||||
|
{
|
||||||
|
Accel->Table = ExAllocatePoolWithTag(PagedPool, EntriesCount * sizeof(ACCEL), TAG_ACCEL);
|
||||||
|
if (Accel->Table == NULL)
|
||||||
|
{
|
||||||
|
ObmDeleteObject(hAccel, otAccel);
|
||||||
|
ObDereferenceObject(WindowStation);
|
||||||
|
SetLastNtError(Status);
|
||||||
|
RETURN( (HACCEL) 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* FIXME: Save HandleTable in a list somewhere so we can clean it up again */
|
Status = MmCopyFromCaller(Accel->Table, Entries, EntriesCount * sizeof(ACCEL));
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ExFreePool(Accel->Table);
|
||||||
|
ObmDeleteObject(hAccel, otAccel);
|
||||||
|
ObDereferenceObject(WindowStation);
|
||||||
|
SetLastNtError(Status);
|
||||||
|
RETURN((HACCEL) 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ObDereferenceObject(WindowStation);
|
||||||
|
|
||||||
|
/* FIXME: Save HandleTable in a list somewhere so we can clean it up again */
|
||||||
|
|
||||||
|
RETURN(hAccel);
|
||||||
|
|
||||||
RETURN(hAccel);
|
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserCreateAcceleratorTable(Entries %p, EntriesCount %d) = %x\n",
|
DPRINT("Leave NtUserCreateAcceleratorTable(Entries %p, EntriesCount %d) = %x\n",
|
||||||
Entries, EntriesCount,_ret_);
|
Entries, EntriesCount,_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -225,219 +225,224 @@ CLEANUP:
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserDestroyAcceleratorTable(
|
NtUserDestroyAcceleratorTable(
|
||||||
HACCEL hAccel)
|
HACCEL hAccel)
|
||||||
{
|
{
|
||||||
PWINSTATION_OBJECT WindowStation;
|
PWINSTATION_OBJECT WindowStation;
|
||||||
PACCELERATOR_TABLE Accel;
|
PACCELERATOR_TABLE Accel;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
DECLARE_RETURN(BOOLEAN);
|
DECLARE_RETURN(BOOLEAN);
|
||||||
|
|
||||||
/* FIXME: If the handle table is from a call to LoadAcceleratorTable, decrement it's
|
/* FIXME: If the handle table is from a call to LoadAcceleratorTable, decrement it's
|
||||||
usage count (and return TRUE).
|
usage count (and return TRUE).
|
||||||
FIXME: Destroy only tables created using CreateAcceleratorTable.
|
FIXME: Destroy only tables created using CreateAcceleratorTable.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DPRINT("NtUserDestroyAcceleratorTable(Table %x)\n", hAccel);
|
DPRINT("NtUserDestroyAcceleratorTable(Table %x)\n", hAccel);
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(UserGetProcessWindowStation(),
|
Status = IntValidateWindowStationHandle(UserGetProcessWindowStation(),
|
||||||
UserMode,
|
UserMode,
|
||||||
0,
|
0,
|
||||||
&WindowStation);
|
&WindowStation);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
SetLastNtError(STATUS_ACCESS_DENIED);
|
|
||||||
DPRINT1("E1\n");
|
|
||||||
RETURN( FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(Accel = UserGetAccelObject(hAccel)))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ObDereferenceObject(WindowStation);
|
SetLastNtError(STATUS_ACCESS_DENIED);
|
||||||
RETURN( FALSE);
|
DPRINT1("E1\n");
|
||||||
}
|
RETURN( FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
ObmDeleteObject(hAccel, otAccel);
|
if (!(Accel = UserGetAccelObject(hAccel)))
|
||||||
|
{
|
||||||
|
ObDereferenceObject(WindowStation);
|
||||||
|
RETURN( FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
if (Accel->Table != NULL)
|
ObmDeleteObject(hAccel, otAccel);
|
||||||
{
|
|
||||||
ExFreePool(Accel->Table);
|
|
||||||
}
|
|
||||||
|
|
||||||
ObDereferenceObject(WindowStation);
|
if (Accel->Table != NULL)
|
||||||
|
{
|
||||||
|
ExFreePool(Accel->Table);
|
||||||
|
}
|
||||||
|
|
||||||
|
ObDereferenceObject(WindowStation);
|
||||||
|
|
||||||
|
RETURN( TRUE);
|
||||||
|
|
||||||
RETURN( TRUE);
|
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserDestroyAcceleratorTable(Table %x) = %i\n", hAccel,_ret_);
|
DPRINT("Leave NtUserDestroyAcceleratorTable(Table %x) = %i\n", hAccel,_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
BOOLEAN FASTCALL
|
BOOLEAN FASTCALL
|
||||||
co_IntTranslateAccelerator(
|
co_IntTranslateAccelerator(
|
||||||
PWINDOW_OBJECT Window,
|
PWINDOW_OBJECT Window,
|
||||||
UINT message,
|
UINT message,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam,
|
LPARAM lParam,
|
||||||
BYTE fVirt,
|
BYTE fVirt,
|
||||||
WORD key,
|
WORD key,
|
||||||
WORD cmd)
|
WORD cmd)
|
||||||
{
|
{
|
||||||
UINT mesg = 0;
|
UINT mesg = 0;
|
||||||
|
|
||||||
ASSERT_REFS_CO(Window);
|
ASSERT_REFS_CO(Window);
|
||||||
|
|
||||||
DPRINT("IntTranslateAccelerator(hwnd %x, message %x, wParam %x, lParam %x, fVirt %d, key %x, cmd %x)\n",
|
DPRINT("IntTranslateAccelerator(hwnd %x, message %x, wParam %x, lParam %x, fVirt %d, key %x, cmd %x)\n",
|
||||||
Window->hSelf, message, wParam, lParam, fVirt, key, cmd);
|
Window->hSelf, message, wParam, lParam, fVirt, key, cmd);
|
||||||
|
|
||||||
if (wParam != key)
|
if (wParam != key)
|
||||||
{
|
{
|
||||||
DPRINT("T0\n");
|
DPRINT("T0\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message == WM_CHAR)
|
if (message == WM_CHAR)
|
||||||
{
|
{
|
||||||
if (!(fVirt & FALT) && !(fVirt & FVIRTKEY))
|
if (!(fVirt & FALT) && !(fVirt & FVIRTKEY))
|
||||||
{
|
{
|
||||||
DPRINT("found accel for WM_CHAR: ('%c')\n", wParam & 0xff);
|
DPRINT("found accel for WM_CHAR: ('%c')\n", wParam & 0xff);
|
||||||
goto found;
|
goto found;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((fVirt & FVIRTKEY) > 0)
|
if ((fVirt & FVIRTKEY) > 0)
|
||||||
{
|
{
|
||||||
INT mask = 0;
|
INT mask = 0;
|
||||||
DPRINT("found accel for virt_key %04x (scan %04x)\n",
|
DPRINT("found accel for virt_key %04x (scan %04x)\n",
|
||||||
wParam, 0xff & HIWORD(lParam));
|
wParam, 0xff & HIWORD(lParam));
|
||||||
|
|
||||||
DPRINT("NtUserGetKeyState(VK_SHIFT) = 0x%x\n",
|
DPRINT("NtUserGetKeyState(VK_SHIFT) = 0x%x\n",
|
||||||
UserGetKeyState(VK_SHIFT));
|
UserGetKeyState(VK_SHIFT));
|
||||||
DPRINT("NtUserGetKeyState(VK_CONTROL) = 0x%x\n",
|
DPRINT("NtUserGetKeyState(VK_CONTROL) = 0x%x\n",
|
||||||
UserGetKeyState(VK_CONTROL));
|
UserGetKeyState(VK_CONTROL));
|
||||||
DPRINT("NtUserGetKeyState(VK_MENU) = 0x%x\n",
|
DPRINT("NtUserGetKeyState(VK_MENU) = 0x%x\n",
|
||||||
UserGetKeyState(VK_MENU));
|
UserGetKeyState(VK_MENU));
|
||||||
|
|
||||||
if (UserGetKeyState(VK_SHIFT) & 0x8000) mask |= FSHIFT;
|
if (UserGetKeyState(VK_SHIFT) & 0x8000)
|
||||||
if (UserGetKeyState(VK_CONTROL) & 0x8000) mask |= FCONTROL;
|
mask |= FSHIFT;
|
||||||
if (UserGetKeyState(VK_MENU) & 0x8000) mask |= FALT;
|
if (UserGetKeyState(VK_CONTROL) & 0x8000)
|
||||||
if (mask == (fVirt & (FSHIFT | FCONTROL | FALT))) goto found;
|
mask |= FCONTROL;
|
||||||
DPRINT("but incorrect SHIFT/CTRL/ALT-state\n");
|
if (UserGetKeyState(VK_MENU) & 0x8000)
|
||||||
}
|
mask |= FALT;
|
||||||
|
if (mask == (fVirt & (FSHIFT | FCONTROL | FALT)))
|
||||||
|
goto found;
|
||||||
|
DPRINT("but incorrect SHIFT/CTRL/ALT-state\n");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!(lParam & 0x01000000)) /* no special_key */
|
if (!(lParam & 0x01000000)) /* no special_key */
|
||||||
{
|
{
|
||||||
if ((fVirt & FALT) && (lParam & 0x20000000))
|
if ((fVirt & FALT) && (lParam & 0x20000000))
|
||||||
{ /* ^^ ALT pressed */
|
{ /* ^^ ALT pressed */
|
||||||
DPRINT("found accel for Alt-%c\n", wParam & 0xff);
|
DPRINT("found accel for Alt-%c\n", wParam & 0xff);
|
||||||
goto found;
|
goto found;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DPRINT("IntTranslateAccelerator(hwnd %x, message %x, wParam %x, lParam %x, fVirt %d, key %x, cmd %x) = FALSE\n",
|
DPRINT("IntTranslateAccelerator(hwnd %x, message %x, wParam %x, lParam %x, fVirt %d, key %x, cmd %x) = FALSE\n",
|
||||||
Window->hSelf, message, wParam, lParam, fVirt, key, cmd);
|
Window->hSelf, message, wParam, lParam, fVirt, key, cmd);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
found:
|
found:
|
||||||
if (message == WM_KEYUP || message == WM_SYSKEYUP)
|
if (message == WM_KEYUP || message == WM_SYSKEYUP)
|
||||||
mesg = 1;
|
mesg = 1;
|
||||||
else if (IntGetCaptureWindow())
|
else if (IntGetCaptureWindow())
|
||||||
mesg = 2;
|
mesg = 2;
|
||||||
else if (!IntIsWindowVisible(Window->hSelf)) /* FIXME: WINE IsWindowEnabled == IntIsWindowVisible? */
|
else if (!IntIsWindowVisible(Window->hSelf)) /* FIXME: WINE IsWindowEnabled == IntIsWindowVisible? */
|
||||||
mesg = 3;
|
mesg = 3;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
HMENU hMenu, hSubMenu, hSysMenu;
|
HMENU hMenu, hSubMenu, hSysMenu;
|
||||||
UINT uSysStat = (UINT)-1, uStat = (UINT)-1, nPos;
|
UINT uSysStat = (UINT)-1, uStat = (UINT)-1, nPos;
|
||||||
|
|
||||||
hMenu = (UserGetWindowLongW(hWnd, GWL_STYLE) & WS_CHILD) ? 0 : GetMenu(hWnd);
|
hMenu = (UserGetWindowLongW(hWnd, GWL_STYLE) & WS_CHILD) ? 0 : GetMenu(hWnd);
|
||||||
hSysMenu = get_win_sys_menu(hWnd);
|
hSysMenu = get_win_sys_menu(hWnd);
|
||||||
|
|
||||||
/* find menu item and ask application to initialize it */
|
/* find menu item and ask application to initialize it */
|
||||||
/* 1. in the system menu */
|
/* 1. in the system menu */
|
||||||
hSubMenu = hSysMenu;
|
hSubMenu = hSysMenu;
|
||||||
nPos = cmd;
|
nPos = cmd;
|
||||||
if(MENU_FindItem(&hSubMenu, &nPos, MF_BYCOMMAND))
|
if(MENU_FindItem(&hSubMenu, &nPos, MF_BYCOMMAND))
|
||||||
{
|
{
|
||||||
co_IntSendMessage(hWnd, WM_INITMENU, (WPARAM)hSysMenu, 0L);
|
co_IntSendMessage(hWnd, WM_INITMENU, (WPARAM)hSysMenu, 0L);
|
||||||
if(hSubMenu != hSysMenu)
|
if(hSubMenu != hSysMenu)
|
||||||
|
{
|
||||||
|
nPos = MENU_FindSubMenu(&hSysMenu, hSubMenu);
|
||||||
|
TRACE_(accel)("hSysMenu = %p, hSubMenu = %p, nPos = %d\n", hSysMenu, hSubMenu, nPos);
|
||||||
|
co_IntSendMessage(hWnd, WM_INITMENUPOPUP, (WPARAM)hSubMenu, MAKELPARAM(nPos, TRUE));
|
||||||
|
}
|
||||||
|
uSysStat = GetMenuState(GetSubMenu(hSysMenu, 0), cmd, MF_BYCOMMAND);
|
||||||
|
}
|
||||||
|
else /* 2. in the window's menu */
|
||||||
|
{
|
||||||
|
hSubMenu = hMenu;
|
||||||
|
nPos = cmd;
|
||||||
|
if(MENU_FindItem(&hSubMenu, &nPos, MF_BYCOMMAND))
|
||||||
|
{
|
||||||
|
co_IntSendMessage(hWnd, WM_INITMENU, (WPARAM)hMenu, 0L);
|
||||||
|
if(hSubMenu != hMenu)
|
||||||
{
|
{
|
||||||
nPos = MENU_FindSubMenu(&hSysMenu, hSubMenu);
|
nPos = MENU_FindSubMenu(&hMenu, hSubMenu);
|
||||||
TRACE_(accel)("hSysMenu = %p, hSubMenu = %p, nPos = %d\n", hSysMenu, hSubMenu, nPos);
|
TRACE_(accel)("hMenu = %p, hSubMenu = %p, nPos = %d\n", hMenu, hSubMenu, nPos);
|
||||||
co_IntSendMessage(hWnd, WM_INITMENUPOPUP, (WPARAM)hSubMenu, MAKELPARAM(nPos, TRUE));
|
co_IntSendMessage(hWnd, WM_INITMENUPOPUP, (WPARAM)hSubMenu, MAKELPARAM(nPos, FALSE));
|
||||||
}
|
}
|
||||||
uSysStat = GetMenuState(GetSubMenu(hSysMenu, 0), cmd, MF_BYCOMMAND);
|
uStat = GetMenuState(hMenu, cmd, MF_BYCOMMAND);
|
||||||
}
|
}
|
||||||
else /* 2. in the window's menu */
|
}
|
||||||
{
|
|
||||||
hSubMenu = hMenu;
|
|
||||||
nPos = cmd;
|
|
||||||
if(MENU_FindItem(&hSubMenu, &nPos, MF_BYCOMMAND))
|
|
||||||
{
|
|
||||||
co_IntSendMessage(hWnd, WM_INITMENU, (WPARAM)hMenu, 0L);
|
|
||||||
if(hSubMenu != hMenu)
|
|
||||||
{
|
|
||||||
nPos = MENU_FindSubMenu(&hMenu, hSubMenu);
|
|
||||||
TRACE_(accel)("hMenu = %p, hSubMenu = %p, nPos = %d\n", hMenu, hSubMenu, nPos);
|
|
||||||
co_IntSendMessage(hWnd, WM_INITMENUPOPUP, (WPARAM)hSubMenu, MAKELPARAM(nPos, FALSE));
|
|
||||||
}
|
|
||||||
uStat = GetMenuState(hMenu, cmd, MF_BYCOMMAND);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (uSysStat != (UINT)-1)
|
if (uSysStat != (UINT)-1)
|
||||||
{
|
{
|
||||||
if (uSysStat & (MF_DISABLED|MF_GRAYED))
|
if (uSysStat & (MF_DISABLED|MF_GRAYED))
|
||||||
mesg=4;
|
mesg=4;
|
||||||
|
else
|
||||||
|
mesg=WM_SYSCOMMAND;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (uStat != (UINT)-1)
|
||||||
|
{
|
||||||
|
if (IsIconic(hWnd))
|
||||||
|
mesg=5;
|
||||||
else
|
else
|
||||||
mesg=WM_SYSCOMMAND;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (uStat != (UINT)-1)
|
|
||||||
{
|
{
|
||||||
if (IsIconic(hWnd))
|
if (uStat & (MF_DISABLED|MF_GRAYED))
|
||||||
mesg=5;
|
mesg=6;
|
||||||
else
|
else
|
||||||
{
|
mesg=WM_COMMAND;
|
||||||
if (uStat & (MF_DISABLED|MF_GRAYED))
|
|
||||||
mesg=6;
|
|
||||||
else
|
|
||||||
mesg=WM_COMMAND;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
mesg=WM_COMMAND;
|
{
|
||||||
}
|
mesg=WM_COMMAND;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
DPRINT1("menu search not implemented");
|
DPRINT1("menu search not implemented");
|
||||||
mesg = WM_COMMAND;
|
mesg = WM_COMMAND;
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
if (mesg == WM_COMMAND)
|
}
|
||||||
{
|
|
||||||
|
if (mesg == WM_COMMAND)
|
||||||
|
{
|
||||||
DPRINT(", sending WM_COMMAND, wParam=%0x\n", 0x10000 | cmd);
|
DPRINT(", sending WM_COMMAND, wParam=%0x\n", 0x10000 | cmd);
|
||||||
co_IntSendMessage(Window->hSelf, mesg, 0x10000 | cmd, 0L);
|
co_IntSendMessage(Window->hSelf, mesg, 0x10000 | cmd, 0L);
|
||||||
}
|
}
|
||||||
else if (mesg == WM_SYSCOMMAND)
|
else if (mesg == WM_SYSCOMMAND)
|
||||||
{
|
{
|
||||||
DPRINT(", sending WM_SYSCOMMAND, wParam=%0x\n", cmd);
|
DPRINT(", sending WM_SYSCOMMAND, wParam=%0x\n", cmd);
|
||||||
co_IntSendMessage(Window->hSelf, mesg, cmd, 0x00010000L);
|
co_IntSendMessage(Window->hSelf, mesg, cmd, 0x00010000L);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* some reasons for NOT sending the WM_{SYS}COMMAND message:
|
/* some reasons for NOT sending the WM_{SYS}COMMAND message:
|
||||||
* #0: unknown (please report!)
|
* #0: unknown (please report!)
|
||||||
* #1: for WM_KEYUP,WM_SYSKEYUP
|
* #1: for WM_KEYUP,WM_SYSKEYUP
|
||||||
|
@ -449,104 +454,107 @@ co_IntTranslateAccelerator(
|
||||||
*/
|
*/
|
||||||
DPRINT(", but won't send WM_{SYS}COMMAND, reason is #%d\n", mesg);
|
DPRINT(", but won't send WM_{SYS}COMMAND, reason is #%d\n", mesg);
|
||||||
if (mesg == 0)
|
if (mesg == 0)
|
||||||
{
|
{
|
||||||
DPRINT1(" unknown reason - please report!");
|
DPRINT1(" unknown reason - please report!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("IntTranslateAccelerator(hWnd %x, message %x, wParam %x, lParam %x, fVirt %d, key %x, cmd %x) = TRUE\n",
|
DPRINT("IntTranslateAccelerator(hWnd %x, message %x, wParam %x, lParam %x, fVirt %d, key %x, cmd %x) = TRUE\n",
|
||||||
Window->hSelf, message, wParam, lParam, fVirt, key, cmd);
|
Window->hSelf, message, wParam, lParam, fVirt, key, cmd);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserTranslateAccelerator(
|
NtUserTranslateAccelerator(
|
||||||
HWND hWnd,
|
HWND hWnd,
|
||||||
HACCEL hAccel,
|
HACCEL hAccel,
|
||||||
LPMSG Message)
|
LPMSG Message)
|
||||||
{
|
{
|
||||||
PWINSTATION_OBJECT WindowStation = NULL;
|
PWINSTATION_OBJECT WindowStation = NULL;
|
||||||
PWINDOW_OBJECT Window = NULL;
|
PWINDOW_OBJECT Window = NULL;
|
||||||
PACCELERATOR_TABLE Accel = NULL;
|
PACCELERATOR_TABLE Accel = NULL;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
DECLARE_RETURN(int);
|
DECLARE_RETURN(int);
|
||||||
|
|
||||||
DPRINT("NtUserTranslateAccelerator(hWnd %x, Table %x, Message %p)\n",
|
DPRINT("NtUserTranslateAccelerator(hWnd %x, Table %x, Message %p)\n",
|
||||||
hWnd, hAccel, Message);
|
hWnd, hAccel, Message);
|
||||||
UserEnterShared();
|
UserEnterShared();
|
||||||
|
|
||||||
if (Message == NULL)
|
if (Message == NULL)
|
||||||
{
|
{
|
||||||
SetLastNtError(STATUS_INVALID_PARAMETER);
|
SetLastNtError(STATUS_INVALID_PARAMETER);
|
||||||
RETURN( 0);
|
RETURN( 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Message->message != WM_KEYDOWN) &&
|
if ((Message->message != WM_KEYDOWN) &&
|
||||||
(Message->message != WM_SYSKEYDOWN) &&
|
(Message->message != WM_SYSKEYDOWN) &&
|
||||||
(Message->message != WM_SYSCHAR) &&
|
(Message->message != WM_SYSCHAR) &&
|
||||||
(Message->message != WM_CHAR))
|
(Message->message != WM_CHAR))
|
||||||
{
|
{
|
||||||
RETURN( 0);
|
RETURN( 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(UserGetProcessWindowStation(),
|
Status = IntValidateWindowStationHandle(UserGetProcessWindowStation(),
|
||||||
UserMode,
|
UserMode,
|
||||||
0,
|
0,
|
||||||
&WindowStation);
|
&WindowStation);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
SetLastNtError(STATUS_ACCESS_DENIED);
|
|
||||||
RETURN( 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(Accel = UserGetAccelObject(hAccel)))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
RETURN( 0);
|
SetLastNtError(STATUS_ACCESS_DENIED);
|
||||||
}
|
RETURN( 0);
|
||||||
|
}
|
||||||
|
|
||||||
UserRefObjectCo(Accel);
|
if (!(Accel = UserGetAccelObject(hAccel)))
|
||||||
|
{
|
||||||
|
RETURN( 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (!(Window = UserGetWindowObject(hWnd)))
|
UserRefObjectCo(Accel);
|
||||||
{
|
|
||||||
RETURN( 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
UserRefObjectCo(Window);
|
if (!(Window = UserGetWindowObject(hWnd)))
|
||||||
|
{
|
||||||
|
RETURN( 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* FIXME: Associate AcceleratorTable with the current thread */
|
UserRefObjectCo(Window);
|
||||||
|
|
||||||
for (i = 0; i < Accel->Count; i++)
|
|
||||||
{
|
/* FIXME: Associate AcceleratorTable with the current thread */
|
||||||
|
|
||||||
|
for (i = 0; i < Accel->Count; i++)
|
||||||
|
{
|
||||||
if (co_IntTranslateAccelerator(Window, Message->message, Message->wParam, Message->lParam,
|
if (co_IntTranslateAccelerator(Window, Message->message, Message->wParam, Message->lParam,
|
||||||
Accel->Table[i].fVirt, Accel->Table[i].key,
|
Accel->Table[i].fVirt, Accel->Table[i].key,
|
||||||
Accel->Table[i].cmd))
|
Accel->Table[i].cmd))
|
||||||
{
|
{
|
||||||
DPRINT("NtUserTranslateAccelerator(hWnd %x, Table %x, Message %p) = %i end\n",
|
DPRINT("NtUserTranslateAccelerator(hWnd %x, Table %x, Message %p) = %i end\n",
|
||||||
hWnd, hAccel, Message, 1);
|
hWnd, hAccel, Message, 1);
|
||||||
RETURN( 1);
|
RETURN( 1);
|
||||||
}
|
}
|
||||||
if (((Accel->Table[i].fVirt & 0x80) > 0))
|
if (((Accel->Table[i].fVirt & 0x80) > 0))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RETURN( 0);
|
||||||
|
|
||||||
RETURN( 0);
|
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
|
|
||||||
if (Window) UserDerefObjectCo(Window);
|
|
||||||
if (Accel) UserDerefObjectCo(Accel);
|
|
||||||
|
|
||||||
if (WindowStation) ObDereferenceObject(WindowStation);
|
if (Window)
|
||||||
|
UserDerefObjectCo(Window);
|
||||||
|
if (Accel)
|
||||||
|
UserDerefObjectCo(Accel);
|
||||||
|
|
||||||
DPRINT("NtUserTranslateAccelerator(hWnd %x, Table %x, Message %p) = %i end\n",
|
if (WindowStation)
|
||||||
hWnd, hAccel, Message, 0);
|
ObDereferenceObject(WindowStation);
|
||||||
UserLeave();
|
|
||||||
END_CLEANUP;
|
DPRINT("NtUserTranslateAccelerator(hWnd %x, Table %x, Message %p) = %i end\n",
|
||||||
|
hWnd, hAccel, Message, 0);
|
||||||
|
UserLeave();
|
||||||
|
END_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,368 +42,369 @@
|
||||||
|
|
||||||
typedef struct _INT_CALLBACK_HEADER
|
typedef struct _INT_CALLBACK_HEADER
|
||||||
{
|
{
|
||||||
/* list entry in the W32THREAD structure */
|
/* list entry in the W32THREAD structure */
|
||||||
LIST_ENTRY ListEntry;
|
LIST_ENTRY ListEntry;
|
||||||
} INT_CALLBACK_HEADER, *PINT_CALLBACK_HEADER;
|
}
|
||||||
|
INT_CALLBACK_HEADER, *PINT_CALLBACK_HEADER;
|
||||||
|
|
||||||
PVOID FASTCALL
|
PVOID FASTCALL
|
||||||
IntCbAllocateMemory(ULONG Size)
|
IntCbAllocateMemory(ULONG Size)
|
||||||
{
|
{
|
||||||
PINT_CALLBACK_HEADER Mem;
|
PINT_CALLBACK_HEADER Mem;
|
||||||
PW32THREAD W32Thread;
|
PW32THREAD W32Thread;
|
||||||
|
|
||||||
if(!(Mem = ExAllocatePoolWithTag(PagedPool, Size + sizeof(INT_CALLBACK_HEADER),
|
if(!(Mem = ExAllocatePoolWithTag(PagedPool, Size + sizeof(INT_CALLBACK_HEADER),
|
||||||
TAG_CALLBACK)))
|
TAG_CALLBACK)))
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
W32Thread = PsGetWin32Thread();
|
W32Thread = PsGetWin32Thread();
|
||||||
ASSERT(W32Thread);
|
ASSERT(W32Thread);
|
||||||
|
|
||||||
/* insert the callback memory into the thread's callback list */
|
/* insert the callback memory into the thread's callback list */
|
||||||
|
|
||||||
InsertTailList(&W32Thread->W32CallbackListHead, &Mem->ListEntry);
|
InsertTailList(&W32Thread->W32CallbackListHead, &Mem->ListEntry);
|
||||||
|
|
||||||
return (Mem + 1);
|
return (Mem + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
IntCbFreeMemory(PVOID Data)
|
IntCbFreeMemory(PVOID Data)
|
||||||
{
|
{
|
||||||
PINT_CALLBACK_HEADER Mem;
|
PINT_CALLBACK_HEADER Mem;
|
||||||
PW32THREAD W32Thread;
|
PW32THREAD W32Thread;
|
||||||
|
|
||||||
ASSERT(Data);
|
ASSERT(Data);
|
||||||
|
|
||||||
Mem = ((PINT_CALLBACK_HEADER)Data - 1);
|
Mem = ((PINT_CALLBACK_HEADER)Data - 1);
|
||||||
|
|
||||||
W32Thread = PsGetWin32Thread();
|
W32Thread = PsGetWin32Thread();
|
||||||
ASSERT(W32Thread);
|
ASSERT(W32Thread);
|
||||||
|
|
||||||
/* remove the memory block from the thread's callback list */
|
/* remove the memory block from the thread's callback list */
|
||||||
RemoveEntryList(&Mem->ListEntry);
|
RemoveEntryList(&Mem->ListEntry);
|
||||||
|
|
||||||
/* free memory */
|
/* free memory */
|
||||||
ExFreePool(Mem);
|
ExFreePool(Mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
IntCleanupThreadCallbacks(PW32THREAD W32Thread)
|
IntCleanupThreadCallbacks(PW32THREAD W32Thread)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY CurrentEntry;
|
PLIST_ENTRY CurrentEntry;
|
||||||
PINT_CALLBACK_HEADER Mem;
|
PINT_CALLBACK_HEADER Mem;
|
||||||
|
|
||||||
while (!IsListEmpty(&W32Thread->W32CallbackListHead))
|
while (!IsListEmpty(&W32Thread->W32CallbackListHead))
|
||||||
{
|
{
|
||||||
CurrentEntry = RemoveHeadList(&W32Thread->W32CallbackListHead);
|
CurrentEntry = RemoveHeadList(&W32Thread->W32CallbackListHead);
|
||||||
Mem = CONTAINING_RECORD(CurrentEntry, INT_CALLBACK_HEADER,
|
Mem = CONTAINING_RECORD(CurrentEntry, INT_CALLBACK_HEADER,
|
||||||
ListEntry);
|
ListEntry);
|
||||||
|
|
||||||
/* free memory */
|
/* free memory */
|
||||||
ExFreePool(Mem);
|
ExFreePool(Mem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
co_IntCallSentMessageCallback(SENDASYNCPROC CompletionCallback,
|
co_IntCallSentMessageCallback(SENDASYNCPROC CompletionCallback,
|
||||||
HWND hWnd,
|
HWND hWnd,
|
||||||
UINT Msg,
|
UINT Msg,
|
||||||
ULONG_PTR CompletionCallbackContext,
|
ULONG_PTR CompletionCallbackContext,
|
||||||
LRESULT Result)
|
LRESULT Result)
|
||||||
{
|
{
|
||||||
SENDASYNCPROC_CALLBACK_ARGUMENTS Arguments;
|
SENDASYNCPROC_CALLBACK_ARGUMENTS Arguments;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Arguments.Callback = CompletionCallback;
|
Arguments.Callback = CompletionCallback;
|
||||||
Arguments.Wnd = hWnd;
|
Arguments.Wnd = hWnd;
|
||||||
Arguments.Msg = Msg;
|
Arguments.Msg = Msg;
|
||||||
Arguments.Context = CompletionCallbackContext;
|
Arguments.Context = CompletionCallbackContext;
|
||||||
Arguments.Result = Result;
|
Arguments.Result = Result;
|
||||||
|
|
||||||
UserLeaveCo();
|
UserLeaveCo();
|
||||||
|
|
||||||
Status = NtW32Call(USER32_CALLBACK_SENDASYNCPROC,
|
Status = NtW32Call(USER32_CALLBACK_SENDASYNCPROC,
|
||||||
&Arguments,
|
&Arguments,
|
||||||
sizeof(SENDASYNCPROC_CALLBACK_ARGUMENTS),
|
sizeof(SENDASYNCPROC_CALLBACK_ARGUMENTS),
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
UserEnterCo();
|
UserEnterCo();
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT STDCALL
|
LRESULT STDCALL
|
||||||
co_IntCallWindowProc(WNDPROC Proc,
|
co_IntCallWindowProc(WNDPROC Proc,
|
||||||
BOOLEAN IsAnsiProc,
|
BOOLEAN IsAnsiProc,
|
||||||
HWND Wnd,
|
HWND Wnd,
|
||||||
UINT Message,
|
UINT Message,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam,
|
LPARAM lParam,
|
||||||
INT lParamBufferSize)
|
INT lParamBufferSize)
|
||||||
{
|
{
|
||||||
WINDOWPROC_CALLBACK_ARGUMENTS StackArguments;
|
WINDOWPROC_CALLBACK_ARGUMENTS StackArguments;
|
||||||
PWINDOWPROC_CALLBACK_ARGUMENTS Arguments;
|
PWINDOWPROC_CALLBACK_ARGUMENTS Arguments;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PVOID ResultPointer;
|
PVOID ResultPointer;
|
||||||
ULONG ResultLength;
|
ULONG ResultLength;
|
||||||
ULONG ArgumentLength;
|
ULONG ArgumentLength;
|
||||||
LRESULT Result;
|
LRESULT Result;
|
||||||
|
|
||||||
if (0 < lParamBufferSize)
|
if (0 < lParamBufferSize)
|
||||||
{
|
{
|
||||||
ArgumentLength = sizeof(WINDOWPROC_CALLBACK_ARGUMENTS) + lParamBufferSize;
|
ArgumentLength = sizeof(WINDOWPROC_CALLBACK_ARGUMENTS) + lParamBufferSize;
|
||||||
Arguments = IntCbAllocateMemory(ArgumentLength);
|
Arguments = IntCbAllocateMemory(ArgumentLength);
|
||||||
if (NULL == Arguments)
|
if (NULL == Arguments)
|
||||||
{
|
{
|
||||||
DPRINT1("Unable to allocate buffer for window proc callback\n");
|
DPRINT1("Unable to allocate buffer for window proc callback\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
RtlMoveMemory((PVOID) ((char *) Arguments + sizeof(WINDOWPROC_CALLBACK_ARGUMENTS)),
|
RtlMoveMemory((PVOID) ((char *) Arguments + sizeof(WINDOWPROC_CALLBACK_ARGUMENTS)),
|
||||||
(PVOID) lParam, lParamBufferSize);
|
(PVOID) lParam, lParamBufferSize);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Arguments = &StackArguments;
|
Arguments = &StackArguments;
|
||||||
ArgumentLength = sizeof(WINDOWPROC_CALLBACK_ARGUMENTS);
|
ArgumentLength = sizeof(WINDOWPROC_CALLBACK_ARGUMENTS);
|
||||||
}
|
}
|
||||||
Arguments->Proc = Proc;
|
Arguments->Proc = Proc;
|
||||||
Arguments->IsAnsiProc = IsAnsiProc;
|
Arguments->IsAnsiProc = IsAnsiProc;
|
||||||
Arguments->Wnd = Wnd;
|
Arguments->Wnd = Wnd;
|
||||||
Arguments->Msg = Message;
|
Arguments->Msg = Message;
|
||||||
Arguments->wParam = wParam;
|
Arguments->wParam = wParam;
|
||||||
Arguments->lParam = lParam;
|
Arguments->lParam = lParam;
|
||||||
Arguments->lParamBufferSize = lParamBufferSize;
|
Arguments->lParamBufferSize = lParamBufferSize;
|
||||||
ResultPointer = Arguments;
|
ResultPointer = Arguments;
|
||||||
ResultLength = ArgumentLength;
|
ResultLength = ArgumentLength;
|
||||||
|
|
||||||
UserLeaveCo();
|
UserLeaveCo();
|
||||||
|
|
||||||
Status = NtW32Call(USER32_CALLBACK_WINDOWPROC,
|
Status = NtW32Call(USER32_CALLBACK_WINDOWPROC,
|
||||||
Arguments,
|
Arguments,
|
||||||
ArgumentLength,
|
ArgumentLength,
|
||||||
&ResultPointer,
|
&ResultPointer,
|
||||||
&ResultLength);
|
&ResultLength);
|
||||||
|
|
||||||
UserEnterCo();
|
UserEnterCo();
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
if (0 < lParamBufferSize)
|
if (0 < lParamBufferSize)
|
||||||
{
|
{
|
||||||
IntCbFreeMemory(Arguments);
|
IntCbFreeMemory(Arguments);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
Result = Arguments->Result;
|
Result = Arguments->Result;
|
||||||
|
|
||||||
if (0 < lParamBufferSize)
|
if (0 < lParamBufferSize)
|
||||||
{
|
{
|
||||||
RtlMoveMemory((PVOID) lParam,
|
RtlMoveMemory((PVOID) lParam,
|
||||||
(PVOID) ((char *) Arguments + sizeof(WINDOWPROC_CALLBACK_ARGUMENTS)),
|
(PVOID) ((char *) Arguments + sizeof(WINDOWPROC_CALLBACK_ARGUMENTS)),
|
||||||
lParamBufferSize);
|
lParamBufferSize);
|
||||||
IntCbFreeMemory(Arguments);
|
IntCbFreeMemory(Arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
HMENU STDCALL
|
HMENU STDCALL
|
||||||
co_IntLoadSysMenuTemplate()
|
co_IntLoadSysMenuTemplate()
|
||||||
{
|
{
|
||||||
LRESULT Result;
|
LRESULT Result;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PVOID ResultPointer;
|
PVOID ResultPointer;
|
||||||
ULONG ResultLength;
|
ULONG ResultLength;
|
||||||
|
|
||||||
ResultPointer = &Result;
|
ResultPointer = &Result;
|
||||||
ResultLength = sizeof(LRESULT);
|
ResultLength = sizeof(LRESULT);
|
||||||
|
|
||||||
UserLeaveCo();
|
UserLeaveCo();
|
||||||
|
|
||||||
Status = NtW32Call(USER32_CALLBACK_LOADSYSMENUTEMPLATE,
|
Status = NtW32Call(USER32_CALLBACK_LOADSYSMENUTEMPLATE,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
&ResultPointer,
|
&ResultPointer,
|
||||||
&ResultLength);
|
&ResultLength);
|
||||||
|
|
||||||
UserEnterCo();
|
UserEnterCo();
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
return (HMENU)Result;
|
return (HMENU)Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
co_IntLoadDefaultCursors(VOID)
|
co_IntLoadDefaultCursors(VOID)
|
||||||
{
|
{
|
||||||
LRESULT Result;
|
LRESULT Result;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PVOID ResultPointer;
|
PVOID ResultPointer;
|
||||||
ULONG ResultLength;
|
ULONG ResultLength;
|
||||||
BOOL DefaultCursor = TRUE;
|
BOOL DefaultCursor = TRUE;
|
||||||
|
|
||||||
ResultPointer = &Result;
|
ResultPointer = &Result;
|
||||||
ResultLength = sizeof(LRESULT);
|
ResultLength = sizeof(LRESULT);
|
||||||
|
|
||||||
UserLeaveCo();
|
UserLeaveCo();
|
||||||
|
|
||||||
Status = NtW32Call(USER32_CALLBACK_LOADDEFAULTCURSORS,
|
Status = NtW32Call(USER32_CALLBACK_LOADDEFAULTCURSORS,
|
||||||
&DefaultCursor,
|
&DefaultCursor,
|
||||||
sizeof(BOOL),
|
sizeof(BOOL),
|
||||||
&ResultPointer,
|
&ResultPointer,
|
||||||
&ResultLength);
|
&ResultLength);
|
||||||
|
|
||||||
UserEnterCo();
|
UserEnterCo();
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT STDCALL
|
LRESULT STDCALL
|
||||||
co_IntCallHookProc(INT HookId,
|
co_IntCallHookProc(INT HookId,
|
||||||
INT Code,
|
INT Code,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam,
|
LPARAM lParam,
|
||||||
HOOKPROC Proc,
|
HOOKPROC Proc,
|
||||||
BOOLEAN Ansi,
|
BOOLEAN Ansi,
|
||||||
PUNICODE_STRING ModuleName)
|
PUNICODE_STRING ModuleName)
|
||||||
{
|
{
|
||||||
ULONG ArgumentLength;
|
ULONG ArgumentLength;
|
||||||
PVOID Argument;
|
PVOID Argument;
|
||||||
LRESULT Result;
|
LRESULT Result;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PVOID ResultPointer;
|
PVOID ResultPointer;
|
||||||
ULONG ResultLength;
|
ULONG ResultLength;
|
||||||
PHOOKPROC_CALLBACK_ARGUMENTS Common;
|
PHOOKPROC_CALLBACK_ARGUMENTS Common;
|
||||||
CBT_CREATEWNDW *CbtCreateWnd =NULL;
|
CBT_CREATEWNDW *CbtCreateWnd =NULL;
|
||||||
PCHAR Extra;
|
PCHAR Extra;
|
||||||
PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS CbtCreatewndExtra ;
|
PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS CbtCreatewndExtra ;
|
||||||
PUNICODE_STRING WindowName = NULL;
|
PUNICODE_STRING WindowName = NULL;
|
||||||
PUNICODE_STRING ClassName = NULL;
|
PUNICODE_STRING ClassName = NULL;
|
||||||
|
|
||||||
ArgumentLength = sizeof(HOOKPROC_CALLBACK_ARGUMENTS) - sizeof(WCHAR)
|
ArgumentLength = sizeof(HOOKPROC_CALLBACK_ARGUMENTS) - sizeof(WCHAR)
|
||||||
+ ModuleName->Length;
|
+ ModuleName->Length;
|
||||||
switch(HookId)
|
switch(HookId)
|
||||||
{
|
{
|
||||||
case WH_CBT:
|
case WH_CBT:
|
||||||
switch(Code)
|
switch(Code)
|
||||||
{
|
{
|
||||||
case HCBT_CREATEWND:
|
case HCBT_CREATEWND:
|
||||||
CbtCreateWnd = (CBT_CREATEWNDW *) lParam;
|
CbtCreateWnd = (CBT_CREATEWNDW *) lParam;
|
||||||
ArgumentLength += sizeof(HOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS);
|
ArgumentLength += sizeof(HOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS);
|
||||||
WindowName = (PUNICODE_STRING) (CbtCreateWnd->lpcs->lpszName);
|
WindowName = (PUNICODE_STRING) (CbtCreateWnd->lpcs->lpszName);
|
||||||
ArgumentLength += WindowName->Length + sizeof(WCHAR);
|
ArgumentLength += WindowName->Length + sizeof(WCHAR);
|
||||||
ClassName = (PUNICODE_STRING) (CbtCreateWnd->lpcs->lpszClass);
|
ClassName = (PUNICODE_STRING) (CbtCreateWnd->lpcs->lpszClass);
|
||||||
if (! IS_ATOM(ClassName->Buffer))
|
if (! IS_ATOM(ClassName->Buffer))
|
||||||
{
|
{
|
||||||
ArgumentLength += ClassName->Length + sizeof(WCHAR);
|
ArgumentLength += ClassName->Length + sizeof(WCHAR);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DPRINT1("Trying to call unsupported CBT hook %d\n", Code);
|
DPRINT1("Trying to call unsupported CBT hook %d\n", Code);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WH_KEYBOARD_LL:
|
case WH_KEYBOARD_LL:
|
||||||
ArgumentLength += sizeof(KBDLLHOOKSTRUCT);
|
ArgumentLength += sizeof(KBDLLHOOKSTRUCT);
|
||||||
break;
|
break;
|
||||||
case WH_MOUSE_LL:
|
case WH_MOUSE_LL:
|
||||||
ArgumentLength += sizeof(MSLLHOOKSTRUCT);
|
ArgumentLength += sizeof(MSLLHOOKSTRUCT);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DPRINT1("Trying to call unsupported window hook %d\n", HookId);
|
DPRINT1("Trying to call unsupported window hook %d\n", HookId);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Argument = IntCbAllocateMemory(ArgumentLength);
|
Argument = IntCbAllocateMemory(ArgumentLength);
|
||||||
if (NULL == Argument)
|
if (NULL == Argument)
|
||||||
{
|
{
|
||||||
DPRINT1("HookProc callback failed: out of memory\n");
|
DPRINT1("HookProc callback failed: out of memory\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Common = (PHOOKPROC_CALLBACK_ARGUMENTS) Argument;
|
Common = (PHOOKPROC_CALLBACK_ARGUMENTS) Argument;
|
||||||
Common->HookId = HookId;
|
Common->HookId = HookId;
|
||||||
Common->Code = Code;
|
Common->Code = Code;
|
||||||
Common->wParam = wParam;
|
Common->wParam = wParam;
|
||||||
Common->lParam = lParam;
|
Common->lParam = lParam;
|
||||||
Common->Proc = Proc;
|
Common->Proc = Proc;
|
||||||
Common->Ansi = Ansi;
|
Common->Ansi = Ansi;
|
||||||
Common->ModuleNameLength = ModuleName->Length;
|
Common->ModuleNameLength = ModuleName->Length;
|
||||||
memcpy(Common->ModuleName, ModuleName->Buffer, ModuleName->Length);
|
memcpy(Common->ModuleName, ModuleName->Buffer, ModuleName->Length);
|
||||||
Extra = (PCHAR) Common->ModuleName + Common->ModuleNameLength;
|
Extra = (PCHAR) Common->ModuleName + Common->ModuleNameLength;
|
||||||
|
|
||||||
switch(HookId)
|
switch(HookId)
|
||||||
{
|
{
|
||||||
case WH_CBT:
|
case WH_CBT:
|
||||||
switch(Code)
|
switch(Code)
|
||||||
{
|
{
|
||||||
case HCBT_CREATEWND:
|
case HCBT_CREATEWND:
|
||||||
Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
|
Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
|
||||||
CbtCreatewndExtra = (PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS) Extra;
|
CbtCreatewndExtra = (PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS) Extra;
|
||||||
CbtCreatewndExtra->Cs = *(CbtCreateWnd->lpcs);
|
CbtCreatewndExtra->Cs = *(CbtCreateWnd->lpcs);
|
||||||
CbtCreatewndExtra->WndInsertAfter = CbtCreateWnd->hwndInsertAfter;
|
CbtCreatewndExtra->WndInsertAfter = CbtCreateWnd->hwndInsertAfter;
|
||||||
Extra = (PCHAR) (CbtCreatewndExtra + 1);
|
Extra = (PCHAR) (CbtCreatewndExtra + 1);
|
||||||
RtlCopyMemory(Extra, WindowName->Buffer, WindowName->Length);
|
RtlCopyMemory(Extra, WindowName->Buffer, WindowName->Length);
|
||||||
CbtCreatewndExtra->Cs.lpszName = (LPCWSTR) (Extra - (PCHAR) CbtCreatewndExtra);
|
CbtCreatewndExtra->Cs.lpszName = (LPCWSTR) (Extra - (PCHAR) CbtCreatewndExtra);
|
||||||
CbtCreatewndExtra->Cs.lpszClass = ClassName->Buffer;
|
CbtCreatewndExtra->Cs.lpszClass = ClassName->Buffer;
|
||||||
Extra += WindowName->Length;
|
Extra += WindowName->Length;
|
||||||
*((WCHAR *) Extra) = L'\0';
|
*((WCHAR *) Extra) = L'\0';
|
||||||
Extra += sizeof(WCHAR);
|
Extra += sizeof(WCHAR);
|
||||||
if (! IS_ATOM(ClassName->Buffer))
|
if (! IS_ATOM(ClassName->Buffer))
|
||||||
{
|
{
|
||||||
RtlCopyMemory(Extra, ClassName->Buffer, ClassName->Length);
|
RtlCopyMemory(Extra, ClassName->Buffer, ClassName->Length);
|
||||||
CbtCreatewndExtra->Cs.lpszClass =
|
CbtCreatewndExtra->Cs.lpszClass =
|
||||||
(LPCWSTR) MAKELONG(Extra - (PCHAR) CbtCreatewndExtra, 1);
|
(LPCWSTR) MAKELONG(Extra - (PCHAR) CbtCreatewndExtra, 1);
|
||||||
Extra += ClassName->Length;
|
Extra += ClassName->Length;
|
||||||
*((WCHAR *) Extra) = L'\0';
|
*((WCHAR *) Extra) = L'\0';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WH_KEYBOARD_LL:
|
case WH_KEYBOARD_LL:
|
||||||
RtlCopyMemory(Extra, (PVOID) lParam, sizeof(KBDLLHOOKSTRUCT));
|
RtlCopyMemory(Extra, (PVOID) lParam, sizeof(KBDLLHOOKSTRUCT));
|
||||||
Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
|
Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
|
||||||
break;
|
break;
|
||||||
case WH_MOUSE_LL:
|
case WH_MOUSE_LL:
|
||||||
RtlCopyMemory(Extra, (PVOID) lParam, sizeof(MSLLHOOKSTRUCT));
|
RtlCopyMemory(Extra, (PVOID) lParam, sizeof(MSLLHOOKSTRUCT));
|
||||||
Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
|
Common->lParam = (LPARAM) (Extra - (PCHAR) Common);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultPointer = &Result;
|
ResultPointer = &Result;
|
||||||
ResultLength = sizeof(LRESULT);
|
ResultLength = sizeof(LRESULT);
|
||||||
|
|
||||||
UserLeaveCo();
|
UserLeaveCo();
|
||||||
|
|
||||||
Status = NtW32Call(USER32_CALLBACK_HOOKPROC,
|
Status = NtW32Call(USER32_CALLBACK_HOOKPROC,
|
||||||
Argument,
|
Argument,
|
||||||
ArgumentLength,
|
ArgumentLength,
|
||||||
&ResultPointer,
|
&ResultPointer,
|
||||||
&ResultLength);
|
&ResultLength);
|
||||||
|
|
||||||
UserEnterCo();
|
UserEnterCo();
|
||||||
|
|
||||||
IntCbFreeMemory(Argument);
|
IntCbFreeMemory(Argument);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -23,192 +23,192 @@
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
co_IntHideCaret(PTHRDCARETINFO CaretInfo)
|
co_IntHideCaret(PTHRDCARETINFO CaretInfo)
|
||||||
{
|
{
|
||||||
if(CaretInfo->hWnd && CaretInfo->Visible && CaretInfo->Showing)
|
if(CaretInfo->hWnd && CaretInfo->Visible && CaretInfo->Showing)
|
||||||
{
|
{
|
||||||
co_IntSendMessage(CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0);
|
co_IntSendMessage(CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0);
|
||||||
CaretInfo->Showing = 0;
|
CaretInfo->Showing = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
co_IntDestroyCaret(PW32THREAD Win32Thread)
|
co_IntDestroyCaret(PW32THREAD Win32Thread)
|
||||||
{
|
{
|
||||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)Win32Thread->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)Win32Thread->MessageQueue;
|
||||||
|
|
||||||
if(!ThreadQueue || !ThreadQueue->CaretInfo)
|
if(!ThreadQueue || !ThreadQueue->CaretInfo)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
co_IntHideCaret(ThreadQueue->CaretInfo);
|
co_IntHideCaret(ThreadQueue->CaretInfo);
|
||||||
ThreadQueue->CaretInfo->Bitmap = (HBITMAP)0;
|
ThreadQueue->CaretInfo->Bitmap = (HBITMAP)0;
|
||||||
ThreadQueue->CaretInfo->hWnd = (HWND)0;
|
ThreadQueue->CaretInfo->hWnd = (HWND)0;
|
||||||
ThreadQueue->CaretInfo->Size.cx = ThreadQueue->CaretInfo->Size.cy = 0;
|
ThreadQueue->CaretInfo->Size.cx = ThreadQueue->CaretInfo->Size.cy = 0;
|
||||||
ThreadQueue->CaretInfo->Showing = 0;
|
ThreadQueue->CaretInfo->Showing = 0;
|
||||||
ThreadQueue->CaretInfo->Visible = 0;
|
ThreadQueue->CaretInfo->Visible = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
IntSetCaretBlinkTime(UINT uMSeconds)
|
IntSetCaretBlinkTime(UINT uMSeconds)
|
||||||
{
|
{
|
||||||
/* Don't save the new value to the registry! */
|
/* Don't save the new value to the registry! */
|
||||||
PWINSTATION_OBJECT WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
PWINSTATION_OBJECT WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
||||||
|
|
||||||
/* windows doesn't do this check */
|
/* windows doesn't do this check */
|
||||||
if((uMSeconds < MIN_CARETBLINKRATE) || (uMSeconds > MAX_CARETBLINKRATE))
|
if((uMSeconds < MIN_CARETBLINKRATE) || (uMSeconds > MAX_CARETBLINKRATE))
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
ObDereferenceObject(WinStaObject);
|
ObDereferenceObject(WinStaObject);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
WinStaObject->CaretBlinkRate = uMSeconds;
|
WinStaObject->CaretBlinkRate = uMSeconds;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT FASTCALL
|
UINT FASTCALL
|
||||||
IntQueryCaretBlinkRate(VOID)
|
IntQueryCaretBlinkRate(VOID)
|
||||||
{
|
{
|
||||||
UNICODE_STRING KeyName = RTL_CONSTANT_STRING(CARET_REGKEY);
|
UNICODE_STRING KeyName = RTL_CONSTANT_STRING(CARET_REGKEY);
|
||||||
UNICODE_STRING ValueName = RTL_CONSTANT_STRING(CARET_VALUENAME);
|
UNICODE_STRING ValueName = RTL_CONSTANT_STRING(CARET_VALUENAME);
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE KeyHandle = NULL;
|
HANDLE KeyHandle = NULL;
|
||||||
OBJECT_ATTRIBUTES KeyAttributes;
|
OBJECT_ATTRIBUTES KeyAttributes;
|
||||||
PKEY_VALUE_PARTIAL_INFORMATION KeyValuePartialInfo;
|
PKEY_VALUE_PARTIAL_INFORMATION KeyValuePartialInfo;
|
||||||
ULONG Length = 0;
|
ULONG Length = 0;
|
||||||
ULONG ResLength = 0;
|
ULONG ResLength = 0;
|
||||||
ULONG Val = 0;
|
ULONG Val = 0;
|
||||||
|
|
||||||
InitializeObjectAttributes(&KeyAttributes, &KeyName, OBJ_CASE_INSENSITIVE,
|
InitializeObjectAttributes(&KeyAttributes, &KeyName, OBJ_CASE_INSENSITIVE,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
Status = ZwOpenKey(&KeyHandle, KEY_READ, &KeyAttributes);
|
Status = ZwOpenKey(&KeyHandle, KEY_READ, &KeyAttributes);
|
||||||
if(!NT_SUCCESS(Status))
|
if(!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ZwQueryValueKey(KeyHandle, &ValueName, KeyValuePartialInformation,
|
Status = ZwQueryValueKey(KeyHandle, &ValueName, KeyValuePartialInformation,
|
||||||
0, 0, &ResLength);
|
0, 0, &ResLength);
|
||||||
if((Status != STATUS_BUFFER_TOO_SMALL))
|
if((Status != STATUS_BUFFER_TOO_SMALL))
|
||||||
{
|
{
|
||||||
NtClose(KeyHandle);
|
NtClose(KeyHandle);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResLength += sizeof(KEY_VALUE_PARTIAL_INFORMATION);
|
ResLength += sizeof(KEY_VALUE_PARTIAL_INFORMATION);
|
||||||
KeyValuePartialInfo = ExAllocatePoolWithTag(PagedPool, ResLength, TAG_STRING);
|
KeyValuePartialInfo = ExAllocatePoolWithTag(PagedPool, ResLength, TAG_STRING);
|
||||||
Length = ResLength;
|
Length = ResLength;
|
||||||
|
|
||||||
if(!KeyValuePartialInfo)
|
if(!KeyValuePartialInfo)
|
||||||
{
|
{
|
||||||
NtClose(KeyHandle);
|
NtClose(KeyHandle);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ZwQueryValueKey(KeyHandle, &ValueName, KeyValuePartialInformation,
|
Status = ZwQueryValueKey(KeyHandle, &ValueName, KeyValuePartialInformation,
|
||||||
(PVOID)KeyValuePartialInfo, Length, &ResLength);
|
(PVOID)KeyValuePartialInfo, Length, &ResLength);
|
||||||
if(!NT_SUCCESS(Status) || (KeyValuePartialInfo->Type != REG_SZ))
|
if(!NT_SUCCESS(Status) || (KeyValuePartialInfo->Type != REG_SZ))
|
||||||
{
|
{
|
||||||
NtClose(KeyHandle);
|
NtClose(KeyHandle);
|
||||||
ExFreePool(KeyValuePartialInfo);
|
ExFreePool(KeyValuePartialInfo);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ValueName.Length = KeyValuePartialInfo->DataLength;
|
ValueName.Length = KeyValuePartialInfo->DataLength;
|
||||||
ValueName.MaximumLength = KeyValuePartialInfo->DataLength;
|
ValueName.MaximumLength = KeyValuePartialInfo->DataLength;
|
||||||
ValueName.Buffer = (PWSTR)KeyValuePartialInfo->Data;
|
ValueName.Buffer = (PWSTR)KeyValuePartialInfo->Data;
|
||||||
|
|
||||||
Status = RtlUnicodeStringToInteger(&ValueName, 0, &Val);
|
Status = RtlUnicodeStringToInteger(&ValueName, 0, &Val);
|
||||||
if(!NT_SUCCESS(Status))
|
if(!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
Val = 0;
|
Val = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExFreePool(KeyValuePartialInfo);
|
ExFreePool(KeyValuePartialInfo);
|
||||||
NtClose(KeyHandle);
|
NtClose(KeyHandle);
|
||||||
|
|
||||||
return (UINT)Val;
|
return (UINT)Val;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT FASTCALL
|
UINT FASTCALL
|
||||||
IntGetCaretBlinkTime(VOID)
|
IntGetCaretBlinkTime(VOID)
|
||||||
{
|
{
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
UINT Ret;
|
UINT Ret;
|
||||||
|
|
||||||
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
||||||
|
|
||||||
Ret = WinStaObject->CaretBlinkRate;
|
Ret = WinStaObject->CaretBlinkRate;
|
||||||
if(!Ret)
|
if(!Ret)
|
||||||
{
|
{
|
||||||
/* load it from the registry the first call only! */
|
/* load it from the registry the first call only! */
|
||||||
Ret = WinStaObject->CaretBlinkRate = IntQueryCaretBlinkRate();
|
Ret = WinStaObject->CaretBlinkRate = IntQueryCaretBlinkRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* windows doesn't do this check */
|
/* windows doesn't do this check */
|
||||||
if((Ret < MIN_CARETBLINKRATE) || (Ret > MAX_CARETBLINKRATE))
|
if((Ret < MIN_CARETBLINKRATE) || (Ret > MAX_CARETBLINKRATE))
|
||||||
{
|
{
|
||||||
Ret = DEFAULT_CARETBLINKRATE;
|
Ret = DEFAULT_CARETBLINKRATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
co_IntSetCaretPos(int X, int Y)
|
co_IntSetCaretPos(int X, int Y)
|
||||||
{
|
{
|
||||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
||||||
|
|
||||||
if(ThreadQueue->CaretInfo->hWnd)
|
if(ThreadQueue->CaretInfo->hWnd)
|
||||||
{
|
{
|
||||||
if(ThreadQueue->CaretInfo->Pos.x != X || ThreadQueue->CaretInfo->Pos.y != Y)
|
if(ThreadQueue->CaretInfo->Pos.x != X || ThreadQueue->CaretInfo->Pos.y != Y)
|
||||||
{
|
{
|
||||||
co_IntHideCaret(ThreadQueue->CaretInfo);
|
co_IntHideCaret(ThreadQueue->CaretInfo);
|
||||||
ThreadQueue->CaretInfo->Showing = 0;
|
ThreadQueue->CaretInfo->Showing = 0;
|
||||||
ThreadQueue->CaretInfo->Pos.x = X;
|
ThreadQueue->CaretInfo->Pos.x = X;
|
||||||
ThreadQueue->CaretInfo->Pos.y = Y;
|
ThreadQueue->CaretInfo->Pos.y = Y;
|
||||||
co_IntSendMessage(ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0);
|
co_IntSendMessage(ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0);
|
||||||
IntSetTimer(ThreadQueue->CaretInfo->hWnd, IDCARETTIMER, IntGetCaretBlinkTime(), NULL, TRUE);
|
IntSetTimer(ThreadQueue->CaretInfo->hWnd, IDCARETTIMER, IntGetCaretBlinkTime(), NULL, TRUE);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
IntSwitchCaretShowing(PVOID Info)
|
IntSwitchCaretShowing(PVOID Info)
|
||||||
{
|
{
|
||||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
||||||
|
|
||||||
if(ThreadQueue->CaretInfo->hWnd)
|
if(ThreadQueue->CaretInfo->hWnd)
|
||||||
{
|
{
|
||||||
ThreadQueue->CaretInfo->Showing = (ThreadQueue->CaretInfo->Showing ? 0 : 1);
|
ThreadQueue->CaretInfo->Showing = (ThreadQueue->CaretInfo->Showing ? 0 : 1);
|
||||||
MmCopyToCaller(Info, ThreadQueue->CaretInfo, sizeof(THRDCARETINFO));
|
MmCopyToCaller(Info, ThreadQueue->CaretInfo, sizeof(THRDCARETINFO));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
co_IntDrawCaret(HWND hWnd)
|
co_IntDrawCaret(HWND hWnd)
|
||||||
{
|
{
|
||||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
||||||
|
|
||||||
if(ThreadQueue->CaretInfo->hWnd && ThreadQueue->CaretInfo->Visible &&
|
if(ThreadQueue->CaretInfo->hWnd && ThreadQueue->CaretInfo->Visible &&
|
||||||
ThreadQueue->CaretInfo->Showing)
|
ThreadQueue->CaretInfo->Showing)
|
||||||
{
|
{
|
||||||
co_IntSendMessage(ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0);
|
co_IntSendMessage(ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0);
|
||||||
ThreadQueue->CaretInfo->Showing = 1;
|
ThreadQueue->CaretInfo->Showing = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -216,63 +216,63 @@ co_IntDrawCaret(HWND hWnd)
|
||||||
BOOL
|
BOOL
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserCreateCaret(
|
NtUserCreateCaret(
|
||||||
HWND hWnd,
|
HWND hWnd,
|
||||||
HBITMAP hBitmap,
|
HBITMAP hBitmap,
|
||||||
int nWidth,
|
int nWidth,
|
||||||
int nHeight)
|
int nHeight)
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT WindowObject;
|
PWINDOW_OBJECT WindowObject;
|
||||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||||
DECLARE_RETURN(BOOL);
|
DECLARE_RETURN(BOOL);
|
||||||
|
|
||||||
DPRINT("Enter NtUserCreateCaret\n");
|
DPRINT("Enter NtUserCreateCaret\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
WindowObject = IntGetWindowObject(hWnd);
|
WindowObject = IntGetWindowObject(hWnd);
|
||||||
if(!WindowObject)
|
if(!WindowObject)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
RETURN(FALSE);
|
RETURN(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(WindowObject->OwnerThread != PsGetCurrentThread())
|
if(WindowObject->OwnerThread != PsGetCurrentThread())
|
||||||
{
|
{
|
||||||
IntReleaseWindowObject(WindowObject);
|
IntReleaseWindowObject(WindowObject);
|
||||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||||
RETURN(FALSE);
|
RETURN(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
||||||
|
|
||||||
if (ThreadQueue->CaretInfo->Visible)
|
if (ThreadQueue->CaretInfo->Visible)
|
||||||
{
|
{
|
||||||
IntKillTimer(hWnd, IDCARETTIMER, TRUE);
|
IntKillTimer(hWnd, IDCARETTIMER, TRUE);
|
||||||
co_IntHideCaret(ThreadQueue->CaretInfo);
|
co_IntHideCaret(ThreadQueue->CaretInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadQueue->CaretInfo->hWnd = hWnd;
|
ThreadQueue->CaretInfo->hWnd = hWnd;
|
||||||
if(hBitmap)
|
if(hBitmap)
|
||||||
{
|
{
|
||||||
ThreadQueue->CaretInfo->Bitmap = hBitmap;
|
ThreadQueue->CaretInfo->Bitmap = hBitmap;
|
||||||
ThreadQueue->CaretInfo->Size.cx = ThreadQueue->CaretInfo->Size.cy = 0;
|
ThreadQueue->CaretInfo->Size.cx = ThreadQueue->CaretInfo->Size.cy = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ThreadQueue->CaretInfo->Bitmap = (HBITMAP)0;
|
ThreadQueue->CaretInfo->Bitmap = (HBITMAP)0;
|
||||||
ThreadQueue->CaretInfo->Size.cx = nWidth;
|
ThreadQueue->CaretInfo->Size.cx = nWidth;
|
||||||
ThreadQueue->CaretInfo->Size.cy = nHeight;
|
ThreadQueue->CaretInfo->Size.cy = nHeight;
|
||||||
}
|
}
|
||||||
ThreadQueue->CaretInfo->Visible = 0;
|
ThreadQueue->CaretInfo->Visible = 0;
|
||||||
ThreadQueue->CaretInfo->Showing = 0;
|
ThreadQueue->CaretInfo->Showing = 0;
|
||||||
|
|
||||||
IntReleaseWindowObject(WindowObject);
|
IntReleaseWindowObject(WindowObject);
|
||||||
|
|
||||||
RETURN(TRUE);
|
RETURN(TRUE);
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserCreateCaret, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserCreateCaret, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT
|
UINT
|
||||||
|
@ -283,9 +283,9 @@ NtUserGetCaretBlinkTime(VOID)
|
||||||
|
|
||||||
DPRINT("Enter NtUserGetCaretBlinkTime\n");
|
DPRINT("Enter NtUserGetCaretBlinkTime\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
RETURN(IntGetCaretBlinkTime());
|
RETURN(IntGetCaretBlinkTime());
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserGetCaretBlinkTime, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserGetCaretBlinkTime, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
|
@ -295,99 +295,99 @@ CLEANUP:
|
||||||
BOOL
|
BOOL
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserGetCaretPos(
|
NtUserGetCaretPos(
|
||||||
LPPOINT lpPoint)
|
LPPOINT lpPoint)
|
||||||
{
|
{
|
||||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
DECLARE_RETURN(BOOL);
|
DECLARE_RETURN(BOOL);
|
||||||
|
|
||||||
DPRINT("Enter NtUserGetCaretPos\n");
|
DPRINT("Enter NtUserGetCaretPos\n");
|
||||||
UserEnterShared();
|
UserEnterShared();
|
||||||
|
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
||||||
|
|
||||||
Status = MmCopyToCaller(lpPoint, &(ThreadQueue->CaretInfo->Pos), sizeof(POINT));
|
Status = MmCopyToCaller(lpPoint, &(ThreadQueue->CaretInfo->Pos), sizeof(POINT));
|
||||||
if(!NT_SUCCESS(Status))
|
if(!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
RETURN(FALSE);
|
RETURN(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RETURN(TRUE);
|
||||||
|
|
||||||
RETURN(TRUE);
|
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserGetCaretPos, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserGetCaretPos, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL FASTCALL co_UserHideCaret(PWINDOW_OBJECT WindowObject)
|
BOOL FASTCALL co_UserHideCaret(PWINDOW_OBJECT WindowObject)
|
||||||
{
|
{
|
||||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||||
|
|
||||||
if(WindowObject->OwnerThread != PsGetCurrentThread())
|
|
||||||
{
|
|
||||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
if(WindowObject->OwnerThread != PsGetCurrentThread())
|
||||||
|
{
|
||||||
|
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if(ThreadQueue->CaretInfo->hWnd != WindowObject->hSelf)
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
||||||
{
|
|
||||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ThreadQueue->CaretInfo->Visible)
|
if(ThreadQueue->CaretInfo->hWnd != WindowObject->hSelf)
|
||||||
{
|
{
|
||||||
IntKillTimer(WindowObject->hSelf, IDCARETTIMER, TRUE);
|
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
co_IntHideCaret(ThreadQueue->CaretInfo);
|
if(ThreadQueue->CaretInfo->Visible)
|
||||||
ThreadQueue->CaretInfo->Visible = 0;
|
{
|
||||||
ThreadQueue->CaretInfo->Showing = 0;
|
IntKillTimer(WindowObject->hSelf, IDCARETTIMER, TRUE);
|
||||||
}
|
|
||||||
|
co_IntHideCaret(ThreadQueue->CaretInfo);
|
||||||
return TRUE;
|
ThreadQueue->CaretInfo->Visible = 0;
|
||||||
}
|
ThreadQueue->CaretInfo->Showing = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserHideCaret(
|
NtUserHideCaret(
|
||||||
HWND hWnd)
|
HWND hWnd)
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT WindowObject;
|
PWINDOW_OBJECT WindowObject;
|
||||||
DECLARE_RETURN(BOOL);
|
DECLARE_RETURN(BOOL);
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
DPRINT("Enter NtUserHideCaret\n");
|
DPRINT("Enter NtUserHideCaret\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
WindowObject = IntGetWindowObject(hWnd);
|
WindowObject = IntGetWindowObject(hWnd);
|
||||||
if(!WindowObject)
|
if(!WindowObject)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
||||||
RETURN(FALSE);
|
RETURN(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = co_UserHideCaret(WindowObject);
|
ret = co_UserHideCaret(WindowObject);
|
||||||
IntReleaseWindowObject(WindowObject);
|
IntReleaseWindowObject(WindowObject);
|
||||||
|
|
||||||
RETURN(ret);
|
RETURN(ret);
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserHideCaret, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserHideCaret, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL FASTCALL co_UserShowCaret(PWINDOW_OBJECT Window)
|
BOOL FASTCALL co_UserShowCaret(PWINDOW_OBJECT Window)
|
||||||
{
|
{
|
||||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||||
|
|
||||||
if(Window->OwnerThread != PsGetCurrentThread())
|
if(Window->OwnerThread != PsGetCurrentThread())
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||||
|
@ -411,7 +411,7 @@ BOOL FASTCALL co_UserShowCaret(PWINDOW_OBJECT Window)
|
||||||
}
|
}
|
||||||
IntSetTimer(Window->hSelf, IDCARETTIMER, IntGetCaretBlinkTime(), NULL, TRUE);
|
IntSetTimer(Window->hSelf, IDCARETTIMER, IntGetCaretBlinkTime(), NULL, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,28 +419,28 @@ BOOL FASTCALL co_UserShowCaret(PWINDOW_OBJECT Window)
|
||||||
BOOL
|
BOOL
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserShowCaret(
|
NtUserShowCaret(
|
||||||
HWND hWnd)
|
HWND hWnd)
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT WindowObject;
|
PWINDOW_OBJECT WindowObject;
|
||||||
DECLARE_RETURN(BOOL);
|
DECLARE_RETURN(BOOL);
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
DPRINT("Enter NtUserShowCaret\n");
|
DPRINT("Enter NtUserShowCaret\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
WindowObject = IntGetWindowObject(hWnd);
|
WindowObject = IntGetWindowObject(hWnd);
|
||||||
if(!WindowObject)
|
if(!WindowObject)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
||||||
RETURN(FALSE);
|
RETURN(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = co_UserShowCaret(WindowObject);
|
||||||
|
IntReleaseWindowObject(WindowObject);
|
||||||
|
RETURN(ret);
|
||||||
|
|
||||||
ret = co_UserShowCaret(WindowObject);
|
|
||||||
IntReleaseWindowObject(WindowObject);
|
|
||||||
RETURN(ret);
|
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserShowCaret, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserShowCaret, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,13 +38,13 @@
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
InitClassImpl(VOID)
|
InitClassImpl(VOID)
|
||||||
{
|
{
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
CleanupClassImpl(VOID)
|
CleanupClassImpl(VOID)
|
||||||
{
|
{
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
|
@ -102,9 +102,9 @@ ClassReferenceClassByName(
|
||||||
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
||||||
|
|
||||||
Status = RtlLookupAtomInAtomTable(
|
Status = RtlLookupAtomInAtomTable(
|
||||||
WinStaObject->AtomTable,
|
WinStaObject->AtomTable,
|
||||||
(LPWSTR)ClassName,
|
(LPWSTR)ClassName,
|
||||||
&ClassAtom);
|
&ClassAtom);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -144,14 +144,14 @@ NtUserGetClassInfo(
|
||||||
PWNDCLASS_OBJECT Class;
|
PWNDCLASS_OBJECT Class;
|
||||||
RTL_ATOM Atom;
|
RTL_ATOM Atom;
|
||||||
DECLARE_RETURN(DWORD);
|
DECLARE_RETURN(DWORD);
|
||||||
|
|
||||||
if (IS_ATOM(lpClassName))
|
if (IS_ATOM(lpClassName))
|
||||||
DPRINT("NtUserGetClassInfo - %x (%lx)\n", lpClassName, hInstance);
|
DPRINT("NtUserGetClassInfo - %x (%lx)\n", lpClassName, hInstance);
|
||||||
else
|
else
|
||||||
DPRINT("NtUserGetClassInfo - %S (%lx)\n", lpClassName, hInstance);
|
DPRINT("NtUserGetClassInfo - %S (%lx)\n", lpClassName, hInstance);
|
||||||
|
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
if (!ClassReferenceClassByNameOrAtom(&Class, lpClassName, hInstance))
|
if (!ClassReferenceClassByNameOrAtom(&Class, lpClassName, hInstance))
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_CLASS_DOES_NOT_EXIST);
|
SetLastWin32Error(ERROR_CLASS_DOES_NOT_EXIST);
|
||||||
|
@ -182,7 +182,7 @@ NtUserGetClassInfo(
|
||||||
ObmDereferenceObject(Class);
|
ObmDereferenceObject(Class);
|
||||||
|
|
||||||
RETURN(Atom);
|
RETURN(Atom);
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserGetClassInfo, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserGetClassInfo, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
|
@ -191,7 +191,7 @@ CLEANUP:
|
||||||
|
|
||||||
ULONG FASTCALL
|
ULONG FASTCALL
|
||||||
IntGetClassName(struct _WINDOW_OBJECT *WindowObject, LPWSTR lpClassName,
|
IntGetClassName(struct _WINDOW_OBJECT *WindowObject, LPWSTR lpClassName,
|
||||||
ULONG nMaxCount)
|
ULONG nMaxCount)
|
||||||
{
|
{
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
LPWSTR Name;
|
LPWSTR Name;
|
||||||
|
@ -207,10 +207,10 @@ IntGetClassName(struct _WINDOW_OBJECT *WindowObject, LPWSTR lpClassName,
|
||||||
|
|
||||||
Length = 0;
|
Length = 0;
|
||||||
Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable,
|
Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable,
|
||||||
WindowObject->Class->Atom, NULL, NULL, NULL, &Length);
|
WindowObject->Class->Atom, NULL, NULL, NULL, &Length);
|
||||||
Name = ExAllocatePoolWithTag(PagedPool, Length + sizeof(UNICODE_NULL), TAG_STRING);
|
Name = ExAllocatePoolWithTag(PagedPool, Length + sizeof(UNICODE_NULL), TAG_STRING);
|
||||||
Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable,
|
Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable,
|
||||||
WindowObject->Class->Atom, NULL, NULL, Name, &Length);
|
WindowObject->Class->Atom, NULL, NULL, Name, &Length);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("IntGetClassName: RtlQueryAtomInAtomTable failed\n");
|
DPRINT("IntGetClassName: RtlQueryAtomInAtomTable failed\n");
|
||||||
|
@ -231,16 +231,16 @@ IntGetClassName(struct _WINDOW_OBJECT *WindowObject, LPWSTR lpClassName,
|
||||||
|
|
||||||
DWORD STDCALL
|
DWORD STDCALL
|
||||||
NtUserGetClassName (
|
NtUserGetClassName (
|
||||||
HWND hWnd,
|
HWND hWnd,
|
||||||
LPWSTR lpClassName,
|
LPWSTR lpClassName,
|
||||||
ULONG nMaxCount)
|
ULONG nMaxCount)
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT WindowObject;
|
PWINDOW_OBJECT WindowObject;
|
||||||
LONG Length;
|
LONG Length;
|
||||||
DECLARE_RETURN(DWORD);
|
DECLARE_RETURN(DWORD);
|
||||||
|
|
||||||
UserEnterShared();
|
UserEnterShared();
|
||||||
|
|
||||||
WindowObject = IntGetWindowObject(hWnd);
|
WindowObject = IntGetWindowObject(hWnd);
|
||||||
if (WindowObject == NULL)
|
if (WindowObject == NULL)
|
||||||
{
|
{
|
||||||
|
@ -250,7 +250,7 @@ NtUserGetClassName (
|
||||||
Length = IntGetClassName(WindowObject, lpClassName, nMaxCount);
|
Length = IntGetClassName(WindowObject, lpClassName, nMaxCount);
|
||||||
IntReleaseWindowObject(WindowObject);
|
IntReleaseWindowObject(WindowObject);
|
||||||
RETURN(Length);
|
RETURN(Length);
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserGetClassName, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserGetClassName, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
|
@ -259,10 +259,10 @@ CLEANUP:
|
||||||
|
|
||||||
DWORD STDCALL
|
DWORD STDCALL
|
||||||
NtUserGetWOWClass(DWORD Unknown0,
|
NtUserGetWOWClass(DWORD Unknown0,
|
||||||
DWORD Unknown1)
|
DWORD Unknown1)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
PWNDCLASS_OBJECT FASTCALL
|
PWNDCLASS_OBJECT FASTCALL
|
||||||
|
@ -273,101 +273,104 @@ IntCreateClass(
|
||||||
PUNICODE_STRING MenuName,
|
PUNICODE_STRING MenuName,
|
||||||
RTL_ATOM Atom)
|
RTL_ATOM Atom)
|
||||||
{
|
{
|
||||||
PWNDCLASS_OBJECT ClassObject;
|
PWNDCLASS_OBJECT ClassObject;
|
||||||
ULONG objectSize;
|
ULONG objectSize;
|
||||||
BOOL Global;
|
BOOL Global;
|
||||||
|
|
||||||
Global = (Flags & REGISTERCLASS_SYSTEM) || (lpwcx->style & CS_GLOBALCLASS) ? TRUE : FALSE;
|
Global = (Flags & REGISTERCLASS_SYSTEM) || (lpwcx->style & CS_GLOBALCLASS) ? TRUE : FALSE;
|
||||||
|
|
||||||
/* Check for double registration of the class. */
|
/* Check for double registration of the class. */
|
||||||
if (PsGetWin32Process() != NULL)
|
if (PsGetWin32Process() != NULL)
|
||||||
{
|
{
|
||||||
if (ClassReferenceClassByAtom(&ClassObject, Atom, lpwcx->hInstance))
|
if (ClassReferenceClassByAtom(&ClassObject, Atom, lpwcx->hInstance))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* NOTE: We may also get a global class from
|
* NOTE: We may also get a global class from
|
||||||
* ClassReferenceClassByAtom. This simple check
|
* ClassReferenceClassByAtom. This simple check
|
||||||
* prevents that we fail valid request.
|
* prevents that we fail valid request.
|
||||||
*/
|
*/
|
||||||
if (ClassObject->hInstance == lpwcx->hInstance)
|
if (ClassObject->hInstance == lpwcx->hInstance)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_CLASS_ALREADY_EXISTS);
|
SetLastWin32Error(ERROR_CLASS_ALREADY_EXISTS);
|
||||||
ObmDereferenceObject(ClassObject);
|
ObmDereferenceObject(ClassObject);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
objectSize = sizeof(WNDCLASS_OBJECT) + lpwcx->cbClsExtra;
|
objectSize = sizeof(WNDCLASS_OBJECT) + lpwcx->cbClsExtra;
|
||||||
ClassObject = ObmCreateObject(&gHandleTable, NULL, otClass, objectSize);
|
ClassObject = ObmCreateObject(&gHandleTable, NULL, otClass, objectSize);
|
||||||
if (ClassObject == 0)
|
if (ClassObject == 0)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
|
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassObject->cbSize = lpwcx->cbSize;
|
ClassObject->cbSize = lpwcx->cbSize;
|
||||||
ClassObject->style = lpwcx->style;
|
ClassObject->style = lpwcx->style;
|
||||||
ClassObject->cbClsExtra = lpwcx->cbClsExtra;
|
ClassObject->cbClsExtra = lpwcx->cbClsExtra;
|
||||||
ClassObject->cbWndExtra = lpwcx->cbWndExtra;
|
ClassObject->cbWndExtra = lpwcx->cbWndExtra;
|
||||||
ClassObject->hInstance = lpwcx->hInstance;
|
ClassObject->hInstance = lpwcx->hInstance;
|
||||||
ClassObject->hIcon = lpwcx->hIcon;
|
ClassObject->hIcon = lpwcx->hIcon;
|
||||||
ClassObject->hCursor = lpwcx->hCursor;
|
ClassObject->hCursor = lpwcx->hCursor;
|
||||||
ClassObject->hbrBackground = lpwcx->hbrBackground;
|
ClassObject->hbrBackground = lpwcx->hbrBackground;
|
||||||
ClassObject->Unicode = !(Flags & REGISTERCLASS_ANSI);
|
ClassObject->Unicode = !(Flags & REGISTERCLASS_ANSI);
|
||||||
ClassObject->Global = Global;
|
ClassObject->Global = Global;
|
||||||
ClassObject->hIconSm = lpwcx->hIconSm;
|
ClassObject->hIconSm = lpwcx->hIconSm;
|
||||||
ClassObject->Atom = Atom;
|
ClassObject->Atom = Atom;
|
||||||
if (wpExtra == NULL) {
|
if (wpExtra == NULL)
|
||||||
if (Flags & REGISTERCLASS_ANSI)
|
{
|
||||||
{
|
if (Flags & REGISTERCLASS_ANSI)
|
||||||
ClassObject->lpfnWndProcA = lpwcx->lpfnWndProc;
|
{
|
||||||
ClassObject->lpfnWndProcW = (WNDPROC)IntAddWndProcHandle(lpwcx->lpfnWndProc,FALSE);
|
ClassObject->lpfnWndProcA = lpwcx->lpfnWndProc;
|
||||||
}
|
ClassObject->lpfnWndProcW = (WNDPROC)IntAddWndProcHandle(lpwcx->lpfnWndProc,FALSE);
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
ClassObject->lpfnWndProcW = lpwcx->lpfnWndProc;
|
{
|
||||||
ClassObject->lpfnWndProcA = (WNDPROC)IntAddWndProcHandle(lpwcx->lpfnWndProc,TRUE);
|
ClassObject->lpfnWndProcW = lpwcx->lpfnWndProc;
|
||||||
}
|
ClassObject->lpfnWndProcA = (WNDPROC)IntAddWndProcHandle(lpwcx->lpfnWndProc,TRUE);
|
||||||
} else {
|
}
|
||||||
if (Flags & REGISTERCLASS_ANSI)
|
}
|
||||||
{
|
else
|
||||||
ClassObject->lpfnWndProcA = lpwcx->lpfnWndProc;
|
{
|
||||||
ClassObject->lpfnWndProcW = wpExtra;
|
if (Flags & REGISTERCLASS_ANSI)
|
||||||
}
|
{
|
||||||
else
|
ClassObject->lpfnWndProcA = lpwcx->lpfnWndProc;
|
||||||
{
|
ClassObject->lpfnWndProcW = wpExtra;
|
||||||
ClassObject->lpfnWndProcW = lpwcx->lpfnWndProc;
|
}
|
||||||
ClassObject->lpfnWndProcA = wpExtra;
|
else
|
||||||
}
|
{
|
||||||
}
|
ClassObject->lpfnWndProcW = lpwcx->lpfnWndProc;
|
||||||
if (MenuName->Length == 0)
|
ClassObject->lpfnWndProcA = wpExtra;
|
||||||
{
|
}
|
||||||
ClassObject->lpszMenuName.Length =
|
}
|
||||||
ClassObject->lpszMenuName.MaximumLength = 0;
|
if (MenuName->Length == 0)
|
||||||
ClassObject->lpszMenuName.Buffer = MenuName->Buffer;
|
{
|
||||||
}
|
ClassObject->lpszMenuName.Length =
|
||||||
else
|
ClassObject->lpszMenuName.MaximumLength = 0;
|
||||||
{
|
ClassObject->lpszMenuName.Buffer = MenuName->Buffer;
|
||||||
ClassObject->lpszMenuName.Length =
|
}
|
||||||
ClassObject->lpszMenuName.MaximumLength = MenuName->MaximumLength;
|
else
|
||||||
ClassObject->lpszMenuName.Buffer = ExAllocatePoolWithTag(PagedPool, ClassObject->lpszMenuName.MaximumLength, TAG_STRING);
|
{
|
||||||
RtlCopyUnicodeString(&ClassObject->lpszMenuName, MenuName);
|
ClassObject->lpszMenuName.Length =
|
||||||
}
|
ClassObject->lpszMenuName.MaximumLength = MenuName->MaximumLength;
|
||||||
/* Extra class data */
|
ClassObject->lpszMenuName.Buffer = ExAllocatePoolWithTag(PagedPool, ClassObject->lpszMenuName.MaximumLength, TAG_STRING);
|
||||||
if (ClassObject->cbClsExtra != 0)
|
RtlCopyUnicodeString(&ClassObject->lpszMenuName, MenuName);
|
||||||
{
|
}
|
||||||
ClassObject->ExtraData = (PCHAR)(ClassObject + 1);
|
/* Extra class data */
|
||||||
RtlZeroMemory(ClassObject->ExtraData, (ULONG)ClassObject->cbClsExtra);
|
if (ClassObject->cbClsExtra != 0)
|
||||||
}
|
{
|
||||||
else
|
ClassObject->ExtraData = (PCHAR)(ClassObject + 1);
|
||||||
{
|
RtlZeroMemory(ClassObject->ExtraData, (ULONG)ClassObject->cbClsExtra);
|
||||||
ClassObject->ExtraData = NULL;
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
ClassObject->ExtraData = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
InitializeListHead(&ClassObject->ClassWindowsListHead);
|
InitializeListHead(&ClassObject->ClassWindowsListHead);
|
||||||
|
|
||||||
return(ClassObject);
|
return(ClassObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
RTL_ATOM STDCALL
|
RTL_ATOM STDCALL
|
||||||
|
@ -428,279 +431,279 @@ NtUserRegisterClassExWOW(
|
||||||
RETURN( (RTL_ATOM)0);
|
RETURN( (RTL_ATOM)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
||||||
|
|
||||||
if (ClassName->Length > 0)
|
if (ClassName->Length > 0)
|
||||||
{
|
{
|
||||||
DPRINT("NtUserRegisterClassExWOW(%S)\n", ClassName->Buffer);
|
DPRINT("NtUserRegisterClassExWOW(%S)\n", ClassName->Buffer);
|
||||||
/* FIXME - Safely copy/verify the buffer first!!! */
|
/* FIXME - Safely copy/verify the buffer first!!! */
|
||||||
Status = RtlAddAtomToAtomTable(WinStaObject->AtomTable,
|
Status = RtlAddAtomToAtomTable(WinStaObject->AtomTable,
|
||||||
ClassName->Buffer,
|
ClassName->Buffer,
|
||||||
&Atom);
|
&Atom);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Failed adding class name (%S) to atom table\n",
|
DPRINT1("Failed adding class name (%S) to atom table\n",
|
||||||
ClassName->Buffer);
|
ClassName->Buffer);
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
|
RETURN((RTL_ATOM)0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Atom = (RTL_ATOM)(ULONG)ClassName->Buffer;
|
||||||
|
}
|
||||||
|
ClassObject = IntCreateClass(&SafeClass, Flags, wpExtra, MenuName, Atom);
|
||||||
|
if (ClassObject == NULL)
|
||||||
|
{
|
||||||
|
if (ClassName->Length)
|
||||||
|
{
|
||||||
|
RtlDeleteAtomFromAtomTable(WinStaObject->AtomTable, Atom);
|
||||||
|
}
|
||||||
|
DPRINT("Failed creating window class object\n");
|
||||||
RETURN((RTL_ATOM)0);
|
RETURN((RTL_ATOM)0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Atom = (RTL_ATOM)(ULONG)ClassName->Buffer;
|
|
||||||
}
|
|
||||||
ClassObject = IntCreateClass(&SafeClass, Flags, wpExtra, MenuName, Atom);
|
|
||||||
if (ClassObject == NULL)
|
|
||||||
{
|
|
||||||
if (ClassName->Length)
|
|
||||||
{
|
|
||||||
RtlDeleteAtomFromAtomTable(WinStaObject->AtomTable, Atom);
|
|
||||||
}
|
|
||||||
DPRINT("Failed creating window class object\n");
|
|
||||||
RETURN((RTL_ATOM)0);
|
|
||||||
}
|
|
||||||
|
|
||||||
InsertTailList(&PsGetWin32Process()->ClassListHead, &ClassObject->ListEntry);
|
InsertTailList(&PsGetWin32Process()->ClassListHead, &ClassObject->ListEntry);
|
||||||
|
|
||||||
RETURN(Atom);
|
RETURN(Atom);
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserRegisterClassExWOW, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserRegisterClassExWOW, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG FASTCALL
|
ULONG FASTCALL
|
||||||
IntGetClassLong(struct _WINDOW_OBJECT *Window, ULONG Offset, BOOL Ansi)
|
IntGetClassLong(struct _WINDOW_OBJECT *Window, ULONG Offset, BOOL Ansi)
|
||||||
{
|
{
|
||||||
LONG Ret;
|
LONG Ret;
|
||||||
|
|
||||||
if ((int)Offset >= 0)
|
if ((int)Offset >= 0)
|
||||||
{
|
{
|
||||||
DPRINT("GetClassLong(%x, %d)\n", Window->hSelf, Offset);
|
DPRINT("GetClassLong(%x, %d)\n", Window->hSelf, Offset);
|
||||||
if ((Offset + sizeof(LONG)) > Window->Class->cbClsExtra)
|
if ((Offset + sizeof(LONG)) > Window->Class->cbClsExtra)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Ret = *((LONG *)(Window->Class->ExtraData + Offset));
|
Ret = *((LONG *)(Window->Class->ExtraData + Offset));
|
||||||
DPRINT("Result: %x\n", Ret);
|
DPRINT("Result: %x\n", Ret);
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Offset)
|
switch (Offset)
|
||||||
{
|
{
|
||||||
case GCL_CBWNDEXTRA:
|
case GCL_CBWNDEXTRA:
|
||||||
Ret = Window->Class->cbWndExtra;
|
Ret = Window->Class->cbWndExtra;
|
||||||
break;
|
break;
|
||||||
case GCL_CBCLSEXTRA:
|
case GCL_CBCLSEXTRA:
|
||||||
Ret = Window->Class->cbClsExtra;
|
Ret = Window->Class->cbClsExtra;
|
||||||
break;
|
break;
|
||||||
case GCL_HBRBACKGROUND:
|
case GCL_HBRBACKGROUND:
|
||||||
Ret = (ULONG)Window->Class->hbrBackground;
|
Ret = (ULONG)Window->Class->hbrBackground;
|
||||||
break;
|
break;
|
||||||
case GCL_HCURSOR:
|
case GCL_HCURSOR:
|
||||||
Ret = (ULONG)Window->Class->hCursor;
|
Ret = (ULONG)Window->Class->hCursor;
|
||||||
break;
|
break;
|
||||||
case GCL_HICON:
|
case GCL_HICON:
|
||||||
Ret = (ULONG)Window->Class->hIcon;
|
Ret = (ULONG)Window->Class->hIcon;
|
||||||
break;
|
break;
|
||||||
case GCL_HICONSM:
|
case GCL_HICONSM:
|
||||||
Ret = (ULONG)Window->Class->hIconSm;
|
Ret = (ULONG)Window->Class->hIconSm;
|
||||||
break;
|
break;
|
||||||
case GCL_HMODULE:
|
case GCL_HMODULE:
|
||||||
Ret = (ULONG)Window->Class->hInstance;
|
Ret = (ULONG)Window->Class->hInstance;
|
||||||
break;
|
break;
|
||||||
case GCL_MENUNAME:
|
case GCL_MENUNAME:
|
||||||
Ret = (ULONG)Window->Class->lpszMenuName.Buffer;
|
Ret = (ULONG)Window->Class->lpszMenuName.Buffer;
|
||||||
break;
|
break;
|
||||||
case GCL_STYLE:
|
case GCL_STYLE:
|
||||||
Ret = Window->Class->style;
|
Ret = Window->Class->style;
|
||||||
break;
|
break;
|
||||||
case GCL_WNDPROC:
|
case GCL_WNDPROC:
|
||||||
if (Ansi)
|
if (Ansi)
|
||||||
{
|
{
|
||||||
Ret = (ULONG)Window->Class->lpfnWndProcA;
|
Ret = (ULONG)Window->Class->lpfnWndProcA;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Ret = (ULONG)Window->Class->lpfnWndProcW;
|
Ret = (ULONG)Window->Class->lpfnWndProcW;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Ret = 0;
|
Ret = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return(Ret);
|
return(Ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD STDCALL
|
DWORD STDCALL
|
||||||
NtUserGetClassLong(HWND hWnd, DWORD Offset, BOOL Ansi)
|
NtUserGetClassLong(HWND hWnd, DWORD Offset, BOOL Ansi)
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT Window;
|
PWINDOW_OBJECT Window;
|
||||||
DECLARE_RETURN(DWORD);
|
DECLARE_RETURN(DWORD);
|
||||||
|
|
||||||
DPRINT("Enter NtUserGetClassLong\n");
|
DPRINT("Enter NtUserGetClassLong\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
|
if (!(Window = UserGetWindowObject(hWnd)))
|
||||||
|
{
|
||||||
|
RETURN(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
RETURN(IntGetClassLong(Window, Offset, Ansi));
|
||||||
|
|
||||||
if (!(Window = UserGetWindowObject(hWnd)))
|
|
||||||
{
|
|
||||||
RETURN(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
RETURN(IntGetClassLong(Window, Offset, Ansi));
|
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserGetClassLong, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserGetClassLong, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FASTCALL
|
void FASTCALL
|
||||||
co_IntSetClassLong(PWINDOW_OBJECT Window, ULONG Offset, LONG dwNewLong, BOOL Ansi)
|
co_IntSetClassLong(PWINDOW_OBJECT Window, ULONG Offset, LONG dwNewLong, BOOL Ansi)
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT Parent, Owner;
|
PWINDOW_OBJECT Parent, Owner;
|
||||||
|
|
||||||
ASSERT_REFS_CO(Window);
|
ASSERT_REFS_CO(Window);
|
||||||
|
|
||||||
if ((int)Offset >= 0)
|
if ((int)Offset >= 0)
|
||||||
{
|
{
|
||||||
DPRINT("SetClassLong(%x, %d, %x)\n", Window->hSelf, Offset, dwNewLong);
|
DPRINT("SetClassLong(%x, %d, %x)\n", Window->hSelf, Offset, dwNewLong);
|
||||||
if ((Offset + sizeof(LONG)) > Window->Class->cbClsExtra)
|
if ((Offset + sizeof(LONG)) > Window->Class->cbClsExtra)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*((LONG *)(Window->Class->ExtraData + Offset)) = dwNewLong;
|
*((LONG *)(Window->Class->ExtraData + Offset)) = dwNewLong;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Offset)
|
switch (Offset)
|
||||||
{
|
{
|
||||||
case GCL_CBWNDEXTRA:
|
case GCL_CBWNDEXTRA:
|
||||||
Window->Class->cbWndExtra = dwNewLong;
|
Window->Class->cbWndExtra = dwNewLong;
|
||||||
break;
|
break;
|
||||||
case GCL_CBCLSEXTRA:
|
case GCL_CBCLSEXTRA:
|
||||||
Window->Class->cbClsExtra = dwNewLong;
|
Window->Class->cbClsExtra = dwNewLong;
|
||||||
break;
|
break;
|
||||||
case GCL_HBRBACKGROUND:
|
case GCL_HBRBACKGROUND:
|
||||||
Window->Class->hbrBackground = (HBRUSH)dwNewLong;
|
Window->Class->hbrBackground = (HBRUSH)dwNewLong;
|
||||||
break;
|
break;
|
||||||
case GCL_HCURSOR:
|
case GCL_HCURSOR:
|
||||||
Window->Class->hCursor = (HCURSOR)dwNewLong;
|
Window->Class->hCursor = (HCURSOR)dwNewLong;
|
||||||
break;
|
break;
|
||||||
case GCL_HICON:
|
case GCL_HICON:
|
||||||
Window->Class->hIcon = (HICON)dwNewLong;
|
Window->Class->hIcon = (HICON)dwNewLong;
|
||||||
Owner = IntGetOwner(Window);
|
Owner = IntGetOwner(Window);
|
||||||
Parent = IntGetParent(Window);
|
Parent = IntGetParent(Window);
|
||||||
|
|
||||||
if ((!Owner) && (!Parent))
|
if ((!Owner) && (!Parent))
|
||||||
{
|
{
|
||||||
co_IntShellHookNotify(HSHELL_REDRAW, (LPARAM) Window->hSelf);
|
co_IntShellHookNotify(HSHELL_REDRAW, (LPARAM) Window->hSelf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Parent)
|
if (Parent)
|
||||||
{
|
{
|
||||||
IntReleaseWindowObject(Parent);
|
IntReleaseWindowObject(Parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Owner)
|
if (Owner)
|
||||||
{
|
{
|
||||||
IntReleaseWindowObject(Owner);
|
IntReleaseWindowObject(Owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case GCL_HICONSM:
|
case GCL_HICONSM:
|
||||||
Window->Class->hIconSm = (HICON)dwNewLong;
|
Window->Class->hIconSm = (HICON)dwNewLong;
|
||||||
break;
|
break;
|
||||||
case GCL_HMODULE:
|
case GCL_HMODULE:
|
||||||
Window->Class->hInstance = (HINSTANCE)dwNewLong;
|
Window->Class->hInstance = (HINSTANCE)dwNewLong;
|
||||||
break;
|
break;
|
||||||
case GCL_MENUNAME:
|
case GCL_MENUNAME:
|
||||||
if (Window->Class->lpszMenuName.MaximumLength)
|
if (Window->Class->lpszMenuName.MaximumLength)
|
||||||
RtlFreeUnicodeString(&Window->Class->lpszMenuName);
|
RtlFreeUnicodeString(&Window->Class->lpszMenuName);
|
||||||
if (!IS_INTRESOURCE(dwNewLong))
|
if (!IS_INTRESOURCE(dwNewLong))
|
||||||
{
|
{
|
||||||
Window->Class->lpszMenuName.Length =
|
Window->Class->lpszMenuName.Length =
|
||||||
Window->Class->lpszMenuName.MaximumLength = ((PUNICODE_STRING)dwNewLong)->MaximumLength;
|
Window->Class->lpszMenuName.MaximumLength = ((PUNICODE_STRING)dwNewLong)->MaximumLength;
|
||||||
Window->Class->lpszMenuName.Buffer = ExAllocatePoolWithTag(PagedPool, Window->Class->lpszMenuName.MaximumLength, TAG_STRING);
|
Window->Class->lpszMenuName.Buffer = ExAllocatePoolWithTag(PagedPool, Window->Class->lpszMenuName.MaximumLength, TAG_STRING);
|
||||||
RtlCopyUnicodeString(&Window->Class->lpszMenuName, (PUNICODE_STRING)dwNewLong);
|
RtlCopyUnicodeString(&Window->Class->lpszMenuName, (PUNICODE_STRING)dwNewLong);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Window->Class->lpszMenuName.Length =
|
Window->Class->lpszMenuName.Length =
|
||||||
Window->Class->lpszMenuName.MaximumLength = 0;
|
Window->Class->lpszMenuName.MaximumLength = 0;
|
||||||
Window->Class->lpszMenuName.Buffer = (LPWSTR)dwNewLong;
|
Window->Class->lpszMenuName.Buffer = (LPWSTR)dwNewLong;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GCL_STYLE:
|
case GCL_STYLE:
|
||||||
Window->Class->style = dwNewLong;
|
Window->Class->style = dwNewLong;
|
||||||
break;
|
break;
|
||||||
case GCL_WNDPROC:
|
case GCL_WNDPROC:
|
||||||
if (Ansi)
|
if (Ansi)
|
||||||
{
|
{
|
||||||
Window->Class->lpfnWndProcA = (WNDPROC)dwNewLong;
|
Window->Class->lpfnWndProcA = (WNDPROC)dwNewLong;
|
||||||
Window->Class->lpfnWndProcW = (WNDPROC) IntAddWndProcHandle((WNDPROC)dwNewLong,FALSE);
|
Window->Class->lpfnWndProcW = (WNDPROC) IntAddWndProcHandle((WNDPROC)dwNewLong,FALSE);
|
||||||
Window->Class->Unicode = FALSE;
|
Window->Class->Unicode = FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Window->Class->lpfnWndProcW = (WNDPROC)dwNewLong;
|
Window->Class->lpfnWndProcW = (WNDPROC)dwNewLong;
|
||||||
Window->Class->lpfnWndProcA = (WNDPROC) IntAddWndProcHandle((WNDPROC)dwNewLong,TRUE);
|
Window->Class->lpfnWndProcA = (WNDPROC) IntAddWndProcHandle((WNDPROC)dwNewLong,TRUE);
|
||||||
Window->Class->Unicode = TRUE;
|
Window->Class->Unicode = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD STDCALL
|
DWORD STDCALL
|
||||||
NtUserSetClassLong(HWND hWnd,
|
NtUserSetClassLong(HWND hWnd,
|
||||||
DWORD Offset,
|
DWORD Offset,
|
||||||
LONG dwNewLong,
|
LONG dwNewLong,
|
||||||
BOOL Ansi)
|
BOOL Ansi)
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT Window;
|
PWINDOW_OBJECT Window;
|
||||||
LONG Ret;
|
LONG Ret;
|
||||||
DECLARE_RETURN(DWORD);
|
DECLARE_RETURN(DWORD);
|
||||||
|
|
||||||
DPRINT("Enter NtUserSetClassLong\n");
|
DPRINT("Enter NtUserSetClassLong\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
|
if (!(Window = UserGetWindowObject(hWnd)))
|
||||||
|
{
|
||||||
|
RETURN(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
UserRefObjectCo(Window);
|
||||||
|
|
||||||
|
Ret = IntGetClassLong(Window, Offset, Ansi);
|
||||||
|
co_IntSetClassLong(Window, Offset, dwNewLong, Ansi);
|
||||||
|
|
||||||
|
UserDerefObjectCo(Window);
|
||||||
|
|
||||||
|
RETURN(Ret);
|
||||||
|
|
||||||
if (!(Window = UserGetWindowObject(hWnd)))
|
|
||||||
{
|
|
||||||
RETURN(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
UserRefObjectCo(Window);
|
|
||||||
|
|
||||||
Ret = IntGetClassLong(Window, Offset, Ansi);
|
|
||||||
co_IntSetClassLong(Window, Offset, dwNewLong, Ansi);
|
|
||||||
|
|
||||||
UserDerefObjectCo(Window);
|
|
||||||
|
|
||||||
RETURN(Ret);
|
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserSetClassLong, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserSetClassLong, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD STDCALL
|
DWORD STDCALL
|
||||||
NtUserSetClassWord(DWORD Unknown0,
|
NtUserSetClassWord(DWORD Unknown0,
|
||||||
DWORD Unknown1,
|
DWORD Unknown1,
|
||||||
DWORD Unknown2)
|
DWORD Unknown2)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtUserUnregisterClass(
|
NtUserUnregisterClass(
|
||||||
LPCWSTR ClassNameOrAtom,
|
LPCWSTR ClassNameOrAtom,
|
||||||
HINSTANCE hInstance,
|
HINSTANCE hInstance,
|
||||||
DWORD Unknown)
|
DWORD Unknown)
|
||||||
{
|
{
|
||||||
PWNDCLASS_OBJECT Class;
|
PWNDCLASS_OBJECT Class;
|
||||||
PWINSTATION_OBJECT WinSta;
|
PWINSTATION_OBJECT WinSta;
|
||||||
|
@ -749,7 +752,7 @@ NtUserUnregisterClass(
|
||||||
ClassDereferenceObject(Class);
|
ClassDereferenceObject(Class);
|
||||||
|
|
||||||
RETURN( TRUE);
|
RETURN( TRUE);
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserUnregisterClass, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserUnregisterClass, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
|
|
|
@ -47,7 +47,7 @@ IntGetClipboardFormatName(UINT format, PUNICODE_STRING FormatName)
|
||||||
{
|
{
|
||||||
|
|
||||||
return IntGetAtomName((RTL_ATOM)format, FormatName->Buffer,
|
return IntGetAtomName((RTL_ATOM)format, FormatName->Buffer,
|
||||||
FormatName->MaximumLength);
|
FormatName->MaximumLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT FASTCALL
|
UINT FASTCALL
|
||||||
|
@ -57,7 +57,7 @@ IntEnumClipboardFormats(UINT format)
|
||||||
CHECK_LOCK
|
CHECK_LOCK
|
||||||
|
|
||||||
if (!hCBData)
|
if (!hCBData)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
//UNIMPLEMENTED;
|
//UNIMPLEMENTED;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -114,12 +114,12 @@ NtUserEmptyClipboard(VOID)
|
||||||
{
|
{
|
||||||
CHECK_LOCK
|
CHECK_LOCK
|
||||||
|
|
||||||
// if (!hCBData)
|
// if (!hCBData)
|
||||||
// return FALSE;
|
// return FALSE;
|
||||||
|
|
||||||
// FIXME!
|
// FIXME!
|
||||||
// GlobalUnlock(hCBData);
|
// GlobalUnlock(hCBData);
|
||||||
// GlobalFree(hCBData);
|
// GlobalFree(hCBData);
|
||||||
hCBData = NULL;
|
hCBData = NULL;
|
||||||
uCBFormat = 0;
|
uCBFormat = 0;
|
||||||
ClipboardWindow = tempClipboardWindow;
|
ClipboardWindow = tempClipboardWindow;
|
||||||
|
@ -133,90 +133,90 @@ NtUserGetClipboardData(UINT uFormat, DWORD Unknown1)
|
||||||
CHECK_LOCK
|
CHECK_LOCK
|
||||||
|
|
||||||
if ((uFormat==1 && uCBFormat==13) || (uFormat==13 && uCBFormat==1))
|
if ((uFormat==1 && uCBFormat==13) || (uFormat==13 && uCBFormat==1))
|
||||||
uCBFormat = uFormat;
|
uCBFormat = uFormat;
|
||||||
|
|
||||||
if (uFormat != uCBFormat)
|
if (uFormat != uCBFormat)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return hCBData;
|
return hCBData;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT STDCALL
|
INT STDCALL
|
||||||
NtUserGetClipboardFormatName(UINT format, PUNICODE_STRING FormatName,
|
NtUserGetClipboardFormatName(UINT format, PUNICODE_STRING FormatName,
|
||||||
INT cchMaxCount)
|
INT cchMaxCount)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PWSTR Buf;
|
PWSTR Buf;
|
||||||
UNICODE_STRING SafeFormatName, BufFormatName;
|
UNICODE_STRING SafeFormatName, BufFormatName;
|
||||||
ULONG Ret;
|
ULONG Ret;
|
||||||
|
|
||||||
if((cchMaxCount < 1) || !FormatName)
|
if((cchMaxCount < 1) || !FormatName)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy the FormatName UNICODE_STRING structure */
|
/* copy the FormatName UNICODE_STRING structure */
|
||||||
Status = MmCopyFromCaller(&SafeFormatName, FormatName, sizeof(UNICODE_STRING));
|
Status = MmCopyFromCaller(&SafeFormatName, FormatName, sizeof(UNICODE_STRING));
|
||||||
if(!NT_SUCCESS(Status))
|
if(!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate memory for the string */
|
/* Allocate memory for the string */
|
||||||
Buf = ExAllocatePoolWithTag(PagedPool, cchMaxCount * sizeof(WCHAR), TAG_STRING);
|
Buf = ExAllocatePoolWithTag(PagedPool, cchMaxCount * sizeof(WCHAR), TAG_STRING);
|
||||||
if(!Buf)
|
if(!Buf)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
|
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup internal unicode string */
|
/* Setup internal unicode string */
|
||||||
BufFormatName.Length = 0;
|
BufFormatName.Length = 0;
|
||||||
BufFormatName.MaximumLength = min(cchMaxCount * sizeof(WCHAR), SafeFormatName.MaximumLength);
|
BufFormatName.MaximumLength = min(cchMaxCount * sizeof(WCHAR), SafeFormatName.MaximumLength);
|
||||||
BufFormatName.Buffer = Buf;
|
BufFormatName.Buffer = Buf;
|
||||||
|
|
||||||
if(BufFormatName.MaximumLength < sizeof(WCHAR))
|
if(BufFormatName.MaximumLength < sizeof(WCHAR))
|
||||||
{
|
{
|
||||||
ExFreePool(Buf);
|
ExFreePool(Buf);
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format >= 0xC000)
|
if (format >= 0xC000)
|
||||||
{
|
{
|
||||||
Ret = IntGetClipboardFormatName(format, &BufFormatName);
|
Ret = IntGetClipboardFormatName(format, &BufFormatName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetLastNtError(NO_ERROR);
|
SetLastNtError(NO_ERROR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy the UNICODE_STRING buffer back to the user */
|
/* copy the UNICODE_STRING buffer back to the user */
|
||||||
Status = MmCopyToCaller(SafeFormatName.Buffer, BufFormatName.Buffer, BufFormatName.MaximumLength);
|
Status = MmCopyToCaller(SafeFormatName.Buffer, BufFormatName.Buffer, BufFormatName.MaximumLength);
|
||||||
if(!NT_SUCCESS(Status))
|
if(!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ExFreePool(Buf);
|
ExFreePool(Buf);
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BufFormatName.MaximumLength = SafeFormatName.MaximumLength;
|
BufFormatName.MaximumLength = SafeFormatName.MaximumLength;
|
||||||
BufFormatName.Buffer = SafeFormatName.Buffer;
|
BufFormatName.Buffer = SafeFormatName.Buffer;
|
||||||
|
|
||||||
/* update the UNICODE_STRING structure (only the Length member should change) */
|
/* update the UNICODE_STRING structure (only the Length member should change) */
|
||||||
Status = MmCopyToCaller(FormatName, &BufFormatName, sizeof(UNICODE_STRING));
|
Status = MmCopyToCaller(FormatName, &BufFormatName, sizeof(UNICODE_STRING));
|
||||||
if(!NT_SUCCESS(Status))
|
if(!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ExFreePool(Buf);
|
ExFreePool(Buf);
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExFreePool(Buf);
|
ExFreePool(Buf);
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND STDCALL
|
HWND STDCALL
|
||||||
|
@ -251,16 +251,17 @@ NtUserIsClipboardFormatAvailable(UINT format)
|
||||||
{
|
{
|
||||||
//UNIMPLEMENTED
|
//UNIMPLEMENTED
|
||||||
|
|
||||||
if (format != 1 && format != 13) {
|
if (format != 1 && format != 13)
|
||||||
|
{
|
||||||
DbgPrint("Clipboard Format unavailable (%d)\n", format);
|
DbgPrint("Clipboard Format unavailable (%d)\n", format);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((format==1 && uCBFormat==13) || (format==13 && uCBFormat==1))
|
if ((format==1 && uCBFormat==13) || (format==13 && uCBFormat==1))
|
||||||
uCBFormat = format;
|
uCBFormat = format;
|
||||||
|
|
||||||
if (format != uCBFormat)
|
if (format != uCBFormat)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -269,48 +270,49 @@ NtUserIsClipboardFormatAvailable(UINT format)
|
||||||
HANDLE STDCALL
|
HANDLE STDCALL
|
||||||
NtUserSetClipboardData(UINT uFormat, HANDLE hMem, DWORD Unknown2)
|
NtUserSetClipboardData(UINT uFormat, HANDLE hMem, DWORD Unknown2)
|
||||||
{
|
{
|
||||||
// LPVOID pMem;
|
// LPVOID pMem;
|
||||||
CHECK_LOCK
|
CHECK_LOCK
|
||||||
|
|
||||||
|
|
||||||
if (uFormat != 1 && uFormat != 13) {
|
if (uFormat != 1 && uFormat != 13)
|
||||||
|
{
|
||||||
DbgPrint("Clipboard unsupported format (%d)\n", uFormat);
|
DbgPrint("Clipboard unsupported format (%d)\n", uFormat);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hMem)
|
if (hMem)
|
||||||
{
|
{
|
||||||
uCBFormat = uFormat;
|
uCBFormat = uFormat;
|
||||||
hCBData = hMem;
|
hCBData = hMem;
|
||||||
//pMem = GlobalLock(hMem);
|
//pMem = GlobalLock(hMem);
|
||||||
/*
|
/*
|
||||||
switch (uFormat) {
|
switch (uFormat) {
|
||||||
default:
|
default:
|
||||||
DbgPrint("Clipboard unsupported format (%d)\n", uFormat);
|
DbgPrint("Clipboard unsupported format (%d)\n", uFormat);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
case CF_TEXT: // 1
|
case CF_TEXT: // 1
|
||||||
break;
|
break;
|
||||||
case CF_UNICODETEXT: // 13
|
case CF_UNICODETEXT: // 13
|
||||||
break;
|
break;
|
||||||
case CF_BITMAP: // 2
|
case CF_BITMAP: // 2
|
||||||
break;
|
break;
|
||||||
case CF_OEMTEXT: // 7
|
case CF_OEMTEXT: // 7
|
||||||
break;
|
break;
|
||||||
} */
|
} */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//the window provides data in the specified format
|
//the window provides data in the specified format
|
||||||
}
|
}
|
||||||
return hMem;
|
return hMem;
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND STDCALL
|
HWND STDCALL
|
||||||
NtUserSetClipboardViewer(HWND hWndNewViewer)
|
NtUserSetClipboardViewer(HWND hWndNewViewer)
|
||||||
{
|
{
|
||||||
HWND hwndPrev = 0;
|
HWND hwndPrev = 0;
|
||||||
DbgPrint("NtUserSetClipboardViewer is UNIMPLEMENTED (%p): returning %p\n", hWndNewViewer, hwndPrev);
|
DbgPrint("NtUserSetClipboardViewer is UNIMPLEMENTED (%p): returning %p\n", hWndNewViewer, hwndPrev);
|
||||||
return hwndPrev;
|
return hwndPrev;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -14,75 +14,75 @@
|
||||||
|
|
||||||
static HANDLE WindowsApiPort = NULL;
|
static HANDLE WindowsApiPort = NULL;
|
||||||
PEPROCESS CsrProcess = NULL;
|
PEPROCESS CsrProcess = NULL;
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
CsrInit(void)
|
CsrInit(void)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
UNICODE_STRING PortName;
|
UNICODE_STRING PortName;
|
||||||
ULONG ConnectInfoLength;
|
ULONG ConnectInfoLength;
|
||||||
|
|
||||||
RtlInitUnicodeString(&PortName, L"\\Windows\\ApiPort");
|
RtlInitUnicodeString(&PortName, L"\\Windows\\ApiPort");
|
||||||
ConnectInfoLength = 0;
|
ConnectInfoLength = 0;
|
||||||
Status = ZwConnectPort(&WindowsApiPort,
|
Status = ZwConnectPort(&WindowsApiPort,
|
||||||
&PortName,
|
&PortName,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
&ConnectInfoLength);
|
&ConnectInfoLength);
|
||||||
if (! NT_SUCCESS(Status))
|
if (! NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
CsrProcess = PsGetCurrentProcess();
|
CsrProcess = PsGetCurrentProcess();
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
co_CsrNotify(PCSR_API_MESSAGE Request)
|
co_CsrNotify(PCSR_API_MESSAGE Request)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PEPROCESS OldProcess;
|
PEPROCESS OldProcess;
|
||||||
|
|
||||||
if (NULL == CsrProcess)
|
if (NULL == CsrProcess)
|
||||||
{
|
{
|
||||||
return STATUS_INVALID_PORT_HANDLE;
|
return STATUS_INVALID_PORT_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
||||||
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
||||||
|
|
||||||
/* Switch to the process in which the WindowsApiPort handle is valid */
|
/* Switch to the process in which the WindowsApiPort handle is valid */
|
||||||
OldProcess = PsGetCurrentProcess();
|
OldProcess = PsGetCurrentProcess();
|
||||||
if (CsrProcess != OldProcess)
|
if (CsrProcess != OldProcess)
|
||||||
{
|
{
|
||||||
KeAttachProcess(&CsrProcess->Pcb);
|
KeAttachProcess(&CsrProcess->Pcb);
|
||||||
}
|
}
|
||||||
|
|
||||||
UserLeaveCo();
|
|
||||||
|
|
||||||
Status = ZwRequestWaitReplyPort(WindowsApiPort,
|
UserLeaveCo();
|
||||||
&Request->Header,
|
|
||||||
&Request->Header);
|
Status = ZwRequestWaitReplyPort(WindowsApiPort,
|
||||||
|
&Request->Header,
|
||||||
UserEnterCo();
|
&Request->Header);
|
||||||
|
|
||||||
if (CsrProcess != OldProcess)
|
UserEnterCo();
|
||||||
{
|
|
||||||
|
if (CsrProcess != OldProcess)
|
||||||
|
{
|
||||||
KeDetachProcess();
|
KeDetachProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
Status = Request->Status;
|
Status = Request->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -91,30 +91,30 @@ CsrInsertObject(HANDLE ObjectHandle,
|
||||||
ACCESS_MASK DesiredAccess,
|
ACCESS_MASK DesiredAccess,
|
||||||
PHANDLE Handle)
|
PHANDLE Handle)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE CsrProcessHandle;
|
HANDLE CsrProcessHandle;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
CLIENT_ID Cid;
|
CLIENT_ID Cid;
|
||||||
|
|
||||||
/* Put CSR'S CID */
|
/* Put CSR'S CID */
|
||||||
Cid.UniqueProcess = CsrProcess->UniqueProcessId;
|
Cid.UniqueProcess = CsrProcess->UniqueProcessId;
|
||||||
Cid.UniqueThread = 0;
|
Cid.UniqueThread = 0;
|
||||||
|
|
||||||
/* Empty Attributes */
|
/* Empty Attributes */
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* Get a Handle to Csrss */
|
/* Get a Handle to Csrss */
|
||||||
Status = ZwOpenProcess(&CsrProcessHandle,
|
Status = ZwOpenProcess(&CsrProcessHandle,
|
||||||
PROCESS_DUP_HANDLE,
|
PROCESS_DUP_HANDLE,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
&Cid);
|
&Cid);
|
||||||
|
|
||||||
if ((NT_SUCCESS(Status)))
|
if ((NT_SUCCESS(Status)))
|
||||||
{
|
{
|
||||||
/* Duplicate the Handle */
|
/* Duplicate the Handle */
|
||||||
Status = ZwDuplicateObject(NtCurrentProcess(),
|
Status = ZwDuplicateObject(NtCurrentProcess(),
|
||||||
ObjectHandle,
|
ObjectHandle,
|
||||||
|
@ -123,35 +123,35 @@ CsrInsertObject(HANDLE ObjectHandle,
|
||||||
DesiredAccess,
|
DesiredAccess,
|
||||||
TRUE,
|
TRUE,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
/* Close our handle to CSRSS */
|
/* Close our handle to CSRSS */
|
||||||
ZwClose(CsrProcessHandle);
|
ZwClose(CsrProcessHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
CsrCloseHandle(HANDLE Handle)
|
CsrCloseHandle(HANDLE Handle)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PEPROCESS OldProcess;
|
PEPROCESS OldProcess;
|
||||||
|
|
||||||
/* Switch to the process in which the handle is valid */
|
/* Switch to the process in which the handle is valid */
|
||||||
OldProcess = PsGetCurrentProcess();
|
OldProcess = PsGetCurrentProcess();
|
||||||
if (CsrProcess != OldProcess)
|
if (CsrProcess != OldProcess)
|
||||||
{
|
{
|
||||||
KeAttachProcess(&CsrProcess->Pcb);
|
KeAttachProcess(&CsrProcess->Pcb);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ZwClose(Handle);
|
Status = ZwClose(Handle);
|
||||||
|
|
||||||
if (CsrProcess != OldProcess)
|
if (CsrProcess != OldProcess)
|
||||||
{
|
{
|
||||||
KeDetachProcess();
|
KeDetachProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -53,8 +53,8 @@ co_IntSendDeactivateMessages(HWND hWndPrev, HWND hWnd)
|
||||||
{
|
{
|
||||||
co_IntPostOrSendMessage(hWndPrev, WM_NCACTIVATE, FALSE, 0);
|
co_IntPostOrSendMessage(hWndPrev, WM_NCACTIVATE, FALSE, 0);
|
||||||
co_IntPostOrSendMessage(hWndPrev, WM_ACTIVATE,
|
co_IntPostOrSendMessage(hWndPrev, WM_ACTIVATE,
|
||||||
MAKEWPARAM(WA_INACTIVE, UserGetWindowLong(hWndPrev, GWL_STYLE, FALSE) & WS_MINIMIZE),
|
MAKEWPARAM(WA_INACTIVE, UserGetWindowLong(hWndPrev, GWL_STYLE, FALSE) & WS_MINIMIZE),
|
||||||
(LPARAM)hWnd);
|
(LPARAM)hWnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,24 +69,24 @@ co_IntSendActivateMessages(HWND hWndPrev, HWND hWnd, BOOL MouseActivate)
|
||||||
if (co_IntPostOrSendMessage(hWnd, WM_QUERYNEWPALETTE, 0, 0))
|
if (co_IntPostOrSendMessage(hWnd, WM_QUERYNEWPALETTE, 0, 0))
|
||||||
{
|
{
|
||||||
co_IntPostOrSendMessage(HWND_BROADCAST, WM_PALETTEISCHANGING,
|
co_IntPostOrSendMessage(HWND_BROADCAST, WM_PALETTEISCHANGING,
|
||||||
(WPARAM)hWnd, 0);
|
(WPARAM)hWnd, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UserGetWindow(hWnd, GW_HWNDPREV) != NULL)
|
if (UserGetWindow(hWnd, GW_HWNDPREV) != NULL)
|
||||||
co_WinPosSetWindowPos(Window, HWND_TOP, 0, 0, 0, 0,
|
co_WinPosSetWindowPos(Window, HWND_TOP, 0, 0, 0, 0,
|
||||||
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
|
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Owner = IntGetOwner(Window);
|
Owner = IntGetOwner(Window);
|
||||||
if (!Owner)
|
if (!Owner)
|
||||||
{
|
{
|
||||||
Parent = IntGetParent(Window);
|
Parent = IntGetParent(Window);
|
||||||
if (!Parent)
|
if (!Parent)
|
||||||
co_IntShellHookNotify(HSHELL_WINDOWACTIVATED, (LPARAM) hWnd);
|
co_IntShellHookNotify(HSHELL_WINDOWACTIVATED, (LPARAM) hWnd);
|
||||||
else
|
else
|
||||||
IntReleaseWindowObject(Parent);
|
IntReleaseWindowObject(Parent);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IntReleaseWindowObject(Owner);
|
IntReleaseWindowObject(Owner);
|
||||||
}
|
}
|
||||||
|
@ -98,9 +98,9 @@ co_IntSendActivateMessages(HWND hWndPrev, HWND hWnd, BOOL MouseActivate)
|
||||||
co_IntPostOrSendMessage(hWnd, WM_NCACTIVATE, (WPARAM)(hWnd == UserGetForegroundWindow()), 0);
|
co_IntPostOrSendMessage(hWnd, WM_NCACTIVATE, (WPARAM)(hWnd == UserGetForegroundWindow()), 0);
|
||||||
/* FIXME: WA_CLICKACTIVE */
|
/* FIXME: WA_CLICKACTIVE */
|
||||||
co_IntPostOrSendMessage(hWnd, WM_ACTIVATE,
|
co_IntPostOrSendMessage(hWnd, WM_ACTIVATE,
|
||||||
MAKEWPARAM(MouseActivate ? WA_CLICKACTIVE : WA_ACTIVE,
|
MAKEWPARAM(MouseActivate ? WA_CLICKACTIVE : WA_ACTIVE,
|
||||||
UserGetWindowLong(hWnd, GWL_STYLE, FALSE) & WS_MINIMIZE),
|
UserGetWindowLong(hWnd, GWL_STYLE, FALSE) & WS_MINIMIZE),
|
||||||
(LPARAM)hWndPrev);
|
(LPARAM)hWndPrev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,25 +125,25 @@ co_IntSendSetFocusMessages(HWND hWndPrev, HWND hWnd)
|
||||||
HWND FASTCALL
|
HWND FASTCALL
|
||||||
IntFindChildWindowToOwner(PWINDOW_OBJECT Root, PWINDOW_OBJECT Owner)
|
IntFindChildWindowToOwner(PWINDOW_OBJECT Root, PWINDOW_OBJECT Owner)
|
||||||
{
|
{
|
||||||
HWND Ret;
|
HWND Ret;
|
||||||
PWINDOW_OBJECT Child, OwnerWnd;
|
PWINDOW_OBJECT Child, OwnerWnd;
|
||||||
|
|
||||||
for(Child = Root->FirstChild; Child; Child = Child->NextSibling)
|
for(Child = Root->FirstChild; Child; Child = Child->NextSibling)
|
||||||
{
|
{
|
||||||
OwnerWnd = IntGetWindowObject(Child->hOwner);
|
OwnerWnd = IntGetWindowObject(Child->hOwner);
|
||||||
if(!OwnerWnd)
|
if(!OwnerWnd)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(OwnerWnd == Owner)
|
if(OwnerWnd == Owner)
|
||||||
{
|
{
|
||||||
Ret = Child->hSelf;
|
Ret = Child->hSelf;
|
||||||
|
IntReleaseWindowObject(OwnerWnd);
|
||||||
|
return Ret;
|
||||||
|
}
|
||||||
IntReleaseWindowObject(OwnerWnd);
|
IntReleaseWindowObject(OwnerWnd);
|
||||||
return Ret;
|
}
|
||||||
}
|
|
||||||
IntReleaseWindowObject(OwnerWnd);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC BOOL FASTCALL
|
STATIC BOOL FASTCALL
|
||||||
|
@ -218,61 +218,61 @@ BOOL FASTCALL
|
||||||
co_IntSetForegroundWindow(PWINDOW_OBJECT Window)
|
co_IntSetForegroundWindow(PWINDOW_OBJECT Window)
|
||||||
{
|
{
|
||||||
ASSERT_REFS_CO(Window);
|
ASSERT_REFS_CO(Window);
|
||||||
|
|
||||||
return co_IntSetForegroundAndFocusWindow(Window, Window, FALSE);
|
return co_IntSetForegroundAndFocusWindow(Window, Window, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
co_IntMouseActivateWindow(PWINDOW_OBJECT Window)
|
co_IntMouseActivateWindow(PWINDOW_OBJECT Window)
|
||||||
{
|
{
|
||||||
HWND Top;
|
HWND Top;
|
||||||
PWINDOW_OBJECT TopWindow;
|
PWINDOW_OBJECT TopWindow;
|
||||||
|
|
||||||
ASSERT_REFS_CO(Window);
|
ASSERT_REFS_CO(Window);
|
||||||
|
|
||||||
if(Window->Style & WS_DISABLED)
|
if(Window->Style & WS_DISABLED)
|
||||||
{
|
{
|
||||||
BOOL Ret;
|
BOOL Ret;
|
||||||
PWINDOW_OBJECT TopWnd;
|
PWINDOW_OBJECT TopWnd;
|
||||||
PWINDOW_OBJECT DesktopWindow = IntGetWindowObject(IntGetDesktopWindow());
|
PWINDOW_OBJECT DesktopWindow = IntGetWindowObject(IntGetDesktopWindow());
|
||||||
if(DesktopWindow)
|
if(DesktopWindow)
|
||||||
{
|
|
||||||
Top = IntFindChildWindowToOwner(DesktopWindow, Window);
|
|
||||||
if((TopWnd = IntGetWindowObject(Top)))
|
|
||||||
{
|
{
|
||||||
Ret = co_IntMouseActivateWindow(TopWnd);
|
Top = IntFindChildWindowToOwner(DesktopWindow, Window);
|
||||||
IntReleaseWindowObject(TopWnd);
|
if((TopWnd = IntGetWindowObject(Top)))
|
||||||
IntReleaseWindowObject(DesktopWindow);
|
{
|
||||||
return Ret;
|
Ret = co_IntMouseActivateWindow(TopWnd);
|
||||||
|
IntReleaseWindowObject(TopWnd);
|
||||||
|
IntReleaseWindowObject(DesktopWindow);
|
||||||
|
return Ret;
|
||||||
|
}
|
||||||
|
IntReleaseWindowObject(DesktopWindow);
|
||||||
}
|
}
|
||||||
IntReleaseWindowObject(DesktopWindow);
|
return FALSE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Top = UserGetAncestor(Window->hSelf, GA_ROOT);
|
Top = UserGetAncestor(Window->hSelf, GA_ROOT);
|
||||||
if (Top != Window->hSelf)
|
if (Top != Window->hSelf)
|
||||||
{
|
{
|
||||||
TopWindow = IntGetWindowObject(Top);
|
TopWindow = IntGetWindowObject(Top);
|
||||||
if (TopWindow == NULL)
|
if (TopWindow == NULL)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TopWindow = Window;
|
TopWindow = Window;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TMN: Check return valud from this function? */
|
/* TMN: Check return valud from this function? */
|
||||||
co_IntSetForegroundAndFocusWindow(TopWindow, Window, TRUE);
|
co_IntSetForegroundAndFocusWindow(TopWindow, Window, TRUE);
|
||||||
|
|
||||||
if (Top != Window->hSelf)
|
if (Top != Window->hSelf)
|
||||||
{
|
{
|
||||||
IntReleaseWindowObject(TopWindow);
|
IntReleaseWindowObject(TopWindow);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND FASTCALL
|
HWND FASTCALL
|
||||||
|
@ -282,7 +282,8 @@ co_IntSetActiveWindow(PWINDOW_OBJECT Window OPTIONAL)
|
||||||
HWND hWndPrev;
|
HWND hWndPrev;
|
||||||
HWND hWnd = 0;
|
HWND hWnd = 0;
|
||||||
|
|
||||||
if (Window) ASSERT_REFS_CO(Window);
|
if (Window)
|
||||||
|
ASSERT_REFS_CO(Window);
|
||||||
|
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
||||||
ASSERT(ThreadQueue != 0);
|
ASSERT(ThreadQueue != 0);
|
||||||
|
@ -290,7 +291,7 @@ co_IntSetActiveWindow(PWINDOW_OBJECT Window OPTIONAL)
|
||||||
if (Window != 0)
|
if (Window != 0)
|
||||||
{
|
{
|
||||||
if (!(Window->Style & WS_VISIBLE) ||
|
if (!(Window->Style & WS_VISIBLE) ||
|
||||||
(Window->Style & (WS_POPUP | WS_CHILD)) == WS_CHILD)
|
(Window->Style & (WS_POPUP | WS_CHILD)) == WS_CHILD)
|
||||||
{
|
{
|
||||||
return ThreadQueue ? 0 : ThreadQueue->ActiveWindow;
|
return ThreadQueue ? 0 : ThreadQueue->ActiveWindow;
|
||||||
}
|
}
|
||||||
|
@ -310,8 +311,8 @@ co_IntSetActiveWindow(PWINDOW_OBJECT Window OPTIONAL)
|
||||||
co_IntSendDeactivateMessages(hWndPrev, hWnd);
|
co_IntSendDeactivateMessages(hWndPrev, hWnd);
|
||||||
co_IntSendActivateMessages(hWndPrev, hWnd, FALSE);
|
co_IntSendActivateMessages(hWndPrev, hWnd, FALSE);
|
||||||
|
|
||||||
/* FIXME */
|
/* FIXME */
|
||||||
/* return IntIsWindow(hWndPrev) ? hWndPrev : 0;*/
|
/* return IntIsWindow(hWndPrev) ? hWndPrev : 0;*/
|
||||||
return hWndPrev;
|
return hWndPrev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,7 +347,7 @@ HWND FASTCALL
|
||||||
UserGetForegroundWindow(VOID)
|
UserGetForegroundWindow(VOID)
|
||||||
{
|
{
|
||||||
PUSER_MESSAGE_QUEUE ForegroundQueue;
|
PUSER_MESSAGE_QUEUE ForegroundQueue;
|
||||||
|
|
||||||
ForegroundQueue = IntGetFocusMessageQueue();
|
ForegroundQueue = IntGetFocusMessageQueue();
|
||||||
return( ForegroundQueue != NULL ? ForegroundQueue->ActiveWindow : 0);
|
return( ForegroundQueue != NULL ? ForegroundQueue->ActiveWindow : 0);
|
||||||
}
|
}
|
||||||
|
@ -359,12 +360,12 @@ HWND STDCALL
|
||||||
NtUserGetForegroundWindow(VOID)
|
NtUserGetForegroundWindow(VOID)
|
||||||
{
|
{
|
||||||
DECLARE_RETURN(HWND);
|
DECLARE_RETURN(HWND);
|
||||||
|
|
||||||
DPRINT("Enter NtUserGetForegroundWindow\n");
|
DPRINT("Enter NtUserGetForegroundWindow\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
RETURN( UserGetForegroundWindow());
|
RETURN( UserGetForegroundWindow());
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserGetForegroundWindow, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserGetForegroundWindow, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
|
@ -387,12 +388,12 @@ HWND STDCALL
|
||||||
NtUserGetActiveWindow(VOID)
|
NtUserGetActiveWindow(VOID)
|
||||||
{
|
{
|
||||||
DECLARE_RETURN(HWND);
|
DECLARE_RETURN(HWND);
|
||||||
|
|
||||||
DPRINT("Enter NtUserGetActiveWindow\n");
|
DPRINT("Enter NtUserGetActiveWindow\n");
|
||||||
UserEnterShared();
|
UserEnterShared();
|
||||||
|
|
||||||
RETURN( UserGetActiveWindow());
|
RETURN( UserGetActiveWindow());
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserGetActiveWindow, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserGetActiveWindow, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
|
@ -438,7 +439,7 @@ NtUserSetActiveWindow(HWND hWnd)
|
||||||
{
|
{
|
||||||
RETURN( co_IntSetActiveWindow(0));
|
RETURN( co_IntSetActiveWindow(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserSetActiveWindow, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserSetActiveWindow, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
|
@ -455,11 +456,11 @@ NtUserGetCapture(VOID)
|
||||||
|
|
||||||
DPRINT("Enter NtUserGetCapture\n");
|
DPRINT("Enter NtUserGetCapture\n");
|
||||||
UserEnterShared();
|
UserEnterShared();
|
||||||
|
|
||||||
PUSER_MESSAGE_QUEUE ThreadQueue;
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
||||||
RETURN( ThreadQueue ? ThreadQueue->CaptureWindow : 0);
|
RETURN( ThreadQueue ? ThreadQueue->CaptureWindow : 0);
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserGetCapture, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserGetCapture, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
|
@ -481,7 +482,7 @@ NtUserSetCapture(HWND hWnd)
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
|
||||||
|
|
||||||
if((Window = UserGetWindowObject(hWnd)))
|
if((Window = UserGetWindowObject(hWnd)))
|
||||||
{
|
{
|
||||||
if(Window->MessageQueue != ThreadQueue)
|
if(Window->MessageQueue != ThreadQueue)
|
||||||
|
@ -489,21 +490,21 @@ NtUserSetCapture(HWND hWnd)
|
||||||
RETURN(NULL);
|
RETURN(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hWndPrev = MsqSetStateWindow(ThreadQueue, MSQ_STATE_CAPTURE, hWnd);
|
hWndPrev = MsqSetStateWindow(ThreadQueue, MSQ_STATE_CAPTURE, hWnd);
|
||||||
|
|
||||||
/* also remove other windows if not capturing anymore */
|
/* also remove other windows if not capturing anymore */
|
||||||
if(hWnd == NULL)
|
if(hWnd == NULL)
|
||||||
{
|
{
|
||||||
MsqSetStateWindow(ThreadQueue, MSQ_STATE_MENUOWNER, NULL);
|
MsqSetStateWindow(ThreadQueue, MSQ_STATE_MENUOWNER, NULL);
|
||||||
MsqSetStateWindow(ThreadQueue, MSQ_STATE_MOVESIZE, NULL);
|
MsqSetStateWindow(ThreadQueue, MSQ_STATE_MOVESIZE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
co_IntPostOrSendMessage(hWndPrev, WM_CAPTURECHANGED, 0, (LPARAM)hWnd);
|
co_IntPostOrSendMessage(hWndPrev, WM_CAPTURECHANGED, 0, (LPARAM)hWnd);
|
||||||
ThreadQueue->CaptureWindow = hWnd;
|
ThreadQueue->CaptureWindow = hWnd;
|
||||||
|
|
||||||
RETURN( hWndPrev);
|
RETURN( hWndPrev);
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserSetCapture, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserSetCapture, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
|
@ -570,7 +571,7 @@ NtUserSetFocus(HWND hWnd)
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
RETURN(UserSetFocus(hWnd));
|
RETURN(UserSetFocus(hWnd));
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserSetFocus, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserSetFocus, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
|
|
|
@ -48,9 +48,9 @@ static FAST_MUTEX GuiSwitchLock;
|
||||||
static BOOL FASTCALL
|
static BOOL FASTCALL
|
||||||
co_AddGuiApp(PW32PROCESS W32Data)
|
co_AddGuiApp(PW32PROCESS W32Data)
|
||||||
{
|
{
|
||||||
W32Data->Flags |= W32PF_CREATEDWINORDC;
|
W32Data->Flags |= W32PF_CREATEDWINORDC;
|
||||||
if (InterlockedIncrement(&NrGuiAppsRunning) == 1)
|
if (InterlockedIncrement(&NrGuiAppsRunning) == 1)
|
||||||
{
|
{
|
||||||
BOOL Initialized;
|
BOOL Initialized;
|
||||||
|
|
||||||
ExAcquireFastMutex(&GuiSwitchLock);
|
ExAcquireFastMutex(&GuiSwitchLock);
|
||||||
|
@ -58,89 +58,89 @@ co_AddGuiApp(PW32PROCESS W32Data)
|
||||||
ExReleaseFastMutex(&GuiSwitchLock);
|
ExReleaseFastMutex(&GuiSwitchLock);
|
||||||
|
|
||||||
if (!Initialized)
|
if (!Initialized)
|
||||||
{
|
{
|
||||||
W32Data->Flags &= ~W32PF_CREATEDWINORDC;
|
W32Data->Flags &= ~W32PF_CREATEDWINORDC;
|
||||||
InterlockedDecrement(&NrGuiAppsRunning);
|
InterlockedDecrement(&NrGuiAppsRunning);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FASTCALL
|
static void FASTCALL
|
||||||
RemoveGuiApp(PW32PROCESS W32Data)
|
RemoveGuiApp(PW32PROCESS W32Data)
|
||||||
{
|
{
|
||||||
W32Data->Flags &= ~W32PF_CREATEDWINORDC;
|
W32Data->Flags &= ~W32PF_CREATEDWINORDC;
|
||||||
if (InterlockedDecrement(&NrGuiAppsRunning) == 0)
|
if (InterlockedDecrement(&NrGuiAppsRunning) == 0)
|
||||||
{
|
{
|
||||||
ExAcquireFastMutex(&GuiSwitchLock);
|
ExAcquireFastMutex(&GuiSwitchLock);
|
||||||
IntEndDesktopGraphics();
|
IntEndDesktopGraphics();
|
||||||
ExReleaseFastMutex(&GuiSwitchLock);
|
ExReleaseFastMutex(&GuiSwitchLock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
co_IntGraphicsCheck(BOOL Create)
|
co_IntGraphicsCheck(BOOL Create)
|
||||||
{
|
{
|
||||||
PW32PROCESS W32Data;
|
PW32PROCESS W32Data;
|
||||||
|
|
||||||
W32Data = PsGetWin32Process();
|
W32Data = PsGetWin32Process();
|
||||||
if (Create)
|
if (Create)
|
||||||
{
|
{
|
||||||
if (! (W32Data->Flags & W32PF_CREATEDWINORDC) && ! (W32Data->Flags & W32PF_MANUALGUICHECK))
|
if (! (W32Data->Flags & W32PF_CREATEDWINORDC) && ! (W32Data->Flags & W32PF_MANUALGUICHECK))
|
||||||
{
|
{
|
||||||
return co_AddGuiApp(W32Data);
|
return co_AddGuiApp(W32Data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((W32Data->Flags & W32PF_CREATEDWINORDC) && ! (W32Data->Flags & W32PF_MANUALGUICHECK))
|
if ((W32Data->Flags & W32PF_CREATEDWINORDC) && ! (W32Data->Flags & W32PF_MANUALGUICHECK))
|
||||||
{
|
{
|
||||||
RemoveGuiApp(W32Data);
|
RemoveGuiApp(W32Data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
NtUserManualGuiCheck(LONG Check)
|
NtUserManualGuiCheck(LONG Check)
|
||||||
{
|
{
|
||||||
PW32PROCESS W32Data;
|
PW32PROCESS W32Data;
|
||||||
|
|
||||||
DPRINT("Enter NtUserManualGuiCheck\n");
|
|
||||||
UserEnterExclusive();
|
|
||||||
|
|
||||||
W32Data = PsGetWin32Process();
|
DPRINT("Enter NtUserManualGuiCheck\n");
|
||||||
if (0 == Check)
|
UserEnterExclusive();
|
||||||
{
|
|
||||||
|
W32Data = PsGetWin32Process();
|
||||||
|
if (0 == Check)
|
||||||
|
{
|
||||||
W32Data->Flags |= W32PF_MANUALGUICHECK;
|
W32Data->Flags |= W32PF_MANUALGUICHECK;
|
||||||
}
|
}
|
||||||
else if (0 < Check)
|
else if (0 < Check)
|
||||||
{
|
{
|
||||||
if (! (W32Data->Flags & W32PF_CREATEDWINORDC))
|
if (! (W32Data->Flags & W32PF_CREATEDWINORDC))
|
||||||
{
|
{
|
||||||
co_AddGuiApp(W32Data);
|
co_AddGuiApp(W32Data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (W32Data->Flags & W32PF_CREATEDWINORDC)
|
if (W32Data->Flags & W32PF_CREATEDWINORDC)
|
||||||
{
|
{
|
||||||
RemoveGuiApp(W32Data);
|
RemoveGuiApp(W32Data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DPRINT("Leave NtUserManualGuiCheck\n");
|
||||||
|
UserLeave();
|
||||||
|
|
||||||
DPRINT("Leave NtUserManualGuiCheck\n");
|
|
||||||
UserLeave();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
InitGuiCheckImpl (VOID)
|
InitGuiCheckImpl (VOID)
|
||||||
{
|
{
|
||||||
ExInitializeFastMutex(&GuiSwitchLock);
|
ExInitializeFastMutex(&GuiSwitchLock);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -41,10 +41,10 @@
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
InitHotKeys(PWINSTATION_OBJECT WinStaObject)
|
InitHotKeys(PWINSTATION_OBJECT WinStaObject)
|
||||||
{
|
{
|
||||||
InitializeListHead(&WinStaObject->HotKeyListHead);
|
InitializeListHead(&WinStaObject->HotKeyListHead);
|
||||||
ExInitializeFastMutex(&WinStaObject->HotKeyListLock);
|
ExInitializeFastMutex(&WinStaObject->HotKeyListLock);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,289 +52,289 @@ NTSTATUS FASTCALL
|
||||||
CleanupHotKeys(PWINSTATION_OBJECT WinStaObject)
|
CleanupHotKeys(PWINSTATION_OBJECT WinStaObject)
|
||||||
{
|
{
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
GetHotKey (PWINSTATION_OBJECT WinStaObject,
|
GetHotKey (PWINSTATION_OBJECT WinStaObject,
|
||||||
UINT fsModifiers,
|
UINT fsModifiers,
|
||||||
UINT vk,
|
UINT vk,
|
||||||
struct _ETHREAD **Thread,
|
struct _ETHREAD **Thread,
|
||||||
HWND *hWnd,
|
HWND *hWnd,
|
||||||
int *id)
|
int *id)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY Entry;
|
PLIST_ENTRY Entry;
|
||||||
PHOT_KEY_ITEM HotKeyItem;
|
PHOT_KEY_ITEM HotKeyItem;
|
||||||
|
|
||||||
if(!WinStaObject)
|
if(!WinStaObject)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntLockHotKeys(WinStaObject);
|
IntLockHotKeys(WinStaObject);
|
||||||
|
|
||||||
Entry = WinStaObject->HotKeyListHead.Flink;
|
Entry = WinStaObject->HotKeyListHead.Flink;
|
||||||
while (Entry != &WinStaObject->HotKeyListHead)
|
while (Entry != &WinStaObject->HotKeyListHead)
|
||||||
{
|
{
|
||||||
HotKeyItem = (PHOT_KEY_ITEM) CONTAINING_RECORD(Entry,
|
HotKeyItem = (PHOT_KEY_ITEM) CONTAINING_RECORD(Entry,
|
||||||
HOT_KEY_ITEM,
|
HOT_KEY_ITEM,
|
||||||
ListEntry);
|
ListEntry);
|
||||||
if (HotKeyItem->fsModifiers == fsModifiers &&
|
if (HotKeyItem->fsModifiers == fsModifiers &&
|
||||||
HotKeyItem->vk == vk)
|
HotKeyItem->vk == vk)
|
||||||
{
|
{
|
||||||
if (Thread != NULL)
|
if (Thread != NULL)
|
||||||
*Thread = HotKeyItem->Thread;
|
*Thread = HotKeyItem->Thread;
|
||||||
|
|
||||||
if (hWnd != NULL)
|
if (hWnd != NULL)
|
||||||
*hWnd = HotKeyItem->hWnd;
|
*hWnd = HotKeyItem->hWnd;
|
||||||
|
|
||||||
if (id != NULL)
|
if (id != NULL)
|
||||||
*id = HotKeyItem->id;
|
*id = HotKeyItem->id;
|
||||||
|
|
||||||
IntUnLockHotKeys(WinStaObject);
|
IntUnLockHotKeys(WinStaObject);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entry = Entry->Flink;
|
Entry = Entry->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntUnLockHotKeys(WinStaObject);
|
IntUnLockHotKeys(WinStaObject);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
UnregisterWindowHotKeys(PWINDOW_OBJECT Window)
|
UnregisterWindowHotKeys(PWINDOW_OBJECT Window)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY Entry;
|
PLIST_ENTRY Entry;
|
||||||
PHOT_KEY_ITEM HotKeyItem;
|
PHOT_KEY_ITEM HotKeyItem;
|
||||||
PWINSTATION_OBJECT WinStaObject = NULL;
|
PWINSTATION_OBJECT WinStaObject = NULL;
|
||||||
|
|
||||||
if(Window->OwnerThread && Window->OwnerThread->ThreadsProcess)
|
if(Window->OwnerThread && Window->OwnerThread->ThreadsProcess)
|
||||||
WinStaObject = Window->OwnerThread->Tcb.Win32Thread->Desktop->WindowStation;
|
WinStaObject = Window->OwnerThread->Tcb.Win32Thread->Desktop->WindowStation;
|
||||||
|
|
||||||
if(!WinStaObject)
|
if(!WinStaObject)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IntLockHotKeys(WinStaObject);
|
IntLockHotKeys(WinStaObject);
|
||||||
|
|
||||||
Entry = WinStaObject->HotKeyListHead.Flink;
|
Entry = WinStaObject->HotKeyListHead.Flink;
|
||||||
while (Entry != &WinStaObject->HotKeyListHead)
|
while (Entry != &WinStaObject->HotKeyListHead)
|
||||||
{
|
{
|
||||||
HotKeyItem = (PHOT_KEY_ITEM) CONTAINING_RECORD (Entry,
|
HotKeyItem = (PHOT_KEY_ITEM) CONTAINING_RECORD (Entry,
|
||||||
HOT_KEY_ITEM,
|
HOT_KEY_ITEM,
|
||||||
ListEntry);
|
ListEntry);
|
||||||
Entry = Entry->Flink;
|
Entry = Entry->Flink;
|
||||||
if (HotKeyItem->hWnd == Window->hSelf)
|
if (HotKeyItem->hWnd == Window->hSelf)
|
||||||
{
|
{
|
||||||
RemoveEntryList (&HotKeyItem->ListEntry);
|
RemoveEntryList (&HotKeyItem->ListEntry);
|
||||||
ExFreePool (HotKeyItem);
|
ExFreePool (HotKeyItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IntUnLockHotKeys(WinStaObject);
|
IntUnLockHotKeys(WinStaObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
UnregisterThreadHotKeys(struct _ETHREAD *Thread)
|
UnregisterThreadHotKeys(struct _ETHREAD *Thread)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY Entry;
|
PLIST_ENTRY Entry;
|
||||||
PHOT_KEY_ITEM HotKeyItem;
|
PHOT_KEY_ITEM HotKeyItem;
|
||||||
PWINSTATION_OBJECT WinStaObject = NULL;
|
PWINSTATION_OBJECT WinStaObject = NULL;
|
||||||
|
|
||||||
if(Thread->Tcb.Win32Thread && Thread->Tcb.Win32Thread->Desktop)
|
if(Thread->Tcb.Win32Thread && Thread->Tcb.Win32Thread->Desktop)
|
||||||
WinStaObject = Thread->Tcb.Win32Thread->Desktop->WindowStation;
|
WinStaObject = Thread->Tcb.Win32Thread->Desktop->WindowStation;
|
||||||
|
|
||||||
if(!WinStaObject)
|
if(!WinStaObject)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IntLockHotKeys(WinStaObject);
|
IntLockHotKeys(WinStaObject);
|
||||||
|
|
||||||
Entry = WinStaObject->HotKeyListHead.Flink;
|
Entry = WinStaObject->HotKeyListHead.Flink;
|
||||||
while (Entry != &WinStaObject->HotKeyListHead)
|
while (Entry != &WinStaObject->HotKeyListHead)
|
||||||
{
|
{
|
||||||
HotKeyItem = (PHOT_KEY_ITEM) CONTAINING_RECORD (Entry,
|
HotKeyItem = (PHOT_KEY_ITEM) CONTAINING_RECORD (Entry,
|
||||||
HOT_KEY_ITEM,
|
HOT_KEY_ITEM,
|
||||||
ListEntry);
|
ListEntry);
|
||||||
Entry = Entry->Flink;
|
Entry = Entry->Flink;
|
||||||
if (HotKeyItem->Thread == Thread)
|
if (HotKeyItem->Thread == Thread)
|
||||||
{
|
{
|
||||||
RemoveEntryList (&HotKeyItem->ListEntry);
|
RemoveEntryList (&HotKeyItem->ListEntry);
|
||||||
ExFreePool (HotKeyItem);
|
ExFreePool (HotKeyItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IntUnLockHotKeys(WinStaObject);
|
IntUnLockHotKeys(WinStaObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
IsHotKey (PWINSTATION_OBJECT WinStaObject,
|
IsHotKey (PWINSTATION_OBJECT WinStaObject,
|
||||||
UINT fsModifiers,
|
UINT fsModifiers,
|
||||||
UINT vk)
|
UINT vk)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY Entry;
|
PLIST_ENTRY Entry;
|
||||||
PHOT_KEY_ITEM HotKeyItem;
|
PHOT_KEY_ITEM HotKeyItem;
|
||||||
|
|
||||||
Entry = WinStaObject->HotKeyListHead.Flink;
|
Entry = WinStaObject->HotKeyListHead.Flink;
|
||||||
while (Entry != &WinStaObject->HotKeyListHead)
|
while (Entry != &WinStaObject->HotKeyListHead)
|
||||||
{
|
{
|
||||||
HotKeyItem = (PHOT_KEY_ITEM) CONTAINING_RECORD (Entry,
|
HotKeyItem = (PHOT_KEY_ITEM) CONTAINING_RECORD (Entry,
|
||||||
HOT_KEY_ITEM,
|
HOT_KEY_ITEM,
|
||||||
ListEntry);
|
ListEntry);
|
||||||
if (HotKeyItem->fsModifiers == fsModifiers &&
|
if (HotKeyItem->fsModifiers == fsModifiers &&
|
||||||
HotKeyItem->vk == vk)
|
HotKeyItem->vk == vk)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entry = Entry->Flink;
|
Entry = Entry->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtUserRegisterHotKey(HWND hWnd,
|
NtUserRegisterHotKey(HWND hWnd,
|
||||||
int id,
|
int id,
|
||||||
UINT fsModifiers,
|
UINT fsModifiers,
|
||||||
UINT vk)
|
UINT vk)
|
||||||
{
|
{
|
||||||
PHOT_KEY_ITEM HotKeyItem;
|
PHOT_KEY_ITEM HotKeyItem;
|
||||||
PWINDOW_OBJECT Window;
|
PWINDOW_OBJECT Window;
|
||||||
PWINSTATION_OBJECT WinStaObject = NULL;
|
PWINSTATION_OBJECT WinStaObject = NULL;
|
||||||
PETHREAD HotKeyThread;
|
PETHREAD HotKeyThread;
|
||||||
DECLARE_RETURN(BOOL);
|
DECLARE_RETURN(BOOL);
|
||||||
|
|
||||||
DPRINT("Enter NtUserRegisterHotKey\n");
|
DPRINT("Enter NtUserRegisterHotKey\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
if (hWnd == NULL)
|
if (hWnd == NULL)
|
||||||
{
|
{
|
||||||
HotKeyThread = PsGetCurrentThread();
|
HotKeyThread = PsGetCurrentThread();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Window = IntGetWindowObject(hWnd);
|
Window = IntGetWindowObject(hWnd);
|
||||||
if(!Window)
|
if(!Window)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
||||||
|
RETURN( FALSE);
|
||||||
|
}
|
||||||
|
HotKeyThread = Window->OwnerThread;
|
||||||
|
IntReleaseWindowObject(Window);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(HotKeyThread->ThreadsProcess && HotKeyThread->ThreadsProcess->Win32Process)
|
||||||
|
WinStaObject = HotKeyThread->Tcb.Win32Thread->Desktop->WindowStation;
|
||||||
|
|
||||||
|
if(!WinStaObject)
|
||||||
|
{
|
||||||
RETURN( FALSE);
|
RETURN( FALSE);
|
||||||
}
|
}
|
||||||
HotKeyThread = Window->OwnerThread;
|
|
||||||
IntReleaseWindowObject(Window);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
IntLockHotKeys(WinStaObject);
|
||||||
|
|
||||||
if(HotKeyThread->ThreadsProcess && HotKeyThread->ThreadsProcess->Win32Process)
|
/* Check for existing hotkey */
|
||||||
WinStaObject = HotKeyThread->Tcb.Win32Thread->Desktop->WindowStation;
|
if (IsHotKey (WinStaObject, fsModifiers, vk))
|
||||||
|
{
|
||||||
if(!WinStaObject)
|
|
||||||
{
|
|
||||||
RETURN( FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
IntLockHotKeys(WinStaObject);
|
|
||||||
|
|
||||||
/* Check for existing hotkey */
|
|
||||||
if (IsHotKey (WinStaObject, fsModifiers, vk))
|
|
||||||
{
|
|
||||||
IntUnLockHotKeys(WinStaObject);
|
|
||||||
RETURN( FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
HotKeyItem = ExAllocatePoolWithTag (PagedPool, sizeof(HOT_KEY_ITEM), TAG_HOTKEY);
|
|
||||||
if (HotKeyItem == NULL)
|
|
||||||
{
|
|
||||||
IntUnLockHotKeys(WinStaObject);
|
IntUnLockHotKeys(WinStaObject);
|
||||||
RETURN( FALSE);
|
RETURN( FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
HotKeyItem->Thread = HotKeyThread;
|
HotKeyItem = ExAllocatePoolWithTag (PagedPool, sizeof(HOT_KEY_ITEM), TAG_HOTKEY);
|
||||||
HotKeyItem->hWnd = hWnd;
|
if (HotKeyItem == NULL)
|
||||||
HotKeyItem->id = id;
|
{
|
||||||
HotKeyItem->fsModifiers = fsModifiers;
|
IntUnLockHotKeys(WinStaObject);
|
||||||
HotKeyItem->vk = vk;
|
RETURN( FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
InsertHeadList (&WinStaObject->HotKeyListHead,
|
HotKeyItem->Thread = HotKeyThread;
|
||||||
&HotKeyItem->ListEntry);
|
HotKeyItem->hWnd = hWnd;
|
||||||
|
HotKeyItem->id = id;
|
||||||
|
HotKeyItem->fsModifiers = fsModifiers;
|
||||||
|
HotKeyItem->vk = vk;
|
||||||
|
|
||||||
IntUnLockHotKeys(WinStaObject);
|
InsertHeadList (&WinStaObject->HotKeyListHead,
|
||||||
|
&HotKeyItem->ListEntry);
|
||||||
|
|
||||||
|
IntUnLockHotKeys(WinStaObject);
|
||||||
|
|
||||||
|
RETURN( TRUE);
|
||||||
|
|
||||||
RETURN( TRUE);
|
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserRegisterHotKey, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserRegisterHotKey, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtUserUnregisterHotKey(HWND hWnd,
|
NtUserUnregisterHotKey(HWND hWnd,
|
||||||
int id)
|
int id)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY Entry;
|
PLIST_ENTRY Entry;
|
||||||
PHOT_KEY_ITEM HotKeyItem;
|
PHOT_KEY_ITEM HotKeyItem;
|
||||||
PWINDOW_OBJECT Window;
|
PWINDOW_OBJECT Window;
|
||||||
PWINSTATION_OBJECT WinStaObject = NULL;
|
PWINSTATION_OBJECT WinStaObject = NULL;
|
||||||
DECLARE_RETURN(BOOL);
|
DECLARE_RETURN(BOOL);
|
||||||
|
|
||||||
DPRINT("Enter NtUserUnregisterHotKey\n");
|
DPRINT("Enter NtUserUnregisterHotKey\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
Window = IntGetWindowObject(hWnd);
|
Window = IntGetWindowObject(hWnd);
|
||||||
if(!Window)
|
if(!Window)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
||||||
RETURN( FALSE);
|
RETURN( FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Window->OwnerThread->ThreadsProcess && Window->OwnerThread->ThreadsProcess->Win32Process)
|
if(Window->OwnerThread->ThreadsProcess && Window->OwnerThread->ThreadsProcess->Win32Process)
|
||||||
WinStaObject = Window->OwnerThread->Tcb.Win32Thread->Desktop->WindowStation;
|
WinStaObject = Window->OwnerThread->Tcb.Win32Thread->Desktop->WindowStation;
|
||||||
|
|
||||||
if(!WinStaObject)
|
if(!WinStaObject)
|
||||||
{
|
{
|
||||||
IntReleaseWindowObject(Window);
|
IntReleaseWindowObject(Window);
|
||||||
RETURN( FALSE);
|
RETURN( FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
IntLockHotKeys(WinStaObject);
|
IntLockHotKeys(WinStaObject);
|
||||||
|
|
||||||
Entry = WinStaObject->HotKeyListHead.Flink;
|
Entry = WinStaObject->HotKeyListHead.Flink;
|
||||||
while (Entry != &WinStaObject->HotKeyListHead)
|
while (Entry != &WinStaObject->HotKeyListHead)
|
||||||
{
|
{
|
||||||
HotKeyItem = (PHOT_KEY_ITEM) CONTAINING_RECORD (Entry,
|
HotKeyItem = (PHOT_KEY_ITEM) CONTAINING_RECORD (Entry,
|
||||||
HOT_KEY_ITEM,
|
HOT_KEY_ITEM,
|
||||||
ListEntry);
|
ListEntry);
|
||||||
if (HotKeyItem->hWnd == hWnd &&
|
if (HotKeyItem->hWnd == hWnd &&
|
||||||
HotKeyItem->id == id)
|
HotKeyItem->id == id)
|
||||||
{
|
{
|
||||||
RemoveEntryList (&HotKeyItem->ListEntry);
|
RemoveEntryList (&HotKeyItem->ListEntry);
|
||||||
ExFreePool (HotKeyItem);
|
ExFreePool (HotKeyItem);
|
||||||
IntUnLockHotKeys(WinStaObject);
|
IntUnLockHotKeys(WinStaObject);
|
||||||
|
|
||||||
IntReleaseWindowObject(Window);
|
IntReleaseWindowObject(Window);
|
||||||
RETURN( TRUE);
|
RETURN( TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Entry = Entry->Flink;
|
Entry = Entry->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntUnLockHotKeys(WinStaObject);
|
IntUnLockHotKeys(WinStaObject);
|
||||||
|
|
||||||
|
IntReleaseWindowObject(Window);
|
||||||
|
RETURN( FALSE);
|
||||||
|
|
||||||
IntReleaseWindowObject(Window);
|
|
||||||
RETURN( FALSE);
|
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserUnregisterHotKey, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserUnregisterHotKey, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -40,182 +40,182 @@
|
||||||
ULONG FASTCALL
|
ULONG FASTCALL
|
||||||
UserGetSystemMetrics(ULONG Index)
|
UserGetSystemMetrics(ULONG Index)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
ULONG Width, Height, Result;
|
ULONG Width, Height, Result;
|
||||||
|
|
||||||
Result = 0;
|
Result = 0;
|
||||||
switch (Index)
|
switch (Index)
|
||||||
{
|
{
|
||||||
case SM_ARRANGE:
|
case SM_ARRANGE:
|
||||||
return(8);
|
return(8);
|
||||||
case SM_CLEANBOOT:
|
case SM_CLEANBOOT:
|
||||||
return(0);
|
return(0);
|
||||||
case SM_CMOUSEBUTTONS:
|
case SM_CMOUSEBUTTONS:
|
||||||
return(2);
|
return(2);
|
||||||
case SM_CXBORDER:
|
case SM_CXBORDER:
|
||||||
case SM_CYBORDER:
|
case SM_CYBORDER:
|
||||||
return(1);
|
return(1);
|
||||||
case SM_CXCURSOR:
|
case SM_CXCURSOR:
|
||||||
case SM_CYCURSOR:
|
case SM_CYCURSOR:
|
||||||
return(32);
|
return(32);
|
||||||
case SM_CXDLGFRAME:
|
case SM_CXDLGFRAME:
|
||||||
case SM_CYDLGFRAME:
|
case SM_CYDLGFRAME:
|
||||||
return(3);
|
return(3);
|
||||||
case SM_CXDOUBLECLK:
|
case SM_CXDOUBLECLK:
|
||||||
case SM_CYDOUBLECLK:
|
case SM_CYDOUBLECLK:
|
||||||
case SM_SWAPBUTTON:
|
case SM_SWAPBUTTON:
|
||||||
{
|
{
|
||||||
PSYSTEM_CURSORINFO CurInfo;
|
PSYSTEM_CURSORINFO CurInfo;
|
||||||
Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
|
Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&WinStaObject);
|
&WinStaObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
return 0xFFFFFFFF;
|
return 0xFFFFFFFF;
|
||||||
|
|
||||||
CurInfo = IntGetSysCursorInfo(WinStaObject);
|
CurInfo = IntGetSysCursorInfo(WinStaObject);
|
||||||
switch(Index)
|
switch(Index)
|
||||||
{
|
{
|
||||||
case SM_CXDOUBLECLK:
|
case SM_CXDOUBLECLK:
|
||||||
Result = CurInfo->DblClickWidth;
|
Result = CurInfo->DblClickWidth;
|
||||||
break;
|
break;
|
||||||
case SM_CYDOUBLECLK:
|
case SM_CYDOUBLECLK:
|
||||||
Result = CurInfo->DblClickWidth;
|
Result = CurInfo->DblClickWidth;
|
||||||
break;
|
break;
|
||||||
case SM_SWAPBUTTON:
|
case SM_SWAPBUTTON:
|
||||||
Result = (UINT)CurInfo->SwapButtons;
|
Result = (UINT)CurInfo->SwapButtons;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObDereferenceObject(WinStaObject);
|
ObDereferenceObject(WinStaObject);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SM_CXDRAG:
|
case SM_CXDRAG:
|
||||||
case SM_CYDRAG:
|
case SM_CYDRAG:
|
||||||
return(2);
|
return(2);
|
||||||
case SM_CXEDGE:
|
case SM_CXEDGE:
|
||||||
case SM_CYEDGE:
|
case SM_CYEDGE:
|
||||||
return(2);
|
return(2);
|
||||||
case SM_CXFRAME:
|
case SM_CXFRAME:
|
||||||
case SM_CYFRAME:
|
case SM_CYFRAME:
|
||||||
return(4);
|
return(4);
|
||||||
case SM_CXFULLSCREEN:
|
case SM_CXFULLSCREEN:
|
||||||
/* FIXME: shouldn't we take borders etc into account??? */
|
/* FIXME: shouldn't we take borders etc into account??? */
|
||||||
return UserGetSystemMetrics(SM_CXSCREEN);
|
return UserGetSystemMetrics(SM_CXSCREEN);
|
||||||
case SM_CYFULLSCREEN:
|
case SM_CYFULLSCREEN:
|
||||||
return UserGetSystemMetrics(SM_CYSCREEN);
|
return UserGetSystemMetrics(SM_CYSCREEN);
|
||||||
case SM_CXHSCROLL:
|
case SM_CXHSCROLL:
|
||||||
case SM_CYHSCROLL:
|
case SM_CYHSCROLL:
|
||||||
return(16);
|
return(16);
|
||||||
case SM_CYVTHUMB:
|
case SM_CYVTHUMB:
|
||||||
case SM_CXHTHUMB:
|
case SM_CXHTHUMB:
|
||||||
return(16);
|
return(16);
|
||||||
case SM_CXICON:
|
case SM_CXICON:
|
||||||
case SM_CYICON:
|
case SM_CYICON:
|
||||||
return(32);
|
return(32);
|
||||||
case SM_CXICONSPACING:
|
case SM_CXICONSPACING:
|
||||||
case SM_CYICONSPACING:
|
case SM_CYICONSPACING:
|
||||||
return(64);
|
return(64);
|
||||||
case SM_CXMAXIMIZED:
|
case SM_CXMAXIMIZED:
|
||||||
return(UserGetSystemMetrics(SM_CXSCREEN) + 8); /* This seems to be 8
|
return(UserGetSystemMetrics(SM_CXSCREEN) + 8); /* This seems to be 8
|
||||||
pixels greater than
|
pixels greater than
|
||||||
the screen width */
|
the screen width */
|
||||||
case SM_CYMAXIMIZED:
|
case SM_CYMAXIMIZED:
|
||||||
return(UserGetSystemMetrics(SM_CYSCREEN) - 20); /* This seems to be 20
|
return(UserGetSystemMetrics(SM_CYSCREEN) - 20); /* This seems to be 20
|
||||||
pixels less than
|
pixels less than
|
||||||
the screen height,
|
the screen height,
|
||||||
taskbar maybe? */
|
taskbar maybe? */
|
||||||
case SM_CXMAXTRACK:
|
case SM_CXMAXTRACK:
|
||||||
return(UserGetSystemMetrics(SM_CYSCREEN) + 12);
|
return(UserGetSystemMetrics(SM_CYSCREEN) + 12);
|
||||||
case SM_CYMAXTRACK:
|
case SM_CYMAXTRACK:
|
||||||
return(UserGetSystemMetrics(SM_CYSCREEN) + 12);
|
return(UserGetSystemMetrics(SM_CYSCREEN) + 12);
|
||||||
case SM_CXMENUCHECK:
|
case SM_CXMENUCHECK:
|
||||||
case SM_CYMENUCHECK:
|
case SM_CYMENUCHECK:
|
||||||
return(13);
|
return(13);
|
||||||
case SM_CXMENUSIZE:
|
case SM_CXMENUSIZE:
|
||||||
case SM_CYMENUSIZE:
|
case SM_CYMENUSIZE:
|
||||||
return(18);
|
return(18);
|
||||||
case SM_CXMIN:
|
case SM_CXMIN:
|
||||||
return(112);
|
return(112);
|
||||||
case SM_CYMIN:
|
case SM_CYMIN:
|
||||||
return(27);
|
return(27);
|
||||||
case SM_CXMINIMIZED:
|
case SM_CXMINIMIZED:
|
||||||
return(160);
|
return(160);
|
||||||
case SM_CYMINIMIZED:
|
case SM_CYMINIMIZED:
|
||||||
return(24);
|
return(24);
|
||||||
case SM_CXMINSPACING:
|
case SM_CXMINSPACING:
|
||||||
return(160);
|
return(160);
|
||||||
case SM_CYMINSPACING:
|
case SM_CYMINSPACING:
|
||||||
return(24);
|
return(24);
|
||||||
case SM_CXMINTRACK:
|
case SM_CXMINTRACK:
|
||||||
return(112);
|
return(112);
|
||||||
case SM_CYMINTRACK:
|
case SM_CYMINTRACK:
|
||||||
return(27);
|
return(27);
|
||||||
case SM_CXSCREEN:
|
case SM_CXSCREEN:
|
||||||
case SM_CYSCREEN:
|
case SM_CYSCREEN:
|
||||||
{
|
{
|
||||||
HDC ScreenDCHandle;
|
HDC ScreenDCHandle;
|
||||||
PDC ScreenDC;
|
PDC ScreenDC;
|
||||||
|
|
||||||
Width = 640;
|
Width = 640;
|
||||||
Height = 480;
|
Height = 480;
|
||||||
ScreenDCHandle = IntGdiCreateDC(NULL, NULL, NULL, NULL, TRUE);
|
ScreenDCHandle = IntGdiCreateDC(NULL, NULL, NULL, NULL, TRUE);
|
||||||
if (NULL != ScreenDCHandle)
|
if (NULL != ScreenDCHandle)
|
||||||
{
|
{
|
||||||
ScreenDC = DC_LockDc(ScreenDCHandle);
|
ScreenDC = DC_LockDc(ScreenDCHandle);
|
||||||
if (NULL != ScreenDC)
|
if (NULL != ScreenDC)
|
||||||
{
|
{
|
||||||
Width = ScreenDC->GDIInfo->ulHorzRes;
|
Width = ScreenDC->GDIInfo->ulHorzRes;
|
||||||
Height = ScreenDC->GDIInfo->ulVertRes;
|
Height = ScreenDC->GDIInfo->ulVertRes;
|
||||||
DC_UnlockDc(ScreenDC);
|
DC_UnlockDc(ScreenDC);
|
||||||
}
|
}
|
||||||
NtGdiDeleteDC(ScreenDCHandle);
|
NtGdiDeleteDC(ScreenDCHandle);
|
||||||
}
|
}
|
||||||
return SM_CXSCREEN == Index ? Width : Height;
|
return SM_CXSCREEN == Index ? Width : Height;
|
||||||
}
|
}
|
||||||
case SM_CXSIZE:
|
case SM_CXSIZE:
|
||||||
case SM_CYSIZE:
|
case SM_CYSIZE:
|
||||||
return(18);
|
return(18);
|
||||||
case SM_CXSMICON:
|
case SM_CXSMICON:
|
||||||
case SM_CYSMICON:
|
case SM_CYSMICON:
|
||||||
return(16);
|
return(16);
|
||||||
case SM_CXSMSIZE:
|
case SM_CXSMSIZE:
|
||||||
return(12);
|
return(12);
|
||||||
case SM_CYSMSIZE:
|
case SM_CYSMSIZE:
|
||||||
return(14);
|
return(14);
|
||||||
case SM_CXVSCROLL:
|
case SM_CXVSCROLL:
|
||||||
case SM_CYVSCROLL:
|
case SM_CYVSCROLL:
|
||||||
return(16);
|
return(16);
|
||||||
case SM_CYCAPTION:
|
case SM_CYCAPTION:
|
||||||
return(19);
|
return(19);
|
||||||
case SM_CYKANJIWINDOW:
|
case SM_CYKANJIWINDOW:
|
||||||
return 0;
|
return 0;
|
||||||
case SM_CYMENU:
|
case SM_CYMENU:
|
||||||
return(19);
|
return(19);
|
||||||
case SM_CYSMCAPTION:
|
case SM_CYSMCAPTION:
|
||||||
return(15);
|
return(15);
|
||||||
case SM_DBCSENABLED:
|
case SM_DBCSENABLED:
|
||||||
case SM_DEBUG:
|
case SM_DEBUG:
|
||||||
case SM_MENUDROPALIGNMENT:
|
case SM_MENUDROPALIGNMENT:
|
||||||
case SM_MIDEASTENABLED:
|
case SM_MIDEASTENABLED:
|
||||||
return(0);
|
return(0);
|
||||||
case SM_MOUSEPRESENT:
|
case SM_MOUSEPRESENT:
|
||||||
return(1);
|
return(1);
|
||||||
case SM_NETWORK:
|
case SM_NETWORK:
|
||||||
return(3);
|
return(3);
|
||||||
case SM_PENWINDOWS:
|
case SM_PENWINDOWS:
|
||||||
case SM_SECURE:
|
case SM_SECURE:
|
||||||
case SM_SHOWSOUNDS:
|
case SM_SHOWSOUNDS:
|
||||||
case SM_SLOWMACHINE:
|
case SM_SLOWMACHINE:
|
||||||
return(0);
|
return(0);
|
||||||
case SM_CMONITORS:
|
case SM_CMONITORS:
|
||||||
return(1);
|
return(1);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return(0xFFFFFFFF);
|
return(0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -224,16 +224,16 @@ UserGetSystemMetrics(ULONG Index)
|
||||||
ULONG STDCALL
|
ULONG STDCALL
|
||||||
NtUserGetSystemMetrics(ULONG Index)
|
NtUserGetSystemMetrics(ULONG Index)
|
||||||
{
|
{
|
||||||
DECLARE_RETURN(ULONG);
|
DECLARE_RETURN(ULONG);
|
||||||
|
|
||||||
DPRINT("Enter NtUserGetSystemMetrics\n");
|
DPRINT("Enter NtUserGetSystemMetrics\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
RETURN(UserGetSystemMetrics(Index));
|
RETURN(UserGetSystemMetrics(Index));
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserGetSystemMetrics, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserGetSystemMetrics, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
}
|
}
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -46,9 +46,9 @@ DWORD _locked=0;
|
||||||
NTSTATUS FASTCALL InitUserImpl(VOID)
|
NTSTATUS FASTCALL InitUserImpl(VOID)
|
||||||
{
|
{
|
||||||
//PVOID mem;
|
//PVOID mem;
|
||||||
|
|
||||||
// DPRINT("Enter InitUserImpl\n");
|
// DPRINT("Enter InitUserImpl\n");
|
||||||
// ExInitializeResourceLite(&UserLock);
|
// ExInitializeResourceLite(&UserLock);
|
||||||
|
|
||||||
ExInitializeFastMutex(&UserLock);
|
ExInitializeFastMutex(&UserLock);
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ NTSTATUS FASTCALL InitUserImpl(VOID)
|
||||||
DPRINT1("Failed creating handle table\n");
|
DPRINT1("Failed creating handle table\n");
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,35 +73,35 @@ BOOL FASTCALL UserIsEntered()
|
||||||
|
|
||||||
VOID FASTCALL CleanupUser(VOID)
|
VOID FASTCALL CleanupUser(VOID)
|
||||||
{
|
{
|
||||||
// ExDeleteResourceLite(&UserLock);
|
// ExDeleteResourceLite(&UserLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FASTCALL UUserEnterShared(VOID)
|
VOID FASTCALL UUserEnterShared(VOID)
|
||||||
{
|
{
|
||||||
// DPRINT("Enter IntLockUserShared\n");
|
// DPRINT("Enter IntLockUserShared\n");
|
||||||
// KeDumpStackFrames((PULONG)__builtin_frame_address(0));
|
// KeDumpStackFrames((PULONG)__builtin_frame_address(0));
|
||||||
//DPRINT("%x\n",__builtin_return_address(0));
|
//DPRINT("%x\n",__builtin_return_address(0));
|
||||||
// KeEnterCriticalRegion();
|
// KeEnterCriticalRegion();
|
||||||
// ExAcquireResourceSharedLite(&UserLock, TRUE);
|
// ExAcquireResourceSharedLite(&UserLock, TRUE);
|
||||||
ExAcquireFastMutex(&UserLock);
|
ExAcquireFastMutex(&UserLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FASTCALL UUserEnterExclusive(VOID)
|
VOID FASTCALL UUserEnterExclusive(VOID)
|
||||||
{
|
{
|
||||||
// DPRINT("Enter UserEnterExclusive\n");
|
// DPRINT("Enter UserEnterExclusive\n");
|
||||||
// KeDumpStackFrames((PULONG)__builtin_frame_address(0));
|
// KeDumpStackFrames((PULONG)__builtin_frame_address(0));
|
||||||
//DPRINT("%x\n",__builtin_return_address(0));
|
//DPRINT("%x\n",__builtin_return_address(0));
|
||||||
// KeEnterCriticalRegion();
|
// KeEnterCriticalRegion();
|
||||||
// ExAcquireResourceExclusiveLite(&UserLock, TRUE);
|
// ExAcquireResourceExclusiveLite(&UserLock, TRUE);
|
||||||
ExAcquireFastMutex(&UserLock);
|
ExAcquireFastMutex(&UserLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FASTCALL UUserLeave(VOID)
|
VOID FASTCALL UUserLeave(VOID)
|
||||||
{
|
{
|
||||||
// DPRINT("Enter UserLeave\n");
|
// DPRINT("Enter UserLeave\n");
|
||||||
// KeDumpStackFrames((PULONG)__builtin_frame_address(0));
|
// KeDumpStackFrames((PULONG)__builtin_frame_address(0));
|
||||||
//DPRINT("%x\n",__builtin_return_address(0));
|
//DPRINT("%x\n",__builtin_return_address(0));
|
||||||
// ExReleaseResourceLite(&UserLock);
|
// ExReleaseResourceLite(&UserLock);
|
||||||
// KeLeaveCriticalRegion();
|
// KeLeaveCriticalRegion();
|
||||||
ExReleaseFastMutex(&UserLock);
|
ExReleaseFastMutex(&UserLock);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,167 +33,179 @@ USER_HANDLE_TABLE gHandleTable;
|
||||||
|
|
||||||
PUSER_HANDLE_ENTRY handle_to_entry(PUSER_HANDLE_TABLE ht, HANDLE handle )
|
PUSER_HANDLE_ENTRY handle_to_entry(PUSER_HANDLE_TABLE ht, HANDLE handle )
|
||||||
{
|
{
|
||||||
unsigned short generation;
|
unsigned short generation;
|
||||||
int index = (((unsigned int)handle & 0xffff) - FIRST_USER_HANDLE) >> 1;
|
int index = (((unsigned int)handle & 0xffff) - FIRST_USER_HANDLE) >> 1;
|
||||||
if (index < 0 || index >= ht->nb_handles) return NULL;
|
if (index < 0 || index >= ht->nb_handles)
|
||||||
if (!ht->handles[index].type) return NULL;
|
return NULL;
|
||||||
generation = (unsigned int)handle >> 16;
|
if (!ht->handles[index].type)
|
||||||
if (generation == ht->handles[index].generation || !generation || generation == 0xffff)
|
return NULL;
|
||||||
return &ht->handles[index];
|
generation = (unsigned int)handle >> 16;
|
||||||
return NULL;
|
if (generation == ht->handles[index].generation || !generation || generation == 0xffff)
|
||||||
|
return &ht->handles[index];
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static HANDLE entry_to_handle(PUSER_HANDLE_TABLE ht, PUSER_HANDLE_ENTRY ptr )
|
inline static HANDLE entry_to_handle(PUSER_HANDLE_TABLE ht, PUSER_HANDLE_ENTRY ptr )
|
||||||
{
|
{
|
||||||
int index = ptr - ht->handles;
|
int index = ptr - ht->handles;
|
||||||
return (HANDLE)(((index << 1) + FIRST_USER_HANDLE) + (ptr->generation << 16));
|
return (HANDLE)(((index << 1) + FIRST_USER_HANDLE) + (ptr->generation << 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static PUSER_HANDLE_ENTRY alloc_user_entry(PUSER_HANDLE_TABLE ht)
|
inline static PUSER_HANDLE_ENTRY alloc_user_entry(PUSER_HANDLE_TABLE ht)
|
||||||
{
|
{
|
||||||
PUSER_HANDLE_ENTRY entry;
|
PUSER_HANDLE_ENTRY entry;
|
||||||
|
|
||||||
if (ht->freelist)
|
if (ht->freelist)
|
||||||
{
|
{
|
||||||
entry = ht->freelist;
|
entry = ht->freelist;
|
||||||
ht->freelist = entry->ptr;
|
ht->freelist = entry->ptr;
|
||||||
|
|
||||||
usedHandles++;
|
usedHandles++;
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ht->nb_handles >= ht->allocated_handles) /* need to grow the array */
|
if (ht->nb_handles >= ht->allocated_handles) /* need to grow the array */
|
||||||
{
|
{
|
||||||
DPRINT1("Out of user handles!\n");
|
DPRINT1("Out of user handles!\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
#if 0
|
#if 0
|
||||||
struct user_handle *new_handles;
|
|
||||||
/* grow array by 50% (but at minimum 32 entries) */
|
struct user_handle *new_handles;
|
||||||
int growth = max( 32, allocated_handles / 2 );
|
/* grow array by 50% (but at minimum 32 entries) */
|
||||||
int new_size = min( allocated_handles + growth, (LAST_USER_HANDLE-FIRST_USER_HANDLE+1) >> 1 );
|
int growth = max( 32, allocated_handles / 2 );
|
||||||
if (new_size <= allocated_handles) return NULL;
|
int new_size = min( allocated_handles + growth, (LAST_USER_HANDLE-FIRST_USER_HANDLE+1) >> 1 );
|
||||||
if (!(new_handles = realloc( handles, new_size * sizeof(*handles) )))
|
if (new_size <= allocated_handles)
|
||||||
return NULL;
|
return NULL;
|
||||||
handles = new_handles;
|
if (!(new_handles = realloc( handles, new_size * sizeof(*handles) )))
|
||||||
allocated_handles = new_size;
|
return NULL;
|
||||||
#endif
|
handles = new_handles;
|
||||||
}
|
allocated_handles = new_size;
|
||||||
|
#endif
|
||||||
entry = &ht->handles[ht->nb_handles++];
|
|
||||||
|
}
|
||||||
entry->generation = 1;
|
|
||||||
|
entry = &ht->handles[ht->nb_handles++];
|
||||||
usedHandles++;
|
|
||||||
|
entry->generation = 1;
|
||||||
return entry;
|
|
||||||
|
usedHandles++;
|
||||||
|
|
||||||
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID UserInitHandleTable(PUSER_HANDLE_TABLE ht, PVOID mem, ULONG bytes)
|
VOID UserInitHandleTable(PUSER_HANDLE_TABLE ht, PVOID mem, ULONG bytes)
|
||||||
{
|
{
|
||||||
ht->freelist = NULL;
|
ht->freelist = NULL;
|
||||||
ht->handles = mem;
|
ht->handles = mem;
|
||||||
|
|
||||||
ht->nb_handles = 0;
|
ht->nb_handles = 0;
|
||||||
ht->allocated_handles = bytes / sizeof(USER_HANDLE_ENTRY);
|
ht->allocated_handles = bytes / sizeof(USER_HANDLE_ENTRY);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static void *free_user_entry(PUSER_HANDLE_TABLE ht, PUSER_HANDLE_ENTRY entry)
|
inline static void *free_user_entry(PUSER_HANDLE_TABLE ht, PUSER_HANDLE_ENTRY entry)
|
||||||
{
|
{
|
||||||
void *ret;
|
void *ret;
|
||||||
ret = entry->ptr;
|
ret = entry->ptr;
|
||||||
entry->ptr = ht->freelist;
|
entry->ptr = ht->freelist;
|
||||||
entry->type = 0;
|
entry->type = 0;
|
||||||
ht->freelist = entry;
|
ht->freelist = entry;
|
||||||
|
|
||||||
usedHandles--;
|
usedHandles--;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocate a user handle for a given object */
|
/* allocate a user handle for a given object */
|
||||||
HANDLE UserAllocHandle(PUSER_HANDLE_TABLE ht, PVOID object, USER_OBJECT_TYPE type )
|
HANDLE UserAllocHandle(PUSER_HANDLE_TABLE ht, PVOID object, USER_OBJECT_TYPE type )
|
||||||
{
|
{
|
||||||
PUSER_HANDLE_ENTRY entry = alloc_user_entry(ht);
|
PUSER_HANDLE_ENTRY entry = alloc_user_entry(ht);
|
||||||
if (!entry) return 0;
|
if (!entry)
|
||||||
entry->ptr = object;
|
return 0;
|
||||||
entry->type = type;
|
entry->ptr = object;
|
||||||
if (++entry->generation >= 0xffff) entry->generation = 1;
|
entry->type = type;
|
||||||
return entry_to_handle(ht, entry );
|
if (++entry->generation >= 0xffff)
|
||||||
|
entry->generation = 1;
|
||||||
|
return entry_to_handle(ht, entry );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return a pointer to a user object from its handle */
|
/* return a pointer to a user object from its handle */
|
||||||
PVOID UserGetObject(PUSER_HANDLE_TABLE ht, HANDLE handle, USER_OBJECT_TYPE type )
|
PVOID UserGetObject(PUSER_HANDLE_TABLE ht, HANDLE handle, USER_OBJECT_TYPE type )
|
||||||
{
|
{
|
||||||
PUSER_HANDLE_ENTRY entry;
|
PUSER_HANDLE_ENTRY entry;
|
||||||
|
|
||||||
ASSERT(ht);
|
ASSERT(ht);
|
||||||
|
|
||||||
if (!(entry = handle_to_entry(ht, handle )) || entry->type != type)
|
if (!(entry = handle_to_entry(ht, handle )) || entry->type != type)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return entry->ptr;
|
return entry->ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* get the full handle (32bit) for a possibly truncated (16bit) handle */
|
/* get the full handle (32bit) for a possibly truncated (16bit) handle */
|
||||||
HANDLE get_user_full_handle(PUSER_HANDLE_TABLE ht, HANDLE handle )
|
HANDLE get_user_full_handle(PUSER_HANDLE_TABLE ht, HANDLE handle )
|
||||||
{
|
{
|
||||||
PUSER_HANDLE_ENTRY entry;
|
PUSER_HANDLE_ENTRY entry;
|
||||||
|
|
||||||
if ((unsigned int)handle >> 16) return handle;
|
if ((unsigned int)handle >> 16)
|
||||||
if (!(entry = handle_to_entry(ht, handle ))) return handle;
|
return handle;
|
||||||
return entry_to_handle( ht, entry );
|
if (!(entry = handle_to_entry(ht, handle )))
|
||||||
|
return handle;
|
||||||
|
return entry_to_handle( ht, entry );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* same as get_user_object plus set the handle to the full 32-bit value */
|
/* same as get_user_object plus set the handle to the full 32-bit value */
|
||||||
void *get_user_object_handle(PUSER_HANDLE_TABLE ht, HANDLE* handle, USER_OBJECT_TYPE type )
|
void *get_user_object_handle(PUSER_HANDLE_TABLE ht, HANDLE* handle, USER_OBJECT_TYPE type )
|
||||||
{
|
{
|
||||||
PUSER_HANDLE_ENTRY entry;
|
PUSER_HANDLE_ENTRY entry;
|
||||||
|
|
||||||
if (!(entry = handle_to_entry(ht, *handle )) || entry->type != type) return NULL;
|
if (!(entry = handle_to_entry(ht, *handle )) || entry->type != type)
|
||||||
*handle = entry_to_handle( ht, entry );
|
return NULL;
|
||||||
return entry->ptr;
|
*handle = entry_to_handle( ht, entry );
|
||||||
|
return entry->ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free a user handle and return a pointer to the object */
|
/* free a user handle and return a pointer to the object */
|
||||||
PVOID UserFreeHandle(PUSER_HANDLE_TABLE ht, HANDLE handle )
|
PVOID UserFreeHandle(PUSER_HANDLE_TABLE ht, HANDLE handle )
|
||||||
{
|
{
|
||||||
PUSER_HANDLE_ENTRY entry;
|
PUSER_HANDLE_ENTRY entry;
|
||||||
|
|
||||||
if (!(entry = handle_to_entry( ht, handle )))
|
if (!(entry = handle_to_entry( ht, handle )))
|
||||||
{
|
{
|
||||||
SetLastNtError( STATUS_INVALID_HANDLE );
|
SetLastNtError( STATUS_INVALID_HANDLE );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return free_user_entry(ht, entry );
|
return free_user_entry(ht, entry );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return the next user handle after 'handle' that is of a given type */
|
/* return the next user handle after 'handle' that is of a given type */
|
||||||
PVOID UserGetNextHandle(PUSER_HANDLE_TABLE ht, HANDLE* handle, USER_OBJECT_TYPE type )
|
PVOID UserGetNextHandle(PUSER_HANDLE_TABLE ht, HANDLE* handle, USER_OBJECT_TYPE type )
|
||||||
{
|
{
|
||||||
PUSER_HANDLE_ENTRY entry;
|
PUSER_HANDLE_ENTRY entry;
|
||||||
|
|
||||||
if (!*handle) entry = ht->handles;
|
if (!*handle)
|
||||||
else
|
entry = ht->handles;
|
||||||
{
|
else
|
||||||
int index = (((unsigned int)*handle & 0xffff) - FIRST_USER_HANDLE) >> 1;
|
{
|
||||||
if (index < 0 || index >= ht->nb_handles) return NULL;
|
int index = (((unsigned int)*handle & 0xffff) - FIRST_USER_HANDLE) >> 1;
|
||||||
entry = ht->handles + index + 1; /* start from the next one */
|
if (index < 0 || index >= ht->nb_handles)
|
||||||
}
|
return NULL;
|
||||||
while (entry < ht->handles + ht->nb_handles)
|
entry = ht->handles + index + 1; /* start from the next one */
|
||||||
{
|
}
|
||||||
if (!type || entry->type == type)
|
while (entry < ht->handles + ht->nb_handles)
|
||||||
{
|
{
|
||||||
*handle = entry_to_handle(ht, entry );
|
if (!type || entry->type == type)
|
||||||
return entry->ptr;
|
{
|
||||||
}
|
*handle = entry_to_handle(ht, entry );
|
||||||
entry++;
|
return entry->ptr;
|
||||||
}
|
}
|
||||||
return NULL;
|
entry++;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -201,14 +213,16 @@ PVOID UserGetNextHandle(PUSER_HANDLE_TABLE ht, HANDLE* handle, USER_OBJECT_TYPE
|
||||||
PVOID FASTCALL
|
PVOID FASTCALL
|
||||||
ObmCreateObject(PUSER_HANDLE_TABLE ht, HANDLE* h,USER_OBJECT_TYPE type , ULONG size)
|
ObmCreateObject(PUSER_HANDLE_TABLE ht, HANDLE* h,USER_OBJECT_TYPE type , ULONG size)
|
||||||
{
|
{
|
||||||
|
|
||||||
HANDLE hi;
|
HANDLE hi;
|
||||||
PUSER_OBJECT_HEADER hdr = ExAllocatePool(PagedPool, size + sizeof(USER_OBJECT_HEADER));
|
PUSER_OBJECT_HEADER hdr = ExAllocatePool(PagedPool, size + sizeof(USER_OBJECT_HEADER));
|
||||||
if (!hdr) return NULL;
|
if (!hdr)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
hi = UserAllocHandle(ht, USER_HEADER_TO_BODY(hdr), type );
|
hi = UserAllocHandle(ht, USER_HEADER_TO_BODY(hdr), type );
|
||||||
if (!hi){
|
if (!hi)
|
||||||
|
{
|
||||||
ExFreePool(hdr);
|
ExFreePool(hdr);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -216,33 +230,35 @@ ObmCreateObject(PUSER_HANDLE_TABLE ht, HANDLE* h,USER_OBJECT_TYPE type , ULONG s
|
||||||
RtlZeroMemory(hdr, size + sizeof(USER_OBJECT_HEADER));
|
RtlZeroMemory(hdr, size + sizeof(USER_OBJECT_HEADER));
|
||||||
hdr->hSelf = hi;
|
hdr->hSelf = hi;
|
||||||
hdr->RefCount++; //temp hack!
|
hdr->RefCount++; //temp hack!
|
||||||
|
|
||||||
if (h) *h = hi;
|
if (h)
|
||||||
|
*h = hi;
|
||||||
return USER_HEADER_TO_BODY(hdr);
|
return USER_HEADER_TO_BODY(hdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
ObmDeleteObject(HANDLE h, USER_OBJECT_TYPE type )
|
ObmDeleteObject(HANDLE h, USER_OBJECT_TYPE type )
|
||||||
{
|
{
|
||||||
PUSER_OBJECT_HEADER hdr;
|
PUSER_OBJECT_HEADER hdr;
|
||||||
PVOID body = UserGetObject(&gHandleTable, h, type);
|
PVOID body = UserGetObject(&gHandleTable, h, type);
|
||||||
if (!body) return FALSE;
|
if (!body)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
hdr = USER_BODY_TO_HEADER(body);
|
hdr = USER_BODY_TO_HEADER(body);
|
||||||
ASSERT(hdr->RefCount >= 0);
|
ASSERT(hdr->RefCount >= 0);
|
||||||
|
|
||||||
hdr->destroyed = TRUE;
|
hdr->destroyed = TRUE;
|
||||||
if (hdr->RefCount == 0)
|
if (hdr->RefCount == 0)
|
||||||
{
|
{
|
||||||
UserFreeHandle(&gHandleTable, h);
|
UserFreeHandle(&gHandleTable, h);
|
||||||
|
|
||||||
memset(hdr, 0x55, sizeof(USER_OBJECT_HEADER));
|
memset(hdr, 0x55, sizeof(USER_OBJECT_HEADER));
|
||||||
|
|
||||||
ExFreePool(hdr);
|
ExFreePool(hdr);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DPRINT1("info: something not destroyed bcause refs still left, inuse %i\n",usedHandles);
|
// DPRINT1("info: something not destroyed bcause refs still left, inuse %i\n",usedHandles);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,9 +266,9 @@ ObmDeleteObject(HANDLE h, USER_OBJECT_TYPE type )
|
||||||
VOID FASTCALL ObmReferenceObject(PVOID obj)
|
VOID FASTCALL ObmReferenceObject(PVOID obj)
|
||||||
{
|
{
|
||||||
PUSER_OBJECT_HEADER hdr = USER_BODY_TO_HEADER(obj);
|
PUSER_OBJECT_HEADER hdr = USER_BODY_TO_HEADER(obj);
|
||||||
|
|
||||||
ASSERT(hdr->RefCount >= 0);
|
ASSERT(hdr->RefCount >= 0);
|
||||||
|
|
||||||
hdr->RefCount++;
|
hdr->RefCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,24 +276,24 @@ VOID FASTCALL ObmReferenceObject(PVOID obj)
|
||||||
BOOL FASTCALL ObmDereferenceObject(PVOID obj)
|
BOOL FASTCALL ObmDereferenceObject(PVOID obj)
|
||||||
{
|
{
|
||||||
PUSER_OBJECT_HEADER hdr = USER_BODY_TO_HEADER(obj);
|
PUSER_OBJECT_HEADER hdr = USER_BODY_TO_HEADER(obj);
|
||||||
|
|
||||||
ASSERT(hdr->RefCount >= 1);
|
ASSERT(hdr->RefCount >= 1);
|
||||||
|
|
||||||
hdr->RefCount--;
|
hdr->RefCount--;
|
||||||
|
|
||||||
if (hdr->RefCount == 0 && hdr->destroyed)
|
if (hdr->RefCount == 0 && hdr->destroyed)
|
||||||
{
|
{
|
||||||
// DPRINT1("info: something destroyed bcaise of deref, in use=%i\n",usedHandles);
|
// DPRINT1("info: something destroyed bcaise of deref, in use=%i\n",usedHandles);
|
||||||
|
|
||||||
UserFreeHandle(&gHandleTable, hdr->hSelf);
|
UserFreeHandle(&gHandleTable, hdr->hSelf);
|
||||||
|
|
||||||
memset(hdr, 0x55, sizeof(USER_OBJECT_HEADER));
|
memset(hdr, 0x55, sizeof(USER_OBJECT_HEADER));
|
||||||
|
|
||||||
ExFreePool(hdr);
|
ExFreePool(hdr);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +301,7 @@ BOOL FASTCALL ObmDereferenceObject(PVOID obj)
|
||||||
|
|
||||||
BOOL FASTCALL ObmCreateHandleTable()
|
BOOL FASTCALL ObmCreateHandleTable()
|
||||||
{
|
{
|
||||||
|
|
||||||
PVOID mem;
|
PVOID mem;
|
||||||
|
|
||||||
//FIXME: dont alloc all at once! must be mapped into umode also...
|
//FIXME: dont alloc all at once! must be mapped into umode also...
|
||||||
|
@ -295,9 +311,9 @@ BOOL FASTCALL ObmCreateHandleTable()
|
||||||
DPRINT1("Failed creating handle table\n");
|
DPRINT1("Failed creating handle table\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME: make auto growable
|
//FIXME: make auto growable
|
||||||
UserInitHandleTable(&gHandleTable, mem, sizeof(USER_HANDLE_ENTRY) * 1024);
|
UserInitHandleTable(&gHandleTable, mem, sizeof(USER_HANDLE_ENTRY) * 1024);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ IntValidateParent(PWINDOW_OBJECT Child, HRGN ValidRegion)
|
||||||
OffsetY = Child->WindowRect.top - ParentWindow->WindowRect.top;
|
OffsetY = Child->WindowRect.top - ParentWindow->WindowRect.top;
|
||||||
NtGdiOffsetRgn(ValidRegion, OffsetX, OffsetY);
|
NtGdiOffsetRgn(ValidRegion, OffsetX, OffsetY);
|
||||||
NtGdiCombineRgn(ParentWindow->UpdateRegion, ParentWindow->UpdateRegion,
|
NtGdiCombineRgn(ParentWindow->UpdateRegion, ParentWindow->UpdateRegion,
|
||||||
ValidRegion, RGN_DIFF);
|
ValidRegion, RGN_DIFF);
|
||||||
/* FIXME: If the resulting region is empty, remove fake posted paint message */
|
/* FIXME: If the resulting region is empty, remove fake posted paint message */
|
||||||
NtGdiOffsetRgn(ValidRegion, -OffsetX, -OffsetY);
|
NtGdiOffsetRgn(ValidRegion, -OffsetX, -OffsetY);
|
||||||
}
|
}
|
||||||
|
@ -79,101 +79,101 @@ IntValidateParent(PWINDOW_OBJECT Child, HRGN ValidRegion)
|
||||||
STATIC VOID FASTCALL
|
STATIC VOID FASTCALL
|
||||||
co_IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
|
co_IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
|
||||||
{
|
{
|
||||||
HDC hDC;
|
HDC hDC;
|
||||||
HWND hWnd = Window->hSelf;
|
HWND hWnd = Window->hSelf;
|
||||||
HRGN TempRegion;
|
HRGN TempRegion;
|
||||||
|
|
||||||
if (Flags & (RDW_ERASENOW | RDW_UPDATENOW))
|
if (Flags & (RDW_ERASENOW | RDW_UPDATENOW))
|
||||||
{
|
{
|
||||||
if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT)
|
if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT)
|
||||||
{
|
{
|
||||||
if (Window->NCUpdateRegion)
|
if (Window->NCUpdateRegion)
|
||||||
{
|
{
|
||||||
IntValidateParent(Window, Window->NCUpdateRegion);
|
IntValidateParent(Window, Window->NCUpdateRegion);
|
||||||
}
|
}
|
||||||
TempRegion = Window->NCUpdateRegion;
|
TempRegion = Window->NCUpdateRegion;
|
||||||
if ((HANDLE) 1 != TempRegion && NULL != TempRegion)
|
if ((HANDLE) 1 != TempRegion && NULL != TempRegion)
|
||||||
{
|
{
|
||||||
GDIOBJ_SetOwnership(TempRegion, PsGetCurrentProcess());
|
GDIOBJ_SetOwnership(TempRegion, PsGetCurrentProcess());
|
||||||
}
|
}
|
||||||
Window->NCUpdateRegion = NULL;
|
Window->NCUpdateRegion = NULL;
|
||||||
Window->Flags &= ~WINDOWOBJECT_NEED_NCPAINT;
|
Window->Flags &= ~WINDOWOBJECT_NEED_NCPAINT;
|
||||||
MsqDecPaintCountQueue(Window->MessageQueue);
|
MsqDecPaintCountQueue(Window->MessageQueue);
|
||||||
co_IntSendMessage(hWnd, WM_NCPAINT, (WPARAM)TempRegion, 0);
|
co_IntSendMessage(hWnd, WM_NCPAINT, (WPARAM)TempRegion, 0);
|
||||||
if ((HANDLE) 1 != TempRegion && NULL != TempRegion)
|
if ((HANDLE) 1 != TempRegion && NULL != TempRegion)
|
||||||
{
|
{
|
||||||
/* NOTE: The region can already be deleted! */
|
/* NOTE: The region can already be deleted! */
|
||||||
GDIOBJ_FreeObj(TempRegion, GDI_OBJECT_TYPE_REGION | GDI_OBJECT_TYPE_SILENT);
|
GDIOBJ_FreeObj(TempRegion, GDI_OBJECT_TYPE_REGION | GDI_OBJECT_TYPE_SILENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Window->Flags & WINDOWOBJECT_NEED_ERASEBKGND)
|
if (Window->Flags & WINDOWOBJECT_NEED_ERASEBKGND)
|
||||||
{
|
{
|
||||||
if (Window->UpdateRegion)
|
if (Window->UpdateRegion)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* This surely wrong! Why we would want to validate the parent?
|
||||||
|
* It breaks quite a few things including dummy WM_ERASEBKGND
|
||||||
|
* implementations that return only TRUE and have corresponding
|
||||||
|
* WM_PAINT that doesn't paint the whole client area.
|
||||||
|
* I left the code here so that no one will readd it again!
|
||||||
|
* - Filip
|
||||||
|
*/
|
||||||
|
/* IntValidateParent(Window, Window->UpdateRegion); */
|
||||||
|
hDC = UserGetDCEx(Window, 0, DCX_CACHE | DCX_USESTYLE |
|
||||||
|
DCX_INTERSECTUPDATE);
|
||||||
|
if (hDC != NULL)
|
||||||
{
|
{
|
||||||
/*
|
if (co_IntSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hDC, 0))
|
||||||
* This surely wrong! Why we would want to validate the parent?
|
{
|
||||||
* It breaks quite a few things including dummy WM_ERASEBKGND
|
Window->Flags &= ~WINDOWOBJECT_NEED_ERASEBKGND;
|
||||||
* implementations that return only TRUE and have corresponding
|
}
|
||||||
* WM_PAINT that doesn't paint the whole client area.
|
UserReleaseDC(Window, hDC);
|
||||||
* I left the code here so that no one will readd it again!
|
|
||||||
* - Filip
|
|
||||||
*/
|
|
||||||
/* IntValidateParent(Window, Window->UpdateRegion); */
|
|
||||||
hDC = UserGetDCEx(Window, 0, DCX_CACHE | DCX_USESTYLE |
|
|
||||||
DCX_INTERSECTUPDATE);
|
|
||||||
if (hDC != NULL)
|
|
||||||
{
|
|
||||||
if (co_IntSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hDC, 0))
|
|
||||||
{
|
|
||||||
Window->Flags &= ~WINDOWOBJECT_NEED_ERASEBKGND;
|
|
||||||
}
|
|
||||||
UserReleaseDC(Window, hDC);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Flags & RDW_UPDATENOW)
|
if (Flags & RDW_UPDATENOW)
|
||||||
{
|
{
|
||||||
if (Window->UpdateRegion != NULL ||
|
if (Window->UpdateRegion != NULL ||
|
||||||
Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)
|
Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)
|
||||||
{
|
{
|
||||||
co_IntSendMessage(hWnd, WM_PAINT, 0, 0);
|
co_IntSendMessage(hWnd, WM_PAINT, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check that the window is still valid at this point
|
* Check that the window is still valid at this point
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (! IntIsWindow(hWnd))
|
if (! IntIsWindow(hWnd))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Paint child windows.
|
* Paint child windows.
|
||||||
*/
|
*/
|
||||||
if (!(Flags & RDW_NOCHILDREN) && !(Window->Style & WS_MINIMIZE) &&
|
if (!(Flags & RDW_NOCHILDREN) && !(Window->Style & WS_MINIMIZE) &&
|
||||||
((Flags & RDW_ALLCHILDREN) || !(Window->Style & WS_CLIPCHILDREN)))
|
((Flags & RDW_ALLCHILDREN) || !(Window->Style & WS_CLIPCHILDREN)))
|
||||||
{
|
{
|
||||||
HWND *List, *phWnd;
|
HWND *List, *phWnd;
|
||||||
|
|
||||||
if ((List = IntWinListChildren(Window)))
|
if ((List = IntWinListChildren(Window)))
|
||||||
{
|
{
|
||||||
for (phWnd = List; *phWnd; ++phWnd)
|
for (phWnd = List; *phWnd; ++phWnd)
|
||||||
|
{
|
||||||
|
Window = IntGetWindowObject(*phWnd);
|
||||||
|
if (Window && (Window->Style & WS_VISIBLE))
|
||||||
{
|
{
|
||||||
Window = IntGetWindowObject(*phWnd);
|
co_IntPaintWindows(Window, Flags);
|
||||||
if (Window && (Window->Style & WS_VISIBLE))
|
IntReleaseWindowObject(Window);
|
||||||
{
|
|
||||||
co_IntPaintWindows(Window, Flags);
|
|
||||||
IntReleaseWindowObject(Window);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ExFreePool(List);
|
}
|
||||||
}
|
ExFreePool(List);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -199,8 +199,8 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
|
||||||
|
|
||||||
hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect);
|
hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect);
|
||||||
NtGdiOffsetRgn(hRgnWindow,
|
NtGdiOffsetRgn(hRgnWindow,
|
||||||
-Window->WindowRect.left,
|
-Window->WindowRect.left,
|
||||||
-Window->WindowRect.top);
|
-Window->WindowRect.top);
|
||||||
RgnType = NtGdiCombineRgn(hRgn, hRgn, hRgnWindow, RGN_AND);
|
RgnType = NtGdiCombineRgn(hRgn, hRgn, hRgnWindow, RGN_AND);
|
||||||
NtGdiDeleteObject(hRgnWindow);
|
NtGdiDeleteObject(hRgnWindow);
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
HadPaintMessage = Window->UpdateRegion != NULL ||
|
HadPaintMessage = Window->UpdateRegion != NULL ||
|
||||||
Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT;
|
Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT;
|
||||||
HadNCPaintMessage = Window->Flags & WINDOWOBJECT_NEED_NCPAINT;
|
HadNCPaintMessage = Window->Flags & WINDOWOBJECT_NEED_NCPAINT;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -230,7 +230,7 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NtGdiCombineRgn(Window->UpdateRegion, Window->UpdateRegion,
|
if (NtGdiCombineRgn(Window->UpdateRegion, Window->UpdateRegion,
|
||||||
hRgn, RGN_OR) == NULLREGION)
|
hRgn, RGN_OR) == NULLREGION)
|
||||||
{
|
{
|
||||||
GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess());
|
GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess());
|
||||||
NtGdiDeleteObject(Window->UpdateRegion);
|
NtGdiDeleteObject(Window->UpdateRegion);
|
||||||
|
@ -250,7 +250,7 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
|
||||||
if (Window->UpdateRegion != NULL)
|
if (Window->UpdateRegion != NULL)
|
||||||
{
|
{
|
||||||
if (NtGdiCombineRgn(Window->UpdateRegion, Window->UpdateRegion,
|
if (NtGdiCombineRgn(Window->UpdateRegion, Window->UpdateRegion,
|
||||||
hRgn, RGN_DIFF) == NULLREGION)
|
hRgn, RGN_DIFF) == NULLREGION)
|
||||||
{
|
{
|
||||||
GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess());
|
GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess());
|
||||||
NtGdiDeleteObject(Window->UpdateRegion);
|
NtGdiDeleteObject(Window->UpdateRegion);
|
||||||
|
@ -286,12 +286,12 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
|
||||||
|
|
||||||
hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect);
|
hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect);
|
||||||
NtGdiOffsetRgn(hRgnWindow,
|
NtGdiOffsetRgn(hRgnWindow,
|
||||||
-Window->WindowRect.left,
|
-Window->WindowRect.left,
|
||||||
-Window->WindowRect.top);
|
-Window->WindowRect.top);
|
||||||
|
|
||||||
hRgnNonClient = NtGdiCreateRectRgn(0, 0, 0, 0);
|
hRgnNonClient = NtGdiCreateRectRgn(0, 0, 0, 0);
|
||||||
if (NtGdiCombineRgn(hRgnNonClient, Window->UpdateRegion,
|
if (NtGdiCombineRgn(hRgnNonClient, Window->UpdateRegion,
|
||||||
hRgnWindow, RGN_DIFF) == NULLREGION)
|
hRgnWindow, RGN_DIFF) == NULLREGION)
|
||||||
{
|
{
|
||||||
NtGdiDeleteObject(hRgnNonClient);
|
NtGdiDeleteObject(hRgnNonClient);
|
||||||
hRgnNonClient = NULL;
|
hRgnNonClient = NULL;
|
||||||
|
@ -305,7 +305,7 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
|
||||||
* Remove the nonclient region from the standard update region.
|
* Remove the nonclient region from the standard update region.
|
||||||
*/
|
*/
|
||||||
if (NtGdiCombineRgn(Window->UpdateRegion, Window->UpdateRegion,
|
if (NtGdiCombineRgn(Window->UpdateRegion, Window->UpdateRegion,
|
||||||
hRgnWindow, RGN_AND) == NULLREGION)
|
hRgnWindow, RGN_AND) == NULLREGION)
|
||||||
{
|
{
|
||||||
GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess());
|
GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess());
|
||||||
NtGdiDeleteObject(Window->UpdateRegion);
|
NtGdiDeleteObject(Window->UpdateRegion);
|
||||||
|
@ -320,10 +320,10 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
|
||||||
{
|
{
|
||||||
if(NULL != hRgnNonClient)
|
if(NULL != hRgnNonClient)
|
||||||
{
|
{
|
||||||
NtGdiCombineRgn(Window->NCUpdateRegion, Window->NCUpdateRegion,
|
NtGdiCombineRgn(Window->NCUpdateRegion, Window->NCUpdateRegion,
|
||||||
hRgnNonClient, RGN_OR);
|
hRgnNonClient, RGN_OR);
|
||||||
GDIOBJ_SetOwnership(hRgnNonClient, PsGetCurrentProcess());
|
GDIOBJ_SetOwnership(hRgnNonClient, PsGetCurrentProcess());
|
||||||
NtGdiDeleteObject(hRgnNonClient);
|
NtGdiDeleteObject(hRgnNonClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!(Flags & RDW_NOCHILDREN) && !(Window->Style & WS_MINIMIZE) &&
|
if (!(Flags & RDW_NOCHILDREN) && !(Window->Style & WS_MINIMIZE) &&
|
||||||
((Flags & RDW_ALLCHILDREN) || !(Window->Style & WS_CLIPCHILDREN)))
|
((Flags & RDW_ALLCHILDREN) || !(Window->Style & WS_CLIPCHILDREN)))
|
||||||
{
|
{
|
||||||
HWND *List, *phWnd;
|
HWND *List, *phWnd;
|
||||||
PWINDOW_OBJECT Child;
|
PWINDOW_OBJECT Child;
|
||||||
|
@ -347,7 +347,7 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
|
||||||
Child = IntGetWindowObject(*phWnd);
|
Child = IntGetWindowObject(*phWnd);
|
||||||
if(!Child)
|
if(!Child)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (Child->Style & WS_VISIBLE)
|
if (Child->Style & WS_VISIBLE)
|
||||||
{
|
{
|
||||||
|
@ -357,8 +357,8 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
|
||||||
HRGN hRgnTemp = NtGdiCreateRectRgn(0, 0, 0, 0);
|
HRGN hRgnTemp = NtGdiCreateRectRgn(0, 0, 0, 0);
|
||||||
NtGdiCombineRgn(hRgnTemp, hRgn, 0, RGN_COPY);
|
NtGdiCombineRgn(hRgnTemp, hRgn, 0, RGN_COPY);
|
||||||
NtGdiOffsetRgn(hRgnTemp,
|
NtGdiOffsetRgn(hRgnTemp,
|
||||||
Window->WindowRect.left - Child->WindowRect.left,
|
Window->WindowRect.left - Child->WindowRect.left,
|
||||||
Window->WindowRect.top - Child->WindowRect.top);
|
Window->WindowRect.top - Child->WindowRect.top);
|
||||||
IntInvalidateWindows(Child, hRgnTemp, Flags);
|
IntInvalidateWindows(Child, hRgnTemp, Flags);
|
||||||
NtGdiDeleteObject(hRgnTemp);
|
NtGdiDeleteObject(hRgnTemp);
|
||||||
}
|
}
|
||||||
|
@ -373,7 +373,7 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
HasPaintMessage = Window->UpdateRegion != NULL ||
|
HasPaintMessage = Window->UpdateRegion != NULL ||
|
||||||
Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT;
|
Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT;
|
||||||
HasNCPaintMessage = Window->Flags & WINDOWOBJECT_NEED_NCPAINT;
|
HasNCPaintMessage = Window->Flags & WINDOWOBJECT_NEED_NCPAINT;
|
||||||
|
|
||||||
if (HasPaintMessage != HadPaintMessage)
|
if (HasPaintMessage != HadPaintMessage)
|
||||||
|
@ -410,14 +410,15 @@ IntIsWindowDrawable(PWINDOW_OBJECT Window)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (!(Wnd->Style & WS_VISIBLE) ||
|
if (!(Wnd->Style & WS_VISIBLE) ||
|
||||||
((Wnd->Style & WS_MINIMIZE) && (Wnd != Window)))
|
((Wnd->Style & WS_MINIMIZE) && (Wnd != Window)))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Wnd = Wnd->Parent;
|
Wnd = Wnd->Parent;
|
||||||
|
|
||||||
} while(Wnd);
|
}
|
||||||
|
while(Wnd);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -431,7 +432,7 @@ IntIsWindowDrawable(PWINDOW_OBJECT Window)
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
co_UserRedrawWindow(PWINDOW_OBJECT Window, const RECT* UpdateRect, HRGN UpdateRgn,
|
co_UserRedrawWindow(PWINDOW_OBJECT Window, const RECT* UpdateRect, HRGN UpdateRgn,
|
||||||
ULONG Flags)
|
ULONG Flags)
|
||||||
{
|
{
|
||||||
HRGN hRgn = NULL;
|
HRGN hRgn = NULL;
|
||||||
|
|
||||||
|
@ -441,8 +442,8 @@ co_UserRedrawWindow(PWINDOW_OBJECT Window, const RECT* UpdateRect, HRGN UpdateRg
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!IntIsWindowDrawable(Window) ||
|
if (!IntIsWindowDrawable(Window) ||
|
||||||
(Flags & (RDW_VALIDATE | RDW_INVALIDATE)) ==
|
(Flags & (RDW_VALIDATE | RDW_INVALIDATE)) ==
|
||||||
(RDW_VALIDATE | RDW_INVALIDATE))
|
(RDW_VALIDATE | RDW_INVALIDATE))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -460,31 +461,33 @@ co_UserRedrawWindow(PWINDOW_OBJECT Window, const RECT* UpdateRect, HRGN UpdateRg
|
||||||
hRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
|
hRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
|
||||||
NtGdiCombineRgn(hRgn, UpdateRgn, NULL, RGN_COPY);
|
NtGdiCombineRgn(hRgn, UpdateRgn, NULL, RGN_COPY);
|
||||||
NtGdiOffsetRgn(hRgn,
|
NtGdiOffsetRgn(hRgn,
|
||||||
Window->ClientRect.left - Window->WindowRect.left,
|
Window->ClientRect.left - Window->WindowRect.left,
|
||||||
Window->ClientRect.top - Window->WindowRect.top);
|
Window->ClientRect.top - Window->WindowRect.top);
|
||||||
} else
|
|
||||||
if (UpdateRect != NULL)
|
|
||||||
{
|
|
||||||
hRgn = UnsafeIntCreateRectRgnIndirect((RECT *)UpdateRect);
|
|
||||||
NtGdiOffsetRgn(hRgn,
|
|
||||||
Window->ClientRect.left - Window->WindowRect.left,
|
|
||||||
Window->ClientRect.top - Window->WindowRect.top);
|
|
||||||
} else
|
|
||||||
if ((Flags & (RDW_INVALIDATE | RDW_FRAME)) == (RDW_INVALIDATE | RDW_FRAME) ||
|
|
||||||
(Flags & (RDW_VALIDATE | RDW_NOFRAME)) == (RDW_VALIDATE | RDW_NOFRAME))
|
|
||||||
{
|
|
||||||
hRgn = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect);
|
|
||||||
NtGdiOffsetRgn(hRgn,
|
|
||||||
-Window->WindowRect.left,
|
|
||||||
-Window->WindowRect.top);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
if (UpdateRect != NULL)
|
||||||
hRgn = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect);
|
{
|
||||||
NtGdiOffsetRgn(hRgn,
|
hRgn = UnsafeIntCreateRectRgnIndirect((RECT *)UpdateRect);
|
||||||
-Window->WindowRect.left,
|
NtGdiOffsetRgn(hRgn,
|
||||||
-Window->WindowRect.top);
|
Window->ClientRect.left - Window->WindowRect.left,
|
||||||
}
|
Window->ClientRect.top - Window->WindowRect.top);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if ((Flags & (RDW_INVALIDATE | RDW_FRAME)) == (RDW_INVALIDATE | RDW_FRAME) ||
|
||||||
|
(Flags & (RDW_VALIDATE | RDW_NOFRAME)) == (RDW_VALIDATE | RDW_NOFRAME))
|
||||||
|
{
|
||||||
|
hRgn = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect);
|
||||||
|
NtGdiOffsetRgn(hRgn,
|
||||||
|
-Window->WindowRect.left,
|
||||||
|
-Window->WindowRect.top);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hRgn = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect);
|
||||||
|
NtGdiOffsetRgn(hRgn,
|
||||||
|
-Window->WindowRect.left,
|
||||||
|
-Window->WindowRect.top);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -524,9 +527,9 @@ BOOL FASTCALL
|
||||||
IntIsWindowDirty(PWINDOW_OBJECT Window)
|
IntIsWindowDirty(PWINDOW_OBJECT Window)
|
||||||
{
|
{
|
||||||
return (Window->Style & WS_VISIBLE) &&
|
return (Window->Style & WS_VISIBLE) &&
|
||||||
((Window->UpdateRegion != NULL) ||
|
((Window->UpdateRegion != NULL) ||
|
||||||
(Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT) ||
|
(Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT) ||
|
||||||
(Window->Flags & WINDOWOBJECT_NEED_NCPAINT));
|
(Window->Flags & WINDOWOBJECT_NEED_NCPAINT));
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND STDCALL
|
HWND STDCALL
|
||||||
|
@ -541,7 +544,7 @@ IntFindWindowToRepaint(HWND hWnd, PW32THREAD Thread)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (IntIsWindowDirty(Window) &&
|
if (IntIsWindowDirty(Window) &&
|
||||||
IntWndBelongsToThread(Window, Thread))
|
IntWndBelongsToThread(Window, Thread))
|
||||||
{
|
{
|
||||||
IntReleaseWindowObject(Window);
|
IntReleaseWindowObject(Window);
|
||||||
return hWnd;
|
return hWnd;
|
||||||
|
@ -550,7 +553,7 @@ IntFindWindowToRepaint(HWND hWnd, PW32THREAD Thread)
|
||||||
for (Child = Window->FirstChild; Child; Child = Child->NextSibling)
|
for (Child = Window->FirstChild; Child; Child = Child->NextSibling)
|
||||||
{
|
{
|
||||||
if (IntIsWindowDirty(Child) &&
|
if (IntIsWindowDirty(Child) &&
|
||||||
IntWndBelongsToThread(Child, Thread))
|
IntWndBelongsToThread(Child, Thread))
|
||||||
{
|
{
|
||||||
hFoundWnd = Child->hSelf;
|
hFoundWnd = Child->hSelf;
|
||||||
break;
|
break;
|
||||||
|
@ -591,7 +594,7 @@ IntGetPaintMessage(HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if ((MsgFilterMin != 0 || MsgFilterMax != 0) &&
|
if ((MsgFilterMin != 0 || MsgFilterMax != 0) &&
|
||||||
(MsgFilterMin > WM_PAINT || MsgFilterMax < WM_PAINT))
|
(MsgFilterMin > WM_PAINT || MsgFilterMax < WM_PAINT))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (hWnd)
|
if (hWnd)
|
||||||
|
@ -631,17 +634,17 @@ co_IntFixCaret(PWINDOW_OBJECT Window, LPRECT lprc, UINT flags)
|
||||||
PTHRDCARETINFO CaretInfo;
|
PTHRDCARETINFO CaretInfo;
|
||||||
HWND hWndCaret;
|
HWND hWndCaret;
|
||||||
PWINDOW_OBJECT WndCaret;
|
PWINDOW_OBJECT WndCaret;
|
||||||
|
|
||||||
ASSERT_REFS_CO(Window);
|
ASSERT_REFS_CO(Window);
|
||||||
|
|
||||||
Desktop = PsGetCurrentThread()->Tcb.Win32Thread->Desktop;
|
Desktop = PsGetCurrentThread()->Tcb.Win32Thread->Desktop;
|
||||||
CaretInfo = ((PUSER_MESSAGE_QUEUE)Desktop->ActiveMessageQueue)->CaretInfo;
|
CaretInfo = ((PUSER_MESSAGE_QUEUE)Desktop->ActiveMessageQueue)->CaretInfo;
|
||||||
hWndCaret = CaretInfo->hWnd;
|
hWndCaret = CaretInfo->hWnd;
|
||||||
|
|
||||||
WndCaret = UserGetWindowObject(hWndCaret);
|
WndCaret = UserGetWindowObject(hWndCaret);
|
||||||
|
|
||||||
if (WndCaret == Window ||
|
if (WndCaret == Window ||
|
||||||
((flags & SW_SCROLLCHILDREN) && IntIsChildWindow(Window->hSelf, hWndCaret)))
|
((flags & SW_SCROLLCHILDREN) && IntIsChildWindow(Window->hSelf, hWndCaret)))
|
||||||
{
|
{
|
||||||
POINT pt, FromOffset, ToOffset, Offset;
|
POINT pt, FromOffset, ToOffset, Offset;
|
||||||
RECT rcCaret;
|
RECT rcCaret;
|
||||||
|
@ -702,7 +705,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs)
|
||||||
HRGN hRgn;
|
HRGN hRgn;
|
||||||
|
|
||||||
if (Window->NCUpdateRegion != (HANDLE)1 &&
|
if (Window->NCUpdateRegion != (HANDLE)1 &&
|
||||||
Window->NCUpdateRegion != NULL)
|
Window->NCUpdateRegion != NULL)
|
||||||
{
|
{
|
||||||
GDIOBJ_SetOwnership(Window->NCUpdateRegion, PsGetCurrentProcess());
|
GDIOBJ_SetOwnership(Window->NCUpdateRegion, PsGetCurrentProcess());
|
||||||
}
|
}
|
||||||
|
@ -720,7 +723,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs)
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory(&Ps, sizeof(PAINTSTRUCT));
|
RtlZeroMemory(&Ps, sizeof(PAINTSTRUCT));
|
||||||
|
|
||||||
Ps.hdc = UserGetDCEx(Window, 0, DCX_INTERSECTUPDATE | DCX_WINDOWPAINT | DCX_USESTYLE);
|
Ps.hdc = UserGetDCEx(Window, 0, DCX_INTERSECTUPDATE | DCX_WINDOWPAINT | DCX_USESTYLE);
|
||||||
|
|
||||||
if (!Ps.hdc)
|
if (!Ps.hdc)
|
||||||
|
@ -778,12 +781,12 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs)
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN( Ps.hdc);
|
RETURN( Ps.hdc);
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserBeginPaint, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserBeginPaint, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -801,19 +804,19 @@ NtUserEndPaint(HWND hWnd, CONST PAINTSTRUCT* lPs)
|
||||||
|
|
||||||
DPRINT("Enter NtUserEndPaint\n");
|
DPRINT("Enter NtUserEndPaint\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
if (!(Window = IntGetWindowObject(hWnd)))
|
if (!(Window = IntGetWindowObject(hWnd)))
|
||||||
{
|
{
|
||||||
RETURN(FALSE);
|
RETURN(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
UserReleaseDC(Window, lPs->hdc);
|
UserReleaseDC(Window, lPs->hdc);
|
||||||
co_UserShowCaret(Window);
|
co_UserShowCaret(Window);
|
||||||
|
|
||||||
IntReleaseWindowObject(Window); //temp hack
|
IntReleaseWindowObject(Window); //temp hack
|
||||||
|
|
||||||
RETURN(TRUE);
|
RETURN(TRUE);
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserEndPaint, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserEndPaint, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
|
@ -927,18 +930,18 @@ NtUserGetUpdateRgn(HWND hWnd, HRGN hRgn, BOOL bErase)
|
||||||
|
|
||||||
DPRINT("Enter NtUserGetUpdateRgn\n");
|
DPRINT("Enter NtUserGetUpdateRgn\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
if (!(Window = UserGetWindowObject(hWnd)))
|
if (!(Window = UserGetWindowObject(hWnd)))
|
||||||
{
|
{
|
||||||
RETURN(ERROR);
|
RETURN(ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
UserRefObjectCo(Window);
|
UserRefObjectCo(Window);
|
||||||
ret = co_UserGetUpdateRgn(Window, hRgn, bErase);
|
ret = co_UserGetUpdateRgn(Window, hRgn, bErase);
|
||||||
UserDerefObjectCo(Window);
|
UserDerefObjectCo(Window);
|
||||||
|
|
||||||
RETURN(ret);
|
RETURN(ret);
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserGetUpdateRgn, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserGetUpdateRgn, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
|
@ -1020,7 +1023,7 @@ CLEANUP:
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate,
|
NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate,
|
||||||
UINT flags)
|
UINT flags)
|
||||||
{
|
{
|
||||||
RECT SafeUpdateRect;
|
RECT SafeUpdateRect;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -1038,7 +1041,7 @@ NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate,
|
||||||
if (lprcUpdate != NULL)
|
if (lprcUpdate != NULL)
|
||||||
{
|
{
|
||||||
Status = MmCopyFromCaller(&SafeUpdateRect, (PRECT)lprcUpdate,
|
Status = MmCopyFromCaller(&SafeUpdateRect, (PRECT)lprcUpdate,
|
||||||
sizeof(RECT));
|
sizeof(RECT));
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -1050,7 +1053,7 @@ NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate,
|
||||||
UserRefObjectCo(Wnd);
|
UserRefObjectCo(Wnd);
|
||||||
|
|
||||||
Status = co_UserRedrawWindow(Wnd, NULL == lprcUpdate ? NULL : &SafeUpdateRect,
|
Status = co_UserRedrawWindow(Wnd, NULL == lprcUpdate ? NULL : &SafeUpdateRect,
|
||||||
hrgnUpdate, flags);
|
hrgnUpdate, flags);
|
||||||
|
|
||||||
UserDerefObjectCo(Wnd);
|
UserDerefObjectCo(Wnd);
|
||||||
|
|
||||||
|
@ -1062,7 +1065,7 @@ NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate,
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN( TRUE);
|
RETURN( TRUE);
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserRedrawWindow, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserRedrawWindow, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
|
@ -1074,7 +1077,7 @@ CLEANUP:
|
||||||
static
|
static
|
||||||
DWORD FASTCALL
|
DWORD FASTCALL
|
||||||
UserScrollDC(HDC hDC, INT dx, INT dy, const RECT *lprcScroll,
|
UserScrollDC(HDC hDC, INT dx, INT dy, const RECT *lprcScroll,
|
||||||
const RECT *lprcClip, HRGN hrgnUpdate, LPRECT lprcUpdate)
|
const RECT *lprcClip, HRGN hrgnUpdate, LPRECT lprcUpdate)
|
||||||
{
|
{
|
||||||
RECT rSrc, rClipped_src, rClip, rDst, offset;
|
RECT rSrc, rClipped_src, rClip, rDst, offset;
|
||||||
PDC DC;
|
PDC DC;
|
||||||
|
@ -1085,9 +1088,9 @@ UserScrollDC(HDC hDC, INT dx, INT dy, const RECT *lprcScroll,
|
||||||
|
|
||||||
DC = DC_LockDc(hDC);
|
DC = DC_LockDc(hDC);
|
||||||
if (NULL == DC)
|
if (NULL == DC)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (lprcScroll)
|
if (lprcScroll)
|
||||||
rSrc = *lprcScroll;
|
rSrc = *lprcScroll;
|
||||||
else
|
else
|
||||||
|
@ -1182,20 +1185,20 @@ UserScrollDC(HDC hDC, INT dx, INT dy, const RECT *lprcScroll,
|
||||||
|
|
||||||
DWORD STDCALL
|
DWORD STDCALL
|
||||||
NtUserScrollDC(HDC hDC, INT dx, INT dy, const RECT *lprcScroll,
|
NtUserScrollDC(HDC hDC, INT dx, INT dy, const RECT *lprcScroll,
|
||||||
const RECT *lprcClip, HRGN hrgnUpdate, LPRECT lprcUpdate)
|
const RECT *lprcClip, HRGN hrgnUpdate, LPRECT lprcUpdate)
|
||||||
{
|
{
|
||||||
DECLARE_RETURN(DWORD);
|
DECLARE_RETURN(DWORD);
|
||||||
|
|
||||||
DPRINT("Enter NtUserScrollDC\n");
|
DPRINT("Enter NtUserScrollDC\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
RETURN( UserScrollDC(hDC, dx, dy, lprcScroll, lprcClip, hrgnUpdate, lprcUpdate));
|
RETURN( UserScrollDC(hDC, dx, dy, lprcScroll, lprcClip, hrgnUpdate, lprcUpdate));
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserScrollDC, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserScrollDC, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1207,7 +1210,7 @@ CLEANUP:
|
||||||
|
|
||||||
DWORD STDCALL
|
DWORD STDCALL
|
||||||
NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *UnsafeRect,
|
NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *UnsafeRect,
|
||||||
const RECT *UnsafeClipRect, HRGN hrgnUpdate, LPRECT rcUpdate, UINT flags)
|
const RECT *UnsafeClipRect, HRGN hrgnUpdate, LPRECT rcUpdate, UINT flags)
|
||||||
{
|
{
|
||||||
RECT rc, cliprc, caretrc, rect, clipRect;
|
RECT rc, cliprc, caretrc, rect, clipRect;
|
||||||
INT Result;
|
INT Result;
|
||||||
|
@ -1229,10 +1232,10 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *UnsafeRect,
|
||||||
Window = NULL; /* prevent deref at cleanup */
|
Window = NULL; /* prevent deref at cleanup */
|
||||||
RETURN( ERROR);
|
RETURN( ERROR);
|
||||||
}
|
}
|
||||||
UserRefObjectCo(Window);
|
UserRefObjectCo(Window);
|
||||||
|
|
||||||
IntGetClientRect(Window, &rc);
|
IntGetClientRect(Window, &rc);
|
||||||
|
|
||||||
if (NULL != UnsafeRect)
|
if (NULL != UnsafeRect)
|
||||||
{
|
{
|
||||||
Status = MmCopyFromCaller(&rect, UnsafeRect, sizeof(RECT));
|
Status = MmCopyFromCaller(&rect, UnsafeRect, sizeof(RECT));
|
||||||
|
@ -1258,7 +1261,7 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *UnsafeRect,
|
||||||
cliprc = rc;
|
cliprc = rc;
|
||||||
|
|
||||||
if (cliprc.right <= cliprc.left || cliprc.bottom <= cliprc.top ||
|
if (cliprc.right <= cliprc.left || cliprc.bottom <= cliprc.top ||
|
||||||
(dx == 0 && dy == 0))
|
(dx == 0 && dy == 0))
|
||||||
{
|
{
|
||||||
RETURN( NULLREGION);
|
RETURN( NULLREGION);
|
||||||
}
|
}
|
||||||
|
@ -1293,7 +1296,7 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *UnsafeRect,
|
||||||
co_UserRedrawWindow(Window, NULL, hrgnTemp, RDW_INVALIDATE | RDW_ERASE);
|
co_UserRedrawWindow(Window, NULL, hrgnTemp, RDW_INVALIDATE | RDW_ERASE);
|
||||||
NtGdiDeleteObject(hrgnClip);
|
NtGdiDeleteObject(hrgnClip);
|
||||||
}
|
}
|
||||||
|
|
||||||
NtGdiDeleteObject(hrgnTemp);
|
NtGdiDeleteObject(hrgnTemp);
|
||||||
|
|
||||||
if (flags & SW_SCROLLCHILDREN)
|
if (flags & SW_SCROLLCHILDREN)
|
||||||
|
@ -1305,11 +1308,12 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *UnsafeRect,
|
||||||
RECT r, dummy;
|
RECT r, dummy;
|
||||||
POINT ClientOrigin;
|
POINT ClientOrigin;
|
||||||
PWINDOW_OBJECT Wnd;
|
PWINDOW_OBJECT Wnd;
|
||||||
|
|
||||||
IntGetClientOrigin(Window, &ClientOrigin);
|
IntGetClientOrigin(Window, &ClientOrigin);
|
||||||
for (i = 0; List[i]; i++)
|
for (i = 0; List[i]; i++)
|
||||||
{
|
{
|
||||||
if (!(Wnd = UserGetWindowObject(List[i]))) continue;
|
if (!(Wnd = UserGetWindowObject(List[i])))
|
||||||
|
continue;
|
||||||
|
|
||||||
r = Wnd->WindowRect;
|
r = Wnd->WindowRect;
|
||||||
r.left -= ClientOrigin.x;
|
r.left -= ClientOrigin.x;
|
||||||
|
@ -1321,11 +1325,11 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *UnsafeRect,
|
||||||
{
|
{
|
||||||
UserRefObjectCo(Wnd);
|
UserRefObjectCo(Wnd);
|
||||||
co_WinPosSetWindowPos(Wnd, 0, r.left + dx, r.top + dy, 0, 0,
|
co_WinPosSetWindowPos(Wnd, 0, r.left + dx, r.top + dy, 0, 0,
|
||||||
SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE |
|
SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE |
|
||||||
SWP_NOREDRAW);
|
SWP_NOREDRAW);
|
||||||
UserDerefObjectCo(Wnd);
|
UserDerefObjectCo(Wnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
ExFreePool(List);
|
ExFreePool(List);
|
||||||
}
|
}
|
||||||
|
@ -1333,8 +1337,8 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *UnsafeRect,
|
||||||
|
|
||||||
if (flags & (SW_INVALIDATE | SW_ERASE))
|
if (flags & (SW_INVALIDATE | SW_ERASE))
|
||||||
co_UserRedrawWindow(Window, NULL, hrgnUpdate, RDW_INVALIDATE | RDW_ERASE |
|
co_UserRedrawWindow(Window, NULL, hrgnUpdate, RDW_INVALIDATE | RDW_ERASE |
|
||||||
((flags & SW_ERASE) ? RDW_ERASENOW : 0) |
|
((flags & SW_ERASE) ? RDW_ERASENOW : 0) |
|
||||||
((flags & SW_SCROLLCHILDREN) ? RDW_ALLCHILDREN : 0));
|
((flags & SW_SCROLLCHILDREN) ? RDW_ALLCHILDREN : 0));
|
||||||
|
|
||||||
if (bOwnRgn && hrgnUpdate)
|
if (bOwnRgn && hrgnUpdate)
|
||||||
NtGdiDeleteObject(hrgnUpdate);
|
NtGdiDeleteObject(hrgnUpdate);
|
||||||
|
@ -1342,17 +1346,18 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *UnsafeRect,
|
||||||
if ((CaretWnd = UserGetWindowObject(hwndCaret)))
|
if ((CaretWnd = UserGetWindowObject(hwndCaret)))
|
||||||
{
|
{
|
||||||
UserRefObjectCo(CaretWnd);
|
UserRefObjectCo(CaretWnd);
|
||||||
|
|
||||||
co_IntSetCaretPos(caretrc.left + dx, caretrc.top + dy);
|
co_IntSetCaretPos(caretrc.left + dx, caretrc.top + dy);
|
||||||
co_UserShowCaret(CaretWnd);
|
co_UserShowCaret(CaretWnd);
|
||||||
|
|
||||||
UserDerefObjectCo(CaretWnd);
|
UserDerefObjectCo(CaretWnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN( Result);
|
RETURN( Result);
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
if (Window) UserDerefObjectCo(Window);
|
if (Window)
|
||||||
|
UserDerefObjectCo(Window);
|
||||||
|
|
||||||
DPRINT("Leave NtUserScrollWindowEx, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserScrollWindowEx, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
|
|
|
@ -35,9 +35,10 @@
|
||||||
|
|
||||||
typedef struct _PROPLISTITEM
|
typedef struct _PROPLISTITEM
|
||||||
{
|
{
|
||||||
ATOM Atom;
|
ATOM Atom;
|
||||||
HANDLE Data;
|
HANDLE Data;
|
||||||
} PROPLISTITEM, *PPROPLISTITEM;
|
}
|
||||||
|
PROPLISTITEM, *PPROPLISTITEM;
|
||||||
|
|
||||||
|
|
||||||
/* STATIC FUNCTIONS **********************************************************/
|
/* STATIC FUNCTIONS **********************************************************/
|
||||||
|
@ -48,205 +49,205 @@ static
|
||||||
PPROPERTY FASTCALL
|
PPROPERTY FASTCALL
|
||||||
IntGetProp(PWINDOW_OBJECT Window, ATOM Atom)
|
IntGetProp(PWINDOW_OBJECT Window, ATOM Atom)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY ListEntry;
|
PLIST_ENTRY ListEntry;
|
||||||
PPROPERTY Property;
|
PPROPERTY Property;
|
||||||
|
|
||||||
ListEntry = Window->PropListHead.Flink;
|
ListEntry = Window->PropListHead.Flink;
|
||||||
while (ListEntry != &Window->PropListHead)
|
while (ListEntry != &Window->PropListHead)
|
||||||
{
|
{
|
||||||
Property = CONTAINING_RECORD(ListEntry, PROPERTY, PropListEntry);
|
Property = CONTAINING_RECORD(ListEntry, PROPERTY, PropListEntry);
|
||||||
if (Property->Atom == Atom)
|
if (Property->Atom == Atom)
|
||||||
{
|
{
|
||||||
return(Property);
|
return(Property);
|
||||||
}
|
}
|
||||||
ListEntry = ListEntry->Flink;
|
ListEntry = ListEntry->Flink;
|
||||||
}
|
}
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
NtUserBuildPropList(HWND hWnd,
|
NtUserBuildPropList(HWND hWnd,
|
||||||
LPVOID Buffer,
|
LPVOID Buffer,
|
||||||
DWORD BufferSize,
|
DWORD BufferSize,
|
||||||
DWORD *Count)
|
DWORD *Count)
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT Window;
|
PWINDOW_OBJECT Window;
|
||||||
PPROPERTY Property;
|
PPROPERTY Property;
|
||||||
PLIST_ENTRY ListEntry;
|
PLIST_ENTRY ListEntry;
|
||||||
PROPLISTITEM listitem, *li;
|
PROPLISTITEM listitem, *li;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
DWORD Cnt = 0;
|
DWORD Cnt = 0;
|
||||||
DECLARE_RETURN(NTSTATUS);
|
DECLARE_RETURN(NTSTATUS);
|
||||||
|
|
||||||
DPRINT("Enter NtUserBuildPropList\n");
|
|
||||||
UserEnterShared();
|
|
||||||
|
|
||||||
if (!(Window = UserGetWindowObject(hWnd)))
|
DPRINT("Enter NtUserBuildPropList\n");
|
||||||
{
|
UserEnterShared();
|
||||||
RETURN( STATUS_INVALID_HANDLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Buffer)
|
if (!(Window = UserGetWindowObject(hWnd)))
|
||||||
{
|
{
|
||||||
if(!BufferSize || (BufferSize % sizeof(PROPLISTITEM) != 0))
|
RETURN( STATUS_INVALID_HANDLE);
|
||||||
{
|
}
|
||||||
RETURN( STATUS_INVALID_PARAMETER);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* copy list */
|
if(Buffer)
|
||||||
li = (PROPLISTITEM *)Buffer;
|
{
|
||||||
ListEntry = Window->PropListHead.Flink;
|
if(!BufferSize || (BufferSize % sizeof(PROPLISTITEM) != 0))
|
||||||
while((BufferSize >= sizeof(PROPLISTITEM)) && (ListEntry != &Window->PropListHead))
|
|
||||||
{
|
|
||||||
Property = CONTAINING_RECORD(ListEntry, PROPERTY, PropListEntry);
|
|
||||||
listitem.Atom = Property->Atom;
|
|
||||||
listitem.Data = Property->Data;
|
|
||||||
|
|
||||||
Status = MmCopyToCaller(li, &listitem, sizeof(PROPLISTITEM));
|
|
||||||
if(!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
RETURN( Status);
|
RETURN( STATUS_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferSize -= sizeof(PROPLISTITEM);
|
/* copy list */
|
||||||
Cnt++;
|
li = (PROPLISTITEM *)Buffer;
|
||||||
li++;
|
ListEntry = Window->PropListHead.Flink;
|
||||||
ListEntry = ListEntry->Flink;
|
while((BufferSize >= sizeof(PROPLISTITEM)) && (ListEntry != &Window->PropListHead))
|
||||||
}
|
{
|
||||||
|
Property = CONTAINING_RECORD(ListEntry, PROPERTY, PropListEntry);
|
||||||
|
listitem.Atom = Property->Atom;
|
||||||
|
listitem.Data = Property->Data;
|
||||||
|
|
||||||
}
|
Status = MmCopyToCaller(li, &listitem, sizeof(PROPLISTITEM));
|
||||||
else
|
if(!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
Cnt = Window->PropListItems * sizeof(PROPLISTITEM);
|
RETURN( Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Count)
|
BufferSize -= sizeof(PROPLISTITEM);
|
||||||
{
|
Cnt++;
|
||||||
Status = MmCopyToCaller(Count, &Cnt, sizeof(DWORD));
|
li++;
|
||||||
if(!NT_SUCCESS(Status))
|
ListEntry = ListEntry->Flink;
|
||||||
{
|
}
|
||||||
RETURN( Status);
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
Cnt = Window->PropListItems * sizeof(PROPLISTITEM);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Count)
|
||||||
|
{
|
||||||
|
Status = MmCopyToCaller(Count, &Cnt, sizeof(DWORD));
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
RETURN( Status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RETURN( STATUS_SUCCESS);
|
||||||
|
|
||||||
RETURN( STATUS_SUCCESS);
|
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserBuildPropList, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserBuildPropList, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE STDCALL
|
HANDLE STDCALL
|
||||||
NtUserRemoveProp(HWND hWnd, ATOM Atom)
|
NtUserRemoveProp(HWND hWnd, ATOM Atom)
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT Window;
|
PWINDOW_OBJECT Window;
|
||||||
PPROPERTY Prop;
|
PPROPERTY Prop;
|
||||||
HANDLE Data;
|
HANDLE Data;
|
||||||
DECLARE_RETURN(HANDLE);
|
DECLARE_RETURN(HANDLE);
|
||||||
|
|
||||||
DPRINT("Enter NtUserRemoveProp\n");
|
|
||||||
UserEnterExclusive();
|
|
||||||
|
|
||||||
if (!(Window = UserGetWindowObject(hWnd)))
|
DPRINT("Enter NtUserRemoveProp\n");
|
||||||
{
|
UserEnterExclusive();
|
||||||
RETURN( NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
Prop = IntGetProp(Window, Atom);
|
if (!(Window = UserGetWindowObject(hWnd)))
|
||||||
|
{
|
||||||
|
RETURN( NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if (Prop == NULL)
|
Prop = IntGetProp(Window, Atom);
|
||||||
{
|
|
||||||
|
if (Prop == NULL)
|
||||||
|
{
|
||||||
RETURN(NULL);
|
RETURN(NULL);
|
||||||
}
|
}
|
||||||
Data = Prop->Data;
|
Data = Prop->Data;
|
||||||
RemoveEntryList(&Prop->PropListEntry);
|
RemoveEntryList(&Prop->PropListEntry);
|
||||||
ExFreePool(Prop);
|
ExFreePool(Prop);
|
||||||
Window->PropListItems--;
|
Window->PropListItems--;
|
||||||
|
|
||||||
|
RETURN(Data);
|
||||||
|
|
||||||
RETURN(Data);
|
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserRemoveProp, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserRemoveProp, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE STDCALL
|
HANDLE STDCALL
|
||||||
NtUserGetProp(HWND hWnd, ATOM Atom)
|
NtUserGetProp(HWND hWnd, ATOM Atom)
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT Window;
|
PWINDOW_OBJECT Window;
|
||||||
PPROPERTY Prop;
|
PPROPERTY Prop;
|
||||||
HANDLE Data = NULL;
|
HANDLE Data = NULL;
|
||||||
DECLARE_RETURN(HANDLE);
|
DECLARE_RETURN(HANDLE);
|
||||||
|
|
||||||
DPRINT("Enter NtUserGetProp\n");
|
|
||||||
UserEnterShared();
|
|
||||||
|
|
||||||
if (!(Window = UserGetWindowObject(hWnd)))
|
DPRINT("Enter NtUserGetProp\n");
|
||||||
{
|
UserEnterShared();
|
||||||
RETURN( FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
Prop = IntGetProp(Window, Atom);
|
if (!(Window = UserGetWindowObject(hWnd)))
|
||||||
if (Prop != NULL)
|
{
|
||||||
{
|
RETURN( FALSE);
|
||||||
Data = Prop->Data;
|
}
|
||||||
}
|
|
||||||
|
Prop = IntGetProp(Window, Atom);
|
||||||
|
if (Prop != NULL)
|
||||||
|
{
|
||||||
|
Data = Prop->Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
RETURN(Data);
|
||||||
|
|
||||||
RETURN(Data);
|
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserGetProp, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserGetProp, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
IntSetProp(PWINDOW_OBJECT Wnd, ATOM Atom, HANDLE Data)
|
IntSetProp(PWINDOW_OBJECT Wnd, ATOM Atom, HANDLE Data)
|
||||||
{
|
{
|
||||||
PPROPERTY Prop;
|
PPROPERTY Prop;
|
||||||
|
|
||||||
Prop = IntGetProp(Wnd, Atom);
|
Prop = IntGetProp(Wnd, Atom);
|
||||||
|
|
||||||
if (Prop == NULL)
|
if (Prop == NULL)
|
||||||
{
|
{
|
||||||
Prop = ExAllocatePoolWithTag(PagedPool, sizeof(PROPERTY), TAG_WNDPROP);
|
Prop = ExAllocatePoolWithTag(PagedPool, sizeof(PROPERTY), TAG_WNDPROP);
|
||||||
if (Prop == NULL)
|
if (Prop == NULL)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
Prop->Atom = Atom;
|
Prop->Atom = Atom;
|
||||||
InsertTailList(&Wnd->PropListHead, &Prop->PropListEntry);
|
InsertTailList(&Wnd->PropListHead, &Prop->PropListEntry);
|
||||||
Wnd->PropListItems++;
|
Wnd->PropListItems++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Prop->Data = Data;
|
Prop->Data = Data;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtUserSetProp(HWND hWnd, ATOM Atom, HANDLE Data)
|
NtUserSetProp(HWND hWnd, ATOM Atom, HANDLE Data)
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT Window;
|
PWINDOW_OBJECT Window;
|
||||||
DECLARE_RETURN(BOOL);
|
DECLARE_RETURN(BOOL);
|
||||||
|
|
||||||
DPRINT("Enter NtUserSetProp\n");
|
|
||||||
UserEnterExclusive();
|
|
||||||
|
|
||||||
if (!(Window = UserGetWindowObject(hWnd)))
|
DPRINT("Enter NtUserSetProp\n");
|
||||||
{
|
UserEnterExclusive();
|
||||||
RETURN( FALSE);
|
|
||||||
}
|
if (!(Window = UserGetWindowObject(hWnd)))
|
||||||
|
{
|
||||||
|
RETURN( FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
RETURN( IntSetProp(Window, Atom, Data));
|
||||||
|
|
||||||
RETURN( IntSetProp(Window, Atom, Data));
|
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserSetProp, ret=%i\n",_ret_);
|
DPRINT("Leave NtUserSetProp, ret=%i\n",_ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
END_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -39,82 +39,82 @@ NTSTATUS INTERNAL_CALL
|
||||||
IntUserCreateSharedSectionPool(IN ULONG MaximumPoolSize,
|
IntUserCreateSharedSectionPool(IN ULONG MaximumPoolSize,
|
||||||
IN PSHARED_SECTION_POOL *SharedSectionPool)
|
IN PSHARED_SECTION_POOL *SharedSectionPool)
|
||||||
{
|
{
|
||||||
PSHARED_SECTION_POOL Pool;
|
PSHARED_SECTION_POOL Pool;
|
||||||
ULONG PoolStructSize;
|
ULONG PoolStructSize;
|
||||||
|
|
||||||
ASSERT(SharedSectionPool);
|
ASSERT(SharedSectionPool);
|
||||||
|
|
||||||
PoolStructSize = ROUND_UP(sizeof(SHARED_SECTION_POOL), PAGE_SIZE);
|
PoolStructSize = ROUND_UP(sizeof(SHARED_SECTION_POOL), PAGE_SIZE);
|
||||||
Pool = ExAllocatePoolWithTag(NonPagedPool,
|
Pool = ExAllocatePoolWithTag(NonPagedPool,
|
||||||
PoolStructSize,
|
PoolStructSize,
|
||||||
TAG_SSECTPOOL);
|
TAG_SSECTPOOL);
|
||||||
if(Pool != NULL)
|
if(Pool != NULL)
|
||||||
{
|
{
|
||||||
RtlZeroMemory(Pool, PoolStructSize);
|
RtlZeroMemory(Pool, PoolStructSize);
|
||||||
|
|
||||||
/* initialize the session heap */
|
/* initialize the session heap */
|
||||||
ExInitializeFastMutex(&Pool->Lock);
|
ExInitializeFastMutex(&Pool->Lock);
|
||||||
Pool->PoolSize = ROUND_UP(MaximumPoolSize, PAGE_SIZE);
|
Pool->PoolSize = ROUND_UP(MaximumPoolSize, PAGE_SIZE);
|
||||||
Pool->PoolFree = Pool->PoolSize;
|
Pool->PoolFree = Pool->PoolSize;
|
||||||
Pool->SharedSectionCount = 0;
|
Pool->SharedSectionCount = 0;
|
||||||
Pool->SectionsArray.Next = NULL;
|
Pool->SectionsArray.Next = NULL;
|
||||||
Pool->SectionsArray.nEntries = ((PoolStructSize - sizeof(SHARED_SECTION_POOL)) /
|
Pool->SectionsArray.nEntries = ((PoolStructSize - sizeof(SHARED_SECTION_POOL)) /
|
||||||
sizeof(SHARED_SECTION)) - 1;
|
sizeof(SHARED_SECTION)) - 1;
|
||||||
|
|
||||||
ASSERT(Pool->SectionsArray.nEntries > 0);
|
ASSERT(Pool->SectionsArray.nEntries > 0);
|
||||||
|
|
||||||
*SharedSectionPool = Pool;
|
*SharedSectionPool = Pool;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID INTERNAL_CALL
|
VOID INTERNAL_CALL
|
||||||
IntUserFreeSharedSectionPool(IN PSHARED_SECTION_POOL SharedSectionPool)
|
IntUserFreeSharedSectionPool(IN PSHARED_SECTION_POOL SharedSectionPool)
|
||||||
{
|
{
|
||||||
PSHARED_SECTIONS_ARRAY Array, OldArray;
|
PSHARED_SECTIONS_ARRAY Array, OldArray;
|
||||||
PSHARED_SECTION SharedSection, LastSharedSection;
|
PSHARED_SECTION SharedSection, LastSharedSection;
|
||||||
|
|
||||||
ASSERT(SharedSectionPool);
|
ASSERT(SharedSectionPool);
|
||||||
|
|
||||||
Array = &SharedSectionPool->SectionsArray;
|
Array = &SharedSectionPool->SectionsArray;
|
||||||
|
|
||||||
ExAcquireFastMutex(&SharedSectionPool->Lock);
|
ExAcquireFastMutex(&SharedSectionPool->Lock);
|
||||||
while(SharedSectionPool->SharedSectionCount > 0 && Array != NULL)
|
while(SharedSectionPool->SharedSectionCount > 0 && Array != NULL)
|
||||||
{
|
{
|
||||||
for(SharedSection = Array->SharedSection, LastSharedSection = SharedSection + Array->nEntries;
|
for(SharedSection = Array->SharedSection, LastSharedSection = SharedSection + Array->nEntries;
|
||||||
SharedSection != LastSharedSection && SharedSectionPool->SharedSectionCount > 0;
|
SharedSection != LastSharedSection && SharedSectionPool->SharedSectionCount > 0;
|
||||||
SharedSection++)
|
SharedSection++)
|
||||||
{
|
|
||||||
if(SharedSection->SectionObject != NULL)
|
|
||||||
{
|
{
|
||||||
ASSERT(SharedSection->SystemMappedBase);
|
if(SharedSection->SectionObject != NULL)
|
||||||
|
{
|
||||||
|
ASSERT(SharedSection->SystemMappedBase);
|
||||||
|
|
||||||
/* FIXME - use MmUnmapViewInSessionSpace() once implemented! */
|
/* FIXME - use MmUnmapViewInSessionSpace() once implemented! */
|
||||||
MmUnmapViewInSystemSpace(SharedSection->SystemMappedBase);
|
MmUnmapViewInSystemSpace(SharedSection->SystemMappedBase);
|
||||||
/* dereference the keep-alive reference so the section get's deleted */
|
/* dereference the keep-alive reference so the section get's deleted */
|
||||||
ObDereferenceObject(SharedSection->SectionObject);
|
ObDereferenceObject(SharedSection->SectionObject);
|
||||||
|
|
||||||
SharedSectionPool->SharedSectionCount--;
|
SharedSectionPool->SharedSectionCount--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
OldArray = Array;
|
OldArray = Array;
|
||||||
Array = Array->Next;
|
Array = Array->Next;
|
||||||
|
|
||||||
/* all shared sections in this array were freed, link the following array to
|
/* all shared sections in this array were freed, link the following array to
|
||||||
the main session heap and free this array */
|
the main session heap and free this array */
|
||||||
SharedSectionPool->SectionsArray.Next = Array;
|
SharedSectionPool->SectionsArray.Next = Array;
|
||||||
ExFreePool(OldArray);
|
ExFreePool(OldArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(SharedSectionPool->SectionsArray.Next == NULL);
|
ASSERT(SharedSectionPool->SectionsArray.Next == NULL);
|
||||||
ASSERT(SharedSectionPool->SharedSectionCount == 0);
|
ASSERT(SharedSectionPool->SharedSectionCount == 0);
|
||||||
|
|
||||||
ExReleaseFastMutex(&SharedSectionPool->Lock);
|
ExReleaseFastMutex(&SharedSectionPool->Lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,120 +123,120 @@ IntUserCreateSharedSection(IN PSHARED_SECTION_POOL SharedSectionPool,
|
||||||
IN OUT PVOID *SystemMappedBase,
|
IN OUT PVOID *SystemMappedBase,
|
||||||
IN OUT ULONG *SharedSectionSize)
|
IN OUT ULONG *SharedSectionSize)
|
||||||
{
|
{
|
||||||
PSHARED_SECTIONS_ARRAY Array, LastArray;
|
PSHARED_SECTIONS_ARRAY Array, LastArray;
|
||||||
PSHARED_SECTION FreeSharedSection, SharedSection, LastSharedSection;
|
PSHARED_SECTION FreeSharedSection, SharedSection, LastSharedSection;
|
||||||
LARGE_INTEGER SectionSize;
|
LARGE_INTEGER SectionSize;
|
||||||
ULONG Size;
|
ULONG Size;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
ASSERT(SharedSectionPool && SharedSectionSize && (*SharedSectionSize) > 0 && SystemMappedBase);
|
ASSERT(SharedSectionPool && SharedSectionSize && (*SharedSectionSize) > 0 && SystemMappedBase);
|
||||||
|
|
||||||
FreeSharedSection = NULL;
|
FreeSharedSection = NULL;
|
||||||
|
|
||||||
Size = ROUND_UP(*SharedSectionSize, PAGE_SIZE);
|
Size = ROUND_UP(*SharedSectionSize, PAGE_SIZE);
|
||||||
|
|
||||||
ExAcquireFastMutex(&SharedSectionPool->Lock);
|
ExAcquireFastMutex(&SharedSectionPool->Lock);
|
||||||
|
|
||||||
if(Size > SharedSectionPool->PoolFree)
|
if(Size > SharedSectionPool->PoolFree)
|
||||||
{
|
{
|
||||||
ExReleaseFastMutex(&SharedSectionPool->Lock);
|
|
||||||
DPRINT1("Shared Section Pool limit (0x%x KB) reached, attempted to allocate a 0x%x KB shared section!\n",
|
|
||||||
SharedSectionPool->PoolSize / 1024, (*SharedSectionSize) / 1024);
|
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* walk the array to find a free entry */
|
|
||||||
for(Array = &SharedSectionPool->SectionsArray, LastArray = Array;
|
|
||||||
Array != NULL && FreeSharedSection == NULL;
|
|
||||||
Array = Array->Next)
|
|
||||||
{
|
|
||||||
LastArray = Array;
|
|
||||||
|
|
||||||
for(SharedSection = Array->SharedSection, LastSharedSection = SharedSection + Array->nEntries;
|
|
||||||
SharedSection != LastSharedSection;
|
|
||||||
SharedSection++)
|
|
||||||
{
|
|
||||||
if(SharedSection->SectionObject == NULL)
|
|
||||||
{
|
|
||||||
FreeSharedSection = SharedSection;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Array->Next != NULL)
|
|
||||||
{
|
|
||||||
LastArray = Array;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT(LastArray);
|
|
||||||
|
|
||||||
if(FreeSharedSection == NULL)
|
|
||||||
{
|
|
||||||
ULONG nNewEntries;
|
|
||||||
PSHARED_SECTIONS_ARRAY NewArray;
|
|
||||||
|
|
||||||
ASSERT(LastArray->Next == NULL);
|
|
||||||
|
|
||||||
/* couldn't find a free entry in the array, extend the array */
|
|
||||||
|
|
||||||
nNewEntries = ((PAGE_SIZE - sizeof(SHARED_SECTIONS_ARRAY)) / sizeof(SHARED_SECTION)) + 1;
|
|
||||||
NewArray = ExAllocatePoolWithTag(NonPagedPool,
|
|
||||||
sizeof(SHARED_SECTIONS_ARRAY) + ((nNewEntries - 1) *
|
|
||||||
sizeof(SHARED_SECTION)),
|
|
||||||
TAG_SSECTPOOL);
|
|
||||||
if(NewArray == NULL)
|
|
||||||
{
|
|
||||||
ExReleaseFastMutex(&SharedSectionPool->Lock);
|
ExReleaseFastMutex(&SharedSectionPool->Lock);
|
||||||
DPRINT1("Failed to allocate new array for shared sections!\n");
|
DPRINT1("Shared Section Pool limit (0x%x KB) reached, attempted to allocate a 0x%x KB shared section!\n",
|
||||||
|
SharedSectionPool->PoolSize / 1024, (*SharedSectionSize) / 1024);
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
NewArray->nEntries = nNewEntries;
|
/* walk the array to find a free entry */
|
||||||
NewArray->Next = NULL;
|
for(Array = &SharedSectionPool->SectionsArray, LastArray = Array;
|
||||||
LastArray->Next = NewArray;
|
Array != NULL && FreeSharedSection == NULL;
|
||||||
|
Array = Array->Next)
|
||||||
|
{
|
||||||
|
LastArray = Array;
|
||||||
|
|
||||||
Array = NewArray;
|
for(SharedSection = Array->SharedSection, LastSharedSection = SharedSection + Array->nEntries;
|
||||||
FreeSharedSection = &Array->SharedSection[0];
|
SharedSection != LastSharedSection;
|
||||||
}
|
SharedSection++)
|
||||||
|
{
|
||||||
|
if(SharedSection->SectionObject == NULL)
|
||||||
|
{
|
||||||
|
FreeSharedSection = SharedSection;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ASSERT(FreeSharedSection);
|
if(Array->Next != NULL)
|
||||||
|
{
|
||||||
|
LastArray = Array;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* now allocate a real section */
|
ASSERT(LastArray);
|
||||||
|
|
||||||
SectionSize.QuadPart = Size;
|
if(FreeSharedSection == NULL)
|
||||||
Status = MmCreateSection(&FreeSharedSection->SectionObject,
|
{
|
||||||
SECTION_ALL_ACCESS,
|
ULONG nNewEntries;
|
||||||
NULL,
|
PSHARED_SECTIONS_ARRAY NewArray;
|
||||||
&SectionSize,
|
|
||||||
PAGE_EXECUTE_READWRITE,
|
|
||||||
SEC_COMMIT,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
if(NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
Status = MmMapViewInSystemSpace(FreeSharedSection->SectionObject,
|
|
||||||
&FreeSharedSection->SystemMappedBase,
|
|
||||||
&FreeSharedSection->ViewSize);
|
|
||||||
if(NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
(*SharedSectionSize) -= Size;
|
|
||||||
SharedSectionPool->SharedSectionCount++;
|
|
||||||
|
|
||||||
*SystemMappedBase = FreeSharedSection->SystemMappedBase;
|
ASSERT(LastArray->Next == NULL);
|
||||||
*SharedSectionSize = FreeSharedSection->ViewSize;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ObDereferenceObject(FreeSharedSection->SectionObject);
|
|
||||||
FreeSharedSection->SectionObject = NULL;
|
|
||||||
DPRINT1("Failed to map the shared section into system space! Status 0x%x\n", Status);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ExReleaseFastMutex(&SharedSectionPool->Lock);
|
/* couldn't find a free entry in the array, extend the array */
|
||||||
|
|
||||||
return Status;
|
nNewEntries = ((PAGE_SIZE - sizeof(SHARED_SECTIONS_ARRAY)) / sizeof(SHARED_SECTION)) + 1;
|
||||||
|
NewArray = ExAllocatePoolWithTag(NonPagedPool,
|
||||||
|
sizeof(SHARED_SECTIONS_ARRAY) + ((nNewEntries - 1) *
|
||||||
|
sizeof(SHARED_SECTION)),
|
||||||
|
TAG_SSECTPOOL);
|
||||||
|
if(NewArray == NULL)
|
||||||
|
{
|
||||||
|
ExReleaseFastMutex(&SharedSectionPool->Lock);
|
||||||
|
DPRINT1("Failed to allocate new array for shared sections!\n");
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
NewArray->nEntries = nNewEntries;
|
||||||
|
NewArray->Next = NULL;
|
||||||
|
LastArray->Next = NewArray;
|
||||||
|
|
||||||
|
Array = NewArray;
|
||||||
|
FreeSharedSection = &Array->SharedSection[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
ASSERT(FreeSharedSection);
|
||||||
|
|
||||||
|
/* now allocate a real section */
|
||||||
|
|
||||||
|
SectionSize.QuadPart = Size;
|
||||||
|
Status = MmCreateSection(&FreeSharedSection->SectionObject,
|
||||||
|
SECTION_ALL_ACCESS,
|
||||||
|
NULL,
|
||||||
|
&SectionSize,
|
||||||
|
PAGE_EXECUTE_READWRITE,
|
||||||
|
SEC_COMMIT,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
if(NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
Status = MmMapViewInSystemSpace(FreeSharedSection->SectionObject,
|
||||||
|
&FreeSharedSection->SystemMappedBase,
|
||||||
|
&FreeSharedSection->ViewSize);
|
||||||
|
if(NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
(*SharedSectionSize) -= Size;
|
||||||
|
SharedSectionPool->SharedSectionCount++;
|
||||||
|
|
||||||
|
*SystemMappedBase = FreeSharedSection->SystemMappedBase;
|
||||||
|
*SharedSectionSize = FreeSharedSection->ViewSize;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ObDereferenceObject(FreeSharedSection->SectionObject);
|
||||||
|
FreeSharedSection->SectionObject = NULL;
|
||||||
|
DPRINT1("Failed to map the shared section into system space! Status 0x%x\n", Status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ExReleaseFastMutex(&SharedSectionPool->Lock);
|
||||||
|
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -244,52 +244,52 @@ NTSTATUS INTERNAL_CALL
|
||||||
InUserDeleteSharedSection(PSHARED_SECTION_POOL SharedSectionPool,
|
InUserDeleteSharedSection(PSHARED_SECTION_POOL SharedSectionPool,
|
||||||
PVOID SystemMappedBase)
|
PVOID SystemMappedBase)
|
||||||
{
|
{
|
||||||
PSHARED_SECTIONS_ARRAY Array;
|
PSHARED_SECTIONS_ARRAY Array;
|
||||||
PSECTION_OBJECT SectionObject;
|
PSECTION_OBJECT SectionObject;
|
||||||
PSHARED_SECTION SharedSection, LastSharedSection;
|
PSHARED_SECTION SharedSection, LastSharedSection;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
ASSERT(SharedSectionPool && SystemMappedBase);
|
ASSERT(SharedSectionPool && SystemMappedBase);
|
||||||
|
|
||||||
SectionObject = NULL;
|
SectionObject = NULL;
|
||||||
|
|
||||||
ExAcquireFastMutex(&SharedSectionPool->Lock);
|
ExAcquireFastMutex(&SharedSectionPool->Lock);
|
||||||
|
|
||||||
for(Array = &SharedSectionPool->SectionsArray;
|
for(Array = &SharedSectionPool->SectionsArray;
|
||||||
Array != NULL && SectionObject == NULL;
|
Array != NULL && SectionObject == NULL;
|
||||||
Array = Array->Next)
|
Array = Array->Next)
|
||||||
{
|
{
|
||||||
for(SharedSection = Array->SharedSection, LastSharedSection = SharedSection + Array->nEntries;
|
for(SharedSection = Array->SharedSection, LastSharedSection = SharedSection + Array->nEntries;
|
||||||
SharedSection != LastSharedSection;
|
SharedSection != LastSharedSection;
|
||||||
SharedSection++)
|
SharedSection++)
|
||||||
{
|
|
||||||
if(SharedSection->SystemMappedBase == SystemMappedBase)
|
|
||||||
{
|
{
|
||||||
SectionObject = SharedSection->SectionObject;
|
if(SharedSection->SystemMappedBase == SystemMappedBase)
|
||||||
SharedSection->SectionObject = NULL;
|
{
|
||||||
SharedSection->SystemMappedBase = NULL;
|
SectionObject = SharedSection->SectionObject;
|
||||||
|
SharedSection->SectionObject = NULL;
|
||||||
|
SharedSection->SystemMappedBase = NULL;
|
||||||
|
|
||||||
ASSERT(SharedSectionPool->SharedSectionCount > 0);
|
ASSERT(SharedSectionPool->SharedSectionCount > 0);
|
||||||
SharedSectionPool->SharedSectionCount--;
|
SharedSectionPool->SharedSectionCount--;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ExReleaseFastMutex(&SharedSectionPool->Lock);
|
ExReleaseFastMutex(&SharedSectionPool->Lock);
|
||||||
|
|
||||||
if(SectionObject != NULL)
|
if(SectionObject != NULL)
|
||||||
{
|
{
|
||||||
Status = MmUnmapViewInSystemSpace(SystemMappedBase);
|
Status = MmUnmapViewInSystemSpace(SystemMappedBase);
|
||||||
ObDereferenceObject(SectionObject);
|
ObDereferenceObject(SectionObject);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINT1("Couldn't find and delete a shared section with SystemMappedBase=0x%x!\n", SystemMappedBase);
|
DPRINT1("Couldn't find and delete a shared section with SystemMappedBase=0x%x!\n", SystemMappedBase);
|
||||||
Status = STATUS_UNSUCCESSFUL;
|
Status = STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -302,67 +302,67 @@ IntUserMapSharedSection(IN PSHARED_SECTION_POOL SharedSectionPool,
|
||||||
IN PULONG ViewSize OPTIONAL,
|
IN PULONG ViewSize OPTIONAL,
|
||||||
IN BOOLEAN ReadOnly)
|
IN BOOLEAN ReadOnly)
|
||||||
{
|
{
|
||||||
PSHARED_SECTIONS_ARRAY Array;
|
PSHARED_SECTIONS_ARRAY Array;
|
||||||
PSECTION_OBJECT SectionObject;
|
PSECTION_OBJECT SectionObject;
|
||||||
PSHARED_SECTION SharedSection, LastSharedSection;
|
PSHARED_SECTION SharedSection, LastSharedSection;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
ASSERT(SharedSectionPool && Process && SystemMappedBase && UserMappedBase);
|
ASSERT(SharedSectionPool && Process && SystemMappedBase && UserMappedBase);
|
||||||
|
|
||||||
SectionObject = NULL;
|
SectionObject = NULL;
|
||||||
SharedSection = NULL;
|
SharedSection = NULL;
|
||||||
|
|
||||||
ExAcquireFastMutex(&SharedSectionPool->Lock);
|
ExAcquireFastMutex(&SharedSectionPool->Lock);
|
||||||
|
|
||||||
for(Array = &SharedSectionPool->SectionsArray;
|
for(Array = &SharedSectionPool->SectionsArray;
|
||||||
Array != NULL && SectionObject == NULL;
|
Array != NULL && SectionObject == NULL;
|
||||||
Array = Array->Next)
|
Array = Array->Next)
|
||||||
{
|
{
|
||||||
for(SharedSection = Array->SharedSection, LastSharedSection = SharedSection + Array->nEntries;
|
for(SharedSection = Array->SharedSection, LastSharedSection = SharedSection + Array->nEntries;
|
||||||
SharedSection != LastSharedSection;
|
SharedSection != LastSharedSection;
|
||||||
SharedSection++)
|
SharedSection++)
|
||||||
{
|
|
||||||
if(SharedSection->SystemMappedBase == SystemMappedBase)
|
|
||||||
{
|
{
|
||||||
SectionObject = SharedSection->SectionObject;
|
if(SharedSection->SystemMappedBase == SystemMappedBase)
|
||||||
break;
|
{
|
||||||
|
SectionObject = SharedSection->SectionObject;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(SectionObject != NULL)
|
if(SectionObject != NULL)
|
||||||
{
|
{
|
||||||
ULONG RealViewSize = (ViewSize ? min(*ViewSize, SharedSection->ViewSize) : SharedSection->ViewSize);
|
ULONG RealViewSize = (ViewSize ? min(*ViewSize, SharedSection->ViewSize) : SharedSection->ViewSize);
|
||||||
|
|
||||||
ObReferenceObjectByPointer(SectionObject,
|
ObReferenceObjectByPointer(SectionObject,
|
||||||
(ReadOnly ? SECTION_MAP_READ : SECTION_MAP_READ | SECTION_MAP_WRITE),
|
(ReadOnly ? SECTION_MAP_READ : SECTION_MAP_READ | SECTION_MAP_WRITE),
|
||||||
NULL,
|
NULL,
|
||||||
KernelMode);
|
KernelMode);
|
||||||
|
|
||||||
Status = MmMapViewOfSection(SectionObject,
|
Status = MmMapViewOfSection(SectionObject,
|
||||||
Process,
|
Process,
|
||||||
UserMappedBase,
|
UserMappedBase,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
SectionOffset,
|
SectionOffset,
|
||||||
&RealViewSize,
|
&RealViewSize,
|
||||||
ViewUnmap, /* not sure if we should inherit it... */
|
ViewUnmap, /* not sure if we should inherit it... */
|
||||||
MEM_COMMIT,
|
MEM_COMMIT,
|
||||||
(ReadOnly ? PAGE_READONLY : PAGE_READWRITE));
|
(ReadOnly ? PAGE_READONLY : PAGE_READWRITE));
|
||||||
if(!NT_SUCCESS(Status))
|
if(!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to map shared section (readonly=%d) into user memory! Status: 0x%x\n", ReadOnly, Status);
|
DPRINT1("Failed to map shared section (readonly=%d) into user memory! Status: 0x%x\n", ReadOnly, Status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINT1("Couldn't find and map a shared section with SystemMappedBase=0x%x!\n", SystemMappedBase);
|
DPRINT1("Couldn't find and map a shared section with SystemMappedBase=0x%x!\n", SystemMappedBase);
|
||||||
Status = STATUS_UNSUCCESSFUL;
|
Status = STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExReleaseFastMutex(&SharedSectionPool->Lock);
|
ExReleaseFastMutex(&SharedSectionPool->Lock);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -372,50 +372,50 @@ IntUserUnMapSharedSection(IN PSHARED_SECTION_POOL SharedSectionPool,
|
||||||
IN PVOID SystemMappedBase,
|
IN PVOID SystemMappedBase,
|
||||||
IN PVOID UserMappedBase)
|
IN PVOID UserMappedBase)
|
||||||
{
|
{
|
||||||
PSHARED_SECTIONS_ARRAY Array;
|
PSHARED_SECTIONS_ARRAY Array;
|
||||||
PSECTION_OBJECT SectionObject;
|
PSECTION_OBJECT SectionObject;
|
||||||
PSHARED_SECTION SharedSection, LastSharedSection;
|
PSHARED_SECTION SharedSection, LastSharedSection;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
ASSERT(SharedSectionPool && Process && SystemMappedBase && UserMappedBase);
|
ASSERT(SharedSectionPool && Process && SystemMappedBase && UserMappedBase);
|
||||||
|
|
||||||
SectionObject = NULL;
|
SectionObject = NULL;
|
||||||
|
|
||||||
ExAcquireFastMutex(&SharedSectionPool->Lock);
|
ExAcquireFastMutex(&SharedSectionPool->Lock);
|
||||||
|
|
||||||
for(Array = &SharedSectionPool->SectionsArray;
|
for(Array = &SharedSectionPool->SectionsArray;
|
||||||
Array != NULL && SectionObject == NULL;
|
Array != NULL && SectionObject == NULL;
|
||||||
Array = Array->Next)
|
Array = Array->Next)
|
||||||
{
|
{
|
||||||
for(SharedSection = Array->SharedSection, LastSharedSection = SharedSection + Array->nEntries;
|
for(SharedSection = Array->SharedSection, LastSharedSection = SharedSection + Array->nEntries;
|
||||||
SharedSection != LastSharedSection;
|
SharedSection != LastSharedSection;
|
||||||
SharedSection++)
|
SharedSection++)
|
||||||
{
|
|
||||||
if(SharedSection->SystemMappedBase == SystemMappedBase)
|
|
||||||
{
|
{
|
||||||
SectionObject = SharedSection->SectionObject;
|
if(SharedSection->SystemMappedBase == SystemMappedBase)
|
||||||
break;
|
{
|
||||||
|
SectionObject = SharedSection->SectionObject;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ExReleaseFastMutex(&SharedSectionPool->Lock);
|
ExReleaseFastMutex(&SharedSectionPool->Lock);
|
||||||
|
|
||||||
if(SectionObject != NULL)
|
if(SectionObject != NULL)
|
||||||
{
|
{
|
||||||
Status = MmUnmapViewOfSection(Process,
|
Status = MmUnmapViewOfSection(Process,
|
||||||
UserMappedBase);
|
UserMappedBase);
|
||||||
ObDereferenceObject(SectionObject);
|
ObDereferenceObject(SectionObject);
|
||||||
if(!NT_SUCCESS(Status))
|
if(!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to unmap shared section UserMappedBase=0x%x! Status: 0x%x\n", UserMappedBase, Status);
|
DPRINT1("Failed to unmap shared section UserMappedBase=0x%x! Status: 0x%x\n", UserMappedBase, Status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINT1("Couldn't find and unmap a shared section with SystemMappedBase=0x%x!\n", SystemMappedBase);
|
DPRINT1("Couldn't find and unmap a shared section with SystemMappedBase=0x%x!\n", SystemMappedBase);
|
||||||
Status = STATUS_UNSUCCESSFUL;
|
Status = STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -58,110 +58,110 @@ static ULONG HintIndex = 0;
|
||||||
UINT_PTR FASTCALL
|
UINT_PTR FASTCALL
|
||||||
IntSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL SystemTimer)
|
IntSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL SystemTimer)
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT WindowObject;
|
PWINDOW_OBJECT WindowObject;
|
||||||
UINT_PTR Ret = 0;
|
UINT_PTR Ret = 0;
|
||||||
|
|
||||||
DPRINT("IntSetTimer wnd %x id %p elapse %u timerproc %p systemtimer %s\n",
|
DPRINT("IntSetTimer wnd %x id %p elapse %u timerproc %p systemtimer %s\n",
|
||||||
Wnd, IDEvent, Elapse, TimerFunc, SystemTimer ? "TRUE" : "FALSE");
|
Wnd, IDEvent, Elapse, TimerFunc, SystemTimer ? "TRUE" : "FALSE");
|
||||||
|
|
||||||
if ((Wnd == NULL) && ! SystemTimer)
|
if ((Wnd == NULL) && ! SystemTimer)
|
||||||
{
|
{
|
||||||
DPRINT("Window-less timer\n");
|
DPRINT("Window-less timer\n");
|
||||||
/* find a free, window-less timer id */
|
/* find a free, window-less timer id */
|
||||||
IntLockWindowlessTimerBitmap();
|
IntLockWindowlessTimerBitmap();
|
||||||
IDEvent = RtlFindClearBitsAndSet(&WindowLessTimersBitMap, 1, HintIndex);
|
IDEvent = RtlFindClearBitsAndSet(&WindowLessTimersBitMap, 1, HintIndex);
|
||||||
|
|
||||||
if (IDEvent == (UINT_PTR) -1)
|
if (IDEvent == (UINT_PTR) -1)
|
||||||
{
|
{
|
||||||
IntUnlockWindowlessTimerBitmap();
|
IntUnlockWindowlessTimerBitmap();
|
||||||
DPRINT1("Unable to find a free window-less timer id\n");
|
DPRINT1("Unable to find a free window-less timer id\n");
|
||||||
SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
|
SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
HintIndex = ++IDEvent;
|
HintIndex = ++IDEvent;
|
||||||
IntUnlockWindowlessTimerBitmap();
|
IntUnlockWindowlessTimerBitmap();
|
||||||
Ret = IDEvent;
|
Ret = IDEvent;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WindowObject = IntGetWindowObject(Wnd);
|
WindowObject = IntGetWindowObject(Wnd);
|
||||||
if (! WindowObject)
|
if (! WindowObject)
|
||||||
{
|
{
|
||||||
DPRINT1("Invalid window handle\n");
|
DPRINT1("Invalid window handle\n");
|
||||||
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WindowObject->OwnerThread->ThreadsProcess != PsGetCurrentProcess())
|
if (WindowObject->OwnerThread->ThreadsProcess != PsGetCurrentProcess())
|
||||||
{
|
{
|
||||||
IntReleaseWindowObject(WindowObject);
|
IntReleaseWindowObject(WindowObject);
|
||||||
DPRINT1("Trying to set timer for window in another process (shatter attack?)\n");
|
DPRINT1("Trying to set timer for window in another process (shatter attack?)\n");
|
||||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
IntReleaseWindowObject(WindowObject);
|
IntReleaseWindowObject(WindowObject);
|
||||||
Ret = IDEvent;
|
Ret = IDEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
|
|
||||||
/* Win NT/2k/XP */
|
/* Win NT/2k/XP */
|
||||||
if (Elapse > 0x7fffffff)
|
if (Elapse > 0x7fffffff)
|
||||||
{
|
{
|
||||||
DPRINT("Adjusting uElapse\n");
|
DPRINT("Adjusting uElapse\n");
|
||||||
Elapse = 1;
|
Elapse = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* Win Server 2003 */
|
/* Win Server 2003 */
|
||||||
if (Elapse > 0x7fffffff)
|
if (Elapse > 0x7fffffff)
|
||||||
{
|
{
|
||||||
DPRINT("Adjusting uElapse\n");
|
DPRINT("Adjusting uElapse\n");
|
||||||
Elapse = 0x7fffffff;
|
Elapse = 0x7fffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Win 2k/XP */
|
/* Win 2k/XP */
|
||||||
if (Elapse < 10)
|
if (Elapse < 10)
|
||||||
{
|
{
|
||||||
DPRINT("Adjusting uElapse\n");
|
DPRINT("Adjusting uElapse\n");
|
||||||
Elapse = 10;
|
Elapse = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! MsqSetTimer(PsGetWin32Thread()->MessageQueue, Wnd,
|
if (! MsqSetTimer(PsGetWin32Thread()->MessageQueue, Wnd,
|
||||||
IDEvent, Elapse, TimerFunc,
|
IDEvent, Elapse, TimerFunc,
|
||||||
SystemTimer ? WM_SYSTIMER : WM_TIMER))
|
SystemTimer ? WM_SYSTIMER : WM_TIMER))
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to set timer in message queue\n");
|
DPRINT1("Failed to set timer in message queue\n");
|
||||||
SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
|
SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
IntKillTimer(HWND Wnd, UINT_PTR IDEvent, BOOL SystemTimer)
|
IntKillTimer(HWND Wnd, UINT_PTR IDEvent, BOOL SystemTimer)
|
||||||
{
|
{
|
||||||
DPRINT("IntKillTimer wnd %x id %p systemtimer %s\n",
|
DPRINT("IntKillTimer wnd %x id %p systemtimer %s\n",
|
||||||
Wnd, IDEvent, SystemTimer ? "TRUE" : "FALSE");
|
Wnd, IDEvent, SystemTimer ? "TRUE" : "FALSE");
|
||||||
|
|
||||||
if (! MsqKillTimer(PsGetWin32Thread()->MessageQueue, Wnd,
|
if (! MsqKillTimer(PsGetWin32Thread()->MessageQueue, Wnd,
|
||||||
IDEvent, SystemTimer ? WM_SYSTIMER : WM_TIMER))
|
IDEvent, SystemTimer ? WM_SYSTIMER : WM_TIMER))
|
||||||
{
|
{
|
||||||
DPRINT1("Unable to locate timer in message queue\n");
|
DPRINT1("Unable to locate timer in message queue\n");
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* window-less timer? */
|
/* window-less timer? */
|
||||||
if ((Wnd == NULL) && ! SystemTimer)
|
if ((Wnd == NULL) && ! SystemTimer)
|
||||||
{
|
{
|
||||||
/* Release the id */
|
/* Release the id */
|
||||||
IntLockWindowlessTimerBitmap();
|
IntLockWindowlessTimerBitmap();
|
||||||
|
|
||||||
|
@ -169,28 +169,28 @@ IntKillTimer(HWND Wnd, UINT_PTR IDEvent, BOOL SystemTimer)
|
||||||
RtlClearBits(&WindowLessTimersBitMap, IDEvent - 1, 1);
|
RtlClearBits(&WindowLessTimersBitMap, IDEvent - 1, 1);
|
||||||
|
|
||||||
IntUnlockWindowlessTimerBitmap();
|
IntUnlockWindowlessTimerBitmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
InitTimerImpl(VOID)
|
InitTimerImpl(VOID)
|
||||||
{
|
{
|
||||||
ULONG BitmapBytes;
|
ULONG BitmapBytes;
|
||||||
|
|
||||||
ExInitializeFastMutex(&Mutex);
|
ExInitializeFastMutex(&Mutex);
|
||||||
|
|
||||||
BitmapBytes = ROUND_UP(NUM_WINDOW_LESS_TIMERS, sizeof(ULONG) * 8) / 8;
|
BitmapBytes = ROUND_UP(NUM_WINDOW_LESS_TIMERS, sizeof(ULONG) * 8) / 8;
|
||||||
WindowLessTimersBitMapBuffer = ExAllocatePoolWithTag(PagedPool, BitmapBytes, TAG_TIMERBMP);
|
WindowLessTimersBitMapBuffer = ExAllocatePoolWithTag(PagedPool, BitmapBytes, TAG_TIMERBMP);
|
||||||
RtlInitializeBitMap(&WindowLessTimersBitMap,
|
RtlInitializeBitMap(&WindowLessTimersBitMap,
|
||||||
WindowLessTimersBitMapBuffer,
|
WindowLessTimersBitMapBuffer,
|
||||||
BitmapBytes * 8);
|
BitmapBytes * 8);
|
||||||
|
|
||||||
/* yes we need this, since ExAllocatePool isn't supposed to zero out allocated memory */
|
/* yes we need this, since ExAllocatePool isn't supposed to zero out allocated memory */
|
||||||
RtlClearAllBits(&WindowLessTimersBitMap);
|
RtlClearAllBits(&WindowLessTimersBitMap);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -198,19 +198,19 @@ UINT_PTR
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserSetTimer
|
NtUserSetTimer
|
||||||
(
|
(
|
||||||
HWND hWnd,
|
HWND hWnd,
|
||||||
UINT_PTR nIDEvent,
|
UINT_PTR nIDEvent,
|
||||||
UINT uElapse,
|
UINT uElapse,
|
||||||
TIMERPROC lpTimerFunc
|
TIMERPROC lpTimerFunc
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DECLARE_RETURN(UINT_PTR);
|
DECLARE_RETURN(UINT_PTR);
|
||||||
|
|
||||||
DPRINT("Enter NtUserSetTimer\n");
|
DPRINT("Enter NtUserSetTimer\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
RETURN(IntSetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc, FALSE));
|
RETURN(IntSetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc, FALSE));
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserSetTimer, ret=%i\n", _ret_);
|
DPRINT("Leave NtUserSetTimer, ret=%i\n", _ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
|
@ -222,17 +222,17 @@ BOOL
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserKillTimer
|
NtUserKillTimer
|
||||||
(
|
(
|
||||||
HWND hWnd,
|
HWND hWnd,
|
||||||
UINT_PTR uIDEvent
|
UINT_PTR uIDEvent
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DECLARE_RETURN(BOOL);
|
DECLARE_RETURN(BOOL);
|
||||||
|
|
||||||
DPRINT("Enter NtUserKillTimer\n");
|
DPRINT("Enter NtUserKillTimer\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
RETURN(IntKillTimer(hWnd, uIDEvent, FALSE));
|
RETURN(IntKillTimer(hWnd, uIDEvent, FALSE));
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserKillTimer, ret=%i\n", _ret_);
|
DPRINT("Leave NtUserKillTimer, ret=%i\n", _ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
|
@ -243,19 +243,19 @@ CLEANUP:
|
||||||
UINT_PTR
|
UINT_PTR
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserSetSystemTimer(
|
NtUserSetSystemTimer(
|
||||||
HWND hWnd,
|
HWND hWnd,
|
||||||
UINT_PTR nIDEvent,
|
UINT_PTR nIDEvent,
|
||||||
UINT uElapse,
|
UINT uElapse,
|
||||||
TIMERPROC lpTimerFunc
|
TIMERPROC lpTimerFunc
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DECLARE_RETURN(UINT_PTR);
|
DECLARE_RETURN(UINT_PTR);
|
||||||
|
|
||||||
DPRINT("Enter NtUserSetSystemTimer\n");
|
DPRINT("Enter NtUserSetSystemTimer\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
RETURN(IntSetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc, TRUE));
|
RETURN(IntSetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc, TRUE));
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserSetSystemTimer, ret=%i\n", _ret_);
|
DPRINT("Leave NtUserSetSystemTimer, ret=%i\n", _ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
|
@ -266,17 +266,17 @@ CLEANUP:
|
||||||
BOOL
|
BOOL
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserKillSystemTimer(
|
NtUserKillSystemTimer(
|
||||||
HWND hWnd,
|
HWND hWnd,
|
||||||
UINT_PTR uIDEvent
|
UINT_PTR uIDEvent
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DECLARE_RETURN(BOOL);
|
DECLARE_RETURN(BOOL);
|
||||||
|
|
||||||
DPRINT("Enter NtUserKillSystemTimer\n");
|
DPRINT("Enter NtUserKillSystemTimer\n");
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
RETURN(IntKillTimer(hWnd, uIDEvent, TRUE));
|
RETURN(IntKillTimer(hWnd, uIDEvent, TRUE));
|
||||||
|
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
DPRINT("Leave NtUserKillSystemTimer, ret=%i\n", _ret_);
|
DPRINT("Leave NtUserKillSystemTimer, ret=%i\n", _ret_);
|
||||||
UserLeave();
|
UserLeave();
|
||||||
|
|
|
@ -43,7 +43,7 @@ IntAddAtom(LPWSTR AtomName)
|
||||||
}
|
}
|
||||||
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
||||||
Status = RtlAddAtomToAtomTable(WinStaObject->AtomTable,
|
Status = RtlAddAtomToAtomTable(WinStaObject->AtomTable,
|
||||||
AtomName, &Atom);
|
AtomName, &Atom);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
|
@ -66,7 +66,7 @@ IntGetAtomName(RTL_ATOM nAtom, LPWSTR lpBuffer, ULONG nSize)
|
||||||
}
|
}
|
||||||
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
WinStaObject = PsGetWin32Thread()->Desktop->WindowStation;
|
||||||
Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable,
|
Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable,
|
||||||
nAtom, NULL, NULL, lpBuffer, &Size);
|
nAtom, NULL, NULL, lpBuffer, &Size);
|
||||||
if (Size < nSize)
|
if (Size < nSize)
|
||||||
*(lpBuffer + Size) = 0;
|
*(lpBuffer + Size) = 0;
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
|
|
@ -50,12 +50,12 @@ VIS_ComputeVisibleRegion(
|
||||||
{
|
{
|
||||||
if(!(ClipRgn = VIS_ComputeVisibleRegion(Window, FALSE, ClipChildren, ClipSiblings)))
|
if(!(ClipRgn = VIS_ComputeVisibleRegion(Window, FALSE, ClipChildren, ClipSiblings)))
|
||||||
{
|
{
|
||||||
return NtGdiCreateRectRgn(0, 0, 0, 0);
|
return NtGdiCreateRectRgn(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
if(!(VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect)))
|
if(!(VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect)))
|
||||||
{
|
{
|
||||||
NtGdiDeleteObject(VisRgn);
|
NtGdiDeleteObject(VisRgn);
|
||||||
return NtGdiCreateRectRgn(0, 0, 0, 0);
|
return NtGdiCreateRectRgn(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
LeftOffset = Window->ClientRect.left - Window->WindowRect.left;
|
LeftOffset = Window->ClientRect.left - Window->WindowRect.left;
|
||||||
TopOffset = Window->ClientRect.top - Window->WindowRect.top;
|
TopOffset = Window->ClientRect.top - Window->WindowRect.top;
|
||||||
|
@ -90,7 +90,7 @@ VIS_ComputeVisibleRegion(
|
||||||
NtGdiDeleteObject(ClipRgn);
|
NtGdiDeleteObject(ClipRgn);
|
||||||
|
|
||||||
if ((PreviousWindow->Style & WS_CLIPSIBLINGS) ||
|
if ((PreviousWindow->Style & WS_CLIPSIBLINGS) ||
|
||||||
(PreviousWindow == Window && ClipSiblings))
|
(PreviousWindow == Window && ClipSiblings))
|
||||||
{
|
{
|
||||||
CurrentSibling = CurrentWindow->FirstChild;
|
CurrentSibling = CurrentWindow->FirstChild;
|
||||||
while (CurrentSibling != NULL && CurrentSibling != PreviousWindow)
|
while (CurrentSibling != NULL && CurrentSibling != PreviousWindow)
|
||||||
|
@ -101,9 +101,9 @@ VIS_ComputeVisibleRegion(
|
||||||
/* Combine it with the window region if available */
|
/* Combine it with the window region if available */
|
||||||
if(CurrentSibling->WindowRegion && !(CurrentSibling->Style & WS_MINIMIZE))
|
if(CurrentSibling->WindowRegion && !(CurrentSibling->Style & WS_MINIMIZE))
|
||||||
{
|
{
|
||||||
NtGdiOffsetRgn(ClipRgn, -CurrentSibling->WindowRect.left, -CurrentSibling->WindowRect.top);
|
NtGdiOffsetRgn(ClipRgn, -CurrentSibling->WindowRect.left, -CurrentSibling->WindowRect.top);
|
||||||
NtGdiCombineRgn(ClipRgn, ClipRgn, CurrentSibling->WindowRegion, RGN_AND);
|
NtGdiCombineRgn(ClipRgn, ClipRgn, CurrentSibling->WindowRegion, RGN_AND);
|
||||||
NtGdiOffsetRgn(ClipRgn, CurrentSibling->WindowRect.left, CurrentSibling->WindowRect.top);
|
NtGdiOffsetRgn(ClipRgn, CurrentSibling->WindowRect.left, CurrentSibling->WindowRect.top);
|
||||||
}
|
}
|
||||||
NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_DIFF);
|
NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_DIFF);
|
||||||
NtGdiDeleteObject(ClipRgn);
|
NtGdiDeleteObject(ClipRgn);
|
||||||
|
@ -127,9 +127,9 @@ VIS_ComputeVisibleRegion(
|
||||||
/* Combine it with the window region if available */
|
/* Combine it with the window region if available */
|
||||||
if(CurrentWindow->WindowRegion && !(CurrentWindow->Style & WS_MINIMIZE))
|
if(CurrentWindow->WindowRegion && !(CurrentWindow->Style & WS_MINIMIZE))
|
||||||
{
|
{
|
||||||
NtGdiOffsetRgn(ClipRgn, -CurrentWindow->WindowRect.left, -CurrentWindow->WindowRect.top);
|
NtGdiOffsetRgn(ClipRgn, -CurrentWindow->WindowRect.left, -CurrentWindow->WindowRect.top);
|
||||||
NtGdiCombineRgn(ClipRgn, ClipRgn, CurrentWindow->WindowRegion, RGN_AND);
|
NtGdiCombineRgn(ClipRgn, ClipRgn, CurrentWindow->WindowRegion, RGN_AND);
|
||||||
NtGdiOffsetRgn(ClipRgn, CurrentWindow->WindowRect.left, CurrentWindow->WindowRect.top);
|
NtGdiOffsetRgn(ClipRgn, CurrentWindow->WindowRect.left, CurrentWindow->WindowRect.top);
|
||||||
}
|
}
|
||||||
NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_DIFF);
|
NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_DIFF);
|
||||||
NtGdiDeleteObject(ClipRgn);
|
NtGdiDeleteObject(ClipRgn);
|
||||||
|
@ -140,9 +140,9 @@ VIS_ComputeVisibleRegion(
|
||||||
|
|
||||||
if(Window->WindowRegion && !(Window->Style & WS_MINIMIZE))
|
if(Window->WindowRegion && !(Window->Style & WS_MINIMIZE))
|
||||||
{
|
{
|
||||||
NtGdiOffsetRgn(VisRgn, -LeftOffset, -TopOffset);
|
NtGdiOffsetRgn(VisRgn, -LeftOffset, -TopOffset);
|
||||||
NtGdiCombineRgn(VisRgn, VisRgn, Window->WindowRegion, RGN_AND);
|
NtGdiCombineRgn(VisRgn, VisRgn, Window->WindowRegion, RGN_AND);
|
||||||
return VisRgn;
|
return VisRgn;
|
||||||
}
|
}
|
||||||
|
|
||||||
NtGdiOffsetRgn(VisRgn, -LeftOffset, -TopOffset);
|
NtGdiOffsetRgn(VisRgn, -LeftOffset, -TopOffset);
|
||||||
|
@ -169,11 +169,11 @@ co_VIS_WindowLayoutChanged(
|
||||||
NtGdiOffsetRgn(Temp,
|
NtGdiOffsetRgn(Temp,
|
||||||
Window->WindowRect.left - Parent->ClientRect.left,
|
Window->WindowRect.left - Parent->ClientRect.left,
|
||||||
Window->WindowRect.top - Parent->ClientRect.top);
|
Window->WindowRect.top - Parent->ClientRect.top);
|
||||||
|
|
||||||
UserRefObjectCo(Parent);
|
UserRefObjectCo(Parent);
|
||||||
co_UserRedrawWindow(Parent, NULL, Temp,
|
co_UserRedrawWindow(Parent, NULL, Temp,
|
||||||
RDW_FRAME | RDW_ERASE | RDW_INVALIDATE |
|
RDW_FRAME | RDW_ERASE | RDW_INVALIDATE |
|
||||||
RDW_ALLCHILDREN);
|
RDW_ALLCHILDREN);
|
||||||
UserDerefObjectCo(Parent);
|
UserDerefObjectCo(Parent);
|
||||||
}
|
}
|
||||||
NtGdiDeleteObject(Temp);
|
NtGdiDeleteObject(Temp);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -48,14 +48,14 @@ PWINSTATION_OBJECT InputWindowStation = NULL;
|
||||||
/* INITALIZATION FUNCTIONS ****************************************************/
|
/* INITALIZATION FUNCTIONS ****************************************************/
|
||||||
|
|
||||||
static GENERIC_MAPPING IntWindowStationMapping =
|
static GENERIC_MAPPING IntWindowStationMapping =
|
||||||
{
|
{
|
||||||
STANDARD_RIGHTS_READ | WINSTA_ENUMDESKTOPS | WINSTA_ENUMERATE | WINSTA_READATTRIBUTES | WINSTA_READSCREEN,
|
STANDARD_RIGHTS_READ | WINSTA_ENUMDESKTOPS | WINSTA_ENUMERATE | WINSTA_READATTRIBUTES | WINSTA_READSCREEN,
|
||||||
STANDARD_RIGHTS_WRITE | WINSTA_ACCESSCLIPBOARD | WINSTA_CREATEDESKTOP | WINSTA_WRITEATTRIBUTES,
|
STANDARD_RIGHTS_WRITE | WINSTA_ACCESSCLIPBOARD | WINSTA_CREATEDESKTOP | WINSTA_WRITEATTRIBUTES,
|
||||||
STANDARD_RIGHTS_EXECUTE | WINSTA_ACCESSGLOBALATOMS | WINSTA_EXITWINDOWS,
|
STANDARD_RIGHTS_EXECUTE | WINSTA_ACCESSGLOBALATOMS | WINSTA_EXITWINDOWS,
|
||||||
STANDARD_RIGHTS_REQUIRED | WINSTA_ACCESSCLIPBOARD | WINSTA_ACCESSGLOBALATOMS | WINSTA_CREATEDESKTOP |
|
STANDARD_RIGHTS_REQUIRED | WINSTA_ACCESSCLIPBOARD | WINSTA_ACCESSGLOBALATOMS | WINSTA_CREATEDESKTOP |
|
||||||
WINSTA_ENUMDESKTOPS | WINSTA_ENUMERATE | WINSTA_EXITWINDOWS |
|
WINSTA_ENUMDESKTOPS | WINSTA_ENUMERATE | WINSTA_EXITWINDOWS |
|
||||||
WINSTA_READATTRIBUTES | WINSTA_READSCREEN | WINSTA_WRITEATTRIBUTES
|
WINSTA_READATTRIBUTES | WINSTA_READSCREEN | WINSTA_WRITEATTRIBUTES
|
||||||
};
|
};
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
InitWindowStationImpl(VOID)
|
InitWindowStationImpl(VOID)
|
||||||
|
@ -71,20 +71,20 @@ InitWindowStationImpl(VOID)
|
||||||
|
|
||||||
RtlInitUnicodeString(&UnicodeString, WINSTA_ROOT_NAME);
|
RtlInitUnicodeString(&UnicodeString, WINSTA_ROOT_NAME);
|
||||||
InitializeObjectAttributes(&ObjectAttributes, &UnicodeString,
|
InitializeObjectAttributes(&ObjectAttributes, &UnicodeString,
|
||||||
0, NULL, NULL);
|
0, NULL, NULL);
|
||||||
Status = ZwCreateDirectoryObject(&WindowStationsDirectory, 0,
|
Status = ZwCreateDirectoryObject(&WindowStationsDirectory, 0,
|
||||||
&ObjectAttributes);
|
&ObjectAttributes);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("Could not create \\Windows\\WindowStations directory "
|
DPRINT("Could not create \\Windows\\WindowStations directory "
|
||||||
"(Status 0x%X)\n", Status);
|
"(Status 0x%X)\n", Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set Winsta Object Attributes */
|
/* Set Winsta Object Attributes */
|
||||||
ExWindowStationObjectType->TypeInfo.DefaultNonPagedPoolCharge = sizeof(WINSTATION_OBJECT);
|
ExWindowStationObjectType->TypeInfo.DefaultNonPagedPoolCharge = sizeof(WINSTATION_OBJECT);
|
||||||
ExWindowStationObjectType->TypeInfo.GenericMapping = IntWindowStationMapping;
|
ExWindowStationObjectType->TypeInfo.GenericMapping = IntWindowStationMapping;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,11 +104,11 @@ IntWinStaObjectOpen(OB_OPEN_REASON Reason,
|
||||||
ULONG HandleCount,
|
ULONG HandleCount,
|
||||||
ACCESS_MASK GrantedAccess)
|
ACCESS_MASK GrantedAccess)
|
||||||
{
|
{
|
||||||
PWINSTATION_OBJECT WinSta = (PWINSTATION_OBJECT)ObjectBody;
|
PWINSTATION_OBJECT WinSta = (PWINSTATION_OBJECT)ObjectBody;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
if (Reason == ObCreateHandle)
|
if (Reason == ObCreateHandle)
|
||||||
{
|
{
|
||||||
DPRINT("Creating window station (0x%X)\n", WinSta);
|
DPRINT("Creating window station (0x%X)\n", WinSta);
|
||||||
|
|
||||||
KeInitializeSpinLock(&WinSta->Lock);
|
KeInitializeSpinLock(&WinSta->Lock);
|
||||||
|
@ -122,66 +122,66 @@ IntWinStaObjectOpen(OB_OPEN_REASON Reason,
|
||||||
WinSta->SystemMenuTemplate = (HANDLE)0;
|
WinSta->SystemMenuTemplate = (HANDLE)0;
|
||||||
|
|
||||||
DPRINT("Window station successfully created.\n");
|
DPRINT("Window station successfully created.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
IntWinStaObjectDelete(PVOID DeletedObject)
|
IntWinStaObjectDelete(PVOID DeletedObject)
|
||||||
{
|
{
|
||||||
PWINSTATION_OBJECT WinSta = (PWINSTATION_OBJECT)DeletedObject;
|
PWINSTATION_OBJECT WinSta = (PWINSTATION_OBJECT)DeletedObject;
|
||||||
|
|
||||||
DPRINT("Deleting window station (0x%X)\n", WinSta);
|
DPRINT("Deleting window station (0x%X)\n", WinSta);
|
||||||
|
|
||||||
RtlDestroyAtomTable(WinSta->AtomTable);
|
RtlDestroyAtomTable(WinSta->AtomTable);
|
||||||
|
|
||||||
RtlFreeUnicodeString(&WinSta->Name);
|
RtlFreeUnicodeString(&WinSta->Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
PVOID STDCALL
|
PVOID STDCALL
|
||||||
IntWinStaObjectFind(PVOID Object,
|
IntWinStaObjectFind(PVOID Object,
|
||||||
PWSTR Name,
|
PWSTR Name,
|
||||||
ULONG Attributes)
|
ULONG Attributes)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY Current;
|
PLIST_ENTRY Current;
|
||||||
PDESKTOP_OBJECT CurrentObject;
|
PDESKTOP_OBJECT CurrentObject;
|
||||||
PWINSTATION_OBJECT WinStaObject = (PWINSTATION_OBJECT)Object;
|
PWINSTATION_OBJECT WinStaObject = (PWINSTATION_OBJECT)Object;
|
||||||
|
|
||||||
DPRINT("WinStaObject (0x%X) Name (%wS)\n", WinStaObject, Name);
|
DPRINT("WinStaObject (0x%X) Name (%wS)\n", WinStaObject, Name);
|
||||||
|
|
||||||
if (Name[0] == 0)
|
if (Name[0] == 0)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Current = WinStaObject->DesktopListHead.Flink;
|
Current = WinStaObject->DesktopListHead.Flink;
|
||||||
while (Current != &WinStaObject->DesktopListHead)
|
while (Current != &WinStaObject->DesktopListHead)
|
||||||
{
|
{
|
||||||
CurrentObject = CONTAINING_RECORD(Current, DESKTOP_OBJECT, ListEntry);
|
CurrentObject = CONTAINING_RECORD(Current, DESKTOP_OBJECT, ListEntry);
|
||||||
DPRINT("Scanning %wZ for %wS\n", &CurrentObject->Name, Name);
|
DPRINT("Scanning %wZ for %wS\n", &CurrentObject->Name, Name);
|
||||||
if (Attributes & OBJ_CASE_INSENSITIVE)
|
if (Attributes & OBJ_CASE_INSENSITIVE)
|
||||||
{
|
|
||||||
if (_wcsicmp(CurrentObject->Name.Buffer, Name) == 0)
|
|
||||||
{
|
{
|
||||||
DPRINT("Found desktop at (0x%X)\n", CurrentObject);
|
if (_wcsicmp(CurrentObject->Name.Buffer, Name) == 0)
|
||||||
return CurrentObject;
|
{
|
||||||
|
DPRINT("Found desktop at (0x%X)\n", CurrentObject);
|
||||||
|
return CurrentObject;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
|
||||||
{
|
|
||||||
if (wcscmp(CurrentObject->Name.Buffer, Name) == 0)
|
|
||||||
{
|
{
|
||||||
DPRINT("Found desktop at (0x%X)\n", CurrentObject);
|
if (wcscmp(CurrentObject->Name.Buffer, Name) == 0)
|
||||||
return CurrentObject;
|
{
|
||||||
|
DPRINT("Found desktop at (0x%X)\n", CurrentObject);
|
||||||
|
return CurrentObject;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
Current = Current->Flink;
|
||||||
Current = Current->Flink;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
DPRINT("Returning NULL\n");
|
DPRINT("Returning NULL\n");
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -192,43 +192,43 @@ IntWinStaObjectParse(PVOID Object,
|
||||||
PWSTR *Path,
|
PWSTR *Path,
|
||||||
ULONG Attributes)
|
ULONG Attributes)
|
||||||
{
|
{
|
||||||
PVOID FoundObject;
|
PVOID FoundObject;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PWSTR End;
|
PWSTR End;
|
||||||
|
|
||||||
DPRINT("Object (0x%X) Path (0x%X) *Path (%wS)\n", Object, Path, *Path);
|
DPRINT("Object (0x%X) Path (0x%X) *Path (%wS)\n", Object, Path, *Path);
|
||||||
|
|
||||||
*NextObject = NULL;
|
*NextObject = NULL;
|
||||||
|
|
||||||
if ((Path == NULL) || ((*Path) == NULL))
|
if ((Path == NULL) || ((*Path) == NULL))
|
||||||
{
|
{
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
End = wcschr((*Path) + 1, '\\');
|
End = wcschr((*Path) + 1, '\\');
|
||||||
if (End != NULL)
|
if (End != NULL)
|
||||||
{
|
{
|
||||||
DPRINT("Name contains illegal characters\n");
|
DPRINT("Name contains illegal characters\n");
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FoundObject = IntWinStaObjectFind(Object, (*Path) + 1, Attributes);
|
FoundObject = IntWinStaObjectFind(Object, (*Path) + 1, Attributes);
|
||||||
if (FoundObject == NULL)
|
if (FoundObject == NULL)
|
||||||
{
|
{
|
||||||
DPRINT("Name was not found\n");
|
DPRINT("Name was not found\n");
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ObReferenceObjectByPointer(
|
Status = ObReferenceObjectByPointer(
|
||||||
FoundObject,
|
FoundObject,
|
||||||
STANDARD_RIGHTS_REQUIRED,
|
STANDARD_RIGHTS_REQUIRED,
|
||||||
NULL,
|
NULL,
|
||||||
UserMode);
|
UserMode);
|
||||||
|
|
||||||
*NextObject = FoundObject;
|
*NextObject = FoundObject;
|
||||||
*Path = NULL;
|
*Path = NULL;
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS **********************************************************/
|
/* PRIVATE FUNCTIONS **********************************************************/
|
||||||
|
@ -305,18 +305,18 @@ IntValidateWindowStationHandle(
|
||||||
|
|
||||||
if (WindowStation == NULL)
|
if (WindowStation == NULL)
|
||||||
{
|
{
|
||||||
// DPRINT1("Invalid window station handle\n");
|
// DPRINT1("Invalid window station handle\n");
|
||||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
return STATUS_INVALID_HANDLE;
|
return STATUS_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ObReferenceObjectByHandle(
|
Status = ObReferenceObjectByHandle(
|
||||||
WindowStation,
|
WindowStation,
|
||||||
DesiredAccess,
|
DesiredAccess,
|
||||||
ExWindowStationObjectType,
|
ExWindowStationObjectType,
|
||||||
AccessMode,
|
AccessMode,
|
||||||
(PVOID*)Object,
|
(PVOID*)Object,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
|
@ -330,10 +330,10 @@ IntGetWindowStationObject(PWINSTATION_OBJECT Object)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = ObReferenceObjectByPointer(
|
Status = ObReferenceObjectByPointer(
|
||||||
Object,
|
Object,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
ExWindowStationObjectType,
|
ExWindowStationObjectType,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
return NT_SUCCESS(Status);
|
return NT_SUCCESS(Status);
|
||||||
}
|
}
|
||||||
|
@ -341,40 +341,40 @@ IntGetWindowStationObject(PWINSTATION_OBJECT Object)
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
co_IntInitializeDesktopGraphics(VOID)
|
co_IntInitializeDesktopGraphics(VOID)
|
||||||
{
|
{
|
||||||
UNICODE_STRING DriverName;
|
UNICODE_STRING DriverName;
|
||||||
if (! IntCreatePrimarySurface())
|
if (! IntCreatePrimarySurface())
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
RtlInitUnicodeString(&DriverName, L"DISPLAY");
|
RtlInitUnicodeString(&DriverName, L"DISPLAY");
|
||||||
ScreenDeviceContext = IntGdiCreateDC(&DriverName, NULL, NULL, NULL, FALSE);
|
ScreenDeviceContext = IntGdiCreateDC(&DriverName, NULL, NULL, NULL, FALSE);
|
||||||
if (NULL == ScreenDeviceContext)
|
if (NULL == ScreenDeviceContext)
|
||||||
{
|
{
|
||||||
IntDestroyPrimarySurface();
|
IntDestroyPrimarySurface();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
DC_SetOwnership(ScreenDeviceContext, NULL);
|
DC_SetOwnership(ScreenDeviceContext, NULL);
|
||||||
|
|
||||||
UserAcquireOrReleaseInputOwnership(FALSE);
|
UserAcquireOrReleaseInputOwnership(FALSE);
|
||||||
|
|
||||||
/* Setup the cursor */
|
/* Setup the cursor */
|
||||||
co_IntLoadDefaultCursors();
|
co_IntLoadDefaultCursors();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
IntEndDesktopGraphics(VOID)
|
IntEndDesktopGraphics(VOID)
|
||||||
{
|
{
|
||||||
UserAcquireOrReleaseInputOwnership(TRUE);
|
UserAcquireOrReleaseInputOwnership(TRUE);
|
||||||
if (NULL != ScreenDeviceContext)
|
if (NULL != ScreenDeviceContext)
|
||||||
{
|
{
|
||||||
DC_SetOwnership(ScreenDeviceContext, PsGetCurrentProcess());
|
DC_SetOwnership(ScreenDeviceContext, PsGetCurrentProcess());
|
||||||
NtGdiDeleteDC(ScreenDeviceContext);
|
NtGdiDeleteDC(ScreenDeviceContext);
|
||||||
ScreenDeviceContext = NULL;
|
ScreenDeviceContext = NULL;
|
||||||
}
|
}
|
||||||
IntHideDesktop(IntGetActiveDesktop());
|
IntHideDesktop(IntGetActiveDesktop());
|
||||||
IntDestroyPrimarySurface();
|
IntDestroyPrimarySurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
HDC FASTCALL
|
HDC FASTCALL
|
||||||
|
@ -442,7 +442,7 @@ NtUserCreateWindowStation(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!IntGetFullWindowStationName(&WindowStationName, lpszWindowStationName,
|
if (!IntGetFullWindowStationName(&WindowStationName, lpszWindowStationName,
|
||||||
NULL))
|
NULL))
|
||||||
{
|
{
|
||||||
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -463,13 +463,13 @@ NtUserCreateWindowStation(
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
Status = ObOpenObjectByName(
|
Status = ObOpenObjectByName(
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
ExWindowStationObjectType,
|
ExWindowStationObjectType,
|
||||||
NULL,
|
NULL,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
dwDesiredAccess,
|
dwDesiredAccess,
|
||||||
NULL,
|
NULL,
|
||||||
(PVOID*)&WindowStation);
|
(PVOID*)&WindowStation);
|
||||||
|
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -485,15 +485,15 @@ NtUserCreateWindowStation(
|
||||||
DPRINT("Creating window station (%wZ)\n", &WindowStationName);
|
DPRINT("Creating window station (%wZ)\n", &WindowStationName);
|
||||||
|
|
||||||
Status = ObCreateObject(
|
Status = ObCreateObject(
|
||||||
KernelMode,
|
KernelMode,
|
||||||
ExWindowStationObjectType,
|
ExWindowStationObjectType,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
ExGetPreviousMode(),
|
ExGetPreviousMode(),
|
||||||
NULL,
|
NULL,
|
||||||
sizeof(WINSTATION_OBJECT),
|
sizeof(WINSTATION_OBJECT),
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
(PVOID*)&WindowStationObject);
|
(PVOID*)&WindowStationObject);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -502,16 +502,16 @@ NtUserCreateWindowStation(
|
||||||
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowStationObject->Name = *lpszWindowStationName;
|
WindowStationObject->Name = *lpszWindowStationName;
|
||||||
|
|
||||||
Status = ObInsertObject(
|
Status = ObInsertObject(
|
||||||
(PVOID)WindowStationObject,
|
(PVOID)WindowStationObject,
|
||||||
NULL,
|
NULL,
|
||||||
STANDARD_RIGHTS_REQUIRED,
|
STANDARD_RIGHTS_REQUIRED,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
(PVOID*)&WindowStation);
|
(PVOID*)&WindowStation);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -528,11 +528,11 @@ NtUserCreateWindowStation(
|
||||||
|
|
||||||
if(!(CurInfo = ExAllocatePool(PagedPool, sizeof(SYSTEM_CURSORINFO))))
|
if(!(CurInfo = ExAllocatePool(PagedPool, sizeof(SYSTEM_CURSORINFO))))
|
||||||
{
|
{
|
||||||
ExFreePool(WindowStationName.Buffer);
|
ExFreePool(WindowStationName.Buffer);
|
||||||
/* FIXME - Delete window station object */
|
/* FIXME - Delete window station object */
|
||||||
ObDereferenceObject(WindowStationObject);
|
ObDereferenceObject(WindowStationObject);
|
||||||
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
InitHotKeys(WindowStationObject);
|
InitHotKeys(WindowStationObject);
|
||||||
|
@ -554,8 +554,8 @@ NtUserCreateWindowStation(
|
||||||
|
|
||||||
if (!IntSetupCurIconHandles(WindowStationObject))
|
if (!IntSetupCurIconHandles(WindowStationObject))
|
||||||
{
|
{
|
||||||
DPRINT1("Setting up the Cursor/Icon Handle table failed!\n");
|
DPRINT1("Setting up the Cursor/Icon Handle table failed!\n");
|
||||||
/* FIXME: Complain more loudly? */
|
/* FIXME: Complain more loudly? */
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("Window station successfully created (%wZ)\n", lpszWindowStationName);
|
DPRINT("Window station successfully created (%wZ)\n", lpszWindowStationName);
|
||||||
|
@ -602,7 +602,7 @@ NtUserOpenWindowStation(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!IntGetFullWindowStationName(&WindowStationName, lpszWindowStationName,
|
if (!IntGetFullWindowStationName(&WindowStationName, lpszWindowStationName,
|
||||||
NULL))
|
NULL))
|
||||||
{
|
{
|
||||||
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -619,13 +619,13 @@ NtUserOpenWindowStation(
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
Status = ObOpenObjectByName(
|
Status = ObOpenObjectByName(
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
ExWindowStationObjectType,
|
ExWindowStationObjectType,
|
||||||
NULL,
|
NULL,
|
||||||
UserMode,
|
UserMode,
|
||||||
dwDesiredAccess,
|
dwDesiredAccess,
|
||||||
NULL,
|
NULL,
|
||||||
(PVOID*)&WindowStation);
|
(PVOID*)&WindowStation);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -672,10 +672,10 @@ NtUserCloseWindowStation(
|
||||||
DPRINT("About to close window station handle (0x%X)\n", hWinSta);
|
DPRINT("About to close window station handle (0x%X)\n", hWinSta);
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(
|
Status = IntValidateWindowStationHandle(
|
||||||
hWinSta,
|
hWinSta,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&Object);
|
&Object);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -683,11 +683,11 @@ NtUserCloseWindowStation(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* FIXME - free the cursor information when actually deleting the object!! */
|
/* FIXME - free the cursor information when actually deleting the object!! */
|
||||||
ASSERT(Object->SystemCursor);
|
ASSERT(Object->SystemCursor);
|
||||||
ExFreePool(Object->SystemCursor);
|
ExFreePool(Object->SystemCursor);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ObDereferenceObject(Object);
|
ObDereferenceObject(Object);
|
||||||
|
|
||||||
|
@ -760,10 +760,10 @@ NtUserGetObjectInformation(
|
||||||
/* try windowstation */
|
/* try windowstation */
|
||||||
DPRINT("Trying to open window station 0x%x\n", hObject);
|
DPRINT("Trying to open window station 0x%x\n", hObject);
|
||||||
Status = IntValidateWindowStationHandle(
|
Status = IntValidateWindowStationHandle(
|
||||||
hObject,
|
hObject,
|
||||||
UserMode,/*ExGetPreviousMode(),*/
|
UserMode,/*ExGetPreviousMode(),*/
|
||||||
GENERIC_READ, /* FIXME: is this ok? */
|
GENERIC_READ, /* FIXME: is this ok? */
|
||||||
&WinStaObject);
|
&WinStaObject);
|
||||||
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status) && Status != STATUS_OBJECT_TYPE_MISMATCH)
|
if (!NT_SUCCESS(Status) && Status != STATUS_OBJECT_TYPE_MISMATCH)
|
||||||
|
@ -778,10 +778,10 @@ NtUserGetObjectInformation(
|
||||||
/* try desktop */
|
/* try desktop */
|
||||||
DPRINT("Trying to open desktop 0x%x\n", hObject);
|
DPRINT("Trying to open desktop 0x%x\n", hObject);
|
||||||
Status = IntValidateDesktopHandle(
|
Status = IntValidateDesktopHandle(
|
||||||
hObject,
|
hObject,
|
||||||
UserMode,/*ExGetPreviousMode(),*/
|
UserMode,/*ExGetPreviousMode(),*/
|
||||||
GENERIC_READ, /* FIXME: is this ok? */
|
GENERIC_READ, /* FIXME: is this ok? */
|
||||||
&DesktopObject);
|
&DesktopObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("Failed: 0x%x\n", Status);
|
DPRINT("Failed: 0x%x\n", Status);
|
||||||
|
@ -794,53 +794,53 @@ NtUserGetObjectInformation(
|
||||||
/* get data */
|
/* get data */
|
||||||
switch (nIndex)
|
switch (nIndex)
|
||||||
{
|
{
|
||||||
case UOI_FLAGS:
|
case UOI_FLAGS:
|
||||||
Status = STATUS_NOT_IMPLEMENTED;
|
Status = STATUS_NOT_IMPLEMENTED;
|
||||||
DPRINT1("UOI_FLAGS unimplemented!\n");
|
DPRINT1("UOI_FLAGS unimplemented!\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UOI_NAME:
|
case UOI_NAME:
|
||||||
if (WinStaObject != NULL)
|
if (WinStaObject != NULL)
|
||||||
{
|
{
|
||||||
pvData = WinStaObject->Name.Buffer;
|
pvData = WinStaObject->Name.Buffer;
|
||||||
nDataSize = WinStaObject->Name.Length+2;
|
nDataSize = WinStaObject->Name.Length+2;
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
else if (DesktopObject != NULL)
|
else if (DesktopObject != NULL)
|
||||||
{
|
{
|
||||||
pvData = DesktopObject->Name.Buffer;
|
pvData = DesktopObject->Name.Buffer;
|
||||||
nDataSize = DesktopObject->Name.Length+2;
|
nDataSize = DesktopObject->Name.Length+2;
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Status = STATUS_INVALID_PARAMETER;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UOI_TYPE:
|
||||||
|
if (WinStaObject != NULL)
|
||||||
|
{
|
||||||
|
pvData = L"WindowStation";
|
||||||
|
nDataSize = (wcslen(pvData) + 1) * sizeof(WCHAR);
|
||||||
|
Status = STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
else if (DesktopObject != NULL)
|
||||||
|
{
|
||||||
|
pvData = L"Desktop";
|
||||||
|
nDataSize = (wcslen(pvData) + 1) * sizeof(WCHAR);
|
||||||
|
Status = STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Status = STATUS_INVALID_PARAMETER;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UOI_USER_SID:
|
||||||
|
Status = STATUS_NOT_IMPLEMENTED;
|
||||||
|
DPRINT1("UOI_USER_SID unimplemented!\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
Status = STATUS_INVALID_PARAMETER;
|
Status = STATUS_INVALID_PARAMETER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UOI_TYPE:
|
|
||||||
if (WinStaObject != NULL)
|
|
||||||
{
|
|
||||||
pvData = L"WindowStation";
|
|
||||||
nDataSize = (wcslen(pvData) + 1) * sizeof(WCHAR);
|
|
||||||
Status = STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
else if (DesktopObject != NULL)
|
|
||||||
{
|
|
||||||
pvData = L"Desktop";
|
|
||||||
nDataSize = (wcslen(pvData) + 1) * sizeof(WCHAR);
|
|
||||||
Status = STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Status = STATUS_INVALID_PARAMETER;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case UOI_USER_SID:
|
|
||||||
Status = STATUS_NOT_IMPLEMENTED;
|
|
||||||
DPRINT1("UOI_USER_SID unimplemented!\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
Status = STATUS_INVALID_PARAMETER;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* try to copy data to caller */
|
/* try to copy data to caller */
|
||||||
|
@ -916,15 +916,15 @@ UserGetProcessWindowStation(VOID)
|
||||||
{
|
{
|
||||||
if(PsGetCurrentProcess() != CsrProcess)
|
if(PsGetCurrentProcess() != CsrProcess)
|
||||||
{
|
{
|
||||||
return PsGetCurrentProcess()->Win32WindowStation;
|
return PsGetCurrentProcess()->Win32WindowStation;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* FIXME - get the pointer to the window station by querying the parent of
|
/* FIXME - get the pointer to the window station by querying the parent of
|
||||||
the desktop of the calling thread (which is a window station),
|
the desktop of the calling thread (which is a window station),
|
||||||
then use ObFindHandleForObject() to find a suitable handle */
|
then use ObFindHandleForObject() to find a suitable handle */
|
||||||
DPRINT1("CSRSS called NtUserGetProcessWindowStation()!!! returned NULL!\n");
|
DPRINT1("CSRSS called NtUserGetProcessWindowStation()!!! returned NULL!\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -952,35 +952,35 @@ NtUserGetProcessWindowStation(VOID)
|
||||||
PWINSTATION_OBJECT FASTCALL
|
PWINSTATION_OBJECT FASTCALL
|
||||||
IntGetWinStaObj(VOID)
|
IntGetWinStaObj(VOID)
|
||||||
{
|
{
|
||||||
PWINSTATION_OBJECT WinStaObj;
|
PWINSTATION_OBJECT WinStaObj;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* just a temporary hack, this will be gone soon
|
* just a temporary hack, this will be gone soon
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(PsGetWin32Thread() != NULL && PsGetWin32Thread()->Desktop != NULL)
|
if(PsGetWin32Thread() != NULL && PsGetWin32Thread()->Desktop != NULL)
|
||||||
{
|
{
|
||||||
WinStaObj = PsGetWin32Thread()->Desktop->WindowStation;
|
WinStaObj = PsGetWin32Thread()->Desktop->WindowStation;
|
||||||
ObReferenceObjectByPointer(WinStaObj, KernelMode, ExWindowStationObjectType, 0);
|
ObReferenceObjectByPointer(WinStaObj, KernelMode, ExWindowStationObjectType, 0);
|
||||||
}
|
}
|
||||||
else if(PsGetCurrentProcess() != CsrProcess)
|
else if(PsGetCurrentProcess() != CsrProcess)
|
||||||
{
|
{
|
||||||
NTSTATUS Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
|
NTSTATUS Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&WinStaObj);
|
&WinStaObj);
|
||||||
if(!NT_SUCCESS(Status))
|
if(!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WinStaObj = NULL;
|
WinStaObj = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return WinStaObj;
|
return WinStaObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1007,25 +1007,25 @@ NtUserSetProcessWindowStation(HWINSTA hWindowStation)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT("About to set process window station with handle (0x%X)\n",
|
DPRINT("About to set process window station with handle (0x%X)\n",
|
||||||
hWindowStation);
|
hWindowStation);
|
||||||
|
|
||||||
if(PsGetCurrentProcess() == CsrProcess)
|
if(PsGetCurrentProcess() == CsrProcess)
|
||||||
{
|
{
|
||||||
DPRINT1("CSRSS is not allowed to change it's window station!!!\n");
|
DPRINT1("CSRSS is not allowed to change it's window station!!!\n");
|
||||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(
|
Status = IntValidateWindowStationHandle(
|
||||||
hWindowStation,
|
hWindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&NewWinSta);
|
&NewWinSta);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("Validation of window station handle (0x%X) failed\n",
|
DPRINT("Validation of window station handle (0x%X) failed\n",
|
||||||
hWindowStation);
|
hWindowStation);
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1038,7 +1038,7 @@ NtUserSetProcessWindowStation(HWINSTA hWindowStation)
|
||||||
hOld = InterlockedExchangePointer(&PsGetCurrentProcess()->Win32WindowStation, hWindowStation);
|
hOld = InterlockedExchangePointer(&PsGetCurrentProcess()->Win32WindowStation, hWindowStation);
|
||||||
|
|
||||||
DPRINT("PsGetCurrentProcess()->Win32WindowStation 0x%X\n",
|
DPRINT("PsGetCurrentProcess()->Win32WindowStation 0x%X\n",
|
||||||
PsGetCurrentProcess()->Win32WindowStation);
|
PsGetCurrentProcess()->Win32WindowStation);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1059,24 +1059,24 @@ NtUserLockWindowStation(HWINSTA hWindowStation)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT("About to set process window station with handle (0x%X)\n",
|
DPRINT("About to set process window station with handle (0x%X)\n",
|
||||||
hWindowStation);
|
hWindowStation);
|
||||||
|
|
||||||
if(PsGetWin32Process() != LogonProcess)
|
if(PsGetWin32Process() != LogonProcess)
|
||||||
{
|
{
|
||||||
DPRINT1("Unauthorized process attempted to lock the window station!\n");
|
DPRINT1("Unauthorized process attempted to lock the window station!\n");
|
||||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(
|
Status = IntValidateWindowStationHandle(
|
||||||
hWindowStation,
|
hWindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&Object);
|
&Object);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("Validation of window station handle (0x%X) failed\n",
|
DPRINT("Validation of window station handle (0x%X) failed\n",
|
||||||
hWindowStation);
|
hWindowStation);
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1104,24 +1104,24 @@ NtUserUnlockWindowStation(HWINSTA hWindowStation)
|
||||||
BOOL Ret;
|
BOOL Ret;
|
||||||
|
|
||||||
DPRINT("About to set process window station with handle (0x%X)\n",
|
DPRINT("About to set process window station with handle (0x%X)\n",
|
||||||
hWindowStation);
|
hWindowStation);
|
||||||
|
|
||||||
if(PsGetWin32Process() != LogonProcess)
|
if(PsGetWin32Process() != LogonProcess)
|
||||||
{
|
{
|
||||||
DPRINT1("Unauthorized process attempted to unlock the window station!\n");
|
DPRINT1("Unauthorized process attempted to unlock the window station!\n");
|
||||||
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
SetLastWin32Error(ERROR_ACCESS_DENIED);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = IntValidateWindowStationHandle(
|
Status = IntValidateWindowStationHandle(
|
||||||
hWindowStation,
|
hWindowStation,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&Object);
|
&Object);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("Validation of window station handle (0x%X) failed\n",
|
DPRINT("Validation of window station handle (0x%X) failed\n",
|
||||||
hWindowStation);
|
hWindowStation);
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1187,9 +1187,9 @@ BuildWindowStationNameList(
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
Status = ZwOpenDirectoryObject(
|
Status = ZwOpenDirectoryObject(
|
||||||
&DirectoryHandle,
|
&DirectoryHandle,
|
||||||
DIRECTORY_QUERY,
|
DIRECTORY_QUERY,
|
||||||
&ObjectAttributes);
|
&ObjectAttributes);
|
||||||
|
|
||||||
ExFreePool(DirectoryName.Buffer);
|
ExFreePool(DirectoryName.Buffer);
|
||||||
|
|
||||||
|
@ -1206,7 +1206,7 @@ BuildWindowStationNameList(
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
if (STATUS_NO_MORE_ENTRIES == ZwQueryDirectoryObject(DirectoryHandle, NULL, 0, FALSE,
|
if (STATUS_NO_MORE_ENTRIES == ZwQueryDirectoryObject(DirectoryHandle, NULL, 0, FALSE,
|
||||||
FALSE, &Context, NULL))
|
FALSE, &Context, NULL))
|
||||||
{
|
{
|
||||||
/* Our fixed-size buffer is large enough */
|
/* Our fixed-size buffer is large enough */
|
||||||
Buffer = InitialBuffer;
|
Buffer = InitialBuffer;
|
||||||
|
@ -1233,8 +1233,8 @@ BuildWindowStationNameList(
|
||||||
Status = ZwQueryDirectoryObject(DirectoryHandle, Buffer, BufferSize,
|
Status = ZwQueryDirectoryObject(DirectoryHandle, Buffer, BufferSize,
|
||||||
FALSE, TRUE, &Context, &ReturnLength);
|
FALSE, TRUE, &Context, &ReturnLength);
|
||||||
if (! NT_SUCCESS(Status) ||
|
if (! NT_SUCCESS(Status) ||
|
||||||
STATUS_NO_MORE_ENTRIES != ZwQueryDirectoryObject(DirectoryHandle, NULL, 0, FALSE,
|
STATUS_NO_MORE_ENTRIES != ZwQueryDirectoryObject(DirectoryHandle, NULL, 0, FALSE,
|
||||||
FALSE, &Context, NULL))
|
FALSE, &Context, NULL))
|
||||||
{
|
{
|
||||||
/* Something went wrong, maybe someone added a directory entry? Just give up. */
|
/* Something went wrong, maybe someone added a directory entry? Just give up. */
|
||||||
ExFreePool(Buffer);
|
ExFreePool(Buffer);
|
||||||
|
@ -1252,7 +1252,7 @@ BuildWindowStationNameList(
|
||||||
ReturnLength = sizeof(DWORD);
|
ReturnLength = sizeof(DWORD);
|
||||||
EntryCount = 0;
|
EntryCount = 0;
|
||||||
for (DirEntry = (POBJECT_DIRECTORY_INFORMATION) Buffer; 0 != DirEntry->ObjectName.Length;
|
for (DirEntry = (POBJECT_DIRECTORY_INFORMATION) Buffer; 0 != DirEntry->ObjectName.Length;
|
||||||
DirEntry++)
|
DirEntry++)
|
||||||
{
|
{
|
||||||
ReturnLength += DirEntry->ObjectName.Length + sizeof(WCHAR);
|
ReturnLength += DirEntry->ObjectName.Length + sizeof(WCHAR);
|
||||||
EntryCount++;
|
EntryCount++;
|
||||||
|
@ -1299,7 +1299,7 @@ BuildWindowStationNameList(
|
||||||
|
|
||||||
NullWchar = L'\0';
|
NullWchar = L'\0';
|
||||||
for (DirEntry = (POBJECT_DIRECTORY_INFORMATION) Buffer; 0 != DirEntry->ObjectName.Length;
|
for (DirEntry = (POBJECT_DIRECTORY_INFORMATION) Buffer; 0 != DirEntry->ObjectName.Length;
|
||||||
DirEntry++)
|
DirEntry++)
|
||||||
{
|
{
|
||||||
Status = MmCopyToCaller(lpBuffer, DirEntry->ObjectName.Buffer, DirEntry->ObjectName.Length);
|
Status = MmCopyToCaller(lpBuffer, DirEntry->ObjectName.Buffer, DirEntry->ObjectName.Length);
|
||||||
if (! NT_SUCCESS(Status))
|
if (! NT_SUCCESS(Status))
|
||||||
|
@ -1367,8 +1367,8 @@ BuildDesktopNameList(
|
||||||
ReturnLength = sizeof(DWORD);
|
ReturnLength = sizeof(DWORD);
|
||||||
EntryCount = 0;
|
EntryCount = 0;
|
||||||
for (DesktopEntry = WindowStation->DesktopListHead.Flink;
|
for (DesktopEntry = WindowStation->DesktopListHead.Flink;
|
||||||
DesktopEntry != &WindowStation->DesktopListHead;
|
DesktopEntry != &WindowStation->DesktopListHead;
|
||||||
DesktopEntry = DesktopEntry->Flink)
|
DesktopEntry = DesktopEntry->Flink)
|
||||||
{
|
{
|
||||||
DesktopObject = CONTAINING_RECORD(DesktopEntry, DESKTOP_OBJECT, ListEntry);
|
DesktopObject = CONTAINING_RECORD(DesktopEntry, DESKTOP_OBJECT, ListEntry);
|
||||||
ReturnLength += DesktopObject->Name.Length + sizeof(WCHAR);
|
ReturnLength += DesktopObject->Name.Length + sizeof(WCHAR);
|
||||||
|
@ -1410,8 +1410,8 @@ BuildDesktopNameList(
|
||||||
|
|
||||||
NullWchar = L'\0';
|
NullWchar = L'\0';
|
||||||
for (DesktopEntry = WindowStation->DesktopListHead.Flink;
|
for (DesktopEntry = WindowStation->DesktopListHead.Flink;
|
||||||
DesktopEntry != &WindowStation->DesktopListHead;
|
DesktopEntry != &WindowStation->DesktopListHead;
|
||||||
DesktopEntry = DesktopEntry->Flink)
|
DesktopEntry = DesktopEntry->Flink)
|
||||||
{
|
{
|
||||||
DesktopObject = CONTAINING_RECORD(DesktopEntry, DESKTOP_OBJECT, ListEntry);
|
DesktopObject = CONTAINING_RECORD(DesktopEntry, DESKTOP_OBJECT, ListEntry);
|
||||||
Status = MmCopyToCaller(lpBuffer, DesktopObject->Name.Buffer, DesktopObject->Name.Length);
|
Status = MmCopyToCaller(lpBuffer, DesktopObject->Name.Buffer, DesktopObject->Name.Length);
|
||||||
|
@ -1477,7 +1477,7 @@ NtUserBuildNameList(
|
||||||
/* The WindowStation name list and desktop name list are build in completely
|
/* The WindowStation name list and desktop name list are build in completely
|
||||||
different ways. Call the appropriate function */
|
different ways. Call the appropriate function */
|
||||||
return NULL == hWindowStation ? BuildWindowStationNameList(dwSize, lpBuffer, pRequiredSize) :
|
return NULL == hWindowStation ? BuildWindowStationNameList(dwSize, lpBuffer, pRequiredSize) :
|
||||||
BuildDesktopNameList(hWindowStation, dwSize, lpBuffer, pRequiredSize);
|
BuildDesktopNameList(hWindowStation, dwSize, lpBuffer, pRequiredSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue