62 CFTypeRef (*pLSGetCurrentApplicationASN)(void);
68 void* application_services_handle;
69 void* core_foundation_handle;
75 void (*pLSSetApplicationLaunchServicesServerConnectionStatus)(
uint64_t,
81 application_services_handle = dlopen(
"/System/Library/Frameworks/"
82 "ApplicationServices.framework/"
83 "Versions/A/ApplicationServices",
84 RTLD_LAZY | RTLD_LOCAL);
85 core_foundation_handle = dlopen(
"/System/Library/Frameworks/"
86 "CoreFoundation.framework/"
87 "Versions/A/CoreFoundation",
88 RTLD_LAZY | RTLD_LOCAL);
90 if (application_services_handle ==
NULL || core_foundation_handle ==
NULL)
93 *(
void **)(&pCFStringCreateWithCString) =
94 dlsym(core_foundation_handle,
"CFStringCreateWithCString");
95 *(
void **)(&pCFBundleGetBundleWithIdentifier) =
96 dlsym(core_foundation_handle,
"CFBundleGetBundleWithIdentifier");
97 *(
void **)(&pCFBundleGetDataPointerForName) =
98 dlsym(core_foundation_handle,
"CFBundleGetDataPointerForName");
99 *(
void **)(&pCFBundleGetFunctionPointerForName) =
100 dlsym(core_foundation_handle,
"CFBundleGetFunctionPointerForName");
102 if (pCFStringCreateWithCString ==
NULL ||
103 pCFBundleGetBundleWithIdentifier ==
NULL ||
104 pCFBundleGetDataPointerForName ==
NULL ||
105 pCFBundleGetFunctionPointerForName ==
NULL) {
109 #define S(s) pCFStringCreateWithCString(NULL, (s), kCFStringEncodingUTF8)
111 launch_services_bundle =
112 pCFBundleGetBundleWithIdentifier(
S(
"com.apple.LaunchServices"));
114 if (launch_services_bundle ==
NULL)
117 *(
void **)(&pLSGetCurrentApplicationASN) =
118 pCFBundleGetFunctionPointerForName(launch_services_bundle,
119 S(
"_LSGetCurrentApplicationASN"));
121 if (pLSGetCurrentApplicationASN ==
NULL)
124 *(
void **)(&pLSSetApplicationInformationItem) =
125 pCFBundleGetFunctionPointerForName(launch_services_bundle,
126 S(
"_LSSetApplicationInformationItem"));
128 if (pLSSetApplicationInformationItem ==
NULL)
131 display_name_key = pCFBundleGetDataPointerForName(launch_services_bundle,
132 S(
"_kLSDisplayNameKey"));
134 if (display_name_key ==
NULL || *display_name_key ==
NULL)
137 *(
void **)(&pCFBundleGetInfoDictionary) = dlsym(core_foundation_handle,
138 "CFBundleGetInfoDictionary");
139 *(
void **)(&pCFBundleGetMainBundle) = dlsym(core_foundation_handle,
140 "CFBundleGetMainBundle");
141 if (pCFBundleGetInfoDictionary ==
NULL || pCFBundleGetMainBundle ==
NULL)
144 *(
void **)(&pLSApplicationCheckIn) = pCFBundleGetFunctionPointerForName(
145 launch_services_bundle,
146 S(
"_LSApplicationCheckIn"));
148 if (pLSApplicationCheckIn ==
NULL)
151 *(
void **)(&pLSSetApplicationLaunchServicesServerConnectionStatus) =
152 pCFBundleGetFunctionPointerForName(
153 launch_services_bundle,
154 S(
"_LSSetApplicationLaunchServicesServerConnectionStatus"));
156 if (pLSSetApplicationLaunchServicesServerConnectionStatus ==
NULL)
159 pLSSetApplicationLaunchServicesServerConnectionStatus(0,
NULL);
162 pLSApplicationCheckIn(-2,
163 pCFBundleGetInfoDictionary(pCFBundleGetMainBundle()));
165 asn = pLSGetCurrentApplicationASN();
172 if (pLSSetApplicationInformationItem(-2,
184 if (core_foundation_handle !=
NULL)
185 dlclose(core_foundation_handle);
187 if (application_services_handle !=
NULL)
188 dlclose(application_services_handle);
const lzma_allocator const uint8_t size_t uint8_t * out
static int uv__pthread_setname_np(const char *name)
static const OSStatus noErr
unsigned CFStringEncoding