资源简介
功能比较简单,热键激活,搜索地址,修改和锁定内存。附带了一个测试的程序test。
代码片段和文件信息
#include “stdafx.h“
#include “resource.h“
#include “Mem.h“
extern DWORD gDwPID;
extern HWND gHwndDlg[];
void KMPNext(char* str int len int* next)
{
int i = 0;
int j = -1;
next[0] = -1;
while (i < len - 1)
{
if (j == -1 || str[i] == str[j])
{
i++;j++;
next[i] = j;
}
else j = next[j];
}
}
void KMPNext1(char* str int len int* next)
{
int i = 0;
int j = -1;
next[0] = -1;
while (i < len - 1)
{
if (j == -1 || str[i] == str[j])
{
i++;j++;
if (str[i] != str[j]) next[i] = j;
else next[i] = next[j];
}
else j = next[j];
}
}
int KMP(char* strM char* strP int lenm int lenp int pos)
{
int i = pos;
int j = 0;
int* next = (int*)malloc(lenp * sizeof(int));
KMPNext1(strP lenp next);
while (i < lenm && j < lenp)
{
if (j == -1 || strM[i] == strP[j])
{
i++;j++;
}
else j = next[j];
}
free(next);
if (j > lenp - 1) return i - lenp;
else return -1;
}
BOOL ConverStr(char* strS char* strD)
{
int len = _tcslen(strS);
char ch[3] = {0};
int i = 0;
int j = 0;
for (i = 0; i < len / 2; i++)
{
ch[0] = strS[len - i * 2 - 2];
ch[1] = strS[len - i * 2 - 1];
ch[2] = 0;
strD[j++] = (char)_tcstol(ch NULL 16);
}
if (1 == len % 2)
{
ch[0] = strS[0];
ch[1] = 0;
strD[j++] = (char)_tcstol(ch NULL 16);
}
strD[j] = 0;
return TRUE;
}
BOOL DoSearch(SEARCHPROC lpProc char* szNum int ilenp LPARAM lParam)
{
SYSTEM_INFO systeminfo = {0};
LPVOID lpMinAddress = NULL;
LPVOID lpMaxAddress = NULL;
HANDLE hProcess = NULL;
char* lpBuffer = NULL;
int ipostion = 0;
char strValue[4] = {0};
MEMORY_BASIC_INFORMATION mbi = {0};
GetSystemInfo(&systeminfo);
lpMinAddress = systeminfo.lpMinimumApplicationAddress;
lpMaxAddress = systeminfo.lpMaximumApplicationAddress;
hProcess = OpenProcess(PROCESS_VM_READ | PROCESS_QUERY_INFORMATION FALSE gDwPID);
if (!hProcess) return FALSE;
while (lpMinAddress < lpMaxAddress)
{
if (!VirtualQueryEx(hProcess lpMinAddress &mbi sizeof(mbi)))
{
CloseHandle(hProcess);
return FALSE;
}
if (MEM_COMMIT == mbi.State &&
(PAGE_READWRITE == mbi.Protect || PAGE_EXECUTE_READWRITE == mbi.Protect))
{
lpBuffer = (char*)HeapAlloc(GetProcessHeap() 0 mbi.RegionSize);
ReadProcessMemory(hProcess lpMinAddress lpBuffer mbi.RegionSize 0);
do
{
ipostion = KMP(lpBuffer szNum mbi.RegionSize ilenp ipost
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 2035 2007-02-11 13:01 Sge\ReadMe.txt
....... 7485 2007-02-23 13:27 Sge\Sge.rc
....... 55808 2007-03-14 19:26 Sge\Sge.opt
....... 1867 2007-02-23 13:26 Sge\resource.h
....... 1056 2007-02-22 23:49 Sge\StdAfx.h
....... 4177 2007-02-11 13:01 Sge\psapi.h
....... 101 2007-02-11 21:01 Sge\Process.h
....... 1245 2007-02-11 13:01 Sge\Process.cpp
....... 7704 2007-02-23 13:27 Sge\Sge.aps
....... 290 2007-02-11 13:01 Sge\StdAfx.cpp
....... 766 1998-01-24 04:51 Sge\Sge.ico
....... 369 2007-02-18 14:00 Sge\Mem.h
....... 1765 2007-03-14 19:26 Sge\Sge.plg
....... 764 2007-02-23 00:55 Sge\Tab.h
....... 19790 2007-02-11 13:01 Sge\psapi.lib
....... 82944 2007-03-14 19:26 Sge\Sge.ncb
....... 363 2007-03-14 19:26 Sge\Sge.positions
....... 4912 2007-02-11 13:01 Sge\Sge.dsp
....... 726 2007-02-18 16:28 Sge\Sge.dsw
....... 6550 2007-02-18 14:00 Sge\Mem.cpp
....... 174 2007-02-23 13:33 Sge\Sge.h
....... 4462 2007-02-23 15:48 Sge\Sge.cpp
....... 35888 2007-02-23 16:04 Sge\Tab.cpp
....... 26 2007-02-11 13:05 Sge\CVS\Root
....... 5 2007-02-11 13:05 Sge\CVS\Repository
....... 612 2007-02-26 19:13 Sge\CVS\Entries.Extra.Old
....... 1047 2007-02-26 19:13 Sge\CVS\Entries.Old
....... 1047 2007-02-26 19:13 Sge\CVS\Entries
....... 612 2007-02-26 19:13 Sge\CVS\Entries.Extra
....... 802 2007-02-18 16:28 Sge\SgeHook\StdAfx.h
............此处省略40个文件信息
- 上一篇:CentOS 7.4 拨号工具包
- 下一篇:jdk(mac)版1.8
评论
共有 条评论