mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 02:36:13 +00:00
[WINESYNC] msi: Avoid using awstring in MsiFormatRecordW().
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 6b54a4bc2eadd0b5cbc2553e2969ff572ff042d1 by Zebediah Figura <z.figura12@gmail.com>
This commit is contained in:
parent
d5e04177e7
commit
0b125236c6
4 changed files with 34 additions and 9 deletions
|
@ -916,22 +916,16 @@ UINT WINAPI MsiFormatRecordW( MSIHANDLE hInstall, MSIHANDLE hRecord,
|
||||||
{
|
{
|
||||||
LPWSTR value = NULL;
|
LPWSTR value = NULL;
|
||||||
MSIHANDLE remote;
|
MSIHANDLE remote;
|
||||||
awstring wstr;
|
|
||||||
|
|
||||||
if ((remote = msi_get_remote(hInstall)))
|
if ((remote = msi_get_remote(hInstall)))
|
||||||
{
|
{
|
||||||
r = remote_FormatRecord(remote, (struct wire_record *)&record->count, &value);
|
r = remote_FormatRecord(remote, (struct wire_record *)&record->count, &value);
|
||||||
if (r)
|
|
||||||
{
|
|
||||||
midl_user_free(value);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
wstr.unicode = TRUE;
|
if (!r)
|
||||||
wstr.str.w = szResult;
|
r = msi_strncpyW(value, -1, szResult, sz);
|
||||||
r = msi_strcpy_to_awstring(value, -1, &wstr, sz);
|
|
||||||
|
|
||||||
midl_user_free(value);
|
midl_user_free(value);
|
||||||
|
msiobj_release(&record->hdr);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,6 +191,25 @@ UINT msi_strncpyWtoA(const WCHAR *str, int lenW, char *buf, DWORD *sz, BOOL remo
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UINT msi_strncpyW(const WCHAR *str, int len, WCHAR *buf, DWORD *sz)
|
||||||
|
{
|
||||||
|
UINT r = ERROR_SUCCESS;
|
||||||
|
|
||||||
|
if (!sz)
|
||||||
|
return buf ? ERROR_INVALID_PARAMETER : ERROR_SUCCESS;
|
||||||
|
|
||||||
|
if (len < 0) len = strlenW(str);
|
||||||
|
if (buf)
|
||||||
|
memcpy(buf, str, min(len + 1, *sz) * sizeof(WCHAR));
|
||||||
|
if (buf && len >= *sz)
|
||||||
|
{
|
||||||
|
if (*sz) buf[*sz - 1] = 0;
|
||||||
|
r = ERROR_MORE_DATA;
|
||||||
|
}
|
||||||
|
*sz = len;
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
const WCHAR *msi_get_target_folder( MSIPACKAGE *package, const WCHAR *name )
|
const WCHAR *msi_get_target_folder( MSIPACKAGE *package, const WCHAR *name )
|
||||||
{
|
{
|
||||||
MSIFOLDER *folder = msi_get_loaded_folder( package, name );
|
MSIFOLDER *folder = msi_get_loaded_folder( package, name );
|
||||||
|
|
|
@ -1047,6 +1047,7 @@ extern WCHAR **msi_split_string(const WCHAR *, WCHAR) DECLSPEC_HIDDEN;
|
||||||
extern UINT msi_set_original_database_property(MSIDATABASE *, const WCHAR *) DECLSPEC_HIDDEN;
|
extern UINT msi_set_original_database_property(MSIDATABASE *, const WCHAR *) DECLSPEC_HIDDEN;
|
||||||
extern WCHAR *msi_get_error_message(MSIDATABASE *, int) DECLSPEC_HIDDEN;
|
extern WCHAR *msi_get_error_message(MSIDATABASE *, int) DECLSPEC_HIDDEN;
|
||||||
extern UINT msi_strncpyWtoA(const WCHAR *str, int len, char *buf, DWORD *sz, BOOL remote) DECLSPEC_HIDDEN;
|
extern UINT msi_strncpyWtoA(const WCHAR *str, int len, char *buf, DWORD *sz, BOOL remote) DECLSPEC_HIDDEN;
|
||||||
|
extern UINT msi_strncpyW(const WCHAR *str, int len, WCHAR *buf, DWORD *sz) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
/* media */
|
/* media */
|
||||||
|
|
||||||
|
|
|
@ -815,6 +815,17 @@ static void test_format_record(MSIHANDLE hinst)
|
||||||
ok(hinst, !strcmp(buffer, "foo 123"), "got \"%s\"\n", buffer);
|
ok(hinst, !strcmp(buffer, "foo 123"), "got \"%s\"\n", buffer);
|
||||||
ok(hinst, sz == 7, "got size %u\n", sz);
|
ok(hinst, sz == 7, "got size %u\n", sz);
|
||||||
|
|
||||||
|
r = MsiFormatRecordW(hinst, rec, NULL, NULL);
|
||||||
|
ok(hinst, !r, "got %u\n", r);
|
||||||
|
|
||||||
|
r = MsiFormatRecordW(hinst, rec, bufferW, NULL);
|
||||||
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
||||||
|
|
||||||
|
sz = 0;
|
||||||
|
r = MsiFormatRecordW(hinst, rec, NULL, &sz);
|
||||||
|
ok(hinst, !r, "got %u\n", r);
|
||||||
|
ok(hinst, sz == 7, "got size %u\n", sz);
|
||||||
|
|
||||||
sz = 0;
|
sz = 0;
|
||||||
bufferW[0] = 'q';
|
bufferW[0] = 'q';
|
||||||
r = MsiFormatRecordW(hinst, rec, bufferW, &sz);
|
r = MsiFormatRecordW(hinst, rec, bufferW, &sz);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue