summaryrefslogtreecommitdiffhomepage
path: root/src/ldso
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2017-01-18 02:15:45 -0500
committermidipix <writeonce@midipix.org>2017-01-18 02:15:45 -0500
commit9d2131a4dd7e9ba6e5e11becbfd8081a6fdcd15a (patch)
tree83a1519b48cfebd3e2e1d748f35103025e1f8e49 /src/ldso
parent6d58d975a6d69ffafe30f51ec83cccefbecd4883 (diff)
downloadpemagine-9d2131a4dd7e9ba6e5e11becbfd8081a6fdcd15a.tar.bz2
pemagine-9d2131a4dd7e9ba6e5e11becbfd8081a6fdcd15a.tar.xz
ldso: control inheritance and share access when opening image or parent dir.
Diffstat (limited to 'src/ldso')
-rw-r--r--src/ldso/pe_open_image_from_addr.c9
-rw-r--r--src/ldso/pe_open_physical_parent_directory.c9
2 files changed, 10 insertions, 8 deletions
diff --git a/src/ldso/pe_open_image_from_addr.c b/src/ldso/pe_open_image_from_addr.c
index 2729a18..810503c 100644
--- a/src/ldso/pe_open_image_from_addr.c
+++ b/src/ldso/pe_open_image_from_addr.c
@@ -19,7 +19,9 @@ pe_api int32_t pe_open_image_from_addr(
__in void * addr,
__out uintptr_t * buffer,
__in uint32_t buffer_size,
+ __in uint32_t oattr,
__in uint32_t desired_access,
+ __in uint32_t share_access,
__in uint32_t open_options)
{
int32_t status;
@@ -63,7 +65,7 @@ pe_api int32_t pe_open_image_from_addr(
oa.len = sizeof(struct os_oa);
oa.root_dir = 0;
oa.obj_name = &path->section_name;
- oa.obj_attr = 0;
+ oa.obj_attr = oattr;
oa.sec_desc = 0;
oa.sec_qos = 0;
@@ -76,8 +78,7 @@ pe_api int32_t pe_open_image_from_addr(
return zw_open_file(
himage,
desired_access,
- &oa,
- &iosb,
- OS_FILE_SHARE_READ | OS_FILE_SHARE_WRITE,
+ &oa,&iosb,
+ share_access,
open_options | OS_FILE_NON_DIRECTORY_FILE);
}
diff --git a/src/ldso/pe_open_physical_parent_directory.c b/src/ldso/pe_open_physical_parent_directory.c
index 7166df5..5f535a3 100644
--- a/src/ldso/pe_open_physical_parent_directory.c
+++ b/src/ldso/pe_open_physical_parent_directory.c
@@ -14,7 +14,9 @@ int32_t pe_open_physical_parent_directory(
__in void * href,
__out uintptr_t * buffer,
__in uint32_t buffer_size,
+ __in uint32_t oattr,
__in uint32_t desired_access,
+ __in uint32_t share_access,
__in uint32_t open_options)
{
int32_t status;
@@ -85,7 +87,7 @@ int32_t pe_open_physical_parent_directory(
oa.len = sizeof(struct os_oa);
oa.root_dir = 0;
oa.obj_name = path;
- oa.obj_attr = 0;
+ oa.obj_attr = oattr;
oa.sec_desc = 0;
oa.sec_qos = 0;
@@ -98,8 +100,7 @@ int32_t pe_open_physical_parent_directory(
return zw_open_file(
hparent,
desired_access,
- &oa,
- &iosb,
- OS_FILE_SHARE_READ | OS_FILE_SHARE_WRITE,
+ &oa,&iosb,
+ share_access,
open_options | OS_FILE_DIRECTORY_FILE);
}