User&Domain name

Hello,

In this time, I think that I also need your help. Now I am going to develop
certain driver which services certan functionalities per logon user/domain
basis.Does anyone give me how to get domain name/user name currently logged
on in device driver?

Thank you,
Hideyuki Inamasu.

As multiple users can be ‘currently logged on’ your question does not make
any sense. You can assign security access rights on a user and group basis
to devices, which is perhaps what you want to do, and then let the existing
security system in NT take care of security for you.

=====================
Mark Roddy
Windows .NET/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
Hideyuki Inamasu
Sent: Friday, February 11, 2005 11:14 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] User&Domain name

Hello,

In this time, I think that I also need your help. Now I am
going to develop certain driver which services certan
functionalities per logon user/domain basis.Does anyone give
me how to get domain name/user name currently logged on in
device driver?

Thank you,
Hideyuki Inamasu.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as:
xxxxx@hollistech.com To unsubscribe send a blank email to
xxxxx@lists.osr.com

No ways to get these, you can only get the user SID using
ZwQueryInformationToken.

You can also get the logon ID using the same function. Logon IDs are good,
since you can register the logoff notification and thus terminate something in
your driver when the user logs off.

Be careful. Do this in CREATE path only, and use
Parameters.Create.SecurityContext to get the token pointer. Then say
ObOpenObjectByPointer on it, and then ZwQueryInformationToken on the resulting
handle. I dunno whether there is an analog of ZwQueryInformationToken which
will take token’s pointer instead of a handle, to avoid using not-so-documented
ObOpenObjectByPointer. Maybe yes - but in new OSes like XP+ only.

Also note that Parameters.Create.SecurityContext has 2 token pointers -
Impersonation and usual. You must first check Impersonation, and only if it is
NULL - then use the usual (it is never NULL).

Resolving SID to domain\user string is surely a user mode task
(LookupAccountName function). At least it requires RPCs to the domain
controller usually.

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

----- Original Message -----
From: “Hideyuki Inamasu”
Newsgroups: ntdev
To: “Windows System Software Devs Interest List”
Sent: Friday, February 11, 2005 7:14 PM
Subject: [ntdev] User&Domain name

> Hello,
>
> In this time, I think that I also need your help. Now I am going to develop
> certain driver which services certan functionalities per logon user/domain
> basis.Does anyone give me how to get domain name/user name currently logged
> on in device driver?
>
> Thank you,
> Hideyuki Inamasu.
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com