doscalls.pas 224 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 1999-2002 by the Free Pascal development team.
  4. Basic OS/2 constants, types and functions
  5. implemented (mostly) in DOSCALL1.DLL.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. unit DosCalls;
  13. {***************************************************************************}
  14. interface
  15. {***************************************************************************}
  16. uses Strings;
  17. type PString = PShortString;
  18. {$PACKRECORDS 1}
  19. type TByteArray=array[0..$fff0] of byte;
  20. PByteArray=^TByteArray;
  21. TCharArray=array[0..$fff0] of char;
  22. PCharArray=^TCharArray;
  23. TWordArray=array[0..$7ff8] of word;
  24. PWordArray=^TWordArray;
  25. {****************************************************************************
  26. Thread related routines.
  27. ****************************************************************************}
  28. type TThreadEntry = function (Param: pointer): cardinal; cdecl;
  29. ThreadEntry = TThreadEntry;
  30. const dtSuspended =1; {Thread is started suspended instead of
  31. started at once.}
  32. dtStack_Commited =2; {Allocate all stack space at once. The
  33. operating system normally allocates more
  34. memory to the stack if the stack grows with
  35. the given stacksize as limit. This has the
  36. restriction that you cannot create a stack
  37. frame > 4 kb. at once. If you want to do
  38. this, or for other reasons you can allocate
  39. the complete stack at once with this flag.}
  40. (* The following for compatibility only *)
  41. CREATE_READY =0; { defect 65437 }
  42. CREATE_SUSPENDED =dtSuspended;
  43. STACK_SPARSE =0;
  44. STACK_COMMITTED =dtStack_Commited;
  45. { Wait option values }
  46. dtWait =0; {Wait until termination.}
  47. dtNoWait =1; {Do not wait. Return with error if not yet
  48. terminated.}
  49. (* The following for compatibility only *)
  50. DCWW_WAIT =dtWait;
  51. DCWW_NOWAIT =dtNoWait;
  52. {Create a new thread.
  53. TID = Thread ID of new thread is returned here.
  54. Address = Thread entry point. The new thread starts executing here.
  55. AParam = This one is passed to the thread entry procedure.
  56. Flags = Flags. Either dtsuspended or dt_stackcommited.
  57. StackSize = Size of the stack of the new thread.}
  58. function DosCreateThread(var TID:longint;Address:TThreadEntry;
  59. AParam:pointer;Flags,StackSize:longint):cardinal;cdecl;
  60. function DosCreateThread (var TID: cardinal; Address: TThreadEntry;
  61. AParam: pointer; Flags, StackSize: cardinal): cardinal; cdecl;
  62. (* Overloaded version for compatibility. *)
  63. function DosCreateThread(var TID:longint;Address:pointer;
  64. AParam:Pointer;Flags,StackSize:longint):cardinal;cdecl;
  65. function DosCreateThread (var TID: cardinal; Address: pointer;
  66. AParam: Pointer; Flags, StackSize: cardinal): cardinal; cdecl;
  67. {Suspend a running thread.}
  68. function DosSuspendThread(TID:cardinal):cardinal; cdecl;
  69. {Resume a suspended thread.}
  70. function DosResumeThread(TID:cardinal):cardinal; cdecl;
  71. {Terminate a specific thread.}
  72. function DosKillThread(TID:cardinal):cardinal; cdecl;
  73. {Wait until a specific thread has ended.
  74. TID = Thread to terminate. Can also be zero. In that case we
  75. wait until the next thread terminates. Its thread ID is
  76. returned back.
  77. Option = Flags. Either dtWait or dtNoWait.}
  78. function DosWaitThread(var TID:longint;Option:longint):cardinal; cdecl;
  79. function DosWaitThread(var TID:cardinal;Option:cardinal):cardinal; cdecl;
  80. {All other threads in the same process are suspended until a
  81. DosExitCritSec.}
  82. function DosEnterCritSec: cardinal; cdecl;
  83. {Resume the other threads again.}
  84. function DosExitCritSec: cardinal; cdecl;
  85. { DosExit codes }
  86. const deThread=0; {Terminate thread only.}
  87. deProcess=1; {Terminate the whole process.}
  88. (* The following for compatibility only *)
  89. Exit_Thread = deThread;
  90. Exit_Process = deProcess;
  91. {Terminate the thread or the program. Never returns, so it's defined as
  92. procedure.}
  93. procedure DosExit(Action,Result:cardinal); cdecl;
  94. type PThreadInfoBlock=^TThreadInfoBlock;
  95. PPThreadInfoBlock=^PThreadInfoBlock;
  96. PSysThreadIB=^TSysThreadIB;
  97. PProcessInfoBlock=^TProcessInfoBlock;
  98. PPProcessInfoBlock=^PProcessInfoBlock;
  99. TThreadInfoBlock=record
  100. Exh_Chain, {Head of exeption handler chain.}
  101. Stack, {Pointer to the thread's stack.}
  102. StackLimit:pointer; {Pointer to the thread's stack-end.}
  103. TIB2:PSysThreadIB; {Pointer to system specific thread info.}
  104. Version, {Version of this datastructure.}
  105. Ordinal:cardinal; {Thread ordinal number.}
  106. end;
  107. ThreadInfoBlock=TThreadInfoBlock;
  108. TSysThreadIB=record
  109. TID, {Thread ID.}
  110. Priority, {Low byte of low word: thread priority.
  111. High byte of low word: thread class
  112. 1 = Idle
  113. 2 = Regular
  114. 3 = Time critical
  115. 4 = Server}
  116. Version:cardinal; {Version of this datastructure.}
  117. MCCount, {Must complete count. ??? Info wanted!}
  118. MCForceFlag:word; {Must complete force flag. Info wanted!}
  119. end;
  120. SysThreadIB=TSysThreadIB;
  121. TProcessInfoBlock=record
  122. PID, {Process ID.}
  123. ParentPID, {Parent's process ID.}
  124. HMTE:cardinal; {Module handle of executable program.
  125. ??? Info wanted!}
  126. Cmd, {Command line options.}
  127. Env:PByteArray; {Environment strings.}
  128. flStatus, {1 means that the process is in exit list
  129. processing.}
  130. tType:cardinal; {Type of process:
  131. 0: Full screen protected mode.
  132. 1: DOS emulation.
  133. 2: Windowable full screen protected
  134. mode program.
  135. 3: Presentation manager program.
  136. 4: Detached mode process.}
  137. end;
  138. ProcessInfoBlock=TProcessInfoBlock;
  139. {OS/2 keeps information about the current process and the current thread
  140. is the datastructures TProcessInfoBlock and TThreadInfoBlock. All data
  141. can both be read and be changed. Use DosGetInfoBlocks to get their
  142. address. The service cannot fail, so it is defined as procedure. The
  143. second version of the call might be useful if you only want address of one
  144. of those datastructures, since you can supply nil for the other parameter
  145. then - beware, omitting one of these parameters (passing nil) is only
  146. supported on newer OS/2 versions, and causes SIGSEGV on e.g. OS/2 v2.1!!!}
  147. procedure DosGetInfoBlocks(var ATIB:PThreadInfoBlock;
  148. var APIB:PProcessInfoBlock); cdecl;
  149. procedure DosGetInfoBlocks(PATIB:PPThreadInfoBlock;
  150. PAPIB:PPProcessInfoBlock); cdecl;
  151. {Wait a number of milliseconds. Cannot fail, so it is defined as procedure.}
  152. procedure DosSleep (MSec:cardinal); cdecl;
  153. {Beep the speaker. You do not need to check for an error if you can
  154. guarantee that the frequency is correct.}
  155. function DosBeep(Freq,MS:cardinal):cardinal; cdecl;
  156. {****************************************************************************
  157. Process handling routines.
  158. ****************************************************************************}
  159. { User's Debug Buffer structure }
  160. type PDbgBuf = ^TDbgBuf;
  161. TDbgBuf = record
  162. Pid: cardinal; { Debuggee Process id }
  163. Tid: cardinal; { Debuggee Thread id }
  164. Cmd: longint; { Command or Notification }
  165. Value: longint; { Generic Data Value }
  166. Addr: pointer; { Debuggee Address }
  167. Buffer: pointer; { Debugger Buffer Address }
  168. Len: cardinal; { Length of Range }
  169. index: cardinal; { Generic Identifier Index }
  170. MTE: cardinal; { Module Table Entry Handle }
  171. EAX: cardinal; { Register Set }
  172. ECX: cardinal;
  173. EDX: cardinal;
  174. EBX: cardinal;
  175. ESP: cardinal;
  176. EBP: cardinal;
  177. ESI: cardinal;
  178. EDI: cardinal;
  179. EFlags: cardinal;
  180. EIP: cardinal;
  181. CSLim: cardinal;
  182. CSBase: cardinal;
  183. CSAcc: byte;
  184. CSAtr: byte;
  185. CS: word;
  186. DSLim: cardinal;
  187. DSBase: cardinal;
  188. DSAcc: byte;
  189. DSAtr: byte;
  190. DS: word;
  191. ESLim: cardinal;
  192. ESBase: cardinal;
  193. ESAcc: byte;
  194. ESAtr: byte;
  195. ES: word;
  196. FSLim: cardinal;
  197. FSBase: cardinal;
  198. FSAcc: byte;
  199. FSAtr: byte;
  200. FS: word;
  201. GSLim: cardinal;
  202. GSBase: cardinal;
  203. GSAcc: byte;
  204. GSAtr: byte;
  205. GS: word;
  206. SSLim: cardinal;
  207. SSBase: cardinal;
  208. SSAcc: byte;
  209. SSAtr: byte;
  210. SS: word;
  211. end;
  212. { DosDebug Command Numbers
  213. *
  214. * These numbers are placed in the Cmd field of the uDB on
  215. * entry to DosDebug.
  216. *
  217. * These numbers identify which command DosDebug is requested
  218. * to perform.
  219. *
  220. }
  221. const DBG_C_Null = 0; { Null }
  222. DBG_C_ReadMem = 1; { Read Word }
  223. DBG_C_ReadMem_I = 1; { Read Word }
  224. DBG_C_ReadMem_D = 2; { Read Word (same as 1) }
  225. DBG_C_ReadReg = 3; { Read Register Set }
  226. DBG_C_WriteMem = 4; { Write Word }
  227. DBG_C_WriteMem_I = 4; { Write Word }
  228. DBG_C_WriteMem_D = 5; { Write Word (same as 4) }
  229. DBG_C_WriteReg = 6; { Write Register Set }
  230. DBG_C_Go = 7; { Go }
  231. DBG_C_Term = 8; { Terminate }
  232. DBG_C_SStep = 9; { Single Step }
  233. DBG_C_Stop = 10; { Stop }
  234. DBG_C_Freeze = 11; { Freeze Thread }
  235. DBG_C_Resume = 12; { Resume Thread }
  236. DBG_C_NumToAddr = 13; { Object Number to Address }
  237. DBG_C_ReadCoRegs = 14; { Read Coprocessor Registers }
  238. DBG_C_WriteCoRegs = 15; { Write Coprocessor Registers }
  239. { 16 is reserved }
  240. DBG_C_ThrdStat = 17; { Get Thread Status }
  241. DBG_C_MapROAlias = 18; { Map read-only alias }
  242. DBG_C_MapRWAlias = 19; { Map read-write alias }
  243. DBG_C_UnMapAlias = 20; { Unmap Alias }
  244. DBG_C_Connect = 21; { Connect to Debuggee }
  245. DBG_C_ReadMemBuf = 22; { Read Memory Buffer }
  246. DBG_C_WriteMemBuf = 23; { Write Memory Buffer }
  247. DBG_C_SetWatch = 24; { Set Watchpoint }
  248. DBG_C_ClearWatch = 25; { Clear Watchpoint }
  249. DBG_C_RangeStep = 26; { Range Step }
  250. DBG_C_Continue = 27; { Continue after an Exception }
  251. DBG_C_AddrToObject = 28; { Address to Object }
  252. DBG_C_XchgOpcode = 29; { Exchange opcode and go }
  253. DBG_C_LinToSel = 30; { 32 to 16 conversion A001}
  254. DBG_C_SelToLin = 31; { 16 to 32 conversion A001}
  255. {------ Constants -------------------}
  256. DBG_L_386 = 1;
  257. DBG_O_OBJMTE = $10000000;
  258. {------ Notifications ---------------}
  259. DBG_N_SUCCESS = 0;
  260. DBG_N_ERROR = -1;
  261. DBG_N_ProcTerm = -6;
  262. DBG_N_Exception = -7;
  263. DBG_N_ModuleLoad = -8;
  264. DBG_N_CoError = -9;
  265. DBG_N_ThreadTerm = -10;
  266. DBG_N_AsyncStop = -11;
  267. DBG_N_NewProc = -12;
  268. DBG_N_AliasFree = -13;
  269. DBG_N_Watchpoint = -14;
  270. DBG_N_ThreadCreate = -15;
  271. DBG_N_ModuleFree = -16;
  272. DBG_N_RangeStep = -17;
  273. DBG_X_PRE_FIRST_CHANCE = 0;
  274. DBG_X_FIRST_CHANCE = 1;
  275. DBG_X_LAST_CHANCE = 2;
  276. DBG_X_STACK_INVALID = 3;
  277. DBG_W_Local = $0000001;
  278. DBG_W_Global = $0000002;
  279. DBG_W_Execute = $00010000;
  280. DBG_W_Write = $00020000;
  281. DBG_W_ReadWrite = $00030000;
  282. {You need a heavy manual if you want to know how this procedure works. Used
  283. for writing debuggers.}
  284. function DosDebug (DebugBuf: PDbgBuf):cardinal; cdecl;
  285. function DosDebug (var APDbgBuf: TDbgBuf): cardinal; cdecl;
  286. { codeTerminate values (also passed to ExitList routines) }
  287. const TC_exit = 0;
  288. TC_harderror = 1;
  289. TC_trap = 2;
  290. TC_killprocess = 3;
  291. TC_exception = 4;
  292. { DosExitList options }
  293. const ExLst_Add = 1;
  294. ExLst_Remove = 2;
  295. ExLst_Exit = 3;
  296. type TExitProc=procedure(Reason:cardinal); cdecl;
  297. {Add/remove an exitprocedure to the exit list. Also used to terminate an
  298. exit procedure. An exit procedure will be called on exiting of the program.
  299. OrderCode = One of the EXLST_XXXX constants.
  300. Proc = Address of the exit procedure.
  301. An exit procedure is called with one of the TC_XXXX constants. When it is
  302. done it must call DosExitList with ExLst_Exit.
  303. Exit procedures are called in random order.}
  304. function DosExitList(OrderCode:cardinal;Proc:TExitProc):cardinal; cdecl;
  305. { DosExecPgm options }
  306. const deSync = 0; {Wait until program terminates.}
  307. deAsync = 1; {Do not wait.}
  308. deAsyncResult = 2; {Do not wait. DosWaitChild will follow to
  309. check if process has been terminated. If
  310. you use this, you must use DosWaitChild,
  311. because OS/2 will not free memory that is
  312. allocated for the result codes if you don't.}
  313. deTrace = 3; {For debugging.}
  314. deBackground = 4; {Do not run as child. Run in a separate
  315. session.}
  316. deSuspended = 5; {Child will be loaded, but not executed.}
  317. deAsyncResultDb = 6; {Similar to deAsyncResult, but for debugging.}
  318. (* The following for compatibility only *)
  319. EXEC_SYNC =deSync;
  320. EXEC_ASYNC =deAsync;
  321. EXEC_ASYNCRESULT =deAsyncResult;
  322. EXEC_TRACE =deTrace;
  323. EXEC_BACKGROUND =deBackground;
  324. EXEC_LOAD =deSuspended;
  325. EXEC_ASYNCRESULTDB =deAsyncResultDb;
  326. type TResultCodes=record
  327. TerminateReason, {0 = Normal termionation.
  328. 1 = Critical error.
  329. 2 = Trapped. (GPE, etc.)
  330. 3 = Killed by DosKillProcess.}
  331. ExitCode:cardinal; {Exit code of child.}
  332. end;
  333. {Execute a program.
  334. ObjName = If a DLL cannot be found, its name will be returned here.
  335. ObjLen = Size of your ObjName buffer.
  336. ExecFlag = One of the deXXXX constants.
  337. Res = See TResultcodes.
  338. Args = Arguments. ASCIIZ strings. End of Args given by an empty
  339. string (#0). First arg must be filename without path and
  340. extension. nil is also allowed.
  341. Env = Environment. ASCIIZ strings. A variable has the format
  342. NAME=CONTENTS. End of Env given by an empty string (#0).
  343. nil is also allowed meaning inherit parent's environment.
  344. FileName = Filename with full path and extension. Is not sensitive
  345. for the PATH environment variable.}
  346. function DosExecPgm(ObjName:PChar;ObjLen:longint;ExecFlag:cardinal;
  347. Args,Env:PByteArray;var Res:TResultCodes;
  348. FileName:PChar):cardinal; cdecl;
  349. function DosExecPgm(var ObjName:string;ExecFlag:cardinal;
  350. Args,Env:PByteArray;var Res:TResultCodes;
  351. const FileName:string):cardinal;
  352. {Wait until a child process terminated. Sometimes called DosCWait.
  353. Action = 0 = Wait until child terminates.
  354. 1 = Wait until child and all its childs terminate.
  355. Option = Flags. Either dtWait or dtNoWait.
  356. Res = See TResultCodes.
  357. TermPID = Process ID that has been terminated. Usefull when
  358. terminating a random process.
  359. PID = Process ID of process to terminate. Use a zero to
  360. terminate a random process.}
  361. function DosWaitChild(Action,Option:longint;var Res:TResultCodes;
  362. var TermPID:longint;PID:longint):cardinal; cdecl;
  363. function DosWaitChild(Action,Option:cardinal;var Res:TResultCodes;
  364. var TermPID:cardinal;PID:cardinal):cardinal; cdecl;
  365. const dpProcess = 0;
  366. dpProcessChilds = 1;
  367. dpThread = 2;
  368. dpSameClass = 0;
  369. dpIdleClass = 1;
  370. dpRegular = 2;
  371. dpTimeCritical = 3;
  372. {Set priority of a thread or all threads in another process.
  373. Scope = 0 = Set for all threads of a process.
  374. 1 = Set for all threads of a process and its childs.
  375. 2 = Set for a thread of the current process.
  376. TrClass = 0 = Do not change class.
  377. 1 = Change to idle time class.
  378. 2 = Change to regular class.
  379. 3 = Change to time-critical class.
  380. Delta = Value to add to priority. Resulting priority must be in
  381. the range 0..31 (Delta itself must be within -31..31).
  382. PortID = Process ID when Scope=0 or 1, thread ID when Scope=2.}
  383. function DosSetPriority(Scope,TrClass: cardinal;Delta:longint;PortID:cardinal):cardinal; cdecl;
  384. {Terminate a process. If the process isn't a child process, it can refuse
  385. to terminate.
  386. Action = 0 = Terminate process and all its childs.
  387. 1 = Terminate process only.
  388. PID = Process ID of process to terminate.}
  389. function DosKillProcess(Action,PID:cardinal):cardinal; cdecl;
  390. const AppTyp_NotSpec = $0000; {Apptype is unknown.}
  391. AppTyp_NotWindowCompat = $0001; {App cannot run in a window.}
  392. AppTyp_WindowCompat = $0002; {App can run in a window.}
  393. AppTyp_WindowAPI = $0003; {App uses PM}
  394. AppTyp_Bound = $0008; {App uses Family API.}
  395. AppTyp_DLL = $0010; {File is a DLL.}
  396. AppTyp_DOS = $0020; {App is a PC-DOS program.}
  397. AppTyp_PhysDrv = $0040; {App is a physical device driver.}
  398. AppTyp_VirtDrv = $0080; {App is virtual device driver.}
  399. AppTyp_ProtDLL = $0100; {File is a protected mode DLL.}
  400. AppTyp_WindowsReal = $0200; {M$ Winslows app, real mode.}
  401. AppTyp_WindowsProt = $0400; {M$ Winslows app, protected mode.}
  402. AppTyp_32bit = $4000; {App is 32 bit.}
  403. {Get the application type of an executable file on disk.
  404. FileName = Name of file to get type from.
  405. Flags = Receives a bitfield using the AppTyp constants.}
  406. function DosQueryAppType(FileName:PChar;var Flags:longint):cardinal; cdecl;
  407. function DosQueryAppType (FileName: PChar; var Flags: cardinal): cardinal;
  408. cdecl;
  409. const diPrinter = 0; {Get number of printer (parallel) ports.}
  410. diRS232 = 1; {Get number of serial ports.}
  411. diFloppy = 2; {Get number of floppy drives.}
  412. diCopro = 3; {Get number of FPU's installed (either 0 or 1).}
  413. diSubModel = 4; {??? System submodel type?}
  414. diModel = 5; {??? System model type?}
  415. diAdapter = 6; {0=Monochrome display, 1=other. ??? Does OS/2
  416. support monochrome displays?}
  417. {Get information about attached devices.
  418. DevInfo = Receives requested information.
  419. Item = One of the dixxxx constants.}
  420. function DosDevConfig(var DevInfo:byte;Item:cardinal):cardinal; cdecl;
  421. {****************************************************************************
  422. File handling related routines.
  423. ****************************************************************************}
  424. const MaxPathLength=260;
  425. MaxPathComponent=256;
  426. type TFileLock=record
  427. Offset,Range:longint;
  428. end;
  429. PFileLock=^TFileLock;
  430. FileLock=TFileLock;
  431. {Lock or unlock an area of a file. Other processes may not access that part
  432. of the file.
  433. Unlock = Area to unlock. (0,0) = Do not unlock.
  434. Lock = Area to lock. (0,0) = Do not lock.
  435. Timeout = Number of miliseconds to wait if another process has locked
  436. the file.
  437. Flags = Bitfield:
  438. Bit 0: 0 = Other processes are denied access.
  439. 1 = Other processes may still read from the area.
  440. Bit 1: 0 = Normal locking mode.
  441. 1 = Atomic mode. Refer IBM's documentation.}
  442. function DosSetFileLocks(Handle:THandle;var Unlock,Lock:TFileLock;
  443. Timeout,Flags: cardinal):cardinal; cdecl;
  444. function DosProtectSetFileLocks (Handle: THandle; var Unlock, Lock: TFileLock;
  445. Timeout, Flags: cardinal;
  446. FileHandleLockID: cardinal): cardinal; cdecl;
  447. {Cancel a filelock area.
  448. Handle = File handle.
  449. Lock = Area that is locked now.}
  450. function DosCancelLockRequest(Handle:THandle;var Lock:TFileLock):cardinal;
  451. cdecl;
  452. {Data structures for extended attributes. Reading IBM's documentation is
  453. highly recommended before experimenting with EAs.}
  454. const fEA_needEA=$80;
  455. eaBinary = $fffe;
  456. eaASCII = $fffd;
  457. eaBitmap = $fffb;
  458. eaMetaFile = $fffa;
  459. eaIcon = $fff9;
  460. eaEA = $ffee;
  461. eaMVMT = $ffdf;
  462. eaMVST = $ffde;
  463. eaASN1 = $ffdd;
  464. type TgEA = record
  465. case byte of
  466. 1: (NameLen: byte;
  467. Name: array [0..0] of char);
  468. 2: (cbName: byte; { name length not including NULL }
  469. szName: char); { attribute name }
  470. end;
  471. PgEA = ^TgEA;
  472. GEA = TgEA;
  473. TgEAList = record
  474. ListLen: cardinal; { total bytes of structure including full list }
  475. List: array [0..0] of TgEA; { variable length GEA structures }
  476. end;
  477. PgEAList = ^TgEAList;
  478. GEAList = TgEAList;
  479. TfEA = record
  480. case byte of
  481. 1: (EA,
  482. NameLen: byte;
  483. Value: word);
  484. 2: (fEA: byte; { flags }
  485. cbName: byte; { name length not including NULL }
  486. cbValue: word); { value length }
  487. end;
  488. PfEA = ^TfEA;
  489. FEA=TfEA;
  490. TfEAList = record
  491. Size: cardinal; { total bytes of structure including full list }
  492. List: array [0..0] of TfEA; { variable length FEA structures }
  493. end;
  494. PfEAList = ^TfEAlist;
  495. FEAList = TfEAList;
  496. TEAOp = record
  497. case byte of
  498. 1: (gEAList: PgEAList;
  499. fEAList: PfEAList;
  500. Error: cardinal);
  501. 2: (fpGEAList: PGEAList; { general EA list }
  502. fpFEAList: PFEAList; { full EA list }
  503. oError: cardinal);
  504. end;
  505. PEAOp = ^TEAOp;
  506. EAOp = TEAOp;
  507. TfEA2 = record
  508. NextEntry: cardinal;
  509. Flags,
  510. NameLen: byte;
  511. Value: word;
  512. szName: array [0..0] of char;
  513. end;
  514. PfEA2 = ^TfEA2;
  515. FEA2 = TfEA2;
  516. TfEA2List = record
  517. ListLen: cardinal;
  518. List: array [0..0] of TfEA2;
  519. end;
  520. PfEA2List = ^TfEA2List;
  521. FEA2List = TfEA2List;
  522. TgEA2 = record
  523. case byte of
  524. 1: (NextEntry: cardinal;
  525. NameLen: byte;
  526. Name: array [0..0] of char);
  527. 2: (oNextEntryOffset: cardinal; { new field }
  528. cbName: byte;
  529. szName: array [0..0] of byte); { new field }
  530. end;
  531. PgEA2 = ^TgEA2;
  532. GEA2 = TgEA2;
  533. TgEA2list = record
  534. ListLen: cardinal;
  535. List: array [0..0] of TgEA2;
  536. end;
  537. PgEA2List = ^TgEA2List;
  538. GEA2List = TgEAList;
  539. TEAOp2 = record
  540. case byte of
  541. 1: (gEA2List: PgEA2List;
  542. fEA2List: PfEA2List;
  543. Error: cardinal);
  544. 2: (fpGEA2List: PGEA2List; { GEA set }
  545. fpFEA2List: PFEA2List; { FEA set }
  546. oError: cardinal); { offset of FEA error }
  547. end;
  548. PEAOp2 = ^TEAOp2;
  549. EAOp2 = TEAOp2;
  550. TEASizeBuf = record { struct for FSCTL fn 2 - max ea size }
  551. case byte of
  552. 1: (MaxEASize: word;
  553. MaxEAListSize: cardinal);
  554. 2: (cbMaxEASize: word; { max size of one EA }
  555. cbMaxEAListSize: cardinal);{ max size of the full EA list }
  556. end;
  557. PEASizeBuf = ^TEASizeBuf;
  558. EASizeBuf = TEASizeBuf;
  559. {*******************End of extented attribute datastructures.***************}
  560. {Usefull constanst for Action parameter.}
  561. { DosOpen() actions }
  562. const doOpened = 1;
  563. doCreated = 2;
  564. doOverwritten = 3;
  565. FILE_EXISTED = doOpened;
  566. FILE_CREATED = doCreated;
  567. FILE_TRUNCATED = doOverwritten;
  568. {Usefull constants for OpenFlags parameter.}
  569. { DosOpen() open flags }
  570. const doFail = 0;
  571. doOpen = 1;
  572. doOverwrite = 2;
  573. (*
  574. fixed by KO M.H. on 1999.07.04
  575. contents : Creation flags is 10 hex not 10 dec.
  576. *)
  577. doCreate = 16;
  578. FILE_OPEN = doOpen;
  579. FILE_TRUNCATE = doOverwrite;
  580. FILE_CREATE = doCreate;
  581. { this nibble applies if file already exists xxxx }
  582. OPEN_ACTION_FAIL_IF_EXISTS =doFail; { ---- ---- ---- 0000 }
  583. OPEN_ACTION_OPEN_IF_EXISTS =doOpen; { ---- ---- ---- 0001 }
  584. OPEN_ACTION_REPLACE_IF_EXISTS =doOverwrite; { ---- ---- ---- 0010 }
  585. { this nibble applies if file does not exist xxxx }
  586. OPEN_ACTION_FAIL_IF_NEW =doFail; { ---- ---- 0000 ---- }
  587. OPEN_ACTION_CREATE_IF_NEW =DoCreate; { ---- ---- 0001 ---- }
  588. {Usefull constants for openmode parameter.}
  589. const doRead = 0;
  590. doWrite = 1;
  591. doReadWrite = 2;
  592. doDenyRW = 16;
  593. doDenyWrite = 32;
  594. doDenyRead = 48;
  595. doDenyNone = 64;
  596. doNoInherit = 128;
  597. doSequential = 256;
  598. doRandom = 512;
  599. doNoCache = 4096;
  600. doFailOnErr = 8192;
  601. doWriteThru = 16384;
  602. doDASD = 32768;
  603. { DosOpen/DosSetFHandState flags }
  604. OPEN_ACCESS_READONLY =doRead; { ---- ---- ---- -000 }
  605. OPEN_ACCESS_WRITEONLY =doWrite; { ---- ---- ---- -001 }
  606. OPEN_ACCESS_READWRITE =doReadWrite; { ---- ---- ---- -010 }
  607. OPEN_SHARE_DENYREADWRITE =doDenyRW; { ---- ---- -001 ---- }
  608. OPEN_SHARE_DENYWRITE =doDenyWrite; { ---- ---- -010 ---- }
  609. OPEN_SHARE_DENYREAD =doDenyRead; { ---- ---- -011 ---- }
  610. OPEN_SHARE_DENYNONE =doDenyNone; { ---- ---- -100 ---- }
  611. OPEN_FLAGS_NOINHERIT =doNoInherit; { ---- ---- 1--- ---- }
  612. OPEN_FLAGS_NO_LOCALITY =$0000; { ---- -000 ---- ---- }
  613. OPEN_FLAGS_SEQUENTIAL =doSequential; { ---- -001 ---- ---- }
  614. OPEN_FLAGS_RANDOM =doRandom; { ---- -010 ---- ---- }
  615. OPEN_FLAGS_RANDOMSEQUENTIAL =doSequential
  616. or doRandom; { ---- -011 ---- ---- }
  617. OPEN_FLAGS_NO_CACHE =doNoCache; { ---1 ---- ---- ---- }
  618. OPEN_FLAGS_FAIL_ON_ERROR =doFailOnErr; { --1- ---- ---- ---- }
  619. OPEN_FLAGS_WRITE_THROUGH =doWriteThru; { -1-- ---- ---- ---- }
  620. OPEN_FLAGS_DASD =doDASD; { 1--- ---- ---- ---- }
  621. OPEN_FLAGS_NONSPOOLED =$00040000;
  622. OPEN_FLAGS_PROTECTED_HANDLE =$40000000;
  623. { Open a file.
  624. FileName = Name of file.
  625. Handle = Receives filehandle.
  626. Action = Receives result of opening.
  627. 1 = Existing file opened.
  628. 2 = File did not exist. Created.
  629. 3 = File existed. Overwritten.
  630. InitSize = Initial size of file when creating or overwriting.
  631. Ignored when you do not. Must be zero when the file is
  632. created or overwritten in read-only mode.
  633. Attrib = Attributes when creating or overwriting files.
  634. OpenFlags = Bitfield describing what to do when file exists or doesn't
  635. exist.
  636. OpenMode = Bitfield describing describing how to open a file.
  637. EA = Extended attributes to give file when created. Use a nil
  638. pointer if you don't want to give it extended attributes.
  639. Use it only when creating or overwriting file. Use nil
  640. when not. Only the FEA list will be used.
  641. The bits in the openflags parameter have the following meanings:
  642. Bit 0-3: Action to take when file exists. 0000 = Return with error.
  643. 0001 = Open it.
  644. 0010 = Overwrite it.
  645. Bit 4-7: Action to take when file does not 0000 = Return with error.
  646. exist. 0001 = Create it.
  647. The bits in the filemode parameter have the following meanings:
  648. Bit 0-2: Access mode: 000 = Read-only
  649. 001 = Write-only
  650. 010 = Read/Write
  651. Bit 3: Reserved.
  652. Bit 4-6: Sharing mode. 001 = Deny all
  653. 010 = Deny write
  654. 011 = Deny read
  655. 100 = Deny none
  656. Bit 7: Inheritance. 0 = Handle will be inherited by childs.
  657. 1 = Handle will not be inherited.
  658. Bit 8-11: Reserved.
  659. Bit 12: Cache flag. 0 = Use caching.
  660. 1 = Disable both read and write caching.
  661. Bit 13: Error handling. 0 = Use critical error handler.
  662. 1 = Return just an error code.
  663. Bit 14: Write cache flag. 0 = Write operations may be cached.
  664. 1 = Write operations must be executed
  665. before write operation functions return.
  666. Bit 15: DASD flag. 0 = Open a file or device.
  667. 1 = Open a drive as file.
  668. When the DASD flag is set, the whole drive is read as a single file. The
  669. file starts with 512 bytes of bootsector, then 512 bytes of the second sector etc.
  670. The filename must consist of the driveletter followed by a semicolon.}
  671. function DosOpen(FileName:PChar;var Handle: longint; var Action:longint;
  672. InitSize:longint;Attrib,OpenFlags,FileMode:longint;
  673. EA:PEAOp2):cardinal; cdecl;
  674. function DosOpen(FileName:PChar;var Handle: THandle;var Action:cardinal;
  675. InitSize,Attrib,OpenFlags,FileMode:cardinal;
  676. EA:PEAOp2):cardinal; cdecl;
  677. {This variant of DosOpen always creates or overwrites a file.}
  678. function DosCreate(FileName:PChar;var Handle: THandle;
  679. Attrib,OpenMode:cardinal):cardinal;
  680. {This variant of DosOpen always opens an existing file.}
  681. function DosOpen(FileName:PChar;var Handle: THandle;
  682. Attrib,OpenMode:cardinal):cardinal;
  683. {There are also string variants.}
  684. function DosOpen(const FileName:string;var Handle: longint; var Action:longint;
  685. InitSize,Attrib,OpenFlags,OpenMode:longint;
  686. ea:PEAOp2):cardinal;
  687. function DosOpen(const FileName:string;var Handle: THandle;var Action:cardinal;
  688. InitSize,Attrib,OpenFlags,OpenMode:cardinal;
  689. ea:PEAOp2):cardinal;
  690. function DosCreate(const FileName:string;var Handle: THandle;
  691. Attrib,OpenMode:cardinal):cardinal;
  692. function DosOpen(const FileName:string;var Handle: THandle;
  693. Attrib,OpenMode:cardinal):cardinal;
  694. function DosProtectOpen (FileName: PChar; var Handle: longint;
  695. var Action: longint; InitSize, Attrib,
  696. OpenFlags, OpenMode: longint; ea: PEAOp2;
  697. var FileHandleLockID: cardinal): cardinal; cdecl;
  698. function DosProtectOpen (FileName: PChar; var Handle: THandle;
  699. var Action: cardinal; InitSize, Attrib,
  700. OpenFlags, OpenMode: cardinal; ea: PEAOp2;
  701. var FileHandleLockID: cardinal): cardinal; cdecl;
  702. function DosProtectOpen (const FileName: string; var Handle: longint;
  703. var Action: longint; InitSize, Attrib,
  704. OpenFlags, OpenMode: longint; ea: PEAOp2;
  705. var FileHandleLockID: cardinal): cardinal;
  706. function DosProtectOpen (const FileName: string; var Handle: THandle;
  707. var Action: cardinal; InitSize, Attrib,
  708. OpenFlags, OpenMode: cardinal; ea: PEAOp2;
  709. var FileHandleLockID: cardinal): cardinal;
  710. {Close a file.
  711. Cannot fail if handle does exist.}
  712. function DosClose (Handle: THandle): cardinal; cdecl;
  713. function DosProtectClose (Handle: THandle;
  714. FileHandleLockID: cardinal): cardinal; cdecl;
  715. {Read from a file or other type of handle.
  716. Handle = File handle.
  717. Buffer = The read data is stored here.
  718. Count = Number of bytes to read.
  719. ActCount = Number of bytes actually read.}
  720. function DosRead (Handle: longint; var Buffer; Count: longint;
  721. var ActCount:longint):cardinal; cdecl;
  722. function DosRead (Handle: THandle; var Buffer; Count: cardinal;
  723. var ActCount:cardinal):cardinal; cdecl;
  724. function DosProtectRead (Handle: longint; var Buffer; Count: longint;
  725. var ActCount: longint; FileHandleLockID: cardinal): cardinal; cdecl;
  726. function DosProtectRead (Handle: THandle; var Buffer; Count: cardinal;
  727. var ActCount: cardinal; FileHandleLockID: cardinal): cardinal; cdecl;
  728. {Write to a file or other type of handle.
  729. Handle = File handle.
  730. Buffer = The data to be written.
  731. Count = Number of bytes to write.
  732. ActCount = Number of bytes actually written.}
  733. function DosWrite (Handle: longint; var Buffer; Count: longint;
  734. var ActCount:longint):cardinal; cdecl;
  735. function DosWrite (Handle: THandle; var Buffer; Count: cardinal;
  736. var ActCount:cardinal):cardinal; cdecl;
  737. function DosProtectWrite (Handle: longint; var Buffer; Count: longint;
  738. var ActCount: longint;
  739. FileHandleLockID: cardinal): cardinal; cdecl;
  740. function DosProtectWrite (Handle: THandle; var Buffer; Count: cardinal;
  741. var ActCount: cardinal;
  742. FileHandleLockID: cardinal): cardinal; cdecl;
  743. const dsZeroBased=0; {Set filepointer from begin of file.}
  744. dsRelative=1; {Set filepointer relative to the current one.}
  745. dsEndBased=2; {Set filepointer from end of file.}
  746. (* The following for compatibility only *)
  747. FILE_BEGIN = dsZeroBased; { Move relative to beginning of file }
  748. FILE_CURRENT = dsRelative; { Move relative to current fptr position }
  749. FILE_END = dsEndBased; { Move relative to end of file }
  750. {Change the filepointer of a file.}
  751. function DosSetFilePtr (Handle: longint; Pos: longint; Method: cardinal;
  752. var PosActual: longint): cardinal; cdecl;
  753. function DosSetFilePtr (Handle: THandle; Pos: longint; Method: cardinal;
  754. var PosActual: cardinal): cardinal; cdecl;
  755. function DosProtectSetFilePtr (Handle: longint; Pos, Method: longint;
  756. var PosActual: longint;
  757. FileHandleLockID: cardinal): cardinal; cdecl;
  758. function DosProtectSetFilePtr (Handle: THandle; Pos: longint; Method: cardinal;
  759. var PosActual: cardinal;
  760. FileHandleLockID: cardinal): cardinal; cdecl;
  761. {This variant seeks always from begin of file and does not return the
  762. actual position.}
  763. function DosSetFilePtr (Handle: THandle; Pos: longint): cardinal;
  764. function DosProtectSetFilePtr (Handle: THandle; Pos: longint;
  765. FileHandleLockID: cardinal): cardinal;
  766. {This variant returns the current filepointer.}
  767. function DosGetFilePtr (Handle: longint; var PosActual: longint): cardinal;
  768. function DosGetFilePtr (Handle: THandle; var PosActual: cardinal): cardinal;
  769. function DosProtectGetFilePtr (Handle: longint;
  770. var PosActual: longint; FileHandleLockID: cardinal): cardinal;
  771. function DosProtectGetFilePtr (Handle: THandle;
  772. var PosActual: cardinal; FileHandleLockID: cardinal): cardinal;
  773. {Use DosQueryFileInfo or DosQueryPathInfo to get the size of a file.}
  774. {Change the size of a file.}
  775. function DosSetFileSize (Handle: THandle; Size: cardinal): cardinal; cdecl;
  776. function DosProtectSetFileSize (Handle: THandle; Size: cardinal;
  777. FileHandleLockID: cardinal): cardinal; cdecl;
  778. {Flush update the changes to a file to disk.}
  779. function DosResetBuffer (Handle: THandle): cardinal; cdecl;
  780. {Duplicate or redirect a handle.
  781. To duplicate a handle: Fill handle with source handle and duplicate with -1.
  782. Copy of handle will be returned in duplicate.
  783. To redirect a handle: Fill handle with handle to which the handle to
  784. redirect will be redirected. The handle that will be
  785. redirected should be placed in duplicate.}
  786. function DosDupHandle (Handle: THandle; var Duplicate: THandle): cardinal;
  787. cdecl;
  788. {Return information about a specific handle. See DosOpen for a
  789. description of FileMode.}
  790. function DosQueryFHState (Handle: longint; var FileMode: longint): cardinal;
  791. cdecl;
  792. function DosQueryFHState (Handle: THandle; var FileMode: cardinal): cardinal;
  793. cdecl;
  794. function DosProtectQueryFHState (Handle: THandle; var FileMode: cardinal;
  795. FileHandleLockID: cardinal): cardinal; cdecl;
  796. {Set information about a specific handle. See DosOpen for a description
  797. of FileMode.}
  798. function DosSetFHState (Handle: THandle; FileMode: cardinal): cardinal; cdecl;
  799. function DosProtectSetFHState (Handle: THandle; FileMode: cardinal;
  800. FileHandleLockID: cardinal): cardinal; cdecl;
  801. {Useful constants for the handle type.}
  802. const dhFile = 0;
  803. dhDevice = 1;
  804. dhPipe = 2;
  805. dhNetwork = 8192;
  806. {Determine if a handle belongs to a file, a device or a pipe.
  807. Handle = Handle tp query info about.
  808. HandType = Bits 0-1: 00 = File
  809. 01 = Device
  810. 02 = Pipe
  811. Bit 15: 0 = Local.
  812. 1 = On network.}
  813. function DosQueryHType (Handle: longint; var HandType: longint;
  814. var Attr: longint): cardinal; cdecl;
  815. function DosQueryHType (Handle: THandle; var HandType:cardinal;
  816. var Attr:cardinal):cardinal; cdecl;
  817. {****************************************************************************
  818. File management related routines.
  819. ****************************************************************************}
  820. {Edit a filename using wildcard.
  821. Example editing CONFIG.SYS with *.BAK becomes CONFIG.BAK.
  822. Usefull when parsing commands like 'copy config.sys *.bak'.
  823. All filename characters are casemapped.'
  824. MetaLevel = 0 Use modern semantics
  825. MetaLevel = 1 Use OS/2 1.2 semantics
  826. Source = string to edit
  827. Edit = editstring
  828. Target = destination buffer
  829. TargetLen = size of the destination buffer}
  830. function DosEditName(MetaLevel:cardinal;Source,Edit:PChar;
  831. Target:PChar;TargetLen:cardinal):cardinal; cdecl;
  832. function DosEditName(MetaLevel:cardinal;const Source,Edit:string;
  833. var Target:string):cardinal;
  834. {Move or rename a file.
  835. OldFile = old name of file
  836. NewFile = new name of file}
  837. function DosMove(OldFile,NewFile:PChar):cardinal; cdecl;
  838. function DosMove(const OldFile,NewFile:string):cardinal;
  839. const dcExisting=1; {Overwrite existing files.}
  840. dcAppend=2; {Append to existing file.}
  841. dcFailAs=4; {?? Info wanted!}
  842. {Copy a file.
  843. OldFile = source file
  844. NewFile = destination file}
  845. function DosCopy(OldFile,NewFile:PChar;Option:cardinal):cardinal; cdecl;
  846. function DosCopy(const OldFile,NewFile:string;Option:cardinal):cardinal;
  847. {Delete a file from disk.}
  848. function DosDelete(FileName:PChar):cardinal; cdecl;
  849. function DosDelete(const FileName:string):cardinal;
  850. {Destroy a file on disk. DosForceDelete makes sure that the file cannot
  851. be unerased anymore.}
  852. function DosForceDelete(FileName:PChar):cardinal; cdecl;
  853. function DosForceDelete(const FileName:string):cardinal;
  854. {Create a new directory.
  855. Name = Name of directory to create.
  856. EA = Extented attributes to give the directory. Use nil if you
  857. do not want do give it extented attributes. Only the FEA
  858. list is used.}
  859. function DosCreateDir(Name:PChar;EA:PEAOp2):cardinal; cdecl;
  860. function DosCreateDir(const Name:string;EA:PEAOp2):cardinal;
  861. {Variants without the EA parameter (nil is used).}
  862. function DosCreateDir(Name:PChar):cardinal;
  863. function DosCreateDir(const Name:string):cardinal;
  864. {Remove a directory.}
  865. function DosDeleteDir(Name:PChar):cardinal; cdecl;
  866. function DosDeleteDir(const Name:string):cardinal;
  867. {Set the current drive. Cannot fail if the driveletter is correct.}
  868. function DosSetDefaultDisk(DiskNum:cardinal):cardinal; cdecl;
  869. {Get the current drive. Because it cannot fail, it is declared as procedure.}
  870. procedure DosQueryCurrentDisk(var DiskNum:longint;var Logical:longint); cdecl;
  871. procedure DosQueryCurrentDisk(var DiskNum:cardinal;var Logical:cardinal); cdecl;
  872. {Set the current directory.}
  873. function DosSetCurrentDir(Name:PChar):cardinal; cdecl;
  874. function DosSetCurrentDir(const Name:string):cardinal;
  875. {Get the current directory.}
  876. function DosQueryCurrentDir(DiskNum:longint;var Buffer;
  877. var BufLen:longint):cardinal; cdecl;
  878. function DosQueryCurrentDir(DiskNum:cardinal;var Buffer:string):cardinal;
  879. function DosQueryCurrentDir(DiskNum:cardinal;var Buffer;
  880. var BufLen:cardinal):cardinal; cdecl;
  881. {Send/receive information to a device.
  882. Handle = A file handle to a device, instead of a file.
  883. Category = The category of functions the function is in.
  884. Func = Function to call.
  885. Params = Parameters for the function.
  886. ParamLen = Size of the params buffer.
  887. ParamSize = Size of the parametrs to send to the device
  888. Receives size of the returned parameters.
  889. Data = Data to send to device.
  890. DataLen = Size of your data buffer.
  891. DataSize = Size of the data to send to device.
  892. Receives size of the data returned by the device.}
  893. function DosDevIOCtl(Handle,Category,Func:longint;var Params;
  894. ParamLen:longint;var ParamSize:longint;
  895. var Data;DataLen:longint;var DataSize:
  896. longint):cardinal; cdecl;
  897. function DosDevIOCtl (Handle: THandle; Category,Func:cardinal;var Params;
  898. ParamLen:cardinal;var ParamSize:cardinal;
  899. var Data;DataLen:cardinal;var DataSize:cardinal):cardinal; cdecl;
  900. {****************************************************************************
  901. File searching related routines.
  902. ****************************************************************************}
  903. const faReadOnly = 1;
  904. faHidden = 2;
  905. faSystem = 4;
  906. faReserve = 8;
  907. faDirectory = 16;
  908. faArchive = 32;
  909. ilStandard = 1;
  910. ilQueryEASize = 2;
  911. ilQueryEAs = 3;
  912. ilQueryFullName = 5;
  913. ilStandardL = 11;
  914. ilQueryEASizeL = 12;
  915. ilQueryEAsL = 13;
  916. FIL_Standard = ilStandard;
  917. FIL_QueryEASize = ilQueryEASize;
  918. FIL_QueryEAsFromList = ilQueryEAs;
  919. FIL_StandardL = ilStandardL;
  920. FIL_QueryEASizeL = ilQueryEASizeL;
  921. FIL_QueryEAsFromListL = ilQueryEAsL;
  922. {Format of date records:
  923. Bit 0..4: day
  924. Bit 5..8: month
  925. Bit 9..15: year minus 1980
  926. Format of time records:
  927. Bit 0..4: seconds divided by 2
  928. Bit 5..10: minutes
  929. Bit 11..15: hours}
  930. type
  931. TFileStatus = object
  932. end;
  933. PFileStatus = ^TFileStatus;
  934. TFileStatus3 = object (TFileStatus)
  935. DateCreation, {Date of file creation.}
  936. TimeCreation, {Time of file creation.}
  937. DateLastAccess, {Date of last access to file.}
  938. TimeLastAccess, {Time of last access to file.}
  939. DateLastWrite, {Date of last modification of file.}
  940. TimeLastWrite:word; {Time of last modification of file.}
  941. FileSize, {Size of file.}
  942. FileAlloc:cardinal; {Amount of space the file really
  943. occupies on disk.}
  944. AttrFile:cardinal; {Attributes of file.}
  945. end;
  946. PFileStatus3=^TFileStatus3;
  947. TFileStatus4=object(TFileStatus3)
  948. cbList:cardinal; {Length of entire EA set.}
  949. end;
  950. PFileStatus4=^TFileStatus4;
  951. TFileFindBuf3=object(TFileStatus)
  952. NextEntryOffset: cardinal; {Offset of next entry}
  953. DateCreation, {Date of file creation.}
  954. TimeCreation, {Time of file creation.}
  955. DateLastAccess, {Date of last access to file.}
  956. TimeLastAccess, {Time of last access to file.}
  957. DateLastWrite, {Date of last modification of file.}
  958. TimeLastWrite:word; {Time of last modification of file.}
  959. FileSize, {Size of file.}
  960. FileAlloc:cardinal; {Amount of space the file really
  961. occupies on disk.}
  962. AttrFile:cardinal; {Attributes of file.}
  963. Name:string; {Also possible to use as ASCIIZ.
  964. The byte following the last string
  965. character is always zero.}
  966. end;
  967. PFileFindBuf3=^TFileFindBuf3;
  968. TFileFindBuf4=object(TFileStatus)
  969. NextEntryOffset: cardinal; {Offset of next entry}
  970. DateCreation, {Date of file creation.}
  971. TimeCreation, {Time of file creation.}
  972. DateLastAccess, {Date of last access to file.}
  973. TimeLastAccess, {Time of last access to file.}
  974. DateLastWrite, {Date of last modification of file.}
  975. TimeLastWrite:word; {Time of last modification of file.}
  976. FileSize, {Size of file.}
  977. FileAlloc:cardinal; {Amount of space the file really
  978. occupies on disk.}
  979. AttrFile:cardinal; {Attributes of file.}
  980. cbList:cardinal; {Size of the file's extended attributes.}
  981. Name:string; {Also possible to use as ASCIIZ.
  982. The byte following the last string
  983. character is always zero.}
  984. end;
  985. PFileFindBuf4=^TFileFindBuf4;
  986. TFileFindBuf3L=object(TFileStatus)
  987. NextEntryOffset: cardinal; {Offset of next entry}
  988. DateCreation, {Date of file creation.}
  989. TimeCreation, {Time of file creation.}
  990. DateLastAccess, {Date of last access to file.}
  991. TimeLastAccess, {Time of last access to file.}
  992. DateLastWrite, {Date of last modification of file.}
  993. TimeLastWrite:word; {Time of last modification of file.}
  994. FileSize, {Size of file.}
  995. FileAlloc:int64; {Amount of space the file really
  996. occupies on disk.}
  997. AttrFile:cardinal; {Attributes of file.}
  998. Name:string; {Also possible to use as ASCIIZ.
  999. The byte following the last string
  1000. character is always zero.}
  1001. end;
  1002. PFileFindBuf3L=^TFileFindBuf3L;
  1003. TFileFindBuf4L=object(TFileStatus)
  1004. NextEntryOffset: cardinal; {Offset of next entry}
  1005. DateCreation, {Date of file creation.}
  1006. TimeCreation, {Time of file creation.}
  1007. DateLastAccess, {Date of last access to file.}
  1008. TimeLastAccess, {Time of last access to file.}
  1009. DateLastWrite, {Date of last modification of file.}
  1010. TimeLastWrite:word; {Time of last modification of file.}
  1011. FileSize, {Size of file.}
  1012. FileAlloc:int64; {Amount of space the file really
  1013. occupies on disk.}
  1014. AttrFile:cardinal; {Attributes of file.}
  1015. cbList:cardinal; {Size of the file's extended attributes.}
  1016. Name:string; {Also possible to use as ASCIIZ.
  1017. The byte following the last string
  1018. character is always zero.}
  1019. end;
  1020. PFileFindBuf4L=^TFileFindBuf4L;
  1021. {Find first file matching a filemask. In contradiction to DOS, a search
  1022. handle is returned which should be closed with FindClose when done.
  1023. FileMask = Filemask to search.
  1024. Handle = Search handle will be returned here, fill with -1 before
  1025. call.
  1026. Attrib = File attributes to search for.
  1027. AFileStatus = Return buffer.
  1028. FileStatusLen = Size of return buffer.
  1029. Count = Fill with maximum number of files to search for, the
  1030. actual number of matching files found is returned here.
  1031. InfoLevel = One of the ilXXXX constants. Consult IBM documentation
  1032. for exact meaning. For normal use: Use ilStandard and
  1033. use PFileFindBuf3 for AFileStatus.}
  1034. function DosFindFirst (FileMask: PChar; var Handle: THandle; Attrib: cardinal;
  1035. AFileStatus: PFileStatus; FileStatusLen: cardinal;
  1036. var Count: cardinal; InfoLevel: cardinal): cardinal;
  1037. cdecl;
  1038. function DosFindFirst (const FileMask: string; var Handle: THandle;
  1039. Attrib: cardinal; AFileStatus: PFileStatus;
  1040. FileStatusLen: cardinal; var Count: cardinal;
  1041. InfoLevel: cardinal): cardinal;
  1042. {Find next matching file.}
  1043. function DosFindNext (Handle: THandle; AFileStatus: PFileStatus;
  1044. FileStatusLen: cardinal; var Count: cardinal): cardinal;
  1045. cdecl;
  1046. {Close a search handle. Cannot fail if handle does exist.}
  1047. function DosFindClose (Handle: THandle): cardinal; cdecl;
  1048. {Get info about a file.
  1049. Handle = Handle of file.
  1050. InfoLevel = One of the ilXXXX constants. Consult IBM documentation
  1051. for exect meaning. For normal use: Use ilStandard and
  1052. PFileFindBuf3 for AFileStatus.
  1053. AFileStatus = An info return buffer.
  1054. FileStatusLen = Size of info buffer.}
  1055. function DosQueryFileInfo (Handle: THandle; InfoLevel: cardinal;
  1056. AFileStatus: PFileStatus; FileStatusLen: cardinal): cardinal; cdecl;
  1057. function DosProtectQueryFileInfo (Handle: THandle; InfoLevel: cardinal;
  1058. AFileStatus: PFileStatus; FileStatusLen: cardinal;
  1059. FileHandleLockID: cardinal): cardinal; cdecl;
  1060. {Set info about a file. File must be opened with write permissions. See
  1061. above fo the parameters.}
  1062. function DosSetFileInfo (Handle: THandle; InfoLevel: cardinal;
  1063. AFileStatus: PFileStatus; FileStatusLen: cardinal): cardinal; cdecl;
  1064. function DosProtectSetFileInfo (Handle: THandle; InfoLevel: cardinal;
  1065. AFileStatus: PFileStatus; FileStatusLen: cardinal;
  1066. FileHandleLockID: cardinal): cardinal; cdecl;
  1067. {Return info about a file. In contradiction to the above functions, the
  1068. file does not have to be open.}
  1069. function DosQueryPathInfo(FileName:PChar;InfoLevel:cardinal;
  1070. AFileStatus:PFileStatus;FileStatusLen:cardinal):cardinal; cdecl;
  1071. function DosQueryPathInfo(const FileName:string;InfoLevel:cardinal;
  1072. AFileStatus:PFileStatus;FileStatusLen:cardinal):cardinal;
  1073. {Set information about a file.}
  1074. function DosSetPathInfo(FileName:PChar;InfoLevel:cardinal;
  1075. AFileStatus:PFileStatus;FileStatusLen,
  1076. Options:cardinal):cardinal; cdecl;
  1077. {Get info about the names and lengths of the EA's for a file or directory.
  1078. RefType = 0 = AFile is a pointer to a file-handle.
  1079. 1 = AFile is a pointer to an ASCIIZ string.
  1080. AFile = Pointer file's name or handle.
  1081. Entry = Number of EA to query inof about. (1 = first EA).
  1082. Buf = Buffer where requested info is returned. For InfoLevel
  1083. 1, the buffer is a TfEA2 datastructure.
  1084. BufLen = Size of buf in bytes.
  1085. Count = Number of EA's to return info for. Number of EA's that
  1086. actually fitted in buf is returned here.
  1087. InfoLevel = Level of information to return. Only level 1 is
  1088. currently allowed.}
  1089. function DosEnumAttribute(RefType:longint;AFile:pointer;
  1090. Entry:longint;var Buf;BufSize:longint;
  1091. var Count:longint;InfoLevel:longint):cardinal; cdecl;
  1092. function DosEnumAttribute(RefType:cardinal;AFile:pointer;
  1093. Entry:cardinal;var Buf;BufSize:cardinal;
  1094. var Count:cardinal;InfoLevel:cardinal):cardinal; cdecl;
  1095. function DosEnumAttribute (RefType: cardinal; AFile: PChar;
  1096. Entry: cardinal; var Buf; BufSize:cardinal;
  1097. var Count: cardinal; InfoLevel: cardinal): cardinal; cdecl;
  1098. function DosEnumAttribute(RefType: cardinal; const AFile: THandle;
  1099. Entry: cardinal; var Buf; BufSize: cardinal;
  1100. var Count: cardinal; InfoLevel: cardinal): cardinal; cdecl;
  1101. function DosProtectEnumAttribute (RefType: cardinal; AFile: pointer;
  1102. Entry: cardinal; var Buf; BufSize: cardinal;
  1103. var Count: cardinal; InfoLevel: cardinal;
  1104. FileHandleLockID: cardinal): cardinal; cdecl;
  1105. function DosEnumAttribute (Handle: longint; Entry: longint; var Buf;
  1106. BufSize: longint; var Count: longint; InfoLevel: longint): cardinal;
  1107. function DosEnumAttribute (Handle: THandle; Entry: cardinal; var Buf;
  1108. BufSize: cardinal; var Count: cardinal; InfoLevel: cardinal): cardinal;
  1109. function DosProtectEnumAttribute (Handle: THandle; Entry: cardinal; var Buf;
  1110. BufSize: cardinal; var Count: cardinal;
  1111. InfoLevel: cardinal;
  1112. FileHandleLockID: cardinal): cardinal;
  1113. function DosEnumAttribute (const FileName: string;
  1114. Entry: cardinal; var Buf; BufSize: cardinal;
  1115. var Count: cardinal; InfoLevel: cardinal): cardinal;
  1116. function DosProtectEnumAttribute (const FileName: string; Entry: cardinal;
  1117. var Buf; BufSize: cardinal;
  1118. var Count: cardinal; InfoLevel: cardinal;
  1119. FileHandleLockID: cardinal): cardinal;
  1120. {Get an environment variable.
  1121. Name = Name of environment variable to get.
  1122. Value = Receives pointer to environment string.}
  1123. function DosScanEnv(Name:PChar;var Value:PChar):cardinal; cdecl;
  1124. {There is, of course a string variant.}
  1125. function DosScanEnv(const Name:string;var Value:string):cardinal;
  1126. const dsPathOnly = 0; {Do not search current dir. (Unless it is
  1127. in the directory list.)}
  1128. dsCurrentDir = 1; {Search in the current direcotry and in the
  1129. directory list.}
  1130. dsEnvironment = 2; {The dirlist parameter is not a directory
  1131. list, but an environment variable
  1132. containing one.}
  1133. dsIgnoreNetErrs = 4; {Ignore network errors when searching.}
  1134. {Search for a file in a given number of directories.
  1135. Flags = A combination of the dsXXXX constants.
  1136. DirList = Directory list or environment variable containing list
  1137. to search in.
  1138. FileName = Filename to search for. May contain wildcards.
  1139. FullName = Receives filename found, including path.
  1140. FullLen = Length of your fullname buffer.}
  1141. function DosSearchPath(Flag:cardinal;DirList,FileName:PChar;
  1142. FullName:PChar;FullLen:cardinal):cardinal; cdecl;
  1143. function DosSearchPath(Flag:cardinal;const DirList,FileName:string;
  1144. var FullName:string):cardinal;
  1145. {****************************************************************************
  1146. File system related routines.
  1147. ****************************************************************************}
  1148. type TFSInfo=record
  1149. case word of
  1150. 1:
  1151. (File_Sys_ID,
  1152. Sectors_Per_Cluster,
  1153. Total_Clusters,
  1154. Free_Clusters:cardinal;
  1155. Bytes_Per_Sector:word);
  1156. 2: {For date/time description,
  1157. see file searching realted
  1158. routines.}
  1159. (Label_Date, {Date when volumelabel created.}
  1160. Label_Time:word; {Time when volumelabel created.}
  1161. VolumeLabel:string); {Volume label. Can also be used
  1162. as ASCIIZ, because the byte
  1163. following the last character of
  1164. the string is always zero.}
  1165. end;
  1166. PFSInfo=^TFSInfo;
  1167. TAttachData=record
  1168. case integer of {Flag in [0,1,2].}
  1169. 0,1: {Flag = 0.}
  1170. (Count:word;
  1171. Data:TCharArray);
  1172. 2: {Flag = 2.}
  1173. (PipeHandle: THandle;
  1174. {Handle of named pipe opened by spooler.}
  1175. SpoolName:string);
  1176. {Name of spooler object. Can also be used
  1177. as ASCIIZ, because the bute following
  1178. the last character is always zero.}
  1179. end;
  1180. PAttachData=^TAttachData;
  1181. TFSQBuffer2=record
  1182. _Type:word;
  1183. NameLen:word;
  1184. FSDNameLen:word;
  1185. FSADataLen:word;
  1186. Name:char;
  1187. Nul1:byte;
  1188. FSDName:char;
  1189. Nul2:byte;
  1190. FSAData:char;
  1191. Nul3:byte;
  1192. end;
  1193. PFSQBuffer2=^TFSQBuffer2;
  1194. const fsAttach = 0; {Attach a drive.}
  1195. fsDetach = 1; {Detach a drive.}
  1196. fsSpoolAttach = 2; {Attach a spool device.}
  1197. fsSpoolDetach = 3; {Detach a spool device.}
  1198. {IBM DOCS: "DosFSAttach attaches or detaches a drive to or from a remote file
  1199. system driver (FSD), or a pseudocharacter device name to or from a local or
  1200. remote FSD."
  1201. DevName = When flag is 0 or 1, the name of a drive or a pseudo-
  1202. character device. When using a drivename use the drive-
  1203. letter followed by a colon.
  1204. When flag is 2 or 3, the name of a spooled device.
  1205. FileSystem = Name of the driver that should be attached or detached
  1206. to DevName. Use nil when flag is 2 or 3.
  1207. Data = Should contain a number of ASCIIZ strings that will
  1208. be passed to the filesystem driver when flag is 0 or 1.
  1209. Should contain de pipehandle and spoolname when flag is
  1210. 2. Should be nil when flag is 3.
  1211. DataLen = Number of bytes in data parameter.
  1212. Flag = One of the dsXXXX constants. See above}
  1213. function DosFSAttach(DevName,FileSystem:PChar;var Data:TAttachData;
  1214. DataLen,Flag:cardinal):cardinal; cdecl;
  1215. function DosFSAttach(const DevName,FileSystem:string;var Data:TAttachData;
  1216. DataLen,Flag:cardinal):cardinal;
  1217. {IBMDOCS: "DosQueryFSAttach obtains information about an attached file system
  1218. (local or remote), or about a character device or pseudocharacter device
  1219. attached to the file system."
  1220. DevName = Name info drive or pseudo character device to query
  1221. info about. Ignored for InfoLevels 2 and 3.
  1222. Ordinal = Index into list of character/pseudo-character
  1223. devices. Starts at 1. Ignored for infolevel 1.
  1224. InfoLevel = 1 = Return information about a drive or device named
  1225. by DevName.
  1226. 2 = Return information about a (pseudo) charachter
  1227. device numbered by Ordinal.
  1228. 3 = Return information about a drive numbered by
  1229. Ordinal.
  1230. Buffer = Will be filled with infomation.
  1231. BufLen = Size of your buffer in bytes. Number of bytes filled
  1232. in your buffer is returned here.}
  1233. function DosQueryFSAttach(DevName:PChar;Ordinal,InfoLevel:longint;
  1234. var Buffer:TFSQBuffer2;var BufLen:longint):cardinal; cdecl;
  1235. function DosQueryFSAttach(const DevName:string;Ordinal,InfoLevel:longint;
  1236. var Buffer:TFSQBuffer2;var BufLen:longint):cardinal;
  1237. function DosQueryFSAttach(DevName:PChar;Ordinal,InfoLevel:cardinal;
  1238. var Buffer:TFSQBuffer2;var BufLen:cardinal):cardinal; cdecl;
  1239. function DosQueryFSAttach(const DevName:string;Ordinal,InfoLevel:cardinal;
  1240. var Buffer:TFSQBuffer2;var BufLen:cardinal):cardinal;
  1241. const FSCtl_Handle=1;
  1242. FSCtl_PathName=2;
  1243. FSCtl_FSDName=3;
  1244. FSCtl_Error_Info=1;
  1245. FSCtl_Max_EASize=2;
  1246. {IBMDOCS: "DosFSCtl provides an extended standard interface between an
  1247. application and a file-system driver (FSD).
  1248. Consult IBM documentation about this function..}
  1249. function DosFSCtl (Data: pointer; DataLen: longint; var ResDataLen: longint;
  1250. Parms: pointer; ParmsLen: longint; var ResParmsLen: longint;
  1251. _Function: longint; Route: PChar;
  1252. Handle, Method: longint): cardinal; cdecl;
  1253. function DosFSCtl (Data: pointer; DataLen: longint; var ResDataLen: longint;
  1254. Parms: pointer;ParmsLen: longint; var ResParmsLen: longint;
  1255. _Function: longint; const Route: string;
  1256. Handle, Method: longint): cardinal;
  1257. function DosFSCtl (Data: pointer; DataLen: cardinal; var ResDataLen: cardinal;
  1258. Parms: pointer; ParmsLen: cardinal; var ResParmsLen: cardinal;
  1259. _Function: cardinal; Route: PChar;
  1260. Handle: THandle;Method: cardinal): cardinal; cdecl;
  1261. function DosFSCtl (Data: pointer; DataLen: cardinal; var ResDataLen: cardinal;
  1262. Parms: pointer; ParmsLen: cardinal; var ResParmsLen: cardinal;
  1263. _Function: cardinal; const Route: string;
  1264. Handle: THandle; Method: cardinal): cardinal;
  1265. {Get information about a drive.
  1266. InfoLevels:
  1267. 1 Get total/free space etc.
  1268. 2 Get volumelabel.}
  1269. function DosQueryFSInfo (DiskNum, InfoLevel: cardinal; var Buffer: TFSInfo;
  1270. BufLen: cardinal): cardinal; cdecl;
  1271. {Set information about a drive.}
  1272. function DosSetFSInfo (DiskNum, InfoLevel: cardinal; var Buffer: TFSinfo;
  1273. BufLen: cardinal): cardinal; cdecl;
  1274. {Check if verify mode is enabled.}
  1275. function DosQueryVerify (var Enabled: longint): cardinal; cdecl;
  1276. function DosQueryVerify (var Enabled: cardinal): cardinal; cdecl;
  1277. function DosQueryVerify (var Enabled: boolean): cardinal; cdecl;
  1278. {Turn the verify mode on or off.}
  1279. function DosSetVerify (Enable: cardinal): cardinal; cdecl;
  1280. function DosSetVerify (Enable: boolean): cardinal; cdecl;
  1281. {Change the number of filehandles our program can open. (Default=50). It
  1282. won't hurt if there are files open when you are calling this.}
  1283. function DosSetMaxFH (Count: cardinal): cardinal; cdecl;
  1284. {Ask for more filehandles (or dump filehandles). It won't hurt if there are
  1285. files open when you are calling this.
  1286. ReqCount = Number of filehandles to ask for. (Negative to dump them.)
  1287. CurMaxFH = Receives the total number of filehandles your program has
  1288. access to.}
  1289. function DosSetRelMaxFH (var ReqCount: longint; var CurMaxFH: longint):
  1290. cardinal; cdecl;
  1291. function DosSetRelMaxFH (var ReqCount: longint; var CurMaxFH: cardinal):
  1292. cardinal; cdecl;
  1293. const dsFull=0; {IBM DOCS: "Perform full system shutdown and
  1294. file-system lock."}
  1295. dsQuiescient=1; {IBM DOCS: "Perform buffer and cache flushing to
  1296. make system quiescent."}
  1297. {Prepare the system for shutdown.}
  1298. function DosShutdown (Flags: cardinal): cardinal; cdecl;
  1299. {Parameters (system variables) for DosQuerySysInfo.}
  1300. const svMaxPathLength = 1; {Maximum length of a pathname.}
  1301. svMaxTextSessions = 2; {Maximum number of text sessions.}
  1302. svMaxPMSessions = 3; {Maximum number of PM sessions.}
  1303. svMaxVDMSessions = 4; {Maximum number of DOS sessions.}
  1304. svBootDrive = 5; {Get the boot drive. (A=1, B=2 etc.)}
  1305. svDynPriVariation = 6; {Dynamic priority variation flag
  1306. (0 = absolute priority, 1 means
  1307. dynamic priority).}
  1308. svMaxWait = 7; {Maximum wait time in seconds.}
  1309. svMinSlice = 8; {Minimum time slice in milliseconds.}
  1310. svMaxSlice = 9; {Maximum time slice in milliseconds.}
  1311. svPageSize = 10; {Size of a page (always 4096 bytes for
  1312. x86).}
  1313. svVersionMajor = 11; {Major version number of kernel:
  1314. 10 for OS/2 1.0 and 1.1,
  1315. 20 for OS/2 2.0 .. OS/2 4.0.}
  1316. svVersionMinor = 12; {Minor version of kernel:
  1317. OS/2 2.0: 00, 2.1: 10, 2.11: 11,
  1318. 3.0: 30, 4.0: 40.}
  1319. svVersionRevision = 13; {Revision of kernel. Until now all
  1320. OS/2 versions return 0.}
  1321. svMsCount = 14; {Uptime in milliseconds.}
  1322. svTimeLow = 15; {System time in seconds since
  1323. 1 January 1970 0:00:00, low dword.}
  1324. svTimeHigh = 16; {System time in seconds since
  1325. 1 January 1970 0:00:00, high dword.}
  1326. svTotPhysMem = 17; {Amount in bytes of physical memory
  1327. in system.}
  1328. svTotResMem = 18; {Amount in bytes of resident memory
  1329. in system.}
  1330. svTotAvailMem = 19; {Amount in bytes of available
  1331. memory.}
  1332. svMaxPrMem = 20; {Maximum amount of memory the current
  1333. process can request for its
  1334. private use.}
  1335. svMaxShMem = 21; {Maximum amount of shared memory
  1336. the current process can request.}
  1337. svTimerInterval = 22; {Timer interval in tenths of a
  1338. millisecond.}
  1339. svMaxCompLength = 23; {Maximum length of a component in a
  1340. pathname.}
  1341. svForegroundFSSession = 24; {Session ID of the foreground
  1342. full-screen session. Presentation
  1343. Manager and all sessions running under
  1344. PM (including PM, windowed VIO, VDM
  1345. and seamless Win 3.x) return ID 1.}
  1346. svForegroundProcess = 25; {Process ID of the current foreground
  1347. process.}
  1348. svNumProcessors = 26; {Number of CPUs in machine - supported
  1349. since WarpServer Advanced SMP.}
  1350. {The following parameters are only supported in WSeB/MCP/eCS
  1351. or OS/2 Warp 4.0 with FP14 and above.}
  1352. svMaxHPrMem = 27; {Maximum amount of high memory the
  1353. process can request for its private
  1354. use in total (not necessarily at once
  1355. because of potential fragmentation).}
  1356. svMaxHShMem = 28; {Maximum amount of high shared memory
  1357. the process can request.}
  1358. svMaxProcesses = 29; {Maximum number of concurrent processes
  1359. supported.}
  1360. svVirtualAddressLimit = 30; {Size of the user address space in MB
  1361. (i.e. the value of the rounded
  1362. VIRTUALADDRESSLIMIT as specified in
  1363. CONFIG.SYS, or the default value of
  1364. 512).}
  1365. svMax = 30; {The maximum parameter number
  1366. for WSeB/MCP/eCS.}
  1367. {Aliases for compatibility...}
  1368. QSV_MAX_PATH_LENGTH = svMaxPathLength;
  1369. QSV_MAX_TEXT_SESSIONS = svMaxTextSessions;
  1370. QSV_MAX_PM_SESSIONS = svMaxPMSessions;
  1371. QSV_MAX_VDM_SESSIONS = svMaxVDMSessions;
  1372. QSV_BOOT_DRIVE = svBootDrive;
  1373. QSV_DYN_PRI_VARIATION = svDynPriVariation;
  1374. QSV_MAX_WAIT = svMaxWait;
  1375. QSV_MIN_SLICE = svMinSlice;
  1376. QSV_MAX_SLICE = svMaxSlice;
  1377. QSV_PAGE_SIZE = svPageSize;
  1378. svMajorVersion = svVersionMajor;
  1379. QSV_VERSION_MAJOR = svVersionMajor;
  1380. svMinorVersion = svVersionMinor;
  1381. QSV_VERSION_MINOR = svVersionMinor;
  1382. svRevision = svVersionRevision;
  1383. QSV_VERSION_REVISION = svVersionRevision;
  1384. QSV_MS_COUNT = svMsCount;
  1385. QSV_TIME_LOW = svTimeLow;
  1386. QSV_TIME_HIGH = svTimeHigh;
  1387. svPhysMem = svTotPhysMem;
  1388. QSV_TOTPHYSMEM = svTotPhysMem;
  1389. svResMem = svTotResMem;
  1390. QSV_TOTRESMEM = svTotResMem;
  1391. svAvailMem = svTotAvailMem;
  1392. QSV_TOTAVAILMEM = svTotAvailMem;
  1393. svPrMem = svMaxPrMem;
  1394. svShMem = svMaxShMem;
  1395. QSV_MAXPRMEM = svMaxPrMem;
  1396. QSV_MAXSHMEM = svMaxShMem;
  1397. QSV_TIMER_INTERVAL = svTimerInterval;
  1398. QSV_MAX_COMP_LENGTH = svMaxCompLength;
  1399. QSV_FOREGROUND_FS_SESSION = svForegroundFSSession;
  1400. svForegroundSession = svForegroundFSSession;
  1401. QSV_FOREGROUND_PROCESS = svForegroundProcess;
  1402. QSV_NUMPROCESSORS = svNumProcessors;
  1403. QSV_MAXHPRMEM = svMaxHPrMem;
  1404. QSV_MAXHSHMEM = svMaxHShMem;
  1405. QSV_MAXPROCESSES = svMaxProcesses;
  1406. QSV_VIRTUALADDRESSLIMIT = svVirtualAddressLimit;
  1407. QSV_MAX = svMax;
  1408. {Get one or more system variables.
  1409. First = First variable to get.
  1410. Last = Last variable to get.
  1411. Buf = Receives variables.
  1412. BufSize = Size of the buffer (every system variable is a cardinal).}
  1413. function DosQuerySysInfo(First,Last:cardinal;var Buf;BufSize:cardinal):cardinal;
  1414. cdecl;
  1415. type
  1416. TQSVValues = array [1..svMax] of cardinal;
  1417. PQSVValues = ^TQSVValues;
  1418. function DosQuerySysInfo(First,Last:cardinal;Buf:PQSVValues;
  1419. BufSize:cardinal):cardinal;cdecl;
  1420. {Return information about a partitionable disk.}
  1421. function DosPhysicalDisk(Func:cardinal;Buf:pointer;BufSize:cardinal;
  1422. Params:pointer;ParamSize:cardinal):cardinal; cdecl;
  1423. {****************************************************************************
  1424. Memory allocation related routines.
  1425. ****************************************************************************}
  1426. const mfPag_Read = $00001; {Give read access to memory.}
  1427. mfPag_Write = $00002; {Give write access to memory.}
  1428. mfPag_Execute = $00004; {Allow code execution in memory.}
  1429. mfPag_Guard = $00008; {Used for dynamic memory growing. Create
  1430. uncommitted memory and make the first
  1431. page guarded. Once it is accessed it
  1432. will be made committed, and the next
  1433. uncommitted page will be made guarded.}
  1434. mfPag_Commit = $00010; {Make the memory committed.}
  1435. mfPag_Decommit = $00020; {Decommit the page.}
  1436. mfObj_Tile = $00040; {Also allocate 16-bit segments of 64k
  1437. which map the memory. (Makes 16<>32 bit
  1438. pointer conversion possible.}
  1439. mfObj_Protected = $00080;
  1440. mfObj_Gettable = $00100;
  1441. mfObj_Giveable = $00200;
  1442. mfObj_Any = $00400; {Allow using high memory (> 512 MB).}
  1443. mfPag_Default = $00400;
  1444. mfPag_Shared = $02000;
  1445. mfPag_Free = $04000;
  1446. mfPag_Base = $10000;
  1447. mfSub_Init = $00001; {Use base, if not set, choose a base
  1448. address yourself.}
  1449. mfSub_Grow = $00002; {Grow the specified heap, instead of
  1450. allocating it. Ignore mfSub_Init.}
  1451. mfSub_Sparse = $00004;
  1452. mfSub_Serialize = $00008;
  1453. (* Plus a little bit compatibility... *)
  1454. pag_Read = mfPag_Read;
  1455. pag_Write = mfPag_Write;
  1456. pag_Execute = mfPag_Execute;
  1457. pag_Guard = mfPag_Guard;
  1458. pag_Commit = mfPag_Commit;
  1459. pag_Decommit = mfPag_Decommit;
  1460. obj_Tile = mfObj_Tile;
  1461. obj_Protected = mfObj_Protected;
  1462. obj_Gettable = mfObj_Gettable;
  1463. obj_Giveable = mfObj_Giveable;
  1464. obj_Any = mfObj_Any;
  1465. pag_Default = mfPag_Default;
  1466. pag_Shared = mfPag_Shared;
  1467. pag_Free = mfPag_Free;
  1468. pag_Base = mfPag_Base;
  1469. sub_Init = mfSub_Init;
  1470. sub_Grow = mfSub_Grow;
  1471. sub_Sparse = mfSub_Sparse;
  1472. sub_Serialize = mfSub_Serialize;
  1473. {Get some memory.
  1474. P = Pointer to memory will be returned here.
  1475. Size = Number of bytes to get. The size is rounded up to a multiple
  1476. of 4096. This is probably not the case on non-intel 386
  1477. versions of OS/2.
  1478. Flags = One or more of the mfXXXX constants.}
  1479. function DosAllocMem(var P:pointer;Size,Flag:cardinal):cardinal; cdecl;
  1480. {Free a memory block.}
  1481. function DosFreeMem(P:pointer):cardinal; cdecl;
  1482. {Set settings for a block of memory.
  1483. P = Pointer to the memory. Doesn't need to be the start of the
  1484. memory block allocated with DosAllocMem, but must be a multiple
  1485. of 4096.
  1486. Size = Number of bytes to change settings for. Is rounded up to a
  1487. multile of 4096.
  1488. Flags = New flags for the memory.}
  1489. function DosSetMem(P:pointer;Size,Flag:cardinal):cardinal; cdecl;
  1490. {Give another process access to a shared memory block.
  1491. P = Pointer to the shared memory object.
  1492. PID = Process of destination process.
  1493. Flag = Permissions the the destination process gets.}
  1494. function DosGiveSharedMem(P:pointer;PID,Flag:cardinal):cardinal; cdecl;
  1495. {Get access to a shared memory object.
  1496. P = Pointer to shared memory object.
  1497. Flag = Permissions to ask.}
  1498. function DosGetSharedMem(P:pointer;Flag:cardinal):cardinal; cdecl;
  1499. {Get access to a shared memory object that has a name.
  1500. P = Pointer to shared memory object.
  1501. Name = Name of the memory object. (Starting with '\SHAREMEM\'.
  1502. Flag = Permissions to ask.}
  1503. function DosGetNamedSharedMem(var P:pointer;Name:PChar;Flag:cardinal):cardinal;
  1504. cdecl;
  1505. function DosGetNamedSharedMem(var P:pointer;const Name:string;
  1506. Flag:cardinal):cardinal;
  1507. {Allocate memory so that it can later be shared with another program.
  1508. P = Reveives pointer to memory.
  1509. Name = Optional: name to give memory. Must start with '\SHAREMEM\'.
  1510. Use nil for the PChar or '' for the string variant for no name.
  1511. Size = Number of bytes to allocate.}
  1512. function DosAllocSharedMem(var P:pointer;Name:PChar;
  1513. Size,Flag:cardinal):cardinal; cdecl;
  1514. function DosAllocSharedMem(var P:pointer;const Name:string;Size,
  1515. Flag:cardinal):cardinal;
  1516. {Get the size and flags of a block of memory.
  1517. P = Pointer to the block of memory.
  1518. Size = Receives block size.
  1519. Flag = Receives the flags.}
  1520. function DosQueryMem(P:pointer;var Size,Flag:longint):cardinal; cdecl;
  1521. function DosQueryMem (P: pointer; var Size, Flag: cardinal): cardinal; cdecl;
  1522. {Allocate a block of memory in a heap.
  1523. Base = Pointer to the start of the heap.
  1524. P = Receives pointer to the memory bock.
  1525. Size = Number of bytes to allocate.}
  1526. function DosSubAllocMem(Base:pointer;var P:pointer;Size:cardinal):cardinal;
  1527. cdecl;
  1528. {Free a block of memory in a heap.
  1529. Base = Pointer to the start of the heap.
  1530. P = Pointer to memory block to free.
  1531. Size = Number of bytes to free.}
  1532. function DosSubFreeMem(Base,P:pointer;Size:cardinal):cardinal; cdecl;
  1533. {Turn a block of memory into a heap.
  1534. Base = Pointer to memory block to turn into a heap.
  1535. Flag = One or more of the mfSub_XXXX flags.
  1536. Size = Size of the requested heap.}
  1537. function DosSubSetMem(Base:pointer;Flag,Size:cardinal):cardinal; cdecl;
  1538. {Destroy a heap. (Memory remains allocated).
  1539. Base = Pointer to the heap to destroy.}
  1540. function DosSubUnsetMem(Base:pointer):cardinal; cdecl;
  1541. {****************************************************************************
  1542. Semaphore related routines
  1543. ****************************************************************************}
  1544. const smShared = $0001; {Semaphore is shared.}
  1545. smMWWaitAny = $0002; {MuxWait only: Wait until a semaphore
  1546. is cleared.}
  1547. smMWWaitAll = $0004; {MuxWait only: Wait until all semaphores
  1548. are cleared.}
  1549. Sem_Indefinite_Wait = -1; {DosRequestMutExSem blocks the calling
  1550. thread indefinitely.}
  1551. Sem_Immediate_Return = 0; {DosRequestMutExSem returns immediately
  1552. without blocking the calling thread.}
  1553. (* The following two flag values are only available
  1554. on Warp 3 FP 29, Warp 4 FP 5 and above. *)
  1555. dce_AutoReset = $1000; {This will cause the (event) semaphore
  1556. to be reset automatically at the time
  1557. it is posted.}
  1558. dce_PostOne = $0800; {This will cause only one thread to be
  1559. posted where multiple threads are
  1560. waiting on an event semaphore created
  1561. with this attribute. dce_PostOne also
  1562. causes the semaphore to be reset
  1563. automatically when it is posted.}
  1564. (* The following just for compatibility. *)
  1565. dcMW_Wait_Any = smMWWaitAny;
  1566. dcMW_Wait_All = smMWWaitAll;
  1567. type PSemRecord=^TSemRecord;
  1568. TSemRecord=record
  1569. Semaphore: THandle; {Handle of semaphore to link.}
  1570. User: cardinal;
  1571. end;
  1572. PSemArray=^TSemArray;
  1573. TSemArray=array[0..$ffff] of TSemRecord;
  1574. {Create an event semaphore.
  1575. Name = Optional: Name of semaphore to create. Must start with '\SEM32\.
  1576. Use nil for PChar or '' for string variant for noname. An
  1577. unnamed semaphore is not shared unless the sm_Shared flag is
  1578. set.
  1579. Handle = Receives handle of semaphore.
  1580. Attr = One or more of the smXXXX constants.
  1581. State = Initial state: 0 = Reset (false), 1 = Posted (true).}
  1582. function DosCreateEventSem (Name: PChar;var Handle: THandle;
  1583. Attr, State: cardinal): cardinal; cdecl;
  1584. function DosCreateEventSem (const Name: string; var Handle: THandle;
  1585. Attr, State: cardinal): cardinal;
  1586. function DosCreateEventSem (Name: PChar;var Handle: THandle;
  1587. Attr: cardinal; State: boolean): cardinal; cdecl;
  1588. function DosCreateEventSem (const Name: string; var Handle: THandle;
  1589. Attr: cardinal; State: boolean): cardinal;
  1590. {Open a semaphore created by another process or thread.
  1591. Name = Name of semaphore.
  1592. Handle = Receives handle of semaphore.}
  1593. function DosOpenEventSem (Name: PChar; var Handle: THandle): cardinal; cdecl;
  1594. function DosOpenEventSem (const Name: string; var Handle: THandle): cardinal;
  1595. {Close an event semaphore.
  1596. Handle = Handle of a semaphore to close.}
  1597. function DosCloseEventSem (Handle: THandle): cardinal; cdecl;
  1598. {Reset an event semaphore: *** probeer *** operation.
  1599. Handle = Handle of semaphore.
  1600. PostCount = Number of times DosPostEventSem has been called since last
  1601. reset.
  1602. Note: Returns errorcode 300 if semaphore is already reset.}
  1603. function DosResetEventSem(Handle:longint;var PostCount:longint):cardinal;
  1604. cdecl;
  1605. function DosResetEventSem (Handle: THandle; var PostCount: cardinal): cardinal;
  1606. cdecl;
  1607. {Post an event semaphore: *** verhoog *** operation.
  1608. Handle = Handle of semaphore.
  1609. Note: Returns errorcode 299 if semaphore is already posted.}
  1610. function DosPostEventSem (Handle: THandle): cardinal; cdecl;
  1611. {Wait until an event semaphore is posted (wait until *** verhoog *** operation).
  1612. Handle = Handle of semaphore.
  1613. Timeout = Return with errorcode if timeout milliseconds have past and the
  1614. semaphore is still reset. To return immediately use 0,
  1615. to wait forever use -1.}
  1616. function DosWaitEventSem (Handle: THandle; Timeout: cardinal): cardinal; cdecl;
  1617. {Check if an event semaphore is posted (if a *** verhoog *** operation has been done).
  1618. Handle = Handle of semaphore.
  1619. Posted = Receives number of times DosPostEventSem was called since
  1620. the last reset.}
  1621. function DosQueryEventSem (Handle: longint; var Posted: longint): cardinal;
  1622. cdecl;
  1623. function DosQueryEventSem (Handle: THandle; var Posted: cardinal): cardinal;
  1624. cdecl;
  1625. {Create a Mutual Exclusion semaphore (mutex).
  1626. Name = Optional: Name to give to semaphore. Must start with '\SEM32\'.
  1627. Use nil for PChar or '' for string variant to use no name.
  1628. If a name if used the semaphore is shared.
  1629. Handle = Receives handle of semaphore.
  1630. Attr = One or more of the smXXXX constants.
  1631. State = Initial state: (0/false=Not owned, 1/true=Owned.)}
  1632. function DosCreateMutExSem (Name: PChar; var Handle: THandle;
  1633. Attr: cardinal; State: boolean): cardinal; cdecl;
  1634. function DosCreateMutExSem (const Name: string; var Handle: THandle;
  1635. Attr: cardinal; State: boolean): cardinal;
  1636. function DosCreateMutExSem (Name: PChar; var Handle: THandle;
  1637. Attr, State: cardinal): cardinal; cdecl;
  1638. function DosCreateMutExSem (const Name: string; var Handle: THandle;
  1639. Attr, State: cardinal): cardinal;
  1640. {Open a shared mutex semaphore.
  1641. Name = Name of semaphore to open, always starts with '\SEM32\'.
  1642. Handle = Receives handle to semaphore.}
  1643. function DosOpenMutExSem (Name: PChar; var Handle: THandle): cardinal; cdecl;
  1644. function DosOpenMutExSem (const Name: string; var Handle: THandle): cardinal;
  1645. {Close a mutex semaphore.
  1646. handle = Handle of semaphore to close.}
  1647. function DosCloseMutExSem (Handle: THandle): cardinal; cdecl;
  1648. {Request ownership of a mutex semaphore. If the semaphore is already owned the
  1649. process is halted until the semaphore is released.
  1650. Handle = Handle of semaphore.
  1651. Timeout = Return with errorcode if the semaphore is still owned after
  1652. timeout milliseconds; special values are Sem_Indefinite_Wait
  1653. and Sem_Immediate_Return.}
  1654. function DosRequestMutExSem (Handle: THandle; Timeout: cardinal): cardinal;
  1655. cdecl;
  1656. {Release the ownership of a mutex semaphore.
  1657. Handle = Handle of semaphore to release.}
  1658. function DosReleaseMutExSem (Handle: THandle): cardinal; cdecl;
  1659. {Query the PID and TIB of the owner of a mutex semaphore.
  1660. Handle = Handle of semaphore.
  1661. PID = Receives process ID of owner.
  1662. TID = Receives thread ID of owner.
  1663. Count = Number of threads (within and outside current process) waiting
  1664. for ownership of semaphore.}
  1665. function DosQueryMutExSem(Handle:longint;var PID,TID,Count:longint):
  1666. cardinal; cdecl;
  1667. function DosQueryMutExSem (Handle: THandle; var PID, TID, Count: cardinal):
  1668. cardinal; cdecl;
  1669. {Create a Multiple Wait (MuxWait) semaphore.
  1670. Name = Optional: Name to give semaphore. Must start with '\SEM32\'.
  1671. Use nil for PChar or '' for string variant to use no name.
  1672. If a name if used the semaphore is shared.
  1673. Handle = Receives handle of semaphore.
  1674. CSemRec = Number of semaphores to link muxwait semaphore with.
  1675. SemArray = Array of semaphore records to link with muxwait semaphore.
  1676. Attr = One or more of the smXXXX constants.}
  1677. function DosCreateMuxWaitSem (Name: PChar; var Handle: THandle;
  1678. CSemRec: cardinal; var SemArray: TSemArray; Attr: cardinal): cardinal; cdecl;
  1679. function DosCreateMuxWaitSem (const Name: string; var Handle: THandle;
  1680. CSemRec: cardinal; var SemArray: TSemArray;
  1681. Attr: cardinal): cardinal;
  1682. {Open a MuxWait semaphore.
  1683. Name = Name of semaphore to open.
  1684. Handle = Receives handle of semaphore.}
  1685. function DosOpenMuxWaitSem (Name: PChar; var Handle: THandle): cardinal; cdecl;
  1686. function DosOpenMuxWaitSem (const Name: string; var Handle: THandle): cardinal;
  1687. {Close a MuxWait semaphore.}
  1688. function DosCloseMuxWaitSem (Handle: THandle): cardinal; cdecl;
  1689. {Wait for the MuxWait semaphore to be cleared.
  1690. Handle = Handle of semaphore.
  1691. Timeout = Timeout. See above.
  1692. User = Receives user value of the semaphore that caused the muxwait
  1693. semaphore to be cleared.}
  1694. function DosWaitMuxWaitSem(Handle:longint;Timeout:longint;
  1695. var User:longint):cardinal;cdecl;
  1696. function DosWaitMuxWaitSem (Handle: THandle; Timeout: cardinal;
  1697. var User: cardinal): cardinal; cdecl;
  1698. {Add a semaphore to the MuxWait semaphore.
  1699. Handle = Handle of semaphore.
  1700. SemRec = The semaphore to add.}
  1701. function DosAddMuxWaitSem (Handle: THandle; var SemRec: TSemRecord): cardinal;
  1702. cdecl;
  1703. {Remove a semaphore from the MuxWait semaphore.
  1704. Handle = Handle of muxwait semaphore.
  1705. Sem = Handle of semaphore to remove.}
  1706. function DosDeleteMuxWaitSem (Handle, Sem: THandle): cardinal; cdecl;
  1707. {Query the semaphores from a MuxWait semaphore.
  1708. Handle = Handle of semaphore.
  1709. CSemRec = Input: Size of our array. Output: Number of items in array.
  1710. SemRecs = Array where TSemRecords are stored.
  1711. Attr = Flags used by creation of semaphore.}
  1712. function DosQueryMuxWaitSem (Handle: longint; var CSemRec: longint;
  1713. var SemRecs: TSemArray; var Attr: longint): cardinal; cdecl;
  1714. function DosQueryMuxWaitSem (Handle: THandle; var CSemRec: cardinal;
  1715. var SemRecs: TSemArray; var Attr: cardinal): cardinal; cdecl;
  1716. {****************************************************************************
  1717. Timing related routines.
  1718. ****************************************************************************}
  1719. type TDateTime=packed record
  1720. case byte of
  1721. 1:
  1722. (Hour,
  1723. Minute,
  1724. Second,
  1725. Sec100,
  1726. Day,
  1727. Month: byte;
  1728. Year: word;
  1729. TimeZone: smallint;
  1730. WeekDay: byte);
  1731. 2: (* For compatibility *)
  1732. (Hours,
  1733. Minutes,
  1734. Seconds,
  1735. Hundredths,
  1736. _Day,
  1737. _Month: byte;
  1738. _Year: word;
  1739. _TimeZone: smallint;
  1740. _WeekDay: byte);
  1741. end;
  1742. PDateTime=^TDateTime;
  1743. {Get the date and time.}
  1744. function DosGetDateTime(var Buf:TDateTime):cardinal; cdecl;
  1745. {Set the date and time.}
  1746. function DosSetDateTime(var Buf:TDateTime):cardinal; cdecl;
  1747. {Start a one shot timer.
  1748. MSec = Number of miliseconds the timer will run.
  1749. HSem = Handle of event semaphore that is posted when time has expired.
  1750. TimHandle = Receives timer handle.}
  1751. function DosAsyncTimer (MSec: cardinal; HSem: THandle;
  1752. var TimHandle: THandle): cardinal; cdecl;
  1753. {Start a cyclic timer.
  1754. MSec = Number of miliseconds the timer will run.
  1755. HSem = Handle of event semaphore that is posted when time has expired.
  1756. TimHandle = Receives timer handle.}
  1757. function DosStartTimer (MSec: cardinal; HSem: THandle;
  1758. var TimHandle: THandle): cardinal; cdecl;
  1759. {Stop a timer and destroy its handle. There is no need to check for an
  1760. error code if you know your timer handle is correct.}
  1761. function DosStopTimer (TimHandle: THandle): cardinal; cdecl;
  1762. {Get the frequency of the high resolution timer.}
  1763. function DosTmrQueryFreq(var Freq:longint):cardinal; cdecl;
  1764. function DosTmrQueryFreq(var Freq:cardinal):cardinal; cdecl;
  1765. {Get the current value of the high resolution timer.}
  1766. function DosTmrQueryTime(var Time:comp):cardinal; cdecl;
  1767. function DosTmrQueryTime (var Time: QWord): cardinal; cdecl;
  1768. {****************************************************************************
  1769. DLL specific routines.
  1770. ****************************************************************************}
  1771. {Load a DLL in memory if it is not yet loaded.
  1772. ObjName = When the DLL cannot be found, or one of the DLL's it needs
  1773. cannot be found, the name of the DLL will be put here.
  1774. ObjLen = Size of the ObjName result buffer.
  1775. DLLName = Name of DLL to load. Do not give an extension or a path,
  1776. just the name. OS/2 will automatically search through the
  1777. LIBPATH for the DLL.
  1778. Handle = Receives DLL handle.}
  1779. function DosLoadModule (ObjName: PChar; ObjLen: cardinal; DLLName: PChar;
  1780. var Handle: THandle): cardinal; cdecl;
  1781. function DosLoadModule (var ObjName: string; ObjLen: cardinal;
  1782. const DLLName: string; var Handle: THandle): cardinal;
  1783. {Let OS/2 know that we do not need a DLL anymore. If we were the only process
  1784. using the DLL, it is unloaded.}
  1785. function DosFreeModule (Handle: THandle): cardinal; cdecl;
  1786. {Get the address of a procedure.
  1787. Handle = DLL handle,
  1788. Ordinal = Procedure to get address for. 0=Use its name.
  1789. ProcName = Name of the procedure to query address for. Must be nil
  1790. for PChar or '' for string variant if Ordinal is nonzero.
  1791. Address = Receives address of procedure.}
  1792. function DosQueryProcAddr (Handle: THandle; Ordinal: cardinal; ProcName: PChar;
  1793. var Address: pointer): cardinal; cdecl;
  1794. function DosQueryProcAddr (Handle: THandle; Ordinal: cardinal;
  1795. const ProcName: string; var Address: pointer): cardinal;
  1796. {Get the handle of a loaded DLL or a loaded executable.
  1797. DLLName = Name of DLL.
  1798. Handle = Receives DLL handle if present.}
  1799. function DosQueryModuleHandle (DLLName: PChar; var Handle: THandle): cardinal;
  1800. cdecl;
  1801. function DosQueryModuleHandle (const DLLName: string;
  1802. var Handle: THandle): cardinal;
  1803. {Get the pathname of a loaded DLL or a loaded executable.
  1804. Handle = Handle of DLL.
  1805. NameLen = Maximum length of char array.
  1806. Name = PChar (or string) where name is returned.}
  1807. function DosQueryModuleName (Handle: THandle; NameLen: cardinal;
  1808. Name: Pchar): cardinal; cdecl;
  1809. {function DosQueryModuleName(Handle:THandle;var Name:OpenString):cardinal;}
  1810. const pt16bit=0;
  1811. pt32bit=1;
  1812. {Return if a procedure is either 16 or 32 bit.
  1813. Handle = Handle of DLL.
  1814. Ordinal = DLL index number. 0 means use Name.
  1815. Name = Must be nil for PChar or '' for string variant if Ordinal
  1816. is zero. Otherwise it contains the procedure name.
  1817. ProcType = One of the ptXXXX constants.}
  1818. function DosQueryProcType (Handle,Ordinal:longint;Name:PChar;
  1819. var ProcType:longint):cardinal; cdecl;
  1820. function DosQueryProcType(Handle,Ordinal:longint;const Name:string;
  1821. var ProcType:longint):cardinal;
  1822. function DosQueryProcType (Handle: THandle; Ordinal: cardinal; Name:PChar;
  1823. var ProcType: cardinal): cardinal; cdecl;
  1824. function DosQueryProcType (Handle: THandle; Ordinal: cardinal; const Name: string;
  1825. var ProcType: cardinal): cardinal;
  1826. {****************************************************************************
  1827. Resource related routines.
  1828. ****************************************************************************}
  1829. {Possible resource types:}
  1830. const rtPointer = 1; {Mouse pointer.}
  1831. rtBitmap = 2; {Bitmap}
  1832. rtMenu = 3; {Menu template.}
  1833. rtDialog = 4; {Dialog template.}
  1834. rtString = 5; {A string table.}
  1835. rtFontDir = 6; {Font directory.}
  1836. rtFont = 7; {A font.}
  1837. rtAccelTable = 8; {Accelerator table.}
  1838. rtRcData = 9; {Binary data.}
  1839. rtMessage = 10; {Error message table.}
  1840. rtDlgInclude = 11; {Dialog include filename.}
  1841. rtVKeyTbl = 12; {Key to vkey tables.}
  1842. rtKeyTbl = 13; {Key to ugl tables.}
  1843. rtCharTbl = 14; {Glyph to character tables.}
  1844. rtDisplayInfo = 15; {Screen display information.}
  1845. rtFKAShort = 16; {Function key area short form.}
  1846. rtFKALong = 17; {Function key area long form.}
  1847. rtHelpTable = 18; {Help table.}
  1848. rtHelpSubTable = 19; {Sub help table.}
  1849. rtFDDir = 20; {DBCS unique/font driver directory.}
  1850. rtFD = 21; {DBCS unique/font driver.}
  1851. {Get the address of a resource object.
  1852. Handle = Handle of DLL (or executable) to get resource from.
  1853. ResType = One of the rtXXXX constants.
  1854. ResName = Number associated to resource object by resource compiler.}
  1855. function DosGetResource (Handle: THandle; ResType, ResName: cardinal;
  1856. var P: pointer): cardinal; cdecl;
  1857. {Remove a resource object from memory.
  1858. P = Pointer to resource.}
  1859. function DosFreeResource (P: pointer): cardinal; cdecl;
  1860. {Get the size of a resource object.
  1861. Handle = Handle to DLL (or executable).
  1862. IDT = One of the rtXXXX constants.
  1863. IDN = Number associated to resource object by resource compiler.
  1864. Size = Receives resource size.}
  1865. function DosQueryResourceSize (Handle,IDT,IDN:longint;var Size:longint):cardinal;
  1866. cdecl;
  1867. function DosQueryResourceSize (Handle: THandle; IDT, IDN: cardinal;
  1868. var Size: cardinal): cardinal; cdecl;
  1869. {****************************************************************************
  1870. Country and codepage specific routines.
  1871. ****************************************************************************}
  1872. type TCountryCode=record
  1873. Country, {Country to query info about (0=current).}
  1874. CodePage:cardinal; {Code page to query info about (0=current).}
  1875. end;
  1876. PCountryCode=^TCountryCode;
  1877. CountryCode=TCountryCode;
  1878. TTimeFmt=(Clock12,Clock24);
  1879. TCountryInfo=record
  1880. Country,CodePage:cardinal; {Country and codepage requested.}
  1881. case byte of
  1882. 0:(
  1883. DateFormat:cardinal; {1=ddmmyy 2=yymmdd 3=mmddyy}
  1884. CurrencyUnit:array[0..4] of char;
  1885. ThousandSeparator:char; {Thousands separator.}
  1886. Zero1:byte; {Always zero.}
  1887. DecimalSeparator:char; {Decimals separator,}
  1888. Zero2:byte;
  1889. DateSeparator:char; {Date separator.}
  1890. Zero3:byte;
  1891. TimeSeparator:char; {Time separator.}
  1892. Zero4:byte;
  1893. CurrencyFormat, {Bit field:
  1894. Bit 0: 0=indicator before value
  1895. 1=indicator after value
  1896. Bit 1: 1=insert space after
  1897. indicator.
  1898. Bit 2: 1=Ignore bit 0&1, replace
  1899. decimal separator with
  1900. indicator.}
  1901. DecimalPlace:byte; {Number of decimal places used in
  1902. currency indication.}
  1903. TimeFormat:TTimeFmt; {12/24 hour.}
  1904. Reserve1:array[0..1] of word;
  1905. DataSeparator:char; {Data list separator}
  1906. Zero5:byte;
  1907. Reserve2:array[0..4] of word);
  1908. 1:(
  1909. fsDateFmt:cardinal; {1=ddmmyy 2=yymmdd 3=mmddyy}
  1910. szCurrency:array[0..4] of char; {null terminated currency symbol}
  1911. szThousandsSeparator:array[0..1] of char;
  1912. {Thousands separator + #0}
  1913. szDecimal:array[0..1] of char; {Decimals separator + #0}
  1914. szDateSeparator:array[0..1] of char;
  1915. {Date separator + #0}
  1916. szTimeSeparator:array[0..1] of char;
  1917. {Time separator + #0}
  1918. fsCurrencyFmt, {Bit field:
  1919. Bit 0: 0=indicator before value
  1920. 1=indicator after value
  1921. Bit 1: 1=insert space after
  1922. indicator.
  1923. Bit 2: 1=Ignore bit 0&1, replace
  1924. decimal separator with
  1925. indicator}
  1926. cDecimalPlace:byte; {Number of decimal places used in
  1927. currency indication}
  1928. fsTimeFmt:byte; {0=12,1=24 hours}
  1929. abReserved1:array[0..1] of word;
  1930. szDataSeparator:array[0..1] of char;
  1931. {Data list separator + #0}
  1932. abReserved2:array[0..4] of word);
  1933. end;
  1934. PCountryInfo=^TCountryInfo;
  1935. CountryInfo=TCountryInfo;
  1936. TDBCSRange=record
  1937. Start,Stop:byte;
  1938. end;
  1939. TDBCSArray=array[0..$ffff] of TDBCSRange;
  1940. PDBCSArray=^TDBCSArray;
  1941. const CurrentCountry:TCountryCode=(Country:0;CodePage:0);
  1942. {Get country specific information.
  1943. Size = Size of our datastructure. (SizeOf(TCountryInfo))
  1944. ActualSize = Size of OS/2's datastructure. ActualSize bytes of
  1945. our TCountryInfo have been filled.}
  1946. function DosQueryCtryInfo(Size:longint;var Country:TCountryCode;
  1947. var Res:TCountryInfo;var ActualSize:longint):cardinal; cdecl;
  1948. function DosQueryCtryInfo(Size:cardinal;var Country:TCountryCode;
  1949. var Res:TCountryInfo;var ActualSize:cardinal):cardinal; cdecl;
  1950. {Get info about a code page with a DBCS character set.}
  1951. function DosQueryDBCSEnv(Size:cardinal;var Country:TCountryCode;
  1952. Buf:PChar):cardinal; cdecl;
  1953. {Convert a string to uppercase.
  1954. Size = Length of string.
  1955. Country = Country and codepage for converting.
  1956. AString = String to convert.}
  1957. function DosMapCase(Size:cardinal;var Country:TCountryCode;
  1958. AString:PChar):cardinal; cdecl;
  1959. function DosMapCase(var Country:TCountryCode;
  1960. var AString:string):cardinal;
  1961. {Get a collate table (a table for comparing which character is smaller and
  1962. which one is greater).
  1963. Size = Length of the databuffer the program has.
  1964. Country = Country to query table for. (0,0) is default country and
  1965. codepage.
  1966. Buf = Buffer to return table in. It's filled with the sort
  1967. weights of the ascii code. For example the 128th byte
  1968. contains the weight for ascii code 128.
  1969. TableLen = Length of collating table.}
  1970. function DosQueryCollate(Size:longint;var Country:TCountryCode;
  1971. Buf:PByteArray;var TableLen:longint):cardinal; cdecl;
  1972. function DosQueryCollate (Size: cardinal; var Country: TCountryCode;
  1973. Buf:PByteArray; var TableLen: cardinal): cardinal; cdecl;
  1974. {Get the current codepage. The PWordArray is filled with the current code
  1975. page followed by alternative codepages.}
  1976. function DosQueryCP(Size:longint;CodePages:PWordArray;
  1977. var ActSize:longint):cardinal; cdecl;
  1978. function DosQueryCP (Size: cardinal; CodePages: PWordArray;
  1979. var ActSize: cardinal): cardinal; cdecl;
  1980. {Change the codepage, but only for the current process.}
  1981. function DosSetProcessCP (CP: cardinal): cardinal; cdecl;
  1982. {****************************************************************************
  1983. Exception handling related functions
  1984. ****************************************************************************}
  1985. {Exception constants.}
  1986. const XCPT_Continue_Search = $00000000;
  1987. XCPT_Continue_Execution = $ffffffff;
  1988. XCPT_Continue_Stop = $00716668;
  1989. XCPT_Signal_Intr = $1;
  1990. XCPT_Signal_KillProc = $3;
  1991. XCPT_Signal_Break = $4;
  1992. XCPT_Fatal_Exception = $c0000000;
  1993. XCPT_Severity_Code = $c0000000;
  1994. XCPT_Customer_Code = $20000000;
  1995. XCPT_Facility_Code = $1fff0000;
  1996. XCPT_Exception_Code = $0000ffff;
  1997. XCPT_Unknown_Access = $00000000;
  1998. XCPT_Read_Access = $00000001;
  1999. XCPT_Write_Access = $00000002;
  2000. XCPT_Execute_Access = $00000004;
  2001. XCPT_Space_Access = $00000008;
  2002. XCPT_Limit_Access = $00000010;
  2003. XCPT_Data_Unknown = $ffffffff;
  2004. XCPT_Guard_Page_Violation = $80000001;
  2005. XCPT_Unable_To_Grow_Stack = $80010001;
  2006. XCPT_Access_Violation = $c0000005;
  2007. XCPT_In_Page_Error = $c0000006;
  2008. XCPT_Illegal_Instruction = $c000001c;
  2009. XCPT_Invalid_Lock_Sequence = $c000001d;
  2010. XCPT_Noncontinuable_Exception = $c0000024;
  2011. XCPT_Invalid_Disposition = $c0000025;
  2012. XCPT_Unwind = $c0000026;
  2013. XCPT_Bad_Stack = $c0000027;
  2014. XCPT_Invalid_Unwind_Target = $c0000028;
  2015. XCPT_Array_Bounds_Exceeded = $c0000093;
  2016. XCPT_Float_Denormal_Operand = $c0000094;
  2017. XCPT_Float_Divide_By_Zero = $c0000095;
  2018. XCPT_Float_Inexact_Result = $c0000096;
  2019. XCPT_Float_Invalid_Operation = $c0000097;
  2020. XCPT_Float_Overflow = $c0000098;
  2021. XCPT_Float_Stack_Check = $c0000099;
  2022. XCPT_Float_Underflow = $c000009a;
  2023. XCPT_Integer_Divide_By_Zero = $c000009b;
  2024. XCPT_Integer_Overflow = $c000009c;
  2025. XCPT_Privileged_Instruction = $c000009d;
  2026. XCPT_Datatype_Misalignment = $c000009e;
  2027. XCPT_Breakpoint = $c000009f;
  2028. XCPT_Single_Step = $c00000a0;
  2029. XCPT_Process_Terminate = $c0010001;
  2030. XCPT_Async_Process_Terminate = $c0010002;
  2031. XCPT_Signal = $c0010003;
  2032. const
  2033. MaxExceptionParameters = 4; { Enough for all system exceptions. }
  2034. type PExceptionRegistrationRecord=^TExceptionRegistrationRecord;
  2035. PExceptionReportRecord=^TExceptionReportRecord;
  2036. PContextRecord=^TContextRecord;
  2037. TExceptionHandler=procedure(Report:PExceptionReportRecord;
  2038. RegRec:PExceptionRegistrationRecord;
  2039. Context:PContextRecord;
  2040. DispContext:pointer); cdecl;
  2041. TExceptionRegistrationRecord=record
  2042. Prev_Structure:PExceptionRegistrationRecord;
  2043. ExceptionHandler:TExceptionHandler;
  2044. end;
  2045. TExceptionReportRecord=record
  2046. Exception_Num,
  2047. HandlerFlags:cardinal;
  2048. Nested_RepRec:PExceptionReportRecord;
  2049. Address:pointer;
  2050. ParamCount:cardinal;
  2051. Parameters:array [0..MaxExceptionParameters] of cardinal;
  2052. end;
  2053. TContextRecord=record
  2054. ContextFlags:cardinal;
  2055. Env:array[1..7] of cardinal;
  2056. FPUStack:array[0..7] of extended;
  2057. Reg_GS,
  2058. Reg_FS,
  2059. Reg_ES,
  2060. Reg_DS,
  2061. Reg_EDI,
  2062. Reg_ESI,
  2063. Reg_EAX,
  2064. Reg_EBX,
  2065. Reg_ECX,
  2066. Reg_EDX,
  2067. Reg_EBP,
  2068. Reg_EIP,
  2069. Reg_CS,
  2070. Flags,
  2071. Reg_ESP,
  2072. Reg_SS:cardinal;
  2073. end;
  2074. {Warning!!! Never use Presentation Manager functions from exception
  2075. handlers!}
  2076. {Install an exceptionhandler. The Prev_Structure field of RegRec should be
  2077. nil, it will be filled in be OS/2. RegRec must be on the stack: It must be a
  2078. local variable.}
  2079. function DosSetExceptionHandler(var RegRec:TExceptionRegistrationRecord):cardinal;
  2080. cdecl;
  2081. {Uninstall an exception handler.}
  2082. function DosUnSetExceptionHandler(var RegRec:TExceptionRegistrationRecord
  2083. ):cardinal; cdecl;
  2084. {Trigger an exception.}
  2085. function DosRaiseException(var Excpt:TExceptionReportRecord):cardinal; cdecl;
  2086. {Send a signal to a process.}
  2087. function DosSendSignalException(PID,Exception:cardinal):cardinal; cdecl;
  2088. {Call and remove a set of exceptionhandlers}
  2089. function DosUnwindException(var Handler:TExceptionRegistrationRecord;
  2090. TargetIP:pointer;
  2091. var RepRec:TExceptionReportRecord):cardinal; cdecl;
  2092. {Full screen applications can get Ctrl-C and Ctrl-Break focus. For all
  2093. processes sharing one screen, only one can have Ctrl-C focus.
  2094. Enable = 0 = Release focus, 1 = Get focus.
  2095. Times = Number of times focus has been get minus number of times it
  2096. has been released.}
  2097. function DosSetSignalExceptionFocus(Enable:longint;var Times:longint):cardinal;
  2098. cdecl;
  2099. function DosSetSignalExceptionFocus (Enable: cardinal;
  2100. var Times: cardinal): cardinal; cdecl;
  2101. function DosSetSignalExceptionFocus (Enable: boolean;
  2102. var Times: cardinal): cardinal; cdecl;
  2103. {Tell OS/2 that if an exception occurs, it must queue it up, until a
  2104. DosExitMustComplete follows. Urgent exceptions still occur. The only
  2105. possible error is that the nesting becomes too high, so error checking
  2106. is only needed in seldom cases.
  2107. Nesting = Number of DosEnterMustComplete calls minus number of
  2108. DosExitMustComplete calls.}
  2109. function DosEnterMustComplete(var Nesting:longint):cardinal; cdecl;
  2110. function DosEnterMustComplete(var Nesting:cardinal):cardinal; cdecl;
  2111. {Tell OS/2 that it can send exceptions again. See above}
  2112. function DosExitMustComplete(var Nesting:longint):cardinal; cdecl;
  2113. function DosExitMustComplete(var Nesting:cardinal):cardinal; cdecl;
  2114. {Tell we want further signal exceptions.
  2115. SignalNum = Signal nummer to acknowlegde.}
  2116. function DosAcknowledgeSignalException (SignalNum: cardinal): cardinal; cdecl;
  2117. {****************************************************************************
  2118. Queue related routines.
  2119. ****************************************************************************}
  2120. type
  2121. TRequestData = record
  2122. case boolean of
  2123. false: (PID0:longint; {ID of process that wrote element.}
  2124. Data0:longint); {Information from process
  2125. writing the data.}
  2126. true: (PID, Data: cardinal);
  2127. end;
  2128. PRequestData = ^TRequestData;
  2129. {Useful constants for priority parameters.}
  2130. const quFIFO=0;
  2131. quLIFO=1;
  2132. quPriority=2;
  2133. quNoConvert_Address=0;
  2134. quConvert_Address=4;
  2135. {Close a queue. If the calling process has created the queue, it is
  2136. destroyed. If you can guarantee the handle is correct, there is no need
  2137. to check for error codes.}
  2138. function DosCloseQueue (Handle: THandle): cardinal; cdecl;
  2139. {Create a queue. The process that creates a queue, owns that queue, and is
  2140. the only one who can read from that queue. Other processes can only write
  2141. to that queue. The queuename must have the format '\QUEUES\name.ext' .
  2142. Handle = Receives queue handle.
  2143. Priority = 0 = Use FIFO system.
  2144. 1 = Use LIFO system.
  2145. 2 = Use priority system.
  2146. Add 4 to convert addresses of data inserted by 16-bit
  2147. processes to 32 bit pointers.
  2148. Name = Name of queue to create.}
  2149. function DosCreateQueue (var Handle: THandle; Priority: cardinal;
  2150. Name: PChar): cardinal; cdecl;
  2151. function DosCreateQueue (var Handle: THandle; Priority: cardinal;
  2152. const Name: string): cardinal;
  2153. {Open an existing queue. You cannot read from the queue unless you are the
  2154. process that created it. The name must have the format '\QUEUES\name.ext'}
  2155. function DosOpenQueue(var Parent_PID:longint;var Handle:longint;
  2156. Name:PChar):cardinal; cdecl;
  2157. function DosOpenQueue(var Parent_PID:longint;var Handle:longint;
  2158. const Name:string):cardinal;
  2159. function DosOpenQueue (var Parent_PID: cardinal; var Handle: THandle;
  2160. Name: PChar): cardinal; cdecl;
  2161. function DosOpenQueue (var Parent_PID: cardinal; var Handle: THandle;
  2162. const Name: string): cardinal;
  2163. {Read a record from a queue, but do not remove it from the queue.
  2164. Handle = Handle of queue to read from.
  2165. ReqBuffer = Receives information about read data.
  2166. DataLen = Receives length of data read.
  2167. DataPtr = Receives the address of the data.
  2168. Element = 0 = Return first element in queue.
  2169. 1 = Return next element in queue. Can be repeated.
  2170. Current element number is returned here, for use
  2171. with DosReadQueue.
  2172. Wait = 0 = Wait until there is a queue element available.
  2173. 1 = Return with an error when queue is empty.
  2174. Priority = Receives priority of queue record (1..15).
  2175. ASem = Use NIL if Wait=0, give a handle of a semaphore when
  2176. Wait=1. The semaphore will be cleared when there is an
  2177. element inserted it the queue.
  2178. !! event queue}
  2179. function DosPeekQueue(Handle:longint;var ReqBuffer:TRequestData;
  2180. var DataLen:longint;var DataPtr:pointer;
  2181. var Element:longint;Wait:longint;
  2182. var Priority:byte;ASem:longint):cardinal; cdecl;
  2183. function DosPeekQueue (Handle: THandle; var ReqBuffer: TRequestData;
  2184. var DataLen: cardinal; var DataPtr: pointer;
  2185. var Element: cardinal; Wait: boolean;
  2186. var Priority: byte; ASem: THandle): cardinal; cdecl;
  2187. function DosPeekQueue (Handle: THandle; var ReqBuffer: TRequestData;
  2188. var DataLen: cardinal; var DataPtr: pointer;
  2189. var Element: cardinal; Wait: cardinal;
  2190. var Priority: byte; ASem: THandle): cardinal; cdecl;
  2191. {Empty a queue. You must be the process the created the queue.}
  2192. function DosPurgeQueue (Handle: THandle): cardinal; cdecl;
  2193. {Return the number of elements in the queue.}
  2194. function DosQueryQueue(Handle:longint;var Count:longint):cardinal; cdecl;
  2195. function DosQueryQueue (Handle: THandle; var Count: cardinal): cardinal; cdecl;
  2196. {Read a record from a queue, but do not remove it from the queue.
  2197. Handle = Handle of queue to read from.
  2198. ReqBuffer = Receives information about read data.
  2199. DataLen = Receives length of data read.
  2200. DataPtr = Receives the address of the data.
  2201. Element = 0 = Return first element in queue.
  2202. Otherwise: Return the element numbered with this.
  2203. Wait = 0 = Wait until there is a queue element available.
  2204. 1 = Return with an error when queue is empty.
  2205. Priority = Receives priority of queue record (1..15).
  2206. ASem = Use NIL if Wait=0, give a handle of a semaphore when
  2207. Wait=1. The semaphore will be cleared when there is an
  2208. element inserted it the queue.
  2209. !! event queue}
  2210. function DosReadQueue(Handle:longint;var ReqBuffer:TRequestData;
  2211. var DataLen:longint;var DataPtr:pointer;
  2212. Element,Wait:longint;var Priority:byte;
  2213. ASem:longint):cardinal; cdecl;
  2214. function DosReadQueue (Handle: THandle; var ReqBuffer: TRequestData;
  2215. var DataLen: cardinal; var DataPtr: pointer;
  2216. Element, Wait: cardinal; var Priority: byte;
  2217. ASem: THandle): cardinal; cdecl;
  2218. function DosReadQueue (Handle: THandle; var ReqBuffer: TRequestData;
  2219. var DataLen: cardinal; var DataPtr: pointer;
  2220. Element: cardinal; Wait: boolean; var Priority: byte;
  2221. ASem: THandle): cardinal; cdecl;
  2222. {Write a data record to a queue.
  2223. Handle = Handle of queue to write to.
  2224. Request = Value that will be inserted in the RequestData field when
  2225. element is read from queue.
  2226. DataLen = Size of data to write.
  2227. DataBuf = Data to write.
  2228. Priority = Priority of data in buffer. Only relevant when queue is
  2229. created with priority support.}
  2230. function DosWriteQueue (Handle: THandle; Request, Datalen: cardinal;
  2231. var DataBuf; Priority: cardinal): cardinal; cdecl;
  2232. {****************************************************************************
  2233. Error handling related routines.
  2234. ****************************************************************************}
  2235. const deHardErr = 1; {Hard errors are enabled, to disable
  2236. do not give this switch.}
  2237. deDisableExceptions = 2; {Exceptions are disabled, to enable
  2238. do not give this switch.}
  2239. {For compatibility with VP:}
  2240. ferr_DisableHardErr = 0; {Disable hard error popups.}
  2241. ferr_EnableHardErr = deHardErr;
  2242. ferr_EnableException = 0; {Enable exception popups.}
  2243. ferr_DisableException = deDisableExceptions;
  2244. {Disable the end user notification of hardware errors and exceptions. Users
  2245. can overide this in config.sys. By default, notification is enabled.
  2246. There is no need for error checking if you can guarantee the parameter is
  2247. correct.}
  2248. function DosError (Error: cardinal): cardinal; cdecl;
  2249. {Get information about an error code.
  2250. It cannot fail, so it is written as procedure.
  2251. Code = Error code to get info about.
  2252. _Class = Receives the error class.
  2253. Action = Receives the recommended action you should take.
  2254. Locus = Receives what could have caused the error.}
  2255. procedure DosErrClass(Code:longint;var _Class,Action,Locus:longint); cdecl;
  2256. procedure DosErrClass (Code: cardinal; var _Class, Action, Locus: cardinal);
  2257. cdecl;
  2258. {****************************************************************************
  2259. Message file specific routines.
  2260. ****************************************************************************}
  2261. type PInsertTable=^TInsertTable;
  2262. TInsertTable=array[1..9] of PChar;
  2263. {Get a message from a messagefile.
  2264. Table = Table of strings to insert.
  2265. TableSize = Number of strings in table.
  2266. Buf = Address of buffer to store message in.
  2267. BufSize = Size of buffer to store message in.
  2268. MsgNumber = Number of message to get.
  2269. FileName = Name of file to get message from.
  2270. MsgSize = The size of the message returned.}
  2271. function DosGetMessage(Table:PInsertTable;TableSize:longint;Buf:PChar;
  2272. BufSize,MsgNumber:longint;FileName:PChar;
  2273. var MsgSize:longint):cardinal;
  2274. function DosGetMessage (Table: PInsertTable; TableSize: cardinal; Buf: PChar;
  2275. BufSize, MsgNumber: cardinal; FileName: PChar;
  2276. var MsgSize: cardinal): cardinal;
  2277. {And a variant using strings and open arrays.
  2278. function DosGetMessage(const Table:array of PString;var Buf:string;
  2279. BufSize,MsgNumber:longint;const FileName:PChar):cardinal;}
  2280. {And a variant using strings, but with a PChar buffer, because of long
  2281. messages, and open arrays.
  2282. function DosGetMessage(const Table:array of PString;Buf:PChar;
  2283. BufSize,MsgNumber:longint;const FileName:string;
  2284. MsgSize:longint):cardinal;}
  2285. {Insert textstrings into a message. The message must be loaded before with
  2286. DosGetMessage. This function is used when the insert strings are not yet
  2287. known when the message was loaded.
  2288. Table = Table of strings to insert.
  2289. TableSize = Number of struings to insert.
  2290. Message = Message to insert strings into.
  2291. SrcMessageSize = Size of message to insert strings into.
  2292. Buf = Receives adjusted message.
  2293. BufSize = Size of your buffer.
  2294. DstMessageSize = Receives size of adjusted message.}
  2295. function DosInsertMessage(Table:PInsertTable;TableSize:longint;
  2296. Message:PChar;SrcMessageSize:longint;
  2297. Buf:PChar;BufSize:longint;
  2298. var DstMessageSize:longint):cardinal; cdecl;
  2299. function DosInsertMessage (Table: PInsertTable; TableSize: cardinal;
  2300. Message: PChar; SrcMessageSize: cardinal;
  2301. Buf: PChar; BufSize: cardinal;
  2302. var DstMessageSize: cardinal): cardinal; cdecl;
  2303. {And a variant using strings and open arrays.
  2304. function DosInsertMessage(Table:array of PString;
  2305. const Message:string;
  2306. var Buf:openstring):cardinal;}
  2307. {And a variant using strings, but with a PChar buffer, because of long
  2308. messages, and open arrays.
  2309. function DosInsertMessage(Table:array of PString;
  2310. Message:PChar;SrcMessageSize:longint;
  2311. Buf:PChar;BufSize:longint;
  2312. var DstMessageSize:longint):cardinal;}
  2313. {Write a message to a file.
  2314. Handle = Handle of file.
  2315. Size = Size of message.
  2316. Buf = Buffer where message is located.}
  2317. function DosPutMessage (Handle: THandle; Size: cardinal; Buf: PChar): cardinal;
  2318. cdecl;
  2319. function DosPutMessage (Handle: THandle; const Buf: string): cardinal;
  2320. {Get info about which codepages and languages a messagefile supports.
  2321. Buf = Receives information.
  2322. BufSize = Size of buffer.
  2323. FileName = Filename of message file.
  2324. InfoSize = Receives size in bytes of the returned info.}
  2325. function DosQueryMessageCP(var Buf;BufSize:longint;FileName:PChar;
  2326. var InfoSize:longint):cardinal;
  2327. function DosQueryMessageCP(var Buf;BufSize:longint;const FileName:string;
  2328. var InfoSize:longint):cardinal;
  2329. function DosQueryMessageCP (var Buf; BufSize: cardinal; FileName: PChar;
  2330. var InfoSize: cardinal): cardinal;
  2331. function DosQueryMessageCP (var Buf; BufSize: cardinal; const FileName: string;
  2332. var InfoSize: cardinal): cardinal;
  2333. {****************************************************************************
  2334. Session specific routines.
  2335. ****************************************************************************}
  2336. const
  2337. {Start the new session independent or as a child.}
  2338. ssf_Related_Independent = 0; {Start new session independent
  2339. of the calling session.}
  2340. ssf_Related_Child = 1; {Start new session as a child
  2341. session to the calling session.}
  2342. {Start the new session in the foreground or in the background.}
  2343. ssf_FgBg_Fore = 0; {Start new session in foreground.}
  2344. ssf_FgBg_Back = 1; {Start new session in background.}
  2345. {Should the program started in the new session
  2346. be executed under conditions for tracing?}
  2347. ssf_TraceOpt_None = 0; {No trace.}
  2348. ssf_TraceOpt_Trace = 1; {Trace with no notification
  2349. of descendants.}
  2350. ssf_TraceOpt_TraceAll = 2; {Trace all descendant sessions.
  2351. A termination queue must be
  2352. supplied and Related must be
  2353. ssf_Related_Child (=1).}
  2354. {Will the new session inherit open file handles
  2355. and environment from the calling process.}
  2356. ssf_InhertOpt_Shell = 0; {Inherit from the shell.}
  2357. ssf_InhertOpt_Parent = 1; {Inherit from the calling process.}
  2358. {Specifies the type of session to start.}
  2359. ssf_Type_Default = 0; {Use program's type.}
  2360. ssf_Type_FullScreen = 1; {OS/2 full screen.}
  2361. ssf_Type_WindowableVIO = 2; {OS/2 window.}
  2362. ssf_Type_PM = 3; {Presentation Manager.}
  2363. ssf_Type_VDM = 4; {DOS full screen.}
  2364. ssf_Type_WindowedVDM = 7; {DOS window.}
  2365. {Additional values for Windows programs}
  2366. Prog_31_StdSeamlessVDM = 15; {Windows 3.1 program in its
  2367. own windowed session.}
  2368. Prog_31_StdSeamlessCommon = 16; {Windows 3.1 program in a
  2369. common windowed session.}
  2370. Prog_31_EnhSeamlessVDM = 17; {Windows 3.1 program in enhanced
  2371. compatibility mode in its own
  2372. windowed session.}
  2373. Prog_31_EnhSeamlessCommon = 18; {Windows 3.1 program in enhanced
  2374. compatibility mode in a common
  2375. windowed session.}
  2376. Prog_31_Enh = 19; {Windows 3.1 program in enhanced
  2377. compatibility mode in a full
  2378. screen session.}
  2379. Prog_31_Std = 20; {Windows 3.1 program in a full
  2380. screen session.}
  2381. {Specifies the initial attributes for a OS/2 window or DOS window session.}
  2382. ssf_Control_Visible = 0; {Window is visible.}
  2383. ssf_Control_Invisible = 1; {Window is invisible.}
  2384. ssf_Control_Maximize = 2; {Window is maximized.}
  2385. ssf_Control_Minimize = 4; {Window is minimized.}
  2386. ssf_Control_NoAutoClose = 8; {Window will not close after
  2387. the program has ended.}
  2388. ssf_Control_SetPos = 32768; {Use InitXPos, InitYPos,
  2389. InitXSize, and InitYSize for
  2390. the size and placement.}
  2391. type TStatusData=record
  2392. Length:word; {Length, in bytes, of datastructure.}
  2393. SelectIND:word; {Determines if the session can be
  2394. selected: Don't change/selectable/
  2395. not selectable (0/1/2).}
  2396. BondIND:word; {Determines which section will come
  2397. to the foreground when it is
  2398. selected: Don't change/child to
  2399. foreground when parent selected/
  2400. parent to foreground when parent
  2401. selected.}
  2402. end;
  2403. PStatusData=^TStatusData;
  2404. {Queue data structure for synchronously started sessions.}
  2405. TChildInfo = record
  2406. case boolean of
  2407. false:
  2408. (SessionID,
  2409. Return: word); {Return code from the child process.}
  2410. true:
  2411. (usSessionID,
  2412. usReturn: word); {Return code from the child process.}
  2413. end;
  2414. PChildInfo = ^TChildInfo;
  2415. TStartData=record
  2416. {Note: to omit some fields, use a length smaller than
  2417. SizeOf(TStartData).}
  2418. Length:word; {Length, in bytes, of datastructure
  2419. (24/30/32/50/60).}
  2420. Related:word; {Independent/child session (0/1).}
  2421. FgBg:word; {Foreground/background (0/1).}
  2422. TraceOpt:word; {No trace/trace this/trace all
  2423. (0/1/2).}
  2424. PgmTitle:PChar; {Program title.}
  2425. PgmName:PChar; {Filename to program.}
  2426. PgmInputs:PChar; {Command parameters (nil allowed).}
  2427. TermQ:PChar; {System queue. (nil allowed).}
  2428. Environment:PChar; {Environment to pass (nil allowed).}
  2429. InheritOpt:word; {Inherit enviroment from shell/
  2430. inherit environment from parent
  2431. (0/1).}
  2432. SessionType:word; {Auto/full screen/window/presentation
  2433. manager/full screen Dos/windowed Dos
  2434. (0/1/2/3/4/5/6/7).}
  2435. Iconfile:PChar; {Icon file to use (nil allowed).}
  2436. PgmHandle:cardinal; {0 or the program handle.}
  2437. PgmControl:word; {Bitfield describing initial state
  2438. of windowed sessions.}
  2439. InitXPos,InitYPos:word; {Initial top coordinates.}
  2440. InitXSize,InitYSize:word; {Initial size.}
  2441. Reserved:word;
  2442. ObjectBuffer:PChar; {If a module cannot be loaded, its
  2443. name will be returned here.}
  2444. ObjectBuffLen:cardinal; {Size of your buffer.}
  2445. end;
  2446. PStartData=^TStartData;
  2447. StartData=TStartData;
  2448. {Start a new session.
  2449. AStartData = A startdata record.
  2450. SesID = Receives session ID of session created.
  2451. PID = Receives process ID of process created.}
  2452. function DosStartSession(var AStartData:TStartData;
  2453. var SesID,PID:longint):cardinal;cdecl;
  2454. function DosStartSession (var AStartData: TStartData;
  2455. var SesID, PID: cardinal): cardinal; cdecl;
  2456. {Set the status of a child session.
  2457. SesID = ID of session.
  2458. AStatus = Status to set.}
  2459. function DosSetSession (SesID: cardinal; var AStatus: TStatusData): cardinal;
  2460. cdecl;
  2461. {Bring a child session to the foreground.
  2462. SesID = ID of session.}
  2463. function DosSelectSession (SesID: cardinal): cardinal; cdecl;
  2464. {Terminate (a) child session(s).
  2465. Scope = 0 = Terminate specified session.
  2466. 1 = Terminate all child sessions.
  2467. SesID = ID of session to terminate (ignored when terminating
  2468. all).}
  2469. function DosStopSession (Scope, SesID: cardinal): cardinal; cdecl;
  2470. {****************************************************************************
  2471. Named/unnamed pipe specific routines.
  2472. ****************************************************************************}
  2473. type TAvailData=record
  2474. cbPipe, {Number of bytes in pipe.}
  2475. cbMessage:word; {Number of bytes in current message.}
  2476. end;
  2477. TPipeInfo=record
  2478. cbOut:word; {Size of outbound data.}
  2479. cbIn:word; {Size of inbound data.}
  2480. MaxInst:byte; {Maximum number of instances.}
  2481. CurInst:byte; {Current number of instances.}
  2482. Name:string; {Name of the pipe. You can use @Name[1] if
  2483. you need a PChar to the name; the string is
  2484. always followed by a zero.}
  2485. end;
  2486. TPipeSemState=record
  2487. Status:byte;
  2488. Flag:byte;
  2489. Key:word;
  2490. Avail:word;
  2491. end;
  2492. {Create an unnamed pipe.
  2493. ReadHandle = Receives handle for reading from pipe.
  2494. WriteHandle = Receives handle to write to pipe.
  2495. Size = Size of pipe to create. 0 means default size. If data is
  2496. written into a pipe that is smaller than the sent data, the
  2497. writing thread is suspended until the data has been read
  2498. from the pipe, thus making room for more data to send.}
  2499. function DosCreatePipe (var ReadHandle, WriteHandle: THandle;
  2500. Size: cardinal): cardinal; cdecl;
  2501. const {np_XXXX constants for openmode.}
  2502. np_Access_Inbound = $0000; {Client to server connection.}
  2503. np_Access_Outbound = $0001; {Server to client access.}
  2504. np_Access_Duplex = $0002; {Two way access.}
  2505. np_Inherit = $0000; {Pipe handle is inherited by
  2506. child processes.}
  2507. np_NoInherit = $0080; {Pipe handle is _not_ inherited by
  2508. child processes.}
  2509. np_No_Write_Behind = $4000; {Don't allow write behind for
  2510. remote pipes.}
  2511. {np_XXXX constants for pipemode.}
  2512. np_Unlimited_Instances = $00ff; {Unlimited instances.}
  2513. np_ReadMode_Mesg = $0100; {Read the pipe as a message
  2514. stream instead of as a byte
  2515. stream.}
  2516. np_ReadMode_Message = np_ReadMode_Mesg;
  2517. np_WriteMode_Mesg = $0400; {Write the pipe as a message
  2518. stream instead of as a byte
  2519. stream.}
  2520. np_WriteMode_Message = np_WriteMode_Mesg;
  2521. np_Type_Message = np_WriteMode_Mesg;
  2522. np_NoWait = $8000; {Dosread and Doswrite do not
  2523. wait is no data can be read or
  2524. written; they return with an
  2525. error message.}
  2526. {Create a named pipe.
  2527. Name = Name of pipe to create.
  2528. Handle = Receives handle to pipe.
  2529. OpenMode = A combination of np_XXXX constants for openmode.
  2530. PipeMode = A combination of np_XXXX constants for pipemode,
  2531. plus a number within [1..254] which determines the number
  2532. of instances that can be created to the pipe, or,
  2533. np_Unlimited_Instance for an unlimited number of
  2534. instances.
  2535. OutBufSize = The number of bytes to allocate for the output buffer.
  2536. InBufSize = The number of bytes to allocate for the input buffer.
  2537. MSec = The maximum time to wait for an available instance.}
  2538. function DosCreateNPipe (Name: PChar; var Handle: THandle; OpenMode, PipeMode,
  2539. OutBufSize, InBufSize, MSec: cardinal): cardinal;
  2540. cdecl;
  2541. function DosCreateNPipe (const Name: string; var Handle: THandle; OpenMode,
  2542. PipeMode, OutBufSize, InBufSize, MSec: cardinal):
  2543. cardinal;
  2544. {Makes a procedure call to a duplex message pipe.
  2545. Name = Name of pipe.
  2546. Input = Buffer that contains data to be written to the pipe.
  2547. InputSize = Size of the inputdata.
  2548. Output = Buffer that contains data to be read from the pipe.
  2549. OutputSize = Size of the outputbuffer.
  2550. ReadBytes = Receives number of bytes actually read.
  2551. MSec = The maximum time to wait for an available instance.}
  2552. function DosCallNPipe(Name:PChar;var Input;InputSize:longint;
  2553. var Output;OutputSize:longint;var ReadBytes:longint;
  2554. MSec:longint):cardinal; cdecl;
  2555. function DosCallNPipe(const Name:string;var Input;InputSize:longint;
  2556. var Output;OutputSize:longint;var ReadBytes:longint;
  2557. MSec:longint):cardinal;
  2558. function DosCallNPipe (Name: PChar; var Input; InputSize: cardinal;
  2559. var Output; OutputSize: cardinal;
  2560. var ReadBytes: cardinal; MSec: cardinal): cardinal;
  2561. cdecl;
  2562. function DosCallNPipe (const Name: string; var Input; InputSize: cardinal;
  2563. var Output; OutputSize: cardinal;
  2564. var ReadBytes: cardinal; MSec: cardinal): cardinal;
  2565. {Prepare a named pipe for a client process.
  2566. Handle = Handle that was returned when pipe was created.}
  2567. function DosConnectNPipe (Handle: THandle): cardinal; cdecl;
  2568. {Acknowledges that a client process has closed a named pipe.
  2569. Handle = Handle that was returned when pipe was created.}
  2570. function DosDisconnectNPipe (Handle: THandle): cardinal; cdecl;
  2571. const np_State_Disconnected = 1; {Pipe is disconnected.}
  2572. np_State_Listening = 2; {Pipe is listening.}
  2573. np_State_Connected = 3; {Pipe is connected.}
  2574. np_State_Closing = 4; {Pipe is closing.}
  2575. {Preview data in a pipe: Read data without removing it.
  2576. Handle = Handle to named pipe.
  2577. Buffer = Buffer to receive data in.
  2578. BufSize = Size of the buffer.
  2579. ReadBytes = Receives number of bytes put in buffer.
  2580. Avail = Receives size of available data.
  2581. State = One of the np_xxxx constants for states.}
  2582. function DosPeekNPipe(Handle:longint;var Buffer;BufSize:longint;
  2583. var ReadBytes:longint;var Avail:TAvailData;
  2584. var State:longint):cardinal; cdecl;
  2585. function DosPeekNPipe (Handle: THandle; var Buffer; BufSize: cardinal;
  2586. var ReadBytes: cardinal; var Avail: TAvailData;
  2587. var State: cardinal): cardinal; cdecl;
  2588. {Get information about a named pipe handle.
  2589. Handle = Handle to pipe.
  2590. State = A combination of np_XXXX constants for (!!!) pipemode.}
  2591. function DosQueryNPHState(Handle:longint;var State:longint):cardinal; cdecl;
  2592. function DosQueryNPHState (Handle: THandle; var State: cardinal): cardinal;
  2593. cdecl;
  2594. {Return information about a named pipe.
  2595. Handle = Handle to pipe.
  2596. InfoLevel = Level of information wanted (1 or 2 allowed).
  2597. Buffer = TPipeInfo datastructure for level 1.
  2598. Unique 4 byte identifier of the client for level 2. Only
  2599. used for LAN based pipe servers.}
  2600. function DosQueryNPipeInfo (Handle: THandle; InfoLevel: cardinal; var Buffer;
  2601. BufSize: cardinal): cardinal; cdecl;
  2602. {Return information of local named pipes that are attached to a semaphore.
  2603. SemHandle = Handle to a shared event or MuxWait semaphore that is
  2604. attached to a named pipe.
  2605. SemArray = Array in which for each pipe attached to the semaphore.
  2606. BufSize = Size of SemArray, in bytes.}
  2607. function DosQueryNPipeSemState (SemHandle: THandle; var SemArray;
  2608. BufSize: cardinal): cardinal; cdecl;
  2609. {Resets the blocking mode and state of a named pipe.
  2610. Handle = Handle to named pipe.
  2611. State = One of the np_XXXX constants for pipemode.}
  2612. function DosSetNPHState (Handle: THandle; State: cardinal): cardinal; cdecl;
  2613. {Attach a shared event semaphore to a local named pipe.
  2614. PipeHandle = Handle to named pipe.
  2615. SemHandle = Handle to semaphore.
  2616. Key = A key that must be different for each named pipe that is
  2617. attached to the semaphore.}
  2618. function DosSetNPipeSem (PipeHandle, SemHandle: THandle; Key: cardinal):
  2619. cardinal; cdecl;
  2620. {Write to a duplex named pipe; then read from it.
  2621. Handle = Handle to named pipe.
  2622. OutBuf = The data to write.
  2623. OutSize = Size of the data to write.
  2624. InBuf = Receives the read data.
  2625. InSize = Size of the input buffer.
  2626. ReadBytes = Number of bytes read from the pipe.}
  2627. function DosTransactNPipe(Handle:longint;var OutBuf;OutSize:longint;
  2628. var InBuf;InSize:longint;
  2629. var ReadBytes:longint):cardinal; cdecl;
  2630. function DosTransactNPipe (Handle: THandle; var OutBuf; OutSize: cardinal;
  2631. var InBuf; InSize: cardinal;
  2632. var ReadBytes: cardinal): cardinal; cdecl;
  2633. {Waits until an instance of a named pipe becomes available.
  2634. Name = Name of named pipe (always starts with '\PIPE\').
  2635. MSec = Return with an error code if this time has elapsed.}
  2636. function DosWaitNPipe (Name: PChar; MSec: cardinal): cardinal; cdecl;
  2637. function DosWaitNPipe (const Name: string; MSec: cardinal): cardinal;
  2638. {****************************************************************************
  2639. Virtual device driver related routines.
  2640. ****************************************************************************}
  2641. {Open a virtual device driver.
  2642. Name = Name of virtual device driver.
  2643. Handle = Receives handle to virtual device driver.}
  2644. function DosOpenVDD (Name: PChar; var Handle: THandle): cardinal; cdecl;
  2645. {Request to talk with a virtual device driver.
  2646. Handle = Handle to virtual device driver.
  2647. SGroup = Handle to the screen group of a DOS session (may be nil).
  2648. Cmd = A number which indicates the service you call.
  2649. InSize = Size of the data to send to the VDD.
  2650. InBuffer = Buffer which contains the data to send to the VDD.
  2651. OutSize = Size of the buffer in which the VDD will return data.
  2652. OutBuffer = Receives the data that the VDD returns.}
  2653. function DosRequestVDD (Handle: THandle; SGroup, Cmd: cardinal;
  2654. InSize: cardinal; var InBuffer;
  2655. OutSize: cardinal; var OutBuffer): cardinal; cdecl;
  2656. {Close a virtual device driver.}
  2657. function DosCloseVDD (Handle: THandle): cardinal; cdecl;
  2658. {****************************************************************************
  2659. 16 <=> 32 bit support related routines
  2660. ****************************************************************************}
  2661. {Convert a 16 bit far pointer to a 32 bit near pointer.
  2662. This procedure needs to be called from assembler.
  2663. This procedure works by mapping an area in your flat address space onto the
  2664. same physical memory address as the selector of the 16 bit far pointer.
  2665. In:
  2666. eax Pointer to convert in selector:offset format.
  2667. Out:
  2668. eax Returned 32 bit near pointer.}
  2669. procedure DosSelToFlat; cdecl;
  2670. type
  2671. TFarPtr = record
  2672. Sel, Offset: word;
  2673. end;
  2674. function SelToFlat (AFarPtr: TFarPtr): pointer;
  2675. function SelToFlat (AFarPtr: cardinal): pointer;
  2676. {The second variant can make use of the register calling convention.}
  2677. {Convert a 32 bit near pointer to a 16 bit far pointer.
  2678. This procedure needs to be called from assembler.
  2679. This procedure works by allocating a selector at the same physical address
  2680. as the pointer you pass points to.
  2681. In:
  2682. eax Pointer to convert in 32 bit near format.
  2683. Out:
  2684. eax Returned 16 bit far pointer in selector:offset format.}
  2685. procedure DosFlatToSel; cdecl;
  2686. {typecast result to TFarPtr}
  2687. function FlatToSel (APtr: pointer): cardinal;
  2688. {Allocate Count dwords in a memory block unique in each thread. A maximum
  2689. of 8 dwords can be allocated at a time, the total size of the thread local
  2690. memory area is 128 bytes; FPC 1.1+ uses one dword from this for internal
  2691. multi-threading support, leaving 124 bytes to programmers.}
  2692. function DosAllocThreadLocalMemory (Count: cardinal; var P: pointer): cardinal;
  2693. cdecl;
  2694. {Deallocate a previously allocated space in the thread local memory area.}
  2695. function DosFreeThreadLocalMemory (P: pointer): cardinal; cdecl;
  2696. const
  2697. { Values for DosQueryRASInfo Index parameter }
  2698. sis_MMIOAddr = 0;
  2699. sis_MEC_Table = 1;
  2700. sis_Sys_Log = 2;
  2701. { The following one for compatibility only }
  2702. SPU_SIS_MEC_TABLE = sis_MEC_Table;
  2703. { Bit flags for the SYSLOG status word. }
  2704. lf_LogEnable = 1; { Logging enabled }
  2705. lf_LogAvailable = 2; { Logging available }
  2706. { DosQueryRASInfo returns information about active trace event recording
  2707. and System Logging facility from the Global Information Segment (InfoSegGDT)
  2708. dump.}
  2709. { Parameters
  2710. * Index - one of the sis_* values:
  2711. sis_MEC_Table - return the address of the table of actively traced major
  2712. event codes in the InfoSegGDT. The table is 32 bytes long, each bit
  2713. represents each major event code from 0 to 255.
  2714. sis_Sys_Log - return the address of the SYSLOG status word from
  2715. the InfoSegGDT. The status may contain a combination of lf_Log* flags
  2716. defined above.}
  2717. { Possible return codes:
  2718. 0 - No_Error
  2719. 5 - Error_Access_Denied
  2720. 87 - Error_Invalid_Parameter}
  2721. function DosQueryRASInfo (Index: cardinal; var PBuffer: pointer): cardinal;
  2722. cdecl;
  2723. const
  2724. { Logging constants }
  2725. ErrLog_Service = 1;
  2726. ErrLog_Version = 1;
  2727. { LogRecord status bits }
  2728. lf_Bit_ProcName = 1; {used to indicate whether the current error log}
  2729. {entry packet contains space in which the error}
  2730. {logging facility can place a long process name}
  2731. {("on" indicates YES, "off" indicates NO) }
  2732. lf_Bit_Origin_256 = 2; {used to indicate whether the current error log }
  2733. {entry packet contains an 8 byte originator name}
  2734. {or a 256 byte originator name ("on" indicates }
  2735. {a 256 byte originator name, "off" indicates an }
  2736. {8 byte originator name) }
  2737. lf_Bit_DateTime = 4; {used to indicate that the caller has placed time}
  2738. {and date values in the Error Log entry packet }
  2739. {and does not wish to have those values modified }
  2740. {during the logging process ("on" indicates that }
  2741. {the error log entry packet already contains time}
  2742. {and date values, "off" indicates the packet does}
  2743. {not already contain time and date values) }
  2744. lf_Bit_Suspend = 8;
  2745. lf_Bit_Resume = 16;
  2746. lf_Bit_Redirect = 32;
  2747. lf_Bit_GetStatus = 64;
  2748. lf_Bit_Register = 128;
  2749. lf_Bit_Remote_Fail = 256;
  2750. type
  2751. { Log entry record header for OS/2 2.x and above used }
  2752. { by 32-bit device drivers and callers of LogAddEntries. }
  2753. TLogRecord = record
  2754. Len: word; { length of this record (including the Len field) }
  2755. Rec_ID: word; { record ID }
  2756. Status: cardinal; { record status bits (see lf_Bit_* constants) }
  2757. Qualifier: array [1..4] of char; { qualifier tag }
  2758. Reserved: cardinal;
  2759. Time: cardinal; { hours, minutes, seconds, hundreds }
  2760. Date: cardinal; { day, month, year (stored as word) }
  2761. case byte of
  2762. 0: (Data: array [1..3400] of char); { variable data (up to 3400 bytes); }
  2763. { beginning of this area must match }
  2764. { one of the following patterns }
  2765. 1: (Originator256: array [0..255] of char; {Originator - if the flag }
  2766. {lf_Bit_Origin_256 is set }
  2767. ProcessName_O256: array [1..260] of char; {if lf_Bit_ProcName is set}
  2768. FormatDLLName_O256_ProcName: array [1..12] of char; {ASCIIZ DLL name}
  2769. Data_O256_ProcName: array [1..3400] of char); {Variable data }
  2770. 2: (Originator256b: array [0..255] of char;
  2771. FormatDLLName_O256: array [1..12] of char;
  2772. Data_O256: array [1..3400] of char);
  2773. 3: (Originator8: array [0..7] of char; {Originator - if flag }
  2774. {lf_Bit_Origin_256 clear }
  2775. ProcessName_O8: array [1..260] of char; {if lf_Bit_ProcName is set}
  2776. FormatDLLName_O8_ProcName: array [1..12] of char;
  2777. Data_O8_ProcName: array [1..3400] of char);
  2778. 4: (Originator8b: array [0..7] of char;
  2779. FormatDLLName_O8: array [1..12] of char;
  2780. Data_O8: array [1..3400] of char);
  2781. end;
  2782. LogRecord = TLogRecord;
  2783. PLogRecord = ^TLogRecord;
  2784. { Format of buffer sent to LogAddEntries }
  2785. TLogEntryRec = record
  2786. Version: word; {this version is 1}
  2787. Count: word; {number of log records in this buffer}
  2788. LogRec: array [0..0] of TLogRecord; {repeated count times}
  2789. end;
  2790. LogEntryRec = TLogEntryRec;
  2791. PLogEntryRec = ^TLogEntryRec;
  2792. { Logging facility functions }
  2793. { Open a connection to the system error logging facility (through the system
  2794. logging service device driver). }
  2795. { Possible return codes:
  2796. 0 .......... success
  2797. non-zero ... facility not available }
  2798. function LogOpen (var Handle: cardinal): cardinal; cdecl;
  2799. { Close the connection to the to the system error logging facility. }
  2800. { Possible return codes:
  2801. 0 .......... success
  2802. non-zero ... failure (possible reason - facility not open)}
  2803. function LogClose (Handle: cardinal): cardinal; cdecl;
  2804. { Add error log entries to the internal error log buffer maintained by
  2805. the system logging service device driver.}
  2806. { Parameters:
  2807. Handle - handle returned by previous LogOpen
  2808. Service - specifies the class of logging facility:
  2809. 0 ........... reserved
  2810. 1 ........... error logging
  2811. 2 - $FFFF ... reserved
  2812. LogEntries - buffer containing a variable length error log entry. The first
  2813. word of the buffer contains the number of packets in the error log entry.
  2814. Multiple error log packets (LogRec structure) can be included within
  2815. a single error log entry buffer. If multiple packets are included within
  2816. a buffer, each individual packet should be aligned on a double word
  2817. boundary.
  2818. Version - packet revision number. Can be used to distinguish error logging
  2819. packets that are intended to be handled by different revisions
  2820. of the LogAddEntries API. For the initial version of the API
  2821. (all OS/2 versions from OS/2 v2.0 up to WSeB and eComStation),
  2822. this field should be set to a value of 1. This field is included
  2823. in the packet to support future backward compatibility.
  2824. Count - number of separate error log entry packets contained within
  2825. the user's buffer
  2826. Len - length of this error log entry packet (LogRec) within the user's
  2827. error log entry buffer in bytes (this length includes the length
  2828. of all the error log entry packet control fields and the size
  2829. of the error log entry text). To support efficient logging execution,
  2830. this length should be a multiple of 4 bytes (i.e. if necessary
  2831. the user should pad the error log entry packet).
  2832. Rec_ID - error log record ID for the current error log entry
  2833. (ID registration will be statically registered by the OS/2
  2834. development organization)
  2835. Status - status flags (two byte flag holder containing three single bit
  2836. flags lf_Bit_* - all the other 29 bits in status flags
  2837. are considered reserved at this time and will be zeroed by
  2838. the LogAddEntries API)
  2839. Qualifier - qualifier name is a secondary name field that is provided
  2840. by the caller
  2841. Reserved - four byte reserved field
  2842. Time - time of logging, filled in by the system error logging facility
  2843. (unless lf_Bit_DateTime status flag is set to "on", indicating
  2844. that the caller has preset a time value)
  2845. Date - date of logging, filled in by the system error logging facility
  2846. (unless lf_Bit_DateTime status flag is set to "on", indicating
  2847. that the caller has preset a date value)
  2848. Originator* - originator name (8 or 256 characters depending on Status),
  2849. a primary name field provided by the caller
  2850. ProcName* - process name (0 or 260 characters), an optional long process
  2851. name field that will be filled in by the error logging facility
  2852. if the field is provided by the caller in the error log entry
  2853. packet
  2854. FormatDLLName* - formatting DLL module name (optional); the optional name
  2855. of a DLL module that houses a formatting routine that
  2856. recognizes this type of error log entry and can format it
  2857. for display by the SYSLOG utility. The name is specified
  2858. as an ASCIIZ string that can be up to eight characters
  2859. in length. If no module name is specified in this field,
  2860. then SYSLOG will display the data portion of the error log
  2861. entry as a hexadecimal dump.
  2862. Data* - error log entry data (up to 3400 characters / bytes); an optional
  2863. variable length set of data that can be supplied by the caller
  2864. (the format of the string is under the control of the caller)
  2865. }
  2866. { Possible return codes:
  2867. 0 - success
  2868. non-zero - failure (invalid log type, facility unavailable, facility
  2869. suspended, facility not open, error log buffer temporarily full)
  2870. }
  2871. function LogAddEntries (Handle: cardinal; Service: cardinal;
  2872. LogEntries: PLogEntryRec): cardinal; cdecl;
  2873. function LogAddEntries (Handle: cardinal; Service: cardinal;
  2874. var LogEntries: TLogEntryRec): cardinal; cdecl;
  2875. {***************************************************************************}
  2876. implementation
  2877. {***************************************************************************}
  2878. function DosCreateThread(var TID:longint;Address:TThreadEntry;
  2879. aParam:pointer;Flags:longint;
  2880. StackSize:longint):cardinal; cdecl;
  2881. external 'DOSCALLS' index 311;
  2882. function DosCreateThread (var TID: cardinal; Address: TThreadEntry;
  2883. aParam: pointer; Flags: cardinal;
  2884. StackSize: cardinal): cardinal; cdecl;
  2885. external 'DOSCALLS' index 311;
  2886. function DosCreateThread(var TID:longint;Address:pointer;
  2887. AParam:Pointer;Flags,StackSize:longint):cardinal;cdecl;
  2888. external 'DOSCALLS' index 311;
  2889. function DosCreateThread (var TID: cardinal; Address: pointer;
  2890. AParam: Pointer; Flags, StackSize: cardinal): cardinal; cdecl;
  2891. external 'DOSCALLS' index 311;
  2892. function DosSuspendThread (TID:cardinal): cardinal; cdecl;
  2893. external 'DOSCALLS' index 238;
  2894. function DosResumeThread (TID: cardinal): cardinal; cdecl;
  2895. external 'DOSCALLS' index 237;
  2896. function DosKillThread (TID: cardinal): cardinal; cdecl;
  2897. external 'DOSCALLS' index 111;
  2898. function DosWaitThread(var TID:longint;Option:longint):cardinal; cdecl;
  2899. external 'DOSCALLS' index 349;
  2900. function DosWaitThread (var TID: cardinal; Option: cardinal): cardinal; cdecl;
  2901. external 'DOSCALLS' index 349;
  2902. function DosEnterCritSec: cardinal; cdecl;
  2903. external 'DOSCALLS' index 232;
  2904. function DosExitCritSec: cardinal; cdecl;
  2905. external 'DOSCALLS' index 233;
  2906. procedure DosExit (Action, Result: cardinal); cdecl;
  2907. external 'DOSCALLS' index 234;
  2908. procedure DosGetInfoBlocks(var ATIB:PThreadInfoBlock;
  2909. var APIB:PProcessInfoBlock); cdecl;
  2910. external 'DOSCALLS' index 312;
  2911. procedure DosGetInfoBlocks(PATIB:PPThreadInfoBlock;
  2912. PAPIB:PPProcessInfoBlock); cdecl;
  2913. external 'DOSCALLS' index 312;
  2914. procedure DosSleep (MSec: cardinal); cdecl;
  2915. external 'DOSCALLS' index 229;
  2916. function DosBeep (Freq, MS: cardinal): cardinal; cdecl;
  2917. external 'DOSCALLS' index 286;
  2918. function DosDebug (DebugBuf: PDbgBuf): cardinal; cdecl;
  2919. external 'DOSCALLS' index 317;
  2920. function DosDebug (var APDbgBuf: TDbgBuf): cardinal; cdecl;
  2921. external 'DOSCALLS' index 317;
  2922. function DosExitList (OrderCode: cardinal; Proc: TExitProc): cardinal; cdecl;
  2923. external 'DOSCALLS' index 296;
  2924. function DosExecPgm (ObjName: PChar; ObjLen: longint; ExecFlag: cardinal;
  2925. Args, Env: PByteArray; var Res: TResultCodes;
  2926. FileName:PChar): cardinal; cdecl;
  2927. external 'DOSCALLS' index 283;
  2928. function DosExecPgm (var ObjName: string; Execflag: cardinal;
  2929. Args, Env: PByteArray; var Res: TResultCodes;
  2930. const FileName: string): cardinal;
  2931. var T,T2:array[0..255] of char;
  2932. begin
  2933. StrPCopy(@T,FileName);
  2934. DosExecPgm:=DosExecPgm(@T2,SizeOf(T2),ExecFlag,Args,Env,Res,@T);;
  2935. ObjName:=StrPas(@T2);
  2936. end;
  2937. function DosWaitChild(Action,Option:longint;var Res:TResultCodes;
  2938. var TermPID:longint;PID:longint):cardinal; cdecl;
  2939. external 'DOSCALLS' index 280;
  2940. function DosWaitChild (Action, Option: cardinal; var Res: TResultCodes;
  2941. var TermPID: cardinal; PID: cardinal): cardinal; cdecl;
  2942. external 'DOSCALLS' index 280;
  2943. function DosSetPriority (Scope, TrClass: cardinal; Delta: longint;
  2944. PortID: cardinal): cardinal; cdecl;
  2945. external 'DOSCALLS' index 236;
  2946. function DosKillProcess (Action, PID: cardinal): cardinal; cdecl;
  2947. external 'DOSCALLS' index 235;
  2948. function DosQueryAppType(FileName:PChar;var Flags:longint):cardinal; cdecl;
  2949. external 'DOSCALLS' index 323;
  2950. function DosQueryAppType (FileName: PChar; var Flags: cardinal): cardinal;
  2951. cdecl;
  2952. external 'DOSCALLS' index 323;
  2953. function DosDevConfig (var DevInfo: byte; Item: cardinal): cardinal; cdecl;
  2954. external 'DOSCALLS' index 231;
  2955. function DosSetFileLocks (Handle: THandle; var Unlock, Lock: TFileLock;
  2956. Timeout, Flags: cardinal): cardinal; cdecl;
  2957. external 'DOSCALLS' index 428;
  2958. function DosProtectSetFileLocks (Handle: THandle; var Unlock, Lock: TFileLock;
  2959. Timeout, Flags: cardinal;
  2960. FileHandleLockID: cardinal): cardinal; cdecl;
  2961. external 'DOSCALLS' index 639;
  2962. function DosCancelLockRequest (Handle: THandle; var Lock: TFileLock): cardinal;
  2963. cdecl;
  2964. external 'DOSCALLS' index 429;
  2965. function DosOpen(FileName:PChar;var Handle,Action:longint;
  2966. InitSize,Attrib,OpenFlags,FileMode:longint;
  2967. EA:PEAOp2):cardinal; cdecl;
  2968. external 'DOSCALLS' index 273;
  2969. function DosOpen (FileName: PChar; var Handle: THandle; var Action: cardinal;
  2970. InitSize, Attrib, OpenFlags, FileMode: cardinal;
  2971. EA: PEAOp2): cardinal; cdecl;
  2972. external 'DOSCALLS' index 273;
  2973. function DosCreate (FileName: PChar; var Handle: THandle;
  2974. Attrib, OpenMode: cardinal): cardinal;
  2975. var Action: cardinal;
  2976. begin
  2977. DosCreate:=DosOpen(FileName,Handle,Action,0,Attrib,18,OpenMode,nil);
  2978. end;
  2979. function DosOpen (FileName: PChar; var Handle: THandle;
  2980. Attrib, OpenMode: cardinal): cardinal;
  2981. var Action: cardinal;
  2982. begin
  2983. DosOpen:=DosOpen(FileName,Handle,Action,0,Attrib,1,OpenMode,nil);
  2984. end;
  2985. function DosOpen(const FileName:string;var Handle,Action:longint;
  2986. InitSize,Attrib,OpenFlags,OpenMode:longint;
  2987. EA:PEAOp2):cardinal;
  2988. var T:array[0..255] of char;
  2989. begin
  2990. StrPCopy(@T,FileName);
  2991. DosOpen:=DosOpen(@T,Handle,Action,InitSize,Attrib,OpenFlags,OpenMode,EA);
  2992. end;
  2993. function DosOpen (const FileName: string; var Handle: THandle;
  2994. var Action: cardinal; InitSize, Attrib, OpenFlags: cardinal;
  2995. OpenMode: cardinal; EA: PEAOp2): cardinal;
  2996. var T:array[0..255] of char;
  2997. begin
  2998. StrPCopy(@T,FileName);
  2999. DosOpen:=DosOpen(@T,Handle,Action,InitSize,Attrib,OpenFlags,OpenMode,EA);
  3000. end;
  3001. function DosCreate (const FileName: string; var Handle: THandle;
  3002. Attrib, OpenMode: cardinal): cardinal;
  3003. var T:array[0..255] of char;
  3004. Action:cardinal;
  3005. begin
  3006. StrPCopy(@T,FileName);
  3007. DosCreate:=DosOpen(@T,Handle,Action,0,Attrib,18,OpenMode,nil);
  3008. end;
  3009. function DosOpen (const FileName: string; var Handle: THandle;
  3010. Attrib, OpenMode: cardinal): cardinal;
  3011. var T:array[0..255] of char;
  3012. Action:cardinal;
  3013. begin
  3014. StrPCopy(@T,FileName);
  3015. DosOpen:=DosOpen(@T,Handle,Action,0,Attrib,1,OpenMode,nil);
  3016. end;
  3017. function DosProtectOpen (FileName: PChar; var Handle: longint;
  3018. var Action: longint; InitSize, Attrib,
  3019. OpenFlags, OpenMode: longint; ea: PEAOp2;
  3020. var FileHandleLockID: cardinal): cardinal; cdecl;
  3021. external 'DOSCALLS' index 637;
  3022. function DosProtectOpen (FileName: PChar; var Handle: THandle;
  3023. var Action: cardinal; InitSize, Attrib,
  3024. OpenFlags, OpenMode: cardinal; ea: PEAOp2;
  3025. var FileHandleLockID: cardinal): cardinal; cdecl;
  3026. external 'DOSCALLS' index 637;
  3027. function DosProtectOpen (const FileName: string; var Handle: longint;
  3028. var Action: longint; InitSize, Attrib,
  3029. OpenFlags, OpenMode: longint; ea: PEAOp2;
  3030. var FileHandleLockID: cardinal): cardinal;
  3031. var T:array[0..255] of char;
  3032. begin
  3033. StrPCopy(@T,FileName);
  3034. DosProtectOpen:=DosProtectOpen(@T,Handle,Action,InitSize,Attrib,OpenFlags,OpenMode,EA,FileHandleLockID);
  3035. end;
  3036. function DosProtectOpen (const FileName: string; var Handle: THandle;
  3037. var Action: cardinal; InitSize, Attrib,
  3038. OpenFlags, OpenMode: cardinal; ea: PEAOp2;
  3039. var FileHandleLockID: cardinal): cardinal;
  3040. var T:array[0..255] of char;
  3041. begin
  3042. StrPCopy(@T,FileName);
  3043. DosProtectOpen:=DosProtectOpen(@T,Handle,Action,InitSize,Attrib,OpenFlags,OpenMode,EA,FileHandleLockID);
  3044. end;
  3045. function DosClose (Handle: THandle): cardinal; cdecl;
  3046. external 'DOSCALLS' index 257;
  3047. function DosProtectClose (Handle: THandle;
  3048. FileHandleLockID: cardinal): cardinal; cdecl;
  3049. external 'DOSCALLS' index 638;
  3050. function DosRead(Handle:longint;var Buffer;Count:longint;
  3051. var ActCount:longint):cardinal; cdecl;
  3052. external 'DOSCALLS' index 281;
  3053. function DosRead (Handle: THandle; var Buffer; Count: cardinal;
  3054. var ActCount: cardinal): cardinal; cdecl;
  3055. external 'DOSCALLS' index 281;
  3056. function DosProtectRead (Handle: longint; var Buffer; Count: longint;
  3057. var ActCount: longint; FileHandleLockID: cardinal): cardinal; cdecl;
  3058. external 'DOSCALLS' index 641;
  3059. function DosProtectRead (Handle: THandle; var Buffer; Count: cardinal;
  3060. var ActCount: cardinal; FileHandleLockID: cardinal): cardinal; cdecl;
  3061. external 'DOSCALLS' index 641;
  3062. function DosWrite(Handle:longint;var Buffer;Count:longint;
  3063. var ActCount:longint):cardinal; cdecl;
  3064. external 'DOSCALLS' index 282;
  3065. function DosWrite (Handle: THandle; var Buffer; Count: cardinal;
  3066. var ActCount: cardinal): cardinal; cdecl;
  3067. external 'DOSCALLS' index 282;
  3068. function DosProtectWrite (Handle: longint; var Buffer; Count: longint;
  3069. var ActCount: longint;
  3070. FileHandleLockID: cardinal): cardinal; cdecl;
  3071. external 'DOSCALLS' index 642;
  3072. function DosProtectWrite (Handle: THandle; var Buffer; Count: cardinal;
  3073. var ActCount: cardinal;
  3074. FileHandleLockID: cardinal): cardinal; cdecl;
  3075. external 'DOSCALLS' index 642;
  3076. function DosSetFilePtr(Handle:longint;Pos:longint;Method:cardinal;
  3077. var PosActual:longint):cardinal; cdecl;
  3078. external 'DOSCALLS' index 256;
  3079. function DosSetFilePtr (Handle: THandle; Pos: longint; Method: cardinal;
  3080. var PosActual: cardinal): cardinal; cdecl;
  3081. external 'DOSCALLS' index 256;
  3082. function DosSetFilePtr (Handle: THandle; Pos: longint): cardinal;
  3083. var PosActual: cardinal;
  3084. begin
  3085. DosSetFilePtr:=DosSetFilePtr(Handle,Pos,0,PosActual);
  3086. end;
  3087. function DosProtectSetFilePtr (Handle: longint; Pos, Method: longint;
  3088. var PosActual: longint;
  3089. FileHandleLockID: cardinal): cardinal; cdecl;
  3090. external 'DOSCALLS' index 621;
  3091. function DosProtectSetFilePtr (Handle: THandle; Pos: longint; Method: cardinal;
  3092. var PosActual: cardinal;
  3093. FileHandleLockID: cardinal): cardinal; cdecl;
  3094. external 'DOSCALLS' index 621;
  3095. function DosProtectSetFilePtr (Handle: THandle; Pos: longint;
  3096. FileHandleLockID: cardinal): cardinal;
  3097. var PosActual:cardinal;
  3098. begin
  3099. DosProtectSetFilePtr:=DosProtectSetFilePtr(Handle,Pos,0,PosActual,
  3100. FileHandleLockID);
  3101. end;
  3102. function DosGetFilePtr(Handle:longint;var PosActual:longint):cardinal;
  3103. begin
  3104. DosGetFilePtr:=DosSetFilePtr(Handle,0,1,PosActual);
  3105. end;
  3106. function DosGetFilePtr (Handle: THandle; var PosActual: cardinal): cardinal;
  3107. begin
  3108. DosGetFilePtr:=DosSetFilePtr(Handle,0,1,PosActual);
  3109. end;
  3110. function DosProtectGetFilePtr (Handle: longint;
  3111. var PosActual: longint; FileHandleLockID: cardinal): cardinal;
  3112. begin
  3113. DosProtectGetFilePtr := DosProtectSetFilePtr (Handle, 0, 1, PosActual,
  3114. FileHandleLockID);
  3115. end;
  3116. function DosProtectGetFilePtr (Handle: THandle;
  3117. var PosActual: cardinal; FileHandleLockID: cardinal): cardinal;
  3118. begin
  3119. DosProtectGetFilePtr := DosProtectSetFilePtr (Handle, 0, 1, PosActual,
  3120. FileHandleLockID);
  3121. end;
  3122. function DosSetFileSize (Handle: THandle; Size: cardinal): cardinal; cdecl;
  3123. external 'DOSCALLS' index 272;
  3124. function DosProtectSetFileSize (Handle: THandle; Size: cardinal;
  3125. FileHandleLockID: cardinal): cardinal; cdecl;
  3126. external 'DOSCALLS' index 640;
  3127. function DosResetBuffer (Handle: THandle): cardinal; cdecl;
  3128. external 'DOSCALLS' index 254;
  3129. function DosDupHandle (Handle: THandle; var Duplicate: THandle): cardinal;
  3130. cdecl;
  3131. external 'DOSCALLS' index 260;
  3132. function DosQueryFHState(Handle:longint;var FileMode:longint):cardinal; cdecl;
  3133. external 'DOSCALLS' index 276;
  3134. function DosQueryFHState (Handle: THandle; var FileMode: cardinal): cardinal;
  3135. cdecl;
  3136. external 'DOSCALLS' index 276;
  3137. function DosProtectQueryFHState (Handle: THandle; var FileMode: cardinal;
  3138. FileHandleLockID: cardinal): cardinal; cdecl;
  3139. external 'DOSCALLS' index 645;
  3140. function DosSetFHState (Handle: THandle; FileMode: cardinal): cardinal; cdecl;
  3141. external 'DOSCALLS' index 221;
  3142. function DosProtectSetFHState (Handle: THandle; FileMode: cardinal;
  3143. FileHandleLockID: cardinal): cardinal; cdecl;
  3144. external 'DOSCALLS' index 644;
  3145. function DosQueryHType(Handle:longint;var HandType:longint;
  3146. var Attr:longint):cardinal; cdecl;
  3147. external 'DOSCALLS' index 224;
  3148. function DosQueryHType (Handle: THandle; var HandType: cardinal;
  3149. var Attr: cardinal): cardinal; cdecl;
  3150. external 'DOSCALLS' index 224;
  3151. function DosEditName (MetaLevel: cardinal; Source, Edit: PChar;
  3152. Target: PChar; TargetLen: cardinal): cardinal; cdecl;
  3153. external 'DOSCALLS' index 261;
  3154. function DosEditName (MetaLevel: cardinal; const Source, Edit: string;
  3155. var Target: string): cardinal;
  3156. var T,T2,T3:array[0..255] of char;
  3157. begin
  3158. StrPCopy(@T,Source);
  3159. StrPCopy(@T2,Edit);
  3160. DosEditName:=DosEditName(MetaLevel,@T,@T2,@T3,SizeOf(T3));
  3161. Target:=StrPas(@T3);
  3162. end;
  3163. function DosMove(OldFile,NewFile:PChar):cardinal; cdecl;
  3164. external 'DOSCALLS' index 271;
  3165. function DosMove(const OldFile,NewFile:string):cardinal;
  3166. var T,T2:array[0..255] of char;
  3167. begin
  3168. StrPCopy(@T,OldFile);
  3169. StrPCopy(@T2,NewFile);
  3170. DosMove:=DosMove(@T,@T2);
  3171. end;
  3172. function DosCopy (OldFile, NewFile: PChar; Option: cardinal): cardinal; cdecl;
  3173. external 'DOSCALLS' index 258;
  3174. function DosCopy (const OldFile, NewFile: string; Option: cardinal): cardinal;
  3175. var T,T2:array[0..255] of char;
  3176. begin
  3177. StrPCopy(@T,OldFile);
  3178. StrPCopy(@T2,NewFile);
  3179. DosCopy:=DosCopy(@T,@T2,Option);
  3180. end;
  3181. function DosDelete(FileName:PChar):cardinal; cdecl;
  3182. external 'DOSCALLS' index 259;
  3183. function DosDelete(const FileName:string):cardinal;
  3184. var T:array[0..255] of char;
  3185. begin
  3186. StrPCopy(@T,FileName);
  3187. DosDelete:=DosDelete(@T);
  3188. end;
  3189. function DosForceDelete(FileName:PChar):cardinal; cdecl;
  3190. external 'DOSCALLS' index 110;
  3191. function DosForceDelete(const FileName:string):cardinal;
  3192. var T:array[0..255] of char;
  3193. begin
  3194. StrPCopy(@T,FileName);
  3195. DosForceDelete:=DosForceDelete(@T);
  3196. end;
  3197. function DosCreateDir(Name:PChar;EA:PEAOp2):cardinal; cdecl;
  3198. external 'DOSCALLS' index 270;
  3199. function DosCreateDir(Name:PChar):cardinal;
  3200. begin
  3201. DosCreateDir:=DosCreateDir(Name,nil);
  3202. end;
  3203. function DosCreateDir(const Name:string;EA:PEAOp2):cardinal;
  3204. var T:array[0..255] of char;
  3205. begin
  3206. StrPCopy(@T,Name);
  3207. DosCreateDir:=DosCreateDir(@T,EA);
  3208. end;
  3209. function DosCreateDir(const Name:string):cardinal;
  3210. var T:array[0..255] of char;
  3211. begin
  3212. StrPCopy(@T,Name);
  3213. DosCreateDir:=DosCreateDir(@T,nil);
  3214. end;
  3215. function DosDeleteDir(Name:PChar):cardinal; cdecl;
  3216. external 'DOSCALLS' index 226;
  3217. function DosDeleteDir(const Name:string):cardinal;
  3218. var T:array[0..255] of char;
  3219. begin
  3220. StrPCopy(@T,Name);
  3221. DosDeleteDir:=DosDeleteDir(@T);
  3222. end;
  3223. function DosSetDefaultDisk(DiskNum:cardinal):cardinal; cdecl;
  3224. external 'DOSCALLS' index 220;
  3225. procedure DosQueryCurrentDisk(var DiskNum:longint;var Logical:longint); cdecl;
  3226. external 'DOSCALLS' index 275;
  3227. procedure DosQueryCurrentDisk (var DiskNum: cardinal; var Logical: cardinal);
  3228. cdecl;
  3229. external 'DOSCALLS' index 275;
  3230. function DosSetCurrentDir(Name:PChar):cardinal; cdecl;
  3231. external 'DOSCALLS' index 255;
  3232. function DosSetCurrentDir(const Name:string):cardinal;
  3233. var T:array[0..255] of char;
  3234. begin
  3235. StrPCopy(@T,Name);
  3236. DosSetCurrentDir:=DosSetCurrentDir(@T);
  3237. end;
  3238. function DosQueryCurrentDir(DiskNum:longint;var Buffer;
  3239. var BufLen:longint):cardinal; cdecl;
  3240. external 'DOSCALLS' index 274;
  3241. function DosQueryCurrentDir (DiskNum: cardinal; var Buffer;
  3242. var BufLen: cardinal): cardinal; cdecl;
  3243. external 'DOSCALLS' index 274;
  3244. function DosQueryCurrentDir (DiskNum: cardinal; var Buffer: string): cardinal;
  3245. var T:array[0..255] of char;
  3246. L: cardinal;
  3247. begin
  3248. L:=255;
  3249. DosQueryCurrentDir:=DosQueryCurrentDir(DiskNum,T,L);
  3250. Buffer:=StrPas(@T);
  3251. end;
  3252. function DosDevIOCtl(Handle,Category,Func:longint;var Params;
  3253. ParamLen:longint;var ParamSize:longint;
  3254. var Data;DataLen:longint;var DataSize:longint):cardinal; cdecl;
  3255. external 'DOSCALLS' index 284;
  3256. function DosDevIOCtl (Handle: THandle; Category, Func: cardinal; var Params;
  3257. ParamLen: cardinal; var ParamSize: cardinal;
  3258. var Data; DataLen: cardinal; var DataSize: cardinal):
  3259. cardinal; cdecl;
  3260. external 'DOSCALLS' index 284;
  3261. function DosFindFirst (FileMask: PChar; var Handle: THandle; Attrib: cardinal;
  3262. AFileStatus: PFileStatus; FileStatusLen: cardinal;
  3263. var Count: cardinal; InfoLevel: cardinal): cardinal;
  3264. cdecl;
  3265. external 'DOSCALLS' index 264;
  3266. function DosFindFirst (const FileMask: string; var Handle: THandle;
  3267. Attrib: cardinal; AFileStatus: PFileStatus;
  3268. FileStatusLen: cardinal; var Count: cardinal;
  3269. InfoLevel: cardinal): cardinal;
  3270. var T:array[0..255] of char;
  3271. begin
  3272. StrPCopy(@T,FileMask);
  3273. DosFindFirst:=DosFindFirst(@T,Handle,Attrib,AFileStatus,FileStatusLen,
  3274. Count,InfoLevel);
  3275. end;
  3276. function DosFindNext (Handle: THandle; AFileStatus: PFileStatus;
  3277. FileStatusLen: cardinal; var Count: cardinal): cardinal;
  3278. cdecl;
  3279. external 'DOSCALLS' index 265;
  3280. function DosFindClose (Handle: THandle): cardinal; cdecl;
  3281. external 'DOSCALLS' index 263;
  3282. function DosQueryFileInfo (Handle: THandle; InfoLevel: cardinal;
  3283. AFileStatus: PFileStatus;
  3284. FileStatusLen: cardinal): cardinal; cdecl;
  3285. external 'DOSCALLS' index 279;
  3286. function DosProtectQueryFileInfo (Handle: THandle; InfoLevel: cardinal;
  3287. AFileStatus: PFileStatus;
  3288. FileStatusLen: cardinal;
  3289. FileHandleLockID: cardinal): cardinal; cdecl;
  3290. external 'DOSCALLS' index 646;
  3291. function DosSetFileInfo (Handle: THandle; InfoLevel: cardinal;
  3292. AFileStatus: PFileStatus;
  3293. FileStatusLen: cardinal): cardinal; cdecl;
  3294. external 'DOSCALLS' index 218;
  3295. function DosProtectSetFileInfo (Handle: THandle; InfoLevel: cardinal;
  3296. AFileStatus: PFileStatus;
  3297. FileStatusLen: cardinal;
  3298. FileHandleLockID: cardinal): cardinal; cdecl;
  3299. external 'DOSCALLS' index 643;
  3300. function DosQueryPathInfo (FileName: PChar; InfoLevel: cardinal;
  3301. AFileStatus: PFileStatus; FileStatusLen: cardinal): cardinal; cdecl;
  3302. external 'DOSCALLS' index 223;
  3303. function DosQueryPathInfo (const FileName: string; InfoLevel: cardinal;
  3304. AFileStatus: PFileStatus; FileStatusLen: cardinal): cardinal;
  3305. var T:array[0..255] of char;
  3306. begin
  3307. StrPCopy(@T,FileName);
  3308. DosQueryPathInfo:=DosQueryPathInfo(@T,InfoLevel,AFileStatus,
  3309. FileStatusLen);
  3310. end;
  3311. function DosSetPathInfo (FileName: PChar; InfoLevel: cardinal;
  3312. AFileStatus: PFileStatus; FileStatusLen,
  3313. Options: cardinal): cardinal; cdecl;
  3314. external 'DOSCALLS' index 219;
  3315. function DosEnumAttribute(RefType:longint;AFile:pointer;
  3316. Entry:longint;var Buf;BufSize:longint;
  3317. var Count:longint;InfoLevel:longint):cardinal; cdecl;
  3318. external 'DOSCALLS' index 372;
  3319. function DosEnumAttribute (RefType: cardinal; AFile: pointer;
  3320. Entry: cardinal; var Buf; BufSize: cardinal;
  3321. var Count: cardinal; InfoLevel: cardinal): cardinal;
  3322. cdecl;
  3323. external 'DOSCALLS' index 372;
  3324. function DosEnumAttribute (RefType: cardinal; AFile: PChar;
  3325. Entry: cardinal; var Buf; BufSize: cardinal;
  3326. var Count: cardinal; InfoLevel: cardinal): cardinal;
  3327. cdecl;
  3328. external 'DOSCALLS' index 372;
  3329. function DosEnumAttribute (RefType: cardinal; const AFile: THandle;
  3330. Entry: cardinal; var Buf; BufSize: cardinal;
  3331. var Count: cardinal; InfoLevel: cardinal): cardinal;
  3332. cdecl;
  3333. external 'DOSCALLS' index 372;
  3334. function DosProtectEnumAttribute (RefType: cardinal; AFile: pointer;
  3335. Entry: cardinal; var Buf; BufSize: cardinal;
  3336. var Count: cardinal; InfoLevel: cardinal;
  3337. FileHandleLockID: cardinal): cardinal; cdecl;
  3338. external 'DOSCALLS' index 636;
  3339. function DosEnumAttribute (Handle: longint; Entry: longint; var Buf;
  3340. BufSize: longint;
  3341. var Count: longint; InfoLevel: longint): cardinal;
  3342. begin
  3343. DosEnumAttribute:=DosEnumAttribute(0,@Handle,Entry,Buf,BufSize,Count,
  3344. InfoLevel);
  3345. end;
  3346. function DosEnumAttribute (Handle: THandle; Entry: cardinal; var Buf;
  3347. BufSize: cardinal;
  3348. var Count: cardinal; InfoLevel: cardinal): cardinal;
  3349. begin
  3350. DosEnumAttribute:=DosEnumAttribute(0,@Handle,Entry,Buf,BufSize,Count,
  3351. InfoLevel);
  3352. end;
  3353. function DosProtectEnumAttribute (Handle: THandle; Entry: cardinal; var Buf;
  3354. BufSize: cardinal; var Count: cardinal;
  3355. InfoLevel: cardinal;
  3356. FileHandleLockID: cardinal): cardinal;
  3357. begin
  3358. DosProtectEnumAttribute := DosProtectEnumAttribute (0, @Handle, Entry, Buf,
  3359. BufSize, Count, InfoLevel, FileHandleLockID);
  3360. end;
  3361. function DosEnumAttribute (const FileName: string;
  3362. Entry: cardinal;var Buf;BufSize: cardinal;
  3363. var Count: cardinal; InfoLevel: cardinal): cardinal;
  3364. var T:array[0..255] of char;
  3365. begin
  3366. StrPCopy(@T,FileName);
  3367. DosEnumAttribute:=DosEnumAttribute(1,@T,Entry,Buf,BufSize,Count,
  3368. InfoLevel);
  3369. end;
  3370. function DosProtectEnumAttribute (const FileName: string; Entry: cardinal;
  3371. var Buf; BufSize: cardinal;
  3372. var Count: cardinal; InfoLevel: cardinal;
  3373. FileHandleLockID: cardinal): cardinal;
  3374. var T: array [0..255] of char;
  3375. begin
  3376. StrPCopy (@T, FileName);
  3377. DosProtectEnumAttribute := DosProtectEnumAttribute (1, @T, Entry, Buf,
  3378. BufSize, Count, InfoLevel, FileHandleLockID);
  3379. end;
  3380. function DosScanEnv(Name:PChar;var Value:PChar):cardinal; cdecl;
  3381. external 'DOSCALLS' index 227;
  3382. function DosScanEnv(const Name:string;var Value:string):cardinal;
  3383. var T:array[0..255] of char;
  3384. P:PChar;
  3385. begin
  3386. StrPCopy(@T,Name);
  3387. DosScanEnv:=DosScanEnv(@T,P);
  3388. Value:=StrPas(P);
  3389. end;
  3390. function DosSearchPath (Flag: cardinal; DirList, FileName: PChar;
  3391. FullName: PChar; FullLen: cardinal): cardinal; cdecl;
  3392. external 'DOSCALLS' index 228;
  3393. function DosSearchPath (Flag: cardinal; const DirList, FileName: string;
  3394. var FullName: string): cardinal;
  3395. var T1,T2,T3:array[0..255] of char;
  3396. begin
  3397. StrPCopy(@T1,DirList);
  3398. StrPCopy(@T2,FileName);
  3399. DosSearchPath:=DosSearchPath(Flag,@T1,@T2,@T3,SizeOf(T3));
  3400. FullName:=StrPas(@T3);
  3401. end;
  3402. function DosFSAttach (DevName, FileSystem: PChar; var Data: TAttachData;
  3403. DataLen, Flag: cardinal):cardinal; cdecl;
  3404. external 'DOSCALLS' index 269;
  3405. function DosFSAttach (const DevName, FileSystem: string; var Data: TAttachData;
  3406. DataLen, Flag: cardinal): cardinal;
  3407. var T1,T2:array[0..255] of char;
  3408. begin
  3409. StrPCopy(@T1,DevName);
  3410. StrPCopy(@T2,FileSystem);
  3411. DosFSAttach:=DosFSAttach(@T1,@T2,Data,DataLen,Flag);
  3412. end;
  3413. function DosQueryFSAttach(DevName:PChar;Ordinal,InfoLevel:longint;
  3414. var Buffer:TFSQBuffer2;var BufLen:longint):cardinal; cdecl;
  3415. external 'DOSCALLS' index 277;
  3416. function DosQueryFSAttach (DevName: PChar; Ordinal, InfoLevel: cardinal;
  3417. var Buffer: TFSQBuffer2; var BufLen: cardinal): cardinal; cdecl;
  3418. external 'DOSCALLS' index 277;
  3419. function DosQueryFSAttach(const DevName:string;Ordinal,InfoLevel:longint;
  3420. var Buffer:TFSQBuffer2;var BufLen:longint):cardinal;
  3421. var T:array[0..255] of char;
  3422. begin
  3423. StrPCopy(@T,DevName);
  3424. DosQueryFSAttach:=DosQueryFSAttach(@T,Ordinal,InfoLevel,Buffer,BufLen);
  3425. end;
  3426. function DosQueryFSAttach (const DevName: string; Ordinal, InfoLevel: cardinal;
  3427. var Buffer: TFSQBuffer2; var BufLen: cardinal): cardinal;
  3428. var T:array[0..255] of char;
  3429. begin
  3430. StrPCopy(@T,DevName);
  3431. DosQueryFSAttach:=DosQueryFSAttach(@T,Ordinal,InfoLevel,Buffer,BufLen);
  3432. end;
  3433. function DosFSCtl(Data:pointer;DataLen:longint;var ResDataLen:longint;
  3434. Parms:pointer;ParmsLen:longint;var ResParmsLen:longint;
  3435. _Function:longint;Route:PChar;
  3436. Handle,Method:longint):cardinal; cdecl;
  3437. external 'DOSCALLS' index 285;
  3438. function DosFSCtl (Data: pointer; DataLen: cardinal; var ResDataLen: cardinal;
  3439. Parms: pointer; ParmsLen: cardinal;
  3440. var ResParmsLen: cardinal; _Function: cardinal;
  3441. Route: PChar; Handle: THandle; Method: cardinal): cardinal;
  3442. cdecl;
  3443. external 'DOSCALLS' index 285;
  3444. function DosFSCtl(Data:pointer;DataLen:longint;var ResDataLen:longint;
  3445. Parms:pointer;ParmsLen:longint;var ResParmsLen:longint;
  3446. _Function:longint;const Route:string;
  3447. Handle,Method:longint):cardinal;
  3448. var T:array[0..255] of char;
  3449. begin
  3450. StrPCopy(@T,Route);
  3451. DosFSCtl:=DosFSCtl(Data,Datalen,ResDataLen,Parms,ParmsLen,ResParmsLen,
  3452. _Function,Route,Handle,Method);
  3453. end;
  3454. function DosFSCtl (Data: pointer; DataLen: cardinal; var ResDataLen: cardinal;
  3455. Parms: pointer; ParmsLen: cardinal;
  3456. var ResParmsLen: cardinal; _Function: cardinal;
  3457. const Route: string; Handle: THandle; Method: cardinal):
  3458. cardinal;
  3459. var T:array[0..255] of char;
  3460. begin
  3461. StrPCopy(@T,Route);
  3462. DosFSCtl:=DosFSCtl(Data,Datalen,ResDataLen,Parms,ParmsLen,ResParmsLen,
  3463. _Function,Route,Handle,Method);
  3464. end;
  3465. function DosQueryFSInfo (DiskNum, InfoLevel: cardinal; var Buffer: TFSInfo;
  3466. BufLen: cardinal): cardinal; cdecl;
  3467. external 'DOSCALLS' index 278;
  3468. function DosSetFSInfo (DiskNum, InfoLevel: cardinal; var Buffer: TFSInfo;
  3469. BufLen: cardinal): cardinal; cdecl;
  3470. external 'DOSCALLS' index 222;
  3471. function DosQueryVerify(var Enabled:longint):cardinal; cdecl;
  3472. external 'DOSCALLS' index 225;
  3473. function DosQueryVerify (var Enabled: cardinal): cardinal; cdecl;
  3474. external 'DOSCALLS' index 225;
  3475. function DosQueryVerify (var Enabled: boolean): cardinal; cdecl;
  3476. external 'DOSCALLS' index 225;
  3477. function DosSetVerify (Enable: boolean): cardinal; cdecl;
  3478. external 'DOSCALLS' index 210;
  3479. function DosSetVerify (Enable: cardinal): cardinal; cdecl;
  3480. external 'DOSCALLS' index 210;
  3481. function DosSetMaxFH (Count: cardinal): cardinal; cdecl;
  3482. external 'DOSCALLS' index 209;
  3483. function DosSetRelMaxFH(var ReqCount,CurMaxFH:longint):cardinal; cdecl;
  3484. external 'DOSCALLS' index 382;
  3485. function DosSetRelMaxFH (var ReqCount: longint; var CurMaxFH: cardinal):
  3486. cardinal; cdecl;
  3487. external 'DOSCALLS' index 382;
  3488. function DosShutDown (Flags: cardinal): cardinal; cdecl;
  3489. external 'DOSCALLS' index 415;
  3490. function DosQuerySysInfo (First, Last: cardinal; var Buf; BufSize: cardinal):
  3491. cardinal; cdecl;
  3492. external 'DOSCALLS' index 348;
  3493. function DosQuerySysInfo(First,Last:cardinal;Buf:PQSVValues;
  3494. BufSize:cardinal):cardinal;cdecl;
  3495. external 'DOSCALLS' index 348;
  3496. function DosPhysicalDisk (Func: cardinal; Buf: pointer; BufSize: cardinal;
  3497. Params: pointer; ParamSize: cardinal): cardinal;
  3498. cdecl;
  3499. external 'DOSCALLS' index 287;
  3500. function DosAllocMem (var P: pointer; Size, Flag: cardinal): cardinal; cdecl;
  3501. external 'DOSCALLS' index 299;
  3502. function DosFreeMem (P: pointer): cardinal; cdecl;
  3503. external 'DOSCALLS' index 304;
  3504. function DosSetMem (P: pointer; Size, Flag: cardinal): cardinal; cdecl;
  3505. external 'DOSCALLS' index 305;
  3506. function DosGiveSharedMem (P: pointer; PID, Flag: cardinal): cardinal; cdecl;
  3507. external 'DOSCALLS' index 303;
  3508. function DosGetSharedMem (P: pointer; Flag: cardinal): cardinal; cdecl;
  3509. external 'DOSCALLS' index 302;
  3510. function DosGetNamedSharedMem (var P: pointer; Name: PChar; Flag: cardinal):
  3511. cardinal; cdecl;
  3512. external 'DOSCALLS' index 301;
  3513. function DosGetNamedSharedMem (var P: pointer; const Name: string;
  3514. Flag: cardinal): cardinal;
  3515. var T:array[0..255] of char;
  3516. begin
  3517. StrPCopy(@T,Name);
  3518. DosGetNamedSharedMem:=DosGetNamedSharedMem(P,@T,Flag);
  3519. end;
  3520. function DosAllocSharedMem (var P: pointer; Name: PChar;
  3521. Size, Flag: cardinal): cardinal; cdecl;
  3522. external 'DOSCALLS' index 300;
  3523. function DosAllocSharedMem (var P: pointer; const Name: string;
  3524. Size, Flag: cardinal): cardinal;
  3525. var T:array[0..255] of char;
  3526. begin
  3527. if Name<>'' then
  3528. begin
  3529. StrPCopy(@T,Name);
  3530. DosAllocSharedMem:=DosAllocSharedMem(P,@T,Size,Flag);
  3531. end
  3532. else
  3533. DosAllocSharedMem:=DosAllocSharedMem(P,nil,Size,Flag);
  3534. end;
  3535. function DosQueryMem(P:pointer;var Size,Flag:longint):cardinal; cdecl;
  3536. external 'DOSCALLS' index 306;
  3537. function DosQueryMem (P: pointer; var Size, Flag: cardinal): cardinal; cdecl;
  3538. external 'DOSCALLS' index 306;
  3539. function DosSubAllocMem (Base: pointer; var P: pointer; Size: cardinal):
  3540. cardinal; cdecl;
  3541. external 'DOSCALLS' index 345;
  3542. function DosSubFreeMem (Base, P: pointer; Size: cardinal): cardinal; cdecl;
  3543. external 'DOSCALLS' index 346;
  3544. function DosSubSetMem (Base: pointer; Flag, Size: cardinal): cardinal; cdecl;
  3545. external 'DOSCALLS' index 344;
  3546. function DosSubUnSetMem (Base: pointer): cardinal; cdecl;
  3547. external 'DOSCALLS' index 347;
  3548. function DosCreateEventSem (Name: PChar; var Handle: THandle;
  3549. Attr, State: cardinal): cardinal; cdecl;
  3550. external 'DOSCALLS' index 324;
  3551. function DosCreateEventSem (Name: PChar; var Handle: THandle;
  3552. Attr: cardinal; State: boolean): cardinal; cdecl;
  3553. external 'DOSCALLS' index 324;
  3554. function DosCreateEventSem (const Name: string; var Handle: THandle;
  3555. Attr: cardinal; State: boolean): cardinal;
  3556. var T:array[0..255] of char;
  3557. begin
  3558. if Name<>'' then
  3559. begin
  3560. StrPCopy(@T,Name);
  3561. DosCreateEventSem:=DosCreateEventSem(@T,Handle,Attr,State);
  3562. end
  3563. else
  3564. DosCreateEventSem:=DosCreateEventSem(nil,Handle,Attr,State);
  3565. end;
  3566. function DosCreateEventSem (const Name: string; var Handle: THandle;
  3567. Attr, State: cardinal): cardinal;
  3568. begin
  3569. DosCreateEventSem:=DosCreateEventSem(Name,Handle,Attr,boolean(State));
  3570. end;
  3571. function DosOpenEventSem (Name: PChar; var Handle: THandle): cardinal; cdecl;
  3572. external 'DOSCALLS' index 325;
  3573. function DosOpenEventSem (const Name: string; var Handle: THandle): cardinal;
  3574. var T:array[0..255] of char;
  3575. begin
  3576. StrPCopy(@T,Name);
  3577. DosOpenEventSem:=DosOpenEventSem(@T,Handle);
  3578. end;
  3579. function DosCloseEventSem (Handle: THandle): cardinal; cdecl;
  3580. external 'DOSCALLS' index 326;
  3581. function DosResetEventSem(Handle:longint;var PostCount:longint):cardinal; cdecl;
  3582. external 'DOSCALLS' index 327;
  3583. function DosResetEventSem (Handle: THandle; var PostCount: cardinal): cardinal;
  3584. cdecl;
  3585. external 'DOSCALLS' index 327;
  3586. function DosPostEventSem (Handle: THandle): cardinal; cdecl;
  3587. external 'DOSCALLS' index 328;
  3588. function DosWaitEventSem (Handle: THandle; Timeout: cardinal): cardinal; cdecl;
  3589. external 'DOSCALLS' index 329;
  3590. function DosQueryEventSem(Handle:longint;var Posted:longint):cardinal; cdecl;
  3591. external 'DOSCALLS' index 330;
  3592. function DosQueryEventSem (Handle: THandle; var Posted: cardinal): cardinal;
  3593. cdecl;
  3594. external 'DOSCALLS' index 330;
  3595. function DosCreateMutExSem (Name: PChar; var Handle: THandle;
  3596. Attr: cardinal; State:boolean): cardinal; cdecl;
  3597. external 'DOSCALLS' index 331;
  3598. function DosCreateMutExSem (Name: PChar; var Handle: THandle;
  3599. Attr, State: cardinal): cardinal; cdecl;
  3600. external 'DOSCALLS' index 331;
  3601. function DosCreateMutExSem (const Name: string; var Handle: THandle;
  3602. Attr: cardinal; State: boolean): cardinal;
  3603. var T:array[0..255] of char;
  3604. begin
  3605. if Name<>'' then
  3606. begin
  3607. StrPCopy(@T,Name);
  3608. DosCreateMutExSem:=DosCreateMutExSem(@T,Handle,Attr,State);
  3609. end
  3610. else
  3611. DosCreateMutExSem:=DosCreateMutExSem(nil,Handle,Attr,State);
  3612. end;
  3613. function DosCreateMutExSem (const Name: string; var Handle: THandle;
  3614. Attr, State: cardinal): cardinal;
  3615. begin
  3616. DosCreateMutExSem:=DosCreateMutExSem(Name,Handle,Attr,boolean(State));
  3617. end;
  3618. function DosOpenMutExSem (Name: PChar; var Handle: THandle): cardinal; cdecl;
  3619. external 'DOSCALLS' index 332;
  3620. function DosOpenMutExSem (const Name: string; var Handle: THandle): cardinal;
  3621. var T:array[0..255] of char;
  3622. begin
  3623. StrPCopy(@T,Name);
  3624. DosOpenMutExSem:=DosOpenMutExSem(@T,Handle);
  3625. end;
  3626. function DosCloseMutExSem (Handle: THandle): cardinal; cdecl;
  3627. external 'DOSCALLS' index 333;
  3628. function DosRequestMutExSem (Handle: THandle; Timeout: cardinal): cardinal;
  3629. cdecl;
  3630. external 'DOSCALLS' index 334;
  3631. function DosReleaseMutExSem (Handle: THandle): cardinal; cdecl;
  3632. external 'DOSCALLS' index 335;
  3633. function DosQueryMutExSem(Handle:longint;var PID,TID,Count:longint):cardinal;
  3634. cdecl;
  3635. external 'DOSCALLS' index 336;
  3636. function DosQueryMutExSem (Handle: THandle; var PID, TID, Count: cardinal):
  3637. cardinal; cdecl;
  3638. external 'DOSCALLS' index 336;
  3639. function DosCreateMuxWaitSem (Name: PChar; var Handle: THandle;
  3640. CSemRec: cardinal; var SemArray: TSemArray;
  3641. Attr: cardinal): cardinal; cdecl;
  3642. external 'DOSCALLS' index 337;
  3643. function DosCreateMuxWaitSem (const Name: string; var Handle: THandle;
  3644. CSemRec: cardinal; var SemArray: TSemArray;
  3645. Attr: cardinal): cardinal;
  3646. var T:array[0..255] of char;
  3647. begin
  3648. if Name<>'' then
  3649. begin
  3650. StrPCopy(@T,Name);
  3651. DosCreateMuxWaitSem:=DosCreateMuxWaitSem(@T,Handle,CSemRec,
  3652. SemArray,Attr);
  3653. end
  3654. else
  3655. DosCreateMuxWaitSem:=DosCreateMuxWaitSem(nil,Handle,CSemRec,SemArray,
  3656. Attr);
  3657. end;
  3658. function DosOpenMuxWaitSem (Name: PChar; var Handle: THandle): cardinal; cdecl;
  3659. external 'DOSCALLS' index 338;
  3660. function DosOpenMuxWaitSem (const Name: string; var Handle: THandle): cardinal;
  3661. var T:array[0..255] of char;
  3662. begin
  3663. StrPCopy(@T,Name);
  3664. DosOpenMuxWaitSem:=DosOpenMuxWaitSem(@T,Handle);
  3665. end;
  3666. function DosCloseMuxWaitSem (Handle: THandle): cardinal; cdecl;
  3667. external 'DOSCALLS' index 339;
  3668. function DosWaitMuxWaitSem(Handle,Timeout:longint;var User:longint):cardinal;
  3669. cdecl;
  3670. external 'DOSCALLS' index 340;
  3671. function DosWaitMuxWaitSem (Handle: THandle; Timeout: cardinal;
  3672. var User: cardinal): cardinal; cdecl;
  3673. external 'DOSCALLS' index 340;
  3674. function DosAddMuxWaitSem (Handle: THandle; var SemRec: TSemRecord): cardinal;
  3675. cdecl;
  3676. external 'DOSCALLS' index 341;
  3677. function DosDeleteMuxWaitSem (Handle, Sem: THandle): cardinal; cdecl;
  3678. external 'DOSCALLS' index 342;
  3679. function DosQueryMuxWaitSem(Handle:longint;var CSemRec:longint;
  3680. var SemRecs:TSemArray;var Attr:longint):cardinal; cdecl;
  3681. external 'DOSCALLS' index 343;
  3682. function DosQueryMuxWaitSem (Handle: THandle; var CSemRec: cardinal;
  3683. var SemRecs: TSemArray; var Attr: cardinal): cardinal; cdecl;
  3684. external 'DOSCALLS' index 343;
  3685. function DosGetDateTime (var Buf: TDateTime): cardinal; cdecl;
  3686. external 'DOSCALLS' index 230;
  3687. function DosSetDateTime (var Buf: TDateTime): cardinal; cdecl;
  3688. external 'DOSCALLS' index 292;
  3689. function DosAsyncTimer (MSec: cardinal; HSem: THandle;
  3690. var TimHandle: THandle): cardinal; cdecl;
  3691. external 'DOSCALLS' index 350;
  3692. function DosStartTimer (MSec: cardinal; HSem: THandle;
  3693. var TimHandle: THandle): cardinal; cdecl;
  3694. external 'DOSCALLS' index 351;
  3695. function DosStopTimer (TimHandle: THandle): cardinal; cdecl;
  3696. external 'DOSCALLS' index 290;
  3697. function DosTmrQueryFreq(var Freq:longint):cardinal; cdecl;
  3698. external 'DOSCALLS' index 362;
  3699. function DosTmrQueryFreq (var Freq: cardinal): cardinal; cdecl;
  3700. external 'DOSCALLS' index 362;
  3701. function DosTmrQueryTime (var Time: comp): cardinal; cdecl;
  3702. external 'DOSCALLS' index 363;
  3703. function DosTmrQueryTime (var Time: qword): cardinal; cdecl;
  3704. external 'DOSCALLS' index 363;
  3705. function DosLoadModule (ObjName: PChar; ObjLen: cardinal; DLLName: PChar;
  3706. var Handle: THandle): cardinal; cdecl;
  3707. external 'DOSCALLS' index 318;
  3708. function DosLoadModule (var ObjName: string; ObjLen: cardinal;
  3709. const DLLName: string; var Handle: THandle): cardinal;
  3710. var T1,T2:array[0..255] of char;
  3711. begin
  3712. StrPCopy(@T2,DLLName);
  3713. DosLoadModule:=DosLoadModule(@T1,ObjLen,@T2,Handle);
  3714. ObjName:=StrPas(@T1);
  3715. end;
  3716. function DosFreeModule (Handle: THandle): cardinal; cdecl;
  3717. external 'DOSCALLS' index 322;
  3718. function DosQueryProcAddr (Handle: THandle; Ordinal: cardinal; ProcName: PChar;
  3719. var Address: pointer): cardinal; cdecl;
  3720. external 'DOSCALLS' index 321;
  3721. function DosQueryProcAddr (Handle: THandle; Ordinal: cardinal;
  3722. const ProcName: string; var Address: pointer): cardinal;
  3723. var T1:array[0..255] of char;
  3724. begin
  3725. if ProcName<>'' then
  3726. begin
  3727. StrPCopy(@T1,ProcName);
  3728. DosQueryProcAddr:=DosQueryProcAddr(Handle,Ordinal,@T1,Address);
  3729. end
  3730. else
  3731. DosQueryProcAddr:=DosQueryProcAddr(Handle,Ordinal,nil,Address);
  3732. end;
  3733. function DosQueryModuleHandle (DLLName: PChar; var Handle: THandle): cardinal;
  3734. cdecl;
  3735. external 'DOSCALLS' index 319;
  3736. function DosQueryModuleHandle (const DLLName: string; var Handle: THandle):
  3737. cardinal;
  3738. var T1:array[0..255] of char;
  3739. begin
  3740. StrPCopy(@T1,DLLName);
  3741. DosQueryModuleHandle:=DosQueryModuleHandle(@T1,Handle);
  3742. end;
  3743. function DosQueryModuleName (Handle: THandle; NameLen: cardinal; Name: PChar):
  3744. cardinal; cdecl;
  3745. external 'DOSCALLS' index 320;
  3746. {function DosQueryModuleName(Handle:longint;var Name:openstring):cardinal;
  3747. var T1:array[0..255] of char;
  3748. begin
  3749. DosQueryModuleName:=DosQueryModuleName(Handle,High(Name),@T1);
  3750. Name:=StrPas(@T1);
  3751. end;}
  3752. function DosQueryProcType(Handle,Ordinal:longint;Name:PChar;
  3753. var ProcType:longint):cardinal; cdecl;
  3754. external 'DOSCALLS' index 586;
  3755. function DosQueryProcType (Handle: THandle; Ordinal: cardinal; Name: PChar;
  3756. var ProcType: cardinal): cardinal; cdecl;
  3757. external 'DOSCALLS' index 586;
  3758. function DosQueryProcType(Handle,Ordinal:longint;const Name:string;
  3759. var ProcType:longint):cardinal;
  3760. var T1:array[0..255] of char;
  3761. begin
  3762. if Name<>'' then
  3763. begin
  3764. StrPCopy(@T1,Name);
  3765. DosQueryProcType:=DosQueryProcType(Handle,Ordinal,@T1,ProcType);
  3766. end
  3767. else
  3768. DosQueryProcType:=DosQueryProcType(Handle,Ordinal,nil,ProcType);
  3769. end;
  3770. function DosQueryProcType (Handle: THandle; Ordinal: cardinal;
  3771. const Name: string; var ProcType: cardinal): cardinal;
  3772. var T1:array[0..255] of char;
  3773. begin
  3774. if Name<>'' then
  3775. begin
  3776. StrPCopy(@T1,Name);
  3777. DosQueryProcType:=DosQueryProcType(Handle,Ordinal,@T1,ProcType);
  3778. end
  3779. else
  3780. DosQueryProcType:=DosQueryProcType(Handle,Ordinal,nil,ProcType);
  3781. end;
  3782. function DosGetResource (Handle: THandle; ResType, ResName: cardinal;
  3783. var P: pointer): cardinal; cdecl;
  3784. external 'DOSCALLS' index 352;
  3785. function DosFreeResource (P: pointer): cardinal; cdecl;
  3786. external 'DOSCALLS' index 353;
  3787. function DosQueryResourceSize(Handle,IDT,IDN:longint;var Size:longint):cardinal;
  3788. cdecl;
  3789. external 'DOSCALLS' index 572;
  3790. function DosQueryResourceSize (Handle: THandle; IDT, IDN: cardinal;
  3791. var Size: cardinal): cardinal; cdecl;
  3792. external 'DOSCALLS' index 572;
  3793. function DosQueryCtryInfo(Size:longint;var Country:TCountryCode;
  3794. var Res:TCountryInfo;var ActualSize:longint):cardinal; cdecl;
  3795. external 'NLS' index 5;
  3796. function DosQueryCtryInfo (Size: cardinal; var Country: TCountryCode;
  3797. var Res: TCountryInfo; var ActualSize: cardinal): cardinal; cdecl;
  3798. external 'NLS' index 5;
  3799. function DosQueryDBCSEnv (Size: cardinal; var Country: TCountryCode;
  3800. Buf: PChar): cardinal; cdecl;
  3801. external 'NLS' index 6;
  3802. function DosMapCase (Size: cardinal; var Country: TCountryCode;
  3803. AString: PChar): cardinal; cdecl;
  3804. external 'NLS' index 7;
  3805. function DosMapCase (var Country: TCountryCode; var AString: string): cardinal;
  3806. var T1:string;
  3807. begin
  3808. StrPCopy(@T1,AString);
  3809. DosMapCase:=DosMapCase(length(AString),Country,@T1);
  3810. AString:=StrPas(@T1);
  3811. end;
  3812. function DosQueryCollate(Size:longint;var Country:TCountryCode;
  3813. buf:PByteArray;var TableLen:longint):cardinal; cdecl;
  3814. external 'NLS' index 8;
  3815. function DosQueryCollate (Size: cardinal; var Country: TCountryCode;
  3816. Buf: PByteArray; var TableLen: cardinal): cardinal; cdecl;
  3817. external 'NLS' index 8;
  3818. function DosQueryCP(Size:longint;CodePages:PWordArray;
  3819. var ActSize:longint):cardinal; cdecl;
  3820. external 'DOSCALLS' index 291;
  3821. function DosQueryCP (Size: cardinal; CodePages: PWordArray;
  3822. var ActSize: cardinal): cardinal; cdecl;
  3823. external 'DOSCALLS' index 291;
  3824. function DosSetProcessCP (CP: cardinal): cardinal; cdecl;
  3825. external 'DOSCALLS' index 289;
  3826. function DosSetExceptionHandler (var RegRec: TExceptionRegistrationRecord):
  3827. cardinal; cdecl;
  3828. external 'DOSCALLS' index 354;
  3829. function DosUnsetExceptionHandler (var RegRec: TExceptionRegistrationRecord):
  3830. cardinal; cdecl;
  3831. external 'DOSCALLS' index 355;
  3832. function DosRaiseException (var Excpt: TExceptionReportRecord): cardinal;
  3833. cdecl;
  3834. external 'DOSCALLS' index 356;
  3835. function DosSendSignalException (PID, Exception: cardinal): cardinal; cdecl;
  3836. external 'DOSCALLS' index 379;
  3837. function DosUnwindException (var Handler: TExceptionRegistrationRecord;
  3838. TargetIP: pointer;
  3839. var RepRec: TExceptionReportRecord): cardinal; cdecl;
  3840. external 'DOSCALLS' index 357;
  3841. function DosSetSignalExceptionFocus(Enable:longint;var Times:longint):cardinal;
  3842. cdecl;
  3843. external 'DOSCALLS' index 378;
  3844. function DosSetSignalExceptionFocus (Enable: cardinal;
  3845. var Times: cardinal): cardinal; cdecl;
  3846. external 'DOSCALLS' index 378;
  3847. function DosSetSignalExceptionFocus (Enable: boolean;
  3848. var Times: cardinal): cardinal; cdecl;
  3849. external 'DOSCALLS' index 378;
  3850. function DosEnterMustComplete(var Nesting:longint):cardinal; cdecl;
  3851. external 'DOSCALLS' index 380;
  3852. function DosEnterMustComplete (var Nesting: cardinal): cardinal; cdecl;
  3853. external 'DOSCALLS' index 380;
  3854. function DosExitMustComplete(var Nesting:longint):cardinal; cdecl;
  3855. external 'DOSCALLS' index 381;
  3856. function DosExitMustComplete (var Nesting: cardinal): cardinal; cdecl;
  3857. external 'DOSCALLS' index 381;
  3858. function DosAcknowledgeSignalException (SignalNum: cardinal): cardinal; cdecl;
  3859. external 'DOSCALLS' index 418;
  3860. function DosCloseQueue (Handle: THandle): cardinal; cdecl;
  3861. external 'QUECALLS' index 11;
  3862. function DosCreateQueue (var Handle: THandle; Priority: cardinal;
  3863. Name: PChar): cardinal; cdecl;
  3864. external 'QUECALLS' index 16;
  3865. function DosCreateQueue (var Handle: THandle; Priority: cardinal;
  3866. const Name: string): cardinal;
  3867. var T1:array[0..255] of char;
  3868. begin
  3869. StrPCopy(@T1,Name);
  3870. DosCreateQueue:=DosCreateQueue(Handle,Priority,@T1);
  3871. end;
  3872. function DosOpenQueue(var Parent_PID:longint;var Handle:longint;
  3873. Name:PChar):cardinal; cdecl;
  3874. external 'QUECALLS' index 15;
  3875. function DosOpenQueue (var Parent_PID: cardinal; var Handle: THandle;
  3876. Name: PChar): cardinal; cdecl;
  3877. external 'QUECALLS' index 15;
  3878. function DosOpenQueue(var Parent_PID:longint;var Handle:longint;
  3879. const Name:string):cardinal;
  3880. var T1:array[0..255] of char;
  3881. begin
  3882. StrPCopy(@T1,Name);
  3883. DosOpenQueue:=DosOpenQueue(Parent_PID,Handle,@T1);
  3884. end;
  3885. function DosOpenQueue (var Parent_PID: cardinal; var Handle: THandle;
  3886. const Name: string): cardinal;
  3887. var T1:array[0..255] of char;
  3888. begin
  3889. StrPCopy(@T1,Name);
  3890. DosOpenQueue:=DosOpenQueue(Parent_PID,Handle,@T1);
  3891. end;
  3892. function DosPeekQueue(Handle:longint;var ReqBuffer:TRequestData;
  3893. var DataLen:longint;var DataPtr:pointer;
  3894. var Element:longint;Wait:longint;
  3895. var Priority:byte;ASem:longint):cardinal; cdecl;
  3896. external 'QUECALLS' index 13;
  3897. function DosPeekQueue (Handle: THandle; var ReqBuffer:TRequestData;
  3898. var DataLen: cardinal; var DataPtr: pointer;
  3899. var Element: cardinal; Wait: cardinal;
  3900. var Priority: byte; ASem: THandle): cardinal; cdecl;
  3901. external 'QUECALLS' index 13;
  3902. function DosPeekQueue (Handle: THandle; var ReqBuffer: TRequestData;
  3903. var DataLen: cardinal; var DataPtr: pointer;
  3904. var Element: cardinal; Wait: boolean;
  3905. var Priority: byte; ASem: THandle): cardinal; cdecl;
  3906. external 'QUECALLS' index 13;
  3907. function DosPurgeQueue (Handle: THandle): cardinal; cdecl;
  3908. external 'QUECALLS' index 10;
  3909. function DosQueryQueue(Handle:longint;var Count:longint):cardinal; cdecl;
  3910. external 'QUECALLS' index 12;
  3911. function DosQueryQueue (Handle: THandle; var Count: cardinal): cardinal; cdecl;
  3912. external 'QUECALLS' index 12;
  3913. function DosReadQueue(Handle:longint;var ReqBuffer:TRequestData;
  3914. var DataLen:longint;var DataPtr:pointer;
  3915. Element,Wait:longint;var Priority:byte;
  3916. ASem:longint):cardinal; cdecl;
  3917. external 'QUECALLS' index 9;
  3918. function DosReadQueue (Handle: THandle; var ReqBuffer: TRequestData;
  3919. var DataLen: cardinal; var DataPtr: pointer;
  3920. Element, Wait: cardinal; var Priority: byte;
  3921. ASem: THandle): cardinal; cdecl;
  3922. external 'QUECALLS' index 9;
  3923. function DosReadQueue (Handle: THandle; var ReqBuffer: TRequestData;
  3924. var DataLen: cardinal; var DataPtr: pointer;
  3925. Element: cardinal; Wait: boolean; var Priority: byte;
  3926. ASem: THandle): cardinal; cdecl;
  3927. external 'QUECALLS' index 9;
  3928. function DosWriteQueue (Handle: THandle; Request, DataLen: cardinal;
  3929. var DataBuf; Priority: cardinal): cardinal; cdecl;
  3930. external 'QUECALLS' index 14;
  3931. function DosError (Error: cardinal): cardinal; cdecl;
  3932. external 'DOSCALLS' index 212;
  3933. procedure DosErrClass(Code:longint;var _Class,Action,Locus:longint); cdecl;
  3934. external 'DOSCALLS' index 211;
  3935. procedure DosErrClass (Code: cardinal; var _Class, Action, Locus: cardinal);
  3936. cdecl;
  3937. external 'DOSCALLS' index 211;
  3938. function DosTrueGetMessage (MsgSeg: pointer; Table: PInsertTable;
  3939. TableSize: cardinal; Buf: PChar;
  3940. BufSize, MsgNumber: cardinal; FileName: PChar;
  3941. var MsgSize: cardinal): cardinal; cdecl;
  3942. external 'MSG' index 6;
  3943. function DosTrueGetMessage (MsgSeg: pointer; Table: PInsertTable;
  3944. TableSize: longint; Buf: PChar;
  3945. BufSize, MsgNumber: longint; FileName: PChar;
  3946. var MsgSize: longint): cardinal; cdecl;
  3947. external 'MSG' index 6;
  3948. function DosIQueryMessageCP (var Buf; BufSize: cardinal; FileName: PChar;
  3949. var InfoSize: cardinal; MesSeg: pointer): cardinal; cdecl;
  3950. external 'MSG' index 8;
  3951. function DosIQueryMessageCP (var Buf; BufSize: longint; FileName: PChar;
  3952. var InfoSize: longint; MesSeg: pointer): cardinal; cdecl;
  3953. external 'MSG' index 8;
  3954. procedure MagicHeaderEnd; assembler; forward;
  3955. {$ASMMODE INTEL}
  3956. {start of _MSGSEG32 segment}
  3957. procedure MagicHeaderStart; assembler;
  3958. asm
  3959. db $0FF
  3960. db $4D,$53,$47,$53,$45,$47,$33,$32, 0 //'MSGSEG32'
  3961. dd $8001
  3962. dd MAGICHEADEREND
  3963. end;
  3964. function DosGetMessage (Table: PInsertTable; TableSize: cardinal; Buf: PChar;
  3965. BufSize, MsgNumber: cardinal; FileName: PChar;
  3966. var MsgSize: cardinal): cardinal;
  3967. begin
  3968. DosGetMessage := DosTrueGetMessage(@MagicHeaderStart,Table,TableSize,
  3969. Buf,BufSize,MsgNumber,FileName,MsgSize);
  3970. end;
  3971. function DosGetMessage (Table: PInsertTable; TableSize:longint;Buf:PChar;
  3972. BufSize,MsgNumber:longint;FileName:PChar;
  3973. var MsgSize:longint):cardinal;
  3974. begin
  3975. DosGetMessage := DosTrueGetMessage(@MagicHeaderStart,Table,TableSize,
  3976. Buf,BufSize,MsgNumber,FileName,MsgSize);
  3977. end;
  3978. function DosQueryMessageCP (var Buf; BufSize: cardinal; FileName: PChar;
  3979. var InfoSize: cardinal): cardinal;
  3980. begin
  3981. DosQueryMessageCP := DosIQueryMessageCP(Buf, BufSize, FileName, InfoSize,
  3982. @MagicHeaderStart);
  3983. end;
  3984. function DosQueryMessageCP(var Buf;BufSize:longint;FileName:PChar;
  3985. var InfoSize:longint):cardinal;
  3986. begin
  3987. DosQueryMessageCP := DosIQueryMessageCP(Buf, BufSize, FileName, InfoSize,
  3988. @MagicHeaderStart);
  3989. end;
  3990. procedure MagicHeaderEnd; assembler;
  3991. asm
  3992. dd $0FFFF0000
  3993. end;
  3994. {$ASMMODE DEFAULT}
  3995. (*function DosGetMessage(const Table:array of PString;var Buf:openstring;
  3996. MsgNumber:longint;const FileName:string):cardinal;
  3997. {Hmm. This takes too much stackspace. Let's use the
  3998. heap instead.}
  3999. type TTableBuffer=record
  4000. IT:TinsertTable;
  4001. Strings:TByteArray;
  4002. end;
  4003. PTableBuffer=^TTableBuffer;
  4004. var Buffer:PTableBuffer;
  4005. I,S:word;
  4006. BufPtr:pointer;
  4007. T1,T2:array[0..255] of char;
  4008. begin
  4009. {Check if there are more than nine items in the table.}
  4010. if High(Table)>8 then
  4011. DosGetMessage:=87
  4012. else
  4013. begin
  4014. {Step 1: Calculate the space we need on the heap.}
  4015. S:=SizeOf(TInsertTable);
  4016. for I:=Low(Table) to High(Table) do
  4017. S:=S+Length(Table[I])+1;
  4018. {Step 2: Allocate the buffer.}
  4019. GetMem(Buffer,S);
  4020. {Step 3: Fill the buffer.}
  4021. BufPtr:=@(S^.Strings);
  4022. for I:=Low(Table) to High(Table) do
  4023. begin
  4024. S^.IT[I+1]:=bufptr;
  4025. StrPCopy(BufPtr,Table[I]);
  4026. Inc(longint(BufPtr),Length(Table[I])+1);
  4027. end;
  4028. {Step 4: Convert the filename.}
  4029. StrPCopy(@T2,FileName);
  4030. {Step 5: Get the message.}
  4031. DosGetMessage:=DosGetMessage(@(S^.IT),High(Table)+1,@T1,
  4032. High(Buf),MsgNumber,@T2,I);
  4033. {Step 6: Convert the returned message.}
  4034. Buf[0]:=Char(I);
  4035. Move(T1,Buf[1],I);
  4036. {Step 7: Free the memory.}
  4037. FreeMem(Buffer,S);
  4038. end;
  4039. end;*)
  4040. {function DosGetMessage(const Table:array of PString;Buf:PChar;
  4041. BufSize,MsgNumber:longint;const FileName:string;
  4042. MsgSize:longint):cardinal;}
  4043. function DosQueryMessageCP(var Buf;BufSize:longint;const FileName:string;
  4044. var InfoSize:longint):cardinal;
  4045. var T:array[0..255] of char;
  4046. begin
  4047. StrPCopy(@T,FileName);
  4048. DosQueryMessageCP:=DosQueryMessageCP(Buf,BufSize,@T,InfoSize);
  4049. end;
  4050. function DosQueryMessageCP (var Buf; BufSize: cardinal; const FileName: string;
  4051. var InfoSize: cardinal): cardinal;
  4052. var T:array[0..255] of char;
  4053. begin
  4054. StrPCopy(@T,FileName);
  4055. DosQueryMessageCP:=DosQueryMessageCP(Buf,BufSize,@T,InfoSize);
  4056. end;
  4057. function DosInsertMessage(Table:PInsertTable;TableSize:longint;
  4058. Message:PChar;SrcMessageSize:longint;
  4059. Buf:PChar;BufSize:longint;
  4060. var DstMessageSize:longint):cardinal; cdecl;
  4061. external 'MSG' index 4;
  4062. function DosInsertMessage (Table: PInsertTable; TableSize: cardinal;
  4063. Message: PChar; SrcMessageSize: cardinal;
  4064. Buf: PChar; BufSize: cardinal;
  4065. var DstMessageSize: cardinal): cardinal; cdecl;
  4066. external 'MSG' index 4;
  4067. {function DosInsertMessage(Table:array of PString;
  4068. const Message:string;
  4069. var Buf:openstring):cardinal;
  4070. function DosInsertMessage(Table:array of PString;
  4071. Message:PChar;SrcMessageSize:longint;
  4072. Buf:PChar;BufSize:longint;
  4073. var DstMessageSize:longint):cardinal;}
  4074. function DosPutMessage (Handle: THandle; Size: cardinal; Buf: PChar): cardinal;
  4075. cdecl;
  4076. external 'MSG' index 5;
  4077. function DosPutMessage (Handle: THandle; const Buf: string): cardinal;
  4078. begin
  4079. DosPutMessage:=DosPutMessage(Handle,Length(Buf),@Buf[1]);
  4080. end;
  4081. function DosStartSession (var AStartData:TStartData;
  4082. var SesID,PID:longint):cardinal; cdecl;
  4083. external 'SESMGR' index 37;
  4084. function DosStartSession (var AStartData: TStartData;
  4085. var SesID, PID: cardinal): cardinal; cdecl;
  4086. external 'SESMGR' index 37;
  4087. function DosSetSession (SesID: cardinal; var AStatus: TStatusData): cardinal;
  4088. cdecl;
  4089. external 'SESMGR' index 39;
  4090. function DosSelectSession (SesID: cardinal): cardinal; cdecl;
  4091. external 'SESMGR' index 38;
  4092. function DosStopSession (Scope, SesID: cardinal): cardinal; cdecl;
  4093. external 'SESMGR' index 40;
  4094. function DosCreatePipe (var ReadHandle, WriteHandle: THandle;
  4095. Size: cardinal): cardinal; cdecl;
  4096. external 'DOSCALLS' index 239;
  4097. function DosCreateNPipe (Name: PChar; var Handle: THandle; OpenMode, PipeMode,
  4098. OutBufSize, InBufSize, MSec: cardinal): cardinal; cdecl;
  4099. external 'DOSCALLS' index 243;
  4100. function DosCreateNPipe (const Name: string; var Handle: THandle; OpenMode,
  4101. PipeMode, OutBufSize, InBufSize, MSec: cardinal): cardinal;
  4102. var T:array[0..255] of char;
  4103. begin
  4104. StrPCopy(@T,Name);
  4105. DosCreateNPipe:=DosCreateNPipe(@T,Handle,OpenMode,PipeMode,OutBufSize,
  4106. InBufSize,MSec);
  4107. end;
  4108. function DosCallNPipe(Name:PChar;var Input;InputSize:longint;
  4109. var Output;OutputSize:longint;var ReadBytes:longint;
  4110. MSec:longint):cardinal; cdecl;
  4111. external 'DOSCALLS' index 240;
  4112. function DosCallNPipe (Name: PChar; var Input; InputSize: cardinal;
  4113. var Output; OutputSize: cardinal;
  4114. var ReadBytes: cardinal; MSec: cardinal): cardinal;
  4115. cdecl;
  4116. external 'DOSCALLS' index 240;
  4117. function DosCallNPipe(const Name:string;var Input;InputSize:longint;
  4118. var Output;OutputSize:longint;var ReadBytes:longint;
  4119. MSec:longint):cardinal;
  4120. var T:array[0..255] of char;
  4121. begin
  4122. StrPCopy(@T,Name);
  4123. DosCallNPipe:=DosCallNPipe(@T,Input,InputSize,Output,OutputSize,
  4124. ReadBytes,MSec);
  4125. end;
  4126. function DosCallNPipe (const Name: string; var Input; InputSize: cardinal;
  4127. var Output; OutputSize: cardinal;
  4128. var ReadBytes: cardinal; MSec: cardinal): cardinal;
  4129. var T:array[0..255] of char;
  4130. begin
  4131. StrPCopy(@T,Name);
  4132. DosCallNPipe:=DosCallNPipe(@T,Input,InputSize,Output,OutputSize,
  4133. ReadBytes,MSec);
  4134. end;
  4135. function DosConnectNPipe (Handle: THandle): cardinal; cdecl;
  4136. external 'DOSCALLS' index 241;
  4137. function DosDisconnectNPipe (Handle: THandle): cardinal; cdecl;
  4138. external 'DOSCALLS' index 242;
  4139. function DosPeekNPipe(Handle:longint;var Buffer;BufSize:longint;
  4140. var ReadBytes:longint;var Avail:TAvailData;
  4141. var State:longint):cardinal; cdecl;
  4142. external 'DOSCALLS' index 244;
  4143. function DosPeekNPipe (Handle: THandle; var Buffer; BufSize: cardinal;
  4144. var ReadBytes: cardinal; var Avail: TAvailData;
  4145. var State: cardinal): cardinal; cdecl;
  4146. external 'DOSCALLS' index 244;
  4147. function DosQueryNPHState(Handle:longint;var State:longint):cardinal; cdecl;
  4148. external 'DOSCALLS' index 245;
  4149. function DosQueryNPHState (Handle: THandle; var State: cardinal): cardinal;
  4150. cdecl;
  4151. external 'DOSCALLS' index 245;
  4152. function DosQueryNPipeInfo (Handle: THandle; InfoLevel: cardinal; var Buffer;
  4153. BufSize: cardinal): cardinal; cdecl;
  4154. external 'DOSCALLS' index 248;
  4155. function DosQueryNPipeSemState (SemHandle: THandle; var SemArray;
  4156. BufSize: cardinal): cardinal; cdecl;
  4157. external 'DOSCALLS' index 249;
  4158. function DosSetNPHState (Handle: THandle; State: cardinal):cardinal; cdecl;
  4159. external 'DOSCALLS' index 250;
  4160. function DosSetNPipeSem(PipeHandle,SemHandle: THandle; Key: cardinal):
  4161. cardinal; cdecl;
  4162. external 'DOSCALLS' index 251;
  4163. function DosTransactNPipe(Handle:longint;var OutBuf;OutSize:longint;
  4164. var InBuf;InSize:longint;
  4165. var ReadBytes:longint):cardinal; cdecl;
  4166. external 'DOSCALLS' index 252;
  4167. function DosTransactNPipe (Handle: THandle; var OutBuf; OutSize: cardinal;
  4168. var InBuf; InSize: cardinal;
  4169. var ReadBytes: cardinal): cardinal; cdecl;
  4170. external 'DOSCALLS' index 252;
  4171. function DosWaitNPipe (Name: PChar; MSec: cardinal): cardinal; cdecl;
  4172. external 'DOSCALLS' index 253;
  4173. function DosWaitNPipe (const Name: string; MSec: cardinal): cardinal;
  4174. var T:array[0..255] of char;
  4175. begin
  4176. StrPCopy(@T,Name);
  4177. DosWaitNPipe:=DosWaitNPipe(@T,MSec);
  4178. end;
  4179. function DosOpenVDD (Name: PChar; var Handle: THandle): cardinal; cdecl;
  4180. external 'DOSCALLS' index 308;
  4181. function DosRequestVDD (Handle: THandle; SGroup, Cmd: cardinal;
  4182. InSize: cardinal; var InBuffer;
  4183. OutSize: cardinal; var OutBuffer): cardinal; cdecl;
  4184. external 'DOSCALLS' index 309;
  4185. function DosCloseVDD (Handle: THandle): cardinal; cdecl;
  4186. external 'DOSCALLS' index 310;
  4187. procedure DosSelToFlat; cdecl;
  4188. external 'DOSCALLS' index 426;
  4189. procedure DosFlatToSel; cdecl;
  4190. external 'DOSCALLS' index 425;
  4191. {$ASMMODE INTEL}
  4192. function SelToFlat (AFarPtr: cardinal): pointer; assembler;
  4193. asm
  4194. push ebx
  4195. push esi
  4196. push edi
  4197. {$IFNDEF REGCALL}
  4198. mov eax, AFarPtr
  4199. {$ENDIF REGCALL}
  4200. call DosSelToFlat
  4201. pop edi
  4202. pop esi
  4203. pop ebx
  4204. end;
  4205. function SelToFlat (AFarPtr: TFarPtr): pointer; assembler;
  4206. asm
  4207. push ebx
  4208. push esi
  4209. push edi
  4210. mov eax, AFarPtr
  4211. call DosSelToFlat
  4212. pop edi
  4213. pop esi
  4214. pop ebx
  4215. end;
  4216. function FlatToSel (APtr: pointer): cardinal; assembler;
  4217. asm
  4218. push ebx
  4219. push esi
  4220. push edi
  4221. {$IFNDEF REGCALL}
  4222. mov eax, APtr
  4223. {$ENDIF REGCALL}
  4224. call DosFlatToSel
  4225. pop edi
  4226. pop esi
  4227. pop ebx
  4228. end;
  4229. function DosAllocThreadLocalMemory (Count: cardinal; var P: pointer): cardinal;
  4230. cdecl;
  4231. external 'DOSCALLS' index 454;
  4232. function DosFreeThreadLocalMemory (P: pointer): cardinal; cdecl;
  4233. external 'DOSCALLS' index 455;
  4234. function DosQueryRASInfo (Index: cardinal; var PBuffer: pointer): cardinal;
  4235. cdecl; external 'DOSCALLS' index 112;
  4236. function LogOpen (var Handle: cardinal): cardinal; cdecl;
  4237. external 'DOSCALLS' index 430;
  4238. function LogClose (Handle: cardinal): cardinal; cdecl;
  4239. external 'DOSCALLS' index 431;
  4240. function LogAddEntries (Handle: cardinal; Service: cardinal;
  4241. LogEntries: PLogEntryRec): cardinal; cdecl; external 'DOSCALLS' index 432;
  4242. function LogAddEntries (Handle: cardinal; Service: cardinal;
  4243. var LogEntries: TLogEntryRec): cardinal; cdecl; external 'DOSCALLS' index 432;
  4244. (* Todo:
  4245. function DosRawReadNPipe ...; cdecl;
  4246. external 'DOSCALLS' index 246;
  4247. function DosRawWriteNPipe ...; cdecl;
  4248. external 'DOSCALLS' index 247;
  4249. function DosSetCP ...; cdecl;
  4250. external 'DOSCALLS' index 288;
  4251. function DosDynamicTrace ...; cdecl;
  4252. external 'DOSCALLS' index 316;
  4253. function DosRegisterPerfCtrs ...; cdecl;
  4254. external 'DOSCALLS' index 367;
  4255. function DosQueryDOSProperty ...; cdecl;
  4256. external 'DOSCALLS' index 373;
  4257. function DosSetDOSProperty ...; cdecl;
  4258. external 'DOSCALLS' index 374;
  4259. function DosProfile ...; cdecl;
  4260. external 'DOSCALLS' index 377;
  4261. function DosReplaceModule ...; cdecl;
  4262. external 'DOSCALLS' index 417;
  4263. function DosTIB ...; cdecl;
  4264. external 'DOSCALLS' index 419;
  4265. function DosOpenChangeNotify ...; cdecl;
  4266. external 'DOSCALLS' index 440;
  4267. function DosResetChangeNotify ...; cdecl;
  4268. external 'DOSCALLS' index 441;
  4269. function DosCloseChangeNotify ...; cdecl;
  4270. external 'DOSCALLS' index 442;
  4271. function DosInitializePorthole ...; cdecl;
  4272. external 'DOSCALLS' index 580;
  4273. function DosQueryHeaderInfo ...; cdecl;
  4274. external 'DOSCALLS' index 582;
  4275. WSeB/eCS APIs:
  4276. Creates a private Read/Write alias or an LDT code segment alias to part
  4277. of an existing memory object. The alias object is accessible only to the
  4278. process that created it. The original object must be accessible to the caller
  4279. of DosAliasMem.
  4280. An alias is removed by calling DosFreeMem with the alias address.
  4281. Although it is possible to create a Read/Write alias to a code segment
  4282. to allow code modification, this is not recommended. On Pentium processors,
  4283. and later, pipe-lining techniques used by the processor might allow
  4284. the processor not to be aware of the modified code, if appropriate
  4285. pipe-line serialization is not performed by the programmer. For further
  4286. information see the processor documentation.
  4287. Possible return values:
  4288. 0 No_Error
  4289. 8 Error_Not_Enough_Memory
  4290. 87 Error_Invalid_Parameter
  4291. 95 Error_Interrupt
  4292. 32798 Error_Crosses_Object_Boundary
  4293. pMem = Pointer to the memory to be aliased. It must be on a page boundary
  4294. (i.e. aligned to 4 kB), but may specify an address within a memory
  4295. object.
  4296. Size = Specifies size in bytes for the memory to alias. The entire range
  4297. must lie within a single memory object and must be committed
  4298. if OBJ_SELMAPALL is specified.
  4299. Alias = Pointer where the address of the aliased memory is returned.
  4300. The corresponding LDT selector is not explicitly returned but may be
  4301. calculated by using the Compatibility Mapping Algorithm
  4302. ((Alias shr 13) or 7).
  4303. Flags = Combination of the following values:
  4304. obj_SelMapAll = $800 (Create a Read/Write 32 bit alias
  4305. to the address specified. The entire range
  4306. must be committed, start on page boundary
  4307. and be within the extent of a single memory
  4308. object. An LDT selector is created to map
  4309. the entire range specified. If obj_SelMapAll
  4310. is not specified, then size is rounded up
  4311. to a 4K multiple and the alias created
  4312. inherits the permissions from the pages
  4313. of the original object.)
  4314. obj_Tile = $40 (Obj_Tile may be specified, but currently
  4315. this is enforced whether or not specified.
  4316. This forces LDT selectors to be based
  4317. on 64K boundaries.)
  4318. sel_Code = 1 (Marks the LDT alias selector(s)
  4319. Read-Executable code selectors.)
  4320. sel_Use32 = 2 (Used with obj_SelMapAll, otherwise ignored.
  4321. Marks the first alias LDT selector
  4322. as a 32 bit selector by setting the BIG/C32
  4323. bit.)
  4324. functionDosAliasMem (pMem: pointer; Size: cardinal; var Alias: pointer; Flags: cardinal): cardinal; cdecl;
  4325. external 'DOSCALLS' index 298;
  4326. DosCancelLockRequestL cancels an outstanding DosSetFileLocksL request.
  4327. If two threads in a process are waiting on a lock file range, and another
  4328. thread issues DosCancelLockRequestL for that lock file range, then both
  4329. waiting threads are released.
  4330. Not all file-system drivers (FSDs) can cancel an outstanding lock request.
  4331. Local Area Network (LAN) servers cannot cancel an outstanding lock request
  4332. if they use a version of the operating system prior to OS/2 Version 2.00.
  4333. Possible return values:
  4334. 0 No_Error
  4335. 6 Error_Invalid_Handle
  4336. 87 Error_Invalid_Parameter
  4337. 173 Error_Cancel_Violation
  4338. hFile = File handle used in the DosSetFileLocksL function
  4339. that is to be cancelled.
  4340. pflLockL = Address of the structure describing the lock request to cancel.
  4341. function DosCancelLockRequestL (hFile: THandle; pflLock: PFileLockL): cardinal; cdecl;
  4342. external 'DOSCALLS' index ???;
  4343. function DosCancelLockRequestL (hFile: THandle; const Lock: TFileLockL): cardinal; cdecl;
  4344. external 'DOSCALLS' index ???;
  4345. DosCreateThread2
  4346. DosDumpProcess
  4347. DosForceSystemDump
  4348. functionDosGetProcessorStatus (...): cardinal; cdecl;
  4349. external 'DOSCALLS' index 447;
  4350. function DosQueryPageUsage (...): cardinal; cdecl;
  4351. external 'DOSCALLS' index 358;
  4352. DosSetProcessorStatus = DOSCALLS.448
  4353. DosCreateSpinLock = DOSCALLS.449
  4354. DosAcquireSpinLock = DOSCALLS.450
  4355. DosReleaseSpinLock = DOSCALLS.451
  4356. DosFreeSpinLock = DOSCALLS.452
  4357. DosListIO
  4358. DosListIOL
  4359. DosOpenL = DOSCALLS.981
  4360. DosPerfSystemCall
  4361. DosProtectOpenL
  4362. DosProtectSetFileLocksL
  4363. DosProtectSetFilePrtL
  4364. DosProtectSetFileSizeL
  4365. DosQueryABIOSSuport
  4366. functionDosQueryMemState (...): cardinal; cdecl;
  4367. external 'DOSCALLS' index 307;
  4368. ___ functionDos16QueryModFromCS (...): ...
  4369. external 'DOSCALLS' index 359;
  4370. DosQueryModFromEIP
  4371. functionDosQuerySysState (): cardinal; cdecl;
  4372. external 'DOSCALLS' index 368;
  4373. DosQueryThreadAffinity
  4374. DosSetFileLocksL
  4375. DosSetFilePtrL = DOSCALLS.988
  4376. DosSetFileSizeL = DOSCALLS.989
  4377. DosSetThreadAffinity
  4378. Dos16SysTrace
  4379. DosVerifyPidTid
  4380. *)
  4381. end.