From 5b283a18625f7a8009c18221592ec81c3cd32375 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Fri, 24 May 2019 23:10:21 -0700 Subject: Delete FEATURE_USE_LCID (#24767) Never defined and obsolete --- src/dlls/mscoree/mscoree.cpp | 135 ------------------------------- src/inc/cor.h | 73 ----------------- src/inc/utilcode.h | 32 +------- src/utilcode/ccomprc.cpp | 41 +--------- src/utilcode/ex.cpp | 4 - src/utilcode/posterror.cpp | 46 ----------- src/utilcode/sstring.cpp | 4 - src/vm/ceemain.cpp | 183 ------------------------------------------- src/vm/corhost.cpp | 1 - 9 files changed, 2 insertions(+), 517 deletions(-) diff --git a/src/dlls/mscoree/mscoree.cpp b/src/dlls/mscoree/mscoree.cpp index 0d587e2fd8..28a3ebe390 100644 --- a/src/dlls/mscoree/mscoree.cpp +++ b/src/dlls/mscoree/mscoree.cpp @@ -386,141 +386,6 @@ STDAPI ReOpenMetaDataWithMemoryEx( return hr; } - -#ifndef CROSSGEN_COMPILE -// --------------------------------------------------------------------------- -// %%Function: CoInitializeCor -// -// Parameters: -// fFlags - Initialization flags for the engine. See the -// COINITICOR enumerator for valid values. -// -// Returns: -// S_OK - On success -// -// Description: -// Reserved to initialize the Cor runtime engine explicitly. This currently -// does nothing. -// --------------------------------------------------------------------------- -STDAPI CoInitializeCor(DWORD fFlags) -{ - WRAPPER_NO_CONTRACT; - - BEGIN_ENTRYPOINT_NOTHROW; - - // Since the CLR doesn't currently support being unloaded, we don't hold a ref - // count and don't even pretend to try to unload. - END_ENTRYPOINT_NOTHROW; - - return (S_OK); -} - -// --------------------------------------------------------------------------- -// %%Function: CoUninitializeCor -// -// Parameters: -// none -// -// Returns: -// Nothing -// -// Description: -// Function to indicate the client is done with the CLR. This currently does -// nothing. -// --------------------------------------------------------------------------- -STDAPI_(void) CoUninitializeCor(void) -{ - WRAPPER_NO_CONTRACT; - - BEGIN_ENTRYPOINT_VOIDRET; - - // Since the CLR doesn't currently support being unloaded, we don't hold a ref - // count and don't even pretend to try to unload. - END_ENTRYPOINT_VOIDRET; - -} - -// Undef LoadStringRC & LoadStringRCEx so we can export these functions. -#undef LoadStringRC -#undef LoadStringRCEx - -// --------------------------------------------------------------------------- -// %%Function: LoadStringRC -// -// Parameters: -// none -// -// Returns: -// Nothing -// -// Description: -// Function to load a resource based on it's ID. -// --------------------------------------------------------------------------- -STDAPI LoadStringRC( - UINT iResourceID, - __out_ecount(iMax) __out_z LPWSTR szBuffer, - int iMax, - int bQuiet -) -{ - WRAPPER_NO_CONTRACT; - - HRESULT hr = S_OK; - - if (NULL == szBuffer) - return E_INVALIDARG; - if (0 == iMax) - return E_INVALIDARG; - - BEGIN_ENTRYPOINT_NOTHROW; - hr = UtilLoadStringRC(iResourceID, szBuffer, iMax, bQuiet); - END_ENTRYPOINT_NOTHROW; - return hr; -} - -// --------------------------------------------------------------------------- -// %%Function: LoadStringRCEx -// -// Parameters: -// none -// -// Returns: -// Nothing -// -// Description: -// Ex version of the function to load a resource based on it's ID. -// --------------------------------------------------------------------------- -#ifdef FEATURE_USE_LCID -STDAPI LoadStringRCEx( - LCID lcid, - UINT iResourceID, - __out_ecount(iMax) __out_z LPWSTR szBuffer, - int iMax, - int bQuiet, - int *pcwchUsed -) -{ - WRAPPER_NO_CONTRACT; - HRESULT hr = S_OK; - - if (NULL == szBuffer) - return E_INVALIDARG; - if (0 == iMax) - return E_INVALIDARG; - - BEGIN_ENTRYPOINT_NOTHROW; - hr = UtilLoadStringRCEx(lcid, iResourceID, szBuffer, iMax, bQuiet, pcwchUsed); - END_ENTRYPOINT_NOTHROW; - return hr; -} -#endif -// Redefine them as errors to prevent people from using these from inside the rest of the compilation unit. -#define LoadStringRC __error("From inside the CLR, use UtilLoadStringRC; LoadStringRC is only meant to be exported.") -#define LoadStringRCEx __error("From inside the CLR, use UtilLoadStringRCEx; LoadStringRC is only meant to be exported.") - -#endif // CROSSGEN_COMPILE - - // Replacement for legacy shim API GetCORRequiredVersion(...) used in linked libraries. // Used in code:TiggerStorage::GetDefaultVersion#CallTo_CLRRuntimeHostInternal_GetImageVersionString. HRESULT diff --git a/src/inc/cor.h b/src/inc/cor.h index 85ef14d8cb..034801b05f 100644 --- a/src/inc/cor.h +++ b/src/inc/cor.h @@ -20,17 +20,6 @@ //***************************************************************************** -#if defined(_MSC_VER) && !defined(USE_DEPRECATED_CLR_API_WITHOUT_WARNING) -#define DEPRECATED_CLR_API_MESG "This API has been deprecated. Refer to http://go.microsoft.com/fwlink/?LinkId=143720 for more details." -#define DECLARE_DEPRECATED __declspec(deprecated(DEPRECATED_CLR_API_MESG)) -#define DEPRECATED_CLR_STDAPI EXTERN_C DECLARE_DEPRECATED HRESULT STDAPICALLTYPE -#define DEPRECATED_CLR_STDAPI_(type) EXTERN_C DECLARE_DEPRECATED type STDAPICALLTYPE -#else // _MSC_VER && !USE_DEPRECATED_CLR_API_WITHOUT_WARNING -#define DECLARE_DEPRECATED -#define DEPRECATED_CLR_STDAPI STDAPI -#define DEPRECATED_CLR_STDAPI_(type) STDAPI_(type) -#endif // _MSC_VER && !USE_DEPRECATED_CLR_API_WITHOUT_WARNING - #ifdef __cplusplus extern "C" { #endif @@ -145,32 +134,6 @@ typedef UNALIGNED void const *UVCP_CONSTANT; #define INVALID_TASK_ID 0x0 #define MAX_CONNECTION_NAME MAX_PATH -//***************************************************************************** -//***************************************************************************** -// -// D L L P U B L I C E N T R Y P O I N T D E C L A R A T I O N S -// -//***************************************************************************** -//***************************************************************************** - -BOOL STDMETHODCALLTYPE _CorDllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved); -__int32 STDMETHODCALLTYPE _CorExeMain(); -__int32 STDMETHODCALLTYPE _CorExeMainInternal(); -__int32 STDMETHODCALLTYPE _CorExeMain2( // Executable exit code. - PBYTE pUnmappedPE, // -> memory mapped code - DWORD cUnmappedPE, // Size of memory mapped code - _In_ LPWSTR pImageNameIn, // -> Executable Name - _In_ LPWSTR pLoadersFileName, // -> Loaders Name - _In_ LPWSTR pCmdLine); // -> Command Line - -STDAPI _CorValidateImage(PVOID *ImageBase, LPCWSTR FileName); -STDAPI_(VOID) _CorImageUnloading(PVOID ImageBase); - -DEPRECATED_CLR_STDAPI CoInitializeEE(DWORD fFlags); -DEPRECATED_CLR_STDAPI_(void) CoUninitializeEE(BOOL fFlags); -DEPRECATED_CLR_STDAPI_(void) CoEEShutDownCOM(void); - - #define MAIN_CLR_MODULE_NAME_W W("coreclr") #define MAIN_CLR_MODULE_NAME_A "coreclr" @@ -179,21 +142,11 @@ DEPRECATED_CLR_STDAPI_(void) CoEEShutDownCOM(void); #define MAIN_CLR_DLL_NAME_A MAKEDLLNAME_A(MAIN_CLR_MODULE_NAME_A) - #define MSCOREE_SHIM_W MAIN_CLR_DLL_NAME_W #define MSCOREE_SHIM_A MAIN_CLR_DLL_NAME_A #define SWITCHOUT_HANDLE_VALUE ((HANDLE)(LONG_PTR)-2) - -// -// CoInitializeCor flags. -// -typedef enum tagCOINITCOR -{ - COINITCOR_DEFAULT = 0x0 // Default initialization mode. -} COINITICOR; - // // CoInitializeEE flags. // @@ -204,15 +157,6 @@ typedef enum tagCOINITEE COINITEE_MAIN = 0x2 // Initialize prior to entering the main routine } COINITIEE; -// -// CoInitializeEE flags. -// -typedef enum tagCOUNINITEE -{ - COUNINITEE_DEFAULT = 0x0, // Default uninitialization mode. - COUNINITEE_DLL = 0x1 // Uninitialization mode for unloading DLL. -} COUNINITIEE; - //***************************************************************************** //***************************************************************************** // @@ -227,18 +171,6 @@ typedef enum tagCOUNINITEE #include #endif // updates -//***************************************************************************** -//***************************************************************************** -// -// D L L P U B L I C E N T R Y P O I N T D E C L A R A T I O N S -// -//***************************************************************************** -//***************************************************************************** - -DEPRECATED_CLR_STDAPI CoInitializeCor(DWORD fFlags); -DEPRECATED_CLR_STDAPI_(void) CoUninitializeCor(void); - -// //***************************************************************************** //***************************************************************************** @@ -2494,10 +2426,5 @@ inline ULONG CorSigUncompressPointer( // return number of bytes of that compre #endif // __cplusplus -#undef DEPRECATED_CLR_STDAPI_ -#undef DEPRECATED_CLR_STDAPI -#undef DECLARE_DEPRECATED -#undef DEPRECATED_CLR_API_MESG - #endif // _COR_H_ // EOF ======================================================================= diff --git a/src/inc/utilcode.h b/src/inc/utilcode.h index 17c8b14afc..8e866a00a7 100644 --- a/src/inc/utilcode.h +++ b/src/inc/utilcode.h @@ -531,16 +531,8 @@ inline HRESULT OutOfMemory() //***************************************************************************** // Handle accessing localizable resource strings //***************************************************************************** -// NOTE: Should use locale names as much as possible. LCIDs don't support -// custom cultures on Vista+. -// TODO: This should always use the names -#ifdef FEATURE_USE_LCID -typedef LCID LocaleID; -typedef LCID LocaleIDValue; -#else typedef LPCWSTR LocaleID; typedef WCHAR LocaleIDValue[LOCALE_NAME_MAX_LENGTH]; -#endif // Notes about the culture callbacks: // - The language we're operating in can change at *runtime*! @@ -556,12 +548,7 @@ typedef WCHAR LocaleIDValue[LOCALE_NAME_MAX_LENGTH]; // Callback to obtain both the culture name and the culture's parent culture name typedef HRESULT (*FPGETTHREADUICULTURENAMES)(__inout StringArrayList* pCultureNames); -#ifdef FEATURE_USE_LCID -// Callback to return the culture ID. -const LCID UICULTUREID_DONTCARE = (LCID)-1; -#else const LPCWSTR UICULTUREID_DONTCARE = NULL; -#endif typedef int (*FPGETTHREADUICULTUREID)(LocaleIDValue*); @@ -571,18 +558,9 @@ HMODULE CLRLoadLibraryEx(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags); BOOL CLRFreeLibrary(HMODULE hModule); -// Prevent people from using LoadStringRC & LoadStringRCEx from inside the product since it -// causes issues with having the wrong version picked up inside the shim. -#define LoadStringRC __error("From inside the CLR, use UtilLoadStringRC; LoadStringRC is only meant to be exported.") -#define LoadStringRCEx __error("From inside the CLR, use UtilLoadStringRCEx; LoadStringRC is only meant to be exported.") - // Load a string using the resources for the current module. STDAPI UtilLoadStringRC(UINT iResouceID, __out_ecount (iMax) LPWSTR szBuffer, int iMax, int bQuiet=FALSE); -#ifdef FEATURE_USE_LCID -STDAPI UtilLoadStringRCEx(LCID lcid, UINT iResourceID, __out_ecount (iMax) LPWSTR szBuffer, int iMax, int bQuiet, int *pcwchUsed); -#endif - // Specify callbacks so that UtilLoadStringRC can find out which language we're in. // If no callbacks specified (or both parameters are NULL), we default to the // resource dll in the root (which is probably english). @@ -647,12 +625,8 @@ public: _ASSERTE(m_hInst != NULL || m_fMissing); if (id == UICULTUREID_DONTCARE) return FALSE; - -#ifdef FEATURE_USE_LCID - return id == m_LangId; -#else + return wcscmp(id, m_LangId) == 0; -#endif } HRESOURCEDLL GetLibraryHandle() @@ -687,9 +661,6 @@ public: private: void SetId(LocaleID id) { -#ifdef FEATURE_USE_LCID - m_LangId = id; -#else if (id != UICULTUREID_DONTCARE) { wcsncpy_s(m_LangId, NumItems(m_LangId), id, NumItems(m_LangId)); @@ -699,7 +670,6 @@ public: { m_LangId[0] = W('\0'); } -#endif } }; diff --git a/src/utilcode/ccomprc.cpp b/src/utilcode/ccomprc.cpp index 26308e53aa..9e7ac65728 100644 --- a/src/utilcode/ccomprc.cpp +++ b/src/utilcode/ccomprc.cpp @@ -49,42 +49,9 @@ int GetMUILanguageID(LocaleIDValue* pResult) #endif } CONTRACTL_END; -#if FEATURE_USE_LCID - int langId=0; - static PFNGETUSERDEFAULTUILANGUAGE pfnGetUserDefaultUILanguage=NULL; - if( NULL == pfnGetUserDefaultUILanguage ) - { - PFNGETUSERDEFAULTUILANGUAGE proc = NULL; - - HMODULE hmod = GetModuleHandleA(WINDOWS_KERNEL32_DLLNAME_A); - - if( hmod ) - proc = (PFNGETUSERDEFAULTUILANGUAGE) - GetProcAddress(hmod, "GetUserDefaultUILanguage"); - - if(proc == NULL) - proc = (PFNGETUSERDEFAULTUILANGUAGE) -1; - - PVOID value = InterlockedExchangeT(&pfnGetUserDefaultUILanguage, - proc); - } - - // We should never get NULL here, the function is -1 or a valid address. - _ASSERTE(pfnGetUserDefaultUILanguage != NULL); - - - if( pfnGetUserDefaultUILanguage == (PFNGETUSERDEFAULTUILANGUAGE) -1) - langId = GetSystemDefaultLangID(); - else - langId = pfnGetUserDefaultUILanguage(); - - *pResult= langId; -#else // FEATURE_USE_LCID _ASSERTE(sizeof(LocaleID)/sizeof(WCHAR) >=LOCALE_NAME_MAX_LENGTH); return ::GetSystemDefaultLocaleName(*pResult, LOCALE_NAME_MAX_LENGTH); -#endif //FEATURE_USE_LCID - return 1; } static void BuildMUIDirectory(int langid, __out SString* pResult) @@ -113,13 +80,7 @@ void GetMUILanguageName(__out SString* pResult) LocaleIDValue langid; GetMUILanguageID(&langid); - int lcid; -#ifdef FEATURE_USE_LCID - lcid=langid; -#else - lcid=::LocaleNameToLCID(langid,0); -#endif - + int lcid = ::LocaleNameToLCID(langid,0); return BuildMUIDirectory(lcid, pResult); } diff --git a/src/utilcode/ex.cpp b/src/utilcode/ex.cpp index 4eaaf3d2ab..feeeb9540e 100644 --- a/src/utilcode/ex.cpp +++ b/src/utilcode/ex.cpp @@ -1160,11 +1160,7 @@ void GetHRMsg(HRESULT hr, SString &result, BOOL bNoGeekStuff/* = FALSE*/) DWORD dwFlags = FORMAT_MESSAGE_FROM_SYSTEM; dwFlags |= FORMAT_MESSAGE_MAX_WIDTH_MASK; -#if FEATURE_USE_LCID - fHaveDescr = strDescr.FormatMessage(dwFlags, 0, hr, LANG_USER_DEFAULT); -#else fHaveDescr = strDescr.FormatMessage(dwFlags, 0, hr, 0); -#endif } LPCSTR name = Exception::GetHRSymbolicName(hr); diff --git a/src/utilcode/posterror.cpp b/src/utilcode/posterror.cpp index a15128add9..c0f66c4f7f 100644 --- a/src/utilcode/posterror.cpp +++ b/src/utilcode/posterror.cpp @@ -99,46 +99,6 @@ HRESULT UtilLoadResourceString(CCompRC::ResourceCategory eCategory, UINT iResour return retVal; } -#ifdef FEATURE_USE_LCID -STDAPI UtilLoadStringRCEx( - LCID lcid, - UINT iResourceID, - __out_ecount(iMax) LPWSTR szBuffer, - int iMax, - int bQuiet, - int *pcwchUsed -) -{ - CONTRACTL - { - DISABLED(NOTHROW); - GC_NOTRIGGER; - } - CONTRACTL_END; - - HRESULT retVal = E_OUTOFMEMORY; - - EX_TRY - { - SString::Startup(); - CCompRC *pResourceDLL = CCompRC::GetDefaultResourceDll(); - - if (pResourceDLL != NULL) - { - retVal = pResourceDLL->LoadString(bQuiet? CCompRC::Optional : CCompRC::Required,lcid, iResourceID, szBuffer, iMax, pcwchUsed); - } - } - EX_CATCH - { - // Catch any errors and return E_OUTOFMEMORY; - retVal = E_OUTOFMEMORY; - } - EX_END_CATCH(SwallowAllExceptions); - - return retVal; -} -#endif //FEATURE_USE_LCID - //***************************************************************************** // Format a Runtime Error message. //***************************************************************************** @@ -174,15 +134,9 @@ HRESULT __cdecl FormatRuntimeErrorVa( // find the text for it. else { -#ifdef FEATURE_USE_LCID - if (WszFormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, - 0, hrRpt, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - rcMsg, cchMsg, 0/*@todo: marker*/)) -#else if (WszFormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, hrRpt, 0, rcMsg, cchMsg, 0/*@todo: marker*/)) -#endif { hr = S_OK; diff --git a/src/utilcode/sstring.cpp b/src/utilcode/sstring.cpp index c2467b8485..bd2cf6fe85 100644 --- a/src/utilcode/sstring.cpp +++ b/src/utilcode/sstring.cpp @@ -73,11 +73,7 @@ static WCHAR MapChar(WCHAR wc, DWORD dwFlags) #ifndef FEATURE_PAL -#ifdef FEATURE_USE_LCID - int iRet = WszLCMapString(MAKELCID(LOCALE_INVARIANT, SORT_DEFAULT), dwFlags, &wc, 1, &wTmp, 1); -#else int iRet = ::LCMapStringEx(LOCALE_NAME_INVARIANT, dwFlags, &wc, 1, &wTmp, 1, NULL, NULL, 0); -#endif if (!iRet) { // This can fail in non-exceptional cases becauseof unknown unicode characters. wTmp = wc; diff --git a/src/vm/ceemain.cpp b/src/vm/ceemain.cpp index 3b02b31397..ac80feb55b 100644 --- a/src/vm/ceemain.cpp +++ b/src/vm/ceemain.cpp @@ -1162,44 +1162,6 @@ void InnerCoEEShutDownCOM() #endif } -// --------------------------------------------------------------------------- -// %%Function: CoEEShutdownCOM() -// -// Parameters: -// none -// -// Returns: -// Nothing -// -// Description: -// COM Objects shutdown stuff should be done here -// --------------------------------------------------------------------------- -void STDMETHODCALLTYPE CoEEShutDownCOM() -{ - - CONTRACTL - { - NOTHROW; - GC_TRIGGERS; - MODE_PREEMPTIVE; - ENTRY_POINT; - } CONTRACTL_END; - - if (g_fEEStarted != TRUE) - return; - - HRESULT hr; - BEGIN_EXTERNAL_ENTRYPOINT(&hr) - - InnerCoEEShutDownCOM(); - - END_EXTERNAL_ENTRYPOINT; - - // API doesn't allow us to communicate a failure HRESULT. MDAs can - // be enabled to catch failure inside CanRunManagedCode. - // _ASSERTE(SUCCEEDED(hr)); -} - #endif // FEATURE_COMINTEROP // --------------------------------------------------------------------------- @@ -2030,65 +1992,6 @@ BOOL CanRunManagedCode(LoaderLockCheck::kind checkKind, HINSTANCE hInst /*= 0*/) } #include - -// --------------------------------------------------------------------------- -// %%Function: CoInitializeEE(DWORD fFlags) -// -// Parameters: -// fFlags - Initialization flags for the engine. See the -// COINITIEE enumerator for valid values. -// -// Returns: -// Nothing -// -// Description: -// Initializes the EE if it hasn't already been initialized. This function -// no longer maintains a ref count since the EE doesn't support being -// unloaded and re-loaded. It simply ensures the EE has been started. -// --------------------------------------------------------------------------- -HRESULT STDAPICALLTYPE CoInitializeEE(DWORD fFlags) -{ - CONTRACTL - { - NOTHROW; - GC_TRIGGERS; - MODE_PREEMPTIVE; - } - CONTRACTL_END; - - HRESULT hr = S_OK; - BEGIN_ENTRYPOINT_NOTHROW; - hr = InitializeEE((COINITIEE)fFlags); - END_ENTRYPOINT_NOTHROW; - - return hr; -} - -// --------------------------------------------------------------------------- -// %%Function: CoUninitializeEE -// -// Parameters: -// BOOL fIsDllUnloading :: is it safe point for full cleanup -// -// Returns: -// Nothing -// -// Description: -// Must be called by client on shut down in order to free up the system. -// --------------------------------------------------------------------------- -void STDAPICALLTYPE CoUninitializeEE(BOOL fIsDllUnloading) -{ - LIMITED_METHOD_CONTRACT; - //BEGIN_ENTRYPOINT_VOIDRET; - - // This API is unfortunately publicly exported so we cannot get rid - // of it. However since the EE doesn't currently support being unloaded - // and re-loaded, it is useless to do any ref counting here or to pretend - // to unload it. The proper way to shutdown the EE is to call CorExitProcess. - //END_ENTRYPOINT_VOIDRET; - -} - //***************************************************************************** BOOL ExecuteDLL_ReturnOrThrow(HRESULT hr, BOOL fFromThunk) { @@ -2500,16 +2403,7 @@ static HRESULT GetThreadUICultureNames(__inout StringArrayList* pCultureNames) int tmp; tmp = GetThreadUICultureId(&id); // TODO: We should use the name instead _ASSERTE(tmp!=0 && id != UICULTUREID_DONTCARE); SIZE_T cchParentCultureName=LOCALE_NAME_MAX_LENGTH; -#ifdef FEATURE_USE_LCID - SIZE_T cchCultureName=LOCALE_NAME_MAX_LENGTH; - if (!::LCIDToLocaleName(id, sCulture.OpenUnicodeBuffer(static_cast(cchCultureName)), static_cast(cchCultureName), 0)) - { - hr = HRESULT_FROM_GetLastError(); - } - sCulture.CloseBuffer(); -#else sCulture.Set(id); -#endif #ifndef FEATURE_PAL if (!::GetLocaleInfoEx((LPCWSTR)sCulture, LOCALE_SPARENT, sParentCulture.OpenUnicodeBuffer(static_cast(cchParentCultureName)),static_cast(cchParentCultureName))) @@ -2567,80 +2461,6 @@ INT32 GetLatchedExitCode (void) // Impl for UtilLoadStringRC Callback: In VM, we let the thread decide culture // Return an int uniquely describing which language this thread is using for ui. // --------------------------------------------------------------------------- -// TODO: Callers should use names, not LCIDs -#ifdef FEATURE_USE_LCID -static int GetThreadUICultureId(__out LocaleIDValue* pLocale) -{ - CONTRACTL{ - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - } CONTRACTL_END; - - - - int Result = UICULTUREID_DONTCARE; - - Thread * pThread = GetThread(); - -#if 0 // Enable and test if/once the unmanaged runtime is localized - // When fatal errors have occured our invariants around GC modes may be broken and attempting to transition to co-op may hang - // indefinately. We want to ensure a clean exit so rather than take the risk of hang we take a risk of the error resource not - // getting localized with a non-default thread-specific culture. - // A canonical stack trace that gets here is a fatal error in the GC that comes through: - // coreclr.dll!GetThreadUICultureNames - // coreclr.dll!CCompRC::LoadLibraryHelper - // coreclr.dll!CCompRC::LoadLibrary - // coreclr.dll!CCompRC::GetLibrary - // coreclr.dll!CCompRC::LoadString - // coreclr.dll!CCompRC::LoadString - // coreclr.dll!SString::LoadResourceAndReturnHR - // coreclr.dll!SString::LoadResourceAndReturnHR - // coreclr.dll!SString::LoadResource - // coreclr.dll!EventReporter::EventReporter - // coreclr.dll!EEPolicy::LogFatalError - // coreclr.dll!EEPolicy::HandleFatalError - if (pThread != NULL && !g_fFatalErrorOccuredOnGCThread) - { - // Switch to cooperative mode, since we'll be looking at managed objects - // and we don't want them moving on us. - GCX_COOP(); - - CULTUREINFOBASEREF pCurrentCulture = (CULTUREINFOBASEREF)Thread::GetCulture(TRUE); - - if (pCurrentCulture != NULL) - { - STRINGREF cultureName = pCurrentCulture->GetName(); - _ASSERT(cultureName != NULL); - - if ((Result = ::LocaleNameToLCID(cultureName->GetBuffer(), 0)) == 0) - Result = (int)UICULTUREID_DONTCARE; - } - } -#endif - - if (Result == (int)UICULTUREID_DONTCARE) - { - // This thread isn't set up to use a non-default culture. Let's grab the default - // one and return that. - - Result = COMNlsInfo::CallGetUserDefaultUILanguage(); - - if (Result == 0 || Result == (int)UICULTUREID_DONTCARE) - Result = GetUserDefaultLangID(); - - _ASSERTE(Result != 0); - if (Result == 0) - { - Result = (int)UICULTUREID_DONTCARE; - } - - } - *pLocale=Result; - return Result; -} -#else -// TODO: Callers should use names, not LCIDs static int GetThreadUICultureId(__out LocaleIDValue* pLocale) { CONTRACTL{ @@ -2716,9 +2536,6 @@ static int GetThreadUICultureId(__out LocaleIDValue* pLocale) return Result; } -#endif // FEATURE_USE_LCID - - #ifdef ENABLE_CONTRACTS_IMPL // Returns TRUE if any contract violation suppressions are in effect. diff --git a/src/vm/corhost.cpp b/src/vm/corhost.cpp index dfbf48c890..5ddaa7754c 100644 --- a/src/vm/corhost.cpp +++ b/src/vm/corhost.cpp @@ -60,7 +60,6 @@ UINT32 _tls_index = 0; #ifndef DACCESS_COMPILE extern void STDMETHODCALLTYPE EEShutDown(BOOL fIsDllUnloading); -extern HRESULT STDAPICALLTYPE CoInitializeEE(DWORD fFlags); extern void PrintToStdOutA(const char *pszString); extern void PrintToStdOutW(const WCHAR *pwzString); extern BOOL g_fEEHostedStartup; -- cgit v1.2.3