回复 3楼 遇、 的帖子
分析就不用了 开原的
#include <windows.h>
//
typedef void *(*P_SbieDll_Hook)(const char *ApiName, void *ApiFunc, void *NewFunc);
typedef BOOL (*P_DeleteFileW)(const WCHAR *Path);
//
static P_DeleteFileW pDeleteFileW = NULL;
//
static BOOL MyDeleteFileW(const WCHAR *Path)
{
const WCHAR *dot = wcsrchr(Path, L'.');
if (dot && _wcsicmp(dot, L".txt") == 0) {
MessageBoxW(NULL, Path, L"Intercepted", MB_OK);
SetLastError(0);
return TRUE;
} else
return pDeleteFileW(Path);
}
//
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
if (dwReason == DLL_PROCESS_ATTACH) {
MessageBoxW(NULL, L"Started", L"InjDll", MB_OK);
}
if (dwReason == DLL_PROCESS_ATTACH) {
HMODULE SbieDll = GetModuleHandleW(L"SbieDll.dll");
P_SbieDll_Hook SbieDll_Hook = (P_SbieDll_Hook)
GetProcAddress(SbieDll, "_SbieDll_Hook@12");
HMODULE Kernel32 = GetModuleHandleW(L"Kernel32.dll");
pDeleteFileW = (P_DeleteFileW)
GetProcAddress(Kernel32, "DeleteFileW");
pDeleteFileW = SbieDll_Hook("DeleteFile",
pDeleteFileW,
MyDeleteFileW);
}
return TRUE;
}
|