home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #1 / Amiga Plus CD - 2000 - No. 1.iso / Tools / HD / SmartFileSystem / V1.58 / Sources / DevInf / DevInf.c
Encoding:
C/C++ Source or Header  |  1999-01-30  |  4.6 KB  |  122 lines

  1. #include <dos/dos.h>
  2. #include <dos/dosextens.h>
  3. #include <dos/filehandler.h>
  4. #include <proto/dos.h>
  5. #include <proto/exec.h>
  6. #include <stdio.h>
  7.  
  8. // char template[]="DEVICE/A";
  9.  
  10. // struct {char *device;} arglist={NULL};
  11.  
  12. UBYTE date[100];
  13. UBYTE time[100];
  14.  
  15. void datetostr(struct DateStamp *ds);
  16.  
  17. ULONG main() {
  18. //  struct RDArgs *readarg;
  19.   struct DeviceList *devinfo;
  20.  
  21.   if((DOSBase=(struct DosLibrary *)OpenLibrary("dos.library",37))!=0) {
  22. //    if((readarg=ReadArgs(template,(LONG *)&arglist,0))!=0) {
  23.       devinfo=BADDR(DOSBase->dl_Root->rn_Info);
  24.       devinfo=(struct DeviceList *)BADDR( ((struct DosInfo *)(devinfo))->di_DevInfo );
  25.  
  26. //      while(devinfo->dl_Next!=0) {
  27.       while(devinfo!=0) {
  28.         if((devinfo->dl_Type)==DLT_VOLUME) {
  29.           datetostr(&devinfo->dl_VolumeDate);
  30.  
  31.           printf("VOLUMENODE %s\n",(ULONG)BADDR(devinfo->dl_Name)+1);
  32.           printf("  Disktype      : 0x%08lx         Task          : 0x%08lx\n",devinfo->dl_DiskType,devinfo->dl_Task);
  33.           printf("  Locklist      : 0x%08lx         unused        : 0x%08lx\n",devinfo->dl_LockList,devinfo->dl_unused);
  34.           printf("  Creation date : %s %s\n\n",date,time);
  35.         }
  36.         else if((devinfo->dl_Type)==DLT_DEVICE) {
  37.           struct DevInfo *dvi=(struct DevInfo *)devinfo;
  38.           struct FileSysStartupMsg *fssm;
  39.  
  40.           fssm=(struct FileSysStartupMsg *)BADDR(dvi->dvi_Startup);
  41.  
  42.           printf("DEVICENODE %s\n",(ULONG)BADDR(devinfo->dl_Name)+1);
  43.           printf("  Lock          : 0x%08lx         Task          : 0x%08lx\n",dvi->dvi_Lock,dvi->dvi_Task);
  44.           printf("  Stacksize     : %10ld bytes   Handler       : %s\n",dvi->dvi_StackSize,(ULONG)BADDR(dvi->dvi_Handler)+1);
  45.           printf("  Priority      : %10ld         Startup       : 0x%08lx\n",dvi->dvi_Priority,dvi->dvi_Startup);
  46.           printf("  SegList       : 0x%08lx         GlobVec       : 0x%08lx\n\n",BADDR(dvi->dvi_SegList),dvi->dvi_GlobVec);
  47.  
  48.           if((ULONG)fssm>200 && fssm->fssm_Unit<=10) {
  49.             struct DosEnvec *de=(struct DosEnvec *)BADDR(fssm->fssm_Environ);
  50.  
  51.             printf("  FSSM          : %s, unit %ld, flags 0x%08lx\n\n",(ULONG)BADDR(fssm->fssm_Device)+1,fssm->fssm_Unit,fssm->fssm_Flags);
  52.             printf("  Sectorsize    : %10ld bytes   Sectors/block : %10ld\n",de->de_SizeBlock<<2,de->de_SectorPerBlock);
  53.             printf("  LowCyl        : %10ld         HighCyl       : %10ld\n",de->de_LowCyl,de->de_HighCyl);
  54.             printf("  Blocks/track  : %10ld         Surfaces      : %10ld tracks/cylinder\n",de->de_BlocksPerTrack,de->de_Surfaces);
  55.             printf("  Reserved      : %10ld blocks  PreAlloc      : %10ld blocks\n",de->de_Reserved,de->de_PreAlloc);
  56.             printf("  SecOrg        : %10ld         Interleave    : %10ld\n",de->de_SecOrg,de->de_Interleave);
  57.             printf("  Buffers       : %10ld       ",de->de_NumBuffers);
  58.  
  59.             if(de->de_TableSize>=12) {
  60.               printf("  BufMemType    : 0x%08lx\n",de->de_BufMemType);
  61.               if(de->de_TableSize>=13) {
  62.                 printf("  MaxTransfer   : 0x%08lx       ",de->de_MaxTransfer);
  63.                 if(de->de_TableSize>=14) {
  64.                   printf("  Mask          : 0x%08lx\n",de->de_Mask);
  65.                   if(de->de_TableSize>=15) {
  66.                     printf("  BootPri       : %10ld       ",de->de_BootPri);
  67.                     if(de->de_TableSize>=16) {
  68.                       printf("  DosType       : 0x%08lx\n",de->de_DosType);
  69.                       if(de->de_TableSize>=17) {
  70.                         printf("  Baud          : %10ld       ",de->de_Baud);
  71.                         if(de->de_TableSize>=18) {
  72.                           printf("  Control       : 0x%08lx\n",de->de_Control);
  73.                           if(de->de_TableSize>=19) {
  74.                             printf("  BootBlocks    : 0x%08lx\n",de->de_BootBlocks);
  75.                           }
  76.                         }
  77.                         else {
  78.                           printf("\n");
  79.                         }
  80.                       }
  81.                     }
  82.                     else {
  83.                       printf("\n");
  84.                     }
  85.                   }
  86.                 }
  87.                 else {
  88.                   printf("\n");
  89.                 }
  90.               }
  91.             }
  92.             else {
  93.               printf("\n");
  94.             }
  95.  
  96.             printf("\n");
  97.           }
  98.         }
  99.  
  100.         devinfo=BADDR(devinfo->dl_Next);
  101.       }
  102. //      FreeArgs(readarg);
  103. //    }
  104.     CloseLibrary((struct Library *)DOSBase);
  105.   }
  106.   return(0);
  107. }
  108.  
  109.  
  110. void datetostr(struct DateStamp *ds) {
  111.   struct DateTime dt;
  112.  
  113.   dt.dat_Stamp=*ds;
  114.   dt.dat_Format=0;
  115.   dt.dat_Flags=0;
  116.   dt.dat_StrDate=date;
  117.   dt.dat_StrDay=0;
  118.   dt.dat_StrTime=time;
  119.  
  120.   DateToStr(&dt);
  121. }
  122.