⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 awdsup.cpp

📁 awd bios文件的修改工具
💻 CPP
字号:
//'AwardMod BIOS Manipulation Tool
//'Copyright (C) 2001 Josef Hill
//'
//'This program is free software; you can redistribute it and/or
//'modify it under the terms of the GNU General Public License
//'as published by the Free Software Foundation; either version 2
//'of the License, or any later version.
//'
//'This program is distributed in the hope that it will be useful,
//'but WITHOUT ANY WARRANTY; without even the implied warranty of
//'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//'GNU General Public License for more details.
//'
//'You should have received a copy of the GNU General Public License
//'along with this program; if not, write to the Free Software
//'Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.



#include "stdafx.h"
#include "AwdSup.h"


#define INIT_CRC  0  /* CCITT: 0xFFFF */
#define CRCPOLY  0xA001  /* ANSI CRC-16 */
                         /* CCITT: 0x8408 */

static unsigned short crctable[256];
static unsigned short crc;

byte *maFile;
dword mpFile;
dword mlFile;


void __stdcall crc16_make_crctable(void)
{
	unsigned int i, j, r;

	for (i = 0; i <= 255; i++) {
		r = i;
		for (j = 0; j < 8; j++)
			if (r & 1) r = (r >> 1) ^ CRCPOLY;
			else       r >>= 1;
		crctable[i] = r;
	}
	
}

unsigned short __stdcall crc16_gencrc(unsigned char* iData, unsigned long int* iLen)
{
	unsigned long int i;
	
	crc = INIT_CRC;
	for (i=0; i < iLen[0]; i++){
		crc = crctable[(crc & 0xFF) ^ iData[i] ] ^ (crc >> 8);
	}
	return crc;
}

unsigned char __stdcall sum8_calcsum(unsigned char* iData, unsigned long int* iLen)
{
	unsigned char lO;
	unsigned long lP;
	unsigned long lL;

	lO = 0;
	lL = iLen[0];
	for (lP = 0; lP < lL; lP++)
	{
		lO += iData[lP];
	}
	return lO;
}

void __stdcall file_setinput(unsigned char* iData, unsigned long int* iLen)
{
	dword lC;

	mlFile = iLen[0];
	maFile = new byte[mlFile];
	for (lC=0;lC<mlFile;lC++)
	{
		maFile[lC] = iData[lC];
	}
	mpFile = 0;
}

void __stdcall file_getoutput(unsigned char* iData, unsigned long int* iLen)
{
	dword lC;
	
	lC = iLen[0];
	iLen[0] = mlFile;
	if (lC<mlFile)
	{
		return;
	}
	for (lC = 0; lC<mlFile; lC++)
	{
		iData[lC] = maFile[lC];
	}
}

void __stdcall file_set(unsigned char* iData, unsigned long int* iLen, unsigned long int* iOffset)
{
	dword lC;
	dword lL;
	dword lP;
	
	lL = iLen[0];
	lP = iOffset[0];
	for (lC = 0; lC <lL;lC++)
	{
		maFile[lC + lP] = iData[lC];
	}
}

void __stdcall file_get(unsigned char* iData, unsigned long int* iLen, unsigned long int* iOffset)
{
	dword lC;
	dword lL;
	dword lP;
	
	lL = iLen[0];
	lP = iOffset[0];
	for (lC = 0; lC <lL;lC++)
	{
		iData[lC] = maFile[lC + lP];
	}
}

⌨️ 快捷键说明

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