⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mq.h

📁 希望我上传的这些东西可以对搞编程的程序员有点小小的帮助!谢谢!
💻 H
📖 第 1 页 / 共 4 页
字号:
/*++

Copyright (c) 1996-1999 Microsoft Corporation

Module Name:

    mq.h

Abstract:

    Master include file for Message Queue applications

--*/

#ifndef __MQ_H__
#pragma option push -b -a8 -pc -A- /*P_O_Push*/
#define __MQ_H__

#if _MSC_VER > 1000
#pragma once
#endif


//
//  Clients that need transactions should include transact.h before mq.h
//  For the clients not needing transactions - ITransaction is  opaque
//
#ifndef __transact_h__
typedef void ITransaction;
#endif

//
//	Support version older than VC4.2
//
#if defined(_MSC_VER) && (_MSC_VER < 1020)

typedef struct tagMQPROPVARIANT MQPROPVARIANT;

#define TYPEDEF_CA(type, name) \
    typedef struct tag##name {\
        ULONG cElems;\
        type * pElems;\
    } name

#ifndef _tagCAUB_DEFINED
#define _tagCAUB_DEFINED
TYPEDEF_CA(unsigned char, CAUB);
#endif

#ifndef _tagCAI_DEFINED
#define _tagCAI_DEFINED
TYPEDEF_CA(short, CAI);
#endif

#ifndef _tagCAUI_DEFINED
#define _tagCAUI_DEFINED
TYPEDEF_CA(USHORT, CAUI);
#endif

#ifndef _tagCAL_DEFINED
#define _tagCAL_DEFINED
TYPEDEF_CA(long, CAL);
#endif

#ifndef _tagCAUL_DEFINED
#define _tagCAUL_DEFINED
TYPEDEF_CA(ULONG, CAUL);
#endif

#ifndef _tagCACLSID_DEFINED
#define _tagCACLSID_DEFINED
TYPEDEF_CA(CLSID, CACLSID);
#endif

#ifndef _tagCABSTR_DEFINED
#define _tagCABSTR_DEFINED
TYPEDEF_CA(LPOLESTR, CABSTR);
#endif

#ifndef _tagCALPWSTR_DEFINED
#define _tagCALPWSTR_DEFINED
TYPEDEF_CA(LPWSTR, CALPWSTR);
#endif

#ifndef _tagCAMQPROPVARIANT_DEFINED
#define _tagCAMQPROPVARIANT_DEFINED
TYPEDEF_CA(MQPROPVARIANT, CAMQPROPVARIANT);
#endif

struct tagMQPROPVARIANT {
    VARTYPE vt;
    WORD wReserved1;
    WORD wReserved2;
    WORD wReserved3;
    /*[switch_is((unsigned short)vt)]*/ union {
      /*[case(VT_EMPTY, VT_NULL)];*/
      /*[case(VT_UI1)]*/               UCHAR bVal;
      /*[case(VT_I2)]*/                short iVal;
      /*[case(VT_UI2)]*/               USHORT uiVal;
      /*[case(VT_BOOL)]*/              VARIANT_BOOL boolVal;
      /*[case(VT_I4)]*/                long lVal;
      /*[case(VT_UI4)]*/               ULONG ulVal;
      /*[case(VT_HRESULT)]*/           SCODE scode;
      /*[case(VT_DATE)]*/              DATE date;
      /*[case(VT_CLSID)]*/             CLSID  *puuid;
      /*[case(VT_BLOB)]*/              BLOB blob;
      /*[case(VT_BSTR)]*/              LPOLESTR bstrVal;
      /*[case(VT_LPSTR)]*/             LPSTR pszVal;
      /*[case(VT_LPWSTR)]*/            LPWSTR pwszVal;
      /*[case(VT_VECTOR | VT_UI1)]*/   CAUB caub;
      /*[case(VT_VECTOR | VT_I2)]*/    CAI cai;
      /*[case(VT_VECTOR | VT_UI2)]*/   CAUI caui;
      /*[case(VT_VECTOR | VT_I4)]*/    CAL cal;
      /*[case(VT_VECTOR | VT_UI4)]*/   CAUL caul;
      /*[case(VT_VECTOR | VT_CLSID)]*/ CACLSID cauuid;
      /*[case(VT_VECTOR | VT_BSTR)]*/  CABSTR cabstr;
      /*[case(VT_VECTOR | VT_LPWSTR)]*/CALPWSTR calpwstr;
      /*[case(VT_VARIANT)]*/           CAMQPROPVARIANT capropvar;
    };
};

#else // defined(_MSC_VER) && (_MSC_VER < 1020)

#ifdef __midl
// This is the PROPVARIANT definition for marshaling.
typedef struct tag_inner_PROPVARIANT tagMQPROPVARIANT;

#else
// This is the standard C layout of the PROPVARIANT.
typedef struct tagPROPVARIANT tagMQPROPVARIANT;
#endif
typedef tagMQPROPVARIANT MQPROPVARIANT;

#endif // defined(_MSC_VER) && (_MSC_VER < 1020)

#define	PRLT	( 0 )

#define	PRLE	( 1 )

#define	PRGT	( 2 )

#define	PRGE	( 3 )

#define	PREQ	( 4 )

#define	PRNE	( 5 )

typedef struct tagMQPROPERTYRESTRICTION
    {
    ULONG rel;
    PROPID prop;
    MQPROPVARIANT prval;
    }	MQPROPERTYRESTRICTION;

typedef struct tagMQRESTRICTION
    {
    ULONG cRes;
    /* [size_is] */ MQPROPERTYRESTRICTION __RPC_FAR *paPropRes;
    }	MQRESTRICTION;

typedef struct tagMQCOLUMNSET
    {
    ULONG cCol;
    /* [size_is] */ PROPID __RPC_FAR *aCol;
    }	MQCOLUMNSET;

#define	QUERY_SORTASCEND	( 0 )

#define	QUERY_SORTDESCEND	( 1 )

typedef struct tagMQSORTKEY
    {
    PROPID propColumn;
    ULONG dwOrder;
    }	MQSORTKEY;

typedef struct tagMQSORTSET
    {
    ULONG cCol;
    /* [size_is] */ MQSORTKEY __RPC_FAR *aCol;
    }	MQSORTSET;


#define MQ_MAX_Q_NAME_LEN      124   // Maximal WCHAR length of a queue name.
#define MQ_MAX_Q_LABEL_LEN     124
#define MQ_MAX_MSG_LABEL_LEN   250

typedef HANDLE QUEUEHANDLE;


typedef PROPID          MSGPROPID;
typedef PROPID          QUEUEPROPID;
typedef PROPID          QMPROPID;

typedef struct tagMQMSGPROPS
{
    DWORD           cProp;
    MSGPROPID*      aPropID;
    MQPROPVARIANT*  aPropVar;
    HRESULT*        aStatus;
} MQMSGPROPS;

typedef struct tagMQQUEUEPROPS
{
    DWORD           cProp;
    QUEUEPROPID*    aPropID;
    MQPROPVARIANT*  aPropVar;
    HRESULT*        aStatus;
} MQQUEUEPROPS;

typedef struct tagMQQMPROPS
{
    DWORD           cProp;
    QMPROPID*       aPropID;
    MQPROPVARIANT*  aPropVar;
    HRESULT*        aStatus;
} MQQMPROPS;

typedef struct tagMQPRIVATEPROPS
{
    DWORD           cProp;
    QMPROPID*       aPropID;
    MQPROPVARIANT*  aPropVar;
    HRESULT*        aStatus;
} MQPRIVATEPROPS;



//********************************************************************
//  API FLAGS
//********************************************************************

//
//  MQOpenQueue - Access values
//
#define MQ_RECEIVE_ACCESS       0x00000001
#define MQ_SEND_ACCESS          0x00000002
#define MQ_PEEK_ACCESS          0x00000020

//
//  MQOpenQueue - Share values
//
#define MQ_DENY_NONE            0x00000000
#define MQ_DENY_RECEIVE_SHARE   0x00000001

//
//  MQReceiveMessage - Action values
//
#define MQ_ACTION_RECEIVE       0x00000000
#define MQ_ACTION_PEEK_CURRENT  0x80000000
#define MQ_ACTION_PEEK_NEXT     0x80000001

//
// MQSendMessage,  MQReceiveMessage:  special cases for the transaction parameter
//
#define MQ_NO_TRANSACTION             NULL
#define MQ_MTS_TRANSACTION            (ITransaction *)1
#define MQ_XA_TRANSACTION             (ITransaction *)2
#define MQ_SINGLE_MESSAGE             (ITransaction *)3

//********************************************************************
//  PRIORITY LIMITS
//********************************************************************

//
//  Message priorities
//
#define MQ_MIN_PRIORITY          0    // Minimal message priority
#define MQ_MAX_PRIORITY          7    // Maximal message priority


//********************************************************************
//  MESSAGE PROPERTIES
//********************************************************************
#define PROPID_M_BASE                0
#define PROPID_M_CLASS               (PROPID_M_BASE + 1)     /* VT_UI2           */
#define PROPID_M_MSGID               (PROPID_M_BASE + 2)     /* VT_UI1|VT_VECTOR */
#define PROPID_M_CORRELATIONID       (PROPID_M_BASE + 3)     /* VT_UI1|VT_VECTOR */
#define PROPID_M_PRIORITY            (PROPID_M_BASE + 4)     /* VT_UI1           */
#define PROPID_M_DELIVERY            (PROPID_M_BASE + 5)     /* VT_UI1           */
#define PROPID_M_ACKNOWLEDGE         (PROPID_M_BASE + 6)     /* VT_UI1           */
#define PROPID_M_JOURNAL             (PROPID_M_BASE + 7)     /* VT_UI1           */
#define PROPID_M_APPSPECIFIC         (PROPID_M_BASE + 8)     /* VT_UI4           */
#define PROPID_M_BODY                (PROPID_M_BASE + 9)     /* VT_UI1|VT_VECTOR */
#define PROPID_M_BODY_SIZE           (PROPID_M_BASE + 10)    /* VT_UI4           */
#define PROPID_M_LABEL               (PROPID_M_BASE + 11)    /* VT_LPWSTR        */
#define PROPID_M_LABEL_LEN           (PROPID_M_BASE + 12)    /* VT_UI4           */
#define PROPID_M_TIME_TO_REACH_QUEUE (PROPID_M_BASE + 13)    /* VT_UI4           */
#define PROPID_M_TIME_TO_BE_RECEIVED (PROPID_M_BASE + 14)    /* VT_UI4           */
#define PROPID_M_RESP_QUEUE          (PROPID_M_BASE + 15)    /* VT_LPWSTR        */
#define PROPID_M_RESP_QUEUE_LEN      (PROPID_M_BASE + 16)    /* VT_UI4           */
#define PROPID_M_ADMIN_QUEUE         (PROPID_M_BASE + 17)    /* VT_LPWSTR        */
#define PROPID_M_ADMIN_QUEUE_LEN     (PROPID_M_BASE + 18)    /* VT_UI4           */
#define PROPID_M_VERSION             (PROPID_M_BASE + 19)    /* VT_UI4           */
#define PROPID_M_SENDERID            (PROPID_M_BASE + 20)    /* VT_UI1|VT_VECTOR */
#define PROPID_M_SENDERID_LEN        (PROPID_M_BASE + 21)    /* VT_UI4           */
#define PROPID_M_SENDERID_TYPE       (PROPID_M_BASE + 22)    /* VT_UI4           */
#define PROPID_M_PRIV_LEVEL          (PROPID_M_BASE + 23)    /* VT_UI4           */
#define PROPID_M_AUTH_LEVEL          (PROPID_M_BASE + 24)    /* VT_UI4           */
#define PROPID_M_AUTHENTICATED       (PROPID_M_BASE + 25)    /* VT_UI1           */
#define PROPID_M_HASH_ALG            (PROPID_M_BASE + 26)    /* VT_UI4           */
#define PROPID_M_ENCRYPTION_ALG      (PROPID_M_BASE + 27)    /* VT_UI4           */
#define PROPID_M_SENDER_CERT         (PROPID_M_BASE + 28)    /* VT_UI1|VT_VECTOR */
#define PROPID_M_SENDER_CERT_LEN     (PROPID_M_BASE + 29)    /* VT_UI4           */
#define PROPID_M_SRC_MACHINE_ID      (PROPID_M_BASE + 30)    /* VT_CLSID         */
#define PROPID_M_SENTTIME            (PROPID_M_BASE + 31)    /* VT_UI4           */
#define PROPID_M_ARRIVEDTIME         (PROPID_M_BASE + 32)    /* VT_UI4           */
#define PROPID_M_DEST_QUEUE          (PROPID_M_BASE + 33)    /* VT_LPWSTR        */
#define PROPID_M_DEST_QUEUE_LEN      (PROPID_M_BASE + 34)    /* VT_UI4           */
#define PROPID_M_EXTENSION           (PROPID_M_BASE + 35)    /* VT_UI1|VT_VECTOR */
#define PROPID_M_EXTENSION_LEN       (PROPID_M_BASE + 36)    /* VT_UI4           */
#define PROPID_M_SECURITY_CONTEXT    (PROPID_M_BASE + 37)    /* VT_UI4           */
#define PROPID_M_CONNECTOR_TYPE      (PROPID_M_BASE + 38)    /* VT_CLSID         */
#define PROPID_M_XACT_STATUS_QUEUE   (PROPID_M_BASE + 39)    /* VT_LPWSTR        */
#define PROPID_M_XACT_STATUS_QUEUE_LEN (PROPID_M_BASE + 40)  /* VT_UI4           */
#define PROPID_M_TRACE               (PROPID_M_BASE + 41)    /* VT_UI1           */
#define PROPID_M_BODY_TYPE           (PROPID_M_BASE + 42)    /* VT_UI4           */
#define PROPID_M_DEST_SYMM_KEY       (PROPID_M_BASE + 43)    /* VT_UI1|VT_VECTOR */
#define PROPID_M_DEST_SYMM_KEY_LEN   (PROPID_M_BASE + 44)    /* VT_UI4           */
#define PROPID_M_SIGNATURE           (PROPID_M_BASE + 45)    /* VT_UI1|VT_VECTOR */
#define PROPID_M_SIGNATURE_LEN       (PROPID_M_BASE + 46)    /* VT_UI4           */
#define PROPID_M_PROV_TYPE           (PROPID_M_BASE + 47)    /* VT_UI4           */
#define PROPID_M_PROV_NAME           (PROPID_M_BASE + 48)    /* VT_LPWSTR        */
#define PROPID_M_PROV_NAME_LEN       (PROPID_M_BASE + 49)    /* VT_UI4           */
#define PROPID_M_FIRST_IN_XACT       (PROPID_M_BASE + 50)    /* VT_UI1           */
#define PROPID_M_LAST_IN_XACT        (PROPID_M_BASE + 51)    /* VT_UI1           */
#define PROPID_M_XACTID              (PROPID_M_BASE + 52)    /* VT_UI1|VT_VECTOR */


//
// Message Property Size
//
#define PROPID_M_MSGID_SIZE         20
#define PROPID_M_CORRELATIONID_SIZE 20
#define PROPID_M_XACTID_SIZE        20


//********************************************************************
//  MESSAGE CLASS VALUES
//********************************************************************
//
//  Message Class Values are 16 bits layed out as follows:
//
//   1 1 1 1 1 1
//   5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
//  +-+-+-----------+---------------+
//  |S|R| Reserved  |  Class code   |
//  +-+-+-----------+---------------+
//
//  where
//
//      S - is the severity flag
//          0 - Normal Message/Positive Acknowledgment (ACK)
//          1 - Negative Acknowledgment (NACK)
//
//      R - is the receive flag
//          0 - Arrival ACK/NACK
//          1 - Receive ACK/NACK
//
#define MQCLASS_CODE(s, r, code) ((USHORT)(((s) << 15) | ((r) << 14) | (code)))
#define MQCLASS_NACK(c)     ((c) & 0x8000)
#define MQCLASS_RECEIVE(c)  ((c) & 0x4000)

//
//  Normal message
//
#define MQMSG_CLASS_NORMAL                      MQCLASS_CODE(0, 0, 0x00)

//
//  Report message
//
#define MQMSG_CLASS_REPORT                      MQCLASS_CODE(0, 0, 0x01)

//
//  Arrival acknowledgment. The message has reached the destination queue
//
#define MQMSG_CLASS_ACK_REACH_QUEUE             MQCLASS_CODE(0, 0, 0x02)

//
//  Receive acknowledgment. The message has been received by the application
//
#define MQMSG_CLASS_ACK_RECEIVE                 MQCLASS_CODE(0, 1, 0x00)


//-----------------------------------------------
//
//  Negative arrival acknowledgments
//

//
//  Destination queue can not be reached, the queue may have been deleted
//
#define MQMSG_CLASS_NACK_BAD_DST_Q              MQCLASS_CODE(1, 0, 0x00)

//
//  The message was purged before reaching the destination queue
//
#define MQMSG_CLASS_NACK_PURGED                 MQCLASS_CODE(1, 0, 0x01)

//
//  Time to reach queue has expired
//
#define MQMSG_CLASS_NACK_REACH_QUEUE_TIMEOUT    MQCLASS_CODE(1, 0, 0x02)

//
//  The message has exceeded the queue quota
//
#define MQMSG_CLASS_NACK_Q_EXCEED_QUOTA         MQCLASS_CODE(1, 0, 0x03)

//
//  The sender does not have send access rights on the queue.
//
#define MQMSG_CLASS_NACK_ACCESS_DENIED          MQCLASS_CODE(1, 0, 0x04)

//
//  The message hop count exceeded
//
#define MQMSG_CLASS_NACK_HOP_COUNT_EXCEEDED     MQCLASS_CODE(1, 0, 0x05)

//
//  The message signature is bad. The message could not be authenticated.
//
#define MQMSG_CLASS_NACK_BAD_SIGNATURE          MQCLASS_CODE(1, 0, 0x06)

//
//  The message could not be decrypted.
//
#define MQMSG_CLASS_NACK_BAD_ENCRYPTION         MQCLASS_CODE(1, 0, 0x07)

//
//  The message could not be encrypted for the destination.
//
#define MQMSG_CLASS_NACK_COULD_NOT_ENCRYPT      MQCLASS_CODE(1, 0, 0x08)

//
//  The message was sent to a non-transactional queue within a transaction.
//
#define MQMSG_CLASS_NACK_NOT_TRANSACTIONAL_Q    MQCLASS_CODE(1, 0, 0x09)

//
//  The message was sent to a transactional queue not within a transaction.
//
#define MQMSG_CLASS_NACK_NOT_TRANSACTIONAL_MSG  MQCLASS_CODE(1, 0, 0x0A)

//
//  The requested crypto provider for encryption is not supported by destination.
//
#define MQMSG_CLASS_NACK_UNSUPPORTED_CRYPTO_PROVIDER  MQCLASS_CODE(1, 0, 0x0B)


//-----------------------------------------------
//
//  Negative receive acknowledgments
//

//
//  The queue was deleted, after the message has arrived
//
#define MQMSG_CLASS_NACK_Q_DELETED              MQCLASS_CODE(1, 1, 0x00)

//
//  The message was purged at the destination queue
//
#define MQMSG_CLASS_NACK_Q_PURGED               MQCLASS_CODE(1, 1, 0x01)

//
//  Time to receive has expired, while the message is in the queue (info from the destination)
//
#define MQMSG_CLASS_NACK_RECEIVE_TIMEOUT        MQCLASS_CODE(1, 1, 0x02)

//
//  Time to receive has expired, while the message is in the queue (generated by sender locally)
//
#define MQMSG_CLASS_NACK_RECEIVE_TIMEOUT_AT_SENDER  MQCLASS_CODE(1, 1, 0x03)


//------ PROPID_M_ACKNOWLEDGE ---------------
#define MQMSG_ACKNOWLEDGMENT_NONE           0x00

#define MQMSG_ACKNOWLEDGMENT_POS_ARRIVAL    0x01
#define MQMSG_ACKNOWLEDGMENT_POS_RECEIVE    0x02
#define MQMSG_ACKNOWLEDGMENT_NEG_ARRIVAL    0x04
#define MQMSG_ACKNOWLEDGMENT_NEG_RECEIVE    0x08

#define MQMSG_ACKNOWLEDGMENT_NACK_REACH_QUEUE ((UCHAR)( \
            MQMSG_ACKNOWLEDGMENT_NEG_ARRIVAL ))

#define MQMSG_ACKNOWLEDGMENT_FULL_REACH_QUEUE ((UCHAR)( \
            MQMSG_ACKNOWLEDGMENT_NEG_ARRIVAL |  \
            MQMSG_ACKNOWLEDGMENT_POS_ARRIVAL ))

#define MQMSG_ACKNOWLEDGMENT_NACK_RECEIVE ((UCHAR)( \
            MQMSG_ACKNOWLEDGMENT_NEG_ARRIVAL |  \
            MQMSG_ACKNOWLEDGMENT_NEG_RECEIVE ))

#define MQMSG_ACKNOWLEDGMENT_FULL_RECEIVE ((UCHAR)( \
            MQMSG_ACKNOWLEDGMENT_NEG_ARRIVAL |  \
            MQMSG_ACKNOWLEDGMENT_NEG_RECEIVE |  \
            MQMSG_ACKNOWLEDGMENT_POS_RECEIVE ))

//------ PROPID_M_DELIVERY ------------------
#define MQMSG_DELIVERY_EXPRESS              0
#define MQMSG_DELIVERY_RECOVERABLE          1

//----- PROPID_M_JOURNAL --------------------
#define MQMSG_JOURNAL_NONE                  0
#define MQMSG_DEADLETTER                    1
#define MQMSG_JOURNAL                       2

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -