Malte Starostik wrote:
Don't free cmdline as the return values point into that string. It's the caller's responsibility to GlobalFree() this according to msdn.
I don't understand what you've done. cmdline is a copy of the passed lpCmdLine parameter used for getting the different bits of the argv, so it should be freed however, what's wrong with current implementation (hence your issues) is that when freeing cmdline the argv array points to garbage it means that the argv array and cmdline should be allocated in a single memory block suh that argv[i] points to the part of the string
wouldn't the (completly untested but) attached patch work better ?
A+
wouldn't the (completly untested but) attached patch work better ?
- argv=HeapAlloc(GetProcessHeap(), 0, (argc+1)*sizeof(LPWSTR) + strlenW(lpCmdline) + 1);
hmm, it should of course be
- argv=HeapAlloc(GetProcessHeap(), 0, (argc+1)*sizeof(LPWSTR) + (strlenW(lpCmdline) + 1) * sizeof(WCHAR));
A+