-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgestalt.c
85 lines (61 loc) · 1.97 KB
/
gestalt.c
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
/*++
Copyright (C) 2011, Velocity Limitless Organization
Licensed under the GNU General Public License v2.
File name:
gestalt.c
Abstract:
Hook functions used by /usr/lib/libMobileGestalt.dylib,
specifically libMobileGestalt!MGCopyAnswer.
--*/
#include <voodoo.h>
PMG_COPY_ANSWER_ROUTINE pMGCopyAnswer;
CFBooleanRef kGSMultitaskingGesturesDefaultOffCapability;
CFTypeRef PSDefaultAssistantLanguage;
CFTypeRef
MGCopyAnswer(
__in CFStringRef KeyToCopy
)
/*++
Routine Description:
Copy a CFData value from the internal mobilegestalt
dictionary, and return a pointer to that CFData object.
Arguments:
KeyToCopy - Key to copy from MobileGestalt.
Return Value:
Pointer to CFType object
--*/
{
CFTypeRef ReturnData;
CFStringRef DeviceName = CFSTR(DEVICE_NAME);
CFStringRef MachineString = CFSTR(MACHINE_STRING);
CFStringRef ModelNumber = CFSTR(MG_MODEL);
CFStringRef ModelString = CFSTR(MODEL_STRING);
CFStringRef SerialNumber = CFSTR(MG_SERIAL);
//
// Check to see if the real function is null.
//
if(!pMGCopyAnswer)
pMGCopyAnswer = dlsym(RTLD_NEXT, "MGCopyAnswer");
//
// Check to see if the string is ours or not.
//
if(!CFStringCompare(KeyToCopy, CFSTR("ProductType"), 0))
return MachineString;
else if(!CFStringCompare(KeyToCopy, CFSTR("ModelNumber"), 0))
return ModelNumber;
else if(!CFStringCompare(KeyToCopy, CFSTR("SerialNumber"), 0))
return SerialNumber;
else if(!CFStringCompare(KeyToCopy, CFSTR("HWModelStr"), 0))
return ModelString;
else if(!CFStringCompare(KeyToCopy, CFSTR("DeviceName"), 0))
return DeviceName;
else if(!CFStringCompare(KeyToCopy, CFSTR("DeviceClass"), 0))
return DeviceName;
else if(!CFStringCompare(KeyToCopy, CFSTR("DeviceClass"), 0))
return DeviceName;
//
// It's not.
//
ReturnData = pMGCopyAnswer(KeyToCopy);
return ReturnData;
}