solv the issue with mouse poiter is hide, do not show the mousepointer when you are...
[reactos.git] / reactos / subsys / win32k / ntuser / misc.c
index 4eaff9f..4f3d40b 100644 (file)
@@ -11,7 +11,8 @@
 
 #include <w32k.h>
 
-#define NDEBUG
+//#define NDEBUG
+#undef NDEBUG
 #include <debug.h>
 
 /* registered Logon process */
@@ -164,6 +165,7 @@ CLEANUP:
    END_CLEANUP;
 }
 
+
 /*
  * @implemented
  */
@@ -176,10 +178,92 @@ NtUserCallOneParam(
    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;
@@ -985,12 +1069,23 @@ IntSystemParametersInfo(
                      InitializeObjectAttributes(&KeyAttributes, &Key, OBJ_CASE_INSENSITIVE,
                               CurrentUserKey, NULL);
                      ZwOpenKey(&KeyHandle, KEY_READ, &KeyAttributes);
-                     NtClose(CurrentUserKey);
+                     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;
@@ -1005,7 +1100,7 @@ IntSystemParametersInfo(
                                               (PVOID)KeyValuePartialInfo, Length, &ResLength);
                      if(!NT_SUCCESS(Status) || (KeyValuePartialInfo->Type != REG_SZ))
                      {
-                        NtClose(KeyHandle);
+                        ZwClose(KeyHandle);
                         ExFreePool(KeyValuePartialInfo);
                         return 0;
                      }
@@ -1032,7 +1127,7 @@ IntSystemParametersInfo(
 
                      if(!KeyValuePartialInfo)
                      {
-                        NtClose(KeyHandle);
+                        ZwClose(KeyHandle);
                         return 0;
                      }
 
@@ -1040,7 +1135,7 @@ IntSystemParametersInfo(
                                               (PVOID)KeyValuePartialInfo, Length, &ResLength);
                      if(!NT_SUCCESS(Status) || (KeyValuePartialInfo->Type != REG_SZ))
                      {
-                        NtClose(KeyHandle);
+                        ZwClose(KeyHandle);
                         ExFreePool(KeyValuePartialInfo);
                         return 0;
                      }
@@ -1066,7 +1161,7 @@ IntSystemParametersInfo(
                         WinStaObject->WallpaperMode = wmStretch;
                      }
                      
-                     NtClose(KeyHandle);
+                     ZwClose(KeyHandle);
                      break;
                   }
                case SPI_GETDESKWALLPAPER: