jwawinioctl.pas 169 KB

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