本文整理汇总了Python中win32service.SERVICE_STOPPED属性的典型用法代码示例。如果您正苦于以下问题:Python win32service.SERVICE_STOPPED属性的具体用法?Python win32service.SERVICE_STOPPED怎么用?Python win32service.SERVICE_STOPPED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类win32service
的用法示例。
在下文中一共展示了win32service.SERVICE_STOPPED属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ReportServiceStatus
# 需要导入模块: import win32service [as 别名]
# 或者: from win32service import SERVICE_STOPPED [as 别名]
def ReportServiceStatus(self, serviceStatus, waitHint = 5000, win32ExitCode = 0, svcExitCode = 0):
if self.ssh is None: # Debugging!
return
if serviceStatus == win32service.SERVICE_START_PENDING:
accepted = 0
else:
accepted = self.GetAcceptedControls()
if serviceStatus in [win32service.SERVICE_RUNNING, win32service.SERVICE_STOPPED]:
checkPoint = 0
else:
self.checkPoint = self.checkPoint + 1
checkPoint = self.checkPoint
# Now report the status to the control manager
status = (win32service.SERVICE_WIN32_OWN_PROCESS,
serviceStatus,
accepted, # dwControlsAccepted,
win32ExitCode, # dwWin32ExitCode;
svcExitCode, # dwServiceSpecificExitCode;
checkPoint, # dwCheckPoint;
waitHint)
win32service.SetServiceStatus( self.ssh, status)
示例2: OnListEvent
# 需要导入模块: import win32service [as 别名]
# 或者: from win32service import SERVICE_STOPPED [as 别名]
def OnListEvent(self, id, code):
if code == win32con.LBN_SELCHANGE or code == win32con.LBN_SELCANCEL:
pos = self.listCtrl.GetCurSel()
if pos >= 0:
data = self.data[self.listCtrl.GetItemData(pos)][2]
canstart = (self.data[self.listCtrl.GetItemData(pos)][1] == win32service.SERVICE_STOPPED)
else:
data = 0
canstart = 0
self.GetDlgItem(self.IDC_START).EnableWindow(canstart)
self.GetDlgItem(self.IDC_STOP).EnableWindow(data & win32service.SERVICE_ACCEPT_STOP)
self.GetDlgItem(self.IDC_PAUSE).EnableWindow(data & win32service.SERVICE_ACCEPT_PAUSE_CONTINUE)
self.GetDlgItem(self.IDC_CONTINUE).EnableWindow(data & win32service.SERVICE_ACCEPT_PAUSE_CONTINUE)
示例3: SvcStop
# 需要导入模块: import win32service [as 别名]
# 或者: from win32service import SERVICE_STOPPED [as 别名]
def SvcStop(self):
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
cherrypy.engine.exit()
self.ReportServiceStatus(win32service.SERVICE_STOPPED)
# very important for use with py2exe
# otherwise the Service Controller never knows that it is stopped !
示例4: stop_service
# 需要导入模块: import win32service [as 别名]
# 或者: from win32service import SERVICE_STOPPED [as 别名]
def stop_service(self, service_name, wait=False):
LOG.debug('Stopping service %s', service_name)
with self._get_service_handle(
service_name,
win32service.SERVICE_STOP |
win32service.SERVICE_QUERY_STATUS) as hs:
win32service.ControlService(hs, win32service.SERVICE_CONTROL_STOP)
if wait:
while True:
service_status = win32service.QueryServiceStatusEx(hs)
state = service_status['CurrentState']
if state == win32service.SERVICE_STOPPED:
return
time.sleep(.1)
示例5: SvcStop
# 需要导入模块: import win32service [as 别名]
# 或者: from win32service import SERVICE_STOPPED [as 别名]
def SvcStop(self):
self.log("Stopping scalyr service")
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
win32event.SetEvent(self._stop_event)
self.controller.invoke_termination_handler()
self.ReportServiceStatus(win32service.SERVICE_STOPPED)
示例6: SvcStop
# 需要导入模块: import win32service [as 别名]
# 或者: from win32service import SERVICE_STOPPED [as 别名]
def SvcStop(self):
self.ReportServiceStatus(svc.SERVICE_STOP_PENDING)
self.stop()
self.ReportServiceStatus(svc.SERVICE_STOPPED)
示例7: SvcStop
# 需要导入模块: import win32service [as 别名]
# 或者: from win32service import SERVICE_STOPPED [as 别名]
def SvcStop(self):
self.ReportServiceStatus(win32service.SERVICE_STOPPED)
示例8: SvcStop
# 需要导入模块: import win32service [as 别名]
# 或者: from win32service import SERVICE_STOPPED [as 别名]
def SvcStop(self):
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
self.stop()
self.ReportServiceStatus(win32service.SERVICE_STOPPED)
示例9: SvcStop
# 需要导入模块: import win32service [as 别名]
# 或者: from win32service import SERVICE_STOPPED [as 别名]
def SvcStop(self):
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) #tell the Service Manager that we are planing to stop the serivce
self.stop()
self.ReportServiceStatus(win32service.SERVICE_STOPPED) #tell the Service Manager that we are currently stopping the service
开发者ID:PacktPublishing,项目名称:Python-for-Offensive-PenTest,代码行数:6,代码来源:Backdoor-ing Legitmate Windows Service.py