From: greenfish on
how can access the '\\sharefolder' in the SYSTEM account process?
of course, that's over than vista os.

any session process(ex, explorer.exe) can access the '\\sharefolder',
after passed with the credential.

in that SYSTEM account process, i processed with
"::ImpersonateLoggedOnUser(explorer process handle);",
but it's failed.

how can it be possible?
From: Jackie on
greenfish wrote:
> how can access the '\\sharefolder' in the SYSTEM account process?
> of course, that's over than vista os.
>
> any session process(ex, explorer.exe) can access the '\\sharefolder',
> after passed with the credential.
>
> in that SYSTEM account process, i processed with
> "::ImpersonateLoggedOnUser(explorer process handle);",
> but it's failed.
>
> how can it be possible?

I am not sure if I can give the whole answer instantly at the moment,
but if you want to use ImpersonateLoggedOnUser correctly, you need to
pass in the token handle, not the handle to the process. You can get the
process' token with OpenProcessToken, then I am not sure if you need to
duplicate it first with DuplicateToken before you use pass it to
ImpersonateLoggedOnUser.

--
Regards,
Jackie
From: Jackie on
greenfish wrote:
> how can access the '\\sharefolder' in the SYSTEM account process?
> of course, that's over than vista os.
>
> any session process(ex, explorer.exe) can access the '\\sharefolder',
> after passed with the credential.
>
> in that SYSTEM account process, i processed with
> "::ImpersonateLoggedOnUser(explorer process handle);",
> but it's failed.
>
> how can it be possible?

Also, it would be a good idea to let us know exactly what error(s) you
get so that we don't have to ask for it and wait for a reply from you.
Luckily, I know the problem though. :)

--
Regards,
Jackie
From: Jackie on
http://msdn.microsoft.com/en-us/library/aa378612%28VS.85%29.aspx

Here's the documentation for ImpersonateLoggedOnUser if you haven't
looked at it (MSDN is usually helpful). :)

--
Regards,
Jackie
From: greenfish on
On 7¿ù7ÀÏ, ¿ÀÈÄ6½Ã08ºÐ, Jackie <Jac...(a)an.on> wrote:
> http://msdn.microsoft.com/en-us/library/aa378612%28VS.85%29.aspx
>
> Here's the documentation for ImpersonateLoggedOnUser if you haven't
> looked at it (MSDN is usually helpful). :)
>
> --
> Regards,
> Jackie

thank you for your help.
::ImpersonateLoggodOnUser was correctly used.
(Find explorer.exe PID -> OpenProcessToken() -> DuplicateTokenEx() ->
ImpersonateLoggedOnUser(...))

i wonder, ::ImpersonateLoggedOnUser can not help access the network
resource in the SYSTEM account process for OS security)