

| ¾÷½X |
|
|---|---|
| _winreg. |
HKEY_CLASSES_ROOT |
| _winreg. |
HKEY_CURRENT_USER |
| _winreg. |
HKEY_LOCAL_MACHINE |
| _winreg. |
HKEY_USERS |
| _winreg. |
HKEY_CURRENT_CONFIG |
| _winreg. |
HKEY_DYN_DATA |
computer_name¬O»·ºÝ¹q¸£ªº¦WºÙ,¨ä®æ¦¡¬° r"\\computername".¦pªG¬ON0¨S¦³«h¬O¥»¦a¹q¸£.
¦^¶Çª«¥ó,¦pªG¨ç¦¡¦æ¿ù»~·|²£¥Í EnvironmentError¿ù»~
key¤w¸g¶}±Òªºkey, ©Î¬O¥ý«e©w¸qªº HKEY_* ±`¼Æ¤§¤@.
sub_key
¬O§ÚÌn«Ø¥ßªº¤l¾÷½X,¨ä¤¤«Ø¥ßªº¾÷½X¬Oìkey/sub_key,¦pªG¥ý«e¬O©w¸q¶}±Ò¤Fkey/subkey,«hsub_key¥i¥H¬ONone.
¦b¨ººØ±¡ªp¤U,In that case, the handle returned is the same key handle passed
in to the function.
¦pªGkey Ȥw¸g¦s¦b,³oӨ禡«h·|¶}±Ò¦s¦bªº¾÷½X
¦^¶ÇªºÈ¬O¤@Ó¶}±ÒÁäȪº handle. ¦pªG¥¢±Ñ·|²£¥ÍEnvironmentError.
key¤w¸g¶}±Òªºkey, ©Î¬O¥ý«e©w¸qªº HKEY_* ±`¼Æ¤§¤@.
sub_key ¬O¤@Ó¦r¦ê¥²¶·¬Okey¤Uªº¤lÁä.³oÓȤ£¥i¥H¬OªÅªº(None),
¨Ã¥B³oÓ key¥i¯à¨S¦³subkeys.
³oÓ¤èªkµLªk§t¦³subkeysªºkey.
¦pªG°õ¦æ¦¨¥\,¾ãÓkey,¥]§t¤F¥¦ªºÈ,·|³Q²¾°£.¦pªG¥¢±Ñ«h·|²£¥Í EnvironmentError.
key¤w¸g¶}±Òªºkey, ©Î¬O¥ý«e©w¸qªº HKEY_* ±`¼Æ¤§¤@.
value ¬O¤@Ó¦r¦ê¥Î¨Ó«ü¥Xn²¾°£ªº¼ÆÈ.
key¤w¸g¶}±Òªºkey, ©Î¬O¥ý«e©w¸qªº HKEY_* ±`¼Æ¤§¤@.
index ¬O¤@Ó¾ã¼Æ¨Óªí¥Ükey¬O¦^¶ÇªºÈ.
³oӨ禡¶Ç¦^¨ä¤¤¤@Ó¤l¾÷½X,¨C¤@¦¸³Q©I¥s. It is typically called repeatedly until an EnvironmentError exception is raised, indicating, no more values are available.
key¤w¸g¶}±Òªºkey, ©Î¬O¥ý«e©w¸qªº HKEY_* ±`¼Æ¤§¤@.
index¬O¤@Ó¾ã¼Æ that identifies the index of the value to retrieve.
The function retrieves the name of one subkey each time it is called. It is typically called repeatedly, until an EnvironmentError exception is raised, indicating no more values.
µ²ªG¬O¶Ç¦^¤TÓ¤l¶µ¥Ø:
| Index | ·N¸q |
|---|---|
| 0 | ¤@Ó¦r¦ê«ü¥Xvalue name |
| 1 | ¤@Óª«¥ó¥]¯dvalue data, and whose type depends on the underlying registry type |
| 2 | ¤@Ó¾ã¼Æ«ü¥Xthe type of the value data |
kkey¤w¸g¶}±Òªºkey, ©Î¬O¥ý«e©w¸qªº HKEY_* ±`¼Æ¤§¤@.
¤£¦b»Ýn©I¥sRegFlushKey¨Ó§ïÅܤ@Ó¾÷½X. Registry changes are flushed to disk by the registry using its lazy flusher. Registry changes are also flushed to disk at system shutdown. Unlike CloseKey(), the FlushKey() method returns only when all the data has been written to the registry. An application should only call FlushKey() if it requires absolute certainty that registry changes are on disk.
¦pªG§A¤£ª¾¹DFlushKey() call is required, it probably isn't.
key¤w¸g¶}±Òªºkey, ©Î¬O¥ý«e©w¸qªº HKEY_* ±`¼Æ¤§¤@.
sub_key is a string that identifies the sub_key to load
file_name is the name of the file to load registry data from. This file must have been created with the SaveKey() function. Under the file allocation table (FAT) file system, the filename may not have an extension.
A call to LoadKey() fails if the calling process does not have the SE_RESTORE_PRIVILEGE privilege. Note that privileges are different than permissions - see the Win32 documentation for more details.
If key is a handle returned by ConnectRegistry(), then the path specified in fileName is relative to the remote computer.
The Win32 documentation implies key must be in the HKEY_USER or HKEY_LOCAL_MACHINE tree. This may or may not be true.
= 0][,
sam = KEY_READ])key=¤º«Ø¾÷½X
sub_key ¬O¤l¾÷½X
res ¬O¤@Ó«O¯d¦r¤º©w0.
sam ¬O¤@Ó¾ã¼Æ¨Ó³]©w¦s¨ú¼Ò¦¡,¤º©w¬° KEY_READ
¶Ç¦^ª«¥ókey OpneKey()©Ò¶Ç¦^¨Óªºª«¥ó.
¤TÓȪº·N¸q¦p¤U:
| ¶¶§Ç |
·N¸q |
|---|---|
| 0 | ¤lÁ䪺¼Æ¥Ø |
| 1 | ¥»Á䪺È. |
| 2 | 0L |
key¤w¸g¶}±Òªºkey, ©Î¬O¥ý«e©w¸qªº HKEY_* ±`¼Æ¤§¤@.
sub_key is a string that holds the name of the subkey
with which the value is associated. If this parameter is None
or empty, the function retrieves the value set by the SetValue() method for the key identified by key.
Values in the registry have name, type, and data components. This method retrieves the data for a key's first value that has a NULL name. But the underlying API call doesn't return the type, Lame Lame Lame, DO NOT USE THIS!!!
key¤w¸g¶}±Òªºkey, ©Î¬O¥ý«e©w¸qªº HKEY_* ±`¼Æ¤§¤@.
value_name is a string indicating the value to query.
The result is a tuple of 2 items:
| Index | ·N¸q |
|---|---|
| 0 | The value of the registry item. |
| 1 | An integer giving the registry type for this value. |
key¤w¸g¶}±Òªºkey, ©Î¬O¥ý«e©w¸qªº HKEY_* ±`¼Æ¤§¤@.
file_name ¬OnÀx¦s¨ìªºÀɮצWºÙ. ³oÓÀɮפ£¥i¥H¤w¸g¦s¦b.¦pªGÀɦW¥]§t¤F°ÆÀɦW,¥¦¤£¥i¥H³Q¨Ï¥Î¦bÀÉ®×°t¸mªí(FAT)ÀÉ®× file systems by the LoadKey(), ReplaceKey() or RestoreKey() methods.
¦pªGkey ¥X¦b»·ºÝªº¹q¸£,³oÓ¸ô®|´yz¥Ñfile_name ¬OÃö³s¨ì»·ºÝªº¹q¸£. ©I¥s³oºØ¤èªk¥²¶·°õ¦æSeBackupPrivilege security privilege. Note that privileges are different than permissions - see the Win32 documentation for more details.
This function passes NULL for security_attributes to the API.
key¤w¸g¶}±Òªºkey, ©Î¬O¥ý«e©w¸qªº HKEY_* ±`¼Æ¤§¤@.
sub_key is a string that names the subkey with which the value is associated.
type ¥²¶·¬OREG_SZ, ·N¨ý¥u¦³¦r¦ê¬O³Q¤ä´©ªº.¦Ó¨Ï¥Î SetValueEx()¨ç¦¡«h¤ä´©§Oªº¸ê®Æ«¬ºA.
value is a string that specifies the new value.
If the key specified by the sub_key parameter does not exist, the SetValue function creates it.
Value lengths are limited by available memory. Long values (more than 2048 bytes) should be stored as files with the filenames stored in the configuration registry. This helps the registry perform efficiently.
The key identified by the key parameter must have been opened with KEY_SET_VALUE access.
key¤w¸g¶}±Òªºkey, ©Î¬O¥ý«e©w¸qªº HKEY_* ±`¼Æ¤§¤@.
sub_key is a string that names the subkey with which the value is associated.
type is an integer that specifies the type of the data. This should be one of the following constants defined in this module:
| ±`¼Æ |
·N¸q |
|---|---|
| REG_BINARY | ¤G¦ì¤¸¸ê®Æin any form. |
| REG_DWORD | ¤@Ó32-¦ì¤¸ªº¼Æ¦r. |
| REG_DWORD_LITTLE_ENDIAN | ¤@Ó32-¦ì¤¸¼Æ¦rin little-endian format. |
| REG_DWORD_BIG_ENDIAN | A 32-bit number in big-endian format. |
| REG_EXPAND_SZ | Null-terminated string containing references to environment variables ("%PATH%"). |
| REG_LINK | A Unicode symbolic link. |
| REG_MULTI_SZ | A sequence of null-terminated strings, terminated by two null characters. (Python handles this termination automatically.) |
| REG_NONE | ¥¼©w¸qªºÈ®æ¦¡. |
| REG_RESOURCE_LIST | A device-driver resource list. |
| REG_SZ | A null-terminated string. |
reserved can be anything - zero is always passed to the API.
value is a string that specifies the new value.
This method can also set additional value and type information for the specified key. The key identified by the key parameter must have been opened with KEY_SET_VALUE access.
To open the key, use the CreateKeyEx() or OpenKey() methods.
Value lengths are limited by available memory. Long values (more than 2048 bytes) should be stored as files with the filenames stored in the configuration registry. This helps the registry perform efficiently.