- #include <stdio.h>
- #define valueat(buf, ofs, type) *( (type*) ( ((char*)buf)+ofs ) )
- main()
- {
- unsigned char grub_mbr[512] = {
- 235, 6, 128, 5, 32, 57, 255, 255, 232, 0,
- 0, 91, 193, 235, 4, 140, 200, 1, 195, 142, 219,
- 83, 106, 25, 203, 246, 6, 2, 0, 4, 116, 15,
- 49, 192, 142, 192, 191, 252, 5, 102, 184, 68, 85,
- 67, 69, 102, 171, 104, 0, 32, 23, 188, 0, 144,
- 49, 201, 81, 186, 128, 0, 82, 180, 8, 249, 205,
- 19, 90, 88, 22, 7, 114, 23, 128, 225, 63, 249,
- 116, 17, 145, 180, 2, 137, 197, 49, 219, 65, 82,
- 249, 205, 19, 90, 114, 2, 246, 220, 14, 31, 156,
- 49, 246, 49, 255, 185, 223, 0, 252, 243, 165, 187,
- 252, 25, 102, 184, 71, 82, 85, 170, 234, 122, 0,
- 0, 32, 22, 31, 102, 57, 7, 117, 84, 157, 114,
- 60, 14, 31, 173, 136, 230, 173, 137, 193, 36, 63,
- 116, 31, 41, 232, 72, 246, 216, 191, 3, 0, 180,
- 2, 104, 0, 13, 7, 49, 219, 96, 205, 19, 97,
- 115, 10, 96, 49, 192, 205, 19, 97, 79, 117, 233,
- 249, 232, 197, 9, 119, 40, 131, 198, 12, 129, 254,
- 254, 1, 114, 198, 119, 21, 190, 178, 49, 180, 8,
- 153, 82, 205, 19, 88, 114, 9, 153, 145, 36, 63,
- 116, 3, 65, 235, 192, 190, 81, 1, 232, 111, 0,
- 235, 254, 30, 6, 102, 96, 140, 195, 250, 15, 1,
- 22, 96, 10, 15, 32, 192, 12, 1, 15, 34, 192,
- 190, 8, 0, 142, 198, 102, 49, 246, 102, 49, 255,
- 102, 185, 0, 36, 0, 0, 252, 243, 102, 165, 190,
- 16, 0, 142, 198, 36, 254, 15, 34, 192, 142, 195,
- 185, 0, 2, 49, 246, 86, 191, 0, 124, 87, 6,
- 31, 86, 7, 252, 243, 165, 191, 16, 126, 190, 0,
- 10, 185, 30, 0, 252, 243, 102, 46, 165, 6, 31,
- 251, 203, 250, 184, 0, 32, 142, 208, 188, 220, 143,
- 251, 102, 97, 7, 31, 233, 111, 255, 180, 14, 205,
- 16, 46, 172, 60, 0, 117, 246, 195, 13, 10, 77,
- 105, 115, 115, 105, 110, 103, 32, 77, 66, 82, 45,
- 104, 101, 108, 112, 101, 114, 46, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 85, 170};
- printf("%d\n", valueat(grub_mbr, 0, unsigned char));
- //printf("%d\n", *((unsigned char*)((unsigned char *)(&grub_mbr)+1)));
- //printf("%d\t%d\t%d", sizeof(char),sizeof(unsigned char),sizeof(int));
- }
复制代码 |