如果我知道机器代码,如何使用C ++编写.Com文件? [英] How Do I Write .Com File Using C++ If I Know The Machine Code?
本文介绍了如果我知道机器代码,如何使用C ++编写.Com文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用C ++创建.com文件。我已经知道HEX中的机器代码了。例如,打印'A',机器代码是:
B2 41 B4 02 CD 21 CD 20
然后,当我编译时,它会自动创建新的.com文件,它将打印'A'。我知道这听起来像编译器。
机器代码是否写入二进制文件?或者如何?
我们将不胜感激。
谢谢,
-Rudy
解决方案
您可以使用二进制文件写入任何文件:只需使用文件流从缓冲区写入字节。
扩展名是文件名的一部分,是全部 - 它不是特定于任何设置的应用程序。
但是..你在这里可能要小心:在生产中,这很可能被反病毒产品归类为可能的病毒活动 - 所以你需要一个很好的理由来做到这一点! :笑:
I want to create .com file using C++. I already know the machine code in HEX. For example to print 'A', the machine code is:
B2 41 B4 02 CD 21 CD 20
Then, when i compile, it is automatically created new .com file which will print 'A'. I know this will sounds like compiler.
Are the machine code write to binary files? or how?
Any response will be appreciated.
Thanks,
-Rudy
解决方案
You can write to any file using binary: just write the bytes from a buffer using a file stream.
The extension is part of the filename, is all - it isn't specific to any "set" of applications.
But...you may want to be careful here: in production this is likely to be classed as "probable virus activity" by antivirus products - so you will need a damn good reason to do this! :laugh:
这篇关于如果我知道机器代码,如何使用C ++编写.Com文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文