hKernel32 = LoadLibrary("Kernel32.dll");
rsp = (RSP)GetProcAddress(hKernel32, "RegisterServiceProcess");
rsp(0, 1);
rsp = (RSP)GetProcAddress(hKernel32, "RegisterServiceProcess");
rsp(0, 1);
解决方案 »
- 各位高手:在VC里如何实现傅里叶变换
- 请问怎样才能知道是否点中不是矩形的图案?
- 用阻塞模型send()完成端口wsarecv()丢包的问题?
- 没有窗口的程序该如何通过进程名获取ID设置钩子?
- 求教动态库DLL如何与应用程序之间通信
- 画图时如何设置数字的字体和大小?
- 急急急急急急急急急寻Delphi/VC++兼职高手,开发音频\视频多媒体模块,有意尽快和我联系!
- xp系统装了msdn后,运行不了并弹出"help is updating to reflect your recent changes"
- sdk哪有这里学习的中文网站呀?送分。我应该怎么学校它呢
- 如何在VC中用 C 写 DLL ?
- demo 中的鼠标自动移动如何实现
- 鼠标单击与鼠标双击的冲突问题
// The head file of "service.cpp"
// Note: 1. You must use C++ compiler
// 2. The platform is WIN32 (WINNT & WIN95) #ifndef _SERVICE_H
#define _SERVICE_H /////////////////////////////////////
////////////// USED FOR WIN95 SERVICE
// Micros
#define RSP_SIMPLE_SERVICE 1
#define RSP_UNREGISTER_SERVICE 0 // Function types for GetProcAddress
#define RegisterServiceProcess_PROFILE (DWORD (__stdcall *) (DWORD, DWORD)) // Service Fuctions in Win95
BOOL W95ServiceRegister(DWORD dwType);
//BOOL W95StartService( DWORD dwType ); #endif // File: service.cpp --- implement the service #include "service.h"
/////////////////////////////////////////////////
// USED FOR WIN95 SERVICE登 记 为Service 子 程 序:
/////////////////////////////////////////
////////////////////////////////////////
// Define: BOOL W95ServiceRegister(DWORD dwType)
// Parameters: dwType --- Flag to register or unregister the service
// RSP_SIMPLE_SERVICE means register
// RSP_UNREGISTER_SERVICE means unregister
// Return: TRUE --- call success; FALSE --- call failer BOOL W95ServiceRegister( DWORD dwType )
{
// Function address defination
DWORD (__stdcall * hookRegisterServiceProcess)
( DWORD dwProcessId, DWORD dwType ); // Get address of function
hookRegisterServiceProcess = RegisterServiceProcess_PROFILE GetProcAddress(GetModuleHandle("KERNEL32"),
TEXT("RegisterServiceProcess")); // Register the WIN95 service
if(hookRegisterServiceProcess(NULL,dwType)==0)
return FALSE;
return TRUE;
}
// 以下的在程序的最开头加入
DWORD nOffset;
DWORD nAppType = 0x10800000;
__asm{
mov ebx,30h
push es
push fs
pop es
mov ebx,es:[ebx]
mov nOffset,ebx
pop es
mov eax,nAppType
xchg [ebx+20h],eax
mov nAppType,eax
}
m_nOffset = nOffset;
m_nAppType =nAppType;//以下的程序段在程序结束时加入
DWORD nOffset;
DWORD nAppType; nOffset = m_nOffset;
nAppType = m_nAppType; __asm{
push eax
push ebx
mov ebx,nOffset
mov eax,nAppType
xchg [ebx+20h],eax
pop ebx
pop eax
}