CVS: winex/memory virtual.c,1.39,1.40
[email protected] 1 Aug 2007 12:32:30 -0000
| Newsgroups | gmane.comp.emulators.winex.cvs |
|---|---|
| Message-ID | <[email protected]> |
Subject: winex/memory virtual.c,1.39,1.40Update of /var/lib/cvsd/cvsroot/winex/memory
In directory agravaine:/tmp/cvs-serv29797/memory
Modified Files:
virtual.c
Log Message:
- fixed GetModuleFileNameA() to properly return a truncated filename error code. GetModuleFileNameW() just calls GetModuleFileNameA(), so its error codes should be updated as well.
- fixed all the calls to GetModuleFileNameA/W() to check for small buffer and bad module errors. Currently small buffer errors are just reported and are allowed to proceed with either an empty string or truncated string for the filename. In the case of an error retrieving the module filename (error == 0), the calling function reports the error and returns immediately.
Index: virtual.c
===================================================================
RCS file: /var/lib/cvsd/cvsroot/winex/memory/virtual.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- virtual.c 31 Jul 2007 19:49:39 -0000 1.39
+++ virtual.c 1 Aug 2007 12:32:28 -0000 1.40
@@ -1120,9 +1120,10 @@
static BOOL is_memory_manager_disabled(void)
{
- char buffer[MAX_PATH+16];
- HKEY hkey, appkey = 0;
- BOOL disabled = FALSE;
+ char buffer[MAX_PATH+16];
+ HKEY hkey, appkey = 0;
+ BOOL disabled = FALSE;
+ DWORD error;
if (RegCreateKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\memory", 0, NULL,
REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL ))
@@ -1132,7 +1133,7 @@
/* open the app-specific key */
if (GetModuleFileName16( GetCurrentTask(), buffer, MAX_PATH ) ||
- GetModuleFileNameA( 0, buffer, MAX_PATH ))
+ ((error = GetModuleFileNameA( 0, buffer, MAX_PATH )) != 0 && error != MAX_PATH))
{
HKEY tmpkey;
char *p, *appname = buffer;
@@ -1146,6 +1147,10 @@
}
}
+ else
+ ERR("could not retrieve the module file name (reason: '%s')\n", error == 0 ? "bad module" : "buffer too small");
+
+
if (!get_config_key( hkey, appkey, "MemoryManager", buffer, sizeof(buffer) ))
disabled = IS_OPTION_FALSE( buffer[0] );