Problem calling 2000 SP4 update using createprocess.

G

Guest

Trying to udate 2000 SP4 by calling createprocess from C++ api. (This is for generic SP update code to be run off a CD.) I have updated NT SP 6a using create process. This 2000 code is identical. Works for NT but not for 2000. For 2000 an error is returned. For 2000 I changed it to call system passing the path to SP4 exe.

Any ideas why create process does not work? I have double checked for typos and tried the createprocess call with differnet args. (We do not want the system DOS box to display - which is the biggest reason for not wanting to call system.

CString SrcFileName = m_csSrcPath + "\\W2KSP4\\"
CString csExec = SrcFileName + "W2KSP4_EN.EXE" + " /u /q /n /z /o"

CString ApplicationName = m_csSrcPath + "\\W2KSP4\\W2KSP4_EN.EXE"

bRes = CreateProcess ( (char *)(const char *)ApplicationName,(char *)(const char *)csExec,NULL,NULL,TRUE,NORMAL_PRIORITY_CLASS,NULL,NULL,&si,&pi)

// This does not work
Res = CreateProcess ( NULL,(char *)(const char *)csExec,NULL,NULL,TRUE,NORMAL_PRIORITY_CLASS,NULL,NULL,&si,&pi)

// This works
int isys = system(csExec)
 
G

Gerry Hickman

Bill said:
Any ideas why create process does not work?
// This does not work
Res = CreateProcess ( NULL,(char *)(const char *)csExec,NULL,NULL,TRUE,NORMAL_PRIORITY_CLASS,NULL,NULL,&si,&pi);

No idea, but why on earth would anyone want to do this from C++ ?
 
O

Oli Restorick [MVP]

If you don't want a "DOS box" (actually, a command prompt window), then head
on over to www.joeware.net/win32/index.html and download the Quiet tool.

Hope this helps

Oli


Bill Smith said:
Trying to udate 2000 SP4 by calling createprocess from C++ api. (This is
for generic SP update code to be run off a CD.) I have updated NT SP 6a
using create process. This 2000 code is identical. Works for NT but not for
2000. For 2000 an error is returned. For 2000 I changed it to call system
passing the path to SP4 exe.
Any ideas why create process does not work? I have double checked for
typos and tried the createprocess call with differnet args. (We do not want
the system DOS box to display - which is the biggest reason for not wanting
to call system.)
CString SrcFileName = m_csSrcPath + "\\W2KSP4\\";
CString csExec = SrcFileName + "W2KSP4_EN.EXE" + " /u /q /n /z /o";

CString ApplicationName = m_csSrcPath + "\\W2KSP4\\W2KSP4_EN.EXE";


bRes = CreateProcess ( (char *)(const char *)ApplicationName,(char
*)(const char
*)csExec,NULL,NULL,TRUE,NORMAL_PRIORITY_CLASS,NULL,NULL,&si,&pi);
 
G

Guest

Gerry - We sell a high volume fax server. Customer buys the hardware with software installed. When we send out a release it updates everything on the PC that needs to be updated - our software and everything else - IE, MDAC, OS SPs, etc. So we write an update program in C++ that does silent updates of the various pieces. When system is run it paints on top of our release update UI. Create process can be executed without a UI displaying at all. Thanks, Bill
 
G

Gerry Hickman

Bill said:
Gerry - We sell a high volume fax server.

OK, what is the exact error code?

What happens if you try the test with a file other than w2ksp4_en.exe?

e.g. you could write an exe program that creates a dummy text file in
the root of the C drive "test.txt" and then exits. Does this program
also give the error, or is it SPECIFIC to the SP4 intstaller.

I've had trouble getting createprocess to work in the past, but in my
case it was more to do with remote machines and UNC paths, and inability
to impersonate an account over more than one network hop.

I also remember an issue with SP3 where I had to extract all the files
first and then run UPDATE.EXE, before it would work on remote machines.
However, with SP4 I have not had this problem. It happily extracts the
files and runs the program.
 
G

Guest

Gerry - The error when executing W2KSP4_EN.EXE is "Cannot create a file when that file already exists.". This seems to point to a ReadOnly file that W2KSP4_EN.EXE could not delete, but I can't find it. I have tested this update on multiple w2k machines - it is not an isolated problem.

For the purposes of release update testing W2KSP4_EN.EXE lives in a folder on a server. We create a parent folder containing subfolders (one of the subfolders is for OS SPs) on the server. The folders are eventually burned to CDs and shipped as the release

I have tried copying W2KSP4_EN.EXE from the folder and executing it locally - same error message. I have tried extracting and then executing update.exe and received the same error message. On the other hand, I run IE 6 update using cretaeprocess with no problems. We do have problems, though starting and stopping sybase using createprocess and so use system.

I'd like to identify what I am doing wrong here or at least understand why it will not work. Any ideas would be appreciated
Thanks, Bill
 
G

Gerry Hickman

Bill said:
Gerry - The error when executing W2KSP4_EN.EXE is "Cannot create a file..

OK, at what point did this error occur? What does the service pack log
file say?

You appear to be saying w2ksp4_en.exe DID actually instantiate, but
something went wrong afterwards - this is very different to
CreateProcess refusing to run it.

What ever the answers to the above, it seems your installer will be
wasting time on each client update because it will have to extract
hundreds of files to a temp location first. You may therefore be better
off extracting the files to your dist point first (using WinZip or
whatever), and then use CreateProcess to run Update.exe instead, from
the Update subfolder of i386.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top