Re: [Samba] regpatch writing to local registry hive with -F not working (registery-utils 4.0.0~alpha15~git20110124.dfsg1-2ubuntu1)

2011-07-26 Thread RiCH
Hi Denis,

I was just wondering if any progress was made with regpatch?

Yours hopefully :)

Rich

On Thu, 2011-05-19 at 09:08 +0200, denis.bonnenfant wrote:

 Wilco Baan Hofman a écrit :
  On Wed, 2011-05-18 at 16:01 +0200, denis bonnenfant wrote:

  Le mercredi 18 mai 2011 à 15:07 +0200, Wilco Baan Hofman a écrit :
  
  On Wed, 2011-05-18 at 12:33 +0200, Michael Wood wrote:
 

  Then it seems the -F option should be removed from regpatch.  Or
  should regpatch be replaced with something similar to the Python script
  you included below?
  
  My patch adds a -K option to regpatch for specifying the predef key
  where -F registry should be mounted. I will submit it for review soon,
  I'm currently experimenting a little bit, and there are still some bugs
  in .reg parsing
  
 

 
 In fact it doesn't make sense to mount regf files to anything but HKCU , 
 so -K option is not necessary, and HKCU can be hardcoded as mountpoint 
 for files specified by -F option.
 
 
  I use this quite a bit and I'm aware of two bugs, which is not directly
  related to the parsing, but that on windows unicode is implicit for
  certain data types even when the data is given in binary format, it's
  still converted. The other 'bug' is that unicode .reg files are not yet
  supported. I'd be very interested to know what other bugs there are.

 I found some problems with value deletion, sometimes values are not 
 deleted, reg_expand_sz data not correctly saved,  but i'm not sure that 
 the problem is in parsing. I'm going to experiment a little bit more.
 
 Denis


-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba

Re: [Samba] regpatch writing to local registry hive with -F not working (registery-utils 4.0.0~alpha15~git20110124.dfsg1-2ubuntu1)

2011-05-19 Thread RiCH
On Thu, 2011-05-19 at 09:08 +0200, denis.bonnenfant wrote:

 Wilco Baan Hofman a écrit :
  On Wed, 2011-05-18 at 16:01 +0200, denis bonnenfant wrote:

  Le mercredi 18 mai 2011 à 15:07 +0200, Wilco Baan Hofman a écrit :
  
  On Wed, 2011-05-18 at 12:33 +0200, Michael Wood wrote:
 

  Then it seems the -F option should be removed from regpatch.  Or
  should regpatch be replaced with something similar to the Python script
  you included below?
  
  My patch adds a -K option to regpatch for specifying the predef key
  where -F registry should be mounted. I will submit it for review soon,
  I'm currently experimenting a little bit, and there are still some bugs
  in .reg parsing
  
 

 
 In fact it doesn't make sense to mount regf files to anything but HKCU , 
 so -K option is not necessary, and HKCU can be hardcoded as mountpoint 
 for files specified by -F option.
 


Sorry if I am misunderstanding something here, but if the .reg file is
modifying a software or system key shouldn't regpatch
 mount the appropriate hive,  mounting under HKLM/Software  system
under HKLM/system etc. ?

(I currently am using Ghost's linux ghregedit to do this, but I am
hoping for a license free version, ... I have been searching for a very
long time for something that actually works!)

I was envisaging a usage along these lines;
regpatch -F  /mnt/xp/WINDOWS/ myregpatch.reg #regpatch loads the hives
needed itself based on the WNIDOWS target dir (auto filling
system32/config), this approximates to how ghrededit works
..or more in keeping with how its setup at the moment
regpatch -F  /mnt/something/software,/mnt/something/system
myregpatch.reg #tell it what hives to load

I appreciate all the effort everyone is putting in. Thanks.


 
  I use this quite a bit and I'm aware of two bugs, which is not directly
  related to the parsing, but that on windows unicode is implicit for
  certain data types even when the data is given in binary format, it's
  still converted. The other 'bug' is that unicode .reg files are not yet
  supported. I'd be very interested to know what other bugs there are.

 I found some problems with value deletion, sometimes values are not 
 deleted, reg_expand_sz data not correctly saved,  but i'm not sure that 
 the problem is in parsing. I'm going to experiment a little bit more.
 
 Denis


-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba

Re: [Samba] regpatch writing to local registry hive with -F not working (registery-utils 4.0.0~alpha15~git20110124.dfsg1-2ubuntu1)

2011-05-19 Thread Wilco Baan Hofman
On Sun, 2011-05-15 at 00:28 +0200, Michael Wood wrote:
 On 14 May 2011 22:09, Michael Wood esiot...@gmail.com wrote:
  On 14 May 2011 19:53, RiCH r...@richud.com wrote:
  Hi,
 
  I was hoping I could modify a locally mounted registry hive using
  regpatch and a .reg file but the -F argument seems to have no function.

Correct. It does not on regpatch, afaik.

  Try this patch (untested, but based on what regtree does).

Won't work. See below.

  I've either got errors like:
 
 $ bin/regpatch -F /tmp/NTUSER.DAT /tmp/test.reg
 Error adding new key 'HKEY_CURRENT_USER\Software\Microsoft\Internet
 Explorer\Main': WERR_BADFILE
 Error adding key HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
 
 I hope the patch helps, but I'm not sure that just using
 start_key-context is the right thing to do.
 

Actually, the reason this doesn't work is that -F loads a registry hive,
not a full registry and .reg files only work on a full registry.

If you load a hive with -F you cannot patch it.

A simple python script will work, however.. something like this:

---
sys.path.append(samba_python_path)
from samba import registry
import samba.getopt as options

# Open the hive
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)
hive = registry.open_hive(hivepath, lp_ctx=lp, credentials=creds)

# Mount the hive to HKEY_CURRENT_USER
reg = registry.Registry()
reg.mount_hive(hive, registry.HKEY_CURRENT_USER)
reg.diff_apply(patchfile)
---

Regards,

Wilco Baan Hofman




-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] regpatch writing to local registry hive with -F not working (registery-utils 4.0.0~alpha15~git20110124.dfsg1-2ubuntu1)

2011-05-19 Thread Wilco Baan Hofman
On Wed, 2011-05-18 at 12:33 +0200, Michael Wood wrote:

 
 Then it seems the -F option should be removed from regpatch.  Or
 should regpatch be replaced with something similar to the Python script
 you included below?

The latter would be preferable, but you'd have to be able to specify
mountpoints for the hives.

 ---
  sys.path.append(samba_python_path)
  from samba import registry
  import samba.getopt as options
 
  # Open the hive
  lp = sambaopts.get_loadparm()
  creds = credopts.get_credentials(lp)
  hive = registry.open_hive(hivepath, lp_ctx=lp, credentials=creds)
 
 So hivepath here is the path to e.g. some user's NTUSER.DAT?

Indeed.

  # Mount the hive to HKEY_CURRENT_USER
  reg = registry.Registry()
  reg.mount_hive(hive, registry.HKEY_CURRENT_USER)
  reg.diff_apply(patchfile)
 ---

Regards,

Wilco Baan Hofman


-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] regpatch writing to local registry hive with -F not working (registery-utils 4.0.0~alpha15~git20110124.dfsg1-2ubuntu1)

2011-05-19 Thread denis bonnenfant
Le mercredi 18 mai 2011 à 15:07 +0200, Wilco Baan Hofman a écrit :
 On Wed, 2011-05-18 at 12:33 +0200, Michael Wood wrote:
 
  
  Then it seems the -F option should be removed from regpatch.  Or
  should regpatch be replaced with something similar to the Python script
  you included below?
 

My patch adds a -K option to regpatch for specifying the predef key
where -F registry should be mounted. I will submit it for review soon,
I'm currently experimenting a little bit, and there are still some bugs
in .reg parsing

Denis

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba

Re: [Samba] regpatch writing to local registry hive with -F not working (registery-utils 4.0.0~alpha15~git20110124.dfsg1-2ubuntu1)

2011-05-19 Thread Wilco Baan Hofman
On Wed, 2011-05-18 at 16:01 +0200, denis bonnenfant wrote:
 Le mercredi 18 mai 2011 à 15:07 +0200, Wilco Baan Hofman a écrit :
  On Wed, 2011-05-18 at 12:33 +0200, Michael Wood wrote:
  
   
   Then it seems the -F option should be removed from regpatch.  Or
   should regpatch be replaced with something similar to the Python script
   you included below?
  
 
 My patch adds a -K option to regpatch for specifying the predef key
 where -F registry should be mounted. I will submit it for review soon,
 I'm currently experimenting a little bit, and there are still some bugs
 in .reg parsing

I use this quite a bit and I'm aware of two bugs, which is not directly
related to the parsing, but that on windows unicode is implicit for
certain data types even when the data is given in binary format, it's
still converted. The other 'bug' is that unicode .reg files are not yet
supported. I'd be very interested to know what other bugs there are.

Regards,

Wilco Baan Hofman

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba

Re: [Samba] regpatch writing to local registry hive with -F not working (registery-utils 4.0.0~alpha15~git20110124.dfsg1-2ubuntu1)

2011-05-19 Thread denis.bonnenfant

Wilco Baan Hofman a écrit :

On Wed, 2011-05-18 at 16:01 +0200, denis bonnenfant wrote:
  

Le mercredi 18 mai 2011 à 15:07 +0200, Wilco Baan Hofman a écrit :


On Wed, 2011-05-18 at 12:33 +0200, Michael Wood wrote:

  

Then it seems the -F option should be removed from regpatch.  Or
should regpatch be replaced with something similar to the Python script
you included below?


My patch adds a -K option to regpatch for specifying the predef key
where -F registry should be mounted. I will submit it for review soon,
I'm currently experimenting a little bit, and there are still some bugs
in .reg parsing



  


In fact it doesn't make sense to mount regf files to anything but HKCU , 
so -K option is not necessary, and HKCU can be hardcoded as mountpoint 
for files specified by -F option.




I use this quite a bit and I'm aware of two bugs, which is not directly
related to the parsing, but that on windows unicode is implicit for
certain data types even when the data is given in binary format, it's
still converted. The other 'bug' is that unicode .reg files are not yet
supported. I'd be very interested to know what other bugs there are.
  
I found some problems with value deletion, sometimes values are not 
deleted, reg_expand_sz data not correctly saved,  but i'm not sure that 
the problem is in parsing. I'm going to experiment a little bit more.


Denis
--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba

Re: [Samba] regpatch writing to local registry hive with -F not working (registery-utils 4.0.0~alpha15~git20110124.dfsg1-2ubuntu1)

2011-05-18 Thread Michael Wood
On 18 May 2011 01:55, Wilco Baan Hofman wi...@baanhofman.nl wrote:
 On Sun, 2011-05-15 at 00:28 +0200, Michael Wood wrote:
 On 14 May 2011 22:09, Michael Wood esiot...@gmail.com wrote:
  On 14 May 2011 19:53, RiCH r...@richud.com wrote:
  Hi,
 
  I was hoping I could modify a locally mounted registry hive using
  regpatch and a .reg file but the -F argument seems to have no function.

 Correct. It does not on regpatch, afaik.

  Try this patch (untested, but based on what regtree does).

 Won't work. See below.

  I've either got errors like:

 $ bin/regpatch -F /tmp/NTUSER.DAT /tmp/test.reg
 Error adding new key 'HKEY_CURRENT_USER\Software\Microsoft\Internet
 Explorer\Main': WERR_BADFILE
 Error adding key HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main

 I hope the patch helps, but I'm not sure that just using
 start_key-context is the right thing to do.

 Actually, the reason this doesn't work is that -F loads a registry hive,
 not a full registry and .reg files only work on a full registry.

 If you load a hive with -F you cannot patch it.

Then it seems the -F option should be removed from regpatch.  Or
should regpatch be replaced with something similar to the Python script
you included below?

 A simple python script will work, however.. something like this:

---
 sys.path.append(samba_python_path)
 from samba import registry
 import samba.getopt as options

 # Open the hive
 lp = sambaopts.get_loadparm()
 creds = credopts.get_credentials(lp)
 hive = registry.open_hive(hivepath, lp_ctx=lp, credentials=creds)

So hivepath here is the path to e.g. some user's NTUSER.DAT?

 # Mount the hive to HKEY_CURRENT_USER
 reg = registry.Registry()
 reg.mount_hive(hive, registry.HKEY_CURRENT_USER)
 reg.diff_apply(patchfile)
---

 Regards,

 Wilco Baan Hofman

-- 
Michael Wood esiot...@gmail.com
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] regpatch writing to local registry hive with -F not working (registery-utils 4.0.0~alpha15~git20110124.dfsg1-2ubuntu1)

2011-05-17 Thread denis bonnenfant
Le dimanche 15 mai 2011 à 00:28 +0200, Michael Wood a écrit :
 On 14 May 2011 22:09, Michael Wood esiot...@gmail.com wrote:
  On 14 May 2011 19:53, RiCH r...@richud.com wrote:
  Hi,
 

Hi, 

Two years ago, I worked a bit on this. There was a lot of things to be
done for full support of regf files patching . My patches mostly worked,
but I never submitted it because I finally decided to generate .pol
files with a small python script and appmently it on client side instead
of patching regf files server-side.

So I'm going to resurrect my old sources, rebase it on current git, and
hope it helps... As far as I remember, there was some problems with regf
format writing, and the registry files generated were sometimes
corrupted. Investigating it may be quite difficult, as regf format is
not simple and badly documented. But maybe some work was already done
yet ? 

Denis

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba

Re: [Samba] regpatch writing to local registry hive with -F not working (registery-utils 4.0.0~alpha15~git20110124.dfsg1-2ubuntu1)

2011-05-17 Thread denis bonnenfant
Le dimanche 15 mai 2011 à 10:26 +0200, denis bonnenfant a écrit :
 Le dimanche 15 mai 2011 à 00:28 +0200, Michael Wood a écrit :
  On 14 May 2011 22:09, Michael Wood esiot...@gmail.com wrote:
   On 14 May 2011 19:53, RiCH r...@richud.com wrote:
   Hi,
  
 
 Hi, 
 
 Two years ago, I worked a bit on this. There was a lot of things to be
 done for full support of regf files patching . My patches mostly worked,
 but I never submitted it because I finally decided to generate .pol
 files with a small python script and appmently it on client side instead
 of patching regf files server-side.
 
 So I'm going to resurrect my old sources, rebase it on current git, and
 hope it helps... As far as I remember, there was some problems with regf
 format writing, and the registry files generated were sometimes
 corrupted. Investigating it may be quite difficult, as regf format is
 not simple and badly documented. But maybe some work was already done
 yet ? 

I had a look, and the merge is not straightforward. So I have work on it
a little bit. Hopefully, regf code seems  corrected, so I expect some
good news...

Denis

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba

Re: [Samba] regpatch writing to local registry hive with -F not working (registery-utils 4.0.0~alpha15~git20110124.dfsg1-2ubuntu1)

2011-05-15 Thread RiCH
Hi Michael,

Many thanks for your reply - have tried your second patch on the git I
just pulled, and got about as far as you, 
.reg file contains a bit for system and software hive, first entry in it
relates to software hive

against software hive

rfm6@KubuntuSSDx64:/media/7200.12/clonemod/source/samba4/bin/default/source4/lib/registry$
 ./regpatch -d=10 -F /tmp/config/software /tmp/config/RunOnceEx.reg
INFO: Current debug levels:
  all: 10
  tdb: 10
  printdrivers: 10
  lanman: 10
  smb: 10
  rpc_parse: 10
  rpc_srv: 10
  rpc_cli: 10
  passdb: 10
  sam: 10
  auth: 10
  winbind: 10
  vfs: 10
  idmap: 10
  quota: 10
  acls: 10
  locking: 10
  msdfs: 10
  dmapi: 10
  registry: 10
Attempting to load registry file
3444 HBIN blocks read
Opening parent of HKEY_LOCAL_MACHINE\SOFTWARE failed with WERR_BADFILE
Error adding new key 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
\CurrentVersion\RunOnceEx\940': WERR_BADFILE
Error adding key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
\CurrentVersion\RunOnceEx\940
rfm6@KubuntuSSDx64:/media/7200.12/clonemod/source/samba4/bin/default/source4/lib/registry$
 



against system hive

rfm6@KubuntuSSDx64:/media/7200.12/clonemod/source/samba4/bin/default/source4/lib/registry$
 ./regpatch -d=10 -F /tmp/config/system /tmp/config/RunOnceEx.reg 
INFO: Current debug levels:
  all: 10
  tdb: 10
  printdrivers: 10
  lanman: 10
  smb: 10
  rpc_parse: 10
  rpc_srv: 10
  rpc_cli: 10
  passdb: 10
  sam: 10
  auth: 10
  winbind: 10
  vfs: 10
  idmap: 10
  quota: 10
  acls: 10
  locking: 10
  msdfs: 10
  dmapi: 10
  registry: 10
Attempting to load registry file
789 HBIN blocks read
Opening parent of HKEY_LOCAL_MACHINE\SOFTWARE failed with WERR_BADFILE
Error adding new key 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
\CurrentVersion\RunOnceEx\940': WERR_BADFILE
Error adding key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
\CurrentVersion\RunOnceEx\940
rfm6@KubuntuSSDx64:/media/7200.12/clonemod/source/samba4/bin/default/source4/lib/registry$
 

changing order of things in .reg file so system hive alteration is first
bit

rfm6@KubuntuSSDx64:/media/7200.12/clonemod/source/samba4/bin/default/source4/lib/registry$
 ./regpatch -d=10 -F /tmp/config/system /tmp/config/RunOnceEx2.reg 
INFO: Current debug levels:
  all: 10
  tdb: 10
  printdrivers: 10
  lanman: 10
  smb: 10
  rpc_parse: 10
  rpc_srv: 10
  rpc_cli: 10
  passdb: 10
  sam: 10
  auth: 10
  winbind: 10
  vfs: 10
  idmap: 10
  quota: 10
  acls: 10
  locking: 10
  msdfs: 10
  dmapi: 10
  registry: 10
Attempting to load registry file
789 HBIN blocks read
Opening parent of HKEY_LOCAL_MACHINE\SYSTEM failed with WERR_BADFILE
Error adding new key 'HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services
\Intelppm': WERR_BADFILE
Error adding key HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services
\Intelppm
rfm6@KubuntuSSDx64:/media/7200.12/clonemod/source/samba4/bin/default/source4/lib/registry$


removed all system hive references, only entry relates to system hive

rfm6@KubuntuSSDx64:/media/7200.12/clonemod/source/samba4/bin/default/source4/lib/registry$
 ./regpatch -d=10 -F /tmp/config/system /tmp/config/RunOnceEx3.reg 
INFO: Current debug levels:
  all: 10
  tdb: 10
  printdrivers: 10
  lanman: 10
  smb: 10
  rpc_parse: 10
  rpc_srv: 10
  rpc_cli: 10
  passdb: 10
  sam: 10
  auth: 10
  winbind: 10
  vfs: 10
  idmap: 10
  quota: 10
  acls: 10
  locking: 10
  msdfs: 10
  dmapi: 10
  registry: 10
Attempting to load registry file
789 HBIN blocks read
Opening parent of HKEY_LOCAL_MACHINE\SYSTEM failed with WERR_BADFILE
Error adding new key 'HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services
\Intelppm': WERR_BADFILE
Error adding key HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services
\Intelppm


not specifying a hive so it writes to local samba hklm.tdb (seems to
work fine)

rfm6@KubuntuSSDx64:/media/7200.12/clonemod/source/samba4/bin/default/source4/lib/registry$
 sudo ./regpatch -d=10 /tmp/config/RunOnceEx.reg
INFO: Current debug levels:
  all: 10
  tdb: 10
  printdrivers: 10
  lanman: 10
  smb: 10
  rpc_parse: 10
  rpc_srv: 10
  rpc_cli: 10
  passdb: 10
  sam: 10
  auth: 10
  winbind: 10
  vfs: 10
  idmap: 10
  quota: 10
  acls: 10
  locking: 10
  msdfs: 10
  dmapi: 10
  registry: 10
ldb: ldb_trace_request: SEARCH
 dn: @MODULES
 scope: base
 expr: (@LIST=*)
 attr: @LIST
 control: NONE

ldb: ldb_trace_request: (tdb)-search
ldb: no modules required by the db
ldb: No modules specified for this database
ldb: ldb_trace_request: REGISTER_CONTROL
1.2.840.113556.1.4.1413
 control: NONE

ldb: ldb_trace_request: SEARCH
 dn: rootDSE
 scope: base
 expr: (objectClass=*)
 attr: rootDomainNamingContext
 attr: configurationNamingContext
 attr: schemaNamingContext
 attr: defaultNamingContext
 control: NONE

ldb: ldb_trace_request: (tdb)-search
ldb_wrap open of /usr/local/samba/private/hklm.ldb
ldb: start ldb transaction (nesting: 0)
ldb: ldb_trace_request: (tdb)-start_transaction
ldb: start ldb transaction error: (null)
ldb: ldb_trace_request: ADD
dn: @ATTRIBUTES

Re: [Samba] regpatch writing to local registry hive with -F not working (registery-utils 4.0.0~alpha15~git20110124.dfsg1-2ubuntu1)

2011-05-15 Thread RiCH
Bonjour Denis,

I would be very grateful if you manage to do it!

Rich

On Sun, 2011-05-15 at 17:41 +0200, denis bonnenfant wrote:

 Le dimanche 15 mai 2011 à 10:26 +0200, denis bonnenfant a écrit :
  Le dimanche 15 mai 2011 à 00:28 +0200, Michael Wood a écrit :
   On 14 May 2011 22:09, Michael Wood esiot...@gmail.com wrote:
On 14 May 2011 19:53, RiCH r...@richud.com wrote:
Hi,
   
  
  Hi, 
  
  Two years ago, I worked a bit on this. There was a lot of things to be
  done for full support of regf files patching . My patches mostly worked,
  but I never submitted it because I finally decided to generate .pol
  files with a small python script and appmently it on client side instead
  of patching regf files server-side.
  
  So I'm going to resurrect my old sources, rebase it on current git, and
  hope it helps... As far as I remember, there was some problems with regf
  format writing, and the registry files generated were sometimes
  corrupted. Investigating it may be quite difficult, as regf format is
  not simple and badly documented. But maybe some work was already done
  yet ? 
 
 I had a look, and the merge is not straightforward. So I have work on it
 a little bit. Hopefully, regf code seems  corrected, so I expect some
 good news...
 
 Denis


-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba

[Samba] regpatch writing to local registry hive with -F not working (registery-utils 4.0.0~alpha15~git20110124.dfsg1-2ubuntu1)

2011-05-14 Thread RiCH
Hi,

I was hoping I could modify a locally mounted registry hive using
regpatch and a .reg file but the -F argument seems to have no function.

(Strace shows it ignores it and just operates
on /var/lib/samba/private/hklm.ldb)
Below is output with debug on.

rfm6@ubuntuSSDx64:cp /mnt/xp/WINDOWS/system32/config/software /tmp/software
rfm6@ubuntuSSDx64:/tmp/config$ sudo regpatch -d=10 -F software
RunOnceSoftware.reg
lpcfg_load: refreshing parameters from /etc/samba/smb.conf
params.c:pm_process() - Processing configuration file
/etc/samba/smb.conf
Processing section [global]
Unknown parameter encountered: max log size
Ignoring unknown parameter max log size
Unknown parameter encountered: syslog
Ignoring unknown parameter syslog
Unknown parameter encountered: passdb backend
Ignoring unknown parameter passdb backend
Unknown parameter encountered: unix password sync
Ignoring unknown parameter unix password sync
Unknown parameter encountered: passwd program
Ignoring unknown parameter passwd program
Unknown parameter encountered: pam password change
Ignoring unknown parameter pam password change
Unknown parameter encountered: map to guest
Ignoring unknown parameter map to guest
Unknown parameter encountered: usershare allow guests
Ignoring unknown parameter usershare allow guests
Processing section [printers]
Unknown parameter encountered: guest ok
Ignoring unknown parameter guest ok
Processing section [print$]
Unknown parameter encountered: guest ok
Ignoring unknown parameter guest ok
pm_process() returned Yes
ldb: ldb_trace_request: SEARCH
 dn: @MODULES
 scope: base
 expr: (@LIST=*)
 attr: @LIST
 control: NONE

ldb: ldb_trace_request: (tdb)-search
ldb: no modules required by the db
ldb: No modules specified for this database
ldb: ldb_trace_request: REGISTER_CONTROL
1.2.840.113556.1.4.1413
 control: NONE

ldb: ldb_trace_request: SEARCH
 dn: rootDSE
 scope: base
 expr: (objectClass=*)
 attr: rootDomainNamingContext
 attr: configurationNamingContext
 attr: schemaNamingContext
 attr: defaultNamingContext
 control: NONE

ldb: ldb_trace_request: (tdb)-search
ldb_wrap open of /var/lib/samba/private/hklm.ldb
ldb: start ldb transaction (nesting: 0)
ldb: ldb_trace_request: (tdb)-start_transaction
ldb: start ldb transaction error: (null)
ldb: ldb_trace_request: ADD
dn: @ATTRIBUTES
changetype: add
key: CASE_INSENSITIVE
value: CASE_INSENSITIVE


 control: NONE

ldb: ldb_trace_request: (tdb)-add
ldb: ldb_trace_request: (tdb)-prepare_commit
ldb: commit ldb transaction (nesting: 0)
ldb: ldb_trace_request: (tdb)-end_transaction
ldb: ldb_trace_request: SEARCH
 dn: @MODULES
 scope: base
 expr: (@LIST=*)
 attr: @LIST
 control: NONE

ldb: ldb_trace_request: (tdb)-search
ldb: no modules required by the db
ldb: No modules specified for this database
ldb: ldb_trace_request: REGISTER_CONTROL
1.2.840.113556.1.4.1413
 control: NONE

ldb: ldb_trace_request: SEARCH
 dn: rootDSE
 scope: base
 expr: (objectClass=*)
 attr: rootDomainNamingContext
 attr: configurationNamingContext
 attr: schemaNamingContext
 attr: defaultNamingContext
 control: NONE

ldb: ldb_trace_request: (tdb)-search
ldb_wrap open of /var/lib/samba/private/hkcr.ldb
ldb: start ldb transaction (nesting: 0)
ldb: ldb_trace_request: (tdb)-start_transaction
ldb: start ldb transaction error: (null)
ldb: ldb_trace_request: ADD
dn: @ATTRIBUTES
changetype: add
key: CASE_INSENSITIVE
value: CASE_INSENSITIVE


 control: NONE

ldb: ldb_trace_request: (tdb)-add
ldb: ldb_trace_request: (tdb)-prepare_commit
ldb: commit ldb transaction (nesting: 0)
ldb: ldb_trace_request: (tdb)-end_transaction
ldb: ldb_trace_request: SEARCH
 dn: @MODULES
 scope: base
 expr: (@LIST=*)
 attr: @LIST
 control: NONE

ldb: ldb_trace_request: (tdb)-search
ldb: no modules required by the db
ldb: No modules specified for this database
ldb: ldb_trace_request: REGISTER_CONTROL
1.2.840.113556.1.4.1413
 control: NONE

ldb: ldb_trace_request: SEARCH
 dn: rootDSE
 scope: base
 expr: (objectClass=*)
 attr: rootDomainNamingContext
 attr: configurationNamingContext
 attr: schemaNamingContext
 attr: defaultNamingContext
 control: NONE

ldb: ldb_trace_request: (tdb)-search
ldb_wrap open of /var/lib/samba/private/hkcu.ldb
ldb: start ldb transaction (nesting: 0)
ldb: ldb_trace_request: (tdb)-start_transaction
ldb: start ldb transaction error: (null)
ldb: ldb_trace_request: ADD
dn: @ATTRIBUTES
changetype: add
key: CASE_INSENSITIVE
value: CASE_INSENSITIVE


 control: NONE

ldb: ldb_trace_request: (tdb)-add
ldb: ldb_trace_request: (tdb)-prepare_commit
ldb: commit ldb transaction (nesting: 0)
ldb: ldb_trace_request: (tdb)-end_transaction
ldb: ldb_trace_request: SEARCH
 dn: @MODULES
 scope: base
 expr: (@LIST=*)
 attr: @LIST
 control: NONE

ldb: ldb_trace_request: (tdb)-search
ldb: no modules required by the db
ldb: No modules specified for this database
ldb: ldb_trace_request: REGISTER_CONTROL
1.2.840.113556.1.4.1413
 control: NONE

ldb: ldb_trace_request: SEARCH
 dn: rootDSE
 scope: base
 expr: (objectClass=*)
 attr: 

Re: [Samba] regpatch writing to local registry hive with -F not working (registery-utils 4.0.0~alpha15~git20110124.dfsg1-2ubuntu1)

2011-05-14 Thread Michael Wood
On 14 May 2011 19:53, RiCH r...@richud.com wrote:
 Hi,

 I was hoping I could modify a locally mounted registry hive using
 regpatch and a .reg file but the -F argument seems to have no function.

Try this patch (untested, but based on what regtree does).  I haven't
looked at the other issues you mention, though.

 (Strace shows it ignores it and just operates
 on /var/lib/samba/private/hklm.ldb)
 Below is output with debug on.

 rfm6@ubuntuSSDx64:cp /mnt/xp/WINDOWS/system32/config/software /tmp/software
 rfm6@ubuntuSSDx64:/tmp/config$ sudo regpatch -d=10 -F software
 RunOnceSoftware.reg
 lpcfg_load: refreshing parameters from /etc/samba/smb.conf
 params.c:pm_process() - Processing configuration file
 /etc/samba/smb.conf
 Processing section [global]
 Unknown parameter encountered: max log size
 Ignoring unknown parameter max log size
 Unknown parameter encountered: syslog
 Ignoring unknown parameter syslog
 Unknown parameter encountered: passdb backend
 Ignoring unknown parameter passdb backend
 Unknown parameter encountered: unix password sync
 Ignoring unknown parameter unix password sync
 Unknown parameter encountered: passwd program
 Ignoring unknown parameter passwd program
 Unknown parameter encountered: pam password change
 Ignoring unknown parameter pam password change
 Unknown parameter encountered: map to guest
 Ignoring unknown parameter map to guest
 Unknown parameter encountered: usershare allow guests
 Ignoring unknown parameter usershare allow guests
 Processing section [printers]
 Unknown parameter encountered: guest ok
 Ignoring unknown parameter guest ok
 Processing section [print$]
 Unknown parameter encountered: guest ok
 Ignoring unknown parameter guest ok
 pm_process() returned Yes
 ldb: ldb_trace_request: SEARCH
  dn: @MODULES
  scope: base
  expr: (@LIST=*)
  attr: @LIST
  control: NONE

 ldb: ldb_trace_request: (tdb)-search
 ldb: no modules required by the db
 ldb: No modules specified for this database
 ldb: ldb_trace_request: REGISTER_CONTROL
 1.2.840.113556.1.4.1413
  control: NONE

 ldb: ldb_trace_request: SEARCH
  dn: rootDSE
  scope: base
  expr: (objectClass=*)
  attr: rootDomainNamingContext
  attr: configurationNamingContext
  attr: schemaNamingContext
  attr: defaultNamingContext
  control: NONE

 ldb: ldb_trace_request: (tdb)-search
 ldb_wrap open of /var/lib/samba/private/hklm.ldb
 ldb: start ldb transaction (nesting: 0)
 ldb: ldb_trace_request: (tdb)-start_transaction
 ldb: start ldb transaction error: (null)
 ldb: ldb_trace_request: ADD
 dn: @ATTRIBUTES
 changetype: add
 key: CASE_INSENSITIVE
 value: CASE_INSENSITIVE


  control: NONE

 ldb: ldb_trace_request: (tdb)-add
 ldb: ldb_trace_request: (tdb)-prepare_commit
 ldb: commit ldb transaction (nesting: 0)
 ldb: ldb_trace_request: (tdb)-end_transaction
 ldb: ldb_trace_request: SEARCH
  dn: @MODULES
  scope: base
  expr: (@LIST=*)
  attr: @LIST
  control: NONE

 ldb: ldb_trace_request: (tdb)-search
 ldb: no modules required by the db
 ldb: No modules specified for this database
 ldb: ldb_trace_request: REGISTER_CONTROL
 1.2.840.113556.1.4.1413
  control: NONE

 ldb: ldb_trace_request: SEARCH
  dn: rootDSE
  scope: base
  expr: (objectClass=*)
  attr: rootDomainNamingContext
  attr: configurationNamingContext
  attr: schemaNamingContext
  attr: defaultNamingContext
  control: NONE

 ldb: ldb_trace_request: (tdb)-search
 ldb_wrap open of /var/lib/samba/private/hkcr.ldb
 ldb: start ldb transaction (nesting: 0)
 ldb: ldb_trace_request: (tdb)-start_transaction
 ldb: start ldb transaction error: (null)
 ldb: ldb_trace_request: ADD
 dn: @ATTRIBUTES
 changetype: add
 key: CASE_INSENSITIVE
 value: CASE_INSENSITIVE


  control: NONE

 ldb: ldb_trace_request: (tdb)-add
 ldb: ldb_trace_request: (tdb)-prepare_commit
 ldb: commit ldb transaction (nesting: 0)
 ldb: ldb_trace_request: (tdb)-end_transaction
 ldb: ldb_trace_request: SEARCH
  dn: @MODULES
  scope: base
  expr: (@LIST=*)
  attr: @LIST
  control: NONE

 ldb: ldb_trace_request: (tdb)-search
 ldb: no modules required by the db
 ldb: No modules specified for this database
 ldb: ldb_trace_request: REGISTER_CONTROL
 1.2.840.113556.1.4.1413
  control: NONE

 ldb: ldb_trace_request: SEARCH
  dn: rootDSE
  scope: base
  expr: (objectClass=*)
  attr: rootDomainNamingContext
  attr: configurationNamingContext
  attr: schemaNamingContext
  attr: defaultNamingContext
  control: NONE

 ldb: ldb_trace_request: (tdb)-search
 ldb_wrap open of /var/lib/samba/private/hkcu.ldb
 ldb: start ldb transaction (nesting: 0)
 ldb: ldb_trace_request: (tdb)-start_transaction
 ldb: start ldb transaction error: (null)
 ldb: ldb_trace_request: ADD
 dn: @ATTRIBUTES
 changetype: add
 key: CASE_INSENSITIVE
 value: CASE_INSENSITIVE


  control: NONE

 ldb: ldb_trace_request: (tdb)-add
 ldb: ldb_trace_request: (tdb)-prepare_commit
 ldb: commit ldb transaction (nesting: 0)
 ldb: ldb_trace_request: (tdb)-end_transaction
 ldb: ldb_trace_request: SEARCH
  dn: @MODULES
  scope: base
  expr: (@LIST=*)
  attr: 

Re: [Samba] regpatch writing to local registry hive with -F not working (registery-utils 4.0.0~alpha15~git20110124.dfsg1-2ubuntu1)

2011-05-14 Thread Michael Wood
On 14 May 2011 22:09, Michael Wood esiot...@gmail.com wrote:
 On 14 May 2011 19:53, RiCH r...@richud.com wrote:
 Hi,

 I was hoping I could modify a locally mounted registry hive using
 regpatch and a .reg file but the -F argument seems to have no function.

 Try this patch (untested, but based on what regtree does).

Sorry, ignore that patch.  I was way too hasty.  There a bit more
needed and I missed that it was assigning to start_key instead of h.

-- 
Michael Wood esiot...@gmail.com
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] regpatch writing to local registry hive with -F not working (registery-utils 4.0.0~alpha15~git20110124.dfsg1-2ubuntu1)

2011-05-14 Thread Michael Wood
On 14 May 2011 22:09, Michael Wood esiot...@gmail.com wrote:
 On 14 May 2011 19:53, RiCH r...@richud.com wrote:
 Hi,

 I was hoping I could modify a locally mounted registry hive using
 regpatch and a .reg file but the -F argument seems to have no function.

 Try this patch (untested, but based on what regtree does).

I don't know if this does the right thing, but it does at least read
the specified file.

I've tried to test it on some arbitrary registry hive files and .reg
files I've managed to dig up or find online, but I'm not sure I'm
using regpatch properly.  I've either got errors like:

$ bin/regpatch -F /tmp/NTUSER.DAT /tmp/test.reg
Error adding new key 'HKEY_CURRENT_USER\Software\Microsoft\Internet
Explorer\Main': WERR_BADFILE
Error adding key HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main

or no output whatsoever and apparently no change to the hive.

I hope the patch helps, but I'm not sure that just using
start_key-context is the right thing to do.

-- 
Michael Wood esiot...@gmail.com
From 96ca078cb4fb218161a1a47edf751bef8a76845c Mon Sep 17 00:00:00 2001
From: Michael Wood esiot...@gmail.com
Date: Sat, 14 May 2011 22:04:37 +0200
Subject: [PATCH] regpatch: Don't ignore the -F option.

---
 source4/lib/registry/tools/regpatch.c |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/source4/lib/registry/tools/regpatch.c b/source4/lib/registry/tools/regpatch.c
index a8c1843..ebb5a69 100644
--- a/source4/lib/registry/tools/regpatch.c
+++ b/source4/lib/registry/tools/regpatch.c
@@ -32,6 +32,7 @@ int main(int argc, char **argv)
 	poptContext pc;
 	const char *patch;
 	struct registry_context *h;
+	struct registry_key *start_key = NULL;
 	const char *file = NULL;
 	const char *remote = NULL;
 	struct tevent_context *ev_ctx;
@@ -53,11 +54,13 @@ int main(int argc, char **argv)
 
 	if (remote) {
 		h = reg_common_open_remote (remote, ev_ctx, cmdline_lp_ctx, cmdline_credentials);
+	} else if (file != NULL) {
+		start_key = reg_common_open_file (file, ev_ctx, cmdline_lp_ctx, cmdline_credentials);
 	} else {
 		h = reg_common_open_local (cmdline_credentials, ev_ctx, cmdline_lp_ctx);
 	}
 
-	if (h == NULL)
+	if (h == NULL  start_key == NULL)
 		return 1;
 
 	patch = poptGetArg(pc);
@@ -68,6 +71,9 @@ int main(int argc, char **argv)
 
 	poptFreeContext(pc);
 
+if (start_key != NULL)
+h = start_key-context;
+
 	reg_diff_apply(h, patch);
 
 	return 0;
-- 
1.7.0

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba