Discussion:
Timer Queue timers and impersonation
(too old to reply)
Kursat
2010-05-12 07:53:01 UTC
Permalink
Hi,

For DeleteTimerQueueTimer() function, MSDN says: "This function cannot be
called while the thread is using impersonation. The resulting behavior is
undefined."

I have some questions about this statement:

- In which situation a thread is supposed to be using impersonation?
- After calling SetThreadToken() with an access token?
- I plan to use timer queue timers in a Windows service. Most probably,
timer queue timer creations and deletions will occur in thread pool threads.
Does a service which runs under an account which is different than the
currently logged-on user's account implicitly impersonate thread pool
threads or other threads created in it?
- Because most of the services run under special user accounts regardless of
the currently logged-on user , if implicit impersonation occurs than does
this mean that DeleteTimerQueueTimer () cannot be used in service
applications?

Thanks in advance.
Tim Roberts
2010-05-13 03:46:11 UTC
Permalink
Post by Kursat
For DeleteTimerQueueTimer() function, MSDN says: "This function cannot be
called while the thread is using impersonation. The resulting behavior is
undefined."
- In which situation a thread is supposed to be using impersonation?
- After calling SetThreadToken() with an access token?
Yes, or one of the Impersonate APIs. See:
http://msdn.microsoft.com/en-us/library/aa376391.aspx
Post by Kursat
- I plan to use timer queue timers in a Windows service. Most probably,
timer queue timer creations and deletions will occur in thread pool threads.
Does a service which runs under an account which is different than the
currently logged-on user's account implicitly impersonate thread pool
threads or other threads created in it?
No. They run under the service's account. Services sometimes need to use
explicit impersonation to mimic the logged on user, but there is no
implicit impersonation.
Post by Kursat
- Because most of the services run under special user accounts regardless of
the currently logged-on user , if implicit impersonation occurs than does
this mean that DeleteTimerQueueTimer () cannot be used in service
applications?
Shouldn't be a problem.
--
Tim Roberts, ***@probo.com
Providenza & Boekelheide, Inc.
Loading...