Profilo di wenjiangmorning's blogFotoBlogElenchiAltro Strumenti Guida

Blog


18 settembre

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 Files\Microsoft Visual Studio\VC98\bin\,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.


 

Commenti (1)

Attendere...
Il commento immesso è troppo lungo. Immetti un commento più breve.
Immissione non effettuata. Riprova.
Impossibile aggiungere il commento al momento. Riprova più tardi.
Per aggiungere un commento è necessaria l'autorizzazione di un genitore. Chiedi autorizzazione
I tuoi genitori hanno disattivato i commenti.
Impossibile eliminare il commento al momento. Riprova più tardi.
Hai raggiunto il numero massimo di commenti pubblicabili giornalmente. Riprova tra 24 ore.
Impossibile lasciare commenti. La funzionalità è stata disattivata perché i sistemi hanno rilevato una possibile attività di spamming dal tuo account. Se ritieni che il tuo account è stato disattivato per errore, contatta il supporto tecnico di Windows Live.
Esegui il seguente controllo di protezione per completare la pubblicazione del commento.
I caratteri digitati nel controllo di protezione devono corrispondere ai caratteri dell'immagine o della riproduzione audio.

Per aggiungere un commento, accedi con il tuo Windows Live ID (se utilizzi Hotmail, Messenger o Xbox LIVE possiedi già un Windows Live ID). Accedi


Non hai ancora un Windows Live ID? Registrati

水 水ha scritto:
= =这招狠,佩服了说!!
22 Set.

Riferimenti

L'URL di riferimento per questo intervento è:
http://ywjheart.spaces.live.com/blog/cns!2067FCA683114503!890.trak
Blog che fanno riferimento a questo intervento
  • Nessuno