?? awdsup.cpp
字號(hào):
//'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];
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -