Move mapping (section) objects into directory name space.
Vitaliy Margolen
wine-patch at kievinfo.com
Thu Dec 1 17:30:59 CST 2005
ChangeLog:
Move mapping (section) objects into directory name space.
dlls/kernel/virtual.c | 6 ++++--
dlls/ntdll/virtual.c | 2 ++
server/mapping.c | 23 ++++++++++++++++++-----
server/protocol.def | 2 ++
4 files changed, 26 insertions(+), 7 deletions(-)
-------------- next part --------------
031ad8a2e45978316e4c00b487cbfa27b2661c89
diff --git a/dlls/kernel/virtual.c b/dlls/kernel/virtual.c
index d3dee13..7cbca34 100644
--- a/dlls/kernel/virtual.c
+++ b/dlls/kernel/virtual.c
@@ -43,6 +43,8 @@
#include "excpt.h"
#include "wine/debug.h"
+#include "kernel_private.h"
+
WINE_DEFAULT_DEBUG_CHANNEL(virtual);
WINE_DECLARE_DEBUG_CHANNEL(seh);
@@ -307,7 +309,7 @@ HANDLE WINAPI CreateFileMappingW( HANDLE
LARGE_INTEGER size;
attr.Length = sizeof(attr);
- attr.RootDirectory = 0;
+ attr.RootDirectory = get_BaseNamedObjects_handle();
attr.ObjectName = NULL;
attr.Attributes = OBJ_CASE_INSENSITIVE | OBJ_OPENIF |
((sa && sa->bInheritHandle) ? OBJ_INHERIT : 0);
@@ -406,7 +408,7 @@ HANDLE WINAPI OpenFileMappingW( DWORD ac
return 0;
}
attr.Length = sizeof(attr);
- attr.RootDirectory = 0;
+ attr.RootDirectory = get_BaseNamedObjects_handle();
attr.ObjectName = &nameW;
attr.Attributes = OBJ_CASE_INSENSITIVE | (inherit ? OBJ_INHERIT : 0);
attr.SecurityDescriptor = NULL;
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 93392f5..fce9ca1 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1662,6 +1662,7 @@ NTSTATUS WINAPI NtCreateSection( HANDLE
{
req->access = access;
req->attributes = (attr) ? attr->Attributes : 0;
+ req->rootdir = (attr) ? attr->RootDirectory : 0;
req->file_handle = file;
req->size_high = size ? size->u.HighPart : 0;
req->size_low = size ? size->u.LowPart : 0;
@@ -1690,6 +1691,7 @@ NTSTATUS WINAPI NtOpenSection( HANDLE *h
{
req->access = access;
req->attributes = (attr) ? attr->Attributes : 0;
+ req->rootdir = (attr) ? attr->RootDirectory : 0;
wine_server_add_data( req, attr->ObjectName->Buffer, len );
if (!(ret = wine_server_call( req ))) *handle = reply->handle;
}
diff --git a/server/mapping.c b/server/mapping.c
index b6e99e4..cf87361 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -273,15 +273,16 @@ inline static int get_file_size( struct
return 1;
}
-static struct object *create_mapping( const struct unicode_str *name, unsigned int attr,
- file_pos_t size, int protect, obj_handle_t handle )
+static struct object *create_mapping( struct directory *root, const struct unicode_str *name,
+ unsigned int attr, file_pos_t size, int protect,
+ obj_handle_t handle )
{
struct mapping *mapping;
int access = 0;
if (!page_mask) init_page_size();
- if (!(mapping = create_named_object( sync_namespace, &mapping_ops, name, attr )))
+ if (!(mapping = create_named_object_dir( root, name, attr, &mapping_ops )))
return NULL;
if (get_error() == STATUS_OBJECT_NAME_EXISTS)
return &mapping->obj; /* Nothing else to do */
@@ -378,25 +379,37 @@ DECL_HANDLER(create_mapping)
{
struct object *obj;
struct unicode_str name;
+ struct directory *root = NULL;
file_pos_t size = ((file_pos_t)req->size_high << 32) | req->size_low;
reply->handle = 0;
get_req_unicode_str( &name );
- if ((obj = create_mapping( &name, req->attributes, size, req->protect, req->file_handle )))
+ if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 )))
+ return;
+
+ if ((obj = create_mapping( root, &name, req->attributes, size, req->protect, req->file_handle )))
{
reply->handle = alloc_handle( current->process, obj, req->access,
req->attributes & OBJ_INHERIT );
release_object( obj );
}
+
+ if (root) release_object( root );
}
/* open a handle to a mapping */
DECL_HANDLER(open_mapping)
{
struct unicode_str name;
+ struct directory *root = NULL;
get_req_unicode_str( &name );
- reply->handle = open_object( sync_namespace, &name, &mapping_ops, req->access, req->attributes );
+ if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 )))
+ return;
+
+ reply->handle = open_object_dir( root, &name, req->attributes, &mapping_ops, req->access );
+
+ if (root) release_object( root );
}
/* get a mapping information */
diff --git a/server/protocol.def b/server/protocol.def
index 934ae42..9343a6d 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -1043,6 +1043,7 @@ enum char_info_mode
@REQ(create_mapping)
unsigned int access; /* wanted access rights */
unsigned int attributes; /* object attributes */
+ obj_handle_t rootdir; /* root directory */
int size_high; /* mapping size */
int size_low; /* mapping size */
int protect; /* protection flags (see below) */
@@ -1066,6 +1067,7 @@ enum char_info_mode
@REQ(open_mapping)
unsigned int access; /* wanted access rights */
unsigned int attributes; /* object attributes */
+ obj_handle_t rootdir; /* root directory */
VARARG(name,unicode_str); /* object name */
@REPLY
obj_handle_t handle; /* handle to the mapping */
More information about the wine-patches
mailing list