GlobalMemoryStatusEx and a fix for my last code patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In future, I won't be so lazy and I'll actually run make when adding
simple stuff to a header :)

ChangeLog:
	
- Add a comma and fix the formatting in the OLECMDID patch (so ignore
the last one)
- Implement GlobalMemoryStatusEx()

FYI GlobalMemoryStatusEx is nearly identical to GlobalMemoryStatus
except for an extra field (which I didn't know what it was talking about
so it's set to zero) and minus a bug, so I just copy the values across
the structures.

This makes an MSI package not crash on startup.

License: LGPL only

thanks -mike

-- 
Mike Hearn <m.hearn@signal.qinetiq.com>
QinetiQ - Malvern Technology Center
Index: dlls/kernel/kernel32.spec
===================================================================
RCS file: /home/wine/wine/dlls/kernel/kernel32.spec,v
retrieving revision 1.91
diff -u -r1.91 kernel32.spec
--- dlls/kernel/kernel32.spec	19 Feb 2003 22:11:05 -0000	1.91
+++ dlls/kernel/kernel32.spec	24 Feb 2003 14:54:57 -0000
@@ -533,7 +533,7 @@
 @ stdcall GlobalHandle(ptr) GlobalHandle
 @ stdcall GlobalLock(long) GlobalLock
 @ stdcall GlobalMemoryStatus(ptr) GlobalMemoryStatus
-@ stub GlobalMemoryStatusEx
+@ stdcall GlobalMemoryStatusEx(ptr) GlobalMemoryStatusEx
 @ stdcall GlobalReAlloc(long long long) GlobalReAlloc
 @ stdcall GlobalSize(long) GlobalSize
 @ stdcall GlobalUnWire(long) GlobalUnWire
Index: include/docobj.h
===================================================================
RCS file: /home/wine/wine/include/docobj.h,v
retrieving revision 1.12
diff -u -r1.12 docobj.h
--- include/docobj.h	5 Jan 2003 01:06:30 -0000	1.12
+++ include/docobj.h	24 Feb 2003 14:55:01 -0000
@@ -141,8 +141,21 @@
 	OLECMDID_ENABLE_INTERACTION = 36,
 	OLECMDID_ONUNLOAD = 37,
 	OLECMDID_PROPERTYBAG2 = 38,
-	OLECMDID_PREREFRESH = 39
+	OLECMDID_PREREFRESH = 39,
 	/* iexplorer uses ... 44 */
+	OLECMDID_SHOWSCRIPTERROR        = 40,
+       OLECMDID_SHOWMESSAGE    = 41,
+       OLECMDID_SHOWFIND       = 42,
+       OLECMDID_SHOWPAGESETUP  = 43,
+       OLECMDID_SHOWPRINT      = 44,
+       OLECMDID_CLOSE  = 45,
+       OLECMDID_ALLOWUILESSSAVEAS      = 46,
+       OLECMDID_DONTDOWNLOADCSS        = 47,
+       OLECMDID_UPDATEPAGESTATUS       = 48,
+       OLECMDID_PRINT2 = 49,
+       OLECMDID_PRINTPREVIEW2  = 50,
+       OLECMDID_SETPRINTTEMPLATE       = 51,
+       OLECMDID_GETPRINTTEMPLATE       = 52
 }	OLECMDID;
 
 #define OLECMDERR_E_FIRST            (OLE_E_LAST+1)
Index: include/winbase.h
===================================================================
RCS file: /home/wine/wine/include/winbase.h,v
retrieving revision 1.178
diff -u -r1.178 winbase.h
--- include/winbase.h	13 Jan 2003 20:44:13 -0000	1.178
+++ include/winbase.h	24 Feb 2003 14:55:02 -0000
@@ -460,6 +460,18 @@
     SIZE_T   dwAvailVirtual;
 } MEMORYSTATUS, *LPMEMORYSTATUS;
 
+typedef struct tagMEMORYSTATUSEX {
+  DWORD dwLength;
+  DWORD dwMemoryLoad;
+  DWORDLONG ullTotalPhys;
+  DWORDLONG ullAvailPhys;
+  DWORDLONG ullTotalPageFile;
+  DWORDLONG ullAvailPageFile;
+  DWORDLONG ullTotalVirtual;
+  DWORDLONG ullAvailVirtual;
+  DWORDLONG ullAvailExtendedVirtual;
+} MEMORYSTATUSEX, *LPMEMORYSTATUSEX;
+
 
 typedef struct _SYSTEMTIME{
         WORD wYear;
Index: memory/global.c
===================================================================
RCS file: /home/wine/wine/memory/global.c,v
retrieving revision 1.77
diff -u -r1.77 global.c
--- memory/global.c	19 Feb 2003 22:11:04 -0000	1.77
+++ memory/global.c	24 Feb 2003 14:55:02 -0000
@@ -1558,6 +1558,9 @@
 
 /***********************************************************************
  *           GlobalMemoryStatus   (KERNEL32.@)
+ * Provides information about the status of the memory, so apps can tell
+ * roughly how much they are able to allocate
+ * 
  * RETURNS
  *	None
  */
@@ -1690,6 +1693,38 @@
           lpmem->dwLength, lpmem->dwMemoryLoad, lpmem->dwTotalPhys, lpmem->dwAvailPhys,
           lpmem->dwTotalPageFile, lpmem->dwAvailPageFile, lpmem->dwTotalVirtual,
           lpmem->dwAvailVirtual);
+}
+
+/***********************************************************************
+ *           GlobalMemoryStatusEx   (KERNEL32.@)
+ * A version of GlobalMemoryStatus that can deal with memory over 4GB
+ *
+ * RETURNS
+ *	None
+ */
+BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpBuffer ) {
+  MEMORYSTATUS memstatus;
+  
+  /* Because GlobalMemoryStatusEx is identical to GlobalMemoryStatus save
+     for one extra field in the struct, and the lack of a bug, we simply
+     call GlobalMemoryStatus and copy the values across. */
+  FIXME("we should emulate the 4GB bug here, as per MSDN\n");
+  GlobalMemoryStatus(&memstatus);
+  lpBuffer->dwMemoryLoad = memstatus.dwMemoryLoad;
+  lpBuffer->ullTotalPhys = memstatus.dwTotalPhys;
+  lpBuffer->ullAvailPhys = memstatus.dwAvailPhys;
+  lpBuffer->ullTotalPageFile = memstatus.dwTotalPageFile;
+  lpBuffer->ullAvailPageFile = memstatus.dwAvailPageFile;
+  lpBuffer->ullTotalVirtual = memstatus.dwTotalVirtual;
+  lpBuffer->ullAvailVirtual = memstatus.dwAvailVirtual;
+  /* MSDN says about AvailExtendedVirtual: Size of unreserved and uncommitted
+     memory in the extended portion of the virtual address space of the calling
+     process, in bytes.
+     
+     However, I don't know what this means, so set it to zero :(
+  */
+  lpBuffer->ullAvailExtendedVirtual = 0;
+  return 1;
 }
 
 /***********************************************************************

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux