mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
Implement DeleteKey, DeleteValue, FlushKey.
(This used to be commit 49f1654510
)
This commit is contained in:
parent
49c02c6634
commit
82d6f5587b
@ -7,6 +7,12 @@
|
||||
pointer_default(unique)
|
||||
] interface winreg
|
||||
{
|
||||
typedef struct {
|
||||
[value(2*strlen_m(r->name))] uint16 name_len;
|
||||
[value(r->name_len)] uint16 name_size;
|
||||
unistr_noterm *name;
|
||||
} winreg_String;
|
||||
|
||||
/******************/
|
||||
/* Function: 0x00 */
|
||||
NTSTATUS winreg_OpenHKCR(
|
||||
@ -54,11 +60,15 @@
|
||||
/******************/
|
||||
/* Function: 0x07 */
|
||||
NTSTATUS winreg_DeleteKey(
|
||||
[in,ref] policy_handle *handle,
|
||||
[in] winreg_String key
|
||||
);
|
||||
|
||||
/******************/
|
||||
/* Function: 0x08 */
|
||||
NTSTATUS winreg_DeleteValue(
|
||||
[in,ref] policy_handle *handle,
|
||||
[in] winreg_String value
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
@ -66,12 +76,6 @@
|
||||
uint32 high;
|
||||
} winreg_Time;
|
||||
|
||||
typedef struct {
|
||||
[value(2*strlen_m(r->name))] uint16 name_len;
|
||||
[value(r->name_len)] uint16 name_size;
|
||||
unistr_noterm *name;
|
||||
} winreg_String;
|
||||
|
||||
/******************/
|
||||
/* Function: 0x09 */
|
||||
NTSTATUS winreg_EnumKey(
|
||||
@ -85,6 +89,7 @@
|
||||
/******************/
|
||||
/* Function: 0x0b */
|
||||
NTSTATUS winreg_FlushKey(
|
||||
[in,ref] policy_handle *handle
|
||||
);
|
||||
|
||||
/******************/
|
||||
|
@ -21,6 +21,13 @@
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
static void init_winreg_String(struct winreg_String *name, const char *s)
|
||||
{
|
||||
name->name = s;
|
||||
name->name_len = 2*strlen_m(s);
|
||||
name->name_size = name->name_len;
|
||||
}
|
||||
|
||||
static BOOL test_GetVersion(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
||||
struct policy_handle *handle)
|
||||
{
|
||||
@ -61,6 +68,47 @@ static BOOL test_CloseKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
||||
return True;
|
||||
}
|
||||
|
||||
static BOOL test_FlushKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
||||
struct policy_handle *handle)
|
||||
{
|
||||
NTSTATUS status;
|
||||
struct winreg_FlushKey r;
|
||||
|
||||
printf("\ntesting FlushKey\n");
|
||||
|
||||
r.in.handle = handle;
|
||||
|
||||
status = dcerpc_winreg_FlushKey(p, mem_ctx, &r);
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
printf("FlushKey failed - %s\n", nt_errstr(status));
|
||||
return False;
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
static BOOL test_DeleteKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
||||
struct policy_handle *handle, char *key)
|
||||
{
|
||||
NTSTATUS status;
|
||||
struct winreg_DeleteKey r;
|
||||
|
||||
printf("\ntesting DeleteKey\n");
|
||||
|
||||
r.in.handle = handle;
|
||||
init_winreg_String(&r.in.key, key);
|
||||
|
||||
status = dcerpc_winreg_DeleteKey(p, mem_ctx, &r);
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
printf("DeleteKey failed - %s\n", nt_errstr(status));
|
||||
return False;
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
static BOOL test_OpenHKLM(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
NTSTATUS status;
|
||||
@ -88,6 +136,10 @@ static BOOL test_OpenHKLM(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
|
||||
ret = False;
|
||||
}
|
||||
|
||||
if (!test_DeleteKey(p, mem_ctx, &handle, "spottyfoot")) {
|
||||
ret = False;
|
||||
}
|
||||
|
||||
if (!test_CloseKey(p, mem_ctx, &handle)) {
|
||||
ret = False;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user