本文整理汇总了Python中_winreg.REG_DWORD属性的典型用法代码示例。如果您正苦于以下问题:Python _winreg.REG_DWORD属性的具体用法?Python _winreg.REG_DWORD怎么用?Python _winreg.REG_DWORD使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类_winreg
的用法示例。
在下文中一共展示了_winreg.REG_DWORD属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_str_type
# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import REG_DWORD [as 别名]
def get_str_type(reg_type):
if reg_type == _winreg.REG_BINARY:
return "REG_BINARY"
elif reg_type == _winreg.REG_DWORD:
return "REG_DWORD"
elif reg_type == _winreg.REG_DWORD_BIG_ENDIAN:
return "REG_DWORD_BIG_ENDIAN"
elif reg_type == _winreg.REG_DWORD_LITTLE_ENDIAN:
return "REG_DWORD_LITTLE_ENDIAN"
elif reg_type == _winreg.REG_EXPAND_SZ:
return "REG_EXPAND_SZ"
elif reg_type == _winreg.REG_LINK:
return "REG_LINK"
elif reg_type == _winreg.REG_MULTI_SZ:
return "REG_MULTI_SZ"
elif reg_type == _winreg.REG_SZ:
return "REG_SZ"
示例2: get_data
# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import REG_DWORD [as 别名]
def get_data(self):
reg_type = self.value.get_type()
if reg_type == _winreg.REG_DWORD:
return self.value.get_data_as_integer()
elif reg_type == _winreg.REG_DWORD_LITTLE_ENDIAN:
return self.value.get_data_as_integer()
elif reg_type == _winreg.REG_DWORD_BIG_ENDIAN:
return self.value.get_data_as_integer()
elif reg_type == _winreg.REG_SZ:
return self.value.get_data_as_string()
elif reg_type == _winreg.REG_EXPAND_SZ:
return self.value.get_data_as_string()
elif reg_type == _winreg.REG_LINK:
return self.value.get_data_as_string()
return self.value.get_data()
示例3: Install
# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import REG_DWORD [as 别名]
def Install():
AddOrRemoveHIDKeys(True)
osExtension = "x86"
if Is64BitOS():
osExtension = "x64"
pluginDir = dirname(__file__.decode(sys.getfilesystemencoding()))
tmpExe = join(pluginDir, "AlternateMceIrService_%s.exe"%osExtension)
myExe = join(pluginDir, "AlternateMceIrService.exe")
try:
os.remove(myExe)
except:
pass
shutil.copyfile(tmpExe,myExe)
key = reg.CreateKey(reg.HKEY_LOCAL_MACHINE, ServiceKey+"\\AlternateMceIrService")
reg.SetValueEx(key, "EventMessageFile", 0, reg.REG_SZ, myExe)
reg.SetValueEx(key, "TypesSupported", 0, reg.REG_DWORD, 7)
service = Service(u"AlternateMceIrService")
service.Install(myExe)
service.Start()
print "Service successfully installed"
示例4: RegisterAddin
# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import REG_DWORD [as 别名]
def RegisterAddin(klass):
import _winreg
key = _winreg.CreateKey(_winreg.HKEY_CURRENT_USER, "Software\\Microsoft\\Office\\Excel\\Addins")
subkey = _winreg.CreateKey(key, klass._reg_progid_)
_winreg.SetValueEx(subkey, "CommandLineSafe", 0, _winreg.REG_DWORD, 0)
_winreg.SetValueEx(subkey, "LoadBehavior", 0, _winreg.REG_DWORD, 3)
_winreg.SetValueEx(subkey, "Description", 0, _winreg.REG_SZ, "Excel Addin")
_winreg.SetValueEx(subkey, "FriendlyName", 0, _winreg.REG_SZ, "A Simple Excel Addin")
示例5: RegisterAddin
# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import REG_DWORD [as 别名]
def RegisterAddin(klass):
import _winreg
key = _winreg.CreateKey(_winreg.HKEY_CURRENT_USER, "Software\\Microsoft\\Office\\Outlook\\Addins")
subkey = _winreg.CreateKey(key, klass._reg_progid_)
_winreg.SetValueEx(subkey, "CommandLineSafe", 0, _winreg.REG_DWORD, 0)
_winreg.SetValueEx(subkey, "LoadBehavior", 0, _winreg.REG_DWORD, 3)
_winreg.SetValueEx(subkey, "Description", 0, _winreg.REG_SZ, klass._reg_progid_)
_winreg.SetValueEx(subkey, "FriendlyName", 0, _winreg.REG_SZ, klass._reg_progid_)
示例6: AddOrRemoveHIDKeys
# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import REG_DWORD [as 别名]
def AddOrRemoveHIDKeys(isInstall):
HID_SUB_KEY = "SYSTEM\\CurrentControlSet\\Services\\HidIr\\Remotes\\745a17a0-74d3-11d0-b6fe-00a0c90f57d"
ValuesToCheck = ['a','b']
for a in ValuesToCheck:
tmpkey = HID_SUB_KEY+a
try:
key = reg.OpenKey(reg.HKEY_LOCAL_MACHINE, tmpkey, 0, reg.KEY_ALL_ACCESS)
for i in xrange(4):
valueName = 'CodeSetNum%i' % i
if isInstall:
reg.DeleteValue(key, valueName)
else:
reg.SetValueEx(key, valueName, 0, reg.REG_DWORD, i + 1)
except WindowsError:
continue
示例7: Finish
# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import REG_DWORD [as 别名]
def Finish(self):
"""
This will be called inside the thread when it finishes. It will even
be called if the thread exits through an exception.
"""
self.abort = True
self.lock.acquire()
if self.dll:
self.dll.IR_Close(self.hwnd, 0);
#print "Irremote is stopped"
if self.timerInit :
self.timerInit.cancel()
#print "Init aborted"
if self.hwnd:
windll.user32.KillTimer(self.hwnd, 1)
DestroyWindow(self.hwnd)
UnregisterClass(self.wc.lpszClassName, self.hinst)
if self.defaultPollTime != -1 :
regHandle = _winreg.OpenKey(
_winreg.HKEY_LOCAL_MACHINE,
'SOFTWARE\hauppauge\IR',
0,
_winreg.KEY_WRITE | _winreg.KEY_READ
)
_winreg.SetValueEx( regHandle, 'PollRate', 0, _winreg.REG_DWORD, int(self.defaultPollTime) )
_winreg.CloseKey( regHandle )
self.lock.release()
示例8: SetHidState
# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import REG_DWORD [as 别名]
def SetHidState(self, disableHid):
"""
Sets the HID registry values. Will raise WindowsError if not
successful.
"""
key = reg.OpenKey(
reg.HKEY_LOCAL_MACHINE, HID_SUB_KEY, 0, reg.KEY_ALL_ACCESS
)
for i in xrange(4):
valueName = 'CodeSetNum%i' % i
if disableHid:
reg.DeleteValue(key, valueName)
else:
reg.SetValueEx(key, valueName, 0, reg.REG_DWORD, i + 1)
示例9: printReg
# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import REG_DWORD [as 别名]
def printReg(hive, value, type, fullkey, outFile, objRegistry, key=None):
if not key:
key = fullkey
if type == _winreg.REG_SZ:
result,reg_value = objRegistry.GetStringValue(hDefKey=hive,sSubKeyName=fullkey,sValueName=value)
elif type == _winreg.REG_EXPAND_SZ:
result,reg_value = objRegistry.GetExpandedStringValue(hDefKey=hive,sSubKeyName=fullkey,sValueName=value)
elif type == _winreg.REG_BINARY:
result,reg_value = objRegistry.GetBinaryValue(hDefKey=hive,sSubKeyName=fullkey,sValueName=value)
r_value = ""
if result == 0:
for decimal in reg_value:
r_value += "%0.2X" % decimal
reg_value = "[BINARY DATA] " + r_value
elif type == _winreg.REG_DWORD:
result,reg_value = objRegistry.GetDWORDValue(hDefKey=hive,sSubKeyName=fullkey,sValueName=value)
elif type == _winreg.REG_MULTI_SZ:
result,reg_value = objRegistry.GetMultiStringValue(hDefKey=hive,sSubKeyName=fullkey,sValueName=value)
else:
reg_value = "OTHER_TYPE"
if reg_value == None:
reg_value = "NULL"
reg_value = convert_to_string(reg_value)
outFile.write(key.replace(","," ") + "," + value.replace(","," ") + "," + reg_value.replace(","," ") + "\n")
#convert windows datetime to nicely formatted date
示例10: _win32_is_nic_enabled
# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import REG_DWORD [as 别名]
def _win32_is_nic_enabled(self, lm, guid, interface_key):
# Look in the Windows Registry to determine whether the network
# interface corresponding to the given guid is enabled.
#
# (Code contributed by Paul Marks, thanks!)
#
try:
# This hard-coded location seems to be consistent, at least
# from Windows 2000 through Vista.
connection_key = _winreg.OpenKey(
lm,
r'SYSTEM\CurrentControlSet\Control\Network'
r'\{4D36E972-E325-11CE-BFC1-08002BE10318}'
r'\%s\Connection' % guid)
try:
# The PnpInstanceID points to a key inside Enum
(pnp_id, ttype) = _winreg.QueryValueEx(
connection_key, 'PnpInstanceID')
if ttype != _winreg.REG_SZ:
raise ValueError
device_key = _winreg.OpenKey(
lm, r'SYSTEM\CurrentControlSet\Enum\%s' % pnp_id)
try:
# Get ConfigFlags for this device
(flags, ttype) = _winreg.QueryValueEx(
device_key, 'ConfigFlags')
if ttype != _winreg.REG_DWORD:
raise ValueError
# Based on experimentation, bit 0x1 indicates that the
# device is disabled.
return not (flags & 0x1)
finally:
device_key.Close()
finally:
connection_key.Close()
except (EnvironmentError, ValueError):
# Pre-vista, enabled interfaces seem to have a non-empty
# NTEContextList; this was how dnspython detected enabled
# nics before the code above was contributed. We've retained
# the old method since we don't know if the code above works
# on Windows 95/98/ME.
try:
(nte, ttype) = _winreg.QueryValueEx(interface_key,
'NTEContextList')
return nte is not None
except WindowsError:
return False
示例11: _win32_is_nic_enabled
# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import REG_DWORD [as 别名]
def _win32_is_nic_enabled(self, lm, guid, interface_key):
# Look in the Windows Registry to determine whether the network
# interface corresponding to the given guid is enabled.
#
# (Code contributed by Paul Marks, thanks!)
#
try:
# This hard-coded location seems to be consistent, at least
# from Windows 2000 through Vista.
connection_key = _winreg.OpenKey(
lm,
r'SYSTEM\CurrentControlSet\Control\Network'
r'\{4D36E972-E325-11CE-BFC1-08002BE10318}'
r'\%s\Connection' % guid)
try:
# The PnpInstanceID points to a key inside Enum
(pnp_id, ttype) = _winreg.QueryValueEx(
connection_key, 'PnpInstanceID')
if ttype != _winreg.REG_SZ:
raise ValueError
device_key = _winreg.OpenKey(
lm, r'SYSTEM\CurrentControlSet\Enum\%s' % pnp_id)
try:
# Get ConfigFlags for this device
(flags, ttype) = _winreg.QueryValueEx(
device_key, 'ConfigFlags')
if ttype != _winreg.REG_DWORD:
raise ValueError
# Based on experimentation, bit 0x1 indicates that the
# device is disabled.
return not (flags & 0x1)
finally:
device_key.Close()
finally:
connection_key.Close()
except (EnvironmentError, ValueError):
# Pre-vista, enabled interfaces seem to have a non-empty
# NTEContextList; this was how dnspython detected enabled
# nics before the code above was contributed. We've retained
# the old method since we don't know if the code above works
# on Windows 95/98/ME.
try:
(nte, ttype) = _winreg.QueryValueEx(interface_key,
'NTEContextList')
return nte is not None
except WindowsError:
return False
示例12: PostInit
# 需要导入模块: import _winreg [as 别名]
# 或者: from _winreg import REG_DWORD [as 别名]
def PostInit( self ) :
self.lock.acquire()
if self.abort :
self.lock.release()
return
self.timerInit = Timer( 60.0, self.OnPostInitTimeOut) # Init timeout timer
self.timerInit.start()
returnVal = False
if ( not self.useDefaultPollTime ) :
regHandle = _winreg.OpenKey(
_winreg.HKEY_LOCAL_MACHINE,
'SOFTWARE\hauppauge\IR',
0,
_winreg.KEY_WRITE | _winreg.KEY_READ
)
self.defaultPollTime = int( _winreg.QueryValueEx(regHandle, 'PollRate')[0] )
_winreg.SetValueEx( regHandle, 'PollRate', 0, _winreg.REG_DWORD, int(self.pollTime) )
returnVal = self.IR_Open(self.hwnd, 0, 0, 0);
_winreg.SetValueEx( regHandle, 'PollRate', 0, _winreg.REG_DWORD, int(self.defaultPollTime) )
_winreg.CloseKey( regHandle )
self.defaultPollTime = -1
else :
returnVal = self.IR_Open(self.hwnd, 0, 0, 0);
self.timerInit.cancel()
if not self.initTerminated :
if not returnVal and not self.initTerminated :
self.plugin.PrintError("Couldn't start the Hauppauge remote control")
self.Stop()
self.plugin.TriggerEvent("InitError")
else :
#print "Irremote is started"
pass
del self.timerInit
self.timerInit = None
self.lock.release()