能力值:
( LV15,RANK:3306 )
|
-
-
2 楼
按区段搜索吧
|
能力值:
(RANK:290 )
|
-
-
3 楼
http://bbs.pediy.com/showthread.php?t=151311
|
能力值:
( LV2,RANK:10 )
|
-
-
4 楼
这个代码不全,像GetFunctionIndexByName我都不知道怎么实现的。有完整的这个函数的例子吗?有的话发我学习一下。谢谢了
|
能力值:
( LV2,RANK:10 )
|
-
-
5 楼
3L给出的代码是A盾中的。LZ可以看看A盾代码 我把GetFunctionIndexByName代码贴出来。
BOOL GetFunctionIndexByName(CHAR *lpszFunctionName,int *Index)
{
UNICODE_STRING wsNtDllString;
HANDLE hNtSection;
ULONG ulNtDllModuleBase;
PIMAGE_DOS_HEADER pDosHeader;
PIMAGE_NT_HEADERS NtDllHeader;
IMAGE_OPTIONAL_HEADER opthdr;
DWORD* arrayOfFunctionAddresses;
DWORD* arrayOfFunctionNames;
WORD* arrayOfFunctionOrdinals;
DWORD functionOrdinal;
DWORD Base, x, functionAddress,position;
char* functionName;
IMAGE_EXPORT_DIRECTORY *pExportTable;
BOOL bRetOK = FALSE;
BOOL bInit = FALSE;
STRING lpszSearchFunction;
STRING lpszFunction;
__try
{
RRtlInitUnicodeString = ReLoadNtosCALL(L"RtlInitUnicodeString",SystemKernelModuleBase,ImageModuleBase);
RZwClose = ReLoadNtosCALL(L"ZwClose",SystemKernelModuleBase,ImageModuleBase);
if (RRtlInitUnicodeString &&
RZwClose)
{
bInit = TRUE;
}
if (!bInit)
return NULL;
RRtlInitUnicodeString(&wsNtDllString,L"\\SystemRoot\\System32\\ntdll.dll");
hNtSection = MapFileAsSection(&wsNtDllString,&ulNtDllModuleBase); //载入到内存
if (!hNtSection)
{
return bRetOK;
}
RZwClose(hNtSection);
//NtDllHeader=(PIMAGE_NT_HEADERS)GetPeHead((ULONG)ulNtDllModuleBase);
pDosHeader=(PIMAGE_DOS_HEADER)ulNtDllModuleBase;
if (pDosHeader->e_magic!=IMAGE_DOS_SIGNATURE)
{
if (DebugOn)
KdPrint(("failed to find NtHeader\r\n"));
return bRetOK;
}
NtDllHeader=(PIMAGE_NT_HEADERS)(ULONG)((ULONG)pDosHeader+pDosHeader->e_lfanew);
if (NtDllHeader->Signature!=IMAGE_NT_SIGNATURE)
{
if (DebugOn)
KdPrint(("failed to find NtHeader\r\n"));
return bRetOK;
}
opthdr = NtDllHeader->OptionalHeader;
pExportTable =(IMAGE_EXPORT_DIRECTORY*)((BYTE*)ulNtDllModuleBase + opthdr.DataDirectory[ IMAGE_DIRECTORY_ENTRY_EXPORT]. VirtualAddress); //得到导出表
arrayOfFunctionAddresses = (DWORD*)( (BYTE*)ulNtDllModuleBase + pExportTable->AddressOfFunctions); //地址表
arrayOfFunctionNames = (DWORD*)((BYTE*)ulNtDllModuleBase + pExportTable->AddressOfNames); //函数名表
arrayOfFunctionOrdinals = (WORD*)( (BYTE*)ulNtDllModuleBase + pExportTable->AddressOfNameOrdinals);
Base = pExportTable->Base;
for(x = 0; x < pExportTable->NumberOfFunctions; x++) //在整个导出表里扫描
{
functionName = (char*)( (BYTE*)ulNtDllModuleBase + arrayOfFunctionNames[x]);
functionOrdinal = arrayOfFunctionOrdinals[x] + Base - 1;
functionAddress = (DWORD)((BYTE*)ulNtDllModuleBase + arrayOfFunctionAddresses[functionOrdinal]);
position = *((WORD*)(functionAddress + 1)); //得到服务号
RtlInitString(&lpszSearchFunction,functionName);
RtlInitString(&lpszFunction,lpszFunctionName);
if (RtlCompareString(&lpszSearchFunction,&lpszFunction,TRUE) == 0)
{
if (DebugOn)
KdPrint(("Find FunctionName:%s\r\nposition:%d\r\n",functionName,position));
*Index = position;
bRetOK = TRUE;
break;
}
}
}__except(EXCEPTION_EXECUTE_HANDLER){
}
return bRetOK;
}
|
能力值:
( LV2,RANK:10 )
|
-
-
6 楼
楼上说的很好……
|
|
|