1/* 2 * Copyright (c) 2014 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23 24/* CFURLPriv.h 25 Copyright (c) 2008-2013, Apple Inc. All rights reserved. 26 */ 27 28#if !defined(__COREFOUNDATION_CFURLPRIV__) 29#define __COREFOUNDATION_CFURLPRIV__ 1 30 31#include <CoreFoundation/CFBase.h> 32#include <CoreFoundation/CFError.h> 33#include <CoreFoundation/CFArray.h> 34#include <CoreFoundation/CFDictionary.h> 35#include <CoreFoundation/CFString.h> 36#include <CoreFoundation/CFURL.h> 37#if TARGET_OS_MAC 38#include <sys/param.h> 39#include <sys/mount.h> 40#include <CoreFoundation/CFFileSecurity.h> 41#include <CoreFoundation/CFURLEnumerator.h> 42#include <CoreFoundation/CFDate.h> 43#endif 44 45CF_EXTERN_C_BEGIN 46 47#if TARGET_OS_MAC 48 49enum { 50 // Resource I/O related errors, with kCFErrorURLKey containing URL 51 kCFURLNoSuchResourceError = 4, // Attempt to do a file system operation on a non-existent file 52 kCFURLResourceLockingError = 255, // Couldn't get a lock on file 53 kCFURLReadUnknownError = 256, // Read error (reason unknown) 54 kCFURLReadNoPermissionError = 257, // Read error (permission problem) 55 kCFURLReadInvalidResourceNameError = 258, // Read error (invalid file name) 56 kCFURLReadCorruptResourceError = 259, // Read error (file corrupt, bad format, etc) 57 kCFURLReadNoSuchResourceError = 260, // Read error (no such file) 58 kCFURLReadInapplicableStringEncodingError = 261, // Read error (string encoding not applicable) also kCFStringEncodingErrorKey 59 kCFURLReadUnsupportedSchemeError = 262, // Read error (unsupported URL scheme) 60 kCFURLReadTooLargeError = 263, // Read error (file too large) 61 kCFURLReadUnknownStringEncodingError = 264, // Read error (string encoding of file contents could not be determined) 62 kCFURLWriteUnknownError = 512, // Write error (reason unknown) 63 kCFURLWriteNoPermissionError = 513, // Write error (permission problem) 64 kCFURLWriteInvalidResourceNameError = 514, // Write error (invalid file name) 65 kCFURLWriteInapplicableStringEncodingError = 517, // Write error (string encoding not applicable) also kCFStringEncodingErrorKey 66 kCFURLWriteUnsupportedSchemeError = 518, // Write error (unsupported URL scheme) 67 kCFURLWriteOutOfSpaceError = 640, // Write error (out of storage space) 68 kCFURLWriteVolumeReadOnlyError = 642, // Write error (readonly volume) 69} CF_ENUM_AVAILABLE(10_5, 2_0); 70 71 72/* 73 Private File System Property Keys 74*/ 75CF_EXPORT const CFStringRef _kCFURLPathKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 76 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLPathKey or NSURLPathKey public property keys */ 77 78CF_EXPORT const CFStringRef _kCFURLVolumeIDKey CF_AVAILABLE(10_6, 4_0); 79 /* Volume ID (CFNumber) */ 80 81CF_EXPORT const CFStringRef _kCFURLInodeNumberKey CF_AVAILABLE(10_6, 4_0); 82 /* 64-bit inode number (the inode number from the file system) (CFNumber) */ 83 84CF_EXPORT const CFStringRef _kCFURLFileIDKey CF_AVAILABLE(10_6, 4_0); 85 /* 64-bit file ID (for tracking a file by ID. This may or may not be the inode number) (CFNumber) */ 86 87CF_EXPORT const CFStringRef _kCFURLParentDirectoryIDKey CF_AVAILABLE(10_6, 4_0); 88 /* 64-bit file ID (for tracking a parent directory by ID. This may or may not be the inode number) (CFNumber) */ 89 90CF_EXPORT const CFStringRef _kCFURLDistinctLocalizedNameKey CF_AVAILABLE(10_6, 4_0); 91 /* The localized name, if it is distinct from the real name. Otherwise, NULL (CFString) */ 92 93CF_EXPORT const CFStringRef _kCFURLNameExtensionKey CF_AVAILABLE(10_6, 4_0); 94 /* The name extension (CFString) */ 95 96CF_EXPORT const CFStringRef _kCFURLFinderInfoKey CF_AVAILABLE(10_6, 4_0); 97 /* A 16-byte Finder Info structure immediately followed by a 16-byte Extended Finder Info structure (CFData) */ 98 99CF_EXPORT const CFStringRef _kCFURLIsCompressedKey CF_AVAILABLE(10_6, 4_0); 100 /* True if resource's data is transparently compressed by the system on its storage device (CFBoolean) */ 101 102CF_EXPORT const CFStringRef _kCFURLIsApplicationKey CF_AVAILABLE(10_6, 4_0); 103 /* True if resource is an application (CFBoolean) */ 104 105CF_EXPORT const CFStringRef _kCFURLCanSetHiddenExtensionKey CF_AVAILABLE(10_6, 4_0); 106 /* True if the filename extension can be hidden or unhidden (CFBoolean) */ 107 108CF_EXPORT const CFStringRef _kCFURLIsReadableKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 109 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLIsReadableKey or NSURLIsReadableKey public property keys */ 110/* never implemented and scheduled for removal in 10.10/8.0 */CF_EXPORT const CFStringRef _kCFURLUserCanReadKey CF_DEPRECATED(10_0, 10_6, 2_0, 4_0); 111 112CF_EXPORT const CFStringRef _kCFURLIsWriteableKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 113 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLIsWritableKey or NSURLIsWritableKey public property keys */ 114/* never implemented and scheduled for removal in 10.10/8.0 */CF_EXPORT const CFStringRef _kCFURLUserCanWriteKey CF_DEPRECATED(10_0, 10_6, 2_0, 4_0); 115 116CF_EXPORT const CFStringRef _kCFURLIsExecutableKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 117 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLIsExecutableKey or NSURLIsExecutableKey public property keys */ 118/* never implemented and scheduled for removal in 10.10/8.0 */CF_EXPORT const CFStringRef _kCFURLUserCanExecuteKey CF_DEPRECATED(10_0, 10_6, 2_0, 4_0); 119 120CF_EXPORT const CFStringRef _kCFURLParentDirectoryIsVolumeRootKey CF_AVAILABLE(10_6, 4_0); 121 /* True if the parent directory is the root of a volume (CFBoolean) */ 122 123CF_EXPORT const CFStringRef _kCFURLFileSecurityKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 124 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLFileSecurityKey or NSURLFileSecurityKey public property keys */ 125 126CF_EXPORT const CFStringRef _kCFURLFileSizeOfResourceForkKey CF_AVAILABLE(10_6, 4_0); 127 /* Size in bytes of the resource fork (CFNumber) */ 128 129CF_EXPORT const CFStringRef _kCFURLFileAllocatedSizeOfResourceForkKey CF_AVAILABLE(10_6, 4_0); 130 /* Size in bytes of the blocks allocated for the resource fork (CFNumber) */ 131 132CF_EXPORT const CFStringRef _kCFURLEffectiveIconImageDataKey CF_AVAILABLE(10_6, 4_0); 133 /* Icon image data, i.e. raw pixel data (CFData) */ 134 135CF_EXPORT const CFStringRef _kCFURLCustomIconImageDataKey CF_AVAILABLE(10_6, 4_0); 136 /* Icon image data of the item's custom icon, if any (CFData) */ 137 138CF_EXPORT const CFStringRef _kCFURLEffectiveIconFlattenedReferenceDataKey CF_AVAILABLE(10_6, 4_0); 139 /* Icon flattened reference, suitable for cheaply sharing the effective icon reference across processess (CFData) */ 140 141CF_EXPORT const CFStringRef _kCFURLBundleIdentifierKey CF_AVAILABLE(10_6, 4_0); 142 /* If resource is a bundle, the bundle identifier (CFString) */ 143 144CF_EXPORT const CFStringRef _kCFURLVersionKey CF_AVAILABLE(10_6, 4_0); 145 /* If resource is a bundle, the bundle version (CFBundleVersion) as a string (CFString) */ 146 147CF_EXPORT const CFStringRef _kCFURLShortVersionStringKey CF_AVAILABLE(10_6, 4_0); 148 /* If resource is a bundle, the bundle short version (CFBundleShortVersionString) as a string (CFString) */ 149 150CF_EXPORT const CFStringRef _kCFURLOwnerIDKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 151 /* Deprecated and scheduled for removal later in 10.9/7.0 since it is unused - Use the kCFURLFileSecurityKey or NSURLFileSecurityKey public property keys and CFFileSecurityGetOwner() */ 152 153CF_EXPORT const CFStringRef _kCFURLGroupIDKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 154 /* Deprecated and scheduled for removal later in 10.9/7.0 since it is unused - Use the kCFURLFileSecurityKey or NSURLFileSecurityKey public property keys and CFFileSecurityGetGroup() */ 155 156CF_EXPORT const CFStringRef _kCFURLStatModeKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 157 /* Deprecated and scheduled for removal later in 10.9/7.0 since it is unused - Use the kCFURLFileSecurityKey or NSURLFileSecurityKey public property keys and CFFileSecurityGetMode() */ 158 159CF_EXPORT const CFStringRef _kCFURLLocalizedNameDictionaryKey CF_AVAILABLE(10_7, NA); 160 /* For items with localized display names, the dictionary of all available localizations. The keys are the cannonical locale strings for the available localizations. (CFDictionary) */ 161 162CF_EXPORT const CFStringRef _kCFURLLocalizedTypeDescriptionDictionaryKey CF_AVAILABLE(10_7, NA); 163 /* The dictionary of all available localizations of the item kind string. The keys are the cannonical locale strings for the available localizations. (CFDictionary) */ 164 165CF_EXPORT const CFStringRef _kCFURLApplicationCategoriesKey CF_AVAILABLE(10_7, NA); 166 /* The array of category UTI strings associated with the url. (CFArray) */ 167 168CF_EXPORT const CFStringRef _kCFURLApplicationHighResolutionModeIsMagnifiedKey CF_AVAILABLE(10_7, NA); 169 /* True if the app runs with magnified 1x graphics on a 2x display (Per-user, CFBoolean) */ 170 171CF_EXPORT const CFStringRef _kCFURLCanSetApplicationHighResolutionModeIsMagnifiedKey CF_AVAILABLE(10_7, NA); 172 /* True if the app can run in either magnified or native resolution modes (Read only, CFBoolean) */ 173 174CF_EXPORT const CFStringRef _kCFURLWriterBundleIdentifierKey CF_AVAILABLE(10_8, NA); 175 /* The bundle identifier of the process writing to this object (Read-write, value type CFString) */ 176 177CF_EXPORT const CFStringRef _kCFURLApplicationNapIsDisabledKey CF_AVAILABLE(10_9, NA); 178 /* True if app nap is disabled (Applications only, Per-user, CFBoolean) */ 179 180CF_EXPORT const CFStringRef _kCFURLCanSetApplicationNapIsDisabledKey CF_AVAILABLE(10_9, NA); 181 /* True if the ApplicationNapIsDisabled property value can be changed (Applications only, Read only, CFBoolean) */ 182 183/* Additional volume properties */ 184 185CF_EXPORT const CFStringRef _kCFURLVolumeRefNumKey CF_AVAILABLE(10_6, 4_0); 186 /* The Carbon File Manager's FSVolumeRefNum for the resource volume (CFNumber) */ 187 188CF_EXPORT const CFStringRef _kCFURLVolumeUUIDStringKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 189 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeUUIDStringKey or NSURLVolumeUUIDStringKey public property keys */ 190 191CF_EXPORT const CFStringRef _kCFURLVolumeCreationDateKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 192 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeCreationDateKey or NSURLVolumeCreationDateKey public property keys */ 193 194CF_EXPORT const CFStringRef _kCFURLVolumeIsLocalKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 195 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeIsLocalKey or NSURLVolumeIsLocalKey public property keys */ 196 197CF_EXPORT const CFStringRef _kCFURLVolumeIsAutomountKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 198 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeIsAutomountedKey or NSURLVolumeIsAutomountedKey public property keys */ 199 200CF_EXPORT const CFStringRef _kCFURLVolumeDontBrowseKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 201 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeIsBrowsableKey or NSURLVolumeIsBrowsableKey public property keys (Note: value is inverse of _kCFURLVolumeDontBrowseKey) */ 202 203CF_EXPORT const CFStringRef _kCFURLVolumeIsReadOnlyKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 204 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeIsReadOnlyKey or NSURLVolumeIsReadOnlyKey public property keys */ 205 206CF_EXPORT const CFStringRef _kCFURLVolumeIsQuarantinedKey CF_AVAILABLE(10_6, 4_0); 207 /* Mounted quarantined (CFBoolean) */ 208 209CF_EXPORT const CFStringRef _kCFURLVolumeIsEjectableKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 210 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeIsEjectableKey or NSURLVolumeIsEjectableKey public property keys */ 211 212CF_EXPORT const CFStringRef _kCFURLVolumeIsRemovableKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 213 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeIsRemovableKey or NSURLVolumeIsRemovableKey public property keys */ 214 215CF_EXPORT const CFStringRef _kCFURLVolumeIsInternalKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 216 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeIsInternalKey or NSURLVolumeIsInternalKey public property keys (Note: this has slightly different behavior than the public VolumeIsInternal key) */ 217 218CF_EXPORT const CFStringRef _kCFURLVolumeIsExternalKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 219 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeIsInternalKey or NSURLVolumeIsInternalKey public property keys (Note: this has slightly different behavior than the public VolumeIsInternal key) */ 220 221CF_EXPORT const CFStringRef _kCFURLVolumeIsDiskImageKey CF_AVAILABLE(10_6, 4_0); 222 /* Volume is a mounted disk image (CFBoolean) */ 223 224CF_EXPORT const CFStringRef _kCFURLDiskImageBackingURLKey CF_AVAILABLE(10_6, 4_0); 225 /* If volume is a mounted disk image, the URL of the backing disk image (CFURL) */ 226 227CF_EXPORT const CFStringRef _kCFURLVolumeIsFileVaultKey CF_AVAILABLE(10_6, 4_0); 228 /* Volume uses File Vault encryption (CFBoolean) */ 229 230CF_EXPORT const CFStringRef _kCFURLVolumeIsiDiskKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 231 /* Deprecated and scheduled for removal in 10.10/8.0 - there are no more iDisks */ 232 233CF_EXPORT const CFStringRef _kCFURLVolumeiDiskUserNameKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 234 /* Deprecated and scheduled for removal in 10.10/8.0 - there are no more iDisks */ 235 236CF_EXPORT const CFStringRef _kCFURLVolumeIsLocaliDiskMirrorKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 237 /* Deprecated and scheduled for removal in 10.10/8.0 - there are no more iDisks */ 238 239CF_EXPORT const CFStringRef _kCFURLVolumeIsiPodKey CF_AVAILABLE(10_6, 4_0); 240 /* Volume is on an iPod (CFBoolean) */ 241 242CF_EXPORT const CFStringRef _kCFURLVolumeIsCDKey CF_AVAILABLE(10_6, 4_0); 243 /* Volume is a CD (audio or CD-ROM). (CFBoolean) */ 244 245CF_EXPORT const CFStringRef _kCFURLVolumeIsDVDKey CF_AVAILABLE(10_6, 4_0); 246 /* Volume is a DVD (CFBoolean) */ 247 248CF_EXPORT const CFStringRef _kCFURLVolumeIsDeviceFileSystemKey CF_AVAILABLE(10_7, 5_0); 249 /* Volume is devfs (CFBoolean) */ 250 251CF_EXPORT const CFStringRef _kCFURLVolumeIsHFSStandardKey CF_AVAILABLE(10_6, 4_0); 252 /* Volume is HFS standard (which includes AFP volumes). Directory IDs, but not file IDs, can be looked up. (CFBoolean) */ 253 254CF_EXPORT const CFStringRef _kCFURLVolumeIOMediaIconFamilyNameKey CF_AVAILABLE(10_9, NA); 255 /* Volume's IOMediaIconFamilyName. (CFStringRef) */ 256 257CF_EXPORT const CFStringRef _kCFURLVolumeIOMediaIconBundleIdentifierKey CF_AVAILABLE(10_9, NA); 258 /* Volume's IOMediaIconBundleIdentifier. (CFStringRef) */ 259 260CF_EXPORT const CFStringRef _kCFURLResolvedFromBookmarkDataKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 261 /* Deprecated and scheduled for removal later in 10.9/7.0 since it is unused (*/ 262 263CF_EXPORT const CFStringRef _kCFURLVolumeMountPointStringKey CF_AVAILABLE(10_6, 4_0); 264 /* the volume mountpoint string (Read-only, value type CFString) */ 265 266CF_EXPORT const CFStringRef _kCFURLCompleteMountURLKey CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 267 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeURLForRemountingKey or NSURLVolumeURLForRemountingKey public property keys */ 268 269CF_EXPORT const CFStringRef _kCFURLUbiquitousItemDownloadRequestedKey CF_AVAILABLE(10_9, 7_0); 270/* Is this Ubiquity item scheduled for download? (this is also true for items that are already downloaded). Use startDownloadingUbiquitousItemAtURL:error: to make this true (Read-only, value type CFBoolean) */ 271 272 273/* 274 Some common boolean properties can be accessed as a bitfield 275 for better performance -- see _CFURLGetResourcePropertyFlags() and 276 _CFURLCopyResourcePropertyValuesAndFlags(), below. 277 */ 278enum { 279 kCFURLResourceIsRegularFile = 0x00000001, 280 kCFURLResourceIsDirectory = 0x00000002, 281 kCFURLResourceIsSymbolicLink = 0x00000004, 282 kCFURLResourceIsVolume = 0x00000008, 283 kCFURLResourceIsPackage = 0x00000010, 284 kCFURLResourceIsSystemImmutable = 0x00000020, 285 kCFURLResourceIsUserImmutable = 0x00000040, 286 kCFURLResourceIsHidden = 0x00000080, 287 kCFURLResourceHasHiddenExtension = 0x00000100, 288 kCFURLResourceIsApplication = 0x00000200, 289 kCFURLResourceIsCompressed = 0x00000400, 290 kCFURLResourceIsSystemCompressed CF_ENUM_DEPRECATED(10_6, 10_9, 4_0, 7_0) 291 = 0x00000400, /* Deprecated and scheduled for removal in 10.10/8.0 - Use kCFURLResourceIsCompressed */ 292 kCFURLCanSetHiddenExtension = 0x00000800, 293 kCFURLResourceIsReadable = 0x00001000, 294 kCFURLResourceIsWriteable = 0x00002000, 295 kCFURLResourceIsExecutable = 0x00004000, /* execute files or search directories */ 296 kCFURLIsAliasFile = 0x00008000, 297 kCFURLIsMountTrigger = 0x00010000, 298}; 299typedef unsigned long long CFURLResourcePropertyFlags; 300 301 302/* 303 _CFURLGetResourceFlags - Returns a bit array of resource flags in the "flags" 304 output parameter. Only flags whose corresponding bits are set in the "mask" parameter 305 are valid in the output bit array. Returns true on success, false if an error occurs. 306 Optional output error: the error is set to a valid CFErrorRef if and only if the function 307 returns false. A valid output error must be released by the caller. 308 */ 309CF_EXPORT 310Boolean _CFURLGetResourcePropertyFlags(CFURLRef url, CFURLResourcePropertyFlags mask, CFURLResourcePropertyFlags *flags, CFErrorRef *error) CF_AVAILABLE(10_6, 4_0); 311 312 313/* 314 File resource properties which can be obtained with _CFURLCopyFilePropertyValuesAndFlags(). 315 */ 316typedef CF_OPTIONS(unsigned long long, CFURLFilePropertyBitmap) { 317 kCFURLName = 0x0000000000000001, 318 kCFURLLinkCount = 0x0000000000000002, 319 kCFURLVolumeIdentifier = 0x0000000000000004, 320 kCFURLObjectIdentifier = 0x0000000000000008, 321 kCFURLCreationDate = 0x0000000000000010, 322 kCFURLContentModificationDate = 0x0000000000000020, 323 kCFURLAttributeModificationDate = 0x0000000000000040, 324 kCFURLFileSize = 0x0000000000000080, 325 kCFURLFileAllocatedSize = 0x0000000000000100, 326 kCFURLFileSizeOfResourceFork = 0x0000000000000200, 327 kCFURLFileAllocatedSizeOfResourceFork = 0x0000000000000400, 328 kCFURLFinderInfo = 0x0000000000000800, 329 kCFURLFileSecurity = 0x0000000000001000, 330}; 331 332/* 333 The structure where _CFURLCopyFilePropertyValuesAndFlags() returns file resource properties. 334 */ 335struct _CFURLFilePropertyValues { 336 CFStringRef name; /* you are responsible for releasing this if you ask for it and get it */ 337 uint32_t linkCount; 338 uint64_t volumeIdentifier; 339 uint64_t objectIdentifier; 340 CFAbsoluteTime creationDate; 341 CFAbsoluteTime contentModificationDate; 342 CFAbsoluteTime attributeModificationDate; 343 uint64_t fileSize; 344 uint64_t fileAllocatedSize; 345 uint64_t fileSizeOfResourceFork; 346 uint64_t fileAllocatedSizeOfResourceFork; 347 uint8_t finderInfo[32]; 348 CFFileSecurityRef fileSecurity; /* you are responsible for releasing this if you ask for it and get it */ 349}; 350typedef struct _CFURLFilePropertyValues _CFURLFilePropertyValues; 351 352/* 353 _CFURLCopyResourcePropertyValuesAndFlags - Returns property values as simple types 354 whenever possible. Returns a bit array of resource flags in the "flags" 355 output parameter. Only flags whose corresponding bits are set in the "mask" parameter 356 are valid in the output bit array. Returns true on success, false if an error occurs. 357 Optional output error: the error is set to a valid CFErrorRef if and only if the function 358 returns false. A valid output error must be released by the caller. 359 */ 360CF_EXPORT 361Boolean _CFURLCopyResourcePropertyValuesAndFlags( CFURLRef url, CFURLFilePropertyBitmap requestProperties, CFURLFilePropertyBitmap *actualProperties, struct _CFURLFilePropertyValues *properties, CFURLResourcePropertyFlags propertyFlagsMask, CFURLResourcePropertyFlags *propertyFlags, CFErrorRef *error) CF_AVAILABLE(10_7, 4_0); 362 363/* 364 Volume property flags 365 */ 366typedef CF_OPTIONS(unsigned long long, CFURLVolumePropertyFlags) { 367 kCFURLVolumeIsLocal = 0x1LL, // Local device (vs. network device) 368 kCFURLVolumeIsAutomount = 0x2LL, // Mounted by the automounter 369 kCFURLVolumeDontBrowse = 0x4LL, // Hidden from user browsing 370 kCFURLVolumeIsReadOnly = 0x8LL, // Mounted read-only 371 kCFURLVolumeIsQuarantined = 0x10LL, // Mounted with quarantine bit 372 kCFURLVolumeIsEjectable = 0x20LL, 373 kCFURLVolumeIsRemovable = 0x40LL, 374 kCFURLVolumeIsInternal = 0x80LL, 375 kCFURLVolumeIsExternal = 0x100LL, 376 kCFURLVolumeIsDiskImage = 0x200LL, 377 kCFURLVolumeIsFileVault = 0x400LL, 378 kCFURLVolumeIsLocaliDiskMirror CF_ENUM_DEPRECATED(10_6, 10_9, 4_0, 7_0) 379 = 0x800LL, // Deprecated and scheduled for removal in 10.10/8.0 - there are no more iDisks 380 kCFURLVolumeIsiPod = 0x1000LL, 381 kCFURLVolumeIsiDisk CF_ENUM_DEPRECATED(10_6, 10_9, 4_0, 7_0) 382 = 0x2000LL, // Deprecated and scheduled for removal in 10.10/8.0 - there are no more iDisks 383 kCFURLVolumeIsCD = 0x4000LL, 384 kCFURLVolumeIsDVD = 0x8000LL, 385 kCFURLVolumeIsDeviceFileSystem = 0x10000LL, 386 kCFURLVolumeIsTimeMachine CF_ENUM_AVAILABLE_MAC(10_9) 387 = 0x20000LL, 388 kCFURLVolumeIsAirport CF_ENUM_AVAILABLE_MAC(10_9) 389 = 0x40000LL, 390 kCFURLVolumeIsVideoDisk CF_ENUM_AVAILABLE_MAC(10_9) 391 = 0x80000LL, 392 kCFURLVolumeIsDVDVideo CF_ENUM_AVAILABLE_MAC(10_9) 393 = 0x100000LL, 394 kCFURLVolumeIsBDVideo CF_ENUM_AVAILABLE_MAC(10_9) 395 = 0x200000LL, 396 kCFURLVolumeIsMobileTimeMachine CF_ENUM_AVAILABLE_MAC(10_9) 397 = 0x400000LL, 398 kCFURLVolumeIsNetworkOptical CF_ENUM_AVAILABLE_MAC(10_9) 399 = 0x800000LL, 400 kCFURLVolumeIsBeingRepaired CF_ENUM_AVAILABLE_MAC(10_9) 401 = 0x1000000LL, 402 kCFURLVolumeIsBeingUnmounted CF_ENUM_AVAILABLE_MAC(10_9) 403 = 0x2000000LL, 404 405// IMPORTANT: The values of the following flags must stay in sync with the 406// VolumeCapabilities flags in CarbonCore (FileIDTreeStorage.h) 407 kCFURLVolumeSupportsPersistentIDs = 0x100000000LL, 408 kCFURLVolumeSupportsSearchFS = 0x200000000LL, 409 kCFURLVolumeSupportsExchange = 0x400000000LL, 410 // reserved 0x800000000LL, 411 kCFURLVolumeSupportsSymbolicLinks = 0x1000000000LL, 412 kCFURLVolumeSupportsDenyModes = 0x2000000000LL, 413 kCFURLVolumeSupportsCopyFile = 0x4000000000LL, 414 kCFURLVolumeSupportsReadDirAttr = 0x8000000000LL, 415 kCFURLVolumeSupportsJournaling = 0x10000000000LL, 416 kCFURLVolumeSupportsRename = 0x20000000000LL, 417 kCFURLVolumeSupportsFastStatFS = 0x40000000000LL, 418 kCFURLVolumeSupportsCaseSensitiveNames = 0x80000000000LL, 419 kCFURLVolumeSupportsCasePreservedNames = 0x100000000000LL, 420 kCFURLVolumeSupportsFLock = 0x200000000000LL, 421 kCFURLVolumeHasNoRootDirectoryTimes = 0x400000000000LL, 422 kCFURLVolumeSupportsExtendedSecurity = 0x800000000000LL, 423 kCFURLVolumeSupports2TBFileSize = 0x1000000000000LL, 424 kCFURLVolumeSupportsHardLinks = 0x2000000000000LL, 425 kCFURLVolumeSupportsMandatoryByteRangeLocks = 0x4000000000000LL, 426 kCFURLVolumeSupportsPathFromID = 0x8000000000000LL, 427 // reserved 0x10000000000000LL, 428 kCFURLVolumeIsJournaling = 0x20000000000000LL, 429 kCFURLVolumeSupportsSparseFiles = 0x40000000000000LL, 430 kCFURLVolumeSupportsZeroRuns = 0x80000000000000LL, 431 kCFURLVolumeSupportsVolumeSizes = 0x100000000000000LL, 432 kCFURLVolumeSupportsRemoteEvents = 0x200000000000000LL, 433 kCFURLVolumeSupportsHiddenFiles = 0x400000000000000LL, 434 kCFURLVolumeSupportsDecmpFSCompression = 0x800000000000000LL, 435 kCFURLVolumeHas64BitObjectIDs = 0x1000000000000000LL, 436 kCFURLVolumePropertyFlagsAll = 0xffffffffffffffffLL 437}; 438 439 440/* 441 _CFURLGetVolumePropertyFlags - Returns a bit array of volume properties. 442 Only flags whose corresponding bits are set in the "mask" parameter are valid 443 in the output bit array. Returns true on success, false if an error occurs. 444 Optional output error: the error is set to a valid CFErrorRef if and only if the function 445 returns false. A valid output error must be released by the caller. 446 */ 447CF_EXPORT 448Boolean _CFURLGetVolumePropertyFlags(CFURLRef url, CFURLVolumePropertyFlags mask, CFURLVolumePropertyFlags *flags, CFErrorRef *error) CF_AVAILABLE(10_6, 4_0); 449 450 451/* _CFURLCopyResourcePropertyForKeyFromCache works like CFURLCopyResourcePropertyForKey 452 only it never causes I/O. If the property value requested is cached (or known 453 to be not available) for the resource, return TRUE and the property value. The 454 property value returned could be NULL meaning that property is not available 455 for the resource. If the property value requested is not cached or the resource, 456 FALSE is returned. 457 458 Only for use by DesktopServices! 459 */ 460CF_EXPORT 461Boolean _CFURLCopyResourcePropertyForKeyFromCache(CFURLRef url, CFStringRef key, void *cfTypeRefValue) CF_AVAILABLE(10_8, NA); 462 463/* _CFURLCopyResourcePropertiesForKeysFromCache works like CFURLCopyResourcePropertiesForKeys 464 only it never causes I/O. If the property values requested are cached (or known 465 to be not available) for the resource, return a CFDictionary. Property values 466 not available for the resource are not included in the CFDictionary. 467 If the values requested are not cached, return NULL. 468 469 Only for use by DesktopServices! 470 */ 471CF_EXPORT 472CFDictionaryRef _CFURLCopyResourcePropertiesForKeysFromCache(CFURLRef url, CFArrayRef keys) CF_AVAILABLE(10_8, NA); 473 474/* _CFURLCacheResourcePropertyForKey works like CFURLCopyResourcePropertyForKey 475 only it does not return the property value -- it just ensures the value is cached. 476 If no errors occur, TRUE is returned. If an error occurs, FALSE is returned 477 and the optional output error is set to a valid CFErrorRef (which must be 478 released by the caller. 479 480 Only for use by DesktopServices! 481 */ 482CF_EXPORT 483Boolean _CFURLCacheResourcePropertyForKey(CFURLRef url, CFStringRef key, CFErrorRef *error) CF_AVAILABLE(10_8, NA); 484 485/* _CFURLCacheResourcePropertiesForKeys works like CFURLCopyResourcePropertiesForKeys 486 only it does not return the property values -- it just ensures the values is cached. 487 If no errors occur, TRUE is returned. If an error occurs, FALSE is returned 488 and the optional output error is set to a valid CFErrorRef (which must be 489 released by the caller. 490 491 Only for use by DesktopServices! 492 */ 493CF_EXPORT 494Boolean _CFURLCacheResourcePropertiesForKeys(CFURLRef url, CFArrayRef keys, CFErrorRef *error) CF_AVAILABLE(10_8, NA); 495 496 497/* 498 _CFURLSetResourcePropertyForKeyAndUpdateFileCache - Works mostly like CFURLSetResourcePropertyForKey 499 except that file system properties are updated in the URL's file cache (if it has a valid cache) 500 and dependant properties are not flushed. This means that values in the cache may not match what 501 is on the file system (see <rdar://problem/8371295> for details). 502 503 Only for use by DesktopServices! 504 */ 505CF_EXPORT 506Boolean _CFURLSetResourcePropertyForKeyAndUpdateFileCache(CFURLRef url, CFStringRef key, CFTypeRef propertyValue, CFErrorRef *error) CF_AVAILABLE(10_7, NA); 507 508/* 509 _CFURLCreateDisplayPathComponentsArray() 510 511 Summary: 512 _FileURLCreateDisplayPathComponentsArray creates a CFArray of 513 CFURLs for each component in the path leading up to the target 514 URL. This routine is suitable for clients who wish to show the 515 path leading up to a file system item. NOTE: This routine can be 516 I/O intensive, so use it sparingly, and cache the results if 517 possible. 518 519 Discussion: 520 The CFURLs in the result CFArray are ordered from the target URL 521 to the root of the display path. For example, if the target URL 522 is file://localhost/System/Library/ the CFURLs in the array will 523 be ordered: file://localhost/System/Library/, 524 file://localhost/System/, and then file://localhost/ 525 526 Parameters: 527 528 targetURL: 529 The target URL. 530 531 error: 532 A pointer to a CFErrorRef, or NULL. If error is non-NULL and 533 the function result is NULL, this will be filled in with a 534 CFErrorRef representing the error that occurred. 535 536 Result: 537 A CFArray or NULL if an error occurred. 538 */ 539CF_EXPORT 540CFArrayRef _CFURLCreateDisplayPathComponentsArray(CFURLRef url, CFErrorRef *error) CF_AVAILABLE(10_7, 4_0); 541 542/* Returns true for URLs that locate file system resources. */ 543CF_EXPORT 544Boolean _CFURLIsFileURL(CFURLRef url) CF_AVAILABLE(10_6, 4_0); 545 546/* Deprecated and scheduled for removal in 10.10/8.0 - Use the public API CFURLIsFileReferenceURL() */ 547CF_EXPORT 548Boolean _CFURLIsFileReferenceURL(CFURLRef url) CF_DEPRECATED(10_6, 10_9, 4_0, 7_0); 549 550/* For use by Core Services */ 551CF_EXPORT 552void *__CFURLResourceInfoPtr(CFURLRef url) CF_AVAILABLE(10_6, 4_0); 553 554CF_EXPORT 555void __CFURLSetResourceInfoPtr(CFURLRef url, void *ptr) CF_AVAILABLE(10_6, 4_0); 556 557 558struct FSCatalogInfo; 559struct HFSUniStr255; 560 561/* _CFURLGetCatalogInfo is used by LaunchServices */ 562CF_EXPORT 563SInt32 _CFURLGetCatalogInfo(CFURLRef url, UInt32 whichInfo, struct FSCatalogInfo *catalogInfo, struct HFSUniStr255 *name) CF_AVAILABLE(10_7, 5_0); 564 565/* _CFURLReplaceObject SPI */ 566 567/* options for _CFURLReplaceObject */ 568enum { 569// _CFURLItemReplacementUsingOriginalMetadataOnly = 1, // not used 570 _CFURLItemReplacementUsingNewMetadataOnly = 2, 571// _CFURLItemReplacementByMergingMetadata = 3, // not used 572 _CFURLItemReplacementWithoutDeletingBackupItem = 1 << 4 573}; 574 575CF_EXPORT 576Boolean _CFURLReplaceObject( CFAllocatorRef allocator, CFURLRef originalItemURL, CFURLRef newItemURL, CFStringRef newName, CFStringRef backupItemName, CFOptionFlags options, CFURLRef *resultingURL, CFErrorRef *error ) CF_AVAILABLE(10_7, 5_0); 577 578 579#if (TARGET_OS_MAC) || CF_BUILDING_CF || NSBUILDINGFOUNDATION 580CF_EXPORT 581CFURLEnumeratorResult _CFURLEnumeratorGetURLsBulk(CFURLEnumeratorRef enumerator, CFIndex maximumURLs, CFIndex *actualURLs, CFURLRef *urls, CFErrorRef *error) CF_AVAILABLE(10_6, 4_0); 582#endif 583 584#if TARGET_OS_MAC 585 586enum { 587 kCFBookmarkFileCreationWithoutOverwritingExistingFile = ( 1UL << 8 ), // if destination file already exists don't overwrite it and return an error 588 kCFBookmarkFileCreationWithoutAppendingAliasExtension = ( 1UL << 9 ), // don't add / change whatever extension is on the created alias file 589 kCFBookmarkFileCreationWithoutCreatingResourceFork = ( 1UL << 10 ), // don't create the resource-fork half of the alias file 590 591 kCFURLBookmarkCreationAllowCreationIfResourceDoesNotExistMask = ( 1 << 28 ), // allow creation of a bookmark to a file: scheme with a CFURLRef of item which may not exist. If the filesystem item does not exist, the created bookmark contains essentially no properties beyond the url string. 592 593 kCFURLBookmarkCreationDoNotIncludeSandboxExtensionsMask = ( 1 << 29 ), // If set, sandbox extensions are not included in created bookmarks. Ordinarily, bookmarks ( except those created suitable for putting into a bookmark file ) will have a sandbox extension added for the item 594}; 595 596enum { 597 kCFBookmarkResolutionPerformRelativeResolutionFirstMask CF_ENUM_AVAILABLE(10_8,6_0) = ( 1 << 11 ), // perform relative resolution before absolute resolution. If this bit is set, for this to be useful a relative URL must also have been passed in and the bookmark when created must have been created relative to another url. 598}; 599 600typedef CF_ENUM(CFIndex, CFURLBookmarkMatchResult) { 601 kCFURLBookmarkComparisonUnableToCompare = 0x00000000, /* the two bookmarks could not be compared for some reason */ 602 kCFURLBookmarkComparisonNoMatch = 0x00001000, /* Bookmarks do not refer to the same item */ 603 kCFURLBookmarkComparisonUnlikelyToMatch = 0x00002000, /* it is unlikely that the two items refer to the same filesystem item */ 604 kCFURLBookmarkComparisonLikelyToMatch = 0x00004000, /* it is likely that the two items refer to the same filesystem item ( but, they may not ) */ 605 kCFURLBookmarkComparisonMatch = 0x00008000, /* the two items refer to the same item, but other information in the bookmarks may not match */ 606 kCFURLBookmarkComparisonExactMatch = 0x0000f000 /* the two bookmarks are identical */ 607}; 608 609/* The relativeToURL and matchingPropertyKeys parameters are not used and are ignored */ 610CF_EXPORT 611CFURLBookmarkMatchResult _CFURLBookmarkDataCompare(CFDataRef bookmark1Ref, CFDataRef bookmark2Ref, CFURLRef relativeToURL, CFArrayRef* matchingPropertyKeys) CF_AVAILABLE(10_7, NA); 612 613CF_EXPORT 614OSStatus _CFURLBookmarkDataToAliasHandle(CFDataRef bookmarkRef, void* aliasHandleP) CF_AVAILABLE(10_7, NA); 615 616#endif 617 618/* 619 The following are properties that can be asked of bookmark data objects in addition to the resource properties 620 from CFURL itself. 621 */ 622 623extern const CFStringRef kCFURLBookmarkOriginalPathKey CF_AVAILABLE(10_7, 5_0); 624extern const CFStringRef kCFURLBookmarkOriginalRelativePathKey CF_AVAILABLE(10_7, 5_0); 625extern const CFStringRef kCFURLBookmarkOriginalRelativePathComponentsArrayKey CF_AVAILABLE(10_7, 5_0); 626extern const CFStringRef kCFURLBookmarkOriginalVolumeNameKey CF_AVAILABLE(10_7, 5_0); 627extern const CFStringRef kCFURLBookmarkOriginalVolumeCreationDateKey CF_AVAILABLE(10_7, 5_0); 628 629#endif /* TARGET_OS_MAC */ 630 631CF_EXTERN_C_END 632 633#endif /* ! __COREFOUNDATION_CFURLPRIV__ */ 634 635