Editing or creating a linked dll file


I have a simple exe file linked to a dll file, and it uses one function from it - GetHour (which simply returns the current time).
I want to change the dll file and insert my own function so that everytime the exe runs, a new file with some text in it will be created. Unforunately, I'm having trouble doing so.
I can't open the dll file with DotPeek, probably because it's not .NET (I don't fully understand what that means).
I tried writing a new dll file, with its own GetHour function, but failed due to the following error:

The application was unable to start correctly (0xc000007b)

I don't really know how to deal with both my problems, and would really appreciate some help. Thanks in advance.

asked on Stack Overflow Aug 3, 2020 by lior sharon • edited Aug 3, 2020 by Roman Sklyarov

1 Answer


.NET (I don't fully understand what that means).

On windows, you have two "types" of DLLs. You have "normal" DLLs, that contain native code (=Machine code) and .NET DLLs that contain the IL that was emitted by the C#-compiler (for example). See here for details

DLL files are PE files, so they follow a special fileformat and if the DLL you created doesn't match, you will get this error. Editing a PE file in a hexeditor is quite difficult and errorprone.

There are tools like PE-Explorer, that will help you to fulfill your task, but they often require a good knowledge about the PE File format.

answered on Stack Overflow Aug 3, 2020 by JCWasmx86 • edited Aug 3, 2020 by JCWasmx86

User contributions licensed under CC BY-SA 3.0