ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
March 2022
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
20 participants
436 discussions
Start a n
N
ew thread
[reactos] 311/360: [WINESYNC] msi: Use the global is_wow64 variable in custom_start_server().
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9fb472fc2646c4eb2e6b1…
commit 9fb472fc2646c4eb2e6b1fddc7deeb0c6a4130a4 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 21:40:10 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:35 2022 +0100 [WINESYNC] msi: Use the global is_wow64 variable in custom_start_server(). Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 12ae1f8528b18d0df018680747429be29fca7ea4 by Zebediah Figura <z.figura12(a)gmail.com> --- dll/win32/msi/custom.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c index 9e9a13afa54..47d04a87ea0 100644 --- a/dll/win32/msi/custom.c +++ b/dll/win32/msi/custom.c @@ -603,7 +603,6 @@ static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch) WCHAR buffer[24]; void *cookie; HANDLE pipe; - BOOL wow64; if ((arch == SCS_32BIT_BINARY && package->custom_server_32_process) || (arch == SCS_64BIT_BINARY && package->custom_server_64_process)) @@ -616,17 +615,14 @@ static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch) if (pipe == INVALID_HANDLE_VALUE) ERR("Failed to create custom action client pipe: %u\n", GetLastError()); - if (!IsWow64Process(GetCurrentProcess(), &wow64)) - wow64 = FALSE; - - if ((sizeof(void *) == 8 || wow64) && arch == SCS_32BIT_BINARY) + if ((sizeof(void *) == 8 || is_wow64) && arch == SCS_32BIT_BINARY) GetSystemWow64DirectoryW(path, MAX_PATH - ARRAY_SIZE(L"\\msiexec.exe")); else GetSystemDirectoryW(path, MAX_PATH - ARRAY_SIZE(L"\\msiexec.exe")); lstrcatW(path, L"\\msiexec.exe"); swprintf(cmdline, ARRAY_SIZE(cmdline), L"%s -Embedding %d", path, GetCurrentProcessId()); - if (wow64 && arch == SCS_64BIT_BINARY) + if (is_wow64 && arch == SCS_64BIT_BINARY) { Wow64DisableWow64FsRedirection(&cookie); CreateProcessW(path, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
2 years, 9 months
1
0
0
0
[reactos] 310/360: [WINESYNC] msi/tests: Use wide character string literals.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f31e4044c22cd97319af1…
commit f31e4044c22cd97319af16268619fa74de36cc5f Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 21:40:07 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:35 2022 +0100 [WINESYNC] msi/tests: Use wide character string literals. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 058ca3d04a4a712d86a111a1975045be02e03133 by Hans Leidekker <hans(a)codeweavers.com> --- modules/rostests/winetests/msi/automation.c | 273 +++++++++++----------------- modules/rostests/winetests/msi/custom.c | 81 ++++----- modules/rostests/winetests/msi/db.c | 75 +++----- modules/rostests/winetests/msi/install.c | 27 +-- modules/rostests/winetests/msi/msi.c | 30 ++- modules/rostests/winetests/msi/package.c | 124 ++++++------- modules/rostests/winetests/msi/patch.c | 15 +- modules/rostests/winetests/msi/record.c | 7 +- modules/rostests/winetests/msi/suminfo.c | 3 +- 9 files changed, 250 insertions(+), 385 deletions(-) diff --git a/modules/rostests/winetests/msi/automation.c b/modules/rostests/winetests/msi/automation.c index d7fed415cda..093b78568ae 100644 --- a/modules/rostests/winetests/msi/automation.c +++ b/modules/rostests/winetests/msi/automation.c @@ -45,14 +45,6 @@ static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); static const char *msifile = "winetest-automation.msi"; -static const WCHAR szMsifile[] = {'w','i','n','e','t','e','s','t','-','a','u','t','o','m','a','t','i','o','n','.','m','s','i',0}; -static const WCHAR szMSITEST[] = { 'M','S','I','T','E','S','T',0 }; -static const WCHAR szProductCode[] = { '{','8','3','7','4','5','0','f','a','-','a','3','9','b','-','4','b','c','8','-','b','3','2','1','-','0','8','b','3','9','3','f','7','8','4','b','3','}',0 }; -static const WCHAR szUpgradeCode[] = { '{','C','E','0','6','7','E','8','D','-','2','E','1','A','-','4','3','6','7','-','B','7','3','4','-','4','E','B','2','B','D','A','D','6','5','6','5','}',0 }; -static const WCHAR szProductInfoException[] = { 'P','r','o','d','u','c','t','I','n','f','o',',','P','r','o','d','u','c','t',',','A','t','t','r','i','b','u','t','e',0 }; -static const WCHAR WINE_INSTALLPROPERTY_PACKAGENAMEW[] = {'P','a','c','k','a','g','e','N','a','m','e',0}; -static const WCHAR WINE_INSTALLPROPERTY_PRODUCTNAMEW[] = {'P','r','o','d','u','c','t','N','a','m','e',0}; -static const WCHAR WINE_INSTALLPROPERTY_LOCALPACKAGEW[] = {'L','o','c','a','l','P','a','c','k','a','g','e',0}; static FILETIME systemtime; static CHAR CURR_DIR[MAX_PATH]; static EXCEPINFO excepinfo; @@ -60,7 +52,6 @@ static EXCEPINFO excepinfo; /* * OLE automation data **/ -static const WCHAR szProgId[] = { 'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r','.','I','n','s','t','a','l','l','e','r',0 }; static IDispatch *pInstaller; /* msi database data */ @@ -349,7 +340,6 @@ static void create_database(const CHAR *name, const msi_table *tables, int num_t static BOOL create_package(LPWSTR path) { - static const WCHAR slashW[] = {'\\',0}; DWORD len; /* Prepare package */ @@ -361,8 +351,7 @@ static BOOL create_package(LPWSTR path) if (!len) return FALSE; - lstrcatW(path, slashW); - lstrcatW(path, szMsifile); + lstrcatW(path, L"\\winetest-automation.msi"); return TRUE; } @@ -490,8 +479,6 @@ static CHAR string1[MAX_PATH], string2[MAX_PATH]; ok(0, format, extra, string1, aString); \ /* exception checker */ -static const WCHAR szSource[] = {'M','s','i',' ','A','P','I',' ','E','r','r','o','r',0}; - #define ok_exception(hr, szDescription) \ if (hr == DISP_E_EXCEPTION) \ { \ @@ -500,7 +487,7 @@ static const WCHAR szSource[] = {'M','s','i',' ','A','P','I',' ','E','r','r','o' \ ok(excepinfo.bstrSource != NULL, "Exception source was NULL\n"); \ if (excepinfo.bstrSource) \ - ok_w2("Exception source was \"%s\" but expected to be \"%s\"\n", excepinfo.bstrSource, szSource); \ + ok_w2("Exception source was \"%s\" but expected to be \"%s\"\n", excepinfo.bstrSource, L"Msi API Error"); \ \ ok(excepinfo.bstrDescription != NULL, "Exception description was NULL\n"); \ if (excepinfo.bstrDescription) \ @@ -629,9 +616,6 @@ static void test_dispid(void) /* Test basic IDispatch functions */ static void test_dispatch(void) { - static WCHAR szOpenPackage[] = { 'O','p','e','n','P','a','c','k','a','g','e',0 }; - static const WCHAR szOpenPackageException[] = {'O','p','e','n','P','a','c','k','a','g','e',',','P','a','c','k','a','g','e','P','a','t','h',',','O','p','t','i','o','n','s',0}; - static WCHAR szProductState[] = { 'P','r','o','d','u','c','t','S','t','a','t','e',0 }; HRESULT hr; DISPID dispid; OLECHAR *name; @@ -641,7 +625,7 @@ static void test_dispatch(void) DISPPARAMS dispparams = {NULL, NULL, 0, 0}; /* Test getting ID of a function name that does not exist */ - name = (WCHAR *)szMsifile; + name = (WCHAR *)L"winetest-automation.msi"; hr = IDispatch_GetIDsOfNames(pInstaller, &IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &dispid); ok(hr == DISP_E_UNKNOWNNAME, "IDispatch::GetIDsOfNames returned 0x%08x\n", hr); @@ -650,7 +634,7 @@ static void test_dispatch(void) ok(hr == DISP_E_MEMBERNOTFOUND, "IDispatch::Invoke returned 0x%08x\n", hr); /* Test getting ID of a function name that does exist */ - name = szOpenPackage; + name = (WCHAR *)L"OpenPackage"; hr = IDispatch_GetIDsOfNames(pInstaller, &IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &dispid); ok(hr == S_OK, "IDispatch::GetIDsOfNames returned 0x%08x\n", hr); @@ -687,10 +671,10 @@ static void test_dispatch(void) dispparams.cArgs = 1; VariantInit(&vararg[0]); V_VT(&vararg[0]) = VT_BSTR; - V_BSTR(&vararg[0]) = SysAllocString(szMsifile); + V_BSTR(&vararg[0]) = SysAllocString(L"winetest-automation.msi"); hr = IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL); ok(hr == DISP_E_EXCEPTION, "IDispatch::Invoke returned 0x%08x\n", hr); - ok_exception(hr, szOpenPackageException); + ok_exception(hr, L"OpenPackage,PackagePath,Options"); VariantClear(&vararg[0]); /* Provide the required BSTR and an empty second parameter. @@ -699,11 +683,11 @@ static void test_dispatch(void) dispparams.cArgs = 2; VariantInit(&vararg[1]); V_VT(&vararg[1]) = VT_BSTR; - V_BSTR(&vararg[1]) = SysAllocString(szMsifile); + V_BSTR(&vararg[1]) = SysAllocString(L"winetest-automation.msi"); VariantInit(&vararg[0]); hr = IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL); ok(hr == DISP_E_EXCEPTION, "IDispatch::Invoke returned 0x%08x\n", hr); - ok_exception(hr, szOpenPackageException); + ok_exception(hr, L"OpenPackage,PackagePath,Options"); VariantClear(&vararg[1]); /* Provide the required BSTR and two empty parameters. @@ -712,22 +696,22 @@ static void test_dispatch(void) dispparams.cArgs = 3; VariantInit(&vararg[2]); V_VT(&vararg[2]) = VT_BSTR; - V_BSTR(&vararg[2]) = SysAllocString(szMsifile); + V_BSTR(&vararg[2]) = SysAllocString(L"winetest-automation.msi"); VariantInit(&vararg[1]); VariantInit(&vararg[0]); hr = IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL); ok(hr == DISP_E_EXCEPTION, "IDispatch::Invoke returned 0x%08x\n", hr); - ok_exception(hr, szOpenPackageException); + ok_exception(hr, L"OpenPackage,PackagePath,Options"); VariantClear(&vararg[2]); /* Provide the required BSTR and a second parameter with the wrong type. */ dispparams.cArgs = 2; VariantInit(&vararg[1]); V_VT(&vararg[1]) = VT_BSTR; - V_BSTR(&vararg[1]) = SysAllocString(szMsifile); + V_BSTR(&vararg[1]) = SysAllocString(L"winetest-automation.msi"); VariantInit(&vararg[0]); V_VT(&vararg[0]) = VT_BSTR; - V_BSTR(&vararg[0]) = SysAllocString(szMsifile); + V_BSTR(&vararg[0]) = SysAllocString(L"winetest-automation.msi"); hr = IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL); ok(hr == DISP_E_TYPEMISMATCH, "IDispatch::Invoke returned 0x%08x\n", hr); VariantClear(&vararg[0]); @@ -742,10 +726,10 @@ static void test_dispatch(void) dispparams.cArgs = 1; VariantInit(&vararg[0]); V_VT(&vararg[0]) = VT_BSTR; - V_BSTR(&vararg[0]) = SysAllocString(szMsifile); + V_BSTR(&vararg[0]) = SysAllocString(L"winetest-automation.msi"); hr = IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL); todo_wine ok(hr == DISP_E_EXCEPTION, "IDispatch::Invoke returned 0x%08x\n", hr); - ok_exception(hr, szOpenPackageException); + ok_exception(hr, L"OpenPackage,PackagePath,Options"); VariantClear(&vararg[0]); if (hr != DISP_E_EXCEPTION) VariantClear(&varresult); @@ -835,7 +819,7 @@ static void test_dispatch(void) ok(hr == DISP_E_MEMBERNOTFOUND, "IDispatch::Invoke returned 0x%08x\n", hr); /* Test invoking a read-only property as DISPATCH_PROPERTYPUT or as a DISPATCH_METHOD */ - name = szProductState; + name = (WCHAR *)L"ProductState"; hr = IDispatch_GetIDsOfNames(pInstaller, &IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &dispid); ok(hr == S_OK, "IDispatch::GetIDsOfNames returned 0x%08x\n", hr); @@ -1597,8 +1581,6 @@ static HRESULT SummaryInfo_PropertyCountGet(IDispatch *pSummaryInfo, int *pCount static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *info, int num_info, BOOL readonly) { - static const WCHAR szPropertyException[] = { 'P','r','o','p','e','r','t','y',',','P','i','d',0 }; - static const WCHAR szTitle[] = { 'T','i','t','l','e',0 }; VARIANT varresult, var; SYSTEMTIME st; HRESULT hr; @@ -1651,11 +1633,11 @@ static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *in /* Invalid pids */ hr = SummaryInfo_PropertyGet(pSummaryInfo, -1, &varresult, VT_EMPTY); ok(hr == DISP_E_EXCEPTION, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr); - ok_exception(hr, szPropertyException); + ok_exception(hr, L"Property,Pid"); hr = SummaryInfo_PropertyGet(pSummaryInfo, 1000, &varresult, VT_EMPTY); ok(hr == DISP_E_EXCEPTION, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr); - ok_exception(hr, szPropertyException); + ok_exception(hr, L"Property,Pid"); /* Unsupported pids */ hr = SummaryInfo_PropertyGet(pSummaryInfo, PID_DICTIONARY, &varresult, VT_EMPTY); @@ -1696,7 +1678,7 @@ static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *in /* VT_BSTR */ V_VT(&var) = VT_BSTR; - V_BSTR(&var) = SysAllocString(szTitle); + V_BSTR(&var) = SysAllocString(L"Title"); hr = SummaryInfo_PropertyPut(pSummaryInfo, PID_TITLE, &var); ok(hr == S_OK, "SummaryInfo_PropertyPut failed, hresult 0x%08x\n", hr); @@ -1740,15 +1722,10 @@ static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *in static void test_Database(IDispatch *pDatabase, BOOL readonly) { - static const WCHAR szSql[] = { 'S','E','L','E','C','T',' ','`','F','e','a','t','u','r','e','`',' ','F','R','O','M',' ','`','F','e','a','t','u','r','e','`',' ','W','H','E','R','E',' ','`','F','e','a','t','u','r','e','_','P','a','r','e','n','t','`','=','\'','O','n','e','\'',0 }; - static const WCHAR szThree[] = { 'T','h','r','e','e',0 }; - static const WCHAR szTwo[] = { 'T','w','o',0 }; - static const WCHAR szStringDataField[] = { 'S','t','r','i','n','g','D','a','t','a',',','F','i','e','l','d',0 }; - static const WCHAR szModifyModeRecord[] = { 'M','o','d','i','f','y',',','M','o','d','e',',','R','e','c','o','r','d',0 }; IDispatch *pView = NULL, *pSummaryInfo = NULL; HRESULT hr; - hr = Database_OpenView(pDatabase, szSql, &pView); + hr = Database_OpenView(pDatabase, L"SELECT `Feature` FROM `Feature` WHERE `Feature_Parent`='One'", &pView); ok(hr == S_OK, "Database_OpenView failed, hresult 0x%08x\n", hr); if (hr == S_OK) { @@ -1769,35 +1746,35 @@ static void test_Database(IDispatch *pDatabase, BOOL readonly) memset(szString, 0, sizeof(szString)); hr = Record_StringDataGet(pRecord, 1, szString); ok(hr == S_OK, "Record_StringDataGet failed, hresult 0x%08x\n", hr); - ok_w2("Record_StringDataGet result was %s but expected %s\n", szString, szThree); + ok_w2("Record_StringDataGet result was %s but expected %s\n", szString, L"Three"); /* Record::StringDataPut with correct index */ - hr = Record_StringDataPut(pRecord, 1, szTwo); + hr = Record_StringDataPut(pRecord, 1, L"Two"); ok(hr == S_OK, "Record_StringDataPut failed, hresult 0x%08x\n", hr); /* Record::StringDataGet */ memset(szString, 0, sizeof(szString)); hr = Record_StringDataGet(pRecord, 1, szString); ok(hr == S_OK, "Record_StringDataGet failed, hresult 0x%08x\n", hr); - ok_w2("Record_StringDataGet result was %s but expected %s\n", szString, szTwo); + ok_w2("Record_StringDataGet result was %s but expected %s\n", szString, L"Two"); /* Record::StringDataPut with incorrect index */ hr = Record_StringDataPut(pRecord, -1, szString); ok(hr == DISP_E_EXCEPTION, "Record_StringDataPut failed, hresult 0x%08x\n", hr); - ok_exception(hr, szStringDataField); + ok_exception(hr, L"StringData,Field"); /* View::Modify with incorrect parameters */ hr = View_Modify(pView, -5, NULL); ok(hr == DISP_E_EXCEPTION, "View_Modify failed, hresult 0x%08x\n", hr); - ok_exception(hr, szModifyModeRecord); + ok_exception(hr, L"Modify,Mode,Record"); hr = View_Modify(pView, -5, pRecord); ok(hr == DISP_E_EXCEPTION, "View_Modify failed, hresult 0x%08x\n", hr); - ok_exception(hr, szModifyModeRecord); + ok_exception(hr, L"Modify,Mode,Record"); hr = View_Modify(pView, MSIMODIFY_REFRESH, NULL); ok(hr == DISP_E_EXCEPTION, "View_Modify failed, hresult 0x%08x\n", hr); - ok_exception(hr, szModifyModeRecord); + ok_exception(hr, L"Modify,Mode,Record"); hr = View_Modify(pView, MSIMODIFY_REFRESH, pRecord); ok(hr == S_OK, "View_Modify failed, hresult 0x%08x\n", hr); @@ -1806,7 +1783,7 @@ static void test_Database(IDispatch *pDatabase, BOOL readonly) memset(szString, 0, sizeof(szString)); hr = Record_StringDataGet(pRecord, 1, szString); ok(hr == S_OK, "Record_StringDataGet failed, hresult 0x%08x\n", hr); - todo_wine ok_w2("Record_StringDataGet result was %s but expected %s\n", szString, szThree); + todo_wine ok_w2("Record_StringDataGet result was %s but expected %s\n", szString, L"Three"); IDispatch_Release(pRecord); } @@ -1821,7 +1798,7 @@ static void test_Database(IDispatch *pDatabase, BOOL readonly) memset(szString, 0, sizeof(szString)); hr = Record_StringDataGet(pRecord, 1, szString); ok(hr == S_OK, "Record_StringDataGet failed, hresult 0x%08x\n", hr); - ok_w2("Record_StringDataGet result was %s but expected %s\n", szString, szTwo); + ok_w2("Record_StringDataGet result was %s but expected %s\n", szString, L"Two"); IDispatch_Release(pRecord); } @@ -1853,17 +1830,6 @@ static void test_Database(IDispatch *pDatabase, BOOL readonly) static void test_Session(IDispatch *pSession) { - static const WCHAR szProductName[] = { 'P','r','o','d','u','c','t','N','a','m','e',0 }; - static const WCHAR szOne[] = { 'O','n','e',0 }; - static const WCHAR szOneStateFalse[] = { '!','O','n','e','>','0',0 }; - static const WCHAR szOneStateTrue[] = { '!','O','n','e','=','-','1',0 }; - static const WCHAR szOneActionFalse[] = { '$','O','n','e','=','-','1',0 }; - static const WCHAR szOneActionTrue[] = { '$','O','n','e','>','0',0 }; - static const WCHAR szCostInitialize[] = { 'C','o','s','t','I','n','i','t','i','a','l','i','z','e',0 }; - static const WCHAR szEmpty[] = { 0 }; - static const WCHAR szEquals[] = { '=',0 }; - static const WCHAR szPropertyName[] = { 'P','r','o','p','e','r','t','y',',','N','a','m','e',0 }; - static const WCHAR szModeFlag[] = { 'M','o','d','e',',','F','l','a','g',0 }; WCHAR stringw[MAX_PATH]; CHAR string[MAX_PATH]; UINT len; @@ -1889,9 +1855,9 @@ static void test_Session(IDispatch *pSession) /* Session::Property, get */ memset(stringw, 0, sizeof(stringw)); - hr = Session_PropertyGet(pSession, szProductName, stringw); + hr = Session_PropertyGet(pSession, L"ProductName", stringw); ok(hr == S_OK, "Session_PropertyGet failed, hresult 0x%08x\n", hr); - if (lstrcmpW(stringw, szMSITEST) != 0) + if (lstrcmpW(stringw, L"MSITEST") != 0) { len = WideCharToMultiByte(CP_ACP, 0, stringw, -1, string, MAX_PATH, NULL, NULL); ok(len, "WideCharToMultiByteChar returned error %d\n", GetLastError()); @@ -1899,12 +1865,12 @@ static void test_Session(IDispatch *pSession) } /* Session::Property, put */ - hr = Session_PropertyPut(pSession, szProductName, szProductName); + hr = Session_PropertyPut(pSession, L"ProductName", L"ProductName"); ok(hr == S_OK, "Session_PropertyPut failed, hresult 0x%08x\n", hr); memset(stringw, 0, sizeof(stringw)); - hr = Session_PropertyGet(pSession, szProductName, stringw); + hr = Session_PropertyGet(pSession, L"ProductName", stringw); ok(hr == S_OK, "Session_PropertyGet failed, hresult 0x%08x\n", hr); - if (lstrcmpW(stringw, szProductName) != 0) + if (lstrcmpW(stringw, L"ProductName") != 0) { len = WideCharToMultiByte(CP_ACP, 0, stringw, -1, string, MAX_PATH, NULL, NULL); ok(len, "WideCharToMultiByteChar returned error %d\n", GetLastError()); @@ -1912,12 +1878,12 @@ static void test_Session(IDispatch *pSession) } /* Try putting a property using empty property identifier */ - hr = Session_PropertyPut(pSession, szEmpty, szProductName); + hr = Session_PropertyPut(pSession, L"", L"ProductName"); ok(hr == DISP_E_EXCEPTION, "Session_PropertyPut failed, hresult 0x%08x\n", hr); - ok_exception(hr, szPropertyName); + ok_exception(hr, L"Property,Name"); /* Try putting a property using illegal property identifier */ - hr = Session_PropertyPut(pSession, szEquals, szProductName); + hr = Session_PropertyPut(pSession, L"=", L"ProductName"); ok(hr == S_OK, "Session_PropertyPut failed, hresult 0x%08x\n", hr); /* Session::Language, get */ @@ -1945,7 +1911,7 @@ static void test_Session(IDispatch *pSession) hr = Session_ModePut(pSession, MSIRUNMODE_REBOOTNOW, VARIANT_TRUE); ok(hr == S_OK, "Session_ModePut failed, hresult 0x%08x\n", hr); - ok_exception(hr, szModeFlag); + ok_exception(hr, L"Mode,Flag"); hr = Session_ModeGet(pSession, MSIRUNMODE_REBOOTNOW, &bool); ok(hr == S_OK, "Session_ModeGet failed, hresult 0x%08x\n", hr); @@ -1953,11 +1919,11 @@ static void test_Session(IDispatch *pSession) hr = Session_ModePut(pSession, MSIRUNMODE_REBOOTNOW, VARIANT_FALSE); /* set it again so we don't reboot */ ok(hr == S_OK, "Session_ModePut failed, hresult 0x%08x\n", hr); - ok_exception(hr, szModeFlag); + ok_exception(hr, L"Mode,Flag"); hr = Session_ModePut(pSession, MSIRUNMODE_MAINTENANCE, VARIANT_TRUE); ok(hr == DISP_E_EXCEPTION, "Session_ModePut failed, hresult 0x%08x\n", hr); - ok_exception(hr, szModeFlag); + ok_exception(hr, L"Mode,Flag"); /* Session::Database, get */ hr = Session_Database(pSession, &pDatabase); @@ -1973,16 +1939,16 @@ static void test_Session(IDispatch *pSession) ok(hr == S_OK, "Session_EvaluateCondition failed, hresult 0x%08x\n", hr); ok(myint == MSICONDITION_NONE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN); - hr = Session_EvaluateCondition(pSession, szEmpty, &myint); + hr = Session_EvaluateCondition(pSession, L"", &myint); ok(hr == S_OK, "Session_EvaluateCondition failed, hresult 0x%08x\n", hr); ok(myint == MSICONDITION_NONE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN); - hr = Session_EvaluateCondition(pSession, szEquals, &myint); + hr = Session_EvaluateCondition(pSession, L"=", &myint); ok(hr == S_OK, "Session_EvaluateCondition failed, hresult 0x%08x\n", hr); ok(myint == MSICONDITION_ERROR, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN); /* Session::DoAction(CostInitialize) must occur before the next statements */ - hr = Session_DoAction(pSession, szCostInitialize, &myint); + hr = Session_DoAction(pSession, L"CostInitialize", &myint); ok(hr == S_OK, "Session_DoAction failed, hresult 0x%08x\n", hr); ok(myint == IDOK, "DoAction(CostInitialize) returned %d, %d expected\n", myint, IDOK); @@ -1991,7 +1957,7 @@ static void test_Session(IDispatch *pSession) ok(hr == S_OK, "Session_SetInstallLevel failed, hresult 0x%08x\n", hr); /* Session::FeatureCurrentState, get */ - hr = Session_FeatureCurrentState(pSession, szOne, &myint); + hr = Session_FeatureCurrentState(pSession, L"One", &myint); ok(hr == S_OK, "Session_FeatureCurrentState failed, hresult 0x%08x\n", hr); ok(myint == INSTALLSTATE_UNKNOWN, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN); @@ -2003,27 +1969,27 @@ static void test_Session(IDispatch *pSession) ok(myint == 0, "Session_Message returned %x\n", myint); /* Session::EvaluateCondition */ - hr = Session_EvaluateCondition(pSession, szOneStateFalse, &myint); + hr = Session_EvaluateCondition(pSession, L"!One>0", &myint); ok(hr == S_OK, "Session_EvaluateCondition failed, hresult 0x%08x\n", hr); ok(myint == MSICONDITION_FALSE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN); - hr = Session_EvaluateCondition(pSession, szOneStateTrue, &myint); + hr = Session_EvaluateCondition(pSession, L"!One=-1", &myint); ok(hr == S_OK, "Session_EvaluateCondition failed, hresult 0x%08x\n", hr); ok(myint == MSICONDITION_TRUE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN); /* Session::FeatureRequestState, put */ - hr = Session_FeatureRequestStatePut(pSession, szOne, INSTALLSTATE_ADVERTISED); + hr = Session_FeatureRequestStatePut(pSession, L"One", INSTALLSTATE_ADVERTISED); ok(hr == S_OK, "Session_FeatureRequestStatePut failed, hresult 0x%08x\n", hr); - hr = Session_FeatureRequestStateGet(pSession, szOne, &myint); + hr = Session_FeatureRequestStateGet(pSession, L"One", &myint); ok(hr == S_OK, "Session_FeatureRequestStateGet failed, hresult 0x%08x\n", hr); ok(myint == INSTALLSTATE_ADVERTISED, "Feature request state was %d but expected %d\n", myint, INSTALLSTATE_ADVERTISED); /* Session::EvaluateCondition */ - hr = Session_EvaluateCondition(pSession, szOneActionFalse, &myint); + hr = Session_EvaluateCondition(pSession, L"$One=-1", &myint); ok(hr == S_OK, "Session_EvaluateCondition failed, hresult 0x%08x\n", hr); ok(myint == MSICONDITION_FALSE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN); - hr = Session_EvaluateCondition(pSession, szOneActionTrue, &myint); + hr = Session_EvaluateCondition(pSession, L"$One>0", &myint); ok(hr == S_OK, "Session_EvaluateCondition failed, hresult 0x%08x\n", hr); ok(myint == MSICONDITION_TRUE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN); } @@ -2052,21 +2018,6 @@ static DWORD delete_key( HKEY hkey ) static void test_Installer_RegistryValue(void) { static const DWORD qw[2] = { 0x12345678, 0x87654321 }; - static const WCHAR szKey[] = { 'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\','T','e','s','t',0 }; - static const WCHAR szOne[] = { 'O','n','e',0 }; - static const WCHAR szTwo[] = { 'T','w','o',0 }; - static const WCHAR szThree[] = { 'T','h','r','e','e',0 }; - static const WCHAR szREG_BINARY[] = { '(','R','E','G','_','B','I','N','A','R','Y',')',0 }; - static const WCHAR szFour[] = { 'F','o','u','r',0 }; - static const WCHAR szExpand[] = { '%','M','S','I','T','E','S','T','%',0 }; - static const WCHAR szFive[] = { 'F','i','v','e',0,'H','i',0,0 }; - static const WCHAR szFiveHi[] = { 'F','i','v','e','\n','H','i',0 }; - static const WCHAR szSix[] = { 'S','i','x',0 }; - static const WCHAR szREG_[] = { '(','R','E','G','_',']',0 }; - static const WCHAR szREG_2[] = { '(','R','E','G','_','?','?',')',0 }; - static const WCHAR szSeven[] = { 'S','e','v','e','n',0 }; - static const WCHAR szEight[] = { 'E','i','g','h','t',0 }; - static const WCHAR szBlank[] = { 0 }; VARIANT varresult; VARIANTARG vararg; WCHAR szString[MAX_PATH]; @@ -2078,7 +2029,7 @@ static void test_Installer_RegistryValue(void) /* Delete keys */ SetLastError(0xdeadbeef); - lRet = RegOpenKeyW( HKEY_CURRENT_USER, szKey, &hkey ); + lRet = RegOpenKeyW( HKEY_CURRENT_USER, L"Software\\Wine\\Test", &hkey ); if (!lRet && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) { win_skip("Needed W-functions are not implemented\n"); @@ -2088,129 +2039,129 @@ static void test_Installer_RegistryValue(void) delete_key( hkey ); /* Does our key exist? Shouldn't; check with all three possible value parameter types */ - hr = Installer_RegistryValueE(curr_user, szKey, &bRet); + hr = Installer_RegistryValueE(curr_user, L"Software\\Wine\\Test", &bRet); ok(hr == S_OK, "Installer_RegistryValueE failed, hresult 0x%08x\n", hr); ok(!bRet, "Registry key expected to not exist, but Installer_RegistryValue claims it does\n"); memset(szString, 0, sizeof(szString)); - hr = Installer_RegistryValueW(curr_user, szKey, NULL, szString); + hr = Installer_RegistryValueW(curr_user, L"Software\\Wine\\Test", NULL, szString); ok(hr == DISP_E_BADINDEX, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr); memset(szString, 0, sizeof(szString)); - hr = Installer_RegistryValueI(curr_user, szKey, 0, szString, VT_BSTR); + hr = Installer_RegistryValueI(curr_user, L"Software\\Wine\\Test", 0, szString, VT_BSTR); ok(hr == DISP_E_BADINDEX, "Installer_RegistryValueI failed, hresult 0x%08x\n", hr); /* Create key */ - ok(!RegCreateKeyW( HKEY_CURRENT_USER, szKey, &hkey ), "RegCreateKeyW failed\n"); + ok(!RegCreateKeyW( HKEY_CURRENT_USER, L"Software\\Wine\\Test", &hkey ), "RegCreateKeyW failed\n"); - ok(!RegSetValueExW(hkey,szOne,0,REG_SZ, (const BYTE *)szOne, sizeof(szOne)), + ok(!RegSetValueExW(hkey, L"One", 0, REG_SZ, (const BYTE *)L"One", sizeof(L"one")), "RegSetValueExW failed\n"); - ok(!RegSetValueExW(hkey,szTwo,0,REG_DWORD, (const BYTE *)qw, 4), + ok(!RegSetValueExW(hkey, L"Two", 0, REG_DWORD, (const BYTE *)qw, 4), "RegSetValueExW failed\n"); - ok(!RegSetValueExW(hkey,szThree,0,REG_BINARY, (const BYTE *)qw, 4), + ok(!RegSetValueExW(hkey, L"Three", 0, REG_BINARY, (const BYTE *)qw, 4), "RegSetValueExW failed\n"); bRet = SetEnvironmentVariableA("MSITEST", "Four"); ok(bRet, "SetEnvironmentVariableA failed %d\n", GetLastError()); - ok(!RegSetValueExW(hkey,szFour,0,REG_EXPAND_SZ, (const BYTE *)szExpand, sizeof(szExpand)), + ok(!RegSetValueExW(hkey, L"Four", 0, REG_EXPAND_SZ, (const BYTE *)L"%MSITEST%", sizeof(L"%MSITEST%")), "RegSetValueExW failed\n"); - ok(!RegSetValueExW(hkey,szFive,0,REG_MULTI_SZ, (const BYTE *)szFive, sizeof(szFive)), + ok(!RegSetValueExW(hkey, L"Five\0Hi\0", 0, REG_MULTI_SZ, (const BYTE *)L"Five\0Hi\0", sizeof(L"Five\0Hi\0")), "RegSetValueExW failed\n"); - ok(!RegSetValueExW(hkey,szSix,0,REG_QWORD, (const BYTE *)qw, 8), + ok(!RegSetValueExW(hkey, L"Six", 0, REG_QWORD, (const BYTE *)qw, 8), "RegSetValueExW failed\n"); - ok(!RegSetValueExW(hkey,szSeven,0,REG_NONE, NULL, 0), + ok(!RegSetValueExW(hkey, L"Seven", 0, REG_NONE, NULL, 0), "RegSetValueExW failed\n"); - ok(!RegSetValueExW(hkey,NULL,0,REG_SZ, (const BYTE *)szOne, sizeof(szOne)), + ok(!RegSetValueExW(hkey, NULL, 0, REG_SZ, (const BYTE *)L"One", sizeof(L"One")), "RegSetValueExW failed\n"); - ok(!RegCreateKeyW( hkey, szEight, &hkey_sub ), "RegCreateKeyW failed\n"); + ok(!RegCreateKeyW( hkey, L"Eight", &hkey_sub ), "RegCreateKeyW failed\n"); /* Does our key exist? It should, and make sure we retrieve the correct default value */ bRet = FALSE; - hr = Installer_RegistryValueE(curr_user, szKey, &bRet); + hr = Installer_RegistryValueE(curr_user, L"Software\\Wine\\Test", &bRet); ok(hr == S_OK, "Installer_RegistryValueE failed, hresult 0x%08x\n", hr); ok(bRet, "Registry key expected to exist, but Installer_RegistryValue claims it does not\n"); memset(szString, 0, sizeof(szString)); - hr = Installer_RegistryValueW(curr_user, szKey, NULL, szString); + hr = Installer_RegistryValueW(curr_user, L"Software\\Wine\\Test", NULL, szString); ok(hr == S_OK, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr); - ok_w2("Default registry value \"%s\" does not match expected \"%s\"\n", szString, szOne); + ok_w2("Default registry value \"%s\" does not match expected \"%s\"\n", szString, L"One"); /* Ask for the value of a nonexistent key */ memset(szString, 0, sizeof(szString)); - hr = Installer_RegistryValueW(curr_user, szKey, szExpand, szString); + hr = Installer_RegistryValueW(curr_user, L"Software\\Wine\\Test", L"%MSITEST%", szString); ok(hr == DISP_E_BADINDEX, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr); /* Get values of keys */ memset(szString, 0, sizeof(szString)); - hr = Installer_RegistryValueW(curr_user, szKey, szOne, szString); + hr = Installer_RegistryValueW(curr_user, L"Software\\Wine\\Test", L"One", szString); ok(hr == S_OK, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr); - ok_w2("Registry value \"%s\" does not match expected \"%s\"\n", szString, szOne); + ok_w2("Registry value \"%s\" does not match expected \"%s\"\n", szString, L"One"); VariantInit(&vararg); V_VT(&vararg) = VT_BSTR; - V_BSTR(&vararg) = SysAllocString(szTwo); - hr = Installer_RegistryValue(curr_user, szKey, vararg, &varresult, VT_I4); + V_BSTR(&vararg) = SysAllocString(L"Two"); + hr = Installer_RegistryValue(curr_user, L"Software\\Wine\\Test", vararg, &varresult, VT_I4); ok(hr == S_OK, "Installer_RegistryValue failed, hresult 0x%08x\n", hr); ok(V_I4(&varresult) == 305419896, "Registry value %d does not match expected value\n", V_I4(&varresult)); VariantClear(&varresult); memset(szString, 0, sizeof(szString)); - hr = Installer_RegistryValueW(curr_user, szKey, szThree, szString); + hr = Installer_RegistryValueW(curr_user, L"Software\\Wine\\Test", L"Three", szString); ok(hr == S_OK, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr); - ok_w2("Registry value \"%s\" does not match expected \"%s\"\n", szString, szREG_BINARY); + ok_w2("Registry value \"%s\" does not match expected \"%s\"\n", szString, L"(REG_BINARY)"); memset(szString, 0, sizeof(szString)); - hr = Installer_RegistryValueW(curr_user, szKey, szFour, szString); + hr = Installer_RegistryValueW(curr_user, L"Software\\Wine\\Test", L"Four", szString); ok(hr == S_OK, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr); - ok_w2("Registry value \"%s\" does not match expected \"%s\"\n", szString, szFour); + ok_w2("Registry value \"%s\" does not match expected \"%s\"\n", szString, L"Four"); /* Vista does not NULL-terminate this case */ memset(szString, 0, sizeof(szString)); - hr = Installer_RegistryValueW(curr_user, szKey, szFive, szString); + hr = Installer_RegistryValueW(curr_user, L"Software\\Wine\\Test", L"Five\0Hi\0", szString); ok(hr == S_OK, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr); ok_w2n("Registry value \"%s\" does not match expected \"%s\"\n", - szString, szFiveHi, lstrlenW(szFiveHi)); + szString, L"Five\nHi", lstrlenW(L"Five\nHi")); memset(szString, 0, sizeof(szString)); - hr = Installer_RegistryValueW(curr_user, szKey, szSix, szString); + hr = Installer_RegistryValueW(curr_user, L"Software\\Wine\\Test", L"Six", szString); ok(hr == S_OK, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr); - ok(!lstrcmpW(szString, szREG_2) || broken(!lstrcmpW(szString, szREG_)), + ok(!lstrcmpW(szString, L"(REG_\?\?)") || broken(!lstrcmpW(szString, L"(REG_]")), "Registry value does not match\n"); VariantInit(&vararg); V_VT(&vararg) = VT_BSTR; - V_BSTR(&vararg) = SysAllocString(szSeven); - hr = Installer_RegistryValue(curr_user, szKey, vararg, &varresult, VT_EMPTY); + V_BSTR(&vararg) = SysAllocString(L"Seven"); + hr = Installer_RegistryValue(curr_user, L"Software\\Wine\\Test", vararg, &varresult, VT_EMPTY); ok(hr == S_OK, "Installer_RegistryValue failed, hresult 0x%08x\n", hr); /* Get string class name for the key */ memset(szString, 0, sizeof(szString)); - hr = Installer_RegistryValueI(curr_user, szKey, 0, szString, VT_BSTR); + hr = Installer_RegistryValueI(curr_user, L"Software\\Wine\\Test", 0, szString, VT_BSTR); ok(hr == S_OK, "Installer_RegistryValueI failed, hresult 0x%08x\n", hr); - ok_w2("Registry name \"%s\" does not match expected \"%s\"\n", szString, szBlank); + ok_w2("Registry name \"%s\" does not match expected \"%s\"\n", szString, L""); /* Get name of a value by positive number (RegEnumValue like), valid index */ memset(szString, 0, sizeof(szString)); - hr = Installer_RegistryValueI(curr_user, szKey, 2, szString, VT_BSTR); + hr = Installer_RegistryValueI(curr_user, L"Software\\Wine\\Test", 2, szString, VT_BSTR); ok(hr == S_OK, "Installer_RegistryValueI failed, hresult 0x%08x\n", hr); /* RegEnumValue order seems different on wine */ - todo_wine ok_w2("Registry name \"%s\" does not match expected \"%s\"\n", szString, szTwo); + todo_wine ok_w2("Registry name \"%s\" does not match expected \"%s\"\n", szString, L"Two"); /* Get name of a value by positive number (RegEnumValue like), invalid index */ memset(szString, 0, sizeof(szString)); - hr = Installer_RegistryValueI(curr_user, szKey, 10, szString, VT_EMPTY); + hr = Installer_RegistryValueI(curr_user, L"Software\\Wine\\Test", 10, szString, VT_EMPTY); ok(hr == S_OK, "Installer_RegistryValueI failed, hresult 0x%08x\n", hr); /* Get name of a subkey by negative number (RegEnumValue like), valid index */ memset(szString, 0, sizeof(szString)); - hr = Installer_RegistryValueI(curr_user, szKey, -1, szString, VT_BSTR); + hr = Installer_RegistryValueI(curr_user, L"Software\\Wine\\Test", -1, szString, VT_BSTR); ok(hr == S_OK, "Installer_RegistryValueI failed, hresult 0x%08x\n", hr); - ok_w2("Registry name \"%s\" does not match expected \"%s\"\n", szString, szEight); + ok_w2("Registry name \"%s\" does not match expected \"%s\"\n", szString, L"Eight"); /* Get name of a subkey by negative number (RegEnumValue like), invalid index */ memset(szString, 0, sizeof(szString)); - hr = Installer_RegistryValueI(curr_user, szKey, -10, szString, VT_EMPTY); + hr = Installer_RegistryValueI(curr_user, L"Software\\Wine\\Test", -10, szString, VT_EMPTY); ok(hr == S_OK, "Installer_RegistryValueI failed, hresult 0x%08x\n", hr); /* clean up */ @@ -2266,7 +2217,7 @@ static void test_Installer_Products(BOOL bProductInstalled) ok(iValue == INSTALLSTATE_DEFAULT || iValue == INSTALLSTATE_ADVERTISED, "Installer_ProductState returned %d, expected %d or %d\n", iValue, INSTALLSTATE_DEFAULT, INSTALLSTATE_ADVERTISED); /* Not found our product code yet? Check */ - if (!bProductFound && !lstrcmpW(szString, szProductCode)) + if (!bProductFound && !lstrcmpW(szString, L"{837450fa-a39b-4bc8-b321-08b393f784b3}")) bProductFound = TRUE; /* IEnumVARIANT::Next */ @@ -2458,7 +2409,7 @@ static void test_Installer_InstallProduct(void) ok(hr == S_OK, "Expected UILevel property put invoke to return S_OK, got 0x%08x\n", hr); /* Installer::InstallProduct */ - hr = Installer_InstallProduct(szMsifile, NULL); + hr = Installer_InstallProduct(L"winetest-automation.msi", NULL); if (hr == DISP_E_EXCEPTION) { skip("InstallProduct failed, insufficient rights?\n"); @@ -2468,7 +2419,7 @@ static void test_Installer_InstallProduct(void) ok(hr == S_OK, "Installer_InstallProduct failed, hresult 0x%08x\n", hr); /* Installer::ProductState for our product code, which has been installed */ - hr = Installer_ProductState(szProductCode, &iValue); + hr = Installer_ProductState(L"{837450fa-a39b-4bc8-b321-08b393f784b3}", &iValue); ok(hr == S_OK, "Installer_ProductState failed, hresult 0x%08x\n", hr); ok(iValue == INSTALLSTATE_DEFAULT, "Installer_ProductState returned %d, expected %d\n", iValue, INSTALLSTATE_DEFAULT); @@ -2476,33 +2427,33 @@ static void test_Installer_InstallProduct(void) /* NULL attribute */ memset(szString, 0, sizeof(szString)); - hr = Installer_ProductInfo(szProductCode, NULL, szString); + hr = Installer_ProductInfo(L"{837450fa-a39b-4bc8-b321-08b393f784b3}", NULL, szString); ok(hr == DISP_E_EXCEPTION, "Installer_ProductInfo failed, hresult 0x%08x\n", hr); - ok_exception(hr, szProductInfoException); + ok_exception(hr, L"ProductInfo,Product,Attribute"); /* Nonexistent attribute */ memset(szString, 0, sizeof(szString)); - hr = Installer_ProductInfo(szProductCode, szMsifile, szString); + hr = Installer_ProductInfo(L"{837450fa-a39b-4bc8-b321-08b393f784b3}", L"winetest-automation.msi", szString); ok(hr == DISP_E_EXCEPTION, "Installer_ProductInfo failed, hresult 0x%08x\n", hr); - ok_exception(hr, szProductInfoException); + ok_exception(hr, L"ProductInfo,Product,Attribute"); /* Package name */ memset(szString, 0, sizeof(szString)); - hr = Installer_ProductInfo(szProductCode, WINE_INSTALLPROPERTY_PACKAGENAMEW, szString); + hr = Installer_ProductInfo(L"{837450fa-a39b-4bc8-b321-08b393f784b3}", L"PackageName", szString); ok(hr == S_OK, "Installer_ProductInfo failed, hresult 0x%08x\n", hr); - todo_wine ok_w2("Installer_ProductInfo returned %s but expected %s\n", szString, szMsifile); + todo_wine ok_w2("Installer_ProductInfo returned %s but expected %s\n", szString, L"winetest-automation.msi"); /* Product name */ memset(szString, 0, sizeof(szString)); - hr = Installer_ProductInfo(szProductCode, WINE_INSTALLPROPERTY_PRODUCTNAMEW, szString); + hr = Installer_ProductInfo(L"{837450fa-a39b-4bc8-b321-08b393f784b3}", L"ProductName", szString); ok(hr == S_OK, "Installer_ProductInfo failed, hresult 0x%08x\n", hr); - todo_wine ok_w2("Installer_ProductInfo returned %s but expected %s\n", szString, szMSITEST); + todo_wine ok_w2("Installer_ProductInfo returned %s but expected %s\n", szString, L"MSITEST"); /* Installer::Products */ test_Installer_Products(TRUE); /* Installer::RelatedProducts for our upgrade code */ - hr = Installer_RelatedProducts(szUpgradeCode, &pStringList); + hr = Installer_RelatedProducts(L"{CE067E8D-2E1A-4367-B734-4EB2BDAD6565}", &pStringList); ok(hr == S_OK, "Installer_RelatedProducts failed, hresult 0x%08x\n", hr); if (hr == S_OK) { @@ -2515,12 +2466,12 @@ static void test_Installer_InstallProduct(void) memset(szString, 0, sizeof(szString)); hr = StringList_Item(pStringList, 0, szString); ok(hr == S_OK, "StringList_Item failed (idx 0, count %d), hresult 0x%08x\n", iCount, hr); - ok_w2("StringList_Item returned %s but expected %s\n", szString, szProductCode); + ok_w2("StringList_Item returned %s but expected %s\n", szString, L"{837450fa-a39b-4bc8-b321-08b393f784b3}"); IDispatch_Release(pStringList); } - hr = Installer_ProductInfo(szProductCode, WINE_INSTALLPROPERTY_LOCALPACKAGEW, szString); + hr = Installer_ProductInfo(L"{837450fa-a39b-4bc8-b321-08b393f784b3}", L"LocalPackage", szString); ok(hr == S_OK, "Installer_ProductInfo failed, hresult 0x%08x\n", hr); DeleteFileW( szString ); @@ -2608,8 +2559,6 @@ static void test_Installer_InstallProduct(void) static void test_Installer(void) { - static const WCHAR szCreateRecordException[] = { 'C','r','e','a','t','e','R','e','c','o','r','d',',','C','o','u','n','t',0 }; - static const WCHAR szIntegerDataException[] = { 'I','n','t','e','g','e','r','D','a','t','a',',','F','i','e','l','d',0 }; WCHAR szPath[MAX_PATH]; HRESULT hr; IDispatch *pSession = NULL, *pDatabase = NULL, *pRecord = NULL, *pStringList = NULL, *pSumInfo = NULL; @@ -2622,7 +2571,7 @@ static void test_Installer(void) /* Test for error */ hr = Installer_CreateRecord(-1, &pRecord); ok(hr == DISP_E_EXCEPTION, "Installer_CreateRecord failed, hresult 0x%08x\n", hr); - ok_exception(hr, szCreateRecordException); + ok_exception(hr, L"CreateRecord,Count"); /* Test for success */ hr = Installer_CreateRecord(1, &pRecord); @@ -2652,7 +2601,7 @@ static void test_Installer(void) /* Record::IntegerDataPut, bad index */ hr = Record_IntegerDataPut(pRecord, 10, 100); ok(hr == DISP_E_EXCEPTION, "Record_IntegerDataPut failed, hresult 0x%08x\n", hr); - ok_exception(hr, szIntegerDataException); + ok_exception(hr, L"IntegerData,Field"); /* Record::IntegerDataGet */ hr = Record_IntegerDataGet(pRecord, 1, &iValue); @@ -2704,7 +2653,7 @@ static void test_Installer(void) test_Installer_RegistryValue(); /* Installer::ProductState for our product code, which should not be installed */ - hr = Installer_ProductState(szProductCode, &iValue); + hr = Installer_ProductState(L"{837450fa-a39b-4bc8-b321-08b393f784b3}", &iValue); ok(hr == S_OK, "Installer_ProductState failed, hresult 0x%08x\n", hr); ok(iValue == INSTALLSTATE_UNKNOWN, "Installer_ProductState returned %d, expected %d\n", iValue, INSTALLSTATE_UNKNOWN); @@ -2712,21 +2661,21 @@ static void test_Installer(void) /* Package name */ memset(szPath, 0, sizeof(szPath)); - hr = Installer_ProductInfo(szProductCode, WINE_INSTALLPROPERTY_PACKAGENAMEW, szPath); + hr = Installer_ProductInfo(L"{837450fa-a39b-4bc8-b321-08b393f784b3}", L"PackageName", szPath); ok(hr == DISP_E_EXCEPTION, "Installer_ProductInfo failed, hresult 0x%08x\n", hr); - ok_exception(hr, szProductInfoException); + ok_exception(hr, L"ProductInfo,Product,Attribute"); /* NULL attribute and NULL product code */ memset(szPath, 0, sizeof(szPath)); hr = Installer_ProductInfo(NULL, NULL, szPath); ok(hr == DISP_E_EXCEPTION, "Installer_ProductInfo failed, hresult 0x%08x\n", hr); - ok_exception(hr, szProductInfoException); + ok_exception(hr, L"ProductInfo,Product,Attribute"); /* Installer::Products */ test_Installer_Products(FALSE); /* Installer::RelatedProducts for our upgrade code, should not find anything */ - hr = Installer_RelatedProducts(szUpgradeCode, &pStringList); + hr = Installer_RelatedProducts(L"{CE067E8D-2E1A-4367-B734-4EB2BDAD6565}", &pStringList); ok(hr == S_OK, "Installer_RelatedProducts failed, hresult 0x%08x\n", hr); if (hr == S_OK) { @@ -2776,7 +2725,7 @@ START_TEST(automation) hr = OleInitialize(NULL); ok (hr == S_OK, "OleInitialize returned 0x%08x\n", hr); - hr = CLSIDFromProgID(szProgId, &clsid); + hr = CLSIDFromProgID(L"WindowsInstaller.Installer", &clsid); ok (hr == S_OK, "CLSIDFromProgID returned 0x%08x\n", hr); hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk); ok(hr == S_OK, "CoCreateInstance returned 0x%08x\n", hr); diff --git a/modules/rostests/winetests/msi/custom.c b/modules/rostests/winetests/msi/custom.c index 504f32cf96f..caf24356948 100644 --- a/modules/rostests/winetests/msi/custom.c +++ b/modules/rostests/winetests/msi/custom.c @@ -106,9 +106,6 @@ static void check_prop(MSIHANDLE hinst, const char *prop, const char *expect) static void test_props(MSIHANDLE hinst) { - static const WCHAR booW[] = {'b','o','o',0}; - static const WCHAR xyzW[] = {'x','y','z',0}; - static const WCHAR xyW[] = {'x','y',0}; char buffer[10]; WCHAR bufferW[10]; DWORD sz; @@ -219,43 +216,43 @@ static void test_props(MSIHANDLE hinst) ok(hinst, !strcmp(buffer, "xyz"), "got \"%s\"\n", buffer); ok(hinst, sz == 3, "got size %u\n", sz); - r = MsiGetPropertyW(hinst, booW, NULL, NULL); + r = MsiGetPropertyW(hinst, L"boo", NULL, NULL); ok(hinst, !r, "got %u\n", r); - r = MsiGetPropertyW(hinst, booW, bufferW, NULL ); + r = MsiGetPropertyW(hinst, L"boo", bufferW, NULL ); ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); sz = 0; - r = MsiGetPropertyW(hinst, booW, NULL, &sz); + r = MsiGetPropertyW(hinst, L"boo", NULL, &sz); ok(hinst, !r, "got %u\n", r); ok(hinst, sz == 3, "got size %u\n", sz); sz = 0; - lstrcpyW(bufferW, booW); - r = MsiGetPropertyW(hinst, booW, bufferW, &sz); + lstrcpyW(bufferW, L"boo"); + r = MsiGetPropertyW(hinst, L"boo", bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); - ok(hinst, !lstrcmpW(bufferW, booW), "got %s\n", dbgstr_w(bufferW)); + ok(hinst, !lstrcmpW(bufferW, L"boo"), "got %s\n", dbgstr_w(bufferW)); ok(hinst, sz == 3, "got size %u\n", sz); sz = 1; - lstrcpyW(bufferW, booW); - r = MsiGetPropertyW(hinst, booW, bufferW, &sz); + lstrcpyW(bufferW, L"boo"); + r = MsiGetPropertyW(hinst, L"boo", bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !bufferW[0], "got %s\n", dbgstr_w(bufferW)); ok(hinst, sz == 3, "got size %u\n", sz); sz = 3; - lstrcpyW(bufferW, booW); - r = MsiGetPropertyW(hinst, booW, bufferW, &sz); + lstrcpyW(bufferW, L"boo"); + r = MsiGetPropertyW(hinst, L"boo", bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); - ok(hinst, !lstrcmpW(bufferW, xyW), "got %s\n", dbgstr_w(bufferW)); + ok(hinst, !lstrcmpW(bufferW, L"xy"), "got %s\n", dbgstr_w(bufferW)); ok(hinst, sz == 3, "got size %u\n", sz); sz = 4; - lstrcpyW(bufferW, booW); - r = MsiGetPropertyW(hinst, booW, bufferW, &sz); + lstrcpyW(bufferW, L"boo"); + r = MsiGetPropertyW(hinst, L"boo", bufferW, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, !lstrcmpW(bufferW, xyzW), "got %s\n", dbgstr_w(bufferW)); + ok(hinst, !lstrcmpW(bufferW, L"xyz"), "got %s\n", dbgstr_w(bufferW)); ok(hinst, sz == 3, "got size %u\n", sz); r = MsiSetPropertyA(hinst, "boo", NULL); @@ -566,9 +563,6 @@ UINT WINAPI nested(MSIHANDLE hinst) static void test_targetpath(MSIHANDLE hinst) { - static const WCHAR targetdirW[] = {'T','A','R','G','E','T','D','I','R',0}; - static const WCHAR xyzW[] = {'C',':','\\',0}; - static const WCHAR xyW[] = {'C',':',0}; WCHAR bufferW[100]; char buffer[100]; DWORD sz, srcsz; @@ -621,36 +615,36 @@ static void test_targetpath(MSIHANDLE hinst) ok(hinst, sz == 3, "got size %u\n", sz); sz = 0; - r = MsiGetTargetPathW(hinst, targetdirW, NULL, &sz); + r = MsiGetTargetPathW(hinst, L"TARGETDIR", NULL, &sz); ok(hinst, !r, "got %u\n", r); ok(hinst, sz == 3, "got size %u\n", sz); sz = 0; bufferW[0] = 'q'; - r = MsiGetTargetPathW(hinst, targetdirW, bufferW, &sz); + r = MsiGetTargetPathW(hinst, L"TARGETDIR", bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, bufferW[0] == 'q', "got %s\n", dbgstr_w(bufferW)); ok(hinst, sz == 3, "got size %u\n", sz); sz = 1; bufferW[0] = 'q'; - r = MsiGetTargetPathW(hinst, targetdirW, bufferW, &sz); + r = MsiGetTargetPathW(hinst, L"TARGETDIR", bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !bufferW[0], "got %s\n", dbgstr_w(bufferW)); ok(hinst, sz == 3, "got size %u\n", sz); sz = 3; bufferW[0] = 'q'; - r = MsiGetTargetPathW(hinst, targetdirW, bufferW, &sz); + r = MsiGetTargetPathW(hinst, L"TARGETDIR", bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); - ok(hinst, !lstrcmpW(bufferW, xyW), "got %s\n", dbgstr_w(bufferW)); + ok(hinst, !lstrcmpW(bufferW, L"C:"), "got %s\n", dbgstr_w(bufferW)); ok(hinst, sz == 3, "got size %u\n", sz); sz = 4; bufferW[0] = 'q'; - r = MsiGetTargetPathW(hinst, targetdirW, bufferW, &sz); + r = MsiGetTargetPathW(hinst, L"TARGETDIR", bufferW, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, !lstrcmpW(bufferW, xyzW), "got %s\n", dbgstr_w(bufferW)); + ok(hinst, !lstrcmpW(bufferW, L"C:\\"), "got %s\n", dbgstr_w(bufferW)); ok(hinst, sz == 3, "got size %u\n", sz); r = MsiSetTargetPathA(hinst, NULL, "C:\\subdir"); @@ -684,7 +678,7 @@ static void test_targetpath(MSIHANDLE hinst) * Seems to be a casualty of RPC... */ srcsz = 0; - MsiGetSourcePathW(hinst, targetdirW, NULL, &srcsz); + MsiGetSourcePathW(hinst, L"TARGETDIR", NULL, &srcsz); sz = 0; r = MsiGetSourcePathA(hinst, "TARGETDIR", NULL, &sz); @@ -720,34 +714,34 @@ static void test_targetpath(MSIHANDLE hinst) ok(hinst, sz == srcsz, "got size %u\n", sz); sz = 0; - r = MsiGetSourcePathW(hinst, targetdirW, NULL, &sz); + r = MsiGetSourcePathW(hinst, L"TARGETDIR", NULL, &sz); ok(hinst, !r, "got %u\n", r); ok(hinst, sz == srcsz, "got size %u\n", sz); sz = 0; bufferW[0] = 'q'; - r = MsiGetSourcePathW(hinst, targetdirW, bufferW, &sz); + r = MsiGetSourcePathW(hinst, L"TARGETDIR", bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, bufferW[0] == 'q', "got %s\n", dbgstr_w(bufferW)); ok(hinst, sz == srcsz, "got size %u\n", sz); sz = 1; bufferW[0] = 'q'; - r = MsiGetSourcePathW(hinst, targetdirW, bufferW, &sz); + r = MsiGetSourcePathW(hinst, L"TARGETDIR", bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !bufferW[0], "got %s\n", dbgstr_w(bufferW)); ok(hinst, sz == srcsz, "got size %u\n", sz); sz = srcsz; bufferW[0] = 'q'; - r = MsiGetSourcePathW(hinst, targetdirW, bufferW, &sz); + r = MsiGetSourcePathW(hinst, L"TARGETDIR", bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, lstrlenW(bufferW) == srcsz - 1, "wrong buffer length %d\n", lstrlenW(bufferW)); ok(hinst, sz == srcsz, "got size %u\n", sz); sz = srcsz + 1; bufferW[0] = 'q'; - r = MsiGetSourcePathW(hinst, targetdirW, bufferW, &sz); + r = MsiGetSourcePathW(hinst, L"TARGETDIR", bufferW, &sz); ok(hinst, !r, "got %u\n", r); ok(hinst, lstrlenW(bufferW) == srcsz, "wrong buffer length %d\n", lstrlenW(bufferW)); ok(hinst, sz == srcsz, "got size %u\n", sz); @@ -870,8 +864,6 @@ static void test_feature_states(MSIHANDLE hinst) static void test_format_record(MSIHANDLE hinst) { - static const WCHAR xyzW[] = {'f','o','o',' ','1','2','3',0}; - static const WCHAR xyW[] = {'f','o','o',' ','1','2',0}; WCHAR bufferW[10]; char buffer[10]; MSIHANDLE rec; @@ -955,14 +947,14 @@ static void test_format_record(MSIHANDLE hinst) bufferW[0] = 'q'; r = MsiFormatRecordW(hinst, rec, bufferW, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); - ok(hinst, !lstrcmpW(bufferW, xyW), "got %s\n", dbgstr_w(bufferW)); + ok(hinst, !lstrcmpW(bufferW, L"foo 12"), "got %s\n", dbgstr_w(bufferW)); ok(hinst, sz == 7, "got size %u\n", sz); sz = 8; bufferW[0] = 'q'; r = MsiFormatRecordW(hinst, rec, bufferW, &sz); ok(hinst, !r, "got %u\n", r); - ok(hinst, !lstrcmpW(bufferW, xyzW), "got %s\n", dbgstr_w(bufferW)); + ok(hinst, !lstrcmpW(bufferW, L"foo 123"), "got %s\n", dbgstr_w(bufferW)); ok(hinst, sz == 7, "got size %u\n", sz); /* check that properties work */ @@ -979,9 +971,6 @@ static void test_format_record(MSIHANDLE hinst) static void test_costs(MSIHANDLE hinst) { - static const WCHAR oneW[] = {'O','n','e',0}; - static const WCHAR xyzW[] = {'C',':',0}; - static const WCHAR xyW[] = {'C',0}; WCHAR bufferW[10]; char buffer[10]; int cost, temp; @@ -1085,30 +1074,30 @@ static void test_costs(MSIHANDLE hinst) sz = 0; bufferW[0] = 'q'; - r = MsiEnumComponentCostsW(hinst, oneW, 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp); + r = MsiEnumComponentCostsW(hinst, L"One", 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, bufferW[0] == 'q', "got %s\n", dbgstr_w(bufferW)); ok(hinst, sz == 2, "got size %u\n", sz); sz = 1; bufferW[0] = 'q'; - r = MsiEnumComponentCostsW(hinst, oneW, 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp); + r = MsiEnumComponentCostsW(hinst, L"One", 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !bufferW[0], "got %s\n", dbgstr_w(bufferW)); ok(hinst, sz == 2, "got size %u\n", sz); sz = 2; bufferW[0] = 'q'; - r = MsiEnumComponentCostsW(hinst, oneW, 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp); + r = MsiEnumComponentCostsW(hinst, L"One", 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); - ok(hinst, !lstrcmpW(bufferW, xyW), "got %s\n", dbgstr_w(bufferW)); + ok(hinst, !lstrcmpW(bufferW, L"C"), "got %s\n", dbgstr_w(bufferW)); ok(hinst, sz == 2, "got size %u\n", sz); sz = 3; bufferW[0] = 'q'; - r = MsiEnumComponentCostsW(hinst, oneW, 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp); + r = MsiEnumComponentCostsW(hinst, L"One", 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp); ok(hinst, !r, "got %u\n", r); - ok(hinst, !lstrcmpW(bufferW, xyzW), "got %s\n", dbgstr_w(bufferW)); + ok(hinst, !lstrcmpW(bufferW, L"C:"), "got %s\n", dbgstr_w(bufferW)); ok(hinst, sz == 2, "got size %u\n", sz); } diff --git a/modules/rostests/winetests/msi/db.c b/modules/rostests/winetests/msi/db.c index 3e1c551d38f..4ffd30f0376 100644 --- a/modules/rostests/winetests/msi/db.c +++ b/modules/rostests/winetests/msi/db.c @@ -33,8 +33,8 @@ static const char *msifile = "winetest-db.msi"; static const char *msifile2 = "winetst2-db.msi"; static const char *mstfile = "winetst-db.mst"; -static const WCHAR msifileW[] = {'w','i','n','e','t','e','s','t','-','d','b','.','m','s','i',0}; -static const WCHAR msifile2W[] = {'w','i','n','e','t','s','t','2','-','d','b','.','m','s','i',0}; +static const WCHAR msifileW[] = L"winetest-db.msi"; +static const WCHAR msifile2W[] = L"winetst2-db.msi"; static void WINAPIV check_record_(int line, MSIHANDLE rec, UINT count, ...) { @@ -1428,7 +1428,7 @@ static void test_msiexport(void) static void test_longstrings(void) { - const char insert_query[] = + const char insert_query[] = "INSERT INTO `strings` ( `id`, `val` ) VALUES('1', 'Z')"; char *str; MSIHANDLE hdb = 0, hview = 0, hrec = 0; @@ -1442,7 +1442,7 @@ static void test_longstrings(void) ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n"); /* create a table */ - r = try_query( hdb, + r = try_query( hdb, "CREATE TABLE `strings` ( `id` INT, `val` CHAR(0) PRIMARY KEY `id`)"); ok(r == ERROR_SUCCESS, "query failed\n"); @@ -1507,7 +1507,7 @@ static void create_file_data(LPCSTR name, LPCSTR data, DWORD size) } #define create_file(name) create_file_data(name, name, 0) - + static void test_streamtable(void) { MSIHANDLE hdb = 0, rec, view, hsi; @@ -2740,7 +2740,7 @@ static void test_handle_limit(void) static char szQueryBuf[256] = "SELECT * from `_Tables`"; hviews[i] = 0xdeadbeeb; r = MsiDatabaseOpenViewA(hdb, szQueryBuf, &hviews[i]); - if( r != ERROR_SUCCESS || hviews[i] == 0xdeadbeeb || + if( r != ERROR_SUCCESS || hviews[i] == 0xdeadbeeb || hviews[i] == 0 || (i && (hviews[i] == hviews[i-1]))) break; } @@ -4776,34 +4776,6 @@ static void test_rows_order(void) static void test_collation(void) { - static const WCHAR query1[] = - {'I','N','S','E','R','T',' ','I','N','T','O',' ','`','b','a','r','`',' ', - '(','`','f','o','o','`',',','`','b','a','z','`',')',' ','V','A','L','U','E','S',' ', - '(','\'','a',0x30a,'\'',',','\'','C','\'',')',0}; - static const WCHAR query2[] = - {'I','N','S','E','R','T',' ','I','N','T','O',' ','`','b','a','r','`',' ', - '(','`','f','o','o','`',',','`','b','a','z','`',')',' ','V','A','L','U','E','S',' ', - '(','\'',0xe5,'\'',',','\'','D','\'',')',0}; - static const WCHAR query3[] = - {'C','R','E','A','T','E',' ','T','A','B','L','E',' ','`','b','a','z','`',' ', - '(',' ','`','a',0x30a,'`',' ','L','O','N','G','C','H','A','R',' ','N','O','T',' ','N','U','L','L',',', - ' ','`',0xe5,'`',' ','L','O','N','G','C','H','A','R',' ','N','O','T',' ','N','U','L','L',' ', - 'P','R','I','M','A','R','Y',' ','K','E','Y',' ','`','a',0x30a,'`',')',0}; - static const WCHAR query4[] = - {'C','R','E','A','T','E',' ','T','A','B','L','E',' ','`','a',0x30a,'`',' ', - '(',' ','`','f','o','o','`',' ','L','O','N','G','C','H','A','R',' ','N','O','T',' ', - 'N','U','L','L',' ','P','R','I','M','A','R','Y',' ','K','E','Y',' ','`','f','o','o','`',')',0}; - static const WCHAR query5[] = - {'C','R','E','A','T','E',' ','T','A','B','L','E',' ','`',0xe5,'`',' ', - '(',' ','`','f','o','o','`',' ','L','O','N','G','C','H','A','R',' ','N','O','T',' ', - 'N','U','L','L',' ','P','R','I','M','A','R','Y',' ','K','E','Y',' ','`','f','o','o','`',')',0}; - static const WCHAR query6[] = - {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','b','a','r','`',' ','W','H','E','R','E', - ' ','`','f','o','o','`',' ','=','\'',0xe5,'\'',0}; - static const WCHAR letter_C[] = {'C',0}; - static const WCHAR letter_D[] = {'D',0}; - static const WCHAR letter_a_ring[] = {'a',0x30a,0}; - static const WCHAR letter_a_with_ring[] = {0xe5,0}; const char *query; MSIHANDLE hdb = 0, hview = 0, hrec = 0; UINT r; @@ -4832,19 +4804,19 @@ static void test_collation(void) "( `foo`, `baz` ) VALUES ( '\1', 'B' )"); ok(r == ERROR_SUCCESS, "cannot add value to table %u\n", r); - r = run_queryW(hdb, 0, query1); + r = run_queryW(hdb, 0, L"INSERT INTO `bar` (`foo`,`baz`) VALUES ('a\x30a','C')"); ok(r == ERROR_SUCCESS, "cannot add value to table %u\n", r); - r = run_queryW(hdb, 0, query2); + r = run_queryW(hdb, 0, L"INSERT INTO `bar` (`foo`,`baz`) VALUES ('\xe5','D')"); ok(r == ERROR_SUCCESS, "cannot add value to table %u\n", r); - r = run_queryW(hdb, 0, query3); + r = run_queryW(hdb, 0, L"CREATE TABLE `baz` ( `a\x30a` LONGCHAR NOT NULL, `\xe5` LONGCHAR NOT NULL PRIMARY KEY `a\x30a`)"); ok(r == ERROR_SUCCESS, "cannot create table %u\n", r); - r = run_queryW(hdb, 0, query4); + r = run_queryW(hdb, 0, L"CREATE TABLE `a\x30a` ( `foo` LONGCHAR NOT NULL PRIMARY KEY `foo`)"); ok(r == ERROR_SUCCESS, "cannot create table %u\n", r); - r = run_queryW(hdb, 0, query5); + r = run_queryW(hdb, 0, L"CREATE TABLE `\xe5` ( `foo` LONGCHAR NOT NULL PRIMARY KEY `foo`)"); ok(r == ERROR_SUCCESS, "cannot create table %u\n", r); query = "SELECT * FROM `bar`"; @@ -4882,12 +4854,12 @@ static void test_collation(void) sz = ARRAY_SIZE(bufferW); r = MsiRecordGetStringW(hrec, 1, bufferW, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!memcmp(bufferW, letter_a_ring, sizeof(letter_a_ring)), - "Expected %s, got %s\n", wine_dbgstr_w(letter_a_ring), wine_dbgstr_w(bufferW)); + ok(!memcmp(bufferW, L"a\x30a", sizeof(L"a\x30a")), + "Expected %s, got %s\n", wine_dbgstr_w(L"a\x30a"), wine_dbgstr_w(bufferW)); sz = ARRAY_SIZE(bufferW); r = MsiRecordGetStringW(hrec, 2, bufferW, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpW(bufferW, letter_C), "Expected C, got %s\n", wine_dbgstr_w(bufferW)); + ok(!lstrcmpW(bufferW, L"C"), "Expected C, got %s\n", wine_dbgstr_w(bufferW)); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); @@ -4895,12 +4867,12 @@ static void test_collation(void) sz = ARRAY_SIZE(bufferW); r = MsiRecordGetStringW(hrec, 1, bufferW, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!memcmp(bufferW, letter_a_with_ring, sizeof(letter_a_with_ring)), - "Expected %s, got %s\n", wine_dbgstr_w(letter_a_with_ring), wine_dbgstr_w(bufferW)); + ok(!memcmp(bufferW, L"\xe5", sizeof(L"\xe5")), + "Expected %s, got %s\n", wine_dbgstr_w(L"\xe5"), wine_dbgstr_w(bufferW)); sz = ARRAY_SIZE(bufferW); r = MsiRecordGetStringW(hrec, 2, bufferW, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpW(bufferW, letter_D), "Expected D, got %s\n", wine_dbgstr_w(bufferW)); + ok(!lstrcmpW(bufferW, L"D"), "Expected D, got %s\n", wine_dbgstr_w(bufferW)); MsiCloseHandle(hrec); r = MsiViewClose(hview); @@ -4908,7 +4880,7 @@ static void test_collation(void) r = MsiCloseHandle(hview); ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); - r = MsiDatabaseOpenViewW(hdb, query6, &hview); + r = MsiDatabaseOpenViewW(hdb, L"SELECT * FROM `bar` WHERE `foo` ='\xe5'", &hview); ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); r = MsiViewExecute(hview, 0); ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n"); @@ -4918,12 +4890,12 @@ static void test_collation(void) sz = ARRAY_SIZE(bufferW); r = MsiRecordGetStringW(hrec, 1, bufferW, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!memcmp(bufferW, letter_a_with_ring, sizeof(letter_a_with_ring)), - "Expected %s, got %s\n", wine_dbgstr_w(letter_a_with_ring), wine_dbgstr_w(bufferW)); + ok(!memcmp(bufferW, L"\xe5", sizeof(L"\xe5")), + "Expected %s, got %s\n", wine_dbgstr_w(L"\xe5"), wine_dbgstr_w(bufferW)); sz = ARRAY_SIZE(bufferW); r = MsiRecordGetStringW(hrec, 2, bufferW, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpW(bufferW, letter_D), "Expected D, got %s\n", wine_dbgstr_w(bufferW)); + ok(!lstrcmpW(bufferW, L"D"), "Expected D, got %s\n", wine_dbgstr_w(bufferW)); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); @@ -7539,7 +7511,6 @@ static void test_droptable(void) static void test_dbmerge(void) { - static const WCHAR refdbW[] = {'r','e','f','d','b','.','m','s','i',0}; MSIHANDLE hdb, href, hview, hrec; CHAR buf[MAX_PATH]; LPCSTR query; @@ -7549,7 +7520,7 @@ static void test_dbmerge(void) r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - r = MsiOpenDatabaseW(refdbW, MSIDBOPEN_CREATE, &href); + r = MsiOpenDatabaseW(L"refdb.msi", MSIDBOPEN_CREATE, &href); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); /* hDatabase is invalid */ @@ -8090,7 +8061,7 @@ static void test_dbmerge(void) MsiCloseHandle(hdb); MsiCloseHandle(href); DeleteFileA(msifile); - DeleteFileW(refdbW); + DeleteFileW(L"refdb.msi"); DeleteFileA("codepage.idt"); DeleteFileA("binary.dat"); } diff --git a/modules/rostests/winetests/msi/install.c b/modules/rostests/winetests/msi/install.c index 2cfa810e1da..ce650b84d61 100644 --- a/modules/rostests/winetests/msi/install.c +++ b/modules/rostests/winetests/msi/install.c @@ -59,8 +59,8 @@ static const char *msifile = "msitest.msi"; static const char *msifile2 = "winetest2.msi"; static const char *mstfile = "winetest.mst"; -static const WCHAR msifileW[] = {'m','s','i','t','e','s','t','.','m','s','i',0}; -static const WCHAR msifile2W[] = {'w','i','n','e','t','e','s','t','2','.','m','s','i',0}; +static const WCHAR msifileW[] = L"msitest.msi"; +static const WCHAR msifile2W[] = L"msitest2.msi"; char CURR_DIR[MAX_PATH]; char PROG_FILES_DIR[MAX_PATH]; @@ -2209,7 +2209,7 @@ static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void * { HANDLE handle = (HANDLE)hf; DWORD ret; - + ret = SetFilePointer(handle, dist, NULL, seektype); ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n"); @@ -3995,11 +3995,6 @@ static void set_admin_property_stream(LPCSTR file) DWORD count; const DWORD mode = STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE; - /* AdminProperties */ - static const WCHAR stmname[] = {0x41ca,0x4330,0x3e71,0x44b5,0x4233,0x45f5,0x422c,0x4836,0}; - static const WCHAR data[] = {'M','Y','P','R','O','P','=','2','7','1','8',' ', - 'M','y','P','r','o','p','=','4','2',0}; - MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH); hr = StgOpenStorage(fileW, NULL, mode, NULL, 0, &stg); @@ -4007,10 +4002,11 @@ static void set_admin_property_stream(LPCSTR file) if (!stg) return; - hr = IStorage_CreateStream(stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm); + hr = IStorage_CreateStream(stg, L"\x41ca\x4330\x3e71\x44b5\x4233\x45f5\x422c\x4836", + STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm); ok(hr == S_OK, "Expected S_OK, got %d\n", hr); - hr = IStream_Write(stm, data, sizeof(data), &count); + hr = IStream_Write(stm, L"MYPROP=2718 MyProp=42", sizeof(L"MYPROP=2718 MyProp=42"), &count); ok(hr == S_OK, "Expected S_OK, got %d\n", hr); IStream_Release(stm); @@ -4983,9 +4979,6 @@ error: static void test_int_widths( void ) { - static const WCHAR msitestW[] = {'m','s','i','t','e','s','t','.','m','s','i',0}; - static const WCHAR msitableW[] = {'m','s','i','t','a','b','l','e','.','i','d','t',0}; - static const WCHAR slashW[] = {'\\',0}; static const char int0[] = "int0\ni0\nint0\tint0\n1"; static const char int1[] = "int1\ni1\nint1\tint1\n1"; static const char int2[] = "int2\ni2\nint2\tint2\n1"; @@ -5017,12 +5010,10 @@ static void test_int_widths( void ) CreateDirectoryW(tmpdir, NULL); lstrcpyW(msitable, tmpdir); - lstrcatW(msitable, slashW); - lstrcatW(msitable, msitableW); + lstrcatW(msitable, L"\\msitable.idt"); lstrcpyW(msidb, tmpdir); - lstrcatW(msidb, slashW); - lstrcatW(msidb, msitestW); + lstrcatW(msidb, L"\\msitest.msi"); r = MsiOpenDatabaseW(msidb, MSIDBOPEN_CREATE, &db); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); @@ -5035,7 +5026,7 @@ static void test_int_widths( void ) WriteFile(handle, tests[i].data, tests[i].size, &count, NULL); CloseHandle(handle); - r = MsiDatabaseImportW(db, tmpdir, msitableW); + r = MsiDatabaseImportW(db, tmpdir, L"msitable.idt"); ok(r == tests[i].ret, " %u expected %u, got %u\n", i, tests[i].ret, r); r = MsiDatabaseCommit(db); diff --git a/modules/rostests/winetests/msi/msi.c b/modules/rostests/winetests/msi/msi.c index 14d7ab1a2df..9ff543347c2 100644 --- a/modules/rostests/winetests/msi/msi.c +++ b/modules/rostests/winetests/msi/msi.c @@ -39,7 +39,7 @@ static BOOL is_wow64; static const char msifile[] = "winetest.msi"; -static const WCHAR msifileW[] = {'w','i','n','e','t','e','s','t','.','m','s','i',0}; +static const WCHAR msifileW[] = L"winetest.msi"; static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD); static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); @@ -892,19 +892,19 @@ static void test_usefeature(void) r = pMsiUseFeatureExA(NULL, "WORDVIEWFiles", -2, 1 ); ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n"); - r = pMsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}", + r = pMsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}", NULL, -2, 0 ); ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n"); - r = pMsiUseFeatureExA("{9085040-6000-11d3-8cfe-0150048383c9}", + r = pMsiUseFeatureExA("{9085040-6000-11d3-8cfe-0150048383c9}", "WORDVIEWFiles", -2, 0 ); ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n"); - r = pMsiUseFeatureExA("{0085040-6000-11d3-8cfe-0150048383c9}", + r = pMsiUseFeatureExA("{0085040-6000-11d3-8cfe-0150048383c9}", "WORDVIEWFiles", -2, 0 ); ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n"); - r = pMsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}", + r = pMsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}", "WORDVIEWFiles", -2, 1 ); ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n"); } @@ -3379,14 +3379,6 @@ static void test_MsiGetComponentPathEx(void) static void test_MsiProvideComponent(void) { - static const WCHAR sourcedirW[] = - {'s','o','u','r','c','e','d','i','r',0}; - static const WCHAR productW[] = - {'{','3','8','8','4','7','3','3','8','-','1','B','B','C','-','4','1','0','4','-', - '8','1','A','C','-','2','F','A','A','C','7','E','C','D','D','C','D','}',0}; - static const WCHAR componentW[] = - {'{','D','D','4','2','2','F','9','2','-','3','E','D','8','-','4','9','B','5','-', - 'A','0','B','7','-','F','2','6','6','F','9','8','3','5','7','D','F','}',0}; INSTALLSTATE state; char buf[0x100]; WCHAR bufW[0x100]; @@ -3445,21 +3437,21 @@ static void test_MsiProvideComponent(void) bufW[0] = 0; len = sizeof(buf); - r = pMsiProvideComponentW(productW, sourcedirW, componentW, - INSTALLMODE_NODETECTION, bufW, &len); + r = pMsiProvideComponentW(L"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}", L"sourcedir", + L"{DD422F92-3ED8-49B5-A0B7-F266F98357DF}", INSTALLMODE_NODETECTION, bufW, &len); ok(r == ERROR_SUCCESS, "got %u\n", r); ok(bufW[0], "empty path\n"); ok(len == lstrlenW(bufW), "got %u\n", len); len2 = 0; - r = pMsiProvideComponentW(productW, sourcedirW, componentW, - INSTALLMODE_NODETECTION, NULL, &len2); + r = pMsiProvideComponentW(L"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}", L"sourcedir", + L"{DD422F92-3ED8-49B5-A0B7-F266F98357DF}", INSTALLMODE_NODETECTION, NULL, &len2); ok(r == ERROR_SUCCESS, "got %u\n", r); ok(len2 == len, "got %u\n", len2); len2 = 0; - r = pMsiProvideComponentW(productW, sourcedirW, componentW, - INSTALLMODE_NODETECTION, bufW, &len2); + r = pMsiProvideComponentW(L"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}", L"sourcedir", + L"{DD422F92-3ED8-49B5-A0B7-F266F98357DF}", INSTALLMODE_NODETECTION, bufW, &len2); ok(r == ERROR_MORE_DATA, "got %u\n", r); ok(len2 == len, "got %u\n", len2); diff --git a/modules/rostests/winetests/msi/package.c b/modules/rostests/winetests/msi/package.c index bf83c116fff..f8bf431883b 100644 --- a/modules/rostests/winetests/msi/package.c +++ b/modules/rostests/winetests/msi/package.c @@ -35,8 +35,7 @@ static BOOL is_wow64; static const char msifile[] = "winetest-package.msi"; -static const WCHAR msifileW[] = - {'w','i','n','e','t','e','s','t','-','p','a','c','k','a','g','e','.','m','s','i',0}; +static const WCHAR msifileW[] = L"winetest-package.msi"; static char CURR_DIR[MAX_PATH]; static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)(LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD); @@ -1137,8 +1136,6 @@ static void test_doaction( void ) static void test_gettargetpath_bad(void) { - static const WCHAR boo[] = {'b','o','o',0}; - static const WCHAR empty[] = {0}; char buffer[0x80]; WCHAR bufferW[0x80]; MSIHANDLE hpkg; @@ -1182,20 +1179,20 @@ static void test_gettargetpath_bad(void) r = MsiGetTargetPathW( 0, NULL, NULL, &sz ); ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n"); - r = MsiGetTargetPathW( 0, boo, NULL, NULL ); + r = MsiGetTargetPathW( 0, L"boo", NULL, NULL ); ok( r == ERROR_INVALID_HANDLE, "wrong return val\n"); - r = MsiGetTargetPathW( 0, boo, NULL, NULL ); + r = MsiGetTargetPathW( 0, L"boo", NULL, NULL ); ok( r == ERROR_INVALID_HANDLE, "wrong return val\n"); - r = MsiGetTargetPathW( hpkg, boo, NULL, NULL ); + r = MsiGetTargetPathW( hpkg, L"boo", NULL, NULL ); ok( r == ERROR_DIRECTORY, "wrong return val\n"); - r = MsiGetTargetPathW( hpkg, boo, bufferW, NULL ); + r = MsiGetTargetPathW( hpkg, L"boo", bufferW, NULL ); ok( r == ERROR_DIRECTORY, "wrong return val\n"); sz = 0; - r = MsiGetTargetPathW( hpkg, empty, bufferW, &sz ); + r = MsiGetTargetPathW( hpkg, L"", bufferW, &sz ); ok( r == ERROR_DIRECTORY, "wrong return val\n"); MsiCloseHandle( hpkg ); @@ -1391,10 +1388,6 @@ static void test_settargetpath(void) static void test_condition(void) { - static const WCHAR cond1[] = {'\"','a',0x30a,'\"','<','\"',0xe5,'\"',0}; - static const WCHAR cond2[] = {'\"','a',0x30a,'\"','>','\"',0xe5,'\"',0}; - static const WCHAR cond3[] = {'\"','a',0x30a,'\"','<','>','\"',0xe5,'\"',0}; - static const WCHAR cond4[] = {'\"','a',0x30a,'\"','=','\"',0xe5,'\"',0}; MSICONDITION r; MSIHANDLE hpkg; @@ -2126,19 +2119,19 @@ static void test_condition(void) r = MsiEvaluateConditionA(hpkg, "A <= X"); ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r); - r = MsiEvaluateConditionW(hpkg, cond1); + r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\"<\"\xe5\""); ok( r == MSICONDITION_TRUE || broken(r == MSICONDITION_FALSE), "wrong return val (%d)\n", r); - r = MsiEvaluateConditionW(hpkg, cond2); + r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\">\"\xe5\""); ok( r == MSICONDITION_FALSE || broken(r == MSICONDITION_TRUE), "wrong return val (%d)\n", r); - r = MsiEvaluateConditionW(hpkg, cond3); + r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\"<>\"\xe5\""); ok( r == MSICONDITION_TRUE || broken(r == MSICONDITION_FALSE), "wrong return val (%d)\n", r); - r = MsiEvaluateConditionW(hpkg, cond4); + r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\"=\"\xe5\""); ok( r == MSICONDITION_FALSE || broken(r == MSICONDITION_TRUE), "wrong return val (%d)\n", r); @@ -2161,9 +2154,6 @@ static void check_prop(MSIHANDLE hpkg, const char *prop, const char *expect, int static void test_props(void) { - static const WCHAR booW[] = {'b','o','o',0}; - static const WCHAR xyzW[] = {'x','y','z',0}; - static const WCHAR xyW[] = {'x','y',0}; MSIHANDLE hpkg, hdb; UINT r; DWORD sz; @@ -2296,36 +2286,36 @@ static void test_props(void) ok(sz == 3, "got size %u\n", sz); sz = 0; - r = MsiGetPropertyW(hpkg, booW, NULL, &sz); + r = MsiGetPropertyW(hpkg, L"boo", NULL, &sz); ok(!r, "got %u\n", r); ok(sz == 3, "got size %u\n", sz); sz = 0; - lstrcpyW(bufferW, booW); - r = MsiGetPropertyW(hpkg, booW, bufferW, &sz); + lstrcpyW(bufferW, L"boo"); + r = MsiGetPropertyW(hpkg, L"boo", bufferW, &sz); ok(r == ERROR_MORE_DATA, "got %u\n", r); - ok(!lstrcmpW(bufferW, booW), "got %s\n", wine_dbgstr_w(bufferW)); + ok(!lstrcmpW(bufferW, L"boo"), "got %s\n", wine_dbgstr_w(bufferW)); ok(sz == 3, "got size %u\n", sz); sz = 1; - lstrcpyW(bufferW, booW); - r = MsiGetPropertyW(hpkg, booW, bufferW, &sz ); + lstrcpyW(bufferW, L"boo"); + r = MsiGetPropertyW(hpkg, L"boo", bufferW, &sz ); ok(r == ERROR_MORE_DATA, "got %u\n", r); ok(!bufferW[0], "got %s\n", wine_dbgstr_w(bufferW)); ok(sz == 3, "got size %u\n", sz); sz = 3; - lstrcpyW(bufferW, booW); - r = MsiGetPropertyW(hpkg, booW, bufferW, &sz ); + lstrcpyW(bufferW, L"boo"); + r = MsiGetPropertyW(hpkg, L"boo", bufferW, &sz ); ok(r == ERROR_MORE_DATA, "got %u\n", r); - ok(!lstrcmpW(bufferW, xyW), "got %s\n", wine_dbgstr_w(bufferW)); + ok(!lstrcmpW(bufferW, L"xy"), "got %s\n", wine_dbgstr_w(bufferW)); ok(sz == 3, "got size %u\n", sz); sz = 4; - lstrcpyW(bufferW, booW); - r = MsiGetPropertyW(hpkg, booW, bufferW, &sz ); + lstrcpyW(bufferW, L"boo"); + r = MsiGetPropertyW(hpkg, L"boo", bufferW, &sz ); ok(!r, "got %u\n", r); - ok(!lstrcmpW(bufferW, xyzW), "got %s\n", wine_dbgstr_w(bufferW)); + ok(!lstrcmpW(bufferW, L"xyz"), "got %s\n", wine_dbgstr_w(bufferW)); ok(sz == 3, "got size %u\n", sz); /* properties are case-sensitive */ @@ -3074,12 +3064,9 @@ static void test_states(void) static const char msifile2[] = "winetest2-package.msi"; static const char msifile3[] = "winetest3-package.msi"; static const char msifile4[] = "winetest4-package.msi"; - static const WCHAR msifile2W[] = - {'w','i','n','e','t','e','s','t','2','-','p','a','c','k','a','g','e','.','m','s','i',0}; - static const WCHAR msifile3W[] = - {'w','i','n','e','t','e','s','t','3','-','p','a','c','k','a','g','e','.','m','s','i',0}; - static const WCHAR msifile4W[] = - {'w','i','n','e','t','e','s','t','4','-','p','a','c','k','a','g','e','.','m','s','i',0}; + static const WCHAR msifile2W[] = L"winetest2-package.msi"; + static const WCHAR msifile3W[] = L"winetest3-package.msi"; + static const WCHAR msifile4W[] = L"winetest4-package.msi"; char msi_cache_file[MAX_PATH]; DWORD cache_file_name_len; INSTALLSTATE state; @@ -4011,7 +3998,7 @@ static void test_removefiles(void) ok( action == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", action ); ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n"); - ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n"); + ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n"); ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n"); ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n"); ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n"); @@ -7959,11 +7946,6 @@ static void test_emptypackage(void) static void test_MsiGetProductProperty(void) { - static const WCHAR prodcode_propW[] = {'P','r','o','d','u','c','t','C','o','d','e',0}; - static const WCHAR nonexistentW[] = {'I','D','o','n','t','E','x','i','s','t',0}; - static const WCHAR newpropW[] = {'N','e','w','P','r','o','p','e','r','t','y',0}; - static const WCHAR appleW[] = {'a','p','p','l','e',0}; - static const WCHAR emptyW[] = {0}; WCHAR valW[MAX_PATH]; MSIHANDLE hprod, hdb; CHAR val[MAX_PATH]; @@ -8069,11 +8051,11 @@ static void test_MsiGetProductProperty(void) ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); size = MAX_PATH; - lstrcpyW(valW, appleW); - r = MsiGetProductPropertyW(0xdeadbeef, prodcode_propW, valW, &size); + lstrcpyW(valW, L"apple"); + r = MsiGetProductPropertyW(0xdeadbeef, L"ProductCode", valW, &size); ok(r == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", r); - ok(!lstrcmpW(valW, appleW), + ok(!lstrcmpW(valW, L"apple"), "Expected val to be unchanged, got %s\n", wine_dbgstr_w(valW)); ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); @@ -8088,11 +8070,11 @@ static void test_MsiGetProductProperty(void) ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); size = MAX_PATH; - lstrcpyW(valW, appleW); + lstrcpyW(valW, L"apple"); r = MsiGetProductPropertyW(hprod, NULL, valW, &size); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpW(valW, appleW), + ok(!lstrcmpW(valW, L"apple"), "Expected val to be unchanged, got %s\n", wine_dbgstr_w(valW)); ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); @@ -8105,8 +8087,8 @@ static void test_MsiGetProductProperty(void) ok(size == 0, "Expected 0, got %d\n", size); size = MAX_PATH; - lstrcpyW(valW, appleW); - r = MsiGetProductPropertyW(hprod, emptyW, valW, &size); + lstrcpyW(valW, L"apple"); + r = MsiGetProductPropertyW(hprod, L"", valW, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(*valW == 0, "Expected \"\", got %s\n", wine_dbgstr_w(valW)); ok(size == 0, "Expected 0, got %d\n", size); @@ -8122,8 +8104,8 @@ static void test_MsiGetProductProperty(void) "Expected %d, got %d\n", lstrlenA(prodcode), size); size = MAX_PATH; - lstrcpyW(valW, appleW); - r = MsiGetProductPropertyW(hprod, prodcode_propW, valW, &size); + lstrcpyW(valW, L"apple"); + r = MsiGetProductPropertyW(hprod, L"ProductCode", valW, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpW(valW, prodcodeW), "Expected %s, got %s\n", wine_dbgstr_w(prodcodeW), wine_dbgstr_w(valW)); @@ -8138,7 +8120,7 @@ static void test_MsiGetProductProperty(void) "Expected %d, got %d\n", lstrlenA(prodcode), size); size = MAX_PATH; - r = MsiGetProductPropertyW(hprod, prodcode_propW, NULL, &size); + r = MsiGetProductPropertyW(hprod, L"ProductCode", NULL, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(size == lstrlenW(prodcodeW), "Expected %d, got %d\n", lstrlenW(prodcodeW), size); @@ -8153,11 +8135,11 @@ static void test_MsiGetProductProperty(void) ok(size == lstrlenA(prodcode), "Expected %d, got %d\n", lstrlenA(prodcode), size); - lstrcpyW(valW, appleW); - r = MsiGetProductPropertyW(hprod, prodcode_propW, valW, NULL); + lstrcpyW(valW, L"apple"); + r = MsiGetProductPropertyW(hprod, L"ProductCode", valW, NULL); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - ok(!lstrcmpW(valW, appleW), + ok(!lstrcmpW(valW, L"apple"), "Expected val to be unchanged, got %s\n", wine_dbgstr_w(valW)); ok(size == lstrlenW(prodcodeW), "Expected %d, got %d\n", lstrlenW(prodcodeW), size); @@ -8173,8 +8155,8 @@ static void test_MsiGetProductProperty(void) "Expected %d, got %d\n", lstrlenA(prodcode), size); size = 4; - lstrcpyW(valW, appleW); - r = MsiGetProductPropertyW(hprod, prodcode_propW, valW, &size); + lstrcpyW(valW, L"apple"); + r = MsiGetProductPropertyW(hprod, L"ProductCode", valW, &size); ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); ok(!memcmp(valW, prodcodeW, 3 * sizeof(WCHAR)), "Expected first 3 chars of %s, got %s\n", wine_dbgstr_w(prodcodeW), wine_dbgstr_w(valW)); @@ -8192,8 +8174,8 @@ static void test_MsiGetProductProperty(void) "Expected %d, got %d\n", lstrlenA(prodcode), size); size = lstrlenW(prodcodeW); - lstrcpyW(valW, appleW); - r = MsiGetProductPropertyW(hprod, prodcode_propW, valW, &size); + lstrcpyW(valW, L"apple"); + r = MsiGetProductPropertyW(hprod, L"ProductCode", valW, &size); ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); ok(!memcmp(valW, prodcodeW, lstrlenW(prodcodeW) - 1), "Expected first 37 chars of %s, got %s\n", wine_dbgstr_w(prodcodeW), wine_dbgstr_w(valW)); @@ -8211,8 +8193,8 @@ static void test_MsiGetProductProperty(void) "Expected %d, got %d\n", lstrlenA(prodcode), size); size = lstrlenW(prodcodeW) + 1; - lstrcpyW(valW, appleW); - r = MsiGetProductPropertyW(hprod, prodcode_propW, valW, &size); + lstrcpyW(valW, L"apple"); + r = MsiGetProductPropertyW(hprod, L"ProductCode", valW, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpW(valW, prodcodeW), "Expected %s, got %s\n", wine_dbgstr_w(prodcodeW), wine_dbgstr_w(valW)); @@ -8228,10 +8210,10 @@ static void test_MsiGetProductProperty(void) ok(size == 0, "Expected 0, got %d\n", size); size = MAX_PATH; - lstrcpyW(valW, appleW); - r = MsiGetProductPropertyW(hprod, nonexistentW, valW, &size); + lstrcpyW(valW, L"apple"); + r = MsiGetProductPropertyW(hprod, L"IDontExist", valW, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpW(valW, emptyW), "Expected \"\", got %s\n", wine_dbgstr_w(valW)); + ok(!lstrcmpW(valW, L""), "Expected \"\", got %s\n", wine_dbgstr_w(valW)); ok(size == 0, "Expected 0, got %d\n", size); r = MsiSetPropertyA(hprod, "NewProperty", "value"); @@ -8246,10 +8228,10 @@ static void test_MsiGetProductProperty(void) ok(size == 0, "Expected 0, got %d\n", size); size = MAX_PATH; - lstrcpyW(valW, appleW); - r = MsiGetProductPropertyW(hprod, newpropW, valW, &size); + lstrcpyW(valW, L"apple"); + r = MsiGetProductPropertyW(hprod, L"NewProperty", valW, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpW(valW, emptyW), "Expected \"\", got %s\n", wine_dbgstr_w(valW)); + ok(!lstrcmpW(valW, L""), "Expected \"\", got %s\n", wine_dbgstr_w(valW)); ok(size == 0, "Expected 0, got %d\n", size); r = MsiSetPropertyA(hprod, "ProductCode", "value"); @@ -8266,8 +8248,8 @@ static void test_MsiGetProductProperty(void) "Expected %d, got %d\n", lstrlenA(prodcode), size); size = MAX_PATH; - lstrcpyW(valW, appleW); - r = MsiGetProductPropertyW(hprod, prodcode_propW, valW, &size); + lstrcpyW(valW, L"apple"); + r = MsiGetProductPropertyW(hprod, L"ProductCode", valW, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpW(valW, prodcodeW), "Expected %s, got %s\n", wine_dbgstr_w(prodcodeW), wine_dbgstr_w(valW)); diff --git a/modules/rostests/winetests/msi/patch.c b/modules/rostests/winetests/msi/patch.c index 87f64d6c835..65b3a5f1d48 100644 --- a/modules/rostests/winetests/msi/patch.c +++ b/modules/rostests/winetests/msi/patch.c @@ -39,10 +39,8 @@ static UINT (WINAPI *pMsiEnumPatchesExA)( LPCSTR, LPCSTR, DWORD, DWORD, DWORD, L static const char *msifile = "winetest-patch.msi"; static const char *mspfile = "winetest-patch.msp"; -static const WCHAR msifileW[] = - {'w','i','n','e','t','e','s','t','-','p','a','t','c','h','.','m','s','i',0}; -static const WCHAR mspfileW[] = - {'w','i','n','e','t','e','s','t','-','p','a','t','c','h','.','m','s','p',0}; +static const WCHAR msifileW[] = L"winetest-patch.msi"; +static const WCHAR mspfileW[] = L"winetest-patch.msp"; static char CURR_DIR[MAX_PATH]; static char PROG_FILES_DIR[MAX_PATH]; @@ -1001,14 +999,11 @@ static UINT find_entry( MSIHANDLE hdb, const char *table, const char *entry ) static UINT find_entryW( MSIHANDLE hdb, const WCHAR *table, const WCHAR *entry ) { - static const WCHAR fmt[] = - {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','%','s','`',' ', - 'W','H','E','R','E',' ','`','N','a','m','e','`',' ','=',' ','\'','%','s','\'',0}; WCHAR query[0x100]; MSIHANDLE hview, hrec; UINT r; - wsprintfW( query, fmt, table, entry ); + wsprintfW( query, L"SELECT * FROM `%s` WHERE `Name` = '%s'", table, entry ); r = MsiDatabaseOpenViewW( hdb, query, &hview ); ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r ); @@ -1086,8 +1081,6 @@ static char *get_string( MSIHANDLE hdb, UINT field, const char *query) static void test_system_tables( void ) { static const char patchsource[] = "MSPSRC0F96CDC04CDF4304B2837B9264889EF7"; - static const WCHAR streamsW[] = {'_','S','t','r','e','a','m','s',0}; - static const WCHAR CAB_msitest_encodedW[] = {0x3a8c,0x47cb,0x45b0,0x45ec,0x45a8,0x4837,0}; UINT r; char *cr; const char *query; @@ -1193,7 +1186,7 @@ static void test_system_tables( void ) r = find_entry( hdb, "_Streams", "\5SummaryInformation" ); ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r ); - r = find_entryW( hdb, streamsW, CAB_msitest_encodedW ); + r = find_entryW( hdb, L"_Streams", L"\x3a8c\x47cb\x45b0\x45ec\x45a8\x4837" ); ok( r == ERROR_NO_MORE_ITEMS, "failed to find entry %u\n", r ); query = "SELECT * FROM `_Storages`"; diff --git a/modules/rostests/winetests/msi/record.c b/modules/rostests/winetests/msi/record.c index d0ad15b8fef..8e4c2df4294 100644 --- a/modules/rostests/winetests/msi/record.c +++ b/modules/rostests/winetests/msi/record.c @@ -25,8 +25,7 @@ #include "wine/test.h" static const char *msifile = "winetest-record.msi"; -static const WCHAR msifileW[] = - {'w','i','n','e','t','e','s','t','-','r','e','c','o','r','d','.','m','s','i',0}; +static const WCHAR msifileW[] = L"winetest-record.msi"; static BOOL create_temp_file(char *name) { @@ -34,7 +33,7 @@ static BOOL create_temp_file(char *name) unsigned char buffer[26], i; DWORD sz; HANDLE handle; - + r = GetTempFileNameA(".", "msitest",0,name); if(!r) return r; @@ -338,7 +337,7 @@ static void test_msirecord(void) ok(r == ERROR_SUCCESS, "Failed to close handle\n"); /* now try streams in a new record - need to create a file to play with */ - r = create_temp_file(filename); + r = create_temp_file(filename); if(!r) return; diff --git a/modules/rostests/winetests/msi/suminfo.c b/modules/rostests/winetests/msi/suminfo.c index 8c2e292ab8f..1ef18310206 100644 --- a/modules/rostests/winetests/msi/suminfo.c +++ b/modules/rostests/winetests/msi/suminfo.c @@ -64,8 +64,7 @@ #define PID_MSIRESTRICT PID_CHARCOUNT static const char *msifile = "winetest-suminfo.msi"; -static const WCHAR msifileW[] = { - 'w','i','n','e','t','e','s','t','-','s','u','m','i','n','f','o','.','m','s','i',0 }; +static const WCHAR msifileW[] = L"winetest-suminfo.msi"; static void test_suminfo(void) {
2 years, 9 months
1
0
0
0
[reactos] 309/360: [WINESYNC] msi: Use wide character string literals in the remaining files.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=74f53b4bcbff9c2b7ec52…
commit 74f53b4bcbff9c2b7ec52aa2296ad5b87017cb36 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 21:31:42 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:35 2022 +0100 [WINESYNC] msi: Use wide character string literals in the remaining files. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id c4fc91f4bf0ffdc4a7dc2e582e5bd3fddca85222 by Hans Leidekker <hans(a)codeweavers.com> --- dll/win32/msi/appsearch.c | 101 +++++++----------------- dll/win32/msi/assembly.c | 100 +++++++----------------- dll/win32/msi/automation.c | 20 ++--- dll/win32/msi/cond.y | 75 +++++++++--------- dll/win32/msi/custom.c | 97 ++++++++--------------- dll/win32/msi/database.c | 187 ++++++++++++++------------------------------- dll/win32/msi/delete.c | 2 +- dll/win32/msi/distinct.c | 2 +- dll/win32/msi/files.c | 51 +++++-------- dll/win32/msi/font.c | 43 +++-------- dll/win32/msi/format.c | 7 +- dll/win32/msi/install.c | 41 +++++----- dll/win32/msi/media.c | 23 ++---- dll/win32/msi/msi.c | 8 +- dll/win32/msi/msipriv.h | 105 ------------------------- dll/win32/msi/msiquery.c | 22 ++---- dll/win32/msi/patch.c | 107 ++++++++------------------ dll/win32/msi/record.c | 5 +- dll/win32/msi/registry.c | 4 +- dll/win32/msi/script.c | 12 +-- dll/win32/msi/select.c | 8 +- dll/win32/msi/source.c | 72 ++++++++--------- dll/win32/msi/sql.y | 3 +- dll/win32/msi/storages.c | 6 +- dll/win32/msi/streams.c | 8 +- dll/win32/msi/string.c | 18 ++--- dll/win32/msi/suminfo.c | 29 ++++--- dll/win32/msi/table.c | 111 ++++++++++++--------------- dll/win32/msi/upgrade.c | 19 ++--- dll/win32/msi/where.c | 2 +- 30 files changed, 422 insertions(+), 866 deletions(-) diff --git a/dll/win32/msi/appsearch.c b/dll/win32/msi/appsearch.c index dd58ccad702..abd3c9d3fd9 100644 --- a/dll/win32/msi/appsearch.c +++ b/dll/win32/msi/appsearch.c @@ -82,13 +82,7 @@ void msi_parse_version_string(LPCWSTR verStr, PDWORD ms, PDWORD ls) */ static UINT get_signature( MSIPACKAGE *package, MSISIGNATURE *sig, const WCHAR *name ) { - static const WCHAR query[] = { - 's','e','l','e','c','t',' ','*',' ', - 'f','r','o','m',' ', - 'S','i','g','n','a','t','u','r','e',' ', - 'w','h','e','r','e',' ','S','i','g','n','a','t','u','r','e',' ','=',' ', - '\'','%','s','\'',0}; - LPWSTR minVersion, maxVersion, p; + WCHAR *minVersion, *maxVersion, *p; MSIRECORD *row; DWORD time; @@ -96,7 +90,7 @@ static UINT get_signature( MSIPACKAGE *package, MSISIGNATURE *sig, const WCHAR * memset(sig, 0, sizeof(*sig)); sig->Name = name; - row = MSI_QueryGetRecord( package->db, query, name ); + row = MSI_QueryGetRecord( package->db, L"SELECT * FROM `Signature` WHERE `Signature` = '%s'", name ); if (!row) { TRACE("failed to query signature for %s\n", debugstr_w(name)); @@ -195,7 +189,7 @@ static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path, MSISIGNATURE *sig ) if (!size) goto done; - if (!VerQueryValueW(buffer, szBackSlash, (LPVOID)&info, &size) || !info) + if (!VerQueryValueW(buffer, L"\\", (LPVOID)&info, &size) || !info) goto done; if (sig->MinVersionLS || sig->MinVersionMS) @@ -227,17 +221,6 @@ done: static UINT search_components( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ', - 'F','R','O','M',' ', - '`','C','o','m','p','L','o','c','a','t','o','r','`',' ', - 'W','H','E','R','E',' ','`','S','i','g','n','a','t','u','r','e','_','`',' ','=',' ', - '\'','%','s','\'',0}; - static const WCHAR sigquery[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','S','i','g','n','a','t','u','r','e','`',' ', - 'W','H','E','R','E',' ','`','S','i','g','n','a','t','u','r','e','`',' ','=',' ', - '\'','%','s','\'',0}; MSIRECORD *row, *rec; LPCWSTR signature, guid; BOOL sigpresent = TRUE; @@ -252,7 +235,7 @@ static UINT search_components( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATU *appValue = NULL; - row = MSI_QueryGetRecord(package->db, query, sig->Name); + row = MSI_QueryGetRecord(package->db, L"SELECT * FROM `CompLocator` WHERE `Signature_` = '%s'", sig->Name); if (!row) { TRACE("failed to query CompLocator for %s\n", debugstr_w(sig->Name)); @@ -263,7 +246,7 @@ static UINT search_components( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATU guid = MSI_RecordGetString(row, 2); type = MSI_RecordGetInteger(row, 3); - rec = MSI_QueryGetRecord(package->db, sigquery, signature); + rec = MSI_QueryGetRecord(package->db, L"SELECT * FROM `Signature` WHERE `Signature` = '%s'", signature); if (!rec) sigpresent = FALSE; @@ -312,9 +295,6 @@ done: static void convert_reg_value( DWORD regType, const BYTE *value, DWORD sz, WCHAR **appValue ) { - static const WCHAR dwordFmt[] = { '#','%','d','\0' }; - static const WCHAR binPre[] = { '#','x','\0' }; - static const WCHAR binFmt[] = { '%','0','2','X','\0' }; LPWSTR ptr; DWORD i; @@ -339,7 +319,7 @@ static void convert_reg_value( DWORD regType, const BYTE *value, DWORD sz, WCHAR * char if needed */ *appValue = msi_alloc(10 * sizeof(WCHAR)); - swprintf(*appValue, 10, dwordFmt, *(const DWORD *)value); + swprintf(*appValue, 10, L"#%d", *(const DWORD *)value); break; case REG_EXPAND_SZ: sz = ExpandEnvironmentStringsW((LPCWSTR)value, NULL, 0); @@ -349,10 +329,10 @@ static void convert_reg_value( DWORD regType, const BYTE *value, DWORD sz, WCHAR case REG_BINARY: /* #x<nibbles>\0 */ *appValue = msi_alloc((sz * 2 + 3) * sizeof(WCHAR)); - lstrcpyW(*appValue, binPre); - ptr = *appValue + lstrlenW(binPre); + lstrcpyW(*appValue, L"#x"); + ptr = *appValue + lstrlenW(L"#x"); for (i = 0; i < sz; i++, ptr += 2) - swprintf(ptr, 3, binFmt, value[i]); + swprintf(ptr, 3, L"%02X", value[i]); break; default: WARN("unimplemented for values of type %d\n", regType); @@ -364,10 +344,6 @@ static UINT search_directory( MSIPACKAGE *, MSISIGNATURE *, const WCHAR *, int, static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'R','e','g','L','o','c','a','t','o','r',' ','W','H','E','R','E',' ', - 'S','i','g','n','a','t','u','r','e','_',' ','=',' ', '\'','%','s','\'',0}; const WCHAR *keyPath, *valueName; WCHAR *deformatted = NULL, *ptr = NULL, *end; int root, type; @@ -382,7 +358,7 @@ static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig *appValue = NULL; - row = MSI_QueryGetRecord( package->db, query, sig->Name ); + row = MSI_QueryGetRecord( package->db, L"SELECT * FROM `RegLocator` WHERE `Signature_` = '%s'", sig->Name ); if (!row) { TRACE("failed to query RegLocator for %s\n", debugstr_w(sig->Name)); @@ -519,12 +495,6 @@ static LPWSTR get_ini_field(LPWSTR buf, int field) static UINT search_ini( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig ) { - static const WCHAR query[] = { - 's','e','l','e','c','t',' ','*',' ', - 'f','r','o','m',' ', - 'I','n','i','L','o','c','a','t','o','r',' ', - 'w','h','e','r','e',' ', - 'S','i','g','n','a','t','u','r','e','_',' ','=',' ','\'','%','s','\'',0}; MSIRECORD *row; LPWSTR fileName, section, key; int field, type; @@ -534,7 +504,7 @@ static UINT search_ini( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig *appValue = NULL; - row = MSI_QueryGetRecord( package->db, query, sig->Name ); + row = MSI_QueryGetRecord( package->db, L"SELECT * FROM `IniLocator` WHERE `Signature_` = '%s'", sig->Name ); if (!row) { TRACE("failed to query IniLocator for %s\n", debugstr_w(sig->Name)); @@ -657,7 +627,7 @@ static BOOL match_languages( const void *version, const WCHAR *languages ) LANGID *ids; if (!languages || !languages[0]) return TRUE; - if (!VerQueryValueW( version, szLangResource, (void **)&lang, &len )) return FALSE; + if (!VerQueryValueW( version, L"\\VarFileInfo\\Translation", (void **)&lang, &len )) return FALSE; if (!(ids = parse_languages( languages, &num_ids ))) return FALSE; for (i = 0; i < num_ids; i++) @@ -694,7 +664,7 @@ static UINT file_version_matches( MSIPACKAGE *package, const MSISIGNATURE *sig, if (!(version = msi_alloc( size ))) return ERROR_OUTOFMEMORY; if (msi_get_file_version_info( package, filePath, size, version )) - VerQueryValueW( version, szBackSlash, (void **)&info, &len ); + VerQueryValueW( version, L"\\", (void **)&info, &len ); if (info) { @@ -788,7 +758,6 @@ static UINT file_matches_sig( MSIPACKAGE *package, const MSISIGNATURE *sig, cons static UINT recurse_search_directory( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig, const WCHAR *dir, int depth ) { - static const WCHAR starDotStarW[] = { '*','.','*',0 }; HANDLE hFind; WIN32_FIND_DATAW findData; UINT rc = ERROR_SUCCESS; @@ -807,7 +776,7 @@ static UINT recurse_search_directory( MSIPACKAGE *package, WCHAR **appValue, MSI * here. Add two because we might need to add a backslash if the dir name * isn't backslash-terminated. */ - len = dirLen + max(fileLen, lstrlenW(starDotStarW)) + 2; + len = dirLen + max(fileLen, lstrlenW(L"*.*")) + 2; buf = msi_alloc(len * sizeof(WCHAR)); if (!buf) return ERROR_OUTOFMEMORY; @@ -837,14 +806,14 @@ static UINT recurse_search_directory( MSIPACKAGE *package, WCHAR **appValue, MSI { lstrcpyW(buf, dir); PathAddBackslashW(buf); - lstrcatW(buf, starDotStarW); + lstrcatW(buf, L"*.*"); hFind = msi_find_first_file( package, buf, &findData ); if (hFind != INVALID_HANDLE_VALUE) { if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY && - wcscmp( findData.cFileName, szDot ) && - wcscmp( findData.cFileName, szDotDot )) + wcscmp( findData.cFileName, L"." ) && + wcscmp( findData.cFileName, L".." )) { lstrcpyW(subpath, dir); PathAppendW(subpath, findData.cFileName); @@ -853,8 +822,8 @@ static UINT recurse_search_directory( MSIPACKAGE *package, WCHAR **appValue, MSI while (rc == ERROR_SUCCESS && !*appValue && msi_find_next_file( package, hFind, &findData )) { - if (!wcscmp( findData.cFileName, szDot ) || - !wcscmp( findData.cFileName, szDotDot )) + if (!wcscmp( findData.cFileName, L"." ) || + !wcscmp( findData.cFileName, L".." )) continue; lstrcpyW(subpath, dir); @@ -966,12 +935,6 @@ static UINT search_sig_name( MSIPACKAGE *, const WCHAR *, MSISIGNATURE *, WCHAR static UINT search_dr( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig ) { - static const WCHAR query[] = { - 's','e','l','e','c','t',' ','*',' ', - 'f','r','o','m',' ', - 'D','r','L','o','c','a','t','o','r',' ', - 'w','h','e','r','e',' ', - 'S','i','g','n','a','t','u','r','e','_',' ','=',' ', '\'','%','s','\'',0}; LPWSTR parent = NULL; LPCWSTR parentName; WCHAR path[MAX_PATH]; @@ -985,7 +948,7 @@ static UINT search_dr( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig *appValue = NULL; - row = MSI_QueryGetRecord( package->db, query, sig->Name ); + row = MSI_QueryGetRecord( package->db, L"SELECT * FROM `DrLocator` WHERE `Signature_` = '%s'", sig->Name ); if (!row) { TRACE("failed to query DrLocator for %s\n", debugstr_w(sig->Name)); @@ -1087,7 +1050,7 @@ static UINT ITERATE_AppSearch(MSIRECORD *row, LPVOID param) if (value) { r = msi_set_property( package->db, propName, value, -1 ); - if (r == ERROR_SUCCESS && !wcscmp( propName, szSourceDir )) + if (r == ERROR_SUCCESS && !wcscmp( propName, L"SourceDir" )) msi_reset_source_folders( package ); msi_free(value); @@ -1105,21 +1068,18 @@ static UINT ITERATE_AppSearch(MSIRECORD *row, LPVOID param) UINT ACTION_AppSearch(MSIPACKAGE *package) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'A','p','p','S','e','a','r','c','h',0}; MSIQUERY *view; UINT r; - if (msi_action_is_unique(package, szAppSearch)) + if (msi_action_is_unique(package, L"AppSearch")) { TRACE("Skipping AppSearch action: already done in UI sequence\n"); return ERROR_SUCCESS; } else - msi_register_unique_action(package, szAppSearch); + msi_register_unique_action(package, L"AppSearch"); - r = MSI_OpenQuery( package->db, &view, query ); + r = MSI_OpenQuery( package->db, &view, L"SELECT * FROM `AppSearch`" ); if (r != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -1136,8 +1096,6 @@ static UINT ITERATE_CCPSearch(MSIRECORD *row, LPVOID param) MSISIGNATURE sig; UINT r = ERROR_SUCCESS; - static const WCHAR success[] = {'C','C','P','_','S','u','c','c','e','s','s',0}; - signature = MSI_RecordGetString(row, 1); TRACE("%s\n", debugstr_w(signature)); @@ -1146,7 +1104,7 @@ static UINT ITERATE_CCPSearch(MSIRECORD *row, LPVOID param) if (value) { TRACE("Found signature %s\n", debugstr_w(signature)); - msi_set_property( package->db, success, szOne, -1 ); + msi_set_property( package->db, L"CCP_Success", L"1", -1 ); msi_free(value); r = ERROR_NO_MORE_ITEMS; } @@ -1157,21 +1115,18 @@ static UINT ITERATE_CCPSearch(MSIRECORD *row, LPVOID param) UINT ACTION_CCPSearch(MSIPACKAGE *package) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'C','C','P','S','e','a','r','c','h',0}; MSIQUERY *view; UINT r; - if (msi_action_is_unique(package, szCCPSearch)) + if (msi_action_is_unique(package, L"CCPSearch")) { TRACE("Skipping AppSearch action: already done in UI sequence\n"); return ERROR_SUCCESS; } else - msi_register_unique_action(package, szCCPSearch); + msi_register_unique_action(package, L"CCPSearch"); - r = MSI_OpenQuery(package->db, &view, query); + r = MSI_OpenQuery(package->db, &view, L"SELECT * FROM `CCPSearch`"); if (r != ERROR_SUCCESS) return ERROR_SUCCESS; diff --git a/dll/win32/msi/assembly.c b/dll/win32/msi/assembly.c index bd694333d2a..1007979827a 100644 --- a/dll/win32/msi/assembly.c +++ b/dll/win32/msi/assembly.c @@ -32,17 +32,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); static BOOL load_fusion_dlls( MSIPACKAGE *package ) { - static const WCHAR szFusion[] = {'f','u','s','i','o','n','.','d','l','l',0}; - static const WCHAR szMscoree[] = {'\\','m','s','c','o','r','e','e','.','d','l','l',0}; - static const WCHAR szVersion10[] = {'v','1','.','0','.','3','7','0','5',0}; - static const WCHAR szVersion11[] = {'v','1','.','1','.','4','3','2','2',0}; - static const WCHAR szVersion20[] = {'v','2','.','0','.','5','0','7','2','7',0}; - static const WCHAR szVersion40[] = {'v','4','.','0','.','3','0','3','1','9',0}; HRESULT (WINAPI *pLoadLibraryShim)( const WCHAR *, const WCHAR *, void *, HMODULE * ); WCHAR path[MAX_PATH]; DWORD len = GetSystemDirectoryW( path, MAX_PATH ); - lstrcpyW( path + len, szMscoree ); + lstrcpyW( path + len, L"\\mscoree.dll" ); if (package->hmscoree || !(package->hmscoree = LoadLibraryW( path ))) return TRUE; if (!(pLoadLibraryShim = (void *)GetProcAddress( package->hmscoree, "LoadLibraryShim" ))) { @@ -51,10 +45,10 @@ static BOOL load_fusion_dlls( MSIPACKAGE *package ) return TRUE; } - pLoadLibraryShim( szFusion, szVersion10, NULL, &package->hfusion10 ); - pLoadLibraryShim( szFusion, szVersion11, NULL, &package->hfusion11 ); - pLoadLibraryShim( szFusion, szVersion20, NULL, &package->hfusion20 ); - pLoadLibraryShim( szFusion, szVersion40, NULL, &package->hfusion40 ); + pLoadLibraryShim( L"fusion.dll", L"v1.0.3705", NULL, &package->hfusion10 ); + pLoadLibraryShim( L"fusion.dll", L"v1.1.4322", NULL, &package->hfusion11 ); + pLoadLibraryShim( L"fusion.dll", L"v2.0.50727", NULL, &package->hfusion20 ); + pLoadLibraryShim( L"fusion.dll", L"v4.0.30319", NULL, &package->hfusion40 ); return TRUE; } @@ -129,16 +123,11 @@ void msi_destroy_assembly_caches( MSIPACKAGE *package ) static MSIRECORD *get_assembly_record( MSIPACKAGE *package, const WCHAR *comp ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','M','s','i','A','s','s','e','m','b','l','y','`',' ', - 'W','H','E','R','E',' ','`','C','o','m','p','o','n','e','n','t','_','`', - ' ','=',' ','\'','%','s','\'',0}; MSIQUERY *view; MSIRECORD *rec; UINT r; - r = MSI_OpenQuery( package->db, &view, query, comp ); + r = MSI_OpenQuery( package->db, &view, L"SELECT * FROM `MsiAssembly` WHERE `Component_` = '%s'", comp ); if (r != ERROR_SUCCESS) return NULL; @@ -170,36 +159,28 @@ struct assembly_name static UINT get_assembly_name_attribute( MSIRECORD *rec, LPVOID param ) { - static const WCHAR fmtW[] = {'%','s','=','"','%','s','"',0}; - static const WCHAR nameW[] = {'n','a','m','e',0}; struct assembly_name *name = param; const WCHAR *attr = MSI_RecordGetString( rec, 2 ); const WCHAR *value = MSI_RecordGetString( rec, 3 ); - int len = lstrlenW( fmtW ) + lstrlenW( attr ) + lstrlenW( value ); + int len = lstrlenW( L"%s=\"%s\"" ) + lstrlenW( attr ) + lstrlenW( value ); if (!(name->attrs[name->index] = msi_alloc( len * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY; - if (!wcsicmp( attr, nameW )) lstrcpyW( name->attrs[name->index++], value ); - else swprintf( name->attrs[name->index++], len, fmtW, attr, value ); + if (!wcsicmp( attr, L"name" )) lstrcpyW( name->attrs[name->index++], value ); + else swprintf( name->attrs[name->index++], len, L"%s=\"%s\"", attr, value ); return ERROR_SUCCESS; } static WCHAR *get_assembly_display_name( MSIDATABASE *db, const WCHAR *comp, MSIASSEMBLY *assembly ) { - static const WCHAR commaW[] = {',',0}; - static const WCHAR queryW[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','M','s','i','A','s','s','e','m','b','l','y','N','a','m','e','`',' ', - 'W','H','E','R','E',' ','`','C','o','m','p','o','n','e','n','t','_','`', - ' ','=',' ','\'','%','s','\'',0}; struct assembly_name name; WCHAR *display_name = NULL; MSIQUERY *view; UINT i, r; int len; - r = MSI_OpenQuery( db, &view, queryW, comp ); + r = MSI_OpenQuery( db, &view, L"SELECT * FROM `MsiAssemblyName` WHERE `Component_` = '%s'", comp ); if (r != ERROR_SUCCESS) return NULL; @@ -224,7 +205,7 @@ static WCHAR *get_assembly_display_name( MSIDATABASE *db, const WCHAR *comp, MSI for (i = 0; i < name.count; i++) { lstrcatW( display_name, name.attrs[i] ); - if (i < name.count - 1) lstrcatW( display_name, commaW ); + if (i < name.count - 1) lstrcatW( display_name, L"," ); } } @@ -320,23 +301,17 @@ IAssemblyEnum *msi_create_assembly_enum( MSIPACKAGE *package, const WCHAR *displ return ret; } -static const WCHAR clr_version_v10[] = {'v','1','.','0','.','3','7','0','5',0}; -static const WCHAR clr_version_v11[] = {'v','1','.','1','.','4','3','2','2',0}; -static const WCHAR clr_version_v20[] = {'v','2','.','0','.','5','0','7','2','7',0}; -static const WCHAR clr_version_v40[] = {'v','4','.','0','.','3','0','3','1','9',0}; -static const WCHAR clr_version_unknown[] = {'u','n','k','n','o','w','n',0}; - static const WCHAR *clr_version[] = { - clr_version_v10, - clr_version_v11, - clr_version_v20, - clr_version_v40 + L"v1.0.3705", + L"v1.2.4322", + L"v2.0.50727", + L"v4.0.30319" }; static const WCHAR *get_clr_version_str( enum clr_version version ) { - if (version >= ARRAY_SIZE( clr_version )) return clr_version_unknown; + if (version >= ARRAY_SIZE( clr_version )) return L"unknown"; return clr_version[version]; } @@ -539,30 +514,20 @@ static WCHAR *build_local_assembly_path( const WCHAR *filename ) static LONG open_assemblies_key( UINT context, BOOL win32, HKEY *hkey ) { - static const WCHAR path_win32[] = - {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'I','n','s','t','a','l','l','e','r','\\','W','i','n','3','2','A','s','s','e','m','b','l','i','e','s','\\',0}; - static const WCHAR path_dotnet[] = - {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'I','n','s','t','a','l','l','e','r','\\','A','s','s','e','m','b','l','i','e','s','\\',0}; - static const WCHAR classes_path_win32[] = - {'I','n','s','t','a','l','l','e','r','\\','W','i','n','3','2','A','s','s','e','m','b','l','i','e','s','\\',0}; - static const WCHAR classes_path_dotnet[] = - {'I','n','s','t','a','l','l','e','r','\\','A','s','s','e','m','b','l','i','e','s','\\',0}; HKEY root; const WCHAR *path; if (context == MSIINSTALLCONTEXT_MACHINE) { root = HKEY_CLASSES_ROOT; - if (win32) path = classes_path_win32; - else path = classes_path_dotnet; + if (win32) path = L"Installer\\Win32Assemblies\\"; + else path = L"Installer\\Assemblies\\"; } else { root = HKEY_CURRENT_USER; - if (win32) path = path_win32; - else path = path_dotnet; + if (win32) path = L"Software\\Microsoft\\Installer\\Win32Assemblies\\"; + else path = L"Software\\Microsoft\\Installer\\Assemblies\\"; } return RegCreateKeyW( root, path, hkey ); } @@ -609,33 +574,20 @@ static LONG delete_local_assembly_key( UINT context, BOOL win32, const WCHAR *fi static LONG open_global_assembly_key( UINT context, BOOL win32, HKEY *hkey ) { - static const WCHAR path_win32[] = - {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'I','n','s','t','a','l','l','e','r','\\','W','i','n','3','2','A','s','s','e','m','b','l','i','e','s','\\', - 'G','l','o','b','a','l',0}; - static const WCHAR path_dotnet[] = - {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'I','n','s','t','a','l','l','e','r','\\','A','s','s','e','m','b','l','i','e','s','\\', - 'G','l','o','b','a','l',0}; - static const WCHAR classes_path_win32[] = - {'I','n','s','t','a','l','l','e','r','\\','W','i','n','3','2','A','s','s','e','m','b','l','i','e','s','\\', - 'G','l','o','b','a','l',0}; - static const WCHAR classes_path_dotnet[] = - {'I','n','s','t','a','l','l','e','r','\\','A','s','s','e','m','b','l','i','e','s','\\','G','l','o','b','a','l',0}; HKEY root; const WCHAR *path; if (context == MSIINSTALLCONTEXT_MACHINE) { root = HKEY_CLASSES_ROOT; - if (win32) path = classes_path_win32; - else path = classes_path_dotnet; + if (win32) path = L"Installer\\Win32Assemblies\\Global"; + else path = L"Installer\\Assemblies\\Global"; } else { root = HKEY_CURRENT_USER; - if (win32) path = path_win32; - else path = path_dotnet; + if (win32) path = L"Software\\Microsoft\\Installer\\Win32Assemblies\\Global"; + else path = L"Software\\Microsoft\\Installer\\Assemblies\\Global"; } return RegCreateKeyW( root, path, hkey ); } @@ -645,7 +597,7 @@ UINT ACTION_MsiPublishAssemblies( MSIPACKAGE *package ) MSICOMPONENT *comp; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szMsiPublishAssemblies); + return msi_schedule_action(package, SCRIPT_INSTALL, L"MsiPublishAssemblies"); LIST_FOR_EACH_ENTRY(comp, &package->components, MSICOMPONENT, entry) { @@ -718,7 +670,7 @@ UINT ACTION_MsiUnpublishAssemblies( MSIPACKAGE *package ) MSICOMPONENT *comp; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szMsiUnpublishAssemblies); + return msi_schedule_action(package, SCRIPT_INSTALL, L"MsiUnpublishAssemblies"); LIST_FOR_EACH_ENTRY(comp, &package->components, MSICOMPONENT, entry) { diff --git a/dll/win32/msi/automation.c b/dll/win32/msi/automation.c index 87c7815094a..dc38436e682 100644 --- a/dll/win32/msi/automation.c +++ b/dll/win32/msi/automation.c @@ -95,8 +95,7 @@ HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo) hr = LoadRegTypeLib(&LIBID_WindowsInstaller, 1, 0, LOCALE_NEUTRAL, &lib); if (FAILED(hr)) { - static const WCHAR msiserverW[] = {'m','s','i','s','e','r','v','e','r','.','t','l','b',0}; - hr = LoadTypeLib(msiserverW, &lib); + hr = LoadTypeLib(L"msiserver.tlb", &lib); if (FAILED(hr)) { ERR("Could not load msiserver.tlb\n"); return hr; @@ -376,8 +375,6 @@ static HRESULT WINAPI AutomationObject_Invoke( else if (pExcepInfo && (hr == DISP_E_PARAMNOTFOUND || hr == DISP_E_EXCEPTION)) { - static const WCHAR szComma[] = { ',',0 }; - static const WCHAR szExceptionSource[] = {'M','s','i',' ','A','P','I',' ','E','r','r','o','r',0}; WCHAR szExceptionDescription[MAX_PATH]; BSTR bstrParamNames[MAX_FUNC_PARAMS]; unsigned namesNo, i; @@ -395,7 +392,7 @@ static HRESULT WINAPI AutomationObject_Invoke( { if (bFirst) bFirst = FALSE; else { - lstrcpyW(&szExceptionDescription[lstrlenW(szExceptionDescription)], szComma); + lstrcpyW(&szExceptionDescription[lstrlenW(szExceptionDescription)], L","); } lstrcpyW(&szExceptionDescription[lstrlenW(szExceptionDescription)], bstrParamNames[i]); SysFreeString(bstrParamNames[i]); @@ -403,7 +400,7 @@ static HRESULT WINAPI AutomationObject_Invoke( memset(pExcepInfo, 0, sizeof(EXCEPINFO)); pExcepInfo->wCode = 1000; - pExcepInfo->bstrSource = SysAllocString(szExceptionSource); + pExcepInfo->bstrSource = SysAllocString(L"Msi API Error"); pExcepInfo->bstrDescription = SysAllocString(szExceptionDescription); hr = DISP_E_EXCEPTION; } @@ -1599,8 +1596,6 @@ static HRESULT session_invoke( * registry value type. Used by Installer::RegistryValue. */ static void variant_from_registry_value(VARIANT *pVarResult, DWORD dwType, LPBYTE lpData, DWORD dwSize) { - static const WCHAR szREG_BINARY[] = { '(','R','E','G','_','B','I','N','A','R','Y',')',0 }; - static const WCHAR szREG_[] = { '(','R','E','G','_','?','?',')',0 }; WCHAR *szString = (WCHAR *)lpData; LPWSTR szNewString = NULL; DWORD dwNewSize = 0; @@ -1642,12 +1637,12 @@ static void variant_from_registry_value(VARIANT *pVarResult, DWORD dwType, LPBYT case REG_QWORD: V_VT(pVarResult) = VT_BSTR; - V_BSTR(pVarResult) = SysAllocString(szREG_); /* Weird string, don't know why native returns it */ + V_BSTR(pVarResult) = SysAllocString(L"(REG_\?\?)"); /* Weird string, don't know why native returns it */ break; case REG_BINARY: V_VT(pVarResult) = VT_BSTR; - V_BSTR(pVarResult) = SysAllocString(szREG_BINARY); + V_BSTR(pVarResult) = SysAllocString(L"(REG_BINARY)"); break; case REG_NONE: @@ -1950,9 +1945,6 @@ static HRESULT InstallerImpl_Version(WORD wFlags, DLLVERSIONINFO verinfo; WCHAR version[MAX_PATH]; - static const WCHAR format[] = { - '%','d','.','%','d','.','%','d','.','%','d',0}; - if (!(wFlags & DISPATCH_PROPERTYGET)) return DISP_E_MEMBERNOTFOUND; @@ -1961,7 +1953,7 @@ static HRESULT InstallerImpl_Version(WORD wFlags, if (FAILED(hr)) return hr; - swprintf(version, ARRAY_SIZE(version), format, verinfo.dwMajorVersion, verinfo.dwMinorVersion, + swprintf(version, ARRAY_SIZE(version), L"%d.%d.%d.%d", verinfo.dwMajorVersion, verinfo.dwMinorVersion, verinfo.dwBuildNumber, verinfo.dwPlatformID); V_VT(pVarResult) = VT_BSTR; diff --git a/dll/win32/msi/cond.y b/dll/win32/msi/cond.y index 3cf63ff8986..7bf3e3f831a 100644 --- a/dll/win32/msi/cond.y +++ b/dll/win32/msi/cond.y @@ -145,7 +145,7 @@ static void value_free( struct value val ) %% condition: - expression + expression { COND_input* cond = (COND_input*) info; cond->result = $1; @@ -158,7 +158,7 @@ condition: ; expression: - boolean_term + boolean_term { $$ = $1; } @@ -319,7 +319,7 @@ value: { COND_input* cond = (COND_input*) info; INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN; - + if(MSI_GetComponentStateW(cond->package, $2, &install, &action ) != ERROR_SUCCESS) { $$.type = VALUE_LITERAL; @@ -336,7 +336,7 @@ value: { COND_input* cond = (COND_input*) info; INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN; - + if(MSI_GetComponentStateW(cond->package, $2, &install, &action ) != ERROR_SUCCESS) { $$.type = VALUE_LITERAL; @@ -353,7 +353,7 @@ value: { COND_input* cond = (COND_input*) info; INSTALLSTATE install, action; - + if (MSI_GetFeatureStateW(cond->package, $2, &install, &action ) != ERROR_SUCCESS) { $$.type = VALUE_LITERAL; @@ -370,7 +370,7 @@ value: { COND_input* cond = (COND_input*) info; INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN; - + if(MSI_GetFeatureStateW(cond->package, $2, &install, &action ) != ERROR_SUCCESS) { $$.type = VALUE_LITERAL; @@ -502,8 +502,8 @@ static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b, BOOL convert ) return compare_substring( a, operator, b ); /* null and empty string are equivalent */ - if (!a) a = szEmpty; - if (!b) b = szEmpty; + if (!a) a = L""; + if (!b) b = L""; if (convert && str_is_number(a) && str_is_number(b)) return compare_int( wcstol(a, NULL, 10), operator, wcstol(b, NULL, 10) ); @@ -582,7 +582,7 @@ static INT compare_int( INT a, INT operator, INT b ) static int COND_IsIdent( WCHAR x ) { - return( COND_IsAlpha( x ) || COND_IsNumber( x ) || ( x == '_' ) + return( COND_IsAlpha( x ) || COND_IsNumber( x ) || ( x == '_' ) || ( x == '#' ) || (x == '.') ); } @@ -592,24 +592,24 @@ static int COND_GetOperator( COND_input *cond ) const WCHAR str[4]; int id; } table[] = { - { {'~','<','=',0}, COND_ILE }, - { {'~','>','<',0}, COND_ISS }, - { {'~','>','>',0}, COND_IRHS }, - { {'~','<','>',0}, COND_INE }, - { {'~','>','=',0}, COND_IGE }, - { {'~','<','<',0}, COND_ILHS }, - { {'~','=',0}, COND_IEQ }, - { {'~','<',0}, COND_ILT }, - { {'~','>',0}, COND_IGT }, - { {'>','=',0}, COND_GE }, - { {'>','<',0}, COND_SS }, - { {'<','<',0}, COND_LHS }, - { {'<','>',0}, COND_NE }, - { {'<','=',0}, COND_LE }, - { {'>','>',0}, COND_RHS }, - { {'>',0}, COND_GT }, - { {'<',0}, COND_LT }, - { {0}, 0 } + { L"~<=", COND_ILE }, + { L"~><", COND_ISS }, + { L"~>>", COND_IRHS }, + { L"~<>", COND_INE }, + { L"~>=", COND_IGE }, + { L"~<<", COND_ILHS }, + { L"~=", COND_IEQ }, + { L"~<", COND_ILT }, + { L"~>", COND_IGT }, + { L">=", COND_GE }, + { L"><", COND_SS }, + { L"<<", COND_LHS }, + { L"<>", COND_NE }, + { L"<=", COND_LE }, + { L">>", COND_RHS }, + { L">", COND_GT }, + { L"<", COND_LT }, + { L"", 0 } }; LPCWSTR p = &cond->str[cond->n]; int i = 0, len; @@ -673,31 +673,24 @@ static int COND_GetOne( struct cond_str *str, COND_input *cond ) } else if( COND_IsAlpha( ch ) ) { - static const WCHAR szNot[] = {'N','O','T',0}; - static const WCHAR szAnd[] = {'A','N','D',0}; - static const WCHAR szXor[] = {'X','O','R',0}; - static const WCHAR szEqv[] = {'E','Q','V',0}; - static const WCHAR szImp[] = {'I','M','P',0}; - static const WCHAR szOr[] = {'O','R',0}; - while( COND_IsIdent( str->data[len] ) ) len++; rc = COND_IDENT; if ( len == 3 ) { - if ( !wcsnicmp( str->data, szNot, len ) ) + if ( !wcsnicmp( str->data, L"NOT", len ) ) rc = COND_NOT; - else if( !wcsnicmp( str->data, szAnd, len ) ) + else if( !wcsnicmp( str->data, L"AND", len ) ) rc = COND_AND; - else if( !wcsnicmp( str->data, szXor, len ) ) + else if( !wcsnicmp( str->data, L"XOR", len ) ) rc = COND_XOR; - else if( !wcsnicmp( str->data, szEqv, len ) ) + else if( !wcsnicmp( str->data, L"EQV", len ) ) rc = COND_EQV; - else if( !wcsnicmp( str->data, szImp, len ) ) + else if( !wcsnicmp( str->data, L"IMP", len ) ) rc = COND_IMP; } - else if( (len == 2) && !wcsnicmp( str->data, szOr, len ) ) + else if( (len == 2) && !wcsnicmp( str->data, L"OR", len ) ) rc = COND_OR; } else if( COND_IsNumber( ch ) ) @@ -726,7 +719,7 @@ static int cond_lex( void *COND_lval, COND_input *cond ) do { rc = COND_GetOne( str, cond ); } while (rc == COND_SPACE); - + return rc; } diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c index 8753a60a279..9e9a13afa54 100644 --- a/dll/win32/msi/custom.c +++ b/dll/win32/msi/custom.c @@ -182,37 +182,32 @@ static LPWSTR msi_get_deferred_action(LPCWSTR action, LPCWSTR actiondata, LPWSTR deferred; DWORD len; - static const WCHAR format[] = { - '[','%','s','<','=','>','%','s','<','=','>','%','s',']','%','s',0 - }; - if (!actiondata) return strdupW(action); len = lstrlenW(action) + lstrlenW(actiondata) + lstrlenW(usersid) + lstrlenW(prodcode) + - lstrlenW(format) - 7; + lstrlenW(L"[%s<=>%s<=>%s]%s") - 7; deferred = msi_alloc(len * sizeof(WCHAR)); - swprintf(deferred, len, format, actiondata, usersid, prodcode, action); + swprintf(deferred, len, L"[%s<=>%s<=>%s]%s", actiondata, usersid, prodcode, action); return deferred; } static void set_deferred_action_props( MSIPACKAGE *package, const WCHAR *deferred_data ) { - static const WCHAR sep[] = {'<','=','>',0}; const WCHAR *end, *beg = deferred_data + 1; - end = wcsstr(beg, sep); - msi_set_property( package->db, szCustomActionData, beg, end - beg ); + end = wcsstr(beg, L"<=>"); + msi_set_property( package->db, L"CustomActionData", beg, end - beg ); beg = end + 3; - end = wcsstr(beg, sep); - msi_set_property( package->db, szUserSID, beg, end - beg ); + end = wcsstr(beg, L"<=>"); + msi_set_property( package->db, L"UserSID", beg, end - beg ); beg = end + 3; end = wcschr(beg, ']'); - msi_set_property( package->db, szProductCode, beg, end - beg ); + msi_set_property( package->db, L"ProductCode", beg, end - beg ); } WCHAR *msi_create_temp_file( MSIDATABASE *db ) @@ -224,7 +219,7 @@ WCHAR *msi_create_temp_file( MSIDATABASE *db ) WCHAR tmp[MAX_PATH]; UINT len = ARRAY_SIZE( tmp ); - if (msi_get_property( db, szTempFolder, tmp, &len ) || + if (msi_get_property( db, L"TempFolder", tmp, &len ) || GetFileAttributesW( tmp ) != FILE_ATTRIBUTE_DIRECTORY) { GetTempPathW( MAX_PATH, tmp ); @@ -234,7 +229,7 @@ WCHAR *msi_create_temp_file( MSIDATABASE *db ) if ((ret = msi_alloc( (lstrlenW( db->tempfolder ) + 20) * sizeof(WCHAR) ))) { - if (!GetTempFileNameW( db->tempfolder, szMsi, 0, ret )) + if (!GetTempFileNameW( db->tempfolder, L"msi", 0, ret )) { msi_free( ret ); return NULL; @@ -246,10 +241,6 @@ WCHAR *msi_create_temp_file( MSIDATABASE *db ) static MSIBINARY *create_temp_binary(MSIPACKAGE *package, LPCWSTR source) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','B','i' ,'n','a','r','y','`',' ','W','H','E','R','E',' ', - '`','N','a','m','e','`',' ','=',' ','\'','%','s','\'',0}; MSIRECORD *row; MSIBINARY *binary = NULL; HANDLE file; @@ -260,7 +251,7 @@ static MSIBINARY *create_temp_binary(MSIPACKAGE *package, LPCWSTR source) if (!(tmpfile = msi_create_temp_file( package->db ))) return NULL; - if (!(row = MSI_QueryGetRecord( package->db, query, source ))) goto error; + if (!(row = MSI_QueryGetRecord( package->db, L"SELECT * FROM `Binary` WHERE `Name` = '%s'", source ))) goto error; if (!(binary = msi_alloc_zero( sizeof(MSIBINARY) ))) goto error; file = CreateFileW( tmpfile, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); @@ -480,9 +471,6 @@ static void handle_msi_break(LPCSTR target) DebugBreak(); } -static WCHAR ncalrpcW[] = {'n','c','a','l','r','p','c',0}; -static WCHAR endpoint_fmtW[] = {'m','s','i','%','x',0}; - #if defined __i386__ && defined _MSC_VER __declspec(naked) UINT custom_proc_wrapper(MsiCustomActionEntryPoint entry, MSIHANDLE hinst) { @@ -539,8 +527,8 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid) { WCHAR endpoint[12]; - swprintf(endpoint, ARRAY_SIZE(endpoint), endpoint_fmtW, client_pid); - status = RpcStringBindingComposeW(NULL, ncalrpcW, NULL, endpoint, NULL, &binding_str); + swprintf(endpoint, ARRAY_SIZE(endpoint), L"msi%x", client_pid); + status = RpcStringBindingComposeW(NULL, (WCHAR *)L"ncalrpc", NULL, endpoint, NULL, &binding_str); if (status != RPC_S_OK) { ERR("RpcStringBindingCompose failed: %#x\n", status); @@ -609,10 +597,6 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid) static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch) { - static const WCHAR pipe_name[] = {'\\','\\','.','\\','p','i','p','e','\\','m','s','i','c','a','_','%','x','_','%','d',0}; - static const WCHAR msiexecW[] = {'\\','m','s','i','e','x','e','c','.','e','x','e',0}; - static const WCHAR argsW[] = {'%','s',' ','-','E','m','b','e','d','d','i','n','g',' ','%','d',0}; - WCHAR path[MAX_PATH], cmdline[MAX_PATH + 23]; PROCESS_INFORMATION pi = {0}; STARTUPINFOW si = {0}; @@ -625,7 +609,7 @@ static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch) (arch == SCS_64BIT_BINARY && package->custom_server_64_process)) return ERROR_SUCCESS; - swprintf(buffer, ARRAY_SIZE(buffer), pipe_name, + swprintf(buffer, ARRAY_SIZE(buffer), L"\\\\.\\pipe\\msica_%x_%d", GetCurrentProcessId(), arch == SCS_32BIT_BINARY ? 32 : 64); pipe = CreateNamedPipeW(buffer, PIPE_ACCESS_DUPLEX, 0, 1, sizeof(DWORD64), sizeof(GUID), 0, NULL); @@ -636,11 +620,11 @@ static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch) wow64 = FALSE; if ((sizeof(void *) == 8 || wow64) && arch == SCS_32BIT_BINARY) - GetSystemWow64DirectoryW(path, MAX_PATH - ARRAY_SIZE(msiexecW)); + GetSystemWow64DirectoryW(path, MAX_PATH - ARRAY_SIZE(L"\\msiexec.exe")); else - GetSystemDirectoryW(path, MAX_PATH - ARRAY_SIZE(msiexecW)); - lstrcatW(path, msiexecW); - swprintf(cmdline, ARRAY_SIZE(cmdline), argsW, path, GetCurrentProcessId()); + GetSystemDirectoryW(path, MAX_PATH - ARRAY_SIZE(L"\\msiexec.exe")); + lstrcatW(path, L"\\msiexec.exe"); + swprintf(cmdline, ARRAY_SIZE(cmdline), L"%s -Embedding %d", path, GetCurrentProcessId()); if (wow64 && arch == SCS_64BIT_BINARY) { @@ -765,8 +749,8 @@ static msi_custom_action_info *do_msidbCustomActionTypeDll( { WCHAR endpoint[12]; - swprintf(endpoint, ARRAY_SIZE(endpoint), endpoint_fmtW, GetCurrentProcessId()); - status = RpcServerUseProtseqEpW(ncalrpcW, RPC_C_PROTSEQ_MAX_REQS_DEFAULT, + swprintf(endpoint, ARRAY_SIZE(endpoint), L"msi%x", GetCurrentProcessId()); + status = RpcServerUseProtseqEpW((WCHAR *)L"ncalrpc", RPC_C_PROTSEQ_MAX_REQS_DEFAULT, endpoint, NULL); if (status != RPC_S_OK) { @@ -818,7 +802,6 @@ static UINT HANDLE_CustomType1( MSIPACKAGE *package, const WCHAR *source, const static HANDLE execute_command( const WCHAR *app, WCHAR *arg, const WCHAR *dir ) { - static const WCHAR dotexeW[] = {'.','e','x','e',0}; STARTUPINFOW si; PROCESS_INFORMATION info; WCHAR *exe = NULL, *cmd = NULL, *p; @@ -830,12 +813,12 @@ static HANDLE execute_command( const WCHAR *app, WCHAR *arg, const WCHAR *dir ) DWORD len_exe; if (!(exe = msi_alloc( MAX_PATH * sizeof(WCHAR) ))) return INVALID_HANDLE_VALUE; - len_exe = SearchPathW( NULL, app, dotexeW, MAX_PATH, exe, NULL ); + len_exe = SearchPathW( NULL, app, L".exe", MAX_PATH, exe, NULL ); if (len_exe >= MAX_PATH) { msi_free( exe ); if (!(exe = msi_alloc( len_exe * sizeof(WCHAR) ))) return INVALID_HANDLE_VALUE; - len_exe = SearchPathW( NULL, app, dotexeW, len_exe, exe, NULL ); + len_exe = SearchPathW( NULL, app, L".exe", len_exe, exe, NULL ); } if (!len_exe) { @@ -897,7 +880,7 @@ static UINT HANDLE_CustomType2( MSIPACKAGE *package, const WCHAR *source, const deformat_string( package, target, &arg ); TRACE("exe %s arg %s\n", debugstr_w(binary->tmpfile), debugstr_w(arg)); - handle = execute_command( binary->tmpfile, arg, szCRoot ); + handle = execute_command( binary->tmpfile, arg, L"C:\\" ); msi_free( arg ); if (handle == INVALID_HANDLE_VALUE) return ERROR_SUCCESS; return wait_process_handle( package, type, handle, action ); @@ -934,7 +917,7 @@ static UINT HANDLE_CustomType18( MSIPACKAGE *package, const WCHAR *source, const deformat_string( package, target, &arg ); TRACE("exe %s arg %s\n", debugstr_w(file->TargetPath), debugstr_w(arg)); - handle = execute_command( file->TargetPath, arg, szCRoot ); + handle = execute_command( file->TargetPath, arg, L"C:\\" ); msi_free( arg ); if (handle == INVALID_HANDLE_VALUE) return ERROR_SUCCESS; return wait_process_handle( package, type, handle, action ); @@ -943,19 +926,13 @@ static UINT HANDLE_CustomType18( MSIPACKAGE *package, const WCHAR *source, const static UINT HANDLE_CustomType19( MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','`','M','e','s','s','a','g','e','`',' ', - 'F','R','O','M',' ','`','E','r','r','o','r','`',' ', - 'W','H','E','R','E',' ','`','E','r','r','o','r','`',' ','=',' ', - '%','s',0 - }; MSIRECORD *row = 0; LPWSTR deformated = NULL; deformat_string( package, target, &deformated ); /* first try treat the error as a number */ - row = MSI_QueryGetRecord( package->db, query, deformated ); + row = MSI_QueryGetRecord( package->db, L"SELECT `Message` FROM `Error` WHERE `Error` = '%s'", deformated ); if( row ) { LPCWSTR error = MSI_RecordGetString( row, 1 ); @@ -995,7 +972,7 @@ static UINT HANDLE_CustomType23( MSIPACKAGE *package, const WCHAR *source, const UINT len_dir, len_source = lstrlenW( source ); HANDLE handle; - if (!(dir = msi_dup_property( package->db, szOriginalDatabase ))) return ERROR_OUTOFMEMORY; + if (!(dir = msi_dup_property( package->db, L"OriginalDatabase" ))) return ERROR_OUTOFMEMORY; if (!(p = wcsrchr( dir, '\\' )) && !(p = wcsrchr( dir, '/' ))) { msi_free( dir ); @@ -1112,7 +1089,7 @@ static UINT HANDLE_CustomType50( MSIPACKAGE *package, const WCHAR *source, const deformat_string( package, target, &arg ); TRACE("exe %s arg %s\n", debugstr_w(exe), debugstr_w(arg)); - handle = execute_command( exe, arg, szCRoot ); + handle = execute_command( exe, arg, L"C:\\" ); msi_free( exe ); msi_free( arg ); if (handle == INVALID_HANDLE_VALUE) return ERROR_SUCCESS; @@ -1230,10 +1207,6 @@ static UINT HANDLE_CustomType37_38( MSIPACKAGE *package, const WCHAR *source, co static UINT HANDLE_CustomType5_6( MSIPACKAGE *package, const WCHAR *source, const WCHAR *target, INT type, const WCHAR *action ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','B','i' ,'n','a','r','y','`',' ','W','H','E','R','E',' ', - '`','N','a','m','e','`',' ','=',' ','\'','%','s','\'',0}; MSIRECORD *row = NULL; msi_custom_action_info *info; CHAR *buffer = NULL; @@ -1243,7 +1216,7 @@ static UINT HANDLE_CustomType5_6( MSIPACKAGE *package, const WCHAR *source, cons TRACE("%s %s\n", debugstr_w(source), debugstr_w(target)); - row = MSI_QueryGetRecord(package->db, query, source); + row = MSI_QueryGetRecord(package->db, L"SELECT * FROM `Binary` WHERE `Name` = '%s'", source); if (!row) return ERROR_FUNCTION_FAILED; @@ -1375,8 +1348,8 @@ static BOOL action_type_matches_script( UINT type, UINT script ) static UINT defer_custom_action( MSIPACKAGE *package, const WCHAR *action, UINT type ) { WCHAR *actiondata = msi_dup_property( package->db, action ); - WCHAR *usersid = msi_dup_property( package->db, szUserSID ); - WCHAR *prodcode = msi_dup_property( package->db, szProductCode ); + WCHAR *usersid = msi_dup_property( package->db, L"UserSID" ); + WCHAR *prodcode = msi_dup_property( package->db, L"ProductCode" ); WCHAR *deferred = msi_get_deferred_action( action, actiondata, usersid, prodcode ); if (!deferred) @@ -1411,10 +1384,6 @@ static UINT defer_custom_action( MSIPACKAGE *package, const WCHAR *action, UINT UINT ACTION_CustomAction(MSIPACKAGE *package, const WCHAR *action) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','C','u','s','t','o','m','A','c','t','i','o','n','`',' ','W','H','E','R','E',' ', - '`','A','c','t','i' ,'o','n','`',' ','=',' ','\'','%','s','\'',0}; UINT rc = ERROR_SUCCESS; MSIRECORD *row; UINT type; @@ -1429,7 +1398,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, const WCHAR *action) action = ptr + 1; } - row = MSI_QueryGetRecord( package->db, query, action ); + row = MSI_QueryGetRecord( package->db, L"SELECT * FROM `CustomAction` WHERE `Action` = '%s'", action ); if (!row) return ERROR_FUNCTION_NOT_CALLED; @@ -1470,9 +1439,9 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, const WCHAR *action) if (deferred_data) set_deferred_action_props(package, deferred_data); else if (actiondata) - msi_set_property( package->db, szCustomActionData, actiondata, -1 ); + msi_set_property( package->db, L"CustomActionData", actiondata, -1 ); else - msi_set_property( package->db, szCustomActionData, szEmpty, -1 ); + msi_set_property( package->db, L"CustomActionData", L"", -1 ); msi_free(actiondata); } @@ -1537,7 +1506,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, const WCHAR *action) if (!source) break; len = deformat_string( package, target, &deformated ); rc = msi_set_property( package->db, source, deformated, len ); - if (rc == ERROR_SUCCESS && !wcscmp( source, szSourceDir )) msi_reset_source_folders( package ); + if (rc == ERROR_SUCCESS && !wcscmp( source, L"SourceDir" )) msi_reset_source_folders( package ); msi_free( deformated ); break; case 53: /* JScript/VBScript text specified by a property value */ diff --git a/dll/win32/msi/database.c b/dll/win32/msi/database.c index f7c70aeead7..c84fd1f6440 100644 --- a/dll/win32/msi/database.c +++ b/dll/win32/msi/database.c @@ -103,7 +103,6 @@ static VOID MSI_CloseDatabase( MSIOBJECTHDR *arg ) static HRESULT db_initialize( IStorage *stg, const GUID *clsid ) { - static const WCHAR szTables[] = { '_','T','a','b','l','e','s',0 }; HRESULT hr; hr = IStorage_SetClass( stg, clsid ); @@ -114,7 +113,7 @@ static HRESULT db_initialize( IStorage *stg, const GUID *clsid ) } /* create the _Tables stream */ - hr = write_stream_data( stg, szTables, NULL, 0, TRUE ); + hr = write_stream_data( stg, L"_Tables", NULL, 0, TRUE ); if (FAILED( hr )) { WARN("failed to create _Tables stream 0x%08x\n", hr); @@ -257,7 +256,7 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb) if (!wcschr( save_path, '\\' )) { GetCurrentDirectoryW( MAX_PATH, path ); - lstrcatW( path, szBackSlash ); + lstrcatW( path, L"\\" ); lstrcatW( path, save_path ); } else @@ -452,14 +451,12 @@ static LPWSTR msi_build_createsql_prelude(LPWSTR table) LPWSTR prelude; DWORD size; - static const WCHAR create_fmt[] = {'C','R','E','A','T','E',' ','T','A','B','L','E',' ','`','%','s','`',' ','(',' ',0}; - - size = ARRAY_SIZE(create_fmt) + lstrlenW(table) - 2; + size = ARRAY_SIZE(L"CREATE TABLE `%s` ( ") + lstrlenW(table) - 2; prelude = msi_alloc(size * sizeof(WCHAR)); if (!prelude) return NULL; - swprintf(prelude, size, create_fmt, table); + swprintf(prelude, size, L"CREATE TABLE `%s` ( ", table); return prelude; } @@ -471,15 +468,6 @@ static LPWSTR msi_build_createsql_columns(LPWSTR *columns_data, LPWSTR *types, D WCHAR expanded[128], *ptr; WCHAR size[10], comma[2], extra[30]; - static const WCHAR column_fmt[] = {'`','%','s','`',' ','%','s','%','s','%','s','%','s',' ',0}; - static const WCHAR size_fmt[] = {'(','%','s',')',0}; - static const WCHAR type_char[] = {'C','H','A','R',0}; - static const WCHAR type_int[] = {'I','N','T',0}; - static const WCHAR type_long[] = {'L','O','N','G',0}; - static const WCHAR type_object[] = {'O','B','J','E','C','T',0}; - static const WCHAR type_notnull[] = {' ','N','O','T',' ','N','U','L','L',0}; - static const WCHAR localizable[] = {' ','L','O','C','A','L','I','Z','A','B','L','E',0}; - columns = msi_alloc_zero(sql_size * sizeof(WCHAR)); if (!columns) return NULL; @@ -501,28 +489,28 @@ static LPWSTR msi_build_createsql_columns(LPWSTR *columns_data, LPWSTR *types, D switch (types[i][0]) { case 'l': - lstrcpyW(extra, type_notnull); + lstrcpyW(extra, L" NOT NULL"); /* fall through */ case 'L': - lstrcatW(extra, localizable); - type = type_char; - swprintf(size, ARRAY_SIZE(size), size_fmt, ptr); + lstrcatW(extra, L" LOCALIZABLE"); + type = L"CHAR"; + swprintf(size, ARRAY_SIZE(size), L"(%s)", ptr); break; case 's': - lstrcpyW(extra, type_notnull); + lstrcpyW(extra, L" NOT NULL"); /* fall through */ case 'S': - type = type_char; - swprintf(size, ARRAY_SIZE(size), size_fmt, ptr); + type = L"CHAR"; + swprintf(size, ARRAY_SIZE(size), L"(%s)", ptr); break; case 'i': - lstrcpyW(extra, type_notnull); + lstrcpyW(extra, L" NOT NULL"); /* fall through */ case 'I': if (len <= 2) - type = type_int; + type = L"INT"; else if (len == 4) - type = type_long; + type = L"LONG"; else { WARN("invalid int width %u\n", len); @@ -531,10 +519,10 @@ static LPWSTR msi_build_createsql_columns(LPWSTR *columns_data, LPWSTR *types, D } break; case 'v': - lstrcpyW(extra, type_notnull); + lstrcpyW(extra, L" NOT NULL"); /* fall through */ case 'V': - type = type_object; + type = L"OBJECT"; break; default: ERR("Unknown type: %c\n", types[i][0]); @@ -542,7 +530,7 @@ static LPWSTR msi_build_createsql_columns(LPWSTR *columns_data, LPWSTR *types, D return NULL; } - swprintf(expanded, ARRAY_SIZE(expanded), column_fmt, columns_data[i], type, size, extra, comma); + swprintf(expanded, ARRAY_SIZE(expanded), L"`%s` %s%s%s%s ", columns_data[i], type, size, extra, comma); sql_size += lstrlenW(expanded); p = msi_realloc(columns, sql_size * sizeof(WCHAR)); @@ -564,11 +552,8 @@ static LPWSTR msi_build_createsql_postlude(LPWSTR *primary_keys, DWORD num_keys) LPWSTR postlude, keys, ptr; DWORD size, i; - static const WCHAR key_fmt[] = {'`','%','s','`',',',' ',0}; - static const WCHAR postlude_fmt[] = {'P','R','I','M','A','R','Y',' ','K','E','Y',' ','%','s',')',0}; - for (i = 0, size = 1; i < num_keys; i++) - size += lstrlenW(key_fmt) + lstrlenW(primary_keys[i]) - 2; + size += lstrlenW(L"`%s`, ") + lstrlenW(primary_keys[i]) - 2; keys = msi_alloc(size * sizeof(WCHAR)); if (!keys) @@ -576,18 +561,18 @@ static LPWSTR msi_build_createsql_postlude(LPWSTR *primary_keys, DWORD num_keys) for (i = 0, ptr = keys; i < num_keys; i++) { - ptr += swprintf(ptr, size - (ptr - keys), key_fmt, primary_keys[i]); + ptr += swprintf(ptr, size - (ptr - keys), L"`%s`, ", primary_keys[i]); } /* remove final ', ' */ *(ptr - 2) = '\0'; - size = lstrlenW(postlude_fmt) + size - 1; + size = lstrlenW(L"PRIMARY KEY %s)") + size - 1; postlude = msi_alloc(size * sizeof(WCHAR)); if (!postlude) goto done; - swprintf(postlude, size, postlude_fmt, keys); + swprintf(postlude, size, L"PRIMARY KEY %s)", keys); done: msi_free(keys); @@ -712,12 +697,7 @@ static UINT msi_add_records_to_table(MSIDATABASE *db, LPWSTR *columns, LPWSTR *t MSIQUERY *view; MSIRECORD *rec; - static const WCHAR select[] = { - 'S','E','L','E','C','T',' ','*',' ', - 'F','R','O','M',' ','`','%','s','`',0 - }; - - r = MSI_OpenQuery(db, &view, select, labels[0]); + r = MSI_OpenQuery(db, &view, L"SELECT * FROM `%s`", labels[0]); if (r != ERROR_SUCCESS) return r; @@ -753,31 +733,21 @@ done: static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file) { UINT r; - DWORD len, i; - DWORD num_labels, num_types; - DWORD num_columns, num_records = 0; - LPWSTR *columns, *types, *labels; - LPWSTR path, ptr, data; - LPWSTR **records = NULL; - LPWSTR **temp_records; - - static const WCHAR suminfo[] = - {'_','S','u','m','m','a','r','y','I','n','f','o','r','m','a','t','i','o','n',0}; - static const WCHAR forcecodepage[] = - {'_','F','o','r','c','e','C','o','d','e','p','a','g','e',0}; + DWORD len, i, num_labels, num_types, num_columns, num_records = 0; + WCHAR **columns, **types, **labels, *path, *ptr, *data, ***records = NULL, ***temp_records; TRACE("%p %s %s\n", db, debugstr_w(folder), debugstr_w(file) ); - if( folder == NULL || file == NULL ) + if (!folder || !file) return ERROR_INVALID_PARAMETER; - len = lstrlenW(folder) + lstrlenW(szBackSlash) + lstrlenW(file) + 1; + len = lstrlenW(folder) + lstrlenW(L"\\") + lstrlenW(file) + 1; path = msi_alloc( len * sizeof(WCHAR) ); if (!path) return ERROR_OUTOFMEMORY; lstrcpyW( path, folder ); - lstrcatW( path, szBackSlash ); + lstrcatW( path, L"\\" ); lstrcatW( path, file ); data = msi_read_text_archive( path, &len ); @@ -793,7 +763,7 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file) msi_parse_line( &ptr, &labels, &num_labels, &len ); if (num_columns == 1 && !columns[0][0] && num_labels == 1 && !labels[0][0] && - num_types == 2 && !wcscmp( types[1], forcecodepage )) + num_types == 2 && !wcscmp( types[1], L"_ForceCodepage" )) { r = msi_set_string_table_codepage( db->strings, wcstol( types[0], NULL, 10 ) ); goto done; @@ -805,7 +775,7 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file) goto done; } - records = msi_alloc(sizeof(LPWSTR *)); + records = msi_alloc(sizeof(WCHAR **)); if (!records) { r = ERROR_OUTOFMEMORY; @@ -818,7 +788,7 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file) msi_parse_line( &ptr, &records[num_records], NULL, &len ); num_records++; - temp_records = msi_realloc(records, (num_records + 1) * sizeof(LPWSTR *)); + temp_records = msi_realloc(records, (num_records + 1) * sizeof(WCHAR **)); if (!temp_records) { r = ERROR_OUTOFMEMORY; @@ -827,7 +797,7 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file) records = temp_records; } - if (!wcscmp(labels[0], suminfo)) + if (!wcscmp(labels[0], L"_SummaryInformation")) { r = msi_add_suminfo( db, records, num_records, num_columns ); if (r != ERROR_SUCCESS) @@ -862,7 +832,6 @@ done: msi_free(records[i]); msi_free(records); - return r; } @@ -957,7 +926,6 @@ static UINT msi_export_field( HANDLE handle, MSIRECORD *row, UINT field ) static UINT msi_export_stream( const WCHAR *folder, const WCHAR *table, MSIRECORD *row, UINT field, UINT start ) { - static const WCHAR fmt[] = {'%','s','\\','%','s',0}; WCHAR stream[MAX_STREAM_NAME_LEN + 1], *path; DWORD sz, read_size, write_size; char buffer[1024]; @@ -969,11 +937,11 @@ static UINT msi_export_stream( const WCHAR *folder, const WCHAR *table, MSIRECOR if (r != ERROR_SUCCESS) return r; - len = sz + lstrlenW( folder ) + lstrlenW( table ) + ARRAY_SIZE( fmt ) + 1; + len = sz + lstrlenW( folder ) + lstrlenW( table ) + ARRAY_SIZE( L"%s\\%s" ) + 1; if (!(path = msi_alloc( len * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY; - len = swprintf( path, len, fmt, folder, table ); + len = swprintf( path, len, L"%s\\%s", folder, table ); if (!CreateDirectoryW( path, NULL ) && GetLastError() != ERROR_ALREADY_EXISTS) { msi_free( path ); @@ -1078,22 +1046,16 @@ static UINT msi_export_summaryinformation( MSIDATABASE *db, HANDLE handle ) static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, LPCWSTR folder, LPCWSTR file ) { - static const WCHAR query[] = { - 's','e','l','e','c','t',' ','*',' ','f','r','o','m',' ','%','s',0 }; - static const WCHAR forcecodepage[] = { - '_','F','o','r','c','e','C','o','d','e','p','a','g','e',0 }; - static const WCHAR summaryinformation[] = { - '_','S','u','m','m','a','r','y','I','n','f','o','r','m','a','t','i','o','n',0 }; MSIRECORD *rec = NULL; MSIQUERY *view = NULL; - LPWSTR filename; + WCHAR *filename; HANDLE handle; UINT len, r; TRACE("%p %s %s %s\n", db, debugstr_w(table), debugstr_w(folder), debugstr_w(file) ); - if( folder == NULL || file == NULL ) + if (!folder || !file) return ERROR_INVALID_PARAMETER; len = lstrlenW(folder) + lstrlenW(file) + 2; @@ -1102,7 +1064,7 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, LPCWSTR folder, return ERROR_OUTOFMEMORY; lstrcpyW( filename, folder ); - lstrcatW( filename, szBackSlash ); + lstrcatW( filename, L"\\" ); lstrcatW( filename, file ); handle = CreateFileW( filename, GENERIC_READ | GENERIC_WRITE, 0, @@ -1111,20 +1073,20 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, LPCWSTR folder, if (handle == INVALID_HANDLE_VALUE) return ERROR_FUNCTION_FAILED; - if (!wcscmp( table, forcecodepage )) + if (!wcscmp( table, L"_ForceCodepage" )) { UINT codepage = msi_get_string_table_codepage( db->strings ); r = msi_export_forcecodepage( handle, codepage ); goto done; } - if (!wcscmp( table, summaryinformation )) + if (!wcscmp( table, L"_SummaryInformation" )) { r = msi_export_summaryinformation( db, handle ); goto done; } - r = MSI_OpenQuery( db, &view, query, table ); + r = MSI_OpenQuery( db, &view, L"SELECT * FROM %s", table ); if (r == ERROR_SUCCESS) { struct row_export_info row_export_info = { handle, folder, table }; @@ -1424,20 +1386,19 @@ static LPWSTR get_key_value(MSIQUERY *view, LPCWSTR key, MSIRECORD *rec) if (MSI_RecordGetString(rec, i)) /* check record field is a string */ { /* quote string record fields */ - static const WCHAR szQuote[] = {'\'', 0}; sz += 2; - val = msi_alloc(sz*sizeof(WCHAR)); + val = msi_alloc(sz * sizeof(WCHAR)); if (!val) return NULL; - lstrcpyW(val, szQuote); - r = MSI_RecordGetStringW(rec, i, val+1, &sz); - lstrcpyW(val+1+sz, szQuote); + lstrcpyW(val, L"'"); + r = MSI_RecordGetStringW(rec, i, val + 1, &sz); + lstrcpyW(val + 1 + sz, L"'"); } else { /* do not quote integer record fields */ - val = msi_alloc(sz*sizeof(WCHAR)); + val = msi_alloc(sz * sizeof(WCHAR)); if (!val) return NULL; @@ -1463,14 +1424,6 @@ static LPWSTR create_diff_row_query(MSIDATABASE *merge, MSIQUERY *view, MSIRECORD *keys; UINT r, i, count; - static const WCHAR keyset[] = { - '`','%','s','`',' ','=',' ','%','s',' ','A','N','D',' ',0}; - static const WCHAR lastkeyset[] = { - '`','%','s','`',' ','=',' ','%','s',' ',0}; - static const WCHAR fmt[] = {'S','E','L','E','C','T',' ','*',' ', - 'F','R','O','M',' ','`','%','s','`',' ', - 'W','H','E','R','E',' ','%','s',0}; - r = MSI_DatabaseGetPrimaryKeys(merge, table, &keys); if (r != ERROR_SUCCESS) return NULL; @@ -1487,9 +1440,9 @@ static LPWSTR create_diff_row_query(MSIDATABASE *merge, MSIQUERY *view, val = get_key_value(view, key, rec); if (i == count) - setptr = lastkeyset; + setptr = L"`%s` = %s "; else - setptr = keyset; + setptr = L"`%s` = %s AND "; oldsize = size; size += lstrlenW(setptr) + lstrlenW(key) + lstrlenW(val) - 4; @@ -1504,12 +1457,12 @@ static LPWSTR create_diff_row_query(MSIDATABASE *merge, MSIQUERY *view, msi_free(val); } - size = lstrlenW(fmt) + lstrlenW(table) + lstrlenW(clause) + 1; + size = lstrlenW(L"SELECT * FROM `%s` WHERE %s") + lstrlenW(table) + lstrlenW(clause) + 1; query = msi_alloc(size * sizeof(WCHAR)); if (!query) goto done; - swprintf(query, size, fmt, table, clause); + swprintf(query, size, L"SELECT * FROM `%s` WHERE %s", table, clause); done: msi_free(clause); @@ -1717,9 +1670,6 @@ static UINT msi_get_merge_table (MSIDATABASE *db, LPCWSTR name, MERGETABLE **pta MERGETABLE *table; MSIQUERY *mergeview = NULL; - static const WCHAR query[] = {'S','E','L','E','C','T',' ','*',' ', - 'F','R','O','M',' ','`','%','s','`',0}; - table = msi_alloc_zero(sizeof(MERGETABLE)); if (!table) { @@ -1731,7 +1681,7 @@ static UINT msi_get_merge_table (MSIDATABASE *db, LPCWSTR name, MERGETABLE **pta if (r != ERROR_SUCCESS) goto err; - r = MSI_OpenQuery(db, &mergeview, query, name); + r = MSI_OpenQuery(db, &mergeview, L"SELECT * FROM `%s`", name); if (r != ERROR_SUCCESS) goto err; @@ -1768,18 +1718,15 @@ static UINT merge_diff_tables(MSIRECORD *rec, LPVOID param) LPCWSTR name; UINT r; - static const WCHAR query[] = {'S','E','L','E','C','T',' ','*',' ', - 'F','R','O','M',' ','`','%','s','`',0}; - name = MSI_RecordGetString(rec, 1); - r = MSI_OpenQuery(data->merge, &mergeview, query, name); + r = MSI_OpenQuery(data->merge, &mergeview, L"SELECT * FROM `%s`", name); if (r != ERROR_SUCCESS) goto done; if (TABLE_Exists(data->db, name)) { - r = MSI_OpenQuery(data->db, &dbview, query, name); + r = MSI_OpenQuery(data->db, &dbview, L"SELECT * FROM `%s`", name); if (r != ERROR_SUCCESS) goto done; @@ -1816,14 +1763,11 @@ done: static UINT gather_merge_data(MSIDATABASE *db, MSIDATABASE *merge, struct list *tabledata) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','_','T','a','b','l','e','s','`',0}; MSIQUERY *view; MERGEDATA data; UINT r; - r = MSI_DatabaseOpenViewW(merge, query, &view); + r = MSI_DatabaseOpenViewW(merge, L"SELECT * FROM `_Tables`", &view); if (r != ERROR_SUCCESS) return r; @@ -1871,24 +1815,10 @@ static UINT update_merge_errors(MSIDATABASE *db, LPCWSTR error, UINT r; MSIQUERY *view; - static const WCHAR create[] = { - 'C','R','E','A','T','E',' ','T','A','B','L','E',' ', - '`','%','s','`',' ','(','`','T','a','b','l','e','`',' ', - 'C','H','A','R','(','2','5','5',')',' ','N','O','T',' ', - 'N','U','L','L',',',' ','`','N','u','m','R','o','w','M','e','r','g','e', - 'C','o','n','f','l','i','c','t','s','`',' ','S','H','O','R','T',' ', - 'N','O','T',' ','N','U','L','L',' ','P','R','I','M','A','R','Y',' ', - 'K','E','Y',' ','`','T','a','b','l','e','`',')',0}; - static const WCHAR insert[] = { - 'I','N','S','E','R','T',' ','I','N','T','O',' ', - '`','%','s','`',' ','(','`','T','a','b','l','e','`',',',' ', - '`','N','u','m','R','o','w','M','e','r','g','e', - 'C','o','n','f','l','i','c','t','s','`',')',' ','V','A','L','U','E','S', - ' ','(','\'','%','s','\'',',',' ','%','d',')',0}; - if (!TABLE_Exists(db, error)) { - r = MSI_OpenQuery(db, &view, create, error); + r = MSI_OpenQuery(db, &view, L"CREATE TABLE `%s` (`Table` CHAR(255) NOT NULL, `NumRowMergeConflicts` SHORT " + "NOT NULL PRIMARY KEY `Table`)" , error); if (r != ERROR_SUCCESS) return r; @@ -1898,7 +1828,8 @@ static UINT update_merge_errors(MSIDATABASE *db, LPCWSTR error, return r; } - r = MSI_OpenQuery(db, &view, insert, error, table, numconflicts); + r = MSI_OpenQuery(db, &view, L"INSERT INTO `%s` (`Table`, `NumRowMergeConflicts`) VALUES ('%s', %d)", error, + table, numconflicts); if (r != ERROR_SUCCESS) return r; @@ -1907,8 +1838,7 @@ static UINT update_merge_errors(MSIDATABASE *db, LPCWSTR error, return r; } -UINT WINAPI MsiDatabaseMergeW(MSIHANDLE hDatabase, MSIHANDLE hDatabaseMerge, - LPCWSTR szTableName) +UINT WINAPI MsiDatabaseMergeW(MSIHANDLE hDatabase, MSIHANDLE hDatabaseMerge, LPCWSTR szTableName) { struct list tabledata = LIST_INIT(tabledata); struct list *item, *cursor; @@ -1917,8 +1847,7 @@ UINT WINAPI MsiDatabaseMergeW(MSIHANDLE hDatabase, MSIHANDLE hDatabaseMerge, BOOL conflicts; UINT r; - TRACE("(%d, %d, %s)\n", hDatabase, hDatabaseMerge, - debugstr_w(szTableName)); + TRACE("(%d, %d, %s)\n", hDatabase, hDatabaseMerge, debugstr_w(szTableName)); if (szTableName && !*szTableName) return ERROR_INVALID_TABLE; diff --git a/dll/win32/msi/delete.c b/dll/win32/msi/delete.c index 81bd9d7db2f..c101b56c231 100644 --- a/dll/win32/msi/delete.c +++ b/dll/win32/msi/delete.c @@ -196,7 +196,7 @@ UINT DELETE_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) dv = msi_alloc_zero( sizeof *dv ); if( !dv ) return ERROR_FUNCTION_FAILED; - + /* fill the structure */ dv->view.ops = &delete_ops; dv->db = db; diff --git a/dll/win32/msi/distinct.c b/dll/win32/msi/distinct.c index e102adb3de2..b97b8c90efc 100644 --- a/dll/win32/msi/distinct.c +++ b/dll/win32/msi/distinct.c @@ -287,7 +287,7 @@ UINT DISTINCT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) dv = msi_alloc_zero( sizeof *dv ); if( !dv ) return ERROR_FUNCTION_FAILED; - + /* fill the structure */ dv->view.ops = &distinct_ops; msiobj_addref( &db->hdr ); diff --git a/dll/win32/msi/files.c b/dll/win32/msi/files.c index aba714b317d..61694ee19ae 100644 --- a/dll/win32/msi/files.c +++ b/dll/win32/msi/files.c @@ -160,7 +160,6 @@ DWORD msi_get_file_version_info( MSIPACKAGE *package, const WCHAR *path, DWORD b VS_FIXEDFILEINFO *msi_get_disk_file_version( MSIPACKAGE *package, const WCHAR *filename ) { - static const WCHAR name[] = {'\\',0}; VS_FIXEDFILEINFO *ptr, *ret; DWORD version_size, size; void *version; @@ -170,7 +169,7 @@ VS_FIXEDFILEINFO *msi_get_disk_file_version( MSIPACKAGE *package, const WCHAR *f msi_get_file_version_info( package, filename, version_size, version ); - if (!VerQueryValueW( version, name, (void **)&ptr, &size )) + if (!VerQueryValueW( version, L"\\", (void **)&ptr, &size )) { msi_free( version ); return NULL; @@ -267,7 +266,7 @@ static BOOL is_obsoleted_by_patch( MSIPACKAGE *package, MSIFILE *file ) { if (!list_empty( &package->patches ) && file->disk_id < MSI_INITIAL_MEDIA_TRANSFORM_DISKID) { - if (!msi_get_property_int( package->db, szInstalled, 0 )) return FALSE; + if (!msi_get_property_int( package->db, L"Installed", 0 )) return FALSE; return TRUE; } if (is_registered_patch_media( package, file->disk_id )) return TRUE; @@ -442,7 +441,7 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source) msi_free( pathW ); return ERROR_OUTOFMEMORY; } - if (!GetTempFileNameW( pathW, szMsi, 0, tmpfileW )) tmpfileW[0] = 0; + if (!GetTempFileNameW( pathW, L"msi", 0, tmpfileW )) tmpfileW[0] = 0; msi_free( pathW ); if (msi_copy_file( package, source, tmpfileW, FALSE ) && @@ -548,7 +547,7 @@ WCHAR *msi_resolve_file_source( MSIPACKAGE *package, MSIFILE *file ) /* * ACTION_InstallFiles() - * + * * For efficiency, this is done in two passes: * 1) Correct all the TargetPaths and determine what files are to be installed. * 2) Extract Cabinets and copy files. @@ -562,7 +561,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package) msi_set_sourcedir_props(package, FALSE); if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szInstallFiles); + return msi_schedule_action(package, SCRIPT_INSTALL, L"InstallFiles"); schedule_install_files(package); mi = msi_alloc_zero( sizeof(MSIMEDIAINFO) ); @@ -571,7 +570,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package) { BOOL is_global_assembly = msi_is_global_assembly( file->Component ); - msi_file_update_ui( package, file, szInstallFiles ); + msi_file_update_ui( package, file, L"InstallFiles" ); rc = msi_load_media_info( package, file->Sequence, mi ); if (rc != ERROR_SUCCESS) @@ -583,7 +582,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package) if (file->state != msifs_hashmatch && file->state != msifs_skipped && - (file->state != msifs_present || !msi_get_property_int( package->db, szInstalled, 0 )) && + (file->state != msifs_present || !msi_get_property_int( package->db, L"Installed", 0 )) && (rc = ready_media( package, file->IsCompressed, mi ))) { ERR("Failed to ready media for %s\n", debugstr_w(file->File)); @@ -790,7 +789,7 @@ UINT ACTION_PatchFiles( MSIPACKAGE *package ) TRACE("%p\n", package); if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szPatchFiles); + return msi_schedule_action(package, SCRIPT_INSTALL, L"PatchFiles"); mi = msi_alloc_zero( sizeof(MSIMEDIAINFO) ); @@ -1129,7 +1128,7 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param ) lstrcpyW(source, sourcedir); if (source[lstrlenW(source) - 1] != '\\') - lstrcatW(source, szBackSlash); + lstrcatW(source, L"\\"); lstrcatW(source, sourcename); } @@ -1167,7 +1166,7 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param ) lstrcpyW(dest, destdir); if (dest[lstrlenW(dest) - 1] != '\\') - lstrcatW(dest, szBackSlash); + lstrcatW(dest, L"\\"); if (destname) lstrcatW(dest, destname); @@ -1205,16 +1204,13 @@ done: UINT ACTION_MoveFiles( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','M','o','v','e','F','i','l','e','`',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szMoveFiles); + return msi_schedule_action(package, SCRIPT_INSTALL, L"MoveFiles"); - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `MoveFile`", &view); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -1338,16 +1334,13 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param) UINT ACTION_DuplicateFiles(MSIPACKAGE *package) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','D','u','p','l','i','c','a','t','e','F','i','l','e','`',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szDuplicateFiles); + return msi_schedule_action(package, SCRIPT_INSTALL, L"DuplicateFiles"); - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `DuplicateFile`", &view); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -1416,16 +1409,13 @@ static UINT ITERATE_RemoveDuplicateFiles( MSIRECORD *row, LPVOID param ) UINT ACTION_RemoveDuplicateFiles( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','D','u','p','l','i','c','a','t','e','F','i','l','e','`',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szRemoveDuplicateFiles); + return msi_schedule_action(package, SCRIPT_INSTALL, L"RemoveDuplicateFiles"); - rc = MSI_DatabaseOpenViewW( package->db, query, &view ); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `DuplicateFile`", &view ); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -1557,18 +1547,15 @@ static void remove_folder( MSIFOLDER *folder ) UINT ACTION_RemoveFiles( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','R','e','m','o','v','e','F','i','l','e','`',0}; MSIQUERY *view; MSICOMPONENT *comp; MSIFILE *file; UINT r; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szRemoveFiles); + return msi_schedule_action(package, SCRIPT_INSTALL, L"RemoveFiles"); - r = MSI_DatabaseOpenViewW(package->db, query, &view); + r = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `RemoveFile`", &view); if (r == ERROR_SUCCESS) { r = MSI_IterateRecords(view, NULL, ITERATE_RemoveFiles, package); @@ -1583,7 +1570,7 @@ UINT ACTION_RemoveFiles( MSIPACKAGE *package ) VS_FIXEDFILEINFO *ver; comp = file->Component; - msi_file_update_ui( package, file, szRemoveFiles ); + msi_file_update_ui( package, file, L"RemoveFiles" ); comp->Action = msi_get_component_action( package, comp ); if (comp->Action != INSTALLSTATE_ABSENT || comp->Installed == INSTALLSTATE_SOURCE) diff --git a/dll/win32/msi/font.c b/dll/win32/msi/font.c index f26d3fd99c3..78d384b1654 100644 --- a/dll/win32/msi/font.c +++ b/dll/win32/msi/font.c @@ -66,19 +66,6 @@ typedef struct _tagTT_NAME_RECORD { #define SWAPWORD(x) MAKEWORD(HIBYTE(x), LOBYTE(x)) #define SWAPLONG(x) MAKELONG(SWAPWORD(HIWORD(x)), SWAPWORD(LOWORD(x))) -static const WCHAR regfont1[] = - {'S','o','f','t','w','a','r','e','\\', - 'M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s',' ','N','T','\\', - 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'F','o','n','t','s',0}; -static const WCHAR regfont2[] = - {'S','o','f','t','w','a','r','e','\\', - 'M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\', - 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'F','o','n','t','s',0}; - /* * Code based off of code located here *
http://www.codeproject.com/gdi/fontnamefromfile.asp
@@ -178,7 +165,6 @@ end: static WCHAR *font_name_from_file( MSIPACKAGE *package, const WCHAR *filename ) { - static const WCHAR truetypeW[] = {' ','(','T','r','u','e','T','y','p','e',')',0}; WCHAR *name, *ret = NULL; if ((name = load_ttf_name_id( package, filename, NAME_ID_FULL_FONT_NAME ))) @@ -189,9 +175,9 @@ static WCHAR *font_name_from_file( MSIPACKAGE *package, const WCHAR *filename ) msi_free( name ); return NULL; } - ret = msi_alloc( (lstrlenW( name ) + lstrlenW( truetypeW ) + 1 ) * sizeof(WCHAR) ); + ret = msi_alloc( (lstrlenW( name ) + lstrlenW( L" (TrueType)" ) + 1 ) * sizeof(WCHAR) ); lstrcpyW( ret, name ); - lstrcatW( ret, truetypeW ); + lstrcatW( ret, L" (TrueType)" ); msi_free( name ); } return ret; @@ -199,7 +185,6 @@ static WCHAR *font_name_from_file( MSIPACKAGE *package, const WCHAR *filename ) WCHAR *msi_get_font_file_version( MSIPACKAGE *package, const WCHAR *filename ) { - static const WCHAR fmtW[] = {'%','u','.','%','u','.','0','.','0',0}; WCHAR *version, *p, *q, *ret = NULL; if ((version = load_ttf_name_id( package, filename, NAME_ID_VERSION ))) @@ -216,9 +201,9 @@ WCHAR *msi_get_font_file_version( MSIPACKAGE *package, const WCHAR *filename ) if (!*q || *q == ' ') minor = wcstol( p, NULL, 10 ); else major = 0; } - len = lstrlenW( fmtW ) + 20; + len = lstrlenW( L"%u.%u.0.0" ) + 20; ret = msi_alloc( len * sizeof(WCHAR) ); - swprintf( ret, len, fmtW, major, minor ); + swprintf( ret, len, L"%u.%u.0.0", major, minor ); msi_free( version ); } return ret; @@ -255,8 +240,8 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param) return ERROR_SUCCESS; } - RegCreateKeyW(HKEY_LOCAL_MACHINE,regfont1,&hkey1); - RegCreateKeyW(HKEY_LOCAL_MACHINE,regfont2,&hkey2); + RegCreateKeyW( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts" ,&hkey1 ); + RegCreateKeyW( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Fonts", &hkey2 ); if (MSI_RecordIsNull(row,2)) name = font_name_from_file( package, file->TargetPath ); @@ -290,15 +275,13 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param) UINT ACTION_RegisterFonts(MSIPACKAGE *package) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','F','o','n','t','`',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szRegisterFonts); + return msi_schedule_action(package, SCRIPT_INSTALL, L"RegisterFonts"); - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `Font`", &view); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -338,8 +321,8 @@ static UINT ITERATE_UnregisterFonts( MSIRECORD *row, LPVOID param ) return ERROR_SUCCESS; } - RegCreateKeyW( HKEY_LOCAL_MACHINE, regfont1, &hkey1 ); - RegCreateKeyW( HKEY_LOCAL_MACHINE, regfont2, &hkey2 ); + RegCreateKeyW( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts", &hkey1 ); + RegCreateKeyW( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Fonts", &hkey2 ); if (MSI_RecordIsNull( row, 2 )) name = font_name_from_file( package, file->TargetPath ); @@ -373,15 +356,13 @@ static UINT ITERATE_UnregisterFonts( MSIRECORD *row, LPVOID param ) UINT ACTION_UnregisterFonts( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','F','o','n','t','`',0}; MSIQUERY *view; UINT r; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szUnregisterFonts); + return msi_schedule_action(package, SCRIPT_INSTALL, L"UnregisterFonts"); - r = MSI_DatabaseOpenViewW( package->db, query, &view ); + r = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `Font`", &view ); if (r != ERROR_SUCCESS) return ERROR_SUCCESS; diff --git a/dll/win32/msi/format.c b/dll/win32/msi/format.c index 340f5d5657f..cf81b3b0374 100644 --- a/dll/win32/msi/format.c +++ b/dll/win32/msi/format.c @@ -341,7 +341,6 @@ static WCHAR *deformat_literal( FORMAT *format, FORMSTR *str, BOOL *propfound, static WCHAR *build_default_format( const MSIRECORD *record ) { - static const WCHAR fmt[] = {'%','i',':',' ','[','%','i',']',' ',0}; int i, count = MSI_RecordGetFieldCount( record ); WCHAR *ret, *tmp, buf[26]; DWORD size = 1; @@ -351,7 +350,7 @@ static WCHAR *build_default_format( const MSIRECORD *record ) for (i = 1; i <= count; i++) { - size += swprintf( buf, ARRAY_SIZE(buf), fmt, i, i ); + size += swprintf( buf, ARRAY_SIZE(buf), L"%d: [%d] ", i, i ); if (!(tmp = msi_realloc( ret, size * sizeof(*ret) ))) { msi_free( ret ); @@ -754,7 +753,7 @@ static BOOL verify_format(LPWSTR data) return TRUE; } -static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr, +static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data, DWORD *len, MSIRECORD* record) { @@ -898,7 +897,7 @@ end: return rc; } -UINT WINAPI MsiFormatRecordW( MSIHANDLE hInstall, MSIHANDLE hRecord, +UINT WINAPI MsiFormatRecordW( MSIHANDLE hInstall, MSIHANDLE hRecord, LPWSTR szResult, LPDWORD sz ) { UINT r = ERROR_INVALID_HANDLE; diff --git a/dll/win32/msi/install.c b/dll/win32/msi/install.c index ebacd9a6130..4ede0d17ccd 100644 --- a/dll/win32/msi/install.c +++ b/dll/win32/msi/install.c @@ -52,7 +52,7 @@ UINT WINAPI MsiDoActionA( MSIHANDLE hInstall, LPCSTR szAction ) szwAction = strdupAtoW(szAction); if (szAction && !szwAction) - return ERROR_FUNCTION_FAILED; + return ERROR_FUNCTION_FAILED; ret = MsiDoActionW( hInstall, szwAction ); msi_free( szwAction ); @@ -92,7 +92,7 @@ UINT WINAPI MsiDoActionW( MSIHANDLE hInstall, LPCWSTR szAction ) return ret; } - + ret = ACTION_PerformAction(package, szAction); msiobj_release( &package->hdr ); @@ -111,7 +111,7 @@ UINT WINAPI MsiSequenceA( MSIHANDLE hInstall, LPCSTR szTable, INT iSequenceMode szwTable = strdupAtoW(szTable); if (szTable && !szwTable) - return ERROR_FUNCTION_FAILED; + return ERROR_FUNCTION_FAILED; ret = MsiSequenceW( hInstall, szwTable, iSequenceMode ); msi_free( szwTable ); @@ -166,7 +166,7 @@ UINT msi_strcpy_to_awstring( const WCHAR *str, int len, awstring *awbuf, DWORD * return ERROR_SUCCESS; if (len < 0) len = lstrlenW( str ); - + if (awbuf->unicode && awbuf->str.w) { memcpy( awbuf->str.w, str, min(len + 1, *sz) * sizeof(WCHAR) ); @@ -359,7 +359,7 @@ UINT WINAPI MsiGetTargetPathW(MSIHANDLE hinst, const WCHAR *folder, WCHAR *buf, static WCHAR *get_source_root( MSIPACKAGE *package ) { msi_set_sourcedir_props( package, FALSE ); - return msi_dup_property( package->db, szSourceDir ); + return msi_dup_property( package->db, L"SourceDir" ); } WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR *name, MSIFOLDER **folder ) @@ -369,11 +369,11 @@ WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR *name, MSIFOL TRACE("working to resolve %s\n", debugstr_w(name)); - if (!wcscmp( name, szSourceDir )) name = szTargetDir; + if (!wcscmp( name, L"SourceDir" )) name = L"TARGETDIR"; if (!(f = msi_get_loaded_folder( package, name ))) return NULL; /* special resolving for root dir */ - if (!wcscmp( name, szTargetDir ) && !f->ResolvedSource) + if (!wcscmp( name, L"TARGETDIR" ) && !f->ResolvedSource) { f->ResolvedSource = get_source_root( package ); } @@ -598,7 +598,7 @@ UINT MSI_SetTargetPathW( MSIPACKAGE *package, LPCWSTR szFolder, LPCWSTR szFolder /*********************************************************************** * MsiSetTargetPathW (MSI.@) */ -UINT WINAPI MsiSetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder, +UINT WINAPI MsiSetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder, LPCWSTR szFolderPath) { MSIPACKAGE *package; @@ -730,11 +730,11 @@ BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode) break; case MSIRUNMODE_MAINTENANCE: - r = msi_get_property_int( package->db, szInstalled, 0 ) != 0; + r = msi_get_property_int( package->db, L"Installed", 0 ) != 0; break; case MSIRUNMODE_ROLLBACKENABLED: - r = msi_get_property_int( package->db, szRollbackDisabled, 0 ) == 0; + r = msi_get_property_int( package->db, L"RollbackDisabled", 0 ) == 0; break; case MSIRUNMODE_REBOOTATEND: @@ -823,7 +823,7 @@ UINT WINAPI MsiSetFeatureStateA(MSIHANDLE hInstall, LPCSTR szFeature, szwFeature = strdupAtoW(szFeature); - rc = MsiSetFeatureStateW(hInstall,szwFeature, iState); + rc = MsiSetFeatureStateW(hInstall,szwFeature, iState); msi_free(szwFeature); @@ -924,7 +924,7 @@ UINT MSI_SetFeatureStateW( MSIPACKAGE *package, LPCWSTR szFeature, INSTALLSTATE if (!feature) return ERROR_UNKNOWN_FEATURE; - if (iState == INSTALLSTATE_ADVERTISED && + if (iState == INSTALLSTATE_ADVERTISED && feature->Attributes & msidbFeatureAttributesDisallowAdvertise) return ERROR_FUNCTION_FAILED; @@ -938,7 +938,7 @@ UINT MSI_SetFeatureStateW( MSIPACKAGE *package, LPCWSTR szFeature, INSTALLSTATE if (child->Feature_Parent && !wcscmp( szFeature, child->Feature_Parent )) MSI_SetFeatureStateW(package, child->Feature, iState); } - + return rc; } @@ -1029,8 +1029,8 @@ UINT WINAPI MsiSetFeatureAttributesW( MSIHANDLE handle, LPCWSTR name, DWORD attr if (!(package = msihandle2msiinfo( handle, MSIHANDLETYPE_PACKAGE ))) return ERROR_INVALID_HANDLE; - costing = msi_dup_property( package->db, szCostingComplete ); - if (!costing || !wcscmp( costing, szOne )) + costing = msi_dup_property( package->db, L"CostingComplete" ); + if (!costing || !wcscmp( costing, L"1" )) { msi_free( costing ); msiobj_release( &package->hdr ); @@ -1055,7 +1055,7 @@ UINT WINAPI MsiGetFeatureStateA(MSIHANDLE hInstall, LPCSTR szFeature, { LPWSTR szwFeature = NULL; UINT rc; - + if (szFeature && !(szwFeature = strdupAtoW(szFeature))) return ERROR_OUTOFMEMORY; rc = MsiGetFeatureStateW(hInstall, szwFeature, piInstalled, piAction); @@ -1400,7 +1400,7 @@ UINT WINAPI MsiGetComponentStateA(MSIHANDLE hInstall, LPCSTR szComponent, { LPWSTR szwComponent= NULL; UINT rc; - + szwComponent= strdupAtoW(szComponent); rc = MsiGetComponentStateW(hInstall,szwComponent,piInstalled, piAction); @@ -1567,14 +1567,13 @@ LANGID WINAPI MsiGetLanguage(MSIHANDLE hInstall) return langid; } - langid = msi_get_property_int( package->db, szProductLanguage, 0 ); + langid = msi_get_property_int( package->db, L"ProductLanguage", 0 ); msiobj_release( &package->hdr ); return langid; } UINT MSI_SetInstallLevel( MSIPACKAGE *package, int iInstallLevel ) { - static const WCHAR fmt[] = { '%','d',0 }; WCHAR level[6]; int len; UINT r; @@ -1587,8 +1586,8 @@ UINT MSI_SetInstallLevel( MSIPACKAGE *package, int iInstallLevel ) if (iInstallLevel < 1) return MSI_SetFeatureStates( package ); - len = swprintf( level, ARRAY_SIZE(level), fmt, iInstallLevel ); - r = msi_set_property( package->db, szInstallLevel, level, len ); + len = swprintf( level, ARRAY_SIZE(level), L"%d", iInstallLevel ); + r = msi_set_property( package->db, L"INSTALLLEVEL", level, len ); if ( r == ERROR_SUCCESS ) r = MSI_SetFeatureStates( package ); diff --git a/dll/win32/msi/media.c b/dll/win32/msi/media.c index 05a751092a3..41c82af1b59 100644 --- a/dll/win32/msi/media.c +++ b/dll/win32/msi/media.c @@ -82,7 +82,7 @@ static UINT msi_change_media(MSIPACKAGE *package, MSIMEDIAINFO *mi) LPWSTR source_dir; UINT r = IDRETRY; - source_dir = msi_dup_property(package->db, szSourceDir); + source_dir = msi_dup_property(package->db, L"SourceDir"); record = MSI_CreateRecord(2); while (r == IDRETRY && !source_matches_volume(mi, source_dir)) @@ -275,12 +275,7 @@ static UINT CDECL msi_media_get_disk_info(MSIPACKAGE *package, MSIMEDIAINFO *mi) { MSIRECORD *row; - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ', - '`','M','e','d','i','a','`',' ','W','H','E','R','E',' ', - '`','D','i','s','k','I','d','`',' ','=',' ','%','i',0}; - - row = MSI_QueryGetRecord(package->db, query, mi->disk_id); + row = MSI_QueryGetRecord(package->db, L"SELECT * FROM `Media` WHERE `DiskId` = %d", mi->disk_id); if (!row) { TRACE("Unable to query row\n"); @@ -473,7 +468,7 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint, msi_free( tmppathW ); return ERROR_OUTOFMEMORY; } - if (!GetTempFileNameW(tmppathW, szMsi, 0, tmpfileW)) tmpfileW[0] = 0; + if (!GetTempFileNameW(tmppathW, L"msi", 0, tmpfileW)) tmpfileW[0] = 0; msi_free( tmppathW ); handle = CreateFileW(tmpfileW, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, attrs, NULL); @@ -679,7 +674,7 @@ static UINT get_drive_type(const WCHAR *path) static WCHAR *get_base_url( MSIDATABASE *db ) { - WCHAR *p, *ret = NULL, *orig_db = msi_dup_property( db, szOriginalDatabase ); + WCHAR *p, *ret = NULL, *orig_db = msi_dup_property( db, L"OriginalDatabase" ); if (UrlIsW( orig_db, URLIS_URL ) && (ret = strdupW( orig_db )) && (p = wcsrchr( ret, '/'))) p[1] = 0; msi_free( orig_db ); return ret; @@ -687,10 +682,6 @@ static WCHAR *get_base_url( MSIDATABASE *db ) UINT msi_load_media_info(MSIPACKAGE *package, UINT Sequence, MSIMEDIAINFO *mi) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','M','e','d','i','a','`',' ', - 'W','H','E','R','E',' ','`','L','a','s','t','S','e','q','u','e','n','c','e','`',' ', - '>','=',' ','%','i',' ','O','R','D','E','R',' ','B','Y',' ','`','D','i','s','k','I','d','`',0}; MSIRECORD *row; WCHAR *source_dir, *source, *base_url = NULL; DWORD options; @@ -698,7 +689,7 @@ UINT msi_load_media_info(MSIPACKAGE *package, UINT Sequence, MSIMEDIAINFO *mi) if (Sequence <= mi->last_sequence) /* already loaded */ return ERROR_SUCCESS; - row = MSI_QueryGetRecord(package->db, query, Sequence); + row = MSI_QueryGetRecord(package->db, L"SELECT * FROM `Media` WHERE `LastSequence` >= %d ORDER BY `DiskId`", Sequence); if (!row) { TRACE("Unable to query row\n"); @@ -717,7 +708,7 @@ UINT msi_load_media_info(MSIPACKAGE *package, UINT Sequence, MSIMEDIAINFO *mi) msiobj_release(&row->hdr); msi_set_sourcedir_props(package, FALSE); - source_dir = msi_dup_property(package->db, szSourceDir); + source_dir = msi_dup_property(package->db, L"SourceDir"); lstrcpyW(mi->sourcedir, source_dir); PathAddBackslashW(mi->sourcedir); mi->type = get_drive_type(source_dir); @@ -902,7 +893,7 @@ UINT ready_media( MSIPACKAGE *package, BOOL compressed, MSIMEDIAINFO *mi ) /* assume first volume is in the drive */ if (mi->last_volume && wcsicmp( mi->last_volume, mi->volume_label )) { - WCHAR *source = msi_dup_property( package->db, szSourceDir ); + WCHAR *source = msi_dup_property( package->db, L"SourceDir" ); BOOL match = source_matches_volume( mi, source ); msi_free( source ); diff --git a/dll/win32/msi/msi.c b/dll/win32/msi/msi.c index 723b935bdcc..237246b8b10 100644 --- a/dll/win32/msi/msi.c +++ b/dll/win32/msi/msi.c @@ -2469,7 +2469,7 @@ UINT WINAPI MsiMessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uTyp { FIXME("%p %s %s %u %08x %08x\n", hWnd, debugstr_a(lpText), debugstr_a(lpCaption), uType, wLanguageId, f); - return MessageBoxExA(hWnd,lpText,lpCaption,uType,wLanguageId); + return MessageBoxExA(hWnd,lpText,lpCaption,uType,wLanguageId); } UINT WINAPI MsiMessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType, @@ -2477,7 +2477,7 @@ UINT WINAPI MsiMessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uT { FIXME("%p %s %s %u %08x %08x\n", hWnd, debugstr_w(lpText), debugstr_w(lpCaption), uType, wLanguageId, f); - return MessageBoxExW(hWnd,lpText,lpCaption,uType,wLanguageId); + return MessageBoxExW(hWnd,lpText,lpCaption,uType,wLanguageId); } UINT WINAPI MsiMessageBoxExA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType, @@ -3522,7 +3522,7 @@ UINT WINAPI MsiProvideQualifiedComponentW( LPCWSTR szComponent, LPCWSTR szQualifier, DWORD dwInstallMode, LPWSTR lpPathBuf, LPDWORD pcchPathBuf) { - return MsiProvideQualifiedComponentExW(szComponent, szQualifier, + return MsiProvideQualifiedComponentExW(szComponent, szQualifier, dwInstallMode, NULL, 0, 0, lpPathBuf, pcchPathBuf); } @@ -3989,7 +3989,7 @@ UINT WINAPI MsiReinstallFeatureW( LPCWSTR szProduct, LPCWSTR szFeature, DWORD dw if (dwReinstallMode & REINSTALLMODE_PACKAGE) *ptr++ = 'v'; *ptr = 0; - + sz = sizeof(sourcepath); MsiSourceListGetInfoW( szProduct, NULL, context, MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEW, sourcepath, &sz ); diff --git a/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h index 503543e82e8..ea4bd0a20e3 100644 --- a/dll/win32/msi/msipriv.h +++ b/dll/win32/msi/msipriv.h @@ -1137,111 +1137,6 @@ extern DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR f /* User interface messages from the actions */ extern void msi_ui_progress(MSIPACKAGE *, int, int, int, int) DECLSPEC_HIDDEN; -/* common strings */ -static const WCHAR szSourceDir[] = {'S','o','u','r','c','e','D','i','r',0}; -static const WCHAR szSOURCEDIR[] = {'S','O','U','R','C','E','D','I','R',0}; -static const WCHAR szRootDrive[] = {'R','O','O','T','D','R','I','V','E',0}; -static const WCHAR szTargetDir[] = {'T','A','R','G','E','T','D','I','R',0}; -static const WCHAR szLocalSid[] = {'S','-','1','-','5','-','1','8',0}; -static const WCHAR szAllSid[] = {'S','-','1','-','1','-','0',0}; -static const WCHAR szEmpty[] = {0}; -static const WCHAR szAll[] = {'A','L','L',0}; -static const WCHAR szOne[] = {'1',0}; -static const WCHAR szZero[] = {'0',0}; -static const WCHAR szSpace[] = {' ',0}; -static const WCHAR szBackSlash[] = {'\\',0}; -static const WCHAR szForwardSlash[] = {'/',0}; -static const WCHAR szDot[] = {'.',0}; -static const WCHAR szDotDot[] = {'.','.',0}; -static const WCHAR szSemiColon[] = {';',0}; -static const WCHAR szPreselected[] = {'P','r','e','s','e','l','e','c','t','e','d',0}; -static const WCHAR szPatches[] = {'P','a','t','c','h','e','s',0}; -static const WCHAR szState[] = {'S','t','a','t','e',0}; -static const WCHAR szMsi[] = {'m','s','i',0}; -static const WCHAR szPatch[] = {'P','A','T','C','H',0}; -static const WCHAR szSourceList[] = {'S','o','u','r','c','e','L','i','s','t',0}; -static const WCHAR szInstalled[] = {'I','n','s','t','a','l','l','e','d',0}; -static const WCHAR szReinstall[] = {'R','E','I','N','S','T','A','L','L',0}; -static const WCHAR szReinstallMode[] = {'R','E','I','N','S','T','A','L','L','M','O','D','E',0}; -static const WCHAR szRemove[] = {'R','E','M','O','V','E',0}; -static const WCHAR szUserSID[] = {'U','s','e','r','S','I','D',0}; -static const WCHAR szProductCode[] = {'P','r','o','d','u','c','t','C','o','d','e',0}; -static const WCHAR szRegisterClassInfo[] = {'R','e','g','i','s','t','e','r','C','l','a','s','s','I','n','f','o',0}; -static const WCHAR szRegisterProgIdInfo[] = {'R','e','g','i','s','t','e','r','P','r','o','g','I','d','I','n','f','o',0}; -static const WCHAR szRegisterExtensionInfo[] = {'R','e','g','i','s','t','e','r','E','x','t','e','n','s','i','o','n','I','n','f','o',0}; -static const WCHAR szRegisterMIMEInfo[] = {'R','e','g','i','s','t','e','r','M','I','M','E','I','n','f','o',0}; -static const WCHAR szDuplicateFiles[] = {'D','u','p','l','i','c','a','t','e','F','i','l','e','s',0}; -static const WCHAR szRemoveDuplicateFiles[] = {'R','e','m','o','v','e','D','u','p','l','i','c','a','t','e','F','i','l','e','s',0}; -static const WCHAR szInstallFiles[] = {'I','n','s','t','a','l','l','F','i','l','e','s',0}; -static const WCHAR szPatchFiles[] = {'P','a','t','c','h','F','i','l','e','s',0}; -static const WCHAR szRemoveFiles[] = {'R','e','m','o','v','e','F','i','l','e','s',0}; -static const WCHAR szFindRelatedProducts[] = {'F','i','n','d','R','e','l','a','t','e','d','P','r','o','d','u','c','t','s',0}; -static const WCHAR szAllUsers[] = {'A','L','L','U','S','E','R','S',0}; -static const WCHAR szCustomActionData[] = {'C','u','s','t','o','m','A','c','t','i','o','n','D','a','t','a',0}; -static const WCHAR szUILevel[] = {'U','I','L','e','v','e','l',0}; -static const WCHAR szProductID[] = {'P','r','o','d','u','c','t','I','D',0}; -static const WCHAR szPIDTemplate[] = {'P','I','D','T','e','m','p','l','a','t','e',0}; -static const WCHAR szPIDKEY[] = {'P','I','D','K','E','Y',0}; -static const WCHAR szTYPELIB[] = {'T','Y','P','E','L','I','B',0}; -static const WCHAR szSumInfo[] = {5 ,'S','u','m','m','a','r','y','I','n','f','o','r','m','a','t','i','o','n',0}; -static const WCHAR szHCR[] = {'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T','\\',0}; -static const WCHAR szHCU[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R','\\',0}; -static const WCHAR szHLM[] = {'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E','\\',0}; -static const WCHAR szHU[] = {'H','K','E','Y','_','U','S','E','R','S','\\',0}; -static const WCHAR szWindowsFolder[] = {'W','i','n','d','o','w','s','F','o','l','d','e','r',0}; -static const WCHAR szAppSearch[] = {'A','p','p','S','e','a','r','c','h',0}; -static const WCHAR szMoveFiles[] = {'M','o','v','e','F','i','l','e','s',0}; -static const WCHAR szCCPSearch[] = {'C','C','P','S','e','a','r','c','h',0}; -static const WCHAR szUnregisterClassInfo[] = {'U','n','r','e','g','i','s','t','e','r','C','l','a','s','s','I','n','f','o',0}; -static const WCHAR szUnregisterExtensionInfo[] = {'U','n','r','e','g','i','s','t','e','r','E','x','t','e','n','s','i','o','n','I','n','f','o',0}; -static const WCHAR szUnregisterMIMEInfo[] = {'U','n','r','e','g','i','s','t','e','r','M','I','M','E','I','n','f','o',0}; -static const WCHAR szUnregisterProgIdInfo[] = {'U','n','r','e','g','i','s','t','e','r','P','r','o','g','I','d','I','n','f','o',0}; -static const WCHAR szRegisterFonts[] = {'R','e','g','i','s','t','e','r','F','o','n','t','s',0}; -static const WCHAR szUnregisterFonts[] = {'U','n','r','e','g','i','s','t','e','r','F','o','n','t','s',0}; -static const WCHAR szCLSID[] = {'C','L','S','I','D',0}; -static const WCHAR szProgID[] = {'P','r','o','g','I','D',0}; -static const WCHAR szVIProgID[] = {'V','e','r','s','i','o','n','I','n','d','e','p','e','n','d','e','n','t','P','r','o','g','I','D',0}; -static const WCHAR szAppID[] = {'A','p','p','I','D',0}; -static const WCHAR szDefaultIcon[] = {'D','e','f','a','u','l','t','I','c','o','n',0}; -static const WCHAR szInprocHandler[] = {'I','n','p','r','o','c','H','a','n','d','l','e','r',0}; -static const WCHAR szInprocHandler32[] = {'I','n','p','r','o','c','H','a','n','d','l','e','r','3','2',0}; -static const WCHAR szMIMEDatabase[] = {'M','I','M','E','\\','D','a','t','a','b','a','s','e','\\','C','o','n','t','e','n','t',' ','T','y','p','e','\\',0}; -static const WCHAR szLocalPackage[] = {'L','o','c','a','l','P','a','c','k','a','g','e',0}; -static const WCHAR szOriginalDatabase[] = {'O','r','i','g','i','n','a','l','D','a','t','a','b','a','s','e',0}; -static const WCHAR szUpgradeCode[] = {'U','p','g','r','a','d','e','C','o','d','e',0}; -static const WCHAR szAdminUser[] = {'A','d','m','i','n','U','s','e','r',0}; -static const WCHAR szIntel[] = {'I','n','t','e','l',0}; -static const WCHAR szIntel64[] = {'I','n','t','e','l','6','4',0}; -static const WCHAR szX64[] = {'x','6','4',0}; -static const WCHAR szAMD64[] = {'A','M','D','6','4',0}; -static const WCHAR szARM[] = {'A','r','m',0}; -static const WCHAR szARM64[] = {'A','r','m','6','4',0}; -static const WCHAR szStreams[] = {'_','S','t','r','e','a','m','s',0}; -static const WCHAR szStorages[] = {'_','S','t','o','r','a','g','e','s',0}; -static const WCHAR szMsiPublishAssemblies[] = {'M','s','i','P','u','b','l','i','s','h','A','s','s','e','m','b','l','i','e','s',0}; -static const WCHAR szMsiUnpublishAssemblies[] = {'M','s','i','U','n','p','u','b','l','i','s','h','A','s','s','e','m','b','l','i','e','s',0}; -static const WCHAR szCostingComplete[] = {'C','o','s','t','i','n','g','C','o','m','p','l','e','t','e',0}; -static const WCHAR szTempFolder[] = {'T','e','m','p','F','o','l','d','e','r',0}; -static const WCHAR szDatabase[] = {'D','A','T','A','B','A','S','E',0}; -static const WCHAR szCRoot[] = {'C',':','\\',0}; -static const WCHAR szProductLanguage[] = {'P','r','o','d','u','c','t','L','a','n','g','u','a','g','e',0}; -static const WCHAR szProductVersion[] = {'P','r','o','d','u','c','t','V','e','r','s','i','o','n',0}; -static const WCHAR szWindowsInstaller[] = {'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0}; -static const WCHAR szStringData[] = {'_','S','t','r','i','n','g','D','a','t','a',0}; -static const WCHAR szStringPool[] = {'_','S','t','r','i','n','g','P','o','o','l',0}; -static const WCHAR szInstallLevel[] = {'I','N','S','T','A','L','L','L','E','V','E','L',0}; -static const WCHAR szCostInitialize[] = {'C','o','s','t','I','n','i','t','i','a','l','i','z','e',0}; -static const WCHAR szAppDataFolder[] = {'A','p','p','D','a','t','a','F','o','l','d','e','r',0}; -static const WCHAR szRollbackDisabled[] = {'R','o','l','l','b','a','c','k','D','i','s','a','b','l','e','d',0}; -static const WCHAR szName[] = {'N','a','m','e',0}; -static const WCHAR szData[] = {'D','a','t','a',0}; -static const WCHAR szLangResource[] = {'\\','V','a','r','F','i','l','e','I','n','f','o','\\','T','r','a','n','s','l','a','t','i','o','n',0}; -static const WCHAR szInstallLocation[] = {'I','n','s','t','a','l','l','L','o','c','a','t','i','o','n',0}; -static const WCHAR szProperty[] = {'P','r','o','p','e','r','t','y',0}; -static const WCHAR szUninstallable[] = {'U','n','i','n','s','t','a','l','l','a','b','l','e',0}; -static const WCHAR szEXECUTEACTION[] = {'E','X','E','C','U','T','E','A','C','T','I','O','N',0}; -static const WCHAR szProductToBeRegistered[] = {'P','r','o','d','u','c','t','T','o','B','e','R','e','g','i','s','t','e','r','e','d',0}; - /* memory allocation macro functions */ static void *msi_alloc( size_t len ) __WINE_ALLOC_SIZE(1); static inline void *msi_alloc( size_t len ) diff --git a/dll/win32/msi/msiquery.c b/dll/win32/msi/msiquery.c index b55e8b920fd..5298073bfb6 100644 --- a/dll/win32/msi/msiquery.c +++ b/dll/win32/msi/msiquery.c @@ -517,7 +517,7 @@ UINT WINAPI MsiViewExecute(MSIHANDLE hView, MSIHANDLE hRec) MSIQUERY *query; MSIRECORD *rec = NULL; UINT ret; - + TRACE("%d %d\n", hView, hRec); if( hRec ) @@ -564,7 +564,6 @@ UINT WINAPI MsiViewExecute(MSIHANDLE hView, MSIHANDLE hRec) static UINT msi_set_record_type_string( MSIRECORD *rec, UINT field, UINT type, BOOL temporary ) { - static const WCHAR fmt[] = { '%','d',0 }; WCHAR szType[0x10]; if (MSITYPE_IS_BINARY(type)) @@ -591,7 +590,7 @@ static UINT msi_set_record_type_string( MSIRECORD *rec, UINT field, if (type & MSITYPE_NULLABLE) szType[0] &= ~0x20; - swprintf( &szType[1], ARRAY_SIZE(szType) - 1, fmt, (type&0xff) ); + swprintf( &szType[1], ARRAY_SIZE(szType) - 1, L"%d", (type&0xff) ); TRACE("type %04x -> %s\n", type, debugstr_w(szType) ); @@ -798,7 +797,7 @@ MSIDBERROR WINAPI MsiViewGetErrorW( MSIHANDLE handle, LPWSTR buffer, LPDWORD buf } __ENDTRY; - if (msi_strncpyW(remote_column ? remote_column : szEmpty, -1, buffer, buflen) == ERROR_MORE_DATA) + if (msi_strncpyW(remote_column ? remote_column : L"", -1, buffer, buflen) == ERROR_MORE_DATA) r = MSIDBERROR_MOREDATA; if (remote_column) @@ -808,7 +807,7 @@ MSIDBERROR WINAPI MsiViewGetErrorW( MSIHANDLE handle, LPWSTR buffer, LPDWORD buf } if ((r = query->view->error)) column = query->view->error_column; - else column = szEmpty; + else column = L""; if (msi_strncpyW(column, -1, buffer, buflen) == ERROR_MORE_DATA) r = MSIDBERROR_MOREDATA; @@ -849,7 +848,7 @@ MSIDBERROR WINAPI MsiViewGetErrorA( MSIHANDLE handle, LPSTR buffer, LPDWORD bufl } __ENDTRY; - if (msi_strncpyWtoA(remote_column ? remote_column : szEmpty, -1, buffer, buflen, FALSE) == ERROR_MORE_DATA) + if (msi_strncpyWtoA(remote_column ? remote_column : L"", -1, buffer, buflen, FALSE) == ERROR_MORE_DATA) r = MSIDBERROR_MOREDATA; if (remote_column) @@ -859,7 +858,7 @@ MSIDBERROR WINAPI MsiViewGetErrorA( MSIHANDLE handle, LPSTR buffer, LPDWORD bufl } if ((r = query->view->error)) column = query->view->error_column; - else column = szEmpty; + else column = L""; if (msi_strncpyWtoA(column, -1, buffer, buflen, FALSE) == ERROR_MORE_DATA) r = MSIDBERROR_MOREDATA; @@ -1045,11 +1044,6 @@ static UINT msi_primary_key_iterator( MSIRECORD *rec, LPVOID param ) UINT MSI_DatabaseGetPrimaryKeys( MSIDATABASE *db, LPCWSTR table, MSIRECORD **prec ) { - static const WCHAR sql[] = { - 's','e','l','e','c','t',' ','*',' ', - 'f','r','o','m',' ','`','_','C','o','l','u','m','n','s','`',' ', - 'w','h','e','r','e',' ', - '`','T','a','b','l','e','`',' ','=',' ','\'','%','s','\'',0 }; struct msi_primary_key_record_info info; MSIQUERY *query = NULL; UINT r; @@ -1057,7 +1051,7 @@ UINT MSI_DatabaseGetPrimaryKeys( MSIDATABASE *db, if (!TABLE_Exists( db, table )) return ERROR_INVALID_TABLE; - r = MSI_OpenQuery( db, &query, sql, table ); + r = MSI_OpenQuery( db, &query, L"SELECT * FROM `_Columns` WHERE `Table` = '%s'", table ); if( r != ERROR_SUCCESS ) return r; @@ -1133,7 +1127,7 @@ UINT WINAPI MsiDatabaseGetPrimaryKeysW( MSIHANDLE hdb, return r; } -UINT WINAPI MsiDatabaseGetPrimaryKeysA(MSIHANDLE hdb, +UINT WINAPI MsiDatabaseGetPrimaryKeysA(MSIHANDLE hdb, LPCSTR table, MSIHANDLE* phRec) { LPWSTR szwTable = NULL; diff --git a/dll/win32/msi/patch.c b/dll/win32/msi/patch.c index 67da5778415..35b2784ba85 100644 --- a/dll/win32/msi/patch.c +++ b/dll/win32/msi/patch.c @@ -179,7 +179,7 @@ static UINT check_transform_applicable( MSIPACKAGE *package, IStorage *transform } if (wanted_flags & MSITRANSFORM_VALIDATE_PRODUCT) { - WCHAR *product_code_installed = msi_dup_property( package->db, szProductCode ); + WCHAR *product_code_installed = msi_dup_property( package->db, L"ProductCode" ); if (!product_code_installed) { @@ -197,7 +197,7 @@ static UINT check_transform_applicable( MSIPACKAGE *package, IStorage *transform msi_free( template ); if (wanted_flags & MSITRANSFORM_VALIDATE_MAJORVERSION) { - WCHAR *product_version_installed = msi_dup_property( package->db, szProductVersion ); + WCHAR *product_version_installed = msi_dup_property( package->db, L"ProductVersion" ); DWORD major_installed, minor_installed, major, minor; if (!product_version_installed) @@ -218,7 +218,7 @@ static UINT check_transform_applicable( MSIPACKAGE *package, IStorage *transform } else if (wanted_flags & MSITRANSFORM_VALIDATE_MINORVERSION) { - WCHAR *product_version_installed = msi_dup_property( package->db, szProductVersion ); + WCHAR *product_version_installed = msi_dup_property( package->db, L"ProductVersion" ); DWORD major_installed, minor_installed, major, minor; if (!product_version_installed) @@ -236,7 +236,7 @@ static UINT check_transform_applicable( MSIPACKAGE *package, IStorage *transform } if (wanted_flags & MSITRANSFORM_VALIDATE_UPGRADECODE) { - WCHAR *upgrade_code_installed = msi_dup_property( package->db, szUpgradeCode ); + WCHAR *upgrade_code_installed = msi_dup_property( package->db, L"UpgradeCode" ); if (!upgrade_code_installed) { @@ -296,7 +296,7 @@ UINT msi_check_patch_applicable( MSIPACKAGE *package, MSISUMMARYINFO *si ) LPWSTR guid_list, *guids, product_code; UINT i, ret = ERROR_FUNCTION_FAILED; - product_code = msi_dup_property( package->db, szProductCode ); + product_code = msi_dup_property( package->db, L"ProductCode" ); if (!product_code) { /* FIXME: the property ProductCode should be written into the DB somewhere */ @@ -368,17 +368,13 @@ static UINT msi_parse_patch_summary( MSISUMMARYINFO *si, MSIPATCHINFO **patch ) static UINT patch_set_media_source_prop( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','`','S','o','u','r','c','e','`',' ','F','R','O','M',' ', - '`','M','e','d','i','a','`',' ','W','H','E','R','E',' ','`','S','o','u','r','c','e','`',' ', - 'I','S',' ','N','O','T',' ','N','U','L','L',0}; MSIQUERY *view; MSIRECORD *rec; const WCHAR *property; WCHAR *patch; UINT r; - r = MSI_DatabaseOpenViewW( package->db, query, &view ); + r = MSI_DatabaseOpenViewW( package->db, L"SELECT `Source` FROM `Media` WHERE `Source` IS NOT NULL", &view ); if (r != ERROR_SUCCESS) return r; @@ -389,7 +385,7 @@ static UINT patch_set_media_source_prop( MSIPACKAGE *package ) if (MSI_ViewFetch( view, &rec ) == ERROR_SUCCESS) { property = MSI_RecordGetString( rec, 1 ); - patch = msi_dup_property( package->db, szPatch ); + patch = msi_dup_property( package->db, L"PATCH" ); msi_set_property( package->db, property, patch, -1 ); msi_free( patch ); msiobj_release( &rec->hdr ); @@ -444,15 +440,11 @@ static void patch_offset_list_free( struct patch_offset_list *pos ) static void patch_offset_get_filepatches( MSIDATABASE *db, UINT last_sequence, struct patch_offset_list *pos ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','P','a','t','c','h',' ', - 'W','H','E','R','E',' ','S','e','q','u','e','n','c','e',' ','<','=',' ','?',' ', - 'O','R','D','E','R',' ','B','Y',' ','S','e','q','u','e','n','c','e',0}; MSIQUERY *view; MSIRECORD *rec; UINT r; - r = MSI_DatabaseOpenViewW( db, query, &view ); + r = MSI_DatabaseOpenViewW( db, L"SELECT * FROM `Patch` WHERE `Sequence` <= ? ORDER BY `Sequence`", &view ); if (r != ERROR_SUCCESS) return; @@ -482,15 +474,11 @@ static void patch_offset_get_filepatches( MSIDATABASE *db, UINT last_sequence, s static void patch_offset_get_files( MSIDATABASE *db, UINT last_sequence, struct patch_offset_list *pos ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','F','i','l','e',' ', - 'W','H','E','R','E',' ','S','e','q','u','e','n','c','e',' ','<','=',' ','?',' ', - 'O','R','D','E','R',' ','B','Y',' ','S','e','q','u','e','n','c','e',0}; MSIQUERY *view; MSIRECORD *rec; UINT r; - r = MSI_DatabaseOpenViewW( db, query, &view ); + r = MSI_DatabaseOpenViewW( db, L"SELECT * FROM `File` WHERE `Sequence` <= ? ORDER BY `Sequence`", &view ); if (r != ERROR_SUCCESS) return; @@ -545,16 +533,6 @@ static UINT patch_update_file_sequence( MSIDATABASE *db, const struct patch_offs static UINT patch_update_filepatch_sequence( MSIDATABASE *db, const struct patch_offset_list *pos, MSIQUERY *view, MSIRECORD *rec ) { - static const WCHAR delete_query[] = { - 'D','E','L','E','T','E',' ','F','R','O','M',' ','`','P','a','t','c','h','`',' ', - 'W','H','E','R','E',' ','`','F','i','l','e','_','`',' ','=',' ','?',' ', - 'A','N','D',' ','`','S','e','q','u','e','n','c','e','`',' ','=',' ','?',0}; - static const WCHAR insert_query[] = { - 'I','N','S','E','R','T',' ','I','N','T','O',' ','`','P','a','t','c','h','`',' ', - '(','`','F','i','l','e','_','`',',','`','S','e','q','u','e','n','c','e','`',',', - '`','P','a','t','c','h','S','i','z','e','`',',','`','A','t','t','r','i','b','u','t','e','s','`',',', - '`','H','e','a','d','e','r','`',',','`','S','t','r','e','a','m','R','e','f','_','`',')',' ', - 'V','A','L','U','E','S',' ','(','?',',','?',',','?',',','?',',','?',',','?',')',0}; struct patch_offset *po; const WCHAR *file = MSI_RecordGetString( rec, 1 ); UINT r = ERROR_SUCCESS, seq = MSI_RecordGetInteger( rec, 2 ); @@ -566,7 +544,7 @@ static UINT patch_update_filepatch_sequence( MSIDATABASE *db, const struct patch MSIQUERY *delete_view, *insert_view; MSIRECORD *rec2; - r = MSI_DatabaseOpenViewW( db, delete_query, &delete_view ); + r = MSI_DatabaseOpenViewW( db, L"DELETE FROM `Patch` WHERE `File_` = ? AND `Sequence` = ?", &delete_view ); if (r != ERROR_SUCCESS) return r; rec2 = MSI_CreateRecord( 2 ); @@ -577,7 +555,8 @@ static UINT patch_update_filepatch_sequence( MSIDATABASE *db, const struct patch msiobj_release( &rec2->hdr ); if (r != ERROR_SUCCESS) return r; - r = MSI_DatabaseOpenViewW( db, insert_query, &insert_view ); + r = MSI_DatabaseOpenViewW( db, L"INSERT INTO `Patch` (`File_`,`Sequence`,`PatchSize`,`Attributes`," + L"`Header`,`StreamRef_`) VALUES (?,?,?,?,?,?)", &insert_view ); if (r != ERROR_SUCCESS) return r; MSI_RecordSetInteger( rec, 2, po->sequence + pos->offset_to_apply ); @@ -594,21 +573,13 @@ static UINT patch_update_filepatch_sequence( MSIDATABASE *db, const struct patch static UINT patch_offset_modify_db( MSIDATABASE *db, struct patch_offset_list *pos ) { - static const WCHAR file_query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','F','i','l','e','`',' ', - 'W','H','E','R','E',' ','`','S','e','q','u','e','n','c','e','`',' ','>','=',' ','?',' ', - 'A','N','D',' ','`','S','e','q','u','e','n','c','e','`',' ','<','=',' ','?',' ', - 'O','R','D','E','R',' ','B','Y',' ','`','S','e','q','u','e','n','c','e','`',0}; - static const WCHAR patch_query[] = { - 'S','E','L','E','C','T',' ','*','F','R','O','M',' ','`','P','a','t','c','h','`',' ', - 'W','H','E','R','E',' ','`','S','e','q','u','e','n','c','e','`',' ','>','=',' ','?',' ', - 'A','N','D',' ','`','S','e','q','u','e','n','c','e','`',' ','<','=',' ','?',' ', - 'O','R','D','E','R',' ','B','Y',' ','`','S','e','q','u','e','n','c','e','`',0}; MSIRECORD *rec; MSIQUERY *view; UINT r, min = pos->min, max = pos->max, r_fetch; - r = MSI_DatabaseOpenViewW( db, file_query, &view ); + r = MSI_DatabaseOpenViewW( db, + L"SELECT * FROM `File` WHERE `Sequence` >= ? AND `Sequence` <= ? ORDER BY `Sequence`", + &view ); if (r != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -629,7 +600,9 @@ static UINT patch_offset_modify_db( MSIDATABASE *db, struct patch_offset_list *p } msiobj_release( &view->hdr ); - r = MSI_DatabaseOpenViewW( db, patch_query, &view ); + r = MSI_DatabaseOpenViewW( db, + L"SELECT *FROM `Patch` WHERE `Sequence` >= ? AND `Sequence` <= ? ORDER BY `Sequence`", + &view ); if (r != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -654,11 +627,8 @@ done: return r; } -static const WCHAR patch_media_query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','M','e','d','i','a','`',' ', - 'W','H','E','R','E',' ','`','S','o','u','r','c','e','`',' ','I','S',' ','N','O','T',' ','N','U','L','L',' ', - 'A','N','D',' ','`','C','a','b','i','n','e','t','`',' ','I','S',' ','N','O','T',' ','N','U','L','L',' ', - 'O','R','D','E','R',' ','B','Y',' ','`','D','i','s','k','I','d','`',0}; +static const WCHAR patch_media_query[] = + L"SELECT * FROM `Media` WHERE `Source` IS NOT NULL AND `Cabinet` IS NOT NULL ORDER BY `DiskId`"; struct patch_media { @@ -673,15 +643,6 @@ struct patch_media static UINT patch_add_media( MSIPACKAGE *package, IStorage *storage, MSIPATCHINFO *patch ) { - static const WCHAR delete_query[] = { - 'D','E','L','E','T','E',' ','F','R','O','M',' ','`','M','e','d','i','a','`',' ', - 'W','H','E','R','E',' ','`','D','i','s','k','I','d','`','=','?',0}; - static const WCHAR insert_query[] = { - 'I','N','S','E','R','T',' ','I','N','T','O',' ','`','M','e','d','i','a','`',' ', - '(','`','D','i','s','k','I','d','`',',','`','L','a','s','t','S','e','q','u','e','n','c','e','`',',', - '`','D','i','s','k','P','r','o','m','p','t','`',',','`','C','a','b','i','n','e','t','`',',', - '`','V','o','l','u','m','e','L','a','b','e','l','`',',','`','S','o','u','r','c','e','`',')',' ', - 'V','A','L','U','E','S',' ','(','?',',','?',',','?',',','?',',','?',',','?',')',0}; MSIQUERY *view; MSIRECORD *rec; UINT r, disk_id; @@ -708,10 +669,11 @@ static UINT patch_add_media( MSIPACKAGE *package, IStorage *storage, MSIPATCHINF msiobj_release( &rec->hdr ); continue; } - if (!(media = msi_alloc( sizeof( *media )))) { + if (!(media = msi_alloc( sizeof( *media )))) + { msiobj_release( &rec->hdr ); goto done; - } + } media->disk_id = disk_id; media->last_sequence = MSI_RecordGetInteger( rec, 2 ); media->prompt = msi_dup_record_field( rec, 3 ); @@ -726,7 +688,7 @@ static UINT patch_add_media( MSIPACKAGE *package, IStorage *storage, MSIPATCHINF { MSIQUERY *delete_view, *insert_view; - r = MSI_DatabaseOpenViewW( package->db, delete_query, &delete_view ); + r = MSI_DatabaseOpenViewW( package->db, L"DELETE FROM `Media` WHERE `DiskId`=?", &delete_view ); if (r != ERROR_SUCCESS) goto done; rec = MSI_CreateRecord( 1 ); @@ -737,7 +699,9 @@ static UINT patch_add_media( MSIPACKAGE *package, IStorage *storage, MSIPATCHINF msiobj_release( &rec->hdr ); if (r != ERROR_SUCCESS) goto done; - r = MSI_DatabaseOpenViewW( package->db, insert_query, &insert_view ); + r = MSI_DatabaseOpenViewW( package->db, L"INSERT INTO `Media` (`DiskId`,`LastSequence`,`DiskPrompt`," + L"`Cabinet`,`VolumeLabel`,`Source`) VALUES (?,?,?,?,?,?)", + &insert_view ); if (r != ERROR_SUCCESS) goto done; disk_id = package->db->media_transform_disk_id; @@ -842,17 +806,12 @@ done: static DWORD is_uninstallable( MSIDATABASE *db ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','`','V','a','l','u','e','`',' ','F','R','O','M',' ', - '`','M','s','i','P','a','t','c','h','M','e','t','a','d','a','t','a','`',' ', - 'W','H','E','R','E',' ','`','C','o','m','p','a','n','y','`',' ','I','S',' ', - 'N','U','L','L',' ','A','N','D',' ','`','P','r','o','p','e','r','t','y','`','=', - '\'','A','l','l','o','w','R','e','m','o','v','a','l','\'',0}; MSIQUERY *view; MSIRECORD *rec; DWORD ret = 0; - if (MSI_DatabaseOpenViewW( db, query, &view ) != ERROR_SUCCESS) return 0; + if (MSI_DatabaseOpenViewW( db, L"SELECT `Value` FROM `MsiPatchMetadata` WHERE `Company` IS NULL " + L"AND `Property`='AllowRemoval'", &view ) != ERROR_SUCCESS) return 0; if (MSI_ViewExecute( view, 0 ) != ERROR_SUCCESS) { msiobj_release( &view->hdr ); @@ -915,7 +874,6 @@ void msi_free_patchinfo( MSIPATCHINFO *patch ) static UINT msi_apply_patch_package( MSIPACKAGE *package, const WCHAR *file ) { - static const WCHAR dotmsp[] = {'.','m','s','p',0}; MSIDATABASE *patch_db = NULL; WCHAR localfile[MAX_PATH]; MSISUMMARYINFO *si; @@ -947,7 +905,7 @@ static UINT msi_apply_patch_package( MSIPACKAGE *package, const WCHAR *file ) if ( r != ERROR_SUCCESS ) goto done; - r = msi_create_empty_local_file( localfile, dotmsp ); + r = msi_create_empty_local_file( localfile, L".msp" ); if ( r != ERROR_SUCCESS ) goto done; @@ -976,7 +934,7 @@ UINT msi_apply_patches( MSIPACKAGE *package ) LPWSTR patch_list, *patches; UINT i, r = ERROR_SUCCESS; - patch_list = msi_dup_property( package->db, szPatch ); + patch_list = msi_dup_property( package->db, L"PATCH" ); TRACE("patches to be applied: %s\n", debugstr_w(patch_list)); @@ -991,11 +949,10 @@ UINT msi_apply_patches( MSIPACKAGE *package ) UINT msi_apply_transforms( MSIPACKAGE *package ) { - static const WCHAR szTransforms[] = {'T','R','A','N','S','F','O','R','M','S',0}; LPWSTR xform_list, *xforms; UINT i, r = ERROR_SUCCESS; - xform_list = msi_dup_property( package->db, szTransforms ); + xform_list = msi_dup_property( package->db, L"TRANSFORMS" ); xforms = msi_split_string( xform_list, ';' ); for (i = 0; xforms && xforms[i] && r == ERROR_SUCCESS; i++) diff --git a/dll/win32/msi/record.c b/dll/win32/msi/record.c index 0a352adcd87..46c2d71f6f1 100644 --- a/dll/win32/msi/record.c +++ b/dll/win32/msi/record.c @@ -147,7 +147,7 @@ static BOOL string2intW( LPCWSTR str, int *out ) if( str[0] == '-' ) /* check if it's negative */ x = -x; - *out = x; + *out = x; return TRUE; } @@ -439,7 +439,6 @@ const WCHAR *MSI_RecordGetString( const MSIRECORD *rec, UINT iField ) UINT MSI_RecordGetStringW(MSIRECORD *rec, UINT iField, LPWSTR szValue, LPDWORD pcchValue) { - static const WCHAR szFormat[] = {'%','d',0}; UINT len = 0, ret = ERROR_SUCCESS; WCHAR buffer[16]; @@ -457,7 +456,7 @@ UINT MSI_RecordGetStringW(MSIRECORD *rec, UINT iField, switch( rec->fields[iField].type ) { case MSIFIELD_INT: - wsprintfW(buffer, szFormat, rec->fields[iField].u.iVal); + wsprintfW(buffer, L"%d", rec->fields[iField].u.iVal); len = lstrlenW( buffer ); if (szValue) lstrcpynW(szValue, buffer, *pcchValue); diff --git a/dll/win32/msi/registry.c b/dll/win32/msi/registry.c index 623bc1866d3..5dc3c0a81c3 100644 --- a/dll/win32/msi/registry.c +++ b/dll/win32/msi/registry.c @@ -773,8 +773,8 @@ UINT MSIREG_OpenPatchesKey(LPCWSTR szPatch, HKEY *key, BOOL create) if (!squash_guid( szPatch, squashed_pc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szPatch), debugstr_w(squashed_pc)); - swprintf( keypath, ARRAY_SIZE(keypath), L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Patches", - squashed_pc ); + lstrcpyW( keypath, L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Patches\\" ); + lstrcatW( keypath, squashed_pc ); if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key); diff --git a/dll/win32/msi/script.c b/dll/win32/msi/script.c index 67ad8b51c52..4585c2b5922 100644 --- a/dll/win32/msi/script.c +++ b/dll/win32/msi/script.c @@ -49,10 +49,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); #endif -static const WCHAR szJScript[] = { 'J','S','c','r','i','p','t',0}; -static const WCHAR szVBScript[] = { 'V','B','S','c','r','i','p','t',0}; -static const WCHAR szSession[] = {'S','e','s','s','i','o','n',0}; - /* * MsiActiveScriptSite - Our IActiveScriptSite implementation. */ @@ -135,7 +131,7 @@ static HRESULT WINAPI MsiActiveScriptSite_GetItemInfo(IActiveScriptSite* iface, } /* Are we looking for the session object? */ - if (!wcscmp(szSession, pstrName)) { + if (!wcscmp(L"Session", pstrName)) { if (dwReturnMask & SCRIPTINFO_ITYPEINFO) { HRESULT hr = get_typeinfo(Session_tid, ppti); if (SUCCEEDED(hr)) @@ -319,9 +315,9 @@ DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function /* Create the scripting engine */ type &= msidbCustomActionTypeJScript|msidbCustomActionTypeVBScript; if (type == msidbCustomActionTypeJScript) - hr = CLSIDFromProgID(szJScript, &clsid); + hr = CLSIDFromProgID(L"JScript", &clsid); else if (type == msidbCustomActionTypeVBScript) - hr = CLSIDFromProgID(szVBScript, &clsid); + hr = CLSIDFromProgID(L"VBScript", &clsid); else { ERR("Unknown script type %d\n", type); goto done; @@ -345,7 +341,7 @@ DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function hr = IActiveScriptParse_InitNew(pActiveScriptParse); if (FAILED(hr)) goto done; - hr = IActiveScript_AddNamedItem(pActiveScript, szSession, SCRIPTITEM_GLOBALMEMBERS|SCRIPTITEM_ISVISIBLE); + hr = IActiveScript_AddNamedItem(pActiveScript, L"Session", SCRIPTITEM_GLOBALMEMBERS|SCRIPTITEM_ISVISIBLE); if (FAILED(hr)) goto done; hr = IActiveScriptParse_ParseScriptText(pActiveScriptParse, script, NULL, NULL, NULL, 0, 0, 0L, NULL, NULL); diff --git a/dll/win32/msi/select.c b/dll/win32/msi/select.c index 3c643f37239..d5a8e1fde23 100644 --- a/dll/win32/msi/select.c +++ b/dll/win32/msi/select.c @@ -236,10 +236,10 @@ static UINT SELECT_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *na n = sv->cols[ n - 1 ]; if( !n ) { - if (name) *name = szEmpty; + if (name) *name = L""; if (type) *type = MSITYPE_UNKNOWN | MSITYPE_VALID; if (temporary) *temporary = FALSE; - if (table_name) *table_name = szEmpty; + if (table_name) *table_name = L""; return ERROR_SUCCESS; } return sv->table->ops->get_column_info( sv->table, n, name, @@ -404,7 +404,7 @@ static UINT SELECT_AddColumn( MSISELECTVIEW *sv, LPCWSTR name, } sv->cols[sv->num_cols] = n; - TRACE("Translating column %s from %d -> %d\n", + TRACE("Translating column %s from %d -> %d\n", debugstr_w( name ), sv->num_cols, n); sv->num_cols++; @@ -433,7 +433,7 @@ UINT SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table, sv = msi_alloc_zero( FIELD_OFFSET( MSISELECTVIEW, cols[count] )); if( !sv ) return ERROR_FUNCTION_FAILED; - + /* fill the structure */ sv->view.ops = &select_ops; sv->db = db; diff --git a/dll/win32/msi/source.c b/dll/win32/msi/source.c index 89c04d9f7dd..b4b3b54fe35 100644 --- a/dll/win32/msi/source.c +++ b/dll/win32/msi/source.c @@ -53,7 +53,7 @@ typedef struct tagMediaInfo static UINT OpenSourceKey(LPCWSTR szProduct, HKEY* key, DWORD dwOptions, MSIINSTALLCONTEXT context, BOOL create) { - HKEY rootkey = 0; + HKEY rootkey = 0; UINT rc = ERROR_FUNCTION_FAILED; if (context == MSIINSTALLCONTEXT_USERUNMANAGED) @@ -90,10 +90,10 @@ static UINT OpenSourceKey(LPCWSTR szProduct, HKEY* key, DWORD dwOptions, } if (create) - rc = RegCreateKeyW(rootkey, szSourceList, key); + rc = RegCreateKeyW(rootkey, L"SourceList", key); else { - rc = RegOpenKeyW(rootkey,szSourceList, key); + rc = RegOpenKeyW(rootkey, L"SourceList", key); if (rc != ERROR_SUCCESS) rc = ERROR_BAD_CONFIGURATION; } @@ -105,12 +105,11 @@ static UINT OpenSourceKey(LPCWSTR szProduct, HKEY* key, DWORD dwOptions, static UINT OpenMediaSubkey(HKEY rootkey, HKEY *key, BOOL create) { UINT rc; - static const WCHAR media[] = {'M','e','d','i','a',0}; if (create) - rc = RegCreateKeyW(rootkey, media, key); + rc = RegCreateKeyW(rootkey, L"Media", key); else - rc = RegOpenKeyW(rootkey,media, key); + rc = RegOpenKeyW(rootkey, L"Media", key); return rc; } @@ -118,12 +117,11 @@ static UINT OpenMediaSubkey(HKEY rootkey, HKEY *key, BOOL create) static UINT OpenNetworkSubkey(HKEY rootkey, HKEY *key, BOOL create) { UINT rc; - static const WCHAR net[] = {'N','e','t',0}; if (create) - rc = RegCreateKeyW(rootkey, net, key); + rc = RegCreateKeyW(rootkey, L"Net", key); else - rc = RegOpenKeyW(rootkey, net, key); + rc = RegOpenKeyW(rootkey, L"Net", key); return rc; } @@ -131,12 +129,11 @@ static UINT OpenNetworkSubkey(HKEY rootkey, HKEY *key, BOOL create) static UINT OpenURLSubkey(HKEY rootkey, HKEY *key, BOOL create) { UINT rc; - static const WCHAR URL[] = {'U','R','L',0}; if (create) - rc = RegCreateKeyW(rootkey, URL, key); + rc = RegCreateKeyW(rootkey, L"URL", key); else - rc = RegOpenKeyW(rootkey, URL, key); + rc = RegOpenKeyW(rootkey, L"URL", key); return rc; } @@ -208,7 +205,6 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode, LPWSTR szVolumeLabel, LPDWORD pcchVolumeLabel, LPWSTR szDiskPrompt, LPDWORD pcchDiskPrompt) { - static const WCHAR fmt[] = {'#','%','d',0}; WCHAR squashed_pc[SQUASHED_GUID_SIZE], convert[11]; WCHAR *value = NULL, *data = NULL, *ptr, *ptr2; HKEY source, media; @@ -285,7 +281,7 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode, { if (type == REG_DWORD) { - swprintf(convert, ARRAY_SIZE(convert), fmt, *data); + swprintf(convert, ARRAY_SIZE(convert), L"#%d", *data); size = lstrlenW(convert); ptr2 = convert; } @@ -307,7 +303,7 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode, if (type == REG_DWORD) { - swprintf(convert, ARRAY_SIZE(convert), fmt, *ptr); + swprintf(convert, ARRAY_SIZE(convert), L"#%d", *ptr); size = lstrlenW(convert); ptr = convert; } @@ -412,7 +408,6 @@ UINT WINAPI MsiSourceListEnumSourcesW(LPCWSTR szProductCodeOrPatch, LPCWSTR szUs DWORD dwOptions, DWORD dwIndex, LPWSTR szSource, LPDWORD pcchSource) { - static const WCHAR format[] = {'%','d',0}; WCHAR squashed_pc[SQUASHED_GUID_SIZE], name[32]; HKEY source = NULL, subkey = NULL; LONG res; @@ -458,7 +453,7 @@ UINT WINAPI MsiSourceListEnumSourcesW(LPCWSTR szProductCodeOrPatch, LPCWSTR szUs goto done; } - swprintf(name, ARRAY_SIZE(name), format, dwIndex + 1); + swprintf(name, ARRAY_SIZE(name), L"%d", dwIndex + 1); res = RegQueryValueExW(subkey, name, 0, 0, (LPBYTE)szSource, pcchSource); if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) @@ -536,10 +531,9 @@ done: */ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, - LPCWSTR szProperty, LPWSTR szValue, - LPDWORD pcchValue) + LPCWSTR szProperty, LPWSTR szValue, + LPDWORD pcchValue) { - static const WCHAR mediapack[] = {'M','e','d','i','a','P','a','c','k','a','g','e',0}; WCHAR *source, *ptr, squashed_pc[SQUASHED_GUID_SIZE]; HKEY sourcekey, media; DWORD size; @@ -579,7 +573,7 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid, } if (!wcscmp( szProperty, INSTALLPROPERTY_MEDIAPACKAGEPATHW )) - szProperty = mediapack; + szProperty = L"MediaPackage"; RegQueryValueExW(media, szProperty, 0, 0, (LPBYTE)szValue, pcchValue); RegCloseKey(media); @@ -591,7 +585,7 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid, 0, 0, NULL, &size); if (rc != ERROR_SUCCESS) { - static WCHAR szEmpty[1] = { '\0' }; + static WCHAR szEmpty[] = {0}; rc = ERROR_SUCCESS; source = NULL; ptr = szEmpty; @@ -709,8 +703,6 @@ UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid, UINT r; int index = 1; - static const WCHAR format[] = {'%','c',';','%','i',';','%','s',0}; - if (options & MSISOURCETYPE_NETWORK) typechar = 'n'; else if (options & MSISOURCETYPE_URL) @@ -736,7 +728,7 @@ UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid, return r; } - size = lstrlenW(format) + lstrlenW(value) + 7; + size = lstrlenW(L"%c;%d;%s") + lstrlenW(value) + 7; buffer = msi_alloc(size * sizeof(WCHAR)); if (!buffer) return ERROR_OUTOFMEMORY; @@ -748,7 +740,7 @@ UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid, return r; } - swprintf(buffer, size, format, typechar, index, value); + swprintf(buffer, size, L"%c;%d;%s", typechar, index, value); size = (lstrlenW(buffer) + 1) * sizeof(WCHAR); r = RegSetValueExW(source, INSTALLPROPERTY_LASTUSEDSOURCEW, 0, @@ -766,7 +758,6 @@ UINT WINAPI MsiSourceListSetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCWSTR szProperty, LPCWSTR szValue) { - static const WCHAR media_package[] = {'M','e','d','i','a','P','a','c','k','a','g','e',0}; WCHAR squashed_pc[SQUASHED_GUID_SIZE]; HKEY sourcekey, media; LPCWSTR property; @@ -795,7 +786,7 @@ UINT WINAPI MsiSourceListSetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid, property = szProperty; if (!wcscmp( szProperty, INSTALLPROPERTY_MEDIAPACKAGEPATHW )) - property = media_package; + property = L"MediaPackage"; rc = OpenSourceKey(szProduct, &sourcekey, MSICODE_PRODUCT, dwContext, FALSE); if (rc != ERROR_SUCCESS) @@ -896,7 +887,7 @@ UINT WINAPI MsiSourceListAddSourceW( LPCWSTR szProduct, LPCWSTR szUserName, RegCloseKey(hkey); } - ret = MsiSourceListAddSourceExW(szProduct, sidstr, + ret = MsiSourceListAddSourceExW(szProduct, sidstr, context, MSISOURCETYPE_NETWORK, szSource, 0); if (sidstr) @@ -968,7 +959,6 @@ static void add_source_to_list(struct list *sourcelist, media_info *info, { media_info *iter; BOOL found = FALSE; - static const WCHAR fmt[] = {'%','i',0}; if (index) *index = 0; @@ -988,7 +978,7 @@ static void add_source_to_list(struct list *sourcelist, media_info *info, /* update the rest of the list */ if (found) - swprintf(iter->szIndex, ARRAY_SIZE(iter->szIndex), fmt, ++iter->index); + swprintf(iter->szIndex, ARRAY_SIZE(iter->szIndex), L"%d", ++iter->index); else if (index) (*index)++; } @@ -1052,10 +1042,9 @@ error: * MsiSourceListAddSourceExW (MSI.@) */ UINT WINAPI MsiSourceListAddSourceExW( LPCWSTR szProduct, LPCWSTR szUserSid, - MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCWSTR szSource, + MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCWSTR szSource, DWORD dwIndex) { - static const WCHAR fmt[] = {'%','i',0}; HKEY sourcekey, typekey; UINT rc; struct list sourcelist; @@ -1108,7 +1097,7 @@ UINT WINAPI MsiSourceListAddSourceExW( LPCWSTR szProduct, LPCWSTR szUserSid, return rc; } - postfix = (dwOptions & MSISOURCETYPE_NETWORK) ? szBackSlash : szForwardSlash; + postfix = (dwOptions & MSISOURCETYPE_NETWORK) ? L"\\" : L"/"; if (szSource[lstrlenW(szSource) - 1] == *postfix) source = strdupW(szSource); else @@ -1128,18 +1117,18 @@ UINT WINAPI MsiSourceListAddSourceExW( LPCWSTR szProduct, LPCWSTR szUserSid, if (count == 0) { - rc = RegSetValueExW(typekey, szOne, 0, REG_EXPAND_SZ, (LPBYTE)source, size); + rc = RegSetValueExW(typekey, L"1", 0, REG_EXPAND_SZ, (LPBYTE)source, size); goto done; } else if (dwIndex > count || dwIndex == 0) { - swprintf(name, ARRAY_SIZE(name), fmt, count + 1); + swprintf(name, ARRAY_SIZE(name), L"%d", count + 1); rc = RegSetValueExW(typekey, name, 0, REG_EXPAND_SZ, (LPBYTE)source, size); goto done; } else { - swprintf(name, ARRAY_SIZE(name), fmt, dwIndex); + swprintf(name, ARRAY_SIZE(name), L"%d", dwIndex); info = msi_alloc(sizeof(media_info)); if (!info) { @@ -1205,11 +1194,10 @@ UINT WINAPI MsiSourceListAddMediaDiskA(LPCSTR szProduct, LPCSTR szUserSid, /****************************************************************** * MsiSourceListAddMediaDiskW (MSI.@) */ -UINT WINAPI MsiSourceListAddMediaDiskW(LPCWSTR szProduct, LPCWSTR szUserSid, - MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwDiskId, +UINT WINAPI MsiSourceListAddMediaDiskW(LPCWSTR szProduct, LPCWSTR szUserSid, + MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwDiskId, LPCWSTR szVolumeLabel, LPCWSTR szDiskPrompt) { - static const WCHAR fmt[] = {'%','i',0}; HKEY sourcekey, mediakey; UINT rc; WCHAR *buffer, squashed_pc[SQUASHED_GUID_SIZE], szIndex[10]; @@ -1243,7 +1231,7 @@ UINT WINAPI MsiSourceListAddMediaDiskW(LPCWSTR szProduct, LPCWSTR szUserSid, OpenMediaSubkey(sourcekey, &mediakey, TRUE); - swprintf(szIndex, ARRAY_SIZE(szIndex), fmt, dwDiskId); + swprintf(szIndex, ARRAY_SIZE(szIndex), L"%d", dwDiskId); size = 2; if (szVolumeLabel) size += lstrlenW(szVolumeLabel); @@ -1254,7 +1242,7 @@ UINT WINAPI MsiSourceListAddMediaDiskW(LPCWSTR szProduct, LPCWSTR szUserSid, *buffer = '\0'; if (szVolumeLabel) lstrcpyW(buffer, szVolumeLabel); - lstrcatW(buffer, szSemiColon); + lstrcatW(buffer, L";"); if (szDiskPrompt) lstrcatW(buffer, szDiskPrompt); RegSetValueExW(mediakey, szIndex, 0, REG_SZ, (LPBYTE)buffer, size); diff --git a/dll/win32/msi/sql.y b/dll/win32/msi/sql.y index 7bdace72981..5b5c8bd7f8e 100644 --- a/dll/win32/msi/sql.y +++ b/dll/win32/msi/sql.y @@ -740,7 +740,6 @@ number: static LPWSTR parser_add_table( void *info, LPCWSTR list, LPCWSTR table ) { - static const WCHAR space[] = {' ',0}; DWORD len = lstrlenW( list ) + lstrlenW( table ) + 2; LPWSTR ret; @@ -748,7 +747,7 @@ static LPWSTR parser_add_table( void *info, LPCWSTR list, LPCWSTR table ) if( ret ) { lstrcpyW( ret, list ); - lstrcatW( ret, space ); + lstrcatW( ret, L" " ); lstrcatW( ret, table ); } return ret; diff --git a/dll/win32/msi/storages.c b/dll/win32/msi/storages.c index 521b6e89e83..336b40a3ae1 100644 --- a/dll/win32/msi/storages.c +++ b/dll/win32/msi/storages.c @@ -316,16 +316,16 @@ static UINT STORAGES_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR * switch (n) { case 1: - if (name) *name = szName; + if (name) *name = L"Name"; if (type) *type = MSITYPE_STRING | MSITYPE_VALID | MAX_STORAGES_NAME_LEN; break; case 2: - if (name) *name = szData; + if (name) *name = L"Data"; if (type) *type = MSITYPE_STRING | MSITYPE_VALID | MSITYPE_NULLABLE; break; } - if (table_name) *table_name = szStorages; + if (table_name) *table_name = L"_Storages"; if (temporary) *temporary = FALSE; return ERROR_SUCCESS; } diff --git a/dll/win32/msi/streams.c b/dll/win32/msi/streams.c index 6f8a436b5e4..1ef99c2ab05 100644 --- a/dll/win32/msi/streams.c +++ b/dll/win32/msi/streams.c @@ -278,16 +278,16 @@ static UINT STREAMS_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *n switch (n) { case 1: - if (name) *name = szName; + if (name) *name = L"Name"; if (type) *type = MSITYPE_STRING | MSITYPE_VALID | MAX_STREAM_NAME_LEN; break; case 2: - if (name) *name = szData; + if (name) *name = L"Data"; if (type) *type = MSITYPE_STRING | MSITYPE_VALID | MSITYPE_NULLABLE; break; } - if (table_name) *table_name = szStreams; + if (table_name) *table_name = L"_Streams"; if (temporary) *temporary = FALSE; return ERROR_SUCCESS; } @@ -614,7 +614,7 @@ UINT msi_commit_streams( MSIDATABASE *db ) for (i = 0; i < db->num_streams; i++) { name = msi_string_lookup( db->strings, db->streams[i].str_index, NULL ); - if (!wcscmp( name, szSumInfo )) continue; + if (!wcscmp( name, L"\5SummaryInformation" )) continue; if (!(encname = encode_streamname( FALSE, name ))) return ERROR_OUTOFMEMORY; TRACE("saving stream %s as %s\n", debugstr_w(name), debugstr_w(encname)); diff --git a/dll/win32/msi/string.c b/dll/win32/msi/string.c index 5c6432ba1ed..0e250ff4527 100644 --- a/dll/win32/msi/string.c +++ b/dll/win32/msi/string.c @@ -77,7 +77,7 @@ static string_table *init_stringtable( int entries, UINT codepage ) st = msi_alloc( sizeof (string_table) ); if( !st ) - return NULL; + return NULL; if( entries < 1 ) entries = 1; @@ -85,7 +85,7 @@ static string_table *init_stringtable( int entries, UINT codepage ) if( !st->strings ) { msi_free( st ); - return NULL; + return NULL; } st->sorted = msi_alloc( sizeof (UINT) * entries ); @@ -347,7 +347,7 @@ const WCHAR *msi_string_lookup( const string_table *st, UINT id, int *len ) if( id == 0 ) { if (len) *len = 0; - return szEmpty; + return L""; } if( id >= st->maxcount ) return NULL; @@ -465,12 +465,12 @@ HRESULT msi_init_string_table( IStorage *stg ) UINT ret; /* create the StringPool stream... add the zero string to it*/ - ret = write_stream_data(stg, szStringPool, zero, sizeof zero, TRUE); + ret = write_stream_data(stg, L"_StringPool", zero, sizeof zero, TRUE); if (ret != ERROR_SUCCESS) return E_FAIL; /* create the StringData stream... make it zero length */ - ret = write_stream_data(stg, szStringData, NULL, 0, TRUE); + ret = write_stream_data(stg, L"_StringData", NULL, 0, TRUE); if (ret != ERROR_SUCCESS) return E_FAIL; @@ -485,10 +485,10 @@ string_table *msi_load_string_table( IStorage *stg, UINT *bytes_per_strref ) UINT r, datasize = 0, poolsize = 0, codepage; DWORD i, count, offset, len, n, refs; - r = read_stream_data( stg, szStringPool, TRUE, (BYTE **)&pool, &poolsize ); + r = read_stream_data( stg, L"_StringPool", TRUE, (BYTE **)&pool, &poolsize ); if( r != ERROR_SUCCESS) goto end; - r = read_stream_data( stg, szStringData, TRUE, (BYTE **)&data, &datasize ); + r = read_stream_data( stg, L"_StringData", TRUE, (BYTE **)&data, &datasize ); if( r != ERROR_SUCCESS) goto end; @@ -652,11 +652,11 @@ UINT msi_save_string_table( const string_table *st, IStorage *storage, UINT *byt } /* write the streams */ - r = write_stream_data( storage, szStringData, data, datasize, TRUE ); + r = write_stream_data( storage, L"_StringData", data, datasize, TRUE ); TRACE("Wrote StringData r=%08x\n", r); if( r ) goto err; - r = write_stream_data( storage, szStringPool, pool, poolsize, TRUE ); + r = write_stream_data( storage, L"_StringPool", pool, poolsize, TRUE ); TRACE("Wrote StringPool r=%08x\n", r); if( r ) goto err; diff --git a/dll/win32/msi/suminfo.c b/dll/win32/msi/suminfo.c index 666bb1ea1ae..663760e0a23 100644 --- a/dll/win32/msi/suminfo.c +++ b/dll/win32/msi/suminfo.c @@ -44,7 +44,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); #include "pshpack1.h" -typedef struct { +typedef struct { WORD wByteOrder; WORD wFormat; DWORD dwOSVer; @@ -52,20 +52,20 @@ typedef struct { DWORD reserved; } PROPERTYSETHEADER; -typedef struct { +typedef struct { FMTID fmtid; DWORD dwOffset; } FORMATIDOFFSET; -typedef struct { +typedef struct { DWORD cbSection; DWORD cProperties; -} PROPERTYSECTIONHEADER; - -typedef struct { +} PROPERTYSECTIONHEADER; + +typedef struct { DWORD propid; DWORD dwOffset; -} PROPERTYIDOFFSET; +} PROPERTYIDOFFSET; typedef struct { DWORD type; @@ -79,7 +79,7 @@ typedef struct { } str; } u; } PROPERTY_DATA; - + #include "poppack.h" static HRESULT (WINAPI *pPropVariantChangeType) @@ -466,7 +466,7 @@ UINT msi_get_suminfo( IStorage *stg, UINT uiUpdateCount, MSISUMMARYINFO **ret ) if (!(si = create_suminfo( stg, uiUpdateCount ))) return ERROR_OUTOFMEMORY; - hr = IStorage_OpenStream( si->storage, szSumInfo, 0, STGM_READ|STGM_SHARE_EXCLUSIVE, 0, &stm ); + hr = IStorage_OpenStream( si->storage, L"\5SummaryInformation", 0, STGM_READ|STGM_SHARE_EXCLUSIVE, 0, &stm ); if (FAILED( hr )) { msiobj_release( &si->hdr ); @@ -493,7 +493,7 @@ UINT msi_get_db_suminfo( MSIDATABASE *db, UINT uiUpdateCount, MSISUMMARYINFO **r if (!(si = create_suminfo( db->storage, uiUpdateCount ))) return ERROR_OUTOFMEMORY; - r = msi_get_stream( db, szSumInfo, &stm ); + r = msi_get_stream( db, L"\5SummaryInformation", &stm ); if (r != ERROR_SUCCESS) { msiobj_release( &si->hdr ); @@ -512,7 +512,7 @@ UINT msi_get_db_suminfo( MSIDATABASE *db, UINT uiUpdateCount, MSISUMMARYINFO **r return ERROR_SUCCESS; } -UINT WINAPI MsiGetSummaryInformationW( MSIHANDLE hDatabase, +UINT WINAPI MsiGetSummaryInformationW( MSIHANDLE hDatabase, LPCWSTR szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle ) { MSISUMMARYINFO *si; @@ -583,7 +583,7 @@ UINT WINAPI MsiGetSummaryInformationW( MSIHANDLE hDatabase, return ret; } -UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase, +UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase, LPCSTR szDatabase, UINT uiUpdateCount, MSIHANDLE *pHandle) { LPWSTR szwDatabase = NULL; @@ -979,7 +979,7 @@ static UINT suminfo_persist( MSISUMMARYINFO *si ) HRESULT r; grfMode = STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE; - r = IStorage_CreateStream( si->storage, szSumInfo, grfMode, 0, 0, &stm ); + r = IStorage_CreateStream( si->storage, L"\5SummaryInformation", grfMode, 0, 0, &stm ); if( SUCCEEDED(r) ) { ret = save_summary_info( si, stm ); @@ -1266,7 +1266,6 @@ UINT WINAPI MsiCreateTransformSummaryInfoW( MSIHANDLE db, MSIHANDLE db_ref, LPCW UINT msi_load_suminfo_properties( MSIPACKAGE *package ) { - static const WCHAR packagecodeW[] = {'P','a','c','k','a','g','e','C','o','d','e',0}; MSISUMMARYINFO *si; WCHAR *package_code; UINT r, len; @@ -1307,7 +1306,7 @@ UINT msi_load_suminfo_properties( MSIPACKAGE *package ) return r; } - r = msi_set_property( package->db, packagecodeW, package_code, len ); + r = msi_set_property( package->db, L"PackageCode", package_code, len ); msi_free( package_code ); count = 0; diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c index e9d6e8804e7..bfddd6125e9 100644 --- a/dll/win32/msi/table.c +++ b/dll/win32/msi/table.c @@ -71,21 +71,15 @@ struct tagMSITABLE }; /* information for default tables */ -static const WCHAR szTables[] = {'_','T','a','b','l','e','s',0}; -static const WCHAR szTable[] = {'T','a','b','l','e',0}; -static const WCHAR szColumns[] = {'_','C','o','l','u','m','n','s',0}; -static const WCHAR szNumber[] = {'N','u','m','b','e','r',0}; -static const WCHAR szType[] = {'T','y','p','e',0}; - static const MSICOLUMNINFO _Columns_cols[4] = { - { szColumns, 1, szTable, MSITYPE_VALID | MSITYPE_STRING | MSITYPE_KEY | 64, 0, NULL }, - { szColumns, 2, szNumber, MSITYPE_VALID | MSITYPE_KEY | 2, 2, NULL }, - { szColumns, 3, szName, MSITYPE_VALID | MSITYPE_STRING | 64, 4, NULL }, - { szColumns, 4, szType, MSITYPE_VALID | 2, 6, NULL }, + { L"_Columns", 1, L"Table", MSITYPE_VALID | MSITYPE_STRING | MSITYPE_KEY | 64, 0, NULL }, + { L"_Columns", 2, L"Number", MSITYPE_VALID | MSITYPE_KEY | 2, 2, NULL }, + { L"_Columns", 3, L"Name", MSITYPE_VALID | MSITYPE_STRING | 64, 4, NULL }, + { L"_Columns", 4, L"Type", MSITYPE_VALID | 2, 6, NULL }, }; static const MSICOLUMNINFO _Tables_cols[1] = { - { szTables, 1, szName, MSITYPE_VALID | MSITYPE_STRING | MSITYPE_KEY | 64, 0, NULL }, + { L"_Tables", 1, L"Name", MSITYPE_VALID | MSITYPE_STRING | MSITYPE_KEY | 64, 0, NULL }, }; #define MAX_STREAM_NAME 0x1f @@ -138,7 +132,7 @@ LPWSTR encode_streamname(BOOL bTable, LPCWSTR in) *p++ = 0x4840; count --; } - while( count -- ) + while( count -- ) { ch = *in++; if( !ch ) @@ -251,7 +245,7 @@ UINT read_stream_data( IStorage *stg, LPCWSTR stname, BOOL table, TRACE("%s -> %s\n",debugstr_w(stname),debugstr_w(encname)); - r = IStorage_OpenStream(stg, encname, NULL, + r = IStorage_OpenStream(stg, encname, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stm); msi_free( encname ); if( FAILED( r ) ) @@ -272,7 +266,7 @@ UINT read_stream_data( IStorage *stg, LPCWSTR stname, BOOL table, WARN("Too big!\n"); goto end; } - + sz = stat.cbSize.QuadPart; data = msi_alloc( sz ); if( !data ) @@ -281,7 +275,7 @@ UINT read_stream_data( IStorage *stg, LPCWSTR stname, BOOL table, ret = ERROR_NOT_ENOUGH_MEMORY; goto end; } - + r = IStream_Read(stm, data, sz, &count ); if( FAILED( r ) || ( count != sz ) ) { @@ -312,7 +306,7 @@ UINT write_stream_data( IStorage *stg, LPCWSTR stname, LPWSTR encname; encname = encode_streamname(bTable, stname ); - r = IStorage_OpenStream( stg, encname, NULL, + r = IStorage_OpenStream( stg, encname, NULL, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, &stm); if( FAILED(r) ) { @@ -520,12 +514,12 @@ static UINT get_defaulttablecolumns( MSIDATABASE *db, LPCWSTR name, MSICOLUMNINF TRACE("%s\n", debugstr_w(name)); - if (!wcscmp( name, szTables )) + if (!wcscmp( name, L"_Tables" )) { p = _Tables_cols; n = 1; } - else if (!wcscmp( name, szColumns )) + else if (!wcscmp( name, L"_Columns" )) { p = _Columns_cols; n = 4; @@ -603,7 +597,7 @@ static UINT get_table( MSIDATABASE *db, LPCWSTR name, MSITABLE **table_ret ) table->persistent = MSICONDITION_TRUE; lstrcpyW( table->name, name ); - if (!wcscmp( name, szTables ) || !wcscmp( name, szColumns )) + if (!wcscmp( name, L"_Tables" ) || !wcscmp( name, L"_Columns" )) table->persistent = MSICONDITION_NONE; r = table_get_column_info( db, name, &table->colinfo, &table->col_count ); @@ -645,7 +639,7 @@ static UINT get_tablecolumns( MSIDATABASE *db, LPCWSTR szTableName, MSICOLUMNINF if (r == ERROR_SUCCESS && *sz) return r; - r = get_table( db, szColumns, &table ); + r = get_table( db, L"_Columns", &table ); if (r != ERROR_SUCCESS) { ERR("couldn't load _Columns table\n"); @@ -766,7 +760,7 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info, } table_calc_column_offsets( db, table->colinfo, table->col_count); - r = TABLE_CreateView( db, szTables, &tv ); + r = TABLE_CreateView( db, L"_Tables", &tv ); TRACE("CreateView returned %x\n", r); if( r ) { @@ -801,7 +795,7 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info, if( persistent != MSICONDITION_FALSE ) { /* add each column to the _Columns table */ - r = TABLE_CreateView( db, szColumns, &tv ); + r = TABLE_CreateView( db, L"_Columns", &tv ); if( r ) goto err; @@ -969,8 +963,8 @@ BOOL TABLE_Exists( MSIDATABASE *db, LPCWSTR name ) UINT r, table_id, i; MSITABLE *table; - if( !wcscmp( name, szTables ) || !wcscmp( name, szColumns ) || - !wcscmp( name, szStreams ) || !wcscmp( name, szStorages ) ) + if( !wcscmp( name, L"_Tables" ) || !wcscmp( name, L"_Columns" ) || + !wcscmp( name, L"_Streams" ) || !wcscmp( name, L"_Storages" ) ) return TRUE; r = msi_string2id( db->strings, name, -1, &table_id ); @@ -980,10 +974,10 @@ BOOL TABLE_Exists( MSIDATABASE *db, LPCWSTR name ) return FALSE; } - r = get_table( db, szTables, &table ); + r = get_table( db, L"_Tables", &table ); if( r != ERROR_SUCCESS ) { - ERR("table %s not available\n", debugstr_w(szTables)); + ERR("table _Tables not available\n"); return FALSE; } @@ -1088,16 +1082,15 @@ static UINT get_stream_name( const MSITABLEVIEW *tv, UINT row, WCHAR **pstname ) } else { - static const WCHAR fmt[] = { '%','d',0 }; UINT n = bytes_per_column( tv->db, &tv->columns[i], LONG_STR_BYTES ); switch( n ) { case 2: - swprintf( number, ARRAY_SIZE(number), fmt, ival-0x8000 ); + swprintf( number, ARRAY_SIZE(number), L"%d", ival-0x8000 ); break; case 4: - swprintf( number, ARRAY_SIZE(number), fmt, ival^0x80000000 ); + swprintf( number, ARRAY_SIZE(number), L"%d", ival^0x80000000 ); break; default: ERR( "oops - unknown column width %d\n", n ); @@ -1107,7 +1100,7 @@ static UINT get_stream_name( const MSITABLEVIEW *tv, UINT row, WCHAR **pstname ) sval = number; } - len += lstrlenW( szDot ) + lstrlenW( sval ); + len += lstrlenW( L"." ) + lstrlenW( sval ); p = msi_realloc ( stname, len*sizeof(WCHAR) ); if ( !p ) { @@ -1116,7 +1109,7 @@ static UINT get_stream_name( const MSITABLEVIEW *tv, UINT row, WCHAR **pstname ) } stname = p; - lstrcatW( stname, szDot ); + lstrcatW( stname, L"." ); lstrcatW( stname, sval ); } else @@ -1295,15 +1288,6 @@ static UINT TABLE_get_row( struct tagMSIVIEW *view, UINT row, MSIRECORD **rec ) static UINT add_stream( MSIDATABASE *db, const WCHAR *name, IStream *data ) { - static const WCHAR insert[] = { - 'I','N','S','E','R','T',' ','I','N','T','O',' ', - '`','_','S','t','r','e','a','m','s','`',' ', - '(','`','N','a','m','e','`',',','`','D','a','t','a','`',')',' ', - 'V','A','L','U','E','S',' ','(','?',',','?',')',0}; - static const WCHAR update[] = { - 'U','P','D','A','T','E',' ','`','_','S','t','r','e','a','m','s','`',' ', - 'S','E','T',' ','`','D','a','t','a','`',' ','=',' ','?',' ', - 'W','H','E','R','E',' ','`','N','a','m','e','`',' ','=',' ','?',0}; MSIQUERY *query; MSIRECORD *rec; UINT r; @@ -1321,7 +1305,7 @@ static UINT add_stream( MSIDATABASE *db, const WCHAR *name, IStream *data ) if (r != ERROR_SUCCESS) goto done; - r = MSI_DatabaseOpenViewW( db, insert, &query ); + r = MSI_DatabaseOpenViewW( db, L"INSERT INTO `_Streams` (`Name`,`Data`) VALUES (?,?)", &query ); if (r != ERROR_SUCCESS) goto done; @@ -1342,7 +1326,7 @@ static UINT add_stream( MSIDATABASE *db, const WCHAR *name, IStream *data ) if (r != ERROR_SUCCESS) goto done; - r = MSI_DatabaseOpenViewW( db, update, &query ); + r = MSI_DatabaseOpenViewW( db, L"UPDATE `_Streams` SET `Data` = ? WHERE `Name` = ?", &query ); if (r != ERROR_SUCCESS) goto done; @@ -1560,7 +1544,7 @@ static UINT TABLE_execute( struct tagMSIVIEW *view, MSIRECORD *record ) static UINT TABLE_close( struct tagMSIVIEW *view ) { TRACE("%p\n", view ); - + return ERROR_SUCCESS; } @@ -1977,7 +1961,7 @@ static UINT TABLE_remove_column(struct tagMSIVIEW *view, UINT number) MSI_RecordSetStringW(rec, 1, tv->name); MSI_RecordSetInteger(rec, 2, number); - r = TABLE_CreateView(tv->db, szColumns, &columns); + r = TABLE_CreateView(tv->db, L"_Columns", &columns); if (r != ERROR_SUCCESS) { msiobj_release(&rec->hdr); @@ -2110,7 +2094,7 @@ static UINT TABLE_add_column(struct tagMSIVIEW *view, LPCWSTR column, MSI_RecordSetStringW(rec, 3, column); MSI_RecordSetInteger(rec, 4, type); - r = TABLE_CreateView(tv->db, szColumns, &columns); + r = TABLE_CreateView(tv->db, L"_Columns", &columns); if (r != ERROR_SUCCESS) { tv->table->col_count--; @@ -2155,7 +2139,7 @@ static UINT TABLE_drop(struct tagMSIVIEW *view) MSI_RecordSetStringW(rec, 1, tv->name); - r = TABLE_CreateView(tv->db, szTables, &tables); + r = TABLE_CreateView(tv->db, L"_Tables", &tables); if (r != ERROR_SUCCESS) { msiobj_release(&rec->hdr); @@ -2210,9 +2194,9 @@ UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view ) TRACE("%p %s %p\n", db, debugstr_w(name), view ); - if ( !wcscmp( name, szStreams ) ) + if ( !wcscmp( name, L"_Streams" ) ) return STREAMS_CreateView( db, view ); - else if ( !wcscmp( name, szStorages ) ) + else if ( !wcscmp( name, L"_Storages" ) ) return STORAGES_CreateView( db, view ); sz = FIELD_OFFSET( MSITABLEVIEW, name[lstrlenW( name ) + 1] ); @@ -2345,13 +2329,13 @@ static UINT TransformView_set_row( MSIVIEW *view, UINT row, MSIRECORD *rec, UINT WCHAR *key; UINT i, p, r, len, qlen; - if (!wcscmp( tv->name, szColumns )) + if (!wcscmp( tv->name, L"_Columns" )) { ERR( "trying to modify existing column\n" ); return ERROR_INSTALL_TRANSFORM_FAILURE; } - if (!wcscmp( tv->name, szTables )) + if (!wcscmp( tv->name, L"_Tables" )) { ERR( "trying to modify existing table\n" ); return ERROR_INSTALL_TRANSFORM_FAILURE; @@ -2578,10 +2562,10 @@ static UINT TransformView_insert_row( MSIVIEW *view, MSIRECORD *rec, UINT row, B int len; UINT r; - if (!wcscmp(tv->name, szTables)) + if (!wcscmp(tv->name, L"_Tables")) return TransformView_create_table( tv, rec ); - if (!wcscmp(tv->name, szColumns)) + if (!wcscmp(tv->name, L"_Columns")) return TransformView_add_column( tv, rec ); key = create_key_string( tv, rec ); @@ -2671,13 +2655,13 @@ static UINT TransformView_delete_row( MSIVIEW *view, UINT row ) MSIRECORD *rec; MSIQUERY *q; - if (!wcscmp( tv->name, szColumns )) + if (!wcscmp( tv->name, L"_Columns" )) { ERR("trying to remove column\n"); return ERROR_INSTALL_TRANSFORM_FAILURE; } - if (!wcscmp( tv->name, szTables )) + if (!wcscmp( tv->name, L"_Tables" )) return TransformView_drop_table( tv, row ); r = msi_view_get_row( tv->db, view, row, &rec ); @@ -3296,7 +3280,7 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, UINT number = MSI_NULL_INTEGER; UINT row = 0; - if (!wcscmp( name, szColumns )) + if (!wcscmp( name, L"_Columns" )) { MSI_RecordGetStringW( rec, 1, table, &sz ); number = MSI_RecordGetInteger( rec, 2 ); @@ -3358,7 +3342,7 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, } if (!(err_cond & MSITRANSFORM_ERROR_VIEWTRANSFORM) && - !wcscmp( name, szColumns )) + !wcscmp( name, L"_Columns" )) msi_update_table_columns( db, table ); msiobj_release( &rec->hdr ); @@ -3422,8 +3406,8 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg, int err_cond ) if ( name[0] != 0x4840 ) continue; - if ( !wcscmp( name+1, szStringPool ) || - !wcscmp( name+1, szStringData ) ) + if ( !wcscmp( name+1, L"_StringPool" ) || + !wcscmp( name+1, L"_StringData" ) ) continue; transform = msi_alloc_zero( sizeof(TRANSFORMDATA) ); @@ -3434,11 +3418,11 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg, int err_cond ) transform->name = strdupW( name + 1 ); - if ( !wcscmp( transform->name, szTables ) ) + if ( !wcscmp( transform->name, L"_Tables" ) ) tables = transform; - else if (!wcscmp( transform->name, szColumns ) ) + else if (!wcscmp( transform->name, L"_Columns" ) ) columns = transform; - else if (!wcscmp( transform->name, szProperty )) + else if (!wcscmp( transform->name, L"Property" )) property_update = TRUE; TRACE("transform contains stream %s\n", debugstr_w(name)); @@ -3462,6 +3446,7 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg, int err_cond ) L"`Table` CHAR(0) NOT NULL TEMPORARY, `Column` CHAR(0) NOT NULL TEMPORARY, " L"`Row` CHAR(0) TEMPORARY, `Data` CHAR(0) TEMPORARY, `Current` CHAR(0) TEMPORARY " L"PRIMARY KEY `Table`, `Column`, `Row` ) HOLD"; + MSIQUERY *query; UINT r; @@ -3506,8 +3491,8 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg, int err_cond ) { transform = LIST_ENTRY( list_head( &transforms ), TRANSFORMDATA, entry ); - if ( wcscmp( transform->name, szColumns ) && - wcscmp( transform->name, szTables ) && + if ( wcscmp( transform->name, L"_Columns" ) && + wcscmp( transform->name, L"_Tables" ) && ret == ERROR_SUCCESS ) { ret = msi_table_load_transform( db, stg, strings, transform, bytes_per_strref, err_cond ); diff --git a/dll/win32/msi/upgrade.c b/dll/win32/msi/upgrade.c index 60b5c74f40b..18649fced3d 100644 --- a/dll/win32/msi/upgrade.c +++ b/dll/win32/msi/upgrade.c @@ -97,13 +97,13 @@ static void append_productcode( MSIPACKAGE *package, const WCHAR *action_prop, c if (prop) { lstrcpyW( newprop, prop ); - lstrcatW( newprop, szSemiColon ); + lstrcatW( newprop, L";" ); } else newprop[0] = 0; lstrcatW( newprop, product ); r = msi_set_property( package->db, action_prop, newprop, -1 ); - if (r == ERROR_SUCCESS && !wcscmp( action_prop, szSourceDir )) + if (r == ERROR_SUCCESS && !wcscmp( action_prop, L"SourceDir" )) msi_reset_source_folders( package ); TRACE( "related product property %s now %s\n", debugstr_w(action_prop), debugstr_w(newprop) ); @@ -210,35 +210,32 @@ static UINT ITERATE_FindRelatedProducts(MSIRECORD *rec, LPVOID param) } RegCloseKey(hkey); msiobj_release( &uirow->hdr); - + return ERROR_SUCCESS; } UINT ACTION_FindRelatedProducts(MSIPACKAGE *package) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','U','p','g','r','a','d','e','`',0}; MSIQUERY *view; UINT rc; - if (msi_get_property_int(package->db, szInstalled, 0)) + if (msi_get_property_int(package->db, L"Installed", 0)) { TRACE("Skipping FindRelatedProducts action: product already installed\n"); return ERROR_SUCCESS; } - if (msi_action_is_unique(package, szFindRelatedProducts)) + if (msi_action_is_unique(package, L"FindRelatedProducts")) { TRACE("Skipping FindRelatedProducts action: already done in UI sequence\n"); return ERROR_SUCCESS; } else - msi_register_unique_action(package, szFindRelatedProducts); + msi_register_unique_action(package, L"FindRelatedProducts"); - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `Upgrade`", &view); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; - + rc = MSI_IterateRecords(view, NULL, ITERATE_FindRelatedProducts, package); msiobj_release(&view->hdr); return rc; diff --git a/dll/win32/msi/where.c b/dll/win32/msi/where.c index 07064f0f980..2a64de8cd9d 100644 --- a/dll/win32/msi/where.c +++ b/dll/win32/msi/where.c @@ -1235,7 +1235,7 @@ UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR tables, wv = msi_alloc_zero( sizeof *wv ); if( !wv ) return ERROR_FUNCTION_FAILED; - + /* fill the structure */ wv->view.ops = &where_ops; msiobj_addref( &db->hdr );
2 years, 9 months
1
0
0
0
[reactos] 308/360: [WINESYNC] msi: Use wide character string literals in classes.c.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d012037f17c59c500b711…
commit d012037f17c59c500b7116b540a7010fbef2f009 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 21:31:37 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:35 2022 +0100 [WINESYNC] msi: Use wide character string literals in classes.c. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id e7dd9b3f3694b276d50ccfb5515e7e0f70b1c555 by Hans Leidekker <hans(a)codeweavers.com> --- dll/win32/msi/classes.c | 266 ++++++++++++++++++------------------------------ 1 file changed, 100 insertions(+), 166 deletions(-) diff --git a/dll/win32/msi/classes.c b/dll/win32/msi/classes.c index 4e0c1a68098..52a91b306f1 100644 --- a/dll/win32/msi/classes.c +++ b/dll/win32/msi/classes.c @@ -52,7 +52,7 @@ static MSIAPPID *load_appid( MSIPACKAGE* package, MSIRECORD *row ) appid = msi_alloc_zero( sizeof(MSIAPPID) ); if (!appid) return NULL; - + appid->AppID = msi_dup_record_field( row, 1 ); TRACE("loading appid %s\n", debugstr_w( appid->AppID )); @@ -67,16 +67,12 @@ static MSIAPPID *load_appid( MSIPACKAGE* package, MSIRECORD *row ) appid->RunAsInteractiveUser = !MSI_RecordIsNull(row,7); list_add_tail( &package->appids, &appid->entry ); - + return appid; } static MSIAPPID *load_given_appid( MSIPACKAGE *package, LPCWSTR name ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','A','p','p','I','d','`',' ','W','H','E','R','E',' ', - '`','A','p','p','I','d','`',' ','=',' ','\'','%','s','\'',0}; MSIRECORD *row; MSIAPPID *appid; @@ -92,8 +88,8 @@ static MSIAPPID *load_given_appid( MSIPACKAGE *package, LPCWSTR name ) return appid; } } - - row = MSI_QueryGetRecord(package->db, query, name); + + row = MSI_QueryGetRecord(package->db, L"SELECT * FROM `AppId` WHERE `AppId` = '%s'", name); if (!row) return NULL; @@ -135,17 +131,14 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row ) if (!MSI_RecordIsNull(row,6)) { - INT icon_index = MSI_RecordGetInteger(row,6); + INT icon_index = MSI_RecordGetInteger(row,6); LPCWSTR FileName = MSI_RecordGetString(row,5); LPWSTR FilePath; - static const WCHAR fmt[] = {'%','s',',','%','i',0}; FilePath = msi_build_icon_path(package, FileName); - - progid->IconPath = msi_alloc( (lstrlenW(FilePath)+10)* sizeof(WCHAR) ); - - swprintf(progid->IconPath,lstrlenW(FilePath)+10,fmt,FilePath,icon_index); + progid->IconPath = msi_alloc( (lstrlenW(FilePath) + 10) * sizeof(WCHAR) ); + swprintf( progid->IconPath, lstrlenW(FilePath) + 10, L"%s,%d", FilePath, icon_index ); msi_free(FilePath); } else @@ -171,16 +164,12 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row ) progid->CurVer = parent; parent->VersionInd = progid; } - + return progid; } static MSIPROGID *load_given_progid(MSIPACKAGE *package, LPCWSTR name) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','P','r','o','g','I','d','`',' ','W','H','E','R','E',' ', - '`','P','r','o','g','I','d','`',' ','=',' ','\'','%','s','\'',0}; MSIPROGID *progid; MSIRECORD *row; @@ -196,8 +185,8 @@ static MSIPROGID *load_given_progid(MSIPACKAGE *package, LPCWSTR name) return progid; } } - - row = MSI_QueryGetRecord( package->db, query, name ); + + row = MSI_QueryGetRecord( package->db, L"SELECT * FROM `ProgId` WHERE `ProgId` = '%s'", name ); if (!row) return NULL; @@ -240,17 +229,14 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row ) if (!MSI_RecordIsNull(row,9)) { - INT icon_index = MSI_RecordGetInteger(row,9); + INT icon_index = MSI_RecordGetInteger(row,9); LPCWSTR FileName = MSI_RecordGetString(row,8); LPWSTR FilePath; - static const WCHAR fmt[] = {'%','s',',','%','i',0}; FilePath = msi_build_icon_path(package, FileName); - - cls->IconPath = msi_alloc( (lstrlenW(FilePath)+5)* sizeof(WCHAR) ); - - swprintf(cls->IconPath,lstrlenW(FilePath)+5,fmt,FilePath,icon_index); + cls->IconPath = msi_alloc( (lstrlenW(FilePath) + 5) * sizeof(WCHAR) ); + swprintf( cls->IconPath, lstrlenW(FilePath) + 5, L"%s,%d", FilePath, icon_index ); msi_free(FilePath); } else @@ -265,20 +251,17 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row ) i = MSI_RecordGetInteger(row,10); if (i != MSI_NULL_INTEGER && i > 0 && i < 4) { - static const WCHAR ole2[] = {'o','l','e','2','.','d','l','l',0}; - static const WCHAR ole32[] = {'o','l','e','3','2','.','d','l','l',0}; - switch(i) { case 1: - cls->DefInprocHandler = strdupW(ole2); + cls->DefInprocHandler = strdupW(L"ole2.dll"); break; case 2: - cls->DefInprocHandler32 = strdupW(ole32); + cls->DefInprocHandler32 = strdupW(L"ole32.dll"); break; case 3: - cls->DefInprocHandler = strdupW(ole2); - cls->DefInprocHandler32 = strdupW(ole32); + cls->DefInprocHandler = strdupW(L"ole2.dll"); + cls->DefInprocHandler32 = strdupW(L"ole32.dll"); break; } } @@ -300,23 +283,19 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row ) } /* - * the Class table has 3 primary keys. Generally it is only + * the Class table has 3 primary keys. Generally it is only * referenced through the first CLSID key. However when loading * all of the classes we need to make sure we do not ignore rows - * with other Context and ComponentIndexs + * with other Context and ComponentIndexs */ static MSICLASS *load_given_class(MSIPACKAGE *package, LPCWSTR classid) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','C','l','a','s','s','`',' ','W','H','E','R','E',' ', - '`','C','L','S','I','D','`',' ','=',' ','\'','%','s','\'',0}; MSICLASS *cls; MSIRECORD *row; if (!classid) return NULL; - + /* check for classes already loaded */ LIST_FOR_EACH_ENTRY( cls, &package->classes, MSICLASS, entry ) { @@ -327,7 +306,7 @@ static MSICLASS *load_given_class(MSIPACKAGE *package, LPCWSTR classid) } } - row = MSI_QueryGetRecord(package->db, query, classid); + row = MSI_QueryGetRecord( package->db, L"SELECT * FROM `Class` WHERE `CLSID` = '%s'", classid ); if (!row) return NULL; @@ -349,7 +328,7 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row ) if (!mt) return mt; - mt->ContentType = msi_dup_record_field( row, 1 ); + mt->ContentType = msi_dup_record_field( row, 1 ); TRACE("loading mime %s\n", debugstr_w(mt->ContentType)); extension = MSI_RecordGetString( row, 2 ); @@ -366,16 +345,12 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row ) static MSIMIME *load_given_mime( MSIPACKAGE *package, LPCWSTR mime ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','M','I','M','E','`',' ','W','H','E','R','E',' ', - '`','C','o','n','t','e','n','t','T','y','p','e','`',' ','=',' ','\'','%','s','\'',0}; MSIRECORD *row; MSIMIME *mt; if (!mime) return NULL; - + /* check for mime already loaded */ LIST_FOR_EACH_ENTRY( mt, &package->mimes, MSIMIME, entry ) { @@ -385,8 +360,8 @@ static MSIMIME *load_given_mime( MSIPACKAGE *package, LPCWSTR mime ) return mt; } } - - row = MSI_QueryGetRecord(package->db, query, mime); + + row = MSI_QueryGetRecord( package->db, L"SELECT * FROM `MIME` WHERE `ContentType` = '%s'", mime ); if (!row) return NULL; @@ -434,10 +409,6 @@ static MSIEXTENSION *load_extension( MSIPACKAGE* package, MSIRECORD *row ) */ static MSIEXTENSION *load_given_extension( MSIPACKAGE *package, LPCWSTR name ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','E','x','t','e','n','s','i','o','n','`',' ','W','H','E','R','E',' ', - '`','E','x','t','e','n','s','i','o','n','`',' ','=',' ','\'','%','s','\'',0}; MSIEXTENSION *ext; MSIRECORD *row; @@ -456,8 +427,8 @@ static MSIEXTENSION *load_given_extension( MSIPACKAGE *package, LPCWSTR name ) return ext; } } - - row = MSI_QueryGetRecord( package->db, query, name ); + + row = MSI_QueryGetRecord( package->db, L"SELECT * FROM `Extension` WHERE `Extension` = '%s'", name ); if (!row) return NULL; @@ -499,7 +470,7 @@ static UINT iterate_load_verb(MSIRECORD *row, LPVOID param) /* associate the verb with the correct extension */ list_add_tail( &extension->verbs, &verb->entry ); - + return ERROR_SUCCESS; } @@ -530,7 +501,7 @@ static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param) break; } } - + if (!match) load_class(package, rec); @@ -539,12 +510,10 @@ static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param) static UINT load_all_classes( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ','`','C','l','a','s','s','`',0}; MSIQUERY *view; UINT rc; - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `Class`", &view ); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -585,12 +554,10 @@ static UINT iterate_all_extensions(MSIRECORD *rec, LPVOID param) static UINT load_all_extensions( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','E','x','t','e','n','s','i','o','n','`',0}; MSIQUERY *view; UINT rc; - rc = MSI_DatabaseOpenViewW( package->db, query, &view ); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `Extension`", &view ); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -611,13 +578,10 @@ static UINT iterate_all_progids(MSIRECORD *rec, LPVOID param) static UINT load_all_progids( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','`','P','r','o','g','I','d','`',' ','F','R','O','M',' ', - '`','P','r','o','g','I','d','`',0}; MSIQUERY *view; UINT rc; - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT `ProgId` FROM `ProgId`", &view ); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -628,12 +592,10 @@ static UINT load_all_progids( MSIPACKAGE *package ) static UINT load_all_verbs( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','V','e','r','b','`',0}; MSIQUERY *view; UINT rc; - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `Verb`", &view ); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -654,13 +616,10 @@ static UINT iterate_all_mimes(MSIRECORD *rec, LPVOID param) static UINT load_all_mimes( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','`','C','o','n','t','e','n','t','T','y','p','e','`',' ', - 'F','R','O','M',' ','`','M','I','M','E','`',0}; MSIQUERY *view; UINT rc; - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT `ContentType` FROM `MIME`", &view ); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -699,45 +658,30 @@ static UINT load_classes_and_such( MSIPACKAGE *package ) static UINT register_appid(const MSIAPPID *appid, LPCWSTR app ) { - static const WCHAR szRemoteServerName[] = - {'R','e','m','o','t','e','S','e','r','v','e','r','N','a','m','e',0}; - static const WCHAR szLocalService[] = - {'L','o','c','a','l','S','e','r','v','i','c','e',0}; - static const WCHAR szService[] = - {'S','e','r','v','i','c','e','P','a','r','a','m','e','t','e','r','s',0}; - static const WCHAR szDLL[] = - {'D','l','l','S','u','r','r','o','g','a','t','e',0}; - static const WCHAR szActivate[] = - {'A','c','t','i','v','a','t','e','A','s','S','t','o','r','a','g','e',0}; - static const WCHAR szY[] = {'Y',0}; - static const WCHAR szRunAs[] = {'R','u','n','A','s',0}; - static const WCHAR szUser[] = - {'I','n','t','e','r','a','c','t','i','v','e',' ','U','s','e','r',0}; - - HKEY hkey2,hkey3; - - RegCreateKeyW(HKEY_CLASSES_ROOT,szAppID,&hkey2); + HKEY hkey2, hkey3; + + RegCreateKeyW( HKEY_CLASSES_ROOT, L"AppID", &hkey2 ); RegCreateKeyW( hkey2, appid->AppID, &hkey3 ); RegCloseKey(hkey2); msi_reg_set_val_str( hkey3, NULL, app ); if (appid->RemoteServerName) - msi_reg_set_val_str( hkey3, szRemoteServerName, appid->RemoteServerName ); + msi_reg_set_val_str( hkey3, L"RemoteServerName", appid->RemoteServerName ); if (appid->LocalServer) - msi_reg_set_val_str( hkey3, szLocalService, appid->LocalServer ); + msi_reg_set_val_str( hkey3, L"LocalService", appid->LocalServer ); if (appid->ServiceParameters) - msi_reg_set_val_str( hkey3, szService, appid->ServiceParameters ); + msi_reg_set_val_str( hkey3, L"ServiceParameters", appid->ServiceParameters ); if (appid->DllSurrogate) - msi_reg_set_val_str( hkey3, szDLL, appid->DllSurrogate ); + msi_reg_set_val_str( hkey3, L"DllSurrogate", appid->DllSurrogate ); if (appid->ActivateAtStorage) - msi_reg_set_val_str( hkey3, szActivate, szY ); + msi_reg_set_val_str( hkey3, L"ActivateAtStorage", L"Y" ); if (appid->RunAsInteractiveUser) - msi_reg_set_val_str( hkey3, szRunAs, szUser ); + msi_reg_set_val_str( hkey3, L"RunAs", L"Interactive User" ); RegCloseKey(hkey3); return ERROR_SUCCESS; @@ -745,7 +689,6 @@ static UINT register_appid(const MSIAPPID *appid, LPCWSTR app ) UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) { - static const WCHAR szFileType_fmt[] = {'F','i','l','e','T','y','p','e','\\','%','s','\\','%','i',0}; REGSAM access = KEY_ALL_ACCESS; MSIRECORD *uirow; HKEY hkey, hkey2, hkey3; @@ -753,7 +696,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) UINT r; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szRegisterClassInfo); + return msi_schedule_action( package, SCRIPT_INSTALL, L"RegisterClassInfo" ); r = load_classes_and_such( package ); if (r != ERROR_SUCCESS) @@ -764,7 +707,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) else access |= KEY_WOW64_64KEY; - if (RegCreateKeyExW( HKEY_CLASSES_ROOT, szCLSID, 0, NULL, 0, access, NULL, &hkey, NULL )) + if (RegCreateKeyExW( HKEY_CLASSES_ROOT, L"CLSID", 0, NULL, 0, access, NULL, &hkey, NULL )) return ERROR_FUNCTION_FAILED; LIST_FOR_EACH_ENTRY( cls, &package->classes, MSICLASS, entry ) @@ -830,7 +773,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) if (cls->Argument) { - lstrcatW( argument, szSpace ); + lstrcatW( argument, L" " ); lstrcatW( argument, cls->Argument ); } @@ -848,11 +791,11 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) else progid = cls->ProgIDText; - msi_reg_set_subkey_val( hkey2, szProgID, NULL, progid ); + msi_reg_set_subkey_val( hkey2, L"ProgID", NULL, progid ); if (cls->ProgID && cls->ProgID->VersionInd) { - msi_reg_set_subkey_val( hkey2, szVIProgID, NULL, + msi_reg_set_subkey_val( hkey2, L"VersionIndependentProgID", NULL, cls->ProgID->VersionInd->ProgID ); } } @@ -860,18 +803,18 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) if (cls->AppID) { MSIAPPID *appid = cls->AppID; - msi_reg_set_val_str( hkey2, szAppID, appid->AppID ); + msi_reg_set_val_str( hkey2, L"AppID", appid->AppID ); register_appid( appid, cls->Description ); } if (cls->IconPath) - msi_reg_set_subkey_val( hkey2, szDefaultIcon, NULL, cls->IconPath ); + msi_reg_set_subkey_val( hkey2, L"DefaultIcon", NULL, cls->IconPath ); if (cls->DefInprocHandler) - msi_reg_set_subkey_val( hkey2, szInprocHandler, NULL, cls->DefInprocHandler ); + msi_reg_set_subkey_val( hkey2, L"InprocHandler", NULL, cls->DefInprocHandler ); if (cls->DefInprocHandler32) - msi_reg_set_subkey_val( hkey2, szInprocHandler32, NULL, cls->DefInprocHandler32 ); + msi_reg_set_subkey_val( hkey2, L"InprocHandler32", NULL, cls->DefInprocHandler32 ); RegCloseKey(hkey2); /* if there is a FileTypeMask, register the FileType */ @@ -886,9 +829,9 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) ptr2 = wcschr(ptr,';'); if (ptr2) *ptr2 = 0; - keyname = msi_alloc( (lstrlenW(szFileType_fmt) + lstrlenW(cls->clsid) + 4) * sizeof(WCHAR)); - swprintf( keyname, lstrlenW(szFileType_fmt) + lstrlenW(cls->clsid) + 4, - szFileType_fmt, cls->clsid, index ); + keyname = msi_alloc( (lstrlenW(L"FileType\\%s\\%d") + lstrlenW(cls->clsid) + 4) * sizeof(WCHAR)); + swprintf( keyname, lstrlenW(L"FileType\\%s\\%d") + lstrlenW(cls->clsid) + 4, + L"FileType\\%s\\%d", cls->clsid, index ); msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, ptr ); msi_free(keyname); @@ -913,7 +856,6 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package ) { - static const WCHAR szFileType[] = {'F','i','l','e','T','y','p','e','\\',0}; REGSAM access = KEY_ALL_ACCESS; MSIRECORD *uirow; MSICLASS *cls; @@ -921,7 +863,7 @@ UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package ) UINT r; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szUnregisterClassInfo); + return msi_schedule_action( package, SCRIPT_INSTALL, L"UnregisterClassInfo" ); r = load_classes_and_such( package ); if (r != ERROR_SUCCESS) @@ -932,7 +874,7 @@ UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package ) else access |= KEY_WOW64_64KEY; - if (RegCreateKeyExW( HKEY_CLASSES_ROOT, szCLSID, 0, NULL, 0, access, NULL, &hkey, NULL )) + if (RegCreateKeyExW( HKEY_CLASSES_ROOT, L"CLSID", 0, NULL, 0, access, NULL, &hkey, NULL )) return ERROR_FUNCTION_FAILED; LIST_FOR_EACH_ENTRY( cls, &package->classes, MSICLASS, entry ) @@ -973,7 +915,7 @@ UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package ) if (cls->AppID) { - res = RegOpenKeyW( HKEY_CLASSES_ROOT, szAppID, &hkey2 ); + res = RegOpenKeyW( HKEY_CLASSES_ROOT, L"AppID", &hkey2 ); if (res == ERROR_SUCCESS) { res = RegDeleteKeyW( hkey2, cls->AppID->AppID ); @@ -984,10 +926,10 @@ UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package ) } if (cls->FileTypeMask) { - filetype = msi_alloc( (lstrlenW( szFileType ) + lstrlenW( cls->clsid ) + 1) * sizeof(WCHAR) ); + filetype = msi_alloc( (lstrlenW( L"FileType\\" ) + lstrlenW( cls->clsid ) + 1) * sizeof(WCHAR) ); if (filetype) { - lstrcpyW( filetype, szFileType ); + lstrcpyW( filetype, L"FileType\\" ); lstrcatW( filetype, cls->clsid ); res = RegDeleteTreeW( HKEY_CLASSES_ROOT, filetype ); msi_free( filetype ); @@ -1021,7 +963,6 @@ static LPCWSTR get_clsid_of_progid( const MSIPROGID *progid ) static UINT register_progid( const MSIPROGID* progid ) { - static const WCHAR szCurVer[] = {'C','u','r','V','e','r',0}; HKEY hkey = 0; UINT rc; @@ -1031,7 +972,7 @@ static UINT register_progid( const MSIPROGID* progid ) LPCWSTR clsid = get_clsid_of_progid( progid ); if (clsid) - msi_reg_set_subkey_val( hkey, szCLSID, NULL, clsid ); + msi_reg_set_subkey_val( hkey, L"CLSID", NULL, clsid ); else TRACE("%s has no class\n", debugstr_w( progid->ProgID ) ); @@ -1039,11 +980,11 @@ static UINT register_progid( const MSIPROGID* progid ) msi_reg_set_val_str( hkey, NULL, progid->Description ); if (progid->IconPath) - msi_reg_set_subkey_val( hkey, szDefaultIcon, NULL, progid->IconPath ); + msi_reg_set_subkey_val( hkey, L"DefaultIcon", NULL, progid->IconPath ); /* write out the current version */ if (progid->CurVer) - msi_reg_set_subkey_val( hkey, szCurVer, NULL, progid->CurVer->ProgID ); + msi_reg_set_subkey_val( hkey, L"CurVer", NULL, progid->CurVer->ProgID ); RegCloseKey(hkey); } @@ -1089,7 +1030,7 @@ UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package) UINT r; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szRegisterProgIdInfo); + return msi_schedule_action( package, SCRIPT_INSTALL, L"RegisterProgIdInfo" ); r = load_classes_and_such( package ); if (r != ERROR_SUCCESS) @@ -1152,7 +1093,7 @@ UINT ACTION_UnregisterProgIdInfo( MSIPACKAGE *package ) UINT r; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szUnregisterProgIdInfo); + return msi_schedule_action( package, SCRIPT_INSTALL, L"UnregisterProgIdInfo" ); r = load_classes_and_such( package ); if (r != ERROR_SUCCESS) @@ -1180,21 +1121,17 @@ UINT ACTION_UnregisterProgIdInfo( MSIPACKAGE *package ) return ERROR_SUCCESS; } -static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, +static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, MSICOMPONENT* component, const MSIEXTENSION* extension, MSIVERB* verb, INT* Sequence ) { LPWSTR keyname; HKEY key; - static const WCHAR szShell[] = {'s','h','e','l','l',0}; - static const WCHAR szCommand[] = {'c','o','m','m','a','n','d',0}; - static const WCHAR fmt[] = {'\"','%','s','\"',' ','%','s',0}; - static const WCHAR fmt2[] = {'\"','%','s','\"',0}; LPWSTR command; DWORD size; LPWSTR advertise; - keyname = msi_build_directory_name(4, progid, szShell, verb->Verb, szCommand); + keyname = msi_build_directory_name(4, progid, L"shell", verb->Verb, L"command"); TRACE("Making Key %s\n",debugstr_w(keyname)); RegCreateKeyW(HKEY_CLASSES_ROOT, keyname, &key); @@ -1205,9 +1142,9 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, command = msi_alloc(size * sizeof (WCHAR)); if (verb->Argument) - swprintf(command, size, fmt, component->FullKeypath, verb->Argument); + swprintf(command, size, L"\"%s\" %s", component->FullKeypath, verb->Argument); else - swprintf(command, size, fmt2, component->FullKeypath); + swprintf(command, size, L"\"%s\"", component->FullKeypath); msi_reg_set_val_str( key, NULL, command ); msi_free(command); @@ -1225,12 +1162,12 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, lstrcpyW(command,advertise); if (verb->Argument) { - lstrcatW(command,szSpace); - lstrcatW(command,verb->Argument); + lstrcatW(command, L" "); + lstrcatW(command, verb->Argument); } - msi_reg_set_val_multi_str( key, szCommand, command ); - + msi_reg_set_val_multi_str( key, L"command", command ); + RegCloseKey(key); msi_free(keyname); msi_free(advertise); @@ -1238,7 +1175,7 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, if (verb->Command) { - keyname = msi_build_directory_name( 3, progid, szShell, verb->Verb ); + keyname = msi_build_directory_name( 3, progid, L"shell", verb->Verb ); msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, verb->Command ); msi_free(keyname); } @@ -1248,7 +1185,7 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, if (*Sequence == MSI_NULL_INTEGER || verb->Sequence < *Sequence) { *Sequence = verb->Sequence; - keyname = msi_build_directory_name( 2, progid, szShell ); + keyname = msi_build_directory_name( 2, progid, L"shell" ); msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, verb->Verb ); msi_free(keyname); } @@ -1258,7 +1195,6 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) { - static const WCHAR szContentType[] = {'C','o','n','t','e','n','t',' ','T','y','p','e',0}; HKEY hkey = NULL; MSIEXTENSION *ext; MSIRECORD *uirow; @@ -1267,7 +1203,7 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) UINT r; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szRegisterExtensionInfo); + return msi_schedule_action( package, SCRIPT_INSTALL, L"RegisterExtensionInfo" ); r = load_classes_and_such( package ); if (r != ERROR_SUCCESS) @@ -1277,12 +1213,12 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) * shortcuts and the like. Because Mike McCormack is working on this i am * going to default to TRUE */ - + LIST_FOR_EACH_ENTRY( ext, &package->extensions, MSIEXTENSION, entry ) { LPWSTR extension; MSIFEATURE *feature; - + if (!ext->Component) continue; @@ -1296,7 +1232,7 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) if (!feature) continue; - /* + /* * yes. MSDN says that these are based on _Feature_ not on * Component. So verify the feature is to be installed */ @@ -1324,18 +1260,16 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) } if (ext->Mime) - msi_reg_set_val_str( hkey, szContentType, ext->Mime->ContentType ); + msi_reg_set_val_str( hkey, L"Content Type", ext->Mime->ContentType ); if (ext->ProgID || ext->ProgIDText) { - static const WCHAR szSN[] = - {'\\','S','h','e','l','l','N','e','w',0}; HKEY hkey2; LPWSTR newkey; LPCWSTR progid; MSIVERB *verb; INT Sequence = MSI_NULL_INTEGER; - + if (ext->ProgID) progid = ext->ProgID->ProgID; else @@ -1343,11 +1277,11 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) msi_reg_set_val_str( hkey, NULL, progid ); - newkey = msi_alloc( (lstrlenW(progid)+lstrlenW(szSN)+1) * sizeof(WCHAR)); + newkey = msi_alloc( (lstrlenW(progid) + lstrlenW(L"\\ShellNew") + 1) * sizeof(WCHAR)); - lstrcpyW(newkey,progid); - lstrcatW(newkey,szSN); - RegCreateKeyW(hkey,newkey,&hkey2); + lstrcpyW(newkey, progid); + lstrcatW(newkey, L"\\ShellNew"); + RegCreateKeyW(hkey, newkey, &hkey2); RegCloseKey(hkey2); msi_free(newkey); @@ -1359,7 +1293,7 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) ext, verb, &Sequence); } } - + RegCloseKey(hkey); uirow = MSI_CreateRecord(1); @@ -1378,7 +1312,7 @@ UINT ACTION_UnregisterExtensionInfo( MSIPACKAGE *package ) UINT r; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szUnregisterExtensionInfo); + return msi_schedule_action( package, SCRIPT_INSTALL, L"UnregisterExtensionInfo" ); r = load_classes_and_such( package ); if (r != ERROR_SUCCESS) @@ -1426,7 +1360,6 @@ UINT ACTION_UnregisterExtensionInfo( MSIPACKAGE *package ) if (ext->ProgID || ext->ProgIDText) { - static const WCHAR shellW[] = {'\\','s','h','e','l','l',0}; LPCWSTR progid; LPWSTR progid_shell; @@ -1435,11 +1368,11 @@ UINT ACTION_UnregisterExtensionInfo( MSIPACKAGE *package ) else progid = ext->ProgIDText; - progid_shell = msi_alloc( (lstrlenW( progid ) + lstrlenW( shellW ) + 1) * sizeof(WCHAR) ); + progid_shell = msi_alloc( (lstrlenW( progid ) + lstrlenW( L"\\shell" ) + 1) * sizeof(WCHAR) ); if (progid_shell) { lstrcpyW( progid_shell, progid ); - lstrcatW( progid_shell, shellW ); + lstrcatW( progid_shell, L"\\shell" ); res = RegDeleteTreeW( HKEY_CLASSES_ROOT, progid_shell ); msi_free( progid_shell ); if (res != ERROR_SUCCESS) @@ -1458,13 +1391,12 @@ UINT ACTION_UnregisterExtensionInfo( MSIPACKAGE *package ) UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package) { - static const WCHAR szExtension[] = {'E','x','t','e','n','s','i','o','n',0}; MSIRECORD *uirow; MSIMIME *mt; UINT r; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szRegisterMIMEInfo); + return msi_schedule_action( package, SCRIPT_INSTALL, L"RegisterMIMEInfo" ); r = load_classes_and_such( package ); if (r != ERROR_SUCCESS) @@ -1474,7 +1406,7 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package) { LPWSTR extension = NULL, key; - /* + /* * check if the MIME is to be installed. Either as requested by an * extension or Class */ @@ -1488,19 +1420,20 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package) TRACE("Registering MIME type %s\n", debugstr_w(mt->ContentType)); if (mt->Extension) extension = msi_alloc( (lstrlenW( mt->Extension->Extension ) + 2) * sizeof(WCHAR) ); - key = msi_alloc( (lstrlenW( mt->ContentType ) + lstrlenW( szMIMEDatabase ) + 1) * sizeof(WCHAR) ); + key = msi_alloc( (lstrlenW( mt->ContentType ) + + lstrlenW( L"MIME\\Database\\Content Type\\" ) + 1) * sizeof(WCHAR) ); if (extension && key) { extension[0] = '.'; lstrcpyW( extension + 1, mt->Extension->Extension ); - lstrcpyW( key, szMIMEDatabase ); + lstrcpyW( key, L"MIME\\Database\\Content Type\\" ); lstrcatW( key, mt->ContentType ); - msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, key, szExtension, extension ); + msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, key, L"Extension", extension ); if (mt->clsid) - msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, key, szCLSID, mt->clsid ); + msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, key, L"CLSID", mt->clsid ); } msi_free( extension ); msi_free( key ); @@ -1521,7 +1454,7 @@ UINT ACTION_UnregisterMIMEInfo( MSIPACKAGE *package ) UINT r; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szUnregisterMIMEInfo); + return msi_schedule_action( package, SCRIPT_INSTALL, L"UnregisterMIMEInfo" ); r = load_classes_and_such( package ); if (r != ERROR_SUCCESS) @@ -1541,10 +1474,11 @@ UINT ACTION_UnregisterMIMEInfo( MSIPACKAGE *package ) TRACE("Unregistering MIME type %s\n", debugstr_w(mime->ContentType)); - mime_key = msi_alloc( (lstrlenW( szMIMEDatabase ) + lstrlenW( mime->ContentType ) + 1) * sizeof(WCHAR) ); + mime_key = msi_alloc( (lstrlenW( L"MIME\\Database\\Content Type\\" ) + + lstrlenW( mime->ContentType ) + 1) * sizeof(WCHAR) ); if (mime_key) { - lstrcpyW( mime_key, szMIMEDatabase ); + lstrcpyW( mime_key, L"MIME\\Database\\Content Type\\" ); lstrcatW( mime_key, mime->ContentType ); res = RegDeleteKeyW( HKEY_CLASSES_ROOT, mime_key ); if (res != ERROR_SUCCESS)
2 years, 9 months
1
0
0
0
[reactos] 307/360: [WINESYNC] msi: Use wide character string literals in registry.c.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0f67ae4bdac36a7f74adf…
commit 0f67ae4bdac36a7f74adfc772a1969700da47c7a Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 21:31:36 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:35 2022 +0100 [WINESYNC] msi: Use wide character string literals in registry.c. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 2672646eaeb1877e0d746e8554529396ec8d9eb1 by Hans Leidekker <hans(a)codeweavers.com> --- dll/win32/msi/registry.c | 349 ++++++++++++++--------------------------------- 1 file changed, 104 insertions(+), 245 deletions(-) diff --git a/dll/win32/msi/registry.c b/dll/win32/msi/registry.c index 4d439d0b304..623bc1866d3 100644 --- a/dll/win32/msi/registry.c +++ b/dll/win32/msi/registry.c @@ -38,151 +38,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); -/* - * This module will be all the helper functions for registry access by the - * installer bits. - */ - -static const WCHAR szUserDataFeatures_fmt[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','s','t','a','l','l','e','r','\\','U','s','e','r','D','a','t','a','\\', - '%','s','\\','P','r','o','d','u','c','t','s','\\','%','s','\\','F','e','a','t','u','r','e','s',0}; - -static const WCHAR szUserDataComp_fmt[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','s','t','a','l','l','e','r','\\','U','s','e','r','D','a','t','a','\\', - '%','s','\\','C','o','m','p','o','n','e','n','t','s','\\','%','s',0}; - -static const WCHAR szUserDataComponents_fmt[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','s','t','a','l','l','e','r','\\','U','s','e','r','D','a','t','a','\\', - '%','s','\\','C','o','m','p','o','n','e','n','t','s',0}; - -static const WCHAR szUserDataProd_fmt[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','s','t','a','l','l','e','r','\\','U','s','e','r','D','a','t','a','\\', - '%','s','\\','P','r','o','d','u','c','t','s','\\','%','s',0}; - -static const WCHAR szUserDataProducts_fmt[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','s','t','a','l','l','e','r','\\','U','s','e','r','D','a','t','a','\\', - '%','s','\\','P','r','o','d','u','c','t','s',0}; - -static const WCHAR szUserDataPatch_fmt[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','s','t','a','l','l','e','r','\\','U','s','e','r','D','a','t','a','\\', - '%','s','\\','P','a','t','c','h','e','s','\\','%','s',0}; - -static const WCHAR szUserDataPatches_fmt[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','s','t','a','l','l','e','r','\\','U','s','e','r','D','a','t','a','\\', - '%','s','\\','P','a','t','c','h','e','s',0}; - -static const WCHAR szUserDataProductPatches_fmt[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','s','t','a','l','l','e','r','\\','U','s','e','r','D','a','t','a','\\', - '%','s','\\','P','r','o','d','u','c','t','s','\\','%','s','\\','P','a','t','c','h','e','s',0}; - -static const WCHAR szInstallProperties_fmt[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','s','t','a','l','l','e','r','\\','U','s','e','r','D','a','t','a','\\', - '%','s','\\','P','r','o','d','u','c','t','s','\\','%','s','\\', - 'I','n','s','t','a','l','l','P','r','o','p','e','r','t','i','e','s',0}; - -static const WCHAR szInstaller_LocalManagedProd_fmt[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','s','t','a','l','l','e','r','\\','M','a','n','a','g','e','d','\\','%','s','\\', - 'I','n','s','t','a','l','l','e','r','\\','P','r','o','d','u','c','t','s','\\','%','s',0}; - -static const WCHAR szInstaller_LocalManagedFeat_fmt[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','s','t','a','l','l','e','r','\\','M','a','n','a','g','e','d','\\','%','s','\\', - 'I','n','s','t','a','l','l','e','r','\\','F','e','a','t','u','r','e','s','\\','%','s',0}; - -static const WCHAR szInstaller_Products[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','s','t','a','l','l','e','r','\\','P','r','o','d','u','c','t','s',0}; - -static const WCHAR szInstaller_Patches[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','s','t','a','l','l','e','r','\\','P','a','t','c','h','e','s',0}; - -static const WCHAR szInstaller_LocalClassesProducts[] = { - 'S','o','f','t','w','a','r','e','\\','C','l','a','s','s','e','s','\\', - 'I','n','s','t','a','l','l','e','r','\\','P','r','o','d','u','c','t','s',0}; - -static const WCHAR szInstaller_LocalClassesFeatures[] = { - 'S','o','f','t','w','a','r','e','\\','C','l','a','s','s','e','s','\\', - 'I','n','s','t','a','l','l','e','r','\\','F','e','a','t','u','r','e','s',0}; - -static const WCHAR szInstaller_LocalClassesProd[] = { - 'S','o','f','t','w','a','r','e','\\','C','l','a','s','s','e','s','\\', - 'I','n','s','t','a','l','l','e','r','\\','P','r','o','d','u','c','t','s','\\',0}; - -static const WCHAR szInstaller_LocalClassesFeat[] = { - 'S','o','f','t','w','a','r','e','\\','C','l','a','s','s','e','s','\\', - 'I','n','s','t','a','l','l','e','r','\\','F','e','a','t','u','r','e','s','\\',0}; - -static const WCHAR szInstaller_ClassesUpgradeCode[] = { - 'S','o','f','t','w','a','r','e','\\','C','l','a','s','s','e','s','\\', - 'I','n','s','t','a','l','l','e','r','\\','U','p','g','r','a','d','e','C','o','d','e','s','\\',0}; - -static const WCHAR szInstaller_ClassesUpgradeCodes[] = { - 'S','o','f','t','w','a','r','e','\\','C','l','a','s','s','e','s','\\', - 'I','n','s','t','a','l','l','e','r','\\','U','p','g','r','a','d','e','C','o','d','e','s',0}; - -static const WCHAR szInstaller_Features[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','s','t','a','l','l','e','r','\\','F','e','a','t','u','r','e','s','\\',0}; - -static const WCHAR szInstaller_UpgradeCodes[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','s','t','a','l','l','e','r','\\','U','p','g','r','a','d','e','C','o','d','e','s','\\',0}; - -static const WCHAR szInstaller_UserUpgradeCodes[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'I','n','s','t','a','l','l','e','r','\\','U','p','g','r','a','d','e','C','o','d','e','s','\\',0}; - -static const WCHAR szUninstall[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'U','n','i','n','s','t','a','l','l','\\',0}; - -static const WCHAR szUserComponents[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'I','n','s','t','a','l','l','e','r','\\','C','o','m','p','o','n','e','n','t','s','\\',0}; - -static const WCHAR szInstaller_Components[] = { - 'S','o','f','t','w','a','r','e','\\','C','l','a','s','s','e','s','\\', - 'I','n','s','t','a','l','l','e','r','\\','C','o','m','p','o','n','e','n','t','s','\\',0}; - -static const WCHAR szUserFeatures[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'I','n','s','t','a','l','l','e','r','\\','F','e','a','t','u','r','e','s','\\',0}; - -static const WCHAR szUserProducts[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'I','n','s','t','a','l','l','e','r','\\','P','r','o','d','u','c','t','s','\\',0}; - -static const WCHAR szUserPatches[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'I','n','s','t','a','l','l','e','r','\\','P','a','t','c','h','e','s','\\',0}; - BOOL unsquash_guid(LPCWSTR in, LPWSTR out) { DWORD i,n=0; @@ -354,7 +209,7 @@ DWORD msi_version_str_to_dword(LPCWSTR p) LONG msi_reg_set_val_str( HKEY hkey, LPCWSTR name, LPCWSTR value ) { DWORD len; - if (!value) value = szEmpty; + if (!value) value = L""; len = (lstrlenW(value) + 1) * sizeof (WCHAR); return RegSetValueExW( hkey, name, 0, REG_SZ, (const BYTE *)value, len ); } @@ -455,7 +310,7 @@ UINT MSIREG_OpenUninstallKey(const WCHAR *product, enum platform platform, HKEY access |= KEY_WOW64_32KEY; else access |= KEY_WOW64_64KEY; - lstrcpyW(keypath, szUninstall); + lstrcpyW(keypath, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"); lstrcatW(keypath, product); if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key); @@ -473,8 +328,8 @@ UINT MSIREG_DeleteUninstallKey(const WCHAR *product, enum platform platform) access |= KEY_WOW64_32KEY; else access |= KEY_WOW64_64KEY; - if ((r = RegOpenKeyExW(HKEY_LOCAL_MACHINE, szUninstall, 0, access, &parent))) - return r; + if ((r = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\", + 0, access, &parent))) return r; r = RegDeleteTreeW(parent, product); RegCloseKey(parent); return r; @@ -491,13 +346,13 @@ UINT MSIREG_OpenProductKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTE if (context == MSIINSTALLCONTEXT_MACHINE) { - lstrcpyW(keypath, szInstaller_LocalClassesProd); + lstrcpyW(keypath, L"Software\\Classes\\Installer\\Products\\"); lstrcatW( keypath, squashed_pc ); } else if (context == MSIINSTALLCONTEXT_USERUNMANAGED) { root = HKEY_CURRENT_USER; - lstrcpyW(keypath, szUserProducts); + lstrcpyW( keypath, L"Software\\Microsoft\\Installer\\Products\\" ); lstrcatW( keypath, squashed_pc ); } else @@ -511,7 +366,9 @@ UINT MSIREG_OpenProductKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTE } szUserSid = usersid; } - swprintf( keypath, ARRAY_SIZE(keypath), szInstaller_LocalManagedProd_fmt, szUserSid, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), + L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\%s\\Installer\\Products\\%s", + szUserSid, squashed_pc ); LocalFree(usersid); } if (create) return RegCreateKeyExW(root, keypath, 0, NULL, 0, access, NULL, key, NULL); @@ -525,7 +382,7 @@ UINT MSIREG_DeleteUserProductKey(LPCWSTR szProduct) if (!squash_guid( szProduct, squashed_pc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc)); - lstrcpyW(keypath, szUserProducts); + lstrcpyW( keypath, L"Software\\Microsoft\\Installer\\Products\\" ); lstrcatW( keypath, squashed_pc ); return RegDeleteTreeW(HKEY_CURRENT_USER, keypath); } @@ -537,7 +394,7 @@ UINT MSIREG_OpenUserPatchesKey(LPCWSTR szPatch, HKEY *key, BOOL create) if (!squash_guid( szPatch, squashed_pc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szPatch), debugstr_w(squashed_pc)); - lstrcpyW(keypath, szUserPatches); + lstrcpyW( keypath, L"Software\\Microsoft\\Installer\\Patches\\" ); lstrcatW( keypath, squashed_pc ); if (create) return RegCreateKeyW(HKEY_CURRENT_USER, keypath, key); @@ -556,13 +413,13 @@ UINT MSIREG_OpenFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONT if (context == MSIINSTALLCONTEXT_MACHINE) { - lstrcpyW(keypath, szInstaller_LocalClassesFeat); + lstrcpyW(keypath, L"Software\\Classes\\Installer\\Features\\"); lstrcatW( keypath, squashed_pc ); } else if (context == MSIINSTALLCONTEXT_USERUNMANAGED) { root = HKEY_CURRENT_USER; - lstrcpyW(keypath, szUserFeatures); + lstrcpyW(keypath, L"Software\\Microsoft\\Installer\\Features\\"); lstrcatW( keypath, squashed_pc ); } else @@ -576,7 +433,9 @@ UINT MSIREG_OpenFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONT } szUserSid = usersid; } - swprintf( keypath, ARRAY_SIZE(keypath), szInstaller_LocalManagedFeat_fmt, szUserSid, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), + L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\%s\\Installer\\Features\\%s", + szUserSid, squashed_pc ); LocalFree(usersid); } if (create) return RegCreateKeyExW(root, keypath, 0, NULL, 0, access, NULL, key, NULL); @@ -590,7 +449,7 @@ UINT MSIREG_DeleteUserFeaturesKey(LPCWSTR szProduct) if (!squash_guid( szProduct, squashed_pc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc)); - lstrcpyW(keypath, szUserFeatures); + lstrcpyW( keypath, L"Software\\Microsoft\\Installer\\Features\\" ); lstrcatW( keypath, squashed_pc ); return RegDeleteTreeW(HKEY_CURRENT_USER, keypath); } @@ -603,7 +462,7 @@ static UINT MSIREG_OpenInstallerFeaturesKey(LPCWSTR szProduct, HKEY *key, BOOL c if (!squash_guid( szProduct, squashed_pc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc)); - lstrcpyW(keypath, szInstaller_Features); + lstrcpyW(keypath, L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Features\\"); lstrcatW( keypath, squashed_pc ); if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); @@ -613,6 +472,8 @@ static UINT MSIREG_OpenInstallerFeaturesKey(LPCWSTR szProduct, HKEY *key, BOOL c UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT context, HKEY *key, BOOL create) { + static const WCHAR fmtW[] = + L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products\\%s\\Features"; REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS; WCHAR squashed_pc[SQUASHED_GUID_SIZE], keypath[0x200], *usersid = NULL; @@ -621,7 +482,7 @@ UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINS if (context == MSIINSTALLCONTEXT_MACHINE) { - swprintf( keypath, ARRAY_SIZE(keypath), szUserDataFeatures_fmt, szLocalSid, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), fmtW, L"S-1-5-18", squashed_pc ); } else { @@ -634,7 +495,7 @@ UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINS } szUserSid = usersid; } - swprintf( keypath, ARRAY_SIZE(keypath), szUserDataFeatures_fmt, szUserSid, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), fmtW, szUserSid, squashed_pc ); LocalFree(usersid); } if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); @@ -650,20 +511,22 @@ UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY *key, BOOL create) if (!squash_guid( szComponent, squashed_cc)) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szComponent), debugstr_w(squashed_cc)); - lstrcpyW(keypath, szUserComponents); + lstrcpyW(keypath, L"Software\\Microsoft\\Installer\\Components\\"); lstrcatW( keypath, squashed_cc ); if (create) return RegCreateKeyW(HKEY_CURRENT_USER, keypath, key); ret = RegOpenKeyW(HKEY_CURRENT_USER, keypath, key); if (ret != ERROR_FILE_NOT_FOUND) return ret; - lstrcpyW(keypath, szInstaller_Components); + lstrcpyW(keypath, L"Software\\Classes\\Installer\\Components\\"); lstrcatW( keypath, squashed_cc ); return RegOpenKeyExW( HKEY_LOCAL_MACHINE, keypath, 0, access, key ); } UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid, HKEY *key, BOOL create) { + static const WCHAR fmtW[] = + L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Components\\%s"; REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS; WCHAR *usersid, squashed_comp[SQUASHED_GUID_SIZE], keypath[0x200]; @@ -677,11 +540,10 @@ UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid, HKE ERR("Failed to retrieve user SID\n"); return ERROR_FUNCTION_FAILED; } - swprintf( keypath, ARRAY_SIZE(keypath), szUserDataComp_fmt, usersid, squashed_comp ); + swprintf( keypath, ARRAY_SIZE(keypath), fmtW, usersid, squashed_comp ); LocalFree(usersid); } - else - swprintf( keypath, ARRAY_SIZE(keypath), szUserDataComp_fmt, szUserSid, squashed_comp ); + else swprintf( keypath, ARRAY_SIZE(keypath), fmtW, szUserSid, squashed_comp ); if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key); @@ -689,6 +551,8 @@ UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid, HKE UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid) { + static const WCHAR fmtW[] = + L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Components"; REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS; WCHAR *usersid, squashed_comp[SQUASHED_GUID_SIZE], keypath[0x200]; HKEY hkey; @@ -704,11 +568,10 @@ UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid) ERR("Failed to retrieve user SID\n"); return ERROR_FUNCTION_FAILED; } - swprintf(keypath, ARRAY_SIZE(keypath), szUserDataComponents_fmt, usersid); + swprintf(keypath, ARRAY_SIZE(keypath), fmtW, usersid); LocalFree(usersid); } - else - swprintf(keypath, ARRAY_SIZE(keypath), szUserDataComponents_fmt, szUserSid); + else swprintf(keypath, ARRAY_SIZE(keypath), fmtW, szUserSid); if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey)) return ERROR_SUCCESS; r = RegDeleteTreeW( hkey, squashed_comp ); @@ -718,6 +581,8 @@ UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid) UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, LPCWSTR szUserSid, HKEY *key, BOOL create) { + static const WCHAR fmtW[] = + L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products\\%s"; REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS; WCHAR *usersid, squashed_pc[SQUASHED_GUID_SIZE], keypath[0x200]; @@ -725,9 +590,9 @@ UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContex TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc)); if (dwContext == MSIINSTALLCONTEXT_MACHINE) - swprintf( keypath, ARRAY_SIZE(keypath), szUserDataProd_fmt, szLocalSid, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), fmtW, L"S-1-5-18", squashed_pc ); else if (szUserSid) - swprintf( keypath, ARRAY_SIZE(keypath), szUserDataProd_fmt, szUserSid, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), fmtW, szUserSid, squashed_pc ); else { if (!(usersid = get_user_sid())) @@ -735,7 +600,7 @@ UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContex ERR("Failed to retrieve user SID\n"); return ERROR_FUNCTION_FAILED; } - swprintf( keypath, ARRAY_SIZE(keypath), szUserDataProd_fmt, usersid, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), fmtW, usersid, squashed_pc ); LocalFree(usersid); } if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); @@ -744,6 +609,8 @@ UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContex UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext, HKEY *key, BOOL create) { + static const WCHAR fmtW[] = + L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Patches\\%s"; REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS; WCHAR *usersid, squashed_patch[SQUASHED_GUID_SIZE], keypath[0x200]; @@ -751,7 +618,7 @@ UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext, H TRACE("%s squashed %s\n", debugstr_w(szPatch), debugstr_w(squashed_patch)); if (dwContext == MSIINSTALLCONTEXT_MACHINE) - swprintf( keypath, ARRAY_SIZE(keypath), szUserDataPatch_fmt, szLocalSid, squashed_patch ); + swprintf( keypath, ARRAY_SIZE(keypath), fmtW, L"S-1-5-18", squashed_patch ); else { if (!(usersid = get_user_sid())) @@ -759,7 +626,7 @@ UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext, H ERR("Failed to retrieve user SID\n"); return ERROR_FUNCTION_FAILED; } - swprintf( keypath, ARRAY_SIZE(keypath), szUserDataPatch_fmt, usersid, squashed_patch ); + swprintf( keypath, ARRAY_SIZE(keypath), fmtW, usersid, squashed_patch ); LocalFree(usersid); } if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); @@ -768,6 +635,8 @@ UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext, H UINT MSIREG_DeleteUserDataPatchKey(LPCWSTR patch, MSIINSTALLCONTEXT context) { + static const WCHAR fmtW[] = + L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Patches"; REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS; WCHAR *usersid, squashed_patch[SQUASHED_GUID_SIZE], keypath[0x200]; HKEY hkey; @@ -777,7 +646,7 @@ UINT MSIREG_DeleteUserDataPatchKey(LPCWSTR patch, MSIINSTALLCONTEXT context) TRACE("%s squashed %s\n", debugstr_w(patch), debugstr_w(squashed_patch)); if (context == MSIINSTALLCONTEXT_MACHINE) - swprintf(keypath, ARRAY_SIZE(keypath), szUserDataPatches_fmt, szLocalSid); + swprintf(keypath, ARRAY_SIZE(keypath), fmtW, L"S-1-5-18"); else { if (!(usersid = get_user_sid())) @@ -785,7 +654,7 @@ UINT MSIREG_DeleteUserDataPatchKey(LPCWSTR patch, MSIINSTALLCONTEXT context) ERR("Failed to retrieve user SID\n"); return ERROR_FUNCTION_FAILED; } - swprintf(keypath, ARRAY_SIZE(keypath), szUserDataPatches_fmt, usersid); + swprintf(keypath, ARRAY_SIZE(keypath), fmtW, usersid); LocalFree(usersid); } if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey)) return ERROR_SUCCESS; @@ -796,6 +665,8 @@ UINT MSIREG_DeleteUserDataPatchKey(LPCWSTR patch, MSIINSTALLCONTEXT context) UINT MSIREG_OpenUserDataProductPatchesKey(LPCWSTR product, MSIINSTALLCONTEXT context, HKEY *key, BOOL create) { + static const WCHAR fmtW[] = + L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products\\%s\\Patches"; REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS; WCHAR *usersid, squashed_product[SQUASHED_GUID_SIZE], keypath[0x200]; @@ -803,7 +674,7 @@ UINT MSIREG_OpenUserDataProductPatchesKey(LPCWSTR product, MSIINSTALLCONTEXT con TRACE("%s squashed %s\n", debugstr_w(product), debugstr_w(squashed_product)); if (context == MSIINSTALLCONTEXT_MACHINE) - swprintf( keypath, ARRAY_SIZE(keypath), szUserDataProductPatches_fmt, szLocalSid, squashed_product ); + swprintf( keypath, ARRAY_SIZE(keypath), fmtW, L"S-1-5-18", squashed_product ); else { if (!(usersid = get_user_sid())) @@ -811,7 +682,7 @@ UINT MSIREG_OpenUserDataProductPatchesKey(LPCWSTR product, MSIINSTALLCONTEXT con ERR("Failed to retrieve user SID\n"); return ERROR_FUNCTION_FAILED; } - swprintf( keypath, ARRAY_SIZE(keypath), szUserDataProductPatches_fmt, usersid, squashed_product ); + swprintf( keypath, ARRAY_SIZE(keypath), fmtW, usersid, squashed_product ); LocalFree(usersid); } if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); @@ -820,6 +691,8 @@ UINT MSIREG_OpenUserDataProductPatchesKey(LPCWSTR product, MSIINSTALLCONTEXT con UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, LPCWSTR szUserSid, HKEY *key, BOOL create) { + static const WCHAR fmtW[] = + L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products\\%s\\InstallProperties"; REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS; WCHAR *usersid, squashed_pc[SQUASHED_GUID_SIZE], keypath[0x200]; @@ -827,9 +700,9 @@ UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, LPC TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc)); if (dwContext == MSIINSTALLCONTEXT_MACHINE) - swprintf( keypath, ARRAY_SIZE(keypath), szInstallProperties_fmt, szLocalSid, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), fmtW, L"S-1-5-18", squashed_pc ); else if (szUserSid) - swprintf( keypath, ARRAY_SIZE(keypath), szInstallProperties_fmt, szUserSid, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), fmtW, szUserSid, squashed_pc ); else { if (!(usersid = get_user_sid())) @@ -837,7 +710,7 @@ UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, LPC ERR("Failed to retrieve user SID\n"); return ERROR_FUNCTION_FAILED; } - swprintf( keypath, ARRAY_SIZE(keypath), szInstallProperties_fmt, usersid, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), fmtW, usersid, squashed_pc ); LocalFree(usersid); } if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); @@ -846,6 +719,8 @@ UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, LPC UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT context) { + static const WCHAR fmtW[] = + L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products"; REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS; WCHAR *usersid, squashed_pc[SQUASHED_GUID_SIZE], keypath[0x200]; HKEY hkey; @@ -855,7 +730,7 @@ UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT contex TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc)); if (context == MSIINSTALLCONTEXT_MACHINE) - swprintf(keypath, ARRAY_SIZE(keypath), szUserDataProducts_fmt, szLocalSid); + swprintf(keypath, ARRAY_SIZE(keypath), fmtW, L"S-1-5-18"); else { if (!(usersid = get_user_sid())) @@ -863,7 +738,7 @@ UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT contex ERR("Failed to retrieve user SID\n"); return ERROR_FUNCTION_FAILED; } - swprintf(keypath, ARRAY_SIZE(keypath), szUserDataProducts_fmt, usersid); + swprintf(keypath, ARRAY_SIZE(keypath), fmtW, usersid); LocalFree(usersid); } @@ -883,7 +758,8 @@ UINT MSIREG_DeleteProductKey(LPCWSTR szProduct) if (!squash_guid( szProduct, squashed_pc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc)); - if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szInstaller_Products, 0, access, &hkey)) return ERROR_SUCCESS; + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Products", + 0, access, &hkey)) return ERROR_SUCCESS; r = RegDeleteTreeW( hkey, squashed_pc ); RegCloseKey(hkey); return r; @@ -897,7 +773,8 @@ UINT MSIREG_OpenPatchesKey(LPCWSTR szPatch, HKEY *key, BOOL create) if (!squash_guid( szPatch, squashed_pc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szPatch), debugstr_w(squashed_pc)); - swprintf( keypath, ARRAY_SIZE(keypath), szInstaller_Patches, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Patches", + squashed_pc ); if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key); @@ -911,7 +788,7 @@ UINT MSIREG_OpenUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY *key, BOOL create) if (!squash_guid( szUpgradeCode, squashed_uc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szUpgradeCode), debugstr_w(squashed_uc)); - lstrcpyW(keypath, szInstaller_UpgradeCodes); + lstrcpyW( keypath, L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UpgradeCodes\\" ); lstrcatW( keypath, squashed_uc ); if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); @@ -925,7 +802,7 @@ UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL creat if (!squash_guid( szUpgradeCode, squashed_uc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szUpgradeCode), debugstr_w(squashed_uc)); - lstrcpyW(keypath, szInstaller_UserUpgradeCodes); + lstrcpyW(keypath, L"Software\\Microsoft\\Installer\\UpgradeCodes\\"); lstrcatW( keypath, squashed_uc ); if (create) return RegCreateKeyW(HKEY_CURRENT_USER, keypath, key); @@ -942,7 +819,8 @@ UINT MSIREG_DeleteUpgradeCodesKey( const WCHAR *code ) if (!squash_guid( code, squashed_code )) return ERROR_FUNCTION_FAILED; TRACE( "%s squashed %s\n", debugstr_w(code), debugstr_w(squashed_code) ); - if (RegOpenKeyExW( HKEY_LOCAL_MACHINE, szInstaller_UpgradeCodes, 0, access, &hkey )) return ERROR_SUCCESS; + if (RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UpgradeCodes\\", + 0, access, &hkey )) return ERROR_SUCCESS; ret = RegDeleteTreeW( hkey, squashed_code ); RegCloseKey( hkey ); return ret; @@ -955,7 +833,7 @@ UINT MSIREG_DeleteUserUpgradeCodesKey(LPCWSTR szUpgradeCode) if (!squash_guid( szUpgradeCode, squashed_uc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szUpgradeCode), debugstr_w(squashed_uc)); - lstrcpyW(keypath, szInstaller_UserUpgradeCodes); + lstrcpyW(keypath, L"Software\\Microsoft\\Installer\\UpgradeCodes\\"); lstrcatW( keypath, squashed_uc ); return RegDeleteTreeW(HKEY_CURRENT_USER, keypath); } @@ -970,7 +848,8 @@ UINT MSIREG_DeleteLocalClassesProductKey(LPCWSTR szProductCode) if (!squash_guid( szProductCode, squashed_pc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szProductCode), debugstr_w(squashed_pc)); - if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szInstaller_LocalClassesProducts, 0, access, &hkey)) return ERROR_SUCCESS; + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Classes\\Installer\\Products", 0, access, &hkey)) + return ERROR_SUCCESS; r = RegDeleteTreeW( hkey, squashed_pc ); RegCloseKey(hkey); return r; @@ -986,7 +865,8 @@ UINT MSIREG_DeleteLocalClassesFeaturesKey(LPCWSTR szProductCode) if (!squash_guid( szProductCode, squashed_pc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szProductCode), debugstr_w(squashed_pc)); - if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szInstaller_LocalClassesFeatures, 0, access, &hkey)) return ERROR_SUCCESS; + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Classes\\Installer\\Features", 0, access, &hkey)) + return ERROR_SUCCESS; r = RegDeleteTreeW( hkey, squashed_pc ); RegCloseKey(hkey); return r; @@ -1000,7 +880,7 @@ UINT MSIREG_OpenClassesUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY *key, BOOL cr if (!squash_guid( szUpgradeCode, squashed_uc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szUpgradeCode), debugstr_w(squashed_uc)); - lstrcpyW(keypath, szInstaller_ClassesUpgradeCode); + lstrcpyW(keypath, L"Software\\Classes\\Installer\\UpgradeCodes\\"); lstrcatW( keypath, squashed_uc ); if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); @@ -1017,7 +897,8 @@ UINT MSIREG_DeleteClassesUpgradeCodesKey(LPCWSTR szUpgradeCode) if (!squash_guid( szUpgradeCode, squashed_uc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szUpgradeCode), debugstr_w(squashed_uc)); - if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szInstaller_ClassesUpgradeCodes, 0, access, &hkey)) return ERROR_SUCCESS; + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Classes\\Installer\\UpgradeCodes", 0, access, &hkey)) + return ERROR_SUCCESS; r = RegDeleteTreeW( hkey, squashed_uc ); RegCloseKey(hkey); return r; @@ -1163,12 +1044,11 @@ UINT WINAPI MsiEnumProductsW(DWORD index, LPWSTR lpguid) if (NULL == lpguid) return ERROR_INVALID_PARAMETER; - return MsiEnumProductsExW( NULL, szAllSid, MSIINSTALLCONTEXT_ALL, index, lpguid, + return MsiEnumProductsExW( NULL, L"S-1-1-0", MSIINSTALLCONTEXT_ALL, index, lpguid, NULL, NULL, NULL ); } -UINT WINAPI MsiEnumFeaturesA(LPCSTR szProduct, DWORD index, - LPSTR szFeature, LPSTR szParent) +UINT WINAPI MsiEnumFeaturesA(LPCSTR szProduct, DWORD index, LPSTR szFeature, LPSTR szParent) { DWORD r; WCHAR szwFeature[GUID_SIZE], szwParent[GUID_SIZE]; @@ -1197,8 +1077,7 @@ UINT WINAPI MsiEnumFeaturesA(LPCSTR szProduct, DWORD index, return r; } -UINT WINAPI MsiEnumFeaturesW(LPCWSTR szProduct, DWORD index, - LPWSTR szFeature, LPWSTR szParent) +UINT WINAPI MsiEnumFeaturesW(LPCWSTR szProduct, DWORD index, LPWSTR szFeature, LPWSTR szParent) { HKEY hkeyProduct = 0; DWORD r, sz; @@ -1241,7 +1120,7 @@ UINT WINAPI MsiEnumComponentsW(DWORD index, LPWSTR lpguid) if (!lpguid) return ERROR_INVALID_PARAMETER; - return MsiEnumComponentsExW( szAllSid, MSIINSTALLCONTEXT_ALL, index, lpguid, NULL, NULL, NULL ); + return MsiEnumComponentsExW( L"S-1-1-0", MSIINSTALLCONTEXT_ALL, index, lpguid, NULL, NULL, NULL ); } UINT WINAPI MsiEnumComponentsExA( LPCSTR user_sid, DWORD ctx, DWORD index, CHAR guid[39], @@ -1274,18 +1153,15 @@ UINT WINAPI MsiEnumComponentsExA( LPCSTR user_sid, DWORD ctx, DWORD index, CHAR static UINT fetch_machine_component( DWORD ctx, DWORD index, DWORD *idx, WCHAR guid[39], MSIINSTALLCONTEXT *installed_ctx, LPWSTR sid, LPDWORD sid_len ) { - static const WCHAR componentsW[] = - {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','s','t','a','l','l','e','r','\\','U','s','e','r','D','a','t','a','\\', - 'S','-','1','-','5','-','1','8','\\','C','o','m','p','o','n','e','n','t','s',0}; UINT r = ERROR_SUCCESS; WCHAR component[SQUASHED_GUID_SIZE]; DWORD i = 0, len_component; REGSAM access = KEY_ENUMERATE_SUB_KEYS | KEY_WOW64_64KEY; HKEY key_components; - if (RegOpenKeyExW( HKEY_LOCAL_MACHINE, componentsW, 0, access, &key_components )) + if (RegOpenKeyExW( HKEY_LOCAL_MACHINE, + L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Components", + 0, access, &key_components )) return ERROR_NO_MORE_ITEMS; len_component = ARRAY_SIZE( component ); @@ -1323,11 +1199,6 @@ static UINT fetch_user_component( const WCHAR *usersid, DWORD ctx, DWORD index, WCHAR guid[39], MSIINSTALLCONTEXT *installed_ctx, LPWSTR sid, LPDWORD sid_len ) { - static const WCHAR userdataW[] = - {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','s','t','a','l','l','e','r','\\','U','s','e','r','D','a','t','a',0}; - static const WCHAR componentsW[] = {'\\','C','o','m','p','o','n','e','n','t','s',0}; UINT r = ERROR_SUCCESS; WCHAR path[MAX_PATH], component[SQUASHED_GUID_SIZE], user[128]; DWORD i = 0, j = 0, len_component, len_user; @@ -1337,21 +1208,21 @@ static UINT fetch_user_component( const WCHAR *usersid, DWORD ctx, DWORD index, if (ctx == MSIINSTALLCONTEXT_USERMANAGED) /* FIXME: where to find these? */ return ERROR_NO_MORE_ITEMS; - if (RegOpenKeyExW( HKEY_LOCAL_MACHINE, userdataW, 0, access, &key_users )) - return ERROR_NO_MORE_ITEMS; + if (RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData", + 0, access, &key_users )) return ERROR_NO_MORE_ITEMS; len_user = ARRAY_SIZE( user ); while (!RegEnumKeyExW( key_users, i, user, &len_user, NULL, NULL, NULL, NULL )) { - if ((wcscmp( usersid, szAllSid ) && wcscmp( usersid, user )) || - !wcscmp( szLocalSid, user )) + if ((wcscmp( usersid, L"S-1-1-0" ) && wcscmp( usersid, user )) || + !wcscmp( L"S-1-5-18", user )) { i++; len_user = ARRAY_SIZE( user ); continue; } lstrcpyW( path, user ); - lstrcatW( path, componentsW ); + lstrcatW( path, L"\\Components" ); if (RegOpenKeyExW( key_users, path, 0, access, &key_components )) { i++; @@ -1498,7 +1369,7 @@ UINT WINAPI MsiEnumClientsW(LPCWSTR szComponent, DWORD index, LPWSTR szProduct) return ERROR_INVALID_PARAMETER; if (MSIREG_OpenUserDataComponentKey(szComponent, NULL, &hkeyComp, FALSE) != ERROR_SUCCESS && - MSIREG_OpenUserDataComponentKey(szComponent, szLocalSid, &hkeyComp, FALSE) != ERROR_SUCCESS) + MSIREG_OpenUserDataComponentKey(szComponent, L"S-1-5-18", &hkeyComp, FALSE) != ERROR_SUCCESS) return ERROR_UNKNOWN_COMPONENT; /* see if there are any products at all */ @@ -1586,7 +1457,7 @@ static UINT MSI_EnumComponentQualifiers( LPCWSTR szComponent, DWORD iIndex, break; if (r != ERROR_MORE_DATA) goto end; - + if (type != REG_MULTI_SZ) { ERR("component data has wrong type (%d)\n", type); @@ -1850,7 +1721,7 @@ static UINT msi_get_patch_state(LPCWSTR prodcode, LPCWSTR usersid, if (r != ERROR_SUCCESS) return ERROR_NO_MORE_ITEMS; - res = RegOpenKeyExW(prod, szPatches, 0, KEY_READ, &hkey); + res = RegOpenKeyExW(prod, L"Patches", 0, KEY_READ, &hkey); if (res != ERROR_SUCCESS) goto done; @@ -1859,7 +1730,7 @@ static UINT msi_get_patch_state(LPCWSTR prodcode, LPCWSTR usersid, goto done; size = sizeof(DWORD); - res = RegGetValueW(udpatch, NULL, szState, RRF_RT_DWORD, &type, &val, &size); + res = RegGetValueW(udpatch, NULL, L"State", RRF_RT_DWORD, &type, &val, &size); if (res != ERROR_SUCCESS || val < MSIPATCHSTATE_APPLIED || val > MSIPATCHSTATE_REGISTERED) { @@ -1896,7 +1767,7 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid, return ERROR_NO_MORE_ITEMS; size = 0; - res = RegGetValueW(prod, szPatches, szPatches, RRF_RT_ANY, &type, NULL, + res = RegGetValueW(prod, L"Patches", L"Patches", RRF_RT_ANY, &type, NULL, &size); if (res != ERROR_SUCCESS) goto done; @@ -1914,7 +1785,7 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid, goto done; } - res = RegGetValueW(prod, szPatches, szPatches, RRF_RT_ANY, &type, + res = RegGetValueW(prod, L"Patches", L"Patches", RRF_RT_ANY, &type, patches, &size); if (res != ERROR_SUCCESS) goto done; @@ -1928,7 +1799,7 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid, } size = 0; - res = RegGetValueW(prod, szPatches, ptr, RRF_RT_REG_SZ, + res = RegGetValueW(prod, L"Patches", ptr, RRF_RT_REG_SZ, &type, NULL, &size); if (res != ERROR_SUCCESS) continue; @@ -1942,7 +1813,7 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid, goto done; } - res = RegGetValueW(prod, szPatches, ptr, RRF_RT_REG_SZ, + res = RegGetValueW(prod, L"Patches", ptr, RRF_RT_REG_SZ, &type, *transforms, &size); if (res != ERROR_SUCCESS) continue; @@ -1990,13 +1861,13 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid, } else if (context == MSIINSTALLCONTEXT_MACHINE) { - usersid = szEmpty; + usersid = L""; if (MSIREG_OpenUserDataProductKey(prodcode, context, NULL, &localprod, FALSE) == ERROR_SUCCESS && - RegOpenKeyExW(localprod, szPatches, 0, KEY_READ, &localpatch) == ERROR_SUCCESS && + RegOpenKeyExW(localprod, L"Patches", 0, KEY_READ, &localpatch) == ERROR_SUCCESS && RegOpenKeyExW(localpatch, ptr, 0, KEY_READ, &patchkey) == ERROR_SUCCESS) { - res = RegGetValueW(patchkey, NULL, szState, RRF_RT_REG_DWORD, + res = RegGetValueW(patchkey, NULL, L"State", RRF_RT_REG_DWORD, &type, &state, &size); if (!(filter & state)) @@ -2125,7 +1996,7 @@ UINT WINAPI MsiEnumPatchesExW(LPCWSTR szProductCode, LPCWSTR szUserSid, if (!szProductCode || !squash_guid( szProductCode, squashed_pc )) return ERROR_INVALID_PARAMETER; - if (szUserSid && !wcscmp( szUserSid, szLocalSid )) + if (szUserSid && !wcscmp( szUserSid, L"S-1-5-18" )) return ERROR_INVALID_PARAMETER; if (dwContext & MSIINSTALLCONTEXT_MACHINE && szUserSid) @@ -2303,16 +2174,13 @@ static UINT fetch_machine_product( const WCHAR *match, DWORD index, DWORD *idx, WCHAR installed_product[GUID_SIZE], MSIINSTALLCONTEXT *installed_ctx, WCHAR *sid, DWORD *sid_len ) { - static const WCHAR productsW[] = - {'S','o','f','t','w','a','r','e','\\','C','l','a','s','s','e','s','\\', - 'I','n','s','t','a','l','l','e','r','\\','P','r','o','d','u','c','t','s',0}; UINT r; WCHAR product[SQUASHED_GUID_SIZE]; DWORD i = 0, len; REGSAM access = KEY_ENUMERATE_SUB_KEYS | KEY_WOW64_64KEY; HKEY key; - if (RegOpenKeyExW( HKEY_LOCAL_MACHINE, productsW, 0, access, &key )) + if (RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"Software\\Classes\\Installer\\Products", 0, access, &key )) return ERROR_NO_MORE_ITEMS; len = ARRAY_SIZE( product ); @@ -2357,15 +2225,6 @@ static UINT fetch_user_product( const WCHAR *match, const WCHAR *usersid, DWORD DWORD *idx, WCHAR installed_product[GUID_SIZE], MSIINSTALLCONTEXT *installed_ctx, WCHAR *sid, DWORD *sid_len ) { - static const WCHAR managedW[] = - {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s', - 'i','o','n','\\','I','n','s','t','a','l','l','e','r','\\','M','a','n','a','g','e','d',0}; - static const WCHAR managed_productsW[] = - {'\\','I','n','s','t','a','l','l','e','r','\\','P','r','o','d','u','c','t','s',0}; - static const WCHAR unmanaged_productsW[] = - {'\\','S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'I','n','s','t','a','l','l','e','r','\\','P','r','o','d','u','c','t','s',0}; UINT r; const WCHAR *subkey; WCHAR path[MAX_PATH], product[SQUASHED_GUID_SIZE], user[128]; @@ -2375,13 +2234,13 @@ static UINT fetch_user_product( const WCHAR *match, const WCHAR *usersid, DWORD if (ctx == MSIINSTALLCONTEXT_USERMANAGED) { - subkey = managed_productsW; - if (RegOpenKeyExW( HKEY_LOCAL_MACHINE, managedW, 0, access, &key_users )) - return ERROR_NO_MORE_ITEMS; + subkey = L"\\Installer\\Products"; + if (RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed", + 0, access, &key_users )) return ERROR_NO_MORE_ITEMS; } else if (ctx == MSIINSTALLCONTEXT_USERUNMANAGED) { - subkey = unmanaged_productsW; + subkey = L"\\Software\\Microsoft\\Installer\\Products"; if (RegOpenKeyExW( HKEY_USERS, NULL, 0, access, &key_users )) return ERROR_NO_MORE_ITEMS; } @@ -2390,7 +2249,7 @@ static UINT fetch_user_product( const WCHAR *match, const WCHAR *usersid, DWORD len_user = ARRAY_SIZE( user ); while (!RegEnumKeyExW( key_users, i, user, &len_user, NULL, NULL, NULL, NULL )) { - if (wcscmp( usersid, user ) && wcscmp( usersid, szAllSid )) + if (wcscmp( usersid, user ) && wcscmp( usersid, L"S-1-1-0" )) { i++; len_user = ARRAY_SIZE( user );
2 years, 9 months
1
0
0
0
[reactos] 306/360: [WINESYNC] msi: Use wide character string literals in package.c.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0272139cbcbc564175988…
commit 0272139cbcbc564175988ca3aa6cbcad5c44021a Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 21:30:13 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:34 2022 +0100 [WINESYNC] msi: Use wide character string literals in package.c. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 731bb72c3d00b089ee23297efdfe0496733e96a4 by Hans Leidekker <hans(a)codeweavers.com> --- dll/win32/msi/package.c | 526 ++++++++++++++++-------------------------------- 1 file changed, 179 insertions(+), 347 deletions(-) diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c index cd8977724ce..e3060507b73 100644 --- a/dll/win32/msi/package.c +++ b/dll/win32/msi/package.c @@ -366,20 +366,11 @@ static void MSI_FreePackage( MSIOBJECTHDR *arg) static UINT create_temp_property_table(MSIPACKAGE *package) { - static const WCHAR query[] = { - 'C','R','E','A','T','E',' ','T','A','B','L','E',' ', - '`','_','P','r','o','p','e','r','t','y','`',' ','(',' ', - '`','_','P','r','o','p','e','r','t','y','`',' ', - 'C','H','A','R','(','5','6',')',' ','N','O','T',' ','N','U','L','L',' ', - 'T','E','M','P','O','R','A','R','Y',',',' ', - '`','V','a','l','u','e','`',' ','C','H','A','R','(','9','8',')',' ', - 'N','O','T',' ','N','U','L','L',' ','T','E','M','P','O','R','A','R','Y', - ' ','P','R','I','M','A','R','Y',' ','K','E','Y',' ', - '`','_','P','r','o','p','e','r','t','y','`',')',' ','H','O','L','D',0}; MSIQUERY *view; UINT rc; - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"CREATE TABLE `_Property` ( `_Property` CHAR(56) NOT NULL TEMPORARY, " + L"`Value` CHAR(98) NOT NULL TEMPORARY PRIMARY KEY `_Property`) HOLD", &view); if (rc != ERROR_SUCCESS) return rc; @@ -391,22 +382,10 @@ static UINT create_temp_property_table(MSIPACKAGE *package) UINT msi_clone_properties( MSIDATABASE *db ) { - static const WCHAR query_select[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','P','r','o','p','e','r','t','y','`',0}; - static const WCHAR query_insert[] = { - 'I','N','S','E','R','T',' ','I','N','T','O',' ', - '`','_','P','r','o','p','e','r','t','y','`',' ', - '(','`','_','P','r','o','p','e','r','t','y','`',',','`','V','a','l','u','e','`',')',' ', - 'V','A','L','U','E','S',' ','(','?',',','?',')',0}; - static const WCHAR query_update[] = { - 'U','P','D','A','T','E',' ','`','_','P','r','o','p','e','r','t','y','`',' ', - 'S','E','T',' ','`','V','a','l','u','e','`',' ','=',' ','?',' ', - 'W','H','E','R','E',' ','`','_','P','r','o','p','e','r','t','y','`',' ','=',' ','?',0}; MSIQUERY *view_select; UINT rc; - rc = MSI_DatabaseOpenViewW( db, query_select, &view_select ); + rc = MSI_DatabaseOpenViewW( db, L"SELECT * FROM `Property`", &view_select ); if (rc != ERROR_SUCCESS) return rc; @@ -427,7 +406,7 @@ UINT msi_clone_properties( MSIDATABASE *db ) if (rc != ERROR_SUCCESS) break; - rc = MSI_DatabaseOpenViewW( db, query_insert, &view_insert ); + rc = MSI_DatabaseOpenViewW( db, L"INSERT INTO `_Property` (`_Property`,`Value`) VALUES (?,?)", &view_insert ); if (rc != ERROR_SUCCESS) { msiobj_release( &rec_select->hdr ); @@ -443,7 +422,7 @@ UINT msi_clone_properties( MSIDATABASE *db ) TRACE("insert failed, trying update\n"); - rc = MSI_DatabaseOpenViewW( db, query_update, &view_update ); + rc = MSI_DatabaseOpenViewW( db, L"UPDATE `_Property` SET `Value` = ? WHERE `_Property` = ?", &view_update ); if (rc != ERROR_SUCCESS) { WARN("open view failed %u\n", rc); @@ -488,7 +467,7 @@ static UINT set_installed_prop( MSIPACKAGE *package ) if (r == ERROR_SUCCESS) { RegCloseKey( hkey ); - msi_set_property( package->db, szInstalled, szOne, -1 ); + msi_set_property( package->db, L"Installed", L"1", -1 ); } return r; } @@ -530,7 +509,7 @@ static UINT set_user_sid_prop( MSIPACKAGE *package ) if (!ConvertSidToStringSidW( psid, &sid_str )) goto done; - r = msi_set_property( package->db, szUserSID, sid_str, -1 ); + r = msi_set_property( package->db, L"UserSID", sid_str, -1 ); done: LocalFree( sid_str ); @@ -543,39 +522,27 @@ done: static LPWSTR get_fusion_filename(MSIPACKAGE *package) { - static const WCHAR fusion[] = - {'f','u','s','i','o','n','.','d','l','l',0}; - static const WCHAR subkey[] = - {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'N','E','T',' ','F','r','a','m','e','w','o','r','k',' ','S','e','t','u','p','\\','N','D','P',0}; - static const WCHAR subdir[] = - {'M','i','c','r','o','s','o','f','t','.','N','E','T','\\','F','r','a','m','e','w','o','r','k','\\',0}; - static const WCHAR v2050727[] = - {'v','2','.','0','.','5','0','7','2','7',0}; - static const WCHAR v4client[] = - {'v','4','\\','C','l','i','e','n','t',0}; - static const WCHAR installpath[] = - {'I','n','s','t','a','l','l','P','a','t','h',0}; HKEY netsetup, hkey; LONG res; DWORD size, len, type; WCHAR windir[MAX_PATH], path[MAX_PATH], *filename = NULL; - res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, subkey, 0, KEY_CREATE_SUB_KEY, &netsetup); + res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\NET Framework Setup\\NDP", 0, KEY_CREATE_SUB_KEY, + &netsetup); if (res != ERROR_SUCCESS) return NULL; - if (!RegCreateKeyExW(netsetup, v4client, 0, NULL, 0, KEY_QUERY_VALUE, NULL, &hkey, NULL)) + if (!RegCreateKeyExW(netsetup, L"v4\\Client", 0, NULL, 0, KEY_QUERY_VALUE, NULL, &hkey, NULL)) { size = ARRAY_SIZE(path); - if (!RegQueryValueExW(hkey, installpath, NULL, &type, (BYTE *)path, &size)) + if (!RegQueryValueExW(hkey, L"InstallPath", NULL, &type, (BYTE *)path, &size)) { - len = lstrlenW(path) + lstrlenW(fusion) + 2; + len = lstrlenW(path) + lstrlenW(L"fusion.dll") + 2; if (!(filename = msi_alloc(len * sizeof(WCHAR)))) return NULL; lstrcpyW(filename, path); - lstrcatW(filename, szBackSlash); - lstrcatW(filename, fusion); + lstrcpyW(filename, L"\\"); + lstrcatW(filename, L"fusion.dll"); if (GetFileAttributesW(filename) != INVALID_FILE_ATTRIBUTES) { TRACE( "found %s\n", debugstr_w(filename) ); @@ -587,19 +554,20 @@ static LPWSTR get_fusion_filename(MSIPACKAGE *package) RegCloseKey(hkey); } - if (!RegCreateKeyExW(netsetup, v2050727, 0, NULL, 0, KEY_QUERY_VALUE, NULL, &hkey, NULL)) + if (!RegCreateKeyExW(netsetup, L"v2.0.50727", 0, NULL, 0, KEY_QUERY_VALUE, NULL, &hkey, NULL)) { RegCloseKey(hkey); GetWindowsDirectoryW(windir, MAX_PATH); - len = lstrlenW(windir) + lstrlenW(subdir) + lstrlenW(v2050727) + lstrlenW(fusion) + 3; + len = lstrlenW(windir) + lstrlenW(L"Microsoft.NET\\Framework\\") + lstrlenW(L"v2.0.50727") + + lstrlenW(L"fusion.dll") + 3; if (!(filename = msi_alloc(len * sizeof(WCHAR)))) return NULL; lstrcpyW(filename, windir); - lstrcatW(filename, szBackSlash); - lstrcatW(filename, subdir); - lstrcatW(filename, v2050727); - lstrcatW(filename, szBackSlash); - lstrcatW(filename, fusion); + lstrcatW(filename, L"\\"); + lstrcatW(filename, L"Microsoft.NET\\Framework\\"); + lstrcatW(filename, L"v2.0.50727"); + lstrcatW(filename, L"\\"); + lstrcatW(filename, L"fusion.dll"); if (GetFileAttributesW(filename) != INVALID_FILE_ATTRIBUTES) { TRACE( "found %s\n", debugstr_w(filename) ); @@ -627,19 +595,6 @@ static void set_msi_assembly_prop(MSIPACKAGE *package) LPWSTR fusion, verstr; LANGANDCODEPAGE *translate; - static const WCHAR netasm[] = { - 'M','s','i','N','e','t','A','s','s','e','m','b','l','y','S','u','p','p','o','r','t',0 - }; - static const WCHAR translation[] = { - '\\','V','a','r','F','i','l','e','I','n','f','o', - '\\','T','r','a','n','s','l','a','t','i','o','n',0 - }; - static const WCHAR verfmt[] = { - '\\','S','t','r','i','n','g','F','i','l','e','I','n','f','o', - '\\','%','0','4','x','%','0','4','x', - '\\','P','r','o','d','u','c','t','V','e','r','s','i','o','n',0 - }; - fusion = get_fusion_filename(package); if (!fusion) return; @@ -655,10 +610,11 @@ static void set_msi_assembly_prop(MSIPACKAGE *package) if (!GetFileVersionInfoW(fusion, handle, size, version)) goto done; - if (!VerQueryValueW(version, translation, (LPVOID *)&translate, &val_len)) + if (!VerQueryValueW(version, L"\\VarFileInfo\\Translation", (LPVOID *)&translate, &val_len)) goto done; - swprintf(buf, ARRAY_SIZE(buf), verfmt, translate[0].wLanguage, translate[0].wCodePage); + swprintf(buf, ARRAY_SIZE(buf), L"\\StringFileInfo\\%04x%04x\\ProductVersion", translate[0].wLanguage, + translate[0].wCodePage); if (!VerQueryValueW(version, buf, (LPVOID *)&verstr, &val_len)) goto done; @@ -666,7 +622,7 @@ static void set_msi_assembly_prop(MSIPACKAGE *package) if (!val_len || !verstr) goto done; - msi_set_property( package->db, netasm, verstr, -1 ); + msi_set_property( package->db, L"MsiNetAssemblySupport", verstr, -1 ); done: msi_free(fusion); @@ -686,84 +642,6 @@ static VOID set_installer_properties(MSIPACKAGE *package) SYSTEM_INFO sys_info; LANGID langid; - static const WCHAR szCommonFilesFolder[] = {'C','o','m','m','o','n','F','i','l','e','s','F','o','l','d','e','r',0}; - static const WCHAR szProgramFilesFolder[] = {'P','r','o','g','r','a','m','F','i','l','e','s','F','o','l','d','e','r',0}; - static const WCHAR szCommonAppDataFolder[] = {'C','o','m','m','o','n','A','p','p','D','a','t','a','F','o','l','d','e','r',0}; - static const WCHAR szFavoritesFolder[] = {'F','a','v','o','r','i','t','e','s','F','o','l','d','e','r',0}; - static const WCHAR szFontsFolder[] = {'F','o','n','t','s','F','o','l','d','e','r',0}; - static const WCHAR szSendToFolder[] = {'S','e','n','d','T','o','F','o','l','d','e','r',0}; - static const WCHAR szStartMenuFolder[] = {'S','t','a','r','t','M','e','n','u','F','o','l','d','e','r',0}; - static const WCHAR szStartupFolder[] = {'S','t','a','r','t','u','p','F','o','l','d','e','r',0}; - static const WCHAR szTemplateFolder[] = {'T','e','m','p','l','a','t','e','F','o','l','d','e','r',0}; - static const WCHAR szDesktopFolder[] = {'D','e','s','k','t','o','p','F','o','l','d','e','r',0}; - static const WCHAR szProgramMenuFolder[] = {'P','r','o','g','r','a','m','M','e','n','u','F','o','l','d','e','r',0}; - static const WCHAR szAdminToolsFolder[] = {'A','d','m','i','n','T','o','o','l','s','F','o','l','d','e','r',0}; - static const WCHAR szSystemFolder[] = {'S','y','s','t','e','m','F','o','l','d','e','r',0}; - static const WCHAR szSystem16Folder[] = {'S','y','s','t','e','m','1','6','F','o','l','d','e','r',0}; - static const WCHAR szLocalAppDataFolder[] = {'L','o','c','a','l','A','p','p','D','a','t','a','F','o','l','d','e','r',0}; - static const WCHAR szMyPicturesFolder[] = {'M','y','P','i','c','t','u','r','e','s','F','o','l','d','e','r',0}; - static const WCHAR szPersonalFolder[] = {'P','e','r','s','o','n','a','l','F','o','l','d','e','r',0}; - static const WCHAR szWindowsVolume[] = {'W','i','n','d','o','w','s','V','o','l','u','m','e',0}; - static const WCHAR szPrivileged[] = {'P','r','i','v','i','l','e','g','e','d',0}; - static const WCHAR szVersion9x[] = {'V','e','r','s','i','o','n','9','X',0}; - static const WCHAR szVersionNT[] = {'V','e','r','s','i','o','n','N','T',0}; - static const WCHAR szMsiNTProductType[] = {'M','s','i','N','T','P','r','o','d','u','c','t','T','y','p','e',0}; - static const WCHAR szFormat[] = {'%','u',0}; - static const WCHAR szFormat2[] = {'%','u','.','%','u',0}; - static const WCHAR szWindowsBuild[] = {'W','i','n','d','o','w','s','B','u','i','l','d',0}; - static const WCHAR szServicePackLevel[] = {'S','e','r','v','i','c','e','P','a','c','k','L','e','v','e','l',0}; - static const WCHAR szVersionMsi[] = { 'V','e','r','s','i','o','n','M','s','i',0 }; - static const WCHAR szVersionDatabase[] = { 'V','e','r','s','i','o','n','D','a','t','a','b','a','s','e',0 }; - static const WCHAR szPhysicalMemory[] = { 'P','h','y','s','i','c','a','l','M','e','m','o','r','y',0 }; - static const WCHAR szScreenX[] = {'S','c','r','e','e','n','X',0}; - static const WCHAR szScreenY[] = {'S','c','r','e','e','n','Y',0}; - static const WCHAR szColorBits[] = {'C','o','l','o','r','B','i','t','s',0}; - static const WCHAR szIntFormat[] = {'%','d',0}; - static const WCHAR szMsiAMD64[] = { 'M','s','i','A','M','D','6','4',0 }; - static const WCHAR szMsix64[] = { 'M','s','i','x','6','4',0 }; - static const WCHAR szSystem64Folder[] = { 'S','y','s','t','e','m','6','4','F','o','l','d','e','r',0 }; - static const WCHAR szCommonFiles64Folder[] = { 'C','o','m','m','o','n','F','i','l','e','s','6','4','F','o','l','d','e','r',0 }; - static const WCHAR szProgramFiles64Folder[] = { 'P','r','o','g','r','a','m','F','i','l','e','s','6','4','F','o','l','d','e','r',0 }; - static const WCHAR szProgramFilesDir[] = {'P','r','o','g','r','a','m','F','i','l','e','s','D','i','r',0}; - static const WCHAR szProgramFilesDirx86[] = {'P','r','o','g','r','a','m','F','i','l','e','s','D','i','r',' ','(','x','8','6',')',0}; - static const WCHAR szCommonFilesDir[] = {'C','o','m','m','o','n','F','i','l','e','s','D','i','r',0}; - static const WCHAR szCommonFilesDirx86[] = {'C','o','m','m','o','n','F','i','l','e','s','D','i','r',' ','(','x','8','6',')',0}; - static const WCHAR szVersionNT64[] = { 'V','e','r','s','i','o','n','N','T','6','4',0 }; - static const WCHAR szUserInfo[] = { - 'S','O','F','T','W','A','R','E','\\', - 'M','i','c','r','o','s','o','f','t','\\', - 'M','S',' ','S','e','t','u','p',' ','(','A','C','M','E',')','\\', - 'U','s','e','r',' ','I','n','f','o',0 - }; - static const WCHAR szDefName[] = { 'D','e','f','N','a','m','e',0 }; - static const WCHAR szDefCompany[] = { 'D','e','f','C','o','m','p','a','n','y',0 }; - static const WCHAR szCurrentVersion[] = { - 'S','O','F','T','W','A','R','E','\\', - 'M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\', - 'C','u','r','r','e','n','t','V','e','r','s','i','o','n',0 - }; - static const WCHAR szCurrentVersionNT[] = { - 'S','O','F','T','W','A','R','E','\\', - 'M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s',' ','N','T','\\', - 'C','u','r','r','e','n','t','V','e','r','s','i','o','n',0 - }; - static const WCHAR szRegisteredOwner[] = {'R','e','g','i','s','t','e','r','e','d','O','w','n','e','r',0}; - static const WCHAR szRegisteredOrganization[] = { - 'R','e','g','i','s','t','e','r','e','d','O','r','g','a','n','i','z','a','t','i','o','n',0 - }; - static const WCHAR szUSERNAME[] = {'U','S','E','R','N','A','M','E',0}; - static const WCHAR szCOMPANYNAME[] = {'C','O','M','P','A','N','Y','N','A','M','E',0}; - static const WCHAR szUserLanguageID[] = {'U','s','e','r','L','a','n','g','u','a','g','e','I','D',0}; - static const WCHAR szSystemLangID[] = {'S','y','s','t','e','m','L','a','n','g','u','a','g','e','I','D',0}; - static const WCHAR szProductState[] = {'P','r','o','d','u','c','t','S','t','a','t','e',0}; - static const WCHAR szLogonUser[] = {'L','o','g','o','n','U','s','e','r',0}; - static const WCHAR szNetHoodFolder[] = {'N','e','t','H','o','o','d','F','o','l','d','e','r',0}; - static const WCHAR szPrintHoodFolder[] = {'P','r','i','n','t','H','o','o','d','F','o','l','d','e','r',0}; - static const WCHAR szRecentFolder[] = {'R','e','c','e','n','t','F','o','l','d','e','r',0}; - static const WCHAR szComputerName[] = {'C','o','m','p','u','t','e','r','N','a','m','e',0}; - /* * Other things that probably should be set: * @@ -772,100 +650,100 @@ static VOID set_installer_properties(MSIPACKAGE *package) */ SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA, NULL, 0, pth); - lstrcatW(pth, szBackSlash); - msi_set_property( package->db, szCommonAppDataFolder, pth, -1 ); + lstrcatW(pth, L"\\"); + msi_set_property( package->db, L"CommonAppDataFolder", pth, -1 ); SHGetFolderPathW(NULL, CSIDL_FAVORITES, NULL, 0, pth); - lstrcatW(pth, szBackSlash); - msi_set_property( package->db, szFavoritesFolder, pth, -1 ); + lstrcatW(pth, L"\\"); + msi_set_property( package->db, L"FavoritesFolder", pth, -1 ); SHGetFolderPathW(NULL, CSIDL_FONTS, NULL, 0, pth); - lstrcatW(pth, szBackSlash); - msi_set_property( package->db, szFontsFolder, pth, -1 ); + lstrcatW(pth, L"\\"); + msi_set_property( package->db, L"FontsFolder", pth, -1 ); SHGetFolderPathW(NULL, CSIDL_SENDTO, NULL, 0, pth); - lstrcatW(pth, szBackSlash); - msi_set_property( package->db, szSendToFolder, pth, -1 ); + lstrcatW(pth, L"\\"); + msi_set_property( package->db, L"SendToFolder", pth, -1 ); SHGetFolderPathW(NULL, CSIDL_STARTMENU, NULL, 0, pth); - lstrcatW(pth, szBackSlash); - msi_set_property( package->db, szStartMenuFolder, pth, -1 ); + lstrcatW(pth, L"\\"); + msi_set_property( package->db, L"StartMenuFolder", pth, -1 ); SHGetFolderPathW(NULL, CSIDL_STARTUP, NULL, 0, pth); - lstrcatW(pth, szBackSlash); - msi_set_property( package->db, szStartupFolder, pth, -1 ); + lstrcatW(pth, L"\\"); + msi_set_property( package->db, L"StartupFolder", pth, -1 ); SHGetFolderPathW(NULL, CSIDL_TEMPLATES, NULL, 0, pth); - lstrcatW(pth, szBackSlash); - msi_set_property( package->db, szTemplateFolder, pth, -1 ); + lstrcatW(pth, L"\\"); + msi_set_property( package->db, L"TemplateFolder", pth, -1 ); SHGetFolderPathW(NULL, CSIDL_DESKTOP, NULL, 0, pth); - lstrcatW(pth, szBackSlash); - msi_set_property( package->db, szDesktopFolder, pth, -1 ); + lstrcatW(pth, L"\\"); + msi_set_property( package->db, L"DesktopFolder", pth, -1 ); /* FIXME: set to AllUsers profile path if ALLUSERS is set */ SHGetFolderPathW(NULL, CSIDL_PROGRAMS, NULL, 0, pth); - lstrcatW(pth, szBackSlash); - msi_set_property( package->db, szProgramMenuFolder, pth, -1 ); + lstrcatW(pth, L"\\"); + msi_set_property( package->db, L"ProgramMenuFolder", pth, -1 ); SHGetFolderPathW(NULL, CSIDL_ADMINTOOLS, NULL, 0, pth); - lstrcatW(pth, szBackSlash); - msi_set_property( package->db, szAdminToolsFolder, pth, -1 ); + lstrcatW(pth, L"\\"); + msi_set_property( package->db, L"AdminToolsFolder", pth, -1 ); SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, 0, pth); - lstrcatW(pth, szBackSlash); - msi_set_property( package->db, szAppDataFolder, pth, -1 ); + lstrcatW(pth, L"\\"); + msi_set_property( package->db, L"AppDataFolder", pth, -1 ); SHGetFolderPathW(NULL, CSIDL_SYSTEM, NULL, 0, pth); - lstrcatW(pth, szBackSlash); - msi_set_property( package->db, szSystemFolder, pth, -1 ); - msi_set_property( package->db, szSystem16Folder, pth, -1 ); + lstrcatW(pth, L"\\"); + msi_set_property( package->db, L"SystemFolder", pth, -1 ); + msi_set_property( package->db, L"System16Folder", pth, -1 ); SHGetFolderPathW(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, pth); - lstrcatW(pth, szBackSlash); - msi_set_property( package->db, szLocalAppDataFolder, pth, -1 ); + lstrcatW(pth, L"\\"); + msi_set_property( package->db, L"LocalAppDataFolder", pth, -1 ); SHGetFolderPathW(NULL, CSIDL_MYPICTURES, NULL, 0, pth); - lstrcatW(pth, szBackSlash); - msi_set_property( package->db, szMyPicturesFolder, pth, -1 ); + lstrcatW(pth, L"\\"); + msi_set_property( package->db, L"MyPicturesFolder", pth, -1 ); SHGetFolderPathW(NULL, CSIDL_PERSONAL, NULL, 0, pth); - lstrcatW(pth, szBackSlash); - msi_set_property( package->db, szPersonalFolder, pth, -1 ); + lstrcatW(pth, L"\\"); + msi_set_property( package->db, L"PersonalFolder", pth, -1 ); SHGetFolderPathW(NULL, CSIDL_WINDOWS, NULL, 0, pth); - lstrcatW(pth, szBackSlash); - msi_set_property( package->db, szWindowsFolder, pth, -1 ); - + lstrcatW(pth, L"\\"); + msi_set_property( package->db, L"WindowsFolder", pth, -1 ); + SHGetFolderPathW(NULL, CSIDL_PRINTHOOD, NULL, 0, pth); - lstrcatW(pth, szBackSlash); - msi_set_property( package->db, szPrintHoodFolder, pth, -1 ); + lstrcatW(pth, L"\\"); + msi_set_property( package->db, L"PrintHoodFolder", pth, -1 ); SHGetFolderPathW(NULL, CSIDL_NETHOOD, NULL, 0, pth); - lstrcatW(pth, szBackSlash); - msi_set_property( package->db, szNetHoodFolder, pth, -1 ); + lstrcatW(pth, L"\\"); + msi_set_property( package->db, L"NetHoodFolder", pth, -1 ); SHGetFolderPathW(NULL, CSIDL_RECENT, NULL, 0, pth); - lstrcatW(pth, szBackSlash); - msi_set_property( package->db, szRecentFolder, pth, -1 ); + lstrcatW(pth, L"\\"); + msi_set_property( package->db, L"RecentFolder", pth, -1 ); /* Physical Memory is specified in MB. Using total amount. */ msex.dwLength = sizeof(msex); GlobalMemoryStatusEx( &msex ); - len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, (int)(msex.ullTotalPhys / 1024 / 1024) ); - msi_set_property( package->db, szPhysicalMemory, bufstr, len ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", (int)(msex.ullTotalPhys / 1024 / 1024) ); + msi_set_property( package->db, L"PhysicalMemory", bufstr, len ); SHGetFolderPathW(NULL, CSIDL_WINDOWS, NULL, 0, pth); ptr = wcschr(pth,'\\'); if (ptr) *(ptr + 1) = 0; - msi_set_property( package->db, szWindowsVolume, pth, -1 ); - + msi_set_property( package->db, L"WindowsVolume", pth, -1 ); + len = GetTempPathW(MAX_PATH, pth); - msi_set_property( package->db, szTempFolder, pth, len ); + msi_set_property( package->db, L"TempFolder", pth, len ); /* in a wine environment the user is always admin and privileged */ - msi_set_property( package->db, szAdminUser, szOne, -1 ); - msi_set_property( package->db, szPrivileged, szOne, -1 ); + msi_set_property( package->db, L"AdminUser", L"1", -1 ); + msi_set_property( package->db, L"Privileged", L"1", -1 ); /* set the os things */ OSVersion.dwOSVersionInfoSize = sizeof(OSVersion); @@ -876,122 +754,122 @@ static VOID set_installer_properties(MSIPACKAGE *package) verval = 603; OSVersion.dwBuildNumber = 9600; } - len = swprintf( verstr, ARRAY_SIZE(verstr), szFormat, verval ); + len = swprintf( verstr, ARRAY_SIZE(verstr), L"%u", verval ); switch (OSVersion.dwPlatformId) { - case VER_PLATFORM_WIN32_WINDOWS: - msi_set_property( package->db, szVersion9x, verstr, len ); + case VER_PLATFORM_WIN32_WINDOWS: + msi_set_property( package->db, L"Version9X", verstr, len ); break; case VER_PLATFORM_WIN32_NT: - msi_set_property( package->db, szVersionNT, verstr, len ); - len = swprintf( bufstr, ARRAY_SIZE(bufstr), szFormat,OSVersion.wProductType ); - msi_set_property( package->db, szMsiNTProductType, bufstr, len ); + msi_set_property( package->db, L"VersionNT", verstr, len ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%u", OSVersion.wProductType ); + msi_set_property( package->db, L"MsiNTProductType", bufstr, len ); break; } - len = swprintf( bufstr, ARRAY_SIZE(bufstr), szFormat, OSVersion.dwBuildNumber ); - msi_set_property( package->db, szWindowsBuild, bufstr, len ); - len = swprintf( bufstr, ARRAY_SIZE(bufstr), szFormat, OSVersion.wServicePackMajor ); - msi_set_property( package->db, szServicePackLevel, bufstr, len ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%u", OSVersion.dwBuildNumber ); + msi_set_property( package->db, L"WindowsBuild", bufstr, len ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%u", OSVersion.wServicePackMajor ); + msi_set_property( package->db, L"ServicePackLevel", bufstr, len ); - len = swprintf( bufstr, ARRAY_SIZE(bufstr), szFormat2, MSI_MAJORVERSION, MSI_MINORVERSION ); - msi_set_property( package->db, szVersionMsi, bufstr, len ); - len = swprintf( bufstr, ARRAY_SIZE(bufstr), szFormat, MSI_MAJORVERSION * 100 ); - msi_set_property( package->db, szVersionDatabase, bufstr, len ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%u.%u", MSI_MAJORVERSION, MSI_MINORVERSION ); + msi_set_property( package->db, L"VersionMsi", bufstr, len ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%u", MSI_MAJORVERSION * 100 ); + msi_set_property( package->db, L"VersionDatabase", bufstr, len ); - RegOpenKeyExW(HKEY_LOCAL_MACHINE, szCurrentVersion, 0, + RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion", 0, KEY_QUERY_VALUE | KEY_WOW64_64KEY, &hkey); GetNativeSystemInfo( &sys_info ); - len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, sys_info.wProcessorLevel ); - msi_set_property( package->db, szIntel, bufstr, len ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", sys_info.wProcessorLevel ); + msi_set_property( package->db, L"Intel", bufstr, len ); if (sys_info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) { GetSystemDirectoryW( pth, MAX_PATH ); PathAddBackslashW( pth ); - msi_set_property( package->db, szSystemFolder, pth, -1 ); + msi_set_property( package->db, L"SystemFolder", pth, -1 ); len = MAX_PATH; - RegQueryValueExW(hkey, szProgramFilesDir, 0, &type, (BYTE *)pth, &len); + RegQueryValueExW(hkey, L"ProgramFilesDir", 0, &type, (BYTE *)pth, &len); PathAddBackslashW( pth ); - msi_set_property( package->db, szProgramFilesFolder, pth, -1 ); + msi_set_property( package->db, L"ProgramFilesFolder", pth, -1 ); len = MAX_PATH; - RegQueryValueExW(hkey, szCommonFilesDir, 0, &type, (BYTE *)pth, &len); + RegQueryValueExW(hkey, L"CommonFilesDir", 0, &type, (BYTE *)pth, &len); PathAddBackslashW( pth ); - msi_set_property( package->db, szCommonFilesFolder, pth, -1 ); + msi_set_property( package->db, L"CommonFilesFolder", pth, -1 ); } else if (sys_info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { - msi_set_property( package->db, szMsiAMD64, bufstr, -1 ); - msi_set_property( package->db, szMsix64, bufstr, -1 ); - msi_set_property( package->db, szVersionNT64, verstr, -1 ); + msi_set_property( package->db, L"MsiAMD64", bufstr, -1 ); + msi_set_property( package->db, L"Msix64", bufstr, -1 ); + msi_set_property( package->db, L"VersionNT64", verstr, -1 ); GetSystemDirectoryW( pth, MAX_PATH ); PathAddBackslashW( pth ); - msi_set_property( package->db, szSystem64Folder, pth, -1 ); + msi_set_property( package->db, L"System64Folder", pth, -1 ); GetSystemWow64DirectoryW( pth, MAX_PATH ); PathAddBackslashW( pth ); - msi_set_property( package->db, szSystemFolder, pth, -1 ); + msi_set_property( package->db, L"SystemFolder", pth, -1 ); len = MAX_PATH; - RegQueryValueExW(hkey, szProgramFilesDir, 0, &type, (BYTE *)pth, &len); + RegQueryValueExW(hkey, L"ProgramFilesDir", 0, &type, (BYTE *)pth, &len); PathAddBackslashW( pth ); - msi_set_property( package->db, szProgramFiles64Folder, pth, -1 ); + msi_set_property( package->db, L"ProgramFiles64Folder", pth, -1 ); len = MAX_PATH; - RegQueryValueExW(hkey, szProgramFilesDirx86, 0, &type, (BYTE *)pth, &len); + RegQueryValueExW(hkey, L"ProgramFilesDir (x86)", 0, &type, (BYTE *)pth, &len); PathAddBackslashW( pth ); - msi_set_property( package->db, szProgramFilesFolder, pth, -1 ); + msi_set_property( package->db, L"ProgramFilesFolder", pth, -1 ); len = MAX_PATH; - RegQueryValueExW(hkey, szCommonFilesDir, 0, &type, (BYTE *)pth, &len); + RegQueryValueExW(hkey, L"CommonFilesDir", 0, &type, (BYTE *)pth, &len); PathAddBackslashW( pth ); - msi_set_property( package->db, szCommonFiles64Folder, pth, -1 ); + msi_set_property( package->db, L"CommonFiles64Folder", pth, -1 ); len = MAX_PATH; - RegQueryValueExW(hkey, szCommonFilesDirx86, 0, &type, (BYTE *)pth, &len); + RegQueryValueExW(hkey, L"CommonFilesDir (x86)", 0, &type, (BYTE *)pth, &len); PathAddBackslashW( pth ); - msi_set_property( package->db, szCommonFilesFolder, pth, -1 ); + msi_set_property( package->db, L"CommonFilesFolder", pth, -1 ); } RegCloseKey(hkey); /* Screen properties. */ dc = GetDC(0); - len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, GetDeviceCaps(dc, HORZRES) ); - msi_set_property( package->db, szScreenX, bufstr, len ); - len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, GetDeviceCaps(dc, VERTRES) ); - msi_set_property( package->db, szScreenY, bufstr, len ); - len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, GetDeviceCaps(dc, BITSPIXEL) ); - msi_set_property( package->db, szColorBits, bufstr, len ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", GetDeviceCaps(dc, HORZRES) ); + msi_set_property( package->db, L"ScreenX", bufstr, len ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", GetDeviceCaps(dc, VERTRES) ); + msi_set_property( package->db, L"ScreenY", bufstr, len ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", GetDeviceCaps(dc, BITSPIXEL) ); + msi_set_property( package->db, L"ColorBits", bufstr, len ); ReleaseDC(0, dc); /* USERNAME and COMPANYNAME */ - username = msi_dup_property( package->db, szUSERNAME ); - companyname = msi_dup_property( package->db, szCOMPANYNAME ); + username = msi_dup_property( package->db, L"USERNAME" ); + companyname = msi_dup_property( package->db, L"COMPANYNAME" ); if ((!username || !companyname) && - RegOpenKeyW( HKEY_CURRENT_USER, szUserInfo, &hkey ) == ERROR_SUCCESS) + RegOpenKeyW( HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey ) == ERROR_SUCCESS) { if (!username && - (username = msi_reg_get_val_str( hkey, szDefName ))) - msi_set_property( package->db, szUSERNAME, username, -1 ); + (username = msi_reg_get_val_str( hkey, L"DefName" ))) + msi_set_property( package->db, L"USERNAME", username, -1 ); if (!companyname && - (companyname = msi_reg_get_val_str( hkey, szDefCompany ))) - msi_set_property( package->db, szCOMPANYNAME, companyname, -1 ); + (companyname = msi_reg_get_val_str( hkey, L"DefCompany" ))) + msi_set_property( package->db, L"COMPANYNAME", companyname, -1 ); CloseHandle( hkey ); } if ((!username || !companyname) && - RegOpenKeyExW( HKEY_LOCAL_MACHINE, szCurrentVersionNT, 0, KEY_QUERY_VALUE|KEY_WOW64_64KEY, - &hkey ) == ERROR_SUCCESS) + RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0, + KEY_QUERY_VALUE|KEY_WOW64_64KEY, &hkey ) == ERROR_SUCCESS) { if (!username && - (username = msi_reg_get_val_str( hkey, szRegisteredOwner ))) - msi_set_property( package->db, szUSERNAME, username, -1 ); + (username = msi_reg_get_val_str( hkey, L"RegisteredOwner" ))) + msi_set_property( package->db, L"USERNAME", username, -1 ); if (!companyname && - (companyname = msi_reg_get_val_str( hkey, szRegisteredOrganization ))) - msi_set_property( package->db, szCOMPANYNAME, companyname, -1 ); + (companyname = msi_reg_get_val_str( hkey, L"RegisteredOrganization" ))) + msi_set_property( package->db, L"COMPANYNAME", companyname, -1 ); CloseHandle( hkey ); } msi_free( username ); @@ -1003,15 +881,15 @@ static VOID set_installer_properties(MSIPACKAGE *package) set_msi_assembly_prop( package ); langid = GetUserDefaultLangID(); - len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, langid ); - msi_set_property( package->db, szUserLanguageID, bufstr, len ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", langid ); + msi_set_property( package->db, L"UserLanguageID", bufstr, len ); langid = GetSystemDefaultLangID(); - len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, langid ); - msi_set_property( package->db, szSystemLangID, bufstr, len ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", langid ); + msi_set_property( package->db, L"SystemLanguageID", bufstr, len ); - len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, MsiQueryProductStateW(package->ProductCode) ); - msi_set_property( package->db, szProductState, bufstr, len ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), L"%d", MsiQueryProductStateW(package->ProductCode) ); + msi_set_property( package->db, L"ProductState", bufstr, len ); len = 0; if (!GetUserNameW( NULL, &len ) && GetLastError() == ERROR_INSUFFICIENT_BUFFER) @@ -1020,7 +898,7 @@ static VOID set_installer_properties(MSIPACKAGE *package) if ((username = msi_alloc( len * sizeof(WCHAR) ))) { if (GetUserNameW( username, &len )) - msi_set_property( package->db, szLogonUser, username, len - 1 ); + msi_set_property( package->db, L"LogonUser", username, len - 1 ); msi_free( username ); } } @@ -1031,7 +909,7 @@ static VOID set_installer_properties(MSIPACKAGE *package) if ((computername = msi_alloc( len * sizeof(WCHAR) ))) { if (GetComputerNameW( computername, &len )) - msi_set_property( package->db, szComputerName, computername, len ); + msi_set_property( package->db, L"ComputerName", computername, len ); msi_free( computername ); } } @@ -1073,9 +951,7 @@ static UINT msi_load_admin_properties(MSIPACKAGE *package) BYTE *data; UINT r, sz; - static const WCHAR stmname[] = {'A','d','m','i','n','P','r','o','p','e','r','t','i','e','s',0}; - - r = read_stream_data(package->db->storage, stmname, FALSE, &data, &sz); + r = read_stream_data(package->db->storage, L"AdminProperties", FALSE, &data, &sz); if (r != ERROR_SUCCESS) return r; @@ -1088,17 +964,16 @@ static UINT msi_load_admin_properties(MSIPACKAGE *package) void msi_adjust_privilege_properties( MSIPACKAGE *package ) { /* FIXME: this should depend on the user's privileges */ - if (msi_get_property_int( package->db, szAllUsers, 0 ) == 2) + if (msi_get_property_int( package->db, L"ALLUSERS", 0 ) == 2) { TRACE("resetting ALLUSERS property from 2 to 1\n"); - msi_set_property( package->db, szAllUsers, szOne, -1 ); + msi_set_property( package->db, L"ALLUSERS", L"1", -1 ); } - msi_set_property( package->db, szAdminUser, szOne, -1 ); + msi_set_property( package->db, L"AdminUser", L"1", -1 ); } MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db ) { - static const WCHAR fmtW[] = {'%','u',0}; MSIPACKAGE *package; WCHAR uilevel[11]; int len; @@ -1122,13 +997,13 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db ) msi_clone_properties( package->db ); msi_adjust_privilege_properties( package ); - package->ProductCode = msi_dup_property( package->db, szProductCode ); + package->ProductCode = msi_dup_property( package->db, L"ProductCode" ); set_installer_properties( package ); package->ui_level = gUILevel; - len = swprintf( uilevel, ARRAY_SIZE(uilevel), fmtW, gUILevel & INSTALLUILEVEL_MASK ); - msi_set_property( package->db, szUILevel, uilevel, len ); + len = swprintf( uilevel, ARRAY_SIZE(uilevel), L"%u", gUILevel & INSTALLUILEVEL_MASK ); + msi_set_property( package->db, L"UILevel", uilevel, len ); r = msi_load_suminfo_properties( package ); if (r != ERROR_SUCCESS) @@ -1184,21 +1059,18 @@ UINT msi_download_file( LPCWSTR szUrl, LPWSTR filename ) UINT msi_create_empty_local_file( LPWSTR path, LPCWSTR suffix ) { - static const WCHAR szInstaller[] = { - '\\','I','n','s','t','a','l','l','e','r','\\',0}; - static const WCHAR fmt[] = {'%','x',0}; DWORD time, len, i, offset; HANDLE handle; time = GetTickCount(); GetWindowsDirectoryW( path, MAX_PATH ); - lstrcatW( path, szInstaller ); + lstrcatW( path, L"\\Installer\\" ); CreateDirectoryW( path, NULL ); len = lstrlenW(path); for (i = 0; i < 0x10000; i++) { - offset = swprintf( path + len, MAX_PATH - len, fmt, (time + i) & 0xffff ); + offset = swprintf( path + len, MAX_PATH - len, L"%x", (time + i) & 0xffff ); memcpy( path + len + offset, suffix, (lstrlenW( suffix ) + 1) * sizeof(WCHAR) ); handle = CreateFileW( path, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0 ); @@ -1217,11 +1089,11 @@ UINT msi_create_empty_local_file( LPWSTR path, LPCWSTR suffix ) static enum platform parse_platform( const WCHAR *str ) { - if (!str[0] || !wcscmp( str, szIntel )) return PLATFORM_INTEL; - else if (!wcscmp( str, szIntel64 )) return PLATFORM_INTEL64; - else if (!wcscmp( str, szX64 ) || !wcscmp( str, szAMD64 )) return PLATFORM_X64; - else if (!wcscmp( str, szARM )) return PLATFORM_ARM; - else if (!wcscmp( str, szARM64 )) return PLATFORM_ARM64; + if (!str[0] || !wcscmp( str, L"Intel" )) return PLATFORM_INTEL; + else if (!wcscmp( str, L"Intel64" )) return PLATFORM_INTEL64; + else if (!wcscmp( str, L"x64" ) || !wcscmp( str, L"AMD64" )) return PLATFORM_X64; + else if (!wcscmp( str, L"Arm" )) return PLATFORM_ARM; + else if (!wcscmp( str, L"Arm64" )) return PLATFORM_ARM64; return PLATFORM_UNRECOGNIZED; } @@ -1339,17 +1211,12 @@ static UINT validate_package( MSIPACKAGE *package ) static WCHAR *get_property( MSIDATABASE *db, const WCHAR *prop ) { - static const WCHAR select_query[] = { - 'S','E','L','E','C','T',' ','`','V','a','l','u','e','`',' ', - 'F','R','O','M',' ','`','P','r','o','p','e','r','t','y','`',' ', - 'W','H','E','R','E',' ','`','P','r','o','p','e','r','t','y','`','=', - '\'','%','s','\'',0}; WCHAR query[MAX_PATH]; MSIQUERY *view; MSIRECORD *rec; WCHAR *ret = NULL; - swprintf(query, ARRAY_SIZE(query), select_query, prop); + swprintf(query, ARRAY_SIZE(query), L"SELECT `Value` FROM `Property` WHERE `Property`='%s'", prop); if (MSI_DatabaseOpenViewW( db, query, &view ) != ERROR_SUCCESS) { return NULL; @@ -1372,12 +1239,12 @@ static WCHAR *get_property( MSIDATABASE *db, const WCHAR *prop ) static WCHAR *get_product_code( MSIDATABASE *db ) { - return get_property( db, szProductCode ); + return get_property( db, L"ProductCode" ); } static WCHAR *get_product_version( MSIDATABASE *db ) { - return get_property( db, szProductVersion ); + return get_property( db, L"ProductVersion" ); } static UINT get_registered_local_package( const WCHAR *product, WCHAR *localfile ) @@ -1443,9 +1310,9 @@ UINT msi_set_original_database_property( MSIDATABASE *db, const WCHAR *package ) UINT r; if (UrlIsW( package, URLIS_URL )) - r = msi_set_property( db, szOriginalDatabase, package, -1 ); + r = msi_set_property( db, L"OriginalDatabase", package, -1 ); else if (package[0] == '#') - r = msi_set_property( db, szOriginalDatabase, db->path, -1 ); + r = msi_set_property( db, L"OriginalDatabase", db->path, -1 ); else { DWORD len; @@ -1454,7 +1321,7 @@ UINT msi_set_original_database_property( MSIDATABASE *db, const WCHAR *package ) if (!(len = GetFullPathNameW( package, 0, NULL, NULL ))) return GetLastError(); if (!(path = msi_alloc( len * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY; len = GetFullPathNameW( package, len, path, NULL ); - r = msi_set_property( db, szOriginalDatabase, path, len ); + r = msi_set_property( db, L"OriginalDatabase", path, len ); msi_free( path ); } return r; @@ -1462,7 +1329,6 @@ UINT msi_set_original_database_property( MSIDATABASE *db, const WCHAR *package ) UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage) { - static const WCHAR dotmsi[] = {'.','m','s','i',0}; MSIDATABASE *db; MSIPACKAGE *package; MSIHANDLE handle; @@ -1511,7 +1377,7 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage) { DWORD localfile_attr; - r = msi_create_empty_local_file( localfile, dotmsi ); + r = msi_create_empty_local_file( localfile, L".msi" ); if (r != ERROR_SUCCESS) { msiobj_release( &db->hdr ); @@ -1597,7 +1463,7 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage) msiobj_release( &package->hdr ); return r; } - msi_set_property( package->db, szDatabase, db->path, -1 ); + msi_set_property( package->db, L"DATABASE", db->path, -1 ); set_installed_prop( package ); msi_set_context( package ); @@ -1605,7 +1471,7 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage) if (msi_locate_product( product_code, &context ) == ERROR_SUCCESS) { TRACE("product already registered\n"); - msi_set_property( package->db, szProductToBeRegistered, szOne, -1 ); + msi_set_property( package->db, L"ProductToBeRegistered", L"1", -1 ); } msi_free(product_code); @@ -1779,12 +1645,6 @@ MSIHANDLE WINAPI MsiGetActiveDatabase(MSIHANDLE hInstall) static INT internal_ui_handler(MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIRECORD *record, LPCWSTR message) { - static const WCHAR szActionData[] = {'A','c','t','i','o','n','D','a','t','a',0}; - static const WCHAR szActionText[] = {'A','c','t','i','o','n','T','e','x','t',0}; - static const WCHAR szSetProgress[] = {'S','e','t','P','r','o','g','r','e','s','s',0}; - static const WCHAR szWindows_Installer[] = - {'W','i','n','d','o','w','s',' ','I','n','s','t','a','l','l','e','r',0}; - if (!package || (package->ui_level & INSTALLUILEVEL_MASK) == INSTALLUILEVEL_NONE) return 0; @@ -1798,17 +1658,17 @@ static INT internal_ui_handler(MSIPACKAGE *package, INSTALLMESSAGE eMessageType, if (package->ui_level & INSTALLUILEVEL_PROGRESSONLY) return 0; if (!(eMessageType & MB_ICONMASK)) eMessageType |= MB_ICONEXCLAMATION; - return MessageBoxW(gUIhwnd, message, szWindows_Installer, eMessageType & 0x00ffffff); + return MessageBoxW(gUIhwnd, message, L"Windows Installer", eMessageType & 0x00ffffff); case INSTALLMESSAGE_WARNING: if (package->ui_level & INSTALLUILEVEL_PROGRESSONLY) return 0; if (!(eMessageType & MB_ICONMASK)) eMessageType |= MB_ICONASTERISK; - return MessageBoxW(gUIhwnd, message, szWindows_Installer, eMessageType & 0x00ffffff); + return MessageBoxW(gUIhwnd, message, L"Windows Installer", eMessageType & 0x00ffffff); case INSTALLMESSAGE_USER: if (package->ui_level & INSTALLUILEVEL_PROGRESSONLY) return 0; if (!(eMessageType & MB_ICONMASK)) eMessageType |= MB_USERICON; - return MessageBoxW(gUIhwnd, message, szWindows_Installer, eMessageType & 0x00ffffff); + return MessageBoxW(gUIhwnd, message, L"Windows Installer", eMessageType & 0x00ffffff); case INSTALLMESSAGE_INFO: case INSTALLMESSAGE_INITIALIZE: case INSTALLMESSAGE_TERMINATE: @@ -1829,7 +1689,7 @@ static INT internal_ui_handler(MSIPACKAGE *package, INSTALLMESSAGE eMessageType, if (!uirow) return -1; deformat_string(package, MSI_RecordGetString(record, 2), &deformatted); MSI_RecordSetStringW(uirow, 1, deformatted); - msi_event_fire(package, szActionText, uirow); + msi_event_fire(package, L"ActionText", uirow); msi_free(deformatted); msiobj_release(&uirow->hdr); @@ -1840,7 +1700,7 @@ static INT internal_ui_handler(MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIRECORD *uirow = MSI_CreateRecord(1); if (!uirow) return -1; MSI_RecordSetStringW(uirow, 1, message); - msi_event_fire(package, szActionData, uirow); + msi_event_fire(package, L"ActionData", uirow); msiobj_release(&uirow->hdr); if (package->action_progress_increment) @@ -1849,13 +1709,13 @@ static INT internal_ui_handler(MSIPACKAGE *package, INSTALLMESSAGE eMessageType, if (!uirow) return -1; MSI_RecordSetInteger(uirow, 1, 2); MSI_RecordSetInteger(uirow, 2, package->action_progress_increment); - msi_event_fire(package, szSetProgress, uirow); + msi_event_fire(package, L"SetProgress", uirow); msiobj_release(&uirow->hdr); } return 1; } case INSTALLMESSAGE_PROGRESS: - msi_event_fire(package, szSetProgress, record); + msi_event_fire(package, L"SetProgress", record); return 1; case INSTALLMESSAGE_COMMONDATA: switch (MSI_RecordGetInteger(record, 1)) @@ -1874,8 +1734,6 @@ static INT internal_ui_handler(MSIPACKAGE *package, INSTALLMESSAGE eMessageType, } } -static const WCHAR szActionNotFound[] = {'D','E','B','U','G',':',' ','E','r','r','o','r',' ','[','1',']',':',' ',' ','A','c','t','i','o','n',' ','n','o','t',' ','f','o','u','n','d',':',' ','[','2',']',0}; - static const struct { int id; @@ -1883,7 +1741,7 @@ static const struct } internal_errors[] = { - {2726, szActionNotFound}, + {2726, L"DEBUG: Error [1]: Action not found: [2]"}, {0} }; @@ -1905,14 +1763,10 @@ static LPCWSTR get_internal_error_message(int error) /* Returned string must be freed */ LPWSTR msi_get_error_message(MSIDATABASE *db, int error) { - static const WCHAR query[] = - {'S','E','L','E','C','T',' ','`','M','e','s','s','a','g','e','`',' ', - 'F','R','O','M',' ','`','E','r','r','o','r','`',' ','W','H','E','R','E',' ', - '`','E','r','r','o','r','`',' ','=',' ','%','i',0}; MSIRECORD *record; LPWSTR ret = NULL; - if ((record = MSI_QueryGetRecord(db, query, error))) + if ((record = MSI_QueryGetRecord(db, L"SELECT `Message` FROM `Error` WHERE `Error` = %d", error))) { ret = msi_dup_record_field(record, 1); msiobj_release(&record->hdr); @@ -2042,7 +1896,7 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIREC template_rec = msi_dup_record_field(record, 0); template_prefix = msi_get_error_message(package->db, eMessageType >> 24); - if (!template_prefix) template_prefix = strdupW(szEmpty); + if (!template_prefix) template_prefix = strdupW(L""); if (!template_rec) { @@ -2074,19 +1928,17 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIREC msi_free(package->LastAction); msi_free(package->LastActionTemplate); package->LastAction = msi_dup_record_field(record, 1); - if (!package->LastAction) package->LastAction = strdupW(szEmpty); + if (!package->LastAction) package->LastAction = strdupW(L""); package->LastActionTemplate = msi_dup_record_field(record, 3); break; } case INSTALLMESSAGE_ACTIONDATA: if (package->LastAction && package->LastActionTemplate) { - static const WCHAR template_s[] = - {'{','{','%','s',':',' ','}','}','%','s',0}; size_t len = lstrlenW(package->LastAction) + lstrlenW(package->LastActionTemplate) + 7; WCHAR *template = msi_alloc(len * sizeof(WCHAR)); if (!template) return ERROR_OUTOFMEMORY; - swprintf(template, len, template_s, package->LastAction, package->LastActionTemplate); + swprintf(template, len, L"{{%s: }}%s", package->LastAction, package->LastActionTemplate); MSI_RecordSetStringW(record, 0, template); msi_free(template); } @@ -2188,19 +2040,6 @@ void msi_reset_source_folders( MSIPACKAGE *package ) UINT msi_set_property( MSIDATABASE *db, const WCHAR *name, const WCHAR *value, int len ) { - static const WCHAR insert_query[] = { - 'I','N','S','E','R','T',' ','I','N','T','O',' ', - '`','_','P','r','o','p','e','r','t','y','`',' ', - '(','`','_','P','r','o','p','e','r','t','y','`',',','`','V','a','l','u','e','`',')',' ', - 'V','A','L','U','E','S',' ','(','?',',','?',')',0}; - static const WCHAR update_query[] = { - 'U','P','D','A','T','E',' ','`','_','P','r','o','p','e','r','t','y','`',' ', - 'S','E','T',' ','`','V','a','l','u','e','`',' ','=',' ','?',' ','W','H','E','R','E',' ', - '`','_','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',0}; - static const WCHAR delete_query[] = { - 'D','E','L','E','T','E',' ','F','R','O','M',' ', - '`','_','P','r','o','p','e','r','t','y','`',' ','W','H','E','R','E',' ', - '`','_','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',0}; MSIQUERY *view; MSIRECORD *row = NULL; DWORD sz = 0; @@ -2221,17 +2060,17 @@ UINT msi_set_property( MSIDATABASE *db, const WCHAR *name, const WCHAR *value, i rc = msi_get_property( db, name, 0, &sz ); if (!value || (!*value && !len)) { - swprintf( query, ARRAY_SIZE(query), delete_query, name ); + swprintf( query, ARRAY_SIZE(query), L"DELETE FROM `_Property` WHERE `_Property` = '%s'", name ); } else if (rc == ERROR_MORE_DATA || rc == ERROR_SUCCESS) { - swprintf( query, ARRAY_SIZE(query), update_query, name ); + swprintf( query, ARRAY_SIZE(query), L"UPDATE `_Property` SET `Value` = ? WHERE `_Property` = '%s'", name ); row = MSI_CreateRecord(1); msi_record_set_string( row, 1, value, len ); } else { - lstrcpyW( query, insert_query ); + lstrcpyW( query, L"INSERT INTO `_Property` (`_Property`,`Value`) VALUES (?,?)" ); row = MSI_CreateRecord(2); msi_record_set_string( row, 1, name, -1 ); msi_record_set_string( row, 2, value, len ); @@ -2275,7 +2114,7 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue } ret = msi_set_property( package->db, szName, szValue, -1 ); - if (ret == ERROR_SUCCESS && !wcscmp( szName, szSourceDir )) + if (ret == ERROR_SUCCESS && !wcscmp( szName, L"SourceDir" )) msi_reset_source_folders( package ); msiobj_release( &package->hdr ); @@ -2284,23 +2123,16 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue static MSIRECORD *msi_get_property_row( MSIDATABASE *db, LPCWSTR name ) { - static const WCHAR query[]= { - 'S','E','L','E','C','T',' ','`','V','a','l','u','e','`',' ', - 'F','R','O','M',' ' ,'`','_','P','r','o','p','e','r','t','y','`',' ', - 'W','H','E','R','E',' ' ,'`','_','P','r','o','p','e','r','t','y','`','=','?',0}; MSIRECORD *rec, *row = NULL; MSIQUERY *view; UINT r; - - static const WCHAR szDate[] = {'D','a','t','e',0}; - static const WCHAR szTime[] = {'T','i','m','e',0}; WCHAR *buffer; int length; if (!name || !*name) return NULL; - if (!wcscmp(name, szDate)) + if (!wcscmp(name, L"Date")) { length = GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, NULL, 0); if (!length) @@ -2318,7 +2150,7 @@ static MSIRECORD *msi_get_property_row( MSIDATABASE *db, LPCWSTR name ) msi_free(buffer); return row; } - else if (!wcscmp(name, szTime)) + else if (!wcscmp(name, L"Time")) { length = GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOTIMEMARKER, NULL, NULL, NULL, 0); if (!length) @@ -2343,7 +2175,7 @@ static MSIRECORD *msi_get_property_row( MSIDATABASE *db, LPCWSTR name ) MSI_RecordSetStringW(rec, 1, name); - r = MSI_DatabaseOpenViewW(db, query, &view); + r = MSI_DatabaseOpenViewW(db, L"SELECT `Value` FROM `_Property` WHERE `_Property`=?", &view); if (r == ERROR_SUCCESS) { MSI_ViewExecute(view, rec); @@ -2422,7 +2254,7 @@ int msi_get_property_int( MSIDATABASE *db, LPCWSTR prop, int def ) UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD *sz) { - const WCHAR *value = szEmpty; + const WCHAR *value = L""; MSIPACKAGE *package; MSIRECORD *row; WCHAR *nameW; @@ -2494,7 +2326,7 @@ UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD UINT WINAPI MsiGetPropertyW(MSIHANDLE hinst, const WCHAR *name, WCHAR *buf, DWORD *sz) { - const WCHAR *value = szEmpty; + const WCHAR *value = L""; MSIPACKAGE *package; MSIRECORD *row; int len = 0;
2 years, 9 months
1
0
0
0
[reactos] 305/360: [WINESYNC] msi: Use wide character string literals in msi.c.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a808407b1570ebb26fa04…
commit a808407b1570ebb26fa04e74d54237bdb7d8c915 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 21:30:13 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:34 2022 +0100 [WINESYNC] msi: Use wide character string literals in msi.c. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 8255da2249816b77b709d1e6c888760c5e59a8f8 by Hans Leidekker <hans(a)codeweavers.com> --- dll/win32/msi/msi.c | 182 ++++++++++++++++++---------------------------------- 1 file changed, 64 insertions(+), 118 deletions(-) diff --git a/dll/win32/msi/msi.c b/dll/win32/msi/msi.c index 00867b5f8ba..723b935bdcc 100644 --- a/dll/win32/msi/msi.c +++ b/dll/win32/msi/msi.c @@ -53,8 +53,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); BOOL is_wow64; -static const WCHAR installerW[] = {'\\','I','n','s','t','a','l','l','e','r',0}; - UINT msi_locate_product(LPCWSTR szProduct, MSIINSTALLCONTEXT *context) { HKEY hkey = NULL; @@ -109,10 +107,6 @@ static UINT MSI_OpenProductW(LPCWSTR szProduct, MSIPACKAGE **package) LPWSTR path; MSIINSTALLCONTEXT context; - static const WCHAR managed[] = { - 'M','a','n','a','g','e','d','L','o','c','a','l','P','a','c','k','a','g','e',0}; - static const WCHAR local[] = {'L','o','c','a','l','P','a','c','k','a','g','e',0}; - TRACE("%s %p\n", debugstr_w(szProduct), package); r = msi_locate_product(szProduct, &context); @@ -124,9 +118,9 @@ static UINT MSI_OpenProductW(LPCWSTR szProduct, MSIPACKAGE **package) return ERROR_UNKNOWN_PRODUCT; if (context == MSIINSTALLCONTEXT_USERMANAGED) - path = msi_reg_get_val_str(props, managed); + path = msi_reg_get_val_str(props, L"ManagedLocalPackage"); else - path = msi_reg_get_val_str(props, local); + path = msi_reg_get_val_str(props, L"LocalPackage"); r = ERROR_UNKNOWN_PRODUCT; @@ -250,7 +244,7 @@ UINT WINAPI MsiInstallProductW(LPCWSTR szPackagePath, LPCWSTR szCommandLine) if (!*szPackagePath) return ERROR_PATH_NOT_FOUND; - reinstallmode = msi_get_command_line_option(szCommandLine, szReinstallMode, &len); + reinstallmode = msi_get_command_line_option(szCommandLine, L"REINSTALLMODE", &len); if (reinstallmode) { while (len > 0) @@ -292,7 +286,7 @@ UINT WINAPI MsiReinstallProductW(LPCWSTR szProduct, DWORD dwReinstallMode) { TRACE("%s %08x\n", debugstr_w(szProduct), dwReinstallMode); - return MsiReinstallFeatureW(szProduct, szAll, dwReinstallMode); + return MsiReinstallFeatureW(szProduct, L"ALL", dwReinstallMode); } UINT WINAPI MsiApplyPatchA(LPCSTR szPatchPackage, LPCSTR szInstallPackage, @@ -376,9 +370,6 @@ static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWS LPWSTR cmd, *codes = NULL; BOOL succeeded = FALSE; - static const WCHAR fmt[] = {'%','s',' ','P','A','T','C','H','=','"','%','s','"',0}; - static const WCHAR empty[] = {0}; - if (!szPatchPackage || !szPatchPackage[0]) return ERROR_INVALID_PARAMETER; @@ -386,16 +377,16 @@ static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWS return r; if (!szCommandLine) - cmd_ptr = empty; + cmd_ptr = L""; - size = lstrlenW(cmd_ptr) + lstrlenW(fmt) + lstrlenW(szPatchPackage) + 1; + size = lstrlenW(cmd_ptr) + lstrlenW(L"%s PATCH=\"%s\"") + lstrlenW(szPatchPackage) + 1; cmd = msi_alloc(size * sizeof(WCHAR)); if (!cmd) { msi_free(codes); return ERROR_OUTOFMEMORY; } - swprintf(cmd, size, fmt, cmd_ptr, szPatchPackage); + swprintf(cmd, size, L"%s PATCH=\"%s\"", cmd_ptr, szPatchPackage); if (szProductCode) r = MsiConfigureProductExW(szProductCode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, cmd); @@ -603,9 +594,6 @@ static UINT MSI_ApplicablePatchW( MSIPACKAGE *package, LPCWSTR patch ) /* IXMLDOMDocument should be set to XPath mode already */ static UINT MSI_ApplicablePatchXML( MSIPACKAGE *package, IXMLDOMDocument *desc ) { - static const WCHAR queryW[] = {'M','s','i','P','a','t','c','h','/', - 'T','a','r','g','e','t','P','r','o','d','u','c','t','/', - 'T','a','r','g','e','t','P','r','o','d','u','c','t','C','o','d','e',0}; UINT r = ERROR_FUNCTION_FAILED; IXMLDOMNodeList *list; LPWSTR product_code; @@ -613,7 +601,7 @@ static UINT MSI_ApplicablePatchXML( MSIPACKAGE *package, IXMLDOMDocument *desc ) HRESULT hr; BSTR s; - product_code = msi_dup_property( package->db, szProductCode ); + product_code = msi_dup_property( package->db, L"ProductCode" ); if (!product_code) { /* FIXME: the property ProductCode should be written into the DB somewhere */ @@ -621,7 +609,7 @@ static UINT MSI_ApplicablePatchXML( MSIPACKAGE *package, IXMLDOMDocument *desc ) return ERROR_SUCCESS; } - s = SysAllocString(queryW); + s = SysAllocString( L"MsiPatch/TargetProduct/TargetProductCode" ); hr = IXMLDOMDocument_selectNodes( desc, s, &list ); SysFreeString(s); if (hr != S_OK) @@ -808,7 +796,7 @@ static UINT open_package( const WCHAR *product, const WCHAR *usersid, r = MSIREG_OpenInstallProps( product, context, usersid, &props, FALSE ); if (r != ERROR_SUCCESS) return ERROR_BAD_CONFIGURATION; - if ((localpath = msi_reg_get_val_str( props, szLocalPackage ))) + if ((localpath = msi_reg_get_val_str( props, L"LocalPackage" ))) { lstrcpyW( sourcepath, localpath ); msi_free( localpath ); @@ -858,15 +846,6 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel, WCHAR sourcepath[MAX_PATH], filename[MAX_PATH]; LPWSTR commandline; - static const WCHAR szInstalled[] = { - ' ','I','n','s','t','a','l','l','e','d','=','1',0}; - static const WCHAR szMaxInstallLevel[] = { - ' ','I','N','S','T','A','L','L','L','E','V','E','L','=','3','2','7','6','7',0}; - static const WCHAR szRemoveAll[] = { - ' ','R','E','M','O','V','E','=','A','L','L',0}; - static const WCHAR szMachine[] = { - ' ','A','L','L','U','S','E','R','S','=','1',0}; - TRACE("%s %d %d %s\n",debugstr_w(szProduct), iInstallLevel, eInstallState, debugstr_w(szCommandLine)); @@ -888,19 +867,19 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel, if (r != ERROR_SUCCESS) return r; - sz = lstrlenW(szInstalled) + 1; + sz = lstrlenW(L" Installed=1") + 1; if (szCommandLine) sz += lstrlenW(szCommandLine); if (eInstallState != INSTALLSTATE_DEFAULT) - sz += lstrlenW(szMaxInstallLevel); + sz += lstrlenW(L" INSTALLLEVEL=32767"); if (eInstallState == INSTALLSTATE_ABSENT) - sz += lstrlenW(szRemoveAll); + sz += lstrlenW(L" REMOVE=ALL"); if (context == MSIINSTALLCONTEXT_MACHINE) - sz += lstrlenW(szMachine); + sz += lstrlenW(L" ALLUSERS=1"); commandline = msi_alloc(sz * sizeof(WCHAR)); if (!commandline) @@ -911,16 +890,16 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel, commandline[0] = 0; if (szCommandLine) - lstrcpyW(commandline,szCommandLine); + lstrcpyW(commandline, szCommandLine); if (eInstallState != INSTALLSTATE_DEFAULT) - lstrcatW(commandline, szMaxInstallLevel); + lstrcatW(commandline, L" INSTALLLEVEL=32767"); if (eInstallState == INSTALLSTATE_ABSENT) - lstrcatW(commandline, szRemoveAll); + lstrcatW(commandline, L" REMOVE=ALL"); if (context == MSIINSTALLCONTEXT_MACHINE) - lstrcatW(commandline, szMachine); + lstrcatW(commandline, L" ALLUSERS=1"); sz = sizeof(sourcepath); MsiSourceListGetInfoW(szProduct, NULL, context, MSICODE_PRODUCT, @@ -1041,7 +1020,7 @@ UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer) return ERROR_INVALID_PARAMETER; if (MSIREG_OpenUserDataComponentKey(szComponent, NULL, &compkey, FALSE) != ERROR_SUCCESS && - MSIREG_OpenUserDataComponentKey(szComponent, szLocalSid, &compkey, FALSE) != ERROR_SUCCESS) + MSIREG_OpenUserDataComponentKey(szComponent, L"S-1-5-18", &compkey, FALSE) != ERROR_SUCCESS) { return ERROR_UNKNOWN_COMPONENT; } @@ -1102,12 +1081,11 @@ static WCHAR *reg_get_value( HKEY hkey, const WCHAR *name, DWORD *type ) if (*type == REG_SZ) return msi_reg_get_val_str( hkey, name ); if (*type == REG_DWORD) { - static const WCHAR fmt[] = {'%','u',0}; WCHAR temp[11]; DWORD val; if (!msi_reg_get_val_dword( hkey, name, &val )) return NULL; - swprintf( temp, ARRAY_SIZE(temp), fmt, val ); + swprintf( temp, ARRAY_SIZE(temp), L"%u", val ); return strdupW( temp ); } @@ -1119,10 +1097,6 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, awstring *szValue, LPDWORD pcchValueBuf) { static WCHAR empty[] = {0}; - static const WCHAR sourcelist[] = {'S','o','u','r','c','e','L','i','s','t',0}; - static const WCHAR display_name[] = {'D','i','s','p','l','a','y','N','a','m','e',0}; - static const WCHAR display_version[] = {'D','i','s','p','l','a','y','V','e','r','s','i','o','n',0}; - static const WCHAR assignment[] = {'A','s','s','i','g','n','m','e','n','t',0}; MSIINSTALLCONTEXT context = MSIINSTALLCONTEXT_USERUNMANAGED; UINT r = ERROR_UNKNOWN_PROPERTY; HKEY prodkey, userdata, source; @@ -1182,9 +1156,9 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, } if (!wcscmp( szAttribute, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW )) - szAttribute = display_name; + szAttribute = L"DisplayName"; else if (!wcscmp( szAttribute, INSTALLPROPERTY_VERSIONSTRINGW )) - szAttribute = display_version; + szAttribute = L"DisplayVersion"; val = reg_get_value(userdata, szAttribute, &type); if (!val) @@ -1209,11 +1183,11 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, } if (!wcscmp( szAttribute, INSTALLPROPERTY_ASSIGNMENTTYPEW )) - szAttribute = assignment; + szAttribute = L"Assignment"; if (!wcscmp( szAttribute, INSTALLPROPERTY_PACKAGENAMEW )) { - res = RegOpenKeyW(prodkey, sourcelist, &source); + res = RegOpenKeyW(prodkey, L"SourceList", &source); if (res != ERROR_SUCCESS) { r = ERROR_UNKNOWN_PRODUCT; @@ -1426,14 +1400,6 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, LPCWSTR szProperty, LPWSTR szValue, LPDWORD pcchValue) { - static const WCHAR five[] = {'5',0}; - static const WCHAR displayname[] = { - 'D','i','s','p','l','a','y','N','a','m','e',0}; - static const WCHAR displayversion[] = { - 'D','i','s','p','l','a','y','V','e','r','s','i','o','n',0}; - static const WCHAR managed_local_package[] = { - 'M','a','n','a','g','e','d','L','o','c','a','l', - 'P','a','c','k','a','g','e',0}; WCHAR *val = NULL, squashed_pc[SQUASHED_GUID_SIZE]; LPCWSTR package = NULL; HKEY props = NULL, prod, classes = NULL, managed, hkey = NULL; @@ -1478,7 +1444,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, } else if (dwContext == MSIINSTALLCONTEXT_USERMANAGED) { - package = managed_local_package; + package = L"ManagedLocalPackage"; if (!props && !managed) goto done; @@ -1522,13 +1488,13 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, msi_free(val); if (!wcscmp( szProperty, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW )) - szProperty = displayname; + szProperty = L"DisplayName"; else if (!wcscmp( szProperty, INSTALLPROPERTY_VERSIONSTRINGW )) - szProperty = displayversion; + szProperty = L"DisplayVersion"; val = reg_get_value(props, szProperty, &type); if (!val) - val = strdupW(szEmpty); + val = strdupW(L""); r = msi_copy_outval(val, szValue, pcchValue); } @@ -1553,7 +1519,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, val = reg_get_value(hkey, szProperty, &type); if (!val) - val = strdupW(szEmpty); + val = strdupW(L""); r = msi_copy_outval(val, szValue, pcchValue); } @@ -1568,10 +1534,10 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, goto done; msi_free(val); - val = strdupW(five); + val = strdupW(L"5"); } else - val = strdupW(szOne); + val = strdupW(L"1"); r = msi_copy_outval(val, szValue, pcchValue); goto done; @@ -1579,13 +1545,13 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, else if (props && (val = reg_get_value(props, package, &type))) { msi_free(val); - val = strdupW(five); + val = strdupW(L"5"); r = msi_copy_outval(val, szValue, pcchValue); goto done; } if (prod || managed) - val = strdupW(szOne); + val = strdupW(L"1"); else goto done; @@ -1597,7 +1563,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, goto done; /* FIXME */ - val = strdupW(szEmpty); + val = strdupW(L""); r = msi_copy_outval(val, szValue, pcchValue); } else @@ -1700,8 +1666,6 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, LPCWSTR szProperty, LPWSTR lpValue, DWORD *pcchValue) { - static const WCHAR szManagedPackage[] = - {'M','a','n','a','g','e','d','L','o','c','a','l','P','a','c','k','a','g','e',0}; WCHAR *val = NULL, squashed_pc[SQUASHED_GUID_SIZE], squashed_patch[SQUASHED_GUID_SIZE]; HKEY udprod = 0, prod = 0, props = 0; HKEY patch = 0, patches = 0; @@ -1735,7 +1699,7 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode, if (dwContext == MSIINSTALLCONTEXT_MACHINE && szUserSid) return ERROR_INVALID_PARAMETER; - if (szUserSid && !wcscmp( szUserSid, szLocalSid )) + if (szUserSid && !wcscmp( szUserSid, L"S-1-5-18" )) return ERROR_INVALID_PARAMETER; if (MSIREG_OpenUserDataProductKey(szProductCode, dwContext, NULL, @@ -1748,7 +1712,7 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode, r = ERROR_UNKNOWN_PATCH; - res = RegOpenKeyExW(udprod, szPatches, 0, KEY_READ, &patches); + res = RegOpenKeyExW(udprod, L"Patches", 0, KEY_READ, &patches); if (res != ERROR_SUCCESS) goto done; @@ -1762,7 +1726,7 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode, &prod, FALSE) != ERROR_SUCCESS) goto done; - res = RegOpenKeyExW(prod, szPatches, 0, KEY_ALL_ACCESS, &prodpatches); + res = RegOpenKeyExW(prod, L"Patches", 0, KEY_ALL_ACCESS, &prodpatches); if (res != ERROR_SUCCESS) goto done; @@ -1778,13 +1742,13 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode, if (!wcscmp( szProperty, INSTALLPROPERTY_LOCALPACKAGEW )) { if (dwContext == MSIINSTALLCONTEXT_USERMANAGED) - szProperty = szManagedPackage; + szProperty = L"ManagedLocalPackage"; datakey = udpatch; } else if (!wcscmp( szProperty, INSTALLPROPERTY_INSTALLDATEW )) { datakey = patch; - szProperty = szInstalled; + szProperty = L"Installed"; } else if (!wcscmp( szProperty, INSTALLPROPERTY_UNINSTALLABLEW ) || !wcscmp( szProperty, INSTALLPROPERTY_PATCHSTATEW ) || @@ -1802,7 +1766,7 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode, val = reg_get_value(datakey, szProperty, &type); if (!val) - val = strdupW(szEmpty); + val = strdupW(L""); r = ERROR_SUCCESS; @@ -2048,7 +2012,7 @@ UINT WINAPI MsiEnumComponentCostsW( MSIHANDLE handle, LPCWSTR component, DWORD i return r; } - if (!msi_get_property_int( package->db, szCostingComplete, 0 )) + if (!msi_get_property_int( package->db, L"CostingComplete", 0 )) { msiobj_release( &package->hdr ); return ERROR_FUNCTION_NOT_CALLED; @@ -2145,19 +2109,14 @@ static BOOL msi_comp_find_package(LPCWSTR prodcode, MSIINSTALLCONTEXT context) LONG res; UINT r; - static const WCHAR local_package[] = {'L','o','c','a','l','P','a','c','k','a','g','e',0}; - static const WCHAR managed_local_package[] = { - 'M','a','n','a','g','e','d','L','o','c','a','l','P','a','c','k','a','g','e',0 - }; - r = MSIREG_OpenInstallProps(prodcode, context, NULL, &hkey, FALSE); if (r != ERROR_SUCCESS) return FALSE; if (context == MSIINSTALLCONTEXT_USERMANAGED) - package = managed_local_package; + package = L"ManagedLocalPackage"; else - package = local_package; + package = L"LocalPackage"; sz = 0; res = RegQueryValueExW(hkey, package, NULL, NULL, NULL, &sz); @@ -2175,7 +2134,7 @@ static UINT msi_comp_find_prodcode(WCHAR *squashed_pc, UINT r; if (context == MSIINSTALLCONTEXT_MACHINE) - r = MSIREG_OpenUserDataComponentKey(comp, szLocalSid, &hkey, FALSE); + r = MSIREG_OpenUserDataComponentKey(comp, L"S-1-5-18", &hkey, FALSE); else r = MSIREG_OpenUserDataComponentKey(comp, NULL, &hkey, FALSE); @@ -2308,7 +2267,7 @@ INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct) if (r != ERROR_SUCCESS) goto done; - if (!msi_reg_get_val_dword(userdata, szWindowsInstaller, &val)) + if (!msi_reg_get_val_dword(userdata, L"WindowsInstaller", &val)) goto done; if (val) @@ -2724,11 +2683,6 @@ UINT WINAPI MsiGetProductPropertyW(MSIHANDLE hProduct, LPCWSTR szProperty, LPCWSTR val; UINT r; - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','P','r','o','p','e','r','t','y','`',' ','W','H','E','R','E',' ', - '`','P','r','o','p','e','r','t','y','`','=','\'','%','s','\'',0}; - TRACE("(%d, %s, %p, %p)\n", hProduct, debugstr_w(szProperty), szValue, pccbValue); @@ -2742,7 +2696,7 @@ UINT WINAPI MsiGetProductPropertyW(MSIHANDLE hProduct, LPCWSTR szProperty, if (!package) return ERROR_INVALID_HANDLE; - r = MSI_OpenQuery(package->db, &view, query, szProperty); + r = MSI_OpenQuery(package->db, &view, L"SELECT * FROM `Property` WHERE `Property` = '%s'", szProperty); if (r != ERROR_SUCCESS) goto done; @@ -2829,11 +2783,11 @@ static BOOL open_userdata_comp_key( const WCHAR *comp, const WCHAR *usersid, MSI { if (ctx & MSIINSTALLCONTEXT_MACHINE) { - if (!MSIREG_OpenUserDataComponentKey( comp, szLocalSid, hkey, FALSE )) return TRUE; + if (!MSIREG_OpenUserDataComponentKey( comp, L"S-1-5-18", hkey, FALSE )) return TRUE; } if (ctx & (MSIINSTALLCONTEXT_USERMANAGED|MSIINSTALLCONTEXT_USERUNMANAGED)) { - if (usersid && !wcsicmp( usersid, szAllSid )) + if (usersid && !wcsicmp( usersid, L"S-1-1-0" )) { FIXME( "only looking at the current user\n" ); usersid = NULL; @@ -2847,8 +2801,6 @@ static INSTALLSTATE MSI_GetComponentPath( const WCHAR *szProduct, const WCHAR *s const WCHAR *szUserSid, MSIINSTALLCONTEXT ctx, awstring *lpPathBuf, DWORD *pcchBuf ) { - static const WCHAR wininstaller[] = - {'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0}; WCHAR *path = NULL, squashed_pc[SQUASHED_GUID_SIZE], squashed_comp[SQUASHED_GUID_SIZE]; HKEY hkey; INSTALLSTATE state; @@ -2877,7 +2829,7 @@ static INSTALLSTATE MSI_GetComponentPath( const WCHAR *szProduct, const WCHAR *s if ((!MSIREG_OpenInstallProps(szProduct, MSIINSTALLCONTEXT_MACHINE, NULL, &hkey, FALSE) || !MSIREG_OpenUserDataProductKey(szProduct, MSIINSTALLCONTEXT_USERUNMANAGED, NULL, &hkey, FALSE)) && - msi_reg_get_val_dword(hkey, wininstaller, &version) && + msi_reg_get_val_dword(hkey, L"WindowsInstaller", &version) && GetFileAttributesW(path) != INVALID_FILE_ATTRIBUTES) { RegCloseKey(hkey); @@ -2966,7 +2918,7 @@ end: */ INSTALLSTATE WINAPI MsiGetComponentPathW( LPCWSTR product, LPCWSTR comp, LPWSTR buf, LPDWORD buflen ) { - return MsiGetComponentPathExW( product, comp, szAllSid, MSIINSTALLCONTEXT_ALL, buf, buflen ); + return MsiGetComponentPathExW( product, comp, L"S-1-1-0", MSIINSTALLCONTEXT_ALL, buf, buflen ); } /****************************************************************** @@ -3028,7 +2980,7 @@ static UINT query_feature_state( const WCHAR *product, const WCHAR *squashed, co } StringFromGUID2( &guid, comp, GUID_SIZE ); if (ctx == MSIINSTALLCONTEXT_MACHINE) - r = MSIREG_OpenUserDataComponentKey( comp, szLocalSid, &hkey, FALSE ); + r = MSIREG_OpenUserDataComponentKey( comp, L"S-1-5-18", &hkey, FALSE ); else r = MSIREG_OpenUserDataComponentKey( comp, usersid, &hkey, FALSE ); @@ -3214,9 +3166,6 @@ end: static UINT get_file_version( const WCHAR *path, WCHAR *verbuf, DWORD *verlen, WCHAR *langbuf, DWORD *langlen ) { - static const WCHAR szVersionResource[] = {'\\',0}; - static const WCHAR szVersionFormat[] = {'%','d','.','%','d','.','%','d','.','%','d',0}; - static const WCHAR szLangFormat[] = {'%','d',0}; UINT ret = ERROR_MORE_DATA; DWORD len, error; LPVOID version; @@ -3244,9 +3193,9 @@ static UINT get_file_version( const WCHAR *path, WCHAR *verbuf, DWORD *verlen, } if (verlen) { - if (VerQueryValueW( version, szVersionResource, (LPVOID *)&ffi, &len ) && len > 0) + if (VerQueryValueW( version, L"\\", (LPVOID *)&ffi, &len ) && len > 0) { - swprintf( tmp, ARRAY_SIZE(tmp), szVersionFormat, + swprintf( tmp, ARRAY_SIZE(tmp), L"%d.%d.%d.%d", HIWORD(ffi->dwFileVersionMS), LOWORD(ffi->dwFileVersionMS), HIWORD(ffi->dwFileVersionLS), LOWORD(ffi->dwFileVersionLS) ); if (verbuf) lstrcpynW( verbuf, tmp, *verlen ); @@ -3262,9 +3211,9 @@ static UINT get_file_version( const WCHAR *path, WCHAR *verbuf, DWORD *verlen, } if (langlen) { - if (VerQueryValueW( version, szLangResource, (LPVOID *)&lang, &len ) && len > 0) + if (VerQueryValueW( version, L"\\VarFileInfo\\Translation", (LPVOID *)&lang, &len ) && len > 0) { - swprintf( tmp, ARRAY_SIZE(tmp), szLangFormat, *lang ); + swprintf( tmp, ARRAY_SIZE(tmp), L"%d", *lang ); if (langbuf) lstrcpynW( langbuf, tmp, *langlen ); len = lstrlenW( tmp ); if (*langlen > len) ret = ERROR_SUCCESS; @@ -3496,7 +3445,7 @@ static UINT MSI_ProvideQualifiedComponentEx(LPCWSTR szComponent, StringFromGUID2( &guid, comp, ARRAY_SIZE( comp )); } - state = MSI_GetComponentPath( szProduct, comp, szAllSid, MSIINSTALLCONTEXT_ALL, lpPathBuf, pcchPathBuf ); + state = MSI_GetComponentPath( szProduct, comp, L"S-1-1-0", MSIINSTALLCONTEXT_ALL, lpPathBuf, pcchPathBuf ); if (state == INSTALLSTATE_MOREDATA) return ERROR_MORE_DATA; if (state != INSTALLSTATE_LOCAL) return ERROR_FILE_NOT_FOUND; @@ -3658,7 +3607,7 @@ static USERINFOSTATE MSI_GetUserInfo(LPCWSTR szProduct, if (pcchOrgNameBuf) { orgptr = org; - if (!orgptr) orgptr = szEmpty; + if (!orgptr) orgptr = L""; r = msi_strcpy_to_awstring(orgptr, -1, lpOrgNameBuf, pcchOrgNameBuf); if (r == ERROR_MORE_DATA) @@ -3755,7 +3704,6 @@ UINT WINAPI MsiCollectUserInfoW(LPCWSTR szProduct) MSIHANDLE handle; UINT rc; MSIPACKAGE *package; - static const WCHAR szFirstRun[] = {'F','i','r','s','t','R','u','n',0}; TRACE("(%s)\n",debugstr_w(szProduct)); @@ -3768,7 +3716,7 @@ UINT WINAPI MsiCollectUserInfoW(LPCWSTR szProduct) if (!package) return ERROR_CALL_NOT_IMPLEMENTED; - rc = ACTION_PerformAction(package, szFirstRun); + rc = ACTION_PerformAction(package, L"FirstRun"); msiobj_release( &package->hdr ); MsiCloseHandle(handle); @@ -3781,7 +3729,6 @@ UINT WINAPI MsiCollectUserInfoA(LPCSTR szProduct) MSIHANDLE handle; UINT rc; MSIPACKAGE *package; - static const WCHAR szFirstRun[] = {'F','i','r','s','t','R','u','n',0}; TRACE("(%s)\n",debugstr_a(szProduct)); @@ -3794,7 +3741,7 @@ UINT WINAPI MsiCollectUserInfoA(LPCSTR szProduct) if (!package) return ERROR_CALL_NOT_IMPLEMENTED; - rc = ACTION_PerformAction(package, szFirstRun); + rc = ACTION_PerformAction(package, L"FirstRun"); msiobj_release( &package->hdr ); MsiCloseHandle(handle); @@ -3875,7 +3822,7 @@ UINT WINAPI MsiConfigureFeatureW(LPCWSTR szProduct, LPCWSTR szFeature, INSTALLST MsiSetInternalUI( INSTALLUILEVEL_BASIC, NULL ); - r = ACTION_PerformAction(package, szCostInitialize); + r = ACTION_PerformAction(package, L"CostInitialize"); if (r != ERROR_SUCCESS) goto end; @@ -3911,7 +3858,7 @@ UINT WINAPI MsiCreateAndVerifyInstallerDirectory(DWORD dwReserved) if (!GetWindowsDirectoryW(path, MAX_PATH)) return ERROR_FUNCTION_FAILED; - lstrcatW(path, installerW); + lstrcatW(path, L"\\Installer"); if (!CreateDirectoryW(path, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) return ERROR_FUNCTION_FAILED; @@ -4006,7 +3953,6 @@ UINT WINAPI MsiGetShortcutTargetW( LPCWSTR szShortcutTarget, UINT WINAPI MsiReinstallFeatureW( LPCWSTR szProduct, LPCWSTR szFeature, DWORD dwReinstallMode ) { - static const WCHAR fmtW[] = {'%','s','=','%','s',' ','%','s','=','%','s',0}; MSIPACKAGE *package; MSIINSTALLCONTEXT context; UINT r; @@ -4060,14 +4006,14 @@ UINT WINAPI MsiReinstallFeatureW( LPCWSTR szProduct, LPCWSTR szFeature, DWORD dw if (r != ERROR_SUCCESS) return r; - sz = (lstrlenW( fmtW ) + lstrlenW( szReinstallMode ) + lstrlenW( reinstallmode )) * sizeof(WCHAR); - sz += (lstrlenW( szReinstall ) + lstrlenW( szFeature )) * sizeof(WCHAR); + sz = (lstrlenW( L"%s=%s %s=%s" ) + lstrlenW( L"REINSTALLMODE" ) + lstrlenW( reinstallmode )) * sizeof(WCHAR); + sz += (lstrlenW( L"REINSTALL" ) + lstrlenW( szFeature )) * sizeof(WCHAR); if (!(cmdline = msi_alloc( sz ))) { msiobj_release( &package->hdr ); return ERROR_OUTOFMEMORY; } - swprintf( cmdline, sz / sizeof(WCHAR), fmtW, szReinstallMode, reinstallmode, szReinstall, szFeature ); + swprintf( cmdline, sz / sizeof(WCHAR), L"%s=%s %s=%s", L"REINSTALLMODE", reinstallmode, L"REINSTALL", szFeature ); r = MSI_InstallPackage( package, sourcepath, cmdline ); msiobj_release( &package->hdr );
2 years, 9 months
1
0
0
0
[reactos] 304/360: [WINESYNC] msi: Use wide character string literals in dialog.c.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9066c718b02e92f503345…
commit 9066c718b02e92f50334592302881425ab8d502d Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 21:24:17 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:34 2022 +0100 [WINESYNC] msi: Use wide character string literals in dialog.c. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id d9fbe788af65c2b2696c446d765a34ae40e3226b by Hans Leidekker <hans(a)codeweavers.com> --- dll/win32/msi/dialog.c | 501 +++++++++++++++++-------------------------------- 1 file changed, 174 insertions(+), 327 deletions(-) diff --git a/dll/win32/msi/dialog.c b/dll/win32/msi/dialog.c index fa4853eb3ce..18a92e6fb9b 100644 --- a/dll/win32/msi/dialog.c +++ b/dll/win32/msi/dialog.c @@ -117,7 +117,7 @@ struct subscriber }; typedef UINT (*msi_dialog_control_func)( msi_dialog *dialog, MSIRECORD *rec ); -struct control_handler +struct control_handler { LPCWSTR control_type; msi_dialog_control_func func; @@ -130,38 +130,6 @@ typedef struct LPWSTR propval; } radio_button_group_descr; -static const WCHAR szMsiDialogClass[] = { 'M','s','i','D','i','a','l','o','g','C','l','o','s','e','C','l','a','s','s',0 }; -static const WCHAR szMsiHiddenWindow[] = { 'M','s','i','H','i','d','d','e','n','W','i','n','d','o','w',0 }; -static const WCHAR szStatic[] = { 'S','t','a','t','i','c',0 }; -static const WCHAR szButton[] = { 'B','U','T','T','O','N', 0 }; -static const WCHAR szButtonData[] = { 'M','S','I','D','A','T','A',0 }; -static const WCHAR szProgress[] = { 'P','r','o','g','r','e','s','s',0 }; -static const WCHAR szText[] = { 'T','e','x','t',0 }; -static const WCHAR szPushButton[] = { 'P','u','s','h','B','u','t','t','o','n',0 }; -static const WCHAR szLine[] = { 'L','i','n','e',0 }; -static const WCHAR szBitmap[] = { 'B','i','t','m','a','p',0 }; -static const WCHAR szCheckBox[] = { 'C','h','e','c','k','B','o','x',0 }; -static const WCHAR szScrollableText[] = { 'S','c','r','o','l','l','a','b','l','e','T','e','x','t',0 }; -static const WCHAR szComboBox[] = { 'C','o','m','b','o','B','o','x',0 }; -static const WCHAR szEdit[] = { 'E','d','i','t',0 }; -static const WCHAR szMaskedEdit[] = { 'M','a','s','k','e','d','E','d','i','t',0 }; -static const WCHAR szPathEdit[] = { 'P','a','t','h','E','d','i','t',0 }; -static const WCHAR szProgressBar[] = { 'P','r','o','g','r','e','s','s','B','a','r',0 }; -static const WCHAR szSetProgress[] = { 'S','e','t','P','r','o','g','r','e','s','s',0 }; -static const WCHAR szRadioButtonGroup[] = { 'R','a','d','i','o','B','u','t','t','o','n','G','r','o','u','p',0 }; -static const WCHAR szIcon[] = { 'I','c','o','n',0 }; -static const WCHAR szSelectionTree[] = { 'S','e','l','e','c','t','i','o','n','T','r','e','e',0 }; -static const WCHAR szGroupBox[] = { 'G','r','o','u','p','B','o','x',0 }; -static const WCHAR szListBox[] = { 'L','i','s','t','B','o','x',0 }; -static const WCHAR szDirectoryCombo[] = { 'D','i','r','e','c','t','o','r','y','C','o','m','b','o',0 }; -static const WCHAR szDirectoryList[] = { 'D','i','r','e','c','t','o','r','y','L','i','s','t',0 }; -static const WCHAR szVolumeCostList[] = { 'V','o','l','u','m','e','C','o','s','t','L','i','s','t',0 }; -static const WCHAR szVolumeSelectCombo[] = { 'V','o','l','u','m','e','S','e','l','e','c','t','C','o','m','b','o',0 }; -static const WCHAR szSelectionDescription[] = {'S','e','l','e','c','t','i','o','n','D','e','s','c','r','i','p','t','i','o','n',0}; -static const WCHAR szSelectionPath[] = {'S','e','l','e','c','t','i','o','n','P','a','t','h',0}; -static const WCHAR szHyperLink[] = {'H','y','p','e','r','L','i','n','k',0}; -static const WCHAR szListView[] = {'L','i','s','t','V','i','e','w',0}; - /* dialog sequencing */ #define WM_MSI_DIALOG_CREATE (WM_USER+0x100) @@ -376,15 +344,12 @@ static UINT msi_dialog_set_font( msi_dialog *dialog, HWND hwnd, LPCWSTR name ) static UINT msi_dialog_build_font_list( msi_dialog *dialog ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','T','e','x','t','S','t','y','l','e','`',0}; MSIQUERY *view; UINT r; TRACE("dialog %p\n", dialog ); - r = MSI_OpenQuery( dialog->package->db, &view, query ); + r = MSI_OpenQuery( dialog->package->db, &view, L"SELECT * FROM `TextStyle`" ); if( r != ERROR_SUCCESS ) return r; @@ -479,31 +444,13 @@ static LPWSTR msi_dialog_get_uitext( msi_dialog *dialog, LPCWSTR key ) MSIRECORD *rec; LPWSTR text; - static const WCHAR query[] = { - 's','e','l','e','c','t',' ','*',' ', - 'f','r','o','m',' ','`','U','I','T','e','x','t','`',' ', - 'w','h','e','r','e',' ','`','K','e','y','`',' ','=',' ','\'','%','s','\'',0 - }; - - rec = MSI_QueryGetRecord( dialog->package->db, query, key ); + rec = MSI_QueryGetRecord( dialog->package->db, L"SELECT * FROM `UIText` WHERE `Key` = '%s'", key ); if (!rec) return NULL; text = strdupW( MSI_RecordGetString( rec, 2 ) ); msiobj_release( &rec->hdr ); return text; } -static MSIRECORD *msi_get_binary_record( MSIDATABASE *db, LPCWSTR name ) -{ - static const WCHAR query[] = { - 's','e','l','e','c','t',' ','*',' ', - 'f','r','o','m',' ','B','i','n','a','r','y',' ', - 'w','h','e','r','e',' ', - '`','N','a','m','e','`',' ','=',' ','\'','%','s','\'',0 - }; - - return MSI_QueryGetRecord( db, query, name ); -} - static HANDLE msi_load_image( MSIDATABASE *db, LPCWSTR name, UINT type, UINT cx, UINT cy, UINT flags ) { @@ -516,7 +463,7 @@ static HANDLE msi_load_image( MSIDATABASE *db, LPCWSTR name, UINT type, if (!(tmp = msi_create_temp_file( db ))) return NULL; - rec = msi_get_binary_record( db, name ); + rec = MSI_QueryGetRecord( db, L"SELCT * FROM `Binary` WHERE `Name` = '%s'", name ); if( rec ) { r = MSI_RecordStreamToFile( rec, 2, tmp ); @@ -580,7 +527,7 @@ static void msi_dialog_update_all_controls( msi_dialog *dialog ) static void msi_dialog_set_property( MSIPACKAGE *package, LPCWSTR property, LPCWSTR value ) { UINT r = msi_set_property( package->db, property, value, -1 ); - if (r == ERROR_SUCCESS && !wcscmp( property, szSourceDir )) + if (r == ERROR_SUCCESS && !wcscmp( property, L"SourceDir" )) msi_reset_source_folders( package ); } @@ -606,7 +553,7 @@ struct msi_selection_tree_info static MSIFEATURE *msi_seltree_get_selected_feature( msi_control *control ) { - struct msi_selection_tree_info *info = GetPropW( control->hwnd, szButtonData ); + struct msi_selection_tree_info *info = GetPropW( control->hwnd, L"MSIDATA" ); return msi_seltree_feature_from_item( control->hwnd, info->selected ); } @@ -618,7 +565,7 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control, ctrl = msi_dialog_find_control( dialog, control ); if (!ctrl) return; - if( !wcscmp( attribute, szText ) ) + if( !wcscmp( attribute, L"Text" ) ) { const WCHAR *font_text, *text = NULL; WCHAR *font, *text_fmt = NULL; @@ -627,7 +574,7 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control, font = msi_dialog_get_style( font_text, &text ); deformat_string( dialog->package, text, &text_fmt ); if (text_fmt) text = text_fmt; - else text = szEmpty; + else text = L""; SetWindowTextW( ctrl->hwnd, text ); @@ -635,7 +582,7 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control, msi_free( text_fmt ); msi_dialog_check_messages( NULL ); } - else if( !wcscmp( attribute, szProgress ) ) + else if( !wcscmp( attribute, L"Progress" ) ) { DWORD func, val1, val2, units; @@ -690,12 +637,12 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control, break; } } - else if ( !wcscmp( attribute, szProperty ) ) + else if ( !wcscmp( attribute, L"Property" ) ) { MSIFEATURE *feature = msi_seltree_get_selected_feature( ctrl ); if (feature) msi_dialog_set_property( dialog->package, ctrl->property, feature->Directory ); } - else if ( !wcscmp( attribute, szSelectionPath ) ) + else if ( !wcscmp( attribute, L"SelectionPath" ) ) { BOOL indirect = ctrl->attributes & msidbControlAttributesIndirect; LPWSTR path = msi_dialog_dup_property( dialog, ctrl->property, indirect ); @@ -754,11 +701,6 @@ static UINT map_event( MSIRECORD *row, void *param ) static void dialog_map_events( msi_dialog *dialog, const WCHAR *control ) { - static const WCHAR queryW[] = - {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','E','v','e','n','t','M','a','p','p','i','n','g','`',' ', - 'W','H','E','R','E',' ','`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',' ', - 'A','N','D',' ','`','C','o','n','t','r','o','l','_','`',' ','=',' ','\'','%','s','\'',0}; MSIQUERY *view; struct dialog_control dialog_control = { @@ -766,7 +708,9 @@ static void dialog_map_events( msi_dialog *dialog, const WCHAR *control ) control }; - if (!MSI_OpenQuery( dialog->package->db, &view, queryW, dialog->name, control )) + if (!MSI_OpenQuery( dialog->package->db, &view, + L"SELECT * FROM `EventMapping` WHERE `Dialog_` = '%s' AND `Control_` = '%s'", + dialog->name, control )) { MSI_IterateRecords( view, NULL, map_event, &dialog_control ); msiobj_release( &view->hdr ); @@ -784,7 +728,7 @@ static msi_control *msi_dialog_add_control( msi_dialog *dialog, name = MSI_RecordGetString( rec, 2 ); control_type = MSI_RecordGetString( rec, 3 ); attributes = MSI_RecordGetInteger( rec, 8 ); - if (wcscmp( control_type, szScrollableText )) text = MSI_RecordGetString( rec, 10 ); + if (wcscmp( control_type, L"ScrollableText" )) text = MSI_RecordGetString( rec, 10 ); TRACE("%s, %s, %08x, %s, %08x\n", debugstr_w(szCls), debugstr_w(name), attributes, debugstr_w(text), style); @@ -831,7 +775,7 @@ MSIText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam); - info = GetPropW(hWnd, szButtonData); + info = GetPropW(hWnd, L"MSIDATA"); if( msg == WM_CTLCOLORSTATIC && ( info->attributes & msidbControlAttributesTransparent ) ) @@ -851,7 +795,7 @@ MSIText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) break; case WM_NCDESTROY: msi_free( info ); - RemovePropW( hWnd, szButtonData ); + RemovePropW( hWnd, L"MSIDATA" ); break; } @@ -867,7 +811,7 @@ static UINT msi_dialog_text_control( msi_dialog *dialog, MSIRECORD *rec ) TRACE("%p %p\n", dialog, rec); - control = msi_dialog_add_control( dialog, rec, szStatic, SS_LEFT | WS_GROUP ); + control = msi_dialog_add_control( dialog, rec, L"Static", SS_LEFT | WS_GROUP ); if( !control ) return ERROR_FUNCTION_FAILED; @@ -891,9 +835,9 @@ static UINT msi_dialog_text_control( msi_dialog *dialog, MSIRECORD *rec ) info->oldproc = (WNDPROC) SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC, (LONG_PTR)MSIText_WndProc ); - SetPropW( control->hwnd, szButtonData, info ); + SetPropW( control->hwnd, L"MSIDATA", info ); - event_subscribe( dialog, szSelectionPath, control_name, szSelectionPath ); + event_subscribe( dialog, L"SelectionPath", control_name, L"SelectionPath" ); return ERROR_SUCCESS; } @@ -920,7 +864,6 @@ static WCHAR *msi_get_binary_name( MSIPACKAGE *package, MSIRECORD *rec ) static UINT msi_dialog_set_property_event( msi_dialog *dialog, LPCWSTR event, LPCWSTR arg ) { - static const WCHAR szNullArg[] = {'{','}',0}; LPWSTR p, prop, arg_fmt = NULL; UINT len; @@ -931,8 +874,7 @@ static UINT msi_dialog_set_property_event( msi_dialog *dialog, LPCWSTR event, LP if (p && (p[1] == 0 || p[1] == ' ')) { *p = 0; - if (wcscmp( szNullArg, arg )) - deformat_string( dialog->package, arg, &arg_fmt ); + if (wcscmp( L"{}", arg )) deformat_string( dialog->package, arg, &arg_fmt ); msi_dialog_set_property( dialog->package, prop, arg_fmt ); msi_dialog_update_controls( dialog, prop ); msi_free( arg_fmt ); @@ -981,19 +923,15 @@ static UINT msi_dialog_control_event( MSIRECORD *rec, LPVOID param ) static UINT msi_dialog_button_handler( msi_dialog *dialog, msi_control *control, WPARAM param ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'C','o','n','t','r','o','l','E','v','e','n','t',' ','W','H','E','R','E',' ', - '`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',' ','A','N','D',' ', - '`','C','o','n','t','r','o','l','_','`',' ','=',' ','\'','%','s','\'',' ', - 'O','R','D','E','R',' ','B','Y',' ','`','O','r','d','e','r','i','n','g','`',0}; MSIQUERY *view; UINT r; if (HIWORD(param) != BN_CLICKED) return ERROR_SUCCESS; - r = MSI_OpenQuery( dialog->package->db, &view, query, dialog->name, control->name ); + r = MSI_OpenQuery( dialog->package->db, &view, + L"SELECT * FROM `ControlEvent` WHERE `Dialog_` = '%s' AND `Control_` = '%s' ORDER BY `Ordering`", + dialog->name, control->name ); if (r != ERROR_SUCCESS) { ERR("query failed\n"); @@ -1024,7 +962,7 @@ static HBITMAP msi_load_picture( MSIDATABASE *db, const WCHAR *name, INT cx, INT BITMAP bm; UINT r; - rec = msi_get_binary_record( db, name ); + rec = MSI_QueryGetRecord( db, L"SELCT * FROM `Binary` WHERE `Name` = '%s'", name ); if (!rec) goto end; @@ -1100,7 +1038,7 @@ static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec ) } } - control = msi_dialog_add_control( dialog, rec, szButton, style ); + control = msi_dialog_add_control( dialog, rec, L"BUTTON", style ); if (!control) return ERROR_FUNCTION_FAILED; @@ -1133,18 +1071,11 @@ static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec ) static LPWSTR msi_get_checkbox_value( msi_dialog *dialog, LPCWSTR prop ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ', - 'F','R','O','M',' ','`','C','h','e','c','k','B','o','x','`',' ', - 'W','H','E','R','E',' ', - '`','P','r','o','p','e','r','t','y','`',' ','=',' ', - '\'','%','s','\'',0 - }; MSIRECORD *rec = NULL; LPWSTR ret = NULL; /* find if there is a value associated with the checkbox */ - rec = MSI_QueryGetRecord( dialog->package->db, query, prop ); + rec = MSI_QueryGetRecord( dialog->package->db, L"SELECT * FROM `CheckBox` WHERE `Property` = '%s'", prop ); if (!rec) return ret; @@ -1179,7 +1110,6 @@ static UINT msi_dialog_get_checkbox_state( msi_dialog *dialog, msi_control *cont static void msi_dialog_set_checkbox_state( msi_dialog *dialog, msi_control *control, UINT state ) { - static const WCHAR szState[] = {'1',0}; LPCWSTR val; /* if uncheck then the property is set to NULL */ @@ -1193,7 +1123,7 @@ static void msi_dialog_set_checkbox_state( msi_dialog *dialog, msi_control *cont if (control->value && control->value[0]) val = control->value; else - val = szState; + val = L"1"; msi_dialog_set_property( dialog->package, control->property, val ); } @@ -1228,7 +1158,7 @@ static UINT msi_dialog_checkbox_control( msi_dialog *dialog, MSIRECORD *rec ) TRACE("%p %p\n", dialog, rec); - control = msi_dialog_add_control( dialog, rec, szButton, BS_CHECKBOX | BS_MULTILINE | WS_TABSTOP ); + control = msi_dialog_add_control( dialog, rec, L"BUTTON", BS_CHECKBOX | BS_MULTILINE | WS_TABSTOP ); control->handler = msi_dialog_checkbox_handler; control->update = msi_dialog_checkbox_sync_state; prop = MSI_RecordGetString( rec, 9 ); @@ -1293,7 +1223,7 @@ static UINT msi_dialog_line_control( msi_dialog *dialog, MSIRECORD *rec ) width = msi_dialog_scale_unit( dialog, width ); height = 2; /* line is exactly 2 units in height */ - control->hwnd = CreateWindowExW( exstyle, szStatic, NULL, style, + control->hwnd = CreateWindowExW( exstyle, L"Static", NULL, style, x, y, width, height, dialog->hwnd, NULL, NULL, NULL ); TRACE("Dialog %s control %s hwnd %p\n", @@ -1319,7 +1249,7 @@ MSIScrollText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam); - info = GetPropW( hWnd, szButtonData ); + info = GetPropW( hWnd, L"MSIDATA" ); r = CallWindowProcW( info->oldproc, hWnd, msg, wParam, lParam ); @@ -1329,7 +1259,7 @@ MSIScrollText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) return DLGC_WANTARROWS; case WM_NCDESTROY: msi_free( info ); - RemovePropW( hWnd, szButtonData ); + RemovePropW( hWnd, L"MSIDATA" ); break; case WM_PAINT: /* native MSI sets a wait cursor here */ @@ -1382,7 +1312,6 @@ static void msi_scrolltext_add_text( msi_control *control, LPCWSTR text ) static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec ) { - static const WCHAR szRichEdit20W[] = {'R','i','c','h','E','d','i','t','2','0','W',0}; struct msi_scrolltext_info *info; msi_control *control; HMODULE hRichedit; @@ -1397,7 +1326,7 @@ static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec ) style = WS_BORDER | ES_MULTILINE | WS_VSCROLL | ES_READONLY | ES_AUTOVSCROLL | WS_TABSTOP; - control = msi_dialog_add_control( dialog, rec, szRichEdit20W, style ); + control = msi_dialog_add_control( dialog, rec, L"RichEdit20W", style ); if (!control) { FreeLibrary( hRichedit ); @@ -1413,7 +1342,7 @@ static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec ) /* subclass the static control */ info->oldproc = (WNDPROC) SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC, (LONG_PTR)MSIScrollText_WndProc ); - SetPropW( control->hwnd, szButtonData, info ); + SetPropW( control->hwnd, L"MSIDATA", info ); /* add the text into the richedit */ text = MSI_RecordGetString( rec, 10 ); @@ -1440,7 +1369,7 @@ static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec ) style |= SS_CENTERIMAGE; } - control = msi_dialog_add_control( dialog, rec, szStatic, style ); + control = msi_dialog_add_control( dialog, rec, L"Static", style ); cx = MSI_RecordGetInteger( rec, 6 ); cy = MSI_RecordGetInteger( rec, 7 ); cx = msi_dialog_scale_unit( dialog, cx ); @@ -1455,7 +1384,7 @@ static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec ) ERR("Failed to load bitmap %s\n", debugstr_w(name)); msi_free( name ); - + return ERROR_SUCCESS; } @@ -1467,9 +1396,9 @@ static UINT msi_dialog_icon_control( msi_dialog *dialog, MSIRECORD *rec ) TRACE("\n"); - control = msi_dialog_add_control( dialog, rec, szStatic, + control = msi_dialog_add_control( dialog, rec, L"Static", SS_ICON | SS_CENTERIMAGE | WS_GROUP ); - + attributes = MSI_RecordGetInteger( rec, 8 ); name = msi_get_binary_name( dialog->package, rec ); control->hIcon = msi_load_icon( dialog->package->db, name, attributes ); @@ -1501,7 +1430,7 @@ static LRESULT WINAPI MSIComboBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam); - info = GetPropW( hWnd, szButtonData ); + info = GetPropW( hWnd, L"MSIDATA" ); if (!info) return 0; @@ -1514,7 +1443,7 @@ static LRESULT WINAPI MSIComboBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP msi_free( info->items[j] ); msi_free( info->items ); msi_free( info ); - RemovePropW( hWnd, szButtonData ); + RemovePropW( hWnd, L"MSIDATA" ); break; } @@ -1541,16 +1470,12 @@ static UINT msi_combobox_add_item( MSIRECORD *rec, LPVOID param ) static UINT msi_combobox_add_items( struct msi_combobox_info *info, LPCWSTR property ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','C','o','m','b','o','B','o','x','`',' ','W','H','E','R','E',' ', - '`','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',' ', - 'O','R','D','E','R',' ','B','Y',' ','`','O','r','d','e','r','`',0}; MSIQUERY *view; DWORD count; UINT r; - r = MSI_OpenQuery( info->dialog->package->db, &view, query, property ); + r = MSI_OpenQuery( info->dialog->package->db, &view, + L"SELECT * FROM `ComboBox` WHERE `Property` = '%s' ORDER BY `Order`", property ); if (r != ERROR_SUCCESS) return r; @@ -1572,11 +1497,6 @@ static UINT msi_combobox_add_items( struct msi_combobox_info *info, LPCWSTR prop static UINT msi_dialog_set_control_condition( MSIRECORD *rec, LPVOID param ) { - static const WCHAR szHide[] = {'H','i','d','e',0}; - static const WCHAR szShow[] = {'S','h','o','w',0}; - static const WCHAR szDisable[] = {'D','i','s','a','b','l','e',0}; - static const WCHAR szEnable[] = {'E','n','a','b','l','e',0}; - static const WCHAR szDefault[] = {'D','e','f','a','u','l','t',0}; msi_dialog *dialog = param; msi_control *control; LPCWSTR name, action, condition; @@ -1592,15 +1512,15 @@ static UINT msi_dialog_set_control_condition( MSIRECORD *rec, LPVOID param ) TRACE("%s control %s\n", debugstr_w(action), debugstr_w(name)); /* FIXME: case sensitive? */ - if (!wcscmp( action, szHide )) + if (!wcscmp( action, L"Hide" )) ShowWindow(control->hwnd, SW_HIDE); - else if (!wcscmp( action, szShow )) + else if (!wcscmp( action, L"Show" )) ShowWindow(control->hwnd, SW_SHOW); - else if (!wcscmp( action, szDisable )) + else if (!wcscmp( action, L"Disable" )) EnableWindow(control->hwnd, FALSE); - else if (!wcscmp( action, szEnable )) + else if (!wcscmp( action, L"Enable" )) EnableWindow(control->hwnd, TRUE); - else if (!wcscmp( action, szDefault )) + else if (!wcscmp( action, L"Default" )) SetFocus(control->hwnd); else FIXME("Unhandled action %s\n", debugstr_w(action)); @@ -1610,10 +1530,6 @@ static UINT msi_dialog_set_control_condition( MSIRECORD *rec, LPVOID param ) static UINT msi_dialog_evaluate_control_conditions( msi_dialog *dialog ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'C','o','n','t','r','o','l','C','o','n','d','i','t','i','o','n',' ', - 'W','H','E','R','E',' ','`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',0}; UINT r; MSIQUERY *view; MSIPACKAGE *package = dialog->package; @@ -1621,7 +1537,7 @@ static UINT msi_dialog_evaluate_control_conditions( msi_dialog *dialog ) TRACE("%p %s\n", dialog, debugstr_w(dialog->name)); /* query the Control table for all the elements of the control */ - r = MSI_OpenQuery( package->db, &view, query, dialog->name ); + r = MSI_OpenQuery( package->db, &view, L"SELECT * FROM `ControlCondition` WHERE `Dialog_` = '%s'", dialog->name ); if (r != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -1639,7 +1555,7 @@ static UINT msi_dialog_combobox_handler( msi_dialog *dialog, msi_control *contro if (HIWORD(param) != CBN_SELCHANGE && HIWORD(param) != CBN_EDITCHANGE) return ERROR_SUCCESS; - info = GetPropW( control->hwnd, szButtonData ); + info = GetPropW( control->hwnd, L"MSIDATA" ); index = SendMessageW( control->hwnd, CB_GETCURSEL, 0, 0 ); if (index == CB_ERR) value = msi_get_window_text( control->hwnd ); @@ -1661,7 +1577,7 @@ static void msi_dialog_combobox_update( msi_dialog *dialog, msi_control *control LPWSTR value, tmp; DWORD j; - info = GetPropW( control->hwnd, szButtonData ); + info = GetPropW( control->hwnd, L"MSIDATA" ); value = msi_dup_property( dialog->package->db, control->property ); if (!value) @@ -1730,7 +1646,7 @@ static UINT msi_dialog_combo_control( msi_dialog *dialog, MSIRECORD *rec ) info->addpos_items = 0; info->oldproc = (WNDPROC)SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC, (LONG_PTR)MSIComboBox_WndProc ); - SetPropW( control->hwnd, szButtonData, info ); + SetPropW( control->hwnd, L"MSIDATA", info ); if (control->property) msi_combobox_add_items( info, control->property ); @@ -1767,7 +1683,7 @@ static UINT msi_dialog_edit_control( msi_dialog *dialog, MSIRECORD *rec ) WCHAR num[MAX_NUM_DIGITS]; DWORD limit; - control = msi_dialog_add_control( dialog, rec, szEdit, + control = msi_dialog_add_control( dialog, rec, L"Edit", WS_BORDER | WS_TABSTOP | ES_AUTOHSCROLL ); control->handler = msi_dialog_edit_handler; @@ -1914,7 +1830,7 @@ MSIMaskedEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam); - info = GetPropW(hWnd, szButtonData); + info = GetPropW(hWnd, L"MSIDATA"); r = CallWindowProcW(info->oldproc, hWnd, msg, wParam, lParam); @@ -1930,7 +1846,7 @@ MSIMaskedEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_NCDESTROY: msi_free( info->prop ); msi_free( info ); - RemovePropW( hWnd, szButtonData ); + RemovePropW( hWnd, L"MSIDATA" ); break; } @@ -2053,7 +1969,7 @@ msi_maskedit_create_children( struct msi_maskedit_info *info, LPCWSTR font ) wx = 0; ww = width; } - hwnd = CreateWindowW( szEdit, NULL, style, wx, 0, ww, height, + hwnd = CreateWindowW( L"Edit", NULL, style, wx, 0, ww, height, info->hwnd, NULL, NULL, NULL ); if( !hwnd ) { @@ -2101,7 +2017,7 @@ static UINT msi_dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec ) info->dialog = dialog; - control = msi_dialog_add_control( dialog, rec, szStatic, + control = msi_dialog_add_control( dialog, rec, L"Static", SS_OWNERDRAW | WS_GROUP | WS_VISIBLE ); if( !control ) { @@ -2116,7 +2032,7 @@ static UINT msi_dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec ) /* subclass the static control */ info->oldproc = (WNDPROC) SetWindowLongPtrW( info->hwnd, GWLP_WNDPROC, (LONG_PTR)MSIMaskedEdit_WndProc ); - SetPropW( control->hwnd, szButtonData, info ); + SetPropW( control->hwnd, L"MSIDATA", info ); prop = MSI_RecordGetString( rec, 9 ); if( prop ) @@ -2158,7 +2074,7 @@ static UINT msi_dialog_progress_bar( msi_dialog *dialog, MSIRECORD *rec ) if( !control ) return ERROR_FUNCTION_FAILED; - event_subscribe( dialog, szSetProgress, control->name, szProgress ); + event_subscribe( dialog, L"SetProgress", control->name, L"Progress" ); return ERROR_SUCCESS; } @@ -2185,7 +2101,7 @@ static void msi_dialog_update_pathedit( msi_dialog *dialog, msi_control *control { WCHAR *path; - if (!control && !(control = msi_dialog_find_control_by_type( dialog, szPathEdit ))) + if (!control && !(control = msi_dialog_find_control_by_type( dialog, L"PathEdit" ))) return; if (!(path = get_path_property( dialog, control ))) return; @@ -2244,7 +2160,7 @@ static BOOL msi_dialog_onkillfocus( msi_dialog *dialog, msi_control *control ) static LRESULT WINAPI MSIPathEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - struct msi_pathedit_info *info = GetPropW(hWnd, szButtonData); + struct msi_pathedit_info *info = GetPropW(hWnd, L"MSIDATA"); LRESULT r = 0; TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam); @@ -2261,7 +2177,7 @@ static LRESULT WINAPI MSIPathEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LP if ( msg == WM_NCDESTROY ) { msi_free( info ); - RemovePropW( hWnd, szButtonData ); + RemovePropW( hWnd, L"MSIDATA" ); } return r; @@ -2277,7 +2193,7 @@ static UINT msi_dialog_pathedit_control( msi_dialog *dialog, MSIRECORD *rec ) if (!info) return ERROR_FUNCTION_FAILED; - control = msi_dialog_add_control( dialog, rec, szEdit, + control = msi_dialog_add_control( dialog, rec, L"Edit", WS_BORDER | WS_TABSTOP ); control->attributes = MSI_RecordGetInteger( rec, 8 ); prop = MSI_RecordGetString( rec, 9 ); @@ -2288,7 +2204,7 @@ static UINT msi_dialog_pathedit_control( msi_dialog *dialog, MSIRECORD *rec ) info->control = control; info->oldproc = (WNDPROC) SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC, (LONG_PTR)MSIPathEdit_WndProc ); - SetPropW( control->hwnd, szButtonData, info ); + SetPropW( control->hwnd, L"MSIDATA", info ); msi_dialog_update_pathedit( dialog, control ); @@ -2319,7 +2235,7 @@ static UINT msi_dialog_create_radiobutton( MSIRECORD *rec, LPVOID param ) name = MSI_RecordGetString( rec, 3 ); text = MSI_RecordGetString( rec, 8 ); - control = dialog_create_window( dialog, rec, 0, szButton, name, text, style, + control = dialog_create_window( dialog, rec, 0, L"BUTTON", name, text, style, group->parent->hwnd ); if (!control) return ERROR_FUNCTION_FAILED; @@ -2343,7 +2259,7 @@ static BOOL CALLBACK msi_radioground_child_enum( HWND hWnd, LPARAM lParam ) static LRESULT WINAPI MSIRadioGroup_WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { - WNDPROC oldproc = (WNDPROC)GetPropW( hWnd, szButtonData ); + WNDPROC oldproc = (WNDPROC)GetPropW( hWnd, L"MSIDATA" ); LRESULT r; TRACE("hWnd %p msg %04x wParam 0x%08lx lParam 0x%08lx\n", hWnd, msg, wParam, lParam); @@ -2362,10 +2278,6 @@ static LRESULT WINAPI MSIRadioGroup_WndProc( HWND hWnd, UINT msg, WPARAM wParam, static UINT msi_dialog_radiogroup_control( msi_dialog *dialog, MSIRECORD *rec ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'R','a','d','i','o','B','u','t','t','o','n',' ','W','H','E','R','E',' ', - '`','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',0}; UINT r; LPCWSTR prop; msi_control *control; @@ -2390,23 +2302,23 @@ static UINT msi_dialog_radiogroup_control( msi_dialog *dialog, MSIRECORD *rec ) style |= BS_OWNERDRAW; /* Create parent group box to hold radio buttons */ - control = msi_dialog_add_control( dialog, rec, szButton, style ); + control = msi_dialog_add_control( dialog, rec, L"BUTTON", style ); if( !control ) return ERROR_FUNCTION_FAILED; oldproc = (WNDPROC) SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC, (LONG_PTR)MSIRadioGroup_WndProc ); - SetPropW(control->hwnd, szButtonData, oldproc); + SetPropW(control->hwnd, L"MSIDATA", oldproc); SetWindowLongPtrW( control->hwnd, GWL_EXSTYLE, WS_EX_CONTROLPARENT ); if( prop ) control->property = strdupW( prop ); /* query the Radio Button table for all control in this group */ - r = MSI_OpenQuery( package->db, &view, query, prop ); + r = MSI_OpenQuery( package->db, &view, L"SELECT * FROM `RadioButton` WHERE `Property` = '%s'", prop ); if( r != ERROR_SUCCESS ) { - ERR("query failed for dialog %s radio group %s\n", + ERR("query failed for dialog %s radio group %s\n", debugstr_w(dialog->name), debugstr_w(prop)); return ERROR_INVALID_PARAMETER; } @@ -2505,7 +2417,7 @@ msi_seltree_menu( HWND hwnd, HTREEITEM hItem ) } u; UINT r; - info = GetPropW(hwnd, szButtonData); + info = GetPropW(hwnd, L"MSIDATA"); package = info->dialog->package; feature = msi_seltree_feature_from_item( hwnd, hItem ); @@ -2553,7 +2465,7 @@ MSISelectionTree_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam); - info = GetPropW(hWnd, szButtonData); + info = GetPropW(hWnd, L"MSIDATA"); switch( msg ) { @@ -2573,7 +2485,7 @@ MSISelectionTree_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { case WM_NCDESTROY: msi_free( info ); - RemovePropW( hWnd, szButtonData ); + RemovePropW( hWnd, L"MSIDATA" ); break; } return r; @@ -2583,7 +2495,7 @@ static void msi_seltree_add_child_features( MSIPACKAGE *package, HWND hwnd, LPCWSTR parent, HTREEITEM hParent ) { - struct msi_selection_tree_info *info = GetPropW( hwnd, szButtonData ); + struct msi_selection_tree_info *info = GetPropW( hwnd, L"MSIDATA" ); MSIFEATURE *feature; TVINSERTSTRUCTW tvis; HTREEITEM hitem, hfirst = NULL; @@ -2671,7 +2583,7 @@ static void msi_seltree_create_imagelist( HWND hwnd ) static UINT msi_dialog_seltree_handler( msi_dialog *dialog, msi_control *control, WPARAM param ) { - struct msi_selection_tree_info *info = GetPropW( control->hwnd, szButtonData ); + struct msi_selection_tree_info *info = GetPropW( control->hwnd, L"MSIDATA" ); LPNMTREEVIEWW tv = (LPNMTREEVIEWW)param; MSIRECORD *row, *rec; MSIFOLDER *folder; @@ -2679,12 +2591,6 @@ static UINT msi_dialog_seltree_handler( msi_dialog *dialog, LPCWSTR dir, title = NULL; UINT r = ERROR_SUCCESS; - static const WCHAR select[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','F','e','a','t','u','r','e','`',' ','W','H','E','R','E',' ', - '`','T','i','t','l','e','`',' ','=',' ','\'','%','s','\'',0 - }; - if (tv->hdr.code != TVN_SELCHANGINGW) return ERROR_SUCCESS; @@ -2699,14 +2605,14 @@ static UINT msi_dialog_seltree_handler( msi_dialog *dialog, else title = tv->itemNew.pszText; - row = MSI_QueryGetRecord( dialog->package->db, select, title ); + row = MSI_QueryGetRecord( dialog->package->db, L"SELECT * FROM `Feature` WHERE `Title` = '%s'", title ); if (!row) return ERROR_FUNCTION_FAILED; rec = MSI_CreateRecord( 1 ); MSI_RecordSetStringW( rec, 1, MSI_RecordGetString( row, 4 ) ); - msi_event_fire( dialog->package, szSelectionDescription, rec ); + msi_event_fire( dialog->package, L"SelectionDescription", rec ); dir = MSI_RecordGetString( row, 7 ); if (dir) @@ -2722,7 +2628,7 @@ static UINT msi_dialog_seltree_handler( msi_dialog *dialog, else MSI_RecordSetStringW( rec, 1, NULL ); - msi_event_fire( dialog->package, szSelectionPath, rec ); + msi_event_fire( dialog->package, L"SelectionPath", rec ); done: msiobj_release(&row->hdr); @@ -2764,9 +2670,9 @@ static UINT msi_dialog_selection_tree( msi_dialog *dialog, MSIRECORD *rec ) info->hwnd = control->hwnd; info->oldproc = (WNDPROC) SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC, (LONG_PTR)MSISelectionTree_WndProc ); - SetPropW( control->hwnd, szButtonData, info ); + SetPropW( control->hwnd, L"MSIDATA", info ); - event_subscribe( dialog, szSelectionPath, control_name, szProperty ); + event_subscribe( dialog, L"SelectionPath", control_name, L"Property" ); /* initialize it */ msi_seltree_create_imagelist( control->hwnd ); @@ -2810,7 +2716,7 @@ static LRESULT WINAPI MSIListBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPA TRACE("%p %04x %08lx %08lx\n", hWnd, msg, wParam, lParam); - info = GetPropW( hWnd, szButtonData ); + info = GetPropW( hWnd, L"MSIDATA" ); if (!info) return 0; @@ -2823,7 +2729,7 @@ static LRESULT WINAPI MSIListBox_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPA msi_free( info->items[j] ); msi_free( info->items ); msi_free( info ); - RemovePropW( hWnd, szButtonData ); + RemovePropW( hWnd, L"MSIDATA" ); break; } @@ -2849,16 +2755,12 @@ static UINT msi_listbox_add_item( MSIRECORD *rec, LPVOID param ) static UINT msi_listbox_add_items( struct msi_listbox_info *info, LPCWSTR property ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','L','i','s','t','B','o','x','`',' ','W','H','E','R','E',' ', - '`','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',' ', - 'O','R','D','E','R',' ','B','Y',' ','`','O','r','d','e','r','`',0}; MSIQUERY *view; DWORD count; UINT r; - r = MSI_OpenQuery( info->dialog->package->db, &view, query, property ); + r = MSI_OpenQuery( info->dialog->package->db, &view, + L"SELECT * FROM `ListBox` WHERE `Property` = '%s' ORDER BY `Order`", property ); if ( r != ERROR_SUCCESS ) return r; @@ -2888,7 +2790,7 @@ static UINT msi_dialog_listbox_handler( msi_dialog *dialog, if( HIWORD(param) != LBN_SELCHANGE ) return ERROR_SUCCESS; - info = GetPropW( control->hwnd, szButtonData ); + info = GetPropW( control->hwnd, L"MSIDATA" ); index = SendMessageW( control->hwnd, LB_GETCURSEL, 0, 0 ); value = (LPCWSTR) SendMessageW( control->hwnd, LB_GETITEMDATA, index, 0 ); @@ -2933,7 +2835,7 @@ static UINT msi_dialog_list_box( msi_dialog *dialog, MSIRECORD *rec ) info->addpos_items = 0; info->oldproc = (WNDPROC)SetWindowLongPtrW( control->hwnd, GWLP_WNDPROC, (LONG_PTR)MSIListBox_WndProc ); - SetPropW( control->hwnd, szButtonData, info ); + SetPropW( control->hwnd, L"MSIDATA", info ); if ( control->property ) msi_listbox_add_items( info, control->property ); @@ -2947,7 +2849,7 @@ static void msi_dialog_update_directory_combo( msi_dialog *dialog, msi_control * { WCHAR *path; - if (!control && !(control = msi_dialog_find_control_by_type( dialog, szDirectoryCombo ))) + if (!control && !(control = msi_dialog_find_control_by_type( dialog, L"DirectoryCombo" ))) return; if (!(path = get_path_property( dialog, control ))) return; @@ -2986,13 +2888,12 @@ static UINT msi_dialog_directory_combo( msi_dialog *dialog, MSIRECORD *rec ) static void msi_dialog_update_directory_list( msi_dialog *dialog, msi_control *control ) { - static const WCHAR asterisk[] = {'*',0}; WCHAR dir_spec[MAX_PATH], *path; WIN32_FIND_DATAW wfd; LVITEMW item; HANDLE file; - if (!control && !(control = msi_dialog_find_control_by_type( dialog, szDirectoryList ))) + if (!control && !(control = msi_dialog_find_control_by_type( dialog, L"DirectoryList" ))) return; /* clear the list-view */ @@ -3000,7 +2901,7 @@ static void msi_dialog_update_directory_list( msi_dialog *dialog, msi_control *c if (!(path = get_path_property( dialog, control ))) return; lstrcpyW( dir_spec, path ); - lstrcatW( dir_spec, asterisk ); + lstrcatW( dir_spec, L"*" ); file = FindFirstFileW( dir_spec, &wfd ); if (file == INVALID_HANDLE_VALUE) @@ -3014,7 +2915,7 @@ static void msi_dialog_update_directory_list( msi_dialog *dialog, msi_control *c if ( wfd.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY ) continue; - if ( !wcscmp( wfd.cFileName, szDot ) || !wcscmp( wfd.cFileName, szDotDot ) ) + if ( !wcscmp( wfd.cFileName, L"." ) || !wcscmp( wfd.cFileName, L".." ) ) continue; item.mask = LVIF_TEXT; @@ -3036,7 +2937,7 @@ static UINT msi_dialog_directorylist_up( msi_dialog *dialog ) LPWSTR prop, path, ptr; BOOL indirect; - control = msi_dialog_find_control_by_type( dialog, szDirectoryList ); + control = msi_dialog_find_control_by_type( dialog, L"DirectoryList" ); indirect = control->attributes & msidbControlAttributesIndirect; prop = msi_dialog_dup_property( dialog, control->property, indirect ); path = msi_dialog_dup_property( dialog, prop, TRUE ); @@ -3060,7 +2961,6 @@ static UINT msi_dialog_directorylist_up( msi_dialog *dialog ) static WCHAR *get_unique_folder_name( const WCHAR *root, int *ret_len ) { - static const WCHAR fmtW[] = {'%','s','%','s',' ','%','u',0}; WCHAR newfolder[MAX_PATH], *path, *ptr; int len, count = 2; @@ -3078,7 +2978,7 @@ static WCHAR *get_unique_folder_name( const WCHAR *root, int *ret_len ) msi_free( path ); return NULL; } - swprintf( path, len + 4, fmtW, root, newfolder, count++ ); + swprintf( path, len + 4, L"%s%s %u", root, newfolder, count++ ); } ptr = wcsrchr( path, '\\' ) + 1; @@ -3094,7 +2994,7 @@ static UINT msi_dialog_directorylist_new( msi_dialog *dialog ) LVITEMW item; int index; - control = msi_dialog_find_control_by_type( dialog, szDirectoryList ); + control = msi_dialog_find_control_by_type( dialog, L"DirectoryList" ); if (!(path = get_path_property( dialog, control ))) return ERROR_OUTOFMEMORY; @@ -3162,7 +3062,7 @@ static UINT msi_dialog_dirlist_handler( msi_dialog *dialog, msi_control *control lstrcpyW( new_path, path ); lstrcatW( new_path, text ); if (nmhdr->code == LVN_ENDLABELEDITW) CreateDirectoryW( new_path, NULL ); - lstrcatW( new_path, szBackSlash ); + lstrcatW( new_path, L"\\" ); msi_dialog_set_property( dialog->package, prop, new_path ); @@ -3219,11 +3119,11 @@ static BOOL str_is_number( LPCWSTR str ) static const WCHAR column_keys[][80] = { - {'V','o','l','u','m','e','C','o','s','t','V','o','l','u','m','e',0}, - {'V','o','l','u','m','e','C','o','s','t','S','i','z','e',0}, - {'V','o','l','u','m','e','C','o','s','t','A','v','a','i','l','a','b','l','e',0}, - {'V','o','l','u','m','e','C','o','s','t','R','e','q','u','i','r','e','d',0}, - {'V','o','l','u','m','e','C','o','s','t','D','i','f','f','e','r','e','n','c','e',0} + L"VolumeCostVolume", + L"VolumeCostSize", + L"VolumeCostAvailable", + L"VolumeCostRequired", + L"VolumeCostDifference", }; static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control, MSIRECORD *rec ) @@ -3234,8 +3134,6 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control LVCOLUMNW lvc; DWORD count = 0; - static const WCHAR negative[] = {'-',0}; - if (!text) return; while ((begin = wcschr( begin, '{' )) && count < 5) @@ -3250,8 +3148,8 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control lstrcpynW( num, begin + 1, end - begin ); begin += end - begin + 1; - /* empty braces or '0' hides the column */ - if ( !num[0] || !wcscmp( num, szZero ) ) + /* empty braces or '0' hides the column */ + if ( !num[0] || !wcscmp( num, L"0" ) ) { count++; msi_free( num ); @@ -3261,7 +3159,7 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control /* the width must be a positive number * if a width is invalid, all remaining columns are hidden */ - if ( !wcsncmp( num, negative, 1 ) || !str_is_number( num ) ) { + if ( !wcsncmp( num, L"-", 1 ) || !str_is_number( num ) ) { msi_free( num ); return; } @@ -3471,9 +3369,7 @@ static UINT msi_dialog_volumeselect_combo( msi_dialog *dialog, MSIRECORD *rec ) static UINT msi_dialog_hyperlink_handler( msi_dialog *dialog, msi_control *control, WPARAM param ) { - static const WCHAR hrefW[] = {'h','r','e','f'}; - static const WCHAR openW[] = {'o','p','e','n',0}; - int len, len_href = ARRAY_SIZE( hrefW ); + int len, len_href = ARRAY_SIZE( L"href" ) - 1; const WCHAR *p, *q; WCHAR quote = 0; LITEM item; @@ -3491,7 +3387,7 @@ static UINT msi_dialog_hyperlink_handler( msi_dialog *dialog, msi_control *contr while (*p && iswspace( *p )) p++; len = lstrlenW( p ); - if (len > len_href && !wcsnicmp( p, hrefW, len_href )) + if (len > len_href && !wcsnicmp( p, L"href", len_href )) { p += len_href; while (*p && iswspace( *p )) p++; @@ -3511,7 +3407,7 @@ static UINT msi_dialog_hyperlink_handler( msi_dialog *dialog, msi_control *contr if (!*q) return ERROR_SUCCESS; } item.szUrl[q - item.szUrl] = 0; - ShellExecuteW( NULL, openW, p, NULL, NULL, SW_SHOWNORMAL ); + ShellExecuteW( NULL, L"open", p, NULL, NULL, SW_SHOWNORMAL ); } return ERROR_SUCCESS; } @@ -3587,15 +3483,11 @@ static UINT msi_listview_add_item( MSIRECORD *rec, LPVOID param ) static UINT msi_listview_add_items( msi_dialog *dialog, msi_control *control ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','L','i','s','t','V','i','e','w','`',' ','W','H','E','R','E',' ', - '`','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',' ', - 'O','R','D','E','R',' ','B','Y',' ','`','O','r','d','e','r','`',0}; MSIQUERY *view; struct listview_param lv_param = { dialog, control }; - if (MSI_OpenQuery( dialog->package->db, &view, query, control->property ) == ERROR_SUCCESS) + if (MSI_OpenQuery( dialog->package->db, &view, L"SELECT * FROM `ListView` WHERE `Property` = '%s' ORDER BY `Order`", + control->property ) == ERROR_SUCCESS) { MSI_IterateRecords( view, NULL, msi_listview_add_item, &lv_param ); msiobj_release( &view->hdr ); @@ -3646,28 +3538,28 @@ static UINT msi_dialog_listview( msi_dialog *dialog, MSIRECORD *rec ) static const struct control_handler msi_dialog_handler[] = { - { szText, msi_dialog_text_control }, - { szPushButton, msi_dialog_button_control }, - { szLine, msi_dialog_line_control }, - { szBitmap, msi_dialog_bitmap_control }, - { szCheckBox, msi_dialog_checkbox_control }, - { szScrollableText, msi_dialog_scrolltext_control }, - { szComboBox, msi_dialog_combo_control }, - { szEdit, msi_dialog_edit_control }, - { szMaskedEdit, msi_dialog_maskedit_control }, - { szPathEdit, msi_dialog_pathedit_control }, - { szProgressBar, msi_dialog_progress_bar }, - { szRadioButtonGroup, msi_dialog_radiogroup_control }, - { szIcon, msi_dialog_icon_control }, - { szSelectionTree, msi_dialog_selection_tree }, - { szGroupBox, msi_dialog_group_box }, - { szListBox, msi_dialog_list_box }, - { szDirectoryCombo, msi_dialog_directory_combo }, - { szDirectoryList, msi_dialog_directory_list }, - { szVolumeCostList, msi_dialog_volumecost_list }, - { szVolumeSelectCombo, msi_dialog_volumeselect_combo }, - { szHyperLink, msi_dialog_hyperlink }, - { szListView, msi_dialog_listview } + { L"Text", msi_dialog_text_control }, + { L"PushButton", msi_dialog_button_control }, + { L"Line", msi_dialog_line_control }, + { L"Bitmap", msi_dialog_bitmap_control }, + { L"CheckBox", msi_dialog_checkbox_control }, + { L"ScrollableText", msi_dialog_scrolltext_control }, + { L"ComboBox", msi_dialog_combo_control }, + { L"Edit", msi_dialog_edit_control }, + { L"MaskedEdit", msi_dialog_maskedit_control }, + { L"PathEdit", msi_dialog_pathedit_control }, + { L"ProgressBar", msi_dialog_progress_bar }, + { L"RadioButtonGroup", msi_dialog_radiogroup_control }, + { L"Icon", msi_dialog_icon_control }, + { L"SelectionTree", msi_dialog_selection_tree }, + { L"GroupBox", msi_dialog_group_box }, + { L"ListBox", msi_dialog_list_box }, + { L"DirectoryCombo", msi_dialog_directory_combo }, + { L"DirectoryList", msi_dialog_directory_list }, + { L"VolumeCostList", msi_dialog_volumecost_list }, + { L"VolumeSelectCombo", msi_dialog_volumeselect_combo }, + { L"HyperLink", msi_dialog_hyperlink }, + { L"ListView", msi_dialog_listview } }; static UINT msi_dialog_create_controls( MSIRECORD *rec, LPVOID param ) @@ -3691,10 +3583,6 @@ static UINT msi_dialog_create_controls( MSIRECORD *rec, LPVOID param ) static UINT msi_dialog_fill_controls( msi_dialog *dialog ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'C','o','n','t','r','o','l',' ','W','H','E','R','E',' ', - '`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',0}; UINT r; MSIQUERY *view; MSIPACKAGE *package = dialog->package; @@ -3702,7 +3590,7 @@ static UINT msi_dialog_fill_controls( msi_dialog *dialog ) TRACE("%p %s\n", dialog, debugstr_w(dialog->name) ); /* query the Control table for all the elements of the control */ - r = MSI_OpenQuery( package->db, &view, query, dialog->name ); + r = MSI_OpenQuery( package->db, &view, L"SELECT * FROM `Control` WHERE `Dialog_` = '%s'", dialog->name ); if( r != ERROR_SUCCESS ) { ERR("query failed for dialog %s\n", debugstr_w(dialog->name)); @@ -3723,8 +3611,6 @@ static UINT msi_dialog_reset( msi_dialog *dialog ) /* figure out the height of 10 point MS Sans Serif */ static INT msi_dialog_get_sans_serif_height( HWND hwnd ) { - static const WCHAR szSansSerif[] = { - 'M','S',' ','S','a','n','s',' ','S','e','r','i','f',0 }; LOGFONTW lf; TEXTMETRICW tm; BOOL r; @@ -3737,7 +3623,7 @@ static INT msi_dialog_get_sans_serif_height( HWND hwnd ) { memset( &lf, 0, sizeof lf ); lf.lfHeight = MulDiv(12, GetDeviceCaps(hdc, LOGPIXELSY), 72); - lstrcpyW( lf.lfFaceName, szSansSerif ); + lstrcpyW( lf.lfFaceName, L"MS Sans Serif" ); hFont = CreateFontIndirectW(&lf); if (hFont) { @@ -3756,17 +3642,12 @@ static INT msi_dialog_get_sans_serif_height( HWND hwnd ) /* fetch the associated record from the Dialog table */ static MSIRECORD *msi_get_dialog_record( msi_dialog *dialog ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ', - 'F','R','O','M',' ','D','i','a','l','o','g',' ', - 'W','H','E','R','E',' ', - '`','D','i','a','l','o','g','`',' ','=',' ','\'','%','s','\'',0}; MSIPACKAGE *package = dialog->package; MSIRECORD *rec = NULL; TRACE("%p %s\n", dialog, debugstr_w(dialog->name) ); - rec = MSI_QueryGetRecord( package->db, query, dialog->name ); + rec = MSI_QueryGetRecord( package->db, L"SELECT * FROM `Dialog` WHERE `Dialog` = '%s'", dialog->name ); if( !rec ) WARN("query failed for dialog %s\n", debugstr_w(dialog->name)); @@ -3775,9 +3656,6 @@ static MSIRECORD *msi_get_dialog_record( msi_dialog *dialog ) static void msi_dialog_adjust_dialog_pos( msi_dialog *dialog, MSIRECORD *rec, LPRECT pos ) { - static const WCHAR szScreenX[] = {'S','c','r','e','e','n','X',0}; - static const WCHAR szScreenY[] = {'S','c','r','e','e','n','Y',0}; - UINT xres, yres; POINT center; SIZE sz; @@ -3792,8 +3670,8 @@ static void msi_dialog_adjust_dialog_pos( msi_dialog *dialog, MSIRECORD *rec, LP sz.cx = msi_dialog_scale_unit( dialog, sz.cx ); sz.cy = msi_dialog_scale_unit( dialog, sz.cy ); - xres = msi_get_property_int( dialog->package->db, szScreenX, 0 ); - yres = msi_get_property_int( dialog->package->db, szScreenY, 0 ); + xres = msi_get_property_int( dialog->package->db, L"ScreenX", 0 ); + yres = msi_get_property_int( dialog->package->db, L"ScreenY", 0 ); center.x = MulDiv( center.x, xres, 100 ); center.y = MulDiv( center.y, yres, 100 ); @@ -3859,10 +3737,6 @@ static void msi_dialog_set_tab_order( msi_dialog *dialog, LPCWSTR first ) static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs ) { - static const WCHAR df[] = { - 'D','e','f','a','u','l','t','U','I','F','o','n','t',0 }; - static const WCHAR dfv[] = { - 'M','S',' ','S','h','e','l','l',' ','D','l','g',0 }; msi_dialog *dialog = cs->lpCreateParams; MSIRECORD *rec = NULL; LPWSTR title = NULL; @@ -3886,10 +3760,10 @@ static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs ) dialog->attributes = MSI_RecordGetInteger( rec, 6 ); - dialog->default_font = msi_dup_property( dialog->package->db, df ); + dialog->default_font = msi_dup_property( dialog->package->db, L"DefaultUIFont" ); if (!dialog->default_font) { - dialog->default_font = strdupW(dfv); + dialog->default_font = strdupW( L"MS Shell Dlg" ); if (!dialog->default_font) { msiobj_release( &rec->hdr ); @@ -3928,7 +3802,7 @@ static LRESULT msi_dialog_oncommand( msi_dialog *dialog, WPARAM param, HWND hwnd case 2: /* escape */ control = msi_dialog_find_control( dialog, dialog->control_cancel ); break; - default: + default: control = msi_dialog_find_control_by_hwnd( dialog, hwnd ); } @@ -4045,10 +3919,9 @@ static UINT dialog_run_message_loop( msi_dialog *dialog ) parent = dialog->parent ? dialog->parent->hwnd : 0; - hwnd = CreateWindowW( szMsiDialogClass, dialog->name, style, + hwnd = CreateWindowW( L"MsiDialogCloseClass", dialog->name, style, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, parent, NULL, NULL, dialog ); - if( !hwnd ) { ERR("Failed to create dialog %s\n", debugstr_w( dialog->name )); @@ -4101,20 +3974,20 @@ static BOOL dialog_register_class( void ) cls.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW); cls.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); cls.lpszMenuName = NULL; - cls.lpszClassName = szMsiDialogClass; + cls.lpszClassName = L"MsiDialogCloseClass"; if( !RegisterClassW( &cls ) ) return FALSE; cls.lpfnWndProc = MSIHiddenWindowProc; - cls.lpszClassName = szMsiHiddenWindow; + cls.lpszClassName = L"MsiHiddenWindow"; if( !RegisterClassW( &cls ) ) return FALSE; uiThreadId = GetCurrentThreadId(); - hMsiHiddenWindow = CreateWindowW( szMsiHiddenWindow, NULL, WS_OVERLAPPED, + hMsiHiddenWindow = CreateWindowW( L"MsiHiddenWindow", NULL, WS_OVERLAPPED, 0, 0, 100, 100, NULL, NULL, NULL, NULL ); if( !hMsiHiddenWindow ) return FALSE; @@ -4125,8 +3998,6 @@ static BOOL dialog_register_class( void ) static msi_dialog *dialog_create( MSIPACKAGE *package, const WCHAR *name, msi_dialog *parent, control_event_handler event_handler ) { - static const WCHAR szDialogCreated[] = - {'D','i','a','l','o','g',' ','c','r','e','a','t','e','d',0}; MSIRECORD *rec = NULL; msi_dialog *dialog; @@ -4165,7 +4036,7 @@ static msi_dialog *dialog_create( MSIPACKAGE *package, const WCHAR *name, msi_di return NULL; } MSI_RecordSetStringW(rec, 1, name); - MSI_RecordSetStringW(rec, 2, szDialogCreated); + MSI_RecordSetStringW(rec, 2, L"Dialog created"); MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONSTART, rec); msiobj_release(&rec->hdr); @@ -4295,8 +4166,8 @@ void msi_dialog_unregister_class( void ) { DestroyWindow( hMsiHiddenWindow ); hMsiHiddenWindow = NULL; - UnregisterClassW( szMsiDialogClass, NULL ); - UnregisterClassW( szMsiHiddenWindow, NULL ); + UnregisterClassW( L"MsiDialogCloseClass", NULL ); + UnregisterClassW( L"MsiHiddenWindow", NULL ); uiThreadId = 0; } @@ -4480,18 +4351,13 @@ static INT event_do_dialog( MSIPACKAGE *package, const WCHAR *name, msi_dialog * /* end a modal dialog box */ static UINT event_end_dialog( msi_dialog *dialog, const WCHAR *argument ) { - static const WCHAR exitW[] = {'E','x','i','t',0}; - static const WCHAR retryW[] = {'R','e','t','r','y',0}; - static const WCHAR ignoreW[] = {'I','g','n','o','r','e',0}; - static const WCHAR returnW[] = {'R','e','t','u','r','n',0}; - - if (!wcscmp( argument, exitW )) + if (!wcscmp( argument, L"Exit" )) dialog->retval = IDCANCEL; - else if (!wcscmp( argument, retryW )) + else if (!wcscmp( argument, L"Retry" )) dialog->retval = IDRETRY; - else if (!wcscmp( argument, ignoreW )) + else if (!wcscmp( argument, L"Ignore" )) dialog->retval = IDOK; - else if (!wcscmp( argument, returnW )) + else if (!wcscmp( argument, L"Return" )) dialog->retval = 0; else { @@ -4573,10 +4439,10 @@ static UINT event_add_local( msi_dialog *dialog, const WCHAR *argument ) LIST_FOR_EACH_ENTRY( feature, &dialog->package->features, MSIFEATURE, entry ) { - if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, szAll )) + if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, L"ALL" )) { if (feature->ActionRequest != INSTALLSTATE_LOCAL) - msi_set_property( dialog->package->db, szPreselected, szOne, -1 ); + msi_set_property( dialog->package->db, L"Preselected", L"1", -1 ); MSI_SetFeatureStateW( dialog->package, feature->Feature, INSTALLSTATE_LOCAL ); } } @@ -4589,10 +4455,10 @@ static UINT event_remove( msi_dialog *dialog, const WCHAR *argument ) LIST_FOR_EACH_ENTRY( feature, &dialog->package->features, MSIFEATURE, entry ) { - if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, szAll )) + if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, L"ALL" )) { if (feature->ActionRequest != INSTALLSTATE_ABSENT) - msi_set_property( dialog->package->db, szPreselected, szOne, -1 ); + msi_set_property( dialog->package->db, L"Preselected", L"1", -1 ); MSI_SetFeatureStateW( dialog->package, feature->Feature, INSTALLSTATE_ABSENT ); } } @@ -4605,10 +4471,10 @@ static UINT event_add_source( msi_dialog *dialog, const WCHAR *argument ) LIST_FOR_EACH_ENTRY( feature, &dialog->package->features, MSIFEATURE, entry ) { - if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, szAll )) + if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, L"ALL" )) { if (feature->ActionRequest != INSTALLSTATE_SOURCE) - msi_set_property( dialog->package->db, szPreselected, szOne, -1 ); + msi_set_property( dialog->package->db, L"Preselected", L"1", -1 ); MSI_SetFeatureStateW( dialog->package, feature->Feature, INSTALLSTATE_SOURCE ); } } @@ -4635,7 +4501,7 @@ static UINT event_set_target_path( msi_dialog *dialog, const WCHAR *argument ) UINT r = ERROR_SUCCESS; MSI_RecordSetStringW( rec, 1, path ); - msi_event_fire( dialog->package, szSelectionPath, rec ); + msi_event_fire( dialog->package, L"SelectionPath", rec ); if (path) { /* failure to set the path halts the executing of control events */ @@ -4654,11 +4520,10 @@ static UINT event_reset( msi_dialog *dialog, const WCHAR *argument ) INT ACTION_ShowDialog( MSIPACKAGE *package, const WCHAR *dialog ) { - static const WCHAR szDialog[] = {'D','i','a','l','o','g',0}; MSIRECORD *row; INT rc; - if (!TABLE_Exists(package->db, szDialog)) return 0; + if (!TABLE_Exists(package->db, L"Dialog")) return 0; row = MSI_CreateRecord(0); if (!row) return -1; @@ -4725,12 +4590,12 @@ static UINT event_directory_list_new( msi_dialog *dialog, const WCHAR *argument static UINT event_reinstall_mode( msi_dialog *dialog, const WCHAR *argument ) { - return msi_set_property( dialog->package->db, szReinstallMode, argument, -1 ); + return msi_set_property( dialog->package->db, L"REINSTALLMODE", argument, -1 ); } static UINT event_reinstall( msi_dialog *dialog, const WCHAR *argument ) { - return msi_set_property( dialog->package->db, szReinstall, argument, -1 ); + return msi_set_property( dialog->package->db, L"REINSTALL", argument, -1 ); } static UINT event_validate_product_id( msi_dialog *dialog, const WCHAR *argument ) @@ -4738,43 +4603,25 @@ static UINT event_validate_product_id( msi_dialog *dialog, const WCHAR *argument return msi_validate_product_id( dialog->package ); } -static const WCHAR end_dialogW[] = {'E','n','d','D','i','a','l','o','g',0}; -static const WCHAR new_dialogW[] = {'N','e','w','D','i','a','l','o','g',0}; -static const WCHAR spawn_dialogW[] = {'S','p','a','w','n','D','i','a','l','o','g',0}; -static const WCHAR spawn_wait_dialogW[] = {'S','p','a','w','n','W','a','i','t','D','i','a','l','o','g',0}; -static const WCHAR do_actionW[] = {'D','o','A','c','t','i','o','n',0}; -static const WCHAR add_localW[] = {'A','d','d','L','o','c','a','l',0}; -static const WCHAR removeW[] = {'R','e','m','o','v','e',0}; -static const WCHAR add_sourceW[] = {'A','d','d','S','o','u','r','c','e',0}; -static const WCHAR set_target_pathW[] = {'S','e','t','T','a','r','g','e','t','P','a','t','h',0}; -static const WCHAR resetW[] = {'R','e','s','e','t',0}; -static const WCHAR set_install_levelW[] = {'S','e','t','I','n','s','t','a','l','l','L','e','v','e','l',0}; -static const WCHAR directory_list_upW[] = {'D','i','r','e','c','t','o','r','y','L','i','s','t','U','p',0}; -static const WCHAR directory_list_newW[] = {'D','i','r','e','c','t','o','r','y','L','i','s','t','N','e','w',0}; -static const WCHAR selection_browseW[] = {'S','e','l','e','c','t','i','o','n','B','r','o','w','s','e',0}; -static const WCHAR reinstall_modeW[] = {'R','e','i','n','s','t','a','l','l','M','o','d','e',0}; -static const WCHAR reinstallW[] = {'R','e','i','n','s','t','a','l','l',0}; -static const WCHAR validate_product_idW[] = {'V','a','l','i','d','a','t','e','P','r','o','d','u','c','t','I','D',0}; - static const struct control_event control_events[] = { - { end_dialogW, pending_event_end_dialog }, - { new_dialogW, pending_event_new_dialog }, - { spawn_dialogW, pending_event_spawn_dialog }, - { spawn_wait_dialogW, event_spawn_wait_dialog }, - { do_actionW, event_do_action }, - { add_localW, event_add_local }, - { removeW, event_remove }, - { add_sourceW, event_add_source }, - { set_target_pathW, event_set_target_path }, - { resetW, event_reset }, - { set_install_levelW, event_set_install_level }, - { directory_list_upW, event_directory_list_up }, - { directory_list_newW, event_directory_list_new }, - { selection_browseW, event_spawn_dialog }, - { reinstall_modeW, event_reinstall_mode }, - { reinstallW, event_reinstall }, - { validate_product_idW, event_validate_product_id }, + { L"EndDialog", pending_event_end_dialog }, + { L"NewDialog", pending_event_new_dialog }, + { L"SpawnDialog", pending_event_spawn_dialog }, + { L"SpawnWaitDialog", event_spawn_wait_dialog }, + { L"DoAction", event_do_action }, + { L"AddLocal", event_add_local }, + { L"Remove", event_remove }, + { L"AddSource", event_add_source }, + { L"SetTargetPath", event_set_target_path }, + { L"Reset", event_reset }, + { L"SetInstallLevel", event_set_install_level }, + { L"DirectoryListUp", event_directory_list_up }, + { L"DirectoryListNew", event_directory_list_new }, + { L"SelectionBrowse", event_spawn_dialog }, + { L"ReinstallMode", event_reinstall_mode }, + { L"Reinstall", event_reinstall }, + { L"ValidateProductID", event_validate_product_id }, { NULL, NULL } };
2 years, 9 months
1
0
0
0
[reactos] 303/360: [WINESYNC] msi: Use wide character string literals in action.c.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7ceaee6d192b60fb59342…
commit 7ceaee6d192b60fb59342740b174a0f2cc5ef2f3 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 19:08:59 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:34 2022 +0100 [WINESYNC] msi: Use wide character string literals in action.c. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 8e13b0b99c823bc22c7eef8b8dac04de283ca462 by Hans Leidekker <hans(a)codeweavers.com> --- dll/win32/msi/action.c | 1362 ++++++++++++--------------------------- sdk/include/reactos/wine/test.h | 1 + 2 files changed, 426 insertions(+), 937 deletions(-) diff --git a/dll/win32/msi/action.c b/dll/win32/msi/action.c index ee3686840a6..f6f03ccb59a 100644 --- a/dll/win32/msi/action.c +++ b/dll/win32/msi/action.c @@ -46,117 +46,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); -static const WCHAR szCreateFolders[] = - {'C','r','e','a','t','e','F','o','l','d','e','r','s',0}; -static const WCHAR szCostFinalize[] = - {'C','o','s','t','F','i','n','a','l','i','z','e',0}; -static const WCHAR szWriteRegistryValues[] = - {'W','r','i','t','e','R','e','g','i','s','t','r','y','V','a','l','u','e','s',0}; -static const WCHAR szFileCost[] = - {'F','i','l','e','C','o','s','t',0}; -static const WCHAR szInstallInitialize[] = - {'I','n','s','t','a','l','l','I','n','i','t','i','a','l','i','z','e',0}; -static const WCHAR szInstallValidate[] = - {'I','n','s','t','a','l','l','V','a','l','i','d','a','t','e',0}; -static const WCHAR szLaunchConditions[] = - {'L','a','u','n','c','h','C','o','n','d','i','t','i','o','n','s',0}; -static const WCHAR szProcessComponents[] = - {'P','r','o','c','e','s','s','C','o','m','p','o','n','e','n','t','s',0}; -static const WCHAR szRegisterTypeLibraries[] = - {'R','e','g','i','s','t','e','r','T','y','p','e','L','i','b','r','a','r','i','e','s',0}; -static const WCHAR szCreateShortcuts[] = - {'C','r','e','a','t','e','S','h','o','r','t','c','u','t','s',0}; -static const WCHAR szPublishProduct[] = - {'P','u','b','l','i','s','h','P','r','o','d','u','c','t',0}; -static const WCHAR szWriteIniValues[] = - {'W','r','i','t','e','I','n','i','V','a','l','u','e','s',0}; -static const WCHAR szSelfRegModules[] = - {'S','e','l','f','R','e','g','M','o','d','u','l','e','s',0}; -static const WCHAR szPublishFeatures[] = - {'P','u','b','l','i','s','h','F','e','a','t','u','r','e','s',0}; -static const WCHAR szRegisterProduct[] = - {'R','e','g','i','s','t','e','r','P','r','o','d','u','c','t',0}; -static const WCHAR szInstallExecute[] = - {'I','n','s','t','a','l','l','E','x','e','c','u','t','e',0}; -static const WCHAR szInstallExecuteAgain[] = - {'I','n','s','t','a','l','l','E','x','e','c','u','t','e','A','g','a','i','n',0}; -static const WCHAR szInstallFinalize[] = - {'I','n','s','t','a','l','l','F','i','n','a','l','i','z','e',0}; -static const WCHAR szForceReboot[] = - {'F','o','r','c','e','R','e','b','o','o','t',0}; -static const WCHAR szResolveSource[] = - {'R','e','s','o','l','v','e','S','o','u','r','c','e',0}; -static const WCHAR szAllocateRegistrySpace[] = - {'A','l','l','o','c','a','t','e','R','e','g','i','s','t','r','y','S','p','a','c','e',0}; -static const WCHAR szBindImage[] = - {'B','i','n','d','I','m','a','g','e',0}; -static const WCHAR szDeleteServices[] = - {'D','e','l','e','t','e','S','e','r','v','i','c','e','s',0}; -static const WCHAR szDisableRollback[] = - {'D','i','s','a','b','l','e','R','o','l','l','b','a','c','k',0}; -static const WCHAR szExecuteAction[] = - {'E','x','e','c','u','t','e','A','c','t','i','o','n',0}; -static const WCHAR szInstallAdminPackage[] = - {'I','n','s','t','a','l','l','A','d','m','i','n','P','a','c','k','a','g','e',0}; -static const WCHAR szInstallSFPCatalogFile[] = - {'I','n','s','t','a','l','l','S','F','P','C','a','t','a','l','o','g','F','i','l','e',0}; -static const WCHAR szIsolateComponents[] = - {'I','s','o','l','a','t','e','C','o','m','p','o','n','e','n','t','s',0}; -static const WCHAR szMigrateFeatureStates[] = - {'M','i','g','r','a','t','e','F','e','a','t','u','r','e','S','t','a','t','e','s',0}; -static const WCHAR szInstallODBC[] = - {'I','n','s','t','a','l','l','O','D','B','C',0}; -static const WCHAR szInstallServices[] = - {'I','n','s','t','a','l','l','S','e','r','v','i','c','e','s',0}; -static const WCHAR szPublishComponents[] = - {'P','u','b','l','i','s','h','C','o','m','p','o','n','e','n','t','s',0}; -static const WCHAR szRegisterComPlus[] = - {'R','e','g','i','s','t','e','r','C','o','m','P','l','u','s',0}; -static const WCHAR szRegisterUser[] = - {'R','e','g','i','s','t','e','r','U','s','e','r',0}; -static const WCHAR szRemoveEnvironmentStrings[] = - {'R','e','m','o','v','e','E','n','v','i','r','o','n','m','e','n','t','S','t','r','i','n','g','s',0}; -static const WCHAR szRemoveExistingProducts[] = - {'R','e','m','o','v','e','E','x','i','s','t','i','n','g','P','r','o','d','u','c','t','s',0}; -static const WCHAR szRemoveFolders[] = - {'R','e','m','o','v','e','F','o','l','d','e','r','s',0}; -static const WCHAR szRemoveIniValues[] = - {'R','e','m','o','v','e','I','n','i','V','a','l','u','e','s',0}; -static const WCHAR szRemoveODBC[] = - {'R','e','m','o','v','e','O','D','B','C',0}; -static const WCHAR szRemoveRegistryValues[] = - {'R','e','m','o','v','e','R','e','g','i','s','t','r','y','V','a','l','u','e','s',0}; -static const WCHAR szRemoveShortcuts[] = - {'R','e','m','o','v','e','S','h','o','r','t','c','u','t','s',0}; -static const WCHAR szRMCCPSearch[] = - {'R','M','C','C','P','S','e','a','r','c','h',0}; -static const WCHAR szScheduleReboot[] = - {'S','c','h','e','d','u','l','e','R','e','b','o','o','t',0}; -static const WCHAR szSelfUnregModules[] = - {'S','e','l','f','U','n','r','e','g','M','o','d','u','l','e','s',0}; -static const WCHAR szSetODBCFolders[] = - {'S','e','t','O','D','B','C','F','o','l','d','e','r','s',0}; -static const WCHAR szStartServices[] = - {'S','t','a','r','t','S','e','r','v','i','c','e','s',0}; -static const WCHAR szStopServices[] = - {'S','t','o','p','S','e','r','v','i','c','e','s',0}; -static const WCHAR szUnpublishComponents[] = - {'U','n','p','u','b','l','i','s','h', 'C','o','m','p','o','n','e','n','t','s',0}; -static const WCHAR szUnpublishFeatures[] = - {'U','n','p','u','b','l','i','s','h','F','e','a','t','u','r','e','s',0}; -static const WCHAR szUnpublishProduct[] = - {'U','n','p','u','b','l','i','s','h','P','r','o','d','u','c','t',0}; -static const WCHAR szUnregisterComPlus[] = - {'U','n','r','e','g','i','s','t','e','r','C','o','m','P','l','u','s',0}; -static const WCHAR szUnregisterTypeLibraries[] = - {'U','n','r','e','g','i','s','t','e','r','T','y','p','e','L','i','b','r','a','r','i','e','s',0}; -static const WCHAR szValidateProductID[] = - {'V','a','l','i','d','a','t','e','P','r','o','d','u','c','t','I','D',0}; -static const WCHAR szWriteEnvironmentStrings[] = - {'W','r','i','t','e','E','n','v','i','r','o','n','m','e','n','t','S','t','r','i','n','g','s',0}; -static const WCHAR szINSTALL[] = - {'I','N','S','T','A','L','L',0}; - struct dummy_thread { HANDLE started; @@ -166,13 +55,10 @@ struct dummy_thread static INT ui_actionstart(MSIPACKAGE *package, LPCWSTR action, LPCWSTR description, LPCWSTR template) { - static const WCHAR query[] = {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','A','c','t','i','o','n','T','e','x','t','`',' ','W','H','E','R','E',' ', - '`','A','c','t','i','o','n','`',' ','=',' ','\'','%','s','\'',0}; MSIRECORD *row, *textrow; INT rc; - textrow = MSI_QueryGetRecord(package->db, query, action); + textrow = MSI_QueryGetRecord(package->db, L"SELECT * FROM `ActionText` WHERE `Action` = '%s'", action); if (textrow) { description = MSI_RecordGetString(textrow, 2); @@ -373,7 +259,7 @@ UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine, TRACE("Found commandline property %s = %s\n", debugstr_w(prop), debugstr_w(val)); r = msi_set_property( package->db, prop, val, -1 ); - if (r == ERROR_SUCCESS && !wcscmp( prop, szSourceDir )) + if (r == ERROR_SUCCESS && !wcscmp( prop, L"SourceDir" )) msi_reset_source_folders( package ); msi_free( val ); @@ -454,14 +340,10 @@ WCHAR **msi_split_string( const WCHAR *str, WCHAR sep ) static BOOL ui_sequence_exists( MSIPACKAGE *package ) { - static const WCHAR query [] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','I','n','s','t','a','l','l','U','I','S','e','q','u','e','n','c','e','`',' ', - 'W','H','E','R','E',' ','`','S','e','q','u','e','n','c','e','`',' ','>',' ','0',0}; MSIQUERY *view; DWORD count = 0; - if (!(MSI_DatabaseOpenViewW( package->db, query, &view ))) + if (!(MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `InstallUISequence` WHERE `Sequence` > 0", &view ))) { MSI_IterateRecords( view, &count, NULL, package ); msiobj_release( &view->hdr ); @@ -474,7 +356,7 @@ UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace) WCHAR *source, *check, *p, *db; DWORD len; - if (!(db = msi_dup_property( package->db, szOriginalDatabase ))) + if (!(db = msi_dup_property( package->db, L"OriginalDatabase" ))) return ERROR_OUTOFMEMORY; if (!(p = wcsrchr( db, '\\' )) && !(p = wcsrchr( db, '/' ))) @@ -487,18 +369,18 @@ UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace) lstrcpynW( source, db, len ); msi_free( db ); - check = msi_dup_property( package->db, szSourceDir ); + check = msi_dup_property( package->db, L"SourceDir" ); if (!check || replace) { - UINT r = msi_set_property( package->db, szSourceDir, source, -1 ); + UINT r = msi_set_property( package->db, L"SourceDir", source, -1 ); if (r == ERROR_SUCCESS) msi_reset_source_folders( package ); } msi_free( check ); - check = msi_dup_property( package->db, szSOURCEDIR ); + check = msi_dup_property( package->db, L"SOURCEDIR" ); if (!check || replace) - msi_set_property( package->db, szSOURCEDIR, source, -1 ); + msi_set_property( package->db, L"SOURCEDIR", source, -1 ); msi_free( check ); msi_free( source ); @@ -516,7 +398,7 @@ UINT msi_set_context(MSIPACKAGE *package) UINT r = msi_locate_product( package->ProductCode, &package->Context ); if (r != ERROR_SUCCESS) { - int num = msi_get_property_int( package->db, szAllUsers, 0 ); + int num = msi_get_property_int( package->db, L"ALLUSERS", 0 ); if (num == 1 || num == 2) package->Context = MSIINSTALLCONTEXT_MACHINE; else @@ -569,17 +451,12 @@ static UINT ITERATE_Actions(MSIRECORD *row, LPVOID param) UINT MSI_Sequence( MSIPACKAGE *package, LPCWSTR table ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','%','s','`', - ' ','W','H','E','R','E',' ','`','S','e','q','u','e','n','c','e','`',' ', - '>',' ','0',' ','O','R','D','E','R',' ','B','Y',' ', - '`','S','e','q','u','e','n','c','e','`',0}; MSIQUERY *view; UINT r; TRACE("%p %s\n", package, debugstr_w(table)); - r = MSI_OpenQuery( package->db, &view, query, table ); + r = MSI_OpenQuery( package->db, &view, L"SELECT * FROM `%s` WHERE `Sequence` > 0 ORDER BY `Sequence`", table ); if (r == ERROR_SUCCESS) { r = MSI_IterateRecords( view, NULL, ITERATE_Actions, package ); @@ -590,12 +467,6 @@ UINT MSI_Sequence( MSIPACKAGE *package, LPCWSTR table ) static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ', - '`','I','n','s','t','a','l','l','E','x','e','c','u','t','e', - 'S','e','q','u','e','n','c','e','`',' ', 'W','H','E','R','E',' ', - '`','S','e','q','u','e','n','c','e','`',' ', '>',' ','0',' ', - 'O','R','D','E','R',' ', 'B','Y',' ','`','S','e','q','u','e','n','c','e','`',0}; MSIQUERY *view; UINT rc; @@ -607,12 +478,13 @@ static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package) package->ExecuteSequenceRun = TRUE; - rc = MSI_OpenQuery(package->db, &view, query); + rc = MSI_OpenQuery(package->db, &view, + L"SELECT * FROM `InstallExecuteSequence` WHERE `Sequence` > 0 ORDER BY `Sequence`"); if (rc == ERROR_SUCCESS) { TRACE("Running the actions\n"); - msi_set_property( package->db, szSourceDir, NULL, -1 ); + msi_set_property( package->db, L"SourceDir", NULL, -1 ); rc = MSI_IterateRecords(view, NULL, ITERATE_Actions, package); msiobj_release(&view->hdr); } @@ -621,18 +493,15 @@ static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package) static UINT ACTION_ProcessUISequence(MSIPACKAGE *package) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','I','n','s','t','a','l','l','U','I','S','e','q','u','e','n','c','e','`',' ', - 'W','H','E','R','E',' ','`','S','e','q','u','e','n','c','e','`',' ','>',' ','0',' ', - 'O','R','D','E','R',' ','B','Y',' ','`','S','e','q','u','e','n','c','e','`',0}; MSIQUERY *view; UINT rc; - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW(package->db, + L"SELECT * FROM `InstallUISequence` WHERE `Sequence` > 0 ORDER BY `Sequence`", + &view); if (rc == ERROR_SUCCESS) { - TRACE("Running the actions\n"); + TRACE("Running the actions\n"); rc = MSI_IterateRecords(view, NULL, ITERATE_Actions, package); msiobj_release(&view->hdr); } @@ -813,16 +682,13 @@ static UINT ITERATE_CreateFolders(MSIRECORD *row, LPVOID param) static UINT ACTION_CreateFolders(MSIPACKAGE *package) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','C','r','e','a','t','e','F','o','l','d','e','r','`',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szCreateFolders); + return msi_schedule_action(package, SCRIPT_INSTALL, L"CreateFolders"); - rc = MSI_DatabaseOpenViewW( package->db, query, &view ); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `CreateFolder`", &view ); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -895,16 +761,13 @@ static UINT ITERATE_RemoveFolders( MSIRECORD *row, LPVOID param ) static UINT ACTION_RemoveFolders( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','C','r','e','a','t','e','F','o','l','d','e','r','`',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szRemoveFolders); + return msi_schedule_action(package, SCRIPT_INSTALL, L"RemoveFolders"); - rc = MSI_DatabaseOpenViewW( package->db, query, &view ); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `CreateFolder`", &view ); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -945,16 +808,13 @@ static UINT load_component( MSIRECORD *row, LPVOID param ) UINT msi_load_all_components( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','C','o','m','p','o','n','e','n','t','`',0}; MSIQUERY *view; UINT r; if (!list_empty(&package->components)) return ERROR_SUCCESS; - r = MSI_DatabaseOpenViewW( package->db, query, &view ); + r = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `Component`", &view ); if (r != ERROR_SUCCESS) return r; @@ -1015,13 +875,8 @@ static UINT iterate_load_featurecomponents(MSIRECORD *row, LPVOID param) return ERROR_SUCCESS; } -static UINT load_feature(MSIRECORD * row, LPVOID param) +static UINT load_feature(MSIRECORD *row, LPVOID param) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','`','C','o','m','p','o','n','e','n','t','_','`', - ' ','F','R','O','M',' ','`','F','e','a','t','u','r','e', - 'C','o','m','p','o','n','e','n','t','s','`',' ','W','H','E','R','E',' ', - '`','F','e', 'a','t','u','r','e','_','`',' ','=','\'','%','s','\'',0}; MSIPACKAGE *package = param; MSIFEATURE *feature; MSIQUERY *view; @@ -1036,7 +891,7 @@ static UINT load_feature(MSIRECORD * row, LPVOID param) list_init( &feature->Children ); list_init( &feature->Components ); - + feature->Feature = msi_dup_record_field( row, 1 ); TRACE("Loading feature %s\n",debugstr_w(feature->Feature)); @@ -1047,7 +902,7 @@ static UINT load_feature(MSIRECORD * row, LPVOID param) if (!MSI_RecordIsNull(row,5)) feature->Display = MSI_RecordGetInteger(row,5); - + feature->Level= MSI_RecordGetInteger(row,6); feature->Directory = msi_dup_record_field( row, 7 ); feature->Attributes = MSI_RecordGetInteger(row,8); @@ -1060,7 +915,8 @@ static UINT load_feature(MSIRECORD * row, LPVOID param) /* load feature components */ - rc = MSI_OpenQuery( package->db, &view, query, feature->Feature ); + rc = MSI_OpenQuery( package->db, &view, L"SELECT `Component_` FROM `FeatureComponents` WHERE `Feature_` = '%s'", + feature->Feature ); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -1094,17 +950,13 @@ static UINT find_feature_children(MSIRECORD * row, LPVOID param) UINT msi_load_all_features( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','F','e','a','t','u','r','e','`',' ','O','R','D','E','R',' ','B','Y',' ', - '`','D','i','s','p','l','a','y','`',0}; MSIQUERY *view; UINT r; if (!list_empty(&package->features)) return ERROR_SUCCESS; - - r = MSI_DatabaseOpenViewW( package->db, query, &view ); + + r = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `Feature` ORDER BY `Display`", &view ); if (r != ERROR_SUCCESS) return r; @@ -1132,17 +984,13 @@ static LPWSTR folder_split_path(LPWSTR p, WCHAR ch) static UINT load_file_hash(MSIPACKAGE *package, MSIFILE *file) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ', - '`','M','s','i','F','i','l','e','H','a','s','h','`',' ', - 'W','H','E','R','E',' ','`','F','i','l','e','_','`',' ','=',' ','\'','%','s','\'',0}; MSIQUERY *view = NULL; MSIRECORD *row = NULL; UINT r; TRACE("%s\n", debugstr_w(file->File)); - r = MSI_OpenQuery(package->db, &view, query, file->File); + r = MSI_OpenQuery(package->db, &view, L"SELECT * FROM `MsiFileHash` WHERE `File_` = '%s'", file->File); if (r != ERROR_SUCCESS) goto done; @@ -1168,13 +1016,8 @@ done: static UINT load_file_disk_id( MSIPACKAGE *package, MSIFILE *file ) { - MSIRECORD *row; - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','`','D','i','s','k','I','d','`',' ', 'F','R','O','M',' ', - '`','M','e','d','i','a','`',' ','W','H','E','R','E',' ', - '`','L','a','s','t','S','e','q','u','e','n','c','e','`',' ','>','=',' ','%','i',0}; - - row = MSI_QueryGetRecord( package->db, query, file->Sequence ); + MSIRECORD *row = MSI_QueryGetRecord( package->db, L"SELECT `DiskId` FROM `Media` WHERE `LastSequence` >= %d", + file->Sequence ); if (!row) { WARN("query failed\n"); @@ -1197,7 +1040,7 @@ static UINT load_file(MSIRECORD *row, LPVOID param) file = msi_alloc_zero( sizeof (MSIFILE) ); if (!file) return ERROR_NOT_ENOUGH_MEMORY; - + file->File = msi_dup_record_field( row, 1 ); component = MSI_RecordGetString( row, 2 ); @@ -1216,7 +1059,7 @@ static UINT load_file(MSIRECORD *row, LPVOID param) file->ShortName = msi_dup_record_field( row, 3 ); file->LongName = strdupW( folder_split_path(file->ShortName, '|')); - + file->FileSize = MSI_RecordGetInteger( row, 4 ); file->Version = msi_dup_record_field( row, 5 ); file->Language = msi_dup_record_field( row, 6 ); @@ -1248,23 +1091,18 @@ static UINT load_file(MSIRECORD *row, LPVOID param) TRACE("File loaded (file %s sequence %u)\n", debugstr_w(file->File), file->Sequence); list_add_tail( &package->files, &file->entry ); - return ERROR_SUCCESS; } static UINT load_all_files(MSIPACKAGE *package) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ', - '`','F','i','l','e','`',' ', 'O','R','D','E','R',' ','B','Y',' ', - '`','S','e','q','u','e','n','c','e','`', 0}; MSIQUERY *view; UINT rc; if (!list_empty(&package->files)) return ERROR_SUCCESS; - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `File` ORDER BY `Sequence`", &view); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -1288,14 +1126,10 @@ static UINT load_media( MSIRECORD *row, LPVOID param ) static UINT load_all_media( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`', - 'M','e','d','i','a','`',' ','O','R','D','E','R',' ','B','Y',' ', - '`','D','i','s','k','I','d','`',0}; MSIQUERY *view; UINT r; - r = MSI_DatabaseOpenViewW( package->db, query, &view ); + r = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `Media` ORDER BY `DiskId`", &view ); if (r != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -1306,13 +1140,9 @@ static UINT load_all_media( MSIPACKAGE *package ) static UINT load_patch_disk_id( MSIPACKAGE *package, MSIFILEPATCH *patch ) { - static const WCHAR query[] = - {'S','E','L','E','C','T',' ','`','D','i','s','k','I','d','`',' ', 'F','R','O','M',' ', - '`','M','e','d','i','a','`',' ','W','H','E','R','E',' ', - '`','L','a','s','t','S','e','q','u','e','n','c','e','`',' ','>','=',' ','%','u',0}; - MSIRECORD *rec; - - if (!(rec = MSI_QueryGetRecord( package->db, query, patch->Sequence ))) + MSIRECORD *rec = MSI_QueryGetRecord( package->db, L"SELECT `DiskId` FROM `Media` WHERE `LastSequence` >= %u", + patch->Sequence ); + if (!rec) { WARN("query failed\n"); return ERROR_FUNCTION_FAILED; @@ -1362,17 +1192,13 @@ static UINT load_patch(MSIRECORD *row, LPVOID param) static UINT load_all_patches(MSIPACKAGE *package) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','P','a','t','c','h','`',' ','O','R','D','E','R',' ','B','Y',' ', - '`','S','e','q','u','e','n','c','e','`',0}; MSIQUERY *view; UINT rc; if (!list_empty(&package->filepatches)) return ERROR_SUCCESS; - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `Patch` ORDER BY `Sequence`", &view); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -1426,14 +1252,11 @@ static void mark_patched_components( MSIPACKAGE *package ) static UINT load_folder_persistence( MSIPACKAGE *package, MSIFOLDER *folder ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','C','r','e','a','t','e','F','o','l','d','e','r','`',' ','W','H','E','R','E',' ', - '`','D','i','r','e','c','t','o','r','y','_','`',' ','=','\'','%','s','\'',0}; MSIQUERY *view; folder->persistent = FALSE; - if (!MSI_OpenQuery( package->db, &view, query, folder->Directory )) + if (!MSI_OpenQuery( package->db, &view, L"SELECT * FROM `CreateFolder` WHERE `Directory_` = '%s'", + folder->Directory )) { if (!MSI_ViewExecute( view, NULL )) { @@ -1453,7 +1276,7 @@ static UINT load_folder_persistence( MSIPACKAGE *package, MSIFOLDER *folder ) static UINT load_folder( MSIRECORD *row, LPVOID param ) { MSIPACKAGE *package = param; - static WCHAR szEmpty[] = { 0 }; + static WCHAR szEmpty[] = {0}; LPWSTR p, tgt_short, tgt_long, src_short, src_long; MSIFOLDER *folder; @@ -1474,9 +1297,9 @@ static UINT load_folder( MSIRECORD *row, LPVOID param ) src_long = folder_split_path( src_short, '|' ); /* check for no-op dirs */ - if (tgt_short && !wcscmp( szDot, tgt_short )) + if (tgt_short && !wcscmp( L".", tgt_short )) tgt_short = szEmpty; - if (src_short && !wcscmp( szDot, src_short )) + if (src_short && !wcscmp( L".", src_short )) src_short = szEmpty; if (!tgt_long) @@ -1534,16 +1357,13 @@ static UINT find_folder_children( MSIRECORD *row, LPVOID param ) static UINT load_all_folders( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','D','i','r','e','c','t','o','r','y','`',0}; MSIQUERY *view; UINT r; if (!list_empty(&package->folders)) return ERROR_SUCCESS; - r = MSI_DatabaseOpenViewW( package->db, query, &view ); + r = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `Directory`", &view ); if (r != ERROR_SUCCESS) return r; @@ -1560,8 +1380,8 @@ static UINT load_all_folders( MSIPACKAGE *package ) static UINT ACTION_CostInitialize(MSIPACKAGE *package) { - msi_set_property( package->db, szCostingComplete, szZero, -1 ); - msi_set_property( package->db, szRootDrive, szCRoot, -1 ); + msi_set_property( package->db, L"CostingComplete", L"0", -1 ); + msi_set_property( package->db, L"ROOTDRIVE", L"C:\\", -1 ); load_all_folders( package ); msi_load_all_components( package ); @@ -1629,7 +1449,7 @@ static void get_client_counts( MSIPACKAGE *package ) { if (!comp->ComponentId) continue; - if (MSIREG_OpenUserDataComponentKey( comp->ComponentId, szLocalSid, &hkey, FALSE ) && + if (MSIREG_OpenUserDataComponentKey( comp->ComponentId, L"S-1-5-18", &hkey, FALSE ) && MSIREG_OpenUserDataComponentKey( comp->ComponentId, NULL, &hkey, FALSE )) { comp->num_clients = 0; @@ -1694,8 +1514,8 @@ static BOOL process_state_property(MSIPACKAGE* package, int level, { LPWSTR override; MSIFEATURE *feature; - BOOL remove = !wcscmp(property, szRemove); - BOOL reinstall = !wcscmp(property, szReinstall); + BOOL remove = !wcscmp(property, L"REMOVE"); + BOOL reinstall = !wcscmp(property, L"REINSTALL"); override = msi_dup_property( package->db, property ); if (!override) @@ -1711,7 +1531,7 @@ static BOOL process_state_property(MSIPACKAGE* package, int level, else if (remove) state = (feature->Installed == INSTALLSTATE_ABSENT ? INSTALLSTATE_UNKNOWN : INSTALLSTATE_ABSENT); - if (!wcsicmp( override, szAll )) + if (!wcsicmp( override, L"ALL" )) { feature->Action = state; feature->ActionRequest = state; @@ -1748,12 +1568,6 @@ static BOOL process_state_property(MSIPACKAGE* package, int level, static BOOL process_overrides( MSIPACKAGE *package, int level ) { - static const WCHAR szAddLocal[] = - {'A','D','D','L','O','C','A','L',0}; - static const WCHAR szAddSource[] = - {'A','D','D','S','O','U','R','C','E',0}; - static const WCHAR szAdvertise[] = - {'A','D','V','E','R','T','I','S','E',0}; BOOL ret = FALSE; /* all these activation/deactivation things happen in order and things @@ -1772,14 +1586,14 @@ static BOOL process_overrides( MSIPACKAGE *package, int level ) * 10 FILEADDSOURCE * 11 FILEADDDEFAULT */ - ret |= process_state_property( package, level, szAddLocal, INSTALLSTATE_LOCAL ); - ret |= process_state_property( package, level, szRemove, INSTALLSTATE_ABSENT ); - ret |= process_state_property( package, level, szAddSource, INSTALLSTATE_SOURCE ); - ret |= process_state_property( package, level, szReinstall, INSTALLSTATE_UNKNOWN ); - ret |= process_state_property( package, level, szAdvertise, INSTALLSTATE_ADVERTISED ); + ret |= process_state_property( package, level, L"ADDLOCAL", INSTALLSTATE_LOCAL ); + ret |= process_state_property( package, level, L"REMOVE", INSTALLSTATE_ABSENT ); + ret |= process_state_property( package, level, L"ADDSOURCE", INSTALLSTATE_SOURCE ); + ret |= process_state_property( package, level, L"REINSTALL", INSTALLSTATE_UNKNOWN ); + ret |= process_state_property( package, level, L"ADVERTISE", INSTALLSTATE_ADVERTISED ); if (ret) - msi_set_property( package->db, szPreselected, szOne, -1 ); + msi_set_property( package->db, L"Preselected", L"1", -1 ); return ret; } @@ -1831,9 +1645,9 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package) TRACE("Checking Install Level\n"); - level = msi_get_property_int(package->db, szInstallLevel, 1); + level = msi_get_property_int(package->db, L"INSTALLLEVEL", 1); - if (msi_get_property_int( package->db, szPreselected, 0 )) + if (msi_get_property_int( package->db, L"Preselected", 0 )) { LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) { @@ -1854,7 +1668,7 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package) } } } - else if (!msi_get_property_int( package->db, szInstalled, 0 )) + else if (!msi_get_property_int( package->db, L"Installed", 0 )) { LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) { @@ -2148,7 +1962,7 @@ static WCHAR *create_temp_dir( MSIDATABASE *db ) WCHAR tmp[MAX_PATH]; UINT len = ARRAY_SIZE( tmp ); - if (msi_get_property( db, szTempFolder, tmp, &len ) || + if (msi_get_property( db, L"TempFolder", tmp, &len ) || GetFileAttributesW( tmp ) != FILE_ATTRIBUTE_DIRECTORY) { GetTempPathW( MAX_PATH, tmp ); @@ -2160,7 +1974,7 @@ static WCHAR *create_temp_dir( MSIDATABASE *db ) { for (;;) { - if (!GetTempFileNameW( db->tempfolder, szMsi, ++id, ret )) + if (!GetTempFileNameW( db->tempfolder, L"msi", ++id, ret )) { msi_free( ret ); return NULL; @@ -2214,7 +2028,7 @@ WCHAR *msi_build_directory_name( DWORD count, ... ) const WCHAR *str = va_arg( va, const WCHAR * ); if (!str) continue; lstrcatW( dir, str ); - if ( i + 1 != count && dir[0] && dir[lstrlenW( dir ) - 1] != '\\') lstrcatW( dir, szBackSlash ); + if ( i + 1 != count && dir[0] && dir[lstrlenW( dir ) - 1] != '\\') lstrcatW( dir, L"\\" ); } va_end( va ); return dir; @@ -2352,7 +2166,7 @@ static WCHAR *get_install_location( MSIPACKAGE *package ) if (!package->ProductCode) return NULL; if (MSIREG_OpenInstallProps( package->ProductCode, package->Context, NULL, &hkey, FALSE )) return NULL; - if ((path = msi_reg_get_val_str( hkey, szInstallLocation )) && !path[0]) + if ((path = msi_reg_get_val_str( hkey, L"InstallLocation" )) && !path[0]) { msi_free( path ); path = NULL; @@ -2371,12 +2185,12 @@ void msi_resolve_target_folder( MSIPACKAGE *package, const WCHAR *name, BOOL loa if (!(folder = msi_get_loaded_folder( package, name ))) return; - if (!wcscmp( folder->Directory, szTargetDir )) /* special resolving for target root dir */ + if (!wcscmp( folder->Directory, L"TARGETDIR" )) /* special resolving for target root dir */ { if (!(path = get_install_location( package )) && - (!load_prop || !(path = msi_dup_property( package->db, szTargetDir )))) + (!load_prop || !(path = msi_dup_property( package->db, L"TARGETDIR" )))) { - path = msi_dup_property( package->db, szRootDrive ); + path = msi_dup_property( package->db, L"ROOTDRIVE" ); } } else if (!load_prop || !(path = msi_dup_property( package->db, folder->Directory ))) @@ -2419,33 +2233,13 @@ static ULONGLONG get_volume_space_required( MSIPACKAGE *package ) static UINT ACTION_CostFinalize(MSIPACKAGE *package) { - static const WCHAR query[] = - {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','C','o','n','d','i','t','i','o','n','`',0}; - static const WCHAR szOutOfDiskSpace[] = - {'O','u','t','O','f','D','i','s','k','S','p','a','c','e',0}; - static const WCHAR szPrimaryFolder[] = - {'P','R','I','M','A','R','Y','F','O','L','D','E','R',0}; - static const WCHAR szPrimaryVolumePath[] = - {'P','r','i','m','a','r','y','V','o','l','u','m','e','P','a','t','h',0}; - static const WCHAR szPrimaryVolumeSpaceAvailable[] = - {'P','r','i','m','a','r','y','V','o','l','u','m','e','S','p','a','c','e', - 'A','v','a','i','l','a','b','l','e',0}; - static const WCHAR szPrimaryVolumeSpaceRequired[] = - {'P','r','i','m','a','r','y','V','o','l','u','m','e','S','p','a','c','e', - 'R','e','q','u','i','r','e','d',0}; - static const WCHAR szPrimaryVolumeSpaceRemaining[] = - {'P','r','i','m','a','r','y','V','o','l','u','m','e','S','p','a','c','e', - 'R','e','m','a','i','n','i','n','g',0}; - static const WCHAR szOutOfNoRbDiskSpace[] = - {'O','u','t','O','f','N','o','R','b','D','i','s','k','S','p','a','c','e',0}; MSICOMPONENT *comp; MSIQUERY *view; WCHAR *level, *primary_key, *primary_folder; UINT rc; TRACE("Building directory properties\n"); - msi_resolve_target_folder( package, szTargetDir, TRUE ); + msi_resolve_target_folder( package, L"TARGETDIR", TRUE ); TRACE("Evaluating component conditions\n"); LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry ) @@ -2464,11 +2258,11 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package) ACTION_GetComponentInstallStates(package); ACTION_GetFeatureInstallStates(package); - if (!process_overrides( package, msi_get_property_int( package->db, szInstallLevel, 1 ) )) + if (!process_overrides( package, msi_get_property_int( package->db, L"INSTALLLEVEL", 1 ) )) { TRACE("Evaluating feature conditions\n"); - rc = MSI_DatabaseOpenViewW( package->db, query, &view ); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `Condition`", &view ); if (rc == ERROR_SUCCESS) { rc = MSI_IterateRecords( view, NULL, ITERATE_CostFinalizeConditions, package ); @@ -2481,22 +2275,21 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package) TRACE("Calculating file cost\n"); calculate_file_cost( package ); - msi_set_property( package->db, szCostingComplete, szOne, -1 ); + msi_set_property( package->db, L"CostingComplete", L"1", -1 ); /* set default run level if not set */ - level = msi_dup_property( package->db, szInstallLevel ); - if (!level) msi_set_property( package->db, szInstallLevel, szOne, -1 ); + level = msi_dup_property( package->db, L"INSTALLLEVEL" ); + if (!level) msi_set_property( package->db, L"INSTALLLEVEL", L"1", -1 ); msi_free(level); if ((rc = MSI_SetFeatureStates( package ))) return rc; - if ((primary_key = msi_dup_property( package->db, szPrimaryFolder ))) + if ((primary_key = msi_dup_property( package->db, L"PRIMARYFOLDER" ))) { if ((primary_folder = msi_dup_property( package->db, primary_key ))) { if (((primary_folder[0] >= 'A' && primary_folder[0] <= 'Z') || (primary_folder[0] >= 'a' && primary_folder[0] <= 'z')) && primary_folder[1] == ':') { - static const WCHAR fmtW[] = {'%','l','u',0}; ULARGE_INTEGER free; ULONGLONG required; WCHAR buf[21]; @@ -2504,16 +2297,28 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package) primary_folder[2] = 0; if (GetDiskFreeSpaceExW( primary_folder, &free, NULL, NULL )) { - swprintf( buf, ARRAY_SIZE(buf), fmtW, free.QuadPart / 512 ); - msi_set_property( package->db, szPrimaryVolumeSpaceAvailable, buf, -1 ); +#ifdef __REACTOS__ + swprintf(buf, ARRAY_SIZE(buf), L"%I64u", free.QuadPart / 512); +#else + swprintf( buf, ARRAY_SIZE(buf), L"%lu", free.QuadPart / 512 ); +#endif + msi_set_property( package->db, L"PrimaryVolumeSpaceAvailable", buf, -1 ); } required = get_volume_space_required( package ); - swprintf( buf, ARRAY_SIZE(buf), fmtW, required / 512 ); - msi_set_property( package->db, szPrimaryVolumeSpaceRequired, buf, -1 ); +#ifdef __REACTOS__ + swprintf( buf, ARRAY_SIZE(buf), L"%I64u", required / 512 ); +#else + swprintf( buf, ARRAY_SIZE(buf), L"%lu", required / 512 ); +#endif + msi_set_property( package->db, L"PrimaryVolumeSpaceRequired", buf, -1 ); - swprintf( buf, ARRAY_SIZE(buf), fmtW, (free.QuadPart - required) / 512 ); - msi_set_property( package->db, szPrimaryVolumeSpaceRemaining, buf, -1 ); - msi_set_property( package->db, szPrimaryVolumePath, primary_folder, 2 ); +#ifdef __REACTOS__ + swprintf( buf, ARRAY_SIZE(buf), L"%I64u", (free.QuadPart - required) / 512 ); +#else + swprintf( buf, ARRAY_SIZE(buf), L"%lu", (free.QuadPart - required) / 512 ); +#endif + msi_set_property( package->db, L"PrimaryVolumeSpaceRemaining", buf, -1 ); + msi_set_property( package->db, L"PrimaryVolumePath", primary_folder, 2 ); } msi_free( primary_folder ); } @@ -2521,8 +2326,8 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package) } /* FIXME: check volume disk space */ - msi_set_property( package->db, szOutOfDiskSpace, szZero, -1 ); - msi_set_property( package->db, szOutOfNoRbDiskSpace, szZero, -1 ); + msi_set_property( package->db, L"OutOfDiskSpace", L"0", -1 ); + msi_set_property( package->db, L"OutOfNoRbDiskSpace", L"0", -1 ); return ERROR_SUCCESS; } @@ -2643,32 +2448,32 @@ static const WCHAR *get_root_key( MSIPACKAGE *package, INT root, HKEY *root_key switch (root) { case -1: - if (msi_get_property_int( package->db, szAllUsers, 0 )) + if (msi_get_property_int( package->db, L"ALLUSERS", 0 )) { *root_key = HKEY_LOCAL_MACHINE; - ret = szHLM; + ret = L"HKEY_LOCAL_MACHINE\\"; } else { *root_key = HKEY_CURRENT_USER; - ret = szHCU; + ret = L"HKEY_CURRENT_USER\\"; } break; case 0: *root_key = HKEY_CLASSES_ROOT; - ret = szHCR; + ret = L"HKEY_CLASSES_ROOT\\"; break; case 1: *root_key = HKEY_CURRENT_USER; - ret = szHCU; + ret = L"HKEY_CURRENT_USER\\"; break; case 2: *root_key = HKEY_LOCAL_MACHINE; - ret = szHLM; + ret = L"HKEY_LOCAL_MACHINE\\"; break; case 3: *root_key = HKEY_USERS; - ret = szHU; + ret = L"HKEY_USERS\\"; break; default: ERR("Unknown root %i\n", root); @@ -3000,16 +2805,13 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param) static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','R','e','g','i','s','t','r','y','`',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szWriteRegistryValues); + return msi_schedule_action(package, SCRIPT_INSTALL, L"WriteRegistryValues"); - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `Registry`", &view); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -3232,19 +3034,13 @@ static UINT ITERATE_RemoveRegistryValuesOnInstall( MSIRECORD *row, LPVOID param static UINT ACTION_RemoveRegistryValues( MSIPACKAGE *package ) { - static const WCHAR registry_query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','R','e','g','i','s','t','r','y','`',0}; - static const WCHAR remove_registry_query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','R','e','m','o','v','e','R','e','g','i','s','t','r','y','`',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szRemoveRegistryValues); + return msi_schedule_action(package, SCRIPT_INSTALL, L"RemoveRegistryValues"); - rc = MSI_DatabaseOpenViewW( package->db, registry_query, &view ); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `Registry`", &view ); if (rc == ERROR_SUCCESS) { rc = MSI_IterateRecords( view, NULL, ITERATE_RemoveRegistryValuesOnUninstall, package ); @@ -3252,7 +3048,7 @@ static UINT ACTION_RemoveRegistryValues( MSIPACKAGE *package ) if (rc != ERROR_SUCCESS) return rc; } - rc = MSI_DatabaseOpenViewW( package->db, remove_registry_query, &view ); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `RemoveRegistry`", &view ); if (rc == ERROR_SUCCESS) { rc = MSI_IterateRecords( view, NULL, ITERATE_RemoveRegistryValuesOnInstall, package ); @@ -3271,9 +3067,6 @@ static UINT ACTION_InstallInitialize(MSIPACKAGE *package) static UINT ACTION_InstallValidate(MSIPACKAGE *package) { - static const WCHAR query[]= { - 'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ', - '`','R','e','g','i','s','t','r','y','`',0}; MSICOMPONENT *comp; DWORD total = 0, count = 0; MSIQUERY *view; @@ -3283,7 +3076,7 @@ static UINT ACTION_InstallValidate(MSIPACKAGE *package) TRACE("InstallValidate\n"); - rc = MSI_DatabaseOpenViewW( package->db, query, &view ); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `Registry`", &view ); if (rc == ERROR_SUCCESS) { rc = MSI_IterateRecords( view, &count, NULL, package ); @@ -3312,24 +3105,19 @@ static UINT ACTION_InstallValidate(MSIPACKAGE *package) static UINT ITERATE_LaunchConditions(MSIRECORD *row, LPVOID param) { MSIPACKAGE* package = param; - LPCWSTR cond = NULL; - LPCWSTR message = NULL; + const WCHAR *cond, *message; UINT r; - static const WCHAR title[]= - {'I','n','s','t','a','l','l',' ','F','a', 'i','l','e','d',0}; - - cond = MSI_RecordGetString(row,1); - - r = MSI_EvaluateConditionW(package,cond); + cond = MSI_RecordGetString(row, 1); + r = MSI_EvaluateConditionW(package, cond); if (r == MSICONDITION_FALSE) { if ((package->ui_level & INSTALLUILEVEL_MASK) != INSTALLUILEVEL_NONE) { - LPWSTR deformated; - message = MSI_RecordGetString(row,2); - deformat_string(package,message,&deformated); - MessageBoxW(NULL,deformated,title,MB_OK); + WCHAR *deformated; + message = MSI_RecordGetString(row, 2); + deformat_string(package, message, &deformated); + MessageBoxW(NULL, deformated, L"Install Failed", MB_OK); msi_free(deformated); } @@ -3341,15 +3129,12 @@ static UINT ITERATE_LaunchConditions(MSIRECORD *row, LPVOID param) static UINT ACTION_LaunchConditions(MSIPACKAGE *package) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','L','a','u','n','c','h','C','o','n','d','i','t','i','o','n','`',0}; MSIQUERY *view; UINT rc; TRACE("Checking launch conditions\n"); - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `LaunchCondition`", &view); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -3366,18 +3151,12 @@ static LPWSTR resolve_keypath( MSIPACKAGE* package, MSICOMPONENT *cmp ) if (cmp->Attributes & msidbComponentAttributesRegistryKeyPath) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','R','e','g','i','s','t','r','y','`',' ','W','H','E','R','E',' ', - '`','R','e','g','i','s','t','r','y','`',' ','=',' ' ,'\'','%','s','\'',0}; - static const WCHAR fmt[] = {'%','0','2','i',':','\\','%','s','\\',0}; - static const WCHAR fmt2[]= {'%','0','2','i',':','\\','%','s','\\','%','s',0}; MSIRECORD *row; UINT root, len; LPWSTR deformated, buffer, deformated_name; LPCWSTR key, name; - row = MSI_QueryGetRecord(package->db, query, cmp->KeyPath); + row = MSI_QueryGetRecord(package->db, L"SELECT * FROM `Registry` WHERE `Registry` = '%s'", cmp->KeyPath); if (!row) return NULL; @@ -3394,9 +3173,9 @@ static LPWSTR resolve_keypath( MSIPACKAGE* package, MSICOMPONENT *cmp ) buffer = msi_alloc( len *sizeof(WCHAR)); if (deformated_name) - swprintf(buffer,len,fmt2,root,deformated,deformated_name); + swprintf(buffer, len, L"%02d:\\%s\\%s", root, deformated, deformated_name); else - swprintf(buffer,len,fmt,root,deformated); + swprintf(buffer, len, L"%02d:\\%s\\", root, deformated); msi_free(deformated); msi_free(deformated_name); @@ -3421,11 +3200,8 @@ static LPWSTR resolve_keypath( MSIPACKAGE* package, MSICOMPONENT *cmp ) static HKEY open_shared_dlls_key( MSICOMPONENT *comp, BOOL create, REGSAM access ) { - static const WCHAR path[] = - {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'S','h','a','r','e','d','D','L','L','s',0}; - return open_key( comp, HKEY_LOCAL_MACHINE, path, create, access ); + return open_key( comp, HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\SharedDLLs", + create, access ); } static UINT get_shared_dlls_count( MSICOMPONENT *comp ) @@ -3521,13 +3297,12 @@ static WCHAR *build_full_keypath( MSIPACKAGE *package, MSICOMPONENT *comp ) { if (comp->assembly) { - static const WCHAR prefixW[] = {'<','\\',0}; - DWORD len = lstrlenW( prefixW ) + lstrlenW( comp->assembly->display_name ); + DWORD len = lstrlenW( L"<\\" ) + lstrlenW( comp->assembly->display_name ); WCHAR *keypath = msi_alloc( (len + 1) * sizeof(WCHAR) ); if (keypath) { - lstrcpyW( keypath, prefixW ); + lstrcpyW( keypath, L"<\\" ); lstrcatW( keypath, comp->assembly->display_name ); } return keypath; @@ -3547,7 +3322,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package) msi_set_sourcedir_props(package, FALSE); if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szProcessComponents); + return msi_schedule_action(package, SCRIPT_INSTALL, L"ProcessComponents"); squash_guid( package->ProductCode, squashed_pc ); @@ -3576,7 +3351,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package) if (action == INSTALLSTATE_LOCAL || action == INSTALLSTATE_SOURCE) { if (package->Context == MSIINSTALLCONTEXT_MACHINE) - rc = MSIREG_OpenUserDataComponentKey(comp->ComponentId, szLocalSid, &hkey, TRUE); + rc = MSIREG_OpenUserDataComponentKey(comp->ComponentId, L"S-1-5-18", &hkey, TRUE); else rc = MSIREG_OpenUserDataComponentKey(comp->ComponentId, NULL, &hkey, TRUE); @@ -3585,12 +3360,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package) if (comp->Attributes & msidbComponentAttributesPermanent) { - static const WCHAR szPermKey[] = - { '0','0','0','0','0','0','0','0','0','0','0','0', - '0','0','0','0','0','0','0','0','0','0','0','0', - '0','0','0','0','0','0','0','0',0 }; - - msi_reg_set_val_str(hkey, szPermKey, comp->FullKeypath); + msi_reg_set_val_str(hkey, L"00000000000000000000000000000000", comp->FullKeypath); } if (action == INSTALLSTATE_LOCAL) msi_reg_set_val_str( hkey, squashed_pc, comp->FullKeypath ); @@ -3603,21 +3373,14 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package) WCHAR base[MAX_PATH]; LPWSTR sourcepath; - static const WCHAR fmt[] = {'%','0','2','d','\\',0}; - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ', - '`','M','e','d','i','a','`',' ','W','H','E','R','E',' ', - '`','L','a','s','t','S','e','q','u','e','n','c','e','`',' ', - '>','=',' ','%','i',' ','O','R','D','E','R',' ','B','Y',' ', - '`','D','i','s','k','I','d','`',0}; - if (!comp->KeyPath || !(file = msi_get_loaded_file(package, comp->KeyPath))) continue; - if (!(row = MSI_QueryGetRecord(package->db, query, file->Sequence))) + if (!(row = MSI_QueryGetRecord(package->db, L"SELECT * FROM `Media` WHERE `LastSequence` >= %d " + L"ORDER BY `DiskId`", file->Sequence))) return ERROR_FUNCTION_FAILED; - swprintf(source, ARRAY_SIZE(source), fmt, MSI_RecordGetInteger(row, 1)); + swprintf(source, ARRAY_SIZE(source), L"%02d\\", MSI_RecordGetInteger(row, 1)); ptr2 = wcsrchr(source, '\\') + 1; msiobj_release(&row->hdr); @@ -3639,7 +3402,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package) if (comp->num_clients <= 0) { if (package->Context == MSIINSTALLCONTEXT_MACHINE) - rc = MSIREG_DeleteUserDataComponentKey( comp->ComponentId, szLocalSid ); + rc = MSIREG_DeleteUserDataComponentKey( comp->ComponentId, L"S-1-5-18" ); else rc = MSIREG_DeleteUserDataComponentKey( comp->ComponentId, NULL ); @@ -3650,7 +3413,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package) LONG res; if (package->Context == MSIINSTALLCONTEXT_MACHINE) - rc = MSIREG_OpenUserDataComponentKey( comp->ComponentId, szLocalSid, &hkey, FALSE ); + rc = MSIREG_OpenUserDataComponentKey( comp->ComponentId, L"S-1-5-18", &hkey, FALSE ); else rc = MSIREG_OpenUserDataComponentKey( comp->ComponentId, NULL, &hkey, FALSE ); @@ -3689,8 +3452,7 @@ static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule, LPCWSTR lpszType, { TLIBATTR *attr; typelib_struct *tl_struct = (typelib_struct*) lParam; - static const WCHAR fmt[] = {'%','s','\\','%','i',0}; - int sz; + int sz; HRESULT res; if (!IS_INTRESOURCE(lpszName)) @@ -3706,7 +3468,11 @@ static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule, LPCWSTR lpszType, else { tl_struct->path = msi_alloc(sz * sizeof(WCHAR)); - swprintf(tl_struct->path,sz,fmt,tl_struct->source, lpszName); +#ifdef __REACTOS__ + swprintf(tl_struct->path, sz, L"%s\\%d", tl_struct->source, (WORD)(INT_PTR)lpszName); +#else + swprintf(tl_struct->path, sz, L"%s\\%d", tl_struct->source, lpszName); +#endif } TRACE("trying %s\n", debugstr_w(tl_struct->path)); @@ -3792,7 +3558,7 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param) tl_struct.source = strdupW( file->TargetPath ); tl_struct.path = NULL; - EnumResourceNamesW(module, szTYPELIB, Typelib_EnumResNameProc, + EnumResourceNamesW(module, L"TYPELIB", Typelib_EnumResNameProc, (LONG_PTR)&tl_struct); if (tl_struct.path) @@ -3835,16 +3601,13 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param) static UINT ACTION_RegisterTypeLibraries(MSIPACKAGE *package) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','T','y','p','e','L','i','b','`',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szRegisterTypeLibraries); + return msi_schedule_action(package, SCRIPT_INSTALL, L"RegisterTypeLibraries"); - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `TypeLib`", &view); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -3899,16 +3662,13 @@ static UINT ITERATE_UnregisterTypeLibraries( MSIRECORD *row, LPVOID param ) static UINT ACTION_UnregisterTypeLibraries( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','T','y','p','e','L','i','b','`',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szUnregisterTypeLibraries); + return msi_schedule_action(package, SCRIPT_INSTALL, L"UnregisterTypeLibraries"); - rc = MSI_DatabaseOpenViewW( package->db, query, &view ); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `TypeLib`", &view ); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -3919,7 +3679,6 @@ static UINT ACTION_UnregisterTypeLibraries( MSIPACKAGE *package ) static WCHAR *get_link_file( MSIPACKAGE *package, MSIRECORD *row ) { - static const WCHAR szlnk[] = {'.','l','n','k',0}; LPCWSTR directory, extension, link_folder; LPWSTR link_file, filename; @@ -3937,11 +3696,11 @@ static WCHAR *get_link_file( MSIPACKAGE *package, MSIRECORD *row ) msi_reduce_to_long_filename( filename ); extension = wcsrchr( filename, '.' ); - if (!extension || wcsicmp( extension, szlnk )) + if (!extension || wcsicmp( extension, L".lnk" )) { int len = lstrlenW( filename ); - filename = msi_realloc( filename, len * sizeof(WCHAR) + sizeof(szlnk) ); - memcpy( filename + len, szlnk, sizeof(szlnk) ); + filename = msi_realloc( filename, len * sizeof(WCHAR) + sizeof(L".lnk") ); + memcpy( filename + len, L".lnk", sizeof(L".lnk") ); } link_file = msi_build_directory_name( 2, link_folder, filename ); msi_free( filename ); @@ -3951,19 +3710,17 @@ static WCHAR *get_link_file( MSIPACKAGE *package, MSIRECORD *row ) WCHAR *msi_build_icon_path( MSIPACKAGE *package, const WCHAR *icon_name ) { - static const WCHAR szMicrosoft[] = {'M','i','c','r','o','s','o','f','t','\\',0}; - static const WCHAR szInstaller[] = {'I','n','s','t','a','l','l','e','r','\\',0}; WCHAR *folder, *dest, *path; if (package->Context == MSIINSTALLCONTEXT_MACHINE) - folder = msi_dup_property( package->db, szWindowsFolder ); + folder = msi_dup_property( package->db, L"WindowsFolder" ); else { - WCHAR *appdata = msi_dup_property( package->db, szAppDataFolder ); - folder = msi_build_directory_name( 2, appdata, szMicrosoft ); + WCHAR *appdata = msi_dup_property( package->db, L"AppDataFolder" ); + folder = msi_build_directory_name( 2, appdata, L"Microsoft\\" ); msi_free( appdata ); } - dest = msi_build_directory_name( 3, folder, szInstaller, package->ProductCode ); + dest = msi_build_directory_name( 3, folder, L"Installer\\", package->ProductCode ); msi_create_full_path( package, dest ); path = msi_build_directory_name( 2, dest, icon_name ); msi_free( folder ); @@ -4089,17 +3846,14 @@ err: static UINT ACTION_CreateShortcuts(MSIPACKAGE *package) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','S','h','o','r','t','c','u','t','`',0}; MSIQUERY *view; HRESULT res; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szCreateShortcuts); + return msi_schedule_action(package, SCRIPT_INSTALL, L"CreateShortcuts"); - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `Shortcut`", &view); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -4142,16 +3896,13 @@ static UINT ITERATE_RemoveShortcuts( MSIRECORD *row, LPVOID param ) static UINT ACTION_RemoveShortcuts( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','S','h','o','r','t','c','u','t','`',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szRemoveShortcuts); + return msi_schedule_action(package, SCRIPT_INSTALL, L"RemoveShortcuts"); - rc = MSI_DatabaseOpenViewW( package->db, query, &view ); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `Shortcut`", &view ); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -4211,13 +3962,10 @@ static UINT ITERATE_PublishIcon(MSIRECORD *row, LPVOID param) static UINT msi_publish_icons(MSIPACKAGE *package) { - static const WCHAR query[]= { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','I','c','o','n','`',0}; MSIQUERY *view; UINT r; - r = MSI_DatabaseOpenViewW(package->db, query, &view); + r = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `Icon`", &view); if (r == ERROR_SUCCESS) { r = MSI_IterateRecords(view, NULL, ITERATE_PublishIcon, package); @@ -4236,7 +3984,7 @@ static UINT msi_publish_sourcelist(MSIPACKAGE *package, HKEY hkey) MSIMEDIADISK *disk; MSISOURCELISTINFO *info; - r = RegCreateKeyW(hkey, szSourceList, &source); + r = RegCreateKeyW(hkey, L"SourceList", &source); if (r != ERROR_SUCCESS) return r; @@ -4251,13 +3999,13 @@ static UINT msi_publish_sourcelist(MSIPACKAGE *package, HKEY hkey) r = MsiSourceListSetInfoW(package->ProductCode, NULL, package->Context, MSICODE_PRODUCT, - INSTALLPROPERTY_MEDIAPACKAGEPATHW, szEmpty); + INSTALLPROPERTY_MEDIAPACKAGEPATHW, L""); if (r != ERROR_SUCCESS) return r; r = MsiSourceListSetInfoW(package->ProductCode, NULL, package->Context, MSICODE_PRODUCT, - INSTALLPROPERTY_DISKPROMPTW, szEmpty); + INSTALLPROPERTY_DISKPROMPTW, L""); if (r != ERROR_SUCCESS) return r; @@ -4284,15 +4032,6 @@ static UINT msi_publish_sourcelist(MSIPACKAGE *package, HKEY hkey) static UINT msi_publish_product_properties(MSIPACKAGE *package, HKEY hkey) { - static const WCHAR szARPProductIcon[] = - {'A','R','P','P','R','O','D','U','C','T','I','C','O','N',0}; - static const WCHAR szAssignment[] = - {'A','s','s','i','g','n','m','e','n','t',0}; - static const WCHAR szAdvertiseFlags[] = - {'A','d','v','e','r','t','i','s','e','F','l','a','g','s',0}; - static const WCHAR szClients[] = - {'C','l','i','e','n','t','s',0}; - static const WCHAR szColon[] = {':',0}; WCHAR *buffer, *ptr, *guids, packcode[SQUASHED_GUID_SIZE]; DWORD langid; @@ -4300,13 +4039,13 @@ static UINT msi_publish_product_properties(MSIPACKAGE *package, HKEY hkey) msi_reg_set_val_str(hkey, INSTALLPROPERTY_PRODUCTNAMEW, buffer); msi_free(buffer); - langid = msi_get_property_int(package->db, szProductLanguage, 0); + langid = msi_get_property_int(package->db, L"ProductLanguage", 0); msi_reg_set_val_dword(hkey, INSTALLPROPERTY_LANGUAGEW, langid); /* FIXME */ msi_reg_set_val_dword(hkey, INSTALLPROPERTY_AUTHORIZED_LUA_APPW, 0); - buffer = msi_dup_property(package->db, szARPProductIcon); + buffer = msi_dup_property(package->db, L"ARPPRODUCTICON"); if (buffer) { LPWSTR path = msi_build_icon_path(package, buffer); @@ -4315,7 +4054,7 @@ static UINT msi_publish_product_properties(MSIPACKAGE *package, HKEY hkey) msi_free(buffer); } - buffer = msi_dup_property(package->db, szProductVersion); + buffer = msi_dup_property(package->db, L"ProductVersion"); if (buffer) { DWORD verdword = msi_version_str_to_dword(buffer); @@ -4323,10 +4062,10 @@ static UINT msi_publish_product_properties(MSIPACKAGE *package, HKEY hkey) msi_free(buffer); } - msi_reg_set_val_dword(hkey, szAssignment, 0); - msi_reg_set_val_dword(hkey, szAdvertiseFlags, 0x184); + msi_reg_set_val_dword(hkey, L"Assignment", 0); + msi_reg_set_val_dword(hkey, L"AdvertiseFlags", 0x184); msi_reg_set_val_dword(hkey, INSTALLPROPERTY_INSTANCETYPEW, 0); - msi_reg_set_val_str(hkey, szClients, szColon); + msi_reg_set_val_str(hkey, L"Clients", L":"); if (!(guids = msi_get_package_code(package->db))) return ERROR_OUTOFMEMORY; if ((ptr = wcschr(guids, ';'))) *ptr = 0; @@ -4343,7 +4082,7 @@ static UINT msi_publish_upgrade_code(MSIPACKAGE *package) HKEY hkey; WCHAR *upgrade, squashed_pc[SQUASHED_GUID_SIZE]; - upgrade = msi_dup_property(package->db, szUpgradeCode); + upgrade = msi_dup_property(package->db, L"UpgradeCode"); if (!upgrade) return ERROR_SUCCESS; @@ -4395,7 +4134,6 @@ static BOOL msi_check_unpublish(MSIPACKAGE *package) static UINT msi_publish_patches( MSIPACKAGE *package ) { - static const WCHAR szAllPatches[] = {'A','l','l','P','a','t','c','h','e','s',0}; WCHAR patch_squashed[GUID_SIZE]; HKEY patches_key = NULL, product_patches_key = NULL, product_key; LONG res; @@ -4408,7 +4146,7 @@ static UINT msi_publish_patches( MSIPACKAGE *package ) if (r != ERROR_SUCCESS) return ERROR_FUNCTION_FAILED; - res = RegCreateKeyExW( product_key, szPatches, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &patches_key, NULL ); + res = RegCreateKeyExW( product_key, L"Patches", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &patches_key, NULL ); if (res != ERROR_SUCCESS) { r = ERROR_FUNCTION_FAILED; @@ -4446,7 +4184,7 @@ static UINT msi_publish_patches( MSIPACKAGE *package ) if (r != ERROR_SUCCESS) goto done; - res = RegSetValueExW( patch_key, szLocalPackage, 0, REG_SZ, (const BYTE *)patch->localfile, + res = RegSetValueExW( patch_key, L"LocalPackage", 0, REG_SZ, (const BYTE *)patch->localfile, (lstrlenW( patch->localfile ) + 1) * sizeof(WCHAR) ); RegCloseKey( patch_key ); if (res != ERROR_SUCCESS) @@ -4462,7 +4200,7 @@ static UINT msi_publish_patches( MSIPACKAGE *package ) if (res != ERROR_SUCCESS) goto done; - res = RegSetValueExW( patch_key, szState, 0, REG_DWORD, (const BYTE *)&patch->state, + res = RegSetValueExW( patch_key, L"State", 0, REG_DWORD, (const BYTE *)&patch->state, sizeof(patch->state) ); if (res != ERROR_SUCCESS) { @@ -4470,7 +4208,7 @@ static UINT msi_publish_patches( MSIPACKAGE *package ) goto done; } - res = RegSetValueExW( patch_key, szUninstallable, 0, REG_DWORD, (const BYTE *)&patch->uninstallable, + res = RegSetValueExW( patch_key, L"Uninstallable", 0, REG_DWORD, (const BYTE *)&patch->uninstallable, sizeof(patch->uninstallable) ); RegCloseKey( patch_key ); if (res != ERROR_SUCCESS) @@ -4478,12 +4216,12 @@ static UINT msi_publish_patches( MSIPACKAGE *package ) } all_patches[len] = 0; - res = RegSetValueExW( patches_key, szPatches, 0, REG_MULTI_SZ, + res = RegSetValueExW( patches_key, L"Patches", 0, REG_MULTI_SZ, (const BYTE *)all_patches, (len + 1) * sizeof(WCHAR) ); if (res != ERROR_SUCCESS) goto done; - res = RegSetValueExW( product_patches_key, szAllPatches, 0, REG_MULTI_SZ, + res = RegSetValueExW( product_patches_key, L"AllPatches", 0, REG_MULTI_SZ, (const BYTE *)all_patches, (len + 1) * sizeof(WCHAR) ); if (res != ERROR_SUCCESS) r = ERROR_FUNCTION_FAILED; @@ -4504,7 +4242,7 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package) BOOL republish = FALSE; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szPublishProduct); + return msi_schedule_action(package, SCRIPT_INSTALL, L"PublishProduct"); if (!list_empty(&package->patches)) { @@ -4605,7 +4343,7 @@ static WCHAR *get_ini_file_name( MSIPACKAGE *package, MSIRECORD *row ) if (!folder) folder = msi_dup_property( package->db, dirprop ); } else - folder = msi_dup_property( package->db, szWindowsFolder ); + folder = msi_dup_property( package->db, L"WindowsFolder" ); if (!folder) { @@ -4697,16 +4435,13 @@ static UINT ITERATE_WriteIniValues(MSIRECORD *row, LPVOID param) static UINT ACTION_WriteIniValues(MSIPACKAGE *package) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','I','n','i','F','i','l','e','`',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szWriteIniValues); + return msi_schedule_action(package, SCRIPT_INSTALL, L"WriteIniValues"); - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `IniFile`", &view); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -4840,19 +4575,13 @@ static UINT ITERATE_RemoveIniValuesOnInstall( MSIRECORD *row, LPVOID param ) static UINT ACTION_RemoveIniValues( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','I','n','i','F','i','l','e','`',0}; - static const WCHAR remove_query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','R','e','m','o','v','e','I','n','i','F','i','l','e','`',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szRemoveIniValues); + return msi_schedule_action(package, SCRIPT_INSTALL, L"RemoveIniValues"); - rc = MSI_DatabaseOpenViewW( package->db, query, &view ); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `IniFile`", &view ); if (rc == ERROR_SUCCESS) { rc = MSI_IterateRecords( view, NULL, ITERATE_RemoveIniValuesOnUninstall, package ); @@ -4860,7 +4589,7 @@ static UINT ACTION_RemoveIniValues( MSIPACKAGE *package ) if (rc != ERROR_SUCCESS) return rc; } - rc = MSI_DatabaseOpenViewW( package->db, remove_query, &view ); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `RemoveIniFile`", &view ); if (rc == ERROR_SUCCESS) { rc = MSI_IterateRecords( view, NULL, ITERATE_RemoveIniValuesOnInstall, package ); @@ -4874,15 +4603,11 @@ static UINT ACTION_RemoveIniValues( MSIPACKAGE *package ) static void register_dll( const WCHAR *dll, BOOL unregister ) { #ifdef __REACTOS__ - static const WCHAR regW[] = - {'r','e','g','s','v','r','3','2','.','e','x','e',' ','/','s',' ','\"','%','s','\"',0}; - static const WCHAR unregW[] = - {'r','e','g','s','v','r','3','2','.','e','x','e',' ','/','s',' ','/','u',' ','\"','%','s','\"',0}; + static const WCHAR regW[] = L"regsvr32.exe /s \"%s\""; + static const WCHAR unregW[] = L"regsvr32.exe /s /u \"%s\""; #else /* __REACTOS__ */ - static const WCHAR regW[] = - {'r','e','g','s','v','r','3','2','.','e','x','e',' ','\"','%','s','\"',0}; - static const WCHAR unregW[] = - {'r','e','g','s','v','r','3','2','.','e','x','e',' ','/','u',' ','\"','%','s','\"',0}; + static const WCHAR regW[] = L"regsvr32.exe \"%s\""; + static const WCHAR unregW[] = L"regsvr32.exe /u \"%s\""; #endif /* __REACTOS__ */ PROCESS_INFORMATION pi; STARTUPINFOW si; @@ -4938,16 +4663,13 @@ static UINT ITERATE_SelfRegModules(MSIRECORD *row, LPVOID param) static UINT ACTION_SelfRegModules(MSIPACKAGE *package) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','S','e','l','f','R','e','g','`',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szSelfRegModules); + return msi_schedule_action(package, SCRIPT_INSTALL, L"SelfRegModules"); - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `SelfReg`", &view); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -4991,16 +4713,13 @@ static UINT ITERATE_SelfUnregModules( MSIRECORD *row, LPVOID param ) static UINT ACTION_SelfUnregModules( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','S','e','l','f','R','e','g','`',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szSelfUnregModules); + return msi_schedule_action(package, SCRIPT_INSTALL, L"SelfUnregModules"); - rc = MSI_DatabaseOpenViewW( package->db, query, &view ); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `SelfReg`", &view ); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -5016,7 +4735,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package) HKEY hkey = NULL, userdata = NULL; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szPublishFeatures); + return msi_schedule_action(package, SCRIPT_INSTALL, L"PublishFeatures"); if (!msi_check_publish(package)) return ERROR_SUCCESS; @@ -5078,9 +4797,8 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package) if (feature->Feature_Parent) { - static const WCHAR sep[] = {'\2',0}; - lstrcatW(data,sep); - lstrcatW(data,feature->Feature_Parent); + lstrcatW(data, L"\2"); + lstrcatW(data, feature->Feature_Parent); } msi_reg_set_val_str( userdata, feature->Feature, data ); @@ -5092,8 +4810,8 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package) if (!absent) { size += sizeof(WCHAR); - RegSetValueExW(hkey,feature->Feature,0,REG_SZ, - (const BYTE*)(feature->Feature_Parent ? feature->Feature_Parent : szEmpty),size); + RegSetValueExW(hkey, feature->Feature, 0 ,REG_SZ, + (const BYTE*)(feature->Feature_Parent ? feature->Feature_Parent : L""), size); } else { @@ -5159,7 +4877,7 @@ static UINT ACTION_UnpublishFeatures(MSIPACKAGE *package) MSIFEATURE *feature; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szUnpublishFeatures); + return msi_schedule_action(package, SCRIPT_INSTALL, L"UnpublishFeatures"); if (!msi_check_unpublish(package)) return ERROR_SUCCESS; @@ -5174,91 +4892,21 @@ static UINT ACTION_UnpublishFeatures(MSIPACKAGE *package) static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY hkey) { - static const WCHAR date_fmt[] = - {'%','i','%','0','2','i','%','0','2','i',0}; - static const WCHAR szEstimatedSize[] = - {'E','s','t','i','m','a','t','e','d','S','i','z','e',0}; - static const WCHAR szDisplayVersion[] = - {'D','i','s','p','l','a','y','V','e','r','s','i','o','n',0}; - static const WCHAR szInstallSource[] = - {'I','n','s','t','a','l','l','S','o','u','r','c','e',0}; - static const WCHAR szARPAUTHORIZEDCDFPREFIX[] = - {'A','R','P','A','U','T','H','O','R','I','Z','E','D','C','D','F','P','R','E','F','I','X',0}; - static const WCHAR szAuthorizedCDFPrefix[] = - {'A','u','t','h','o','r','i','z','e','d','C','D','F','P','r','e','f','i','x',0}; - static const WCHAR szARPCONTACT[] = - {'A','R','P','C','O','N','T','A','C','T',0}; - static const WCHAR szContact[] = - {'C','o','n','t','a','c','t',0}; - static const WCHAR szARPCOMMENTS[] = - {'A','R','P','C','O','M','M','E','N','T','S',0}; - static const WCHAR szComments[] = - {'C','o','m','m','e','n','t','s',0}; - static const WCHAR szProductName[] = - {'P','r','o','d','u','c','t','N','a','m','e',0}; - static const WCHAR szDisplayName[] = - {'D','i','s','p','l','a','y','N','a','m','e',0}; - static const WCHAR szARPHELPLINK[] = - {'A','R','P','H','E','L','P','L','I','N','K',0}; - static const WCHAR szHelpLink[] = - {'H','e','l','p','L','i','n','k',0}; - static const WCHAR szARPHELPTELEPHONE[] = - {'A','R','P','H','E','L','P','T','E','L','E','P','H','O','N','E',0}; - static const WCHAR szHelpTelephone[] = - {'H','e','l','p','T','e','l','e','p','h','o','n','e',0}; - static const WCHAR szARPINSTALLLOCATION[] = - {'A','R','P','I','N','S','T','A','L','L','L','O','C','A','T','I','O','N',0}; - static const WCHAR szManufacturer[] = - {'M','a','n','u','f','a','c','t','u','r','e','r',0}; - static const WCHAR szPublisher[] = - {'P','u','b','l','i','s','h','e','r',0}; - static const WCHAR szARPREADME[] = - {'A','R','P','R','E','A','D','M','E',0}; - static const WCHAR szReadme[] = - {'R','e','a','d','M','e',0}; - static const WCHAR szARPSIZE[] = - {'A','R','P','S','I','Z','E',0}; - static const WCHAR szSize[] = - {'S','i','z','e',0}; - static const WCHAR szARPURLINFOABOUT[] = - {'A','R','P','U','R','L','I','N','F','O','A','B','O','U','T',0}; - static const WCHAR szURLInfoAbout[] = - {'U','R','L','I','n','f','o','A','b','o','u','t',0}; - static const WCHAR szARPURLUPDATEINFO[] = - {'A','R','P','U','R','L','U','P','D','A','T','E','I','N','F','O',0}; - static const WCHAR szURLUpdateInfo[] = - {'U','R','L','U','p','d','a','t','e','I','n','f','o',0}; - static const WCHAR szARPSYSTEMCOMPONENT[] = - {'A','R','P','S','Y','S','T','E','M','C','O','M','P','O','N','E','N','T',0}; - static const WCHAR szSystemComponent[] = - {'S','y','s','t','e','m','C','o','m','p','o','n','e','n','t',0}; - static const WCHAR szARPNOMODIFY[] = - {'A','R','P','N','O','M','O','D','I','F','Y',0}; - static const WCHAR szNoModify[] = - {'N','o','M','o','d','i','f','y',0}; - static const WCHAR szARPNOREMOVE[] = - {'A','R','P','N','O','R','E','M','O','V','E',0}; - static const WCHAR szNoRemove[] = - {'N','o','R','e','m','o','v','e',0}; - static const WCHAR szARPNOREPAIR[] = - {'A','R','P','N','O','R','E','P','A','I','R',0}; - static const WCHAR szNoRepair[] = - {'N','o','R','e','p','a','i','r',0}; - - static const WCHAR *propval[] = { - szARPAUTHORIZEDCDFPREFIX, szAuthorizedCDFPrefix, - szARPCONTACT, szContact, - szARPCOMMENTS, szComments, - szProductName, szDisplayName, - szARPHELPLINK, szHelpLink, - szARPHELPTELEPHONE, szHelpTelephone, - szARPINSTALLLOCATION, szInstallLocation, - szSourceDir, szInstallSource, - szManufacturer, szPublisher, - szARPREADME, szReadme, - szARPSIZE, szSize, - szARPURLINFOABOUT, szURLInfoAbout, - szARPURLUPDATEINFO, szURLUpdateInfo, + static const WCHAR *propval[] = + { + L"ARPAUTHORIZEDCDFPREFIX", L"AuthorizedCDFPrefix", + L"ARPCONTACT", L"Contact", + L"ARPCOMMENTS", L"Comments", + L"ProductName", L"DisplayName", + L"ARPHELPLINK", L"HelpLink", + L"ARPHELPTELEPHONE", L"HelpTelephone", + L"ARPINSTALLLOCATION", L"InstallLocation", + L"SourceDir", L"InstallSource", + L"Manufacturer", L"Publisher", + L"ARPREADME", L"ReadMe", + L"ARPSIZE", L"Size", + L"ARPURLINFOABOUT", L"URLInfoAbout", + L"ARPURLUPDATEINFO", L"URLUpdateInfo", NULL }; const WCHAR **p = propval; @@ -5276,55 +4924,47 @@ static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY hkey) msi_free(val); } - msi_reg_set_val_dword(hkey, szWindowsInstaller, 1); - if (msi_get_property_int( package->db, szARPSYSTEMCOMPONENT, 0 )) + msi_reg_set_val_dword(hkey, L"WindowsInstaller", 1); + if (msi_get_property_int( package->db, L"ARPSYSTEMCOMPONENT", 0 )) { - msi_reg_set_val_dword( hkey, szSystemComponent, 1 ); + msi_reg_set_val_dword( hkey, L"SystemComponent", 1 ); } - if (msi_get_property_int( package->db, szARPNOREMOVE, 0 )) - msi_reg_set_val_dword( hkey, szNoRemove, 1 ); + if (msi_get_property_int( package->db, L"ARPNOREMOVE", 0 )) + msi_reg_set_val_dword( hkey, L"NoRemove", 1 ); else { - static const WCHAR fmt_install[] = - {'M','s','i','E','x','e','c','.','e','x','e',' ', - '/','I','[','P','r','o','d','u','c','t','C','o','d','e',']',0}; - static const WCHAR fmt_uninstall[] = - {'M','s','i','E','x','e','c','.','e','x','e',' ', - '/','X','[','P','r','o','d','u','c','t','C','o','d','e',']',0}; - static const WCHAR szModifyPath[] = - {'M','o','d','i','f','y','P','a','t','h',0}; - static const WCHAR szUninstallString[] = - {'U','n','i','n','s','t','a','l','l','S','t','r','i','n','g',0}; + static const WCHAR fmt_install[] = L"MsiExec.exe /I[ProductCode]"; + static const WCHAR fmt_uninstall[] = L"MsiExec.exe /X[ProductCode]"; const WCHAR *fmt = fmt_install; - if (msi_get_property_int( package->db, szARPNOREPAIR, 0 )) - msi_reg_set_val_dword( hkey, szNoRepair, 1 ); + if (msi_get_property_int( package->db, L"ARPNOREPAIR", 0 )) + msi_reg_set_val_dword( hkey, L"NoRepair", 1 ); - if (msi_get_property_int( package->db, szARPNOMODIFY, 0 )) + if (msi_get_property_int( package->db, L"ARPNOMODIFY", 0 )) { - msi_reg_set_val_dword( hkey, szNoModify, 1 ); + msi_reg_set_val_dword( hkey, L"NoModify", 1 ); fmt = fmt_uninstall; } size = deformat_string(package, fmt, &buffer) * sizeof(WCHAR); - RegSetValueExW(hkey, szModifyPath, 0, REG_EXPAND_SZ, (LPBYTE)buffer, size); - RegSetValueExW(hkey, szUninstallString, 0, REG_EXPAND_SZ, (LPBYTE)buffer, size); + RegSetValueExW(hkey, L"ModifyPath", 0, REG_EXPAND_SZ, (LPBYTE)buffer, size); + RegSetValueExW(hkey, L"UninstallString", 0, REG_EXPAND_SZ, (LPBYTE)buffer, size); msi_free(buffer); } /* FIXME: Write real Estimated Size when we have it */ - msi_reg_set_val_dword(hkey, szEstimatedSize, 0); + msi_reg_set_val_dword(hkey, L"EstimatedSize", 0); GetLocalTime(&systime); - swprintf(date, ARRAY_SIZE(date), date_fmt, systime.wYear, systime.wMonth, systime.wDay); + swprintf(date, ARRAY_SIZE(date), L"%d%02d%02d", systime.wYear, systime.wMonth, systime.wDay); msi_reg_set_val_str(hkey, INSTALLPROPERTY_INSTALLDATEW, date); - langid = msi_get_property_int(package->db, szProductLanguage, 0); + langid = msi_get_property_int(package->db, L"ProductLanguage", 0); msi_reg_set_val_dword(hkey, INSTALLPROPERTY_LANGUAGEW, langid); - buffer = msi_dup_property(package->db, szProductVersion); - msi_reg_set_val_str(hkey, szDisplayVersion, buffer); + buffer = msi_dup_property(package->db, L"ProductVersion"); + msi_reg_set_val_str(hkey, L"DisplayVersion", buffer); if (buffer) { DWORD verdword = msi_version_str_to_dword(buffer); @@ -5346,10 +4986,10 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package) UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szRegisterProduct); + return msi_schedule_action(package, SCRIPT_INSTALL, L"RegisterProduct"); /* FIXME: also need to publish if the product is in advertise mode */ - if (!msi_get_property_int( package->db, szProductToBeRegistered, 0 ) + if (!msi_get_property_int( package->db, L"ProductToBeRegistered", 0 ) && !msi_check_publish(package)) return ERROR_SUCCESS; @@ -5369,7 +5009,7 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package) if (rc != ERROR_SUCCESS) goto done; - upgrade_code = msi_dup_property(package->db, szUpgradeCode); + upgrade_code = msi_dup_property(package->db, L"UpgradeCode"); if (upgrade_code) { rc = MSIREG_OpenUpgradeCodesKey( upgrade_code, &upgrade_key, TRUE ); @@ -5422,12 +5062,10 @@ static UINT ITERATE_UnpublishIcon( MSIRECORD *row, LPVOID param ) static UINT msi_unpublish_icons( MSIPACKAGE *package ) { - static const WCHAR query[]= { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','I','c','o','n','`',0}; MSIQUERY *view; UINT r; - r = MSI_DatabaseOpenViewW( package->db, query, &view ); + r = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `Icon`", &view ); if (r == ERROR_SUCCESS) { r = MSI_IterateRecords( view, NULL, ITERATE_UnpublishIcon, package ); @@ -5446,7 +5084,7 @@ static void remove_product_upgrade_code( MSIPACKAGE *package ) DWORD count; squash_guid( package->ProductCode, product ); - if (!(code = msi_dup_property( package->db, szUpgradeCode ))) + if (!(code = msi_dup_property( package->db, L"UpgradeCode" ))) { WARN( "upgrade code not found\n" ); return; @@ -5544,44 +5182,24 @@ static UINT ACTION_InstallFinalize(MSIPACKAGE *package) UINT ACTION_ForceReboot(MSIPACKAGE *package) { - static const WCHAR RunOnce[] = { - 'S','o','f','t','w','a','r','e','\\', - 'M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\', - 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'R','u','n','O','n','c','e',0}; - static const WCHAR InstallRunOnce[] = { - 'S','o','f','t','w','a','r','e','\\', - 'M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\', - 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'I','n','s','t','a','l','l','e','r','\\', - 'R','u','n','O','n','c','e','E','n','t','r','i','e','s',0}; - - static const WCHAR msiexec_fmt[] = { - '%','s', - '\\','M','s','i','E','x','e','c','.','e','x','e',' ','/','@',' ', - '\"','%','s','\"',0}; - static const WCHAR install_fmt[] = { - '/','I',' ','\"','%','s','\"',' ', - 'A','F','T','E','R','R','E','B','O','O','T','=','1',' ', - 'R','U','N','O','N','C','E','E','N','T','R','Y','=','\"','%','s','\"',0}; WCHAR buffer[256], sysdir[MAX_PATH], squashed_pc[SQUASHED_GUID_SIZE]; HKEY hkey; squash_guid( package->ProductCode, squashed_pc ); GetSystemDirectoryW(sysdir, ARRAY_SIZE(sysdir)); - RegCreateKeyW(HKEY_LOCAL_MACHINE,RunOnce,&hkey); - swprintf(buffer, ARRAY_SIZE(buffer), msiexec_fmt, sysdir, squashed_pc); + RegCreateKeyW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce", &hkey); + swprintf(buffer, ARRAY_SIZE(buffer), L"%s\\MsiExec.exe /@ \"%s\"", sysdir, squashed_pc); msi_reg_set_val_str( hkey, squashed_pc, buffer ); RegCloseKey(hkey); TRACE("Reboot command %s\n",debugstr_w(buffer)); - RegCreateKeyW(HKEY_LOCAL_MACHINE,InstallRunOnce,&hkey); - swprintf( buffer, ARRAY_SIZE(buffer), install_fmt, package->ProductCode, squashed_pc ); + RegCreateKeyW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\RunOnceEntries", + &hkey); + swprintf( buffer, ARRAY_SIZE(buffer), L"/I \"%s\" AFTERREBOOT=1 RUNONCEENTRY=\"%s\"", package->ProductCode, + squashed_pc ); msi_reg_set_val_str( hkey, squashed_pc, buffer ); RegCloseKey(hkey); @@ -5645,29 +5263,27 @@ static UINT ACTION_ResolveSource(MSIPACKAGE* package) static UINT ACTION_RegisterUser(MSIPACKAGE *package) { - HKEY hkey = 0; - LPWSTR buffer, productid = NULL; - UINT i, rc = ERROR_SUCCESS; - MSIRECORD *uirow; - - static const WCHAR szPropKeys[][80] = + static const WCHAR szPropKeys[][80] = { - {'P','r','o','d','u','c','t','I','D',0}, - {'U','S','E','R','N','A','M','E',0}, - {'C','O','M','P','A','N','Y','N','A','M','E',0}, + L"ProductID", + L"USERNAME", + L"COMPANYNAME", {0}, }; - - static const WCHAR szRegKeys[][80] = + static const WCHAR szRegKeys[][80] = { - {'P','r','o','d','u','c','t','I','D',0}, - {'R','e','g','O','w','n','e','r',0}, - {'R','e','g','C','o','m','p','a','n','y',0}, + L"ProductID", + L"RegOwner", + L"RegCompany", {0}, }; + HKEY hkey = 0; + LPWSTR buffer, productid = NULL; + UINT i, rc = ERROR_SUCCESS; + MSIRECORD *uirow; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szRegisterUser); + return msi_schedule_action(package, SCRIPT_INSTALL, L"RegisterUser"); if (msi_check_unpublish(package)) { @@ -5704,13 +5320,11 @@ end: static UINT iterate_properties(MSIRECORD *record, void *param) { - static const WCHAR prop_template[] = - {'P','r','o','p','e','r','t','y','(','S',')',':',' ','[','1',']',' ','=',' ','[','2',']',0}; MSIRECORD *uirow; uirow = MSI_CloneRecord(record); if (!uirow) return ERROR_OUTOFMEMORY; - MSI_RecordSetStringW(uirow, 0, prop_template); + MSI_RecordSetStringW(uirow, 0, L"Property(S): [1] = [2]"); MSI_ProcessMessage(param, INSTALLMESSAGE_INFO|MB_ICONHAND, uirow); msiobj_release(&uirow->hdr); @@ -5720,8 +5334,6 @@ static UINT iterate_properties(MSIRECORD *record, void *param) static UINT ACTION_ExecuteAction(MSIPACKAGE *package) { - static const WCHAR prop_query[] = - {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','_','P','r','o','p','e','r','t','y','`',0}; WCHAR *productname; WCHAR *action; WCHAR *info_template; @@ -5767,15 +5379,15 @@ static UINT ACTION_ExecuteAction(MSIPACKAGE *package) package->LastActionResult = MSI_NULL_INTEGER; - action = msi_dup_property(package->db, szEXECUTEACTION); - if (!action) action = msi_strdupW(szINSTALL, lstrlenW(szINSTALL)); + action = msi_dup_property(package->db, L"EXECUTEACTION"); + if (!action) action = msi_strdupW(L"INSTALL", ARRAY_SIZE(L"INSTALL") - 1); /* Perform the action. Top-level actions trigger a sequence. */ - if (!wcscmp(action, szINSTALL)) + if (!wcscmp(action, L"INSTALL")) { /* Send ACTIONSTART/INFO and INSTALLSTART. */ - ui_actionstart(package, szINSTALL, NULL, NULL); - ui_actioninfo(package, szINSTALL, TRUE, 0); + ui_actionstart(package, L"INSTALL", NULL, NULL); + ui_actioninfo(package, L"INSTALL", TRUE, 0); uirow = MSI_CreateRecord(2); if (!uirow) { @@ -5793,7 +5405,7 @@ static UINT ACTION_ExecuteAction(MSIPACKAGE *package) rc = ACTION_ProcessExecSequence(package); /* Send return value and INSTALLEND. */ - ui_actioninfo(package, szINSTALL, FALSE, !rc); + ui_actioninfo(package, L"INSTALL", FALSE, !rc); uirow = MSI_CreateRecord(3); if (!uirow) { @@ -5811,7 +5423,7 @@ static UINT ACTION_ExecuteAction(MSIPACKAGE *package) rc = ACTION_PerformAction(package, action); /* Send all set properties. */ - if (!MSI_OpenQuery(package->db, &view, prop_query)) + if (!MSI_OpenQuery(package->db, &view, L"SELECT * FROM `_Property`")) { MSI_IterateRecords(view, NULL, iterate_properties, package); msiobj_release(&view->hdr); @@ -5840,7 +5452,7 @@ end: static UINT ACTION_INSTALL(MSIPACKAGE *package) { - msi_set_property(package->db, szEXECUTEACTION, szINSTALL, -1); + msi_set_property(package->db, L"EXECUTEACTION", L"INSTALL", -1); if (needs_ui_sequence(package) && ui_sequence_exists(package)) { package->InWhatSequence |= SEQUENCE_UI; @@ -5852,7 +5464,6 @@ static UINT ACTION_INSTALL(MSIPACKAGE *package) WCHAR *msi_create_component_advertise_string( MSIPACKAGE *package, MSICOMPONENT *component, const WCHAR *feature ) { - static const WCHAR fmt[] = {'%','s','%','s','%','c','%','s',0}; WCHAR productid_85[21], component_85[21], *ret; GUID clsid; DWORD sz; @@ -5875,7 +5486,7 @@ WCHAR *msi_create_component_advertise_string( MSIPACKAGE *package, MSICOMPONENT sz = 20 + lstrlenW( feature ) + 20 + 3; ret = msi_alloc_zero( sz * sizeof(WCHAR) ); - if (ret) swprintf( ret, sz, fmt, productid_85, feature, component ? '>' : '<', component_85 ); + if (ret) swprintf( ret, sz, L"%s%s%c%s", productid_85, feature, component ? '>' : '<', component_85 ); return ret; } @@ -5985,16 +5596,13 @@ end: */ static UINT ACTION_PublishComponents(MSIPACKAGE *package) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','P','u','b','l','i','s','h','C','o','m','p','o','n','e','n','t','`',0}; MSIQUERY *view; UINT rc; - + if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szPublishComponents); + return msi_schedule_action(package, SCRIPT_INSTALL, L"PublishComponents"); - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `PublishComponent`", &view); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -6005,12 +5613,6 @@ static UINT ACTION_PublishComponents(MSIPACKAGE *package) static UINT ITERATE_UnpublishComponent( MSIRECORD *rec, LPVOID param ) { - static const WCHAR szInstallerComponents[] = { - 'S','o','f','t','w','a','r','e','\\', - 'M','i','c','r','o','s','o','f','t','\\', - 'I','n','s','t','a','l','l','e','r','\\', - 'C','o','m','p','o','n','e','n','t','s','\\',0}; - MSIPACKAGE *package = param; LPCWSTR compgroupid, component, feature, qualifier; MSICOMPONENT *comp; @@ -6040,7 +5642,7 @@ static UINT ITERATE_UnpublishComponent( MSIRECORD *rec, LPVOID param ) qualifier = MSI_RecordGetString( rec, 2 ); squash_guid( compgroupid, squashed ); - lstrcpyW( keypath, szInstallerComponents ); + lstrcpyW( keypath, L"Software\\Microsoft\\Installer\\Components\\" ); lstrcatW( keypath, squashed ); res = RegDeleteKeyW( HKEY_CURRENT_USER, keypath ); @@ -6060,16 +5662,13 @@ static UINT ITERATE_UnpublishComponent( MSIRECORD *rec, LPVOID param ) static UINT ACTION_UnpublishComponents( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','P','u','b','l','i','s','h','C','o','m','p','o','n','e','n','t','`',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szUnpublishComponents); + return msi_schedule_action(package, SCRIPT_INSTALL, L"UnpublishComponents"); - rc = MSI_DatabaseOpenViewW( package->db, query, &view ); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `PublishComponent`", &view ); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -6080,10 +5679,6 @@ static UINT ACTION_UnpublishComponents( MSIPACKAGE *package ) static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param) { - static const WCHAR query[] = - {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','C','o','m','p','o','n','e','n','t','`',' ','W','H','E','R','E',' ', - '`','C','o','m','p','o','n','e','n','t','`',' ','=','\'','%','s','\'',0}; MSIPACKAGE *package = param; MSICOMPONENT *component; MSIRECORD *row; @@ -6140,7 +5735,7 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param) err_control &= ~msidbServiceInstallErrorControlVital; /* fetch the service path */ - row = MSI_QueryGetRecord(package->db, query, comp); + row = MSI_QueryGetRecord(package->db, L"SELECT * FROM `Component` WHERE `Component` = '%s'", comp); if (!row) { ERR("Query failed\n"); @@ -6170,7 +5765,7 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param) } lstrcpyW(image_path, file->TargetPath); - lstrcatW(image_path, szSpace); + lstrcatW(image_path, L" "); lstrcatW(image_path, args); } service = CreateServiceW(hscm, name, disp, GENERIC_ALL, serv_type, @@ -6211,16 +5806,13 @@ done: static UINT ACTION_InstallServices( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'S','e','r','v','i','c','e','I','n','s','t','a','l','l',0}; MSIQUERY *view; UINT rc; - + if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szInstallServices); + return msi_schedule_action(package, SCRIPT_INSTALL, L"InstallServices"); - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `ServiceInstall`", &view); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -6236,10 +5828,8 @@ static LPCWSTR *msi_service_args_to_vector(LPWSTR args, DWORD *numargs) LPWSTR p, q; DWORD sep_len; - static const WCHAR separator[] = {'[','~',']',0}; - *numargs = 0; - sep_len = ARRAY_SIZE(separator) - 1; + sep_len = ARRAY_SIZE(L"[~]") - 1; if (!args) return NULL; @@ -6254,7 +5844,7 @@ static LPCWSTR *msi_service_args_to_vector(LPWSTR args, DWORD *numargs) (*numargs)++; vector[*numargs - 1] = p; - if ((q = wcsstr(p, separator))) + if ((q = wcsstr(p, L"[~]"))) { *q = '\0'; @@ -6385,16 +5975,13 @@ done: static UINT ACTION_StartServices( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'S','e','r','v','i','c','e','C','o','n','t','r','o','l',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szStartServices); + return msi_schedule_action(package, SCRIPT_INSTALL, L"StartServices"); - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `ServiceControl`", &view); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -6551,16 +6138,13 @@ done: static UINT ACTION_StopServices( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'S','e','r','v','i','c','e','C','o','n','t','r','o','l',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szStopServices); + return msi_schedule_action(package, SCRIPT_INSTALL, L"StopServices"); - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `ServiceControl`", &view); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -6637,16 +6221,13 @@ done: static UINT ACTION_DeleteServices( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'S','e','r','v','i','c','e','C','o','n','t','r','o','l',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szDeleteServices); + return msi_schedule_action(package, SCRIPT_INSTALL, L"DeleteServices"); - rc = MSI_DatabaseOpenViewW( package->db, query, &view ); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `ServiceControl`", &view ); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -6667,13 +6248,6 @@ static UINT ITERATE_InstallODBCDriver( MSIRECORD *rec, LPVOID param ) DWORD len, usage; UINT r = ERROR_SUCCESS; - static const WCHAR driver_fmt[] = { - 'D','r','i','v','e','r','=','%','s',0}; - static const WCHAR setup_fmt[] = { - 'S','e','t','u','p','=','%','s',0}; - static const WCHAR usage_fmt[] = { - 'F','i','l','e','U','s','a','g','e','=','1',0}; - component = MSI_RecordGetString( rec, 2 ); comp = msi_get_loaded_component( package, component ); if (!comp) @@ -6699,10 +6273,10 @@ static UINT ITERATE_InstallODBCDriver( MSIRECORD *rec, LPVOID param ) return ERROR_FUNCTION_FAILED; } - len = lstrlenW(desc) + lstrlenW(driver_fmt) + lstrlenW(driver_file->FileName); + len = lstrlenW(desc) + lstrlenW(L"Driver=%s") + lstrlenW(driver_file->FileName); if (setup_file) - len += lstrlenW(setup_fmt) + lstrlenW(setup_file->FileName); - len += lstrlenW(usage_fmt) + 2; /* \0\0 */ + len += lstrlenW(L"Setup=%s") + lstrlenW(setup_file->FileName); + len += lstrlenW(L"FileUsage=1") + 2; /* \0\0 */ driver = msi_alloc(len * sizeof(WCHAR)); if (!driver) @@ -6712,16 +6286,16 @@ static UINT ITERATE_InstallODBCDriver( MSIRECORD *rec, LPVOID param ) lstrcpyW(ptr, desc); ptr += lstrlenW(ptr) + 1; - len = swprintf(ptr, len - (ptr - driver), driver_fmt, driver_file->FileName); + len = swprintf(ptr, len - (ptr - driver), L"Driver=%s", driver_file->FileName); ptr += len + 1; if (setup_file) { - len = swprintf(ptr, len - (ptr - driver), setup_fmt, setup_file->FileName); + len = swprintf(ptr, len - (ptr - driver), L"Setup=%s", setup_file->FileName); ptr += len + 1; } - lstrcpyW(ptr, usage_fmt); + lstrcpyW(ptr, L"FileUsage=1"); ptr += lstrlenW(ptr) + 1; *ptr = '\0'; @@ -6766,11 +6340,6 @@ static UINT ITERATE_InstallODBCTranslator( MSIRECORD *rec, LPVOID param ) DWORD len, usage; UINT r = ERROR_SUCCESS; - static const WCHAR translator_fmt[] = { - 'T','r','a','n','s','l','a','t','o','r','=','%','s',0}; - static const WCHAR setup_fmt[] = { - 'S','e','t','u','p','=','%','s',0}; - component = MSI_RecordGetString( rec, 2 ); comp = msi_get_loaded_component( package, component ); if (!comp) @@ -6796,9 +6365,9 @@ static UINT ITERATE_InstallODBCTranslator( MSIRECORD *rec, LPVOID param ) return ERROR_FUNCTION_FAILED; } - len = lstrlenW(desc) + lstrlenW(translator_fmt) + lstrlenW(translator_file->FileName) + 2; /* \0\0 */ + len = lstrlenW(desc) + lstrlenW(L"Translator=%s") + lstrlenW(translator_file->FileName) + 2; /* \0\0 */ if (setup_file) - len += lstrlenW(setup_fmt) + lstrlenW(setup_file->FileName); + len += lstrlenW(L"Setup=%s") + lstrlenW(setup_file->FileName); translator = msi_alloc(len * sizeof(WCHAR)); if (!translator) @@ -6808,12 +6377,12 @@ static UINT ITERATE_InstallODBCTranslator( MSIRECORD *rec, LPVOID param ) lstrcpyW(ptr, desc); ptr += lstrlenW(ptr) + 1; - len = swprintf(ptr, len - (ptr - translator), translator_fmt, translator_file->FileName); + len = swprintf(ptr, len - (ptr - translator), L"Translator=%s", translator_file->FileName); ptr += len + 1; if (setup_file) { - len = swprintf(ptr, len - (ptr - translator), setup_fmt, setup_file->FileName); + len = swprintf(ptr, len - (ptr - translator), L"Setup=%s", setup_file->FileName); ptr += len + 1; } *ptr = '\0'; @@ -6854,9 +6423,6 @@ static UINT ITERATE_InstallODBCDataSource( MSIRECORD *rec, LPVOID param ) UINT r = ERROR_SUCCESS; MSIRECORD *uirow; - static const WCHAR attrs_fmt[] = { - 'D','S','N','=','%','s',0 }; - component = MSI_RecordGetString( rec, 2 ); comp = msi_get_loaded_component( package, component ); if (!comp) @@ -6876,12 +6442,12 @@ static UINT ITERATE_InstallODBCDataSource( MSIRECORD *rec, LPVOID param ) if (registration == msidbODBCDataSourceRegistrationPerMachine) request = ODBC_ADD_SYS_DSN; else if (registration == msidbODBCDataSourceRegistrationPerUser) request = ODBC_ADD_DSN; - len = lstrlenW(attrs_fmt) + lstrlenW(desc) + 2; /* \0\0 */ + len = lstrlenW(L"DSN=%s") + lstrlenW(desc) + 2; /* \0\0 */ attrs = msi_alloc(len * sizeof(WCHAR)); if (!attrs) return ERROR_OUTOFMEMORY; - len = swprintf(attrs, len, attrs_fmt, desc); + len = swprintf(attrs, len, L"DSN=%s", desc); attrs[len + 1] = 0; if (!SQLConfigDataSourceW(NULL, request, driver, attrs)) @@ -6901,22 +6467,13 @@ static UINT ITERATE_InstallODBCDataSource( MSIRECORD *rec, LPVOID param ) static UINT ACTION_InstallODBC( MSIPACKAGE *package ) { - static const WCHAR driver_query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'O','D','B','C','D','r','i','v','e','r',0}; - static const WCHAR translator_query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'O','D','B','C','T','r','a','n','s','l','a','t','o','r',0}; - static const WCHAR source_query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'O','D','B','C','D','a','t','a','S','o','u','r','c','e',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szInstallODBC); + return msi_schedule_action(package, SCRIPT_INSTALL, L"InstallODBC"); - rc = MSI_DatabaseOpenViewW(package->db, driver_query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `ODBCDriver`", &view); if (rc == ERROR_SUCCESS) { rc = MSI_IterateRecords(view, NULL, ITERATE_InstallODBCDriver, package); @@ -6924,7 +6481,7 @@ static UINT ACTION_InstallODBC( MSIPACKAGE *package ) if (rc != ERROR_SUCCESS) return rc; } - rc = MSI_DatabaseOpenViewW(package->db, translator_query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `ODBCTranslator`", &view); if (rc == ERROR_SUCCESS) { rc = MSI_IterateRecords(view, NULL, ITERATE_InstallODBCTranslator, package); @@ -6932,7 +6489,7 @@ static UINT ACTION_InstallODBC( MSIPACKAGE *package ) if (rc != ERROR_SUCCESS) return rc; } - rc = MSI_DatabaseOpenViewW(package->db, source_query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `ODBCDataSource`", &view); if (rc == ERROR_SUCCESS) { rc = MSI_IterateRecords(view, NULL, ITERATE_InstallODBCDataSource, package); @@ -7032,9 +6589,6 @@ static UINT ITERATE_RemoveODBCDataSource( MSIRECORD *rec, LPVOID param ) INT registration; DWORD len; - static const WCHAR attrs_fmt[] = { - 'D','S','N','=','%','s',0 }; - component = MSI_RecordGetString( rec, 2 ); comp = msi_get_loaded_component( package, component ); if (!comp) @@ -7054,14 +6608,14 @@ static UINT ITERATE_RemoveODBCDataSource( MSIRECORD *rec, LPVOID param ) if (registration == msidbODBCDataSourceRegistrationPerMachine) request = ODBC_REMOVE_SYS_DSN; else if (registration == msidbODBCDataSourceRegistrationPerUser) request = ODBC_REMOVE_DSN; - len = lstrlenW( attrs_fmt ) + lstrlenW( desc ) + 2; /* \0\0 */ + len = lstrlenW( L"DSN=%s" ) + lstrlenW( desc ) + 2; /* \0\0 */ attrs = msi_alloc( len * sizeof(WCHAR) ); if (!attrs) return ERROR_OUTOFMEMORY; FIXME("Use ODBCSourceAttribute table\n"); - len = swprintf( attrs, len, attrs_fmt, desc ); + len = swprintf( attrs, len, L"DSN=%s", desc ); attrs[len + 1] = 0; if (!SQLConfigDataSourceW( NULL, request, driver, attrs )) @@ -7082,22 +6636,13 @@ static UINT ITERATE_RemoveODBCDataSource( MSIRECORD *rec, LPVOID param ) static UINT ACTION_RemoveODBC( MSIPACKAGE *package ) { - static const WCHAR driver_query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'O','D','B','C','D','r','i','v','e','r',0}; - static const WCHAR translator_query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'O','D','B','C','T','r','a','n','s','l','a','t','o','r',0}; - static const WCHAR source_query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'O','D','B','C','D','a','t','a','S','o','u','r','c','e',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szRemoveODBC); + return msi_schedule_action(package, SCRIPT_INSTALL, L"RemoveODBC"); - rc = MSI_DatabaseOpenViewW( package->db, driver_query, &view ); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `ODBCDriver`", &view ); if (rc == ERROR_SUCCESS) { rc = MSI_IterateRecords( view, NULL, ITERATE_RemoveODBCDriver, package ); @@ -7105,7 +6650,7 @@ static UINT ACTION_RemoveODBC( MSIPACKAGE *package ) if (rc != ERROR_SUCCESS) return rc; } - rc = MSI_DatabaseOpenViewW( package->db, translator_query, &view ); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `ODBCTranslator`", &view ); if (rc == ERROR_SUCCESS) { rc = MSI_IterateRecords( view, NULL, ITERATE_RemoveODBCTranslator, package ); @@ -7113,7 +6658,7 @@ static UINT ACTION_RemoveODBC( MSIPACKAGE *package ) if (rc != ERROR_SUCCESS) return rc; } - rc = MSI_DatabaseOpenViewW( package->db, source_query, &view ); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `ODBCDataSource`", &view ); if (rc == ERROR_SUCCESS) { rc = MSI_IterateRecords( view, NULL, ITERATE_RemoveODBCDataSource, package ); @@ -7138,10 +6683,7 @@ static UINT ACTION_RemoveODBC( MSIPACKAGE *package ) static UINT env_parse_flags( LPCWSTR *name, LPCWSTR *value, DWORD *flags ) { - LPCWSTR cptr = *name; - - static const WCHAR prefix[] = {'[','~',']',0}; - static const int prefix_len = 3; + const WCHAR *cptr = *name; *flags = 0; while (*cptr) @@ -7172,24 +6714,24 @@ static UINT env_parse_flags( LPCWSTR *name, LPCWSTR *value, DWORD *flags ) if (*value) { LPCWSTR ptr = *value; - if (!wcsncmp(ptr, prefix, prefix_len)) + if (!wcsncmp(ptr, L"[~]", 3)) { - if (ptr[prefix_len] == szSemiColon[0]) + if (ptr[3] == ';') { *flags |= ENV_MOD_APPEND; - *value += lstrlenW(prefix); + *value += 3; } else { *value = NULL; } } - else if (lstrlenW(*value) >= prefix_len) + else if (lstrlenW(*value) >= 3) { - ptr += lstrlenW(ptr) - prefix_len; - if (!wcscmp( ptr, prefix )) + ptr += lstrlenW(ptr) - 3; + if (!wcscmp( ptr, L"[~]" )) { - if ((ptr-1) > *value && *(ptr-1) == szSemiColon[0]) + if ((ptr-1) > *value && *(ptr-1) == ';') { *flags |= ENV_MOD_PREFIX; /* the "[~]" will be removed by deformat_string */; @@ -7219,26 +6761,18 @@ static UINT env_parse_flags( LPCWSTR *name, LPCWSTR *value, DWORD *flags ) static UINT open_env_key( DWORD flags, HKEY *key ) { - static const WCHAR user_env[] = - {'E','n','v','i','r','o','n','m','e','n','t',0}; - static const WCHAR machine_env[] = - {'S','y','s','t','e','m','\\', - 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', - 'C','o','n','t','r','o','l','\\', - 'S','e','s','s','i','o','n',' ','M','a','n','a','g','e','r','\\', - 'E','n','v','i','r','o','n','m','e','n','t',0}; const WCHAR *env; HKEY root; LONG res; if (flags & ENV_MOD_MACHINE) { - env = machine_env; + env = L"System\\CurrentControlSet\\Control\\Session Manager\\Environment"; root = HKEY_LOCAL_MACHINE; } else { - env = user_env; + env = L"Environment"; root = HKEY_CURRENT_USER; } @@ -7437,16 +6971,13 @@ done: static UINT ACTION_WriteEnvironmentStrings( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','E','n','v','i','r','o','n','m','e','n','t','`',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szWriteEnvironmentStrings); + return msi_schedule_action(package, SCRIPT_INSTALL, L"WriteEnvironmentStrings"); - rc = MSI_DatabaseOpenViewW(package->db, query, &view); + rc = MSI_DatabaseOpenViewW(package->db, L"SELECT * FROM `Environment`", &view); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -7582,16 +7113,13 @@ done: static UINT ACTION_RemoveEnvironmentStrings( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','E','n','v','i','r','o','n','m','e','n','t','`',0}; MSIQUERY *view; UINT rc; if (package->script == SCRIPT_NONE) - return msi_schedule_action(package, SCRIPT_INSTALL, szRemoveEnvironmentStrings); + return msi_schedule_action(package, SCRIPT_INSTALL, L"RemoveEnvironmentStrings"); - rc = MSI_DatabaseOpenViewW( package->db, query, &view ); + rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `Environment`", &view ); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -7605,21 +7133,21 @@ UINT msi_validate_product_id( MSIPACKAGE *package ) LPWSTR key, template, id; UINT r = ERROR_SUCCESS; - id = msi_dup_property( package->db, szProductID ); + id = msi_dup_property( package->db, L"ProductID" ); if (id) { msi_free( id ); return ERROR_SUCCESS; } - template = msi_dup_property( package->db, szPIDTemplate ); - key = msi_dup_property( package->db, szPIDKEY ); + template = msi_dup_property( package->db, L"PIDTemplate" ); + key = msi_dup_property( package->db, L"PIDKEY" ); if (key && template) { FIXME( "partial stub: template %s key %s\n", debugstr_w(template), debugstr_w(key) ); #ifdef __REACTOS__ WARN("Product key validation HACK, see CORE-14710\n"); #else - r = msi_set_property( package->db, szProductID, key, -1 ); + r = msi_set_property( package->db, L"ProductID", key, -1 ); #endif } msi_free( template ); @@ -7641,10 +7169,8 @@ static UINT ACTION_ScheduleReboot( MSIPACKAGE *package ) static UINT ACTION_AllocateRegistrySpace( MSIPACKAGE *package ) { - static const WCHAR szAvailableFreeReg[] = - {'A','V','A','I','L','A','B','L','E','F','R','E','E','R','E','G',0}; MSIRECORD *uirow; - int space = msi_get_property_int( package->db, szAvailableFreeReg, 0 ); + int space = msi_get_property_int( package->db, L"AVAILABLEFREEREG", 0 ); TRACE("%p %d kilobytes\n", package, space); @@ -7660,7 +7186,7 @@ static UINT ACTION_DisableRollback( MSIPACKAGE *package ) { TRACE("%p\n", package); - msi_set_property( package->db, szRollbackDisabled, szOne, -1 ); + msi_set_property( package->db, L"RollbackDisabled", L"1", -1 ); return ERROR_SUCCESS; } @@ -7672,16 +7198,10 @@ static UINT ACTION_InstallAdminPackage( MSIPACKAGE *package ) static UINT ACTION_SetODBCFolders( MSIPACKAGE *package ) { - static const WCHAR driver_query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'O','D','B','C','D','r','i','v','e','r',0}; - static const WCHAR translator_query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'O','D','B','C','T','r','a','n','s','l','a','t','o','r',0}; MSIQUERY *view; UINT r, count; - r = MSI_DatabaseOpenViewW( package->db, driver_query, &view ); + r = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `ODBCDriver`", &view ); if (r == ERROR_SUCCESS) { count = 0; @@ -7691,7 +7211,7 @@ static UINT ACTION_SetODBCFolders( MSIPACKAGE *package ) return r; if (count) FIXME("ignored %u rows in ODBCDriver table\n", count); } - r = MSI_DatabaseOpenViewW( package->db, translator_query, &view ); + r = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `ODBCTranslator`", &view ); if (r == ERROR_SUCCESS) { count = 0; @@ -7706,13 +7226,10 @@ static UINT ACTION_SetODBCFolders( MSIPACKAGE *package ) static UINT ITERATE_RemoveExistingProducts( MSIRECORD *rec, LPVOID param ) { - static const WCHAR fmtW[] = - {'m','s','i','e','x','e','c',' ','/','q','n',' ','/','i',' ','%','s',' ', - 'R','E','M','O','V','E','=','%','s',0}; MSIPACKAGE *package = param; const WCHAR *property = MSI_RecordGetString( rec, 7 ); int attrs = MSI_RecordGetInteger( rec, 5 ); - UINT len = ARRAY_SIZE( fmtW ); + UINT len = ARRAY_SIZE( L"msiexec /qn /i %s REMOVE=%s" ); WCHAR *product, *features, *cmd; STARTUPINFOW si; PROCESS_INFORMATION info; @@ -7727,7 +7244,7 @@ static UINT ITERATE_RemoveExistingProducts( MSIRECORD *rec, LPVOID param ) if (features) len += lstrlenW( features ); else - len += ARRAY_SIZE( szAll ); + len += ARRAY_SIZE( L"ALL" ); if (!(cmd = msi_alloc( len * sizeof(WCHAR) ))) { @@ -7735,7 +7252,7 @@ static UINT ITERATE_RemoveExistingProducts( MSIRECORD *rec, LPVOID param ) msi_free( features ); return ERROR_OUTOFMEMORY; } - swprintf( cmd, len, fmtW, product, features ? features : szAll ); + swprintf( cmd, len, L"msiexec /qn /i %s REMOVE=%s", product, features ? features : L"ALL" ); msi_free( product ); msi_free( features ); @@ -7752,12 +7269,10 @@ static UINT ITERATE_RemoveExistingProducts( MSIRECORD *rec, LPVOID param ) static UINT ACTION_RemoveExistingProducts( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','U','p','g','r','a','d','e',0}; MSIQUERY *view; UINT r; - r = MSI_DatabaseOpenViewW( package->db, query, &view ); + r = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `Upgrade`", &view ); if (r == ERROR_SUCCESS) { r = MSI_IterateRecords( view, NULL, ITERATE_RemoveExistingProducts, package ); @@ -7805,23 +7320,20 @@ static UINT ITERATE_MigrateFeatureStates( MSIRECORD *rec, LPVOID param ) static UINT ACTION_MigrateFeatureStates( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'U','p','g','r','a','d','e',0}; MSIQUERY *view; UINT r; - if (msi_get_property_int( package->db, szInstalled, 0 )) + if (msi_get_property_int( package->db, L"Installed", 0 )) { TRACE("product is installed, skipping action\n"); return ERROR_SUCCESS; } - if (msi_get_property_int( package->db, szPreselected, 0 )) + if (msi_get_property_int( package->db, L"Preselected", 0 )) { TRACE("Preselected property is set, not migrating feature states\n"); return ERROR_SUCCESS; } - r = MSI_DatabaseOpenViewW( package->db, query, &view ); + r = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `Upgrade`", &view ); if (r == ERROR_SUCCESS) { r = MSI_IterateRecords( view, NULL, ITERATE_MigrateFeatureStates, package ); @@ -7889,13 +7401,10 @@ static UINT ITERATE_BindImage( MSIRECORD *rec, LPVOID param ) static UINT ACTION_BindImage( MSIPACKAGE *package ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - 'B','i','n','d','I','m','a','g','e',0}; MSIQUERY *view; UINT r; - r = MSI_DatabaseOpenViewW( package->db, query, &view ); + r = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `BindImage`", &view ); if (r == ERROR_SUCCESS) { MSI_IterateRecords( view, NULL, ITERATE_BindImage, package ); @@ -7906,13 +7415,11 @@ static UINT ACTION_BindImage( MSIPACKAGE *package ) static UINT msi_unimplemented_action_stub( MSIPACKAGE *package, LPCSTR action, LPCWSTR table ) { - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','%','s','`',0}; MSIQUERY *view; DWORD count = 0; UINT r; - - r = MSI_OpenQuery( package->db, &view, query, table ); + + r = MSI_OpenQuery( package->db, &view, L"SELECT * FROM `%s`", table ); if (r == ERROR_SUCCESS) { r = MSI_IterateRecords(view, &count, NULL, package); @@ -7926,33 +7433,27 @@ static UINT msi_unimplemented_action_stub( MSIPACKAGE *package, LPCSTR action, L static UINT ACTION_IsolateComponents( MSIPACKAGE *package ) { - static const WCHAR table[] = { - 'I','s','o','l','a','t','e','d','C','o','m','p','o','n','e','n','t',0 }; - return msi_unimplemented_action_stub( package, "IsolateComponents", table ); + return msi_unimplemented_action_stub( package, "IsolateComponents", L"IsolateComponent" ); } static UINT ACTION_RMCCPSearch( MSIPACKAGE *package ) { - static const WCHAR table[] = { 'C','C','P','S','e','a','r','c','h',0 }; - return msi_unimplemented_action_stub( package, "RMCCPSearch", table ); + return msi_unimplemented_action_stub( package, "RMCCPSearch", L"CCPSearch" ); } static UINT ACTION_RegisterComPlus( MSIPACKAGE *package ) { - static const WCHAR table[] = { 'C','o','m','p','l','u','s',0 }; - return msi_unimplemented_action_stub( package, "RegisterComPlus", table ); + return msi_unimplemented_action_stub( package, "RegisterComPlus", L"Complus" ); } static UINT ACTION_UnregisterComPlus( MSIPACKAGE *package ) { - static const WCHAR table[] = { 'C','o','m','p','l','u','s',0 }; - return msi_unimplemented_action_stub( package, "UnregisterComPlus", table ); + return msi_unimplemented_action_stub( package, "UnregisterComPlus", L"Complus" ); } static UINT ACTION_InstallSFPCatalogFile( MSIPACKAGE *package ) { - static const WCHAR table[] = { 'S','F','P','C','a','t','a','l','o','g',0 }; - return msi_unimplemented_action_stub( package, "InstallSFPCatalogFile", table ); + return msi_unimplemented_action_stub( package, "InstallSFPCatalogFile", L"SFPCatalog" ); } static const struct @@ -7965,83 +7466,83 @@ static const struct } StandardActions[] = { - { szAllocateRegistrySpace, IDS_DESC_ALLOCATEREGISTRYSPACE, IDS_TEMP_ALLOCATEREGISTRYSPACE, ACTION_AllocateRegistrySpace, NULL }, - { szAppSearch, IDS_DESC_APPSEARCH, IDS_TEMP_APPSEARCH, ACTION_AppSearch, NULL }, - { szBindImage, IDS_DESC_BINDIMAGE, IDS_TEMP_BINDIMAGE, ACTION_BindImage, NULL }, - { szCCPSearch, IDS_DESC_CCPSEARCH, 0, ACTION_CCPSearch, NULL }, - { szCostFinalize, IDS_DESC_COSTFINALIZE, 0, ACTION_CostFinalize, NULL }, - { szCostInitialize, IDS_DESC_COSTINITIALIZE, 0, ACTION_CostInitialize, NULL }, - { szCreateFolders, IDS_DESC_CREATEFOLDERS, IDS_TEMP_CREATEFOLDERS, ACTION_CreateFolders, szRemoveFolders }, - { szCreateShortcuts, IDS_DESC_CREATESHORTCUTS, IDS_TEMP_CREATESHORTCUTS, ACTION_CreateShortcuts, szRemoveShortcuts }, - { szDeleteServices, IDS_DESC_DELETESERVICES, IDS_TEMP_DELETESERVICES, ACTION_DeleteServices, szInstallServices }, - { szDisableRollback, 0, 0, ACTION_DisableRollback, NULL }, - { szDuplicateFiles, IDS_DESC_DUPLICATEFILES, IDS_TEMP_DUPLICATEFILES, ACTION_DuplicateFiles, szRemoveDuplicateFiles }, - { szExecuteAction, 0, 0, ACTION_ExecuteAction, NULL }, - { szFileCost, IDS_DESC_FILECOST, 0, ACTION_FileCost, NULL }, - { szFindRelatedProducts, IDS_DESC_FINDRELATEDPRODUCTS, IDS_TEMP_FINDRELATEDPRODUCTS, ACTION_FindRelatedProducts, NULL }, - { szForceReboot, 0, 0, ACTION_ForceReboot, NULL }, - { szInstallAdminPackage, IDS_DESC_INSTALLADMINPACKAGE, IDS_TEMP_INSTALLADMINPACKAGE, ACTION_InstallAdminPackage, NULL }, - { szInstallExecute, 0, 0, ACTION_InstallExecute, NULL }, - { szInstallExecuteAgain, 0, 0, ACTION_InstallExecute, NULL }, - { szInstallFiles, IDS_DESC_INSTALLFILES, IDS_TEMP_INSTALLFILES, ACTION_InstallFiles, szRemoveFiles }, - { szInstallFinalize, 0, 0, ACTION_InstallFinalize, NULL }, - { szInstallInitialize, 0, 0, ACTION_InstallInitialize, NULL }, - { szInstallODBC, IDS_DESC_INSTALLODBC, 0, ACTION_InstallODBC, szRemoveODBC }, - { szInstallServices, IDS_DESC_INSTALLSERVICES, IDS_TEMP_INSTALLSERVICES, ACTION_InstallServices, szDeleteServices }, - { szInstallSFPCatalogFile, IDS_DESC_INSTALLSFPCATALOGFILE, IDS_TEMP_INSTALLSFPCATALOGFILE, ACTION_InstallSFPCatalogFile, NULL }, - { szInstallValidate, IDS_DESC_INSTALLVALIDATE, 0, ACTION_InstallValidate, NULL }, - { szIsolateComponents, 0, 0, ACTION_IsolateComponents, NULL }, - { szLaunchConditions, IDS_DESC_LAUNCHCONDITIONS, 0, ACTION_LaunchConditions, NULL }, - { szMigrateFeatureStates, IDS_DESC_MIGRATEFEATURESTATES, IDS_TEMP_MIGRATEFEATURESTATES, ACTION_MigrateFeatureStates, NULL }, - { szMoveFiles, IDS_DESC_MOVEFILES, IDS_TEMP_MOVEFILES, ACTION_MoveFiles, NULL }, - { szMsiPublishAssemblies, IDS_DESC_MSIPUBLISHASSEMBLIES, IDS_TEMP_MSIPUBLISHASSEMBLIES, ACTION_MsiPublishAssemblies, szMsiUnpublishAssemblies }, - { szMsiUnpublishAssemblies, IDS_DESC_MSIUNPUBLISHASSEMBLIES, IDS_TEMP_MSIUNPUBLISHASSEMBLIES, ACTION_MsiUnpublishAssemblies, szMsiPublishAssemblies }, - { szPatchFiles, IDS_DESC_PATCHFILES, IDS_TEMP_PATCHFILES, ACTION_PatchFiles, NULL }, - { szProcessComponents, IDS_DESC_PROCESSCOMPONENTS, 0, ACTION_ProcessComponents, szProcessComponents }, - { szPublishComponents, IDS_DESC_PUBLISHCOMPONENTS, IDS_TEMP_PUBLISHCOMPONENTS, ACTION_PublishComponents, szUnpublishComponents }, - { szPublishFeatures, IDS_DESC_PUBLISHFEATURES, IDS_TEMP_PUBLISHFEATURES, ACTION_PublishFeatures, szUnpublishFeatures }, - { szPublishProduct, IDS_DESC_PUBLISHPRODUCT, 0, ACTION_PublishProduct, szUnpublishProduct }, - { szRegisterClassInfo, IDS_DESC_REGISTERCLASSINFO, IDS_TEMP_REGISTERCLASSINFO, ACTION_RegisterClassInfo, szUnregisterClassInfo }, - { szRegisterComPlus, IDS_DESC_REGISTERCOMPLUS, IDS_TEMP_REGISTERCOMPLUS, ACTION_RegisterComPlus, szUnregisterComPlus }, - { szRegisterExtensionInfo, IDS_DESC_REGISTEREXTENSIONINFO, 0, ACTION_RegisterExtensionInfo, szUnregisterExtensionInfo }, - { szRegisterFonts, IDS_DESC_REGISTERFONTS, IDS_TEMP_REGISTERFONTS, ACTION_RegisterFonts, szUnregisterFonts }, - { szRegisterMIMEInfo, IDS_DESC_REGISTERMIMEINFO, IDS_TEMP_REGISTERMIMEINFO, ACTION_RegisterMIMEInfo, szUnregisterMIMEInfo }, - { szRegisterProduct, IDS_DESC_REGISTERPRODUCT, 0, ACTION_RegisterProduct, NULL }, - { szRegisterProgIdInfo, IDS_DESC_REGISTERPROGIDINFO, IDS_TEMP_REGISTERPROGIDINFO, ACTION_RegisterProgIdInfo, szUnregisterProgIdInfo }, - { szRegisterTypeLibraries, IDS_DESC_REGISTERTYPELIBRARIES, IDS_TEMP_REGISTERTYPELIBRARIES, ACTION_RegisterTypeLibraries, szUnregisterTypeLibraries }, - { szRegisterUser, IDS_DESC_REGISTERUSER, 0, ACTION_RegisterUser, NULL }, - { szRemoveDuplicateFiles, IDS_DESC_REMOVEDUPLICATEFILES, IDS_TEMP_REMOVEDUPLICATEFILES, ACTION_RemoveDuplicateFiles, szDuplicateFiles }, - { szRemoveEnvironmentStrings, IDS_DESC_REMOVEENVIRONMENTSTRINGS, IDS_TEMP_REMOVEENVIRONMENTSTRINGS, ACTION_RemoveEnvironmentStrings, szWriteEnvironmentStrings }, - { szRemoveExistingProducts, IDS_DESC_REMOVEEXISTINGPRODUCTS, IDS_TEMP_REMOVEEXISTINGPRODUCTS, ACTION_RemoveExistingProducts, NULL }, - { szRemoveFiles, IDS_DESC_REMOVEFILES, IDS_TEMP_REMOVEFILES, ACTION_RemoveFiles, szInstallFiles }, - { szRemoveFolders, IDS_DESC_REMOVEFOLDERS, IDS_TEMP_REMOVEFOLDERS, ACTION_RemoveFolders, szCreateFolders }, - { szRemoveIniValues, IDS_DESC_REMOVEINIVALUES, IDS_TEMP_REMOVEINIVALUES, ACTION_RemoveIniValues, szWriteIniValues }, - { szRemoveODBC, IDS_DESC_REMOVEODBC, 0, ACTION_RemoveODBC, szInstallODBC }, - { szRemoveRegistryValues, IDS_DESC_REMOVEREGISTRYVALUES, IDS_TEMP_REMOVEREGISTRYVALUES, ACTION_RemoveRegistryValues, szWriteRegistryValues }, - { szRemoveShortcuts, IDS_DESC_REMOVESHORTCUTS, IDS_TEMP_REMOVESHORTCUTS, ACTION_RemoveShortcuts, szCreateShortcuts }, - { szResolveSource, 0, 0, ACTION_ResolveSource, NULL }, - { szRMCCPSearch, IDS_DESC_RMCCPSEARCH, 0, ACTION_RMCCPSearch, NULL }, - { szScheduleReboot, 0, 0, ACTION_ScheduleReboot, NULL }, - { szSelfRegModules, IDS_DESC_SELFREGMODULES, IDS_TEMP_SELFREGMODULES, ACTION_SelfRegModules, szSelfUnregModules }, - { szSelfUnregModules, IDS_DESC_SELFUNREGMODULES, IDS_TEMP_SELFUNREGMODULES, ACTION_SelfUnregModules, szSelfRegModules }, - { szSetODBCFolders, IDS_DESC_SETODBCFOLDERS, 0, ACTION_SetODBCFolders, NULL }, - { szStartServices, IDS_DESC_STARTSERVICES, IDS_TEMP_STARTSERVICES, ACTION_StartServices, szStopServices }, - { szStopServices, IDS_DESC_STOPSERVICES, IDS_TEMP_STOPSERVICES, ACTION_StopServices, szStartServices }, - { szUnpublishComponents, IDS_DESC_UNPUBLISHCOMPONENTS, IDS_TEMP_UNPUBLISHCOMPONENTS, ACTION_UnpublishComponents, szPublishComponents }, - { szUnpublishFeatures, IDS_DESC_UNPUBLISHFEATURES, IDS_TEMP_UNPUBLISHFEATURES, ACTION_UnpublishFeatures, szPublishFeatures }, - { szUnpublishProduct, IDS_DESC_UNPUBLISHPRODUCT, 0, ACTION_UnpublishProduct, NULL }, /* for rollback only */ - { szUnregisterClassInfo, IDS_DESC_UNREGISTERCLASSINFO, IDS_TEMP_UNREGISTERCLASSINFO, ACTION_UnregisterClassInfo, szRegisterClassInfo }, - { szUnregisterComPlus, IDS_DESC_UNREGISTERCOMPLUS, IDS_TEMP_UNREGISTERCOMPLUS, ACTION_UnregisterComPlus, szRegisterComPlus }, - { szUnregisterExtensionInfo, IDS_DESC_UNREGISTEREXTENSIONINFO, IDS_TEMP_UNREGISTEREXTENSIONINFO, ACTION_UnregisterExtensionInfo, szRegisterExtensionInfo }, - { szUnregisterFonts, IDS_DESC_UNREGISTERFONTS, IDS_TEMP_UNREGISTERFONTS, ACTION_UnregisterFonts, szRegisterFonts }, - { szUnregisterMIMEInfo, IDS_DESC_UNREGISTERMIMEINFO, IDS_TEMP_UNREGISTERMIMEINFO, ACTION_UnregisterMIMEInfo, szRegisterMIMEInfo }, - { szUnregisterProgIdInfo, IDS_DESC_UNREGISTERPROGIDINFO, IDS_TEMP_UNREGISTERPROGIDINFO, ACTION_UnregisterProgIdInfo, szRegisterProgIdInfo }, - { szUnregisterTypeLibraries, IDS_DESC_UNREGISTERTYPELIBRARIES, IDS_TEMP_UNREGISTERTYPELIBRARIES, ACTION_UnregisterTypeLibraries, szRegisterTypeLibraries }, - { szValidateProductID, 0, 0, ACTION_ValidateProductID, NULL }, - { szWriteEnvironmentStrings, IDS_DESC_WRITEENVIRONMENTSTRINGS, IDS_TEMP_WRITEENVIRONMENTSTRINGS, ACTION_WriteEnvironmentStrings, szRemoveEnvironmentStrings }, - { szWriteIniValues, IDS_DESC_WRITEINIVALUES, IDS_TEMP_WRITEINIVALUES, ACTION_WriteIniValues, szRemoveIniValues }, - { szWriteRegistryValues, IDS_DESC_WRITEREGISTRYVALUES, IDS_TEMP_WRITEREGISTRYVALUES, ACTION_WriteRegistryValues, szRemoveRegistryValues }, - { szINSTALL, 0, 0, ACTION_INSTALL, NULL }, + { L"AllocateRegistrySpace", IDS_DESC_ALLOCATEREGISTRYSPACE, IDS_TEMP_ALLOCATEREGISTRYSPACE, ACTION_AllocateRegistrySpace, NULL }, + { L"AppSearch", IDS_DESC_APPSEARCH, IDS_TEMP_APPSEARCH, ACTION_AppSearch, NULL }, + { L"BindImage", IDS_DESC_BINDIMAGE, IDS_TEMP_BINDIMAGE, ACTION_BindImage, NULL }, + { L"CCPSearch", IDS_DESC_CCPSEARCH, 0, ACTION_CCPSearch, NULL }, + { L"CostFinalize", IDS_DESC_COSTFINALIZE, 0, ACTION_CostFinalize, NULL }, + { L"CostInitialize", IDS_DESC_COSTINITIALIZE, 0, ACTION_CostInitialize, NULL }, + { L"CreateFolders", IDS_DESC_CREATEFOLDERS, IDS_TEMP_CREATEFOLDERS, ACTION_CreateFolders, L"RemoveFolders" }, + { L"CreateShortcuts", IDS_DESC_CREATESHORTCUTS, IDS_TEMP_CREATESHORTCUTS, ACTION_CreateShortcuts, L"RemoveShortcuts" }, + { L"DeleteServices", IDS_DESC_DELETESERVICES, IDS_TEMP_DELETESERVICES, ACTION_DeleteServices, L"InstallServices" }, + { L"DisableRollback", 0, 0, ACTION_DisableRollback, NULL }, + { L"DuplicateFiles", IDS_DESC_DUPLICATEFILES, IDS_TEMP_DUPLICATEFILES, ACTION_DuplicateFiles, L"RemoveDuplicateFiles" }, + { L"ExecuteAction", 0, 0, ACTION_ExecuteAction, NULL }, + { L"FileCost", IDS_DESC_FILECOST, 0, ACTION_FileCost, NULL }, + { L"FindRelatedProducts", IDS_DESC_FINDRELATEDPRODUCTS, IDS_TEMP_FINDRELATEDPRODUCTS, ACTION_FindRelatedProducts, NULL }, + { L"ForceReboot", 0, 0, ACTION_ForceReboot, NULL }, + { L"InstallAdminPackage", IDS_DESC_INSTALLADMINPACKAGE, IDS_TEMP_INSTALLADMINPACKAGE, ACTION_InstallAdminPackage, NULL }, + { L"InstallExecute", 0, 0, ACTION_InstallExecute, NULL }, + { L"InstallExecuteAgain", 0, 0, ACTION_InstallExecute, NULL }, + { L"InstallFiles", IDS_DESC_INSTALLFILES, IDS_TEMP_INSTALLFILES, ACTION_InstallFiles, L"RemoveFiles" }, + { L"InstallFinalize", 0, 0, ACTION_InstallFinalize, NULL }, + { L"InstallInitialize", 0, 0, ACTION_InstallInitialize, NULL }, + { L"InstallODBC", IDS_DESC_INSTALLODBC, 0, ACTION_InstallODBC, L"RemoveODBC" }, + { L"InstallServices", IDS_DESC_INSTALLSERVICES, IDS_TEMP_INSTALLSERVICES, ACTION_InstallServices, L"DeleteServices" }, + { L"InstallSFPCatalogFile", IDS_DESC_INSTALLSFPCATALOGFILE, IDS_TEMP_INSTALLSFPCATALOGFILE, ACTION_InstallSFPCatalogFile, NULL }, + { L"InstallValidate", IDS_DESC_INSTALLVALIDATE, 0, ACTION_InstallValidate, NULL }, + { L"IsolateComponents", 0, 0, ACTION_IsolateComponents, NULL }, + { L"LaunchConditions", IDS_DESC_LAUNCHCONDITIONS, 0, ACTION_LaunchConditions, NULL }, + { L"MigrateFeutureStates", IDS_DESC_MIGRATEFEATURESTATES, IDS_TEMP_MIGRATEFEATURESTATES, ACTION_MigrateFeatureStates, NULL }, + { L"MoveFiles", IDS_DESC_MOVEFILES, IDS_TEMP_MOVEFILES, ACTION_MoveFiles, NULL }, + { L"MsiPublishAssemblies", IDS_DESC_MSIPUBLISHASSEMBLIES, IDS_TEMP_MSIPUBLISHASSEMBLIES, ACTION_MsiPublishAssemblies, L"MsiUnpublishAssemblies" }, + { L"MsiUnpublishAssemblies", IDS_DESC_MSIUNPUBLISHASSEMBLIES, IDS_TEMP_MSIUNPUBLISHASSEMBLIES, ACTION_MsiUnpublishAssemblies, L"MsiPublishAssemblies" }, + { L"PatchFiles", IDS_DESC_PATCHFILES, IDS_TEMP_PATCHFILES, ACTION_PatchFiles, NULL }, + { L"ProcessComponents", IDS_DESC_PROCESSCOMPONENTS, 0, ACTION_ProcessComponents, L"ProcessComponents" }, + { L"PublishComponents", IDS_DESC_PUBLISHCOMPONENTS, IDS_TEMP_PUBLISHCOMPONENTS, ACTION_PublishComponents, L"UnpublishComponents" }, + { L"PublishFeatures", IDS_DESC_PUBLISHFEATURES, IDS_TEMP_PUBLISHFEATURES, ACTION_PublishFeatures, L"UnpublishFeatures" }, + { L"PublishProduct", IDS_DESC_PUBLISHPRODUCT, 0, ACTION_PublishProduct, L"UnpublishProduct" }, + { L"RegisterClassInfo", IDS_DESC_REGISTERCLASSINFO, IDS_TEMP_REGISTERCLASSINFO, ACTION_RegisterClassInfo, L"UnregisterClassInfo" }, + { L"RegisterComPlus", IDS_DESC_REGISTERCOMPLUS, IDS_TEMP_REGISTERCOMPLUS, ACTION_RegisterComPlus, L"UnregisterComPlus" }, + { L"RegisterExtensionInfo", IDS_DESC_REGISTEREXTENSIONINFO, 0, ACTION_RegisterExtensionInfo, L"UnregisterExtensionInfo" }, + { L"RegisterFonts", IDS_DESC_REGISTERFONTS, IDS_TEMP_REGISTERFONTS, ACTION_RegisterFonts, L"UnregisterFonts" }, + { L"RegisterMIMEInfo", IDS_DESC_REGISTERMIMEINFO, IDS_TEMP_REGISTERMIMEINFO, ACTION_RegisterMIMEInfo, L"UnregisterMIMEInfo" }, + { L"RegisterProduct", IDS_DESC_REGISTERPRODUCT, 0, ACTION_RegisterProduct, NULL }, + { L"RegisterProgIdInfo", IDS_DESC_REGISTERPROGIDINFO, IDS_TEMP_REGISTERPROGIDINFO, ACTION_RegisterProgIdInfo, L"UnregisterProgIdInfo" }, + { L"RegisterTypeLibraries", IDS_DESC_REGISTERTYPELIBRARIES, IDS_TEMP_REGISTERTYPELIBRARIES, ACTION_RegisterTypeLibraries, L"UnregisterTypeLibraries" }, + { L"RegisterUser", IDS_DESC_REGISTERUSER, 0, ACTION_RegisterUser, NULL }, + { L"RemoveDuplicateFiles", IDS_DESC_REMOVEDUPLICATEFILES, IDS_TEMP_REMOVEDUPLICATEFILES, ACTION_RemoveDuplicateFiles, L"DuplicateFiles" }, + { L"RemoveEnvironmentStrings", IDS_DESC_REMOVEENVIRONMENTSTRINGS, IDS_TEMP_REMOVEENVIRONMENTSTRINGS, ACTION_RemoveEnvironmentStrings, L"WriteEnvironmentStrings" }, + { L"RemoveExistingProducts", IDS_DESC_REMOVEEXISTINGPRODUCTS, IDS_TEMP_REMOVEEXISTINGPRODUCTS, ACTION_RemoveExistingProducts, NULL }, + { L"RemoveFiles", IDS_DESC_REMOVEFILES, IDS_TEMP_REMOVEFILES, ACTION_RemoveFiles, L"InstallFiles" }, + { L"RemoveFolders", IDS_DESC_REMOVEFOLDERS, IDS_TEMP_REMOVEFOLDERS, ACTION_RemoveFolders, L"CreateFolders" }, + { L"RemoveIniValues", IDS_DESC_REMOVEINIVALUES, IDS_TEMP_REMOVEINIVALUES, ACTION_RemoveIniValues, L"WriteIniValues" }, + { L"RemoveODBC", IDS_DESC_REMOVEODBC, 0, ACTION_RemoveODBC, L"InstallODBC" }, + { L"RemoveRegistryValues", IDS_DESC_REMOVEREGISTRYVALUES, IDS_TEMP_REMOVEREGISTRYVALUES, ACTION_RemoveRegistryValues, L"WriteRegistryValues" }, + { L"RemoveShortcuts", IDS_DESC_REMOVESHORTCUTS, IDS_TEMP_REMOVESHORTCUTS, ACTION_RemoveShortcuts, L"CreateShortcuts" }, + { L"ResolveSource", 0, 0, ACTION_ResolveSource, NULL }, + { L"RMCCPSearch", IDS_DESC_RMCCPSEARCH, 0, ACTION_RMCCPSearch, NULL }, + { L"ScheduleReboot", 0, 0, ACTION_ScheduleReboot, NULL }, + { L"SelfRegModules", IDS_DESC_SELFREGMODULES, IDS_TEMP_SELFREGMODULES, ACTION_SelfRegModules, L"SelfUnregModules" }, + { L"SelfUnregModules", IDS_DESC_SELFUNREGMODULES, IDS_TEMP_SELFUNREGMODULES, ACTION_SelfUnregModules, L"SelfRegModules" }, + { L"SetODBCFolders", IDS_DESC_SETODBCFOLDERS, 0, ACTION_SetODBCFolders, NULL }, + { L"StartServices", IDS_DESC_STARTSERVICES, IDS_TEMP_STARTSERVICES, ACTION_StartServices, L"StopServices" }, + { L"StopServices", IDS_DESC_STOPSERVICES, IDS_TEMP_STOPSERVICES, ACTION_StopServices, L"StartServices" }, + { L"UnpublishComponents", IDS_DESC_UNPUBLISHCOMPONENTS, IDS_TEMP_UNPUBLISHCOMPONENTS, ACTION_UnpublishComponents, L"PublishComponents" }, + { L"UnpublishFeatures", IDS_DESC_UNPUBLISHFEATURES, IDS_TEMP_UNPUBLISHFEATURES, ACTION_UnpublishFeatures, L"PublishFeatures" }, + { L"UnpublishProduct", IDS_DESC_UNPUBLISHPRODUCT, 0, ACTION_UnpublishProduct, NULL }, /* for rollback only */ + { L"UnregisterClassInfo", IDS_DESC_UNREGISTERCLASSINFO, IDS_TEMP_UNREGISTERCLASSINFO, ACTION_UnregisterClassInfo, L"RegisterClassInfo" }, + { L"UnregisterComPlus", IDS_DESC_UNREGISTERCOMPLUS, IDS_TEMP_UNREGISTERCOMPLUS, ACTION_UnregisterComPlus, L"RegisterComPlus" }, + { L"UnregisterExtensionInfo", IDS_DESC_UNREGISTEREXTENSIONINFO, IDS_TEMP_UNREGISTEREXTENSIONINFO, ACTION_UnregisterExtensionInfo, L"RegisterExtensionInfo" }, + { L"UnregisterFonts", IDS_DESC_UNREGISTERFONTS, IDS_TEMP_UNREGISTERFONTS, ACTION_UnregisterFonts, L"RegisterFonts" }, + { L"UnregisterMIMEInfo", IDS_DESC_UNREGISTERMIMEINFO, IDS_TEMP_UNREGISTERMIMEINFO, ACTION_UnregisterMIMEInfo, L"RegisterMIMEInfo" }, + { L"UnregisterProgIdInfo", IDS_DESC_UNREGISTERPROGIDINFO, IDS_TEMP_UNREGISTERPROGIDINFO, ACTION_UnregisterProgIdInfo, L"RegisterProgIdInfo" }, + { L"UnregisterTypeLibraries", IDS_DESC_UNREGISTERTYPELIBRARIES, IDS_TEMP_UNREGISTERTYPELIBRARIES, ACTION_UnregisterTypeLibraries, L"RegisterTypeLibraries" }, + { L"ValidateProductID", 0, 0, ACTION_ValidateProductID, NULL }, + { L"WriteEnvironmentStrings", IDS_DESC_WRITEENVIRONMENTSTRINGS, IDS_TEMP_WRITEENVIRONMENTSTRINGS, ACTION_WriteEnvironmentStrings, L"RemoveEnvironmentStrings" }, + { L"WriteIniValues", IDS_DESC_WRITEINIVALUES, IDS_TEMP_WRITEINIVALUES, ACTION_WriteIniValues, L"RemoveIniValues" }, + { L"WriteRegistryValues", IDS_DESC_WRITEREGISTRYVALUES, IDS_TEMP_WRITEREGISTRYVALUES, ACTION_WriteRegistryValues, L"RemoveRegistryValues" }, + { L"INSTALL", 0, 0, ACTION_INSTALL, NULL }, { 0 } }; @@ -8111,21 +7612,10 @@ static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq) UINT rc = ERROR_SUCCESS; MSIRECORD *row; - static const WCHAR query[] = - {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','I','n','s','t','a','l','l','E','x','e','c','u','t','e', - 'S','e','q','u','e','n','c','e','`',' ', 'W','H','E','R','E',' ', - '`','S','e','q','u','e','n','c','e','`',' ', '=',' ','%','i',0}; - static const WCHAR ui_query[] = - {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','I','n','s','t','a','l','l','U','I','S','e','q','u','e','n','c','e', - '`', ' ', 'W','H','E','R','E',' ','`','S','e','q','u','e','n','c','e','`', - ' ', '=',' ','%','i',0}; - if (needs_ui_sequence(package)) - row = MSI_QueryGetRecord(package->db, ui_query, seq); + row = MSI_QueryGetRecord(package->db, L"SELECT * FROM `InstallUISequence` WHERE `Sequence` = %d", seq); else - row = MSI_QueryGetRecord(package->db, query, seq); + row = MSI_QueryGetRecord(package->db, L"SELECT * FROM `InstallExecuteSequence` WHERE `Sequence` = %d", seq); if (row) { @@ -8202,8 +7692,6 @@ static void stop_dummy_thread(struct dummy_thread *info) UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, LPCWSTR szCommandLine ) { - static const WCHAR szDisableRollback[] = {'D','I','S','A','B','L','E','R','O','L','L','B','A','C','K',0}; - static const WCHAR szAction[] = {'A','C','T','I','O','N',0}; WCHAR *reinstall = NULL, *productcode, *action; struct dummy_thread thread_info = {NULL, NULL, NULL}; UINT rc; @@ -8226,7 +7714,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, msi_free(dir); dir = msi_alloc(MAX_PATH * sizeof(WCHAR)); GetCurrentDirectoryW(MAX_PATH, dir); - lstrcatW(dir, szBackSlash); + lstrcatW(dir, L"\\"); file = szPackagePath; } @@ -8252,9 +7740,9 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, msi_apply_transforms( package ); msi_apply_patches( package ); - if (msi_get_property( package->db, szAction, NULL, &len )) - msi_set_property( package->db, szAction, szINSTALL, -1 ); - action = msi_dup_property( package->db, szAction ); + if (msi_get_property( package->db, L"ACTION", NULL, &len )) + msi_set_property( package->db, L"ACTION", L"INSTALL", -1 ); + action = msi_dup_property( package->db, L"ACTION" ); CharUpperW(action); msi_set_original_database_property( package->db, szPackagePath ); @@ -8264,7 +7752,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, start_dummy_thread(&thread_info); - productcode = msi_dup_property( package->db, szProductCode ); + productcode = msi_dup_property( package->db, L"ProductCode" ); if (wcsicmp( productcode, package->ProductCode )) { TRACE( "product code changed %s -> %s\n", debugstr_w(package->ProductCode), debugstr_w(productcode) ); @@ -8273,10 +7761,10 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, } else msi_free( productcode ); - if (msi_get_property_int( package->db, szDisableRollback, 0 )) + if (msi_get_property_int( package->db, L"DISABLEROLLBACK", 0 )) { TRACE("disabling rollback\n"); - msi_set_property( package->db, szRollbackDisabled, szOne, -1 ); + msi_set_property( package->db, L"RollbackDisabled", L"1", -1 ); } rc = ACTION_PerformAction(package, action); @@ -8291,7 +7779,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, else /* failed */ { ACTION_PerformActionSequence(package, -3); - if (!msi_get_property_int( package->db, szRollbackDisabled, 0 )) + if (!msi_get_property_int( package->db, L"RollbackDisabled", 0 )) { package->need_rollback = TRUE; } @@ -8302,7 +7790,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, stop_dummy_thread(&thread_info); - if (package->need_rollback && !(reinstall = msi_dup_property( package->db, szReinstall ))) + if (package->need_rollback && !(reinstall = msi_dup_property( package->db, L"REINSTALL" ))) { WARN("installation failed, running rollback script\n"); execute_script( package, SCRIPT_ROLLBACK ); diff --git a/sdk/include/reactos/wine/test.h b/sdk/include/reactos/wine/test.h index 28d993217c9..423d7ac3637 100644 --- a/sdk/include/reactos/wine/test.h +++ b/sdk/include/reactos/wine/test.h @@ -85,6 +85,7 @@ extern const char *wine_dbgstr_rect( const RECT *rect ); extern const char *wine_dbgstr_longlong( ULONGLONG ll ); #endif static inline const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, -1 ); } +static inline const char *wine_dbgstr_a( const char *s ) { return wine_dbgstr_an( s, -1 ); } static inline const char *wine_dbgstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); } /* strcmpW is available for tests compiled under Wine, but not in standalone
2 years, 9 months
1
0
0
0
[reactos] 302/360: [WINESYNC] msi: Use 0 terminated WCHAR strings in the SQL tokenizer.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ce6af3b1bcbc091f6fbb8…
commit ce6af3b1bcbc091f6fbb81a1f23f9bb706bfa803 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 19:08:59 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:33 2022 +0100 [WINESYNC] msi: Use 0 terminated WCHAR strings in the SQL tokenizer. Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 6705b959d0cf7635bf2ab16ab89fefb409a0a9c8 by Michael Stefaniuc <mstefani(a)winehq.org> --- dll/win32/msi/tokenize.c | 114 ++++++++++++++++------------------------------- 1 file changed, 39 insertions(+), 75 deletions(-) diff --git a/dll/win32/msi/tokenize.c b/dll/win32/msi/tokenize.c index 4ebc9b81fb4..3b9f98c6f17 100644 --- a/dll/win32/msi/tokenize.c +++ b/dll/win32/msi/tokenize.c @@ -38,87 +38,51 @@ struct Keyword { #define MAX_TOKEN_LEN 11 -static const WCHAR addW[] = {'A','D','D'}; -static const WCHAR alterW[] = {'A','L','T','E','R'}; -static const WCHAR andW[] = {'A','N','D'}; -static const WCHAR byW[] = {'B','Y'}; -static const WCHAR charW[] = {'C','H','A','R'}; -static const WCHAR characterW[] = {'C','H','A','R','A','C','T','E','R'}; -static const WCHAR createW[] = {'C','R','E','A','T','E'}; -static const WCHAR deleteW[] = {'D','E','L','E','T','E'}; -static const WCHAR distinctW[] = {'D','I','S','T','I','N','C','T'}; -static const WCHAR dropW[] = {'D','R','O','P'}; -static const WCHAR freeW[] = {'F','R','E','E'}; -static const WCHAR fromW[] = {'F','R','O','M'}; -static const WCHAR holdW[] = {'H','O','L','D'}; -static const WCHAR insertW[] = {'I','N','S','E','R','T'}; -static const WCHAR intW[] = {'I','N','T'}; -static const WCHAR integerW[] = {'I','N','T','E','G','E','R'}; -static const WCHAR intoW[] = {'I','N','T','O'}; -static const WCHAR isW[] = {'I','S'}; -static const WCHAR keyW[] = {'K','E','Y'}; -static const WCHAR likeW[] = {'L','I','K','E'}; -static const WCHAR localizableW[] = {'L','O','C','A','L','I','Z','A','B','L','E'}; -static const WCHAR longW[] = {'L','O','N','G'}; -static const WCHAR longcharW[] = {'L','O','N','G','C','H','A','R'}; -static const WCHAR notW[] = {'N','O','T'}; -static const WCHAR nullW[] = {'N','U','L','L'}; -static const WCHAR objectW[] = {'O','B','J','E','C','T'}; -static const WCHAR orW[] = {'O','R'}; -static const WCHAR orderW[] = {'O','R','D','E','R'}; -static const WCHAR primaryW[] = {'P','R','I','M','A','R','Y'}; -static const WCHAR selectW[] = {'S','E','L','E','C','T'}; -static const WCHAR setW[] = {'S','E','T'}; -static const WCHAR shortW[] = {'S','H','O','R','T'}; -static const WCHAR tableW[] = {'T','A','B','L','E'}; -static const WCHAR temporaryW[] = {'T','E','M','P','O','R','A','R','Y'}; -static const WCHAR updateW[] = {'U','P','D','A','T','E'}; -static const WCHAR valuesW[] = {'V','A','L','U','E','S'}; -static const WCHAR whereW[] = {'W','H','E','R','E'}; - /* ** These are the keywords ** They MUST be in alphabetical order */ +#define X(str) str, ARRAY_SIZE(str) - 1 static const Keyword aKeywordTable[] = { - { addW, ARRAY_SIZE(addW), TK_ADD }, - { alterW, ARRAY_SIZE(alterW), TK_ALTER }, - { andW, ARRAY_SIZE(andW), TK_AND }, - { byW, ARRAY_SIZE(byW), TK_BY }, - { charW, ARRAY_SIZE(charW), TK_CHAR }, - { characterW, ARRAY_SIZE(characterW), TK_CHAR }, - { createW, ARRAY_SIZE(createW), TK_CREATE }, - { deleteW, ARRAY_SIZE(deleteW), TK_DELETE }, - { distinctW, ARRAY_SIZE(distinctW), TK_DISTINCT }, - { dropW, ARRAY_SIZE(dropW), TK_DROP }, - { freeW, ARRAY_SIZE(freeW), TK_FREE }, - { fromW, ARRAY_SIZE(fromW), TK_FROM }, - { holdW, ARRAY_SIZE(holdW), TK_HOLD }, - { insertW, ARRAY_SIZE(insertW), TK_INSERT }, - { intW, ARRAY_SIZE(intW), TK_INT }, - { integerW, ARRAY_SIZE(integerW), TK_INT }, - { intoW, ARRAY_SIZE(intoW), TK_INTO }, - { isW, ARRAY_SIZE(isW), TK_IS }, - { keyW, ARRAY_SIZE(keyW), TK_KEY }, - { likeW, ARRAY_SIZE(likeW), TK_LIKE }, - { localizableW, ARRAY_SIZE(localizableW), TK_LOCALIZABLE }, - { longW, ARRAY_SIZE(longW), TK_LONG }, - { longcharW, ARRAY_SIZE(longcharW), TK_LONGCHAR }, - { notW, ARRAY_SIZE(notW), TK_NOT }, - { nullW, ARRAY_SIZE(nullW), TK_NULL }, - { objectW, ARRAY_SIZE(objectW), TK_OBJECT }, - { orW, ARRAY_SIZE(orW), TK_OR }, - { orderW, ARRAY_SIZE(orderW), TK_ORDER }, - { primaryW, ARRAY_SIZE(primaryW), TK_PRIMARY }, - { selectW, ARRAY_SIZE(selectW), TK_SELECT }, - { setW, ARRAY_SIZE(setW), TK_SET }, - { shortW, ARRAY_SIZE(shortW), TK_SHORT }, - { tableW, ARRAY_SIZE(tableW), TK_TABLE }, - { temporaryW, ARRAY_SIZE(temporaryW), TK_TEMPORARY }, - { updateW, ARRAY_SIZE(updateW), TK_UPDATE }, - { valuesW, ARRAY_SIZE(valuesW), TK_VALUES }, - { whereW, ARRAY_SIZE(whereW), TK_WHERE }, + { X(L"ADD"), TK_ADD }, + { X(L"ALTER"), TK_ALTER }, + { X(L"AND"), TK_AND }, + { X(L"BY"), TK_BY }, + { X(L"CHAR"), TK_CHAR }, + { X(L"CHARACTER"), TK_CHAR }, + { X(L"CREATE"), TK_CREATE }, + { X(L"DELETE"), TK_DELETE }, + { X(L"DISTINCT"), TK_DISTINCT }, + { X(L"DROP"), TK_DROP }, + { X(L"FREE"), TK_FREE }, + { X(L"FROM"), TK_FROM }, + { X(L"HOLD"), TK_HOLD }, + { X(L"INSERT"), TK_INSERT }, + { X(L"INT"), TK_INT }, + { X(L"INTEGER"), TK_INT }, + { X(L"INTO"), TK_INTO }, + { X(L"IS"), TK_IS }, + { X(L"KEY"), TK_KEY }, + { X(L"LIKE"), TK_LIKE }, + { X(L"LOCALIZABLE"), TK_LOCALIZABLE }, + { X(L"LONG"), TK_LONG }, + { X(L"LONGCHAR"), TK_LONGCHAR }, + { X(L"NOT"), TK_NOT }, + { X(L"NULL"), TK_NULL }, + { X(L"OBJECT"), TK_OBJECT }, + { X(L"OR"), TK_OR }, + { X(L"ORDER"), TK_ORDER }, + { X(L"PRIMARY"), TK_PRIMARY }, + { X(L"SELECT"), TK_SELECT }, + { X(L"SET"), TK_SET }, + { X(L"SHORT"), TK_SHORT }, + { X(L"TABLE"), TK_TABLE }, + { X(L"TEMPORARY"), TK_TEMPORARY }, + { X(L"UPDATE"), TK_UPDATE }, + { X(L"VALUES"), TK_VALUES }, + { X(L"WHERE"), TK_WHERE }, }; +#undef X /* ** Comparison function for binary search.
2 years, 9 months
1
0
0
0
← Newer
1
...
7
8
9
10
11
12
13
...
44
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Results per page:
10
25
50
100
200