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


Python sys.dllhandle方法代码示例

本文整理汇总了Python中sys.dllhandle方法的典型用法代码示例。如果您正苦于以下问题:Python sys.dllhandle方法的具体用法?Python sys.dllhandle怎么用?Python sys.dllhandle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sys的用法示例。


在下文中一共展示了sys.dllhandle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: RegisterCoreDLL

# 需要导入模块: import sys [as 别名]
# 或者: from sys import dllhandle [as 别名]
def RegisterCoreDLL(coredllName = None):
	"""Registers the core DLL in the registry.

        If no params are passed, the name of the Python DLL used in 
        the current process is used and registered.
	"""
	if coredllName is None:
		coredllName = win32api.GetModuleFileName(sys.dllhandle)
		# must exist!
	else:
		try:
			os.stat(coredllName)
		except os.error:
			print "Warning: Registering non-existant core DLL %s" % coredllName

	hKey = win32api.RegCreateKey(GetRootKey() , BuildDefaultPythonKey())
	try:
		win32api.RegSetValue(hKey, "Dll", win32con.REG_SZ, coredllName)
	finally:
		win32api.RegCloseKey(hKey)
	# Lastly, setup the current version to point to me.
	win32api.RegSetValue(GetRootKey(), "Software\\Python\\PythonCore\\CurrentVersion", win32con.REG_SZ, sys.winver) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:24,代码来源:regutil.py

示例2: testOtherHandle

# 需要导入模块: import sys [as 别名]
# 或者: from sys import dllhandle [as 别名]
def testOtherHandle(self):
        h=pywintypes.HANDLE(1)
        h2=pywintypes.HANDLE(h)
        self.failUnlessEqual(h, h2)
        # but the above doesn't really test everything - we want a way to
        # pass the handle directly into PyWinLong_AsVoidPtr.  One way to
        # to that is to abuse win32api.GetProcAddress() - the 2nd param
        # is passed to PyWinLong_AsVoidPtr() if its not a string.
        # passing a handle value of '1' should work - there is something
        # at that ordinal
        win32api.GetProcAddress(sys.dllhandle, h) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:13,代码来源:handles.py

示例3: install_readline

# 需要导入模块: import sys [as 别名]
# 或者: from sys import dllhandle [as 别名]
def install_readline(hook):
    '''Set up things for the interpreter to call 
    our function like GNU readline.'''
    global readline_hook, readline_ref
    # save the hook so the wrapper can call it
    readline_hook = hook
    # get the address of PyOS_ReadlineFunctionPointer so we can update it
    PyOS_RFP = c_void_p.from_address(Console.GetProcAddress(sys.dllhandle,
                           "PyOS_ReadlineFunctionPointer".encode('ascii')))
    # save a reference to the generated C-callable so it doesn't go away
    readline_ref = HOOKFUNC23(hook_wrapper_23)
    # get the address of the function
    func_start = c_void_p.from_address(addressof(readline_ref)).value
    # write the function address into PyOS_ReadlineFunctionPointer
    PyOS_RFP.value = func_start 
开发者ID:darkarp,项目名称:malkit,代码行数:17,代码来源:console.py

示例4: install_readline

# 需要导入模块: import sys [as 别名]
# 或者: from sys import dllhandle [as 别名]
def install_readline(hook):
    '''Set up things for the interpreter to call 
    our function like GNU readline.'''
    global readline_hook, readline_ref
    # save the hook so the wrapper can call it
    readline_hook = hook
    # get the address of PyOS_ReadlineFunctionPointer so we can update it
    PyOS_RFP = c_void_p.from_address(Console.GetProcAddress(
        sys.dllhandle, "PyOS_ReadlineFunctionPointer".encode('ascii')))
    # save a reference to the generated C-callable so it doesn't go away
    readline_ref = HOOKFUNC23(hook_wrapper_23)
    # get the address of the function
    func_start = c_void_p.from_address(addressof(readline_ref)).value
    # write the function address into PyOS_ReadlineFunctionPointer
    PyOS_RFP.value = func_start 
开发者ID:zdresearch,项目名称:OWASP-ZSC,代码行数:17,代码来源:console.py


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