Click to See Complete Forum and Search --> : WNetAddConnection2 and Win NT family question


Guido Niewerth
April 17th, 2003, 01:09 AM
Hello,

maybe someone can help me on this one:

Iīve made two accounts (say A and B) on my Windows XP machine, A is member of the local group "administrators", and B belongs to the local group "users".
After B logs on, a small program starts another process (say P) with the credentials of account A. This is necessary to prevent B from killing P. After some user input P maps a network drive to a remote server (using WNetAddConnection2) , the share which will be connected depends on the userīs input. Now I face the following problem:
The mapped drive is only visible in Aīs security context, B cannot access it. Itīs invisble in Bīs explorer, though it really exists.

I tried the following approaches:

(1) Switch Pīs identity temporarily from A to B using LogonUser, ImpersonateLoggedOnUser() and SetThreadToken(). Then I called WNetAddConnection2() and RevertToSelf, but it did not work. The share is mapped, but invisible to B.

(2) I wrote another small program that maps the network drive, this program is called from P with Bīs credentials (using CreateProcessWithLogonW). Woooot, B can access the share! Unfortunately P cannot see it, so itīs the same problem the other way round.

Is it possible to establish a network mapping that is visible to ALL users?

Regards,
Guido