DOS FindFirst/FindNext fix

Jukka Heinonen jhei at iki.fi
Sat Sep 28 09:56:43 CDT 2002


It looks like conversion to wide characters messed up the
long/short mask selection logic in DOSFS_FindNextInitialize. 
Previously, null pointer was used to indicate that mask is not
to be used but RtlCreateUnicodeStringFromAsciiz changes null
pointers to empty strings. This makes it impossible to
use FindFirst/FindNext from DOS int21.


Changelog: DOSFS_FindNextInitialize now sets wchar
           long and short masks to null if char masks were null.
           

Index: files/dos_fs.c
===================================================================
RCS file: /home/wine/wine/files/dos_fs.c,v
retrieving revision 1.120
diff -u -r1.120 dos_fs.c
--- files/dos_fs.c      16 Sep 2002 19:27:15 -0000      1.120
+++ files/dos_fs.c      28 Sep 2002 14:49:45 -0000
@@ -1840,8 +1840,18 @@
         info.path = (LPSTR)path;
         RtlFreeHeap(GetProcessHeap(), 0, info.long_mask);
         RtlFreeHeap(GetProcessHeap(), 0, info.short_mask);
-        info.long_mask = long_maskW.Buffer;
-        info.short_mask = short_maskW.Buffer;
+        if(long_mask)
+            info.long_mask = long_maskW.Buffer;
+        else {
+            info.long_mask = 0;
+            RtlFreeUnicodeString(&long_maskW);
+        }
+        if(short_mask)
+            info.short_mask = short_maskW.Buffer;
+        else {
+            info.short_mask = 0;
+            RtlFreeUnicodeString(&short_maskW);
+        }
         info.attr = attr;
         info.drive = drive;
         info.cur_pos = 0;



-- 
Jukka Heinonen <http://www.iki.fi/jhei/>



More information about the wine-patches mailing list