Example #1
0
BOOL GetNetConfig::GetStringFromRegistry(
	BOOL Is64KeyRequired,
    HKEY hRootKey,
    LPCSTR lpszPath,
    LPCSTR lpszKeyName,
    LPBYTE lpszValue,
    DWORD dwSize
	)
{
    REGSAM samDesired = KEY_READ;
    HKEY hKey;

    /* Check Win2000 (KEY_WOW64_64KEY - not supported) */
    if (!IsWindows2000() && Is64KeyRequired)
    {
        samDesired |= KEY_WOW64_64KEY;
    }

	LONG lResult;

	lResult = RegOpenKeyEx(hRootKey, lpszPath, 0, samDesired, &hKey);
    if (lResult != ERROR_SUCCESS)
    {
		PrintWinAPI_error(lResult);
		return FALSE;
	}

	lResult = RegQueryValueEx(hKey, lpszKeyName, NULL, NULL, lpszValue, &dwSize);
    if (lResult != ERROR_SUCCESS)
    {
		PrintWinAPI_error(lResult);
        RegCloseKey(hKey);
		return FALSE;
	}
    RegCloseKey(hKey);
    return TRUE;
}
Example #2
0
bool
CNdasServiceDeviceEventHandler::
Initialize(HANDLE hRecipient, DWORD dwReceptionFlag)
{
	m_hRecipient = hRecipient;
	m_dwReceptionFlags = dwReceptionFlag;
	//
	// Caution!
	//
	// DEVICE_NOFITY_WINDOW_HANDLE is 0x000, hence
	// XTLASSERT(DEVICE_NOFITY_WINDOW_HANDLE & m_dwReceptionFlags)
	// will always fail.
	//
	XTLASSERT(
		((DEVICE_NOTIFY_SERVICE_HANDLE & m_dwReceptionFlags) == DEVICE_NOTIFY_SERVICE_HANDLE) ||
		((DEVICE_NOTIFY_WINDOW_HANDLE & m_dwReceptionFlags) == DEVICE_NOTIFY_WINDOW_HANDLE));

	//
	// Do not initialize twice if successful.
	//
	XTLASSERT(!m_bInitialized);

	pEnumerateNdasStoragePorts();

	//
	// register Storage Port, Volume and Disk device notification
	//

	m_hStoragePortNotify = RegisterDeviceInterfaceNotification(&GUID_DEVINTERFACE_STORAGEPORT);
	if (m_hStoragePortNotify.IsInvalid()) 
	{
		XTLTRACE2(NDASSVC_PNP, TRACE_LEVEL_ERROR, 
			"Registering Storage Port Device Notification failed, error=0x%X\n", GetLastError());
	}

	m_hVolumeNotify = RegisterDeviceInterfaceNotification(&GUID_DEVINTERFACE_VOLUME);
	if (m_hVolumeNotify.IsInvalid()) 
	{
		XTLTRACE2(NDASSVC_PNP, TRACE_LEVEL_ERROR, 
			"Registering Volume Device Notification failed, error=0x%X\n", GetLastError());
	}

	m_hDiskNotify = RegisterDeviceInterfaceNotification(&GUID_DEVINTERFACE_DISK);

	if (m_hDiskNotify.IsInvalid()) 
	{
		XTLTRACE2(NDASSVC_PNP, TRACE_LEVEL_ERROR, 
			"Registering Disk Device Notification failed, error=0x%X\n", GetLastError());
	}

	m_hCdRomClassNotify = RegisterDeviceInterfaceNotification(&GUID_DEVINTERFACE_CDROM);

	if (m_hCdRomClassNotify.IsInvalid()) 
	{
		XTLTRACE2(NDASSVC_PNP, TRACE_LEVEL_ERROR, 
			"Registering CDROM Device Notification failed, error=0x%X\n", GetLastError());
	}

	XTLTRACE2(NDASSVC_PNP, TRACE_LEVEL_INFORMATION, "Storage Port Notify Handle: %p\n", m_hStoragePortNotify);
	XTLTRACE2(NDASSVC_PNP, TRACE_LEVEL_INFORMATION, "Volume Notify Handle      : %p\n", m_hVolumeNotify);
	XTLTRACE2(NDASSVC_PNP, TRACE_LEVEL_INFORMATION, "Disk Device Notify Handle : %p\n", m_hDiskNotify);
	XTLTRACE2(NDASSVC_PNP, TRACE_LEVEL_INFORMATION, "CDROM Device Notify Handle : %p\n", m_hCdRomClassNotify);

	//
	// nothing more for Windows XP or later
	//

	//
	// If NoLfs is set and if the OS is Windows 2000, 
	// load ROFilter service
	//
	if (!(IsWindows2000() && m_bNoLfs)) 
	{
		m_bInitialized = TRUE;
		return TRUE;
	}

	XTLASSERT(m_hROFilter.IsInvalid());

	//
	// Even if the rofilter is not loaded
	// initialization returns TRUE
	// However, m_hROFilter has INVALID_HANDLE_VALUE
	//

	m_bInitialized = TRUE;

	SERVICE_STATUS serviceStatus;
	BOOL fSuccess = NdasRoFilterQueryServiceStatus(&serviceStatus);
	if (!fSuccess) 
	{
		XTLTRACE2(NDASSVC_PNP, TRACE_LEVEL_ERROR, 
			"NdasRoFilterQueryServiceStatus failed, error=0x%X\n", GetLastError());
		return TRUE;
	}

	if (SERVICE_RUNNING != serviceStatus.dwCurrentState) 
	{
		fSuccess = NdasRoFilterStartService();
		if (!fSuccess) 
		{
			XTLTRACE2(NDASSVC_PNP, TRACE_LEVEL_ERROR, 
				"NdasRoFilterStartService failed, error=0x%X\n", GetLastError());
			return TRUE;
		}
	}

	HANDLE hROFilter = NdasRoFilterOpenDevice();
	if (INVALID_HANDLE_VALUE == hROFilter) 
	{
		XTLTRACE2(NDASSVC_PNP, TRACE_LEVEL_ERROR, 
			"NdasRoFilterCreate failed, error=0x%X\n", GetLastError());
		return TRUE;
	}

	m_hROFilter = hROFilter;

	return TRUE;
}
Example #3
0
/*! 
  \brief Opens the wan (dialup, vpn...) adapter.
  \return If the function succeeds, the return value is the pointer to a properly initialized WAN_ADAPTER structure,
   otherwise the return value is NULL.
*/
PWAN_ADAPTER WanPacketOpenAdapter()
{
	PWAN_ADAPTER pWanAdapter = NULL;
	PBLOB_TABLE pBlobTable = NULL;
	HBLOB hFilterBlob = NULL;
	HRESULT hResult;
	DWORD i;

	if ( g_hModule == NULL)
	{
		g_hModule = LoadLibrary("npp\\ndisnpp.dll");
	}

	if ( g_hModule == NULL)
	{
		return NULL;
	}

	hResult = CoInitialize(NULL);

	//
 	// if  the calling thread has already initialized COM with a 
 	// different threading model, we have this error
 	// however, we are able to support another threading model,
 	// so we try to initialize COM with another threading model.
 	// This new call should succeed with S_FALSE.
 	//
 	if (hResult == RPC_E_CHANGED_MODE)
	{
		hResult = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
	
		//MULTITHREADED threading is only supported on Windows 2000
		if (hResult == RPC_E_CHANGED_MODE && IsWindows2000())
		{
			hResult = CoInitializeEx(NULL, COINIT_MULTITHREADED);
		}
	}

	if (hResult != S_OK && hResult != S_FALSE)
		return NULL;

	pWanAdapter = (PWAN_ADAPTER)GlobalAlloc(GPTR, sizeof (WAN_ADAPTER));

	if ( pWanAdapter == NULL )
		goto error;
	
	memset(pWanAdapter, 0, sizeof(WAN_ADAPTER));
	
	if ( CreateBlob(&hFilterBlob) != NMERR_SUCCESS )
	{
		goto error;
	}
	
	if ( SetBoolInBlob(hFilterBlob, OWNER_NPP, CATEGORY_CONFIG, TAG_INTERFACE_REALTIME_CAPTURE, TRUE) != NMERR_SUCCESS )
	{
		DestroyBlob( hFilterBlob);
		goto error;
	}

	if ( SetBoolInBlob(hFilterBlob, OWNER_NPP, CATEGORY_LOCATION, TAG_RAS, TRUE) != NMERR_SUCCESS )
	{
		DestroyBlob( hFilterBlob);
		goto error;
	}

	if ( GetNPPBlobTable(hFilterBlob, &pBlobTable) != NMERR_SUCCESS )
	{
		DestroyBlob( hFilterBlob);
		goto error;
	}

	DestroyBlob (hFilterBlob);

	if ( pBlobTable->dwNumBlobs == 0 || pBlobTable->dwNumBlobs > 1)
	{
		///fixme.....
		for ( i = 0 ; i < pBlobTable->dwNumBlobs ; i++ )
			DestroyBlob(pBlobTable->hBlobs[i]);
		
		GlobalFree(pBlobTable);
		goto error;
	}

	pWanAdapter->hCaptureBlob = pBlobTable->hBlobs[0];

	GlobalFree(pBlobTable);

	InitializeCriticalSection(&pWanAdapter->CriticalSection);

	pWanAdapter->hReadEvent = CreateEvent(NULL, TRUE, FALSE, NULL);

	if ( pWanAdapter->hReadEvent == NULL )
		goto error;

	pWanAdapter->MemEx.buffer = (PUCHAR)GlobalAlloc(GPTR, DEFAULT_MEM_EX_SIZE);
	if (pWanAdapter->MemEx.buffer == NULL)
		goto error;
	
	pWanAdapter->MemEx.size = DEFAULT_MEM_EX_SIZE;
	pWanAdapter->Tme.active = TME_NONE_ACTIVE;

	if (CreateNPPInterface(pWanAdapter->hCaptureBlob, IID_IRTC, (void**) &pWanAdapter->pIRTC) == NMERR_SUCCESS && pWanAdapter->pIRTC != NULL) 
	{
		//create OK
		if (pWanAdapter->pIRTC->Connect(pWanAdapter->hCaptureBlob, NULL, WanPacketReceiverCallback, (LPVOID)pWanAdapter , NULL) == NMERR_SUCCESS)
		{
			//connect OK
			if (pWanAdapter->pIRTC->Start() == NMERR_SUCCESS)
			{
				return pWanAdapter;
			}
			else
			{
				pWanAdapter->pIRTC->Disconnect();
				pWanAdapter->pIRTC->Release();
				goto error;
			}
		}
		else
		{
			pWanAdapter->pIRTC->Release();
			goto error;
		}
	}
	else
	{
		goto error;
	}

	//awfully never reached
//	return NULL;

error:

	if (pWanAdapter != NULL)
	{
		if (pWanAdapter->hReadEvent != NULL)
			CloseHandle(pWanAdapter->hReadEvent);

		DeleteCriticalSection(&pWanAdapter->CriticalSection);
		if (pWanAdapter->hCaptureBlob)
			DestroyBlob(pWanAdapter->hCaptureBlob);

		GlobalFree(pWanAdapter);
	}

	CoUninitialize();
	
	return NULL;
}
Example #4
0
/*! 
  \brief Tries to open the wan (dialup, vpn...) adapter, and immediately closes it.
  \return TRUE on success.
*/
BOOLEAN WanPacketTestAdapter()
{
	PBLOB_TABLE pBlobTable = NULL;
	HBLOB hFilterBlob = NULL;
	BOOLEAN retVal;
	DWORD i;
	HRESULT hResult;

	if ( g_hModule == NULL)
	{
		g_hModule = LoadLibrary("npp\\ndisnpp.dll");
	}

	if ( g_hModule == NULL)
	{
		return FALSE;
	}

	hResult = CoInitialize(NULL);

	//
 	// if  the calling thread has already initialized COM with a 
 	// different threading model, we have this error
 	// however, we are able to support another threading model,
 	// so we try to initialize COM with another threading model.
 	// This new call should succeed with S_FALSE.
 	//
 	if (hResult == RPC_E_CHANGED_MODE)
	{
		hResult = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
	
		//MULTITHREADED threading is only supported on Windows 2000
		if (hResult == RPC_E_CHANGED_MODE && IsWindows2000())
		{
			hResult = CoInitializeEx(NULL, COINIT_MULTITHREADED);
		}
	}

	if (hResult != S_OK && hResult != S_FALSE)
		return FALSE;

	if ( CreateBlob(&hFilterBlob) != NMERR_SUCCESS )
	{
		CoUninitialize();
		return FALSE;
	}
	
	if ( SetBoolInBlob(hFilterBlob, OWNER_NPP, CATEGORY_CONFIG, TAG_INTERFACE_REALTIME_CAPTURE, TRUE) != NMERR_SUCCESS )
	{
		DestroyBlob( hFilterBlob);
		CoUninitialize();
		return FALSE;
	}

	if ( SetBoolInBlob(hFilterBlob, OWNER_NPP, CATEGORY_LOCATION, TAG_RAS, TRUE) != NMERR_SUCCESS )
	{
		DestroyBlob( hFilterBlob);
		CoUninitialize();
		return FALSE;
	}

	if ( GetNPPBlobTable(hFilterBlob, &pBlobTable) != NMERR_SUCCESS )
	{
		DestroyBlob( hFilterBlob);
		CoUninitialize();
		return FALSE;
	}

	DestroyBlob (hFilterBlob);

	if (pBlobTable->dwNumBlobs == 1)
		retVal = TRUE;
	else
		retVal = FALSE;

	for ( i = 0 ; i < pBlobTable->dwNumBlobs ; i++ )
		DestroyBlob(pBlobTable->hBlobs[i]);
		
	GlobalFree(pBlobTable);	
	CoUninitialize();
			
	return retVal;
}
Example #5
0
CString GetOS()
{
	CString Response;
	OS_VERSION_INFO osvi;
	char sText[512]="";
	char sBuf[100]="";
	ZeroMemory(&osvi,sizeof(OS_VERSION_INFO));
	
	_stprintf(sText, _T("\nOperating System\n"));
	if (GetOSVersion(&osvi)) {                                           
//		_stprintf(sText, _T("Emulated OS: "));
		
		switch (osvi.dwEmulatedPlatformId) {
		case PLATFORM_DOS:               
			{
				_stprintf(sBuf, _T("Dos"));
				break;
			}
		case PLATFORM_WINDOWS31:         
			{
				_stprintf(sBuf, _T("Windows"));
				break;
			}
		case PLATFORM_WINDOWSFW:         
			{
				_stprintf(sBuf, _T("Windows For Workgroups"));
				break; 
			}
		case PLATFORM_WIN32S:
			{
				_stprintf(sBuf, _T("Win32s"));
				break; 
			}
		case PLATFORM_WINDOWS_CE:
			{
				_stprintf(sBuf, _T("Windows CE"));
				break;
			}
		case PLATFORM_WINDOWS:
			{
				if (IsWindows95(&osvi))
					_stprintf(sBuf, _T("Windows 95"));
				else if (IsWindows95SP1(&osvi))
					_stprintf(sBuf, _T("Windows 95 SP1"));
				else if (IsWindows95OSR2(&osvi))
					_stprintf(sBuf, _T("Windows 95 OSR2"));
				else if (IsWindows98(&osvi))
					_stprintf(sBuf, _T("Windows 98"));
				else if (IsWindows98SP1(&osvi))
					_stprintf(sBuf, _T("Windows 98 SP1"));
				else if (IsWindows98SE(&osvi))
					_stprintf(sBuf, _T("Windows 98 Second Edition"));
				else
					_stprintf(sBuf, _T("Windows ??"));
				break;
			}
		case PLATFORM_NT_WORKSTATION:
			{
				if (IsWindows2000(&osvi))
					_stprintf(sBuf, _T("Windows 2000 Professional"));
				else
					_stprintf(sBuf, _T("Windows NT Workstation"));
				break;
			}
		case PLATFORM_NT_PRIMARY_DOMAIN_CONTROLLER:         
			{
				if (IsWindows2000(&osvi))
					_stprintf(sBuf, _T("Windows 2000 Server (Acting as Primary Domain Controller)"));
				else
					_stprintf(sBuf, _T("Windows NT Server (Acting as Primary Domain Controller)"));
				break;
			}
		case PLATFORM_NT_BACKUP_DOMAIN_CONTROLLER:         
			{
				if (IsWindows2000(&osvi))
					_stprintf(sBuf, _T("Windows 2000 Server (Acting as Backup Domain Controller)"));
				else
					_stprintf(sBuf, _T("Windows NT Server (Acting as Backup Domain Controller)"));
				break;
			}
		case PLATFORM_NT_STAND_ALONE_SERVER:
			{
				if (IsWindows2000(&osvi))
					_stprintf(sBuf, _T("Windows 2000 Server (Acting as Standalone Sever)"));
				else
					_stprintf(sBuf, _T("Windows NT Server (Acting as Standalone Sever)"));
				break;
			}
		case PLATFORM_WINDOWS_TERMINAL_SERVER:
			{
				_stprintf(sBuf, _T("Windows NT Terminal Server"));
				break;
			}
		case PLATFORM_NT_ENTERPRISE_SERVER:
			{
				_stprintf(sBuf, _T("Windows NT Enterprise Edition"));
				break;
			}
		default: 
			{
				_stprintf(sBuf, _T("Unknown OS"));
				break;
			}
		}
	}                     
	_tcscat(sText, sBuf);
//	_stprintf(sBuf, _T(" v%d."), osvi.dwEmulatedMajorVersion);
//	_tcscat(sText, sBuf);     
//	_stprintf(sBuf, _T("%02d "), osvi.dwEmulatedMinorVersion);
//	_tcscat(sText, sBuf);                           
	if (osvi.wEmulatedServicePack)       
	{
		_stprintf(sBuf, _T(" Service Pack %d"), osvi.wEmulatedServicePack);
		_tcscat(sText, sBuf);
	}
	if (osvi.dwEmulatedBuildNumber)
	{
		_stprintf(sBuf, _T(" (Build %d)"), osvi.dwEmulatedBuildNumber);
		_tcscat(sText, sBuf);           
	}
	_tcscat(sText, _T(" \r\n"));
	;

	return sText;
}
Example #6
0
bool
CNdasServiceDeviceEventHandler::Initialize(
	HANDLE hRecipient, DWORD dwReceptionFlag)
{
	HRESULT hr;

	m_hRecipient = hRecipient;
	m_dwReceptionFlags = dwReceptionFlag;

	//
	// Caution!
	//
	// DEVICE_NOFITY_WINDOW_HANDLE is 0x000, hence
	// XTLASSERT(DEVICE_NOFITY_WINDOW_HANDLE & m_dwReceptionFlags)
	// will always fail.
	//
	XTLASSERT(
		((DEVICE_NOTIFY_SERVICE_HANDLE & m_dwReceptionFlags) == DEVICE_NOTIFY_SERVICE_HANDLE) ||
		((DEVICE_NOTIFY_WINDOW_HANDLE & m_dwReceptionFlags) == DEVICE_NOTIFY_WINDOW_HANDLE));

	//
	// Do not initialize twice if successful.
	//
	XTLASSERT(!m_bInitialized);

	//
	// Register interested device interfaces
	//

	RegisterDeviceInterfaceNotification(
		&GUID_DEVINTERFACE_STORAGEPORT, "StoragePort");

	RegisterDeviceInterfaceNotification(
		&GUID_DEVINTERFACE_VOLUME, "Volume");

	for (DWORD i = 0; i < RTL_NUMBER_OF(LogicalUnitInterfaceGuids); ++i)
	{
		RegisterDeviceInterfaceNotification(
			LogicalUnitInterfaceGuids[i].Guid,
			LogicalUnitInterfaceGuids[i].TypeName);
	}
	
	//
	// Register all existing logical units
	//

	hr = pRegisterNdasScsiPorts();

	hr = pRegisterLogicalUnits();

	//
	// nothing more for Windows XP or later
	//

	//
	// If NoLfs is set and if the OS is Windows 2000, 
	// load ROFilter service
	//
	if (!(IsWindows2000() && m_bNoLfs)) 
	{
		m_bInitialized = TRUE;
		return TRUE;
	}

	XTLASSERT(m_hROFilter.IsInvalid());

	//
	// Even if the rofilter is not loaded
	// initialization returns TRUE
	// However, m_hROFilter has INVALID_HANDLE_VALUE
	//

	m_bInitialized = TRUE;

	SERVICE_STATUS serviceStatus;
	BOOL fSuccess = NdasRoFilterQueryServiceStatus(&serviceStatus);
	if (!fSuccess) 
	{
		XTLTRACE2(NDASSVC_PNP, TRACE_LEVEL_ERROR, 
			"NdasRoFilterQueryServiceStatus failed, error=0x%X\n", GetLastError());
		return TRUE;
	}

	if (SERVICE_RUNNING != serviceStatus.dwCurrentState) 
	{
		fSuccess = NdasRoFilterStartService();
		if (!fSuccess) 
		{
			XTLTRACE2(NDASSVC_PNP, TRACE_LEVEL_ERROR, 
				"NdasRoFilterStartService failed, error=0x%X\n", GetLastError());
			return TRUE;
		}
	}

	HANDLE hROFilter = NdasRoFilterOpenDevice();
	if (INVALID_HANDLE_VALUE == hROFilter) 
	{
		XTLTRACE2(NDASSVC_PNP, TRACE_LEVEL_ERROR, 
			"NdasRoFilterCreate failed, error=0x%X\n", GetLastError());
		return TRUE;
	}

	m_hROFilter = hROFilter;

	return TRUE;
}
Example #7
0
BOOL GetDriveSubmount (TCHAR chDrive, LPTSTR pszSubmountNow)
{
	BOOL isWinNT = IsWindowsNT();

	TCHAR szDrive[] = TEXT("*:");
    szDrive[0] = chDrive;

    TCHAR szMapping[ _MAX_PATH ] = TEXT("");

    if (isWinNT && !QueryDosDevice (szDrive, szMapping, MAX_PATH))
           return FALSE;

    LPTSTR pszSubmount = szMapping;

	TCHAR szNetBiosName[32];
    memset(szNetBiosName, '\0', sizeof(szNetBiosName));
    GetClientNetbiosName(szNetBiosName);
    _tcscat(szNetBiosName, TEXT("\\"));

   if (isWinNT)
   {
      // Now if this is an AFS network drive mapping, {szMapping} will be:
      //
      //   \Device\LanmanRedirector\<Drive>:\<netbiosname>\submount
      //
      // on Windows NT. On Windows 2000, it will be:
      //
      //   \Device\LanmanRedirector\;<Drive>:0\<netbiosname>\submount
      //
      // (This is presumably to support multiple drive mappings with
      // Terminal Server).
      //
      // on Windows XP and 2003, it will be :
      //   \Device\LanmanRedirector\;<Drive>:<AuthID>\<netbiosname>\submount
      //
      //   where : <Drive> : DOS drive letter
      //           <AuthID>: Authentication ID, 16 char hex.
      //           <netbiosname>: Netbios name of server
      //
      BOOL b;
#ifndef AFSIFS
      b = _tcsnicmp(szMapping, cszLANMANDEVICE, _tcslen(cszLANMANDEVICE));
#else
      const TCHAR ker_sub_path[] = "\\Device\\afsrdr\\";
      b = _tcsnicmp(szMapping, ker_sub_path, _tcslen(ker_sub_path));
#endif
       if (b)
         return FALSE;
#ifndef AFSIFS
      pszSubmount = &szMapping[ _tcslen(cszLANMANDEVICE) ];
#else
      pszSubmount = &szMapping[ _tcslen(ker_sub_path) ];
#endif

#ifdef AFSIFS
       if (*(pszSubmount) < '0' ||
            *(pszSubmount) > '9')
           return FALSE;
       ++pszSubmount;
#else
      if (IsWindows2000())
      {
          if (*(pszSubmount) != TEXT(';'))
             return FALSE;
      } else
          --pszSubmount;

      if (toupper(*(++pszSubmount)) != chDrive)
         return FALSE;

      if (*(++pszSubmount) != TEXT(':'))
         return FALSE;

#ifdef COMMENT
       // No longer a safe assumption on XP
      if (IsWindows2000())
          if (*(++pszSubmount) != TEXT('0'))
             return FALSE;
#endif

      // scan for next "\"
      while (*(++pszSubmount) != TEXT('\\'))
      {
	  if (*pszSubmount==0)
              return FALSE;
      }

       // note that szNetBiosName has a '\\' tagged in the end earlier
      for (++pszSubmount; *pszSubmount && (*pszSubmount != TEXT('\\')); ++pszSubmount)
         if (!_tcsncicmp(pszSubmount, szNetBiosName, _tcslen(szNetBiosName)))
            break;
      if ((!*pszSubmount) || (*pszSubmount == TEXT('\\')))
         return FALSE;

       pszSubmount += _tcslen(szNetBiosName);
#endif
      }
   else // (!IsWindowsNT())
      {
      DWORD dwSize = MAX_PATH;
      if (WNetGetConnection (szDrive, szMapping, &dwSize) != NO_ERROR)
         return FALSE;
      if (*(pszSubmount++) != TEXT('\\'))
         return FALSE;
      if (*(pszSubmount++) != TEXT('\\'))
         return FALSE;
      for ( ; *pszSubmount && (*pszSubmount != TEXT('\\')); ++pszSubmount)
         if (!lstrncmpi (pszSubmount, szNetBiosName, lstrlen(szNetBiosName)))
            break;
      if ((!*pszSubmount) || (*pszSubmount == TEXT('\\')))
         return FALSE;
      pszSubmount += lstrlen(szNetBiosName);
      }

   if (!pszSubmount || !*pszSubmount)
      return FALSE;

#ifndef AFSIFS
   lstrcpy (pszSubmountNow, pszSubmount);
#else
   lstrcpy (pszSubmountNow, "\\afs");
   lstrcat (pszSubmountNow, pszSubmount);
#endif
   return TRUE;
}