mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 20:40:30 +00:00
nsi: Allocate a small buffer at once in NsiAllocateAndGetTable().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
50c27f88e3
commit
7ef04f4118
|
@ -39,7 +39,7 @@ DWORD WINAPI NsiAllocateAndGetTable( DWORD unk, const NPI_MODULEID *module, DWOR
|
||||||
void **rw_data, DWORD rw_size, void **dynamic_data, DWORD dynamic_size,
|
void **rw_data, DWORD rw_size, void **dynamic_data, DWORD dynamic_size,
|
||||||
void **static_data, DWORD static_size, DWORD *count, DWORD unk2 )
|
void **static_data, DWORD static_size, DWORD *count, DWORD unk2 )
|
||||||
{
|
{
|
||||||
DWORD err, num = 0;
|
DWORD err, num = 64;
|
||||||
void *data[4] = { NULL };
|
void *data[4] = { NULL };
|
||||||
DWORD sizes[4] = { key_size, rw_size, dynamic_size, static_size };
|
DWORD sizes[4] = { key_size, rw_size, dynamic_size, static_size };
|
||||||
int i, attempt;
|
int i, attempt;
|
||||||
|
@ -49,9 +49,6 @@ DWORD WINAPI NsiAllocateAndGetTable( DWORD unk, const NPI_MODULEID *module, DWOR
|
||||||
|
|
||||||
for (attempt = 0; attempt < 5; attempt++)
|
for (attempt = 0; attempt < 5; attempt++)
|
||||||
{
|
{
|
||||||
err = NsiEnumerateObjectsAllParameters( unk, 0, module, table, NULL, 0, NULL, 0, NULL, 0, NULL, 0, &num );
|
|
||||||
if (err) return err;
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(data); i++)
|
for (i = 0; i < ARRAY_SIZE(data); i++)
|
||||||
{
|
{
|
||||||
if (sizes[i])
|
if (sizes[i])
|
||||||
|
@ -68,9 +65,11 @@ DWORD WINAPI NsiAllocateAndGetTable( DWORD unk, const NPI_MODULEID *module, DWOR
|
||||||
err = NsiEnumerateObjectsAllParameters( unk, 0, module, table, data[0], sizes[0], data[1], sizes[1],
|
err = NsiEnumerateObjectsAllParameters( unk, 0, module, table, data[0], sizes[0], data[1], sizes[1],
|
||||||
data[2], sizes[2], data[3], sizes[3], &num );
|
data[2], sizes[2], data[3], sizes[3], &num );
|
||||||
if (err != ERROR_MORE_DATA) break;
|
if (err != ERROR_MORE_DATA) break;
|
||||||
|
TRACE( "Short buffer, attempt %d.\n", attempt );
|
||||||
NsiFreeTable( data[0], data[1], data[2], data[3] );
|
NsiFreeTable( data[0], data[1], data[2], data[3] );
|
||||||
memset( data, 0, sizeof(data) );
|
memset( data, 0, sizeof(data) );
|
||||||
|
err = NsiEnumerateObjectsAllParameters( unk, 0, module, table, NULL, 0, NULL, 0, NULL, 0, NULL, 0, &num );
|
||||||
|
if (err) return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!err)
|
if (!err)
|
||||||
|
|
Loading…
Reference in a new issue