|
wslwinreg
|
A Python object representing a win32 registry key. More...
Public Member Functions | |
| __init__ (self, hkey, null_ok=False) | |
| Initialize the PyHKEY class. | |
| __del__ (self) | |
| Called when this object is garbage collected. | |
| Close (self) | |
| Closes the underlying Windows handle. | |
| Detach (self) | |
| Detaches the Windows handle from the handle object. | |
| __enter__ (self) | |
| Called when object is entered. | |
| __exit__ (self, exc_type, exc_value, exc_traceback) | |
| Release handle on class destruction. | |
| __hash__ (self) | |
| Convert the object into a hash. | |
| __int__ (self) | |
| Converting a handle to an integer returns the Win32 handle. | |
| __nonzero__ (self) | |
| Handles with an open object return true, otherwise false. | |
| __bool__ (self) | |
| Handles with an open object return true, otherwise false. | |
| __repr__ (self) | |
| Return descriptive string for the class object. | |
| __str__ (self) | |
| Return short string for the handle object. | |
Static Public Member Functions | |
| make (hkey, null_ok=None) | |
| Convert a pointer into a PyHKEY object. | |
Public Attributes | |
| int | hkey = hkey |
| Integer that represents the HANDLE pointer. | |
Protected Member Functions | |
| _handle (self) | |
| The integer Win32 handle. | |
Properties | |
| handle = property(_handle) | |
| The integer Win32 handle. | |
| _as_parameter_ | |
| Python sort description. | |
A Python object representing a win32 registry key.
This object wraps a Windows HKEY object, automatically closing it when the object is destroyed. To guarantee cleanup, you can call either the Close() method on the object, or the CloseKey() function.
All registry functions in this module return one of these objects.
All registry functions in this module which accept a handle object also accept an integer, however, use of the handle object is encouraged.
Handle objects provide semantics for bool() – thus
will print Yes if the handle is currently valid (has not been closed or detached).
The object also support comparison semantics, so handle objects will compare true if they both reference the same underlying Windows handle value.
Handle objects can be converted to an integer (e.g., using the built-in int() function), in which case the underlying Windows handle value is returned. You can also use the Detach() method to return the integer handle, and also disconnect the Windows handle from the handle object.
| wslwinreg.wslapi.PyHKEY.__init__ | ( | self, | |
| hkey, | |||
| null_ok = False ) |
Initialize the PyHKEY class.
| hkey | Integer value representing the pointer to the HKEY |
| null_ok | True if None is acceptable. |
| wslwinreg.wslapi.PyHKEY.__enter__ | ( | self | ) |
Called when object is entered.
| wslwinreg.wslapi.PyHKEY.__exit__ | ( | self, | |
| exc_type, | |||
| exc_value, | |||
| exc_traceback ) |
Release handle on class destruction.
| wslwinreg.wslapi.PyHKEY.__hash__ | ( | self | ) |
Convert the object into a hash.
| wslwinreg.wslapi.PyHKEY.Close | ( | self | ) |
Closes the underlying Windows handle.
| wslwinreg.wslapi.PyHKEY.Detach | ( | self | ) |
Detaches the Windows handle from the handle object.
After calling this function, the handle is effectively invalidated, but the handle is not closed. You would call this function when you need the underlying win32 handle to exist beyond the lifetime of the handle object.
On 64 bit windows, the result of this function is a long integer.