msi: fix calls to ReadFile()
Thomas Weidenmueller
wine-patches at reactsoft.com
Fri Oct 28 10:21:24 CDT 2005
Passing NULL as the last two parameters to ReadFile is illegal and
actually causes a crash on windows. The attached patch fixes this.
- Thomas
-------------- next part --------------
Index: dlls/msi/action.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/action.c,v
retrieving revision 1.217
diff -u -r1.217 action.c
--- dlls/msi/action.c 28 Oct 2005 09:39:29 -0000 1.217
+++ dlls/msi/action.c 28 Oct 2005 15:15:23 -0000
@@ -3866,8 +3866,9 @@
TT_TABLE_DIRECTORY tblDir;
BOOL bFound = FALSE;
TT_OFFSET_TABLE ttOffsetTable;
+ DWORD dwRead;
- ReadFile(handle,&ttOffsetTable, sizeof(TT_OFFSET_TABLE),NULL,NULL);
+ ReadFile(handle,&ttOffsetTable, sizeof(TT_OFFSET_TABLE),&dwRead,NULL);
ttOffsetTable.uNumOfTables = SWAPWORD(ttOffsetTable.uNumOfTables);
ttOffsetTable.uMajorVersion = SWAPWORD(ttOffsetTable.uMajorVersion);
ttOffsetTable.uMinorVersion = SWAPWORD(ttOffsetTable.uMinorVersion);
@@ -3878,7 +3879,7 @@
for (i=0; i< ttOffsetTable.uNumOfTables; i++)
{
- ReadFile(handle,&tblDir, sizeof(TT_TABLE_DIRECTORY),NULL,NULL);
+ ReadFile(handle,&tblDir, sizeof(TT_TABLE_DIRECTORY),&dwRead,NULL);
if (strncmp(tblDir.szTag,"name",4)==0)
{
bFound = TRUE;
@@ -3895,14 +3896,14 @@
SetFilePointer(handle, tblDir.uOffset, NULL, FILE_BEGIN);
ReadFile(handle,&ttNTHeader, sizeof(TT_NAME_TABLE_HEADER),
- NULL,NULL);
+ &dwRead,NULL);
ttNTHeader.uNRCount = SWAPWORD(ttNTHeader.uNRCount);
ttNTHeader.uStorageOffset = SWAPWORD(ttNTHeader.uStorageOffset);
bFound = FALSE;
for(i=0; i<ttNTHeader.uNRCount; i++)
{
- ReadFile(handle,&ttRecord, sizeof(TT_NAME_RECORD),NULL,NULL);
+ ReadFile(handle,&ttRecord, sizeof(TT_NAME_RECORD),&dwRead,NULL);
ttRecord.uNameID = SWAPWORD(ttRecord.uNameID);
/* 4 is the Full Font Name */
if(ttRecord.uNameID == 4)
@@ -3920,7 +3921,7 @@
NULL, FILE_BEGIN);
buf = msi_alloc( ttRecord.uStringLength + 1 + strlen(tt) );
memset(buf, 0, ttRecord.uStringLength + 1 + strlen(tt));
- ReadFile(handle, buf, ttRecord.uStringLength, NULL, NULL);
+ ReadFile(handle, buf, ttRecord.uStringLength, &dwRead, NULL);
if (strlen(buf) > 0)
{
strcat(buf,tt);
More information about the wine-patches
mailing list