// Tries to map CfgMgr32 error codes to Win32 error codes
        // before setting 'error' and 'message'. Both error codes
        // and messages are written.
        public static void SetCR(string cmFuncName, CfgMgr32.CR configRet)
        {
            // We return ERROR_SUCCESS if the
            // error code cannot be mapped
            int win32Err = CfgMgr32.CM_MapCrToWin32Err(
                configRet,
                WinError.ERROR_SUCCESS
            );

            message =
                cmFuncName + "() - CR_Error [" + (int)configRet + "]: " +
                configRet + " => Win32_Error [";

            if (win32Err == WinError.ERROR_SUCCESS)
            {
                message += "-]: No equivalent Win32 error code exists";
                error = (int)configRet;
            }
            else
            {
                message +=
                    win32Err + "]: " + new Win32Exception(win32Err).Message;
                error = win32Err;
            }
        }
예제 #2
0
        public static void SetCR(string cmFuncName, CfgMgr32.CR configRet)
        // Tries to map CfgMgr32 error codes to Win32 error codes
        // before setting 'error' and 'message'. Both error codes
        // and messages are written.
        {
            // We return ERROR_SUCCESS if the
            // error code cannot be mapped
            int win32Err = CfgMgr32.CM_MapCrToWin32Err(
                configRet,
                WinError.ERROR_SUCCESS
                );

            message =
                cmFuncName + "() - CR_Error [" + (int)configRet + "]: " +
                configRet + " => Win32_Error [";

            if (win32Err == WinError.ERROR_SUCCESS)
            {
                message += "-]: No equivalent Win32 error code exists";
                error    = (int)configRet;
            }
            else
            {
                message +=
                    win32Err + "]: " + new Win32Exception(win32Err).Message;
                error = win32Err;
            }
        }