home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / appccfg.h < prev    next >
Text File  |  1998-04-25  |  13KB  |  173 lines

  1. /*****************************************************************************/
  2. /*                                                                           */
  3. /* Header: appccfg.h                                                         */
  4. /*                                                                           */
  5. /* (C) COPYRIGHT Data Connection Ltd 1993                                    */
  6. /* (C) COPYRIGHT Microsoft Corp.     1993                                    */
  7. /*                                                                           */
  8. /* Header for appccfg.c                                                      */
  9. /*                                                                           */
  10. /*****************************************************************************/
  11. /*  ----  14/05/93  CD  Initial coding                                       */
  12. /*****************************************************************************/
  13.  
  14.  
  15. /*****************************************************************************/
  16. /*                                                                           */
  17. /* HANDLE WINAPI GetAppcConfig( HANDLE hWnd, LPSTR pLocalLu, LPSTR pMode,    */
  18. /*                              LPINT pNumRemLu, INT iMaxRemLu, LPSTR pRemLu,*/
  19. /*                              LPINT pAsyncRetCode)                         */
  20. /*                                                                           */
  21. /* Parameters                                                                */
  22. /* ----------                                                                */
  23. /*                                                                           */
  24. /*  IN      hWnd      Handle of window to which completion is to be posted.  */
  25. /*                    If NULL no completion message will be posted but       */
  26. /*                    pAsyncRetCode must be valid. If hWnd is non-NULL it    */
  27. /*                    must be valid & pAsyncRetCode must be NULL.            */
  28. /*                                                                           */
  29. /*  IN      pLocalLU  Pointer to max 8 byte ASCII local LU name (should be 8 */
  30. /*                    ASCII blanks to request info on Remote LUs partnered   */
  31. /*                    to the default Local LU for this user. If none is      */
  32. /*                    configured then APPC_CFG_ERROR_NO_DEFAULT_LOCAL will   */
  33. /*                    be returned in the LPARAM).                            */
  34. /*                                                                           */
  35. /*  IN      pMode     Pointer to max 8 byte ASCII mode name (usually         */
  36. /*                    "QPCSUPP" for a 5250 emulator)                         */
  37. /*                                                                           */
  38. /*  IN/OUT  pNumRemLu Pointer to int to receive the number of Remote LUs     */
  39. /*                    available. (If more than MaxRemLu then only the first  */
  40. /*                    MaxRemLu of them will have been copied)                */
  41. /*                                                                           */
  42. /*  IN      iMaxRemLu Int giving the max number of Remote LU names the       */
  43. /*                    buffer can hold. (size of buffer in bytes / 9)         */
  44. /*                                                                           */
  45. /*  IN/OUT  pRemLu    Pointer to buffer to receive Remote LUs                */
  46. /*                    The data will be returned as an array of max 8 byte    */
  47. /*                    ASCII strings each followed by a terminating NULL      */
  48. /*                                                                           */
  49. /*  IN/OUT  pAsyncRetCode                                                    */
  50. /*                    Optional pointer to int to take the RetCode on         */
  51. /*                    completion of the async part of the call. Only         */
  52. /*                    required if hWnd is NULL. If the request is not        */
  53. /*                    accepted the value in AsyncRetCode is undefined.       */
  54. /*                    It the request was accepted then until the request is  */
  55. /*                    completed AsyncRetCode will contain the value          */
  56. /*                    APPC_CFG_PENDING. Final values are as in the LPARAM of */
  57. /*                    the completion message. If hWnd != NULL, pAsyncRetCode */
  58. /*                    must be NULL.                                          */
  59. /*                                                                           */
  60. /*                                                                           */
  61. /* Returns                                                                   */
  62. /* -------                                                                   */
  63. /*                                                                           */
  64. /* On Call                                                                   */
  65. /* -------                                                                   */
  66. /*  HANDLE  This VerbId will be returned in the WPARAM of any completion     */
  67. /*          message. (VerbId & APPC_CFG_SUCCESS) evaluates to TRUE if the    */
  68. /*          request was accepted.                                            */
  69. /*                                                                           */
  70. /*          If the above expression evaluates to FALSE then VerbId will      */
  71. /*          have one of the following values:                                */
  72. /*                                                                           */
  73. /*             APPC_CFG_ERROR_NO_APPC_INIT                                   */
  74. /*             APPC_CFG_ERROR_INVALID_HWND                                   */
  75. /*             APPC_CFG_ERROR_BAD_POINTER                                    */
  76. /*             APPC_CFG_ERROR_UNCLEAR_COMPLETION_MODE                        */
  77. /*             APPC_CFG_ERROR_TOO_MANY_REQUESTS                              */
  78. /*             APPC_CFG_ERROR_GENERAL_FAILURE                                */
  79. /*                                                                           */
  80. /*                                                                           */
  81. /*                                                                           */
  82. /* On Receipt of completion message                                          */
  83. /* --------------------------------                                          */
  84. /*  MSG     Equal to return from RegisterWindowMessage with                  */
  85. /*          WIN_APPC_CFG_COMPLETION_MSG passed as message name.              */
  86. /*                                                                           */
  87. /*  WPARAM  VerbId returned on the initiating call.                          */
  88. /*                                                                           */
  89. /*  LPARAM  Retcode which will be one of the following:                      */
  90. /*                                                                           */
  91. /*             APPC_CFG_SUCCESS_NO_DEFAULT_REMOTE                            */
  92. /*             APPC_CFG_SUCCESS_DEFAULT_REMOTE                               */
  93. /*                                                                           */
  94. /*             APPC_CFG_ERROR_NO_DEFAULT_LOCAL_LU                            */
  95. /*             APPC_CFG_ERROR_BAD_LOCAL_LU                                   */
  96. /*             APPC_CFG_ERROR_GENERAL_FAILURE                                */
  97. /*                                                                           */
  98. /*  (Retcode & APPC_CFG_ERROR)   evaluates to TRUE for an error retcode      */
  99. /*  (Retcode & APPC_CFG_SUCCESS) evaluates to TRUE for a success retcode     */
  100. /*                                                                           */
  101. /*                                                                           */
  102. /*                                                                           */
  103. /* Comments                                                                  */
  104. /* --------                                                                  */
  105. /*  This call attempts to get all the remote systems (partner LUs) which can */
  106. /*  be accessed by the logged on user with the given local LU and mode name. */
  107. /*  The final retcode also indicates if there is a default remote system     */
  108. /*  configured.                                                              */
  109. /*                                                                           */
  110. /*  Completion will either be signified by the posting of a completion       */
  111. /*  message or by the change of *pAsyncRetCode to a value other than         */
  112. /*  APPC_CFG_PENDING. The latter mechanism is intended for use by console    */
  113. /*  apps with no windows or on non-Windows platforms. Completion can then    */
  114. /*  be tested by code similar to the below:                                  */
  115. /*                                                                           */
  116. /*                while (*pAsyncRetCode == APPC_CFG_PENDING)                 */
  117. /*                {                                                          */
  118. /*                  sleep(250);                                              */
  119. /*                }                                                          */
  120. /*                                                                           */
  121. /*  Note that one of hWnd & pAsyncRetCode must be NULL and the other valid.  */
  122. /*  If this isn't the case APPC_CFG_ERROR_UNCLEAR_COMPLETION_MODE will be    */
  123. /*  returned.                                                                */
  124. /*                                                                           */
  125. /*  All strings are null terminated and are NOT space padded                 */
  126. /*                                                                           */
  127. /*  If the buffer is too short, the reported number of remote LU's available */
  128. /*  MAY be GREATER than the actual number. (This will only be the case where */
  129. /*  a particular Local Lu is configured at multiple nodes, and has the       */
  130. /*  remote on multiple nodes.) When the call is made again which a buffer    */
  131. /*  large enough to take all the remote LU, the reported number will be      */
  132. /*  correct.                                                                 */
  133. /*                                                                           */
  134. /*  ALL MEMORY TO WHICH POINTERS ARE PASSED MUST REMAIN VALID TILL A         */
  135. /*  COMPLETION MESSAGE IS RECEIVED                                           */
  136. /*                                                                           */
  137. /*  WinAPPCStartup MUST be called first                                      */
  138. /*                                                                           */
  139. /*****************************************************************************/
  140. /*****************************************************************************/
  141. /* Entry point prototype                                                     */
  142. /*****************************************************************************/
  143. extern HANDLE WINAPI GetAppcConfig( HANDLE hWnd, LPSTR pLocalLu, LPSTR pMode,
  144.                                  LPINT pNumRemLu, INT iMaxRemLu, LPSTR pRemLu,
  145.                                  LPINT pAsyncRetCode);
  146.  
  147. /*****************************************************************************/
  148. /* Completion Message Name                                                   */
  149. /*****************************************************************************/
  150. #define  WIN_APPC_CFG_COMPLETION_MSG "WinAppcCfg"
  151.  
  152. /*****************************************************************************/
  153. /* Test values                                                               */
  154. /*****************************************************************************/
  155. #define  APPC_CFG_SUCCESS                      0x1000
  156. #define  APPC_CFG_ERROR                        0x2000
  157. #define  APPC_CFG_PENDING                      0xFFFF
  158.  
  159. /*****************************************************************************/
  160. /* Retcodes                                                                  */
  161. /*****************************************************************************/
  162. #define  APPC_CFG_SUCCESS_NO_DEFAULT_REMOTE     (APPC_CFG_SUCCESS + 1)
  163. #define  APPC_CFG_SUCCESS_DEFAULT_REMOTE        (APPC_CFG_SUCCESS + 2)
  164.  
  165. #define  APPC_CFG_ERROR_NO_DEFAULT_LOCAL_LU     (APPC_CFG_ERROR + 1)
  166. #define  APPC_CFG_ERROR_BAD_LOCAL_LU            (APPC_CFG_ERROR + 2)
  167. #define  APPC_CFG_ERROR_GENERAL_FAILURE         (APPC_CFG_ERROR + 3)
  168. #define  APPC_CFG_ERROR_INVALID_HWND            (APPC_CFG_ERROR + 4)
  169. #define  APPC_CFG_ERROR_BAD_POINTER             (APPC_CFG_ERROR + 5)
  170. #define  APPC_CFG_ERROR_TOO_MANY_REQUESTS       (APPC_CFG_ERROR + 6)
  171. #define  APPC_CFG_ERROR_NO_APPC_INIT            (APPC_CFG_ERROR + 7)
  172. #define  APPC_CFG_ERROR_UNCLEAR_COMPLETION_MODE (APPC_CFG_ERROR + 8)
  173.