home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / GETSCRN.EXE / USER.MAN < prev   
Text File  |  1990-07-03  |  19KB  |  676 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.                User Manual
  15.                    for
  16.                CAPTURE.EXE
  17.  
  18.           A Full Screen, Protected Mode
  19.              Screen Capture  Utility
  20.  
  21.  
  22.                    by
  23.               Arthur Kevin McGrath
  24.               P. O. Box 128
  25.             Barboursville, VA.    22923
  26.               703/832-7025
  27.  
  28.  
  29.             User Manual for CAPTURE.EXE
  30.  
  31.  
  32.      
  33.      
  34.     Copyright (c) 1990 by:    Arthur Kevin McGrath
  35.                 P. O. Box 128
  36.                 Barboursville, VA  22923
  37.      
  38.                 703/832-7025
  39.      
  40.      
  41.        ALL RIGHTS ARE RESERVED.  You may not copy this document in any 
  42.      way.   If you copy this document for any reason without   WRITTEN 
  43.      PERMISSION from the above named copyright owner, you are breaking 
  44.      the  Copyright Laws of the United States.    You will  go  to  jail 
  45.      for one year and pay a $50,000 fine.
  46.      
  47.      
  48.                  LICENSE AGREEMENT
  49.      
  50.       Both the software on the enclosed diskette and this document 
  51.      are the intellectual property of Arthur Kevin McGrath who remains 
  52.      its  sole    owner.    Upon payment of the appropriate fee  from  the 
  53.      list  below,  you are granted a license to use the  software  and 
  54.      this manual in accordance with the terms of this license.
  55.      
  56.       You  must purchase a license for each machine on  which  you 
  57.      plan  to execute the software.  You may not sell the software  or 
  58.      the  documentation  to anyone unless you  purchase  a  Reseller's 
  59.      License.  The license fee schedule is as follows:
  60.      
  61.      
  62.       Number of Licenses            Fee in U. S. Dollars
  63.            1                      49.95
  64.           10                     350.00
  65.           20                     815.00
  66.           50                       1,495.00
  67.          100                       2,500.00
  68.            Reseller's License               5,000.00
  69.      
  70.       The  Reseller's  License  grants  you  the  right  to   make 
  71.      unlimited    number    of  copies  of    both  the  software  and   the 
  72.      documentation,  and  sell    these copies for  whatever  price  you 
  73.      desire.  You must reproduce my copyright notice on every copy you 
  74.      sell.
  75.      
  76.       In  addition to the copies authorized by the    above  license 
  77.      schedule, you are authorized to make one copy of the software and 
  78.      the documentation for backup purposes.
  79.      
  80.  
  81.  
  82.  
  83.  
  84.  
  85.                   Page i
  86.  
  87.             User Manual for CAPTURE.EXE
  88.  
  89.  
  90.                  Table of Contents
  91.      
  92.        Executing CAPTURE.................................1
  93.         Syntax.......................................1
  94.         Capturing a Screen...........................2
  95.         System Requirements..........................2
  96.         Limitations..................................2
  97.        Theory of Operation...............................4
  98.         Character Monitors...........................4
  99.         Threads......................................5
  100.         Pop Ups......................................6
  101.         Capturing the Screen Under OS/2..............6
  102.        Index.............................................8
  103.      
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.                   Page ii
  144.  
  145.             User Manual for CAPTURE.EXE
  146.  
  147.  
  148.                  Executing CAPTURE
  149.      
  150.                   Syntax
  151.      
  152.      
  153.      CAPTURE (options)
  154.      
  155.       The following options decide what kind of characters will be 
  156.      copied from the screen:
  157.       /A   (default)  Capture all screen text whether or  not  the        
  158.               characters are considered printable.
  159.       /X          Capture ONLY the printable ASCII characters.
  160.      
  161.       The  following  options decide what file  will  receive  the 
  162.      characters captured from the screen:
  163.       /D          What DRIVE will hold the file?  (The default
  164.               drive is the current disk drive).
  165.       /P          What PATH (directory) will hold the file?
  166.               (The default path is the current directory)
  167.       /F          What is the file name?  The default file 
  168.               name is SCREEN.DAT
  169.      
  170.       The following option causes CAPTURE.EXE to display a list of 
  171.      legal options:
  172.       /?          What are the legal options for CAPTURE.EXE?
  173.      
  174.      
  175.       You  may use either upper or lower case.  You must  separate 
  176.      each option by at least one space.  For example:
  177.      
  178.      CAPTURE /X
  179.      
  180.      will set up CAPTURE.EXE to copy the printable characters on  your 
  181.      screen  to a file called SCREEN.DAT in your current directory  on 
  182.      your current drive.
  183.      
  184.      
  185.      CAPTURE /D b /P screens /f lanman.vga
  186.      
  187.      will  set    up  CAPTURE.EXE to copy all characters    in  the  ASCII 
  188.      character    set  to a file called  B:\SCREENS\LANMAN.VGA.    Notice 
  189.      that  leading and trailing backslashes were added by  CAPTURE.EXE 
  190.      to  the beginning and end of the path name.  Notice that  it  was 
  191.      not  necessary to type a colon after the drive name.  Notice  the 
  192.      space after the /D, /P, and /F.
  193.      
  194.      
  195.      CAPTURE /X /D d /p SOFTWARE\SCREENS /F FiRsT.Scr
  196.      
  197.      will  set    up  CAPTURE.EXE to copy all characters    in  the  ASCII 
  198.      character    set  to a file    called    D:\SOFTWARE\SCREENS\FIRST.SCR.    
  199.  
  200.  
  201.     Copyright, 1990 Arthur Kevin McGrath.  All rights reserved.
  202.                   Page 1
  203.  
  204.             User Manual for CAPTURE.EXE
  205.  
  206.  
  207.      Notice  that  leading  and trailing  backslashes  were  added  by 
  208.      CAPTURE.EXE  to the beginning and end of the path    name.    Notice 
  209.      that  it was not necessary to type a colon after the drive  name.    
  210.      Notice  the  space  after    the  /D,  /P,  and  /F.   Notice  that 
  211.      CAPTURE.EXE is not case-sensitive.
  212.      
  213.       Once    you have started CAPTURE.EXE, you will see  a  message 
  214.      from  the operating system telling you which version of OS/2  you 
  215.      are  using.  When you see that message, CAPTURE.EXE is  ready  to 
  216.      record the screen display from a full screen, protected mode OS/2 
  217.      session.
  218.      
  219.                 Capturing a Screen
  220.      
  221.       At  this  point,  you  may  capture  the  screen  by    typing 
  222.      <CONTROL><PRINT  SCREEN>.     CAPTURE.EXE will prompt you  for  the 
  223.      name of a file to hold a copy of the screen data.    You may accept 
  224.      the  defaults by hitting the <ENTER> key at each prompt.  If  you 
  225.      make a mistake, just type <N> (for NO) when CAPTURE.EXE asks  you 
  226.      if the file name you entered is correct.
  227.      
  228.       When     you   want   to  terminate   CAPTURE.EXE,   hit   the 
  229.      <CONTROL><END>  key.   You will see a pop up screen  telling  you 
  230.      that CAPTURE.EXE is no longer active on your system.
  231.      
  232.      
  233.                 System Requirements
  234.      
  235.       This version of CAPTURE.EXE was compiled and tested on IBM's 
  236.      OS/2  version 1.2.  I have enclosed the source code and the  make 
  237.      file  I  used to compile CAPTURE.EXE.  If you  have  difficulties 
  238.      with  an earlier version of OS/2 feel free to recompile  and  re-
  239.      link this program.
  240.      
  241.       The  July 3, 1990 version of CAPTURE.EXE requires  a    little 
  242.      less than 20,000 bytes of memory, four threads, and one queue  in 
  243.      order to run.
  244.      
  245.       If  you  get a message that says "Out of  system  resources" 
  246.      when you try to execute CAPTURE.EXE, you might want to change the 
  247.      line  in  your  CONFIG.SYS  file  that  begins  with  the     words 
  248.      "THREADS=".   Increase  the number of threads available  in  your 
  249.      system.  If you do not have a line in your CONFIG.SYS that begins 
  250.      with  the    words  "THREADS=",  add the  following    line  to  your 
  251.      CONFIG.SYS file:
  252.      
  253.       THREADS=255
  254.      
  255.      
  256.                 Limitations
  257.      
  258.  
  259.  
  260.     Copyright, 1990 Arthur Kevin McGrath.  All rights reserved.
  261.                   Page 2
  262.  
  263.             User Manual for CAPTURE.EXE
  264.  
  265.  
  266.       This    screen    capture program ONLY WORKS IN  OS/2  PROTECTED 
  267.      MODE FULL SCREEN SESSIONS.
  268.      
  269.       You  may NOT run more this utility in more than one  session 
  270.      at the same time.    You will get a GENERAL PROTECTION FAULT  (Trap 
  271.      13).   This limitation WILL be removed in a future  version.   It 
  272.      comes from the way that CAPTURE.EXE frees memory it is no    longer 
  273.      using.   A detailed explanation is in THEORY OF  OPERATION  under 
  274.      threads.
  275.      
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.     Copyright, 1990 Arthur Kevin McGrath.  All rights reserved.
  320.                   Page 3
  321.  
  322.             User Manual for CAPTURE.EXE
  323.  
  324.  
  325.                 Theory of Operation
  326.      
  327.       CAPTURE.EXE  is the OS/2 equivalent of what a Terminate  and 
  328.      Stay  Resident  program  (TSR)  was under    PC/DOS.   It  runs  in 
  329.      parallel  with whatever software you are running in the  rest  of 
  330.      the  system.   It samples the raw data coming from  the  keyboard 
  331.      waiting for one of two hot keys.  When it detects <CONTROL><PRINT 
  332.      SCREEN>,  it  copies the current screen to a file on  your  disk.    
  333.      When it detects a <CONTROL><END>, it de-installs itself.
  334.      
  335.       CAPTURE.EXE  loads  a second copy of the  command  processor 
  336.      (usually  CMD.EXE)  in order to allow the user  to  run  programs 
  337.      while  CAPTURE.EXE is monitoring the keyboard data  stream.   The 
  338.      version message that the user sees when CAPTURE.EXE is started is 
  339.      the  second command processor telling the user that it  has  just 
  340.      loaded.   After  the  user terminates  CAPTURE.EXE,  that    second 
  341.      command  processor  is still resident in memory.  To  remove  the 
  342.      extra  command  processor,  the  user  should  type  EXIT     after 
  343.      terminating  CAPTURE.EXE.    I could have killed the extra  command 
  344.      processor for you, but if I did that, I would automatically  kill 
  345.      whatever  program you are running under that  command  processor.    
  346.      Because  I  have no way of knowing if you are running  a  program 
  347.      from that command processor, I chose to play it safe and let  you 
  348.      type EXIT.
  349.      
  350.       This    screen    capture program ONLY WORKS IN  OS/2  PROTECTED 
  351.      MODE FULL SCREEN SESSIONS.
  352.      
  353.       CAPTURE.EXE consists of the following modules:
  354.             CAPTURE.C         the actual screen capture code
  355.             POPUP.C         the code that puts the various
  356.                      popup messages on the screen.
  357.             MONITOR.C         a character monitor
  358.             THREAD.C         the various functions used to
  359.                      manage threads.
  360.      
  361.                 Character Monitors
  362.      
  363.       A  character    monitor  is  a    mechanism  OS/2  provides   to 
  364.      intercept and modify data coming from a character device such  as 
  365.      the keyboard.  The character monitor program is patched into  the 
  366.      character    device driver.    It receives every character  that  the 
  367.      device driver produces.  The character monitor has the option of:
  368.            1.   passing  the intercepted data back to  the    device 
  369.            driver without any changes,
  370.            2.   changing the intercepted character to one or  more 
  371.            different characters,
  372.            3.   deleting the intercepted character altogether.
  373.      
  374.       CAPTURE.EXE uses a character monitor to intercept data  from 
  375.      the  keyboard.  Any character except <CONTROL><PRINT SCREEN>  and 
  376.  
  377.  
  378.     Copyright, 1990 Arthur Kevin McGrath.  All rights reserved.
  379.                   Page 4
  380.  
  381.             User Manual for CAPTURE.EXE
  382.  
  383.  
  384.      <CONTROL><END>  are  returned unaltered to  the  keyboard    device 
  385.      driver.   <CONTROL><PRINT    SCREEN> triggers  the  screen  capture 
  386.      routine.    <CONTROL><END>    causes the monitor to  de-install  and 
  387.      CAPTURE.EXE to end.
  388.      
  389.                   Threads
  390.      
  391.       In OS/2, a thread is a subroutine that executes in  parallel 
  392.      with  everything else.  It is the basic unit of  multitasking  in 
  393.      OS/2.  Programs that choose to have several tasks execute at  the 
  394.      same time do so by creating threads.
  395.      
  396.       Threads  are    extremely  modular  creatures.     Because  OS/2 
  397.      handles the details of scheduling execution time for threads  and 
  398.      switching from thread to thread, it is possible to design several 
  399.      simple  threads  each  of    which  does  one  simple  task     well.    
  400.      Extremely complex algorithms can be broken down into very    simple 
  401.      constructions in this fashion.
  402.      
  403.       Because  CAPTURE.EXE    is intercepting every  keystroke  that 
  404.      will  ever  be  used by every other program in  the  full    screen 
  405.      session,  it  uses  multiple threads to  minimize    the  perceived 
  406.      disruption  to  other  programs.    Two  threads  do  nothing  but 
  407.      intercept    keystrokes and decide if they should trigger a    screen 
  408.      capture.    A  third  thread does nothing but  the    actual    screen 
  409.      capture.    A  fourth  thread executes another copy  of  the  OS/2 
  410.      command processor so that the user will see a command line.   The 
  411.      fifth  thread  frees  the stack of the other  threads  when  they 
  412.      terminate. 
  413.      
  414.       CAPTURE.EXE requires a total of five threads.
  415.      
  416.       OS/2 architecture requires a program to allocate a stack  (a 
  417.      memory  area) for each thread it creates and to free  that  stack 
  418.      when the thread terminates.  Finding out when a thread has  ended 
  419.      without  consuming  massive system resources is  something  of  a 
  420.      challenge    to  OS/2 programmers.  Microsoft  engineers  recommend 
  421.      setting  a semaphore when a thread starts and having  the    thread 
  422.      clear  the  semaphore just as it exits.  As long  as  the    thread 
  423.      declares  its exit processing to be part of a  critical  segment, 
  424.      this approach works well.
  425.      
  426.       The  approach  that  CAPTURE.EXE uses is  as    follows.   One 
  427.      thread  (the  Stack Killer thread) sleeps in the  background  and 
  428.      waits  to    be told that some other thread has ended.   The  Stack 
  429.      Killer  then wakes up, frees the stack, and goes back  to    sleep.    
  430.      The beauty of this approach is that it does not limit the    number 
  431.      of  instances  of    any thread, and it does  not  prevent  a  time 
  432.      critical  thread  from  being  serviced  by  the  CPU.   This  is 
  433.      especially important on a server or any machine that has a lot of 
  434.      multi-tasking.  The cost of this approach is one extra thread and 
  435.  
  436.  
  437.     Copyright, 1990 Arthur Kevin McGrath.  All rights reserved.
  438.                   Page 5
  439.  
  440.             User Manual for CAPTURE.EXE
  441.  
  442.  
  443.      one extra queue.  The name of the queue is \\QUEUES\KILLSTK$$.$$$
  444.      
  445.       If  you  have another queue by that name  anywhere  on  your 
  446.      computer, CAPTURE.EXE will not be able to run.  If you try to run 
  447.      two   CAPTURE.EXE    programs  on  the  same  computer,  you   will 
  448.      automatically  have  this problem.  There is a solution  to  this 
  449.      problem.    I just could not debug the solution in time  for  this 
  450.      release of CAPTURE.EXE.
  451.      
  452.      
  453.      
  454.                   Pop Ups
  455.      
  456.       OS/2    provides a way to create a small temporary screen  for 
  457.      the purpose of getting data from a user or for passing important, 
  458.      immediate information to the user.  This vehicle is called a  pop 
  459.      up.
  460.      
  461.       CAPTURE.EXE uses three pop ups.  The first gets a file  name 
  462.      from  the    user.    The  second tells the user  if    the  file  was 
  463.      successfully created.  The third tells the user when capture  has 
  464.      ended.
  465.      
  466.       All  the  code between VioPopUp and the  VioEndPopUp    system 
  467.      calls is very special code.  All keyboard and screen I/O  between 
  468.      these two calls is part of a special session.  It is NOT possible 
  469.      to switch out of this session.  This makes pop ups very difficult 
  470.      to debug.
  471.      
  472.       If you ever need to debug a pop up, do the following:
  473.             1.      Always isolate your pop up code in  separate 
  474.             source files from the rest of your code.
  475.             2.      Comment  out    the VioPopUp  and  VioEndPopUp 
  476.             system calls.
  477.             3.      Write  a main() function that  does  nothing 
  478.             but call your pop up code.
  479.             4.      Compile  your  pop up code with  this  dummy 
  480.             main().
  481.             5.      Debug the code using your favorite debugger.    
  482.             Without  the  calls to VioPopUp  and  VioEndPopUp, 
  483.             this is just ordinary video calls.
  484.             6.      When the code works properly, uncomment  the 
  485.             VioPopUp and VioEndPopUp system calls.
  486.      
  487.      
  488.               Capturing the Screen Under OS/2
  489.      
  490.       Capturing  the  screen under OS/2 requires a little  bit  of 
  491.      thought.  OS/2 is a multi-tasking operating system.  There  could 
  492.      be  (and usually are) several programs writing to the  screen  at 
  493.      any time.    OS/2 is also a hardware independent operating  system.    
  494.  
  495.  
  496.     Copyright, 1990 Arthur Kevin McGrath.  All rights reserved.
  497.                   Page 6
  498.  
  499.             User Manual for CAPTURE.EXE
  500.  
  501.  
  502.      There  is    no  guarantee that there will be a  screen  buffer  at 
  503.      address 0xB0000 or 0xB8000.
  504.      
  505.       To capture the screen, you must call VioGetMode to find  out 
  506.      where  the physical screen buffer is located and how long it  is.    
  507.      The  Microsoft  documentation of this call INCORRECTLY  fails  to 
  508.      mention  that this call returns both the length and  location  of 
  509.      the physical screen buffer.  The IBM documentation is correct.
  510.       Next,  VioGetPhysBuf must be called to get a valid  selector 
  511.      to  that  address.  Then the macro MAKEP is used to  convert  the 
  512.      selector into a pointer that can be used in the C language.
  513.      
  514.       The  screen  is  then locked using  VioScrLock  so  that  no 
  515.      program can change the screen while it is being copied.  At  this 
  516.      point,  the  screen is copied.  Then, VioScrUnLock is  called  so 
  517.      that other programs can write to the screen.
  518.      
  519.       After the screen has been captured, the user is prompted for 
  520.      a file name and the screen data is written to a file.
  521.      
  522.      
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.     Copyright, 1990 Arthur Kevin McGrath.  All rights reserved.
  556.                   Page 7
  557.  
  558.             User Manual for CAPTURE.EXE
  559.  
  560.  
  561.                    Index
  562.      
  563.      CAPTURE.C, 4
  564.      Character monitor, 4
  565.      Command processor, 4, 5
  566.      CONFIG.SYS, 2
  567.      
  568.      Device driver, 4, 5
  569.      
  570.      GENERAL PROTECTION FAULT, 3
  571.      
  572.      Keyboard, 4, 5
  573.      
  574.      LICENSE AGREEMENT, i
  575.      
  576.      Modules, 4
  577.      MONITOR.C, 4
  578.      
  579.      Options, 1
  580.      Out of system resources, 2
  581.      
  582.      Pop up, 6
  583.      Pop up
  584.        hints for debugging, 6
  585.      Popup messages, 4
  586.      POPUP.C, 4
  587.      
  588.      Queue, 6
  589.      
  590.      Reseller's License, i
  591.      
  592.      Screen capture, 4
  593.      Stack Killer, 5
  594.      
  595.      Terminate and Stay Resident, 4
  596.      Threads, 4, 5
  597.      THREADS=, 2
  598.      THREAD.C, 4
  599.      Trap 13, 3
  600.      TSR, 4
  601.      
  602.      VioEndPopUp, 6
  603.      VioGetMode, 7
  604.      VioGetPhysBuf, 7
  605.      VioPopUp, 6
  606.      VioScrLock, 7
  607.      VioScrUnLock, 7
  608.      
  609.      /A, 1
  610.      /D, 1
  611.      /F, 1
  612.  
  613.  
  614.     Copyright, 1990 Arthur Kevin McGrath.  All rights reserved.
  615.                   Page 8
  616.  
  617.             User Manual for CAPTURE.EXE
  618.  
  619.  
  620.      /P, 1
  621.      /X, 1
  622.      /?, 1
  623.      
  624.      <CONTROL><END>, 2, 4, 5
  625.      <CONTROL><PRINT SCREEN>, 2, 4, 5
  626.      
  627.      \\QUEUES\KILLSTK$$.$$$, 6
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.     Copyright, 1990 Arthur Kevin McGrath.  All rights reserved.
  674.                   Page 9
  675. 
  676.