midipix / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

Blame ntapi.local.patch

Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
diff --git a/include/ntapi/nt_mount.h b/include/ntapi/nt_mount.h
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
index 8a7258a..cf2deac 100644
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
--- a/include/ntapi/nt_mount.h
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+++ b/include/ntapi/nt_mount.h
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
@@ -10,6 +10,10 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 #define __DEVICE_PATH_PREFIX_LEN	(8 * sizeof(wchar16_t))
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 #define __DEVICE_PATH_PREFIX_HASH	(0xDA6FA40B)
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+/* {'\\','D','e','v','i','c','e','\\',M','u','p','\\'} */
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+#define __DEVICE_MUP_PATH_PREFIX_LEN	(12 * sizeof(wchar16_t))
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+#define __DEVICE_MUP_PATH_PREFIX_HASH	(0x0CEBB5F6)
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 /* {'\\','?','?','\\','V','o','l','u','m','e','{'} */
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 #define __VOLUME_PATH_PREFIX_LEN	(11 * sizeof(wchar16_t))
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 #define __VOLUME_PATH_PREFIX_HASH	(0xFEBA8529)
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
diff --git a/src/fs/ntapi_tt_statfs.c b/src/fs/ntapi_tt_statfs.c
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
index 114cc8e..8bc43e2 100644
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
--- a/src/fs/ntapi_tt_statfs.c
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+++ b/src/fs/ntapi_tt_statfs.c
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
@@ -23,7 +23,7 @@ int32_t __stdcall __ntapi_tt_statfs(
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 	nt_oa			oa;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 	nt_iosb			iosb;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 	nt_unicode_string *	sdev;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
-	uint32_t		hash;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+	uint32_t		hash,hash_mup;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 	wchar16_t *		wch;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 	wchar16_t *		wch_mark;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 	uint32_t		offset;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
@@ -156,6 +156,14 @@ int32_t __stdcall __ntapi_tt_statfs(
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 	if (hash != __DEVICE_PATH_PREFIX_HASH)
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 		return NT_STATUS_INVALID_HANDLE;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+	hash_mup = __ntapi->tt_buffer_crc32(
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+			0,
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+			sdev->buffer,
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+			__DEVICE_MUP_PATH_PREFIX_LEN);
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+	if (hash_mup == __DEVICE_MUP_PATH_PREFIX_HASH)
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+		sdev->buffer[__DEVICE_MUP_PATH_PREFIX_LEN - 1] = 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 	wch_mark = sdev->buffer + __DEVICE_PATH_PREFIX_LEN/sizeof(wchar16_t);
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 	wch = wch_mark;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 	while (*wch != '\\') wch++;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
@@ -190,6 +198,9 @@ int32_t __stdcall __ntapi_tt_statfs(
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 	statfs->nt_control_flags = 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 	statfs->nt_padding = 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+	if (hash_mup == __DEVICE_MUP_PATH_PREFIX_HASH)
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+		return NT_STATUS_SUCCESS;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 	if (!(flags & NT_STATFS_VOLUME_GUID)) {
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 		statfs->nt_drive_letter = 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 		pguid = (uint64_t *)&(statfs->nt_volume_guid);
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
diff --git a/src/fs/ntapi_tt_open_physical_parent_directory.c b/src/fs/ntapi_tt_open_physical_parent_directory.c
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
index 68d282b..742607d 100644
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
--- a/src/fs/ntapi_tt_open_physical_parent_directory.c
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+++ b/src/fs/ntapi_tt_open_physical_parent_directory.c
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
@@ -37,6 +37,9 @@ int32_t __stdcall __ntapi_tt_open_physical_parent_directory(
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 		return NT_STATUS_BAD_FILE_TYPE;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 	wch = path->buffer + (path->strlen / sizeof(uint16_t));
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+	if ((&wch[-1] >= path->buffer) && (wch[-1] == '\\') &&
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+			(&wch[-2] >= path->buffer))
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
+		wch = &wch[-1];
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 	while ((--wch >= path->buffer) && (*wch != '\\'));
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
 	if (wch == path->buffer )