内嵌汇编报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;
下面标红的代码编译时报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;
...全文
相关推荐
Quantized-Model-File-Size-Integrity-Auditor-v1.0-原创源码与文档.zip
原创 JavaScript 工程工具源码,包含完整可运行源码、3 项自动化测试、离线 HTML/JSON/SVG 报告、真实运行截图、README、使用文档、MIT License 与原创授权声明。适合前端、Node.js、自动化测试和工程实践学习,解压后按 README 即可运行。
MATLAB下批量读入图片(以JPG示例).pdf
。。。
C++ max()报错解析[项目源码]
文章详细解释了在C++中使用max()函数时遇到的常见错误“error: no matching function for call to ‘max’”。通过一个统计字符串数组中最长字符串长度的例子,作者指出错误的原因是size()函数返回size_t类型(即unsigned long int),而max()函数需要两个参数类型一致。解决方案包括将res定义为size_t类型或将word.size()强制转换为int类型。文章提供了修改后的代码示例,帮助读者理解并解决类似问题。
Java 泛型总结(二):泛型与数组
数组与泛型的关系还是有点复杂的,Java 中不允许直接创建泛型数组。本文分析了其中原因并且总结了一些创建泛型数组的方式。具有很好的参考价值。下面跟着小编一起来看下吧
MATLAB下批量读入图片(以JPG示例) (2).pdf
。。。


语言基础/算法/系统设计
