/* * Process Hacker - * function import module * * Copyright (C) 2009-2010 wj32 * * This file is part of Process Hacker. * * Process Hacker is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Process Hacker is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Process Hacker. If not, see . */ #define NTIMPORT_PRIVATE #include #include #define GetProc(DllName, ProcName) GetProcAddress(GetModuleHandle(L##DllName), (ProcName)) #define InitProc(DllName, ProcName) ((ProcName) = (_##ProcName)GetProc(DllName, #ProcName)) #define InitProcReq(DllName, ProcName) \ if (!InitProc(DllName, ProcName)) \ { \ PhShowError( \ NULL, \ L"Process Hacker cannot run on your operating system. Unable to find %S in %S.", \ #ProcName, \ DllName \ ); \ return FALSE; \ } BOOLEAN PhInitializeImports() { InitProcReq("ntdll.dll", NtAccessCheck); InitProcReq("ntdll.dll", NtAlertResumeThread); InitProcReq("ntdll.dll", NtAlertThread); InitProcReq("ntdll.dll", NtAllocateVirtualMemory); InitProcReq("ntdll.dll", NtClose); InitProcReq("ntdll.dll", NtCreateDebugObject); InitProcReq("ntdll.dll", NtCreateDirectoryObject); InitProcReq("ntdll.dll", NtCreateFile); InitProcReq("ntdll.dll", NtCreateKeyedEvent); InitProcReq("ntdll.dll", NtCreateMailslotFile); InitProcReq("ntdll.dll", NtCreateNamedPipeFile); InitProcReq("ntdll.dll", NtCreateSection); InitProcReq("ntdll.dll", NtDebugActiveProcess); InitProcReq("ntdll.dll", NtDeleteFile); InitProcReq("ntdll.dll", NtDeviceIoControlFile); InitProcReq("ntdll.dll", NtDuplicateObject); InitProcReq("ntdll.dll", NtExtendSection); InitProcReq("ntdll.dll", NtFreeVirtualMemory); InitProcReq("ntdll.dll", NtFsControlFile); InitProcReq("ntdll.dll", NtGetContextThread); InitProc("ntdll.dll", NtGetNextProcess); InitProc("ntdll.dll", NtGetNextThread); InitProcReq("ntdll.dll", NtLoadDriver); InitProcReq("ntdll.dll", NtMapViewOfSection); InitProcReq("ntdll.dll", NtOpenDirectoryObject); InitProcReq("ntdll.dll", NtOpenFile); InitProcReq("ntdll.dll", NtOpenKeyedEvent); InitProcReq("ntdll.dll", NtOpenProcess); InitProcReq("ntdll.dll", NtOpenProcessToken); InitProcReq("ntdll.dll", NtOpenSection); InitProcReq("ntdll.dll", NtOpenThread); InitProcReq("ntdll.dll", NtOpenThreadToken); InitProcReq("ntdll.dll", NtPrivilegeCheck); InitProcReq("ntdll.dll", NtProtectVirtualMemory); InitProcReq("ntdll.dll", NtQueryDirectoryObject); InitProc("ntdll.dll", NtQueryInformationEnlistment); InitProcReq("ntdll.dll", NtQueryInformationFile); InitProcReq("ntdll.dll", NtQueryInformationProcess); InitProc("ntdll.dll", NtQueryInformationResourceManager); InitProcReq("ntdll.dll", NtQueryInformationThread); InitProcReq("ntdll.dll", NtQueryInformationToken); InitProc("ntdll.dll", NtQueryInformationTransaction); InitProc("ntdll.dll", NtQueryInformationTransactionManager); InitProcReq("ntdll.dll", NtQueryObject); InitProcReq("ntdll.dll", NtQuerySection); InitProcReq("ntdll.dll", NtQuerySecurityObject); InitProcReq("ntdll.dll", NtQuerySystemInformation); InitProcReq("ntdll.dll", NtQueryVirtualMemory); InitProcReq("ntdll.dll", NtQueueApcThread); InitProcReq("ntdll.dll", NtReadFile); InitProcReq("ntdll.dll", NtReadVirtualMemory); InitProcReq("ntdll.dll", NtReleaseKeyedEvent); InitProcReq("ntdll.dll", NtRemoveProcessDebug); InitProcReq("ntdll.dll", NtResumeProcess); InitProcReq("ntdll.dll", NtResumeThread); InitProcReq("ntdll.dll", NtSetContextThread); InitProcReq("ntdll.dll", NtSetInformationDebugObject); InitProcReq("ntdll.dll", NtSetInformationFile); InitProcReq("ntdll.dll", NtSetInformationProcess); InitProcReq("ntdll.dll", NtSetInformationThread); InitProcReq("ntdll.dll", NtSetInformationToken); InitProcReq("ntdll.dll", NtSetSecurityObject); InitProcReq("ntdll.dll", NtSuspendProcess); InitProcReq("ntdll.dll", NtSuspendThread); InitProcReq("ntdll.dll", NtTerminateProcess); InitProcReq("ntdll.dll", NtTerminateThread); InitProcReq("ntdll.dll", NtUnloadDriver); InitProcReq("ntdll.dll", NtUnmapViewOfSection); InitProcReq("ntdll.dll", NtWaitForKeyedEvent); InitProcReq("ntdll.dll", NtWaitForSingleObject); InitProcReq("ntdll.dll", NtWriteFile); InitProcReq("ntdll.dll", NtWriteVirtualMemory); InitProcReq("ntdll.dll", RtlCopySecurityDescriptor); InitProcReq("ntdll.dll", RtlCreateQueryDebugBuffer); InitProcReq("ntdll.dll", RtlCreateUserThread); InitProcReq("ntdll.dll", RtlDeleteSecurityObject); InitProcReq("ntdll.dll", RtlDestroyQueryDebugBuffer); InitProcReq("ntdll.dll", RtlFindMessage); InitProcReq("ntdll.dll", RtlMultiByteToUnicodeN); InitProcReq("ntdll.dll", RtlMultiByteToUnicodeSize); InitProcReq("ntdll.dll", RtlNewSecurityObject); InitProcReq("ntdll.dll", RtlNtStatusToDosError); InitProcReq("ntdll.dll", RtlQueryProcessDebugInformation); InitProcReq("ntdll.dll", RtlQuerySecurityObject); InitProcReq("ntdll.dll", RtlSetSecurityObject); InitProcReq("ntdll.dll", RtlUnicodeToMultiByteN); InitProcReq("ntdll.dll", RtlUnicodeToMultiByteSize); return TRUE; }