SNsdk on WinNT ?

Marta Stojanovic marta.stojanovic@nrc.ca
Thu Dec 14 09:24:00 GMT 2000


>
>
> Here is the definition of this function.
>
> CreateProcessA(
>     LPCSTR lpApplicationName,
>     LPSTR lpCommandLine,
>     LPSECURITY_ATTRIBUTES lpProcessAttributes,
>     LPSECURITY_ATTRIBUTES lpThreadAttributes,
>     BOOL bInheritHandles,
>     DWORD dwCreationFlags,
>     LPVOID lpEnvironment,
>     LPCSTR lpCurrentDirectory,
>     LPSTARTUPINFOA lpStartupInfo,
>     LPPROCESS_INFORMATION lpProcessInformation
>     );
>
> I traced snsdk.exe and found the following arguments for
> the first call to this function (it crashes in this function) :
>
> - the return address (next instruction to execute
> after returning from the function) is at 0x12ff01
>
> - lpApplicationName is a null pointer
>
> - lpCommandLine is buggy. It points to this string :
> "..^Hinhyper.exe FILES\SN452\BIN\SNSDK.exe" toto"
> with ^H being the backspace char.
>
> Explanations are that my snsdk.exe is in
> d:\Program Files\SN452\bin, and that I gave it toto
> as a first argument (script to execute)
>

Thanks Xavier, it was very helpfull. I downloaded SN source code, and
tried to find what's wrong. Look at this :

- file : \SN452-source\snavigator\snavigator\win\makefile.am
        ....
        snsdk_SOURCES = winCon.c
        ....
        snsdk_CFLAGS =  -DAPPNAME=\"..\\bin\\hyper.exe\"
        ....

- file : \SN452-source\snavigator\snavigator\win\winCon.c

     /* create command string */
    strcpy(cmd, APPNAME);
    if (strchr(GetCommandLine(), ' '))
        strcat(cmd, strchr(GetCommandLine(), ' '));

    /* Create the child process. */
    if ( !CreateProcess (NULL,
                         cmd,           /* command
line                        */
                         NULL,          /* process security
attributes         */
                         NULL,          /* primary thread security
attributes  */
                         TRUE,          /* handles are
inherited               */
                         0,             /* creation
flags                      */
                         NULL,          /* use parent's
environment            */
                         NULL,          /* use parent's current
directory      */
                         &siStartInfo,  /* STARTUPINFO
pointer                 */
                         &piProcInfo))  /* receives
PROCESS_INFORMATION        */
        ErrorExit("CreateProcess failed");

Look at "create command string" : if it finds space in the comand line,
it will append to APPNAME the rest of the command line string (after the
space). That explains what you found :

"..^Hinhyper.exe FILES\SN452\BIN\SNSDK.exe" toto"

(APPNAME should be "..\bin\hyper.exe" but it seems to me that it sees it
as "^Hinhyper.exe" ;
 cmd is exactly what goes after space in "Program Files ..." :
"FILES\SN452\BIN\SNSDK.exe toto")

Am I wrong or cmd should be something like : "hyper.exe <script name>"
(in this case "hyper.exe toto") ?

See : http://msdn.microsoft.com/library/psdk/winbase/prothred_9dpv.htm
for CreateProcess
and : http://msdn.microsoft.com/library/psdk/winbase/prothred_0mzp.htm
for GetCommandLine (see there remark on CommandLineToArgvW).


Maybe I'm completely wrong ... If not, does someone has an idea of how
to make this thing work without having to change makefile or winCon.c
and recompile it on WinNT (I prefer ready-made binaries, to tell you the
truth) ?

Thanks.

Kind regards,
Marta.






More information about the Sourcenav mailing list