none
Access a ntfs resource as another user by code c++ with the owner usr and psw RRS feed

  • General discussion

  • Hello everyone! I'm writting a software wich needs to access some files owned by other user but knowing his username and password. I need something like "run as.. " but for opening a file for reading and/or writting. I tried LogonUser and SetThreadToken and ImpersonateLoggedOnUser but nothings happens perhaps i missed with the code or those are not the right apis. Could you please give me a piece of advice or some simple code for doing so. Suppose a folder "d:\personals\john" with some files and owned by john with login pass "123" and a user robert who knows those credentials and wants to copy, by code,(c++) those files to his folder "d:\personals\robert\copied from john" The code must open for reading john's files, create a folder in robert's and create(open for writting) the same name of files maybe in a loop reading/writting the files piece by piece.

    thanks a lot.

    Friday, June 23, 2017 6:31 PM

All replies

  • LeonardoZB,

    Sorry but you have posted to a forum that deals exclusively with questions/issues about customizing and programming Microsoft Project, a project management application. I suggest you re-post to the following forum:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vcgeneral

    John

    Friday, June 23, 2017 7:24 PM
  • Well, if "robert" asks "john" to grant read access to the location of the files then the problem goes away.
    Friday, June 23, 2017 9:02 PM