On Tue, 2007-12-11 at 21:02 +0100, David Eriksson wrote:
> On Tue, 2007-12-11 at 17:28 +0000, Mark Ellis wrote:
> > On Tue, 2007-12-11 at 11:16 +0100, Guido Diepen wrote:
> > > >
> > > > Me too. I'm going to, hopefully today, go through all the rapi1 registry
> > > > calls and see exactly what works.
> > > 
> > > I was thinking, you could see if the problem lays only in the InfoKey, or
> > > also in the EnumValue. The only reason I call the InfoKey is that I want
> > > to know what sizes for the buffers I need to reserve.
> > > 
> > 
> > I'm getting there, InfoKey now works. There were a few problems, but the
> > killer was the implementation trying to GetLastError, which isn't
> > provided by this function, who knows why. This of course meant the
> > buffer position was 4 bytes too far in.
> > 
> > Unfortunately, EnumValue still doesn't work.
> 
> I think that the correct solution is to not read the reserved value,
> i.e. removing this line from both functions:

Seems to be working ok with this still in, but I have actually supplied
a non-NULL location in my testing, hope it doesn't break later.

> rapi_buffer_read_optional_uint32(context->recv_buffer, lpReserved);
> 
> Otherwise, they should be implemented just fine. Here are my specs. "No
> data" means that the value should not be sent. "Data" means that the
> value should be sent. (Controls parameter to rapi_buffer_write_optional*
> functions.)
> 
> 
> RegQueryInfoKey:
> 
> Request
> 
> 4 bytes  HKEY hKey 
> *lpcbClass bytes optional  LPWSTR lpClass 
> 4 bytes optional data LPDWORD lpcbClass, 
> 4 bytes optional no data LPDWORD lpReserved, 
> 4 bytes optional no data LPDWORD lpcSubKeys, 
> 4 bytes optional no data LPDWORD lpcbMaxSubKeyLen, 
> 4 bytes optional no data LPDWORD lpcbMaxClassLen, 
> 4 bytes optional no data LPDWORD lpcValues, 
> 4 bytes optional no data LPDWORD lpcbMaxValueNameLen, 
> 4 bytes optional no data LPDWORD lpcbMaxValueLen, 
> 4 bytes optional no data LPDWORD lpcbSecurityDescriptor, 
> 8 bytes optional no data PFILETIME lpftLastWriteTime 
> 

This was all fine.

> Response
> 
> *lpcbClass bytes optional  LPWSTR lpClass 
> 4 bytes optional data LPDWORD lpcbClass, 
> ignoring LPDWORD lpReserved, 
> 4 bytes optional LPDWORD lpcSubKeys, 
> 4 bytes optional LPDWORD lpcbMaxSubKeyLen, 
> 4 bytes optional LPDWORD lpcbMaxClassLen, 
> 4 bytes optional LPDWORD lpcValues, 
> 4 bytes optional LPDWORD lpcbMaxValueNameLen, 
> 4 bytes optional LPDWORD lpcbMaxValueLen, 
> 4 bytes optional LPDWORD lpcbSecurityDescriptor, 
> 8 bytes optional PFILETIME lpftLastWriteTime 
> 

Had to take out the aforementioned read of last_error. Also had to swap
lpClass and lpcbClass, ie read the size first, perfectly logical but
breaks the parameter passing order, bizarre. Do you think when M$
assigns these things for someone to spec, it explicitly states "make it
as awkward as possible".

> 
> RegEnumValue
> 
> 4 bytes  HKEY hKey, 
> 4 bytes  DWORD dwIndex, 
> *lpcbValueName bytes optional no data  LPWSTR lpszValueName, 
> 4 bytes optional data LPDWORD lpcbValueName, 
> 4 bytes optional no data LPDWORD lpReserved, 
> 4 bytes optional no data LPDWORD lpType, 
> *lpcbData bytes optional no data  LPBYTE lpData, 
> 4 bytes optional data LPDWORD lpcbData 
> 
> Response
> 
> 4 bytes last error
> 4 bytes return value
> *lpcbValueName bytes optional  LPWSTR lpszValueName, 
> 4 bytes optional  LPDWORD lpcbValueName, 
> ignoring  LPDWORD lpReserved, 
> 4 bytes optional  LPDWORD lpType, 
> *lpcbData bytes optional  LPBYTE lpData, 
> 4 bytes optional  LPDWORD lpcbData 
> 
> 

Had to remove the last_error read again, still testing.

> > 
> > David, after my first experience of reverse engineering in rapi, I'm
> > humbled by the effort it must have taken to get librapi to the point
> > it's at, hats off to you.
> 
> Hey, the reverse engineering is the fun part! :-)
> 
> 

Analyzing the returns can be quite fun, randomly guessing what to send
can become slightly more frustrating :)

Mark


-------------------------------------------------------------------------
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
SynCE-Devel mailing list
SynCE-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synce-devel

Reply via email to