WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Functions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How do I interpret Install File Return Codes?

Keywords:  install file installation return codes 

Question:

Would you send me an example of how to interpret InstallFile return codes in WinBatch? I need to know the result-codes and there explanations from InstallFile. The description for API-VerInstallFile that I have, lists the results as constants in the form of e.g. "VIF-FILEINUSE" or "VIF-WRITEPROT". But does the result-code "11|.." mean from InstallFile.

Answer:

Code 11 is Error 8 + 2 + 1.

1 VIF_TEMPFILE
The temporary copy of the new file is in the destination directory. The cause of failure is reflected in other flags.

2 VIF_MISMATCH
The new and preexisting files differ in one or more attributes. This error can be overridden by calling VerInstallFile again with the VIFF_FORCEINSTALL flag set.

8 VIF_DIFFLANG
The new and preexisting files have different language or code-page values. This error can be overridden bycalling VerInstallFile again with the VIFF_FORCEINSTALL flag set.

I think the file you are trying to install is a different language from the one already on your system. Windows thinks maybe you should not install it. But if you really want to, you can set the force flag.

For a complete list of return codes, see list below.


result=InstallFile(... 


 rslt1=ItemExtract(1,result,"|")
 rslt2=ItemExtract(2,result,"|")

 Message("Result code is", rslt1)
 Message("Temp file name (if any) is", rslt2)
Rslt1 codes


    0  =  It worked - as far as we can tell
RETURN CODES (corresponding numbers below):

/* ----- VerInstallFile() flags ----- */

1 VIF_TEMPFILE
The temporary copy of the new file is in the destination directory. The cause of failure is reflected in other flags.

2 VIF_MISMATCH
The new and preexisting files differ in one or more attributes. This error can be overridden by calling VerInstallFile again with the VIFF_FORCEINSTALL flag set.

4 VIF_SRCOLD
The file to install is older than the preexisting file. This error can be overridden by calling VerInstallFile again with the VIFF_FORCEINSTALL flag set.

8 VIF_DIFFLANG The new and preexisting files have different language or code-page values. This error can be overridden by calling VerInstallFile again with the VIFF_FORCEINSTALL flag set.

16 VIF_DIFFCODEPG
The new file requires a code page that cannot be displayed by the version of Windows currently running. This error can be overridden by calling VerInstallFile with the VIFF_FORCEINSTALL flag set.

32 VIF_DIFFTYPE
The new file has a different type, subtype, or operating system from the preexisting file. This error can be overridden by calling VerInstallFile again with the VIFF_FORCEINSTALL flag set.

64 VIF_WRITEPROT
The preexisting file is write protected. This error can be overridden by calling VerInstallFile again with the VIFF_FORCEINSTALL flag set.

128 VIF_FILEINUSE
The preexisting file is in use by Windows and cannot be deleted.

256 VIF_OUTOFSPACE
The function cannot create the temporary file due to insufficient disk space on the destination drive.

512 VIF_ACCESSVIOLATION
A read, create, delete, or rename operation failed due to an access violation.

1024 VIF_SHARINGVIOLATION
A read, create, delete, or rename operation failed due to a sharing violation.

2048 VIF_CANNOTCREATE
The function cannot create the temporary file. The specific error may be described by another flag.

4096 VIF_CANNOTDELETE
The function cannot delete the destination file, or cannot delete the existing version of the file located in another directory. If the VIF_TEMPFILE bit is set, the installation failed, and the destination file probably cannot be deleted.

8192 VIF_CANNOTRENAME
The function cannot rename the temporary file, but already deleted the destination file.

16384 VIF_CANNOTDELETECUR
The existing version of the file could not be deleted and VIFF_DONTDELETEOLD was not specified.

32768 VIF_OUTOFMEMORY
The function cannot complete the requested operation due to insufficient memory. Generally, this means the application ran out of memory attempting to expand a compressed file.

65536 VIF_CANNOTREADSRC
The function cannot read the source file. This could mean that the path was not specified properly.

131072 VIF_CANNOTREADDST
The function cannot read the destination (existing) files. This prevents the function from examining the file's attributes.

262144 VIF_BUFFTOOSMALL
The szTmpFile buffer was too small to contain the name of the temporary source file. When the function returns, lpuTmpFileLen contains the size of the buffer required to hold the filename.

Install File Overwrites Newer Files!

Question:

I am trying to us the InstallFile function to copy VBX files to my local drive from our network. I am setting the Delete-old flag to @false and the Flag to 1 ( shared file ). but it still is overwriting the newer .VBX file with the older one. What am I doing wrong. I have also noted that it will always install the file even if the files are identical, I thought that it would only copy the file if the source file was newer than the destination. Sample of code Result=InstallFile("f:\public\resource\threed.vbx","C:\windows\system",@false,1) The result is always 0 no matter what is done, i.e. an overwrite or a reinstall of the same file, it always overwrites the file, with no regard to the timedate stamp of the vbx file!

Answer:

  1. The result should be, 0|, not 0.

  2. Make sure you don't have ErrorMode(@OFF) set any place.

  3. The 32 bit programs cannot see the version info on a 16 bit file. Timedate stamps are ignored. You can add code to check for any particular conditions you want.

  4. The install file documentation says the timestamp will be used if no other info is available, but that turns out to be incorrect. We believed the Microsoft documentation (since we call their Installfile function).

  5. Do your own checking...

  6. Note that installFile just works with SHORT file names. When we install, we install to a temporary short name then filerename to the long name.

Question:

I'm testing InstallFile on the following Microsoft file WD97VW32.EXE (the Word97-2000 Viewer):

http://www.microsoft.com/downloads/release.asp?ReleaseID=13268&LangID=20&LangDIR=en-us&OpSysID=9800&Search=Product&Value=188&Show=Alpha&Start=&Page=0

which I downloaded from Microsoft.

My code is the following:


a=InstallFile(FileNameShort("C:\My Download Files\wd97vw32.exe"),"wd97vw32.exe","E:\temp\", @false, 1)
message("",a)
The variable "a" has the value "0|" but nothing happens (nothing gets installed).

What am I doing wrong? I think this must be a 32-bit app.

Answer:

??? I think the WD97VW32 is not merely a small little file that wants to be installed, but rather it is an entire setup program for the Word 97 Viewer.

InstallFile can be though of as a semi-intelligent CopyFile that knows how to uncompress certain kinds of files.

Often all it does is copy the file. It does not run it or anything.


Article ID:   W13082
Filename:   InstallFile Function and Return Codes.txt
File Created: 2001:01:26:12:50:56
Last Updated: 2001:01:26:12:50:56