? User logoff

Posted: 10-30-2003, 01:01 PM
Hello!

I should do some work at user logoff in my driver, but can't find any info
in DDK about logoff event. Does anybody knows how to receive "user logoff"
notification in kernel mode?

OS - Windows 2000 and later.

Thanks for any info.

Aleksey.


Reply With Quote

Responses to "? User logoff"

Slava M. Usov
Guest
Posts: n/a
 
Re: ? User logoff
Posted: 10-30-2003, 02:02 PM
"Aleksey Rechinsky" <ar_(dont_spam)faramir@mail.ru> wrote in message
news:emSHDZunDHA.1764@tk2msftngp13.phx.gbl...
> Hello!
>
> I should do some work at user logoff in my driver, but can't find any info
> in DDK about logoff event. Does anybody knows how to receive "user logoff"
> notification in kernel mode?
>
> OS - Windows 2000 and later.
>
> Thanks for any info.
Out of the box, you can't. The best you can have is "logon session
termination", but it will happen any time after the logoff. If you don't
have to do something exactly at logoff, then it should suffice.

If you have, then you can use "winlogon notification packages", and talk to
your driver from there.

But it's best not to depend on such things in a driver.

S


Reply With Quote
Maxim S. Shatskih
Guest
Posts: n/a
 
Re: ? User logoff
Posted: 10-31-2003, 08:25 PM
> Out of the box, you can't. The best you can have is "logon session
> termination", but it will happen any time after the logoff. If you don't
"Logon session termination" is logoff, at least in terms of security log.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


Reply With Quote
Slava M. Usov
Guest
Posts: n/a
 
Re: ? User logoff
Posted: 11-01-2003, 09:33 PM
"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:e7fl8NGoDHA.1096@TK2MSFTNGP11.phx.gbl...
> > Out of the box, you can't. The best you can have is "logon session
> > termination", but it will happen any time after the logoff. If you don't
>
> "Logon session termination" is logoff, at least in terms of security log.
Except that it may happen hours after the "logoff" in terms of Winlogon and
the human user. And sometimes you can have two logon sessions for a single
logon, one of which will terminate in milliseconds. The latter happens
fairly frequently on XP and 2K3.

Without knowing the requirements, it is hard to suggest anything. Winlogon
notifications might be the greatest common denominator.

S


Reply With Quote
Alexander Grigoriev
Guest
Posts: n/a
 
Re: ? User logoff
Posted: 10-30-2003, 03:09 PM
Run a service which can receive logoff notifications. Have the service send
an IOCTL to the driver.

"Aleksey Rechinsky" <ar_(dont_spam)faramir@mail.ru> wrote in message
news:emSHDZunDHA.1764@tk2msftngp13.phx.gbl...
> Hello!
>
> I should do some work at user logoff in my driver, but can't find any info
> in DDK about logoff event. Does anybody knows how to receive "user logoff"
> notification in kernel mode?
>
> OS - Windows 2000 and later.
>
> Thanks for any info.
>
> Aleksey.
>
>

Reply With Quote
Jeff Henkels
Guest
Posts: n/a
 
Re: ? User logoff
Posted: 10-30-2003, 08:28 PM
This is especially easy on XP/2K3, where your service can receive a
SERVICE_CONTROL_SESSIONCHANGE notification; very useful for handling Fast
User Switching on XP.

"Alexander Grigoriev" <alegr@earthlink.net> wrote in message
news:%23Z4nHfvnDHA.2772@TK2MSFTNGP10.phx.gbl...
> Run a service which can receive logoff notifications. Have the service
send
> an IOCTL to the driver.
>
> "Aleksey Rechinsky" <ar_(dont_spam)faramir@mail.ru> wrote in message
> news:emSHDZunDHA.1764@tk2msftngp13.phx.gbl...
> > Hello!
> >
> > I should do some work at user logoff in my driver, but can't find any
info
> > in DDK about logoff event. Does anybody knows how to receive "user
logoff"
> > notification in kernel mode?
> >
> > OS - Windows 2000 and later.
> >
> > Thanks for any info.
> >
> > Aleksey.
> >
> >
>
>

Reply With Quote
Ray Trent
Guest
Posts: n/a
 
Re: ? User logoff
Posted: 10-31-2003, 12:27 AM
Another (slightly kludgey) way this can be accomplished (depending on
exactly what you want) is to run a user-mode application from the Run
key that just sits in the background and does nothing except notice the
appropriate termination messages, upon which it sends an IOCTL to you
driver. This is especially convenient if you happen to have any settings
you want to store in HKCU, since you already have to have a resident
program sitting around IOCTLing your driver so it can access the
registry in the context of a user thread...

Aleksey Rechinsky wrote:
> Hello!
>
> I should do some work at user logoff in my driver, but can't find any info
> in DDK about logoff event. Does anybody knows how to receive "user logoff"
> notification in kernel mode?
>
> OS - Windows 2000 and later.
>
> Thanks for any info.
>
> Aleksey.
>
>
--
.../ray\..

Reply With Quote
Kirk Ferdmann
Guest
Posts: n/a
 
Re: ? User logoff
Posted: 11-01-2003, 05:35 AM
"Ray Trent" <rat@synaptics.com.spamblock> wrote in message
news:uORqQX0nDHA.3256@tk2msftngp13.phx.gbl...
> Another (slightly kludgey) way this can be accomplished (depending on
> exactly what you want) is to run a user-mode application from the Run
> key that just sits in the background and does nothing except notice the
> appropriate termination messages, upon which it sends an IOCTL to you
> driver. This is especially convenient if you happen to have any settings
> you want to store in HKCU, since you already have to have a resident
> program sitting around IOCTLing your driver so it can access the
> registry in the context of a user thread...
Hmm not that kludgy at all. I think the best way to handle it is to perform
the cleaning inside IRP_MJ_CLEANUP. The user mode application is guaranteed
to die (of course if the driver does not block it forever) and the driver is
guaranteed to receive the IRP.

This way the application only needs to open a handle to the device.

This approach nicely scales to multi user scenario. Others here suggested NT
service - I would argue against it for this exactly reason.

-Kirk


Reply With Quote
Maxim S. Shatskih
Guest
Posts: n/a
 
Re: ? User logoff
Posted: 10-31-2003, 08:28 PM
Why not rely on SeRegisterLogonSessionForTerminationNotification and treat
logon session termination as logoff? Advantage: no additional user code.
Drawback: cannot catch Fast User Switching.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


"Ray Trent" <rat@synaptics.com.spamblock> wrote in message
news:uORqQX0nDHA.3256@tk2msftngp13.phx.gbl...
> Another (slightly kludgey) way this can be accomplished (depending on
> exactly what you want) is to run a user-mode application from the Run
> key that just sits in the background and does nothing except notice the
> appropriate termination messages, upon which it sends an IOCTL to you
> driver. This is especially convenient if you happen to have any settings
> you want to store in HKCU, since you already have to have a resident
> program sitting around IOCTLing your driver so it can access the
> registry in the context of a user thread...
>
> Aleksey Rechinsky wrote:
>
> > Hello!
> >
> > I should do some work at user logoff in my driver, but can't find any info
> > in DDK about logoff event. Does anybody knows how to receive "user logoff"
> > notification in kernel mode?
> >
> > OS - Windows 2000 and later.
> >
> > Thanks for any info.
> >
> > Aleksey.
> >
> >
>
> --
> ../ray\..
>

Reply With Quote
Alexander Grigoriev
Guest
Posts: n/a
 
Re: ? User logoff
Posted: 11-01-2003, 03:35 PM
It all depends what's the purpose of the logoff notification, how reliable
it should be, etc. We don't know what's the OP goal.

"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:ub7V$NGoDHA.1096@TK2MSFTNGP11.phx.gbl...
> Why not rely on SeRegisterLogonSessionForTerminationNotification and treat
> logon session termination as logoff? Advantage: no additional user code.
> Drawback: cannot catch Fast User Switching.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>
>

Reply With Quote
 
LinkBack Thread Tools Display Modes
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
Logoff problem HelpDZ Windows XP WMI 0 10-08-2006 05:41 PM
User-Unique Logon/Logoff Scripts For Multiple Accounts Harold Windows XP WMI 0 11-20-2005 11:05 PM
logon and logoff help!!!!!!!! kingston Windows XP Configuration & Management 1 11-04-2004 06:56 AM
cant logoff windows paul Windows XP Help & Support 0 10-26-2003 05:53 PM
Windows XP logoff Josh Klassen Windows XP Network & Web 0 07-04-2003 11:35 PM