ResKnife/External/MoreFiles/MoreFilesExtras.c

1 line
100 KiB
C
Raw Normal View History

2002-03-29 14:59:03 +00:00
/* File: MoreFilesExtras.c Contains: A collection of useful high-level File Manager routines Version: MoreFiles Copyright: <09> 1992-2001 by Apple Computer, Inc., all rights reserved. You may incorporate this sample code into your applications without restriction, though the sample code has been provided "AS IS" and the responsibility for its operation is 100% yours. However, what you are not permitted to do is to redistribute the source as "DSC Sample Code" after having made changes. If you're going to re-distribute the source, we require that you make it clear in the source that the code was descended from Apple Sample Code, but that you've made changes. File Ownership: DRI: Jim Luther Other Contact: Apple Macintosh Developer Technical Support <http://developer.apple.com/bugreporter/> Technology: DTS Sample Code Writers: (JL) Jim Luther Change History (most recent first): <2> 2/7/01 JL [2500429] Changed null output parameters to real variables when calling GetSharedLibrary to prevent crashes with older versions of CFM. Added standard header. Updated names of includes. Added C function implementations of accessors that used to be macros since the generated Pascal headers no longer contain implementations. Updated various other routines to use new calling convention of the accessor functions. <1> 12/06/99 JL MoreFiles 1.5. */ #include <MacTypes.h> #include <Traps.h> #include <OSUtils.h> #include <MacErrors.h> #include <MacMemory.h> #include <Files.h> #include <Devices.h> #include <Finder.h> #include <Folders.h> #include <FSM.h> #include <Disks.h> #include <Gestalt.h> #include <TextUtils.h> #include <Script.h> #include <Math64.h> #include <CodeFragments.h> #include <stddef.h> #define __COMPILINGMOREFILES #include "MoreFiles.h" #include "MoreDesktopMgr.h" #include "FSpCompat.h" #include "MoreFilesExtras.h" /*****************************************************************************/ /* Functions to get information out of GetVolParmsInfoBuffer. */ /* version 1 field getters */ pascal short GetVolParmsInfoVersion(const GetVolParmsInfoBuffer *volParms) { return ( volParms->vMVersion ); } pascal long GetVolParmsInfoAttrib(const GetVolParmsInfoBuffer *volParms) { return ( volParms->vMAttrib ); } pascal Handle GetVolParmsInfoLocalHand(const GetVolParmsInfoBuffer *volParms) { return ( volParms->vMLocalHand ); } pascal long GetVolParmsInfoServerAdr(const GetVolParmsInfoBuffer *volParms) { return ( volParms->vMServerAdr ); } /* version 2 field getters (assume zero result if version < 2) */ pascal long GetVolParmsInfoVolumeGrade(const GetVolParmsInfoBuffer *volParms) { return ( (volParms->vMVersion >= 2) ? volParms->vMVolumeGrade : 0 ); } pascal long GetVolParmsInfoForeignPrivID(const GetVolParmsInfoBuffer *volParms) { return ( (volParms->vMVersion >= 2) ? volParms->vMForeignPrivID : 0 ); } /* version 3 field getters (assume zero result if version < 3) */ pascal long GetVolParmsInfoExtendedAttributes(const GetVolParmsInfoBuffer *volParms) { return ( (volParms->vMVersion >= 3) ? volParms->vMExtendedAttributes : 0 ); } /* attribute bits supported by all versions of GetVolParmsInfoBuffer */ pascal Boolean isNetworkVolume(const GetVolParmsInfoBuffer *volParms) { return ( volParms->vMServerAdr != 0 ); } pascal Boolean hasLimitFCBs(const GetVolParmsInfoBuffer *volParms) { return ( (volParms->vMAttrib & (1L << bLimitFCBs)) != 0 ); } pascal Boolean hasLocalWList(const GetVolParmsInfoBuffer *volParms) { return ( (volParms->vMAttrib & (1L << bLocalWList)) != 0 ); } pascal Boolean hasNoMiniFndr(const GetVolParmsInfoBuffer *volParms) { return ( (volParms->vMAttrib & (1L << bNoMiniFndr)) != 0 ); } pascal Boolean hasNoVNEdit(const GetVolParmsInfoBuffer *volParms) { return ( (volParms->vMAttrib & (1L << bNoVNEdit)) != 0 ); } pascal Boolean hasNoLclSync(const GetVolParmsInfoBuffer *volParms) { return ( (volParms->vMAttrib & (1L << bNoLclSync)) != 0 ); } pascal Boolean hasTrshOffLine(const GetVolParms