I'm writing a native CLR Profiler which does some heavy IL rewriting. When developing a new feature, we sometimes encounter a CLR verification error. For small methods, it's pretty easy to compare the bytes before and after, looking at the various elements (method header, signature, locals, code and exception table, mostly) and finding the error. Sometimes, this can be on huge methods and the process might take a while. I'm trying to dump the current module to a file, in order to easily run peverify.exe (and https://github.com/dotnet/corert/tree/master/src/ILVerify). I found IMetaDataEmit::Save, which looks perfect on paper (we're using IMetaDataEmit constantly to perform the IL rewriting). I can dump my module, open it in a hex viewer and see the changes I made. However, it only dumps the module (the .Net directory inside the PE). How can I create a full PE (dll/exe) from this module, preferably programmatically?
Creating a PE file using IMetaDataEmit::Save(/ToMemory/ToStream)
205 Views Asked by Egozy At
0
There are 0 best solutions below
Related Questions in WINAPI
- How to immediately apply DISPLAYCONFIG_SCALING display scaling mode with SetDisplayConfig and DISPLAYCONFIG_PATH_TARGET_INFO
- Changing the theme of a #32768 (menu) window class at runtime
- Issue with GetOpenFileName while debugging
- How to populate a ListBox with SendMessage?
- Is there a function to end a child process?
- HDR video publishing
- Frameless Qt + WinAPI maximized window size is bigger than the availableGeometry()
- Mount .iso file with python
- What is Win32 x86-64 CONTEXT::VectorRegister for?
- WinAPI - right mouse drag & drop and IContextMenu
- Win32 per-filesystem cache tuning?
- Client connection timeout during Android & Windows PC communication via sockets
- MessageBoxEx sometimes shows as hollow window, border only, and only on Windows 11
- Win32api send message and Pydirectinput and Powertoy (Keyboard Manager ) Not working when open the application
- Would it be possible to run an application right after csrss.exe loads? (Windows)
Related Questions in CLR
- Making a CLI CPP project from static library to DLL is causing LNK2020 linking errors
- Does CLR add overhead fields to type which value is null?
- Where and how are IL opcodes implemented in the .NET runtime source code
- SQL Server Error 15441 - Database is no longer enabled for subscriptions
- What does 'has a SUC' mean?
- Looking for clr/cli code where a structure is returned from c# method to win32 vc++ dll
- Visual Studio 2022 CLR Empty Project (.NET Framework) entry point is not working, even after being set
- Creating a stored procedure in SQL Server using the CLR assembly (C#)
- Do we have to use `CompareExchange` rather than `Exchange` in a hybridLock lock that uses AutoResetEvent?
- what Win32 funcntion does WaitOneCore call internally?
- The Common Language Runtime (CLR) was loaded in an unsupported manner
- How to get a list of all packages that a .NET solution ACTUALLY requires?
- How to call a delegate in C# (Windows forms) from an unmanaged C++ dll
- Exception code c0020001 on shutdown - how to determine which managed code function didn't run?
- How to use python callback function to get return string values from a C# Dll method
Related Questions in CIL
- Boxing System.RuntimeArgumentHandle
- Where and how are IL opcodes implemented in the .NET runtime source code
- .NET reflection emit - what am I doing wrong in writing this method in MSIL?
- View Intermediate Language code in Visual Studio
- How to parse a method invocation in IL bytes?
- How are memory allocations handled in "bytecode based" languages?
- Using Harmony to patch the real content of an async method for a Unity game
- Undefined behavior when trying to Memory.Slice using il.Emit
- How to emit IL for ref locals using ILGenerator?
- CIL code parses "15" into 15,000000000000004
- CIL shows `box` ops when the generic type is constrained to a class
- Is the C# compiler able to optimize a statement like someEnumerable.Count() < 2?
- Why is there a `.constrained` opcode preceeding the `call` opcode when calling an abstract static function?
- C# find what the last interacted with instance in the call stack is
- Insert method call into setter causes Invalid IL code
Related Questions in CLR-PROFILING-API
- In ASP.NET Core 5 MVC app, ControllerActionInvoker.InvokeActionAsync method seems to be called twice in the same thread simultaneously?
- Why is the implementation of ICorProfilerCallback::Initialize( IUnknown*) returning success and SETEVENTMASK failing (segmentation fault)?
- why full name of method on ilspy appear with slash?
- How to query profiler instrumented IL code address using Windbg and SOS extension?
- Can't start CLRprofiler on WSL on Windows 11, but it works on Windows 10
- Signature of generic MethodRefs in .NET Profiler API
- .NET Profiler - Filter out .Net Framework Functions
- .NET profiling api - calculate time taken to execute async method
- IMetaDataEmit::DefineUserString returns HRESULT: -2147024882 (0x8007000E E_OUTOFMEMORY)
- Parsing the COR_PRF_FUNCTION_ARGUMENT_INFO Structure
- .NET Profiler - Getting The Type Of A Function Parameter
- How to get the value from the byte array object using ICorProfilerInfo2
- Can we invoke a method from a class using IMetaDataImport2 in CLR profiling?
- How to get COR_PRF_FUNCTION_ARGUMENT_INFO from COR_PRF_ELT_INFO using GetFunctionEnter3Info function in ICorProfilerInfo3 interface
- Which method I should track to know a new request comes into .net core application
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?