summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2022-10-15 17:18:13 +0000
committermidipix <writeonce@midipix.org>2022-10-15 17:54:27 +0000
commit94b7f5208ecea9895114265b525bcb1bffe6b497 (patch)
treefac2fc931f7bc770882cd70230524531335908fd
parent64e60696fd9cf2e8e672cebd1ed8b52b9b542606 (diff)
downloadntapi-94b7f5208ecea9895114265b525bcb1bffe6b497.tar.bz2
ntapi-94b7f5208ecea9895114265b525bcb1bffe6b497.tar.xz
__ntapi_tt_port_prefix_from_type(): initial implementation and integration.
-rw-r--r--include/ntapi/nt_port.h6
-rw-r--r--include/ntapi/ntapi.h1
-rw-r--r--src/internal/ntapi.c1
-rw-r--r--src/internal/ntapi_fnapi.h1
-rw-r--r--src/port/ntapi_port_name_helper.c23
5 files changed, 32 insertions, 0 deletions
diff --git a/include/ntapi/nt_port.h b/include/ntapi/nt_port.h
index ff1cdb9..8021768 100644
--- a/include/ntapi/nt_port.h
+++ b/include/ntapi/nt_port.h
@@ -339,6 +339,12 @@ typedef int32_t __stdcall ntapi_tt_port_type_from_guid(
__in const nt_guid * guid);
+typedef int32_t __stdcall ntapi_tt_port_prefix_from_type(
+ __out wchar16_t (*prefix)[6],
+ __in nt_port_type type,
+ __in nt_port_subtype subtype);
+
+
typedef int32_t __stdcall ntapi_tt_port_generate_keys(
__out nt_port_keys * keys);
diff --git a/include/ntapi/ntapi.h b/include/ntapi/ntapi.h
index 9fcb896..93970e4 100644
--- a/include/ntapi/ntapi.h
+++ b/include/ntapi/ntapi.h
@@ -550,6 +550,7 @@ typedef struct _ntapi_vtbl {
/* nt_port.h */
ntapi_tt_port_guid_from_type * tt_port_guid_from_type;
ntapi_tt_port_type_from_guid * tt_port_type_from_guid;
+ ntapi_tt_port_prefix_from_type * tt_port_prefix_from_type;
ntapi_tt_port_generate_keys * tt_port_generate_keys;
ntapi_tt_port_format_keys * tt_port_format_keys;
ntapi_tt_port_name_from_attr * tt_port_name_from_attr;
diff --git a/src/internal/ntapi.c b/src/internal/ntapi.c
index 51db364..4941400 100644
--- a/src/internal/ntapi.c
+++ b/src/internal/ntapi.c
@@ -386,6 +386,7 @@ static int32_t __fastcall __ntapi_init_once(ntapi_vtbl ** pvtbl)
__ntapi->csr_port_handle = __ntapi_csr_port_handle;
__ntapi->tt_port_guid_from_type = __ntapi_tt_port_guid_from_type;
__ntapi->tt_port_type_from_guid = __ntapi_tt_port_type_from_guid;
+ __ntapi->tt_port_prefix_from_type = __ntapi_tt_port_prefix_from_type;
__ntapi->tt_port_generate_keys = __ntapi_tt_port_generate_keys;
__ntapi->tt_port_format_keys = __ntapi_tt_port_format_keys;
__ntapi->tt_port_name_from_attr = __ntapi_tt_port_name_from_attr;
diff --git a/src/internal/ntapi_fnapi.h b/src/internal/ntapi_fnapi.h
index c41dc02..8e900ce 100644
--- a/src/internal/ntapi_fnapi.h
+++ b/src/internal/ntapi_fnapi.h
@@ -202,6 +202,7 @@ NTAPI_UFN(tt_wait_for_dummy_event);
/* nt_port.h */
NTAPI_UFN(tt_port_guid_from_type);
NTAPI_UFN(tt_port_type_from_guid);
+NTAPI_UFN(tt_port_prefix_from_type);
NTAPI_UFN(tt_port_generate_keys);
NTAPI_UFN(tt_port_format_keys);
NTAPI_UFN(tt_port_name_from_attr);
diff --git a/src/port/ntapi_port_name_helper.c b/src/port/ntapi_port_name_helper.c
index e28df8c..fe6a684 100644
--- a/src/port/ntapi_port_name_helper.c
+++ b/src/port/ntapi_port_name_helper.c
@@ -87,6 +87,29 @@ int32_t __stdcall __ntapi_tt_port_type_from_guid(
}
+int32_t __stdcall __ntapi_tt_port_prefix_from_type(
+ __out wchar16_t (*prefix)[6],
+ __in nt_port_type type,
+ __in nt_port_subtype subtype)
+{
+ const wchar16_t * svc_prefix;
+
+ if ((type >= NT_PORT_TYPE_CAP) || (subtype >= NT_PORT_SUBTYPE_CAP))
+ return NT_STATUS_INVALID_PARAMETER;
+
+ svc_prefix = __port_service_prefixes[type][subtype];
+
+ prefix[0][0] = svc_prefix[0];
+ prefix[0][1] = svc_prefix[1];
+ prefix[0][2] = svc_prefix[2];
+ prefix[0][3] = svc_prefix[3];
+ prefix[0][4] = svc_prefix[4];
+ prefix[0][5] = svc_prefix[5];
+
+ return NT_STATUS_SUCCESS;
+}
+
+
int32_t __stdcall __ntapi_tt_port_generate_keys(
__out nt_port_keys * keys)
{