refs #1310 close a file before reading from it again
parent
d1b49362a4
commit
e43a126557
|
@ -74,7 +74,9 @@ def ogAddRegistryKey (mntpt, hive, k):
|
|||
#@warning Requisitos: chntpw
|
||||
#@warning El sistema de archivos de Windows debe estar montada previamente.
|
||||
#*/ ##
|
||||
#ogAddRegistryValue ('/mnt/sda1', 'SOFTWARE', '\Microsoft\NewKey\Value1')
|
||||
#ogAddRegistryValue ('/mnt/sda1', 'SOFTWARE', '\Microsoft\NewKey\Value1') ## type STRING by default
|
||||
#ogAddRegistryValue ('/mnt/sda1', 'SOFTWARE', '\Microsoft\NewKey\Value1', 'STRING')
|
||||
#ogAddRegistryValue ('/mnt/sda1', 'SOFTWARE', '\Microsoft\NewKey\Value1', 'BINARY')
|
||||
#ogAddRegistryValue ('/mnt/sda1', 'SOFTWARE', '\Microsoft\NewKey\Value1', 'DWORD')
|
||||
def ogAddRegistryValue (mntpt, hive, k, vtype='STRING'):
|
||||
hivefile = ogGetHivePath (mntpt, hive)
|
||||
|
@ -350,7 +352,6 @@ def ogSetRegistryValue (mntpt, hive, k, v):
|
|||
k_dirname, k_basename = _split_k (k)
|
||||
|
||||
with tempfile.NamedTemporaryFile (delete_on_close=False, prefix='chntpw-', mode='w') as f:
|
||||
## TODO: indentation here. This 'try' should be indented
|
||||
f.write (f"ls {k_dirname}\n")
|
||||
f.write ('q\n')
|
||||
f.close()
|
||||
|
@ -375,5 +376,6 @@ def ogSetRegistryValue (mntpt, hive, k, v):
|
|||
f.write (f'ed {k_basename}\n')
|
||||
f.write (f'{formatted}\n')
|
||||
f.write ('q\ny\n')
|
||||
f.close()
|
||||
chntpw (hivefile, f.name)
|
||||
os.remove(f.name)
|
||||
|
|
Loading…
Reference in New Issue