> > That code has been in there for some time, but it fails - it generates
> > error 6 - incorrect handle. I am aware of the issue.
> 
> Sorry, I didn't know that.  The only help I can offer then, is to
> describe what code I have written elsewhere, which runs in the context
> of a service does.  The following is used to start the executable:
> 
>     PROCESS_INFORMATION pinfo;
>     DWORD status = ERROR_SUCCESS;
> 
>     szCommandLine = (TCHAR *)malloc(sizeof(*szProgram)* 
>                 (4+((szProgram)? _tcslen(szProgram) : 0) + 
>                    ((szProgramArguments)? _tcslen(szProgramArguments) :
> 0)));
>     if (szProgram)
>         {
>         if (szProgramArguments)
>             _stprintf(szCommandLine, "\"%s\" %s", szProgram,
> szProgramArguments);
>         else
>             _stprintf(szCommandLine, "\"%s\"", szProgram);
>         }
>     else
>         if (szProgramArguments)
>             _tcscpy(szCommandLine, szProgramArguments);
>         else
>             *szCommandLine = NULCHAR;
>     if (!CreateProcess(szProgram, 
>                        szCommandLine, 
>                        NULL, 
>                        NULL, 
>                        TRUE,
>                        CREATE_NEW_PROCESS_GROUP |
>                        NORMAL_PRIORITY_CLASS,
>                        NULL, 
>                        szWorkingDirectory, 
>                        NULL, 
>                        &pinfo))
>         status = GetLastError();
>     free(szCommandLine);
>     if (status  == ERROR_SUCCESS)
>         {
>         CloseHandle(pinfo.hProcess);
>         CloseHandle(pinfo.hThread);
>         }
> 
> On success, the returned pinfo structure contains the dwProcessId which
> is later used at shutdown time to pass to GenerateConsoleCtrlEvent().

Except, as I said, I get error -6 :-(

> - Mark Pizzolato

-Nigel 
_______________________________________________
http://lists.clamav.net/cgi-bin/mailman/listinfo/clamav-win32

Reply via email to