Пример #1
0
        /// <summary>
        /// Get information for the given mailslot.
        /// </summary>
        public unsafe static MailslotInfo GetMailslotInfo(SafeMailslotHandle mailslotHandle)
        {
            MailslotInfo info = new MailslotInfo();

            Error.ThrowLastErrorIfFalse(
                Imports.GetMailslotInfo(
                    hMailslot: mailslotHandle,
                    lpMaxMessageSize: &info.MaxMessageSize,
                    lpNextSize: &info.NextSize,
                    lpMessageCount: &info.MessageCount,
                    lpReadTimeout: &info.ReadTimeout));

            return(info);
        }
Пример #2
0
        /// <summary>
        /// Get information for the given mailslot.
        /// </summary>
        public static MailslotInfo GetMailslotInfo(SafeMailslotHandle mailslotHandle)
        {
            MailslotInfo info = new MailslotInfo();

            unsafe
            {
                if (!Imports.GetMailslotInfo(
                        hMailslot: mailslotHandle,
                        lpMaxMessageSize: &info.MaxMessageSize,
                        lpNextSize: &info.NextSize,
                        lpMessageCount: &info.MessageCount,
                        lpReadTimeout: &info.ReadTimeout))
                {
                    throw Error.GetExceptionForLastError();
                }
            }

            return(info);
        }