B
bluedyness
Unregistered / Unconfirmed
GUEST, unregistred user!
unsigned short sum( DWORD addr, LPBYTE lpCode, DWORD len )
{
unsigned short check_sum = 0x1000 + (unsigned short)addr;
unsigned short uiSourceValue, uiDestValue;
for( int i = 0; i < len; i += sizeof(unsigned short) )
{
uiSourceValue = *(unsigned short*)&lpCode[ i ];
uiDestValue = 0;
CONVERT_SHORT( uiSourceValue, uiDestValue);
check_sum += uiDestValue;
}
return check_sum;
}
//////////////////////////////////////////////////////
function sum(addr:cardinal;lpcodebyte;len:cardinal):word;
var
check_sum,
uiSourceValue, uiDestValue:word;
i:integer;
begin
check_sum := $1000 + addr;
i:=0;
GetMem(lpcode,128);
while i<len do
begin
uiSourceValue:=lpcode^;
uiDestValue:=0;
CONVERT_SHORT( uiSourceValue, uiDestValue);//????咋弄
check_sum :=check_sum + uiDestValue;
i:=i + sizeof(word);
inc(lpcode,sizeof(word));
end;
FreeMem(lpcode);
result:=check_sum;
end;
不知道上面写的对不对 但现在最关键的问题是:
CONVERT_SHORT 该怎么转 我在那个cpp文件中找不到,直接拿vc++也编译不过去!咋办?
{
unsigned short check_sum = 0x1000 + (unsigned short)addr;
unsigned short uiSourceValue, uiDestValue;
for( int i = 0; i < len; i += sizeof(unsigned short) )
{
uiSourceValue = *(unsigned short*)&lpCode[ i ];
uiDestValue = 0;
CONVERT_SHORT( uiSourceValue, uiDestValue);
check_sum += uiDestValue;
}
return check_sum;
}
//////////////////////////////////////////////////////
function sum(addr:cardinal;lpcodebyte;len:cardinal):word;
var
check_sum,
uiSourceValue, uiDestValue:word;
i:integer;
begin
check_sum := $1000 + addr;
i:=0;
GetMem(lpcode,128);
while i<len do
begin
uiSourceValue:=lpcode^;
uiDestValue:=0;
CONVERT_SHORT( uiSourceValue, uiDestValue);//????咋弄
check_sum :=check_sum + uiDestValue;
i:=i + sizeof(word);
inc(lpcode,sizeof(word));
end;
FreeMem(lpcode);
result:=check_sum;
end;
不知道上面写的对不对 但现在最关键的问题是:
CONVERT_SHORT 该怎么转 我在那个cpp文件中找不到,直接拿vc++也编译不过去!咋办?