Ejemplo n.º 1
0
        internal static string GetSystemErrorString(int hr)
        {
            StringBuilder strMessage  = new StringBuilder(512);
            uint          dwErrorCode = CAPI.FormatMessage(CAPI.FORMAT_MESSAGE_FROM_SYSTEM | CAPI.FORMAT_MESSAGE_IGNORE_INSERTS,
                                                           IntPtr.Zero,
                                                           (uint)hr,
                                                           0,
                                                           strMessage,
                                                           (uint)strMessage.Capacity,
                                                           IntPtr.Zero);

            if (dwErrorCode != 0)
            {
                return(strMessage.ToString());
            }
            else
            {
                return(SR.GetString(SR.Unknown_Error));
            }
        }