aboutsummaryrefslogtreecommitdiff
path: root/src/wixnative/extractcab.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/wixnative/extractcab.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/wixnative/extractcab.cpp b/src/wixnative/extractcab.cpp
new file mode 100644
index 00000000..53f53266
--- /dev/null
+++ b/src/wixnative/extractcab.cpp
@@ -0,0 +1,50 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3#include "precomp.h"
4
5static HRESULT ProgressCallback(BOOL fBeginFile, LPCWSTR wzFileId, LPVOID pvContext);
6
7
8HRESULT ExtractCabCommand(
9 __in int argc,
10 __in LPWSTR argv[]
11)
12{
13 HRESULT hr = E_INVALIDARG;
14 LPCWSTR wzCabPath = NULL;
15 LPCWSTR wzOutputFolder = NULL;
16
17 if (argc < 2)
18 {
19 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Must specify: cabPath outputFolder");
20 }
21
22 wzCabPath = argv[0];
23 wzOutputFolder = argv[1];
24
25 hr = CabInitialize(FALSE);
26 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "failed to initialize cabinet: %ls", wzCabPath);
27
28 hr = CabExtract(wzCabPath, L"*", wzOutputFolder, ProgressCallback, NULL, 0);
29 ExitOnFailure(hr, "failed to compress files into cabinet: %ls", wzCabPath);
30
31LExit:
32 CabUninitialize();
33
34 return hr;
35}
36
37
38static HRESULT ProgressCallback(
39 __in BOOL fBeginFile,
40 __in LPCWSTR wzFileId,
41 __in LPVOID /*pvContext*/
42)
43{
44 if (fBeginFile)
45 {
46 ConsoleWriteLine(CONSOLE_COLOR_NORMAL, "%ls", wzFileId);
47 }
48
49 return S_OK;
50}