VirtualBox

source: vbox/trunk/src/VBox/Main/testcase/msiDarwinDescriptorDecoder.cpp@ 73768

Last change on this file since 73768 was 69500, checked in by vboxsync, 7 years ago

*: scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1/* $Id: msiDarwinDescriptorDecoder.cpp 69500 2017-10-28 15:14:05Z vboxsync $ */
2/** @file
3 * msiDarwinDescriptorDecoder
4 */
5
6/*
7 * Copyright (C) 2016-2017 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18
19#include <stdio.h>
20#include <iprt/win/windows.h> /* Avoid -Wall warnings. */
21
22
23
24typedef DWORD (WINAPI *PFNMSIDECOMPOSEDESCRIPTORW)(PCWSTR pwszDescriptor,
25 LPWSTR pwszProductCode /*[40]*/,
26 LPWSTR pwszFeatureId /*[40]*/,
27 LPWSTR pwszComponentCode /*[40]*/,
28 DWORD *poffArguments);
29
30int wmain(int cArgs, wchar_t **papwszArgs)
31{
32 HMODULE hmodMsi = LoadLibrary("msi.dll");
33 PFNMSIDECOMPOSEDESCRIPTORW pfnMsiDecomposeDescriptorW;
34 pfnMsiDecomposeDescriptorW = (PFNMSIDECOMPOSEDESCRIPTORW)GetProcAddress(hmodMsi, "MsiDecomposeDescriptorW");
35 if (!pfnMsiDecomposeDescriptorW)
36 {
37 fprintf(stderr, "Failed to load msi.dll or resolve 'MsiDecomposeDescriptorW'\n");
38 return 1;
39 }
40
41 int rcExit = 0;
42 for (int iArg = 1; iArg < cArgs; iArg++)
43 {
44 wchar_t wszProductCode[40] = { 0 };
45 wchar_t wszFeatureId[40] = { 0 };
46 wchar_t wszComponentCode[40] = { 0 };
47 DWORD offArguments = ~(DWORD)0;
48 DWORD dwErr = pfnMsiDecomposeDescriptorW(papwszArgs[iArg], wszProductCode, wszFeatureId, wszComponentCode, &offArguments);
49 if (dwErr == 0)
50 {
51 fprintf(stderr,
52 "#%u: '%ls'\n"
53 " -> Product=%ls\n"
54 " -> FeatureId=%ls\n"
55 " -> ComponentCode=%ls\n"
56 " -> offArguments=%#x (%d)\n"
57 , iArg, papwszArgs[iArg], wszProductCode, wszFeatureId, wszComponentCode, offArguments, offArguments);
58 }
59 else
60 {
61 fprintf(stderr,
62 "#%u: '%ls'\n"
63 " -> error %u (%#x)\n"
64 , iArg, papwszArgs[iArg], dwErr, dwErr);
65 rcExit = 1;
66 }
67 }
68
69 return rcExit;
70}
71
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use