Why I cannot open "Display1" ?

Hi ,Everyone.
I just take a test to open the video device “Display1” and to get a
File_Object for accessing the video buffer . Code I used :

PFILE_OBJECT VideoTest_OpenDisplayDevice(ULONG DisplayNumber)
{
WCHAR DeviceNameBuffer[40];
UNICODE_STRING DeviceName;
NTSTATUS Status;
PFILE_OBJECT VideoFileObject;
PDEVICE_OBJECT DeviceObject;

swprintf(DeviceNameBuffer, L"\Device\Video%d", DisplayNumber);
RtlInitUnicodeString(&DeviceName, DeviceNameBuffer);

Status=IoGetDeviceObjectPointer(
&DeviceName,
FILE_READ_ATTRIBUTES,//FILE_ALL_ACCESS ,
&VideoFileObject,
& DeviceObject
);

if (!NT_SUCCESS(Status))
{
DbgPrint(“Status=0x%x\n”,(ULONG)Status);
return(NULL);
}

return VideoFileObject;
}

The result is NULL, Status=0xc0000022,it means “STATUS_ACCESS_DENIED”.
Why?

http://www.eyou.com
–Îȶ¨¿É¿¿µÄµç×ÓÐÅÏä ÓïÒôÓʼþ Òƶ¯ÊéÇ© ÈÕÀú·þÎñ ÍøÂç´æ´¢…ÒÚÓÊδ¾¡

http://vip.eyou.com
–¿ì¿ìµÇ¼ÒÚÓÊVIPÐÅÏä ×¢²áÄúÖÐÒâµÄÓû§Ãû

Because video port driver creates \devcice\videoN with exclusive flag set.

What do you want to accomplish by access video DO?

Calvin Guan Software Engineer
ATI Technologies Inc. www.ati.com

-----Original Message-----
From: f [mailto:xxxxx@eyou.com]
Sent: November 24, 2004 8:36 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Why I cannot open “Display1” ?

Hi ,Everyone.
I just take a test to open the video device “Display1” and to get a
File_Object for accessing the video buffer . Code I used :

PFILE_OBJECT VideoTest_OpenDisplayDevice(ULONG DisplayNumber)
{
WCHAR DeviceNameBuffer[40];
UNICODE_STRING DeviceName;
NTSTATUS Status;
PFILE_OBJECT VideoFileObject;
PDEVICE_OBJECT DeviceObject;

swprintf(DeviceNameBuffer, L"\Device\Video%d", DisplayNumber);
RtlInitUnicodeString(&DeviceName, DeviceNameBuffer);

Status=IoGetDeviceObjectPointer(
&DeviceName,
FILE_READ_ATTRIBUTES,//FILE_ALL_ACCESS ,
&VideoFileObject,
& DeviceObject
);

if (!NT_SUCCESS(Status))
{
DbgPrint(“Status=0x%x\n”,(ULONG)Status);
return(NULL);
}

return VideoFileObject;
}

The result is NULL, Status=0xc0000022,it means “STATUS_ACCESS_DENIED”.
Why?

http://www.eyou.com
–?ȶ??ɿ??ĵ??? ???ʼ? ?ƶ???ǩ ??? ???洢…???δ??

http://vip.eyou.com
–???¼???VIP??? ע???û???


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

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