当前位置: 代码迷 >> 汇编语言 >> win32汇编学习中遇到的困惑?该如何解决
  详细解决方案

win32汇编学习中遇到的困惑?该如何解决

热度:4790   发布时间:2013-02-26 00:00:00.0
win32汇编学习中遇到的困惑????????????
Assembly code
kernel32.inc声明的系统API如下Process32FirstW PROTO STDCALL :DWORD,:DWORDIFDEF __UNICODE__  Process32First equ <Process32FirstW>ENDIFProcess32NextW PROTO STDCALL :DWORD,:DWORDIFDEF __UNICODE__  Process32Next equ <Process32NextW>ENDIF我的asm文件编写如下CheckFatherProcessID procLOCAL hProc: HANDLELOCAL pe: PROCESSENTRY32mov pe.dwSize,sizeof PROCESSENTRY32invoke CreateToolhelp32Snapshot,TH32CS_SNAPPROCESS,0mov hProc,eax    mov eax,INVALID_HANDLE_VALUE.if eax == hProcxor eax,eaxret.endifinvoke Process32First,hProc,addr pe//????.while (eax);invoke StrCmpi,addr szExplorer,addr pe.szExeFileinvoke lstrcmpi, szExplorer, pe.szExeFile.if (eax == 0)push pe.th32ParentProcessIDpop dwFatherpush pe.th32ProcessIDpop dwSun.endifinvoke Process32Next,hProc,addr pe//????.endwinvoke CloseHandle,hProcpush ebxmov eax,dwFathermov ebx,dwSun.if eax == ebxxor eax,eaxpop ebxret.elsemov eax,1pop ebxret.endifretCheckFatherProcessID endpend start编译通过,链接错误Link /subsystem:windows AntiDown.obj AntiDown.resMicrosoft (R) Incremental Linker Version 5.12.8078Copyright (C) Microsoft Corp 1992-1998. All rights reserved.AntiDown.obj : error LNK2001: unresolved external symbol _Process32First@8AntiDown.obj : error LNK2001: unresolved external symbol _Process32Next@8AntiDown.exe : fatal error LNK1120: 2 unresolved externals我查了下,好像是函数调用的时候,参数传递类型不匹配。但是win32 api系统提供的的类型是两个DWORD 这个怎办转化啊什么原因啊 ????、大牛帮忙啊


------解决方案--------------------------------------------------------
使用寄存器 EAX 等
------解决方案--------------------------------------------------------
是你没定义__UNICODE__
或invoke Process32NextW
------解决方案--------------------------------------------------------
Assembly code
kernel32.inc声明的系统API如下Process32FirstW PROTO STDCALL :DWORD,:DWORDIFDEF __UNICODE__  Process32First equ <Process32FirstW>ENDIFProcess32NextW PROTO STDCALL :DWORD,:DWORDIFDEF __UNICODE__  Process32Next equ <Process32NextW>ENDIF我的asm文件编写如下CheckFatherProcessID procLOCAL hProc: HANDLELOCAL pe: PROCESSENTRY32mov pe.dwSize,sizeof PROCESSENTRY32invoke CreateToolhelp32Snapshot,TH32CS_SNAPPROCESS,0mov hProc,eax    mov eax,INVALID_HANDLE_VALUE.if eax == hProcxor eax,eaxret.endifinvoke Process32First,hProc,addr pe//????.while (eax);invoke StrCmpi,addr szExplorer,addr pe.szExeFileinvoke lstrcmpi, szExplorer, pe.szExeFile.if (eax == 0)push pe.th32ParentProcessIDpop dwFatherpush pe.th32ProcessIDpop dwSun.endifinvoke Process32Next,hProc,addr pe//????.endwinvoke CloseHandle,hProcpush ebxmov eax,dwFathermov ebx,dwSun.if eax == ebxxor eax,eaxpop ebxret.elsemov eax,1pop ebxret.endifretCheckFatherProcessID endpend start编译通过,链接错误Link /subsystem:windows AntiDown.obj AntiDown.resMicrosoft (R) Incremental Linker Version 5.12.8078Copyright (C) Microsoft Corp 1992-1998. All rights reserved.AntiDown.obj : error LNK2001: unresolved external symbol _Process32First@8AntiDown.obj : error LNK2001: unresolved external symbol _Process32Next@8AntiDown.exe : fatal error LNK1120: 2 unresolved externals
  相关解决方案