grub2: bring back build of aros-side grub2 tools
[AROS.git] / tools / adflib / Win32 / adfvolinfo.c
bloba00599d020d45aa2102a8194c3593f276a4279cf
1 // An ADFLib function for Windows which displays a dialogue box containing details about
2 // the current disk file.
3 // Converted from adfVolumeInfo(), part of ADFLib by Laurent Clevy.
4 //
5 // Gary Harris
6 // 30/8/00
9 #include "../ADF_raw.h"
10 #include "../ADF_Util.h"
13 void adfVolumeInfoWin(HWND hWnd, struct Volume *vol)
14 // Windows version of adfVolumeInfo().
15 // Input: Receives a handle to the window on which to display the dialogue and a pointer
16 // to a ADFLib Volume structure.
17 // Output: Nil. Displays a windows dialogue containing the disk file data.
19 char szTemp[50], szAdfInfo[500]; // Info string.
21 struct bRootBlock root;
22 char diskName[35];
23 int days,month,year;
25 if (adfReadRootBlock(vol, vol->rootBlock, &root)!=RC_OK)
26 return;
28 memset(diskName, 0, 35);
29 memcpy(diskName, root.diskName, root.nameLen);
31 sprintf(szAdfInfo, "Name : %-30s\n", vol->volName);
32 strcat(szAdfInfo, "Type : ");
33 switch(vol->dev->devType) {
34 case DEVTYPE_FLOPDD:
35 strcat(szAdfInfo, "Floppy Double Density : 880 KBytes\n");
36 break;
37 case DEVTYPE_FLOPHD:
38 strcat(szAdfInfo, "Floppy High Density : 1760 KBytes\n");
39 break;
40 case DEVTYPE_HARDDISK:
41 sprintf(szTemp, "Hard Disk partition : %3.1f KBytes\n",
42 (vol->lastBlock - vol->firstBlock +1) * 512.0/1024.0);
43 strcat(szAdfInfo, szTemp);
44 break;
45 case DEVTYPE_HARDFILE:
46 sprintf(szTemp, "HardFile : %3.1f KBytes\n",
47 (vol->lastBlock - vol->firstBlock +1) * 512.0/1024.0);
48 strcat(szAdfInfo, szTemp);
49 break;
50 default:
51 strcat(szAdfInfo, "Unknown devType!\n");
53 strcat(szAdfInfo, "Filesystem : ");
54 sprintf(szTemp, "%s ",isFFS(vol->dosType) ? "FFS" : "OFS");
55 strcat(szAdfInfo, szTemp);
56 if (isINTL(vol->dosType))
57 strcat(szAdfInfo, "INTL ");
58 if (isDIRCACHE(vol->dosType))
59 strcat(szAdfInfo, "DIRCACHE ");
60 strcat(szAdfInfo, "\n");
62 sprintf(szTemp, "Free blocks = %ld\n", adfCountFreeBlocks(vol));
63 strcat(szAdfInfo, szTemp);
64 if (vol->readOnly)
65 strcat(szAdfInfo, "Read only\n");
66 else
67 strcat(szAdfInfo, "Read/Write\n");
69 /* created */
70 adfDays2Date(root.coDays, &year, &month, &days);
71 sprintf(szTemp, "created %d/%02d/%02d %ld:%02ld:%02ld\n",days,month,year,
72 root.coMins/60,root.coMins%60,root.coTicks/50);
73 strcat(szAdfInfo, szTemp);
74 adfDays2Date(root.days, &year, &month, &days);
75 sprintf(szTemp, "last access %d/%02d/%02d %ld:%02ld:%02ld, ",days,month,year,
76 root.mins/60,root.mins%60,root.ticks/50);
77 strcat(szAdfInfo, szTemp);
78 adfDays2Date(root.cDays, &year, &month, &days);
79 sprintf(szTemp, "%d/%02d/%02d %ld:%02ld:%02ld\n",days,month,year,
80 root.cMins/60,root.cMins%60,root.cTicks/50);
81 strcat(szAdfInfo, szTemp);
83 MessageBox(hWnd, szAdfInfo, "Adf Info", MB_OK);