Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
b6e54adb
Kaydet (Commit)
b6e54adb
authored
Haz 30, 2000
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Ooops! I didn't finish all the renaming needed here, so this was
attempting a recursive import and causing a fatal error.
üst
8173d99e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
36 deletions
+36
-36
winreg.py
Lib/plat-win/winreg.py
+36
-36
No files found.
Lib/plat-win/winreg.py
Dosyayı görüntüle @
b6e54adb
import
winreg
import
_
winreg
import
sys
import
exceptions
import
array
...
...
@@ -9,37 +9,37 @@ class RegType:
def
__init__
(
self
,
msname
,
friendlyname
):
self
.
msname
=
msname
self
.
friendlyname
=
friendlyname
self
.
intval
=
getattr
(
winreg
,
msname
)
self
.
intval
=
getattr
(
_
winreg
,
msname
)
def
__repr__
(
self
):
return
"<RegType
%
d:
%
s
%
s>"
%
\
(
self
.
intval
,
self
.
msname
,
self
.
friendlyname
)
_typeConstants
=
{
winreg
.
REG_NONE
:
_
winreg
.
REG_NONE
:
RegType
(
"REG_NONE"
,
"None"
),
winreg
.
REG_SZ
:
_
winreg
.
REG_SZ
:
RegType
(
"REG_SZ"
,
"String"
),
winreg
.
REG_EXPAND_SZ
:
_
winreg
.
REG_EXPAND_SZ
:
RegType
(
"REG_EXPAND_SZ"
,
"Expandable Template String"
),
winreg
.
REG_BINARY
:
_
winreg
.
REG_BINARY
:
RegType
(
"REG_BINARY"
,
"Binary Data"
),
winreg
.
REG_DWORD
:
_
winreg
.
REG_DWORD
:
RegType
(
"REG_DWORD"
,
"Integer"
),
# winreg.REG_DWORD_LITTLE_ENDIAN :
#
_
winreg.REG_DWORD_LITTLE_ENDIAN :
# RegType("REG_DWORD_LITTLE_ENDIAN", "Integer"),
winreg
.
REG_DWORD_BIG_ENDIAN
:
_
winreg
.
REG_DWORD_BIG_ENDIAN
:
RegType
(
"REG_DWORD_BIG_ENDIAN"
,
"Big Endian Integer"
),
winreg
.
REG_LINK
:
_
winreg
.
REG_LINK
:
RegType
(
"REG_LINK"
,
"Link"
),
winreg
.
REG_MULTI_SZ
:
_
winreg
.
REG_MULTI_SZ
:
RegType
(
"REG_MULTI_SZ"
,
"List of Strings"
),
winreg
.
REG_RESOURCE_LIST
:
_
winreg
.
REG_RESOURCE_LIST
:
RegType
(
"REG_RESOURCE_LIST"
,
"Resource List"
),
winreg
.
REG_FULL_RESOURCE_DESCRIPTOR
:
_
winreg
.
REG_FULL_RESOURCE_DESCRIPTOR
:
RegType
(
"REG_FULL_RESOURCE_DESCRIPTOR"
,
"Full Resource Descriptor"
),
winreg
.
REG_RESOURCE_REQUIREMENTS_LIST
:
_
winreg
.
REG_RESOURCE_REQUIREMENTS_LIST
:
RegType
(
"REG_RESOURCE_REQUIREMENTS_LIST"
,
"Resource Requirements List"
)
}
...
...
@@ -128,7 +128,7 @@ class RegValuesDict( _DictBase ):
class
RegKeysDict
(
_DictBase
):
def
_nameFromNum
(
self
,
item
):
return
winreg
.
EnumKey
(
self
.
key
.
handle
,
item
)
return
_
winreg
.
EnumKey
(
self
.
key
.
handle
,
item
)
def
__getitem__
(
self
,
item
):
keyname
=
_getName
(
item
,
self
.
_nameFromNum
)
...
...
@@ -162,7 +162,7 @@ def deleteKey( keyname ):
class
RegKey
:
def
_nameFromNum
(
self
,
item
):
(
name
,
data
,
datatype
)
=
winreg
.
EnumValue
(
self
.
handle
,
item
)
(
name
,
data
,
datatype
)
=
_
winreg
.
EnumValue
(
self
.
handle
,
item
)
return
name
def
__nonzero__
(
self
):
...
...
@@ -185,7 +185,7 @@ class RegKey:
return
"<Windows RegKey:
%
s>"
%
self
.
name
def
close
(
self
):
return
winreg
.
CloseKey
(
self
.
handle
)
return
_
winreg
.
CloseKey
(
self
.
handle
)
def
getSubkeyNames
(
self
):
return
self
.
getSubkeys
()
.
keys
()
...
...
@@ -194,20 +194,20 @@ class RegKey:
return
self
.
getValues
()
.
keys
()
def
deleteSubkey
(
self
,
subkey
):
return
winreg
.
DeleteKey
(
self
.
handle
,
subkey
)
return
_
winreg
.
DeleteKey
(
self
.
handle
,
subkey
)
def
deleteValue
(
self
,
valname
):
return
winreg
.
DeleteValue
(
self
.
handle
,
valname
)
return
_
winreg
.
DeleteValue
(
self
.
handle
,
valname
)
def
createSubkey
(
self
,
keyname
):
handle
=
winreg
.
CreateKey
(
self
.
handle
,
keyname
)
handle
=
_
winreg
.
CreateKey
(
self
.
handle
,
keyname
)
return
RegKey
(
self
.
name
+
"
\\
"
+
keyname
,
handle
)
def
openSubkey
(
self
,
keyname
,
samFlags
=
None
):
if
samFlags
:
handle
=
winreg
.
OpenKey
(
self
.
handle
,
keyname
,
0
,
samFlags
)
handle
=
_
winreg
.
OpenKey
(
self
.
handle
,
keyname
,
0
,
samFlags
)
else
:
handle
=
winreg
.
OpenKey
(
self
.
handle
,
keyname
,
0
)
handle
=
_
winreg
.
OpenKey
(
self
.
handle
,
keyname
,
0
)
return
RegKey
(
self
.
name
+
"
\\
"
+
keyname
,
handle
)
def
getSubkeys
(
self
):
...
...
@@ -219,14 +219,14 @@ class RegKey:
def
getValueNameDataAndType
(
self
,
valname
):
try
:
if
type
(
valname
)
==
IntType
:
(
valname
,
data
,
datatype
)
=
winreg
.
EnumValue
(
self
.
handle
,
valname
)
(
valname
,
data
,
datatype
)
=
_
winreg
.
EnumValue
(
self
.
handle
,
valname
)
else
:
keyname
=
_getName
(
valname
,
self
.
_nameFromNum
)
(
data
,
datatype
)
=
winreg
.
QueryValueEx
(
self
.
handle
,
keyname
)
(
data
,
datatype
)
=
_
winreg
.
QueryValueEx
(
self
.
handle
,
keyname
)
except
(
WindowsError
,
EnvironmentError
):
raise
IndexError
,
valname
if
datatype
==
winreg
.
REG_BINARY
:
if
datatype
==
_
winreg
.
REG_BINARY
:
# use arrays for binary data
data
=
array
.
array
(
'c'
,
data
)
...
...
@@ -241,28 +241,28 @@ class RegKey:
typeint
=
regtype
.
intval
else
:
if
type
(
data
)
==
StringType
:
typeint
=
winreg
.
REG_SZ
typeint
=
_
winreg
.
REG_SZ
elif
type
(
data
)
==
IntType
:
typeint
=
winreg
.
REG_DWORD
typeint
=
_
winreg
.
REG_DWORD
elif
type
(
data
)
==
array
.
ArrayType
:
typeint
=
winreg
.
REG_BINARY
typeint
=
_
winreg
.
REG_BINARY
data
=
data
.
tostring
()
winreg
.
SetValueEx
(
self
.
handle
,
valname
,
0
,
typeint
,
data
)
_
winreg
.
SetValueEx
(
self
.
handle
,
valname
,
0
,
typeint
,
data
)
def
flush
(
self
):
winreg
.
FlushKey
(
self
.
keyobbj
)
_
winreg
.
FlushKey
(
self
.
keyobbj
)
def
save
(
self
,
filename
):
winreg
.
SaveKey
(
self
.
keyobj
,
filename
)
_
winreg
.
SaveKey
(
self
.
keyobj
,
filename
)
def
load
(
self
,
subkey
,
filename
):
return
winreg
.
RegLoadKey
(
self
.
handle
,
subkey
,
filename
)
return
_
winreg
.
RegLoadKey
(
self
.
handle
,
subkey
,
filename
)
class
RemoteKey
(
RegKey
):
def
__init__
(
self
,
machine
,
topLevelKey
):
assert
topLevelKey
in
_hivenames
self
.
handle
=
winreg
.
ConnectRegistry
(
machine
,
parentKey
)
self
.
handle
=
_
winreg
.
ConnectRegistry
(
machine
,
parentKey
)
self
.
name
=
r"\\
%
s\%s"
%
(
machine
,
topLevelKey
)
_hivenames
=
[
"HKEY_CLASSES_ROOT"
,
"HKEY_CURRENT_USER"
,
"HKEY_LOCAL_MACHINE"
,
...
...
@@ -270,7 +270,7 @@ _hivenames = ["HKEY_CLASSES_ROOT","HKEY_CURRENT_USER","HKEY_LOCAL_MACHINE",
"HKEY_PERFORMANCE_DATA"
]
hives
=
{}
for
name
in
_hivenames
:
hives
[
name
]
=
RegKey
(
name
,
getattr
(
winreg
,
name
)
)
hives
[
name
]
=
RegKey
(
name
,
getattr
(
_
winreg
,
name
)
)
hives
[
"HKLM"
]
=
hives
[
"HKEY_LOCAL_MACHINE"
]
hives
[
"HKCR"
]
=
hives
[
"HKEY_CLASSES_ROOT"
]
hives
[
"HKCU"
]
=
hives
[
"HKEY_CURRENT_USER"
]
...
...
@@ -280,7 +280,7 @@ _flagnames = ["KEY_ALL_ACCESS","KEY_CREATE_LINK", "KEY_CREATE_SUB_KEY",
"KEY_QUERY_VALUE"
,
"KEY_READ"
,
"KEY_SET_VALUE"
]
flags
=
{}
for
name
in
_flagnames
:
flags
[
name
]
=
getattr
(
winreg
,
name
)
flags
[
name
]
=
getattr
(
_
winreg
,
name
)
_RegNotifyChangeKeyValueOptions
=
[
"REG_NOTIFY_CHANGE_ATTRIBUTES"
,
"REG_NOTIFY_CHANGE_SECURITY"
,
"REG_NOTIFY_CHANGE_LAST_SET"
,
...
...
@@ -311,7 +311,7 @@ def test():
#typeConstantNames=map( lambda x: x.msname, typeConstants.values() )
#allnames=_hivenames+_flagnames+typeConstantNames+unusednames
#winregnames=winreg.__dict__.keys()
#winregnames=
_
winreg.__dict__.keys()
#for name in winregnames:
# if name not in allnames:
# print name
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment