summaryrefslogtreecommitdiffhomepage
path: root/src/fs
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-05-03 00:44:25 +0000
committermidipix <writeonce@midipix.org>2018-05-07 01:24:23 -0400
commit0e25b018afe1d358f8734205c2b42e1eb045ccb6 (patch)
tree6dff7fd60b574527e6d6ae6af2be2a063ddb92e6 /src/fs
parent6729c897b1b601679f019acfc3765b6a05ccacfd (diff)
downloadntapi-0e25b018afe1d358f8734205c2b42e1eb045ccb6.tar.bz2
ntapi-0e25b018afe1d358f8734205c2b42e1eb045ccb6.tar.xz
fs interfaces: ntapi_tt_open_volume_by_guid(): initial integration.
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/ntapi_tt_open_volume_by_guid.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/fs/ntapi_tt_open_volume_by_guid.c b/src/fs/ntapi_tt_open_volume_by_guid.c
new file mode 100644
index 0000000..4f6236c
--- /dev/null
+++ b/src/fs/ntapi_tt_open_volume_by_guid.c
@@ -0,0 +1,65 @@
+/********************************************************/
+/* ntapi: Native API core library */
+/* Copyright (C) 2013--2018 Z. Gilboa */
+/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */
+/********************************************************/
+
+#include <ntapi/ntapi.h>
+#include <ntapi/nt_file.h>
+#include "ntapi_impl.h"
+
+struct __ntapi_volume_name {
+ wchar16_t global[4];
+ wchar16_t volume[6];
+ nt_guid_str_utf16 guid;
+};
+
+int32_t __stdcall __ntapi_tt_open_volume_by_guid(
+ __out void ** hfile,
+ __in const nt_guid * guid,
+ __in uint32_t access,
+ __in nt_object_attributes * oaarg,
+ __out nt_io_status_block * iosb,
+ __in uint32_t share,
+ __in uint32_t options)
+{
+ struct __ntapi_volume_name name;
+ nt_unicode_string path;
+ nt_object_attributes oa;
+
+ if (!oaarg)
+ oaarg = &(nt_object_attributes){sizeof(*oaarg),0,0,0,0,0};
+
+ else if (oaarg->obj_name)
+ return NT_STATUS_INVALID_PARAMETER;
+
+ name.global[0] = '\\';
+ name.global[1] = '?';
+ name.global[2] = '?';
+ name.global[3] = '\\';
+
+ name.volume[0] = 'V';
+ name.volume[1] = 'o';
+ name.volume[2] = 'l';
+ name.volume[3] = 'u';
+ name.volume[4] = 'm';
+ name.volume[5] = 'e';
+
+ __ntapi->tt_guid_to_string_utf16(
+ guid,&name.guid);
+
+ path.strlen = sizeof(name);
+ path.maxlen = 0;
+ path.buffer = &name.global[0];
+
+ oa.len = oaarg->len;
+ oa.root_dir = oaarg->root_dir;
+ oa.obj_name = &path;
+ oa.obj_attr = oaarg->obj_attr;
+ oa.sec_desc = oaarg->sec_desc;
+ oa.sec_qos = oaarg->sec_qos;
+
+ return __ntapi->zw_open_file(
+ hfile,access,&oa,iosb,
+ share,options);
+}