我試圖在 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
uj5u.com熱心網友回復:
查看 IsWindows10OrGreater的檔案,我們看到該函式在 versionhelpers.h 中定義。查看 versionhelpers.h,我們看到該函式未在庫中定義。它寫在 versionhelpers.h 中,其中 IsWindows10OrGreater 呼叫 IsWindowsVersionOrGreater,后者又呼叫VerifyVersionInfoW。
所以在任何名為 IsWindows10OrGreater 的庫中都沒有符號,這就解釋了為什么聯結器找不到它。您應該能夠從這些函式重新創建邏輯并直接呼叫VerifyVersionInfoW,它是匯出的(從Kernel32.lib)。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/515595.html
標籤:温纳皮masm32
