当前位置: 首页>>代码示例>>Python>>正文


Python win32service.SERVICE_STOPPED属性代码示例

本文整理汇总了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) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:25,代码来源:win32serviceutil.py

示例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) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:15,代码来源:ControlService.py

示例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 ! 
开发者ID:pawl,项目名称:Chinese-RFID-Access-Control-Library,代码行数:9,代码来源:windows_webservice.py

示例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) 
开发者ID:cloudbase,项目名称:cloudbase-init,代码行数:16,代码来源:windows.py

示例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) 
开发者ID:scalyr,项目名称:scalyr-agent-2,代码行数:8,代码来源:platform_windows.py

示例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) 
开发者ID:grawity,项目名称:code,代码行数:6,代码来源:powermonitor.py

示例7: SvcStop

# 需要导入模块: import win32service [as 别名]
# 或者: from win32service import SERVICE_STOPPED [as 别名]
def SvcStop(self):
        self.ReportServiceStatus(win32service.SERVICE_STOPPED) 
开发者ID:grawity,项目名称:code,代码行数:4,代码来源:win32-identd.py

示例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) 
开发者ID:PacktPublishing,项目名称:Python-for-Offensive-PenTest,代码行数:6,代码来源:Create a New Admin account.py

示例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


注:本文中的win32service.SERVICE_STOPPED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。