Commit d7e85d66 authored by Alexandre Julliard's avatar Alexandre Julliard

Added registry support to the server.

parent fbb9a9fd
......@@ -9,6 +9,7 @@
#include <stdlib.h>
#include <time.h>
#include "windef.h"
/* Request structures */
......@@ -23,6 +24,9 @@
#define OUT /*nothing*/
/* a path name for server requests (Unicode) */
typedef WCHAR path_t[MAX_PATH+1];
/* Create a new process from the context of the parent */
struct new_process_request
{
......@@ -829,6 +833,138 @@ struct write_process_memory_request
};
/* Create a registry key */
struct create_key_request
{
IN int parent; /* handle to the parent key */
IN unsigned int access; /* desired access rights */
IN unsigned int options; /* creation options */
IN time_t modif; /* last modification time */
OUT int hkey; /* handle to the created key */
OUT int created; /* has it been newly created? */
IN path_t name; /* key name */
IN WCHAR class[1]; /* class name */
};
/* Open a registry key */
struct open_key_request
{
IN int parent; /* handle to the parent key */
IN unsigned int access; /* desired access rights */
OUT int hkey; /* handle to the open key */
IN path_t name; /* key name */
};
/* Delete a registry key */
struct delete_key_request
{
IN int hkey; /* handle to the parent key */
IN path_t name; /* key name */
};
/* Close a registry key */
struct close_key_request
{
IN int hkey; /* key to close */
};
/* Enumerate registry subkeys */
struct enum_key_request
{
IN int hkey; /* handle to registry key */
IN int index; /* index of subkey */
OUT time_t modif; /* last modification time */
OUT path_t name; /* subkey name */
OUT WCHAR class[1]; /* class name */
};
/* Query information about a registry key */
struct query_key_info_request
{
IN int hkey; /* handle to registry key */
OUT int subkeys; /* number of subkeys */
OUT int max_subkey; /* longest subkey name */
OUT int max_class; /* longest class name */
OUT int values; /* number of values */
OUT int max_value; /* longest value name */
OUT int max_data; /* longest value data */
OUT time_t modif; /* last modification time */
OUT WCHAR class[1]; /* class name */
};
/* Set a value of a registry key */
struct set_key_value_request
{
IN int hkey; /* handle to registry key */
IN int type; /* value type */
IN int len; /* value data len */
IN path_t name; /* value name */
IN unsigned char data[1]; /* value data */
};
/* Retrieve the value of a registry key */
struct get_key_value_request
{
IN int hkey; /* handle to registry key */
OUT int type; /* value type */
OUT int len; /* value data len */
IN WCHAR name[1]; /* value name */
OUT unsigned char data[1]; /* value data */
};
/* Enumerate a value of a registry key */
struct enum_key_value_request
{
IN int hkey; /* handle to registry key */
IN int index; /* value index */
OUT int type; /* value type */
OUT int len; /* value data len */
OUT path_t name; /* value name */
OUT unsigned char data[1]; /* value data */
};
/* Delete a value of a registry key */
struct delete_key_value_request
{
IN int hkey; /* handle to registry key */
IN path_t name; /* value name */
};
/* Load a registry branch from a file */
struct load_registry_request
{
IN int hkey; /* root key to load to */
IN int file; /* file to load from */
IN path_t name; /* subkey name */
};
/* Save a registry branch to a file */
struct save_registry_request
{
IN int hkey; /* key to save */
IN int file; /* file to save to */
};
/* Set the current and saving level for the registry */
struct set_registry_levels_request
{
IN int current; /* new current level */
IN int saving; /* new saving level */
};
/* Everything below this line is generated automatically by tools/make_requests */
/* ### make_requests begin ### */
......@@ -907,6 +1043,19 @@ enum request
REQ_DEBUG_PROCESS,
REQ_READ_PROCESS_MEMORY,
REQ_WRITE_PROCESS_MEMORY,
REQ_CREATE_KEY,
REQ_OPEN_KEY,
REQ_DELETE_KEY,
REQ_CLOSE_KEY,
REQ_ENUM_KEY,
REQ_QUERY_KEY_INFO,
REQ_SET_KEY_VALUE,
REQ_GET_KEY_VALUE,
REQ_ENUM_KEY_VALUE,
REQ_DELETE_KEY_VALUE,
REQ_LOAD_REGISTRY,
REQ_SAVE_REGISTRY,
REQ_SET_REGISTRY_LEVELS,
REQ_NB_REQUESTS
};
......
......@@ -19,10 +19,11 @@ C_SRCS = \
pipe.c \
process.c \
ptrace.c \
registry.c \
request.c \
snapshot.c \
select.c \
semaphore.c \
snapshot.c \
sock.c \
socket.c \
thread.c \
......
......@@ -29,6 +29,7 @@ int main( int argc, char *argv[] )
create_initial_thread( fd );
if (debug_level) fprintf( stderr, "Server: exiting (pid=%ld)\n", (long) getpid() );
close_registry();
#ifdef DEBUG_OBJECTS
dump_objects(); /* dump any remaining objects */
#endif
......
......@@ -55,6 +55,15 @@ void *mem_alloc( size_t size )
return ptr;
}
/* duplicate a block of memory */
void *memdup( const void *data, size_t len )
{
void *ptr = mem_alloc( len );
if (ptr) memcpy( ptr, data, len );
return ptr;
}
/*****************************************************************/
static int get_name_hash( const char *name, size_t len )
......
......@@ -66,7 +66,7 @@ struct object
};
extern void *mem_alloc( size_t size ); /* malloc wrapper */
extern char *mem_strdup( const char *str );
extern void *memdup( const void *data, size_t len );
extern void *alloc_object( const struct object_ops *ops );
extern const char *get_object_name( struct object *obj );
extern void *create_named_object( const struct object_ops *ops, const char *name, size_t len );
......@@ -163,6 +163,10 @@ extern void debug_exit_thread( struct thread *thread, int exit_code );
extern int get_page_size(void);
/* registry functions */
extern void close_registry(void);
extern int debug_level;
#endif /* __WINE_SERVER_OBJECT_H */
......@@ -58,6 +58,14 @@ static inline size_t get_req_strlen( const char *str )
return p - str;
}
/* same as above for Unicode */
static inline size_t get_req_strlenW( const WCHAR *str )
{
const WCHAR *p = str;
while (*p && ((char *)p < (char *)current->buffer + MAX_REQUEST_LENGTH - 2)) p++;
return p - str;
}
/* Everything below this line is generated automatically by tools/make_requests */
/* ### make_requests begin ### */
......@@ -134,6 +142,19 @@ DECL_HANDLER(continue_debug_event);
DECL_HANDLER(debug_process);
DECL_HANDLER(read_process_memory);
DECL_HANDLER(write_process_memory);
DECL_HANDLER(create_key);
DECL_HANDLER(open_key);
DECL_HANDLER(delete_key);
DECL_HANDLER(close_key);
DECL_HANDLER(enum_key);
DECL_HANDLER(query_key_info);
DECL_HANDLER(set_key_value);
DECL_HANDLER(get_key_value);
DECL_HANDLER(enum_key_value);
DECL_HANDLER(delete_key_value);
DECL_HANDLER(load_registry);
DECL_HANDLER(save_registry);
DECL_HANDLER(set_registry_levels);
#ifdef WANT_REQUEST_HANDLERS
......@@ -214,6 +235,19 @@ static const struct handler {
{ (void(*)())req_debug_process, sizeof(struct debug_process_request) },
{ (void(*)())req_read_process_memory, sizeof(struct read_process_memory_request) },
{ (void(*)())req_write_process_memory, sizeof(struct write_process_memory_request) },
{ (void(*)())req_create_key, sizeof(struct create_key_request) },
{ (void(*)())req_open_key, sizeof(struct open_key_request) },
{ (void(*)())req_delete_key, sizeof(struct delete_key_request) },
{ (void(*)())req_close_key, sizeof(struct close_key_request) },
{ (void(*)())req_enum_key, sizeof(struct enum_key_request) },
{ (void(*)())req_query_key_info, sizeof(struct query_key_info_request) },
{ (void(*)())req_set_key_value, sizeof(struct set_key_value_request) },
{ (void(*)())req_get_key_value, sizeof(struct get_key_value_request) },
{ (void(*)())req_enum_key_value, sizeof(struct enum_key_value_request) },
{ (void(*)())req_delete_key_value, sizeof(struct delete_key_value_request) },
{ (void(*)())req_load_registry, sizeof(struct load_registry_request) },
{ (void(*)())req_save_registry, sizeof(struct save_registry_request) },
{ (void(*)())req_set_registry_levels, sizeof(struct set_registry_levels_request) },
};
#endif /* WANT_REQUEST_HANDLERS */
......
/*
* Unicode routines for use inside the server
*
* Copyright (C) 1999 Alexandre Julliard
*/
#ifndef __WINE_SERVER_UNICODE_H
#define __WINE_SERVER_UNICODE_H
#ifndef __WINE_SERVER__
#error This file can only be used in the Wine server
#endif
#include "config.h"
#include <ctype.h>
#ifdef HAVE_WCTYPE_H
#include <wctype.h>
#endif
#include "windef.h"
static inline size_t strlenW( const WCHAR *str )
{
const WCHAR *s = str;
while (*s) s++;
return s - str;
}
static inline int strcmpW( const WCHAR *str1, const WCHAR *str2 )
{
while (*str1 && (*str1 == *str2)) { str1++; str2++; }
return *str1 - *str2;
}
static inline int strcmpiW( const WCHAR *str1, const WCHAR *str2 )
{
while (*str1 && (towupper(*str1) == towupper(*str2))) { str1++; str2++; }
return towupper(*str1) - towupper(*str2);
}
static inline WCHAR *strcpyW( WCHAR *src, const WCHAR *dst )
{
const WCHAR *ret = dst;
while ((*src++ = *dst++));
return (WCHAR *)ret;
}
static inline WCHAR *strdupW( const WCHAR *str )
{
size_t len = (strlenW(str) + 1) * sizeof(WCHAR);
return memdup( str, len );
}
#endif /* __WINE_SERVER_UNICODE_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment