Beispiel #1
0
 static Kernel32()
 {
     HModule = NativeLibrary.Load(_moduleName);
     // LibLoaderApi
     GetModuleFileNameW = Marshal.GetDelegateForFunctionPointer <GetModuleFileNameWDelegate>(NativeLibrary.GetExport(HModule, nameof(GetModuleFileNameW)));
     // ProcessThreadsApi
     CreateProcessW   = Marshal.GetDelegateForFunctionPointer <CreateProcessWDelegate>(NativeLibrary.GetExport(HModule, nameof(CreateProcessW)));
     TerminateProcess = Marshal.GetDelegateForFunctionPointer <TerminateProcessDelegate>(NativeLibrary.GetExport(HModule, nameof(TerminateProcess)));
     OpenThread       = Marshal.GetDelegateForFunctionPointer <OpenThreadDelegate>(NativeLibrary.GetExport(HModule, nameof(OpenThread)));
     ResumeThread     = Marshal.GetDelegateForFunctionPointer <ResumeThreadDelegate>(NativeLibrary.GetExport(HModule, nameof(ResumeThread)));
     // SynchApi
     WaitForSingleObject = Marshal.GetDelegateForFunctionPointer <WaitForSingleObjectDelegate>(NativeLibrary.GetExport(HModule, nameof(WaitForSingleObject)));
     // MemoryApi
     VirtualProtect = Marshal.GetDelegateForFunctionPointer <VirtualProtectDelegate>(NativeLibrary.GetExport(HModule, nameof(VirtualProtect)));
     // HandleApi
     CloseHandle = Marshal.GetDelegateForFunctionPointer <CloseHandleDelegate>(NativeLibrary.GetExport(HModule, nameof(CloseHandle)));
     // FileApi
     FindFirstFileW = Marshal.GetDelegateForFunctionPointer <FindFirstFileWDelegate>(NativeLibrary.GetExport(HModule, nameof(FindFirstFileW)));
     FindClose      = Marshal.GetDelegateForFunctionPointer <FindCloseDelegate>(NativeLibrary.GetExport(HModule, nameof(FindClose)));
     // WinBase
     SetCurrentDirectoryW = Marshal.GetDelegateForFunctionPointer <SetCurrentDirectoryWDelegate>(NativeLibrary.GetExport(HModule, nameof(SetCurrentDirectoryW)));
     // Windows
     AllocConsole     = Marshal.GetDelegateForFunctionPointer <AllocConsoleDelegate>(NativeLibrary.GetExport(HModule, nameof(AllocConsole)));
     GetConsoleWindow = Marshal.GetDelegateForFunctionPointer <GetConsoleWindowDelegate>(NativeLibrary.GetExport(HModule, nameof(GetConsoleWindow)));
 }
Beispiel #2
0
 static User32()
 {
     HModule = NativeLibrary.Load(_moduleName);
     // Windows
     SetLayeredWindowAttributes = Marshal.GetDelegateForFunctionPointer <SetLayeredWindowAttributesDelegate>(NativeLibrary.GetExport(HModule, nameof(SetLayeredWindowAttributes)));
     ShowWindow = Marshal.GetDelegateForFunctionPointer <ShowWindowDelegate>(NativeLibrary.GetExport(HModule, nameof(ShowWindow)));
 }
Beispiel #3
0
 static AdvApi32()
 {
     HModule = NativeLibrary.Load(_moduleName);
     // WinReg
     RegOpenKeyExW    = Marshal.GetDelegateForFunctionPointer <RegOpenKeyExWDelegate>(NativeLibrary.GetExport(HModule, nameof(RegOpenKeyExW)));
     RegQueryValueExA = Marshal.GetDelegateForFunctionPointer <RegQueryValueExADelegate>(NativeLibrary.GetExport(HModule, nameof(RegQueryValueExA)));
     RegQueryValueExW = Marshal.GetDelegateForFunctionPointer <RegQueryValueExWDelegate>(NativeLibrary.GetExport(HModule, nameof(RegQueryValueExW)));
     RegCloseKey      = Marshal.GetDelegateForFunctionPointer <RegCloseKeyDelegate>(NativeLibrary.GetExport(HModule, nameof(RegCloseKey)));
 }
Beispiel #4
0
 static MsVcRt()
 {
     _hModule        = NativeLibrary.Load(_moduleName);
     _clearMemoryInt = Marshal.GetDelegateForFunctionPointer <ClearMemoryDelegate>(NativeLibrary.GetExport(_hModule, "memset"));
     MemICmp         = Marshal.GetDelegateForFunctionPointer <MemICmpDelegate>(NativeLibrary.GetExport(_hModule, "_memicmp"));
 }
Beispiel #5
0
 static Ws2_32()
 {
     HModule = NativeLibrary.Load(_moduleName);
     // WinSock
     GetHostByName = Marshal.GetDelegateForFunctionPointer <GetHostByNameDelegate>(NativeLibrary.GetExport(HModule, "gethostbyname"));
     Send          = Marshal.GetDelegateForFunctionPointer <SendDelegate>(NativeLibrary.GetExport(HModule, "send"));
 }