File tree Expand file tree Collapse file tree 4 files changed +3
-16
lines changed
ch11_reading_offline_hives Expand file tree Collapse file tree 4 files changed +3
-16
lines changed Original file line number Diff line number Diff line change @@ -34,13 +34,13 @@ public NodeKey (BinaryReader hive)
34
34
private void ReadNodeStructure ( BinaryReader hive ) {
35
35
byte [ ] buf = hive . ReadBytes ( 4 ) ;
36
36
37
- if ( buf [ 0 ] != 110 || buf [ 1 ] != 107 )
37
+ if ( buf [ 0 ] != 0x6e || buf [ 1 ] != 0x6b )
38
38
throw new NotSupportedException ( "Bad nk header" ) ;
39
39
40
40
long startingOffset = hive . BaseStream . Position ;
41
41
this . IsRootKey = ( buf [ 2 ] == 0x2c ) ? true : false ;
42
42
43
- this . Timestamp = DateTime . FromFileTime ( BitConverter . ToInt64 ( hive . ReadBytes ( 8 ) , 0 ) ) ;
43
+ this . Timestamp = DateTime . FromFileTime ( hive . ReadInt64 ( ) ) ;
44
44
45
45
hive . BaseStream . Position += 4 ;
46
46
Original file line number Diff line number Diff line change @@ -8,11 +8,8 @@ class MainClass
8
8
public static void Main ( string [ ] args )
9
9
{
10
10
RegistryHive hive = new RegistryHive ( args [ 0 ] ) ;
11
-
12
- if ( hive . WasExported )
13
- Console . Write ( "This hive was exported. " ) ;
14
11
15
- Console . WriteLine ( "The rootkey's name is " + hive . RootKey + "." ) ;
12
+ Console . WriteLine ( "The rootkey's name is " + hive . RootKey . Name ) ;
16
13
}
17
14
}
18
15
}
Original file line number Diff line number Diff line change @@ -21,15 +21,6 @@ public RegistryHive(string file)
21
21
if ( buf [ 0 ] != 'r' || buf [ 1 ] != 'e' || buf [ 2 ] != 'g' || buf [ 3 ] != 'f' )
22
22
throw new NotSupportedException ( ) ;
23
23
24
- reader . ReadBytes ( 8 ) ;
25
- buf = reader . ReadBytes ( 8 ) ;
26
- //Array.Reverse(buf);
27
- long timestamp = BitConverter . ToInt64 ( buf , 0 ) ;
28
- //long timestamp = reader.ReadInt64 ();
29
- DateTime time = DateTime . FromBinary ( timestamp ) ;
30
-
31
- this . WasExported = ( timestamp == 0 ) ? true : false ;
32
-
33
24
//fast-forward
34
25
reader . BaseStream . Position += ( 4096 + 32 + 4 ) - reader . BaseStream . Position ;
35
26
Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ public ValueKey (BinaryReader hive)
15
15
16
16
this . NameLength = hive . ReadInt16 ( ) ;
17
17
this . DataLength = hive . ReadInt32 ( ) ;
18
- //this.DataLength = BitConverter.ToInt32(hive.ReadBytes(4),0);
19
18
20
19
byte [ ] databuf = hive . ReadBytes ( 4 ) ;
21
20
You can’t perform that action at this time.
0 commit comments