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] 51/360: [WINESYNC] msi: Set the correct values for ProgramFiles64Folder and CommonFiles64Folder.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3ec0ea99c6563fbe930a7…
commit 3ec0ea99c6563fbe930a7177928864b36e73be59 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sat Mar 12 15:12:11 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:27:43 2022 +0100 [WINESYNC] msi: Set the correct values for ProgramFiles64Folder and CommonFiles64Folder. 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 a6e9622439c4fd22578e737e60ca2af44a32f8b1 by Zebediah Figura <z.figura12(a)gmail.com> --- dll/win32/msi/package.c | 37 +++- modules/rostests/winetests/msi/package.c | 292 ++++++++----------------------- 2 files changed, 101 insertions(+), 228 deletions(-) diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c index 55789f50594..58943536b46 100644 --- a/dll/win32/msi/package.c +++ b/dll/win32/msi/package.c @@ -662,7 +662,7 @@ static VOID set_installer_properties(MSIPACKAGE *package) WCHAR *ptr; OSVERSIONINFOEXW OSVersion; MEMORYSTATUSEX msex; - DWORD verval, len; + DWORD verval, len, type; WCHAR pth[MAX_PATH], verstr[11], bufstr[22]; HDC dc; HKEY hkey; @@ -708,6 +708,10 @@ static VOID set_installer_properties(MSIPACKAGE *package) 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','\\', @@ -718,6 +722,12 @@ static VOID set_installer_properties(MSIPACKAGE *package) 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','\\', @@ -867,6 +877,9 @@ static VOID set_installer_properties(MSIPACKAGE *package) len = sprintfW( bufstr, szFormat, MSI_MAJORVERSION * 100 ); msi_set_property( package->db, szVersionDatabase, bufstr, len ); + RegOpenKeyExW(HKEY_LOCAL_MACHINE, szCurrentVersion, 0, + KEY_QUERY_VALUE | KEY_WOW64_64KEY, &hkey); + GetNativeSystemInfo( &sys_info ); len = sprintfW( bufstr, szIntFormat, sys_info.wProcessorLevel ); msi_set_property( package->db, szIntel, bufstr, len ); @@ -876,11 +889,13 @@ static VOID set_installer_properties(MSIPACKAGE *package) PathAddBackslashW( pth ); msi_set_property( package->db, szSystemFolder, pth, -1 ); - SHGetFolderPathW( NULL, CSIDL_PROGRAM_FILES, NULL, 0, pth ); + len = MAX_PATH; + RegQueryValueExW(hkey, szProgramFilesDir, 0, &type, (BYTE *)pth, &len); PathAddBackslashW( pth ); msi_set_property( package->db, szProgramFilesFolder, pth, -1 ); - SHGetFolderPathW( NULL, CSIDL_PROGRAM_FILES_COMMON, NULL, 0, pth ); + len = MAX_PATH; + RegQueryValueExW(hkey, szCommonFilesDir, 0, &type, (BYTE *)pth, &len); PathAddBackslashW( pth ); msi_set_property( package->db, szCommonFilesFolder, pth, -1 ); } @@ -898,23 +913,29 @@ static VOID set_installer_properties(MSIPACKAGE *package) PathAddBackslashW( pth ); msi_set_property( package->db, szSystemFolder, pth, -1 ); - SHGetFolderPathW( NULL, CSIDL_PROGRAM_FILES, NULL, 0, pth ); + len = MAX_PATH; + RegQueryValueExW(hkey, szProgramFilesDir, 0, &type, (BYTE *)pth, &len); PathAddBackslashW( pth ); msi_set_property( package->db, szProgramFiles64Folder, pth, -1 ); - SHGetFolderPathW( NULL, CSIDL_PROGRAM_FILESX86, NULL, 0, pth ); + len = MAX_PATH; + RegQueryValueExW(hkey, szProgramFilesDirx86, 0, &type, (BYTE *)pth, &len); PathAddBackslashW( pth ); msi_set_property( package->db, szProgramFilesFolder, pth, -1 ); - SHGetFolderPathW( NULL, CSIDL_PROGRAM_FILES_COMMON, NULL, 0, pth ); + len = MAX_PATH; + RegQueryValueExW(hkey, szCommonFilesDir, 0, &type, (BYTE *)pth, &len); PathAddBackslashW( pth ); msi_set_property( package->db, szCommonFiles64Folder, pth, -1 ); - SHGetFolderPathW( NULL, CSIDL_PROGRAM_FILES_COMMONX86, NULL, 0, pth ); + len = MAX_PATH; + RegQueryValueExW(hkey, szCommonFilesDirx86, 0, &type, (BYTE *)pth, &len); PathAddBackslashW( pth ); msi_set_property( package->db, szCommonFilesFolder, pth, -1 ); } + RegCloseKey(hkey); + /* Screen properties. */ dc = GetDC(0); len = sprintfW( bufstr, szIntFormat, GetDeviceCaps(dc, HORZRES) ); @@ -941,7 +962,7 @@ static VOID set_installer_properties(MSIPACKAGE *package) CloseHandle( hkey ); } if ((!username || !companyname) && - RegOpenKeyW( HKEY_LOCAL_MACHINE, szCurrentVersion, &hkey ) == ERROR_SUCCESS) + RegOpenKeyW( HKEY_LOCAL_MACHINE, szCurrentVersionNT, &hkey ) == ERROR_SUCCESS) { if (!username && (username = msi_reg_get_val_str( hkey, szRegisteredUser ))) diff --git a/modules/rostests/winetests/msi/package.c b/modules/rostests/winetests/msi/package.c index d26e2fdb56f..09d2e0b61b8 100644 --- a/modules/rostests/winetests/msi/package.c +++ b/modules/rostests/winetests/msi/package.c @@ -2140,12 +2140,12 @@ static void test_condition(void) static void check_prop(MSIHANDLE hpkg, const char *prop, const char *expect) { - char buffer[20] = "x"; + char buffer[MAX_PATH] = "x"; DWORD sz = sizeof(buffer); UINT r = MsiGetPropertyA(hpkg, prop, buffer, &sz); ok(!r, "'%s': got %u\n", prop, r); ok(sz == lstrlenA(buffer), "'%s': expected %u, got %u\n", prop, lstrlenA(buffer), sz); - ok(!strcmp(buffer, expect), "expected '%s', got '%s'\n", expect, buffer); + ok(!strcmp(buffer, expect), "'%s': expected '%s', got '%s'\n", prop, expect, buffer); } static void test_props(void) @@ -5463,7 +5463,7 @@ static void test_installprops(void) CHAR path[MAX_PATH], buf[MAX_PATH]; DWORD size, type; LANGID langid; - HKEY hkey1, hkey2; + HKEY hkey1, hkey2, pathkey; int res; UINT r; REGSAM access = KEY_ALL_ACCESS; @@ -5516,6 +5516,8 @@ static void test_installprops(void) RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1); RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0, access, &hkey2); + RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion", + 0, KEY_QUERY_VALUE | KEY_WOW64_64KEY, &pathkey); size = MAX_PATH; type = REG_SZ; @@ -5616,228 +5618,78 @@ static void test_installprops(void) r = MsiGetPropertyA(hpkg, "MsiNetAssemblySupport", buf, &size); if (r == ERROR_SUCCESS) trace( "MsiNetAssemblySupport \"%s\"\n", buf ); - if (pGetSystemInfo && pSHGetFolderPathA) - { + if (pGetNativeSystemInfo) + pGetNativeSystemInfo(&si); + else pGetSystemInfo(&si); - if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) - { - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "Intel", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - ok(buf[0], "property not set\n"); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "MsiAMD64", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - ok(buf[0], "property not set\n"); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "Msix64", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - ok(buf[0], "property not set\n"); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "System64Folder", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - GetSystemDirectoryA(path, MAX_PATH); - if (size) buf[size - 1] = 0; - ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "SystemFolder", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - pGetSystemWow64DirectoryA(path, MAX_PATH); - if (size) buf[size - 1] = 0; - ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "ProgramFiles64Folder", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES, NULL, 0, path); - if (size) buf[size - 1] = 0; - ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "ProgramFilesFolder", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILESX86, NULL, 0, path); - if (size) buf[size - 1] = 0; - ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "CommonFiles64Folder", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES_COMMON, NULL, 0, path); - if (size) buf[size - 1] = 0; - ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "CommonFilesFolder", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES_COMMONX86, NULL, 0, path); - if (size) buf[size - 1] = 0; - ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "VersionNT64", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - ok(buf[0], "property not set\n"); - } - else if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) - { - if (!is_wow64) - { - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "Intel", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - ok(buf[0], "property not set\n"); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "MsiAMD64", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - ok(!buf[0], "property set\n"); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "Msix64", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - ok(!buf[0], "property set\n"); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "System64Folder", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - ok(!buf[0], "property set\n"); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "SystemFolder", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - GetSystemDirectoryA(path, MAX_PATH); - if (size) buf[size - 1] = 0; - ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "ProgramFiles64Folder", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - ok(!buf[0], "property set\n"); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "ProgramFilesFolder", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES, NULL, 0, path); - if (size) buf[size - 1] = 0; - ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "CommonFiles64Folder", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - ok(!buf[0], "property set\n"); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "CommonFilesFolder", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES_COMMON, NULL, 0, path); - if (size) buf[size - 1] = 0; - ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "VersionNT64", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - ok(!buf[0], "property set\n"); - } - else - { - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "Intel", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - ok(buf[0], "property not set\n"); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "MsiAMD64", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - ok(buf[0], "property not set\n"); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "Msix64", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - ok(buf[0], "property not set\n"); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "System64Folder", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - GetSystemDirectoryA(path, MAX_PATH); - if (size) buf[size - 1] = 0; - ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "SystemFolder", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - pGetSystemWow64DirectoryA(path, MAX_PATH); - if (size) buf[size - 1] = 0; - ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "ProgramFilesFolder64", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - ok(!buf[0], "property set\n"); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "ProgramFilesFolder", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILESX86, NULL, 0, path); - if (size) buf[size - 1] = 0; - ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "CommonFilesFolder64", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - ok(!buf[0], "property set\n"); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "CommonFilesFolder", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES_COMMONX86, NULL, 0, path); - if (size) buf[size - 1] = 0; - ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf); - - buf[0] = 0; - size = MAX_PATH; - r = MsiGetPropertyA(hpkg, "VersionNT64", buf, &size); - ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r); - ok(buf[0], "property not set\n"); - } - } + + if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) + { + sprintf(buf, "%d", si.wProcessorLevel); + check_prop(hpkg, "Intel", buf); + check_prop(hpkg, "MsiAMD64", buf); + check_prop(hpkg, "Msix64", buf); + sprintf(buf, "%d", LOBYTE(LOWORD(GetVersion())) * 100 + HIBYTE(LOWORD(GetVersion()))); + check_prop(hpkg, "VersionNT64", buf); + + GetSystemDirectoryA(path, MAX_PATH); + strcat(path, "\\"); + check_prop(hpkg, "System64Folder", path); + + pGetSystemWow64DirectoryA(path, MAX_PATH); + strcat(path, "\\"); + check_prop(hpkg, "SystemFolder", path); + + size = MAX_PATH; + r = RegQueryValueExA(pathkey, "ProgramFilesDir (x86)", 0, &type, (BYTE *)path, &size); + strcat(path, "\\"); + check_prop(hpkg, "ProgramFilesFolder", path); + + size = MAX_PATH; + RegQueryValueExA(pathkey, "ProgramFilesDir", 0, &type, (BYTE *)path, &size); + strcat(path, "\\"); + check_prop(hpkg, "ProgramFiles64Folder", path); + + size = MAX_PATH; + RegQueryValueExA(pathkey, "CommonFilesDir (x86)", 0, &type, (BYTE *)path, &size); + strcat(path, "\\"); + check_prop(hpkg, "CommonFilesFolder", path); + + size = MAX_PATH; + RegQueryValueExA(pathkey, "CommonFilesDir", 0, &type, (BYTE *)path, &size); + strcat(path, "\\"); + check_prop(hpkg, "CommonFiles64Folder", path); + } + else if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) + { + sprintf(buf, "%d", si.wProcessorLevel); + check_prop(hpkg, "Intel", buf); + + GetSystemDirectoryA(path, MAX_PATH); + strcat(path, "\\"); + check_prop(hpkg, "SystemFolder", path); + + size = MAX_PATH; + RegQueryValueExA(pathkey, "ProgramFilesDir", 0, &type, (BYTE *)path, &size); + strcat(path, "\\"); + check_prop(hpkg, "ProgramFilesFolder", path); + + size = MAX_PATH; + RegQueryValueExA(pathkey, "CommonFilesDir", 0, &type, (BYTE *)path, &size); + strcat(path, "\\"); + check_prop(hpkg, "CommonFilesFolder", path); + + check_prop(hpkg, "MsiAMD64", ""); + check_prop(hpkg, "Msix64", ""); + check_prop(hpkg, "VersionNT64", ""); + check_prop(hpkg, "System64Folder", ""); + check_prop(hpkg, "ProgramFiles64Dir", ""); + check_prop(hpkg, "CommonFiles64Dir", ""); } CloseHandle(hkey1); CloseHandle(hkey2); + RegCloseKey(pathkey); MsiCloseHandle(hpkg); DeleteFileA(msifile); MsiSetInternalUI(uilevel, NULL);
2 years, 9 months
1
0
0
0
[reactos] 50/360: [WINESYNC] msi: Don't load a custom action DLL in the main process.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d817f7cfa1754e7e3f3ca…
commit d817f7cfa1754e7e3f3cae4cbed6e15c649170bb Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sat Mar 12 15:12:10 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:27:43 2022 +0100 [WINESYNC] msi: Don't load a custom action DLL in the main process. This has no effect anymore, and won't work if the architecture doesn't match. 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 e355cb62775f7fd39a03458c62334a603dcb0c78 by Zebediah Figura <z.figura12(a)gmail.com> --- dll/win32/msi/custom.c | 16 ++++++---------- dll/win32/msi/msipriv.h | 1 - dll/win32/msi/package.c | 2 -- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c index 027d0f6961a..71f02bb2745 100644 --- a/dll/win32/msi/custom.c +++ b/dll/win32/msi/custom.c @@ -236,7 +236,7 @@ WCHAR *msi_create_temp_file( MSIDATABASE *db ) return ret; } -static MSIBINARY *create_temp_binary( MSIPACKAGE *package, LPCWSTR source, BOOL dll ) +static MSIBINARY *create_temp_binary(MSIPACKAGE *package, LPCWSTR source) { static const WCHAR query[] = { 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', @@ -273,11 +273,6 @@ static MSIBINARY *create_temp_binary( MSIPACKAGE *package, LPCWSTR source, BOOL CloseHandle( file ); if (r != ERROR_SUCCESS) goto error; - /* keep a reference to prevent the dll from being unloaded */ - if (dll && !(binary->module = LoadLibraryW( tmpfile ))) - { - ERR( "failed to load dll %s (%u)\n", debugstr_w( tmpfile ), GetLastError() ); - } binary->source = strdupW( source ); binary->tmpfile = tmpfile; list_add_tail( &package->binaries, &binary->entry ); @@ -293,7 +288,7 @@ error: return NULL; } -static MSIBINARY *get_temp_binary( MSIPACKAGE *package, LPCWSTR source, BOOL dll ) +static MSIBINARY *get_temp_binary(MSIPACKAGE *package, LPCWSTR source) { MSIBINARY *binary; @@ -303,7 +298,7 @@ static MSIBINARY *get_temp_binary( MSIPACKAGE *package, LPCWSTR source, BOOL dll return binary; } - return create_temp_binary( package, source, dll ); + return create_temp_binary(package, source); } static void file_running_action(MSIPACKAGE* package, HANDLE Handle, @@ -693,7 +688,7 @@ static UINT HANDLE_CustomType1( MSIPACKAGE *package, const WCHAR *source, const msi_custom_action_info *info; MSIBINARY *binary; - if (!(binary = get_temp_binary( package, source, TRUE ))) + if (!(binary = get_temp_binary(package, source))) return ERROR_FUNCTION_FAILED; TRACE("Calling function %s from %s\n", debugstr_w(target), debugstr_w(binary->tmpfile)); @@ -777,7 +772,8 @@ static UINT HANDLE_CustomType2( MSIPACKAGE *package, const WCHAR *source, const HANDLE handle; WCHAR *arg; - if (!(binary = get_temp_binary( package, source, FALSE ))) return ERROR_FUNCTION_FAILED; + if (!(binary = get_temp_binary(package, source))) + return ERROR_FUNCTION_FAILED; deformat_string( package, target, &arg ); TRACE("exe %s arg %s\n", debugstr_w(binary->tmpfile), debugstr_w(arg)); diff --git a/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h index f1f689e153f..ca4c5cfc083 100644 --- a/dll/win32/msi/msipriv.h +++ b/dll/win32/msi/msipriv.h @@ -206,7 +206,6 @@ typedef struct tagMSIBINARY struct list entry; WCHAR *source; WCHAR *tmpfile; - HMODULE module; } MSIBINARY; typedef struct _column_info diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c index 1e4c0874d8a..55789f50594 100644 --- a/dll/win32/msi/package.c +++ b/dll/win32/msi/package.c @@ -290,8 +290,6 @@ static void free_package_structures( MSIPACKAGE *package ) MSIBINARY *binary = LIST_ENTRY( item, MSIBINARY, entry ); list_remove( &binary->entry ); - if (binary->module) - FreeLibrary( binary->module ); if (!DeleteFileW( binary->tmpfile )) ERR("failed to delete %s (%u)\n", debugstr_w(binary->tmpfile), GetLastError()); msi_free( binary->source );
2 years, 9 months
1
0
0
0
[reactos] 49/360: [WINESYNC] msi: Execute the custom action server with the correct bitness.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=20260e3310ebc25ec583c…
commit 20260e3310ebc25ec583ce9da70510db7eaa69a2 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sat Mar 12 15:12:10 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:27:43 2022 +0100 [WINESYNC] msi: Execute the custom action server with the correct bitness. The bitness depends solely on the bitness of the DLL (tested manually). 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 6049b0f8c3637b6ef55b05a57893191ab808c69f by Zebediah Figura <z.figura12(a)gmail.com> --- dll/win32/msi/custom.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c index d6a8e11aec6..027d0f6961a 100644 --- a/dll/win32/msi/custom.c +++ b/dll/win32/msi/custom.c @@ -580,11 +580,17 @@ UINT __wine_msi_call_dll_function(const GUID *guid) static DWORD WINAPI DllThread( LPVOID arg ) { - WCHAR buffer[64] = {'m','s','i','e','x','e','c','.','e','x','e',' ','-','E','m','b','e','d','d','i','n','g',' ',0}; + static const WCHAR msiexecW[] = {'\\','m','s','i','e','x','e','c','.','e','x','e',0}; + static const WCHAR argsW[] = {' ','-','E','m','b','e','d','d','i','n','g',' ',0}; + msi_custom_action_info *info; PROCESS_INFORMATION pi = {0}; STARTUPINFOW si = {0}; + WCHAR buffer[MAX_PATH], cmdline[MAX_PATH + 60]; RPC_STATUS status; GUID *guid = arg; + void *cookie; + BOOL wow64; + DWORD arch; DWORD rc; TRACE("custom action (%x) started\n", GetCurrentThreadId() ); @@ -606,8 +612,27 @@ static DWORD WINAPI DllThread( LPVOID arg ) return status; } - StringFromGUID2(guid, buffer + strlenW(buffer), 39); - CreateProcessW(NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); + info = find_action_by_guid(guid); + GetBinaryTypeW(info->source, &arch); + + if (sizeof(void *) == 8 && arch == SCS_32BIT_BINARY) + GetSystemWow64DirectoryW(buffer, MAX_PATH - sizeof(msiexecW)/sizeof(WCHAR)); + else + GetSystemDirectoryW(buffer, MAX_PATH - sizeof(msiexecW)/sizeof(WCHAR)); + strcatW(buffer, msiexecW); + strcpyW(cmdline, buffer); + strcatW(cmdline, argsW); + StringFromGUID2(guid, cmdline + strlenW(cmdline), 39); + + if (IsWow64Process(GetCurrentProcess(), &wow64) && wow64 && arch == SCS_64BIT_BINARY) + { + Wow64DisableWow64FsRedirection(&cookie); + CreateProcessW(buffer, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); + Wow64RevertWow64FsRedirection(cookie); + } + else + CreateProcessW(buffer, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); + WaitForSingleObject(pi.hProcess, INFINITE); GetExitCodeProcess(pi.hProcess, &rc); CloseHandle(pi.hProcess);
2 years, 9 months
1
0
0
0
[reactos] 48/360: [WINESYNC] msi/tests: Add trailing '\n's to ok() calls.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7a16dc22c543ba5d7637e…
commit 7a16dc22c543ba5d7637e04d7378b5bd63362fb9 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sat Mar 12 15:12:09 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:27:43 2022 +0100 [WINESYNC] msi/tests: Add trailing '\n's to ok() calls. Signed-off-by: Francois Gouget <fgouget(a)free.fr> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 4d1c3a022bcf28d46aa38cec458ac701b3cc615f by Francois Gouget <fgouget(a)free.fr> --- modules/rostests/winetests/msi/db.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/rostests/winetests/msi/db.c b/modules/rostests/winetests/msi/db.c index e2328ab784a..477ab0ad399 100644 --- a/modules/rostests/winetests/msi/db.c +++ b/modules/rostests/winetests/msi/db.c @@ -9719,8 +9719,8 @@ static void test_primary_keys(void) r = MsiRecordGetFieldCount(keys); ok(r == 1, "got %d\n", r); - ok(check_record(keys, 0, "T"), "expected 'T'"); - ok(check_record(keys, 1, "A"), "expected 'A'"); + ok(check_record(keys, 0, "T"), "expected 'T'\n"); + ok(check_record(keys, 1, "A"), "expected 'A'\n"); MsiCloseHandle(keys); @@ -9732,9 +9732,9 @@ static void test_primary_keys(void) r = MsiRecordGetFieldCount(keys); ok(r == 2, "got %d\n", r); - ok(check_record(keys, 0, "U"), "expected 'U'"); - ok(check_record(keys, 1, "B"), "expected 'B'"); - ok(check_record(keys, 2, "C"), "expected 'C'"); + ok(check_record(keys, 0, "U"), "expected 'U'\n"); + ok(check_record(keys, 1, "B"), "expected 'B'\n"); + ok(check_record(keys, 2, "C"), "expected 'C'\n"); MsiCloseHandle(keys); MsiCloseHandle(hdb);
2 years, 9 months
1
0
0
0
[reactos] 47/360: [WINESYNC] msi: Initialize [out] strings to NULL.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=db6dce432d050546c1ae9…
commit db6dce432d050546c1ae93afb99c489948d70748 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sat Mar 12 15:12:09 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:27:42 2022 +0100 [WINESYNC] msi: Initialize [out] strings to NULL. 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 71c0738c0e2598d2af9e31e2e82b69e6a5081e51 by Zebediah Figura <z.figura12(a)gmail.com> --- dll/win32/msi/custom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c index 25066a70d02..d6a8e11aec6 100644 --- a/dll/win32/msi/custom.c +++ b/dll/win32/msi/custom.c @@ -497,10 +497,10 @@ UINT __wine_msi_call_dll_function(const GUID *guid) RPC_WSTR binding_str; MSIHANDLE hPackage; RPC_STATUS status; + LPWSTR dll = NULL; + LPSTR proc = NULL; HANDLE hModule; HANDLE thread; - LPWSTR dll; - LPSTR proc; INT type; UINT r;
2 years, 9 months
1
0
0
0
[reactos] 46/360: [WINESYNC] msi: Execute custom actions in a separate process.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a8bc3902bac9f5d74b274…
commit a8bc3902bac9f5d74b274155825160c525b20868 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sat Mar 12 15:12:08 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:27:42 2022 +0100 [WINESYNC] msi: Execute custom actions in a separate process. 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 85d1fb62b321e890004bc8d0ded7a0183216c42d by Zebediah Figura <z.figura12(a)gmail.com> --- base/system/msiexec/msiexec.c | 9 ++- dll/win32/msi/CMakeLists.txt | 11 +++- dll/win32/msi/cond.y | 2 +- dll/win32/msi/custom.c | 103 ++++++++++++++++++++++---------- dll/win32/msi/database.c | 8 +-- dll/win32/msi/format.c | 2 +- dll/win32/msi/handle.c | 4 +- dll/win32/msi/install.c | 2 +- dll/win32/msi/msi.c | 2 +- dll/win32/msi/msi.spec | 2 + dll/win32/msi/msipriv.h | 2 +- dll/win32/msi/msiquery.c | 12 ++-- dll/win32/msi/msvchelper.h | 25 -------- dll/win32/msi/package.c | 44 +++++++------- dll/win32/msi/suminfo.c | 2 +- dll/win32/msi/winemsi.idl | 5 +- modules/rostests/winetests/msi/custom.c | 2 +- 17 files changed, 132 insertions(+), 105 deletions(-) diff --git a/base/system/msiexec/msiexec.c b/base/system/msiexec/msiexec.c index 8dcd216380e..2ed055771f6 100644 --- a/base/system/msiexec/msiexec.c +++ b/base/system/msiexec/msiexec.c @@ -393,10 +393,13 @@ static DWORD DoUnregServer(void) return ret; } -static INT DoEmbedding( LPWSTR key ) +extern UINT __wine_msi_call_dll_function(GUID *guid); + +static int DoEmbedding(LPCWSTR key) { - printf("Remote custom actions are not supported yet\n"); - return 1; + GUID guid; + CLSIDFromString(key, &guid); + return __wine_msi_call_dll_function(&guid); } /* diff --git a/dll/win32/msi/CMakeLists.txt b/dll/win32/msi/CMakeLists.txt index d3eb231a0fd..60f6d8f1e1b 100644 --- a/dll/win32/msi/CMakeLists.txt +++ b/dll/win32/msi/CMakeLists.txt @@ -52,11 +52,18 @@ list(APPEND SOURCE BISON_TARGET(cond cond.y ${CMAKE_CURRENT_BINARY_DIR}/cond.tab.c COMPILE_FLAGS "-p cond_") BISON_TARGET(sql sql.y ${CMAKE_CURRENT_BINARY_DIR}/sql.tab.c COMPILE_FLAGS "-p sql_") +set(OLD_IDL_FLAGS ${IDL_FLAGS}) +set(IDL_FLAGS ${IDL_FLAGS} --prefix-server=s_) +add_rpc_files(client winemsi.idl) +add_rpc_files(server winemsi.idl) +set(IDL_FLAGS ${OLD_IDL_FLAGS}) + list(APPEND PCH_SKIP_SOURCE ${BISON_cond_OUTPUTS} ${BISON_sql_OUTPUTS} ${CMAKE_CURRENT_BINARY_DIR}/msiserver_i.c - ${CMAKE_CURRENT_BINARY_DIR}/winemsi_i.c + ${CMAKE_CURRENT_BINARY_DIR}/winemsi_c.c + ${CMAKE_CURRENT_BINARY_DIR}/winemsi_s.c ${CMAKE_CURRENT_BINARY_DIR}/msi_stubs.c) add_library(msi MODULE @@ -80,7 +87,7 @@ set_module_type(msi win32dll) target_link_libraries(msi uuid ${PSEH_LIB} wine) add_dependencies(msi msi_idlheader) add_delay_importlibs(msi odbccp32 crypt32 wintrust) -add_importlibs(msi advapi32 advapi32_vista cabinet comctl32 gdi32 ole32 oleaut32 shell32 shlwapi urlmon user32 version wininet mspatcha +add_importlibs(msi advapi32 advapi32_vista cabinet comctl32 gdi32 ole32 oleaut32 shell32 shlwapi rpcrt4 urlmon user32 version wininet mspatcha #FIXME : should be in delayed imports imagehlp msvcrt diff --git a/dll/win32/msi/cond.y b/dll/win32/msi/cond.y index a8c97340db9..780ca381f93 100644 --- a/dll/win32/msi/cond.y +++ b/dll/win32/msi/cond.y @@ -37,7 +37,7 @@ #include "oleauto.h" #include "msipriv.h" -#include "winemsi.h" +#include "winemsi_s.h" #include "wine/debug.h" #include "wine/unicode.h" #include "wine/list.h" diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c index e5636083451..25066a70d02 100644 --- a/dll/win32/msi/custom.c +++ b/dll/win32/msi/custom.c @@ -35,16 +35,12 @@ #include "oleauto.h" #include "msipriv.h" -#include "winemsi.h" +#include "winemsi_s.h" #include "wine/heap.h" #include "wine/debug.h" #include "wine/unicode.h" #include "wine/exception.h" -#ifdef _MSC_VER -#include "msvchelper.h" -#endif - WINE_DEFAULT_DEBUG_CHANNEL(msi); #define CUSTOM_ACTION_TYPE_MASK 0x3F @@ -491,35 +487,18 @@ static void handle_msi_break(LPCSTR target) DebugBreak(); } -#ifdef __i386__ -extern UINT CUSTOMPROC_wrapper( MsiCustomActionEntryPoint proc, MSIHANDLE handle ); -__ASM_GLOBAL_FUNC( CUSTOMPROC_wrapper, - "pushl %ebp\n\t" - __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") - __ASM_CFI(".cfi_rel_offset %ebp,0\n\t") - "movl %esp,%ebp\n\t" - __ASM_CFI(".cfi_def_cfa_register %ebp\n\t") - "subl $4,%esp\n\t" - "pushl 12(%ebp)\n\t" - "movl 8(%ebp),%eax\n\t" - "call *%eax\n\t" - "leave\n\t" - __ASM_CFI(".cfi_def_cfa %esp,4\n\t") - __ASM_CFI(".cfi_same_value %ebp\n\t") - "ret" ) -#else -static inline UINT CUSTOMPROC_wrapper( MsiCustomActionEntryPoint proc, MSIHANDLE handle ) -{ - return proc(handle); -} -#endif +static WCHAR ncalrpcW[] = {'n','c','a','l','r','p','c',0}; +static WCHAR endpoint_lrpcW[] = {'m','s','i',0}; -static DWORD ACTION_CallDllFunction( const GUID *guid ) +UINT __wine_msi_call_dll_function(const GUID *guid) { MsiCustomActionEntryPoint fn; MSIHANDLE remote_package = 0; + RPC_WSTR binding_str; MSIHANDLE hPackage; + RPC_STATUS status; HANDLE hModule; + HANDLE thread; LPWSTR dll; LPSTR proc; INT type; @@ -527,6 +506,23 @@ static DWORD ACTION_CallDllFunction( const GUID *guid ) TRACE("%s\n", debugstr_guid( guid )); + status = RpcStringBindingComposeW(NULL, ncalrpcW, NULL, endpoint_lrpcW, NULL, &binding_str); + if (status != RPC_S_OK) + { + ERR("RpcStringBindingCompose failed: %#x\n", status); + return status; + } + status = RpcBindingFromStringBindingW(binding_str, &rpc_handle); + if (status != RPC_S_OK) + { + ERR("RpcBindingFromStringBinding failed: %#x\n", status); + return status; + } + RpcStringFreeW(&binding_str); + + /* We need this to unmarshal streams, and some apps expect it to be present. */ + CoInitializeEx(NULL, COINIT_MULTITHREADED); + r = remote_GetActionInfo(guid, &type, &dll, &proc, &remote_package); if (r != ERROR_SUCCESS) return r; @@ -549,7 +545,9 @@ static DWORD ACTION_CallDllFunction( const GUID *guid ) __TRY { - r = CUSTOMPROC_wrapper( fn, hPackage ); + thread = CreateThread(NULL, 0, (void *)fn, (void *)(ULONG_PTR) hPackage, 0, NULL); + WaitForSingleObject(thread, INFINITE); + GetExitCodeThread(thread, &r); } __EXCEPT_PAGE_FAULT { @@ -573,17 +571,56 @@ static DWORD ACTION_CallDllFunction( const GUID *guid ) midl_user_free(dll); midl_user_free(proc); + CoUninitialize(); + + RpcBindingFree(&rpc_handle); + return r; } static DWORD WINAPI DllThread( LPVOID arg ) { - LPGUID guid = arg; - DWORD rc = 0; + WCHAR buffer[64] = {'m','s','i','e','x','e','c','.','e','x','e',' ','-','E','m','b','e','d','d','i','n','g',' ',0}; + PROCESS_INFORMATION pi = {0}; + STARTUPINFOW si = {0}; + RPC_STATUS status; + GUID *guid = arg; + DWORD rc; TRACE("custom action (%x) started\n", GetCurrentThreadId() ); - rc = ACTION_CallDllFunction( guid ); + CoInitializeEx(NULL, COINIT_MULTITHREADED); /* needed to marshal streams */ + + status = RpcServerUseProtseqEpW(ncalrpcW, RPC_C_PROTSEQ_MAX_REQS_DEFAULT, endpoint_lrpcW, NULL); + if (status != RPC_S_OK) + { + ERR("RpcServerUseProtseqEp failed: %#x\n", status); + return status; + } + + status = RpcServerRegisterIfEx((RPC_IF_HANDLE)s_IWineMsiRemote_v0_0_s_ifspec, NULL, NULL, + RPC_IF_AUTOLISTEN, RPC_C_LISTEN_MAX_CALLS_DEFAULT, NULL); + if (status != RPC_S_OK) + { + ERR("RpcServerRegisterIfEx failed: %#x\n", status); + return status; + } + + StringFromGUID2(guid, buffer + strlenW(buffer), 39); + CreateProcessW(NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); + WaitForSingleObject(pi.hProcess, INFINITE); + GetExitCodeProcess(pi.hProcess, &rc); + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + + status = RpcServerUnregisterIf((RPC_IF_HANDLE)s_IWineMsiRemote_v0_0_s_ifspec, NULL, FALSE); + if (status != RPC_S_OK) + { + ERR("RpcServerUnregisterIf failed: %#x\n", status); + return status; + } + + CoUninitialize(); TRACE("custom action (%x) returned %i\n", GetCurrentThreadId(), rc ); @@ -1348,7 +1385,7 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package) LeaveCriticalSection( &msi_custom_action_cs ); } -UINT __cdecl remote_GetActionInfo(const GUID *guid, int *type, LPWSTR *dll, LPSTR *func, MSIHANDLE *hinst) +UINT __cdecl s_remote_GetActionInfo(const GUID *guid, int *type, LPWSTR *dll, LPSTR *func, MSIHANDLE *hinst) { msi_custom_action_info *info; diff --git a/dll/win32/msi/database.c b/dll/win32/msi/database.c index 1657a353ba0..303667d52b8 100644 --- a/dll/win32/msi/database.c +++ b/dll/win32/msi/database.c @@ -2017,12 +2017,12 @@ MSIDBSTATE WINAPI MsiGetDatabaseState( MSIHANDLE handle ) return ret; } -MSICONDITION __cdecl remote_DatabaseIsTablePersistent(MSIHANDLE db, LPCWSTR table) +MSICONDITION __cdecl s_remote_DatabaseIsTablePersistent(MSIHANDLE db, LPCWSTR table) { return MsiDatabaseIsTablePersistentW(db, table); } -UINT __cdecl remote_DatabaseGetPrimaryKeys(MSIHANDLE db, LPCWSTR table, struct wire_record **rec) +UINT __cdecl s_remote_DatabaseGetPrimaryKeys(MSIHANDLE db, LPCWSTR table, struct wire_record **rec) { MSIHANDLE handle; UINT r = MsiDatabaseGetPrimaryKeysW(db, table, &handle); @@ -2033,12 +2033,12 @@ UINT __cdecl remote_DatabaseGetPrimaryKeys(MSIHANDLE db, LPCWSTR table, struct w return r; } -UINT __cdecl remote_DatabaseGetSummaryInformation(MSIHANDLE db, UINT updatecount, MSIHANDLE *suminfo) +UINT __cdecl s_remote_DatabaseGetSummaryInformation(MSIHANDLE db, UINT updatecount, MSIHANDLE *suminfo) { return MsiGetSummaryInformationW(db, NULL, updatecount, suminfo); } -UINT __cdecl remote_DatabaseOpenView(MSIHANDLE db, LPCWSTR query, MSIHANDLE *view) +UINT __cdecl s_remote_DatabaseOpenView(MSIHANDLE db, LPCWSTR query, MSIHANDLE *view) { return MsiDatabaseOpenViewW(db, query, view); } diff --git a/dll/win32/msi/format.c b/dll/win32/msi/format.c index 0533cc004ce..6f187581516 100644 --- a/dll/win32/msi/format.c +++ b/dll/win32/msi/format.c @@ -34,7 +34,7 @@ #include "oleauto.h" #include "msipriv.h" -#include "winemsi.h" +#include "winemsi_s.h" #include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); diff --git a/dll/win32/msi/handle.c b/dll/win32/msi/handle.c index 1002f9d969b..d2731935a3d 100644 --- a/dll/win32/msi/handle.c +++ b/dll/win32/msi/handle.c @@ -31,7 +31,7 @@ #include "msiquery.h" #include "msipriv.h" -#include "winemsi.h" +#include "winemsi_s.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -344,7 +344,7 @@ UINT WINAPI MsiCloseAllHandles(void) return n; } -UINT __cdecl remote_CloseHandle(MSIHANDLE handle) +UINT __cdecl s_remote_CloseHandle(MSIHANDLE handle) { return MsiCloseHandle(handle); } diff --git a/dll/win32/msi/install.c b/dll/win32/msi/install.c index 45c55375bfd..382f20b7aa0 100644 --- a/dll/win32/msi/install.c +++ b/dll/win32/msi/install.c @@ -33,7 +33,7 @@ #include "oleauto.h" #include "msipriv.h" -#include "winemsi.h" +#include "winemsi_s.h" #include "wine/heap.h" #include "wine/debug.h" #include "wine/unicode.h" diff --git a/dll/win32/msi/msi.c b/dll/win32/msi/msi.c index 2ec94a1cfb6..b53c2241e43 100644 --- a/dll/win32/msi/msi.c +++ b/dll/win32/msi/msi.c @@ -41,7 +41,7 @@ #include "softpub.h" #include "msipriv.h" -#include "winemsi.h" +#include "winemsi_s.h" #include "initguid.h" #include "msxml2.h" diff --git a/dll/win32/msi/msi.spec b/dll/win32/msi/msi.spec index 4288c9d408f..aecba1b1b38 100644 --- a/dll/win32/msi/msi.spec +++ b/dll/win32/msi/msi.spec @@ -294,3 +294,5 @@ @ stdcall -private DllGetClassObject(ptr ptr ptr) @ stdcall -private DllRegisterServer() @ stdcall -private DllUnregisterServer() + +@ cdecl __wine_msi_call_dll_function(ptr) diff --git a/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h index 4a92bd0e943..f1f689e153f 100644 --- a/dll/win32/msi/msipriv.h +++ b/dll/win32/msi/msipriv.h @@ -39,7 +39,7 @@ #include "wine/debug.h" #include "msiserver.h" -#include "winemsi.h" +#include "winemsi_s.h" static const BOOL is_64bit = sizeof(void *) > sizeof(int); BOOL is_wow64 DECLSPEC_HIDDEN; diff --git a/dll/win32/msi/msiquery.c b/dll/win32/msi/msiquery.c index 42ee8c79d02..83ec59c45dc 100644 --- a/dll/win32/msi/msiquery.c +++ b/dll/win32/msi/msiquery.c @@ -35,7 +35,7 @@ #include "msipriv.h" #include "query.h" -#include "winemsi.h" +#include "winemsi_s.h" #include "initguid.h" @@ -1093,12 +1093,12 @@ MSICONDITION WINAPI MsiDatabaseIsTablePersistentW( return r; } -UINT __cdecl remote_ViewClose(MSIHANDLE view) +UINT __cdecl s_remote_ViewClose(MSIHANDLE view) { return MsiViewClose(view); } -UINT __cdecl remote_ViewExecute(MSIHANDLE view, struct wire_record *remote_rec) +UINT __cdecl s_remote_ViewExecute(MSIHANDLE view, struct wire_record *remote_rec) { MSIHANDLE rec = 0; UINT r; @@ -1112,7 +1112,7 @@ UINT __cdecl remote_ViewExecute(MSIHANDLE view, struct wire_record *remote_rec) return r; } -UINT __cdecl remote_ViewFetch(MSIHANDLE view, struct wire_record **rec) +UINT __cdecl s_remote_ViewFetch(MSIHANDLE view, struct wire_record **rec) { MSIHANDLE handle; UINT r = MsiViewFetch(view, &handle); @@ -1123,7 +1123,7 @@ UINT __cdecl remote_ViewFetch(MSIHANDLE view, struct wire_record **rec) return r; } -UINT __cdecl remote_ViewGetColumnInfo(MSIHANDLE view, MSICOLINFO info, struct wire_record **rec) +UINT __cdecl s_remote_ViewGetColumnInfo(MSIHANDLE view, MSICOLINFO info, struct wire_record **rec) { MSIHANDLE handle; UINT r = MsiViewGetColumnInfo(view, info, &handle); @@ -1134,7 +1134,7 @@ UINT __cdecl remote_ViewGetColumnInfo(MSIHANDLE view, MSICOLINFO info, struct wi return r; } -UINT __cdecl remote_ViewModify(MSIHANDLE view, MSIMODIFY mode, +UINT __cdecl s_remote_ViewModify(MSIHANDLE view, MSIMODIFY mode, struct wire_record *remote_rec, struct wire_record **remote_refreshed) { MSIHANDLE handle = 0; diff --git a/dll/win32/msi/msvchelper.h b/dll/win32/msi/msvchelper.h deleted file mode 100644 index 0ad6d72308d..00000000000 --- a/dll/win32/msi/msvchelper.h +++ /dev/null @@ -1,25 +0,0 @@ - -#ifdef __i386__ - -typedef unsigned int (__stdcall *__MSVC__MsiCustomActionEntryPoint)(unsigned int); - -static -__declspec(naked) -unsigned int -__cdecl -CUSTOMPROC_wrapper(__MSVC__MsiCustomActionEntryPoint proc, unsigned int handle) -{ - __asm - { - push ebp - mov ebp, esp - sub esp, 4 - push dword ptr [ebp + 12] - mov eax, dword ptr [ebp + 8] - call eax - leave - ret - } -} - -#endif diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c index 510dd43b2ad..1e4c0874d8a 100644 --- a/dll/win32/msi/package.c +++ b/dll/win32/msi/package.c @@ -47,7 +47,7 @@ #include "wine/unicode.h" #include "msipriv.h" -#include "winemsi.h" +#include "winemsi_s.h" #include "resource.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -2428,12 +2428,12 @@ UINT WINAPI MsiGetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, return MSI_GetProperty( hInstall, szName, &val, pchValueBuf ); } -MSIHANDLE __cdecl remote_GetActiveDatabase(MSIHANDLE hinst) +MSIHANDLE __cdecl s_remote_GetActiveDatabase(MSIHANDLE hinst) { return MsiGetActiveDatabase(hinst); } -UINT __cdecl remote_GetProperty(MSIHANDLE hinst, LPCWSTR property, LPWSTR *value, DWORD *size) +UINT __cdecl s_remote_GetProperty(MSIHANDLE hinst, LPCWSTR property, LPWSTR *value, DWORD *size) { WCHAR empty[1]; UINT r; @@ -2451,12 +2451,12 @@ UINT __cdecl remote_GetProperty(MSIHANDLE hinst, LPCWSTR property, LPWSTR *value return r; } -UINT __cdecl remote_SetProperty(MSIHANDLE hinst, LPCWSTR property, LPCWSTR value) +UINT __cdecl s_remote_SetProperty(MSIHANDLE hinst, LPCWSTR property, LPCWSTR value) { return MsiSetPropertyW(hinst, property, value); } -int __cdecl remote_ProcessMessage(MSIHANDLE hinst, INSTALLMESSAGE message, struct wire_record *remote_rec) +int __cdecl s_remote_ProcessMessage(MSIHANDLE hinst, INSTALLMESSAGE message, struct wire_record *remote_rec) { MSIHANDLE rec; int ret; @@ -2471,17 +2471,17 @@ int __cdecl remote_ProcessMessage(MSIHANDLE hinst, INSTALLMESSAGE message, struc return ret; } -UINT __cdecl remote_DoAction(MSIHANDLE hinst, LPCWSTR action) +UINT __cdecl s_remote_DoAction(MSIHANDLE hinst, LPCWSTR action) { return MsiDoActionW(hinst, action); } -UINT __cdecl remote_Sequence(MSIHANDLE hinst, LPCWSTR table, int sequence) +UINT __cdecl s_remote_Sequence(MSIHANDLE hinst, LPCWSTR table, int sequence) { return MsiSequenceW(hinst, table, sequence); } -UINT __cdecl remote_GetTargetPath(MSIHANDLE hinst, LPCWSTR folder, LPWSTR *value) +UINT __cdecl s_remote_GetTargetPath(MSIHANDLE hinst, LPCWSTR folder, LPWSTR *value) { WCHAR empty[1]; DWORD size = 0; @@ -2498,12 +2498,12 @@ UINT __cdecl remote_GetTargetPath(MSIHANDLE hinst, LPCWSTR folder, LPWSTR *value return r; } -UINT __cdecl remote_SetTargetPath(MSIHANDLE hinst, LPCWSTR folder, LPCWSTR value) +UINT __cdecl s_remote_SetTargetPath(MSIHANDLE hinst, LPCWSTR folder, LPCWSTR value) { return MsiSetTargetPathW(hinst, folder, value); } -UINT __cdecl remote_GetSourcePath(MSIHANDLE hinst, LPCWSTR folder, LPWSTR *value) +UINT __cdecl s_remote_GetSourcePath(MSIHANDLE hinst, LPCWSTR folder, LPWSTR *value) { WCHAR empty[1]; DWORD size = 1; @@ -2520,49 +2520,49 @@ UINT __cdecl remote_GetSourcePath(MSIHANDLE hinst, LPCWSTR folder, LPWSTR *value return r; } -BOOL __cdecl remote_GetMode(MSIHANDLE hinst, MSIRUNMODE mode) +BOOL __cdecl s_remote_GetMode(MSIHANDLE hinst, MSIRUNMODE mode) { return MsiGetMode(hinst, mode); } -UINT __cdecl remote_SetMode(MSIHANDLE hinst, MSIRUNMODE mode, BOOL state) +UINT __cdecl s_remote_SetMode(MSIHANDLE hinst, MSIRUNMODE mode, BOOL state) { return MsiSetMode(hinst, mode, state); } -UINT __cdecl remote_GetFeatureState(MSIHANDLE hinst, LPCWSTR feature, +UINT __cdecl s_remote_GetFeatureState(MSIHANDLE hinst, LPCWSTR feature, INSTALLSTATE *installed, INSTALLSTATE *action) { return MsiGetFeatureStateW(hinst, feature, installed, action); } -UINT __cdecl remote_SetFeatureState(MSIHANDLE hinst, LPCWSTR feature, INSTALLSTATE state) +UINT __cdecl s_remote_SetFeatureState(MSIHANDLE hinst, LPCWSTR feature, INSTALLSTATE state) { return MsiSetFeatureStateW(hinst, feature, state); } -UINT __cdecl remote_GetComponentState(MSIHANDLE hinst, LPCWSTR component, +UINT __cdecl s_remote_GetComponentState(MSIHANDLE hinst, LPCWSTR component, INSTALLSTATE *installed, INSTALLSTATE *action) { return MsiGetComponentStateW(hinst, component, installed, action); } -UINT __cdecl remote_SetComponentState(MSIHANDLE hinst, LPCWSTR component, INSTALLSTATE state) +UINT __cdecl s_remote_SetComponentState(MSIHANDLE hinst, LPCWSTR component, INSTALLSTATE state) { return MsiSetComponentStateW(hinst, component, state); } -LANGID __cdecl remote_GetLanguage(MSIHANDLE hinst) +LANGID __cdecl s_remote_GetLanguage(MSIHANDLE hinst) { return MsiGetLanguage(hinst); } -UINT __cdecl remote_SetInstallLevel(MSIHANDLE hinst, int level) +UINT __cdecl s_remote_SetInstallLevel(MSIHANDLE hinst, int level) { return MsiSetInstallLevel(hinst, level); } -UINT __cdecl remote_FormatRecord(MSIHANDLE hinst, struct wire_record *remote_rec, LPWSTR *value) +UINT __cdecl s_remote_FormatRecord(MSIHANDLE hinst, struct wire_record *remote_rec, LPWSTR *value) { WCHAR empty[1]; DWORD size = 0; @@ -2585,18 +2585,18 @@ UINT __cdecl remote_FormatRecord(MSIHANDLE hinst, struct wire_record *remote_rec return r; } -MSICONDITION __cdecl remote_EvaluateCondition(MSIHANDLE hinst, LPCWSTR condition) +MSICONDITION __cdecl s_remote_EvaluateCondition(MSIHANDLE hinst, LPCWSTR condition) { return MsiEvaluateConditionW(hinst, condition); } -UINT __cdecl remote_GetFeatureCost(MSIHANDLE hinst, LPCWSTR feature, +UINT __cdecl s_remote_GetFeatureCost(MSIHANDLE hinst, LPCWSTR feature, MSICOSTTREE cost_tree, INSTALLSTATE state, INT *cost) { return MsiGetFeatureCostW(hinst, feature, cost_tree, state, cost); } -UINT __cdecl remote_EnumComponentCosts(MSIHANDLE hinst, LPCWSTR component, +UINT __cdecl s_remote_EnumComponentCosts(MSIHANDLE hinst, LPCWSTR component, DWORD index, INSTALLSTATE state, LPWSTR drive, INT *cost, INT *temp) { DWORD size = 3; diff --git a/dll/win32/msi/suminfo.c b/dll/win32/msi/suminfo.c index 0268f631288..f9bdf38edf3 100644 --- a/dll/win32/msi/suminfo.c +++ b/dll/win32/msi/suminfo.c @@ -38,7 +38,7 @@ #include "propvarutil.h" #include "msipriv.h" -#include "winemsi.h" +#include "winemsi_s.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); diff --git a/dll/win32/msi/winemsi.idl b/dll/win32/msi/winemsi.idl index 8af175999b8..50f62fcbfd8 100644 --- a/dll/win32/msi/winemsi.idl +++ b/dll/win32/msi/winemsi.idl @@ -18,6 +18,8 @@ */ #pragma makedep header +#pragma makedep client +#pragma makedep server import "objidl.idl"; @@ -55,7 +57,8 @@ struct wire_record { }; [ - uuid(56D58B64-8780-4c22-A8BC-8B0B29E4A9F8) + uuid(56D58B64-8780-4c22-A8BC-8B0B29E4A9F8), + implicit_handle(handle_t rpc_handle) ] interface IWineMsiRemote { diff --git a/modules/rostests/winetests/msi/custom.c b/modules/rostests/winetests/msi/custom.c index 35b3d71f52b..04946d907d3 100644 --- a/modules/rostests/winetests/msi/custom.c +++ b/modules/rostests/winetests/msi/custom.c @@ -993,7 +993,7 @@ UINT WINAPI main_test(MSIHANDLE hinst) /* Test for an MTA apartment */ hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk); - todo_wine_ok(hinst, hr == S_OK, "CoCreateInstance failed with %08x\n", hr); + ok(hinst, hr == S_OK, "CoCreateInstance failed with %08x\n", hr); if (unk) IUnknown_Release(unk);
2 years, 9 months
1
0
0
0
[reactos] 45/360: [WINESYNC] msi: Make remote_GetActionInfo() RPC-compatible.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c2e9daf59eab5a94e43be…
commit c2e9daf59eab5a94e43be6f5f2cbf94e75f7b6d3 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sat Mar 12 15:12:07 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:27:42 2022 +0100 [WINESYNC] msi: Make remote_GetActionInfo() RPC-compatible. 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 2635333922f13c0312b3cdae08f7cf870e10f49a by Zebediah Figura <z.figura12(a)gmail.com> --- dll/win32/msi/custom.c | 74 +++++++++++++++++------------------------------ dll/win32/msi/winemsi.idl | 4 +-- 2 files changed, 29 insertions(+), 49 deletions(-) diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c index 7a05cb5d670..e5636083451 100644 --- a/dll/win32/msi/custom.c +++ b/dll/win32/msi/custom.c @@ -25,6 +25,7 @@ #define COBJMACROS #include <stdarg.h> +#include <stdio.h> #include "windef.h" #include "winbase.h" #include "winerror.h" @@ -472,37 +473,21 @@ static msi_custom_action_info *find_action_by_guid( const GUID *guid ) return info; } -static void handle_msi_break( LPCWSTR target ) +static void handle_msi_break(LPCSTR target) { - LPWSTR msg; - WCHAR val[MAX_PATH]; + char format[] = "To debug your custom action, attach your debugger to " + "process %i (0x%X) and press OK"; + char val[MAX_PATH]; + char msg[100]; - static const WCHAR MsiBreak[] = { 'M','s','i','B','r','e','a','k',0 }; - static const WCHAR WindowsInstaller[] = { - 'W','i','n','d','o','w','s',' ','I','n','s','t','a','l','l','e','r',0 - }; - - static const WCHAR format[] = { - 'T','o',' ','d','e','b','u','g',' ','y','o','u','r',' ', - 'c','u','s','t','o','m',' ','a','c','t','i','o','n',',',' ', - 'a','t','t','a','c','h',' ','y','o','u','r',' ','d','e','b','u','g','g','e','r',' ', - 't','o',' ','p','r','o','c','e','s','s',' ','%','i',' ','(','0','x','%','X',')',' ', - 'a','n','d',' ','p','r','e','s','s',' ','O','K',0 - }; - - if( !GetEnvironmentVariableW( MsiBreak, val, MAX_PATH )) + if (!GetEnvironmentVariableA("MsiBreak", val, MAX_PATH)) return; - if( strcmpiW( val, target )) + if (strcasecmp(val, target)) return; - msg = msi_alloc( (lstrlenW(format) + 10) * sizeof(WCHAR) ); - if (!msg) - return; - - wsprintfW( msg, format, GetCurrentProcessId(), GetCurrentProcessId()); - MessageBoxW( NULL, msg, WindowsInstaller, MB_OK); - msi_free(msg); + sprintf(msg, format, GetCurrentProcessId(), GetCurrentProcessId()); + MessageBoxA(NULL, msg, "Windows Installer", MB_OK); DebugBreak(); } @@ -535,14 +520,14 @@ static DWORD ACTION_CallDllFunction( const GUID *guid ) MSIHANDLE remote_package = 0; MSIHANDLE hPackage; HANDLE hModule; + LPWSTR dll; LPSTR proc; - UINT r = ERROR_FUNCTION_FAILED; - BSTR dll = NULL, function = NULL; INT type; + UINT r; TRACE("%s\n", debugstr_guid( guid )); - r = remote_GetActionInfo( guid, &type, &dll, &function, &remote_package ); + r = remote_GetActionInfo(guid, &type, &dll, &proc, &remote_package); if (r != ERROR_SUCCESS) return r; @@ -553,16 +538,14 @@ static DWORD ACTION_CallDllFunction( const GUID *guid ) return ERROR_SUCCESS; } - proc = strdupWtoA( function ); fn = (MsiCustomActionEntryPoint) GetProcAddress( hModule, proc ); - msi_free( proc ); if (fn) { hPackage = alloc_msi_remote_handle( remote_package ); if (hPackage) { - TRACE("calling %s\n", debugstr_w( function ) ); - handle_msi_break( function ); + TRACE("calling %s\n", debugstr_a(proc)); + handle_msi_break(proc); __TRY { @@ -571,7 +554,7 @@ static DWORD ACTION_CallDllFunction( const GUID *guid ) __EXCEPT_PAGE_FAULT { ERR("Custom action (%s:%s) caused a page fault: %08x\n", - debugstr_w(dll), debugstr_w(function), GetExceptionCode()); + debugstr_w(dll), debugstr_a(proc), GetExceptionCode()); r = ERROR_SUCCESS; } __ENDTRY; @@ -582,13 +565,13 @@ static DWORD ACTION_CallDllFunction( const GUID *guid ) ERR("failed to create handle for %x\n", remote_package ); } else - ERR("GetProcAddress(%s) failed\n", debugstr_w( function ) ); + ERR("GetProcAddress(%s) failed\n", debugstr_a(proc)); FreeLibrary(hModule); MsiCloseHandle(hPackage); - SysFreeString( dll ); - SysFreeString( function ); + midl_user_free(dll); + midl_user_free(proc); return r; } @@ -1365,22 +1348,19 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package) LeaveCriticalSection( &msi_custom_action_cs ); } -HRESULT __cdecl remote_GetActionInfo( const GUID *custom_action_guid, - INT *type, BSTR *dll, BSTR *func, MSIHANDLE *remote_package ) +UINT __cdecl remote_GetActionInfo(const GUID *guid, int *type, LPWSTR *dll, LPSTR *func, MSIHANDLE *hinst) { msi_custom_action_info *info; - MSIHANDLE handle; - info = find_action_by_guid( custom_action_guid ); + info = find_action_by_guid(guid); if (!info) - return E_FAIL; + return ERROR_INVALID_DATA; *type = info->type; - handle = alloc_msihandle( &info->package->hdr ); - *dll = SysAllocString( info->source ); - *func = SysAllocString( info->target ); + *hinst = alloc_msihandle(&info->package->hdr); + *dll = strdupW(info->source); + *func = strdupWtoA(info->target); - release_custom_action_data( info ); - *remote_package = handle; - return S_OK; + release_custom_action_data(info); + return ERROR_SUCCESS; } diff --git a/dll/win32/msi/winemsi.idl b/dll/win32/msi/winemsi.idl index 388450084e9..8af175999b8 100644 --- a/dll/win32/msi/winemsi.idl +++ b/dll/win32/msi/winemsi.idl @@ -94,7 +94,7 @@ interface IWineMsiRemote UINT remote_EnumComponentCosts( [in] MSIHANDLE hinst, [in, string, unique] LPCWSTR component, [in] DWORD index, [in] INSTALLSTATE state, [out, string, size_is(3)] LPWSTR drive, [out] INT *cost, [out] INT *temp ); - HRESULT remote_GetActionInfo( [in] LPCGUID guid, [out] INT *type, [out] BSTR *dllname, - [out] BSTR *function, [out] MSIHANDLE *package ); + UINT remote_GetActionInfo( [in] const GUID *guid, [out] int *type, [out, string] LPWSTR *dllname, + [out, string] LPSTR *function, [out] MSIHANDLE *hinst ); UINT remote_CloseHandle( [in] MSIHANDLE handle ); }
2 years, 9 months
1
0
0
0
[reactos] 44/360: [WINESYNC] msi: Make MsiEnumComponentCosts RPC-compatible.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3919813408ffae7e45885…
commit 3919813408ffae7e45885fe81c54187fc4153749 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sat Mar 12 15:12:07 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:27:42 2022 +0100 [WINESYNC] msi: Make MsiEnumComponentCosts RPC-compatible. 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 efb8ed4748e75e88240cb27f3f917f6ed3446901 by Zebediah Figura <z.figura12(a)gmail.com> --- dll/win32/msi/msi.c | 20 +++--- dll/win32/msi/package.c | 9 ++- dll/win32/msi/winemsi.idl | 4 +- modules/rostests/winetests/msi/custom.c | 111 +++++++++++++++++++++++++++++++- 4 files changed, 124 insertions(+), 20 deletions(-) diff --git a/dll/win32/msi/msi.c b/dll/win32/msi/msi.c index c0af7f52f62..2ec94a1cfb6 100644 --- a/dll/win32/msi/msi.c +++ b/dll/win32/msi/msi.c @@ -2005,25 +2005,21 @@ UINT WINAPI MsiEnumComponentCostsW( MSIHANDLE handle, LPCWSTR component, DWORD i if (!drive || !buflen || !cost || !temp) return ERROR_INVALID_PARAMETER; if (!(package = msihandle2msiinfo( handle, MSIHANDLETYPE_PACKAGE ))) { + WCHAR buffer[3]; MSIHANDLE remote; - HRESULT hr; - BSTR bname = NULL; if (!(remote = msi_get_remote(handle))) return ERROR_INVALID_HANDLE; - if (component && !(bname = SysAllocString( component ))) - return ERROR_OUTOFMEMORY; - - hr = remote_EnumComponentCosts(remote, bname, index, state, drive, buflen, cost, temp); - - SysFreeString( bname ); - if (FAILED(hr)) + r = remote_EnumComponentCosts(remote, component, index, state, buffer, cost, temp); + if (r == ERROR_SUCCESS) { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) return HRESULT_CODE(hr); - return ERROR_FUNCTION_FAILED; + lstrcpynW(drive, buffer, *buflen); + if (*buflen < 3) + r = ERROR_MORE_DATA; + *buflen = 2; } - return ERROR_SUCCESS; + return r; } if (!msi_get_property_int( package->db, szCostingComplete, 0 )) diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c index 12893f3ad1d..510dd43b2ad 100644 --- a/dll/win32/msi/package.c +++ b/dll/win32/msi/package.c @@ -2596,12 +2596,11 @@ UINT __cdecl remote_GetFeatureCost(MSIHANDLE hinst, LPCWSTR feature, return MsiGetFeatureCostW(hinst, feature, cost_tree, state, cost); } -HRESULT __cdecl remote_EnumComponentCosts(MSIHANDLE hinst, BSTR component, - DWORD index, INSTALLSTATE state, BSTR drive, - DWORD *buflen, INT *cost, INT *temp) +UINT __cdecl remote_EnumComponentCosts(MSIHANDLE hinst, LPCWSTR component, + DWORD index, INSTALLSTATE state, LPWSTR drive, INT *cost, INT *temp) { - UINT r = MsiEnumComponentCostsW(hinst, component, index, state, drive, buflen, cost, temp); - return HRESULT_FROM_WIN32(r); + DWORD size = 3; + return MsiEnumComponentCostsW(hinst, component, index, state, drive, &size, cost, temp); } UINT msi_package_add_info(MSIPACKAGE *package, DWORD context, DWORD options, diff --git a/dll/win32/msi/winemsi.idl b/dll/win32/msi/winemsi.idl index fa98ac00434..388450084e9 100644 --- a/dll/win32/msi/winemsi.idl +++ b/dll/win32/msi/winemsi.idl @@ -91,8 +91,8 @@ interface IWineMsiRemote UINT remote_FormatRecord( [in] MSIHANDLE hinst, [in] struct wire_record *record, [out, string] LPWSTR *value); MSICONDITION remote_EvaluateCondition( [in] MSIHANDLE hinst, [in, string] LPCWSTR condition ); UINT remote_GetFeatureCost( [in] MSIHANDLE hinst, [in, string] LPCWSTR feature, [in] MSICOSTTREE cost_tree, [in] INSTALLSTATE state, [out] INT *cost ); - HRESULT remote_EnumComponentCosts( [in] MSIHANDLE hinst, [in] BSTR component, [in] DWORD index, [in] INSTALLSTATE state, - [out, size_is(*buflen)] BSTR drive, [in, out] DWORD *buflen, [out] INT *cost, [out] INT *temp ); + UINT remote_EnumComponentCosts( [in] MSIHANDLE hinst, [in, string, unique] LPCWSTR component, [in] DWORD index, [in] INSTALLSTATE state, + [out, string, size_is(3)] LPWSTR drive, [out] INT *cost, [out] INT *temp ); HRESULT remote_GetActionInfo( [in] LPCGUID guid, [out] INT *type, [out] BSTR *dllname, [out] BSTR *function, [out] MSIHANDLE *package ); diff --git a/modules/rostests/winetests/msi/custom.c b/modules/rostests/winetests/msi/custom.c index ecd172a7161..35b3d71f52b 100644 --- a/modules/rostests/winetests/msi/custom.c +++ b/modules/rostests/winetests/msi/custom.c @@ -857,7 +857,13 @@ static void test_format_record(MSIHANDLE hinst) static void test_costs(MSIHANDLE hinst) { - INT cost; + 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; + DWORD sz; UINT r; cost = 0xdead; @@ -872,6 +878,109 @@ static void test_costs(MSIHANDLE hinst) r = MsiGetFeatureCostA(hinst, "One", MSICOSTTREE_CHILDREN, INSTALLSTATE_LOCAL, &cost); ok(hinst, !r, "got %u\n", r); todo_wine_ok(hinst, cost == 8, "got %d\n", cost); + + sz = cost = temp = 0xdead; + r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, NULL, &sz, &cost, &temp); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + ok(hinst, sz == 0xdead, "got size %d\n", sz); + ok(hinst, cost == 0xdead, "got cost %d\n", cost); + ok(hinst, temp == 0xdead, "got temp %d\n", temp); + + cost = temp = 0xdead; + r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, NULL, &cost, &temp); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + ok(hinst, cost == 0xdead, "got cost %d\n", cost); + ok(hinst, temp == 0xdead, "got temp %d\n", temp); + + sz = temp = 0xdead; + r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, NULL, &temp); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + ok(hinst, sz == 0xdead, "got size %d\n", sz); + ok(hinst, temp == 0xdead, "got temp %d\n", temp); + + sz = cost = 0xdead; + r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, NULL); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + ok(hinst, sz == 0xdead, "got size %d\n", sz); + ok(hinst, cost == 0xdead, "got cost %d\n", cost); + + cost = temp = 0xdead; + sz = sizeof(buffer); + r = MsiEnumComponentCostsA(hinst, NULL, 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp); + ok(hinst, !r, "got %u\n", r); + ok(hinst, sz == 2, "got size %u\n", sz); + ok(hinst, !strcmp(buffer, "C:"), "got '%s'\n", buffer); + ok(hinst, !cost, "got cost %d\n", cost); + ok(hinst, temp && temp != 0xdead, "got temp %d\n", temp); + + cost = temp = 0xdead; + sz = sizeof(buffer); + r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp); + ok(hinst, !r, "got %u\n", r); + ok(hinst, sz == 2, "got size %u\n", sz); + ok(hinst, !strcmp(buffer, "C:"), "got '%s'\n", buffer); + ok(hinst, cost == 8, "got cost %d\n", cost); + ok(hinst, !temp, "got temp %d\n", temp); + + /* same string behaviour */ + cost = temp = 0xdead; + sz = 0; + strcpy(buffer,"q"); + r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, !strcmp(buffer, "q"), "got \"%s\"\n", buffer); + todo_wine_ok(hinst, sz == 4, "got size %u\n", sz); + ok(hinst, cost == 8, "got cost %d\n", cost); + ok(hinst, !temp, "got temp %d\n", temp); + + sz = 1; + strcpy(buffer,"x"); + r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + todo_wine_ok(hinst, !buffer[0], "got \"%s\"\n", buffer); + todo_wine_ok(hinst, sz == 4, "got size %u\n", sz); + + sz = 2; + strcpy(buffer,"x"); + r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + todo_wine_ok(hinst, !strcmp(buffer, "C"), "got \"%s\"\n", buffer); + todo_wine_ok(hinst, sz == 4, "got size %u\n", sz); + + sz = 3; + strcpy(buffer,"x"); + r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp); + ok(hinst, !r, "got %u\n", r); + ok(hinst, !strcmp(buffer, "C:"), "got \"%s\"\n", buffer); + ok(hinst, sz == 2, "got size %u\n", sz); + + sz = 0; + bufferW[0] = 'q'; + r = MsiEnumComponentCostsW(hinst, oneW, 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); + 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); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, !lstrcmpW(bufferW, xyW), "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); + ok(hinst, !r, "got %u\n", r); + ok(hinst, !lstrcmpW(bufferW, xyzW), "got %s\n", dbgstr_w(bufferW)); + ok(hinst, sz == 2, "got size %u\n", sz); } /* Main test. Anything that doesn't depend on a specific install configuration
2 years, 9 months
1
0
0
0
[reactos] 43/360: [WINESYNC] msi: Make MsiGetFeatureCost() RPC-compatible.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9f3e4bbbecd13e8644621…
commit 9f3e4bbbecd13e8644621e6be87d3d44262bb5be Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sat Mar 12 15:12:06 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:27:42 2022 +0100 [WINESYNC] msi: Make MsiGetFeatureCost() RPC-compatible. 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 e500af2b678da519011588ee6973bda19999f34d by Zebediah Figura <z.figura12(a)gmail.com> --- dll/win32/msi/install.c | 22 ++++------------------ dll/win32/msi/package.c | 7 +++---- dll/win32/msi/winemsi.idl | 3 ++- modules/rostests/winetests/msi/custom.c | 20 ++++++++++++++++++++ modules/rostests/winetests/msi/install.c | 1 + 5 files changed, 30 insertions(+), 23 deletions(-) diff --git a/dll/win32/msi/install.c b/dll/win32/msi/install.c index 63aed1eeebe..45c55375bfd 100644 --- a/dll/win32/msi/install.c +++ b/dll/win32/msi/install.c @@ -1068,29 +1068,15 @@ UINT WINAPI MsiGetFeatureCostW(MSIHANDLE hInstall, LPCWSTR szFeature, if (!package) { MSIHANDLE remote; - HRESULT hr; - BSTR feature; if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE; - feature = SysAllocString(szFeature); - if (!feature) - return ERROR_OUTOFMEMORY; - - hr = remote_GetFeatureCost(remote, feature, iCostTree, iState, piCost); - - SysFreeString(feature); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } + /* FIXME: should use SEH */ + if (!piCost) + return RPC_X_NULL_REF_POINTER; - return ERROR_SUCCESS; + return remote_GetFeatureCost(remote, szFeature, iCostTree, iState, piCost); } if (!piCost) diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c index d4cbe0766da..12893f3ad1d 100644 --- a/dll/win32/msi/package.c +++ b/dll/win32/msi/package.c @@ -2590,11 +2590,10 @@ MSICONDITION __cdecl remote_EvaluateCondition(MSIHANDLE hinst, LPCWSTR condition return MsiEvaluateConditionW(hinst, condition); } -HRESULT __cdecl remote_GetFeatureCost(MSIHANDLE hinst, BSTR feature, - INT cost_tree, INSTALLSTATE state, INT *cost) +UINT __cdecl remote_GetFeatureCost(MSIHANDLE hinst, LPCWSTR feature, + MSICOSTTREE cost_tree, INSTALLSTATE state, INT *cost) { - UINT r = MsiGetFeatureCostW(hinst, feature, cost_tree, state, cost); - return HRESULT_FROM_WIN32(r); + return MsiGetFeatureCostW(hinst, feature, cost_tree, state, cost); } HRESULT __cdecl remote_EnumComponentCosts(MSIHANDLE hinst, BSTR component, diff --git a/dll/win32/msi/winemsi.idl b/dll/win32/msi/winemsi.idl index 6bdd117160f..fa98ac00434 100644 --- a/dll/win32/msi/winemsi.idl +++ b/dll/win32/msi/winemsi.idl @@ -29,6 +29,7 @@ typedef int MSIRUNMODE; typedef int INSTALLSTATE; typedef int MSICOLINFO; typedef int MSIMODIFY; +typedef int MSICOSTTREE; #define MSIFIELD_NULL 0 #define MSIFIELD_INT 1 @@ -89,7 +90,7 @@ interface IWineMsiRemote UINT remote_SetInstallLevel( [in] MSIHANDLE hinst, [in] int level ); UINT remote_FormatRecord( [in] MSIHANDLE hinst, [in] struct wire_record *record, [out, string] LPWSTR *value); MSICONDITION remote_EvaluateCondition( [in] MSIHANDLE hinst, [in, string] LPCWSTR condition ); - HRESULT remote_GetFeatureCost( [in] MSIHANDLE hinst, [in] BSTR feature, [in] INT cost_tree, [in] INSTALLSTATE state, [out] INT *cost ); + UINT remote_GetFeatureCost( [in] MSIHANDLE hinst, [in, string] LPCWSTR feature, [in] MSICOSTTREE cost_tree, [in] INSTALLSTATE state, [out] INT *cost ); HRESULT remote_EnumComponentCosts( [in] MSIHANDLE hinst, [in] BSTR component, [in] DWORD index, [in] INSTALLSTATE state, [out, size_is(*buflen)] BSTR drive, [in, out] DWORD *buflen, [out] INT *cost, [out] INT *temp ); diff --git a/modules/rostests/winetests/msi/custom.c b/modules/rostests/winetests/msi/custom.c index 2035a8f7295..ecd172a7161 100644 --- a/modules/rostests/winetests/msi/custom.c +++ b/modules/rostests/winetests/msi/custom.c @@ -855,6 +855,25 @@ static void test_format_record(MSIHANDLE hinst) MsiCloseHandle(rec); } +static void test_costs(MSIHANDLE hinst) +{ + INT cost; + UINT r; + + cost = 0xdead; + r = MsiGetFeatureCostA(hinst, NULL, MSICOSTTREE_CHILDREN, INSTALLSTATE_LOCAL, &cost); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + todo_wine_ok(hinst, !cost, "got %d\n", cost); + + r = MsiGetFeatureCostA(hinst, "One", MSICOSTTREE_CHILDREN, INSTALLSTATE_LOCAL, NULL); + ok(hinst, r == RPC_X_NULL_REF_POINTER, "got %u\n", r); + + cost = 0xdead; + r = MsiGetFeatureCostA(hinst, "One", MSICOSTTREE_CHILDREN, INSTALLSTATE_LOCAL, &cost); + ok(hinst, !r, "got %u\n", r); + todo_wine_ok(hinst, cost == 8, "got %d\n", cost); +} + /* Main test. Anything that doesn't depend on a specific install configuration * or have undesired side effects should go here. */ UINT WINAPI main_test(MSIHANDLE hinst) @@ -885,6 +904,7 @@ UINT WINAPI main_test(MSIHANDLE hinst) test_misc(hinst); test_feature_states(hinst); test_format_record(hinst); + test_costs(hinst); return ERROR_SUCCESS; } diff --git a/modules/rostests/winetests/msi/install.c b/modules/rostests/winetests/msi/install.c index 6a7383b3607..5c83d303fa2 100644 --- a/modules/rostests/winetests/msi/install.c +++ b/modules/rostests/winetests/msi/install.c @@ -698,6 +698,7 @@ static const CHAR ca1_install_exec_seq_dat[] = "Action\tCondition\tSequence\n" "CostInitialize\t\t100\n" "FileCost\t\t200\n" "CostFinalize\t\t300\n" + "InstallValidate\t\t400\n" "embednull\t\t600\n" "maintest\tMAIN_TEST\t700\n" "testretval\tTEST_RETVAL\t710\n";
2 years, 9 months
1
0
0
0
[reactos] 42/360: [WINESYNC] msi: Handle some invalid parameters in MsiGetFeatureCost().
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=818a84dd11866d3cd17d6…
commit 818a84dd11866d3cd17d684c4a6235e64e24526a Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sat Mar 12 15:12:06 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:27:41 2022 +0100 [WINESYNC] msi: Handle some invalid parameters in MsiGetFeatureCost(). 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 1b6adcb7216a6b4a0706ac7255f3ddb832656127 by Zebediah Figura <z.figura12(a)gmail.com> --- dll/win32/msi/install.c | 9 +++++++++ modules/rostests/winetests/msi/package.c | 18 ++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/dll/win32/msi/install.c b/dll/win32/msi/install.c index b9290b4a8d0..63aed1eeebe 100644 --- a/dll/win32/msi/install.c +++ b/dll/win32/msi/install.c @@ -1061,6 +1061,9 @@ UINT WINAPI MsiGetFeatureCostW(MSIHANDLE hInstall, LPCWSTR szFeature, TRACE("(%d %s %i %i %p)\n", hInstall, debugstr_w(szFeature), iCostTree, iState, piCost); + if (!szFeature) + return ERROR_INVALID_PARAMETER; + package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); if (!package) { @@ -1090,6 +1093,12 @@ UINT WINAPI MsiGetFeatureCostW(MSIHANDLE hInstall, LPCWSTR szFeature, return ERROR_SUCCESS; } + if (!piCost) + { + msiobj_release( &package->hdr ); + return ERROR_INVALID_PARAMETER; + } + feature = msi_get_loaded_feature(package, szFeature); if (feature) diff --git a/modules/rostests/winetests/msi/package.c b/modules/rostests/winetests/msi/package.c index c2e2106c38b..d26e2fdb56f 100644 --- a/modules/rostests/winetests/msi/package.c +++ b/modules/rostests/winetests/msi/package.c @@ -8479,7 +8479,7 @@ static void test_MsiApplyPatch(void) ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r); } -static void test_MsiEnumComponentCosts(void) +static void test_costs(void) { MSIHANDLE hdb, hpkg; char package[12], drive[3]; @@ -8662,6 +8662,20 @@ static void test_MsiEnumComponentCosts(void) r = MsiEnumComponentCostsA( hpkg, "", 1, INSTALLSTATE_UNKNOWN, drive, &len, &cost, &temp ); ok( r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %u\n", r ); + /* test MsiGetFeatureCost */ + cost = 0xdead; + r = MsiGetFeatureCostA( hpkg, NULL, MSICOSTTREE_SELFONLY, INSTALLSTATE_LOCAL, &cost ); + ok( r == ERROR_INVALID_PARAMETER, "got %u\n", r); + ok( cost == 0xdead, "got %d\n", cost ); + + r = MsiGetFeatureCostA( hpkg, "one", MSICOSTTREE_SELFONLY, INSTALLSTATE_LOCAL, NULL ); + ok( r == ERROR_INVALID_PARAMETER, "got %u\n", r); + + cost = 0xdead; + r = MsiGetFeatureCostA( hpkg, "one", MSICOSTTREE_SELFONLY, INSTALLSTATE_LOCAL, &cost ); + ok( !r, "got %u\n", r); + ok( cost == 8, "got %d\n", cost ); + MsiCloseHandle( hpkg ); error: MsiCloseHandle( hdb ); @@ -9702,7 +9716,7 @@ START_TEST(package) test_MsiSetProperty(); test_MsiApplyMultiplePatches(); test_MsiApplyPatch(); - test_MsiEnumComponentCosts(); + test_costs(); test_MsiDatabaseCommit(); test_externalui(); test_externalui_message();
2 years, 9 months
1
0
0
0
← Newer
1
...
33
34
35
36
37
38
39
...
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