From: Francois Gouget fgouget@codeweavers.com
The table size typically keeps increasing such that in some cases the size we got is already too small by the time we try to get the table content in the next iteration.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54328 --- This issue regularly causes NsiAllocateAndGetTable() to fail on my Linux box, maybe because there is always some network traffic. It would go like this: num=64 -> too small, num=264 -> too small, num=266 -> too small, num=267 -> too small, eventualy wasting all 5 attempts (and causing a crash when NsiAllocateAndGetTable() returned success despite it all). --- dlls/nsi/nsi.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/nsi/nsi.c b/dlls/nsi/nsi.c index 6d8ae40a5c7..3f324ef555b 100644 --- a/dlls/nsi/nsi.c +++ b/dlls/nsi/nsi.c @@ -71,6 +71,7 @@ DWORD WINAPI NsiAllocateAndGetTable( DWORD unk, const NPI_MODULEID *module, DWOR err = NsiEnumerateObjectsAllParameters( unk, 0, module, table, NULL, 0, NULL, 0, NULL, 0, NULL, 0, &num ); if (err) return err; err = ERROR_OUTOFMEMORY; /* fail if this is the last attempt */ + num += num >> 4; /* the tables may grow before the next iteration; get ahead */ }
if (!err)