Esempio n. 1
0
 /// <summary>
 /// Creates a new instance of DestinationInfo at the specific memory address.
 /// </summary>
 /// <param name="baseAddr">Memory address where the DestinationInfo object should be created.</param>
 public DestinationInfo(IntPtr baseAddr)
 {
     lock (syncRoot)
     {
         guid        = new Guid(MarshalEx.ReadByteArray(baseAddr, 0, 16));
         description = MarshalEx.PtrToStringUni(baseAddr, 16, 256);
     }
 }
Esempio n. 2
0
        internal static string GetErrorMessage(int ErrNo)
        {
            IntPtr pBuffer;
            int    nLen = Win32.Core.FormatMessage(Core.FormatMessageFlags.FromSystem | Core.FormatMessageFlags.AllocateBuffer, 0, ErrNo, 0, out pBuffer, 0, null);

            if (nLen == 0)              //Failed
            {
                return(string.Format("Error {0} (0x{0:X})", ErrNo));
            }
            string sMsg = MarshalEx.PtrToStringUni(pBuffer, 0, nLen);

            MarshalEx.FreeHGlobal(pBuffer);

            return(sMsg);
        }