Hi,

I am trying to retrieve basic data from video driver via ExtEscape.
But the problem is I am getting blue screen of death.
I have a data structure

typedef struct _DispCmdQueue {
RECTL queue[2000];
INT queueHeadIndex, queueTailIndex;
INT queueSize;
} RectQueue, *PRectQueue;

In the main function I am creating a
RectQueue rectQueue;

Then I am calling the driver

ExtEscape(hdc,0,0,NULL, sizeof(rectQueue), (char *)&rectQueue);

And in the driver I am trying to set one field of the structure like that

ULONG
DrvEscape(
IN SURFOBJ *pso,
IN ULONG iEsc,
IN ULONG cjIn,
IN PVOID pvIn,
IN ULONG cjOut,
OUT PVOID pvOut)
{
PRectQueue userPRectQueue = (PRectQueue) pvOut;
userPRectQueue->queueTailIndex = 1;
}

But I am getting blue screen and machine needs reboot.

Any suggestion.

Sincerely,

Omer

Re: What is the best strategy to retrieve data from video driver? I am getting blue screen by Eugene

Eugene
Wed May 17 01:22:58 CDT 2006

Dear Omer,

> I am trying to retrieve basic data from video driver via ExtEscape.
> But the problem is I am getting blue screen of death.

I don't think ExtEscape is the right way to extract a large amount of data.
Shared memory is by far the best method for this task. It works
100% reliably if it's implemented properly.

You may take a look at our own sample and its accompanied doc:
http://www.demoforge.com/sdk/dfmirage-sdk-1.2.74.0.zip

--
Sincerely,
Eugene Sukhodolin
www.demoforge.com


Re: What is the best strategy to retrieve data from video driver? I am getting blue screen by Eugene

Eugene
Wed May 17 01:24:48 CDT 2006


Dear Omer,

> I am trying to retrieve basic data from video driver via ExtEscape.
> But the problem is I am getting blue screen of death.

I don't think ExtEscape is the right way to extract a large amount of data.
Shared memory is by far the best method for this task. It works
100% reliably if it's implemented properly.

You may take a look at our sample (which works with TightVNC for years)
and its accompanied documentation to see how the API may look like:
http://www.demoforge.com/sdk/dfmirage-sdk-1.2.74.0.zip

--
Sincerely,
Eugene Sukhodolin
www.demoforge.com

Re: What is the best strategy to retrieve data from video driver? by Omer

Omer
Wed May 17 03:15:32 CDT 2006

Thank you very much Eugene.

This article says that there are two methods, is one of them better than
the other in your opinion/experience?

This article says that
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q191840

"A memory-mapped file backed by the paging file is a common technique
used for sharing memory among user processes. However, you can use the
same technique to share memory between user processes and a device
driver. There are two approaches to this technique.

In the first method, a driver can create a named memory object (called a
section object) and one or more user applications can open the same
object by using OpenFileMapping and then calling the MapViewOfFile
function to get a pointer to a section or all of the shared memory. By
specifying protection attributes to the section object, you can define
the manner in which a process can manipulate the memory.

In the second method, an application can create a named memory object in
user mode with CreateFileMapping. A driver can open the same memory
object by using ZwOpenSection and calling ZwMapViewOfSection to get a
pointer to it. Always access this memory address in kernel mode with an
exception handler."


Eugene Sukhodolin wrote:
>
> Dear Omer,
>
>> I am trying to retrieve basic data from video driver via ExtEscape.
>> But the problem is I am getting blue screen of death.
>
> I don't think ExtEscape is the right way to extract a large amount of data.
> Shared memory is by far the best method for this task. It works
> 100% reliably if it's implemented properly.
>
> You may take a look at our sample (which works with TightVNC for years)
> and its accompanied documentation to see how the API may look like:
> http://www.demoforge.com/sdk/dfmirage-sdk-1.2.74.0.zip
>

Re: What is the best strategy to retrieve data from video driver? I am getting blue screen by Maxim

Maxim
Wed May 17 07:17:31 CDT 2006

> In the first method, a driver can create a named memory object (called a
> section object) and one or more user applications can open the same
> object by using OpenFileMapping and then calling the MapViewOfFile

Unsafe. The access to this memory cannot be synchronized. So, only the things
like video display screens or some perf stats tables read-only from user side
are good candidates for this.

A ring buffer with head-tail pointers, for instance, is definitely not, such a
design is nasty and unsafe, use pending IRPs instead.

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