jwawinioctl.pas 169 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025
  1. {******************************************************************************}
  2. { }
  3. { I/O Control Codes API interface Unit for Object Pascal }
  4. { }
  5. { Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
  6. { Corporation. All Rights Reserved. }
  7. { }
  8. { The original file is: winioctl.h, released June 2000. The original Pascal }
  9. { code is: WinIoCtl.pas, released December 2000. The initial developer of the }
  10. { Pascal code is Marcel van Brakel (brakelm att chello dott nl). }
  11. { }
  12. { Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
  13. { Marcel van Brakel. All Rights Reserved. }
  14. { }
  15. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
  16. { }
  17. { You may retrieve the latest version of this file at the Project JEDI }
  18. { APILIB home page, located at http://jedi-apilib.sourceforge.net }
  19. { }
  20. { The contents of this file are used with permission, subject to the Mozilla }
  21. { Public License Version 1.1 (the "License"); you may not use this file except }
  22. { in compliance with the License. You may obtain a copy of the License at }
  23. { http://www.mozilla.org/MPL/MPL-1.1.html }
  24. { }
  25. { Software distributed under the License is distributed on an "AS IS" basis, }
  26. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  27. { the specific language governing rights and limitations under the License. }
  28. { }
  29. { Alternatively, the contents of this file may be used under the terms of the }
  30. { GNU Lesser General Public License (the "LGPL License"), in which case the }
  31. { provisions of the LGPL License are applicable instead of those above. }
  32. { If you wish to allow use of your version of this file only under the terms }
  33. { of the LGPL License and not to allow others to use your version of this file }
  34. { under the MPL, indicate your decision by deleting the provisions above and }
  35. { replace them with the notice and other provisions required by the LGPL }
  36. { License. If you do not delete the provisions above, a recipient may use }
  37. { your version of this file under either the MPL or the LGPL License. }
  38. { }
  39. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  40. { }
  41. {******************************************************************************}
  42. // $Id: JwaWinIoctl.pas,v 1.9 2007/09/05 11:58:54 dezipaitor Exp $
  43. {$IFNDEF JWA_OMIT_SECTIONS}
  44. unit JwaWinIoctl;
  45. {$WEAKPACKAGEUNIT}
  46. {$ENDIF JWA_OMIT_SECTIONS}
  47. {$HPPEMIT ''}
  48. {$HPPEMIT '#include "WinIoCtl.h"'}
  49. {$HPPEMIT ''}
  50. {$IFNDEF JWA_OMIT_SECTIONS}
  51. {$I jediapilib.inc}
  52. interface
  53. uses
  54. JwaWinNT, JwaWinType;
  55. {$ENDIF JWA_OMIT_SECTIONS}
  56. {$IFNDEF JWA_IMPLEMENTATIONSECTION}
  57. //
  58. // Device interface class GUIDs.
  59. //
  60. // need these GUIDs outside conditional includes so that user can
  61. // #include <winioctl.h> in precompiled header
  62. // #include <initguid.h> in a single source file
  63. // #include <winioctl.h> in that source file a second time to instantiate the GUIDs
  64. //
  65. const
  66. GUID_DEVINTERFACE_DISK: TGUID = (
  67. D1:$53f56307; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
  68. {$EXTERNALSYM GUID_DEVINTERFACE_DISK}
  69. GUID_DEVINTERFACE_CDROM: TGUID = (
  70. D1:$53f56308; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
  71. {$EXTERNALSYM GUID_DEVINTERFACE_CDROM}
  72. GUID_DEVINTERFACE_PARTITION: TGUID = (
  73. D1:$53f5630a; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
  74. {$EXTERNALSYM GUID_DEVINTERFACE_PARTITION}
  75. GUID_DEVINTERFACE_TAPE: TGUID = (
  76. D1:$53f5630b; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
  77. {$EXTERNALSYM GUID_DEVINTERFACE_TAPE}
  78. GUID_DEVINTERFACE_WRITEONCEDISK: TGUID = (
  79. D1:$53f5630c; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
  80. {$EXTERNALSYM GUID_DEVINTERFACE_WRITEONCEDISK}
  81. GUID_DEVINTERFACE_VOLUME: TGUID = (
  82. D1:$53f5630d; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
  83. {$EXTERNALSYM GUID_DEVINTERFACE_VOLUME}
  84. GUID_DEVINTERFACE_MEDIUMCHANGER: TGUID = (
  85. D1:$53f56310; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
  86. {$EXTERNALSYM GUID_DEVINTERFACE_MEDIUMCHANGER}
  87. GUID_DEVINTERFACE_FLOPPY: TGUID = (
  88. D1:$53f56311; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
  89. {$EXTERNALSYM GUID_DEVINTERFACE_FLOPPY}
  90. GUID_DEVINTERFACE_CDCHANGER: TGUID = (
  91. D1:$53f56312; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
  92. {$EXTERNALSYM GUID_DEVINTERFACE_CDCHANGER}
  93. GUID_DEVINTERFACE_STORAGEPORT: TGUID = (
  94. D1:$2accfe60; D2:$c130; D3:$11d2; D4:($b0, $82, $00, $a0, $c9, $1e, $fb, $8b));
  95. {$EXTERNALSYM GUID_DEVINTERFACE_STORAGEPORT}
  96. GUID_DEVINTERFACE_COMPORT: TGUID = (
  97. D1:$86e0d1e0; D2:$8089; D3:$11d0; D4:($9c, $e4, $08, $00, $3e, $30, $1f, $73));
  98. {$EXTERNALSYM GUID_DEVINTERFACE_COMPORT}
  99. GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR: TGUID = (
  100. D1:$4D36E978; D2:$E325; D3:$11CE; D4:($BF, $C1, $08, $00, $2B, $E1, $03, $18));
  101. {$EXTERNALSYM GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR}
  102. //
  103. // Obsolete device interface class GUID names.
  104. // (use of above GUID_DEVINTERFACE_* names is recommended).
  105. //
  106. // MVB: Note that these "constants" are in reality aliases for the list above. Unfortunately you can't
  107. // define a GUID without using a type constant and you can't alias a type constant in Delphi...
  108. DiskClassGuid: TGUID = (
  109. D1:$53f56307; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
  110. {$EXTERNALSYM DiskClassGuid}
  111. CdRomClassGuid: TGUID = (
  112. D1:$53f56308; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
  113. {$EXTERNALSYM CdRomClassGuid}
  114. PartitionClassGuid: TGUID = (
  115. D1:$53f5630a; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
  116. {$EXTERNALSYM PartitionClassGuid}
  117. TapeClassGuid: TGUID = (
  118. D1:$53f5630b; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
  119. {$EXTERNALSYM TapeClassGuid}
  120. WriteOnceDiskClassGuid: TGUID = (
  121. D1:$53f5630c; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
  122. {$EXTERNALSYM WriteOnceDiskClassGuid}
  123. VolumeClassGuid: TGUID = (
  124. D1:$53f5630d; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
  125. {$EXTERNALSYM VolumeClassGuid}
  126. MediumChangerClassGuid: TGUID = (
  127. D1:$53f56310; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
  128. {$EXTERNALSYM MediumChangerClassGuid}
  129. FloppyClassGuid: TGUID = (
  130. D1:$53f56311; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
  131. {$EXTERNALSYM FloppyClassGuid}
  132. CdChangerClassGuid: TGUID = (
  133. D1:$53f56312; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
  134. {$EXTERNALSYM CdChangerClassGuid}
  135. StoragePortClassGuid: TGUID = (
  136. D1:$2accfe60; D2:$c130; D3:$11d2; D4:($b0, $82, $00, $a0, $c9, $1e, $fb, $8b));
  137. {$EXTERNALSYM StoragePortClassGuid}
  138. GUID_CLASS_COMPORT: TGUID = (
  139. D1:$86e0d1e0; D2:$8089; D3:$11d0; D4:($9c, $e4, $08, $00, $3e, $30, $1f, $73));
  140. {$EXTERNALSYM GUID_CLASS_COMPORT}
  141. GUID_SERENUM_BUS_ENUMERATOR: TGUID = (
  142. D1:$4D36E978; D2:$E325; D3:$11CE; D4:($BF, $C1, $08, $00, $2B, $E1, $03, $18));
  143. {$EXTERNALSYM GUID_SERENUM_BUS_ENUMERATOR}
  144. //
  145. // Define the various device type values. Note that values used by Microsoft
  146. // Corporation are in the range 0-32767, and 32768-65535 are reserved for use
  147. // by customers.
  148. //
  149. type
  150. DEVICE_TYPE = DWORD;
  151. {$EXTERNALSYM DEVICE_TYPE}
  152. const
  153. FILE_DEVICE_BEEP = $00000001;
  154. {$EXTERNALSYM FILE_DEVICE_BEEP}
  155. FILE_DEVICE_CD_ROM = $00000002;
  156. {$EXTERNALSYM FILE_DEVICE_CD_ROM}
  157. FILE_DEVICE_CD_ROM_FILE_SYSTEM = $00000003;
  158. {$EXTERNALSYM FILE_DEVICE_CD_ROM_FILE_SYSTEM}
  159. FILE_DEVICE_CONTROLLER = $00000004;
  160. {$EXTERNALSYM FILE_DEVICE_CONTROLLER}
  161. FILE_DEVICE_DATALINK = $00000005;
  162. {$EXTERNALSYM FILE_DEVICE_DATALINK}
  163. FILE_DEVICE_DFS = $00000006;
  164. {$EXTERNALSYM FILE_DEVICE_DFS}
  165. FILE_DEVICE_DISK = $00000007;
  166. {$EXTERNALSYM FILE_DEVICE_DISK}
  167. FILE_DEVICE_DISK_FILE_SYSTEM = $00000008;
  168. {$EXTERNALSYM FILE_DEVICE_DISK_FILE_SYSTEM}
  169. FILE_DEVICE_FILE_SYSTEM = $00000009;
  170. {$EXTERNALSYM FILE_DEVICE_FILE_SYSTEM}
  171. FILE_DEVICE_INPORT_PORT = $0000000a;
  172. {$EXTERNALSYM FILE_DEVICE_INPORT_PORT}
  173. FILE_DEVICE_KEYBOARD = $0000000b;
  174. {$EXTERNALSYM FILE_DEVICE_KEYBOARD}
  175. FILE_DEVICE_MAILSLOT = $0000000c;
  176. {$EXTERNALSYM FILE_DEVICE_MAILSLOT}
  177. FILE_DEVICE_MIDI_IN = $0000000d;
  178. {$EXTERNALSYM FILE_DEVICE_MIDI_IN}
  179. FILE_DEVICE_MIDI_OUT = $0000000e;
  180. {$EXTERNALSYM FILE_DEVICE_MIDI_OUT}
  181. FILE_DEVICE_MOUSE = $0000000f;
  182. {$EXTERNALSYM FILE_DEVICE_MOUSE}
  183. FILE_DEVICE_MULTI_UNC_PROVIDER = $00000010;
  184. {$EXTERNALSYM FILE_DEVICE_MULTI_UNC_PROVIDER}
  185. FILE_DEVICE_NAMED_PIPE = $00000011;
  186. {$EXTERNALSYM FILE_DEVICE_NAMED_PIPE}
  187. FILE_DEVICE_NETWORK = $00000012;
  188. {$EXTERNALSYM FILE_DEVICE_NETWORK}
  189. FILE_DEVICE_NETWORK_BROWSER = $00000013;
  190. {$EXTERNALSYM FILE_DEVICE_NETWORK_BROWSER}
  191. FILE_DEVICE_NETWORK_FILE_SYSTEM = $00000014;
  192. {$EXTERNALSYM FILE_DEVICE_NETWORK_FILE_SYSTEM}
  193. FILE_DEVICE_NULL = $00000015;
  194. {$EXTERNALSYM FILE_DEVICE_NULL}
  195. FILE_DEVICE_PARALLEL_PORT = $00000016;
  196. {$EXTERNALSYM FILE_DEVICE_PARALLEL_PORT}
  197. FILE_DEVICE_PHYSICAL_NETCARD = $00000017;
  198. {$EXTERNALSYM FILE_DEVICE_PHYSICAL_NETCARD}
  199. FILE_DEVICE_PRINTER = $00000018;
  200. {$EXTERNALSYM FILE_DEVICE_PRINTER}
  201. FILE_DEVICE_SCANNER = $00000019;
  202. {$EXTERNALSYM FILE_DEVICE_SCANNER}
  203. FILE_DEVICE_SERIAL_MOUSE_PORT = $0000001a;
  204. {$EXTERNALSYM FILE_DEVICE_SERIAL_MOUSE_PORT}
  205. FILE_DEVICE_SERIAL_PORT = $0000001b;
  206. {$EXTERNALSYM FILE_DEVICE_SERIAL_PORT}
  207. FILE_DEVICE_SCREEN = $0000001c;
  208. {$EXTERNALSYM FILE_DEVICE_SCREEN}
  209. FILE_DEVICE_SOUND = $0000001d;
  210. {$EXTERNALSYM FILE_DEVICE_SOUND}
  211. FILE_DEVICE_STREAMS = $0000001e;
  212. {$EXTERNALSYM FILE_DEVICE_STREAMS}
  213. FILE_DEVICE_TAPE = $0000001f;
  214. {$EXTERNALSYM FILE_DEVICE_TAPE}
  215. FILE_DEVICE_TAPE_FILE_SYSTEM = $00000020;
  216. {$EXTERNALSYM FILE_DEVICE_TAPE_FILE_SYSTEM}
  217. FILE_DEVICE_TRANSPORT = $00000021;
  218. {$EXTERNALSYM FILE_DEVICE_TRANSPORT}
  219. FILE_DEVICE_UNKNOWN = $00000022;
  220. {$EXTERNALSYM FILE_DEVICE_UNKNOWN}
  221. FILE_DEVICE_VIDEO = $00000023;
  222. {$EXTERNALSYM FILE_DEVICE_VIDEO}
  223. FILE_DEVICE_VIRTUAL_DISK = $00000024;
  224. {$EXTERNALSYM FILE_DEVICE_VIRTUAL_DISK}
  225. FILE_DEVICE_WAVE_IN = $00000025;
  226. {$EXTERNALSYM FILE_DEVICE_WAVE_IN}
  227. FILE_DEVICE_WAVE_OUT = $00000026;
  228. {$EXTERNALSYM FILE_DEVICE_WAVE_OUT}
  229. FILE_DEVICE_8042_PORT = $00000027;
  230. {$EXTERNALSYM FILE_DEVICE_8042_PORT}
  231. FILE_DEVICE_NETWORK_REDIRECTOR = $00000028;
  232. {$EXTERNALSYM FILE_DEVICE_NETWORK_REDIRECTOR}
  233. FILE_DEVICE_BATTERY = $00000029;
  234. {$EXTERNALSYM FILE_DEVICE_BATTERY}
  235. FILE_DEVICE_BUS_EXTENDER = $0000002a;
  236. {$EXTERNALSYM FILE_DEVICE_BUS_EXTENDER}
  237. FILE_DEVICE_MODEM = $0000002b;
  238. {$EXTERNALSYM FILE_DEVICE_MODEM}
  239. FILE_DEVICE_VDM = $0000002c;
  240. {$EXTERNALSYM FILE_DEVICE_VDM}
  241. FILE_DEVICE_MASS_STORAGE = $0000002d;
  242. {$EXTERNALSYM FILE_DEVICE_MASS_STORAGE}
  243. FILE_DEVICE_SMB = $0000002e;
  244. {$EXTERNALSYM FILE_DEVICE_SMB}
  245. FILE_DEVICE_KS = $0000002f;
  246. {$EXTERNALSYM FILE_DEVICE_KS}
  247. FILE_DEVICE_CHANGER = $00000030;
  248. {$EXTERNALSYM FILE_DEVICE_CHANGER}
  249. FILE_DEVICE_SMARTCARD = $00000031;
  250. {$EXTERNALSYM FILE_DEVICE_SMARTCARD}
  251. FILE_DEVICE_ACPI = $00000032;
  252. {$EXTERNALSYM FILE_DEVICE_ACPI}
  253. FILE_DEVICE_DVD = $00000033;
  254. {$EXTERNALSYM FILE_DEVICE_DVD}
  255. FILE_DEVICE_FULLSCREEN_VIDEO = $00000034;
  256. {$EXTERNALSYM FILE_DEVICE_FULLSCREEN_VIDEO}
  257. FILE_DEVICE_DFS_FILE_SYSTEM = $00000035;
  258. {$EXTERNALSYM FILE_DEVICE_DFS_FILE_SYSTEM}
  259. FILE_DEVICE_DFS_VOLUME = $00000036;
  260. {$EXTERNALSYM FILE_DEVICE_DFS_VOLUME}
  261. FILE_DEVICE_SERENUM = $00000037;
  262. {$EXTERNALSYM FILE_DEVICE_SERENUM}
  263. FILE_DEVICE_TERMSRV = $00000038;
  264. {$EXTERNALSYM FILE_DEVICE_TERMSRV}
  265. FILE_DEVICE_KSEC = $00000039;
  266. {$EXTERNALSYM FILE_DEVICE_KSEC}
  267. FILE_DEVICE_FIPS = $0000003A;
  268. {$EXTERNALSYM FILE_DEVICE_FIPS}
  269. FILE_DEVICE_INFINIBAND = $0000003B;
  270. {$EXTERNALSYM FILE_DEVICE_INFINIBAND}
  271. //
  272. // Macro definition for defining IOCTL and FSCTL function control codes. Note
  273. // that function codes 0-2047 are reserved for Microsoft Corporation, and
  274. // 2048-4095 are reserved for customers.
  275. //
  276. function CTL_CODE(DeviceType, Func, Method, Access: WORD): DWORD;
  277. {$EXTERNALSYM CTL_CODE}
  278. //
  279. // Macro to extract device type out of the device io control code
  280. //
  281. function DEVICE_TYPE_FROM_CTL_CODE(CtrlCode: DWORD): WORD;
  282. {$EXTERNALSYM DEVICE_TYPE_FROM_CTL_CODE}
  283. //
  284. // Define the method codes for how buffers are passed for I/O and FS controls
  285. //
  286. const
  287. METHOD_BUFFERED = 0;
  288. {$EXTERNALSYM METHOD_BUFFERED}
  289. METHOD_IN_DIRECT = 1;
  290. {$EXTERNALSYM METHOD_IN_DIRECT}
  291. METHOD_OUT_DIRECT = 2;
  292. {$EXTERNALSYM METHOD_OUT_DIRECT}
  293. METHOD_NEITHER = 3;
  294. {$EXTERNALSYM METHOD_NEITHER}
  295. //
  296. // Define some easier to comprehend aliases:
  297. // METHOD_DIRECT_TO_HARDWARE (writes, aka METHOD_IN_DIRECT)
  298. // METHOD_DIRECT_FROM_HARDWARE (reads, aka METHOD_OUT_DIRECT)
  299. //
  300. METHOD_DIRECT_TO_HARDWARE = METHOD_IN_DIRECT;
  301. {$EXTERNALSYM METHOD_DIRECT_TO_HARDWARE}
  302. METHOD_DIRECT_FROM_HARDWARE = METHOD_OUT_DIRECT;
  303. {$EXTERNALSYM METHOD_DIRECT_FROM_HARDWARE}
  304. //
  305. // Define the access check value for any access
  306. //
  307. //
  308. // The FILE_READ_ACCESS and FILE_WRITE_ACCESS constants are also defined in
  309. // ntioapi.h as FILE_READ_DATA and FILE_WRITE_DATA. The values for these
  310. // constants *MUST* always be in sync.
  311. //
  312. //
  313. // FILE_SPECIAL_ACCESS is checked by the NT I/O system the same as FILE_ANY_ACCESS.
  314. // The file systems, however, may add additional access checks for I/O and FS controls
  315. // that use this value.
  316. //
  317. const
  318. FILE_ANY_ACCESS = 0;
  319. {$EXTERNALSYM FILE_ANY_ACCESS}
  320. FILE_SPECIAL_ACCESS = FILE_ANY_ACCESS;
  321. {$EXTERNALSYM FILE_SPECIAL_ACCESS}
  322. FILE_READ_ACCESS = $0001; // file & pipe
  323. {$EXTERNALSYM FILE_READ_ACCESS}
  324. FILE_WRITE_ACCESS = $0002; // file & pipe
  325. {$EXTERNALSYM FILE_WRITE_ACCESS}
  326. //
  327. // IoControlCode values for storage devices
  328. //
  329. IOCTL_STORAGE_BASE = FILE_DEVICE_MASS_STORAGE;
  330. {$EXTERNALSYM IOCTL_STORAGE_BASE}
  331. //
  332. // The following device control codes are common for all class drivers. They
  333. // should be used in place of the older IOCTL_DISK, IOCTL_CDROM and IOCTL_TAPE
  334. // common codes
  335. //
  336. const
  337. IOCTL_STORAGE_CHECK_VERIFY = (
  338. (IOCTL_STORAGE_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  339. ($0200 shl 2) or METHOD_BUFFERED);
  340. {$EXTERNALSYM IOCTL_STORAGE_CHECK_VERIFY}
  341. IOCTL_STORAGE_CHECK_VERIFY2 = (
  342. (IOCTL_STORAGE_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  343. ($0200 shl 2) or METHOD_BUFFERED);
  344. {$EXTERNALSYM IOCTL_STORAGE_CHECK_VERIFY2}
  345. IOCTL_STORAGE_MEDIA_REMOVAL = (
  346. (IOCTL_STORAGE_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  347. ($0201 shl 2) or METHOD_BUFFERED);
  348. {$EXTERNALSYM IOCTL_STORAGE_MEDIA_REMOVAL}
  349. IOCTL_STORAGE_EJECT_MEDIA = (
  350. (IOCTL_STORAGE_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  351. ($0202 shl 2) or METHOD_BUFFERED);
  352. {$EXTERNALSYM IOCTL_STORAGE_EJECT_MEDIA}
  353. IOCTL_STORAGE_LOAD_MEDIA = (
  354. (IOCTL_STORAGE_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  355. ($0203 shl 2) or METHOD_BUFFERED);
  356. {$EXTERNALSYM IOCTL_STORAGE_LOAD_MEDIA}
  357. IOCTL_STORAGE_LOAD_MEDIA2 = (
  358. (IOCTL_STORAGE_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  359. ($0203 shl 2) or METHOD_BUFFERED);
  360. {$EXTERNALSYM IOCTL_STORAGE_LOAD_MEDIA2}
  361. IOCTL_STORAGE_RESERVE = (
  362. (IOCTL_STORAGE_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  363. ($0204 shl 2) or METHOD_BUFFERED);
  364. {$EXTERNALSYM IOCTL_STORAGE_RESERVE}
  365. IOCTL_STORAGE_RELEASE = (
  366. (IOCTL_STORAGE_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  367. ($0205 shl 2) or METHOD_BUFFERED);
  368. {$EXTERNALSYM IOCTL_STORAGE_RELEASE}
  369. IOCTL_STORAGE_FIND_NEW_DEVICES = (
  370. (IOCTL_STORAGE_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  371. ($0206 shl 2) or METHOD_BUFFERED);
  372. {$EXTERNALSYM IOCTL_STORAGE_FIND_NEW_DEVICES}
  373. IOCTL_STORAGE_EJECTION_CONTROL = (
  374. (IOCTL_STORAGE_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  375. ($0250 shl 2) or METHOD_BUFFERED);
  376. {$EXTERNALSYM IOCTL_STORAGE_EJECTION_CONTROL}
  377. IOCTL_STORAGE_MCN_CONTROL = (
  378. (IOCTL_STORAGE_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  379. ($0251 shl 2) or METHOD_BUFFERED);
  380. {$EXTERNALSYM IOCTL_STORAGE_MCN_CONTROL}
  381. IOCTL_STORAGE_GET_MEDIA_TYPES = (
  382. (IOCTL_STORAGE_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  383. ($0300 shl 2) or METHOD_BUFFERED);
  384. {$EXTERNALSYM IOCTL_STORAGE_GET_MEDIA_TYPES}
  385. IOCTL_STORAGE_GET_MEDIA_TYPES_EX = (
  386. (IOCTL_STORAGE_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  387. ($0301 shl 2) or METHOD_BUFFERED);
  388. {$EXTERNALSYM IOCTL_STORAGE_GET_MEDIA_TYPES_EX}
  389. IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER = (
  390. (IOCTL_STORAGE_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  391. ($0304 shl 2) or METHOD_BUFFERED);
  392. {$EXTERNALSYM IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER}
  393. IOCTL_STORAGE_GET_HOTPLUG_INFO = (
  394. (IOCTL_STORAGE_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  395. ($0305 shl 2) or METHOD_BUFFERED);
  396. {$EXTERNALSYM IOCTL_STORAGE_GET_HOTPLUG_INFO}
  397. IOCTL_STORAGE_SET_HOTPLUG_INFO = (
  398. (IOCTL_STORAGE_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  399. ($0306 shl 2) or METHOD_BUFFERED);
  400. {$EXTERNALSYM IOCTL_STORAGE_SET_HOTPLUG_INFO}
  401. IOCTL_STORAGE_RESET_BUS = (
  402. (IOCTL_STORAGE_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  403. ($0400 shl 2) or METHOD_BUFFERED);
  404. {$EXTERNALSYM IOCTL_STORAGE_RESET_BUS}
  405. IOCTL_STORAGE_RESET_DEVICE = (
  406. (IOCTL_STORAGE_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  407. ($0401 shl 2) or METHOD_BUFFERED);
  408. {$EXTERNALSYM IOCTL_STORAGE_RESET_DEVICE}
  409. IOCTL_STORAGE_BREAK_RESERVATION = (
  410. (IOCTL_STORAGE_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  411. ($0405 shl 2) or METHOD_BUFFERED);
  412. {$EXTERNALSYM IOCTL_STORAGE_BREAK_RESERVATION}
  413. IOCTL_STORAGE_GET_DEVICE_NUMBER = (
  414. (IOCTL_STORAGE_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  415. ($0420 shl 2) or METHOD_BUFFERED);
  416. {$EXTERNALSYM IOCTL_STORAGE_GET_DEVICE_NUMBER}
  417. IOCTL_STORAGE_PREDICT_FAILURE = (
  418. (IOCTL_STORAGE_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  419. ($0440 shl 2) or METHOD_BUFFERED);
  420. {$EXTERNALSYM IOCTL_STORAGE_PREDICT_FAILURE}
  421. //
  422. // These ioctl codes are obsolete. They are defined here to avoid resuing them
  423. // and to allow class drivers to respond to them more easily.
  424. //
  425. OBSOLETE_IOCTL_STORAGE_RESET_BUS = (
  426. (IOCTL_STORAGE_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  427. ($0400 shl 2) or METHOD_BUFFERED);
  428. {$EXTERNALSYM OBSOLETE_IOCTL_STORAGE_RESET_BUS}
  429. OBSOLETE_IOCTL_STORAGE_RESET_DEVICE = (
  430. (IOCTL_STORAGE_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  431. ($0401 shl 2) or METHOD_BUFFERED);
  432. {$EXTERNALSYM OBSOLETE_IOCTL_STORAGE_RESET_DEVICE}
  433. //
  434. // IOCTL_STORAGE_GET_HOTPLUG_INFO
  435. //
  436. type
  437. PSTORAGE_HOTPLUG_INFO = ^STORAGE_HOTPLUG_INFO;
  438. {$EXTERNALSYM PSTORAGE_HOTPLUG_INFO}
  439. _STORAGE_HOTPLUG_INFO = record
  440. Size: DWORD; // version
  441. MediaRemovable: BOOLEAN; // ie. zip, jaz, cdrom, mo, etc. vs hdd
  442. MediaHotplug: BOOLEAN; // ie. does the device succeed a lock even though its not lockable media?
  443. DeviceHotplug: BOOLEAN; // ie. 1394, USB, etc.
  444. WriteCacheEnableOverride: BOOLEAN; // This field should not be relied upon because it is no longer used
  445. end;
  446. {$EXTERNALSYM _STORAGE_HOTPLUG_INFO}
  447. STORAGE_HOTPLUG_INFO = _STORAGE_HOTPLUG_INFO;
  448. {$EXTERNALSYM STORAGE_HOTPLUG_INFO}
  449. TStorageHotplugInfo = STORAGE_HOTPLUG_INFO;
  450. PStorageHotplugInfo = PSTORAGE_HOTPLUG_INFO;
  451. //
  452. // IOCTL_STORAGE_GET_DEVICE_NUMBER
  453. //
  454. // input - none
  455. //
  456. // output - STORAGE_DEVICE_NUMBER structure
  457. // The values in the STORAGE_DEVICE_NUMBER structure are guaranteed
  458. // to remain unchanged until the system is rebooted. They are not
  459. // guaranteed to be persistant across boots.
  460. //
  461. type
  462. PSTORAGE_DEVICE_NUMBER = ^STORAGE_DEVICE_NUMBER;
  463. {$EXTERNALSYM PSTORAGE_DEVICE_NUMBER}
  464. _STORAGE_DEVICE_NUMBER = record
  465. //
  466. // The FILE_DEVICE_XXX type for this device.
  467. //
  468. DeviceType: DEVICE_TYPE;
  469. //
  470. // The number of this device
  471. //
  472. DeviceNumber: DWORD;
  473. //
  474. // If the device is partitionable, the partition number of the device.
  475. // Otherwise -1
  476. //
  477. PartitionNumber: DWORD;
  478. end;
  479. {$EXTERNALSYM _STORAGE_DEVICE_NUMBER}
  480. STORAGE_DEVICE_NUMBER = _STORAGE_DEVICE_NUMBER;
  481. {$EXTERNALSYM STORAGE_DEVICE_NUMBER}
  482. TStorageDeviceNumber = STORAGE_DEVICE_NUMBER;
  483. PStorageDeviceNumber = PSTORAGE_DEVICE_NUMBER;
  484. //
  485. // Define the structures for scsi resets
  486. //
  487. PSTORAGE_BUS_RESET_REQUEST = ^STORAGE_BUS_RESET_REQUEST;
  488. {$EXTERNALSYM PSTORAGE_BUS_RESET_REQUEST}
  489. _STORAGE_BUS_RESET_REQUEST = record
  490. PathId: BYTE;
  491. end;
  492. {$EXTERNALSYM _STORAGE_BUS_RESET_REQUEST}
  493. STORAGE_BUS_RESET_REQUEST = _STORAGE_BUS_RESET_REQUEST;
  494. {$EXTERNALSYM STORAGE_BUS_RESET_REQUEST}
  495. TStorageBusResetRequest = STORAGE_BUS_RESET_REQUEST;
  496. PStorageBusResetRequest = PSTORAGE_BUS_RESET_REQUEST;
  497. //
  498. // Break reservation is sent to the Adapter/FDO with the given lun information.
  499. //
  500. STORAGE_BREAK_RESERVATION_REQUEST = record
  501. Length: DWORD;
  502. _unused: Byte;
  503. PathId: Byte;
  504. TargetId: Byte;
  505. Lun: Byte;
  506. end;
  507. {$EXTERNALSYM STORAGE_BREAK_RESERVATION_REQUEST}
  508. PSTORAGE_BREAK_RESERVATION_REQUEST = ^STORAGE_BREAK_RESERVATION_REQUEST;
  509. {$EXTERNALSYM PSTORAGE_BREAK_RESERVATION_REQUEST}
  510. TStorageBreakReservationRequest = STORAGE_BREAK_RESERVATION_REQUEST;
  511. PStorageBreakReservationRequest = PSTORAGE_BREAK_RESERVATION_REQUEST;
  512. //
  513. // IOCTL_STORAGE_MEDIA_REMOVAL disables the mechanism
  514. // on a storage device that ejects media. This function
  515. // may or may not be supported on storage devices that
  516. // support removable media.
  517. //
  518. // TRUE means prevent media from being removed.
  519. // FALSE means allow media removal.
  520. //
  521. PPREVENT_MEDIA_REMOVAL = ^PREVENT_MEDIA_REMOVAL;
  522. {$EXTERNALSYM PPREVENT_MEDIA_REMOVAL}
  523. _PREVENT_MEDIA_REMOVAL = record
  524. PreventMediaRemoval: ByteBool;
  525. end;
  526. {$EXTERNALSYM _PREVENT_MEDIA_REMOVAL}
  527. PREVENT_MEDIA_REMOVAL = _PREVENT_MEDIA_REMOVAL;
  528. {$EXTERNALSYM PREVENT_MEDIA_REMOVAL}
  529. TPreventMediaRemoval = PREVENT_MEDIA_REMOVAL;
  530. PPreventMediaRemoval = PPREVENT_MEDIA_REMOVAL;
  531. //
  532. // This is the format of TARGET_DEVICE_CUSTOM_NOTIFICATION.CustomDataBuffer
  533. // passed to applications by the classpnp autorun code (via IoReportTargetDeviceChangeAsynchronous).
  534. //
  535. _CLASS_MEDIA_CHANGE_CONTEXT = record
  536. MediaChangeCount: DWORD;
  537. NewState: DWORD; // see MEDIA_CHANGE_DETECTION_STATE enum in classpnp.h in DDK
  538. end;
  539. {$EXTERNALSYM _CLASS_MEDIA_CHANGE_CONTEXT}
  540. CLASS_MEDIA_CHANGE_CONTEXT = _CLASS_MEDIA_CHANGE_CONTEXT;
  541. {$EXTERNALSYM CLASS_MEDIA_CHANGE_CONTEXT}
  542. PCLASS_MEDIA_CHANGE_CONTEXT = ^CLASS_MEDIA_CHANGE_CONTEXT;
  543. {$EXTERNALSYM PCLASS_MEDIA_CHANGE_CONTEXT}
  544. TClassMediaChangeContext = CLASS_MEDIA_CHANGE_CONTEXT;
  545. PClassMediaChangeContext = PCLASS_MEDIA_CHANGE_CONTEXT;
  546. PTAPE_STATISTICS = ^TAPE_STATISTICS;
  547. {$EXTERNALSYM PTAPE_STATISTICS}
  548. _TAPE_STATISTICS = record
  549. Version: DWORD;
  550. Flags: DWORD;
  551. RecoveredWrites: LARGE_INTEGER;
  552. UnrecoveredWrites: LARGE_INTEGER;
  553. RecoveredReads: LARGE_INTEGER;
  554. UnrecoveredReads: LARGE_INTEGER;
  555. CompressionRatioReads: BYTE;
  556. CompressionRatioWrites: BYTE;
  557. end;
  558. {$EXTERNALSYM _TAPE_STATISTICS}
  559. TAPE_STATISTICS = _TAPE_STATISTICS;
  560. {$EXTERNALSYM TAPE_STATISTICS}
  561. TTapeStatistics = TAPE_STATISTICS;
  562. PTapeStatistics = PTAPE_STATISTICS;
  563. const
  564. RECOVERED_WRITES_VALID = $00000001;
  565. {$EXTERNALSYM RECOVERED_WRITES_VALID}
  566. UNRECOVERED_WRITES_VALID = $00000002;
  567. {$EXTERNALSYM UNRECOVERED_WRITES_VALID}
  568. RECOVERED_READS_VALID = $00000004;
  569. {$EXTERNALSYM RECOVERED_READS_VALID}
  570. UNRECOVERED_READS_VALID = $00000008;
  571. {$EXTERNALSYM UNRECOVERED_READS_VALID}
  572. WRITE_COMPRESSION_INFO_VALID = $00000010;
  573. {$EXTERNALSYM WRITE_COMPRESSION_INFO_VALID}
  574. READ_COMPRESSION_INFO_VALID = $00000020;
  575. {$EXTERNALSYM READ_COMPRESSION_INFO_VALID}
  576. type
  577. PTAPE_GET_STATISTICS = ^TAPE_GET_STATISTICS;
  578. {$EXTERNALSYM PTAPE_GET_STATISTICS}
  579. _TAPE_GET_STATISTICS = record
  580. Operation: DWORD;
  581. end;
  582. {$EXTERNALSYM _TAPE_GET_STATISTICS}
  583. TAPE_GET_STATISTICS = _TAPE_GET_STATISTICS;
  584. {$EXTERNALSYM TAPE_GET_STATISTICS}
  585. TTapeGetStatistics = TAPE_GET_STATISTICS;
  586. PTapeGetStatistics = PTAPE_GET_STATISTICS;
  587. const
  588. TAPE_RETURN_STATISTICS = 0;
  589. {$EXTERNALSYM TAPE_RETURN_STATISTICS}
  590. TAPE_RETURN_ENV_INFO = 1;
  591. {$EXTERNALSYM TAPE_RETURN_ENV_INFO}
  592. TAPE_RESET_STATISTICS = 2;
  593. {$EXTERNALSYM TAPE_RESET_STATISTICS}
  594. //
  595. // IOCTL_STORAGE_GET_MEDIA_TYPES_EX will return an array of DEVICE_MEDIA_INFO
  596. // structures, one per supported type, embedded in the GET_MEDIA_TYPES struct.
  597. //
  598. const
  599. //
  600. // Following are defined in ntdddisk.h in the MEDIA_TYPE enum
  601. //
  602. // Unknown, // Format is unknown
  603. // F5_1Pt2_512, // 5.25", 1.2MB, 512 bytes/sector
  604. // F3_1Pt44_512, // 3.5", 1.44MB, 512 bytes/sector
  605. // F3_2Pt88_512, // 3.5", 2.88MB, 512 bytes/sector
  606. // F3_20Pt8_512, // 3.5", 20.8MB, 512 bytes/sector
  607. // F3_720_512, // 3.5", 720KB, 512 bytes/sector
  608. // F5_360_512, // 5.25", 360KB, 512 bytes/sector
  609. // F5_320_512, // 5.25", 320KB, 512 bytes/sector
  610. // F5_320_1024, // 5.25", 320KB, 1024 bytes/sector
  611. // F5_180_512, // 5.25", 180KB, 512 bytes/sector
  612. // F5_160_512, // 5.25", 160KB, 512 bytes/sector
  613. // RemovableMedia, // Removable media other than floppy
  614. // FixedMedia, // Fixed hard disk media
  615. // F3_120M_512, // 3.5", 120M Floppy
  616. // F3_640_512, // 3.5" , 640KB, 512 bytes/sector
  617. // F5_640_512, // 5.25", 640KB, 512 bytes/sector
  618. // F5_720_512, // 5.25", 720KB, 512 bytes/sector
  619. // F3_1Pt2_512, // 3.5" , 1.2Mb, 512 bytes/sector
  620. // F3_1Pt23_1024, // 3.5" , 1.23Mb, 1024 bytes/sector
  621. // F5_1Pt23_1024, // 5.25", 1.23MB, 1024 bytes/sector
  622. // F3_128Mb_512, // 3.5" MO 128Mb 512 bytes/sector
  623. // F3_230Mb_512, // 3.5" MO 230Mb 512 bytes/sector
  624. // F8_256_128, // 8", 256KB, 128 bytes/sector
  625. // F3_200Mb_512, // 3.5", 200M Floppy (HiFD)
  626. //
  627. DDS_4mm = $20; // Tape - DAT DDS1,2,... (all vendors)
  628. MiniQic = $21; // Tape - miniQIC Tape
  629. Travan = $22; // Tape - Travan TR-1,2,3,...
  630. QIC = $23; // Tape - QIC
  631. MP_8mm = $24; // Tape - 8mm Exabyte Metal Particle
  632. AME_8mm = $25; // Tape - 8mm Exabyte Advanced Metal Evap
  633. AIT1_8mm = $26; // Tape - 8mm Sony AIT
  634. DLT = $27; // Tape - DLT Compact IIIxt, IV
  635. NCTP = $28; // Tape - Philips NCTP
  636. IBM_3480 = $29; // Tape - IBM 3480
  637. IBM_3490E = $2A; // Tape - IBM 3490E
  638. IBM_Magstar_3590 = $2B; // Tape - IBM Magstar 3590
  639. IBM_Magstar_MP = $2C; // Tape - IBM Magstar MP
  640. STK_DATA_D3 = $2D; // Tape - STK Data D3
  641. SONY_DTF = $2E; // Tape - Sony DTF
  642. DV_6mm = $2F; // Tape - 6mm Digital Video
  643. DMI = $30; // Tape - Exabyte DMI and compatibles
  644. SONY_D2 = $31; // Tape - Sony D2S and D2L
  645. CLEANER_CARTRIDGE = $32; // Cleaner - All Drive types that support Drive Cleaners
  646. CD_ROM = $33; // Opt_Disk - CD
  647. CD_R = $34; // Opt_Disk - CD-Recordable (Write Once)
  648. CD_RW = $35; // Opt_Disk - CD-Rewriteable
  649. DVD_ROM = $36; // Opt_Disk - DVD-ROM
  650. DVD_R = $37; // Opt_Disk - DVD-Recordable (Write Once)
  651. DVD_RW = $38; // Opt_Disk - DVD-Rewriteable
  652. MO_3_RW = $39; // Opt_Disk - 3.5" Rewriteable MO Disk
  653. MO_5_WO = $3A; // Opt_Disk - MO 5.25" Write Once
  654. MO_5_RW = $3B; // Opt_Disk - MO 5.25" Rewriteable (not LIMDOW)
  655. MO_5_LIMDOW = $3C; // Opt_Disk - MO 5.25" Rewriteable (LIMDOW)
  656. PC_5_WO = $3D; // Opt_Disk - Phase Change 5.25" Write Once Optical
  657. PC_5_RW = $3E; // Opt_Disk - Phase Change 5.25" Rewriteable
  658. PD_5_RW = $3F; // Opt_Disk - PhaseChange Dual Rewriteable
  659. ABL_5_WO = $40; // Opt_Disk - Ablative 5.25" Write Once Optical
  660. PINNACLE_APEX_5_RW = $41; // Opt_Disk - Pinnacle Apex 4.6GB Rewriteable Optical
  661. SONY_12_WO = $42; // Opt_Disk - Sony 12" Write Once
  662. PHILIPS_12_WO = $43; // Opt_Disk - Philips/LMS 12" Write Once
  663. HITACHI_12_WO = $44; // Opt_Disk - Hitachi 12" Write Once
  664. CYGNET_12_WO = $45; // Opt_Disk - Cygnet/ATG 12" Write Once
  665. KODAK_14_WO = $46; // Opt_Disk - Kodak 14" Write Once
  666. MO_NFR_525 = $47; // Opt_Disk - Near Field Recording (Terastor)
  667. NIKON_12_RW = $48; // Opt_Disk - Nikon 12" Rewriteable
  668. IOMEGA_ZIP = $49; // Mag_Disk - Iomega Zip
  669. IOMEGA_JAZ = $4A; // Mag_Disk - Iomega Jaz
  670. SYQUEST_EZ135 = $4B; // Mag_Disk - Syquest EZ135
  671. SYQUEST_EZFLYER = $4C; // Mag_Disk - Syquest EzFlyer
  672. SYQUEST_SYJET = $4D; // Mag_Disk - Syquest SyJet
  673. AVATAR_F2 = $4E; // Mag_Disk - 2.5" Floppy
  674. MP2_8mm = $4F; // Tape - 8mm Hitachi
  675. DST_S = $50; // Ampex DST Small Tapes
  676. DST_M = $51; // Ampex DST Medium Tapes
  677. DST_L = $52; // Ampex DST Large Tapes
  678. VXATape_1 = $53; // Ecrix 8mm Tape
  679. VXATape_2 = $54; // Ecrix 8mm Tape
  680. STK_9840 = $55; // STK 9840
  681. LTO_Ultrium = $56; // IBM, HP, Seagate LTO Ultrium
  682. LTO_Accelis = $57; // IBM, HP, Seagate LTO Accelis
  683. DVD_RAM = $58; // Opt_Disk - DVD-RAM
  684. AIT_8mm = $59; // AIT2 or higher
  685. ADR_1 = $5A; // OnStream ADR Mediatypes
  686. ADR_2 = $5B;
  687. STK_9940 = $5C; // STK 9940
  688. type
  689. STORAGE_MEDIA_TYPE = DWORD;
  690. {$EXTERNALSYM STORAGE_MEDIA_TYPE}
  691. PSTORAGE_MEDIA_TYPE = ^STORAGE_MEDIA_TYPE;
  692. {$EXTERNALSYM PSTORAGE_MEDIA_TYPE}
  693. TStorageMediaType = STORAGE_MEDIA_TYPE;
  694. PStorageMediaType = ^TStorageMediaType;
  695. const
  696. MEDIA_ERASEABLE = $00000001;
  697. {$EXTERNALSYM MEDIA_ERASEABLE}
  698. MEDIA_WRITE_ONCE = $00000002;
  699. {$EXTERNALSYM MEDIA_WRITE_ONCE}
  700. MEDIA_READ_ONLY = $00000004;
  701. {$EXTERNALSYM MEDIA_READ_ONLY}
  702. MEDIA_READ_WRITE = $00000008;
  703. {$EXTERNALSYM MEDIA_READ_WRITE}
  704. MEDIA_WRITE_PROTECTED = $00000100;
  705. {$EXTERNALSYM MEDIA_WRITE_PROTECTED}
  706. MEDIA_CURRENTLY_MOUNTED = DWORD($80000000);
  707. {$EXTERNALSYM MEDIA_CURRENTLY_MOUNTED}
  708. //
  709. // Define the different storage bus types
  710. // Bus types below 128 (0x80) are reserved for Microsoft use
  711. //
  712. const
  713. BusTypeUnknown = 0;
  714. BusTypeScsi = 1;
  715. BusTypeAtapi = 2;
  716. BusTypeAta = 3;
  717. BusType1394 = 4;
  718. BusTypeSsa = 5;
  719. BusTypeFibre = 6;
  720. BusTypeUsb = 7;
  721. BusTypeRAID = 8;
  722. BusTypeMaxReserved = $7F;
  723. type
  724. STORAGE_BUS_TYPE = DWORD;
  725. {$EXTERNALSYM STORAGE_BUS_TYPE}
  726. PSTORAGE_BUS_TYPE = ^STORAGE_BUS_TYPE;
  727. {$EXTERNALSYM PSTORAGE_BUS_TYPE}
  728. TStorageBusType = STORAGE_BUS_TYPE;
  729. PStorageBusType = PSTORAGE_BUS_TYPE;
  730. TDMIDiskInfo = record
  731. Cylinders: LARGE_INTEGER;
  732. MediaType: STORAGE_MEDIA_TYPE;
  733. TracksPerCylinder: DWORD;
  734. SectorsPerTrack: DWORD;
  735. BytesPerSector: DWORD;
  736. NumberMediaSides: DWORD;
  737. MediaCharacteristics: DWORD; // Bitmask of MEDIA_XXX values.
  738. end;
  739. TDMIRemovableDiskInfo = record
  740. Cylinders: LARGE_INTEGER;
  741. MediaType: STORAGE_MEDIA_TYPE;
  742. TracksPerCylinder: DWORD;
  743. SectorsPerTrack: DWORD;
  744. BytesPerSector: DWORD;
  745. NumberMediaSides: DWORD;
  746. MediaCharacteristics: DWORD; // Bitmask of MEDIA_XXX values.
  747. end;
  748. TDMITapeInfo = record
  749. MediaType: STORAGE_MEDIA_TYPE;
  750. MediaCharacteristics: DWORD; // Bitmask of MEDIA_XXX values.
  751. CurrentBlockSize: DWORD;
  752. BusType: STORAGE_BUS_TYPE;
  753. //
  754. // Bus specific information describing the medium supported.
  755. //
  756. case Integer of {BusSpecificData}
  757. 0: ( {ScsiInformation}
  758. MediumType: BYTE;
  759. DensityCode: BYTE);
  760. end;
  761. PDEVICE_MEDIA_INFO = ^DEVICE_MEDIA_INFO;
  762. {$EXTERNALSYM PDEVICE_MEDIA_INFO}
  763. _DEVICE_MEDIA_INFO = record
  764. case Integer of
  765. 0: (DiskInfo: TDMIDiskInfo);
  766. 1: (RemovableDiskInfo: TDMIRemovableDiskInfo);
  767. 2: (TapeInfo: TDMITapeInfo);
  768. end;
  769. {$EXTERNALSYM _DEVICE_MEDIA_INFO}
  770. DEVICE_MEDIA_INFO = _DEVICE_MEDIA_INFO;
  771. {$EXTERNALSYM DEVICE_MEDIA_INFO}
  772. TDeviceMediaInfo = DEVICE_MEDIA_INFO;
  773. PDeviceMediaInfo = PDEVICE_MEDIA_INFO;
  774. PGET_MEDIA_TYPES = ^GET_MEDIA_TYPES;
  775. {$EXTERNALSYM PGET_MEDIA_TYPES}
  776. _GET_MEDIA_TYPES = record
  777. DeviceType: DWORD; // FILE_DEVICE_XXX values
  778. MediaInfoCount: DWORD;
  779. MediaInfo: array [0..0] of DEVICE_MEDIA_INFO;
  780. end;
  781. {$EXTERNALSYM _GET_MEDIA_TYPES}
  782. GET_MEDIA_TYPES = _GET_MEDIA_TYPES;
  783. {$EXTERNALSYM GET_MEDIA_TYPES}
  784. TGetMediaTypes = GET_MEDIA_TYPES;
  785. PGetMediaTypes = PGET_MEDIA_TYPES;
  786. //
  787. // IOCTL_STORAGE_PREDICT_FAILURE
  788. //
  789. // input - none
  790. //
  791. // output - STORAGE_PREDICT_FAILURE structure
  792. // PredictFailure returns zero if no failure predicted and non zero
  793. // if a failure is predicted.
  794. //
  795. // VendorSpecific returns 512 bytes of vendor specific information
  796. // if a failure is predicted
  797. //
  798. PSTORAGE_PREDICT_FAILURE = ^STORAGE_PREDICT_FAILURE;
  799. {$EXTERNALSYM PSTORAGE_PREDICT_FAILURE}
  800. _STORAGE_PREDICT_FAILURE = record
  801. PredictFailure: DWORD;
  802. VendorSpecific: array [0..511] of BYTE;
  803. end;
  804. {$EXTERNALSYM _STORAGE_PREDICT_FAILURE}
  805. STORAGE_PREDICT_FAILURE = _STORAGE_PREDICT_FAILURE;
  806. {$EXTERNALSYM STORAGE_PREDICT_FAILURE}
  807. TStoragePredictFailure = STORAGE_PREDICT_FAILURE;
  808. PStoragePredictFailure = PSTORAGE_PREDICT_FAILURE;
  809. //
  810. // IoControlCode values for disk devices.
  811. //
  812. const
  813. IOCTL_DISK_BASE = FILE_DEVICE_DISK;
  814. {$EXTERNALSYM IOCTL_DISK_BASE}
  815. IOCTL_DISK_GET_DRIVE_GEOMETRY = (
  816. (IOCTL_DISK_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  817. ($0000 shl 2) or METHOD_BUFFERED);
  818. {$EXTERNALSYM IOCTL_DISK_GET_DRIVE_GEOMETRY}
  819. IOCTL_DISK_GET_PARTITION_INFO = (
  820. (IOCTL_DISK_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  821. ($0001 shl 2) or METHOD_BUFFERED);
  822. {$EXTERNALSYM IOCTL_DISK_GET_PARTITION_INFO}
  823. IOCTL_DISK_SET_PARTITION_INFO = (
  824. (IOCTL_DISK_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  825. ($0002 shl 2) or METHOD_BUFFERED);
  826. {$EXTERNALSYM IOCTL_DISK_SET_PARTITION_INFO}
  827. IOCTL_DISK_GET_DRIVE_LAYOUT = (
  828. (IOCTL_DISK_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  829. ($0003 shl 2) or METHOD_BUFFERED);
  830. {$EXTERNALSYM IOCTL_DISK_GET_DRIVE_LAYOUT}
  831. IOCTL_DISK_SET_DRIVE_LAYOUT = (
  832. (IOCTL_DISK_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  833. ($0004 shl 2) or METHOD_BUFFERED);
  834. {$EXTERNALSYM IOCTL_DISK_SET_DRIVE_LAYOUT}
  835. IOCTL_DISK_VERIFY = (
  836. (IOCTL_DISK_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  837. ($0005 shl 2) or METHOD_BUFFERED);
  838. {$EXTERNALSYM IOCTL_DISK_VERIFY}
  839. IOCTL_DISK_FORMAT_TRACKS = (
  840. (IOCTL_DISK_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  841. ($0006 shl 2) or METHOD_BUFFERED);
  842. {$EXTERNALSYM IOCTL_DISK_FORMAT_TRACKS}
  843. IOCTL_DISK_REASSIGN_BLOCKS = (
  844. (IOCTL_DISK_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  845. ($0007 shl 2) or METHOD_BUFFERED);
  846. {$EXTERNALSYM IOCTL_DISK_REASSIGN_BLOCKS}
  847. IOCTL_DISK_PERFORMANCE = (
  848. (IOCTL_DISK_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  849. ($0008 shl 2) or METHOD_BUFFERED);
  850. {$EXTERNALSYM IOCTL_DISK_PERFORMANCE}
  851. IOCTL_DISK_IS_WRITABLE = (
  852. (IOCTL_DISK_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  853. ($0009 shl 2) or METHOD_BUFFERED);
  854. {$EXTERNALSYM IOCTL_DISK_IS_WRITABLE}
  855. IOCTL_DISK_LOGGING = (
  856. (IOCTL_DISK_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  857. ($000a shl 2) or METHOD_BUFFERED);
  858. {$EXTERNALSYM IOCTL_DISK_LOGGING}
  859. IOCTL_DISK_FORMAT_TRACKS_EX = (
  860. (IOCTL_DISK_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  861. ($000b shl 2) or METHOD_BUFFERED);
  862. {$EXTERNALSYM IOCTL_DISK_FORMAT_TRACKS_EX}
  863. IOCTL_DISK_HISTOGRAM_STRUCTURE = (
  864. (IOCTL_DISK_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  865. ($000c shl 2) or METHOD_BUFFERED);
  866. {$EXTERNALSYM IOCTL_DISK_HISTOGRAM_STRUCTURE}
  867. IOCTL_DISK_HISTOGRAM_DATA = (
  868. (IOCTL_DISK_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  869. ($000d shl 2) or METHOD_BUFFERED);
  870. {$EXTERNALSYM IOCTL_DISK_HISTOGRAM_DATA}
  871. IOCTL_DISK_HISTOGRAM_RESET = (
  872. (IOCTL_DISK_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  873. ($000e shl 2) or METHOD_BUFFERED);
  874. {$EXTERNALSYM IOCTL_DISK_HISTOGRAM_RESET}
  875. IOCTL_DISK_REQUEST_STRUCTURE = (
  876. (IOCTL_DISK_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  877. ($000f shl 2) or METHOD_BUFFERED);
  878. {$EXTERNALSYM IOCTL_DISK_REQUEST_STRUCTURE}
  879. IOCTL_DISK_REQUEST_DATA = (
  880. (IOCTL_DISK_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  881. ($0010 shl 2) or METHOD_BUFFERED);
  882. {$EXTERNALSYM IOCTL_DISK_REQUEST_DATA}
  883. IOCTL_DISK_PERFORMANCE_OFF = (
  884. (IOCTL_DISK_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  885. ($0018 shl 2) or METHOD_BUFFERED);
  886. {$EXTERNALSYM IOCTL_DISK_PERFORMANCE_OFF}
  887. IOCTL_DISK_CONTROLLER_NUMBER = (
  888. (IOCTL_DISK_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  889. ($0011 shl 2) or METHOD_BUFFERED);
  890. {$EXTERNALSYM IOCTL_DISK_CONTROLLER_NUMBER}
  891. //
  892. // IOCTL support for SMART drive fault prediction.
  893. //
  894. SMART_GET_VERSION = (
  895. (IOCTL_DISK_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  896. ($0020 shl 2) or METHOD_BUFFERED);
  897. {$EXTERNALSYM SMART_GET_VERSION}
  898. SMART_SEND_DRIVE_COMMAND = (
  899. (IOCTL_DISK_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  900. ($0021 shl 2) or METHOD_BUFFERED);
  901. {$EXTERNALSYM SMART_SEND_DRIVE_COMMAND}
  902. SMART_RCV_DRIVE_DATA = (
  903. (IOCTL_DISK_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  904. ($0022 shl 2) or METHOD_BUFFERED);
  905. {$EXTERNALSYM SMART_RCV_DRIVE_DATA}
  906. //
  907. // New IOCTLs for GUID Partition tabled disks.
  908. //
  909. // 23-11-2002: various bugs reported by Carsten Grafflage corrected
  910. IOCTL_DISK_GET_PARTITION_INFO_EX = (
  911. (IOCTL_DISK_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  912. ($0012 shl 2) or METHOD_BUFFERED);
  913. {$EXTERNALSYM IOCTL_DISK_GET_PARTITION_INFO_EX}
  914. IOCTL_DISK_SET_PARTITION_INFO_EX = (
  915. (IOCTL_DISK_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  916. ($0013 shl 2) or METHOD_BUFFERED);
  917. {$EXTERNALSYM IOCTL_DISK_SET_PARTITION_INFO_EX}
  918. IOCTL_DISK_GET_DRIVE_LAYOUT_EX = (
  919. (IOCTL_DISK_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  920. ($0014 shl 2) or METHOD_BUFFERED);
  921. {$EXTERNALSYM IOCTL_DISK_GET_DRIVE_LAYOUT_EX}
  922. IOCTL_DISK_SET_DRIVE_LAYOUT_EX = (
  923. (IOCTL_DISK_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  924. ($0015 shl 2) or METHOD_BUFFERED);
  925. {$EXTERNALSYM IOCTL_DISK_SET_DRIVE_LAYOUT_EX}
  926. IOCTL_DISK_CREATE_DISK = (
  927. (IOCTL_DISK_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  928. ($0016 shl 2) or METHOD_BUFFERED);
  929. {$EXTERNALSYM IOCTL_DISK_CREATE_DISK}
  930. IOCTL_DISK_GET_LENGTH_INFO = (
  931. (IOCTL_DISK_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  932. ($0017 shl 2) or METHOD_BUFFERED);
  933. {$EXTERNALSYM IOCTL_DISK_GET_LENGTH_INFO}
  934. IOCTL_DISK_GET_DRIVE_GEOMETRY_EX = (
  935. (IOCTL_DISK_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  936. ($0028 shl 2) or METHOD_BUFFERED);
  937. {$EXTERNALSYM IOCTL_DISK_GET_DRIVE_GEOMETRY_EX}
  938. IOCTL_DISK_UPDATE_DRIVE_SIZE = (
  939. (IOCTL_DISK_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  940. ($0032 shl 2) or METHOD_BUFFERED);
  941. {$EXTERNALSYM IOCTL_DISK_UPDATE_DRIVE_SIZE}
  942. IOCTL_DISK_GROW_PARTITION = (
  943. (IOCTL_DISK_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  944. ($0034 shl 2) or METHOD_BUFFERED);
  945. {$EXTERNALSYM IOCTL_DISK_GROW_PARTITION}
  946. IOCTL_DISK_GET_CACHE_INFORMATION = (
  947. (IOCTL_DISK_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  948. ($0035 shl 2) or METHOD_BUFFERED);
  949. {$EXTERNALSYM IOCTL_DISK_GET_CACHE_INFORMATION}
  950. IOCTL_DISK_SET_CACHE_INFORMATION = (
  951. (IOCTL_DISK_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  952. ($0036 shl 2) or METHOD_BUFFERED);
  953. {$EXTERNALSYM IOCTL_DISK_SET_CACHE_INFORMATION}
  954. OBSOLETE_DISK_GET_WRITE_CACHE_STATE = (
  955. (IOCTL_DISK_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  956. ($0037 shl 2) or METHOD_BUFFERED);
  957. {$EXTERNALSYM OBSOLETE_DISK_GET_WRITE_CACHE_STATE}
  958. IOCTL_DISK_DELETE_DRIVE_LAYOUT = (
  959. (IOCTL_DISK_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  960. ($0040 shl 2) or METHOD_BUFFERED);
  961. {$EXTERNALSYM IOCTL_DISK_DELETE_DRIVE_LAYOUT}
  962. //
  963. // Called to flush cached information that the driver may have about this
  964. // device's characteristics. Not all drivers cache characteristics, and not
  965. // cached properties can be flushed. This simply serves as an update to the
  966. // driver that it may want to do an expensive reexamination of the device's
  967. // characteristics now (fixed media size, partition table, etc...)
  968. //
  969. IOCTL_DISK_UPDATE_PROPERTIES = (
  970. (IOCTL_DISK_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  971. ($0050 shl 2) or METHOD_BUFFERED);
  972. {$EXTERNALSYM IOCTL_DISK_UPDATE_PROPERTIES}
  973. //
  974. // Special IOCTLs needed to support PC-98 machines in Japan
  975. //
  976. IOCTL_DISK_FORMAT_DRIVE = (
  977. (IOCTL_DISK_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  978. ($00f3 shl 2) or METHOD_BUFFERED);
  979. {$EXTERNALSYM IOCTL_DISK_FORMAT_DRIVE}
  980. IOCTL_DISK_SENSE_DEVICE = (
  981. (IOCTL_DISK_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  982. ($00f8 shl 2) or METHOD_BUFFERED);
  983. {$EXTERNALSYM IOCTL_DISK_SENSE_DEVICE}
  984. //
  985. // The following device control codes are common for all class drivers. The
  986. // functions codes defined here must match all of the other class drivers.
  987. //
  988. // Warning: these codes will be replaced in the future by equivalent
  989. // IOCTL_STORAGE codes
  990. //
  991. IOCTL_DISK_CHECK_VERIFY = (
  992. (IOCTL_DISK_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  993. ($0200 shl 2) or METHOD_BUFFERED);
  994. {$EXTERNALSYM IOCTL_DISK_CHECK_VERIFY}
  995. IOCTL_DISK_MEDIA_REMOVAL = (
  996. (IOCTL_DISK_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  997. ($0201 shl 2) or METHOD_BUFFERED);
  998. {$EXTERNALSYM IOCTL_DISK_MEDIA_REMOVAL}
  999. IOCTL_DISK_EJECT_MEDIA = (
  1000. (IOCTL_DISK_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  1001. ($0202 shl 2) or METHOD_BUFFERED);
  1002. {$EXTERNALSYM IOCTL_DISK_EJECT_MEDIA}
  1003. IOCTL_DISK_LOAD_MEDIA = (
  1004. (IOCTL_DISK_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  1005. ($0203 shl 2) or METHOD_BUFFERED);
  1006. {$EXTERNALSYM IOCTL_DISK_LOAD_MEDIA}
  1007. IOCTL_DISK_RESERVE = (
  1008. (IOCTL_DISK_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  1009. ($0204 shl 2) or METHOD_BUFFERED);
  1010. {$EXTERNALSYM IOCTL_DISK_RESERVE}
  1011. IOCTL_DISK_RELEASE = (
  1012. (IOCTL_DISK_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  1013. ($0205 shl 2) or METHOD_BUFFERED);
  1014. {$EXTERNALSYM IOCTL_DISK_RELEASE}
  1015. IOCTL_DISK_FIND_NEW_DEVICES = (
  1016. (IOCTL_DISK_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  1017. ($0206 shl 2) or METHOD_BUFFERED);
  1018. {$EXTERNALSYM IOCTL_DISK_FIND_NEW_DEVICES}
  1019. IOCTL_DISK_GET_MEDIA_TYPES = (
  1020. (IOCTL_DISK_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  1021. ($0300 shl 2) or METHOD_BUFFERED);
  1022. {$EXTERNALSYM IOCTL_DISK_GET_MEDIA_TYPES}
  1023. //
  1024. // Define the partition types returnable by known disk drivers.
  1025. //
  1026. const
  1027. PARTITION_ENTRY_UNUSED = $00; // Entry unused
  1028. {$EXTERNALSYM PARTITION_ENTRY_UNUSED}
  1029. PARTITION_FAT_12 = $01; // 12-bit FAT entries
  1030. {$EXTERNALSYM PARTITION_FAT_12}
  1031. PARTITION_XENIX_1 = $02; // Xenix
  1032. {$EXTERNALSYM PARTITION_XENIX_1}
  1033. PARTITION_XENIX_2 = $03; // Xenix
  1034. {$EXTERNALSYM PARTITION_XENIX_2}
  1035. PARTITION_FAT_16 = $04; // 16-bit FAT entries
  1036. {$EXTERNALSYM PARTITION_FAT_16}
  1037. PARTITION_EXTENDED = $05; // Extended partition entry
  1038. {$EXTERNALSYM PARTITION_EXTENDED}
  1039. PARTITION_HUGE = $06; // Huge partition MS-DOS V4
  1040. {$EXTERNALSYM PARTITION_HUGE}
  1041. PARTITION_IFS = $07; // IFS Partition
  1042. {$EXTERNALSYM PARTITION_IFS}
  1043. PARTITION_OS2BOOTMGR = $0A; // OS/2 Boot Manager/OPUS/Coherent swap
  1044. {$EXTERNALSYM PARTITION_OS2BOOTMGR}
  1045. PARTITION_FAT32 = $0B; // FAT32
  1046. {$EXTERNALSYM PARTITION_FAT32}
  1047. PARTITION_FAT32_XINT13 = $0C; // FAT32 using extended int13 services
  1048. {$EXTERNALSYM PARTITION_FAT32_XINT13}
  1049. PARTITION_XINT13 = $0E; // Win95 partition using extended int13 services
  1050. {$EXTERNALSYM PARTITION_XINT13}
  1051. PARTITION_XINT13_EXTENDED = $0F; // Same as type 5 but uses extended int13 services
  1052. {$EXTERNALSYM PARTITION_XINT13_EXTENDED}
  1053. PARTITION_PREP = $41; // PowerPC Reference Platform (PReP) Boot Partition
  1054. {$EXTERNALSYM PARTITION_PREP}
  1055. PARTITION_LDM = $42; // Logical Disk Manager partition
  1056. {$EXTERNALSYM PARTITION_LDM}
  1057. PARTITION_UNIX = $63; // Unix
  1058. {$EXTERNALSYM PARTITION_UNIX}
  1059. VALID_NTFT = $C0; // NTFT uses high order bits
  1060. {$EXTERNALSYM VALID_NTFT}
  1061. //
  1062. // The high bit of the partition type code indicates that a partition
  1063. // is part of an NTFT mirror or striped array.
  1064. //
  1065. PARTITION_NTFT = $80; // NTFT partition
  1066. {$EXTERNALSYM PARTITION_NTFT}
  1067. //
  1068. // The following macro is used to determine which partitions should be
  1069. // assigned drive letters.
  1070. //
  1071. //++
  1072. //
  1073. // BOOLEAN
  1074. // IsRecognizedPartition(
  1075. // IN DWORD PartitionType
  1076. // )
  1077. //
  1078. // Routine Description:
  1079. //
  1080. // This macro is used to determine to which partitions drive letters
  1081. // should be assigned.
  1082. //
  1083. // Arguments:
  1084. //
  1085. // PartitionType - Supplies the type of the partition being examined.
  1086. //
  1087. // Return Value:
  1088. //
  1089. // The return value is TRUE if the partition type is recognized,
  1090. // otherwise FALSE is returned.
  1091. //
  1092. //--
  1093. function IsRecognizedPartition(PartitionType: DWORD): Boolean;
  1094. {$EXTERNALSYM IsRecognizedPartition}
  1095. //++
  1096. //
  1097. // BOOLEAN
  1098. // IsContainerPartition(
  1099. // IN DWORD PartitionType
  1100. // )
  1101. //
  1102. // Routine Description:
  1103. //
  1104. // This macro is used to determine to which partition types are actually
  1105. // containers for other partitions (ie, extended partitions).
  1106. //
  1107. // Arguments:
  1108. //
  1109. // PartitionType - Supplies the type of the partition being examined.
  1110. //
  1111. // Return Value:
  1112. //
  1113. // The return value is TRUE if the partition type is a container,
  1114. // otherwise FALSE is returned.
  1115. //
  1116. //--
  1117. function IsContainerPartition(PartitionType: DWORD): Boolean;
  1118. {$EXTERNALSYM IsContainerPartition}
  1119. //++
  1120. //
  1121. // BOOLEAN
  1122. // IsFTPartition(
  1123. // IN DWORD PartitionType
  1124. // )
  1125. //
  1126. // Routine Description:
  1127. //
  1128. // This macro is used to determine if the given partition is an FT
  1129. // partition.
  1130. //
  1131. // Arguments:
  1132. //
  1133. // PartitionType - Supplies the type of the partition being examined.
  1134. //
  1135. // Return Value:
  1136. //
  1137. // The return value is TRUE if the partition type is an FT partition,
  1138. // otherwise FALSE is returned.
  1139. //
  1140. //--
  1141. function IsFTPartition(PartitionType: DWORD): Boolean;
  1142. {$EXTERNALSYM IsFTPartition}
  1143. //
  1144. // Define the media types supported by the driver.
  1145. //
  1146. type
  1147. _MEDIA_TYPE = (
  1148. Unknown, // Format is unknown
  1149. F5_1Pt2_512, // 5.25", 1.2MB, 512 bytes/sector
  1150. F3_1Pt44_512, // 3.5", 1.44MB, 512 bytes/sector
  1151. F3_2Pt88_512, // 3.5", 2.88MB, 512 bytes/sector
  1152. F3_20Pt8_512, // 3.5", 20.8MB, 512 bytes/sector
  1153. F3_720_512, // 3.5", 720KB, 512 bytes/sector
  1154. F5_360_512, // 5.25", 360KB, 512 bytes/sector
  1155. F5_320_512, // 5.25", 320KB, 512 bytes/sector
  1156. F5_320_1024, // 5.25", 320KB, 1024 bytes/sector
  1157. F5_180_512, // 5.25", 180KB, 512 bytes/sector
  1158. F5_160_512, // 5.25", 160KB, 512 bytes/sector
  1159. RemovableMedia, // Removable media other than floppy
  1160. FixedMedia, // Fixed hard disk media
  1161. F3_120M_512, // 3.5", 120M Floppy
  1162. F3_640_512, // 3.5" , 640KB, 512 bytes/sector
  1163. F5_640_512, // 5.25", 640KB, 512 bytes/sector
  1164. F5_720_512, // 5.25", 720KB, 512 bytes/sector
  1165. F3_1Pt2_512, // 3.5" , 1.2Mb, 512 bytes/sector
  1166. F3_1Pt23_1024, // 3.5" , 1.23Mb, 1024 bytes/sector
  1167. F5_1Pt23_1024, // 5.25", 1.23MB, 1024 bytes/sector
  1168. F3_128Mb_512, // 3.5" MO 128Mb 512 bytes/sector
  1169. F3_230Mb_512, // 3.5" MO 230Mb 512 bytes/sector
  1170. F8_256_128, // 8", 256KB, 128 bytes/sector
  1171. F3_200Mb_512, // 3.5", 200M Floppy (HiFD)
  1172. F3_240M_512, // 3.5", 240Mb Floppy (HiFD)
  1173. F3_32M_512); // 3.5", 32Mb Floppy
  1174. {$EXTERNALSYM _MEDIA_TYPE}
  1175. MEDIA_TYPE = _MEDIA_TYPE;
  1176. {$EXTERNALSYM MEDIA_TYPE}
  1177. PMEDIA_TYPE = ^MEDIA_TYPE;
  1178. {$EXTERNALSYM PMEDIA_TYPE}
  1179. TMediaType = MEDIA_TYPE;
  1180. PMediaType = PMEDIA_TYPE;
  1181. //
  1182. // Define the input buffer structure for the driver, when
  1183. // it is called with IOCTL_DISK_FORMAT_TRACKS.
  1184. //
  1185. PFORMAT_PARAMETERS = ^FORMAT_PARAMETERS;
  1186. {$EXTERNALSYM PFORMAT_PARAMETERS}
  1187. _FORMAT_PARAMETERS = record
  1188. MediaType: MEDIA_TYPE;
  1189. StartCylinderNumber: DWORD;
  1190. EndCylinderNumber: DWORD;
  1191. StartHeadNumber: DWORD;
  1192. EndHeadNumber: DWORD;
  1193. end;
  1194. {$EXTERNALSYM _FORMAT_PARAMETERS}
  1195. FORMAT_PARAMETERS = _FORMAT_PARAMETERS;
  1196. {$EXTERNALSYM FORMAT_PARAMETERS}
  1197. TFormatParameters = FORMAT_PARAMETERS;
  1198. PFormatParameters = PFORMAT_PARAMETERS;
  1199. //
  1200. // Define the BAD_TRACK_NUMBER type. An array of elements of this type is
  1201. // returned by the driver on IOCTL_DISK_FORMAT_TRACKS requests, to indicate
  1202. // what tracks were bad during formatting. The length of that array is
  1203. // reported in the `Information' field of the I/O Status Block.
  1204. //
  1205. BAD_TRACK_NUMBER = WORD;
  1206. {$EXTERNALSYM BAD_TRACK_NUMBER}
  1207. PBAD_TRACK_NUMBER = ^WORD;
  1208. {$EXTERNALSYM PBAD_TRACK_NUMBER}
  1209. //
  1210. // Define the input buffer structure for the driver, when
  1211. // it is called with IOCTL_DISK_FORMAT_TRACKS_EX.
  1212. //
  1213. PFORMAT_EX_PARAMETERS = ^FORMAT_EX_PARAMETERS;
  1214. {$EXTERNALSYM PFORMAT_EX_PARAMETERS}
  1215. _FORMAT_EX_PARAMETERS = record
  1216. MediaType: MEDIA_TYPE;
  1217. StartCylinderNumber: DWORD;
  1218. EndCylinderNumber: DWORD;
  1219. StartHeadNumber: DWORD;
  1220. EndHeadNumber: DWORD;
  1221. FormatGapLength: WORD;
  1222. SectorsPerTrack: WORD;
  1223. SectorNumber: array [0..0] of WORD;
  1224. end;
  1225. {$EXTERNALSYM _FORMAT_EX_PARAMETERS}
  1226. FORMAT_EX_PARAMETERS = _FORMAT_EX_PARAMETERS;
  1227. {$EXTERNALSYM FORMAT_EX_PARAMETERS}
  1228. TFormatExParameters = FORMAT_EX_PARAMETERS;
  1229. PFormatExParameters = PFORMAT_EX_PARAMETERS;
  1230. //
  1231. // The following structure is returned on an IOCTL_DISK_GET_DRIVE_GEOMETRY
  1232. // request and an array of them is returned on an IOCTL_DISK_GET_MEDIA_TYPES
  1233. // request.
  1234. //
  1235. PDISK_GEOMETRY = ^DISK_GEOMETRY;
  1236. {$EXTERNALSYM PDISK_GEOMETRY}
  1237. _DISK_GEOMETRY = record
  1238. Cylinders: LARGE_INTEGER;
  1239. MediaType: MEDIA_TYPE;
  1240. TracksPerCylinder: DWORD;
  1241. SectorsPerTrack: DWORD;
  1242. BytesPerSector: DWORD;
  1243. end;
  1244. {$EXTERNALSYM _DISK_GEOMETRY}
  1245. DISK_GEOMETRY = _DISK_GEOMETRY;
  1246. {$EXTERNALSYM DISK_GEOMETRY}
  1247. TDiskGeometry = DISK_GEOMETRY;
  1248. PDiskGeometry = PDISK_GEOMETRY;
  1249. //
  1250. // This wmi guid returns a DISK_GEOMETRY structure
  1251. //
  1252. const
  1253. WMI_DISK_GEOMETRY_GUID: TGUID = (
  1254. D1:$25007f51; D2:$57c2; D3:$11d1; D4:($a5, $28, $00, $a0, $c9, $06, $29, $10));
  1255. {$EXTERNALSYM WMI_DISK_GEOMETRY_GUID}
  1256. //
  1257. // The following structure is returned on an IOCTL_DISK_GET_PARTITION_INFO
  1258. // and an IOCTL_DISK_GET_DRIVE_LAYOUT request. It is also used in a request
  1259. // to change the drive layout, IOCTL_DISK_SET_DRIVE_LAYOUT.
  1260. //
  1261. type
  1262. PPARTITION_INFORMATION = ^PARTITION_INFORMATION;
  1263. {$EXTERNALSYM PPARTITION_INFORMATION}
  1264. _PARTITION_INFORMATION = record
  1265. StartingOffset: LARGE_INTEGER;
  1266. PartitionLength: LARGE_INTEGER;
  1267. HiddenSectors: DWORD;
  1268. PartitionNumber: DWORD;
  1269. PartitionType: BYTE;
  1270. BootIndicator: ByteBool;
  1271. RecognizedPartition: ByteBool;
  1272. RewritePartition: ByteBool;
  1273. end;
  1274. {$EXTERNALSYM _PARTITION_INFORMATION}
  1275. PARTITION_INFORMATION = _PARTITION_INFORMATION;
  1276. {$EXTERNALSYM PARTITION_INFORMATION}
  1277. TPartitionInformation = PARTITION_INFORMATION;
  1278. PPartitionInformation = PPARTITION_INFORMATION;
  1279. //
  1280. // The following structure is used to change the partition type of a
  1281. // specified disk partition using an IOCTL_DISK_SET_PARTITION_INFO
  1282. // request.
  1283. //
  1284. PSET_PARTITION_INFORMATION = ^SET_PARTITION_INFORMATION;
  1285. {$EXTERNALSYM PSET_PARTITION_INFORMATION}
  1286. _SET_PARTITION_INFORMATION = record
  1287. PartitionType: BYTE;
  1288. end;
  1289. {$EXTERNALSYM _SET_PARTITION_INFORMATION}
  1290. SET_PARTITION_INFORMATION = _SET_PARTITION_INFORMATION;
  1291. {$EXTERNALSYM SET_PARTITION_INFORMATION}
  1292. TSetPartitionInformation = _SET_PARTITION_INFORMATION;
  1293. PSetPartitionInformation = PSET_PARTITION_INFORMATION;
  1294. //
  1295. // The following structures is returned on an IOCTL_DISK_GET_DRIVE_LAYOUT
  1296. // request and given as input to an IOCTL_DISK_SET_DRIVE_LAYOUT request.
  1297. //
  1298. PDRIVE_LAYOUT_INFORMATION = ^DRIVE_LAYOUT_INFORMATION;
  1299. {$EXTERNALSYM PDRIVE_LAYOUT_INFORMATION}
  1300. _DRIVE_LAYOUT_INFORMATION = record
  1301. PartitionCount: DWORD;
  1302. Signature: DWORD;
  1303. PartitionEntry: array [0..0] of PARTITION_INFORMATION;
  1304. end;
  1305. {$EXTERNALSYM _DRIVE_LAYOUT_INFORMATION}
  1306. DRIVE_LAYOUT_INFORMATION = _DRIVE_LAYOUT_INFORMATION;
  1307. {$EXTERNALSYM DRIVE_LAYOUT_INFORMATION}
  1308. TDriveLayoutInformation = DRIVE_LAYOUT_INFORMATION;
  1309. PDriveLayoutInformation = PDRIVE_LAYOUT_INFORMATION;
  1310. //
  1311. // The following structure is passed in on an IOCTL_DISK_VERIFY request.
  1312. // The offset and length parameters are both given in bytes.
  1313. //
  1314. PVERIFY_INFORMATION = ^VERIFY_INFORMATION;
  1315. {$EXTERNALSYM PVERIFY_INFORMATION}
  1316. _VERIFY_INFORMATION = record
  1317. StartingOffset: LARGE_INTEGER;
  1318. Length: DWORD;
  1319. end;
  1320. {$EXTERNALSYM _VERIFY_INFORMATION}
  1321. VERIFY_INFORMATION = _VERIFY_INFORMATION;
  1322. {$EXTERNALSYM VERIFY_INFORMATION}
  1323. TVerifyInformation = VERIFY_INFORMATION;
  1324. PVerifyInformation = PVERIFY_INFORMATION;
  1325. //
  1326. // The following structure is passed in on an IOCTL_DISK_REASSIGN_BLOCKS
  1327. // request.
  1328. //
  1329. PREASSIGN_BLOCKS = ^REASSIGN_BLOCKS;
  1330. {$EXTERNALSYM PREASSIGN_BLOCKS}
  1331. _REASSIGN_BLOCKS = record
  1332. Reserved: WORD;
  1333. Count: WORD;
  1334. BlockNumber: array [0..0] of DWORD;
  1335. end;
  1336. {$EXTERNALSYM _REASSIGN_BLOCKS}
  1337. REASSIGN_BLOCKS = _REASSIGN_BLOCKS;
  1338. {$EXTERNALSYM REASSIGN_BLOCKS}
  1339. TReassignBlocks = REASSIGN_BLOCKS;
  1340. PReassignBlocks = PREASSIGN_BLOCKS;
  1341. //
  1342. // Support for GUID Partition Table (GPT) disks.
  1343. //
  1344. //
  1345. // There are currently two ways a disk can be partitioned. With a traditional
  1346. // AT-style master boot record (PARTITION_STYLE_MBR) and with a new, GPT
  1347. // partition table (PARTITION_STYLE_GPT). RAW is for an unrecognizable
  1348. // partition style. There are a very limited number of things you can
  1349. // do with a RAW partititon.
  1350. //
  1351. type
  1352. _PARTITION_STYLE = (
  1353. PARTITION_STYLE_MBR,
  1354. PARTITION_STYLE_GPT,
  1355. PARTITION_STYLE_RAW);
  1356. {$EXTERNALSYM _PARTITION_STYLE}
  1357. PARTITION_STYLE = _PARTITION_STYLE;
  1358. {$EXTERNALSYM PARTITION_STYLE}
  1359. TPartitionStyle = PARTITION_STYLE;
  1360. //
  1361. // The following structure defines information in a GPT partition that is
  1362. // not common to both GPT and MBR partitions.
  1363. //
  1364. PPARTITION_INFORMATION_GPT = ^PARTITION_INFORMATION_GPT;
  1365. {$EXTERNALSYM PPARTITION_INFORMATION_GPT}
  1366. _PARTITION_INFORMATION_GPT = record
  1367. PartitionType: GUID; // Partition type. See table 16-3.
  1368. PartitionId: GUID; // Unique GUID for this partition.
  1369. Attributes: DWORD64; // See table 16-4.
  1370. Name: array [0..35] of WCHAR; // Partition Name in Unicode.
  1371. end;
  1372. {$EXTERNALSYM _PARTITION_INFORMATION_GPT}
  1373. PARTITION_INFORMATION_GPT = _PARTITION_INFORMATION_GPT;
  1374. {$EXTERNALSYM PARTITION_INFORMATION_GPT}
  1375. TPartitionInformationGpt = PARTITION_INFORMATION_GPT;
  1376. PPartitionInformationGpt = PPARTITION_INFORMATION_GPT;
  1377. //
  1378. // The following are GPT partition attributes applicable for any
  1379. // partition type. These attributes are not OS-specific
  1380. //
  1381. const
  1382. GPT_ATTRIBUTE_PLATFORM_REQUIRED = $0000000000000001;
  1383. {$EXTERNALSYM GPT_ATTRIBUTE_PLATFORM_REQUIRED}
  1384. //
  1385. // The following are GPT partition attributes applicable when the
  1386. // PartitionType is PARTITION_BASIC_DATA_GUID.
  1387. //
  1388. GPT_BASIC_DATA_ATTRIBUTE_NO_DRIVE_LETTER = DWORD($8000000000000000);
  1389. {$EXTERNALSYM GPT_BASIC_DATA_ATTRIBUTE_NO_DRIVE_LETTER}
  1390. GPT_BASIC_DATA_ATTRIBUTE_HIDDEN = $4000000000000000;
  1391. {$EXTERNALSYM GPT_BASIC_DATA_ATTRIBUTE_HIDDEN}
  1392. GPT_BASIC_DATA_ATTRIBUTE_READ_ONLY = $1000000000000000;
  1393. {$EXTERNALSYM GPT_BASIC_DATA_ATTRIBUTE_READ_ONLY}
  1394. //
  1395. // The following structure defines information in an MBR partition that is not
  1396. // common to both GPT and MBR partitions.
  1397. //
  1398. type
  1399. PPARTITION_INFORMATION_MBR = ^PARTITION_INFORMATION_MBR;
  1400. {$EXTERNALSYM PPARTITION_INFORMATION_MBR}
  1401. _PARTITION_INFORMATION_MBR = record
  1402. PartitionType: BYTE;
  1403. BootIndicator: BOOLEAN;
  1404. RecognizedPartition: BOOLEAN;
  1405. HiddenSectors: DWORD;
  1406. end;
  1407. {$EXTERNALSYM _PARTITION_INFORMATION_MBR}
  1408. PARTITION_INFORMATION_MBR = _PARTITION_INFORMATION_MBR;
  1409. {$EXTERNALSYM PARTITION_INFORMATION_MBR}
  1410. TPartitionInformationMbr = PARTITION_INFORMATION_MBR;
  1411. PPartitionInformationMbr = PPARTITION_INFORMATION_MBR;
  1412. //
  1413. // The structure SET_PARTITION_INFO_EX is used with the ioctl
  1414. // IOCTL_SET_PARTITION_INFO_EX to set information about a specific
  1415. // partition. Note that for MBR partitions, you can only set the partition
  1416. // signature, whereas GPT partitions allow setting of all fields that
  1417. // you can get.
  1418. //
  1419. SET_PARTITION_INFORMATION_MBR = SET_PARTITION_INFORMATION;
  1420. {$EXTERNALSYM SET_PARTITION_INFORMATION_MBR}
  1421. TSetPartitionInformationMbr = SET_PARTITION_INFORMATION_MBR;
  1422. SET_PARTITION_INFORMATION_GPT = PARTITION_INFORMATION_GPT;
  1423. {$EXTERNALSYM SET_PARTITION_INFORMATION_GPT}
  1424. TSetPartitionInformationGpt = SET_PARTITION_INFORMATION_GPT;
  1425. PSET_PARTITION_INFORMATION_EX = ^SET_PARTITION_INFORMATION_EX;
  1426. {$EXTERNALSYM PSET_PARTITION_INFORMATION_EX}
  1427. _SET_PARTITION_INFORMATION_EX = record
  1428. PartitionStyle: PARTITION_STYLE;
  1429. case Integer of
  1430. 0: (Mbr: SET_PARTITION_INFORMATION_MBR);
  1431. 1: (Gpt: SET_PARTITION_INFORMATION_GPT);
  1432. end;
  1433. {$EXTERNALSYM _SET_PARTITION_INFORMATION_EX}
  1434. SET_PARTITION_INFORMATION_EX = _SET_PARTITION_INFORMATION_EX;
  1435. {$EXTERNALSYM SET_PARTITION_INFORMATION_EX}
  1436. TSetPartitionInformationEx = SET_PARTITION_INFORMATION_EX;
  1437. PSetPartitionInformationEx = PSET_PARTITION_INFORMATION_EX;
  1438. //
  1439. // The structure CREATE_DISK_GPT with the ioctl IOCTL_DISK_CREATE_DISK
  1440. // to initialize an virgin disk with an empty GPT partition table.
  1441. //
  1442. PCREATE_DISK_GPT = ^CREATE_DISK_GPT;
  1443. {$EXTERNALSYM PCREATE_DISK_GPT}
  1444. _CREATE_DISK_GPT = record
  1445. DiskId: GUID; // Unique disk id for the disk.
  1446. MaxPartitionCount: DWORD; // Maximim number of partitions allowable.
  1447. end;
  1448. {$EXTERNALSYM _CREATE_DISK_GPT}
  1449. CREATE_DISK_GPT = _CREATE_DISK_GPT;
  1450. {$EXTERNALSYM CREATE_DISK_GPT}
  1451. TCreateDiskGpt = CREATE_DISK_GPT;
  1452. PCreateDiskGpt = PCREATE_DISK_GPT;
  1453. //
  1454. // The structure CREATE_DISK_MBR with the ioctl IOCTL_DISK_CREATE_DISK
  1455. // to initialize an virgin disk with an empty MBR partition table.
  1456. //
  1457. PCREATE_DISK_MBR = ^CREATE_DISK_MBR;
  1458. {$EXTERNALSYM PCREATE_DISK_MBR}
  1459. _CREATE_DISK_MBR = record
  1460. Signature: DWORD;
  1461. end;
  1462. {$EXTERNALSYM _CREATE_DISK_MBR}
  1463. CREATE_DISK_MBR = _CREATE_DISK_MBR;
  1464. {$EXTERNALSYM CREATE_DISK_MBR}
  1465. TCreateDiskMbr = CREATE_DISK_MBR;
  1466. PCreateDiskMbr = PCREATE_DISK_MBR;
  1467. PCREATE_DISK = ^CREATE_DISK;
  1468. {$EXTERNALSYM PCREATE_DISK}
  1469. _CREATE_DISK = record
  1470. PartitionStyle: PARTITION_STYLE;
  1471. case Integer of
  1472. 0: (Mbr: CREATE_DISK_MBR);
  1473. 1: (Gpt: CREATE_DISK_GPT);
  1474. end;
  1475. {$EXTERNALSYM _CREATE_DISK}
  1476. CREATE_DISK = _CREATE_DISK;
  1477. {$EXTERNALSYM CREATE_DISK}
  1478. TCreateDisk = CREATE_DISK;
  1479. PCreateDisk = PCREATE_DISK;
  1480. //
  1481. // The structure GET_LENGTH_INFORMATION is used with the ioctl
  1482. // IOCTL_DISK_GET_LENGTH_INFO to obtain the length, in bytes, of the
  1483. // disk, partition, or volume.
  1484. //
  1485. PGET_LENGTH_INFORMATION = ^GET_LENGTH_INFORMATION;
  1486. {$EXTERNALSYM PGET_LENGTH_INFORMATION}
  1487. _GET_LENGTH_INFORMATION = record
  1488. Length: LARGE_INTEGER;
  1489. end;
  1490. {$EXTERNALSYM _GET_LENGTH_INFORMATION}
  1491. GET_LENGTH_INFORMATION = _GET_LENGTH_INFORMATION;
  1492. {$EXTERNALSYM GET_LENGTH_INFORMATION}
  1493. TGetLengthInformation = GET_LENGTH_INFORMATION;
  1494. PGetLengthInformation = PGET_LENGTH_INFORMATION;
  1495. //
  1496. // The PARTITION_INFORMATION_EX structure is used with the
  1497. // IOCTL_DISK_GET_DRIVE_LAYOUT_EX, IOCTL_DISK_SET_DRIVE_LAYOUT_EX,
  1498. // IOCTL_DISK_GET_PARTITION_INFO_EX and IOCTL_DISK_GET_PARTITION_INFO_EX calls.
  1499. //
  1500. PPARTITION_INFORMATION_EX = ^PARTITION_INFORMATION_EX;
  1501. {$EXTERNALSYM PPARTITION_INFORMATION_EX}
  1502. _PARTITION_INFORMATION_EX = record
  1503. PartitionStyle: PARTITION_STYLE;
  1504. StartingOffset: LARGE_INTEGER;
  1505. PartitionLength: LARGE_INTEGER;
  1506. PartitionNumber: DWORD;
  1507. RewritePartition: BOOLEAN;
  1508. case Integer of
  1509. 0: (Mbr: PARTITION_INFORMATION_MBR);
  1510. 1: (Gpt: PARTITION_INFORMATION_GPT);
  1511. end;
  1512. {$EXTERNALSYM _PARTITION_INFORMATION_EX}
  1513. PARTITION_INFORMATION_EX = _PARTITION_INFORMATION_EX;
  1514. {$EXTERNALSYM PARTITION_INFORMATION_EX}
  1515. TPartitionInformationEx = PARTITION_INFORMATION_EX;
  1516. PPartitionInformationEx = PPARTITION_INFORMATION_EX;
  1517. //
  1518. // GPT specific drive layout information.
  1519. //
  1520. PDRIVE_LAYOUT_INFORMATION_GPT = ^DRIVE_LAYOUT_INFORMATION_GPT;
  1521. {$EXTERNALSYM PDRIVE_LAYOUT_INFORMATION_GPT}
  1522. _DRIVE_LAYOUT_INFORMATION_GPT = record
  1523. DiskId: GUID;
  1524. StartingUsableOffset: LARGE_INTEGER;
  1525. UsableLength: LARGE_INTEGER;
  1526. MaxPartitionCount: DWORD;
  1527. end;
  1528. {$EXTERNALSYM _DRIVE_LAYOUT_INFORMATION_GPT}
  1529. DRIVE_LAYOUT_INFORMATION_GPT = _DRIVE_LAYOUT_INFORMATION_GPT;
  1530. {$EXTERNALSYM DRIVE_LAYOUT_INFORMATION_GPT}
  1531. TDriveLayoutInformationGpt = DRIVE_LAYOUT_INFORMATION_GPT;
  1532. PDriveLayoutInformationGpt = PDRIVE_LAYOUT_INFORMATION_GPT;
  1533. //
  1534. // MBR specific drive layout information.
  1535. //
  1536. PDRIVE_LAYOUT_INFORMATION_MBR = ^DRIVE_LAYOUT_INFORMATION_MBR;
  1537. {$EXTERNALSYM PDRIVE_LAYOUT_INFORMATION_MBR}
  1538. _DRIVE_LAYOUT_INFORMATION_MBR = record
  1539. Signature: DWORD;
  1540. end;
  1541. {$EXTERNALSYM _DRIVE_LAYOUT_INFORMATION_MBR}
  1542. DRIVE_LAYOUT_INFORMATION_MBR = _DRIVE_LAYOUT_INFORMATION_MBR;
  1543. {$EXTERNALSYM DRIVE_LAYOUT_INFORMATION_MBR}
  1544. TDriveLayoutInformationMbr = DRIVE_LAYOUT_INFORMATION_MBR;
  1545. PDriveLayoutInformationMbr = PDRIVE_LAYOUT_INFORMATION_MBR;
  1546. //
  1547. // The structure DRIVE_LAYOUT_INFORMATION_EX is used with the
  1548. // IOCTL_SET_DRIVE_LAYOUT_EX and IOCTL_GET_DRIVE_LAYOUT_EX calls.
  1549. //
  1550. PDRIVE_LAYOUT_INFORMATION_EX = ^DRIVE_LAYOUT_INFORMATION_EX;
  1551. {$EXTERNALSYM PDRIVE_LAYOUT_INFORMATION_EX}
  1552. _DRIVE_LAYOUT_INFORMATION_EX = record
  1553. PartitionStyle: DWORD;
  1554. PartitionCount: DWORD;
  1555. Union: record
  1556. case Integer of
  1557. 0: (Mbr: DRIVE_LAYOUT_INFORMATION_MBR);
  1558. 1: (Gpt: DRIVE_LAYOUT_INFORMATION_GPT);
  1559. end;
  1560. PartitionEntry: array [0..0] of PARTITION_INFORMATION_EX;
  1561. end;
  1562. {$EXTERNALSYM _DRIVE_LAYOUT_INFORMATION_EX}
  1563. DRIVE_LAYOUT_INFORMATION_EX = _DRIVE_LAYOUT_INFORMATION_EX;
  1564. {$EXTERNALSYM DRIVE_LAYOUT_INFORMATION_EX}
  1565. TDriveLayoutInformationEx = DRIVE_LAYOUT_INFORMATION_EX;
  1566. PDriveLayoutInformationEx = PDRIVE_LAYOUT_INFORMATION_EX;
  1567. //
  1568. // The DISK_GEOMETRY_EX structure is returned on issuing an
  1569. // IOCTL_DISK_GET_DRIVE_GEOMETRY_EX ioctl.
  1570. //
  1571. _DETECTION_TYPE = (
  1572. DetectNone,
  1573. DetectInt13,
  1574. DetectExInt13);
  1575. {$EXTERNALSYM _DETECTION_TYPE}
  1576. DETECTION_TYPE = _DETECTION_TYPE;
  1577. {$EXTERNALSYM DETECTION_TYPE}
  1578. TDetectionType = DETECTION_TYPE;
  1579. PDISK_INT13_INFO = ^DISK_INT13_INFO;
  1580. {$EXTERNALSYM PDISK_INT13_INFO}
  1581. _DISK_INT13_INFO = record
  1582. DriveSelect: WORD;
  1583. MaxCylinders: DWORD;
  1584. SectorsPerTrack: WORD;
  1585. MaxHeads: WORD;
  1586. NumberDrives: WORD;
  1587. end;
  1588. {$EXTERNALSYM _DISK_INT13_INFO}
  1589. DISK_INT13_INFO = _DISK_INT13_INFO;
  1590. {$EXTERNALSYM DISK_INT13_INFO}
  1591. TDiskInt13Info = DISK_INT13_INFO;
  1592. PDiskInt13Info = PDISK_INT13_INFO;
  1593. PDISK_EX_INT13_INFO = ^DISK_EX_INT13_INFO;
  1594. {$EXTERNALSYM PDISK_EX_INT13_INFO}
  1595. _DISK_EX_INT13_INFO = record
  1596. ExBufferSize: WORD;
  1597. ExFlags: WORD;
  1598. ExCylinders: DWORD;
  1599. ExHeads: DWORD;
  1600. ExSectorsPerTrack: DWORD;
  1601. ExSectorsPerDrive: DWORD64;
  1602. ExSectorSize: WORD;
  1603. ExReserved: WORD;
  1604. end;
  1605. {$EXTERNALSYM _DISK_EX_INT13_INFO}
  1606. DISK_EX_INT13_INFO = _DISK_EX_INT13_INFO;
  1607. {$EXTERNALSYM DISK_EX_INT13_INFO}
  1608. TDiskExInt13Info = DISK_EX_INT13_INFO;
  1609. PDiskExInt13Info = PDISK_EX_INT13_INFO;
  1610. PDISK_DETECTION_INFO = ^DISK_DETECTION_INFO;
  1611. {$EXTERNALSYM PDISK_DETECTION_INFO}
  1612. _DISK_DETECTION_INFO = record
  1613. SizeOfDetectInfo: DWORD;
  1614. DetectionType: DETECTION_TYPE;
  1615. case Integer of
  1616. 0: (
  1617. //
  1618. // If DetectionType == DETECTION_INT13 then we have just the Int13
  1619. // information.
  1620. //
  1621. Int13: DISK_INT13_INFO;
  1622. //
  1623. // If DetectionType == DETECTION_EX_INT13, then we have the
  1624. // extended int 13 information.
  1625. //
  1626. ExInt13: DISK_EX_INT13_INFO); // If DetectionType == DetectExInt13
  1627. end;
  1628. {$EXTERNALSYM _DISK_DETECTION_INFO}
  1629. DISK_DETECTION_INFO = _DISK_DETECTION_INFO;
  1630. {$EXTERNALSYM DISK_DETECTION_INFO}
  1631. TDiskDetectionInfo = DISK_DETECTION_INFO;
  1632. PDiskDetectionInfo = PDISK_DETECTION_INFO;
  1633. PDISK_PARTITION_INFO = ^DISK_PARTITION_INFO;
  1634. {$EXTERNALSYM PDISK_PARTITION_INFO}
  1635. _DISK_PARTITION_INFO = record
  1636. SizeOfPartitionInfo: DWORD;
  1637. PartitionStyle: PARTITION_STYLE; // PartitionStyle = RAW, GPT or MBR
  1638. case Integer of
  1639. 0: ( // If PartitionStyle == MBR
  1640. Signature: DWORD; // MBR Signature
  1641. CheckSum: DWORD); // MBR CheckSum
  1642. 1: ( // If PartitionStyle == GPT
  1643. DiskId: GUID);
  1644. end;
  1645. {$EXTERNALSYM _DISK_PARTITION_INFO}
  1646. DISK_PARTITION_INFO = _DISK_PARTITION_INFO;
  1647. {$EXTERNALSYM DISK_PARTITION_INFO}
  1648. TDiskPartitionInfo = DISK_PARTITION_INFO;
  1649. PDiskPartitionInfo = PDISK_PARTITION_INFO;
  1650. //
  1651. // The Geometry structure is a variable length structure composed of a
  1652. // DISK_GEOMETRY_EX structure followed by a DISK_PARTITION_INFO structure
  1653. // followed by a DISK_DETECTION_DATA structure.
  1654. //
  1655. type
  1656. PDISK_GEOMETRY_EX = ^DISK_GEOMETRY_EX;
  1657. {$EXTERNALSYM PDISK_GEOMETRY_EX}
  1658. _DISK_GEOMETRY_EX = record
  1659. Geometry: DISK_GEOMETRY; // Standard disk geometry: may be faked by driver.
  1660. DiskSize: LARGE_INTEGER; // Must always be correct
  1661. Data: array [0..0] of BYTE; // Partition, Detect info
  1662. end;
  1663. {$EXTERNALSYM _DISK_GEOMETRY_EX}
  1664. DISK_GEOMETRY_EX = _DISK_GEOMETRY_EX;
  1665. {$EXTERNALSYM DISK_GEOMETRY_EX}
  1666. TDiskGeometryEx = DISK_GEOMETRY_EX;
  1667. PDiskGeometryEx = PDISK_GEOMETRY_EX;
  1668. function DiskGeometryGetPartition(Geometry: PDiskGeometryEx): PDiskPartitionInfo;
  1669. {$EXTERNALSYM DiskGeometryGetPartition}
  1670. function DiskGeometryGetDetect(Geometry: PDiskGeometryEx): PDiskDetectionInfo;
  1671. {$EXTERNALSYM DiskGeometryGetDetect}
  1672. //
  1673. // IOCTL_DISK_CONTROLLER_NUMBER returns the controller and disk
  1674. // number for the handle. This is used to determine if a disk
  1675. // is attached to the primary or secondary IDE controller.
  1676. //
  1677. type
  1678. PDISK_CONTROLLER_NUMBER = ^DISK_CONTROLLER_NUMBER;
  1679. {$EXTERNALSYM PDISK_CONTROLLER_NUMBER}
  1680. _DISK_CONTROLLER_NUMBER = record
  1681. ControllerNumber: DWORD;
  1682. DiskNumber: DWORD;
  1683. end;
  1684. {$EXTERNALSYM _DISK_CONTROLLER_NUMBER}
  1685. DISK_CONTROLLER_NUMBER = _DISK_CONTROLLER_NUMBER;
  1686. {$EXTERNALSYM DISK_CONTROLLER_NUMBER}
  1687. TDiskControllerNumber = DISK_CONTROLLER_NUMBER;
  1688. PDiskControllerNumber = PDISK_CONTROLLER_NUMBER;
  1689. //
  1690. // IOCTL_DISK_SET_CACHE allows the caller to get or set the state of the disk
  1691. // read/write caches.
  1692. //
  1693. // If the structure is provided as the input buffer for the ioctl the read &
  1694. // write caches will be enabled or disabled depending on the parameters
  1695. // provided.
  1696. //
  1697. // If the structure is provided as an output buffer for the ioctl the state
  1698. // of the read & write caches will be returned. If both input and outut buffers
  1699. // are provided the output buffer will contain the cache state BEFORE any
  1700. // changes are made
  1701. //
  1702. DISK_CACHE_RETENTION_PRIORITY = (EqualPriority, KeepPrefetchedData, KeepReadData);
  1703. {$EXTERNALSYM DISK_CACHE_RETENTION_PRIORITY}
  1704. TDiskCacheRetentionPriority = DISK_CACHE_RETENTION_PRIORITY;
  1705. TDCIScalarPrefetch = record
  1706. Minimum: WORD;
  1707. Maximum: WORD;
  1708. //
  1709. // The maximum number of blocks which will be prefetched - useful
  1710. // with the scalar limits to set definite upper limits.
  1711. //
  1712. MaximumBlocks: WORD;
  1713. end;
  1714. TDCIBlockPrefetch = record
  1715. Minimum: WORD;
  1716. Maximum: WORD;
  1717. end;
  1718. PDISK_CACHE_INFORMATION = ^DISK_CACHE_INFORMATION;
  1719. {$EXTERNALSYM PDISK_CACHE_INFORMATION}
  1720. _DISK_CACHE_INFORMATION = record
  1721. //
  1722. // on return indicates that the device is capable of saving any parameters
  1723. // in non-volatile storage. On send indicates that the device should
  1724. // save the state in non-volatile storage.
  1725. //
  1726. ParametersSavable: ByteBool;
  1727. //
  1728. // Indicates whether the write and read caches are enabled.
  1729. //
  1730. ReadCacheEnabled: ByteBool;
  1731. WriteCacheEnabled: ByteBool;
  1732. //
  1733. // Controls the likelyhood of data remaining in the cache depending on how
  1734. // it got there. Data cached from a READ or WRITE operation may be given
  1735. // higher, lower or equal priority to data entered into the cache for other
  1736. // means (like prefetch)
  1737. //
  1738. ReadRetentionPriority: DISK_CACHE_RETENTION_PRIORITY;
  1739. WriteRetentionPriority: DISK_CACHE_RETENTION_PRIORITY;
  1740. //
  1741. // Requests for a larger number of blocks than this may have prefetching
  1742. // disabled. If this value is set to 0 prefetch will be disabled.
  1743. //
  1744. DisablePrefetchTransferLength: WORD;
  1745. //
  1746. // If TRUE then ScalarPrefetch (below) will be valid. If FALSE then
  1747. // the minimum and maximum values should be treated as a block count
  1748. // (BlockPrefetch)
  1749. //
  1750. PrefetchScalar: ByteBool;
  1751. //
  1752. // Contains the minimum and maximum amount of data which will be
  1753. // will be prefetched into the cache on a disk operation. This value
  1754. // may either be a scalar multiplier of the transfer length of the request,
  1755. // or an abolute number of disk blocks. PrefetchScalar (above) indicates
  1756. // which interpretation is used.
  1757. //
  1758. case Integer of
  1759. 0: (ScalarPrefetch: TDCIScalarPrefetch);
  1760. 1: (BlockPrefetch: TDCIBlockPrefetch);
  1761. end;
  1762. {$EXTERNALSYM _DISK_CACHE_INFORMATION}
  1763. DISK_CACHE_INFORMATION = _DISK_CACHE_INFORMATION;
  1764. {$EXTERNALSYM DISK_CACHE_INFORMATION}
  1765. TDiskCacheInformation = DISK_CACHE_INFORMATION;
  1766. PDiskCacheInformation = PDISK_CACHE_INFORMATION;
  1767. //
  1768. // IOCTL_DISK_GROW_PARTITION will update the size of a partition
  1769. // by adding sectors to the length. The number of sectors must be
  1770. // predetermined by examining PARTITION_INFORMATION.
  1771. //
  1772. PDISK_GROW_PARTITION = ^DISK_GROW_PARTITION;
  1773. {$EXTERNALSYM PDISK_GROW_PARTITION}
  1774. _DISK_GROW_PARTITION = record
  1775. PartitionNumber: DWORD;
  1776. BytesToGrow: LARGE_INTEGER;
  1777. end;
  1778. {$EXTERNALSYM _DISK_GROW_PARTITION}
  1779. DISK_GROW_PARTITION = _DISK_GROW_PARTITION;
  1780. {$EXTERNALSYM DISK_GROW_PARTITION}
  1781. TDiskGrowPartition = DISK_GROW_PARTITION;
  1782. PDiskGrowPartition = PDISK_GROW_PARTITION;
  1783. ///////////////////////////////////////////////////////
  1784. // //
  1785. // The following structures define disk performance //
  1786. // statistics: specifically the locations of all the //
  1787. // reads and writes which have occured on the disk. //
  1788. // //
  1789. // To use these structures, you must issue an IOCTL_ //
  1790. // DISK_HIST_STRUCTURE (with a DISK_HISTOGRAM) to //
  1791. // obtain the basic histogram information. The //
  1792. // number of buckets which must allocated is part of //
  1793. // this structure. Allocate the required number of //
  1794. // buckets and call an IOCTL_DISK_HIST_DATA to fill //
  1795. // in the data //
  1796. // //
  1797. ///////////////////////////////////////////////////////
  1798. const
  1799. HIST_NO_OF_BUCKETS = 24;
  1800. {$EXTERNALSYM HIST_NO_OF_BUCKETS}
  1801. type
  1802. PHISTOGRAM_BUCKET = ^HISTOGRAM_BUCKET;
  1803. {$EXTERNALSYM PHISTOGRAM_BUCKET}
  1804. _HISTOGRAM_BUCKET = record
  1805. Reads: DWORD;
  1806. Writes: DWORD;
  1807. end;
  1808. {$EXTERNALSYM _HISTOGRAM_BUCKET}
  1809. HISTOGRAM_BUCKET = _HISTOGRAM_BUCKET;
  1810. {$EXTERNALSYM HISTOGRAM_BUCKET}
  1811. THistogramBucket = HISTOGRAM_BUCKET;
  1812. PHistogramBucket = PHISTOGRAM_BUCKET;
  1813. const
  1814. HISTOGRAM_BUCKET_SIZE = SizeOf(HISTOGRAM_BUCKET);
  1815. {$EXTERNALSYM HISTOGRAM_BUCKET_SIZE}
  1816. type
  1817. PDISK_HISTOGRAM = ^DISK_HISTOGRAM;
  1818. {$EXTERNALSYM PDISK_HISTOGRAM}
  1819. _DISK_HISTOGRAM = record
  1820. DiskSize: LARGE_INTEGER;
  1821. Start: LARGE_INTEGER;
  1822. End_: LARGE_INTEGER;
  1823. Average: LARGE_INTEGER;
  1824. AverageRead: LARGE_INTEGER;
  1825. AverageWrite: LARGE_INTEGER;
  1826. Granularity: DWORD;
  1827. Size: DWORD;
  1828. ReadCount: DWORD;
  1829. WriteCount: DWORD;
  1830. Histogram: PHISTOGRAM_BUCKET;
  1831. end;
  1832. {$EXTERNALSYM _DISK_HISTOGRAM}
  1833. DISK_HISTOGRAM = _DISK_HISTOGRAM;
  1834. {$EXTERNALSYM DISK_HISTOGRAM}
  1835. TDiskHistogram = DISK_HISTOGRAM;
  1836. PDiskHistogram = PDISK_HISTOGRAM;
  1837. const
  1838. DISK_HISTOGRAM_SIZE = SizeOf(DISK_HISTOGRAM);
  1839. {$EXTERNALSYM DISK_HISTOGRAM_SIZE}
  1840. ///////////////////////////////////////////////////////
  1841. // //
  1842. // The following structures define disk debugging //
  1843. // capabilities. The IOCTLs are directed to one of //
  1844. // the two disk filter drivers. //
  1845. // //
  1846. // DISKPERF is a utilty for collecting disk request //
  1847. // statistics. //
  1848. // //
  1849. // SIMBAD is a utility for injecting faults in //
  1850. // IO requests to disks. //
  1851. // //
  1852. ///////////////////////////////////////////////////////
  1853. //
  1854. // The following structure is exchanged on an IOCTL_DISK_GET_PERFORMANCE
  1855. // request. This ioctl collects summary disk request statistics used
  1856. // in measuring performance.
  1857. //
  1858. type
  1859. PDISK_PERFORMANCE = ^DISK_PERFORMANCE;
  1860. {$EXTERNALSYM PDISK_PERFORMANCE}
  1861. _DISK_PERFORMANCE = record
  1862. BytesRead: LARGE_INTEGER;
  1863. BytesWritten: LARGE_INTEGER;
  1864. ReadTime: LARGE_INTEGER;
  1865. WriteTime: LARGE_INTEGER;
  1866. IdleTime: LARGE_INTEGER;
  1867. ReadCount: DWORD;
  1868. WriteCount: DWORD;
  1869. QueueDepth: DWORD;
  1870. SplitCount: DWORD;
  1871. QueryTime: LARGE_INTEGER;
  1872. StorageDeviceNumber: DWORD;
  1873. StorageManagerName: array [0..7] of WCHAR;
  1874. end;
  1875. {$EXTERNALSYM _DISK_PERFORMANCE}
  1876. DISK_PERFORMANCE = _DISK_PERFORMANCE;
  1877. {$EXTERNALSYM DISK_PERFORMANCE}
  1878. TDiskPerformance = DISK_PERFORMANCE;
  1879. PDiskPerformance = PDISK_PERFORMANCE;
  1880. //
  1881. // This structure defines the disk logging record. When disk logging
  1882. // is enabled, one of these is written to an internal buffer for each
  1883. // disk request.
  1884. //
  1885. PDISK_RECORD = ^DISK_RECORD;
  1886. {$EXTERNALSYM PDISK_RECORD}
  1887. _DISK_RECORD = record
  1888. ByteOffset: LARGE_INTEGER;
  1889. StartTime: LARGE_INTEGER;
  1890. EndTime: LARGE_INTEGER;
  1891. VirtualAddress: PVOID;
  1892. NumberOfBytes: DWORD;
  1893. DeviceNumber: BYTE;
  1894. ReadRequest: ByteBool;
  1895. end;
  1896. {$EXTERNALSYM _DISK_RECORD}
  1897. DISK_RECORD = _DISK_RECORD;
  1898. {$EXTERNALSYM DISK_RECORD}
  1899. TDiskRecord = DISK_RECORD;
  1900. PDiskRecord = PDISK_RECORD;
  1901. //
  1902. // The following structure is exchanged on an IOCTL_DISK_LOG request.
  1903. // Not all fields are valid with each function type.
  1904. //
  1905. PDISK_LOGGING = ^DISK_LOGGING;
  1906. {$EXTERNALSYM PDISK_LOGGING}
  1907. _DISK_LOGGING = record
  1908. Function_: BYTE;
  1909. BufferAddress: PVOID;
  1910. BufferSize: DWORD;
  1911. end;
  1912. {$EXTERNALSYM _DISK_LOGGING}
  1913. DISK_LOGGING = _DISK_LOGGING;
  1914. {$EXTERNALSYM DISK_LOGGING}
  1915. TDiskLogging = DISK_LOGGING;
  1916. PDiskLogging = PDISK_LOGGING;
  1917. //
  1918. // Disk logging functions
  1919. //
  1920. // Start disk logging. Only the Function and BufferSize fields are valid.
  1921. //
  1922. const
  1923. DISK_LOGGING_START = 0;
  1924. {$EXTERNALSYM DISK_LOGGING_START}
  1925. //
  1926. // Stop disk logging. Only the Function field is valid.
  1927. //
  1928. DISK_LOGGING_STOP = 1;
  1929. {$EXTERNALSYM DISK_LOGGING_STOP}
  1930. //
  1931. // Return disk log. All fields are valid. Data will be copied from internal
  1932. // buffer to buffer specified for the number of bytes requested.
  1933. //
  1934. DISK_LOGGING_DUMP = 2;
  1935. {$EXTERNALSYM DISK_LOGGING_DUMP}
  1936. //
  1937. // DISK BINNING
  1938. //
  1939. // DISKPERF will keep counters for IO that falls in each of these ranges.
  1940. // The application determines the number and size of the ranges.
  1941. // Joe Lin wanted me to keep it flexible as possible, for instance, IO
  1942. // sizes are interesting in ranges like 0-4096, 4097-16384, 16385-65536, 65537+.
  1943. //
  1944. DISK_BINNING = 3;
  1945. {$EXTERNALSYM DISK_BINNING}
  1946. //
  1947. // Bin types
  1948. //
  1949. type
  1950. _BIN_TYPES = (RequestSize, RequestLocation);
  1951. {$EXTERNALSYM _BIN_TYPES}
  1952. BIN_TYPES = _BIN_TYPES;
  1953. {$EXTERNALSYM BIN_TYPES}
  1954. TBinTypes = _BIN_TYPES;
  1955. //
  1956. // Bin ranges
  1957. //
  1958. PBIN_RANGE = ^BIN_RANGE;
  1959. {$EXTERNALSYM PBIN_RANGE}
  1960. _BIN_RANGE = record
  1961. StartValue: LARGE_INTEGER;
  1962. Length: LARGE_INTEGER;
  1963. end;
  1964. {$EXTERNALSYM _BIN_RANGE}
  1965. BIN_RANGE = _BIN_RANGE;
  1966. {$EXTERNALSYM BIN_RANGE}
  1967. TBinRange = BIN_RANGE;
  1968. PBinRange = PBIN_RANGE;
  1969. //
  1970. // Bin definition
  1971. //
  1972. PPERF_BIN = ^PERF_BIN;
  1973. {$EXTERNALSYM PPERF_BIN}
  1974. _PERF_BIN = record
  1975. NumberOfBins: DWORD;
  1976. TypeOfBin: DWORD;
  1977. BinsRanges: array [0..0] of BIN_RANGE;
  1978. end;
  1979. {$EXTERNALSYM _PERF_BIN}
  1980. PERF_BIN = _PERF_BIN;
  1981. {$EXTERNALSYM PERF_BIN}
  1982. TPerfBin = PERF_BIN;
  1983. PPerfBin = PPERF_BIN;
  1984. //
  1985. // Bin count
  1986. //
  1987. PBIN_COUNT = ^BIN_COUNT;
  1988. {$EXTERNALSYM PBIN_COUNT}
  1989. _BIN_COUNT = record
  1990. BinRange: BIN_RANGE;
  1991. BinCount: DWORD;
  1992. end;
  1993. {$EXTERNALSYM _BIN_COUNT}
  1994. BIN_COUNT = _BIN_COUNT;
  1995. {$EXTERNALSYM BIN_COUNT}
  1996. TBinCount = BIN_COUNT;
  1997. PBinCount = PBIN_COUNT;
  1998. //
  1999. // Bin results
  2000. //
  2001. PBIN_RESULTS = ^BIN_RESULTS;
  2002. {$EXTERNALSYM PBIN_RESULTS}
  2003. _BIN_RESULTS = record
  2004. NumberOfBins: DWORD;
  2005. BinCounts: array [0..0] of BIN_COUNT;
  2006. end;
  2007. {$EXTERNALSYM _BIN_RESULTS}
  2008. BIN_RESULTS = _BIN_RESULTS;
  2009. {$EXTERNALSYM BIN_RESULTS}
  2010. TBinResults = BIN_RESULTS;
  2011. PBinResults = PBIN_RESULTS;
  2012. //
  2013. // Data structures for SMART drive fault prediction.
  2014. //
  2015. // GETVERSIONINPARAMS contains the data returned from the
  2016. // Get Driver Version function.
  2017. //
  2018. //#include <pshpack1.h>
  2019. LPGETVERSIONINPARAMS = ^GETVERSIONINPARAMS;
  2020. {$EXTERNALSYM LPGETVERSIONINPARAMS}
  2021. _GETVERSIONINPARAMS = packed record
  2022. bVersion: BYTE; // Binary driver version.
  2023. bRevision: BYTE; // Binary driver revision.
  2024. bReserved: BYTE; // Not used.
  2025. bIDEDeviceMap: BYTE; // Bit map of IDE devices.
  2026. fCapabilities: DWORD; // Bit mask of driver capabilities.
  2027. dwReserved: array [0..3] of DWORD; // For future use.
  2028. end;
  2029. {$EXTERNALSYM _GETVERSIONINPARAMS}
  2030. GETVERSIONINPARAMS = _GETVERSIONINPARAMS;
  2031. {$EXTERNALSYM GETVERSIONINPARAMS}
  2032. TGetVersionInParams = GETVERSIONINPARAMS;
  2033. PGetVersionInParams = LPGETVERSIONINPARAMS;
  2034. //#include <poppack.h>
  2035. //
  2036. // Bits returned in the fCapabilities member of GETVERSIONINPARAMS
  2037. //
  2038. const
  2039. CAP_ATA_ID_CMD = 1; // ATA ID command supported
  2040. {$EXTERNALSYM CAP_ATA_ID_CMD}
  2041. CAP_ATAPI_ID_CMD = 2; // ATAPI ID command supported
  2042. {$EXTERNALSYM CAP_ATAPI_ID_CMD}
  2043. CAP_SMART_CMD = 4; // SMART commannds supported
  2044. {$EXTERNALSYM CAP_SMART_CMD}
  2045. //
  2046. // IDE registers
  2047. //
  2048. //#include <pshpack1.h>
  2049. type
  2050. LPIDEREGS = ^IDEREGS;
  2051. {$EXTERNALSYM LPIDEREGS}
  2052. _IDEREGS = packed record
  2053. bFeaturesReg: BYTE; // Used for specifying SMART "commands".
  2054. bSectorCountReg: BYTE; // IDE sector count register
  2055. bSectorNumberReg: BYTE; // IDE sector number register
  2056. bCylLowReg: BYTE; // IDE low order cylinder value
  2057. bCylHighReg: BYTE; // IDE high order cylinder value
  2058. bDriveHeadReg: BYTE; // IDE drive/head register
  2059. bCommandReg: BYTE; // Actual IDE command.
  2060. bReserved: BYTE; // reserved for future use. Must be zero.
  2061. end;
  2062. {$EXTERNALSYM _IDEREGS}
  2063. IDEREGS = _IDEREGS;
  2064. {$EXTERNALSYM IDEREGS}
  2065. TIdeRegs = IDEREGS;
  2066. PIdeRegs = LPIDEREGS;
  2067. //#include <poppack.h>
  2068. //
  2069. // Valid values for the bCommandReg member of IDEREGS.
  2070. //
  2071. const
  2072. ATAPI_ID_CMD = $A1; // Returns ID sector for ATAPI.
  2073. {$EXTERNALSYM ATAPI_ID_CMD}
  2074. ID_CMD = $EC; // Returns ID sector for ATA.
  2075. {$EXTERNALSYM ID_CMD}
  2076. SMART_CMD = $B0; // Performs SMART cmd.
  2077. // Requires valid bFeaturesReg,
  2078. // bCylLowReg, and bCylHighReg
  2079. {$EXTERNALSYM SMART_CMD}
  2080. //
  2081. // Cylinder register defines for SMART command
  2082. //
  2083. SMART_CYL_LOW = $4F;
  2084. {$EXTERNALSYM SMART_CYL_LOW}
  2085. SMART_CYL_HI = $C2;
  2086. {$EXTERNALSYM SMART_CYL_HI}
  2087. //
  2088. // SENDCMDINPARAMS contains the input parameters for the
  2089. // Send Command to Drive function.
  2090. //
  2091. //#include <pshpack1.h>
  2092. type
  2093. LPSENDCMDINPARAMS = ^SENDCMDINPARAMS;
  2094. {$EXTERNALSYM LPSENDCMDINPARAMS}
  2095. _SENDCMDINPARAMS = packed record
  2096. cBufferSize: DWORD; // Buffer size in bytes
  2097. irDriveRegs: IDEREGS; // Structure with drive register values.
  2098. bDriveNumber: BYTE; // Physical drive number to send
  2099. // command to (0,1,2,3).
  2100. bReserved: array [0..2] of BYTE; // Reserved for future expansion.
  2101. dwReserved: array [0..3] of DWORD; // For future use.
  2102. bBuffer: array [0..0] of BYTE; // Input buffer.
  2103. end;
  2104. {$EXTERNALSYM _SENDCMDINPARAMS}
  2105. SENDCMDINPARAMS = _SENDCMDINPARAMS;
  2106. {$EXTERNALSYM SENDCMDINPARAMS}
  2107. TSendCmdInParams = SENDCMDINPARAMS;
  2108. PSendCmdInParams = LPSENDCMDINPARAMS;
  2109. //#include <poppack.h>
  2110. //
  2111. // Status returned from driver
  2112. //
  2113. //#include <pshpack1.h>
  2114. LPDRIVERSTATUS = ^DRIVERSTATUS;
  2115. {$EXTERNALSYM LPDRIVERSTATUS}
  2116. _DRIVERSTATUS = packed record
  2117. bDriverError: BYTE; // Error code from driver,
  2118. // or 0 if no error.
  2119. bIDEError: BYTE; // Contents of IDE Error register.
  2120. // Only valid when bDriverError
  2121. // is SMART_IDE_ERROR.
  2122. bReserved: array [0..1] of BYTE; // Reserved for future expansion.
  2123. dwReserved: array [0..1] of DWORD; // Reserved for future expansion.
  2124. end;
  2125. {$EXTERNALSYM _DRIVERSTATUS}
  2126. DRIVERSTATUS = _DRIVERSTATUS;
  2127. {$EXTERNALSYM DRIVERSTATUS}
  2128. TDriverStatus = DRIVERSTATUS;
  2129. PDriverStatus = LPDRIVERSTATUS;
  2130. //#include <poppack.h>
  2131. //
  2132. // bDriverError values
  2133. //
  2134. const
  2135. SMART_NO_ERROR = 0; // No error
  2136. {$EXTERNALSYM SMART_NO_ERROR}
  2137. SMART_IDE_ERROR = 1; // Error from IDE controller
  2138. {$EXTERNALSYM SMART_IDE_ERROR}
  2139. SMART_INVALID_FLAG = 2; // Invalid command flag
  2140. {$EXTERNALSYM SMART_INVALID_FLAG}
  2141. SMART_INVALID_COMMAND = 3; // Invalid command byte
  2142. {$EXTERNALSYM SMART_INVALID_COMMAND}
  2143. SMART_INVALID_BUFFER = 4; // Bad buffer (null, invalid addr..)
  2144. {$EXTERNALSYM SMART_INVALID_BUFFER}
  2145. SMART_INVALID_DRIVE = 5; // Drive number not valid
  2146. {$EXTERNALSYM SMART_INVALID_DRIVE}
  2147. SMART_INVALID_IOCTL = 6; // Invalid IOCTL
  2148. {$EXTERNALSYM SMART_INVALID_IOCTL}
  2149. SMART_ERROR_NO_MEM = 7; // Could not lock user's buffer
  2150. {$EXTERNALSYM SMART_ERROR_NO_MEM}
  2151. SMART_INVALID_REGISTER = 8; // Some IDE Register not valid
  2152. {$EXTERNALSYM SMART_INVALID_REGISTER}
  2153. SMART_NOT_SUPPORTED = 9; // Invalid cmd flag set
  2154. {$EXTERNALSYM SMART_NOT_SUPPORTED}
  2155. SMART_NO_IDE_DEVICE = 10; // Cmd issued to device not present
  2156. {$EXTERNALSYM SMART_NO_IDE_DEVICE}
  2157. // although drive number is valid
  2158. //
  2159. // SMART sub commands for execute offline diags
  2160. //
  2161. SMART_OFFLINE_ROUTINE_OFFLINE = 0;
  2162. {$EXTERNALSYM SMART_OFFLINE_ROUTINE_OFFLINE}
  2163. SMART_SHORT_SELFTEST_OFFLINE = 1;
  2164. {$EXTERNALSYM SMART_SHORT_SELFTEST_OFFLINE}
  2165. SMART_EXTENDED_SELFTEST_OFFLINE = 2;
  2166. {$EXTERNALSYM SMART_EXTENDED_SELFTEST_OFFLINE}
  2167. SMART_ABORT_OFFLINE_SELFTEST = 127;
  2168. {$EXTERNALSYM SMART_ABORT_OFFLINE_SELFTEST}
  2169. SMART_SHORT_SELFTEST_CAPTIVE = 129;
  2170. {$EXTERNALSYM SMART_SHORT_SELFTEST_CAPTIVE}
  2171. SMART_EXTENDED_SELFTEST_CAPTIVE = 130;
  2172. {$EXTERNALSYM SMART_EXTENDED_SELFTEST_CAPTIVE}
  2173. //#include <pshpack1.h>
  2174. type
  2175. LPSENDCMDOUTPARAMS = ^SENDCMDOUTPARAMS;
  2176. {$EXTERNALSYM LPSENDCMDOUTPARAMS}
  2177. _SENDCMDOUTPARAMS = packed record
  2178. cBufferSize: DWORD; // Size of bBuffer in bytes
  2179. DriverStatus: DRIVERSTATUS; // Driver status structure.
  2180. bBuffer: array [0..0] of BYTE; // Buffer of arbitrary length in which to store the data read from the // drive.
  2181. end;
  2182. {$EXTERNALSYM _SENDCMDOUTPARAMS}
  2183. SENDCMDOUTPARAMS = _SENDCMDOUTPARAMS;
  2184. {$EXTERNALSYM SENDCMDOUTPARAMS}
  2185. TSendCmdOutParams = SENDCMDOUTPARAMS;
  2186. PSendCmdOutParams = LPSENDCMDOUTPARAMS;
  2187. //#include <poppack.h>
  2188. const
  2189. READ_ATTRIBUTE_BUFFER_SIZE = 512;
  2190. {$EXTERNALSYM READ_ATTRIBUTE_BUFFER_SIZE}
  2191. IDENTIFY_BUFFER_SIZE = 512;
  2192. {$EXTERNALSYM IDENTIFY_BUFFER_SIZE}
  2193. READ_THRESHOLD_BUFFER_SIZE = 512;
  2194. {$EXTERNALSYM READ_THRESHOLD_BUFFER_SIZE}
  2195. SMART_LOG_SECTOR_SIZE = 512;
  2196. {$EXTERNALSYM SMART_LOG_SECTOR_SIZE}
  2197. //
  2198. // Feature register defines for SMART "sub commands"
  2199. //
  2200. READ_ATTRIBUTES = $D0;
  2201. {$EXTERNALSYM READ_ATTRIBUTES}
  2202. READ_THRESHOLDS = $D1;
  2203. {$EXTERNALSYM READ_THRESHOLDS}
  2204. ENABLE_DISABLE_AUTOSAVE = $D2;
  2205. {$EXTERNALSYM ENABLE_DISABLE_AUTOSAVE}
  2206. SAVE_ATTRIBUTE_VALUES = $D3;
  2207. {$EXTERNALSYM SAVE_ATTRIBUTE_VALUES}
  2208. EXECUTE_OFFLINE_DIAGS = $D4;
  2209. {$EXTERNALSYM EXECUTE_OFFLINE_DIAGS}
  2210. SMART_READ_LOG = $D5;
  2211. {$EXTERNALSYM SMART_READ_LOG}
  2212. SMART_WRITE_LOG = $d6;
  2213. {$EXTERNALSYM SMART_WRITE_LOG}
  2214. ENABLE_SMART = $D8;
  2215. {$EXTERNALSYM ENABLE_SMART}
  2216. DISABLE_SMART = $D9;
  2217. {$EXTERNALSYM DISABLE_SMART}
  2218. RETURN_SMART_STATUS = $DA;
  2219. {$EXTERNALSYM RETURN_SMART_STATUS}
  2220. ENABLE_DISABLE_AUTO_OFFLINE = $DB;
  2221. {$EXTERNALSYM ENABLE_DISABLE_AUTO_OFFLINE}
  2222. IOCTL_CHANGER_BASE = FILE_DEVICE_CHANGER;
  2223. {$EXTERNALSYM IOCTL_CHANGER_BASE}
  2224. IOCTL_CHANGER_GET_PARAMETERS = (
  2225. (IOCTL_CHANGER_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  2226. ($0000 shl 2) or METHOD_BUFFERED);
  2227. {$EXTERNALSYM IOCTL_CHANGER_GET_PARAMETERS}
  2228. IOCTL_CHANGER_GET_STATUS = (
  2229. (IOCTL_CHANGER_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  2230. ($0001 shl 2) or METHOD_BUFFERED);
  2231. {$EXTERNALSYM IOCTL_CHANGER_GET_STATUS}
  2232. IOCTL_CHANGER_GET_PRODUCT_DATA = (
  2233. (IOCTL_CHANGER_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  2234. ($0002 shl 2) or METHOD_BUFFERED);
  2235. {$EXTERNALSYM IOCTL_CHANGER_GET_PRODUCT_DATA}
  2236. IOCTL_CHANGER_SET_ACCESS = (
  2237. (IOCTL_CHANGER_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  2238. ($0004 shl 2) or METHOD_BUFFERED);
  2239. {$EXTERNALSYM IOCTL_CHANGER_SET_ACCESS}
  2240. IOCTL_CHANGER_GET_ELEMENT_STATUS = (
  2241. (IOCTL_CHANGER_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  2242. ($0005 shl 2) or METHOD_BUFFERED);
  2243. {$EXTERNALSYM IOCTL_CHANGER_GET_ELEMENT_STATUS}
  2244. IOCTL_CHANGER_INITIALIZE_ELEMENT_STATUS = (
  2245. (IOCTL_CHANGER_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  2246. ($0006 shl 2) or METHOD_BUFFERED);
  2247. {$EXTERNALSYM IOCTL_CHANGER_INITIALIZE_ELEMENT_STATUS}
  2248. IOCTL_CHANGER_SET_POSITION = (
  2249. (IOCTL_CHANGER_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  2250. ($0007 shl 2) or METHOD_BUFFERED);
  2251. {$EXTERNALSYM IOCTL_CHANGER_SET_POSITION}
  2252. IOCTL_CHANGER_EXCHANGE_MEDIUM = (
  2253. (IOCTL_CHANGER_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  2254. ($0008 shl 2) or METHOD_BUFFERED);
  2255. {$EXTERNALSYM IOCTL_CHANGER_EXCHANGE_MEDIUM}
  2256. IOCTL_CHANGER_MOVE_MEDIUM = (
  2257. (IOCTL_CHANGER_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  2258. ($0009 shl 2) or METHOD_BUFFERED);
  2259. {$EXTERNALSYM IOCTL_CHANGER_MOVE_MEDIUM}
  2260. IOCTL_CHANGER_REINITIALIZE_TRANSPORT = (
  2261. (IOCTL_CHANGER_BASE shl 16) or (FILE_READ_ACCESS shl 14) or
  2262. ($000A shl 2) or METHOD_BUFFERED);
  2263. {$EXTERNALSYM IOCTL_CHANGER_REINITIALIZE_TRANSPORT}
  2264. IOCTL_CHANGER_QUERY_VOLUME_TAGS = (
  2265. (IOCTL_CHANGER_BASE shl 16) or ((FILE_READ_ACCESS or FILE_WRITE_ACCESS) shl 14) or
  2266. ($000B shl 2) or METHOD_BUFFERED);
  2267. {$EXTERNALSYM IOCTL_CHANGER_QUERY_VOLUME_TAGS}
  2268. MAX_VOLUME_ID_SIZE = 36;
  2269. {$EXTERNALSYM MAX_VOLUME_ID_SIZE}
  2270. MAX_VOLUME_TEMPLATE_SIZE = 40;
  2271. {$EXTERNALSYM MAX_VOLUME_TEMPLATE_SIZE}
  2272. VENDOR_ID_LENGTH = 8;
  2273. {$EXTERNALSYM VENDOR_ID_LENGTH}
  2274. PRODUCT_ID_LENGTH = 16;
  2275. {$EXTERNALSYM PRODUCT_ID_LENGTH}
  2276. REVISION_LENGTH = 4;
  2277. {$EXTERNALSYM REVISION_LENGTH}
  2278. SERIAL_NUMBER_LENGTH = 32;
  2279. {$EXTERNALSYM SERIAL_NUMBER_LENGTH}
  2280. //
  2281. // Common structures describing elements.
  2282. //
  2283. type
  2284. _ELEMENT_TYPE = (
  2285. AllElements, // As defined by SCSI
  2286. ChangerTransport, // As defined by SCSI
  2287. ChangerSlot, // As defined by SCSI
  2288. ChangerIEPort, // As defined by SCSI
  2289. ChangerDrive, // As defined by SCSI
  2290. ChangerDoor, // Front panel, used to access internal of cabinet.
  2291. ChangerKeypad, // Keypad/input on front panel.
  2292. ChangerMaxElement); // Placeholder only. Not a valid type.
  2293. {$EXTERNALSYM _ELEMENT_TYPE}
  2294. ELEMENT_TYPE = _ELEMENT_TYPE;
  2295. {$EXTERNALSYM ELEMENT_TYPE}
  2296. PELEMENT_TYPE = ^ELEMENT_TYPE;
  2297. {$EXTERNALSYM PELEMENT_TYPE}
  2298. TElementType = ELEMENT_TYPE;
  2299. PElementType = PELEMENT_TYPE;
  2300. PCHANGER_ELEMENT = ^CHANGER_ELEMENT;
  2301. {$EXTERNALSYM PCHANGER_ELEMENT}
  2302. _CHANGER_ELEMENT = record
  2303. ElementType: ELEMENT_TYPE;
  2304. ElementAddress: DWORD;
  2305. end;
  2306. {$EXTERNALSYM _CHANGER_ELEMENT}
  2307. CHANGER_ELEMENT = _CHANGER_ELEMENT;
  2308. {$EXTERNALSYM CHANGER_ELEMENT}
  2309. TChangerElement = CHANGER_ELEMENT;
  2310. PChangerElement = PCHANGER_ELEMENT;
  2311. PCHANGER_ELEMENT_LIST = ^CHANGER_ELEMENT_LIST;
  2312. {$EXTERNALSYM PCHANGER_ELEMENT_LIST}
  2313. _CHANGER_ELEMENT_LIST = record
  2314. Element: CHANGER_ELEMENT;
  2315. NumberOfElements: DWORD;
  2316. end;
  2317. {$EXTERNALSYM _CHANGER_ELEMENT_LIST}
  2318. CHANGER_ELEMENT_LIST = _CHANGER_ELEMENT_LIST;
  2319. {$EXTERNALSYM CHANGER_ELEMENT_LIST}
  2320. TChangerElementList = CHANGER_ELEMENT_LIST;
  2321. PChangerElementList = PCHANGER_ELEMENT_LIST;
  2322. //
  2323. // Definitions for IOCTL_CHANGER_GET_PARAMETERS
  2324. //
  2325. //
  2326. // Definitions for Features0 of GET_CHANGER_PARAMETERS
  2327. //
  2328. const
  2329. CHANGER_BAR_CODE_SCANNER_INSTALLED = $00000001; // The medium-changer has a bar code scanner installed.
  2330. {$EXTERNALSYM CHANGER_BAR_CODE_SCANNER_INSTALLED}
  2331. CHANGER_INIT_ELEM_STAT_WITH_RANGE = $00000002; // The medium-changer has the ability to initialize elements within a specified range.
  2332. {$EXTERNALSYM CHANGER_INIT_ELEM_STAT_WITH_RANGE}
  2333. CHANGER_CLOSE_IEPORT = $00000004; // The medium-changer has the ability to close the i/e port door.
  2334. {$EXTERNALSYM CHANGER_CLOSE_IEPORT}
  2335. CHANGER_OPEN_IEPORT = $00000008; // The medium-changer can open the i/e port door.
  2336. {$EXTERNALSYM CHANGER_OPEN_IEPORT}
  2337. CHANGER_STATUS_NON_VOLATILE = $00000010; // The medium-changer uses non-volatile memory for element status information.
  2338. {$EXTERNALSYM CHANGER_STATUS_NON_VOLATILE}
  2339. CHANGER_EXCHANGE_MEDIA = $00000020; // The medium-changer supports exchange operations.
  2340. {$EXTERNALSYM CHANGER_EXCHANGE_MEDIA}
  2341. CHANGER_CLEANER_SLOT = $00000040; // The medium-changer has a fixed slot designated for cleaner cartridges.
  2342. {$EXTERNALSYM CHANGER_CLEANER_SLOT}
  2343. CHANGER_LOCK_UNLOCK = $00000080; // The medium-changer can be (un)secured to (allow)prevent media removal.
  2344. {$EXTERNALSYM CHANGER_LOCK_UNLOCK}
  2345. CHANGER_CARTRIDGE_MAGAZINE = $00000100; // The medium-changer uses cartridge magazines for some storage slots.
  2346. {$EXTERNALSYM CHANGER_CARTRIDGE_MAGAZINE}
  2347. CHANGER_MEDIUM_FLIP = $00000200; // The medium-changer can flip medium.
  2348. {$EXTERNALSYM CHANGER_MEDIUM_FLIP}
  2349. CHANGER_POSITION_TO_ELEMENT = $00000400; // The medium-changer can position the transport to a particular element.
  2350. {$EXTERNALSYM CHANGER_POSITION_TO_ELEMENT}
  2351. CHANGER_REPORT_IEPORT_STATE = $00000800; // The medium-changer can determine whether media is present
  2352. {$EXTERNALSYM CHANGER_REPORT_IEPORT_STATE}
  2353. // in the IE Port.
  2354. CHANGER_STORAGE_DRIVE = $00001000; // The medium-changer can use a drive as an independent storage element.
  2355. {$EXTERNALSYM CHANGER_STORAGE_DRIVE}
  2356. CHANGER_STORAGE_IEPORT = $00002000; // The medium-changer can use a i/e port as an independent storage element.
  2357. {$EXTERNALSYM CHANGER_STORAGE_IEPORT}
  2358. CHANGER_STORAGE_SLOT = $00004000; // The medium-changer can use a slot as an independent storage element.
  2359. {$EXTERNALSYM CHANGER_STORAGE_SLOT}
  2360. CHANGER_STORAGE_TRANSPORT = $00008000; // The medium-changer can use a transport as an independent storage element.
  2361. {$EXTERNALSYM CHANGER_STORAGE_TRANSPORT}
  2362. CHANGER_DRIVE_CLEANING_REQUIRED = $00010000; // The drives controlled by the medium changer require periodic cleaning
  2363. {$EXTERNALSYM CHANGER_DRIVE_CLEANING_REQUIRED}
  2364. // initiated by an application.
  2365. CHANGER_PREDISMOUNT_EJECT_REQUIRED = $00020000; // The medium-changer requires a drive eject command to be issued, before a changer
  2366. {$EXTERNALSYM CHANGER_PREDISMOUNT_EJECT_REQUIRED}
  2367. // move / exchange command can be issued to the drive.
  2368. CHANGER_CLEANER_ACCESS_NOT_VALID = $00040000; // The access bit in GES isn't valid for cleaner cartridges.
  2369. {$EXTERNALSYM CHANGER_CLEANER_ACCESS_NOT_VALID}
  2370. CHANGER_PREMOUNT_EJECT_REQUIRED = $00080000; // The medium-changer requires a drive eject command to be issued
  2371. {$EXTERNALSYM CHANGER_PREMOUNT_EJECT_REQUIRED}
  2372. // before a move / exchange command can be issued with the drive as src/dst.
  2373. CHANGER_VOLUME_IDENTIFICATION = $00100000; // The medium-changer supports volume identification.
  2374. {$EXTERNALSYM CHANGER_VOLUME_IDENTIFICATION}
  2375. CHANGER_VOLUME_SEARCH = $00200000; // The medium-changer can search for volume information.
  2376. {$EXTERNALSYM CHANGER_VOLUME_SEARCH}
  2377. CHANGER_VOLUME_ASSERT = $00400000; // The medium-changer can verify volume information.
  2378. {$EXTERNALSYM CHANGER_VOLUME_ASSERT}
  2379. CHANGER_VOLUME_REPLACE = $00800000; // The medium-changer can replace volume information.
  2380. {$EXTERNALSYM CHANGER_VOLUME_REPLACE}
  2381. CHANGER_VOLUME_UNDEFINE = $01000000; // The medium-changer can undefine volume information.
  2382. {$EXTERNALSYM CHANGER_VOLUME_UNDEFINE}
  2383. CHANGER_SERIAL_NUMBER_VALID = $04000000; // The serial number reported in GetProductData is valid
  2384. {$EXTERNALSYM CHANGER_SERIAL_NUMBER_VALID}
  2385. // and unique.
  2386. CHANGER_DEVICE_REINITIALIZE_CAPABLE = $08000000; // The medium-changer can be issued a ChangerReinitializeUnit.
  2387. {$EXTERNALSYM CHANGER_DEVICE_REINITIALIZE_CAPABLE}
  2388. CHANGER_KEYPAD_ENABLE_DISABLE = $10000000; // Indicates that the keypad can be enabled/disabled.
  2389. {$EXTERNALSYM CHANGER_KEYPAD_ENABLE_DISABLE}
  2390. CHANGER_DRIVE_EMPTY_ON_DOOR_ACCESS = $20000000; // Drives must be empty before access via the door is possible.
  2391. {$EXTERNALSYM CHANGER_DRIVE_EMPTY_ON_DOOR_ACCESS}
  2392. CHANGER_RESERVED_BIT = DWORD($80000000); // Will be used to indicate Features1 capability bits.
  2393. {$EXTERNALSYM CHANGER_RESERVED_BIT}
  2394. //
  2395. // Definitions for Features1 of GET_CHANGER_PARAMETERS
  2396. //
  2397. CHANGER_PREDISMOUNT_ALIGN_TO_SLOT = DWORD($80000001); // The transport must be prepositioned to the slot prior to ejecting the media.
  2398. {$EXTERNALSYM CHANGER_PREDISMOUNT_ALIGN_TO_SLOT}
  2399. CHANGER_PREDISMOUNT_ALIGN_TO_DRIVE = DWORD($80000002); // The transport must be prepositioned to the drive prior to ejecting the media.
  2400. {$EXTERNALSYM CHANGER_PREDISMOUNT_ALIGN_TO_DRIVE}
  2401. CHANGER_CLEANER_AUTODISMOUNT = DWORD($80000004); // The device will move the cleaner cartridge back into the slot when cleaning has completed.
  2402. {$EXTERNALSYM CHANGER_CLEANER_AUTODISMOUNT}
  2403. CHANGER_TRUE_EXCHANGE_CAPABLE = DWORD($80000008); // Device can do src -> dest2 exchanges.
  2404. {$EXTERNALSYM CHANGER_TRUE_EXCHANGE_CAPABLE}
  2405. CHANGER_SLOTS_USE_TRAYS = DWORD($80000010); // Slots have removable trays, requiring multiple moves for inject/eject.
  2406. {$EXTERNALSYM CHANGER_SLOTS_USE_TRAYS}
  2407. CHANGER_RTN_MEDIA_TO_ORIGINAL_ADDR = DWORD($80000020); // Media must be returned to the slot from which it originated after a move to another element.
  2408. {$EXTERNALSYM CHANGER_RTN_MEDIA_TO_ORIGINAL_ADDR}
  2409. CHANGER_CLEANER_OPS_NOT_SUPPORTED = DWORD($80000040); // Automated cleaning operations are not supported on this device.
  2410. {$EXTERNALSYM CHANGER_CLEANER_OPS_NOT_SUPPORTED}
  2411. CHANGER_IEPORT_USER_CONTROL_OPEN = DWORD($80000080); // Indicates that user action is necessary to open a closed ieport.
  2412. {$EXTERNALSYM CHANGER_IEPORT_USER_CONTROL_OPEN}
  2413. CHANGER_IEPORT_USER_CONTROL_CLOSE = DWORD($80000100); // Indicates that user action is necessary to close an opened ieport.
  2414. {$EXTERNALSYM CHANGER_IEPORT_USER_CONTROL_CLOSE}
  2415. CHANGER_MOVE_EXTENDS_IEPORT = DWORD($80000200); // Indicates that a move media to the ieport extends the tray.
  2416. {$EXTERNALSYM CHANGER_MOVE_EXTENDS_IEPORT}
  2417. CHANGER_MOVE_RETRACTS_IEPORT = DWORD($80000400); // Indicates that a move media from the ieport retracts the tray.
  2418. {$EXTERNALSYM CHANGER_MOVE_RETRACTS_IEPORT}
  2419. //
  2420. // Definitions for MoveFrom, ExchangeFrom, and PositionCapabilities
  2421. //
  2422. CHANGER_TO_TRANSPORT = $01; // The device can carry out the operation to a transport from the specified element.
  2423. {$EXTERNALSYM CHANGER_TO_TRANSPORT}
  2424. CHANGER_TO_SLOT = $02; // The device can carry out the operation to a slot from the specified element.
  2425. {$EXTERNALSYM CHANGER_TO_SLOT}
  2426. CHANGER_TO_IEPORT = $04; // The device can carry out the operation to an IE Port from the specified element.
  2427. {$EXTERNALSYM CHANGER_TO_IEPORT}
  2428. CHANGER_TO_DRIVE = $08; // The device can carry out the operation to a drive from the specified element.
  2429. {$EXTERNALSYM CHANGER_TO_DRIVE}
  2430. //
  2431. // Definitions for LockUnlockCapabilities
  2432. //
  2433. LOCK_UNLOCK_IEPORT = $01; // The device can lock/unlock the ieport(s).
  2434. {$EXTERNALSYM LOCK_UNLOCK_IEPORT}
  2435. LOCK_UNLOCK_DOOR = $02; // The device can lock/unlock the door(s).
  2436. {$EXTERNALSYM LOCK_UNLOCK_DOOR}
  2437. LOCK_UNLOCK_KEYPAD = $04; // The device can lock/unlock the keypad.
  2438. {$EXTERNALSYM LOCK_UNLOCK_KEYPAD}
  2439. type
  2440. PGET_CHANGER_PARAMETERS = ^GET_CHANGER_PARAMETERS;
  2441. {$EXTERNALSYM PGET_CHANGER_PARAMETERS}
  2442. _GET_CHANGER_PARAMETERS = record
  2443. //
  2444. // Size of the structure. Can be used for versioning.
  2445. //
  2446. Size: DWORD;
  2447. //
  2448. // Number of N element(s) as defined by the Element Address Page (or equivalent...).
  2449. //
  2450. NumberTransportElements: WORD;
  2451. NumberStorageElements: WORD; // for data cartridges only
  2452. NumberCleanerSlots: WORD; // for cleaner cartridges
  2453. NumberIEElements: WORD;
  2454. NumberDataTransferElements: WORD;
  2455. //
  2456. // Number of doors/front panels (allows user entry into the cabinet).
  2457. //
  2458. NumberOfDoors: WORD;
  2459. //
  2460. // The device-specific address (from user manual of the device) of the first N element. Used
  2461. // by the UI to relate the various elements to the user.
  2462. //
  2463. FirstSlotNumber: WORD;
  2464. FirstDriveNumber: WORD;
  2465. FirstTransportNumber: WORD;
  2466. FirstIEPortNumber: WORD;
  2467. FirstCleanerSlotAddress: WORD;
  2468. //
  2469. // Indicates the capacity of each magazine, if they exist.
  2470. //
  2471. MagazineSize: WORD;
  2472. //
  2473. // Specifies the approximate number of seconds for when a cleaning should be completed.
  2474. // Only applicable if drive cleaning is supported. See Features0.
  2475. //
  2476. DriveCleanTimeout: DWORD;
  2477. //
  2478. // See features bits, above.
  2479. //
  2480. Features0: DWORD;
  2481. Features1: DWORD;
  2482. //
  2483. // Bitmask defining Move from N element to element. Defined by Device Capabilities Page (or equivalent).
  2484. // AND-masking with the TO_XXX values will indicate legal destinations.
  2485. //
  2486. MoveFromTransport: BYTE;
  2487. MoveFromSlot: BYTE;
  2488. MoveFromIePort: BYTE;
  2489. MoveFromDrive: BYTE;
  2490. //
  2491. // Bitmask defining Exchange from N element to element. Defined by Device Capabilities Page (or equivalent).
  2492. // AND-masking with the TO_XXX values will indicate legal destinations.
  2493. //
  2494. ExchangeFromTransport: BYTE;
  2495. ExchangeFromSlot: BYTE;
  2496. ExchangeFromIePort: BYTE;
  2497. ExchangeFromDrive: BYTE;
  2498. //
  2499. // Bitmask defining which elements are capable of lock/unlock. Valid only if
  2500. // CHANGER_LOCK_UNLOCK is set in Features0.
  2501. //
  2502. LockUnlockCapabilities: BYTE;
  2503. //
  2504. // Bitmask defining which elements valid for positioning operations. Valid only if
  2505. // CHANGER_POSITION_TO_ELEMENT is set in Features0.
  2506. //
  2507. PositionCapabilities: BYTE;
  2508. //
  2509. // For future expansion.
  2510. //
  2511. Reserved1: array [0..1] of BYTE;
  2512. Reserved2: array [0..1] of DWORD;
  2513. end;
  2514. {$EXTERNALSYM _GET_CHANGER_PARAMETERS}
  2515. GET_CHANGER_PARAMETERS = _GET_CHANGER_PARAMETERS;
  2516. {$EXTERNALSYM GET_CHANGER_PARAMETERS}
  2517. TGetChangerParameters = GET_CHANGER_PARAMETERS;
  2518. PGetChangerParameters = PGET_CHANGER_PARAMETERS;
  2519. //
  2520. // Definitions for IOCTL_CHANGER_GET_PRODUCT_DATA
  2521. //
  2522. PCHANGER_PRODUCT_DATA = ^CHANGER_PRODUCT_DATA;
  2523. {$EXTERNALSYM PCHANGER_PRODUCT_DATA}
  2524. _CHANGER_PRODUCT_DATA = record
  2525. //
  2526. // Device manufacturer's name - based on inquiry data
  2527. //
  2528. VendorId: array [0..VENDOR_ID_LENGTH - 1] of BYTE;
  2529. //
  2530. // Product identification as defined by the vendor - based on Inquiry data
  2531. //
  2532. ProductId: array [0..PRODUCT_ID_LENGTH - 1] of BYTE;
  2533. //
  2534. // Product revision as defined by the vendor.
  2535. //
  2536. Revision: array [0..REVISION_LENGTH - 1] of BYTE;
  2537. //
  2538. // Vendor unique value used to globally identify this device. Can
  2539. // be from Vital Product Data, for example.
  2540. //
  2541. SerialNumber: array [0..SERIAL_NUMBER_LENGTH - 1] of BYTE;
  2542. //
  2543. // Indicates device type of data transports, as defined by SCSI-2.
  2544. //
  2545. DeviceType: BYTE;
  2546. end;
  2547. {$EXTERNALSYM _CHANGER_PRODUCT_DATA}
  2548. CHANGER_PRODUCT_DATA = _CHANGER_PRODUCT_DATA;
  2549. {$EXTERNALSYM CHANGER_PRODUCT_DATA}
  2550. TChangerProductData = CHANGER_PRODUCT_DATA;
  2551. PChangerProductData = PCHANGER_PRODUCT_DATA;
  2552. //
  2553. // Definitions for IOCTL_CHANGER_SET_ACCESS
  2554. //
  2555. const
  2556. LOCK_ELEMENT = 0;
  2557. {$EXTERNALSYM LOCK_ELEMENT}
  2558. UNLOCK_ELEMENT = 1;
  2559. {$EXTERNALSYM UNLOCK_ELEMENT}
  2560. EXTEND_IEPORT = 2;
  2561. {$EXTERNALSYM EXTEND_IEPORT}
  2562. RETRACT_IEPORT = 3;
  2563. {$EXTERNALSYM RETRACT_IEPORT}
  2564. type
  2565. PCHANGER_SET_ACCESS = ^CHANGER_SET_ACCESS;
  2566. {$EXTERNALSYM PCHANGER_SET_ACCESS}
  2567. _CHANGER_SET_ACCESS = record
  2568. //
  2569. // Element can be ChangerIEPort, ChangerDoor, ChangerKeypad
  2570. //
  2571. Element: CHANGER_ELEMENT;
  2572. //
  2573. // See above for possible operations.
  2574. //
  2575. Control: DWORD;
  2576. end;
  2577. {$EXTERNALSYM _CHANGER_SET_ACCESS}
  2578. CHANGER_SET_ACCESS = _CHANGER_SET_ACCESS;
  2579. {$EXTERNALSYM CHANGER_SET_ACCESS}
  2580. TChangerSetAccess = CHANGER_SET_ACCESS;
  2581. PChangerSetAccess = PCHANGER_SET_ACCESS;
  2582. //
  2583. // Definitions for IOCTL_CHANGER_GET_ELEMENT_STATUS
  2584. //
  2585. //
  2586. // Input buffer.
  2587. //
  2588. PCHANGER_READ_ELEMENT_STATUS = ^CHANGER_READ_ELEMENT_STATUS;
  2589. {$EXTERNALSYM PCHANGER_READ_ELEMENT_STATUS}
  2590. _CHANGER_READ_ELEMENT_STATUS = record
  2591. //
  2592. // List describing the elements and range on which to return information.
  2593. //
  2594. ElementList: CHANGER_ELEMENT_LIST;
  2595. //
  2596. // Indicates whether volume tag information is to be returned.
  2597. //
  2598. VolumeTagInfo: ByteBool;
  2599. end;
  2600. {$EXTERNALSYM _CHANGER_READ_ELEMENT_STATUS}
  2601. CHANGER_READ_ELEMENT_STATUS = _CHANGER_READ_ELEMENT_STATUS;
  2602. {$EXTERNALSYM CHANGER_READ_ELEMENT_STATUS}
  2603. TChangerReadElementStatus = CHANGER_READ_ELEMENT_STATUS;
  2604. PChangerReadElementStatus = PCHANGER_READ_ELEMENT_STATUS;
  2605. //
  2606. // Output buffer.
  2607. //
  2608. PCHANGER_ELEMENT_STATUS = ^CHANGER_ELEMENT_STATUS;
  2609. {$EXTERNALSYM PCHANGER_ELEMENT_STATUS}
  2610. _CHANGER_ELEMENT_STATUS = record
  2611. //
  2612. // Element to which this structure refers.
  2613. //
  2614. Element: CHANGER_ELEMENT;
  2615. //
  2616. // Address of the element from which the media was originally moved.
  2617. // Valid if ELEMENT_STATUS_SVALID bit of Flags DWORD is set.
  2618. // Needs to be converted to a zero-based offset from the device-unique value.
  2619. //
  2620. SrcElementAddress: CHANGER_ELEMENT;
  2621. //
  2622. // See below.
  2623. //
  2624. Flags: DWORD;
  2625. //
  2626. // See below for possible values.
  2627. //
  2628. ExceptionCode: DWORD;
  2629. //
  2630. // Scsi Target Id of this element.
  2631. // Valid only if ELEMENT_STATUS_ID_VALID is set in Flags.
  2632. //
  2633. TargetId: BYTE;
  2634. //
  2635. // LogicalUnitNumber of this element.
  2636. // Valid only if ELEMENT_STATUS_LUN_VALID is set in Flags.
  2637. //
  2638. Lun: BYTE;
  2639. Reserved: WORD;
  2640. //
  2641. // Primary volume identification for the media.
  2642. // Valid only if ELEMENT_STATUS_PVOLTAG bit is set in Flags.
  2643. //
  2644. PrimaryVolumeID: array [0..MAX_VOLUME_ID_SIZE - 1] of BYTE;
  2645. //
  2646. // Alternate volume identification for the media.
  2647. // Valid for two-sided media only, and pertains to the id. of the inverted side.
  2648. // Valid only if ELEMENT_STATUS_AVOLTAG bit is set in Flags.
  2649. //
  2650. AlternateVolumeID: array [0..MAX_VOLUME_ID_SIZE - 1] of BYTE;
  2651. end;
  2652. {$EXTERNALSYM _CHANGER_ELEMENT_STATUS}
  2653. CHANGER_ELEMENT_STATUS = _CHANGER_ELEMENT_STATUS;
  2654. {$EXTERNALSYM CHANGER_ELEMENT_STATUS}
  2655. TChangerElementStatus = CHANGER_ELEMENT_STATUS;
  2656. PChangerElementStatus = PCHANGER_ELEMENT_STATUS;
  2657. PCHANGER_ELEMENT_STATUS_EX = ^CHANGER_ELEMENT_STATUS_EX;
  2658. {$EXTERNALSYM PCHANGER_ELEMENT_STATUS_EX}
  2659. _CHANGER_ELEMENT_STATUS_EX = record
  2660. //
  2661. // Element to which this structure refers.
  2662. //
  2663. Element: CHANGER_ELEMENT;
  2664. //
  2665. // Address of the element from which the media was originally moved.
  2666. // Valid if ELEMENT_STATUS_SVALID bit of Flags DWORD is set.
  2667. // Needs to be converted to a zero-based offset from the device-unique value.
  2668. //
  2669. SrcElementAddress: CHANGER_ELEMENT;
  2670. //
  2671. // See below.
  2672. //
  2673. Flags: DWORD;
  2674. //
  2675. // See below for possible values.
  2676. //
  2677. ExceptionCode: DWORD;
  2678. //
  2679. // Scsi Target Id of this element.
  2680. // Valid only if ELEMENT_STATUS_ID_VALID is set in Flags.
  2681. //
  2682. TargetId: BYTE;
  2683. //
  2684. // LogicalUnitNumber of this element.
  2685. // Valid only if ELEMENT_STATUS_LUN_VALID is set in Flags.
  2686. //
  2687. Lun: BYTE;
  2688. Reserved: WORD;
  2689. //
  2690. // Primary volume identification for the media.
  2691. // Valid only if ELEMENT_STATUS_PVOLTAG bit is set in Flags.
  2692. //
  2693. PrimaryVolumeID: array [0..MAX_VOLUME_ID_SIZE - 1] of BYTE;
  2694. //
  2695. // Alternate volume identification for the media.
  2696. // Valid for two-sided media only, and pertains to the id. of the inverted side.
  2697. // Valid only if ELEMENT_STATUS_AVOLTAG bit is set in Flags.
  2698. //
  2699. AlternateVolumeID: array [0..MAX_VOLUME_ID_SIZE - 1] of BYTE;
  2700. //
  2701. // Vendor ID
  2702. //
  2703. VendorIdentification: array [0..VENDOR_ID_LENGTH - 1] of BYTE;
  2704. //
  2705. // Product ID
  2706. //
  2707. ProductIdentification: array [0..PRODUCT_ID_LENGTH - 1] of BYTE;
  2708. //
  2709. // Serial number
  2710. //
  2711. SerialNumber: array [0..SERIAL_NUMBER_LENGTH - 1] of BYTE;
  2712. end;
  2713. {$EXTERNALSYM _CHANGER_ELEMENT_STATUS_EX}
  2714. CHANGER_ELEMENT_STATUS_EX = _CHANGER_ELEMENT_STATUS_EX;
  2715. {$EXTERNALSYM CHANGER_ELEMENT_STATUS_EX}
  2716. TChangerElementStatusEx = CHANGER_ELEMENT_STATUS_EX;
  2717. PChangerElementStatusEx = PCHANGER_ELEMENT_STATUS_EX;
  2718. //
  2719. // Possible flag values
  2720. //
  2721. const
  2722. ELEMENT_STATUS_FULL = $00000001; // Element contains a unit of media.
  2723. {$EXTERNALSYM ELEMENT_STATUS_FULL}
  2724. ELEMENT_STATUS_IMPEXP = $00000002; // Media in i/e port was placed there by an operator.
  2725. {$EXTERNALSYM ELEMENT_STATUS_IMPEXP}
  2726. ELEMENT_STATUS_EXCEPT = $00000004; // Element is in an abnormal state; check ExceptionCode field for more information.
  2727. {$EXTERNALSYM ELEMENT_STATUS_EXCEPT}
  2728. ELEMENT_STATUS_ACCESS = $00000008; // Access to the i/e port from the medium changer is allowed.
  2729. {$EXTERNALSYM ELEMENT_STATUS_ACCESS}
  2730. ELEMENT_STATUS_EXENAB = $00000010; // Export of media is supported.
  2731. {$EXTERNALSYM ELEMENT_STATUS_EXENAB}
  2732. ELEMENT_STATUS_INENAB = $00000020; // Import of media is supported.
  2733. {$EXTERNALSYM ELEMENT_STATUS_INENAB}
  2734. ELEMENT_STATUS_PRODUCT_DATA = $00000040; // Serial number valid for the drive
  2735. {$EXTERNALSYM ELEMENT_STATUS_PRODUCT_DATA}
  2736. ELEMENT_STATUS_LUN_VALID = $00001000; // Lun information is valid.
  2737. {$EXTERNALSYM ELEMENT_STATUS_LUN_VALID}
  2738. ELEMENT_STATUS_ID_VALID = $00002000; // SCSI Id information is valid.
  2739. {$EXTERNALSYM ELEMENT_STATUS_ID_VALID}
  2740. ELEMENT_STATUS_NOT_BUS = $00008000; // Lun and SCSI Id fields are not on same bus as medium changer.
  2741. {$EXTERNALSYM ELEMENT_STATUS_NOT_BUS}
  2742. ELEMENT_STATUS_INVERT = $00400000; // Media in element was inverted (valid only if ELEMENT_STATUS_SVALID bit is set)
  2743. {$EXTERNALSYM ELEMENT_STATUS_INVERT}
  2744. ELEMENT_STATUS_SVALID = $00800000; // SourceElementAddress field and ELEMENT_STATUS_INVERT bit are valid.
  2745. {$EXTERNALSYM ELEMENT_STATUS_SVALID}
  2746. ELEMENT_STATUS_PVOLTAG = $10000000; // Primary volume information is valid.
  2747. {$EXTERNALSYM ELEMENT_STATUS_PVOLTAG}
  2748. ELEMENT_STATUS_AVOLTAG = $20000000; // Alternate volume information is valid.
  2749. {$EXTERNALSYM ELEMENT_STATUS_AVOLTAG}
  2750. //
  2751. // ExceptionCode values.
  2752. //
  2753. ERROR_LABEL_UNREADABLE = $00000001; // Bar code scanner could not read bar code label.
  2754. {$EXTERNALSYM ERROR_LABEL_UNREADABLE}
  2755. ERROR_LABEL_QUESTIONABLE = $00000002; // Label could be invalid due to unit attention condition.
  2756. {$EXTERNALSYM ERROR_LABEL_QUESTIONABLE}
  2757. ERROR_SLOT_NOT_PRESENT = $00000004; // Slot is currently not addressable in the device.
  2758. {$EXTERNALSYM ERROR_SLOT_NOT_PRESENT}
  2759. ERROR_DRIVE_NOT_INSTALLED = $00000008; // Drive is not installed.
  2760. {$EXTERNALSYM ERROR_DRIVE_NOT_INSTALLED}
  2761. ERROR_TRAY_MALFUNCTION = $00000010; // Media tray is malfunctioning/broken.
  2762. {$EXTERNALSYM ERROR_TRAY_MALFUNCTION}
  2763. ERROR_INIT_STATUS_NEEDED = $00000011; // An Initialize Element Status command is needed.
  2764. {$EXTERNALSYM ERROR_INIT_STATUS_NEEDED}
  2765. ERROR_UNHANDLED_ERROR = DWORD($FFFFFFFF); // Unknown error condition
  2766. {$EXTERNALSYM ERROR_UNHANDLED_ERROR}
  2767. //
  2768. // Definitions for IOCTL_CHANGER_INITIALIZE_ELEMENT_STATUS
  2769. //
  2770. type
  2771. PCHANGER_INITIALIZE_ELEMENT_STATUS = ^CHANGER_INITIALIZE_ELEMENT_STATUS;
  2772. {$EXTERNALSYM PCHANGER_INITIALIZE_ELEMENT_STATUS}
  2773. _CHANGER_INITIALIZE_ELEMENT_STATUS = record
  2774. //
  2775. // List describing the elements and range on which to initialize.
  2776. //
  2777. ElementList: CHANGER_ELEMENT_LIST;
  2778. //
  2779. // Indicates whether a bar code scan should be used. Only applicable if
  2780. // CHANGER_BAR_CODE_SCANNER_INSTALLED is set in Features0 of CHANGER_GET_PARAMETERS.
  2781. //
  2782. BarCodeScan: ByteBool;
  2783. end;
  2784. {$EXTERNALSYM _CHANGER_INITIALIZE_ELEMENT_STATUS}
  2785. CHANGER_INITIALIZE_ELEMENT_STATUS = _CHANGER_INITIALIZE_ELEMENT_STATUS;
  2786. {$EXTERNALSYM CHANGER_INITIALIZE_ELEMENT_STATUS}
  2787. TChangerInitializeElementStatus = CHANGER_INITIALIZE_ELEMENT_STATUS;
  2788. PChangerInitializeElementStatus = PCHANGER_INITIALIZE_ELEMENT_STATUS;
  2789. //
  2790. // Definitions for IOCTL_CHANGER_SET_POSITION
  2791. //
  2792. PCHANGER_SET_POSITION = ^CHANGER_SET_POSITION;
  2793. {$EXTERNALSYM PCHANGER_SET_POSITION}
  2794. _CHANGER_SET_POSITION = record
  2795. //
  2796. // Indicates which transport to move.
  2797. //
  2798. Transport: CHANGER_ELEMENT;
  2799. //
  2800. // Indicates the final destination of the transport.
  2801. //
  2802. Destination: CHANGER_ELEMENT;
  2803. //
  2804. // Indicates whether the media currently carried by Transport, should be flipped.
  2805. //
  2806. Flip: ByteBool;
  2807. end;
  2808. {$EXTERNALSYM _CHANGER_SET_POSITION}
  2809. CHANGER_SET_POSITION = _CHANGER_SET_POSITION;
  2810. {$EXTERNALSYM CHANGER_SET_POSITION}
  2811. TChangerSetPosition = CHANGER_SET_POSITION;
  2812. PChangerSetPosition = PCHANGER_SET_POSITION;
  2813. //
  2814. // Definitions for IOCTL_CHANGER_EXCHANGE_MEDIUM
  2815. //
  2816. PCHANGER_EXCHANGE_MEDIUM = ^CHANGER_EXCHANGE_MEDIUM;
  2817. {$EXTERNALSYM PCHANGER_EXCHANGE_MEDIUM}
  2818. _CHANGER_EXCHANGE_MEDIUM = record
  2819. //
  2820. // Indicates which transport to use for the exchange operation.
  2821. //
  2822. Transport: CHANGER_ELEMENT;
  2823. //
  2824. // Indicates the source for the media that is to be moved.
  2825. //
  2826. Source: CHANGER_ELEMENT;
  2827. //
  2828. // Indicates the final destination of the media originally at Source.
  2829. //
  2830. Destination1: CHANGER_ELEMENT;
  2831. //
  2832. // Indicates the destination of the media moved from Destination1.
  2833. //
  2834. Destination2: CHANGER_ELEMENT;
  2835. //
  2836. // Indicates whether the medium should be flipped.
  2837. //
  2838. Flip1: ByteBool;
  2839. Flip2: ByteBool;
  2840. end;
  2841. {$EXTERNALSYM _CHANGER_EXCHANGE_MEDIUM}
  2842. CHANGER_EXCHANGE_MEDIUM = _CHANGER_EXCHANGE_MEDIUM;
  2843. {$EXTERNALSYM CHANGER_EXCHANGE_MEDIUM}
  2844. TChangerExchangeMedium = CHANGER_EXCHANGE_MEDIUM;
  2845. PChangerExchangeMedium = PCHANGER_EXCHANGE_MEDIUM;
  2846. //
  2847. // Definitions for IOCTL_CHANGER_MOVE_MEDIUM
  2848. //
  2849. PCHANGER_MOVE_MEDIUM = ^CHANGER_MOVE_MEDIUM;
  2850. {$EXTERNALSYM PCHANGER_MOVE_MEDIUM}
  2851. _CHANGER_MOVE_MEDIUM = record
  2852. //
  2853. // Indicates which transport to use for the move operation.
  2854. //
  2855. Transport: CHANGER_ELEMENT;
  2856. //
  2857. // Indicates the source for the media that is to be moved.
  2858. //
  2859. Source: CHANGER_ELEMENT;
  2860. //
  2861. // Indicates the destination of the media originally at Source.
  2862. //
  2863. Destination: CHANGER_ELEMENT;
  2864. //
  2865. // Indicates whether the media should be flipped.
  2866. //
  2867. Flip: ByteBool;
  2868. end;
  2869. {$EXTERNALSYM _CHANGER_MOVE_MEDIUM}
  2870. CHANGER_MOVE_MEDIUM = _CHANGER_MOVE_MEDIUM;
  2871. {$EXTERNALSYM CHANGER_MOVE_MEDIUM}
  2872. TChangerMoveMedium = CHANGER_MOVE_MEDIUM;
  2873. PChangerMoveMedium = PCHANGER_MOVE_MEDIUM;
  2874. //
  2875. // Definitions for IOCTL_QUERY_VOLUME_TAGS
  2876. //
  2877. //
  2878. // Input buffer.
  2879. //
  2880. PCHANGER_SEND_VOLUME_TAG_INFORMATION = ^CHANGER_SEND_VOLUME_TAG_INFORMATION;
  2881. {$EXTERNALSYM PCHANGER_SEND_VOLUME_TAG_INFORMATION}
  2882. _CHANGER_SEND_VOLUME_TAG_INFORMATION = record
  2883. //
  2884. // Describes the starting element for which to return information.
  2885. //
  2886. StartingElement: CHANGER_ELEMENT;
  2887. //
  2888. // Indicates the specific action to perform. See below.
  2889. //
  2890. ActionCode: DWORD;
  2891. //
  2892. // Template used by the device to search for volume ids.
  2893. //
  2894. VolumeIDTemplate: array [0..MAX_VOLUME_TEMPLATE_SIZE - 1] of BYTE;
  2895. end;
  2896. {$EXTERNALSYM _CHANGER_SEND_VOLUME_TAG_INFORMATION}
  2897. CHANGER_SEND_VOLUME_TAG_INFORMATION = _CHANGER_SEND_VOLUME_TAG_INFORMATION;
  2898. {$EXTERNALSYM CHANGER_SEND_VOLUME_TAG_INFORMATION}
  2899. TChangerSendVolumeTagInformation = CHANGER_SEND_VOLUME_TAG_INFORMATION;
  2900. PChangerSendVolumeTagInformation = PCHANGER_SEND_VOLUME_TAG_INFORMATION;
  2901. //
  2902. // Output buffer.
  2903. //
  2904. PREAD_ELEMENT_ADDRESS_INFO = ^READ_ELEMENT_ADDRESS_INFO;
  2905. {$EXTERNALSYM PREAD_ELEMENT_ADDRESS_INFO}
  2906. _READ_ELEMENT_ADDRESS_INFO = record
  2907. //
  2908. // Number of elements matching criteria set forth by ActionCode.
  2909. //
  2910. NumberOfElements: DWORD;
  2911. //
  2912. // Array of CHANGER_ELEMENT_STATUS structures, one for each element that corresponded
  2913. // with the information passed in with the CHANGER_SEND_VOLUME_TAG_INFORMATION structure.
  2914. //
  2915. ElementStatus: array [0..0] of CHANGER_ELEMENT_STATUS;
  2916. end;
  2917. {$EXTERNALSYM _READ_ELEMENT_ADDRESS_INFO}
  2918. READ_ELEMENT_ADDRESS_INFO = _READ_ELEMENT_ADDRESS_INFO;
  2919. {$EXTERNALSYM READ_ELEMENT_ADDRESS_INFO}
  2920. TReadElementAddressInfo = READ_ELEMENT_ADDRESS_INFO;
  2921. PReadElementAddressInfo = PREAD_ELEMENT_ADDRESS_INFO;
  2922. //
  2923. // Possible ActionCode values. See Features0 of CHANGER_GET_PARAMETERS for compatibility with
  2924. // the current device.
  2925. //
  2926. const
  2927. SEARCH_ALL = $0; // Translate - search all defined volume tags.
  2928. {$EXTERNALSYM SEARCH_ALL}
  2929. SEARCH_PRIMARY = $1; // Translate - search only primary volume tags.
  2930. {$EXTERNALSYM SEARCH_PRIMARY}
  2931. SEARCH_ALTERNATE = $2; // Translate - search only alternate volume tags.
  2932. {$EXTERNALSYM SEARCH_ALTERNATE}
  2933. SEARCH_ALL_NO_SEQ = $4; // Translate - search all defined volume tags but ignore sequence numbers.
  2934. {$EXTERNALSYM SEARCH_ALL_NO_SEQ}
  2935. SEARCH_PRI_NO_SEQ = $5; // Translate - search only primary volume tags but ignore sequence numbers.
  2936. {$EXTERNALSYM SEARCH_PRI_NO_SEQ}
  2937. SEARCH_ALT_NO_SEQ = $6; // Translate - search only alternate volume tags but ignore sequence numbers.
  2938. {$EXTERNALSYM SEARCH_ALT_NO_SEQ}
  2939. ASSERT_PRIMARY = $8; // Assert - as the primary volume tag - if tag now undefined.
  2940. {$EXTERNALSYM ASSERT_PRIMARY}
  2941. ASSERT_ALTERNATE = $9; // Assert - as the alternate volume tag - if tag now undefined.
  2942. {$EXTERNALSYM ASSERT_ALTERNATE}
  2943. REPLACE_PRIMARY = $A; // Replace - the primary volume tag - current tag ignored.
  2944. {$EXTERNALSYM REPLACE_PRIMARY}
  2945. REPLACE_ALTERNATE = $B; // Replace - the alternate volume tag - current tag ignored.
  2946. {$EXTERNALSYM REPLACE_ALTERNATE}
  2947. UNDEFINE_PRIMARY = $C; // Undefine - the primary volume tag - current tag ignored.
  2948. {$EXTERNALSYM UNDEFINE_PRIMARY}
  2949. UNDEFINE_ALTERNATE = $D; // Undefine - the alternate volume tag - current tag ignored.
  2950. {$EXTERNALSYM UNDEFINE_ALTERNATE}
  2951. //
  2952. // Changer diagnostic test related definitions
  2953. //
  2954. type
  2955. _CHANGER_DEVICE_PROBLEM_TYPE = (
  2956. DeviceProblemNone,
  2957. DeviceProblemHardware,
  2958. DeviceProblemCHMError,
  2959. DeviceProblemDoorOpen,
  2960. DeviceProblemCalibrationError,
  2961. DeviceProblemTargetFailure,
  2962. DeviceProblemCHMMoveError,
  2963. DeviceProblemCHMZeroError,
  2964. DeviceProblemCartridgeInsertError,
  2965. DeviceProblemPositionError,
  2966. DeviceProblemSensorError,
  2967. DeviceProblemCartridgeEjectError,
  2968. DeviceProblemGripperError,
  2969. DeviceProblemDriveError);
  2970. {$EXTERNALSYM _CHANGER_DEVICE_PROBLEM_TYPE}
  2971. CHANGER_DEVICE_PROBLEM_TYPE = _CHANGER_DEVICE_PROBLEM_TYPE;
  2972. {$EXTERNALSYM CHANGER_DEVICE_PROBLEM_TYPE}
  2973. PCHANGER_DEVICE_PROBLEM_TYPE = ^CHANGER_DEVICE_PROBLEM_TYPE;
  2974. {$EXTERNALSYM PCHANGER_DEVICE_PROBLEM_TYPE}
  2975. TChangerDeviceProblemType = CHANGER_DEVICE_PROBLEM_TYPE;
  2976. PChangerDeviceProblemType = PCHANGER_DEVICE_PROBLEM_TYPE;
  2977. const
  2978. IOCTL_SERIAL_LSRMST_INSERT = (
  2979. (FILE_DEVICE_SERIAL_PORT shl 16) or (FILE_ANY_ACCESS shl 14) or
  2980. (31 shl 2) or METHOD_BUFFERED);
  2981. {$EXTERNALSYM IOCTL_SERIAL_LSRMST_INSERT}
  2982. IOCTL_SERENUM_EXPOSE_HARDWARE = (
  2983. (FILE_DEVICE_SERENUM shl 16) or (FILE_ANY_ACCESS shl 14) or
  2984. (128 shl 2) or METHOD_BUFFERED);
  2985. {$EXTERNALSYM IOCTL_SERENUM_EXPOSE_HARDWARE}
  2986. IOCTL_SERENUM_REMOVE_HARDWARE = (
  2987. (FILE_DEVICE_SERENUM shl 16) or (FILE_ANY_ACCESS shl 14) or
  2988. (129 shl 2) or METHOD_BUFFERED);
  2989. {$EXTERNALSYM IOCTL_SERENUM_REMOVE_HARDWARE}
  2990. IOCTL_SERENUM_PORT_DESC = (
  2991. (FILE_DEVICE_SERENUM shl 16) or (FILE_ANY_ACCESS shl 14) or
  2992. (130 shl 2) or METHOD_BUFFERED);
  2993. {$EXTERNALSYM IOCTL_SERENUM_PORT_DESC}
  2994. IOCTL_SERENUM_GET_PORT_NAME = (
  2995. (FILE_DEVICE_SERENUM shl 16) or (FILE_ANY_ACCESS shl 14) or
  2996. (131 shl 2) or METHOD_BUFFERED);
  2997. {$EXTERNALSYM IOCTL_SERENUM_GET_PORT_NAME}
  2998. //
  2999. // The following values follow the escape designator in the
  3000. // data stream if the LSRMST_INSERT mode has been turned on.
  3001. //
  3002. SERIAL_LSRMST_ESCAPE = BYTE($00);
  3003. {$EXTERNALSYM SERIAL_LSRMST_ESCAPE}
  3004. //
  3005. // Following this value is the contents of the line status
  3006. // register, and then the character in the RX hardware when
  3007. // the line status register was encountered.
  3008. //
  3009. SERIAL_LSRMST_LSR_DATA = BYTE($01);
  3010. {$EXTERNALSYM SERIAL_LSRMST_LSR_DATA}
  3011. //
  3012. // Following this value is the contents of the line status
  3013. // register. No error character follows
  3014. //
  3015. SERIAL_LSRMST_LSR_NODATA = BYTE($02);
  3016. {$EXTERNALSYM SERIAL_LSRMST_LSR_NODATA}
  3017. //
  3018. // Following this value is the contents of the modem status
  3019. // register.
  3020. //
  3021. SERIAL_LSRMST_MST = BYTE($03);
  3022. {$EXTERNALSYM SERIAL_LSRMST_MST}
  3023. //
  3024. // Bit values for FIFO Control Register
  3025. //
  3026. SERIAL_IOC_FCR_FIFO_ENABLE = DWORD($00000001);
  3027. {$EXTERNALSYM SERIAL_IOC_FCR_FIFO_ENABLE}
  3028. SERIAL_IOC_FCR_RCVR_RESET = DWORD($00000002);
  3029. {$EXTERNALSYM SERIAL_IOC_FCR_RCVR_RESET}
  3030. SERIAL_IOC_FCR_XMIT_RESET = DWORD($00000004);
  3031. {$EXTERNALSYM SERIAL_IOC_FCR_XMIT_RESET}
  3032. SERIAL_IOC_FCR_DMA_MODE = DWORD($00000008);
  3033. {$EXTERNALSYM SERIAL_IOC_FCR_DMA_MODE}
  3034. SERIAL_IOC_FCR_RES1 = DWORD($00000010);
  3035. {$EXTERNALSYM SERIAL_IOC_FCR_RES1}
  3036. SERIAL_IOC_FCR_RES2 = DWORD($00000020);
  3037. {$EXTERNALSYM SERIAL_IOC_FCR_RES2}
  3038. SERIAL_IOC_FCR_RCVR_TRIGGER_LSB = DWORD($00000040);
  3039. {$EXTERNALSYM SERIAL_IOC_FCR_RCVR_TRIGGER_LSB}
  3040. SERIAL_IOC_FCR_RCVR_TRIGGER_MSB = DWORD($00000080);
  3041. {$EXTERNALSYM SERIAL_IOC_FCR_RCVR_TRIGGER_MSB}
  3042. //
  3043. // Bit values for Modem Control Register
  3044. //
  3045. SERIAL_IOC_MCR_DTR = DWORD($00000001);
  3046. {$EXTERNALSYM SERIAL_IOC_MCR_DTR}
  3047. SERIAL_IOC_MCR_RTS = DWORD($00000002);
  3048. {$EXTERNALSYM SERIAL_IOC_MCR_RTS}
  3049. SERIAL_IOC_MCR_OUT1 = DWORD($00000004);
  3050. {$EXTERNALSYM SERIAL_IOC_MCR_OUT1}
  3051. SERIAL_IOC_MCR_OUT2 = DWORD($00000008);
  3052. {$EXTERNALSYM SERIAL_IOC_MCR_OUT2}
  3053. SERIAL_IOC_MCR_LOOP = DWORD($00000010);
  3054. {$EXTERNALSYM SERIAL_IOC_MCR_LOOP}
  3055. //
  3056. // The following is a list of the native file system fsctls followed by
  3057. // additional network file system fsctls. Some values have been
  3058. // decommissioned.
  3059. //
  3060. FSCTL_REQUEST_OPLOCK_LEVEL_1 = (
  3061. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3062. (0 shl 2) or METHOD_BUFFERED);
  3063. {$EXTERNALSYM FSCTL_REQUEST_OPLOCK_LEVEL_1}
  3064. FSCTL_REQUEST_OPLOCK_LEVEL_2 = (
  3065. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3066. (1 shl 2) or METHOD_BUFFERED);
  3067. {$EXTERNALSYM FSCTL_REQUEST_OPLOCK_LEVEL_2}
  3068. FSCTL_REQUEST_BATCH_OPLOCK = (
  3069. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3070. (2 shl 2) or METHOD_BUFFERED);
  3071. {$EXTERNALSYM FSCTL_REQUEST_BATCH_OPLOCK}
  3072. FSCTL_OPLOCK_BREAK_ACKNOWLEDGE = (
  3073. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3074. (3 shl 2) or METHOD_BUFFERED);
  3075. {$EXTERNALSYM FSCTL_OPLOCK_BREAK_ACKNOWLEDGE}
  3076. FSCTL_OPBATCH_ACK_CLOSE_PENDING = (
  3077. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3078. (4 shl 2) or METHOD_BUFFERED);
  3079. {$EXTERNALSYM FSCTL_OPBATCH_ACK_CLOSE_PENDING}
  3080. FSCTL_OPLOCK_BREAK_NOTIFY = (
  3081. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3082. (5 shl 2) or METHOD_BUFFERED);
  3083. {$EXTERNALSYM FSCTL_OPLOCK_BREAK_NOTIFY}
  3084. FSCTL_LOCK_VOLUME = (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or (6 shl 2) or METHOD_BUFFERED;
  3085. {$EXTERNALSYM FSCTL_LOCK_VOLUME}
  3086. FSCTL_UNLOCK_VOLUME = (
  3087. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3088. (7 shl 2) or METHOD_BUFFERED);
  3089. {$EXTERNALSYM FSCTL_UNLOCK_VOLUME}
  3090. FSCTL_DISMOUNT_VOLUME = (
  3091. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3092. (8 shl 2) or METHOD_BUFFERED);
  3093. {$EXTERNALSYM FSCTL_DISMOUNT_VOLUME}
  3094. // decommissioned fsctl value 9
  3095. FSCTL_IS_VOLUME_MOUNTED = (
  3096. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3097. (10 shl 2) or METHOD_BUFFERED);
  3098. {$EXTERNALSYM FSCTL_IS_VOLUME_MOUNTED}
  3099. FSCTL_IS_PATHNAME_VALID = (
  3100. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3101. (11 shl 2) or METHOD_BUFFERED); // PATHNAME_BUFFER,
  3102. {$EXTERNALSYM FSCTL_IS_PATHNAME_VALID}
  3103. FSCTL_MARK_VOLUME_DIRTY = (
  3104. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3105. (12 shl 2) or METHOD_BUFFERED);
  3106. {$EXTERNALSYM FSCTL_MARK_VOLUME_DIRTY}
  3107. // decommissioned fsctl value 13
  3108. FSCTL_QUERY_RETRIEVAL_POINTERS = (
  3109. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3110. (14 shl 2) or METHOD_NEITHER);
  3111. {$EXTERNALSYM FSCTL_QUERY_RETRIEVAL_POINTERS}
  3112. FSCTL_GET_COMPRESSION = (
  3113. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3114. (15 shl 2) or METHOD_BUFFERED);
  3115. {$EXTERNALSYM FSCTL_GET_COMPRESSION}
  3116. FSCTL_SET_COMPRESSION = (
  3117. (FILE_DEVICE_FILE_SYSTEM shl 16) or ((FILE_READ_DATA or FILE_WRITE_DATA) shl 14) or
  3118. (16 shl 2) or METHOD_BUFFERED);
  3119. {$EXTERNALSYM FSCTL_SET_COMPRESSION}
  3120. // decommissioned fsctl value 17
  3121. // decommissioned fsctl value 18
  3122. FSCTL_MARK_AS_SYSTEM_HIVE = (
  3123. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3124. (19 shl 2) or METHOD_NEITHER);
  3125. {$EXTERNALSYM FSCTL_MARK_AS_SYSTEM_HIVE}
  3126. FSCTL_OPLOCK_BREAK_ACK_NO_2 = (
  3127. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3128. (20 shl 2) or METHOD_BUFFERED);
  3129. {$EXTERNALSYM FSCTL_OPLOCK_BREAK_ACK_NO_2}
  3130. FSCTL_INVALIDATE_VOLUMES = (
  3131. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3132. (21 shl 2) or METHOD_BUFFERED);
  3133. {$EXTERNALSYM FSCTL_INVALIDATE_VOLUMES}
  3134. FSCTL_QUERY_FAT_BPB = (
  3135. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3136. (22 shl 2) or METHOD_BUFFERED); // FSCTL_QUERY_FAT_BPB_BUFFER
  3137. {$EXTERNALSYM FSCTL_QUERY_FAT_BPB}
  3138. FSCTL_REQUEST_FILTER_OPLOCK = (
  3139. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3140. (23 shl 2) or METHOD_BUFFERED);
  3141. {$EXTERNALSYM FSCTL_REQUEST_FILTER_OPLOCK}
  3142. FSCTL_FILESYSTEM_GET_STATISTICS = (
  3143. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3144. (24 shl 2) or METHOD_BUFFERED); // FILESYSTEM_STATISTICS
  3145. {$EXTERNALSYM FSCTL_FILESYSTEM_GET_STATISTICS}
  3146. FSCTL_GET_NTFS_VOLUME_DATA = (
  3147. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3148. (25 shl 2) or METHOD_BUFFERED);
  3149. {$EXTERNALSYM FSCTL_GET_NTFS_VOLUME_DATA}
  3150. FSCTL_GET_NTFS_FILE_RECORD = (
  3151. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3152. (26 shl 2) or METHOD_BUFFERED);
  3153. {$EXTERNALSYM FSCTL_GET_NTFS_FILE_RECORD}
  3154. FSCTL_GET_VOLUME_BITMAP = (
  3155. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3156. (27 shl 2) or METHOD_NEITHER);
  3157. {$EXTERNALSYM FSCTL_GET_VOLUME_BITMAP}
  3158. FSCTL_GET_RETRIEVAL_POINTERS = (
  3159. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3160. (28 shl 2) or METHOD_NEITHER);
  3161. {$EXTERNALSYM FSCTL_GET_RETRIEVAL_POINTERS}
  3162. FSCTL_MOVE_FILE = (
  3163. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_SPECIAL_ACCESS shl 14) or
  3164. (29 shl 2) or METHOD_BUFFERED);
  3165. {$EXTERNALSYM FSCTL_MOVE_FILE}
  3166. FSCTL_IS_VOLUME_DIRTY = (
  3167. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3168. (30 shl 2) or METHOD_BUFFERED);
  3169. {$EXTERNALSYM FSCTL_IS_VOLUME_DIRTY}
  3170. // decomissioned fsctl value 31
  3171. (* FSCTL_GET_HFS_INFORMATION = (
  3172. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3173. (31 shl 2) or METHOD_BUFFERED);
  3174. {$EXTERNALSYM FSCTL_GET_HFS_INFORMATION}
  3175. *)
  3176. FSCTL_ALLOW_EXTENDED_DASD_IO = (
  3177. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3178. (32 shl 2) or METHOD_NEITHER);
  3179. {$EXTERNALSYM FSCTL_ALLOW_EXTENDED_DASD_IO}
  3180. // decommissioned fsctl value 33
  3181. // decommissioned fsctl value 34
  3182. (*
  3183. FSCTL_READ_PROPERTY_DATA = (
  3184. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3185. (33 shl 2) or METHOD_NEITHER);
  3186. {$EXTERNALSYM FSCTL_READ_PROPERTY_DATA}
  3187. FSCTL_WRITE_PROPERTY_DATA = (
  3188. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3189. (34 shl 2) or METHOD_NEITHER);
  3190. {$EXTERNALSYM FSCTL_WRITE_PROPERTY_DATA}
  3191. *)
  3192. FSCTL_FIND_FILES_BY_SID = (
  3193. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3194. (35 shl 2) or METHOD_NEITHER);
  3195. {$EXTERNALSYM FSCTL_FIND_FILES_BY_SID}
  3196. // decommissioned fsctl value 36
  3197. // decommissioned fsctl value 37
  3198. (* FSCTL_DUMP_PROPERTY_DATA = (
  3199. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3200. (37 shl 2) or METHOD_NEITHER);
  3201. {$EXTERNALSYM FSCTL_DUMP_PROPERTY_DATA}
  3202. *)
  3203. FSCTL_SET_OBJECT_ID = (
  3204. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_SPECIAL_ACCESS shl 14) or
  3205. (38 shl 2) or METHOD_BUFFERED);
  3206. {$EXTERNALSYM FSCTL_SET_OBJECT_ID}
  3207. FSCTL_GET_OBJECT_ID = (
  3208. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3209. (39 shl 2) or METHOD_BUFFERED);
  3210. {$EXTERNALSYM FSCTL_GET_OBJECT_ID}
  3211. FSCTL_DELETE_OBJECT_ID = (
  3212. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_SPECIAL_ACCESS shl 14) or
  3213. (40 shl 2) or METHOD_BUFFERED);
  3214. {$EXTERNALSYM FSCTL_DELETE_OBJECT_ID}
  3215. FSCTL_SET_REPARSE_POINT = (
  3216. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_SPECIAL_ACCESS shl 14) or
  3217. (41 shl 2) or METHOD_BUFFERED);
  3218. {$EXTERNALSYM FSCTL_SET_REPARSE_POINT}
  3219. FSCTL_GET_REPARSE_POINT = (
  3220. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3221. (42 shl 2) or METHOD_BUFFERED);
  3222. {$EXTERNALSYM FSCTL_GET_REPARSE_POINT}
  3223. FSCTL_DELETE_REPARSE_POINT = (
  3224. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_SPECIAL_ACCESS shl 14) or
  3225. (43 shl 2) or METHOD_BUFFERED);
  3226. {$EXTERNALSYM FSCTL_DELETE_REPARSE_POINT}
  3227. FSCTL_ENUM_USN_DATA = (
  3228. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3229. (44 shl 2) or METHOD_NEITHER);
  3230. {$EXTERNALSYM FSCTL_ENUM_USN_DATA}
  3231. FSCTL_SECURITY_ID_CHECK = (
  3232. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_READ_DATA shl 14) or
  3233. (45 shl 2) or METHOD_NEITHER);
  3234. {$EXTERNALSYM FSCTL_SECURITY_ID_CHECK}
  3235. FSCTL_READ_USN_JOURNAL = (
  3236. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3237. (46 shl 2) or METHOD_NEITHER);
  3238. {$EXTERNALSYM FSCTL_READ_USN_JOURNAL}
  3239. FSCTL_SET_OBJECT_ID_EXTENDED = (
  3240. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_SPECIAL_ACCESS shl 14) or
  3241. (47 shl 2) or METHOD_BUFFERED);
  3242. {$EXTERNALSYM FSCTL_SET_OBJECT_ID_EXTENDED}
  3243. FSCTL_CREATE_OR_GET_OBJECT_ID = (
  3244. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3245. (48 shl 2) or METHOD_BUFFERED);
  3246. {$EXTERNALSYM FSCTL_CREATE_OR_GET_OBJECT_ID}
  3247. FSCTL_SET_SPARSE = (
  3248. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_SPECIAL_ACCESS shl 14) or
  3249. (49 shl 2) or METHOD_BUFFERED);
  3250. {$EXTERNALSYM FSCTL_SET_SPARSE}
  3251. FSCTL_SET_ZERO_DATA = (
  3252. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_WRITE_DATA shl 14) or
  3253. (50 shl 2) or METHOD_BUFFERED);
  3254. {$EXTERNALSYM FSCTL_SET_ZERO_DATA}
  3255. FSCTL_QUERY_ALLOCATED_RANGES = (
  3256. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_READ_DATA shl 14) or
  3257. (51 shl 2) or METHOD_NEITHER);
  3258. {$EXTERNALSYM FSCTL_QUERY_ALLOCATED_RANGES}
  3259. // decommissioned fsctl value 52
  3260. (*
  3261. FSCTL_ENABLE_UPGRADE = (
  3262. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_WRITE_DATA shl 14) or
  3263. (52 shl 2) or METHOD_BUFFERED);
  3264. {$EXTERNALSYM FSCTL_ENABLE_UPGRADE}
  3265. *)
  3266. FSCTL_SET_ENCRYPTION = (
  3267. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3268. (53 shl 2) or METHOD_NEITHER);
  3269. {$EXTERNALSYM FSCTL_SET_ENCRYPTION}
  3270. FSCTL_ENCRYPTION_FSCTL_IO = (
  3271. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3272. (54 shl 2) or METHOD_NEITHER);
  3273. {$EXTERNALSYM FSCTL_ENCRYPTION_FSCTL_IO}
  3274. FSCTL_WRITE_RAW_ENCRYPTED = (
  3275. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_SPECIAL_ACCESS shl 14) or
  3276. (55 shl 2) or METHOD_NEITHER);
  3277. {$EXTERNALSYM FSCTL_WRITE_RAW_ENCRYPTED}
  3278. FSCTL_READ_RAW_ENCRYPTED = (
  3279. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_SPECIAL_ACCESS shl 14) or
  3280. (56 shl 2) or METHOD_NEITHER);
  3281. {$EXTERNALSYM FSCTL_READ_RAW_ENCRYPTED}
  3282. FSCTL_CREATE_USN_JOURNAL = (
  3283. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3284. (57 shl 2) or METHOD_NEITHER);
  3285. {$EXTERNALSYM FSCTL_CREATE_USN_JOURNAL}
  3286. FSCTL_READ_FILE_USN_DATA = (
  3287. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3288. (58 shl 2) or METHOD_NEITHER);
  3289. {$EXTERNALSYM FSCTL_READ_FILE_USN_DATA}
  3290. FSCTL_WRITE_USN_CLOSE_RECORD = (
  3291. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3292. (59 shl 2) or METHOD_NEITHER);
  3293. {$EXTERNALSYM FSCTL_WRITE_USN_CLOSE_RECORD}
  3294. FSCTL_EXTEND_VOLUME = (
  3295. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3296. (60 shl 2) or METHOD_BUFFERED);
  3297. {$EXTERNALSYM FSCTL_EXTEND_VOLUME}
  3298. FSCTL_QUERY_USN_JOURNAL = (
  3299. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3300. (61 shl 2) or METHOD_BUFFERED);
  3301. {$EXTERNALSYM FSCTL_QUERY_USN_JOURNAL}
  3302. FSCTL_DELETE_USN_JOURNAL = (
  3303. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3304. (62 shl 2) or METHOD_BUFFERED);
  3305. {$EXTERNALSYM FSCTL_DELETE_USN_JOURNAL}
  3306. FSCTL_MARK_HANDLE = (
  3307. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3308. (63 shl 2) or METHOD_BUFFERED);
  3309. {$EXTERNALSYM FSCTL_MARK_HANDLE}
  3310. FSCTL_SIS_COPYFILE = (
  3311. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3312. (64 shl 2) or METHOD_BUFFERED);
  3313. {$EXTERNALSYM FSCTL_SIS_COPYFILE}
  3314. FSCTL_SIS_LINK_FILES = (
  3315. (FILE_DEVICE_FILE_SYSTEM shl 16) or ((FILE_READ_DATA or FILE_WRITE_DATA) shl 14) or
  3316. (65 shl 2) or METHOD_BUFFERED);
  3317. {$EXTERNALSYM FSCTL_SIS_LINK_FILES}
  3318. FSCTL_HSM_MSG = (
  3319. (FILE_DEVICE_FILE_SYSTEM shl 16) or ((FILE_READ_DATA or FILE_WRITE_DATA) shl 14) or
  3320. (66 shl 2) or METHOD_BUFFERED);
  3321. {$EXTERNALSYM FSCTL_HSM_MSG}
  3322. // decommissioned fsctl value 67
  3323. (*
  3324. FSCTL_NSS_CONTROL = (
  3325. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_WRITE_DATA shl 14) or
  3326. (67 shl 2) or METHOD_BUFFERED);
  3327. {$EXTERNALSYM FSCTL_NSS_CONTROL}
  3328. *)
  3329. FSCTL_HSM_DATA = (
  3330. (FILE_DEVICE_FILE_SYSTEM shl 16) or ((FILE_READ_DATA or FILE_WRITE_DATA) shl 14) or
  3331. (68 shl 2) or METHOD_NEITHER);
  3332. {$EXTERNALSYM FSCTL_HSM_DATA}
  3333. FSCTL_RECALL_FILE = (
  3334. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_ANY_ACCESS shl 14) or
  3335. (69 shl 2) or METHOD_NEITHER);
  3336. {$EXTERNALSYM FSCTL_RECALL_FILE}
  3337. // decommissioned fsctl value 70
  3338. (*
  3339. FSCTL_NSS_RCONTROL = (
  3340. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_READ_DATA shl 14) or
  3341. (70 shl 2) or METHOD_BUFFERED);
  3342. {$EXTERNALSYM FSCTL_NSS_RCONTROL}
  3343. *)
  3344. FSCTL_READ_FROM_PLEX = (
  3345. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_READ_DATA shl 14) or
  3346. (71 shl 2) or METHOD_OUT_DIRECT);
  3347. {$EXTERNALSYM FSCTL_READ_FROM_PLEX}
  3348. FSCTL_FILE_PREFETCH = (
  3349. (FILE_DEVICE_FILE_SYSTEM shl 16) or (FILE_SPECIAL_ACCESS shl 14) or
  3350. (72 shl 2) or METHOD_BUFFERED);
  3351. {$EXTERNALSYM FSCTL_FILE_PREFETCH}
  3352. //
  3353. // The following long list of structs are associated with the preceeding
  3354. // file system fsctls.
  3355. //
  3356. // Note that the structs for the property sets fsctls are not included
  3357. // in this file. They can be found in ntfsprop.h where they should stay
  3358. // because of their dependency on objidl.h.
  3359. //
  3360. //
  3361. // Structure for FSCTL_IS_PATHNAME_VALID
  3362. //
  3363. type
  3364. PPATHNAME_BUFFER = ^PATHNAME_BUFFER;
  3365. {$EXTERNALSYM PPATHNAME_BUFFER}
  3366. _PATHNAME_BUFFER = record
  3367. PathNameLength: DWORD;
  3368. Name: array [0..0] of WCHAR;
  3369. end;
  3370. {$EXTERNALSYM _PATHNAME_BUFFER}
  3371. PATHNAME_BUFFER = _PATHNAME_BUFFER;
  3372. {$EXTERNALSYM PATHNAME_BUFFER}
  3373. TPathnameBuffer = PATHNAME_BUFFER;
  3374. PPathnameBuffer = PPATHNAME_BUFFER;
  3375. //
  3376. // Structure for FSCTL_QUERY_BPB_INFO
  3377. //
  3378. PFSCTL_QUERY_FAT_BPB_BUFFER = ^FSCTL_QUERY_FAT_BPB_BUFFER;
  3379. {$EXTERNALSYM PFSCTL_QUERY_FAT_BPB_BUFFER}
  3380. _FSCTL_QUERY_FAT_BPB_BUFFER = record
  3381. First0x24BytesOfBootSector: array [0..$23] of BYTE;
  3382. end;
  3383. {$EXTERNALSYM _FSCTL_QUERY_FAT_BPB_BUFFER}
  3384. FSCTL_QUERY_FAT_BPB_BUFFER = _FSCTL_QUERY_FAT_BPB_BUFFER;
  3385. {$EXTERNALSYM FSCTL_QUERY_FAT_BPB_BUFFER}
  3386. TFsctlQueryFatBpbBuffer = FSCTL_QUERY_FAT_BPB_BUFFER;
  3387. PFsctlQueryFatBpbBuffer = PFSCTL_QUERY_FAT_BPB_BUFFER;
  3388. //
  3389. // Structures for FSCTL_GET_NTFS_VOLUME_DATA.
  3390. // The user must pass the basic buffer below. Ntfs
  3391. // will return as many fields as available in the extended
  3392. // buffer which follows immediately after the VOLUME_DATA_BUFFER.
  3393. //
  3394. PNTFS_VOLUME_DATA_BUFFER = ^NTFS_VOLUME_DATA_BUFFER;
  3395. {$EXTERNALSYM PNTFS_VOLUME_DATA_BUFFER}
  3396. NTFS_VOLUME_DATA_BUFFER = record
  3397. VolumeSerialNumber: LARGE_INTEGER;
  3398. NumberSectors: LARGE_INTEGER;
  3399. TotalClusters: LARGE_INTEGER;
  3400. FreeClusters: LARGE_INTEGER;
  3401. TotalReserved: LARGE_INTEGER;
  3402. BytesPerSector: DWORD;
  3403. BytesPerCluster: DWORD;
  3404. BytesPerFileRecordSegment: DWORD;
  3405. ClustersPerFileRecordSegment: DWORD;
  3406. MftValidDataLength: LARGE_INTEGER;
  3407. MftStartLcn: LARGE_INTEGER;
  3408. Mft2StartLcn: LARGE_INTEGER;
  3409. MftZoneStart: LARGE_INTEGER;
  3410. MftZoneEnd: LARGE_INTEGER;
  3411. end;
  3412. {$EXTERNALSYM NTFS_VOLUME_DATA_BUFFER}
  3413. TNtfsVolumeDataBuffer = NTFS_VOLUME_DATA_BUFFER;
  3414. PNtfsVolumeDataBuffer = PNTFS_VOLUME_DATA_BUFFER;
  3415. PNTFS_EXTENDED_VOLUME_DATA = ^NTFS_EXTENDED_VOLUME_DATA;
  3416. {$EXTERNALSYM PNTFS_EXTENDED_VOLUME_DATA}
  3417. NTFS_EXTENDED_VOLUME_DATA = record
  3418. ByteCount: DWORD;
  3419. MajorVersion: WORD;
  3420. MinorVersion: WORD;
  3421. end;
  3422. {$EXTERNALSYM NTFS_EXTENDED_VOLUME_DATA}
  3423. TNtfsExtendedVolumeData = NTFS_EXTENDED_VOLUME_DATA;
  3424. PNtfsExtendedVolumeData = PNTFS_EXTENDED_VOLUME_DATA;
  3425. //
  3426. // Structure for FSCTL_GET_VOLUME_BITMAP
  3427. //
  3428. PSTARTING_LCN_INPUT_BUFFER = ^STARTING_LCN_INPUT_BUFFER;
  3429. {$EXTERNALSYM PSTARTING_LCN_INPUT_BUFFER}
  3430. STARTING_LCN_INPUT_BUFFER = record
  3431. StartingLcn: LARGE_INTEGER;
  3432. end;
  3433. {$EXTERNALSYM STARTING_LCN_INPUT_BUFFER}
  3434. TStartingLcnInputBuffer = STARTING_LCN_INPUT_BUFFER;
  3435. PStartingLcnInputBuffer = PSTARTING_LCN_INPUT_BUFFER;
  3436. PVOLUME_BITMAP_BUFFER = ^VOLUME_BITMAP_BUFFER;
  3437. {$EXTERNALSYM PVOLUME_BITMAP_BUFFER}
  3438. VOLUME_BITMAP_BUFFER = record
  3439. StartingLcn: LARGE_INTEGER;
  3440. BitmapSize: LARGE_INTEGER;
  3441. Buffer: array [0..0] of BYTE;
  3442. end;
  3443. {$EXTERNALSYM VOLUME_BITMAP_BUFFER}
  3444. TVolumeBitmapBuffer = VOLUME_BITMAP_BUFFER;
  3445. PVolumeBitmapBuffer = PVOLUME_BITMAP_BUFFER;
  3446. //
  3447. // Structure for FSCTL_GET_RETRIEVAL_POINTERS
  3448. //
  3449. PSTARTING_VCN_INPUT_BUFFER = ^STARTING_VCN_INPUT_BUFFER;
  3450. {$EXTERNALSYM PSTARTING_VCN_INPUT_BUFFER}
  3451. STARTING_VCN_INPUT_BUFFER = record
  3452. StartingVcn: LARGE_INTEGER;
  3453. end;
  3454. {$EXTERNALSYM STARTING_VCN_INPUT_BUFFER}
  3455. TStartingVcnInputBuffer = STARTING_VCN_INPUT_BUFFER;
  3456. PStartingVcnInputBuffer = PSTARTING_VCN_INPUT_BUFFER;
  3457. TRPBExtends = record
  3458. NextVcn: LARGE_INTEGER;
  3459. Lcn: LARGE_INTEGER;
  3460. end;
  3461. PRETRIEVAL_POINTERS_BUFFER = ^RETRIEVAL_POINTERS_BUFFER;
  3462. {$EXTERNALSYM PRETRIEVAL_POINTERS_BUFFER}
  3463. RETRIEVAL_POINTERS_BUFFER = record
  3464. ExtentCount: DWORD;
  3465. StartingVcn: LARGE_INTEGER;
  3466. Extends: array [0..0] of TRPBExtends;
  3467. end;
  3468. {$EXTERNALSYM RETRIEVAL_POINTERS_BUFFER}
  3469. TRetrievalPointersBuffer = RETRIEVAL_POINTERS_BUFFER;
  3470. PRetrievalPointersBuffer = PRETRIEVAL_POINTERS_BUFFER;
  3471. //
  3472. // Structures for FSCTL_GET_NTFS_FILE_RECORD
  3473. //
  3474. PNTFS_FILE_RECORD_INPUT_BUFFER = ^NTFS_FILE_RECORD_INPUT_BUFFER;
  3475. {$EXTERNALSYM PNTFS_FILE_RECORD_INPUT_BUFFER}
  3476. NTFS_FILE_RECORD_INPUT_BUFFER = record
  3477. FileReferenceNumber: LARGE_INTEGER;
  3478. end;
  3479. {$EXTERNALSYM NTFS_FILE_RECORD_INPUT_BUFFER}
  3480. TNtfsFileRecordInputBuffer = NTFS_FILE_RECORD_INPUT_BUFFER;
  3481. PNtfsFileRecordInputBuffer = PNTFS_FILE_RECORD_INPUT_BUFFER;
  3482. PNTFS_FILE_RECORD_OUTPUT_BUFFER = ^NTFS_FILE_RECORD_OUTPUT_BUFFER;
  3483. {$EXTERNALSYM PNTFS_FILE_RECORD_OUTPUT_BUFFER}
  3484. NTFS_FILE_RECORD_OUTPUT_BUFFER = record
  3485. FileReferenceNumber: LARGE_INTEGER;
  3486. FileRecordLength: DWORD;
  3487. FileRecordBuffer: array [0..0] of BYTE;
  3488. end;
  3489. {$EXTERNALSYM NTFS_FILE_RECORD_OUTPUT_BUFFER}
  3490. TNtfsFileRecordOutputBuffer = NTFS_FILE_RECORD_OUTPUT_BUFFER;
  3491. PNtfsFileRecordOutputBuffer = PNTFS_FILE_RECORD_OUTPUT_BUFFER;
  3492. //
  3493. // Structure for FSCTL_MOVE_FILE
  3494. //
  3495. PMOVE_FILE_DATA = ^MOVE_FILE_DATA;
  3496. {$EXTERNALSYM PMOVE_FILE_DATA}
  3497. MOVE_FILE_DATA = record
  3498. FileHandle: HANDLE;
  3499. StartingVcn: LARGE_INTEGER;
  3500. StartingLcn: LARGE_INTEGER;
  3501. ClusterCount: DWORD;
  3502. end;
  3503. {$EXTERNALSYM MOVE_FILE_DATA}
  3504. TMoveFileData = MOVE_FILE_DATA;
  3505. PMoveFileData = PMOVE_FILE_DATA;
  3506. {$IFDEF _WIN64}
  3507. //
  3508. // 32/64 Bit thunking support structure
  3509. //
  3510. _MOVE_FILE_DATA32 = record
  3511. FileHandle: UINT32;
  3512. StartingVcn: LARGE_INTEGER;
  3513. StartingLcn: LARGE_INTEGER;
  3514. ClusterCount: DWORD;
  3515. end;
  3516. {$EXTERNALSYM _MOVE_FILE_DATA32}
  3517. MOVE_FILE_DATA32 = _MOVE_FILE_DATA32;
  3518. {$EXTERNALSYM MOVE_FILE_DATA32}
  3519. PMOVE_FILE_DATA32 = ^MOVE_FILE_DATA32;
  3520. {$EXTERNALSYM PMOVE_FILE_DATA32}
  3521. TMoveFileData32 = MOVE_FILE_DATA32;
  3522. PMoveFileData32 = PMOVE_FILE_DATA32;
  3523. {$ENDIF _WIN64}
  3524. //
  3525. // Structures for FSCTL_FIND_FILES_BY_SID
  3526. //
  3527. PFIND_BY_SID_DATA = ^FIND_BY_SID_DATA;
  3528. {$EXTERNALSYM PFIND_BY_SID_DATA}
  3529. FIND_BY_SID_DATA = record
  3530. Restart: DWORD;
  3531. Sid: SID;
  3532. end;
  3533. {$EXTERNALSYM FIND_BY_SID_DATA}
  3534. TFindBySidData = FIND_BY_SID_DATA;
  3535. PFindBySidData = PFIND_BY_SID_DATA;
  3536. FIND_BY_SID_OUTPUT = record
  3537. NextEntryOffset: DWORD;
  3538. FileIndex: DWORD;
  3539. FileNameLength: DWORD;
  3540. FileName: array [0..0] of WCHAR;
  3541. end;
  3542. {$EXTERNALSYM FIND_BY_SID_OUTPUT}
  3543. PFIND_BY_SID_OUTPUT = ^FIND_BY_SID_OUTPUT;
  3544. TFindBySidOutput = FIND_BY_SID_OUTPUT;
  3545. PFindBySidOutput = PFIND_BY_SID_OUTPUT;
  3546. //
  3547. // The following structures apply to Usn operations.
  3548. //
  3549. //
  3550. // Structure for FSCTL_ENUM_USN_DATA
  3551. //
  3552. PMFT_ENUM_DATA = ^MFT_ENUM_DATA;
  3553. {$EXTERNALSYM PMFT_ENUM_DATA}
  3554. MFT_ENUM_DATA = record
  3555. StartFileReferenceNumber: DWORDLONG;
  3556. LowUsn: USN;
  3557. HighUsn: USN;
  3558. end;
  3559. {$EXTERNALSYM MFT_ENUM_DATA}
  3560. TMftEnumData = MFT_ENUM_DATA;
  3561. PMftEnumData = PMFT_ENUM_DATA;
  3562. //
  3563. // Structure for FSCTL_CREATE_USN_JOURNAL
  3564. //
  3565. PCREATE_USN_JOURNAL_DATA = ^CREATE_USN_JOURNAL_DATA;
  3566. {$EXTERNALSYM PCREATE_USN_JOURNAL_DATA}
  3567. CREATE_USN_JOURNAL_DATA = record
  3568. MaximumSize: DWORDLONG;
  3569. AllocationDelta: DWORDLONG;
  3570. end;
  3571. {$EXTERNALSYM CREATE_USN_JOURNAL_DATA}
  3572. TCreateUsnJournalData = CREATE_USN_JOURNAL_DATA;
  3573. PCreateUsnJournalData = PCREATE_USN_JOURNAL_DATA;
  3574. //
  3575. // Structure for FSCTL_READ_USN_JOURNAL
  3576. //
  3577. PREAD_USN_JOURNAL_DATA = ^READ_USN_JOURNAL_DATA;
  3578. {$EXTERNALSYM PREAD_USN_JOURNAL_DATA}
  3579. READ_USN_JOURNAL_DATA = record
  3580. StartUsn: USN;
  3581. ReasonMask: DWORD;
  3582. ReturnOnlyOnClose: DWORD;
  3583. Timeout: DWORDLONG;
  3584. BytesToWaitFor: DWORDLONG;
  3585. UsnJournalID: DWORDLONG;
  3586. end;
  3587. {$EXTERNALSYM READ_USN_JOURNAL_DATA}
  3588. TReadUsnJournalData = READ_USN_JOURNAL_DATA;
  3589. PReadUsnJournalData = PREAD_USN_JOURNAL_DATA;
  3590. //
  3591. // The initial Major.Minor version of the Usn record will be 2.0.
  3592. // In general, the MinorVersion may be changed if fields are added
  3593. // to this structure in such a way that the previous version of the
  3594. // software can still correctly the fields it knows about. The
  3595. // MajorVersion should only be changed if the previous version of
  3596. // any software using this structure would incorrectly handle new
  3597. // records due to structure changes.
  3598. //
  3599. // The first update to this will force the structure to version 2.0.
  3600. // This will add the extended information about the source as
  3601. // well as indicate the file name offset within the structure.
  3602. //
  3603. // The following structure is returned with these fsctls.
  3604. //
  3605. // FSCTL_READ_USN_JOURNAL
  3606. // FSCTL_READ_FILE_USN_DATA
  3607. // FSCTL_ENUM_USN_DATA
  3608. //
  3609. PUSN_RECORD = ^USN_RECORD;
  3610. {$EXTERNALSYM PUSN_RECORD}
  3611. USN_RECORD = record
  3612. RecordLength: DWORD;
  3613. MajorVersion: WORD;
  3614. MinorVersion: WORD;
  3615. FileReferenceNumber: DWORDLONG;
  3616. ParentFileReferenceNumber: DWORDLONG;
  3617. Usn: USN;
  3618. TimeStamp: LARGE_INTEGER;
  3619. Reason: DWORD;
  3620. SourceInfo: DWORD;
  3621. SecurityId: DWORD;
  3622. FileAttributes: DWORD;
  3623. FileNameLength: WORD;
  3624. FileNameOffset: WORD;
  3625. FileName: array [0..0] of WCHAR;
  3626. end;
  3627. {$EXTERNALSYM USN_RECORD}
  3628. TUsnRecord = USN_RECORD;
  3629. PUsnRecord = PUSN_RECORD;
  3630. const
  3631. USN_PAGE_SIZE = $1000;
  3632. {$EXTERNALSYM USN_PAGE_SIZE}
  3633. USN_REASON_DATA_OVERWRITE = $00000001;
  3634. {$EXTERNALSYM USN_REASON_DATA_OVERWRITE}
  3635. USN_REASON_DATA_EXTEND = $00000002;
  3636. {$EXTERNALSYM USN_REASON_DATA_EXTEND}
  3637. USN_REASON_DATA_TRUNCATION = $00000004;
  3638. {$EXTERNALSYM USN_REASON_DATA_TRUNCATION}
  3639. USN_REASON_NAMED_DATA_OVERWRITE = $00000010;
  3640. {$EXTERNALSYM USN_REASON_NAMED_DATA_OVERWRITE}
  3641. USN_REASON_NAMED_DATA_EXTEND = $00000020;
  3642. {$EXTERNALSYM USN_REASON_NAMED_DATA_EXTEND}
  3643. USN_REASON_NAMED_DATA_TRUNCATION = $00000040;
  3644. {$EXTERNALSYM USN_REASON_NAMED_DATA_TRUNCATION}
  3645. USN_REASON_FILE_CREATE = $00000100;
  3646. {$EXTERNALSYM USN_REASON_FILE_CREATE}
  3647. USN_REASON_FILE_DELETE = $00000200;
  3648. {$EXTERNALSYM USN_REASON_FILE_DELETE}
  3649. USN_REASON_EA_CHANGE = $00000400;
  3650. {$EXTERNALSYM USN_REASON_EA_CHANGE}
  3651. USN_REASON_SECURITY_CHANGE = $00000800;
  3652. {$EXTERNALSYM USN_REASON_SECURITY_CHANGE}
  3653. USN_REASON_RENAME_OLD_NAME = $00001000;
  3654. {$EXTERNALSYM USN_REASON_RENAME_OLD_NAME}
  3655. USN_REASON_RENAME_NEW_NAME = $00002000;
  3656. {$EXTERNALSYM USN_REASON_RENAME_NEW_NAME}
  3657. USN_REASON_INDEXABLE_CHANGE = $00004000;
  3658. {$EXTERNALSYM USN_REASON_INDEXABLE_CHANGE}
  3659. USN_REASON_BASIC_INFO_CHANGE = $00008000;
  3660. {$EXTERNALSYM USN_REASON_BASIC_INFO_CHANGE}
  3661. USN_REASON_HARD_LINK_CHANGE = $00010000;
  3662. {$EXTERNALSYM USN_REASON_HARD_LINK_CHANGE}
  3663. USN_REASON_COMPRESSION_CHANGE = $00020000;
  3664. {$EXTERNALSYM USN_REASON_COMPRESSION_CHANGE}
  3665. USN_REASON_ENCRYPTION_CHANGE = $00040000;
  3666. {$EXTERNALSYM USN_REASON_ENCRYPTION_CHANGE}
  3667. USN_REASON_OBJECT_ID_CHANGE = $00080000;
  3668. {$EXTERNALSYM USN_REASON_OBJECT_ID_CHANGE}
  3669. USN_REASON_REPARSE_POINT_CHANGE = $00100000;
  3670. {$EXTERNALSYM USN_REASON_REPARSE_POINT_CHANGE}
  3671. USN_REASON_STREAM_CHANGE = $00200000;
  3672. {$EXTERNALSYM USN_REASON_STREAM_CHANGE}
  3673. USN_REASON_CLOSE = DWORD($80000000);
  3674. {$EXTERNALSYM USN_REASON_CLOSE}
  3675. //
  3676. // Structure for FSCTL_QUERY_USN_JOUNAL
  3677. //
  3678. type
  3679. PUSN_JOURNAL_DATA = ^USN_JOURNAL_DATA;
  3680. {$EXTERNALSYM PUSN_JOURNAL_DATA}
  3681. USN_JOURNAL_DATA = record
  3682. UsnJournalID: DWORDLONG;
  3683. FirstUsn: USN;
  3684. NextUsn: USN;
  3685. LowestValidUsn: USN;
  3686. MaxUsn: USN;
  3687. MaximumSize: DWORDLONG;
  3688. AllocationDelta: DWORDLONG;
  3689. end;
  3690. {$EXTERNALSYM USN_JOURNAL_DATA}
  3691. TUsnJournalData = USN_JOURNAL_DATA;
  3692. PUsnJournalData = PUSN_JOURNAL_DATA;
  3693. //
  3694. // Structure for FSCTL_DELETE_USN_JOURNAL
  3695. //
  3696. PDELETE_USN_JOURNAL_DATA = ^DELETE_USN_JOURNAL_DATA;
  3697. {$EXTERNALSYM PDELETE_USN_JOURNAL_DATA}
  3698. DELETE_USN_JOURNAL_DATA = record
  3699. UsnJournalID: DWORDLONG;
  3700. DeleteFlags: DWORD;
  3701. end;
  3702. {$EXTERNALSYM DELETE_USN_JOURNAL_DATA}
  3703. TDeleteUsnJournalData = DELETE_USN_JOURNAL_DATA;
  3704. PDeleteUsnJournalData = PDELETE_USN_JOURNAL_DATA;
  3705. const
  3706. USN_DELETE_FLAG_DELETE = $00000001;
  3707. {$EXTERNALSYM USN_DELETE_FLAG_DELETE}
  3708. USN_DELETE_FLAG_NOTIFY = $00000002;
  3709. {$EXTERNALSYM USN_DELETE_FLAG_NOTIFY}
  3710. USN_DELETE_VALID_FLAGS = $00000003;
  3711. {$EXTERNALSYM USN_DELETE_VALID_FLAGS}
  3712. //
  3713. // Structure for FSCTL_MARK_HANDLE
  3714. //
  3715. type
  3716. PMARK_HANDLE_INFO = ^MARK_HANDLE_INFO;
  3717. {$EXTERNALSYM PMARK_HANDLE_INFO}
  3718. MARK_HANDLE_INFO = record
  3719. UsnSourceInfo: DWORD;
  3720. VolumeHandle: HANDLE;
  3721. HandleInfo: DWORD;
  3722. end;
  3723. {$EXTERNALSYM MARK_HANDLE_INFO}
  3724. TMarkHandleInfo = MARK_HANDLE_INFO;
  3725. PMarkHandleInfo = PMARK_HANDLE_INFO;
  3726. {$IFDEF _WIN64}
  3727. //
  3728. // 32/64 Bit thunking support structure
  3729. //
  3730. MARK_HANDLE_INFO32 = record
  3731. UsnSourceInfo: DWORD;
  3732. VolumeHandle: UINT32;
  3733. HandleInfo: DWORD;
  3734. end;
  3735. {$EXTERNALSYM MARK_HANDLE_INFO32}
  3736. PMARK_HANDLE_INFO32 = ^MARK_HANDLE_INFO32;
  3737. {$EXTERNALSYM PMARK_HANDLE_INFO32}
  3738. TMarkHandleInfo32 = MARK_HANDLE_INFO32;
  3739. PMarkHandleInfo32 = PMARK_HANDLE_INFO32;
  3740. {$ENDIF _WIN64}
  3741. //
  3742. // Flags for the additional source information above.
  3743. //
  3744. // USN_SOURCE_DATA_MANAGEMENT - Service is not modifying the external view
  3745. // of any part of the file. Typical case is HSM moving data to
  3746. // and from external storage.
  3747. //
  3748. // USN_SOURCE_AUXILIARY_DATA - Service is not modifying the external view
  3749. // of the file with regard to the application that created this file.
  3750. // Can be used to add private data streams to a file.
  3751. //
  3752. // USN_SOURCE_REPLICATION_MANAGEMENT - Service is modifying a file to match
  3753. // the contents of the same file which exists in another member of the
  3754. // replica set.
  3755. //
  3756. const
  3757. USN_SOURCE_DATA_MANAGEMENT = $00000001;
  3758. {$EXTERNALSYM USN_SOURCE_DATA_MANAGEMENT}
  3759. USN_SOURCE_AUXILIARY_DATA = $00000002;
  3760. {$EXTERNALSYM USN_SOURCE_AUXILIARY_DATA}
  3761. USN_SOURCE_REPLICATION_MANAGEMENT = $00000004;
  3762. {$EXTERNALSYM USN_SOURCE_REPLICATION_MANAGEMENT}
  3763. //
  3764. // Flags for the HandleInfo field above
  3765. //
  3766. // MARK_HANDLE_PROTECT_CLUSTERS - disallow any defragmenting (FSCTL_MOVE_FILE) until the
  3767. // the handle is closed
  3768. //
  3769. MARK_HANDLE_PROTECT_CLUSTERS = $00000001;
  3770. {$EXTERNALSYM MARK_HANDLE_PROTECT_CLUSTERS}
  3771. //
  3772. // Structure for FSCTL_SECURITY_ID_CHECK
  3773. //
  3774. type
  3775. PBULK_SECURITY_TEST_DATA = ^BULK_SECURITY_TEST_DATA;
  3776. {$EXTERNALSYM PBULK_SECURITY_TEST_DATA}
  3777. BULK_SECURITY_TEST_DATA = record
  3778. DesiredAccess: ACCESS_MASK;
  3779. SecurityIds: array [0..0] of DWORD;
  3780. end;
  3781. {$EXTERNALSYM BULK_SECURITY_TEST_DATA}
  3782. TBulkSecurityTestData = BULK_SECURITY_TEST_DATA;
  3783. PBulkSecurityTestData = PBULK_SECURITY_TEST_DATA;
  3784. //
  3785. // Output flags for the FSCTL_IS_VOLUME_DIRTY
  3786. //
  3787. const
  3788. VOLUME_IS_DIRTY = $00000001;
  3789. {$EXTERNALSYM VOLUME_IS_DIRTY}
  3790. VOLUME_UPGRADE_SCHEDULED = $00000002;
  3791. {$EXTERNALSYM VOLUME_UPGRADE_SCHEDULED}
  3792. //
  3793. // Structures for FSCTL_FILE_PREFETCH
  3794. //
  3795. type
  3796. _FILE_PREFETCH = record
  3797. Type_: DWORD;
  3798. Count: DWORD;
  3799. Prefetch: array [0..0] of DWORDLONG;
  3800. end;
  3801. {$EXTERNALSYM _FILE_PREFETCH}
  3802. FILE_PREFETCH = _FILE_PREFETCH;
  3803. {$EXTERNALSYM FILE_PREFETCH}
  3804. PFILE_PREFETCH = ^FILE_PREFETCH;
  3805. {$EXTERNALSYM PFILE_PREFETCH}
  3806. TFilePrefetch = FILE_PREFETCH;
  3807. PFilePrefetch = PFILE_PREFETCH;
  3808. const
  3809. FILE_PREFETCH_TYPE_FOR_CREATE = $1;
  3810. {$EXTERNALSYM FILE_PREFETCH_TYPE_FOR_CREATE}
  3811. //
  3812. // Structures for FSCTL_FILESYSTEM_GET_STATISTICS
  3813. //
  3814. // Filesystem performance counters
  3815. //
  3816. type
  3817. PFILESYSTEM_STATISTICS = ^FILESYSTEM_STATISTICS;
  3818. {$EXTERNALSYM PFILESYSTEM_STATISTICS}
  3819. _FILESYSTEM_STATISTICS = record
  3820. FileSystemType: WORD;
  3821. Version: WORD; // currently version 1
  3822. SizeOfCompleteStructure: DWORD; // must by a mutiple of 64 bytes
  3823. UserFileReads: DWORD;
  3824. UserFileReadBytes: DWORD;
  3825. UserDiskReads: DWORD;
  3826. UserFileWrites: DWORD;
  3827. UserFileWriteBytes: DWORD;
  3828. UserDiskWrites: DWORD;
  3829. MetaDataReads: DWORD;
  3830. MetaDataReadBytes: DWORD;
  3831. MetaDataDiskReads: DWORD;
  3832. MetaDataWrites: DWORD;
  3833. MetaDataWriteBytes: DWORD;
  3834. MetaDataDiskWrites: DWORD;
  3835. //
  3836. // The file system's private structure is appended here.
  3837. //
  3838. end;
  3839. {$EXTERNALSYM _FILESYSTEM_STATISTICS}
  3840. FILESYSTEM_STATISTICS = _FILESYSTEM_STATISTICS;
  3841. {$EXTERNALSYM FILESYSTEM_STATISTICS}
  3842. TFilesystemStatistics = FILESYSTEM_STATISTICS;
  3843. PFilesystemStatistics = PFILESYSTEM_STATISTICS;
  3844. // values for FS_STATISTICS.FileSystemType
  3845. const
  3846. FILESYSTEM_STATISTICS_TYPE_NTFS = 1;
  3847. {$EXTERNALSYM FILESYSTEM_STATISTICS_TYPE_NTFS}
  3848. FILESYSTEM_STATISTICS_TYPE_FAT = 2;
  3849. {$EXTERNALSYM FILESYSTEM_STATISTICS_TYPE_FAT}
  3850. //
  3851. // File System Specific Statistics Data
  3852. //
  3853. type
  3854. PFAT_STATISTICS = ^FAT_STATISTICS;
  3855. {$EXTERNALSYM PFAT_STATISTICS}
  3856. _FAT_STATISTICS = record
  3857. CreateHits: DWORD;
  3858. SuccessfulCreates: DWORD;
  3859. FailedCreates: DWORD;
  3860. NonCachedReads: DWORD;
  3861. NonCachedReadBytes: DWORD;
  3862. NonCachedWrites: DWORD;
  3863. NonCachedWriteBytes: DWORD;
  3864. NonCachedDiskReads: DWORD;
  3865. NonCachedDiskWrites: DWORD;
  3866. end;
  3867. {$EXTERNALSYM _FAT_STATISTICS}
  3868. FAT_STATISTICS = _FAT_STATISTICS;
  3869. {$EXTERNALSYM FAT_STATISTICS}
  3870. TFatStatistics = FAT_STATISTICS;
  3871. PFatStatistics = PFAT_STATISTICS;
  3872. // NTFS Statistics
  3873. TMftWritesUserLevel = record
  3874. Write: WORD;
  3875. Create: WORD;
  3876. SetInfo: WORD;
  3877. Flush: WORD;
  3878. end;
  3879. TMft2WritesUserLevel = record
  3880. Write: WORD;
  3881. Create: WORD;
  3882. SetInfo: WORD;
  3883. Flush: WORD;
  3884. end;
  3885. TBitmapWritesUserLevel = record
  3886. Write: WORD;
  3887. Create: WORD;
  3888. SetInfo: WORD;
  3889. end;
  3890. TMftBitmapWritesUserLevel = record
  3891. Write: WORD;
  3892. Create: WORD;
  3893. SetInfo: WORD;
  3894. Flush: WORD;
  3895. end;
  3896. TAllocate = record
  3897. Calls: DWORD; // number of individual calls to allocate clusters
  3898. Clusters: DWORD; // number of clusters allocated
  3899. Hints: DWORD; // number of times a hint was specified
  3900. RunsReturned: DWORD; // number of runs used to satisify all the requests
  3901. HintsHonored: DWORD; // number of times the hint was useful
  3902. HintsClusters: DWORD; // number of clusters allocated via the hint
  3903. Cache: DWORD; // number of times the cache was useful other than the hint
  3904. CacheClusters: DWORD; // number of clusters allocated via the cache other than the hint
  3905. CacheMiss: DWORD; // number of times the cache wasn't useful
  3906. CacheMissClusters: DWORD; // number of clusters allocated without the cache
  3907. end;
  3908. {$EXTERNALSYM NTFS_STATISTICS}
  3909. PNTFS_STATISTICS = ^NTFS_STATISTICS;
  3910. _NTFS_STATISTICS = record
  3911. LogFileFullExceptions: DWORD;
  3912. OtherExceptions: DWORD;
  3913. //
  3914. // Other meta data io's
  3915. //
  3916. MftReads: DWORD;
  3917. MftReadBytes: DWORD;
  3918. MftWrites: DWORD;
  3919. MftWriteBytes: DWORD;
  3920. MftWritesUserLevel: TMftWritesUserLevel;
  3921. MftWritesFlushForLogFileFull: WORD;
  3922. MftWritesLazyWriter: WORD;
  3923. MftWritesUserRequest: WORD;
  3924. Mft2Writes: DWORD;
  3925. Mft2WriteBytes: DWORD;
  3926. Mft2WritesUserLevel: TMft2WritesUserLevel;
  3927. Mft2WritesFlushForLogFileFull: WORD;
  3928. Mft2WritesLazyWriter: WORD;
  3929. Mft2WritesUserRequest: WORD;
  3930. RootIndexReads: DWORD;
  3931. RootIndexReadBytes: DWORD;
  3932. RootIndexWrites: DWORD;
  3933. RootIndexWriteBytes: DWORD;
  3934. BitmapReads: DWORD;
  3935. BitmapReadBytes: DWORD;
  3936. BitmapWrites: DWORD;
  3937. BitmapWriteBytes: DWORD;
  3938. BitmapWritesFlushForLogFileFull: WORD;
  3939. BitmapWritesLazyWriter: WORD;
  3940. BitmapWritesUserRequest: WORD;
  3941. BitmapWritesUserLevel: TBitmapWritesUserLevel;
  3942. MftBitmapReads: DWORD;
  3943. MftBitmapReadBytes: DWORD;
  3944. MftBitmapWrites: DWORD;
  3945. MftBitmapWriteBytes: DWORD;
  3946. MftBitmapWritesFlushForLogFileFull: WORD;
  3947. MftBitmapWritesLazyWriter: WORD;
  3948. MftBitmapWritesUserRequest: WORD;
  3949. MftBitmapWritesUserLevel: TMftBitmapWritesUserLevel;
  3950. UserIndexReads: DWORD;
  3951. UserIndexReadBytes: DWORD;
  3952. UserIndexWrites: DWORD;
  3953. UserIndexWriteBytes: DWORD;
  3954. //
  3955. // Additions for NT 5.0
  3956. //
  3957. LogFileReads: DWORD;
  3958. LogFileReadBytes: DWORD;
  3959. LogFileWrites: DWORD;
  3960. LogFileWriteBytes: DWORD;
  3961. Allocate: TAllocate;
  3962. end;
  3963. {$EXTERNALSYM _NTFS_STATISTICS}
  3964. NTFS_STATISTICS = _NTFS_STATISTICS;
  3965. {$EXTERNALSYM PNTFS_STATISTICS}
  3966. TNTFSStatistics = NTFS_STATISTICS;
  3967. PNTFSStatistics = PNTFS_STATISTICS;
  3968. //
  3969. // Structure for FSCTL_SET_OBJECT_ID, FSCTL_GET_OBJECT_ID, and FSCTL_CREATE_OR_GET_OBJECT_ID
  3970. //
  3971. PFILE_OBJECTID_BUFFER = ^FILE_OBJECTID_BUFFER;
  3972. {$EXTERNALSYM PFILE_OBJECTID_BUFFER}
  3973. _FILE_OBJECTID_BUFFER = record
  3974. //
  3975. // This is the portion of the object id that is indexed.
  3976. //
  3977. ObjectId: array [0..15] of BYTE;
  3978. //
  3979. // This portion of the object id is not indexed, it's just
  3980. // some metadata for the user's benefit.
  3981. //
  3982. case Integer of
  3983. 0: (
  3984. BirthVolumeId: array [0..15] of BYTE;
  3985. BirthObjectId: array [0..15] of BYTE;
  3986. DomainId: array [0..15] of BYTE);
  3987. 1: (
  3988. ExtendedInfo: array [0..47] of BYTE);
  3989. end;
  3990. {$EXTERNALSYM _FILE_OBJECTID_BUFFER}
  3991. FILE_OBJECTID_BUFFER = _FILE_OBJECTID_BUFFER;
  3992. {$EXTERNALSYM FILE_OBJECTID_BUFFER}
  3993. TFileObjectIdBuffer = FILE_OBJECTID_BUFFER;
  3994. PFileObjectIdBuffer = PFILE_OBJECTID_BUFFER;
  3995. //
  3996. // Structure for FSCTL_SET_SPARSE
  3997. //
  3998. PFILE_SET_SPARSE_BUFFER = ^FILE_SET_SPARSE_BUFFER;
  3999. {$EXTERNALSYM PFILE_SET_SPARSE_BUFFER}
  4000. _FILE_SET_SPARSE_BUFFER = record
  4001. SetSparse: ByteBool;
  4002. end;
  4003. {$EXTERNALSYM _FILE_SET_SPARSE_BUFFER}
  4004. FILE_SET_SPARSE_BUFFER = _FILE_SET_SPARSE_BUFFER;
  4005. {$EXTERNALSYM FILE_SET_SPARSE_BUFFER}
  4006. TFileSetSparseBuffer = FILE_SET_SPARSE_BUFFER;
  4007. PFileSetSparseBuffer = PFILE_SET_SPARSE_BUFFER;
  4008. //
  4009. // Structure for FSCTL_SET_ZERO_DATA
  4010. //
  4011. PFILE_ZERO_DATA_INFORMATION = ^FILE_ZERO_DATA_INFORMATION;
  4012. {$EXTERNALSYM PFILE_ZERO_DATA_INFORMATION}
  4013. _FILE_ZERO_DATA_INFORMATION = record
  4014. FileOffset: LARGE_INTEGER;
  4015. BeyondFinalZero: LARGE_INTEGER;
  4016. end;
  4017. {$EXTERNALSYM _FILE_ZERO_DATA_INFORMATION}
  4018. FILE_ZERO_DATA_INFORMATION = _FILE_ZERO_DATA_INFORMATION;
  4019. {$EXTERNALSYM FILE_ZERO_DATA_INFORMATION}
  4020. TFileZeroDataInformation = FILE_ZERO_DATA_INFORMATION;
  4021. PFileZeroDataInformation = PFILE_ZERO_DATA_INFORMATION;
  4022. //
  4023. // Structure for FSCTL_QUERY_ALLOCATED_RANGES
  4024. //
  4025. //
  4026. // Querying the allocated ranges requires an output buffer to store the
  4027. // allocated ranges and an input buffer to specify the range to query.
  4028. // The input buffer contains a single entry, the output buffer is an
  4029. // array of the following structure.
  4030. //
  4031. PFILE_ALLOCATED_RANGE_BUFFER = ^FILE_ALLOCATED_RANGE_BUFFER;
  4032. {$EXTERNALSYM PFILE_ALLOCATED_RANGE_BUFFER}
  4033. _FILE_ALLOCATED_RANGE_BUFFER = record
  4034. FileOffset: LARGE_INTEGER;
  4035. Length: LARGE_INTEGER;
  4036. end;
  4037. {$EXTERNALSYM _FILE_ALLOCATED_RANGE_BUFFER}
  4038. FILE_ALLOCATED_RANGE_BUFFER = _FILE_ALLOCATED_RANGE_BUFFER;
  4039. {$EXTERNALSYM FILE_ALLOCATED_RANGE_BUFFER}
  4040. TFileAllocatedRangeBuffer = FILE_ALLOCATED_RANGE_BUFFER;
  4041. PFileAllocatedRangeBuffer = PFILE_ALLOCATED_RANGE_BUFFER;
  4042. //
  4043. // Structures for FSCTL_SET_ENCRYPTION, FSCTL_WRITE_RAW_ENCRYPTED, and FSCTL_READ_RAW_ENCRYPTED
  4044. //
  4045. //
  4046. // The input buffer to set encryption indicates whether we are to encrypt/decrypt a file
  4047. // or an individual stream.
  4048. //
  4049. PENCRYPTION_BUFFER = ^ENCRYPTION_BUFFER;
  4050. {$EXTERNALSYM PENCRYPTION_BUFFER}
  4051. _ENCRYPTION_BUFFER = record
  4052. EncryptionOperation: DWORD;
  4053. Private_: array [0..0] of BYTE;
  4054. end;
  4055. {$EXTERNALSYM _ENCRYPTION_BUFFER}
  4056. ENCRYPTION_BUFFER = _ENCRYPTION_BUFFER;
  4057. {$EXTERNALSYM ENCRYPTION_BUFFER}
  4058. TEncryptionBuffer = ENCRYPTION_BUFFER;
  4059. PEncryptionBuffer = PENCRYPTION_BUFFER;
  4060. const
  4061. FILE_SET_ENCRYPTION = $00000001;
  4062. {$EXTERNALSYM FILE_SET_ENCRYPTION}
  4063. FILE_CLEAR_ENCRYPTION = $00000002;
  4064. {$EXTERNALSYM FILE_CLEAR_ENCRYPTION}
  4065. STREAM_SET_ENCRYPTION = $00000003;
  4066. {$EXTERNALSYM STREAM_SET_ENCRYPTION}
  4067. STREAM_CLEAR_ENCRYPTION = $00000004;
  4068. {$EXTERNALSYM STREAM_CLEAR_ENCRYPTION}
  4069. MAXIMUM_ENCRYPTION_VALUE = $00000004;
  4070. {$EXTERNALSYM MAXIMUM_ENCRYPTION_VALUE}
  4071. //
  4072. // The optional output buffer to set encryption indicates that the last encrypted
  4073. // stream in a file has been marked as decrypted.
  4074. //
  4075. type
  4076. PDECRYPTION_STATUS_BUFFER = ^DECRYPTION_STATUS_BUFFER;
  4077. {$EXTERNALSYM PDECRYPTION_STATUS_BUFFER}
  4078. _DECRYPTION_STATUS_BUFFER = record
  4079. NoEncryptedStreams: ByteBool;
  4080. end;
  4081. {$EXTERNALSYM _DECRYPTION_STATUS_BUFFER}
  4082. DECRYPTION_STATUS_BUFFER = _DECRYPTION_STATUS_BUFFER;
  4083. {$EXTERNALSYM DECRYPTION_STATUS_BUFFER}
  4084. TDecryptionStatusBuffer = DECRYPTION_STATUS_BUFFER;
  4085. PDecryptionStatusBuffer = PDECRYPTION_STATUS_BUFFER;
  4086. const
  4087. ENCRYPTION_FORMAT_DEFAULT = $01;
  4088. {$EXTERNALSYM ENCRYPTION_FORMAT_DEFAULT}
  4089. COMPRESSION_FORMAT_SPARSE = $4000;
  4090. {$EXTERNALSYM COMPRESSION_FORMAT_SPARSE}
  4091. //
  4092. // Request Encrypted Data structure. This is used to indicate
  4093. // the range of the file to read. It also describes the
  4094. // output buffer used to return the data.
  4095. //
  4096. type
  4097. PREQUEST_RAW_ENCRYPTED_DATA = ^REQUEST_RAW_ENCRYPTED_DATA;
  4098. {$EXTERNALSYM PREQUEST_RAW_ENCRYPTED_DATA}
  4099. _REQUEST_RAW_ENCRYPTED_DATA = record
  4100. //
  4101. // Requested file offset and requested length to read.
  4102. // The fsctl will round the starting offset down
  4103. // to a file system boundary. It will also
  4104. // round the length up to a file system boundary.
  4105. //
  4106. FileOffset: LONGLONG;
  4107. Length: DWORD;
  4108. end;
  4109. {$EXTERNALSYM _REQUEST_RAW_ENCRYPTED_DATA}
  4110. REQUEST_RAW_ENCRYPTED_DATA = _REQUEST_RAW_ENCRYPTED_DATA;
  4111. {$EXTERNALSYM REQUEST_RAW_ENCRYPTED_DATA}
  4112. TRequestRawEncryptedData = REQUEST_RAW_ENCRYPTED_DATA;
  4113. PRequestRawEncryptedData = PREQUEST_RAW_ENCRYPTED_DATA;
  4114. //
  4115. // Encrypted Data Information structure. This structure
  4116. // is used to return raw encrypted data from a file in
  4117. // order to perform off-line recovery. The data will be
  4118. // encrypted or encrypted and compressed. The off-line
  4119. // service will need to use the encryption and compression
  4120. // format information to recover the file data. In the
  4121. // event that the data is both encrypted and compressed then
  4122. // the decryption must occur before decompression. All
  4123. // the data units below must be encrypted and compressed
  4124. // with the same format.
  4125. //
  4126. // The data will be returned in units. The data unit size
  4127. // will be fixed per request. If the data is compressed
  4128. // then the data unit size will be the compression unit size.
  4129. //
  4130. // This structure is at the beginning of the buffer used to
  4131. // return the encrypted data. The actual raw bytes from
  4132. // the file will follow this buffer. The offset of the
  4133. // raw bytes from the beginning of this structure is
  4134. // specified in the REQUEST_RAW_ENCRYPTED_DATA structure
  4135. // described above.
  4136. //
  4137. PENCRYPTED_DATA_INFO = ^ENCRYPTED_DATA_INFO;
  4138. {$EXTERNALSYM PENCRYPTED_DATA_INFO}
  4139. _ENCRYPTED_DATA_INFO = record
  4140. //
  4141. // This is the file offset for the first entry in the
  4142. // data block array. The file system will round
  4143. // the requested start offset down to a boundary
  4144. // that is consistent with the format of the file.
  4145. //
  4146. StartingFileOffset: DWORDLONG;
  4147. //
  4148. // Data offset in output buffer. The output buffer
  4149. // begins with an ENCRYPTED_DATA_INFO structure.
  4150. // The file system will then store the raw bytes from
  4151. // disk beginning at the following offset within the
  4152. // output buffer.
  4153. //
  4154. OutputBufferOffset: DWORD;
  4155. //
  4156. // The number of bytes being returned that are within
  4157. // the size of the file. If this value is less than
  4158. // (NumberOfDataBlocks << DataUnitShift), it means the
  4159. // end of the file occurs within this transfer. Any
  4160. // data beyond file size is invalid and was never
  4161. // passed to the encryption driver.
  4162. //
  4163. BytesWithinFileSize: DWORD;
  4164. //
  4165. // The number of bytes being returned that are below
  4166. // valid data length. If this value is less than
  4167. // (NumberOfDataBlocks << DataUnitShift), it means the
  4168. // end of the valid data occurs within this transfer.
  4169. // After decrypting the data from this transfer, any
  4170. // byte(s) beyond valid data length must be zeroed.
  4171. //
  4172. BytesWithinValidDataLength: DWORD;
  4173. //
  4174. // Code for the compression format as defined in
  4175. // ntrtl.h. Note that COMPRESSION_FORMAT_NONE
  4176. // and COMPRESSION_FORMAT_DEFAULT are invalid if
  4177. // any of the described chunks are compressed.
  4178. //
  4179. CompressionFormat: WORD;
  4180. //
  4181. // The DataUnit is the granularity used to access the
  4182. // disk. It will be the same as the compression unit
  4183. // size for a compressed file. For an uncompressed
  4184. // file, it will be some cluster-aligned power of 2 that
  4185. // the file system deems convenient. A caller should
  4186. // not expect that successive calls will have the
  4187. // same data unit shift value as the previous call.
  4188. //
  4189. // Since chunks and compression units are expected to be
  4190. // powers of 2 in size, we express them log2. So, for
  4191. // example (1 << ChunkShift) == ChunkSizeInBytes. The
  4192. // ClusterShift indicates how much space must be saved
  4193. // to successfully compress a compression unit - each
  4194. // successfully compressed data unit must occupy
  4195. // at least one cluster less in bytes than an uncompressed
  4196. // data block unit.
  4197. //
  4198. DataUnitShift: BYTE;
  4199. ChunkShift: BYTE;
  4200. ClusterShift: BYTE;
  4201. //
  4202. // The format for the encryption.
  4203. //
  4204. EncryptionFormat: BYTE;
  4205. //
  4206. // This is the number of entries in the data block size
  4207. // array.
  4208. //
  4209. NumberOfDataBlocks: WORD;
  4210. //
  4211. // This is an array of sizes in the data block array. There
  4212. // must be one entry in this array for each data block
  4213. // read from disk. The size has a different meaning
  4214. // depending on whether the file is compressed.
  4215. //
  4216. // A size of zero always indicates that the final data consists entirely
  4217. // of zeroes. There is no decryption or decompression to
  4218. // perform.
  4219. //
  4220. // If the file is compressed then the data block size indicates
  4221. // whether this block is compressed. A size equal to
  4222. // the block size indicates that the corresponding block did
  4223. // not compress. Any other non-zero size indicates the
  4224. // size of the compressed data which needs to be
  4225. // decrypted/decompressed.
  4226. //
  4227. // If the file is not compressed then the data block size
  4228. // indicates the amount of data within the block that
  4229. // needs to be decrypted. Any other non-zero size indicates
  4230. // that the remaining bytes in the data unit within the file
  4231. // consists of zeros. An example of this is when the
  4232. // the read spans the valid data length of the file. There
  4233. // is no data to decrypt past the valid data length.
  4234. //
  4235. DataBlockSize: array [0..ANYSIZE_ARRAY - 1] of DWORD;
  4236. end;
  4237. {$EXTERNALSYM _ENCRYPTED_DATA_INFO}
  4238. ENCRYPTED_DATA_INFO = _ENCRYPTED_DATA_INFO;
  4239. {$EXTERNALSYM ENCRYPTED_DATA_INFO}
  4240. TEncryptedDataInfo = ENCRYPTED_DATA_INFO;
  4241. PEncryptedDataInfo = PENCRYPTED_DATA_INFO;
  4242. //
  4243. // FSCTL_READ_FROM_PLEX support
  4244. // Request Plex Read Data structure. This is used to indicate
  4245. // the range of the file to read. It also describes
  4246. // which plex to perform the read from.
  4247. //
  4248. _PLEX_READ_DATA_REQUEST = record
  4249. //
  4250. // Requested offset and length to read.
  4251. // The offset can be the virtual offset (vbo) in to a file,
  4252. // or a volume. In the case of a file offset,
  4253. // the fsd will round the starting offset down
  4254. // to a file system boundary. It will also
  4255. // round the length up to a file system boundary and
  4256. // enforce any other applicable limits.
  4257. //
  4258. ByteOffset: LARGE_INTEGER;
  4259. ByteLength: DWORD;
  4260. PlexNumber: DWORD;
  4261. end;
  4262. {$EXTERNALSYM _PLEX_READ_DATA_REQUEST}
  4263. PLEX_READ_DATA_REQUEST = _PLEX_READ_DATA_REQUEST;
  4264. {$EXTERNALSYM PLEX_READ_DATA_REQUEST}
  4265. PPLEX_READ_DATA_REQUEST = ^PLEX_READ_DATA_REQUEST;
  4266. {$EXTERNALSYM PPLEX_READ_DATA_REQUEST}
  4267. TPlexReadDataRequest = PLEX_READ_DATA_REQUEST;
  4268. PPlexReadDataRequest = PPLEX_READ_DATA_REQUEST;
  4269. //
  4270. // FSCTL_SIS_COPYFILE support
  4271. // Source and destination file names are passed in the FileNameBuffer.
  4272. // Both strings are null terminated, with the source name starting at
  4273. // the beginning of FileNameBuffer, and the destination name immediately
  4274. // following. Length fields include terminating nulls.
  4275. //
  4276. PSI_COPYFILE = ^SI_COPYFILE;
  4277. {$EXTERNALSYM PSI_COPYFILE}
  4278. _SI_COPYFILE = record
  4279. SourceFileNameLength: DWORD;
  4280. DestinationFileNameLength: DWORD;
  4281. Flags: DWORD;
  4282. FileNameBuffer: array [0..0] of WCHAR;
  4283. end;
  4284. {$EXTERNALSYM _SI_COPYFILE}
  4285. SI_COPYFILE = _SI_COPYFILE;
  4286. {$EXTERNALSYM SI_COPYFILE}
  4287. TSiCopyfile = SI_COPYFILE;
  4288. PSiCopyfile = PSI_COPYFILE;
  4289. const
  4290. COPYFILE_SIS_LINK = $0001; // Copy only if source is SIS
  4291. {$EXTERNALSYM COPYFILE_SIS_LINK}
  4292. COPYFILE_SIS_REPLACE = $0002; // Replace destination if it exists, otherwise don't.
  4293. {$EXTERNALSYM COPYFILE_SIS_REPLACE}
  4294. COPYFILE_SIS_FLAGS = $0003;
  4295. {$EXTERNALSYM COPYFILE_SIS_FLAGS}
  4296. //
  4297. // These IOCTLs are handled by hard disk volumes.
  4298. //
  4299. IOCTL_VOLUME_BASE = DWORD('V');
  4300. {$EXTERNALSYM IOCTL_VOLUME_BASE}
  4301. IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS = (
  4302. (IOCTL_VOLUME_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  4303. (0 shl 2) or METHOD_BUFFERED);
  4304. {$EXTERNALSYM IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS}
  4305. IOCTL_VOLUME_IS_CLUSTERED = (
  4306. (IOCTL_VOLUME_BASE shl 16) or (FILE_ANY_ACCESS shl 14) or
  4307. (12 shl 2) or METHOD_BUFFERED);
  4308. {$EXTERNALSYM IOCTL_VOLUME_IS_CLUSTERED}
  4309. //
  4310. // Disk extent definition.
  4311. //
  4312. type
  4313. PDISK_EXTENT = ^DISK_EXTENT;
  4314. {$EXTERNALSYM PDISK_EXTENT}
  4315. _DISK_EXTENT = record
  4316. DiskNumber: DWORD;
  4317. StartingOffset: LARGE_INTEGER;
  4318. ExtentLength: LARGE_INTEGER;
  4319. end;
  4320. {$EXTERNALSYM _DISK_EXTENT}
  4321. DISK_EXTENT = _DISK_EXTENT;
  4322. {$EXTERNALSYM DISK_EXTENT}
  4323. TDiskExtent = DISK_EXTENT;
  4324. PDiskExtent = PDISK_EXTENT;
  4325. //
  4326. // Output structure for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS.
  4327. //
  4328. PVOLUME_DISK_EXTENTS = ^VOLUME_DISK_EXTENTS;
  4329. {$EXTERNALSYM PVOLUME_DISK_EXTENTS}
  4330. _VOLUME_DISK_EXTENTS = record
  4331. NumberOfDiskExtents: DWORD;
  4332. Extents: array [0..0] of DISK_EXTENT;
  4333. end;
  4334. {$EXTERNALSYM _VOLUME_DISK_EXTENTS}
  4335. VOLUME_DISK_EXTENTS = _VOLUME_DISK_EXTENTS;
  4336. {$EXTERNALSYM VOLUME_DISK_EXTENTS}
  4337. TVolumeDiskExtents = VOLUME_DISK_EXTENTS;
  4338. PVolumeDiskExtents = PVOLUME_DISK_EXTENTS;
  4339. {$ENDIF JWA_IMPLEMENTATIONSECTION}
  4340. {$IFNDEF JWA_OMIT_SECTIONS}
  4341. implementation
  4342. //uses ...
  4343. {$ENDIF JWA_OMIT_SECTIONS}
  4344. {$IFNDEF JWA_INTERFACESECTION}
  4345. function CTL_CODE(DeviceType, Func, Method, Access: WORD): DWORD;
  4346. begin
  4347. Result := (DeviceType shl 16) or (Access shl 14) or (Func shl 2) or Method;
  4348. end;
  4349. function DEVICE_TYPE_FROM_CTL_CODE(CtrlCode: DWORD): WORD;
  4350. begin
  4351. Result := (CtrlCode and DWORD($FFFF0000)) shr 16;
  4352. end;
  4353. {
  4354. #define IsRecognizedPartition( PartitionType ) ( \
  4355. ((PartitionType & PARTITION_NTFT) && ((PartitionType & ~0xC0) == PARTITION_FAT_12)) || \
  4356. ((PartitionType & PARTITION_NTFT) && ((PartitionType & ~0xC0) == PARTITION_IFS)) || \
  4357. ((PartitionType & PARTITION_NTFT) && ((PartitionType & ~0xC0) == PARTITION_HUGE)) || \
  4358. ((PartitionType & PARTITION_NTFT) && ((PartitionType & ~0xC0) == PARTITION_FAT32)) || \
  4359. ((PartitionType & PARTITION_NTFT) && ((PartitionType & ~0xC0) == PARTITION_FAT32_XINT13)) || \
  4360. ((PartitionType & PARTITION_NTFT) && ((PartitionType & ~0xC0) == PARTITION_XINT13)) || \
  4361. ((PartitionType) == PARTITION_FAT_12) || \
  4362. ((PartitionType) == PARTITION_FAT_16) || \
  4363. ((PartitionType) == PARTITION_IFS) || \
  4364. ((PartitionType) == PARTITION_HUGE) || \
  4365. ((PartitionType) == PARTITION_FAT32) || \
  4366. ((PartitionType) == PARTITION_FAT32_XINT13) || \
  4367. ((PartitionType) == PARTITION_XINT13) )
  4368. }
  4369. function IsRecognizedPartition(PartitionType: DWORD): Boolean;
  4370. begin
  4371. Result :=
  4372. (((PartitionType and PARTITION_NTFT) <> 0) and ((PartitionType and not $C0) = PARTITION_FAT_12)) or
  4373. (((PartitionType and PARTITION_NTFT) <> 0) and ((PartitionType and not $C0) = PARTITION_IFS)) or
  4374. (((PartitionType and PARTITION_NTFT) <> 0) and ((PartitionType and not $C0) = PARTITION_HUGE)) or
  4375. (((PartitionType and PARTITION_NTFT) <> 0) and ((PartitionType and not $C0) = PARTITION_FAT32)) or
  4376. (((PartitionType and PARTITION_NTFT) <> 0) and ((PartitionType and not $C0) = PARTITION_FAT32_XINT13)) or
  4377. (((PartitionType and PARTITION_NTFT) <> 0) and ((PartitionType and not $C0) = PARTITION_XINT13)) or
  4378. ((PartitionType) = PARTITION_FAT_12) or
  4379. ((PartitionType) = PARTITION_FAT_16) or
  4380. ((PartitionType) = PARTITION_IFS) or
  4381. ((PartitionType) = PARTITION_HUGE) or
  4382. ((PartitionType) = PARTITION_FAT32) or
  4383. ((PartitionType) = PARTITION_FAT32_XINT13) or
  4384. ((PartitionType) = PARTITION_XINT13);
  4385. end;
  4386. function IsContainerPartition(PartitionType: DWORD): Boolean;
  4387. begin
  4388. Result :=
  4389. (PartitionType = PARTITION_EXTENDED) or
  4390. (PartitionType = PARTITION_XINT13_EXTENDED);
  4391. end;
  4392. function IsFTPartition(PartitionType: DWORD): Boolean;
  4393. begin
  4394. Result := ((PartitionType and PARTITION_NTFT) <> 0) and IsRecognizedPartition(PartitionType);
  4395. end;
  4396. function DiskGeometryGetPartition(Geometry: PDiskGeometryEx): PDiskPartitionInfo;
  4397. begin
  4398. Result := @Geometry^.Data[0];
  4399. end;
  4400. function DiskGeometryGetDetect(Geometry: PDiskGeometryEx): PDiskDetectionInfo;
  4401. var
  4402. Partition: PDiskPartitionInfo;
  4403. begin
  4404. Partition := DiskGeometryGetPartition(Geometry);
  4405. Result := PDiskDetectionInfo(PChar(Partition) + Partition^.SizeOfPartitionInfo*SizeOf(DWORD));
  4406. end;
  4407. {$ENDIF JWA_INTERFACESECTION}
  4408. {$IFNDEF JWA_OMIT_SECTIONS}
  4409. end.
  4410. {$ENDIF JWA_OMIT_SECTIONS}