- Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCFBundle_Internal.h
256 lines (213 loc) · 11.9 KB
/
CFBundle_Internal.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
/*
* Copyright (c) 2008-2012 Brent Fulgham <bfulgham@gmail.org>. All rights reserved.
*
* This source code is a modified version of the CoreFoundation sources released by Apple Inc. under
* the terms of the APSL version 2.0 (see below).
*
* For information about changes from the original Apple source release can be found by reviewing the
* source control system for the project at https://sourceforge.net/svn/?group_id=246198.
*
* The original license information is as follows:
*
* Copyright (c) 2012 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/* CFBundle_Internal.h
Copyright (c) 1999-2011, Apple Inc. All rights reserved.
*/
#if !defined(__COREFOUNDATION_CFBUNDLE_INTERNAL__)
#define__COREFOUNDATION_CFBUNDLE_INTERNAL__ 1
#include<CoreFoundation/CFDate.h>
#include<CoreFoundation/CFBundle.h>
#include<CoreFoundation/CFPlugIn.h>
#include<CoreFoundation/CFError.h>
#include<CoreFoundation/CoreFoundation_Prefix.h>
#include"CFInternal.h"
#include"CFPlugIn_Factory.h"
#include"CFBundle_BinaryTypes.h"
CF_EXTERN_C_BEGIN
#define__kCFLogBundle 3
#define__kCFLogPlugIn 3
#ifDEPLOYMENT_TARGET_MACOSX||DEPLOYMENT_TARGET_EMBEDDED||DEPLOYMENT_TARGET_LINUX||DEPLOYMENT_TARGET_FREEBSD
#definePLATFORM_PATH_STYLE kCFURLPOSIXPathStyle
#elifDEPLOYMENT_TARGET_WINDOWS
#definePLATFORM_PATH_STYLE kCFURLWindowsPathStyle
#else
#error Unknown or unspecified DEPLOYMENT_TARGET
#endif
#defineCFBundleExecutableNotFoundError 4
#defineCFBundleExecutableNotLoadableError 3584
#defineCFBundleExecutableArchitectureMismatchError 3585
#defineCFBundleExecutableRuntimeMismatchError 3586
#defineCFBundleExecutableLoadError 3587
#defineCFBundleExecutableLinkError 3588
typedefstruct__CFResourceData {
CFMutableDictionaryRef_stringTableCache;
Boolean_executableLacksResourceFork;
Boolean_infoDictionaryFromResourceFork;
char_padding[2];
} _CFResourceData;
extern_CFResourceData*__CFBundleGetResourceData(CFBundleRefbundle);
typedefstruct__CFPlugInData {
Boolean_isPlugIn;
Boolean_loadOnDemand;
Boolean_isDoingDynamicRegistration;
Boolean_unused1;
UInt32_instanceCount;
CFMutableArrayRef_factories;
} _CFPlugInData;
extern_CFPlugInData*__CFBundleGetPlugInData(CFBundleRefbundle);
/* Private CFBundle API */
externBoolean_CFIsResourceAtURL(CFURLRefurl, Boolean*isDir);
externBoolean_CFIsResourceAtPath(CFStringRefpath, Boolean*isDir);
externBoolean_CFBundleURLLooksLikeBundleVersion(CFURLRefurl, UInt8*version);
externCFDictionaryRef_CFBundleCopyInfoDictionaryInDirectory(CFAllocatorRefalloc, CFURLRefurl, UInt8*version);
externCFDictionaryRef_CFBundleCopyInfoDictionaryInDirectoryWithVersion(CFAllocatorRefalloc, CFURLRefurl, UInt8version);
externCFURLRef_CFBundleCopySupportFilesDirectoryURLInDirectory(CFURLRefbundleURL, UInt8version);
externCFURLRef_CFBundleCopyResourcesDirectoryURLInDirectory(CFURLRefbundleURL, UInt8version);
externBoolean_CFBundleCouldBeBundle(CFURLRefurl);
externCFURLRef_CFBundleCopyResourceForkURLMayBeLocal(CFBundleRefbundle, BooleanmayBeLocal);
externCFDictionaryRef_CFBundleCopyInfoDictionaryInResourceForkWithAllocator(CFAllocatorRefalloc, CFURLRefurl);
externCFStringRef_CFBundleCopyBundleDevelopmentRegionFromVersResource(CFBundleRefbundle);
externCFDictionaryRef_CFBundleCopyInfoDictionaryInExecutable(CFURLRefurl);
externCFArrayRef_CFBundleCopyArchitecturesForExecutable(CFURLRefurl);
externvoid_CFBundleAddPreferredLprojNamesInDirectory(CFAllocatorRefalloc, CFURLRefbundleURL, UInt8version, CFDictionaryRefinfoDict, CFMutableArrayReflprojNames, CFStringRefdevLang);
externCFStringRef_CFBundleGetPlatformExecutablesSubdirectoryName(void);
externCFStringRef_CFBundleGetAlternatePlatformExecutablesSubdirectoryName(void);
externCFStringRef_CFBundleGetOtherPlatformExecutablesSubdirectoryName(void);
externCFStringRef_CFBundleGetOtherAlternatePlatformExecutablesSubdirectoryName(void);
externCFStringRef_CFCreateStringFromVersionNumber(CFAllocatorRefalloc, UInt32vers);
externUInt32_CFVersionNumberFromString(CFStringRefversStr);
externvoid_CFBundleScheduleForUnloading(CFBundleRefbundle);
externvoid_CFBundleUnscheduleForUnloading(CFBundleRefbundle);
externvoid_CFBundleUnloadScheduledBundles(void);
#if defined(BINARY_SUPPORT_DYLD)
// DYLD API
extern__CFPBinaryType_CFBundleGrokBinaryType(CFURLRefexecutableURL);
externCFArrayRef_CFBundleDYLDCopyLoadedImagePathsIfChanged(void);
externCFArrayRef_CFBundleDYLDCopyLoadedImagePathsForHint(CFStringRefhint);
#if !defined(BINARY_SUPPORT_DLFCN)
externBoolean_CFBundleDYLDCheckLoaded(CFBundleRefbundle);
externBoolean_CFBundleDYLDLoadBundle(CFBundleRefbundle, BooleanforceGlobal, CFErrorRef*error);
externBoolean_CFBundleDYLDLoadFramework(CFBundleRefbundle, CFErrorRef*error);
externvoid_CFBundleDYLDUnloadBundle(CFBundleRefbundle);
externvoid*_CFBundleDYLDGetSymbolByName(CFBundleRefbundle, CFStringRefsymbolName);
#endif/* !BINARY_SUPPORT_DLFCN */
#endif/* BINARY_SUPPORT_DYLD */
#if defined(BINARY_SUPPORT_DLFCN)
// dlfcn API
externBoolean_CFBundleDlfcnCheckLoaded(CFBundleRefbundle);
externBoolean_CFBundleDlfcnPreflight(CFBundleRefbundle, CFErrorRef*error);
externBoolean_CFBundleDlfcnLoadBundle(CFBundleRefbundle, BooleanforceGlobal, CFErrorRef*error);
externBoolean_CFBundleDlfcnLoadFramework(CFBundleRefbundle, CFErrorRef*error);
externvoid_CFBundleDlfcnUnload(CFBundleRefbundle);
externvoid*_CFBundleDlfcnGetSymbolByName(CFBundleRefbundle, CFStringRefsymbolName);
#endif/* BINARY_SUPPORT_DLFCN */
#if defined(BINARY_SUPPORT_DLL)
externBoolean_CFBundleDLLLoad(CFBundleRefbundle, CFErrorRef*error);
externvoid_CFBundleDLLUnload(CFBundleRefbundle);
externvoid*_CFBundleDLLGetSymbolByName(CFBundleRefbundle, CFStringRefsymbolName);
#endif/* BINARY_SUPPORT_DLL */
/* Private PlugIn-related CFBundle API */
externBoolean_CFBundleNeedsInitPlugIn(CFBundleRefbundle);
externvoid_CFBundleInitPlugIn(CFBundleRefbundle);
externvoid_CFBundlePlugInLoaded(CFBundleRefbundle);
externvoid_CFBundleDeallocatePlugIn(CFBundleRefbundle);
externvoid_CFPlugInWillUnload(CFPlugInRefplugIn);
externvoid_CFPlugInAddPlugInInstance(CFPlugInRefplugIn);
externvoid_CFPlugInRemovePlugInInstance(CFPlugInRefplugIn);
externvoid_CFPlugInAddFactory(CFPlugInRefplugIn, _CFPFactory*factory);
externvoid_CFPlugInRemoveFactory(CFPlugInRefplugIn, _CFPFactory*factory);
/* Strings for parsing bundle structure */
#define_CFBundleSupportFilesDirectoryName1 CFSTR("Support Files")
#define_CFBundleSupportFilesDirectoryName2 CFSTR("Contents")
#define_CFBundleResourcesDirectoryName CFSTR("Resources")
#define_CFBundleExecutablesDirectoryName CFSTR("Executables")
#define_CFBundleNonLocalizedResourcesDirectoryName CFSTR("Non-localized Resources")
#define_CFBundleSupportFilesURLFromBase1 CFSTR("Support%20Files/")
#define_CFBundleSupportFilesURLFromBase2 CFSTR("Contents/")
#define_CFBundleResourcesURLFromBase0 CFSTR("Resources/")
#define_CFBundleResourcesURLFromBase1 CFSTR("Support%20Files/Resources/")
#define_CFBundleResourcesURLFromBase2 CFSTR("Contents/Resources/")
#define_CFBundleAppStoreReceiptURLFromBase0 CFSTR("_MASReceipt/receipt")
#define_CFBundleAppStoreReceiptURLFromBase1 CFSTR("Support%20Files/_MASReceipt/receipt")
#define_CFBundleAppStoreReceiptURLFromBase2 CFSTR("Contents/_MASReceipt/receipt")
#define_CFBundleExecutablesURLFromBase1 CFSTR("Support%20Files/Executables/")
#define_CFBundleExecutablesURLFromBase2 CFSTR("Contents/")
#define_CFBundleInfoURLFromBase0 CFSTR("Resources/Info.plist")
#define_CFBundleInfoURLFromBase1 CFSTR("Support%20Files/Info.plist")
#define_CFBundleInfoURLFromBase2 CFSTR("Contents/Info.plist")
#define_CFBundleInfoURLFromBase3 CFSTR("Info.plist")
#define_CFBundleInfoFileName CFSTR("Info.plist")
#define_CFBundleInfoURLFromBaseNoExtension0 CFSTR("Resources/Info")
#define_CFBundleInfoURLFromBaseNoExtension1 CFSTR("Support%20Files/Info")
#define_CFBundleInfoURLFromBaseNoExtension2 CFSTR("Contents/Info")
#define_CFBundleInfoURLFromBaseNoExtension3 CFSTR("Info")
#define_CFBundleInfoExtension CFSTR("plist")
#define_CFBundleLocalInfoName CFSTR("InfoPlist")
#define_CFBundlePkgInfoURLFromBase1 CFSTR("Support%20Files/PkgInfo")
#define_CFBundlePkgInfoURLFromBase2 CFSTR("Contents/PkgInfo")
#define_CFBundlePseudoPkgInfoURLFromBase CFSTR("PkgInfo")
#define_CFBundlePrivateFrameworksURLFromBase0 CFSTR("Frameworks/")
#define_CFBundlePrivateFrameworksURLFromBase1 CFSTR("Support%20Files/Frameworks/")
#define_CFBundlePrivateFrameworksURLFromBase2 CFSTR("Contents/Frameworks/")
#define_CFBundleSharedFrameworksURLFromBase0 CFSTR("SharedFrameworks/")
#define_CFBundleSharedFrameworksURLFromBase1 CFSTR("Support%20Files/SharedFrameworks/")
#define_CFBundleSharedFrameworksURLFromBase2 CFSTR("Contents/SharedFrameworks/")
#define_CFBundleSharedSupportURLFromBase0 CFSTR("SharedSupport/")
#define_CFBundleSharedSupportURLFromBase1 CFSTR("Support%20Files/SharedSupport/")
#define_CFBundleSharedSupportURLFromBase2 CFSTR("Contents/SharedSupport/")
#define_CFBundleBuiltInPlugInsURLFromBase0 CFSTR("PlugIns/")
#define_CFBundleBuiltInPlugInsURLFromBase1 CFSTR("Support%20Files/PlugIns/")
#define_CFBundleBuiltInPlugInsURLFromBase2 CFSTR("Contents/PlugIns/")
#define_CFBundleAlternateBuiltInPlugInsURLFromBase0 CFSTR("Plug-ins/")
#define_CFBundleAlternateBuiltInPlugInsURLFromBase1 CFSTR("Support%20Files/Plug-ins/")
#define_CFBundleAlternateBuiltInPlugInsURLFromBase2 CFSTR("Contents/Plug-ins/")
#define_CFBundleLprojExtension CFSTR("lproj")
#define_CFBundleLprojExtensionWithDot CFSTR(".lproj")
#define_CFBundleMacOSXPlatformName CFSTR("macos")
#define_CFBundleAlternateMacOSXPlatformName CFSTR("macosx")
#define_CFBundleiPhoneOSPlatformName CFSTR("iphoneos")
#define_CFBundleMacOS8PlatformName CFSTR("macosclassic")
#define_CFBundleAlternateMacOS8PlatformName CFSTR("macos8")
#define_CFBundleWindowsPlatformName CFSTR("windows")
#define_CFBundleHPUXPlatformName CFSTR("hpux")
#define_CFBundleSolarisPlatformName CFSTR("solaris")
#define_CFBundleLinuxPlatformName CFSTR("linux")
#define_CFBundleFreeBSDPlatformName CFSTR("freebsd")
#define_CFBundleDefaultStringTableName CFSTR("Localizable")
#define_CFBundleStringTableType CFSTR("strings")
#define_CFBundleStringDictTableType CFSTR("stringsdict")
#define_CFBundleUserLanguagesPreferenceName CFSTR("AppleLanguages")
#define_CFBundleOldUserLanguagesPreferenceName CFSTR("NSLanguages")
#define_CFBundleLocalizedResourceForkFileName CFSTR("Localized")
#ifDEPLOYMENT_TARGET_WINDOWS
#define_CFBundleWindowsResourceDirectoryExtension CFSTR("resources")
#endif
/* Old platform names (no longer used) */
#define_CFBundleMacOSXPlatformName_OLD CFSTR("macintosh")
#define_CFBundleAlternateMacOSXPlatformName_OLD CFSTR("nextstep")
#define_CFBundleWindowsPlatformName_OLD CFSTR("windows")
#define_CFBundleAlternateWindowsPlatformName_OLD CFSTR("winnt")
#define_CFBundleMacOSXInfoPlistPlatformName_OLD CFSTR("macos")
#define_CFBundleWindowsInfoPlistPlatformName_OLD CFSTR("win32")
CF_EXTERN_C_END
#endif/* ! __COREFOUNDATION_CFBUNDLE_INTERNAL__ */