summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2003-12-12 06:29:21 +0000
committerTim Potter <tpot@samba.org>2003-12-12 06:29:21 +0000
commit6fba6f5ca31d445661673fa656ef8eb3b481c371 (patch)
tree22358b8794bf0df2c026057210b07c987a565e78
parentd68d1558f7b6344a14774ce49ebc5da210a5b261 (diff)
downloadsamba-6fba6f5ca31d445661673fa656ef8eb3b481c371.tar.gz
samba-6fba6f5ca31d445661673fa656ef8eb3b481c371.tar.bz2
samba-6fba6f5ca31d445661673fa656ef8eb3b481c371.zip
Got winreg_EnumValue working - what a mess!
(This used to be commit cc494086e796c0090a92ac36012727c67e3587d1)
-rw-r--r--source4/librpc/idl/winreg.idl28
-rw-r--r--source4/torture/rpc/winreg.c78
2 files changed, 86 insertions, 20 deletions
diff --git a/source4/librpc/idl/winreg.idl b/source4/librpc/idl/winreg.idl
index 263946bdda..4fe4e6d414 100644
--- a/source4/librpc/idl/winreg.idl
+++ b/source4/librpc/idl/winreg.idl
@@ -114,16 +114,36 @@
[in,out] winreg_Time *last_changed_time
);
+ typedef struct {
+ uint32 max_len;
+ uint32 offset;
+ uint32 len;
+ uint16 buffer[len];
+ } winreg_Uint16buf;
+
+ typedef struct {
+ uint16 len;
+ uint16 max_len;
+ winreg_Uint16buf *buf;
+ } winreg_EnumValueName;
+
+ typedef struct {
+ uint32 max_len;
+ uint32 offset;
+ uint32 len;
+ uint8 buffer[len];
+ } winreg_Uint8buf;
+
/******************/
/* Function: 0x0a */
WERROR winreg_EnumValue(
[in,ref] policy_handle *handle,
[in] uint32 val_index,
- [in,out,ref] winreg_String *name,
+ [in,out,ref] winreg_EnumValueName *name,
[in,out] uint32 *type,
- [in,out] unistr *value,
- [in,out] uint32 *value1,
- [in,out] uint32 *value2
+ [in,out] winreg_Uint8buf *value,
+ [in,out] uint32 *requested_len,
+ [in,out] uint32 *returned_len
);
/******************/
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c
index 773240171d..4306714111 100644
--- a/source4/torture/rpc/winreg.c
+++ b/source4/torture/rpc/winreg.c
@@ -160,6 +160,8 @@ static BOOL test_QueryInfoKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return True;
}
+#if 0
+
static BOOL test_EnumValue(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle)
{
@@ -202,6 +204,8 @@ static BOOL test_EnumValue(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return True;
}
+#endif
+
static BOOL test_OpenHKLM(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle)
{
@@ -311,10 +315,15 @@ static BOOL test_OpenHKCU(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
static BOOL test_key(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle, int depth)
{
- struct winreg_EnumKey r;
+ struct winreg_EnumKey ek;
struct winreg_EnumKeyNameRequest keyname;
struct winreg_String classname;
struct winreg_Time tm;
+ struct winreg_EnumValue ev;
+ struct winreg_EnumValueName name;
+ struct winreg_Uint8buf value;
+ struct winreg_Uint16buf buf;
+ uint32 type, requested_len, returned_len;
NTSTATUS status;
if (depth == MAX_DEPTH)
@@ -326,30 +335,30 @@ static BOOL test_key(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
/* Enumerate keys */
- r.in.handle = handle;
- r.in.key_index = 0;
- r.in.key_name_len = r.out.key_name_len = 0;
- r.in.unknown = r.out.unknown = 0x0414;
+ ek.in.handle = handle;
+ ek.in.key_index = 0;
+ ek.in.key_name_len = ek.out.key_name_len = 0;
+ ek.in.unknown = ek.out.unknown = 0x0414;
keyname.unknown = 0x0000020a;
init_winreg_String(&keyname.key_name, NULL);
init_winreg_String(&classname, NULL);
- r.in.in_name = &keyname;
- r.in.class = &classname;
+ ek.in.in_name = &keyname;
+ ek.in.class = &classname;
tm.low = tm.high = 0x7fffffff;
- r.in.last_changed_time = &tm;
+ ek.in.last_changed_time = &tm;
do {
- status = dcerpc_winreg_EnumKey(p, mem_ctx, &r);
+ status = dcerpc_winreg_EnumKey(p, mem_ctx, &ek);
- if (NT_STATUS_IS_OK(status) && W_ERROR_IS_OK(r.out.result)) {
+ if (NT_STATUS_IS_OK(status) && W_ERROR_IS_OK(ek.out.result)) {
struct policy_handle key_handle;
if (!test_OpenKey(
- p, mem_ctx, handle, r.out.out_name->name,
+ p, mem_ctx, handle, ek.out.out_name->name,
&key_handle)) {
printf("OpenKey(%s) failed - %s\n",
- r.out.out_name->name,
- win_errstr(r.out.result));
+ ek.out.out_name->name,
+ win_errstr(ek.out.result));
goto next_key;
}
@@ -358,10 +367,47 @@ static BOOL test_key(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
next_key:
- r.in.key_index++;
+ ek.in.key_index++;
- } while (W_ERROR_IS_OK(r.out.result));
+ } while (W_ERROR_IS_OK(ek.out.result));
+
+ /* Enumerate values */
+ ev.in.handle = handle;
+ ev.in.val_index = 0;
+
+ buf.max_len = 0x7fff;
+ buf.offset = 0;
+ buf.len = 0;
+ buf.buffer = NULL;
+
+ name.len = 0;
+ name.max_len = buf.max_len * 2;
+ name.buf = &buf;
+
+ ev.in.name = ev.out.name = &name;
+
+ type = 0;
+ ev.in.type = &type;
+
+ value.max_len = 0xffff;
+ value.offset = 0;
+ value.len = 0;
+ value.buffer = NULL;
+
+ ev.in.value = &value;
+
+ requested_len = value.max_len;
+ ev.in.requested_len = &requested_len;
+ returned_len = 0;
+ ev.in.returned_len = &returned_len;
+
+ do {
+
+ status = dcerpc_winreg_EnumValue(p, mem_ctx, &ev);
+ ev.in.val_index++;
+ } while (W_ERROR_IS_OK(ev.out.result));
+
test_CloseKey(p, mem_ctx, handle);
return True;
@@ -389,7 +435,7 @@ static BOOL test_Open(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, void *fn)
}
if (!test_DeleteKey(p, mem_ctx, &handle, "spottyfoot")) {
- printf("FlushKey failed\n");
+ printf("DeleteKey failed\n");
return False;
}