PyHKEY, int = RegCreateKeyEx(Key, SubKey , samDesired , Class , Options , SecurityAttributes , Transaction )

Extended version of RegCreateKey


Key : PyHKEY/int

Registry key or one of win32con.HKEY_* values

SubKey : PyUnicode

Name of subkey to open or create.

samDesired : int

Access allowed to handle, combination of win32con.KEY_* constants. Can also contain standard access rights such as DELETE, WRITE_OWNER, etc.

Class=None : PyUnicode

Name of registry key class


One of the winnt.REG_OPTION_* values

SecurityAttributes=None : PySECURITY_ATTRIBUTES

Specifies security for key and handle inheritance

Transaction=None : PyHANDLE

Handle to a transaction as returned by win32transaction::CreateTransaction


Implemented only as Unicode (RegCreateKeyExW). Accepts keyword arguments.

If a transaction handle is passed in, RegCreateKeyTransacted will be called (requires Vista or later)

Win32 API References

Search for RegCreateKeyEx at msdn, google or google groups.

Search for RegCreateKeyTransacted at msdn, google or google groups.

Return Value

Returns registry handle and flag indicating if key was opened or created (REG_CREATED_NEW_KEY or REG_OPENED_EXISTING_KEY)