patch.cpp

来自「TDS510仿真器 的硬件电路和软件VHDL代码和大家共享TDS510」· C++ 代码 · 共 47 行

CPP
47
字号
// patch.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdio.h>

int main(int argc, char* argv[])
{
	FILE *h = fopen( "xdsfast1.sys", "rb+");

	if( h == NULL)
	{
		printf( "xdsfast1.sys must be in the work directory of this patch.\n");
		return 1;
	}

	unsigned char ch;
	fseek( h, 0x109, SEEK_SET);
	fread( &ch, 1, 1, h);
	if( ch != 0x73)
	{
		printf( "Wrong input file.\n" );
		fclose( h);
		return 2;
	}
	fseek( h, 0x57D, SEEK_SET);
	fread( &ch, 1, 1, h);
	if( ch != 0x01)
	{
		printf( "Wrong input file.\n" );
		fclose( h);
		return 2;
	}

	ch = 0x72;
	fseek( h, 0x109, SEEK_SET);
	fwrite( &ch, 1, 1, h);
	ch = 0x00;
	fseek( h, 0x57D, SEEK_SET);
	fwrite( &ch, 1, 1, h);
	
	fclose( h);
	printf( "Patch successful.\n");

	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?