Index: trunk/src/user32/new/loadres.cpp
===================================================================
--- trunk/src/user32/new/loadres.cpp	(revision 626)
+++ trunk/src/user32/new/loadres.cpp	(revision 627)
@@ -1,3 +1,3 @@
-/* $Id: loadres.cpp,v 1.9 1999-08-22 11:10:34 sandervl Exp $ */
+/* $Id: loadres.cpp,v 1.10 1999-08-22 16:46:58 dengert Exp $ */
 
 /*
@@ -9,5 +9,5 @@
  *
  * Copyright 1993 Alexandre Julliard
- *           1998 Huw D M Davies
+ *	     1998 Huw D M Davies
  *
  * Project Odin Software License can be found in LICENSE.TXT
@@ -29,5 +29,5 @@
  Win32Resource *winres;
  LPWSTR  resstring;
- int     resstrlen = 0;
+ int	 resstrlen = 0;
 
     winres = (Win32Resource *)FindResourceA(hinst, (LPSTR)wID, RT_STRINGA);
@@ -36,5 +36,5 @@
 	return 0;
     }
-    
+
     resstring = (LPWSTR)winres->lockResource();
     if(resstring) {
@@ -56,5 +56,5 @@
  Win32Resource *winres;
  LPWSTR resstring;
- int    resstrlen = 0;
+ int	resstrlen = 0;
 
     winres = (Win32Resource *)FindResourceW(hinst, (LPWSTR)wID, RT_STRINGW);
@@ -63,5 +63,5 @@
 	return 0;
     }
-    
+
     resstring = (LPWSTR)winres->lockResource();
     if(resstring) {
@@ -81,16 +81,16 @@
 {
  Win32Resource *winres;
- HICON          hIcon;
+ HICON		hIcon;
 
     hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon);
     if(hIcon == 0) {//not a system icon
-    	winres = (Win32Resource *)FindResourceA(hinst, lpszIcon, RT_ICONA);
-    	if(winres == 0) {
-    		winres = (Win32Resource *)FindResourceA(hinst, lpszIcon, RT_GROUP_ICONA);
-    	}
-    	if(winres) {
+	winres = (Win32Resource *)FindResourceA(hinst, lpszIcon, RT_ICONA);
+	if(winres == 0) {
+		winres = (Win32Resource *)FindResourceA(hinst, lpszIcon, RT_GROUP_ICONA);
+	}
+	if(winres) {
 		hIcon = OSLibWinCreateIcon(winres->lockOS2Resource());
 		delete winres;
-    	}
+	}
     }
     dprintf(("LoadIconA (%X) returned %x\n", hinst, hIcon));
@@ -103,16 +103,16 @@
 {
  Win32Resource *winres;
- HICON          hIcon;
+ HICON		hIcon;
 
     hIcon = OSLibWinQuerySysIcon((ULONG)lpszIcon);
     if(hIcon == 0) {//not a system icon
-    	winres = (Win32Resource *)FindResourceW(hinst, lpszIcon, RT_ICONW);
-    	if(winres == 0) {
-    		winres = (Win32Resource *)FindResourceW(hinst, lpszIcon, RT_GROUP_ICONW);
-    	}
-    	if(winres) {
+	winres = (Win32Resource *)FindResourceW(hinst, lpszIcon, RT_ICONW);
+	if(winres == 0) {
+		winres = (Win32Resource *)FindResourceW(hinst, lpszIcon, RT_GROUP_ICONW);
+	}
+	if(winres) {
 		hIcon = OSLibWinCreateIcon(winres->lockOS2Resource());
 		delete winres;
-    	}
+	}
     }
     dprintf(("LoadIconW (%X) returned %x\n", hinst, hIcon));
@@ -125,16 +125,16 @@
 {
  Win32Resource *winres;
- HCURSOR        hCursor;
+ HCURSOR	hCursor;
 
     hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor);
     if(hCursor == 0) {//not a system pointer
-    	winres = (Win32Resource *)FindResourceA(hinst, lpszCursor, RT_CURSORA);
-    	if(winres == 0) {
-    		winres = (Win32Resource *)FindResourceA(hinst, lpszCursor, RT_GROUP_CURSORA);
-    	}
-    	if(winres) {
+	winres = (Win32Resource *)FindResourceA(hinst, lpszCursor, RT_CURSORA);
+	if(winres == 0) {
+		winres = (Win32Resource *)FindResourceA(hinst, lpszCursor, RT_GROUP_CURSORA);
+	}
+	if(winres) {
 		hCursor = OSLibWinCreatePointer(winres->lockOS2Resource());
 		delete winres;
-    	}
+	}
     }
     dprintf(("LoadCursorA (%X) returned %x\n", hinst, hCursor));
@@ -147,16 +147,16 @@
 {
  Win32Resource *winres;
- HCURSOR        hCursor;
+ HCURSOR	hCursor;
 
     hCursor = OSLibWinQuerySysPointer((ULONG)lpszCursor);
     if(hCursor == 0) {//not a system pointer
-    	winres = (Win32Resource *)FindResourceW(hinst, lpszCursor, RT_CURSORW);
-    	if(winres == 0) {
-    		winres = (Win32Resource *)FindResourceW(hinst, lpszCursor, RT_GROUP_CURSORW);
-    	}
-    	if(winres) {
+	winres = (Win32Resource *)FindResourceW(hinst, lpszCursor, RT_CURSORW);
+	if(winres == 0) {
+		winres = (Win32Resource *)FindResourceW(hinst, lpszCursor, RT_GROUP_CURSORW);
+	}
+	if(winres) {
 		hCursor = OSLibWinCreatePointer(winres->lockOS2Resource());
 		delete winres;
-    	}
+	}
     }
     dprintf(("LoadCursorW (%X) returned %x\n", hinst, hCursor));
@@ -170,57 +170,57 @@
    switch(*id)
    {
-      	case OBM_UPARROW_W:
-      	case OBM_DNARROW_W:
-      	case OBM_RGARROW_W:
-      	case OBM_LFARROW_W:
-      	case OBM_RESTORE_W:
-      	case OBM_RESTORED_W:
-      	case OBM_UPARROWD_W:
-      	case OBM_DNARROWD_W:
-      	case OBM_RGARROWD_W:
-      	case OBM_LFARROWD_W:
-      	case OBM_OLD_UPARROW_W:
-      	case OBM_OLD_DNARROW_W:
-      	case OBM_OLD_RGARROW_W:
-      	case OBM_OLD_LFARROW_W:
-      	case OBM_CHECK_W:
-      	case OBM_CHECKBOXES_W:
-      	case OBM_BTNCORNERS_W:
-      	case OBM_COMBO_W:
-      	case OBM_REDUCE_W:
-      	case OBM_REDUCED_W:
-      	case OBM_ZOOM_W:
-      	case OBM_ZOOMD_W:
-      	case OBM_SIZE_W:
-      	case OBM_CLOSE_W:
-      	case OBM_MNARROW_W:
-      	case OBM_UPARROWI_W:
-      	case OBM_DNARROWI_W:
-      	case OBM_RGARROWI_W:
-      	case OBM_LFARROWI_W:
+	case OBM_UPARROW_W:
+	case OBM_DNARROW_W:
+	case OBM_RGARROW_W:
+	case OBM_LFARROW_W:
+	case OBM_RESTORE_W:
+	case OBM_RESTORED_W:
+	case OBM_UPARROWD_W:
+	case OBM_DNARROWD_W:
+	case OBM_RGARROWD_W:
+	case OBM_LFARROWD_W:
+	case OBM_OLD_UPARROW_W:
+	case OBM_OLD_DNARROW_W:
+	case OBM_OLD_RGARROW_W:
+	case OBM_OLD_LFARROW_W:
+	case OBM_CHECK_W:
+	case OBM_CHECKBOXES_W:
+	case OBM_BTNCORNERS_W:
+	case OBM_COMBO_W:
+	case OBM_REDUCE_W:
+	case OBM_REDUCED_W:
+	case OBM_ZOOM_W:
+	case OBM_ZOOMD_W:
+	case OBM_SIZE_W:
+	case OBM_CLOSE_W:
+	case OBM_MNARROW_W:
+	case OBM_UPARROWI_W:
+	case OBM_DNARROWI_W:
+	case OBM_RGARROWI_W:
+	case OBM_LFARROWI_W:
 		return TRUE;
 
 	//TODO: Not supported by Open32. Replacement may not be accurate
-      	case OBM_OLD_CLOSE_W:
+	case OBM_OLD_CLOSE_W:
 		*id = OBM_CLOSE_W;
 		return TRUE;
 
-      	case OBM_BTSIZE_W:
+	case OBM_BTSIZE_W:
 		*id = OBM_SIZE_W;
 		return TRUE;
 
-      	case OBM_OLD_REDUCE_W:
+	case OBM_OLD_REDUCE_W:
 		*id = OBM_REDUCE_W;
 		return TRUE;
 
-      	case OBM_OLD_ZOOM_W:
+	case OBM_OLD_ZOOM_W:
 		*id = OBM_ZOOM_W;
 		return TRUE;
 
-      	case OBM_OLD_RESTORE_W:
+	case OBM_OLD_RESTORE_W:
 		*id = OBM_RESTORE_W;
 		return TRUE;
 
-     	default:
+	default:
 		return FALSE;
    }
@@ -229,6 +229,6 @@
 //NOTE: LR_CREATEDIBSECTION flag doesn't work (crash in GDI32)!
 //******************************************************************************
-HANDLE LoadBitmapA(HINSTANCE hinst, LPCSTR lpszName, int cxDesired, int cyDesired, 
-                   UINT fuLoad)
+HANDLE LoadBitmapA(HINSTANCE hinst, LPCSTR lpszName, int cxDesired, int cyDesired,
+		   UINT fuLoad)
 {
     HBITMAP hbitmap = 0;
@@ -249,17 +249,17 @@
     else
     {
-        if (!(ptr = (char *)VIRTUAL_MapFileA( lpszName ))) return 0;
-        info = (BITMAPINFO *)(ptr + sizeof(BITMAPFILEHEADER));
+	if (!(ptr = (char *)VIRTUAL_MapFileA( lpszName ))) return 0;
+	info = (BITMAPINFO *)(ptr + sizeof(BITMAPFILEHEADER));
     }
 
     //TODO: This has to be removed once pe2lx stores win32 resources!!!
-    if (info->bmiHeader.biSize != sizeof(BITMAPCOREHEADER) && 
-        info->bmiHeader.biSize != sizeof(BITMAPINFOHEADER)) 
+    if (info->bmiHeader.biSize != sizeof(BITMAPCOREHEADER) &&
+	info->bmiHeader.biSize != sizeof(BITMAPINFOHEADER))
     {//assume it contains a file header first
-  	info = (BITMAPINFO *)((char *)info + sizeof(BITMAPFILEHEADER));
+	info = (BITMAPINFO *)((char *)info + sizeof(BITMAPFILEHEADER));
     }
 
     size = DIB_BitmapInfoSize(info, DIB_RGB_COLORS);
-    if ((hFix = GlobalAlloc(0, size))) fix_info = (BITMAPINFO *)GlobalLock(hFix);
+    if ((hFix = GlobalAlloc(0, size)) != NULL) fix_info = (BITMAPINFO *)GlobalLock(hFix);
     if (fix_info) {
       BYTE pix;
@@ -269,17 +269,17 @@
       DIB_FixColorsToLoadflags(fix_info, fuLoad, pix);
       if ((hdc = GetDC(0)) != 0) {
-        char *bits = (char *)info + size;
+	char *bits = (char *)info + size;
 	if (fuLoad & LR_CREATEDIBSECTION) {
-          DIBSECTION dib;
+	  DIBSECTION dib;
 	  hbitmap = CreateDIBSection(hdc, fix_info, DIB_RGB_COLORS, NULL, 0, 0);
-          GetObjectA(hbitmap, sizeof(DIBSECTION), &dib);
-          SetDIBits(hdc, hbitmap, 0, dib.dsBm.bmHeight, bits, info, 
-                    DIB_RGB_COLORS);
-        }
-        else {
-          hbitmap = CreateDIBitmap( hdc, &fix_info->bmiHeader, CBM_INIT,
-                                      bits, fix_info, DIB_RGB_COLORS );
-	}
-        ReleaseDC( 0, hdc );
+	  GetObjectA(hbitmap, sizeof(DIBSECTION), &dib);
+	  SetDIBits(hdc, hbitmap, 0, dib.dsBm.bmHeight, bits, info,
+		    DIB_RGB_COLORS);
+	}
+	else {
+	  hbitmap = CreateDIBitmap( hdc, &fix_info->bmiHeader, CBM_INIT,
+				      bits, fix_info, DIB_RGB_COLORS );
+	}
+	ReleaseDC( 0, hdc );
       }
       GlobalUnlock(hFix);
@@ -303,5 +303,5 @@
   }
   dprintf(("LoadBitmapA returned %08xh\n", hBitmap));
-  
+
   return(hBitmap);
 }
@@ -317,7 +317,7 @@
   }
   else {
-    	if(HIWORD(lpszBitmap) != 0) {
+	if(HIWORD(lpszBitmap) != 0) {
 		 lpszBitmap = (LPWSTR)UnicodeToAsciiString((LPWSTR)lpszBitmap);
-    	}
+	}
 	hBitmap = LoadBitmapA(hinst, (LPSTR)lpszBitmap, 0, 0, 0);
   }
@@ -327,5 +327,5 @@
 
   dprintf(("LoadBitmapW returned %08xh\n", hBitmap));
-  
+
   return(hBitmap);
 }
@@ -335,5 +335,5 @@
 //******************************************************************************
 HANDLE WIN32API LoadImageA(HINSTANCE hinst, LPCSTR lpszName, UINT uType,
-		           int cxDesired, int cyDesired, UINT fuLoad)
+			   int cxDesired, int cyDesired, UINT fuLoad)
 {
  HANDLE hRet = 0;
@@ -342,10 +342,10 @@
 
   if (fuLoad & LR_DEFAULTSIZE) {
-        if (uType == IMAGE_ICON) {
+	if (uType == IMAGE_ICON) {
 	    if (!cxDesired) cxDesired = GetSystemMetrics(SM_CXICON);
 	    if (!cyDesired) cyDesired = GetSystemMetrics(SM_CYICON);
-	} 
+	}
 	else if (uType == IMAGE_CURSOR) {
-            if (!cxDesired) cxDesired = GetSystemMetrics(SM_CXCURSOR);
+	    if (!cxDesired) cxDesired = GetSystemMetrics(SM_CXCURSOR);
 	    if (!cyDesired) cyDesired = GetSystemMetrics(SM_CYCURSOR);
 	}
@@ -381,10 +381,10 @@
 
   if (fuLoad & LR_DEFAULTSIZE) {
-        if (uType == IMAGE_ICON) {
+	if (uType == IMAGE_ICON) {
 	    if (!cxDesired) cxDesired = GetSystemMetrics(SM_CXICON);
 	    if (!cyDesired) cyDesired = GetSystemMetrics(SM_CYICON);
-	} 
+	}
 	else if (uType == IMAGE_CURSOR) {
-            if (!cxDesired) cxDesired = GetSystemMetrics(SM_CXCURSOR);
+	    if (!cxDesired) cxDesired = GetSystemMetrics(SM_CXCURSOR);
 	    if (!cyDesired) cyDesired = GetSystemMetrics(SM_CYCURSOR);
 	}
