包含 MASM 的文件
Include Files for MASM
因此,多年来,MASM 的使用方式似乎已经改变了大约 50 次,因为我找到了大量的答案,但没有一个有效。
我想知道的是如何在 MASM 上调用类似 exitprocess 的东西?我 include/where 是什么文件?我正在使用 VS2015 社区版中内置的 ml.exe。我的根驱动器或 VS 上都没有 MASM 文件夹。 VS 不附带任何 .inc 文件(我 运行 在驱动器上进行了详尽的搜索)。我只想做一些简单的事情:
.386
.model flat, stdcall
option casemap:none
includelib ?????????????
include ?????????????
.data
.code
start:
invoke ExitProcess,0
end start
我试过只包含 msvcrt.lib 但这也不起作用。
希望有人有更好的答案,但我通过从该站点安装 MASM 来修复。它将 masm32 文件夹放在根目录中(对于我们大多数人来说是 C:\)
http://www.masm32.com/download.htm
编辑:此外,.inc 文件只是一堆函数原型。因此,您可以只对想要的任何函数进行原型设计,然后使用 includelib 来调用它。
http://win32assembly.programminghorizon.com/tut2.html
In our example above, we call a function exported by kernel32.dll, so we need to include the function prototypes from kernel32.dll. That file is kernel32.inc. If you open it with a text editor, you will see that it's full of function prototypes for kernel32.dll. If you don't include kernel32.inc, you can still call ExitProcess but only with simple call syntax. You won't be able to invoke the function. The point here is that: in order to invoke a function, you have to put its function prototype somewhere in the source code. In the above example, if you don't include kernel32.inc, you can define the function prototype for ExitProcess anywhere in the source code above the invoke command and it will work. The include files are there to save you the work of typing out the prototypes yourself so use them whenever you can.
.386
.model flat, stdcall
option casemap:none
include C:\masm32\include\windows.inc
include C:\masm32\include\kernel32.inc
includelib C:\masm32\lib\kernel32.lib
.data
.code
start:
invoke ExitProcess,0
end start
但我可以轻松删除包含的内容:
.386
.model flat, stdcall
option casemap:none
includelib C:\masm32\lib\kernel32.lib
.data
.code
start:
ExitProcess PROTO STDCALL :DWORD
invoke ExitProcess,0
end start
因此,多年来,MASM 的使用方式似乎已经改变了大约 50 次,因为我找到了大量的答案,但没有一个有效。
我想知道的是如何在 MASM 上调用类似 exitprocess 的东西?我 include/where 是什么文件?我正在使用 VS2015 社区版中内置的 ml.exe。我的根驱动器或 VS 上都没有 MASM 文件夹。 VS 不附带任何 .inc 文件(我 运行 在驱动器上进行了详尽的搜索)。我只想做一些简单的事情:
.386
.model flat, stdcall
option casemap:none
includelib ?????????????
include ?????????????
.data
.code
start:
invoke ExitProcess,0
end start
我试过只包含 msvcrt.lib 但这也不起作用。
希望有人有更好的答案,但我通过从该站点安装 MASM 来修复。它将 masm32 文件夹放在根目录中(对于我们大多数人来说是 C:\)
http://www.masm32.com/download.htm
编辑:此外,.inc 文件只是一堆函数原型。因此,您可以只对想要的任何函数进行原型设计,然后使用 includelib 来调用它。
http://win32assembly.programminghorizon.com/tut2.html
In our example above, we call a function exported by kernel32.dll, so we need to include the function prototypes from kernel32.dll. That file is kernel32.inc. If you open it with a text editor, you will see that it's full of function prototypes for kernel32.dll. If you don't include kernel32.inc, you can still call ExitProcess but only with simple call syntax. You won't be able to invoke the function. The point here is that: in order to invoke a function, you have to put its function prototype somewhere in the source code. In the above example, if you don't include kernel32.inc, you can define the function prototype for ExitProcess anywhere in the source code above the invoke command and it will work. The include files are there to save you the work of typing out the prototypes yourself so use them whenever you can.
.386
.model flat, stdcall
option casemap:none
include C:\masm32\include\windows.inc
include C:\masm32\include\kernel32.inc
includelib C:\masm32\lib\kernel32.lib
.data
.code
start:
invoke ExitProcess,0
end start
但我可以轻松删除包含的内容:
.386
.model flat, stdcall
option casemap:none
includelib C:\masm32\lib\kernel32.lib
.data
.code
start:
ExitProcess PROTO STDCALL :DWORD
invoke ExitProcess,0
end start