this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Changes required to have _CFCopyVersionDictionary() working

+100 -49
+81
src/CFF/CFUtilities.c
··· 1 + 2 + #include "CFUtilities.h" 3 + #include <CoreFoundation/CFString.h> 4 + #include <CoreFoundation/CFData.h> 5 + #include <CoreFoundation/CFPropertyList.h> 6 + #include <stddef.h> 7 + #include "CFStringConst.h" 8 + #include <stdbool.h> 9 + #include "darling-config.h" 10 + 11 + CONST_STRING_DECL(_kCFSystemVersionProductNameKey, "ProductName"); 12 + CONST_STRING_DECL(_kCFSystemVersionProductCopyrightKey, "ProductCopyright"); 13 + CONST_STRING_DECL(_kCFSystemVersionProductVersionKey, "ProductVersion"); 14 + CONST_STRING_DECL(_kCFSystemVersionProductVersionExtraKey, "ProductVersionExtra"); 15 + CONST_STRING_DECL(_kCFSystemVersionProductUserVisibleVersionKey, "UserVisibleVersion"); 16 + CONST_STRING_DECL(_kCFSystemVersionBuildVersionKey, "ProductBuildVersion"); 17 + CONST_STRING_DECL(_kCFSystemVersionProductVersionStringKey, "ProductVersionString"); 18 + CONST_STRING_DECL(_kCFSystemVersionBuildStringKey, "ProductBuildString"); 19 + 20 + __attribute__((constructor)) 21 + static void initConstants() 22 + { 23 + CFTypeID type = CFStringGetTypeID(); 24 + GSRuntimeConstantInit(_kCFSystemVersionProductNameKey, type); 25 + GSRuntimeConstantInit(_kCFSystemVersionProductCopyrightKey, type); 26 + GSRuntimeConstantInit(_kCFSystemVersionProductVersionKey, type); 27 + GSRuntimeConstantInit(_kCFSystemVersionProductVersionExtraKey, type); 28 + GSRuntimeConstantInit(_kCFSystemVersionBuildVersionKey, type); 29 + GSRuntimeConstantInit(_kCFSystemVersionProductUserVisibleVersionKey, type); 30 + GSRuntimeConstantInit(_kCFSystemVersionProductVersionStringKey, type); 31 + GSRuntimeConstantInit(_kCFSystemVersionBuildStringKey, type); 32 + 33 + CFHash(_kCFSystemVersionBuildStringKey); 34 + } 35 + 36 + Boolean _CFExecutableLinkedOnOrAfter(CFSystemVersion version) 37 + { 38 + // TODO: For now just say yep, we are newer 39 + return true; 40 + } 41 + 42 + static CFDictionaryRef _CFCopyVersionDictionary(CFStringRef path) 43 + { 44 + CFURLRef url; 45 + CFDataRef resourceData; 46 + Boolean status; 47 + SInt32 errorCode; 48 + CFErrorRef err; 49 + CFPropertyListRef plist; 50 + 51 + url = CFURLCreateWithFileSystemPath(NULL, path, kCFURLPOSIXPathStyle, 0); 52 + status = CFURLCreateDataAndPropertiesFromResource(NULL, url, &resourceData, 53 + NULL, NULL, &errorCode); 54 + 55 + if (!status) 56 + { 57 + CFRelease(url); 58 + return NULL; 59 + } 60 + 61 + plist = CFPropertyListCreateWithData(NULL, resourceData, kCFPropertyListImmutable, 62 + NULL, &err); 63 + 64 + CFRelease(resourceData); 65 + CFRelease(url); 66 + 67 + return plist; 68 + } 69 + 70 + CFDictionaryRef _CFCopySystemVersionDictionary(void) 71 + { 72 + CFStringRef str = CFSTR(SHARE_PATH "/SystemVersion.plist"); 73 + return _CFCopyVersionDictionary(str); 74 + } 75 + 76 + CFDictionaryRef _CFCopyServerVersionDictionary(void) 77 + { 78 + CFStringRef str = CFSTR(SHARE_PATH "/SystemVersion.plist"); 79 + return _CFCopyVersionDictionary(str); 80 + } 81 +
-46
src/CFF/CFUtilities.cpp
··· 1 - 2 - #include "CFUtilities.h" 3 - #include <CoreFoundation/CFString.h> 4 - #include <stddef.h> 5 - 6 - Boolean _CFExecutableLinkedOnOrAfter(CFSystemVersion version) 7 - { 8 - // TODO: For now just say yep, we are newer 9 - return true; 10 - } 11 - 12 - static CFDictionaryRef _CFCopyVersionDictionary(CFStringRef path) 13 - { 14 - static const CFStringRef keys[] = 15 - { 16 - CFSTR("ProductBuildVersion"), 17 - CFSTR("ProductCopyright"), 18 - CFSTR("ProductName"), 19 - CFSTR("ProductUserVisibleVersion"), 20 - CFSTR("ProductVersion") 21 - }; 22 - 23 - static const CFStringRef values[] = 24 - { 25 - CFSTR("12345678"), 26 - CFSTR("See Source Files"), 27 - CFSTR("Darling"), 28 - CFSTR("10.8"), 29 - CFSTR("10.8") 30 - }; 31 - 32 - return CFDictionaryCreate(NULL, (const void**)&keys[0], (const void**)&values[0], 5, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); 33 - } 34 - 35 - CFDictionaryRef _CFCopySystemVersionDictionary(void) 36 - { 37 - // TODO: Make this a real file installed by Darling and read by _CFCopyVersionDictionary 38 - return _CFCopyVersionDictionary(CFSTR("/System/Library/CoreServices/SystemVersion.plist")); 39 - } 40 - 41 - CFDictionaryRef _CFCopyServerVersionDictionary(void) 42 - { 43 - // TODO: Make this a real file installed by Darling and read by _CFCopyVersionDictionary 44 - return _CFCopyVersionDictionary(CFSTR("/System/Library/CoreServices/ServerVersion.plist")); 45 - } 46 -
+1 -2
src/CFF/CFUtilities.h
··· 4 4 #include <CoreFoundation/CFBase.h> 5 5 #include <CoreFoundation/CFDictionary.h> 6 6 7 - typedef enum { 8 - } CFSystemVersion; 7 + typedef int CFSystemVersion; 9 8 10 9 CF_EXPORT Boolean _CFExecutableLinkedOnOrAfter(CFSystemVersion version); 11 10
+1 -1
src/CFF/CMakeLists.txt
··· 41 41 ) 42 42 43 43 set(cffextra_SRCS 44 - CFUtilities.cpp 44 + CFUtilities.c 45 45 CFPreferences.mm 46 46 ../util/debug.cpp 47 47 ../util/stlutils.cpp
+1
src/CoreServices/CMakeLists.txt
··· 64 64 target_link_libraries(CoreServices icucore system ${EXTRA_LIBS} CFF cxx iconv) 65 65 66 66 install(TARGETS CoreServices DESTINATION "lib${SUFFIX}/darling") 67 + install(FILES SystemVersion.plist DESTINATION "share/darling") 67 68
+16
src/CoreServices/SystemVersion.plist
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 3 + <plist version="1.0"> 4 + <dict> 5 + <key>ProductBuildVersion</key> 6 + <string>Darling</string> 7 + <key>ProductCopyright</key> 8 + <string>2012-2015 Lubos Dolezel</string> 9 + <key>ProductName</key> 10 + <string>Mac OS X</string> 11 + <key>ProductUserVisibleVersion</key> 12 + <string>10.8</string> 13 + <key>ProductVersion</key> 14 + <string>10.8</string> 15 + </dict> 16 + </plist>