⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 startservice.cpp

📁 一本在讲述USB驱动程式的书 及其范例原码
💻 CPP
字号:
// StartService.dll -- Use with RUNDLL32 to start a service
// Copyright (C) 1999 by Walter Oney
// All rights reserved

#include "stdafx.h"

BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
	{							// DllMain
    return TRUE;
	}							// DllMain

extern "C" void CALLBACK StartServiceRunning(HWND hwnd, HINSTANCE hInst, LPSTR lpCmdLine, int nShow)
	{							// StartServiceRunning

	if (!lpCmdLine || lstrlen(lpCmdLine) == 0)
		return;

	SC_HANDLE hsc = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
	if (!hsc)
		return;

	SC_HANDLE hservice = OpenService(hsc, lpCmdLine, SERVICE_START);
	if (hservice)
		{
		StartService(hservice, 0, NULL);
		CloseServiceHandle(hservice);
		}

	CloseServiceHandle(hsc);
	}							// StartServiceRunning


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -