From 90f730c3d49555e5c16106a7c8dd0219818edad6 Mon Sep 17 00:00:00 2001 From: Simon Smith Date: Thu, 1 Aug 2024 15:18:26 +0100 Subject: [PATCH] fix userID detect when the same local and domain user exist Signed-off-by: Simon Smith --- modules/win-registry.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/win-registry.js b/modules/win-registry.js index 72980d4..998b8bb 100644 --- a/modules/win-registry.js +++ b/modules/win-registry.js @@ -319,7 +319,7 @@ function windows_registry() var sid = user; if (typeof (user) == 'string') { - // Try to find the Session ID for the specified domain user + // Try to find the Session ID for the specified local user var r = this.QueryKey(this.HKEY.LocalMachine, 'SAM\\SAM\\Domains\\Account\\Users\\Names\\' + user); sid = r.default._type; } @@ -328,8 +328,11 @@ function windows_registry() { if(u.subkeys[i].endsWith('-' + sid)) { - // Try to find the Descriptor Key with the SID that we found - return (u.subkeys[i]); + if (this.QueryKey(this.HKEY.Users, u.subkeys[i] + '\\Volatile Environment', 'USERDOMAIN') == domain) + { + // Try to find the Descriptor Key with the SID that we found + return (u.subkeys[i]); + } } } }