亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? memscan.c.svn-base

?? 這是一段游戲修改工具的源代碼.ring3功能由dephi開發,驅動是C開發.希望對大家有幫助
?? SVN-BASE
?? 第 1 頁 / 共 3 頁
字號:
#include "ntifs.h"
#include <windef.h>
#ifdef CETC
#include "tdiwrapper.h"
#include "kfiles.h"
#endif
#include "memscan.h"
#include "DBKFunc.h"
#include "vmxhelper.h"
#include "rootkit.h"


BOOLEAN IsAddressSafe(UINT_PTR StartAddress)
{


	//note: Add support for PAE enabled systems
	//return TRUE;
#ifdef AMD64
	return TRUE; //for now
#endif
/*	MDL x;

	
	MmProbeAndLockPages(&x,KernelMode,IoModifyAccess);


	MmUnlockPages(&x);
	*/
	ULONG kernelbase=0x7ffe0000;

	if ((!HiddenDriver) && (StartAddress<kernelbase))
		return TRUE;

    {
		UINT_PTR PTE,PDE;
		struct PTEStruct *x;
		
		/*
		PHYSICAL_ADDRESS physical;
		physical=MmGetPhysicalAddress((PVOID)StartAddress);
		return (physical.QuadPart!=0);*/


		PTE=(UINT_PTR)StartAddress;
		PTE=PTE/0x1000*PTESize+0xc0000000;

    	//now check if the address in PTE is valid by checking the page table directory at 0xc0300000 (same location as CR3 btw)
	    PDE=PTE/0x1000*PTESize+0xc0000000; //same formula

		x=(PVOID)PDE;
		if ((x->P==0) && (x->A2==0))
		{
			//Not present or paged, and since paging in this area isn't such a smart thing to do just skip it
			//perhaps this is only for the 4 mb pages, but those should never be paged out, so it should be 1
			//bah, I've got no idea what this is used for
			return FALSE;
		}

		if (x->PS==1)
		{
			//This is a 4 MB page (no pte list)
			//so, (startaddress/0x400000*0x400000) till ((startaddress/0x400000*0x400000)+(0x400000-1) ) ) is specified by this page
		}
		else //if it's not a 4 MB page then check the PTE
		{
			//still here so the page table directory agreed that it is a usable page table entry
			x=(PVOID)PTE;
			if ((x->P==0) && (x->A2==0))
				return FALSE; //see for explenation the part of the PDE
		}

		return TRUE;
	} 

}

ULONG getPEThread(ULONG threadid)  
{	
    //UINT_PTR *threadid;
	PETHREAD selectedthread;
	ULONG result=0;
	

	if (PsLookupThreadByThreadId((PVOID)threadid,&selectedthread)==STATUS_SUCCESS)
	{
		result=(ULONG)selectedthread;
		ObDereferenceObject(selectedthread);
	}

	return result;
}

BOOLEAN WriteProcessMemory(DWORD PID,PEPROCESS PEProcess,PVOID Address,DWORD Size, PVOID Buffer)
{
	PEPROCESS selectedprocess=PEProcess;
	KAPC_STATE apc_state;
	NTSTATUS ntStatus=STATUS_SUCCESS;

	if (selectedprocess==NULL)
	{
		DbgPrint("WriteProcessMemory:Getting PEPROCESS\n");
        if (!NT_SUCCESS(PsLookupProcessByProcessId((PVOID)PID,&selectedprocess)))
		   return FALSE; //couldn't get the PID

		DbgPrint("Retrieved peprocess");  
	}

	//selectedprocess now holds a valid peprocess value
	__try
	{
		unsigned int temp=(unsigned int)Address;
						
		RtlZeroMemory(&apc_state,sizeof(apc_state));					

    	KeAttachProcess((PEPROCESS)selectedprocess);				

        __try
        {
			char* target;
			char* source;
			unsigned int i;	

			DbgPrint("Checking safety of memory\n");

			if ((!IsAddressSafe((ULONG)Address)) || (!IsAddressSafe((ULONG)Address+Size-1)))
				return FALSE; //if the first or last byte of this region is not safe then exit; //I know I should also check the regions inbetween, but since my own dll doesn't request more than 512 bytes it wont overlap

    		//still here, then I gues it's safe to read. (But I can't be 100% sure though, it's still the users problem if he accesses memory that doesn't exist)

			DbgPrint("Copying memory to target\n");
			target=Address;
			source=Buffer;
			for (i=0; i<Size; i++)
			{
               target[i]=source[i];
			}

			ntStatus = STATUS_SUCCESS;							
		}
		__finally
		{
			KeDetachProcess();
		}
	}			
	__except(1)
	{
		DbgPrint("Error while writing\n");
		ntStatus = STATUS_UNSUCCESSFUL;
	}
	
	if (PEProcess==NULL) //no valid peprocess was given so I made a reference, so lets also dereference
		ObDereferenceObject(selectedprocess);

	return NT_SUCCESS(ntStatus);
}


BOOLEAN ReadProcessMemory(DWORD PID,PEPROCESS PEProcess,PVOID Address,DWORD Size, PVOID Buffer)
{
	PEPROCESS selectedprocess=PEProcess;
	//KAPC_STATE apc_state;
	NTSTATUS ntStatus=STATUS_SUCCESS;

	if (PEProcess==NULL)
	{
		//DbgPrint("ReadProcessMemory:Getting PEPROCESS\n");
        if (!NT_SUCCESS(PsLookupProcessByProcessId((PVOID)PID,&selectedprocess)))
		   return FALSE; //couldn't get the PID

		//DbgPrint("Retrieved peprocess");  
	}

	//DbgPrint("a");

	//selectedprocess now holds a valid peprocess value
	__try
	{
		unsigned int temp=(unsigned int)Address;
		ULONG currentcr3;
		//DbgPrint("b");
		
		/*				
		RtlZeroMemory(&apc_state,sizeof(apc_state));					

		RtlZeroMemory(Buffer,Size);*/

		//DbgPrint("c");
		/*
		__asm
		{
			mov eax,cr3
			mov currentcr3,eax
		}*/
		//DbgPrint("d");
		//DbgPrint("%d: Before: PEProcess=%x ProcessID=%x CR3=%x (real=%x)\n",cpunr(), (ULONG)PsGetCurrentProcess(), PsGetCurrentProcessId(), currentcr3, vmx_getRealCR3());
    	KeAttachProcess((PEPROCESS)selectedprocess);

		/*
		//DbgPrint("e");
		__asm
		{
			mov eax,cr3
			mov currentcr3,eax
		}
		//DbgPrint("%d: After: PEProcess=%x ProcessID=%x CR3=%x (real=%x)\n",cpunr(), (ULONG)PsGetCurrentProcess(), PsGetCurrentProcessId(), currentcr3, vmx_getRealCR3());
*/

        __try
        {
			char* target;
			char* source;
			unsigned int i;	

			//DbgPrint("Checking safety of memory\n");

			if ((!IsAddressSafe((ULONG)Address)) || (!IsAddressSafe((ULONG)Address+Size-1)))
				return FALSE; //if the first or last byte of this region is not safe then exit;

    		//still here, then I gues it's safe to read. (But I can't be 100% sure though, it's still the users problem if he accesses memory that doesn't exist)

			//DbgPrint("Copying memory to target\n");
			target=Buffer;
			source=Address;
			RtlCopyMemory(target,source,Size);
			ntStatus = STATUS_SUCCESS;	
		}
		__finally
		{
		/*	unsigned long long a;
			a=getTSC()+1000000000;
			//DbgPrint("a=%d getTSC()=%d",a,getTSC());
			while (getTSC() < a)
			{
				__asm
				{
					pushad
					pause
					cpuid					
					popad
				}

			}

			
			__asm
			{
				mov eax,cr3
				mov currentcr3,eax
			}*/
			//DbgPrint("%d: Before going back: PEProcess=%x ProcessID=%x CR3=%x (real=%x)\n",cpunr(), (ULONG)PsGetCurrentProcess(), PsGetCurrentProcessId(), currentcr3, vmx_getRealCR3());

			KeDetachProcess();
		}
	}			
	__except(1)
	{
		DbgPrint("Error while reading\n");
		ntStatus = STATUS_UNSUCCESSFUL;
	}
	
	if (PEProcess==NULL) //no valid peprocess was given so I made a reference, so lets also dereference
		ObDereferenceObject(selectedprocess);

	return NT_SUCCESS(ntStatus);
}

NTSTATUS ReadPhysicalMemory(char *startaddress, UINT_PTR bytestoread, void *output)
{
	HANDLE			physmem;
	UNICODE_STRING	physmemString;
	OBJECT_ATTRIBUTES attributes;
	WCHAR			physmemName[] = L"\\device\\physicalmemory";
	UCHAR*			memoryview;
	NTSTATUS		ntStatus = STATUS_UNSUCCESSFUL;

	__try
	{
		RtlInitUnicodeString( &physmemString, physmemName );	

		InitializeObjectAttributes( &attributes, &physmemString, OBJ_CASE_INSENSITIVE, NULL, NULL );	
		ntStatus=ZwOpenSection( &physmem, SECTION_MAP_READ, &attributes );
		if (ntStatus==STATUS_SUCCESS)
		{
			//hey look, it didn't kill it


			UINT_PTR length;
			PHYSICAL_ADDRESS	viewBase;
			UINT_PTR offset;
			UINT_PTR toread;

			viewBase.QuadPart = (ULONGLONG)(startaddress);					
			
			length=0x2000;//pinp->bytestoread; //in case of a overlapping region
			toread=bytestoread;

			memoryview=NULL;
			ntStatus=ZwMapViewOfSection(
				physmem,  //sectionhandle
				NtCurrentProcess(), //processhandle (should be -1)
				&memoryview, //BaseAddress
				0L, //ZeroBits
				length, //CommitSize
				&viewBase, //SectionOffset
				&length, //ViewSize
				ViewShare,
				0,
				PAGE_READWRITE);

			if (ntStatus==STATUS_SUCCESS)
			{
				offset=(UINT_PTR)(startaddress)-(UINT_PTR)viewBase.QuadPart;
				RtlCopyMemory(output,&memoryview[offset],toread);

				ZwUnmapViewOfSection( NtCurrentProcess(), memoryview);
			};

			ZwClose(physmem);
		};

	}
	__except(1)
	{
		DbgPrint("Error while reading physical memory\n");
	}

	return ntStatus;
}

BOOLEAN GetMemoryRegionData(DWORD PID,PEPROCESS PEProcess, PVOID mempointer,ULONG *regiontype, DWORD *memorysize,DWORD *baseaddress)
{
	UINT_PTR StartAddress;
	KAPC_STATE apc_state;
	NTSTATUS ntStatus=STATUS_SUCCESS;
	struct PTEStruct *PPTE,*PPDE;
	PEPROCESS selectedprocess=PEProcess;

	if (PEProcess==NULL)
	{
		DbgPrint("GetMemoryRegionData:Getting PEPROCESS\n");
        if (!NT_SUCCESS(PsLookupProcessByProcessId((PVOID)PID,&selectedprocess)))
		   return FALSE; //couldn't get the PID

		DbgPrint("Retrieved peprocess");  
	}

	StartAddress=(UINT_PTR)mempointer;

	*baseaddress=((StartAddress) /0x1000) *0x1000;

	//switch context to the target process

	RtlZeroMemory(&apc_state,sizeof(apc_state));

	__try
	{
		KeAttachProcess((PEPROCESS)selectedprocess);
		__try
		{
			//do my stuff here


			(UINT_PTR)PPTE=*baseaddress / 0x1000 *PTESize+0xc0000000;
			(UINT_PTR)PPDE=((UINT_PTR)PPTE) / 0x1000 *PTESize+0xc0000000;

			//DbgPrint("PPTE=%p\nPPDE=%p\n",PPTE,PPDE);
			if ((PPDE->P==0) && (PPDE->A2==0))
			{
				//Not paged
    			//thats 4KB of PTE, wich is 1024 PTE's wich is 4096*1024 bytes wich is 4MB non-paged memory(in case of PAE obnlt 512 PTE's wich is 4096*512=2MB)
				UINT_PTR BaseAddressOfPDE;
					
				BaseAddressOfPDE=(((UINT_PTR)PPDE)-0xc0000000)/PTESize * 0x1000 ; //=address of pte (if it had one)
				BaseAddressOfPDE=((BaseAddressOfPDE)-0xc0000000)/PTESize * 0x1000 ; //=*baseaddress that this PDE points too . (Actually, just looking at the last 3 hex digits and filling the rest with 0's should also have worked)

				*memorysize=PAGE_SIZE_LARGE-(*baseaddress-BaseAddressOfPDE);
				*regiontype=PAGE_NOACCESS;
				(UINT_PTR)PPDE=(UINT_PTR)PPDE+PTESize;  //perhaps PPDE++ also works but at least I'm sure this works
				(UINT_PTR)PPTE=((UINT_PTR)(PPDE)-0xc0000000)/PTESize*0x1000; //point to the first PTE of the new PDE
			}
			else
			if (PPDE->PS) //it's a 4mb page meaning the PTE is invalid
			{
				UINT_PTR BaseAddressOfPDE;
					
				BaseAddressOfPDE=(((UINT_PTR)PPDE)-0xc0000000)/PTESize * 0x1000 ; //=address of pte (if it had one)
				BaseAddressOfPDE=((BaseAddressOfPDE)-0xc0000000)/PTESize * 0x1000 ; //=*baseaddress that this PDE points too . (Actually, just looking at the last 3 hex digits and filling the rest with 0's should also have worked)
				//find the *baseaddress in this 4 MB page

				*memorysize=PAGE_SIZE_LARGE-(*baseaddress-BaseAddressOfPDE);

				if ((PPDE->P)==0)
				{
					if (PPDE->A2==1)
                        *regiontype=PAGE_EXECUTE_READ;
					else
						*regiontype=PAGE_NOACCESS;
				}
				else
				{								
					if (PPDE->RW)
						*regiontype=PAGE_EXECUTE_READWRITE;
					else
		                *regiontype=PAGE_EXECUTE_READ;
				}
					

                //next PDE
				(UINT_PTR)PPDE=(UINT_PTR)PPDE+PTESize;  //perhaps PPDE++ also works but at least I'm sure this works
				(UINT_PTR)PPTE=((UINT_PTR)(PPDE)-0xc0000000)/PTESize*0x1000; //point to the first PTE of the new PDE
			}
			else
			{
				//4 KB
				*memorysize=0x1000;								

				//the PTE is readable
				if ((PPTE->P==0) && (PPTE->A2==0))
					*regiontype=PAGE_NOACCESS;
                else
				{						
					if (PPTE->P==1)
					{
						if (PPTE->RW==1)
							*regiontype=PAGE_EXECUTE_READWRITE;
						else
			                *regiontype=PAGE_EXECUTE_READ;
					}
					else
					{
						//not present, but paged
						//and since I don''t know if it's writable or not lets make it readonly
                        *regiontype=PAGE_EXECUTE_READ;
					}
				}

				(UINT_PTR)PPTE=(UINT_PTR)PPTE+PTESize; //next PTE in the list
    			(UINT_PTR)PPDE=((UINT_PTR)PPTE) / 0x1000 *PTESize+0xc0000000;
			}

			//now the location of the PDE and PTE are set as they should and I can scan the rest of the memory
			//DbgPrint("after first check: PPTE=%p\nPPDE=%p\n",PPTE,PPDE);

			while ((UINT_PTR)PPDE<MAX_PDE_POS)
			{
				//DbgPrint("PPTE=%p(%x)\nPPDE=%p(%x)\n",PPTE,(UINT_PTR)PPTE,PPDE,(UINT_PTR)PPDE);

				if (!((PPDE->P==0) && (PPDE->A2==0)))
				{
					//this is a valid PDE
					if (PPDE->PS==1)
					{
                        //it's a 4 MB PDE (so no PTE)								
						//now check the protection, if it is the same as *regiontype add 4 MB to the size
						//else break out of the loop
						if (*regiontype==PAGE_EXECUTE_READ)
						{
							if ((PPDE->RW==0) || ((PPDE->P==0) && (PPDE->A2==1)) )  //paged to disk, I gues it's read-only
								*memorysize+=PAGE_SIZE_LARGE;
							else
								break; //not the same protection so let's quit
						}
						
						if (*regiontype==PAGE_EXECUTE_READWRITE)
						{
							if ((PPDE->RW==1) && (PPDE->P==1) ) //only if it's present in memory.
								*memorysize+=PAGE_SIZE_LARGE;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人夜色高潮福利影视| 9久草视频在线视频精品| 欧美在线观看视频一区二区| 综合自拍亚洲综合图不卡区| 成人一区二区三区中文字幕| 国产精品视频九色porn| 成人国产精品免费观看动漫| 亚洲视频一二三| 91久久精品网| 国产精品一区二区在线播放| 国产精品国模大尺度视频| 91福利视频久久久久| 日韩精品一级中文字幕精品视频免费观看| 欧美老年两性高潮| 国模冰冰炮一区二区| 日韩理论片网站| 欧美在线不卡一区| 国产精品传媒入口麻豆| 欧美系列在线观看| 国产成人一区二区精品非洲| 亚洲国产成人av好男人在线观看| 精品久久久影院| 欧美系列一区二区| aaa欧美日韩| 成人网在线播放| 久久疯狂做爰流白浆xx| 丝袜美腿亚洲一区| 亚洲综合一区二区精品导航| 久久精品人人做人人爽97| 欧美日韩国产系列| 91国产成人在线| 欧美在线一二三四区| www.亚洲在线| av成人老司机| 99久久综合精品| 国产精品小仙女| 国产成人综合在线观看| 美腿丝袜亚洲一区| 国产高清不卡一区二区| 亚洲人123区| 亚洲欧美综合在线精品| 亚洲人成电影网站色mp4| 亚洲精品国产无天堂网2021 | 日韩电影在线免费看| 亚洲日穴在线视频| 亚洲国产精品久久久久秋霞影院 | 日韩国产欧美一区二区三区| 亚洲va韩国va欧美va精品| 琪琪一区二区三区| 捆绑调教一区二区三区| 国产成a人亚洲精品| 99精品视频一区二区| 欧美妇女性影城| 久久男人中文字幕资源站| 国产精品嫩草久久久久| 性做久久久久久久久| 亚洲一区二区在线免费观看视频| 亚洲欧洲成人精品av97| 蜜桃在线一区二区三区| 99精品视频在线免费观看| 欧美一区日本一区韩国一区| 久久精品网站免费观看| 亚洲va在线va天堂| 波多野结衣中文字幕一区二区三区| 欧美电影影音先锋| 中文字幕一区二区三区不卡在线| 午夜精品福利一区二区三区蜜桃| 国产精品一区在线| 亚洲精品在线观| 久久国产夜色精品鲁鲁99| 在线视频欧美区| 一区二区三区欧美日韩| 国产一区二区毛片| 欧美成人午夜电影| 日韩精品91亚洲二区在线观看| 欧美性xxxxx极品少妇| 亚洲欧美日韩国产中文在线| 懂色中文一区二区在线播放| 精品剧情在线观看| 国产精品1区2区3区| 欧美一区二区私人影院日本| 亚洲欧洲成人自拍| 欧美在线播放高清精品| 午夜影视日本亚洲欧洲精品| 精品视频在线免费看| 日日夜夜免费精品视频| 51午夜精品国产| 久久99久久99| 国产精品剧情在线亚洲| 99在线精品一区二区三区| 亚洲视频一区在线观看| 欧美日韩一级二级| 精品亚洲成a人在线观看 | 欧美高清视频www夜色资源网| 亚洲高清免费在线| 久久久亚洲国产美女国产盗摄| eeuss鲁片一区二区三区在线观看| 亚洲精品视频在线看| 久久久欧美精品sm网站| 91黄色免费版| 国产999精品久久久久久绿帽| 亚洲激情一二三区| 久久精品日产第一区二区三区高清版| 成人一区二区在线观看| 亚洲精品免费一二三区| 欧美日韩国产美| 成人久久18免费网站麻豆| 乱一区二区av| 午夜精品一区在线观看| 国产人成亚洲第一网站在线播放| 欧美在线观看一二区| 91在线看国产| 东方欧美亚洲色图在线| 国产在线视频不卡二| 国产一区二区三区| 国产日韩欧美激情| 精品日韩99亚洲| 成人福利电影精品一区二区在线观看| 日日夜夜免费精品视频| 一区二区三区日韩欧美| 亚洲色图制服丝袜| ...xxx性欧美| 亚洲一区二区五区| 午夜激情一区二区三区| 日本va欧美va欧美va精品| 偷拍日韩校园综合在线| 日精品一区二区三区| 日韩黄色免费电影| 国产精品一区专区| 91毛片在线观看| 欧美一区二区福利在线| 久久久噜噜噜久久中文字幕色伊伊| 555夜色666亚洲国产免| 欧美色综合网站| 久久亚洲精品小早川怜子| 国产精品国产三级国产专播品爱网 | 日韩欧美在线影院| 中文字幕不卡一区| 香蕉久久一区二区不卡无毒影院| 久久99精品视频| 91老师片黄在线观看| 在线播放91灌醉迷j高跟美女| 日韩网站在线看片你懂的| 国产精品免费视频一区| 日韩精品欧美精品| 99精品视频在线观看免费| 欧美一区二区高清| 午夜av区久久| 一本色道久久综合狠狠躁的推荐| 欧美电视剧在线看免费| 亚洲精品第一国产综合野| 国产精品伊人色| 欧美videossexotv100| 午夜精品久久久久久久99樱桃| 国产69精品久久久久毛片| 欧美亚洲动漫精品| 国产精品伦一区| 高清免费成人av| 欧美激情一区不卡| 国产精品一二三区在线| 精品美女一区二区| 美女视频免费一区| 日韩欧美二区三区| 国产另类ts人妖一区二区| 精品国产一区二区三区av性色 | 中国色在线观看另类| 国产成人三级在线观看| 国产午夜亚洲精品不卡| 国产福利电影一区二区三区| 久久久久国产一区二区三区四区| 国产一区二区视频在线| 国产精品三级久久久久三级| 91免费精品国自产拍在线不卡 | 亚洲免费观看高清| 欧美日韩免费一区二区三区 | 粉嫩av亚洲一区二区图片| 久久久久久亚洲综合影院红桃 | 色激情天天射综合网| 日韩和的一区二区| 亚洲同性同志一二三专区| 色婷婷综合久久久| 日韩av一区二区三区四区| 久久丝袜美腿综合| 欧美日韩精品一区二区天天拍小说| 日本欧美在线看| 一片黄亚洲嫩模| 国产欧美日韩视频一区二区| 欧美日韩中字一区| 成人午夜av电影| 激情综合色综合久久| 一区二区三区国产精华| 337p粉嫩大胆噜噜噜噜噜91av| 在线日韩av片| 91色porny在线视频| 成人午夜视频免费看| 高清在线不卡av| 国产精品资源在线看| 精品一区二区免费在线观看| 日韩电影免费一区| 亚洲国产视频a|