Mais conteúdo relacionado Semelhante a Tilting at Windmills with ctypes and cygwinreg (20) Tilting at Windmills with ctypes and cygwinreg20. © Andy Heatwole
Creative Commons Attribution-NonCommercial-NoDerivs 2.5.
http://blog.bluehourphoto.com/?showimage=224
28. from windmill.authoring import *
def setup_module(module):
client = WindmillTestClient(__name__)
client.click(id=u'home')
client.waits.forPageLoad(timeout=u'60000')
client.asserts.assertNode(id='LoginPage')
29. from windmill.authoring import *
def setup_module(module):
client = WindmillTestClient(__name__)
client.click(id=u'home')
client.waits.forPageLoad(timeout=u'60000')
client.asserts.assertNode(id='LoginPage')
30. from windmill.authoring import *
def setup_module(module):
client = WindmillTestClient(__name__)
client.click(id=u'home')
client.waits.forPageLoad(timeout=u'60000')
client.asserts.assertNode(id='LoginPage')
31. from windmill.authoring import *
def setup_module(module):
client = WindmillTestClient(__name__)
client.click(id=u'home')
client.waits.forPageLoad(timeout=u'60000')
client.asserts.assertNode(id='LoginPage')
67. >>> a = cdll.advapi32
>>> RegCloseKey = a.RegCloseKey
>>> RegCloseKey(0)
6
73. from ctypes import cdll
from ctypes import c_long, c_ulong
# WINADVAPI LONG WINAPI RegCloseKey(HKEY);
RegCloseKey = cdll.advapi32.RegCloseKey
RegCloseKey.restype = c_long
RegCloseKey.argtypes = [c_ulong]
74. from ctypes import cdll
from ctypes import c_long, c_ulong
# WINADVAPI LONG WINAPI RegCloseKey(HKEY);
RegCloseKey = cdll.advapi32.RegCloseKey
RegCloseKey.restype = c_long
RegCloseKey.argtypes = [c_ulong]
75. from ctypes import cdll
from ctypes import c_long, c_ulong
# WINADVAPI LONG WINAPI RegCloseKey(HKEY);
RegCloseKey = cdll.advapi32.RegCloseKey
RegCloseKey.restype = c_long
RegCloseKey.argtypes = [c_ulong]
76. from ctypes import cdll
from ctypes import c_long, c_ulong
LONG = c_long
HANDLE = c_ulong # in header files: void *
HKEY = HANDLE
# WINADVAPI LONG WINAPI RegCloseKey(HKEY);
RegCloseKey = cdll.advapi32.RegCloseKey
RegCloseKey.restype = LONG
RegCloseKey.argtypes = [HKEY]
81. class PyHKEY(object):
def __init__(self, hkey):
self.hkey = hkey
def Close(self):
if RegCloseKey(self.hkey) != 0:
raise WindowsError()
self.hkey = 0
class WindowsError(OSError):
...
82. class PyHKEY(object):
def __init__(self, hkey):
self.hkey = hkey
def Close(self):
RegCloseKey(self.hkey)
raise WindowsError()
self.hkey = 0
class WindowsError(OSError):
...
83. class PyHKEY(object):
def __init__(self, hkey):
self.hkey = hkey
def Close(self):
if RegCloseKey(self.hkey) != 0:
raise WindowsError()
self.hkey = 0
class WindowsError(OSError):
...
90. >>> try:
... import winreg
... except ImportError:
... import cygwinreg as winreg