Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Enoch/i386/libsaio/binaryPatcher.h

1//
2// binaryPatcher.h
3//
4// binary patcher of any kinds (kexts, kernel, ACPI tables etc..)
5//
6//
7
8#ifndef binaryPatcher_h
9#define binaryPatcher_h
10
11#include <string.h>
12#include <stdbool.h>
13#include <libkern/OSTypes.h>
14#include "saio_types.h"
15#include "libsaio.h"
16#include "xml.h"
17
18#include "bootargs.h"
19#include "saio_types.h"
20#include "bios.h"
21#include "device_tree.h"
22
23// Micky1979: Next five functions (+ needed struct) are to split a string like "10.10.5,10.7,10.11.6,10.8.x"
24// in their components separated by comma (in this case)
25struct MatchOSes {
26 int count;
27 char* array[100];
28};
29
30/** Returns a boolean and then enable disable the patch if MachOSEntry have a match for the booted OS. */
31bool IsPatchEnabled(char *MatchOSEntry, char *CurrOS);
32
33/** return true if a given os contains '.' as separator,
34 and then match components of the current booted OS. Also allow 10.10.x format meaning all revisions
35 of the 10.10 OS */
36bool IsOSValid(char *MatchOS, char *CurrOS);
37
38/** return MatchOSes struct (count+array) with the components of str that contains the given char sep as separator. */
39struct MatchOSes *GetStrArraySeparatedByChar(char *str, char sep);
40
41/** free MatchOSes struct and its array. */
42void deallocMatchOSes(struct MatchOSes *s);
43
44/** count occurrences of a given char in a char* string. */
45int countOccurrences( char *s, char c );
46
47
48unsigned int FindAndReplace(void *sourceData,
49 UInt32 SourceSize,
50 UInt32 StartLocation,
51 UInt8 *Search,
52 unsigned int SearchSize,
53 UInt8 *Replace,
54 int MaxReplaces);
55
56unsigned int FindAndReplace(void *sourceData,
57 UInt32 SourceSize,
58 UInt32 StartLocation,
59 UInt8 *Search,
60 unsigned int SearchSize,
61 UInt8 *Replace,
62 int MaxReplaces);
63
64/*
65unsigned int FindAndCount(void *sourceData,
66 UInt32 SourceSize,
67 UInt8 *Search,
68 unsigned int SearchSize);
69*/
70void pach_binaryUsingDictionary(void *data,
71 UInt32 dataLen,
72 UInt32 StartLocation,
73 char *reason,
74 TagPtr config);
75
76#endif /* binaryPatcher_h */
77

Archive Download this file

Revision: 2871