Can HeapAlloc() safely be used in those dos routines?
I'm working on the CMDLINE fix. Fixed the strlen thing, fixed the leak, looking into the PROCESS_INFORMATION leak. Will fix the synchronous issue.
Chris
On Sunday 29 September 2002 05:07 am, Jukka Heinonen wrote:
Look reasonable?
No. Command tail is not null terminated so you cannot use strlen. DOS exec function "load and exec" is synchronous so you should return to caller only after created process has finished. In addition to hFile lead found by Ove Kaaven, you are leaking handles in PROCESS_INFORMATION. Using fixed size buffer for full command line without sanity checks is a bad idea and will cause problems sooner or later.
And, finally, you are ignoring long command lines from DOS program stored in CMDLINE environment variable. (I have already exchanged private email with Chris Morgan about this; DOS programs can be passed command tails longer than 126 characters using CMDLINE environment variable. Similarly, DOS programs may pass long command lines to programs they execute.)