Open skul377 opened 2 years ago
Had the same issue and worked around it by saving the rawFile
buffer to file (it seems like AddImport doesn't apply changes to the binary).
So in your case do this:
// add import
PeNet.PeFile peFile = new PeNet.PeFile(@"D:\Sample\7z.exe");
peFile.AddImport("gdi32.dll", "StartPage");
// save binary to disk
File.WriteAllBytes(@"D:\Sample\7z.exe", peFile.rawFile.ToArray());
I tried using the stock templat as given below to add an import to a file. However, I am not able to see the import added to the binary. Please let me know where I am going wrong.
I imported the package via NuGet and compiled the code. The code exits as expected but doesn't provide the expected results.