home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / mq.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  44KB  |  1,706 lines

  1. /*++
  2.  
  3. Copyright (c) 1996 Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     mq.h
  8.  
  9. Abstract:
  10.  
  11.     Master include file for Message Queue applications
  12.  
  13. --*/
  14.  
  15. #ifndef __MQ_H__
  16. #define __MQ_H__
  17.  
  18. //
  19. //  Clients that need transactions should include transact.h before mq.h
  20. //  For the clients not needing transactions - ITransaction is  opaque
  21. //
  22. #ifndef __transact_h__
  23. typedef void ITransaction;
  24. #endif
  25.  
  26. //
  27. //    Support version older than VC4.2
  28. //
  29. #if defined(_MSC_VER) && (_MSC_VER < 1020)
  30.  
  31. typedef struct tagMQPROPVARIANT MQPROPVARIANT;
  32.  
  33. #define TYPEDEF_CA(type, name) \
  34.     typedef struct tag##name {\
  35.         ULONG cElems;\
  36.         type * pElems;\
  37.     } name
  38.  
  39. #ifndef _tagCAUB_DEFINED
  40. #define _tagCAUB_DEFINED
  41. TYPEDEF_CA(unsigned char, CAUB);
  42. #endif
  43.  
  44. #ifndef _tagCAI_DEFINED
  45. #define _tagCAI_DEFINED
  46. TYPEDEF_CA(short, CAI);
  47. #endif
  48.  
  49. #ifndef _tagCAUI_DEFINED
  50. #define _tagCAUI_DEFINED
  51. TYPEDEF_CA(USHORT, CAUI);
  52. #endif
  53.  
  54. #ifndef _tagCAL_DEFINED
  55. #define _tagCAL_DEFINED
  56. TYPEDEF_CA(long, CAL);
  57. #endif
  58.  
  59. #ifndef _tagCAUL_DEFINED
  60. #define _tagCAUL_DEFINED
  61. TYPEDEF_CA(ULONG, CAUL);
  62. #endif
  63.  
  64. #ifndef _tagCACLSID_DEFINED
  65. #define _tagCACLSID_DEFINED
  66. TYPEDEF_CA(CLSID, CACLSID);
  67. #endif
  68.  
  69. #ifndef _tagCABSTR_DEFINED
  70. #define _tagCABSTR_DEFINED
  71. TYPEDEF_CA(LPOLESTR, CABSTR);
  72. #endif
  73.  
  74. #ifndef _tagCALPWSTR_DEFINED
  75. #define _tagCALPWSTR_DEFINED
  76. TYPEDEF_CA(LPWSTR, CALPWSTR);
  77. #endif
  78.  
  79. #ifndef _tagCAMQPROPVARIANT_DEFINED
  80. #define _tagCAMQPROPVARIANT_DEFINED
  81. TYPEDEF_CA(MQPROPVARIANT, CAMQPROPVARIANT);
  82. #endif
  83.  
  84. struct tagMQPROPVARIANT {
  85.     VARTYPE vt;
  86.     WORD wReserved1;
  87.     WORD wReserved2;
  88.     WORD wReserved3;
  89.     /*[switch_is((unsigned short)vt)]*/ union {
  90.       /*[case(VT_EMPTY, VT_NULL)];*/
  91.       /*[case(VT_UI1)]*/               UCHAR bVal;
  92.       /*[case(VT_I2)]*/                short iVal;
  93.       /*[case(VT_UI2)]*/               USHORT uiVal;
  94.       /*[case(VT_BOOL)]*/              VARIANT_BOOL boolVal;
  95.       /*[case(VT_I4)]*/                long lVal;
  96.       /*[case(VT_UI4)]*/               ULONG ulVal;
  97.       /*[case(VT_HRESULT)]*/           SCODE scode;
  98.       /*[case(VT_DATE)]*/              DATE date;
  99.       /*[case(VT_CLSID)]*/             CLSID  *puuid;
  100.       /*[case(VT_BLOB)]*/              BLOB blob;
  101.       /*[case(VT_BSTR)]*/              LPOLESTR bstrVal;
  102.       /*[case(VT_LPSTR)]*/             LPSTR pszVal;
  103.       /*[case(VT_LPWSTR)]*/            LPWSTR pwszVal;
  104.       /*[case(VT_VECTOR | VT_UI1)]*/   CAUB caub;
  105.       /*[case(VT_VECTOR | VT_I2)]*/    CAI cai;
  106.       /*[case(VT_VECTOR | VT_UI2)]*/   CAUI caui;
  107.       /*[case(VT_VECTOR | VT_I4)]*/    CAL cal;
  108.       /*[case(VT_VECTOR | VT_UI4)]*/   CAUL caul;
  109.       /*[case(VT_VECTOR | VT_CLSID)]*/ CACLSID cauuid;
  110.       /*[case(VT_VECTOR | VT_BSTR)]*/  CABSTR cabstr;
  111.       /*[case(VT_VECTOR | VT_LPWSTR)]*/CALPWSTR calpwstr;
  112.       /*[case(VT_VARIANT)]*/           CAMQPROPVARIANT capropvar;
  113.     };
  114. };
  115.  
  116. #else // defined(_MSC_VER) && (_MSC_VER < 1020)
  117.  
  118. typedef struct tagPROPVARIANT tagMQPROPVARIANT;
  119.  
  120. typedef tagMQPROPVARIANT MQPROPVARIANT;
  121.  
  122. #endif // defined(_MSC_VER) && (_MSC_VER < 1020)
  123.  
  124. #define    PRLT    ( 0 )
  125.  
  126. #define    PRLE    ( 1 )
  127.  
  128. #define    PRGT    ( 2 )
  129.  
  130. #define    PRGE    ( 3 )
  131.  
  132. #define    PREQ    ( 4 )
  133.  
  134. #define    PRNE    ( 5 )
  135.  
  136. typedef struct  tagMQPROPERTYRESTRICTION
  137.     {
  138.     ULONG rel;
  139.     PROPID prop;
  140.     MQPROPVARIANT prval;
  141.     }    MQPROPERTYRESTRICTION;
  142.  
  143. typedef struct  tagMQRESTRICTION
  144.     {
  145.     ULONG cRes;
  146.     /* [size_is] */ MQPROPERTYRESTRICTION __RPC_FAR *paPropRes;
  147.     }    MQRESTRICTION;
  148.  
  149. typedef struct  tagMQCOLUMNSET
  150.     {
  151.     ULONG cCol;
  152.     /* [size_is] */ PROPID __RPC_FAR *aCol;
  153.     }    MQCOLUMNSET;
  154.  
  155. #define    QUERY_SORTASCEND    ( 0 )
  156.  
  157. #define    QUERY_SORTDESCEND    ( 1 )
  158.  
  159. typedef struct  tagMQSORTKEY
  160.     {
  161.     PROPID propColumn;
  162.     ULONG dwOrder;
  163.     }    MQSORTKEY;
  164.  
  165. typedef struct  tagMQSORTSET
  166.     {
  167.     ULONG cCol;
  168.     /* [size_is] */ MQSORTKEY __RPC_FAR *aCol;
  169.     }    MQSORTSET;
  170.  
  171.  
  172. #define MQ_MAX_Q_NAME_LEN      124   // Maximal WCHAR length of a queue name.
  173. #define MQ_MAX_Q_LABEL_LEN     124
  174. #define MQ_MAX_MSG_LABEL_LEN   250
  175.  
  176. typedef HANDLE QUEUEHANDLE;
  177.  
  178.  
  179. typedef PROPID          MSGPROPID;
  180. typedef PROPID          QUEUEPROPID;
  181. typedef PROPID          QMPROPID;
  182.  
  183. typedef struct tagMQMSGPROPS
  184. {
  185.     DWORD           cProp;
  186.     MSGPROPID*      aPropID;
  187.     MQPROPVARIANT*  aPropVar;
  188.     HRESULT*        aStatus;
  189. } MQMSGPROPS;
  190.  
  191. typedef struct tagMQQUEUEPROPS
  192. {
  193.     DWORD           cProp;
  194.     QUEUEPROPID*    aPropID;
  195.     MQPROPVARIANT*  aPropVar;
  196.     HRESULT*        aStatus;
  197. } MQQUEUEPROPS;
  198.  
  199. typedef struct tagMQQMPROPS
  200. {
  201.     DWORD           cProp;
  202.     QMPROPID*       aPropID;
  203.     MQPROPVARIANT*  aPropVar;
  204.     HRESULT*        aStatus;
  205. } MQQMPROPS;
  206.  
  207.  
  208.  
  209. //********************************************************************
  210. //  API FLAGS
  211. //********************************************************************
  212.  
  213. //
  214. //  MQOpenQueue - Access values
  215. //
  216. #define MQ_RECEIVE_ACCESS       0x00000001
  217. #define MQ_SEND_ACCESS          0x00000002
  218. #define MQ_PEEK_ACCESS          0x00000020
  219.  
  220. //
  221. //  MQOpenQueue - Share values
  222. //
  223. #define MQ_DENY_NONE            0x00000000
  224. #define MQ_DENY_RECEIVE_SHARE   0x00000001
  225.  
  226. //
  227. //  MQReceiveMessage - Action values
  228. //
  229. #define MQ_ACTION_RECEIVE       0x00000000
  230. #define MQ_ACTION_PEEK_CURRENT  0x80000000
  231. #define MQ_ACTION_PEEK_NEXT     0x80000001
  232.  
  233. //
  234. // MQSendMessage,  MQReceiveMessage:  special cases for the transaction parameter
  235. //
  236. #define MQ_NO_TRANSACTION             NULL
  237. #define MQ_MTS_TRANSACTION            (ITransaction *)1
  238. #define MQ_XA_TRANSACTION             (ITransaction *)2
  239. #define MQ_SINGLE_MESSAGE             (ITransaction *)3
  240.  
  241. //********************************************************************
  242. //  PRIORITY LIMITS
  243. //********************************************************************
  244.  
  245. //
  246. //  Message priorities
  247. //
  248. #define MQ_MIN_PRIORITY          0    // Minimal message priority
  249. #define MQ_MAX_PRIORITY          7    // Maximal message priority
  250.  
  251.  
  252. //********************************************************************
  253. //  MESSAGE PROPERTIES
  254. //********************************************************************
  255. #define PROPID_M_BASE                0
  256. #define PROPID_M_CLASS               (PROPID_M_BASE + 1)     /* VT_UI2           */
  257. #define PROPID_M_MSGID               (PROPID_M_BASE + 2)     /* VT_UI1|VT_VECTOR */
  258. #define PROPID_M_CORRELATIONID       (PROPID_M_BASE + 3)     /* VT_UI1|VT_VECTOR */
  259. #define PROPID_M_PRIORITY            (PROPID_M_BASE + 4)     /* VT_UI1           */
  260. #define PROPID_M_DELIVERY            (PROPID_M_BASE + 5)     /* VT_UI1           */
  261. #define PROPID_M_ACKNOWLEDGE         (PROPID_M_BASE + 6)     /* VT_UI1           */
  262. #define PROPID_M_JOURNAL             (PROPID_M_BASE + 7)     /* VT_UI1           */
  263. #define PROPID_M_APPSPECIFIC         (PROPID_M_BASE + 8)     /* VT_UI4           */
  264. #define PROPID_M_BODY                (PROPID_M_BASE + 9)     /* VT_UI1|VT_VECTOR */
  265. #define PROPID_M_BODY_SIZE           (PROPID_M_BASE + 10)    /* VT_UI4           */
  266. #define PROPID_M_LABEL               (PROPID_M_BASE + 11)    /* VT_LPWSTR        */
  267. #define PROPID_M_LABEL_LEN           (PROPID_M_BASE + 12)    /* VT_UI4           */
  268. #define PROPID_M_TIME_TO_REACH_QUEUE (PROPID_M_BASE + 13)    /* VT_UI4           */
  269. #define PROPID_M_TIME_TO_BE_RECEIVED (PROPID_M_BASE + 14)    /* VT_UI4           */
  270. #define PROPID_M_RESP_QUEUE          (PROPID_M_BASE + 15)    /* VT_LPWSTR        */
  271. #define PROPID_M_RESP_QUEUE_LEN      (PROPID_M_BASE + 16)    /* VT_UI4           */
  272. #define PROPID_M_ADMIN_QUEUE         (PROPID_M_BASE + 17)    /* VT_LPWSTR        */
  273. #define PROPID_M_ADMIN_QUEUE_LEN     (PROPID_M_BASE + 18)    /* VT_UI4           */
  274. #define PROPID_M_VERSION             (PROPID_M_BASE + 19)    /* VT_UI4           */
  275. #define PROPID_M_SENDERID            (PROPID_M_BASE + 20)    /* VT_UI1|VT_VECTOR */
  276. #define PROPID_M_SENDERID_LEN        (PROPID_M_BASE + 21)    /* VT_UI4           */
  277. #define PROPID_M_SENDERID_TYPE       (PROPID_M_BASE + 22)    /* VT_UI4           */
  278. #define PROPID_M_PRIV_LEVEL          (PROPID_M_BASE + 23)    /* VT_UI4           */
  279. #define PROPID_M_AUTH_LEVEL          (PROPID_M_BASE + 24)    /* VT_UI4           */
  280. #define PROPID_M_AUTHENTICATED       (PROPID_M_BASE + 25)    /* VT_UI1           */
  281. #define PROPID_M_HASH_ALG            (PROPID_M_BASE + 26)    /* VT_UI4           */
  282. #define PROPID_M_ENCRYPTION_ALG      (PROPID_M_BASE + 27)    /* VT_UI4           */
  283. #define PROPID_M_SENDER_CERT         (PROPID_M_BASE + 28)    /* VT_UI1|VT_VECTOR */
  284. #define PROPID_M_SENDER_CERT_LEN     (PROPID_M_BASE + 29)    /* VT_UI4           */
  285. #define PROPID_M_SRC_MACHINE_ID      (PROPID_M_BASE + 30)    /* VT_CLSID         */
  286. #define PROPID_M_SENTTIME            (PROPID_M_BASE + 31)    /* VT_UI4           */
  287. #define PROPID_M_ARRIVEDTIME         (PROPID_M_BASE + 32)    /* VT_UI4           */
  288. #define PROPID_M_DEST_QUEUE          (PROPID_M_BASE + 33)    /* VT_LPWSTR        */
  289. #define PROPID_M_DEST_QUEUE_LEN      (PROPID_M_BASE + 34)    /* VT_UI4           */
  290. #define PROPID_M_EXTENSION           (PROPID_M_BASE + 35)    /* VT_UI1|VT_VECTOR */
  291. #define PROPID_M_EXTENSION_LEN       (PROPID_M_BASE + 36)    /* VT_UI4           */
  292. #define PROPID_M_SECURITY_CONTEXT    (PROPID_M_BASE + 37)    /* VT_UI4           */
  293. #define PROPID_M_CONNECTOR_TYPE      (PROPID_M_BASE + 38)    /* VT_CLSID         */
  294. #define PROPID_M_XACT_STATUS_QUEUE   (PROPID_M_BASE + 39)    /* VT_LPWSTR        */
  295. #define PROPID_M_XACT_STATUS_QUEUE_LEN (PROPID_M_BASE + 40)  /* VT_UI4           */
  296. #define PROPID_M_TRACE               (PROPID_M_BASE + 41)    /* VT_UI1           */
  297. #define PROPID_M_BODY_TYPE           (PROPID_M_BASE + 42)    /* VT_UI4           */
  298. #define PROPID_M_DEST_SYMM_KEY       (PROPID_M_BASE + 43)    /* VT_UI1|VT_VECTOR */
  299. #define PROPID_M_DEST_SYMM_KEY_LEN   (PROPID_M_BASE + 44)    /* VT_UI4           */
  300. #define PROPID_M_SIGNATURE           (PROPID_M_BASE + 45)    /* VT_UI1|VT_VECTOR */
  301. #define PROPID_M_SIGNATURE_LEN       (PROPID_M_BASE + 46)    /* VT_UI4           */
  302. #define PROPID_M_PROV_TYPE           (PROPID_M_BASE + 47)    /* VT_UI4           */
  303. #define PROPID_M_PROV_NAME           (PROPID_M_BASE + 48)    /* VT_LPWSTR        */
  304. #define PROPID_M_PROV_NAME_LEN       (PROPID_M_BASE + 49)    /* VT_UI4           */
  305.  
  306.  
  307. //
  308. // Message Property Size
  309. //
  310. #define PROPID_M_MSGID_SIZE         20
  311. #define PROPID_M_CORRELATIONID_SIZE 20
  312.  
  313.  
  314. //********************************************************************
  315. //  MESSAGE CLASS VALUES
  316. //********************************************************************
  317. //
  318. //  Message Class Values are 16 bits layed out as follows:
  319. //
  320. //   1 1 1 1 1 1
  321. //   5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  322. //  +-+-+-----------+---------------+
  323. //  |S|R| Reserved  |  Class code   |
  324. //  +-+-+-----------+---------------+
  325. //
  326. //  where
  327. //
  328. //      S - is the severity flag
  329. //          0 - Normal Message/Positive Acknowledgment (ACK)
  330. //          1 - Negative Acknowledgment (NACK)
  331. //
  332. //      R - is the receive flag
  333. //          0 - Arrival ACK/NACK
  334. //          1 - Receive ACK/NACK
  335. //
  336. #define MQCLASS_CODE(s, r, code) ((USHORT)(((s) << 15) | ((r) << 14) | (code)))
  337. #define MQCLASS_NACK(c)     ((c) & 0x8000)
  338. #define MQCLASS_RECEIVE(c)  ((c) & 0x4000)
  339.  
  340. //
  341. //  Normal message
  342. //
  343. #define MQMSG_CLASS_NORMAL                      MQCLASS_CODE(0, 0, 0x00)
  344.  
  345. //
  346. //  Report message
  347. //
  348. #define MQMSG_CLASS_REPORT                      MQCLASS_CODE(0, 0, 0x01)
  349.  
  350. //
  351. //  Arrival acknowledgment. The message has reached the destination queue
  352. //
  353. #define MQMSG_CLASS_ACK_REACH_QUEUE             MQCLASS_CODE(0, 0, 0x02)
  354.  
  355. //
  356. //  Receive acknowledgment. The message has been received by the application
  357. //
  358. #define MQMSG_CLASS_ACK_RECEIVE                 MQCLASS_CODE(0, 1, 0x00)
  359.  
  360.  
  361. //-----------------------------------------------
  362. //
  363. //  Negative arrival acknowledgments
  364. //
  365.  
  366. //
  367. //  Destination queue can not be reached, the queue may have been deleted
  368. //
  369. #define MQMSG_CLASS_NACK_BAD_DST_Q              MQCLASS_CODE(1, 0, 0x00)
  370.  
  371. //
  372. //  The message was purged before reaching the destination queue
  373. //
  374. #define MQMSG_CLASS_NACK_PURGED                 MQCLASS_CODE(1, 0, 0x01)
  375.  
  376. //
  377. //  Time to reach queue has expired
  378. //
  379. #define MQMSG_CLASS_NACK_REACH_QUEUE_TIMEOUT    MQCLASS_CODE(1, 0, 0x02)
  380.  
  381. //
  382. //  The message has exceeded the queue quota
  383. //
  384. #define MQMSG_CLASS_NACK_Q_EXCEED_QUOTA         MQCLASS_CODE(1, 0, 0x03)
  385.  
  386. //
  387. //  The sender does not have send access rights on the queue.
  388. //
  389. #define MQMSG_CLASS_NACK_ACCESS_DENIED          MQCLASS_CODE(1, 0, 0x04)
  390.  
  391. //
  392. //  The message hop count exceeded
  393. //
  394. #define MQMSG_CLASS_NACK_HOP_COUNT_EXCEEDED     MQCLASS_CODE(1, 0, 0x05)
  395.  
  396. //
  397. //  The message signature is bad. The message could not be authenticated.
  398. //
  399. #define MQMSG_CLASS_NACK_BAD_SIGNATURE          MQCLASS_CODE(1, 0, 0x06)
  400.  
  401. //
  402. //  The message could not be decrypted.
  403. //
  404. #define MQMSG_CLASS_NACK_BAD_ENCRYPTION         MQCLASS_CODE(1, 0, 0x07)
  405.  
  406. //
  407. //  The message could not be encrypted for the destination.
  408. //
  409. #define MQMSG_CLASS_NACK_COULD_NOT_ENCRYPT      MQCLASS_CODE(1, 0, 0x08)
  410.  
  411. //
  412. //  The message was sent to a non-transactional queue within a transaction.
  413. //
  414. #define MQMSG_CLASS_NACK_NOT_TRANSACTIONAL_Q    MQCLASS_CODE(1, 0, 0x09)
  415.  
  416. //
  417. //  The message was sent to a transactional queue not within a transaction.
  418. //
  419. #define MQMSG_CLASS_NACK_NOT_TRANSACTIONAL_MSG  MQCLASS_CODE(1, 0, 0x0A)
  420.  
  421.  
  422. //-----------------------------------------------
  423. //
  424. //  Negative receive acknowledgments
  425. //
  426.  
  427. //
  428. //  The queue was deleted, after the message has arrived
  429. //
  430. #define MQMSG_CLASS_NACK_Q_DELETED              MQCLASS_CODE(1, 1, 0x00)
  431.  
  432. //
  433. //  The message was purged at the destination queue
  434. //
  435. #define MQMSG_CLASS_NACK_Q_PURGED               MQCLASS_CODE(1, 1, 0x01)
  436.  
  437. //
  438. //  Time to receive has expired, while the message is in the queue
  439. //
  440. #define MQMSG_CLASS_NACK_RECEIVE_TIMEOUT        MQCLASS_CODE(1, 1, 0x02)
  441.  
  442.  
  443. //------ PROPID_M_ACKNOWLEDGE ---------------
  444. #define MQMSG_ACKNOWLEDGMENT_NONE           0x00
  445.  
  446. #define MQMSG_ACKNOWLEDGMENT_POS_ARRIVAL    0x01
  447. #define MQMSG_ACKNOWLEDGMENT_POS_RECEIVE    0x02
  448. #define MQMSG_ACKNOWLEDGMENT_NEG_ARRIVAL    0x04
  449. #define MQMSG_ACKNOWLEDGMENT_NEG_RECEIVE    0x08
  450.  
  451. #define MQMSG_ACKNOWLEDGMENT_NACK_REACH_QUEUE ((UCHAR)( \
  452.             MQMSG_ACKNOWLEDGMENT_NEG_ARRIVAL ))
  453.  
  454. #define MQMSG_ACKNOWLEDGMENT_FULL_REACH_QUEUE ((UCHAR)( \
  455.             MQMSG_ACKNOWLEDGMENT_NEG_ARRIVAL |  \
  456.             MQMSG_ACKNOWLEDGMENT_POS_ARRIVAL ))
  457.  
  458. #define MQMSG_ACKNOWLEDGMENT_NACK_RECEIVE ((UCHAR)( \
  459.             MQMSG_ACKNOWLEDGMENT_NEG_ARRIVAL |  \
  460.             MQMSG_ACKNOWLEDGMENT_NEG_RECEIVE ))
  461.  
  462. #define MQMSG_ACKNOWLEDGMENT_FULL_RECEIVE ((UCHAR)( \
  463.             MQMSG_ACKNOWLEDGMENT_NEG_ARRIVAL |  \
  464.             MQMSG_ACKNOWLEDGMENT_NEG_RECEIVE |  \
  465.             MQMSG_ACKNOWLEDGMENT_POS_RECEIVE ))
  466.  
  467. //------ PROPID_M_DELIVERY ------------------
  468. #define MQMSG_DELIVERY_EXPRESS              0
  469. #define MQMSG_DELIVERY_RECOVERABLE          1
  470.  
  471. //----- PROPID_M_JOURNAL --------------------
  472. #define MQMSG_JOURNAL_NONE                  0
  473. #define MQMSG_DEADLETTER                    1
  474. #define MQMSG_JOURNAL                       2
  475.  
  476. //----- PROPID_M_TRACE ----------------------
  477. #define MQMSG_TRACE_NONE                    0
  478. #define MQMSG_SEND_ROUTE_TO_REPORT_QUEUE    1
  479.  
  480. //----- PROPID_M_SENDERID_TYPE --------------
  481. #define MQMSG_SENDERID_TYPE_NONE            0
  482. #define MQMSG_SENDERID_TYPE_SID             1
  483.  
  484. //----- PROPID_M_PRIV_LEVEL -----------------
  485. #define MQMSG_PRIV_LEVEL_NONE               0
  486. #define MQMSG_PRIV_LEVEL_BODY               1
  487.  
  488. //----- PROPID_M_AUTH_LEVEL -----------------
  489. #define MQMSG_AUTH_LEVEL_NONE               0
  490. #define MQMSG_AUTH_LEVEL_ALWAYS             1
  491.  
  492.  
  493. //********************************************************************
  494. //  QUEUE PROPERTIES
  495. //********************************************************************
  496. #define PROPID_Q_BASE           100
  497. #define PROPID_Q_INSTANCE       (PROPID_Q_BASE +  1)  /* VT_CLSID     */
  498. #define PROPID_Q_TYPE           (PROPID_Q_BASE +  2)  /* VT_CLSID     */
  499. #define PROPID_Q_PATHNAME       (PROPID_Q_BASE +  3)  /* VT_LPWSTR    */
  500. #define PROPID_Q_JOURNAL        (PROPID_Q_BASE +  4)  /* VT_UI1       */
  501. #define PROPID_Q_QUOTA          (PROPID_Q_BASE +  5)  /* VT_UI4       */
  502. #define PROPID_Q_BASEPRIORITY   (PROPID_Q_BASE +  6)  /* VT_I2        */
  503. #define PROPID_Q_JOURNAL_QUOTA  (PROPID_Q_BASE +  7)  /* VT_UI4       */
  504. #define PROPID_Q_LABEL          (PROPID_Q_BASE +  8)  /* VT_LPWSTR    */
  505. #define PROPID_Q_CREATE_TIME    (PROPID_Q_BASE +  9)  /* VT_I4        */
  506. #define PROPID_Q_MODIFY_TIME    (PROPID_Q_BASE + 10)  /* VT_I4        */
  507. #define PROPID_Q_AUTHENTICATE   (PROPID_Q_BASE + 11)  /* VT_UI1       */
  508. #define PROPID_Q_PRIV_LEVEL     (PROPID_Q_BASE + 12)  /* VT_UI4       */
  509. #define PROPID_Q_TRANSACTION    (PROPID_Q_BASE + 13)  /* VT_UI1       */
  510.  
  511. //----- PROPID_Q_JOURNAL ------------------
  512. #define MQ_JOURNAL_NONE     (unsigned char)0
  513. #define MQ_JOURNAL          (unsigned char)1
  514.  
  515. //----- PROPID_Q_TYPE ------------------
  516. //  {55EE8F32-CCE9-11cf-B108-0020AFD61CE9}
  517. #define MQ_QTYPE_REPORT {0x55ee8f32, 0xcce9, 0x11cf, \
  518.                         {0xb1, 0x8, 0x0, 0x20, 0xaf, 0xd6, 0x1c, 0xe9}}
  519.  
  520. //  {55EE8F33-CCE9-11cf-B108-0020AFD61CE9}
  521. #define MQ_QTYPE_TEST   {0x55ee8f33, 0xcce9, 0x11cf, \
  522.                         {0xb1, 0x8, 0x0, 0x20, 0xaf, 0xd6, 0x1c, 0xe9}}
  523.  
  524. //----- PROPID_Q_TRANSACTION ------------------
  525. #define MQ_TRANSACTIONAL_NONE     (unsigned char)0
  526. #define MQ_TRANSACTIONAL          (unsigned char)1
  527.  
  528. //----- PROPID_Q_AUTHENTICATE ------------------
  529. #define MQ_AUTHENTICATE_NONE      (unsigned char)0
  530. #define MQ_AUTHENTICATE           (unsigned char)1
  531.  
  532. //----- PROPID_Q_PRIV_LEVEL ------------------
  533. #define MQ_PRIV_LEVEL_NONE        (unsigned long)0
  534. #define MQ_PRIV_LEVEL_OPTIONAL    (unsigned long)1
  535. #define MQ_PRIV_LEVEL_BODY        (unsigned long)2
  536.  
  537.  
  538. //********************************************************************
  539. //  MACHINE PROPERTIES
  540. //********************************************************************
  541. #define PROPID_QM_BASE 200
  542.  
  543. #define PROPID_QM_SITE_ID       (PROPID_QM_BASE + 1)  /* VT_CLSID            */
  544. #define PROPID_QM_MACHINE_ID    (PROPID_QM_BASE + 2)  /* VT_CLSID            */
  545. #define PROPID_QM_PATHNAME      (PROPID_QM_BASE + 3)  /* VT_LPWSTR           */
  546. #define PROPID_QM_CONNECTION    (PROPID_QM_BASE + 4)  /* VT_LPWSTR|VT_VECTOR */
  547. #define PROPID_QM_ENCRYPTION_PK (PROPID_QM_BASE + 5)  /* VT_BLOB             */
  548.  
  549. //
  550. // LONG_LIVED is the default for PROPID_M_TIME_TO_REACH_QUEUE. If call
  551. // to MQSendMessage() specify this value, or not give this property at
  552. // all, then the actual timeout is taken from MQIS database.
  553. //
  554. #define LONG_LIVED    0xfffffffe
  555.  
  556. //
  557. // Success
  558. //
  559. #define MQ_OK                       0L
  560.  
  561.  
  562. #ifndef FACILITY_MSMQ
  563. #define FACILITY_MSMQ               0x0E
  564. #endif
  565.  
  566.  
  567. //
  568. //  Error
  569. //
  570.  
  571. //
  572. //  Values are 32 bit values layed out as follows:
  573. //
  574. //   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  575. //   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  576. //  +---+-+-+-----------------------+-------------------------------+
  577. //  |Sev|C|R|     Facility          |               Code            |
  578. //  +---+-+-+-----------------------+-------------------------------+
  579. //
  580. //  where
  581. //
  582. //      Sev - is the severity code
  583. //
  584. //          00 - Success
  585. //          01 - Informational
  586. //          10 - Warning
  587. //          11 - Error
  588. //
  589. //      C - is the Customer code flag
  590. //
  591. //      R - is a reserved bit
  592. //
  593. //      Facility - is the facility code
  594. //
  595. //      Code - is the facility's status code
  596. //
  597. //
  598. // Define the facility codes
  599. //
  600.  
  601.  
  602. //
  603. // Define the severity codes
  604. //
  605.  
  606.  
  607. //
  608. // MessageId: MQ_ERROR
  609. //
  610. // MessageText:
  611. //
  612. //  GenericError
  613. //
  614. #define MQ_ERROR                         0xC00E0001L
  615.  
  616. //
  617. // MessageId: MQ_ERROR_PROPERTY
  618. //
  619. // MessageText:
  620. //
  621. //  One or more of the passed properties are invalid.
  622. //
  623. #define MQ_ERROR_PROPERTY                0xC00E0002L
  624.  
  625. //
  626. // MessageId: MQ_ERROR_QUEUE_NOT_FOUND
  627. //
  628. // MessageText:
  629. //
  630. //  The queue is not registered in the DS
  631. //
  632. #define MQ_ERROR_QUEUE_NOT_FOUND         0xC00E0003L
  633.  
  634. //
  635. // MessageId: MQ_ERROR_QUEUE_EXISTS
  636. //
  637. // MessageText:
  638. //
  639. //  A queue with the same pathname is already registered
  640. //
  641. #define MQ_ERROR_QUEUE_EXISTS            0xC00E0005L
  642.  
  643. //
  644. // MessageId: MQ_ERROR_INVALID_PARAMETER
  645. //
  646. // MessageText:
  647. //
  648. //  An invalid parameter passed to a function.
  649. //
  650. #define MQ_ERROR_INVALID_PARAMETER       0xC00E0006L
  651.  
  652. //
  653. // MessageId: MQ_ERROR_INVALID_HANDLE
  654. //
  655. // MessageText:
  656. //
  657. //  An invalid handle passed to a function.
  658. //
  659. #define MQ_ERROR_INVALID_HANDLE          0xC00E0007L
  660.  
  661. //
  662. // MessageId: MQ_ERROR_OPERATION_CANCELLED
  663. //
  664. // MessageText:
  665. //
  666. //  The operation was cancelled before it could be completed.
  667. //
  668. #define MQ_ERROR_OPERATION_CANCELLED     0xC00E0008L
  669.  
  670. //
  671. // MessageId: MQ_ERROR_SHARING_VIOLATION
  672. //
  673. // MessageText:
  674. //
  675. //  Sharing violation. The queue is already opened for exclusive receive.
  676. //
  677. #define MQ_ERROR_SHARING_VIOLATION       0xC00E0009L
  678.  
  679. //
  680. // MessageId: MQ_ERROR_SERVICE_NOT_AVAILABLE
  681. //
  682. // MessageText:
  683. //
  684. //  The Message Queues service is not available
  685. //
  686. #define MQ_ERROR_SERVICE_NOT_AVAILABLE   0xC00E000BL
  687.  
  688. //
  689. // MessageId: MQ_ERROR_MACHINE_NOT_FOUND
  690. //
  691. // MessageText:
  692. //
  693. //  The specified machine could not be found.
  694. //
  695. #define MQ_ERROR_MACHINE_NOT_FOUND       0xC00E000DL
  696.  
  697. //
  698. // MessageId: MQ_ERROR_ILLEGAL_SORT
  699. //
  700. // MessageText:
  701. //
  702. //  Illegal sort specified in MQLocateBegin (e.g., duplicate columns).
  703. //
  704. #define MQ_ERROR_ILLEGAL_SORT            0xC00E0010L
  705.  
  706. //
  707. // MessageId: MQ_ERROR_ILLEGAL_USER
  708. //
  709. // MessageText:
  710. //
  711. //  The user is an illegal user.
  712. //
  713. #define MQ_ERROR_ILLEGAL_USER            0xC00E0011L
  714.  
  715. //
  716. // MessageId: MQ_ERROR_NO_DS
  717. //
  718. // MessageText:
  719. //
  720. //  No connection with this site's controller(s).
  721. //
  722. #define MQ_ERROR_NO_DS                   0xC00E0013L
  723.  
  724. //
  725. // MessageId: MQ_ERROR_ILLEGAL_QUEUE_PATHNAME
  726. //
  727. // MessageText:
  728. //
  729. //  Illegal queue path name.
  730. //
  731. #define MQ_ERROR_ILLEGAL_QUEUE_PATHNAME  0xC00E0014L
  732.  
  733. //
  734. // MessageId: MQ_ERROR_ILLEGAL_PROPERTY_VALUE
  735. //
  736. // MessageText:
  737. //
  738. //  Illegal property value.
  739. //
  740. #define MQ_ERROR_ILLEGAL_PROPERTY_VALUE  0xC00E0018L
  741.  
  742. //
  743. // MessageId: MQ_ERROR_ILLEGAL_PROPERTY_VT
  744. //
  745. // MessageText:
  746. //
  747. //  Invalid VARTYPE value.
  748. //
  749. #define MQ_ERROR_ILLEGAL_PROPERTY_VT     0xC00E0019L
  750.  
  751. //
  752. // MessageId: MQ_ERROR_BUFFER_OVERFLOW
  753. //
  754. // MessageText:
  755. //
  756. //  The buffer supplied to MQReceiveMessage for message body retrieval
  757. //  was too small. The message is not removed from the queue and part
  758. //  of the message body that fits in the buffer was copied.
  759. //
  760. #define MQ_ERROR_BUFFER_OVERFLOW         0xC00E001AL
  761.  
  762. //
  763. // MessageId: MQ_ERROR_IO_TIMEOUT
  764. //
  765. // MessageText:
  766. //
  767. //  The MQReceiveMessage timeout has expired
  768. //
  769. #define MQ_ERROR_IO_TIMEOUT              0xC00E001BL
  770.  
  771. //
  772. // MessageId: MQ_ERROR_ILLEGAL_CURSOR_ACTION
  773. //
  774. // MessageText:
  775. //
  776. //  MQ_ACTION_PEEK_NEXT specified to MQReceiveMessage can not be used with
  777. //  the current cursor position.
  778. //
  779. #define MQ_ERROR_ILLEGAL_CURSOR_ACTION   0xC00E001CL
  780.  
  781. //
  782. // MessageId: MQ_ERROR_MESSAGE_ALREADY_RECEIVED
  783. //
  784. // MessageText:
  785. //
  786. //  A message that is currently pointed at by the cursor has been removed from
  787. //  the queue by another process or by another call to MQReceiveMessage
  788. //  without the use of this cursor.
  789. //
  790. #define MQ_ERROR_MESSAGE_ALREADY_RECEIVED 0xC00E001DL
  791.  
  792. //
  793. // MessageId: MQ_ERROR_ILLEGAL_FORMATNAME
  794. //
  795. // MessageText:
  796. //
  797. //  The given format name is invalid.
  798. //
  799. #define MQ_ERROR_ILLEGAL_FORMATNAME      0xC00E001EL
  800.  
  801. //
  802. // MessageId: MQ_ERROR_FORMATNAME_BUFFER_TOO_SMALL
  803. //
  804. // MessageText:
  805. //
  806. //  The format name buffer supplied to the API was too small
  807. //  to fit the format name
  808. //
  809. #define MQ_ERROR_FORMATNAME_BUFFER_TOO_SMALL 0xC00E001FL
  810.  
  811. //
  812. // MessageId: MQ_ERROR_UNSUPPORTED_FORMATNAME_OPERATION
  813. //
  814. // MessageText:
  815. //
  816. //  The requested operation for the specified format name is not
  817. //  supported (e.g., delete a direct queue format name).
  818. //
  819. #define MQ_ERROR_UNSUPPORTED_FORMATNAME_OPERATION 0xC00E0020L
  820.  
  821. //
  822. // MessageId: MQ_ERROR_ILLEGAL_SECURITY_DESCRIPTOR
  823. //
  824. // MessageText:
  825. //
  826. //  The specified security descriptor is not a valid security descriptor.
  827. //
  828. #define MQ_ERROR_ILLEGAL_SECURITY_DESCRIPTOR 0xC00E0021L
  829.  
  830. //
  831. // MessageId: MQ_ERROR_SENDERID_BUFFER_TOO_SMALL
  832. //
  833. // MessageText:
  834. //
  835. //  The passed buffer for the user ID property is too small.
  836. //
  837. #define MQ_ERROR_SENDERID_BUFFER_TOO_SMALL 0xC00E0022L
  838.  
  839. //
  840. // MessageId: MQ_ERROR_SECURITY_DESCRIPTOR_TOO_SMALL
  841. //
  842. // MessageText:
  843. //
  844. //  The size of the buffer passed to MQGetQueueSecurity is too small.
  845. //
  846. #define MQ_ERROR_SECURITY_DESCRIPTOR_TOO_SMALL 0xC00E0023L
  847.  
  848. //
  849. // MessageId: MQ_ERROR_CANNOT_IMPERSONATE_CLIENT
  850. //
  851. // MessageText:
  852. //
  853. //  The RPC server can not impersonate the client application, hence security
  854. //  credentials could not be verified.
  855. //
  856. #define MQ_ERROR_CANNOT_IMPERSONATE_CLIENT 0xC00E0024L
  857.  
  858. //
  859. // MessageId: MQ_ERROR_ACCESS_DENIED
  860. //
  861. // MessageText:
  862. //
  863. //  Access is denied.
  864. //
  865. #define MQ_ERROR_ACCESS_DENIED           0xC00E0025L
  866.  
  867. //
  868. // MessageId: MQ_ERROR_PRIVILEGE_NOT_HELD
  869. //
  870. // MessageText:
  871. //
  872. //  Client does not have the required privileges to perform the operation.
  873. //
  874. #define MQ_ERROR_PRIVILEGE_NOT_HELD      0xC00E0026L
  875.  
  876. //
  877. // MessageId: MQ_ERROR_INSUFFICIENT_RESOURCES
  878. //
  879. // MessageText:
  880. //
  881. //  Insufficient resources to perform operation.
  882. //
  883. #define MQ_ERROR_INSUFFICIENT_RESOURCES  0xC00E0027L
  884.  
  885. //
  886. // MessageId: MQ_ERROR_USER_BUFFER_TOO_SMALL
  887. //
  888. // MessageText:
  889. //
  890. //  Request failed because user buffer is too small to hold the returned information
  891. //
  892. #define MQ_ERROR_USER_BUFFER_TOO_SMALL   0xC00E0028L
  893.  
  894. //
  895. // MessageId: MQ_ERROR_MESSAGE_STORAGE_FAILED
  896. //
  897. // MessageText:
  898. //
  899. //  Could not store a recoverable or journal message. Message was not sent
  900. //
  901. #define MQ_ERROR_MESSAGE_STORAGE_FAILED  0xC00E002AL
  902.  
  903. //
  904. // MessageId: MQ_ERROR_SENDER_CERT_BUFFER_TOO_SMALL
  905. //
  906. // MessageText:
  907. //
  908. //  The passed buffer for the user certificate property is too small.
  909. //
  910. #define MQ_ERROR_SENDER_CERT_BUFFER_TOO_SMALL 0xC00E002BL
  911.  
  912. //
  913. // MessageId: MQ_ERROR_INVALID_CERTIFICATE
  914. //
  915. // MessageText:
  916. //
  917. //  The user certificate is not valid.
  918. //
  919. #define MQ_ERROR_INVALID_CERTIFICATE     0xC00E002CL
  920.  
  921. //
  922. // MessageId: MQ_ERROR_CORRUPTED_INTERNAL_CERTIFICATE
  923. //
  924. // MessageText:
  925. //
  926. //  The internal MSMQ certificate is corrupted.
  927. //
  928. #define MQ_ERROR_CORRUPTED_INTERNAL_CERTIFICATE 0xC00E002DL
  929.  
  930.  
  931. //
  932. // MessageId: MQ_ERROR_NO_INTERNAL_USER_CERT
  933. //
  934. // MessageText:
  935. //
  936. //  The internal MSMQ certificate for the user does not exist.
  937. //
  938. #define MQ_ERROR_NO_INTERNAL_USER_CERT   0xC00E002FL
  939.  
  940. //
  941. // MessageId: MQ_ERROR_CORRUPTED_SECURITY_DATA
  942. //
  943. // MessageText:
  944. //
  945. //  A cryptogrphic function has failed.
  946. //
  947. #define MQ_ERROR_CORRUPTED_SECURITY_DATA 0xC00E0030L
  948.  
  949. //
  950. // MessageId: MQ_ERROR_CORRUPTED_PERSONAL_CERT_STORE
  951. //
  952. // MessageText:
  953. //
  954. //  The personal certificate store is corrupted.
  955. //
  956. #define MQ_ERROR_CORRUPTED_PERSONAL_CERT_STORE 0xC00E0031L
  957.  
  958. //
  959. // MessageId: MQ_ERROR_COMPUTER_DOES_NOT_SUPPORT_ENCRYPTION
  960. //
  961. // MessageText:
  962. //
  963. //  The computer does not support encryption operations.
  964. //
  965. #define MQ_ERROR_COMPUTER_DOES_NOT_SUPPORT_ENCRYPTION 0xC00E0033L
  966.  
  967. //
  968. // MessageId: MQ_ERROR_BAD_SECURITY_CONTEXT
  969. //
  970. // MessageText:
  971. //
  972. //  Bad security context.
  973. //
  974. #define MQ_ERROR_BAD_SECURITY_CONTEXT    0xC00E0035L
  975.  
  976. //
  977. // MessageId: MQ_ERROR_COULD_NOT_GET_USER_SID
  978. //
  979. // MessageText:
  980. //
  981. //  Could not get the SID information out of the thread token.
  982. //
  983. #define MQ_ERROR_COULD_NOT_GET_USER_SID  0xC00E0036L
  984.  
  985. //
  986. // MessageId: MQ_ERROR_COULD_NOT_GET_ACCOUNT_INFO
  987. //
  988. // MessageText:
  989. //
  990. //  Could not get the account information for the user.
  991. //
  992. #define MQ_ERROR_COULD_NOT_GET_ACCOUNT_INFO 0xC00E0037L
  993.  
  994. //
  995. // MessageId: MQ_ERROR_ILLEGAL_MQCOLUMNS
  996. //
  997. // MessageText:
  998. //
  999. //  Invalid MQCOLUMNS parameter
  1000. //
  1001. #define MQ_ERROR_ILLEGAL_MQCOLUMNS       0xC00E0038L
  1002.  
  1003. //
  1004. // MessageId: MQ_ERROR_ILLEGAL_PROPID
  1005. //
  1006. // MessageText:
  1007. //
  1008. //  Invalid propid value
  1009. //
  1010. #define MQ_ERROR_ILLEGAL_PROPID          0xC00E0039L
  1011.  
  1012. //
  1013. // MessageId: MQ_ERROR_ILLEGAL_RELATION
  1014. //
  1015. // MessageText:
  1016. //
  1017. //  Invalid relation value in restriction
  1018. //
  1019. #define MQ_ERROR_ILLEGAL_RELATION        0xC00E003AL
  1020.  
  1021. //
  1022. // MessageId: MQ_ERROR_ILLEGAL_PROPERTY_SIZE
  1023. //
  1024. // MessageText:
  1025. //
  1026. //  Illegal property buffer size
  1027. //
  1028. #define MQ_ERROR_ILLEGAL_PROPERTY_SIZE   0xC00E003BL
  1029.  
  1030. //
  1031. // MessageId: MQ_ERROR_ILLEGAL_RESTRICTION_PROPID
  1032. //
  1033. // MessageText:
  1034. //
  1035. //  Invalid propid value in MQRESTRICTION parameter
  1036. //
  1037. #define MQ_ERROR_ILLEGAL_RESTRICTION_PROPID 0xC00E003CL
  1038.  
  1039. //
  1040. // MessageId: MQ_ERROR_ILLEGAL_MQQUEUEPROPS
  1041. //
  1042. // MessageText:
  1043. //
  1044. //  Illegal MQQUEUEPROPS parameter, either null or with zero properties
  1045. //
  1046. #define MQ_ERROR_ILLEGAL_MQQUEUEPROPS    0xC00E003DL
  1047.  
  1048. //
  1049. // MessageId: MQ_ERROR_PROPERTY_NOTALLOWED
  1050. //
  1051. // MessageText:
  1052. //
  1053. //  Invalid propid for the requested operation (e.g. PROPID_Q_INSTANCE
  1054. //  in MQSetQueueProperties)
  1055. //
  1056. #define MQ_ERROR_PROPERTY_NOTALLOWED     0xC00E003EL
  1057.  
  1058. //
  1059. // MessageId: MQ_ERROR_INSUFFICIENT_PROPERTIES
  1060. //
  1061. // MessageText:
  1062. //
  1063. //  Not all the required properties for the operation were specified
  1064. //  in the input parameters
  1065. //
  1066. #define MQ_ERROR_INSUFFICIENT_PROPERTIES 0xC00E003FL
  1067.  
  1068. //
  1069. // MessageId: MQ_ERROR_MACHINE_EXISTS
  1070. //
  1071. // MessageText:
  1072. //
  1073. //  Computer with the same name already exists in the site.
  1074. //
  1075. #define MQ_ERROR_MACHINE_EXISTS          0xC00E0040L
  1076.  
  1077. //
  1078. // MessageId: MQ_ERROR_ILLEGAL_MQQMPROPS
  1079. //
  1080. // MessageText:
  1081. //
  1082. //  Illegal MQQMPROPS parameter, either null or with zero properties
  1083. //
  1084. #define MQ_ERROR_ILLEGAL_MQQMPROPS       0xC00E0041L
  1085.  
  1086. //
  1087. // MessageId: MQ_ERROR_DS_IS_FULL
  1088. //
  1089. // MessageText:
  1090. //
  1091. //  DS is full
  1092. //
  1093. #define MQ_ERROR_DS_IS_FULL              0xC00E0042L
  1094.  
  1095. //
  1096. // MessageId: MQ_ERROR_DS_ERROR
  1097. //
  1098. // MessageText:
  1099. //
  1100. //  Internal DS error.
  1101. //
  1102. #define MQ_ERROR_DS_ERROR                0xC00E0043L
  1103.  
  1104. //
  1105. // MessageId: MQ_ERROR_INVALID_OWNER
  1106. //
  1107. // MessageText:
  1108. //
  1109. //  Invalid object owner. For example MQCreateQueue failed because the QM
  1110. //  object is invalid
  1111. //
  1112. #define MQ_ERROR_INVALID_OWNER           0xC00E0044L
  1113.  
  1114. //
  1115. // MessageId: MQ_ERROR_UNSUPPORTED_ACCESS_MODE
  1116. //
  1117. // MessageText:
  1118. //
  1119. //  The specified access mode is not supported.
  1120. //
  1121. #define MQ_ERROR_UNSUPPORTED_ACCESS_MODE 0xC00E0045L
  1122.  
  1123. //
  1124. // MessageId: MQ_ERROR_RESULT_BUFFER_TOO_SMALL
  1125. //
  1126. // MessageText:
  1127. //
  1128. //  The supplied result buffer is too small
  1129. //
  1130. #define MQ_ERROR_RESULT_BUFFER_TOO_SMALL 0xC00E0046L
  1131.  
  1132. //
  1133. // MessageId: MQ_ERROR_DELETE_CN_IN_USE
  1134. //
  1135. // MessageText:
  1136. //
  1137. //  The Connected Network can not be deleted, it is in use.
  1138. //
  1139. #define MQ_ERROR_DELETE_CN_IN_USE        0xC00E0048L
  1140.  
  1141. //
  1142. // MessageId: MQ_ERROR_NO_RESPONSE_FROM_OBJECT_SERVER
  1143. //
  1144. // MessageText:
  1145. //
  1146. //  No response from object owner.
  1147. //
  1148. #define MQ_ERROR_NO_RESPONSE_FROM_OBJECT_SERVER 0xC00E0049L
  1149.  
  1150. //
  1151. // MessageId: MQ_ERROR_OBJECT_SERVER_NOT_AVAILABLE
  1152. //
  1153. // MessageText:
  1154. //
  1155. //  Object owner is not reachable.
  1156. //
  1157. #define MQ_ERROR_OBJECT_SERVER_NOT_AVAILABLE 0xC00E004AL
  1158.  
  1159. //
  1160. // MessageId: MQ_ERROR_QUEUE_NOT_AVAILABLE
  1161. //
  1162. // MessageText:
  1163. //
  1164. //  Error while reading from a queue residing on a remote computer
  1165. //
  1166. #define MQ_ERROR_QUEUE_NOT_AVAILABLE     0xC00E004BL
  1167.  
  1168. //
  1169. // MessageId: MQ_ERROR_DTC_CONNECT
  1170. //
  1171. // MessageText:
  1172. //
  1173. //  Cannot connect to MS DTC
  1174. //
  1175. #define MQ_ERROR_DTC_CONNECT             0xC00E004CL
  1176.  
  1177. //
  1178. // MessageId: MQ_ERROR_TRANSACTION_IMPORT
  1179. //
  1180. // MessageText:
  1181. //
  1182. //  Cannot import the transaction
  1183. //
  1184. #define MQ_ERROR_TRANSACTION_IMPORT      0xC00E004EL
  1185.  
  1186. //
  1187. // MessageId: MQ_ERROR_TRANSACTION_USAGE
  1188. //
  1189. // MessageText:
  1190. //
  1191. //  Wrong transaction usage
  1192. //
  1193. #define MQ_ERROR_TRANSACTION_USAGE       0xC00E0050L
  1194.  
  1195. //
  1196. // MessageId: MQ_ERROR_TRANSACTION_SEQUENCE
  1197. //
  1198. // MessageText:
  1199. //
  1200. //  Wrong transaction operations sequence
  1201. //
  1202. #define MQ_ERROR_TRANSACTION_SEQUENCE    0xC00E0051L
  1203.  
  1204. //
  1205. // MessageId: MQ_ERROR_MISSING_CONNECTOR_TYPE
  1206. //
  1207. // MessageText:
  1208. //
  1209. //  Connector Type is mandatory when sending Acknowledgment or secure message
  1210. //
  1211. #define MQ_ERROR_MISSING_CONNECTOR_TYPE  0xC00E0055L
  1212.  
  1213. //
  1214. // MessageId: MQ_ERROR_STALE_HANDLE
  1215. //
  1216. // MessageText:
  1217. //
  1218. //  The Queue manager service has been restarted. The queue handle
  1219. //  is stale, and should be closed.
  1220. //
  1221. #define MQ_ERROR_STALE_HANDLE            0xC00E0056L
  1222.  
  1223. //
  1224. // MessageId: MQ_ERROR_TRANSACTION_ENLIST
  1225. //
  1226. // MessageText:
  1227. //
  1228. //  Cannot enlist the transaction
  1229. //
  1230. #define MQ_ERROR_TRANSACTION_ENLIST      0xC00E0058L
  1231.  
  1232. //
  1233. // MessageId: MQ_ERROR_QUEUE_DELETED
  1234. //
  1235. // MessageText:
  1236. //
  1237. //  The queue was deleted. Messages can not be received anymore using this
  1238. //  queue handle. The handle should be closed
  1239. //
  1240. #define MQ_ERROR_QUEUE_DELETED           0xC00E005AL
  1241.  
  1242. //
  1243. // MessageId: MQ_ERROR_ILLEGAL_CONTEXT
  1244. //
  1245. // MessageText:
  1246. //
  1247. //  Invalid context parameter (MQLocateBegin).
  1248. //
  1249. #define MQ_ERROR_ILLEGAL_CONTEXT         0xC00E005BL
  1250.  
  1251. //
  1252. // MessageId: MQ_ERROR_ILLEGAL_SORT_PROPID
  1253. //
  1254. // MessageText:
  1255. //
  1256. //  Invalid propid value in MQSORTSET
  1257. //
  1258. #define MQ_ERROR_ILLEGAL_SORT_PROPID     0xC00E005CL
  1259.  
  1260. //
  1261. // MessageId: MQ_ERROR_LABEL_TOO_LONG
  1262. //
  1263. // MessageText:
  1264. //
  1265. //  The passed label is too long. It should be less or equal to MQ_MAX_MSG_LABEL_LEN
  1266. //
  1267. #define MQ_ERROR_LABEL_TOO_LONG          0xC00E005DL
  1268.  
  1269. //
  1270. // MessageId: MQ_ERROR_LABEL_BUFFER_TOO_SMALL
  1271. //
  1272. // MessageText:
  1273. //
  1274. //  The label buffer supplied to the API was too small
  1275. //
  1276. #define MQ_ERROR_LABEL_BUFFER_TOO_SMALL  0xC00E005EL
  1277.  
  1278. //
  1279. // MessageId: MQ_ERROR_MQIS_SERVER_EMPTY
  1280. //
  1281. // MessageText:
  1282. //
  1283. //  The list of MQIS servers (in registry) is empty.
  1284. //
  1285. #define MQ_ERROR_MQIS_SERVER_EMPTY       0xC00E005FL
  1286.  
  1287. //
  1288. // MessageId: MQ_ERROR_MQIS_READONLY_MODE
  1289. //
  1290. // MessageText:
  1291. //
  1292. //  MQIS database is in read-only mode.
  1293. //
  1294. #define MQ_ERROR_MQIS_READONLY_MODE      0xC00E0060L
  1295.  
  1296. //
  1297. // MessageId: MQ_ERROR_SYMM_KEY_BUFFER_TOO_SMALL
  1298. //
  1299. // MessageText:
  1300. //
  1301. //  The passed buffer for the Symmetric key property is too small.
  1302. //
  1303. #define MQ_ERROR_SYMM_KEY_BUFFER_TOO_SMALL 0xC00E0061L
  1304.  
  1305. //
  1306. // MessageId: MQ_ERROR_SIGNATURE_BUFFER_TOO_SMALL
  1307. //
  1308. // MessageText:
  1309. //
  1310. //  The passed buffer for the Signature property is too small.
  1311. //
  1312. #define MQ_ERROR_SIGNATURE_BUFFER_TOO_SMALL 0xC00E0062L
  1313.  
  1314. //
  1315. // MessageId: MQ_ERROR_PROV_NAME_BUFFER_TOO_SMALL
  1316. //
  1317. // MessageText:
  1318. //
  1319. //  The passed buffer for the Provider name property is too small.
  1320. //
  1321. #define MQ_ERROR_PROV_NAME_BUFFER_TOO_SMALL 0xC00E0063L
  1322.  
  1323. //
  1324. // MessageId: MQ_ERROR_ILLEGAL_OPERATION
  1325. //
  1326. // MessageText:
  1327. //
  1328. //  The operation is illegal on foreign message queuing system
  1329. //
  1330. #define MQ_ERROR_ILLEGAL_OPERATION       0xC00E0064L
  1331.  
  1332. //
  1333. // MessageId: MQ_ERROR_WRITE_NOT_ALLOWED
  1334. //
  1335. // MessageText:
  1336. //
  1337. //  Another MQIS server is being installed, write operations to the
  1338. //  database are not allowed at this stage.
  1339. //
  1340. #define MQ_ERROR_WRITE_NOT_ALLOWED       0xC00E0065L
  1341.  
  1342. //
  1343. // MessageId: MQ_ERROR_WKS_CANT_SERVE_CLIENT
  1344. //
  1345. // MessageText:
  1346. //
  1347. //  MSMQ independent clients cannot serve MSMQ dependent clients.
  1348. //
  1349. #define MQ_ERROR_WKS_CANT_SERVE_CLIENT   0xC00E0066L
  1350.  
  1351. //
  1352. //
  1353. // MessageId: MQ_ERROR_DEPEND_WKS_LICENSE_OVERFLOW
  1354. //
  1355. // MessageText:
  1356. //
  1357. //  The number of dependent clients served by this MSMQ server reached
  1358. //  its upper limit.
  1359. //
  1360. #define MQ_ERROR_DEPEND_WKS_LICENSE_OVERFLOW 0xC00E0067L
  1361.  
  1362. //
  1363. //
  1364. // MessageId: MQ_CORRUPTED_QUEUE_WAS_DELETED
  1365. //
  1366. // MessageText:
  1367. //
  1368. //  Ini file for queue %1 in LQS was deleted because it was corrupted.
  1369. //
  1370. #define MQ_CORRUPTED_QUEUE_WAS_DELETED   0xC00E0068L
  1371.  
  1372. //
  1373. //
  1374. // MessageId: MQ_ERROR_REMOTE_MACHINE_NOT_AVAILABLE
  1375. //
  1376. // MessageText:
  1377. //
  1378. //  The remote machine is not available.
  1379. //
  1380. #define MQ_ERROR_REMOTE_MACHINE_NOT_AVAILABLE 0xC00E0069L
  1381.  
  1382. //
  1383. // Informational
  1384. //
  1385. //
  1386. // MessageId: MQ_INFORMATION_PROPERTY
  1387. //
  1388. // MessageText:
  1389. //
  1390. //  One or more of the passed properties resulted in warning but the
  1391. //  function completed.
  1392. //
  1393. #define MQ_INFORMATION_PROPERTY          0x400E0001L
  1394.  
  1395. //
  1396. // MessageId: MQ_INFORMATION_ILLEGAL_PROPERTY
  1397. //
  1398. // MessageText:
  1399. //
  1400. //  Invalid property id.
  1401. //
  1402. #define MQ_INFORMATION_ILLEGAL_PROPERTY  0x400E0002L
  1403.  
  1404. //
  1405. // MessageId: MQ_INFORMATION_PROPERTY_IGNORED
  1406. //
  1407. // MessageText:
  1408. //
  1409. //  The specified property is ignored in this operation
  1410. //  (e.g., PROPID_M_SENDERID in SendMessage().
  1411. //
  1412. #define MQ_INFORMATION_PROPERTY_IGNORED  0x400E0003L
  1413.  
  1414. //
  1415. // MessageId: MQ_INFORMATION_UNSUPPORTED_PROPERTY
  1416. //
  1417. // MessageText:
  1418. //
  1419. //  The specified property is not supported and is ignored in this operation
  1420. //
  1421. #define MQ_INFORMATION_UNSUPPORTED_PROPERTY 0x400E0004L
  1422.  
  1423. //
  1424. // MessageId: MQ_INFORMATION_DUPLICATE_PROPERTY
  1425. //
  1426. // MessageText:
  1427. //
  1428. //  The specified property already appeared in the propid array, and is
  1429. //  ignored in this operation
  1430. //
  1431. #define MQ_INFORMATION_DUPLICATE_PROPERTY 0x400E0005L
  1432.  
  1433. //
  1434. // MessageId: MQ_INFORMATION_OPERATION_PENDING
  1435. //
  1436. // MessageText:
  1437. //
  1438. //  Asynchronous operation is currently pending.
  1439. //
  1440. #define MQ_INFORMATION_OPERATION_PENDING 0x400E0006L
  1441.  
  1442. //
  1443. // MessageId: MQ_INFORMATION_FORMATNAME_BUFFER_TOO_SMALL
  1444. //
  1445. // MessageText:
  1446. //
  1447. //  The format name buffer supplied to MQCreateQueue was too small
  1448. //  to fit the format name. Queue was created successfully
  1449. //
  1450. #define MQ_INFORMATION_FORMATNAME_BUFFER_TOO_SMALL 0x400E0009L
  1451.  
  1452.  
  1453.  
  1454. //********************************************************************
  1455. //  SECURITY FLAGS
  1456. //********************************************************************
  1457. #define MQSEC_DELETE_MESSAGE                0x1
  1458. #define MQSEC_PEEK_MESSAGE                  0x2
  1459. #define MQSEC_WRITE_MESSAGE                 0x4
  1460. #define MQSEC_DELETE_JOURNAL_MESSAGE        0x8
  1461. #define MQSEC_SET_QUEUE_PROPERTIES          0x10
  1462. #define MQSEC_GET_QUEUE_PROPERTIES          0x20
  1463. #define MQSEC_DELETE_QUEUE                  DELETE
  1464. #define MQSEC_GET_QUEUE_PERMISSIONS         READ_CONTROL
  1465. #define MQSEC_CHANGE_QUEUE_PERMISSIONS      WRITE_DAC
  1466. #define MQSEC_TAKE_QUEUE_OWNERSHIP          WRITE_OWNER
  1467.  
  1468. #define MQSEC_RECEIVE_MESSAGE               (MQSEC_DELETE_MESSAGE | \
  1469.                                              MQSEC_PEEK_MESSAGE)
  1470.  
  1471. #define MQSEC_RECEIVE_JOURNAL_MESSAGE       (MQSEC_DELETE_JOURNAL_MESSAGE | \
  1472.                                              MQSEC_PEEK_MESSAGE)
  1473.  
  1474. #define MQSEC_QUEUE_GENERIC_READ            (MQSEC_GET_QUEUE_PROPERTIES | \
  1475.                                              MQSEC_GET_QUEUE_PERMISSIONS | \
  1476.                                              MQSEC_RECEIVE_MESSAGE | \
  1477.                                              MQSEC_RECEIVE_JOURNAL_MESSAGE)
  1478.  
  1479. #define MQSEC_QUEUE_GENERIC_WRITE           (MQSEC_GET_QUEUE_PROPERTIES | \
  1480.                                              MQSEC_GET_QUEUE_PERMISSIONS | \
  1481.                                              MQSEC_WRITE_MESSAGE)
  1482.  
  1483. #define MQSEC_QUEUE_GENERIC_EXECUTE         0
  1484.  
  1485. #define MQSEC_QUEUE_GENERIC_ALL             (MQSEC_RECEIVE_MESSAGE | \
  1486.                                              MQSEC_RECEIVE_JOURNAL_MESSAGE | \
  1487.                                              MQSEC_WRITE_MESSAGE | \
  1488.                                              MQSEC_SET_QUEUE_PROPERTIES | \
  1489.                                              MQSEC_GET_QUEUE_PROPERTIES | \
  1490.                                              MQSEC_DELETE_QUEUE | \
  1491.                                              MQSEC_GET_QUEUE_PERMISSIONS | \
  1492.                                              MQSEC_CHANGE_QUEUE_PERMISSIONS | \
  1493.                                              MQSEC_TAKE_QUEUE_OWNERSHIP)
  1494.  
  1495. #ifdef __cplusplus
  1496. extern "C"
  1497. {
  1498. #endif
  1499.  
  1500. //********************************************************************
  1501. //  RECEIVE CALLBACK
  1502. //********************************************************************
  1503.  
  1504. typedef
  1505. VOID
  1506. (APIENTRY *PMQRECEIVECALLBACK)(
  1507.     HRESULT hrStatus,
  1508.     QUEUEHANDLE hSource,
  1509.     DWORD dwTimeout,
  1510.     DWORD dwAction,
  1511.     MQMSGPROPS* pMessageProps,
  1512.     LPOVERLAPPED lpOverlapped,
  1513.     HANDLE hCursor
  1514.     );
  1515.  
  1516.  
  1517. //********************************************************************
  1518. // MSMQ API
  1519. //********************************************************************
  1520.  
  1521. HRESULT
  1522. APIENTRY
  1523. MQCreateQueue(
  1524.     IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
  1525.     IN OUT MQQUEUEPROPS* pQueueProps,
  1526.     OUT LPWSTR lpwcsFormatName,
  1527.     IN OUT LPDWORD lpdwFormatNameLength
  1528.     );
  1529.  
  1530. HRESULT
  1531. APIENTRY
  1532. MQDeleteQueue(
  1533.     IN LPCWSTR lpwcsFormatName
  1534.     );
  1535.  
  1536. HRESULT
  1537. APIENTRY
  1538. MQLocateBegin(
  1539.     IN LPCWSTR lpwcsContext,
  1540.     IN MQRESTRICTION* pRestriction,
  1541.     IN MQCOLUMNSET* pColumns,
  1542.     IN MQSORTSET* pSort,
  1543.     OUT PHANDLE phEnum
  1544.     );
  1545.  
  1546. HRESULT
  1547. APIENTRY
  1548. MQLocateNext(
  1549.     IN HANDLE hEnum,
  1550.     IN OUT DWORD* pcProps,
  1551.     OUT MQPROPVARIANT aPropVar[]
  1552.     );
  1553.  
  1554. HRESULT
  1555. APIENTRY
  1556. MQLocateEnd(
  1557.     IN HANDLE hEnum
  1558.     );
  1559.  
  1560. HRESULT
  1561. APIENTRY
  1562. MQOpenQueue(
  1563.     IN LPCWSTR lpwcsFormatName,
  1564.     IN DWORD dwAccess,
  1565.     IN DWORD dwShareMode,
  1566.     OUT QUEUEHANDLE* phQueue
  1567.     );
  1568.  
  1569. HRESULT
  1570. APIENTRY
  1571. MQSendMessage(
  1572.     IN QUEUEHANDLE hDestinationQueue,
  1573.     IN MQMSGPROPS* pMessageProps,
  1574.     IN ITransaction *pTransaction
  1575.     );
  1576.  
  1577. HRESULT
  1578. APIENTRY
  1579. MQReceiveMessage(
  1580.     IN QUEUEHANDLE hSource,
  1581.     IN DWORD dwTimeout,
  1582.     IN DWORD dwAction,
  1583.     IN OUT MQMSGPROPS* pMessageProps,
  1584.     IN OUT LPOVERLAPPED lpOverlapped,
  1585.     IN PMQRECEIVECALLBACK fnReceiveCallback,
  1586.     IN HANDLE hCursor,
  1587.     IN ITransaction* pTransaction
  1588.     );
  1589.  
  1590. HRESULT
  1591. APIENTRY
  1592. MQCreateCursor(
  1593.     IN QUEUEHANDLE hQueue,
  1594.     OUT PHANDLE phCursor
  1595.     );
  1596.  
  1597. HRESULT
  1598. APIENTRY
  1599. MQCloseCursor(
  1600.     IN HANDLE hCursor
  1601.     );
  1602.  
  1603. HRESULT
  1604. APIENTRY
  1605. MQCloseQueue(
  1606.     IN HANDLE hQueue
  1607.     );
  1608.  
  1609. HRESULT
  1610. APIENTRY
  1611. MQSetQueueProperties(
  1612.     IN LPCWSTR lpwcsFormatName,
  1613.     IN MQQUEUEPROPS* pQueueProps
  1614.     );
  1615.  
  1616. HRESULT
  1617. APIENTRY
  1618. MQGetQueueProperties(
  1619.     IN LPCWSTR lpwcsFormatName,
  1620.     OUT MQQUEUEPROPS* pQueueProps
  1621.     );
  1622.  
  1623. HRESULT
  1624. APIENTRY
  1625. MQGetQueueSecurity(
  1626.     IN LPCWSTR lpwcsFormatName,
  1627.     IN SECURITY_INFORMATION RequestedInformation,
  1628.     OUT PSECURITY_DESCRIPTOR pSecurityDescriptor,
  1629.     IN DWORD nLength,
  1630.     OUT LPDWORD lpnLengthNeeded
  1631.     );
  1632.  
  1633. HRESULT
  1634. APIENTRY
  1635. MQSetQueueSecurity(
  1636.     IN LPCWSTR lpwcsFormatName,
  1637.     IN SECURITY_INFORMATION SecurityInformation,
  1638.     IN PSECURITY_DESCRIPTOR pSecurityDescriptor
  1639.     );
  1640.  
  1641. HRESULT
  1642. APIENTRY
  1643. MQPathNameToFormatName(
  1644.     IN LPCWSTR lpwcsPathName,
  1645.     OUT LPWSTR lpwcsFormatName,
  1646.     IN OUT LPDWORD lpdwFormatNameLength
  1647.     );
  1648.  
  1649. HRESULT
  1650. APIENTRY
  1651. MQHandleToFormatName(
  1652.     IN QUEUEHANDLE hQueue,
  1653.     OUT LPWSTR lpwcsFormatName,
  1654.     IN OUT LPDWORD lpdwFormatNameLength
  1655.     );
  1656.  
  1657. HRESULT
  1658. APIENTRY
  1659. MQInstanceToFormatName(
  1660.     IN GUID* pGuid,
  1661.     OUT LPWSTR lpwcsFormatName,
  1662.     IN OUT LPDWORD lpdwFormatNameLength
  1663.     );
  1664.  
  1665. void
  1666. APIENTRY
  1667. MQFreeMemory(
  1668.     IN PVOID pvMemory
  1669.     );
  1670.  
  1671. HRESULT
  1672. APIENTRY
  1673. MQGetMachineProperties(
  1674.     IN LPCWSTR lpwcsMachineName,
  1675.     IN const GUID* pguidMachineId,
  1676.     IN OUT MQQMPROPS* pQMProps
  1677.     );
  1678.  
  1679. HRESULT
  1680. APIENTRY
  1681. MQGetSecurityContext(
  1682.     IN PVOID lpCertBuffer,
  1683.     IN DWORD dwCertBufferLength,
  1684.     OUT HANDLE* hSecurityContext
  1685.     );
  1686.  
  1687. void
  1688. APIENTRY
  1689. MQFreeSecurityContext(
  1690.     IN HANDLE hSecurityContext
  1691.     );
  1692.  
  1693. HRESULT
  1694. APIENTRY
  1695. MQBeginTransaction(
  1696.     OUT ITransaction **ppTransaction
  1697.     );
  1698.  
  1699.  
  1700. #ifdef __cplusplus
  1701. }
  1702. #endif
  1703.  
  1704. #endif // __MQ_H__
  1705.  
  1706.