C++编写windows自动安装自动启动系统服务
作者:互联网
运行效果:
实现过程:
1.服务程序入口实现:
int __cdecl _tmain(int argc, TCHAR *argv[])
{
if (SvcInstall())
{
DoAutoStartSvc();
DoUpdateSvcDacl();
if (DoUpdateSvcDesc())
{
DoStartSvc();
}
}
SERVICE_TABLE_ENTRY DispatchTable[] =
{
{ SVCNAME, (LPSERVICE_MAIN_FUNCTION)SvcMain },
{ NULL, NULL }
};
if (!StartServiceCtrlDispatcher(DispatchTable))
{
SvcReportEvent(TEXT("StartServiceCtrlDispatcher"));
}
}
标签:服务程序,windows,C++,StartServiceCtrlDispatcher,int,自动,NULL,DispatchTable 来源: https://blog.csdn.net/fittec/article/details/122023955