Using the Optimizing VC7 compiler with the VC6 IDE,with DEBUGGING

Using the Optimizing VC7 compiler with the VC6 IDE,with DEBUGGING

2009.09.18
By: morning.ye
you may contact him at: ywjheart ## gmail.com (replace ## to @)

from the source of atl/mfc in vc7x series,wo can see something interesting,that vc7 is able to output pdb files in the format used in vc6,the options is as following:
cl.exe:  /Zvc6
link.exe: /debugtype:vc6

however,vc7 toolset refuse the options if we add to commandline.
They lie to us,in fact,after debugging,we know M$ close the interface in commandline,but leave the functions in binaries.
OK,let’s patch the toolset,in order to reenable the capability we need.

prepares:
1.install vc2003toolkit(any vc2003 edition is ok,and psdk/ddk 2003 also has these files),i’ll use the toolset unpack from vc2003sp1,it’s the lastest version.
copy the following files to C:Program FilesMicrosoft Visual StudioVC98bin,don’t forget to backup files from vc6!
msobj71.dll
c1.dll
c1xx.dll
c2.dll
cl.exe
link.exe
2. take a copy of the mspdb60.dll from PSDK/DDK2003,its version should equal to 6.2
3. hex editor

start patch:
1.1 modify the compiler front end
c1.dll in offset 78a11,change 0 to 1;
c1xx.dll in offset 18D3B1,change 0 to 1;
1.2 modify the compiler back end
c2.dll in offset 744C,change 1D to 3D;

2. modify the linker
link.exe
from 2a4dc to 2a4e7
original:  8A 98 60 01 00 00 84 DB
after patch: B3 01 88 98 60 01 00 00

3.open c1.dll,c1xx.dll,c2.dll,cl.exe,link.exe in a hex editor
replace all string "mspdb71.dll" to "mspdb60.dll"

4.in link.exe,search the string ?Open@PDB@@SAHPBD0KPAJQADPAPAU1@@Z ,and change it to ?Open@PDB@@SAHPAD0KPAJQADPAPAU1@@Z

5.copy the mspdb60.dll v6.2 to bin folder.

all done.now you can new a console project, and build the debug configuration,open the output file in a hex editor,you can find the  signature of  the old pdb format,"NB10",set a break in the function "main",and press F5, after break,you can see variables,callstack,and etc.

 

Advertisements

One thought on “Using the Optimizing VC7 compiler with the VC6 IDE,with DEBUGGING

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s