【发布时间】:2022-11-07 17:23:08
【问题描述】:
我试图在 Masm32 中调用 winApi 函数 IsWindows10OrGreater,但出现错误 LNK2001:未解析的外部符号 _IsWindows10OrGreater@0。我也尝试在visual studio .asm中调用这个函数,但是结果是一样的。为什么 masm 不能识别这个函数?我试图用 C 代码调用这个函数,它可以工作。 这是我的代码:
.686
.model flat, STDCALL
option casemap :none
include D:\masm32\include\windows.inc
include D:\masm32\macros\macros.asm
include D:\masm32\include\masm32.inc
include D:\masm32\include\gdi32.inc
include D:\masm32\include\user32.inc
include D:\masm32\include\kernel32.inc
include D:\masm32\include\ntdll.inc
includelib D:\masm32\lib\masm32.lib
includelib D:\masm32\lib\gdi32.lib
includelib D:\masm32\lib\user32.lib
includelib D:\masm32\lib\kernel32.lib
includelib D:\masm32\lib\ntdll.lib
IsWindows10OrGreater proto STDCALL
MessageBoxA proto STDCALL, h : DWORD, lpText : DWORD, LPCSTR : DWORD, UINT : DWORD
ExitProcess proto STDCALL, uExitCode : DWORD
.data
buflen dd 256
hello_title db ' Lab ', 0
hello_message db 'IsWindows10OrGreater: '
.code
Start:
call IsWindows10OrGreater
push 40h
push offset hello_title
push offset hello_message
push 0
call MessageBoxA
push 0
call ExitProcess
end Start
【问题讨论】: