Discussion:
[WiX-users] CabExtract returns 0x80070003
Edwin Castro
2015-07-10 05:34:22 UTC
Permalink
I'm trying to use CabExtract from cabutil.h (WiX v3.9) but I always get hr
== 0x80070003 (The system cannot find the path specified).

My code is equivalent to the following:

hr = CabInitialize(false);

hr = PathCreateTempDirectory(NULL, L"extract", 1, &tempDir);

hr = PathConcat(tempDir, L"file.cab", &cabPath);

hr = StrAllocString(&extractDir, tempDir, 0):

hr = PathBackslashTerminate(&extractDir);

hr = CabExtract(cabPath, L"*", extractDir, NULL, NULL, 0);

CabUninitialize();

I see the paths I expect to see when I log cabPath and extrtactDir:

cabPath = C:\Users\user\AppData\Local\Temp\extract\file.cab
extractDir = C:\Users\user\AppData\Local\Temp\extract\

I'm at a loss because I can't figure out what CabExtract is failing to find.

Am I doing something obviously wrong?

Any suggestions as to how I might go about finding out what CabExtract is
actually complaining about?
--
Edwin G. Castro
Edwin Castro
2015-07-10 07:05:36 UTC
Permalink
I think I know what the problem is.

The cab file I'm trying to extract has directories inside. I think when
CabExtractCallback is called for the first file we get wzPath pointing to a
string like C:\Users\user\AppData\Local\Temp\extract\subdir\file1.txt
and the call to CreateFileW fails because
C:\Users\user\AppData\Local\Temp\extract\subdir does not exist yet. I think
this results in GetLastWin32Error returning ERROR_PATH_NOT_FOUND back in
CabOperation which converts the error into 0x80070003 which then gets
returned to CabExtract and finally back to me.

If my guess above is correct, then the fix is to ensure the directory
portion of wzPath exists before calling CreateFileW.
Post by Edwin Castro
I'm trying to use CabExtract from cabutil.h (WiX v3.9) but I always get hr
== 0x80070003 (The system cannot find the path specified).
hr = CabInitialize(false);
hr = PathCreateTempDirectory(NULL, L"extract", 1, &tempDir);
hr = PathConcat(tempDir, L"file.cab", &cabPath);
hr = PathBackslashTerminate(&extractDir);
hr = CabExtract(cabPath, L"*", extractDir, NULL, NULL, 0);
CabUninitialize();
cabPath = C:\Users\user\AppData\Local\Temp\extract\file.cab
extractDir = C:\Users\user\AppData\Local\Temp\extract\
I'm at a loss because I can't figure out what CabExtract is failing to find.
Am I doing something obviously wrong?
Any suggestions as to how I might go about finding out what CabExtract is
actually complaining about?
--
Edwin G. Castro
--
Edwin G. Castro
Loading...