Network shares & access control
-
Hi Platform: XPPro/XPe Dev Tools: VS2005, VC++, ATL, .Net I have a service based application that requires to be able to access a network share using a unc path. There could be several unc paths on separate NT Domains. Whilst is is possible to assign a user on each NT Domain for my application to access the share I would like to, at run time pass in the domain\user name & password, so that my app can access the appropriate files. Each unc access will run in a separate thread and from reading the platform SDK docs it looks like I need to Set the token for this thread. However I can not find out how to convert my domain\user name & password in a token. can someone please point me in the right direction. Thanks. Robin
-
Hi Platform: XPPro/XPe Dev Tools: VS2005, VC++, ATL, .Net I have a service based application that requires to be able to access a network share using a unc path. There could be several unc paths on separate NT Domains. Whilst is is possible to assign a user on each NT Domain for my application to access the share I would like to, at run time pass in the domain\user name & password, so that my app can access the appropriate files. Each unc access will run in a separate thread and from reading the platform SDK docs it looks like I need to Set the token for this thread. However I can not find out how to convert my domain\user name & password in a token. can someone please point me in the right direction. Thanks. Robin
You need to call
LogonUser
to get a token. Then useImpersonateLoggedOnUser
to set the token for the thread. Once you've finished using the share, useRevertToSelf
.
DoEvents
: Generating unexpected recursion since 1991