From: Jeffrey Altman Date: Tue, 29 Nov 2011 19:55:55 +0000 (-0500) Subject: Windows: no drive subst for NPCancelConnection X-Git-Tag: openafs-stable-1_8_0pre1~3002 X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=9fa28d7df3034600026aacbfb902a4f92446253b Windows: no drive subst for NPCancelConnection NPCancelConnection() must use the results of a Get Connection ioctl to the afs redirector and not the result of Drive Letter Substitution queries via DosQueryDevice(). Rename NPGetConnection() to NPGetConnectionCommon() and add a new parameter to indicate whether drive substitution is ok. Change-Id: I42cd4488038f128ae90356a41bc538966d9cebed Reviewed-on: http://gerrit.openafs.org/6139 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- diff --git a/src/WINNT/afsrdr/npdll/AFS_Npdll.c b/src/WINNT/afsrdr/npdll/AFS_Npdll.c index e63ee09..51fe57a 100644 --- a/src/WINNT/afsrdr/npdll/AFS_Npdll.c +++ b/src/WINNT/afsrdr/npdll/AFS_Npdll.c @@ -72,6 +72,12 @@ ULONG _cdecl AFSDbgPrint( PWCHAR Format, ... ); +static DWORD APIENTRY +NPGetConnectionCommon( LPWSTR lpLocalName, + LPWSTR lpRemoteName, + LPDWORD lpBufferSize, + BOOL bDriveSubstOk); + #define WNNC_DRIVER( major, minor ) ( major * 0x00010000 + minor ) #define OPENAFS_PROVIDER_NAME L"OpenAFS Network" @@ -912,9 +918,10 @@ NPCancelConnection( LPWSTR lpName, // Get the remote name for the connection, if we are handling it // - dwStatus = NPGetConnection( lpName, - wchRemoteName, - &dwRemoteNameLength); + dwStatus = NPGetConnectionCommon( wchLocalName, + wchRemoteName, + &dwRemoteNameLength, + FALSE); if( dwStatus != WN_SUCCESS || dwRemoteNameLength == 0) @@ -1155,6 +1162,20 @@ NPGetConnection( LPWSTR lpLocalName, LPDWORD lpBufferSize) { + return NPGetConnectionCommon( lpLocalName, + lpRemoteName, + lpBufferSize, + TRUE); +} + +DWORD +APIENTRY +NPGetConnectionCommon( LPWSTR lpLocalName, + LPWSTR lpRemoteName, + LPDWORD lpBufferSize, + BOOL bDriveSubstOk) +{ + DWORD dwStatus = WN_NOT_CONNECTED; WCHAR wchLocalName[3]; WCHAR wchSubstName[MAX_PATH + 1]; @@ -1195,7 +1216,8 @@ NPGetConnection( LPWSTR lpLocalName, dwPassedSize = *lpBufferSize; - if ( !DriveSubstitution( lpLocalName, wchSubstName, sizeof( wchSubstName))) + if ( !bDriveSubstOk || + !DriveSubstitution( lpLocalName, wchSubstName, sizeof( wchSubstName))) { wchLocalName[0] = towupper(lpLocalName[0]); wchLocalName[1] = L':';