Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/package.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/msi/package.c b/dlls/msi/package.c index ab6c3dd..2801efa 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -2368,9 +2368,14 @@ UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD DWORD len;
if (!(remote = msi_get_remote(hinst))) + { + heap_free(nameW); return ERROR_INVALID_HANDLE; + }
r = remote_GetProperty(remote, nameW, &value, &len); + heap_free(nameW); + if (!r) { /* String might contain embedded nulls. @@ -2388,7 +2393,6 @@ UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD heap_free(tmp); } midl_user_free(value); - heap_free(nameW); return r; }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/install.c | 48 ++++++++++++++++++++++++++++++++++++------------ dlls/msi/tests/custom.c | 8 ++++---- 2 files changed, 40 insertions(+), 16 deletions(-)
diff --git a/dlls/msi/install.c b/dlls/msi/install.c index b54daff..93f9cce 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -271,26 +271,50 @@ static UINT MSI_GetTargetPath( MSIHANDLE hInstall, LPCWSTR szFolder, /*********************************************************************** * MsiGetTargetPathA (MSI.@) */ -UINT WINAPI MsiGetTargetPathA( MSIHANDLE hInstall, LPCSTR szFolder, - LPSTR szPathBuf, LPDWORD pcchPathBuf ) +UINT WINAPI MsiGetTargetPathA(MSIHANDLE hinst, const char *folder, char *buf, DWORD *sz) { - LPWSTR szwFolder; - awstring path; + MSIPACKAGE *package; + const WCHAR *path; + WCHAR *folderW; UINT r;
- TRACE("%s %p %p\n", debugstr_a(szFolder), szPathBuf, pcchPathBuf); + TRACE("%s %p %p\n", debugstr_a(folder), buf, sz);
- szwFolder = strdupAtoW(szFolder); - if (szFolder && !szwFolder) - return ERROR_FUNCTION_FAILED; + if (!folder) + return ERROR_INVALID_PARAMETER;
- path.unicode = FALSE; - path.str.a = szPathBuf; + if (!(folderW = strdupAtoW(folder))) + return ERROR_OUTOFMEMORY;
- r = MSI_GetTargetPath( hInstall, szwFolder, &path, pcchPathBuf ); + package = msihandle2msiinfo(hinst, MSIHANDLETYPE_PACKAGE); + if (!package) + { + WCHAR *path = NULL; + MSIHANDLE remote;
- msi_free( szwFolder ); + if (!(remote = msi_get_remote(hinst))) + { + heap_free(folderW); + return ERROR_INVALID_HANDLE; + }
+ r = remote_GetTargetPath(remote, folderW, &path); + if (!r) + r = msi_strncpyWtoA(path, -1, buf, sz, TRUE); + + midl_user_free(path); + heap_free(folderW); + return r; + } + + path = msi_get_target_folder(package, folderW); + if (path) + r = msi_strncpyWtoA(path, -1, buf, sz, FALSE); + else + r = ERROR_DIRECTORY; + + heap_free(folderW); + msiobj_release(&package->hdr); return r; }
diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index d240964..4e42eed 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -485,28 +485,28 @@ static void test_targetpath(MSIHANDLE hinst) sz = 0; r = MsiGetTargetPathA(hinst, "TARGETDIR", NULL, &sz); ok(hinst, !r, "got %u\n", r); - todo_wine_ok(hinst, sz == 6, "got size %u\n", sz); + ok(hinst, sz == 6, "got size %u\n", sz);
sz = 0; strcpy(buffer,"q"); r = MsiGetTargetPathA(hinst, "TARGETDIR", 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 = MsiGetTargetPathA(hinst, "TARGETDIR", 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 = MsiGetTargetPathA(hinst, "TARGETDIR", buffer, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, !strcmp(buffer, "C:"), "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");
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=38477
Your paranoid android.
=== w7pro64 (64 bit custom) === The previous 1 run(s) terminated abnormally
Signed-off-by: Hans Leidekker hans@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/install.c | 80 ++++++++++++++++++++++-------------------------------- 1 file changed, 32 insertions(+), 48 deletions(-)
diff --git a/dlls/msi/install.c b/dlls/msi/install.c index 93f9cce..31352c6 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -228,47 +228,6 @@ const WCHAR *msi_get_target_folder( MSIPACKAGE *package, const WCHAR *name ) }
/*********************************************************************** - * MsiGetTargetPath (internal) - */ -static UINT MSI_GetTargetPath( MSIHANDLE hInstall, LPCWSTR szFolder, - awstring *szPathBuf, LPDWORD pcchPathBuf ) -{ - MSIPACKAGE *package; - const WCHAR *path; - UINT r = ERROR_FUNCTION_FAILED; - - if (!szFolder) - return ERROR_INVALID_PARAMETER; - - package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); - if (!package) - { - LPWSTR value = NULL; - MSIHANDLE remote; - - if (!(remote = msi_get_remote(hInstall))) - return ERROR_INVALID_HANDLE; - - r = remote_GetTargetPath(remote, szFolder, &value); - if (r != ERROR_SUCCESS) - return r; - - r = msi_strcpy_to_awstring(value, -1, szPathBuf, pcchPathBuf); - - midl_user_free(value); - return r; - } - - path = msi_get_target_folder( package, szFolder ); - msiobj_release( &package->hdr ); - - if (!path) - return ERROR_DIRECTORY; - - return msi_strcpy_to_awstring( path, -1, szPathBuf, pcchPathBuf ); -} - -/*********************************************************************** * MsiGetTargetPathA (MSI.@) */ UINT WINAPI MsiGetTargetPathA(MSIHANDLE hinst, const char *folder, char *buf, DWORD *sz) @@ -321,17 +280,42 @@ UINT WINAPI MsiGetTargetPathA(MSIHANDLE hinst, const char *folder, char *buf, DW /*********************************************************************** * MsiGetTargetPathW (MSI.@) */ -UINT WINAPI MsiGetTargetPathW( MSIHANDLE hInstall, LPCWSTR szFolder, - LPWSTR szPathBuf, LPDWORD pcchPathBuf ) +UINT WINAPI MsiGetTargetPathW(MSIHANDLE hinst, const WCHAR *folder, WCHAR *buf, DWORD *sz) { - awstring path; + MSIPACKAGE *package; + const WCHAR *path; + UINT r;
- TRACE("%s %p %p\n", debugstr_w(szFolder), szPathBuf, pcchPathBuf); + TRACE("%s %p %p\n", debugstr_w(folder), buf, sz);
- path.unicode = TRUE; - path.str.w = szPathBuf; + if (!folder) + return ERROR_INVALID_PARAMETER;
- return MSI_GetTargetPath( hInstall, szFolder, &path, pcchPathBuf ); + package = msihandle2msiinfo(hinst, MSIHANDLETYPE_PACKAGE); + if (!package) + { + WCHAR *path = NULL; + MSIHANDLE remote; + + if (!(remote = msi_get_remote(hinst))) + return ERROR_INVALID_HANDLE; + + r = remote_GetTargetPath(remote, folder, &path); + if (!r) + r = msi_strncpyW(path, -1, buf, sz); + + midl_user_free(path); + return r; + } + + path = msi_get_target_folder(package, folder); + if (path) + r = msi_strncpyW(path, -1, buf, sz); + else + r = ERROR_DIRECTORY; + + msiobj_release(&package->hdr); + return r; }
static WCHAR *get_source_root( MSIPACKAGE *package )
Signed-off-by: Hans Leidekker hans@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/install.c | 48 ++++++++++++++++++++++++++++++++++++++---------- dlls/msi/tests/custom.c | 8 ++++---- 2 files changed, 42 insertions(+), 14 deletions(-)
diff --git a/dlls/msi/install.c b/dlls/msi/install.c index 31352c6..d62fe26 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -421,22 +421,50 @@ static UINT MSI_GetSourcePath( MSIHANDLE hInstall, LPCWSTR szFolder, /*********************************************************************** * MsiGetSourcePathA (MSI.@) */ -UINT WINAPI MsiGetSourcePathA( MSIHANDLE hInstall, LPCSTR szFolder, - LPSTR szPathBuf, LPDWORD pcchPathBuf ) +UINT WINAPI MsiGetSourcePathA(MSIHANDLE hinst, const char *folder, char *buf, DWORD *sz) { - LPWSTR folder; - awstring str; + MSIPACKAGE *package; + const WCHAR *path; + WCHAR *folderW; UINT r;
- TRACE("%s %p %p\n", debugstr_a(szFolder), szPathBuf, pcchPathBuf); + TRACE("%s %p %p\n", debugstr_a(folder), buf, sz);
- str.unicode = FALSE; - str.str.a = szPathBuf; + if (!folder) + return ERROR_INVALID_PARAMETER;
- folder = strdupAtoW( szFolder ); - r = MSI_GetSourcePath( hInstall, folder, &str, pcchPathBuf ); - msi_free( folder ); + if (!(folderW = strdupAtoW(folder))) + return ERROR_OUTOFMEMORY;
+ package = msihandle2msiinfo(hinst, MSIHANDLETYPE_PACKAGE); + if (!package) + { + WCHAR *path = NULL; + MSIHANDLE remote; + + if (!(remote = msi_get_remote(hinst))) + { + heap_free(folderW); + return ERROR_INVALID_HANDLE; + } + + r = remote_GetSourcePath(remote, folderW, &path); + if (!r) + r = msi_strncpyWtoA(path, -1, buf, sz, TRUE); + + midl_user_free(path); + heap_free(folderW); + return r; + } + + path = msi_resolve_source_folder(package, folderW, NULL); + if (path) + r = msi_strncpyWtoA(path, -1, buf, sz, FALSE); + else + r = ERROR_DIRECTORY; + + heap_free(folderW); + msiobj_release(&package->hdr); return r; }
diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index 4e42eed..ff1be9b 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -584,28 +584,28 @@ static void test_targetpath(MSIHANDLE hinst) sz = 0; r = MsiGetSourcePathA(hinst, "TARGETDIR", NULL, &sz); ok(hinst, !r, "got %u\n", r); - todo_wine_ok(hinst, sz == srcsz * 2, "got size %u\n", sz); + ok(hinst, sz == srcsz * 2, "got size %u\n", sz);
sz = 0; strcpy(buffer,"q"); r = MsiGetSourcePathA(hinst, "TARGETDIR", 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 == srcsz * 2, "got size %u\n", sz); + ok(hinst, sz == srcsz * 2, "got size %u\n", sz);
sz = 1; strcpy(buffer,"x"); r = MsiGetSourcePathA(hinst, "TARGETDIR", 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 == srcsz * 2, "got size %u\n", sz); + ok(hinst, sz == srcsz * 2, "got size %u\n", sz);
sz = srcsz; strcpy(buffer,"x"); r = MsiGetSourcePathA(hinst, "TARGETDIR", buffer, &sz); ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); ok(hinst, strlen(buffer) == srcsz - 1, "wrong buffer length %d\n", strlen(buffer)); - todo_wine_ok(hinst, sz == srcsz * 2, "got size %u\n", sz); + ok(hinst, sz == srcsz * 2, "got size %u\n", sz);
sz = srcsz + 1; strcpy(buffer,"x");
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=38478
Your paranoid android.
=== w7pro64 (64 bit custom) === The previous 1 run(s) terminated abnormally
Signed-off-by: Hans Leidekker hans@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/install.c | 91 +++++++++++++++++++----------------------------------- 1 file changed, 32 insertions(+), 59 deletions(-)
diff --git a/dlls/msi/install.c b/dlls/msi/install.c index d62fe26..e043c04 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -367,58 +367,6 @@ WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR *name, MSIFOL }
/*********************************************************************** - * MSI_GetSourcePath (internal) - */ -static UINT MSI_GetSourcePath( MSIHANDLE hInstall, LPCWSTR szFolder, - awstring *szPathBuf, LPDWORD pcchPathBuf ) -{ - MSIPACKAGE *package; - LPWSTR path; - UINT r = ERROR_FUNCTION_FAILED; - - TRACE("%s %p %p\n", debugstr_w(szFolder), szPathBuf, pcchPathBuf ); - - if (!szFolder) - return ERROR_INVALID_PARAMETER; - - package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); - if (!package) - { - LPWSTR value = NULL; - MSIHANDLE remote; - - if (!(remote = msi_get_remote(hInstall))) - return ERROR_INVALID_HANDLE; - - r = remote_GetSourcePath(remote, szFolder, &value); - if (r != ERROR_SUCCESS) - return r; - - r = msi_strcpy_to_awstring(value, -1, szPathBuf, pcchPathBuf); - - midl_user_free(value); - return r; - } - - if (szPathBuf->str.w && !pcchPathBuf ) - { - msiobj_release( &package->hdr ); - return ERROR_INVALID_PARAMETER; - } - - path = msi_resolve_source_folder( package, szFolder, NULL ); - msiobj_release( &package->hdr ); - - TRACE("path = %s\n", debugstr_w(path)); - if (!path) - return ERROR_DIRECTORY; - - r = msi_strcpy_to_awstring( path, -1, szPathBuf, pcchPathBuf ); - msi_free( path ); - return r; -} - -/*********************************************************************** * MsiGetSourcePathA (MSI.@) */ UINT WINAPI MsiGetSourcePathA(MSIHANDLE hinst, const char *folder, char *buf, DWORD *sz) @@ -471,17 +419,42 @@ UINT WINAPI MsiGetSourcePathA(MSIHANDLE hinst, const char *folder, char *buf, DW /*********************************************************************** * MsiGetSourcePathW (MSI.@) */ -UINT WINAPI MsiGetSourcePathW( MSIHANDLE hInstall, LPCWSTR szFolder, - LPWSTR szPathBuf, LPDWORD pcchPathBuf ) +UINT WINAPI MsiGetSourcePathW(MSIHANDLE hinst, const WCHAR *folder, WCHAR *buf, DWORD *sz) { - awstring str; + MSIPACKAGE *package; + const WCHAR *path; + UINT r;
- TRACE("%s %p %p\n", debugstr_w(szFolder), szPathBuf, pcchPathBuf ); + TRACE("%s %p %p\n", debugstr_w(folder), buf, sz);
- str.unicode = TRUE; - str.str.w = szPathBuf; + if (!folder) + return ERROR_INVALID_PARAMETER;
- return MSI_GetSourcePath( hInstall, szFolder, &str, pcchPathBuf ); + package = msihandle2msiinfo(hinst, MSIHANDLETYPE_PACKAGE); + if (!package) + { + WCHAR *path = NULL; + MSIHANDLE remote; + + if (!(remote = msi_get_remote(hinst))) + return ERROR_INVALID_HANDLE; + + r = remote_GetSourcePath(remote, folder, &path); + if (!r) + r = msi_strncpyW(path, -1, buf, sz); + + midl_user_free(path); + return r; + } + + path = msi_resolve_source_folder(package, folder, NULL); + if (path) + r = msi_strncpyW(path, -1, buf, sz); + else + r = ERROR_DIRECTORY; + + msiobj_release(&package->hdr); + return r; }
/***********************************************************************
Signed-off-by: Hans Leidekker hans@codeweavers.com