Author: jimtabor
Date: Fri Dec 19 16:33:11 2008
New Revision: 38189
URL: 
http://svn.reactos.org/svn/reactos?rev=38189&view=rev
Log:
- Properly implement LookupIconIdFromDirectoryEx.
- Remove hack for GetDeviceCaps.
- This fixes one part of the Win32k Initialization Bug. If this change creates a problem
some where else, the problem is not in this change.
Modified:
    trunk/reactos/dll/win32/gdi32/objects/dc.c
    trunk/reactos/dll/win32/user32/windows/icon.c
    trunk/reactos/dll/win32/user32/windows/input.c
Modified: trunk/reactos/dll/win32/gdi32/objects/dc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/dc…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/dc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/objects/dc.c [iso-8859-1] Fri Dec 19 16:33:11 2008
@@ -505,11 +505,6 @@
   }
   else
   {
-     // HAX!!!!
-     // Due to winlogon process/thread mapping issues we have this hax!
-     // FIXME!!! This is a victim of the Win32k Initialization BUG!!!!!
-     return NtGdiGetDeviceCaps(hDC,i);
-
      if (!GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
         return 0;
      if (!(Dc_Attr->ulDirty_ & DC_PRIMARY_DISPLAY) )
Modified: trunk/reactos/dll/win32/user32/windows/icon.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/i…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/icon.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/icon.c [iso-8859-1] Fri Dec 19 16:33:11 2008
@@ -658,6 +658,9 @@
 {
     GRPCURSORICONDIR *dir = (GRPCURSORICONDIR*)xdir;
     UINT retVal = 0;
+
+    GetConnected();
+
     if(dir && !dir->idReserved && (IMAGE_ICON == dir->idType ||
IMAGE_CURSOR == dir->idType))
     {
         GRPCURSORICONDIRENTRY *entry = NULL;
@@ -667,11 +670,13 @@
         {
             ColorBits = 1;
         }
+        else if (g_psi->SystemMetrics[SM_SAMEDISPLAYFORMAT] || (cFlag &
LR_VGACOLOR) )
+        {
+            ColorBits = 4;
+        }
         else
         {
-            HDC hdc = CreateICW(NULL, NULL, NULL, NULL);
-            ColorBits = GetDeviceCaps(hdc, BITSPIXEL);
-            DeleteDC(hdc);
+            ColorBits = 0;
         }
         if(bIcon)
Modified: trunk/reactos/dll/win32/user32/windows/input.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/i…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/input.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/input.c [iso-8859-1] Fri Dec 19 16:33:11 2008
@@ -153,6 +153,8 @@
 SHORT WINAPI
 GetAsyncKeyState(int vKey)
 {
+ if (vKey < 0 || vKey > 256)
+    return 0;
  return (SHORT) NtUserGetAsyncKeyState((DWORD) vKey);
 }