c语言ml不是内部或外部命令,MASM32汇编错误 - C:\ masm32 \ bin \ ml.exe不是有效的Win32应用程序(MASM32 Assembling error - C:\mas...

MASM32汇编错误 - C:\ masm32 \ bin \ ml.exe不是有效的Win32应用程序(MASM32 Assembling error - C:\masm32\bin\ml.exe is not a valid Win32 application)

想要学习一些Assembly程序,我安装了MASM32 SDK 。 之后,我跟着这个视频 。 所以,在创建我的第一个asm文件后,我通过命令提示符导航到它的文件夹,然后输入:

\masm32\bin\ml /c /Zd /coff [name of my asm file]

就像这个人在2:40在视频中所做的那样。

此时,不是获得成功的组装信息,而是弹出一个窗口,告诉我:

C:\masm32\bin\ml.exe is not a valid Win32 application

我为什么得到这个? 我该如何解决?

我的操作系统是64位Windows 7。

Wanting to learn some Assembly programming, I installed the MASM32 SDK. After that, I followed this video. So, after creating my first asm file, I navigated to its folder through the command prompt, then typed:

\masm32\bin\ml /c /Zd /coff [name of my asm file]

just as the guy does at 2:40 in the video.

At this point, instead of getting the successful Assembling message, a window pops up, telling me that:

C:\masm32\bin\ml.exe is not a valid Win32 application

Why am I getting this? How can I solve?

My OS is 64 bit Windows 7.

原文:https://stackoverflow.com/questions/48785773

更新时间:2019-12-20 08:47

最满意答案

通过重新安装MASM32 SDK(相同的install.exe)解决。 要卸载,只需删除/ masm32文件夹。 Margaret Bloom建议的解决方案。

Solved by reinstalling the MASM32 SDK (same install.exe). To uninstall, simply delete the /masm32 folder. Solution suggested by Margaret Bloom.

2018-02-15

相关问答

换言之:我如何用马铃薯给自行车轮胎充气? 你的程序集是16位,你的目标是MS-DOS( int21调用是赠品)。 VS2013和MASM32都不能生成DOS可执行文件。 尝试不同的汇编程序,即NASM。 或者,阅读现代装配。 To paraphrase: how do I inflate a bicycle tire with a potato? Your assembly is 16-bit, and you're targeting MS-DOS (the int21 call is a gi

...

你需要有一个“退出”来结束你的应用程序。 另外,我的个人风格是将所有内容都放在一个子程序中,但这只是我。 就像是: .code 开始: call main

inkey

exit

主要过程 mov loop_stopper,2

loop_start:

invoke StdOut, addr ProgramText

cmp loop_stopper, 0

dec loop_stopper

jg loop_start

ret

主要endp 结束开始 You need to hav

...

MASM32 不是 Visual Studio的一部分,MASM是。 如果您在一个驱动器上安装了MASM32,但您的项目/源位于另一个驱动器上,那么相对路径如何工作? 即include masm32\includes如果是这种情况,那么你必须使用绝对路径,即D:\masm32\includes\masm32rt.inc 我不使用VS,但它应该有一个选项来设置包含路径,然后它会将此路径传递给ml的命令行以搜索包含。 MASM32 is NOT part of Visual Studio, MASM

...

通过重新安装MASM32 SDK(相同的install.exe)解决。 要卸载,只需删除/ masm32文件夹。 Margaret Bloom建议的解决方案。 Solved by reinstalling the MASM32 SDK (same install.exe). To uninstall, simply delete the /masm32 folder. Solution suggested by Margaret Bloom.

代码段不可写,因此如果在代码段中定义字符串,则默认情况下无法写入该字符串。 您必须在数据段中声明它,或者您必须修改代码段的权限才能写入它。 A code segment is not writable, so if you define a string in the code segment you can not write to it, by default. You either have to declare it in the data segment, or you must mod

...

首先, myvar db 52在错误的地方。 程序启动时,计算机进入db 52并将其视为指令。 其次,0值(不要说字符)不是StdOut的参数,并且必须位于数据的末尾。 StdOut需要一个指向零终止字符串的指针作为参数。 你不能给它一个直接的值,函数会把它作为指针。 BTW:考虑StdOut是MASM32的函数,而不是Windows内核的函数。 你的程序应该是这样的: include c:\masm32\include\masm32rt.inc

.data

myvar db 52, 0

...

好吧,你肯定不想使用Segmented链接器,这适用于16位代码。 继续使用Incremental Linker Version 5.12.8078 那么,你得到一个obj文件? 这就是ML.exe的功能。 它是MASM汇编程序,它会将您的代码汇编到一个obj文件中,并传递给您选择的链接器以创建exe。 我说你选择的链接器,因为有一些链接器你可以使用它们各有利弊。 要创建目标文件: ml /c /coff /Cp sample.asm /c选项告诉ml仅汇编而不是尝试链接 /Cp选项告诉ml保留所

...

OP说: 一旦编译了这段代码,我将用有效的地址替换00000000h地址。 一旦编译代码,ASM代码中的地址的存在就是保持相同数量的操作码 那你可能想写的是: my_jump:

jmp near ptr $ ; produces a 4 byte long relative jump instruction that jmps-to-self

当你知道你希望它跳转的目标地址,并在eax中加载了该地址时,你可以编码: mov eax, .... ; desi

...

首先,您获取示例代码的链接来自NASM用户,他可能从未使用MASM,就像他说的那样。 他还像NASM格式一样写了他的MASM样本。 您想要使用Assembly的事实意味着您必须是高级计算机用户。 您需要知道如何使用批处理文件,如何设置系统路径和其他东西。 当出现问题时,你会通过研究来学习。 所以你得到一个错误,说它找不到masm32rt.inc,但你说你正在使用MASM32。 我使用批处理文件和IDE进行汇编,我的系统路径指向MASM32中的各种目录。 在masm32rt.inc之前添加masm3

...

为什么不呢? 它很简单,简单如下: .486

.model flat, stdcall

option casemap:none

include \masm32\include\masm32.inc

include \masm32\include\kernel32.inc

include \masm32\include\user32.inc

include sqlite3.inc

.data

szSQLDB db "MyDB.db3", 0

szRandQuery db

...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值