Copy file with elevated privileges

Is there a way to increase privileges to the level required to write files to a network folder with our Delphi 2006 (Win32) application?

The user running the application does not have the right to write (or view) files in the corresponding network folder.

Any recommended methods or alternative suggestions?

+3
source share
2 answers

You can ask the user to enter credentials for the user with higher permissions and then temporarily work under this other username while writing to the network share. For this you are looking for LogonUserand ImpersonateLoggedOnUser. See this answer .

+5

WNetAddConnection2 UNC-, lpUsername lpPassword ( , - ).

, UNC- ( nil lpLocalname). UNC .

+1

Source: https://habr.com/ru/post/1730057/


All Articles