aboutsummaryrefslogtreecommitdiff
path: root/src/ca/scasched.cpp
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2018-12-15 21:46:30 -0600
committerGitHub <noreply@github.com>2018-12-15 21:46:30 -0600
commitf7020c0d16baf2b960e7123e233e20c519f6a340 (patch)
treed2cd464ee15b2b3f304ff780c531b39bb292d331 /src/ca/scasched.cpp
parent6ed8d107e6edf16956c778bda3573f8d7a7690fc (diff)
downloadwix-f7020c0d16baf2b960e7123e233e20c519f6a340.tar.gz
wix-f7020c0d16baf2b960e7123e233e20c519f6a340.tar.bz2
wix-f7020c0d16baf2b960e7123e233e20c519f6a340.zip
Import implementation of UtilCA from old repo's WixCA/scasched/scaexec. (#3)
Diffstat (limited to 'src/ca/scasched.cpp')
-rw-r--r--src/ca/scasched.cpp127
1 files changed, 127 insertions, 0 deletions
diff --git a/src/ca/scasched.cpp b/src/ca/scasched.cpp
new file mode 100644
index 00000000..ba230a9e
--- /dev/null
+++ b/src/ca/scasched.cpp
@@ -0,0 +1,127 @@
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
6/********************************************************************
7ConfigureSmb - CUSTOM ACTION ENTRY POINT for installing fileshare settings
8
9********************************************************************/
10extern "C" UINT __stdcall ConfigureSmbInstall(
11 __in MSIHANDLE hInstall
12 )
13{
14 HRESULT hr = S_OK;
15 UINT er = ERROR_SUCCESS;
16
17 SCA_SMB* pssList = NULL;
18
19 // initialize
20 hr = WcaInitialize(hInstall, "ConfigureSmbInstall");
21 ExitOnFailure(hr, "Failed to initialize");
22
23 // check to see if necessary tables are specified
24 if (WcaTableExists(L"FileShare") != S_OK)
25 {
26 WcaLog(LOGMSG_VERBOSE, "Skipping SMB CustomAction, no FileShare table");
27 ExitFunction1(hr = S_FALSE);
28 }
29
30 hr = ScaSmbRead(&pssList);
31 ExitOnFailure(hr, "failed to read FileShare table");
32
33 hr = ScaSmbInstall(pssList);
34 ExitOnFailure(hr, "failed to install FileShares");
35
36LExit:
37 if (pssList)
38 ScaSmbFreeList(pssList);
39
40 er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
41 return WcaFinalize(er);
42}
43
44
45/********************************************************************
46ConfigureSmb - CUSTOM ACTION ENTRY POINT for installing fileshare settings
47
48********************************************************************/
49extern "C" UINT __stdcall ConfigureSmbUninstall(
50 __in MSIHANDLE hInstall
51 )
52{
53 HRESULT hr = S_OK;
54 UINT er = ERROR_SUCCESS;
55
56 SCA_SMB* pssList = NULL;
57
58 // initialize
59 hr = WcaInitialize(hInstall, "ConfigureSmbUninstall");
60 ExitOnFailure(hr, "Failed to initialize");
61
62 // check to see if necessary tables are specified
63 if (WcaTableExists(L"FileShare") != S_OK)
64 {
65 WcaLog(LOGMSG_VERBOSE, "Skipping SMB CustomAction, no FileShare table");
66 ExitFunction1(hr = S_FALSE);
67 }
68
69 hr = ScaSmbRead(&pssList);
70 ExitOnFailure(hr, "failed to read FileShare table");
71
72 hr = ScaSmbUninstall(pssList);
73 ExitOnFailure(hr, "failed to uninstall FileShares");
74
75LExit:
76 if (pssList)
77 ScaSmbFreeList(pssList);
78
79 er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
80 return WcaFinalize(er);
81}
82
83
84/********************************************************************
85ConfigureUsers - CUSTOM ACTION ENTRY POINT for installing users
86
87********************************************************************/
88extern "C" UINT __stdcall ConfigureUsers(
89 __in MSIHANDLE hInstall
90 )
91{
92 //AssertSz(0, "Debug ConfigureUsers");
93
94 HRESULT hr = S_OK;
95 UINT er = ERROR_SUCCESS;
96
97 BOOL fInitializedCom = FALSE;
98 SCA_USER* psuList = NULL;
99
100 // initialize
101 hr = WcaInitialize(hInstall, "ConfigureUsers");
102 ExitOnFailure(hr, "Failed to initialize");
103
104 hr = ::CoInitialize(NULL);
105 ExitOnFailure(hr, "failed to initialize COM");
106 fInitializedCom = TRUE;
107
108 hr = ScaUserRead(&psuList);
109 ExitOnFailure(hr, "failed to read User table");
110
111 hr = ScaUserExecute(psuList);
112 ExitOnFailure(hr, "failed to add/remove User actions");
113
114LExit:
115 if (psuList)
116 {
117 ScaUserFreeList(psuList);
118 }
119
120 if (fInitializedCom)
121 {
122 ::CoUninitialize();
123 }
124
125 er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
126 return WcaFinalize(er);
127} \ No newline at end of file