#include <w32k.h>
-#define NDEBUG
+//#define NDEBUG
+#undef NDEBUG
#include <debug.h>
/* registered Logon process */
END_CLEANUP;
}
+
/*
* @implemented
*/
DECLARE_RETURN(DWORD);
DPRINT("Enter NtUserCallOneParam\n");
+
+
+ if (Routine == ONEPARAM_ROUTINE_SHOWCURSOR)
+ {
+ PWINSTATION_OBJECT WinSta = PsGetWin32Thread()->Desktop->WindowStation;
+ PSYSTEM_CURSORINFO CurInfo;
+
+ HDC Screen;
+ HBITMAP dcbmp;
+ SURFOBJ *SurfObj;
+ BITMAPOBJ *BitmapObj;
+ GDIDEVICE *ppdev;
+ GDIPOINTER *pgp;
+
+ if(!(Screen = IntGetScreenDC()))
+ {
+ return 1; /* No mouse */
+ }
+
+ PDC dc = DC_LockDc(Screen);
+
+ if (!dc)
+ {
+ return 1; /* No mouse */
+ }
+
+ dcbmp = dc->w.hBitmap;
+ DC_UnlockDc(dc);
+
+ BitmapObj = BITMAPOBJ_LockBitmap(dcbmp);
+ if ( !BitmapObj )
+ {
+ BITMAPOBJ_UnlockBitmap(BitmapObj);
+ return 1; /* No Mouse */
+ }
+
+ SurfObj = &BitmapObj->SurfObj;
+ if (SurfObj == NULL)
+ {
+ BITMAPOBJ_UnlockBitmap(BitmapObj);
+ return 1; /* No mouse */
+ }
+
+ ppdev = GDIDEV(SurfObj);
+
+ if(ppdev == NULL)
+ {
+ BITMAPOBJ_UnlockBitmap(BitmapObj);
+ return 1; /* No mouse */
+ }
+
+ pgp = &ppdev->Pointer;
+
+ CurInfo = IntGetSysCursorInfo(WinSta);
+
+ if (Param == FALSE)
+ {
+ if (CurInfo->ShowingCursor != 0)
+ {
+ pgp->ShowPointer = 1;
+ //ppdev->SafetyRemoveCount = 1;
+ //ppdev->SafetyRemoveLevel = 1;
+ EngMovePointer(SurfObj,-1,-1,NULL);
+ CurInfo->ShowingCursor = 0;
+ }
+
+ }
+ else
+ {
+ /* Show Cursor */
+ pgp->ShowPointer = 0;
+ //ppdev->SafetyRemoveCount = 0;
+ //ppdev->SafetyRemoveLevel = 0;
+ EngMovePointer(SurfObj,-1,-1,NULL);
+ CurInfo->ShowingCursor = CURSOR_SHOWING;
+ }
+
+ BITMAPOBJ_UnlockBitmap(BitmapObj);
+ return 0;
+ }
+
+
UserEnterExclusive();
switch(Routine)
- {
+ {
case ONEPARAM_ROUTINE_GETMENU:
{
PWINDOW_OBJECT Window;
case TWOPARAM_ROUTINE_SETGUITHRDHANDLE:
{
- PUSER_MESSAGE_QUEUE MsgQueue = PsGetCurrentThread()->Tcb.Win32Thread->MessageQueue;
+ PUSER_MESSAGE_QUEUE MsgQueue = ((PW32THREAD)PsGetCurrentThread()->Tcb.Win32Thread)->MessageQueue;
ASSERT(MsgQueue);
RETURN( (DWORD)MsqSetStateWindow(MsgQueue, (ULONG)Param1, (HWND)Param2));
the current wallpaper bitmap */
HBITMAP hOldBitmap, hNewBitmap;
ASSERT(pvParam);
-
+ UNICODE_STRING Key = RTL_CONSTANT_STRING(L"Control Panel\\Desktop");
+ UNICODE_STRING Tile = RTL_CONSTANT_STRING(L"TileWallpaper");
+ UNICODE_STRING Style = RTL_CONSTANT_STRING(L"WallpaperStyle");
+ UNICODE_STRING KeyPath;
+ OBJECT_ATTRIBUTES KeyAttributes;
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ NTSTATUS Status;
+ HANDLE CurrentUserKey = NULL;
+ HANDLE KeyHandle = NULL;
+ PKEY_VALUE_PARTIAL_INFORMATION KeyValuePartialInfo;
+ ULONG Length = 0;
+ ULONG ResLength = 0;
+ ULONG TileNum = 0;
+ ULONG StyleNum = 0;
+
hNewBitmap = *(HBITMAP*)pvParam;
if(hNewBitmap != NULL)
{
/* delete the old wallpaper */
NtGdiDeleteObject(hOldBitmap);
}
+
+ /* Set the style */
+
+ /*default value is center */
+ WinStaObject->WallpaperMode = wmCenter;
+
+
+
+ /* Get a handle to the current users settings */
+ RtlFormatCurrentUserKeyPath(&KeyPath);
+ InitializeObjectAttributes(&ObjectAttributes,&KeyPath,OBJ_CASE_INSENSITIVE,NULL,NULL);
+ ZwOpenKey(&CurrentUserKey, KEY_READ, &ObjectAttributes);
+ RtlFreeUnicodeString(&KeyPath);
+
+ /* open up the settings to read the values */
+ InitializeObjectAttributes(&KeyAttributes, &Key, OBJ_CASE_INSENSITIVE,
+ CurrentUserKey, NULL);
+ ZwOpenKey(&KeyHandle, KEY_READ, &KeyAttributes);
+ ZwClose(CurrentUserKey);
+
+ /* read the tile value in the registry */
+ Status = ZwQueryValueKey(KeyHandle, &Tile, KeyValuePartialInformation,
+ 0, 0, &ResLength);
+
+ /* fall back to .DEFAULT if we didnt find values */
+ if(Status == STATUS_INVALID_HANDLE)
+ {
+ RtlInitUnicodeString (&KeyPath,L"\\Registry\\User\\.Default\\Control Panel\\Desktop");
+ InitializeObjectAttributes(&KeyAttributes, &KeyPath, OBJ_CASE_INSENSITIVE,
+ NULL, NULL);
+ ZwOpenKey(&KeyHandle, KEY_READ, &KeyAttributes);
+ ZwQueryValueKey(KeyHandle, &Tile, KeyValuePartialInformation,
+ 0, 0, &ResLength);
+ }
+
+ ResLength += sizeof(KEY_VALUE_PARTIAL_INFORMATION);
+ KeyValuePartialInfo = ExAllocatePoolWithTag(PagedPool, ResLength, TAG_STRING);
+ Length = ResLength;
+
+ if(!KeyValuePartialInfo)
+ {
+ NtClose(KeyHandle);
+ return 0;
+ }
+
+ Status = ZwQueryValueKey(KeyHandle, &Tile, KeyValuePartialInformation,
+ (PVOID)KeyValuePartialInfo, Length, &ResLength);
+ if(!NT_SUCCESS(Status) || (KeyValuePartialInfo->Type != REG_SZ))
+ {
+ ZwClose(KeyHandle);
+ ExFreePool(KeyValuePartialInfo);
+ return 0;
+ }
+
+ Tile.Length = KeyValuePartialInfo->DataLength;
+ Tile.MaximumLength = KeyValuePartialInfo->DataLength;
+ Tile.Buffer = (PWSTR)KeyValuePartialInfo->Data;
+
+ Status = RtlUnicodeStringToInteger(&Tile, 0, &TileNum);
+ if(!NT_SUCCESS(Status))
+ {
+ TileNum = 0;
+ }
+ ExFreePool(KeyValuePartialInfo);
+
+ /* start over again and look for the style*/
+ ResLength = 0;
+ Status = ZwQueryValueKey(KeyHandle, &Style, KeyValuePartialInformation,
+ 0, 0, &ResLength);
+
+ ResLength += sizeof(KEY_VALUE_PARTIAL_INFORMATION);
+ KeyValuePartialInfo = ExAllocatePoolWithTag(PagedPool, ResLength, TAG_STRING);
+ Length = ResLength;
+
+ if(!KeyValuePartialInfo)
+ {
+ ZwClose(KeyHandle);
+ return 0;
+ }
+
+ Status = ZwQueryValueKey(KeyHandle, &Style, KeyValuePartialInformation,
+ (PVOID)KeyValuePartialInfo, Length, &ResLength);
+ if(!NT_SUCCESS(Status) || (KeyValuePartialInfo->Type != REG_SZ))
+ {
+ ZwClose(KeyHandle);
+ ExFreePool(KeyValuePartialInfo);
+ return 0;
+ }
+
+ Style.Length = KeyValuePartialInfo->DataLength;
+ Style.MaximumLength = KeyValuePartialInfo->DataLength;
+ Style.Buffer = (PWSTR)KeyValuePartialInfo->Data;
+
+ Status = RtlUnicodeStringToInteger(&Style, 0, &StyleNum);
+ if(!NT_SUCCESS(Status))
+ {
+ StyleNum = 0;
+ }
+ ExFreePool(KeyValuePartialInfo);
+
+ /* Check the values we found in the registry */
+ if(TileNum && !StyleNum)
+ {
+ WinStaObject->WallpaperMode = wmTile;
+ }
+ else if(!TileNum && StyleNum == 2)
+ {
+ WinStaObject->WallpaperMode = wmStretch;
+ }
+
+ ZwClose(KeyHandle);
break;
}
case SPI_GETDESKWALLPAPER:
SetLastWin32Error(ERROR_ACCESS_DENIED);
RETURN( FALSE);
}
- Desktop = Thread->Tcb.Win32Thread->Desktop;
+ Desktop = ((PW32THREAD)Thread->Tcb.Win32Thread)->Desktop;
}
else
{
/* get the foreground thread */
- PW32THREAD W32Thread = PsGetCurrentThread()->Tcb.Win32Thread;
+ PW32THREAD W32Thread = (PW32THREAD)PsGetCurrentThread()->Tcb.Win32Thread;
Desktop = W32Thread->Desktop;
if(Desktop)
{