[YAROTOWS] Reintegrate the branch. For a brighter future.
[reactos.git] / reactos / dll / win32 / user32 / windows / class.c
index cf45f18..70171c6 100644 (file)
@@ -32,8 +32,11 @@ GetClassInfoExA(
         IS_ATOM(lpszClass) ? lpszClass : 0,
         lpwcx);
 
-    //HACKHACK: This is ROS-specific and should go away
-    lpwcx->cbSize = sizeof(*lpwcx);
+    if (!lpwcx)
+    {
+       SetLastError( ERROR_NOACCESS );
+       return FALSE;
+    }
 
     if (hInstance == User32Instance)
     {
@@ -105,8 +108,14 @@ GetClassInfoExW(
         IS_ATOM(lpszClass) ? lpszClass : 0,
         lpwcx);
 
-    //HACKHACK: This is ROS-specific and should go away
-    lpwcx->cbSize = sizeof(*lpwcx);
+    /* From wine, for speed only, ReactOS supports the correct return in
+     * Win32k. cbSize is ignored.
+     */
+    if (!lpwcx)
+    {
+       SetLastError( ERROR_NOACCESS );
+       return FALSE;
+    }
 
     if (hInstance == User32Instance)
     {
@@ -289,7 +298,7 @@ IntGetWndProc(PWND pWnd, BOOL Ansi)
      }
      return Ret;
   }
-  // Wine Class tests: 
+  // Wine Class tests:
   /*  Edit controls are special - they return a wndproc handle when
       GetWindowLongPtr is called with a different A/W.
       On the other hand there is no W->A->W conversion so this control
@@ -822,7 +831,6 @@ CreateSmallIcon(HICON StdIcon)
    int SmallIconWidth;
    int SmallIconHeight;
    BITMAP StdBitmapInfo;
-   HDC hInfoDc = NULL;
    HDC hSourceDc = NULL;
    HDC hDestDc = NULL;
    ICONINFO SmallInfo;
@@ -858,15 +866,6 @@ CreateSmallIcon(HICON StdIcon)
       return StdIcon;
    }
 
-   /* Get a handle to a info DC and handles to DCs which can be used to
-      select a bitmap into. This is done to avoid triggering a switch to
-      graphics mode (if we're currently in text/blue screen mode) */
-   hInfoDc = CreateICW(NULL, NULL, NULL, NULL);
-   if (NULL == hInfoDc)
-   {
-      ERR("Failed to create info DC\n");
-      goto cleanup;
-   }
    hSourceDc = CreateCompatibleDC(NULL);
    if (NULL == hSourceDc)
    {
@@ -886,7 +885,7 @@ CreateSmallIcon(HICON StdIcon)
       ERR("Failed to select source color bitmap\n");
       goto cleanup;
    }
-   SmallInfo.hbmColor = CreateCompatibleBitmap(hInfoDc, SmallIconWidth,
+   SmallInfo.hbmColor = CreateCompatibleBitmap(hSourceDc, SmallIconWidth,
                                               SmallIconHeight);
    if (NULL == SmallInfo.hbmColor)
    {
@@ -912,8 +911,7 @@ CreateSmallIcon(HICON StdIcon)
       ERR("Failed to select source mask bitmap\n");
       goto cleanup;
    }
-   SmallInfo.hbmMask = CreateBitmap(SmallIconWidth, SmallIconHeight, 1, 1,
-                                    NULL);
+   SmallInfo.hbmMask = CreateCompatibleBitmap(hSourceDc, SmallIconWidth, SmallIconHeight);
    if (NULL == SmallInfo.hbmMask)
    {
       ERR("Failed to create mask bitmap\n");
@@ -967,10 +965,6 @@ cleanup:
    {
       DeleteDC(hSourceDc);
    }
-   if (NULL != hInfoDc)
-   {
-      DeleteDC(hInfoDc);
-   }
 
    return SmallIcon;
 }
@@ -1061,9 +1055,9 @@ RegisterClassExWOWW(WNDCLASSEXW *lpwcx,
    clsMenuName.pszClientAnsiMenuName = AnsiMenuName.Buffer;
    clsMenuName.pwszClientUnicodeMenuName = MenuName.Buffer;
    clsMenuName.pusMenuName = &MenuName;
-   
+
    Atom = NtUserRegisterClassExWOW( &WndClass,
-                                    &ClassName,  
+                                    &ClassName,
                                      NULL, //PUNICODE_STRING ClsNVersion,
                                     &clsMenuName,
                                      fnID,