Skip to content

Commit 2f2e68e

Browse files
winesynclearn-more
authored andcommitted
[WINESYNC] msi: Avoid using awstring in MsiGetTargetPathW().
Signed-off-by: Zebediah Figura <[email protected]> Signed-off-by: Hans Leidekker <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id ce3fc1af555106bcc614a1b9259172357035517f by Zebediah Figura <[email protected]>
1 parent c33915e commit 2f2e68e

File tree

1 file changed

+32
-48
lines changed

1 file changed

+32
-48
lines changed

dll/win32/msi/install.c

Lines changed: 32 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -227,47 +227,6 @@ const WCHAR *msi_get_target_folder( MSIPACKAGE *package, const WCHAR *name )
227227
return folder->ResolvedTarget;
228228
}
229229

230-
/***********************************************************************
231-
* MsiGetTargetPath (internal)
232-
*/
233-
static UINT MSI_GetTargetPath( MSIHANDLE hInstall, LPCWSTR szFolder,
234-
awstring *szPathBuf, LPDWORD pcchPathBuf )
235-
{
236-
MSIPACKAGE *package;
237-
const WCHAR *path;
238-
UINT r = ERROR_FUNCTION_FAILED;
239-
240-
if (!szFolder)
241-
return ERROR_INVALID_PARAMETER;
242-
243-
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
244-
if (!package)
245-
{
246-
LPWSTR value = NULL;
247-
MSIHANDLE remote;
248-
249-
if (!(remote = msi_get_remote(hInstall)))
250-
return ERROR_INVALID_HANDLE;
251-
252-
r = remote_GetTargetPath(remote, szFolder, &value);
253-
if (r != ERROR_SUCCESS)
254-
return r;
255-
256-
r = msi_strcpy_to_awstring(value, -1, szPathBuf, pcchPathBuf);
257-
258-
midl_user_free(value);
259-
return r;
260-
}
261-
262-
path = msi_get_target_folder( package, szFolder );
263-
msiobj_release( &package->hdr );
264-
265-
if (!path)
266-
return ERROR_DIRECTORY;
267-
268-
return msi_strcpy_to_awstring( path, -1, szPathBuf, pcchPathBuf );
269-
}
270-
271230
/***********************************************************************
272231
* MsiGetTargetPathA (MSI.@)
273232
*/
@@ -321,17 +280,42 @@ UINT WINAPI MsiGetTargetPathA(MSIHANDLE hinst, const char *folder, char *buf, DW
321280
/***********************************************************************
322281
* MsiGetTargetPathW (MSI.@)
323282
*/
324-
UINT WINAPI MsiGetTargetPathW( MSIHANDLE hInstall, LPCWSTR szFolder,
325-
LPWSTR szPathBuf, LPDWORD pcchPathBuf )
283+
UINT WINAPI MsiGetTargetPathW(MSIHANDLE hinst, const WCHAR *folder, WCHAR *buf, DWORD *sz)
326284
{
327-
awstring path;
285+
MSIPACKAGE *package;
286+
const WCHAR *path;
287+
UINT r;
328288

329-
TRACE("%s %p %p\n", debugstr_w(szFolder), szPathBuf, pcchPathBuf);
289+
TRACE("%s %p %p\n", debugstr_w(folder), buf, sz);
330290

331-
path.unicode = TRUE;
332-
path.str.w = szPathBuf;
291+
if (!folder)
292+
return ERROR_INVALID_PARAMETER;
293+
294+
package = msihandle2msiinfo(hinst, MSIHANDLETYPE_PACKAGE);
295+
if (!package)
296+
{
297+
WCHAR *path = NULL;
298+
MSIHANDLE remote;
333299

334-
return MSI_GetTargetPath( hInstall, szFolder, &path, pcchPathBuf );
300+
if (!(remote = msi_get_remote(hinst)))
301+
return ERROR_INVALID_HANDLE;
302+
303+
r = remote_GetTargetPath(remote, folder, &path);
304+
if (!r)
305+
r = msi_strncpyW(path, -1, buf, sz);
306+
307+
midl_user_free(path);
308+
return r;
309+
}
310+
311+
path = msi_get_target_folder(package, folder);
312+
if (path)
313+
r = msi_strncpyW(path, -1, buf, sz);
314+
else
315+
r = ERROR_DIRECTORY;
316+
317+
msiobj_release(&package->hdr);
318+
return r;
335319
}
336320

337321
static WCHAR *get_source_root( MSIPACKAGE *package )

0 commit comments

Comments
 (0)