home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / PMFLOPPY.ZIP / PMREAD.ME < prev   
Text File  |  1990-04-24  |  7KB  |  135 lines

  1.  
  2. This is a first cut at putting a PM shell over the dskcpy2 program from
  3. Brady Flowers.  I'm trying to head this toward a generic PM floppy disk
  4. utility, and so have added a format routine.  Unfortunately, it doesn't work.
  5. Brady's code has been modified a bit for the PM interface, and to run the
  6. reads and writes as background threads.  This means that you can do multiple
  7. writes at the same, each thread reading out of the buffers created by the read
  8. thread.  This was written under OS/2 1.2, and it blows up under 1.1 (I suspect
  9. this is due to resource differences).  If there's a great demand for a 1.1
  10. version, I'll try to check it out, but I don't really have a 1.1 development
  11. environment.  Otherwise, unless some catastrophic bug turns up, I probably
  12. won't send out another version until I get the format or one of the "future
  13. thoughts" finished,.  Of course, all the standard disclaimers about damage to
  14. data, etc caused by the program apply.  This is public domain software, so use
  15. it at your own risk.  I am providing full source code (including Brady's
  16. original source), in case you don't trust the exe or want to make your own
  17. mods.
  18.  
  19.   Files include:
  20.  
  21. dskcpy2a.zip     ; Brady's original program
  22. copydlgs.c       ; dialog procs source code
  23. copydlgs.dlg     ; resource file for dialog windows
  24. copydlgs.h       ; defines for dialog windows
  25. dskcpy.c         ; modified dskcpy2 source code
  26. m.cmd            ; make command file (so sue me, I'm lazy)
  27. pmcopy           ; make file
  28. pmcopy.c         ; front end source code
  29. pmcopy.def       ; MSC define file
  30. pmcopy.exe       ; right, you want a description?
  31. pmcopy.h         ; defines for main program
  32. pmcopy.ico       ; incredible artwork
  33. pmcopy.rc        ; main resource file
  34. pmread.me        ; <= YOU ARE HERE
  35.  
  36.  
  37. I am currently on Internet at gregb@ncrwpd.dayton.ncr.com, various BBSs in
  38. the Dayton area, as well as Channel 1 and Magnum.
  39.  
  40.  
  41. Known Anomolies (aka features)
  42.   o opening the drive door during a disk operation doesn't bring up an error
  43.     until it's closed again.  This is due to the way the driver handles the
  44.     "disk change" line rather than an actual bug in the program.
  45.   o since all screen updates happen in messages other than paint, when you
  46.     resize the screen, message text gets lost.
  47.  
  48. other current features
  49.   o single read/multiple copies of disk - no disk swapping (from DSKCPY2)
  50.   o PM interface
  51.   o all disk I/O occurs on background thread - no slowdown to other PM apps
  52.   o can write multiple copies simultaneously (although at least on my
  53.     system, making two copies in parallel is slower than two copies linear)
  54.  
  55. some possible thoughts for the future:
  56.   o show graphically the percentage done (modify the DisplayStatus routine)
  57.   o be able to read from two different disks at the same time (separate
  58.     source buffers)
  59.     - add a disk compare function
  60.  
  61.  
  62.  
  63. Technical Notes:
  64.  
  65. The changes to Brady's code are relatively minor.  Apparently the
  66. BIOSPARAMETERBLOCK bug has been fixed in 1.2, because my header file matches
  67. what he had defined locally.  Since they were the same, I removed the local
  68. copy.  The OpenDrive funtion has been integrated into the disk functions.
  69. This is to keep the drive handles local to the thread.  Also, errors are now
  70. handled through a common error handler, which posts a message to the parent
  71. window - this is because background threads aren't allowed into the
  72. presentation space (or, if they are, it wasn't obvious to me).  Thus, I have
  73. three classes of messages being passed forward - Error, Status, and General.
  74. Currently the "General" messages are only passing Done up, but I wanted to
  75. leave it open for future use.
  76.  
  77. Ah, the format.  This has caused me quite a bit of pain.  I really thought I
  78. had this one beaten, but I'm out of "play time", and it still doesn't work.
  79. If you enable the menu option (in the WM_INITMENU case for the main window),
  80. you can see what it does currently.  It will go through the disk, formatting
  81. each track (and dieing on errors - perfect disks only).  It will then build
  82. the root track based on an algorithm from Writing OS/2 Device Drivers (by
  83. Raymond Westwater, Addison-Wesley, p. 496), but when I go to write out the
  84. track, the IOCtl returns an invalid parameter.  Other unsolved format issues
  85. involve detecting a low density disk (unformatted) in a high density drive.
  86. I leave the resolution to this problem as an exercise to the reader.
  87.  
  88. Having only recently come to the OS/2 world (from a wide variety of other OSs),
  89. and being relatively unwashed in the intricacies of MSC and PM, I ran into
  90. a few oddities only to be resolved by Spy and Logitech's Multiscope.  These I
  91. thought I would share, hopefully to prevent others from following the same
  92. road.  First, the disappearing window.  When I got to the point that my
  93. main window was coming up fine, and I was spinning off threads that didn't do
  94. anything beyond opening the drive, I added the first real task - the IOCtl to
  95. get the BPB, and then calculate the disk parameters.  This is just straight
  96. out of what Brady had done, so I felt relatively secure.  Well, for some 
  97. reason, shortly after the IOCtl, the window would close and the program would
  98. shut down.  No messages, no warnings, no phone calls, just gone.  I set Spy
  99. to work, and found that my window was receiving a WM_DESTROY message.  Well,
  100. I certainly wasn't sending it, so it had to be PM.  According to multiscope,
  101. I was just doing some assignment statements in my background thread when it
  102. died.  Not til I looked closely at the assignments did I realize there was a
  103. divide by zero.
  104.  
  105. Conclusion 1: Certain run-time errors will cause a PM app to shut down without
  106.               warning.
  107.  
  108. Now, why was there a divide by zero?  This was just straight out of Brady's
  109. original program.  I went back and recompiled his code under my make, and 
  110. found that his did the same thing.  Again, multiscope to the rescue,  the
  111. IOCtl was returning fine, the data was there and fine, but the structure wasn't
  112. interpreting it correctly.  Linker alignment?  No, actually compiler alignment.
  113. As I said, I'm new to MSC, and they have a -Zp parameter for packing.  Not 
  114. that it's documented anywhere on the IOCtl call, but Brady's program used it,
  115. and when I created my make, I left it off.  Problem solved.
  116.  
  117. Conclusion 2:  Beware of compiler alignment as well as Linker alignment.
  118.  
  119. The invisible dialog:  This one was actually simple, but again, it might save
  120. someone a few minutes.  A couple times I had dialog boxes that looked fine,
  121. all the code was in place, but they just wouldn't appear.  It turned out that
  122. one of my resource IDs was incorrect in the .DLG file.  Nobody would complain,
  123. but they also wouldn't comply.
  124.  
  125. PM programming is actually quite interesting.  The quality of the tools is
  126. very good.  I've been playing recently with other programs, like Smalltalk/V
  127. PM and Object/1.  I've done some great prototypes very quickly with ST/V, but
  128. both products seem to need to mature a bit in the PM world.  Thanks again to
  129. Brady Flowers for the disk handling routines. Now I'd better get back to
  130. something that'll make the company money - unfortunately, I can't spend all
  131. my time just learning about the new stuff.
  132.  
  133. 24 April 90
  134. gb
  135.