如果bfagent使用service mode,使用_MAP时,可以看到挂在的网络磁盘。但是当bfagnet以user mode启动,使用_MAP时,就看不到网络磁盘了。
后来发现这是因为WNetAddConnection2 limitation。这个问题只发生在XP和2003上面
http://msdn.microsoft.com/en-us/library/windows/desktop/aa385413%28v=vs.85%29.aspx
微软没有解决这个问题
Remarks
On Windows Server 2003 and Windows XP, the WNet functions create and delete network drive letters in the MS-DOS device namespace associated with a logon session because MS-DOS devices are identified by AuthenticationID (a locally unique identifier, or LUID, associated with a logon session.) This can affect applications that call one of the WNet functions to create a network drive letter under one user logon, but query for existing network drive letters under a different user logon. An example of this situation could be when a user's second logon is created within a logon session, for example, by calling the CreateProcessAsUser function, and the second logon runs an application that calls the GetLogicalDrives function. The call to the GetLogicalDrives function does not return network drive letters created by WNet function calls under the first logon. Note that in the preceding example the first logon session still exists, and the example could apply to any logon session, including a Terminal Services session. For more information, see Defining an MS-DOS Device Name.
On Windows Server 2003 and Windows XP, if a service that runs as LocalSystem calls the WNetAddConnection2 function, then the mapped drive is visible to all user logon sessions.