| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Read-only media |
Jeff Dunlop wrote in a message to All:
JD> I would like to detect whether a device found by
JD> DosQueryFSInfo is read-only. I know that if the file system
JD> is CDFS, it's a CD-Rom, but this seems incomplete to me. Is
JD> there a DevIOCtl command that will provide this information?
Call DosQueryPathInfo() against the root directory of the device.
-- Mike
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
#include
#define INCL_DOSFILEMGR
#define INCL_NOPMAPI
#include
#define FILE_DRIVE (0x0008) /* undocumented */
int main(int argc, char *argv[]);
void printdtfmt(FDATE fdp, FTIME ftp) {
const UCHAR dtfmt[] = " \t%04u-%02u-%02u %02u:%02u:%02u";
printf(dtfmt, fdp.year+1980, fdp.month, fdp.day,
ftp.hours, ftp.minutes, ftp.twosecs);
return;
}
int main(int argc, char *argv[]) {
FILESTATUS3 f;
APIRET rc;
if(argc < 2) {
printf("\nUsage: \tPCHK \n");
exit(1);
}
memset(&f, sizeof(f), 0);
rc = DosQueryPathInfo(argv[1], FIL_STANDARD, (PVOID)&f, sizeof(f));
printf("\nPath: \t\t%s", argv[1]);
printf("\nReturn: \t%lu", (ULONG)rc);
if(rc != 0) printf(" \t(Invalid)");
printf("\nCreated: ");
printdtfmt(f.fdateCreation, f.ftimeCreation);
printf("\nAccessed: ");
printdtfmt(f.fdateLastAccess, f.ftimeLastAccess);
printf("\nModified: ");
printdtfmt(f.fdateLastWrite, f.ftimeLastWrite);
printf("\nData size: \t%lu (bytes)", f.cbFile);
printf("\nAlloc size: \t%lu (bytes)", f.cbFileAlloc);
printf("\nAttribute: \t%08Xh \t", f.attrFile);
if(f.attrFile == FILE_NORMAL) printf(" Normal");
if(f.attrFile & FILE_READONLY) printf(" Read-Only");
if(f.attrFile & FILE_HIDDEN) printf(" Hidden");
if(f.attrFile & FILE_SYSTEM) printf(" System");
if(f.attrFile & FILE_DRIVE) printf(" Drive");
if(f.attrFile & FILE_DIRECTORY) printf(" Directory");
if(f.attrFile & FILE_ARCHIVED) printf(" Archive");
if(f.attrFile & 0xFFFFFFC0) printf(" (?)");
printf("\n");
return(0);
}
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Here is what an HPFS hard disk looks like:
Path: c:\
Return: 0
Created: 1995-03-19 20:58:27
Accessed: 1995-03-19 20:58:27
Modified: 1995-03-19 20:58:27
Data size: 5 (bytes)
Alloc size: 512 (bytes)
Attribute: 00000010h Directory
Here is what a CD-ROM looks like:
Path: e:\
Return: 0
Created: 1980-00-00 00:00:00
Accessed: 1980-00-00 00:00:00
Modified: 1980-00-00 00:00:00
Data size: 0 (bytes)
Alloc size: 0 (bytes)
Attribute: 00000011h Read-Only Directory
---
* Origin: N1BEE BBS +1 401 944 8498 V.34/V.FC/V.32bis/HST16.8 (1:323/107)SEEN-BY: 270/101 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407 SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809 @PATH: 323/107 150 3615/50 396/1 270/101 712/515 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.