AccessingMSVBVM60APIfromVBIDE. I'mwritingthismoreasaninformativethingthanarealusefultechnique.I'mgonnatrytoexplainhow topatch/modvbfilesinordertohaveaccesstoanyAPIexportedbyMSVBVM60withoutdeclaringor addinganythingelsetoyourproject. ThetoolsI'mgoingtobeusingtodothisare: 1PEExplorer PEExploreristhemostfeaturepackedprogramforinspectingtheinnerworkingsofyourown software,andmoreimportantly,thirdpartyWindowsapplicationsandlibrariesforwhichyoudonot havesourcecode. Link:[Link] 2TypeLibraryEditor ThePowerVBTypeLibraryEditorcontrolisusedinallofthetypelibraryeditingtoolsprovidedwith AdvancedVisualBasic6:[Link] isessentiallythesameregardlessoftheexe/addinthatthecontrolishostedin.
Theeditingoperations fallintotwocategories,thosedonebyeditingfieldsintherighthandsideofthecontrol,and [Link] menucommandsforeachtypeofselection. Link:[Link] [Link](locatedinthesytem32 folder)[Link],File>Open>navigatetothe [Link],oncewehavethefileopenwegotoview>exportor Ctrl+E. [Link] commonlyusedinvbandwelldocumented,[Link] aboutthem.
[Link],navigatetoyourdesktopandcreatea foldercalledMSVBVM_Testandsavethetextfilethere.NowwecanclosePEExp. BeforestartmoddingourVB,IhighlyrecommendtoinstalltheSP6becauseifyouinstallthispatch lateritwilloverwriteallourwork. [Link],[Link] abackupofit,justincasesomethinggoeswrongorwewanttorestoreourVB. Letsstartwithasimplechange,closeallVBinstancesthatmightberunning,nowopenTypeLibrary Editor,File>Open>[Link]. Youshouldseesomethinglikethis
NowletssavetheTLBinthefolderwecreatedpreviouslyinthedesktopMSVBVM_Testnamethe [Link]. [Link] newconstanttoVBcalledvbQuotethisnewconstantwillrepresenta,inthatwaywecanuse vbQuoteinsteadofchr$(34)or.
GotothelefthadsidetreeviewandfindamodulecalledConstants,Expandthatmoduleandyouwill seeabunchofknownVBconstants(vbBack,vbCr,etc).RightClickontheconstantmoduleandclick AddConstantthiswilladdanewconstantcalledConstant1. NowselectthatconstantRightClick>[Link] typeLPSTRandintheConstantValuefieldtype,clickupdateandsavethefile.
Itshouldlooklikethis
[Link]>Open>naviagteto [Link],View>ResourcesorCtrl+R
SelectthefirstTypeLibrary. ClickResourceEditor NavigatetotheTLBfilelocatedinthefolderwecreatedpreviouslyandreplacetheresourcewiththe [Link],nowyoushouldhaveanewconstantavailable.
AddingnewAPIs. Thisprocedureisprettymuchsimilartothefirstonebut,thistimeinsteadofaddingaconstantwe gonnaaddanewAPI. FirstwegonnacreateanewmoduletostoreallyournewAPIs,rightclickonVBAAddType>Module ,renamethemoduletoMemory. RightclickonthemodulejustcreatedandAddFunction>Function. NowwegonnarenamethisnewfunctiontoGetByte,thisisgonnabeacalltoGetMem1exportedby MSVBVM60,InthispictureyoucanseeI'musingtheordinal#317(checkthetextwesavedatthe beginningwithalltheexportedfunctionstoverifythis)
Atthispointyoujustneedtosaveandrepeatthefirstprocessagain(replaceTLB),thisisself explanatory,butI'mpastingsomemorescreencapssoyoucanseeallthevalues.
Usingthistechniqueyoucanaddawholesetofmemoryfunctions,oranyotherapiyouwantfrom MSVBVM60. Well,IhopeyoufindthisusefuloratleastFUNNY! Havefunk!Cobein.