dwUsage = RESOURCEUSAGE_ALL;
}
-#if 0
- if ( dwType == 0 || dwType == RESOURCEUSAGE_ATTACHED)
- {
- dwType |= RESOURCETYPE_DISK | RESOURCETYPE_PRINT;
- }
-#endif
-
hControlDevice = OpenRedirector();
if( hControlDevice == NULL)
}
//
- // Handle the special cases here
- // 0. Provider Network Root
- // 1. Server Root
- //
-
-#if 0
- if ( pEnumCB->Scope == RESOURCE_GLOBALNET)
- {
-
- ReadServerNameString();
-
- if ( pEnumCB->CurrentIndex == 0 &&
- pEnumCB->RemoteName == NULL)
- {
-
- // Determine the space needed for this entry...
-
- SpaceNeeded = 2 * ( cbProviderNameLength + sizeof( WCHAR));
-
- uniRemoteName.Length = (USHORT)cbProviderNameLength;
- uniRemoteName.MaximumLength = uniRemoteName.Length;
- uniRemoteName.Buffer = wszProviderName;
-
- if( SpaceNeeded + sizeof( NETRESOURCE) > SpaceAvailable)
- {
-
- *lpBufferSize = SpaceNeeded + sizeof( NETRESOURCE);
-
-#ifdef AFS_DEBUG_TRACE
- AFSDbgPrint( L"NPEnumResource Request MORE_DATA for entry %s Len %d\n",
- &uniRemoteName,
- *lpBufferSize);
-#endif
- try_return( dwStatus = WN_MORE_DATA);
- }
-
-#ifdef AFS_DEBUG_TRACE
- AFSDbgPrint( L"NPEnumResource Processing Entry %wZ\n",
- &uniRemoteName);
-#endif
-
- SpaceAvailable -= (SpaceNeeded + sizeof( NETRESOURCE));
-
- pNetResource->dwScope = RESOURCE_GLOBALNET;
- pNetResource->dwType = RESOURCETYPE_ANY;
- pNetResource->dwDisplayType = RESOURCEDISPLAYTYPE_NETWORK;
- pNetResource->dwUsage = RESOURCEUSAGE_CONTAINER | RESOURCEUSAGE_RESERVED;
-
- // setup string area at opposite end of buffer
- StringZone = (PWCHAR)( (PBYTE) StringZone - SpaceNeeded);
-
- pNetResource->lpLocalName = NULL;
-
- // copy remote name
- pNetResource->lpRemoteName = StringZone;
-
- StringCbCopy( StringZone,
- cbProviderNameLength + sizeof( WCHAR),
- wszProviderName);
-
- StringZone += cbProviderNameLength / sizeof(WCHAR) + 1;
-
- pNetResource->lpComment = NULL;
-
- // copy provider name
- pNetResource->lpProvider = StringZone;
- StringCbCopy( StringZone,
- cbProviderNameLength + sizeof( WCHAR),
- wszProviderName);
-
- StringZone += cbProviderNameLength / sizeof( WCHAR) + 1;
-
-#ifdef AFS_DEBUG_TRACE
- AFSDbgPrint( L"NPEnumResource Entry (0x%p) Scope %s Type %s Display %s Usage %s Local %s Remote \"%s\" Comment \"%s\"\n",
- pNetResource,
- GetScopeString(pNetResource->dwScope),
- GetTypeString(pNetResource->dwType),
- GetDisplayString(pNetResource->dwDisplayType),
- GetUsageString(pNetResource->dwUsage),
- pNetResource->lpLocalName,
- pNetResource->lpRemoteName,
- pNetResource->lpComment);
-#endif
-
- // setup the new end of buffer
- StringZone = (PWCHAR)( (PBYTE) StringZone - SpaceNeeded);
-
- EntriesCopied++;
-
- pNetResource++;
-
- // do not change the index since we did not query the redirector
- pEnumCB->CurrentIndex = 0;
-
- // remember that we returned the provider name
- pEnumCB->RemoteName = (WCHAR *)HeapAlloc( GetProcessHeap( ), HEAP_ZERO_MEMORY, 0x1000);
-
- if( pEnumCB->RemoteName == NULL)
- {
-
- try_return( dwStatus = WN_OUT_OF_MEMORY);
- }
- else
- {
-
- StringCbCopy( pEnumCB->RemoteName,
- 0x1000,
- wszProviderName);
- }
- }
-
- if ( pEnumCB->CurrentIndex == 0 &&
- lstrlen( pEnumCB->RemoteName) == cbProviderNameLength / sizeof( WCHAR) &&
- _wcsnicmp( pEnumCB->RemoteName, wszProviderName, cbProviderNameLength / sizeof( WCHAR)) == 0 &&
- EntriesCopied < EntriesRequested)
- {
-
- //
- // After the network provider entry comes the server entry
- //
-
- // Determine the space needed for this entry...
-
- SpaceNeeded = cbProviderNameLength + cbServerNameUNCLength + cbServerCommentLength + 3 * sizeof( WCHAR);
-
- uniRemoteName.Length = (USHORT)cbServerNameUNCLength;
- uniRemoteName.MaximumLength = uniRemoteName.Length;
- uniRemoteName.Buffer = wszServerNameUNC;
-
- if( SpaceNeeded + sizeof( NETRESOURCE) > SpaceAvailable)
- {
-
- *lpBufferSize = SpaceNeeded + sizeof( NETRESOURCE);
-
-#ifdef AFS_DEBUG_TRACE
- AFSDbgPrint( L"NPEnumResource Request MORE_DATA for entry %s Len %d\n",
- &uniRemoteName,
- *lpBufferSize);
-#endif
- try_return( dwStatus = WN_MORE_DATA);
- }
-
-#ifdef AFS_DEBUG_TRACE
- AFSDbgPrint( L"NPEnumResource Processing Entry %wZ\n",
- &uniRemoteName);
-#endif
-
- SpaceAvailable -= (SpaceNeeded + sizeof( NETRESOURCE));
-
- pNetResource->dwScope = 0;
- pNetResource->dwType = RESOURCETYPE_ANY;
- pNetResource->dwDisplayType = RESOURCEDISPLAYTYPE_SERVER;
- pNetResource->dwUsage = RESOURCEUSAGE_CONTAINER;
-
- // setup string area at opposite end of buffer
- StringZone = (PWCHAR)( (PBYTE) StringZone - SpaceNeeded);
-
- pNetResource->lpLocalName = NULL;
-
- // copy remote name
- pNetResource->lpRemoteName = StringZone;
-
- StringCbCopy( StringZone,
- cbServerNameUNCLength + sizeof( WCHAR),
- wszServerNameUNC);
-
- StringZone += cbServerNameUNCLength / sizeof(WCHAR) + 1;
-
- // copy comment
- pNetResource->lpComment = StringZone;
-
- StringCbCopy( StringZone,
- cbServerCommentLength + sizeof( WCHAR),
- wszServerComment);
-
- StringZone += cbServerCommentLength / sizeof( WCHAR) + 1;
-
- // copy provider name
- pNetResource->lpProvider = StringZone;
- StringCbCopy( StringZone,
- cbProviderNameLength + sizeof( WCHAR),
- wszProviderName);
-
- StringZone += cbProviderNameLength / sizeof( WCHAR) + 1;
-
-#ifdef AFS_DEBUG_TRACE
- AFSDbgPrint( L"NPEnumResource Entry (0x%p) Scope %s Type %s Display %s Usage %s Local %s Remote \"%s\" Comment \"%s\"\n",
- pNetResource,
- GetScopeString(pNetResource->dwScope),
- GetTypeString(pNetResource->dwType),
- GetDisplayString(pNetResource->dwDisplayType),
- GetUsageString(pNetResource->dwUsage),
- pNetResource->lpLocalName,
- pNetResource->lpRemoteName,
- pNetResource->lpComment);
-#endif
-
- // setup the new end of buffer
- StringZone = (PWCHAR)( (PBYTE) StringZone - SpaceNeeded);
-
- EntriesCopied++;
-
- pNetResource++;
-
- // do not update the index because we did not query the redirector
- pEnumCB->CurrentIndex = 0;
-
- // remember that we returned the server
- StringCbCopy( pEnumCB->RemoteName,
- 0x1000,
- wszServerNameUNC);
- }
- }
-#endif
-
- //
// Setup what we are going to ask for
//
GetLastError());
#endif
}
-#if 0
- //
- // only do this if you want network shares to fail to mount
- // when the file system is not yet ready
- //
- else {
-
- AFSDriverStatusRespCB respCB;
- DWORD dwBytes;
-
- memset( &respCB, '\0', sizeof( AFSDriverStatusRespCB));
-
- if ( !DeviceIoControl( hControlDevice,
- IOCTL_AFS_STATUS_REQUEST,
- NULL,
- 0,
- (void *)&respCB,
- sizeof( AFSDriverStatusRespCB),
- &dwBytes,
- NULL) ||
- dwBytes != sizeof(AFSDriverStatusRespCB) ||
- respCB.Status != AFS_DRIVER_STATUS_READY )
- {
-
- CloseHandle( hControlDevice);
-
- hControlDevice = NULL;
- }
- }
-#endif
return hControlDevice;
}