Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Declaration of CloseHandle as local external function
- Function boolean CloseHandle (ulong hObject) Library "KERNEL32.DLL"
- ....
- // Start another process
- CreateProcess (lul_null, "~"" + as_command + "~" " + as_arguments, lul_null, lul_null, TRUE, 32, lul_null, ls_null, lstr_startupinfo, lstr_proc)
- // Just for test
- gf_log_into_file("HANDLE="+string(lstr_proc.ul_process))
- WaitForInputIdle(lstr_proc.ul_process, al_millisecs)
- // Wait until the process closes
- do
- do while Yield()
- loop
- lul_rc = WaitForSingleObject (lstr_proc.ul_process, al_millisecs)
- loop while lul_rc = WAIT_TIMEOUT
- // get exit code
- GetExitCodeProcess(lstr_proc.ul_process, ref al_ret)
- // this one still returns TRUE!!
- gf_log_into_file("HANDLE="+string(lstr_proc.ul_process))
- // closehandle returns FALSE 2 times
- if NOT CloseHandle(lstr_proc.ul_thread) then lul_rc = GetLastError()
- // lul_rc = 6
- if NOT CloseHandle(lstr_proc.ul_process) then lul_rc = GetLastError()
- // lul_rc = 6 which means ERROR_INVALID_HANDLE. But why?? For GetExitCodeProcess(..) one line above the handle was still OK
- gf_log_into_file("HANDLE="+string(lstr_proc.ul_process))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement