From ae459e133dddafb54a7094b91fa6098382e13271 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Fri, 2 Jan 2004 03:55:35 +0000 Subject: [PATCH] Properly L2-encode the NetBIOS scope ID in DeviceIo_VNB, so ipconfig.exe and winipcfg.exe display it. --- dlls/kernel/device.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/dlls/kernel/device.c b/dlls/kernel/device.c index 17c9021e718..2ab7b14cfdc 100644 --- a/dlls/kernel/device.c +++ b/dlls/kernel/device.c @@ -957,12 +957,26 @@ static BOOL DeviceIo_VNB(DWORD dwIoControlCode, if (NO_ERROR == error) { info->nodeType = (WORD)fixedInfo->NodeType; - info->scopeLen = max(strlen(fixedInfo->ScopeId) + 1, - sizeof(info->scope) - 1); - memcpy(info->scope, fixedInfo->ScopeId, + info->scopeLen = min(strlen(fixedInfo->ScopeId) + 1, + sizeof(info->scope) - 2); + memcpy(info->scope + 1, fixedInfo->ScopeId, info->scopeLen); - info->scope[info->scopeLen] = '\0'; - /* FIXME: gotta L2-encode the scope ID */ + info->scope[info->scopeLen + 1] = '\0'; + { + /* convert into L2-encoded version */ + char *ptr, *lenPtr; + + for (ptr = info->scope + 1; *ptr && + ptr - info->scope < sizeof(info->scope); ) + { + for (lenPtr = ptr - 1, *lenPtr = 0; + *ptr && *ptr != '.' && + ptr - info->scope < sizeof(info->scope); + ptr++) + *lenPtr += 1; + ptr++; + } + } /* could set DNS servers here too, but since * ipconfig.exe and winipcfg.exe read these from the * registry, there's no point */