summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/ntapi/nt_file.h2
-rw-r--r--src/fs/ntapi_tt_open_physical_parent_directory.c14
2 files changed, 13 insertions, 3 deletions
diff --git a/include/ntapi/nt_file.h b/include/ntapi/nt_file.h
index cb27bdf..e1f3e1a 100644
--- a/include/ntapi/nt_file.h
+++ b/include/ntapi/nt_file.h
@@ -1206,7 +1206,7 @@ typedef int32_t __stdcall ntapi_tt_open_logical_parent_directory(
typedef int32_t __stdcall ntapi_tt_open_physical_parent_directory(
__out void ** hparent,
__in void * hdir,
- __out uintptr_t * buffer,
+ __out void * buffer,
__in uint32_t buffer_size,
__in uint32_t oattr,
__in uint32_t desired_access,
diff --git a/src/fs/ntapi_tt_open_physical_parent_directory.c b/src/fs/ntapi_tt_open_physical_parent_directory.c
index 77ae61d..3476113 100644
--- a/src/fs/ntapi_tt_open_physical_parent_directory.c
+++ b/src/fs/ntapi_tt_open_physical_parent_directory.c
@@ -11,7 +11,7 @@
int32_t __stdcall __ntapi_tt_open_physical_parent_directory(
__out void ** hparent,
__in void * hdir,
- __out uintptr_t * buffer,
+ __out void * buffer,
__in uint32_t buffer_size,
__in uint32_t oattr,
__in uint32_t desired_access,
@@ -27,10 +27,20 @@ int32_t __stdcall __ntapi_tt_open_physical_parent_directory(
nt_unicode_string * path;
uint32_t len;
int mup;
+ uintptr_t addr;
+ uintptr_t addr_cap;
(void)reserved;
- path = (nt_unicode_string *)buffer;
+ addr = (uintptr_t)buffer;
+ addr_cap = addr + buffer_size;
+
+ addr += 0xf;
+ addr |= 0xf;
+ addr ^= 0xf;
+
+ path = (nt_unicode_string *)addr;
+ buffer_size = addr_cap - addr;
if ((status = __ntapi->zw_query_object(
hdir,