| 1 | /* Hive.h |
| 2 | Hive file access, pretty lame and bugged but do the work O_o |
| 3 | Thanks to B.D. for file structure info |
| 4 | |
| 5 | This program is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU General Public License |
| 7 | as published by the Free Software Foundation; either version 2 |
| 8 | of the License, or (at your option) any later version. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program; if not, write to the Free Software |
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | |
| 19 | This program is released under the GPL with the additional exemption |
| 20 | that compiling, linking, and/or using OpenSSL is allowed. |
| 21 | |
| 22 | Copyright (C) 2004-2006 Nicola Cuomo <[email protected]> |
| 23 | Improvments and some bugs fixes by Objectif Securité |
| 24 | <http://www.objectif-securite.ch> |
| 25 | */ |
| 26 | |
| 27 | #ifndef HIVE_H |
| 28 | #define HIVE_Hcxx . . $ `hive.h:28:9`! |
| 29 | |
| 30 | #include <stdio.h> |
| 31 | #include <stdlib.h> |
| 32 | #include <string.h> |
| 33 | |
| 34 | #define mincxx . . $ `hive.h:34:9`!(a, b) (((a) < (b)) ? (a) : (b)) |
| 35 | |
| 36 | #define NK_IDcxx . . $ `hive.h:36:9`! 0x6B6E |
| 37 | #define NK_ROOTcxx . . $ `hive.h:37:9`! 0x2c |
| 38 | #define LF_IDcxx . . $ `hive.h:38:9`! 0x666C |
| 39 | |
| 40 | #ifdef __cplusplus |
| 41 | extern "C" { |
| 42 | #endif |
| 43 | |
| 44 | struct hivecxx . . $ hive# |
| 45 | { |
| 46 | unsigned char *basecxx . . $ hive#base.; |
| 47 | }; |
| 48 | |
| 49 | typedef struct _nk_hdrcxx . . $ _nk_hdr# |
| 50 | { |
| 51 | short int idcxx . . $ _nk_hdr#id.; |
| 52 | short int typecxx . . $ _nk_hdr#type.; |
| 53 | int t1cxx . . $ _nk_hdr#t1., t2cxx . . $ _nk_hdr#t2.; |
| 54 | int unk1cxx . . $ _nk_hdr#unk1.; |
| 55 | int parent_offcxx . . $ _nk_hdr#parent_off.; |
| 56 | int subkey_numcxx . . $ _nk_hdr#subkey_num.; |
| 57 | int unk2cxx . . $ _nk_hdr#unk2.; |
| 58 | int lf_offcxx . . $ _nk_hdr#lf_off.; |
| 59 | int unk3cxx . . $ _nk_hdr#unk3.; |
| 60 | int value_cntcxx . . $ _nk_hdr#value_cnt.; |
| 61 | int value_offcxx . . $ _nk_hdr#value_off.; |
| 62 | int sk_offcxx . . $ _nk_hdr#sk_off.; |
| 63 | int classname_offcxx . . $ _nk_hdr#classname_off.; |
| 64 | int unk4cxx . . $ _nk_hdr#unk4.[4]; |
| 65 | int unk5cxx . . $ _nk_hdr#unk5.; |
| 66 | short int name_lencxx . . $ _nk_hdr#name_len.; |
| 67 | short int classname_lencxx . . $ _nk_hdr#classname_len.; |
| 68 | unsigned char *key_namecxx . . $ _nk_hdr#key_name.; |
| 69 | } nk_hdrcxx . . $ nk_hdr#; |
| 70 | |
| 71 | typedef struct _hashrecordcxx . . $ _hashrecord# |
| 72 | { |
| 73 | |
| 74 | int nk_offsetcxx . . $ _hashrecord#nk_offset.; |
| 75 | char keynamecxx . . $ _hashrecord#keyname.[4]; |
| 76 | } hashrecordcxx . . $ hashrecord#; |
| 77 | |
| 78 | typedef struct _lf_hdrcxx . . $ _lf_hdr# |
| 79 | { |
| 80 | short int idcxx . . $ _lf_hdr#id.; |
| 81 | short int key_numcxx . . $ _lf_hdr#key_num.; |
| 82 | unsigned char *hrcxx . . $ _lf_hdr#hr.; |
| 83 | } lf_hdrcxx . . $ lf_hdr#; |
| 84 | |
| 85 | typedef struct _vk_hdrcxx . . $ _vk_hdr# |
| 86 | { |
| 87 | short int idcxx . . $ _vk_hdr#id.; |
| 88 | short int name_lencxx . . $ _vk_hdr#name_len.; |
| 89 | int data_lencxx . . $ _vk_hdr#data_len.; |
| 90 | int data_offcxx . . $ _vk_hdr#data_off.; |
| 91 | int data_typecxx . . $ _vk_hdr#data_type.; |
| 92 | short int flagcxx . . $ _vk_hdr#flag.; |
| 93 | short int unk1cxx . . $ _vk_hdr#unk1.; |
| 94 | unsigned char *value_namecxx . . $ _vk_hdr#value_name.; |
| 95 | } vk_hdrcxx . . $ vk_hdr#; |
| 96 | |
| 97 | nk_hdrcxx . . $ nk_hdr#* read_nkcxx . . $ read_nk(2316082a77336704).(nk_hdrcxx . . $ nk_hdr# *nk, struct hivecxx . . $ hive# *h, int offset ); |
| 98 | lf_hdrcxx . . $ lf_hdr#* read_lfcxx . . $ read_lf(85bb1d927174c2d).(lf_hdrcxx . . $ lf_hdr# *lf, struct hivecxx . . $ hive# *h, int offset ); |
| 99 | vk_hdrcxx . . $ vk_hdr#* read_vkcxx . . $ read_vk(fd4df586ea07da97).(vk_hdrcxx . . $ vk_hdr# *vk, struct hivecxx . . $ hive# *h, int offset ); |
| 100 | hashrecordcxx . . $ hashrecord#* read_hrcxx . . $ read_hr(9bbfcf56ed6c0170).(hashrecordcxx . . $ hashrecord# *hr, unsigned char *pos, int index ); |
| 101 | int* read_valuelistcxx . . $ read_valuelist(2621c5b1afd2e82b).(int *value, struct hivecxx . . $ hive# *h, int offset, int size); |
| 102 | unsigned char* read_datacxx . . $ read_data(c27d5f014b3fecf5).(struct hivecxx . . $ hive# *h, int offset ); |
| 103 | |
| 104 | void _RegCloseHivecxx . . $ _RegCloseHive(75e6f13f219d000f).( struct hivecxx . . $ hive# *h ); |
| 105 | |
| 106 | void _InitHivecxx . . $ _InitHive(75e6f13f219d000f).( struct hivecxx . . $ hive# *h ); |
| 107 | |
| 108 | int _RegOpenHivecxx . . $ _RegOpenHive(84cbfd8c19656c97).( unsigned char *filename, struct hivecxx . . $ hive# *h ); |
| 109 | |
| 110 | int _RegOpenHiveBuffercxx . . $ _RegOpenHiveBuffer(94d6b6e0be58d039).( unsigned char *buffer, unsigned long size, struct hivecxx . . $ hive# *h ); |
| 111 | |
| 112 | long parselfcxx . . $ parself(fede0aacf5ae7045).( struct hivecxx . . $ hive# *h, char *t, unsigned long off ); |
| 113 | |
| 114 | int _RegGetRootKeycxx . . $ _RegGetRootKey(3d851ed2cd37585f).(struct hivecxx . . $ hive# *h, char **root_key); |
| 115 | |
| 116 | int _RegOpenKeycxx . . $ _RegOpenKey(31ebb3f0ca3e6396).( struct hivecxx . . $ hive# *h, char *path, nk_hdrcxx . . $ nk_hdr# **nr ); |
| 117 | |
| 118 | int _RegQueryValuecxx . . $ _RegQueryValue(9d8dfe56b004a603).( struct hivecxx . . $ hive# *h, char *name, nk_hdrcxx . . $ nk_hdr# *nr, unsigned char **buff, int *len ); |
| 119 | |
| 120 | int _RegEnumKeycxx . . $ _RegEnumKey(12b579c9edc383c3).( struct hivecxx . . $ hive# *h, nk_hdrcxx . . $ nk_hdr# *nr, int index, char *name, int *namelen ); |
| 121 | |
| 122 | #ifdef __cplusplus |
| 123 | } |
| 124 | #endif |
| 125 | #endif |