首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Masm32 winApi函数IsWindows10OrGreater未被识别

Masm32 winApi函数IsWindows10OrGreater未被识别
EN

Stack Overflow用户
提问于 2022-10-12 17:17:07
回答 1查看 87关注 0票数 1

我试图在winApi函数IsWindows10OrGreater中调用Masm32,但得到了错误LNK2001:未解析的外部符号_IsWindows10OrGreater@0。我还试图在visual .asm中调用此函数,但结果是相等的。为什么masm不认识这个函数?我试着用C代码调用这个函数,它可以工作。这是我的代码:

代码语言:javascript
复制
.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 
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-10-12 18:09:21

查看文档 for IsWindows10OrGreater,我们看到函数是在versionhelpers.h中定义的。在versionhelpers.h中,我们看到函数不是在库中定义的。它就写在versionhelpers.h中,其中IsWindows10OrGreater调用了IsWindowsVersionOrGreater,而后者又调用了VerifyVersionInfoW

因此,在任何名为IsWindows10OrGreater的库中都没有符号,这就解释了为什么链接器没有找到它。您应该能够从这些函数中重新创建逻辑,并直接调用VerifyVersionInfoW,这是导出的(来自Kernel32.lib)。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74045729

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档