-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Delete extra layers #116405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Delete extra layers #116405
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,16 +6,7 @@ | |
| #include "stdafx.h" // Standard header. | ||
|
|
||
| #include <utilcode.h> // Utility helpers. | ||
| #include <posterror.h> // Error handlers | ||
| #define INIT_GUIDS | ||
| #include <corpriv.h> | ||
| #include <winwrap.h> | ||
| #include <mscoree.h> | ||
| #include "shimload.h" | ||
| #include "metadataexports.h" | ||
| #include "ex.h" | ||
|
|
||
| #include <dbgenginemetrics.h> | ||
|
|
||
| #if !defined(CORECLR_EMBEDDED) | ||
|
|
||
|
|
@@ -45,18 +36,16 @@ BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved) | |
|
|
||
| #endif // !defined(CORECLR_EMBEDDED) | ||
|
|
||
| extern void* GetClrModuleBase(); | ||
|
|
||
| // --------------------------------------------------------------------------- | ||
| // %%Function: MetaDataGetDispenser | ||
| // This function gets the Dispenser interface given the CLSID and REFIID. | ||
| // Exported from coreclr and used by external profilers. | ||
| // --------------------------------------------------------------------------- | ||
| STDAPI DLLEXPORT MetaDataGetDispenser( // Return HRESULT | ||
| STDAPI DLLEXPORT MetaDataGetDispenser( // Return HRESULT | ||
| REFCLSID rclsid, // The class to desired. | ||
| REFIID riid, // Interface wanted on class factory. | ||
| LPVOID FAR *ppv) // Return interface pointer here. | ||
| { | ||
|
|
||
| CONTRACTL { | ||
| NOTHROW; | ||
| GC_NOTRIGGER; | ||
|
|
@@ -69,208 +58,3 @@ STDAPI DLLEXPORT MetaDataGetDispenser( // Return HRESULT | |
|
|
||
| return CreateMetaDataDispenser(riid, ppv); | ||
| } | ||
|
|
||
| // --------------------------------------------------------------------------- | ||
| // %%Function: GetMetaDataInternalInterface | ||
| // This function gets the IMDInternalImport given the metadata on memory. | ||
| // --------------------------------------------------------------------------- | ||
| STDAPI DLLEXPORT GetMetaDataInternalInterface( | ||
| LPVOID pData, // [IN] in memory metadata section | ||
| ULONG cbData, // [IN] size of the metadata section | ||
| DWORD flags, // [IN] MDInternal_OpenForRead or MDInternal_OpenForENC | ||
| REFIID riid, // [IN] desired interface | ||
| void **ppv) // [OUT] returned interface | ||
| { | ||
| CONTRACTL{ | ||
| NOTHROW; | ||
| GC_NOTRIGGER; | ||
| ENTRY_POINT; | ||
| PRECONDITION(CheckPointer(pData)); | ||
| PRECONDITION(CheckPointer(ppv)); | ||
| } CONTRACTL_END; | ||
|
|
||
| return GetMDInternalInterface(pData, cbData, flags, riid, ppv); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The exact same thing was exposed under two different names. None of this is exported in CoreCLR, so it is fine to delete the extra layer. |
||
| } | ||
|
|
||
| // --------------------------------------------------------------------------- | ||
| // %%Function: GetMetaDataInternalInterfaceFromPublic | ||
| // This function gets the internal scopeless interface given the public | ||
| // scopeless interface. | ||
| // --------------------------------------------------------------------------- | ||
| STDAPI DLLEXPORT GetMetaDataInternalInterfaceFromPublic( | ||
| IUnknown *pv, // [IN] Given interface. | ||
| REFIID riid, // [IN] desired interface | ||
| void **ppv) // [OUT] returned interface | ||
| { | ||
| CONTRACTL{ | ||
| NOTHROW; | ||
| GC_NOTRIGGER; | ||
| ENTRY_POINT; | ||
| PRECONDITION(CheckPointer(pv)); | ||
| PRECONDITION(CheckPointer(ppv)); | ||
| } CONTRACTL_END; | ||
|
|
||
| return GetMDInternalInterfaceFromPublic(pv, riid, ppv); | ||
| } | ||
|
|
||
| // --------------------------------------------------------------------------- | ||
| // %%Function: GetMetaDataPublicInterfaceFromInternal | ||
| // This function gets the public scopeless interface given the internal | ||
| // scopeless interface. | ||
| // --------------------------------------------------------------------------- | ||
| STDAPI DLLEXPORT GetMetaDataPublicInterfaceFromInternal( | ||
| void *pv, // [IN] Given interface. | ||
| REFIID riid, // [IN] desired interface. | ||
| void **ppv) // [OUT] returned interface | ||
| { | ||
| CONTRACTL{ | ||
| NOTHROW; | ||
| GC_NOTRIGGER; | ||
| PRECONDITION(CheckPointer(pv)); | ||
| PRECONDITION(CheckPointer(ppv)); | ||
| ENTRY_POINT; | ||
| } CONTRACTL_END; | ||
|
|
||
| return GetMDPublicInterfaceFromInternal(pv, riid, ppv); | ||
| } | ||
|
|
||
|
|
||
| // --------------------------------------------------------------------------- | ||
| // %%Function: ReopenMetaDataWithMemory | ||
| // This function gets the public scopeless interface given the internal | ||
| // scopeless interface. | ||
| // --------------------------------------------------------------------------- | ||
| STDAPI ReOpenMetaDataWithMemory( | ||
| void *pUnk, // [IN] Given scope. public interfaces | ||
| LPCVOID pData, // [in] Location of scope data. | ||
| ULONG cbData) // [in] Size of the data pointed to by pData. | ||
| { | ||
| CONTRACTL{ | ||
| NOTHROW; | ||
| GC_NOTRIGGER; | ||
| ENTRY_POINT; | ||
| PRECONDITION(CheckPointer(pUnk)); | ||
| PRECONDITION(CheckPointer(pData)); | ||
| } CONTRACTL_END; | ||
|
|
||
| return MDReOpenMetaDataWithMemory(pUnk, pData, cbData); | ||
| } | ||
|
|
||
| // --------------------------------------------------------------------------- | ||
| // %%Function: ReopenMetaDataWithMemoryEx | ||
| // This function gets the public scopeless interface given the internal | ||
| // scopeless interface. | ||
| // --------------------------------------------------------------------------- | ||
| STDAPI ReOpenMetaDataWithMemoryEx( | ||
| void *pUnk, // [IN] Given scope. public interfaces | ||
| LPCVOID pData, // [in] Location of scope data. | ||
| ULONG cbData, // [in] Size of the data pointed to by pData. | ||
| DWORD dwReOpenFlags) // [in] ReOpen flags | ||
| { | ||
| CONTRACTL{ | ||
| NOTHROW; | ||
| GC_NOTRIGGER; | ||
| ENTRY_POINT; | ||
| PRECONDITION(CheckPointer(pUnk)); | ||
| PRECONDITION(CheckPointer(pData)); | ||
| } CONTRACTL_END; | ||
|
|
||
| return MDReOpenMetaDataWithMemoryEx(pUnk, pData, cbData, dwReOpenFlags); | ||
| } | ||
|
|
||
| static DWORD g_dwSystemDirectory = 0; | ||
| static WCHAR * g_pSystemDirectory = NULL; | ||
|
|
||
| HRESULT GetInternalSystemDirectory(_Out_writes_to_opt_(*pdwLength,*pdwLength) LPWSTR buffer, __inout DWORD* pdwLength) | ||
| { | ||
| CONTRACTL { | ||
| NOTHROW; | ||
| GC_NOTRIGGER; | ||
| PRECONDITION(CheckPointer(buffer, NULL_OK)); | ||
| PRECONDITION(CheckPointer(pdwLength)); | ||
| } CONTRACTL_END; | ||
|
|
||
| if (g_dwSystemDirectory == 0) | ||
| SetInternalSystemDirectory(); | ||
|
|
||
| // | ||
| // g_dwSystemDirectory includes the NULL in its count! | ||
| // | ||
| if(*pdwLength < g_dwSystemDirectory) | ||
| { | ||
| *pdwLength = g_dwSystemDirectory; | ||
| return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); | ||
| } | ||
|
|
||
| if (buffer != NULL) | ||
| { | ||
| // | ||
| // wcsncpy_s will automatically append a null and g_dwSystemDirectory | ||
| // includes the null in its count, so we have to subtract 1. | ||
| // | ||
| wcsncpy_s(buffer, *pdwLength, g_pSystemDirectory, g_dwSystemDirectory-1); | ||
| } | ||
| *pdwLength = g_dwSystemDirectory; | ||
| return S_OK; | ||
| } | ||
|
|
||
|
|
||
| LPCWSTR GetInternalSystemDirectory(_Out_ DWORD* pdwLength) | ||
| { | ||
| LIMITED_METHOD_CONTRACT; | ||
|
|
||
| if (g_dwSystemDirectory == 0) | ||
| { | ||
| SetInternalSystemDirectory(); | ||
| } | ||
|
|
||
| if (pdwLength != NULL) | ||
| { | ||
| * pdwLength = g_dwSystemDirectory; | ||
| } | ||
|
|
||
| return g_pSystemDirectory; | ||
| } | ||
|
|
||
|
|
||
| HRESULT SetInternalSystemDirectory() | ||
| { | ||
| CONTRACTL { | ||
| NOTHROW; | ||
| GC_NOTRIGGER; | ||
| } CONTRACTL_END; | ||
|
|
||
| HRESULT hr = S_OK; | ||
| if(g_dwSystemDirectory == 0) { | ||
|
|
||
| DWORD len = 0; | ||
| NewArrayHolder<WCHAR> pSystemDirectory; | ||
| EX_TRY{ | ||
|
|
||
| // use local buffer for thread safety | ||
| PathString wzSystemDirectory; | ||
| hr = GetClrModuleDirectory(wzSystemDirectory); | ||
|
|
||
| if (FAILED(hr)) { | ||
| wzSystemDirectory.Set(W('\0')); | ||
| } | ||
|
|
||
| pSystemDirectory = wzSystemDirectory.GetCopyOfUnicodeString(); | ||
| if (pSystemDirectory == NULL) | ||
| { | ||
| hr = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY); | ||
| } | ||
| len = wzSystemDirectory.GetCount() + 1; | ||
|
|
||
| } | ||
| EX_CATCH_HRESULT(hr); | ||
|
|
||
| // publish results idempotently with correct memory ordering | ||
| g_pSystemDirectory = pSystemDirectory.Extract(); | ||
|
|
||
| (void)InterlockedExchange((LONG *)&g_dwSystemDirectory, len); | ||
| } | ||
|
|
||
| return hr; | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.