Microsoft KB Archive/115848

= INFO: Services and Redirected Drives =

ID: Q115848

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API) included with: - Microsoft Windows NT versions 3.51, 4.0

SUMMARY
When you write a service, do not use WNetAddConnectionXXX to redirect drives to remote shares because the redirector does not allow the interactive user to see or enumerate the redirected drive.

MORE INFORMATION
WNetAddConnectionXXX creates a global symbolic link describing the drive. Therefore, users can change to the drive at the command prompt if they have the proper security access to the share. However, WNetOpenEnum, WNetEnumResource, and the "net use" command fail to list the drive connection that was created by the service. This happens because an interactive user does not have an active session to the remote connection, so the redirector will not let the interactive user see the remote share.

Windows NT File Manager and Windows NT Explorer can see the redirected drive because they call GetDriveType on each drive and they put up an icon for each drive found. Windows NT File Manager and Windows NT Explorer create an icon for redirected drives created from a service because there is a global symbolic link to that drive. However, the interactive user cannot use Windows NT File Manager or Windows NT Explorer to disconnect the drive because the drive was created by the service, not the interactive user.

If the service is running in the security context of the LocalSystem account, then only that service or another process running in the LocalSystem account can call WNetCancelConnection to disconnect the drive.

Additional query words:

Keywords         : kbnetwork kbAPI kbKernBase kbNTOS351 kbNTOS400 kbSDKPlatform kbService kbWNet kbGrpNet Issue type       : kbinfo Last Reviewed: July 31, 1998