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.
This commit is contained in:
Jeffrey Altman 2004-03-21 03:05:45 +00:00 committed by Jeffrey Altman
parent e3b52b0bc6
commit d1bbfc0d0e

View File

@ -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\<Drive>:\<netbiosname>\submount