diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2020-05-23 15:55:58 +1000 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2020-05-23 16:00:11 +1000 |
commit | 6fbe9b0b7e98e63daa89c1347e5388dec9fdc57f (patch) | |
tree | 98c04dcb4cfdd19aca0d292b97810cac00aa6adb /src/ca | |
parent | 242d5201cb75c686f4cb86e521ed0d8c025c563b (diff) | |
download | wix-6fbe9b0b7e98e63daa89c1347e5388dec9fdc57f.tar.gz wix-6fbe9b0b7e98e63daa89c1347e5388dec9fdc57f.tar.bz2 wix-6fbe9b0b7e98e63daa89c1347e5388dec9fdc57f.zip |
WIXFEAT:2006,2580,2751 Add Inheritable attribute to PermissionEx.
Diffstat (limited to 'src/ca')
-rw-r--r-- | src/ca/secureobj.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/ca/secureobj.cpp b/src/ca/secureobj.cpp index 392945d9..72842eb5 100644 --- a/src/ca/secureobj.cpp +++ b/src/ca/secureobj.cpp | |||
@@ -3,10 +3,10 @@ | |||
3 | #include "precomp.h" | 3 | #include "precomp.h" |
4 | 4 | ||
5 | // structs | 5 | // structs |
6 | LPCWSTR wzQUERY_SECUREOBJECTS = L"SELECT `Wix4SecureObject`.`Wix4SecureObject`, `Wix4SecureObject`.`Table`, `Wix4SecureObject`.`Domain`, `Wix4SecureObject`.`User`, " | 6 | LPCWSTR wzQUERY_SECUREOBJECTS = L"SELECT `Wix4SecureObject`.`Wix4SecureObject`, `Wix4SecureObject`.`Table`, `Wix4SecureObject`.`Domain`, `Wix4SecureObject`.`User`, `Wix4SecureObject`.`Attributes`, " |
7 | L"`Wix4SecureObject`.`Permission`, `Wix4SecureObject`.`Component_`, `Component`.`Attributes` FROM `Wix4SecureObject`,`Component` WHERE " | 7 | L"`Wix4SecureObject`.`Permission`, `Wix4SecureObject`.`Component_`, `Component`.`Attributes` FROM `Wix4SecureObject`,`Component` WHERE " |
8 | L"`Wix4SecureObject`.`Component_`=`Component`.`Component`"; | 8 | L"`Wix4SecureObject`.`Component_`=`Component`.`Component`"; |
9 | enum eQUERY_SECUREOBJECTS { QSO_SECUREOBJECT = 1, QSO_TABLE, QSO_DOMAIN, QSO_USER, QSO_PERMISSION, QSO_COMPONENT, QSO_COMPATTRIBUTES }; | 9 | enum eQUERY_SECUREOBJECTS { QSO_SECUREOBJECT = 1, QSO_TABLE, QSO_DOMAIN, QSO_USER, QSO_ATTRIBUTES, QSO_PERMISSION, QSO_COMPONENT, QSO_COMPATTRIBUTES }; |
10 | 10 | ||
11 | LPCWSTR wzQUERY_REGISTRY = L"SELECT `Registry`.`Registry`, `Registry`.`Root`, `Registry`.`Key` FROM `Registry` WHERE `Registry`.`Registry`=?"; | 11 | LPCWSTR wzQUERY_REGISTRY = L"SELECT `Registry`.`Registry`, `Registry`.`Root`, `Registry`.`Key` FROM `Registry` WHERE `Registry`.`Registry`=?"; |
12 | enum eQUERY_OBJECTCOMPONENT { QSOC_REGISTRY = 1, QSOC_REGROOT, QSOC_REGKEY }; | 12 | enum eQUERY_OBJECTCOMPONENT { QSOC_REGISTRY = 1, QSOC_REGROOT, QSOC_REGKEY }; |
@@ -16,6 +16,11 @@ enum eQUERY_SECURESERVICEINSTALL { QSSI_NAME = 1 }; | |||
16 | 16 | ||
17 | enum eOBJECTTYPE { OT_UNKNOWN, OT_SERVICE, OT_FOLDER, OT_FILE, OT_REGISTRY }; | 17 | enum eOBJECTTYPE { OT_UNKNOWN, OT_SERVICE, OT_FOLDER, OT_FILE, OT_REGISTRY }; |
18 | 18 | ||
19 | enum eSECURE_OBJECT_ATTRIBUTE | ||
20 | { | ||
21 | SECURE_OBJECT_ATTRIBUTE_INHERITABLE = 0x1, | ||
22 | }; | ||
23 | |||
19 | static eOBJECTTYPE EObjectTypeFromString( | 24 | static eOBJECTTYPE EObjectTypeFromString( |
20 | __in LPCWSTR pwzTable | 25 | __in LPCWSTR pwzTable |
21 | ) | 26 | ) |
@@ -335,6 +340,7 @@ extern "C" UINT __stdcall SchedSecureObjects( | |||
335 | 340 | ||
336 | DWORD cObjects = 0; | 341 | DWORD cObjects = 0; |
337 | eOBJECTTYPE eType = OT_UNKNOWN; | 342 | eOBJECTTYPE eType = OT_UNKNOWN; |
343 | DWORD dwAttributes = 0; | ||
338 | 344 | ||
339 | // | 345 | // |
340 | // initialize | 346 | // initialize |
@@ -409,7 +415,6 @@ extern "C" UINT __stdcall SchedSecureObjects( | |||
409 | // add the data to the CustomActionData | 415 | // add the data to the CustomActionData |
410 | hr = WcaGetRecordString(hRec, QSO_SECUREOBJECT, &pwzData); | 416 | hr = WcaGetRecordString(hRec, QSO_SECUREOBJECT, &pwzData); |
411 | ExitOnFailure(hr, "failed to get name of object"); | 417 | ExitOnFailure(hr, "failed to get name of object"); |
412 | |||
413 | hr = WcaWriteStringToCaData(pwzTable, &pwzCustomActionData); | 418 | hr = WcaWriteStringToCaData(pwzTable, &pwzCustomActionData); |
414 | ExitOnFailure(hr, "failed to add data to CustomActionData"); | 419 | ExitOnFailure(hr, "failed to add data to CustomActionData"); |
415 | 420 | ||
@@ -423,6 +428,11 @@ extern "C" UINT __stdcall SchedSecureObjects( | |||
423 | hr = WcaWriteStringToCaData(pwzData, &pwzCustomActionData); | 428 | hr = WcaWriteStringToCaData(pwzData, &pwzCustomActionData); |
424 | ExitOnFailure(hr, "failed to add data to CustomActionData"); | 429 | ExitOnFailure(hr, "failed to add data to CustomActionData"); |
425 | 430 | ||
431 | hr = WcaGetRecordInteger(hRec, QSO_ATTRIBUTES, reinterpret_cast<int*>(&dwAttributes)); | ||
432 | ExitOnFailure(hr, "failed to get attributes to configure object"); | ||
433 | hr = WcaWriteIntegerToCaData(dwAttributes, &pwzCustomActionData); | ||
434 | ExitOnFailure(hr, "failed to add data to CustomActionData"); | ||
435 | |||
426 | hr = WcaGetRecordString(hRec, QSO_PERMISSION, &pwzData); | 436 | hr = WcaGetRecordString(hRec, QSO_PERMISSION, &pwzData); |
427 | ExitOnFailure(hr, "failed to get permission to configure object"); | 437 | ExitOnFailure(hr, "failed to get permission to configure object"); |
428 | hr = WcaWriteStringToCaData(pwzData, &pwzCustomActionData); | 438 | hr = WcaWriteStringToCaData(pwzData, &pwzCustomActionData); |
@@ -568,7 +578,7 @@ LExit: | |||
568 | called as Type 1025 CustomAction (deferred binary DLL) | 578 | called as Type 1025 CustomAction (deferred binary DLL) |
569 | 579 | ||
570 | NOTE: deferred CustomAction since it modifies the machine | 580 | NOTE: deferred CustomAction since it modifies the machine |
571 | NOTE: CustomActionData == wzObject\twzTable\twzDomain\twzUser\tdwPermissions\twzObject\t... | 581 | NOTE: CustomActionData == wzObject\twzTable\twzDomain\twzUser\tdwAttributes\tdwPermissions\t... |
572 | ******************************************************************/ | 582 | ******************************************************************/ |
573 | extern "C" UINT __stdcall ExecSecureObjects( | 583 | extern "C" UINT __stdcall ExecSecureObjects( |
574 | __in MSIHANDLE hInstall | 584 | __in MSIHANDLE hInstall |
@@ -586,6 +596,7 @@ extern "C" UINT __stdcall ExecSecureObjects( | |||
586 | DWORD dwRevision = 0; | 596 | DWORD dwRevision = 0; |
587 | LPWSTR pwzUser = NULL; | 597 | LPWSTR pwzUser = NULL; |
588 | DWORD dwPermissions = 0; | 598 | DWORD dwPermissions = 0; |
599 | DWORD dwAttributes = 0; | ||
589 | LPWSTR pwzAccount = NULL; | 600 | LPWSTR pwzAccount = NULL; |
590 | PSID psid = NULL; | 601 | PSID psid = NULL; |
591 | 602 | ||
@@ -626,8 +637,10 @@ extern "C" UINT __stdcall ExecSecureObjects( | |||
626 | ExitOnFailure(hr, "failed to process CustomActionData"); | 637 | ExitOnFailure(hr, "failed to process CustomActionData"); |
627 | hr = WcaReadStringFromCaData(&pwz, &pwzUser); | 638 | hr = WcaReadStringFromCaData(&pwz, &pwzUser); |
628 | ExitOnFailure(hr, "failed to process CustomActionData"); | 639 | ExitOnFailure(hr, "failed to process CustomActionData"); |
640 | hr = WcaReadIntegerFromCaData(&pwz, reinterpret_cast<int*>(&dwAttributes)); | ||
641 | ExitOnFailure(hr, "failed to process CustomActionData"); | ||
629 | hr = WcaReadIntegerFromCaData(&pwz, reinterpret_cast<int*>(&dwPermissions)); | 642 | hr = WcaReadIntegerFromCaData(&pwz, reinterpret_cast<int*>(&dwPermissions)); |
630 | ExitOnFailure(hr, "failed to processCustomActionData"); | 643 | ExitOnFailure(hr, "failed to process CustomActionData"); |
631 | 644 | ||
632 | WcaLog(LOGMSG_VERBOSE, "Securing Object: %ls Type: %ls User: %ls", pwzObject, pwzTable, pwzUser); | 645 | WcaLog(LOGMSG_VERBOSE, "Securing Object: %ls Type: %ls User: %ls", pwzObject, pwzTable, pwzUser); |
633 | 646 | ||
@@ -690,7 +703,7 @@ extern "C" UINT __stdcall ExecSecureObjects( | |||
690 | // | 703 | // |
691 | ea.grfAccessMode = SET_ACCESS; | 704 | ea.grfAccessMode = SET_ACCESS; |
692 | 705 | ||
693 | if (0 == lstrcmpW(L"CreateFolder", pwzTable)) | 706 | if (dwAttributes & SECURE_OBJECT_ATTRIBUTE_INHERITABLE) |
694 | { | 707 | { |
695 | ea.grfInheritance = SUB_CONTAINERS_AND_OBJECTS_INHERIT; | 708 | ea.grfInheritance = SUB_CONTAINERS_AND_OBJECTS_INHERIT; |
696 | } | 709 | } |