Try this - I'll look at the rest later if this doesn't fix it.
Code:
PROCESS_INFORMATION scan_procinfo = {0};
STARTUPINFO         scan_startup = {0};
gg