Escape Call to a Display Driver from within a service running in session 0

Hello All,

CreateDC() returns NULL when it is called within the windows service running in session 0 while user has logged on into it’s own account running in a session other than session 0. I understand that session 0 isolation prevents the service to render any graphics to the display driver but I thought Escape call is permitted.

Is there any work around for this issue?

I appreciate your thoughts and inputs.

Thanks

xxxxx@hotmail.com wrote:

CreateDC() returns NULL when it is called within the windows service running in session 0 while user has logged on into it’s own account running in a session other than session 0. I understand that session 0 isolation prevents the service to render any graphics to the display driver but I thought Escape call is permitted.

Is there any work around for this issue?

Not really. The reason graphics cannot be done is that the display
driver is simply not “hooked up” to that session. It’s more than just
blocking pixel calls, there’s just no path to the driver.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

launch an application in the session of the logged in user to do your
display work.

Mark Roddy

On Wed, Mar 17, 2010 at 5:33 PM, wrote:

> Hello All,
>
> CreateDC() returns NULL when it is called within the windows service
> running in session 0 while user has logged on into it’s own account running
> in a session other than session 0. I understand that session 0 isolation
> prevents the service to render any graphics to the display driver but I
> thought Escape call is permitted.
>
> Is there any work around for this issue?
>
> I appreciate your thoughts and inputs.
>
> Thanks
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Tim, Mark,

Thank you both for helpful responses.

So the way to go is to launch a user agent running in logged-on user session communicating with Display Driver on behalf of the service.

My Display Driver is a driver with virtual frame buffer (System Memory). I want my service to get hold of this frame buffer (Read-Access only) in logged-on user session.

Is it possible to use user space MemMap technique to map system memory (frame buffer) to the service process user space running in session 0?

I suppose it is using some sort of shared memory map approach between user
and service. Seems like an awful ugly thing to be doing.

Mark Roddy

On Thu, Mar 18, 2010 at 11:29 AM, wrote:

> Tim, Mark,
>
> Thank you both for helpful responses.
>
> So the way to go is to launch a user agent running in logged-on user
> session communicating with Display Driver on behalf of the service.
>
> My Display Driver is a driver with virtual frame buffer (System Memory). I
> want my service to get hold of this frame buffer (Read-Access only) in
> logged-on user session.
>
> Is it possible to use user space MemMap technique to map system memory
> (frame buffer) to the service process user space running in session 0?
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

User agent can get a user space mapped memory of the frame buffer on its own process.

Is there any way to map it into service process? If yes, How?

Thanks

xxxxx@hotmail.com wrote:

User agent can get a user space mapped memory of the frame buffer on its own process.

Well, sort of. You can use DirectDraw to get a pointer to the primary
surface. Note, however that the term “the frame buffer” is not
accurate. Many machines these days have multiple monitors, and that
means multiple frame buffers.

Is there any way to map it into service process?

No. Display drivers are not available to the services window station.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

>> Is there any way to map it into service process?

No. Display drivers are not available to the services window station.

What I meant to say was that the user application has already got a user-space-memory pointer to the primary surface. Can I map this user-space pointer to another process?

xxxxx@hotmail.com wrote:

> No. Display drivers are not available to the services window station.
>

What I meant to say was that the user application has already got a user-space-memory pointer to the primary surface. Can I map this user-space pointer to another process?

Nope. I was going to point out that you could use OpenProcess and
WriteProcessMemory, but I’m not sure whether that works across window
stations.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

If you speak of the user mode OpenProcess and WriteProcessMemory APIs, yes, those work fine across both window stations or winstations/TS sessions provided you have the necessary access rights.

  • S

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Thursday, March 18, 2010 5:58 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Escape Call to a Display Driver from within a service running in session 0

xxxxx@hotmail.com wrote:

> No. Display drivers are not available to the services window station.
>

What I meant to say was that the user application has already got a user-space-memory pointer to the primary surface. Can I map this user-space pointer to another process?

Nope. I was going to point out that you could use OpenProcess and
WriteProcessMemory, but I’m not sure whether that works across window
stations.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

WriteProcessMemory does not map a user-space memory pointer from one process to another, does it?

No, it just performs the equivalent of a cross-process memcpy.

  • S

-----Original Message-----
From: xxxxx@hotmail.com
Sent: Friday, March 19, 2010 11:57
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Escape Call to a Display Driver from within a service running in session 0

WriteProcessMemory does not map a user-space memory pointer from one process to another, does it?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Obviously I’m not getting anywhere with this approach. Let’s change the approach.

My service is created as interactive service running in session 0.

Can service process attach to Winsta0\Default (by series of APIs like OpenWindowStation, SetProcessWindowStation, OpenDesktop, SetThreadDesktop) and then try ExtEscape call to send io call to display driver?

Thanks

OK. It seems my problem resolved.

I created a device object and a symbolic link using video miniport driver object. Now my service can open this device and send DeviceIoControl calls to video miniport driver and map the primary surface into the service process.

Thank you all for your professional inputs.