From: Kursat on 12 May 2010 03:53 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.
From: Tim Roberts on 12 May 2010 23:46 Kursat <Kursat(a)discussions.microsoft.com> wrote: > >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? Yes, or one of the Impersonate APIs. See: http://msdn.microsoft.com/en-us/library/aa376391.aspx >- 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. >- 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, timr(a)probo.com Providenza & Boekelheide, Inc.
|
Pages: 1 Prev: Shutdown explorer not interactively ? Next: Find the users-home-folders from within a driver |