AppcCfg.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:26k
源码类别:

模拟服务器

开发平台:

C/C++

  1. /*****************************************************************************/
  2. /*                                                                           */
  3. /* Header: appccfg.h                                                         */
  4. /*                                                                           */
  5. /* (C) COPYRIGHT Data Connection Ltd 1993 - 2000                             */
  6. /* Copyright (c) Microsoft Corporation.  All rights reserved.                */
  7. /*                                                                           */
  8. /* Header for appccfg.c                                                      */
  9. /*                                                                           */
  10. /*****************************************************************************/
  11. /*****************************************************************************/
  12. /* If appccfg.h not already included then define APPCCFG_INCLUDED to avoid   */
  13. /* it being included again.                                                  */
  14. /*****************************************************************************/
  15. #ifndef APPCCFG_INCLUDED
  16. #define APPCCFG_INCLUDED
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /*****************************************************************************/
  21. /*                                                                           */
  22. /* HANDLE WINAPI GetAppcConfig( HANDLE hWnd, LPSTR pLocalLu, LPSTR pMode,    */
  23. /*                              LPINT pNumRemLu, INT iMaxRemLu, LPSTR pRemLu,*/
  24. /*                              LPINT pAsyncRetCode)                         */
  25. /*                                                                           */
  26. /* Parameters                                                                */
  27. /* ----------                                                                */
  28. /*                                                                           */
  29. /*  IN      hWnd      Handle of window to which completion is to be posted.  */
  30. /*                    If NULL no completion message will be posted but       */
  31. /*                    pAsyncRetCode must be valid. If hWnd is non-NULL it    */
  32. /*                    must be valid & pAsyncRetCode must be NULL.            */
  33. /*                                                                           */
  34. /*  IN      pLocalLU  Pointer to max 8 byte ASCII local LU name (should be 8 */
  35. /*                    ASCII blanks to request info on Remote LUs partnered   */
  36. /*                    to the default Local LU for this user. If none is      */
  37. /*                    configured then APPC_CFG_ERROR_NO_DEFAULT_LOCAL will   */
  38. /*                    be returned in the LPARAM).                            */
  39. /*                                                                           */
  40. /*  IN      pMode     Pointer to max 8 byte ASCII mode name (usually         */
  41. /*                    "QPCSUPP" for a 5250 emulator)                         */
  42. /*                                                                           */
  43. /*  IN/OUT  pNumRemLu Pointer to int to receive the number of Remote LUs     */
  44. /*                    available. (If more than MaxRemLu then only the first  */
  45. /*                    MaxRemLu of them will have been copied)                */
  46. /*                                                                           */
  47. /*  IN      iMaxRemLu Int giving the max number of Remote LU names the       */
  48. /*                    buffer can hold. (size of buffer in bytes / 9)         */
  49. /*                                                                           */
  50. /*  IN/OUT  pRemLu    Pointer to buffer to receive Remote LUs                */
  51. /*                    The data will be returned as an array of max 8 byte    */
  52. /*                    ASCII strings each followed by a terminating NULL      */
  53. /*                                                                           */
  54. /*  IN/OUT  pAsyncRetCode                                                    */
  55. /*                    Optional pointer to int to take the RetCode on         */
  56. /*                    completion of the async part of the call. Only         */
  57. /*                    required if hWnd is NULL. If the request is not        */
  58. /*                    accepted the value in AsyncRetCode is undefined.       */
  59. /*                    It the request was accepted then until the request is  */
  60. /*                    completed AsyncRetCode will contain the value          */
  61. /*                    APPC_CFG_PENDING. Final values are as in the LPARAM of */
  62. /*                    the completion message. If hWnd != NULL, pAsyncRetCode */
  63. /*                    must be NULL.                                          */
  64. /*                                                                           */
  65. /*                                                                           */
  66. /* Returns                                                                   */
  67. /* -------                                                                   */
  68. /*                                                                           */
  69. /* On Call                                                                   */
  70. /* -------                                                                   */
  71. /*  HANDLE  This VerbId will be returned in the WPARAM of any completion     */
  72. /*          message. (VerbId & APPC_CFG_SUCCESS) evaluates to TRUE if the    */
  73. /*          request was accepted.                                            */
  74. /*                                                                           */
  75. /*          If the above expression evaluates to FALSE then VerbId will      */
  76. /*          have one of the following values:                                */
  77. /*                                                                           */
  78. /*             APPC_CFG_ERROR_NO_APPC_INIT                                   */
  79. /*             APPC_CFG_ERROR_INVALID_HWND                                   */
  80. /*             APPC_CFG_ERROR_BAD_POINTER                                    */
  81. /*             APPC_CFG_ERROR_UNCLEAR_COMPLETION_MODE                        */
  82. /*             APPC_CFG_ERROR_TOO_MANY_REQUESTS                              */
  83. /*             APPC_CFG_ERROR_GENERAL_FAILURE                                */
  84. /*                                                                           */
  85. /*                                                                           */
  86. /*                                                                           */
  87. /* On Receipt of completion message                                          */
  88. /* --------------------------------                                          */
  89. /*  MSG     Equal to return from RegisterWindowMessage with                  */
  90. /*          WIN_APPC_CFG_COMPLETION_MSG passed as message name.              */
  91. /*                                                                           */
  92. /*  WPARAM  VerbId returned on the initiating call.                          */
  93. /*                                                                           */
  94. /*  LPARAM  Retcode which will be one of the following:                      */
  95. /*                                                                           */
  96. /*             APPC_CFG_SUCCESS_NO_DEFAULT_REMOTE                            */
  97. /*             APPC_CFG_SUCCESS_DEFAULT_REMOTE                               */
  98. /*                                                                           */
  99. /*             APPC_CFG_ERROR_NO_DEFAULT_LOCAL_LU                            */
  100. /*             APPC_CFG_ERROR_BAD_LOCAL_LU                                   */
  101. /*             APPC_CFG_ERROR_GENERAL_FAILURE                                */
  102. /*                                                                           */
  103. /*  (Retcode & APPC_CFG_ERROR)   evaluates to TRUE for an error retcode      */
  104. /*  (Retcode & APPC_CFG_SUCCESS) evaluates to TRUE for a success retcode     */
  105. /*                                                                           */
  106. /*                                                                           */
  107. /*                                                                           */
  108. /* Comments                                                                  */
  109. /* --------                                                                  */
  110. /*  This call attempts to get all the remote systems (partner LUs) which can */
  111. /*  be accessed by the logged on user with the given local LU and mode name. */
  112. /*  The final retcode also indicates if there is a default remote system     */
  113. /*  configured.                                                              */
  114. /*                                                                           */
  115. /*  Completion will either be signified by the posting of a completion       */
  116. /*  message or by the change of *pAsyncRetCode to a value other than         */
  117. /*  APPC_CFG_PENDING. The latter mechanism is intended for use by console    */
  118. /*  apps with no windows or on non-Windows platforms. Completion can then    */
  119. /*  be tested by code similar to the below:                                  */
  120. /*                                                                           */
  121. /*                while (*pAsyncRetCode == APPC_CFG_PENDING)                 */
  122. /*                {                                                          */
  123. /*                  sleep(250);                                              */
  124. /*                }                                                          */
  125. /*                                                                           */
  126. /*  Note that one of hWnd & pAsyncRetCode must be NULL and the other valid.  */
  127. /*  If this isn't the case APPC_CFG_ERROR_UNCLEAR_COMPLETION_MODE will be    */
  128. /*  returned.                                                                */
  129. /*                                                                           */
  130. /*  All strings are null terminated and are NOT space padded                 */
  131. /*                                                                           */
  132. /*  If the buffer is too short, the reported number of remote LU's available */
  133. /*  MAY be GREATER than the actual number. (This will only be the case where */
  134. /*  a particular Local Lu is configured at multiple nodes, and has the       */
  135. /*  remote on multiple nodes.) When the call is made again which a buffer    */
  136. /*  large enough to take all the remote LU, the reported number will be      */
  137. /*  correct.                                                                 */
  138. /*                                                                           */
  139. /*  ALL MEMORY TO WHICH POINTERS ARE PASSED MUST REMAIN VALID TILL A         */
  140. /*  COMPLETION MESSAGE IS RECEIVED                                           */
  141. /*                                                                           */
  142. /*  WinAPPCStartup MUST be called first                                      */
  143. /*                                                                           */
  144. /*****************************************************************************/
  145. /*****************************************************************************/
  146. /* Entry point prototype                                                     */
  147. /*****************************************************************************/
  148. extern HANDLE WINAPI GetAppcConfig( HANDLE hWnd, LPSTR pLocalLu, LPSTR pMode,
  149.                                  LPINT pNumRemLu, INT iMaxRemLu, LPSTR pRemLu,
  150.                                  LPINT pAsyncRetCode);
  151. /*****************************************************************************/
  152. /* Completion Message Name                                                   */
  153. /*****************************************************************************/
  154. #define  WIN_APPC_CFG_COMPLETION_MSG "WinAppcCfg"
  155. /*****************************************************************************/
  156. /* Test values                                                               */
  157. /*****************************************************************************/
  158. #define  APPC_CFG_SUCCESS                      0x1000
  159. #define  APPC_CFG_ERROR                        0x2000
  160. #define  APPC_CFG_PENDING                      0xFFFF
  161. /*****************************************************************************/
  162. /* Retcodes                                                                  */
  163. /*****************************************************************************/
  164. #define  APPC_CFG_SUCCESS_NO_DEFAULT_REMOTE     (APPC_CFG_SUCCESS + 1)
  165. #define  APPC_CFG_SUCCESS_DEFAULT_REMOTE        (APPC_CFG_SUCCESS + 2)
  166. #define  APPC_CFG_SUCCESS_NAMES                 (APPC_CFG_SUCCESS + 3)
  167. #define  APPC_CFG_SUCCESS_NAMES_INCOMPLETE      (APPC_CFG_SUCCESS + 2)
  168. #define  APPC_CFG_ERROR_NO_DEFAULT_LOCAL_LU     (APPC_CFG_ERROR + 1)
  169. #define  APPC_CFG_ERROR_BAD_LOCAL_LU            (APPC_CFG_ERROR + 2)
  170. #define  APPC_CFG_ERROR_GENERAL_FAILURE         (APPC_CFG_ERROR + 3)
  171. #define  APPC_CFG_ERROR_INVALID_HWND            (APPC_CFG_ERROR + 4)
  172. #define  APPC_CFG_ERROR_BAD_POINTER             (APPC_CFG_ERROR + 5)
  173. #define  APPC_CFG_ERROR_TOO_MANY_REQUESTS       (APPC_CFG_ERROR + 6)
  174. #define  APPC_CFG_ERROR_NO_APPC_INIT            (APPC_CFG_ERROR + 7)
  175. #define  APPC_CFG_ERROR_UNCLEAR_COMPLETION_MODE (APPC_CFG_ERROR + 8)
  176. #define  APPC_CFG_ERROR_BAD_PARAMETER           (APPC_CFG_ERROR + 10)
  177. /*****************************************************************************/
  178. /*                                                                           */
  179. /* HANDLE WINAPI GetAppcConfigEx( HANDLE hWnd, LPSTR pAssociate, INT CmdCode,*/
  180. /*                              LPINT pNumNames, INT iMaxNames, LPSTR pNames,*/
  181. /*                              LPINT pAsyncRetCode)                         */
  182. /*                                                                           */
  183. /* Parameters                                                                */
  184. /* ----------                                                                */
  185. /*                                                                           */
  186. /*  IN      hWnd      Handle of window to which completion is to be posted.  */
  187. /*                    If NULL no completion message will be posted but       */
  188. /*                    pAsyncRetCode must be valid. If hWnd is non-NULL it    */
  189. /*                    must be valid & pAsyncRetCode must be NULL.            */
  190. /*                                                                           */
  191. /*  IN      pAssociate Pointer to ASCII name that qualifies which names to   */
  192. /*                    retrieve. The meaning of the name depends on CmdCode.  */
  193. /*                    The name could be a Local LU,a Remote LU, a SNA        */
  194. /*                    Server, or a NULL pointer.                             */
  195. /*                    For SNA Server the syntax may be a Machine name, or    */
  196. /*                    Service name:Machine name (ex SNASRV02:THISBOX )       */
  197. /*                                                                           */
  198. /*  IN      CmdCode   Specifies what names to retrieve and what association  */
  199. /*                    to use.                                                */
  200. /*                    NAMES_LOCALFORREMOTE  get Local LU names that can      */
  201. /*                                          partner with the Remote LU name  */
  202. /*                                          that pAssociate points to.       */
  203. /*                                                                           */
  204. /*                    NAMES_LOCALFORLOCAL   get Local LU names that can      */
  205. /*                                          partner with the Local LU name   */
  206. /*                                          that pAssociate points to.       */
  207. /*                                                                           */
  208. /*                    NAMES_LOCALFORNODE    get Local LU names that          */
  209. /*                                          are defined on the SNA Server    */
  210. /*                                          that pAssociate points to.       */
  211. /*                                                                           */
  212. /*                    NAMES_LOCALFORALL     get all Local LU names that      */
  213. /*                                          are defined on the sub-domain.   */
  214. /*                                          pAssociate is ignored.           */
  215. /*                                                                           */
  216. /*                    NAMES_REMOTEFORLOCAL  get Remote LU names that can     */
  217. /*                                          partner with the Local LU name   */
  218. /*                                          that pAssociate points to.       */
  219. /*                                                                           */
  220. /*                    NAMES_REMOTEFORNODE   get Remote LU names that         */
  221. /*                                          are defined on the SNA Server    */
  222. /*                                          that pAssociate points to.       */
  223. /*                                                                           */
  224. /*                    NAMES_REMOTEFORALL    get all Remote LU names that     */
  225. /*                                          are defined on the sub-domain.   */
  226. /*                                          pAssociate is ignored.           */
  227. /*                                                                           */
  228. /*                    NAMES_MODEFORALL      get all Mode names that          */
  229. /*                                          are defined on the sub-domain.   */
  230. /*                                          pAssociate is ignored.           */
  231. /*                                                                           */
  232. /*                                                                           */
  233. /*                                                                           */
  234. /*  IN/OUT  pNumNames Pointer to int to receive the number of names          */
  235. /*                    available. (If more than MaxRemLu then only the first  */
  236. /*                    MaxRemLu of them will have been copied)                */
  237. /*                                                                           */
  238. /*  IN      iMaxNames Int giving the max number of names the                 */
  239. /*                    buffer can hold. (size of buffer in bytes / 9)         */
  240. /*                                                                           */
  241. /*  IN/OUT  pNames    Pointer to buffer to receive names.                    */
  242. /*                    The data will be returned as an array of max 8 byte    */
  243. /*                    ASCII strings each followed by a terminating NULL      */
  244. /*                                                                           */
  245. /*  IN/OUT  pAsyncRetCode                                                    */
  246. /*                    Optional pointer to int to take the RetCode on         */
  247. /*                    completion of the async part of the call. Only         */
  248. /*                    required if hWnd is NULL. If the request is not        */
  249. /*                    accepted the value in AsyncRetCode is undefined.       */
  250. /*                    It the request was accepted then until the request is  */
  251. /*                    completed AsyncRetCode will contain the value          */
  252. /*                    APPC_CFG_PENDING. Final values are as in the LPARAM of */
  253. /*                    the completion message. If hWnd != NULL, pAsyncRetCode */
  254. /*                    must be NULL.                                          */
  255. /*                                                                           */
  256. /*                                                                           */
  257. /* Returns                                                                   */
  258. /* -------                                                                   */
  259. /*                                                                           */
  260. /* On Call                                                                   */
  261. /* -------                                                                   */
  262. /*  HANDLE  This VerbId will be returned in the WPARAM of any completion     */
  263. /*          message. (VerbId & APPC_CFG_SUCCESS) evaluates to TRUE if the    */
  264. /*          request was accepted.                                            */
  265. /*                                                                           */
  266. /*          If the above expression evaluates to FALSE then VerbId will      */
  267. /*          have one of the following values:                                */
  268. /*                                                                           */
  269. /*             APPC_CFG_ERROR_NO_APPC_INIT                                   */
  270. /*             APPC_CFG_ERROR_INVALID_HWND                                   */
  271. /*             APPC_CFG_ERROR_BAD_POINTER                                    */
  272. /*             APPC_CFG_ERROR_UNCLEAR_COMPLETION_MODE                        */
  273. /*             APPC_CFG_ERROR_TOO_MANY_REQUESTS                              */
  274. /*             APPC_CFG_ERROR_GENERAL_FAILURE                                */
  275. /*                                                                           */
  276. /*                                                                           */
  277. /*                                                                           */
  278. /* On Receipt of completion message                                          */
  279. /* --------------------------------                                          */
  280. /*  MSG     Equal to return from RegisterWindowMessage with                  */
  281. /*          WIN_APPC_CFG_COMPLETION_MSG passed as message name.              */
  282. /*                                                                           */
  283. /*  WPARAM  VerbId returned on the initiating call.                          */
  284. /*                                                                           */
  285. /*  LPARAM  Retcode which will be one of the following:                      */
  286. /*                                                                           */
  287. /*             APPC_CFG_SUCCESS_NAMES                                        */
  288. /*             APPC_CFG_SUCCESS_NAMES_INCOMPLETE                             */
  289. /*                                                                           */
  290. /*             APPC_CFG_ERROR_BAD_PARAMETER                                  */
  291. /*             APPC_CFG_ERROR_GENERAL_FAILURE                                */
  292. /*                                                                           */
  293. /*  (Retcode & APPC_CFG_ERROR)   evaluates to TRUE for an error retcode      */
  294. /*  (Retcode & APPC_CFG_SUCCESS) evaluates to TRUE for a success retcode     */
  295. /*                                                                           */
  296. /*                                                                           */
  297. /*                                                                           */
  298. /* Comments                                                                  */
  299. /* --------                                                                  */
  300. /*                                                                           */
  301. /*  Completion will either be signified by the posting of a completion       */
  302. /*  message or by the change of *pAsyncRetCode to a value other than         */
  303. /*  APPC_CFG_PENDING. The latter mechanism is intended for use by console    */
  304. /*  apps with no windows or on non-Windows platforms. Completion can then    */
  305. /*  be tested by code similar to the below:                                  */
  306. /*                                                                           */
  307. /*                while (*pAsyncRetCode == APPC_CFG_PENDING)                 */
  308. /*                {                                                          */
  309. /*                  sleep(250);                                              */
  310. /*                }                                                          */
  311. /*                                                                           */
  312. /*  Note that one of hWnd & pAsyncRetCode must be NULL and the other valid.  */
  313. /*  If this isn't the case APPC_CFG_ERROR_UNCLEAR_COMPLETION_MODE will be    */
  314. /*  returned.                                                                */
  315. /*                                                                           */
  316. /*  All strings are null terminated and are NOT space padded                 */
  317. /*                                                                           */
  318. /*  If the buffer is too short, the reported number of remote LU's available */
  319. /*  MAY be GREATER than the actual number.                                   */
  320. /*                                                                           */
  321. /*  ALL MEMORY TO WHICH POINTERS ARE PASSED MUST REMAIN VALID TILL A         */
  322. /*  COMPLETION MESSAGE IS RECEIVED                                           */
  323. /*                                                                           */
  324. /*  WinAPPCStartup MUST be called first                                      */
  325. /*                                                                           */
  326. /*****************************************************************************/
  327. /*****************************************************************************/
  328. /* Entry point prototype                                                     */
  329. /*****************************************************************************/
  330. extern HANDLE WINAPI GetAppcConfigEx( HANDLE hWnd, LPSTR pAssociate, INT CmdCode,
  331.                                  LPINT pNumNames, INT iMaxNames, LPSTR pNames,
  332.                                  LPINT pAsyncRetCode);
  333. /*****************************************************************************/
  334. /* CmdCode values                                                            */
  335. /*****************************************************************************/
  336. #ifndef NAMES_LOCALFORREMOTE
  337. #define NAMES_LOCALFORREMOTE 1
  338. #define NAMES_LOCALFORLOCAL 2
  339. #define NAMES_LOCALFORNODE 3
  340. #define NAMES_LOCALFORALL 4
  341. #define NAMES_REMOTEFORLOCAL 5
  342. #define NAMES_REMOTEFORNODE 6
  343. #define NAMES_REMOTEFORALL 7
  344. #define NAMES_MODEFORALL 8
  345. #endif
  346. #ifdef __cplusplus
  347. }
  348. #endif
  349. /*****************************************************************************/
  350. /* End ifndef APPCCFG_INCLUDED                                               */
  351. /*****************************************************************************/
  352. #endif