home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / vdmutils.zip / VDMUTILS.INF (.txt) < prev    next >
OS/2 Help File  |  1997-10-20  |  42KB  |  1,498 lines

  1.  
  2. ΓòÉΓòÉΓòÉ 1. Copyrights and Notices ΓòÉΓòÉΓòÉ
  3.  
  4. Various trademarks used in this document are the properties of their respective 
  5. owners. There are so many in computing these days, I cannot keep track of them 
  6. all. 
  7.  
  8.  
  9. ΓòÉΓòÉΓòÉ 1.1. OS/2 VDM Utility Subroutines ΓòÉΓòÉΓòÉ
  10.  
  11.  
  12. COPYRIGHT AND LICENSING INFORMATION 
  13.  
  14. This suite of programs and subroutines is freeware, distributed as is, without 
  15. any warranty of its usefulness for any purpose. You may use it freely. You may 
  16. also redistribute it, provided no charge is levied beyond the price of its 
  17. distribution medium. 
  18.  
  19. However, the author retains all intellectual property rights. 
  20. Copyright (C) David W. Noon, 1995, 1997 
  21.  
  22. OBTAINING TECHNICAL SUPPORT 
  23.  
  24. You can obtain technical support via Internet e-mail, Compuserve or FidoNet 
  25. Netmail. My addresses are as follows. 
  26.  
  27.  Internet:      david_noon@donor2.demon.co.uk 
  28.                 dwnoon@ibm.net 
  29.                 dnoon@acm.org 
  30.  Compuserve:    72172,431 
  31.  FidoNet:       David Noon 2:440/4 
  32.  
  33.  The FidoNet mailbox and the first listed Internet mailbox, which are the same 
  34.  place, I check almost every day. The others are checked less frequently, such 
  35.  as every third day or so. 
  36.  
  37.  Turn-around time on problems might not be spectacular, especially if I have 
  38.  other issues to handle. This is freeware and you should expect no more than 
  39.  you pay for. 
  40.  
  41.  
  42. ΓòÉΓòÉΓòÉ 1.2. ACKNOWLEDGEMENT ΓòÉΓòÉΓòÉ
  43.  
  44. This library would not have been possible without the information supplied by 
  45. George Fulk of IBM Personal Software Products in Austin, TX. George provided me 
  46. with the details of the various register conventions used to pass parameters 
  47. and receive results. Had it not been for his assistance I would still be 
  48. groping around with DEBUG.COM and reading hex. 
  49.  
  50.  
  51. ΓòÉΓòÉΓòÉ 2. The Definitive Source for the Usage of the OS/2 API ΓòÉΓòÉΓòÉ
  52.  
  53.  
  54. DISCLAIMER (Cop Out) 
  55.  
  56. This file is not it! Complete documentation of the API is beyond the scope of 
  57. this file. Read on to find out where you should really look. 
  58.  
  59.  
  60. ΓòÉΓòÉΓòÉ 2.1. The Base API Documentation ΓòÉΓòÉΓòÉ
  61.  
  62. All the API calls implemented in this library are part of the Base API of OS/2. 
  63. Some of the functions are 16-bit and others are 32-bit, even though all are to 
  64. be called by 16-bit code running in Virtual 8086 mode inside a Virtual DOS 
  65. Machine (this support is not available in a Virtual Machine Boot, or VMB, 
  66. session). As a result, you will need the OS/2 Developer's Toolkit 1.3 and the 
  67. OS/2 Developer's Toolkit 2.1 (or later). 
  68.  
  69. Both of these are supplied on the OS/2 Developer Connection CD subscription, 
  70. and are reputedly downloadble from http://www.developer.ibm.com/devcon/. 
  71.  
  72. The API calls that can be accessed via this library are documented in the 
  73. respective Control Program Reference books. The soft-copy versions have the 
  74. following definitions in my CONFIG.SYS file: 
  75.  
  76. SET PROGREF13=PRCP.INF+PRWINFN.INF+PRGPIFN.INF+PRDATA.INF+PRINTRO.INF 
  77. SET PROGREF21=CPGREF1.INF+CPGREF2.INF+CPGREF3.INF 
  78.  
  79. I strongly suggest you obtain both of these reference manuals, at least in 
  80. soft-copy form, before undertaking API-programming. Even the CD subscription is 
  81. not that expensive. 
  82.  
  83. My intention here is to provide you with the syntax to call each subroutine I 
  84. have written and to tell you in which IBM publication to look for the semantics 
  85. involved in calling it. Thus, you should not expect too much detail from this 
  86. file. 
  87.  
  88. One thing to be aware of is that the return code supplied by the DOS interrupt 
  89. is not always the same as a direct call to the API will yield under identical 
  90. circumstances. Quite often, the result in a VDM is simply: zero means it worked 
  91. and one means something went wrong. This seems particularly to be the case with 
  92. the 32-bit API calls. The older API's usually supply the same return codes as 
  93. in the OS/2 1.x documentation. 
  94.  
  95.  
  96. ΓòÉΓòÉΓòÉ 3. Supported Languages and Compilers ΓòÉΓòÉΓòÉ
  97.  
  98. The OS/2 API is language-neutral. Thus, any language that can produce object 
  99. code can use the API. However, I don't have all that many DOS compilers, so I 
  100. can only offer here advice on the ones I have used. Your mileage might vary 
  101. with other compilers. 
  102.  
  103. If you are using assembler, you can plagiarise the source code of the library 
  104. and issue the interrupts directly. I have assembled the code with MASM [6.11], 
  105. TASM and WASM. All produced excellent results. I have kept the syntax 
  106. compatible with MASM 5.x, since TASM and WASM do not fully support MASM 6.x 
  107. syntax. 
  108.  
  109.  
  110. ΓòÉΓòÉΓòÉ 3.1. C/C++ ΓòÉΓòÉΓòÉ
  111.  
  112. The code provided in this suite was prepared using Watcom C/C++ 10.6 and WASM, 
  113. the Watcom assembler. When used with this compiler the object code will be 
  114. generated in-line, giving very efficient results, since there is then no need 
  115. to call the external library. This is the compiler that has been most 
  116. thoroughly used during testing. 
  117.  
  118. I also tested the code with Borland C/C++ with Application Frameworks 3.1, or 
  119. BCAF 3.1, and its assembler, TASM. You will need to define a macro called 
  120. __DOS__ for successful compilation; I do this as part of the project 
  121. definition. This compiler has also produced satisfactory results, but has 
  122. fallen into disuse on my system. 
  123.  
  124.  
  125. ΓòÉΓòÉΓòÉ 3.2. Pascal ΓòÉΓòÉΓòÉ
  126.  
  127. I have done a very small amount of testing with IBM Pascal/2, a thinly 
  128. disguised copy of Microsoft QuickPascal. It seems to work. Users of other 
  129. Pascal compilers will notice some very idiosyncratic syntax for pointers in 
  130. this dialect of Pascal. Sorry, but I didn't write that compiler; blame 
  131. Microsoft. 
  132.  
  133. I would be interested in hearing from people who use these routines with a more 
  134. mainstream Pascal compiler, such as Borland/Turbo or TopSpeed, as I would like 
  135. to include a more widely useful set of Pascal declarations than the ones I am 
  136. using here. It would be a nice gesture if somebody using a better Pascal 
  137. compiler could supply me with same. 
  138.  
  139.  
  140. ΓòÉΓòÉΓòÉ 3.3. FORTRAN 77 ΓòÉΓòÉΓòÉ
  141.  
  142. Coming soon! 
  143.  
  144. I have not had time to give Microsoft FORTRAN 5.1 a run with this yet. I will 
  145. also give Watcom FORTRAN 77 a run when I get a copy. 
  146.  
  147.  
  148. ΓòÉΓòÉΓòÉ 3.4. DOS Extenders ΓòÉΓòÉΓòÉ
  149.  
  150. The OS/2 VDM support has a DPMI extender built in. By and large it is a very 
  151. good one. 
  152.  
  153. However, it does not map all the real (actually V86) mode DOS interrupts into 
  154. its protected mode interrupt vector. Most notably, it does not have these 
  155. interrupt functions avilable. Thus, you cannot use these functions unless your 
  156. DPMI code switches the machine back to V86 mode. 
  157.  
  158.  
  159. ΓòÉΓòÉΓòÉ 4. Naming Conventions ΓòÉΓòÉΓòÉ
  160.  
  161. Where the subroutine I have written front-ends a standard OS/2 API, I have 
  162. given it a name that is simply the API name with the Dos prefix replaced by 
  163. Dwn. In the case of those API's that only have meaning from within a VDM, and 
  164. consequently have no name in the full OS/2 context, I have assigned a name that 
  165. I feel is consonant with the "orthognoal" naming convention of OS/2. 
  166.  
  167.  
  168. ΓòÉΓòÉΓòÉ 5. The Subroutines and Functions ΓòÉΓòÉΓòÉ
  169.  
  170. All the sample syntax is in C. It should not be too difficult to interpret this 
  171. code in Pascal (or any other ALGOL 60 derived language) or FORTRAN. On the 
  172. other hand, COBOL could be a bit of a challenge. 
  173.  
  174.  
  175. ΓòÉΓòÉΓòÉ 5.1. DwnExitVDM ΓòÉΓòÉΓòÉ
  176.  
  177. This API call shuts down the VDM session. It has no use outside of a VDM. 
  178.  
  179.       Syntax 
  180.  
  181.       Parameters 
  182.  
  183.       Remarks 
  184.  
  185.  
  186. ΓòÉΓòÉΓòÉ <hidden> DwnExitVDM syntax ΓòÉΓòÉΓòÉ
  187.  
  188. int VDM_LINKAGE DwnExitVDM(void);
  189.  
  190.  
  191. rc = DwnExitVDM(); /* Shut down DOS session */
  192.  
  193.  
  194. ΓòÉΓòÉΓòÉ <hidden> DwnExitVDM parameters ΓòÉΓòÉΓòÉ
  195.  
  196. This API takes no parameters. 
  197.  
  198. It can return an integer result, but only if the call fails. This seldom 
  199. happens. 
  200.  
  201.  
  202. ΓòÉΓòÉΓòÉ <hidden> DwnExitVDM remarks ΓòÉΓòÉΓòÉ
  203.  
  204. This shuts down the address space for the VDM session. It is fatal for all 
  205. programs that might be running in that session. Ensure all resources have been 
  206. cleaned up, where necessary, before calling this API. 
  207.  
  208. This is the only one of these API's that seems to work in a VMB session. 
  209.  
  210.  
  211. ΓòÉΓòÉΓòÉ 5.2. DwnReleaseTimeSlice ΓòÉΓòÉΓòÉ
  212.  
  213. This API call releases the current timeslice from the VDM session. 
  214.  
  215.       Syntax 
  216.  
  217.       Parameters 
  218.  
  219.       Remarks 
  220.  
  221.  
  222. ΓòÉΓòÉΓòÉ <hidden> DwnReleaseTimeSlice syntax ΓòÉΓòÉΓòÉ
  223.  
  224. void VDM_LINKAGE DwnReleaseTimeSlice(void);
  225.  
  226.  
  227. DwnReleaseTimeSlice(); /* Let someone else use the CPU */
  228.  
  229.  
  230. ΓòÉΓòÉΓòÉ <hidden> DwnReleaseTimeSlice parameters ΓòÉΓòÉΓòÉ
  231.  
  232. This API takes no parameters and returns no result. 
  233.  
  234.  
  235. ΓòÉΓòÉΓòÉ <hidden> DwnReleaseTimeSlice remarks ΓòÉΓòÉΓòÉ
  236.  
  237. This makes the overall system more responsive when a DOS program has to poll a 
  238. resource. Any poll that fails to obtain the resource should release its 
  239. timeslice so that OS/2 can allow other programs to run. 
  240.  
  241. Its nearest relative in the native API is DosSleep(). Indeed, it is the code 
  242. for the DosSleep() API that provides support for this function. 
  243.  
  244. With Warp 4, there have been some problems with VDM sessions not releasing 
  245. timeslices, even though they were coded to do this. After some informal 
  246. experimentation with my system at Fixpack #1 level, I have found that INT 28H 
  247. appears to work, but the mutliplex interrupt, INT 2FH function 1680H, is still 
  248. broken. Thus, this release uses the DOS idle interrupt rather than the more 
  249. timeslice-oriented multiplex interrupt. 
  250.  
  251.  
  252. ΓòÉΓòÉΓòÉ 5.3. DwnSetSessionTitle ΓòÉΓòÉΓòÉ
  253.  
  254. This API call sets the title bar text on a windowed VDM session. It has no use 
  255. outside of a VDM, nor in a full-screen session. 
  256.  
  257.       Syntax 
  258.  
  259.       Parameters 
  260.  
  261.       Remarks 
  262.  
  263.       Related API 
  264.  
  265.  
  266. ΓòÉΓòÉΓòÉ <hidden> DwnSetSessionTitle syntax ΓòÉΓòÉΓòÉ
  267.  
  268. void VDM_LINKAGE DwnSetSessionTitle(PCSZ Session_title);
  269.  
  270.  
  271. DwnSetSessionTitle("Running a DOS program");
  272.  
  273.  
  274. ΓòÉΓòÉΓòÉ <hidden> DwnSetSessionTitle parameters ΓòÉΓòÉΓòÉ
  275.  
  276. This API takes a single ASCIIZ character string as input and returns no result. 
  277.  
  278.  const char [] (PCSZ)     Any zero-delimited ASCII string constant or variable. 
  279.                           Used for input only. 
  280.  
  281.  
  282. ΓòÉΓòÉΓòÉ <hidden> DwnSetSessionTitle remarks ΓòÉΓòÉΓòÉ
  283.  
  284. The title bar is largely of of interest for looking at the WorkPlace Shell task 
  285. list. The text you set here will appear in that list, corresponding to the 
  286. current VDM session. 
  287.  
  288. It seems that the length limit is 19 bytes, including the trailing null. 
  289. Superfluous bytes are ignored. 
  290.  
  291.  
  292. ΓòÉΓòÉΓòÉ <hidden> DwnSetSessionTitle related API calls ΓòÉΓòÉΓòÉ
  293.  
  294. The only API call related to this is: 
  295.  
  296.       DwnQuerySessionTitle 
  297.  
  298.  
  299. ΓòÉΓòÉΓòÉ 5.4. DwnQuerySessionTitle ΓòÉΓòÉΓòÉ
  300.  
  301. This API call obtains a copy of the title bar text on a windowed VDM session. 
  302. It has no use outside of a VDM, nor in a full-screen session. 
  303.  
  304.       Syntax 
  305.  
  306.       Parameters 
  307.  
  308.       Remarks 
  309.  
  310.       Related API 
  311.  
  312.  
  313. ΓòÉΓòÉΓòÉ <hidden> DwnQuerySessionTitle syntax ΓòÉΓòÉΓòÉ
  314.  
  315. void VDM_LINKAGE DwnQuerySessionTitle(PSZ Session_title);
  316.  
  317.  
  318. char Session_title[20];
  319.  
  320. DwnQuerySessionTitle(Session_title);
  321.  
  322. puts("The current VDM session has title ");
  323. puts(Session_title);
  324.  
  325.  
  326. ΓòÉΓòÉΓòÉ <hidden> DwnQuerySessionTitle parameters ΓòÉΓòÉΓòÉ
  327.  
  328. This API takes a single ASCIIZ character string variable as its output area and 
  329. returns no result. 
  330.  
  331.  char [] (PSZ)            An area to receive the title string. The minimum safe 
  332.                           size of the receiving field is 19 bytes. 
  333.  
  334.  
  335. ΓòÉΓòÉΓòÉ <hidden> DwnQuerySessionTitle remarks ΓòÉΓòÉΓòÉ
  336.  
  337. This API will retrieve whatever title the VDM session has currently. Do NOT 
  338. depend on it being what your program set earlier. Any program in the address 
  339. space can issue the interrupt, and window messages can be sent from outside the 
  340. address space to change the title. 
  341.  
  342.  
  343. ΓòÉΓòÉΓòÉ <hidden> DwnQuerySessionTitle related API calls ΓòÉΓòÉΓòÉ
  344.  
  345. The only API call related to this is: 
  346.  
  347.       DwnSetSessionTitle 
  348.  
  349.  
  350. ΓòÉΓòÉΓòÉ 5.5. DwnQFileInfo ΓòÉΓòÉΓòÉ
  351.  
  352. This API call obtains the attributes of a file for which your program currently 
  353. has an open file handle. 
  354.  
  355.       Syntax 
  356.  
  357.       Parameters 
  358.  
  359.       Remarks 
  360.  
  361.       Related API's 
  362.  
  363.  
  364. ΓòÉΓòÉΓòÉ <hidden> DwnQFileInfo syntax ΓòÉΓòÉΓòÉ
  365.  
  366. USHORT VDM_LINKAGE DwnQFileInfo(HFILE FileHandle, USHORT FileInfoLevel, PVOID FileInfoBuf, USHORT FileInfoBufSize);
  367.  
  368.  
  369. USHORT rc;
  370. HFILE Input_file;
  371. FILESTATUS Attribute_buffer;
  372.  
  373. rc = DwnQFileInfo(Input_file, FIL_STANDARD, &Attribute_buffer, sizeof(Attribute_buffer));
  374.  
  375.  
  376. ΓòÉΓòÉΓòÉ <hidden> DwnQFileInfo parameters ΓòÉΓòÉΓòÉ
  377.  
  378.  HFILE                    The file handle of an open file. It can be open for 
  379.                           read-only or for write too. 
  380.  
  381.  USHORT                   An integer that defines the level of detail required. 
  382.                           See Control Program Reference for details. 
  383.  
  384.  PVOID                    The address of a buffer area to receive the file's 
  385.                           attributes. There are pre-defined structures for 
  386.                           various levels of detail. See Control Program 
  387.                           Reference for details. 
  388.  
  389.  USHORT                   An integer that tells the API how large the buffer 
  390.                           area is. 
  391.  
  392.  
  393. ΓòÉΓòÉΓòÉ <hidden> DwnQFileInfo remarks ΓòÉΓòÉΓòÉ
  394.  
  395. This API can retrieve the base attributes of a file, or its extended attribute 
  396. structure. It appears to use the 16-bit interface of OS/2 1.x. Thus, you should 
  397. read the older Control Program Reference for the detailed documentation of this 
  398. function. 
  399.  
  400.  
  401. ΓòÉΓòÉΓòÉ <hidden> DwnQFileInfo related API calls ΓòÉΓòÉΓòÉ
  402.  
  403.       DwnQPathInfo 
  404.  
  405.       DwnSetFileInfo 
  406.  
  407.       DwnSetPathInfo 
  408.  
  409.  
  410. ΓòÉΓòÉΓòÉ 5.6. DwnSetFileInfo ΓòÉΓòÉΓòÉ
  411.  
  412. This API call modifies the attributes of a file for which your program 
  413. currently has an open file handle. 
  414.  
  415.       Syntax 
  416.  
  417.       Parameters 
  418.  
  419.       Remarks 
  420.  
  421.       Related API's 
  422.  
  423.  
  424. ΓòÉΓòÉΓòÉ <hidden> DwnSetFileInfo syntax ΓòÉΓòÉΓòÉ
  425.  
  426. USHORT VDM_LINKAGE DwnSetFileInfo(HFILE FileHandle, USHORT FileInfoLevel, PVOID FileInfoBuf, USHORT FileInfoBufSize);
  427.  
  428.  
  429. USHORT rc;
  430. HFILE Input_file;
  431. FILESTATUS Attribute_buffer;
  432.  
  433. rc = DwnSetFileInfo(Input_file, FIL_STANDARD, &Attribute_buffer, sizeof(Attribute_buffer));
  434.  
  435.  
  436. ΓòÉΓòÉΓòÉ <hidden> DwnSetFileInfo parameters ΓòÉΓòÉΓòÉ
  437.  
  438.  HFILE                    The file handle of an open file. It must be open for 
  439.                           write access. 
  440.  
  441.  USHORT                   An integer that defines the level of detail supplied. 
  442.                           See Control Program Reference for details. 
  443.  
  444.  PVOID                    The address of a buffer area to supply the file's 
  445.                           attributes. There are pre-defined structures for 
  446.                           various levels of detail. See Control Program 
  447.                           Reference for details. 
  448.  
  449.  USHORT                   An integer that tells the API how large the buffer 
  450.                           area is. 
  451.  
  452.  
  453. ΓòÉΓòÉΓòÉ <hidden> DwnSetFileInfo remarks ΓòÉΓòÉΓòÉ
  454.  
  455. This API can modify the base attributes of a file, or its extended attribute 
  456. structure. It appears to use the 16-bit interface of OS/2 1.x. Thus, you should 
  457. read the older Control Program Reference for the detailed documentation of this 
  458. function. 
  459.  
  460.  
  461. ΓòÉΓòÉΓòÉ <hidden> DwnSetFileInfo related API calls ΓòÉΓòÉΓòÉ
  462.  
  463.       DwnSetPathInfo 
  464.  
  465.       DwnQFileInfo 
  466.  
  467.       DwnQPathInfo 
  468.  
  469.  
  470. ΓòÉΓòÉΓòÉ 5.7. DwnQPathInfo ΓòÉΓòÉΓòÉ
  471.  
  472. This API call obtains the attributes of a file or directory named in its 
  473. parameter list. 
  474.  
  475.       Syntax 
  476.  
  477.       Parameters 
  478.  
  479.       Remarks 
  480.  
  481.       Related API's 
  482.  
  483.  
  484. ΓòÉΓòÉΓòÉ <hidden> DwnQPathInfo syntax ΓòÉΓòÉΓòÉ
  485.  
  486. USHORT VDM_LINKAGE DwnQPathInfo(PCSZ PathName, USHORT PathInfoLevel, PVOID PathInfoBuf, USHORT PathInfoBufSize);
  487.  
  488.  
  489. USHORT rc;
  490. const char Directory_name[] = "D:\\DATA\\SUBDIR";
  491. FILESTATUS Attribute_buffer;
  492.  
  493. rc = DwnQPathInfo(Directory_name, FIL_STANDARD, &Attribute_buffer, sizeof(Attribute_buffer));
  494.  
  495.  
  496. ΓòÉΓòÉΓòÉ <hidden> DwnQPathInfo parameters ΓòÉΓòÉΓòÉ
  497.  
  498.  PCSZ                     An ASCIIZ string constant or variable that supplies 
  499.                           the path/filename of the file or directory whose 
  500.                           attributes are to be retrieved. 
  501.  
  502.  USHORT                   An integer that defines the level of detail required. 
  503.                           See Control Program Reference for details. 
  504.  
  505.  PVOID                    The address of a buffer area to receive the file's 
  506.                           attributes. There are pre-defined structures for 
  507.                           various levels of detail. See Control Program 
  508.                           Reference for details. 
  509.  
  510.  USHORT                   An integer that tells the API how large the buffer 
  511.                           area is. 
  512.  
  513.  
  514. ΓòÉΓòÉΓòÉ <hidden> DwnQPathInfo remarks ΓòÉΓòÉΓòÉ
  515.  
  516. This API can retrieve the base attributes of a file or directory, or its 
  517. extended attribute structure. It appears to use the 16-bit interface of OS/2 
  518. 1.x. Thus, you should read the older Control Program Reference for the detailed 
  519. documentation of this function. 
  520.  
  521.  
  522. ΓòÉΓòÉΓòÉ <hidden> DwnQPathInfo related API calls ΓòÉΓòÉΓòÉ
  523.  
  524.       DwnQFileInfo 
  525.  
  526.       DwnSetFileInfo 
  527.  
  528.       DwnSetPathInfo 
  529.  
  530.  
  531. ΓòÉΓòÉΓòÉ 5.8. DwnSetPathInfo ΓòÉΓòÉΓòÉ
  532.  
  533. This API call modifies the attributes of a file or directory named in its 
  534. parameter list. 
  535.  
  536.       Syntax 
  537.  
  538.       Parameters 
  539.  
  540.       Remarks 
  541.  
  542.       Related API's 
  543.  
  544.  
  545. ΓòÉΓòÉΓòÉ <hidden> DwnSetPathInfo syntax ΓòÉΓòÉΓòÉ
  546.  
  547. USHORT VDM_LINKAGE DwnSetPathInfo(PCSZ PathName, USHORT PathInfoLevel, PVOID PathInfoBuf, USHORT PathInfoBufSize);
  548.  
  549.  
  550. USHORT rc;
  551. const char Directory_name[] = "D:\\DATA\\SUBDIR";
  552. FILESTATUS Attribute_buffer;
  553.  
  554. rc = DwnSetPathInfo(Directory_name, FIL_STANDARD, &Attribute_buffer, sizeof(Attribute_buffer));
  555.  
  556.  
  557. ΓòÉΓòÉΓòÉ <hidden> DwnSetPathInfo parameters ΓòÉΓòÉΓòÉ
  558.  
  559.  PCSZ                     An ASCIIZ string constant or variable that supplies 
  560.                           the path/filename of the file or directory whose 
  561.                           attributes are to be modified. 
  562.  
  563.  USHORT                   An integer that defines the level of detail supplied. 
  564.                           See Control Program Reference for details. 
  565.  
  566.  PVOID                    The address of a buffer area to supply the file's 
  567.                           attributes. There are pre-defined structures for 
  568.                           various levels of detail. See Control Program 
  569.                           Reference for details. 
  570.  
  571.  USHORT                   An integer that tells the API how large the buffer 
  572.                           area is. 
  573.  
  574.  
  575. ΓòÉΓòÉΓòÉ <hidden> DwnSetPathInfo remarks ΓòÉΓòÉΓòÉ
  576.  
  577. This API can modify the base attributes of a file or directory, or its extended 
  578. attribute structure. It appears to use the 16-bit interface of OS/2 1.x. Thus, 
  579. you should read the older Control Program Reference for the detailed 
  580. documentation of this function. 
  581.  
  582.  
  583. ΓòÉΓòÉΓòÉ <hidden> DwnSetPathInfo related API calls ΓòÉΓòÉΓòÉ
  584.  
  585.       DwnSetFileInfo 
  586.  
  587.       DwnQPathInfo 
  588.  
  589.       DwnQFileInfo 
  590.  
  591.  
  592. ΓòÉΓòÉΓòÉ 5.9. DwnCreateEventSem ΓòÉΓòÉΓòÉ
  593.  
  594. This API call creates an event semaphore and, optionally, posts it. 
  595.  
  596.       Syntax 
  597.  
  598.       Parameters 
  599.  
  600.       Remarks 
  601.  
  602.       Related API's 
  603.  
  604.  
  605. ΓòÉΓòÉΓòÉ <hidden> DwnCreateEventSem syntax ΓòÉΓòÉΓòÉ
  606.  
  607. USHORT VDM_LINKAGE DwnCreateEventSem(PCSZ SemName, PHEV SemHandle, USHORT Attr, BOOL State);
  608.  
  609.  
  610. USHORT rc;
  611. const char Sem_name[] = "\\SEM32\\It_happened";
  612. HEV It_happened;
  613.  
  614. rc = DwnCreateEventSem(Sem_name, &It_happened, DC_SEM_SHARED, FALSE);
  615.  
  616.  
  617. ΓòÉΓòÉΓòÉ <hidden> DwnCreateEventSem parameters ΓòÉΓòÉΓòÉ
  618.  
  619.  PCSZ                     An ASCIIZ string constant or variable that supplies 
  620.                           the name of the semaphore tp be created. All 
  621.                           semaphores created using the 32-bit API must start 
  622.                           with SEM32 as their apparent directory. 
  623.  
  624.                           If this parameter is NULL, a private semaphore is 
  625.                           created, that can be used only within the address 
  626.                           space that created it. 
  627.  
  628.  PHEV                     The address of an event semaphore handle area. This 
  629.                           will be filled by the API with the handle of the 
  630.                           semaphore created. 
  631.  
  632.  USHORT                   The attributes of the semaphore. The only non-default 
  633.                           attribute a named sempahore can have is 
  634.                           DC_SEM_SHARED. Unnamed semaphores cannot have any 
  635.                           attribute and this parameter must then be zero. 
  636.  
  637.  BOOL                     The state of the event semaphore when created. Zero 
  638.                           (FALSE) means cleared and non-zero (TRUE) means 
  639.                           posted. 
  640.  
  641.  
  642. ΓòÉΓòÉΓòÉ <hidden> DwnCreateEventSem remarks ΓòÉΓòÉΓòÉ
  643.  
  644. This API is a 32-bit function, so the newer (2.x and later) Control Program 
  645. Reference should be read for details of this function. 
  646.  
  647.  
  648. ΓòÉΓòÉΓòÉ <hidden> DwnCreateEventSem related API calls ΓòÉΓòÉΓòÉ
  649.  
  650.       DwnOpenEventSem 
  651.  
  652.       DwnWaitEventSem 
  653.  
  654.       DwnPostEventSem 
  655.  
  656.       DwnCloseEventSem 
  657.  
  658.       DwnQueryEventSem 
  659.  
  660.       DwnResetEventSem 
  661.  
  662.  
  663. ΓòÉΓòÉΓòÉ 5.10. DwnOpenEventSem ΓòÉΓòÉΓòÉ
  664.  
  665. This API call opens an already created event semaphore. 
  666.  
  667.       Syntax 
  668.  
  669.       Parameters 
  670.  
  671.       Remarks 
  672.  
  673.       Related API's 
  674.  
  675.  
  676. ΓòÉΓòÉΓòÉ <hidden> DwnOpenEventSem syntax ΓòÉΓòÉΓòÉ
  677.  
  678. USHORT VDM_LINKAGE DwnOpenEventSem(PCSZ SemName, PHEV SemHandle);
  679.  
  680.  
  681. USHORT rc;
  682. const char Sem_name[] = "\\SEM32\\It_happened";
  683. HEV It_happened;
  684.  
  685. rc = DwnOpenEventSem(Sem_name, &It_happened);
  686.  
  687.  
  688. ΓòÉΓòÉΓòÉ <hidden> DwnOpenEventSem parameters ΓòÉΓòÉΓòÉ
  689.  
  690.  PCSZ                     An ASCIIZ string constant or variable that supplies 
  691.                           the name of the semaphore tp be opened. All 
  692.                           semaphores created using the 32-bit API must start 
  693.                           with SEM32 as their apparent directory. 
  694.  
  695.  PHEV                     The address of an event semaphore handle area. This 
  696.                           will be filled by the API with the handle of the 
  697.                           semaphore opened. 
  698.  
  699.  
  700. ΓòÉΓòÉΓòÉ <hidden> DwnOpenEventSem remarks ΓòÉΓòÉΓòÉ
  701.  
  702. This API is a 32-bit function, so the newer (2.x and later) Control Program 
  703. Reference should be read for details of this function. 
  704.  
  705.  
  706. ΓòÉΓòÉΓòÉ <hidden> DwnOpenEventSem related API calls ΓòÉΓòÉΓòÉ
  707.  
  708.       DwnCreateEventSem 
  709.  
  710.       DwnWaitEventSem 
  711.  
  712.       DwnPostEventSem 
  713.  
  714.       DwnCloseEventSem 
  715.  
  716.       DwnQueryEventSem 
  717.  
  718.       DwnResetEventSem 
  719.  
  720.  
  721. ΓòÉΓòÉΓòÉ 5.11. DwnWaitEventSem ΓòÉΓòÉΓòÉ
  722.  
  723. This API call suspends execution of the current thread until the event 
  724. semaphore has been posted. 
  725.  
  726.       Syntax 
  727.  
  728.       Parameters 
  729.  
  730.       Remarks 
  731.  
  732.       Related API's 
  733.  
  734.  
  735. ΓòÉΓòÉΓòÉ <hidden> DwnWaitEventSem syntax ΓòÉΓòÉΓòÉ
  736.  
  737. USHORT VDM_LINKAGE DwnWaitEventSem(HEV SemHandle, long Timeout);
  738.  
  739.  
  740. USHORT rc;
  741. HEV It_happened;
  742.  
  743. rc = DwnWaitEventSem(It_happened, SEM_INDEFINITE_WAIT);
  744.  
  745.  
  746. ΓòÉΓòÉΓòÉ <hidden> DwnWaitEventSem parameters ΓòÉΓòÉΓòÉ
  747.  
  748.  HEV                      The event semaphore handle. 
  749.  
  750.  long                     The maximum time, in millseconds, the thread should 
  751.                           be suspended. 
  752.  
  753.  
  754. ΓòÉΓòÉΓòÉ <hidden> DwnWaitEventSem remarks ΓòÉΓòÉΓòÉ
  755.  
  756. This API call suspends execution of the current thread until the event 
  757. semaphore has been posted or the time-out value has elapsed. If it has already 
  758. been posted, the post count is decremented and control returns immediately. 
  759.  
  760. This API is a 32-bit function, so the newer (2.x and later) Control Program 
  761. Reference should be read for details of this function. 
  762.  
  763.  
  764. ΓòÉΓòÉΓòÉ <hidden> DwnWaitEventSem related API calls ΓòÉΓòÉΓòÉ
  765.  
  766.       DwnCreateEventSem 
  767.  
  768.       DwnOpenEventSem 
  769.  
  770.       DwnPostEventSem 
  771.  
  772.       DwnCloseEventSem 
  773.  
  774.       DwnQueryEventSem 
  775.  
  776.       DwnResetEventSem 
  777.  
  778.  
  779. ΓòÉΓòÉΓòÉ 5.12. DwnPostEventSem ΓòÉΓòÉΓòÉ
  780.  
  781. This API call allows execution of the any thread waiting on the event semaphore 
  782. to be resumed. 
  783.  
  784.       Syntax 
  785.  
  786.       Parameters 
  787.  
  788.       Remarks 
  789.  
  790.       Related API's 
  791.  
  792.  
  793. ΓòÉΓòÉΓòÉ <hidden> DwnPostEventSem syntax ΓòÉΓòÉΓòÉ
  794.  
  795. USHORT VDM_LINKAGE DwnPostEventSem(HEV SemHandle);
  796.  
  797.  
  798. USHORT rc;
  799. HEV It_happened;
  800.  
  801. rc = DwnPostEventSem(It_happened);
  802.  
  803.  
  804. ΓòÉΓòÉΓòÉ <hidden> DwnPostEventSem parameters ΓòÉΓòÉΓòÉ
  805.  
  806.  HEV                      The event semaphore handle. 
  807.  
  808.  
  809. ΓòÉΓòÉΓòÉ <hidden> DwnPostEventSem remarks ΓòÉΓòÉΓòÉ
  810.  
  811. This API call allows execution of the any thread waiting on the event semaphore 
  812. to be resumed. If no thread is waiting, the semaphore's post count is 
  813. incremented. 
  814.  
  815. This API is a 32-bit function, so the newer (2.x and later) Control Program 
  816. Reference should be read for details of this function. 
  817.  
  818.  
  819. ΓòÉΓòÉΓòÉ <hidden> DwnPostEventSem related API calls ΓòÉΓòÉΓòÉ
  820.  
  821.       DwnCreateEventSem 
  822.  
  823.       DwnOpenEventSem 
  824.  
  825.       DwnWaitEventSem 
  826.  
  827.       DwnCloseEventSem 
  828.  
  829.       DwnQueryEventSem 
  830.  
  831.       DwnResetEventSem 
  832.  
  833.  
  834. ΓòÉΓòÉΓòÉ 5.13. DwnCloseEventSem ΓòÉΓòÉΓòÉ
  835.  
  836. This API call closes the current thread's handle on the semaphore. 
  837.  
  838.       Syntax 
  839.  
  840.       Parameters 
  841.  
  842.       Remarks 
  843.  
  844.       Related API's 
  845.  
  846.  
  847. ΓòÉΓòÉΓòÉ <hidden> DwnCloseEventSem syntax ΓòÉΓòÉΓòÉ
  848.  
  849. USHORT VDM_LINKAGE DwnCloseEventSem(HEV SemHandle);
  850.  
  851.  
  852. USHORT rc;
  853. HEV It_happened;
  854.  
  855. rc = DwnCloseEventSem(It_happened);
  856.  
  857.  
  858. ΓòÉΓòÉΓòÉ <hidden> DwnCloseEventSem parameters ΓòÉΓòÉΓòÉ
  859.  
  860.  HEV                      The event semaphore handle. 
  861.  
  862.  
  863. ΓòÉΓòÉΓòÉ <hidden> DwnCloseEventSem remarks ΓòÉΓòÉΓòÉ
  864.  
  865. This API call closes the current thread's handle on the semaphore. If it is the 
  866. last handle on that semaphore, the semaphore is deleted. 
  867.  
  868. This API is a 32-bit function, so the newer (2.x and later) Control Program 
  869. Reference should be read for details of this function. 
  870.  
  871.  
  872. ΓòÉΓòÉΓòÉ <hidden> DwnCloseEventSem related API calls ΓòÉΓòÉΓòÉ
  873.  
  874.       DwnCreateEventSem 
  875.  
  876.       DwnOpenEventSem 
  877.  
  878.       DwnWaitEventSem 
  879.  
  880.       DwnPostEventSem 
  881.  
  882.       DwnQueryEventSem 
  883.  
  884.       DwnResetEventSem 
  885.  
  886.  
  887. ΓòÉΓòÉΓòÉ 5.14. DwnQueryEventSem ΓòÉΓòÉΓòÉ
  888.  
  889. This API retrieves the count of posts that have not been waited on yet for the 
  890. event semaphore. 
  891.  
  892.       Syntax 
  893.  
  894.       Parameters 
  895.  
  896.       Remarks 
  897.  
  898.       Related API's 
  899.  
  900.  
  901. ΓòÉΓòÉΓòÉ <hidden> DwnQueryEventSem syntax ΓòÉΓòÉΓòÉ
  902.  
  903. USHORT VDM_LINKAGE DwnQueryEventSem(HEV SemHandle, PULONG PostCount);
  904.  
  905.  
  906. USHORT rc;
  907. HEV It_happened;
  908. ULONG Times_posted;
  909.  
  910. rc = DwnQueryEventSem(It_happened, &Times_posted);
  911.  
  912.  
  913. ΓòÉΓòÉΓòÉ <hidden> DwnQueryEventSem parameters ΓòÉΓòÉΓòÉ
  914.  
  915.  HEV                      The event semaphore handle. 
  916.  
  917.  PULONG                   The address of an unsigned long integer that will 
  918.                           receive the count. 
  919.  
  920.  
  921. ΓòÉΓòÉΓòÉ <hidden> DwnQueryEventSem remarks ΓòÉΓòÉΓòÉ
  922.  
  923. This API is a 32-bit function, so the newer (2.x and later) Control Program 
  924. Reference should be read for details of this function. 
  925.  
  926.  
  927. ΓòÉΓòÉΓòÉ <hidden> DwnQueryEventSem related API calls ΓòÉΓòÉΓòÉ
  928.  
  929.       DwnCreateEventSem 
  930.  
  931.       DwnOpenEventSem 
  932.  
  933.       DwnWaitEventSem 
  934.  
  935.       DwnPostEventSem 
  936.  
  937.       DwnCloseEventSem 
  938.  
  939.       DwnResetEventSem 
  940.  
  941.  
  942. ΓòÉΓòÉΓòÉ 5.15. DwnResetEventSem ΓòÉΓòÉΓòÉ
  943.  
  944. This API retrieves the count of posts that have not been waited on yet for the 
  945. event semaphore and sets that count to zero. 
  946.  
  947.       Syntax 
  948.  
  949.       Parameters 
  950.  
  951.       Remarks 
  952.  
  953.       Related API's 
  954.  
  955.  
  956. ΓòÉΓòÉΓòÉ <hidden> DwnResetEventSem syntax ΓòÉΓòÉΓòÉ
  957.  
  958. USHORT VDM_LINKAGE DwnResetEventSem(HEV SemHandle, PULONG PostCount);
  959.  
  960.  
  961. USHORT rc;
  962. HEV It_happened;
  963. ULONG Times_posted;
  964.  
  965. Times_posted = 0UL;
  966. rc = DwnResetEventSem(It_happened, &Times_posted);
  967.  
  968.  
  969. ΓòÉΓòÉΓòÉ <hidden> DwnResetEventSem parameters ΓòÉΓòÉΓòÉ
  970.  
  971.  HEV                      The event semaphore handle. 
  972.  
  973.  PULONG                   The address of an unsigned long integer that will 
  974.                           receive the count. 
  975.  
  976.  
  977. ΓòÉΓòÉΓòÉ <hidden> DwnResetEventSem remarks ΓòÉΓòÉΓòÉ
  978.  
  979. This API retrieves the count of posts that have not been waited on yet for the 
  980. event semaphore. It also sets that count to zero within the semaphore, thus 
  981. causing all threads that call DosWaitEventSem() to be blocked until another 
  982. call to DosPostEventSem() on that semaphore. 
  983.  
  984. This API is a 32-bit function, so the newer (2.x and later) Control Program 
  985. Reference should be read for details of this function. 
  986.  
  987.  
  988. ΓòÉΓòÉΓòÉ <hidden> DwnResetEventSem related API calls ΓòÉΓòÉΓòÉ
  989.  
  990.       DwnCreateEventSem 
  991.  
  992.       DwnOpenEventSem 
  993.  
  994.       DwnWaitEventSem 
  995.  
  996.       DwnPostEventSem 
  997.  
  998.       DwnCloseEventSem 
  999.  
  1000.       DwnQueryEventSem 
  1001.  
  1002.  
  1003. ΓòÉΓòÉΓòÉ 5.16. DwnCreateMutexSem ΓòÉΓòÉΓòÉ
  1004.  
  1005. This API call creates a mutual exclusion (mutex) semaphore and, optionally, 
  1006. acquires control of it. 
  1007.  
  1008.       Syntax 
  1009.  
  1010.       Parameters 
  1011.  
  1012.       Remarks 
  1013.  
  1014.       Related API's 
  1015.  
  1016.  
  1017. ΓòÉΓòÉΓòÉ <hidden> DwnCreateMutexSem syntax ΓòÉΓòÉΓòÉ
  1018.  
  1019. USHORT VDM_LINKAGE DwnCreateMutexSem(PCSZ SemName, PHMTX SemHandle, USHORT Attr, BOOL State);
  1020.  
  1021.  
  1022. USHORT rc;
  1023. const char Sem_name[] = "\\SEM32\\My_resource";
  1024. HMTX My_resource;
  1025.  
  1026. rc = DwnCreateMutexSem(Sem_name, &My_resource, DC_SEM_SHARED, TRUE);
  1027.  
  1028.  
  1029. ΓòÉΓòÉΓòÉ <hidden> DwnCreateMutexSem parameters ΓòÉΓòÉΓòÉ
  1030.  
  1031.  PCSZ                     An ASCIIZ string constant or variable that supplies 
  1032.                           the name of the semaphore tp be created. All 
  1033.                           semaphores created using the 32-bit API must start 
  1034.                           with SEM32 as their apparent directory. 
  1035.  
  1036.                           If this parameter is NULL, a private semaphore is 
  1037.                           created, that can be used only within the address 
  1038.                           space that created it. 
  1039.  
  1040.  PHMTX                    The address of a mutex semaphore handle area. This 
  1041.                           will be filled by the API with the handle of the 
  1042.                           semaphore created. 
  1043.  
  1044.  USHORT                   The attributes of the semaphore. The only non-default 
  1045.                           attribute a named sempahore can have is 
  1046.                           DC_SEM_SHARED. Unnamed semaphores cannot have any 
  1047.                           attribute and this parameter must then be zero. 
  1048.  
  1049.  BOOL                     The state of the mutex semaphore when created. Zero 
  1050.                           (FALSE) means available for other trheads to request 
  1051.                           and non-zero (TRUE) means controlled by the creating 
  1052.                           thread. 
  1053.  
  1054.  
  1055. ΓòÉΓòÉΓòÉ <hidden> DwnCreateMutexSem remarks ΓòÉΓòÉΓòÉ
  1056.  
  1057. This API is a 32-bit function, so the newer (2.x and later) Control Program 
  1058. Reference should be read for details of this function. 
  1059.  
  1060.  
  1061. ΓòÉΓòÉΓòÉ <hidden> DwnCreateMutexSem related API calls ΓòÉΓòÉΓòÉ
  1062.  
  1063.       DwnOpenMutexSem 
  1064.  
  1065.       DwnRequestMutexSem 
  1066.  
  1067.       DwnReleaseMutexSem 
  1068.  
  1069.       DwnCloseMutexSem 
  1070.  
  1071.       DwnQueryMutexSem 
  1072.  
  1073.  
  1074. ΓòÉΓòÉΓòÉ 5.17. DwnOpenMutexSem ΓòÉΓòÉΓòÉ
  1075.  
  1076. This API call opens an already created mutex semaphore. 
  1077.  
  1078.       Syntax 
  1079.  
  1080.       Parameters 
  1081.  
  1082.       Remarks 
  1083.  
  1084.       Related API's 
  1085.  
  1086.  
  1087. ΓòÉΓòÉΓòÉ <hidden> DwnOpenMutexSem syntax ΓòÉΓòÉΓòÉ
  1088.  
  1089. USHORT VDM_LINKAGE DwnOpenMutexSem(PCSZ SemName, PHMTX SemHandle);
  1090.  
  1091.  
  1092. USHORT rc;
  1093. const char Sem_name[] = "\\SEM32\\My_resource";
  1094. HMTX My_resource;
  1095.  
  1096. rc = DwnOpenMutexSem(Sem_name, &My_resource);
  1097.  
  1098.  
  1099. ΓòÉΓòÉΓòÉ <hidden> DwnOpenMutexSem parameters ΓòÉΓòÉΓòÉ
  1100.  
  1101.  PCSZ                     An ASCIIZ string constant or variable that supplies 
  1102.                           the name of the semaphore tp be opened. All 
  1103.                           semaphores created using the 32-bit API must start 
  1104.                           with SEM32 as their apparent directory. 
  1105.  
  1106.  PHMTX                    The address of a mutex semaphore handle area. This 
  1107.                           will be filled by the API with the handle of the 
  1108.                           semaphore opened. 
  1109.  
  1110.  
  1111. ΓòÉΓòÉΓòÉ <hidden> DwnOpenMutexSem remarks ΓòÉΓòÉΓòÉ
  1112.  
  1113. This API is a 32-bit function, so the newer (2.x and later) Control Program 
  1114. Reference should be read for details of this function. 
  1115.  
  1116.  
  1117. ΓòÉΓòÉΓòÉ <hidden> DwnOpenMutexSem related API calls ΓòÉΓòÉΓòÉ
  1118.  
  1119.       DwnCreateMutexSem 
  1120.  
  1121.       DwnRequestMutexSem 
  1122.  
  1123.       DwnReleaseMutexSem 
  1124.  
  1125.       DwnCloseMutexSem 
  1126.  
  1127.       DwnQueryMutexSem 
  1128.  
  1129.  
  1130. ΓòÉΓòÉΓòÉ 5.18. DwnRequestMutexSem ΓòÉΓòÉΓòÉ
  1131.  
  1132. This API call suspends execution of the current thread until the mutex 
  1133. semaphore has been acquired. 
  1134.  
  1135.       Syntax 
  1136.  
  1137.       Parameters 
  1138.  
  1139.       Remarks 
  1140.  
  1141.       Related API's 
  1142.  
  1143.  
  1144. ΓòÉΓòÉΓòÉ <hidden> DwnRequestMutexSem syntax ΓòÉΓòÉΓòÉ
  1145.  
  1146. USHORT VDM_LINKAGE DwnRequestMutexSem(HMTX SemHandle, long Timeout);
  1147.  
  1148.  
  1149. USHORT rc;
  1150. HMTX My_resource;
  1151.  
  1152. rc = DwnRequestMutexSem(My_resource, SEM_INDEFINITE_WAIT);
  1153.  
  1154.  
  1155. ΓòÉΓòÉΓòÉ <hidden> DwnRequestMutexSem parameters ΓòÉΓòÉΓòÉ
  1156.  
  1157.  HMTX                     The mutex semaphore handle. 
  1158.  
  1159.  long                     The maximum time, in millseconds, the thread should 
  1160.                           be suspended. 
  1161.  
  1162.  
  1163. ΓòÉΓòÉΓòÉ <hidden> DwnRequestMutexSem remarks ΓòÉΓòÉΓòÉ
  1164.  
  1165. This API call suspends execution of the current thread until the mutex 
  1166. semaphore has been acquired or the time-out value has elapsed. If it is already 
  1167. avaliable control returns immediately. 
  1168.  
  1169. This API is a 32-bit function, so the newer (2.x and later) Control Program 
  1170. Reference should be read for details of this function. 
  1171.  
  1172.  
  1173. ΓòÉΓòÉΓòÉ <hidden> DwnRequestMutexSem related API calls ΓòÉΓòÉΓòÉ
  1174.  
  1175.       DwnCreateMutexSem 
  1176.  
  1177.       DwnOpenMutexSem 
  1178.  
  1179.       DwnReleaseMutexSem 
  1180.  
  1181.       DwnCloseMutexSem 
  1182.  
  1183.       DwnQueryMutexSem 
  1184.  
  1185.  
  1186. ΓòÉΓòÉΓòÉ 5.19. DwnReleaseMutexSem ΓòÉΓòÉΓòÉ
  1187.  
  1188. This API call allows execution of the any thread waiting on the mutex semaphore 
  1189. to be resumed. 
  1190.  
  1191.       Syntax 
  1192.  
  1193.       Parameters 
  1194.  
  1195.       Remarks 
  1196.  
  1197.       Related API's 
  1198.  
  1199.  
  1200. ΓòÉΓòÉΓòÉ <hidden> DwnReleaseMutexSem syntax ΓòÉΓòÉΓòÉ
  1201.  
  1202. USHORT VDM_LINKAGE DwnReleaseMutexSem(HMTX SemHandle);
  1203.  
  1204.  
  1205. USHORT rc;
  1206. HMTX My_resource;
  1207.  
  1208. rc = DwnReleaseMutexSem(My_resource);
  1209.  
  1210.  
  1211. ΓòÉΓòÉΓòÉ <hidden> DwnReleaseMutexSem parameters ΓòÉΓòÉΓòÉ
  1212.  
  1213.  HMTX                     The mutex semaphore handle. 
  1214.  
  1215.  
  1216. ΓòÉΓòÉΓòÉ <hidden> DwnReleaseMutexSem remarks ΓòÉΓòÉΓòÉ
  1217.  
  1218. This API call allows execution of the any thread waiting on the mutex semaphore 
  1219. to be resumed. It can only be issued by the thread that currently owns the 
  1220. mutex semaphore. 
  1221.  
  1222. This API is a 32-bit function, so the newer (2.x and later) Control Program 
  1223. Reference should be read for details of this function. 
  1224.  
  1225.  
  1226. ΓòÉΓòÉΓòÉ <hidden> DwnReleaseMutexSem related API calls ΓòÉΓòÉΓòÉ
  1227.  
  1228.       DwnCreateMutexSem 
  1229.  
  1230.       DwnOpenMutexSem 
  1231.  
  1232.       DwnRequestMutexSem 
  1233.  
  1234.       DwnCloseMutexSem 
  1235.  
  1236.       DwnQueryMutexSem 
  1237.  
  1238.  
  1239. ΓòÉΓòÉΓòÉ 5.20. DwnCloseMutexSem ΓòÉΓòÉΓòÉ
  1240.  
  1241. This API call closes the current thread's handle on the semaphore. 
  1242.  
  1243.       Syntax 
  1244.  
  1245.       Parameters 
  1246.  
  1247.       Remarks 
  1248.  
  1249.       Related API's 
  1250.  
  1251.  
  1252. ΓòÉΓòÉΓòÉ <hidden> DwnCloseMutexSem syntax ΓòÉΓòÉΓòÉ
  1253.  
  1254. USHORT VDM_LINKAGE DwnCloseMutexSem(HMTX SemHandle);
  1255.  
  1256.  
  1257. USHORT rc;
  1258. HMTX My_resource;
  1259.  
  1260. rc = DwnCloseMutexSem(My_resource);
  1261.  
  1262.  
  1263. ΓòÉΓòÉΓòÉ <hidden> DwnCloseMutexSem parameters ΓòÉΓòÉΓòÉ
  1264.  
  1265.  HMTX                     The mutex semaphore handle. 
  1266.  
  1267.  
  1268. ΓòÉΓòÉΓòÉ <hidden> DwnCloseMutexSem remarks ΓòÉΓòÉΓòÉ
  1269.  
  1270. This API call closes the current thread's handle on the semaphore. If it is the 
  1271. last handle on that semaphore, the semaphore is deleted. 
  1272.  
  1273. This API is a 32-bit function, so the newer (2.x and later) Control Program 
  1274. Reference should be read for details of this function. 
  1275.  
  1276.  
  1277. ΓòÉΓòÉΓòÉ <hidden> DwnCloseMutexSem related API calls ΓòÉΓòÉΓòÉ
  1278.  
  1279.       DwnCreateMutexSem 
  1280.  
  1281.       DwnOpenMutexSem 
  1282.  
  1283.       DwnRequestMutexSem 
  1284.  
  1285.       DwnReleaseMutexSem 
  1286.  
  1287.       DwnQueryMutexSem 
  1288.  
  1289.  
  1290. ΓòÉΓòÉΓòÉ 5.21. DwnQueryMutexSem ΓòÉΓòÉΓòÉ
  1291.  
  1292. This API retrieves the count of posts that have not been waited on yet for the 
  1293. mutex semaphore. 
  1294.  
  1295.       Syntax 
  1296.  
  1297.       Parameters 
  1298.  
  1299.       Remarks 
  1300.  
  1301.       Related API's 
  1302.  
  1303.  
  1304. ΓòÉΓòÉΓòÉ <hidden> DwnQueryMutexSem syntax ΓòÉΓòÉΓòÉ
  1305.  
  1306. USHORT VDM_LINKAGE DwnQueryMutexSem(HMTX SemHandle, PPID OwnerProcess, PTID OwnerThread, PULONG RequestCount);
  1307.  
  1308.  
  1309. USHORT rc;
  1310. HMTX My_resource;
  1311. PID Owner_process;
  1312. TID Owner_thread;
  1313. ULONG Waiting_threads;
  1314.  
  1315. rc = DwnQueryMutexSem(My_resource, &Owner_process, &Owner_thread, &Waiting_threads);
  1316.  
  1317.  
  1318. ΓòÉΓòÉΓòÉ <hidden> DwnQueryMutexSem parameters ΓòÉΓòÉΓòÉ
  1319.  
  1320.  HMTX                     The mutex semaphore handle. 
  1321.  
  1322.  PPID                     The address of a PID that will receive the process 
  1323.                           id. of the owning process. 
  1324.  
  1325.  PTID                     The address of a TID that will receive the thread id. 
  1326.                           of the owning thread. 
  1327.  
  1328.  PULONG                   The address of an unsigned long integer that will 
  1329.                           receive the count of waiting threads. 
  1330.  
  1331.  
  1332. ΓòÉΓòÉΓòÉ <hidden> DwnQueryMutexSem remarks ΓòÉΓòÉΓòÉ
  1333.  
  1334. This API does not work in a VDM session. Do not use it. 
  1335.  
  1336. This API is a 32-bit function, so the newer (2.x and later) Control Program 
  1337. Reference should be read for details of this function. 
  1338.  
  1339.  
  1340. ΓòÉΓòÉΓòÉ <hidden> DwnQueryMutexSem related API calls ΓòÉΓòÉΓòÉ
  1341.  
  1342.       DwnCreateMutexSem 
  1343.  
  1344.       DwnOpenMutexSem 
  1345.  
  1346.       DwnRequestMutexSem 
  1347.  
  1348.       DwnReleaseMutexSem 
  1349.  
  1350.       DwnCloseMutexSem 
  1351.  
  1352.  
  1353. ΓòÉΓòÉΓòÉ 5.22. DwnStartSession ΓòÉΓòÉΓòÉ
  1354.  
  1355. This API call starts another address space. 
  1356.  
  1357.       Syntax 
  1358.  
  1359.       Parameters 
  1360.  
  1361.       Remarks 
  1362.  
  1363.  
  1364. ΓòÉΓòÉΓòÉ <hidden> DwnStartSession syntax ΓòÉΓòÉΓòÉ
  1365.  
  1366. USHORT VDM_LINKAGE DwnStartSession(PSTARTDATA StartData);
  1367.  
  1368.  
  1369. USHORT rc;
  1370. STARTDATA Session_info;
  1371.  
  1372. memset(&Session_info,0x00,sizeof(STARTDATA));
  1373. Session_info.Length = sizeof(STARTDATA);
  1374. Session_info.FgBg = SSF_FGBG_BACK;
  1375. Session_info.PgmTitle = "CMD.EXE";
  1376. Session_info.PgmInputs = "/C BLOBBO.CMD INFILE.DAT";
  1377. Session_info.SessionType = SSF_TYPE_WINDOWABLEVIO;
  1378. rc = DwnStartSession(&Session_info);
  1379.  
  1380.  
  1381. ΓòÉΓòÉΓòÉ <hidden> DwnStartSession parameters ΓòÉΓòÉΓòÉ
  1382.  
  1383.  PSTARTDATA               The address of a STARTDATA structure describing the 
  1384.                           session to be started. 
  1385.  
  1386.  
  1387. ΓòÉΓòÉΓòÉ <hidden> DwnStartSession remarks ΓòÉΓòÉΓòÉ
  1388.  
  1389. This API is a 32-bit function, so the newer (2.x and later) Control Program 
  1390. Reference should be read for details of this function. 
  1391.  
  1392.  
  1393. ΓòÉΓòÉΓòÉ 6. Data Structures ΓòÉΓòÉΓòÉ
  1394.  
  1395. The following data structures are used in this documentations. Please refer to 
  1396. the formal IBM documentation for others, particularly regarding extended 
  1397. attribute handling. 
  1398.  
  1399.  
  1400. ΓòÉΓòÉΓòÉ 6.1. FDATE ΓòÉΓòÉΓòÉ
  1401.  
  1402. typedef struct _FDATE {    /* fdate */
  1403.    unsigned day   : 5;     /* binary day for directory entry */
  1404.    unsigned month : 4;     /* binary month for directory entry */
  1405.    unsigned year  : 7;     /* binary year for directory entry, offset from 1980 */
  1406.  } FDATE;
  1407.  
  1408. typedef FDATE FAR *PFDATE;
  1409.  
  1410.  
  1411. ΓòÉΓòÉΓòÉ 6.2. FTIME ΓòÉΓòÉΓòÉ
  1412.  
  1413. typedef struct _FTIME {        /* ftime */
  1414.    unsigned twosecs : 5;       /* binary number of two-second increments */
  1415.    unsigned minutes : 6;       /* binary number of minutes */
  1416.    unsigned hours   : 5;       /* binary number of hours */
  1417.  } FTIME;
  1418.  
  1419. typedef FTIME FAR *PFTIME;
  1420.  
  1421.  
  1422. ΓòÉΓòÉΓòÉ 6.3. FILESTATUS ΓòÉΓòÉΓòÉ
  1423.  
  1424. typedef struct _FILESTATUS {    /* fsts */
  1425.    FDATE  fdateCreation;        /* date of file creation */
  1426.    FTIME  ftimeCreation;        /* time of file creation */
  1427.    FDATE  fdateLastAccess;      /* date of last access */
  1428.    FTIME  ftimeLastAccess;      /* time of last access */
  1429.    FDATE  fdateLastWrite;       /* date of last write */
  1430.    FTIME  ftimeLastWrite;       /* time of last write */
  1431.    ULONG  cbFile;               /* file size (end of data) */
  1432.    ULONG  cbFileAlloc;          /* file allocated size */
  1433.    USHORT attrFile;             /* attributes of the file */
  1434.    ULONG  cbList;               /* length of EA structure */
  1435.  } FILESTATUS;
  1436.  
  1437. typedef FILESTATUS FAR *PFILESTATUS;
  1438.  
  1439. Note:  This structure must be byte packed. The ULONG at the end will be out of 
  1440. place of it is allowed to assume WORD or DWORD alignment. 
  1441.  
  1442.  
  1443. ΓòÉΓòÉΓòÉ 6.4. STARTDATA ΓòÉΓòÉΓòÉ
  1444.  
  1445. /* The following typedef has been plagiarised from the OS/2 Warp Developer's Toolkit 4.0 */
  1446.  
  1447. typedef struct _STARTDATA {
  1448.    USHORT     Length;         /*  The length of the data structure, in bytes, including Length itself. */
  1449.    USHORT     Related;        /*  An indicator which specifies whether the session created is related to the calling session. */
  1450.    USHORT     FgBg;           /*  An indicator which specifies whether the new session should be started in the foreground or background. */
  1451.    USHORT     TraceOpt;       /*  An indicator which specifies whether the program started in the new session should be executed under conditions for tracing. */
  1452.    PCSZ       PgmTitle;       /*  Address of an ASCIIZ string that contains the program title. */
  1453.    PCSZ       PgmName;        /*  The address of an ASCIIZ string that contains the file specification of the program to be loaded. */
  1454.    PCSZ       PgmInputs;      /*  Either 0 or the address of an ASCIIZ string that contains the input arguments to be passed to the program. */
  1455.    PCSZ       TermQ;          /*  Either 0 or the address of an ASCIIZ string that contains the file specification of a system queue. */
  1456.    PCSZ       Environment;    /*  The address of an environment string to be passed to the program started in the new session. */
  1457.    USHORT     InheritOpt;     /*  Specifies whether the program started in the new session should inherit the calling program's environment and open file handles. */
  1458.    USHORT     SessionType;    /*  The type of session that should be created for this program. */
  1459.    PCSZ       IconFile;       /*  Either 0 or the address of an ASCIIZ string that contains the file specification of an icon definition. */
  1460.    ULONG      PgmHandle;      /*  Either 0 or the program handle. */
  1461.    USHORT     PgmControl;     /*  An indicator which specifies the initial state for a windowed application. */
  1462.    USHORT     InitXPos;       /*  The initial x-coordinate, in pels, for the initial session window. */
  1463.    USHORT     InitYPos;       /*  The initial y-coordinate, in pels, for the initial session window. */
  1464.    USHORT     InitXSize;      /*  The initial x extent, in pels, for the initial session window. */
  1465.    USHORT     InitYSize;      /*  The initial y extent, in pels, for the initial session window. */
  1466.    USHORT     Reserved;       /*  Reserved; must be zero. */
  1467.    PVOID      ObjectBuffer;   /*  Buffer in which the name of the object that contributed to the failure of DosExecPgm is returned. */
  1468.    ULONG      ObjectBuffLen;  /*  The length, in bytes, of the buffer pointed to by ObjectBuffer. */
  1469. } STARTDATA;
  1470.  
  1471. typedef STARTDATA FAR *PSTARTDATA;
  1472.  
  1473.  
  1474. ΓòÉΓòÉΓòÉ 7. Linkage Convention ΓòÉΓòÉΓòÉ
  1475.  
  1476. The linkage convention is handled in C/C++ by a macro called VDM_LINKAGE. In 
  1477. any other language you will need to deal with this, unless the default linkage 
  1478. convention is that of Pascal. This means that both Pascal and FORTRAN 
  1479. programmers should be OK. 
  1480.  
  1481.  
  1482. ΓòÉΓòÉΓòÉ 7.1. Using Watcom C/C++ ΓòÉΓòÉΓòÉ
  1483.  
  1484. The Watcom C/C++ compiler permits #pragma aux to generate machine instructions 
  1485. from in-line assembler source. This is the approach I have taken for these API 
  1486. calls using this compiler. As a result, no linkage convention is used: the 
  1487. object code is in-line, and the VDM_LINKAGE macro is null. 
  1488.  
  1489.  
  1490. ΓòÉΓòÉΓòÉ 7.2. Using Other Compilers ΓòÉΓòÉΓòÉ
  1491.  
  1492. Note:  This section applies to compilers of languages other than C/C++, as well 
  1493. as to C/C++ compilers from other vendors. 
  1494.  
  1495. For compilers other than Watcom C/C++, I have used the Pascal linkage 
  1496. convention, since that is the "lowest common denominator" of subroutine 
  1497. linkage, and it is the one used by the OS/2 native API. Thus, the VDM_LINKAGE 
  1498. macro is resolved as _Pascal.