home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / INFO / FAQS / OS2FAX2 / OSDANMPP.FAX < prev    next >
Encoding:
Text File  |  1994-07-18  |  28.3 KB  |  826 lines

  1. FILE:  OSDANMPP.FAX  - 5/13/94
  2.  
  3. TITLE:  940513 - OS/2 NAMED PIPES
  4.  
  5. DESCRIPTION:
  6.  
  7. Named Pipes are an interprocess communication vehicle that OS/2 and
  8. OS/2-DOS programs can utilize under OS/2 to communicate with each other.
  9.  
  10. Please note that two or more OS/2-DOS based programs cannot communicate
  11. with each other without the assistance of an OS/2-based program providing
  12. a named pipe through which the interprocess communications are passed.
  13. Since OS/2 does not come with programs that demonstrate this built-in
  14. feature of the operating system, many OS/2 customers have asked for
  15. additional information and sample programs demonstrating the use of
  16. named pipes in the operating system.  We feel that this fax will
  17. provide some of the basics needed to get started with named pipes.
  18. The reference section of this fax lists important publications that
  19. will help you understand even more about Named Pipe application
  20. programming interfaces (APIs).  It is important to note that
  21. named pipes can be used to communicate between programs running on the
  22. same machine or communicate with programs running across an IBM
  23. Lan Server or equivalent based lan.  A pre-requisite for using the
  24. information presented in this fax is a knowledge of C, C++, Advanced
  25. BASIC, and optionally 80x86 assembly language programming.
  26.  
  27. If you have been sent this fax as a result of having problems connecting
  28. or communicating with the Microsoft SQL Server product via ODBC using a
  29. Windows** based front-end product (such as a Visual Basic or
  30. PowerBuilder**), please download the file "PEKNMP.ZIP" or "NMP.ZIP"
  31. from IBM's OS/2 Support Library number 12 (Windows** application
  32. questions) on Compuserve ("GO IBMOS2").  The download contains a patch
  33. file and instructions on how to configure these types of Windows**
  34. applications for use under WIN-OS/2.
  35.  
  36. Please direct all programming questions related to this information
  37. to the IBM Developers forums on Compuserve (GO IBMOS2).
  38.  
  39.  
  40. Included in this fax are the following items:
  41.  
  42. 1. An OS/2-based C / C++ program that creates a named pipe and queries
  43.    the user for keystrokes to be sent to the NAMEPIPE.BAS or NAMEPIPE.CPP
  44.    program.  It can be compiled with IBM CSET/2, CSET++ 2.1, or Borland
  45.    C++ for OS/2 2.x.  None of these compilers come with the main
  46.    OS/2 package at this time.  This is an example of a pipe server
  47.    OS/2 program through which DOS or Windows applications would need
  48.    to communicate on a stand-alone computer.  In network situations,
  49.    DOS, Windows, or OS/2 applications can be named pipe servers using
  50.    the appropriate named pipe APIs (these APIs are part of the LAN
  51.    system being used - contact your lan vendor for these APIs or
  52.    refer to the reference section for books with this information).
  53.  
  54. 2. A QBASIC program that reads keystrokes from an OS/2 named
  55.    pipe and changes colors on the screen according to the characters
  56.    received from the named pipe (NAMEPIPE.BAS).  QBASIC comes with OS/2.
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65. 3. A Borland Turbo C++ v3.0 for DOS program that reads keystokes from
  66.    an OS/2 named pipe and changes colors on the screen according to
  67.    the character received from the named pipe (NAMEPIPE.CPP).  The
  68.    Turbo C++ v3.0 for DOS compiler does not come with OS/2.
  69.  
  70. 4. A listing of the assembly language interfaces that can be used for
  71.    advanced Named Pipe communication programming for VDMs (virtual DOS
  72.    machines - the DOS sessions in OS/2).  These are for use by advanced
  73.    programmers.
  74.  
  75. 5. A list of references for additional information.
  76.  
  77. = Item 1 ===================================================================
  78.  
  79. /**********************************************************/
  80. /**********************************************************/
  81. /***                                                    ***/
  82. /***  Program name: PIPEOS2.C or PIPEOS2.CPP            ***/
  83. /***                                                    ***/
  84. /***  Created     : 16th May 1990                       ***/
  85. /***                                                    ***/
  86. /***  Revised     : 26th February 1992                  ***/
  87. /***                                                    ***/
  88. /***  Author      : Tim Sennitt, Dorle Hecker           ***/
  89. /***                Slight modifications for C++        ***/
  90. /***                compiler use by Ron Bassett         ***/
  91. /***                                                    ***/
  92. /***  Purpose     : To demonstrate the use of an OS/2   ***/
  93. /***                created named pipe connecting to    ***/
  94. /***                many DOS sessions                   ***/
  95. /***                                                    ***/
  96. /***  Compile     : icc /O+ pipeos2.c (using IBM CSET/2)***/
  97. /***  or            icc /Gm+ /O+ pipeos2.cpp (using     ***/
  98. /***                    IBM CSET++ v2.1)                ***/
  99. /***  or          : cl386 pipeos2.c                     ***/
  100. /***                                                    ***/
  101. /***  Note: This program will compile using Borland C++ ***/
  102. /***  for OS/2 2.x.  Create a new project in the IDE,   ***/
  103. /***  add this source file to the project, view the     ***/
  104. /***  settings for the project, select the Target tab,  ***/
  105. /***  select OS2 Exe for the Program Target, select     ***/
  106. /***  Multi-thread for the Thread Options, and select   ***/
  107. /***  Use DLL for the Generate Import LIbrary.  Close   ***/
  108. /***  settings window and choose Run.                   ***/
  109. /***                                                    ***/
  110. /***  Input param : A number between 1 and 255          ***/
  111. /***                (number of pipe instances)          ***/
  112. /***                                                    ***/
  113. /***  The original program listing appears in the OS/2  ***/
  114. /***  REDBOOK VOLUME 2: DOS and Windows** Environment,  ***/
  115. /***  p. 282, IBM Order number GG24-3731-00.            ***/
  116. /***  To order, please phone 1-800-765-4426.            ***/
  117. /***                                                    ***/
  118. /**********************************************************/
  119. /***  DEFINES                                           ***/
  120. /**********************************************************/
  121.  
  122.  
  123.  
  124.  
  125. #define INCL_DOS
  126. #define INCL_DOSNMPIPES
  127. /**********************************************************/
  128. /***  INCLUDES and VARIABLES                            ***/
  129. /**********************************************************/
  130. #include <os2.h>
  131. #include <stdlib.h>
  132. #include <string.h>
  133. #include <stdio.h>
  134.  
  135. #ifdef __IBMC__
  136.    void     _System NewThread(ULONG threadArg);
  137. #endif
  138.  
  139. #ifdef __IBMCPP__
  140.    void     _System NewThread(ULONG threadArg);
  141. #else
  142.    void     NewThread(ULONG threadArg);
  143. #endif
  144.  
  145.    TID      threadID[512];
  146.    HPIPE    piphand[255];
  147.    ULONG    threadArg, threadFlags, stack_size;
  148.    ULONG    outbuffer, inbuffer, timeout, BytesWrit;
  149.    USHORT   rc, loopsize, i;
  150.    char     prep_string[11];
  151. /**********************************************************/
  152. /***  MAIN PROGRAM                                      ***/
  153. /**********************************************************/
  154. main(int argc, char *argv[], char *envp[])
  155. {
  156.    BOOL fEnd_Correct=FALSE;
  157.    threadFlags = 0;          /* start thread immediatly    */
  158.    stack_size  = 1024;       /* give stack size in bytes   */
  159.    threadArg   = 1;
  160.  
  161.    if ( argc != 2 || (loopsize = atoi(argv[1])) == 0 )
  162.      { printf("You have not specified the correct bacon size !\n");
  163.        printf("The syntax is PIPEOS2 NNNN (where NNNN is a number between \
  164. 1 and 255)\n");
  165.        exit(0);
  166.       } /*end-if*/
  167.    for (i = 1; i < loopsize+1; i++)
  168.      {
  169.        rc = DosCreateThread(&threadID[i],
  170.                            (PFNTHREAD)NewThread, i,
  171.                            threadFlags,
  172.                            stack_size);
  173.        if (rc != 0)
  174.          { printf("DosCreateThread error = %d\n",rc);
  175.           exit (1);
  176.          } /*end-if*/
  177.        printf("Pipe-Thread number %d created\n",i);
  178.        printf("Please start the DOS client\n");
  179.      } /*end-for*/
  180.  
  181.  
  182.  
  183.  
  184.  
  185.    printf("Now lets send some data to it......\n");
  186.  
  187.    /****************************************************************/
  188.    /* At this point we will loop getting keyboard input            */
  189.    /* and writing this to our named pipe (until we enter null)     */
  190.    /****************************************************************/
  191.    printf("ENTER\n [B]lue, [C]yan, [G]reen, [P]urple, \
  192. [R]ed, [W]hite, [Y]ellow or [Q]uit\n");
  193.    gets(prep_string);
  194.    while (prep_string[0] != 0)
  195.      {
  196.       if (prep_string[0] == 'q' || prep_string[0] == 'Q')
  197.         { for (i = 1; i < loopsize+1; i++)
  198.              { rc = DosWrite(piphand[i],
  199.                              (PVOID)prep_string,
  200.                              strlen(prep_string),
  201.                              &BytesWrit);
  202.                if (rc !=0) printf("Return code from DosWrite= %d\n",rc);
  203.              } /* end-for */
  204.           prep_string[0]=0; fEnd_Correct=TRUE;
  205.         }
  206.       else
  207.         { for (i = 1; i < loopsize+1; i++)
  208.              {
  209.                rc = DosWrite(piphand[i],
  210.                              (PVOID)prep_string,
  211.                              strlen(prep_string),
  212.                              &BytesWrit);
  213.                if (rc !=0) printf("Return code from DosWrite= %d\n",rc);
  214.               } /* end-for */
  215.           printf("ENTER\n [B]lue, [C]yan, [G]reen, [P]urple, \
  216. [R]ed, [W]hite, [Y]ellow or [Q]uit\n");
  217.           gets(prep_string);
  218.  
  219.         } /* endif */
  220.      } /* endwhile */
  221.  
  222.    if (!fEnd_Correct)
  223.      { prep_string[0]='q';
  224.        rc = DosWrite(piphand[i],
  225.                      (PVOID)prep_string,
  226.                      strlen(prep_string),
  227.                      &BytesWrit);
  228.        if (rc !=0) printf("Return code from DosWrite= %d\n",rc);
  229.      }
  230.  exit(0);
  231. }
  232.  
  233. /****************************************************************/
  234. /* This is our thread process which creates N named pipes then  */
  235. /* waits for the DOS sessions to connect to them.               */
  236. /****************************************************************/
  237. void NewThread(ULONG threadArg)
  238. {
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245. outbuffer = 25;
  246. inbuffer  = 25;
  247. timeout   = 200;
  248.  
  249.   rc = DosCreateNPipe("\\PIPE\\TEST\0",      /* create pipe    */
  250.                       &piphand[threadArg],
  251.                       0x4081,
  252.                       0x0008,
  253.                       outbuffer,
  254.                       inbuffer,
  255.                       timeout);
  256.   if (rc != 0)
  257.     { DosBeep(300,200); DosBeep(100,200);
  258.       exit(1);
  259.     }
  260.   DosBeep(300,200); DosBeep(600,200);
  261.  
  262. /****************************************************************/
  263. /* now we wait for our DOS session to connect to us             */
  264. /****************************************************************/
  265.  
  266.   rc = DosConnectNPipe(piphand[threadArg]);
  267.   if (rc != 0)
  268.     { DosBeep(100,200);
  269.       exit(1);
  270.     }
  271.   DosBeep(600,200);
  272.   printf("DOS Session number %d connected\n",threadArg);
  273. }
  274.  
  275.  
  276. = Item 2 ===================================================================
  277.  
  278. 5 ' PIPENAME.BAS
  279. 10 'This program is listed in the OS/2 REDBOOK VOLUME 2: DOS and Windows**
  280. 11 'Environment, p. 282, IBM Order number GG24-3731-00, orderable through
  281. 12 '1-800-765-4426.
  282. 15 '
  283. 16 'This program can be compiled with QBASIC.EXE that comes with OS/2 2.x.
  284. 17 'It works with OS/2 2.1 GA, and OS/2 2.11 with additional service modules
  285. 18 '  applied to the system.  This program must work in conjunction with
  286. 19 '  another OS/2-based program called PIPEOS2.C / PIPEOS2.CPP also listed
  287. 20 '  in this fax.  Using the two programs together demonstrate
  288. 21 '  interprocess communication between an OS/2 program and a DOS program
  289. 22 '  running in an OS/2 VDM session.  The OS/2 program accepts keystrokes
  290. 23 '  from the user and sends them via a named pipe to this program which
  291. 24 '  will respond to the keystrokes by filling the screen with a color
  292. 25 '  that corresponds to the keystroke sent.  You must run the OS/2
  293. 26 '  PIPEOS2.EXE (program listing follows this listing) before this program.
  294. 38 '
  295. 39 CLS : KEY OFF
  296. 40 COLOR 7, 0
  297. 50 OPEN "r", 1, "\PIPE\TEST", 1
  298. 60 FIELD 1, 1 AS A$
  299. 70 GET 1
  300. 80 IF A$ = "B" OR A$ = "b" THEN BKGRND = 9: GOTO 90' Color Blue
  301.  
  302.  
  303.  
  304.  
  305. 81 IF A$ = "C" OR A$ = "c" THEN BKGRND = 3: GOTO 90' Color Cyan
  306. 82 IF A$ = "G" OR A$ = "g" THEN BKGRND = 10: GOTO 90' Color Green
  307. 83 IF A$ = "P" OR A$ = "p" THEN BKGRND = 5: GOTO 90' Color Purple
  308. 84 IF A$ = "R" OR A$ = "r" THEN BKGRND = 12: GOTO 90' Color Red
  309. 85 IF A$ = "W" OR A$ = "w" THEN BKGRND = 7: GOTO 90' Color White
  310. 86 IF A$ = "Y" OR A$ = "y" THEN BKGRND = 6: GOTO 90' Color Yellow
  311. 87 IF A$ = "Q" OR A$ = "q" THEN SYSTEM  'exit to the operating system
  312. 90 COLOR 0, BKGRND: CLS : GOTO 70
  313.  
  314.  
  315. = Item 3 ===================================================================
  316.  
  317. // This is a Borland Turbo C++ v3.0-based DOS program listing.
  318. // This program MUST be used in conjunction with the PIPEOS2.C
  319. // or PIPEOS2.CPP program listed previously.  See the instructions
  320. // in the program below for more information.
  321.  
  322. #include <fstream.h>
  323. #include <conio.h>
  324. #include <string.h>
  325. #include <iostream.h>
  326. #include <stdlib.h>
  327. #include <process.h>
  328.  
  329. int main(void) {
  330.    char ch[1];
  331.    int color;
  332.  
  333.    textbackground(BLACK);
  334.    clrscr();
  335.    cout << "NAMEPIPE.EXE - A simple program for reading named pipes" << endl;
  336.    cout << "               written with Borland Turbo C++ v3.0 for"<< endl;
  337.    cout << "               DOS.  For use with OS/2 and PIPEOS2.EXE." << endl;
  338.    cout << endl << endl << "Program instructions:" << endl << endl;
  339.    cout << "1. If you are running this program in a DOS full screen," << endl;
  340.    cout << "   press ALT-HOME to run it in a Window now." << endl;
  341.    cout << "2. Run the PIPEOS2 program with a parameter of 1 from \
  342. an OS/2 Window." << endl;
  343.    cout << "3. Once the PIPEOS2 program is running, press any key in"<<endl;
  344.    cout << "   this program's window to allow it to open the named" << endl;
  345.    cout << "   pipe and read a character from the named pipe." << endl;
  346.    cout << "4. Switch back to the PIPEOS2 program's window and press"<<endl;
  347.    cout << "   one of the keys enclosed in brackets followed by the ENTER \
  348. key."<<endl << "   Try different keys followed by the ENTER key." << endl;
  349.    cout << endl << "Press any key to continue..." << endl << endl;
  350.    getch();
  351.    fstream f1("\\PIPE\\TEST",ios::in);           // open the pipe for input
  352.    if (!f1) {
  353.       textbackground(BLACK);
  354.       clrscr();
  355.       cerr << endl << "Cannot open the named pipe for input." << endl;
  356.       cerr << "Check the pipe name in PIPEOS2.C and make" << endl;
  357.       cerr << "sure it matches the pipe name listed in this" << endl;
  358.       cerr << "program (NAMEPIPE.CPP).  Also, make sure that" << endl;
  359.       cerr << "the PIPEOS2 program IS running in an OS/2" << endl;
  360.       cerr << "window *before* running this program." << endl << endl;
  361.  
  362.  
  363.  
  364.  
  365.       cerr << "Program terminating... press any key to exit." << endl;
  366.       getch();
  367.       exit(EXIT_FAILURE);
  368.    }
  369.    cout << "Reading data from the pipe..." << endl;
  370.    do {
  371.       f1.getline(ch,2);
  372.       if (ch[0]>'a') ch[0]-=32;
  373.       switch (ch[0]) {
  374.          case 'B':
  375.             textbackground(BLUE);
  376.             clrscr();
  377.             break;
  378.          case 'C':
  379.             textbackground(CYAN);
  380.             clrscr();
  381.             break;
  382.          case 'G':
  383.             textbackground(GREEN);
  384.             clrscr();
  385.             break;
  386.          case 'P':
  387.             textbackground(MAGENTA);
  388.             clrscr();
  389.             break;
  390.          case 'R':
  391.             textbackground(RED);
  392.             clrscr();
  393.             break;
  394.          case 'W':
  395.             textbackground(WHITE);
  396.             clrscr();
  397.             break;
  398.          case 'Y':
  399.             textbackground(YELLOW);
  400.             clrscr();
  401.             break;
  402.          default:
  403.             cout << endl << "With the PIPEOS2 program active, press" << endl;
  404.             cout << "one of the keys in brackets followed by the"<< endl;
  405.             cout << "ENTER key." << endl << endl;
  406.          break;
  407.       }
  408.       cout << "Received " << ch << " through the pipe." << endl;
  409.    } while (ch[0]!='Q');
  410.    clrscr();
  411.    cout << endl << "The quit command was received from the pipe." << endl;
  412.    cout << "Exiting program..." << endl;
  413.    return(0);
  414. }
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425. = Item 4 ===================================================================
  426.  
  427. *********************************************************************
  428. The section below details IBM OS/2 2.1's specification of
  429. the DOS Emulation (VDM) INT 21 function 5F named pipe support.
  430. This information is presented for your information only
  431. and IBM does not guarantee that these interfaces
  432. will not change in the future.
  433.  
  434. Please note: There are more named pipe functions than those listed
  435. here, but those functions absolutely require the presence of IBM
  436. Lan Server or equivalent software.  Contact your lan vendor for
  437. a listing of the named pipe functions that they support.  The
  438. functions listed here are supported by the OS/2 base operating system
  439. without the need for Lan Server or equivalent accompanying software.
  440.  
  441. In all cases below, the function number listed must be moved into AX
  442. before making the INT 21 function call.
  443. *********************************************************************
  444.  
  445. - INT 21 function 5F32 -----------------------------------------------------
  446. QNmPipeInfo - Get info on a named pipe
  447.  Inputs:
  448.        BX is handle of pipe
  449.        CX is size of buffer for info
  450.        DX is Level of info to get
  451.        DS:SI is address of buffer
  452.  Function:
  453.        Get pipe info
  454.  Returns:
  455.        Carry set
  456.            AX = error
  457.        Carry Clear
  458.            OK
  459.  
  460. - INT 21 function 5F33 -----------------------------------------------------
  461. QNmpHandState - Get pipe mode information
  462.  Inputs:
  463.        BX is handle of pipe
  464.  Function:
  465.        Return mode of pipe
  466.  Returns:
  467.        Carry clear
  468.            AX = Pipe mode word
  469.        Carry set
  470.            AX = error
  471.  
  472. - INT 21 function 5F34 -----------------------------------------------------
  473. SetNmpHandState - Set pipe mode
  474.  Inputs:
  475.        BX is handle of pipe
  476.        CX is pipe mode word to set
  477.  Function:
  478.        Set mode of pipe
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  Returns:
  486.        Carry Clear
  487.            Indicated mode set
  488.        Carry set
  489.            AX = error
  490.  
  491. - INT 21 function 5F35 -----------------------------------------------------
  492. PeekNmPipe - Peek on a named pipe
  493.  Inputs:
  494.        BX is handle of pipe
  495.        CX is size of buffer for peek
  496.        DS:SI is address of peek buffer
  497.  Function:
  498.        Peek from pipe
  499.  Returns:
  500.        Carry set
  501.            AX = error code. IF ERROR IS ERROR_MORE_DATA Carry
  502.                 clear returns are also set.
  503.        Carry Clear
  504.            CX = bytes peeked from pipe
  505.            User DX:SI is available data
  506.            AX is pipe status
  507.  
  508.   * WARNING: Microsoft changed the specification for this function
  509.     in later versions of their OS products.  The IBM implementation
  510.     still reflects the original specification in order to preserve
  511.     backwards compatibility.  If you would like to make your function
  512.     compatible with Microsoft's implementation of this function, please
  513.     download the "PEKNMP.ZIP" or "NMP.ZIP" package as described at the
  514.     top of this fax.  For each OS/2 system that runs your program, you
  515.     will need to provide the patch program.  If you do not need
  516.     Microsoft OS compatibility or Micrsoft SQL Server connectivity,
  517.     you will not need this additional program.
  518.  
  519. - INT 21 function 5F36 -----------------------------------------------------
  520. TransactNmPipe - Do a transact named pipe
  521.  Inputs:
  522.        BX is handle of pipe
  523.        CX is source (write) buffer length
  524.        DX is destination (read) buffer length
  525.        DS:SI is address of source (write) buffer
  526.        ES:DI is address of destination (read) buffer
  527.  Function:
  528.        Write the data part of the transaction
  529.        NOTE: IT IS ASSUMED THE RESPONSE SMB HAS ONE PARAMETER WHICH IS THE
  530.              AMOUNT WRITTEN.
  531.  Returns:
  532.        Carry set
  533.            AX = error code. IF ERROR IS ERROR_MORE_DATA Carry
  534.                 clear returns are also set.
  535.        Carry Clear
  536.            CX = bytes read into destination (read) buffer address
  537.  
  538. - INT 21 function 5F37 -----------------------------------------------------
  539. CallNmPipe - Do a call named pipe
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  Inputs:
  546.        DS:SI -> Call named pipe parameter structure
  547.  Function:
  548.        Do a call named pipe
  549.  Returns:
  550.        Carry set
  551.            AX = error code. IF ERROR IS ERROR_MORE_DATA Carry
  552.                 clear returns are also set.
  553.        Carry Clear
  554.            CX = Bytes read
  555.  
  556. - INT 21 function 5F38 -----------------------------------------------------
  557. WaitNmPipe - Do a wait named pipe
  558.  Inputs:
  559.        DS:DX -> Pipe name
  560.        BX:CX = Timeout value
  561.  Function:
  562.        Do a wait named pipe
  563.  Returns:
  564.        Carry set
  565.            AX = error
  566.        Carry Clear
  567.  
  568. - INT 21 function 5F39 -----------------------------------------------------
  569. RawReadNmPipe/WriteNmPipe - Do raw I/O on a pipe
  570.  Inputs:
  571.        BX is handle of pipe
  572.        CX is size to read
  573.        DS:DX is address of buffer
  574.  Function:
  575.        Do a Raw read transaction on the pipe
  576.  Returns:
  577.        Carry set
  578.            AX = error code. IF ERROR IS ERROR_MORE_DATA Carry
  579.                 clear returns are also set.
  580.        Carry Clear
  581.            CX = bytes read into transfer address
  582.  
  583. - INT 21 function 5F3A -----------------------------------------------------
  584. RAW WRITE NAMED PIPE
  585.  Inputs:
  586.        BX is handle of pipe
  587.        CX is size to write
  588.        DS:DX is address of buffer
  589.  Function:
  590.        Do a Raw write transaction on the pipe
  591.  Returns:
  592.        Carry set
  593.            AX = error
  594.        Carry Clear
  595.            CX = bytes written from transfer address
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606. ********************************************************************
  607. The information below was downloaded from Compuserve, from an upload
  608. by Ralf Brown.  IBM does not warrant that the information below
  609. is correct or will actually function correctly when used.  Please
  610. direct questions to the PC DOS programming forums on Compuserve if
  611. there is a question or problem with the following information.
  612. IBM has also been given permission by the authors to distribute INF
  613. files listing these and other DOS functions by the authors.  Look on
  614. Compuserve and other online sources such as the PCC BBS (919-517-0001)
  615. for these files in the near future.
  616. ********************************************************************
  617.  
  618. --------N-215F32-----------------------------
  619. INT 21 u - Named Pipes - LOCAL DosQNmPipeInfo
  620.         AX = 5F32h
  621.         BX = handle
  622.         CX = size of _PIPEINFO structure
  623.         DX = level (must be 0001h)
  624.         DS:SI -> _PIPEINFO structure (see below)
  625. Return: CF clear if successful
  626.             _PIPEINFO structure filled in
  627.         CF set on error
  628.             AX = error code
  629.  
  630. Format of _PIPEINFO structure:
  631. Offset  Size    Description
  632.  00h    WORD    size of outgoing buffer
  633.  02h    WORD    size of incoming buffer
  634.  04h    BYTE    maximum number of instances allowed
  635.  05h    BYTE    current number of instances
  636.  06h    BYTE    length of the name (including terminating NUL)
  637.  07h  N BYTEs   name
  638.  
  639. --------N-215F33-----------------------------
  640. INT 21 u - Named Pipes - LOCAL DosQNmPHandState
  641.         AX = 5F33h
  642.         BX = handle
  643. Return: CF clear if successful
  644.             AH = pipe mode bit mask (see below)
  645.             AL = maximum number of instances
  646.         CF set on error
  647.             AX = error code
  648.  
  649. Bitfields for pipe mode:
  650.  bit 7  set if nonblocking, clear if blocking
  651.  bit 6  set if server end, clear if client end
  652.  bit 2  set if write in message mode, clear if write in byte mode
  653.  bit 0  set if read in message mode, clear if read in byte mode
  654.  
  655. --------N-215F34-----------------------------
  656. INT 21 u - Named Pipes - LOCAL DosSetNmPHandState
  657.         AX = 5F34h
  658.         BX = handle
  659.         CX = pipe mode bit mask
  660.  
  661.  
  662.  
  663.  
  664.  
  665.             bit 15: set if nonblocking, clear if blocking
  666.             bit  8: set if read in message mode, clear if read in byte mode
  667. Return: CF clear if successful
  668.         CF set if error
  669.             AX = error code
  670.  
  671. --------N-215F35-----------------------------
  672. INT 21 u - Named Pipes - LOCAL DosPeekNmPipe
  673.         AX = 5F35h
  674.         BX = handle
  675.         CX = buffer length
  676.         DS:SI -> buffer
  677. Return: CF clear if successful
  678.             CX = bytes read
  679.             SI = bytes left in the pipe
  680.             DX = bytes left in the current message
  681.             DI = pipe status
  682.                 0001h disconnected
  683.                 0002h listening
  684.                 0003h connected
  685.                 0004h closing
  686.         CF set if error
  687.             AX = error code
  688.  
  689. --------N-215F36-----------------------------
  690. INT 21 u - Named Pipes - LOCAL DosTransactNmPipe
  691.         AX = 5F36h
  692.         BX = handle
  693.         CX = in buffer length
  694.         DS:SI -> in buffer
  695.         DX = out buffer length
  696.         ES:DI -> out buffer
  697. Return: CF clear if successful
  698.             CX = bytes read
  699.         CF set on error
  700.             AX = error code
  701.  
  702. --------N-215F37-----------------------------
  703. INT 21 u - Named Pipes - DosCallNmPipe
  704.         AX = 5F37h
  705.         DS:SI -> DosCallNmPipe stack frame (see below)
  706. Return: CF clear if successful
  707.             CX = bytes read
  708.         CF set on error
  709.             AX = error code
  710.  
  711. Format of DosCallNmPipe stack frame:
  712. Offset  Size    Description
  713.  00h    DWORD   timeout
  714.  04h    DWORD   -> bytes read WORD (not used!!)
  715.  08h    WORD    out buffer length
  716.  0Ah    DWORD   address of out buffer
  717.  0Eh    WORD    in buffer length
  718.  10h    DWORD   address of in buffer
  719.  14h    DWORD   address of pipe name
  720.  
  721.  
  722.  
  723.  
  724.  
  725. --------N-215F38-----------------------------
  726. INT 21 u - Named Pipes - LOCAL DosWaitNmPipe
  727.         AX = 5F38h
  728.         DS:DX -> pipe name
  729.         BX:CX = timeout value
  730. Return: CF clear if successful
  731.         CF set if error
  732.             AX = error code
  733.  
  734. --------N-215F39-----------------------------
  735. INT 21 U - Named Pipes - LOCAL DosRawReadNmPipe
  736.         AX = 5F39h
  737.         BX = handle
  738.         CX = buffer length
  739.         DS:DX -> buffer
  740. Return: CF clear if successful
  741.             CX = bytes read
  742.         CF set if error
  743.             AX = error code
  744.  
  745. --------N-215F3A-----------------------------
  746. INT 21 U - Named Pipes - LOCAL DosRawWriteNmPipe
  747.         AX = 5F3Ah
  748.         BX = handle
  749.         CX = buffer length
  750.         DS:DX -> buffer
  751. Return: CF clear if successful
  752.             CX = bytes written
  753.         CF set if error
  754.             AX = error code
  755.  
  756.  
  757. = Item 5 ===================================================================
  758.  
  759. ----------
  760. References
  761. ----------
  762.  
  763. "IBM OS/2 Volume 2: Dos and Windows** Environment", p. 282-283., 1992.
  764. IBM Publication ordering number: GG-3731-00.
  765. To order, call 1-800-765-4426.
  766.  
  767. "IBM OS/2 Control Program Programming Reference", 1992.
  768. IBM Publication ordering number: S10G-6263-00.
  769. To order, call 1-800-765-4426.
  770.  
  771. Brown, Ralf and Kyle, Jim.  "Network Interrupts - A Programmer's
  772. Reference to Network APIs".  p. 105-106.  Addison-Wesley, 1994.
  773. ISBN number: 0-201-62644-6.
  774.  
  775. Orfali, Robert and Harkey, Dan.  "Client/Server Programming with
  776. OS/2 2.1".  New York, NY: Van Nostrand Reinhold, 1993.
  777. ISBN number: 0-442-01833-9.
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785. Sheils, Michael.  "The Undocumented LAN Manager and Named Pipe
  786. APIs for DOS and Windows**".  p. 119-143.  Dr. Dobbs Journal. April 1993.
  787.  
  788. Brown, Ralf.  (Electronic) PC Interrupt List (found on Compuserve in
  789. the PC DOS Programming area).  Look for the OS/2 INF version on
  790. Compuserve and other online sources as well.
  791.  
  792.  
  793. ----------------------
  794. NOTICES AND TRADEMARKS
  795. ----------------------
  796.  
  797.    The following terms mentioned in this FAX are trademarks or
  798.    registered trademarks of the IBM Corporation in the United
  799.    States and/or other countries:
  800.  
  801.     IBM
  802.    -----------------------------------------------
  803.     OS/2
  804.    -----------------------------------------------
  805.  
  806.    The following terms, denoted by a double
  807.    asterisk (**) in this FAX, are trademarks of
  808.    other companies as follows:
  809.  
  810.     Trademark:            Owner:
  811.    --------------------------------------------------------------
  812.     Windows               Microsoft Corporation
  813.    --------------------------------------------------------------
  814.     PowerBuilder          PowerSoft, Inc.
  815.    --------------------------------------------------------------
  816.  
  817.  
  818.  
  819.        Report by:  OS/2 Dosap Analyst Team - 05/94
  820.                    IBM - Boca Raton, Florida
  821.  
  822.  
  823.  
  824.  
  825.  
  826.