public Message() { this.properties = new MessagePropertyVariants(); this.receiveCreated = false; this.filter = new MessagePropertyFilter(); this.properties.SetUI1Vector(2, new byte[20]); this.filter.Id = true; }
/// <include file='doc\Message.uex' path='docs/doc[@for="Message.Message"]/*' /> /// <devdoc> /// <para> /// Initializes a new instance of the <see cref='System.Messaging.Message'/> class with an empty body. /// </para> /// </devdoc> public Message() { properties = new MessagePropertyVariants(); receiveCreated = false; this.filter = new MessagePropertyFilter(); //Always add Id properties.SetUI1Vector(NativeMethods.MESSAGE_PROPID_MSGID, new byte[MessageIdSize]); this.filter.Id = true; }
public unsafe static int MQReceiveMessageByLookupId(MessageQueueHandle handle, long lookupId, int action, MessagePropertyVariants.MQPROPS properties, NativeOverlapped* overlapped, SafeNativeMethods.ReceiveCallback receiveCallback, ITransaction transaction) { try { return IntMQReceiveMessageByLookupId(handle, lookupId, action, properties, overlapped, receiveCallback, transaction); } catch (EntryPointNotFoundException) { throw new PlatformNotSupportedException(Res.GetString(Res.PlatformNotSupported)); } }
/// <include file='doc\Message.uex' path='docs/doc[@for="Message.Message3"]/*' /> /// <internalonly/> internal Message(MessagePropertyFilter filter) { properties = new MessagePropertyVariants(); receiveCreated = true; this.filter = filter; if (filter.data1 != 0) { int data = filter.data1; if (0 != (data & MessagePropertyFilter.ACKNOWLEDGEMENT)) properties.SetUI2(NativeMethods.MESSAGE_PROPID_CLASS, (short)0); if (0 != (data & MessagePropertyFilter.ACKNOWLEDGE_TYPE)) properties.SetUI1(NativeMethods.MESSAGE_PROPID_ACKNOWLEDGE, (byte)0); if (0 != (data & MessagePropertyFilter.ADMIN_QUEUE)) { properties.SetString(NativeMethods.MESSAGE_PROPID_ADMIN_QUEUE, new byte[DefaultQueueNameSize * 2]); properties.SetUI4(NativeMethods.MESSAGE_PROPID_ADMIN_QUEUE_LEN, DefaultQueueNameSize); } if (0 != (data & MessagePropertyFilter.BODY)) { properties.SetUI1Vector(NativeMethods.MESSAGE_PROPID_BODY, new byte[filter.bodySize]); properties.SetUI4(NativeMethods.MESSAGE_PROPID_BODY_SIZE, filter.bodySize); properties.SetUI4(NativeMethods.MESSAGE_PROPID_BODY_TYPE, 0); } if (0 != (data & MessagePropertyFilter.LABEL)) { properties.SetString(NativeMethods.MESSAGE_PROPID_LABEL, new byte[filter.labelSize * 2]); properties.SetUI4(NativeMethods.MESSAGE_PROPID_LABEL_LEN, filter.labelSize); } if (0 != (data & MessagePropertyFilter.ID)) properties.SetUI1Vector(NativeMethods.MESSAGE_PROPID_MSGID, new byte[MessageIdSize]); if (0 != (data & MessagePropertyFilter.LOOKUP_ID)) properties.SetUI8(NativeMethods.MESSAGE_PROPID_LOOKUPID, (long)0); if (0 != (data & MessagePropertyFilter.USE_DEADLETTER_QUEUE)) properties.SetUI1(NativeMethods.MESSAGE_PROPID_JOURNAL, (byte)0); if (0 != (data & MessagePropertyFilter.RESPONSE_QUEUE)) { properties.SetString(NativeMethods.MESSAGE_PROPID_RESP_QUEUE, new byte[DefaultQueueNameSize * 2]); properties.SetUI4(NativeMethods.MESSAGE_PROPID_RESP_QUEUE_LEN, DefaultQueueNameSize); } //Acknowledgment and MessageType are overloaded in MQ. if ((0 == (data & MessagePropertyFilter.ACKNOWLEDGEMENT)) && (0 != (data & MessagePropertyFilter.MESSAGE_TYPE))) properties.SetUI2(NativeMethods.MESSAGE_PROPID_CLASS, (short)0); //Journaling and Deadletter are overloaded in MSMQ if ((0 == (data & MessagePropertyFilter.USE_DEADLETTER_QUEUE)) && (0 != (data & MessagePropertyFilter.USE_JOURNALING))) properties.SetUI1(NativeMethods.MESSAGE_PROPID_JOURNAL, (byte)0); } if (filter.data2 != 0) { int data = filter.data2; if (0 != (data & MessagePropertyFilter.APP_SPECIFIC)) properties.SetUI4(NativeMethods.MESSAGE_PROPID_APPSPECIFIC, 0); if (0 != (data & MessagePropertyFilter.ARRIVED_TIME)) properties.SetUI4(NativeMethods.MESSAGE_PROPID_ARRIVEDTIME, 0); if (0 != (data & MessagePropertyFilter.ATTACH_SENDER_ID)) properties.SetUI4(NativeMethods.MESSAGE_PROPID_SENDERID_TYPE, 0); if (0 != (data & MessagePropertyFilter.AUTHENTICATED)) properties.SetUI1(NativeMethods.MESSAGE_PROPID_AUTHENTICATED, (byte)0); if (0 != (data & MessagePropertyFilter.CONNECTOR_TYPE)) properties.SetGuid(NativeMethods.MESSAGE_PROPID_CONNECTOR_TYPE, new byte[GenericIdSize]); if (0 != (data & MessagePropertyFilter.CORRELATION_ID)) properties.SetUI1Vector(NativeMethods.MESSAGE_PROPID_CORRELATIONID, new byte[MessageIdSize]); if (0 != (data & MessagePropertyFilter.CRYPTOGRAPHIC_PROVIDER_NAME)) { properties.SetString(NativeMethods.MESSAGE_PROPID_PROV_NAME, new byte[DefaultCryptographicProviderNameSize * 2]); properties.SetUI4(NativeMethods.MESSAGE_PROPID_PROV_NAME_LEN, DefaultCryptographicProviderNameSize); } if (0 != (data & MessagePropertyFilter.CRYPTOGRAPHIC_PROVIDER_TYPE)) properties.SetUI4(NativeMethods.MESSAGE_PROPID_PROV_TYPE, 0); if (0 != (data & MessagePropertyFilter.IS_RECOVERABLE)) properties.SetUI1(NativeMethods.MESSAGE_PROPID_DELIVERY, (byte)0); if (0 != (data & MessagePropertyFilter.DESTINATION_QUEUE)) { properties.SetString(NativeMethods.MESSAGE_PROPID_DEST_QUEUE, new byte[DefaultQueueNameSize * 2]); properties.SetUI4(NativeMethods.MESSAGE_PROPID_DEST_QUEUE_LEN, DefaultQueueNameSize); } if (0 != (data & MessagePropertyFilter.DIGITAL_SIGNATURE)) { properties.SetUI1Vector(NativeMethods.MESSAGE_PROPID_SIGNATURE, new byte[DefaultDigitalSignatureSize]); properties.SetUI4(NativeMethods.MESSAGE_PROPID_SIGNATURE_LEN, DefaultDigitalSignatureSize); } if (0 != (data & MessagePropertyFilter.ENCRYPTION_ALGORITHM)) properties.SetUI4(NativeMethods.MESSAGE_PROPID_ENCRYPTION_ALG, 0); if (0 != (data & MessagePropertyFilter.EXTENSION)) { properties.SetUI1Vector(NativeMethods.MESSAGE_PROPID_EXTENSION, new byte[filter.extensionSize]); properties.SetUI4(NativeMethods.MESSAGE_PROPID_EXTENSION_LEN, filter.extensionSize); } if (0 != (data & MessagePropertyFilter.FOREIGN_ADMIN_QUEUE)) { properties.SetString(NativeMethods.MESSAGE_PROPID_XACT_STATUS_QUEUE, new byte[DefaultQueueNameSize * 2]); properties.SetUI4(NativeMethods.MESSAGE_PROPID_XACT_STATUS_QUEUE_LEN, DefaultQueueNameSize); } if (0 != (data & MessagePropertyFilter.HASH_ALGORITHM)) properties.SetUI4(NativeMethods.MESSAGE_PROPID_HASH_ALG, 0); if (0 != (data & MessagePropertyFilter.IS_FIRST_IN_TRANSACTION)) properties.SetUI1(NativeMethods.MESSAGE_PROPID_FIRST_IN_XACT, (byte)0); if (0 != (data & MessagePropertyFilter.IS_LAST_IN_TRANSACTION)) properties.SetUI1(NativeMethods.MESSAGE_PROPID_LAST_IN_XACT, (byte)0); if (0 != (data & MessagePropertyFilter.PRIORITY)) properties.SetUI1(NativeMethods.MESSAGE_PROPID_PRIORITY, (byte)0); if (0 != (data & MessagePropertyFilter.SENDER_CERTIFICATE)) { properties.SetUI1Vector(NativeMethods.MESSAGE_PROPID_SENDER_CERT, new byte[DefaultSenderCertificateSize]); properties.SetUI4(NativeMethods.MESSAGE_PROPID_SENDER_CERT_LEN, DefaultSenderCertificateSize); } if (0 != (data & MessagePropertyFilter.SENDER_ID)) { properties.SetUI1Vector(NativeMethods.MESSAGE_PROPID_SENDERID, new byte[DefaultSenderIdSize]); properties.SetUI4(NativeMethods.MESSAGE_PROPID_SENDERID_LEN, DefaultSenderIdSize); } if (0 != (data & MessagePropertyFilter.SENT_TIME)) properties.SetUI4(NativeMethods.MESSAGE_PROPID_SENTTIME, 0); if (0 != (data & MessagePropertyFilter.SOURCE_MACHINE)) properties.SetGuid(NativeMethods.MESSAGE_PROPID_SRC_MACHINE_ID, new byte[GenericIdSize]); if (0 != (data & MessagePropertyFilter.SYMMETRIC_KEY)) { properties.SetUI1Vector(NativeMethods.MESSAGE_PROPID_DEST_SYMM_KEY, new byte[DefaultSymmetricKeySize]); properties.SetUI4(NativeMethods.MESSAGE_PROPID_DEST_SYMM_KEY_LEN, DefaultSymmetricKeySize); } if (0 != (data & MessagePropertyFilter.TIME_TO_BE_RECEIVED)) properties.SetUI4(NativeMethods.MESSAGE_PROPID_TIME_TO_BE_RECEIVED, 0); if (0 != (data & MessagePropertyFilter.TIME_TO_REACH_QUEUE)) properties.SetUI4(NativeMethods.MESSAGE_PROPID_TIME_TO_REACH_QUEUE, 0); if (0 != (data & MessagePropertyFilter.TRANSACTION_ID)) properties.SetUI1Vector(NativeMethods.MESSAGE_PROPID_XACTID, new byte[MessageIdSize]); if (0 != (data & MessagePropertyFilter.USE_AUTHENTICATION)) properties.SetUI4(NativeMethods.MESSAGE_PROPID_AUTH_LEVEL, 0); if (0 != (data & MessagePropertyFilter.USE_ENCRYPTION)) properties.SetUI4(NativeMethods.MESSAGE_PROPID_PRIV_LEVEL, 0); if (0 != (data & MessagePropertyFilter.USE_TRACING)) properties.SetUI1(NativeMethods.MESSAGE_PROPID_TRACE, (byte)0); if (0 != (data & MessagePropertyFilter.VERSION)) properties.SetUI4(NativeMethods.MESSAGE_PROPID_VERSION, 0); } }
public static int MQCreateQueue(IntPtr securityDescriptor, MessagePropertyVariants.MQPROPS queueProperties, StringBuilder formatName, ref int formatNameLength) { try { return IntMQCreateQueue(securityDescriptor, queueProperties, formatName, ref formatNameLength); } catch (DllNotFoundException) { throw new InvalidOperationException(Res.GetString(Res.MSMQNotInstalled)); } }
private static extern int IntMQCreateQueue(IntPtr securityDescriptor, MessagePropertyVariants.MQPROPS queueProperties, StringBuilder formatName, ref int formatNameLength);
private unsafe static extern int IntMQReceiveMessageByLookupId(MessageQueueHandle handle, long lookupId, int action, MessagePropertyVariants.MQPROPS properties, NativeOverlapped* overlapped, SafeNativeMethods.ReceiveCallback receiveCallback, ITransaction transaction);
public unsafe static extern int MQReceiveMessage(MessageQueueHandle handle, uint timeout, int action, MessagePropertyVariants.MQPROPS properties, NativeOverlapped* overlapped, SafeNativeMethods.ReceiveCallback receiveCallback, CursorHandle cursorHandle, ITransaction transaction);
public static extern int MQSendMessage(MessageQueueHandle handle, MessagePropertyVariants.MQPROPS properties, ITransaction transaction);
public static int MQSetQueueProperties(string formatName, MessagePropertyVariants.MQPROPS queueProperties) { try { return IntMQSetQueueProperties(formatName, queueProperties); } catch (DllNotFoundException) { throw new InvalidOperationException(Res.GetString(Res.MSMQNotInstalled)); } }
private static extern int IntMQSetQueueProperties(string formatName, MessagePropertyVariants.MQPROPS queueProperties);
public static int MQMgmtGetInfo(string machineName, string objectName, MessagePropertyVariants.MQPROPS queueProperties) { try { return IntMQMgmtGetInfo(machineName, objectName, queueProperties); } catch (EntryPointNotFoundException) { throw new InvalidOperationException(Res.GetString(Res.MSMQInfoNotSupported)); } catch (DllNotFoundException) { throw new InvalidOperationException(Res.GetString(Res.MSMQNotInstalled)); } }
private static extern int IntMQMgmtGetInfo(string machineName, string objectName, MessagePropertyVariants.MQPROPS queueProperties);
public static int MQGetMachineProperties(string machineName, IntPtr machineIdPointer, MessagePropertyVariants.MQPROPS machineProperties) { try { return IntMQGetMachineProperties(machineName, machineIdPointer, machineProperties); } catch (DllNotFoundException) { throw new InvalidOperationException(Res.GetString(Res.MSMQNotInstalled)); } }
private static extern int IntMQGetMachineProperties(string machineName, IntPtr machineIdPointer, MessagePropertyVariants.MQPROPS machineProperties);
internal Message(MessagePropertyFilter filter) { this.properties = new MessagePropertyVariants(); this.receiveCreated = true; this.filter = filter; if (filter.data1 != 0) { int num = filter.data1; if ((num & 1) != 0) { this.properties.SetUI2(1, 0); } if ((num & 4) != 0) { this.properties.SetUI1(6, 0); } if ((num & 8) != 0) { this.properties.SetString(0x11, new byte[510]); this.properties.SetUI4(0x12, 0xff); } if ((num & 0x10) != 0) { this.properties.SetUI1Vector(9, new byte[filter.bodySize]); this.properties.SetUI4(10, filter.bodySize); this.properties.SetUI4(0x2a, 0); } if ((num & 0x20) != 0) { this.properties.SetString(11, new byte[filter.labelSize * 2]); this.properties.SetUI4(12, filter.labelSize); } if ((num & 0x40) != 0) { this.properties.SetUI1Vector(2, new byte[20]); } if ((num & 0x800) != 0) { this.properties.SetUI8(60, 0L); } if ((num & 0x80) != 0) { this.properties.SetUI1(7, 0); } if ((num & 0x100) != 0) { this.properties.SetString(15, new byte[510]); this.properties.SetUI4(0x10, 0xff); } if (((num & 1) == 0) && ((num & 0x200) != 0)) { this.properties.SetUI2(1, 0); } if (((num & 0x80) == 0) && ((num & 0x400) != 0)) { this.properties.SetUI1(7, 0); } } if (filter.data2 != 0) { int num2 = filter.data2; if ((num2 & 1) != 0) { this.properties.SetUI4(8, 0); } if ((num2 & 4) != 0) { this.properties.SetUI4(0x20, 0); } if ((num2 & 8) != 0) { this.properties.SetUI4(0x16, 0); } if ((num2 & 0x10) != 0) { this.properties.SetUI1(0x19, 0); } if ((num2 & 0x20) != 0) { this.properties.SetGuid(0x26, new byte[0x10]); } if ((num2 & 0x40) != 0) { this.properties.SetUI1Vector(3, new byte[20]); } if ((num2 & 0x80) != 0) { this.properties.SetString(0x30, new byte[510]); this.properties.SetUI4(0x31, 0xff); } if ((num2 & 0x100) != 0) { this.properties.SetUI4(0x2f, 0); } if ((num2 & 0x200) != 0) { this.properties.SetUI1(5, 0); } if ((num2 & 0x8000) != 0) { this.properties.SetString(0x21, new byte[510]); this.properties.SetUI4(0x22, 0xff); } if ((num2 & 0x400) != 0) { this.properties.SetUI1Vector(0x2d, new byte[0xff]); this.properties.SetUI4(0x2e, 0xff); } if ((num2 & 0x800) != 0) { this.properties.SetUI4(0x1b, 0); } if ((num2 & 0x1000) != 0) { this.properties.SetUI1Vector(0x23, new byte[filter.extensionSize]); this.properties.SetUI4(0x24, filter.extensionSize); } if ((num2 & 0x2000) != 0) { this.properties.SetString(0x27, new byte[510]); this.properties.SetUI4(40, 0xff); } if ((num2 & 0x4000) != 0) { this.properties.SetUI4(0x1a, 0); } if ((num2 & 0x20000000) != 0) { this.properties.SetUI1(50, 0); } if ((num2 & 0x40000000) != 0) { this.properties.SetUI1(0x33, 0); } if ((num2 & 0x10000) != 0) { this.properties.SetUI1(4, 0); } if ((num2 & 0x40000) != 0) { this.properties.SetUI1Vector(0x1c, new byte[0xff]); this.properties.SetUI4(0x1d, 0xff); } if ((num2 & 0x80000) != 0) { this.properties.SetUI1Vector(20, new byte[0xff]); this.properties.SetUI4(0x15, 0xff); } if ((num2 & 0x100000) != 0) { this.properties.SetUI4(0x1f, 0); } if ((num2 & 0x200000) != 0) { this.properties.SetGuid(30, new byte[0x10]); } if ((num2 & 0x400000) != 0) { this.properties.SetUI1Vector(0x2b, new byte[0xff]); this.properties.SetUI4(0x2c, 0xff); } if ((num2 & 0x800000) != 0) { this.properties.SetUI4(14, 0); } if ((num2 & 0x1000000) != 0) { this.properties.SetUI4(13, 0); } if ((num2 & -2147483648) != 0) { this.properties.SetUI1Vector(0x34, new byte[20]); } if ((num2 & 0x2000000) != 0) { this.properties.SetUI4(0x18, 0); } if ((num2 & 0x4000000) != 0) { this.properties.SetUI4(0x17, 0); } if ((num2 & 0x8000000) != 0) { this.properties.SetUI1(0x29, 0); } if ((num2 & 0x10000000) != 0) { this.properties.SetUI4(0x13, 0); } } }