Chameleon

Chameleon Svn Source Tree

Root/branches/meklort/i386/modules/KextPatcher/kext_patcher.c

Source at commit 458 created 13 years 7 months ago.
By meklort, Modified make file. Created initial module for patching kexts + associated hooks that may be needed. Subject to change and may be removed if deemed unusable / impractical. Untested.
1/*
2 * Copyright (c) 2010 Evan Lojewski. All rights reserved.
3 *
4 *KextPather
5 *This is an experimental module that I'm looking into implimenting.
6 *The main purpose is to replace the need for programs such as
7 * NetbookInstaller's kext patching routines. THis way, Apple's kexts can be
8 * patched whe loaded instead. (eg: GMA950 kext, Bluetooth + Wifi kexts)
9 */
10
11#include "libsaio.h"
12#include "kext_patcher.h"
13//#include "platform.h"
14#include "modules.h"
15
16//extern PlatformInfo_t Platform;
17
18/**
19 ** KextPatcher_start -> module start
20 **Notified the module system that this module will hook into the
21 **LoadMatchedModules and LoadDriverMKext functions
22 **/
23void KextPatcher_start()
24{
25// Hooks into the following:
26//execute_hook("LoadDriverMKext", (void*)package, (void*) length, NULL, NULL);
27// execute_hook("LoadMatchedModules", module, &length, executableAddr, NULL);
28
29register_hook_callback("LoadMatchedModules", &kext_loaded);
30register_hook_callback("LoadDriverMKext", &mkext_loaded);
31
32}
33
34/**
35 ** kext_loaded -> Called whenever a kext is in read into memory
36 **This function will be used to patch kexts ( eg AppleInteIntegratedFramebuffer)
37 **and their plists when they are loaded into memmory
38 **/
39void kext_loaded(void* module, void* length, void* executableAddr, void* arg3)
40{
41}
42
43/**
44 ** mkext_loaded -> Called whenever an mkext is in read into memory
45 **This function will be used to patch mkext. Matching kexts will be
46 **Extracted, modified, and then compressed again. Note: I need to determine
47 **what sort of slowdown this will cause and if it's worth implimenting.
48 **/
49
50void mkext_loaded(void* filespec, void* package, void* lenght, void* arg3)
51{
52}

Archive Download this file

Revision: 458