From d1bbfc0d0e1348bf2faffb2c784bae3038435b71 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sun, 21 Mar 2004 03:05:45 +0000 Subject: [PATCH] find-netbios-optimize-20040320 In Mount_ReadSubmount() cache the first response to GetNetbiosName() since the result won't change and the work necessary to get the result is considerable. We don't want to be calling it loops over and over again. --- src/WINNT/client_config/drivemap.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/WINNT/client_config/drivemap.cpp b/src/WINNT/client_config/drivemap.cpp index 86fc0ae252..dffbd36d84 100644 --- a/src/WINNT/client_config/drivemap.cpp +++ b/src/WINNT/client_config/drivemap.cpp @@ -698,22 +698,27 @@ void AdjustAfsPath (LPTSTR pszTarget, LPCTSTR pszSource, BOOL fWantAFS, BOOL fWa BOOL GetDriveSubmount (TCHAR chDrive, LPTSTR pszSubmountNow) { - TCHAR szDrive[] = TEXT("*:"); + BOOL isWinNT = IsWindowsNT(); + + TCHAR szDrive[] = TEXT("*:"); szDrive[0] = chDrive; TCHAR szMapping[ _MAX_PATH ] = TEXT(""); - LPTSTR pszSubmount = szMapping; - TCHAR szNetBiosName[32]; - memset(szNetBiosName, '\0', sizeof(szNetBiosName)); - lana_GetNetbiosName(szNetBiosName, LANA_NETBIOS_NAME_FULL); - _tcscat(szNetBiosName, TEXT("\\")); - - if (IsWindowsNT()) - { - if (!QueryDosDevice (szDrive, szMapping, MAX_PATH)) + if (isWinNT && !QueryDosDevice (szDrive, szMapping, MAX_PATH)) return FALSE; + LPTSTR pszSubmount = szMapping; + + static TCHAR szNetBiosName[32] = ""; + if (szNetBiosName[0] == 0) { + memset(szNetBiosName, '\0', sizeof(szNetBiosName)); + lana_GetNetbiosName(szNetBiosName, LANA_NETBIOS_NAME_FULL); + _tcscat(szNetBiosName, TEXT("\\")); + } + + if (isWinNT) + { // Now if this is an AFS network drive mapping, {szMapping} will be: // // \Device\LanmanRedirector\:\\submount