Skip to content
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

The Writing damage my dll ? #457

Closed
HPXCoder opened this issue Mar 15, 2022 · 11 comments
Closed

The Writing damage my dll ? #457

HPXCoder opened this issue Mar 15, 2022 · 11 comments

Comments

@HPXCoder
Copy link

HPXCoder commented Mar 15, 2022

hi sir,
am just read the dll and write it and its been damaged
there is very big difference between the original dll size and the written dll
as shown in pic
err

and i have used the metadata flags [preserve all & keep old stack]

options.MetadataOptions.Flags = MetadataFlags.PreserveAll;
options.MetadataOptions.Flags |= MetadataFlags.KeepOldMaxStack;

there is any advice to keep my dll not damaged after write ?

@yangzhongke
Copy link

yangzhongke commented Mar 15, 2022

It looks like the same problem with mine: #455

if(module.IsILOnly)
    {
        module.Write(filename);
    }
    else
    {
        module.NativeWrite(filename);
    }

@HPXCoder
Copy link
Author

It looks like the same problem with mine: #455

if(module.IsILOnly)
    {
        module.Write(filename);
    }
    else
    {
        module.NativeWrite(filename);
    }

Oh thanks bro for reply
i will try and give a feedback ;D
Great Thanks again

@HPXCoder
Copy link
Author

It looks like the same problem with mine: #455

if(module.IsILOnly)
    {
        module.Write(filename);
    }
    else
    {
        module.NativeWrite(filename);
    }

unfortunately
it didnt have any native codes still the same problem

@yangzhongke
Copy link

Please provide the C# code and the origial dll file.

@HPXCoder
Copy link
Author

HPXCoder commented Mar 15, 2022

Please provide the C# code and the origial dll file.

dll
https://mega.nz/file/JCp1DA7Y#qPEBkKcLUUYexaac7jw8eaWGTCjrpyXCOE---D_ZGf4

c# code
using (ModuleDefMD mod = ModuleDefMD.Load(FilePath))
{
ModuleWriterOptions options = new ModuleWriterOptions(mod) { Logger = DummyLogger.ThrowModuleWriterExceptionOnErrorInstance };
options.MetadataOptions.Flags = MetadataFlags.KeepOldMaxStack;
mod.Write(DestPath, options);
}

Thank You About Your Help <3

@yangzhongke
Copy link

Sorry, I did not use .NET framwork with dnlib. I have no idea.
Maybe because it's obfuscated, and obfuscator embeded extra hidden data in dll file.
Hope others can help you.

@HPXCoder
Copy link
Author

Sorry, I did not use .NET framwork with dnlib. I have no idea. Maybe because it's obfuscated, and obfuscator embeded extra hidden data in dll file. Hope others can help you.

i appreciate your help 😊
Thanka for your time

@wtfsck
Copy link
Contributor

wtfsck commented Mar 16, 2022

Try calling module.NativeWrite() instead of Write(). And if it's obfuscated it could have runtime checks (eg. checksum) and other data. If so you have to fix that manually.

@HPXCoder
Copy link
Author

Try calling module.NativeWrite() instead of Write(). And if it's obfuscated it could have runtime checks (eg. checksum) and other data. If so you have to fix that manually.

First thank you for your help,
Its obfuscated .
With agile
and if i edited it using dnspy i will face the same problem .
Oh i forgot something
The dll working so good in runtime
But if added to visual studio and running a code or using a ui control
Give me an error
Stack trace err
And saying that the object is not loaded when i put some controls to my form.

@wtfsck
Copy link
Contributor

wtfsck commented Mar 18, 2022

You need to find a deobfuscator for it.

@wtfsck wtfsck closed this as completed Mar 18, 2022
@HPXCoder
Copy link
Author

You need to find a deobfuscator for it.

unfortunately, there is no

can i deob it manually, is any toturial ? maybe you can help ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants