OSDN Git Service

projects clean up 1
[pinoc/pinoc.git] / tryos / tryos_test / pinoc_x86 / tool / Tool src / BootSigned / BootSigned / BootSigned.cpp
1 /* ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
2         概要  :       このプログラムは 指定されたファイルの511byte512byteへブート署名します
3         更新  :       2010/05/02 新規作成 [mk-pino]
4                         2010/05/03      Linuxで実行すると日本語が文字化けする問題を解決 [mk-pino]
5  ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ */
6
7 #include <stdio.h>
8 #include <stdlib.h>
9
10 int main(int argv, char* argc[])
11 {
12         if(argv < 2)
13         {
14                 printf("No input parameter!!\n");
15                 printf("Exa... BootSigned.exe bootimg.img\n");
16                 exit(1);
17         }
18
19         FILE* fp;
20         fp = fopen(argc[1], "r+");
21         if(fp == NULL)
22         {
23                 printf("open error\n");
24                 exit(1);
25         }
26
27         /* 511byte移動 */
28         fseek(fp, 510, SEEK_SET);
29         putc(0x55, fp);
30         putc(0xaa, fp);
31
32         fclose(fp);
33         printf("Signed!!\n");
34
35         return 0;
36 }