From b7adc5a32f677b5e4ae3dc5363abf965db5e971a Mon Sep 17 00:00:00 2001 From: nishikawa_takeshi Date: Mon, 22 Jun 2009 02:13:49 +0000 Subject: [PATCH] =?UTF-8?q?=E3=83=A1=E3=83=8B=E3=83=A5=E3=83=BC=E3=82=B9?= =?UTF-8?q?=E3=82=AD=E3=83=83=E3=83=97=E3=83=95=E3=83=A9=E3=82=B0=E7=AB=8B?= =?UTF-8?q?=E3=81=A6=E3=83=84=E3=83=BC=E3=83=AB:=E3=83=98=E3=83=83?= =?UTF-8?q?=E3=83=80CRC=E3=81=8C=E3=81=8A=E3=81=8B=E3=81=97=E3=81=84?= =?UTF-8?q?=E3=81=A8=E3=81=8D=E5=BE=8C=E7=B6=9A=E3=81=AE=E5=87=A6=E7=90=86?= =?UTF-8?q?=E3=82=92=E3=81=97=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@298 7061adef-622a-194b-ae81-725974e89856 --- .../MasterEditor/MenuSkipFlagTool/main.c | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/build/tools/MasterEditor/MenuSkipFlagTool/main.c b/build/tools/MasterEditor/MenuSkipFlagTool/main.c index 10a1a12..6d8a94b 100644 --- a/build/tools/MasterEditor/MenuSkipFlagTool/main.c +++ b/build/tools/MasterEditor/MenuSkipFlagTool/main.c @@ -106,7 +106,9 @@ int main(int argc, char *argv[]) BOOL bResult = TRUE; BOOL bForceOverwrite = FALSE; BOOL bEnableFlag = FALSE; // フラグを立てるかどうか - + ROM_Header rh; + u16 h_crc = 0; + printf( "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" ); printf( " ManuSkipFlagTool [%s-%s]\n", SDK_REVISION, IPL_REVISION ); printf( "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" ); @@ -202,6 +204,22 @@ int main(int argc, char *argv[]) goto FINALIZE; } + // SRLかどうかのチェック + fseek( context.ifp, 0, SEEK_SET ); + if( sizeof(ROM_Header) != fread( &rh, 1, sizeof(ROM_Header), context.ifp ) ) + { + printf( "\n*** Error: Failed to read the ROM Header. ***\n" ); + bResult = FALSE; + goto FINALIZE; + } + h_crc = CalcCRC16( CRC16_INIT_VALUE, (u8*)&rh, CALC_CRC16_SIZE ); // ヘッダCRCがおかしいとき不正ROMとみなす + if( h_crc != rh.s.header_crc16 ) + { + printf( "\n*** Error: Invalid header CRC. ***\n" ); + bResult = FALSE; + goto FINALIZE; + } + // ファイルコピー if( !CopyFile( context.ofp, context.ifp ) ) {