Paul Gofman : nsi: Allocate a small buffer at once in NsiAllocateAndGetTable().
Alexandre Julliard
julliard at winehq.org
Tue May 17 15:37:23 CDT 2022
Module: wine
Branch: master
Commit: 7ef04f4118c1d221c1f8d8d87d833246534ebe47
URL: https://source.winehq.org/git/wine.git/?a=commit;h=7ef04f4118c1d221c1f8d8d87d833246534ebe47
Author: Paul Gofman <pgofman at codeweavers.com>
Date: Mon May 16 16:53:03 2022 -0500
nsi: Allocate a small buffer at once in NsiAllocateAndGetTable().
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/nsi/nsi.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/dlls/nsi/nsi.c b/dlls/nsi/nsi.c
index efb10c0f615..345dce6dfe6 100644
--- a/dlls/nsi/nsi.c
+++ b/dlls/nsi/nsi.c
@@ -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 **static_data, DWORD static_size, DWORD *count, DWORD unk2 )
{
- DWORD err, num = 0;
+ DWORD err, num = 64;
void *data[4] = { NULL };
DWORD sizes[4] = { key_size, rw_size, dynamic_size, static_size };
int i, attempt;
@@ -49,9 +49,6 @@ DWORD WINAPI NsiAllocateAndGetTable( DWORD unk, const NPI_MODULEID *module, DWOR
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++)
{
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],
data[2], sizes[2], data[3], sizes[3], &num );
if (err != ERROR_MORE_DATA) break;
-
+ TRACE( "Short buffer, attempt %d.\n", attempt );
NsiFreeTable( data[0], data[1], data[2], data[3] );
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)
More information about the wine-cvs
mailing list