添加项目文件。
This commit is contained in:
70
test/dllmain.cpp
Normal file
70
test/dllmain.cpp
Normal file
@@ -0,0 +1,70 @@
|
||||
// dllmain.cpp : 定义 DLL 应用程序的入口点。
|
||||
#include "pch.h"
|
||||
#include <iostream>
|
||||
#include <Windows.h>
|
||||
|
||||
|
||||
|
||||
|
||||
typedef int func(int a , int b);
|
||||
func* f = (func*)0x401000;
|
||||
|
||||
|
||||
|
||||
int GetExeNutWrtNum(int Pos)
|
||||
{
|
||||
int num = *(int*)(0x40079F + (Pos * 4));
|
||||
return num;
|
||||
}
|
||||
|
||||
void ThreadFun(void)
|
||||
{
|
||||
|
||||
while (true)
|
||||
{
|
||||
std::cout << GetExeNutWrtNum(40) << std::endl;;
|
||||
}
|
||||
Sleep(10);
|
||||
}
|
||||
|
||||
|
||||
__declspec(dllexport) void Lenheart()
|
||||
{
|
||||
DWORD threadID;
|
||||
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadFun, NULL, 0, &threadID);
|
||||
}
|
||||
|
||||
/*
|
||||
extern "C" __declspec(dllexport) int Sub(int a, int b) {
|
||||
|
||||
int i = f(160, 80);
|
||||
std::cout << i << std::endl;
|
||||
getchar();
|
||||
|
||||
std::cout << "注入成功\n";
|
||||
|
||||
return a - b;
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
{
|
||||
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
//int i = f(60,80);
|
||||
//std::cout << "12132132" << std::endl;
|
||||
Lenheart();
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user