views:

70

answers:

2

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.

A: 

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.

foxwoods
+1  A: 

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.

Luca Farber
I'm using http://www.vb-decompiler.orgWill try out your suggestion tonight, thanks.
FerretallicA
I don't think it passes raw values for height/width/etc, it's enumerated, so I can't find where I need to be changing.
FerretallicA