winnt.h 188 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836
  1. /**
  2. * This file has no copyright assigned and is placed in the Public Domain.
  3. * This file is part of the w64 mingw-runtime package.
  4. * No warranty is given; refer to the file DISCLAIMER within this package.
  5. */
  6. #ifndef _WINNT_
  7. #define _WINNT_
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. #include <ctype.h>
  12. #define ANYSIZE_ARRAY 1
  13. //gr #include <specstrings.h>
  14. #define RESTRICTED_POINTER
  15. #ifndef __CRT_UNALIGNED
  16. #define __CRT_UNALIGNED
  17. #endif
  18. #if defined(__ia64__) || defined(__x86_64)
  19. #define UNALIGNED __CRT_UNALIGNED
  20. #ifdef _WIN64
  21. #define UNALIGNED64 __CRT_UNALIGNED
  22. #else
  23. #define UNALIGNED64
  24. #endif
  25. #else
  26. #define UNALIGNED
  27. #define UNALIGNED64
  28. #endif
  29. #if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) && (defined(_X86_) && !defined(__x86_64))
  30. #define I_X86_
  31. #endif
  32. #if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(__x86_64)
  33. #define _AMD64_
  34. #endif
  35. #if !defined(I_X86_) && !(defined(_X86_) && !defined(__x86_64)) && !defined(_AMD64_) && defined(__ia64__)
  36. #if !defined(_IA64_)
  37. #define _IA64_
  38. #endif
  39. #endif
  40. #ifdef _WIN64
  41. #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
  42. #define MEMORY_ALLOCATION_ALIGNMENT 16
  43. #else
  44. #define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
  45. #define MEMORY_ALLOCATION_ALIGNMENT 8
  46. #endif
  47. #ifdef __cplusplus
  48. #define TYPE_ALIGNMENT(t) __alignof__ (t)
  49. #else
  50. #define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; },test)
  51. #endif
  52. #ifdef _WIN64
  53. #ifdef _AMD64_
  54. #define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD)
  55. #elif defined(_IA64_)
  56. #define PROBE_ALIGNMENT(_s) (TYPE_ALIGNMENT(_s) > TYPE_ALIGNMENT(DWORD) ? TYPE_ALIGNMENT(_s) : TYPE_ALIGNMENT(DWORD))
  57. #else
  58. #error No Target Architecture
  59. #endif
  60. #define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(DWORD)
  61. #else
  62. #define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD)
  63. #endif
  64. #define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
  65. #include <basetsd.h>
  66. #if defined(_X86_) || defined(__ia64__) || defined(__x86_64)
  67. #define DECLSPEC_IMPORT __declspec(dllimport)
  68. #else
  69. #define DECLSPEC_IMPORT
  70. #endif
  71. #ifndef DECLSPEC_NORETURN
  72. #define DECLSPEC_NORETURN __declspec(noreturn)
  73. #endif
  74. #ifndef DECLSPEC_ALIGN
  75. #define DECLSPEC_ALIGN(x) __attribute__ ((aligned(x)))
  76. #endif
  77. #ifndef SYSTEM_CACHE_ALIGNMENT_SIZE
  78. #if defined(_AMD64_) || defined(I_X86_)
  79. #define SYSTEM_CACHE_ALIGNMENT_SIZE 64
  80. #else
  81. #define SYSTEM_CACHE_ALIGNMENT_SIZE 128
  82. #endif
  83. #endif
  84. #ifndef DECLSPEC_CACHEALIGN
  85. #define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(SYSTEM_CACHE_ALIGNMENT_SIZE)
  86. #endif
  87. #ifndef DECLSPEC_UUID
  88. #define DECLSPEC_UUID(x)
  89. #endif
  90. #ifndef DECLSPEC_NOVTABLE
  91. #define DECLSPEC_NOVTABLE
  92. #endif
  93. #ifndef DECLSPEC_SELECTANY
  94. #define DECLSPEC_SELECTANY __declspec(selectany)
  95. #endif
  96. #ifndef NOP_FUNCTION
  97. #define NOP_FUNCTION (void)0
  98. #endif
  99. #ifndef DECLSPEC_NOINLINE
  100. #define DECLSPEC_NOINLINE
  101. #endif
  102. #ifndef FORCEINLINE
  103. #define FORCEINLINE static __inline__
  104. #endif
  105. #ifndef DECLSPEC_DEPRECATED
  106. #define DECLSPEC_DEPRECATED __declspec(deprecated)
  107. #define DEPRECATE_SUPPORTED
  108. #endif
  109. #define DECLSPEC_DEPRECATED_DDK
  110. #define PRAGMA_DEPRECATED_DDK 0
  111. typedef void *PVOID;
  112. typedef void *PVOID64;
  113. #define NTAPI __stdcall
  114. #define NTSYSAPI DECLSPEC_IMPORT
  115. #define NTSYSCALLAPI DECLSPEC_IMPORT
  116. #ifndef VOID
  117. #define VOID void
  118. typedef char CHAR;
  119. typedef short SHORT;
  120. typedef long LONG;
  121. #endif
  122. typedef wchar_t WCHAR;
  123. typedef WCHAR *PWCHAR,*LPWCH,*PWCH;
  124. typedef CONST WCHAR *LPCWCH,*PCWCH;
  125. typedef WCHAR *NWPSTR,*LPWSTR,*PWSTR;
  126. typedef PWSTR *PZPWSTR;
  127. typedef CONST PWSTR *PCZPWSTR;
  128. typedef WCHAR UNALIGNED *LPUWSTR,*PUWSTR;
  129. typedef CONST WCHAR *LPCWSTR,*PCWSTR;
  130. typedef PCWSTR *PZPCWSTR;
  131. typedef CONST WCHAR UNALIGNED *LPCUWSTR,*PCUWSTR;
  132. typedef CHAR *PCHAR,*LPCH,*PCH;
  133. typedef CONST CHAR *LPCCH,*PCCH;
  134. typedef CHAR *NPSTR,*LPSTR,*PSTR;
  135. typedef PSTR *PZPSTR;
  136. typedef CONST PSTR *PCZPSTR;
  137. typedef CONST CHAR *LPCSTR,*PCSTR;
  138. typedef PCSTR *PZPCSTR;
  139. #ifdef UNICODE
  140. #ifndef _TCHAR_DEFINED
  141. #define _TCHAR_DEFINED
  142. typedef WCHAR TCHAR,*PTCHAR;
  143. typedef WCHAR TBYTE ,*PTBYTE;
  144. #endif
  145. typedef LPWSTR LPTCH,PTCH;
  146. typedef LPWSTR PTSTR,LPTSTR;
  147. typedef LPCWSTR PCTSTR,LPCTSTR;
  148. typedef LPUWSTR PUTSTR,LPUTSTR;
  149. typedef LPCUWSTR PCUTSTR,LPCUTSTR;
  150. typedef LPWSTR LP;
  151. #define __TEXT(quote) L##quote
  152. #else
  153. #ifndef _TCHAR_DEFINED
  154. #define _TCHAR_DEFINED
  155. typedef char TCHAR,*PTCHAR;
  156. typedef unsigned char TBYTE ,*PTBYTE;
  157. #endif
  158. typedef LPSTR LPTCH,PTCH;
  159. typedef LPSTR PTSTR,LPTSTR,PUTSTR,LPUTSTR;
  160. typedef LPCSTR PCTSTR,LPCTSTR,PCUTSTR,LPCUTSTR;
  161. #define __TEXT(quote) quote
  162. #endif
  163. #define TEXT(quote) __TEXT(quote)
  164. typedef SHORT *PSHORT;
  165. typedef LONG *PLONG;
  166. typedef void *HANDLE;
  167. #define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
  168. typedef HANDLE *PHANDLE;
  169. typedef BYTE FCHAR;
  170. typedef WORD FSHORT;
  171. typedef DWORD FLONG;
  172. #ifndef _HRESULT_DEFINED
  173. #define _HRESULT_DEFINED
  174. typedef LONG HRESULT;
  175. #endif
  176. #ifdef __cplusplus
  177. #define EXTERN_C extern "C"
  178. #else
  179. #define EXTERN_C extern
  180. #endif
  181. #define STDMETHODCALLTYPE WINAPI
  182. #define STDMETHODVCALLTYPE __cdecl
  183. #define STDAPICALLTYPE WINAPI
  184. #define STDAPIVCALLTYPE __cdecl
  185. #define STDAPI EXTERN_C HRESULT WINAPI
  186. #define STDAPI_(type) EXTERN_C type WINAPI
  187. #define STDMETHODIMP HRESULT WINAPI
  188. #define STDMETHODIMP_(type) type WINAPI
  189. #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
  190. #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
  191. #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
  192. #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
  193. typedef char CCHAR;
  194. #ifndef _LCID_DEFINED
  195. #define _LCID_DEFINED
  196. typedef DWORD LCID;
  197. #endif
  198. typedef PDWORD PLCID;
  199. #ifndef _LANGID_DEFINED
  200. #define _LANGID_DEFINED
  201. typedef WORD LANGID;
  202. #endif
  203. #define APPLICATION_ERROR_MASK 0x20000000
  204. #define ERROR_SEVERITY_SUCCESS 0x00000000
  205. #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
  206. #define ERROR_SEVERITY_WARNING 0x80000000
  207. #define ERROR_SEVERITY_ERROR 0xC0000000
  208. #ifdef __ia64__
  209. __declspec(align(16))
  210. #endif
  211. typedef struct _FLOAT128 {
  212. __int64 LowPart;
  213. __int64 HighPart;
  214. } FLOAT128;
  215. typedef FLOAT128 *PFLOAT128;
  216. #define _ULONGLONG_
  217. #if((!(defined(_X86_) && !defined(__x86_64)) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64)))
  218. typedef __int64 LONGLONG;
  219. typedef unsigned __int64 ULONGLONG;
  220. #define MAXLONGLONG (0x7fffffffffffffff)
  221. #else
  222. typedef double LONGLONG;
  223. typedef double ULONGLONG;
  224. #endif
  225. typedef LONGLONG *PLONGLONG;
  226. typedef ULONGLONG *PULONGLONG;
  227. typedef LONGLONG USN;
  228. typedef union _LARGE_INTEGER {
  229. struct {
  230. DWORD LowPart;
  231. LONG HighPart;
  232. };
  233. struct {
  234. DWORD LowPart;
  235. LONG HighPart;
  236. } u;
  237. LONGLONG QuadPart;
  238. } LARGE_INTEGER;
  239. typedef LARGE_INTEGER *PLARGE_INTEGER;
  240. typedef union _ULARGE_INTEGER {
  241. struct {
  242. DWORD LowPart;
  243. DWORD HighPart;
  244. };
  245. struct {
  246. DWORD LowPart;
  247. DWORD HighPart;
  248. } u;
  249. ULONGLONG QuadPart;
  250. } ULARGE_INTEGER;
  251. typedef ULARGE_INTEGER *PULARGE_INTEGER;
  252. typedef struct _LUID {
  253. DWORD LowPart;
  254. LONG HighPart;
  255. } LUID,*PLUID;
  256. #define _DWORDLONG_
  257. typedef ULONGLONG DWORDLONG;
  258. typedef DWORDLONG *PDWORDLONG;
  259. #ifdef RC_INVOKED
  260. #define Int32x32To64(a,b) ((LONGLONG)((LONG)(a)) *(LONGLONG)((LONG)(b)))
  261. #define UInt32x32To64(a,b) ((ULONGLONG)((DWORD)(a)) *(ULONGLONG)((DWORD)(b)))
  262. #define Int64ShrlMod32(a,b) ((ULONGLONG)(a) >> (b))
  263. #elif (defined(_X86_) && !defined(__x86_64))
  264. #define Int32x32To64(a,b) (LONGLONG)((LONGLONG)(LONG)(a) *(LONG)(b))
  265. #define UInt32x32To64(a,b) (ULONGLONG)((ULONGLONG)(DWORD)(a) *(DWORD)(b))
  266. #define Int64ShrlMod32(a,b) ((DWORDLONG)(a)>>(b))
  267. #elif defined(__ia64__) || defined(__x86_64)
  268. #define Int32x32To64(a,b) ((LONGLONG)((LONG)(a)) *(LONGLONG)((LONG)(b)))
  269. #define UInt32x32To64(a,b) ((ULONGLONG)((DWORD)(a)) *(ULONGLONG)((DWORD)(b)))
  270. #define Int64ShrlMod32(a,b) ((ULONGLONG)(a) >> (b))
  271. #else
  272. #error Must define a target architecture.
  273. #endif
  274. #define Int64ShraMod32(a,b) ((LONGLONG)(a) >> (b))
  275. #define Int64ShllMod32(a,b) ((ULONGLONG)(a) << (b))
  276. #ifdef __cplusplus
  277. extern "C" {
  278. #endif
  279. #ifdef __x86_64
  280. #define RotateLeft8 _rotl8
  281. #define RotateLeft16 _rotl16
  282. #define RotateRight8 _rotr8
  283. #define RotateRight16 _rotr16
  284. unsigned char __cdecl _rotl8(unsigned char Value,unsigned char Shift);
  285. unsigned short __cdecl _rotl16(unsigned short Value,unsigned char Shift);
  286. unsigned char __cdecl _rotr8(unsigned char Value,unsigned char Shift);
  287. unsigned short __cdecl _rotr16(unsigned short Value,unsigned char Shift);
  288. #endif
  289. #define RotateLeft32 _rotl
  290. #define RotateLeft64 _rotl64
  291. #define RotateRight32 _rotr
  292. #define RotateRight64 _rotr64
  293. unsigned int __cdecl _rotl(unsigned int Value,int Shift);
  294. unsigned __int64 __cdecl _rotl64(unsigned __int64 Value,int Shift);
  295. unsigned int __cdecl _rotr(unsigned int Value,int Shift);
  296. unsigned __int64 __cdecl _rotr64(unsigned __int64 Value,int Shift);
  297. #ifdef __cplusplus
  298. }
  299. #endif
  300. #define ANSI_NULL ((CHAR)0)
  301. #define UNICODE_NULL ((WCHAR)0)
  302. #define UNICODE_STRING_MAX_BYTES ((WORD) 65534)
  303. #define UNICODE_STRING_MAX_CHARS (32767)
  304. #ifndef _BOOLEAN_
  305. #define _BOOLEAN_
  306. typedef BYTE BOOLEAN;
  307. #endif
  308. typedef BOOLEAN *PBOOLEAN;
  309. typedef struct _LIST_ENTRY {
  310. struct _LIST_ENTRY *Flink;
  311. struct _LIST_ENTRY *Blink;
  312. } LIST_ENTRY,*PLIST_ENTRY,*RESTRICTED_POINTER PRLIST_ENTRY;
  313. typedef struct _SINGLE_LIST_ENTRY {
  314. struct _SINGLE_LIST_ENTRY *Next;
  315. } SINGLE_LIST_ENTRY,*PSINGLE_LIST_ENTRY;
  316. typedef struct LIST_ENTRY32 {
  317. DWORD Flink;
  318. DWORD Blink;
  319. } LIST_ENTRY32;
  320. typedef LIST_ENTRY32 *PLIST_ENTRY32;
  321. typedef struct LIST_ENTRY64 {
  322. ULONGLONG Flink;
  323. ULONGLONG Blink;
  324. } LIST_ENTRY64;
  325. typedef LIST_ENTRY64 *PLIST_ENTRY64;
  326. #include <guiddef.h>
  327. #ifndef __OBJECTID_DEFINED
  328. #define __OBJECTID_DEFINED
  329. typedef struct _OBJECTID {
  330. GUID Lineage;
  331. DWORD Uniquifier;
  332. } OBJECTID;
  333. #endif
  334. #define MINCHAR 0x80
  335. #define MAXCHAR 0x7f
  336. #define MINSHORT 0x8000
  337. #define MAXSHORT 0x7fff
  338. #define MINLONG 0x80000000
  339. #define MAXLONG 0x7fffffff
  340. #define MAXBYTE 0xff
  341. #define MAXWORD 0xffff
  342. #define MAXDWORD 0xffffffff
  343. #define FIELD_OFFSET(type,field) ((LONG)(LONG_PTR)&(((type *)0)->field))
  344. #define RTL_FIELD_SIZE(type,field) (sizeof(((type *)0)->field))
  345. #define RTL_SIZEOF_THROUGH_FIELD(type,field) (FIELD_OFFSET(type,field) + RTL_FIELD_SIZE(type,field))
  346. #define RTL_CONTAINS_FIELD(Struct,Size,Field) ((((PCHAR)(&(Struct)->Field)) + sizeof((Struct)->Field)) <= (((PCHAR)(Struct))+(Size)))
  347. #define RTL_NUMBER_OF_V1(A) (sizeof(A)/sizeof((A)[0]))
  348. #define RTL_NUMBER_OF_V2(A) RTL_NUMBER_OF_V1(A)
  349. #ifdef ENABLE_RTL_NUMBER_OF_V2
  350. #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V2(A)
  351. #else
  352. #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V1(A)
  353. #endif
  354. #define ARRAYSIZE(A) RTL_NUMBER_OF_V2(A)
  355. #define _ARRAYSIZE(A) RTL_NUMBER_OF_V1(A)
  356. #define RTL_FIELD_TYPE(type,field) (((type*)0)->field)
  357. #define RTL_NUMBER_OF_FIELD(type,field) (RTL_NUMBER_OF(RTL_FIELD_TYPE(type,field)))
  358. #define RTL_PADDING_BETWEEN_FIELDS(T,F1,F2) ((FIELD_OFFSET(T,F2) > FIELD_OFFSET(T,F1)) ? (FIELD_OFFSET(T,F2) - FIELD_OFFSET(T,F1) - RTL_FIELD_SIZE(T,F1)) : (FIELD_OFFSET(T,F1) - FIELD_OFFSET(T,F2) - RTL_FIELD_SIZE(T,F2)))
  359. #ifdef __cplusplus
  360. #define RTL_CONST_CAST(type) const_cast<type>
  361. #else
  362. #define RTL_CONST_CAST(type) (type)
  363. #endif
  364. #define RTL_BITS_OF(sizeOfArg) (sizeof(sizeOfArg) *8)
  365. #define RTL_BITS_OF_FIELD(type,field) (RTL_BITS_OF(RTL_FIELD_TYPE(type,field)))
  366. #define CONTAINING_RECORD(address,type,field) ((type *)((PCHAR)(address) - (ULONG_PTR)(&((type *)0)->field)))
  367. #define VER_SERVER_NT 0x80000000
  368. #define VER_WORKSTATION_NT 0x40000000
  369. #define VER_SUITE_SMALLBUSINESS 0x00000001
  370. #define VER_SUITE_ENTERPRISE 0x00000002
  371. #define VER_SUITE_BACKOFFICE 0x00000004
  372. #define VER_SUITE_COMMUNICATIONS 0x00000008
  373. #define VER_SUITE_TERMINAL 0x00000010
  374. #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
  375. #define VER_SUITE_EMBEDDEDNT 0x00000040
  376. #define VER_SUITE_DATACENTER 0x00000080
  377. #define VER_SUITE_SINGLEUSERTS 0x00000100
  378. #define VER_SUITE_PERSONAL 0x00000200
  379. #define VER_SUITE_BLADE 0x00000400
  380. #define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
  381. #define VER_SUITE_SECURITY_APPLIANCE 0x00001000
  382. #define VER_SUITE_STORAGE_SERVER 0x00002000
  383. #define VER_SUITE_COMPUTE_SERVER 0x00004000
  384. #define PRODUCT_UNDEFINED 0x0
  385. #define PRODUCT_ULTIMATE 0x1
  386. #define PRODUCT_HOME_BASIC 0x2
  387. #define PRODUCT_HOME_PREMIUM 0x3
  388. #define PRODUCT_ENTERPRISE 0x4
  389. #define PRODUCT_HOME_BASIC_N 0x5
  390. #define PRODUCT_BUSINESS 0x6
  391. #define PRODUCT_STANDARD_SERVER 0x7
  392. #define PRODUCT_DATACENTER_SERVER 0x8
  393. #define PRODUCT_SMALLBUSINESS_SERVER 0x9
  394. #define PRODUCT_ENTERPRISE_SERVER 0xa
  395. #define PRODUCT_STARTER 0xb
  396. #define PRODUCT_DATACENTER_SERVER_CORE 0xc
  397. #define PRODUCT_STANDARD_SERVER_CORE 0xd
  398. #define PRODUCT_ENTERPRISE_SERVER_CORE 0xe
  399. #define PRODUCT_ENTERPRISE_SERVER_IA64 0xf
  400. #define PRODUCT_BUSINESS_N 0x10
  401. #define PRODUCT_WEB_SERVER 0x11
  402. #define PRODUCT_CLUSTER_SERVER 0x12
  403. #define PRODUCT_HOME_SERVER 0x13
  404. #define PRODUCT_STORAGE_EXPRESS_SERVER 0x14
  405. #define PRODUCT_STORAGE_STANDARD_SERVER 0x15
  406. #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x16
  407. #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x17
  408. #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x18
  409. #define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x19
  410. #define PRODUCT_UNLICENSED 0xabcdabcd
  411. #define LANG_NEUTRAL 0x00
  412. #define LANG_INVARIANT 0x7f
  413. #define LANG_AFRIKAANS 0x36
  414. #define LANG_ALBANIAN 0x1c
  415. #define LANG_ALSATIAN 0x84
  416. #define LANG_AMHARIC 0x5e
  417. #define LANG_ARABIC 0x01
  418. #define LANG_ARMENIAN 0x2b
  419. #define LANG_ASSAMESE 0x4d
  420. #define LANG_AZERI 0x2c
  421. #define LANG_BASHKIR 0x6d
  422. #define LANG_BASQUE 0x2d
  423. #define LANG_BELARUSIAN 0x23
  424. #define LANG_BENGALI 0x45
  425. #define LANG_BRETON 0x7e
  426. #define LANG_BOSNIAN 0x1a
  427. #define LANG_BOSNIAN_NEUTRAL 0x781a
  428. #define LANG_BULGARIAN 0x02
  429. #define LANG_CATALAN 0x03
  430. #define LANG_CHINESE 0x04
  431. #define LANG_CHINESE_SIMPLIFIED 0x04
  432. #define LANG_CHINESE_TRADITIONAL 0x7c04
  433. #define LANG_CORSICAN 0x83
  434. #define LANG_CROATIAN 0x1a
  435. #define LANG_CZECH 0x05
  436. #define LANG_DANISH 0x06
  437. #define LANG_DARI 0x8c
  438. #define LANG_DIVEHI 0x65
  439. #define LANG_DUTCH 0x13
  440. #define LANG_ENGLISH 0x09
  441. #define LANG_ESTONIAN 0x25
  442. #define LANG_FAEROESE 0x38
  443. #define LANG_FARSI 0x29
  444. #define LANG_FILIPINO 0x64
  445. #define LANG_FINNISH 0x0b
  446. #define LANG_FRENCH 0x0c
  447. #define LANG_FRISIAN 0x62
  448. #define LANG_GALICIAN 0x56
  449. #define LANG_GEORGIAN 0x37
  450. #define LANG_GERMAN 0x07
  451. #define LANG_GREEK 0x08
  452. #define LANG_GREENLANDIC 0x6f
  453. #define LANG_GUJARATI 0x47
  454. #define LANG_HAUSA 0x68
  455. #define LANG_HEBREW 0x0d
  456. #define LANG_HINDI 0x39
  457. #define LANG_HUNGARIAN 0x0e
  458. #define LANG_ICELANDIC 0x0f
  459. #define LANG_IGBO 0x70
  460. #define LANG_INDONESIAN 0x21
  461. #define LANG_INUKTITUT 0x5d
  462. #define LANG_IRISH 0x3c
  463. #define LANG_ITALIAN 0x10
  464. #define LANG_JAPANESE 0x11
  465. #define LANG_KANNADA 0x4b
  466. #define LANG_KASHMIRI 0x60
  467. #define LANG_KAZAK 0x3f
  468. #define LANG_KHMER 0x53
  469. #define LANG_KICHE 0x86
  470. #define LANG_KINYARWANDA 0x87
  471. #define LANG_KONKANI 0x57
  472. #define LANG_KOREAN 0x12
  473. #define LANG_KYRGYZ 0x40
  474. #define LANG_LAO 0x54
  475. #define LANG_LATVIAN 0x26
  476. #define LANG_LITHUANIAN 0x27
  477. #define LANG_LOWER_SORBIAN 0x2e
  478. #define LANG_LUXEMBOURGISH 0x6e
  479. #define LANG_MACEDONIAN 0x2f
  480. #define LANG_MALAY 0x3e
  481. #define LANG_MALAYALAM 0x4c
  482. #define LANG_MALTESE 0x3a
  483. #define LANG_MANIPURI 0x58
  484. #define LANG_MAORI 0x81
  485. #define LANG_MAPUDUNGUN 0x7a
  486. #define LANG_MARATHI 0x4e
  487. #define LANG_MOHAWK 0x7c
  488. #define LANG_MONGOLIAN 0x50
  489. #define LANG_NEPALI 0x61
  490. #define LANG_NORWEGIAN 0x14
  491. #define LANG_OCCITAN 0x82
  492. #define LANG_ORIYA 0x48
  493. #define LANG_PASHTO 0x63
  494. #define LANG_PERSIAN 0x29
  495. #define LANG_POLISH 0x15
  496. #define LANG_PORTUGUESE 0x16
  497. #define LANG_PUNJABI 0x46
  498. #define LANG_QUECHUA 0x6b
  499. #define LANG_ROMANIAN 0x18
  500. #define LANG_RUSSIAN 0x19
  501. #define LANG_SAMI 0x3b
  502. #define LANG_ROMANSH 0x17
  503. #define LANG_SANSKRIT 0x4f
  504. #define LANG_SERBIAN 0x1a
  505. #define LANG_SERBIAN_NEUTRAL 0x7c1a
  506. #define LANG_SINDHI 0x59
  507. #define LANG_SINHALESE 0x5b
  508. #define LANG_SLOVAK 0x1b
  509. #define LANG_SLOVENIAN 0x24
  510. #define LANG_SOTHO 0x6c
  511. #define LANG_SPANISH 0x0a
  512. #define LANG_SWAHILI 0x41
  513. #define LANG_SWEDISH 0x1d
  514. #define LANG_SYRIAC 0x5a
  515. #define LANG_TAJIK 0x28
  516. #define LANG_TAMAZIGHT 0x5f
  517. #define LANG_TAMIL 0x49
  518. #define LANG_TATAR 0x44
  519. #define LANG_TELUGU 0x4a
  520. #define LANG_THAI 0x1e
  521. #define LANG_TIBETAN 0x51
  522. #define LANG_TIGRIGNA 0x73
  523. #define LANG_TSWANA 0x32
  524. #define LANG_TURKISH 0x1f
  525. #define LANG_TURKMEN 0x42
  526. #define LANG_UIGHUR 0x80
  527. #define LANG_UKRAINIAN 0x22
  528. #define LANG_UPPER_SORBIAN 0x2e
  529. #define LANG_URDU 0x20
  530. #define LANG_UZBEK 0x43
  531. #define LANG_VIETNAMESE 0x2a
  532. #define LANG_WELSH 0x52
  533. #define LANG_WOLOF 0x88
  534. #define LANG_XHOSA 0x34
  535. #define LANG_YAKUT 0x85
  536. #define LANG_YI 0x78
  537. #define LANG_YORUBA 0x6a
  538. #define LANG_ZULU 0x35
  539. #define SUBLANG_NEUTRAL 0x0
  540. #define SUBLANG_DEFAULT 0x1
  541. #define SUBLANG_SYS_DEFAULT 0x2
  542. #define SUBLANG_CUSTOM_DEFAULT 0x3
  543. #define SUBLANG_CUSTOM_UNSPECIFIED 0x4
  544. #define SUBLANG_UI_CUSTOM_DEFAULT 0x5
  545. #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
  546. #define SUBLANG_ARABIC_IRAQ 0x02
  547. #define SUBLANG_ARABIC_EGYPT 0x03
  548. #define SUBLANG_ARABIC_LIBYA 0x04
  549. #define SUBLANG_ARABIC_ALGERIA 0x05
  550. #define SUBLANG_ARABIC_MOROCCO 0x06
  551. #define SUBLANG_ARABIC_TUNISIA 0x07
  552. #define SUBLANG_ARABIC_OMAN 0x08
  553. #define SUBLANG_ARABIC_YEMEN 0x09
  554. #define SUBLANG_ARABIC_SYRIA 0x0a
  555. #define SUBLANG_ARABIC_JORDAN 0x0b
  556. #define SUBLANG_ARABIC_LEBANON 0x0c
  557. #define SUBLANG_ARABIC_KUWAIT 0x0d
  558. #define SUBLANG_ARABIC_UAE 0x0e
  559. #define SUBLANG_ARABIC_BAHRAIN 0x0f
  560. #define SUBLANG_ARABIC_QATAR 0x10
  561. #define SUBLANG_AZERI_LATIN 0x01
  562. #define SUBLANG_AZERI_CYRILLIC 0x02
  563. #define SUBLANG_CHINESE_TRADITIONAL 0x01
  564. #define SUBLANG_CHINESE_SIMPLIFIED 0x02
  565. #define SUBLANG_CHINESE_HONGKONG 0x03
  566. #define SUBLANG_CHINESE_SINGAPORE 0x04
  567. #define SUBLANG_CHINESE_MACAU 0x05
  568. #define SUBLANG_DUTCH 0x01
  569. #define SUBLANG_DUTCH_BELGIAN 0x02
  570. #define SUBLANG_ENGLISH_US 0x01
  571. #define SUBLANG_ENGLISH_UK 0x02
  572. #define SUBLANG_ENGLISH_AUS 0x03
  573. #define SUBLANG_ENGLISH_CAN 0x04
  574. #define SUBLANG_ENGLISH_NZ 0x05
  575. #define SUBLANG_ENGLISH_EIRE 0x06
  576. #define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
  577. #define SUBLANG_ENGLISH_JAMAICA 0x08
  578. #define SUBLANG_ENGLISH_CARIBBEAN 0x09
  579. #define SUBLANG_ENGLISH_BELIZE 0x0a
  580. #define SUBLANG_ENGLISH_TRINIDAD 0x0b
  581. #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
  582. #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
  583. #define SUBLANG_FRENCH 0x01
  584. #define SUBLANG_FRENCH_BELGIAN 0x02
  585. #define SUBLANG_FRENCH_CANADIAN 0x03
  586. #define SUBLANG_FRENCH_SWISS 0x04
  587. #define SUBLANG_FRENCH_LUXEMBOURG 0x05
  588. #define SUBLANG_FRENCH_MONACO 0x06
  589. #define SUBLANG_GERMAN 0x01
  590. #define SUBLANG_GERMAN_SWISS 0x02
  591. #define SUBLANG_GERMAN_AUSTRIAN 0x03
  592. #define SUBLANG_GERMAN_LUXEMBOURG 0x04
  593. #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
  594. #define SUBLANG_ITALIAN 0x01
  595. #define SUBLANG_ITALIAN_SWISS 0x02
  596. #define SUBLANG_KASHMIRI_SASIA 0x02
  597. #define SUBLANG_KASHMIRI_INDIA 0x02
  598. #define SUBLANG_KOREAN 0x01
  599. #define SUBLANG_LITHUANIAN 0x01
  600. #define SUBLANG_MALAY_MALAYSIA 0x01
  601. #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
  602. #define SUBLANG_NEPALI_INDIA 0x02
  603. #define SUBLANG_NORWEGIAN_BOKMAL 0x01
  604. #define SUBLANG_NORWEGIAN_NYNORSK 0x02
  605. #define SUBLANG_PORTUGUESE 0x02
  606. #define SUBLANG_PORTUGUESE_BRAZILIAN 0x01
  607. #define SUBLANG_SERBIAN_LATIN 0x02
  608. #define SUBLANG_SERBIAN_CYRILLIC 0x03
  609. #define SUBLANG_SPANISH 0x01
  610. #define SUBLANG_SPANISH_MEXICAN 0x02
  611. #define SUBLANG_SPANISH_MODERN 0x03
  612. #define SUBLANG_SPANISH_GUATEMALA 0x04
  613. #define SUBLANG_SPANISH_COSTA_RICA 0x05
  614. #define SUBLANG_SPANISH_PANAMA 0x06
  615. #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
  616. #define SUBLANG_SPANISH_VENEZUELA 0x08
  617. #define SUBLANG_SPANISH_COLOMBIA 0x09
  618. #define SUBLANG_SPANISH_PERU 0x0a
  619. #define SUBLANG_SPANISH_ARGENTINA 0x0b
  620. #define SUBLANG_SPANISH_ECUADOR 0x0c
  621. #define SUBLANG_SPANISH_CHILE 0x0d
  622. #define SUBLANG_SPANISH_URUGUAY 0x0e
  623. #define SUBLANG_SPANISH_PARAGUAY 0x0f
  624. #define SUBLANG_SPANISH_BOLIVIA 0x10
  625. #define SUBLANG_SPANISH_EL_SALVADOR 0x11
  626. #define SUBLANG_SPANISH_HONDURAS 0x12
  627. #define SUBLANG_SPANISH_NICARAGUA 0x13
  628. #define SUBLANG_SPANISH_PUERTO_RICO 0x14
  629. #define SUBLANG_SWEDISH 0x01
  630. #define SUBLANG_SWEDISH_FINLAND 0x02
  631. #define SUBLANG_URDU_PAKISTAN 0x01
  632. #define SUBLANG_URDU_INDIA 0x02
  633. #define SUBLANG_UZBEK_LATIN 0x01
  634. #define SUBLANG_UZBEK_CYRILLIC 0x02
  635. #define SORT_DEFAULT 0x0
  636. #define SORT_INVARIANT_MATH 0x1
  637. #define SORT_JAPANESE_XJIS 0x0
  638. #define SORT_JAPANESE_UNICODE 0x1
  639. #define SORT_JAPANESE_RADICALSTROKE 0x4
  640. #define SORT_CHINESE_BIG5 0x0
  641. #define SORT_CHINESE_PRCP 0x0
  642. #define SORT_CHINESE_UNICODE 0x1
  643. #define SORT_CHINESE_PRC 0x2
  644. #define SORT_CHINESE_BOPOMOFO 0x3
  645. #define SORT_KOREAN_KSC 0x0
  646. #define SORT_KOREAN_UNICODE 0x1
  647. #define SORT_GERMAN_PHONE_BOOK 0x1
  648. #define SORT_HUNGARIAN_DEFAULT 0x0
  649. #define SORT_HUNGARIAN_TECHNICAL 0x1
  650. #define SORT_GEORGIAN_TRADITIONAL 0x0
  651. #define SORT_GEORGIAN_MODERN 0x1
  652. #define MAKELANGID(p,s) ((((WORD)(s)) << 10) | (WORD)(p))
  653. #define PRIMARYLANGID(lgid) ((WORD)(lgid) & 0x3ff)
  654. #define SUBLANGID(lgid) ((WORD)(lgid) >> 10)
  655. #define NLS_VALID_LOCALE_MASK 0x000fffff
  656. #define MAKELCID(lgid,srtid) ((DWORD)((((DWORD)((WORD)(srtid))) << 16) | ((DWORD)((WORD)(lgid)))))
  657. #define MAKESORTLCID(lgid,srtid,ver) ((DWORD)((MAKELCID(lgid,srtid)) | (((DWORD)((WORD)(ver))) << 20)))
  658. #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
  659. #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0xf))
  660. #define SORTVERSIONFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 20) & 0xf))
  661. #define LOCALE_NAME_MAX_LENGTH 85
  662. #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL,SUBLANG_SYS_DEFAULT))
  663. #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT))
  664. #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT,SORT_DEFAULT))
  665. #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT,SORT_DEFAULT))
  666. #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
  667. #define LOCALE_CUSTOM_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_DEFAULT), SORT_DEFAULT))
  668. #define LOCALE_CUSTOM_UNSPECIFIED (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_UNSPECIFIED), SORT_DEFAULT))
  669. #define LOCALE_CUSTOM_UI_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_UI_CUSTOM_DEFAULT), SORT_DEFAULT))
  670. #define LOCALE_INVARIANT (MAKELCID(MAKELANGID(LANG_INVARIANT,SUBLANG_NEUTRAL),SORT_DEFAULT))
  671. #define UNREFERENCED_PARAMETER(P) (P)
  672. #define DBG_UNREFERENCED_PARAMETER(P) (P)
  673. #define DBG_UNREFERENCED_LOCAL_VARIABLE(V) (V)
  674. #define DEFAULT_UNREACHABLE
  675. #ifndef WIN32_NO_STATUS
  676. #define STATUS_WAIT_0 ((DWORD)0x00000000L)
  677. #define STATUS_ABANDONED_WAIT_0 ((DWORD)0x00000080L)
  678. #define STATUS_USER_APC ((DWORD)0x000000C0L)
  679. #define STATUS_TIMEOUT ((DWORD)0x00000102L)
  680. #define STATUS_PENDING ((DWORD)0x00000103L)
  681. #define DBG_EXCEPTION_HANDLED ((DWORD)0x00010001L)
  682. #define DBG_CONTINUE ((DWORD)0x00010002L)
  683. #define STATUS_SEGMENT_NOTIFICATION ((DWORD)0x40000005L)
  684. #define DBG_TERMINATE_THREAD ((DWORD)0x40010003L)
  685. #define DBG_TERMINATE_PROCESS ((DWORD)0x40010004L)
  686. #define DBG_CONTROL_C ((DWORD)0x40010005L)
  687. #define DBG_CONTROL_BREAK ((DWORD)0x40010008L)
  688. #define DBG_COMMAND_EXCEPTION ((DWORD)0x40010009L)
  689. #define STATUS_GUARD_PAGE_VIOLATION ((DWORD)0x80000001L)
  690. #define STATUS_DATATYPE_MISALIGNMENT ((DWORD)0x80000002L)
  691. #define STATUS_BREAKPOINT ((DWORD)0x80000003L)
  692. #define STATUS_SINGLE_STEP ((DWORD)0x80000004L)
  693. #define DBG_EXCEPTION_NOT_HANDLED ((DWORD)0x80010001L)
  694. #define STATUS_ACCESS_VIOLATION ((DWORD)0xC0000005L)
  695. #define STATUS_IN_PAGE_ERROR ((DWORD)0xC0000006L)
  696. #define STATUS_INVALID_HANDLE ((DWORD)0xC0000008L)
  697. #define STATUS_NO_MEMORY ((DWORD)0xC0000017L)
  698. #define STATUS_ILLEGAL_INSTRUCTION ((DWORD)0xC000001DL)
  699. #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD)0xC0000025L)
  700. #define STATUS_INVALID_DISPOSITION ((DWORD)0xC0000026L)
  701. #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD)0xC000008CL)
  702. #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD)0xC000008DL)
  703. #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD)0xC000008EL)
  704. #define STATUS_FLOAT_INEXACT_RESULT ((DWORD)0xC000008FL)
  705. #define STATUS_FLOAT_INVALID_OPERATION ((DWORD)0xC0000090L)
  706. #define STATUS_FLOAT_OVERFLOW ((DWORD)0xC0000091L)
  707. #define STATUS_FLOAT_STACK_CHECK ((DWORD)0xC0000092L)
  708. #define STATUS_FLOAT_UNDERFLOW ((DWORD)0xC0000093L)
  709. #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD)0xC0000094L)
  710. #define STATUS_INTEGER_OVERFLOW ((DWORD)0xC0000095L)
  711. #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD)0xC0000096L)
  712. #define STATUS_STACK_OVERFLOW ((DWORD)0xC00000FDL)
  713. #define STATUS_CONTROL_C_EXIT ((DWORD)0xC000013AL)
  714. #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD)0xC00002B4L)
  715. #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD)0xC00002B5L)
  716. #define STATUS_REG_NAT_CONSUMPTION ((DWORD)0xC00002C9L)
  717. #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD)0xC015000FL)
  718. #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD)0xC0150010L)
  719. #endif
  720. #define MAXIMUM_WAIT_OBJECTS 64
  721. #define MAXIMUM_SUSPEND_COUNT MAXCHAR
  722. typedef ULONG_PTR KSPIN_LOCK;
  723. typedef KSPIN_LOCK *PKSPIN_LOCK;
  724. #ifdef _AMD64_
  725. #if defined(__x86_64) && !defined(RC_INVOKED)
  726. #ifdef __cplusplus
  727. extern "C" {
  728. #endif
  729. #define BitTest _bittest
  730. #define BitTestAndComplement _bittestandcomplement
  731. #define BitTestAndSet _bittestandset
  732. #define BitTestAndReset _bittestandreset
  733. #define InterlockedBitTestAndSet _interlockedbittestandset
  734. #define InterlockedBitTestAndReset _interlockedbittestandreset
  735. #define BitTest64 _bittest64
  736. #define BitTestAndComplement64 _bittestandcomplement64
  737. #define BitTestAndSet64 _bittestandset64
  738. #define BitTestAndReset64 _bittestandreset64
  739. #define InterlockedBitTestAndSet64 _interlockedbittestandset64
  740. #define InterlockedBitTestAndReset64 _interlockedbittestandreset64
  741. __CRT_INLINE BOOLEAN _bittest(LONG const *Base,LONG Offset) {
  742. int old = 0;
  743. __asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0 "
  744. :"=r" (old),"=m" ((*(volatile long *) Base))
  745. :"Ir" (Offset));
  746. return (BOOLEAN) (old!=0);
  747. }
  748. __CRT_INLINE BOOLEAN _bittestandcomplement(LONG *Base,LONG Offset) {
  749. int old = 0;
  750. __asm__ __volatile__("btcl %2,%1\n\tsbbl %0,%0 "
  751. :"=r" (old),"=m" ((*(volatile long *) Base))
  752. :"Ir" (Offset));
  753. return (BOOLEAN) (old!=0);
  754. }
  755. __CRT_INLINE BOOLEAN InterlockedBitTestAndComplement(LONG *Base,LONG Bit) {
  756. int old = 0;
  757. __asm__ __volatile__("lock ; btcl %2,%1\n\tsbbl %0,%0 "
  758. :"=r" (old),"=m" ((*(volatile long *) Base))
  759. :"Ir" (Bit));
  760. return (BOOLEAN) (old!=0);
  761. }
  762. __CRT_INLINE BOOLEAN _bittestandset(LONG *Base,LONG Offset) {
  763. int old = 0;
  764. __asm__ __volatile__("btsl %2,%1\n\tsbbl %0,%0 "
  765. :"=r" (old),"=m" ((*(volatile long *) Base))
  766. :"Ir" (Offset));
  767. return (BOOLEAN) (old!=0);
  768. }
  769. __CRT_INLINE BOOLEAN _bittestandreset(LONG *Base,LONG Offset) {
  770. int old = 0;
  771. __asm__ __volatile__("btrl %2,%1\n\tsbbl %0,%0 "
  772. :"=r" (old),"=m" ((*(volatile long *) Base))
  773. :"Ir" (Offset));
  774. return (BOOLEAN) (old!=0);
  775. }
  776. __CRT_INLINE BOOLEAN _interlockedbittestandset(LONG *Base,LONG Offset) {
  777. int old = 0;
  778. __asm__ __volatile__("lock ; btsl %2,%1\n\tsbbl %0,%0 "
  779. :"=r" (old),"=m" ((*(volatile long *) Base))
  780. :"Ir" (Offset));
  781. return (BOOLEAN) (old!=0);
  782. }
  783. __CRT_INLINE BOOLEAN _interlockedbittestandreset(LONG *Base,LONG Offset) {
  784. int old = 0;
  785. __asm__ __volatile__("lock ; btrl %2,%1\n\tsbbl %0,%0 "
  786. :"=r" (old),"=m" ((*(volatile long *) Base))
  787. :"Ir" (Offset));
  788. return (BOOLEAN) (old!=0);
  789. }
  790. __CRT_INLINE BOOLEAN _bittest64(LONG64 const *Base,LONG64 Offset) {
  791. int old = 0;
  792. __asm__ __volatile__("btq %2,%1\n\tsbbl %0,%0 "
  793. :"=r" (old),"=m" ((*(volatile long long *) Base))
  794. :"Ir" (Offset));
  795. return (BOOLEAN) (old!=0);
  796. }
  797. __CRT_INLINE BOOLEAN _bittestandcomplement64(LONG64 *Base,LONG64 Offset) {
  798. int old = 0;
  799. __asm__ __volatile__("btcq %2,%1\n\tsbbl %0,%0 "
  800. :"=r" (old),"=m" ((*(volatile long long *) Base))
  801. :"Ir" (Offset));
  802. return (BOOLEAN) (old!=0);
  803. }
  804. __CRT_INLINE BOOLEAN _bittestandset64(LONG64 *Base,LONG64 Offset) {
  805. int old = 0;
  806. __asm__ __volatile__("btsq %2,%1\n\tsbbl %0,%0 "
  807. :"=r" (old),"=m" ((*(volatile long long *) Base))
  808. :"Ir" (Offset));
  809. return (BOOLEAN) (old!=0);
  810. }
  811. __CRT_INLINE BOOLEAN _bittestandreset64(LONG64 *Base,LONG64 Offset) {
  812. int old = 0;
  813. __asm__ __volatile__("btrq %2,%1\n\tsbbl %0,%0 "
  814. :"=r" (old),"=m" ((*(volatile long long *) Base))
  815. :"Ir" (Offset));
  816. return (BOOLEAN) (old!=0);
  817. }
  818. __CRT_INLINE BOOLEAN _interlockedbittestandset64(LONG64 *Base,LONG64 Offset) {
  819. int old = 0;
  820. __asm__ __volatile__("lock ; btsq %2,%1\n\tsbbl %0,%0 "
  821. :"=r" (old),"=m" ((*(volatile long long *) Base))
  822. :"Ir" (Offset));
  823. return (BOOLEAN) (old!=0);
  824. }
  825. __CRT_INLINE BOOLEAN _interlockedbittestandreset64(LONG64 *Base,LONG64 Offset) {
  826. int old = 0;
  827. __asm__ __volatile__("lock ; btrq %2,%1\n\tsbbl %0,%0 "
  828. :"=r" (old),"=m" ((*(volatile long long *) Base))
  829. :"Ir" (Offset));
  830. return (BOOLEAN) (old!=0);
  831. }
  832. #define BitScanForward _BitScanForward
  833. #define BitScanReverse _BitScanReverse
  834. #define BitScanForward64 _BitScanForward64
  835. #define BitScanReverse64 _BitScanReverse64
  836. __CRT_INLINE BOOLEAN _BitScanForward(DWORD *Index,DWORD Mask) {
  837. __asm__ __volatile__("bsfl %1,%0" : "=r" (Mask),"=m" ((*(volatile long *)Index)));
  838. return Mask!=0;
  839. }
  840. __CRT_INLINE BOOLEAN _BitScanReverse(DWORD *Index,DWORD Mask) {
  841. __asm__ __volatile__("bsrl %1,%0" : "=r" (Mask),"=m" ((*(volatile long *)Index)));
  842. return Mask!=0;
  843. }
  844. __CRT_INLINE BOOLEAN _BitScanForward64(DWORD *Index,DWORD64 Mask) {
  845. __asm__ __volatile__("bsfq %1,%0" : "=r" (Mask),"=m" ((*(volatile long long *)Index)));
  846. return Mask!=0;
  847. }
  848. __CRT_INLINE BOOLEAN _BitScanReverse64(DWORD *Index,DWORD64 Mask) {
  849. __asm__ __volatile__("bsrq %1,%0" : "=r" (Mask),"=m" ((*(volatile long long *)Index)));
  850. return Mask!=0;
  851. }
  852. #define InterlockedIncrement16 _InterlockedIncrement16
  853. #define InterlockedDecrement16 _InterlockedDecrement16
  854. #define InterlockedCompareExchange16 _InterlockedCompareExchange16
  855. #define InterlockedAnd _InterlockedAnd
  856. #define InterlockedOr _InterlockedOr
  857. #define InterlockedXor _InterlockedXor
  858. #define InterlockedIncrement _InterlockedIncrement
  859. #define InterlockedIncrementAcquire InterlockedIncrement
  860. #define InterlockedIncrementRelease InterlockedIncrement
  861. #define InterlockedDecrement _InterlockedDecrement
  862. #define InterlockedDecrementAcquire InterlockedDecrement
  863. #define InterlockedDecrementRelease InterlockedDecrement
  864. #define InterlockedAdd _InterlockedAdd
  865. #define InterlockedExchange _InterlockedExchange
  866. #define InterlockedExchangeAdd _InterlockedExchangeAdd
  867. #define InterlockedCompareExchange _InterlockedCompareExchange
  868. #define InterlockedCompareExchangeAcquire InterlockedCompareExchange
  869. #define InterlockedCompareExchangeRelease InterlockedCompareExchange
  870. #define InterlockedAnd64 _InterlockedAnd64
  871. #define InterlockedAndAffinity InterlockedAnd64
  872. #define InterlockedOr64 _InterlockedOr64
  873. #define InterlockedOrAffinity InterlockedOr64
  874. #define InterlockedXor64 _InterlockedXor64
  875. #define InterlockedIncrement64 _InterlockedIncrement64
  876. #define InterlockedDecrement64 _InterlockedDecrement64
  877. #define InterlockedAdd64 _InterlockedAdd64
  878. #define InterlockedExchange64 _InterlockedExchange64
  879. #define InterlockedExchangeAcquire64 InterlockedExchange64
  880. #define InterlockedExchangeAdd64 _InterlockedExchangeAdd64
  881. #define InterlockedCompareExchange64 _InterlockedCompareExchange64
  882. #define InterlockedCompareExchangeAcquire64 InterlockedCompareExchange64
  883. #define InterlockedCompareExchangeRelease64 InterlockedCompareExchange64
  884. #define InterlockedExchangePointer _InterlockedExchangePointer
  885. #define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
  886. #define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer
  887. #define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer
  888. #define InterlockedExchangeAddSizeT(a,b) InterlockedExchangeAdd64((LONG64 *)a,b)
  889. #define InterlockedIncrementSizeT(a) InterlockedIncrement64((LONG64 *)a)
  890. #define InterlockedDecrementSizeT(a) InterlockedDecrement64((LONG64 *)a)
  891. __CRT_INLINE SHORT InterlockedIncrement16(SHORT volatile *Addend) {
  892. unsigned char c;
  893. unsigned char s;
  894. __asm__ __volatile__(
  895. "lock ; addw $1,%0; sete %1 ; sets %2"
  896. :"=m" (*Addend), "=qm" (c), "=qm" (s)
  897. :"m" (*Addend) : "memory");
  898. return (c != 0 ? 0 : (s != 0 ? -1 : 1));
  899. }
  900. __CRT_INLINE SHORT InterlockedDecrement16(SHORT volatile *Addend) {
  901. unsigned char c;
  902. unsigned char s;
  903. __asm__ __volatile__(
  904. "lock ; subw $1,%0; sete %1 ; sets %2"
  905. :"=m" (*Addend), "=qm" (c), "=qm" (s)
  906. :"m" (*Addend) : "memory");
  907. return (c != 0 ? 0 : (s != 0 ? -1 : 1));
  908. }
  909. __CRT_INLINE SHORT InterlockedCompareExchange16(SHORT volatile *Destination,SHORT ExChange,SHORT Comperand) {
  910. SHORT prev;
  911. __asm__ __volatile__("lock ; cmpxchgw %w1,%2"
  912. :"=a"(prev)
  913. :"q"(ExChange), "m"(*Destination), "0"(Comperand)
  914. : "memory");
  915. return prev;
  916. }
  917. __CRT_INLINE LONG InterlockedAnd(LONG volatile *Destination,LONG Value) {
  918. __asm__ __volatile__("lock ; andl %0,%1"
  919. : :"r"(Value),"m"(*Destination)
  920. : "memory");
  921. return *Destination;
  922. }
  923. __CRT_INLINE LONG InterlockedOr(LONG volatile *Destination,LONG Value) {
  924. __asm__ __volatile__("lock ; orl %0,%1"
  925. : : "r"(Value),"m"(*Destination) : "memory");
  926. return *Destination;
  927. }
  928. __CRT_INLINE LONG InterlockedXor(LONG volatile *Destination,LONG Value) {
  929. __asm__ __volatile__("lock ; xorl %0,%1"
  930. : : "r"(Value),"m"(*Destination) : "memory");
  931. return *Destination;
  932. }
  933. // $$$$
  934. __CRT_INLINE LONG64 InterlockedAnd64(LONG64 volatile *Destination,LONG64 Value) {
  935. __asm__ __volatile__("lock ; andq %0,%1"
  936. : : "r"(Value),"m"(*Destination) : "memory");
  937. return *Destination;
  938. }
  939. __CRT_INLINE LONG64 InterlockedOr64(LONG64 volatile *Destination,LONG64 Value) {
  940. __asm__ __volatile__("lock ; orq %0,%1"
  941. : : "r"(Value),"m"(*Destination) : "memory");
  942. return *Destination;
  943. }
  944. __CRT_INLINE LONG64 InterlockedXor64(LONG64 volatile *Destination,LONG64 Value) {
  945. __asm__ __volatile__("lock ; xorq %0,%1"
  946. : : "r"(Value),"m"(*Destination) : "memory");
  947. return *Destination;
  948. }
  949. __CRT_INLINE LONG InterlockedIncrement(LONG volatile *Addend) {
  950. unsigned char c;
  951. unsigned char s;
  952. __asm__ __volatile__(
  953. "lock ; addl $1,%0; sete %1 ; sets %2"
  954. :"=m" (*Addend), "=qm" (c), "=qm" (s)
  955. :"m" (*Addend) : "memory");
  956. return (c != 0 ? 0 : (s != 0 ? -1 : 1));
  957. }
  958. __CRT_INLINE LONG InterlockedDecrement(LONG volatile *Addend) {
  959. unsigned char c;
  960. unsigned char s;
  961. __asm__ __volatile__(
  962. "lock ; subl $1,%0; sete %1 ; sets %2"
  963. :"=m" (*Addend), "=qm" (c), "=qm" (s)
  964. :"m" (*Addend) : "memory");
  965. return (c != 0 ? 0 : (s != 0 ? -1 : 1));
  966. }
  967. __CRT_INLINE LONG InterlockedExchange(LONG volatile *Target,LONG Value) {
  968. __asm__ __volatile("lock ; xchgl %0,%1"
  969. : "=r"(Value)
  970. : "m"(*Target),"0"(Value)
  971. : "memory");
  972. return Value;
  973. }
  974. LONG InterlockedExchangeAdd(LONG volatile *Addend,LONG Value);
  975. #ifndef _X86AMD64_
  976. __CRT_INLINE LONG InterlockedAdd(LONG volatile *Addend,LONG Value) { return InterlockedExchangeAdd(Addend,Value) + Value; }
  977. #endif
  978. __CRT_INLINE LONG InterlockedCompareExchange(LONG volatile *Destination,LONG ExChange,LONG Comperand) {
  979. LONG prev;
  980. __asm__ __volatile__("lock ; cmpxchgl %1,%2" : "=a" (prev) : "q" (ExChange),"m" (*Destination), "0" (Comperand) : "memory");
  981. return prev;
  982. }
  983. __CRT_INLINE LONG64 InterlockedIncrement64(LONG64 volatile *Addend) {
  984. unsigned char c;
  985. unsigned char s;
  986. __asm__ __volatile__(
  987. "lock ; addq $1,%0; sete %1 ; sets %2"
  988. :"=m" (*Addend), "=qm" (c), "=qm" (s)
  989. :"m" (*Addend) : "memory");
  990. return (c != 0 ? 0 : (s != 0 ? -1 : 1));
  991. }
  992. __CRT_INLINE LONG64 InterlockedDecrement64(LONG64 volatile *Addend) {
  993. unsigned char c;
  994. unsigned char s;
  995. __asm__ __volatile__(
  996. "lock ; subq $1,%0; sete %1 ; sets %2"
  997. :"=m" (*Addend), "=qm" (c), "=qm" (s)
  998. :"m" (*Addend) : "memory");
  999. return (c != 0 ? 0 : (s != 0 ? -1 : 1));
  1000. }
  1001. __CRT_INLINE LONG64 InterlockedExchange64(LONG64 volatile *Target,LONG64 Value) {
  1002. __asm__ __volatile("lock ; xchgq %0,%1"
  1003. : "=r"(Value)
  1004. : "m"(*Target),"0"(Value)
  1005. : "memory");
  1006. return Value;
  1007. }
  1008. LONG64 InterlockedExchangeAdd64(LONG64 volatile *Addend,LONG64 Value);
  1009. #ifndef _X86AMD64_
  1010. __CRT_INLINE LONG64 InterlockedAdd64(LONG64 volatile *Addend,LONG64 Value) { return InterlockedExchangeAdd64(Addend,Value) + Value; }
  1011. #endif
  1012. __CRT_INLINE LONG64 InterlockedCompareExchange64(LONG64 volatile *Destination,LONG64 ExChange,LONG64 Comperand) {
  1013. LONG64 prev;
  1014. __asm__ __volatile__("lock ; cmpxchgq %1,%2" : "=a" (prev) : "q" (ExChange),"m" (*Destination), "0" (Comperand) : "memory");
  1015. return prev;
  1016. }
  1017. __CRT_INLINE PVOID InterlockedCompareExchangePointer(PVOID volatile *Destination,PVOID ExChange,PVOID Comperand) {
  1018. PVOID prev;
  1019. __asm__ __volatile__("lock ; cmpxchgq %1,%2" : "=a" (prev) : "q" (ExChange),"m" (*Destination), "0" (Comperand) : "memory");
  1020. return prev;
  1021. }
  1022. __CRT_INLINE PVOID InterlockedExchangePointer(PVOID volatile *Target,PVOID Value) {
  1023. __asm__ __volatile("lock ; xchgq %0,%1"
  1024. : "=r"(Value)
  1025. : "m"(*Target),"0"(Value)
  1026. : "memory");
  1027. return Value;
  1028. }
  1029. #define CacheLineFlush(Address) _mm_clflush(Address)
  1030. VOID _ReadWriteBarrier(VOID);
  1031. #define FastFence __faststorefence
  1032. #define LoadFence _mm_lfence
  1033. #define MemoryFence _mm_mfence
  1034. #define StoreFence _mm_sfence
  1035. VOID __faststorefence(VOID);
  1036. VOID _m_prefetchw(volatile CONST VOID *Source);
  1037. //!__TINYC__: #include <intrin.h>
  1038. #define YieldProcessor _mm_pause
  1039. #define MemoryBarrier __faststorefence
  1040. #define PreFetchCacheLine(l,a) _mm_prefetch((CHAR CONST *) a,l)
  1041. #define PrefetchForWrite(p) _m_prefetchw(p)
  1042. #define ReadForWriteAccess(p) (_m_prefetchw(p),*(p))
  1043. #define PF_TEMPORAL_LEVEL_1 _MM_HINT_T0
  1044. #define PF_TEMPORAL_LEVEL_2 _MM_HINT_T1
  1045. #define PF_TEMPORAL_LEVEL_3 _MM_HINT_T2
  1046. #define PF_NON_TEMPORAL_LEVEL_ALL _MM_HINT_NTA
  1047. #define ReadMxCsr _mm_getcsr
  1048. #define WriteMxCsr _mm_setcsr
  1049. VOID __int2c(VOID);
  1050. #define DbgRaiseAssertionFailure() __int2c()
  1051. #define GetCallersEflags() __getcallerseflags()
  1052. unsigned __int32 __getcallerseflags(VOID);
  1053. #define GetSegmentLimit __segmentlimit
  1054. DWORD __segmentlimit(DWORD Selector);
  1055. #define ReadTimeStampCounter() __rdtsc()
  1056. DWORD64 __rdtsc(VOID);
  1057. VOID __movsb(PBYTE Destination,BYTE const *Source,SIZE_T Count);
  1058. VOID __movsw(PWORD Destination,WORD const *Source,SIZE_T Count);
  1059. VOID __movsd(PDWORD Destination,DWORD const *Source,SIZE_T Count);
  1060. VOID __movsq(PDWORD64 Destination,DWORD64 const *Source,SIZE_T Count);
  1061. VOID __stosb(PBYTE Destination,BYTE Value,SIZE_T Count);
  1062. VOID __stosw(PWORD Destination,WORD Value,SIZE_T Count);
  1063. VOID __stosd(PDWORD Destination,DWORD Value,SIZE_T Count);
  1064. VOID __stosq(PDWORD64 Destination,DWORD64 Value,SIZE_T Count);
  1065. #define MultiplyHigh __mulh
  1066. #define UnsignedMultiplyHigh __umulh
  1067. LONGLONG MultiplyHigh(LONGLONG Multiplier,LONGLONG Multiplicand);
  1068. ULONGLONG UnsignedMultiplyHigh(ULONGLONG Multiplier,ULONGLONG Multiplicand);
  1069. #define ShiftLeft128 __shiftleft128
  1070. #define ShiftRight128 __shiftright128
  1071. DWORD64 ShiftLeft128(DWORD64 LowPart,DWORD64 HighPart,BYTE Shift);
  1072. DWORD64 ShiftRight128(DWORD64 LowPart,DWORD64 HighPart,BYTE Shift);
  1073. #define Multiply128 _mul128
  1074. LONG64 Multiply128(LONG64 Multiplier,LONG64 Multiplicand,LONG64 *HighProduct);
  1075. #define UnsignedMultiply128 _umul128
  1076. DWORD64 UnsignedMultiply128(DWORD64 Multiplier,DWORD64 Multiplicand,DWORD64 *HighProduct);
  1077. __CRT_INLINE LONG64 MultiplyExtract128(LONG64 Multiplier,LONG64 Multiplicand,BYTE Shift) {
  1078. LONG64 extractedProduct;
  1079. LONG64 highProduct;
  1080. LONG64 lowProduct;
  1081. lowProduct = Multiply128(Multiplier,Multiplicand,&highProduct);
  1082. extractedProduct = (LONG64)ShiftRight128((LONG64)lowProduct,(LONG64)highProduct,Shift);
  1083. return extractedProduct;
  1084. }
  1085. __CRT_INLINE DWORD64 UnsignedMultiplyExtract128(DWORD64 Multiplier,DWORD64 Multiplicand,BYTE Shift) {
  1086. DWORD64 extractedProduct;
  1087. DWORD64 highProduct;
  1088. DWORD64 lowProduct;
  1089. lowProduct = UnsignedMultiply128(Multiplier,Multiplicand,&highProduct);
  1090. extractedProduct = ShiftRight128(lowProduct,highProduct,Shift);
  1091. return extractedProduct;
  1092. }
  1093. __CRT_INLINE BYTE __readgsbyte(DWORD Offset) {
  1094. BYTE ret;
  1095. __asm__ volatile ("movb %%gs:%1,%0"
  1096. : "=r" (ret) ,"=m" ((*(volatile long *) (DWORD64) Offset)));
  1097. return ret;
  1098. }
  1099. __CRT_INLINE WORD __readgsword(DWORD Offset) {
  1100. WORD ret;
  1101. __asm__ volatile ("movw %%gs:%1,%0"
  1102. : "=r" (ret) ,"=m" ((*(volatile long *) (DWORD64) Offset)));
  1103. return ret;
  1104. }
  1105. __CRT_INLINE DWORD __readgsdword(DWORD Offset) {
  1106. DWORD ret;
  1107. __asm__ volatile ("movl %%gs:%1,%0"
  1108. : "=r" (ret) ,"=m" ((*(volatile long *) (DWORD64) Offset)));
  1109. return ret;
  1110. }
  1111. __CRT_INLINE DWORD64 __readgsqword(DWORD Offset) {
  1112. void *ret;
  1113. __asm__ volatile ("movq %%gs:%1,%0"
  1114. : "=r" (ret) ,"=m" ((*(volatile long *) (DWORD64) Offset)));
  1115. return (DWORD64) ret;
  1116. }
  1117. __CRT_INLINE VOID __writegsbyte(DWORD Offset,BYTE Data) {
  1118. __asm__ volatile ("movb %0,%%gs:%1"
  1119. : "=r" (Data) ,"=m" ((*(volatile long *) (DWORD64) Offset)));
  1120. }
  1121. __CRT_INLINE VOID __writegsword(DWORD Offset,WORD Data) {
  1122. __asm__ volatile ("movw %0,%%gs:%1"
  1123. : "=r" (Data) ,"=m" ((*(volatile long *) (DWORD64) Offset)));
  1124. }
  1125. __CRT_INLINE VOID __writegsdword(DWORD Offset,DWORD Data) {
  1126. __asm__ volatile ("movl %0,%%gs:%1"
  1127. : "=r" (Data) ,"=m" ((*(volatile long *) (DWORD64) Offset)));
  1128. }
  1129. __CRT_INLINE VOID __writegsqword(DWORD Offset,DWORD64 Data) {
  1130. __asm__ volatile ("movq %0,%%gs:%1"
  1131. : "=r" (Data) ,"=m" ((*(volatile long *) (DWORD64) Offset)));
  1132. }
  1133. #ifdef __cplusplus
  1134. }
  1135. #endif
  1136. #endif
  1137. #define EXCEPTION_READ_FAULT 0
  1138. #define EXCEPTION_WRITE_FAULT 1
  1139. #define EXCEPTION_EXECUTE_FAULT 8
  1140. #if !defined(RC_INVOKED)
  1141. #define CONTEXT_AMD64 0x100000
  1142. #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x1L)
  1143. #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x2L)
  1144. #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x4L)
  1145. #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x8L)
  1146. #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x10L)
  1147. #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
  1148. #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
  1149. #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
  1150. #define CONTEXT_SERVICE_ACTIVE 0x10000000
  1151. #define CONTEXT_EXCEPTION_REQUEST 0x40000000
  1152. #define CONTEXT_EXCEPTION_REPORTING 0x80000000
  1153. #endif
  1154. #define INITIAL_MXCSR 0x1f80
  1155. #define INITIAL_FPCSR 0x027f
  1156. typedef DECLSPEC_ALIGN(16) struct _M128A {
  1157. ULONGLONG Low;
  1158. LONGLONG High;
  1159. } M128A,*PM128A;
  1160. typedef struct _XMM_SAVE_AREA32 {
  1161. WORD ControlWord;
  1162. WORD StatusWord;
  1163. BYTE TagWord;
  1164. BYTE Reserved1;
  1165. WORD ErrorOpcode;
  1166. DWORD ErrorOffset;
  1167. WORD ErrorSelector;
  1168. WORD Reserved2;
  1169. DWORD DataOffset;
  1170. WORD DataSelector;
  1171. WORD Reserved3;
  1172. DWORD MxCsr;
  1173. DWORD MxCsr_Mask;
  1174. M128A FloatRegisters[8];
  1175. M128A XmmRegisters[16];
  1176. BYTE Reserved4[96];
  1177. } XMM_SAVE_AREA32,*PXMM_SAVE_AREA32;
  1178. #define LEGACY_SAVE_AREA_LENGTH sizeof(XMM_SAVE_AREA32)
  1179. typedef DECLSPEC_ALIGN(16) struct _CONTEXT {
  1180. DWORD64 P1Home;
  1181. DWORD64 P2Home;
  1182. DWORD64 P3Home;
  1183. DWORD64 P4Home;
  1184. DWORD64 P5Home;
  1185. DWORD64 P6Home;
  1186. DWORD ContextFlags;
  1187. DWORD MxCsr;
  1188. WORD SegCs;
  1189. WORD SegDs;
  1190. WORD SegEs;
  1191. WORD SegFs;
  1192. WORD SegGs;
  1193. WORD SegSs;
  1194. DWORD EFlags;
  1195. DWORD64 Dr0;
  1196. DWORD64 Dr1;
  1197. DWORD64 Dr2;
  1198. DWORD64 Dr3;
  1199. DWORD64 Dr6;
  1200. DWORD64 Dr7;
  1201. DWORD64 Rax;
  1202. DWORD64 Rcx;
  1203. DWORD64 Rdx;
  1204. DWORD64 Rbx;
  1205. DWORD64 Rsp;
  1206. DWORD64 Rbp;
  1207. DWORD64 Rsi;
  1208. DWORD64 Rdi;
  1209. DWORD64 R8;
  1210. DWORD64 R9;
  1211. DWORD64 R10;
  1212. DWORD64 R11;
  1213. DWORD64 R12;
  1214. DWORD64 R13;
  1215. DWORD64 R14;
  1216. DWORD64 R15;
  1217. DWORD64 Rip;
  1218. union {
  1219. XMM_SAVE_AREA32 FltSave;
  1220. XMM_SAVE_AREA32 FloatSave;
  1221. struct {
  1222. M128A Header[2];
  1223. M128A Legacy[8];
  1224. M128A Xmm0;
  1225. M128A Xmm1;
  1226. M128A Xmm2;
  1227. M128A Xmm3;
  1228. M128A Xmm4;
  1229. M128A Xmm5;
  1230. M128A Xmm6;
  1231. M128A Xmm7;
  1232. M128A Xmm8;
  1233. M128A Xmm9;
  1234. M128A Xmm10;
  1235. M128A Xmm11;
  1236. M128A Xmm12;
  1237. M128A Xmm13;
  1238. M128A Xmm14;
  1239. M128A Xmm15;
  1240. };
  1241. };
  1242. M128A VectorRegister[26];
  1243. DWORD64 VectorControl;
  1244. DWORD64 DebugControl;
  1245. DWORD64 LastBranchToRip;
  1246. DWORD64 LastBranchFromRip;
  1247. DWORD64 LastExceptionToRip;
  1248. DWORD64 LastExceptionFromRip;
  1249. } CONTEXT,*PCONTEXT;
  1250. #define RUNTIME_FUNCTION_INDIRECT 0x1
  1251. typedef struct _RUNTIME_FUNCTION {
  1252. DWORD BeginAddress;
  1253. DWORD EndAddress;
  1254. DWORD UnwindData;
  1255. } RUNTIME_FUNCTION,*PRUNTIME_FUNCTION;
  1256. typedef PRUNTIME_FUNCTION (*PGET_RUNTIME_FUNCTION_CALLBACK)(DWORD64 ControlPc,PVOID Context);
  1257. typedef DWORD (*POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK)(HANDLE Process,PVOID TableAddress,PDWORD Entries,PRUNTIME_FUNCTION *Functions);
  1258. #define OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME "OutOfProcessFunctionTableCallback"
  1259. NTSYSAPI VOID __cdecl RtlRestoreContext (PCONTEXT ContextRecord,struct _EXCEPTION_RECORD *ExceptionRecord);
  1260. NTSYSAPI BOOLEAN __cdecl RtlAddFunctionTable(PRUNTIME_FUNCTION FunctionTable,DWORD EntryCount,DWORD64 BaseAddress);
  1261. NTSYSAPI BOOLEAN __cdecl RtlInstallFunctionTableCallback(DWORD64 TableIdentifier,DWORD64 BaseAddress,DWORD Length,PGET_RUNTIME_FUNCTION_CALLBACK Callback,PVOID Context,PCWSTR OutOfProcessCallbackDll);
  1262. NTSYSAPI BOOLEAN __cdecl RtlDeleteFunctionTable(PRUNTIME_FUNCTION FunctionTable);
  1263. #endif
  1264. #ifdef I_X86_
  1265. #if(defined(_X86_) && !defined(__x86_64)) && !defined(RC_INVOKED)
  1266. #ifdef __cplusplus
  1267. extern "C" {
  1268. #endif
  1269. __CRT_INLINE BOOLEAN InterlockedBitTestAndSet(LONG *Base,LONG Bit) {
  1270. int old = 0;
  1271. __asm__ __volatile__("lock ; btsl %2,%1\n\tsbbl %0,%0 "
  1272. :"=r" (old),"=m" ((*(volatile long *) Base))
  1273. :"Ir" (Bit));
  1274. return (BOOLEAN) (old!=0);
  1275. }
  1276. __CRT_INLINE BOOLEAN InterlockedBitTestAndReset(LONG *Base,LONG Bit) {
  1277. int old = 0;
  1278. __asm__ __volatile__("lock ; btrl %2,%1\n\tsbbl %0,%0 "
  1279. :"=r" (old),"=m" ((*(volatile long *) Base))
  1280. :"Ir" (Bit));
  1281. return (BOOLEAN) (old!=0);
  1282. }
  1283. __CRT_INLINE BOOLEAN InterlockedBitTestAndComplement(LONG *Base,LONG Bit) {
  1284. int old = 0;
  1285. __asm__ __volatile__("lock ; btcl %2,%1\n\tsbbl %0,%0 "
  1286. :"=r" (old),"=m" ((*(volatile long *) Base))
  1287. :"Ir" (Bit));
  1288. return (BOOLEAN) (old!=0);
  1289. }
  1290. #ifdef _PREFIX_
  1291. BYTE __readfsbyte(DWORD Offset);
  1292. WORD __readfsword(DWORD Offset);
  1293. DWORD __readfsdword(DWORD Offset);
  1294. VOID __writefsbyte(DWORD Offset,BYTE Data);
  1295. VOID __writefsword(DWORD Offset,WORD Data);
  1296. VOID __writefsdword(DWORD Offset,DWORD Data);
  1297. #endif
  1298. #ifdef __cplusplus
  1299. }
  1300. #endif
  1301. #endif
  1302. #if(defined(_X86_) && !defined(__x86_64))
  1303. __CRT_INLINE VOID MemoryBarrier(VOID) {
  1304. LONG Barrier;
  1305. __asm__ __volatile__("xchgl %eax,%0 "
  1306. :"=r" (Barrier));
  1307. }
  1308. #define YieldProcessor() __asm__ __volatile__("rep nop ");
  1309. #define PreFetchCacheLine(l,a)
  1310. #define ReadForWriteAccess(p) (*(p))
  1311. #define PF_TEMPORAL_LEVEL_1
  1312. #define PF_NON_TEMPORAL_LEVEL_ALL
  1313. __CRT_INLINE VOID DbgRaiseAssertionFailure(void) {
  1314. __asm__ __volatile__("int 0x2c ");
  1315. }
  1316. PVOID GetCurrentFiber(void);
  1317. __CRT_INLINE PVOID GetCurrentFiber(void)
  1318. {
  1319. void *ret;
  1320. __asm__ volatile ("movl %%fs:0x10,%0"
  1321. : "=r" (ret));
  1322. return ret;
  1323. }
  1324. PVOID GetFiberData(void);
  1325. __CRT_INLINE PVOID GetFiberData(void)
  1326. {
  1327. void *ret;
  1328. __asm__ volatile ("movl %%fs:0x10,%0\n"
  1329. "movl (%0),%0"
  1330. : "=r" (ret));
  1331. return ret;
  1332. }
  1333. #endif
  1334. #define EXCEPTION_READ_FAULT 0
  1335. #define EXCEPTION_WRITE_FAULT 1
  1336. #define EXCEPTION_EXECUTE_FAULT 8
  1337. #define SIZE_OF_80387_REGISTERS 80
  1338. #if !defined(RC_INVOKED)
  1339. #define CONTEXT_i386 0x00010000
  1340. #define CONTEXT_i486 0x00010000
  1341. #define CONTEXT_CONTROL (CONTEXT_i386 | 0x00000001L)
  1342. #define CONTEXT_INTEGER (CONTEXT_i386 | 0x00000002L)
  1343. #define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x00000004L)
  1344. #define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x00000008L)
  1345. #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x00000010L)
  1346. #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386 | 0x00000020L)
  1347. #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
  1348. #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS)
  1349. #endif
  1350. #define MAXIMUM_SUPPORTED_EXTENSION 512
  1351. typedef struct _FLOATING_SAVE_AREA {
  1352. DWORD ControlWord;
  1353. DWORD StatusWord;
  1354. DWORD TagWord;
  1355. DWORD ErrorOffset;
  1356. DWORD ErrorSelector;
  1357. DWORD DataOffset;
  1358. DWORD DataSelector;
  1359. BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
  1360. DWORD Cr0NpxState;
  1361. } FLOATING_SAVE_AREA;
  1362. typedef FLOATING_SAVE_AREA *PFLOATING_SAVE_AREA;
  1363. typedef struct _CONTEXT {
  1364. DWORD ContextFlags;
  1365. DWORD Dr0;
  1366. DWORD Dr1;
  1367. DWORD Dr2;
  1368. DWORD Dr3;
  1369. DWORD Dr6;
  1370. DWORD Dr7;
  1371. FLOATING_SAVE_AREA FloatSave;
  1372. DWORD SegGs;
  1373. DWORD SegFs;
  1374. DWORD SegEs;
  1375. DWORD SegDs;
  1376. DWORD Edi;
  1377. DWORD Esi;
  1378. DWORD Ebx;
  1379. DWORD Edx;
  1380. DWORD Ecx;
  1381. DWORD Eax;
  1382. DWORD Ebp;
  1383. DWORD Eip;
  1384. DWORD SegCs;
  1385. DWORD EFlags;
  1386. DWORD Esp;
  1387. DWORD SegSs;
  1388. BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
  1389. } CONTEXT;
  1390. typedef CONTEXT *PCONTEXT;
  1391. #endif
  1392. #ifndef _LDT_ENTRY_DEFINED
  1393. #define _LDT_ENTRY_DEFINED
  1394. typedef struct _LDT_ENTRY {
  1395. WORD LimitLow;
  1396. WORD BaseLow;
  1397. union {
  1398. struct {
  1399. BYTE BaseMid;
  1400. BYTE Flags1;
  1401. BYTE Flags2;
  1402. BYTE BaseHi;
  1403. } Bytes;
  1404. struct {
  1405. DWORD BaseMid : 8;
  1406. DWORD Type : 5;
  1407. DWORD Dpl : 2;
  1408. DWORD Pres : 1;
  1409. DWORD LimitHi : 4;
  1410. DWORD Sys : 1;
  1411. DWORD Reserved_0 : 1;
  1412. DWORD Default_Big : 1;
  1413. DWORD Granularity : 1;
  1414. DWORD BaseHi : 8;
  1415. } Bits;
  1416. } HighWord;
  1417. } LDT_ENTRY,*PLDT_ENTRY;
  1418. #endif
  1419. #if defined(__ia64__) && !defined(RC_INVOKED)
  1420. #ifdef __cplusplus
  1421. extern "C" {
  1422. #endif
  1423. BOOLEAN BitScanForward64(DWORD *Index,DWORD64 Mask);
  1424. BOOLEAN BitScanReverse64(DWORD *Index,DWORD64 Mask);
  1425. #ifdef __cplusplus
  1426. }
  1427. #endif
  1428. #endif
  1429. #if !defined(GENUTIL) && !defined(_GENIA64_) && defined(_IA64_)
  1430. void *_cdecl _rdteb(void);
  1431. #ifdef __ia64__
  1432. #define NtCurrentTeb() ((struct _TEB *)_rdteb())
  1433. #define GetCurrentFiber() (((PNT_TIB)NtCurrentTeb())->FiberData)
  1434. #define GetFiberData() (*(PVOID *)(GetCurrentFiber()))
  1435. #ifdef __cplusplus
  1436. extern "C" {
  1437. #endif
  1438. void __break(int);
  1439. void __yield(void);
  1440. void __mf(void);
  1441. void __lfetch(int Level,VOID CONST *Address);
  1442. void __lfetchfault(int Level,VOID CONST *Address);
  1443. void __lfetch_excl(int Level,VOID CONST *Address);
  1444. void __lfetchfault_excl(int Level,VOID CONST *Address);
  1445. #define MD_LFHINT_NONE 0x00
  1446. #define MD_LFHINT_NT1 0x01
  1447. #define MD_LFHINT_NT2 0x02
  1448. #define MD_LFHINT_NTA 0x03
  1449. #ifdef __cplusplus
  1450. }
  1451. #endif
  1452. #define YieldProcessor __yield
  1453. #define MemoryBarrier __mf
  1454. #define PreFetchCacheLine __lfetch
  1455. #define ReadForWriteAccess(p) (*(p))
  1456. #define DbgRaiseAssertionFailure() __break(ASSERT_BREAKPOINT)
  1457. #define PF_TEMPORAL_LEVEL_1 MD_LFHINT_NONE
  1458. #define PF_NON_TEMPORAL_LEVEL_ALL MD_LFHINT_NTA
  1459. #define UnsignedMultiplyHigh __UMULH
  1460. ULONGLONG UnsignedMultiplyHigh(ULONGLONG Multiplier,ULONGLONG Multiplicand);
  1461. #else
  1462. struct _TEB *NtCurrentTeb(void);
  1463. #endif
  1464. #endif
  1465. #ifdef _IA64_
  1466. #define EXCEPTION_READ_FAULT 0
  1467. #define EXCEPTION_WRITE_FAULT 1
  1468. #define EXCEPTION_EXECUTE_FAULT 2
  1469. #if !defined(RC_INVOKED)
  1470. #define CONTEXT_IA64 0x00080000
  1471. #define CONTEXT_CONTROL (CONTEXT_IA64 | 0x00000001L)
  1472. #define CONTEXT_LOWER_FLOATING_POINT (CONTEXT_IA64 | 0x00000002L)
  1473. #define CONTEXT_HIGHER_FLOATING_POINT (CONTEXT_IA64 | 0x00000004L)
  1474. #define CONTEXT_INTEGER (CONTEXT_IA64 | 0x00000008L)
  1475. #define CONTEXT_DEBUG (CONTEXT_IA64 | 0x00000010L)
  1476. #define CONTEXT_IA32_CONTROL (CONTEXT_IA64 | 0x00000020L)
  1477. #define CONTEXT_FLOATING_POINT (CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT)
  1478. #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_IA32_CONTROL)
  1479. #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_DEBUG | CONTEXT_IA32_CONTROL)
  1480. #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
  1481. #define CONTEXT_SERVICE_ACTIVE 0x10000000
  1482. #define CONTEXT_EXCEPTION_REQUEST 0x40000000
  1483. #define CONTEXT_EXCEPTION_REPORTING 0x80000000
  1484. #endif
  1485. typedef struct _CONTEXT {
  1486. DWORD ContextFlags;
  1487. DWORD Fill1[3];
  1488. ULONGLONG DbI0;
  1489. ULONGLONG DbI1;
  1490. ULONGLONG DbI2;
  1491. ULONGLONG DbI3;
  1492. ULONGLONG DbI4;
  1493. ULONGLONG DbI5;
  1494. ULONGLONG DbI6;
  1495. ULONGLONG DbI7;
  1496. ULONGLONG DbD0;
  1497. ULONGLONG DbD1;
  1498. ULONGLONG DbD2;
  1499. ULONGLONG DbD3;
  1500. ULONGLONG DbD4;
  1501. ULONGLONG DbD5;
  1502. ULONGLONG DbD6;
  1503. ULONGLONG DbD7;
  1504. FLOAT128 FltS0;
  1505. FLOAT128 FltS1;
  1506. FLOAT128 FltS2;
  1507. FLOAT128 FltS3;
  1508. FLOAT128 FltT0;
  1509. FLOAT128 FltT1;
  1510. FLOAT128 FltT2;
  1511. FLOAT128 FltT3;
  1512. FLOAT128 FltT4;
  1513. FLOAT128 FltT5;
  1514. FLOAT128 FltT6;
  1515. FLOAT128 FltT7;
  1516. FLOAT128 FltT8;
  1517. FLOAT128 FltT9;
  1518. FLOAT128 FltS4;
  1519. FLOAT128 FltS5;
  1520. FLOAT128 FltS6;
  1521. FLOAT128 FltS7;
  1522. FLOAT128 FltS8;
  1523. FLOAT128 FltS9;
  1524. FLOAT128 FltS10;
  1525. FLOAT128 FltS11;
  1526. FLOAT128 FltS12;
  1527. FLOAT128 FltS13;
  1528. FLOAT128 FltS14;
  1529. FLOAT128 FltS15;
  1530. FLOAT128 FltS16;
  1531. FLOAT128 FltS17;
  1532. FLOAT128 FltS18;
  1533. FLOAT128 FltS19;
  1534. FLOAT128 FltF32;
  1535. FLOAT128 FltF33;
  1536. FLOAT128 FltF34;
  1537. FLOAT128 FltF35;
  1538. FLOAT128 FltF36;
  1539. FLOAT128 FltF37;
  1540. FLOAT128 FltF38;
  1541. FLOAT128 FltF39;
  1542. FLOAT128 FltF40;
  1543. FLOAT128 FltF41;
  1544. FLOAT128 FltF42;
  1545. FLOAT128 FltF43;
  1546. FLOAT128 FltF44;
  1547. FLOAT128 FltF45;
  1548. FLOAT128 FltF46;
  1549. FLOAT128 FltF47;
  1550. FLOAT128 FltF48;
  1551. FLOAT128 FltF49;
  1552. FLOAT128 FltF50;
  1553. FLOAT128 FltF51;
  1554. FLOAT128 FltF52;
  1555. FLOAT128 FltF53;
  1556. FLOAT128 FltF54;
  1557. FLOAT128 FltF55;
  1558. FLOAT128 FltF56;
  1559. FLOAT128 FltF57;
  1560. FLOAT128 FltF58;
  1561. FLOAT128 FltF59;
  1562. FLOAT128 FltF60;
  1563. FLOAT128 FltF61;
  1564. FLOAT128 FltF62;
  1565. FLOAT128 FltF63;
  1566. FLOAT128 FltF64;
  1567. FLOAT128 FltF65;
  1568. FLOAT128 FltF66;
  1569. FLOAT128 FltF67;
  1570. FLOAT128 FltF68;
  1571. FLOAT128 FltF69;
  1572. FLOAT128 FltF70;
  1573. FLOAT128 FltF71;
  1574. FLOAT128 FltF72;
  1575. FLOAT128 FltF73;
  1576. FLOAT128 FltF74;
  1577. FLOAT128 FltF75;
  1578. FLOAT128 FltF76;
  1579. FLOAT128 FltF77;
  1580. FLOAT128 FltF78;
  1581. FLOAT128 FltF79;
  1582. FLOAT128 FltF80;
  1583. FLOAT128 FltF81;
  1584. FLOAT128 FltF82;
  1585. FLOAT128 FltF83;
  1586. FLOAT128 FltF84;
  1587. FLOAT128 FltF85;
  1588. FLOAT128 FltF86;
  1589. FLOAT128 FltF87;
  1590. FLOAT128 FltF88;
  1591. FLOAT128 FltF89;
  1592. FLOAT128 FltF90;
  1593. FLOAT128 FltF91;
  1594. FLOAT128 FltF92;
  1595. FLOAT128 FltF93;
  1596. FLOAT128 FltF94;
  1597. FLOAT128 FltF95;
  1598. FLOAT128 FltF96;
  1599. FLOAT128 FltF97;
  1600. FLOAT128 FltF98;
  1601. FLOAT128 FltF99;
  1602. FLOAT128 FltF100;
  1603. FLOAT128 FltF101;
  1604. FLOAT128 FltF102;
  1605. FLOAT128 FltF103;
  1606. FLOAT128 FltF104;
  1607. FLOAT128 FltF105;
  1608. FLOAT128 FltF106;
  1609. FLOAT128 FltF107;
  1610. FLOAT128 FltF108;
  1611. FLOAT128 FltF109;
  1612. FLOAT128 FltF110;
  1613. FLOAT128 FltF111;
  1614. FLOAT128 FltF112;
  1615. FLOAT128 FltF113;
  1616. FLOAT128 FltF114;
  1617. FLOAT128 FltF115;
  1618. FLOAT128 FltF116;
  1619. FLOAT128 FltF117;
  1620. FLOAT128 FltF118;
  1621. FLOAT128 FltF119;
  1622. FLOAT128 FltF120;
  1623. FLOAT128 FltF121;
  1624. FLOAT128 FltF122;
  1625. FLOAT128 FltF123;
  1626. FLOAT128 FltF124;
  1627. FLOAT128 FltF125;
  1628. FLOAT128 FltF126;
  1629. FLOAT128 FltF127;
  1630. ULONGLONG StFPSR;
  1631. ULONGLONG IntGp;
  1632. ULONGLONG IntT0;
  1633. ULONGLONG IntT1;
  1634. ULONGLONG IntS0;
  1635. ULONGLONG IntS1;
  1636. ULONGLONG IntS2;
  1637. ULONGLONG IntS3;
  1638. ULONGLONG IntV0;
  1639. ULONGLONG IntT2;
  1640. ULONGLONG IntT3;
  1641. ULONGLONG IntT4;
  1642. ULONGLONG IntSp;
  1643. ULONGLONG IntTeb;
  1644. ULONGLONG IntT5;
  1645. ULONGLONG IntT6;
  1646. ULONGLONG IntT7;
  1647. ULONGLONG IntT8;
  1648. ULONGLONG IntT9;
  1649. ULONGLONG IntT10;
  1650. ULONGLONG IntT11;
  1651. ULONGLONG IntT12;
  1652. ULONGLONG IntT13;
  1653. ULONGLONG IntT14;
  1654. ULONGLONG IntT15;
  1655. ULONGLONG IntT16;
  1656. ULONGLONG IntT17;
  1657. ULONGLONG IntT18;
  1658. ULONGLONG IntT19;
  1659. ULONGLONG IntT20;
  1660. ULONGLONG IntT21;
  1661. ULONGLONG IntT22;
  1662. ULONGLONG IntNats;
  1663. ULONGLONG Preds;
  1664. ULONGLONG BrRp;
  1665. ULONGLONG BrS0;
  1666. ULONGLONG BrS1;
  1667. ULONGLONG BrS2;
  1668. ULONGLONG BrS3;
  1669. ULONGLONG BrS4;
  1670. ULONGLONG BrT0;
  1671. ULONGLONG BrT1;
  1672. ULONGLONG ApUNAT;
  1673. ULONGLONG ApLC;
  1674. ULONGLONG ApEC;
  1675. ULONGLONG ApCCV;
  1676. ULONGLONG ApDCR;
  1677. ULONGLONG RsPFS;
  1678. ULONGLONG RsBSP;
  1679. ULONGLONG RsBSPSTORE;
  1680. ULONGLONG RsRSC;
  1681. ULONGLONG RsRNAT;
  1682. ULONGLONG StIPSR;
  1683. ULONGLONG StIIP;
  1684. ULONGLONG StIFS;
  1685. ULONGLONG StFCR;
  1686. ULONGLONG Eflag;
  1687. ULONGLONG SegCSD;
  1688. ULONGLONG SegSSD;
  1689. ULONGLONG Cflag;
  1690. ULONGLONG StFSR;
  1691. ULONGLONG StFIR;
  1692. ULONGLONG StFDR;
  1693. ULONGLONG UNUSEDPACK;
  1694. } CONTEXT,*PCONTEXT;
  1695. typedef struct _PLABEL_DESCRIPTOR {
  1696. ULONGLONG EntryPoint;
  1697. ULONGLONG GlobalPointer;
  1698. } PLABEL_DESCRIPTOR,*PPLABEL_DESCRIPTOR;
  1699. typedef struct _RUNTIME_FUNCTION {
  1700. DWORD BeginAddress;
  1701. DWORD EndAddress;
  1702. DWORD UnwindInfoAddress;
  1703. } RUNTIME_FUNCTION,*PRUNTIME_FUNCTION;
  1704. typedef PRUNTIME_FUNCTION (*PGET_RUNTIME_FUNCTION_CALLBACK)(DWORD64 ControlPc,PVOID Context);
  1705. typedef DWORD (*POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK)(HANDLE Process,PVOID TableAddress,PDWORD Entries,PRUNTIME_FUNCTION *Functions);
  1706. #define OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME "OutOfProcessFunctionTableCallback"
  1707. BOOLEAN RtlAddFunctionTable(PRUNTIME_FUNCTION FunctionTable,DWORD EntryCount,ULONGLONG BaseAddress,ULONGLONG TargetGp);
  1708. BOOLEAN RtlInstallFunctionTableCallback(DWORD64 TableIdentifier,DWORD64 BaseAddress,DWORD Length,DWORD64 TargetGp,PGET_RUNTIME_FUNCTION_CALLBACK Callback,PVOID Context,PCWSTR OutOfProcessCallbackDll);
  1709. BOOLEAN RtlDeleteFunctionTable(PRUNTIME_FUNCTION FunctionTable);
  1710. VOID RtlRestoreContext (PCONTEXT ContextRecord,struct _EXCEPTION_RECORD *ExceptionRecord);
  1711. VOID __jump_unwind(ULONGLONG TargetMsFrame,ULONGLONG TargetBsFrame,ULONGLONG TargetPc);
  1712. #endif
  1713. #define EXCEPTION_NONCONTINUABLE 0x1
  1714. #define EXCEPTION_MAXIMUM_PARAMETERS 15
  1715. typedef struct _EXCEPTION_RECORD {
  1716. DWORD ExceptionCode;
  1717. DWORD ExceptionFlags;
  1718. struct _EXCEPTION_RECORD *ExceptionRecord;
  1719. PVOID ExceptionAddress;
  1720. DWORD NumberParameters;
  1721. ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
  1722. } EXCEPTION_RECORD;
  1723. typedef EXCEPTION_RECORD *PEXCEPTION_RECORD;
  1724. typedef struct _EXCEPTION_RECORD32 {
  1725. DWORD ExceptionCode;
  1726. DWORD ExceptionFlags;
  1727. DWORD ExceptionRecord;
  1728. DWORD ExceptionAddress;
  1729. DWORD NumberParameters;
  1730. DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
  1731. } EXCEPTION_RECORD32,*PEXCEPTION_RECORD32;
  1732. typedef struct _EXCEPTION_RECORD64 {
  1733. DWORD ExceptionCode;
  1734. DWORD ExceptionFlags;
  1735. DWORD64 ExceptionRecord;
  1736. DWORD64 ExceptionAddress;
  1737. DWORD NumberParameters;
  1738. DWORD __unusedAlignment;
  1739. DWORD64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
  1740. } EXCEPTION_RECORD64,*PEXCEPTION_RECORD64;
  1741. typedef struct _EXCEPTION_POINTERS {
  1742. PEXCEPTION_RECORD ExceptionRecord;
  1743. PCONTEXT ContextRecord;
  1744. } EXCEPTION_POINTERS,*PEXCEPTION_POINTERS;
  1745. #ifdef __x86_64
  1746. typedef EXCEPTION_DISPOSITION NTAPI EXCEPTION_ROUTINE (struct _EXCEPTION_RECORD *ExceptionRecord, PVOID EstablisherFrame, struct _CONTEXT *ContextRecord, PVOID DispatcherContext);
  1747. #ifndef __PEXCEPTION_ROUTINE_DEFINED
  1748. #define __PEXCEPTION_ROUTINE_DEFINED
  1749. typedef EXCEPTION_ROUTINE *PEXCEPTION_ROUTINE;
  1750. #endif
  1751. /* http://msdn.microsoft.com/en-us/library/ms680597(VS.85).aspx */
  1752. #define UNWIND_HISTORY_TABLE_SIZE 12
  1753. typedef struct _UNWIND_HISTORY_TABLE_ENTRY {
  1754. ULONG64 ImageBase;
  1755. PRUNTIME_FUNCTION FunctionEntry;
  1756. } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
  1757. #define UNWIND_HISTORY_TABLE_NONE 0
  1758. #define UNWIND_HISTORY_TABLE_GLOBAL 1
  1759. #define UNWIND_HISTORY_TABLE_LOCAL 2
  1760. typedef struct _UNWIND_HISTORY_TABLE {
  1761. ULONG Count;
  1762. UCHAR Search;
  1763. ULONG64 LowAddress;
  1764. ULONG64 HighAddress;
  1765. UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
  1766. } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
  1767. /* http://msdn.microsoft.com/en-us/library/b6sf5kbd(VS.80).aspx */
  1768. struct _DISPATCHER_CONTEXT;
  1769. typedef struct _DISPATCHER_CONTEXT DISPATCHER_CONTEXT;
  1770. typedef struct _DISPATCHER_CONTEXT *PDISPATCHER_CONTEXT;
  1771. struct _DISPATCHER_CONTEXT {
  1772. ULONG64 ControlPc;
  1773. ULONG64 ImageBase;
  1774. PRUNTIME_FUNCTION FunctionEntry;
  1775. ULONG64 EstablisherFrame;
  1776. ULONG64 TargetIp;
  1777. PCONTEXT ContextRecord;
  1778. PEXCEPTION_ROUTINE LanguageHandler;
  1779. PVOID HandlerData;
  1780. /* http://www.nynaeve.net/?p=99 */
  1781. PUNWIND_HISTORY_TABLE HistoryTable;
  1782. ULONG ScopeIndex;
  1783. ULONG Fill0;
  1784. };
  1785. /* http://msdn.microsoft.com/en-us/library/ms680617(VS.85).aspx */
  1786. typedef struct _KNONVOLATILE_CONTEXT_POINTERS
  1787. {
  1788. PM128A FloatingContext[16];
  1789. PULONG64 IntegerContext[16];
  1790. } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
  1791. #endif /* defined(__x86_64) */
  1792. typedef PVOID PACCESS_TOKEN;
  1793. typedef PVOID PSECURITY_DESCRIPTOR;
  1794. typedef PVOID PSID;
  1795. typedef DWORD ACCESS_MASK;
  1796. typedef ACCESS_MASK *PACCESS_MASK;
  1797. #define DELETE (0x00010000L)
  1798. #define READ_CONTROL (0x00020000L)
  1799. #define WRITE_DAC (0x00040000L)
  1800. #define WRITE_OWNER (0x00080000L)
  1801. #define SYNCHRONIZE (0x00100000L)
  1802. #define STANDARD_RIGHTS_REQUIRED (0x000F0000L)
  1803. #define STANDARD_RIGHTS_READ (READ_CONTROL)
  1804. #define STANDARD_RIGHTS_WRITE (READ_CONTROL)
  1805. #define STANDARD_RIGHTS_EXECUTE (READ_CONTROL)
  1806. #define STANDARD_RIGHTS_ALL (0x001F0000L)
  1807. #define SPECIFIC_RIGHTS_ALL (0x0000FFFFL)
  1808. #define ACCESS_SYSTEM_SECURITY (0x01000000L)
  1809. #define MAXIMUM_ALLOWED (0x02000000L)
  1810. #define GENERIC_READ (0x80000000L)
  1811. #define GENERIC_WRITE (0x40000000L)
  1812. #define GENERIC_EXECUTE (0x20000000L)
  1813. #define GENERIC_ALL (0x10000000L)
  1814. typedef struct _GENERIC_MAPPING {
  1815. ACCESS_MASK GenericRead;
  1816. ACCESS_MASK GenericWrite;
  1817. ACCESS_MASK GenericExecute;
  1818. ACCESS_MASK GenericAll;
  1819. } GENERIC_MAPPING;
  1820. typedef GENERIC_MAPPING *PGENERIC_MAPPING;
  1821. #include <pshpack4.h>
  1822. typedef struct _LUID_AND_ATTRIBUTES {
  1823. LUID Luid;
  1824. DWORD Attributes;
  1825. } LUID_AND_ATTRIBUTES,*PLUID_AND_ATTRIBUTES;
  1826. typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
  1827. typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY;
  1828. #include <poppack.h>
  1829. #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
  1830. #define SID_IDENTIFIER_AUTHORITY_DEFINED
  1831. typedef struct _SID_IDENTIFIER_AUTHORITY {
  1832. BYTE Value[6];
  1833. } SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY;
  1834. #endif
  1835. #ifndef SID_DEFINED
  1836. #define SID_DEFINED
  1837. typedef struct _SID {
  1838. BYTE Revision;
  1839. BYTE SubAuthorityCount;
  1840. SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
  1841. DWORD SubAuthority[ANYSIZE_ARRAY];
  1842. } SID,*PISID;
  1843. #endif
  1844. #define SID_REVISION (1)
  1845. #define SID_MAX_SUB_AUTHORITIES (15)
  1846. #define SID_RECOMMENDED_SUB_AUTHORITIES (1)
  1847. #define SECURITY_MAX_SID_SIZE (sizeof(SID) - sizeof(DWORD) + (SID_MAX_SUB_AUTHORITIES *sizeof(DWORD)))
  1848. typedef enum _SID_NAME_USE {
  1849. SidTypeUser = 1,SidTypeGroup,SidTypeDomain,SidTypeAlias,SidTypeWellKnownGroup,SidTypeDeletedAccount,SidTypeInvalid,SidTypeUnknown,SidTypeComputer
  1850. } SID_NAME_USE,*PSID_NAME_USE;
  1851. typedef struct _SID_AND_ATTRIBUTES {
  1852. PSID Sid;
  1853. DWORD Attributes;
  1854. } SID_AND_ATTRIBUTES,*PSID_AND_ATTRIBUTES;
  1855. typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
  1856. typedef SID_AND_ATTRIBUTES_ARRAY *PSID_AND_ATTRIBUTES_ARRAY;
  1857. #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
  1858. #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
  1859. #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
  1860. #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
  1861. #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
  1862. #define SECURITY_RESOURCE_MANAGER_AUTHORITY {0,0,0,0,0,9}
  1863. #define SECURITY_NULL_RID (0x00000000L)
  1864. #define SECURITY_WORLD_RID (0x00000000L)
  1865. #define SECURITY_LOCAL_RID (0x00000000L)
  1866. #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
  1867. #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
  1868. #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
  1869. #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
  1870. #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
  1871. #define SECURITY_DIALUP_RID (0x00000001L)
  1872. #define SECURITY_NETWORK_RID (0x00000002L)
  1873. #define SECURITY_BATCH_RID (0x00000003L)
  1874. #define SECURITY_INTERACTIVE_RID (0x00000004L)
  1875. #define SECURITY_LOGON_IDS_RID (0x00000005L)
  1876. #define SECURITY_LOGON_IDS_RID_COUNT (3L)
  1877. #define SECURITY_SERVICE_RID (0x00000006L)
  1878. #define SECURITY_ANONYMOUS_LOGON_RID (0x00000007L)
  1879. #define SECURITY_PROXY_RID (0x00000008L)
  1880. #define SECURITY_ENTERPRISE_CONTROLLERS_RID (0x00000009L)
  1881. #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
  1882. #define SECURITY_PRINCIPAL_SELF_RID (0x0000000AL)
  1883. #define SECURITY_AUTHENTICATED_USER_RID (0x0000000BL)
  1884. #define SECURITY_RESTRICTED_CODE_RID (0x0000000CL)
  1885. #define SECURITY_TERMINAL_SERVER_RID (0x0000000DL)
  1886. #define SECURITY_REMOTE_LOGON_RID (0x0000000EL)
  1887. #define SECURITY_THIS_ORGANIZATION_RID (0x0000000FL)
  1888. #define SECURITY_IUSER_RID (0x00000011L)
  1889. #define SECURITY_LOCAL_SYSTEM_RID (0x00000012L)
  1890. #define SECURITY_LOCAL_SERVICE_RID (0x00000013L)
  1891. #define SECURITY_NETWORK_SERVICE_RID (0x00000014L)
  1892. #define SECURITY_NT_NON_UNIQUE (0x00000015L)
  1893. #define SECURITY_NT_NON_UNIQUE_SUB_AUTH_COUNT (3L)
  1894. #define SECURITY_ENTERPRISE_READONLY_CONTROLLERS_RID (0x00000016L)
  1895. #define SECURITY_BUILTIN_DOMAIN_RID (0x00000020L)
  1896. #define SECURITY_WRITE_RESTRICTED_CODE_RID (0x00000021L)
  1897. #define SECURITY_PACKAGE_BASE_RID (0x00000040L)
  1898. #define SECURITY_PACKAGE_RID_COUNT (2L)
  1899. #define SECURITY_PACKAGE_NTLM_RID (0x0000000AL)
  1900. #define SECURITY_PACKAGE_SCHANNEL_RID (0x0000000EL)
  1901. #define SECURITY_PACKAGE_DIGEST_RID (0x00000015L)
  1902. #define SECURITY_SERVICE_ID_BASE_RID (0x00000050L)
  1903. #define SECURITY_SERVICE_ID_RID_COUNT (6L)
  1904. #define SECURITY_RESERVED_ID_BASE_RID (0x00000051L)
  1905. #define SECURITY_MAX_ALWAYS_FILTERED (0x000003E7L)
  1906. #define SECURITY_MIN_NEVER_FILTERED (0x000003E8L)
  1907. #define SECURITY_OTHER_ORGANIZATION_RID (0x000003E8L)
  1908. #define FOREST_USER_RID_MAX (0x000001F3L)
  1909. #define DOMAIN_USER_RID_ADMIN (0x000001F4L)
  1910. #define DOMAIN_USER_RID_GUEST (0x000001F5L)
  1911. #define DOMAIN_USER_RID_KRBTGT (0x000001F6L)
  1912. #define DOMAIN_USER_RID_MAX (0x000003E7L)
  1913. #define DOMAIN_GROUP_RID_ADMINS (0x00000200L)
  1914. #define DOMAIN_GROUP_RID_USERS (0x00000201L)
  1915. #define DOMAIN_GROUP_RID_GUESTS (0x00000202L)
  1916. #define DOMAIN_GROUP_RID_COMPUTERS (0x00000203L)
  1917. #define DOMAIN_GROUP_RID_CONTROLLERS (0x00000204L)
  1918. #define DOMAIN_GROUP_RID_CERT_ADMINS (0x00000205L)
  1919. #define DOMAIN_GROUP_RID_SCHEMA_ADMINS (0x00000206L)
  1920. #define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS (0x00000207L)
  1921. #define DOMAIN_GROUP_RID_POLICY_ADMINS (0x00000208L)
  1922. #define DOMAIN_GROUP_RID_READONLY_CONTROLLERS (0x00000209L)
  1923. #define DOMAIN_ALIAS_RID_ADMINS (0x00000220L)
  1924. #define DOMAIN_ALIAS_RID_USERS (0x00000221L)
  1925. #define DOMAIN_ALIAS_RID_GUESTS (0x00000222L)
  1926. #define DOMAIN_ALIAS_RID_POWER_USERS (0x00000223L)
  1927. #define DOMAIN_ALIAS_RID_ACCOUNT_OPS (0x00000224L)
  1928. #define DOMAIN_ALIAS_RID_SYSTEM_OPS (0x00000225L)
  1929. #define DOMAIN_ALIAS_RID_PRINT_OPS (0x00000226L)
  1930. #define DOMAIN_ALIAS_RID_BACKUP_OPS (0x00000227L)
  1931. #define DOMAIN_ALIAS_RID_REPLICATOR (0x00000228L)
  1932. #define DOMAIN_ALIAS_RID_RAS_SERVERS (0x00000229L)
  1933. #define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS (0x0000022AL)
  1934. #define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS (0x0000022BL)
  1935. #define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS (0x0000022CL)
  1936. #define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS (0x0000022DL)
  1937. #define DOMAIN_ALIAS_RID_MONITORING_USERS (0x0000022EL)
  1938. #define DOMAIN_ALIAS_RID_LOGGING_USERS (0x0000022FL)
  1939. #define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS (0x00000230L)
  1940. #define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS (0x00000231L)
  1941. #define DOMAIN_ALIAS_RID_DCOM_USERS (0x00000232L)
  1942. #define DOMAIN_ALIAS_RID_IUSERS (0x00000238L)
  1943. #define DOMAIN_ALIAS_RID_CRYPTO_OPERATORS (0x00000239L)
  1944. #define DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP (0x0000023BL)
  1945. #define DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP (0x0000023CL)
  1946. #define DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP (0x0000023DL)
  1947. #define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16}
  1948. #define SECURITY_MANDATORY_UNTRUSTED_RID (0x00000000L)
  1949. #define SECURITY_MANDATORY_LOW_RID (0x00001000L)
  1950. #define SECURITY_MANDATORY_MEDIUM_RID (0x00002000L)
  1951. #define SECURITY_MANDATORY_HIGH_RID (0x00003000L)
  1952. #define SECURITY_MANDATORY_SYSTEM_RID (0x00004000L)
  1953. #define SECURITY_MANDATORY_PROTECTED_PROCESS_RID (0x00005000L)
  1954. #define SECURITY_MANDATORY_MAXIMUM_USER_RID SECURITY_MANDATORY_SYSTEM_RID
  1955. #define MANDATORY_LEVEL_TO_MANDATORY_RID(IL) (IL * 0x1000)
  1956. typedef enum {
  1957. WinNullSid = 0,WinWorldSid = 1,WinLocalSid = 2,WinCreatorOwnerSid = 3,WinCreatorGroupSid = 4,WinCreatorOwnerServerSid = 5,WinCreatorGroupServerSid = 6,WinNtAuthoritySid = 7,WinDialupSid = 8,WinNetworkSid = 9,WinBatchSid = 10,WinInteractiveSid = 11,WinServiceSid = 12,WinAnonymousSid = 13,WinProxySid = 14,WinEnterpriseControllersSid = 15,WinSelfSid = 16,WinAuthenticatedUserSid = 17,WinRestrictedCodeSid = 18,WinTerminalServerSid = 19,WinRemoteLogonIdSid = 20,WinLogonIdsSid = 21,WinLocalSystemSid = 22,WinLocalServiceSid = 23,WinNetworkServiceSid = 24,WinBuiltinDomainSid = 25,WinBuiltinAdministratorsSid = 26,WinBuiltinUsersSid = 27,WinBuiltinGuestsSid = 28,WinBuiltinPowerUsersSid = 29,WinBuiltinAccountOperatorsSid = 30,WinBuiltinSystemOperatorsSid = 31,WinBuiltinPrintOperatorsSid = 32,WinBuiltinBackupOperatorsSid = 33,WinBuiltinReplicatorSid = 34,WinBuiltinPreWindows2000CompatibleAccessSid = 35,WinBuiltinRemoteDesktopUsersSid = 36,WinBuiltinNetworkConfigurationOperatorsSid = 37,WinAccountAdministratorSid = 38,WinAccountGuestSid = 39,WinAccountKrbtgtSid = 40,WinAccountDomainAdminsSid = 41,WinAccountDomainUsersSid = 42,WinAccountDomainGuestsSid = 43,WinAccountComputersSid = 44,WinAccountControllersSid = 45,WinAccountCertAdminsSid = 46,WinAccountSchemaAdminsSid = 47,WinAccountEnterpriseAdminsSid = 48,WinAccountPolicyAdminsSid = 49,WinAccountRasAndIasServersSid = 50,WinNTLMAuthenticationSid = 51,WinDigestAuthenticationSid = 52,WinSChannelAuthenticationSid = 53,WinThisOrganizationSid = 54,WinOtherOrganizationSid = 55,WinBuiltinIncomingForestTrustBuildersSid = 56,WinBuiltinPerfMonitoringUsersSid = 57,WinBuiltinPerfLoggingUsersSid = 58,WinBuiltinAuthorizationAccessSid = 59,WinBuiltinTerminalServerLicenseServersSid = 60,WinBuiltinDCOMUsersSid = 61
  1958. } WELL_KNOWN_SID_TYPE;
  1959. #define SYSTEM_LUID { 0x3E7,0x0 }
  1960. #define ANONYMOUS_LOGON_LUID { 0x3e6,0x0 }
  1961. #define LOCALSERVICE_LUID { 0x3e5,0x0 }
  1962. #define NETWORKSERVICE_LUID { 0x3e4,0x0 }
  1963. #define IUSER_LUID { 0x3e3, 0x0 }
  1964. #define SE_GROUP_MANDATORY (0x00000001L)
  1965. #define SE_GROUP_ENABLED_BY_DEFAULT (0x00000002L)
  1966. #define SE_GROUP_ENABLED (0x00000004L)
  1967. #define SE_GROUP_OWNER (0x00000008L)
  1968. #define SE_GROUP_USE_FOR_DENY_ONLY (0x00000010L)
  1969. #define SE_GROUP_INTEGRITY (0x00000020L)
  1970. #define SE_GROUP_INTEGRITY_ENABLED (0x00000040L)
  1971. #define SE_GROUP_LOGON_ID (0xC0000000L)
  1972. #define SE_GROUP_RESOURCE (0x20000000L)
  1973. #define ACL_REVISION (2)
  1974. #define ACL_REVISION_DS (4)
  1975. #define ACL_REVISION1 (1)
  1976. #define MIN_ACL_REVISION ACL_REVISION2
  1977. #define ACL_REVISION2 (2)
  1978. #define ACL_REVISION3 (3)
  1979. #define ACL_REVISION4 (4)
  1980. #define MAX_ACL_REVISION ACL_REVISION4
  1981. typedef struct _ACL {
  1982. BYTE AclRevision;
  1983. BYTE Sbz1;
  1984. WORD AclSize;
  1985. WORD AceCount;
  1986. WORD Sbz2;
  1987. } ACL;
  1988. typedef ACL *PACL;
  1989. typedef struct _ACE_HEADER {
  1990. BYTE AceType;
  1991. BYTE AceFlags;
  1992. WORD AceSize;
  1993. } ACE_HEADER;
  1994. typedef ACE_HEADER *PACE_HEADER;
  1995. #define ACCESS_MIN_MS_ACE_TYPE (0x0)
  1996. #define ACCESS_ALLOWED_ACE_TYPE (0x0)
  1997. #define ACCESS_DENIED_ACE_TYPE (0x1)
  1998. #define SYSTEM_AUDIT_ACE_TYPE (0x2)
  1999. #define SYSTEM_ALARM_ACE_TYPE (0x3)
  2000. #define ACCESS_MAX_MS_V2_ACE_TYPE (0x3)
  2001. #define ACCESS_ALLOWED_COMPOUND_ACE_TYPE (0x4)
  2002. #define ACCESS_MAX_MS_V3_ACE_TYPE (0x4)
  2003. #define ACCESS_MIN_MS_OBJECT_ACE_TYPE (0x5)
  2004. #define ACCESS_ALLOWED_OBJECT_ACE_TYPE (0x5)
  2005. #define ACCESS_DENIED_OBJECT_ACE_TYPE (0x6)
  2006. #define SYSTEM_AUDIT_OBJECT_ACE_TYPE (0x7)
  2007. #define SYSTEM_ALARM_OBJECT_ACE_TYPE (0x8)
  2008. #define ACCESS_MAX_MS_OBJECT_ACE_TYPE (0x8)
  2009. #define ACCESS_MAX_MS_V4_ACE_TYPE (0x8)
  2010. #define ACCESS_MAX_MS_ACE_TYPE (0x8)
  2011. #define ACCESS_ALLOWED_CALLBACK_ACE_TYPE (0x9)
  2012. #define ACCESS_DENIED_CALLBACK_ACE_TYPE (0xA)
  2013. #define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE (0xB)
  2014. #define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE (0xC)
  2015. #define SYSTEM_AUDIT_CALLBACK_ACE_TYPE (0xD)
  2016. #define SYSTEM_ALARM_CALLBACK_ACE_TYPE (0xE)
  2017. #define SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE (0xF)
  2018. #define SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE (0x10)
  2019. #define SYSTEM_MANDATORY_LABEL_ACE_TYPE (0x11)
  2020. #define ACCESS_MAX_MS_V5_ACE_TYPE (0x11)
  2021. #define OBJECT_INHERIT_ACE (0x1)
  2022. #define CONTAINER_INHERIT_ACE (0x2)
  2023. #define NO_PROPAGATE_INHERIT_ACE (0x4)
  2024. #define INHERIT_ONLY_ACE (0x8)
  2025. #define INHERITED_ACE (0x10)
  2026. #define VALID_INHERIT_FLAGS (0x1F)
  2027. #define SUCCESSFUL_ACCESS_ACE_FLAG (0x40)
  2028. #define FAILED_ACCESS_ACE_FLAG (0x80)
  2029. typedef struct _ACCESS_ALLOWED_ACE {
  2030. ACE_HEADER Header;
  2031. ACCESS_MASK Mask;
  2032. DWORD SidStart;
  2033. } ACCESS_ALLOWED_ACE;
  2034. typedef ACCESS_ALLOWED_ACE *PACCESS_ALLOWED_ACE;
  2035. typedef struct _ACCESS_DENIED_ACE {
  2036. ACE_HEADER Header;
  2037. ACCESS_MASK Mask;
  2038. DWORD SidStart;
  2039. } ACCESS_DENIED_ACE;
  2040. typedef ACCESS_DENIED_ACE *PACCESS_DENIED_ACE;
  2041. typedef struct _SYSTEM_AUDIT_ACE {
  2042. ACE_HEADER Header;
  2043. ACCESS_MASK Mask;
  2044. DWORD SidStart;
  2045. } SYSTEM_AUDIT_ACE;
  2046. typedef SYSTEM_AUDIT_ACE *PSYSTEM_AUDIT_ACE;
  2047. typedef struct _SYSTEM_ALARM_ACE {
  2048. ACE_HEADER Header;
  2049. ACCESS_MASK Mask;
  2050. DWORD SidStart;
  2051. } SYSTEM_ALARM_ACE;
  2052. typedef SYSTEM_ALARM_ACE *PSYSTEM_ALARM_ACE;
  2053. typedef struct _ACCESS_ALLOWED_OBJECT_ACE {
  2054. ACE_HEADER Header;
  2055. ACCESS_MASK Mask;
  2056. DWORD Flags;
  2057. GUID ObjectType;
  2058. GUID InheritedObjectType;
  2059. DWORD SidStart;
  2060. } ACCESS_ALLOWED_OBJECT_ACE,*PACCESS_ALLOWED_OBJECT_ACE;
  2061. typedef struct _ACCESS_DENIED_OBJECT_ACE {
  2062. ACE_HEADER Header;
  2063. ACCESS_MASK Mask;
  2064. DWORD Flags;
  2065. GUID ObjectType;
  2066. GUID InheritedObjectType;
  2067. DWORD SidStart;
  2068. } ACCESS_DENIED_OBJECT_ACE,*PACCESS_DENIED_OBJECT_ACE;
  2069. typedef struct _SYSTEM_AUDIT_OBJECT_ACE {
  2070. ACE_HEADER Header;
  2071. ACCESS_MASK Mask;
  2072. DWORD Flags;
  2073. GUID ObjectType;
  2074. GUID InheritedObjectType;
  2075. DWORD SidStart;
  2076. } SYSTEM_AUDIT_OBJECT_ACE,*PSYSTEM_AUDIT_OBJECT_ACE;
  2077. typedef struct _SYSTEM_ALARM_OBJECT_ACE {
  2078. ACE_HEADER Header;
  2079. ACCESS_MASK Mask;
  2080. DWORD Flags;
  2081. GUID ObjectType;
  2082. GUID InheritedObjectType;
  2083. DWORD SidStart;
  2084. } SYSTEM_ALARM_OBJECT_ACE,*PSYSTEM_ALARM_OBJECT_ACE;
  2085. typedef struct _ACCESS_ALLOWED_CALLBACK_ACE {
  2086. ACE_HEADER Header;
  2087. ACCESS_MASK Mask;
  2088. DWORD SidStart;
  2089. } ACCESS_ALLOWED_CALLBACK_ACE,*PACCESS_ALLOWED_CALLBACK_ACE;
  2090. typedef struct _ACCESS_DENIED_CALLBACK_ACE {
  2091. ACE_HEADER Header;
  2092. ACCESS_MASK Mask;
  2093. DWORD SidStart;
  2094. } ACCESS_DENIED_CALLBACK_ACE,*PACCESS_DENIED_CALLBACK_ACE;
  2095. typedef struct _SYSTEM_AUDIT_CALLBACK_ACE {
  2096. ACE_HEADER Header;
  2097. ACCESS_MASK Mask;
  2098. DWORD SidStart;
  2099. } SYSTEM_AUDIT_CALLBACK_ACE,*PSYSTEM_AUDIT_CALLBACK_ACE;
  2100. typedef struct _SYSTEM_ALARM_CALLBACK_ACE {
  2101. ACE_HEADER Header;
  2102. ACCESS_MASK Mask;
  2103. DWORD SidStart;
  2104. } SYSTEM_ALARM_CALLBACK_ACE,*PSYSTEM_ALARM_CALLBACK_ACE;
  2105. typedef struct _ACCESS_ALLOWED_CALLBACK_OBJECT_ACE {
  2106. ACE_HEADER Header;
  2107. ACCESS_MASK Mask;
  2108. DWORD Flags;
  2109. GUID ObjectType;
  2110. GUID InheritedObjectType;
  2111. DWORD SidStart;
  2112. } ACCESS_ALLOWED_CALLBACK_OBJECT_ACE,*PACCESS_ALLOWED_CALLBACK_OBJECT_ACE;
  2113. typedef struct _ACCESS_DENIED_CALLBACK_OBJECT_ACE {
  2114. ACE_HEADER Header;
  2115. ACCESS_MASK Mask;
  2116. DWORD Flags;
  2117. GUID ObjectType;
  2118. GUID InheritedObjectType;
  2119. DWORD SidStart;
  2120. } ACCESS_DENIED_CALLBACK_OBJECT_ACE,*PACCESS_DENIED_CALLBACK_OBJECT_ACE;
  2121. typedef struct _SYSTEM_AUDIT_CALLBACK_OBJECT_ACE {
  2122. ACE_HEADER Header;
  2123. ACCESS_MASK Mask;
  2124. DWORD Flags;
  2125. GUID ObjectType;
  2126. GUID InheritedObjectType;
  2127. DWORD SidStart;
  2128. } SYSTEM_AUDIT_CALLBACK_OBJECT_ACE,*PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE;
  2129. typedef struct _SYSTEM_ALARM_CALLBACK_OBJECT_ACE {
  2130. ACE_HEADER Header;
  2131. ACCESS_MASK Mask;
  2132. DWORD Flags;
  2133. GUID ObjectType;
  2134. GUID InheritedObjectType;
  2135. DWORD SidStart;
  2136. } SYSTEM_ALARM_CALLBACK_OBJECT_ACE,*PSYSTEM_ALARM_CALLBACK_OBJECT_ACE;
  2137. #define ACE_OBJECT_TYPE_PRESENT 0x1
  2138. #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x2
  2139. typedef enum _ACL_INFORMATION_CLASS {
  2140. AclRevisionInformation = 1,AclSizeInformation
  2141. } ACL_INFORMATION_CLASS;
  2142. typedef struct _ACL_REVISION_INFORMATION {
  2143. DWORD AclRevision;
  2144. } ACL_REVISION_INFORMATION;
  2145. typedef ACL_REVISION_INFORMATION *PACL_REVISION_INFORMATION;
  2146. typedef struct _ACL_SIZE_INFORMATION {
  2147. DWORD AceCount;
  2148. DWORD AclBytesInUse;
  2149. DWORD AclBytesFree;
  2150. } ACL_SIZE_INFORMATION;
  2151. typedef ACL_SIZE_INFORMATION *PACL_SIZE_INFORMATION;
  2152. #define SECURITY_DESCRIPTOR_REVISION (1)
  2153. #define SECURITY_DESCRIPTOR_REVISION1 (1)
  2154. #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
  2155. typedef WORD SECURITY_DESCRIPTOR_CONTROL,*PSECURITY_DESCRIPTOR_CONTROL;
  2156. #define SE_OWNER_DEFAULTED (0x0001)
  2157. #define SE_GROUP_DEFAULTED (0x0002)
  2158. #define SE_DACL_PRESENT (0x0004)
  2159. #define SE_DACL_DEFAULTED (0x0008)
  2160. #define SE_SACL_PRESENT (0x0010)
  2161. #define SE_SACL_DEFAULTED (0x0020)
  2162. #define SE_DACL_AUTO_INHERIT_REQ (0x0100)
  2163. #define SE_SACL_AUTO_INHERIT_REQ (0x0200)
  2164. #define SE_DACL_AUTO_INHERITED (0x0400)
  2165. #define SE_SACL_AUTO_INHERITED (0x0800)
  2166. #define SE_DACL_PROTECTED (0x1000)
  2167. #define SE_SACL_PROTECTED (0x2000)
  2168. #define SE_RM_CONTROL_VALID (0x4000)
  2169. #define SE_SELF_RELATIVE (0x8000)
  2170. typedef struct _SECURITY_DESCRIPTOR_RELATIVE {
  2171. BYTE Revision;
  2172. BYTE Sbz1;
  2173. SECURITY_DESCRIPTOR_CONTROL Control;
  2174. DWORD Owner;
  2175. DWORD Group;
  2176. DWORD Sacl;
  2177. DWORD Dacl;
  2178. } SECURITY_DESCRIPTOR_RELATIVE,*PISECURITY_DESCRIPTOR_RELATIVE;
  2179. typedef struct _SECURITY_DESCRIPTOR {
  2180. BYTE Revision;
  2181. BYTE Sbz1;
  2182. SECURITY_DESCRIPTOR_CONTROL Control;
  2183. PSID Owner;
  2184. PSID Group;
  2185. PACL Sacl;
  2186. PACL Dacl;
  2187. } SECURITY_DESCRIPTOR,*PISECURITY_DESCRIPTOR;
  2188. typedef struct _OBJECT_TYPE_LIST {
  2189. WORD Level;
  2190. WORD Sbz;
  2191. GUID *ObjectType;
  2192. } OBJECT_TYPE_LIST,*POBJECT_TYPE_LIST;
  2193. #define ACCESS_OBJECT_GUID 0
  2194. #define ACCESS_PROPERTY_SET_GUID 1
  2195. #define ACCESS_PROPERTY_GUID 2
  2196. #define ACCESS_MAX_LEVEL 4
  2197. typedef enum _AUDIT_EVENT_TYPE {
  2198. AuditEventObjectAccess,AuditEventDirectoryServiceAccess
  2199. } AUDIT_EVENT_TYPE,*PAUDIT_EVENT_TYPE;
  2200. #define AUDIT_ALLOW_NO_PRIVILEGE 0x1
  2201. #define ACCESS_DS_SOURCE_A "DS"
  2202. #define ACCESS_DS_SOURCE_W L"DS"
  2203. #define ACCESS_DS_OBJECT_TYPE_NAME_A "Directory Service Object"
  2204. #define ACCESS_DS_OBJECT_TYPE_NAME_W L"Directory Service Object"
  2205. #define SE_PRIVILEGE_ENABLED_BY_DEFAULT (0x00000001L)
  2206. #define SE_PRIVILEGE_ENABLED (0x00000002L)
  2207. #define SE_PRIVILEGE_REMOVED (0X00000004L)
  2208. #define SE_PRIVILEGE_USED_FOR_ACCESS (0x80000000L)
  2209. #define PRIVILEGE_SET_ALL_NECESSARY (1)
  2210. typedef struct _PRIVILEGE_SET {
  2211. DWORD PrivilegeCount;
  2212. DWORD Control;
  2213. LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
  2214. } PRIVILEGE_SET,*PPRIVILEGE_SET;
  2215. #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
  2216. #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
  2217. #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
  2218. #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
  2219. #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
  2220. #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
  2221. #define SE_TCB_NAME TEXT("SeTcbPrivilege")
  2222. #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
  2223. #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
  2224. #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
  2225. #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
  2226. #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
  2227. #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
  2228. #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
  2229. #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
  2230. #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
  2231. #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
  2232. #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
  2233. #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
  2234. #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
  2235. #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
  2236. #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
  2237. #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
  2238. #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
  2239. #define SE_UNDOCK_NAME TEXT("SeUndockPrivilege")
  2240. #define SE_SYNC_AGENT_NAME TEXT("SeSyncAgentPrivilege")
  2241. #define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege")
  2242. #define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege")
  2243. #define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege")
  2244. #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
  2245. typedef enum _SECURITY_IMPERSONATION_LEVEL {
  2246. SecurityAnonymous,SecurityIdentification,SecurityImpersonation,SecurityDelegation
  2247. } SECURITY_IMPERSONATION_LEVEL,*PSECURITY_IMPERSONATION_LEVEL;
  2248. #define SECURITY_MAX_IMPERSONATION_LEVEL SecurityDelegation
  2249. #define SECURITY_MIN_IMPERSONATION_LEVEL SecurityAnonymous
  2250. #define DEFAULT_IMPERSONATION_LEVEL SecurityImpersonation
  2251. #define VALID_IMPERSONATION_LEVEL(L) (((L) >= SECURITY_MIN_IMPERSONATION_LEVEL) && ((L) <= SECURITY_MAX_IMPERSONATION_LEVEL))
  2252. #define TOKEN_ASSIGN_PRIMARY (0x0001)
  2253. #define TOKEN_DUPLICATE (0x0002)
  2254. #define TOKEN_IMPERSONATE (0x0004)
  2255. #define TOKEN_QUERY (0x0008)
  2256. #define TOKEN_QUERY_SOURCE (0x0010)
  2257. #define TOKEN_ADJUST_PRIVILEGES (0x0020)
  2258. #define TOKEN_ADJUST_GROUPS (0x0040)
  2259. #define TOKEN_ADJUST_DEFAULT (0x0080)
  2260. #define TOKEN_ADJUST_SESSIONID (0x0100)
  2261. #define TOKEN_ALL_ACCESS_P (STANDARD_RIGHTS_REQUIRED | TOKEN_ASSIGN_PRIMARY | TOKEN_DUPLICATE | TOKEN_IMPERSONATE | TOKEN_QUERY | TOKEN_QUERY_SOURCE | TOKEN_ADJUST_PRIVILEGES | TOKEN_ADJUST_GROUPS | TOKEN_ADJUST_DEFAULT)
  2262. #define TOKEN_ALL_ACCESS (TOKEN_ALL_ACCESS_P | TOKEN_ADJUST_SESSIONID)
  2263. #define TOKEN_READ (STANDARD_RIGHTS_READ | TOKEN_QUERY)
  2264. #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | TOKEN_ADJUST_PRIVILEGES | TOKEN_ADJUST_GROUPS | TOKEN_ADJUST_DEFAULT)
  2265. #define TOKEN_EXECUTE (STANDARD_RIGHTS_EXECUTE)
  2266. typedef enum _TOKEN_TYPE {
  2267. TokenPrimary = 1,TokenImpersonation
  2268. } TOKEN_TYPE;
  2269. typedef TOKEN_TYPE *PTOKEN_TYPE;
  2270. typedef enum _TOKEN_INFORMATION_CLASS {
  2271. TokenUser = 1,TokenGroups,TokenPrivileges,TokenOwner,TokenPrimaryGroup,TokenDefaultDacl,TokenSource,TokenType,TokenImpersonationLevel,
  2272. TokenStatistics,TokenRestrictedSids,TokenSessionId,TokenGroupsAndPrivileges,TokenSessionReference,TokenSandBoxInert,TokenAuditPolicy,
  2273. TokenOrigin,MaxTokenInfoClass
  2274. } TOKEN_INFORMATION_CLASS,*PTOKEN_INFORMATION_CLASS;
  2275. typedef struct _TOKEN_USER {
  2276. SID_AND_ATTRIBUTES User;
  2277. } TOKEN_USER,*PTOKEN_USER;
  2278. typedef struct _TOKEN_GROUPS {
  2279. DWORD GroupCount;
  2280. SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
  2281. } TOKEN_GROUPS,*PTOKEN_GROUPS;
  2282. typedef struct _TOKEN_PRIVILEGES {
  2283. DWORD PrivilegeCount;
  2284. LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
  2285. } TOKEN_PRIVILEGES,*PTOKEN_PRIVILEGES;
  2286. typedef struct _TOKEN_OWNER {
  2287. PSID Owner;
  2288. } TOKEN_OWNER,*PTOKEN_OWNER;
  2289. typedef struct _TOKEN_PRIMARY_GROUP {
  2290. PSID PrimaryGroup;
  2291. } TOKEN_PRIMARY_GROUP,*PTOKEN_PRIMARY_GROUP;
  2292. typedef struct _TOKEN_DEFAULT_DACL {
  2293. PACL DefaultDacl;
  2294. } TOKEN_DEFAULT_DACL,*PTOKEN_DEFAULT_DACL;
  2295. typedef struct _TOKEN_GROUPS_AND_PRIVILEGES {
  2296. DWORD SidCount;
  2297. DWORD SidLength;
  2298. PSID_AND_ATTRIBUTES Sids;
  2299. DWORD RestrictedSidCount;
  2300. DWORD RestrictedSidLength;
  2301. PSID_AND_ATTRIBUTES RestrictedSids;
  2302. DWORD PrivilegeCount;
  2303. DWORD PrivilegeLength;
  2304. PLUID_AND_ATTRIBUTES Privileges;
  2305. LUID AuthenticationId;
  2306. } TOKEN_GROUPS_AND_PRIVILEGES,*PTOKEN_GROUPS_AND_PRIVILEGES;
  2307. #define TOKEN_AUDIT_SUCCESS_INCLUDE 0x1
  2308. #define TOKEN_AUDIT_SUCCESS_EXCLUDE 0x2
  2309. #define TOKEN_AUDIT_FAILURE_INCLUDE 0x4
  2310. #define TOKEN_AUDIT_FAILURE_EXCLUDE 0x8
  2311. #define VALID_AUDIT_POLICY_BITS (TOKEN_AUDIT_SUCCESS_INCLUDE | TOKEN_AUDIT_SUCCESS_EXCLUDE | TOKEN_AUDIT_FAILURE_INCLUDE | TOKEN_AUDIT_FAILURE_EXCLUDE)
  2312. #define VALID_TOKEN_AUDIT_POLICY_ELEMENT(P) ((((P).PolicyMask & ~VALID_AUDIT_POLICY_BITS)==0) && ((P).Category <= AuditEventMaxType))
  2313. typedef struct _TOKEN_AUDIT_POLICY_ELEMENT {
  2314. DWORD Category;
  2315. DWORD PolicyMask;
  2316. } TOKEN_AUDIT_POLICY_ELEMENT,*PTOKEN_AUDIT_POLICY_ELEMENT;
  2317. typedef struct _TOKEN_AUDIT_POLICY {
  2318. DWORD PolicyCount;
  2319. TOKEN_AUDIT_POLICY_ELEMENT Policy[ANYSIZE_ARRAY];
  2320. } TOKEN_AUDIT_POLICY,*PTOKEN_AUDIT_POLICY;
  2321. #define PER_USER_AUDITING_POLICY_SIZE(p) (sizeof(TOKEN_AUDIT_POLICY) + (((p)->PolicyCount > ANYSIZE_ARRAY) ? (sizeof(TOKEN_AUDIT_POLICY_ELEMENT) *((p)->PolicyCount - ANYSIZE_ARRAY)) : 0))
  2322. #define PER_USER_AUDITING_POLICY_SIZE_BY_COUNT(C) (sizeof(TOKEN_AUDIT_POLICY) + (((C) > ANYSIZE_ARRAY) ? (sizeof(TOKEN_AUDIT_POLICY_ELEMENT) *((C) - ANYSIZE_ARRAY)) : 0))
  2323. #define TOKEN_SOURCE_LENGTH 8
  2324. typedef struct _TOKEN_SOURCE {
  2325. CHAR SourceName[TOKEN_SOURCE_LENGTH];
  2326. LUID SourceIdentifier;
  2327. } TOKEN_SOURCE,*PTOKEN_SOURCE;
  2328. typedef struct _TOKEN_STATISTICS {
  2329. LUID TokenId;
  2330. LUID AuthenticationId;
  2331. LARGE_INTEGER ExpirationTime;
  2332. TOKEN_TYPE TokenType;
  2333. SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
  2334. DWORD DynamicCharged;
  2335. DWORD DynamicAvailable;
  2336. DWORD GroupCount;
  2337. DWORD PrivilegeCount;
  2338. LUID ModifiedId;
  2339. } TOKEN_STATISTICS,*PTOKEN_STATISTICS;
  2340. typedef struct _TOKEN_CONTROL {
  2341. LUID TokenId;
  2342. LUID AuthenticationId;
  2343. LUID ModifiedId;
  2344. TOKEN_SOURCE TokenSource;
  2345. } TOKEN_CONTROL,*PTOKEN_CONTROL;
  2346. typedef struct _TOKEN_ORIGIN {
  2347. LUID OriginatingLogonSession;
  2348. } TOKEN_ORIGIN,*PTOKEN_ORIGIN;
  2349. #define SECURITY_DYNAMIC_TRACKING (TRUE)
  2350. #define SECURITY_STATIC_TRACKING (FALSE)
  2351. typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,*PSECURITY_CONTEXT_TRACKING_MODE;
  2352. typedef struct _SECURITY_QUALITY_OF_SERVICE {
  2353. DWORD Length;
  2354. SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
  2355. SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
  2356. BOOLEAN EffectiveOnly;
  2357. } SECURITY_QUALITY_OF_SERVICE,*PSECURITY_QUALITY_OF_SERVICE;
  2358. typedef struct _SE_IMPERSONATION_STATE {
  2359. PACCESS_TOKEN Token;
  2360. BOOLEAN CopyOnOpen;
  2361. BOOLEAN EffectiveOnly;
  2362. SECURITY_IMPERSONATION_LEVEL Level;
  2363. } SE_IMPERSONATION_STATE,*PSE_IMPERSONATION_STATE;
  2364. #define DISABLE_MAX_PRIVILEGE 0x1
  2365. #define SANDBOX_INERT 0x2
  2366. typedef DWORD SECURITY_INFORMATION,*PSECURITY_INFORMATION;
  2367. #define OWNER_SECURITY_INFORMATION (0x00000001L)
  2368. #define GROUP_SECURITY_INFORMATION (0x00000002L)
  2369. #define DACL_SECURITY_INFORMATION (0x00000004L)
  2370. #define SACL_SECURITY_INFORMATION (0x00000008L)
  2371. #define PROTECTED_DACL_SECURITY_INFORMATION (0x80000000L)
  2372. #define PROTECTED_SACL_SECURITY_INFORMATION (0x40000000L)
  2373. #define UNPROTECTED_DACL_SECURITY_INFORMATION (0x20000000L)
  2374. #define UNPROTECTED_SACL_SECURITY_INFORMATION (0x10000000L)
  2375. #define PROCESS_TERMINATE (0x0001)
  2376. #define PROCESS_CREATE_THREAD (0x0002)
  2377. #define PROCESS_SET_SESSIONID (0x0004)
  2378. #define PROCESS_VM_OPERATION (0x0008)
  2379. #define PROCESS_VM_READ (0x0010)
  2380. #define PROCESS_VM_WRITE (0x0020)
  2381. #define PROCESS_DUP_HANDLE (0x0040)
  2382. #define PROCESS_CREATE_PROCESS (0x0080)
  2383. #define PROCESS_SET_QUOTA (0x0100)
  2384. #define PROCESS_SET_INFORMATION (0x0200)
  2385. #define PROCESS_QUERY_INFORMATION (0x0400)
  2386. #define PROCESS_SUSPEND_RESUME (0x0800)
  2387. #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFF)
  2388. #ifdef _WIN64
  2389. #define MAXIMUM_PROCESSORS 64
  2390. #else
  2391. #define MAXIMUM_PROCESSORS 32
  2392. #endif
  2393. #define THREAD_TERMINATE (0x0001)
  2394. #define THREAD_SUSPEND_RESUME (0x0002)
  2395. #define THREAD_GET_CONTEXT (0x0008)
  2396. #define THREAD_SET_CONTEXT (0x0010)
  2397. #define THREAD_SET_INFORMATION (0x0020)
  2398. #define THREAD_QUERY_INFORMATION (0x0040)
  2399. #define THREAD_SET_THREAD_TOKEN (0x0080)
  2400. #define THREAD_IMPERSONATE (0x0100)
  2401. #define THREAD_DIRECT_IMPERSONATION (0x0200)
  2402. #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3FF)
  2403. #define JOB_OBJECT_ASSIGN_PROCESS (0x0001)
  2404. #define JOB_OBJECT_SET_ATTRIBUTES (0x0002)
  2405. #define JOB_OBJECT_QUERY (0x0004)
  2406. #define JOB_OBJECT_TERMINATE (0x0008)
  2407. #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES (0x0010)
  2408. #define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1F)
  2409. typedef struct _JOB_SET_ARRAY {
  2410. HANDLE JobHandle;
  2411. DWORD MemberLevel;
  2412. DWORD Flags;
  2413. } JOB_SET_ARRAY,*PJOB_SET_ARRAY;
  2414. #define FLS_MAXIMUM_AVAILABLE 128
  2415. #define TLS_MINIMUM_AVAILABLE 64
  2416. #ifndef _NT_TIB_DEFINED
  2417. #define _NT_TIB_DEFINED
  2418. typedef struct _NT_TIB {
  2419. struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
  2420. PVOID StackBase;
  2421. PVOID StackLimit;
  2422. PVOID SubSystemTib;
  2423. union {
  2424. PVOID FiberData;
  2425. DWORD Version;
  2426. };
  2427. PVOID ArbitraryUserPointer;
  2428. struct _NT_TIB *Self;
  2429. } NT_TIB;
  2430. typedef NT_TIB *PNT_TIB;
  2431. #endif
  2432. typedef struct _NT_TIB32 {
  2433. DWORD ExceptionList;
  2434. DWORD StackBase;
  2435. DWORD StackLimit;
  2436. DWORD SubSystemTib;
  2437. union {
  2438. DWORD FiberData;
  2439. DWORD Version;
  2440. };
  2441. DWORD ArbitraryUserPointer;
  2442. DWORD Self;
  2443. } NT_TIB32,*PNT_TIB32;
  2444. typedef struct _NT_TIB64 {
  2445. DWORD64 ExceptionList;
  2446. DWORD64 StackBase;
  2447. DWORD64 StackLimit;
  2448. DWORD64 SubSystemTib;
  2449. union {
  2450. DWORD64 FiberData;
  2451. DWORD Version;
  2452. };
  2453. DWORD64 ArbitraryUserPointer;
  2454. DWORD64 Self;
  2455. } NT_TIB64,*PNT_TIB64;
  2456. #if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_)
  2457. #define WX86
  2458. #endif
  2459. #define THREAD_BASE_PRIORITY_LOWRT 15
  2460. #define THREAD_BASE_PRIORITY_MAX 2
  2461. #define THREAD_BASE_PRIORITY_MIN (-2)
  2462. #define THREAD_BASE_PRIORITY_IDLE (-15)
  2463. typedef struct _QUOTA_LIMITS {
  2464. SIZE_T PagedPoolLimit;
  2465. SIZE_T NonPagedPoolLimit;
  2466. SIZE_T MinimumWorkingSetSize;
  2467. SIZE_T MaximumWorkingSetSize;
  2468. SIZE_T PagefileLimit;
  2469. LARGE_INTEGER TimeLimit;
  2470. } QUOTA_LIMITS,*PQUOTA_LIMITS;
  2471. #define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001
  2472. #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002
  2473. #define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004
  2474. #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008
  2475. typedef struct _QUOTA_LIMITS_EX {
  2476. SIZE_T PagedPoolLimit;
  2477. SIZE_T NonPagedPoolLimit;
  2478. SIZE_T MinimumWorkingSetSize;
  2479. SIZE_T MaximumWorkingSetSize;
  2480. SIZE_T PagefileLimit;
  2481. LARGE_INTEGER TimeLimit;
  2482. SIZE_T Reserved1;
  2483. SIZE_T Reserved2;
  2484. SIZE_T Reserved3;
  2485. SIZE_T Reserved4;
  2486. DWORD Flags;
  2487. DWORD Reserved5;
  2488. } QUOTA_LIMITS_EX,*PQUOTA_LIMITS_EX;
  2489. typedef struct _IO_COUNTERS {
  2490. ULONGLONG ReadOperationCount;
  2491. ULONGLONG WriteOperationCount;
  2492. ULONGLONG OtherOperationCount;
  2493. ULONGLONG ReadTransferCount;
  2494. ULONGLONG WriteTransferCount;
  2495. ULONGLONG OtherTransferCount;
  2496. } IO_COUNTERS;
  2497. typedef IO_COUNTERS *PIO_COUNTERS;
  2498. typedef struct _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION {
  2499. LARGE_INTEGER TotalUserTime;
  2500. LARGE_INTEGER TotalKernelTime;
  2501. LARGE_INTEGER ThisPeriodTotalUserTime;
  2502. LARGE_INTEGER ThisPeriodTotalKernelTime;
  2503. DWORD TotalPageFaultCount;
  2504. DWORD TotalProcesses;
  2505. DWORD ActiveProcesses;
  2506. DWORD TotalTerminatedProcesses;
  2507. } JOBOBJECT_BASIC_ACCOUNTING_INFORMATION,*PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION;
  2508. typedef struct _JOBOBJECT_BASIC_LIMIT_INFORMATION {
  2509. LARGE_INTEGER PerProcessUserTimeLimit;
  2510. LARGE_INTEGER PerJobUserTimeLimit;
  2511. DWORD LimitFlags;
  2512. SIZE_T MinimumWorkingSetSize;
  2513. SIZE_T MaximumWorkingSetSize;
  2514. DWORD ActiveProcessLimit;
  2515. ULONG_PTR Affinity;
  2516. DWORD PriorityClass;
  2517. DWORD SchedulingClass;
  2518. } JOBOBJECT_BASIC_LIMIT_INFORMATION,*PJOBOBJECT_BASIC_LIMIT_INFORMATION;
  2519. typedef struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION {
  2520. JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation;
  2521. IO_COUNTERS IoInfo;
  2522. SIZE_T ProcessMemoryLimit;
  2523. SIZE_T JobMemoryLimit;
  2524. SIZE_T PeakProcessMemoryUsed;
  2525. SIZE_T PeakJobMemoryUsed;
  2526. } JOBOBJECT_EXTENDED_LIMIT_INFORMATION,*PJOBOBJECT_EXTENDED_LIMIT_INFORMATION;
  2527. typedef struct _JOBOBJECT_BASIC_PROCESS_ID_LIST {
  2528. DWORD NumberOfAssignedProcesses;
  2529. DWORD NumberOfProcessIdsInList;
  2530. ULONG_PTR ProcessIdList[1];
  2531. } JOBOBJECT_BASIC_PROCESS_ID_LIST,*PJOBOBJECT_BASIC_PROCESS_ID_LIST;
  2532. typedef struct _JOBOBJECT_BASIC_UI_RESTRICTIONS {
  2533. DWORD UIRestrictionsClass;
  2534. } JOBOBJECT_BASIC_UI_RESTRICTIONS,*PJOBOBJECT_BASIC_UI_RESTRICTIONS;
  2535. typedef struct _JOBOBJECT_SECURITY_LIMIT_INFORMATION {
  2536. DWORD SecurityLimitFlags;
  2537. HANDLE JobToken;
  2538. PTOKEN_GROUPS SidsToDisable;
  2539. PTOKEN_PRIVILEGES PrivilegesToDelete;
  2540. PTOKEN_GROUPS RestrictedSids;
  2541. } JOBOBJECT_SECURITY_LIMIT_INFORMATION,*PJOBOBJECT_SECURITY_LIMIT_INFORMATION;
  2542. typedef struct _JOBOBJECT_END_OF_JOB_TIME_INFORMATION {
  2543. DWORD EndOfJobTimeAction;
  2544. } JOBOBJECT_END_OF_JOB_TIME_INFORMATION,*PJOBOBJECT_END_OF_JOB_TIME_INFORMATION;
  2545. typedef struct _JOBOBJECT_ASSOCIATE_COMPLETION_PORT {
  2546. PVOID CompletionKey;
  2547. HANDLE CompletionPort;
  2548. } JOBOBJECT_ASSOCIATE_COMPLETION_PORT,*PJOBOBJECT_ASSOCIATE_COMPLETION_PORT;
  2549. typedef struct _JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION {
  2550. JOBOBJECT_BASIC_ACCOUNTING_INFORMATION BasicInfo;
  2551. IO_COUNTERS IoInfo;
  2552. } JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION,*PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION;
  2553. typedef struct _JOBOBJECT_JOBSET_INFORMATION {
  2554. DWORD MemberLevel;
  2555. } JOBOBJECT_JOBSET_INFORMATION,*PJOBOBJECT_JOBSET_INFORMATION;
  2556. #define JOB_OBJECT_TERMINATE_AT_END_OF_JOB 0
  2557. #define JOB_OBJECT_POST_AT_END_OF_JOB 1
  2558. #define JOB_OBJECT_MSG_END_OF_JOB_TIME 1
  2559. #define JOB_OBJECT_MSG_END_OF_PROCESS_TIME 2
  2560. #define JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT 3
  2561. #define JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO 4
  2562. #define JOB_OBJECT_MSG_NEW_PROCESS 6
  2563. #define JOB_OBJECT_MSG_EXIT_PROCESS 7
  2564. #define JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS 8
  2565. #define JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT 9
  2566. #define JOB_OBJECT_MSG_JOB_MEMORY_LIMIT 10
  2567. #define JOB_OBJECT_LIMIT_WORKINGSET 0x00000001
  2568. #define JOB_OBJECT_LIMIT_PROCESS_TIME 0x00000002
  2569. #define JOB_OBJECT_LIMIT_JOB_TIME 0x00000004
  2570. #define JOB_OBJECT_LIMIT_ACTIVE_PROCESS 0x00000008
  2571. #define JOB_OBJECT_LIMIT_AFFINITY 0x00000010
  2572. #define JOB_OBJECT_LIMIT_PRIORITY_CLASS 0x00000020
  2573. #define JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME 0x00000040
  2574. #define JOB_OBJECT_LIMIT_SCHEDULING_CLASS 0x00000080
  2575. #define JOB_OBJECT_LIMIT_PROCESS_MEMORY 0x00000100
  2576. #define JOB_OBJECT_LIMIT_JOB_MEMORY 0x00000200
  2577. #define JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION 0x00000400
  2578. #define JOB_OBJECT_LIMIT_BREAKAWAY_OK 0x00000800
  2579. #define JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK 0x00001000
  2580. #define JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE 0x00002000
  2581. #define JOB_OBJECT_LIMIT_RESERVED2 0x00004000
  2582. #define JOB_OBJECT_LIMIT_RESERVED3 0x00008000
  2583. #define JOB_OBJECT_LIMIT_RESERVED4 0x00010000
  2584. #define JOB_OBJECT_LIMIT_RESERVED5 0x00020000
  2585. #define JOB_OBJECT_LIMIT_RESERVED6 0x00040000
  2586. #define JOB_OBJECT_LIMIT_VALID_FLAGS 0x0007ffff
  2587. #define JOB_OBJECT_BASIC_LIMIT_VALID_FLAGS 0x000000ff
  2588. #define JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS 0x00003fff
  2589. #define JOB_OBJECT_RESERVED_LIMIT_VALID_FLAGS 0x0007ffff
  2590. #define JOB_OBJECT_UILIMIT_NONE 0x00000000
  2591. #define JOB_OBJECT_UILIMIT_HANDLES 0x00000001
  2592. #define JOB_OBJECT_UILIMIT_READCLIPBOARD 0x00000002
  2593. #define JOB_OBJECT_UILIMIT_WRITECLIPBOARD 0x00000004
  2594. #define JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS 0x00000008
  2595. #define JOB_OBJECT_UILIMIT_DISPLAYSETTINGS 0x00000010
  2596. #define JOB_OBJECT_UILIMIT_GLOBALATOMS 0x00000020
  2597. #define JOB_OBJECT_UILIMIT_DESKTOP 0x00000040
  2598. #define JOB_OBJECT_UILIMIT_EXITWINDOWS 0x00000080
  2599. #define JOB_OBJECT_UILIMIT_ALL 0x000000FF
  2600. #define JOB_OBJECT_UI_VALID_FLAGS 0x000000FF
  2601. #define JOB_OBJECT_SECURITY_NO_ADMIN 0x00000001
  2602. #define JOB_OBJECT_SECURITY_RESTRICTED_TOKEN 0x00000002
  2603. #define JOB_OBJECT_SECURITY_ONLY_TOKEN 0x00000004
  2604. #define JOB_OBJECT_SECURITY_FILTER_TOKENS 0x00000008
  2605. #define JOB_OBJECT_SECURITY_VALID_FLAGS 0x0000000f
  2606. typedef enum _JOBOBJECTINFOCLASS {
  2607. JobObjectBasicAccountingInformation = 1,JobObjectBasicLimitInformation,JobObjectBasicProcessIdList,JobObjectBasicUIRestrictions,
  2608. JobObjectSecurityLimitInformation,JobObjectEndOfJobTimeInformation,JobObjectAssociateCompletionPortInformation,
  2609. JobObjectBasicAndIoAccountingInformation,JobObjectExtendedLimitInformation,JobObjectJobSetInformation,MaxJobObjectInfoClass
  2610. } JOBOBJECTINFOCLASS;
  2611. #define EVENT_MODIFY_STATE 0x0002
  2612. #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
  2613. #define MUTANT_QUERY_STATE 0x0001
  2614. #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE| MUTANT_QUERY_STATE)
  2615. #define SEMAPHORE_MODIFY_STATE 0x0002
  2616. #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
  2617. #define TIMER_QUERY_STATE 0x0001
  2618. #define TIMER_MODIFY_STATE 0x0002
  2619. #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE| TIMER_QUERY_STATE|TIMER_MODIFY_STATE)
  2620. #define TIME_ZONE_ID_UNKNOWN 0
  2621. #define TIME_ZONE_ID_STANDARD 1
  2622. #define TIME_ZONE_ID_DAYLIGHT 2
  2623. typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP {
  2624. RelationProcessorCore,RelationNumaNode,RelationCache
  2625. } LOGICAL_PROCESSOR_RELATIONSHIP;
  2626. #define LTP_PC_SMT 0x1
  2627. typedef enum _PROCESSOR_CACHE_TYPE {
  2628. CacheUnified,CacheInstruction,CacheData,CacheTrace
  2629. } PROCESSOR_CACHE_TYPE;
  2630. #define CACHE_FULLY_ASSOCIATIVE 0xFF
  2631. typedef struct _CACHE_DESCRIPTOR {
  2632. BYTE Level;
  2633. BYTE Associativity;
  2634. WORD LineSize;
  2635. DWORD Size;
  2636. PROCESSOR_CACHE_TYPE Type;
  2637. } CACHE_DESCRIPTOR,*PCACHE_DESCRIPTOR;
  2638. typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION {
  2639. ULONG_PTR ProcessorMask;
  2640. LOGICAL_PROCESSOR_RELATIONSHIP Relationship;
  2641. union {
  2642. struct {
  2643. BYTE Flags;
  2644. } ProcessorCore;
  2645. struct {
  2646. DWORD NodeNumber;
  2647. } NumaNode;
  2648. CACHE_DESCRIPTOR Cache;
  2649. ULONGLONG Reserved[2];
  2650. };
  2651. } SYSTEM_LOGICAL_PROCESSOR_INFORMATION,*PSYSTEM_LOGICAL_PROCESSOR_INFORMATION;
  2652. #define PROCESSOR_INTEL_386 386
  2653. #define PROCESSOR_INTEL_486 486
  2654. #define PROCESSOR_INTEL_PENTIUM 586
  2655. #define PROCESSOR_INTEL_IA64 2200
  2656. #define PROCESSOR_AMD_X8664 8664
  2657. #define PROCESSOR_MIPS_R4000 4000
  2658. #define PROCESSOR_ALPHA_21064 21064
  2659. #define PROCESSOR_PPC_601 601
  2660. #define PROCESSOR_PPC_603 603
  2661. #define PROCESSOR_PPC_604 604
  2662. #define PROCESSOR_PPC_620 620
  2663. #define PROCESSOR_HITACHI_SH3 10003
  2664. #define PROCESSOR_HITACHI_SH3E 10004
  2665. #define PROCESSOR_HITACHI_SH4 10005
  2666. #define PROCESSOR_MOTOROLA_821 821
  2667. #define PROCESSOR_SHx_SH3 103
  2668. #define PROCESSOR_SHx_SH4 104
  2669. #define PROCESSOR_STRONGARM 2577
  2670. #define PROCESSOR_ARM720 1824
  2671. #define PROCESSOR_ARM820 2080
  2672. #define PROCESSOR_ARM920 2336
  2673. #define PROCESSOR_ARM_7TDMI 70001
  2674. #define PROCESSOR_OPTIL 0x494f
  2675. #define PROCESSOR_ARCHITECTURE_INTEL 0
  2676. #define PROCESSOR_ARCHITECTURE_MIPS 1
  2677. #define PROCESSOR_ARCHITECTURE_ALPHA 2
  2678. #define PROCESSOR_ARCHITECTURE_PPC 3
  2679. #define PROCESSOR_ARCHITECTURE_SHX 4
  2680. #define PROCESSOR_ARCHITECTURE_ARM 5
  2681. #define PROCESSOR_ARCHITECTURE_IA64 6
  2682. #define PROCESSOR_ARCHITECTURE_ALPHA64 7
  2683. #define PROCESSOR_ARCHITECTURE_MSIL 8
  2684. #define PROCESSOR_ARCHITECTURE_AMD64 9
  2685. #define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
  2686. #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
  2687. #define PF_FLOATING_POINT_PRECISION_ERRATA 0
  2688. #define PF_FLOATING_POINT_EMULATED 1
  2689. #define PF_COMPARE_EXCHANGE_DOUBLE 2
  2690. #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
  2691. #define PF_PPC_MOVEMEM_64BIT_OK 4
  2692. #define PF_ALPHA_BYTE_INSTRUCTIONS 5
  2693. #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
  2694. #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
  2695. #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
  2696. #define PF_PAE_ENABLED 9
  2697. #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
  2698. #define PF_SSE_DAZ_MODE_AVAILABLE 11
  2699. #define PF_NX_ENABLED 12
  2700. typedef struct _MEMORY_BASIC_INFORMATION {
  2701. PVOID BaseAddress;
  2702. PVOID AllocationBase;
  2703. DWORD AllocationProtect;
  2704. SIZE_T RegionSize;
  2705. DWORD State;
  2706. DWORD Protect;
  2707. DWORD Type;
  2708. } MEMORY_BASIC_INFORMATION,*PMEMORY_BASIC_INFORMATION;
  2709. typedef struct _MEMORY_BASIC_INFORMATION32 {
  2710. DWORD BaseAddress;
  2711. DWORD AllocationBase;
  2712. DWORD AllocationProtect;
  2713. DWORD RegionSize;
  2714. DWORD State;
  2715. DWORD Protect;
  2716. DWORD Type;
  2717. } MEMORY_BASIC_INFORMATION32,*PMEMORY_BASIC_INFORMATION32;
  2718. typedef DECLSPEC_ALIGN(16) struct _MEMORY_BASIC_INFORMATION64 {
  2719. ULONGLONG BaseAddress;
  2720. ULONGLONG AllocationBase;
  2721. DWORD AllocationProtect;
  2722. DWORD __alignment1;
  2723. ULONGLONG RegionSize;
  2724. DWORD State;
  2725. DWORD Protect;
  2726. DWORD Type;
  2727. DWORD __alignment2;
  2728. } MEMORY_BASIC_INFORMATION64,*PMEMORY_BASIC_INFORMATION64;
  2729. #define SECTION_QUERY 0x0001
  2730. #define SECTION_MAP_WRITE 0x0002
  2731. #define SECTION_MAP_READ 0x0004
  2732. #define SECTION_MAP_EXECUTE 0x0008
  2733. #define SECTION_EXTEND_SIZE 0x0010
  2734. #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
  2735. #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SECTION_QUERY| SECTION_MAP_WRITE | SECTION_MAP_READ | SECTION_MAP_EXECUTE | SECTION_EXTEND_SIZE)
  2736. #define PAGE_NOACCESS 0x01
  2737. #define PAGE_READONLY 0x02
  2738. #define PAGE_READWRITE 0x04
  2739. #define PAGE_WRITECOPY 0x08
  2740. #define PAGE_EXECUTE 0x10
  2741. #define PAGE_EXECUTE_READ 0x20
  2742. #define PAGE_EXECUTE_READWRITE 0x40
  2743. #define PAGE_EXECUTE_WRITECOPY 0x80
  2744. #define PAGE_GUARD 0x100
  2745. #define PAGE_NOCACHE 0x200
  2746. #define PAGE_WRITECOMBINE 0x400
  2747. #define MEM_COMMIT 0x1000
  2748. #define MEM_RESERVE 0x2000
  2749. #define MEM_DECOMMIT 0x4000
  2750. #define MEM_RELEASE 0x8000
  2751. #define MEM_FREE 0x10000
  2752. #define MEM_PRIVATE 0x20000
  2753. #define MEM_MAPPED 0x40000
  2754. #define MEM_RESET 0x80000
  2755. #define MEM_TOP_DOWN 0x100000
  2756. #define MEM_WRITE_WATCH 0x200000
  2757. #define MEM_PHYSICAL 0x400000
  2758. #define MEM_LARGE_PAGES 0x20000000
  2759. #define MEM_4MB_PAGES 0x80000000
  2760. #define SEC_FILE 0x800000
  2761. #define SEC_IMAGE 0x1000000
  2762. #define SEC_RESERVE 0x4000000
  2763. #define SEC_COMMIT 0x8000000
  2764. #define SEC_NOCACHE 0x10000000
  2765. #define SEC_LARGE_PAGES 0x80000000
  2766. #define MEM_IMAGE SEC_IMAGE
  2767. #define WRITE_WATCH_FLAG_RESET 0x01
  2768. #define FILE_READ_DATA (0x0001)
  2769. #define FILE_LIST_DIRECTORY (0x0001)
  2770. #define FILE_WRITE_DATA (0x0002)
  2771. #define FILE_ADD_FILE (0x0002)
  2772. #define FILE_APPEND_DATA (0x0004)
  2773. #define FILE_ADD_SUBDIRECTORY (0x0004)
  2774. #define FILE_CREATE_PIPE_INSTANCE (0x0004)
  2775. #define FILE_READ_EA (0x0008)
  2776. #define FILE_WRITE_EA (0x0010)
  2777. #define FILE_EXECUTE (0x0020)
  2778. #define FILE_TRAVERSE (0x0020)
  2779. #define FILE_DELETE_CHILD (0x0040)
  2780. #define FILE_READ_ATTRIBUTES (0x0080)
  2781. #define FILE_WRITE_ATTRIBUTES (0x0100)
  2782. #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF)
  2783. #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE)
  2784. #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE)
  2785. #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES | FILE_EXECUTE | SYNCHRONIZE)
  2786. #define FILE_SHARE_READ 0x00000001
  2787. #define FILE_SHARE_WRITE 0x00000002
  2788. #define FILE_SHARE_DELETE 0x00000004
  2789. #define FILE_ATTRIBUTE_READONLY 0x00000001
  2790. #define FILE_ATTRIBUTE_HIDDEN 0x00000002
  2791. #define FILE_ATTRIBUTE_SYSTEM 0x00000004
  2792. #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
  2793. #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
  2794. #define FILE_ATTRIBUTE_DEVICE 0x00000040
  2795. #define FILE_ATTRIBUTE_NORMAL 0x00000080
  2796. #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
  2797. #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
  2798. #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
  2799. #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
  2800. #define FILE_ATTRIBUTE_OFFLINE 0x00001000
  2801. #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
  2802. #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
  2803. #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
  2804. #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
  2805. #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
  2806. #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
  2807. #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
  2808. #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
  2809. #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
  2810. #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
  2811. #define FILE_ACTION_ADDED 0x00000001
  2812. #define FILE_ACTION_REMOVED 0x00000002
  2813. #define FILE_ACTION_MODIFIED 0x00000003
  2814. #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
  2815. #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
  2816. #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
  2817. #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
  2818. #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
  2819. #define FILE_CASE_PRESERVED_NAMES 0x00000002
  2820. #define FILE_UNICODE_ON_DISK 0x00000004
  2821. #define FILE_PERSISTENT_ACLS 0x00000008
  2822. #define FILE_FILE_COMPRESSION 0x00000010
  2823. #define FILE_VOLUME_QUOTAS 0x00000020
  2824. #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
  2825. #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
  2826. #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
  2827. #define FILE_VOLUME_IS_COMPRESSED 0x00008000
  2828. #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
  2829. #define FILE_SUPPORTS_ENCRYPTION 0x00020000
  2830. #define FILE_NAMED_STREAMS 0x00040000
  2831. #define FILE_READ_ONLY_VOLUME 0x00080000
  2832. typedef struct _FILE_NOTIFY_INFORMATION {
  2833. DWORD NextEntryOffset;
  2834. DWORD Action;
  2835. DWORD FileNameLength;
  2836. WCHAR FileName[1];
  2837. } FILE_NOTIFY_INFORMATION,*PFILE_NOTIFY_INFORMATION;
  2838. typedef union _FILE_SEGMENT_ELEMENT {
  2839. PVOID64 Buffer;
  2840. ULONGLONG Alignment;
  2841. }FILE_SEGMENT_ELEMENT,*PFILE_SEGMENT_ELEMENT;
  2842. typedef struct _REPARSE_GUID_DATA_BUFFER {
  2843. DWORD ReparseTag;
  2844. WORD ReparseDataLength;
  2845. WORD Reserved;
  2846. GUID ReparseGuid;
  2847. struct {
  2848. BYTE DataBuffer[1];
  2849. } GenericReparseBuffer;
  2850. } REPARSE_GUID_DATA_BUFFER,*PREPARSE_GUID_DATA_BUFFER;
  2851. #define REPARSE_GUID_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER,GenericReparseBuffer)
  2852. #define MAXIMUM_REPARSE_DATA_BUFFER_SIZE (16 *1024)
  2853. #define IO_REPARSE_TAG_RESERVED_ZERO (0)
  2854. #define IO_REPARSE_TAG_RESERVED_ONE (1)
  2855. #define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_ONE
  2856. #define IsReparseTagMicrosoft(_tag) (((_tag) & 0x80000000))
  2857. #define IsReparseTagNameSurrogate(_tag) (((_tag) & 0x20000000))
  2858. #define IO_REPARSE_TAG_MOUNT_POINT (0xA0000003L)
  2859. #define IO_REPARSE_TAG_HSM (0xC0000004L)
  2860. #define IO_REPARSE_TAG_SIS (0x80000007L)
  2861. #define IO_REPARSE_TAG_DFS (0x8000000AL)
  2862. #define IO_REPARSE_TAG_FILTER_MANAGER (0x8000000BL)
  2863. #define IO_COMPLETION_MODIFY_STATE 0x0002
  2864. #define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
  2865. #define DUPLICATE_CLOSE_SOURCE 0x00000001
  2866. #define DUPLICATE_SAME_ACCESS 0x00000002
  2867. typedef enum _SYSTEM_POWER_STATE {
  2868. PowerSystemUnspecified = 0,PowerSystemWorking = 1,PowerSystemSleeping1 = 2,PowerSystemSleeping2 = 3,PowerSystemSleeping3 = 4,PowerSystemHibernate = 5,PowerSystemShutdown = 6,PowerSystemMaximum = 7
  2869. } SYSTEM_POWER_STATE,*PSYSTEM_POWER_STATE;
  2870. #define POWER_SYSTEM_MAXIMUM 7
  2871. typedef enum {
  2872. PowerActionNone = 0,PowerActionReserved,PowerActionSleep,PowerActionHibernate,PowerActionShutdown,PowerActionShutdownReset,PowerActionShutdownOff,PowerActionWarmEject
  2873. } POWER_ACTION,*PPOWER_ACTION;
  2874. typedef enum _DEVICE_POWER_STATE {
  2875. PowerDeviceUnspecified = 0,PowerDeviceD0,PowerDeviceD1,PowerDeviceD2,PowerDeviceD3,PowerDeviceMaximum
  2876. } DEVICE_POWER_STATE,*PDEVICE_POWER_STATE;
  2877. #define ES_SYSTEM_REQUIRED ((DWORD)0x00000001)
  2878. #define ES_DISPLAY_REQUIRED ((DWORD)0x00000002)
  2879. #define ES_USER_PRESENT ((DWORD)0x00000004)
  2880. #define ES_CONTINUOUS ((DWORD)0x80000000)
  2881. typedef DWORD EXECUTION_STATE;
  2882. typedef enum {
  2883. LT_DONT_CARE,LT_LOWEST_LATENCY
  2884. } LATENCY_TIME;
  2885. #define PDCAP_D0_SUPPORTED 0x00000001
  2886. #define PDCAP_D1_SUPPORTED 0x00000002
  2887. #define PDCAP_D2_SUPPORTED 0x00000004
  2888. #define PDCAP_D3_SUPPORTED 0x00000008
  2889. #define PDCAP_WAKE_FROM_D0_SUPPORTED 0x00000010
  2890. #define PDCAP_WAKE_FROM_D1_SUPPORTED 0x00000020
  2891. #define PDCAP_WAKE_FROM_D2_SUPPORTED 0x00000040
  2892. #define PDCAP_WAKE_FROM_D3_SUPPORTED 0x00000080
  2893. #define PDCAP_WARM_EJECT_SUPPORTED 0x00000100
  2894. typedef struct CM_Power_Data_s {
  2895. DWORD PD_Size;
  2896. DEVICE_POWER_STATE PD_MostRecentPowerState;
  2897. DWORD PD_Capabilities;
  2898. DWORD PD_D1Latency;
  2899. DWORD PD_D2Latency;
  2900. DWORD PD_D3Latency;
  2901. DEVICE_POWER_STATE PD_PowerStateMapping[POWER_SYSTEM_MAXIMUM];
  2902. SYSTEM_POWER_STATE PD_DeepestSystemWake;
  2903. } CM_POWER_DATA,*PCM_POWER_DATA;
  2904. typedef enum {
  2905. SystemPowerPolicyAc,SystemPowerPolicyDc,VerifySystemPolicyAc,VerifySystemPolicyDc,SystemPowerCapabilities,SystemBatteryState,SystemPowerStateHandler,ProcessorStateHandler,SystemPowerPolicyCurrent,AdministratorPowerPolicy,SystemReserveHiberFile,ProcessorInformation,SystemPowerInformation,ProcessorStateHandler2,LastWakeTime,LastSleepTime,SystemExecutionState,SystemPowerStateNotifyHandler,ProcessorPowerPolicyAc,ProcessorPowerPolicyDc,VerifyProcessorPowerPolicyAc,VerifyProcessorPowerPolicyDc,ProcessorPowerPolicyCurrent,SystemPowerStateLogging,SystemPowerLoggingEntry
  2906. } POWER_INFORMATION_LEVEL;
  2907. typedef struct {
  2908. DWORD Granularity;
  2909. DWORD Capacity;
  2910. } BATTERY_REPORTING_SCALE,*PBATTERY_REPORTING_SCALE;
  2911. typedef struct {
  2912. POWER_ACTION Action;
  2913. DWORD Flags;
  2914. DWORD EventCode;
  2915. } POWER_ACTION_POLICY,*PPOWER_ACTION_POLICY;
  2916. #define POWER_ACTION_QUERY_ALLOWED 0x00000001
  2917. #define POWER_ACTION_UI_ALLOWED 0x00000002
  2918. #define POWER_ACTION_OVERRIDE_APPS 0x00000004
  2919. #define POWER_ACTION_LIGHTEST_FIRST 0x10000000
  2920. #define POWER_ACTION_LOCK_CONSOLE 0x20000000
  2921. #define POWER_ACTION_DISABLE_WAKES 0x40000000
  2922. #define POWER_ACTION_CRITICAL 0x80000000
  2923. #define POWER_LEVEL_USER_NOTIFY_TEXT 0x00000001
  2924. #define POWER_LEVEL_USER_NOTIFY_SOUND 0x00000002
  2925. #define POWER_LEVEL_USER_NOTIFY_EXEC 0x00000004
  2926. #define POWER_USER_NOTIFY_BUTTON 0x00000008
  2927. #define POWER_USER_NOTIFY_SHUTDOWN 0x00000010
  2928. #define POWER_FORCE_TRIGGER_RESET 0x80000000
  2929. typedef struct {
  2930. BOOLEAN Enable;
  2931. BYTE Spare[3];
  2932. DWORD BatteryLevel;
  2933. POWER_ACTION_POLICY PowerPolicy;
  2934. SYSTEM_POWER_STATE MinSystemState;
  2935. } SYSTEM_POWER_LEVEL,*PSYSTEM_POWER_LEVEL;
  2936. #define NUM_DISCHARGE_POLICIES 4
  2937. #define DISCHARGE_POLICY_CRITICAL 0
  2938. #define DISCHARGE_POLICY_LOW 1
  2939. #define PO_THROTTLE_NONE 0
  2940. #define PO_THROTTLE_CONSTANT 1
  2941. #define PO_THROTTLE_DEGRADE 2
  2942. #define PO_THROTTLE_ADAPTIVE 3
  2943. #define PO_THROTTLE_MAXIMUM 4
  2944. typedef struct _SYSTEM_POWER_POLICY {
  2945. DWORD Revision;
  2946. POWER_ACTION_POLICY PowerButton;
  2947. POWER_ACTION_POLICY SleepButton;
  2948. POWER_ACTION_POLICY LidClose;
  2949. SYSTEM_POWER_STATE LidOpenWake;
  2950. DWORD Reserved;
  2951. POWER_ACTION_POLICY Idle;
  2952. DWORD IdleTimeout;
  2953. BYTE IdleSensitivity;
  2954. BYTE DynamicThrottle;
  2955. BYTE Spare2[2];
  2956. SYSTEM_POWER_STATE MinSleep;
  2957. SYSTEM_POWER_STATE MaxSleep;
  2958. SYSTEM_POWER_STATE ReducedLatencySleep;
  2959. DWORD WinLogonFlags;
  2960. DWORD Spare3;
  2961. DWORD DozeS4Timeout;
  2962. DWORD BroadcastCapacityResolution;
  2963. SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES];
  2964. DWORD VideoTimeout;
  2965. BOOLEAN VideoDimDisplay;
  2966. DWORD VideoReserved[3];
  2967. DWORD SpindownTimeout;
  2968. BOOLEAN OptimizeForPower;
  2969. BYTE FanThrottleTolerance;
  2970. BYTE ForcedThrottle;
  2971. BYTE MinThrottle;
  2972. POWER_ACTION_POLICY OverThrottled;
  2973. } SYSTEM_POWER_POLICY,*PSYSTEM_POWER_POLICY;
  2974. typedef struct _PROCESSOR_POWER_POLICY_INFO {
  2975. DWORD TimeCheck;
  2976. DWORD DemoteLimit;
  2977. DWORD PromoteLimit;
  2978. BYTE DemotePercent;
  2979. BYTE PromotePercent;
  2980. BYTE Spare[2];
  2981. DWORD AllowDemotion:1;
  2982. DWORD AllowPromotion:1;
  2983. DWORD Reserved:30;
  2984. } PROCESSOR_POWER_POLICY_INFO,*PPROCESSOR_POWER_POLICY_INFO;
  2985. typedef struct _PROCESSOR_POWER_POLICY {
  2986. DWORD Revision;
  2987. BYTE DynamicThrottle;
  2988. BYTE Spare[3];
  2989. DWORD DisableCStates:1;
  2990. DWORD Reserved:31;
  2991. DWORD PolicyCount;
  2992. PROCESSOR_POWER_POLICY_INFO Policy[3];
  2993. } PROCESSOR_POWER_POLICY,*PPROCESSOR_POWER_POLICY;
  2994. typedef struct _ADMINISTRATOR_POWER_POLICY {
  2995. SYSTEM_POWER_STATE MinSleep;
  2996. SYSTEM_POWER_STATE MaxSleep;
  2997. DWORD MinVideoTimeout;
  2998. DWORD MaxVideoTimeout;
  2999. DWORD MinSpindownTimeout;
  3000. DWORD MaxSpindownTimeout;
  3001. } ADMINISTRATOR_POWER_POLICY,*PADMINISTRATOR_POWER_POLICY;
  3002. typedef struct {
  3003. BOOLEAN PowerButtonPresent;
  3004. BOOLEAN SleepButtonPresent;
  3005. BOOLEAN LidPresent;
  3006. BOOLEAN SystemS1;
  3007. BOOLEAN SystemS2;
  3008. BOOLEAN SystemS3;
  3009. BOOLEAN SystemS4;
  3010. BOOLEAN SystemS5;
  3011. BOOLEAN HiberFilePresent;
  3012. BOOLEAN FullWake;
  3013. BOOLEAN VideoDimPresent;
  3014. BOOLEAN ApmPresent;
  3015. BOOLEAN UpsPresent;
  3016. BOOLEAN ThermalControl;
  3017. BOOLEAN ProcessorThrottle;
  3018. BYTE ProcessorMinThrottle;
  3019. BYTE ProcessorMaxThrottle;
  3020. BYTE spare2[4];
  3021. BOOLEAN DiskSpinDown;
  3022. BYTE spare3[8];
  3023. BOOLEAN SystemBatteriesPresent;
  3024. BOOLEAN BatteriesAreShortTerm;
  3025. BATTERY_REPORTING_SCALE BatteryScale[3];
  3026. SYSTEM_POWER_STATE AcOnLineWake;
  3027. SYSTEM_POWER_STATE SoftLidWake;
  3028. SYSTEM_POWER_STATE RtcWake;
  3029. SYSTEM_POWER_STATE MinDeviceWakeState;
  3030. SYSTEM_POWER_STATE DefaultLowLatencyWake;
  3031. } SYSTEM_POWER_CAPABILITIES,*PSYSTEM_POWER_CAPABILITIES;
  3032. typedef struct {
  3033. BOOLEAN AcOnLine;
  3034. BOOLEAN BatteryPresent;
  3035. BOOLEAN Charging;
  3036. BOOLEAN Discharging;
  3037. BOOLEAN Spare1[4];
  3038. DWORD MaxCapacity;
  3039. DWORD RemainingCapacity;
  3040. DWORD Rate;
  3041. DWORD EstimatedTime;
  3042. DWORD DefaultAlert1;
  3043. DWORD DefaultAlert2;
  3044. } SYSTEM_BATTERY_STATE,*PSYSTEM_BATTERY_STATE;
  3045. #include "pshpack4.h"
  3046. #define IMAGE_DOS_SIGNATURE 0x5A4D
  3047. #define IMAGE_OS2_SIGNATURE 0x454E
  3048. #define IMAGE_OS2_SIGNATURE_LE 0x454C
  3049. #define IMAGE_VXD_SIGNATURE 0x454C
  3050. #define IMAGE_NT_SIGNATURE 0x00004550
  3051. #include "pshpack2.h"
  3052. typedef struct _IMAGE_DOS_HEADER {
  3053. WORD e_magic;
  3054. WORD e_cblp;
  3055. WORD e_cp;
  3056. WORD e_crlc;
  3057. WORD e_cparhdr;
  3058. WORD e_minalloc;
  3059. WORD e_maxalloc;
  3060. WORD e_ss;
  3061. WORD e_sp;
  3062. WORD e_csum;
  3063. WORD e_ip;
  3064. WORD e_cs;
  3065. WORD e_lfarlc;
  3066. WORD e_ovno;
  3067. WORD e_res[4];
  3068. WORD e_oemid;
  3069. WORD e_oeminfo;
  3070. WORD e_res2[10];
  3071. LONG e_lfanew;
  3072. } IMAGE_DOS_HEADER,*PIMAGE_DOS_HEADER;
  3073. typedef struct _IMAGE_OS2_HEADER {
  3074. WORD ne_magic;
  3075. CHAR ne_ver;
  3076. CHAR ne_rev;
  3077. WORD ne_enttab;
  3078. WORD ne_cbenttab;
  3079. LONG ne_crc;
  3080. WORD ne_flags;
  3081. WORD ne_autodata;
  3082. WORD ne_heap;
  3083. WORD ne_stack;
  3084. LONG ne_csip;
  3085. LONG ne_sssp;
  3086. WORD ne_cseg;
  3087. WORD ne_cmod;
  3088. WORD ne_cbnrestab;
  3089. WORD ne_segtab;
  3090. WORD ne_rsrctab;
  3091. WORD ne_restab;
  3092. WORD ne_modtab;
  3093. WORD ne_imptab;
  3094. LONG ne_nrestab;
  3095. WORD ne_cmovent;
  3096. WORD ne_align;
  3097. WORD ne_cres;
  3098. BYTE ne_exetyp;
  3099. BYTE ne_flagsothers;
  3100. WORD ne_pretthunks;
  3101. WORD ne_psegrefbytes;
  3102. WORD ne_swaparea;
  3103. WORD ne_expver;
  3104. } IMAGE_OS2_HEADER,*PIMAGE_OS2_HEADER;
  3105. typedef struct _IMAGE_VXD_HEADER {
  3106. WORD e32_magic;
  3107. BYTE e32_border;
  3108. BYTE e32_worder;
  3109. DWORD e32_level;
  3110. WORD e32_cpu;
  3111. WORD e32_os;
  3112. DWORD e32_ver;
  3113. DWORD e32_mflags;
  3114. DWORD e32_mpages;
  3115. DWORD e32_startobj;
  3116. DWORD e32_eip;
  3117. DWORD e32_stackobj;
  3118. DWORD e32_esp;
  3119. DWORD e32_pagesize;
  3120. DWORD e32_lastpagesize;
  3121. DWORD e32_fixupsize;
  3122. DWORD e32_fixupsum;
  3123. DWORD e32_ldrsize;
  3124. DWORD e32_ldrsum;
  3125. DWORD e32_objtab;
  3126. DWORD e32_objcnt;
  3127. DWORD e32_objmap;
  3128. DWORD e32_itermap;
  3129. DWORD e32_rsrctab;
  3130. DWORD e32_rsrccnt;
  3131. DWORD e32_restab;
  3132. DWORD e32_enttab;
  3133. DWORD e32_dirtab;
  3134. DWORD e32_dircnt;
  3135. DWORD e32_fpagetab;
  3136. DWORD e32_frectab;
  3137. DWORD e32_impmod;
  3138. DWORD e32_impmodcnt;
  3139. DWORD e32_impproc;
  3140. DWORD e32_pagesum;
  3141. DWORD e32_datapage;
  3142. DWORD e32_preload;
  3143. DWORD e32_nrestab;
  3144. DWORD e32_cbnrestab;
  3145. DWORD e32_nressum;
  3146. DWORD e32_autodata;
  3147. DWORD e32_debuginfo;
  3148. DWORD e32_debuglen;
  3149. DWORD e32_instpreload;
  3150. DWORD e32_instdemand;
  3151. DWORD e32_heapsize;
  3152. BYTE e32_res3[12];
  3153. DWORD e32_winresoff;
  3154. DWORD e32_winreslen;
  3155. WORD e32_devid;
  3156. WORD e32_ddkver;
  3157. } IMAGE_VXD_HEADER,*PIMAGE_VXD_HEADER;
  3158. #include "poppack.h"
  3159. typedef struct _IMAGE_FILE_HEADER {
  3160. WORD Machine;
  3161. WORD NumberOfSections;
  3162. DWORD TimeDateStamp;
  3163. DWORD PointerToSymbolTable;
  3164. DWORD NumberOfSymbols;
  3165. WORD SizeOfOptionalHeader;
  3166. WORD Characteristics;
  3167. } IMAGE_FILE_HEADER,*PIMAGE_FILE_HEADER;
  3168. #define IMAGE_SIZEOF_FILE_HEADER 20
  3169. #define IMAGE_FILE_RELOCS_STRIPPED 0x0001
  3170. #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
  3171. #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
  3172. #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
  3173. #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
  3174. #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
  3175. #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
  3176. #define IMAGE_FILE_32BIT_MACHINE 0x0100
  3177. #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
  3178. #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
  3179. #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
  3180. #define IMAGE_FILE_SYSTEM 0x1000
  3181. #define IMAGE_FILE_DLL 0x2000
  3182. #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
  3183. #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
  3184. #define IMAGE_FILE_MACHINE_UNKNOWN 0
  3185. #define IMAGE_FILE_MACHINE_I386 0x014c
  3186. #define IMAGE_FILE_MACHINE_R3000 0x0162
  3187. #define IMAGE_FILE_MACHINE_R4000 0x0166
  3188. #define IMAGE_FILE_MACHINE_R10000 0x0168
  3189. #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
  3190. #define IMAGE_FILE_MACHINE_ALPHA 0x0184
  3191. #define IMAGE_FILE_MACHINE_SH3 0x01a2
  3192. #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
  3193. #define IMAGE_FILE_MACHINE_SH3E 0x01a4
  3194. #define IMAGE_FILE_MACHINE_SH4 0x01a6
  3195. #define IMAGE_FILE_MACHINE_SH5 0x01a8
  3196. #define IMAGE_FILE_MACHINE_ARM 0x01c0
  3197. #define IMAGE_FILE_MACHINE_THUMB 0x01c2
  3198. #define IMAGE_FILE_MACHINE_AM33 0x01d3
  3199. #define IMAGE_FILE_MACHINE_POWERPC 0x01F0
  3200. #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
  3201. #define IMAGE_FILE_MACHINE_IA64 0x0200
  3202. #define IMAGE_FILE_MACHINE_MIPS16 0x0266
  3203. #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
  3204. #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
  3205. #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
  3206. #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
  3207. #define IMAGE_FILE_MACHINE_TRICORE 0x0520
  3208. #define IMAGE_FILE_MACHINE_CEF 0x0CEF
  3209. #define IMAGE_FILE_MACHINE_EBC 0x0EBC
  3210. #define IMAGE_FILE_MACHINE_AMD64 0x8664
  3211. #define IMAGE_FILE_MACHINE_M32R 0x9041
  3212. #define IMAGE_FILE_MACHINE_CEE 0xC0EE
  3213. typedef struct _IMAGE_DATA_DIRECTORY {
  3214. DWORD VirtualAddress;
  3215. DWORD Size;
  3216. } IMAGE_DATA_DIRECTORY,*PIMAGE_DATA_DIRECTORY;
  3217. #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
  3218. typedef struct _IMAGE_OPTIONAL_HEADER {
  3219. WORD Magic;
  3220. BYTE MajorLinkerVersion;
  3221. BYTE MinorLinkerVersion;
  3222. DWORD SizeOfCode;
  3223. DWORD SizeOfInitializedData;
  3224. DWORD SizeOfUninitializedData;
  3225. DWORD AddressOfEntryPoint;
  3226. DWORD BaseOfCode;
  3227. DWORD BaseOfData;
  3228. DWORD ImageBase;
  3229. DWORD SectionAlignment;
  3230. DWORD FileAlignment;
  3231. WORD MajorOperatingSystemVersion;
  3232. WORD MinorOperatingSystemVersion;
  3233. WORD MajorImageVersion;
  3234. WORD MinorImageVersion;
  3235. WORD MajorSubsystemVersion;
  3236. WORD MinorSubsystemVersion;
  3237. DWORD Win32VersionValue;
  3238. DWORD SizeOfImage;
  3239. DWORD SizeOfHeaders;
  3240. DWORD CheckSum;
  3241. WORD Subsystem;
  3242. WORD DllCharacteristics;
  3243. DWORD SizeOfStackReserve;
  3244. DWORD SizeOfStackCommit;
  3245. DWORD SizeOfHeapReserve;
  3246. DWORD SizeOfHeapCommit;
  3247. DWORD LoaderFlags;
  3248. DWORD NumberOfRvaAndSizes;
  3249. IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
  3250. } IMAGE_OPTIONAL_HEADER32,*PIMAGE_OPTIONAL_HEADER32;
  3251. typedef struct _IMAGE_ROM_OPTIONAL_HEADER {
  3252. WORD Magic;
  3253. BYTE MajorLinkerVersion;
  3254. BYTE MinorLinkerVersion;
  3255. DWORD SizeOfCode;
  3256. DWORD SizeOfInitializedData;
  3257. DWORD SizeOfUninitializedData;
  3258. DWORD AddressOfEntryPoint;
  3259. DWORD BaseOfCode;
  3260. DWORD BaseOfData;
  3261. DWORD BaseOfBss;
  3262. DWORD GprMask;
  3263. DWORD CprMask[4];
  3264. DWORD GpValue;
  3265. } IMAGE_ROM_OPTIONAL_HEADER,*PIMAGE_ROM_OPTIONAL_HEADER;
  3266. typedef struct _IMAGE_OPTIONAL_HEADER64 {
  3267. WORD Magic;
  3268. BYTE MajorLinkerVersion;
  3269. BYTE MinorLinkerVersion;
  3270. DWORD SizeOfCode;
  3271. DWORD SizeOfInitializedData;
  3272. DWORD SizeOfUninitializedData;
  3273. DWORD AddressOfEntryPoint;
  3274. DWORD BaseOfCode;
  3275. ULONGLONG ImageBase;
  3276. DWORD SectionAlignment;
  3277. DWORD FileAlignment;
  3278. WORD MajorOperatingSystemVersion;
  3279. WORD MinorOperatingSystemVersion;
  3280. WORD MajorImageVersion;
  3281. WORD MinorImageVersion;
  3282. WORD MajorSubsystemVersion;
  3283. WORD MinorSubsystemVersion;
  3284. DWORD Win32VersionValue;
  3285. DWORD SizeOfImage;
  3286. DWORD SizeOfHeaders;
  3287. DWORD CheckSum;
  3288. WORD Subsystem;
  3289. WORD DllCharacteristics;
  3290. ULONGLONG SizeOfStackReserve;
  3291. ULONGLONG SizeOfStackCommit;
  3292. ULONGLONG SizeOfHeapReserve;
  3293. ULONGLONG SizeOfHeapCommit;
  3294. DWORD LoaderFlags;
  3295. DWORD NumberOfRvaAndSizes;
  3296. IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
  3297. } IMAGE_OPTIONAL_HEADER64,*PIMAGE_OPTIONAL_HEADER64;
  3298. #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
  3299. #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
  3300. #define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224
  3301. #define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240
  3302. #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
  3303. #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
  3304. #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
  3305. #ifdef _WIN64
  3306. typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER;
  3307. typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER;
  3308. #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL64_HEADER
  3309. #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
  3310. #else
  3311. typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER;
  3312. typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER;
  3313. #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
  3314. #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
  3315. #endif
  3316. typedef struct _IMAGE_NT_HEADERS64 {
  3317. DWORD Signature;
  3318. IMAGE_FILE_HEADER FileHeader;
  3319. IMAGE_OPTIONAL_HEADER64 OptionalHeader;
  3320. } IMAGE_NT_HEADERS64,*PIMAGE_NT_HEADERS64;
  3321. typedef struct _IMAGE_NT_HEADERS {
  3322. DWORD Signature;
  3323. IMAGE_FILE_HEADER FileHeader;
  3324. IMAGE_OPTIONAL_HEADER32 OptionalHeader;
  3325. } IMAGE_NT_HEADERS32,*PIMAGE_NT_HEADERS32;
  3326. typedef struct _IMAGE_ROM_HEADERS {
  3327. IMAGE_FILE_HEADER FileHeader;
  3328. IMAGE_ROM_OPTIONAL_HEADER OptionalHeader;
  3329. } IMAGE_ROM_HEADERS,*PIMAGE_ROM_HEADERS;
  3330. #ifdef _WIN64
  3331. typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS;
  3332. typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS;
  3333. #else
  3334. typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS;
  3335. typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS;
  3336. #endif
  3337. #define IMAGE_FIRST_SECTION(ntheader) ((PIMAGE_SECTION_HEADER) ((ULONG_PTR)ntheader + FIELD_OFFSET(IMAGE_NT_HEADERS,OptionalHeader) + ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader))
  3338. #define IMAGE_SUBSYSTEM_UNKNOWN 0
  3339. #define IMAGE_SUBSYSTEM_NATIVE 1
  3340. #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
  3341. #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3
  3342. #define IMAGE_SUBSYSTEM_OS2_CUI 5
  3343. #define IMAGE_SUBSYSTEM_POSIX_CUI 7
  3344. #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8
  3345. #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9
  3346. #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
  3347. #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
  3348. #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
  3349. #define IMAGE_SUBSYSTEM_EFI_ROM 13
  3350. #define IMAGE_SUBSYSTEM_XBOX 14
  3351. #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
  3352. #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
  3353. #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
  3354. #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
  3355. #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
  3356. #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
  3357. #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
  3358. #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
  3359. #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
  3360. #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
  3361. #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
  3362. #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
  3363. #define IMAGE_DIRECTORY_ENTRY_ARCHITECTURE 7
  3364. #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8
  3365. #define IMAGE_DIRECTORY_ENTRY_TLS 9
  3366. #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
  3367. #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
  3368. #define IMAGE_DIRECTORY_ENTRY_IAT 12
  3369. #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
  3370. #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
  3371. typedef struct ANON_OBJECT_HEADER {
  3372. WORD Sig1;
  3373. WORD Sig2;
  3374. WORD Version;
  3375. WORD Machine;
  3376. DWORD TimeDateStamp;
  3377. CLSID ClassID;
  3378. DWORD SizeOfData;
  3379. } ANON_OBJECT_HEADER;
  3380. #define IMAGE_SIZEOF_SHORT_NAME 8
  3381. typedef struct _IMAGE_SECTION_HEADER {
  3382. BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
  3383. union {
  3384. DWORD PhysicalAddress;
  3385. DWORD VirtualSize;
  3386. } Misc;
  3387. DWORD VirtualAddress;
  3388. DWORD SizeOfRawData;
  3389. DWORD PointerToRawData;
  3390. DWORD PointerToRelocations;
  3391. DWORD PointerToLinenumbers;
  3392. WORD NumberOfRelocations;
  3393. WORD NumberOfLinenumbers;
  3394. DWORD Characteristics;
  3395. } IMAGE_SECTION_HEADER,*PIMAGE_SECTION_HEADER;
  3396. #define IMAGE_SIZEOF_SECTION_HEADER 40
  3397. #define IMAGE_SCN_TYPE_NO_PAD 0x00000008
  3398. #define IMAGE_SCN_CNT_CODE 0x00000020
  3399. #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
  3400. #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
  3401. #define IMAGE_SCN_LNK_OTHER 0x00000100
  3402. #define IMAGE_SCN_LNK_INFO 0x00000200
  3403. #define IMAGE_SCN_LNK_REMOVE 0x00000800
  3404. #define IMAGE_SCN_LNK_COMDAT 0x00001000
  3405. #define IMAGE_SCN_NO_DEFER_SPEC_EXC 0x00004000
  3406. #define IMAGE_SCN_GPREL 0x00008000
  3407. #define IMAGE_SCN_MEM_FARDATA 0x00008000
  3408. #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
  3409. #define IMAGE_SCN_MEM_16BIT 0x00020000
  3410. #define IMAGE_SCN_MEM_LOCKED 0x00040000
  3411. #define IMAGE_SCN_MEM_PRELOAD 0x00080000
  3412. #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
  3413. #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
  3414. #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
  3415. #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
  3416. #define IMAGE_SCN_ALIGN_16BYTES 0x00500000
  3417. #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
  3418. #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
  3419. #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
  3420. #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
  3421. #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
  3422. #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
  3423. #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
  3424. #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
  3425. #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
  3426. #define IMAGE_SCN_ALIGN_MASK 0x00F00000
  3427. #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
  3428. #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
  3429. #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
  3430. #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
  3431. #define IMAGE_SCN_MEM_SHARED 0x10000000
  3432. #define IMAGE_SCN_MEM_EXECUTE 0x20000000
  3433. #define IMAGE_SCN_MEM_READ 0x40000000
  3434. #define IMAGE_SCN_MEM_WRITE 0x80000000
  3435. #define IMAGE_SCN_SCALE_INDEX 0x00000001
  3436. #include "pshpack2.h"
  3437. typedef struct _IMAGE_SYMBOL {
  3438. union {
  3439. BYTE ShortName[8];
  3440. struct {
  3441. DWORD Short;
  3442. DWORD Long;
  3443. } Name;
  3444. DWORD LongName[2];
  3445. } N;
  3446. DWORD Value;
  3447. SHORT SectionNumber;
  3448. WORD Type;
  3449. BYTE StorageClass;
  3450. BYTE NumberOfAuxSymbols;
  3451. } IMAGE_SYMBOL;
  3452. typedef IMAGE_SYMBOL UNALIGNED *PIMAGE_SYMBOL;
  3453. #define IMAGE_SIZEOF_SYMBOL 18
  3454. #define IMAGE_SYM_UNDEFINED (SHORT)0
  3455. #define IMAGE_SYM_ABSOLUTE (SHORT)-1
  3456. #define IMAGE_SYM_DEBUG (SHORT)-2
  3457. #define IMAGE_SYM_SECTION_MAX 0xFEFF
  3458. #define IMAGE_SYM_TYPE_NULL 0x0000
  3459. #define IMAGE_SYM_TYPE_VOID 0x0001
  3460. #define IMAGE_SYM_TYPE_CHAR 0x0002
  3461. #define IMAGE_SYM_TYPE_SHORT 0x0003
  3462. #define IMAGE_SYM_TYPE_INT 0x0004
  3463. #define IMAGE_SYM_TYPE_LONG 0x0005
  3464. #define IMAGE_SYM_TYPE_FLOAT 0x0006
  3465. #define IMAGE_SYM_TYPE_DOUBLE 0x0007
  3466. #define IMAGE_SYM_TYPE_STRUCT 0x0008
  3467. #define IMAGE_SYM_TYPE_UNION 0x0009
  3468. #define IMAGE_SYM_TYPE_ENUM 0x000A
  3469. #define IMAGE_SYM_TYPE_MOE 0x000B
  3470. #define IMAGE_SYM_TYPE_BYTE 0x000C
  3471. #define IMAGE_SYM_TYPE_WORD 0x000D
  3472. #define IMAGE_SYM_TYPE_UINT 0x000E
  3473. #define IMAGE_SYM_TYPE_DWORD 0x000F
  3474. #define IMAGE_SYM_TYPE_PCODE 0x8000
  3475. #define IMAGE_SYM_DTYPE_NULL 0
  3476. #define IMAGE_SYM_DTYPE_POINTER 1
  3477. #define IMAGE_SYM_DTYPE_FUNCTION 2
  3478. #define IMAGE_SYM_DTYPE_ARRAY 3
  3479. #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE)-1
  3480. #define IMAGE_SYM_CLASS_NULL 0x0000
  3481. #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
  3482. #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
  3483. #define IMAGE_SYM_CLASS_STATIC 0x0003
  3484. #define IMAGE_SYM_CLASS_REGISTER 0x0004
  3485. #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
  3486. #define IMAGE_SYM_CLASS_LABEL 0x0006
  3487. #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
  3488. #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
  3489. #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
  3490. #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
  3491. #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
  3492. #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
  3493. #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
  3494. #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
  3495. #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
  3496. #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
  3497. #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
  3498. #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
  3499. #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
  3500. #define IMAGE_SYM_CLASS_BLOCK 0x0064
  3501. #define IMAGE_SYM_CLASS_FUNCTION 0x0065
  3502. #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
  3503. #define IMAGE_SYM_CLASS_FILE 0x0067
  3504. #define IMAGE_SYM_CLASS_SECTION 0x0068
  3505. #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
  3506. #define IMAGE_SYM_CLASS_CLR_TOKEN 0x006B
  3507. #define N_BTMASK 0x000F
  3508. #define N_TMASK 0x0030
  3509. #define N_TMASK1 0x00C0
  3510. #define N_TMASK2 0x00F0
  3511. #define N_BTSHFT 4
  3512. #define N_TSHIFT 2
  3513. #define BTYPE(x) ((x) & N_BTMASK)
  3514. #ifndef ISPTR
  3515. #define ISPTR(x) (((x) & N_TMASK)==(IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
  3516. #endif
  3517. #ifndef ISFCN
  3518. #define ISFCN(x) (((x) & N_TMASK)==(IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
  3519. #endif
  3520. #ifndef ISARY
  3521. #define ISARY(x) (((x) & N_TMASK)==(IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
  3522. #endif
  3523. #ifndef ISTAG
  3524. #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
  3525. #endif
  3526. #ifndef INCREF
  3527. #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
  3528. #endif
  3529. #ifndef DECREF
  3530. #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
  3531. #endif
  3532. typedef union _IMAGE_AUX_SYMBOL {
  3533. struct {
  3534. DWORD TagIndex;
  3535. union {
  3536. struct {
  3537. WORD Linenumber;
  3538. WORD Size;
  3539. } LnSz;
  3540. DWORD TotalSize;
  3541. } Misc;
  3542. union {
  3543. struct {
  3544. DWORD PointerToLinenumber;
  3545. DWORD PointerToNextFunction;
  3546. } Function;
  3547. struct {
  3548. WORD Dimension[4];
  3549. } Array;
  3550. } FcnAry;
  3551. WORD TvIndex;
  3552. } Sym;
  3553. struct {
  3554. BYTE Name[IMAGE_SIZEOF_SYMBOL];
  3555. } File;
  3556. struct {
  3557. DWORD Length;
  3558. WORD NumberOfRelocations;
  3559. WORD NumberOfLinenumbers;
  3560. DWORD CheckSum;
  3561. SHORT Number;
  3562. BYTE Selection;
  3563. } Section;
  3564. } IMAGE_AUX_SYMBOL;
  3565. typedef IMAGE_AUX_SYMBOL UNALIGNED *PIMAGE_AUX_SYMBOL;
  3566. #define IMAGE_SIZEOF_AUX_SYMBOL 18
  3567. typedef enum IMAGE_AUX_SYMBOL_TYPE {
  3568. IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF = 1
  3569. } IMAGE_AUX_SYMBOL_TYPE;
  3570. #include <pshpack2.h>
  3571. typedef struct IMAGE_AUX_SYMBOL_TOKEN_DEF {
  3572. BYTE bAuxType;
  3573. BYTE bReserved;
  3574. DWORD SymbolTableIndex;
  3575. BYTE rgbReserved[12];
  3576. } IMAGE_AUX_SYMBOL_TOKEN_DEF;
  3577. typedef IMAGE_AUX_SYMBOL_TOKEN_DEF UNALIGNED *PIMAGE_AUX_SYMBOL_TOKEN_DEF;
  3578. #include <poppack.h>
  3579. #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
  3580. #define IMAGE_COMDAT_SELECT_ANY 2
  3581. #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
  3582. #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
  3583. #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
  3584. #define IMAGE_COMDAT_SELECT_LARGEST 6
  3585. #define IMAGE_COMDAT_SELECT_NEWEST 7
  3586. #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
  3587. #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
  3588. #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
  3589. typedef struct _IMAGE_RELOCATION {
  3590. union {
  3591. DWORD VirtualAddress;
  3592. DWORD RelocCount;
  3593. };
  3594. DWORD SymbolTableIndex;
  3595. WORD Type;
  3596. } IMAGE_RELOCATION;
  3597. typedef IMAGE_RELOCATION UNALIGNED *PIMAGE_RELOCATION;
  3598. #define IMAGE_SIZEOF_RELOCATION 10
  3599. #define IMAGE_REL_I386_ABSOLUTE 0x0000
  3600. #define IMAGE_REL_I386_DIR16 0x0001
  3601. #define IMAGE_REL_I386_REL16 0x0002
  3602. #define IMAGE_REL_I386_DIR32 0x0006
  3603. #define IMAGE_REL_I386_DIR32NB 0x0007
  3604. #define IMAGE_REL_I386_SEG12 0x0009
  3605. #define IMAGE_REL_I386_SECTION 0x000A
  3606. #define IMAGE_REL_I386_SECREL 0x000B
  3607. #define IMAGE_REL_I386_TOKEN 0x000C
  3608. #define IMAGE_REL_I386_SECREL7 0x000D
  3609. #define IMAGE_REL_I386_REL32 0x0014
  3610. #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
  3611. #define IMAGE_REL_MIPS_REFHALF 0x0001
  3612. #define IMAGE_REL_MIPS_REFWORD 0x0002
  3613. #define IMAGE_REL_MIPS_JMPADDR 0x0003
  3614. #define IMAGE_REL_MIPS_REFHI 0x0004
  3615. #define IMAGE_REL_MIPS_REFLO 0x0005
  3616. #define IMAGE_REL_MIPS_GPREL 0x0006
  3617. #define IMAGE_REL_MIPS_LITERAL 0x0007
  3618. #define IMAGE_REL_MIPS_SECTION 0x000A
  3619. #define IMAGE_REL_MIPS_SECREL 0x000B
  3620. #define IMAGE_REL_MIPS_SECRELLO 0x000C
  3621. #define IMAGE_REL_MIPS_SECRELHI 0x000D
  3622. #define IMAGE_REL_MIPS_TOKEN 0x000E
  3623. #define IMAGE_REL_MIPS_JMPADDR16 0x0010
  3624. #define IMAGE_REL_MIPS_REFWORDNB 0x0022
  3625. #define IMAGE_REL_MIPS_PAIR 0x0025
  3626. #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
  3627. #define IMAGE_REL_ALPHA_REFLONG 0x0001
  3628. #define IMAGE_REL_ALPHA_REFQUAD 0x0002
  3629. #define IMAGE_REL_ALPHA_GPREL32 0x0003
  3630. #define IMAGE_REL_ALPHA_LITERAL 0x0004
  3631. #define IMAGE_REL_ALPHA_LITUSE 0x0005
  3632. #define IMAGE_REL_ALPHA_GPDISP 0x0006
  3633. #define IMAGE_REL_ALPHA_BRADDR 0x0007
  3634. #define IMAGE_REL_ALPHA_HINT 0x0008
  3635. #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
  3636. #define IMAGE_REL_ALPHA_REFHI 0x000A
  3637. #define IMAGE_REL_ALPHA_REFLO 0x000B
  3638. #define IMAGE_REL_ALPHA_PAIR 0x000C
  3639. #define IMAGE_REL_ALPHA_MATCH 0x000D
  3640. #define IMAGE_REL_ALPHA_SECTION 0x000E
  3641. #define IMAGE_REL_ALPHA_SECREL 0x000F
  3642. #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
  3643. #define IMAGE_REL_ALPHA_SECRELLO 0x0011
  3644. #define IMAGE_REL_ALPHA_SECRELHI 0x0012
  3645. #define IMAGE_REL_ALPHA_REFQ3 0x0013
  3646. #define IMAGE_REL_ALPHA_REFQ2 0x0014
  3647. #define IMAGE_REL_ALPHA_REFQ1 0x0015
  3648. #define IMAGE_REL_ALPHA_GPRELLO 0x0016
  3649. #define IMAGE_REL_ALPHA_GPRELHI 0x0017
  3650. #define IMAGE_REL_PPC_ABSOLUTE 0x0000
  3651. #define IMAGE_REL_PPC_ADDR64 0x0001
  3652. #define IMAGE_REL_PPC_ADDR32 0x0002
  3653. #define IMAGE_REL_PPC_ADDR24 0x0003
  3654. #define IMAGE_REL_PPC_ADDR16 0x0004
  3655. #define IMAGE_REL_PPC_ADDR14 0x0005
  3656. #define IMAGE_REL_PPC_REL24 0x0006
  3657. #define IMAGE_REL_PPC_REL14 0x0007
  3658. #define IMAGE_REL_PPC_TOCREL16 0x0008
  3659. #define IMAGE_REL_PPC_TOCREL14 0x0009
  3660. #define IMAGE_REL_PPC_ADDR32NB 0x000A
  3661. #define IMAGE_REL_PPC_SECREL 0x000B
  3662. #define IMAGE_REL_PPC_SECTION 0x000C
  3663. #define IMAGE_REL_PPC_IFGLUE 0x000D
  3664. #define IMAGE_REL_PPC_IMGLUE 0x000E
  3665. #define IMAGE_REL_PPC_SECREL16 0x000F
  3666. #define IMAGE_REL_PPC_REFHI 0x0010
  3667. #define IMAGE_REL_PPC_REFLO 0x0011
  3668. #define IMAGE_REL_PPC_PAIR 0x0012
  3669. #define IMAGE_REL_PPC_SECRELLO 0x0013
  3670. #define IMAGE_REL_PPC_SECRELHI 0x0014
  3671. #define IMAGE_REL_PPC_GPREL 0x0015
  3672. #define IMAGE_REL_PPC_TOKEN 0x0016
  3673. #define IMAGE_REL_PPC_TYPEMASK 0x00FF
  3674. #define IMAGE_REL_PPC_NEG 0x0100
  3675. #define IMAGE_REL_PPC_BRTAKEN 0x0200
  3676. #define IMAGE_REL_PPC_BRNTAKEN 0x0400
  3677. #define IMAGE_REL_PPC_TOCDEFN 0x0800
  3678. #define IMAGE_REL_SH3_ABSOLUTE 0x0000
  3679. #define IMAGE_REL_SH3_DIRECT16 0x0001
  3680. #define IMAGE_REL_SH3_DIRECT32 0x0002
  3681. #define IMAGE_REL_SH3_DIRECT8 0x0003
  3682. #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
  3683. #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
  3684. #define IMAGE_REL_SH3_DIRECT4 0x0006
  3685. #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
  3686. #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
  3687. #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
  3688. #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
  3689. #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
  3690. #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
  3691. #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
  3692. #define IMAGE_REL_SH3_SECTION 0x000E
  3693. #define IMAGE_REL_SH3_SECREL 0x000F
  3694. #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
  3695. #define IMAGE_REL_SH3_GPREL4_LONG 0x0011
  3696. #define IMAGE_REL_SH3_TOKEN 0x0012
  3697. #define IMAGE_REL_SHM_PCRELPT 0x0013
  3698. #define IMAGE_REL_SHM_REFLO 0x0014
  3699. #define IMAGE_REL_SHM_REFHALF 0x0015
  3700. #define IMAGE_REL_SHM_RELLO 0x0016
  3701. #define IMAGE_REL_SHM_RELHALF 0x0017
  3702. #define IMAGE_REL_SHM_PAIR 0x0018
  3703. #define IMAGE_REL_SH_NOMODE 0x8000
  3704. #define IMAGE_REL_ARM_ABSOLUTE 0x0000
  3705. #define IMAGE_REL_ARM_ADDR32 0x0001
  3706. #define IMAGE_REL_ARM_ADDR32NB 0x0002
  3707. #define IMAGE_REL_ARM_BRANCH24 0x0003
  3708. #define IMAGE_REL_ARM_BRANCH11 0x0004
  3709. #define IMAGE_REL_ARM_TOKEN 0x0005
  3710. #define IMAGE_REL_ARM_GPREL12 0x0006
  3711. #define IMAGE_REL_ARM_GPREL7 0x0007
  3712. #define IMAGE_REL_ARM_BLX24 0x0008
  3713. #define IMAGE_REL_ARM_BLX11 0x0009
  3714. #define IMAGE_REL_ARM_SECTION 0x000E
  3715. #define IMAGE_REL_ARM_SECREL 0x000F
  3716. #define IMAGE_REL_AM_ABSOLUTE 0x0000
  3717. #define IMAGE_REL_AM_ADDR32 0x0001
  3718. #define IMAGE_REL_AM_ADDR32NB 0x0002
  3719. #define IMAGE_REL_AM_CALL32 0x0003
  3720. #define IMAGE_REL_AM_FUNCINFO 0x0004
  3721. #define IMAGE_REL_AM_REL32_1 0x0005
  3722. #define IMAGE_REL_AM_REL32_2 0x0006
  3723. #define IMAGE_REL_AM_SECREL 0x0007
  3724. #define IMAGE_REL_AM_SECTION 0x0008
  3725. #define IMAGE_REL_AM_TOKEN 0x0009
  3726. #define IMAGE_REL_AMD64_ABSOLUTE 0x0000
  3727. #define IMAGE_REL_AMD64_ADDR64 0x0001
  3728. #define IMAGE_REL_AMD64_ADDR32 0x0002
  3729. #define IMAGE_REL_AMD64_ADDR32NB 0x0003
  3730. #define IMAGE_REL_AMD64_REL32 0x0004
  3731. #define IMAGE_REL_AMD64_REL32_1 0x0005
  3732. #define IMAGE_REL_AMD64_REL32_2 0x0006
  3733. #define IMAGE_REL_AMD64_REL32_3 0x0007
  3734. #define IMAGE_REL_AMD64_REL32_4 0x0008
  3735. #define IMAGE_REL_AMD64_REL32_5 0x0009
  3736. #define IMAGE_REL_AMD64_SECTION 0x000A
  3737. #define IMAGE_REL_AMD64_SECREL 0x000B
  3738. #define IMAGE_REL_AMD64_SECREL7 0x000C
  3739. #define IMAGE_REL_AMD64_TOKEN 0x000D
  3740. #define IMAGE_REL_AMD64_SREL32 0x000E
  3741. #define IMAGE_REL_AMD64_PAIR 0x000F
  3742. #define IMAGE_REL_AMD64_SSPAN32 0x0010
  3743. #define IMAGE_REL_IA64_ABSOLUTE 0x0000
  3744. #define IMAGE_REL_IA64_IMM14 0x0001
  3745. #define IMAGE_REL_IA64_IMM22 0x0002
  3746. #define IMAGE_REL_IA64_IMM64 0x0003
  3747. #define IMAGE_REL_IA64_DIR32 0x0004
  3748. #define IMAGE_REL_IA64_DIR64 0x0005
  3749. #define IMAGE_REL_IA64_PCREL21B 0x0006
  3750. #define IMAGE_REL_IA64_PCREL21M 0x0007
  3751. #define IMAGE_REL_IA64_PCREL21F 0x0008
  3752. #define IMAGE_REL_IA64_GPREL22 0x0009
  3753. #define IMAGE_REL_IA64_LTOFF22 0x000A
  3754. #define IMAGE_REL_IA64_SECTION 0x000B
  3755. #define IMAGE_REL_IA64_SECREL22 0x000C
  3756. #define IMAGE_REL_IA64_SECREL64I 0x000D
  3757. #define IMAGE_REL_IA64_SECREL32 0x000E
  3758. #define IMAGE_REL_IA64_DIR32NB 0x0010
  3759. #define IMAGE_REL_IA64_SREL14 0x0011
  3760. #define IMAGE_REL_IA64_SREL22 0x0012
  3761. #define IMAGE_REL_IA64_SREL32 0x0013
  3762. #define IMAGE_REL_IA64_UREL32 0x0014
  3763. #define IMAGE_REL_IA64_PCREL60X 0x0015
  3764. #define IMAGE_REL_IA64_PCREL60B 0x0016
  3765. #define IMAGE_REL_IA64_PCREL60F 0x0017
  3766. #define IMAGE_REL_IA64_PCREL60I 0x0018
  3767. #define IMAGE_REL_IA64_PCREL60M 0x0019
  3768. #define IMAGE_REL_IA64_IMMGPREL64 0x001A
  3769. #define IMAGE_REL_IA64_TOKEN 0x001B
  3770. #define IMAGE_REL_IA64_GPREL32 0x001C
  3771. #define IMAGE_REL_IA64_ADDEND 0x001F
  3772. #define IMAGE_REL_CEF_ABSOLUTE 0x0000
  3773. #define IMAGE_REL_CEF_ADDR32 0x0001
  3774. #define IMAGE_REL_CEF_ADDR64 0x0002
  3775. #define IMAGE_REL_CEF_ADDR32NB 0x0003
  3776. #define IMAGE_REL_CEF_SECTION 0x0004
  3777. #define IMAGE_REL_CEF_SECREL 0x0005
  3778. #define IMAGE_REL_CEF_TOKEN 0x0006
  3779. #define IMAGE_REL_CEE_ABSOLUTE 0x0000
  3780. #define IMAGE_REL_CEE_ADDR32 0x0001
  3781. #define IMAGE_REL_CEE_ADDR64 0x0002
  3782. #define IMAGE_REL_CEE_ADDR32NB 0x0003
  3783. #define IMAGE_REL_CEE_SECTION 0x0004
  3784. #define IMAGE_REL_CEE_SECREL 0x0005
  3785. #define IMAGE_REL_CEE_TOKEN 0x0006
  3786. #define IMAGE_REL_M32R_ABSOLUTE 0x0000
  3787. #define IMAGE_REL_M32R_ADDR32 0x0001
  3788. #define IMAGE_REL_M32R_ADDR32NB 0x0002
  3789. #define IMAGE_REL_M32R_ADDR24 0x0003
  3790. #define IMAGE_REL_M32R_GPREL16 0x0004
  3791. #define IMAGE_REL_M32R_PCREL24 0x0005
  3792. #define IMAGE_REL_M32R_PCREL16 0x0006
  3793. #define IMAGE_REL_M32R_PCREL8 0x0007
  3794. #define IMAGE_REL_M32R_REFHALF 0x0008
  3795. #define IMAGE_REL_M32R_REFHI 0x0009
  3796. #define IMAGE_REL_M32R_REFLO 0x000A
  3797. #define IMAGE_REL_M32R_PAIR 0x000B
  3798. #define IMAGE_REL_M32R_SECTION 0x000C
  3799. #define IMAGE_REL_M32R_SECREL32 0x000D
  3800. #define IMAGE_REL_M32R_TOKEN 0x000E
  3801. #define EXT_IMM64(Value,Address,Size,InstPos,ValPos) Value |= (((ULONGLONG)((*(Address) >> InstPos) & (((ULONGLONG)1 << Size) - 1))) << ValPos)
  3802. #define INS_IMM64(Value,Address,Size,InstPos,ValPos) *(PDWORD)Address = (*(PDWORD)Address & ~(((1 << Size) - 1) << InstPos)) | ((DWORD)((((ULONGLONG)Value >> ValPos) & (((ULONGLONG)1 << Size) - 1))) << InstPos)
  3803. #define EMARCH_ENC_I17_IMM7B_INST_WORD_X 3
  3804. #define EMARCH_ENC_I17_IMM7B_SIZE_X 7
  3805. #define EMARCH_ENC_I17_IMM7B_INST_WORD_POS_X 4
  3806. #define EMARCH_ENC_I17_IMM7B_VAL_POS_X 0
  3807. #define EMARCH_ENC_I17_IMM9D_INST_WORD_X 3
  3808. #define EMARCH_ENC_I17_IMM9D_SIZE_X 9
  3809. #define EMARCH_ENC_I17_IMM9D_INST_WORD_POS_X 18
  3810. #define EMARCH_ENC_I17_IMM9D_VAL_POS_X 7
  3811. #define EMARCH_ENC_I17_IMM5C_INST_WORD_X 3
  3812. #define EMARCH_ENC_I17_IMM5C_SIZE_X 5
  3813. #define EMARCH_ENC_I17_IMM5C_INST_WORD_POS_X 13
  3814. #define EMARCH_ENC_I17_IMM5C_VAL_POS_X 16
  3815. #define EMARCH_ENC_I17_IC_INST_WORD_X 3
  3816. #define EMARCH_ENC_I17_IC_SIZE_X 1
  3817. #define EMARCH_ENC_I17_IC_INST_WORD_POS_X 12
  3818. #define EMARCH_ENC_I17_IC_VAL_POS_X 21
  3819. #define EMARCH_ENC_I17_IMM41a_INST_WORD_X 1
  3820. #define EMARCH_ENC_I17_IMM41a_SIZE_X 10
  3821. #define EMARCH_ENC_I17_IMM41a_INST_WORD_POS_X 14
  3822. #define EMARCH_ENC_I17_IMM41a_VAL_POS_X 22
  3823. #define EMARCH_ENC_I17_IMM41b_INST_WORD_X 1
  3824. #define EMARCH_ENC_I17_IMM41b_SIZE_X 8
  3825. #define EMARCH_ENC_I17_IMM41b_INST_WORD_POS_X 24
  3826. #define EMARCH_ENC_I17_IMM41b_VAL_POS_X 32
  3827. #define EMARCH_ENC_I17_IMM41c_INST_WORD_X 2
  3828. #define EMARCH_ENC_I17_IMM41c_SIZE_X 23
  3829. #define EMARCH_ENC_I17_IMM41c_INST_WORD_POS_X 0
  3830. #define EMARCH_ENC_I17_IMM41c_VAL_POS_X 40
  3831. #define EMARCH_ENC_I17_SIGN_INST_WORD_X 3
  3832. #define EMARCH_ENC_I17_SIGN_SIZE_X 1
  3833. #define EMARCH_ENC_I17_SIGN_INST_WORD_POS_X 27
  3834. #define EMARCH_ENC_I17_SIGN_VAL_POS_X 63
  3835. #define X3_OPCODE_INST_WORD_X 3
  3836. #define X3_OPCODE_SIZE_X 4
  3837. #define X3_OPCODE_INST_WORD_POS_X 28
  3838. #define X3_OPCODE_SIGN_VAL_POS_X 0
  3839. #define X3_I_INST_WORD_X 3
  3840. #define X3_I_SIZE_X 1
  3841. #define X3_I_INST_WORD_POS_X 27
  3842. #define X3_I_SIGN_VAL_POS_X 59
  3843. #define X3_D_WH_INST_WORD_X 3
  3844. #define X3_D_WH_SIZE_X 3
  3845. #define X3_D_WH_INST_WORD_POS_X 24
  3846. #define X3_D_WH_SIGN_VAL_POS_X 0
  3847. #define X3_IMM20_INST_WORD_X 3
  3848. #define X3_IMM20_SIZE_X 20
  3849. #define X3_IMM20_INST_WORD_POS_X 4
  3850. #define X3_IMM20_SIGN_VAL_POS_X 0
  3851. #define X3_IMM39_1_INST_WORD_X 2
  3852. #define X3_IMM39_1_SIZE_X 23
  3853. #define X3_IMM39_1_INST_WORD_POS_X 0
  3854. #define X3_IMM39_1_SIGN_VAL_POS_X 36
  3855. #define X3_IMM39_2_INST_WORD_X 1
  3856. #define X3_IMM39_2_SIZE_X 16
  3857. #define X3_IMM39_2_INST_WORD_POS_X 16
  3858. #define X3_IMM39_2_SIGN_VAL_POS_X 20
  3859. #define X3_P_INST_WORD_X 3
  3860. #define X3_P_SIZE_X 4
  3861. #define X3_P_INST_WORD_POS_X 0
  3862. #define X3_P_SIGN_VAL_POS_X 0
  3863. #define X3_TMPLT_INST_WORD_X 0
  3864. #define X3_TMPLT_SIZE_X 4
  3865. #define X3_TMPLT_INST_WORD_POS_X 0
  3866. #define X3_TMPLT_SIGN_VAL_POS_X 0
  3867. #define X3_BTYPE_QP_INST_WORD_X 2
  3868. #define X3_BTYPE_QP_SIZE_X 9
  3869. #define X3_BTYPE_QP_INST_WORD_POS_X 23
  3870. #define X3_BTYPE_QP_INST_VAL_POS_X 0
  3871. #define X3_EMPTY_INST_WORD_X 1
  3872. #define X3_EMPTY_SIZE_X 2
  3873. #define X3_EMPTY_INST_WORD_POS_X 14
  3874. #define X3_EMPTY_INST_VAL_POS_X 0
  3875. typedef struct _IMAGE_LINENUMBER {
  3876. union {
  3877. DWORD SymbolTableIndex;
  3878. DWORD VirtualAddress;
  3879. } Type;
  3880. WORD Linenumber;
  3881. } IMAGE_LINENUMBER;
  3882. typedef IMAGE_LINENUMBER UNALIGNED *PIMAGE_LINENUMBER;
  3883. #define IMAGE_SIZEOF_LINENUMBER 6
  3884. #include "poppack.h"
  3885. typedef struct _IMAGE_BASE_RELOCATION {
  3886. DWORD VirtualAddress;
  3887. DWORD SizeOfBlock;
  3888. } IMAGE_BASE_RELOCATION;
  3889. typedef IMAGE_BASE_RELOCATION UNALIGNED *PIMAGE_BASE_RELOCATION;
  3890. #define IMAGE_SIZEOF_BASE_RELOCATION 8
  3891. #define IMAGE_REL_BASED_ABSOLUTE 0
  3892. #define IMAGE_REL_BASED_HIGH 1
  3893. #define IMAGE_REL_BASED_LOW 2
  3894. #define IMAGE_REL_BASED_HIGHLOW 3
  3895. #define IMAGE_REL_BASED_HIGHADJ 4
  3896. #define IMAGE_REL_BASED_MIPS_JMPADDR 5
  3897. #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
  3898. #define IMAGE_REL_BASED_IA64_IMM64 9
  3899. #define IMAGE_REL_BASED_DIR64 10
  3900. #define IMAGE_ARCHIVE_START_SIZE 8
  3901. #define IMAGE_ARCHIVE_START "!<arch>\n"
  3902. #define IMAGE_ARCHIVE_END "`\n"
  3903. #define IMAGE_ARCHIVE_PAD "\n"
  3904. #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
  3905. #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
  3906. typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER {
  3907. BYTE Name[16];
  3908. BYTE Date[12];
  3909. BYTE UserID[6];
  3910. BYTE GroupID[6];
  3911. BYTE Mode[8];
  3912. BYTE Size[10];
  3913. BYTE EndHeader[2];
  3914. } IMAGE_ARCHIVE_MEMBER_HEADER,*PIMAGE_ARCHIVE_MEMBER_HEADER;
  3915. #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
  3916. typedef struct _IMAGE_EXPORT_DIRECTORY {
  3917. DWORD Characteristics;
  3918. DWORD TimeDateStamp;
  3919. WORD MajorVersion;
  3920. WORD MinorVersion;
  3921. DWORD Name;
  3922. DWORD Base;
  3923. DWORD NumberOfFunctions;
  3924. DWORD NumberOfNames;
  3925. DWORD AddressOfFunctions;
  3926. DWORD AddressOfNames;
  3927. DWORD AddressOfNameOrdinals;
  3928. } IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY;
  3929. typedef struct _IMAGE_IMPORT_BY_NAME {
  3930. WORD Hint;
  3931. BYTE Name[1];
  3932. } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME;
  3933. #include "pshpack8.h"
  3934. typedef struct _IMAGE_THUNK_DATA64 {
  3935. union {
  3936. ULONGLONG ForwarderString;
  3937. ULONGLONG Function;
  3938. ULONGLONG Ordinal;
  3939. ULONGLONG AddressOfData;
  3940. } u1;
  3941. } IMAGE_THUNK_DATA64;
  3942. typedef IMAGE_THUNK_DATA64 *PIMAGE_THUNK_DATA64;
  3943. #include "poppack.h"
  3944. typedef struct _IMAGE_THUNK_DATA32 {
  3945. union {
  3946. DWORD ForwarderString;
  3947. DWORD Function;
  3948. DWORD Ordinal;
  3949. DWORD AddressOfData;
  3950. } u1;
  3951. } IMAGE_THUNK_DATA32;
  3952. typedef IMAGE_THUNK_DATA32 *PIMAGE_THUNK_DATA32;
  3953. #define IMAGE_ORDINAL_FLAG64 0x8000000000000000ull
  3954. #define IMAGE_ORDINAL_FLAG32 0x80000000
  3955. #define IMAGE_ORDINAL64(Ordinal) (Ordinal & 0xffffull)
  3956. #define IMAGE_ORDINAL32(Ordinal) (Ordinal & 0xffff)
  3957. #define IMAGE_SNAP_BY_ORDINAL64(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG64)!=0)
  3958. #define IMAGE_SNAP_BY_ORDINAL32(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG32)!=0)
  3959. typedef VOID
  3960. (NTAPI *PIMAGE_TLS_CALLBACK)(PVOID DllHandle,DWORD Reason,PVOID Reserved);
  3961. typedef struct _IMAGE_TLS_DIRECTORY64 {
  3962. ULONGLONG StartAddressOfRawData;
  3963. ULONGLONG EndAddressOfRawData;
  3964. ULONGLONG AddressOfIndex;
  3965. ULONGLONG AddressOfCallBacks;
  3966. DWORD SizeOfZeroFill;
  3967. DWORD Characteristics;
  3968. } IMAGE_TLS_DIRECTORY64;
  3969. typedef IMAGE_TLS_DIRECTORY64 *PIMAGE_TLS_DIRECTORY64;
  3970. typedef struct _IMAGE_TLS_DIRECTORY32 {
  3971. DWORD StartAddressOfRawData;
  3972. DWORD EndAddressOfRawData;
  3973. DWORD AddressOfIndex;
  3974. DWORD AddressOfCallBacks;
  3975. DWORD SizeOfZeroFill;
  3976. DWORD Characteristics;
  3977. } IMAGE_TLS_DIRECTORY32;
  3978. typedef IMAGE_TLS_DIRECTORY32 *PIMAGE_TLS_DIRECTORY32;
  3979. #ifdef _WIN64
  3980. #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
  3981. #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal)
  3982. typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA;
  3983. typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA;
  3984. #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal)
  3985. typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY;
  3986. typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY;
  3987. #else
  3988. #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
  3989. #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal)
  3990. typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA;
  3991. typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA;
  3992. #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal)
  3993. typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY;
  3994. typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY;
  3995. #endif
  3996. typedef struct _IMAGE_IMPORT_DESCRIPTOR {
  3997. union {
  3998. DWORD Characteristics;
  3999. DWORD OriginalFirstThunk;
  4000. };
  4001. DWORD TimeDateStamp;
  4002. DWORD ForwarderChain;
  4003. DWORD Name;
  4004. DWORD FirstThunk;
  4005. } IMAGE_IMPORT_DESCRIPTOR;
  4006. typedef IMAGE_IMPORT_DESCRIPTOR UNALIGNED *PIMAGE_IMPORT_DESCRIPTOR;
  4007. typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR {
  4008. DWORD TimeDateStamp;
  4009. WORD OffsetModuleName;
  4010. WORD NumberOfModuleForwarderRefs;
  4011. } IMAGE_BOUND_IMPORT_DESCRIPTOR,*PIMAGE_BOUND_IMPORT_DESCRIPTOR;
  4012. typedef struct _IMAGE_BOUND_FORWARDER_REF {
  4013. DWORD TimeDateStamp;
  4014. WORD OffsetModuleName;
  4015. WORD Reserved;
  4016. } IMAGE_BOUND_FORWARDER_REF,*PIMAGE_BOUND_FORWARDER_REF;
  4017. typedef struct _IMAGE_RESOURCE_DIRECTORY {
  4018. DWORD Characteristics;
  4019. DWORD TimeDateStamp;
  4020. WORD MajorVersion;
  4021. WORD MinorVersion;
  4022. WORD NumberOfNamedEntries;
  4023. WORD NumberOfIdEntries;
  4024. } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY;
  4025. #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
  4026. #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
  4027. typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
  4028. union {
  4029. struct {
  4030. DWORD NameOffset:31;
  4031. DWORD NameIsString:1;
  4032. };
  4033. DWORD Name;
  4034. WORD Id;
  4035. };
  4036. union {
  4037. DWORD OffsetToData;
  4038. struct {
  4039. DWORD OffsetToDirectory:31;
  4040. DWORD DataIsDirectory:1;
  4041. };
  4042. };
  4043. } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY;
  4044. typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
  4045. WORD Length;
  4046. CHAR NameString[1];
  4047. } IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING;
  4048. typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
  4049. WORD Length;
  4050. WCHAR NameString[1];
  4051. } IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U;
  4052. typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
  4053. DWORD OffsetToData;
  4054. DWORD Size;
  4055. DWORD CodePage;
  4056. DWORD Reserved;
  4057. } IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY;
  4058. typedef struct {
  4059. DWORD Size;
  4060. DWORD TimeDateStamp;
  4061. WORD MajorVersion;
  4062. WORD MinorVersion;
  4063. DWORD GlobalFlagsClear;
  4064. DWORD GlobalFlagsSet;
  4065. DWORD CriticalSectionDefaultTimeout;
  4066. DWORD DeCommitFreeBlockThreshold;
  4067. DWORD DeCommitTotalFreeThreshold;
  4068. DWORD LockPrefixTable;
  4069. DWORD MaximumAllocationSize;
  4070. DWORD VirtualMemoryThreshold;
  4071. DWORD ProcessHeapFlags;
  4072. DWORD ProcessAffinityMask;
  4073. WORD CSDVersion;
  4074. WORD Reserved1;
  4075. DWORD EditList;
  4076. DWORD SecurityCookie;
  4077. DWORD SEHandlerTable;
  4078. DWORD SEHandlerCount;
  4079. } IMAGE_LOAD_CONFIG_DIRECTORY32,*PIMAGE_LOAD_CONFIG_DIRECTORY32;
  4080. typedef struct {
  4081. DWORD Size;
  4082. DWORD TimeDateStamp;
  4083. WORD MajorVersion;
  4084. WORD MinorVersion;
  4085. DWORD GlobalFlagsClear;
  4086. DWORD GlobalFlagsSet;
  4087. DWORD CriticalSectionDefaultTimeout;
  4088. ULONGLONG DeCommitFreeBlockThreshold;
  4089. ULONGLONG DeCommitTotalFreeThreshold;
  4090. ULONGLONG LockPrefixTable;
  4091. ULONGLONG MaximumAllocationSize;
  4092. ULONGLONG VirtualMemoryThreshold;
  4093. ULONGLONG ProcessAffinityMask;
  4094. DWORD ProcessHeapFlags;
  4095. WORD CSDVersion;
  4096. WORD Reserved1;
  4097. ULONGLONG EditList;
  4098. ULONGLONG SecurityCookie;
  4099. ULONGLONG SEHandlerTable;
  4100. ULONGLONG SEHandlerCount;
  4101. } IMAGE_LOAD_CONFIG_DIRECTORY64,*PIMAGE_LOAD_CONFIG_DIRECTORY64;
  4102. #ifdef _WIN64
  4103. typedef IMAGE_LOAD_CONFIG_DIRECTORY64 IMAGE_LOAD_CONFIG_DIRECTORY;
  4104. typedef PIMAGE_LOAD_CONFIG_DIRECTORY64 PIMAGE_LOAD_CONFIG_DIRECTORY;
  4105. #else
  4106. typedef IMAGE_LOAD_CONFIG_DIRECTORY32 IMAGE_LOAD_CONFIG_DIRECTORY;
  4107. typedef PIMAGE_LOAD_CONFIG_DIRECTORY32 PIMAGE_LOAD_CONFIG_DIRECTORY;
  4108. #endif
  4109. typedef struct _IMAGE_CE_RUNTIME_FUNCTION_ENTRY {
  4110. DWORD FuncStart;
  4111. DWORD PrologLen : 8;
  4112. DWORD FuncLen : 22;
  4113. DWORD ThirtyTwoBit : 1;
  4114. DWORD ExceptionFlag : 1;
  4115. } IMAGE_CE_RUNTIME_FUNCTION_ENTRY,*PIMAGE_CE_RUNTIME_FUNCTION_ENTRY;
  4116. typedef struct _IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY {
  4117. ULONGLONG BeginAddress;
  4118. ULONGLONG EndAddress;
  4119. ULONGLONG ExceptionHandler;
  4120. ULONGLONG HandlerData;
  4121. ULONGLONG PrologEndAddress;
  4122. } IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY,*PIMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY;
  4123. typedef struct _IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY {
  4124. DWORD BeginAddress;
  4125. DWORD EndAddress;
  4126. DWORD ExceptionHandler;
  4127. DWORD HandlerData;
  4128. DWORD PrologEndAddress;
  4129. } IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY,*PIMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY;
  4130. typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY {
  4131. DWORD BeginAddress;
  4132. DWORD EndAddress;
  4133. DWORD UnwindInfoAddress;
  4134. } _IMAGE_RUNTIME_FUNCTION_ENTRY,*_PIMAGE_RUNTIME_FUNCTION_ENTRY;
  4135. typedef _IMAGE_RUNTIME_FUNCTION_ENTRY IMAGE_IA64_RUNTIME_FUNCTION_ENTRY;
  4136. typedef _PIMAGE_RUNTIME_FUNCTION_ENTRY PIMAGE_IA64_RUNTIME_FUNCTION_ENTRY;
  4137. typedef _IMAGE_RUNTIME_FUNCTION_ENTRY IMAGE_RUNTIME_FUNCTION_ENTRY;
  4138. typedef _PIMAGE_RUNTIME_FUNCTION_ENTRY PIMAGE_RUNTIME_FUNCTION_ENTRY;
  4139. typedef struct _IMAGE_DEBUG_DIRECTORY {
  4140. DWORD Characteristics;
  4141. DWORD TimeDateStamp;
  4142. WORD MajorVersion;
  4143. WORD MinorVersion;
  4144. DWORD Type;
  4145. DWORD SizeOfData;
  4146. DWORD AddressOfRawData;
  4147. DWORD PointerToRawData;
  4148. } IMAGE_DEBUG_DIRECTORY,*PIMAGE_DEBUG_DIRECTORY;
  4149. #define IMAGE_DEBUG_TYPE_UNKNOWN 0
  4150. #define IMAGE_DEBUG_TYPE_COFF 1
  4151. #define IMAGE_DEBUG_TYPE_CODEVIEW 2
  4152. #define IMAGE_DEBUG_TYPE_FPO 3
  4153. #define IMAGE_DEBUG_TYPE_MISC 4
  4154. #define IMAGE_DEBUG_TYPE_EXCEPTION 5
  4155. #define IMAGE_DEBUG_TYPE_FIXUP 6
  4156. #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
  4157. #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
  4158. #define IMAGE_DEBUG_TYPE_BORLAND 9
  4159. #define IMAGE_DEBUG_TYPE_RESERVED10 10
  4160. #define IMAGE_DEBUG_TYPE_CLSID 11
  4161. typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
  4162. DWORD NumberOfSymbols;
  4163. DWORD LvaToFirstSymbol;
  4164. DWORD NumberOfLinenumbers;
  4165. DWORD LvaToFirstLinenumber;
  4166. DWORD RvaToFirstByteOfCode;
  4167. DWORD RvaToLastByteOfCode;
  4168. DWORD RvaToFirstByteOfData;
  4169. DWORD RvaToLastByteOfData;
  4170. } IMAGE_COFF_SYMBOLS_HEADER,*PIMAGE_COFF_SYMBOLS_HEADER;
  4171. #define FRAME_FPO 0
  4172. #define FRAME_TRAP 1
  4173. #define FRAME_TSS 2
  4174. #define FRAME_NONFPO 3
  4175. typedef struct _FPO_DATA {
  4176. DWORD ulOffStart;
  4177. DWORD cbProcSize;
  4178. DWORD cdwLocals;
  4179. WORD cdwParams;
  4180. WORD cbProlog : 8;
  4181. WORD cbRegs : 3;
  4182. WORD fHasSEH : 1;
  4183. WORD fUseBP : 1;
  4184. WORD reserved : 1;
  4185. WORD cbFrame : 2;
  4186. } FPO_DATA,*PFPO_DATA;
  4187. #define SIZEOF_RFPO_DATA 16
  4188. #define IMAGE_DEBUG_MISC_EXENAME 1
  4189. typedef struct _IMAGE_DEBUG_MISC {
  4190. DWORD DataType;
  4191. DWORD Length;
  4192. BOOLEAN Unicode;
  4193. BYTE Reserved[3];
  4194. BYTE Data[1];
  4195. } IMAGE_DEBUG_MISC,*PIMAGE_DEBUG_MISC;
  4196. typedef struct _IMAGE_FUNCTION_ENTRY {
  4197. DWORD StartingAddress;
  4198. DWORD EndingAddress;
  4199. DWORD EndOfPrologue;
  4200. } IMAGE_FUNCTION_ENTRY,*PIMAGE_FUNCTION_ENTRY;
  4201. typedef struct _IMAGE_FUNCTION_ENTRY64 {
  4202. ULONGLONG StartingAddress;
  4203. ULONGLONG EndingAddress;
  4204. union {
  4205. ULONGLONG EndOfPrologue;
  4206. ULONGLONG UnwindInfoAddress;
  4207. };
  4208. } IMAGE_FUNCTION_ENTRY64,*PIMAGE_FUNCTION_ENTRY64;
  4209. typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
  4210. WORD Signature;
  4211. WORD Flags;
  4212. WORD Machine;
  4213. WORD Characteristics;
  4214. DWORD TimeDateStamp;
  4215. DWORD CheckSum;
  4216. DWORD ImageBase;
  4217. DWORD SizeOfImage;
  4218. DWORD NumberOfSections;
  4219. DWORD ExportedNamesSize;
  4220. DWORD DebugDirectorySize;
  4221. DWORD SectionAlignment;
  4222. DWORD Reserved[2];
  4223. } IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER;
  4224. typedef struct _NON_PAGED_DEBUG_INFO {
  4225. WORD Signature;
  4226. WORD Flags;
  4227. DWORD Size;
  4228. WORD Machine;
  4229. WORD Characteristics;
  4230. DWORD TimeDateStamp;
  4231. DWORD CheckSum;
  4232. DWORD SizeOfImage;
  4233. ULONGLONG ImageBase;
  4234. } NON_PAGED_DEBUG_INFO,*PNON_PAGED_DEBUG_INFO;
  4235. #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
  4236. #define NON_PAGED_DEBUG_SIGNATURE 0x494E
  4237. #define IMAGE_SEPARATE_DEBUG_FLAGS_MASK 0x8000
  4238. #define IMAGE_SEPARATE_DEBUG_MISMATCH 0x8000
  4239. typedef struct _ImageArchitectureHeader {
  4240. unsigned int AmaskValue: 1;
  4241. int Adummy1 :7;
  4242. unsigned int AmaskShift: 8;
  4243. int Adummy2 :16;
  4244. DWORD FirstEntryRVA;
  4245. } IMAGE_ARCHITECTURE_HEADER,*PIMAGE_ARCHITECTURE_HEADER;
  4246. typedef struct _ImageArchitectureEntry {
  4247. DWORD FixupInstRVA;
  4248. DWORD NewInst;
  4249. } IMAGE_ARCHITECTURE_ENTRY,*PIMAGE_ARCHITECTURE_ENTRY;
  4250. #include "poppack.h"
  4251. #define IMPORT_OBJECT_HDR_SIG2 0xffff
  4252. typedef struct IMPORT_OBJECT_HEADER {
  4253. WORD Sig1;
  4254. WORD Sig2;
  4255. WORD Version;
  4256. WORD Machine;
  4257. DWORD TimeDateStamp;
  4258. DWORD SizeOfData;
  4259. union {
  4260. WORD Ordinal;
  4261. WORD Hint;
  4262. };
  4263. WORD Type : 2;
  4264. WORD NameType : 3;
  4265. WORD Reserved : 11;
  4266. } IMPORT_OBJECT_HEADER;
  4267. typedef enum IMPORT_OBJECT_TYPE {
  4268. IMPORT_OBJECT_CODE = 0,IMPORT_OBJECT_DATA = 1,IMPORT_OBJECT_CONST = 2
  4269. } IMPORT_OBJECT_TYPE;
  4270. typedef enum IMPORT_OBJECT_NAME_TYPE {
  4271. IMPORT_OBJECT_ORDINAL = 0,IMPORT_OBJECT_NAME = 1,IMPORT_OBJECT_NAME_NO_PREFIX = 2,IMPORT_OBJECT_NAME_UNDECORATE = 3
  4272. } IMPORT_OBJECT_NAME_TYPE;
  4273. #ifndef __IMAGE_COR20_HEADER_DEFINED__
  4274. #define __IMAGE_COR20_HEADER_DEFINED__
  4275. typedef enum ReplacesCorHdrNumericDefines {
  4276. COMIMAGE_FLAGS_ILONLY =0x00000001,COMIMAGE_FLAGS_32BITREQUIRED =0x00000002,COMIMAGE_FLAGS_IL_LIBRARY =0x00000004,
  4277. COMIMAGE_FLAGS_STRONGNAMESIGNED =0x00000008,COMIMAGE_FLAGS_TRACKDEBUGDATA =0x00010000,COR_VERSION_MAJOR_V2 =2,
  4278. COR_VERSION_MAJOR =COR_VERSION_MAJOR_V2,COR_VERSION_MINOR =0,COR_DELETED_NAME_LENGTH =8,COR_VTABLEGAP_NAME_LENGTH =8,
  4279. NATIVE_TYPE_MAX_CB =1,COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE=0xFF,IMAGE_COR_MIH_METHODRVA =0x01,IMAGE_COR_MIH_EHRVA =0x02,
  4280. IMAGE_COR_MIH_BASICBLOCK =0x08,COR_VTABLE_32BIT =0x01,COR_VTABLE_64BIT =0x02,COR_VTABLE_FROM_UNMANAGED =0x04,
  4281. COR_VTABLE_CALL_MOST_DERIVED =0x10,IMAGE_COR_EATJ_THUNK_SIZE =32,MAX_CLASS_NAME =1024,MAX_PACKAGE_NAME =1024
  4282. } ReplacesCorHdrNumericDefines;
  4283. typedef struct IMAGE_COR20_HEADER {
  4284. DWORD cb;
  4285. WORD MajorRuntimeVersion;
  4286. WORD MinorRuntimeVersion;
  4287. IMAGE_DATA_DIRECTORY MetaData;
  4288. DWORD Flags;
  4289. DWORD EntryPointToken;
  4290. IMAGE_DATA_DIRECTORY Resources;
  4291. IMAGE_DATA_DIRECTORY StrongNameSignature;
  4292. IMAGE_DATA_DIRECTORY CodeManagerTable;
  4293. IMAGE_DATA_DIRECTORY VTableFixups;
  4294. IMAGE_DATA_DIRECTORY ExportAddressTableJumps;
  4295. IMAGE_DATA_DIRECTORY ManagedNativeHeader;
  4296. } IMAGE_COR20_HEADER,*PIMAGE_COR20_HEADER;
  4297. #endif
  4298. #if defined (__x86_64)
  4299. NTSYSAPI PRUNTIME_FUNCTION NTAPI RtlLookupFunctionEntry (DWORD64 ControlPc, PDWORD64 ImageBase, PUNWIND_HISTORY_TABLE HistoryTable);
  4300. NTSYSAPI VOID NTAPI RtlUnwindEx (PVOID TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue, PCONTEXT ContextRecord, PUNWIND_HISTORY_TABLE HistoryTable);
  4301. #endif
  4302. #include <string.h>
  4303. #ifndef _SLIST_HEADER_
  4304. #define _SLIST_HEADER_
  4305. #ifdef _WIN64
  4306. typedef struct _SLIST_ENTRY *PSLIST_ENTRY;
  4307. typedef DECLSPEC_ALIGN(16) struct _SLIST_ENTRY {
  4308. PSLIST_ENTRY Next;
  4309. } SLIST_ENTRY;
  4310. #else
  4311. #define SLIST_ENTRY SINGLE_LIST_ENTRY
  4312. #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
  4313. #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
  4314. #endif
  4315. #if defined(_WIN64)
  4316. typedef DECLSPEC_ALIGN(16) struct _SLIST_HEADER {
  4317. ULONGLONG Alignment;
  4318. ULONGLONG Region;
  4319. } SLIST_HEADER;
  4320. typedef struct _SLIST_HEADER *PSLIST_HEADER;
  4321. #else
  4322. typedef union _SLIST_HEADER {
  4323. ULONGLONG Alignment;
  4324. struct {
  4325. SLIST_ENTRY Next;
  4326. WORD Depth;
  4327. WORD Sequence;
  4328. };
  4329. } SLIST_HEADER,*PSLIST_HEADER;
  4330. #endif
  4331. #endif
  4332. NTSYSAPI VOID NTAPI RtlInitializeSListHead(PSLIST_HEADER ListHead);
  4333. NTSYSAPI PSLIST_ENTRY NTAPI RtlFirstEntrySList(const SLIST_HEADER *ListHead);
  4334. NTSYSAPI PSLIST_ENTRY NTAPI RtlInterlockedPopEntrySList(PSLIST_HEADER ListHead);
  4335. NTSYSAPI PSLIST_ENTRY NTAPI RtlInterlockedPushEntrySList(PSLIST_HEADER ListHead,PSLIST_ENTRY ListEntry);
  4336. NTSYSAPI PSLIST_ENTRY NTAPI RtlInterlockedFlushSList(PSLIST_HEADER ListHead);
  4337. NTSYSAPI WORD NTAPI RtlQueryDepthSList(PSLIST_HEADER ListHead);
  4338. #define HEAP_NO_SERIALIZE 0x00000001
  4339. #define HEAP_GROWABLE 0x00000002
  4340. #define HEAP_GENERATE_EXCEPTIONS 0x00000004
  4341. #define HEAP_ZERO_MEMORY 0x00000008
  4342. #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
  4343. #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
  4344. #define HEAP_FREE_CHECKING_ENABLED 0x00000040
  4345. #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
  4346. #define HEAP_CREATE_ALIGN_16 0x00010000
  4347. #define HEAP_CREATE_ENABLE_TRACING 0x00020000
  4348. #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
  4349. #define HEAP_MAXIMUM_TAG 0x0FFF
  4350. #define HEAP_PSEUDO_TAG_FLAG 0x8000
  4351. #define HEAP_TAG_SHIFT 18
  4352. #define HEAP_MAKE_TAG_FLAGS(b,o) ((DWORD)((b) + ((o) << 18)))
  4353. NTSYSAPI VOID NTAPI RtlCaptureContext(PCONTEXT ContextRecord);
  4354. #define IS_TEXT_UNICODE_ASCII16 0x0001
  4355. #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
  4356. #define IS_TEXT_UNICODE_STATISTICS 0x0002
  4357. #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
  4358. #define IS_TEXT_UNICODE_CONTROLS 0x0004
  4359. #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
  4360. #define IS_TEXT_UNICODE_SIGNATURE 0x0008
  4361. #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
  4362. #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
  4363. #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
  4364. #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
  4365. #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
  4366. #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
  4367. #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
  4368. #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
  4369. #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
  4370. #define COMPRESSION_FORMAT_NONE (0x0000)
  4371. #define COMPRESSION_FORMAT_DEFAULT (0x0001)
  4372. #define COMPRESSION_FORMAT_LZNT1 (0x0002)
  4373. #define COMPRESSION_ENGINE_STANDARD (0x0000)
  4374. #define COMPRESSION_ENGINE_MAXIMUM (0x0100)
  4375. #define COMPRESSION_ENGINE_HIBER (0x0200)
  4376. #if _DBG_MEMCPY_INLINE_ && !defined(_MEMCPY_INLINE_) && !defined(_CRTBLD)
  4377. #define _MEMCPY_INLINE_
  4378. __CRT_INLINE PVOID __cdecl memcpy_inline(void *dst,const void *src,size_t size) {
  4379. if(((char *)dst > (char *)src) && ((char *)dst < ((char *)src + size))) {
  4380. __debugbreak();
  4381. }
  4382. return memcpy(dst,src,size);
  4383. }
  4384. #define memcpy memcpy_inline
  4385. #endif
  4386. NTSYSAPI SIZE_T NTAPI RtlCompareMemory(const VOID *Source1,const VOID *Source2,SIZE_T Length);
  4387. #define RtlEqualMemory(Destination,Source,Length) (!memcmp((Destination),(Source),(Length)))
  4388. #define RtlMoveMemory(Destination,Source,Length) memmove((Destination),(Source),(Length))
  4389. #define RtlCopyMemory(Destination,Source,Length) memcpy((Destination),(Source),(Length))
  4390. #define RtlFillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length))
  4391. #define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length))
  4392. __CRT_INLINE PVOID RtlSecureZeroMemory(PVOID ptr,SIZE_T cnt) {
  4393. volatile char *vptr =(volatile char *)ptr;
  4394. #ifdef __x86_64
  4395. __stosb((PBYTE)((DWORD64)vptr),0,cnt);
  4396. #else
  4397. while(cnt) {
  4398. *vptr = 0;
  4399. vptr++;
  4400. cnt--;
  4401. }
  4402. #endif
  4403. return ptr;
  4404. }
  4405. typedef struct _MESSAGE_RESOURCE_ENTRY {
  4406. WORD Length;
  4407. WORD Flags;
  4408. BYTE Text[1];
  4409. } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY;
  4410. #define MESSAGE_RESOURCE_UNICODE 0x0001
  4411. typedef struct _MESSAGE_RESOURCE_BLOCK {
  4412. DWORD LowId;
  4413. DWORD HighId;
  4414. DWORD OffsetToEntries;
  4415. } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK;
  4416. typedef struct _MESSAGE_RESOURCE_DATA {
  4417. DWORD NumberOfBlocks;
  4418. MESSAGE_RESOURCE_BLOCK Blocks[1];
  4419. } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
  4420. typedef struct _OSVERSIONINFOA {
  4421. DWORD dwOSVersionInfoSize;
  4422. DWORD dwMajorVersion;
  4423. DWORD dwMinorVersion;
  4424. DWORD dwBuildNumber;
  4425. DWORD dwPlatformId;
  4426. CHAR szCSDVersion[128];
  4427. } OSVERSIONINFOA,*POSVERSIONINFOA,*LPOSVERSIONINFOA;
  4428. typedef struct _OSVERSIONINFOW {
  4429. DWORD dwOSVersionInfoSize;
  4430. DWORD dwMajorVersion;
  4431. DWORD dwMinorVersion;
  4432. DWORD dwBuildNumber;
  4433. DWORD dwPlatformId;
  4434. WCHAR szCSDVersion[128];
  4435. } OSVERSIONINFOW,*POSVERSIONINFOW,*LPOSVERSIONINFOW,RTL_OSVERSIONINFOW,*PRTL_OSVERSIONINFOW;
  4436. #ifdef UNICODE
  4437. typedef OSVERSIONINFOW OSVERSIONINFO;
  4438. typedef POSVERSIONINFOW POSVERSIONINFO;
  4439. typedef LPOSVERSIONINFOW LPOSVERSIONINFO;
  4440. #else
  4441. typedef OSVERSIONINFOA OSVERSIONINFO;
  4442. typedef POSVERSIONINFOA POSVERSIONINFO;
  4443. typedef LPOSVERSIONINFOA LPOSVERSIONINFO;
  4444. #endif
  4445. typedef struct _OSVERSIONINFOEXA {
  4446. DWORD dwOSVersionInfoSize;
  4447. DWORD dwMajorVersion;
  4448. DWORD dwMinorVersion;
  4449. DWORD dwBuildNumber;
  4450. DWORD dwPlatformId;
  4451. CHAR szCSDVersion[128];
  4452. WORD wServicePackMajor;
  4453. WORD wServicePackMinor;
  4454. WORD wSuiteMask;
  4455. BYTE wProductType;
  4456. BYTE wReserved;
  4457. } OSVERSIONINFOEXA,*POSVERSIONINFOEXA,*LPOSVERSIONINFOEXA;
  4458. typedef struct _OSVERSIONINFOEXW {
  4459. DWORD dwOSVersionInfoSize;
  4460. DWORD dwMajorVersion;
  4461. DWORD dwMinorVersion;
  4462. DWORD dwBuildNumber;
  4463. DWORD dwPlatformId;
  4464. WCHAR szCSDVersion[128];
  4465. WORD wServicePackMajor;
  4466. WORD wServicePackMinor;
  4467. WORD wSuiteMask;
  4468. BYTE wProductType;
  4469. BYTE wReserved;
  4470. } OSVERSIONINFOEXW,*POSVERSIONINFOEXW,*LPOSVERSIONINFOEXW,RTL_OSVERSIONINFOEXW,*PRTL_OSVERSIONINFOEXW;
  4471. #ifdef UNICODE
  4472. typedef OSVERSIONINFOEXW OSVERSIONINFOEX;
  4473. typedef POSVERSIONINFOEXW POSVERSIONINFOEX;
  4474. typedef LPOSVERSIONINFOEXW LPOSVERSIONINFOEX;
  4475. #else
  4476. typedef OSVERSIONINFOEXA OSVERSIONINFOEX;
  4477. typedef POSVERSIONINFOEXA POSVERSIONINFOEX;
  4478. typedef LPOSVERSIONINFOEXA LPOSVERSIONINFOEX;
  4479. #endif
  4480. #define VER_EQUAL 1
  4481. #define VER_GREATER 2
  4482. #define VER_GREATER_EQUAL 3
  4483. #define VER_LESS 4
  4484. #define VER_LESS_EQUAL 5
  4485. #define VER_AND 6
  4486. #define VER_OR 7
  4487. #define VER_CONDITION_MASK 7
  4488. #define VER_NUM_BITS_PER_CONDITION_MASK 3
  4489. #define VER_MINORVERSION 0x0000001
  4490. #define VER_MAJORVERSION 0x0000002
  4491. #define VER_BUILDNUMBER 0x0000004
  4492. #define VER_PLATFORMID 0x0000008
  4493. #define VER_SERVICEPACKMINOR 0x0000010
  4494. #define VER_SERVICEPACKMAJOR 0x0000020
  4495. #define VER_SUITENAME 0x0000040
  4496. #define VER_PRODUCT_TYPE 0x0000080
  4497. #define VER_NT_WORKSTATION 0x0000001
  4498. #define VER_NT_DOMAIN_CONTROLLER 0x0000002
  4499. #define VER_NT_SERVER 0x0000003
  4500. #define VER_PLATFORM_WIN32s 0
  4501. #define VER_PLATFORM_WIN32_WINDOWS 1
  4502. #define VER_PLATFORM_WIN32_NT 2
  4503. #define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_)))
  4504. NTSYSAPI ULONGLONG NTAPI VerSetConditionMask(ULONGLONG ConditionMask,DWORD TypeMask,BYTE Condition);
  4505. typedef struct _RTL_CRITICAL_SECTION_DEBUG {
  4506. WORD Type;
  4507. WORD CreatorBackTraceIndex;
  4508. struct _RTL_CRITICAL_SECTION *CriticalSection;
  4509. LIST_ENTRY ProcessLocksList;
  4510. DWORD EntryCount;
  4511. DWORD ContentionCount;
  4512. DWORD Spare[2];
  4513. } RTL_CRITICAL_SECTION_DEBUG,*PRTL_CRITICAL_SECTION_DEBUG,RTL_RESOURCE_DEBUG,*PRTL_RESOURCE_DEBUG;
  4514. #define RTL_CRITSECT_TYPE 0
  4515. #define RTL_RESOURCE_TYPE 1
  4516. typedef struct _RTL_CRITICAL_SECTION {
  4517. PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
  4518. LONG LockCount;
  4519. LONG RecursionCount;
  4520. HANDLE OwningThread;
  4521. HANDLE LockSemaphore;
  4522. ULONG_PTR SpinCount;
  4523. } RTL_CRITICAL_SECTION,*PRTL_CRITICAL_SECTION;
  4524. typedef VOID (NTAPI *RTL_VERIFIER_DLL_LOAD_CALLBACK) (PWSTR DllName,PVOID DllBase,SIZE_T DllSize,PVOID Reserved);
  4525. typedef VOID (NTAPI *RTL_VERIFIER_DLL_UNLOAD_CALLBACK) (PWSTR DllName,PVOID DllBase,SIZE_T DllSize,PVOID Reserved);
  4526. typedef VOID (NTAPI *RTL_VERIFIER_NTDLLHEAPFREE_CALLBACK)(PVOID AllocationBase,SIZE_T AllocationSize);
  4527. typedef struct _RTL_VERIFIER_THUNK_DESCRIPTOR {
  4528. PCHAR ThunkName;
  4529. PVOID ThunkOldAddress;
  4530. PVOID ThunkNewAddress;
  4531. } RTL_VERIFIER_THUNK_DESCRIPTOR,*PRTL_VERIFIER_THUNK_DESCRIPTOR;
  4532. typedef struct _RTL_VERIFIER_DLL_DESCRIPTOR {
  4533. PWCHAR DllName;
  4534. DWORD DllFlags;
  4535. PVOID DllAddress;
  4536. PRTL_VERIFIER_THUNK_DESCRIPTOR DllThunks;
  4537. } RTL_VERIFIER_DLL_DESCRIPTOR,*PRTL_VERIFIER_DLL_DESCRIPTOR;
  4538. typedef struct _RTL_VERIFIER_PROVIDER_DESCRIPTOR {
  4539. DWORD Length;
  4540. PRTL_VERIFIER_DLL_DESCRIPTOR ProviderDlls;
  4541. RTL_VERIFIER_DLL_LOAD_CALLBACK ProviderDllLoadCallback;
  4542. RTL_VERIFIER_DLL_UNLOAD_CALLBACK ProviderDllUnloadCallback;
  4543. PWSTR VerifierImage;
  4544. DWORD VerifierFlags;
  4545. DWORD VerifierDebug;
  4546. PVOID RtlpGetStackTraceAddress;
  4547. PVOID RtlpDebugPageHeapCreate;
  4548. PVOID RtlpDebugPageHeapDestroy;
  4549. RTL_VERIFIER_NTDLLHEAPFREE_CALLBACK ProviderNtdllHeapFreeCallback;
  4550. } RTL_VERIFIER_PROVIDER_DESCRIPTOR,*PRTL_VERIFIER_PROVIDER_DESCRIPTOR;
  4551. #define RTL_VRF_FLG_FULL_PAGE_HEAP 0x00000001
  4552. #define RTL_VRF_FLG_RESERVED_DONOTUSE 0x00000002
  4553. #define RTL_VRF_FLG_HANDLE_CHECKS 0x00000004
  4554. #define RTL_VRF_FLG_STACK_CHECKS 0x00000008
  4555. #define RTL_VRF_FLG_APPCOMPAT_CHECKS 0x00000010
  4556. #define RTL_VRF_FLG_TLS_CHECKS 0x00000020
  4557. #define RTL_VRF_FLG_DIRTY_STACKS 0x00000040
  4558. #define RTL_VRF_FLG_RPC_CHECKS 0x00000080
  4559. #define RTL_VRF_FLG_COM_CHECKS 0x00000100
  4560. #define RTL_VRF_FLG_DANGEROUS_APIS 0x00000200
  4561. #define RTL_VRF_FLG_RACE_CHECKS 0x00000400
  4562. #define RTL_VRF_FLG_DEADLOCK_CHECKS 0x00000800
  4563. #define RTL_VRF_FLG_FIRST_CHANCE_EXCEPTION_CHECKS 0x00001000
  4564. #define RTL_VRF_FLG_VIRTUAL_MEM_CHECKS 0x00002000
  4565. #define RTL_VRF_FLG_ENABLE_LOGGING 0x00004000
  4566. #define RTL_VRF_FLG_FAST_FILL_HEAP 0x00008000
  4567. #define RTL_VRF_FLG_VIRTUAL_SPACE_TRACKING 0x00010000
  4568. #define RTL_VRF_FLG_ENABLED_SYSTEM_WIDE 0x00020000
  4569. #define RTL_VRF_FLG_MISCELLANEOUS_CHECKS 0x00020000
  4570. #define RTL_VRF_FLG_LOCK_CHECKS 0x00040000
  4571. #define APPLICATION_VERIFIER_INTERNAL_ERROR 0x80000000
  4572. #define APPLICATION_VERIFIER_INTERNAL_WARNING 0x40000000
  4573. #define APPLICATION_VERIFIER_NO_BREAK 0x20000000
  4574. #define APPLICATION_VERIFIER_CONTINUABLE_BREAK 0x10000000
  4575. #define APPLICATION_VERIFIER_UNKNOWN_ERROR 0x0001
  4576. #define APPLICATION_VERIFIER_ACCESS_VIOLATION 0x0002
  4577. #define APPLICATION_VERIFIER_UNSYNCHRONIZED_ACCESS 0x0003
  4578. #define APPLICATION_VERIFIER_EXTREME_SIZE_REQUEST 0x0004
  4579. #define APPLICATION_VERIFIER_BAD_HEAP_HANDLE 0x0005
  4580. #define APPLICATION_VERIFIER_SWITCHED_HEAP_HANDLE 0x0006
  4581. #define APPLICATION_VERIFIER_DOUBLE_FREE 0x0007
  4582. #define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK 0x0008
  4583. #define APPLICATION_VERIFIER_DESTROY_PROCESS_HEAP 0x0009
  4584. #define APPLICATION_VERIFIER_UNEXPECTED_EXCEPTION 0x000A
  4585. #define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_EXCEPTION_RAISED_FOR_HEADER 0x000B
  4586. #define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_EXCEPTION_RAISED_FOR_PROBING 0x000C
  4587. #define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_HEADER 0x000D
  4588. #define APPLICATION_VERIFIER_CORRUPTED_FREED_HEAP_BLOCK 0x000E
  4589. #define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_SUFFIX 0x000F
  4590. #define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_START_STAMP 0x0010
  4591. #define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_END_STAMP 0x0011
  4592. #define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_PREFIX 0x0012
  4593. #define APPLICATION_VERIFIER_FIRST_CHANCE_ACCESS_VIOLATION 0x0013
  4594. #define APPLICATION_VERIFIER_CORRUPTED_HEAP_LIST 0x0014
  4595. #define APPLICATION_VERIFIER_TERMINATE_THREAD_CALL 0x0100
  4596. #define APPLICATION_VERIFIER_STACK_OVERFLOW 0x0101
  4597. #define APPLICATION_VERIFIER_INVALID_EXIT_PROCESS_CALL 0x0102
  4598. #define APPLICATION_VERIFIER_EXIT_THREAD_OWNS_LOCK 0x0200
  4599. #define APPLICATION_VERIFIER_LOCK_IN_UNLOADED_DLL 0x0201
  4600. #define APPLICATION_VERIFIER_LOCK_IN_FREED_HEAP 0x0202
  4601. #define APPLICATION_VERIFIER_LOCK_DOUBLE_INITIALIZE 0x0203
  4602. #define APPLICATION_VERIFIER_LOCK_IN_FREED_MEMORY 0x0204
  4603. #define APPLICATION_VERIFIER_LOCK_CORRUPTED 0x0205
  4604. #define APPLICATION_VERIFIER_LOCK_INVALID_OWNER 0x0206
  4605. #define APPLICATION_VERIFIER_LOCK_INVALID_RECURSION_COUNT 0x0207
  4606. #define APPLICATION_VERIFIER_LOCK_INVALID_LOCK_COUNT 0x0208
  4607. #define APPLICATION_VERIFIER_LOCK_OVER_RELEASED 0x0209
  4608. #define APPLICATION_VERIFIER_LOCK_NOT_INITIALIZED 0x0210
  4609. #define APPLICATION_VERIFIER_LOCK_ALREADY_INITIALIZED 0x0211
  4610. #define APPLICATION_VERIFIER_LOCK_IN_FREED_VMEM 0x0212
  4611. #define APPLICATION_VERIFIER_LOCK_IN_UNMAPPED_MEM 0x0213
  4612. #define APPLICATION_VERIFIER_THREAD_NOT_LOCK_OWNER 0x0214
  4613. #define APPLICATION_VERIFIER_INVALID_HANDLE 0x0300
  4614. #define APPLICATION_VERIFIER_INVALID_TLS_VALUE 0x0301
  4615. #define APPLICATION_VERIFIER_INCORRECT_WAIT_CALL 0x0302
  4616. #define APPLICATION_VERIFIER_NULL_HANDLE 0x0303
  4617. #define APPLICATION_VERIFIER_WAIT_IN_DLLMAIN 0x0304
  4618. #define APPLICATION_VERIFIER_COM_ERROR 0x0400
  4619. #define APPLICATION_VERIFIER_COM_API_IN_DLLMAIN 0x0401
  4620. #define APPLICATION_VERIFIER_COM_UNHANDLED_EXCEPTION 0x0402
  4621. #define APPLICATION_VERIFIER_COM_UNBALANCED_COINIT 0x0403
  4622. #define APPLICATION_VERIFIER_COM_UNBALANCED_OLEINIT 0x0404
  4623. #define APPLICATION_VERIFIER_COM_UNBALANCED_SWC 0x0405
  4624. #define APPLICATION_VERIFIER_COM_NULL_DACL 0x0406
  4625. #define APPLICATION_VERIFIER_COM_UNSAFE_IMPERSONATION 0x0407
  4626. #define APPLICATION_VERIFIER_COM_SMUGGLED_WRAPPER 0x0408
  4627. #define APPLICATION_VERIFIER_COM_SMUGGLED_PROXY 0x0409
  4628. #define APPLICATION_VERIFIER_COM_CF_SUCCESS_WITH_NULL 0x040A
  4629. #define APPLICATION_VERIFIER_COM_GCO_SUCCESS_WITH_NULL 0x040B
  4630. #define APPLICATION_VERIFIER_COM_OBJECT_IN_FREED_MEMORY 0x040C
  4631. #define APPLICATION_VERIFIER_COM_OBJECT_IN_UNLOADED_DLL 0x040D
  4632. #define APPLICATION_VERIFIER_COM_VTBL_IN_FREED_MEMORY 0x040E
  4633. #define APPLICATION_VERIFIER_COM_VTBL_IN_UNLOADED_DLL 0x040F
  4634. #define APPLICATION_VERIFIER_COM_HOLDING_LOCKS_ON_CALL 0x0410
  4635. #define APPLICATION_VERIFIER_RPC_ERROR 0x0500
  4636. #define APPLICATION_VERIFIER_INVALID_FREEMEM 0x0600
  4637. #define APPLICATION_VERIFIER_INVALID_ALLOCMEM 0x0601
  4638. #define APPLICATION_VERIFIER_INVALID_MAPVIEW 0x0602
  4639. #define APPLICATION_VERIFIER_PROBE_INVALID_ADDRESS 0x0603
  4640. #define APPLICATION_VERIFIER_PROBE_FREE_MEM 0x0604
  4641. #define APPLICATION_VERIFIER_PROBE_GUARD_PAGE 0x0605
  4642. #define APPLICATION_VERIFIER_PROBE_NULL 0x0606
  4643. #define APPLICATION_VERIFIER_PROBE_INVALID_START_OR_SIZE 0x0607
  4644. #define APPLICATION_VERIFIER_SIZE_HEAP_UNEXPECTED_EXCEPTION 0x0618
  4645. #define VERIFIER_STOP(Code,Msg,P1,S1,P2,S2,P3,S3,P4,S4) { RtlApplicationVerifierStop ((Code),(Msg),(ULONG_PTR)(P1),(S1),(ULONG_PTR)(P2),(S2),(ULONG_PTR)(P3),(S3),(ULONG_PTR)(P4),(S4)); }
  4646. VOID NTAPI RtlApplicationVerifierStop(ULONG_PTR Code,PSTR Message,ULONG_PTR Param1,PSTR Description1,ULONG_PTR Param2,PSTR Description2,ULONG_PTR Param3,PSTR Description3,ULONG_PTR Param4,PSTR Description4);
  4647. typedef LONG (NTAPI *PVECTORED_EXCEPTION_HANDLER)(struct _EXCEPTION_POINTERS *ExceptionInfo);
  4648. #define SEF_DACL_AUTO_INHERIT 0x01
  4649. #define SEF_SACL_AUTO_INHERIT 0x02
  4650. #define SEF_DEFAULT_DESCRIPTOR_FOR_OBJECT 0x04
  4651. #define SEF_AVOID_PRIVILEGE_CHECK 0x08
  4652. #define SEF_AVOID_OWNER_CHECK 0x10
  4653. #define SEF_DEFAULT_OWNER_FROM_PARENT 0x20
  4654. #define SEF_DEFAULT_GROUP_FROM_PARENT 0x40
  4655. typedef enum _HEAP_INFORMATION_CLASS {
  4656. HeapCompatibilityInformation
  4657. } HEAP_INFORMATION_CLASS;
  4658. NTSYSAPI DWORD NTAPI RtlSetHeapInformation(PVOID HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID HeapInformation,SIZE_T HeapInformationLength);
  4659. NTSYSAPI DWORD NTAPI RtlQueryHeapInformation(PVOID HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID HeapInformation,SIZE_T HeapInformationLength,PSIZE_T ReturnLength);
  4660. DWORD NTAPI RtlMultipleAllocateHeap(PVOID HeapHandle,DWORD Flags,SIZE_T Size,DWORD Count,PVOID *Array);
  4661. DWORD NTAPI RtlMultipleFreeHeap(PVOID HeapHandle,DWORD Flags,DWORD Count,PVOID *Array);
  4662. #define WT_EXECUTEDEFAULT 0x00000000
  4663. #define WT_EXECUTEINIOTHREAD 0x00000001
  4664. #define WT_EXECUTEINUITHREAD 0x00000002
  4665. #define WT_EXECUTEINWAITTHREAD 0x00000004
  4666. #define WT_EXECUTEONLYONCE 0x00000008
  4667. #define WT_EXECUTEINTIMERTHREAD 0x00000020
  4668. #define WT_EXECUTELONGFUNCTION 0x00000010
  4669. #define WT_EXECUTEINPERSISTENTIOTHREAD 0x00000040
  4670. #define WT_EXECUTEINPERSISTENTTHREAD 0x00000080
  4671. #define WT_TRANSFER_IMPERSONATION 0x00000100
  4672. #define WT_SET_MAX_THREADPOOL_THREADS(Flags,Limit) ((Flags) |= (Limit)<<16)
  4673. typedef VOID (NTAPI *WAITORTIMERCALLBACKFUNC)(PVOID,BOOLEAN);
  4674. typedef VOID (NTAPI *WORKERCALLBACKFUNC)(PVOID);
  4675. typedef VOID (NTAPI *APC_CALLBACK_FUNCTION)(DWORD ,PVOID,PVOID);
  4676. typedef
  4677. VOID
  4678. (NTAPI *PFLS_CALLBACK_FUNCTION)(PVOID lpFlsData);
  4679. #define WT_EXECUTEINLONGTHREAD 0x00000010
  4680. #define WT_EXECUTEDELETEWAIT 0x00000008
  4681. typedef enum _ACTIVATION_CONTEXT_INFO_CLASS {
  4682. ActivationContextBasicInformation = 1,ActivationContextDetailedInformation = 2,AssemblyDetailedInformationInActivationContext = 3,FileInformationInAssemblyOfAssemblyInActivationContext = 4,MaxActivationContextInfoClass,AssemblyDetailedInformationInActivationContxt = 3,FileInformationInAssemblyOfAssemblyInActivationContxt = 4
  4683. } ACTIVATION_CONTEXT_INFO_CLASS;
  4684. #define ACTIVATIONCONTEXTINFOCLASS ACTIVATION_CONTEXT_INFO_CLASS
  4685. typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX {
  4686. DWORD ulAssemblyIndex;
  4687. DWORD ulFileIndexInAssembly;
  4688. } ACTIVATION_CONTEXT_QUERY_INDEX,*PACTIVATION_CONTEXT_QUERY_INDEX;
  4689. typedef const struct _ACTIVATION_CONTEXT_QUERY_INDEX *PCACTIVATION_CONTEXT_QUERY_INDEX;
  4690. #define ACTIVATION_CONTEXT_PATH_TYPE_NONE (1)
  4691. #define ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE (2)
  4692. #define ACTIVATION_CONTEXT_PATH_TYPE_URL (3)
  4693. #define ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF (4)
  4694. typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION {
  4695. DWORD ulFlags;
  4696. DWORD ulFilenameLength;
  4697. DWORD ulPathLength;
  4698. PCWSTR lpFileName;
  4699. PCWSTR lpFilePath;
  4700. } ASSEMBLY_FILE_DETAILED_INFORMATION,*PASSEMBLY_FILE_DETAILED_INFORMATION;
  4701. typedef const ASSEMBLY_FILE_DETAILED_INFORMATION *PCASSEMBLY_FILE_DETAILED_INFORMATION;
  4702. #define _ASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION _ASSEMBLY_FILE_DETAILED_INFORMATION
  4703. #define ASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION ASSEMBLY_FILE_DETAILED_INFORMATION
  4704. #define PASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION PASSEMBLY_FILE_DETAILED_INFORMATION
  4705. #define PCASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION PCASSEMBLY_FILE_DETAILED_INFORMATION
  4706. typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION {
  4707. DWORD ulFlags;
  4708. DWORD ulEncodedAssemblyIdentityLength;
  4709. DWORD ulManifestPathType;
  4710. DWORD ulManifestPathLength;
  4711. LARGE_INTEGER liManifestLastWriteTime;
  4712. DWORD ulPolicyPathType;
  4713. DWORD ulPolicyPathLength;
  4714. LARGE_INTEGER liPolicyLastWriteTime;
  4715. DWORD ulMetadataSatelliteRosterIndex;
  4716. DWORD ulManifestVersionMajor;
  4717. DWORD ulManifestVersionMinor;
  4718. DWORD ulPolicyVersionMajor;
  4719. DWORD ulPolicyVersionMinor;
  4720. DWORD ulAssemblyDirectoryNameLength;
  4721. PCWSTR lpAssemblyEncodedAssemblyIdentity;
  4722. PCWSTR lpAssemblyManifestPath;
  4723. PCWSTR lpAssemblyPolicyPath;
  4724. PCWSTR lpAssemblyDirectoryName;
  4725. DWORD ulFileCount;
  4726. } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION,*PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION;
  4727. typedef const struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *PCACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION;
  4728. typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION {
  4729. DWORD dwFlags;
  4730. DWORD ulFormatVersion;
  4731. DWORD ulAssemblyCount;
  4732. DWORD ulRootManifestPathType;
  4733. DWORD ulRootManifestPathChars;
  4734. DWORD ulRootConfigurationPathType;
  4735. DWORD ulRootConfigurationPathChars;
  4736. DWORD ulAppDirPathType;
  4737. DWORD ulAppDirPathChars;
  4738. PCWSTR lpRootManifestPath;
  4739. PCWSTR lpRootConfigurationPath;
  4740. PCWSTR lpAppDirPath;
  4741. } ACTIVATION_CONTEXT_DETAILED_INFORMATION,*PACTIVATION_CONTEXT_DETAILED_INFORMATION;
  4742. typedef const struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION *PCACTIVATION_CONTEXT_DETAILED_INFORMATION;
  4743. #define DLL_PROCESS_ATTACH 1
  4744. #define DLL_THREAD_ATTACH 2
  4745. #define DLL_THREAD_DETACH 3
  4746. #define DLL_PROCESS_DETACH 0
  4747. #define DLL_PROCESS_VERIFIER 4
  4748. #define EVENTLOG_SEQUENTIAL_READ 0x0001
  4749. #define EVENTLOG_SEEK_READ 0x0002
  4750. #define EVENTLOG_FORWARDS_READ 0x0004
  4751. #define EVENTLOG_BACKWARDS_READ 0x0008
  4752. #define EVENTLOG_SUCCESS 0x0000
  4753. #define EVENTLOG_ERROR_TYPE 0x0001
  4754. #define EVENTLOG_WARNING_TYPE 0x0002
  4755. #define EVENTLOG_INFORMATION_TYPE 0x0004
  4756. #define EVENTLOG_AUDIT_SUCCESS 0x0008
  4757. #define EVENTLOG_AUDIT_FAILURE 0x0010
  4758. #define EVENTLOG_START_PAIRED_EVENT 0x0001
  4759. #define EVENTLOG_END_PAIRED_EVENT 0x0002
  4760. #define EVENTLOG_END_ALL_PAIRED_EVENTS 0x0004
  4761. #define EVENTLOG_PAIRED_EVENT_ACTIVE 0x0008
  4762. #define EVENTLOG_PAIRED_EVENT_INACTIVE 0x0010
  4763. typedef struct _EVENTLOGRECORD {
  4764. DWORD Length;
  4765. DWORD Reserved;
  4766. DWORD RecordNumber;
  4767. DWORD TimeGenerated;
  4768. DWORD TimeWritten;
  4769. DWORD EventID;
  4770. WORD EventType;
  4771. WORD NumStrings;
  4772. WORD EventCategory;
  4773. WORD ReservedFlags;
  4774. DWORD ClosingRecordNumber;
  4775. DWORD StringOffset;
  4776. DWORD UserSidLength;
  4777. DWORD UserSidOffset;
  4778. DWORD DataLength;
  4779. DWORD DataOffset;
  4780. } EVENTLOGRECORD,*PEVENTLOGRECORD;
  4781. #define MAXLOGICALLOGNAMESIZE 256
  4782. typedef struct _EVENTSFORLOGFILE{
  4783. DWORD ulSize;
  4784. WCHAR szLogicalLogFile[MAXLOGICALLOGNAMESIZE];
  4785. DWORD ulNumRecords;
  4786. EVENTLOGRECORD pEventLogRecords[];
  4787. } EVENTSFORLOGFILE,*PEVENTSFORLOGFILE;
  4788. typedef struct _PACKEDEVENTINFO{
  4789. DWORD ulSize;
  4790. DWORD ulNumEventsForLogFile;
  4791. DWORD ulOffsets[];
  4792. } PACKEDEVENTINFO,*PPACKEDEVENTINFO;
  4793. #define KEY_QUERY_VALUE (0x0001)
  4794. #define KEY_SET_VALUE (0x0002)
  4795. #define KEY_CREATE_SUB_KEY (0x0004)
  4796. #define KEY_ENUMERATE_SUB_KEYS (0x0008)
  4797. #define KEY_NOTIFY (0x0010)
  4798. #define KEY_CREATE_LINK (0x0020)
  4799. #define KEY_WOW64_32KEY (0x0200)
  4800. #define KEY_WOW64_64KEY (0x0100)
  4801. #define KEY_WOW64_RES (0x0300)
  4802. #define KEY_READ ((STANDARD_RIGHTS_READ | KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY) & (~SYNCHRONIZE))
  4803. #define KEY_WRITE ((STANDARD_RIGHTS_WRITE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY) & (~SYNCHRONIZE))
  4804. #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
  4805. #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL | KEY_QUERY_VALUE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY | KEY_CREATE_LINK) & (~SYNCHRONIZE))
  4806. #define REG_OPTION_RESERVED (0x00000000L)
  4807. #define REG_OPTION_NON_VOLATILE (0x00000000L)
  4808. #define REG_OPTION_VOLATILE (0x00000001L)
  4809. #define REG_OPTION_CREATE_LINK (0x00000002L)
  4810. #define REG_OPTION_BACKUP_RESTORE (0x00000004L)
  4811. #define REG_OPTION_OPEN_LINK (0x00000008L)
  4812. #define REG_LEGAL_OPTION (REG_OPTION_RESERVED | REG_OPTION_NON_VOLATILE | REG_OPTION_VOLATILE | REG_OPTION_CREATE_LINK | REG_OPTION_BACKUP_RESTORE | REG_OPTION_OPEN_LINK)
  4813. #define REG_CREATED_NEW_KEY (0x00000001L)
  4814. #define REG_OPENED_EXISTING_KEY (0x00000002L)
  4815. #define REG_STANDARD_FORMAT 1
  4816. #define REG_LATEST_FORMAT 2
  4817. #define REG_NO_COMPRESSION 4
  4818. #define REG_WHOLE_HIVE_VOLATILE (0x00000001L)
  4819. #define REG_REFRESH_HIVE (0x00000002L)
  4820. #define REG_NO_LAZY_FLUSH (0x00000004L)
  4821. #define REG_FORCE_RESTORE (0x00000008L)
  4822. #define REG_FORCE_UNLOAD 1
  4823. #define REG_NOTIFY_CHANGE_NAME (0x00000001L)
  4824. #define REG_NOTIFY_CHANGE_ATTRIBUTES (0x00000002L)
  4825. #define REG_NOTIFY_CHANGE_LAST_SET (0x00000004L)
  4826. #define REG_NOTIFY_CHANGE_SECURITY (0x00000008L)
  4827. #define REG_LEGAL_CHANGE_FILTER (REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_ATTRIBUTES | REG_NOTIFY_CHANGE_LAST_SET | REG_NOTIFY_CHANGE_SECURITY)
  4828. #define REG_NONE (0)
  4829. #define REG_SZ (1)
  4830. #define REG_EXPAND_SZ (2)
  4831. #define REG_BINARY (3)
  4832. #define REG_DWORD (4)
  4833. #define REG_DWORD_LITTLE_ENDIAN (4)
  4834. #define REG_DWORD_BIG_ENDIAN (5)
  4835. #define REG_LINK (6)
  4836. #define REG_MULTI_SZ (7)
  4837. #define REG_RESOURCE_LIST (8)
  4838. #define REG_FULL_RESOURCE_DESCRIPTOR (9)
  4839. #define REG_RESOURCE_REQUIREMENTS_LIST (10)
  4840. #define REG_QWORD (11)
  4841. #define REG_QWORD_LITTLE_ENDIAN (11)
  4842. #define SERVICE_KERNEL_DRIVER 0x00000001
  4843. #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
  4844. #define SERVICE_ADAPTER 0x00000004
  4845. #define SERVICE_RECOGNIZER_DRIVER 0x00000008
  4846. #define SERVICE_DRIVER (SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | SERVICE_RECOGNIZER_DRIVER)
  4847. #define SERVICE_WIN32_OWN_PROCESS 0x00000010
  4848. #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
  4849. #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
  4850. #define SERVICE_INTERACTIVE_PROCESS 0x00000100
  4851. #define SERVICE_TYPE_ALL (SERVICE_WIN32 | SERVICE_ADAPTER | SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS)
  4852. #define SERVICE_BOOT_START 0x00000000
  4853. #define SERVICE_SYSTEM_START 0x00000001
  4854. #define SERVICE_AUTO_START 0x00000002
  4855. #define SERVICE_DEMAND_START 0x00000003
  4856. #define SERVICE_DISABLED 0x00000004
  4857. #define SERVICE_ERROR_IGNORE 0x00000000
  4858. #define SERVICE_ERROR_NORMAL 0x00000001
  4859. #define SERVICE_ERROR_SEVERE 0x00000002
  4860. #define SERVICE_ERROR_CRITICAL 0x00000003
  4861. typedef enum _CM_SERVICE_NODE_TYPE {
  4862. DriverType = SERVICE_KERNEL_DRIVER,FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS,
  4863. Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,AdapterType = SERVICE_ADAPTER,RecognizerType = SERVICE_RECOGNIZER_DRIVER
  4864. } SERVICE_NODE_TYPE;
  4865. typedef enum _CM_SERVICE_LOAD_TYPE {
  4866. BootLoad = SERVICE_BOOT_START,SystemLoad = SERVICE_SYSTEM_START,AutoLoad = SERVICE_AUTO_START,DemandLoad = SERVICE_DEMAND_START,
  4867. DisableLoad = SERVICE_DISABLED
  4868. } SERVICE_LOAD_TYPE;
  4869. typedef enum _CM_ERROR_CONTROL_TYPE {
  4870. IgnoreError = SERVICE_ERROR_IGNORE,NormalError = SERVICE_ERROR_NORMAL,SevereError = SERVICE_ERROR_SEVERE,CriticalError = SERVICE_ERROR_CRITICAL
  4871. } SERVICE_ERROR_TYPE;
  4872. #define TAPE_ERASE_SHORT 0L
  4873. #define TAPE_ERASE_LONG 1L
  4874. typedef struct _TAPE_ERASE {
  4875. DWORD Type;
  4876. BOOLEAN Immediate;
  4877. } TAPE_ERASE,*PTAPE_ERASE;
  4878. #define TAPE_LOAD 0L
  4879. #define TAPE_UNLOAD 1L
  4880. #define TAPE_TENSION 2L
  4881. #define TAPE_LOCK 3L
  4882. #define TAPE_UNLOCK 4L
  4883. #define TAPE_FORMAT 5L
  4884. typedef struct _TAPE_PREPARE {
  4885. DWORD Operation;
  4886. BOOLEAN Immediate;
  4887. } TAPE_PREPARE,*PTAPE_PREPARE;
  4888. #define TAPE_SETMARKS 0L
  4889. #define TAPE_FILEMARKS 1L
  4890. #define TAPE_SHORT_FILEMARKS 2L
  4891. #define TAPE_LONG_FILEMARKS 3L
  4892. typedef struct _TAPE_WRITE_MARKS {
  4893. DWORD Type;
  4894. DWORD Count;
  4895. BOOLEAN Immediate;
  4896. } TAPE_WRITE_MARKS,*PTAPE_WRITE_MARKS;
  4897. #define TAPE_ABSOLUTE_POSITION 0L
  4898. #define TAPE_LOGICAL_POSITION 1L
  4899. #define TAPE_PSEUDO_LOGICAL_POSITION 2L
  4900. typedef struct _TAPE_GET_POSITION {
  4901. DWORD Type;
  4902. DWORD Partition;
  4903. LARGE_INTEGER Offset;
  4904. } TAPE_GET_POSITION,*PTAPE_GET_POSITION;
  4905. #define TAPE_REWIND 0L
  4906. #define TAPE_ABSOLUTE_BLOCK 1L
  4907. #define TAPE_LOGICAL_BLOCK 2L
  4908. #define TAPE_PSEUDO_LOGICAL_BLOCK 3L
  4909. #define TAPE_SPACE_END_OF_DATA 4L
  4910. #define TAPE_SPACE_RELATIVE_BLOCKS 5L
  4911. #define TAPE_SPACE_FILEMARKS 6L
  4912. #define TAPE_SPACE_SEQUENTIAL_FMKS 7L
  4913. #define TAPE_SPACE_SETMARKS 8L
  4914. #define TAPE_SPACE_SEQUENTIAL_SMKS 9L
  4915. typedef struct _TAPE_SET_POSITION {
  4916. DWORD Method;
  4917. DWORD Partition;
  4918. LARGE_INTEGER Offset;
  4919. BOOLEAN Immediate;
  4920. } TAPE_SET_POSITION,*PTAPE_SET_POSITION;
  4921. #define TAPE_DRIVE_FIXED 0x00000001
  4922. #define TAPE_DRIVE_SELECT 0x00000002
  4923. #define TAPE_DRIVE_INITIATOR 0x00000004
  4924. #define TAPE_DRIVE_ERASE_SHORT 0x00000010
  4925. #define TAPE_DRIVE_ERASE_LONG 0x00000020
  4926. #define TAPE_DRIVE_ERASE_BOP_ONLY 0x00000040
  4927. #define TAPE_DRIVE_ERASE_IMMEDIATE 0x00000080
  4928. #define TAPE_DRIVE_TAPE_CAPACITY 0x00000100
  4929. #define TAPE_DRIVE_TAPE_REMAINING 0x00000200
  4930. #define TAPE_DRIVE_FIXED_BLOCK 0x00000400
  4931. #define TAPE_DRIVE_VARIABLE_BLOCK 0x00000800
  4932. #define TAPE_DRIVE_WRITE_PROTECT 0x00001000
  4933. #define TAPE_DRIVE_EOT_WZ_SIZE 0x00002000
  4934. #define TAPE_DRIVE_ECC 0x00010000
  4935. #define TAPE_DRIVE_COMPRESSION 0x00020000
  4936. #define TAPE_DRIVE_PADDING 0x00040000
  4937. #define TAPE_DRIVE_REPORT_SMKS 0x00080000
  4938. #define TAPE_DRIVE_GET_ABSOLUTE_BLK 0x00100000
  4939. #define TAPE_DRIVE_GET_LOGICAL_BLK 0x00200000
  4940. #define TAPE_DRIVE_SET_EOT_WZ_SIZE 0x00400000
  4941. #define TAPE_DRIVE_EJECT_MEDIA 0x01000000
  4942. #define TAPE_DRIVE_CLEAN_REQUESTS 0x02000000
  4943. #define TAPE_DRIVE_SET_CMP_BOP_ONLY 0x04000000
  4944. #define TAPE_DRIVE_RESERVED_BIT 0x80000000
  4945. #define TAPE_DRIVE_LOAD_UNLOAD 0x80000001
  4946. #define TAPE_DRIVE_TENSION 0x80000002
  4947. #define TAPE_DRIVE_LOCK_UNLOCK 0x80000004
  4948. #define TAPE_DRIVE_REWIND_IMMEDIATE 0x80000008
  4949. #define TAPE_DRIVE_SET_BLOCK_SIZE 0x80000010
  4950. #define TAPE_DRIVE_LOAD_UNLD_IMMED 0x80000020
  4951. #define TAPE_DRIVE_TENSION_IMMED 0x80000040
  4952. #define TAPE_DRIVE_LOCK_UNLK_IMMED 0x80000080
  4953. #define TAPE_DRIVE_SET_ECC 0x80000100
  4954. #define TAPE_DRIVE_SET_COMPRESSION 0x80000200
  4955. #define TAPE_DRIVE_SET_PADDING 0x80000400
  4956. #define TAPE_DRIVE_SET_REPORT_SMKS 0x80000800
  4957. #define TAPE_DRIVE_ABSOLUTE_BLK 0x80001000
  4958. #define TAPE_DRIVE_ABS_BLK_IMMED 0x80002000
  4959. #define TAPE_DRIVE_LOGICAL_BLK 0x80004000
  4960. #define TAPE_DRIVE_LOG_BLK_IMMED 0x80008000
  4961. #define TAPE_DRIVE_END_OF_DATA 0x80010000
  4962. #define TAPE_DRIVE_RELATIVE_BLKS 0x80020000
  4963. #define TAPE_DRIVE_FILEMARKS 0x80040000
  4964. #define TAPE_DRIVE_SEQUENTIAL_FMKS 0x80080000
  4965. #define TAPE_DRIVE_SETMARKS 0x80100000
  4966. #define TAPE_DRIVE_SEQUENTIAL_SMKS 0x80200000
  4967. #define TAPE_DRIVE_REVERSE_POSITION 0x80400000
  4968. #define TAPE_DRIVE_SPACE_IMMEDIATE 0x80800000
  4969. #define TAPE_DRIVE_WRITE_SETMARKS 0x81000000
  4970. #define TAPE_DRIVE_WRITE_FILEMARKS 0x82000000
  4971. #define TAPE_DRIVE_WRITE_SHORT_FMKS 0x84000000
  4972. #define TAPE_DRIVE_WRITE_LONG_FMKS 0x88000000
  4973. #define TAPE_DRIVE_WRITE_MARK_IMMED 0x90000000
  4974. #define TAPE_DRIVE_FORMAT 0xA0000000
  4975. #define TAPE_DRIVE_FORMAT_IMMEDIATE 0xC0000000
  4976. #define TAPE_DRIVE_HIGH_FEATURES 0x80000000
  4977. typedef struct _TAPE_GET_DRIVE_PARAMETERS {
  4978. BOOLEAN ECC;
  4979. BOOLEAN Compression;
  4980. BOOLEAN DataPadding;
  4981. BOOLEAN ReportSetmarks;
  4982. DWORD DefaultBlockSize;
  4983. DWORD MaximumBlockSize;
  4984. DWORD MinimumBlockSize;
  4985. DWORD MaximumPartitionCount;
  4986. DWORD FeaturesLow;
  4987. DWORD FeaturesHigh;
  4988. DWORD EOTWarningZoneSize;
  4989. } TAPE_GET_DRIVE_PARAMETERS,*PTAPE_GET_DRIVE_PARAMETERS;
  4990. typedef struct _TAPE_SET_DRIVE_PARAMETERS {
  4991. BOOLEAN ECC;
  4992. BOOLEAN Compression;
  4993. BOOLEAN DataPadding;
  4994. BOOLEAN ReportSetmarks;
  4995. DWORD EOTWarningZoneSize;
  4996. } TAPE_SET_DRIVE_PARAMETERS,*PTAPE_SET_DRIVE_PARAMETERS;
  4997. typedef struct _TAPE_GET_MEDIA_PARAMETERS {
  4998. LARGE_INTEGER Capacity;
  4999. LARGE_INTEGER Remaining;
  5000. DWORD BlockSize;
  5001. DWORD PartitionCount;
  5002. BOOLEAN WriteProtected;
  5003. } TAPE_GET_MEDIA_PARAMETERS,*PTAPE_GET_MEDIA_PARAMETERS;
  5004. typedef struct _TAPE_SET_MEDIA_PARAMETERS {
  5005. DWORD BlockSize;
  5006. } TAPE_SET_MEDIA_PARAMETERS,*PTAPE_SET_MEDIA_PARAMETERS;
  5007. #define TAPE_FIXED_PARTITIONS 0L
  5008. #define TAPE_SELECT_PARTITIONS 1L
  5009. #define TAPE_INITIATOR_PARTITIONS 2L
  5010. typedef struct _TAPE_CREATE_PARTITION {
  5011. DWORD Method;
  5012. DWORD Count;
  5013. DWORD Size;
  5014. } TAPE_CREATE_PARTITION,*PTAPE_CREATE_PARTITION;
  5015. #define TAPE_QUERY_DRIVE_PARAMETERS 0L
  5016. #define TAPE_QUERY_MEDIA_CAPACITY 1L
  5017. #define TAPE_CHECK_FOR_DRIVE_PROBLEM 2L
  5018. #define TAPE_QUERY_IO_ERROR_DATA 3L
  5019. #define TAPE_QUERY_DEVICE_ERROR_DATA 4L
  5020. typedef struct _TAPE_WMI_OPERATIONS {
  5021. DWORD Method;
  5022. DWORD DataBufferSize;
  5023. PVOID DataBuffer;
  5024. } TAPE_WMI_OPERATIONS,*PTAPE_WMI_OPERATIONS;
  5025. typedef enum _TAPE_DRIVE_PROBLEM_TYPE {
  5026. TapeDriveProblemNone,TapeDriveReadWriteWarning,TapeDriveReadWriteError,TapeDriveReadWarning,TapeDriveWriteWarning,TapeDriveReadError,TapeDriveWriteError,TapeDriveHardwareError,TapeDriveUnsupportedMedia,TapeDriveScsiConnectionError,TapeDriveTimetoClean,TapeDriveCleanDriveNow,TapeDriveMediaLifeExpired,TapeDriveSnappedTape
  5027. } TAPE_DRIVE_PROBLEM_TYPE;
  5028. #if defined(__x86_64)
  5029. __CRT_INLINE struct _TEB *NtCurrentTeb(VOID) { return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB,Self)); }
  5030. __CRT_INLINE PVOID GetCurrentFiber(VOID) { return(PVOID)__readgsqword(FIELD_OFFSET(NT_TIB,FiberData)); }
  5031. __CRT_INLINE PVOID GetFiberData(VOID) {
  5032. return *(PVOID *)GetCurrentFiber();
  5033. }
  5034. #endif
  5035. #if(defined(_X86_) && !defined(__x86_64))
  5036. #define PcTeb 0x18
  5037. __CRT_INLINE struct _TEB *NtCurrentTeb(void) {
  5038. struct _TEB *ret;
  5039. __asm__ volatile ("movl %%fs:0x18,%0"
  5040. : "=r" (ret));
  5041. return ret;
  5042. }
  5043. #endif
  5044. #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION (1)
  5045. #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION (2)
  5046. #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION (3)
  5047. #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION (4)
  5048. #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION (5)
  5049. #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION (6)
  5050. #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION (7)
  5051. #define ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE (8)
  5052. #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES (9)
  5053. #define ACTIVATION_CONTEXT_SECTION_APPLICATION_SETTINGS (10)
  5054. #ifdef __cplusplus
  5055. }
  5056. #endif
  5057. #endif