2013-05-12 3 views
2

변경 사항이 있는지 확인하려면 particolar 메모리 영역을 모니터링하는 방법이 있는지 궁금합니다. 나는 그것의 사용 메모리 영역의 컬렉션을 프로세스를 열고 얻기 위해 다음과 같은 방법을 사용하고 있습니다 :C#/WinAPI - 메모리 영역 모니터링

internal static MemoryProcess OpenProcess(Process process) 
{ 
    IntPtr processHandle = OpenProcess(ProcessAccess.Desided, true, (UInt32)process.Id); 

    if (processHandle == IntPtr.Zero) 
     return null; 

    IntPtr processAddress = new IntPtr(); 
    List<MemoryRegion> memoryRegions = new List<MemoryRegion>(); 

    while (true) 
    { 
     MemoryBasicInformation info = new MemoryBasicInformation(); 

     if (VirtualQueryEx(processHandle, processAddress, out info, MemoryBasicInformation.Size) == 0) 
      break; 

     if (info.Allocation.HasFlag(MemoryAllocation.Commit) && info.Type.HasFlag(MemoryType.Private) && ((info.Protection & MemoryProtection.Readable) != 0) && ((info.Protection & MemoryProtection.Protected) == 0)) 
      memoryRegions.Add(new MemoryRegion(info.BaseAddress, info.RegionSize)); 

     processAddress = new IntPtr(info.BaseAddress.ToInt64() + info.RegionSize.ToInt64()); 
    } 

    if (memoryRegions.Count == 0) 
    { 
     CloseHandle(processHandle); 
     return null; 
    } 

    return (new MemoryProcess(processHandle, memoryRegions)); 
} 

나는 이렇게 많은 응용 프로그램을 보았다. 치트 엔진은 그 중 하나입니다. ,

enter image description here

지금, 내가 탭이 완전히 다른 또 다른를 찾아 것을 사용의 내가 구글 크롬 탭 프로세스를 열고 나는 그것의 메모리 내에서 검색 및 특정 값 (문자열 "유래")을 찾을 수 있다고 가정 해 봅시다 웹 사이트와 나는 그 주소 값 변경을 참조하십시오

enter image description here

마지막 단계 :

: 나는 크롬의 탭은 해당 프로세스를 죽이는 것을 닫습니다

물론 ... 메모리 영역에 대해 일종의 모니터링이 있어야합니다. 그리고, 사실,이 :

enter image description here

사용 Process.Exited 이벤트가 메모리의 업데이트가 ... 내가 생각하는 값을 해결할 수 있도록 실시간을 달성하는 것만으로는 충분하지 않습니다, 나는 그렇게 할 수 있습니까? 당신이 VirtualAlloc은 대상 응용 프로그램에서 호출, 원래 플래그에 MEM_WRITE_WATCH을 결합 가로 챌 수있는 경우

+0

.NET 용으로 직접 사용할 수 없다고 확신합니다. Interops를 통해 Win32 API를 사용할 수도 있지만 AFAIK에는 이런 종류의 .NET API가 없습니다. – jugg1es

답변

1

, 시스템이 할당 된 메모리 영역을 추적합니다, 당신은에 기록 된 페이지의 주소를 검색 할 GetWriteWatch 함수를 호출 할 수 있습니다 영역이 할당되었거나 쓰기 추적 상태가 재설정 되었기 때문에 이것은 할 많은 일을 생각합니다.

관련 문제