Folks,

I am having trouble obtaining a handle to a WDF driver using
CreateFile(DosDeviceName, other parameters) in Vista.

My driver is a software only driver and with some help from Chkinf was able
to muck around with my inf file to get the driver successfully install (I
make this statement based on the fact that the setupact.log in the windows
folder doesn't have any errors related to this particular driver listed and
there are no bangs or questions marks next to my driver in Device Manager).
Initially the chkinf complained about not recognizing the GUID and I had to
use the class Name 'System' and the associated GUID to make chkinf happy and
eventually Vista happy. Therefore my driver ended up under the 'System
Devices' tree.

Now when I try to open a handle to this driver using the Symbolic link name
I am failing. Before this my driver was under the class name 'Test Tools'
with some other GUID and WinXP 32 and 64 bit didn't have any problems with it.

Has anyone seen this before and point me towards the solution.

Thanks!

Ram
Driver Developer

RE: Obtaining Driver handle in Vista using CreateFile() by pavel_a

pavel_a
Tue Sep 12 16:45:02 CDT 2006

"ramjohnny" wrote:

> Now when I try to open a handle to this driver using the Symbolic link name
> I am failing. Before this my driver was under the class name 'Test Tools'
> with some other GUID and WinXP 32 and 64 bit didn't have any problems with it.

What is the error returned from CreateFile?

--PA

RE: Obtaining Driver handle in Vista using CreateFile() by ramjohnny

ramjohnny
Tue Sep 12 17:02:01 CDT 2006

I get an INVALID_HANDLE_VALUE.

This is the piece of code:

h = CreateFile("\\\\.\\SAD_Dev", GENERIC_READ, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(h == INVALID_HANDLE_VALUE) // Was the device opened?
{
return FALSE;
}

return TRUE;

--
Ram
Driver Developer


"Pavel A." wrote:

> "ramjohnny" wrote:
>
> > Now when I try to open a handle to this driver using the Symbolic link name
> > I am failing. Before this my driver was under the class name 'Test Tools'
> > with some other GUID and WinXP 32 and 64 bit didn't have any problems with it.
>
> What is the error returned from CreateFile?
>
> --PA

RE: Obtaining Driver handle in Vista using CreateFile() by pavel_a

pavel_a
Tue Sep 12 17:24:02 CDT 2006

What is GetLastError() ?

Also, try 0 instead of GENERIC_READ

--PA


"ramjohnny" wrote:

> I get an INVALID_HANDLE_VALUE.
>
> This is the piece of code:
>
> h = CreateFile("\\\\.\\SAD_Dev", GENERIC_READ, 0, NULL,
> OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
> if(h == INVALID_HANDLE_VALUE) // Was the device opened?
> {
> return FALSE;
> }
>
> return TRUE;
>
> --
> Ram
> Driver Developer
>
>
> "Pavel A." wrote:
>
> > "ramjohnny" wrote:
> >
> > > Now when I try to open a handle to this driver using the Symbolic link name
> > > I am failing. Before this my driver was under the class name 'Test Tools'
> > > with some other GUID and WinXP 32 and 64 bit didn't have any problems with it.
> >
> > What is the error returned from CreateFile?
> >
> > --PA

Re: Obtaining Driver handle in Vista using CreateFile() by Doron

Doron
Tue Sep 12 22:19:03 CDT 2006

post the code in your KMDF driver which creates the device and the symbolic
link. are you doing this in DriverEntry()?

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Pavel A." <pavel_a@NOwritemeNO.com> wrote in message
news:6BDFA24F-29DE-4CC2-AA2E-B9210D1E811A@microsoft.com...
> What is GetLastError() ?
>
> Also, try 0 instead of GENERIC_READ
>
> --PA
>
>
> "ramjohnny" wrote:
>
>> I get an INVALID_HANDLE_VALUE.
>>
>> This is the piece of code:
>>
>> h = CreateFile("\\\\.\\SAD_Dev", GENERIC_READ, 0, NULL,
>> OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
>> if(h == INVALID_HANDLE_VALUE) // Was the device opened?
>> {
>> return FALSE;
>> }
>>
>> return TRUE;
>>
>> --
>> Ram
>> Driver Developer
>>
>>
>> "Pavel A." wrote:
>>
>> > "ramjohnny" wrote:
>> >
>> > > Now when I try to open a handle to this driver using the Symbolic
>> > > link name
>> > > I am failing. Before this my driver was under the class name 'Test
>> > > Tools'
>> > > with some other GUID and WinXP 32 and 64 bit didn't have any problems
>> > > with it.
>> >
>> > What is the error returned from CreateFile?
>> >
>> > --PA



Re: Obtaining Driver handle in Vista using CreateFile() by ramjohnny

ramjohnny
Fri Sep 15 12:04:02 CDT 2006

I did Pavel had suggested in terms of getting the GetLastError(). The last
error returned was 'Access denied'. I turned off the User Account control and
then everything worked without problems. I didn't even have to use the GUID
of the class: System devices. thanks for the help guys.
--
Ram
Driver Developer


"Doron Holan [MS]" wrote:

> post the code in your KMDF driver which creates the device and the symbolic
> link. are you doing this in DriverEntry()?
>
> d
>
> --
> Please do not send e-mail directly to this alias. this alias is for
> newsgroup purposes only.
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "Pavel A." <pavel_a@NOwritemeNO.com> wrote in message
> news:6BDFA24F-29DE-4CC2-AA2E-B9210D1E811A@microsoft.com...
> > What is GetLastError() ?
> >
> > Also, try 0 instead of GENERIC_READ
> >
> > --PA
> >
> >
> > "ramjohnny" wrote:
> >
> >> I get an INVALID_HANDLE_VALUE.
> >>
> >> This is the piece of code:
> >>
> >> h = CreateFile("\\\\.\\SAD_Dev", GENERIC_READ, 0, NULL,
> >> OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
> >> if(h == INVALID_HANDLE_VALUE) // Was the device opened?
> >> {
> >> return FALSE;
> >> }
> >>
> >> return TRUE;
> >>
> >> --
> >> Ram
> >> Driver Developer
> >>
> >>
> >> "Pavel A." wrote:
> >>
> >> > "ramjohnny" wrote:
> >> >
> >> > > Now when I try to open a handle to this driver using the Symbolic
> >> > > link name
> >> > > I am failing. Before this my driver was under the class name 'Test
> >> > > Tools'
> >> > > with some other GUID and WinXP 32 and 64 bit didn't have any problems
> >> > > with it.
> >> >
> >> > What is the error returned from CreateFile?
> >> >
> >> > --PA
>
>
>

Re: Obtaining Driver handle in Vista using CreateFile() by usfinecats

usfinecats
Tue Mar 20 20:37:05 CDT 2007

I've got the same problem, how do I turn off user account controls? are
there consequences to this? Is this a programatic solution, or do I need to
tell my user community to do something to their computers?
--
Gak -
Finecats


"ramjohnny" wrote:

> I did Pavel had suggested in terms of getting the GetLastError(). The last
> error returned was 'Access denied'. I turned off the User Account control and
> then everything worked without problems. I didn't even have to use the GUID
> of the class: System devices. thanks for the help guys.
> --
> Ram
> Driver Developer
>
>
> "Doron Holan [MS]" wrote:
>
> > post the code in your KMDF driver which creates the device and the symbolic
> > link. are you doing this in DriverEntry()?
> >
> > d
> >
> > --
> > Please do not send e-mail directly to this alias. this alias is for
> > newsgroup purposes only.
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> >
> >
> > "Pavel A." <pavel_a@NOwritemeNO.com> wrote in message
> > news:6BDFA24F-29DE-4CC2-AA2E-B9210D1E811A@microsoft.com...
> > > What is GetLastError() ?
> > >
> > > Also, try 0 instead of GENERIC_READ
> > >
> > > --PA
> > >
> > >
> > > "ramjohnny" wrote:
> > >
> > >> I get an INVALID_HANDLE_VALUE.
> > >>
> > >> This is the piece of code:
> > >>
> > >> h = CreateFile("\\\\.\\SAD_Dev", GENERIC_READ, 0, NULL,
> > >> OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
> > >> if(h == INVALID_HANDLE_VALUE) // Was the device opened?
> > >> {
> > >> return FALSE;
> > >> }
> > >>
> > >> return TRUE;
> > >>
> > >> --
> > >> Ram
> > >> Driver Developer
> > >>
> > >>
> > >> "Pavel A." wrote:
> > >>
> > >> > "ramjohnny" wrote:
> > >> >
> > >> > > Now when I try to open a handle to this driver using the Symbolic
> > >> > > link name
> > >> > > I am failing. Before this my driver was under the class name 'Test
> > >> > > Tools'
> > >> > > with some other GUID and WinXP 32 and 64 bit didn't have any problems
> > >> > > with it.
> > >> >
> > >> > What is the error returned from CreateFile?
> > >> >
> > >> > --PA
> >
> >
> >