Aliases.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:12k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       Aliases.h
  3.  
  4.      Contains:   Alias Manager Interfaces.
  5.  
  6.      Version:    Technology: Mac OS 8.1
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1989-2001 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __ALIASES__
  18. #define __ALIASES__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __APPLETALK__
  23. #include "AppleTalk.h"
  24. #endif
  25. #ifndef __FILES__
  26. #include "Files.h"
  27. #endif
  28. #if PRAGMA_ONCE
  29. #pragma once
  30. #endif
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. #if PRAGMA_IMPORT
  35. #pragma import on
  36. #endif
  37. #if PRAGMA_STRUCT_ALIGN
  38.     #pragma options align=mac68k
  39. #elif PRAGMA_STRUCT_PACKPUSH
  40.     #pragma pack(push, 2)
  41. #elif PRAGMA_STRUCT_PACK
  42.     #pragma pack(2)
  43. #endif
  44. enum {
  45.     rAliasType                  = FOUR_CHAR_CODE('alis')        /* Aliases are stored as resources of this type */
  46. };
  47. enum {
  48.                                                                 /* define alias resolution action rules mask */
  49.     kARMMountVol                = 0x00000001,                   /* mount the volume automatically */
  50.     kARMNoUI                    = 0x00000002,                   /* no user interface allowed during resolution */
  51.     kARMMultVols                = 0x00000008,                   /* search on multiple volumes */
  52.     kARMSearch                  = 0x00000100,                   /* search quickly */
  53.     kARMSearchMore              = 0x00000200,                   /* search further */
  54.     kARMSearchRelFirst          = 0x00000400                    /* search target on a relative path first */
  55. };
  56. enum {
  57.                                                                 /* define alias record information types */
  58.     asiZoneName                 = -3,                           /* get zone name */
  59.     asiServerName               = -2,                           /* get server name */
  60.     asiVolumeName               = -1,                           /* get volume name */
  61.     asiAliasName                = 0,                            /* get aliased file/folder/volume name */
  62.     asiParentName               = 1                             /* get parent folder name */
  63. };
  64. /* ResolveAliasFileWithMountFlags options */
  65. enum {
  66.     kResolveAliasFileNoUI       = 0x00000001                    /* no user interaction during resolution */
  67. };
  68. /* define the alias record that will be the blackbox for the caller */
  69. struct AliasRecord {
  70.     OSType                          userType;                   /* appl stored type like creator type */
  71.     unsigned short                  aliasSize;                  /* alias record size in bytes, for appl usage */
  72. };
  73. typedef struct AliasRecord              AliasRecord;
  74. typedef AliasRecord *                   AliasPtr;
  75. typedef AliasPtr *                      AliasHandle;
  76. /* alias record information type */
  77. typedef short                           AliasInfoType;
  78. /*  create a new alias between fromFile-target and return alias record handle  */
  79. EXTERN_API( OSErr )
  80. NewAlias                        (const FSSpec *         fromFile, /* can be NULL */
  81.                                  const FSSpec *         target,
  82.                                  AliasHandle *          alias)                              TWOWORDINLINE(0x7002, 0xA823);
  83. /* create a minimal new alias for a target and return alias record handle */
  84. EXTERN_API( OSErr )
  85. NewAliasMinimal                 (const FSSpec *         target,
  86.                                  AliasHandle *          alias)                              TWOWORDINLINE(0x7008, 0xA823);
  87. /* create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  */
  88. EXTERN_API( OSErr )
  89. NewAliasMinimalFromFullPath     (short                  fullPathLength,
  90.                                  const void *           fullPath,
  91.                                  ConstStr32Param        zoneName,
  92.                                  ConstStr31Param        serverName,
  93.                                  AliasHandle *          alias)                              TWOWORDINLINE(0x7009, 0xA823);
  94. /* given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. */
  95. EXTERN_API( OSErr )
  96. ResolveAlias                    (const FSSpec *         fromFile, /* can be NULL */
  97.                                  AliasHandle            alias,
  98.                                  FSSpec *               target,
  99.                                  Boolean *              wasChanged)                         TWOWORDINLINE(0x7003, 0xA823);
  100. /* given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. */
  101. EXTERN_API( OSErr )
  102. GetAliasInfo                    (AliasHandle            alias,
  103.                                  AliasInfoType          index,
  104.                                  Str63                  theString)                          TWOWORDINLINE(0x7007, 0xA823);
  105. EXTERN_API( OSErr )
  106. IsAliasFile                     (const FSSpec *         fileFSSpec,
  107.                                  Boolean *              aliasFileFlag,
  108.                                  Boolean *              folderFlag)                         TWOWORDINLINE(0x702A, 0xA823);
  109. EXTERN_API( OSErr )
  110. ResolveAliasWithMountFlags      (const FSSpec *         fromFile,
  111.                                  AliasHandle            alias,
  112.                                  FSSpec *               target,
  113.                                  Boolean *              wasChanged,
  114.                                  unsigned long          mountFlags)                         TWOWORDINLINE(0x702B, 0xA823);
  115. /* 
  116.   Given a file spec, return target file spec if input file spec is an alias.
  117.   It resolves the entire alias chain or one step of the chain.  It returns
  118.   info about whether the target is a folder or file; and whether the input
  119.   file spec was an alias or not. 
  120. */
  121. EXTERN_API( OSErr )
  122. ResolveAliasFile                (FSSpec *               theSpec,
  123.                                  Boolean                resolveAliasChains,
  124.                                  Boolean *              targetIsFolder,
  125.                                  Boolean *              wasAliased)                         TWOWORDINLINE(0x700C, 0xA823);
  126. EXTERN_API( OSErr )
  127. ResolveAliasFileWithMountFlags  (FSSpec *               theSpec,
  128.                                  Boolean                resolveAliasChains,
  129.                                  Boolean *              targetIsFolder,
  130.                                  Boolean *              wasAliased,
  131.                                  unsigned long          mountFlags)                         TWOWORDINLINE(0x7029, 0xA823);
  132. EXTERN_API( OSErr )
  133. FollowFinderAlias               (ConstFSSpecPtr         fromFile,
  134.                                  AliasHandle            alias,
  135.                                  Boolean                logon,
  136.                                  FSSpec *               target,
  137.                                  Boolean *              wasChanged)                         TWOWORDINLINE(0x700F, 0xA823);
  138. /* 
  139.    Low Level Routines 
  140. */
  141. /* given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. */
  142. EXTERN_API( OSErr )
  143. UpdateAlias                     (const FSSpec *         fromFile, /* can be NULL */
  144.                                  const FSSpec *         target,
  145.                                  AliasHandle            alias,
  146.                                  Boolean *              wasChanged)                         TWOWORDINLINE(0x7006, 0xA823);
  147. typedef CALLBACK_API( Boolean , AliasFilterProcPtr )(CInfoPBPtr cpbPtr, Boolean *quitFlag, Ptr myDataPtr);
  148. typedef STACK_UPP_TYPE(AliasFilterProcPtr)                      AliasFilterUPP;
  149. #if OPAQUE_UPP_TYPES
  150.     EXTERN_API(AliasFilterUPP)
  151.     NewAliasFilterUPP              (AliasFilterProcPtr      userRoutine);
  152.     EXTERN_API(void)
  153.     DisposeAliasFilterUPP          (AliasFilterUPP          userUPP);
  154.     EXTERN_API(Boolean)
  155.     InvokeAliasFilterUPP           (CInfoPBPtr              cpbPtr,
  156.                                     Boolean *               quitFlag,
  157.                                     Ptr                     myDataPtr,
  158.                                     AliasFilterUPP          userUPP);
  159. #else
  160.     enum { uppAliasFilterProcInfo = 0x00000FD0 };                   /* pascal 1_byte Func(4_bytes, 4_bytes, 4_bytes) */
  161.     #define NewAliasFilterUPP(userRoutine)                          (AliasFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppAliasFilterProcInfo, GetCurrentArchitecture())
  162.     #define DisposeAliasFilterUPP(userUPP)                          DisposeRoutineDescriptor(userUPP)
  163.     #define InvokeAliasFilterUPP(cpbPtr, quitFlag, myDataPtr, userUPP)  (Boolean)CALL_THREE_PARAMETER_UPP((userUPP), uppAliasFilterProcInfo, (cpbPtr), (quitFlag), (myDataPtr))
  164. #endif
  165. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  166. #define NewAliasFilterProc(userRoutine)                         NewAliasFilterUPP(userRoutine)
  167. #define CallAliasFilterProc(userRoutine, cpbPtr, quitFlag, myDataPtr) InvokeAliasFilterUPP(cpbPtr, quitFlag, myDataPtr, userRoutine)
  168. /*  Given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag */
  169. EXTERN_API( OSErr )
  170. MatchAlias                      (const FSSpec *         fromFile, /* can be NULL */
  171.                                  unsigned long          rulesMask,
  172.                                  AliasHandle            alias,
  173.                                  short *                aliasCount,
  174.                                  FSSpecArrayPtr         aliasList,
  175.                                  Boolean *              needsUpdate,
  176.                                  AliasFilterUPP         aliasFilter,
  177.                                  void *                 yourDataPtr)                        TWOWORDINLINE(0x7005, 0xA823);
  178. /* The follow two calls are for Carbon only.  They allow tools and background apps to have
  179.     AliasMgr functionality without ever having to deal with UI */
  180. EXTERN_API( OSErr )
  181. ResolveAliasFileWithMountFlagsNoUI (FSSpec *            theSpec,
  182.                                  Boolean                resolveAliasChains,
  183.                                  Boolean *              targetIsFolder,
  184.                                  Boolean *              wasAliased,
  185.                                  unsigned long          mountFlags);
  186. EXTERN_API( OSErr )
  187. MatchAliasNoUI                  (const FSSpec *         fromFile, /* can be NULL */
  188.                                  unsigned long          rulesMask,
  189.                                  AliasHandle            alias,
  190.                                  short *                aliasCount,
  191.                                  FSSpecArrayPtr         aliasList,
  192.                                  Boolean *              needsUpdate,
  193.                                  AliasFilterUPP         aliasFilter,
  194.                                  void *                 yourDataPtr);
  195. #if PRAGMA_STRUCT_ALIGN
  196.     #pragma options align=reset
  197. #elif PRAGMA_STRUCT_PACKPUSH
  198.     #pragma pack(pop)
  199. #elif PRAGMA_STRUCT_PACK
  200.     #pragma pack()
  201. #endif
  202. #ifdef PRAGMA_IMPORT_OFF
  203. #pragma import off
  204. #elif PRAGMA_IMPORT
  205. #pragma import reset
  206. #endif
  207. #ifdef __cplusplus
  208. }
  209. #endif
  210. #endif /* __ALIASES__ */