メニュースキップフラグ立てツール:ヘッダCRCがおかしいとき後続の処理をしないようにした。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@298 7061adef-622a-194b-ae81-725974e89856
This commit is contained in:
nishikawa_takeshi 2009-06-22 02:13:49 +00:00
parent 5283954fa1
commit b7adc5a32f

View File

@ -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 ) )
{