0% found this document useful (0 votes)
425 views

Accessing Msvbvm60 API

This document describes how to modify VB files to access APIs exported by MSVBVM60 without declaring or adding references. It involves using PE Explorer to view exported functions from MSVBVM60.dll and Type Library Editor to modify VBA6.DLL. As an example, it shows how to add a new constant called vbQuote and a new function called GetByte that calls an exported API. The process involves modifying the type library, replacing the resource in VBA6.DLL with PE Explorer, and then the new API/constant can be accessed from VB.

Uploaded by

Alexander Mejia
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
425 views

Accessing Msvbvm60 API

This document describes how to modify VB files to access APIs exported by MSVBVM60 without declaring or adding references. It involves using PE Explorer to view exported functions from MSVBVM60.dll and Type Library Editor to modify VBA6.DLL. As an example, it shows how to add a new constant called vbQuote and a new function called GetByte that calls an exported API. The process involves modifying the type library, replacing the resource in VBA6.DLL with PE Explorer, and then the new API/constant can be accessed from VB.

Uploaded by

Alexander Mejia
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

AccessingMSVBVM60APIfromVBIDE. I'mwritingthismoreasaninformativethingthanarealusefultechnique.I'mgonnatrytoexplainhow topatch/modvbfilesinordertohaveaccesstoanyAPIexportedbyMSVBVM60withoutdeclaringor addinganythingelsetoyourproject. ThetoolsI'mgoingtobeusingtodothisare: 1PEExplorer PEExploreristhemostfeaturepackedprogramforinspectingtheinnerworkingsofyourown software,andmoreimportantly,thirdpartyWindowsapplicationsandlibrariesforwhichyoudonot havesourcecode. Link:http://www.heaventools.com/ 2TypeLibraryEditor ThePowerVBTypeLibraryEditorcontrolisusedinallofthetypelibraryeditingtoolsprovidedwith AdvancedVisualBasic6:PowerTechniquesforEverydayPrograms.Editingelementsinatypelibrary isessentiallythesameregardlessoftheexe/addinthatthecontrolishostedin.

Theeditingoperations fallintotwocategories,thosedonebyeditingfieldsintherighthandsideofthecontrol,and commandsexecutedfromthecontextmenuinthetreecontrol.Thisdocumentexplainsthecontext menucommandsforeachtypeofselection. Link:http://www.powervb.com/ Letsstartwiththis.ThefirstthingwehavetodoisfindMSVBVM60.dll(locatedinthesytem32 folder)andseewhatfunctionsexports.TodothisopenPEExplorer,File>Open>navigatetothe system32folderandselectMSVBVM60.dll,oncewehavethefileopenwegotoview>exportor Ctrl+E. Youshouldseealistwithalltheexportedfunctionsantheirordinals.Someofthisfunctionsare commonlyusedinvbandwelldocumented,butmostofthemareamystery.YoucanGoogleforinfo aboutthem.

Letssavethisinfoforfutureuse.Clickonsavesyntaxdetails,navigatetoyourdesktopandcreatea foldercalledMSVBVM_Testandsavethetextfilethere.NowwecanclosePEExp. BeforestartmoddingourVB,IhighlyrecommendtoinstalltheSP6becauseifyouinstallthispatch lateritwilloverwriteallourwork. Timetostartdoingfunnystuff.FirstnavigatetoyouVBfolder,findafilecalledVBA6.DLLandmake abackupofit,justincasesomethinggoeswrongorwewanttorestoreourVB. Letsstartwithasimplechange,closeallVBinstancesthatmightberunning,nowopenTypeLibrary Editor,File>Open>navigatetotheVBfolderandselectVBA6.DLL. Youshouldseesomethinglikethis

NowletssavetheTLBinthefolderwecreatedpreviouslyinthedesktopMSVBVM_Testnamethe fileVBA6.tlb. Forthefirstmodwegonnadosomethingsimpleinordertounderstandhowitworks.Wegonnaadda newconstanttoVBcalledvbQuotethisnewconstantwillrepresenta,inthatwaywecanuse vbQuoteinsteadofchr$(34)or.

GotothelefthadsidetreeviewandfindamodulecalledConstants,Expandthatmoduleandyouwill seeabunchofknownVBconstants(vbBack,vbCr,etc).RightClickontheconstantmoduleandclick AddConstantthiswilladdanewconstantcalledConstant1. NowselectthatconstantRightClick>RenameandtypevbQuote.Ontherightpanelchooseconstant typeLPSTRandintheConstantValuefieldtype,clickupdateandsavethefile.

Itshouldlooklikethis

IstimetoupdatetheVBA6.DLLfiletoreflectthechanges.OpenPEExplorerFile>Open>naviagteto theVBfolderandselectVBA6.DLLnowopentheresourceview,View>ResourcesorCtrl+R

SelectthefirstTypeLibrary. ClickResourceEditor NavigatetotheTLBfilelocatedinthefolderwecreatedpreviouslyandreplacetheresourcewiththe newfile.ClosePEExplorerandrunyourVB,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.

You might also like