Closed fabri9532 closed 4 years ago
Hi!
Actually, the E_FAIL
error code on Windows XP and Vista is correct, while the E_HANDLE
on Windows 7 and later not!
Concerning bit7z itself, it always return E_FAIL
, never E_HANDLE
.
Before further analyzing the issue, I did a quick check in the 7-zip source code (v19.00): it never directly returns E_HANDLE
or the corresponding Win32 error code ERRROR_INVALID_HANDLE
.
So, I think that probably this issue comes either from the result of a WinAPI call in 7-zip, or the result of a GetLastError()
call converted to HRESULT
(either in 7-zip or bit7z).
Anyway, I did some tests on both Windows 7 and 10 with x86 executables, trying to replicate your issue (I still did not manage to set up a development/debugging environment on Windows XP and Vista: they're very old and unsupported OSes).
I've analyzed the error code in the BitException
thrown by BitExtractor::test()
when the tested archive is malformed, and I always got an E_FAIL error code value, which should be the correct behavior, as already mentioned!
So:
E_HANDLE
/ERROR_INVALID_HANDLE
.As a side note, I recently fixed (66d3544fd1250e2b5afa2ac9ff395820e8f7aec3) an issue where Win32 error codes (e.g., return values of GetLastError()
) where not converted to HRESULT. It should not be directly related to your issue, but this commit, together with other recent fixes and improvements, may have indirectly solved your problem!
Finally, I will probably going to replace the HRESULT
error code in BitException
with a more portable std::error_code
to better support cross platform code.
Edit: sorry, I mistakenly closed the issue.
I use the 7z dll v19.00 and Bit7z v3.1.1 .
When I force the handle to close on checking archive, on Windows 7 and later I get the correct error code E_HANDLE. On Windows XP SP3 32 bit and Windows Vista SP2 32 bit I get E_FAIL.
I tried with the 7Zip GUI and got the same behavior. So it is not a bug of Bit7z.
It may be a bug in the 7zip DLL or in the obsolete operating systems.
Thanks, Fabrizio.
When I force the handle to close on checking archive, on Windows 7 and later I get the correct error code E_HANDLE.
Ah ok, you force it! Sorry, I overlooked this detail!
On Windows XP SP3 32 bit and Windows Vista SP2 32 bit I get E_FAIL.
I tried with the 7Zip GUI and got the same behavior. So it is not a bug of Bit7z.
Yeah, in this case bit7z can't do anything, I'm sorry.
It may be a bug in the 7zip DLL or in the obsolete operating systems.
I think so, too.
Thanks, Fabrizio.
You're welcome!
When I using "bit7z::BitExtractor test()" to test an archive, on Windows XP SP3 and Windows Vista SP2, when happen an error, I receive always the error code E_FAIL by "bit7z::BitException getErrorCode()" This do not happen on Windows 7 and later. Tested with 32 bit executable.
To test this behavior, I used the "LockHunter" program (https://lockhunter.com/) which allows you to close the handles on the .7z file being tested. I should receive the E_HANDLE error code. The problem does not occur during compression on the temporary ".7z.tmp" file: I receive the correct error code E_HANDLE. I have not tested the extraction.
E_HANDLE (Invalid Handle) is define as _HRESULTTYPEDEF(0x80070006L)