HDKEEPER.C
资源名称:schddog.zip [点击查看]
上传用户:haocheng
上传日期:2007-01-06
资源大小:24k
文件大小:14k
源码类别:
磁盘编程
开发平台:
Others
- #include<stdio.h>
- #include<dos.h>
- #include<fcntl.h>
- #include<sysstat.h>
- #define MemSize *(unsigned far *)0x00400013
- unsigned char Sector1[512]=
- { 0xEB,0x05,0x90,0x89,0xA1,0x00,0xF0,0xFA,0x8C,0xC8,0x8E,0xD8,
- 0x8E,0xC0,0x8E,0xD0,0xBC,0x00,0x7C,0x33,0xF6,0xFB,0xFF,0x0E,
- 0x13,0x04,0xFF,0x0E,0x13,0x04,0xA1,0x13,0x04,0xB1,0x06,0xD3,
- 0xE0,0x8E,0xC0,0xBF,0x00,0x00,0xBE,0x00,0x7C,0xB9,0x00,0x02,
- 0xF3,0xA4,0x06,0xB8,0x38,0x00,0x50,0xCB,0x33,0xC0,0x8E,0xD8,
- 0x8C,0x06,0xF0,0x03,0xFA,0xA1,0x4C,0x00,0x2E,0xA3,0x03,0x00,
- 0xA3,0x40,0x01,0xA1,0x4E,0x00,0x2E,0xA3,0x05,0x00,0xA3,0x42,
- 0x01,0xB8,0x2F,0x01,0xA3,0x4C,0x00,0x8C,0x0E,0x4E,0x00,0xA1,
- 0x24,0x00,0x2E,0xA3,0x0C,0x01,0xA1,0x26,0x00,0x2E,0xA3,0x0E,
- 0x01,0xB8,0xB4,0x01,0xA3,0x24,0x00,0x8C,0x0E,0x26,0x00,0xBE,
- 0x02,0x00,0xB8,0x01,0x02,0xBB,0x00,0x02,0xB9,0x01,0x00,0xBA,
- 0x80,0x00,0x9C,0x2E,0xFF,0x1E,0x03,0x00,0x73,0x03,0x4E,0x75,
- 0xE9,0x33,0xF6,0xBF,0x00,0x02,0x0E,0x1F,0xF3,0xA6,0x74,0x14,
- 0xBE,0x10,0x01,0x32,0xED,0xAC,0x8A,0xC8,0xB8,0x01,0x13,0xBB,
- 0x07,0x00,0x2B,0xD2,0x8B,0xEE,0xCD,0x10,0x8C,0xC8,0x8E,0xC0,
- 0x33,0xDB,0xB8,0x01,0x03,0xB9,0x01,0x00,0xBA,0x80,0x00,0x9C,
- 0x2E,0xFF,0x1E,0x03,0x00,0xBE,0x02,0x00,0xB8,0x03,0x02,0xBB,
- 0x00,0x02,0xB9,0x04,0x00,0xBA,0x80,0x00,0x9C,0x2E,0xFF,0x1E,
- 0x03,0x00,0x73,0x03,0x4E,0x75,0xE9,0xB8,0xE8,0x00,0x50,0xB8,
- 0x00,0x02,0x50,0xC3,0xFB,0x33,0xC0,0x8E,0xC0,0xBE,0x02,0x00,
- 0xB8,0x01,0x02,0xBB,0x00,0x7C,0xB9,0x03,0x00,0xBA,0x80,0x00,
- 0x9C,0x2E,0xFF,0x1E,0x03,0x00,0x73,0x03,0x4E,0x75,0xE9,0xEA,
- 0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x5B,0x56,0x69,
- 0x72,0x75,0x73,0x5D,0x20,0x53,0x65,0x6C,0x66,0x20,0x50,0x72,
- 0x6F,0x74,0x65,0x63,0x74,0x2E,0x2E,0x2E,0x0A,0x0D,0x00,0xFF,
- 0xFF,0x6B,0x02,0xFB,0x81,0xFA,0x80,0x00,0x75,0x08,0x83,0xF9,
- 0x01,0x75,0x03,0xB9,0x03,0x00,0x80,0xFC,0x03,0x74,0x28,0x80,
- 0xFC,0x05,0x74,0x23,0x80,0xFC,0x06,0x74,0x1E,0x80,0xFC,0x07,
- 0x74,0x19,0x80,0xFC,0x0B,0x74,0x14,0x80,0xFC,0x0F,0x74,0x0F,
- 0x80,0xFC,0x13,0x74,0x0A,0x80,0xFC,0x19,0x74,0x05,0x2E,0xFF,
- 0x2E,0x03,0x00,0x80,0xFA,0x80,0x75,0xF6,0x51,0x52,0x86,0xE9,
- 0x80,0xE5,0xC0,0x8B,0xD1,0xB1,0x06,0xD2,0xEE,0x2E,0x3B,0x16,
- 0x2D,0x01,0x5A,0x59,0x7D,0xE0,0x2E,0x80,0x3E,0x2A,0x01,0x00,
- 0x74,0x20,0x80,0xFE,0x00,0x75,0xD3,0x83,0xF9,0x01,0x74,0x16,
- 0x83,0xF9,0x02,0x74,0x11,0x83,0xF9,0x03,0x74,0x0C,0x83,0xF9,
- 0x07,0x74,0x07,0x83,0xF9,0x08,0x74,0x02,0xEB,0xB8,0xB4,0x00,
- 0xFD,0xCA,0x02,0x00,0xFB,0x50,0xE4,0x60,0x3C,0x01,0x74,0x06,
- 0x58,0x2E,0xFF,0x2E,0x0C,0x01,0xB4,0x02,0xCD,0x16,0x24,0x0F,
- 0x3C,0x0A,0x75,0xF0,0x9C,0x2E,0xFF,0x1E,0x0C,0x01,0x9C,0xB8,
- 0xDC,0x01,0x50,0xB8,0x00,0x06,0x50,0xC3,0x72,0x09,0x2E,0xC6,
- 0x06,0x2A,0x01,0xFF,0xEB,0x07,0x90,0x2E,0xC6,0x06,0x2A,0x01,
- 0x00,0x9D,0x58,0xCF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x55,0xAA};
- char Sector2[1536]=
- { 0x0E,0x1F,0xBF,0xAB,0x02,0xE8,0x90,0x00,0xBF,0xF0,0x07,0xE8,
- 0x23,0x00,0xBE,0xF0,0x07,0xBF,0xE0,0x07,0x8A,0x0D,0x8A,0x2C,
- 0x3A,0xCD,0x75,0x06,0x32,0xED,0xF3,0xA6,0x74,0x08,0xBF,0xD1,
- 0x06,0xE8,0x70,0x00,0xEB,0xFE,0xBF,0xDC,0x02,0xE8,0x68,0x00,
- 0xC3,0x06,0x57,0x0E,0x07,0x47,0xC6,0x06,0xAA,0x02,0x00,0x90,
- 0x80,0x3E,0xAA,0x02,0x0F,0x7D,0x4D,0xB4,0x01,0xCD,0x16,0x74,
- 0xF3,0xB8,0x00,0x00,0xCD,0x16,0x3C,0x00,0x74,0xEA,0x3C,0x08,
- 0x74,0x18,0x3C,0x0D,0x74,0x36,0x2C,0x14,0x0C,0x80,0xAA,0xB0,
- 0x2A,0xBB,0x00,0x00,0xB4,0x0E,0xCD,0x10,0xFE,0x06,0xAA,0x02,
- 0xEB,0xCE,0x80,0x3E,0xAA,0x02,0x00,0x74,0xC7,0x4F,0xB0,0x00,
- 0xAA,0xB4,0x03,0xB7,0x00,0xCD,0x10,0xB0,0x20,0xB4,0x0E,0xCD,
- 0x10,0xB4,0x02,0xCD,0x10,0xFE,0x0E,0xAA,0x02,0x4F,0xEB,0xAC,
- 0x5F,0xA0,0xAA,0x02,0x88,0x05,0x07,0xC3,0x2E,0x8A,0x05,0x3C,
- 0x24,0x74,0x0A,0xB4,0x0E,0xBB,0x03,0x00,0xCD,0x10,0x47,0xEB,
- 0xEF,0xC3,0x00,0x57,0x61,0x6B,0x69,0x6E,0x67,0x20,0x75,0x70,
- 0x20,0x42,0x61,0x62,0x79,0x73,0x6F,0x66,0x74,0x2D,0x48,0x44,
- 0x4B,0x65,0x65,0x70,0x65,0x72,0x2E,0x2E,0x2E,0x20,0x6F,0x6B,
- 0x2E,0x0A,0x0D,0x0A,0x0D,0x50,0x61,0x73,0x73,0x77,0x6F,0x72,
- 0x64,0x3A,0x20,0x24,0x0A,0x0D,0x0A,0x0D,0x24,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,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,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,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,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,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,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,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,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,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,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,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,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,0x50,0x51,0x1E,0x06,0x56,0x57,0x33,0xC0,
- 0x8E,0xD8,0xA1,0xF0,0x03,0x8E,0xD8,0x8E,0xC0,0xBF,0xF0,0x07,
- 0xE8,0x49,0x00,0xBE,0xF0,0x07,0xBF,0xE0,0x07,0x8A,0x0D,0x8A,
- 0x2C,0x3A,0xCD,0x75,0x0C,0x32,0xED,0xF3,0xA6,0xB8,0x33,0x04,
- 0xB9,0x05,0x00,0x74,0x16,0x05,0xC8,0x00,0xE8,0x74,0x00,0xE8,
- 0x8B,0x00,0xE2,0xF5,0xE8,0x7F,0x00,0x5F,0x5E,0x07,0x1F,0x59,
- 0x58,0xF9,0xC3,0xB8,0xE3,0x08,0x2D,0xC8,0x00,0xE8,0x5B,0x00,
- 0xE8,0x72,0x00,0xE2,0xF5,0xE8,0x66,0x00,0x5F,0x5E,0x07,0x1F,
- 0x59,0x58,0xF8,0xC3,0x06,0x57,0x47,0xC6,0x06,0xAA,0x02,0x00,
- 0x80,0x3E,0xAA,0x02,0x0F,0x7D,0x34,0xB4,0x01,0xCD,0x16,0x74,
- 0xF3,0xB8,0x00,0x00,0xCD,0x16,0x3C,0x00,0x74,0xEA,0x3C,0x08,
- 0x74,0x0F,0x3C,0x0D,0x74,0x1D,0x2C,0x14,0x0C,0x80,0xAA,0xFE,
- 0x06,0xAA,0x02,0xEB,0xD7,0x80,0x3E,0xAA,0x02,0x00,0x74,0xD0,
- 0x4F,0xB0,0x00,0xAA,0xFE,0x0E,0xAA,0x02,0x4F,0xEB,0xC5,0x5F,
- 0xA0,0xAA,0x02,0x88,0x05,0x07,0xC3,0x50,0xB0,0xB6,0xE6,0x43,
- 0x58,0xE6,0x42,0x8A,0xC4,0xE6,0x42,0xE4,0x61,0x0C,0x03,0xE6,
- 0x61,0xC3,0xE4,0x61,0x24,0xFC,0xE6,0x61,0xC3,0x56,0xBE,0x00,
- 0xA0,0x4E,0x83,0xFE,0x00,0x75,0xFA,0x5E,0xC3,0x07,0x0A,0x0D,
- 0x0A,0x0D,0x53,0x6F,0x72,0x72,0x79,0x21,0x20,0x59,0x6F,0x75,
- 0x20,0x61,0x72,0x65,0x20,0x55,0x6E,0x77,0x65,0x6C,0x63,0x6F,
- 0x6D,0x65,0x20,0x47,0x75,0x65,0x73,0x74,0x21,0x0A,0x0D,0x49,
- 0x20,0x63,0x61,0x6E,0x20,0x6E,0x6F,0x74,0x20,0x6C,0x65,0x74,
- 0x20,0x79,0x6F,0x75,0x20,0x69,0x6E,0x21,0x0A,0x0D,0x48,0x61,
- 0x21,0x48,0x61,0x21,0x48,0x61,0x21,0x2E,0x2E,0x2E,0x24,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,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,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,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,
- 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01};
- unsigned char buffer[512];
- void ReadStr(char *str)
- {
- unsigned char Plength=1;
- unsigned xx,yy,x;
- union REGS r;
- xx=wherex();
- yy=wherey();
- x=xx;
- do{
- gotoxy(xx,yy);
- r.h.ah=0;
- int86(0x16,&r,&r);
- if((r.h.ah!=28)&&(r.h.ah!=14)&&(r.h.ah!=1))
- {
- *(str+Plength)=(r.h.al-20)|0x80;
- gotoxy(xx,yy);
- putch('*');
- xx++;
- Plength++;
- }
- else if(r.h.ah==14)
- {
- xx--;
- if(xx<x)xx=x;
- gotoxy(xx,yy);
- putch(' ');
- if(Plength>1)Plength--;
- }
- else if(r.h.ah==1)Plength=0;
- }while((r.h.ah!=28)&&(r.h.ah!=1)&&(Plength<15));
- *(str+0)=Plength-1;
- }
- int CheckPass(char *src,char *dest)
- {
- unsigned char Plength,p2;
- Plength=*(src+0);
- p2=*(dest+0);
- if(Plength!=p2)return -1;
- while(Plength>0)
- {
- if(*(src+Plength)!=*(dest+Plength))return -1;
- Plength--;
- }
- return 1;
- }
- int CopyPass(char *src,char *dest)
- {
- char Plength;
- Plength=*(src+0);
- while(Plength>=0)
- {
- *(dest+Plength)=*(src+Plength);
- Plength--;
- }
- return 0;
- }
- void reboot(void)
- {
- void (far *reboot_ptr)(void);
- unsigned int far *i_ptr;
- clrscr();
- i_ptr=MK_FP(0x0040,0x0072);
- *i_ptr=0x1234;
- reboot_ptr=MK_FP(0xF000,0xFFF0);
- reboot_ptr();
- }
- void copyright()
- {
- printf("n Babysoft (R) Hard Disk Keeper version 1.0");
- printf("n Copyright (C) 1997.12 LiuYaDing,Babysoft Corp.");
- printf("n This Program can set password on Driver C: and make it Read-Only.n");
- }
- void main()
- {
- char k,*pass;
- char passwd1[16],passwd2[16];
- char filename[20];
- int fp;
- if(MemSize!=0x280)
- {
- printf("na Hard Disk Keeper has been Installed or Virus infected!!!");
- printf("n Please check your system......");
- printf("n If you use AMI BIOS,don't reduce your RAM.n");
- printf("n (C) Copyright 1997.12 LiuYaDing,Babysoft Corp.n");
- exit(1);
- }
- copyright();
- printf("n Password: ");
- ReadStr(passwd1);
- printf("n Verify : ");
- ReadStr(passwd2);
- if(CheckPass(passwd1,passwd2)!=1)
- {
- printf("na Password verify error!!! ");
- exit(1);
- }
- pass=Sector2+0x600-32;
- CopyPass(passwd1,pass);
- printf("n Backup Filename[.MBG]:");
- scanf("%s",filename);
- fp=open(filename,O_CREAT|O_BINARY,S_IREAD|S_IWRITE);
- if(fp==-1){printf("na Backup file open error!");}
- else printf(" Saved Master Boot Sector to <%s> ok.",filename);
- if((biosdisk(0x02,0x80,0,0,1,1,buffer))!=0)
- {
- printf("na Read Master Boot Sector error!");
- exit(1);
- }
- if((biosdisk(0x03,0x80,0,0,3,1,buffer))!=0)
- {
- printf("na Installed Hard Disk Keeper error!");
- exit(1);
- }
- if((biosdisk(0x03,0x80,0,0,7,1,buffer))!=0)
- {
- printf("na Installed Hard Disk Keeper error!");
- exit(1);
- }
- Sector1[0x12D]=buffer[0x1C5];
- Sector1[0x12E]=buffer[0x1C4]&192;
- Sector1[0x12E]=Sector1[0x12E]>>6;
- if((biosdisk(0x03,0x80,0,0,1,1,Sector1))!=0)
- {
- printf("na Install Hard Disk Keeper First Parts error!");
- exit(1);
- }
- if((biosdisk(0x03,0x80,0,0,4,3,Sector2))!=0)
- {
- printf("na Install Hard Disk Keeper Other Parts error!");
- exit(1);
- }
- write(fp,buffer,512);
- close(fp);
- printf("n Installed Hard Disk Keeper ok.");
- printf("n Reboot system to enable the change?(Y/N)");
- k=getch();k=k|0x20;
- if(k=='y')reboot();
- }