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] 351/360: [WINESYNC] msi: Fix memory leak in get_fusion_filename (Coverity).
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=848267813e68a5ac66522…
commit 848267813e68a5ac665220dd58aea1c0ea2f6bb9 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Mar 14 21:12:25 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:44 2022 +0100 [WINESYNC] msi: Fix memory leak in get_fusion_filename (Coverity). Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id ad90181e1407bc4ffe81e55f07f83b23c09cccb8 by Alex Henrie <alexhenrie24(a)gmail.com> --- dll/win32/msi/package.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c index 14ddcb79a57..b65b9e98959 100644 --- a/dll/win32/msi/package.c +++ b/dll/win32/msi/package.c @@ -559,6 +559,7 @@ static LPWSTR get_fusion_filename(MSIPACKAGE *package) GetWindowsDirectoryW(windir, MAX_PATH); len = lstrlenW(windir) + lstrlenW(L"Microsoft.NET\\Framework\\") + lstrlenW(L"v2.0.50727") + lstrlenW(L"fusion.dll") + 3; + msi_free(filename); if (!(filename = msi_alloc(len * sizeof(WCHAR)))) return NULL; lstrcpyW(filename, windir);
2 years, 9 months
1
0
0
0
[reactos] 350/360: [WINESYNC] msi/tests: Use CRT allocation functions.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6aefc5b976c60249604b0…
commit 6aefc5b976c60249604b070b6148c85b2a5a896c Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Mar 14 21:12:25 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:44 2022 +0100 [WINESYNC] msi/tests: Use CRT allocation functions. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 11ddaf067f80749fa1a40b28dba3aa3f88a70623 by Hans Leidekker <hans(a)codeweavers.com> --- modules/rostests/winetests/msi/action.c | 20 +++++++-------- modules/rostests/winetests/msi/automation.c | 20 +++++++-------- modules/rostests/winetests/msi/db.c | 9 +++---- modules/rostests/winetests/msi/format.c | 5 ++-- modules/rostests/winetests/msi/install.c | 28 ++++++++++----------- modules/rostests/winetests/msi/msi.c | 29 ++++++++++----------- modules/rostests/winetests/msi/package.c | 39 +++++++++++++---------------- modules/rostests/winetests/msi/patch.c | 8 +++--- modules/rostests/winetests/msi/source.c | 10 ++++---- 9 files changed, 79 insertions(+), 89 deletions(-) diff --git a/modules/rostests/winetests/msi/action.c b/modules/rostests/winetests/msi/action.c index 2787ed48da0..b5b80efe63e 100644 --- a/modules/rostests/winetests/msi/action.c +++ b/modules/rostests/winetests/msi/action.c @@ -2412,10 +2412,10 @@ static char *get_user_sid(void) OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token); GetTokenInformation(token, TokenUser, NULL, size, &size); - user = HeapAlloc(GetProcessHeap(), 0, size); + user = malloc(size); GetTokenInformation(token, TokenUser, user, size, &size); ConvertSidToStringSidA(user->User.Sid, &usersid); - HeapFree(GetProcessHeap(), 0, user); + free(user); CloseHandle(token); return usersid; @@ -3025,7 +3025,7 @@ error: DeleteFileA(msifile); DeleteFileA("msitest\\maximus"); RemoveDirectoryA("msitest"); - HeapFree(GetProcessHeap(), 0, usersid); + free(usersid); } static void test_publish_product(void) @@ -3262,7 +3262,7 @@ error: DeleteFileA(msifile); DeleteFileA("msitest\\maximus"); RemoveDirectoryA("msitest"); - HeapFree(GetProcessHeap(), 0, usersid); + free(usersid); } static void test_publish_features(void) @@ -3387,7 +3387,7 @@ error: DeleteFileA(msifile); DeleteFileA("msitest\\maximus"); RemoveDirectoryA("msitest"); - HeapFree(GetProcessHeap(), 0, usersid); + free(usersid); } static LPSTR reg_get_val_str(HKEY hkey, LPCSTR name) @@ -3401,7 +3401,7 @@ static LPSTR reg_get_val_str(HKEY hkey, LPCSTR name) return NULL; len += sizeof (WCHAR); - val = HeapAlloc(GetProcessHeap(), 0, len); + val = malloc(len); if (!val) return NULL; val[0] = 0; RegQueryValueExA(hkey, name, NULL, NULL, (LPBYTE)val, &len); @@ -3541,8 +3541,8 @@ static void test_register_user(void) delete_key(HKEY_LOCAL_MACHINE, keypath, access); error: - HeapFree(GetProcessHeap(), 0, company); - HeapFree(GetProcessHeap(), 0, owner); + free(company); + free(owner); DeleteFileA(msifile); DeleteFileA("msitest\\maximus"); @@ -5784,7 +5784,7 @@ static void test_publish_components(void) res = RegQueryValueExA(key, "english.txt", NULL, NULL, NULL, &size); ok(res == ERROR_SUCCESS, "value not found %d\n", res); - data = HeapAlloc(GetProcessHeap(), 0, size); + data = malloc(size); res = RegQueryValueExA(key, "english.txt", NULL, NULL, data, &size); ok(res == ERROR_SUCCESS, "value not found %d\n", res); RegCloseKey(key); @@ -5815,7 +5815,7 @@ static void test_publish_components(void) res = RegSetValueExA(key, "english.txt", 0, REG_MULTI_SZ, data, size); ok(res == ERROR_SUCCESS, "RegSetValueEx failed %d\n", res); - HeapFree(GetProcessHeap(), 0, data); + free(data); RegCloseKey(key); r = MsiInstallProductA(msifile, "REMOVE=ALL"); diff --git a/modules/rostests/winetests/msi/automation.c b/modules/rostests/winetests/msi/automation.c index 093b78568ae..bd040b153da 100644 --- a/modules/rostests/winetests/msi/automation.c +++ b/modules/rostests/winetests/msi/automation.c @@ -310,7 +310,7 @@ static void create_database(const CHAR *name, const msi_table *tables, int num_t int j, len; len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 ); - if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return; + if (!(nameW = malloc( len * sizeof(WCHAR) ))) return; MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len ); r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db); @@ -335,7 +335,7 @@ static void create_database(const CHAR *name, const msi_table *tables, int num_t ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); MsiCloseHandle(db); - HeapFree( GetProcessHeap(), 0, nameW ); + free( nameW ); } static BOOL create_package(LPWSTR path) @@ -506,12 +506,12 @@ static DISPID get_dispid( IDispatch *disp, const char *name ) HRESULT r; len = MultiByteToWideChar(CP_ACP, 0, name, -1, NULL, 0 ); - str = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR) ); + str = malloc( len * sizeof(WCHAR) ); if (str) { MultiByteToWideChar(CP_ACP, 0, name, -1, str, len ); r = IDispatch_GetIDsOfNames( disp, &IID_NULL, &str, 1, 0, &id ); - HeapFree(GetProcessHeap(), 0, str); + free( str ); if (r != S_OK) return -1; } @@ -849,11 +849,11 @@ static HRESULT invoke(IDispatch *pDispatch, LPCSTR szName, WORD wFlags, DISPPARA VariantInit(pVarResult); len = MultiByteToWideChar(CP_ACP, 0, szName, -1, NULL, 0 ); - name = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR) ); + name = malloc(len * sizeof(WCHAR)); if (!name) return E_FAIL; MultiByteToWideChar(CP_ACP, 0, szName, -1, name, len ); hr = IDispatch_GetIDsOfNames(pDispatch, &IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &dispid); - HeapFree(GetProcessHeap(), 0, name); + free(name); ok(hr == S_OK, "IDispatch::GetIDsOfNames returned 0x%08x\n", hr); if (hr != S_OK) return hr; @@ -2333,13 +2333,13 @@ static UINT delete_registry_key(HKEY hkeyParent, LPCSTR subkey, REGSAM access) if (ret != ERROR_SUCCESS) return ret; ret = RegQueryInfoKeyA(hkey, NULL, NULL, NULL, NULL, &dwSize, NULL, NULL, NULL, NULL, NULL, NULL); if (ret != ERROR_SUCCESS) return ret; - if (!(string = HeapAlloc(GetProcessHeap(), 0, ++dwSize))) return ERROR_NOT_ENOUGH_MEMORY; + if (!(string = malloc(++dwSize))) return ERROR_NOT_ENOUGH_MEMORY; while (RegEnumKeyA(hkey, 0, string, dwSize) == ERROR_SUCCESS) delete_registry_key(hkey, string, access); RegCloseKey(hkey); - HeapFree(GetProcessHeap(), 0, string); + free(string); delete_key_portable(hkeyParent, subkey, access); return ERROR_SUCCESS; } @@ -2360,7 +2360,7 @@ static UINT find_registry_key(HKEY hkeyParent, LPCSTR subkey, LPCSTR findkey, RE if (ret != ERROR_SUCCESS) return ret; ret = RegQueryInfoKeyA(hkey, NULL, NULL, NULL, NULL, &dwSize, NULL, NULL, NULL, NULL, NULL, NULL); if (ret != ERROR_SUCCESS) return ret; - if (!(string = HeapAlloc(GetProcessHeap(), 0, ++dwSize))) return ERROR_NOT_ENOUGH_MEMORY; + if (!(string = malloc(++dwSize))) return ERROR_NOT_ENOUGH_MEMORY; while (!found && RegEnumKeyA(hkey, idx++, string, dwSize) == ERROR_SUCCESS) @@ -2374,7 +2374,7 @@ static UINT find_registry_key(HKEY hkeyParent, LPCSTR subkey, LPCSTR findkey, RE } if (*phkey != hkey) RegCloseKey(hkey); - HeapFree(GetProcessHeap(), 0, string); + free(string); return (found ? ERROR_SUCCESS : ERROR_FILE_NOT_FOUND); } diff --git a/modules/rostests/winetests/msi/db.c b/modules/rostests/winetests/msi/db.c index b75e5f7a4b5..b2a60f5b304 100644 --- a/modules/rostests/winetests/msi/db.c +++ b/modules/rostests/winetests/msi/db.c @@ -323,10 +323,10 @@ static inline UINT add_entry(const char *file, int line, const char *type, MSIHA UINT sz, r; sz = strlen(values) + strlen(insert) + 1; - query = HeapAlloc(GetProcessHeap(), 0, sz); + query = malloc(sz); sprintf(query, insert, values); r = run_query(hdb, 0, query); - HeapFree(GetProcessHeap(), 0, query); + free(query); ok_(file, line)(r == ERROR_SUCCESS, "failed to insert into %s table: %u\n", type, r); return r; } @@ -1465,15 +1465,14 @@ static void test_longstrings(void) ok(r == ERROR_SUCCESS, "query failed\n"); /* try to insert a very long string */ - str = HeapAlloc(GetProcessHeap(), 0, STRING_LENGTH+sizeof insert_query); + str = malloc(STRING_LENGTH + sizeof insert_query); len = strchr(insert_query, 'Z') - insert_query; strcpy(str, insert_query); memset(str+len, 'Z', STRING_LENGTH); strcpy(str+len+STRING_LENGTH, insert_query+len+1); r = try_query( hdb, str ); ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); - - HeapFree(GetProcessHeap(), 0, str); + free(str); r = MsiDatabaseCommit(hdb); ok(r == ERROR_SUCCESS, "MsiDatabaseCommit failed\n"); diff --git a/modules/rostests/winetests/msi/format.c b/modules/rostests/winetests/msi/format.c index 88d8180a50c..06f901fb84c 100644 --- a/modules/rostests/winetests/msi/format.c +++ b/modules/rostests/winetests/msi/format.c @@ -61,13 +61,12 @@ static UINT helper_createpackage( const char *szName, MSIHANDLE *handle ) DeleteFileA(szName); len = MultiByteToWideChar( CP_ACP, 0, szName, -1, NULL, 0 ); - if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) - return ERROR_OUTOFMEMORY; + if (!(nameW = malloc( len * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY; MultiByteToWideChar( CP_ACP, 0, szName, -1, nameW, len ); /* create an empty database */ res = MsiOpenDatabaseW( nameW, MSIDBOPEN_CREATEDIRECT, &hdb ); - HeapFree( GetProcessHeap(), 0, nameW ); + free( nameW ); ok( res == ERROR_SUCCESS , "Failed to create database %u\n", res ); if (res != ERROR_SUCCESS) return res; diff --git a/modules/rostests/winetests/msi/install.c b/modules/rostests/winetests/msi/install.c index ce650b84d61..ae5b03e248c 100644 --- a/modules/rostests/winetests/msi/install.c +++ b/modules/rostests/winetests/msi/install.c @@ -2125,12 +2125,12 @@ static const msi_table sr_tables[] = static void * CDECL mem_alloc(ULONG cb) { - return HeapAlloc(GetProcessHeap(), 0, cb); + return malloc(cb); } static void CDECL mem_free(void *memory) { - HeapFree(GetProcessHeap(), 0, memory); + free(memory); } static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv) @@ -2302,18 +2302,17 @@ static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv) { LPSTR tempname; - tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH); + tempname = malloc(MAX_PATH); GetTempFileNameA(".", "xx", 0, tempname); if (tempname && (strlen(tempname) < (unsigned)cbTempName)) { lstrcpyA(pszTempName, tempname); - HeapFree(GetProcessHeap(), 0, tempname); + free(tempname); return TRUE; } - HeapFree(GetProcessHeap(), 0, tempname); - + free(tempname); return FALSE; } @@ -2551,12 +2550,11 @@ static BOOL compare_pf_data(const char *filename, const char *data, DWORD size) lstrcatA(path, filename); handle = CreateFileA(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - buffer = HeapAlloc(GetProcessHeap(), 0, size); - if (buffer) + if ((buffer = malloc(size))) { ReadFile(handle, buffer, size, &read, NULL); if (read == size && !memcmp(data, buffer, size)) ret = TRUE; - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer); } CloseHandle(handle); return ret; @@ -2707,7 +2705,7 @@ void create_database_wordcount(const CHAR *name, const msi_table *tables, int nu int j, len; len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 ); - if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return; + if (!(nameW = malloc( len * sizeof(WCHAR) ))) return; MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len ); r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db); @@ -2733,7 +2731,7 @@ void create_database_wordcount(const CHAR *name, const msi_table *tables, int nu ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); MsiCloseHandle(db); - HeapFree( GetProcessHeap(), 0, nameW ); + free( nameW ); } static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status) @@ -5266,8 +5264,8 @@ static void process_pending_renames(HKEY hkey) ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size); ok(!ret, "RegQueryValueExA failed %d\n", ret); - buf = HeapAlloc(GetProcessHeap(), 0, size + 1); - buf2ptr = buf2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + 1); + buf = malloc(size + 1); + buf2ptr = buf2 = calloc(1, size + 1); ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, (LPBYTE)buf, &size); buf[size] = 0; @@ -5318,8 +5316,8 @@ static void process_pending_renames(HKEY hkey) else RegDeleteValueA(hkey, rename_ops); - HeapFree(GetProcessHeap(), 0, buf); - HeapFree(GetProcessHeap(), 0, buf2); + free(buf); + free(buf2); } static BOOL file_matches_data(LPCSTR file, LPCSTR data) diff --git a/modules/rostests/winetests/msi/msi.c b/modules/rostests/winetests/msi/msi.c index 9ff543347c2..6e7ef68872d 100644 --- a/modules/rostests/winetests/msi/msi.c +++ b/modules/rostests/winetests/msi/msi.c @@ -966,9 +966,7 @@ static void test_null(void) ok ( r == ERROR_SUCCESS || r == ERROR_FILE_NOT_FOUND, "wrong error %d\n", r); if ( r == ERROR_SUCCESS ) { - lpData = HeapAlloc(GetProcessHeap(), 0, cbData); - if (!lpData) - skip("Out of memory\n"); + if (!(lpData = malloc(cbData))) skip("Out of memory\n"); else { r = RegQueryValueExA(hkey, NULL, 0, &dwType, lpData, &cbData); @@ -980,7 +978,7 @@ static void test_null(void) if (r == ERROR_ACCESS_DENIED) { skip("Not enough rights to perform tests\n"); - HeapFree(GetProcessHeap(), 0, lpData); + free(lpData); RegCloseKey(hkey); return; } @@ -993,8 +991,7 @@ static void test_null(void) { r = RegSetValueExA(hkey, NULL, 0, dwType, lpData, cbData); ok ( r == ERROR_SUCCESS, "wrong error %d\n", r); - - HeapFree(GetProcessHeap(), 0, lpData); + free(lpData); } else { @@ -1257,10 +1254,10 @@ static char *get_user_sid(void) OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token); GetTokenInformation(token, TokenUser, NULL, size, &size); - user = HeapAlloc(GetProcessHeap(), 0, size); + user = malloc(size); GetTokenInformation(token, TokenUser, user, size, &size); ConvertSidToStringSidA(user->User.Sid, &usersid); - HeapFree(GetProcessHeap(), 0, user); + free(user); CloseHandle(token); return usersid; @@ -4087,22 +4084,22 @@ static void get_version_info(LPSTR path, LPSTR *vercheck, LPDWORD verchecksz, DWORD size = GetFileVersionInfoSizeA(path, NULL); USHORT *lang; - version = HeapAlloc(GetProcessHeap(), 0, size); + version = malloc(size); GetFileVersionInfoA(path, 0, size, version); VerQueryValueA(version, "\\", (LPVOID *)&ffi, &size); - *vercheck = HeapAlloc(GetProcessHeap(), 0, MAX_PATH); + *vercheck = malloc(MAX_PATH); sprintf(*vercheck, "%d.%d.%d.%d", HIWORD(ffi->dwFileVersionMS), LOWORD(ffi->dwFileVersionMS), HIWORD(ffi->dwFileVersionLS), LOWORD(ffi->dwFileVersionLS)); *verchecksz = lstrlenA(*vercheck); VerQueryValueA(version, "\\VarFileInfo\\Translation", (void **)&lang, &size); - *langcheck = HeapAlloc(GetProcessHeap(), 0, MAX_PATH); + *langcheck = malloc(MAX_PATH); sprintf(*langcheck, "%d", *lang); *langchecksz = lstrlenA(*langcheck); - HeapFree(GetProcessHeap(), 0, version); + free(version); } static void test_MsiGetFileVersion(void) @@ -4286,8 +4283,8 @@ static void test_MsiGetFileVersion(void) if (langchecksz && !langsz) { win_skip("broken MsiGetFileVersionA detected\n"); - HeapFree(GetProcessHeap(), 0, vercheck); - HeapFree(GetProcessHeap(), 0, langcheck); + free(vercheck); + free(langcheck); return; } ok(versz == verchecksz, "Expected %d, got %d\n", verchecksz, versz); @@ -4372,8 +4369,8 @@ static void test_MsiGetFileVersion(void) r = MsiGetFileVersionA(path, NULL, NULL, NULL, NULL); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - HeapFree(GetProcessHeap(), 0, vercheck); - HeapFree(GetProcessHeap(), 0, langcheck); + free(vercheck); + free(langcheck); } static void test_MsiGetProductInfo(void) diff --git a/modules/rostests/winetests/msi/package.c b/modules/rostests/winetests/msi/package.c index 3b98d9ef111..556bc016997 100644 --- a/modules/rostests/winetests/msi/package.c +++ b/modules/rostests/winetests/msi/package.c @@ -133,10 +133,10 @@ static char *get_user_sid(void) OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token); GetTokenInformation(token, TokenUser, NULL, size, &size); - user = HeapAlloc(GetProcessHeap(), 0, size); + user = malloc(size); GetTokenInformation(token, TokenUser, user, size, &size); ConvertSidToStringSidA(user->User.Sid, &usersid); - HeapFree(GetProcessHeap(), 0, user); + free(user); CloseHandle(token); return usersid; @@ -167,7 +167,7 @@ static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM acce if (dwMaxLen > ARRAY_SIZE(szNameBuf)) { /* Name too big: alloc a buffer for it */ - if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR)))) + if (!(lpszName = malloc(dwMaxLen * sizeof(WCHAR)))) { ret = ERROR_NOT_ENOUGH_MEMORY; goto cleanup; @@ -204,10 +204,8 @@ static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM acce } cleanup: - if (lpszName != szNameBuf) - HeapFree(GetProcessHeap(), 0, lpszName); - if(lpszSubKey) - RegCloseKey(hSubKey); + if (lpszName != szNameBuf) free(lpszName); + if (lpszSubKey) RegCloseKey(hSubKey); return ret; } @@ -750,10 +748,10 @@ static inline UINT add_entry(const char *file, int line, const char *type, MSIHA UINT sz, r; sz = strlen(values) + strlen(insert) + 1; - query = HeapAlloc(GetProcessHeap(), 0, sz); + query = malloc(sz); sprintf(query, insert, values); r = run_query(hdb, query); - HeapFree(GetProcessHeap(), 0, query); + free(query); ok_(file, line)(r == ERROR_SUCCESS, "failed to insert into %s table: %u\n", type, r); return r; } @@ -867,10 +865,10 @@ static UINT add_reglocator_entry( MSIHANDLE hdb, const char *sig, UINT root, con UINT sz, r; sz = strlen( sig ) + 10 + strlen( path ) + strlen( name ) + 10 + sizeof( insert ); - query = HeapAlloc( GetProcessHeap(), 0, sz ); + query = malloc( sz ); sprintf( query, insert, sig, root, path, name, type ); r = run_query( hdb, query ); - HeapFree( GetProcessHeap(), 0, query ); + free( query ); ok(r == ERROR_SUCCESS, "failed to insert into reglocator table: %u\n", r); \ return r; } @@ -1028,7 +1026,7 @@ static BOOL create_file_with_version(const CHAR *name, LONG ms, LONG ls) CopyFileA(path, name, FALSE); size = GetFileVersionInfoSizeA(path, &handle); - buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); GetFileVersionInfoA(path, 0, size, buffer); @@ -1055,7 +1053,7 @@ static BOOL create_file_with_version(const CHAR *name, LONG ms, LONG ls) ret = TRUE; done: - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer); return ret; } @@ -4722,21 +4720,21 @@ static void test_appsearch_reglocator(void) if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) { size = ExpandEnvironmentStringsA("%PATH%", NULL, 0); - pathvar = HeapAlloc(GetProcessHeap(), 0, size); + pathvar = malloc(size); ExpandEnvironmentStringsA("%PATH%", pathvar, size); size = 0; r = MsiGetPropertyA(hpkg, "SIGPROP4", NULL, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - pathdata = HeapAlloc(GetProcessHeap(), 0, ++size); + pathdata = malloc(++size); r = MsiGetPropertyA(hpkg, "SIGPROP4", pathdata, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(pathdata, pathvar), "Expected \"%s\", got \"%s\"\n", pathvar, pathdata); - HeapFree(GetProcessHeap(), 0, pathvar); - HeapFree(GetProcessHeap(), 0, pathdata); + free(pathvar); + free(pathdata); } size = MAX_PATH; @@ -8802,22 +8800,21 @@ static void add_message(const struct externalui_message *msg) if (!sequence) { sequence_size = 10; - sequence = HeapAlloc(GetProcessHeap(), 0, sequence_size * sizeof(*sequence)); + sequence = malloc(sequence_size * sizeof(*sequence)); } if (sequence_count == sequence_size) { sequence_size *= 2; - sequence = HeapReAlloc(GetProcessHeap(), 0, sequence, sequence_size * sizeof(*sequence)); + sequence = realloc(sequence, sequence_size * sizeof(*sequence)); } assert(sequence); - sequence[sequence_count++] = *msg; } static void flush_sequence(void) { - HeapFree(GetProcessHeap(), 0, sequence); + free(sequence); sequence = NULL; sequence_count = sequence_size = 0; } diff --git a/modules/rostests/winetests/msi/patch.c b/modules/rostests/winetests/msi/patch.c index 65b3a5f1d48..8e8bd356e71 100644 --- a/modules/rostests/winetests/msi/patch.c +++ b/modules/rostests/winetests/msi/patch.c @@ -321,7 +321,7 @@ static void create_database( const char *filename, const struct msi_table *table int len; len = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 ); - if (!(filenameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return; + if (!(filenameW = malloc( len * sizeof(WCHAR) ))) return; MultiByteToWideChar( CP_ACP, 0, filename, -1, filenameW, len ); r = MsiOpenDatabaseW( filenameW, MSIDBOPEN_CREATE, &hdb ); @@ -345,7 +345,7 @@ static void create_database( const char *filename, const struct msi_table *table MsiCloseHandle( hdb ); set_suminfo( filenameW ); - HeapFree( GetProcessHeap(), 0, filenameW ); + free( filenameW ); } /* data for generating a patch */ @@ -704,11 +704,11 @@ static void create_patch( const char *filename ) const CLSID CLSID_MsiTransform = {0xc1082, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46}}; len = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 ); - filenameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + filenameW = malloc( len * sizeof(WCHAR) ); MultiByteToWideChar( CP_ACP, 0, filename, -1, filenameW, len ); r = StgCreateDocfile( filenameW, mode, 0, &stg ); - HeapFree( GetProcessHeap(), 0, filenameW ); + free( filenameW ); ok( r == S_OK, "failed to create storage 0x%08x\n", r ); if (!stg) return; diff --git a/modules/rostests/winetests/msi/source.c b/modules/rostests/winetests/msi/source.c index 32b5621e3bf..d141307e0ba 100644 --- a/modules/rostests/winetests/msi/source.c +++ b/modules/rostests/winetests/msi/source.c @@ -144,10 +144,10 @@ static char *get_user_sid(void) OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token); GetTokenInformation(token, TokenUser, NULL, size, &size); - user = HeapAlloc(GetProcessHeap(), 0, size); + user = malloc(size); GetTokenInformation(token, TokenUser, user, size, &size); ConvertSidToStringSidA(user->User.Sid, &usersid); - HeapFree(GetProcessHeap(), 0, user); + free(user); CloseHandle(token); return usersid; @@ -188,7 +188,7 @@ static inline WCHAR *strdupAW( const char *str ) int len; WCHAR *ret; len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); - if (!(ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return NULL; + if (!(ret = malloc( len * sizeof(WCHAR) ))) return NULL; MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len ); return ret; } @@ -448,8 +448,8 @@ static void test_MsiSourceListGetInfo(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!valueW[0], "Expected \"\""); ok(size == 0, "Expected 0, got %d\n", size); - HeapFree(GetProcessHeap(), 0, usersidW); - HeapFree(GetProcessHeap(), 0, prodcodeW); + free(usersidW); + free(prodcodeW); data = ""; res = RegSetValueExA(hkey, "LastUsedSource", 0, REG_SZ,
2 years, 9 months
1
0
0
0
[reactos] 349/360: [WINESYNC] msi: Use CRT allocation functions.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1b18dc22d5eaee3280074…
commit 1b18dc22d5eaee3280074628e975ee6968ca3e23 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Mar 14 20:05:29 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:43 2022 +0100 [WINESYNC] msi: Use CRT allocation functions. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 0d5f28457e8eced81677509f5129a20f10df526c by Hans Leidekker <hans(a)codeweavers.com> --- dll/win32/msi/custom.c | 5 ++--- dll/win32/msi/handle.c | 6 +++--- dll/win32/msi/install.c | 17 ++++++++--------- dll/win32/msi/msipriv.h | 16 +++++----------- dll/win32/msi/package.c | 15 +++++++-------- dll/win32/msi/streams.c | 3 ++- dll/win32/msi/string.c | 10 ++++------ dll/win32/msi/where.c | 3 ++- 8 files changed, 33 insertions(+), 42 deletions(-) diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c index fb23d7b755a..3ee4f82e41f 100644 --- a/dll/win32/msi/custom.c +++ b/dll/win32/msi/custom.c @@ -36,7 +36,6 @@ #include "msipriv.h" #include "winemsi_s.h" #include "wine/asm.h" -#include "wine/heap.h" #include "wine/debug.h" #include "wine/unicode.h" #include "wine/exception.h" @@ -75,12 +74,12 @@ static struct list msi_pending_custom_actions = LIST_INIT( msi_pending_custom_ac void __RPC_FAR * __RPC_USER MIDL_user_allocate(SIZE_T len) { - return heap_alloc(len); + return malloc(len); } void __RPC_USER MIDL_user_free(void __RPC_FAR * ptr) { - heap_free(ptr); + free(ptr); } LONG WINAPI rpc_filter(EXCEPTION_POINTERS *eptr) diff --git a/dll/win32/msi/handle.c b/dll/win32/msi/handle.c index d2731935a3d..29c5784c10e 100644 --- a/dll/win32/msi/handle.c +++ b/dll/win32/msi/handle.c @@ -92,13 +92,13 @@ static MSIHANDLE alloc_handle_table_entry(void) if (msihandletable_size == 0) { newsize = 256; - p = msi_alloc_zero(newsize*sizeof(msi_handle_info)); + p = msi_alloc_zero(newsize * sizeof(*p)); } else { newsize = msihandletable_size * 2; - p = msi_realloc_zero(msihandletable, - newsize*sizeof(msi_handle_info)); + p = msi_realloc(msihandletable, newsize * sizeof(*p)); + if (p) memset(p + msihandletable_size, 0, (newsize - msihandletable_size) * sizeof(*p)); } if (!p) return 0; diff --git a/dll/win32/msi/install.c b/dll/win32/msi/install.c index 4ede0d17ccd..7aad6bffc07 100644 --- a/dll/win32/msi/install.c +++ b/dll/win32/msi/install.c @@ -34,7 +34,6 @@ #include "msipriv.h" #include "winemsi_s.h" -#include "wine/heap.h" #include "wine/debug.h" #include "wine/exception.h" @@ -273,7 +272,7 @@ UINT WINAPI MsiGetTargetPathA(MSIHANDLE hinst, const char *folder, char *buf, DW if (!(remote = msi_get_remote(hinst))) { - heap_free(folderW); + free(folderW); return ERROR_INVALID_HANDLE; } @@ -291,7 +290,7 @@ UINT WINAPI MsiGetTargetPathA(MSIHANDLE hinst, const char *folder, char *buf, DW r = msi_strncpyWtoA(path, -1, buf, sz, TRUE); midl_user_free(path); - heap_free(folderW); + free(folderW); return r; } @@ -301,7 +300,7 @@ UINT WINAPI MsiGetTargetPathA(MSIHANDLE hinst, const char *folder, char *buf, DW else r = ERROR_DIRECTORY; - heap_free(folderW); + free(folderW); msiobj_release(&package->hdr); return r; } @@ -429,7 +428,7 @@ UINT WINAPI MsiGetSourcePathA(MSIHANDLE hinst, const char *folder, char *buf, DW if (!(remote = msi_get_remote(hinst))) { - heap_free(folderW); + free(folderW); return ERROR_INVALID_HANDLE; } @@ -447,7 +446,7 @@ UINT WINAPI MsiGetSourcePathA(MSIHANDLE hinst, const char *folder, char *buf, DW r = msi_strncpyWtoA(path, -1, buf, sz, TRUE); midl_user_free(path); - heap_free(folderW); + free(folderW); return r; } @@ -457,8 +456,8 @@ UINT WINAPI MsiGetSourcePathA(MSIHANDLE hinst, const char *folder, char *buf, DW else r = ERROR_DIRECTORY; - heap_free(path); - heap_free(folderW); + free(path); + free(folderW); msiobj_release(&package->hdr); return r; } @@ -509,7 +508,7 @@ UINT WINAPI MsiGetSourcePathW(MSIHANDLE hinst, const WCHAR *folder, WCHAR *buf, else r = ERROR_DIRECTORY; - heap_free(path); + free(path); msiobj_release(&package->hdr); return r; } diff --git a/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h index 6da8203b721..7a86b32d6ba 100644 --- a/dll/win32/msi/msipriv.h +++ b/dll/win32/msi/msipriv.h @@ -1141,30 +1141,24 @@ extern void msi_ui_progress(MSIPACKAGE *, int, int, int, int) DECLSPEC_HIDDEN; static void *msi_alloc( size_t len ) __WINE_ALLOC_SIZE(1); static inline void *msi_alloc( size_t len ) { - return HeapAlloc( GetProcessHeap(), 0, len ); + return malloc( len ); } static void *msi_alloc_zero( size_t len ) __WINE_ALLOC_SIZE(1); static inline void *msi_alloc_zero( size_t len ) { - return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, len ); + return calloc( 1, len ); } static void *msi_realloc( void *mem, size_t len ) __WINE_ALLOC_SIZE(2); static inline void *msi_realloc( void *mem, size_t len ) { - return HeapReAlloc( GetProcessHeap(), 0, mem, len ); + return realloc( mem, len ); } -static void *msi_realloc_zero( void *mem, size_t len ) __WINE_ALLOC_SIZE(2); -static inline void *msi_realloc_zero( void *mem, size_t len ) +static inline void msi_free( void *mem ) { - return HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len ); -} - -static inline BOOL msi_free( void *mem ) -{ - return HeapFree( GetProcessHeap(), 0, mem ); + free( mem ); } static inline char *strdupWtoA( LPCWSTR str ) diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c index fda1622f666..14ddcb79a57 100644 --- a/dll/win32/msi/package.c +++ b/dll/win32/msi/package.c @@ -50,7 +50,6 @@ #include "msidefs.h" #include "sddl.h" -#include "wine/heap.h" #include "wine/debug.h" #include "wine/exception.h" @@ -2279,7 +2278,7 @@ UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD if (!(remote = msi_get_remote(hinst))) { - heap_free(nameW); + free(nameW); return ERROR_INVALID_HANDLE; } @@ -2293,13 +2292,13 @@ UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD } __ENDTRY - heap_free(nameW); + free(nameW); if (!r) { /* String might contain embedded nulls. * Native returns the correct size but truncates the string. */ - tmp = heap_alloc_zero((len + 1) * sizeof(WCHAR)); + tmp = calloc(1, (len + 1) * sizeof(WCHAR)); if (!tmp) { midl_user_free(value); @@ -2309,7 +2308,7 @@ UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD r = msi_strncpyWtoA(tmp, len, buf, sz, TRUE); - heap_free(tmp); + free(tmp); } midl_user_free(value); return r; @@ -2321,7 +2320,7 @@ UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD r = msi_strncpyWtoA(value, len, buf, sz, FALSE); - heap_free(nameW); + free(nameW); if (row) msiobj_release(&row->hdr); msiobj_release(&package->hdr); return r; @@ -2362,7 +2361,7 @@ UINT WINAPI MsiGetPropertyW(MSIHANDLE hinst, const WCHAR *name, WCHAR *buf, DWOR { /* String might contain embedded nulls. * Native returns the correct size but truncates the string. */ - tmp = heap_alloc_zero((len + 1) * sizeof(WCHAR)); + tmp = calloc(1, (len + 1) * sizeof(WCHAR)); if (!tmp) { midl_user_free(value); @@ -2372,7 +2371,7 @@ UINT WINAPI MsiGetPropertyW(MSIHANDLE hinst, const WCHAR *name, WCHAR *buf, DWOR r = msi_strncpyW(tmp, len, buf, sz); - heap_free(tmp); + free(tmp); } midl_user_free(value); return r; diff --git a/dll/win32/msi/streams.c b/dll/win32/msi/streams.c index 1ef99c2ab05..8f6986039a9 100644 --- a/dll/win32/msi/streams.c +++ b/dll/win32/msi/streams.c @@ -57,7 +57,8 @@ static BOOL streams_resize_table( MSIDATABASE *db, UINT size ) { MSISTREAM *tmp; UINT new_size = db->num_streams_allocated * 2; - if (!(tmp = msi_realloc_zero( db->streams, new_size * sizeof(MSISTREAM) ))) return FALSE; + if (!(tmp = msi_realloc( db->streams, new_size * sizeof(*tmp) ))) return FALSE; + memset( tmp + db->num_streams_allocated, 0, (new_size - db->num_streams_allocated) * sizeof(*tmp) ); db->streams = tmp; db->num_streams_allocated = new_size; } diff --git a/dll/win32/msi/string.c b/dll/win32/msi/string.c index 0e250ff4527..fb0134810b9 100644 --- a/dll/win32/msi/string.c +++ b/dll/win32/msi/string.c @@ -139,13 +139,11 @@ static int st_find_free_entry( string_table *st ) return i; /* dynamically resize */ - sz = st->maxcount + 1 + st->maxcount/2; - p = msi_realloc_zero( st->strings, sz * sizeof(struct msistring) ); - if( !p ) - return -1; + sz = st->maxcount + 1 + st->maxcount / 2; + if (!(p = msi_realloc( st->strings, sz * sizeof(*p) ))) return -1; + memset( p + st->maxcount, 0, (sz - st->maxcount) * sizeof(*p) ); - s = msi_realloc( st->sorted, sz*sizeof(UINT) ); - if( !s ) + if (!(s = msi_realloc( st->sorted, sz * sizeof(*s) ))) { msi_free( p ); return -1; diff --git a/dll/win32/msi/where.c b/dll/win32/msi/where.c index 2a64de8cd9d..684d9d5fb98 100644 --- a/dll/win32/msi/where.c +++ b/dll/win32/msi/where.c @@ -131,9 +131,10 @@ static UINT add_row(MSIWHEREVIEW *wv, UINT vals[]) MSIROWENTRY **new_reorder; UINT newsize = wv->reorder_size * 2; - new_reorder = msi_realloc_zero(wv->reorder, sizeof(MSIROWENTRY *) * newsize); + new_reorder = msi_realloc(wv->reorder, newsize * sizeof(*new_reorder)); if (!new_reorder) return ERROR_OUTOFMEMORY; + memset(new_reorder + wv->reorder_size, 0, (newsize - wv->reorder_size) * sizeof(*new_reorder)); wv->reorder = new_reorder; wv->reorder_size = newsize;
2 years, 9 months
1
0
0
0
[reactos] 348/360: [WINESYNC] msi/tests: Avoid "misleading indentation" warnings.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=34c24483e533e32a2ee64…
commit 34c24483e533e32a2ee642ad7b637dade09570a5 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Mar 14 20:05:26 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:43 2022 +0100 [WINESYNC] msi/tests: Avoid "misleading indentation" warnings. Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 164664a34ee7f01395e8b9028728a026268c1595 by Fabian Maurer <dark.shadow4(a)web.de> --- modules/rostests/winetests/msi/action.c | 6 +++--- modules/rostests/winetests/msi/db.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/rostests/winetests/msi/action.c b/modules/rostests/winetests/msi/action.c index 0ea5d286e04..2787ed48da0 100644 --- a/modules/rostests/winetests/msi/action.c +++ b/modules/rostests/winetests/msi/action.c @@ -2785,7 +2785,7 @@ static void test_register_product(void) } res = RegDeleteKeyA(usage, ""); -todo_wine + todo_wine ok(!res, "got %d\n", res); RegCloseKey(usage); res = RegDeleteKeyA(hkey, ""); @@ -2890,7 +2890,7 @@ todo_wine } res = RegDeleteKeyA(usage, ""); -todo_wine + todo_wine ok(!res, "got %d\n", res); RegCloseKey(usage); res = RegDeleteKeyA(hkey, ""); @@ -3002,7 +3002,7 @@ todo_wine } res = RegDeleteKeyA(usage, ""); - todo_wine + todo_wine ok(!res, "got %d\n", res); RegCloseKey(usage); res = RegDeleteKeyA(hkey, ""); diff --git a/modules/rostests/winetests/msi/db.c b/modules/rostests/winetests/msi/db.c index 447f2cdd0ee..b75e5f7a4b5 100644 --- a/modules/rostests/winetests/msi/db.c +++ b/modules/rostests/winetests/msi/db.c @@ -8864,7 +8864,7 @@ static void test_viewmodify_merge(void) MsiRecordSetInteger(rec, 1, 1); MsiRecordSetInteger(rec, 2, 3); r = MsiViewModify(view, MSIMODIFY_MERGE, rec); -todo_wine + todo_wine ok(r == ERROR_FUNCTION_FAILED, "got %u\n", r); MsiRecordSetInteger(rec, 1, 2); @@ -8913,7 +8913,7 @@ todo_wine MsiRecordSetInteger(rec, 3, 4); r = MsiViewModify(view, MSIMODIFY_MERGE, rec); -todo_wine + todo_wine ok(r == ERROR_FUNCTION_FAILED, "got %u\n", r); MsiRecordSetInteger(rec, 2, 4); @@ -8958,7 +8958,7 @@ todo_wine MsiRecordSetInteger(rec, 2, 3); r = MsiViewModify(view, MSIMODIFY_MERGE, rec); -todo_wine + todo_wine ok(r == ERROR_FUNCTION_FAILED, "got %u\n", r); MsiCloseHandle(rec); @@ -8998,7 +8998,7 @@ todo_wine MsiRecordSetInteger(rec, 2, 2); MsiRecordSetInteger(rec, 3, 3); r = MsiViewModify(view, MSIMODIFY_MERGE, rec); -todo_wine + todo_wine ok(r == ERROR_FUNCTION_FAILED, "got %u\n", r); MsiRecordSetInteger(rec, 1, 1);
2 years, 9 months
1
0
0
0
[reactos] 347/360: [WINESYNC] msi: Use custom action name for MsiBreak handling.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5deb0e6042ede9d010b1e…
commit 5deb0e6042ede9d010b1e9521d31c579b26f6ec3 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Mar 14 20:05:24 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:43 2022 +0100 [WINESYNC] msi: Use custom action name for MsiBreak handling. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=50433
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id b74b634335c8d843e6dc2ef21e5d9248ca05bae9 by Hans Leidekker <hans(a)codeweavers.com> --- dll/win32/msi/custom.c | 31 ++++++++++++++----------------- dll/win32/msi/winemsi.idl | 4 ++-- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c index 512c1874f50..fb23d7b755a 100644 --- a/dll/win32/msi/custom.c +++ b/dll/win32/msi/custom.c @@ -456,21 +456,15 @@ static msi_custom_action_info *find_action_by_guid( const GUID *guid ) return info; } -static void handle_msi_break(LPCSTR target) +static void handle_msi_break( const WCHAR *action ) { - 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]; + const WCHAR fmt[] = L"To debug your custom action, attach your debugger to process %u (0x%x) and press OK"; + WCHAR val[MAX_PATH], msg[100]; - if (!GetEnvironmentVariableA("MsiBreak", val, MAX_PATH)) - return; + if (!GetEnvironmentVariableW( L"MsiBreak", val, MAX_PATH ) || wcscmp( val, action )) return; - if (strcmp(val, target)) - return; - - sprintf(msg, format, GetCurrentProcessId(), GetCurrentProcessId()); - MessageBoxA(NULL, msg, "Windows Installer", MB_OK); + swprintf( msg, ARRAY_SIZE(msg), fmt, GetCurrentProcessId(), GetCurrentProcessId() ); + MessageBoxW( NULL, msg, L"Windows Installer", MB_OK ); DebugBreak(); } @@ -518,7 +512,7 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid) RPC_WSTR binding_str; MSIHANDLE hPackage; RPC_STATUS status; - LPWSTR dll = NULL; + WCHAR *dll = NULL, *action = NULL; LPSTR proc = NULL; HANDLE hModule; INT type; @@ -546,7 +540,7 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid) RpcStringFreeW(&binding_str); } - r = remote_GetActionInfo(guid, &type, &dll, &proc, &remote_package); + r = remote_GetActionInfo(guid, &action, &type, &dll, &proc, &remote_package); if (r != ERROR_SUCCESS) return r; @@ -554,6 +548,7 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid) if (!hPackage) { ERR( "failed to create handle for %x\n", remote_package ); + midl_user_free( action ); midl_user_free( dll ); midl_user_free( proc ); return ERROR_INSTALL_FAILURE; @@ -563,6 +558,7 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid) if (!hModule) { ERR( "failed to load dll %s (%u)\n", debugstr_w( dll ), GetLastError() ); + midl_user_free( action ); midl_user_free( dll ); midl_user_free( proc ); MsiCloseHandle( hPackage ); @@ -573,7 +569,7 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid) if (!fn) WARN( "GetProcAddress(%s) failed\n", debugstr_a(proc) ); else { - handle_msi_break(proc); + handle_msi_break(action); __TRY { @@ -590,11 +586,11 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid) FreeLibrary(hModule); + midl_user_free(action); midl_user_free(dll); midl_user_free(proc); MsiCloseAllHandles(); - return r; } @@ -1633,7 +1629,7 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package) LeaveCriticalSection( &msi_custom_action_cs ); } -UINT __cdecl s_remote_GetActionInfo(const GUID *guid, int *type, LPWSTR *dll, LPSTR *func, MSIHANDLE *hinst) +UINT __cdecl s_remote_GetActionInfo(const GUID *guid, WCHAR **name, int *type, WCHAR **dll, char **func, MSIHANDLE *hinst) { msi_custom_action_info *info; @@ -1641,6 +1637,7 @@ UINT __cdecl s_remote_GetActionInfo(const GUID *guid, int *type, LPWSTR *dll, LP if (!info) return ERROR_INVALID_DATA; + *name = strdupW(info->action); *type = info->type; *hinst = alloc_msihandle(&info->package->hdr); *dll = strdupW(info->source); diff --git a/dll/win32/msi/winemsi.idl b/dll/win32/msi/winemsi.idl index 7888b0ceb40..e9f0f9e6e59 100644 --- a/dll/win32/msi/winemsi.idl +++ b/dll/win32/msi/winemsi.idl @@ -105,7 +105,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 ); - UINT remote_GetActionInfo( [in] const GUID *guid, [out] int *type, [out, string] LPWSTR *dllname, - [out, string] LPSTR *function, [out] MSIHANDLE *hinst ); + UINT remote_GetActionInfo( [in] const GUID *guid, [out, string] WCHAR **action, [out] int *type, [out, string] WCHAR **dllname, + [out, string] char **function, [out] MSIHANDLE *hinst ); UINT remote_CloseHandle( [in] MSIHANDLE handle ); }
2 years, 9 months
1
0
0
0
[reactos] 346/360: [WINESYNC] include: Introduce winetest_push_context() and winetest_pop_context().
by Mark Jansen
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=218a1ae241aaf05e5b951…
commit 218a1ae241aaf05e5b9516e3f2264615f72b64a9 Author: Mark Jansen <mark.jansen(a)reactos.org> AuthorDate: Mon Mar 14 00:35:20 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:43 2022 +0100 [WINESYNC] include: Introduce winetest_push_context() and winetest_pop_context(). include: Introduce winetest_push_context() and winetest_pop_context(). Based on vkd3d's vkd3d_test_set_context(), but adding support for a stack of context prefixes, to more easily accomodate tests with nested loops. af39a1b0bce0622ed8df0e64f9c794380eb30c45 Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- sdk/include/reactos/wine/test.h | 78 +++++++++++++++++++++++++++++++++-------- 1 file changed, 64 insertions(+), 14 deletions(-) diff --git a/sdk/include/reactos/wine/test.h b/sdk/include/reactos/wine/test.h index 45578f1a65d..414215ab0c4 100644 --- a/sdk/include/reactos/wine/test.h +++ b/sdk/include/reactos/wine/test.h @@ -133,6 +133,8 @@ extern void __winetest_cdecl winetest_skip( const char *msg, ... ) __attribute__ extern void __winetest_cdecl winetest_win_skip( const char *msg, ... ) __attribute__((format (printf,1,2))); extern void __winetest_cdecl winetest_trace( const char *msg, ... ) __attribute__((format (printf,1,2))); extern void __winetest_cdecl winetest_print(const char* msg, ...) __attribute__((format(printf, 1, 2))); +extern void __winetest_cdecl winetest_push_context( const char *fmt, ... ) __attribute__((format(printf, 1, 2))); +extern void winetest_pop_context(void); #else /* __GNUC__ */ # define WINETEST_PRINTF_ATTR(fmt,args) @@ -141,6 +143,8 @@ extern void __winetest_cdecl winetest_skip( const char *msg, ... ); extern void __winetest_cdecl winetest_win_skip( const char *msg, ... ); extern void __winetest_cdecl winetest_trace( const char *msg, ... ); extern void __winetest_cdecl winetest_print(const char* msg, ...); +extern void __winetest_cdecl winetest_push_context( const char *fmt, ... ); +extern void winetest_pop_context(void); #endif /* __GNUC__ */ @@ -288,6 +292,8 @@ typedef struct int todo_do_loop; char *str_pos; /* position in debug buffer */ char strings[2000]; /* buffer for debug strings */ + char context[8][128]; /* data to print before messages */ + unsigned int context_count; /* number of context prefixes */ } tls_data; static DWORD tls_index; @@ -350,10 +356,36 @@ void winetest_set_location( const char* file, int line ) data->current_line=line; } +#ifdef __GNUC__ +static void __winetest_cdecl winetest_printf( const char *msg, ... ) __attribute__((format(printf,1,2))); +#else +static void __winetest_cdecl winetest_printf(const char* msg, ...); +#endif +static void __winetest_cdecl winetest_printf( const char *msg, ... ) +{ + tls_data *data = get_tls_data(); + __winetest_va_list valist; + + fprintf( stdout, __winetest_file_line_prefix ": ", data->current_file, data->current_line ); + __winetest_va_start( valist, msg ); + vfprintf( stdout, msg, valist ); + __winetest_va_end( valist ); +} + +static void __winetest_cdecl winetest_print_context( const char *msgtype ) +{ + tls_data *data = get_tls_data(); + unsigned int i; + + winetest_printf( "%s", msgtype ); + for (i = 0; i < data->context_count; ++i) + fprintf( stdout, "%s: ", data->context[i] ); +} + void winetest_subtest(const char* name) { tls_data* data = get_tls_data(); - printf(__winetest_file_line_prefix ": Subtest %s\n", + fprintf(stdout, __winetest_file_line_prefix ": Subtest %s\n", data->current_file, data->current_line, name); } @@ -384,8 +416,7 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args ) { if (condition) { - fprintf( stdout, __winetest_file_line_prefix ": Test succeeded inside todo block: ", - data->current_file, data->current_line ); + winetest_print_context( "Test succeeded inside todo block: " ); vfprintf(stdout, msg, args); if ((data->nocount_level & 2) == 0) InterlockedIncrement(&todo_failures); @@ -396,8 +427,7 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args ) /* show todos even if traces are disabled*/ /*if (winetest_debug > 0)*/ { - fprintf( stdout, __winetest_file_line_prefix ": Test marked todo: ", - data->current_file, data->current_line ); + winetest_print_context( "Test marked todo: " ); vfprintf(stdout, msg, args); } if ((data->nocount_level & 1) == 0) @@ -409,8 +439,7 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args ) { if (!condition) { - fprintf( stdout, __winetest_file_line_prefix ": Test failed: ", - data->current_file, data->current_line ); + winetest_print_context( "Test failed: " ); vfprintf(stdout, msg, args); if ((data->nocount_level & 2) == 0) InterlockedIncrement(&failures); @@ -419,8 +448,9 @@ int winetest_vok( int condition, const char *msg, __winetest_va_list args ) else { if (report_success && (data->nocount_level & 1) == 0) - fprintf( stdout, __winetest_file_line_prefix ": Test succeeded\n", - data->current_file, data->current_line); + { + winetest_printf("Test succeeded\n"); + } if ((data->nocount_level & 1) == 0) InterlockedIncrement(&successes); return 1; @@ -440,11 +470,10 @@ void __winetest_cdecl winetest_ok( int condition, const char *msg, ... ) void __winetest_cdecl winetest_trace( const char *msg, ... ) { __winetest_va_list valist; - tls_data* data=get_tls_data(); if (winetest_debug > 0) { - fprintf( stdout, __winetest_file_line_prefix ": ", data->current_file, data->current_line ); + winetest_print_context( "" ); __winetest_va_start(valist, msg); vfprintf(stdout, msg, valist); __winetest_va_end(valist); @@ -464,9 +493,7 @@ void __winetest_cdecl winetest_print(const char* msg, ...) void winetest_vskip( const char *msg, __winetest_va_list args ) { - tls_data* data=get_tls_data(); - - fprintf( stdout, __winetest_file_line_prefix ": Tests skipped: ", data->current_file, data->current_line ); + winetest_print_context( "Tests skipped: " ); vfprintf(stdout, msg, args); skipped++; } @@ -543,6 +570,29 @@ void winetest_end_nocount(void) data->nocount_level >>= 2; } +void __winetest_cdecl winetest_push_context(const char* fmt, ...) +{ + tls_data* data = get_tls_data(); + __winetest_va_list valist; + + if (data->context_count < ARRAY_SIZE(data->context)) + { + __winetest_va_start(valist, fmt); + vsnprintf(data->context[data->context_count], sizeof(data->context[data->context_count]), fmt, valist); + __winetest_va_end(valist); + data->context[data->context_count][sizeof(data->context[data->context_count]) - 1] = 0; + } + ++data->context_count; +} + +void winetest_pop_context(void) +{ + tls_data* data = get_tls_data(); + + if (data->context_count) + --data->context_count; +} + int winetest_get_mainargs( char*** pargv ) { *pargv = winetest_argv;
2 years, 9 months
1
0
0
0
[reactos] 345/360: [WINESYNC] makefiles: Specify the bison prefix directly in the source files.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=eb75eae9837b947766daf…
commit eb75eae9837b947766daf2381ffc694373479e95 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Mar 14 00:16:50 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:42 2022 +0100 [WINESYNC] makefiles: Specify the bison prefix directly in the source files. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id f4af3134dec425706b74428317e9ab327b6061cc by Alexandre Julliard <julliard(a)winehq.org> --- dll/win32/msi/CMakeLists.txt | 4 ++-- dll/win32/msi/cond.y | 5 +++-- dll/win32/msi/sql.y | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dll/win32/msi/CMakeLists.txt b/dll/win32/msi/CMakeLists.txt index 6f335cd269c..56fcc80cb25 100644 --- a/dll/win32/msi/CMakeLists.txt +++ b/dll/win32/msi/CMakeLists.txt @@ -47,8 +47,8 @@ list(APPEND SOURCE upgrade.c where.c) -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_") +BISON_TARGET(cond cond.y ${CMAKE_CURRENT_BINARY_DIR}/cond.tab.c) +BISON_TARGET(sql sql.y ${CMAKE_CURRENT_BINARY_DIR}/sql.tab.c) set(OLD_IDL_FLAGS ${IDL_FLAGS}) set(IDL_FLAGS ${IDL_FLAGS} --prefix-server=s_) diff --git a/dll/win32/msi/cond.y b/dll/win32/msi/cond.y index 7bf3e3f831a..17df0a4248c 100644 --- a/dll/win32/msi/cond.y +++ b/dll/win32/msi/cond.y @@ -115,6 +115,7 @@ static void value_free( struct value val ) %lex-param { COND_input *info } %parse-param { COND_input *info } +%define api.prefix {cond_} %define api.pure %union @@ -126,7 +127,7 @@ static void value_free( struct value val ) BOOL bool; } -%token COND_SPACE COND_EOF +%token COND_SPACE %token COND_OR COND_AND COND_NOT COND_XOR COND_IMP COND_EQV %token COND_LT COND_GT COND_EQ COND_NE COND_GE COND_LE %token COND_ILT COND_IGT COND_IEQ COND_INE COND_IGE COND_ILE @@ -135,7 +136,7 @@ static void value_free( struct value val ) %token COND_PERCENT COND_DOLLARS COND_QUESTION COND_AMPER COND_EXCLAM %token <str> COND_IDENT <str> COND_NUMBER <str> COND_LITER -%nonassoc COND_ERROR COND_EOF +%nonassoc COND_ERROR %type <bool> expression boolean_term boolean_factor %type <value> value diff --git a/dll/win32/msi/sql.y b/dll/win32/msi/sql.y index 5b5c8bd7f8e..885593a9d18 100644 --- a/dll/win32/msi/sql.y +++ b/dll/win32/msi/sql.y @@ -58,6 +58,7 @@ static struct expr * EXPR_wildcard( void *info ); %lex-param { SQL_input *info } %parse-param { SQL_input *info } +%define api.prefix {sql_} %define api.pure %union
2 years, 9 months
1
0
0
0
[reactos] 344/360: [WINESYNC] msi: Don't call RegCloseKey with uninitialized value.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9a05b53ce88a3896bf9fa…
commit 9a05b53ce88a3896bf9fa9acefb4efeb2fea5918 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Mar 14 00:16:49 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:42 2022 +0100 [WINESYNC] msi: Don't call RegCloseKey with uninitialized value. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 4240e71a350b16d7ba048a839683c2023d03c831 by Eric Pouech <eric.pouech(a)gmail.com> --- dll/win32/msi/action.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dll/win32/msi/action.c b/dll/win32/msi/action.c index 0640d9ae1c8..98e503694ba 100644 --- a/dll/win32/msi/action.c +++ b/dll/win32/msi/action.c @@ -7001,7 +7001,7 @@ static UINT ITERATE_RemoveEnvironmentString( MSIRECORD *rec, LPVOID param ) LPCWSTR name, value, component; WCHAR *p, *q, *deformatted = NULL, *new_value = NULL; DWORD flags, type, size, len, len_value = 0, len_new_value; - HKEY env; + HKEY env = NULL; MSICOMPONENT *comp; MSIRECORD *uirow; int action = 0;
2 years, 9 months
1
0
0
0
[reactos] 343/360: [WINESYNC] msi: GetBinaryType() doesn't accept DLLs.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3d6aaff25404561272675…
commit 3d6aaff25404561272675f5a7c417593a5c2f1cd Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Mar 14 00:16:47 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:42 2022 +0100 [WINESYNC] msi: GetBinaryType() doesn't accept DLLs. With help from Dmitry Timoshkov. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=51790
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 4aa858c9badfb35bcc3cdd38abfd40dc5b06c696 by Hans Leidekker <hans(a)codeweavers.com> --- dll/win32/msi/CMakeLists.txt | 2 +- dll/win32/msi/custom.c | 56 ++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/dll/win32/msi/CMakeLists.txt b/dll/win32/msi/CMakeLists.txt index 84bfef42ec6..6f335cd269c 100644 --- a/dll/win32/msi/CMakeLists.txt +++ b/dll/win32/msi/CMakeLists.txt @@ -16,7 +16,6 @@ list(APPEND SOURCE automation.c classes.c create.c - custom.c database.c delete.c dialog.c @@ -58,6 +57,7 @@ add_rpc_files(server winemsi.idl) set(IDL_FLAGS ${OLD_IDL_FLAGS}) list(APPEND PCH_SKIP_SOURCE + custom.c # Need custom defines for WIN32_NO_STATUS suminfo.c # The only file without NONAMELESSUNION ${BISON_cond_OUTPUTS} ${BISON_sql_OUTPUTS} diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c index b717c293eae..512c1874f50 100644 --- a/dll/win32/msi/custom.c +++ b/dll/win32/msi/custom.c @@ -22,6 +22,9 @@ #include <stdarg.h> #include <stdio.h> + +#include "ntstatus.h" +#define WIN32_NO_STATUS #include "windef.h" #include "winbase.h" #include "winerror.h" @@ -39,9 +42,9 @@ #include "wine/exception.h" #ifdef __REACTOS__ -#ifndef STATUS_ACCESS_VIOLATION -#define STATUS_ACCESS_VIOLATION ((NTSTATUS)0xC0000005) -#endif +#undef WIN32_NO_STATUS +#include <psdk/ntstatus.h> +#include <ndk/mmfuncs.h> #endif WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -718,6 +721,51 @@ static DWORD WINAPI custom_client_thread(void *arg) return rc; } +/* based on kernel32.GetBinaryTypeW() */ +static BOOL get_binary_type( const WCHAR *name, DWORD *type ) +{ + HANDLE hfile, mapping; + NTSTATUS status; + + hfile = CreateFileW( name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 ); + if (hfile == INVALID_HANDLE_VALUE) + return FALSE; + + status = NtCreateSection( &mapping, STANDARD_RIGHTS_REQUIRED | SECTION_QUERY, NULL, NULL, PAGE_READONLY, + SEC_IMAGE, hfile ); + CloseHandle( hfile ); + + switch (status) + { + case STATUS_SUCCESS: + { + SECTION_IMAGE_INFORMATION info; + + status = NtQuerySection( mapping, SectionImageInformation, &info, sizeof(info), NULL ); + CloseHandle( mapping ); + if (status) return FALSE; + switch (info.Machine) + { + case IMAGE_FILE_MACHINE_I386: + case IMAGE_FILE_MACHINE_ARMNT: + *type = SCS_32BIT_BINARY; + return TRUE; + case IMAGE_FILE_MACHINE_AMD64: + case IMAGE_FILE_MACHINE_ARM64: + *type = SCS_64BIT_BINARY; + return TRUE; + default: + return FALSE; + } + } + case STATUS_INVALID_IMAGE_WIN_64: + *type = SCS_64BIT_BINARY; + return TRUE; + default: + return FALSE; + } +} + static msi_custom_action_info *do_msidbCustomActionTypeDll( MSIPACKAGE *package, INT type, LPCWSTR source, LPCWSTR target, LPCWSTR action ) { @@ -765,7 +813,7 @@ static msi_custom_action_info *do_msidbCustomActionTypeDll( info->package->rpc_server_started = 1; } - ret = GetBinaryTypeW(source, &info->arch); + ret = get_binary_type(source, &info->arch); if (!ret) info->arch = (sizeof(void *) == 8 ? SCS_64BIT_BINARY : SCS_32BIT_BINARY);
2 years, 9 months
1
0
0
0
[reactos] 342/360: [WINESYNC] msi: Wrap around to first record at end of view in MSI_ViewFetch.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=faea5bf012fd95910d3cf…
commit faea5bf012fd95910d3cf50ffcb8200423b1be74 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Mon Mar 14 00:16:45 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:42 2022 +0100 [WINESYNC] msi: Wrap around to first record at end of view in MSI_ViewFetch. Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 547492007e17ed7fe3c2e5ffd5f58f0d46a40048 by Jinoh Kang <jinoh.kang.kr(a)gmail.com> --- dll/win32/msi/msiquery.c | 5 +++++ modules/rostests/winetests/msi/db.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dll/win32/msi/msiquery.c b/dll/win32/msi/msiquery.c index 2f04d441717..39233c2bd0c 100644 --- a/dll/win32/msi/msiquery.c +++ b/dll/win32/msi/msiquery.c @@ -394,6 +394,11 @@ UINT MSI_ViewFetch(MSIQUERY *query, MSIRECORD **prec) (*prec)->cookie = (UINT64)(ULONG_PTR)query; MSI_RecordSetInteger(*prec, 0, 1); } + else if (r == ERROR_NO_MORE_ITEMS) + { + /* end of view; reset cursor to first row */ + query->row = 0; + } return r; } diff --git a/modules/rostests/winetests/msi/db.c b/modules/rostests/winetests/msi/db.c index eb087eb9711..447f2cdd0ee 100644 --- a/modules/rostests/winetests/msi/db.c +++ b/modules/rostests/winetests/msi/db.c @@ -9343,7 +9343,7 @@ static void test_viewfetch_wraparound(void) winetest_push_context( "Record #%d", i ); r = MsiViewFetch( view, &rec ); - todo_wine_if(tries > 0) ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); if (r != ERROR_SUCCESS) { winetest_pop_context();
2 years, 9 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
9
...
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