| 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 |
#ifndef HIVE_H |
| 28 |
#define HIVE_H |
| 29 |
|
| 30 |
#include <stdio.h> |
| 31 |
#include <stdlib.h> |
| 32 |
#include <string.h> |
| 33 |
|
| 34 |
#define min(a, b) (((a) < (b)) ? (a) : (b)) |
| 35 |
|
| 36 |
#define NK_ID 0x6B6E |
| 37 |
#define NK_ROOT 0x2c |
| 38 |
#define LF_ID 0x666C |
| 39 |
|
| 40 |
#ifdef __cplusplus |
| 41 |
extern "C" { |
| 42 |
#endif |
| 43 |
|
| 44 |
struct hive |
| 45 |
{ |
| 46 |
unsigned char *base; |
| 47 |
}; |
| 48 |
|
| 49 |
typedef struct _nk_hdr |
| 50 |
{ |
| 51 |
short int id; |
| 52 |
short int type; |
| 53 |
int t1, t2; |
| 54 |
int unk1; |
| 55 |
int parent_off; |
| 56 |
int subkey_num; |
| 57 |
int unk2; |
| 58 |
int lf_off; |
| 59 |
int unk3; |
| 60 |
int value_cnt; |
| 61 |
int value_off; |
| 62 |
int sk_off; |
| 63 |
int classname_off; |
| 64 |
int unk4[4]; |
| 65 |
int unk5; |
| 66 |
short int name_len; |
| 67 |
short int classname_len; |
| 68 |
unsigned char *key_name; |
| 69 |
} nk_hdr; |
| 70 |
|
| 71 |
typedef struct _hashrecord |
| 72 |
{ |
| 73 |
|
| 74 |
int nk_offset; |
| 75 |
char keyname[4]; |
| 76 |
} hashrecord; |
| 77 |
|
| 78 |
typedef struct _lf_hdr |
| 79 |
{ |
| 80 |
short int id; |
| 81 |
short int key_num; |
| 82 |
unsigned char *hr; |
| 83 |
} lf_hdr; |
| 84 |
|
| 85 |
typedef struct _vk_hdr |
| 86 |
{ |
| 87 |
short int id; |
| 88 |
short int name_len; |
| 89 |
int data_len; |
| 90 |
int data_off; |
| 91 |
int data_type; |
| 92 |
short int flag; |
| 93 |
short int unk1; |
| 94 |
unsigned char *value_name; |
| 95 |
} vk_hdr; |
| 96 |
|
| 97 |
nk_hdr* read_nk(nk_hdr *nk, struct hive *h, int offset ); |
| 98 |
lf_hdr* read_lf(lf_hdr *lf, struct hive *h, int offset ); |
| 99 |
vk_hdr* read_vk(vk_hdr *vk, struct hive *h, int offset ); |
| 100 |
hashrecord* read_hr(hashrecord *hr, unsigned char *pos, int index ); |
| 101 |
int* read_valuelist(int *value, struct hive *h, int offset, int size); |
| 102 |
unsigned char* read_data(struct hive *h, int offset ); |
| 103 |
|
| 104 |
void _RegCloseHive( struct hive *h ); |
| 105 |
|
| 106 |
void _InitHive( struct hive *h ); |
| 107 |
|
| 108 |
int _RegOpenHive( unsigned char *filename, struct hive *h ); |
| 109 |
|
| 110 |
int _RegOpenHiveBuffer( unsigned char *buffer, unsigned long size, struct hive *h ); |
| 111 |
|
| 112 |
long parself( struct hive *h, char *t, unsigned long off ); |
| 113 |
|
| 114 |
int _RegGetRootKey(struct hive *h, char **root_key); |
| 115 |
|
| 116 |
int _RegOpenKey( struct hive *h, char *path, nk_hdr **nr ); |
| 117 |
|
| 118 |
int _RegQueryValue( struct hive *h, char *name, nk_hdr *nr, unsigned char **buff, int *len ); |
| 119 |
|
| 120 |
int _RegEnumKey( struct hive *h, nk_hdr *nr, int index, char *name, int *namelen ); |
| 121 |
|
| 122 |
#ifdef __cplusplus |
| 123 |
} |
| 124 |
#endif |
| 125 |
#endif |