diff options
Diffstat (limited to 'src/wix/wixnative/enumcab.cpp')
-rw-r--r-- | src/wix/wixnative/enumcab.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/wix/wixnative/enumcab.cpp b/src/wix/wixnative/enumcab.cpp new file mode 100644 index 00000000..e7717bac --- /dev/null +++ b/src/wix/wixnative/enumcab.cpp | |||
@@ -0,0 +1,47 @@ | |||
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 | |||
5 | static INT_PTR __stdcall EnumCallback(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin); | ||
6 | |||
7 | |||
8 | HRESULT EnumCabCommand( | ||
9 | __in int argc, | ||
10 | __in LPWSTR argv[] | ||
11 | ) | ||
12 | { | ||
13 | HRESULT hr = E_INVALIDARG; | ||
14 | LPCWSTR wzCabPath = NULL; | ||
15 | |||
16 | if (argc < 1) | ||
17 | { | ||
18 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Must specify: cabPath outputFolder"); | ||
19 | } | ||
20 | |||
21 | wzCabPath = argv[0]; | ||
22 | |||
23 | hr = CabInitialize(FALSE); | ||
24 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "failed to initialize cabinet: %ls", wzCabPath); | ||
25 | |||
26 | hr = CabEnumerate(wzCabPath, L"*", EnumCallback, 0); | ||
27 | ExitOnFailure(hr, "failed to compress files into cabinet: %ls", wzCabPath); | ||
28 | |||
29 | LExit: | ||
30 | CabUninitialize(); | ||
31 | |||
32 | return hr; | ||
33 | } | ||
34 | |||
35 | |||
36 | static INT_PTR __stdcall EnumCallback( | ||
37 | __in FDINOTIFICATIONTYPE fdint, | ||
38 | __in PFDINOTIFICATION pfdin | ||
39 | ) | ||
40 | { | ||
41 | if (fdint == fdintCOPY_FILE) | ||
42 | { | ||
43 | ConsoleWriteLine(CONSOLE_COLOR_NORMAL, "%s\t%d\t%u\t%u", pfdin->psz1, pfdin->cb, pfdin->date, pfdin->time); | ||
44 | } | ||
45 | |||
46 | return 0; | ||
47 | } | ||