{Global,Local}ReAlloc() does not allocate memory.

This commit is contained in:
Dimitrie O. Paun 2003-11-26 05:04:15 +00:00 committed by Alexandre Julliard
parent 77b8c0a42f
commit 3e54350dc2
2 changed files with 7 additions and 6 deletions

View file

@ -73,7 +73,8 @@ static CRITICAL_SECTION IMalloc32_SpyCS = { &critsect_debug, -1, 0, 0, 0, 0 };
/* resize the old table */
static int SetSpyedBlockTableLength ( int NewLength )
{
Malloc32.SpyedBlocks = (LPVOID*)LocalReAlloc((HLOCAL)Malloc32.SpyedBlocks, NewLength, GMEM_ZEROINIT);
if (!Malloc32.SpyedBlocks) Malloc32.SpyedBlocks = (LPVOID*)LocalAlloc(NewLength, GMEM_ZEROINIT);
else Malloc32.SpyedBlocks = (LPVOID*)LocalReAlloc((HLOCAL)Malloc32.SpyedBlocks, NewLength, GMEM_ZEROINIT);
Malloc32.SpyedBlockTableLength = NewLength;
return Malloc32.SpyedBlocks ? 1 : 0;
}

View file

@ -92,15 +92,15 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
if (*lpCmdline==0) {
/* Return the path to the executable */
DWORD size;
DWORD size=16;
hargv=0;
size=16;
do {
hargv=GlobalAlloc(size, 0);
argv=GlobalLock(hargv);
while (GetModuleFileNameW(0, (LPWSTR)(argv+1), size-sizeof(LPWSTR)) == 0) {
size*=2;
hargv=GlobalReAlloc(hargv, size, 0);
argv=GlobalLock(hargv);
} while (GetModuleFileNameW(0, (LPWSTR)(argv+1), size-sizeof(LPWSTR)) == 0);
}
argv[0]=(LPWSTR)(argv+1);
if (numargs)
*numargs=2;