コード例 #1
0
        [System.Security.SecurityCritical]  // auto-generated
        private static Exception _HandleErrorCode(int errorCode, string name, SafeHandle handle, object context)
        {
            System.Exception exception = null;

            switch (errorCode)
            {
            case Interop.mincore.Errors.ERROR_INVALID_NAME:
            case Interop.mincore.Errors.ERROR_INVALID_HANDLE:
            case Interop.mincore.Errors.ERROR_FILE_NOT_FOUND:
                if ((name != null) && (name.Length != 0))
                {
                    exception = new WaitHandleCannotBeOpenedException(SR.Format(SR.WaitHandleCannotBeOpenedException_InvalidHandle, name));
                }
                else
                {
                    exception = new WaitHandleCannotBeOpenedException();
                }
                break;

            default:
                break;
            }

            return(exception);
        }
コード例 #2
0
ファイル: mutexsecurity.cs プロジェクト: dox0/DotNet471RS3
        [System.Security.SecurityCritical]  // auto-generated
        private static Exception _HandleErrorCode(int errorCode, string name, SafeHandle handle, object context)
        {
            System.Exception exception = null;

            switch (errorCode)
            {
            case Win32Native.ERROR_INVALID_NAME:
            case Win32Native.ERROR_INVALID_HANDLE:
            case Win32Native.ERROR_FILE_NOT_FOUND:
                if ((name != null) && (name.Length != 0))
                {
                    exception = new WaitHandleCannotBeOpenedException(Environment.GetResourceString("Threading.WaitHandleCannotBeOpenedException_InvalidHandle", name));
                }
                else
                {
                    exception = new WaitHandleCannotBeOpenedException();
                }
                break;

            default:
                break;
            }

            return(exception);
        }
コード例 #3
0
        private static Exception _HandleErrorCode(int errorCode, string name, SafeHandle handle, object context)
        {
            Exception result = null;

            if (errorCode == 2 || errorCode == 6 || errorCode == 123)
            {
                if (name != null && name.Length != 0)
                {
                    result = new WaitHandleCannotBeOpenedException(Environment.GetResourceString("Threading.WaitHandleCannotBeOpenedException_InvalidHandle", new object[]
                    {
                        name
                    }));
                }
                else
                {
                    result = new WaitHandleCannotBeOpenedException();
                }
            }
            return(result);
        }