home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / source / devnews / vol2 / sample3 / vdft.lst < prev    next >
Encoding:
File List  |  1993-12-30  |  74.2 KB  |  620 lines

  1. VDFT.C                                                                                         12/30/93 13:57:16     Page     1
  2.                                       * * * * *   P R O L O G   * * * * *
  3.  
  4.  Compiler . . . . . . . . . . . . : IBM C/C++ Tools V2.0
  5.  Command options:
  6.     Compiler mode . . . . . . . . : C
  7.     Program name. . . . . . . . . : VDFT.C
  8.     Assemble name . . . . . . . . : "vdft.asm"
  9.     Object name . . . . . . . . . : "vdft.obj"
  10.     Listing name. . . . . . . . . : vdft.lst
  11.     Compiler options. . . . . . . : /C+  /Fa+ /Fc- /Fd- /Fi- /Fl- /Fm- /Fo+ /Fw- /Gd- /Ge+ /Gf- /Gh- /Gi- /Gm- /Gn- /Gr+ /Gs-
  12.                                   : /Gt- /Gu- /Gv- /Gw- /J+  /L-  /La- /Lb- /Le- /Lf- /Li- /Lj- /Ls+ /Lx- /Ly- /O-  /Ol- /Om-
  13.                                   : /Op+ /Os- /P-  /Pc- /Pd- /Pe- /Q+  /Sd- /Sh- /Si- /Sm- /Sn- /Sr- /Ss+ /Sv- /Ti- /Tm- /Tx-
  14.                                   : /Xi-
  15.                                   : /Wcls- /Wcmp- /Wcnd- /Wcns- /Wcnv- /Wcpy- /Wdcl- /Weff- /Wenu- /Wext- /Wgen- /Wgnr- /Wgot-
  16.                                   : /Wini- /Wlan- /Wobs- /Word- /Wpar- /Wpor- /Wppc- /Wppt- /Wpro- /Wrea- /Wret- /Wtrd- /Wtru-
  17.                                   : /Wund- /Wuni- /Wuse- /Wvft-
  18.                                   : /Mp  /Rn  /Se  /Sp1  /G3  /W3  /H255  /Lp66  /Sg-  /Sq-  /N  /Oi0  /Su-  /Tl10 
  19.                                   : /DM_I386=1  
  20.                                   : /I  
  21.                                   : /Lt 
  22.                                   : /Lu 
  23.                                   : /B  
  24.                                   : /V  
  25. VDFT.C                                                                                         12/30/93 13:57:16     Page     2
  26.                                           * * * * *   S O U R C E   * * * * *
  27.  
  28.  LINE  STMT                                                                                                       SEQNBR INCNO
  29.              *...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9.......*
  30.     1       |/******************************************************************************/                  |      1           
  31.     2       |/*                                                                            */                  |      2           
  32.     3       |/*                     IBM Sample Virtual Device Driver                       */                  |      3           
  33.     4       |/*                                                                            */                  |      4           
  34.     5       |/*                 Copyright (c) IBM Corporation 1993                         */                  |      5           
  35.     6       |/*                         All Rights Reserved                                */                  |      6           
  36.     7       |/*                                                                            */                  |      7           
  37.     8       |/*   DISCLAIMER OF WARRANTIES.  The following [enclosed] code is              */                  |      8           
  38.     9       |/*   sample code created by IBM Corporation. This sample code is not          */                  |      9           
  39.    10       |/*   part of any standard or IBM product and is provided to you solely        */                  |     10           
  40.    11       |/*   for  the purpose of assisting you in the development of your             */                  |     11           
  41.    12       |/*   applications.  The code is provided "AS IS", without                     */                  |     12           
  42.    13       |/*   warranty of any kind.  IBM shall not be liable for any damages           */                  |     13           
  43.    14       |/*   arising out of your use of the sample code, even if they have been       */                  |     14           
  44.    15       |/*   advised of the possibility of such damages.                              */                  |     15           
  45.    16       |/*                                                                            */                  |     16           
  46.    17       |/******************************************************************************/                  |     17           
  47.    18       |/**************************** END OF SPECIFICATIONS ***************************/                  |     18           
  48.    19       |                                                                                                  |     19           
  49.    20       |#define INCL_VDH                                                                                  |     20           
  50.    21       |#define NULL 0                                                                                    |     21           
  51.    22       |                                                                                                  |     22           
  52.    23       |#include <mvdm.h>                       /* VDH services, etc.        */                           |     23           
  53.    24       |#include <basemid.h>                    /* message numbers           */                           |     24           
  54.    25       |#include <builtin.h>                    /* builtin functions         */                           |     25           
  55.    26       |#include "VDFTP.H"                      /* Local Stuff               */                           |     26           
  56.    27       |#include "common.h"                                                                               |     27           
  57.    28       |                                                                                                  |     28           
  58.    29       |/*                                                                   */                           |     29           
  59.    30       |/*                 GLOBAL DATA AREA FOR VDFT                         */                           |     30           
  60.    31       |/*                                                                   */                           |     31           
  61.    32       |#define DEBUG                                                                                     |     32           
  62.    33       |HIRQ hirq_DFT = 0;                      /* holds handle for EOI hook */                           |     33           
  63.    34       |                                                                                                  |     34           
  64.    35       |HVDM HVDM_Owner = 0;                    /* hvdm of owner             */                           |     35           
  65.    36       |INT   Status_byte;                      /* Status Register value     */                           |     36           
  66.    37       |PMESSAGE pMessage = NULL;                                                                         |     37           
  67.    38       |                                                                                                  |     38           
  68.    39       |HVDHSEM SemOS2Handle = 0;                                                                         |     39           
  69.    40       |HVDHSEM SemWinHandle = 0;                                                                         |     40           
  70.    41       |#pragma data_seg(CSWAP_DATA)                                                                      |     41           
  71.    42       |                                                                                                  |     42           
  72.    43       |                                                                                                  |     43           
  73.    44       |#pragma data_seg()                                                                                |     44           
  74.    45       |                                                                                                  |     45           
  75.    46       |#pragma data_seg(SWAPINSTDATA)                                                                    |     46           
  76.    47       |                                                                                                  |     47           
  77.    48       |HVDM  HVDM_Current;                     /* Current VDM handle  */                                 |     48           
  78.    49       |VDFTPDB PDB_Current;                    /* Current PDB         */                                 |     49           
  79.    50       |                                                                                                  |     50           
  80.    51       |#pragma data_seg()                                                                                |     51           
  81.    52       |                                                                                                  |     52           
  82.    53       |#pragma data_seg(CINIT_DATA)                                                                      |     53           
  83.    54       |                                                                                                  |     54           
  84.    55       |char szPDDName[]=DFT_NAME;                                                                        |     55           
  85.    56       |                                                                                                  |     56           
  86.    57       |#pragma data_seg()                                                                                |     57           
  87.    58       |                                                                                                  |     58           
  88.    59       |#pragma alloc_text(CSWAP_TEXT, VDFTDaIn, VDFTStIn, VDFTDaOut)                                     |     59           
  89.    60       |/*                                                                                                |     60           
  90.    61       | *local function prototypes go here                                                               |     61           
  91. VDFT.C                                                                                         12/30/93 13:57:16     Page     3
  92.                                           * * * * *   S O U R C E   * * * * *
  93.  
  94.  LINE  STMT                                                                                                       SEQNBR INCNO
  95.              *...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9.......*
  96.    62       | */                                                                                               |     62           
  97.    63       |                                                                                                  |     63           
  98.    64       |LONG EXPENTRY OS2Service(SGID sgid,ULONG ulCommand,ULONG ulCountIn,                               |     64           
  99.    65       |                         PVOID pvDataIn,ULONG ulCountout,                                         |     65           
  100.    66       |                         PVOID pvDataOut);                                                        |     66           
  101.    67       |LONG OS2ReadQueue(SGID sgid,ULONG ulCountout,                                                     |     67           
  102.    68       |                    PVOID pvDataOut);                                                             |     68           
  103.    69       |                                                                                                  |     69           
  104.    70       |BOOL OS2TerminateService(VOID);                                                                   |     70           
  105.    71       |BOOL OS2PostMessage(SGID SessionId,ULONG ulCountIn,PVOID pvDataIn);                               |     71           
  106.    72       |BOOL OS2InitSetup(VOID);                                                                          |     72           
  107.    73       |BOOL OS2ReadMessageData(SGID sgid,ULONG ulCountout,PVOID pvDataOut);                              |     73           
  108.    74       |PMESSAGE GetNextLink(VOID);                                                                       |     74           
  109.    75       |                                                                                                  |     75           
  110.    76       |#pragma alloc_text(CINIT_TEXT, Start_Here)                                                        |     76           
  111.    77       |//#pragma alloc_text(CINIT_TEXT, VDDInit)                                                         |     77           
  112.    78       |                                                                                                  |     78           
  113.    79       |/********************** START OF SPECIFICATIONS ***********************/                          |     79           
  114.    80       |/*                                                                    */                          |     80           
  115.    81       |/* SUBROUTINE NAME:  VDFTInit (Start_here)                            */                          |     81           
  116.    82       |/*                                                                    */                          |     82           
  117.    83       |/* DESCRIPTIVE NAME:  Virtual DFT Initialization entry point          */                          |     83           
  118.    84       |/*                                                                    */                          |     84           
  119.    85       |/* FUNCTION:  The function of this routine is to register the VDM     */                          |     85           
  120.    86       |/*            Creation, Termination, PDB Change, and PDB Destroy      */                          |     86           
  121.    87       |/*            handlers. This routine also sets up the VDFT Port       */                          |     87           
  122.    88       |/*            Address table in the global data area.                  */                          |     88           
  123.    89       |/*                                                                    */                          |     89           
  124.    90       |/* NOTES:                                                             */                          |     90           
  125.    91       |/*                                                                    */                          |     91           
  126.    92       |/* CONTEXT: System Initialization                                     */                          |     92           
  127.    93       |/*                                                                    */                          |     93           
  128.    94       |/* ENTRY POINT:  VDFTInit                                             */                          |     94           
  129.    95       |/*    LINKAGE:  CALL NEAR 32                                          */                          |     95           
  130.    96       |/*                                                                    */                          |     96           
  131.    97       |/* INPUT: psz - pointer to configuration strings                      */                          |     97           
  132.    98       |/*                                                                    */                          |     98           
  133.    99       |/* EXIT-NORMAL: returns !0                                            */                          |     99           
  134.   100       |/*                                                                    */                          |    100           
  135.   101       |/* EXIT-ERROR: returns 0                                              */                          |    101           
  136.   102       |/*                                                                    */                          |    102           
  137.   103       |/* EFFECTS: VDFT Port Address table in the global data area.          */                          |    103           
  138.   104       |/*                                                                    */                          |    104           
  139.   105       |/* INTERNAL REFERENCES:  NONE                                         */                          |    105           
  140.   106       |/*                                                                    */                          |    106           
  141.   107       |/* EXTERNAL REFERENCES:  VDHInstallUserHook - Install VDM event hook  */                          |    107           
  142.   108       |/*                       VDHOpenPDD         - Get PDD entry point     */                          |    108           
  143.   109       |/*                       VDHOpenVIRQ        - register an IRQ for VDM */                          |    109           
  144.   110       |/*                       VDHReservePages    - set up some linear      */                          |    110           
  145.   111       |/*                                 space for use as the adapter space */                          |    111           
  146.   112       |/************************ END OF SPECIFICATIONS ***********************/                          |    112           
  147.   113       |#pragma entry(Start_Here)                                                                         |    113           
  148.   114       |BOOL EXPENTRY Start_Here(PSZ psz)                                                                 |    114           
  149.   115       |{                                                                                                 |    115           
  150.   116       |                                                                                                  |    116           
  151.   117       |     ULONG ErrorNumber;                 /* holds error number from getError*/                     |    117           
  152.   118       |#ifdef DEBUG                                                                                      |    118           
  153.   119     1 |     _interrupt(3);                                                                               |    119           
  154.   120       |#endif                                                                                            |    120           
  155.   121     2 |     if(!VDHRegisterVDD(VDDNAME,OS2Service,NULL))                                                 |    121           
  156.   122       |     {                                                                                            |    122           
  157. VDFT.C                                                                                         12/30/93 13:57:16     Page     4
  158.                                           * * * * *   S O U R C E   * * * * *
  159.  
  160.  LINE  STMT                                                                                                       SEQNBR INCNO
  161.              *...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9.......*
  162.   123     3 |       return(FALSE);                                                                             |    123           
  163.   124       |     }                                                                                            |    124           
  164.   125     4 |     return TRUE;                                                                                 |    125           
  165.   126       |}                                                                                                 |    126           
  166.   127       |/****************************************************************\                                |    127           
  167.   128       | *                                                                                                |    128           
  168.   129       | *--------------------------------------------------------------                                  |    129           
  169.   130       | *                                                                                                |    130           
  170.   131       | *  Name:OS2Service                                                                               |    131           
  171.   132       | *                                                                                                |    132           
  172.   133       | *  Purpose:                                                                                      |    133           
  173.   134       | *                                                                                                |    134           
  174.   135       | *                                                                                                |    135           
  175.   136       | *                                                                                                |    136           
  176.   137       | *  Usage:                                                                                        |    137           
  177.   138       | *                                                                                                |    138           
  178.   139       | *  Method:                                                                                       |    139           
  179.   140       | *          -                                                                                     |    140           
  180.   141       | *                                                                                                |    141           
  181.   142       | *          -                                                                                     |    142           
  182.   143       | *          -                                                                                     |    143           
  183.   144       | *                                                                                                |    144           
  184.   145       | *          -                                                                                     |    145           
  185.   146       | *          -                                                                                     |    146           
  186.   147       | *                                                                                                |    147           
  187.   148       | *  Returns:                                                                                      |    148           
  188.   149       | *          1 - if sucessful execution completed                                                  |    149           
  189.   150       | *          0 - if error                                                                          |    150           
  190.   151       |\****************************************************************/                                |    151           
  191.   152       |LONG EXPENTRY OS2Service(SGID sgid,ULONG ulCommand,ULONG ulCountIn,                               |    152           
  192.   153       |                         PVOID pvDataIn,ULONG ulCountout,                                         |    153           
  193.   154       |                         PVOID pvDataOut)                                                         |    154           
  194.   155       |                                                                                                  |    155           
  195.   156       |{                                                                                                 |    156           
  196.   157       |                                                                                                  |    157           
  197.   158       |     LONG apiRet;                                                                                 |    158           
  198.   159       |                                                                                                  |    159           
  199.   160       |#ifdef DEBUG                                                                                      |    160           
  200.   161     5 |     _interrupt(3);                                                                               |    161           
  201.   162       |#endif                                                                                            |    162           
  202.   163     6 |     do                                                                                           |    163           
  203.   164       |     {                                                                                            |    164           
  204.   165     7 |          switch(ulCommand)                                                                       |    165           
  205.   166       |          {                                                                                       |    166           
  206.   167       |          case INIT_COMMAND:                                                                      |    167           
  207.   168     8 |               apiRet= OS2InitSetup();                                                            |    168           
  208.   169     9 |               break;                                                                             |    169           
  209.   170       |          case POST_MESSAGE:                                                                      |    170           
  210.   171    10 |               apiRet=OS2PostMessage(sgid,ulCountIn,pvDataIn);                                    |    171           
  211.   172    11 |               break;                                                                             |    172           
  212.   173       |                                                                                                  |    173           
  213.   174       |          case READ_QUEUE:                                                                        |    174           
  214.   175    12 |               apiRet= OS2ReadQueue(sgid,ulCountout,pvDataOut);                                   |    175           
  215.   176    13 |               break;                                                                             |    176           
  216.   177       |          case TERMINATE_COMMAND:                                                                 |    177           
  217.   178    14 |               OS2TerminateService();                                                             |    178           
  218.   179    15 |               break;                                                                             |    179           
  219.   180       |          }                                                                                       |    180           
  220.   181       |                                                                                                  |    181           
  221.   182       |                                                                                                  |    182           
  222.   183    16 |     }ONCE;                                                                                       |    183           
  223. VDFT.C                                                                                         12/30/93 13:57:16     Page     5
  224.                                           * * * * *   S O U R C E   * * * * *
  225.  
  226.  LINE  STMT                                                                                                       SEQNBR INCNO
  227.              *...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9.......*
  228.   184    17 |     return(apiRet);                                                                              |    184           
  229.   185       |}                                                                                                 |    185           
  230.   186       |/****************************************************************\                                |    186           
  231.   187       | *                                                                                                |    187           
  232.   188       | *--------------------------------------------------------------                                  |    188           
  233.   189       | *                                                                                                |    189           
  234.   190       | *  Name:                                                                                         |    190           
  235.   191       | *                                                                                                |    191           
  236.   192       | *  Purpose:                                                                                      |    192           
  237.   193       | *                                                                                                |    193           
  238.   194       | *                                                                                                |    194           
  239.   195       | *                                                                                                |    195           
  240.   196       | *  Usage:                                                                                        |    196           
  241.   197       | *                                                                                                |    197           
  242.   198       | *  Method:                                                                                       |    198           
  243.   199       | *          -                                                                                     |    199           
  244.   200       | *                                                                                                |    200           
  245.   201       | *          -                                                                                     |    201           
  246.   202       | *          -                                                                                     |    202           
  247.   203       | *                                                                                                |    203           
  248.   204       | *          -                                                                                     |    204           
  249.   205       | *          -                                                                                     |    205           
  250.   206       | *                                                                                                |    206           
  251.   207       | *  Returns:                                                                                      |    207           
  252.   208       | *          1 - if sucessful execution completed                                                  |    208           
  253.   209       | *          0 - if error                                                                          |    209           
  254.   210       |\****************************************************************/                                |    210           
  255.   211       |LONG OS2ReadQueue(SGID sgid,ULONG ulCountout,                                                     |    211           
  256.   212       |                    PVOID pvDataOut)                                                              |    212           
  257.   213       |{                                                                                                 |    213           
  258.   214       |                                                                                                  |    214           
  259.   215       |#ifdef DEBUG                                                                                      |    215           
  260.   216    18 |     _interrupt(3);                                                                               |    216           
  261.   217       |#endif                                                                                            |    217           
  262.   218    19 |     do                                                                                           |    218           
  263.   219       |     {                                                                                            |    219           
  264.   220       |                                                                                                  |    220           
  265.   221       |          /*                                                                                      |    221           
  266.   222       |           *wait until we get cleared                                                             |    222           
  267.   223       |           *and if so assume we have a new message waiting for us                                 |    223           
  268.   224       |           */                                                                                     |    224           
  269.   225       |          if(!VDHWaitEventSem(SemOS2Handle,                                                       |    225           
  270.   226    20 |                          SEM_INDEFINITE_WAIT) )                                                  |    226           
  271.   227       |          {                                                                                       |    227           
  272.   228    21 |               return(TRUE);                                                                      |    228           
  273.   229       |          }                                                                                       |    229           
  274.   230       |          /*                                                                                      |    230           
  275.   231       |           *reset the semaphore for the next time                                                 |    231           
  276.   232       |           *through                                                                               |    232           
  277.   233       |           */                                                                                     |    233           
  278.   234    22 |          VDHResetEventSem(SemOS2Handle);                                                         |    234           
  279.   235       |          /*                                                                                      |    235           
  280.   236       |           *retrieve the message data                                                             |    236           
  281.   237       |           *and store it in pvDataOut                                                             |    237           
  282.   238       |           */                                                                                     |    238           
  283.   239    23 |          if(OS2ReadMessageData(sgid,ulCountout,pvDataOut) )                                      |    239           
  284.   240       |          {                                                                                       |    240           
  285.   241    24 |               return(TRUE);                                                                      |    241           
  286.   242       |          }                                                                                       |    242           
  287.   243       |                                                                                                  |    243           
  288.   244    25 |     }ONCE;                                                                                       |    244           
  289. VDFT.C                                                                                         12/30/93 13:57:16     Page     6
  290.                                           * * * * *   S O U R C E   * * * * *
  291.  
  292.  LINE  STMT                                                                                                       SEQNBR INCNO
  293.              *...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9.......*
  294.   245    26 |     return(FALSE);                                                                               |    245           
  295.   246       |                                                                                                  |    246           
  296.   247       |}                                                                                                 |    247           
  297.   248       |                                                                                                  |    248           
  298.   249       |/****************************************************************\                                |    249           
  299.   250       | *                                                                                                |    250           
  300.   251       | *--------------------------------------------------------------                                  |    251           
  301.   252       | *                                                                                                |    252           
  302.   253       | *  Name:                                                                                         |    253           
  303.   254       | *                                                                                                |    254           
  304.   255       | *  Purpose:                                                                                      |    255           
  305.   256       | *                                                                                                |    256           
  306.   257       | *                                                                                                |    257           
  307.   258       | *                                                                                                |    258           
  308.   259       | *  Usage:                                                                                        |    259           
  309.   260       | *                                                                                                |    260           
  310.   261       | *  Method:                                                                                       |    261           
  311.   262       | *          -                                                                                     |    262           
  312.   263       | *                                                                                                |    263           
  313.   264       | *          -                                                                                     |    264           
  314.   265       | *          -                                                                                     |    265           
  315.   266       | *                                                                                                |    266           
  316.   267       | *          -                                                                                     |    267           
  317.   268       | *          -                                                                                     |    268           
  318.   269       | *                                                                                                |    269           
  319.   270       | *  Returns:                                                                                      |    270           
  320.   271       | *          1 - if sucessful execution completed                                                  |    271           
  321.   272       | *          0 - if error                                                                          |    272           
  322.   273       |\****************************************************************/                                |    273           
  323.   274       |BOOL OS2InitSetup(VOID)                                                                           |    274           
  324.   275       |{                                                                                                 |    275           
  325.   276       |                                                                                                  |    276           
  326.   277       |#ifdef DEBUG                                                                                      |    277           
  327.   278    27 |     _interrupt(3);                                                                               |    278           
  328.   279       |#endif                                                                                            |    279           
  329.   280       |                                                                                                  |    280           
  330.   281       |     /*                                                                                           |    281           
  331.   282       |      *if we have not created our structure yet                                                   |    282           
  332.   283       |      */                                                                                          |    283           
  333.   284    28 |     if(!pMessage)                                                                                |    284           
  334.   285       |     {                                                                                            |    285           
  335.   286       |                                                                                                  |    286           
  336.   287       |         /*                                                                                       |    287           
  337.   288       |          *allocate our control                                                                   |    288           
  338.   289       |          *structure for our messagelist                                                          |    289           
  339.   290       |          */                                                                                      |    290           
  340.   291       |          if( ( pMessage = VDHAllocMem(sizeof(MESSAGE),                                           |    291           
  341.   292    29 |                                        VDHAM_SWAPPABLE) ) == NULL)                               |    292           
  342.   293       |          {                                                                                       |    293           
  343.   294    30 |               return(TRUE);                                                                      |    294           
  344.   295       |          }                                                                                       |    295           
  345.   296       |     }                                                                                            |    296           
  346.   297    31 |     pMessage->SrcSessionIdentifier = -1;                                                         |    297           
  347.   298    32 |     pMessage->DstSessionIdentifier = -1;                                                         |    298           
  348.   299    33 |     pMessage->ulMessageType        = 0;                                                          |    299           
  349.   300    34 |     pMessage->ulMessageSubCommand  = 0;                                                          |    300           
  350.   301    35 |     pMessage->ulBufferSize         = 0;                                                          |    301           
  351.   302    36 |     pMessage->pvMessageData    = NULL;                                                           |    302           
  352.   303    37 |     pMessage->pvNextMessage    = NULL;                                                           |    303           
  353.   304       |     /*                                                                                           |    304           
  354.   305       |      *create our event semaphore for the                                                         |    305           
  355. VDFT.C                                                                                         12/30/93 13:57:16     Page     7
  356.                                           * * * * *   S O U R C E   * * * * *
  357.  
  358.  LINE  STMT                                                                                                       SEQNBR INCNO
  359.              *...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9.......*
  360.   306       |      *read thread from the OS/2 process                                                          |    306           
  361.   307       |      */                                                                                          |    307           
  362.   308       |                                                                                                  |    308           
  363.   309       |     if(!VDHCreateSem(&SemOS2Handle,                                                              |    309           
  364.   310    38 |                     VDH_EVENTSEM) )                                                              |    310           
  365.   311       |     {                                                                                            |    311           
  366.   312    39 |          return(TRUE);                                                                           |    312           
  367.   313       |     }                                                                                            |    313           
  368.   314       |                                                                                                  |    314           
  369.   315    40 |     VDHResetEventSem(SemOS2Handle);                                                              |    315           
  370.   316    41 |     return(FALSE);                                                                               |    316           
  371.   317       |                                                                                                  |    317           
  372.   318       |}                                                                                                 |    318           
  373.   319       |                                                                                                  |    319           
  374.   320       |                                                                                                  |    320           
  375.   321       |/****************************************************************\                                |    321           
  376.   322       | *                                                                                                |    322           
  377.   323       | *--------------------------------------------------------------                                  |    323           
  378.   324       | *                                                                                                |    324           
  379.   325       | *  Name:                                                                                         |    325           
  380.   326       | *                                                                                                |    326           
  381.   327       | *  Purpose:                                                                                      |    327           
  382.   328       | *                                                                                                |    328           
  383.   329       | *                                                                                                |    329           
  384.   330       | *                                                                                                |    330           
  385.   331       | *  Usage:                                                                                        |    331           
  386.   332       | *                                                                                                |    332           
  387.   333       | *  Method:                                                                                       |    333           
  388.   334       | *          -                                                                                     |    334           
  389.   335       | *                                                                                                |    335           
  390.   336       | *          -                                                                                     |    336           
  391.   337       | *          -                                                                                     |    337           
  392.   338       | *                                                                                                |    338           
  393.   339       | *          -                                                                                     |    339           
  394.   340       | *          -                                                                                     |    340           
  395.   341       | *                                                                                                |    341           
  396.   342       | *  Returns:                                                                                      |    342           
  397.   343       | *          1 - if sucessful execution completed                                                  |    343           
  398.   344       | *          0 - if error                                                                          |    344           
  399.   345       |\****************************************************************/                                |    345           
  400.   346       |BOOL OS2TerminateService(VOID)                                                                    |    346           
  401.   347       |{                                                                                                 |    347           
  402.   348       |     BOOL fError = FALSE;                                                                         |    348           
  403.   349       |                                                                                                  |    349           
  404.   350       |#ifdef DEBUG                                                                                      |    350           
  405.   351    42 |     _interrupt(3);                                                                               |    351           
  406.   352       |#endif                                                                                            |    352           
  407.   353       |                                                                                                  |    353           
  408.   354    43 |     do                                                                                           |    354           
  409.   355       |     {                                                                                            |    355           
  410.   356       |                                                                                                  |    356           
  411.   357       |          /*                                                                                      |    357           
  412.   358       |           *post our semaphore                                                                    |    358           
  413.   359       |           */                                                                                     |    359           
  414.   360    44 |          VDHPostEventSem(SemOS2Handle);                                                          |    360           
  415.   361       |          /*                                                                                      |    361           
  416.   362       |           *and get rid of it                                                                     |    362           
  417.   363       |           */                                                                                     |    363           
  418.   364    45 |          VDHDestroySem(SemOS2Handle);                                                            |    364           
  419.   365       |                                                                                                  |    365           
  420.   366    46 |     }ONCE;                                                                                       |    366           
  421. VDFT.C                                                                                         12/30/93 13:57:16     Page     8
  422.                                           * * * * *   S O U R C E   * * * * *
  423.  
  424.  LINE  STMT                                                                                                       SEQNBR INCNO
  425.              *...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9.......*
  426.   367    47 |     return(fError);                                                                              |    367           
  427.   368       |}                                                                                                 |    368           
  428.   369       |                                                                                                  |    369           
  429.   370       |/****************************************************************\                                |    370           
  430.   371       | *                                                                                                |    371           
  431.   372       | *--------------------------------------------------------------                                  |    372           
  432.   373       | *                                                                                                |    373           
  433.   374       | *  Name:                                                                                         |    374           
  434.   375       | *                                                                                                |    375           
  435.   376       | *  Purpose:                                                                                      |    376           
  436.   377       | *                                                                                                |    377           
  437.   378       | *                                                                                                |    378           
  438.   379       | *                                                                                                |    379           
  439.   380       | *  Usage:                                                                                        |    380           
  440.   381       | *                                                                                                |    381           
  441.   382       | *  Method:                                                                                       |    382           
  442.   383       | *          -                                                                                     |    383           
  443.   384       | *                                                                                                |    384           
  444.   385       | *          -                                                                                     |    385           
  445.   386       | *          -                                                                                     |    386           
  446.   387       | *                                                                                                |    387           
  447.   388       | *          -                                                                                     |    388           
  448.   389       | *          -                                                                                     |    389           
  449.   390       | *                                                                                                |    390           
  450.   391       | *  Returns:                                                                                      |    391           
  451.   392       | *          1 - if sucessful execution completed                                                  |    392           
  452.   393       | *          0 - if error                                                                          |    393           
  453.   394       |\****************************************************************/                                |    394           
  454.   395       |BOOL OS2PostMessage(SGID SessionId,ULONG ulCountIn,PVOID pvDataIn)                                |    395           
  455.   396       |{                                                                                                 |    396           
  456.   397       |     BOOL fError = FALSE;                                                                         |    397           
  457.   398       |     PMESSAGE pMessage;                                                                           |    398           
  458.   399       |                                                                                                  |    399           
  459.   400       |                                                                                                  |    400           
  460.   401    48 |     do                                                                                           |    401           
  461.   402       |     {                                                                                            |    402           
  462.   403       |          /*                                                                                      |    403           
  463.   404       |           *get the next link in our list                                                         |    404           
  464.   405       |           */                                                                                     |    405           
  465.   406    49 |           pMessage = GetNextLink();                                                              |    406           
  466.   407       |                                                                                                  |    407           
  467.   408       |                                                                                                  |    408           
  468.   409       |          /*                                                                                      |    409           
  469.   410       |           *allocate some local storage                                                           |    410           
  470.   411       |           */                                                                                     |    411           
  471.   412    50 |           if( (pMessage = VDHAllocMem(ulCountIn,VDHAM_SWAPPABLE))== NULL)                        |    412           
  472.   413       |           {                                                                                      |    413           
  473.   414    51 |               return(TRUE);                                                                      |    414           
  474.   415       |           }                                                                                      |    415           
  475.   416       |                                                                                                  |    416           
  476.   417       |          /*                                                                                      |    417           
  477.   418       |           *copy our message data in                                                              |    418           
  478.   419       |           *and hold onto our session identifier                                                  |    419           
  479.   420       |           */                                                                                     |    420           
  480.   421    52 |           pMessage->SrcSessionIdentifier = SessionId;                                            |    421           
  481.   422    53 |           pMessage->ulBufferSize         = ulCountIn;                                            |    422           
  482.   423       |           memcpy(pMessage->pvMessageData,pvDataIn,                                               |    423           
  483.   424    54 |                  ulCountIn);                                                                     |    424           
  484.   425       |                                                                                                  |    425           
  485.   426       |                                                                                                  |    426           
  486.   427       |          /*                                                                                      |    427           
  487. VDFT.C                                                                                         12/30/93 13:57:16     Page     9
  488.                                           * * * * *   S O U R C E   * * * * *
  489.  
  490.  LINE  STMT                                                                                                       SEQNBR INCNO
  491.              *...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9.......*
  492.   428       |           *clear the semaphore on the Windows side                                               |    428           
  493.   429       |           */                                                                                     |    429           
  494.   430    55 |          VDHPostEventSem(SemWinHandle);                                                          |    430           
  495.   431       |                                                                                                  |    431           
  496.   432       |                                                                                                  |    432           
  497.   433    56 |     }ONCE;                                                                                       |    433           
  498.   434    57 |     return(fError);                                                                              |    434           
  499.   435       |}                                                                                                 |    435           
  500.   436       |/****************************************************************\                                |    436           
  501.   437       | *                                                                                                |    437           
  502.   438       | *--------------------------------------------------------------                                  |    438           
  503.   439       | *                                                                                                |    439           
  504.   440       | *  Name:                                                                                         |    440           
  505.   441       | *                                                                                                |    441           
  506.   442       | *  Purpose:                                                                                      |    442           
  507.   443       | *                                                                                                |    443           
  508.   444       | *                                                                                                |    444           
  509.   445       | *                                                                                                |    445           
  510.   446       | *  Usage:                                                                                        |    446           
  511.   447       | *                                                                                                |    447           
  512.   448       | *  Method:                                                                                       |    448           
  513.   449       | *          -                                                                                     |    449           
  514.   450       | *                                                                                                |    450           
  515.   451       | *          -                                                                                     |    451           
  516.   452       | *          -                                                                                     |    452           
  517.   453       | *                                                                                                |    453           
  518.   454       | *          -                                                                                     |    454           
  519.   455       | *          -                                                                                     |    455           
  520.   456       | *                                                                                                |    456           
  521.   457       | *  Returns:                                                                                      |    457           
  522.   458       | *          1 - if sucessful execution completed                                                  |    458           
  523.   459       | *          0 - if error                                                                          |    459           
  524.   460       |\****************************************************************/                                |    460           
  525.   461       |BOOL OS2ReadMessageData(SGID sgid,ULONG ulCountout,PVOID pvDataOut)                               |    461           
  526.   462       |{                                                                                                 |    462           
  527.   463       |                                                                                                  |    463           
  528.   464       |                                                                                                  |    464           
  529.   465       |                                                                                                  |    465           
  530.   466       |                                                                                                  |    466           
  531.   467       |                                                                                                  |    467           
  532.   468    58 |     return(FALSE);                                                                               |    468           
  533.   469       |}                                                                                                 |    469           
  534.   470       |/****************************************************************\                                |    470           
  535.   471       | *                                                                                                |    471           
  536.   472       | *--------------------------------------------------------------                                  |    472           
  537.   473       | *                                                                                                |    473           
  538.   474       | *  Name:                                                                                         |    474           
  539.   475       | *                                                                                                |    475           
  540.   476       | *  Purpose:                                                                                      |    476           
  541.   477       | *                                                                                                |    477           
  542.   478       | *                                                                                                |    478           
  543.   479       | *                                                                                                |    479           
  544.   480       | *  Usage:                                                                                        |    480           
  545.   481       | *                                                                                                |    481           
  546.   482       | *  Method:                                                                                       |    482           
  547.   483       | *          -                                                                                     |    483           
  548.   484       | *                                                                                                |    484           
  549.   485       | *          -                                                                                     |    485           
  550.   486       | *          -                                                                                     |    486           
  551.   487       | *                                                                                                |    487           
  552.   488       | *          -                                                                                     |    488           
  553. VDFT.C                                                                                         12/30/93 13:57:16     Page    10
  554.                                           * * * * *   S O U R C E   * * * * *
  555.  
  556.  LINE  STMT                                                                                                       SEQNBR INCNO
  557.              *...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9.......*
  558.   489       | *          -                                                                                     |    489           
  559.   490       | *                                                                                                |    490           
  560.   491       | *  Returns:                                                                                      |    491           
  561.   492       | *          1 - if sucessful execution completed                                                  |    492           
  562.   493       | *          0 - if error                                                                          |    493           
  563.   494       |\****************************************************************/                                |    494           
  564.   495       |PMESSAGE GetNextLink(VOID)                                                                        |    495           
  565.   496       |{                                                                                                 |    496           
  566.   497       |     PMESSAGE pMessageNext;                                                                       |    497           
  567.   498       |                                                                                                  |    498           
  568.   499    59 |     do                                                                                           |    499           
  569.   500       |     {                                                                                            |    500           
  570.   501       |          /*                                                                                      |    501           
  571.   502       |           *spin through our list looking for the                                                 |    502           
  572.   503       |           *first null link                                                                       |    503           
  573.   504       |           *in our list                                                                           |    504           
  574.   505       |           */                                                                                     |    505           
  575.   506       |          for(pMessageNext = (PMESSAGE)pMessage->pvNextMessage;                                   |    506           
  576.   507       |                         !pMessageNext;                                                           |    507           
  577.   508    60 |                         pMessageNext = pMessageNext->pvNextMessage)                              |    508           
  578.   509       |          {                                                                                       |    509           
  579.   510    61 |               ;                                                                                  |    510           
  580.   511       |          }                                                                                       |    511           
  581.   512       |                                                                                                  |    512           
  582.   513       |                                                                                                  |    513           
  583.   514    62 |     }ONCE;                                                                                       |    514           
  584.   515    63 |     return(pMessageNext);                                                                        |    515           
  585.   516       |}                                                                                                 |    516           
  586.   517       |                                                                                                  |    517           
  587.                                     * * * * *   E N D   O F   S O U R C E   * * * * *
  588. VDFT.C                                                                                         12/30/93 13:57:16     Page    11
  589.                         * * * * *   I N C L U D E S   * * * * *
  590.  
  591. INCLUDE FILES  ---  FILE#   NAME
  592.                       1       F:\TOOLKT21\C\OS2H\VDD\MVDM.H
  593.                       2       F:\TOOLKT21\C\OS2H\VDD\BASEMAC.H
  594.                       3       F:\TOOLKT21\C\OS2H\VDD\BASEDEF.H
  595.                       4       F:\TOOLKT21\C\OS2H\VDD\VDMPROP.H
  596.                       5       F:\TOOLKT21\C\OS2H\VDD\VDMM.H
  597.                       6       F:\TOOLKT21\C\OS2H\VDD\V8086.H
  598.                       7       F:\TOOLKT21\C\OS2H\VDD\VDOS.H
  599.                       8       F:\TOOLKT21\C\OS2H\VDD\VPIC.H
  600.                       9       F:\TOOLKT21\C\OS2H\VDD\VKBD.H
  601.                      10       F:\TOOLKT21\C\OS2H\VDD\VLPT.H
  602.                      11       F:\TOOLKT21\C\OS2H\VDD\VDMA.H
  603.                      12       F:\TOOLKT21\C\OS2H\VDD\VDMBIOS.H
  604.                      13       F:\TOOLKT21\C\OS2H\VDD\BASEMID.H
  605.                      14       G:\IBMCPP\INCLUDE\BUILTIN.H
  606.                      15       G:\IBMCPP\SRC\VDFTP.H
  607.                      16       G:\IBMCPP\SRC\COMMON.H
  608.  
  609.                         * * * * *   E N D   O F   I N C L U D E S   * * * * *
  610. VDFT.C                                                                                         12/30/93 13:57:16     Page    12
  611.                              * * * * *   M E S S A G E   S U M M A R Y   * * * * *
  612.  
  613.         Total            Informational(00)          Warning(10)          Error(30)            Severe Error(40)
  614.  
  615.           0                    0                        0                   0                        0
  616.  
  617.                         * * * * *   E N D   O F   M E S S A G E   S U M M A R Y   * * * * *
  618.  
  619.                              * * * * *   E N D   O F   C O M P I L A T I O N   * * * * *
  620.