Archive: Error Code 87 with CABSetup plugin


Error Code 87 with CABSetup plugin
I am attempting to make a small NSIS script that will help me in the creation/extraction of cab files. Currently, I am playing around with the CABSetup sample files to learn more about how to use the plugin.

I was successful in creating the cab file. Now, I wish to extract from the cab file. However, I get an error code 87 before anything happens. I'm wondering if anyone is able to help me figure out what's going on?

A lot of the code is just copied from the sample, but here it is anyhow:

Section ExtractCab
CABSetup::Extract "C:\Installer\Test\MasterCab\Disk1\MASTER1.CAB" "/TARGET=C:\Installer\Test2" \
/ALL "/reportfile=C:\Installer\Test\MasterCab\MASTER.RPT" \
"/showrate" "/resume"
Pop $R0

; Quit if the extraction completed without error.
${IfThen} $R0 = 0 ${|} Goto Done ${|}

; Handle case where extraction was cancelled.
${If} $R0 = 995
DetailPrint "Extract process was cancelled"
SetDetailsPrint None
Goto Done
${EndIf}

DetailPrint "Extract failed with error code $R0"
Done:

DetailPrint 'Dumping install details log...'
DumpLog::DumpLog 'test.log' .r0
SectionEnd


And here is the log output:
Extract failed with error code 87
Dumping install details log...


If anyone has any ideas, let me know! I could use the help. I have never worked with cab files before.

Thanks!

Awww, dang. I just figured out why it didn't work...

CABSetup::Extract "C:\Installer\Test\MasterCab\Disk1\MASTER1.CAB" "/TARGET=C:\Installer\Test2" \
/ALL "/reportfile=C:\Installer\Test\MasterCab\MASTER.RPT" \
"/showrate" "/resume"


is wrong and it SHOULD be

CABSetup::Extract "/SOURCE=C:\Installer\Test\MasterCab\Disk1\MASTER1.CAB" "/TARGET=C:\Installer\Test2" \
/ALL "/reportfile=C:\Installer\Test\MasterCab\MASTER.RPT" \
"/showrate" "/resume"

Any positive non-zero return code from the CABSetup functions will be a value that could be returned from the GetLastError Windows API function. The value -1 is returned if the normal error code could not be returned and should only happen if the system is extremely low on memory i.e. there is less than the length of an NSIS string free.

Error 87 is as follows (from MSDN):

ERROR_INVALID_PARAMETER
87
0x57

The parameter is incorrect.

As you correctly noticed, one of the parameters passed to the function was incorrect - trying to extract files without a valid source cabinet or target path currently counts as specifying invalid parameters for Extract.

Sounds like it might be an idea to add 87 and its meaning to the commonly returned error codes for each function in CABSetup.txt; I will do this for the next update.

Duncan