aboutsummaryrefslogtreecommitdiff
path: root/src/wixnative/enumcab.cpp
blob: e7717bac58f1fe201e9118644cf63f2fd3f69d2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// 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.

#include "precomp.h"

static INT_PTR __stdcall EnumCallback(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin);


HRESULT EnumCabCommand(
    __in int argc,
    __in LPWSTR argv[]
)
{
    HRESULT hr = E_INVALIDARG;
    LPCWSTR wzCabPath = NULL;

    if (argc < 1)
    {
        ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Must specify: cabPath outputFolder");
    }

    wzCabPath = argv[0];

    hr = CabInitialize(FALSE);
    ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "failed to initialize cabinet: %ls", wzCabPath);

    hr = CabEnumerate(wzCabPath, L"*", EnumCallback, 0);
    ExitOnFailure(hr, "failed to compress files into cabinet: %ls", wzCabPath);

LExit:
    CabUninitialize();

    return hr;
}


static INT_PTR __stdcall EnumCallback(
    __in FDINOTIFICATIONTYPE fdint,
    __in PFDINOTIFICATION pfdin
)
{
    if (fdint == fdintCOPY_FILE)
    {
        ConsoleWriteLine(CONSOLE_COLOR_NORMAL, "%s\t%d\t%u\t%u", pfdin->psz1, pfdin->cb, pfdin->date, pfdin->time);
    }

    return 0;
}