MSI: test and fix the size of stream fields in a record

Mike McCormack mike at codeweavers.com
Thu May 26 22:37:01 CDT 2005


ChangeLog:
* test and fix the size of stream fields in a record
-------------- next part --------------
Index: dlls/msi/record.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/record.c,v
retrieving revision 1.26
diff -u -p -r1.26 record.c
--- dlls/msi/record.c	7 May 2005 12:13:08 -0000	1.26
+++ dlls/msi/record.c	27 May 2005 03:36:43 -0000
@@ -410,6 +410,17 @@ UINT WINAPI MsiRecordGetStringW(MSIHANDL
     return ret;
 }
 
+static UINT msi_get_stream_size( IStream *stm )
+{
+    STATSTG stat;
+    HRESULT r;
+
+    r = IStream_Stat( stm, &stat, STATFLAG_NONAME );
+    if( FAILED(r) )
+        return 0;
+    return stat.cbSize.QuadPart;
+}
+
 UINT MSI_RecordDataSize(MSIRECORD *rec, unsigned int iField)
 {
     TRACE("%p %d\n", rec, iField);
@@ -425,6 +436,8 @@ UINT MSI_RecordDataSize(MSIRECORD *rec, 
         return lstrlenW( rec->fields[iField].u.szwVal );
     case MSIFIELD_NULL:
         break;
+    case MSIFIELD_STREAM:
+        return msi_get_stream_size( rec->fields[iField].u.stream );
     }
     return 0;
 }
Index: dlls/msi/tests/record.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/tests/record.c,v
retrieving revision 1.7
diff -u -p -r1.7 record.c
--- dlls/msi/tests/record.c	19 Apr 2005 09:48:44 -0000	1.7
+++ dlls/msi/tests/record.c	27 May 2005 03:36:43 -0000
@@ -220,6 +220,10 @@ void test_msirecord(void)
     r = MsiRecordReadStream(h, 0, buf, &sz);
     ok(r == ERROR_INVALID_DATATYPE, "read non-stream type\n");
     ok(sz == sizeof buf, "set sz\n");
+    r = MsiRecordDataSize( h, -1);
+    ok(r == 0,"MsiRecordDataSize returned wrong size\n");
+    r = MsiRecordDataSize( h, 0);
+    ok(r == 4,"MsiRecordDataSize returned wrong size\n");
 
     /* same record, now close it */
     r = MsiCloseHandle(h);
@@ -279,6 +283,8 @@ void test_msirecord(void)
     r = MsiRecordReadStream(h, 1, NULL, &sz);
     ok(r == ERROR_SUCCESS, "bytes left wrong after reset\n");
     ok(sz==26,"couldn't get size of stream\n");
+    r = MsiRecordDataSize(h,1);
+    ok(r == 26,"MsiRecordDataSize returned wrong size\n");
 
     /* now close the stream record */
     r = MsiCloseHandle(h);


More information about the wine-patches mailing list