您好,欢迎访问三七文档
当前位置:首页 > IT计算机/网络 > 数据库 > Windows动态链接库原理分析及其应用
3112004JOURNALOFBEIJINGUNIVERSITYOFCHEMICALTECHNOLOGYVol.31,No.12004Windows(,100029):Windows(DLL),DLL,,:;Windows;;:TP313:2003205229:,1978,E2mail:xionghua2008@yahoo.com.cnWindows(98/2000/XP),,WindowsDLL,Windows,3DLLKernal32.dll(),GDI32.dll()User32.dll()[122]Win32(API)DLLWDMWindows(Windows98Windows2000/XP,VxD),DLL,()DLLDLLWin2dows1DLLDLL,DLLDLL,:(1)DLL,,DLL(2)DLLWindows,DLL(3)DLL,DLLVB,VCDLL(4)DLL;,DLL,(5)(VB),DLL,,,2DLLDLL,,EXEDLL,Main(),WindowsWinMain(),DriverEntry(),DLLDllMain(),,DLLDLL,DLL,DLL,DLL211,,,,[3]11Fig.1Staticlink,DLL,(),[3]22Fig.2Dynamiclink212DLL2:1)DLL()DLL,DLL,DLLDLL,DLL()DLLLIB,LIBDLL(LIB,DLL,,LIB,,DLL)LIBEXEDLL,DLL2)DLL(),DLL,(DLLDLL)DLL,DLL(),DLL,DLLDLL(DLL,),DLL,,DLL213DLL,,DLLDLL:1)DLLDLL,,DLL,DLL;0,DLL2)DLLDLL,0,DLL,DLL,DLLDLL,21;DLL,21DLL,DLL,DLL,214DLLDLLDLL,DLL[3]33DLL(TC,BC,BCB,VC)DLL,VC,MFC(MicrosoftFoundationClasses),VCDLLVC00120043DLLFig.3AddressspacemappingbetweenDLLandprocess4:MFCDLL,MFCDLL,MFCDLL,MFCDLL311MFCDLLMFCDLLMFC,DLLMFC,DLLMFCDLL,,Win32Dynamic2LinkLibrary:AnemptyDLLproject,3.cpp,3.h,3.def;AsimpleDLLprojectDllMain,;ADLLthatexportssomesymbolsDllMain,,312MFCDLLDLLMFC,MFCDLLMFCDLLMFC,MFC,DLL,MFC,DLLMFC,MFCDLLCWinApp,,,DLLDLL,CWinAppPreTranslateMessage()DLLDLL,DLLDLLMFC313MFCDLLMFCDLLMFCDLL,MFC(MFC3.dll),MFC3.dllDLL,MFC3.dll,AFX-MANAGE-STATE,314MFCDLLMFCDLLMFC,MFC,MFC3.dllDLLMFCDLL315DLL,3.def(MSDN),,3.h3.cppEXE(),(1)3.def,:GlbVar2Name@1DATA;,:-declspec(dllexport)intGlbVarName;(2)3.def,:GlbFunc2tionName@1;,:-declspec(dllex2port)intGlbFunctionName(intpar1,intpar2);(3):3.def,:GlbClassName@1;,:class-declspec(dllexport)GlbClassName{}316DLL,[4](1)DLL:DLL()LIB()()DLL,LIB,DLL,DLLDLL,DLL-API,DLLDLL-EXPORTS,DLLDLL-EXPORTS,#ifdefDLL-EXPORTS#defineDLL-API1011:Windows-declspec(dllexport)#else#defineDLL-API-declspec(dl2limport)#endif(2)APIDLL,LoadLi2brary()DLL,FreeLibrary()DLL,GetPro2cAddress()DLL[5]floatresult;typedeffloat(CALLBACK3Function)(float,float);HINSTANCEhDLL=LoadLibrary(DLL1.dll);if(hDLL!=NULL){Functionfun=(Function)GetProcAddress(hDLL,AddFunction);if(fun!=NULL){result=fun(310,415);}FreeLibrary(hDLL);},DLLC(-cdecl),DLLC++,DLLC++,-stdcall,float-stdcallAddFunction(floatx,floaty){return(x+y);}4DLL,DLL,CAIBPDLL,,,,,VBDLLDLL,[1],,,.Windows[M].:,2000[2]SolomonDA,RussinovichM.Insidemicrosoftwindows2000[M].Washington:MicrosoftPress,2000[3],,,.Windows[M].:,2001[4],,,.VBVCWin32DLL[J].,2002,28(4):285[5].WINDOWS[J].(),2002,26(1):51-55TheoreticanalysisandapplicationofwindowsdynamiclinklibraryXiongHuaLiuFeng2xinPanXiao2li(CollegeofInformationScienceandTechnology,BeijingUniversityofChemicalTechnology,Beijing100029,China)Abstract:TheinternaltheoryofWindowsdynamiclinklibrary(DLL)wasanalyzed.VariouscharacteristicsofDLLsuchasdynamiclinking,memoryaddressmappingandreferencecountingwereexplained.ThemethodandtechniqueofdesigningandusingDLLwereproposed,prodidingatechnicalsupportforengineersindesign2ingWindowsdynamiclinklibrary.Keywords:dynamiclinklibrary;advancedWindowsapplication;memoryaddressmapping;dynamiclinking()2012004
本文标题:Windows动态链接库原理分析及其应用
链接地址:https://www.777doc.com/doc-5322941 .html