aboutsummaryrefslogtreecommitdiff
path: root/src/wixnative/extractcab.cpp
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2017-11-29 14:08:08 -0800
committerRob Mensching <rob@firegiant.com>2017-11-29 14:08:08 -0800
commitea3d18595a610ee07b03f07af4f03cf75b5ab420 (patch)
treeb69ac2185b05254b136051d561b189c4fda1fc5b /src/wixnative/extractcab.cpp
parent95f4f9b9b99e1a6f91f4687c2dd511a6d6fc2716 (diff)
downloadwix-ea3d18595a610ee07b03f07af4f03cf75b5ab420.tar.gz
wix-ea3d18595a610ee07b03f07af4f03cf75b5ab420.tar.bz2
wix-ea3d18595a610ee07b03f07af4f03cf75b5ab420.zip
Improved cabinet handling
Diffstat (limited to 'src/wixnative/extractcab.cpp')
-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}