[NTVDM]
authorAleksandar Andrejevic <aandrejevic@reactos.org>
Fri, 1 May 2015 23:04:03 +0000 (23:04 +0000)
committerAleksandar Andrejevic <aandrejevic@reactos.org>
Fri, 1 May 2015 23:04:03 +0000 (23:04 +0000)
Implement INT 21h, AH = 36h "Get Free Disk Space".

svn path=/trunk/; revision=67504

reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c

index ccf106f..084f027 100644 (file)
@@ -832,6 +832,38 @@ VOID WINAPI DosInt21h(LPWORD Stack)
             break;
         }
 
+        /* Get Free Disk Space */
+        case 0x36:
+        {
+            CHAR RootPath[3] = "X:\\";
+            DWORD SectorsPerCluster;
+            DWORD BytesPerSector;
+            DWORD NumberOfFreeClusters;
+            DWORD TotalNumberOfClusters;
+
+            if (getDL() == 0) RootPath[0] = 'A' + CurrentDrive;
+            else RootPath[0] = 'A' + getDL() - 1;
+
+            if (GetDiskFreeSpaceA(RootPath,
+                                  &SectorsPerCluster,
+                                  &BytesPerSector,
+                                  &NumberOfFreeClusters,
+                                  &TotalNumberOfClusters))
+            {
+                setAX(LOWORD(SectorsPerCluster));
+                setCX(LOWORD(BytesPerSector));
+                setBX(LOWORD(NumberOfFreeClusters));
+                setDX(LOWORD(TotalNumberOfClusters));
+            }
+            else
+            {
+                /* Error */
+                setAX(0xFFFF);
+            }
+
+            break;
+        }
+
         /* SWITCH character - AVAILDEV */
         case 0x37:
         {