summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-12-22 11:58:01 +0200
committermidipix <writeonce@midipix.org>2016-12-22 14:08:40 -0500
commit030926d2c8da32a09fefd9c5e9ea4478cd0d4780 (patch)
tree6aed6d03c81a50693315100e794a3c3504bf6831
parent7f8d50abe18471c5a79951ad13b63d1bc125c47e (diff)
downloadntapi-030926d2c8da32a09fefd9c5e9ea4478cd0d4780.tar.bz2
ntapi-030926d2c8da32a09fefd9c5e9ea4478cd0d4780.tar.xz
__ntapi_tt_statfs(), __ntapi_tt_istat(): added initial \Device\Mup support.
-rw-r--r--include/ntapi/nt_istat.h1
-rw-r--r--include/ntapi/nt_mount.h4
-rw-r--r--include/ntapi/nt_statfs.h1
-rw-r--r--src/fs/ntapi_tt_istat.c25
-rw-r--r--src/fs/ntapi_tt_statfs.c31
5 files changed, 49 insertions, 13 deletions
diff --git a/include/ntapi/nt_istat.h b/include/ntapi/nt_istat.h
index 7ad02a3..497dc72 100644
--- a/include/ntapi/nt_istat.h
+++ b/include/ntapi/nt_istat.h
@@ -9,6 +9,7 @@
#define NT_ISTAT_DEFAULT 0x00000000
#define NT_ISTAT_COMMON 0x00000001
#define NT_ISTAT_DEV_NAME_COPY 0x00000002
+#define NT_ISTAT_MUP_DEVICE 0x20000000
#define NT_ISTAT_NEW_HANDLE 0x80000000
typedef struct _nt_istat {
diff --git a/include/ntapi/nt_mount.h b/include/ntapi/nt_mount.h
index 0e0b979..e9b5dae 100644
--- a/include/ntapi/nt_mount.h
+++ b/include/ntapi/nt_mount.h
@@ -10,6 +10,10 @@
#define __DEVICE_PATH_PREFIX_LEN (8 * sizeof(wchar16_t))
#define __DEVICE_PATH_PREFIX_HASH (0xDA6FA40B)
+/* {'\\','D','e','v','i','c','e','\\','M','u','p','\\'} */
+#define __DEVICE_MUP_PREFIX_LEN (12 * sizeof(wchar16_t))
+#define __DEVICE_MUP_PREFIX_HASH (0x0CEBB5F6)
+
/* {'\\','?','?','\\','V','o','l','u','m','e','{'} */
#define __VOLUME_PATH_PREFIX_LEN (11 * sizeof(wchar16_t))
#define __VOLUME_PATH_PREFIX_HASH (0xFEBA8529)
diff --git a/include/ntapi/nt_statfs.h b/include/ntapi/nt_statfs.h
index b57b418..9bb5ce1 100644
--- a/include/ntapi/nt_statfs.h
+++ b/include/ntapi/nt_statfs.h
@@ -10,6 +10,7 @@
#define NT_STATFS_DEV_NAME_COPY (0x00000002)
#define NT_STATFS_VOLUME_GUID (0x00000004)
#define NT_STATFS_DOS_DRIVE_LETTER NT_STATFS_VOLUME_GUID
+#define NT_STATFS_MUP_DEVICE (0x20000000)
#define NT_STATFS_NEW_HANDLE (0x80000000)
diff --git a/src/fs/ntapi_tt_istat.c b/src/fs/ntapi_tt_istat.c
index bdfa09f..a42c8dd 100644
--- a/src/fs/ntapi_tt_istat.c
+++ b/src/fs/ntapi_tt_istat.c
@@ -28,13 +28,16 @@ int32_t __stdcall __ntapi_tt_istat(
nt_unicode_string * sdev;
wchar16_t * wch;
wchar16_t * wch_mark;
+ uint32_t hash;
/* validaton */
if (!hfile && !path)
return NT_STATUS_INVALID_HANDLE;
/* hfile */
- if (!hfile) {
+ if (hfile) {
+ istat->flags_out = 0;
+ } else {
/* oa */
oa.len = sizeof(nt_oa);
oa.root_dir = hroot;
@@ -104,15 +107,25 @@ int32_t __stdcall __ntapi_tt_istat(
|| (wch[7] != '\\'))
return NT_STATUS_INVALID_HANDLE;
- wch_mark = &wch[8];
- wch = wch_mark;
+ if ((sdev->strlen >= __DEVICE_MUP_PREFIX_LEN)
+ && (wch[8]=='M')
+ && (wch[9]=='u')
+ && (wch[10]=='p')
+ && (wch[11]=='\\')) {
+ istat->flags_out |= NT_STATFS_MUP_DEVICE;
+ wch_mark = &wch[12];
+ hash = __DEVICE_MUP_PREFIX_HASH;
+ } else {
+ wch_mark = &wch[8];
+ hash = __DEVICE_PATH_PREFIX_HASH;
+ }
- while (*wch != '\\')
- wch++;
+ for (wch=wch_mark; *wch!='\\'; wch++)
+ (void)0;
istat->dev_name_strlen = (uint16_t)((wch - sdev->buffer) * sizeof(uint16_t));
istat->dev_name_hash = __ntapi->tt_buffer_crc32(
- __DEVICE_PATH_PREFIX_HASH,
+ hash,
wch_mark,
(uintptr_t)wch - (uintptr_t)wch_mark);
diff --git a/src/fs/ntapi_tt_statfs.c b/src/fs/ntapi_tt_statfs.c
index b386c8b..8b2285a 100644
--- a/src/fs/ntapi_tt_statfs.c
+++ b/src/fs/ntapi_tt_statfs.c
@@ -26,6 +26,8 @@ int32_t __stdcall __ntapi_tt_statfs(
wchar16_t * wch;
wchar16_t * wch_mark;
uint32_t offset;
+ uint32_t fmup;
+ uint32_t hash;
void * mnt_points_buffer;
nt_mount_points * mnt_points;
nt_fsai * fsai;
@@ -38,7 +40,9 @@ int32_t __stdcall __ntapi_tt_statfs(
return NT_STATUS_INVALID_HANDLE;
/* hfile */
- if (!hfile) {
+ if (hfile) {
+ statfs->flags_out = 0;
+ } else {
/* oa */
oa.len = sizeof(nt_oa);
oa.root_dir = hroot;
@@ -151,17 +155,30 @@ int32_t __stdcall __ntapi_tt_statfs(
|| (wch[7] != '\\'))
return NT_STATUS_INVALID_HANDLE;
- wch_mark = &wch[8];
- wch = wch_mark;
+ if (sdev->strlen < __DEVICE_MUP_PREFIX_LEN)
+ fmup = 0;
+ else if ((wch[8]=='M') && (wch[9]=='u') && (wch[10]=='p') && (wch[11]=='\\'))
+ fmup = NT_STATFS_MUP_DEVICE;
+ else
+ fmup = 0;
+
+ if (fmup) {
+ wch_mark = &wch[8];
+ hash = __DEVICE_MUP_PREFIX_HASH;
+ flags &= ~NT_STATFS_VOLUME_GUID;
+ } else {
+ wch_mark = &wch[8];
+ hash = __DEVICE_PATH_PREFIX_HASH;
+ }
- while (*wch != '\\')
- wch++;
+ for (wch=wch_mark; *wch!='\\'; wch++)
+ (void)0;
statfs->dev_name_strlen = (uint16_t)((wch - sdev->buffer) * sizeof(uint16_t));
statfs->record_name_strlen = sdev->strlen - statfs->dev_name_strlen;
statfs->dev_name_hash = __ntapi->tt_buffer_crc32(
- __DEVICE_PATH_PREFIX_HASH,
+ hash,
wch_mark,
sizeof(wchar16_t) * (wch - wch_mark));
@@ -186,7 +203,7 @@ int32_t __stdcall __ntapi_tt_statfs(
/* f_flags, nt_attr, nt_control_flags (todo?) */
statfs->f_flags = 0;
statfs->nt_attr = 0;
- statfs->nt_control_flags = 0;
+ statfs->nt_control_flags = fmup;
statfs->nt_padding = 0;
if (!(flags & NT_STATFS_VOLUME_GUID)) {