内嵌汇编报Operand size mismatch
代码是别人用delphi5写的,想用delphi7编译后在win7下运行
下面标红的代码编译时报Operand size mismatch
不懂汇编,请懂的大大帮看下怎么改啊,先谢了
-------------------------------------------------------------------------------------------
type
TExportEntry = packed record
nParamCount: DWORD;
Hook_Handler: Pointer;
Stub: TFunctionEntryPoint;
FunctionName: PChar;
LibraryName: PChar;
end;
entries: array [0..1] of TExportEntry = (
(nParamCount: 3; Hook_Handler: @HookExport_GetProcAddress; FunctionName: 'GetProcAddress'; LibraryName: 'kernel32.dll'),
(nParamCount: 4; Hook_Handler: @HookExport_LoadLibraryExW; FunctionName: 'LoadLibraryExW'; LibraryName: 'kernel32.dll')
);
procedure Hook_Multiplexer(); stdcall; assembler;
asm
pop eax // function index
push ebp // save stack frame
mov ebp, esp //
push ebx // Save all used registers and flags
push ecx
push edx
push esi
push edi
pushfd
mov ebx, eax
mov eax, sizeof(TExportEntry) // get entries item
mov edx, ebx //
mul edx // eax = entries + index * sizeof(one item)
lea ecx, dword ptr entries // get ptr to entries array
add ecx, eax
xchg eax, ecx
mov ecx, [eax + nParamCountOffs] // ecx = entries[index].nParamCount
mov edx, [eax + HookHandlerOffs] // get entries[index].handler
push eax
@@next:
mov eax, [ebp + ecx * 4 ] // Push all parameters
push eax
dec ecx
jnz @@next // loop until ecx == 0 (with zero included)
call edx // call it
pop ecx
cmp eax, -2
jne @@_exit_1 // if handler returns good value, just leave
mov eax, ecx
lea ecx, [EAX + StubOffs] // get entries[index].stub
mov eax, ecx
popfd
pop edi
pop esi
pop edx
pop ecx
pop ebx
mov esp, ebp
pop ebp
jmp eax // jump to stub
@@_exit_1:
mov edx, [ecx]
cmp edx, 4
je @@_ret12
jmp @@_ret8
@@_ret8:
popfd
pop edi
pop esi
pop edx // Restore registers
pop ecx
pop ebx
mov esp, ebp
pop ebp
ret 8
@@_ret12:
popfd
pop edi
pop esi
pop edx // Restore registers
pop ecx
pop ebx
mov esp, ebp
pop ebp
ret 12
end;