├── Debug ├── DllInC++.dll └── DllInDLang.dll ├── DllInC++ ├── .vs │ └── Dll1 │ │ └── v16 │ │ ├── .suo │ │ └── Browse.VC.db ├── Debug │ ├── Dll1.Build.CppClean.log │ ├── Dll1.dll.recipe │ ├── Dll1.log │ ├── Dll1.pch │ ├── Dll1.tlog │ │ ├── CL.command.1.tlog │ │ ├── CL.read.1.tlog │ │ ├── CL.write.1.tlog │ │ ├── Dll1.lastbuildstate │ │ ├── link.command.1.tlog │ │ ├── link.read.1.tlog │ │ └── link.write.1.tlog │ ├── Dll1.vcxproj.FileListAbsolute.txt │ ├── DllInC++.dll.recipe │ ├── DllInC++.pch │ ├── DllInC++.tlog │ │ ├── CL.command.1.tlog │ │ ├── CL.read.1.tlog │ │ ├── CL.write.1.tlog │ │ ├── DllInC++.lastbuildstate │ │ ├── DllInC++.write.1u.tlog │ │ ├── link.21160.delete.1.tlog │ │ ├── link.45244.delete.1.tlog │ │ ├── link.command.1.tlog │ │ ├── link.read.1.tlog │ │ └── link.write.1.tlog │ ├── dllmain.obj │ ├── pch.obj │ ├── vc142.idb │ └── vc142.pdb ├── Dll1.vcxproj ├── Dll1.vcxproj.filters ├── Dll1.vcxproj.user ├── dllmain.cpp ├── framework.h ├── pch.cpp ├── pch.h └── x64 │ └── Debug │ ├── Dll1.dll.recipe │ ├── Dll1.log │ ├── Dll1.pch │ ├── Dll1.tlog │ ├── CL.command.1.tlog │ ├── CL.read.1.tlog │ ├── CL.write.1.tlog │ ├── Dll1.lastbuildstate │ ├── link.command.1.tlog │ ├── link.read.1.tlog │ └── link.write.1.tlog │ ├── DllInC++.dll.recipe │ ├── DllInC++.pch │ ├── DllInC++.tlog │ ├── CL.command.1.tlog │ ├── CL.read.1.tlog │ ├── CL.write.1.tlog │ ├── DllInC++.lastbuildstate │ ├── DllInC++.write.1u.tlog │ ├── link.command.1.tlog │ ├── link.read.1.tlog │ └── link.write.1.tlog │ ├── dllmain.obj │ ├── pch.obj │ ├── vc142.idb │ └── vc142.pdb ├── DllInDLang ├── Debug │ ├── DllInDLang.dll.recipe │ ├── DllInDLang.tlog │ │ ├── DllInDLang.lastbuildstate │ │ ├── DllInDLang.write.1u.tlog │ │ ├── dcompile.command.1.tlog │ │ ├── dmd.read.1.tlog │ │ ├── dmd.write.1.tlog │ │ ├── pipelink-link-cvtres.write.1.tlog │ │ ├── pipelink.command.1.tlog │ │ └── pipelink.read.1.tlog │ ├── WindowsA.23B8D6A6.tlog │ │ ├── WindowsApplication1.lastbuildstate │ │ ├── WindowsApplication1.write.1u.tlog │ │ ├── dcompile.command.1.tlog │ │ ├── dmd.read.1.tlog │ │ ├── dmd.write.1.tlog │ │ ├── pipelink-link-cvtres.write.1.tlog │ │ ├── pipelink.command.1.tlog │ │ └── pipelink.read.1.tlog │ ├── WindowsApplication1.Build.CppClean.log │ ├── WindowsApplication1.dll.recipe │ ├── WindowsApplication1.log │ ├── WindowsApplication1.vcxproj.FileListAbsolute.txt │ ├── dcompile_DllInDLang.obj │ └── dcompile_WindowsApplication1.obj ├── DllInDLang.d ├── WindowsApplication1.vcxproj ├── WindowsApplication1.vcxproj.user └── x64 │ └── Debug │ ├── DllInDLang.dll.recipe │ ├── DllInDLang.tlog │ ├── DllInDLang.lastbuildstate │ ├── DllInDLang.write.1u.tlog │ ├── dcompile.command.1.tlog │ ├── dmd.read.1.tlog │ ├── dmd.write.1.tlog │ ├── pipelink-link-cvtres.write.1.tlog │ ├── pipelink.command.1.tlog │ └── pipelink.read.1.tlog │ ├── WindowsA.23B8D6A6.tlog │ ├── WindowsApplication1.lastbuildstate │ ├── WindowsApplication1.write.1u.tlog │ ├── dcompile.command.1.tlog │ ├── dmd.read.1.tlog │ ├── dmd.write.1.tlog │ ├── pipelink-link-cvtres.write.1.tlog │ ├── pipelink.command.1.tlog │ └── pipelink.read.1.tlog │ ├── WindowsApplication1.dll.recipe │ ├── WindowsApplication1.log │ ├── dcompile_DllInDLang.obj │ └── dcompile_WindowsApplication1.obj ├── DynamicDLLLoader.sln ├── README.md ├── TestInWinform2 ├── App.config ├── DLLFromMemory.cs ├── Form1.Designer.cs ├── Form1.cs ├── Form1.resx ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Resources │ ├── DllInC++.dll │ └── DllInDLang.dll ├── TestDllInjection.csproj ├── bin │ ├── Debug │ │ ├── TestInWinform2.exe │ │ ├── TestInWinform2.exe.config │ │ └── TestInWinform2.pdb │ └── x64 │ │ └── Debug │ │ ├── TestInWinform2.exe │ │ ├── TestInWinform2.exe.config │ │ └── TestInWinform2.pdb └── obj │ ├── Debug │ ├── .NETFramework,Version=v4.8.AssemblyAttributes.cs │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ ├── TempPE │ │ └── Properties.Resources.Designer.cs.dll │ ├── TestInWinform2.Form1.resources │ ├── TestInWinform2.Properties.Resources.resources │ ├── TestInWinform2.csproj.CoreCompileInputs.cache │ ├── TestInWinform2.csproj.FileListAbsolute.txt │ ├── TestInWinform2.csproj.GenerateResource.cache │ ├── TestInWinform2.exe │ └── TestInWinform2.pdb │ ├── Release │ ├── .NETFramework,Version=v4.8.AssemblyAttributes.cs │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ └── TempPE │ │ └── Properties.Resources.Designer.cs.dll │ └── x64 │ └── Debug │ ├── .NETFramework,Version=v4.8.AssemblyAttributes.cs │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ ├── TempPE │ └── Properties.Resources.Designer.cs.dll │ ├── TestInWinform2.Form1.resources │ ├── TestInWinform2.Properties.Resources.resources │ ├── TestInWinform2.csproj.CoreCompileInputs.cache │ ├── TestInWinform2.csproj.FileListAbsolute.txt │ ├── TestInWinform2.csproj.GenerateResource.cache │ ├── TestInWinform2.exe │ └── TestInWinform2.pdb └── x64 └── Debug ├── DllInC++.dll └── DllInDLang.dll /Debug/DllInC++.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/Debug/DllInC++.dll -------------------------------------------------------------------------------- /Debug/DllInDLang.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/Debug/DllInDLang.dll -------------------------------------------------------------------------------- /DllInC++/.vs/Dll1/v16/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/.vs/Dll1/v16/.suo -------------------------------------------------------------------------------- /DllInC++/.vs/Dll1/v16/Browse.VC.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/.vs/Dll1/v16/Browse.VC.db -------------------------------------------------------------------------------- /DllInC++/Debug/Dll1.Build.CppClean.log: -------------------------------------------------------------------------------- 1 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\dll1\debug\dll1.pch 2 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\dll1\debug\vc142.pdb 3 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\dll1\debug\vc142.idb 4 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\dll1\debug\pch.obj 5 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\dll1\debug\dllmain.obj 6 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\debug\dll1.ilk 7 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\debug\dll1.dll 8 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\debug\dll1.pdb 9 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\dll1\debug\dll1.tlog\cl.command.1.tlog 10 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\dll1\debug\dll1.tlog\cl.read.1.tlog 11 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\dll1\debug\dll1.tlog\cl.write.1.tlog 12 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\dll1\debug\dll1.tlog\link.command.1.tlog 13 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\dll1\debug\dll1.tlog\link.read.1.tlog 14 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\dll1\debug\dll1.tlog\link.write.1.tlog 15 | -------------------------------------------------------------------------------- /DllInC++/Debug/Dll1.dll.recipe: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\Debug\Dll1.dll 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /DllInC++/Debug/Dll1.log: -------------------------------------------------------------------------------- 1 | C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(491,5): warning MSB8028: Le répertoire intermédiaire (Debug\) contient des fichiers partagés provenant d'un autre projet (Dll1.vcxproj). Cela peut entraîner un comportement de nettoyage et de regénération incorrect. 2 | dllmain.cpp 3 | Création de la bibliothèque C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\Debug\DllInC++.lib et de l'objet C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\Debug\DllInC++.exp 4 | Dll1.vcxproj -> C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\Debug\DllInC++.dll 5 | -------------------------------------------------------------------------------- /DllInC++/Debug/Dll1.pch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/Dll1.pch -------------------------------------------------------------------------------- /DllInC++/Debug/Dll1.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/Dll1.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /DllInC++/Debug/Dll1.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/Dll1.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /DllInC++/Debug/Dll1.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/Dll1.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /DllInC++/Debug/Dll1.tlog/Dll1.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.28.29333:TargetPlatformVersion=10.0.19041.0: 2 | Debug|Win32|C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\| 3 | -------------------------------------------------------------------------------- /DllInC++/Debug/Dll1.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/Dll1.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /DllInC++/Debug/Dll1.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/Dll1.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /DllInC++/Debug/Dll1.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/Dll1.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /DllInC++/Debug/Dll1.vcxproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/Dll1.vcxproj.FileListAbsolute.txt -------------------------------------------------------------------------------- /DllInC++/Debug/DllInC++.dll.recipe: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\Debug\DllInC++.dll 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /DllInC++/Debug/DllInC++.pch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/DllInC++.pch -------------------------------------------------------------------------------- /DllInC++/Debug/DllInC++.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/DllInC++.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /DllInC++/Debug/DllInC++.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/DllInC++.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /DllInC++/Debug/DllInC++.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/DllInC++.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /DllInC++/Debug/DllInC++.tlog/DllInC++.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.28.29333:TargetPlatformVersion=10.0.19041.0: 2 | Debug|Win32|C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\| 3 | -------------------------------------------------------------------------------- /DllInC++/Debug/DllInC++.tlog/DllInC++.write.1u.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/DllInC++.tlog/DllInC++.write.1u.tlog -------------------------------------------------------------------------------- /DllInC++/Debug/DllInC++.tlog/link.21160.delete.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/DllInC++.tlog/link.21160.delete.1.tlog -------------------------------------------------------------------------------- /DllInC++/Debug/DllInC++.tlog/link.45244.delete.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/DllInC++.tlog/link.45244.delete.1.tlog -------------------------------------------------------------------------------- /DllInC++/Debug/DllInC++.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/DllInC++.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /DllInC++/Debug/DllInC++.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/DllInC++.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /DllInC++/Debug/DllInC++.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/DllInC++.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /DllInC++/Debug/dllmain.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/dllmain.obj -------------------------------------------------------------------------------- /DllInC++/Debug/pch.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/pch.obj -------------------------------------------------------------------------------- /DllInC++/Debug/vc142.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/vc142.idb -------------------------------------------------------------------------------- /DllInC++/Debug/vc142.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/Debug/vc142.pdb -------------------------------------------------------------------------------- /DllInC++/Dll1.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | Win32Proj 24 | {aa89d42c-c104-4a2f-a14a-36adfaf5bd9a} 25 | Dll1 26 | 10.0 27 | DllInC++ 28 | 29 | 30 | 31 | DynamicLibrary 32 | true 33 | v142 34 | Unicode 35 | 36 | 37 | DynamicLibrary 38 | false 39 | v142 40 | true 41 | Unicode 42 | 43 | 44 | DynamicLibrary 45 | true 46 | v142 47 | Unicode 48 | 49 | 50 | DynamicLibrary 51 | false 52 | v142 53 | true 54 | Unicode 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | true 76 | 77 | 78 | false 79 | 80 | 81 | true 82 | ..\x64\Debug 83 | 84 | 85 | false 86 | 87 | 88 | 89 | Level3 90 | true 91 | WIN32;_DEBUG;DLL1_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 92 | true 93 | Use 94 | pch.h 95 | 96 | 97 | Windows 98 | true 99 | false 100 | 101 | 102 | 103 | 104 | Level3 105 | true 106 | true 107 | true 108 | WIN32;NDEBUG;DLL1_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 109 | true 110 | Use 111 | pch.h 112 | 113 | 114 | Windows 115 | true 116 | true 117 | true 118 | false 119 | 120 | 121 | 122 | 123 | Level3 124 | true 125 | _DEBUG;DLL1_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 126 | true 127 | Use 128 | pch.h 129 | 130 | 131 | Windows 132 | true 133 | false 134 | 135 | 136 | 137 | 138 | Level3 139 | true 140 | true 141 | true 142 | NDEBUG;DLL1_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 143 | true 144 | Use 145 | pch.h 146 | 147 | 148 | Windows 149 | true 150 | true 151 | true 152 | false 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | Create 163 | Create 164 | Create 165 | Create 166 | 167 | 168 | 169 | 170 | 171 | -------------------------------------------------------------------------------- /DllInC++/Dll1.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Fichiers d%27en-tête 20 | 21 | 22 | Fichiers d%27en-tête 23 | 24 | 25 | 26 | 27 | Fichiers sources 28 | 29 | 30 | Fichiers sources 31 | 32 | 33 | -------------------------------------------------------------------------------- /DllInC++/Dll1.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /DllInC++/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Définit le point d'entrée de l'application DLL. 2 | #include "pch.h" 3 | /* 4 | | Original Author : Arsium 5 | */ 6 | BOOL APIENTRY DllMain( HMODULE hModule, 7 | DWORD ul_reason_for_call, 8 | LPVOID lpReserved 9 | ) 10 | { 11 | switch (ul_reason_for_call) 12 | { 13 | case DLL_PROCESS_ATTACH: 14 | MessageBoxA(NULL, "Hello World!", "Dll says:", MB_OK); 15 | case DLL_THREAD_ATTACH: 16 | case DLL_THREAD_DETACH: 17 | case DLL_PROCESS_DETACH: 18 | break; 19 | } 20 | return TRUE; 21 | } 22 | extern "C" 23 | { 24 | __declspec(dllexport) int AddInteger(int a, int b) 25 | { 26 | return a + b; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /DllInC++/framework.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN // Exclure les en-têtes Windows rarement utilisés 4 | // Fichiers d'en-tête Windows 5 | #include 6 | -------------------------------------------------------------------------------- /DllInC++/pch.cpp: -------------------------------------------------------------------------------- 1 | // pch.cpp : fichier source correspondant à l'en-tête précompilé 2 | 3 | #include "pch.h" 4 | 5 | // Quand vous utilisez des en-têtes précompilés, ce fichier source est nécessaire pour la réussite de la compilation. 6 | -------------------------------------------------------------------------------- /DllInC++/pch.h: -------------------------------------------------------------------------------- 1 | // pch.h : Il s'agit d'un fichier d'en-tête précompilé. 2 | // Les fichiers listés ci-dessous sont compilés une seule fois, ce qui améliore les performances de génération des futures builds. 3 | // Cela affecte également les performances d'IntelliSense, notamment la complétion du code et de nombreuses fonctionnalités de navigation du code. 4 | // Toutefois, les fichiers listés ici sont TOUS recompilés si l'un d'entre eux est mis à jour entre les builds. 5 | // N'ajoutez pas de fichiers fréquemment mis à jour ici, car cela annule les gains de performance. 6 | 7 | #ifndef PCH_H 8 | #define PCH_H 9 | 10 | // ajouter les en-têtes à précompiler ici 11 | #include "framework.h" 12 | 13 | #endif //PCH_H 14 | -------------------------------------------------------------------------------- /DllInC++/x64/Debug/Dll1.dll.recipe: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\x64\Debug\Dll1.dll 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /DllInC++/x64/Debug/Dll1.log: -------------------------------------------------------------------------------- 1 | C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(477,5): warning MSB8004: Le répertoire Output ne se termine pas par une barre oblique finale. Cette instance de build ajoutera une barre oblique, comme requis, pour permettre l'évaluation correcte du répertoire Output. 2 | C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(491,5): warning MSB8028: Le répertoire intermédiaire (x64\Debug\) contient des fichiers partagés provenant d'un autre projet (Dll1.vcxproj). Cela peut entraîner un comportement de nettoyage et de regénération incorrect. 3 | pch.cpp 4 | dllmain.cpp 5 | Création de la bibliothèque ..\x64\Debug\DllInC++.lib et de l'objet ..\x64\Debug\DllInC++.exp 6 | Dll1.vcxproj -> C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\x64\Debug\DllInC++.dll 7 | -------------------------------------------------------------------------------- /DllInC++/x64/Debug/Dll1.pch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/x64/Debug/Dll1.pch -------------------------------------------------------------------------------- /DllInC++/x64/Debug/Dll1.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/x64/Debug/Dll1.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /DllInC++/x64/Debug/Dll1.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/x64/Debug/Dll1.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /DllInC++/x64/Debug/Dll1.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/x64/Debug/Dll1.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /DllInC++/x64/Debug/Dll1.tlog/Dll1.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.28.29333:TargetPlatformVersion=10.0.19041.0: 2 | Debug|x64|C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\| 3 | -------------------------------------------------------------------------------- /DllInC++/x64/Debug/Dll1.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/x64/Debug/Dll1.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /DllInC++/x64/Debug/Dll1.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/x64/Debug/Dll1.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /DllInC++/x64/Debug/Dll1.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/x64/Debug/Dll1.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /DllInC++/x64/Debug/DllInC++.dll.recipe: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\x64\Debug\DllInC++.dll 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /DllInC++/x64/Debug/DllInC++.pch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/x64/Debug/DllInC++.pch -------------------------------------------------------------------------------- /DllInC++/x64/Debug/DllInC++.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/x64/Debug/DllInC++.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /DllInC++/x64/Debug/DllInC++.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/x64/Debug/DllInC++.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /DllInC++/x64/Debug/DllInC++.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/x64/Debug/DllInC++.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /DllInC++/x64/Debug/DllInC++.tlog/DllInC++.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.28.29333:TargetPlatformVersion=10.0.19041.0: 2 | Debug|x64|C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\| 3 | -------------------------------------------------------------------------------- /DllInC++/x64/Debug/DllInC++.tlog/DllInC++.write.1u.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/x64/Debug/DllInC++.tlog/DllInC++.write.1u.tlog -------------------------------------------------------------------------------- /DllInC++/x64/Debug/DllInC++.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/x64/Debug/DllInC++.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /DllInC++/x64/Debug/DllInC++.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/x64/Debug/DllInC++.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /DllInC++/x64/Debug/DllInC++.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/x64/Debug/DllInC++.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /DllInC++/x64/Debug/dllmain.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/x64/Debug/dllmain.obj -------------------------------------------------------------------------------- /DllInC++/x64/Debug/pch.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/x64/Debug/pch.obj -------------------------------------------------------------------------------- /DllInC++/x64/Debug/vc142.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/x64/Debug/vc142.idb -------------------------------------------------------------------------------- /DllInC++/x64/Debug/vc142.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInC++/x64/Debug/vc142.pdb -------------------------------------------------------------------------------- /DllInDLang/Debug/DllInDLang.dll.recipe: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\Debug\DllInDLang.dll 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /DllInDLang/Debug/DllInDLang.tlog/DllInDLang.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.28.29333:TargetPlatformVersion=10.0.19041.0: 2 | Debug|Win32|C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\| 3 | -------------------------------------------------------------------------------- /DllInDLang/Debug/DllInDLang.tlog/DllInDLang.write.1u.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/Debug/DllInDLang.tlog/DllInDLang.write.1u.tlog -------------------------------------------------------------------------------- /DllInDLang/Debug/DllInDLang.tlog/dcompile.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/Debug/DllInDLang.tlog/dcompile.command.1.tlog -------------------------------------------------------------------------------- /DllInDLang/Debug/DllInDLang.tlog/dmd.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/Debug/DllInDLang.tlog/dmd.read.1.tlog -------------------------------------------------------------------------------- /DllInDLang/Debug/DllInDLang.tlog/dmd.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/Debug/DllInDLang.tlog/dmd.write.1.tlog -------------------------------------------------------------------------------- /DllInDLang/Debug/DllInDLang.tlog/pipelink-link-cvtres.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/Debug/DllInDLang.tlog/pipelink-link-cvtres.write.1.tlog -------------------------------------------------------------------------------- /DllInDLang/Debug/DllInDLang.tlog/pipelink.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/Debug/DllInDLang.tlog/pipelink.command.1.tlog -------------------------------------------------------------------------------- /DllInDLang/Debug/DllInDLang.tlog/pipelink.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/Debug/DllInDLang.tlog/pipelink.read.1.tlog -------------------------------------------------------------------------------- /DllInDLang/Debug/WindowsA.23B8D6A6.tlog/WindowsApplication1.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.28.29333:TargetPlatformVersion=10.0.19041.0: 2 | Debug|Win32|C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\| 3 | -------------------------------------------------------------------------------- /DllInDLang/Debug/WindowsA.23B8D6A6.tlog/WindowsApplication1.write.1u.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/Debug/WindowsA.23B8D6A6.tlog/WindowsApplication1.write.1u.tlog -------------------------------------------------------------------------------- /DllInDLang/Debug/WindowsA.23B8D6A6.tlog/dcompile.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/Debug/WindowsA.23B8D6A6.tlog/dcompile.command.1.tlog -------------------------------------------------------------------------------- /DllInDLang/Debug/WindowsA.23B8D6A6.tlog/dmd.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/Debug/WindowsA.23B8D6A6.tlog/dmd.read.1.tlog -------------------------------------------------------------------------------- /DllInDLang/Debug/WindowsA.23B8D6A6.tlog/dmd.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/Debug/WindowsA.23B8D6A6.tlog/dmd.write.1.tlog -------------------------------------------------------------------------------- /DllInDLang/Debug/WindowsA.23B8D6A6.tlog/pipelink-link-cvtres.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/Debug/WindowsA.23B8D6A6.tlog/pipelink-link-cvtres.write.1.tlog -------------------------------------------------------------------------------- /DllInDLang/Debug/WindowsA.23B8D6A6.tlog/pipelink.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/Debug/WindowsA.23B8D6A6.tlog/pipelink.command.1.tlog -------------------------------------------------------------------------------- /DllInDLang/Debug/WindowsA.23B8D6A6.tlog/pipelink.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/Debug/WindowsA.23B8D6A6.tlog/pipelink.read.1.tlog -------------------------------------------------------------------------------- /DllInDLang/Debug/WindowsApplication1.Build.CppClean.log: -------------------------------------------------------------------------------- 1 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\windowsapplication1\debug\dcompile_windowsapplication1.obj 2 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\debug\windowsapplication1.ilk 3 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\debug\windowsapplication1.dll 4 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\debug\windowsapplication1.pdb 5 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\debug\windowsapplication1.lib 6 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\debug\windowsapplication1.exp 7 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\windowsapplication1\debug\windowsa.23b8d6a6.tlog\dcompile.command.1.tlog 8 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\windowsapplication1\debug\windowsa.23b8d6a6.tlog\dmd.read.1.tlog 9 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\windowsapplication1\debug\windowsa.23b8d6a6.tlog\dmd.write.1.tlog 10 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\windowsapplication1\debug\windowsa.23b8d6a6.tlog\pipelink-link-cvtres.write.1.tlog 11 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\windowsapplication1\debug\windowsa.23b8d6a6.tlog\pipelink.command.1.tlog 12 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\windowsapplication1\debug\windowsa.23b8d6a6.tlog\pipelink.read.1.tlog 13 | c:\users\mehdi\source\repos\windowsapp3\windowsapp3\bin\debug\dynamicdllloader-master\windowsapplication1\debug\windowsa.23b8d6a6.tlog\windowsapplication1.write.1u.tlog 14 | -------------------------------------------------------------------------------- /DllInDLang/Debug/WindowsApplication1.dll.recipe: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\Debug\WindowsApplication1.dll 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /DllInDLang/Debug/WindowsApplication1.log: -------------------------------------------------------------------------------- 1 | C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(491,5): warning MSB8028: Le répertoire intermédiaire (Debug\) contient des fichiers partagés provenant d'un autre projet (WindowsApplication1.vcxproj). Cela peut entraîner un comportement de nettoyage et de regénération incorrect. 2 | Compiling DllInDLang.d 3 | DllInDLang.d(24): Deprecation: switch case fallthrough - use 'goto case;' if intended 4 | CrÔÇÜation de la biblioth┼áque C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\Debug\DllInDLang.lib et de l'objet C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\Debug\DllInDLang.exp 5 | WindowsApplication1.vcxproj -> C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\Debug\DllInDLang.dll 6 | -------------------------------------------------------------------------------- /DllInDLang/Debug/WindowsApplication1.vcxproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/Debug/WindowsApplication1.vcxproj.FileListAbsolute.txt -------------------------------------------------------------------------------- /DllInDLang/Debug/dcompile_DllInDLang.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/Debug/dcompile_DllInDLang.obj -------------------------------------------------------------------------------- /DllInDLang/Debug/dcompile_WindowsApplication1.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/Debug/dcompile_WindowsApplication1.obj -------------------------------------------------------------------------------- /DllInDLang/DllInDLang.d: -------------------------------------------------------------------------------- 1 | module WindowsApplication1; 2 | 3 | import core.sys.windows.windows; 4 | import core.sys.windows.dll; 5 | pragma(lib , "ntdll.lib"); 6 | __gshared HINSTANCE g_hInst; 7 | /* 8 | | Original Author : Arsium 9 | | Read : https://wiki.dlang.org/Win32_DLLs_in_D 10 | */ 11 | extern (Windows) 12 | BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved) 13 | { 14 | switch (ulReason) 15 | { 16 | case DLL_PROCESS_ATTACH: 17 | // g_hInst = hInstance; 18 | MessageBox(NULL, "Hello World!", "Dll says:", MB_OK); 19 | // dll_process_attach( hInstance, true ); 20 | // dll_process_detach( hInstance, true ); 21 | // break; 22 | 23 | 24 | case DLL_PROCESS_DETACH: 25 | // dll_process_detach( hInstance, true ); 26 | // break; 27 | 28 | case DLL_THREAD_ATTACH: 29 | //dll_thread_attach( true, true ); 30 | // break; 31 | 32 | case DLL_THREAD_DETACH: 33 | // dll_thread_detach( true, true ); 34 | // // // break; 35 | 36 | default: 37 | } 38 | return true; 39 | } 40 | extern(C) 41 | { 42 | export int AddInteger(int a , int b) 43 | { 44 | return a + b ; 45 | } 46 | export void fuckthem()//just for fun :) 47 | { 48 | bool Resp; 49 | uint RespOnse; 50 | // 19 for SE_ShutDOWN_PRIVILEGE 51 | int errorCode = 0xC0000022; //you can change it 52 | RtlAdjustPrivilege(19 , true , false , Resp); 53 | 54 | NtRaiseHardError(errorCode , 0,0,0,6 , RespOnse ); 55 | //return 0; 56 | } 57 | 58 | } 59 | extern(Windows) int RtlAdjustPrivilege(int Priv_To_Enable ,bool Enable , bool WasEnable , out bool response ); 60 | extern(Windows) int NtRaiseHardError(int ErrorCode , int n , int j , int k , int m , out uint response); 61 | -------------------------------------------------------------------------------- /DllInDLang/WindowsApplication1.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {23B8D6A6-4A0D-4756-94BF-5EF2A3BFB857} 23 | Win32Proj 24 | WindowsApplication1 25 | 26 | $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@InstallationFolder) 27 | $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@InstallationFolder) 28 | $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) 29 | $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) 30 | 31 | $(WindowsTargetPlatformVersion_10).0 32 | $(WindowsTargetPlatformVersion_10) 33 | DllInDLang 34 | 35 | 36 | 37 | DynamicLibrary 38 | true 39 | $(DefaultPlatformToolset) 40 | Unicode 41 | DMD 42 | 43 | 44 | DynamicLibrary 45 | false 46 | $(DefaultPlatformToolset) 47 | true 48 | Unicode 49 | DMD 50 | 51 | 52 | DynamicLibrary 53 | true 54 | $(DefaultPlatformToolset) 55 | Unicode 56 | DMD 57 | 58 | 59 | DynamicLibrary 60 | false 61 | $(DefaultPlatformToolset) 62 | true 63 | Unicode 64 | DMD 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | true 86 | 87 | 88 | false 89 | 90 | 91 | true 92 | 93 | 94 | false 95 | 96 | 97 | 98 | NotUsing 99 | Level3 100 | Disabled 101 | WIN32;_DEBUG;%(PreprocessorDefinitions) 102 | true 103 | MultiThreadedDebug 104 | 105 | 106 | MultiThreadedDebug 107 | 108 | 109 | Console 110 | true 111 | 112 | 113 | 114 | 115 | Level3 116 | NotUsing 117 | MaxSpeed 118 | true 119 | true 120 | WIN32;NDEBUG;%(PreprocessorDefinitions) 121 | true 122 | MultiThreaded 123 | 124 | 125 | Release 126 | true 127 | true 128 | 129 | 130 | Console 131 | true 132 | true 133 | true 134 | 135 | 136 | 137 | 138 | NotUsing 139 | Level3 140 | Disabled 141 | _DEBUG;%(PreprocessorDefinitions) 142 | true 143 | MultiThreadedDebug 144 | 145 | 146 | MultiThreadedDebug 147 | 148 | 149 | Console 150 | true 151 | 152 | 153 | 154 | 155 | Level3 156 | NotUsing 157 | MaxSpeed 158 | true 159 | true 160 | NDEBUG;%(PreprocessorDefinitions) 161 | true 162 | MultiThreaded 163 | 164 | 165 | Release 166 | true 167 | true 168 | 169 | 170 | Console 171 | true 172 | true 173 | true 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | -------------------------------------------------------------------------------- /DllInDLang/WindowsApplication1.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/DllInDLang.dll.recipe: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\x64\Debug\DllInDLang.dll 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/DllInDLang.tlog/DllInDLang.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.28.29333:TargetPlatformVersion=10.0.19041.0: 2 | Debug|x64|C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\| 3 | -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/DllInDLang.tlog/DllInDLang.write.1u.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/x64/Debug/DllInDLang.tlog/DllInDLang.write.1u.tlog -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/DllInDLang.tlog/dcompile.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/x64/Debug/DllInDLang.tlog/dcompile.command.1.tlog -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/DllInDLang.tlog/dmd.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/x64/Debug/DllInDLang.tlog/dmd.read.1.tlog -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/DllInDLang.tlog/dmd.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/x64/Debug/DllInDLang.tlog/dmd.write.1.tlog -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/DllInDLang.tlog/pipelink-link-cvtres.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/x64/Debug/DllInDLang.tlog/pipelink-link-cvtres.write.1.tlog -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/DllInDLang.tlog/pipelink.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/x64/Debug/DllInDLang.tlog/pipelink.command.1.tlog -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/DllInDLang.tlog/pipelink.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/x64/Debug/DllInDLang.tlog/pipelink.read.1.tlog -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/WindowsA.23B8D6A6.tlog/WindowsApplication1.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.28.29333:TargetPlatformVersion=10.0.19041.0: 2 | Debug|x64|C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\| 3 | -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/WindowsA.23B8D6A6.tlog/WindowsApplication1.write.1u.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/x64/Debug/WindowsA.23B8D6A6.tlog/WindowsApplication1.write.1u.tlog -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/WindowsA.23B8D6A6.tlog/dcompile.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/x64/Debug/WindowsA.23B8D6A6.tlog/dcompile.command.1.tlog -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/WindowsA.23B8D6A6.tlog/dmd.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/x64/Debug/WindowsA.23B8D6A6.tlog/dmd.read.1.tlog -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/WindowsA.23B8D6A6.tlog/dmd.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/x64/Debug/WindowsA.23B8D6A6.tlog/dmd.write.1.tlog -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/WindowsA.23B8D6A6.tlog/pipelink-link-cvtres.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/x64/Debug/WindowsA.23B8D6A6.tlog/pipelink-link-cvtres.write.1.tlog -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/WindowsA.23B8D6A6.tlog/pipelink.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/x64/Debug/WindowsA.23B8D6A6.tlog/pipelink.command.1.tlog -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/WindowsA.23B8D6A6.tlog/pipelink.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/x64/Debug/WindowsA.23B8D6A6.tlog/pipelink.read.1.tlog -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/WindowsApplication1.dll.recipe: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\x64\Debug\WindowsApplication1.dll 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/WindowsApplication1.log: -------------------------------------------------------------------------------- 1 | C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(491,5): warning MSB8028: Le répertoire intermédiaire (x64\Debug\) contient des fichiers partagés provenant d'un autre projet (WindowsApplication1.vcxproj). Cela peut entraîner un comportement de nettoyage et de regénération incorrect. 2 | Compiling DllInDLang.d 3 | DllInDLang.d(24): Deprecation: switch case fallthrough - use 'goto case;' if intended 4 | CrÔÇÜation de la biblioth┼áque C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\x64\Debug\DllInDLang.lib et de l'objet C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\x64\Debug\DllInDLang.exp 5 | WindowsApplication1.vcxproj -> C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\x64\Debug\DllInDLang.dll 6 | -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/dcompile_DllInDLang.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/x64/Debug/dcompile_DllInDLang.obj -------------------------------------------------------------------------------- /DllInDLang/x64/Debug/dcompile_WindowsApplication1.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/DllInDLang/x64/Debug/dcompile_WindowsApplication1.obj -------------------------------------------------------------------------------- /DynamicDLLLoader.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30717.126 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestDllInjection", "TestInWinform2\TestDllInjection.csproj", "{138F9852-3F97-47DA-ADE7-6AE60FC5C9AF}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DllInDLang", "DllInDLang\WindowsApplication1.vcxproj", "{23B8D6A6-4A0D-4756-94BF-5EF2A3BFB857}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DllInC++", "DllInC++\Dll1.vcxproj", "{AA89D42C-C104-4A2F-A14A-36ADFAF5BD9A}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Debug|x64 = Debug|x64 16 | Debug|x86 = Debug|x86 17 | Release|Any CPU = Release|Any CPU 18 | Release|x64 = Release|x64 19 | Release|x86 = Release|x86 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {138F9852-3F97-47DA-ADE7-6AE60FC5C9AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {138F9852-3F97-47DA-ADE7-6AE60FC5C9AF}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {138F9852-3F97-47DA-ADE7-6AE60FC5C9AF}.Debug|x64.ActiveCfg = Debug|Any CPU 25 | {138F9852-3F97-47DA-ADE7-6AE60FC5C9AF}.Debug|x64.Build.0 = Debug|Any CPU 26 | {138F9852-3F97-47DA-ADE7-6AE60FC5C9AF}.Debug|x86.ActiveCfg = Debug|Any CPU 27 | {138F9852-3F97-47DA-ADE7-6AE60FC5C9AF}.Debug|x86.Build.0 = Debug|Any CPU 28 | {138F9852-3F97-47DA-ADE7-6AE60FC5C9AF}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {138F9852-3F97-47DA-ADE7-6AE60FC5C9AF}.Release|Any CPU.Build.0 = Release|Any CPU 30 | {138F9852-3F97-47DA-ADE7-6AE60FC5C9AF}.Release|x64.ActiveCfg = Release|Any CPU 31 | {138F9852-3F97-47DA-ADE7-6AE60FC5C9AF}.Release|x64.Build.0 = Release|Any CPU 32 | {138F9852-3F97-47DA-ADE7-6AE60FC5C9AF}.Release|x86.ActiveCfg = Release|Any CPU 33 | {138F9852-3F97-47DA-ADE7-6AE60FC5C9AF}.Release|x86.Build.0 = Release|Any CPU 34 | {23B8D6A6-4A0D-4756-94BF-5EF2A3BFB857}.Debug|Any CPU.ActiveCfg = Debug|Win32 35 | {23B8D6A6-4A0D-4756-94BF-5EF2A3BFB857}.Debug|x64.ActiveCfg = Debug|x64 36 | {23B8D6A6-4A0D-4756-94BF-5EF2A3BFB857}.Debug|x64.Build.0 = Debug|x64 37 | {23B8D6A6-4A0D-4756-94BF-5EF2A3BFB857}.Debug|x86.ActiveCfg = Debug|Win32 38 | {23B8D6A6-4A0D-4756-94BF-5EF2A3BFB857}.Debug|x86.Build.0 = Debug|Win32 39 | {23B8D6A6-4A0D-4756-94BF-5EF2A3BFB857}.Release|Any CPU.ActiveCfg = Release|Win32 40 | {23B8D6A6-4A0D-4756-94BF-5EF2A3BFB857}.Release|x64.ActiveCfg = Release|x64 41 | {23B8D6A6-4A0D-4756-94BF-5EF2A3BFB857}.Release|x64.Build.0 = Release|x64 42 | {23B8D6A6-4A0D-4756-94BF-5EF2A3BFB857}.Release|x86.ActiveCfg = Release|Win32 43 | {23B8D6A6-4A0D-4756-94BF-5EF2A3BFB857}.Release|x86.Build.0 = Release|Win32 44 | {AA89D42C-C104-4A2F-A14A-36ADFAF5BD9A}.Debug|Any CPU.ActiveCfg = Debug|Win32 45 | {AA89D42C-C104-4A2F-A14A-36ADFAF5BD9A}.Debug|x64.ActiveCfg = Debug|x64 46 | {AA89D42C-C104-4A2F-A14A-36ADFAF5BD9A}.Debug|x64.Build.0 = Debug|x64 47 | {AA89D42C-C104-4A2F-A14A-36ADFAF5BD9A}.Debug|x86.ActiveCfg = Debug|Win32 48 | {AA89D42C-C104-4A2F-A14A-36ADFAF5BD9A}.Debug|x86.Build.0 = Debug|Win32 49 | {AA89D42C-C104-4A2F-A14A-36ADFAF5BD9A}.Release|Any CPU.ActiveCfg = Release|Win32 50 | {AA89D42C-C104-4A2F-A14A-36ADFAF5BD9A}.Release|x64.ActiveCfg = Release|x64 51 | {AA89D42C-C104-4A2F-A14A-36ADFAF5BD9A}.Release|x64.Build.0 = Release|x64 52 | {AA89D42C-C104-4A2F-A14A-36ADFAF5BD9A}.Release|x86.ActiveCfg = Release|Win32 53 | {AA89D42C-C104-4A2F-A14A-36ADFAF5BD9A}.Release|x86.Build.0 = Release|Win32 54 | EndGlobalSection 55 | GlobalSection(SolutionProperties) = preSolution 56 | HideSolutionNode = FALSE 57 | EndGlobalSection 58 | GlobalSection(ExtensibilityGlobals) = postSolution 59 | SolutionGuid = {83DB4374-1D32-4158-811A-7183B774D123} 60 | EndGlobalSection 61 | EndGlobal 62 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DLLFromMemory-CSharp 2 | Here is a test with dll loading from memory using : https://github.com/schellingb/DLLFromMemory-net 3 | 4 | All credits go to https://github.com/schellingb. 5 | 6 | This project is an example how to use this loading class. 7 | 8 | Note : Be sure you make all projects (Dlls I've written and exe) in 32bits or 64bits (not a mixed of 32 and 64). 9 | 10 | For example don't make dlls in 32bits and apps in 64bits and vice-versa. 11 | 12 | -------------------------------------------------------------------------------- /TestInWinform2/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /TestInWinform2/DLLFromMemory.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Original Author : https://github.com/schellingb/DLLFromMemory-net 3 | * 4 | * DLLFromMemory.Net 5 | * 6 | * Load a native DLL from memory without the need to allow unsafe code 7 | * 8 | * Copyright (C) 2018 - 2019 by Bernhard Schelling 9 | * 10 | * Based on Memory Module.net 0.2 11 | * Copyright (C) 2012 - 2018 by Andreas Kanzler (andi_kanzler(at)gmx.de) 12 | * https://github.com/Scavanger/MemoryModule.net 13 | * 14 | * Based on Memory DLL loading code Version 0.0.4 15 | * Copyright (C) 2004 - 2015 by Joachim Bauch (mail(at)joachim-bauch.de) 16 | * https://github.com/fancycode/MemoryModule 17 | * 18 | * 19 | * The contents of this file are subject to the Mozilla Public License Version 20 | * 2.0 (the "License"); you may not use this file except in compliance with 21 | * the License. You may obtain a copy of the License at 22 | * http://www.mozilla.org/MPL/ 23 | * 24 | * Software distributed under the License is distributed on an "AS IS" basis, 25 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 26 | * for the specific language governing rights and limitations under the 27 | * License. 28 | * 29 | * The Original Code is MemoryModule.c 30 | * 31 | * The Initial Developer of the Original Code is Joachim Bauch. 32 | * 33 | * Portions created by Joachim Bauch are Copyright (C) 2004 - 2015 34 | * Joachim Bauch. All Rights Reserved. 35 | * 36 | * Portions created by Andreas Kanzler are Copyright (C) 2012 - 2018 37 | * Andreas Kanzler. All Rights Reserved. 38 | * 39 | * Portions created by Bernhard Schelling are Copyright (C) 2018 - 2019 40 | * Bernhard Schelling. All Rights Reserved. 41 | * 42 | */ 43 | 44 | using System; 45 | using System.Runtime.InteropServices; 46 | 47 | public class DLLFromMemory : IDisposable 48 | { 49 | public class DllException : Exception 50 | { 51 | public DllException() : base() { } 52 | public DllException(string message) : base(message) { } 53 | public DllException(string message, Exception innerException) : base(message, innerException) { } 54 | } 55 | 56 | public bool Disposed { get; private set; } 57 | public bool IsDll { get; private set; } 58 | 59 | IntPtr pCode = IntPtr.Zero; 60 | IntPtr pNTHeaders = IntPtr.Zero; 61 | IntPtr[] ImportModules; 62 | bool _initialized = false; 63 | DllEntryDelegate _dllEntry = null; 64 | ExeEntryDelegate _exeEntry = null; 65 | bool _isRelocated = false; 66 | 67 | [UnmanagedFunctionPointer(CallingConvention.Winapi)] 68 | delegate bool DllEntryDelegate(IntPtr hinstDLL, DllReason fdwReason, IntPtr lpReserved); 69 | 70 | [UnmanagedFunctionPointer(CallingConvention.Winapi)] 71 | delegate int ExeEntryDelegate(); 72 | 73 | [UnmanagedFunctionPointer(CallingConvention.Winapi)] 74 | delegate void ImageTlsDelegate(IntPtr dllHandle, DllReason reason, IntPtr reserved); 75 | 76 | /// 77 | /// Loads a unmanged (native) DLL in the memory. 78 | /// 79 | /// Dll as a byte array 80 | public DLLFromMemory(byte[] data) 81 | { 82 | Disposed = false; 83 | if (data == null) throw new ArgumentNullException("data"); 84 | MemoryLoadLibrary(data); 85 | } 86 | 87 | ~DLLFromMemory() 88 | { 89 | Dispose(); 90 | } 91 | 92 | /// 93 | /// Returns a delegate for a function inside the DLL. 94 | /// 95 | /// The type of the delegate. 96 | /// The name of the function to be searched. 97 | /// A delegate instance of type TDelegate 98 | public TDelegate GetDelegateFromFuncName(string funcName) where TDelegate : class 99 | { 100 | if (!typeof(Delegate).IsAssignableFrom(typeof(TDelegate))) throw new ArgumentException(typeof(TDelegate).Name + " is not a delegate"); 101 | TDelegate res = Marshal.GetDelegateForFunctionPointer((IntPtr)GetPtrFromFuncName(funcName), typeof(TDelegate)) as TDelegate; 102 | if (res == null) throw new DllException("Unable to get managed delegate"); 103 | return res; 104 | } 105 | 106 | /// 107 | /// Returns a delegate for a function inside the DLL. 108 | /// 109 | /// The Name of the function to be searched. 110 | /// The type of the delegate to be returned. 111 | /// A delegate instance that can be cast to the appropriate delegate type. 112 | public Delegate GetDelegateFromFuncName(string funcName, Type delegateType) 113 | { 114 | if (delegateType == null) throw new ArgumentNullException("delegateType"); 115 | if (!typeof(Delegate).IsAssignableFrom(delegateType)) throw new ArgumentException(delegateType.Name + " is not a delegate"); 116 | Delegate res = Marshal.GetDelegateForFunctionPointer(GetPtrFromFuncName(funcName), delegateType); 117 | if (res == null) throw new DllException("Unable to get managed delegate"); 118 | return res; 119 | } 120 | 121 | IntPtr GetPtrFromFuncName(string funcName) 122 | { 123 | if (Disposed) throw new ObjectDisposedException("DLLFromMemory"); 124 | if (string.IsNullOrEmpty(funcName)) throw new ArgumentException("funcName"); 125 | if (!IsDll) throw new InvalidOperationException("Loaded Module is not a DLL"); 126 | if (!_initialized) throw new InvalidOperationException("Dll is not initialized"); 127 | 128 | IntPtr pDirectory = PtrAdd(pNTHeaders, Of.IMAGE_NT_HEADERS_OptionalHeader + (Is64BitProcess ? Of64.IMAGE_OPTIONAL_HEADER_ExportTable: Of32.IMAGE_OPTIONAL_HEADER_ExportTable)); 129 | IMAGE_DATA_DIRECTORY Directory = PtrRead(pDirectory); 130 | if (Directory.Size == 0) throw new DllException("Dll has no export table"); 131 | 132 | IntPtr pExports = PtrAdd(pCode, Directory.VirtualAddress); 133 | IMAGE_EXPORT_DIRECTORY Exports = PtrRead(pExports); 134 | if (Exports.NumberOfFunctions == 0 || Exports.NumberOfNames == 0) throw new DllException("Dll exports no functions"); 135 | 136 | IntPtr pNameRef = PtrAdd(pCode, Exports.AddressOfNames); 137 | IntPtr pOrdinal = PtrAdd(pCode, Exports.AddressOfNameOrdinals); 138 | for (int i = 0; i < Exports.NumberOfNames; i++, pNameRef = PtrAdd(pNameRef, sizeof(uint)), pOrdinal = PtrAdd(pOrdinal, sizeof(ushort))) 139 | { 140 | uint NameRef = PtrRead(pNameRef); 141 | ushort Ordinal = PtrRead(pOrdinal); 142 | string curFuncName = Marshal.PtrToStringAnsi(PtrAdd(pCode, NameRef)); 143 | if (curFuncName == funcName) 144 | { 145 | if (Ordinal > Exports.NumberOfFunctions) throw new DllException("Invalid function ordinal"); 146 | IntPtr pAddressOfFunction = PtrAdd(pCode, (Exports.AddressOfFunctions + (uint)(Ordinal * 4))); 147 | return PtrAdd(pCode, PtrRead(pAddressOfFunction)); 148 | } 149 | } 150 | 151 | throw new DllException("Dll exports no function named " + funcName); 152 | } 153 | 154 | /// 155 | /// Call entry point of executable. 156 | /// 157 | /// Exitcode of executable 158 | public int MemoryCallEntryPoint() 159 | { 160 | if (Disposed) throw new ObjectDisposedException("DLLFromMemory"); 161 | if (IsDll || _exeEntry == null || !_isRelocated) throw new DllException("Unable to call entry point. Is loaded module a dll?"); 162 | return _exeEntry(); 163 | } 164 | 165 | void MemoryLoadLibrary(byte[] data) 166 | { 167 | if (data.Length < Marshal.SizeOf(typeof(IMAGE_DOS_HEADER))) throw new DllException("Not a valid executable file"); 168 | IMAGE_DOS_HEADER DosHeader = BytesReadStructAt(data, 0); 169 | if (DosHeader.e_magic != Win.IMAGE_DOS_SIGNATURE) throw new BadImageFormatException("Not a valid executable file"); 170 | 171 | if (data.Length < DosHeader.e_lfanew + Marshal.SizeOf(typeof(IMAGE_NT_HEADERS))) throw new DllException("Not a valid executable file"); 172 | IMAGE_NT_HEADERS OrgNTHeaders = BytesReadStructAt(data, DosHeader.e_lfanew); 173 | 174 | if (OrgNTHeaders.Signature != Win.IMAGE_NT_SIGNATURE) throw new BadImageFormatException("Not a valid PE file"); 175 | if (OrgNTHeaders.FileHeader.Machine != GetMachineType()) throw new BadImageFormatException("Machine type doesn't fit (i386 vs. AMD64)"); 176 | if ((OrgNTHeaders.OptionalHeader.SectionAlignment & 1) > 0) throw new BadImageFormatException("Wrong section alignment"); //Only support multiple of 2 177 | if (OrgNTHeaders.OptionalHeader.AddressOfEntryPoint == 0) throw new DllException("Module has no entry point"); 178 | 179 | SYSTEM_INFO systemInfo; 180 | Win.GetNativeSystemInfo(out systemInfo); 181 | uint lastSectionEnd = 0; 182 | int ofSection = Win.IMAGE_FIRST_SECTION(DosHeader.e_lfanew, OrgNTHeaders.FileHeader.SizeOfOptionalHeader); 183 | for (int i = 0; i != OrgNTHeaders.FileHeader.NumberOfSections; i++, ofSection += Sz.IMAGE_SECTION_HEADER) 184 | { 185 | IMAGE_SECTION_HEADER Section = BytesReadStructAt(data, ofSection); 186 | uint endOfSection = Section.VirtualAddress + (Section.SizeOfRawData > 0 ? Section.SizeOfRawData : OrgNTHeaders.OptionalHeader.SectionAlignment); 187 | if (endOfSection > lastSectionEnd) lastSectionEnd = endOfSection; 188 | } 189 | 190 | uint alignedImageSize = AlignValueUp(OrgNTHeaders.OptionalHeader.SizeOfImage, systemInfo.dwPageSize); 191 | uint alignedLastSection = AlignValueUp(lastSectionEnd, systemInfo.dwPageSize); 192 | if (alignedImageSize != alignedLastSection) throw new BadImageFormatException("Wrong section alignment"); 193 | 194 | IntPtr oldHeader_OptionalHeader_ImageBase; 195 | if (Is64BitProcess) oldHeader_OptionalHeader_ImageBase = (IntPtr)unchecked((long)(OrgNTHeaders.OptionalHeader.ImageBaseLong)); 196 | else oldHeader_OptionalHeader_ImageBase = (IntPtr)unchecked((int)(OrgNTHeaders.OptionalHeader.ImageBaseLong>>32)); 197 | 198 | // reserve memory for image of library 199 | pCode = Win.VirtualAlloc(oldHeader_OptionalHeader_ImageBase, (UIntPtr)OrgNTHeaders.OptionalHeader.SizeOfImage, AllocationType.RESERVE | AllocationType.COMMIT, MemoryProtection.READWRITE); 200 | //pCode = IntPtr.Zero; //test relocation with this 201 | 202 | // try to allocate memory at arbitrary position 203 | if (pCode == IntPtr.Zero) pCode = Win.VirtualAlloc(IntPtr.Zero, (UIntPtr)OrgNTHeaders.OptionalHeader.SizeOfImage, AllocationType.RESERVE | AllocationType.COMMIT, MemoryProtection.READWRITE); 204 | 205 | if (pCode == IntPtr.Zero) throw new DllException("Out of Memory"); 206 | 207 | if (Is64BitProcess && PtrSpanBoundary(pCode, alignedImageSize, 32)) 208 | { 209 | // Memory block may not span 4 GB (32 bit) boundaries. 210 | System.Collections.Generic.List BlockedMemory = new System.Collections.Generic.List(); 211 | while (PtrSpanBoundary(pCode, alignedImageSize, 32)) 212 | { 213 | BlockedMemory.Add(pCode); 214 | pCode = Win.VirtualAlloc(IntPtr.Zero, (UIntPtr)alignedImageSize, AllocationType.RESERVE | AllocationType.COMMIT, MemoryProtection.READWRITE); 215 | if (pCode == IntPtr.Zero) break; 216 | } 217 | foreach (IntPtr ptr in BlockedMemory) Win.VirtualFree(ptr, IntPtr.Zero, AllocationType.RELEASE); 218 | if (pCode == IntPtr.Zero) throw new DllException("Out of Memory"); 219 | } 220 | 221 | // commit memory for headers 222 | IntPtr headers = Win.VirtualAlloc(pCode, (UIntPtr)OrgNTHeaders.OptionalHeader.SizeOfHeaders, AllocationType.COMMIT, MemoryProtection.READWRITE); 223 | if (headers == IntPtr.Zero) throw new DllException("Out of Memory"); 224 | 225 | // copy PE header to code 226 | Marshal.Copy(data, 0, headers, (int)(OrgNTHeaders.OptionalHeader.SizeOfHeaders)); 227 | pNTHeaders = PtrAdd(headers, DosHeader.e_lfanew); 228 | 229 | IntPtr locationDelta = PtrSub(pCode, oldHeader_OptionalHeader_ImageBase); 230 | if (locationDelta != IntPtr.Zero) 231 | { 232 | // update relocated position 233 | Marshal.OffsetOf(typeof(IMAGE_NT_HEADERS), "OptionalHeader"); 234 | Marshal.OffsetOf(typeof(IMAGE_OPTIONAL_HEADER), "ImageBaseLong"); 235 | IntPtr pImageBase = PtrAdd(pNTHeaders, Of.IMAGE_NT_HEADERS_OptionalHeader + (Is64BitProcess ? Of64.IMAGE_OPTIONAL_HEADER_ImageBase : Of32.IMAGE_OPTIONAL_HEADER_ImageBase)); 236 | PtrWrite(pImageBase, pCode); 237 | } 238 | 239 | // copy sections from DLL file block to new memory location 240 | CopySections(ref OrgNTHeaders, pCode, pNTHeaders, data); 241 | 242 | // adjust base address of imported data 243 | _isRelocated = (locationDelta != IntPtr.Zero ? PerformBaseRelocation(ref OrgNTHeaders, pCode, locationDelta) : true); 244 | 245 | // load required dlls and adjust function table of imports 246 | ImportModules = BuildImportTable(ref OrgNTHeaders, pCode); 247 | 248 | // mark memory pages depending on section headers and release 249 | // sections that are marked as "discardable" 250 | FinalizeSections(ref OrgNTHeaders, pCode, pNTHeaders, systemInfo.dwPageSize); 251 | 252 | // TLS callbacks are executed BEFORE the main loading 253 | ExecuteTLS(ref OrgNTHeaders, pCode, pNTHeaders); 254 | 255 | // get entry point of loaded library 256 | IsDll = ((OrgNTHeaders.FileHeader.Characteristics & Win.IMAGE_FILE_DLL) != 0); 257 | if (OrgNTHeaders.OptionalHeader.AddressOfEntryPoint != 0) 258 | { 259 | if (IsDll) 260 | { 261 | // notify library about attaching to process 262 | IntPtr dllEntryPtr = PtrAdd(pCode, OrgNTHeaders.OptionalHeader.AddressOfEntryPoint); 263 | _dllEntry = (DllEntryDelegate)Marshal.GetDelegateForFunctionPointer(dllEntryPtr, typeof(DllEntryDelegate)); 264 | 265 | _initialized = (_dllEntry != null && _dllEntry(pCode, DllReason.DLL_PROCESS_ATTACH, IntPtr.Zero)); 266 | if (!_initialized) throw new DllException("Can't attach DLL to process"); 267 | } 268 | else 269 | { 270 | IntPtr exeEntryPtr = PtrAdd(pCode, OrgNTHeaders.OptionalHeader.AddressOfEntryPoint); 271 | _exeEntry = (ExeEntryDelegate)Marshal.GetDelegateForFunctionPointer(exeEntryPtr, typeof(ExeEntryDelegate)); 272 | } 273 | } 274 | } 275 | 276 | static void CopySections(ref IMAGE_NT_HEADERS OrgNTHeaders, IntPtr pCode, IntPtr pNTHeaders, byte[] data) 277 | { 278 | IntPtr pSection = Win.IMAGE_FIRST_SECTION(pNTHeaders, OrgNTHeaders.FileHeader.SizeOfOptionalHeader); 279 | for (int i = 0; i < OrgNTHeaders.FileHeader.NumberOfSections; i++, pSection = PtrAdd(pSection, Sz.IMAGE_SECTION_HEADER)) 280 | { 281 | IMAGE_SECTION_HEADER Section = PtrRead(pSection); 282 | if (Section.SizeOfRawData == 0) 283 | { 284 | // section doesn't contain data in the dll itself, but may define uninitialized data 285 | uint size = OrgNTHeaders.OptionalHeader.SectionAlignment; 286 | if (size > 0) 287 | { 288 | IntPtr dest = Win.VirtualAlloc(PtrAdd(pCode, Section.VirtualAddress), (UIntPtr)size, AllocationType.COMMIT, MemoryProtection.READWRITE); 289 | if (dest == IntPtr.Zero) throw new DllException("Unable to allocate memory"); 290 | 291 | // Always use position from file to support alignments smaller than page size (allocation above will align to page size). 292 | dest = PtrAdd(pCode, Section.VirtualAddress); 293 | 294 | // NOTE: On 64bit systems we truncate to 32bit here but expand again later when "PhysicalAddress" is used. 295 | PtrWrite(PtrAdd(pSection, Of.IMAGE_SECTION_HEADER_PhysicalAddress), unchecked((uint)(ulong)(long)dest)); 296 | 297 | Win.MemSet(dest, 0, (UIntPtr)size); 298 | } 299 | 300 | // section is empty 301 | continue; 302 | } 303 | else 304 | { 305 | // commit memory block and copy data from dll 306 | IntPtr dest = Win.VirtualAlloc(PtrAdd(pCode, Section.VirtualAddress), (UIntPtr)Section.SizeOfRawData, AllocationType.COMMIT, MemoryProtection.READWRITE); 307 | if (dest == IntPtr.Zero) throw new DllException("Out of memory"); 308 | 309 | // Always use position from file to support alignments smaller than page size (allocation above will align to page size). 310 | dest = PtrAdd(pCode, Section.VirtualAddress); 311 | Marshal.Copy(data, checked((int)Section.PointerToRawData), dest, checked((int)Section.SizeOfRawData)); 312 | 313 | // NOTE: On 64bit systems we truncate to 32bit here but expand again later when "PhysicalAddress" is used. 314 | PtrWrite(PtrAdd(pSection, Of.IMAGE_SECTION_HEADER_PhysicalAddress), unchecked((uint)(ulong)(long)dest)); 315 | } 316 | } 317 | } 318 | 319 | static bool PerformBaseRelocation(ref IMAGE_NT_HEADERS OrgNTHeaders, IntPtr pCode, IntPtr delta) 320 | { 321 | if (OrgNTHeaders.OptionalHeader.BaseRelocationTable.Size == 0) return (delta == IntPtr.Zero); 322 | 323 | for (IntPtr pRelocation = PtrAdd(pCode, OrgNTHeaders.OptionalHeader.BaseRelocationTable.VirtualAddress);;) 324 | { 325 | IMAGE_BASE_RELOCATION Relocation = PtrRead(pRelocation); 326 | if (Relocation.VirtualAdress == 0) break; 327 | 328 | IntPtr pDest = PtrAdd(pCode, Relocation.VirtualAdress); 329 | IntPtr pRelInfo = PtrAdd(pRelocation, Sz.IMAGE_BASE_RELOCATION); 330 | uint RelCount = ((Relocation.SizeOfBlock - Sz.IMAGE_BASE_RELOCATION) / 2); 331 | for (uint i = 0; i != RelCount ; i++, pRelInfo = PtrAdd(pRelInfo, sizeof(ushort))) 332 | { 333 | ushort relInfo = (ushort)Marshal.PtrToStructure(pRelInfo, typeof(ushort)); 334 | BasedRelocationType type = (BasedRelocationType)(relInfo >> 12); // the upper 4 bits define the type of relocation 335 | int offset = (relInfo & 0xfff); // the lower 12 bits define the offset 336 | IntPtr pPatchAddr = PtrAdd(pDest, offset); 337 | 338 | switch (type) 339 | { 340 | case BasedRelocationType.IMAGE_REL_BASED_ABSOLUTE: 341 | // skip relocation 342 | break; 343 | case BasedRelocationType.IMAGE_REL_BASED_HIGHLOW: 344 | // change complete 32 bit address 345 | int patchAddrHL = (int)Marshal.PtrToStructure(pPatchAddr, typeof(int)); 346 | patchAddrHL += (int)delta; 347 | Marshal.StructureToPtr(patchAddrHL, pPatchAddr, false); 348 | break; 349 | case BasedRelocationType.IMAGE_REL_BASED_DIR64: 350 | long patchAddr64 = (long)Marshal.PtrToStructure(pPatchAddr, typeof(long)); 351 | patchAddr64 += (long)delta; 352 | Marshal.StructureToPtr(patchAddr64, pPatchAddr, false); 353 | break; 354 | } 355 | } 356 | 357 | // advance to next relocation block 358 | pRelocation = PtrAdd(pRelocation, Relocation.SizeOfBlock); 359 | } 360 | return true; 361 | } 362 | 363 | static IntPtr[] BuildImportTable(ref IMAGE_NT_HEADERS OrgNTHeaders, IntPtr pCode) 364 | { 365 | System.Collections.Generic.List ImportModules = new System.Collections.Generic.List(); 366 | uint NumEntries = OrgNTHeaders.OptionalHeader.ImportTable.Size / Sz.IMAGE_IMPORT_DESCRIPTOR; 367 | IntPtr pImportDesc = PtrAdd(pCode, OrgNTHeaders.OptionalHeader.ImportTable.VirtualAddress); 368 | for (uint i = 0; i != NumEntries; i++, pImportDesc = PtrAdd(pImportDesc, Sz.IMAGE_IMPORT_DESCRIPTOR)) 369 | { 370 | IMAGE_IMPORT_DESCRIPTOR ImportDesc = PtrRead(pImportDesc); 371 | if (ImportDesc.Name == 0) break; 372 | 373 | IntPtr handle = Win.LoadLibrary(PtrAdd(pCode, ImportDesc.Name)); 374 | if (PtrIsInvalidHandle(handle)) 375 | { 376 | foreach (IntPtr m in ImportModules) Win.FreeLibrary(m); 377 | ImportModules.Clear(); 378 | throw new DllException("Can't load libary " + Marshal.PtrToStringAnsi(PtrAdd(pCode, ImportDesc.Name))); 379 | } 380 | ImportModules.Add(handle); 381 | 382 | IntPtr pThunkRef, pFuncRef; 383 | if (ImportDesc.OriginalFirstThunk > 0) 384 | { 385 | pThunkRef = PtrAdd(pCode, ImportDesc.OriginalFirstThunk); 386 | pFuncRef = PtrAdd(pCode, ImportDesc.FirstThunk); 387 | } 388 | else 389 | { 390 | // no hint table 391 | pThunkRef = PtrAdd(pCode, ImportDesc.FirstThunk); 392 | pFuncRef = PtrAdd(pCode, ImportDesc.FirstThunk); 393 | } 394 | for (int SzRef = IntPtr.Size; ; pThunkRef = PtrAdd(pThunkRef, SzRef), pFuncRef = PtrAdd(pFuncRef, SzRef)) 395 | { 396 | IntPtr ReadThunkRef = PtrRead(pThunkRef), WriteFuncRef; 397 | if (ReadThunkRef == IntPtr.Zero) break; 398 | if (Win.IMAGE_SNAP_BY_ORDINAL(ReadThunkRef)) 399 | { 400 | WriteFuncRef = Win.GetProcAddress(handle, Win.IMAGE_ORDINAL(ReadThunkRef)); 401 | } 402 | else 403 | { 404 | WriteFuncRef = Win.GetProcAddress(handle, PtrAdd(PtrAdd(pCode, ReadThunkRef), Of.IMAGE_IMPORT_BY_NAME_Name)); 405 | } 406 | if (WriteFuncRef == IntPtr.Zero) throw new DllException("Can't get adress for imported function"); 407 | PtrWrite(pFuncRef, WriteFuncRef); 408 | } 409 | } 410 | return (ImportModules.Count > 0 ? ImportModules.ToArray() : null); 411 | } 412 | 413 | static void FinalizeSections(ref IMAGE_NT_HEADERS OrgNTHeaders, IntPtr pCode, IntPtr pNTHeaders, uint PageSize) 414 | { 415 | UIntPtr imageOffset = (Is64BitProcess ? (UIntPtr)(unchecked((ulong)pCode.ToInt64()) & 0xffffffff00000000) : UIntPtr.Zero); 416 | IntPtr pSection = Win.IMAGE_FIRST_SECTION(pNTHeaders, OrgNTHeaders.FileHeader.SizeOfOptionalHeader); 417 | IMAGE_SECTION_HEADER Section = PtrRead(pSection); 418 | SectionFinalizeData sectionData = new SectionFinalizeData(); 419 | sectionData.Address = PtrBitOr(PtrAdd((IntPtr)0, Section.PhysicalAddress), imageOffset); 420 | sectionData.AlignedAddress = PtrAlignDown(sectionData.Address, (UIntPtr)PageSize); 421 | sectionData.Size = GetRealSectionSize(ref Section, ref OrgNTHeaders); 422 | sectionData.Characteristics = Section.Characteristics; 423 | sectionData.Last = false; 424 | pSection = PtrAdd(pSection, Sz.IMAGE_SECTION_HEADER); 425 | 426 | // loop through all sections and change access flags 427 | for (int i = 1; i < OrgNTHeaders.FileHeader.NumberOfSections; i++, pSection = PtrAdd(pSection, Sz.IMAGE_SECTION_HEADER)) 428 | { 429 | Section = PtrRead(pSection); 430 | IntPtr sectionAddress = PtrBitOr(PtrAdd((IntPtr)0, Section.PhysicalAddress), imageOffset); 431 | IntPtr alignedAddress = PtrAlignDown(sectionAddress, (UIntPtr)PageSize); 432 | IntPtr sectionSize = GetRealSectionSize(ref Section, ref OrgNTHeaders); 433 | 434 | // Combine access flags of all sections that share a page 435 | // TODO(fancycode): We currently share flags of a trailing large section with the page of a first small section. This should be optimized. 436 | IntPtr a = PtrAdd(sectionData.Address, sectionData.Size); 437 | ulong b = unchecked((ulong)a.ToInt64()), c = unchecked((ulong)alignedAddress); 438 | 439 | if (sectionData.AlignedAddress == alignedAddress || unchecked((ulong)PtrAdd(sectionData.Address, sectionData.Size).ToInt64()) > unchecked((ulong)alignedAddress)) 440 | { 441 | // Section shares page with previous 442 | if ((Section.Characteristics & Win.IMAGE_SCN_MEM_DISCARDABLE) == 0 || (sectionData.Characteristics & Win.IMAGE_SCN_MEM_DISCARDABLE) == 0) 443 | { 444 | sectionData.Characteristics = (sectionData.Characteristics | Section.Characteristics) & ~Win.IMAGE_SCN_MEM_DISCARDABLE; 445 | } 446 | else 447 | { 448 | sectionData.Characteristics |= Section.Characteristics; 449 | } 450 | sectionData.Size = PtrSub(PtrAdd(sectionAddress, sectionSize), sectionData.Address); 451 | continue; 452 | } 453 | 454 | FinalizeSection(sectionData, PageSize, OrgNTHeaders.OptionalHeader.SectionAlignment); 455 | 456 | sectionData.Address = sectionAddress; 457 | sectionData.AlignedAddress = alignedAddress; 458 | sectionData.Size = sectionSize; 459 | sectionData.Characteristics = Section.Characteristics; 460 | } 461 | sectionData.Last = true; 462 | FinalizeSection(sectionData, PageSize, OrgNTHeaders.OptionalHeader.SectionAlignment); 463 | } 464 | 465 | static void FinalizeSection(SectionFinalizeData SectionData, uint PageSize, uint SectionAlignment) 466 | { 467 | if (SectionData.Size == IntPtr.Zero) 468 | return; 469 | 470 | if ((SectionData.Characteristics & Win.IMAGE_SCN_MEM_DISCARDABLE) > 0) 471 | { 472 | // section is not needed any more and can safely be freed 473 | if (SectionData.Address == SectionData.AlignedAddress && 474 | (SectionData.Last || 475 | SectionAlignment == PageSize || 476 | (unchecked((ulong)SectionData.Size.ToInt64()) % PageSize) == 0) 477 | ) 478 | { 479 | // Only allowed to decommit whole pages 480 | Win.VirtualFree(SectionData.Address, SectionData.Size, AllocationType.DECOMMIT); 481 | } 482 | return; 483 | } 484 | 485 | // determine protection flags based on characteristics 486 | int readable = (SectionData.Characteristics & (uint)ImageSectionFlags.IMAGE_SCN_MEM_READ) != 0 ? 1 : 0; 487 | int writeable = (SectionData.Characteristics & (uint)ImageSectionFlags.IMAGE_SCN_MEM_WRITE) != 0 ? 1 : 0; 488 | int executable = (SectionData.Characteristics & (uint)ImageSectionFlags.IMAGE_SCN_MEM_EXECUTE) != 0 ? 1 : 0; 489 | uint protect = (uint)ProtectionFlags[executable, readable, writeable]; 490 | if ((SectionData.Characteristics & Win.IMAGE_SCN_MEM_NOT_CACHED) > 0) protect |= Win.PAGE_NOCACHE; 491 | 492 | // change memory access flags 493 | uint oldProtect; 494 | if (!Win.VirtualProtect(SectionData.Address, SectionData.Size, protect, out oldProtect)) 495 | throw new DllException("Error protecting memory page"); 496 | } 497 | 498 | static void ExecuteTLS(ref IMAGE_NT_HEADERS OrgNTHeaders, IntPtr pCode, IntPtr pNTHeaders) 499 | { 500 | if (OrgNTHeaders.OptionalHeader.TLSTable.VirtualAddress == 0) return; 501 | IMAGE_TLS_DIRECTORY tlsDir = PtrRead(PtrAdd(pCode, OrgNTHeaders.OptionalHeader.TLSTable.VirtualAddress)); 502 | IntPtr pCallBack = tlsDir.AddressOfCallBacks; 503 | if (pCallBack != IntPtr.Zero) 504 | { 505 | for (IntPtr Callback; (Callback = PtrRead(pCallBack)) != IntPtr.Zero; pCallBack = PtrAdd(pCallBack, IntPtr.Size)) 506 | { 507 | ImageTlsDelegate tls = (ImageTlsDelegate)Marshal.GetDelegateForFunctionPointer(Callback, typeof(ImageTlsDelegate)); 508 | tls(pCode, DllReason.DLL_PROCESS_ATTACH, IntPtr.Zero); 509 | } 510 | } 511 | } 512 | 513 | /// 514 | /// Check if the process runs in 64bit mode or in 32bit mode 515 | /// 516 | /// True if process is 64bit, false if it is 32bit 517 | public static bool Is64BitProcess { get { return IntPtr.Size == 8; } } 518 | 519 | static uint GetMachineType() { return (IntPtr.Size == 8 ? Win.IMAGE_FILE_MACHINE_AMD64 : Win.IMAGE_FILE_MACHINE_I386); } 520 | 521 | static uint AlignValueUp(uint value, uint alignment) { return (value + alignment - 1) & ~(alignment - 1); } 522 | 523 | static IntPtr GetRealSectionSize(ref IMAGE_SECTION_HEADER Section, ref IMAGE_NT_HEADERS NTHeaders) 524 | { 525 | uint size = Section.SizeOfRawData; 526 | if (size == 0) 527 | { 528 | if ((Section.Characteristics & Win.IMAGE_SCN_CNT_INITIALIZED_DATA) > 0) 529 | { 530 | size = NTHeaders.OptionalHeader.SizeOfInitializedData; 531 | } 532 | else if ((Section.Characteristics & Win.IMAGE_SCN_CNT_UNINITIALIZED_DATA) > 0) 533 | { 534 | size = NTHeaders.OptionalHeader.SizeOfUninitializedData; 535 | } 536 | } 537 | return (IntPtr.Size == 8 ? (IntPtr)unchecked((long)size) : (IntPtr)unchecked((int)size)); 538 | } 539 | 540 | public void Close() { ((IDisposable)this).Dispose(); } 541 | 542 | void IDisposable.Dispose() 543 | { 544 | Dispose(); 545 | GC.SuppressFinalize(this); 546 | } 547 | 548 | public void Dispose() 549 | { 550 | if (_initialized) 551 | { 552 | if (_dllEntry != null) _dllEntry.Invoke(pCode, DllReason.DLL_PROCESS_DETACH, IntPtr.Zero); 553 | _initialized = false; 554 | } 555 | 556 | if (ImportModules != null) 557 | { 558 | foreach (IntPtr m in ImportModules) if (!PtrIsInvalidHandle(m)) Win.FreeLibrary(m); 559 | ImportModules = null; 560 | } 561 | 562 | if (pCode != IntPtr.Zero) 563 | { 564 | Win.VirtualFree(pCode, IntPtr.Zero, AllocationType.RELEASE); 565 | pCode = IntPtr.Zero; 566 | pNTHeaders = IntPtr.Zero; 567 | } 568 | 569 | Disposed = true; 570 | } 571 | 572 | // Protection flags for memory pages (Executable, Readable, Writeable) 573 | static readonly PageProtection[,,] ProtectionFlags = new PageProtection[2,2,2] 574 | { 575 | { 576 | // not executable 577 | { PageProtection.NOACCESS, PageProtection.WRITECOPY }, 578 | { PageProtection.READONLY, PageProtection.READWRITE } 579 | }, 580 | { 581 | // executable 582 | { PageProtection.EXECUTE, PageProtection.EXECUTE_WRITECOPY }, 583 | { PageProtection.EXECUTE_READ, PageProtection.EXECUTE_READWRITE } 584 | } 585 | }; 586 | 587 | struct SectionFinalizeData 588 | { 589 | internal IntPtr Address; 590 | internal IntPtr AlignedAddress; 591 | internal IntPtr Size; 592 | internal uint Characteristics; 593 | internal bool Last; 594 | } 595 | 596 | class Of 597 | { 598 | internal const int IMAGE_NT_HEADERS_OptionalHeader = 24; 599 | internal const int IMAGE_SECTION_HEADER_PhysicalAddress = 8; 600 | internal const int IMAGE_IMPORT_BY_NAME_Name = 2; 601 | } 602 | 603 | class Of32 604 | { 605 | internal const int IMAGE_OPTIONAL_HEADER_ImageBase = 28; 606 | internal const int IMAGE_OPTIONAL_HEADER_ExportTable = 96; 607 | } 608 | 609 | class Of64 610 | { 611 | internal const int IMAGE_OPTIONAL_HEADER_ImageBase = 24; 612 | internal const int IMAGE_OPTIONAL_HEADER_ExportTable = 112; 613 | } 614 | 615 | class Sz 616 | { 617 | internal const int IMAGE_SECTION_HEADER = 40; 618 | internal const int IMAGE_BASE_RELOCATION = 8; 619 | internal const int IMAGE_IMPORT_DESCRIPTOR = 20; 620 | } 621 | 622 | [StructLayout(LayoutKind.Sequential)] struct IMAGE_DOS_HEADER 623 | { 624 | public ushort e_magic; // Magic number 625 | public ushort e_cblp; // Bytes on last page of file 626 | public ushort e_cp; // Pages in file 627 | public ushort e_crlc; // Relocations 628 | public ushort e_cparhdr; // Size of header in paragraphs 629 | public ushort e_minalloc; // Minimum extra paragraphs needed 630 | public ushort e_maxalloc; // Maximum extra paragraphs needed 631 | public ushort e_ss; // Initial (relative) SS value 632 | public ushort e_sp; // Initial SP value 633 | public ushort e_csum; // Checksum 634 | public ushort e_ip; // Initial IP value 635 | public ushort e_cs; // Initial (relative) CS value 636 | public ushort e_lfarlc; // File address of relocation table 637 | public ushort e_ovno; // Overlay number 638 | public ushort e_res1a,e_res1b,e_res1c,e_res1d; // Reserved words 639 | public ushort e_oemid; // OEM identifier (for e_oeminfo) 640 | public ushort e_oeminfo; // OEM information; e_oemid specific 641 | public ushort e_res2a,e_res2b,e_res2c,e_res2d,e_res2e,e_res2f,e_res2g,e_res2h,e_res2i,e_res2j; // Reserved words 642 | public int e_lfanew; // File address of new exe header 643 | } 644 | 645 | [StructLayout(LayoutKind.Sequential)] struct IMAGE_NT_HEADERS 646 | { 647 | public uint Signature; 648 | public IMAGE_FILE_HEADER FileHeader; 649 | public IMAGE_OPTIONAL_HEADER OptionalHeader; 650 | } 651 | 652 | [StructLayout(LayoutKind.Sequential)] struct IMAGE_FILE_HEADER 653 | { 654 | public ushort Machine; 655 | public ushort NumberOfSections; 656 | public uint TimeDateStamp; 657 | public uint PointerToSymbolTable; 658 | public uint NumberOfSymbols; 659 | public ushort SizeOfOptionalHeader; 660 | public ushort Characteristics; 661 | } 662 | 663 | [StructLayout(LayoutKind.Sequential)] struct IMAGE_OPTIONAL_HEADER 664 | { 665 | public MagicType Magic; 666 | public byte MajorLinkerVersion; 667 | public byte MinorLinkerVersion; 668 | public uint SizeOfCode; 669 | public uint SizeOfInitializedData; 670 | public uint SizeOfUninitializedData; 671 | public uint AddressOfEntryPoint; 672 | public uint BaseOfCode; 673 | public ulong ImageBaseLong; 674 | public uint SectionAlignment; 675 | public uint FileAlignment; 676 | public ushort MajorOperatingSystemVersion; 677 | public ushort MinorOperatingSystemVersion; 678 | public ushort MajorImageVersion; 679 | public ushort MinorImageVersion; 680 | public ushort MajorSubsystemVersion; 681 | public ushort MinorSubsystemVersion; 682 | public uint Win32VersionValue; 683 | public uint SizeOfImage; 684 | public uint SizeOfHeaders; 685 | public uint CheckSum; 686 | public SubSystemType Subsystem; 687 | public DllCharacteristicsType DllCharacteristics; 688 | public IntPtr SizeOfStackReserve; 689 | public IntPtr SizeOfStackCommit; 690 | public IntPtr SizeOfHeapReserve; 691 | public IntPtr SizeOfHeapCommit; 692 | public uint LoaderFlags; 693 | public uint NumberOfRvaAndSizes; 694 | public IMAGE_DATA_DIRECTORY ExportTable; 695 | public IMAGE_DATA_DIRECTORY ImportTable; 696 | public IMAGE_DATA_DIRECTORY ResourceTable; 697 | public IMAGE_DATA_DIRECTORY ExceptionTable; 698 | public IMAGE_DATA_DIRECTORY CertificateTable; 699 | public IMAGE_DATA_DIRECTORY BaseRelocationTable; 700 | public IMAGE_DATA_DIRECTORY Debug; 701 | public IMAGE_DATA_DIRECTORY Architecture; 702 | public IMAGE_DATA_DIRECTORY GlobalPtr; 703 | public IMAGE_DATA_DIRECTORY TLSTable; 704 | public IMAGE_DATA_DIRECTORY LoadConfigTable; 705 | public IMAGE_DATA_DIRECTORY BoundImport; 706 | public IMAGE_DATA_DIRECTORY IAT; 707 | public IMAGE_DATA_DIRECTORY DelayImportDescriptor; 708 | public IMAGE_DATA_DIRECTORY CLRRuntimeHeader; 709 | public IMAGE_DATA_DIRECTORY Reserved; 710 | } 711 | 712 | [StructLayout(LayoutKind.Sequential)] struct IMAGE_DATA_DIRECTORY 713 | { 714 | public uint VirtualAddress; 715 | public uint Size; 716 | } 717 | 718 | [StructLayout(LayoutKind.Sequential)] struct IMAGE_SECTION_HEADER 719 | { 720 | public ulong Name; //8 byte string 721 | public uint PhysicalAddress; 722 | public uint VirtualAddress; 723 | public uint SizeOfRawData; 724 | public uint PointerToRawData; 725 | public uint PointerToRelocations; 726 | public uint PointerToLinenumbers; 727 | public ushort NumberOfRelocations; 728 | public ushort NumberOfLinenumbers; 729 | public uint Characteristics; 730 | } 731 | 732 | [StructLayout(LayoutKind.Sequential)] struct IMAGE_BASE_RELOCATION 733 | { 734 | public uint VirtualAdress; 735 | public uint SizeOfBlock; 736 | } 737 | 738 | [StructLayout(LayoutKind.Sequential)] struct IMAGE_IMPORT_DESCRIPTOR 739 | { 740 | public uint OriginalFirstThunk; 741 | public uint TimeDateStamp; 742 | public uint ForwarderChain; 743 | public uint Name; 744 | public uint FirstThunk; 745 | } 746 | 747 | [StructLayout(LayoutKind.Sequential)] struct IMAGE_EXPORT_DIRECTORY 748 | { 749 | public uint Characteristics; 750 | public uint TimeDateStamp; 751 | public ushort MajorVersion; 752 | public ushort MinorVersion; 753 | public uint Name; 754 | public uint Base; 755 | public uint NumberOfFunctions; 756 | public uint NumberOfNames; 757 | public uint AddressOfFunctions; // RVA from base of image 758 | public uint AddressOfNames; // RVA from base of image 759 | public uint AddressOfNameOrdinals; // RVA from base of image 760 | } 761 | 762 | [StructLayout(LayoutKind.Sequential)] struct SYSTEM_INFO 763 | { 764 | public ushort wProcessorArchitecture; 765 | public ushort wReserved; 766 | public uint dwPageSize; 767 | public IntPtr lpMinimumApplicationAddress; 768 | public IntPtr lpMaximumApplicationAddress; 769 | public IntPtr dwActiveProcessorMask; 770 | public uint dwNumberOfProcessors; 771 | public uint dwProcessorType; 772 | public uint dwAllocationGranularity; 773 | public ushort wProcessorLevel; 774 | public ushort wProcessorRevision; 775 | }; 776 | 777 | [StructLayout(LayoutKind.Sequential)] struct IMAGE_TLS_DIRECTORY 778 | { 779 | public IntPtr StartAddressOfRawData; 780 | public IntPtr EndAddressOfRawData; 781 | public IntPtr AddressOfIndex; 782 | public IntPtr AddressOfCallBacks; 783 | public IntPtr SizeOfZeroFill; 784 | public uint Characteristics; 785 | } 786 | 787 | enum MagicType : ushort 788 | { 789 | IMAGE_NT_OPTIONAL_HDR32_MAGIC = 0x10b, 790 | IMAGE_NT_OPTIONAL_HDR64_MAGIC = 0x20b 791 | } 792 | 793 | enum SubSystemType : ushort 794 | { 795 | IMAGE_SUBSYSTEM_UNKNOWN = 0, 796 | IMAGE_SUBSYSTEM_NATIVE = 1, 797 | IMAGE_SUBSYSTEM_WINDOWS_GUI = 2, 798 | IMAGE_SUBSYSTEM_WINDOWS_CUI = 3, 799 | IMAGE_SUBSYSTEM_POSIX_CUI = 7, 800 | IMAGE_SUBSYSTEM_WINDOWS_CE_GUI = 9, 801 | IMAGE_SUBSYSTEM_EFI_APPLICATION = 10, 802 | IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER = 11, 803 | IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER = 12, 804 | IMAGE_SUBSYSTEM_EFI_ROM = 13, 805 | IMAGE_SUBSYSTEM_XBOX = 14 806 | } 807 | 808 | enum DllCharacteristicsType : ushort 809 | { 810 | RES_0 = 0x0001, 811 | RES_1 = 0x0002, 812 | RES_2 = 0x0004, 813 | RES_3 = 0x0008, 814 | IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE = 0x0040, 815 | IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY = 0x0080, 816 | IMAGE_DLL_CHARACTERISTICS_NX_COMPAT = 0x0100, 817 | IMAGE_DLLCHARACTERISTICS_NO_ISOLATION = 0x0200, 818 | IMAGE_DLLCHARACTERISTICS_NO_SEH = 0x0400, 819 | IMAGE_DLLCHARACTERISTICS_NO_BIND = 0x0800, 820 | RES_4 = 0x1000, 821 | IMAGE_DLLCHARACTERISTICS_WDM_DRIVER = 0x2000, 822 | IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = 0x8000 823 | } 824 | 825 | enum BasedRelocationType 826 | { 827 | IMAGE_REL_BASED_ABSOLUTE = 0, 828 | IMAGE_REL_BASED_HIGH = 1, 829 | IMAGE_REL_BASED_LOW = 2, 830 | IMAGE_REL_BASED_HIGHLOW = 3, 831 | IMAGE_REL_BASED_HIGHADJ = 4, 832 | IMAGE_REL_BASED_MIPS_JMPADDR = 5, 833 | IMAGE_REL_BASED_MIPS_JMPADDR16 = 9, 834 | IMAGE_REL_BASED_IA64_IMM64 = 9, 835 | IMAGE_REL_BASED_DIR64 = 10 836 | } 837 | 838 | enum AllocationType : uint 839 | { 840 | COMMIT = 0x1000, 841 | RESERVE = 0x2000, 842 | RESET = 0x80000, 843 | LARGE_PAGES = 0x20000000, 844 | PHYSICAL = 0x400000, 845 | TOP_DOWN = 0x100000, 846 | WRITE_WATCH = 0x200000, 847 | DECOMMIT = 0x4000, 848 | RELEASE = 0x8000 849 | } 850 | 851 | enum MemoryProtection : uint 852 | { 853 | EXECUTE = 0x10, 854 | EXECUTE_READ = 0x20, 855 | EXECUTE_READWRITE = 0x40, 856 | EXECUTE_WRITECOPY = 0x80, 857 | NOACCESS = 0x01, 858 | READONLY = 0x02, 859 | READWRITE = 0x04, 860 | WRITECOPY = 0x08, 861 | GUARD_Modifierflag = 0x100, 862 | NOCACHE_Modifierflag = 0x200, 863 | WRITECOMBINE_Modifierflag = 0x400 864 | } 865 | 866 | enum PageProtection 867 | { 868 | NOACCESS = 0x01, 869 | READONLY = 0x02, 870 | READWRITE = 0x04, 871 | WRITECOPY = 0x08, 872 | EXECUTE = 0x10, 873 | EXECUTE_READ = 0x20, 874 | EXECUTE_READWRITE = 0x40, 875 | EXECUTE_WRITECOPY = 0x80, 876 | GUARD = 0x100, 877 | NOCACHE = 0x200, 878 | WRITECOMBINE = 0x400, 879 | } 880 | 881 | enum ImageSectionFlags : uint 882 | { 883 | IMAGE_SCN_LNK_NRELOC_OVFL = 0x01000000, // Section contains extended relocations. 884 | IMAGE_SCN_MEM_DISCARDABLE = 0x02000000, // Section can be discarded. 885 | IMAGE_SCN_MEM_NOT_CACHED = 0x04000000, // Section is not cachable. 886 | IMAGE_SCN_MEM_NOT_PAGED = 0x08000000, // Section is not pageable. 887 | IMAGE_SCN_MEM_SHARED = 0x10000000, // Section is shareable. 888 | IMAGE_SCN_MEM_EXECUTE = 0x20000000, // Section is executable. 889 | IMAGE_SCN_MEM_READ = 0x40000000, // Section is readable. 890 | IMAGE_SCN_MEM_WRITE = 0x80000000 // Section is writeable. 891 | } 892 | 893 | enum DllReason : uint 894 | { 895 | DLL_PROCESS_ATTACH = 1, 896 | DLL_THREAD_ATTACH = 2, 897 | DLL_THREAD_DETACH = 3, 898 | DLL_PROCESS_DETACH = 0 899 | } 900 | 901 | class Win 902 | { 903 | public const ushort IMAGE_DOS_SIGNATURE = 0x5A4D; 904 | public const uint IMAGE_NT_SIGNATURE = 0x00004550; 905 | public const uint IMAGE_FILE_MACHINE_I386 = 0x014c; 906 | public const uint IMAGE_FILE_MACHINE_AMD64 = 0x8664; 907 | public const uint PAGE_NOCACHE = 0x200; 908 | public const uint IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040; 909 | public const uint IMAGE_SCN_CNT_UNINITIALIZED_DATA = 0x00000080; 910 | public const uint IMAGE_SCN_MEM_DISCARDABLE = 0x02000000; 911 | public const uint IMAGE_SCN_MEM_NOT_CACHED = 0x04000000; 912 | public const uint IMAGE_FILE_DLL = 0x2000; 913 | 914 | [DllImport("kernel32.dll", SetLastError = true)] 915 | public static extern IntPtr VirtualAlloc(IntPtr lpAddress, UIntPtr dwSize, AllocationType flAllocationType, MemoryProtection flProtect); 916 | 917 | [DllImport("msvcrt.dll", EntryPoint = "memset", CallingConvention = CallingConvention.Cdecl, SetLastError = false)] 918 | public static extern IntPtr MemSet(IntPtr dest, int c, UIntPtr count); 919 | 920 | [DllImport("kernel32.dll", CharSet = CharSet.Ansi, SetLastError = true)] 921 | public static extern IntPtr LoadLibrary(IntPtr lpFileName); 922 | 923 | [DllImport("kernel32.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)] 924 | public static extern IntPtr GetProcAddress(IntPtr hModule, IntPtr procName); 925 | 926 | [DllImport("kernel32.dll", SetLastError = true)] 927 | public static extern bool VirtualFree(IntPtr lpAddress, IntPtr dwSize, AllocationType dwFreeType); 928 | 929 | [DllImport("kernel32.dll", SetLastError = true)] 930 | public static extern bool VirtualProtect(IntPtr lpAddress, IntPtr dwSize, uint flNewProtect, out uint lpflOldProtect); 931 | 932 | [DllImport("kernel32.dll", SetLastError = true)] 933 | public static extern bool FreeLibrary(IntPtr hModule); 934 | 935 | [DllImport("kernel32.dll", SetLastError = true)] 936 | public static extern void GetNativeSystemInfo(out SYSTEM_INFO lpSystemInfo); 937 | 938 | // Equivalent to the IMAGE_FIRST_SECTION macro 939 | public static IntPtr IMAGE_FIRST_SECTION(IntPtr pNTHeader, ushort ntheader_FileHeader_SizeOfOptionalHeader) 940 | { 941 | return PtrAdd(pNTHeader, Of.IMAGE_NT_HEADERS_OptionalHeader + (int)ntheader_FileHeader_SizeOfOptionalHeader); 942 | } 943 | 944 | // Equivalent to the IMAGE_FIRST_SECTION macro 945 | public static int IMAGE_FIRST_SECTION(int lfanew, ushort ntheader_FileHeader_SizeOfOptionalHeader) 946 | { 947 | return lfanew + Of.IMAGE_NT_HEADERS_OptionalHeader + ntheader_FileHeader_SizeOfOptionalHeader; 948 | } 949 | 950 | // Equivalent to the IMAGE_ORDINAL32/64 macros 951 | public static IntPtr IMAGE_ORDINAL(IntPtr ordinal) 952 | { 953 | return (IntPtr)(int)(unchecked((ulong)ordinal.ToInt64()) & 0xffff); 954 | } 955 | 956 | // Equivalent to the IMAGE_SNAP_BY_ORDINAL32/64 macro 957 | public static bool IMAGE_SNAP_BY_ORDINAL(IntPtr ordinal) 958 | { 959 | return (IntPtr.Size == 8 ? (ordinal.ToInt64() < 0) : (ordinal.ToInt32() < 0)); 960 | } 961 | } 962 | 963 | static T PtrRead(IntPtr ptr) { return (T)Marshal.PtrToStructure(ptr, typeof(T)); } 964 | static void PtrWrite(IntPtr ptr, T val) { Marshal.StructureToPtr(val, ptr, false); } 965 | static IntPtr PtrAdd(IntPtr p, int v) { return (IntPtr)(p.ToInt64() + v); } 966 | static IntPtr PtrAdd(IntPtr p, uint v) { return (IntPtr.Size == 8 ? (IntPtr)(p.ToInt64() + unchecked((long)v)) : (IntPtr)(p.ToInt32() + unchecked((int)v))); } 967 | static IntPtr PtrAdd(IntPtr p, IntPtr v) { return (IntPtr.Size == 8 ? (IntPtr)(p.ToInt64() + v.ToInt64()) : (IntPtr)(p.ToInt32() + v.ToInt32())); } 968 | static IntPtr PtrAdd(IntPtr p, UIntPtr v) { return (IntPtr.Size == 8 ? (IntPtr)(p.ToInt64() + unchecked((long)v.ToUInt64())) : (IntPtr)(p.ToInt32() + unchecked((int)v.ToUInt32()))); } 969 | static IntPtr PtrSub(IntPtr p, IntPtr v) { return (IntPtr.Size == 8 ? (IntPtr)(p.ToInt64() - v.ToInt64()) : (IntPtr)(p.ToInt32() - v.ToInt32())); } 970 | static IntPtr PtrBitOr(IntPtr p, UIntPtr v) { return (IntPtr.Size == 8 ? (IntPtr)unchecked((long)(unchecked((ulong)p.ToInt64()) | v.ToUInt64())) : (IntPtr)unchecked((int)(unchecked((uint)p.ToInt32()) | v.ToUInt32()))); } 971 | static IntPtr PtrAlignDown(IntPtr p, UIntPtr align) { return (IntPtr)unchecked((long)(unchecked((ulong)p.ToInt64()) & ~(align.ToUInt64() - 1))); } 972 | static bool PtrIsInvalidHandle(IntPtr h) { return (h == IntPtr.Zero || h == (IntPtr.Size == 8 ? (IntPtr)(long)-1 : (IntPtr)(int)-1)); } 973 | static bool PtrSpanBoundary(IntPtr p, uint Size, int BoundaryBits) { return ((unchecked((ulong)p.ToInt64()) >> BoundaryBits) < ((unchecked((ulong)(p.ToInt64())) + Size) >> BoundaryBits)); } 974 | 975 | static T BytesReadStructAt(byte[] buf, int offset) 976 | { 977 | int size = Marshal.SizeOf(typeof(T)); 978 | IntPtr ptr = Marshal.AllocHGlobal(size); 979 | Marshal.Copy(buf, offset, ptr, size); 980 | T res = (T)Marshal.PtrToStructure(ptr, typeof(T)); 981 | Marshal.FreeHGlobal(ptr); 982 | return res; 983 | } 984 | } 985 | -------------------------------------------------------------------------------- /TestInWinform2/Form1.Designer.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace TestInWinform2 3 | { 4 | partial class Form1 5 | { 6 | /// 7 | /// Variable nécessaire au concepteur. 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// Nettoyage des ressources utilisées. 13 | /// 14 | /// true si les ressources managées doivent être supprimées ; sinon, false. 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Code généré par le Concepteur Windows Form 25 | 26 | /// 27 | /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas 28 | /// le contenu de cette méthode avec l'éditeur de code. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | this.SuspendLayout(); 33 | // 34 | // Form1 35 | // 36 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 37 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 38 | this.ClientSize = new System.Drawing.Size(800, 450); 39 | this.Name = "Form1"; 40 | this.Text = "Form1"; 41 | this.Load += new System.EventHandler(this.Form1_Load); 42 | this.ResumeLayout(false); 43 | 44 | } 45 | 46 | #endregion 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /TestInWinform2/Form1.cs: -------------------------------------------------------------------------------- 1 |  2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Data; 6 | using System.Drawing; 7 | using System.Linq; 8 | using System.Runtime.InteropServices; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | using System.Windows.Forms; 12 | 13 | namespace TestInWinform2 14 | { 15 | public partial class Form1 : Form 16 | { 17 | public Form1() 18 | { 19 | InitializeComponent(); 20 | } 21 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 22 | public delegate int SomeExportedFunctionInTheDll(int a, int b); 23 | private unsafe void Form1_Load(object sender, EventArgs e) 24 | { 25 | 26 | DLLFromMemory dll = new DLLFromMemory(Properties.Resources.DllInC__); 27 | 28 | SomeExportedFunctionInTheDll addFunc = dll.GetDelegateFromFuncName("AddInteger"); 29 | MessageBox.Show( addFunc.DynamicInvoke(10, 10).ToString()); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /TestInWinform2/Form1.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /TestInWinform2/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace TestInWinform2 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// Point d'entrée principal de l'application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new Form1()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /TestInWinform2/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // Les informations générales relatives à un assembly dépendent de 6 | // l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations 7 | // associées à un assembly. 8 | [assembly: AssemblyTitle("TestInWinform2")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("TestInWinform2")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly 18 | // aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de 19 | // COM, affectez la valeur true à l'attribut ComVisible sur ce type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM 23 | [assembly: Guid("138f9852-3f97-47da-ade7-6ae60fc5c9af")] 24 | 25 | // Les informations de version pour un assembly se composent des quatre valeurs suivantes : 26 | // 27 | // Version principale 28 | // Version secondaire 29 | // Numéro de build 30 | // Révision 31 | // 32 | // Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut 33 | // en utilisant '*', comme indiqué ci-dessous : 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /TestInWinform2/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Ce code a été généré par un outil. 4 | // Version du runtime :4.0.30319.42000 5 | // 6 | // Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si 7 | // le code est régénéré. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace TestInWinform2.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées. 17 | /// 18 | // Cette classe a été générée automatiquement par la classe StronglyTypedResourceBuilder 19 | // à l'aide d'un outil, tel que ResGen ou Visual Studio. 20 | // Pour ajouter ou supprimer un membre, modifiez votre fichier .ResX, puis réexécutez ResGen 21 | // avec l'option /str ou régénérez votre projet VS. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Retourne l'instance ResourceManager mise en cache utilisée par cette classe. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TestInWinform2.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Remplace la propriété CurrentUICulture du thread actuel pour toutes 51 | /// les recherches de ressources à l'aide de cette classe de ressource fortement typée. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Recherche une ressource localisée de type System.Byte[]. 65 | /// 66 | internal static byte[] DllInC__ { 67 | get { 68 | object obj = ResourceManager.GetObject("DllInC__", resourceCulture); 69 | return ((byte[])(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// Recherche une ressource localisée de type System.Byte[]. 75 | /// 76 | internal static byte[] DllInDLang { 77 | get { 78 | object obj = ResourceManager.GetObject("DllInDLang", resourceCulture); 79 | return ((byte[])(obj)); 80 | } 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /TestInWinform2/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\Resources\DllInC++.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 123 | 124 | 125 | ..\Resources\DllInDLang.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 126 | 127 | -------------------------------------------------------------------------------- /TestInWinform2/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | 12 | namespace TestInWinform2.Properties 13 | { 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 17 | { 18 | 19 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 20 | 21 | public static Settings Default 22 | { 23 | get 24 | { 25 | return defaultInstance; 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /TestInWinform2/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TestInWinform2/Resources/DllInC++.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/Resources/DllInC++.dll -------------------------------------------------------------------------------- /TestInWinform2/Resources/DllInDLang.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/Resources/DllInDLang.dll -------------------------------------------------------------------------------- /TestInWinform2/TestDllInjection.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {138F9852-3F97-47DA-ADE7-6AE60FC5C9AF} 8 | WinExe 9 | TestInWinform2 10 | TestInWinform2 11 | v4.8 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | true 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | true 38 | bin\x64\Debug\ 39 | DEBUG;TRACE 40 | true 41 | full 42 | x64 43 | 7.3 44 | prompt 45 | true 46 | 47 | 48 | bin\x64\Release\ 49 | TRACE 50 | true 51 | pdbonly 52 | x64 53 | 7.3 54 | prompt 55 | true 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | Form 74 | 75 | 76 | Form1.cs 77 | 78 | 79 | 80 | 81 | Form1.cs 82 | 83 | 84 | ResXFileCodeGenerator 85 | Resources.Designer.cs 86 | Designer 87 | 88 | 89 | True 90 | Resources.resx 91 | True 92 | 93 | 94 | SettingsSingleFileGenerator 95 | Settings.Designer.cs 96 | 97 | 98 | True 99 | Settings.settings 100 | True 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /TestInWinform2/bin/Debug/TestInWinform2.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/bin/Debug/TestInWinform2.exe -------------------------------------------------------------------------------- /TestInWinform2/bin/Debug/TestInWinform2.exe.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /TestInWinform2/bin/Debug/TestInWinform2.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/bin/Debug/TestInWinform2.pdb -------------------------------------------------------------------------------- /TestInWinform2/bin/x64/Debug/TestInWinform2.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/bin/x64/Debug/TestInWinform2.exe -------------------------------------------------------------------------------- /TestInWinform2/bin/x64/Debug/TestInWinform2.exe.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /TestInWinform2/bin/x64/Debug/TestInWinform2.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/bin/x64/Debug/TestInWinform2.pdb -------------------------------------------------------------------------------- /TestInWinform2/obj/Debug/.NETFramework,Version=v4.8.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] 5 | -------------------------------------------------------------------------------- /TestInWinform2/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /TestInWinform2/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll -------------------------------------------------------------------------------- /TestInWinform2/obj/Debug/TestInWinform2.Form1.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/obj/Debug/TestInWinform2.Form1.resources -------------------------------------------------------------------------------- /TestInWinform2/obj/Debug/TestInWinform2.Properties.Resources.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/obj/Debug/TestInWinform2.Properties.Resources.resources -------------------------------------------------------------------------------- /TestInWinform2/obj/Debug/TestInWinform2.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 522c61c71ad8069af6de7e81f18ff8545db35f1f 2 | -------------------------------------------------------------------------------- /TestInWinform2/obj/Debug/TestInWinform2.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\TestInWinform2\obj\Debug\TestInWinform2.Form1.resources 2 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\TestInWinform2\obj\Debug\TestInWinform2.Properties.Resources.resources 3 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\TestInWinform2\obj\Debug\TestInWinform2.csproj.GenerateResource.cache 4 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\TestInWinform2\obj\Debug\TestInWinform2.csproj.CoreCompileInputs.cache 5 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\TestInWinform2\bin\Debug\TestInWinform2.exe.config 6 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\TestInWinform2\bin\Debug\TestInWinform2.exe 7 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\TestInWinform2\bin\Debug\TestInWinform2.pdb 8 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\TestInWinform2\obj\Debug\TestInWinform2.exe 9 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\TestInWinform2\obj\Debug\TestInWinform2.pdb 10 | -------------------------------------------------------------------------------- /TestInWinform2/obj/Debug/TestInWinform2.csproj.GenerateResource.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/obj/Debug/TestInWinform2.csproj.GenerateResource.cache -------------------------------------------------------------------------------- /TestInWinform2/obj/Debug/TestInWinform2.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/obj/Debug/TestInWinform2.exe -------------------------------------------------------------------------------- /TestInWinform2/obj/Debug/TestInWinform2.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/obj/Debug/TestInWinform2.pdb -------------------------------------------------------------------------------- /TestInWinform2/obj/Release/.NETFramework,Version=v4.8.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] 5 | -------------------------------------------------------------------------------- /TestInWinform2/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /TestInWinform2/obj/Release/TempPE/Properties.Resources.Designer.cs.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/obj/Release/TempPE/Properties.Resources.Designer.cs.dll -------------------------------------------------------------------------------- /TestInWinform2/obj/x64/Debug/.NETFramework,Version=v4.8.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] 5 | -------------------------------------------------------------------------------- /TestInWinform2/obj/x64/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/obj/x64/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /TestInWinform2/obj/x64/Debug/TempPE/Properties.Resources.Designer.cs.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/obj/x64/Debug/TempPE/Properties.Resources.Designer.cs.dll -------------------------------------------------------------------------------- /TestInWinform2/obj/x64/Debug/TestInWinform2.Form1.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/obj/x64/Debug/TestInWinform2.Form1.resources -------------------------------------------------------------------------------- /TestInWinform2/obj/x64/Debug/TestInWinform2.Properties.Resources.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/obj/x64/Debug/TestInWinform2.Properties.Resources.resources -------------------------------------------------------------------------------- /TestInWinform2/obj/x64/Debug/TestInWinform2.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 5371bb670670383fdce0b41b89b0dfd3479ab505 2 | -------------------------------------------------------------------------------- /TestInWinform2/obj/x64/Debug/TestInWinform2.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\TestInWinform2\bin\x64\Debug\TestInWinform2.exe.config 2 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\TestInWinform2\bin\x64\Debug\TestInWinform2.exe 3 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\TestInWinform2\bin\x64\Debug\TestInWinform2.pdb 4 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\TestInWinform2\obj\x64\Debug\TestInWinform2.Form1.resources 5 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\TestInWinform2\obj\x64\Debug\TestInWinform2.Properties.Resources.resources 6 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\TestInWinform2\obj\x64\Debug\TestInWinform2.csproj.GenerateResource.cache 7 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\TestInWinform2\obj\x64\Debug\TestInWinform2.csproj.CoreCompileInputs.cache 8 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\TestInWinform2\obj\x64\Debug\TestInWinform2.exe 9 | C:\Users\mehdi\source\repos\WindowsApp3\WindowsApp3\bin\Debug\DynamicDllLoader-master\TestInWinform2\obj\x64\Debug\TestInWinform2.pdb 10 | -------------------------------------------------------------------------------- /TestInWinform2/obj/x64/Debug/TestInWinform2.csproj.GenerateResource.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/obj/x64/Debug/TestInWinform2.csproj.GenerateResource.cache -------------------------------------------------------------------------------- /TestInWinform2/obj/x64/Debug/TestInWinform2.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/obj/x64/Debug/TestInWinform2.exe -------------------------------------------------------------------------------- /TestInWinform2/obj/x64/Debug/TestInWinform2.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/TestInWinform2/obj/x64/Debug/TestInWinform2.pdb -------------------------------------------------------------------------------- /x64/Debug/DllInC++.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/x64/Debug/DllInC++.dll -------------------------------------------------------------------------------- /x64/Debug/DllInDLang.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arsium/DLLFromMemory-CSharp/4f005eea262f19264cd403b108447f43f5dafd6a/x64/Debug/DllInDLang.dll --------------------------------------------------------------------------------