diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2020-07-31 17:06:35 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2020-08-09 10:33:49 -0600 |
commit | d21eed76c48960707561c45c492c10a6a23c052e (patch) | |
tree | ebab09d099a699a24801fcfb4d7152cf82cc4a06 /src/engine/search.cpp | |
parent | ad80d6dc10f9bd6cb6a084857a8fb546cc55e756 (diff) | |
download | wix-d21eed76c48960707561c45c492c10a6a23c052e.tar.gz wix-d21eed76c48960707561c45c492c10a6a23c052e.tar.bz2 wix-d21eed76c48960707561c45c492c10a6a23c052e.zip |
WIXFEAT:4763 Change "string" variable type to literal and add "formatted".
Diffstat (limited to 'src/engine/search.cpp')
-rw-r--r-- | src/engine/search.cpp | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/engine/search.cpp b/src/engine/search.cpp index 16f8e459..2978edd3 100644 --- a/src/engine/search.cpp +++ b/src/engine/search.cpp | |||
@@ -239,7 +239,11 @@ extern "C" HRESULT SearchesParseFromXml( | |||
239 | hr = XmlGetAttributeEx(pixnNode, L"VariableType", &scz); | 239 | hr = XmlGetAttributeEx(pixnNode, L"VariableType", &scz); |
240 | ExitOnFailure(hr, "Failed to get @VariableType."); | 240 | ExitOnFailure(hr, "Failed to get @VariableType."); |
241 | 241 | ||
242 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, scz, -1, L"numeric", -1)) | 242 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, scz, -1, L"formatted", -1)) |
243 | { | ||
244 | pSearch->RegistrySearch.VariableType = BURN_VARIANT_TYPE_FORMATTED; | ||
245 | } | ||
246 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, scz, -1, L"numeric", -1)) | ||
243 | { | 247 | { |
244 | pSearch->RegistrySearch.VariableType = BURN_VARIANT_TYPE_NUMERIC; | 248 | pSearch->RegistrySearch.VariableType = BURN_VARIANT_TYPE_NUMERIC; |
245 | } | 249 | } |
@@ -403,14 +407,18 @@ extern "C" HRESULT SearchesParseFromXml( | |||
403 | { | 407 | { |
404 | ExitOnFailure(hr, "Failed to get @Value."); | 408 | ExitOnFailure(hr, "Failed to get @Value."); |
405 | 409 | ||
406 | hr = BVariantSetString(&pSearch->SetVariable.value, scz, 0); | 410 | hr = BVariantSetString(&pSearch->SetVariable.value, scz, 0, FALSE); |
407 | ExitOnFailure(hr, "Failed to set variant value."); | 411 | ExitOnFailure(hr, "Failed to set variant value."); |
408 | 412 | ||
409 | // @Type | 413 | // @Type |
410 | hr = XmlGetAttributeEx(pixnNode, L"Type", &scz); | 414 | hr = XmlGetAttributeEx(pixnNode, L"Type", &scz); |
411 | ExitOnFailure(hr, "Failed to get @Type."); | 415 | ExitOnFailure(hr, "Failed to get @Type."); |
412 | 416 | ||
413 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, scz, -1, L"numeric", -1)) | 417 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, scz, -1, L"formatted", -1)) |
418 | { | ||
419 | valueType = BURN_VARIANT_TYPE_FORMATTED; | ||
420 | } | ||
421 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, scz, -1, L"numeric", -1)) | ||
414 | { | 422 | { |
415 | valueType = BURN_VARIANT_TYPE_NUMERIC; | 423 | valueType = BURN_VARIANT_TYPE_NUMERIC; |
416 | } | 424 | } |
@@ -673,7 +681,7 @@ static HRESULT DirectorySearchPath( | |||
673 | } | 681 | } |
674 | else if (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) | 682 | else if (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) |
675 | { | 683 | { |
676 | hr = VariableSetLiteralString(pVariables, pSearch->sczVariable, sczPath, FALSE); | 684 | hr = VariableSetString(pVariables, pSearch->sczVariable, sczPath, FALSE, FALSE); |
677 | ExitOnFailure(hr, "Failed to set directory search path variable."); | 685 | ExitOnFailure(hr, "Failed to set directory search path variable."); |
678 | } | 686 | } |
679 | else // must have found a file. | 687 | else // must have found a file. |
@@ -793,7 +801,7 @@ static HRESULT FileSearchPath( | |||
793 | } | 801 | } |
794 | else // found our file. | 802 | else // found our file. |
795 | { | 803 | { |
796 | hr = VariableSetLiteralString(pVariables, pSearch->sczVariable, sczPath, FALSE); | 804 | hr = VariableSetString(pVariables, pSearch->sczVariable, sczPath, FALSE, FALSE); |
797 | ExitOnFailure(hr, "Failed to set variable to file search path."); | 805 | ExitOnFailure(hr, "Failed to set variable to file search path."); |
798 | } | 806 | } |
799 | 807 | ||
@@ -933,7 +941,7 @@ static HRESULT RegistrySearchValue( | |||
933 | { | 941 | { |
934 | // What if there is a hidden variable in sczKey? | 942 | // What if there is a hidden variable in sczKey? |
935 | LogStringLine(REPORT_STANDARD, "Registry key not found. Key = '%ls'", sczKey); | 943 | LogStringLine(REPORT_STANDARD, "Registry key not found. Key = '%ls'", sczKey); |
936 | hr = VariableSetLiteralVariant(pVariables, pSearch->sczVariable, &value); | 944 | hr = VariableSetVariant(pVariables, pSearch->sczVariable, &value); |
937 | ExitOnFailure(hr, "Failed to clear variable."); | 945 | ExitOnFailure(hr, "Failed to clear variable."); |
938 | ExitFunction1(hr = S_OK); | 946 | ExitFunction1(hr = S_OK); |
939 | } | 947 | } |
@@ -945,7 +953,7 @@ static HRESULT RegistrySearchValue( | |||
945 | { | 953 | { |
946 | // What if there is a hidden variable in sczKey or sczValue? | 954 | // What if there is a hidden variable in sczKey or sczValue? |
947 | LogStringLine(REPORT_STANDARD, "Registry value not found. Key = '%ls', Value = '%ls'", sczKey, sczValue); | 955 | LogStringLine(REPORT_STANDARD, "Registry value not found. Key = '%ls', Value = '%ls'", sczKey, sczValue); |
948 | hr = VariableSetLiteralVariant(pVariables, pSearch->sczVariable, &value); | 956 | hr = VariableSetVariant(pVariables, pSearch->sczVariable, &value); |
949 | ExitOnFailure(hr, "Failed to clear variable."); | 957 | ExitOnFailure(hr, "Failed to clear variable."); |
950 | ExitFunction1(hr = S_OK); | 958 | ExitFunction1(hr = S_OK); |
951 | } | 959 | } |
@@ -995,7 +1003,7 @@ static HRESULT RegistrySearchValue( | |||
995 | } | 1003 | } |
996 | __fallthrough; | 1004 | __fallthrough; |
997 | case REG_SZ: | 1005 | case REG_SZ: |
998 | hr = BVariantSetString(&value, (LPCWSTR)pData, 0); | 1006 | hr = BVariantSetString(&value, (LPCWSTR)pData, 0, FALSE); |
999 | break; | 1007 | break; |
1000 | default: | 1008 | default: |
1001 | ExitOnFailure(hr = E_NOTIMPL, "Unsupported registry key value type. Type = '%u'", dwType); | 1009 | ExitOnFailure(hr = E_NOTIMPL, "Unsupported registry key value type. Type = '%u'", dwType); |
@@ -1006,8 +1014,8 @@ static HRESULT RegistrySearchValue( | |||
1006 | hr = BVariantChangeType(&value, pSearch->RegistrySearch.VariableType); | 1014 | hr = BVariantChangeType(&value, pSearch->RegistrySearch.VariableType); |
1007 | ExitOnFailure(hr, "Failed to change value type."); | 1015 | ExitOnFailure(hr, "Failed to change value type."); |
1008 | 1016 | ||
1009 | // Set variable as a literal. | 1017 | // Set variable. |
1010 | hr = VariableSetLiteralVariant(pVariables, pSearch->sczVariable, &value); | 1018 | hr = VariableSetVariant(pVariables, pSearch->sczVariable, &value); |
1011 | ExitOnFailure(hr, "Failed to set variable."); | 1019 | ExitOnFailure(hr, "Failed to set variable."); |
1012 | 1020 | ||
1013 | LExit: | 1021 | LExit: |
@@ -1077,7 +1085,7 @@ static HRESULT MsiComponentSearch( | |||
1077 | case BURN_MSI_COMPONENT_SEARCH_TYPE_KEYPATH: | 1085 | case BURN_MSI_COMPONENT_SEARCH_TYPE_KEYPATH: |
1078 | if (INSTALLSTATE_ABSENT == is || INSTALLSTATE_LOCAL == is || INSTALLSTATE_SOURCE == is) | 1086 | if (INSTALLSTATE_ABSENT == is || INSTALLSTATE_LOCAL == is || INSTALLSTATE_SOURCE == is) |
1079 | { | 1087 | { |
1080 | hr = VariableSetLiteralString(pVariables, pSearch->sczVariable, sczPath, FALSE); | 1088 | hr = VariableSetString(pVariables, pSearch->sczVariable, sczPath, FALSE, FALSE); |
1081 | } | 1089 | } |
1082 | break; | 1090 | break; |
1083 | case BURN_MSI_COMPONENT_SEARCH_TYPE_STATE: | 1091 | case BURN_MSI_COMPONENT_SEARCH_TYPE_STATE: |
@@ -1093,7 +1101,7 @@ static HRESULT MsiComponentSearch( | |||
1093 | wz[1] = L'\0'; | 1101 | wz[1] = L'\0'; |
1094 | } | 1102 | } |
1095 | 1103 | ||
1096 | hr = VariableSetLiteralString(pVariables, pSearch->sczVariable, sczPath, FALSE); | 1104 | hr = VariableSetString(pVariables, pSearch->sczVariable, sczPath, FALSE, FALSE); |
1097 | } | 1105 | } |
1098 | break; | 1106 | break; |
1099 | } | 1107 | } |
@@ -1234,8 +1242,8 @@ static HRESULT MsiProductSearch( | |||
1234 | hr = BVariantChangeType(&value, type); | 1242 | hr = BVariantChangeType(&value, type); |
1235 | ExitOnFailure(hr, "Failed to change value type."); | 1243 | ExitOnFailure(hr, "Failed to change value type."); |
1236 | 1244 | ||
1237 | // Set variable as a literal. | 1245 | // Set variable. |
1238 | hr = VariableSetLiteralVariant(pVariables, pSearch->sczVariable, &value); | 1246 | hr = VariableSetVariant(pVariables, pSearch->sczVariable, &value); |
1239 | ExitOnFailure(hr, "Failed to set variable."); | 1247 | ExitOnFailure(hr, "Failed to set variable."); |
1240 | 1248 | ||
1241 | LExit: | 1249 | LExit: |