winedos / Implement fat32 get extended free space
Jukka Heinonen
jhei at iki.fi
Sun Nov 2 11:57:28 CST 2003
Changelog:
Implement fat32 extended free space function.
Make fat32 calls reset carry flag explicitly.
Index: dlls/winedos/int21.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/int21.c,v
retrieving revision 1.44
diff -u -r1.44 int21.c
--- dlls/winedos/int21.c 27 Oct 2003 22:06:11 -0000 1.44
+++ dlls/winedos/int21.c 2 Nov 2003 17:53:13 -0000
@@ -2474,6 +2474,55 @@
}
break;
+ case 0x03: /* FAT32 - GET EXTENDED FREE SPACE ON DRIVE */
+ {
+ WCHAR dirW[MAX_PATH];
+ char *dirA = CTX_SEG_OFF_TO_LIN( context,
+ context->SegDs, context->Edx );
+ BYTE *data = CTX_SEG_OFF_TO_LIN( context,
+ context->SegEs, context->Edi );
+ DWORD cluster_sectors;
+ DWORD sector_bytes;
+ DWORD free_clusters;
+ DWORD total_clusters;
+
+ TRACE( "FAT32 - GET EXTENDED FREE SPACE ON DRIVE %s\n", dirA );
+ MultiByteToWideChar(CP_OEMCP, 0, dirA, -1, dirW, MAX_PATH);
+
+ if (CX_reg(context) < 44)
+ {
+ SetLastError( ERROR_BAD_LENGTH );
+ return FALSE;
+ }
+
+ if (!GetDiskFreeSpaceW( dirW, &cluster_sectors, §or_bytes,
+ &free_clusters, &total_clusters ))
+ return FALSE;
+
+ *(WORD*) (data + 0) = 44; /* size of structure */
+ *(WORD*) (data + 2) = 0; /* version */
+ *(DWORD*)(data + 4) = cluster_sectors;
+ *(DWORD*)(data + 8) = sector_bytes;
+ *(DWORD*)(data + 12) = free_clusters;
+ *(DWORD*)(data + 16) = total_clusters;
+
+ /*
+ * Below we have free/total sectors and
+ * free/total allocation units without adjustment
+ * for compression. We fake both using cluster information.
+ */
+ *(DWORD*)(data + 20) = free_clusters * cluster_sectors;
+ *(DWORD*)(data + 24) = total_clusters * cluster_sectors;
+ *(DWORD*)(data + 28) = free_clusters;
+ *(DWORD*)(data + 32) = total_clusters;
+
+ /*
+ * Between (data + 36) and (data + 43) there
+ * are eight reserved bytes.
+ */
+ }
+ break;
+
default:
INT_BARF( context, 0x21 );
}
@@ -3923,6 +3972,7 @@
break;
case 0x73: /* MSDOS7 - FAT32 */
+ RESET_CFLAG( context );
if (!INT21_Fat32( context ))
bSetDOSExtendedError = TRUE;
break;
--
Jukka Heinonen <http://www.iki.fi/jhei/>
More information about the wine-patches
mailing list