diff options
author | danmosemsft <danmose@microsoft.com> | 2017-02-12 15:32:54 -0800 |
---|---|---|
committer | danmosemsft <danmose@microsoft.com> | 2017-02-12 16:58:50 -0800 |
commit | 206b6a7efbc2e947eff900f448b86573b77ae392 (patch) | |
tree | 1047a9631b0eba294a37571bc4384309308220f1 /src/utilcode | |
parent | 764b57ba3b7494a8391f32fea688c46247dc9336 (diff) | |
download | coreclr-206b6a7efbc2e947eff900f448b86573b77ae392.tar.gz coreclr-206b6a7efbc2e947eff900f448b86573b77ae392.tar.bz2 coreclr-206b6a7efbc2e947eff900f448b86573b77ae392.zip |
Remove remainder of FEATURE_CORECLR (tool missed some files, also comments)
Diffstat (limited to 'src/utilcode')
-rw-r--r-- | src/utilcode/clrhost.cpp | 2 | ||||
-rw-r--r-- | src/utilcode/ex.cpp | 6 | ||||
-rw-r--r-- | src/utilcode/stacktrace.cpp | 2 | ||||
-rw-r--r-- | src/utilcode/utilmessagebox.cpp | 160 |
4 files changed, 5 insertions, 165 deletions
diff --git a/src/utilcode/clrhost.cpp b/src/utilcode/clrhost.cpp index 5b28018514..15678a9861 100644 --- a/src/utilcode/clrhost.cpp +++ b/src/utilcode/clrhost.cpp @@ -430,7 +430,7 @@ void OnUninitializedCoreClrCallbacks() // (other than coreclr.dll) that links to utilcode.lib, or that you're using a nohost // variant of utilcode.lib but hitting code that assumes there is a CLR in the process. // - // Under FEATURE_CORECLR (and not SELF_NO_HOST), it is expected that coreclr.dll + // It is expected that coreclr.dll // is the ONLY dll that links to utilcode libraries. // // If you must introduce a new dll that links to utilcode.lib, it is your responsibility diff --git a/src/utilcode/ex.cpp b/src/utilcode/ex.cpp index 5d060660e3..92b25b0aaf 100644 --- a/src/utilcode/ex.cpp +++ b/src/utilcode/ex.cpp @@ -2039,7 +2039,7 @@ static DWORD MarkAsThrownByUsWorker(UINT numArgs, /*out*/ ULONG_PTR exceptionArg #if !defined(FEATURE_UTILCODE_NO_DEPENDENCIES) exceptionArgs[INSTANCE_TAGGED_SEH_PARAM_ARRAY_SIZE - 1] = (ULONG_PTR) (GetCLRModule()); -#endif // !defined(FEATURE_UTILCODE_NO_DEPENDENCIES) && defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST) || defined(DACCESS_COMPILE) +#endif // !defined(FEATURE_UTILCODE_NO_DEPENDENCIES) return INSTANCE_TAGGED_SEH_PARAM_ARRAY_SIZE; } @@ -2092,9 +2092,9 @@ BOOL WasThrownByUs(const EXCEPTION_RECORD *pcER, DWORD dwExceptionCode) return FALSE; } return TRUE; -#else // !(!defined(FEATURE_UTILCODE_NO_DEPENDENCIES) && (defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST) || defined(DACCESS_COMPILE))) +#else // !(!defined(FEATURE_UTILCODE_NO_DEPENDENCIES) return FALSE; -#endif // !defined(FEATURE_UTILCODE_NO_DEPENDENCIES) && defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST) || defined(DACCESS_COMPILE) +#endif // !defined(FEATURE_UTILCODE_NO_DEPENDENCIES) } diff --git a/src/utilcode/stacktrace.cpp b/src/utilcode/stacktrace.cpp index 8fbc457019..3dee1802f4 100644 --- a/src/utilcode/stacktrace.cpp +++ b/src/utilcode/stacktrace.cpp @@ -989,4 +989,4 @@ ClrCaptureContext(__out PCONTEXT ctx) ret 4 } } -#endif // _TARGET_X86_ && FEATURE_CORECLR +#endif // _TARGET_X86 diff --git a/src/utilcode/utilmessagebox.cpp b/src/utilcode/utilmessagebox.cpp index 5ceb3909f6..58fd7554c2 100644 --- a/src/utilcode/utilmessagebox.cpp +++ b/src/utilcode/utilmessagebox.cpp @@ -49,16 +49,6 @@ BOOL ShouldDisplayMsgBoxOnCriticalFailure() } -#if !defined(FEATURE_CORESYSTEM) && !defined(FEATURE_CORECLR) -enum ProbedTaskDialogIndirectState -{ - ProbedTaskDialogIndirectState_NotProbed = 0, - ProbedTaskDialogIndirectState_NotAvailable = 1, - ProbedTaskDialogIndirectState_Available = 2 -}; - -static ProbedTaskDialogIndirectState siProbedTaskDialogIndirect = ProbedTaskDialogIndirectState_NotProbed; -#endif // !FEATURE_CORESYSTEM && !FEATURE_CORECLR // We'd like to use TaskDialogIndirect for asserts coming from managed code in particular @@ -86,157 +76,7 @@ int MessageBoxImpl( } CONTRACTL_END; -#if defined(FEATURE_CORESYSTEM) || defined (FEATURE_CORECLR) return WszMessageBox(hWnd, message, title, uType); -#else - bool mustUseMessageBox = false; // Mac, Silverlight, pre-Vista? Do we support this type of message box? - decltype(TaskDialogIndirect)* pfnTaskDialogIndirect = NULL; - ULONG_PTR cookie = NULL; // For activation context. - bool activatedActivationContext = false; - HModuleHolder hmodComctl32; - HANDLE hActCtx = INVALID_HANDLE_VALUE; - - // Note: TaskDialogIndirect is only in the v6 and above versions of comctl32. Windows - // stores that library in the WinSxS directory in a directory with - // "Microsoft.Windows.Common-Controls" in the name. Your application can only see - // this library if the linker has added a manifest dependency on the V6 common controls - // to your application. Or, you can create an activation context to make this work, - // if your library also has the appropriate manifest dependency. - // Also, I'm not going to leave comctl32.dll mapped, to ensure it can't somehow - // interfere with older versions. Therefore, re-load comctl32.dll every time through - // this method. We will record whether TaskDialogIndirect is available though, so - // we can fall back to MessageBox faster. - - // We don't yet have a perfect mapping from all MessageBox behavior to TaskDialogIndirect behavior. - // Use MessageBox to avoid most of this complexity. - if (((uType & MB_ICONMASK) != MB_ICONWARNING) && (uType & MB_ICONMASK) != MB_ICONERROR || - (uType & MB_TYPEMASK) != MB_ABORTRETRYIGNORE || - (uType & MB_DEFMASK) != 0 || - (uType & MB_MODEMASK) != 0 || - (uType & MB_MISCMASK) != 0) - mustUseMessageBox = true; - else if (mustUseMessageBox || siProbedTaskDialogIndirect == ProbedTaskDialogIndirectState_NotAvailable) - mustUseMessageBox = true; - else { - // Replace our application's ActivationContext temporarily, load comctl32 - // & look for TaskDialogIndirect. Don't cache pointer. - // The following code was suggested by some Windows experts. We do not want - // to add a manifest to our library saying we use comctl32 v6, because that - // will mean loading a lot of extra libraries on startup (a significant perf hit). - // We could either store the manifest as a resource, or more creatively since - // we are effectively a Windows component, rely on %windir%\WindowsShell.manifest. - ACTCTX ctx = { sizeof(ACTCTX) }; - ctx.dwFlags = 0; - StackSString manifestPath; // Point this at %windir%\WindowsShell.manifest, for comctl32 version 6. - UINT numChars = WszGetWindowsDirectory(manifestPath.OpenUnicodeBuffer(MAX_PATH_FNAME), MAX_PATH_FNAME); - if (numChars == 0 || numChars >= MAX_PATH_FNAME) - { - _ASSERTE(0); // How did this fail? - } - else { - manifestPath.CloseBuffer(numChars); - if (manifestPath[manifestPath.GetCount() - 1] != W('\\')) - manifestPath.Append(W('\\')); - manifestPath.Append(W("WindowsShell.manifest")); // Other Windows components have already loaded this. - ctx.lpSource = manifestPath.GetUnicode(); - hActCtx = CreateActCtx(&ctx); - if (hActCtx != INVALID_HANDLE_VALUE) - { - if (!ActivateActCtx(hActCtx, &cookie)) - { - cookie = NULL; - _ASSERTE(0); // Why did ActivateActCtx fail? (We'll continue executing & cope with the failure.) - } - else { - activatedActivationContext = true; - // Activation context was replaced - now we can load comctl32 version 6. - hmodComctl32 = WszLoadLibrary(W("comctl32.dll")); - - if (hmodComctl32 != INVALID_HANDLE_VALUE) { - pfnTaskDialogIndirect = (decltype(TaskDialogIndirect)*)GetProcAddress(hmodComctl32, "TaskDialogIndirect"); - if (pfnTaskDialogIndirect == NULL) { - hmodComctl32.Release(); - } - } - } - } - } - - siProbedTaskDialogIndirect = (pfnTaskDialogIndirect == NULL) ? ProbedTaskDialogIndirectState_NotAvailable : ProbedTaskDialogIndirectState_Available; - mustUseMessageBox = (pfnTaskDialogIndirect == NULL); - } - - int result = MB_OK; - if (mustUseMessageBox) { - result = WszMessageBox(hWnd, message, title, uType); - } - else { - _ASSERTE(pfnTaskDialogIndirect != NULL); - int nButtonPressed = 0; - TASKDIALOGCONFIG config = {0}; - config.cbSize = sizeof(config); - config.hwndParent = hWnd; - config.dwCommonButtons = 0; - config.pszWindowTitle = title; - config.dwFlags = (uType & MB_RTLREADING) ? TDF_RTL_LAYOUT : 0; - - // Set the user-visible icon in the window. - _ASSERTE(((uType & MB_ICONMASK) == MB_ICONWARNING) || ((uType & MB_ICONMASK) == MB_ICONERROR)); - config.pszMainIcon = ((uType & MB_ICONMASK) == MB_ICONWARNING) ? TD_WARNING_ICON : TD_ERROR_ICON; - - config.pszMainInstruction = title; - config.pszContent = message; - config.pszExpandedInformation = detailedText; - - // Set up the buttons - // Note about button hot keys: Windows keeps track of of where the last input came from - // (ie, mouse or keyboard). If you use the mouse to interact w/ one dialog box and then use - // the keyboard, the next dialog will not include hot keys. This is a Windows feature to - // minimize clutter on the screen for mouse users. - _ASSERTE((uType & MB_TYPEMASK) == MB_ABORTRETRYIGNORE); - StackSString abortLabel, debugLabel, ignoreLabel; - const WCHAR *pAbortLabel, *pDebugLabel, *pIgnoreLabel; - - if (abortLabel.LoadResource(CCompRC::Optional, IDS_DIALOG_BOX_ABORT_BUTTON)) - pAbortLabel = abortLabel.GetUnicode(); - else - pAbortLabel = W("&Abort"); - if (debugLabel.LoadResource(CCompRC::Optional, IDS_DIALOG_BOX_DEBUG_BUTTON)) - pDebugLabel = debugLabel.GetUnicode(); - else - pDebugLabel = W("&Debug"); - if (ignoreLabel.LoadResource(CCompRC::Optional, IDS_DIALOG_BOX_IGNORE_BUTTON)) - pIgnoreLabel = ignoreLabel.GetUnicode(); - else - pIgnoreLabel = W("&Ignore"); - - const TASKDIALOG_BUTTON abortDebugIgnoreButtons[] = { - { IDOK, pAbortLabel }, - { IDRETRY, pDebugLabel }, - { IDIGNORE, pIgnoreLabel } - }; - config.pButtons = abortDebugIgnoreButtons; - config.cButtons = 3; - - HRESULT hr = pfnTaskDialogIndirect(&config, &nButtonPressed, NULL, NULL); - _ASSERTE(hr == S_OK); - if (hr == S_OK) { - result = nButtonPressed; - } - else { - result = IDOK; - } - - _ASSERTE(result == IDOK || result == IDRETRY || result == IDIGNORE); - } - - if (activatedActivationContext) { - DeactivateActCtx(0, cookie); - ReleaseActCtx(hActCtx); // perf isn't important so we won't bother caching the actctx - } - - return result; -#endif } int UtilMessageBoxVA( |