Re: SHFileOperation Problem
- From: Kellie Fitton <KELLIEFITTON@xxxxxxxxx>
- Date: Mon, 14 Apr 2008 13:00:01 -0700 (PDT)
On Apr 14, 7:12 am, Marcelo Grossi <Marcelo
Gro...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Hello,
I have a service application running under the "Local System" account. This
service can receive a command to run a set of batch operations (on my case,
collecting log files of the system). A file with a known name is created and
I will need to send this file to a shared network folder. I understand the
"Local System" account doesn't have network rights.
What can I do to copy a file from the local machine to a shared network
folder using the "Local System" account? I've been trying to use
"CreateProcessAsUser" with no avail..
Any ideas on the subject?
Thank you,
Hi,
If you have access rights to the network resources, you can
access the network server and perform your operation. Also,
in a service process you can only access the network drives
via the UNC path, you can use the following API to access the
shared hard drives on the remote server machine:
WNetGetUniversalName() UNIVERSAL_NAME_INFO_LEVEL
Now, the LocalSystem account does not have network credentials, and
explicitly denied any access to the UNC names. So, you need to use
a network service or a designated user account to access the network,
you can use the following APIs to accomplish that:
LogonUserEx()
ImpersonateLoggedOnUser()
CreateEnvironmentBlock()
GetUserProfileDirectory()
LoadUserProfile()
CreateProcessAsUser()
........................................................................................
........................................................................................
DestroyEnvironmentBlock()
UnloadUserProfile()
RevertToSelf()
CloseHandle()
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q180362
http://msdn2.microsoft.com/en-us/library/Aa385413.aspx
http://msdn2.microsoft.com/en-us/library/Aa385474.aspx
http://msdn2.microsoft.com/En-US/library/aa378189.aspx
http://msdn2.microsoft.com/en-US/library/aa378612.aspx
http://msdn2.microsoft.com/En-US/library/aa373491.aspx
http://msdn2.microsoft.com/en-us/library/aa373772.aspx
http://msdn2.microsoft.com/En-US/library/aa374341.aspx
http://msdn2.microsoft.com/en-us/library/ms682429.aspx
http://msdn2.microsoft.com/en-US/library/aa373501.aspx
http://msdn2.microsoft.com/en-US/library/aa375098.aspx
http://msdn2.microsoft.com/en-us/library/aa379317.aspx
http://msdn2.microsoft.com/en-us/library/ms724211.aspx
Kellie.
.
- Follow-Ups:
- Re: SHFileOperation Problem
- From: Marcelo Grossi
- Re: SHFileOperation Problem
- References:
- SHFileOperation Problem
- From: Marcelo Grossi
- SHFileOperation Problem
- Prev by Date: WMI missing security settings
- Next by Date: Re: Smartcard authentication in a multi-tier application
- Previous by thread: SHFileOperation Problem
- Next by thread: Re: SHFileOperation Problem
- Index(es):
Relevant Pages
|