From cb3f2e4c5e529e3f0fcacb542d3f17fd2830903e Mon Sep 17 00:00:00 2001
From: midipix <writeonce@midipix.org>
Date: Sun, 21 Aug 2016 14:17:08 -0400
Subject: __ntapi_tt_port_type_from_guid(): reimplement using
 __ntapi_tt_guid_compare().

---
 src/port/ntapi_port_name_helper.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

(limited to 'src')

diff --git a/src/port/ntapi_port_name_helper.c b/src/port/ntapi_port_name_helper.c
index bd55f5b..369cbd4 100644
--- a/src/port/ntapi_port_name_helper.c
+++ b/src/port/ntapi_port_name_helper.c
@@ -57,18 +57,12 @@ int32_t __stdcall __ntapi_tt_port_type_from_guid(
 {
 	int		itype;
 	int		isubtype;
-	const nt_guid *	src_guid;
-	uint32_t	guid_hash;
-	uint32_t	src_hash;
-
-	guid_hash = __ntapi->tt_buffer_crc32(0,guid,sizeof(nt_guid));
 
 	for (itype=0; itype<NT_PORT_TYPE_CAP; itype++) {
 		for (isubtype=0; isubtype<NT_PORT_SUBTYPE_CAP; isubtype++) {
-			src_guid = &(__port_guids[itype][isubtype]);
-			src_hash = __ntapi->tt_buffer_crc32(0,src_guid,sizeof(nt_guid));
-
-			if (guid_hash == src_hash) {
+			if (!(__ntapi_tt_guid_compare(
+					&__port_guids[itype][isubtype],
+					guid))) {
 				*type	 = (nt_port_type)itype;
 				*subtype = (nt_port_subtype)isubtype;
 
@@ -77,8 +71,7 @@ int32_t __stdcall __ntapi_tt_port_type_from_guid(
 		}
 	}
 
-	return NT_STATUS_INVALID_PARAMETER;
-
+	return NT_STATUS_NOT_FOUND;
 }
 
 
-- 
cgit v1.2.3