vc写的服务程序,怎么禁止用户停止

vc写的服务程序,怎么禁止用户停止,第1张

SERVICE_STATUS结构体成员dwControlsAccepted

C/C++ code?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

dwControlsAccepted

The control codes the service accepts and processes in its handler function (see Handler and HandlerEx). A user interface process can control a service by specifying a control command in the ControlService or ControlServiceEx function. By default, all services accept the SERVICE_CONTROL_INTERROGATE value. To accept the SERVICE_CONTROL_DEVICEEVENT value, the service must register to receive device events by using the RegisterDeviceNotification function.

The following are the control codes.

Control code Meaning

SERVICE_ACCEPT_NETBINDCHANGE

0x00000010 The service is a network component that can accept changes in its binding without being stopped and restarted.

This control code allows the service to receive SERVICE_CONTROL_NETBINDADD, SERVICE_CONTROL_NETBINDREMOVE, SERVICE_CONTROL_NETBINDENABLE, and SERVICE_CONTROL_NETBINDDISABLE notifications.

SERVICE_ACCEPT_PARAMCHANGE

0x00000008 The service can reread its startup parameters without being stopped and restarted.

This control code allows the service to receive SERVICE_CONTROL_PARAMCHANGE notifications.

SERVICE_ACCEPT_PAUSE_CONTINUE

0x00000002 The service can be paused and continued.

This control code allows the service to receive SERVICE_CONTROL_PAUSE and SERVICE_CONTROL_CONTINUE notifications.

SERVICE_ACCEPT_PRESHUTDOWN

0x00000100 The service can perform preshutdown tasks.

This control code enables the service to receive SERVICE_CONTROL_PRESHUTDOWN notifications. Note that ControlService and ControlServiceEx cannot send this notificationonly the system can send it.

Windows Server 2003 and Windows XP:This value is not supported.

SERVICE_ACCEPT_SHUTDOWN

0x00000004 The service is notified when system shutdown occurs.

This control code allows the service to receive SERVICE_CONTROL_SHUTDOWN notifications. Note that ControlService and ControlServiceEx cannot send this notificationonly the system can send it.

SERVICE_ACCEPT_STOP

0x00000001 The service can be stopped.

This control code allows the service to receive SERVICE_CONTROL_STOP notifications.

要在Debug的时候才可以的,你可以先在你想要停止的地方按F9设置一个 断点 然后按F5开始调试,当程序运行到你设置断点的地方就会自动停止运行,你可能观察当时各变量的值,查出某些问题!


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/8122784.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-13
下一篇 2023-04-13

发表评论

登录后才能评论

评论列表(0条)

保存