summaryrefslogtreecommitdiffstats
path: root/src/parti386.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2010-08-18 21:55:40 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2010-08-18 21:55:40 +0200
commitf767c4283e08c83b0591b00fdfe9408a0789a7be (patch)
tree4283e8beadfea050e1b1695d38c1e46aaa7c5c57 /src/parti386.c
parentb7c1b28b16efcee2a379ad46d45a7022af464b52 (diff)
MBRCode: Avoid to replace the disk signature used by Vista and later
Diffstat (limited to 'src/parti386.c')
-rw-r--r--src/parti386.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/parti386.c b/src/parti386.c
index fdf3cad..673e1c3 100644
--- a/src/parti386.c
+++ b/src/parti386.c
@@ -63,6 +63,7 @@
#include "parti386.h"
#include "partgpt.h"
+#define TAB_PART 0x1BE
static int is_extended(const unsigned int part_type);
static int test_structure_i386(list_part_t *list_part);
#define pt_offset_const(b, n) ((const struct partition_dos *)((b) + 0x1be + \
@@ -938,16 +939,17 @@ static int write_MBR_code_i386_aux(unsigned char *buffer)
0xbb, 0x00, 0x7c, 0x50, 0xc6, 0x06, 0x8f, 0x07, 0x01, 0xcd, 0x13, 0x58, 0x5e, 0x73, 0x05, 0x4f,
0x75, 0xb4, 0xeb, 0x93, 0x81, 0x3e, 0xfe, 0x7d, 0x55, 0xaa, 0x75, 0xf6, 0xea, 0x00, 0x7c, 0x00,
0x00, 0xbe, 0x83, 0x07, 0xb9, 0x0a, 0x00, 0x50, 0xb4, 0x0e, 0x31, 0xdb, 0xac, 0xcd, 0x10, 0xe2,
- 0xfb, 0x58, 0xc3, 0x54, 0x65, 0x73, 0x74, 0x44, 0x69, 0x73, 0x6b, 0x0d, 0x0a, 0x10, 0x00, 0x01,
- 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x32, 0x33,
- 0x34, 0x46, 0x00, 0x00, 0x41, 0x4e, 0x44, 0x54, 0x6d, 0x62, 0x72, 0x00, 0x02, 0x02, 0x02, 0x1f,
+ 0xfb, 0x58, 0xc3, 'T', 'e', 's', 't', 'D', 'i', 's', 'k', 0x0d, 0x0a, 0x10, 0x00, 0x01,
+ 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, '1', '2', '3',
+ '4', 'F', 0x00, 0x00, 0x41, 'N', 'D', 'T', 'm', 'b', 'r', 0x00, 0x02, 0x02, 0x02, 0x1f,
0xc7, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xaa,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xaa
};
- memcpy(buffer,&mbr_code_testdisk,TAB_PART);
+ /* don't overwrite the disk signature at 0x1b8 */
+ memcpy(buffer, &mbr_code_testdisk, 0x1b8);
buffer[0x1FE]=(unsigned char)0x55;
buffer[0x1FF]=(unsigned char)0xAA;
return 0;