Skip to content

Commit c4bbdd0

Browse files
Evan LojewskiEvan Lojewski
Evan Lojewski
authored and
Evan Lojewski
committedNov 26, 2016
Iniital import from internal svn repo.
1 parent 3d90198 commit c4bbdd0

File tree

12 files changed

+2424
-1
lines changed

12 files changed

+2424
-1
lines changed
 

‎English.lproj/InfoPlist.strings

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/* Localized versions of Info.plist keys */
2+

‎Info.plist

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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>CFBundleDevelopmentRegion</key>
6+
<string>English</string>
7+
<key>CFBundleExecutable</key>
8+
<string>${EXECUTABLE_NAME}</string>
9+
<key>CFBundleName</key>
10+
<string>${PRODUCT_NAME}</string>
11+
<key>CFBundleIconFile</key>
12+
<string></string>
13+
<key>CFBundleIdentifier</key>
14+
<string>com.meklort.kext.${PRODUCT_NAME:rfc1034Identifier}</string>
15+
<key>CFBundleInfoDictionaryVersion</key>
16+
<string>6.0</string>
17+
<key>CFBundlePackageType</key>
18+
<string>KEXT</string>
19+
<key>CFBundleSignature</key>
20+
<string>????</string>
21+
<key>CFBundleVersion</key>
22+
<string>1.1.1</string>
23+
<key>CFBundleShortVersionString</key>
24+
<string>1.1.1</string>
25+
<key>IOKitPersonalities</key>
26+
<dict>
27+
<key>KextcacheHelper</key>
28+
<dict>
29+
<key>CFBundleIdentifier</key>
30+
<string>com.meklort.kext.${PRODUCT_NAME:rfc1034Identifier}</string>
31+
<key>IOClass</key>
32+
<string>KextcacheHelper</string>
33+
<key>IOMatchCategory</key>
34+
<string>KextcacheHelper</string>
35+
<key>IOProbeScore</key>
36+
<integer>1000</integer>
37+
<key>IOProviderClass</key>
38+
<string>IOPlatformExpertDevice</string>
39+
<key>IOResourceMatch</key>
40+
<string>ACPI</string>
41+
</dict>
42+
</dict>
43+
<key>OSBundleLibraries</key>
44+
<dict>
45+
<key>com.apple.kpi.iokit</key>
46+
<string>9.8.0</string>
47+
<key>com.apple.kpi.libkern</key>
48+
<string>9.8.0</string>
49+
<key>com.meklort.symbols.kextcacheHelper</key>
50+
<string>10.0.0</string>
51+
</dict>
52+
<key>OSBundleRequired</key>
53+
<string>Root</string>
54+
</dict>
55+
</plist>

‎KextcacheHelper.cpp

+181
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
/*
2+
* kextcacheHelper.cpp
3+
* kextcacheHelper
4+
*
5+
* Created by Meklort on 10/21/10.
6+
* Copyright 2010 Evan Lojewski. All rights reserved.
7+
*
8+
*/
9+
#include "kextcacheHelper.h"
10+
#include "loader.h"
11+
12+
#define super IOService
13+
OSDefineMetaClassAndStructors(KextcacheHelper, IOService);
14+
15+
16+
static int (*KextcacheHelper_handler)(struct image_params *imgp);
17+
18+
19+
bool KextcacheHelper::start(IOService *provider)
20+
{
21+
// Replace first img handler with our own, that way we are run first.
22+
KextcacheHelper_handler = execsw->ex_imgact;
23+
execsw->ex_imgact = &KextcacheHelper::exec_KextcacheHelper_imgact;
24+
25+
return true;
26+
}
27+
28+
void KextcacheHelper::stop()
29+
{
30+
execsw->ex_imgact = KextcacheHelper_handler; // Put old handler back
31+
}
32+
33+
void KextcacheHelper::free( void )
34+
{
35+
execsw->ex_imgact = KextcacheHelper_handler; // Put old handler back
36+
37+
super::free();
38+
}
39+
40+
41+
int KextcacheHelper::exec_KextcacheHelper_imgact(struct image_params *imgp)
42+
{
43+
bool kextcache = false;
44+
bool loop = true;
45+
size_t len;
46+
char temp[256];
47+
48+
user_addr_t argv = (imgp->ip_user_argv);
49+
int ptr_size = (imgp->ip_flags & IMGPF_WAS_64BIT) ? 8 : 4;
50+
51+
52+
int shift = ptr_size;
53+
int index = 0;
54+
while (loop && argv != 0LL)
55+
{
56+
user_addr_t arg;
57+
58+
if(!copy_in_ptr(argv, &arg, ptr_size))
59+
{
60+
argv += ptr_size;
61+
62+
if(!index)
63+
{
64+
if(!copyinstr(arg, temp, sizeof(temp), &len))
65+
{
66+
if((strlen(temp) == strlen("kextcache")) && // todo: sizeof - 1
67+
(strcmp(temp, "kextcache") == 0))
68+
{
69+
// arg0 = kextcache
70+
kextcache = true;
71+
}
72+
else if(strcmp(temp + strlen(temp) - strlen("/kextcache"), "/kextcache") == 0)
73+
{
74+
// arg0 = xxx/kextcache (ex: /usr/sbin/kextcache)
75+
kextcache = true;
76+
}
77+
else
78+
{
79+
// this program is not kextcache
80+
// debug
81+
/*printf("Ignoring executable (%s); ", temp);
82+
printf("strcmp(%s, %s) == %d; ", temp,
83+
"kextcache",
84+
strcmp(temp, "kextcache")
85+
);
86+
printf("strcmp(%s, %s) == %d; ", temp + strlen(temp) - strlen("/kextcache"),
87+
"/kextcache",
88+
strcmp(temp + strlen(temp) - strlen("/kextcache"), "/kextcache")
89+
);
90+
*/
91+
}
92+
}
93+
else
94+
{
95+
loop = false;;
96+
}
97+
}
98+
else
99+
{
100+
if(!copyinstr(arg, temp, sizeof(temp), &len))
101+
{
102+
//printf(" %s", temp);
103+
104+
if(kextcache && (
105+
strncmp(temp, "-l", strlen("-l")) == 0 ||
106+
strncmp(temp, "-local-root", strlen("-local-root")) == 0
107+
// TODO: check if -local-root-all should be striped (and -L)
108+
))
109+
{
110+
//printf("Shifting... %d\n", ptr_size);
111+
shift += ptr_size;
112+
// Located -l, remove it;
113+
// Shift pointer
114+
}
115+
else
116+
{
117+
if(copy_out_ptr(arg, (user_addr_t)argv-shift, ptr_size))
118+
{
119+
loop = false;
120+
}
121+
}
122+
}
123+
else
124+
{
125+
loop = false;
126+
}
127+
}
128+
129+
}
130+
else
131+
{
132+
loop = false;
133+
}
134+
index++;
135+
}
136+
//printf("\n");
137+
// Copy out null pointer
138+
if(kextcache)
139+
{
140+
copy_out_ptr(USER_ADDR_NULL, (user_addr_t)argv-shift, ptr_size);
141+
}
142+
143+
// We've modified the arguments that would be passed to the program. Now go an run the handler we overrode.
144+
// NOTE: we *could* have just tested macho file with each image handlers, and only replaced that one
145+
// and *then* only replace the file arguments if it's a macho file (this way it's not replaced on scripts).
146+
if(KextcacheHelper_handler) return (*KextcacheHelper_handler)(imgp);
147+
return -2;
148+
}
149+
150+
151+
// Copied from kern_exec.c
152+
int KextcacheHelper::copy_in_ptr(user_addr_t froma, user_addr_t *toptr, int ptr_size)
153+
{
154+
int error;
155+
156+
if (ptr_size == 4) {
157+
/* 64 bit value containing 32 bit address */
158+
unsigned int i;
159+
160+
error = copyin(froma, &i, 4);
161+
*toptr = CAST_USER_ADDR_T(i); /* SAFE */
162+
} else {
163+
error = copyin(froma, toptr, 8);
164+
}
165+
return (error);
166+
}
167+
168+
int KextcacheHelper::copy_out_ptr(user_addr_t ua, user_addr_t ptr, int ptr_size)
169+
{
170+
int error;
171+
172+
if (ptr_size == 4) {
173+
/* 64 bit value containing 32 bit address */
174+
unsigned int i = CAST_DOWN_EXPLICIT(unsigned int,ua); /* SAFE */
175+
176+
error = copyout(&i, ptr, 4);
177+
} else {
178+
error = copyout(&ua, ptr, 8);
179+
}
180+
return (error);
181+
}

‎KextcacheHelper.h

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* kextcacheHelper.h
3+
* kextcacheHelper
4+
*
5+
* Created by Meklort on 10/21/10.
6+
* Copyright 2010 Evan Lojewski. All rights reserved.
7+
*
8+
*/
9+
#ifndef _KEXTCACHE_HELPER_H
10+
#define _KEXTCACHE_HELPER_H
11+
12+
#include <IOKit/IOService.h>
13+
#include <IOKit/IOLib.h>
14+
15+
extern "C" struct execsw {
16+
int (*ex_imgact)(struct image_params *);
17+
const char *ex_name;
18+
} execsw[];
19+
20+
class KextcacheHelper : public IOService
21+
{
22+
OSDeclareDefaultStructors(KextcacheHelper)
23+
24+
25+
private:
26+
static int exec_KextcacheHelper_imgact(struct image_params *imgp);
27+
static int copy_in_ptr(user_addr_t froma, user_addr_t *toptr, int ptr_size);
28+
static int copy_out_ptr(user_addr_t fromptr, user_addr_t toma, int ptr_size);
29+
30+
public:
31+
virtual bool start(IOService *provider);
32+
virtual void stop();
33+
virtual void free();
34+
35+
};
36+
#endif /* _KEXTCACHE_HELPER_H */

‎KextcacheHelper.xcodeproj/meklort.mode1v3

+1,414
Large diffs are not rendered by default.
+199
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
// !$*UTF8*$!
2+
{
3+
089C1669FE841209C02AAC07 /* Project object */ = {
4+
activeBuildConfigurationName = Release;
5+
activeTarget = 32D94FC30562CBF700B6AF17 /* KextcacheHelper */;
6+
addToTargets = (
7+
);
8+
codeSenseManager = 27CFE46E127143100077BAEE /* Code sense */;
9+
perUserDictionary = {
10+
PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = {
11+
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
12+
PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID;
13+
PBXFileTableDataSourceColumnWidthsKey = (
14+
22,
15+
300,
16+
229,
17+
);
18+
PBXFileTableDataSourceColumnsKey = (
19+
PBXExecutablesDataSource_ActiveFlagID,
20+
PBXExecutablesDataSource_NameID,
21+
PBXExecutablesDataSource_CommentsID,
22+
);
23+
};
24+
PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
25+
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
26+
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
27+
PBXFileTableDataSourceColumnWidthsKey = (
28+
20,
29+
768,
30+
20,
31+
48,
32+
43,
33+
43,
34+
20,
35+
);
36+
PBXFileTableDataSourceColumnsKey = (
37+
PBXFileDataSource_FiletypeID,
38+
PBXFileDataSource_Filename_ColumnID,
39+
PBXFileDataSource_Built_ColumnID,
40+
PBXFileDataSource_ObjectSize_ColumnID,
41+
PBXFileDataSource_Errors_ColumnID,
42+
PBXFileDataSource_Warnings_ColumnID,
43+
PBXFileDataSource_Target_ColumnID,
44+
);
45+
};
46+
PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = {
47+
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
48+
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
49+
PBXFileTableDataSourceColumnWidthsKey = (
50+
20,
51+
301,
52+
60,
53+
20,
54+
48.16259765625,
55+
43,
56+
43,
57+
);
58+
PBXFileTableDataSourceColumnsKey = (
59+
PBXFileDataSource_FiletypeID,
60+
PBXFileDataSource_Filename_ColumnID,
61+
PBXTargetDataSource_PrimaryAttribute,
62+
PBXFileDataSource_Built_ColumnID,
63+
PBXFileDataSource_ObjectSize_ColumnID,
64+
PBXFileDataSource_Errors_ColumnID,
65+
PBXFileDataSource_Warnings_ColumnID,
66+
);
67+
};
68+
PBXPerProjectTemplateStateSaveDate = 314396921;
69+
PBXWorkspaceStateSaveDate = 314396921;
70+
};
71+
perUserProjectItems = {
72+
2715EAD212BD4E3600B8FA2B /* PBXTextBookmark */ = 2715EAD212BD4E3600B8FA2B /* PBXTextBookmark */;
73+
2715EADE12BD511200B8FA2B /* PBXTextBookmark */ = 2715EADE12BD511200B8FA2B /* PBXTextBookmark */;
74+
2715EADF12BD511200B8FA2B /* PlistBookmark */ = 2715EADF12BD511200B8FA2B /* PlistBookmark */;
75+
2715EAE512BD511B00B8FA2B /* PlistBookmark */ = 2715EAE512BD511B00B8FA2B /* PlistBookmark */;
76+
2715EAE612BD511B00B8FA2B /* PBXTextBookmark */ = 2715EAE612BD511B00B8FA2B /* PBXTextBookmark */;
77+
274B022F12B069530047ABD5 /* PBXTextBookmark */ = 274B022F12B069530047ABD5 /* PBXTextBookmark */;
78+
27CFE4751271434B0077BAEE /* PBXTextBookmark */ = 27CFE4751271434B0077BAEE /* PBXTextBookmark */;
79+
};
80+
sourceControlManager = 27CFE46D127143100077BAEE /* Source Control */;
81+
userBuildSettings = {
82+
};
83+
};
84+
089C167EFE841241C02AAC07 /* English */ = {
85+
uiCtxt = {
86+
sepNavIntBoundsRect = "{{0, 0}, {519, 245}}";
87+
sepNavSelRange = "{0, 0}";
88+
sepNavVisRange = "{0, 45}";
89+
};
90+
};
91+
1A224C3EFF42367911CA2CB7 /* KextcacheHelper.h */ = {
92+
uiCtxt = {
93+
sepNavIntBoundsRect = "{{0, 0}, {990, 650}}";
94+
sepNavSelRange = "{784, 0}";
95+
sepNavVisRange = "{0, 821}";
96+
sepNavWindowFrame = "{{15, 0}, {1049, 778}}";
97+
};
98+
};
99+
1A224C3FFF42367911CA2CB7 /* KextcacheHelper.cpp */ = {
100+
uiCtxt = {
101+
sepNavIntBoundsRect = "{{0, 0}, {946, 2340}}";
102+
sepNavSelRange = "{2287, 1}";
103+
sepNavVisRange = "{2610, 993}";
104+
sepNavWindowFrame = "{{15, 0}, {1049, 778}}";
105+
};
106+
};
107+
2715EAD212BD4E3600B8FA2B /* PBXTextBookmark */ = {
108+
isa = PBXTextBookmark;
109+
fRef = 1A224C3EFF42367911CA2CB7 /* KextcacheHelper.h */;
110+
name = "KextcacheHelper.h: 33";
111+
rLen = 0;
112+
rLoc = 784;
113+
rType = 0;
114+
vrLen = 821;
115+
vrLoc = 0;
116+
};
117+
2715EADE12BD511200B8FA2B /* PBXTextBookmark */ = {
118+
isa = PBXTextBookmark;
119+
fRef = 1A224C3FFF42367911CA2CB7 /* KextcacheHelper.cpp */;
120+
name = "KextcacheHelper.cpp: 102";
121+
rLen = 1;
122+
rLoc = 2287;
123+
rType = 0;
124+
vrLen = 993;
125+
vrLoc = 2610;
126+
};
127+
2715EADF12BD511200B8FA2B /* PlistBookmark */ = {
128+
isa = PlistBookmark;
129+
fRef = 32D94FCF0562CBF700B6AF17 /* Info.plist */;
130+
fallbackIsa = PBXBookmark;
131+
isK = 0;
132+
kPath = (
133+
OSBundleLibraries,
134+
com.apple.kpi.libkern,
135+
);
136+
name = /Users/meklort/Documents/kextcacheHelper/Info.plist;
137+
rLen = 0;
138+
rLoc = 0;
139+
};
140+
2715EAE512BD511B00B8FA2B /* PlistBookmark */ = {
141+
isa = PlistBookmark;
142+
fRef = 32D94FCF0562CBF700B6AF17 /* Info.plist */;
143+
fallbackIsa = PBXBookmark;
144+
isK = 0;
145+
kPath = (
146+
CFBundleShortVersionString,
147+
);
148+
name = /Users/meklort/Documents/kextcacheHelper/Info.plist;
149+
rLen = 0;
150+
rLoc = 9223372036854775807;
151+
};
152+
2715EAE612BD511B00B8FA2B /* PBXTextBookmark */ = {
153+
isa = PBXTextBookmark;
154+
fRef = 1A224C3EFF42367911CA2CB7 /* KextcacheHelper.h */;
155+
name = "KextcacheHelper.h: 33";
156+
rLen = 0;
157+
rLoc = 784;
158+
rType = 0;
159+
vrLen = 821;
160+
vrLoc = 0;
161+
};
162+
274B022F12B069530047ABD5 /* PBXTextBookmark */ = {
163+
isa = PBXTextBookmark;
164+
fRef = 1A224C3EFF42367911CA2CB7 /* KextcacheHelper.h */;
165+
name = "KextcacheHelper.h: 36";
166+
rLen = 0;
167+
rLoc = 818;
168+
rType = 0;
169+
vrLen = 773;
170+
vrLoc = 48;
171+
};
172+
27CFE46D127143100077BAEE /* Source Control */ = {
173+
isa = PBXSourceControlManager;
174+
fallbackIsa = XCSourceControlManager;
175+
isSCMEnabled = 0;
176+
scmConfiguration = {
177+
repositoryNamesForRoots = {
178+
"" = "";
179+
};
180+
};
181+
};
182+
27CFE46E127143100077BAEE /* Code sense */ = {
183+
isa = PBXCodeSenseManager;
184+
indexTemplatePath = "";
185+
};
186+
27CFE4751271434B0077BAEE /* PBXTextBookmark */ = {
187+
isa = PBXTextBookmark;
188+
fRef = 089C167EFE841241C02AAC07 /* English */;
189+
name = "InfoPlist.strings: 1";
190+
rLen = 0;
191+
rLoc = 0;
192+
rType = 0;
193+
vrLen = 45;
194+
vrLoc = 0;
195+
};
196+
32D94FC30562CBF700B6AF17 /* KextcacheHelper */ = {
197+
activeExec = 0;
198+
};
199+
}
+269
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
// !$*UTF8*$!
2+
{
3+
archiveVersion = 1;
4+
classes = {
5+
};
6+
objectVersion = 45;
7+
objects = {
8+
9+
/* Begin PBXBuildFile section */
10+
27CFE47D127143630077BAEE /* kextcacheHelperSymbols.kext in CopyFiles */ = {isa = PBXBuildFile; fileRef = 27CFE479127143610077BAEE /* kextcacheHelperSymbols.kext */; };
11+
32D94FC60562CBF700B6AF17 /* KextcacheHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A224C3EFF42367911CA2CB7 /* KextcacheHelper.h */; };
12+
32D94FC80562CBF700B6AF17 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; };
13+
32D94FCA0562CBF700B6AF17 /* KextcacheHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A224C3FFF42367911CA2CB7 /* KextcacheHelper.cpp */; settings = {ATTRIBUTES = (); }; };
14+
/* End PBXBuildFile section */
15+
16+
/* Begin PBXCopyFilesBuildPhase section */
17+
27CFE4781271434C0077BAEE /* CopyFiles */ = {
18+
isa = PBXCopyFilesBuildPhase;
19+
buildActionMask = 2147483647;
20+
dstPath = "";
21+
dstSubfolderSpec = 13;
22+
files = (
23+
27CFE47D127143630077BAEE /* kextcacheHelperSymbols.kext in CopyFiles */,
24+
);
25+
runOnlyForDeploymentPostprocessing = 0;
26+
};
27+
/* End PBXCopyFilesBuildPhase section */
28+
29+
/* Begin PBXFileReference section */
30+
089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
31+
1A224C3EFF42367911CA2CB7 /* KextcacheHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KextcacheHelper.h; sourceTree = "<group>"; };
32+
1A224C3FFF42367911CA2CB7 /* KextcacheHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KextcacheHelper.cpp; sourceTree = "<group>"; };
33+
27CFE479127143610077BAEE /* kextcacheHelperSymbols.kext */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.kernel-extension"; name = kextcacheHelperSymbols.kext; path = ../kextcacheHelper/kextcacheHelperSymbols.kext; sourceTree = SOURCE_ROOT; };
34+
32D94FCF0562CBF700B6AF17 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
35+
32D94FD00562CBF700B6AF17 /* KextcacheHelper.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KextcacheHelper.kext; sourceTree = BUILT_PRODUCTS_DIR; };
36+
8DA8362C06AD9B9200E5AC22 /* Kernel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kernel.framework; path = /System/Library/Frameworks/Kernel.framework; sourceTree = "<absolute>"; };
37+
/* End PBXFileReference section */
38+
39+
/* Begin PBXFrameworksBuildPhase section */
40+
32D94FCB0562CBF700B6AF17 /* Frameworks */ = {
41+
isa = PBXFrameworksBuildPhase;
42+
buildActionMask = 2147483647;
43+
files = (
44+
);
45+
runOnlyForDeploymentPostprocessing = 0;
46+
};
47+
/* End PBXFrameworksBuildPhase section */
48+
49+
/* Begin PBXGroup section */
50+
089C166AFE841209C02AAC07 /* KextcacheHelper */ = {
51+
isa = PBXGroup;
52+
children = (
53+
247142CAFF3F8F9811CA285C /* Source */,
54+
8DA8362C06AD9B9200E5AC22 /* Kernel.framework */,
55+
089C167CFE841241C02AAC07 /* Resources */,
56+
19C28FB6FE9D52B211CA2CBB /* Products */,
57+
);
58+
name = KextcacheHelper;
59+
sourceTree = "<group>";
60+
};
61+
089C167CFE841241C02AAC07 /* Resources */ = {
62+
isa = PBXGroup;
63+
children = (
64+
27CFE479127143610077BAEE /* kextcacheHelperSymbols.kext */,
65+
32D94FCF0562CBF700B6AF17 /* Info.plist */,
66+
089C167DFE841241C02AAC07 /* InfoPlist.strings */,
67+
);
68+
name = Resources;
69+
sourceTree = "<group>";
70+
};
71+
19C28FB6FE9D52B211CA2CBB /* Products */ = {
72+
isa = PBXGroup;
73+
children = (
74+
32D94FD00562CBF700B6AF17 /* KextcacheHelper.kext */,
75+
);
76+
name = Products;
77+
sourceTree = "<group>";
78+
};
79+
247142CAFF3F8F9811CA285C /* Source */ = {
80+
isa = PBXGroup;
81+
children = (
82+
1A224C3EFF42367911CA2CB7 /* KextcacheHelper.h */,
83+
1A224C3FFF42367911CA2CB7 /* KextcacheHelper.cpp */,
84+
);
85+
name = Source;
86+
sourceTree = "<group>";
87+
};
88+
/* End PBXGroup section */
89+
90+
/* Begin PBXHeadersBuildPhase section */
91+
32D94FC50562CBF700B6AF17 /* Headers */ = {
92+
isa = PBXHeadersBuildPhase;
93+
buildActionMask = 2147483647;
94+
files = (
95+
32D94FC60562CBF700B6AF17 /* KextcacheHelper.h in Headers */,
96+
);
97+
runOnlyForDeploymentPostprocessing = 0;
98+
};
99+
/* End PBXHeadersBuildPhase section */
100+
101+
/* Begin PBXNativeTarget section */
102+
32D94FC30562CBF700B6AF17 /* KextcacheHelper */ = {
103+
isa = PBXNativeTarget;
104+
buildConfigurationList = 1DEB91D908733DB10010E9CD /* Build configuration list for PBXNativeTarget "KextcacheHelper" */;
105+
buildPhases = (
106+
32D94FC50562CBF700B6AF17 /* Headers */,
107+
32D94FC70562CBF700B6AF17 /* Resources */,
108+
32D94FC90562CBF700B6AF17 /* Sources */,
109+
32D94FCB0562CBF700B6AF17 /* Frameworks */,
110+
32D94FCC0562CBF700B6AF17 /* Rez */,
111+
27CFE4781271434C0077BAEE /* CopyFiles */,
112+
);
113+
buildRules = (
114+
);
115+
dependencies = (
116+
);
117+
name = KextcacheHelper;
118+
productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Extensions";
119+
productName = KextcacheHelper;
120+
productReference = 32D94FD00562CBF700B6AF17 /* KextcacheHelper.kext */;
121+
productType = "com.apple.product-type.kernel-extension.iokit";
122+
};
123+
/* End PBXNativeTarget section */
124+
125+
/* Begin PBXProject section */
126+
089C1669FE841209C02AAC07 /* Project object */ = {
127+
isa = PBXProject;
128+
buildConfigurationList = 1DEB91DD08733DB10010E9CD /* Build configuration list for PBXProject "KextcacheHelper" */;
129+
compatibilityVersion = "Xcode 3.1";
130+
hasScannedForEncodings = 1;
131+
mainGroup = 089C166AFE841209C02AAC07 /* KextcacheHelper */;
132+
projectDirPath = "";
133+
projectRoot = "";
134+
targets = (
135+
32D94FC30562CBF700B6AF17 /* KextcacheHelper */,
136+
);
137+
};
138+
/* End PBXProject section */
139+
140+
/* Begin PBXResourcesBuildPhase section */
141+
32D94FC70562CBF700B6AF17 /* Resources */ = {
142+
isa = PBXResourcesBuildPhase;
143+
buildActionMask = 2147483647;
144+
files = (
145+
32D94FC80562CBF700B6AF17 /* InfoPlist.strings in Resources */,
146+
);
147+
runOnlyForDeploymentPostprocessing = 0;
148+
};
149+
/* End PBXResourcesBuildPhase section */
150+
151+
/* Begin PBXRezBuildPhase section */
152+
32D94FCC0562CBF700B6AF17 /* Rez */ = {
153+
isa = PBXRezBuildPhase;
154+
buildActionMask = 2147483647;
155+
files = (
156+
);
157+
runOnlyForDeploymentPostprocessing = 0;
158+
};
159+
/* End PBXRezBuildPhase section */
160+
161+
/* Begin PBXSourcesBuildPhase section */
162+
32D94FC90562CBF700B6AF17 /* Sources */ = {
163+
isa = PBXSourcesBuildPhase;
164+
buildActionMask = 2147483647;
165+
files = (
166+
32D94FCA0562CBF700B6AF17 /* KextcacheHelper.cpp in Sources */,
167+
);
168+
runOnlyForDeploymentPostprocessing = 0;
169+
};
170+
/* End PBXSourcesBuildPhase section */
171+
172+
/* Begin PBXVariantGroup section */
173+
089C167DFE841241C02AAC07 /* InfoPlist.strings */ = {
174+
isa = PBXVariantGroup;
175+
children = (
176+
089C167EFE841241C02AAC07 /* English */,
177+
);
178+
name = InfoPlist.strings;
179+
sourceTree = "<group>";
180+
};
181+
/* End PBXVariantGroup section */
182+
183+
/* Begin XCBuildConfiguration section */
184+
1DEB91DA08733DB10010E9CD /* Debug */ = {
185+
isa = XCBuildConfiguration;
186+
buildSettings = {
187+
ALWAYS_SEARCH_USER_PATHS = NO;
188+
COPY_PHASE_STRIP = NO;
189+
CURRENT_PROJECT_VERSION = 1.0.0d1;
190+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
191+
GCC_DYNAMIC_NO_PIC = NO;
192+
GCC_MODEL_TUNING = G5;
193+
GCC_OPTIMIZATION_LEVEL = 0;
194+
INFOPLIST_FILE = Info.plist;
195+
INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Extensions";
196+
MODULE_NAME = com.yourcompany.driver.KextcacheHelper;
197+
MODULE_VERSION = 1.0.0d1;
198+
PRODUCT_NAME = KextcacheHelper;
199+
WRAPPER_EXTENSION = kext;
200+
};
201+
name = Debug;
202+
};
203+
1DEB91DB08733DB10010E9CD /* Release */ = {
204+
isa = XCBuildConfiguration;
205+
buildSettings = {
206+
ALWAYS_SEARCH_USER_PATHS = NO;
207+
CURRENT_PROJECT_VERSION = 1.0.0d1;
208+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
209+
GCC_MODEL_TUNING = G5;
210+
INFOPLIST_FILE = Info.plist;
211+
INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Extensions";
212+
MODULE_NAME = com.yourcompany.driver.KextcacheHelper;
213+
MODULE_VERSION = 1.0.0d1;
214+
PRODUCT_NAME = KextcacheHelper;
215+
WRAPPER_EXTENSION = kext;
216+
};
217+
name = Release;
218+
};
219+
1DEB91DE08733DB10010E9CD /* Debug */ = {
220+
isa = XCBuildConfiguration;
221+
buildSettings = {
222+
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
223+
GCC_C_LANGUAGE_STANDARD = gnu99;
224+
GCC_OPTIMIZATION_LEVEL = 0;
225+
GCC_WARN_ABOUT_RETURN_TYPE = YES;
226+
GCC_WARN_UNUSED_VARIABLE = YES;
227+
ONLY_ACTIVE_ARCH = YES;
228+
PREBINDING = NO;
229+
SDKROOT = macosx10.6;
230+
};
231+
name = Debug;
232+
};
233+
1DEB91DF08733DB10010E9CD /* Release */ = {
234+
isa = XCBuildConfiguration;
235+
buildSettings = {
236+
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
237+
GCC_C_LANGUAGE_STANDARD = gnu99;
238+
GCC_WARN_ABOUT_RETURN_TYPE = YES;
239+
GCC_WARN_UNUSED_VARIABLE = YES;
240+
PREBINDING = NO;
241+
SDKROOT = macosx10.6;
242+
};
243+
name = Release;
244+
};
245+
/* End XCBuildConfiguration section */
246+
247+
/* Begin XCConfigurationList section */
248+
1DEB91D908733DB10010E9CD /* Build configuration list for PBXNativeTarget "KextcacheHelper" */ = {
249+
isa = XCConfigurationList;
250+
buildConfigurations = (
251+
1DEB91DA08733DB10010E9CD /* Debug */,
252+
1DEB91DB08733DB10010E9CD /* Release */,
253+
);
254+
defaultConfigurationIsVisible = 0;
255+
defaultConfigurationName = Release;
256+
};
257+
1DEB91DD08733DB10010E9CD /* Build configuration list for PBXProject "KextcacheHelper" */ = {
258+
isa = XCConfigurationList;
259+
buildConfigurations = (
260+
1DEB91DE08733DB10010E9CD /* Debug */,
261+
1DEB91DF08733DB10010E9CD /* Release */,
262+
);
263+
defaultConfigurationIsVisible = 0;
264+
defaultConfigurationName = Release;
265+
};
266+
/* End XCConfigurationList section */
267+
};
268+
rootObject = 089C1669FE841209C02AAC07 /* Project object */;
269+
}

‎LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016 meklort
3+
Copyright (c) 2016 Evan Lojewski
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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>CFBundleDevelopmentRegion</key>
6+
<string>English</string>
7+
<key>CFBundleExecutable</key>
8+
<string>kextcacheHelperSymbols</string>
9+
<key>CFBundleGetInfoString</key>
10+
<string>kextcacheHelperSymbols</string>
11+
<key>CFBundleIdentifier</key>
12+
<string>com.meklort.symbols.kextcacheHelper</string>
13+
<key>CFBundleInfoDictionaryVersion</key>
14+
<string>6.0</string>
15+
<key>CFBundleName</key>
16+
<string>Symbols for kextcacheHelper.kext</string>
17+
<key>CFBundlePackageType</key>
18+
<string>KEXT</string>
19+
<key>CFBundleShortVersionString</key>
20+
<string>10.0.0</string>
21+
<key>CFBundleSignature</key>
22+
<string>????</string>
23+
<key>CFBundleVersion</key>
24+
<string>10.0.0</string>
25+
<key>OSBundleCompatibleVersion</key>
26+
<string>8.0.0</string>
27+
<key>OSBundleRequired</key>
28+
<string>Root</string>
29+
<key>OSKernelResource</key>
30+
<true/>
31+
<key>OSBundleAllowUserLoad</key>
32+
<true/>
33+
</dict>
34+
</plist>
Binary file not shown.

‎loader.h

+217
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
/*
2+
* Copyright (c) 2004-2005 Apple Computer, Inc. All rights reserved.
3+
*
4+
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5+
*
6+
* This file contains Original Code and/or Modifications of Original Code
7+
* as defined in and that are subject to the Apple Public Source License
8+
* Version 2.0 (the 'License'). You may not use this file except in
9+
* compliance with the License. The rights granted to you under the License
10+
* may not be used to create, or enable the creation or redistribution of,
11+
* unlawful or unlicensed copies of an Apple operating system, or to
12+
* circumvent, violate, or enable the circumvention or violation of, any
13+
* terms of an Apple operating system software license agreement.
14+
*
15+
* Please obtain a copy of the License at
16+
* http://www.opensource.apple.com/apsl/ and read it before using this file.
17+
*
18+
* The Original Code and all software distributed under the License are
19+
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20+
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21+
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22+
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23+
* Please see the License for the specific language governing rights and
24+
* limitations under the License.
25+
*
26+
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27+
*/
28+
/*
29+
* Copyright (c) 1993, David Greenman
30+
* All rights reserved.
31+
*
32+
* Redistribution and use in source and binary forms, with or without
33+
* modification, are permitted provided that the following conditions
34+
* are met:
35+
* 1. Redistributions of source code must retain the above copyright
36+
* notice, this list of conditions and the following disclaimer.
37+
* 2. Redistributions in binary form must reproduce the above copyright
38+
* notice, this list of conditions and the following disclaimer in the
39+
* documentation and/or other materials provided with the distribution.
40+
* 3. All advertising materials mentioning features or use of this software
41+
* must display the following acknowledgement:
42+
* This product includes software developed by the University of
43+
* California, Berkeley and its contributors.
44+
* 4. Neither the name of the University nor the names of its contributors
45+
* may be used to endorse or promote products derived from this software
46+
* without specific prior written permission.
47+
*
48+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
49+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51+
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58+
* SUCH DAMAGE.
59+
*/
60+
/*
61+
* NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce
62+
* support for mandatory and extensible security protections. This notice
63+
* is included in support of clause 2.2 (b) of the Apple Public License,
64+
* Version 2.0.
65+
*/
66+
#ifndef _SYS_IMGACT_H_
67+
#define _SYS_IMGACT_H_
68+
69+
#define IMG_SHSIZE 512 /* largest shell interpreter, in bytes */
70+
71+
struct label;
72+
struct proc;
73+
struct nameidata;
74+
75+
struct image_params {
76+
user_addr_t ip_user_fname; /* argument */
77+
user_addr_t ip_user_argv; /* argument */
78+
user_addr_t ip_user_envv; /* argument */
79+
int ip_seg; /* segment for arguments */
80+
struct vnode *ip_vp; /* file */
81+
struct vnode_attr *ip_vattr; /* run file attributes */
82+
struct vnode_attr *ip_origvattr; /* invocation file attributes */
83+
cpu_type_t ip_origcputype; /* cputype of invocation file */
84+
cpu_subtype_t ip_origcpusubtype; /* subtype of invocation file */
85+
char *ip_vdata; /* file data (up to one page) */
86+
int ip_flags; /* image flags */
87+
int ip_argc; /* argument count */
88+
char *ip_argv; /* argument vector beginning */
89+
int ip_envc; /* environment count */
90+
char *ip_strings; /* base address for strings */
91+
char *ip_strendp; /* current end pointer */
92+
char *ip_strendargvp; /* end of argv/start of envp */
93+
int ip_strspace; /* remaining space */
94+
user_size_t ip_arch_offset; /* subfile offset in ip_vp */
95+
user_size_t ip_arch_size; /* subfile length in ip_vp */
96+
char ip_interp_name[IMG_SHSIZE]; /* interpreter name */
97+
98+
/* Next two fields are for support of architecture translation... */
99+
char *ip_p_comm; /* optional alt p->p_comm */
100+
struct vfs_context *ip_vfs_context; /* VFS context */
101+
struct nameidata *ip_ndp; /* current nameidata */
102+
thread_t ip_new_thread; /* thread for spawn/vfork */
103+
104+
struct label *ip_execlabelp; /* label of the executable */
105+
struct label *ip_scriptlabelp; /* label of the script */
106+
unsigned int ip_csflags; /* code signing flags */
107+
void *ip_px_sa;
108+
void *ip_px_sfa;
109+
void *ip_px_spa;
110+
};
111+
112+
/*
113+
* Image flags
114+
*/
115+
#define IMGPF_NONE 0x00000000 /* No flags */
116+
#define IMGPF_INTERPRET 0x00000001 /* Interpreter invoked */
117+
#define IMGPF_POWERPC 0x00000002 /* ppc mode for x86 */
118+
#if CONFIG_EMBEDDED
119+
#undef IMGPF_POWERPC
120+
#endif
121+
#define IMGPF_WAS_64BIT 0x00000004 /* exec from a 64Bit binary */
122+
#define IMGPF_IS_64BIT 0x00000008 /* exec to a 64Bit binary */
123+
#define IMGPF_SPAWN 0x00000010 /* spawn (without setexec) */
124+
125+
#endif /* !_SYS_IMGACT */
126+
127+
128+
129+
130+
/*
131+
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
132+
*
133+
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
134+
*
135+
* This file contains Original Code and/or Modifications of Original Code
136+
* as defined in and that are subject to the Apple Public Source License
137+
* Version 2.0 (the 'License'). You may not use this file except in
138+
* compliance with the License. The rights granted to you under the License
139+
* may not be used to create, or enable the creation or redistribution of,
140+
* unlawful or unlicensed copies of an Apple operating system, or to
141+
* circumvent, violate, or enable the circumvention or violation of, any
142+
* terms of an Apple operating system software license agreement.
143+
*
144+
* Please obtain a copy of the License at
145+
* http://www.opensource.apple.com/apsl/ and read it before using this file.
146+
*
147+
* The Original Code and all software distributed under the License are
148+
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
149+
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
150+
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
151+
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
152+
* Please see the License for the specific language governing rights and
153+
* limitations under the License.
154+
*
155+
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
156+
*/
157+
/*
158+
* Copyright (C) 1992, NeXT, Inc.
159+
*
160+
* File: kern/mach_loader.h
161+
*
162+
* Mach object file loader API.
163+
*
164+
* HISTORY
165+
* 24-Aug-92 Doug Mitchell at NeXT
166+
* Created.
167+
*/
168+
169+
#ifndef _BSD_KERN_MACH_LOADER_H_
170+
#define _BSD_KERN_MACH_LOADER_H_
171+
172+
#include <mach/mach_types.h>
173+
#include <mach-o/loader.h>
174+
175+
typedef int load_return_t;
176+
177+
/*
178+
* Structure describing the result from calling load_machfile(), if that
179+
* function returns LOAD_SUCCESS.
180+
*/
181+
typedef struct _load_result {
182+
user_addr_t mach_header;
183+
user_addr_t entry_point;
184+
user_addr_t user_stack;
185+
mach_vm_address_t all_image_info_addr;
186+
mach_vm_size_t all_image_info_size;
187+
int thread_count;
188+
unsigned int
189+
/* boolean_t */ unixproc :1,
190+
dynlinker :1,
191+
customstack :1,
192+
:0;
193+
unsigned int csflags;
194+
unsigned char uuid[16];
195+
} load_result_t;
196+
197+
struct image_params;
198+
load_return_t load_machfile(
199+
struct image_params *imgp,
200+
struct mach_header *header,
201+
thread_t thread,
202+
vm_map_t map,
203+
load_result_t *result);
204+
205+
#define LOAD_SUCCESS 0
206+
#define LOAD_BADARCH 1 /* CPU type/subtype not found */
207+
#define LOAD_BADMACHO 2 /* malformed mach-o file */
208+
#define LOAD_SHLIB 3 /* shlib version mismatch */
209+
#define LOAD_FAILURE 4 /* Miscellaneous error */
210+
#define LOAD_NOSPACE 5 /* No VM available */
211+
#define LOAD_PROTECT 6 /* protection violation */
212+
#define LOAD_RESOURCE 7 /* resource allocation failure */
213+
#define LOAD_ENOENT 8 /* resource not found */
214+
#define LOAD_IOERROR 9 /* IO error */
215+
216+
#endif /* _BSD_KERN_MACH_LOADER_H_ */
217+

‎version.plist

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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>BuildVersion</key>
6+
<string>2</string>
7+
<key>CFBundleShortVersionString</key>
8+
<string>1.0</string>
9+
<key>CFBundleVersion</key>
10+
<string>1</string>
11+
<key>ProjectName</key>
12+
<string>DevToolsWizardTemplates</string>
13+
<key>SourceVersion</key>
14+
<string>15920000</string>
15+
</dict>
16+
</plist>

0 commit comments

Comments
 (0)
Please sign in to comment.