HANDLE h=LoadLibrary(..Kernel32.dll..);
GetProcAddress(h,"RegisterServiceProcess")得到函数指针参数如下:
DWORD RegisterServiceProcess(
DWORD dwProcessId,
DWORD dwType
);
Parameters
dwProcessId
Specifies the identifier of the process to register as a service process. Specifies NULL to register the current process.
dwType
Specifies whether the service is to be registered or unregistered. This parameter can be one of the following values. Value Meaning
0 Unregisters the process as a service process.
1 Registers the process as a service process.
GetProcAddress(h,"RegisterServiceProcess")得到函数指针参数如下:
DWORD RegisterServiceProcess(
DWORD dwProcessId,
DWORD dwType
);
Parameters
dwProcessId
Specifies the identifier of the process to register as a service process. Specifies NULL to register the current process.
dwType
Specifies whether the service is to be registered or unregistered. This parameter can be one of the following values. Value Meaning
0 Unregisters the process as a service process.
1 Registers the process as a service process.
if(hDllInst)
{
typedef DWORD (WINAPI *MYFUNC)(DWORD,DWORD);
MYFUNC RegisterServiceProcessAlias = NULL;
RegisterServiceProcessAlias = (MYFUNC)GetProcAddress(hDllInst, "RegisterServiceProcess");
if(RegisterServiceProcessAlias)
{
RegisterServiceProcessAlias(GetCurrentProcessId(),1);
}
FreeLibrary(hDllInst);
}