home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / docs / devcon2.inf (.txt) < prev    next >
Encoding:
OS/2 Help File  |  1994-02-25  |  377.3 KB  |  3,786 lines

  1.  
  2. ΓòÉΓòÉΓòÉ 1. Cover ΓòÉΓòÉΓòÉ
  3.  
  4. The Developer Connection News 
  5.  
  6. The Developer Connection for OS/2  ΓêÖ  Volume 2 
  7.  
  8. "The complete source of information for all of your OS/2 development efforts." 
  9.  
  10.  
  11. ΓòÉΓòÉΓòÉ 2. Publisher's Note ΓòÉΓòÉΓòÉ
  12.  
  13. The Developer Connection News 
  14. November 1993 
  15. Volume 2 
  16. Number 2 
  17.  
  18. Publisher                                    Barbara Britt 
  19.  
  20. Editor, The Developer Connection News        Stacey Miller 
  21.  
  22. Editorial Advisor                            Suzanne Gagnon 
  23.  
  24. Technical Advisors                           David Kenner, Jay Tunkel 
  25.  
  26. Art Director                                 Brian Black 
  27.  
  28. Graphics Design                              Studio East 
  29.                                              Ft. Lauderdale, Florida 
  30.  
  31. The Developer Connection News is a technical newsletter published quarterly by 
  32. The Developer Connection, Stacey Miller, Editor.  The newsletter contains 
  33. product, strategy, and technical information for software developers.  To 
  34. correspond with The IBM Developer Connection News, please write to the Editor 
  35. at IBM Corp., P.O. Box 1328, Internal ZIP 1599, Boca Raton, Florida 33431-1328. 
  36.  
  37. IBM may use or distribute any of the information you supply in any way it 
  38. believes appropriate without incurring any obligation whatever.  The terms 
  39. OS/2, OS/2 2.0, and OS/2 2.1 are used in this publication as abbreviations for 
  40. the full term OS/2 operating system.  OS/2 is a registered trademark of the IBM 
  41. Corporation.  Titles and abstracts, but no other portions, of information may 
  42. be copied and distributed by computer-based and other information service 
  43. systems.  Permission to republish information from this publication in any 
  44. other publication of computer-based information systems must be obtained from 
  45. the Editor, The Developer Connection News. 
  46.  
  47. IBM believes the statements contained herein are accurate as of the date of 
  48. publication of this document.  All specifications are subject to change without 
  49. notice.  However, IBM, hereby disclaims all warranties, either expressed or 
  50. implied, including with out limitation any implied warranty of merchantability 
  51. or fitness for a particular purpose.  In no event will IBM be liable to you for 
  52. any damages, including any lost profits, lost savings, or other incidental or 
  53. consequential damage arising out of the use or inability to use any information 
  54. provided through this publication even if IBM has been advised of the 
  55. possibility of such damages, or for any claim by any other party. 
  56.  
  57. Some states do not allow the limitation or exclusion of liability for 
  58. incidental or consequential damages so the above limitation or exclusion may 
  59. not apply to you. 
  60.  
  61. This publication may contain technical inaccuracies or typographical errors. 
  62. Also, illustrations contained here may show prototype equipment.  Your 
  63. configuration may differ slightly. 
  64.  
  65. This publication may contain articles by non-IBM authors.  These articles 
  66. represent the views of their authors.  IBM does not endorse any non-IBM 
  67. products that may be mentioned.  Questions should be directed to the authors. 
  68.  
  69. This information is not intended to be an assertion of future action.  IBM 
  70. expressly reserves the right to change or withdraw current products that may or 
  71. may not have the same characteristics or codes listed in this publication. It 
  72. is possible that this material may contain reference to, or information about, 
  73. IBM products (machines and programs), programming or services that are not to 
  74. be construed to mean that IBM intends to announce such products, programming, 
  75. or services in your country. 
  76.  
  77. IBM takes no responsibility whatsoever with regard to the selection, 
  78. performance, or use of the products advertised herein.  All understanding, 
  79. agreements, or warranties must take place directly between the software vendors 
  80. and perspective users. 
  81.  
  82. IBM, OS/2, PS/2, Micro Channel, Presentation Manager, Workplace Shell, AS/400, 
  83. and ES/3090 are registered trademarks of IBM Corp. 
  84.  
  85. AIX, C/2, CUA, SAA, WIN-OS/2, AS/400, ES/390, C Set/2, WorkSet/2, WorkFrame/2 , 
  86. Pen for OS/2, MMPM/2, and Multimedia Presentation Manager/2, Ultimotion, and 
  87. M-Audio Capture are trademarks of IBM Corp. 
  88.  
  89. Microsoft, MS-DOS, Code View, and Windows are trademarks of Microsoft Corp. 
  90.  
  91. CompuServe is a trademark of CompuServe Incorporated. 
  92.  
  93. UNIX is a trademark of UNIX System Laboratories. 
  94.  
  95. Apple, Macintosh, and System 7 are trademarks of Apple Computer, Inc. 
  96.  
  97. Intel, DVI, Indeo, and Pentium are trademarks of Intel Corporation. 
  98.  
  99. SmallTalk/V is a trademark of the Digitalk, Inc. 
  100.  
  101. HockWare and VisPro/REXX are trademarks of HockWare, Inc. 
  102.  
  103. WATCOM and Vx_Rexx are trademarks of WATCOM. 
  104.  
  105. C + + is a trademark of AT&T, Inc. 
  106.  
  107. Motorola is a trademark of Motorola, Inc. 
  108.  
  109. ProAudio Spectrum is a trademark of Media Vision. 
  110.  
  111. Sound Blaster is a trademark of Creative Labs, Inc. 
  112.  
  113. Performance 2.1 is a trademark of Clear & Simple, Inc. 
  114.  
  115. Taligent is a trademark of Taligent, Inc. 
  116.  
  117. All other products and names may be trademarks and/or registered trademarks of 
  118. their respective holders. 
  119.  
  120.  
  121. ΓòÉΓòÉΓòÉ 3. LIFE AFTER MAXIMUM ENTROPY or Operating Systems Unification at Last ΓòÉΓòÉΓòÉ
  122.  
  123. by Scott L. Winters and Jeri Dube 
  124.  
  125.  
  126. ΓòÉΓòÉΓòÉ 3.1. Days Gone By... ΓòÉΓòÉΓòÉ
  127.  
  128. The ordered world of PC hardware and software in the 1980s has been fractured 
  129. in the 1990s.  Simplistically viewed, in the 1980s all an entrepreneur had to 
  130. do was write a good application on DOS and market it well.  If he did that, 
  131. then everyone would buy the application and use it on their IBM PC or PC clone. 
  132.  
  133. Since that kinder, gentler, and simpler time, a lot has changed.  Today, there 
  134. are numerous software platforms with different API sets that are still 
  135. evolving.  These different API sets are all competing for viability.  Until the 
  136. ultimate winner or winners are declared, the software developer is left to 
  137. either take his chances with his choice of the long term winner or hedge his 
  138. bets by supporting multiple software platforms. 
  139.  
  140. The cost of supporting the various API sets are high.  The development costs 
  141. include the time, energy, and money it takes to migrate from one API set to 
  142. another plus add the features to take advantage of the additional 
  143. functionality.  The cost also include s the effect of not using resources to 
  144. improve the application itself to further meet the requirements of the 
  145. application users.  The risk of supporting only one platform is that the 
  146. investment will be lost due to insufficient sales of the selected platform. 
  147.  
  148. The anarchy and confusion in today's PC world is not all created by the 
  149. software.  The entire hardware paradigm is changing.  Until recently, the CISC 
  150. and RISC worlds were separate and distinct.  With the invention of the PowerPC 
  151. chip set and hardware reference platform, RISC is moving into the realm of 
  152. desktop computing.  Similarly, the capabilities and robustness of Intel's 
  153. Pentium chip moves CISC even further into the server and workstation realm. In 
  154. addition, the distinguishing software requirements between different hardware 
  155. systems are blurring as systems from PDAs to super computers are required to be 
  156. on one continuum. 
  157.  
  158. Further complicating the world, is the pending movement from today's 32-bit 
  159. machines to tomorrow's 64-bit machines.  Additionally, computers are leaving 
  160. homes and offices and moving onto the road and into the air.  People want and 
  161. now expect their applications to be able to work anywhere.  What we have in the 
  162. current world of computing is a state of maximum entropy.  The industry is 
  163. evolving, churning and fracturing.  The complexity of choices needs to be 
  164. simplified, even more than they have been already by the introduction of a 
  165. multi-personality, integrated platform like OS/2, because the complexity is too 
  166. draining of resources. 
  167.  
  168.  
  169. ΓòÉΓòÉΓòÉ 3.2. A New Order ΓòÉΓòÉΓòÉ
  170.  
  171. The Workplace OS family (WPOS) is IBM Personal Software's vehicle to bring 
  172. order back to the world of computing.  In this article, we will show the 
  173. features of the system and how those features allow application developers to 
  174. minimize their resource expenditures on retrofitting code while maximizing the 
  175. number of platforms on which an application can run. 
  176.  
  177.  
  178. ΓòÉΓòÉΓòÉ 3.3. A Modular Operating System ΓòÉΓòÉΓòÉ
  179.  
  180. The Workplace OS family provides a modular approach to allow different 
  181. operating system personalities to share physical hardware resources and system 
  182. software components that are architecturally positioned as support elements. 
  183. Looking at the system from the bottom up, we start with the hardware platforms. 
  184.  
  185. WPOS runs on the CISC environment of the Intel x86 and Pentium family of chips 
  186. and the RISC-based IBM/Motorola PowerPC Architecture.  Our approach is to 
  187. introduce a UNIX personality of WPOS (WPIX) on the Intel platform and a 
  188. Workplace OS/2 (WP-OS/2) personality on the PowerPC platform with a DOS/WIN 
  189. personality on both platforms.  As time passes, all three personalities will 
  190. run on both platforms, and the WPOS family will extend onto other RISC-based 
  191. platforms with more personality choices as well. 
  192.  
  193.  
  194. ΓòÉΓòÉΓòÉ 3.4. Putting it Together ΓòÉΓòÉΓòÉ
  195.  
  196. The WPOS interface to the hardware platform is the IBM Microkernel, which is an 
  197. extended and industrialized version of the Mach microkernel originally written 
  198. at Carnegie Mellon University.  Some of the IBM-written extensions include 
  199. out-of-kernel devic e drivers, security, and additional performance 
  200. enhancements.  The microkernel is what allows WPOS to be portable between 
  201. hardware platforms. 
  202.  
  203. Also contained in the interface is a set of system services called Personality 
  204. Neutral Services (PNS) that are required by all traditional operating systems. 
  205. These services are considered personality neutral because they are: 
  206.  
  207. o Written in an endian-neutral, processor-neutral fashion 
  208. o Common to all operating systems in an implementation-neutral way. 
  209. o Able to share APIs with all other neutral services within the system. 
  210.  
  211. These services are provided by five separate servers.  The Name Server ensures 
  212. the uniqueness of each system entity's name so that there is no confusion 
  213. between elements in the system.  The Master Server is responsible for the 
  214. initial system loading and address resolution.  The Default Pager handles 
  215. memory allocation and anonymous paging.  The Hardware Resource Manager (HRM) 
  216. does the peripheral device management as well as handling basic Boot support. 
  217. The Security Server manages access rights and handles security tokens. 
  218.  
  219. WPOS physical device drivers will also be personality neutral, so once a device 
  220. driver is designed and written in a neutral way, it can be reused by many 
  221. operating systems personalities. 
  222.  
  223. The combination of the hardware interface, physical device drivers, and the 
  224. above services comprise the IBM Microkernel.  The microkernel is not an 
  225. operating system by itself, but rather a set of components on which operating 
  226. systems can be constructed.  The microkernel is the foundation of Workplace OS 
  227. and also will be available as a product for operating system developers to use 
  228. as building blocks.  Using the microkernel as the foundation of WPOS gives it 
  229. the flexibility to be used on hardware systems ranging from PDAs to 
  230. supercomputers. 
  231.  
  232. Common Personality Services (CPS) are an optional set of elements within 
  233. Workplace OS.  A CPS is shared among different operating system servers, as 
  234. described previously, except that a CPS has fewer rules to follow within the 
  235. system structure and architecture.  The value of a CPS is in its ability to be 
  236. shared partially or fully within the system architecture.  A CPS: 
  237.  
  238. o May be common to a subset of operating system personalities in its function 
  239.   or architecture. 
  240.  
  241. o May export its APIs to other PNS/CPS libraries and servers but may not need 
  242.   to be common to all. 
  243.  
  244. o Is an optional element of the Workplace OS, not an element of the microkernel 
  245.   product. 
  246.  
  247. A prime example of a CPS is the OS/2-styled multimedia subsystem and server. In 
  248. this CPS, you find the current OS/2 2.1 and Windows 3.1 multimedia 
  249. architectures, exporting the Media Control Interface and the Multimedia I/O 
  250. (MMIO) API.  Although these interfaces are important to traditional Intel-based 
  251. PC's, they mean less in other worlds like Unix or System 7. Since this MM layer 
  252. is common to only a subset of WPOS personalities, and it is not in the 
  253. Microkernel, it is a CPS rather than a true PNS. 
  254.  
  255. The File Server (FS) is also a product and a CPS.  The File Server supports the 
  256. management of a client/server file system model.  The FS client code is 
  257. dynamically linked in the same address space of a WPOS application and supports 
  258. traditional API sets.  The Server side of the product embodies the Logical File 
  259. System (LFS).  The Server hosts the Service Provider Interface (SPI) to the 
  260. Physical File Systems and also talks to the microkernel and the Name Server. 
  261. Physical File Systems planned to be included in WPOS are FAT, CD-ROM, JFS, HPFS 
  262. and others.  Some subset of these will be in the initial release of the file 
  263. server.  JFS is planned for the first release because it is functionally robust 
  264. and extensible.  The design is stable and a proven architecture currently used 
  265. in the open standards world. 
  266.  
  267. In addition to the two CPS's listed, there will be more CPS's offered by IBM 
  268. and others.  These Common Personality Servers will provide functions such as 
  269. database, communications, and LAN servers. 
  270.  
  271. In WPOS, operating system environments are known as personalities.  These 
  272. personalities provide the user interface and the complete operating system 
  273. function not included in the microkernel for that personality.  The end user of 
  274. WPOS will choose which version of the Workplace OS family to use for their 
  275. applications, compatibility requirements, and so on. 
  276.  
  277. Workplace OS/2 is functionally compatible with OS/2 2.1.  What this means is 
  278. that every 32-bit API that exists in Version 2.1 will exist in this operating 
  279. system.  The OS/2 text-based, 16-bit APIs will be functionally replaced with 
  280. 32-bit equivalent APIs.  In addition, our goal is to maintain source 
  281. compatibility between OS/2 32-bit applications on WP-OS/2 for Intel and WP-OS/2 
  282. for PowerPC, with binary compatibility between OS/2 32-bit applications on 
  283. WP-OS/2 for Intel and OS/2 2.1 on Intel. 
  284.  
  285. Extensions beyond OS/2 2.1 functionality, besides the obvious advantage of more 
  286. hardware platforms include the following list: 
  287.  
  288. o System management 
  289. o Human-centric exploitation 
  290. o Scalability 
  291. o Security 
  292. o User-friendly installation 
  293. o Improved developer productivity 
  294.  
  295.  
  296. ΓòÉΓòÉΓòÉ 3.5. The Beginning of the End of Maximum Entropy ΓòÉΓòÉΓòÉ
  297.  
  298. Workplace OS is a microkernel-based operating system that embodies the 
  299. Workplace family of architected technologies and open industry standards. Many 
  300. products will be based on Workplace technologies and standards, because they 
  301. give customers and developers flexibility to adopt new technologies while 
  302. protecting their current investment. 
  303.  
  304. The Workplace Shell is one of these technologies.  By virtue of the Workplace 
  305. Shell, WPOS will not be foreign to users of other IBM Personal Software 
  306. products.  The Workplace Shell is a common GUI on top of the traditional 
  307. operating system environment.  The immediate value of such an environment is 
  308. obvious:  enhanced user productivity within a heterogeneous PC office 
  309. environment.  Employees fluent on the Workplace Shell would be able to use any 
  310. office equipment available, independent of the Workplace family member.  The 
  311. value to developers is the standardization of a GUI API set. Since the 
  312. Workplace Shell on OS/2 2.1 is available and robust today, there is an existing 
  313. path from which to grow to in the future. The beginning of the end of maximum 
  314. entropy is here today. 
  315.  
  316. The addition of Workplace OS diminishes the entropy by isolating applications 
  317. from hardware, so developers can create source code without regard to hardware 
  318. differences.  Furthermore, with an architecture that enables concurrent 
  319. execution of applications w ritten for several OS platforms, by providing 
  320. multiple OS services on a microkernel, a developer will find it less critical 
  321. to develop applications for multiple software platforms.  Common Personality 
  322. Services provide the mechanisms that subsystem developers use to create 
  323. products for multiple microkernel-based operating environments. 
  324.  
  325. The computing environment will never return to the simplicity of the early days 
  326. for personal computers.  IBM's goal is to provide technical innovations and 
  327. advanced architectures that can simplify the choices and minimize the expense 
  328. of developing applications while satisfying customers' requirements. WPOS meets 
  329. these goals by being both portable and scalable, as well as an extension and 
  330. complement to IBM's current operating systems portfolio. 
  331.  
  332.  
  333. ΓòÉΓòÉΓòÉ 3.5.1. About the Authors ΓòÉΓòÉΓòÉ
  334.  
  335. Jeri Dube is an Advisory Planner for the Workplace OS products. Previously, 
  336. Jeri was a Planning Group Manager for Engineering Systems Test for Enterprise 
  337. Systems.  During her eclectic career at IBM, Jeri has held a variety of roles. 
  338.  
  339. Scott L. Winters is an IBM Senior Technical Staff Member.  His current 
  340. assignment is Chief Architect of Workplace OS/2. Previously, Scott was the Lead 
  341. Architect in the OS/2 Multimedia Systems Software group, where the MMPM/2 
  342. product was created. 
  343.  
  344. Look to future issues of The Developer Connection News for in-depth articles 
  345. on: 
  346.  
  347. o Common Personality and Personality Neutral Servers. 
  348. o Extensions beyond Os/2 2.1 
  349. o The Workplace Shell 
  350.  
  351.  
  352. ΓòÉΓòÉΓòÉ 4. OpenDoc:  An Idea Whose Time has Come! ΓòÉΓòÉΓòÉ
  353.  
  354. by Robert Tycast 
  355.  
  356. When Brad Cox coined the term "software IC", he foresaw a day when software 
  357. building would move from the realm of hand-crafted monoliths to a world of 
  358. composites.  These new-age solutions would be assembled from parts by skilled 
  359. application builders using and reusing software components in ways that the 
  360. original designers didn't and couldn't have conceived of. 
  361.  
  362. OpenDoc represents an important first step in that direction.  It provides the 
  363. technology to break up an application into parts. 
  364.  
  365.  
  366. ΓòÉΓòÉΓòÉ 4.1. OpenDoc - What's In a Name? ΓòÉΓòÉΓòÉ
  367.  
  368. "Open" - OpenDoc is a programming architecture for creating, storing, and 
  369. sharing compound-documents.  It is open, vendor-neutral, language-independent, 
  370. and cross-platform. 
  371.  
  372. Born of work by Apple Computer, Inc., and supported by major vendors such as 
  373. IBM, Novell, Oracle, WordPerfect Corporation, Xerox Corporation, and Taligent, 
  374. OpenDoc is changing the way applications are built and used. 
  375.  
  376. "Doc"  -  OpenDoc is document-centered programming.  By a suitable change of 
  377. mind-set, virtually all applications in use today can been seen as a document. 
  378. And, the definition is expanded.  In OpenDoc, documents include more than text 
  379. - audio, video, graphics, charts, spreadsheets -  virtually anything that a 
  380. computer can output is fair game.  The document must be alive and not static - 
  381. animation, background music, and a dynamically changing content are all part of 
  382. the OpenDoc document. 
  383.  
  384. You will no longer decide which applications to launch to solve a problem or to 
  385. do work on your computer.  Instead, you'll start with blank stationery and 
  386. compose a document by collecting and combining "parts in standard or novel 
  387. ways, depending on your need, inclination, or experience-level." 
  388.  
  389. The most simple documents, ones that traditionally would use a text editor or 
  390. word processor simply will include a text part.  If, however, you wish to spice 
  391. up your memo or letter with some graphics, simply include a graphics part using 
  392. your favorite graphics editor.  Or, if you want to include up-to-the-minute 
  393. sales data, then a bar graph linked to a spreadsheet will do the trick. 
  394.  
  395. Contrast this with an application-centered model, where you can't decide to 
  396. include graphics in your document as an afterthought.  You have to choose a 
  397. word-processor which has all of the capabilities that you'll eventually want. 
  398.  
  399. With OpenDoc you are limited only by your imagination and not by the 
  400. capabilities of the application selected. 
  401.  
  402.  
  403. ΓòÉΓòÉΓòÉ 4.2. Is That ALL? ΓòÉΓòÉΓòÉ
  404.  
  405. Not by a long shot.  OpenDoc documents are scriptable.  That means that 
  406. developers can provide unique solutions by gluing OpenDoc parts together with a 
  407. script language such as ObjectRexx.  And users benefit, because they can tinker 
  408. and customize their documents to their heart's content. 
  409.  
  410.  
  411. ΓòÉΓòÉΓòÉ 4.3. An Amalgam of Technologies ΓòÉΓòÉΓòÉ
  412.  
  413. OpenDoc will consist of four distinct technologies: 
  414.  
  415. o Compound documents 
  416.  
  417.   This is OpenDoc proper. 
  418.  
  419. o System Object Model (SOM) 
  420.  
  421.   SOM provides the CORBA-compliant capabilities of OpenDoc, including a 
  422.   language-neutral interface and the ability to access parts across a network. 
  423.  
  424. o Open Scripting Architecture (OSA) 
  425.  
  426.   OSA provides the ability to script a document at the part level. 
  427.  
  428. o Bento 
  429.  
  430.   This is the persistent storage model.  It is available to developers to use 
  431.   to write OpenDoc documents to permanent store. 
  432.  
  433.  
  434. ΓòÉΓòÉΓòÉ 4.4. But How Will These Technologies Be Made Available To The Industry? ΓòÉΓòÉΓòÉ
  435.  
  436. Enter CIL.  Apple Computer, Inc., IBM, Novell, Oracle, WordPerfect Corporation, 
  437. Xerox Corporation, and Taligent have agreed to license these technologies to a 
  438. jointly-funded consortium.  To that end, Component Integration Laboratories 
  439. (CIL) was founded.  Modeled after the successful X Window System Consortium, 
  440. CIL will receive the rights to OpenDoc, SOM, and related technologies.  It 
  441. will, then, license them back, royalty-free, to the industry.  Members will 
  442. contribute reference implementations and other donated software.  CIL will also 
  443. develop certification programs as a service to the industry to verify the 
  444. completeness and correctness of OpenDoc implementations, as well as offer 
  445. training for developers who want to use CIL technologies. 
  446.  
  447.  
  448. ΓòÉΓòÉΓòÉ 4.5. What?  You Want More Information? ΓòÉΓòÉΓòÉ
  449.  
  450. For more information, contact the Component Integration Laboratories.  They can 
  451. be reached at: 
  452.  
  453. Component Integration Laboratories (CIL)
  454. 688 Fourth Avenue
  455. San Francisco, California  94118
  456. (415) 750-8352 (voice)
  457. (415) 757-4829 (fax)
  458.  
  459. "The Components Integration Laboratory....is a nonprofit association dedicated 
  460. to software plug-and play interoperability across multiple computer platforms." 
  461.  
  462. Watch for more information on OpenDoc in successive Newsletters, as well as on 
  463. The Developer Connection for OS/2 CD-ROM. 
  464.  
  465.  
  466. ΓòÉΓòÉΓòÉ 4.5.1. About the Author ΓòÉΓòÉΓòÉ
  467.  
  468. Robert Tycast is an Advisory Programmer in the OS/2 Development group.  Over 
  469. the last 15 years, Robert has had project experience in XII, AI Technology 
  470. (LISP and OPS5 support), and technical workstations (VMS and ULTRIX). 
  471.  
  472.  
  473. ΓòÉΓòÉΓòÉ 5. Side by Side Comparison - OpenDoc vs. OLE2 ΓòÉΓòÉΓòÉ
  474.  
  475. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  476. ΓöéOpenDoc                       ΓöéOLE2                          Γöé
  477. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  478. ΓöéOpen System - Freely licensed ΓöéProprietary - Owned and       Γöé
  479. Γöéto the industry through the   Γöécontrolled by Microsoft.      Γöé
  480. ΓöéComponent Integration         Γöé                              Γöé
  481. ΓöéLaboratories.                 Γöé                              Γöé
  482. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  483. ΓöéSOM - Based on industry       ΓöéCOM - NOT CORBA compliant; no Γöé
  484. Γöéstandard for object-oriented  Γöéinheritance; aggregation      Γöé
  485. Γöéprogramming (CORBA).          Γöéproposed as alternative.      Γöé
  486. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  487. ΓöéDistributed - OpenDoc parts   ΓöéNot Distributed - Can only    Γöé
  488. Γöécan be embedded from anywhere Γöéembed objects from local OLE  Γöé
  489. Γöéin the network.               Γöéservers.                      Γöé
  490. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  491. ΓöéCross-platform support -      ΓöéOnly available on Microsoft   Γöé
  492. ΓöéOpenDoc will be available on  ΓöéWindows.                      Γöé
  493. ΓöéApple, OS/2, UNIX, and        Γöé                              Γöé
  494. ΓöéMicrosoft Windows.            Γöé                              Γöé
  495. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  496. ΓöéLanguage Neutral - SOM        ΓöéDifficult to use with         Γöé
  497. Γöébindings make OpenDoc readily Γöélanguages other than C++.     Γöé
  498. Γöéavailable from any language.  Γöé                              Γöé
  499. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  500. ΓöéSource code available.        ΓöéSource code NOT available.    Γöé
  501. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  502. ΓöéAny part can be at the "root" ΓöéIn OLE, only specialized      Γöé
  503. Γöéof the document.              Γöécontainers can be at the      Γöé
  504. Γöé                              Γöé"root".                       Γöé
  505. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  506. ΓöéParts can be any shape.       ΓöéOLE objects must be           Γöé
  507. Γöé                              Γöérectangular                   Γöé
  508. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  509. ΓöéOpenDoc maintains multiple    ΓöéNo support for multiple draftsΓöé
  510. Γöédraft versions of a document. Γöéon OLE.                       Γöé
  511. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  512. ΓöéOpenDoc parts can overlap.    ΓöéOLE objects CANNOT overlap.   Γöé
  513. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  514. ΓöéOpenDoc parts can be edited byΓöéOLE objects must be activated Γöé
  515. Γöéclicking on them directly.    Γöéand the content selected in   Γöé
  516. Γöé                              Γöéorder to edit it; when nested,Γöé
  517. Γöé                              Γöémultiple levels have to be    Γöé
  518. Γöé                              Γöéactivated.                    Γöé
  519. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  520. ΓöéDevelopment effort:  50       ΓöéDevelopment effort:  14       Γöé
  521. Γöémandatory functions for a     Γöédifferent interfaces must be  Γöé
  522. Γöébasic part.                   Γöéprovided with a total of 136  Γöé
  523. Γöé                              Γöéfunctions mandatory.          Γöé
  524. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  525.  
  526.  
  527. ΓòÉΓòÉΓòÉ 6. Insights ΓòÉΓòÉΓòÉ
  528.  
  529. Barbara Britt, Product Manager of OS/2 Development Tools including The 
  530. Developer Connection for OS/2, took time out of her busy schedule to talk to 
  531. Stacey Miller, Editor of The Developer Connection News, about the future of 
  532. OS/2 Development Tools and specifically The Developer Connection program. 
  533.  
  534. The following is an edited transcript of that conversation. 
  535.  
  536. SM:       Barbara, beside being Product Manager for The Developer Connection 
  537.           for OS/2, what other development tools are you responsible for? 
  538. BB:       I'm also responsible for the OS/2 Developer's Toolkit and the OS/2 
  539.           Device Driver Source Kit (DDK).  In addition, I have responsibility 
  540.           for the Workplace OS development tools, And, in the future you'll be 
  541.           seeing pre-release copies of those toolkits that support our 
  542.           Workplace OS development as we move that development onto the 
  543.           PowerPC. 
  544.  
  545. SM:       You said "in the future."  Can you project how long in the future? 
  546. BB:       Information has already been starting to go out about Workplace OS, 
  547.           the types of tools needed, and the development environment to the 
  548.           development communities.  We will start rolling out the Workplace OS 
  549.           toolkits early next year on The Developer Connection for OS/2 CD-ROM. 
  550.  
  551. SM:       The Developer Connection for OS/2 has been creating a lot of 
  552.           excitement since its announcement in August.  Why do you believe this 
  553.           to be the case? 
  554. BB:       I think The Developer Connection for OS/2 is receiving this good 
  555.           response because we've been listening to the customers, and we are 
  556.           providing what they've asked for.  They've asked for the latest tools 
  557.           and latest pre-release versions of the Operating Systems as soon as 
  558.           they are available and the Developer Connection does that.  We also 
  559.           provide the latest information in The Developer Connection News. 
  560.           They also like all the other extra things on the CD-ROM, such as the 
  561.           demo products. 
  562.  
  563. SM:       What steps are you taking to make sure that The Developer Connection 
  564.           for OS/2 is meeting the needs of developers? 
  565. BB:       We are continuing to get feedback For example, we've put a CompuServe 
  566.           forum together exclusively for people who have purchased The 
  567.           Developer Connection, so we can get that feedback.  Also, we are 
  568.           talking to people at conferences.  We take all of the feedback back 
  569.           here [to the development lab] to work on getting the right tools and 
  570.           levels of information on the CD-ROM to answer the requests of our 
  571.           customers. 
  572.  
  573. SM:       A lot of folks are comparing The Developer Connection to Microsoft's 
  574.           Developer Network.  How do you respond to this comparison? 
  575. BB:       I think our focus is different than Microsoft's Developer Network, 
  576.           and I think that just because they're both delivered on a CD-ROM will 
  577.           invite comparison.  I believe that the key purpose of the Developer 
  578.           Network is to provide information.  We are not only providing 
  579.           information, but the toolkits, pre-release software, demos, and 
  580.           samples.  I believe we're striving to satisfy a different market; to 
  581.           solve a different problem. 
  582.  
  583. SM:       The Developer Connection for LAN Systems was pre-released in Orlando; 
  584.           what is the difference between that Developer Connection and The 
  585.           Developer Connection for OS/2? 
  586. BB:       The Developer Connection is a program; it is not just a product. The 
  587.           program is designed to get the right set of tools out to the right 
  588.           customers.  In the future, you'll be seeing more announcements of 
  589.           other Developer Connections.  Now, the Developer Connection for OS/2 
  590.           is the one for base OS/2 development.  If you're specifically 
  591.           developing in the LAN environment, you would need the Developer 
  592.           Connection for LAN Systems.  Since it is a program, the user 
  593.           interface, the browser, and the catalog functions will all be the 
  594.           same.  Also, ordering information and support will come from one 
  595.           common area.  Therefore, each additional program will be an extension 
  596.           of The Developer Connection for OS/2. 
  597.  
  598. SM:       What about other Developer Connection programs? 
  599. BB:       We're looking at providing a Developer Connection for Objects, which 
  600.           may or may not be part of the base system, because objects is such an 
  601.           important part of the whole base.  So if its not a separate offering, 
  602.           it will be a separate section to The Developer Connection for OS/2. 
  603.           I've also talked about the Developer Connection for Workplace OS, 
  604.           which will run on the PowerPC.  We're also looking at expanding The 
  605.           Developer Connection program to run on some of the UNIX-based boxes 
  606.           to provide tools for UNIX developers. 
  607.  
  608. SM:       What are the plans to have these additional Developer Connection 
  609.           programs available? 
  610. BB:       Most of these programs will be available next year.  We're rolling 
  611.           them out over time.  Workplace OS will be delivered first, with the 
  612.           rest of the programs to follow.  You'll eventually see The Developer 
  613.           Connection as a family of programs. 
  614.  
  615. SM:       Some of the developers are saying that the first CD-ROM did not 
  616.           contain enough sample code.  How would you respond to that? 
  617. BB:       Everyone needs more samples, and we would agree that we need to 
  618.           provide more samples.  But what we're trying to do right now is to 
  619.           put together a list of the most-requested samples.  Then, we'll 
  620.           either ask people in IBM development to write them; or we'll ask 
  621.           people outside of IBM to donate them.  For instance, if you had a 
  622.           particular favorite sample to solve a problem, we'd like to evaluate 
  623.           putting it on the CD-ROM.  We are developing a sample architecture to 
  624.           ensure that the programmer gets consistent information on how to use 
  625.           the sample, as well as the problem that the sample is solving.  We 
  626.           would like to put the sample architecture on the CD-ROM, so if you 
  627.           are writing a sample, you could follow that architecture.  That way, 
  628.           everybody has the same base to work from. 
  629.  
  630. SM:       What other improvements can you tell us about? 
  631. BB:       We want to improve the Browser.  We want to add phrase and Boolean 
  632.           searches. We want to improve the on-line information, as well as the 
  633.           Catalog functions. We also want to look at adding more books. 
  634.  
  635. SM:       What about hardware?  Is there any plan to tie the Device Driver 
  636.           Source Kit program in with The Developer Connection for OS/2, or do 
  637.           you feel that these will stay two separate offerings? 
  638. BB:       We've made tremendous strides in providing the Device Driver Source 
  639.           Kit for OS/2. In fact, we've just delivered the first update to that 
  640.           system.  We're getting tremendous response that we're providing the 
  641.           right kinds of device driver source code that they need to do their 
  642.           device driver development.  This will help hardware support.  We are 
  643.           also looking at providing the DDK as part of the Developer Connection 
  644.           program.  Again, not everyone is doing device driver development, so 
  645.           it would be just a way to consolidate support and have more of a one 
  646.           stop shopping place for all of the Development Tools. 
  647.  
  648. SM:       The success of Independent Software Vendors (ISVs) is crucial to 
  649.           IBM's success with OS/2.  How will being a part of The Developer 
  650.           Connection family help them, and at the same time help IBM? 
  651. BB:       What we want to do with The Developer Connection is to provide 
  652.           pre-release operating systems to both our ISVs and Corporate 
  653.           customers, so that they can develop and exploit new operating system 
  654.           functions in their applications.  Then, they can have the 
  655.           applications ready at the same time the operating system ships.  So, 
  656.           when OS/2 comes out with a new function applications will be 
  657.           available that can exploit these new functions right away.  This will 
  658.           not only help OS/2, but it will also help the ISVs.  They will be 
  659.           able to say, for example, when OS/2 supports OpenDoc, their 
  660.           application will also support OpenDoc.  There will be no lag time 
  661.           between a new release of an operating system and applications that 
  662.           exploit those new functions. 
  663.  
  664. SM:       Do you believe that The Developer Connection for OS/2 is critical to 
  665.           the success of OS/2? 
  666. BB:       Tools and programs like The Developer Connection are critical to the 
  667.           success of OS/2.  We need to provide software developers with what 
  668.           they need to write applications that support OS/2.  And, those 
  669.           applications running on OS/2 are a key to its success. 
  670.  
  671. SM:       Thank you, Barbara! 
  672. Barbara Britt, Product Manager -- The Developer Connection for OS/2 
  673.  
  674. Stacey Miller, Editor -- The Developer Connection News 
  675.  
  676.  
  677. ΓòÉΓòÉΓòÉ 7. The OS/2 Graphics Subsystem in the Workplace OS Family ΓòÉΓòÉΓòÉ
  678.  
  679. by Kelvin R. Lawrence 
  680.  
  681. In recent articles published in The Developer Connection News, we have 
  682. presented an overview of Workplace OS.  One of the key features of Workplace OS 
  683. is its ability to run all of today's 32-bit OS/2 applications, which includes 
  684. those written to the OS/2 Presentation Manager.  In this article, we will 
  685. explore the graphical and presentation service capabilities that Workplace OS/2 
  686. (WP-OS/2) will provide for OS/2 applications - focusing on the port of the OS/2 
  687. Graphics Subsystem to the WP-OS/2 environment. 
  688.  
  689. All of the components present in the graphics subsystem of today's OS/2 2.1 
  690. will be ported to the WP-OS/2 IBM Microkernel environment.  Presentation 
  691. Manager applications that are written in a 32-bit, high-level language (such as 
  692. C or C++) will port to WP-O S/2 with little more than a recompile.  And, 
  693. depending on the target hardware platform even the recompile might be 
  694. unnecessary.  For example, today's 32-bit applications that run on Intel 
  695. hardware will continue to run on WP-OS/2 on Intel hardware.  In ad dition, 
  696. today's 32-bit, assembler code will port potentially unchanged to WP-OS/2 when 
  697. running on an Intel hardware platform, but not to non-Intel hardware.  However, 
  698. applications written in a 16-bit, high-level language today, will, at a 
  699. minimum, require a port to a 32-bit compiler.  Ideally, they should be modified 
  700. to take full advantage of a 32-bit flat memory model that OS/2 2.1 provides 
  701. today and that the WP-OS/2 will provide. 
  702.  
  703. The reality is that on WP-OS/2, 32-bit applications will be easier to port and 
  704. will realize greater performance. 
  705.  
  706. All of the interfaces provided by the PM Window Manager (PMWIN) and PM 
  707. Graphical Programming Interface (PMGPI) will be available in 32-bit form on 
  708. WP-OS/2.  This is very important for application programmers who want to 
  709. maintain one set of source code and have it run unchanged on a variety of 
  710. hardware platforms (for example, Intel and RISC). 
  711.  
  712. The Graphics Subsystem under WP-OS/2
  713.  
  714.  
  715. ΓòÉΓòÉΓòÉ 7.1. The PM Window Manager ΓòÉΓòÉΓòÉ
  716.  
  717. When we talk about the PM Window Manager (PMWIN) component of OS/2 2.1, we are 
  718. referring to that piece of Presentation Manager that provides the support for 
  719. the displaying and manipulating of windows and controls.  As many of you know, 
  720. even under OS/2 2.1 today, some pieces of 16-bit code and data are present in 
  721. the Window Manager.  As part of the port of the Window Manager to WP-OS/2, all 
  722. of the remaining restrictions imposed by the presence of 16-bit code and data 
  723. will be removed.  This will yield advan tages for 32-bit applications.  No 
  724. longer will any thunk (or conversion) layers be needed to convert 32-bit data 
  725. provided by applications to 16-bit format, so that the Window Manager can work 
  726. with the data.  Also, the control window classes provided by PMWIN, such as the 
  727. listbox, will no longer have a 64KB constraint on the amount of data they can 
  728. maintain. 
  729.  
  730. The technology used to upgrade PMWIN for WP-OS/2 will be rolled back to the 
  731. OS/2 2.x arena.  Therefore, 32-bit applications will realize the benefits of a 
  732. fully 32-bit Window Manager on any platform where the OS/2 2.1 application 
  733. programming interface (API) is available. 
  734.  
  735.  
  736. ΓòÉΓòÉΓòÉ 7.2. Graphical Programming Interface ΓòÉΓòÉΓòÉ
  737.  
  738. Since its inception in the days of OS/2 1.1 back in 1987, the Graphical 
  739. Programming Interface (GPI) has had a 32-bit API.  In other words, all of the 
  740. parameters that get passed to GPI functions are 32-bit LONGs.  In the OS/2 2.1 
  741. environment, the internal library of the GPI is fully 32-bit.  Because of this, 
  742. applications written to the GPI today will see exactly the same environment 
  743. when running under either WP-OS/2 or OS/2 2.1. 
  744.  
  745.  
  746. ΓòÉΓòÉΓòÉ 7.3. Graphics Engine ΓòÉΓòÉΓòÉ
  747.  
  748. OS/2 2.1 already contains a powerful, 32-bit, graphics engine.  The graphics 
  749. engine is the graphical kernel of PM.  It sits between the GPI and the 
  750. presentation drivers that support hardware devices.  The engine contains the 
  751. algorithms and functions that implement the OS/2 imaging (or drawing) model. 
  752.  
  753. It handles and manipulates all aspects of the graphics subsystem -  from 
  754. rendering line primitives, such as arcs and splines,  to performing coordinate 
  755. transformations to managing fonts to calculating clipping. In the same way that 
  756. 32-bit applications can be ported easily to the WP-OS/2, the graphics engine 
  757. also is a simple port.  This is because it is written almost entirely in 32-bit 
  758. C code. 
  759.  
  760.  
  761. ΓòÉΓòÉΓòÉ 7.4. Presentation Driver Model ΓòÉΓòÉΓòÉ
  762.  
  763. The term presentation driver refers to the piece of code that sits between the 
  764. graphics engine and a hardware device such as a screen or a printer. 
  765. Presentation drivers are really dynamic link libraries (DLLs) that can be 
  766. dynamically loaded when required.  A typical OS/2 2.1 system has one display 
  767. presentation driver and one or more printer presentation drivers loaded at any 
  768. one time. 
  769.  
  770. The graphics engine maintains a dispatch table of functions for each device it 
  771. has loaded.  When an application makes a GPI call such as GpiPartialArc, the 
  772. GPI calls the engine's function dispatcher, which jumps to the address of the 
  773. PartialArc function in the dispatch table. 
  774.  
  775. When the engine initially loads a presentation driver, the driver has the 
  776. chance to replace the address of functions in the default dispatch table with 
  777. the address of its functions.  For example, if the driver provides the address 
  778. of a function that implements the PartialArc function, the engine jumps 
  779. directly to the driver's function - whenever the application makes a call to 
  780. GpiPartialArc.  Otherwise, the engine breaks the arc down into simpler graphics 
  781. primitives that the device indicates it can handle by hooking out those 
  782. functions, such as PolyLine. 
  783.  
  784. Today, in OS/2 2.1, presentation drivers have to hook out (or support) between 
  785. 59 (printer drivers) and 75 (display drivers) mandatory functions.  That is, 
  786. the engine provides no support for a range of functions that it expects all 
  787. presentation drivers to provide routines for.  Therefore, presentation drivers 
  788. are more complex and take longer to write than perhaps should have be 
  789. necessary. 
  790.  
  791. As well as the current level of function it provides, the graphics engine is 
  792. being further enhanced to make the writing of presentation drivers much easier. 
  793. Existing drivers that hook large numbers of functions are still supported. 
  794. However, the number of mandatory (must hook) functions is greatly reduced. 
  795. Under the new model, the minimum that a presentation driver will have to do to 
  796. get up and running is to notify the engine of a flat frame linear address where 
  797. the engine can place a ready-for-display bitmap image of the picture generated 
  798. by the application.  For a display device, this could be simply the address of 
  799. video memory in the hardware.  For a printer device, this could be a large 
  800. linear address space within the printer or an address space allocated by the 
  801. presentation driver. 
  802.  
  803. To achieve the new presentation driver model, the graphics engine will now 
  804. provide support for functions that it required drivers to support in the past. 
  805. The engine will also provide more built-in support for palette management and 
  806. generation of rasterized images, so presentation drivers do not have to provide 
  807. that support themselves. 
  808.  
  809. The new presentation driver model means that it will be very easy and take very 
  810. little time to get a presentation driver up and running.  This is especially 
  811. good when producing drivers for a new hardware device, as it is highly 
  812. desirable to get a driver up and running quickly.  By allowing Presentation 
  813. drivers to hook out  more than a minimum set of functions from the Engine's 
  814. dispatch table, they will still be able to exploit built-in algorithms and 
  815. features of hardware device that are provided to help spee d up the graphics 
  816. rendering process.  In other words, presentation drivers will focus on the 
  817. hardware specific portions of their drivers (the parts that are unique) and can 
  818. allow the Engine and the rest of the presentation manager video subsystem to do 
  819. the rest of the work. 
  820.  
  821. It is possible to port existing OS/2 2.1 presentation drivers to WP-OS/2. The 
  822. new model does not replace the old one, rather it complements it.  To port a 
  823. presentation driver to WP-OS/2, it will first of all need to be converted to 
  824. 32-bit code if it is currently 16-bit code.  A high-level language should be 
  825. used to enable porting of code across hardware platforms.  As presentation 
  826. drivers, by their very nature (especially in the case of display drivers), have 
  827. hardware-dependent portions, some changes wi ll be needed to that part of the 
  828. driver if it is being ported to a non-Intel platform. 
  829.  
  830. The new presentation driver model will also be made available in the OS/2 2.x 
  831. arena so that presentation drivers can be developed to the new model to work 
  832. both under OS/2 2.x and WP-OS/2. 
  833.  
  834.  
  835. ΓòÉΓòÉΓòÉ 7.5. Keyboard/Video/Mouse APIs ΓòÉΓòÉΓòÉ
  836.  
  837. OS/2 2.1 provides a set of functions that character mode (non-PM) applications 
  838. can use to manipulate the keyboard, mouse, and screen.  Under WP-OS/2, the 
  839. majority of these functions will be provided in 32-bit form. 
  840.  
  841.  
  842. ΓòÉΓòÉΓòÉ 7.6. Summary ΓòÉΓòÉΓòÉ
  843.  
  844. In summary, the WP-OS/2 environment provides a fully-functional, 32-bit, 
  845. Presentation Manager across a wide variety of hardware platforms.  To the OS/2 
  846. application developer, simply put, this means a large increase in potential end 
  847. users and target machines.  As it is a simple task to port the Micokernel to 
  848. new hardware platforms, and as WP-OS/2 is built on top of the Microkernel, the 
  849. number of hardware platforms where the OS/2 2.1 API is available will continue 
  850. to grow and grow.  At the same time, PM applications will continue to port very 
  851. easily to each of the new platforms requiring, in most cases, no more than a 
  852. recompile. 
  853.  
  854.  
  855. ΓòÉΓòÉΓòÉ 7.6.1. About the Author ΓòÉΓòÉΓòÉ
  856.  
  857. Kelvin R. Lawrence is an Architect working on the design of IBM's Workplace OS 
  858. Graphical Subsystem.  He was the Lead Programmer for the development of the 
  859. OS/2 2.1 Presentation Manager.  Kelvin has been a key member of OS/2 
  860. development and support since 1986. 
  861.  
  862.  
  863. ΓòÉΓòÉΓòÉ 8. Cool Stuff on This Month's CD-ROM ΓòÉΓòÉΓòÉ
  864.  
  865. (This month we review Clear & Simple's new product - Performance 2.1. - ed.) 
  866.  
  867. Performance 2.1 is a unique product consisting of both a book and a set of 
  868. utilities. 
  869.  
  870. Note:  The Developer Connection CD-ROM contains an online version of the book. 
  871.  
  872. The gneralized section of the book clearly describes performance issues, such 
  873. as 32-bit preemptive multitasking, multithreading, and virtual memory operating 
  874. systems.  The detail section provides information about the meaning and 
  875. allowable values for many of OS/2's CONFIG.SYS commands and parameters. 
  876.  
  877. The REXX utilities will help you implement the suggestions in the book.  These 
  878. utilities are categorized into: 
  879.  
  880. o Optimizers that assist your system's CONFIG.SYS parameters 
  881.  
  882. o Tools that help you specifically tune individual parts of your system 
  883.  
  884. o Eliminators that help you reclaim hard disk space occupied by currently 
  885.   unused OS/2 options.  Eliminators provide you with a selective uninstall 
  886.  
  887. o Performers that help you improve your individual performance, rather than 
  888.   system performance 
  889. Performance 2.1 also includes 3000+ public-domain icons in a zipped format to 
  890. save you time and communication charges needed to download these icons from 
  891. bulletin boards. 
  892.  
  893. Performance 2.1 is for a wide range of users that will benefit from the sample 
  894. configurations outlined for minimum, average, and power systems.  This, the 
  895. utilities, REXX source code, and the 3000+ icons make it a great value. 
  896.  
  897.  
  898. ΓòÉΓòÉΓòÉ 9. Snap!  Crack!  Bang!  With OS/2 2.1 Multimedia Support (Part 2) ΓòÉΓòÉΓòÉ
  899.  
  900. by Gary G. Allran 
  901.  
  902. In the previous issue of The Developer Connection News, we described the user 
  903. interface aspect of the Audio portion to the OS/2 2.1 operating system's 
  904. multimedia support.  This quarter we continue with the description of the Video 
  905. portion of multimedia. and conclude with an overview of programming for OS/2's 
  906. rich multimedia platform. 
  907.  
  908. To access the Video Support, select either the Digital Video or Digital Video 2 
  909. object from the Multimedia folder. 
  910.  
  911.  
  912. ΓòÉΓòÉΓòÉ 9.1. Video Support ΓòÉΓòÉΓòÉ
  913.  
  914. Video has been available in the personal computer arena for quite some time. 
  915. The major drawback up to now has been cost.  Most of the video delivery 
  916. solutions have either relied on expensive video sources, such as laser video 
  917. disc, or have required expen sive video co-processor, such as the Digital Video 
  918. Interactive (DVI) chips from Intel. 
  919.  
  920. For quite some time, the search has been on for an inexpensive method for 
  921. delivering quality video on desktop systems.  Recent breakthroughs in this area 
  922. have been fueled by dramatic increases in processor speed and advances in 
  923. operating system technology. 
  924.  
  925. The Software Motion Video Playback software that is included with OS/2 2.1 has 
  926. been designed to allow pluggable Compressor/Decompressors, also known as 
  927. CODECs. We have included two CODECs with OS/2, one for Indeo and the other for 
  928. Ultimotion.  Both of the se video formats can be found in files with the .AVI 
  929. extension. 
  930.  
  931. Indeo is a CODEC that was developed by Intel and is based on the algorithms 
  932. used in the DVI products.  Much of the design of the Indeo CODEC was dictated 
  933. by the existing algorithms used in the DVI chips. 
  934.  
  935. Ultimotion is a CODEC developed by IBM.  Ultimotion was designed specifically 
  936. for software motion video playback, and was optimized for the personal computer 
  937. instruction set. 
  938.  
  939. Both of these algorithms are loosely based on a technique known as delta-frame 
  940. encoding, a method of video compression.  This video compression method 
  941. compares each frame of video with the previous frame.  As frames advance, only 
  942. those pels that change nee d be stored. 
  943.  
  944. For example, in a head shot of someone reporting the evening news, only the 
  945. area of the video window around the reporter's face change from frame to frame. 
  946. The pels that make up the backdrop need only be stored once at the beginning of 
  947. the clip, and then simply left in place as the rest of the video is played.  If 
  948. something in the background does change, it is noted during the 
  949. video-compression phase and those changed pels are included in the delta frames 
  950. along with the facial gestures. 
  951.  
  952. Generally, the more motion in a video clip, the more pel change there is from 
  953. frame to frame.  Ultimotion, for example, can easily handle a 320x240 frame 
  954. size video clip at 15 frames per second on a standard desktop system. 
  955.  
  956.  
  957. ΓòÉΓòÉΓòÉ 9.2. Multimedia Programming with OS/2 ΓòÉΓòÉΓòÉ
  958.  
  959. What we've seen so far are all features of the sample applications that are 
  960. shipped with OS/2.  It is also quite easy to exploit all of the powerful 
  961. underlying multimedia support in your own applications.  The key to writing 
  962. code to use OS/2 multimedia is a programming interface known as the Media 
  963. Control Interface. 
  964.  
  965. Media Control Interface is a high-level application programming interface (API) 
  966. that allows easy access to all of the multimedia features described previously 
  967. The concept behind the design of Media Control Interface was to provide a 
  968. simple, consistent int erface that allows control of a variety of multimedia 
  969. devices.  The same basic PLAY API is used for playback of Digital Audio, CD-DA, 
  970. MIDI, and Software Motion Video. 
  971.  
  972. The Media Control Interface commands are all also available as a string 
  973. interface.  This creation of a prototype allows for easy inclusion of 
  974. multimedia content in existing applications.  For example, the following string 
  975.  
  976. "PLAY CDAUDIO FROM 10000 TO 20000"
  977.  
  978. would caus e the CD-ROM player to start playing at the 10-second point (10 
  979. seconds = 10,000 milliseconds) and stop at the 20-second point. 
  980.  
  981. A REXX interface to Media Control Interface has also been included with the 
  982. OS/2 multimedia support.  Documentation, as well as some sample REXX command 
  983. files, are included. 
  984.  
  985.  
  986. ΓòÉΓòÉΓòÉ 9.3. Summary ΓòÉΓòÉΓòÉ
  987.  
  988. This article presents just a sample of the multimedia features available in 
  989. OS/2 2.1.  The OS/2 2.1 Developer's Toolkit, MMPM/2, and MMPM/2 Developer's 
  990. Toolkit are available on your Developer Connection CD-ROM.  In addition, an 
  991. evaluation copya of the Video IN product is also included on the CD-ROM. 
  992.  
  993. So, install the appropriate components and have a good time! 
  994.  
  995.  
  996. ΓòÉΓòÉΓòÉ 9.3.1. About the Author ΓòÉΓòÉΓòÉ
  997.  
  998. Gary G. Allran is the Manager of OS Technical Marketing and Support. Gary has 
  999. held a variety of roles since joining IBM in 1982, including OS/2 Multimedia 
  1000. Evangelist and Audio Subsystem Architect. 
  1001.  
  1002.  
  1003. ΓòÉΓòÉΓòÉ 10. Modifying Your PM Programs for Pen for OS/2 ΓòÉΓòÉΓòÉ
  1004.  
  1005. by Vera Dulaney and Kevin Lee 
  1006.  
  1007. Last quarter, we provided an overview of how to best use Pen for OS/2.  This 
  1008. quarter, we pick up on that concept and describe how to modify a Presentation 
  1009. Manager (PM) program to be pen-aware and, if modification is not possible, we 
  1010. also describe how to write a gesture command handler for an existing PM 
  1011. program. 
  1012.  
  1013.  
  1014. ΓòÉΓòÉΓòÉ 10.1. To Recap... ΓòÉΓòÉΓòÉ
  1015.  
  1016. Pen for OS/2 gives the computer users a much more intuitive pointing device 
  1017. over a mouse.  Existing Presentation Manager (PM) applications can easily be 
  1018. modified to make use of the pen interface. 
  1019.  
  1020. When a menu item is selected from a PM application window, the WM_COMMAND 
  1021. message is sent to its window procedure.  Similarly, in a Pen for OS/2 system, 
  1022. when a gesture is given on a PM window, the WM_RECO message is sent to its 
  1023. window procedure.  Therefore, Pen for OS/2 performs the actions specified by 
  1024. the gesture.  If your application wants to handle the gesture by itself, it 
  1025. must process the WM_RECO message, returning to PM with the RECO_PROCESSED 
  1026. message. 
  1027.  
  1028. If you do not want to modify your PM application to handle a gesture, your 
  1029. application was already distributed, or no way exists to recall, modify, or 
  1030. redistribute it, but you still want to handle a gesture within your 
  1031. application, you can write a separate command handler.  Then, put this command 
  1032. handler name in the gesture setting of your application.  When a gesture is 
  1033. given on your application window, Pen for OS/2 initiates this command handler 
  1034. to take care of the gesture. 
  1035.  
  1036.  
  1037. ΓòÉΓòÉΓòÉ 10.2. Recognizing the Pen ΓòÉΓòÉΓòÉ
  1038.  
  1039. For all gestures given on an PM window (even if the gesture is not recognized 
  1040. by Pen for OS/2), the WM_RECO message is sent to the window program.  Like 
  1041. other PM messages, the WM_RECO message has 2 parameters, mp1 and mp2.  The mp1 
  1042. parameter has the window coordinate of the hot spot of a gesture; the mp2 
  1043. parameter has the address of RECODATA structure.  Each gesture has its own hot 
  1044. spot.  The WM_RECO message is sent to the window that has the hot spot.  The 
  1045. RECODATA structure has 13 fields; however, this article explains only the two 
  1046. most common, HRECO and RECOID.  For an explanation of the other fields, please 
  1047. see the PENPM.H file in Pen for OS/2 Developer's Toolkit, which is on your 
  1048. accompanying Developer Connection CD-ROM. 
  1049.  
  1050. The HRECO field is the Recognition subsystem handle.  Pen for OS/2 Version 1.0 
  1051. supports only the Gesture subsystem.  Future Pen for OS/2 releases might also 
  1052. include support for the Voice subsystem. 
  1053.  
  1054. The RedQueryRecoSubsystem API takes the handle as input and returns the 
  1055. subsystem name, as well as the number of events in the subsystem.  The RECOID 
  1056. field is an Event ID of the recognition subsystem.  The RedRecoNameFromID API 
  1057. uses the HRECO and RECOID fields, and returns the event name.  For example, if 
  1058. the HRECO is 1 and RECOID is 6, the Pigtail gesture name is returned.  The 
  1059. application writer can do whatever is needed with the subsystem and its event 
  1060. ID. 
  1061.  
  1062. For the unrecognized gesture, a NULL event name will be returned by the 
  1063. RedRecoNameFromID API.  While you process the WM_RECO message, do not give a 
  1064. message or a dialog box.  This will cause a deadlock to occur.  If you have to 
  1065. give the box, simply post a message to yourself, then give the box while you 
  1066. process the message.  After you process the WM_RECO message, return to PM with 
  1067. RECO_PROCESSED.  Then, Pen for OS/2 knows that the application has handled the 
  1068. gesture.  The sample code shows the WM_RECO message handler in the client 
  1069. window.  For more information, please check the WMRECO program in the Pen for 
  1070. OS/2 Developer's Toolkit sample program. 
  1071.  
  1072. #define   RECO_MSG   WM_USER + 1
  1073.  MRESULT EXPENTRY ClientWndProc( HWND hwnd, ULONG msg, MPARAM
  1074.         mp1, MPARAM mp2 )
  1075.  {
  1076.  USHORT         usXpos, usYpos;
  1077.  ULONG  ulEventCnt;
  1078.  CHAR   achRecoSubsys[15], achRecoEvent[15];
  1079.  static RECODATA  rcData;
  1080.  
  1081.     switch ( msg )
  1082.     {
  1083.        case WM_RECO:
  1084. /*********************************************************************
  1085. *  The MP1 has hot spot in window coordinate, NOT in screen          *
  1086. *  coordinate.                                                       *
  1087. *********************************************************************/
  1088.           usXPos = SHORT1FROMMP( mp1 );
  1089.           usYPos = SHORT2FROMMP( mp1 );
  1090.  
  1091. /*********************************************************************
  1092. *  The MP2 has pointer to RECODATA and copy it to local memory       *
  1093. *  because it is good while the WM_RECO message is processed.        *
  1094. *********************************************************************/
  1095.           rcData = * ( RECODATA * ) PVOIDFROMMP( mp2 );
  1096.  
  1097. /**********************************************************************
  1098. *  There are 3 pointers in RECODATA pointing to command,              *
  1099. *  argument, and prefix command. You have to allocate memory          *
  1100. *  to retrieve them while the WM_RECO message is processed.           *
  1101. **********************************************************************/
  1102.  
  1103. /*********************************************************************
  1104. *  Get the Reco subsystem name and number of events from handle.     *
  1105. *********************************************************************/
  1106.           RedQueryRecoSubsystem( rcData.hReco, achRecoSubsys, &ulEventCnt );
  1107.  
  1108. /*********************************************************************
  1109. *  Get the Event Name.                                               *
  1110. *********************************************************************/
  1111.           RedRecoNameFromID( hReco, rcData.rID, achRecoEvent );
  1112.  
  1113. /*********************************************************************
  1114. *  You can do whatever you would like to do with the gesture.        *
  1115. *  If you have to give a message box, post a message to yourself     *
  1116. *  Do NOT send the message.                                          *
  1117. *********************************************************************/
  1118.           WinPostMsg( hwnd, RECO_MSG, mp1, mp2 );
  1119.  
  1120.           return( ( MRESULT ) RECO_PROCESSED );
  1121.  
  1122.        case RECO_MSG:
  1123. /*********************************************************************
  1124. *  A message box can be given here without deadlock.                 *
  1125. *********************************************************************/
  1126.  
  1127.     }
  1128.  }
  1129.  
  1130.  
  1131. ΓòÉΓòÉΓòÉ 10.3. Writing a Pen for OS/2 Command Handler ΓòÉΓòÉΓòÉ
  1132.  
  1133. You can write a command handler for an application and put the handler name in 
  1134. the gesture setting of the application.  When a gesture is given on the 
  1135. application window, Pen for OS/2 initiates the command handler, retrieve the 
  1136. RECODATA, and perform an action required for the gesture.  For a subsequent 
  1137. gesture given on the application window, WM_RECO_COMMAND is sent to the command 
  1138. handler window procedure.  In this way, any actions required for the gestures 
  1139. can be done by the handler, not by Pen for OS/2. 
  1140.  
  1141. The following explains how to assign the command handler to the gesture setting 
  1142. of the application: 
  1143.  
  1144. o On the Workplace Shell desktop, click the right mouse button on the 
  1145.   application icon. 
  1146.  
  1147. o Select the right arrow in Open item, and then select Settings.  The settings 
  1148.   dialog window appears and the Gesture setting page is added by Pen for OS/2. 
  1149.   In this page, from the listbox of all gestures, you can give your command 
  1150.   handler name to any gestures. 
  1151.  
  1152. o To set a command handler to a gesture, highlight the gesture and select the 
  1153.   Edit button.  Another dialog window appears with Command and Parameters 
  1154.   fields. 
  1155.  
  1156. You can put the command handler name (without the .EXE extension) in the 
  1157. Command field.  If the command handler is not in a directory identified on the 
  1158. PATH= parameter in your CONFIG.SYS file, you must include its full path name. 
  1159. Any parameters put in the Parameters field are in argv of command handler. 
  1160. Several gestures can share one command handler or each gesture can have its own 
  1161. command handler.  Up to 20 command handlers can run at any time. 
  1162.  
  1163. When the command handler is initiated, it registers itself as a command handler 
  1164. using the RedRegisterRecoCommand API.  Pen for OS/2 saves the command handler 
  1165. name in its internal table.  After the registration, it calls the 
  1166. RedRecoDataFromEnv API to retrieve the RECODATA structure.  The Command, 
  1167. Parameter, and Prefix Command fields pointed to by three pointer fields in 
  1168. RECODATA are attached after the RECODATA, so this API must have a large buffer. 
  1169.  
  1170. Like a Pen-aware application, the command handler can use the HRECO and RECOID 
  1171. in RECODATA to retrieve subsystem and event names.  When subsequent gesture is 
  1172. given on the application window, Pen for OS/2 checks the gesture setting of the 
  1173. subsequent gesture to get the command handler name and, if it cannot find the 
  1174. command handler in its internal table, it initiates another command handler. 
  1175. Otherwise it sends the WM_RECO_COMMAND message to the running command handler. 
  1176. The processing of this message is same as the WM_RECO message, except for the 
  1177. mp1 parameter. 
  1178.  
  1179. If any file is accessed inside the command handler, use the full path name of 
  1180. the file.  The DosQueryCurrentDisk and DosQueryCurrentDir APIs usually give a 
  1181. root directory of the boot disk, but not always. 
  1182.  
  1183. An example of the Client Window procedure of a command handler follows.  For 
  1184. command handler details, please see the RECODISP sample program in the Pen for 
  1185. OS/2 Developer's Toolkit. 
  1186.  
  1187.  #define    WM_RECO_INFO     WM_USER + 2
  1188.  #define    CMD_STR          "recocmd"
  1189.  #define    ID_CMD           1
  1190.  MRESULT EXPENTRY ClientWndProc( HWND hwnd, ULONG msg, MPARAM mp1,
  1191.          MPARAM mp2 )
  1192.  {
  1193.  ULONG           nLen;
  1194.  static RECODATA *pRecodata;
  1195.  
  1196.    switch( msg )
  1197.    {
  1198.       case WM_CREATE:
  1199.       {
  1200.          /*****************************************************************
  1201.          * Register Reco command handler in PenPM.                        *
  1202.          * If you have another command handler running and if you want to *
  1203.          * remove it, the RedQueryRecoCommand and                         *
  1204.          * RedDeregisterRecoCommand API's can be used.                    *
  1205.          *****************************************************************/
  1206.          RedRegisterRecoCommand( CMD_STR, ID_CMD, hwnd )  ;
  1207.  
  1208.          /*****************************************************************
  1209.          * Retrieve RECODATA from environment.                            *
  1210.          * First put NULL for the buffer pointer to get the actual size.  *
  1211.          * If NULL is given as buffer pointer, then NO error returned.    *
  1212.          *****************************************************************/
  1213.          nLen = 0;
  1214.          RedRecoDataFromEnv( NULL, &nLen );
  1215.  
  1216.          /******************************************************************
  1217.          *  The actual length of data is returned in nLen.                 *
  1218.          ******************************************************************/
  1219.          pRecodata = ( RECODATA * ) malloc( nLen );
  1220.          RedRecoDataFromEnv( pRecodata, &nLen );
  1221.  
  1222.          /*******************************************************************
  1223.          *  When the RECODATA is retrieved from environment, the Command,   *
  1224.          *  Argument, and PrefixCommand are attached after the RECODATA.    *
  1225.          *  So, the pszCmd points after the RECODATA, the pszArg points     *
  1226.          *  after the command data, and so forth.                           *
  1227.          *  All three data are terminated by NULL character.                *
  1228.          *  But the retrieval of RECODATA by WM_RECO_COMMAND message is     *
  1229.          *  quite different. Please check the message below.                *
  1230.          *******************************************************************/
  1231.          break;
  1232.       }
  1233.  
  1234.       case WM_RECO_COMMAND:
  1235.       {
  1236.          /*******************************************************************
  1237.          *  Replace this message handling code with yours for your own      *
  1238.          *  command handler. Handling of this message is similar to that of *
  1239.          *  the WM_RECO message for Pen for OS/2 aware application.         *
  1240.          *******************************************************************/
  1241.  
  1242.          /*******************************************************************
  1243.          * Copy the RECODATA.                                               *
  1244.          *******************************************************************/
  1245.          *pRecodata = * ( RECODATA * ) PVOIDFROMMP( mp2 );
  1246.  
  1247.          /*******************************************************************
  1248.          *  The RECODATA is retrieved, but the command, argument, and       *
  1249.          *  prefix command must be copied too.  These data are valid        *
  1250.          *  while the WM_RECO_COMMAND message is processed.                 *
  1251.          *******************************************************************/
  1252.  
  1253.          /*******************************************************************
  1254.          * Do NOT call WinMessageBox or WinDlgBox because deadlock can      *
  1255.          * occur. Post a message to yourself, do NOT send it.               *
  1256.          *******************************************************************/
  1257.          WinPostMsg( hwnd, WM_RECO_INFO, NULL, NULL );
  1258.          return( ( MRESULT ) ( TRUE ) );
  1259.       }
  1260.  
  1261.       case WM_RECO_INFO:
  1262.          /*******************************************************************
  1263.          *  A message or dialog box can be given here.                      *
  1264.          *******************************************************************/
  1265.          return FALSE;
  1266.  
  1267.    }
  1268.    return FALSE;
  1269.  }
  1270.  
  1271.  
  1272. ΓòÉΓòÉΓòÉ 10.3.1. About the Authors ΓòÉΓòÉΓòÉ
  1273.  
  1274. Vera Dulaney  is the Manager of Pen Development, where she manages both the 
  1275. development of Pen for OS/2 and the delivery of Pen and Speech to the Workplace 
  1276. OS platform. 
  1277.  
  1278. Kevin Lee  is a Staff Programmer in the Mobil, Voice, and Pen Development. 
  1279. Keven has worked on Compilers, Toolkit Sample programs, and OS/2. 
  1280.  
  1281.  
  1282. ΓòÉΓòÉΓòÉ 11. Maximizing the Audio Support in OS/2 2.1 ΓòÉΓòÉΓòÉ
  1283.  
  1284. by Linden deCarmo 
  1285.  
  1286.  
  1287. ΓòÉΓòÉΓòÉ 11.1. Introduction ΓòÉΓòÉΓòÉ
  1288.  
  1289. One of the most notable additions to the OS/2 2.1 operating system is its 
  1290. exciting multimedia capabilities.  This multimedia support, called MMPM/2, 
  1291. includes a robust, multihreaded transportation layer, seamless data translation 
  1292. support, and an ever-growing number of media drivers.  Because considerable 
  1293. number of machines now come with audio cards, application developers must 
  1294. either take advantage of the new hardware or risk losing market share. 
  1295.  
  1296. This article describes how you can incorporate key audio features to enhance 
  1297. your product - whether it's a REXX utility, shareware game, or mission critical 
  1298. application 
  1299.  
  1300.  
  1301. ΓòÉΓòÉΓòÉ 11.2. Easy As a VCR ΓòÉΓòÉΓòÉ
  1302.  
  1303. MMPM/2 uses the Media Control Interface as the primary method of incorporating 
  1304. multimedia into OS/2 programs.  These commands are very similar to your VCR 
  1305. (for example, play, record, rewind, and stop), and if you use this 32-bit API 
  1306. set, your application will run not only on the current Intel x86 platform, but 
  1307. also RISC-based systems (such as the PowerPC) under Workplace OS.  This 
  1308. portable API set has two primary interfaces:  the string interface and the 
  1309. procedural interface. 
  1310.  
  1311. The string interface lets applications send command strings to OS/2 without 
  1312. having to write any C or Pascal code.  This method is excellent for batch 
  1313. languages, as well as for quickly creating programs in C or C++ (MMPM/2 even 
  1314. comes with some excellent REXX command examples).  For instance, the string in 
  1315. quotes below can be used with REXX to play an audio file. 
  1316.  
  1317. mciRxSendString("play \mmos2\sounds\laser.wav wait", 'RetSt', '0', '0')
  1318.  
  1319. If you want to experiment with the string interface without the overhead of 
  1320. compiling a program or writing a command file the MMPM/2 toolkit comes with an 
  1321. excellent testing application, MCISTRNG, that lets you send string commands. 
  1322. Check out the MMPM/2 Toolkit that is available on your CD-ROM. 
  1323.  
  1324.  
  1325. ΓòÉΓòÉΓòÉ 11.3. Can REXX Learn New Tricks? ΓòÉΓòÉΓòÉ
  1326.  
  1327. All string interface commands can be used from REXX through the mciRxSendString 
  1328. call.  Syntax and theory of the string interface can be found in the Multimedia 
  1329. Presentation Programming Reference or Multimedia with REXX online reference 
  1330. provided with MMPM/2. The example command file that follows shows how to modify 
  1331. a makefile to boo if the compile is unsuccessful and cheer if things went well. 
  1332.  
  1333. nmake
  1334. :main
  1335. if ERRORLEVEL 1 goto error
  1336. play FILE=\mmos2\sounds\cheer.wav
  1337. goto quit
  1338. :error
  1339. play FILE=\mmos2\sounds\boo.wav
  1340. :quit
  1341.  
  1342. You can use the new Multimedia Control Interface clipboard functions with 
  1343. PMREXX, VisPro/REXX, or VX REXX programs to communicate with other programs and 
  1344. edit audio files with very little code.  These clipboard commands also work on 
  1345. Ultimotion or Indeo v ideo files, if you have the Ultimedia Video IN product 
  1346. (the Video IN beta was included on the last Developer Connection and an 
  1347. evaluation copy is available on this quarter's CD-ROM).  The following REXX 
  1348. example copies the start of the waveform (.WAV) file onto the clipboard and 
  1349. pastes that information repeatedly at the end of the file to create a Max 
  1350. Headroom effect. 
  1351.  
  1352. RXFUNCADD ( 'mciRxInit', 'MCIAPI', 'mciRxInit')
  1353. InitRC=mciRxInit ();
  1354. mciRxSendString("open \mmos2\sounds\laser.wav alias a wait", 'RetSt', '0', '0')
  1355. mxiRxSendString("copy a from 0 to 3000 wait", 'RetSt', '0','0')
  1356. mciRxSendString("seek a to end wait", 'RetSt', '0','0')
  1357. mciRxSendString("paste a wait", 'RetSt', '0','0')
  1358. mciRxSendString("paste a wait", 'RetSt', '0','0')
  1359. mciRxSendString("paste a wait", 'RetSt', '0','0')
  1360.  
  1361.  
  1362. ΓòÉΓòÉΓòÉ 11.4. Procedural Interface ΓòÉΓòÉΓòÉ
  1363.  
  1364. The procedural interface is the traditional means for accessing MMPM/2.  It is 
  1365. available from C, C++, Smalltalk, and other languages that support dynamic link 
  1366. libraries.  The procedural interface (or the string interface from C or C++) 
  1367. gives the developer complete access to all multimedia commands and messages, 
  1368. notification of all events, and the ability to maximize the multithreaded 
  1369. nature of MMPM/2. 
  1370.  
  1371.  
  1372. ΓòÉΓòÉΓòÉ 11.5. Full Multimedia API ΓòÉΓòÉΓòÉ
  1373.  
  1374. MMPM/2 contains a very sophisticated resource manager and is the first 
  1375. multimedia environment that lets an infinite number of applications 
  1376. simultaneously open an audio device.  As a contrast to Windows, MMPM/2 does not 
  1377. force you to open and close the device on a constant basis to allow other 
  1378. applications to share the .WAV device.  A good MMPM/2 program opens the device 
  1379. in a shareable mode and processes the MM_MCIPASSDEVICE message. 
  1380.  
  1381. If the MCI_OPEN_SHAREABLE flag is not passed to MCI_OPEN,other devices cannot 
  1382. use the device while you have it open.  Unless you need the device exclusively, 
  1383. use the shareable flag when opening.  If you must have the device exclusively 
  1384. for a period of time (for example, recording audio data), always open the 
  1385. device in shareable mode, send an MCI_ACQUIRE to obtain it exclusively, and 
  1386. perform the necessary action.  Use MCI_RELEASE to release the device. 
  1387.  
  1388. If your application receives the MM_MCIPASSDEVICE message (with MCI_LOSING_USE 
  1389. in ulMsgParam2 field), another application has taken the device from you. 
  1390. Reacquire the device using MCI_ACQUIRE before sending another command.  The 
  1391. following example illustrates this. 
  1392.  
  1393.  
  1394.       /*
  1395.        * The next two messages are handled so that the audio recorder
  1396.        * application can participate in device sharing.   We keep track of this device passing in
  1397.        * the fPassedDevice boolean variable.
  1398.        *
  1399.        * If we do not have access to the device when we receive an WM_ACTIVATE
  1400.        * message, then we will issue an acquire device command to gain
  1401.        * access to the device.
  1402.        *
  1403.        * For applications that are more complex
  1404.        * than this sample program, developers may wish to take
  1405.        * advantage of a more robust method of device sharing.
  1406.        * This can be done by using the MCI_ACQUIRE_QUEUE flag on
  1407.        * the MCI_ACQUIREDEVICE command.  Please refer to the MMPM/2
  1408.        * documentation for more information on this flag.
  1409.        */
  1410.  
  1411.       case MM_MCIPASSDEVICE:
  1412.          if (SHORT1FROMMP(mp2) == MCI_GAINING_USE)      /* GAINING USE */
  1413.          {
  1414.              fPassed Device = FALSE                     /* Gaining control of device.*/
  1415.   // Once we receive the gaining use message, we can send commands to the device.  See the MMPM/2
  1416.   // toolkit for more information.
  1417.          }
  1418.          else                                           /* LOSING USE */
  1419.          {
  1420.              fPassedDevice = TRUE;                      /* Losing control of device */
  1421.  
  1422.   // Once we receive the losing use message, we can no longer send commands to
  1423.   // the device until we re-acquire it.
  1424.          }
  1425. return ( WinDefSecondaryWindowProc( hwnd, msg, mp1, mp2 ) );
  1426.  
  1427. Although most Media Control Interface commands are available from the string 
  1428. interface, some are not.  They require pointers or other items which don't 
  1429. translate into English.  An example of such a command is MCI_COPY.  The basic 
  1430. MCI_COPY command is available via the string interface; however, a more 
  1431. advanced version lets you actually transfer the contents of a buffer to the 
  1432. clipboard.  The following code segment reads part of a .WAV file into a buffer 
  1433. so it can be copied into the clipboard. 
  1434.  
  1435. HMMIO          hmmio;
  1436. MCI_EDIT_PARMS mep;
  1437. PVOID          pBuffer;
  1438. MMAUDIOHEADER  mmaudioheader;
  1439. USHORT         usDeviceID;
  1440.  
  1441. /* usDeviceID was obtained via MCI_OPEN */
  1442. /* mmaudioheader was filled in with mmioGetHeader call */
  1443.  
  1444. /* Read the info necessary to copy into the clipboard */
  1445.  
  1446. lReturnCode = mmioRead( hmmio,
  1447.                         ( PSZ ) pBuffer,
  1448.                         60000 );
  1449.  
  1450. if ( lReturnCode == MMIO_ERROR )
  1451.    {
  1452.    ulrc = mmioGetLastError( hmmio );
  1453.    return ( ulrc );
  1454.    }
  1455.  
  1456. A final advantage of using the procedural interface (or the string interface 
  1457. from C or C++) over REXX is the ability to take advantage of the multithreaded 
  1458. nature of the MMPM/2.  In the DOS world, programmers must constantly poll the 
  1459. device to find out it s current position in the file.  By contrast, MMPM/2 
  1460. offers a significant alternative to the polling approach - 
  1461. MCI_SETPOSITIONADVISE and MCI_SETCUEPOINT. 
  1462.  
  1463. Using MCI_SETPOSITIONADVISE, MMPM/2 informs applications on a periodic basis 
  1464. the device's media position when playing or recording an audio or video file 
  1465. (this is similar to the WM_TIMER message, but much more accurate, because it is 
  1466. media based).  MCI_SET CUEPOINT lets you set up single a notification, rather 
  1467. than recurring notifications, about the media position of the audio device. 
  1468.  
  1469.  
  1470. ΓòÉΓòÉΓòÉ 11.6. Adventure is Just Beginning ΓòÉΓòÉΓòÉ
  1471.  
  1472. We have only touched on the myriad of audio features available in the OS/2 2.1 
  1473. operating system (not to mention the exciting software motion video support 
  1474. that will be covered in a future article).  I encourage you to explore the 
  1475. multimedia toolkit and us e the appropriate APIs in order to bring your 
  1476. application into the exciting age of multimedia computing! 
  1477.  
  1478.  
  1479. ΓòÉΓòÉΓòÉ 11.6.1. About the Author ΓòÉΓòÉΓòÉ
  1480.  
  1481. Linden deCarmo is a Senior Associate Programmer in the Workplace OS multimedia 
  1482. development and has been with IBM since 1991.  He is an active supporter of 
  1483. multimedia developers on Internet, CompuServe, and the IBM BBS. He can be 
  1484. reached at lad@vnet.ibm.com. 
  1485.  
  1486.  
  1487. ΓòÉΓòÉΓòÉ 12. Looking for a great sound card? ΓòÉΓòÉΓòÉ
  1488.  
  1489. Look no further...OS/2 2.1 comes with support for the following sound cards: 
  1490.  
  1491. Media Vision: Proaudio Spectrum, Proaudio Studio, Proaudio Basic 
  1492.  
  1493. IBM: Maudio  adapter 
  1494.  
  1495. Creative Labs:  SoundBlaster, SoundBlaster Pro, SoundBlaster 16 and 
  1496. SoundBlaster 16ASP 
  1497.  
  1498.  
  1499. ΓòÉΓòÉΓòÉ 13. 32-Bit OS/2 Exception Management ΓòÉΓòÉΓòÉ
  1500.  
  1501. by Monte Copeland 
  1502.  
  1503. Under 16-bit OS/2 architecture, a process cannot handle access violations and 
  1504. certain other exceptions; the system invariably terminates the process.  The 
  1505. only choice a program has is to register an exit-list function using the 
  1506. DosExitList() API.  Then, at process-termination time, OS/2 calls each of the 
  1507. registered exit-list functions, and they perform cleanup before the termination 
  1508. of the process.  This approach is process-granular.  It allows for cleanup, but 
  1509. not recovery. 
  1510.  
  1511. Under the 32-bit OS/2 environment, the approach is thread-granular.  OS/2 keeps 
  1512. a chain of exception handler functions for every thread.  When a thread causes 
  1513. an exception, OS/2 walks the chain and calls each of the functions until one 
  1514. reports "handled".  If no function handles the exception, the system takes 
  1515. default action.  For many exceptions, the default action is process 
  1516. termination. 
  1517.  
  1518. The exception management APIs are new in the 32-bit OS/2 operating system. They 
  1519. are available to 32-bit executables and dynamic link libraries (DLLs). OS/2 
  1520. designers intend for 32-bit exception management to be hardware-independent, to 
  1521. be a superset of traditional 16-bit exit-list processing, to encompass 16-bit 
  1522. signals, and to provide thread-granular recovery of exceptions. 
  1523.  
  1524. Figure 1.  Chain of Exception Registration Records.  A pointer to the 
  1525. first record in the chain is stored in the thread information block (TIB)
  1526. structure.
  1527.  
  1528. This article describes the following exception handler scenarios: 
  1529.  
  1530. o A function recovers from the error and reports "handled" by returning 
  1531.   XCPT_CONTINUE_EXECUTION.  The function continues to execute. 
  1532.  
  1533. o A function does not handle the exception and reports "not handled" by 
  1534.   returning XCPT_CONTINUE_SEARCH.  Other handlers in the chain get a chance to 
  1535.   handle the exception. 
  1536.  
  1537. o The third option is graceful failure.  This approach is nicely suited for 
  1538.   worker functions in EXEs and DLLs that must remain robust in spite of bad 
  1539.   parameters or killed threads. 
  1540.  
  1541.  
  1542. ΓòÉΓòÉΓòÉ 13.1. Adding a Handler to the Chain ΓòÉΓòÉΓòÉ
  1543.  
  1544. Use the API DosSetExceptionHandler() to insert an exception handler for the 
  1545. calling thread.  This API performs an insert-at-head operation; therefore, the 
  1546. last handler inserted is the first one called at exception time.  It is quite 
  1547. possible for one handler to serve numerous threads, but each thread must call 
  1548. DosSetExceptionHandler(). 
  1549.  
  1550. The OS/2 Developer's Toolkit defines a exception registration record structure 
  1551. called EXCEPTIONREGISTRATIONRECORD, but you can define your own.  See Figure 1. 
  1552. (More later on why that is a good thing to do.)  The absolute minimum exception 
  1553. registration record is a structure that contains two 32-bit pointers: a pointer 
  1554. to the next exception registration record in the chain and a pointer to the 
  1555. handler function. 
  1556.  
  1557. // Bare-bones exception registration record
  1558. // See also \toolkt20\c\os2h\bsexcpt.h
  1559. typedef struct _regrec {
  1560.         PVOID   pNext;
  1561.         PFN     pfnHandler;
  1562. } REGREC;
  1563. typedef REGREC *PREGREC;
  1564.  
  1565. // A prototype for an exception handler function
  1566. ULONG _System HandlerFunction( PEXCEPTIONREPORTRECORD           p1,
  1567.                                PREGREC                          p2,
  1568.                                PCONTEXTRECOR  D                 p3,
  1569.                                PVOID                            p4 );
  1570.  
  1571. Figure 1.  REGREC definition and handler function prototype 
  1572.  
  1573. Assign the pointer regrec.pfnHandler then call the DosSetExceptionHandler() 
  1574. API.  The system assigns regrec.pNext.  See Figure 2. 
  1575.  
  1576. REGREC regrec;
  1577. . . .
  1578. regrec.pfnHandler = (PFN)HandlerFunction;
  1579. rc = DosSetExceptionHandler( (PEXCEPTIONREGISTRATIONRECORD)®rec );
  1580. assert( 0 == rc );
  1581.  
  1582. Figure 2. Code fragment shows REGREC declaration and use.
  1583.  
  1584.  
  1585. ΓòÉΓòÉΓòÉ 13.2. Recoverable Exceptions ΓòÉΓòÉΓòÉ
  1586.  
  1587. When an exception handler returns handled, the handler has recovered from the 
  1588. exception, and execution resumes at the point of the exception. 
  1589.  
  1590. One scenario involving recoverable exceptions is NPX (80387) emulation.  For 
  1591. example, compile a program with hardware floating-point instructions, and run 
  1592. it on a system without a floating-point coprocessor.  Executing the 
  1593. floating-point instruction causes OS/2 to raise a coprocessor-not-available 
  1594. exception. 
  1595.  
  1596. An exception handler emulates the floating-point instruction in software.  In 
  1597. fact, this scenario describes one of OS/2's default exception handlers.  Code 
  1598. compiled with floating-point instructions runs under OS/2 on systems without a 
  1599. math coprocessor. 
  1600.  
  1601. Another scenario involves sparse allocation of memory.  In 32-bit OS/2, 
  1602. DosAllocMem() allocates memory in a collection of 4K pages.  (The size of every 
  1603. DosAllocMem allocation is always rounded up to the next higher multiple of 4K.) 
  1604. The pages within a memory allocation can have different attributes: notable 
  1605. ones are committed and invalid.  The DosSetMem() API lets you commit individual 
  1606. pages within a memory allocation. 
  1607.  
  1608. Sample Program 1 uses the DosSetMem() API in an exception handler to commit 
  1609. memory as it is referenced.  The sample program allocates a memory object such 
  1610. that no pages are committed.  Then, it writes to the memory.  This causes a 
  1611. page fault, and the system delivers an exception to the handler.  The handler 
  1612. commits the memory, returns handled, and the system restarts the instruction. 
  1613.  
  1614. /* SPARSE.C.  This program allocates a one MB memory object but commits no pages.  */  The program then writes to that memory which is invalid, and this causes a trap.  The handler commits the invalid page and resumes execution.
  1615. /* Compile and link this program with:  icc /Ss sparse.c                           */
  1616.  
  1617. // os2 includes
  1618. #define INCL_DOS
  1619. #define INCL_ERRORS
  1620. #include <os2.h>
  1621.  
  1622. // c includes
  1623. #include <stdio.h>
  1624. #include <stdlib.h>
  1625. #include <string.h>
  1626. #include <assert.h>
  1627.  
  1628. // Exception handler registration record
  1629. typedef struct _regrec {
  1630.   PVOID pNext;
  1631.   PFN   pfnHandler;
  1632. } REGREC;
  1633. typedef REGREC *PREGREC;
  1634.  
  1635. // ----------------------------------------------------------------------
  1636. ULONG _System Handler( PEXCEPTIONREPORTRECORD p1,
  1637.                        PREGREC p2,
  1638.                        PCONTEXTRECORD p3,
  1639.                        PVOID pv )
  1640. {
  1641.   // Interested in access violation
  1642.   if( p1->ExceptionNum == XCPT_ACCESS_VIOLATION  ) {
  1643.     assert( p1->ExceptionInfo[0] == XCPT_WRITE_ACCESS );
  1644.     // Try to commit the referenced page
  1645.     if( 0 == DosSetMem( (PVOID)p1->ExceptionInfo[1], 1, PAG_COMMIT|PAG_WRITE )) {
  1646.       // Successful commit; resume execution
  1647.       return XCPT_CONTINUE_EXECUTION;
  1648.     }
  1649.   }
  1650.   // Not handled, let other handlers in the chain have the exception
  1651.   return XCPT_CONTINUE_SEARCH;
  1652. }
  1653.  
  1654. // ----------------------------------------------------------------------
  1655. int main ( void )
  1656. {
  1657.   APIRET      rc;
  1658.   PCHAR       pchar;
  1659.   PSZ         psz;
  1660.   PVOID       pvBase;
  1661.   REGREC      regrec;
  1662.  
  1663.   // Insert exception handler into the chain of handlers for this thread
  1664.   regrec.pfnHandler = (PFN)Handler;
  1665.   rc = DosSetExceptionHandler( (PEXCEPTIONREGISTRATIONRECORD) ®rec );
  1666.   assert( rc == 0 );
  1667.  
  1668.   // Allocate a memory object without committing any of it;
  1669.   // Note lack of PAG_COMMIT flag
  1670.   rc = DosAllocMem(  &pvBase, 1048576, PAG_WRITE );
  1671.   assert( rc == 0 );
  1672.  
  1673.   // This causes an exception since the page is not committed
  1674.   pchar = (PCHAR)pvBase;
  1675.   *pchar = 'a';
  1676.  
  1677.   // This string copy causes two more exceptions
  1678.   psz = (PSZ)pvBase + (4096 + 4092);
  1679.   strcpy( psz, "This string crosses a 4K page boundary." );
  1680.  
  1681.   // Reference the memory
  1682.   printf( "%c\n", *pchar );
  1683.   printf( "%s\n", psz );
  1684.  
  1685.   // Free memory object
  1686.   rc = DosFreeMem( pvBase );
  1687.   assert( rc == 0 );
  1688.  
  1689.   // Unlink handler before returning
  1690.   rc = DosUnsetExceptionHandler( (PEXCEPTIONREGISTRATIONRECORD) ®rec );
  1691.   assert( rc == 0 );
  1692.  
  1693.   return 0;
  1694. }
  1695.  
  1696. Sample Program 1:  sparse.c
  1697.  
  1698.  
  1699. ΓòÉΓòÉΓòÉ 13.3. Graceful Failure - When Good Threads Go Bad ΓòÉΓòÉΓòÉ
  1700.  
  1701. Some exceptions are not so easy to restart.  Can an exception handler fix a bad 
  1702. pointer during a general protection fault?  Probably not.  Should an exception 
  1703. handler choose a new divisor after division by zero?  No.  The operation must 
  1704. fail - but gracefully. 
  1705.  
  1706. Graceful failure is important to APIs.  API worker functions must return 
  1707. sensible, failing result codes to the caller in error situations. 
  1708.  
  1709. Worker functions use an exception handler like a safety net.  If a thread goes 
  1710. bad while executing a function, the safety net is there to catch it.  For the 
  1711. net to be in place, the worker function registers a handler at function entry 
  1712. and removes it at function exit.  The overhead is small, and it is worth the 
  1713. robustness gained. 
  1714.  
  1715.  
  1716. ΓòÉΓòÉΓòÉ 13.4. Getting There from Here ΓòÉΓòÉΓòÉ
  1717.  
  1718. In Sample Program 1, OS/2 lifts the thread from the point of the exception, 
  1719. makes it call the exception handler, then drops it back on the faulting 
  1720. instruction.  This is no good for graceful failure.  Yes, it is desirable to 
  1721. jump back to the worker function, but not at the point of the exception! 
  1722.  
  1723. Instead, the thread must jump from the exception handler function to a known 
  1724. point in the worker function.  This is an interfunctional GOTO.  Debates still 
  1725. rage about GOTO, but most programmers accept them when it comes to exception 
  1726. management. 
  1727.  
  1728. Code interfunctional GOTO's in C, using setjmp() and longjmp().  Use setjmp() 
  1729. to record the state of the thread at the beginning of the worker function. 
  1730. Later, from the exception handler function, use longjmp() to return the thread 
  1731. to the saved state.  State information is stored in a variable of type jmp_buf. 
  1732.  
  1733. The exception handler function must have addressability to the jmp_buf to use 
  1734. it on the call to longjmp().  The stack frame of the worker function is the 
  1735. ideal place to hold the jmp_buf and the exception registration record.  Also, a 
  1736. pointer to the except ion registration record is one of the parameters to the 
  1737. exception handler function.  Therefore, the way for an exception handler 
  1738. function to get the address of a jmp_buf is to put a jmp_buf at the end of the 
  1739. exception registration record.  See Figure 3. 
  1740.  
  1741. // User-extended exception registration record
  1742. typedef struct _regrec {
  1743.         PVOID           pNext;
  1744.         PFN             pfnHandler;
  1745.         jmp_buf         jmpWorker;
  1746. } REGREC;
  1747. typedef REGREC *PREGREC;
  1748.  
  1749. Figure 3. Extended REGREC definition 
  1750.  
  1751. Sample Program 2  consists of the main() function, a worker function, and an 
  1752. exception handler function.  It shows how the worker function always returns a 
  1753. sensible result code in spite of bad parameters. 
  1754.  
  1755. /* WORKER.C.  This program shows how a worker function can use an exception */
  1756. /* handler  like a safety net for calling threads. Compile and link this    */
  1757. /* program with:  icc /ss worker.c                                          */
  1758.  
  1759. // os2 includes
  1760. #define INCL_DOS
  1761. #define INCL_ERRORS
  1762. #include <os2.h>
  1763.  
  1764. // c includes
  1765. #include <stdio.h>
  1766. #include <stdlib.h>
  1767. #include <string.h>
  1768. #include <setjmp.h>
  1769. #include <assert.h>
  1770.  
  1771. // User-extended exception registration record
  1772. typedef struct _regrec {
  1773.   PVOID         pNext;
  1774.   PFN           pfnHandler;
  1775.   jmp_buf       jmpWorker;
  1776. } REGREC;
  1777. typedef REGREC *PREGREC;
  1778.  
  1779. // ----------------------------------------------------------------------
  1780. ULONG _System Handler( PEXCEPTIONREPORTRECORD p1,
  1781.                        PREGREC p2,
  1782.                        PCONTEXTRECORD p3,
  1783.                        PVOID pv )
  1784. {
  1785.   switch( p1->ExceptionNum ) {
  1786.   case XCPT_ACCESS_VIOLATION:
  1787.   case XCPT_INTEGER_DIVIDE_BY_ZERO:
  1788.   case XCPT_INTEGER_OVERFLOW:
  1789.   case XCPT_PROCESS_TERMINATE:           // Killed thread case
  1790.   case XCPT_ASYNC_PROCESS_TERMINATE:     // Killed thread case
  1791.     // Interested in this one
  1792.     longjmp( p2->jmpWorker, p1->ExceptionNum );
  1793.   default:
  1794.     break;
  1795.   }
  1796.   // Not handled
  1797.   return XCPT_CONTINUE_SEARCH;
  1798. }
  1799.  
  1800.  
  1801. // ----------------------------------------------------------------------
  1802. // Returns TRUE for success, FALSE for failure
  1803. LONG _System WorkerFunction( PCHAR pch )
  1804. {
  1805.   LONG        rc;
  1806.   LONG        rcResult;
  1807.   ULONG       ulException;
  1808.   REGREC      regrec;
  1809.  
  1810.   // Set a handler
  1811.   regrec.pfnHandler = (PFN)Handler;
  1812.   rc = DosSetExceptionHandler( (PEXCEPTIONREGISTRATIONRECORD) ®rec );
  1813.   assert( rc == 0 );
  1814.  
  1815.   // Store a known thread state
  1816.   ulException = setjmp( regrec.jmpWorker );
  1817.  
  1818.   if( ulException ) {
  1819.  
  1820.     // Clean up here: free memory allocations, release mutex sems, etc.
  1821.  
  1822.     // Get the handler off the chain
  1823.     rc = DosUnsetExceptionHandler( (PEXCEPTIONREGISTRATIONRECORD) ®rec );
  1824.     assert( rc == 0 );
  1825.  
  1826.     // Check for the killed-thread case
  1827.     switch( ulException ) {
  1828.     case XCPT_PROCESS_TERMINATE:
  1829.     case XCPT_ASYNC_PROCESS_TERMINATE:
  1830.       // Clean up done above and thread really wants to die
  1831.       DosExit( EXIT_THREAD, 0 );
  1832.       break;
  1833.     }
  1834.     // Set a failing result code
  1835.     rcResult = FALSE;
  1836.     goto depart;
  1837.   }
  1838.  
  1839.   // Dereference the supplied pointer
  1840.   *pch = 'a';
  1841.  
  1842.   rc = DosUnsetExceptionHandler( (PEXCEPTIONREGISTRATIONRECORD) ®rec );
  1843.   assert( rc == 0 );
  1844.  
  1845.   rcResult = TRUE;
  1846.  
  1847. depart:
  1848.   return rcResult;
  1849. }
  1850.  
  1851.  
  1852. // ----------------------------------------------------------------------
  1853. int main ( void )
  1854. {
  1855.   CHAR     szWork[ 16 ];
  1856.   LONG     rc;
  1857.  
  1858.   // Try worker function with a good pointer
  1859.   rc = WorkerFunction( szWork );
  1860.   printf( "Good pointer returns %d\n", rc );
  1861.  
  1862.   // Try worker function with a bad pointer
  1863.   rc = WorkerFunction( NULL );
  1864.   printf( "Bad pointer returns %d\n", rc );
  1865.  
  1866.   return 0;
  1867. }
  1868.  
  1869. Sample Program 2:  worker.c
  1870.  
  1871. Notes about Sample Program 2: 
  1872.  
  1873. o The Killed Thread:  The code in Sample Program 2  shows how to handle the 
  1874.   killed thread case.  Even though there are no killed threads in Sample 
  1875.   Program 2, the technique is critical to exported worker functions in DLLs 
  1876.   where the client process may use DosKillThread with abandon. 
  1877.  
  1878. o Nested Exceptions:  At exception time, OS/2 inserts a handler at the head of 
  1879.   the chain before it invokes the remaining handlers on the chain in order to 
  1880.   detect nested exceptions.  (A nested exception is one that occurs in an 
  1881.   exception handler.)  The IBM C Set/2 implementation of longjmp() correctly 
  1882.   unwinds the system's nested exception handler. 
  1883.  
  1884. o Sparse Allocations in OS/2:  When there is no COMMIT option on the MEMMAN 
  1885.   statement in CONFIG.SYS, OS/2 handles every memory allocation in a sparse 
  1886.   manner similar to Sample Program 1. This technique is called lazy commit. 
  1887.   When the COMMIT option is present on MEMMAN, commits are never deferred. 
  1888.  
  1889.  
  1890. ΓòÉΓòÉΓòÉ 13.5. Future Considerations ΓòÉΓòÉΓòÉ
  1891.  
  1892. Rest assured that this exception management strategy is portable to future 
  1893. versions of OS/2.  It uses 32-bit APIs, ANSI C runtime routines, and no 
  1894. assembler code. 
  1895.  
  1896.  
  1897. ΓòÉΓòÉΓòÉ 13.5.1. About the Author ΓòÉΓòÉΓòÉ
  1898.  
  1899. Monte Copeland is a Staff Programmer in OS/2 Print Driver Development.  He has 
  1900. been programming OS/2 applications since 1987 when he joined IBM.  Monte 
  1901. frequently speaks about OS/2 programming at IBM's OS/2 technical conferences. 
  1902.  
  1903.  
  1904. ΓòÉΓòÉΓòÉ 14. Communication between OS/2 and Windows Processes ΓòÉΓòÉΓòÉ
  1905.  
  1906. by David Kenner 
  1907.  
  1908. As part of The Developer Connection team, part of my job is to travel to the 
  1909. technical seminars and talk to the development community.  Frequently, I give a 
  1910. presentation on the architecture of virtual device drivers (VDDs), how they fit 
  1911. into the OS/2 architecture, and how to build them.  During the Question and 
  1912. Answer session that follows my presentation, the same question would 
  1913. consistently come up:  What is the recommended interprocess communication (IPC) 
  1914. mechanism for Windows and OS/2 processes to communicate?  The answer:  Use 
  1915. named pipes.  Several named pipe APIs exist that would be appropriate for this. 
  1916. Typically, the OS/2 process creates the pipe, and the DOS or Windows process 
  1917. opens the other end of the pipe to read or write to it.  This mechanism is used 
  1918. in OS/2 2.0 for dynamic data exchange (DDE) support. 
  1919.  
  1920. It became clear after talking to developers that a better mechanism is needed 
  1921. to allow for larger amounts of data to go back and forth between the processes. 
  1922. Because named pipes use the file system, the transfer rate was limited by the 
  1923. speed of the target system.  So I set off to investigate how we could improve 
  1924. on the existing mechanism. 
  1925.  
  1926.  
  1927. ΓòÉΓòÉΓòÉ 14.1. The Journey ΓòÉΓòÉΓòÉ
  1928.  
  1929. First, my research took me into the bowels of a OS/2 VDD named VWIN.SYS. 
  1930. Within VWIN.SYS, a lot of the logical interprocess communication (IPC) that I 
  1931. needed to do already resides.  VWIN.SYS is the VDD that allows for windowed 
  1932. WIN-OS/2 sessions or seamless OS/2.  Since VWIN.SYS was a proven mechanism for 
  1933. accomplishing this, I followed the logic of this VDD. 
  1934.  
  1935. What we must do was to use our new VDD (based on VWIN.SYS) as the interface 
  1936. layer between our WIN-OS/2 process and our OS/2 process.  We construct a VDD 
  1937. that lets us send messages in either direction, and receive responses back to 
  1938. the originating process, if required.  We wanted our VDD to be fairly generic; 
  1939. that is, it must be structured to queue up messages and notify the destination 
  1940. process that a message is waiting.  Part of the message data includes the 
  1941. originating process identification (PID), so we optionally can return a message 
  1942. to the originator.  Our VDD allocates memory from the system arena for each new 
  1943. message in the queue. 
  1944.  
  1945. Because each message put into or extracted from our message queue is performed 
  1946. in the context of the currently executing thread, the copy is performed while 
  1947. the correct LDT is active.  During message posting, each process copies the 
  1948. message data from a portion of its own address space to the the global data 
  1949. space of the VDD.  If the process is extracting a message, it copies the 
  1950. message data into its local data space.  This allows us to avoid the same 
  1951. context issue. 
  1952.  
  1953. Start off with the OS/2 side of the interface.  We have to set up a way for the 
  1954. OS/2 application to be able to talk to the VDD.  Do this by exporting an 
  1955. interface using the VDHRegisterVDD service.  In our VDD, we will set up an 
  1956. interface that our OS/2 application can use to wait for any message data.  Now 
  1957. our OS/2 process can use the DosOpenVdd and DosRequestVDD to talk to the VDD. 
  1958. It's up to the application developer to define the interface between the OS/2 
  1959. process and the VDD.  Typically, the interface mechanism is contained in 
  1960. another thread.  This thread is blocked until messages are sent.  The thread 
  1961. will block on the DosRequestVDD when the command packet that the VDD receives 
  1962. specifies WAITE. 
  1963.  
  1964.  
  1965. ΓòÉΓòÉΓòÉ 14.2. The Details ΓòÉΓòÉΓòÉ
  1966.  
  1967. We will use a set of logical interfaces that can be mapped to the set of OS/2 
  1968. and VDH services as follows: 
  1969.  
  1970. OpenVirtQueue:  Within our OS/2 application, we will use two system APIs to 
  1971. accomplish this.  Our application will use the DosOpenVdd API and the 
  1972. DosRequestVDD API.  Start, by opening our VDD with the DosOpenVDD.  From this 
  1973. call, we get a handle to our VDD.  Now that we have the handle to our VDD, we 
  1974. can use the DosRequestVDD service to call into the VDD and perform any 
  1975. preprocess initialization for us.  In our VDD, for example we will configure a 
  1976. message queueing mechanism. 
  1977.  
  1978. The OpenVirtQueue routine is shown in Sample Program 1. 
  1979.  
  1980. /****************************************************************************/
  1981. /*OpenVirtQueue                                                             */
  1982. /*                                                                          */
  1983. /*                                                                          */
  1984. /*A service routine that will allow us to do our initilization with the VDD */
  1985. /****************************************************************************/
  1986. APIRET OpenVirtQueue(VOID)
  1987. {
  1988.      APIRET apiRet;
  1989.  
  1990.      /*
  1991.       *See if our VDD is alive and if so get
  1992.       *a handle that we may use later
  1993.       */
  1994.      if(apiRet = DosOpenVDD(VDDNAME,&HandleToVDD) )
  1995.      {
  1996.           return(apiRet);
  1997.      }
  1998.  
  1999.      /*
  2000.       *Call into our VDD so we perform any initialization
  2001.       *we need to do at this time.
  2002.       */
  2003.      if(apiRet  = DosRequestVDD(HandleToVDD,
  2004.                                 0,
  2005.                                 INIT_COMMAND,
  2006.                                 0,
  2007.                                 NULL,
  2008.                                 0,
  2009.                                 NULL) )
  2010.      {
  2011.           return(apiRet);
  2012.      }
  2013.      return(apiRet);
  2014. }
  2015.  
  2016. Sample Program 1.  OpenVirtQueue.
  2017.  
  2018. WriteVirtQueue:  This is the mechanism in the VDD that lets us send information 
  2019. back to the WIN-OS/2 process.  Again, we will use the DosRequestVDD service to 
  2020. call into our VDD.  We will send a command that corresponds to our worker 
  2021. routine inside our VDD.  Our worker routine will post a message to our internal 
  2022. queue, and in turn, post a message back to the Windows message queue.  (See 
  2023. Sample Program 2.) 
  2024.  
  2025. /****************************************************************************/
  2026. /*WriteVirtQueue                                                            */
  2027. /*                                                                          */
  2028. /*                                                                          */
  2029. /*A service routine that will allow us to send our message data to the VDD  */
  2030. /*                                                                          */
  2031. /*                                                                          */
  2032. /*                                                                          */
  2033. /****************************************************************************/
  2034.  
  2035. APIRET WriteVirtQueue(PVOID pvMessageToSend,
  2036.                       ULONG ulCount,
  2037.                       SGID  SessionId)
  2038. {
  2039.      APIRET apiRet;
  2040.  
  2041.      if(apiRet = DosRequestVDD(HandleToVDD,
  2042.                                SessionId,
  2043.                                POST_MESSAGE,
  2044.                                ulCount,
  2045.                                pvMessageToSend,
  2046.                                0,
  2047.                                NULL) )
  2048.      {
  2049.           return(apiRet);
  2050.      }
  2051.      return(apiRet);
  2052. }
  2053.  
  2054. Sample Program 2. WriteVirtQueue 
  2055.  
  2056. ReadVirtQueue:  This is our mechanism in the VDD that lets our thread block and 
  2057. wait for any message data.  We will set up a protocol with the VDD, so that 
  2058. when the application calls into the VDD using the DosRequestVDD API, the VDD 
  2059. will block using the VDHWaitEventSem.  When we have a message from the WIN-OS2 
  2060. side, we clear the semaphore and copy the data into the buffer that was passed 
  2061. by the OS/2 application using DosOpenVdd.  See Sample Program 3. 
  2062.  
  2063. /****************************************************************************/
  2064. /*ReadVirtQueue                                                             */
  2065. /*                                                                          */
  2066. /*                                                                          */
  2067. /*This routine is set up as separate thread that will read messages,process */
  2068. /*them,and then continue to block until additional messages come in.The     */
  2069. /*block mechansim is accomplished through the semaphore in our VDD.         */
  2070. /*                                                                          */
  2071. /*Note:                                                                     */
  2072. /*There is no error return. All error messages are handled before the       */
  2073. /*thread terminates.                                                        */
  2074. /*                                                                          */
  2075. /****************************************************************************/
  2076. VOID ReadVirtQueue(VOID)
  2077. {
  2078.      APIRET apiRet;
  2079.      PVOID  pvMessage;
  2080.      CHAR   CommandToSend[SIZ_COMMAND_BUF];
  2081.  
  2082.  
  2083.  
  2084.      do
  2085.      {
  2086.           /*
  2087.            *Block until we get any message
  2088.            *data
  2089.            */
  2090.           if(apiRet = DosRequestVDD(HandleToVDD,
  2091.                                     0,
  2092.                                     READ_QUEUE,
  2093.                                     strlen(CommandToSend),
  2094.                                     CommandToSend,
  2095.                                     sizeof(MessageBuffer),
  2096.                                     &MessageBuffer) )
  2097.           {
  2098.                break;
  2099.           }
  2100.           /*
  2101.            *Do all of our message processing
  2102.            */
  2103.            apiRet = ProcessMessageData(MessageBuffer);
  2104.  
  2105.      }while(!apiRet);
  2106.      /*
  2107.       *Handle any error that was encountered
  2108.       *during our polling
  2109.       */
  2110.  
  2111.  
  2112.      /*
  2113.       *Do any other clean up we need to do
  2114.       *and get out
  2115.       */
  2116.  
  2117.      _endthread();
  2118. }
  2119.  
  2120. Sample Program 3. ReadVirtQueue 
  2121.  
  2122. We now have a mechanism to call into our VDD, receive messages, and post 
  2123. messages.  Our worker routines that do most of our work for us are within the 
  2124. VDD. 
  2125.  
  2126. Stay tuned to the next issue where we'll discuss the internal routines that we 
  2127. will use in our VDD and our interfaces in the WINOS/2 process.  Till then... 
  2128.  
  2129.  
  2130. ΓòÉΓòÉΓòÉ 14.2.1. About the Author ΓòÉΓòÉΓòÉ
  2131.  
  2132. David Kenner is the Project Leader for The Developer Connection for OS/2. David 
  2133. frequently speaks at IBM's OS/2 technical conferences on Virtual Device Driver 
  2134. Design. 
  2135.  
  2136.  
  2137. ΓòÉΓòÉΓòÉ 15. Migrating Windows Applications to OS/2: Making it Work ΓòÉΓòÉΓòÉ
  2138.  
  2139. by Jeff English 
  2140. One Up Corporation 
  2141.  
  2142. Migrating Windows source code to OS/2 is doable!  It is, however, an involved 
  2143. process that requires knowledge of both the Windows and OS/2 environments, as 
  2144. well as the many differences in the APIs.  The right set of tools can make the 
  2145. porting process easier. 
  2146.  
  2147. With the increasing success of OS/2, it is becoming paramount to many 
  2148. application developers to have native applications on multiple platforms.  For 
  2149. many, this means migrating their existing Windows application source to OS/2. 
  2150. Cross-platform conversion of source code is a doable, albeit time-consuming 
  2151. process. 
  2152.  
  2153.  
  2154. ΓòÉΓòÉΓòÉ 15.1. Windows to OS/2 Porting - The Programming Perspective ΓòÉΓòÉΓòÉ
  2155.  
  2156. Both Windows and OS/2 are message-based environments.  However, the formats of 
  2157. these messages, as well as the APIs, differ substantially between the two.  To 
  2158. solve the porting problem, one must handle those areas that do not overlap. 
  2159.  
  2160. There are also some conceptual differences in how things operate.  For example, 
  2161. Windows relies on the concepts of brushes and pens for many of its drawing 
  2162. primitives.  OS/2 relies on the concepts of bundles and attributes.  A line 
  2163. bundle defines the drawing attributes and an area or image bundle defines the 
  2164. fill attributes.  A conceptual difference such as this can significantly alter 
  2165. the logic of the application when ported to OS/2. 
  2166.  
  2167. The following is a list of some of the most common major issues: 
  2168.  
  2169. o Conversion from 16- to 32-bit application code 
  2170.  
  2171. o Preemptive multitasking 
  2172.  
  2173. o Multiple Document Interface (MDI) 
  2174.  
  2175. o GDI (Windows) vs. GPI (OS/2) 
  2176.  
  2177. o Printing and Device Driver dependencies 
  2178.  
  2179. o Window class styles and use of the class device context 
  2180.  
  2181. o Message notification and message order dependencies 
  2182.  
  2183. o Resource and data sharing among instances of an application or DLL 
  2184.  
  2185. o Conversion from 16-bit segmented memory model to 32-bit flat memory model 
  2186.  
  2187. o OLE support 
  2188.  
  2189. How much the application exploits and depends on these items will affect how 
  2190. easy the migration will be.  Separating these features into platform dependent 
  2191. objects is one solution to reducing the effort of porting. 
  2192.  
  2193.  
  2194. ΓòÉΓòÉΓòÉ 15.2. Porting Tools ΓòÉΓòÉΓòÉ
  2195.  
  2196. Many tools are available today that assist in some of the phases of the porting 
  2197. process.  Tools, such as GREP and Seek-and-Scan, can help identify individual 
  2198. features in the source.  Basic text editors can perform simple replacement of 
  2199. text.  More sophisticated editors, such as SourceLink, provide hyper-link 
  2200. access for source replacement. 
  2201.  
  2202. A suite of tools developed by One Up Corporation and currently being enhanced 
  2203. and expanded, greatly assist the migration process in all phases of the porting 
  2204. process. 
  2205.  
  2206.  
  2207. ΓòÉΓòÉΓòÉ 15.3. Summary ΓòÉΓòÉΓòÉ
  2208.  
  2209. Porting of source code is much more than attempting to map APIs from one 
  2210. platform to another.  The port can become more difficult if the source code 
  2211. includes features that must be redesigned on the target platform.  However, 
  2212. with the a complete understand ing of both the Windows and OS/2 programming 
  2213. environments and right tools, this process can be much easier. 
  2214.  
  2215.  
  2216. ΓòÉΓòÉΓòÉ 15.3.1. About the Author ΓòÉΓòÉΓòÉ
  2217.  
  2218. Jeff English is a Staff Programmer for One Up Corporation and the co-author of 
  2219. the book Real-World Programming for OS/2 2.1.  One Up Corporation is a leader 
  2220. in OS/2 products, education, and application expertise.  One-Up produces the 
  2221. SMART (Source Migration and Reporting Tool) Toolset, which is a collection of 
  2222. advanced porting tools.  For more information, call 1-800-678-0187. 
  2223.  
  2224.  
  2225. ΓòÉΓòÉΓòÉ 16. The Five Phases of the Porting Process ΓòÉΓòÉΓòÉ
  2226.  
  2227. The process of porting source code is comprised of five phases, some of which 
  2228. overlap: Analysis, Automated Code Replacement, Computer-Assisted Code 
  2229. Replacement, Implementation of Unsupported Features, and Addition of Platform 
  2230. Specific Features.  Automated tools can help process the first three phases; 
  2231. while additional tools can assist with the last two. 
  2232.  
  2233.  
  2234. ΓòÉΓòÉΓòÉ 16.1. Phase 1: Analysis ΓòÉΓòÉΓòÉ
  2235.  
  2236. Analysis of the code to identify and report all environment specific issues and 
  2237. amount of porting effort required.  This includes a breakdown of all API calls, 
  2238. type definitions, symbols, and messages.  This also includes their frequency of 
  2239. occurrence and difficulty of porting.  The analysis provides a detailed look at 
  2240. your source and what specific features of the environment are being used. 
  2241.  
  2242.  
  2243. ΓòÉΓòÉΓòÉ 16.2. Phase 2: Automated Code Replacement ΓòÉΓòÉΓòÉ
  2244.  
  2245. This phase includes automated code replacement of those items that have a 
  2246. one-to-one mapping from the source to target environment.  Also included in 
  2247. this phase is the conversion of resource files. 
  2248.  
  2249.  
  2250. ΓòÉΓòÉΓòÉ 16.3. Phase 3: Computer-Assisted Code Replacement ΓòÉΓòÉΓòÉ
  2251.  
  2252. This phase includes interactive code replacement with input from an application 
  2253. developer for those source items that have an equivalent feature in the target 
  2254. environment, yet require a decision as to either the original intent of the 
  2255. source or which of several choices to use in the target environment. 
  2256.  
  2257.  
  2258. ΓòÉΓòÉΓòÉ 16.4. Phase 4: Implementation of Unsupported Features ΓòÉΓòÉΓòÉ
  2259.  
  2260. There will ultimately be some features of the source environment that are not 
  2261. directly supported in the target environment.  In some cases it may be possible 
  2262. to simulate it, and in other cases it will not be possible.  The developer will 
  2263. have to provide input in order to make the changes. 
  2264.  
  2265.  
  2266. ΓòÉΓòÉΓòÉ 16.5. Phase 5: Addition of Platform Specific Features ΓòÉΓòÉΓòÉ
  2267.  
  2268. Tighter integration of the application with the target environment might be 
  2269. desirable from a marketing or even coding standpoint.  This adds features that 
  2270. might make it more difficult to port to other platforms, but can add 
  2271. significant benefit to the end user. 
  2272.  
  2273.  
  2274. ΓòÉΓòÉΓòÉ 17. New Tricks for Dynamic Linking On The OS/2 2.x Operating System ΓòÉΓòÉΓòÉ
  2275.  
  2276. by John Keenleyside 
  2277.  
  2278. Dynamic linking is not a new concept.  Now, IBM has added some new features for 
  2279. 32-bit dynamic link libraries (DLLs).  It is to build and use 32-bit DLLs on 
  2280. the OS/2 2.x operating system, especially if you use the IBM C Set ++ compiler. 
  2281.  
  2282.  
  2283. ΓòÉΓòÉΓòÉ 17.1. Building 32-bit DLLs ΓòÉΓòÉΓòÉ
  2284.  
  2285. Building DLLs is straightforward in OS/2 once you understand the constraints. 
  2286. You build from source files containing the data or functions you want to 
  2287. include in the DLL.  Each function or data item you want to export from the DLL 
  2288. must have external scope. 
  2289.  
  2290. You also need a module definition file.  The OS/2 linker uses this file while 
  2291. linking the compiled objects to create a DLL.  Basically, it's a plain text 
  2292. file that describes the name, attributes of segments, exported names or 
  2293. ordinals, imported names or ordinals, and other characteristics for the DLL. 
  2294. (Ordinals are numbers you can assign to exported functions.) 
  2295.  
  2296.  
  2297. ΓòÉΓòÉΓòÉ 17.2. Using 32-bit DLLs ΓòÉΓòÉΓòÉ
  2298.  
  2299. Dynamic linking comes in two flavors: 
  2300.  
  2301. o Load-time dynamic linking, which resolves external references within a 
  2302.   segment at the time the segment is loaded 
  2303.  
  2304. o Runtime dynamic linking, which does not resolve references within a code 
  2305.   segment until the actual code is executed. 
  2306.  
  2307. To use a DLL, write the source file for the program or DLL that will use it. 
  2308. Refer to the functions or variables as if they were going to be statically 
  2309. linked into the program or DLL.  Then, at link-edit time, tell the linker that 
  2310. some function or variable reference is a dynamic reference to a DLL and will be 
  2311. resolved at runtime. 
  2312.  
  2313. OS/2 2.x lets you communicate this information to the linker as follows: 
  2314.  
  2315. o Create a module definition file for the program or DLL that is going to use 
  2316.   the DLL.  Specify the imported names or ordinals under the keyword IMPORTS. 
  2317.  
  2318. o Use the IMPLIB utility from the OS/2 Developer's Toolkit to create an import 
  2319.   library for the linker.  It will contain a list of the exported names or 
  2320.   ordinals for the DLL.  Create the import library from the module definition 
  2321.   file or the DLL itself.  This is the preferred approach, because it 
  2322.   eliminates the need to create a module definition file.  It also keeps the 
  2323.   DLL independent from your application programs, so you can use it again. 
  2324.  
  2325. o Even easier, IBM C Set ++ will do it all automatically.  Like many C/C++ 
  2326.   compilers, the IBM C Set ++ compiler supports the _Export keyword.  But it 
  2327.   also supports the import and export pragmas.  This lets you specify exports 
  2328.   and imports within the source code itself - especially useful for C++ 
  2329.   programmers who want to export classes from their DLLs but don't want the 
  2330.   hassle of figuring out all the mangled names to export. 
  2331. The following shows a bit-counting function you can build into a DLL.  It also 
  2332. provides a small application source (Main.C) file that shows you how to call 
  2333. the bitcount() function.  Using the C Set ++ compiler, the command file builds 
  2334. the DLL and the application program. 
  2335.  
  2336. /* From BITS.C */
  2337. /* This function will count the number of 1 bits in n. */
  2338.  
  2339. unsigned int bitcount(unsigned int n)
  2340. {
  2341.    unsigned int count;
  2342.     for (count = 0; n; n >>= 1)
  2343.       if (n & 1)
  2344.          count++;
  2345.    return count;
  2346. }
  2347.  
  2348. /* From BITS.DEF */
  2349. LIBRARY BITS INITINSTANCE TERMINSTANCE
  2350. DATA MULTIPLE NONSHARED
  2351. EXPORTS
  2352.    bitcount
  2353.  
  2354. /* From MAIN.C */
  2355. #include <stdio.h>
  2356. unsigned int bitcount(unsigned int n);
  2357. int main(void)
  2358. {
  2359.    printf("The number of 1 bits in %u is %u\n",
  2360.           123, bitcount(123));
  2361.    return 0;
  2362. }
  2363.  
  2364. /* From BUILD.CMD */
  2365. /* This is a REXX command file. */
  2366.  
  2367. /* Compile and link-edit BITS.C to create BITS.DLL */
  2368. 'ICC /Ge- /O+ BITS.C BITS.DEF'
  2369.  
  2370. /* Create the import library for BITS.DLL */
  2371. 'IMPLIB BITS.LIB BITS.DEF'
  2372.  
  2373. /* Compile and link-edit MAIN.C to create MAIN.EXE */
  2374. 'ICC /O+ MAIN.C BITS.LIB'
  2375. Sample Program 1. Simple Bit-Counting Function 
  2376.  
  2377.  
  2378. ΓòÉΓòÉΓòÉ 17.3. Initialization and Termination ΓòÉΓòÉΓòÉ
  2379.  
  2380. When you load a DLL in OS/2 2.x, you might need to allocate memory and 
  2381. initialize data and other resources before you can call code within the DLL. 
  2382. Then, after an application is finished using a DLL, you might need to free up 
  2383. resources such as memory. 
  2384.  
  2385. The C Set ++ libraries provide functions to initialize and terminate the C/C++ 
  2386. runtime environment.  The function _CRT_init() initializes the C runtime 
  2387. environment, and the function __ctordtorInit calls any C++ constructors that 
  2388. are required.  The __ctordt orTerm function calls the C++ destructors, and the 
  2389. _CRT_term function terminates the C runtime environment. 
  2390.  
  2391. You can export the initialization and termination functions from the DLL, so 
  2392. each application can call them.  The initialization functions are called before 
  2393. any other functions within the DLL.  The termination functions are called just 
  2394. before the applicati on is finished with the DLL.  This makes the DLL dependent 
  2395. on the applications that use it. 
  2396.  
  2397. Fortunately, another way exists for OS/2 to call a function within the DLL when 
  2398. it is loaded and when an application tells the operating system that it is 
  2399. finished with a DLL. 
  2400.  
  2401. A DLL can have an entry point just like an executable.  This entry point is 
  2402. called when the DLL is loaded and when it is unloaded.  This process is called 
  2403. global initialization and termination.  The entry point also can be called each 
  2404. time a new process acc esses a DLL or is finished with the DLL.  This process 
  2405. is called instance initialization and termination.  The whole initialization 
  2406. and termination routine becomes automatic. 
  2407.  
  2408.  
  2409. ΓòÉΓòÉΓòÉ 17.4. A New Way to Use Entry Points ΓòÉΓòÉΓòÉ
  2410.  
  2411. The OS/2 2.x operating system also provides a new feature for the termination 
  2412. of 32-bit DLLs.  In OS/2 1.x, the entry point was called only for 
  2413. initialization. But if the entry-point routine is in a 32-bit code segment (as 
  2414. in OS/2 2.x), it also will be called for termination. 
  2415.  
  2416. For the DLL entry point function to determine whether it is being called for 
  2417. initialization or termination, the loader passes a flag value to it.  If the 
  2418. flag is 0, it is being called for initialization.  If the flag is 1, it is 
  2419. being called for termination. 
  2420.  
  2421. The module handle for the DLL also is passed to the entry-point function.  The 
  2422. following describes the contents of the stack and the values of the 80x86 
  2423. registers when the entry-point function is called. 
  2424.  
  2425. Register values at LX format DLL initialization and termination:
  2426.  
  2427. EIP = DLL entry point address
  2428. ESP = Current stack pointer for thread that is loading the DLL
  2429. EAX = EBX = ECX = EDX = ESI = EDI = EBP = 0
  2430. CS = Code selector for base of linear address space
  2431. DS = ES = SS = Data selector for base of linear address space
  2432. FS = Data selector of base of the Thread Information Block (TIB)
  2433.      for the thread that is loading the DLL
  2434. GS = 0
  2435.  
  2436. Stack contents at DLL initialization:
  2437.  
  2438. [ESP+0] = Return address to system where the value of EAX is the
  2439.           return code
  2440. [ESP+4] = Module handle for the DLL
  2441. [ESP+8] = 0 which means that the DLL entry point is being called
  2442.           for initialization
  2443.  
  2444. Stack contents at DLL termination:
  2445.  
  2446. [ESP+0] = Return address to system where the value of EAX is the
  2447.           return code
  2448. [ESP+4] = Module handle for the DLL
  2449. [ESP+8] = 1 which means that the DLL entry point is being called
  2450.           for termination
  2451.  
  2452. Note:  The stack contents at DLL initialization and termination
  2453. follows the system calling convention except that AL is not set to
  2454. the number of DWORDS of parameters passed.
  2455.  
  2456. The entry-point function can be written in a high-level language like C, but it 
  2457. must have system linkage, because it is called from the operating system. 
  2458. Also, because the return value of this function is returned in the EAX 
  2459. register, an unsigned long return type is appropriate. 
  2460.  
  2461. If you are using the C Set ++ compiler, the prototype for this function is 
  2462. simple: 
  2463.  
  2464. unsigned long _System entry(unsigned long hModule, unsigned long ulFlag)
  2465.  
  2466. OS/2 automatically confirms your results.  A non-zero return value tells the 
  2467. loader that the DLL initialization was successful.  A zero return value tells 
  2468. the loader that an error occurred. 
  2469.  
  2470.  
  2471. ΓòÉΓòÉΓòÉ 17.5. A New Way to Specify and Set Entry Points ΓòÉΓòÉΓòÉ
  2472.  
  2473. The entry point is typically specified by the module end record within an 
  2474. object module that is linked into the DLL.  With most compilers, you generate 
  2475. the module end record using a small assembler module, as follows. 
  2476.  
  2477.          TITLE   DLLSTUB.ASM
  2478.  
  2479.          .386
  2480.          .387
  2481.  
  2482. CODE32   SEGMENT DWORD USE32 PUBLIC 'CODE'
  2483. CODE32   ENDS
  2484. DATA32   SEGMENT DWORD USE32 PUBLIC 'DATA'
  2485. DATA32   ENDS
  2486. CONST32  SEGMENT DWORD USE32 PUBLIC 'CONST'
  2487. CONST32  ENDS
  2488. BSS32    SEGMENT DWORD USE32 PUBLIC 'BSS'
  2489. BSS32    ENDS
  2490.  
  2491. DGROUP   GROUP CONST32, BSS32, DATA32
  2492.          ASSUME  CS:FLAT, DS:FLAT, SS:FLAT, ES:FLAT
  2493.  
  2494.          EXTRN   entry:PROC
  2495.  
  2496.          END     entry
  2497.  
  2498. C Set ++ makes it easier to specify the entry point.  It gives you the object 
  2499. module to set the entry point in its runtime libraries.  All you do is name the 
  2500. entry-point function _DLL_InitTerm.  A default _DLL_InitTerm() function calls 
  2501. the initialization an d termination functions. 
  2502.  
  2503. C Set ++ also provides the pragma, #pragma entry.  This new feature lets you 
  2504. set the entry point for a module using the C language rather than assembler, so 
  2505. you can pick the entry-point function name.  It also means that you don't have 
  2506. to use the DLL genera tion option (/Ge-) when compiling the source files for 
  2507. the DLL.  You decide at link-edit time, rather than at compile time, whether to 
  2508. put the objects into a DLL or into an application. 
  2509.  
  2510. The following shows you how to write a DLL entry-point function using the 
  2511. features of C Set ++.  The application program provided in the listing uses 
  2512. runtime dynamic linking. 
  2513.  
  2514. /* From DLLENTRY.C */
  2515. #pragma strings(readonly)
  2516.  
  2517. #define INCL_DOSFILEMGR
  2518. #define INCL_DOSMODULEMGR
  2519. #include <os2.h>
  2520. #include <string.h>
  2521.  
  2522. int _dllentry = 1;  /* just in case an object is compiled with /Ge- */
  2523. char name[CCHMAXPATH];
  2524.  
  2525. #pragma entry(entry)
  2526. unsigned long _System entry(unsigned long hModule, unsigned long
  2527. ulFlag)
  2528. {
  2529.    APIRET rc;
  2530.    unsigned long ulBytesWritten;
  2531.  
  2532.    rc = DosQueryModuleName(hModule, CCHMAXPATH, name);
  2533.  
  2534.    if (!rc)
  2535.    {
  2536.       if (ulFlag == 0)
  2537.       {
  2538.          rc = DosWrite(1, name, strlen(name), &ulBytesWritten);
  2539.          rc = DosWrite(1, " initialized.\r\n", 15,
  2540. &ulBytesWritten);
  2541.       }
  2542.       else
  2543.       {
  2544.          rc = DosWrite(1, name, strlen(name), &ulBytesWritten);
  2545.          rc = DosWrite(1, " terminated.\r\n", 14, &ulBytesWritten);
  2546.       }
  2547.    }
  2548.  
  2549.    return !rc;   /* non-zero means DLL init/term was successful */
  2550. }
  2551.  
  2552. void hello(void)
  2553. {
  2554.    unsigned long ulBytesWritten;
  2555.  
  2556.    DosWrite(1, "Hello there\r\n", 13, &ulBytesWritten);
  2557.  
  2558.    return;
  2559. }
  2560.  
  2561. /* From SIMPLE.DEF */
  2562. LIBRARY SIMPLE INITINSTANCE TERMINSTANCE
  2563.  
  2564. EXPORTS
  2565.    hello
  2566.  
  2567. /* From RUNTIME.C */
  2568. #pragma strings(readonly)
  2569.  
  2570. #define INCL_DOSMODULEMGR
  2571. #define INCL_DOSPROCESS
  2572. #include <os2.h>
  2573.  
  2574. char pszErrorBuf[CCHMAXPATH];
  2575.  
  2576. void hello(void);
  2577.  
  2578. int main(void)
  2579. {
  2580.    APIRET rc;
  2581.    HMODULE hDLL;
  2582.    PFN pHello;
  2583.  
  2584.    rc = DosLoadModule(pszErrorBuf, CCHMAXPATH, "SIMPLE", &hDLL);
  2585.  
  2586.    if (!rc)
  2587.    {
  2588.       rc = DosQueryProcAddr(hDLL, 0, "hello", &pHello);
  2589.  
  2590.       if (!rc)
  2591.          pHello();
  2592.  
  2593.       rc = DosFreeModule(hDLL);
  2594.    }
  2595.  
  2596.    return rc;
  2597. }
  2598.  
  2599. /* From BUILD.CMD */
  2600. /* Build a simple DLL that shows how the DLL entry point function works. */
  2601. 'ICC /C /Rn /O+ DLLENTRY.C'
  2602. 'ICC /Rn /Ge- /FeSIMPLE.DLL DLLENTRY SIMPLE.DEF'
  2603. 'ICC /Rn /O+ RUNTIME.C'
  2604.  
  2605.  
  2606. ΓòÉΓòÉΓòÉ 17.6. Ordering Issues ΓòÉΓòÉΓòÉ
  2607.  
  2608. Sometimes the initialization part of the entry-point function for DLL A depends 
  2609. on DLL B being initialized first.  For instance, DLL B could be a C runtime 
  2610. DLL, and the entry point function in DLL A could be using some C runtime 
  2611. functions. In this case, you should initialize the C runtime DLL before DLL A. 
  2612.  
  2613. To handle this, DLL B exports a function that performs the initialization 
  2614. required.  This function can be called by the entry-point function in DLL B or 
  2615. the entry-point function in DLL A. Use the _CRT_init() and __ctordtorInit() 
  2616. functions that are provided in the C Set ++ libraries. 
  2617.  
  2618. Ordering constraints also can be a problem at termination.  There is no way to 
  2619. determine whether a DLL has been unloaded or not, you can't solve the problem 
  2620. by calling the termination function of another DLL.  If you call a function in 
  2621. an unloaded DLL, you' ll get an access violation. 
  2622.  
  2623. You can use the DosExitList() API to register a termination function within the 
  2624. DLL that will be called when a process terminates.  DosExitList() takes a 
  2625. function-order parameter, allowing termination functions to be called in a 
  2626. specific order.  If you register more than one termination function using the 
  2627. same order number, these functions are called in last-in first-out order.  When 
  2628. a process terminates, OS/2 calls all the termination functions registered with 
  2629. DosExitList() before any of the DLL entry-point functions are called for 
  2630. termination processing. 
  2631.  
  2632. A different termination problem exists when DLLs are unloaded using the 
  2633. DosFreeModule() API.  In this case, the termination function registered by the 
  2634. DLL with DosExitList() is not called since a process is not terminating.  OS/2 
  2635. cannot unload the DLL sin ce an exit list contains a reference to a function 
  2636. within the DLL. 
  2637.  
  2638. Fortunately, OS/2 2.x provides a new, improved solution to this problem.  It 
  2639. calls a 32-bit entry-point function in a DLL whenever the DLL is about to be 
  2640. unloaded.  The entry-point function can call DosExitList() to remove the 
  2641. registered termination functio n and instead perform the termination processing 
  2642. itself.  The DLL can then be unloaded, and all of the resources it was using 
  2643. will have been freed. 
  2644.  
  2645.  
  2646. ΓòÉΓòÉΓòÉ 17.7. Summary ΓòÉΓòÉΓòÉ
  2647.  
  2648. In the next issue of The Developer Connection News, the discussion of DLLs will 
  2649. continue.  Topics such private or shared databased DLLs, exception handling 
  2650. within DLLs, and resource DLLs will be covered. 
  2651.  
  2652.  
  2653. ΓòÉΓòÉΓòÉ 17.7.1. References: ΓòÉΓòÉΓòÉ
  2654.  
  2655. 1) OS/2 Version 2.0 - Volume 4: Application Development GG24-3774-00 
  2656.  
  2657.  
  2658. ΓòÉΓòÉΓòÉ 17.7.2. Notes: ΓòÉΓòÉΓòÉ
  2659.  
  2660. 1) All sample code has been compiled using the GA version of IBM C Set ++ 
  2661. compiler.  It has been tested on the GA level of OS/2 2.0 . 
  2662.  
  2663.  
  2664. ΓòÉΓòÉΓòÉ 17.7.3. About the Author ΓòÉΓòÉΓòÉ
  2665.  
  2666. John Keenleyside  is a software developer working on IBM's C Set ++ product. 
  2667. He may be reached at IBM Software Solutions Toronto Laboratory via Email at 
  2668. jkeenley@vnet.ibm.com. 
  2669.  
  2670.  
  2671. ΓòÉΓòÉΓòÉ 18. Why DLLs? ΓòÉΓòÉΓòÉ
  2672.  
  2673. It's no accident that all OS/2 APIs are provided through DLLs.  They're simply 
  2674. the most efficient way to share code and data across any number of OS/2 
  2675. applications. 
  2676.  
  2677. Normally code in libraries is linked into the application that uses it; DLLs 
  2678. are actually loaded into memory.  As a result, linking an application takes 
  2679. less time, because you don't have to copy the library code into the 
  2680. application.  You need only copy an import reference. 
  2681.  
  2682. Dynamic linking offers two other advantages. 
  2683.  
  2684. o You need less hard disk space and memory to run applications because code and 
  2685.   data are shared. 
  2686.  
  2687. o You can modify the code in a DLL without needing to relink the application. 
  2688.   With dynamic linking, you resolve references (calls) to external routines in 
  2689.   DLLs at the time the application program is loaded, rather than at link-edit 
  2690.   time. 
  2691.  
  2692. Note:  When we are talking about an executable or DLL, an object refers to one 
  2693.        or more segments that have been grouped.  This grouping can either be 
  2694.        specified explicitly, or can happen by default if the segments have the 
  2695.        same attributes. For example, the group DGROUP is an object in the 
  2696.        context of an executable or DLL. 
  2697.  
  2698.  
  2699. ΓòÉΓòÉΓòÉ 19. KwikINF (Quick Information Access into Online References) ΓòÉΓòÉΓòÉ
  2700.  
  2701. by Paul Brightly 
  2702.  
  2703. One of the most time-consuming efforts in developing code is locating and 
  2704. accessing the correct API Reference.  These references come in both hard- and 
  2705. soft-copy.  Yet , there are drawbacks to each.  Using hard-copy, you can end up 
  2706. with a cluttered desk; soft-copy requires you to identify the correct 
  2707. information object on your desktop (most likely buried several folders deep). 
  2708. With softcopy, there is the additional dilemma that once you find the 
  2709. information object, you must then search through the contents or do a string 
  2710. search to find the item you need. 
  2711.  
  2712. Enter KwikINF.  KwikINF lets you look up an API, while editing source code, 
  2713. with the cursor sitting on the API in question.  It is a utility that uses 
  2714. keyboard monitors in full-screen sessions and a system message queue hook in PM 
  2715. to detect user-defined hot-key sequences.  Pressing this key, extracts the text 
  2716. string under the cursor (presumably an API call) and launches the appropriate 
  2717. online reference, displaying help on that API. 
  2718.  
  2719. The KwikINF utility comes with the OS/2 2.1 Developer's Toolkit (that is 
  2720. available on your Developer Connection CD-ROM).  Look for it in the online 
  2721. tools reference, as well as the toolkit desktop folder. 
  2722.  
  2723. Launching online books lets your editor be run in full-screen, a VIO/AVIO 
  2724. window, MLE, or PM window.  Unfortunately, in a graphical PM window, we can't 
  2725. extract the word under the cursor, because it's a bitmap and we don't have 
  2726. access to the string used to create it.  WIN-OS2 sessions aren't monitored at 
  2727. all. 
  2728.  
  2729. KwikINF determines which online reference to launch by using an index table 
  2730. that maps APIs to the books in which they reside.  This mapping is specified by 
  2731. index files that are shipped with the OS/2 Developer's Toolkit as well as the C 
  2732. Set++ product. 
  2733.  
  2734.  
  2735. ΓòÉΓòÉΓòÉ 19.1. Interface ΓòÉΓòÉΓòÉ
  2736.  
  2737. Start KwikINF from a command prompt by typing KwikINF.  If you have the 2.1 
  2738. toolkit installed, a corresponding program object is created in the Toolkit 
  2739. information folder.  Once started, the configuration menu is minimized to an 
  2740. icon on your desktop.  You can configure the tool by double-clicking on this 
  2741. icon. 
  2742.  
  2743. The configuration screen in Figure 1 lets you change the behavior of KwikINF. 
  2744. The Activation Key Sequence (hot-key) activates KwikINF from any session.  You 
  2745. can change the default (Alt+Q) to one of several other choices if you want.  If 
  2746. you edit source c ode in a full-screen session, you will want to specify how 
  2747. many full-screen sessions KwikINF should monitor for the hot-key. You can 
  2748. choose a default book to be searched.  Lastly, and I think most useful, you can 
  2749. decide what happens when you hit the hot-key.  If you prefer, it will always 
  2750. show the search window in Figure 2.  This is useful if you need to choose which 
  2751. book to search every time you want help.  But if you're getting help on an API 
  2752. that's specified in the index files, it's faster to bypass the search window. 
  2753. KwikINF determines the correct .INF file and launches it with the text under 
  2754. your cursor.  However if you misspell the API, an error message will appear, 
  2755. and control will be returned to the originating window. 
  2756.  
  2757. Figure 1. Configuration Screen 
  2758.  
  2759. The search window in Figure 2 lets you specify the search-text and the book to 
  2760. be searched.  This is less convenient than the bypass method previously 
  2761. described.  But, it is required if you press the hot-key sequence from a 
  2762. graphical editor.  If you use a graphical editor which has the appropriate 
  2763. macro support, you can write a macro that calls KWIKINF.EXE directly with the 
  2764. search-string as a parameter.  Make sure you don't use the KwikINF hot-key to 
  2765. invoke this macro or KwikINF will intercept it before your editor ever sees it. 
  2766.  
  2767. Figure 2. Search Window 
  2768.  
  2769.  
  2770. ΓòÉΓòÉΓòÉ 19.2. Building Custom Index Files ΓòÉΓòÉΓòÉ
  2771.  
  2772. If you have an online book that is best used as a reference, you can create an 
  2773. index file to let KwikINF do the searching for you when you need information. 
  2774. By examining the index files shipped with the toolkit, you can see they're easy 
  2775. to build. 
  2776.  
  2777. A typical line from the index file in the OS/2 2.1 Developer's Toolkit 
  2778. (x:\TOOLKT21\BOOK\EPMKWHLP.NDX) is (Win*, view pmref ~). 
  2779.  
  2780. The first token on this typical line, (Win*), identifies a group of APIs that 
  2781. reside in a specific book.  The asterisk, or wild-card character, specifies all 
  2782. APIs that have the Win prefix.  This eliminates the need to list each 
  2783. individual API and greatly red uces the size of your index file.  The second 
  2784. token, (view), is currently unused.  The third token, (pmref), is an 
  2785. environment variable that specifies a group of books to be searched.  A 
  2786. specific .INF file can be used as well. 
  2787.  
  2788. Here's a simple index file demonstrating the basic syntax: 
  2789.  
  2790. /* C style comments and blank lines are acceptable */
  2791. /* Specific file extensions may be specified here (for EPM editor) */
  2792. EXTENSIONS: *
  2793.  
  2794. /* A title may be placed here */
  2795.  
  2796. DESCRIPTION: Any Developer's Custom KwikINF index file
  2797.  
  2798. /* Complete help words or prefixes with wildcard (*) character may be used */
  2799. /* to determine the proper book to open */
  2800.  
  2801.    (undelete, view cmdref.inf ~)
  2802.    (sysl*, view cmdref.inf ~)
  2803.    (wp*, view pmwkp.inf ~)
  2804.  
  2805. Using this sample index file, KwikINF is able to load the correct book and find 
  2806. the unrelated topics undelete, syslevel, syslog, and wpOpen. 
  2807.  
  2808.  
  2809. ΓòÉΓòÉΓòÉ 19.3. Installing Index Files ΓòÉΓòÉΓòÉ
  2810.  
  2811. KwikINF determines the index files to use from the HELPNDX environment 
  2812. variable, installed in the CONFIG.SYS file by the OS/2 Toolkit installation 
  2813. program. 
  2814.  
  2815. SET HELPNDX=EPMKWHLP.NDX
  2816.  
  2817. If you write your own index file, you must add it to the end of this variable. 
  2818. For example, suppose you wrote an index file named CUSTOM.NDX.  You modify this 
  2819. variable like this: 
  2820.  
  2821. SET HELPNDX=CUSTOM.NDX+EPMKWHLP.NDX
  2822.  
  2823. For KwikINF to find your index file, it must be in the BOOKSHELF environment 
  2824. path (in CONFIG.SYS). 
  2825.  
  2826.  
  2827. ΓòÉΓòÉΓòÉ 19.4. Future Work ΓòÉΓòÉΓòÉ
  2828.  
  2829. Though KwikINF is very useful as it is, I'm excited by the prospect of 
  2830. continually improving this tool.  Future work on KwikINF might include making 
  2831. it portable to different hardware platforms (a good idea for any code), faster 
  2832. interface into .INF files, full 32-bit port, and an API interface for other 
  2833. applications. 
  2834.  
  2835. But you're the customer.  We'd like your idea and suggestions; send your ideas 
  2836. using CompuServe, or write us at the address shown in The Developer Connection 
  2837. News. 
  2838.  
  2839.  
  2840. ΓòÉΓòÉΓòÉ 19.5. Summary ΓòÉΓòÉΓòÉ
  2841.  
  2842. If you rely heavily on the OS/2 Online References when you write code, KwikINF 
  2843. is the tool for you.  Try it!  You might think twice before you clutter your 
  2844. desk with hardcopy books.  KwikINF puts it at your fingertips. 
  2845.  
  2846. For more detailed information on KwikINF, see the Tools Reference in the 
  2847. Toolkit Information folder. 
  2848.  
  2849.  
  2850. ΓòÉΓòÉΓòÉ 19.5.1. About the Author ΓòÉΓòÉΓòÉ
  2851.  
  2852. Paul Brightly is a Staff Programmer in the OS/2 and Workplace OS Tools 
  2853. development organization, where he is presently working on Workplace OS tools 
  2854. and samples.  Paul has been working on OS/2-related projects since 1987 when he 
  2855. joined IBM. 
  2856.  
  2857.  
  2858. ΓòÉΓòÉΓòÉ 20. Writing Device Drivers - Where to Start? ΓòÉΓòÉΓòÉ
  2859.  
  2860. by Steve Mastrianni 
  2861.  
  2862. I get a lot of questions from developers just starting to write device drivers. 
  2863. One of the most common questions is "How do I get started writing OS/2 device 
  2864. drivers?"  Well, that depends on your background. 
  2865.  
  2866. Because device drivers interact with the OS/2 kernel, you should have a good 
  2867. understanding of the basic functions provided by OS/2, such as multithreading, 
  2868. priorities, memory allocation, and addressing. 
  2869.  
  2870. A majority of the questions I get involve a misunderstanding of how various 
  2871. types of addresses work.  Driver writers must be able to work with virtual, 
  2872. linear, physical, and real addresses.  Since the device driver interacts with 
  2873. the processor at the machine level, a good understanding of the processor 
  2874. architecture is also invaluable.  Failures in a device driver usually hang the 
  2875. system, and tracking them down can be tedious without knowing where to look. 
  2876.  
  2877.  
  2878. ΓòÉΓòÉΓòÉ 20.1. So, What Tools Do I Need? ΓòÉΓòÉΓòÉ
  2879.  
  2880. If you're writing your device drivers in C, you'll need a 16-bit C Compiler 
  2881. such as Microsoft C Version 5.1 or Version 6.0.  You'll also need an assembler, 
  2882. such as the Microsoft Version 6.0 Macro Assembler.  Previous versions (such as 
  2883. Version 5.1) will also work. 
  2884.  
  2885. If you're writing Virtual Device Drivers (VDDs), you'll need a 32-bit C 
  2886. compiler, such as IBM C Set/2 or C Set++ (recommended) or the special 32-bit 
  2887. compiler, CL386, included in the Device Driver Source Kit (DDK).  The DDK also 
  2888. includes the kernel debugger and ASDT32, which you will need to debug your 
  2889. device drivers.  The Periscope Debugger is available commercially. 
  2890.  
  2891. You also should get the OS/2 Technical Library, a 50-pound collection of 
  2892. developer reference books, which includes the OS/2 Physical Device Driver 
  2893. Reference, Virtual Device Driver Reference, and Presentation Driver Reference. 
  2894. The library is also available as part of the OS/2 Online Book Collection 
  2895. CD-ROM. 
  2896.  
  2897. You can get the book, Writing OS/2 2.1 Device Drivers in C, 2nd edition.  It's 
  2898. the only tutorial on writing OS/2 2.x device drivers.  Call 1-800-842-3636 to 
  2899. order. 
  2900.  
  2901. Support for device driver writers is free via IBM's DUDE (Dynamic Upload and 
  2902. Download Environment).  Periodically, the DUDE team archives the questions into 
  2903. a file (removing names), which you can download.  See the Directory of this 
  2904. Newsletter on how to access the DUDE. 
  2905.  
  2906. You can download the file CDISK.ZIP from the Libraries section, Device Drivers, 
  2907. of OS2DF1 on CompuServe.  CDISK.ZIP includes several sample device drivers, 
  2908. including a VDD sample, all written in C. 
  2909.  
  2910. I've always written my drivers in C; IBM has historically written them in 
  2911. assembler.  This is evidenced by the code in the PDD reference, which contains 
  2912. MASM examples of DevHlp calls.  With the advent of Workplace OS, IBM has begun 
  2913. to document C-language interfaces to the DevHlps.  Future releases of the DDK 
  2914. and driver references will include these. 
  2915.  
  2916.  
  2917. ΓòÉΓòÉΓòÉ 20.2. Another Question... ΓòÉΓòÉΓòÉ
  2918.  
  2919. Another question I get asked frequently is "How can I initialize a memory 
  2920. mapped adapter during initialization (Init time)?"  Very often, adapters must 
  2921. have their memory loaded with a program or initialized.  Many device driver 
  2922. writers experience their first Trap 13 (General Protection Fault) when 
  2923. attempting to perform this operation during Init. 
  2924.  
  2925. The most common cause is that driver writers sometimes forget that Init is run 
  2926. as a ring 3 thread of the system.  Mapping a physical address to a virtual 
  2927. address with PhysToVirt yields a GDT-based pointer, which is not usable from a 
  2928. ring 3 thread.  Ring 3 threads do not have GDT access; only LDT access. 
  2929.  
  2930. The solution to this problem is to map the physical address of the adapter to a 
  2931. virtual address that's mapped into the application's LDT.  This is done with 
  2932. the PhysToUVirt DevHlp call, rather than the PhysToVirt call. 
  2933.  
  2934. If you have a lot of data to download to the adapter, keep it in a disk file, 
  2935. and use the standard DosOpen, DosRead, and DosClose APIs.  This is possible 
  2936. because Init is running as a ring 3 thread, which is the same ring level at 
  2937. which most applications run. 
  2938.  
  2939.  
  2940. ΓòÉΓòÉΓòÉ 20.3. And, Yet Another Question... ΓòÉΓòÉΓòÉ
  2941.  
  2942. "How can device drivers can transfer data at interrupt time?" 
  2943.  
  2944. This is a little tricky; but easy once it's been explained.  Remember that Init 
  2945. runs as a ring 3 thread with access to the application program's LDT.  The rest 
  2946. of the time, your device driver operates in the lowest ring, ring 0. While at 
  2947. ring 0, the device driver has full access to the GDT and for the most part, the 
  2948. entire system. 
  2949.  
  2950. The problem is that when an interrupt occurs, your program might not be the 
  2951. program that is currently running.  For example, your program might be blocked 
  2952. waiting for I/O or waiting on a semaphore.  Because of this, the context, or 
  2953. current environment at t hat instant, might not be known. 
  2954.  
  2955. Trying to map an application's buffer address at interrupt time will not work. 
  2956. To maintain addressability in any context, the application's buffer address 
  2957. must be mapped to a GDT selector.  The selector, however, must be allocated 
  2958. during Init, and then mapped to the GDT selector for later use during interrupt 
  2959. time. Remember that even though you map the selector during Init, you can't use 
  2960. it during Init. 
  2961.  
  2962.  
  2963. ΓòÉΓòÉΓòÉ 20.3.1. About the Author ΓòÉΓòÉΓòÉ
  2964.  
  2965. Steve Mastrianni is an industry consultant specializing in device drivers and 
  2966. real-time applications for OS/2.  The author of "Writing OS/2 Device Drivers in 
  2967. C", Steve is regarded as one of the industry's leading experts in OS/2 and OS/2 
  2968. device drivers. 
  2969.  
  2970.  
  2971. ΓòÉΓòÉΓòÉ 21. DDK Notes ΓòÉΓòÉΓòÉ
  2972.  
  2973. by Judith A. Courter 
  2974.  
  2975. Version 1.1 of the IBM Device Driver Source Kit for OS/2 (DDK) became available 
  2976. on September 30, 1993.  If you previously ordered the one year program, Version 
  2977. 1.1 was automatically shipped to you.  If you ordered the single-issue copy of 
  2978. Version 1.0, you can start your yearly program now by ordering Version 1.1. 
  2979. (Call 1-800-6DEVCON.) 
  2980.  
  2981. We hope you are pleased with the direction the DDKs are going.  We've received 
  2982. your requests through the DUDE, conferences, and trade shows and are trying to 
  2983. satisfy them as fast as possible.  I enjoyed meeting many of you at the Device 
  2984. Driver Conference held in San Jose in July; it was a great opportunity to talk 
  2985. to you and find out what you needed in order to write your OS/2 drivers. 
  2986.  
  2987. If you haven't signed up for the DUDE, see the Directory of this newsletter for 
  2988. more information on DDK support. 
  2989.  
  2990. For those of you who started with the Beta in February, you can see how we've 
  2991. grown in the last several months.  Some of the new items are the direct result 
  2992. of requests we've received from you.  For example, a new tool, DDKREF, has been 
  2993. added to enable vi ewing the online documentation directly from your CD-ROM 
  2994. instead of installing the books on your hard drive.  We've added a new tool, 
  2995. DELDDK, to use if you ever want to delete the DDK.  Several files created by 
  2996. the install program are not obvious to you a nd if not deleted could cause 
  2997. problems when reinstalling or installing a new DDK.  DELDDK takes care of 
  2998. these. Additionally, you've asked for debuggers and we've provided 7, plus 
  2999. documentation.  Some of the other online documentation has been updated and 
  3000. expanded. 
  3001.  
  3002.  
  3003. ΓòÉΓòÉΓòÉ 21.1. Using Your DDK ΓòÉΓòÉΓòÉ
  3004.  
  3005. Version 1.0 contained an online book called General Information.  It has been 
  3006. renamed Using Your DDK.  This book contains the following helpful information: 
  3007.  
  3008. o A listing and description of all new drivers, tools, and books contained in 
  3009.   this version. 
  3010.  
  3011. o A listing of each driver and a cross-reference to the compiler/assembler 
  3012.   needed by each driver and tool. 
  3013.  
  3014. o A directory structure overview of the DDK. 
  3015.  
  3016. o A listing of each compiler/assembler used in the DDK and a cross-reference to 
  3017.   the device drivers and tools. 
  3018.  
  3019. o The file names of all drivers that can be built using the DDK. 
  3020.  
  3021. o A listing of some useful reference books that may help you develop your own 
  3022.   device drivers under OS/2; including excerpts from Steven Mastrianni's book, 
  3023.   Writing OS/2 2.1 Device Drivers in C. 
  3024.  
  3025. o Documentation on the 32 bit Mini-Driver Rasterizing Printer Driver sample. 
  3026.  
  3027.  
  3028. ΓòÉΓòÉΓòÉ 21.2. It's a Program ΓòÉΓòÉΓòÉ
  3029.  
  3030. As we've said in the past, it doesn't end here!  The DDK Team is currently 
  3031. working on the next DDK.  It will contain additional device driver source code, 
  3032. more tools, and restructured and expanded documentation.  If you haven't 
  3033. ordered the DDK, see the Directory of this newsletter for more information on 
  3034. ordering. 
  3035.  
  3036.  
  3037. ΓòÉΓòÉΓòÉ 21.3. Version 1.1 Contents ΓòÉΓòÉΓòÉ
  3038.  
  3039. The Version 1.1 CD-ROM contains almost 140MB of source, tools, debuggers, and 
  3040. documentation.  The following list identifies what's new: 
  3041.  
  3042. o Video Device Drivers 
  3043.  
  3044.    - 32-Bit S3 Chip Set Support (8 bit color) 
  3045.  
  3046.    - 32-Bit ISO Fonts 
  3047.  
  3048.    - DBCS VGA/SVGA PM Display 
  3049.  
  3050.    - Screen Base Videos 
  3051.  
  3052. o Printer Device Drivers 
  3053.  
  3054.    - 32-Bit 42xx Rasterizing Sample 
  3055.  
  3056.    - 32-Bit Mini-Driver Rasterizing Sample 
  3057.  
  3058. o DASD Device Driver 
  3059.  
  3060.    - Adapter Presence-Check Services 
  3061.  
  3062. o PCMCIA Device Driver 
  3063.  
  3064.    - Client Services Sample 
  3065.  
  3066. o Multimedia Device Drivers and Installs 
  3067.  
  3068.    - Generic Audio Installation 
  3069.  
  3070.    - Generic Video Installation 
  3071.  
  3072.    - Audio Vendor-Specific Resource File 
  3073.  
  3074.    - Video Capture Adapter PDD 
  3075.  
  3076.    - Video Capture Adapter VSD 
  3077.  
  3078. o Clock Device Drivers 
  3079.  
  3080. o Debuggers 
  3081.  
  3082.    - 5 OS/2 Debug Kernels 
  3083.  
  3084.    - ASDT32 Debugger 
  3085.  
  3086.    - Debugo 
  3087.  
  3088. o Test Tools/Suites 
  3089.  
  3090.    - 32-Bit Font Test Tool 
  3091.  
  3092.    - MMPM/2 P2String Audio Test Suites 
  3093.  
  3094.    - MMPM/2 P2String Video Test Suites 
  3095.  
  3096. o DDK Tools 
  3097.  
  3098.    - DELDDK 
  3099.  
  3100.    - DDKREF 
  3101.  
  3102. o Updated and expanded on-line documentation 
  3103.  
  3104.  
  3105. ΓòÉΓòÉΓòÉ 21.3.1. About the Author ΓòÉΓòÉΓòÉ
  3106.  
  3107. Judith A. Courter is the Manager of the POS Toolkit Development department. 
  3108. She started a dedicated DDK team in August of 1993.  Judi has held a variety of 
  3109. programming positions since she began with IBM in 1981. 
  3110.  
  3111.  
  3112. ΓòÉΓòÉΓòÉ 22. Order Form ΓòÉΓòÉΓòÉ
  3113.  
  3114. The Developer Connection for OS/2
  3115.  
  3116. ORDER FORM 
  3117.  
  3118. Send this completed Order Form and $199.00 for each single, annual subscription 
  3119. and $75.00 for each additional license (plus applicable shipping charges and 
  3120. sales tax).  Members of the U.S.  Commercial/Premier Services of the IBM 
  3121. Developer's Assistance Program can get a discount by calling 1-800-6DEVCON 
  3122. (1-800-633-8266). IBM Order Fulfillment, 010J   Fax This Form to:
  3123. P.O. Box 9031          1-800-494-3045
  3124. Boulder, CO 80301-9191
  3125.  
  3126. Receive By Mail an annual subscription consisting of 4 CD's and newsletters, 
  3127. plus access to the interactive forum for one year.* Please allow 1-2 weeks for 
  3128. delivery. 
  3129.  
  3130. Please Complete (please print or type): 
  3131.  
  3132. Bill To: 
  3133.  
  3134.  
  3135. __________________________________________________________________
  3136. Name
  3137.  
  3138. __________________________________________________________________
  3139. Company Phone
  3140.  
  3141. __________________________________________________________________
  3142. Street
  3143.  
  3144. __________________________________________________________________
  3145. City   State  Zip
  3146.  
  3147. MethodofPayment :( Checkone )
  3148.  
  3149.  
  3150.  ____Visa  ___MasterCard ____American Express  ___ Discover ___Other Payment Method 3
  3151.  
  3152.  
  3153. Card#________________________________________________________________________
  3154.  
  3155. Annual Subscription (Qty):    ____ x 199.00  =    $__________
  3156.  
  3157. Additional Licenses (Qty):    ____ x  75.00  =    $__________
  3158.  
  3159.                     TOTAL  =    $__________4
  3160.  
  3161. I certify that the information I have provided is accurate and complete and the 
  3162. submission of this form is in accordance with the conditions specified below. 
  3163.  
  3164.  
  3165. ____________________________________________________________________
  3166. Signature (required when ordering by credit card)        Date
  3167.  
  3168. Instructions: 
  3169.  
  3170.  1. To ensure speedy delivery, please make sure that the information provided 
  3171.     is accurate and legible. 
  3172.  
  3173.  2. If you have any questions, please call 1-800-6DEVCON. 
  3174.  
  3175.  3. To pay by check/money order or to submit a Corporate Purchase Order, please 
  3176.     call 1-800-6DEVCON for instructions. 
  3177.  
  3178.  4. Applicable Sales Tax and Shipping and handling charges will be added to 
  3179.     your total. 
  3180. Conditions: 
  3181.  
  3182. o The Developer Connection for OS/2 is for the customer's own use and is not to 
  3183.   be remarketed. 
  3184.  
  3185. o Lost or misdirected Order Forms are not the responsibility of IBM or IBM 
  3186.   Fulfillment  Headquarters. 
  3187.  
  3188. o IBM reserves the right to modify or withdraw this offer at any time. 
  3189. *CompuServe membership is required 
  3190. IBM and OS/2 are registered trademarks of International Business Machines 
  3191. Corporation. The Developer Connection for OS/2 is a trademark of International 
  3192. Business Machines Corporation.  Other products and brand names may be 
  3193. trademarks or registered trademarks of their respective owners. 
  3194.  
  3195. International Business Machines Corporation, 1993.  All Rights Reserved. 
  3196.  
  3197. IBM Order Fulfillment 010J P.O. Box 9031 Boulder, CO 80301-9191 
  3198.  
  3199. 11-93 
  3200.  
  3201.  
  3202. ΓòÉΓòÉΓòÉ 23. Q's and A's ΓòÉΓòÉΓòÉ
  3203.  
  3204. Question 1: 
  3205.  
  3206. My Toolkit will not run properly.  I get a message that the file PMREF cannot 
  3207. be found.  How do I solve this problem? 
  3208.  
  3209. Answer: 
  3210.  
  3211. References to PMREF should be changed to the name PMFUN.  This seems to fix the 
  3212. problem.  Also, C/Set&Toolkit&WorkFrame must be installed in the following 
  3213. order:  Toolkit, WorkFrame, C Set/2.  If they are not, WorkfFame will not be 
  3214. aware of C Set/2 and some of the function will not be available. 
  3215.  
  3216. If you get missing libraries, such as dde4XXXX, you need to go back and install 
  3217. the migration part of the compiler. 
  3218.  
  3219. Question 2: 
  3220.  
  3221. I get an Error Unresolved External 2029 message when trying to link a program. 
  3222. Why? 
  3223.  
  3224. Answer: 
  3225.  
  3226. The following statements need to be present and correct in the OS/2 CONFIG.SYS 
  3227. file: 
  3228.  
  3229.  1. The LIBPATH line must include: 
  3230.  
  3231.         x:\TOOLKT20\DLL;x:\IBMC\DLL;x:\IBMWF\DLL;
  3232.  
  3233.     (x: = drive letter) 
  3234.  
  3235.  2. The SET PATH line must include: 
  3236.  
  3237.         x:\TOOLKT20\OS2BIN;x:\IBMC\BIN;x:\IBMWF\BIN;
  3238.  
  3239.  3. The SET DPATH line must include 
  3240.  
  3241.         x:\IBMC\LOCALE;x:\IBMC\HELP;x:TOOLKT20\BOOK;
  3242.  
  3243.  4. The SET HELP line must include: 
  3244.  
  3245.         x:\TOOLKT20\OS2HELP;x:\IBMC\HELP;x:\IBMWF\HELP;
  3246.  
  3247.  5. SET IPF_KEYS=SBCS 
  3248.  
  3249.  6. The following lines should be at the end of the CONFIG.SYS: 
  3250.  
  3251.         SET PROGREF20=GUIREF20.INF
  3252.         SET PMREF=PMFUN.INF+PMGPI.INF+PMHOK.INF+PMMSG.INF
  3253.                   +PMREL.INF+PMWIN.INF+PMWKP.INF
  3254.         SET HELPNDX=EPMKWHLP.NDX+DDE4.NDX
  3255.         SET IPFC=x:\TOOLKT20\IPFC;
  3256.         SET INCLUDE=x:\TOOLKT20\C\OS2H;
  3257.               x:\TOOLKT20\ASM\OS2INC;x:\IBMC\INCLUDE
  3258.         SET LIB=x:\TOOLKT20\OS2LIB;x:\IBMC\LIB
  3259.  
  3260. Question 3: 
  3261.  
  3262. I notice that the OS/2 2.0 toolkit documentation, specifically the manual OS/2 
  3263. 2.0 Physical Device Driver Reference, was not changed to reflect the code 
  3264. change to touch display support.  Is there a reason for this? 
  3265.  
  3266. Answer: 
  3267.  
  3268. The mouse IDC, Process_Absolute, has been changed in OS/2 2.0 because a defect 
  3269. was raised by the IBM Touch Display support added to 2.0.  The change was to 
  3270. remove the function where the MOUSE.SYS device driver would check the movement 
  3271. of the mouse pointer against the button mask that was passed in and change that 
  3272. mask if there was a discrepancy.  This was deemed in error since there are 
  3273. occasions where the device-dependent driver may want to pass these bogus values 
  3274. up the chain to running applications. 
  3275.  
  3276. The OS/2 2.0 Toolkit documentation, specifically the manual OS/2 2.0 Physical 
  3277. Device Driver Reference, was not changed to reflect the code change.  In the 
  3278. Physical Mouse Device Driver Reverence (in the Mouse IDC section), there is a 
  3279. reference to the "EVENT" field that should be changed. 
  3280.  
  3281. Remove/ignore the following sentence: 
  3282.  
  3283. The event field should never indicate that motion was associated with the
  3284. event.  MOUSE$ determines if motion occurs.
  3285.  
  3286. Question 4: 
  3287.  
  3288. I created an application program, but the CD drive doesn't respond as it does 
  3289. with the Compact Disc program.  What am I doing wrong? 
  3290.  
  3291. Answer: 
  3292.  
  3293. Check proper use of APIs and verify sufficient stack is used when creating a 
  3294. second thread, as follows: 
  3295.  
  3296.  1. Check that you are using commands with the same alias that was used on the 
  3297.     "open" if using the string interface, or the same DeviceID that was 
  3298.     returned on the MCI_OPEN command if using the procedural interface. 
  3299.  
  3300.  2. If creating a second thread, make sure that sufficient stack is allocated. 
  3301.     The IOCTL router or CD drive driver sometimes acts peculiar if low stack is 
  3302.     used on a secondary thread.  We recommend 64KB, but you must have at least 
  3303.     16KB. 
  3304.  
  3305.  3. If using C Set/2, use _beginthread instead of DosCreateThread.  See the C 
  3306.     Set/2 user's manual for more details. 
  3307.  
  3308. Question 5: 
  3309.  
  3310. I am getting a general protection fault error when I try to run an FSCANF 
  3311. statement in a DLL.  The DLL is being called from two different programs in two 
  3312. different sessions.  What is happening? 
  3313.  
  3314. Answer: 
  3315.  
  3316. The FSCANF and other like functions are called critical functions.  They cannot 
  3317. be run in a DLL because they lack SEMAPHORES.  This means that when an FSCANF 
  3318. runs, it grabs hold of everything and doesn't allow another process the use of 
  3319. FSCANF.  The solution is to use exception handling or DosRead.  The DosRead 
  3320. functions have SEMAPHORES built in, and therefore allow multiple processes to 
  3321. simultaneously access them. 
  3322.  
  3323. Question 6: 
  3324.  
  3325. My system hangs intermittently (shell hang; not kernel) when running certain PM 
  3326. Applications that utilize DosKillThread() or DosKillProcess().  What is the 
  3327. reason for this? 
  3328.  
  3329. Answer: 
  3330.  
  3331. The problem is that any thread that makes PMWIN calls may own/control certain 
  3332. PMWIN controls, such as semaphores, and may be currently in the middle of 
  3333. updating global PMWIN structures.  Both DosKillThread() and DosKillProcess() 
  3334. will force the thread(s) of the process to die upon immediately exiting from 
  3335. the Kernel.  However, PMWIN runs at rings 3 and 2, so their operations are not 
  3336. completely within the kernel.  This may cause a user thread to die while in the 
  3337. middle of updating a PMWIN structure. 
  3338.  
  3339. The only resolution, until PMWIN becomes 32-bit, is for the developer to use 
  3340. some form of IPC in place of DosKillxx() calls (such as, Semaphores, Queues, 
  3341. Shared Memory, or Presentation Manager Messages.) 
  3342.  
  3343.  
  3344. ΓòÉΓòÉΓòÉ 24. Tips 'N Techniques ΓòÉΓòÉΓòÉ
  3345.  
  3346. Use the following tips to increase your productivity! 
  3347.  
  3348.  
  3349. ΓòÉΓòÉΓòÉ 24.1. Device Driver Tips: ΓòÉΓòÉΓòÉ
  3350.  
  3351. o To access a GDT selector during Init, start a timer handler that will be 
  3352.   called within 32ms at ring 0; then perform the access. 
  3353.  
  3354. o If you need to post a 32-bit shared even semaphore at interrupt time, which 
  3355.   normally can't be done, allocate and arm a context hook.  This hook will be 
  3356.   called at task time and therefore will be able to post the semaphore. 
  3357.  
  3358.  
  3359. ΓòÉΓòÉΓòÉ 24.2. Performance Tip: ΓòÉΓòÉΓòÉ
  3360.  
  3361. o Tip: 
  3362.  
  3363.   Reduce your icon sizes and increase system performance. 
  3364.  
  3365. o Technique: 
  3366.  
  3367.   Attaching icons to desktop objects (abstract objects for WPS programmers) can 
  3368.   increase the size of the OS2.INI file.  This can potentially effect system 
  3369.   performance.  Large icons shipped with software cascades this effect to 
  3370.   users. 
  3371.  
  3372.   Icons are stored as bitmap arrays.  This allows for different display types 
  3373.   and resolutions.  Unfortunately, the more formats stored, the larger they 
  3374.   get.  But many icons don't require many colors or resolution.  If you edit 
  3375.   them with the icon editor and save only the Independent VGA format, they will 
  3376.   be less than 1K. If this format isn't present, just add it from the menu. 
  3377.   The existing format will be rendered into the new format.  And, the VGA is a 
  3378.   pretty good lowest-common-display type. 
  3379.  
  3380.   The opposite extreme can be seen by saving an icon with all possible formats. 
  3381.   The resulting file is around 17K.  With so many desktop objects, you can see 
  3382.   how we can all benefit by smaller icons. 
  3383.  
  3384.  
  3385. ΓòÉΓòÉΓòÉ 24.3. KwikINF Tips and Techniques: ΓòÉΓòÉΓòÉ
  3386.  
  3387. Like any tool, there are good and bad ways to use them.  Here are some of my 
  3388. favorite tips for getting the best use and performance out of KwikINF. 
  3389.  
  3390. Don't use full-screen monitors if you don't need them.  It wastes memory and 
  3391. creates a keyboard monitor for every full screen session you start (up to the 
  3392. maximum set in the configuration menu. 
  3393.  
  3394. Keep books open if you intend to keep accessing them.  It can take a long time 
  3395. to open a book.  If you're writing new code, you'll likely want frequent access 
  3396. to certain online references.  If you leave the book open (minimized), you 
  3397. won't have to wait so long each time you press Alt+Q. 
  3398.  
  3399. Trim down your index files!  If you create an index file for your own online 
  3400. reference, then take advantage of the wildcard character (*) supported in index 
  3401. files.  Every single entry in an index file has to be allocated, added to an 
  3402. index table in memory , and searched by KwikINF.  If we didn't use Win* to 
  3403. specify the PM reference in the toolkit index file, there would be a LOT of 
  3404. unnecessary index entries for every WinXXX API in our index table. 
  3405.  
  3406. Don't restrict KwikINF to your editor.  There are other ways to benefit from 
  3407. this tool.  I've often typed an API on a Windowed Command Prompt so I could 
  3408. press Alt+Q and get help on it.  And one of my favorite tricks is to get help 
  3409. while I'm reading E-mail or a public forum.  I can answer a technical question 
  3410. with the press of a key. 
  3411.  
  3412.  
  3413. ΓòÉΓòÉΓòÉ 24.4. MMPM/2 Tips and Techniques: ΓòÉΓòÉΓòÉ
  3414.  
  3415. o Tip: 
  3416.  
  3417.   Improve overall performance in MMPM/2 applications. 
  3418.  
  3419. o Technique 1: 
  3420.  
  3421.   WRITE MULTITHREADED APPLICATIONS!  This is the most important tip and cannot 
  3422.   be stressed enough!  OS/2 is a very powerful operating system and provides 
  3423.   its programmers with the ability to execute more than one activity (thread) 
  3424.   at a time.  This is not automatic, however; it must be programmed into 
  3425.   applications.  The benefits gained from multithreaded applications are 
  3426.   tremendous.  This is especially true when it comes to Presentation Manager 
  3427.   (PM) applications.  A PM application should never tie up its main message 
  3428.   procedure's thread for very long.  If it does, users will experience the OS/2 
  3429.   timer icon, and be unable to manipulate the application (or other 
  3430.   applications) for a period of time.  This also holds when programming 
  3431.   MultiMedia Presentation Manager/2 (MMPM/2) applications.  Time-consuming 
  3432.   Media Control Interface calls should not be made from within a PM 
  3433.   application's main message procedure's thread.  Instead, a worker thread 
  3434.   should be created to make the MCI call.  The most time consuming calls incl 
  3435.   ude MCI_OPEN, MCI_CUT, MCI_COPY, MCI_PASTE, MCI_SAVE, and sometimes MCI_LOAD 
  3436.   (this depends on the device and/or the file size). 
  3437.  
  3438. o Technique 2: 
  3439.  
  3440.   Use the MMPM/2 pre-roll capability provided through the MCI_CUE message. 
  3441.   When an application will have a time delay between an MCI_LOAD and an 
  3442.   MCI_PLAY of a file (like a Wave Player application:  where the user opens a 
  3443.   file [MCI_LOAD], then presses a butt on to start playing the file [MCI_PLAY]) 
  3444.   the application should make an MCI_CUE call.  This message will pre-roll the 
  3445.   data (pre-fill the play buffers) and allow the MCI_PLAY to start immediately. 
  3446.   Without the MCI_CUE message, an MCI_PLAY will take longer as it will 
  3447.   automatically take the time to perform an MCI_CUE. 
  3448.  
  3449.   Note:  The MCI_CUE will have no effect if the MCI_PLAY uses the MCI_FROM 
  3450.          flag.  The MCI_FROM will change the start position of a file and thus 
  3451.          invalidate the buffers that were pre-filled.  If a file is to be 
  3452.          played FROM a particular position, one should first MCI_SEEK to the 
  3453.          position, issue the MCI_CUE, and then finally, when appropriate, issue 
  3454.          the MCI_PLAY message. 
  3455.  
  3456. o Technique 3: 
  3457.  
  3458.   Don't close a device unless necessary.  Many applications MCI_OPEN a device, 
  3459.   MCI_LOAD a file, MCI_PLAY the file, and then MCI_CLOSE the device they are 
  3460.   using.  This is fine, however, some of these applications then turn around 
  3461.   and re-issue MCI_OPEN the same device, MCI_LOAD another file, MCI_PLAY, and 
  3462.   then MCI_CLOSE again.  This is very wasteful.  On each open, a device must be 
  3463.   initialized, resource must be allocated, and so on.  It is much more 
  3464.   efficient (and desirable) to leave the device open and simply do another 
  3465.   MCI_LOAD and then another MCI_PLAY.  The basic rule of thumb to follow is: 
  3466.   Re-open a device as little as possible. 
  3467.  
  3468. o Technique 4: 
  3469.  
  3470.   Open and close devices that will be needed prior to using them.  The most 
  3471.   time consuming MCI message is the MCI_OPEN message.  Opening a device takes 
  3472.   time due to the amount of work that must be accomplished (initializing the 
  3473.   device, allocating device reso urce, making the appropriate connections and 
  3474.   perhaps, even loading a file).  The MCI_OPEN takes a bit longer than usual 
  3475.   when a device is opened for the first time, because the associated dynamic 
  3476.   link libraries (DLLs) for that device must be loaded.  Pre-opening and 
  3477.   closing the particular device(s) that will/may be used will load the needed 
  3478.   DLLs.  These DLLs will remain loaded (even after an MCI_CLOSE), as long as 
  3479.   the application is still running.  Subsequent MCI_OPEN calls will occur 
  3480.   quicker, because the DLLs are already loaded.  For example, a digital video 
  3481.   application could, on its initialization, create a thread to open and then 
  3482.   close the digital video devices it might be using.  When the user determines 
  3483.   which device will be used (perhaps by selecting a particular video file) the 
  3484.   device's DLLs will have already been loaded, and thus the open will occur 
  3485.   quicker. 
  3486.  
  3487.   Note:  When MMPM/2's system sounds are installed, part of the audio subsystem 
  3488.          will have already been loaded at system boot time, thus there may not 
  3489.          be a need to open and close the audio device prior to using it in an 
  3490.          application. 
  3491.  
  3492.  
  3493. ΓòÉΓòÉΓòÉ 25. Conference Column ΓòÉΓòÉΓòÉ
  3494.  
  3495. Look to this column each issue for the most up-to-the-minute information on 
  3496. OS/2 conferences.  Be sure to register for these conferences early, as you 
  3497. don't want to be left out! 
  3498.  
  3499.  
  3500. ΓòÉΓòÉΓòÉ 25.1. PSP Technical Interchange Featuring OS/2 and LAN Systems ΓòÉΓòÉΓòÉ
  3501.  
  3502. So, you enjoyed the technical interchange in Orlando, and can't wait for the 
  3503. next one?  Well, the good news is that PSP is currently planning the next one; 
  3504. the bad news is that it's not planned until April.  Here's the preliminary 
  3505. information: 
  3506.  
  3507. Where:    San Francisco, California at the San Francisco Hilton 
  3508.  
  3509. When:     April 25, 1994 to April 29, 1994 
  3510.  
  3511. Cost:     895 USD; however, a discounted fee of 795USD is available until March 
  3512.           21, 1994. 
  3513.  
  3514. Contact:  US: 1-800-872-7109 
  3515.           All other countries: 1-508-443-3330 
  3516.  
  3517. Look in the February issue of The Developer Connection News for more details. 
  3518.  
  3519.  
  3520. ΓòÉΓòÉΓòÉ 25.2. Trade Shows ΓòÉΓòÉΓòÉ
  3521.  
  3522. The following are some of the major trade shows through April of 1994. 
  3523.  
  3524. What:     Networks Expo 
  3525. Where:    Boston, Massachusetts 
  3526. When:     February 15 
  3527. Contact:  Bruno Blenheim, Inc. 
  3528.           1-800-829-3976/1-201-346-1400 
  3529.  
  3530. What:     Software Development and Business Software Solutions 
  3531. Where:    San Jose, California 
  3532. When:     February 15 
  3533. Contact:  Miller Freeman, Inc. 
  3534.           1-415-905-2741 
  3535.  
  3536. What:     Federal Office Systems Symposium 
  3537. Where:    Washington, DC 
  3538. When:     March 21 
  3539. Contact:  National Trade Productions 
  3540.           1-800-638-8510/1-703-683-8500 
  3541.  
  3542.  
  3543. ΓòÉΓòÉΓòÉ 26. Directory ΓòÉΓòÉΓòÉ
  3544.  
  3545. Ever wonder where to call to order a product or to voice a particular problem 
  3546. or concern.  Well, we believe it's our job to let you know how to contact IBM. 
  3547. Watch this space; we'll continually update this information. 
  3548.  
  3549. The Developer Connection for OS/2            1-800-6DEVCON (1-800-633-8266) 
  3550.                                              phone 
  3551.                                              1-800-494-3045 fax 
  3552.  
  3553. Additional Order Numbers 
  3554.  
  3555. To order in Europe: 
  3556.  
  3557. The Developer Connection for OS/2 can be ordered direct from IBM SPC in Denmark 
  3558. if you live outside the US, Canada, or Asia/Pacific.  Please ensure that you 
  3559. dial the international access code applicable to your country before dialing 
  3560. the appropriate phone number.  This applies to both telephone and fax orders. 
  3561. Operators speaking the following languages are available.  Note that 45 is the 
  3562. country code for Denmark. 
  3563.  
  3564. Dutch               45-3-252-7088 
  3565. English             45-3-252-6588 
  3566. French              45-3-252-7411 
  3567. German              45-3-252-6711 
  3568. Italian             45-3-252-7622 
  3569. Spanish             45-3-252-6311 
  3570. FAX                 45-3-252-8203 
  3571.  
  3572. To order in Canada: 
  3573.  
  3574. The Developer Connection for OS/2 can be ordered direct from Canada.  Please 
  3575. dial the following appropriate number: 
  3576.  
  3577. 1-800-561-5293 (phone) 
  3578. 1-416-946-5700 (fax) 
  3579.  
  3580. To order in Asia/Pacific: 
  3581.  
  3582. The Developer Connection for OS/2 can be ordered in Asia/Pacific countries. 
  3583. Please ensure that you dial the international access code applicable to your 
  3584. country before the listed phone number.  Note that 61 is the country code for 
  3585. Australia. 
  3586.  
  3587. 61-2-354-7684 (phone) 
  3588. 61-2-354-7766 (fax) 
  3589.  
  3590. To order in Mexico: 
  3591.  
  3592. The Developer Connection for OS/2 can be ordered direct from Mexico. Please 
  3593. dial the appropriate phone number. 
  3594.  
  3595. 91-800-00639 (Country) 
  3596. 627-2444 (Mexico City) 
  3597. To order in Brazil: 
  3598.  
  3599. The Developer Connection for OS/2 can be ordered direct from Brazil. Please 
  3600. dial the appropriate phone number. 
  3601.  
  3602. 0800-111205 (phone) 
  3603. (011) 886-3222 (fax) 
  3604.  
  3605. Electronic Support 
  3606.  
  3607. Electronic support is provided through CompuServe.  Obtain technical support or 
  3608. use the forum to exchange messages, ideas, comments, or concerns with The 
  3609. Developer Connection for OS/2 team or other members.  The dedicated Developer 
  3610. Connection section is located in the IBM OS/2 Developer Forum 2. To obtain 
  3611. access to this section, please send a note with your subscription number to the 
  3612. Developer Connection Administrator at CompuServe user id 73423,2767.  You will 
  3613. receive notification or access to the Developer Connection section within 2 
  3614. business days. 
  3615.  
  3616. To access the forum, type GO OS2DF2 at the ! prompt; then, select the Developer 
  3617. Connection section. 
  3618.  
  3619. For CompuServe membership information, call one of the following numbers 
  3620. depending on where you are located. 
  3621.  
  3622. From Germany                            0130 37 32 
  3623. From the United Kingdom                 0800 289 378 
  3624. From other countries in Europe          (+44) (+272) (255 111) 
  3625. From the U.S.                           1-800-524-3388 
  3626. From elsewhere                          1-614-457-0802 
  3627. Ask for Representative 239.  You will receive a special introductory membership 
  3628. for IBM customers. 
  3629.  
  3630. IBM Device Driver Source Kit for OS/2             1-800-6DEVCON 
  3631.                                                   (1-800-633-8266) phone 
  3632.                                                   1-407-982-3217 modem 
  3633.                                                   1-407-982-4239 voice 
  3634.  
  3635. Additional Order Numbers 
  3636.  
  3637. To order in Europe: 
  3638.  
  3639. The Device Driver Source Kit can be ordered direct from IBM SPC in Denmark if 
  3640. you live outside the US, Canada, Asia/Pacific, or Brazil.  Please ensure that 
  3641. you dial the international access code applicable to your country before 
  3642. dialing the appropriate phone number.  This applies to both telephone and fax 
  3643. orders.  Operators speaking the following languages are available.  Note that 
  3644. 45 is the country code for Denmark. 
  3645.  
  3646. Dutch               45-3-252-7088 
  3647. English             45-3-252-6588 
  3648. French              45-3-252-7411 
  3649. German              45-3-252-6711 
  3650. Italian             45-3-252-7622 
  3651. Spanish             45-3-252-6311 
  3652. FAX                 45-3-252-8203 
  3653.  
  3654. To order in Canada: 
  3655.  
  3656. The Device Driver Source Kit can be ordered direct from Canada.  Please dial 
  3657. the following appropriate number: 
  3658.  
  3659. 1-800-465-7999 (phone) 
  3660.  
  3661. To order in Asia/Pacific: 
  3662.  
  3663. The Device Driver Source Kit can be ordered in Asia/Pacific countries. Please 
  3664. ensure that you dial the international access code applicable to your country 
  3665. before the listed phone number.  Note that 61 is the country code for 
  3666. Australia. 
  3667.  
  3668. 61-2-354-7684 (phone) 
  3669. 61-2-354-7766 (fax) 
  3670.  
  3671. To order in Brazil: 
  3672.  
  3673. The Device Driver Source Kit can be ordered direct from Brazil. Please ensure 
  3674. that you dial the international access code applicable to your country before 
  3675. the listed phone number.  Note that 02 is the country code for Brazil. 
  3676.  
  3677. 02-1-800-6120 (phone) 
  3678. 02-1-800-6936 (fax) 
  3679.  
  3680. Obtain support for the IBM DDK kit by calling the Dynamic Upload/Download 
  3681. Environment (DUDE) BBS.  After completing a self-registration, you will first 
  3682. have limited access to the system; then, within one business day, you will be 
  3683. notified that your access level has been upgraded to NORMAL.  Send your 
  3684. questions using your PC and modem. 
  3685.  
  3686. If you have problems connecting to the DUDE BBS, you can leave a voice message 
  3687. on 1-407-982-4239.  A member of the DDSC team will return your call before the 
  3688. end of the next business day. 
  3689.  
  3690. OS/2 2.1 Technical Support                        1-800-992-4777 
  3691.  
  3692. When you buy OS/2 2.1, you also receive 60 days of free technical support.  The 
  3693. OS/2 technical support team will provide assistance with installing OS/2 2.1, 
  3694. setting up printers and displays, partitioning disk drives, setting up to run 
  3695. multiple operating systems, moving commercial programs to folders or to the 
  3696. OS/2 desktop, and installing and using Multimedia.  You can also report 
  3697. suspected product defects to the technical support team. 
  3698.  
  3699. Electronic Support (U.S. and Puerto Rico only) 
  3700.  
  3701. Electronic support enables you to access current OS/2 technical information, 
  3702. exchange messages with other OS/2 users, and submit program defects to IBM. 
  3703. Electronic support is available to users with a modem and a telephone line 
  3704. through the OS/2 Bulletin Board System (BBS) or CompuServe. 
  3705.  
  3706. For information about registration and access to the IBM OS/2 BBS, call 
  3707. 1-800-547-1283. 
  3708.  
  3709. For CompuServe membership information, call 1-800-848-8199. 
  3710.  
  3711. If you are already a CompuServe member, type GO OS2SUP at the ! prompt to 
  3712. access the IBM OS/2 forum. 
  3713.  
  3714. Electronic Support (Canada only) 
  3715.  
  3716. Electronic Support enables you to access current OS/2 technical information and 
  3717. exchange messages with other OS/2 users.  Electronic support is available to 
  3718. users with a modem and a telephone line through an OS/2 BBS. 
  3719.  
  3720. You can connect directly to the OS/2 BBS nearest you by dialing one of the 
  3721. following numbers: 
  3722.  
  3723. 1-416-946-4255 
  3724. 1-514-938-3022 
  3725. 1-604-664-6466 
  3726.  
  3727. Note:  Set your modem and communication software to the following:  no parity 
  3728.        bit, 8 data bits, 1 stop bit. 
  3729.  
  3730. The Developer Assistance Program 
  3731.  
  3732. The Developer Assistance Program (DAP) is a worldwide program that offers 
  3733. services to software developers.  Specific services vary by country and 
  3734. development platform.  For more information about the DAP, call: 
  3735.  
  3736. U.S.                1-407-982-6408 (phone) 
  3737.                     1-407-998-7610 (fax) 
  3738.  
  3739. Worldwide           1-407-982-4259 (phone) 
  3740.  
  3741. Additional Phone Numbers 
  3742.  
  3743. All 800 numbers are applicable in the USA only; for individual country numbers, 
  3744. please check on your local BBS or your IBM Representative. 
  3745.  
  3746. IBM Academic Information Systems Ordering Information 1-800-222-7257 
  3747.  
  3748. IBM Direct Marketing               1-800-IBM-2YOU 
  3749. Order IBM ValuePoint systems, IBM ThinkPad systems, IBM Communication and LAN 
  3750. hardware and software, memory options, printer, and typewriter supplies. HOURS: 
  3751. 8:00 a.m.  - 10:00 p.m.  EST. 
  3752.  
  3753. IBM FAX Information Service        1-800-IBM-4FAX 
  3754. Retrieve information on IBM products with your fax machine. 
  3755.  
  3756. IBM LAN Systems Service and Support 1-800-237-5511 
  3757. Technical support for customers who own LAN Systems products. 
  3758.  
  3759. IBM PC Dealer Referral             1-800-237-4824 
  3760. Locate an IBM dealer nearest you. 
  3761.  
  3762. IBM Personal Systems Help Center   1-800-PS2-2227 
  3763. Obtain general information and technical support on ValuePoint systems, 
  3764. ThinkPad systems, PS/2, and OS/2 products.  HOURS:  24-hours a day. 
  3765.  
  3766. Independent Vendor League 
  3767. The Independent Vendor League was formed to meet the specific needs of 
  3768. individuals and companies who develop and market products and services that 
  3769. support OS/2.  It is an association of vendors whose common ground is the IBM 
  3770. OS/2 marketplace. 
  3771.  
  3772.    To join or to receive information         1-203-262-3769 
  3773.                                              1-203-262-3776 
  3774.    To order an IVL Catalog                   1-800-342-6672 
  3775.  
  3776. Multimedia Help Line               1-800-241-1620 
  3777. Obtain technical support for the Multimedia Presentation Manager/2 product. 
  3778.  
  3779. Multimedia Information Center      1-800-IBM-9402 
  3780. Obtain information on the Multimedia Presentation Manager/2 product. 
  3781.  
  3782. OS/2 and IBM LAN Systems Sales     1-800-3-IBM-OS2 
  3783. Purchase OS/2 and IBM LAN Systems products by phone. 
  3784.  
  3785. Ultimedia Tool Series              1-800-887-7771 
  3786. Obtain technical support on the Ultimedia tool series.