Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2008 Apr : Copying file over to a shared network folder

www.cryer.info
Managed Newsgroup Archive

Copying file over to a shared network folder

Subject:Copying file over to a shared network folder
Posted by:"Marcelo Grossi" (no@spam.com)
Date:16 Apr 2008 07:40:41 -0700

  I've been trying for the past couple of days to copy a file from my local TEMP directory to a shared network folder (with full permission).
  The problem is that this must be done from within a Service that runs under the "Local System" account. And I know this account doesn't have Network Privileges and even has explicit denied access to UNC paths (like the one I'm trying to use).
  Running this service as "Network Service" is not an option as it does several other operations that require extra privileges/right to the local system.
  So basically, all that I've read so far and tested didn't work. I've tried the following methods:
  - LogonUser/Ex
  - ImpersonateLoggenOnUser
  - DuplicateToken
  - CreateProcessAsUser
  - CreateProcessWithLogonW
  And none of them worked for me. For my own inability to make them work or simply because they don't work.
  So, what I ask is. Should I just give up on trying to do things properly and just create antoher Service that runs as "Network Service" that ONLY copies a file from the local machine to a remote machine? (Which in my opinion not very elegant and quite an overkill of the problem..) Or is there still hope to use Windows privilege/security system?

  Thank you for all the great assistance so far,

  Marcelo Grossi

Info

Glossary

Replies:

www.cryer.info
Managed Newsgroup Archive