doscalls.pas 225 KB

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