msi: Perform partial copies in MsiViewGetError().
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>
This commit is contained in:
parent
fac04043d9
commit
6a3dbf1192
|
@ -772,7 +772,6 @@ MSIDBERROR WINAPI MsiViewGetErrorW( MSIHANDLE handle, LPWSTR buffer, LPDWORD buf
|
|||
MSIQUERY *query;
|
||||
const WCHAR *column;
|
||||
MSIDBERROR r;
|
||||
DWORD len;
|
||||
|
||||
TRACE("%u %p %p\n", handle, buffer, buflen);
|
||||
|
||||
|
@ -786,15 +785,9 @@ MSIDBERROR WINAPI MsiViewGetErrorW( MSIHANDLE handle, LPWSTR buffer, LPDWORD buf
|
|||
if ((r = query->view->error)) column = query->view->error_column;
|
||||
else column = szEmpty;
|
||||
|
||||
len = strlenW( column );
|
||||
if (buffer)
|
||||
{
|
||||
if (*buflen > len)
|
||||
strcpyW( buffer, column );
|
||||
else
|
||||
r = MSIDBERROR_MOREDATA;
|
||||
}
|
||||
*buflen = len;
|
||||
if (msi_strncpyW(column, -1, buffer, buflen) == ERROR_MORE_DATA)
|
||||
r = MSIDBERROR_MOREDATA;
|
||||
|
||||
msiobj_release( &query->hdr );
|
||||
return r;
|
||||
}
|
||||
|
@ -804,7 +797,6 @@ MSIDBERROR WINAPI MsiViewGetErrorA( MSIHANDLE handle, LPSTR buffer, LPDWORD bufl
|
|||
MSIQUERY *query;
|
||||
const WCHAR *column;
|
||||
MSIDBERROR r;
|
||||
DWORD len;
|
||||
|
||||
TRACE("%u %p %p\n", handle, buffer, buflen);
|
||||
|
||||
|
@ -818,15 +810,9 @@ MSIDBERROR WINAPI MsiViewGetErrorA( MSIHANDLE handle, LPSTR buffer, LPDWORD bufl
|
|||
if ((r = query->view->error)) column = query->view->error_column;
|
||||
else column = szEmpty;
|
||||
|
||||
len = WideCharToMultiByte( CP_ACP, 0, column, -1, NULL, 0, NULL, NULL );
|
||||
if (buffer)
|
||||
{
|
||||
if (*buflen >= len)
|
||||
WideCharToMultiByte( CP_ACP, 0, column, -1, buffer, *buflen, NULL, NULL );
|
||||
else
|
||||
r = MSIDBERROR_MOREDATA;
|
||||
}
|
||||
*buflen = len - 1;
|
||||
if (msi_strncpyWtoA(column, -1, buffer, buflen, FALSE) == ERROR_MORE_DATA)
|
||||
r = MSIDBERROR_MOREDATA;
|
||||
|
||||
msiobj_release( &query->hdr );
|
||||
return r;
|
||||
}
|
||||
|
|
|
@ -9163,14 +9163,14 @@ static void test_view_get_error(void)
|
|||
strcpy(buffer, "x");
|
||||
err = MsiViewGetErrorA(view, buffer, &sz);
|
||||
ok(err == MSIDBERROR_MOREDATA, "got %d\n", err);
|
||||
todo_wine ok(!buffer[0], "got \"%s\"\n", buffer);
|
||||
ok(!buffer[0], "got \"%s\"\n", buffer);
|
||||
ok(sz == 1, "got size %u\n", sz);
|
||||
|
||||
sz = 1;
|
||||
strcpy(buffer, "x");
|
||||
err = MsiViewGetErrorA(view, buffer, &sz);
|
||||
todo_wine ok(err == MSIDBERROR_NOERROR, "got %d\n", err);
|
||||
todo_wine ok(!buffer[0], "got \"%s\"\n", buffer);
|
||||
ok(!buffer[0], "got \"%s\"\n", buffer);
|
||||
todo_wine ok(sz == 0, "got size %u\n", sz);
|
||||
|
||||
r = MsiViewModify(view, MSIMODIFY_VALIDATE_NEW, rec);
|
||||
|
|
Loading…
Reference in New Issue