home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / os2call.zip / OS2CALL.DOC next >
Text File  |  1999-04-29  |  19KB  |  340 lines

  1.  
  2.  
  3.                      Operating System/2 API Call Analyzer
  4.  
  5.   Author       : Dave Blaschke
  6.                  IBM Austin, Texas
  7.                  Internal (Notes) - Dave Blaschke@IBMUS
  8.                  Internal (VM)    - IBMUSM26(BLASCHKE)
  9.                  External         - blaschke@us.ibm.com
  10.  
  11.   Description  : Analyzes and reports the OS/2 APIs called and/or not called
  12.                  and/or the  minimum OS/2  version required  by one  or more
  13.                  16-bit or 32-bit executable  files without  requiring their
  14.                  source code.
  15.  
  16.                  This feat is accomplished  by processing  each fixup record
  17.                  within the executable file(s),  because every function call
  18.                  external to  the executable(s)  will  have a  corresponding
  19.                  import  fixup  record.  Whenever an  import by  ordinal  or
  20.                  import by name fixup record is encountered, it is dissected
  21.                  to  determine which  export is  being  imported from  which
  22.                  DLL.  If  it is an  import from  one of the  supported OS/2
  23.                  DLLs  and the  user requested  statistics on the  DLL,  the
  24.                  count  of references  is incremented  and the required OS/2
  25.                  version   updated   appropriately.   When   finished,   the
  26.                  requested statistics are displayed to standard output.
  27.  
  28.                  The user  can request  statistics  on one  or more  of  the
  29.                  supported DLLs  individually by specifying  each DLL's name
  30.                  as an option,  or can request  statistics on  all supported
  31.                  DLLs by specifying  the -ALL option.  The user  can request
  32.                  statistics on  APIs called  by the  executable  file(s)  by
  33.                  specifying the -C option,  and/or can request statistics on
  34.                  APIs not called by the executable file(s) by specifying the
  35.                  -NC option.  The user can request statistics on only 16-bit
  36.                  APIs called and/or not called by specifying the -16 option,
  37.                  or can request statistics on only 32-bit APIs called and/or
  38.                  not  called  by  specifying  the -32  option.  The user can
  39.                  request detailed statistics,  including fixup  record table
  40.                  and  individual fixup record information, by specifying the
  41.                  -D option.  The user  can input  a text file  that contains
  42.                  the name(s) of the executable  file(s)  to  be analyzed  by
  43.                  specifying  the -L  option.  Because  by default  only  the
  44.                  names of APIs  called and/or not  called are reported,  the
  45.                  user can additionally request  that the ordinals of APIs be
  46.                  reported by  specifying the -O option.  Because  by default
  47.                  only  statistics  on public  APIs called  and/or not called
  48.                  are reported,  the user can additionally request statistics
  49.                  on  private APIs  called  and/or not  called  by specifying
  50.                  the -P  option.  The user can  request a summation  of  the
  51.                  APIs called  and/or not  called  by all  of the  executable
  52.                  file(s) combined by specifying the -S option.  The user can
  53.                  request statistics  on the  minimum OS/2  version  required
  54.                  by the executable file(s) by specifying the -V option.
  55.  
  56.                  NOTE:  "Public" APIs are those that  are present in OS2286,
  57.                  OS2386, MMPM2, and/or PMBIDI libraries.
  58.  
  59.                  The user can request helping  information by specifying the
  60.                  -?, -H, or -HELP option.
  61.  
  62.                  The OS/2 API Call Analyzer  works on all 32-bit versions of
  63.                  OS/2:
  64.  
  65.                                                  |  Major  |  Minor
  66.                  Name                            | Version | Version
  67.                  --------------------------------+---------+---------
  68.                  OS/2 Version 2.0                |    20   |     0
  69.                  OS/2 Version 2.1                |    20   |    10
  70.                  OS/2 Version 2.11               |    20   |    11
  71.                  OS/2 Warp Version 3             |    20   |    30
  72.                  OS/2 Warp Version 4             |    20   |    40
  73.                  OS/2 Warp Server for e-business |    20   |    45
  74.  
  75.                  where major and minor versions are the corresponding values
  76.                  returned from DosQuerySysInfo.
  77.  
  78.   Usage        : OS2CALL {-C|-NC}... {-ALL|-dll}... [-16|-32] [-D] [-L] [-O]
  79.                          [-P] [-S] [-V] file
  80.  
  81.                  Where:
  82.                    -C   indicates display APIs called
  83.                    -NC  indicates display APIs not called
  84.                    -ALL indicates analyze APIs from all DLLs
  85.                    -dll indicates analyze APIs from specific DLL,  where dll
  86.                         can be one of the following:
  87.                            ANSICALL  BDCALLS   BKSCALLS  BMSCALLS  BVSCALLS
  88.                            DIVE      DOSCALLS  FKA       HELPMGR   KBDCALLS
  89.                            MCIAPI    MDM       MMIO      MONCALLS  MOUCALLS
  90.                            MSG       NAMPIPES  NLS       PMBIDI    PMCTLS
  91.                            PMDRAG    PMGPI     PMGRE     PMMERGE   PMPIC
  92.                            PMSHAPI   PMSPL     PMVIOP    PMWIN     PMWP
  93.                            PNP       QUECALLS  SESMGR    SSM       SW
  94.                            VIOCALLS  WPCONFIG  WPINET    WPPRINT
  95.                    -16  indicates display only 16-bit APIs called/not called
  96.                    -32  indicates display only 32-bit APIs called/not called
  97.                    -D   indicates display detailed analysis
  98.                    -L   indicates file is name of input list file containing
  99.                         name(s) of executable file(s) to be analyzed
  100.                    -O   indicates display ordinals of APIs called/not called
  101.                    -P   indicates display private APIs called/not called
  102.                    -S   indicates display API call summation
  103.                    -V   indicates display required OS/2 version
  104.                    file indicates name of executable  file to be analyzed or
  105.                         name of input list file (see -L option)
  106.  
  107.                  In  the  following  example,    TEST.EXE  is  analyzed  and
  108.                  statistics  displayed   for  the  public  APIs   called  in
  109.                  DOSCALLS, PMGPI, and SESMGR:
  110.  
  111.                  OS2CALL -C -DOSCALLS -PMGPI -SESMGR TEST.EXE
  112.  
  113.                  In  the  following  example,    TEST.EXE  is  analyzed  and
  114.                  detailed  statistics displayed  for the 32-bit  public APIs
  115.                  called and not called in PMWIN:
  116.  
  117.                  OS2CALL -C -NC -PMWIN -32 -D TEST.EXE
  118.  
  119.                  In  the  following  example,    TEST.EXE  is  analyzed  and
  120.                  statistics including API ordinals displayed for the minimum
  121.                  version  of OS/2  required  and the  public APIs  called in
  122.                  PMGPI:
  123.  
  124.                  OS2CALL -C -PMGPI -O -V TEST.EXE
  125.  
  126.                  In  the  following  example,    TEST.DLL  is  analyzed  and
  127.                  statistics  placed in TEST.API  for the public  and private
  128.                  APIs not called in all supported DLLs:
  129.  
  130.                  OS2CALL -NC -ALL -P TEST.DLL > TEST.API
  131.  
  132.                  In the following example,  TEST1.EXE, TEST2.EXE, TEST3.EXE,
  133.                  and TEST4.DLL are analyzed and statistics displayed for the
  134.                  public APIs  called in  QUECALLS  by each  executable  file
  135.                  individually and by all executable files combined:
  136.  
  137.                  ECHO TEST1.EXE >  OS2CALL.IN
  138.                  ECHO TEST2.EXE >> OS2CALL.IN
  139.                  ECHO TEST3.EXE >> OS2CALL.IN
  140.                  ECHO TEST4.DLL >> OS2CALL.IN
  141.                  OS2CALL -C -QUECALLS -L -S OS2CALL.IN
  142.  
  143.                  The  following  example  produces the  same results  as the
  144.                  previous example:
  145.  
  146.                  ECHO TEST1.EXE TEST2.EXE TEST3.EXE TEST4.DLL > OS2CALL.IN
  147.                  OS2CALL -C -QUECALLS -L -S OS2CALL.IN
  148.  
  149.                  Note  that the names of the  executable files in  the input
  150.                  list file do  not have to placed on individual lines;  they
  151.                  need only be separated by white space.
  152.  
  153.                  In the following example,  all EXEs and DLLs in the current
  154.                  directory are  analyzed and  statistics  displayed for  the
  155.                  public APIs called and not called in NAMPIPES:
  156.  
  157.                  DIR /F *.EXE *.DLL > OS2CALL.IN
  158.                  OS2CALL -C -NC -NAMPIPES -L OS2CALL.IN
  159.  
  160.                  Note that the -D option is only enabled if the /DDETAILINFO
  161.                  compiler switch is used to build the program.
  162.  
  163.   Output       : If the  user  requests  statistics  on  APIs called  by the
  164.                  executable file(s)  (-C  option),  information  similar  to
  165.                  the following is displayed for each requested DLL:
  166.  
  167.                  Used DLLNAME APIs:
  168.                    APINAME (4)
  169.                       :
  170.                    Ordinal 100 (2)
  171.                       :
  172.                    APINAME (16)
  173.  
  174.                  If the  user  requests  statistics  on  APIs called  by the
  175.                  executable file(s)  (-C option)  and that  the ordinals  of
  176.                  APIs be reported  (-O option), information  similar  to the
  177.                  the following is displayed for each requested DLL:
  178.  
  179.                  Used DLLNAME APIs:
  180.                    Ordinal 75 = APINAME (4)
  181.                       :
  182.                    Ordinal 100 (2)
  183.                       :
  184.                    Ordinal 125 = APINAME (16)
  185.  
  186.                  In either  case,  the  used  API  section  shows  the  APIs
  187.                  imported  by the  executable  file  from a  particular DLL.
  188.                  Each line in this section contains the name of the used API
  189.                  (optionally  preceded  by  "Ordinal" and  the corresponding
  190.                  ordinal number)  if exported by name,  or "Ordinal" and the
  191.                  corresponding  ordinal number if exported  by ordinal,  and
  192.                  the number of times  the API is called.  It should be noted
  193.                  that  these APIs are listed in order of increasing  ordinal
  194.                  value.
  195.  
  196.                  If the user requests statistics  on only 16-bit APIs called
  197.                  by the  executable file(s)  (-16 option),  the above header
  198.                  is instead similar to the following:
  199.  
  200.                  Used 16-bit DLLNAME APIs:
  201.  
  202.                  If the user requests statistics  on only 32-bit APIs called
  203.                  by the  executable file(s)  (-32 option),  the above header
  204.                  is instead similar to the following:
  205.  
  206.                  Used 32-bit DLLNAME APIs:
  207.  
  208.                  If the user  requests statistics  on APIs not called by the
  209.                  executable file(s)  (-NC  option),  information  similar to
  210.                  the following is displayed for each requested DLL:
  211.  
  212.                  Unused DLLNAME APIs:
  213.                    APINAME
  214.                       :
  215.                    APINAME
  216.  
  217.                  If the user  requests statistics  on APIs not called by the
  218.                  executable file(s)  (-NC option)  and that the ordinals  of
  219.                  APIs be reported  (-O option), information  similar  to the
  220.                  the following is displayed for each requested DLL:
  221.  
  222.                  Unused DLLNAME APIs:
  223.                    Ordinal 75 = APINAME
  224.                       :
  225.                    Ordinal 125 = APINAME
  226.  
  227.                  In either case, the unused  API section shows  the APIs not
  228.                  imported by  the executable  file  from a  particular  DLL.
  229.                  Each  line in this  section contains  the name  (optionally
  230.                  preceded by "Ordinal" and the corresponding ordinal number)
  231.                  of the unused API.  It should be noted that  these APIs are
  232.                  listed in  order of  increasing  ordinal  value.  It should
  233.                  also  be noted that  APIs exported by ordinal  only are NOT
  234.                  listed.
  235.  
  236.                  If the  user requests  statistics  on only 16-bit  APIs not
  237.                  called by the  executable file(s)  (-16 option),  the above
  238.                  header is instead similar to the following:
  239.  
  240.                  Unused 16-bit DLLNAME APIs:
  241.  
  242.                  If the  user requests  statistics  on only 32-bit  APIs not
  243.                  called by the  executable file(s)  (-32 option),  the above
  244.                  header is instead similar to the following:
  245.  
  246.                  Unused 32-bit DLLNAME APIs:
  247.  
  248.                  If  the  user  requests  detailed  statistics  (-D option),
  249.                  information similar to the following is displayed:
  250.  
  251.                  Fixup record table:
  252.                    0x00000000: 33 81 02 01 07 21 01 0f ..
  253.                       :
  254.                    0x00000280: 32 00 02 05 52 00 54 00 01
  255.                  Analysis:
  256.                    0x00000000 Found import by ordinal fixup (DLLNAME.7)
  257.                       :
  258.                    0x0000005B Found import by name fixup (DLLNAME.APINAME)
  259.                    0x00000061 Found import by name fixup not from OS/2 DLL
  260.                       :
  261.                    0x00000280 Found internal fixup
  262.  
  263.                  The fixup  record  table  section shows  the  actual  bytes
  264.                  present in the executable  file's fixup record table.  Each
  265.                  line in this section is prefixed with the logical offset of
  266.                  the corresponding bytes within the fixup record table.  The
  267.                  analysis section  shows a brief  description of  each fixup
  268.                  record  within the  table.  Each  line  in this  section is
  269.                  prefixed with the logical offset of the corresponding fixup
  270.                  record within  the fixup record table.  It  should be noted
  271.                  that these  sections  are  displayed  per-file  for  linear
  272.                  executable  files,  per-segment  for  segmented  executable
  273.                  files.
  274.  
  275.                  If the user requests statistics on the minimum OS/2 version
  276.                  required by the executable file(s) (-V option), information
  277.                  similar to the following is displayed:
  278.  
  279.                  Requires OS/2 Version 2.10
  280.  
  281.                  The version number is the  minimum version of OS/2 required
  282.                  to  successfully  execute the  executable  file.  In  other
  283.                  words, it is the earliest version of OS/2 that contains all
  284.                  of the APIs imported by the executable file from all of the
  285.                  supported DLLs.  It should be noted that the version number
  286.                  refers to  the original  (Golden  Master)  release of  that
  287.                  version and does not take into account any FixPaks that may
  288.                  have added an API to an earlier  version.  For example,  if
  289.                  an  executable  file imports  Dos32QueryThreadContext, then
  290.                  the minimum version  of OS/2 displayed  would be 2.40  even
  291.                  though a  FixPak may  have added  the API  to OS/2  Version
  292.                  2.30.
  293.  
  294.   History      : Version Date    Item
  295.                  2.10.00 18Jun93 Created (supported LX executable only)
  296.                  2.10.01 21Jun93 Fixed BMSCALLS and BVSCALLS exports
  297.                  2.10.02 22Jun93 Added support for NE executable
  298.                  2.10.03 28Jun93 Added PMWP exports
  299.                  2.10.04 14Sep93 Added -L and -S options
  300.                  2.10.05 15Sep93 Prepared for submission to OS2TOOLS
  301.                  2.10.06 10Feb94 Converted to IBM C Set++
  302.                  2.10.07 16Feb94 Eliminated aborting after bad executable
  303.                  2.10.08 20Oct94 Added WPCONFIG and WPPRINT exports
  304.                  2.11.00 20Oct94 Added new OS/2 2.11 and SMP exports
  305.                  2.30.00 24Oct94 Added new OS/2 2.30 exports
  306.                  2.30.02 11Apr95 Changed copyright to use year constants
  307.                  2.30.03 21Apr95 Required display and analysis options
  308.                  2.30.04 13Jun95 Added Multimedia exports
  309.                  2.30.05 05Jul95 Changed PMSTDDLG to PMCTLS
  310.                  2.30.06 08Feb96 Changed MACAPI to MCIAPI
  311.                  2.30.07 12Feb96 Added -16 and -32 options
  312.                  2.30.08 23May96 Fixed LookupAPI bug
  313.                  2.30.09 24May96 Verified DOS header new header file address
  314.                  2.30.10 24May96 Changed unknown API name/ordinal to warning
  315.                  2.30.11 28May96 Fixed NE import name table read bug
  316.                  2.30.12 28May96 Displayed executable file type
  317.                  2.30.13 13Jun96 Changed "\r\n" to "\n" in output
  318.                  2.30.14 14Jun96 Handled additive import fixups
  319.                  2.30.15 26Jun96 Added OS/2 2.00 PM debugger exports
  320.                  2.30.16 23Jul96 Added -P option
  321.                  2.40.00 05Sep96 Added new OS/2 2.40 exports
  322.                  2.40.01 06Mar97 Converted to IBM VisualAge C++
  323.                  2.40.02 22Aug97 Fixed DOSQUERYMODFROMDS bug
  324.                  2.40.03 17Aug98 Fixed DOSCALLS SMP exports bugs
  325.                  2.40.04 17Aug98 Added missing OS/2 SMP exports
  326.                  2.40.05 15Sep98 Handled DOSCALL1 exports as DOSCALLS
  327.                  2.40.07 27Oct98 Added PMBIDI exports
  328.                  2.40.08 30Oct98 Improved VerifyInformation logic
  329.                  2.40.09 30Oct98 Added -V option
  330.                  2.40.10 30Oct98 Handled executable without segments/objects
  331.                  2.40.11 03Mar99 Added support  for executables  without DOS
  332.                                  header
  333.                  2.40.12 15Apr99 Handled iterated segments
  334.                  2.45.00 15Apr99 Added new OS/2 2.45 APIs
  335.                  2.45.01 29Apr99 Added -O option
  336.  
  337.   Please direct all comments,  problems,  questions,  and suggestions to the
  338.   author above.
  339.  
  340.