コード例 #1
0
 static Kernel32()
 {
     HModule = NativeLibrary.Load(_moduleName);
     // ProcessEnv
     GetCommandLineA = Marshal.GetDelegateForFunctionPointer <GetCommandLineADelegate>(NativeLibrary.GetExport(HModule, nameof(GetCommandLineA)));
     GetCommandLineW = Marshal.GetDelegateForFunctionPointer <GetCommandLineWDelegate>(NativeLibrary.GetExport(HModule, nameof(GetCommandLineW)));
     // LibLoaderApi
     LoadLibraryA       = Marshal.GetDelegateForFunctionPointer <LoadLibraryADelegate>(NativeLibrary.GetExport(HModule, nameof(LoadLibraryA)));
     GetProcAddress     = Marshal.GetDelegateForFunctionPointer <GetProcAddressDelegate>(NativeLibrary.GetExport(HModule, nameof(GetProcAddress)));
     FreeLibrary        = Marshal.GetDelegateForFunctionPointer <FreeLibraryDelegate>(NativeLibrary.GetExport(HModule, nameof(FreeLibrary)));
     GetModuleFileNameW = Marshal.GetDelegateForFunctionPointer <GetModuleFileNameWDelegate>(NativeLibrary.GetExport(HModule, nameof(GetModuleFileNameW)));
     // ProcessThreadsApi
     GetCurrentProcess  = Marshal.GetDelegateForFunctionPointer <GetCurrentProcessDelegate>(NativeLibrary.GetExport(HModule, nameof(GetCurrentProcess)));
     CreateProcessA     = Marshal.GetDelegateForFunctionPointer <CreateProcessADelegate>(NativeLibrary.GetExport(HModule, nameof(CreateProcessA)));
     CreateProcessW     = Marshal.GetDelegateForFunctionPointer <CreateProcessWDelegate>(NativeLibrary.GetExport(HModule, nameof(CreateProcessW)));
     TerminateProcess   = Marshal.GetDelegateForFunctionPointer <TerminateProcessDelegate>(NativeLibrary.GetExport(HModule, nameof(TerminateProcess)));
     GetCurrentThreadId = Marshal.GetDelegateForFunctionPointer <GetCurrentThreadIdDelegate>(NativeLibrary.GetExport(HModule, nameof(GetCurrentThreadId)));
     CreateThread       = Marshal.GetDelegateForFunctionPointer <CreateThreadDelegate>(NativeLibrary.GetExport(HModule, nameof(CreateThread)));
     OpenThread         = Marshal.GetDelegateForFunctionPointer <OpenThreadDelegate>(NativeLibrary.GetExport(HModule, nameof(OpenThread)));
     SuspendThread      = Marshal.GetDelegateForFunctionPointer <SuspendThreadDelegate>(NativeLibrary.GetExport(HModule, nameof(SuspendThread)));
     ResumeThread       = Marshal.GetDelegateForFunctionPointer <ResumeThreadDelegate>(NativeLibrary.GetExport(HModule, nameof(ResumeThread)));
     // SynchApi
     CreateEventA        = Marshal.GetDelegateForFunctionPointer <CreateEventADelegate>(NativeLibrary.GetExport(HModule, nameof(CreateEventA)));
     OpenEventA          = Marshal.GetDelegateForFunctionPointer <OpenEventADelegate>(NativeLibrary.GetExport(HModule, nameof(OpenEventA)));
     SetEvent            = Marshal.GetDelegateForFunctionPointer <SetEventDelegate>(NativeLibrary.GetExport(HModule, nameof(SetEvent)));
     ResetEvent          = Marshal.GetDelegateForFunctionPointer <ResetEventDelegate>(NativeLibrary.GetExport(HModule, nameof(ResetEvent)));
     CreateMutexA        = Marshal.GetDelegateForFunctionPointer <CreateMutexADelegate>(NativeLibrary.GetExport(HModule, nameof(CreateMutexA)));
     CreateMutexW        = Marshal.GetDelegateForFunctionPointer <CreateMutexWDelegate>(NativeLibrary.GetExport(HModule, nameof(CreateMutexW)));
     WaitForSingleObject = Marshal.GetDelegateForFunctionPointer <WaitForSingleObjectDelegate>(NativeLibrary.GetExport(HModule, nameof(WaitForSingleObject)));
     // MemoryApi
     VirtualProtect = Marshal.GetDelegateForFunctionPointer <VirtualProtectDelegate>(NativeLibrary.GetExport(HModule, nameof(VirtualProtect)));
     // HandleApi
     DuplicateHandle = Marshal.GetDelegateForFunctionPointer <DuplicateHandleDelegate>(NativeLibrary.GetExport(HModule, nameof(DuplicateHandle)));
     CloseHandle     = Marshal.GetDelegateForFunctionPointer <CloseHandleDelegate>(NativeLibrary.GetExport(HModule, nameof(CloseHandle)));
     // NamedPipeApi
     CreatePipe = Marshal.GetDelegateForFunctionPointer <CreatePipeDelegate>(NativeLibrary.GetExport(HModule, nameof(CreatePipe)));
     // FileApi
     CreateFileA    = Marshal.GetDelegateForFunctionPointer <CreateFileADelegate>(NativeLibrary.GetExport(HModule, nameof(CreateFileA)));
     CreateFileW    = Marshal.GetDelegateForFunctionPointer <CreateFileWDelegate>(NativeLibrary.GetExport(HModule, nameof(CreateFileW)));
     FindFirstFileA = Marshal.GetDelegateForFunctionPointer <FindFirstFileADelegate>(NativeLibrary.GetExport(HModule, nameof(FindFirstFileA)));
     FindFirstFileW = Marshal.GetDelegateForFunctionPointer <FindFirstFileWDelegate>(NativeLibrary.GetExport(HModule, nameof(FindFirstFileW)));
     FindClose      = Marshal.GetDelegateForFunctionPointer <FindCloseDelegate>(NativeLibrary.GetExport(HModule, nameof(FindClose)));
     // ErrHandlingApi
     SetErrorMode = Marshal.GetDelegateForFunctionPointer <SetErrorModeDelegate>(NativeLibrary.GetExport(HModule, nameof(SetErrorMode)));
     GetLastError = Marshal.GetDelegateForFunctionPointer <GetLastErrorDelegate>(NativeLibrary.GetExport(HModule, nameof(GetLastError)));
     // WinBase
     LStrLenA             = Marshal.GetDelegateForFunctionPointer <LStrLenADelegate>(NativeLibrary.GetExport(HModule, "lstrlenA"));
     LStrLen2A            = Marshal.GetDelegateForFunctionPointer <LStrLen2ADelegate>(NativeLibrary.GetExport(HModule, "lstrlenA"));
     SetCurrentDirectoryW = Marshal.GetDelegateForFunctionPointer <SetCurrentDirectoryWDelegate>(NativeLibrary.GetExport(HModule, nameof(SetCurrentDirectoryW)));
     GetCurrentDirectoryW = Marshal.GetDelegateForFunctionPointer <GetCurrentDirectoryWDelegate>(NativeLibrary.GetExport(HModule, nameof(GetCurrentDirectoryW)));
     // Windows
     AllocConsole     = Marshal.GetDelegateForFunctionPointer <AllocConsoleDelegate>(NativeLibrary.GetExport(HModule, nameof(AllocConsole)));
     GetConsoleWindow = Marshal.GetDelegateForFunctionPointer <GetConsoleWindowDelegate>(NativeLibrary.GetExport(HModule, nameof(GetConsoleWindow)));
 }
コード例 #2
0
ファイル: MsVcRt.cs プロジェクト: Qibbi/LookingGlass
 static MsVcRt()
 {
     _hModule       = NativeLibrary.Load(_moduleName);
     ClearMemoryInt = Marshal.GetDelegateForFunctionPointer <ClearMemoryDelegate>(NativeLibrary.GetExport(_hModule, "memset"));
     MemICmp        = Marshal.GetDelegateForFunctionPointer <MemICmpDelegate>(NativeLibrary.GetExport(_hModule, "_memicmp"));
 }
コード例 #3
0
ファイル: Ws2_32.cs プロジェクト: Qibbi/LookingGlass
 static Ws2_32()
 {
     HModule = NativeLibrary.Load(_moduleName);
     // WinSock
     GetHostByName = Marshal.GetDelegateForFunctionPointer <GetHostByNameDelegate>(NativeLibrary.GetExport(HModule, "gethostbyname"));
     Send          = Marshal.GetDelegateForFunctionPointer <SendDelegate>(NativeLibrary.GetExport(HModule, "send"));
 }
コード例 #4
0
 static User32()
 {
     HModule = NativeLibrary.Load(_moduleName);
     // Windows
     IsWindowUnicode            = Marshal.GetDelegateForFunctionPointer <IsWindowUnicodeDelegate>(NativeLibrary.GetExport(HModule, nameof(IsWindowUnicode)));
     DefWindowProcA             = Marshal.GetDelegateForFunctionPointer <DefWindowProcADelegate>(NativeLibrary.GetExport(HModule, nameof(DefWindowProcA)));
     DefWindowProcW             = Marshal.GetDelegateForFunctionPointer <DefWindowProcWDelegate>(NativeLibrary.GetExport(HModule, nameof(DefWindowProcW)));
     ShowWindow                 = Marshal.GetDelegateForFunctionPointer <ShowWindowDelegate>(NativeLibrary.GetExport(HModule, nameof(ShowWindow)));
     SetLayeredWindowAttributes = Marshal.GetDelegateForFunctionPointer <SetLayeredWindowAttributesDelegate>(NativeLibrary.GetExport(HModule, nameof(SetLayeredWindowAttributes)));
     RegisterWindowMessageA     = Marshal.GetDelegateForFunctionPointer <RegisterWindowMessageADelegate>(NativeLibrary.GetExport(HModule, nameof(RegisterWindowMessageA)));
     GetWindowRect              = Marshal.GetDelegateForFunctionPointer <GetWindowRectDelegate>(NativeLibrary.GetExport(HModule, nameof(GetWindowRect)));
     PostMessageA               = Marshal.GetDelegateForFunctionPointer <PostMessageADelegate>(NativeLibrary.GetExport(HModule, nameof(PostMessageA)));
     PostQuitMessage            = Marshal.GetDelegateForFunctionPointer <PostQuitMessageDelegate>(NativeLibrary.GetExport(HModule, nameof(PostQuitMessage)));
     ClipCursor                 = Marshal.GetDelegateForFunctionPointer <ClipCursorDelegate>(NativeLibrary.GetExport(HModule, nameof(ClipCursor)));
 }
コード例 #5
0
ファイル: PsApi.cs プロジェクト: Qibbi/LookingGlass
 static PsApi()
 {
     HModule = NativeLibrary.Load(_moduleName);
     // Windows
     EnumProcessModules   = Marshal.GetDelegateForFunctionPointer <EnumProcessModulesDelegate>(NativeLibrary.GetExport(HModule, nameof(EnumProcessModules)));
     EnumProcessModulesEx = Marshal.GetDelegateForFunctionPointer <EnumProcessModulesExDelegate>(NativeLibrary.GetExport(HModule, nameof(EnumProcessModulesEx)));
 }