// ritorna TRUE se il file system Š HPFS BOOL isHPFS(UCHAR uchDrive) { BYTE buf[512]; ULONG ul = 512; CHAR pszDrv[] = "?:"; pszDrv[0] = uchDrive; DosQueryFSAttach(pszDrv, 0L, FSAIL_QUERYNAME, (PFSQBUFFER2)buf, &ul); return (BOOL)!sstrcmp("HPFS", ((PSZ)(((PFSQBUFFER2)buf)->szName)) + 3); }
BOOL showlocal(ULONG drvno) { UCHAR devname[3]; BYTE fsqBuffer[sizeof(FSQBUFFER2)+(3*CCHMAXPATH)]; APIRET rc; PFSQBUFFER2 fsinfo = (PFSQBUFFER2) fsqBuffer; ULONG fsinfolen= sizeof(fsqBuffer); if(!drvReady(drvno)) return FALSE; devname[0] = drvBst(drvno); devname[1] = ':'; devname[2] = '\000'; rc = DosQueryFSAttach( devname, 0, FSAIL_QUERYNAME, fsinfo, &fsinfolen ); if(rc!=0&&rc!=ERROR_NOT_READY) fprintf(stderr,"error: type helpmsg %li\n",rc); return (rc!=ERROR_NOT_READY) && ( rc!=0 || fsinfo->iType == FSAT_LOCALDRV ); }
/* * Return first char of filesystem type, or 0 if unknown. */ static char getFSType(const char *path) { static char cache[1 + 26]; char drive[3], info[512]; Word unit, infolen; char r; if (isalpha(path[0]) && path[1] == ':') { unit = toupper(path[0]) - '@'; path += 2; } else { ULONG driveMap; #if OS2 >= 2 if (DosQueryCurrentDisk(&unit, &driveMap)) #else if (DosQCurDisk(&unit, &driveMap)) #endif return 0; } if ((path[0] == '\\' || path[0] == '/') && (path[1] == '\\' || path[1] == '/')) return 0; if (cache[unit]) return cache[unit]; drive[0] = '@' + unit; drive[1] = ':'; drive[2] = '\0'; infolen = sizeof info; #if OS2 >= 2 if (DosQueryFSAttach(drive, 0, FSAIL_QUERYNAME, (PVOID)info, &infolen)) return 0; if (infolen >= sizeof(FSQBUFFER2)) { FSQBUFFER2 *p = (FSQBUFFER2 *)info; r = p->szFSDName[p->cbName]; } else #else if (DosQFSAttach((PSZ)drive, 0, FSAIL_QUERYNAME, (PVOID)info, &infolen, 0)) return 0; if (infolen >= 9) { char *p = info + sizeof(USHORT); p += sizeof(USHORT) + *(USHORT *)p + 1 + sizeof(USHORT); r = *p; } else #endif r = 0; return cache[unit] = r; }
BOOL fillDrvList(PINSTALLDATA pid, HWND hprgs) { char dev[4]; FSALLOCATE fsa; BYTE buf[32]; CHAR achdd[32]; ULONG ulDriveNum = 0; ULONG ulDriveMap = 0; ULONG ul, idx, tot; int i, j, k; PFSQBUFFER2 pfsqb = (PFSQBUFFER2)buf; strcpy(dev, " :"); DosError(0); DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap); // conta drive presenti for (i = 2, tot = 0; i < 26; ++i) tot += (ulDriveMap & 1L << i)? 1: 0; // per ogni drive presente raccogli informazioni for (i = 2, j = 0, k = 0, idx = 0; i < 26; i++) {// ripete x tutti i drive // DosSleep(1000); if (ulDriveMap & 1L << i) { // se trova partizione if (Wincrease(&idx, hprgs, tot)) return FALSE; ul = 32; dev[0] = (CHAR)(i + 'A'); if (DosQueryFSInfo(i + 1, FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) continue; // se drive non disponibile passa a successivo DosQueryFSAttach((PSZ)dev, 1, FSAIL_QUERYNAME, (PFSQBUFFER2)&buf, &ul); if (pfsqb->iType != 3 || // se non drive locale (strcmp(pfsqb->szName + 3, "FAT") && // o nŠ FAT strcmp(pfsqb->szName + 3, "HPFS") && strcmp(pfsqb->szName + 3, "JFS"))) // e nŠ HPFS continue; // passa al successivo pid->cMbDrv[i] = (ULONG)((float)fsa.cbSector * (float)fsa.cSectorUnit * (float)fsa.cUnitAvail) / 1048576; sprintf(achdd, "%s % 15d MB", dev, pid->cMbDrv[i]); DlgLboxInsertItem(pid->hwnd, LBX_INSTDRV, LIT_END, achdd); // seleziona l'item corrispondente al drive menzionato in pad->path if (dev[0] == *pid->tpath) k = j; j++; } // end if } // end for Wincrease(&idx, hprgs, tot); DosError(1); DlgLboxSelectItem(pid->hwnd, LBX_INSTDRV, k); WinPostMsg(hprgs, PRGSM_END, MPVOID, MPVOID); return TRUE; }
static int is_singletasking_fs( const char* filename ) { if( isalpha( filename[0] ) && filename[1] == ':' ) { // Return-data buffer should be large enough to hold FSQBUFFER2 // and the maximum data for szName, szFSDName, and rgFSAData // Typically, the data isn't that large. BYTE fsqBuffer[ sizeof( FSQBUFFER2 ) + ( 3 * CCHMAXPATH )] = { 0 }; PFSQBUFFER2 pfsqBuffer = (PFSQBUFFER2)fsqBuffer; ULONG cbBuffer = sizeof( fsqBuffer ); PBYTE pszFSDName = NULL; UCHAR szDeviceName[3] = "x:"; APIRET rc; szDeviceName[0] = filename[0]; rc = DosQueryFSAttach( szDeviceName, // Logical drive of attached FS 0, // Ignored for FSAIL_QUERYNAME FSAIL_QUERYNAME, // Return data for a Drive or Device pfsqBuffer, // Returned data &cbBuffer ); // Returned data length // On successful return, the fsqBuffer structure contains // a set of information describing the specified attached // file system and the DataBufferLen variable contains // the size of information within the structure. if( rc == NO_ERROR ) { pszFSDName = pfsqBuffer->szName + pfsqBuffer->cbName + 1; if( stricmp( pszFSDName, "FAT32" ) == 0 ) { DEBUGLOG(( "xio123: detected %s filesystem for file %s, serialize access.\n", pszFSDName, filename )); return 1; } else { DEBUGLOG(( "xio123: detected %s filesystem for file %s.\n", pszFSDName, filename )); } } } return 0; }
PSZ GetFSName(PSZ pszDevice) { static BYTE Buffer[200]; ULONG ulBufferSize; PFSQBUFFER2 fsqBuf = (PFSQBUFFER2)Buffer; APIRET rc; ulBufferSize = sizeof Buffer; DosError(0); rc = DosQueryFSAttach(pszDevice, 1L, FSAIL_QUERYNAME, fsqBuf, &ulBufferSize); DosError(1); if (rc) return ""; return fsqBuf->szName + fsqBuf->cbName + 1; }
char *getIFSname(int drive) { static char ifs_name[256]; #ifdef __OS2__ char devicename[3]; ULONG ordinal,infolevel; APIRET rc; struct { USHORT a,b,c,d; CHAR data[9000]; } Buffer; ULONG BufferLen; devicename[0]=64+drive; devicename[1]=':'; devicename[2]=0; infolevel=1; BufferLen=sizeof(Buffer); rc = DosQueryFSAttach(devicename,ordinal,infolevel, (void*)&Buffer,&BufferLen); if (rc!=0) return 0; if (Buffer.c>sizeof(ifs_name)) Buffer.c=sizeof(ifs_name); memcpy(ifs_name,&Buffer.data[Buffer.b+1],Buffer.c+1); return ifs_name; #else // code for DOS struct fatinfo data; getfat(drive,&data); switch (data.fi_fatid) { case 0xfff0: strcpy(ifs_name,"other"); break; default: strcpy(ifs_name,"FAT"); } // sprintf(ifs_name,"%x",data.fi_fatid); return ifs_name; #endif }
VOID QueryDrives (HWND hWnd) { PFSQBUFFER2 pfsq2; ULONG ulLen, ulInx, ulAction, ulParmLen, ulDataLen; APIRET RetCode; HFILE hFile; BIOSPARAMETERBLOCK bpb; CHAR szDrive[3] = " :"; BYTE cBlock = 0; WinSetPointer (HWND_DESKTOP, WinQuerySysPointer (HWND_DESKTOP,SPTR_WAIT,FALSE)); /* Allocate buffer */ DosAllocMem ((PPVOID)&pfsq2, 1024L, fALLOC); DosError (FERR_DISABLEHARDERR); ulNumDrives = 0L; for (ulInx = 0; ulInx < 26; ulInx++) { szDrive[0] = (CHAR)('A' + ulInx); ulLen = 1024L; RetCode = DosQueryFSAttach (szDrive, 0L, FSAIL_QUERYNAME, pfsq2, &ulLen); DriveInfo[ulNumDrives].szDrive[0] = szDrive[0]; DriveInfo[ulNumDrives].szDrive[1] = '\0'; if (RetCode == ERROR_NOT_READY) { /* Assume local, removable, and FAT file system */ strcpy (DriveInfo[ulNumDrives].szLocation, "Local"); strcpy (DriveInfo[ulNumDrives].szRemovable, "Yes"); strcpy (DriveInfo[ulNumDrives].szFileSystem, "FAT"); DriveInfo[ulNumDrives].ulDescriptionIndex = 10L; ulNumDrives++; } else if (RetCode != ERROR_INVALID_DRIVE) { bpb.fsDeviceAttr = 0; /* Attempt to open the device */ if (!DosOpen (szDrive, &hFile, &ulAction, 0L, FILE_NORMAL, FILE_OPEN, OPEN_FLAGS_DASD | OPEN_SHARE_DENYNONE, 0L)) { ulParmLen = sizeof(BYTE); ulDataLen = sizeof(BIOSPARAMETERBLOCK); DosDevIOCtl (hFile, IOCTL_DISK, DSK_GETDEVICEPARAMS, (PVOID)&cBlock, ulParmLen, &ulParmLen, (PVOID)&bpb, ulDataLen, &ulDataLen); DosClose (hFile); } else { /* Remote drives may not allow themselves to be opened with the OPEN_FLAGS_DASD access flag. Default to not removable and description of unknown. */ bpb.fsDeviceAttr = 0x0001; bpb.bDeviceType = 7; } /* Is the drive remote? */ if (pfsq2->iType == FSAT_REMOTEDRV) strcpy (DriveInfo[ulNumDrives].szLocation, "Remote"); else strcpy (DriveInfo[ulNumDrives].szLocation, "Local"); /* Is the drive removable? */ if (bpb.fsDeviceAttr & 0x0001) strcpy (DriveInfo[ulNumDrives].szRemovable, "No"); else strcpy (DriveInfo[ulNumDrives].szRemovable, "Yes"); /* Set the description index */ if (bpb.bDeviceType < 10) DriveInfo[ulNumDrives].ulDescriptionIndex = (LONG)bpb.bDeviceType; else DriveInfo[ulNumDrives].ulDescriptionIndex = 7L; /* Set the file system name */ strncpy (DriveInfo[ulNumDrives].szFileSystem, (PSZ)(pfsq2->szName + 1 + pfsq2->cbName), 15); ulNumDrives++; } } DosError (FERR_ENABLEHARDERR); DosFreeMem (pfsq2); /* Add items to the drive listbox */ for (ulInx = 0; ulInx < ulNumDrives; ulInx++) WinSendDlgItemMsg (hWnd, IDC_DRIVELIST, LM_INSERTITEM, (MPARAM)LIT_END, DriveInfo[ulInx].szDrive); WinSendDlgItemMsg (hWnd, IDC_DRIVELIST, LM_SELECTITEM, 0L, (MPARAM)TRUE); WinSetPointer (HWND_DESKTOP, WinQuerySysPointer (HWND_DESKTOP,SPTR_ARROW,FALSE)); return; }
int main (int argc, char *argv[]) { char logText[CCHMAXPATH]; short a; FILE *file; ULONG fl; HWND hwndClient; char text[CCHMAXPATH+10]; char title[CCHMAXPATH]; /* Create a copy of the args */ /* argv[0]: progname * argv[1]: installdir of Audio-CD-Creator * argv[2]: foldername * argv[3]: imagename * argv[4]: Parameter file */ ULONG ulDriveNum=0; ULONG ulDriveMap=0; APIRET rc; int i; rc=DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap); if(rc!=NO_ERROR) { printf("Error\n"); exit(1); } printf("Current disk: %c:\n",'A'+ulDriveNum-1); printf("Drive map:\n"); printf("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z\n"); for(i=0;i<26;i++) { printf(( (ulDriveMap << (31-i)) >>31) ? "y ": "- "); } printf("\n\n"); DosError(FERR_DISABLEHARDERR); for(i=2;i<26;i++) { if(( (ulDriveMap << (31-i)) >>31)) { char chrDrive[3]="A:"; BYTE fsqBuf2[sizeof(FSQBUFFER2)+3*CCHMAXPATH]={0}; PFSQBUFFER2 pfsqBuf2=(PFSQBUFFER2) &fsqBuf2; ULONG ulLength; /* Get FS */ chrDrive[0]='A'+i; ulLength=sizeof(fsqBuf2); rc=DosQueryFSAttach(chrDrive,0L,FSAIL_QUERYNAME, (PFSQBUFFER2)&fsqBuf2, &ulLength); if(DosQueryFSAttach(chrDrive,0L,FSAIL_QUERYNAME, (PFSQBUFFER2)&fsqBuf2, &ulLength)==NO_ERROR) { if(!strcmp(pfsqBuf2->szName+pfsqBuf2->cbName+1,"ISOFS")) { FSINFO fsInfo; rc=DosQueryFSInfo(i+1, FSIL_VOLSER, &fsInfo,sizeof(fsInfo)); printf("%s %s %d %s\n",chrDrive, pfsqBuf2->szName+pfsqBuf2->cbName+1, i+1, fsInfo.vol.szVolLabel); } } else printf("%s %s\n",chrDrive, "---"); } } DosError(FERR_ENABLEHARDERR); printf("\n\nDone"); return 0; }
/* This Proc handles the ISO image mounting */ MRESULT EXPENTRY unmountIsoDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { char text[CCHMAXPATH]; char title[CCHMAXPATH]; ULONG rc; SWCNTRL swctl; PID pid; switch (msg) { case WM_INITDLG: { BOOL bDone=FALSE; int i; writeLog("Initializing dialog...\n"); /* Add switch entry */ memset(&swctl,0,sizeof(swctl)); WinQueryWindowProcess(hwnd,&pid,NULL); swctl.hwnd=hwnd; swctl.uchVisibility=SWL_VISIBLE; swctl.idProcess=pid; swctl.bProgType=PROG_DEFAULT; swctl.fbJump=SWL_JUMPABLE; WinAddSwitchEntry(&swctl); /*sprintf(text,"%d",params[4]);*/ // sprintf(text,"params[1]: %s ",params[1]); /* WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, pvSharedMem, params[4], 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE ); WinPostMsg(hwnd,WM_CLOSE,0,0); return (MRESULT) TRUE; */ /* Get free drive letters */ if((rc=DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap))!=NO_ERROR) WinPostMsg(hwnd,WM_CLOSE,0,0); DosError(FERR_DISABLEHARDERR); for(i=2;i<26;i++) { if(( (ulDriveMap << (31-i)) >>31)) { char chrDrive[3]="A:"; BYTE fsqBuf2[sizeof(FSQBUFFER2)+3*CCHMAXPATH]={0}; PFSQBUFFER2 pfsqBuf2=(PFSQBUFFER2) &fsqBuf2; ULONG ulLength; /* Get FS */ chrDrive[0]='A'+i; ulLength=sizeof(fsqBuf2); if(DosQueryFSAttach(chrDrive,0L,FSAIL_QUERYNAME, (PFSQBUFFER2)&fsqBuf2, &ulLength)==NO_ERROR) { if(!strcmp(pfsqBuf2->szName+pfsqBuf2->cbName+1,"ISOFS")) { FSINFO fsInfo; if(DosQueryFSInfo(i+1, FSIL_VOLSER, &fsInfo,sizeof(fsInfo))==NO_ERROR) sprintf(text, "%s (%s)",chrDrive, fsInfo.vol.szVolLabel); else sprintf(text, "%s (unknown)",chrDrive); WinSendMsg(WinWindowFromID(hwnd, IDLB_UNMOUNTLETTER),LM_INSERTITEM,MPFROMSHORT(LIT_END),MPFROMP(text)); } } else printf("%s %s\n",chrDrive, "---"); } } DosError(FERR_ENABLEHARDERR); /* Set dialog font to WarpSans for Warp 4 and above */ if(cwQueryOSRelease()>=40) { WinSetPresParam(hwnd, PP_FONTNAMESIZE,(ULONG)sizeof(DEFAULT_DIALOG_FONT), DEFAULT_DIALOG_FONT ); } if(!bHaveWindowPos) WinSetWindowPos(hwnd,HWND_TOP,0,0,0,0,SWP_ZORDER|SWP_ACTIVATE); else WinSetWindowPos(hwnd,HWND_TOP,swpWindow.x, swpWindow.y, 0, 0, SWP_MOVE|SWP_ZORDER|SWP_ACTIVATE|SWP_SHOW); return (MRESULT) TRUE; } case WM_CLOSE: WinQueryWindowPos(hwnd,&swpWindow); WinDismissDlg(hwnd,0); return FALSE; case WM_HELP: sendCommand("DISPLAYHELPPANEL=5100"); break; case WM_COMMAND: switch(SHORT1FROMMP(mp1)) { case IDPB_UNMOUNT: { /* User pressed the Unount button */ AEFS_DETACH detachparms={0}; char pszDrive[3]={0}; HOBJECT hObject; SHORT sSelected; memset(&detachparms, 0, sizeof(detachparms)); /* Get the drive letter */ sSelected=SHORT1FROMMR(WinSendMsg(WinWindowFromID(hwnd, IDLB_UNMOUNTLETTER),LM_QUERYSELECTION, MPFROMSHORT(LIT_FIRST),MPFROMLONG(0L))); if(sSelected==LIT_NONE) break; WinSendMsg(WinWindowFromID(hwnd, IDLB_UNMOUNTLETTER),LM_QUERYITEMTEXT, MPFROM2SHORT(sSelected,2),MPFROMP(pszDrive)); /* Send the attachment request to the FSD. */ rc = DosFSAttach( // (PSZ) "", (PSZ) pszDrive, (PSZ) AEFS_IFS_NAME, &detachparms, sizeof(detachparms), FS_DETACH); if (rc) { DosBeep(100,400); sprintf(text, "Error while unmounting rc=%d. Make sure there're no open files on the drive.\n", rc); WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, text, "ISO image unmount error", 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE ); }else { WinSendMsg(WinWindowFromID(hwnd, IDLB_UNMOUNTLETTER),LM_DELETEITEM, MPFROMSHORT(sSelected),MPFROMLONG(0L)); sSelected=SHORT1FROMMR(WinSendMsg(WinWindowFromID(hwnd, IDLB_UNMOUNTLETTER),LM_QUERYITEMCOUNT, MPFROMLONG(0L),MPFROMLONG(0L))); if(sSelected==0) WinEnableWindow(WinWindowFromID(hwnd,IDPB_UNMOUNT), FALSE); } break; } case IDPB_UNMOUNTCLOSE: WinPostMsg(hwnd,WM_CLOSE,0,0); break; default: break; } return (MRESULT) FALSE; default: break; } return WinDefDlgProc(hwnd, msg, mp1, mp2); }
void my_statfs (struct my_statfs *myfs_stats, char *path) { PFSALLOCATE pBuf; PFSINFO pFsInfo; ULONG lghBuf; ULONG diskNum = 0; ULONG logical = 0; UCHAR szDeviceName[3] = "A:"; PBYTE pszFSDName = NULL; /* pointer to FS name */ APIRET rc = NO_ERROR; /* Return code */ BYTE fsqBuffer[sizeof(FSQBUFFER2) + (3 * CCHMAXPATH)] = {0}; ULONG cbBuffer = sizeof(fsqBuffer); /* Buffer length) */ PFSQBUFFER2 pfsqBuffer = (PFSQBUFFER2) fsqBuffer; int i, len = 0; /* ------------------------------------------------------------------ */ lghBuf = sizeof(FSALLOCATE); pBuf = (PFSALLOCATE) malloc(lghBuf); /* Get the free number of Bytes */ rc = DosQueryFSInfo(0L, FSIL_ALLOC, (PVOID) pBuf, lghBuf); /* KBytes available */ myfs_stats->avail = pBuf->cSectorUnit * pBuf->cUnitAvail * pBuf->cbSector / 1024; /* KBytes total */ myfs_stats->total = pBuf->cSectorUnit * pBuf->cUnit * pBuf->cbSector / 1024; myfs_stats->nfree = pBuf->cUnitAvail; myfs_stats->nodes = pBuf->cbSector; lghBuf = sizeof(FSINFO); pFsInfo = (PFSINFO) malloc(lghBuf); rc = DosQueryFSInfo(0L, FSIL_VOLSER, (PVOID) pFsInfo, lghBuf); /* Get name */ myfs_stats->device = strdup(pFsInfo->vol.szVolLabel); /* Label of the Disk */ /* Get the current disk for DosQueryFSAttach */ rc = DosQueryCurrentDisk(&diskNum, &logical); szDeviceName[0] = (UCHAR) (diskNum + (ULONG) 'A' - 1); /* Now get the type of the disk */ rc = DosQueryFSAttach(szDeviceName, 0L, FSAIL_QUERYNAME, pfsqBuffer, &cbBuffer); pszFSDName = pfsqBuffer->szName + pfsqBuffer->cbName + 1; myfs_stats->mpoint = strdup(pszFSDName); /* FAT, HPFS ... */ myfs_stats->type = pBuf->idFileSystem; /* What is about 3 ?*/ if (myfs_stats->type == 0) { myfs_stats->typename = (char *) malloc(11); strcpy(myfs_stats->typename, "Local Disk"); } else {
unsigned long SysDriveMap(unsigned char *name, unsigned long numargs, RXSTRING args[], char *queuename, RXSTRING *retstr) { char temp[MAX]; /* Entire drive map built here*/ char tmpstr[MAX]; /* Single drive entries built */ /* here */ char buf[256]; /* Give DosQFSInfo 256 bytes */ char DeviceName[3]; /* Device name or drive letter*/ /* string */ unsigned long CurDrive; /* Current drive */ unsigned long DriveMap; /* Drive map */ unsigned long Ordinal; /* Ordinal of entry in name */ /* list */ unsigned long FSAInfoLevel; /* Type of attached FSD data */ /* required */ unsigned long DataBufferLen; /* Buffer length */ unsigned long dnum; /* Disk num variable */ unsigned long start = 3; /* Initial disk num */ unsigned long Mode = USED; /* Query mode USED, FREE, */ /* LOCAL, etc */ FSQBUFFER2 DataBuffer; /* Returned data buffer */ long rc; /* OS/2 return codes */ Ordinal = (unsigned long )0; FSAInfoLevel = (unsigned long )1; temp[0] = '\0'; #ifdef DLOGGING logmessage(__func__); #endif if (numargs > 2) return INVALID_ROUTINE; if (numargs >= 1 && args[0].strptr) { if ((strlen(args[0].strptr) == 2 && args[0].strptr[1] != ':') || strlen(args[0].strptr) > 2 || strlen(args[0].strptr) == 0 || !isalpha(args[0].strptr[0])) return INVALID_ROUTINE; start = toupper(args[0].strptr[0])-'A'+1; } /* check the mode */ if (numargs == 2 && args[1].strlength != 0) { if (!stricmp(args[1].strptr, "FREE")) Mode = FREE; else if (!stricmp(args[1].strptr, "USED")) Mode = USED; else if (!stricmp(args[1].strptr, "DETACHED")) Mode = DETACHED; else if (!stricmp(args[1].strptr, "REMOTE")) Mode = REMOTE; else if (!stricmp(args[1].strptr, "LOCAL")) Mode = LOCAL; else return INVALID_ROUTINE; } /* perform the query */ DosError(0); /* Disable Hard-Error Popups */ DosQueryCurrentDisk(&CurDrive, &DriveMap); DriveMap>>=start-1; /* Shift to the first drive */ temp[0] = '\0'; /* Clear temporary buffer */ for (dnum = start; dnum <= 26; dnum++) { if (!(DriveMap&(unsigned long)1) && Mode == FREE) { sprintf(tmpstr, "%c: ", dnum+'A'-1); strcat(temp, tmpstr); } /* Hey, we have a used drive */ else if ((DriveMap&(unsigned long)1) && Mode == USED) { sprintf(tmpstr, "%c: ", dnum+'A'-1); strcat(temp, tmpstr); } else if (DriveMap&(unsigned long)1) { /* Check specific drive info */ sprintf(DeviceName, "%c:", dnum+'A'-1); DataBufferLen = sizeof DataBuffer; DosQueryFSAttach(DeviceName, Ordinal, FSAInfoLevel, &DataBuffer, &DataBufferLen); rc = DosQueryFSInfo(dnum, 2, buf, sizeof(buf)); if (rc == 67 && DataBuffer.iType == 4 && Mode == DETACHED) { /* Hey, we have a detached */ /* drive */ sprintf(tmpstr, "%c: ", dnum+'A'-1); strcat(temp, tmpstr); } else if (DataBuffer.iType == 4 && Mode == REMOTE) { sprintf(tmpstr, "%c: ", dnum+'A'-1); strcat(temp, tmpstr); } else if (DataBuffer.iType == 3 && Mode == LOCAL) { sprintf(tmpstr, "%c: ", dnum+'A'-1); strcat(temp, tmpstr); } } DriveMap>>=1; /* Shift to the next drive */ } BUILDRXSTRING(retstr, temp); /* pass back result */ if (retstr->strlength) retstr->strlength--; DosError(1); /* Enable Hard-Error Popups */ return VALID_ROUTINE; /* no error on call */ }