修复无源硬编码显示设置(24 位,需要 32 位)
大约 10 年前,我用 Visual Basic 6 编写了一个程序,该程序基本上是一个类似于 Breakout / Arkanoid 的全屏游戏,但具有“demoscene”风格的背景。我找到了程序,但没有找到源代码。当时我将显示模式硬编码为 800x600x24,结果每当我尝试运行它时程序就会崩溃。当主机显示模式为16/32位时,似乎没有虚拟机支持24位显示。它使用 DirectX 7,因此 DOSBox 没有用。
我尝试过各种反编译器,最多他们给我表单名称和一堆汇编调用,这对我来说毫无意义。显示模式设置是 DirectX 7 调用,但反编译中没有明确引用它。
在这种情况下,是否有任何指示我可以如何:
精确定位程序中将显示模式设置为 800x600x24(可能是 ResHacker?)的函数调用,并更改传递给它的值,使其设置为 800x600x32
查看/拦截正在执行的 DirectX 调用运行
,或者如果不可能,至少
- 在模拟 24 位显示的环境中运行该程序,
我需要恢复源代码(尽可能好)只是想让它运行。
I wrote a program about 10 years ago in Visual Basic 6 which was basically a full-screen game similar to Breakout / Arkanoid but had 'demoscene'-style backgrounds. I found the program, but not the source code. Back then I hard-coded the display mode to 800x600x24, and the program crashes whenever I try to run it as a result. No virtual machine seems to support 24-bit display when the host display mode is 16/32-bit. It uses DirectX 7 so DOSBox is no use.
I've tried all sorts of decompiler and at best they give me the form names and a bunch of assembly calls which mean nothing to me. The display mode setting was a DirectX 7 call but there's no clear reference to it in the decompilation.
In this situation, is there any pointers on how I can:
pin-point the function call in the program which is setting the display mode to 800x600x24 (ResHacker maybe?) and change the value being passed to it so it sets 800x600x32
view/intercept DirectX calls being made while it's running
or if that's not possible, at least
- run the program in an environment that emulates a 24-bit display
I don't need to recover the source code (as nice as it would be) so much as just want to get it running.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在反汇编程序中尝试的一种技术是搜索您记住的常量,但作为可执行文件中包含的实际字节。我猜您使用了 DirectDraw SetDisplayMode 调用,它是一个 COM 对象,因此无法轻松地追踪到 DLL 中的入口点或从 DLL 中的入口点追踪。它采用宽度、高度和每像素位数的参数,它们是 DWORD(32 位),因此搜索“58 02 00 00”、“20 03 00 00”和“18 00 00 00”。希望这能将范围缩小到您需要更改的内容。
顺便问一下,您使用的是哪种反汇编程序?
如果您的 VB6 程序编译为 p 代码而不是本机代码,则这种方法可能会有些复杂,因为您只会获得代表程序的大量数据,而不是有用的汇编指令。
One technique you could try in your disassembler is to do a search for the constants you remember, but as the actual bytes that would be contained within the executable. I guess you used the DirectDraw SetDisplayMode call, which is a COM object so can't be as easily traced to/from an entry point in a DLL. It takes parameters for width, height and bits per pixel and they are DWORDs (32-bit) so do a search for "58 02 00 00", "20 03 00 00" and "18 00 00 00". Hopefully that will narrow it down to what you need to change.
By the way which disassembler are you using?
This approach may be complicated somewhat if your VB6 program compiled to p-code rather than native code as you'll just get a huge chunk of data that represents the program rather than useful assembler instructions.
检查一下:
http://www.sevenforums.com/tutorials/ 258-color-bit-depth-display-settings.html
如果你的显卡没有 24 位显示的条目......我想破解你的代码是唯一的可能性。或者找一台旧机器来安装 Windows 95 :P。
Check this:
http://www.sevenforums.com/tutorials/258-color-bit-depth-display-settings.html
If your graphics card doesn't have an entry for 24-bit display....I guess hacking your code's the only possibility. That or finding an old machine to throw windows 95 on :P.