home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / online / source / c / compilers / Tickle-4.0.sit.hqx / Tickle-4.0 / src / Blessed.c < prev    next >
Text File  |  1993-11-18  |  2KB  |  66 lines

  1. /*
  2. ** This source code was written by Tim Endres
  3. ** Email: time@ice.com.
  4. ** USMail: 8840 Main Street, Whitmore Lake, MI  48189
  5. **
  6. ** Some portions of this application utilize sources
  7. ** that are copyrighted by ICE Engineering, Inc., and
  8. ** ICE Engineering retains all rights to those sources.
  9. **
  10. ** Neither ICE Engineering, Inc., nor Tim Endres, 
  11. ** warrants this source code for any reason, and neither
  12. ** party assumes any responsbility for the use of these
  13. ** sources, libraries, or applications. The user of these
  14. ** sources and binaries assumes all responsbilities for
  15. ** any resulting consequences.
  16. */
  17.  
  18. #include <types.h>
  19. #include <files.h>
  20. #include <stdio.h>
  21.  
  22. #define SysMapRef    ( * (short *) 0x0A58 )
  23. #define ROM85        ( * (short *) 0x028E )    /* High bit = 0 (thus, > 0) for ROM $75 and later */
  24.  
  25. BlessedWD()
  26.     {
  27.     short            sysvref, myerr, wdrefnum, i;
  28.     HVolumeParam    vparm;
  29.     WDPBRec            wparm;
  30.     Str32            volname;
  31.     char            *ptr;
  32.  
  33.     if (ROM85 < 0) {
  34.         /* We are running on the old 64K ROMs. Return default volume. */
  35.         GetVol(volname, &wdrefnum);
  36.         return wdrefnum;
  37.         }
  38.     
  39.     wdrefnum = 0;
  40.     for (ptr=(char *)&vparm,i=0; i<sizeof(HVolumeParam); i++) *(ptr++) = 0;
  41.     myerr = GetVRefNum(SysMapRef, &sysvref);
  42.     if (myerr == noErr) {
  43.         vparm.ioNamePtr = NULL;
  44.         vparm.ioVRefNum = sysvref;
  45.         vparm.ioVolIndex = 0;
  46.         myerr = PBHGetVInfo((HParmBlkPtr)&vparm, false);
  47.         if (myerr == noErr) {
  48.             wparm.ioNamePtr = NULL;
  49.             wparm.ioVRefNum = sysvref;
  50.             wparm.ioWDDirID = vparm.ioVFndrInfo[0];
  51.             wparm.ioWDProcID = 'ERIK';
  52.             myerr = PBOpenWD(&wparm, false);
  53.             if (myerr == noErr)
  54.                 wdrefnum = wparm.ioVRefNum;
  55.             }
  56.         }
  57.     return wdrefnum;
  58.     }
  59.  
  60. BlessedPath(path_str)
  61. char    *path_str;
  62. {
  63.     pathname(path_str, BlessedWD());
  64.     }
  65.  
  66.