toptensoftware / nvpatch

14 stars 4 forks source link

nvpatch overwrites files that are included in a .NET publish when `PublishSingleFile` is enabled #1

Closed SteffanDonal closed 1 year ago

SteffanDonal commented 1 year ago

Hey Brad!

Thank you for publishing this tool and documenting the approach. Pleasure reading through and following the code. I've encountered a problem where nvpatch breaks files that .NET includes in a PublishSingleFile-enabled publish.

The cause seems rooted in .NET's approach to bundling those files - they're appended directly to the end of the PE executable, which nvpatch also uses as the location to write the new export table.

I'm currently investigating a fix for the issue, my hope is that shifting the content after the executable down to make room will not break the .NET PublishSingleFile option.

toptensoftware commented 1 year ago

Interesting. Thanks for the info. I had heard of issues with .NET but nobody had mentioned this was specific to bundled single file publishing. Let me know how you get on with this - happy to accept a pull request to fix it if you figure it out.

SteffanDonal commented 1 year ago

Alright, I got it! Check the pull request for more context. That was genuinely quite fun, hope the fix is up to snuff!

Cheers 👍

toptensoftware commented 1 year ago

Thanks for that. I'm not actively working on this project at the moment so I'll take your word for it that it works and have merged it, built it and published it as b104. Thanks again.