https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e12fb5036ccaec21f47818...
commit e12fb5036ccaec21f47818159b1b2f5dae7f42e7 Author: winesync ros-dev@reactos.org AuthorDate: Sat Mar 12 15:12:16 2022 +0100 Commit: Mark Jansen mark.jansen@reactos.org CommitDate: Sun Mar 20 19:27:45 2022 +0100
[WINESYNC] msi: Handle the remote case directly in MsiGetPropertyA().
Signed-off-by: Zebediah Figura z.figura12@gmail.com Signed-off-by: Hans Leidekker hans@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
wine commit id 84d972010fcf7bc94534c7bb20890ce88381f943 by Zebediah Figura z.figura12@gmail.com --- dll/win32/msi/package.c | 54 +++++++++++++++++++++++++++------ modules/rostests/winetests/msi/custom.c | 6 ++-- 2 files changed, 48 insertions(+), 12 deletions(-)
diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c index 58943536b46..c112b6fae2c 100644 --- a/dll/win32/msi/package.c +++ b/dll/win32/msi/package.c @@ -2417,22 +2417,58 @@ static UINT MSI_GetProperty( MSIHANDLE handle, LPCWSTR name, return r; }
-UINT WINAPI MsiGetPropertyA( MSIHANDLE hInstall, LPCSTR szName, - LPSTR szValueBuf, LPDWORD pchValueBuf ) +UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD *sz) { + MSIPACKAGE *package; awstring val; - LPWSTR name; + WCHAR *nameW; UINT r;
- val.unicode = FALSE; - val.str.a = szValueBuf; + if (!name) + return ERROR_INVALID_PARAMETER;
- name = strdupAtoW( szName ); - if (szName && !name) + if (!(nameW = strdupAtoW(name))) return ERROR_OUTOFMEMORY;
- r = MSI_GetProperty( hInstall, name, &val, pchValueBuf ); - msi_free( name ); + package = msihandle2msiinfo(hinst, MSIHANDLETYPE_PACKAGE); + if (!package) + { + WCHAR *value = NULL, *tmp; + MSIHANDLE remote; + DWORD len; + + if (!(remote = msi_get_remote(hinst))) + return ERROR_INVALID_HANDLE; + + r = remote_GetProperty(remote, nameW, &value, &len); + if (!r) + { + /* String might contain embedded nulls. + * Native returns the correct size but truncates the string. */ + tmp = heap_alloc_zero((len + 1) * sizeof(WCHAR)); + if (!tmp) + { + midl_user_free(value); + return ERROR_OUTOFMEMORY; + } + strcpyW(tmp, value); + + r = msi_strncpyWtoA(tmp, len, buf, sz, TRUE); + + heap_free(tmp); + } + midl_user_free(value); + heap_free(nameW); + return r; + } + + val.unicode = FALSE; + val.str.a = buf; + + r = MSI_GetProperty(hinst, nameW, &val, sz); + + heap_free(nameW); + msiobj_release(&package->hdr); return r; }
diff --git a/modules/rostests/winetests/msi/custom.c b/modules/rostests/winetests/msi/custom.c index 723b2b5deba..96344ebc6eb 100644 --- a/modules/rostests/winetests/msi/custom.c +++ b/modules/rostests/winetests/msi/custom.c @@ -168,21 +168,21 @@ static void test_props(MSIHANDLE hinst) r = MsiGetPropertyA(hinst, "boo", buffer, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !strcmp(buffer, "q"), "got "%s"\n", buffer); - todo_wine_ok(hinst, sz == 6, "got size %u\n", sz); + ok(hinst, sz == 6, "got size %u\n", sz);
sz = 1; strcpy(buffer,"x"); r = MsiGetPropertyA(hinst, "boo", buffer, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !buffer[0], "got "%s"\n", buffer); - todo_wine_ok(hinst, sz == 6, "got size %u\n", sz); + ok(hinst, sz == 6, "got size %u\n", sz);
sz = 3; strcpy(buffer,"x"); r = MsiGetPropertyA(hinst, "boo", buffer, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !strcmp(buffer, "xy"), "got "%s"\n", buffer); - todo_wine_ok(hinst, sz == 6, "got size %u\n", sz); + ok(hinst, sz == 6, "got size %u\n", sz);
sz = 4; strcpy(buffer,"x");