[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference decwet::visual

Title:Microsoft Visual C++ bug reports and kits
Notice:Register in Topic 2. 5.Last for latest Kit
Moderator:DECWET::THOMASN
Created:Tue May 17 1994
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:521
Total number of notes:2938

460.0. "CreateProcess returns 'No such file or directory' for a 'ver'" by CRONIC::LEMONS (And we thank you for your support.) Mon Feb 10 1997 09:55

    Visual C++ for Digital Alpha V4.2
    
    Hi
    
    We're using:
    
    	//Get the windows directory path for use in CreateProcess
    	GetWindowsDirectory(WinDir, MAX_PATH);
    
    	// Create a process and execute the command. 
    	// CreateProcess returns FALSE on error (of creating the process,
    not the command)
    	tfStatus = CreateProcess(NULL,lpszCommand, NULL, NULL, TRUE,
    NORMAL_PRIORITY_CLASS,
    		NULL, WinDir, &StartupInfo, &pInfo);
    
    When we feed this command a value of 'Ver' for lpszCommand, we get a
    value of 2 in GetLastError, which strerror translates to 'No such file
    or directory'.  Oddly enough, if we pass a value of 'net start
    {servicename}', the Create Process functions normally.
    
    WinDir has a value of D:\WINNT, which is a valid directory on this
    system.
    
    Any thoughts?
    
    Thanks!
    tl
T.RTitleUserPersonal
Name
DateLines
460.1internal commandCANDOO::GRIEBTue Feb 11 1997 07:0413
    When we feed this command a value of 'Ver' for lpszCommand, we get a
    value of 2 in GetLastError, which strerror translates to 'No such file
    or directory'.  Oddly enough, if we pass a value of 'net start
    {servicename}', the Create Process functions normally.
    
There is no such image "ver" on the system. It is an internal command to
the command shell. Try "command /c ver" or "cmd /c ver". That might
work.

(Note there is NO copy.exe either !!!)


460.28153::tecotoo.mro.dec.com::mayerDanny MayerTue Feb 11 1997 07:214
	If you're looking for the Windows Version number, there are other
  easier ways to do it.  If this is just for a test, run a real executable.

		Danny
460.3CRONIC::LEMONSAnd we thank you for your support.Tue Feb 11 1997 09:556
    I'm trying to write a DLL, centered around CreateProcess, that will
    handle any command thrown at it, internal command or external program. 
    Any suggestion on how to do this?
    
    Thanks!
    tl
460.4let a command shell do itCANDOO::GRIEBWed Feb 12 1997 08:3211
>    I'm trying to write a DLL, centered around CreateProcess, that will
>    handle any command thrown at it, internal command or external program. 
>    Any suggestion on how to do this?
    
I think the "easy" way to do this is detect if running on Windows NT or
Windows 95 and then either put a "cmd /c " or a "command /c " in front
of the command. If you don't do that then I think you have to handle .bat/.cmd
files, DOS images, WIN16 images, internal commands and lots of other stuff.