aboutsummaryrefslogtreecommitdiff
path: root/src/dutil/cabutil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dutil/cabutil.cpp')
-rw-r--r--src/dutil/cabutil.cpp96
1 files changed, 56 insertions, 40 deletions
diff --git a/src/dutil/cabutil.cpp b/src/dutil/cabutil.cpp
index e0efb717..4a6f7b7b 100644
--- a/src/dutil/cabutil.cpp
+++ b/src/dutil/cabutil.cpp
@@ -2,6 +2,22 @@
2 2
3#include "precomp.h" 3#include "precomp.h"
4 4
5
6// Exit macros
7#define CabExitOnLastError(x, s, ...) ExitOnLastErrorSource(DUTIL_SOURCE_CABUTIL, x, s, __VA_ARGS__)
8#define CabExitOnLastErrorDebugTrace(x, s, ...) ExitOnLastErrorDebugTraceSource(DUTIL_SOURCE_CABUTIL, x, s, __VA_ARGS__)
9#define CabExitWithLastError(x, s, ...) ExitWithLastErrorSource(DUTIL_SOURCE_CABUTIL, x, s, __VA_ARGS__)
10#define CabExitOnFailure(x, s, ...) ExitOnFailureSource(DUTIL_SOURCE_CABUTIL, x, s, __VA_ARGS__)
11#define CabExitOnRootFailure(x, s, ...) ExitOnRootFailureSource(DUTIL_SOURCE_CABUTIL, x, s, __VA_ARGS__)
12#define CabExitOnFailureDebugTrace(x, s, ...) ExitOnFailureDebugTraceSource(DUTIL_SOURCE_CABUTIL, x, s, __VA_ARGS__)
13#define CabExitOnNull(p, x, e, s, ...) ExitOnNullSource(DUTIL_SOURCE_CABUTIL, p, x, e, s, __VA_ARGS__)
14#define CabExitOnNullWithLastError(p, x, s, ...) ExitOnNullWithLastErrorSource(DUTIL_SOURCE_CABUTIL, p, x, s, __VA_ARGS__)
15#define CabExitOnNullDebugTrace(p, x, e, s, ...) ExitOnNullDebugTraceSource(DUTIL_SOURCE_CABUTIL, p, x, e, s, __VA_ARGS__)
16#define CabExitOnInvalidHandleWithLastError(p, x, s, ...) ExitOnInvalidHandleWithLastErrorSource(DUTIL_SOURCE_CABUTIL, p, x, s, __VA_ARGS__)
17#define CabExitOnWin32Error(e, x, s, ...) ExitOnWin32ErrorSource(DUTIL_SOURCE_CABUTIL, e, x, s, __VA_ARGS__)
18#define CabExitOnGdipFailure(g, x, s, ...) ExitOnGdipFailureSource(DUTIL_SOURCE_CABUTIL, g, x, s, __VA_ARGS__)
19
20
5// external prototypes 21// external prototypes
6typedef BOOL (FAR DIAMONDAPI *PFNFDIDESTROY)(VOID*); 22typedef BOOL (FAR DIAMONDAPI *PFNFDIDESTROY)(VOID*);
7typedef HFDI (FAR DIAMONDAPI *PFNFDICREATE)(PFNALLOC, PFNFREE, PFNOPEN, PFNREAD, PFNWRITE, PFNCLOSE, PFNSEEK, int, PERF); 23typedef HFDI (FAR DIAMONDAPI *PFNFDICREATE)(PFNALLOC, PFNFREE, PFNOPEN, PFNREAD, PFNWRITE, PFNCLOSE, PFNSEEK, int, PERF);
@@ -59,20 +75,20 @@ inline HRESULT LoadCabinetDll()
59 if (!vhCabinetDll) 75 if (!vhCabinetDll)
60 { 76 {
61 hr = LoadSystemLibrary(L"cabinet.dll", &vhCabinetDll); 77 hr = LoadSystemLibrary(L"cabinet.dll", &vhCabinetDll);
62 ExitOnFailure(hr, "failed to load cabinet.dll"); 78 CabExitOnFailure(hr, "failed to load cabinet.dll");
63 79
64 // retrieve all address functions 80 // retrieve all address functions
65 vpfnFDICreate = reinterpret_cast<PFNFDICREATE>(::GetProcAddress(vhCabinetDll, "FDICreate")); 81 vpfnFDICreate = reinterpret_cast<PFNFDICREATE>(::GetProcAddress(vhCabinetDll, "FDICreate"));
66 ExitOnNullWithLastError(vpfnFDICreate, hr, "failed to import FDICreate from CABINET.DLL"); 82 CabExitOnNullWithLastError(vpfnFDICreate, hr, "failed to import FDICreate from CABINET.DLL");
67 vpfnFDICopy = reinterpret_cast<PFNFDICOPY>(::GetProcAddress(vhCabinetDll, "FDICopy")); 83 vpfnFDICopy = reinterpret_cast<PFNFDICOPY>(::GetProcAddress(vhCabinetDll, "FDICopy"));
68 ExitOnNullWithLastError(vpfnFDICopy, hr, "failed to import FDICopy from CABINET.DLL"); 84 CabExitOnNullWithLastError(vpfnFDICopy, hr, "failed to import FDICopy from CABINET.DLL");
69 vpfnFDIIsCabinet = reinterpret_cast<PFNFDIISCABINET>(::GetProcAddress(vhCabinetDll, "FDIIsCabinet")); 85 vpfnFDIIsCabinet = reinterpret_cast<PFNFDIISCABINET>(::GetProcAddress(vhCabinetDll, "FDIIsCabinet"));
70 ExitOnNullWithLastError(vpfnFDIIsCabinet, hr, "failed to import FDIIsCabinetfrom CABINET.DLL"); 86 CabExitOnNullWithLastError(vpfnFDIIsCabinet, hr, "failed to import FDIIsCabinetfrom CABINET.DLL");
71 vpfnFDIDestroy = reinterpret_cast<PFNFDIDESTROY>(::GetProcAddress(vhCabinetDll, "FDIDestroy")); 87 vpfnFDIDestroy = reinterpret_cast<PFNFDIDESTROY>(::GetProcAddress(vhCabinetDll, "FDIDestroy"));
72 ExitOnNullWithLastError(vpfnFDIDestroy, hr, "failed to import FDIDestroyfrom CABINET.DLL"); 88 CabExitOnNullWithLastError(vpfnFDIDestroy, hr, "failed to import FDIDestroyfrom CABINET.DLL");
73 89
74 vhfdi = vpfnFDICreate(CabExtractAlloc, CabExtractFree, CabExtractOpen, CabExtractRead, CabExtractWrite, CabExtractClose, CabExtractSeek, cpuUNKNOWN, &verf); 90 vhfdi = vpfnFDICreate(CabExtractAlloc, CabExtractFree, CabExtractOpen, CabExtractRead, CabExtractWrite, CabExtractClose, CabExtractSeek, cpuUNKNOWN, &verf);
75 ExitOnNull(vhfdi, hr, E_FAIL, "failed to initialize cabinet.dll"); 91 CabExitOnNull(vhfdi, hr, E_FAIL, "failed to initialize cabinet.dll");
76 } 92 }
77 93
78LExit: 94LExit:
@@ -99,7 +115,7 @@ extern "C" HRESULT DAPI CabInitialize(
99 if (!fDelayLoad) 115 if (!fDelayLoad)
100 { 116 {
101 hr = LoadCabinetDll(); 117 hr = LoadCabinetDll();
102 ExitOnFailure(hr, "failed to load CABINET.DLL"); 118 CabExitOnFailure(hr, "failed to load CABINET.DLL");
103 } 119 }
104 120
105LExit: 121LExit:
@@ -143,8 +159,8 @@ extern "C" void DAPI CabUninitialize(
143 in the cabinet 159 in the cabinet
144********************************************************************/ 160********************************************************************/
145extern "C" HRESULT DAPI CabEnumerate( 161extern "C" HRESULT DAPI CabEnumerate(
146 __in LPCWSTR wzCabinet, 162 __in_z LPCWSTR wzCabinet,
147 __in LPCWSTR wzEnumerateFile, 163 __in_z LPCWSTR wzEnumerateFile,
148 __in STDCALL_PFNFDINOTIFY pfnNotify, 164 __in STDCALL_PFNFDINOTIFY pfnNotify,
149 __in DWORD64 dw64EmbeddedOffset 165 __in DWORD64 dw64EmbeddedOffset
150 ) 166 )
@@ -161,9 +177,9 @@ extern "C" HRESULT DAPI CabEnumerate(
161 if pfnBeginFile is NULL pfnEndFile must be NULL and vice versa 177 if pfnBeginFile is NULL pfnEndFile must be NULL and vice versa
162********************************************************************/ 178********************************************************************/
163extern "C" HRESULT DAPI CabExtract( 179extern "C" HRESULT DAPI CabExtract(
164 __in LPCWSTR wzCabinet, 180 __in_z LPCWSTR wzCabinet,
165 __in LPCWSTR wzExtractFile, 181 __in_z LPCWSTR wzExtractFile,
166 __in LPCWSTR wzExtractDir, 182 __in_z LPCWSTR wzExtractDir,
167 __in_opt CAB_CALLBACK_PROGRESS pfnProgress, 183 __in_opt CAB_CALLBACK_PROGRESS pfnProgress,
168 __in_opt LPVOID pvContext, 184 __in_opt LPVOID pvContext,
169 __in DWORD64 dw64EmbeddedOffset 185 __in DWORD64 dw64EmbeddedOffset
@@ -238,21 +254,21 @@ static HRESULT DAPI CabOperation(
238 if (!vhfdi) 254 if (!vhfdi)
239 { 255 {
240 hr = LoadCabinetDll(); 256 hr = LoadCabinetDll();
241 ExitOnFailure(hr, "failed to load CABINET.DLL"); 257 CabExitOnFailure(hr, "failed to load CABINET.DLL");
242 } 258 }
243 259
244 hr = StrAllocString(&sczCabinet, wzCabinet, 0); 260 hr = StrAllocString(&sczCabinet, wzCabinet, 0);
245 ExitOnFailure(hr, "Failed to make copy of cabinet name:%ls", wzCabinet); 261 CabExitOnFailure(hr, "Failed to make copy of cabinet name:%ls", wzCabinet);
246 262
247 // 263 //
248 // split the cabinet full path into directory and filename and convert to multi-byte (ick!) 264 // split the cabinet full path into directory and filename and convert to multi-byte (ick!)
249 // 265 //
250 pwz = FileFromPath(sczCabinet); 266 pwz = FileFromPath(sczCabinet);
251 ExitOnNull(pwz, hr, E_INVALIDARG, "failed to process cabinet path: %ls", wzCabinet); 267 CabExitOnNull(pwz, hr, E_INVALIDARG, "failed to process cabinet path: %ls", wzCabinet);
252 268
253 if (!::WideCharToMultiByte(CP_UTF8, 0, pwz, -1, szCabFile, countof(szCabFile), NULL, NULL)) 269 if (!::WideCharToMultiByte(CP_UTF8, 0, pwz, -1, szCabFile, countof(szCabFile), NULL, NULL))
254 { 270 {
255 ExitWithLastError(hr, "failed to convert cabinet filename to ASCII: %ls", pwz); 271 CabExitWithLastError(hr, "failed to convert cabinet filename to ASCII: %ls", pwz);
256 } 272 }
257 273
258 *pwz = '\0'; 274 *pwz = '\0';
@@ -261,13 +277,13 @@ static HRESULT DAPI CabOperation(
261 if (wzCabinet == pwz) 277 if (wzCabinet == pwz)
262 { 278 {
263 hr = ::StringCchCopyA(szCabDirectory, countof(szCabDirectory), ".\\"); 279 hr = ::StringCchCopyA(szCabDirectory, countof(szCabDirectory), ".\\");
264 ExitOnFailure(hr, "Failed to copy relative current directory as cabinet directory."); 280 CabExitOnFailure(hr, "Failed to copy relative current directory as cabinet directory.");
265 } 281 }
266 else 282 else
267 { 283 {
268 if (!::WideCharToMultiByte(CP_UTF8, 0, sczCabinet, -1, szCabDirectory, countof(szCabDirectory), NULL, NULL)) 284 if (!::WideCharToMultiByte(CP_UTF8, 0, sczCabinet, -1, szCabDirectory, countof(szCabDirectory), NULL, NULL))
269 { 285 {
270 ExitWithLastError(hr, "failed to convert cabinet directory to ASCII: %ls", sczCabinet); 286 CabExitWithLastError(hr, "failed to convert cabinet directory to ASCII: %ls", sczCabinet);
271 } 287 }
272 } 288 }
273 289
@@ -295,7 +311,7 @@ static HRESULT DAPI CabOperation(
295 fResult = vpfnFDICopy(vhfdi, szCabFile, szCabDirectory, 0, pfnFdiNotify, NULL, static_cast<void*>(&ccs)); 311 fResult = vpfnFDICopy(vhfdi, szCabFile, szCabDirectory, 0, pfnFdiNotify, NULL, static_cast<void*>(&ccs));
296 if (!fResult && !ccs.fStopExtracting) // if something went wrong and it wasn't us just stopping the extraction, then return a failure 312 if (!fResult && !ccs.fStopExtracting) // if something went wrong and it wasn't us just stopping the extraction, then return a failure
297 { 313 {
298 ExitWithLastError(hr, "failed to extract cabinet file: %ls", sczCabinet); 314 CabExitWithLastError(hr, "failed to extract cabinet file: %ls", sczCabinet);
299 } 315 }
300 316
301LExit: 317LExit:
@@ -331,22 +347,22 @@ static __callback INT_PTR FAR DIAMONDAPI CabExtractOpen(__in_z PSTR pszFile, __i
331 if ((oflag != (/*_O_BINARY*/ 0x8000 | /*_O_RDONLY*/ 0x0000)) || (pmode != (_S_IREAD | _S_IWRITE))) 347 if ((oflag != (/*_O_BINARY*/ 0x8000 | /*_O_RDONLY*/ 0x0000)) || (pmode != (_S_IREAD | _S_IWRITE)))
332 { 348 {
333 hr = E_OUTOFMEMORY; 349 hr = E_OUTOFMEMORY;
334 ExitOnFailure(hr, "FDI asked for a scratch file to be created, which is unsupported"); 350 CabExitOnFailure(hr, "FDI asked for a scratch file to be created, which is unsupported");
335 } 351 }
336 352
337 hr = StrAllocStringAnsi(&sczCabFile, pszFile, 0, CP_UTF8); 353 hr = StrAllocStringAnsi(&sczCabFile, pszFile, 0, CP_UTF8);
338 ExitOnFailure(hr, "Failed to convert UTF8 cab file name to wide character string"); 354 CabExitOnFailure(hr, "Failed to convert UTF8 cab file name to wide character string");
339 355
340 pFile = reinterpret_cast<INT_PTR>(::CreateFileW(sczCabFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)); 356 pFile = reinterpret_cast<INT_PTR>(::CreateFileW(sczCabFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL));
341 if (INVALID_HANDLE_VALUE == reinterpret_cast<HANDLE>(pFile)) 357 if (INVALID_HANDLE_VALUE == reinterpret_cast<HANDLE>(pFile))
342 { 358 {
343 ExitWithLastError(hr, "failed to open file: %ls", sczCabFile); 359 CabExitWithLastError(hr, "failed to open file: %ls", sczCabFile);
344 } 360 }
345 361
346 if (vdw64EmbeddedOffset) 362 if (vdw64EmbeddedOffset)
347 { 363 {
348 hr = CabExtractSeek(pFile, 0, 0); 364 hr = CabExtractSeek(pFile, 0, 0);
349 ExitOnFailure(hr, "Failed to seek to embedded offset %I64d", vdw64EmbeddedOffset); 365 CabExitOnFailure(hr, "Failed to seek to embedded offset %I64d", vdw64EmbeddedOffset);
350 } 366 }
351 367
352LExit: 368LExit:
@@ -361,10 +377,10 @@ static __callback UINT FAR DIAMONDAPI CabExtractRead(__in INT_PTR hf, __out void
361 HRESULT hr = S_OK; 377 HRESULT hr = S_OK;
362 DWORD cbRead = 0; 378 DWORD cbRead = 0;
363 379
364 ExitOnNull(hf, hr, E_INVALIDARG, "Failed to read file during cabinet extraction - no file given to read"); 380 CabExitOnNull(hf, hr, E_INVALIDARG, "Failed to read file during cabinet extraction - no file given to read");
365 if (!::ReadFile(reinterpret_cast<HANDLE>(hf), pv, cb, &cbRead, NULL)) 381 if (!::ReadFile(reinterpret_cast<HANDLE>(hf), pv, cb, &cbRead, NULL))
366 { 382 {
367 ExitWithLastError(hr, "failed to read during cabinet extraction"); 383 CabExitWithLastError(hr, "failed to read during cabinet extraction");
368 } 384 }
369 385
370LExit: 386LExit:
@@ -377,10 +393,10 @@ static __callback UINT FAR DIAMONDAPI CabExtractWrite(__in INT_PTR hf, __in void
377 HRESULT hr = S_OK; 393 HRESULT hr = S_OK;
378 DWORD cbWrite = 0; 394 DWORD cbWrite = 0;
379 395
380 ExitOnNull(hf, hr, E_INVALIDARG, "Failed to write file during cabinet extraction - no file given to write"); 396 CabExitOnNull(hf, hr, E_INVALIDARG, "Failed to write file during cabinet extraction - no file given to write");
381 if (!::WriteFile(reinterpret_cast<HANDLE>(hf), pv, cb, &cbWrite, NULL)) 397 if (!::WriteFile(reinterpret_cast<HANDLE>(hf), pv, cb, &cbWrite, NULL))
382 { 398 {
383 ExitWithLastError(hr, "failed to write during cabinet extraction"); 399 CabExitWithLastError(hr, "failed to write during cabinet extraction");
384 } 400 }
385 401
386LExit: 402LExit:
@@ -409,7 +425,7 @@ static __callback long FAR DIAMONDAPI CabExtractSeek(__in INT_PTR hf, __in long
409 default : 425 default :
410 dwMoveMethod = 0; 426 dwMoveMethod = 0;
411 hr = E_UNEXPECTED; 427 hr = E_UNEXPECTED;
412 ExitOnFailure(hr, "unexpected seektype in FDISeek(): %d", seektype); 428 CabExitOnFailure(hr, "unexpected seektype in FDISeek(): %d", seektype);
413 } 429 }
414 430
415 // SetFilePointer returns -1 if it fails (this will cause FDI to quit with an FDIERROR_USER_ABORT error. 431 // SetFilePointer returns -1 if it fails (this will cause FDI to quit with an FDIERROR_USER_ABORT error.
@@ -417,7 +433,7 @@ static __callback long FAR DIAMONDAPI CabExtractSeek(__in INT_PTR hf, __in long
417 lMove = ::SetFilePointer(reinterpret_cast<HANDLE>(hf), dist, NULL, dwMoveMethod); 433 lMove = ::SetFilePointer(reinterpret_cast<HANDLE>(hf), dist, NULL, dwMoveMethod);
418 if (0xFFFFFFFF == lMove) 434 if (0xFFFFFFFF == lMove)
419 { 435 {
420 ExitWithLastError(hr, "failed to move file pointer %d bytes", dist); 436 CabExitWithLastError(hr, "failed to move file pointer %d bytes", dist);
421 } 437 }
422 438
423LExit: 439LExit:
@@ -431,7 +447,7 @@ static __callback int FAR DIAMONDAPI CabExtractClose(__in INT_PTR hf)
431 447
432 if (!::CloseHandle(reinterpret_cast<HANDLE>(hf))) 448 if (!::CloseHandle(reinterpret_cast<HANDLE>(hf)))
433 { 449 {
434 ExitWithLastError(hr, "failed to close file during cabinet extraction"); 450 CabExitWithLastError(hr, "failed to close file during cabinet extraction");
435 } 451 }
436 452
437LExit: 453LExit:
@@ -454,8 +470,8 @@ static __callback INT_PTR DIAMONDAPI CabExtractCallback(__in FDINOTIFICATIONTYPE
454 switch (iNotification) 470 switch (iNotification)
455 { 471 {
456 case fdintCOPY_FILE: // begin extracting a resource from cabinet 472 case fdintCOPY_FILE: // begin extracting a resource from cabinet
457 ExitOnNull(pFDINotify->psz1, hr, E_INVALIDARG, "No cabinet file ID given to convert"); 473 CabExitOnNull(pFDINotify->psz1, hr, E_INVALIDARG, "No cabinet file ID given to convert");
458 ExitOnNull(pccs, hr, E_INVALIDARG, "Failed to call cabextract callback, because no callback struct was provided"); 474 CabExitOnNull(pccs, hr, E_INVALIDARG, "Failed to call cabextract callback, because no callback struct was provided");
459 475
460 if (pccs->fStopExtracting) 476 if (pccs->fStopExtracting)
461 { 477 {
@@ -466,7 +482,7 @@ static __callback INT_PTR DIAMONDAPI CabExtractCallback(__in FDINOTIFICATIONTYPE
466 sz = static_cast<LPCSTR>(pFDINotify->psz1); 482 sz = static_cast<LPCSTR>(pFDINotify->psz1);
467 if (!::MultiByteToWideChar(CP_ACP, 0, sz, -1, wz, countof(wz))) 483 if (!::MultiByteToWideChar(CP_ACP, 0, sz, -1, wz, countof(wz)))
468 { 484 {
469 ExitWithLastError(hr, "failed to convert cabinet file id to unicode: %s", sz); 485 CabExitWithLastError(hr, "failed to convert cabinet file id to unicode: %s", sz);
470 } 486 }
471 487
472 if (pccs->pfnProgress) 488 if (pccs->pfnProgress)
@@ -484,21 +500,21 @@ static __callback INT_PTR DIAMONDAPI CabExtractCallback(__in FDINOTIFICATIONTYPE
484 FILETIME ftLocal; 500 FILETIME ftLocal;
485 if (!::DosDateTimeToFileTime(pFDINotify->date, pFDINotify->time, &ftLocal)) 501 if (!::DosDateTimeToFileTime(pFDINotify->date, pFDINotify->time, &ftLocal))
486 { 502 {
487 ExitWithLastError(hr, "failed to get time for resource: %ls", wz); 503 CabExitWithLastError(hr, "failed to get time for resource: %ls", wz);
488 } 504 }
489 ::LocalFileTimeToFileTime(&ftLocal, &ft); 505 ::LocalFileTimeToFileTime(&ftLocal, &ft);
490 506
491 507
492 WCHAR wzPath[MAX_PATH]; 508 WCHAR wzPath[MAX_PATH];
493 hr = ::StringCchCopyW(wzPath, countof(wzPath), pccs->pwzExtractDir); 509 hr = ::StringCchCopyW(wzPath, countof(wzPath), pccs->pwzExtractDir);
494 ExitOnFailure(hr, "failed to copy in extract directory: %ls for file: %ls", pccs->pwzExtractDir, wz); 510 CabExitOnFailure(hr, "failed to copy in extract directory: %ls for file: %ls", pccs->pwzExtractDir, wz);
495 hr = ::StringCchCatW(wzPath, countof(wzPath), wz); 511 hr = ::StringCchCatW(wzPath, countof(wzPath), wz);
496 ExitOnFailure(hr, "failed to concat onto path: %ls file: %ls", wzPath, wz); 512 CabExitOnFailure(hr, "failed to concat onto path: %ls file: %ls", wzPath, wz);
497 513
498 ipResult = reinterpret_cast<INT_PTR>(::CreateFileW(wzPath, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)); 514 ipResult = reinterpret_cast<INT_PTR>(::CreateFileW(wzPath, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL));
499 if (INVALID_HANDLE_VALUE == reinterpret_cast<HANDLE>(ipResult)) 515 if (INVALID_HANDLE_VALUE == reinterpret_cast<HANDLE>(ipResult))
500 { 516 {
501 ExitWithLastError(hr, "failed to create file: %s", wzPath); 517 CabExitWithLastError(hr, "failed to create file: %ls", wzPath);
502 } 518 }
503 519
504 ::SetFileTime(reinterpret_cast<HANDLE>(ipResult), &ft, &ft, &ft); // try to set the file time (who cares if it fails) 520 ::SetFileTime(reinterpret_cast<HANDLE>(ipResult), &ft, &ft, &ft); // try to set the file time (who cares if it fails)
@@ -520,15 +536,15 @@ static __callback INT_PTR DIAMONDAPI CabExtractCallback(__in FDINOTIFICATIONTYPE
520 break; 536 break;
521 case fdintCLOSE_FILE_INFO: // resource extraction complete 537 case fdintCLOSE_FILE_INFO: // resource extraction complete
522 Assert(pFDINotify->hf && pFDINotify->psz1); 538 Assert(pFDINotify->hf && pFDINotify->psz1);
523 ExitOnNull(pccs, hr, E_INVALIDARG, "Failed to call cabextract callback, because no callback struct was provided"); 539 CabExitOnNull(pccs, hr, E_INVALIDARG, "Failed to call cabextract callback, because no callback struct was provided");
524 540
525 // convert params to useful variables 541 // convert params to useful variables
526 sz = static_cast<LPCSTR>(pFDINotify->psz1); 542 sz = static_cast<LPCSTR>(pFDINotify->psz1);
527 ExitOnNull(sz, hr, E_INVALIDARG, "Failed to convert cabinet file id, because no cabinet file id was provided"); 543 CabExitOnNull(sz, hr, E_INVALIDARG, "Failed to convert cabinet file id, because no cabinet file id was provided");
528 544
529 if (!::MultiByteToWideChar(CP_ACP, 0, sz, -1, wz, countof(wz))) 545 if (!::MultiByteToWideChar(CP_ACP, 0, sz, -1, wz, countof(wz)))
530 { 546 {
531 ExitWithLastError(hr, "failed to convert cabinet file id to unicode: %s", sz); 547 CabExitWithLastError(hr, "failed to convert cabinet file id to unicode: %s", sz);
532 } 548 }
533 549
534 if (NULL != pFDINotify->hf) // just close the file 550 if (NULL != pFDINotify->hf) // just close the file