jwawinioctl.pas 169 KB

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