Index: trunk/src/kernel32/Fileio.cpp
===================================================================
--- trunk/src/kernel32/Fileio.cpp	(revision 4533)
+++ trunk/src/kernel32/Fileio.cpp	(revision 4534)
@@ -1,8 +1,8 @@
-/* $Id: Fileio.cpp,v 1.43 2000-10-02 18:39:32 sandervl Exp $ */
+/* $Id: Fileio.cpp,v 1.44 2000-10-26 17:21:38 sandervl Exp $ */
 
 /*
  * Win32 File IO API functions for OS/2
  *
- * Copyright 1998 Sander van Leeuwen
+ * Copyright 1998-2000 Sander van Leeuwen
  * Copyright 1998 Patrick Haller
  *
@@ -89,18 +89,18 @@
  int    namelen;
 
-  dprintf(("FindFirstFileA %s", lpFileName));
-  if(lpFileName == NULL || lpFindFileData == NULL) {
-  SetLastError(ERROR_INVALID_PARAMETER);
-  return -1;
-  }
-  namelen = strlen(lpFileName);
-  if(lpFileName[namelen-1] == '\\') {
-  filename = (char *)alloca(namelen+1);
-  strcpy(filename, lpFileName);
-  filename[namelen-1] = 0;
-  }
-  else  filename = (char *)lpFileName;
-
-  return (HANDLE)OSLibDosFindFirst(filename,lpFindFileData);
+    dprintf(("FindFirstFileA %s", lpFileName));
+    if(lpFileName == NULL || lpFindFileData == NULL) {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return -1;
+    }
+    namelen = strlen(lpFileName);
+    if(lpFileName[namelen-1] == '\\') {
+        filename = (char *)alloca(namelen+1);
+        strcpy(filename, lpFileName);
+        filename[namelen-1] = 0;
+    }
+    else  filename = (char *)lpFileName;
+
+    return (HANDLE)OSLibDosFindFirst(filename,lpFindFileData);
 }
 //******************************************************************************
@@ -112,5 +112,5 @@
               DWORD *,count)
 {
-  return (HANDLE)OSLibDosFindFirstMulti(lpFileName,lpFindFileData,count);
+    return (HANDLE)OSLibDosFindFirstMulti(lpFileName,lpFindFileData,count);
 }
 //******************************************************************************
@@ -124,11 +124,12 @@
   WIN32_FIND_DATAA wfda;
 
-  astring = UnicodeToAsciiString((LPWSTR)lpFileName);
-  rc = (HANDLE)OSLibDosFindFirst(astring,&wfda);
-
-  if(rc == -1) {
+    astring = UnicodeToAsciiString((LPWSTR)lpFileName);
+    dprintf(("FindFirstFileW %s", astring));
+    rc = (HANDLE)OSLibDosFindFirst(astring,&wfda);
+
+    if(rc == -1) {
         memset(lpFindFileData, 0, sizeof(WIN32_FIND_DATAW));
-  }
-  else {
+    }
+    else {
         // convert back the result structure
         memcpy(lpFindFileData,
@@ -143,7 +144,7 @@
                       wfda.cAlternateFileName,
                       sizeof(wfda.cAlternateFileName));
-  }
-  FreeAsciiString(astring);
-  return(rc);
+    }
+    FreeAsciiString(astring);
+    return(rc);
 }
 //******************************************************************************
@@ -153,5 +154,5 @@
               WIN32_FIND_DATAA *, lpFindFileData)
 {
-  return OSLibDosFindNext(hFindFile,lpFindFileData);
+    return OSLibDosFindNext(hFindFile,lpFindFileData);
 }
 //******************************************************************************
Index: trunk/src/kernel32/KERNEL32.CPP
===================================================================
--- trunk/src/kernel32/KERNEL32.CPP	(revision 4533)
+++ trunk/src/kernel32/KERNEL32.CPP	(revision 4534)
@@ -1,3 +1,3 @@
-/* $Id: KERNEL32.CPP,v 1.56 2000-10-04 19:36:24 sandervl Exp $ */
+/* $Id: KERNEL32.CPP,v 1.57 2000-10-26 17:21:38 sandervl Exp $ */
 
 /*
@@ -178,7 +178,6 @@
 //******************************************************************************
 //******************************************************************************
-UINT WIN32API GetACP(VOID)
-{
-  dprintf(("KERNEL32:  GetACP\n"));
+ODINFUNCTION0(UINT, GetACP)
+{
   return(O32_GetACP());
 }
Index: trunk/src/kernel32/registry.cpp
===================================================================
--- trunk/src/kernel32/registry.cpp	(revision 4533)
+++ trunk/src/kernel32/registry.cpp	(revision 4534)
@@ -1,3 +1,3 @@
-/* $Id: registry.cpp,v 1.6 2000-10-21 14:30:47 sandervl Exp $ */
+/* $Id: registry.cpp,v 1.7 2000-10-26 17:21:39 sandervl Exp $ */
 
 /*
@@ -8,4 +8,7 @@
  * Copyright 1998 Sander van Leeuwen
  * Copyright 1998 Patrick Haller
+ *
+ *
+ * TODO: Many unicode apis are still wrong (missing unicode conversions and wrong sizes)!!!!!
  *
  * Project Odin Software License can be found in LICENSE.TXT
@@ -439,5 +442,5 @@
   if(rc == ERROR_SUCCESS)
   {
-    astring = (char *)malloc(max(*arg4, *arg7));   //class & keyname
+    astring = (char *)malloc(max(*arg4+1, *arg7+1));   //class & keyname
     strcpy(astring, (char *)arg3);
     AsciiToUnicode(astring, arg3);
@@ -497,30 +500,57 @@
  *****************************************************************************/
 
-ODINFUNCTION8(LONG,RegEnumValueW,HKEY,   arg1,
-                                 DWORD,  arg2,
-                                 LPWSTR, arg3,
-                                 LPDWORD,arg4,
-                                 LPDWORD,arg5,
-                                 LPDWORD,arg6,
-                                 LPBYTE, arg7,
-                                 LPDWORD,arg8)
+ODINFUNCTION8(LONG,RegEnumValueW,HKEY,   hkey,
+                                 DWORD,  iValue,
+                                 LPWSTR, lpszValue,
+                                 LPDWORD,lpcchValue,
+                                 LPDWORD,lpdwReserved,
+                                 LPDWORD,lpdwType,
+                                 LPBYTE, lpbData,
+                                 LPDWORD,lpcbData)
 {
   char *astring;
-  LONG  rc;
-
-  rc = O32_RegEnumValue(ConvertKey(arg1),
-                        arg2,
-                        (char *)arg3,
-                        arg4,
-                        arg5,
-                        arg6,
-                        arg7,
-                        arg8);
+  LONG  rc, oldsize = 0;
+
+  if(lpcbData) {
+    oldsize = *lpcbData;
+  }
+  rc = O32_RegEnumValue(ConvertKey(hkey),
+                        iValue,
+                        (char *)lpszValue,
+                        lpcchValue,
+                        lpdwReserved,
+                        lpdwType,
+                        lpbData,
+                        lpcbData);
   if(rc == ERROR_SUCCESS)
   {
-    astring = (char *)malloc(*arg4);
-    strcpy(astring, (char *)arg3);
-    AsciiToUnicode(astring, arg3);
+    astring = (char *)malloc(*lpcchValue+1); //+ 0 terminator
+    strcpy(astring, (char *)lpszValue);
+    AsciiToUnicode(astring, lpszValue);
     free(astring);
+
+    if(lpcbData && lpbData)
+    {
+        switch(*lpdwType) {
+        case REG_SZ:
+        case REG_EXPAND_SZ:
+            if(oldsize < *lpcbData*sizeof(WCHAR)) {
+                *lpcbData = *lpcbData*sizeof(WCHAR);
+                return ERROR_MORE_DATA;
+            }
+            astring = (char *)malloc(*lpcbData);
+            strcpy(astring, (char *)lpbData);
+            lstrcpyAtoW((LPWSTR)lpbData, astring);
+            free(astring);
+            break;
+        case REG_MULTI_SZ:
+        case REG_LINK: //???
+            dprintf(("ERROR: key data must be translated from Unicode to Ascii!!"));
+            break;
+        default:
+            break;
+        }
+    }
+
   }
   return(rc);
@@ -712,42 +742,43 @@
  *****************************************************************************/
 
-ODINFUNCTION12(LONG,RegQueryInfoKeyW,HKEY,       arg1,
-                                      LPWSTR,     arg2,
-                                      LPDWORD,    arg3,
-                                      LPDWORD,    arg4,
-                                      LPDWORD,    arg5,
-                                      LPDWORD,    arg6,
-                                      LPDWORD,    arg7,
-                                      LPDWORD,    arg8,
-                                      LPDWORD,    arg9,
-                                      LPDWORD,    arg10,
-                                      LPDWORD,    arg11,
-                                      LPFILETIME, arg12)
+ODINFUNCTION12(LONG,RegQueryInfoKeyW,HKEY,       hkey,
+                                     LPWSTR,     lpszClass,
+                                     LPDWORD,    lpcchClass,
+                                     LPDWORD,    lpdwReserved,
+                                     LPDWORD,    lpcSubKeys,
+                                     LPDWORD,    lpcchMaxSubKey,
+                                     LPDWORD,    lpcchMaxClass,
+                                     LPDWORD,    lpcValues,
+                                     LPDWORD,    lpcchMaxValueName,
+                                     LPDWORD,    lpcbMaxValueData,
+                                     LPDWORD,    lpcbSecurityDescriptor,
+                                     LPFILETIME, lpftLastWriteTime)
 {
   char *astring;
   LONG  rc;
 
-  rc = O32_RegQueryInfoKey(ConvertKey(arg1),
-                           (char *)arg2,
-                           arg3,
-                           arg4,
-                           arg5,
-                           arg6,
-                           arg7,
-                           arg8,
-                           arg9,
-                           arg10,
-                           arg11,
-                           arg12);
+  rc = O32_RegQueryInfoKey(ConvertKey(hkey),
+                           (char *)lpszClass,
+                           lpcchClass,
+                           lpdwReserved,
+                           lpcSubKeys,
+                           lpcchMaxSubKey,
+                           lpcchMaxClass,
+                           lpcValues,
+                           lpcchMaxValueName,
+                           lpcbMaxValueData,
+                           lpcbSecurityDescriptor,
+                           lpftLastWriteTime);
   if(rc == ERROR_SUCCESS)
   {
-    if(*arg3) {
-            astring = (char *)malloc(*arg3);
-        strcpy(astring, (char *)arg2);
-            AsciiToUnicode(astring, arg2);
+    if(*lpcchClass) {
+            astring = (char *)malloc(*lpcchClass+1); //returned length does NOT include 0 terminator
+            strcpy(astring, (char *)lpszClass);
+            AsciiToUnicode(astring, lpszClass);
             free(astring);
     }
-    else    *arg2 = 0;
+    else    *lpszClass = 0;
   }
+  //TODO: lpcbMaxValueData could be wrong for string key values!!! (as it's in bytes)
   return(rc);
 }
@@ -808,5 +839,5 @@
   {
     if(pcbValue) {
-            astring2 = (char *)malloc(*pcbValue);
+            astring2 = (char *)malloc(*pcbValue);   //includes 0 terminator
             strcpy(astring2, (char *)lpszValue);
             AsciiToUnicode(astring2, lpszValue);
Index: trunk/src/kernel32/virtual.cpp
===================================================================
--- trunk/src/kernel32/virtual.cpp	(revision 4533)
+++ trunk/src/kernel32/virtual.cpp	(revision 4534)
@@ -1,3 +1,3 @@
-/* $Id: virtual.cpp,v 1.34 2000-09-18 19:26:16 sandervl Exp $ */
+/* $Id: virtual.cpp,v 1.35 2000-10-26 17:21:39 sandervl Exp $ */
 
 /*
@@ -28,5 +28,5 @@
 #include "oslibdos.h"
 
-#define DBG_LOCALLOG	DBG_virtual
+#define DBG_LOCALLOG    DBG_virtual
 #include "dbglocal.h"
 
@@ -40,7 +40,7 @@
  *
  * RETURNS
- *	Handle: Success
- *	0: Mapping object does not exist
- *	NULL: Failure
+ *  Handle: Success
+ *  0: Mapping object does not exist
+ *  NULL: Failure
  */
 HANDLE WINAPI CreateFileMappingA(
@@ -82,6 +82,6 @@
  *
  * RETURNS
- *	Handle: Success
- *	NULL: Failure
+ *  Handle: Success
+ *  NULL: Failure
  */
 HANDLE WINAPI OpenFileMappingA(
@@ -113,6 +113,6 @@
  *
  * RETURNS
- *	Starting address of mapped view
- *	NULL: Failure
+ *  Starting address of mapped view
+ *  NULL: Failure
  */
 LPVOID WINAPI MapViewOfFile(
@@ -134,6 +134,6 @@
  *
  * RETURNS
- *	Starting address of mapped view
- *	NULL: Failure
+ *  Starting address of mapped view
+ *  NULL: Failure
  */
 LPVOID WINAPI MapViewOfFileEx(
@@ -155,6 +155,6 @@
  *
  * RETURNS
- *	TRUE: Success
- *	FALSE: Failure
+ *  TRUE: Success
+ *  FALSE: Failure
  */
 BOOL WINAPI FlushViewOfFile(
@@ -185,9 +185,9 @@
  *
  * NOTES
- *	Should addr be an LPCVOID?
+ *  Should addr be an LPCVOID?
  *
  * RETURNS
- *	TRUE: Success
- *	FALSE: Failure
+ *  TRUE: Success
+ *  FALSE: Failure
  */
 BOOL WINAPI UnmapViewOfFile(LPVOID addr /* [in] Address where mapped view begins */
@@ -216,6 +216,6 @@
  *
  * Helper function to map a file to memory:
- *  name			-	file name
- *  [RETURN] ptr		-	pointer to mapped file
+ *  name            -   file name
+ *  [RETURN] ptr        -   pointer to mapped file
  */
 HANDLE WINAPI VIRTUAL_MapFileW( LPCWSTR name , LPVOID *lpMapping, BOOL fReadIntoMemory)
@@ -241,6 +241,6 @@
  *
  * Helper function to map a file to memory:
- *  name			-	file name
- *  [RETURN] ptr		-	pointer to mapped file
+ *  name            -   file name
+ *  [RETURN] ptr        -   pointer to mapped file
  */
 HANDLE WINAPI VIRTUAL_MapFileA( LPCSTR name , LPVOID *lpMapping, BOOL fReadIntoMemory)
@@ -277,5 +277,5 @@
   if (cbSize > 0x7fc00000)  /* 2Gb - 4Mb */
   {
-   	dprintf(("VirtualAlloc: size too large"));
+    dprintf(("VirtualAlloc: size too large"));
         SetLastError( ERROR_OUTOFMEMORY );
         return NULL;
@@ -285,5 +285,5 @@
        (fdwAllocationType & ~(MEM_COMMIT | MEM_RESERVE)))
   {
-   	dprintf(("VirtualAlloc: Invalid parameter"));
+        dprintf(("VirtualAlloc: Invalid parameter"));
         SetLastError( ERROR_INVALID_PARAMETER );
         return NULL;
@@ -295,13 +295,13 @@
         flag = PAG_COMMIT;
   }
-  
+
   if(fdwAllocationType & MEM_RESERVE) {
-	//SvL: DosRead crashes if memory is initially reserved with write
+    //SvL: DosRead crashes if memory is initially reserved with write
         //     access disabled (OS/2 bug) even if the commit sets the page
         //     flags to read/write:
-	// DosSetMem does not alter the 16 bit selectors so if you change memory
-	// attributes and then access the memory with a 16 bit API (such as DosRead),
-	// it will have the old (alloc time) attributes
-	flag |= PAG_READ|PAG_WRITE; 
+    // DosSetMem does not alter the 16 bit selectors so if you change memory
+    // attributes and then access the memory with a 16 bit API (such as DosRead),
+    // it will have the old (alloc time) attributes
+    flag |= PAG_READ|PAG_WRITE;
   }
   if(fdwProtect & PAGE_READONLY)     flag |= PAG_READ;
@@ -315,5 +315,5 @@
 
   if(fdwProtect & PAGE_GUARD) {
-	dprintf(("ERROR: PAGE_GUARD bit set for VirtualAlloc -> we don't support this right now!"));
+        dprintf(("ERROR: PAGE_GUARD bit set for VirtualAlloc -> we don't support this right now!"));
         flag |= PAG_GUARD;
   }
@@ -326,28 +326,28 @@
   }
 
-  if(lpvAddress) 
+  if(lpvAddress)
   {
    Win32MemMap *map;
    ULONG offset, nrpages, accessflags = 0;
 
-	nrpages = cbSize >> PAGE_SHIFT;
-	if(cbSize & 0xFFF)
-		nrpages++;
-
-	if(flag & PAG_READ) {
-		accessflags |= MEMMAP_ACCESS_READ;
-	}
-	if(flag & PAG_WRITE) {
-		accessflags |= MEMMAP_ACCESS_WRITE;
-	}
-	if(flag & PAG_EXECUTE) {
-		accessflags |= MEMMAP_ACCESS_EXECUTE;
-	}
-  	map = Win32MemMapView::findMapByView((ULONG)lpvAddress, &offset, accessflags);
-  	if(map) {
-		//TODO: We don't allow protection flag changes for mmaped files now
-		map->commitPage(offset, FALSE, nrpages);
-		return lpvAddress;
-  	}
+    nrpages = cbSize >> PAGE_SHIFT;
+    if(cbSize & 0xFFF)
+        nrpages++;
+
+    if(flag & PAG_READ) {
+        accessflags |= MEMMAP_ACCESS_READ;
+    }
+    if(flag & PAG_WRITE) {
+        accessflags |= MEMMAP_ACCESS_WRITE;
+    }
+    if(flag & PAG_EXECUTE) {
+        accessflags |= MEMMAP_ACCESS_EXECUTE;
+    }
+    map = Win32MemMapView::findMapByView((ULONG)lpvAddress, &offset, accessflags);
+    if(map) {
+        //TODO: We don't allow protection flag changes for mmaped files now
+        map->commitPage(offset, FALSE, nrpages);
+        return lpvAddress;
+    }
   }
 
@@ -362,40 +362,65 @@
     if(rc == OSLIB_ERROR_ACCESS_DENIED && cbSize > 4096 )
     { //knut: AND more than one page
-      char *newbase = (char *)lpvAddress + ((cbSize-1) & 0xFFFFF000); //knut: lets not start after the last page!
-      ULONG size, os2flags;
-
-      while(newbase >= (char *)lpvAddress)
-      {  //knut: should check first page to!!
-        size     = 4096;
-        os2flags = 0;
-        rc = OSLibDosQueryMem(newbase, &size, &os2flags);
-        if(rc)
-          break;
-
-        if(os2flags & PAG_COMMIT)
+        char *newbase = (char *)lpvAddress + ((cbSize-1) & 0xFFFFF000); //knut: lets not start after the last page!
+        ULONG size, os2flags;
+
+        while(newbase >= (char *)lpvAddress)
+        {     //knut: should check first page to!!
+            size     = 4096;
+            os2flags = 0;
+            rc = OSLibDosQueryMem(newbase, &size, &os2flags);
+            if(rc)
+                break;
+
+            if(os2flags & PAG_COMMIT)
+            {
+                newbase += 4096;
+                break;
+            }
+            newbase -= 4096;
+        }
+
+        if(rc == 0)
         {
-          newbase += 4096;
-          break;
+            //In case it wants to commit bytes that fall into the last
+            //page of the previous commit command
+            if(cbSize > ((int)newbase - (int)lpvAddress))
+                rc = OSLibDosSetMem(newbase, cbSize - ((int)newbase - (int)lpvAddress), flag);
         }
-        newbase -= 4096;
-      }
-
-      if(rc == 0)
-      {
-        //In case it wants to commit bytes that fall into the last
-        //page of the previous commit command
-        if(cbSize > ((int)newbase - (int)lpvAddress))
-          	rc = OSLibDosSetMem(newbase, cbSize - ((int)newbase - (int)lpvAddress), flag);
-      }
-      else      return(NULL);
+        else  return(NULL);
 
     }
     else
     {
-      	if(rc == OSLIB_ERROR_INVALID_ADDRESS) {
-        	rc = OSLibDosAllocMem(&Address, cbSize, flag );
-	}
-      	else
-        if(rc)  dprintf(("Unexpected DosSetMem error %x", rc));
+        if(rc == OSLIB_ERROR_INVALID_ADDRESS) {
+            rc = OSLibDosAllocMem(&Address, cbSize, flag );
+        }
+        else {
+            if(rc) {
+                //check if the app tries to commit an already commited part of memory or change the protection flags
+                ULONG size = cbSize, os2flags, newrc;
+                newrc = OSLibDosQueryMem(lpvAddress, &size, &os2flags);
+                if(newrc == 0) {
+                    if(size >= cbSize && (os2flags & PAG_COMMIT)) {
+                            dprintf(("VirtualAlloc: commit on committed memory"));
+                            if((flag & (PAG_READ|PAG_WRITE|PAG_EXECUTE)) != (os2flags & (PAG_READ|PAG_WRITE|PAG_EXECUTE)))
+                            {   //change protection flags
+                                DWORD tmp;
+                                if(VirtualProtect(lpvAddress, cbSize, fdwAllocationType, &tmp) == TRUE) {
+                                    return lpvAddress;
+                                }
+                                dprintf(("ERROR: VirtualAlloc: commit on committed memory -> VirtualProtect failed!!"));
+                                return NULL;
+                            }
+                            //else everything ok
+                            return lpvAddress;
+                    }
+                    else    dprintf(("Unexpected DosSetMem error %x", rc));
+                }
+                else {
+                    dprintf(("Unexpected DosQueryMem error %x", newrc));
+                }
+            }
+        }
     }
   }
@@ -446,11 +471,11 @@
     if(rc)
     {
-	if(rc == 32803) { //SvL: ERROR_ALIAS
-      		dprintf(("KERNEL32:VirtualFree:OsLibSetMem rc = #%d; app tries to decommit aliased memory; ignore", rc));
-		return(TRUE);
-	}
-      	dprintf(("KERNEL32:VirtualFree:OsLibSetMem rc = #%d\n", rc));
-      	SetLastError(ERROR_INVALID_ADDRESS);
-	return(FALSE);
+    if(rc == 32803) { //SvL: ERROR_ALIAS
+            dprintf(("KERNEL32:VirtualFree:OsLibSetMem rc = #%d; app tries to decommit aliased memory; ignore", rc));
+        return(TRUE);
+    }
+        dprintf(("KERNEL32:VirtualFree:OsLibSetMem rc = #%d\n", rc));
+        SetLastError(ERROR_INVALID_ADDRESS);
+    return(FALSE);
     }
   }
@@ -492,5 +517,5 @@
   if(pfdwOldProtect == NULL) {
         dprintf(("WARNING: pfdwOldProtect == NULL"));
-  	SetLastError(ERROR_INVALID_PARAMETER);
+    SetLastError(ERROR_INVALID_PARAMETER);
         return(FALSE);
   }
@@ -542,8 +567,8 @@
   cb = (cbSize & 0xFFF) + offset; // !!! added, some optimization :)
   if( cb > 0 ) { // changed
-	npages++;
+    npages++;
   }
   if( cb > 4096 ) { // changed, note '>' sign ( not '>=' ) 4096 is exactly one page
-	npages++;
+    npages++;
   }
 
@@ -574,7 +599,7 @@
   if(pmbiBuffer == NULL || cbLength != sizeof(MEMORY_BASIC_INFORMATION)) // check parameters
   {
-	dprintf(("WARNING: invalid parameter"));
-	SetLastError(ERROR_INVALID_PARAMETER);
-    	return 0;                             // nothing to return
+    dprintf(("WARNING: invalid parameter"));
+    SetLastError(ERROR_INVALID_PARAMETER);
+        return 0;                             // nothing to return
   }
 
@@ -588,8 +613,8 @@
   if(rc)
   {
-    	dprintf(("VirtualQuery - OSLibDosQueryMem %x %x returned %d\n",
-             	  lpBase, cbLength, rc));
-	SetLastError(ERROR_INVALID_PARAMETER);
-    	return 0;
+        dprintf(("VirtualQuery - OSLibDosQueryMem %x %x returned %d\n",
+                  lpBase, cbLength, rc));
+    SetLastError(ERROR_INVALID_PARAMETER);
+        return 0;
   }
 
@@ -625,5 +650,5 @@
 
   if(!(dAttr & PAG_SHARED))
-    	pmbiBuffer->Type = MEM_PRIVATE;
+        pmbiBuffer->Type = MEM_PRIVATE;
 
   //TODO: This is not correct: AllocationProtect should contain the protection
@@ -631,22 +656,22 @@
   pmbiBuffer->AllocationProtect = pmbiBuffer->Protect;
   if(dAttr & PAG_BASE) {
-    	pmbiBuffer->AllocationBase = lpBase;
+        pmbiBuffer->AllocationBase = lpBase;
   }
   else
   {
-    	while(lpBase > 0)
-    	{
-      		rc = OSLibDosQueryMem(lpBase, &cbRangeSize, &dAttr);
-	      	if(rc) {
-	         	dprintf(("VirtualQuery - OSLibDosQueryMem %x %x returned %d\n",
-	                  	  lpBase, cbLength, rc));
-	         	break;
-	      	}
-	      	if(dAttr & PAG_BASE) {
-	         	pmbiBuffer->AllocationBase = lpBase;
-	         	break;
-	      	}
-	     	lpBase = (LPVOID)((ULONG)lpBase - PAGE_SIZE);
-	}
+        while(lpBase > 0)
+        {
+            rc = OSLibDosQueryMem(lpBase, &cbRangeSize, &dAttr);
+            if(rc) {
+                dprintf(("VirtualQuery - OSLibDosQueryMem %x %x returned %d\n",
+                          lpBase, cbLength, rc));
+                break;
+            }
+            if(dAttr & PAG_BASE) {
+                pmbiBuffer->AllocationBase = lpBase;
+                break;
+            }
+            lpBase = (LPVOID)((ULONG)lpBase - PAGE_SIZE);
+    }
   }
   return sizeof(MEMORY_BASIC_INFORMATION);
@@ -752,5 +777,5 @@
   if (cbSize > 0x7fc00000)  /* 2Gb - 4Mb */
   {
-   	dprintf(("VirtualAllocShared: size too large"));
+    dprintf(("VirtualAllocShared: size too large"));
         SetLastError( ERROR_OUTOFMEMORY );
         return NULL;
@@ -760,5 +785,5 @@
        (fdwAllocationType & ~(MEM_COMMIT | MEM_RESERVE)))
   {
-   	dprintf(("VirtualAllocShared: Invalid parameter"));
+    dprintf(("VirtualAllocShared: Invalid parameter"));
         SetLastError( ERROR_INVALID_PARAMETER );
         return NULL;
@@ -781,5 +806,5 @@
 
   if(fdwProtect & PAGE_GUARD) {
-	dprintf(("ERROR: PAGE_GUARD bit set for VirtualAllocShared -> we don't support this right now!"));
+    dprintf(("ERROR: PAGE_GUARD bit set for VirtualAllocShared -> we don't support this right now!"));
         flag |= PAG_GUARD;
   }
