]>
Commit | Line | Data |
---|---|---|
020dfc54 JF |
1 | #import <GraphicsServices/GraphicsServices.h> |
2 | #import <UIKit/UIKit.h> | |
3 | #include <stdio.h> | |
4 | #include <dlfcn.h> | |
5 | ||
6 | static CFArrayRef (*$GSSystemCopyCapability)(CFStringRef); | |
7 | static CFArrayRef (*$GSSystemGetCapability)(CFStringRef); | |
8 | ||
9 | int main(int argc, char *argv[]) { | |
10 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
11 | ||
12 | NSString *name = nil; | |
13 | ||
14 | if (argc == 2) | |
15 | name = [NSString stringWithUTF8String:argv[0]]; | |
16 | else if (argc > 2) { | |
17 | fprintf(stderr, "usage: %s [capability]\n", argv[0]); | |
18 | exit(1); | |
19 | } | |
20 | ||
21 | $GSSystemCopyCapability = reinterpret_cast<CFArrayRef (*)(CFStringRef)>(dlsym(RTLD_DEFAULT, "GSSystemCopyCapability")); | |
22 | $GSSystemGetCapability = reinterpret_cast<CFArrayRef (*)(CFStringRef)>(dlsym(RTLD_DEFAULT, "GSSystemGetCapability")); | |
23 | ||
24 | const NSArray *capability; | |
25 | ||
26 | if ($GSSystemCopyCapability != NULL) { | |
27 | capability = reinterpret_cast<const NSArray *>((*$GSSystemCopyCapability)(reinterpret_cast<CFStringRef>(name))); | |
28 | capability = [capability autorelease]; | |
29 | } else if ($GSSystemGetCapability != NULL) { | |
30 | capability = reinterpret_cast<const NSArray *>((*$GSSystemGetCapability)(reinterpret_cast<CFStringRef>(name))); | |
31 | } else | |
32 | capability = nil; | |
33 | ||
34 | NSLog(@"%@", capability); | |
35 | ||
36 | /*for (NSString *value in capability) | |
37 | printf("%s\n", [value UTF8String]);*/ | |
38 | ||
39 | [pool release]; | |
40 | ||
41 | return 0; | |
42 | } |