Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/coreclr/binder/bindertracing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ namespace BinderTracing
if (mvidMismatch)
{
StackSString format;
format.LoadResource(CCompRC::Error, IDS_EE_FILELOAD_ERROR_GENERIC);
format.LoadResource(IDS_EE_FILELOAD_ERROR_GENERIC);
StackSString details;
details.LoadResource(CCompRC::Error, IDS_HOST_ASSEMBLY_RESOLVER_ASSEMBLY_ALREADY_LOADED_IN_CONTEXT);
details.LoadResource(IDS_HOST_ASSEMBLY_RESOLVER_ASSEMBLY_ALREADY_LOADED_IN_CONTEXT);
errorMsg.FormatMessage(FORMAT_MESSAGE_FROM_STRING, format.GetUnicode(), 0, 0, m_assemblyName, details);
}

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ endif (CLR_CMAKE_HOST_UNIX AND NOT CLR_CMAKE_TARGET_ARCH_WASM)
# order dependent and changing the order can result in undefined symbols in the shared
# library.
set(CORECLR_LIBRARIES
mscorrc
utilcode
${START_LIBRARY_GROUP} # Start group of libraries that have circular references
${LIB_CORDBEE}
Expand Down Expand Up @@ -137,7 +138,6 @@ if(CLR_CMAKE_TARGET_WIN32)
else()
list(APPEND CORECLR_LIBRARIES
coreclrpal
mscorrc
)
endif(CLR_CMAKE_TARGET_WIN32)

Expand Down
13 changes: 1 addition & 12 deletions src/coreclr/dlls/mscorrc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,9 @@ include_directories("../../pal/prebuilt/corerror")
add_definitions(-DFX_VER_INTERNALNAME_STR=mscorrc.dll)

if(CLR_CMAKE_HOST_WIN32)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NOENTRY")

# remove /guard:cf, /guard:ehcont, and /CETCOMPAT from resource-only libraries
set_property(DIRECTORY PROPERTY CLR_CONTROL_FLOW_GUARD OFF)

if (CLR_CMAKE_HOST_ARCH_AMD64)
set_property(DIRECTORY PROPERTY CLR_EH_CONTINUATION OFF)
string(REPLACE "/CETCOMPAT" "" CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS})
endif (CLR_CMAKE_HOST_ARCH_AMD64)

add_library_clr(mscorrc SHARED
add_library_clr(mscorrc OBJECT
include.rc
)
install_clr(TARGETS mscorrc DESTINATIONS . sharedFramework COMPONENT runtime)

else()
build_resources(${CMAKE_CURRENT_SOURCE_DIR}/include.rc mscorrc TARGET_CPP_FILE)
Expand Down
7 changes: 0 additions & 7 deletions src/coreclr/dlls/mscorrc/mscorrc.rc
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@

#include <winresrc.h>

#ifndef FX_VER_FILEDESCRIPTION_STR
#define FX_VER_FILEDESCRIPTION_STR ".NET Runtime resources"
#endif

#include <fxver.h>
#include <fxver.rc>

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/inc/sstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -572,8 +572,8 @@ class EMPTY_BASES_DECL SString : private SBuffer
void AppendVPrintf(const CHAR *format, va_list args);

public:
BOOL LoadResource(CCompRC::ResourceCategory eCategory, int resourceID);
HRESULT LoadResourceAndReturnHR(CCompRC::ResourceCategory eCategory, int resourceID);
BOOL LoadResource(int resourceID);
HRESULT LoadResourceAndReturnHR(int resourceID);
BOOL FormatMessage(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId,
const SString &arg1 = Empty(), const SString &arg2 = Empty(),
const SString &arg3 = Empty(), const SString &arg4 = Empty(),
Expand Down
118 changes: 2 additions & 116 deletions src/coreclr/inc/utilcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,6 @@ HMODULE CLRLoadLibraryEx(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);

BOOL CLRFreeLibrary(HMODULE hModule);

// Load a string using the resources for the current module.
STDAPI UtilLoadStringRC(UINT iResourceID, _Out_writes_ (iMax) LPWSTR szBuffer, int iMax, int bQuiet=FALSE);

//*****************************************************************************
// Use this class by privately deriving from noncopyable to disallow copying of
// your class.
Expand All @@ -369,126 +366,15 @@ class noncopyable
};

//*****************************************************************************
// Must associate each handle to an instance of a resource dll with the int
// that it represents
//*****************************************************************************
typedef HINSTANCE HRESOURCEDLL;


class CCulturedHInstance
{
HRESOURCEDLL m_hInst;
BOOL m_fMissing;

public:
CCulturedHInstance()
{
LIMITED_METHOD_CONTRACT;
m_hInst = NULL;
m_fMissing = FALSE;
}

HRESOURCEDLL GetLibraryHandle()
{
return m_hInst;
}

BOOL IsSet()
{
return m_hInst != NULL;
}

BOOL IsMissing()
{
return m_fMissing;
}

void SetMissing()
{
_ASSERTE(m_hInst == NULL);
m_fMissing = TRUE;
}

void Set(HRESOURCEDLL hInst)
{
_ASSERTE(m_hInst == NULL);
_ASSERTE(m_fMissing == FALSE);
m_hInst = hInst;
}
};

//*****************************************************************************
// CCompRC manages string Resource access for CLR. This includes loading
// the MsCorRC.dll for resources. No localization is supported.
// CCompRC manages string Resource access for CLR.
//*****************************************************************************
class CCompRC
{
public:

enum ResourceCategory
{
// must be present
Required,

// present in Desktop CLR and Core CLR + debug pack, an error
// If missing, get a generic error message instead
Error,

// present in Desktop CLR and Core CLR + debug pack, normal operation (e.g tracing)
// if missing, get a generic "resource not found" message instead
Debugging,

// present in Desktop CLR, optional for CoreCLR
DesktopCLR,

// might not be present, non essential
Optional
};

CCompRC()
{
// This constructor will be fired up on startup. Make sure it doesn't
// do anything besides zero-out out values.
m_csMap = NULL;
m_pResourceFile = NULL;
}// CCompRC

HRESULT Init(LPCWSTR pResourceFile);
void Destroy();

HRESULT LoadString(ResourceCategory eCategory, UINT iResourceID, _Out_writes_ (iMax) LPWSTR szBuffer, int iMax , int *pcwchUsed=NULL);

// Get the default resource location (mscorrc.dll)
static CCompRC* GetDefaultResourceDll();

private:
// String resources packaged as PE files only exist on Windows
#ifdef HOST_WINDOWS
HRESULT GetLibrary(HRESOURCEDLL* phInst);
#ifndef DACCESS_COMPILE
HRESULT LoadLibraryHelper(HRESOURCEDLL *pHInst,
SString& rcPath);
HRESULT LoadLibraryThrows(HRESOURCEDLL * pHInst);
HRESULT LoadLibrary(HRESOURCEDLL * pHInst);
HRESULT LoadResourceFile(HRESOURCEDLL * pHInst, LPCWSTR lpFileName);
#endif // DACCESS_COMPILE
#endif // HOST_WINDOWS

// We do not have global constructors any more
static LONG m_dwDefaultInitialized;
static CCompRC m_DefaultResourceDll;
static LPCWSTR m_pDefaultResource;

// Use a singleton since we don't support localization any more.
CCulturedHInstance m_Primary;

CRITSEC_COOKIE m_csMap;

LPCWSTR m_pResourceFile;
static HRESULT LoadString(UINT iResourceID, _Out_writes_ (iMax) LPWSTR szBuffer, int iMax , int *pcwchUsed=NULL);
};

HRESULT UtilLoadResourceString(CCompRC::ResourceCategory eCategory, UINT iResourceID, _Out_writes_ (iMax) LPWSTR szBuffer, int iMax);

// The HRESULT_FROM_WIN32 macro evaluates its arguments three times.
// <TODO>TODO: All HRESULT_FROM_WIN32(GetLastError()) should be replaced by calls to
// this helper function avoid code bloat</TODO>
Expand Down
Loading
Loading