def setValueFromRegKey(self, key, valueName, valueData, valueType):
"""Sets a value in a key
@param key: The registry key that holds the value to set. If the key does not exist, it will be created. The key should include the section. Eg. "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion"
@type key: string
@param valueName: The name of the value to set
@type valueName: string
@param valueData: The data to assign to the value
@type valueData: string
@param valueType: The type of the value
@type valueType: WinRegValueType
"""
hkey, key = self._getHiveAndKey(key)
aReg = reg.ConnectRegistry(None, hkey)
aKey = reg.CreateKey(aReg, key)
reg.SetValueEx(aKey, valueName, 0, valueType.type, valueData)
评论列表
文章目录