aboutsummaryrefslogtreecommitdiff
path: root/src/ca/scasmbsched.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ca/scasmbsched.cpp')
-rw-r--r--src/ca/scasmbsched.cpp50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/ca/scasmbsched.cpp b/src/ca/scasmbsched.cpp
index 72536d6d..e29f7f51 100644
--- a/src/ca/scasmbsched.cpp
+++ b/src/ca/scasmbsched.cpp
@@ -92,8 +92,8 @@ void ScaExUserPermsSmbFreeList(SCA_SMB_EX_USER_PERMS* pExUserPermsList)
92} 92}
93 93
94// sql query constants 94// sql query constants
95LPCWSTR vcsSmbQuery = L"SELECT `FileShare`, `ShareName`, `Description`, `Directory_`, " 95LPCWSTR vcsSmbQuery = L"SELECT `Wix4FileShare`, `ShareName`, `Description`, `Directory_`, "
96 L"`Component_`, `User_`, `Permissions` FROM `FileShare`"; 96 L"`Component_`, `User_`, `Permissions` FROM `Wix4FileShare`";
97 97
98enum eSmbQuery { 98enum eSmbQuery {
99 ssqFileShare = 1, 99 ssqFileShare = 1,
@@ -122,26 +122,26 @@ HRESULT ScaSmbRead(SCA_SMB** ppssList)
122 SCA_SMB* pss = NULL; 122 SCA_SMB* pss = NULL;
123 BOOL bUserPermissionsTableExists = FALSE; 123 BOOL bUserPermissionsTableExists = FALSE;
124 124
125 if (S_OK != WcaTableExists(L"FileShare")) 125 if (S_OK != WcaTableExists(L"Wix4FileShare"))
126 { 126 {
127 WcaLog(LOGMSG_VERBOSE, "Skipping ScaSmbCreateShare() - FileShare table not present"); 127 WcaLog(LOGMSG_VERBOSE, "Skipping ScaSmbCreateShare() - Wix4FileShare table not present");
128 ExitFunction1(hr = S_FALSE); 128 ExitFunction1(hr = S_FALSE);
129 } 129 }
130 130
131 if (S_OK == WcaTableExists(L"FileSharePermissions")) 131 if (S_OK == WcaTableExists(L"Wix4FileSharePermissions"))
132 { 132 {
133 bUserPermissionsTableExists = TRUE; 133 bUserPermissionsTableExists = TRUE;
134 } 134 }
135 else 135 else
136 { 136 {
137 WcaLog(LOGMSG_VERBOSE, "No Additional Permissions - FileSharePermissions table not present"); 137 WcaLog(LOGMSG_VERBOSE, "No Additional Permissions - Wix4FileSharePermissions table not present");
138 } 138 }
139 139
140 WcaLog(LOGMSG_VERBOSE, "Reading File Share Tables"); 140 WcaLog(LOGMSG_VERBOSE, "Reading File Share Tables");
141 141
142 // loop through all the fileshares 142 // loop through all the fileshares
143 hr = WcaOpenExecuteView(vcsSmbQuery, &hView); 143 hr = WcaOpenExecuteView(vcsSmbQuery, &hView);
144 ExitOnFailure(hr, "Failed to open view on FileShare table"); 144 ExitOnFailure(hr, "Failed to open view on Wix4FileShare table");
145 while (S_OK == (hr = WcaFetchRecord(hView, &hRec))) 145 while (S_OK == (hr = WcaFetchRecord(hView, &hRec)))
146 { 146 {
147 pss = NewSmb(); 147 pss = NewSmb();
@@ -154,33 +154,33 @@ HRESULT ScaSmbRead(SCA_SMB** ppssList)
154 ::ZeroMemory(pss, sizeof(*pss)); 154 ::ZeroMemory(pss, sizeof(*pss));
155 155
156 hr = WcaGetRecordString(hRec, ssqFileShare, &pwzData); 156 hr = WcaGetRecordString(hRec, ssqFileShare, &pwzData);
157 ExitOnFailure(hr, "Failed to get FileShare.FileShare"); 157 ExitOnFailure(hr, "Failed to get Wix4FileShare.Wix4FileShare");
158 hr = ::StringCchCopyW(pss->wzId, countof(pss->wzId), pwzData); 158 hr = ::StringCchCopyW(pss->wzId, countof(pss->wzId), pwzData);
159 ExitOnFailure(hr, "Failed to copy ID string to smb object"); 159 ExitOnFailure(hr, "Failed to copy ID string to smb object");
160 160
161 hr = WcaGetRecordFormattedString(hRec, ssqShareName, &pwzData); 161 hr = WcaGetRecordFormattedString(hRec, ssqShareName, &pwzData);
162 ExitOnFailure(hr, "Failed to get FileShare.ShareName"); 162 ExitOnFailure(hr, "Failed to get Wix4FileShare.ShareName");
163 hr = ::StringCchCopyW(pss->wzShareName, countof(pss->wzShareName), pwzData); 163 hr = ::StringCchCopyW(pss->wzShareName, countof(pss->wzShareName), pwzData);
164 ExitOnFailure(hr, "Failed to copy share name string to smb object"); 164 ExitOnFailure(hr, "Failed to copy share name string to smb object");
165 165
166 hr = WcaGetRecordString(hRec, ssqComponent, &pwzData); 166 hr = WcaGetRecordString(hRec, ssqComponent, &pwzData);
167 ExitOnFailure(hr, "Failed to get Component for FileShare: '%ls'", pss->wzShareName); 167 ExitOnFailure(hr, "Failed to get Component for Wix4FileShare: '%ls'", pss->wzShareName);
168 hr = ::StringCchCopyW(pss->wzComponent, countof(pss->wzComponent), pwzData); 168 hr = ::StringCchCopyW(pss->wzComponent, countof(pss->wzComponent), pwzData);
169 ExitOnFailure(hr, "Failed to copy component string to smb object"); 169 ExitOnFailure(hr, "Failed to copy component string to smb object");
170 170
171 hr = WcaGetRecordFormattedString(hRec, ssqDescription, &pwzData); 171 hr = WcaGetRecordFormattedString(hRec, ssqDescription, &pwzData);
172 ExitOnFailure(hr, "Failed to get Share Description for FileShare: '%ls'", pss->wzShareName); 172 ExitOnFailure(hr, "Failed to get Share Description for Wix4FileShare: '%ls'", pss->wzShareName);
173 hr = ::StringCchCopyW(pss->wzDescription, countof(pss->wzDescription), pwzData); 173 hr = ::StringCchCopyW(pss->wzDescription, countof(pss->wzDescription), pwzData);
174 ExitOnFailure(hr, "Failed to copy description string to smb object"); 174 ExitOnFailure(hr, "Failed to copy description string to smb object");
175 175
176 // get user info from the user table 176 // get user info from the user table
177 hr = WcaGetRecordFormattedString(hRec, ssqUser, &pwzData); 177 hr = WcaGetRecordFormattedString(hRec, ssqUser, &pwzData);
178 ExitOnFailure(hr, "Failed to get User record for FileShare: '%ls'", pss->wzShareName); 178 ExitOnFailure(hr, "Failed to get Wix4User record for Wix4FileShare: '%ls'", pss->wzShareName);
179 179
180 // get component install state 180 // get component install state
181 er = ::MsiGetComponentStateW(WcaGetInstallHandle(), pss->wzComponent, &pss->isInstalled, &pss->isAction); 181 er = ::MsiGetComponentStateW(WcaGetInstallHandle(), pss->wzComponent, &pss->isInstalled, &pss->isAction);
182 hr = HRESULT_FROM_WIN32(er); 182 hr = HRESULT_FROM_WIN32(er);
183 ExitOnFailure(hr, "Failed to get Component state for FileShare"); 183 ExitOnFailure(hr, "Failed to get Component state for Wix4FileShare");
184 184
185 // if a user was specified 185 // if a user was specified
186 if (*pwzData) 186 if (*pwzData)
@@ -200,7 +200,7 @@ HRESULT ScaSmbRead(SCA_SMB** ppssList)
200 200
201 // get the share's directory 201 // get the share's directory
202 hr = WcaGetRecordString(hRec, ssqDirectory, &pwzData); 202 hr = WcaGetRecordString(hRec, ssqDirectory, &pwzData);
203 ExitOnFailure(hr, "Failed to get directory for FileShare: '%ls'", pss->wzShareName); 203 ExitOnFailure(hr, "Failed to get directory for Wix4FileShare: '%ls'", pss->wzShareName);
204 204
205 WCHAR wzPath[MAX_PATH]; 205 WCHAR wzPath[MAX_PATH];
206 DWORD dwLen; 206 DWORD dwLen;
@@ -236,7 +236,7 @@ HRESULT ScaSmbRead(SCA_SMB** ppssList)
236 ExitOnFailure(hr, "Failed to copy directory string to smb object"); 236 ExitOnFailure(hr, "Failed to copy directory string to smb object");
237 237
238 hr = WcaGetRecordInteger(hRec, ssqPermissions, &pss->nPermissions); 238 hr = WcaGetRecordInteger(hRec, ssqPermissions, &pss->nPermissions);
239 ExitOnFailure(hr, "Failed to get FileShare.Permissions"); 239 ExitOnFailure(hr, "Failed to get Wix4FileShare.Permissions");
240 240
241 // Check to see if additional user & permissions are specified for this share 241 // Check to see if additional user & permissions are specified for this share
242 if (bUserPermissionsTableExists) 242 if (bUserPermissionsTableExists)
@@ -253,7 +253,7 @@ HRESULT ScaSmbRead(SCA_SMB** ppssList)
253 { 253 {
254 hr = S_OK; 254 hr = S_OK;
255 } 255 }
256 ExitOnFailure(hr, "Failure occured while processing FileShare table"); 256 ExitOnFailure(hr, "Failure occured while processing Wix4FileShare table");
257 257
258LExit: 258LExit:
259 // if anything was left over after an error clean it all up 259 // if anything was left over after an error clean it all up
@@ -420,10 +420,10 @@ HRESULT SchedCreateSmb(SCA_SMB* pss)
420 } 420 }
421 421
422 // Schedule the rollback first 422 // Schedule the rollback first
423 hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"CreateSmbRollback"), pwzRollbackCustomActionData, COST_SMB_DROPSMB); 423 hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"CreateSmbRollback"), pwzRollbackCustomActionData, COST_SMB_DROPSMB);
424 ExitOnFailure(hr, "Failed to schedule DropSmb action"); 424 ExitOnFailure(hr, "Failed to schedule DropSmb action");
425 425
426 hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"CreateSmb"), pwzCustomActionData, COST_SMB_CREATESMB); 426 hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"CreateSmb"), pwzCustomActionData, COST_SMB_CREATESMB);
427 ExitOnFailure(hr, "Failed to schedule CreateSmb action"); 427 ExitOnFailure(hr, "Failed to schedule CreateSmb action");
428 428
429LExit: 429LExit:
@@ -511,14 +511,14 @@ HRESULT SchedDropSmb(SCA_SMB* pss)
511 ExitOnFailure(hr, "Failed to add permissions to CustomActionData"); 511 ExitOnFailure(hr, "Failed to add permissions to CustomActionData");
512 } 512 }
513 513
514 hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"DropSmbRollback"), pwzRollbackCustomActionData, COST_SMB_CREATESMB); 514 hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"DropSmbRollback"), pwzRollbackCustomActionData, COST_SMB_CREATESMB);
515 ExitOnFailure(hr, "Failed to schedule DropSmbRollback action"); 515 ExitOnFailure(hr, "Failed to schedule DropSmbRollback action");
516 516
517 // DropSMB 517 // DropSMB
518 hr = WcaWriteStringToCaData(pss->wzShareName, &pwzCustomActionData); 518 hr = WcaWriteStringToCaData(pss->wzShareName, &pwzCustomActionData);
519 ExitOnFailure(hr, "failed to add ShareName to CustomActionData"); 519 ExitOnFailure(hr, "failed to add ShareName to CustomActionData");
520 520
521 hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"DropSmb"), pwzCustomActionData, COST_SMB_DROPSMB); 521 hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"DropSmb"), pwzCustomActionData, COST_SMB_DROPSMB);
522 ExitOnFailure(hr, "Failed to schedule DropSmb action"); 522 ExitOnFailure(hr, "Failed to schedule DropSmb action");
523 523
524LExit: 524LExit:
@@ -558,7 +558,7 @@ LExit:
558} 558}
559 559
560LPCWSTR vcsSmbExUserPermsQuery = L"SELECT `FileShare_`,`User_`,`Permissions` " 560LPCWSTR vcsSmbExUserPermsQuery = L"SELECT `FileShare_`,`User_`,`Permissions` "
561 L"FROM `FileSharePermissions` WHERE `FileShare_`=?"; 561 L"FROM `Wix4FileSharePermissions` WHERE `FileShare_`=?";
562 562
563enum eSmbUserPermsQuery { 563enum eSmbUserPermsQuery {
564 ssupqFileShare = 1, 564 ssupqFileShare = 1,
@@ -588,9 +588,9 @@ HRESULT ScaSmbExPermsRead(SCA_SMB* pss)
588 ExitOnFailure(hr, "Failed to look up FileShare"); 588 ExitOnFailure(hr, "Failed to look up FileShare");
589 589
590 hr = WcaOpenView(vcsSmbExUserPermsQuery, &hView); 590 hr = WcaOpenView(vcsSmbExUserPermsQuery, &hView);
591 ExitOnFailure(hr, "Failed to open view on FileSharePermissions table"); 591 ExitOnFailure(hr, "Failed to open view on Wix4FileSharePermissions table");
592 hr = WcaExecuteView(hView, hRec); 592 hr = WcaExecuteView(hView, hRec);
593 ExitOnFailure(hr, "Failed to execute view on FileSharePermissions table"); 593 ExitOnFailure(hr, "Failed to execute view on Wix4FileSharePermissions table");
594 594
595 // loop through all User/Permissions paris returned 595 // loop through all User/Permissions paris returned
596 while (S_OK == (hr = WcaFetchRecord(hView, &hRec))) 596 while (S_OK == (hr = WcaFetchRecord(hView, &hRec)))
@@ -605,12 +605,12 @@ HRESULT ScaSmbExPermsRead(SCA_SMB* pss)
605 ::ZeroMemory(pExUserPerms, sizeof(*pExUserPerms)); 605 ::ZeroMemory(pExUserPerms, sizeof(*pExUserPerms));
606 606
607 hr = WcaGetRecordString(hRec, ssupqUser, &pwzData); 607 hr = WcaGetRecordString(hRec, ssupqUser, &pwzData);
608 ExitOnFailure(hr, "Failed to get FileSharePermissions.User"); 608 ExitOnFailure(hr, "Failed to get Wix4FileSharePermissions.User");
609 hr = ScaGetUser(pwzData, &pExUserPerms->scau); 609 hr = ScaGetUser(pwzData, &pExUserPerms->scau);
610 ExitOnFailure(hr, "Failed to get user information for fileshare: '%ls'", pss->wzShareName); 610 ExitOnFailure(hr, "Failed to get user information for fileshare: '%ls'", pss->wzShareName);
611 611
612 hr = WcaGetRecordInteger(hRec, ssupqPermissions, &pExUserPerms->nPermissions); 612 hr = WcaGetRecordInteger(hRec, ssupqPermissions, &pExUserPerms->nPermissions);
613 ExitOnFailure(hr, "Failed to get FileSharePermissions.Permissions"); 613 ExitOnFailure(hr, "Failed to get Wix4FileSharePermissions.Permissions");
614 pExUserPerms->accessMode = SET_ACCESS; // we only support SET_ACCESS here 614 pExUserPerms->accessMode = SET_ACCESS; // we only support SET_ACCESS here
615 615
616 pExUserPermsList = AddExUserPermsSmbToList(pExUserPermsList, pExUserPerms); 616 pExUserPermsList = AddExUserPermsSmbToList(pExUserPermsList, pExUserPerms);