shell32: Use LocalFree in CommandLineToArgvW.
This commit is contained in:
parent
602e675375
commit
0f0678aa60
|
@ -97,20 +97,20 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
|
||||||
/* Return the path to the executable */
|
/* Return the path to the executable */
|
||||||
DWORD len, size=16;
|
DWORD len, size=16;
|
||||||
|
|
||||||
hargv=GlobalAlloc(0, size);
|
hargv=LocalAlloc(0, size);
|
||||||
argv=GlobalLock(hargv);
|
argv=LocalLock(hargv);
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
len = GetModuleFileNameW(0, (LPWSTR)(argv+1), (size-sizeof(LPWSTR))/sizeof(WCHAR));
|
len = GetModuleFileNameW(0, (LPWSTR)(argv+1), (size-sizeof(LPWSTR))/sizeof(WCHAR));
|
||||||
if (!len)
|
if (!len)
|
||||||
{
|
{
|
||||||
GlobalFree(hargv);
|
LocalFree(hargv);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (len < size) break;
|
if (len < size) break;
|
||||||
size*=2;
|
size*=2;
|
||||||
hargv=GlobalReAlloc(hargv, size, 0);
|
hargv=LocalReAlloc(hargv, size, 0);
|
||||||
argv=GlobalLock(hargv);
|
argv=LocalLock(hargv);
|
||||||
}
|
}
|
||||||
argv[0]=(LPWSTR)(argv+1);
|
argv[0]=(LPWSTR)(argv+1);
|
||||||
if (numargs)
|
if (numargs)
|
||||||
|
|
Loading…
Reference in New Issue