资源描述:
《A_Crash_Course_on_the_Depths_of_Win32英文》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、ACrashCourseontheDepthsofWin32™StructuredExceptionHandlingAtitsheart,Win32structuredexceptionhandlingisanoperatingsystem-providedservice.Allthedocsyou'relikelytofindaboutSEHdescribeoneparticularcom-piler'sruntimelibrarywrappingaroundtheoperatingsystemimple
2、mentation.I'llstripSEHtoitsmostfundamentalconcepts.MattPietrekThisarticleassumesyou'refamiliarwithC++,Win32Codeforthisarticle:Exception.exe(33KB)MattPietrekistheauthorofWindows95SystemProgrammingSecrets(IDGBooks,1995).HeworksatNuMegaTechnologiesInc.,andcan
3、bereachedatmpietrek@tiac.com.OfallthefacilitiesprovidedbyWin32®operatingsystems,perhapsthemostwidelyusedbutunderdocumentedisstructuredexceptionhandling(SEH).WhenyouthinkofWin32structuredexceptionhandling,youprobablythinkoftermslike_try,_finally,and_except.
4、YoucanfindgooddescriptionsofSEHinjustaboutanycompetentWin32book(eventheremedialones).EventheWin32SDKhasafairlycompleteoverviewofusingstructuredexceptionhandlingwith_try,_finally,and_except.Withallthisdocumentation,wheredoIgetoffsayingthatSEHisunderdocument
5、ed?Atitsheart,Win32structuredexceptionhandlingisanoperatingsystem-providedservice.Allthedocumentationyou'relikelytofindaboutSEHdescribesoneparticularcompiler'sruntimelibrarywrappingaroundtheoperatingsystemimplementation.There'snothingmagicalaboutthekeyword
6、s_try,_finally,or_except.Microsoft'sOSandcompilergroupsdefinedthesekeywordsandwhattheydo.OtherC++compilervendorshavesimplygonealongwiththeirsemantics.WhilethecompilerSEHlayertamesthenastinessofrawoperatingsystemSEH,it'shadtheeffectofkeepingtherawoperatings
7、ystemSEHdetailsfrompublicview.I'vereceivednumerousemailmessagesfrompeoplewhohaveneededtoimplementcompiler-levelSEHandcouldn'tfindmuchinthewayofdocumentationfortheoperatingsystemfacilities.Inarationalworld,I'dbeabletopointtotheruntimelibrarysourcesforVisual
8、C++orBorlandC++andbedonewithit.Alas,forsomeunknownreason,compiler-levelSEHseemstobeabigsecret.NeitherMicrosoftnorBorlandprovidethesourcecodefortheinnermostlayeroftheirSEHsupport.Inthisarticle,I'llstripstructu