You are hereGetting Older Code to Run on Windows 7 (Problems with DEP)

Getting Older Code to Run on Windows 7 (Problems with DEP)

By steve - Posted on 05 November 2010

I still develop/support software and code for some older environments such as Visual Studio 6 (VS6). In fact, two of the bigger development projects I've worked on in the last 10 years were done with VB6, so it is important that my primary environment allow me to maintain these applications.

Both of these particular apps also used itgrid6 (itgrid6.ocx) which is a super-fast grid control I licensed for development around 2003.

The problem started when I started to try to recreate my development environment in Windows 7 64-bit. During the VS6 installation, Win7 complained that the program had known instability issues, but I was able to force it through. I could also install some third-party components from Xceed as they didn't have any issues installing.

However, when I got to itgrid, the installer refused to install it with an "invalid access to memory" error and a -2147023898 error. The logs showed "itGrid6.ocx failed to register."

The problem turns out to be that itGrid6.ocx (along with a lot of other activex components from that era) are not DEP compatible. DEP (Data Execution Prevention) comes enabled and you can't disable it through the user interface. In XP SP2 and later, you can get around this by disabling DEP in the boot.ini file and rebooting with it disabled, but this wasn't available to me in Windows 7 (or Vista for that matter, which I never bothered with).

I googled around and was a little discouraged because it didn't look like there was a way to disable DEP, especially when using 64-bit Windows 7 (I read where it wasn't even possible to do--not true as I found out).

It turns out in Windows 7 you can still disable DEP, but it is a little more of a cryptic process.

This is NOT for the newbie and use this information at your own risk. I've read about people trashing their systems and having to do a complete re-install. Make a complete image of your system before attempting this. You may be able to boot into safe mode to undo this, but I make no promises.

Here's what you do...

1. Image your system. Really. Don't do step 2 until this is done.
2. Log in as administrator (not someone with administrator rights, log in as administrator).
3. Open a cmd window.
4. Type this:

bcdedit.exe /set nx AlwaysOff

This sets the boot program to boot without DEP enabled.
5. Reboot your system.
6. Install your software (in my case, itgrid6.msi). No error!
7. Open a cmd window.
8. Type this:

bcdedit.exe /set nx AlwaysOn

9. Reboot.

Supposedly, you can use:

bcdedit.exe /set {current} nx AlwaysOff

To allow a momentary session where DEP is off, but that didn't work for me. I had to set it as I described above and reboot for the program to be able to install.


Did this help you? You can help me!

Did you find this information helpful? You can help me back by linking to this page, purchasing from my sponsors, or posting a comment!

+One me on Google:

Follow me on twitter:


Affiliation Badges