Пример #1
0
        public void AddImport_ToNotExistingImpDescMultiple_64BitExecutable()
        {
            var peFile = new PeFile(@"Binaries/add-import.exe");
            var ai1    = new AdditionalImport("gdi32.dll", new List <string> {
                "StartPage", "EndDoc"
            });
            var ai2 = new AdditionalImport("api-ms-win-core-errorhandling-l1-1-0.dll", new List <string> {
                "SetUnhandledExceptionFilter"
            });

            peFile.AddImports(new List <AdditionalImport> {
                ai1, ai2
            });

            Assert.NotNull(peFile.ImportedFunctions.FirstOrDefault(i =>
                                                                   i.DLL == "gdi32.dll" &&
                                                                   i.Name == "StartPage"));

            Assert.NotNull(peFile.ImportedFunctions.FirstOrDefault(i =>
                                                                   i.DLL == "gdi32.dll" &&
                                                                   i.Name == "EndDoc"));

            Assert.NotNull(peFile.ImportedFunctions.FirstOrDefault(i =>
                                                                   i.DLL == "api-ms-win-core-errorhandling-l1-1-0.dll" &&
                                                                   i.Name == "SetUnhandledExceptionFilter"));
        }
Пример #2
0
        public void AddImport_ToExistingImpDesc_64BitExecutable()
        {
            var peFile = new PeFile(@"Binaries/add-import.exe");
            var ai     = new AdditionalImport("ADVAPI32.dll", new List <string> {
                "RegCloseKey"
            });

            peFile.AddImports(new List <AdditionalImport> {
                ai
            });

            Assert.NotNull(peFile.ImportedFunctions.FirstOrDefault(i =>
                                                                   i.DLL == "ADVAPI32.dll" &&
                                                                   i.Name == "RegCloseKey"));
        }