problems using CreateFile

Hi everybody, and sorry for troubling you with
newbies questions, but I have a problem with CreateFile
that I just can’t figure out:

I have a driver, to which I want to connect from my application,
using CreateFile(), and I have 2 processes that try to
attach to the driver.

The first succeeds, and the second fails with error code #2
(ERROR_FILE_NOT_FOUND).

The CreateFile line is this:
CreateFile(SymbolicLinkName,
GENERIC_WRITE | GENERIC_READ,
0,
NULL,
CREATE_ALWAYS,
FILE_FLAG_OVERLAPPED,0);

My guess is that it’s something with the flags, but I don’t seem
to find the correct flag…

thanks in advance,

  • Barak

Barak Mandelovich Mercury Interactive ltd.
xxxxx@conduct.com 19 Shabazi st.
Tel: +972 3 539 9286 Yehud, 56100
Fax: +972 3 533 1617 Israel

When you called IoCreateDevice in the DriverEntry, how did you set the
Exclusive parameter? To allow multiple processes access, you must set it to
FALSE.

Gary

-----Original Message-----
From: Barak Mandelovich [mailto:xxxxx@conduct.com]
Sent: Tuesday, March 21, 2000 4:44 AM
To: NT Developers Interest List
Subject: [ntdev] problems using CreateFile

I have a driver, to which I want to connect from my application,
using CreateFile(), and I have 2 processes that try to
attach to the driver.

The first succeeds, and the second fails with error code #2
(ERROR_FILE_NOT_FOUND).

Hmm, but should setting exclusive == TRUE cause ERROR_FILE_NOT_FOUND to be
returned to the second process? I would have though ERROR_ACCESS_DENIED
would be returned in that case.

  • Matt

From: “Gary Little”
Sent: Tuesday, March 21, 2000 11:09 AM

> When you called IoCreateDevice in the DriverEntry, how did you set the
> Exclusive parameter? To allow multiple processes access, you must set it
to
> FALSE.

[snip]

> From: Barak Mandelovich [mailto:xxxxx@conduct.com]
> To: NT Developers Interest List
>
> > I have a driver, to which I want to connect from my application,
> > using CreateFile(), and I have 2 processes that try to
> > attach to the driver.
> >
> > The first succeeds, and the second fails with error code #2
> > (ERROR_FILE_NOT_FOUND).

[snip]

Have you verified that the value of SymbolicLinkName is identical in both
cases ?

You’ll also need to set FILE_SHARE READ | FILE_SHARE_WRITE to the 3rd
parameter of CreateFile.

As previously pointed out, you’ll need to set the Exclusive bit to FALSE
when calling IoCreateDevice().

Regards,

Paul Bunn, UltraBac.Com, 425-644-6000
Microsoft MVP - WindowsNT
http://www.ultrabac.com

-----Original Message-----
From: Barak Mandelovich [mailto:xxxxx@conduct.com]
Sent: Tuesday, March 21, 2000 4:44 AM
To: NT Developers Interest List
Subject: [ntdev] problems using CreateFile

Hi everybody, and sorry for troubling you with
newbies questions, but I have a problem with CreateFile
that I just can’t figure out:

I have a driver, to which I want to connect from my application,
using CreateFile(), and I have 2 processes that try to
attach to the driver.

The first succeeds, and the second fails with error code #2
(ERROR_FILE_NOT_FOUND).

The CreateFile line is this:
CreateFile(SymbolicLinkName,
GENERIC_WRITE | GENERIC_READ,
0,
NULL,
CREATE_ALWAYS,
FILE_FLAG_OVERLAPPED,0);

My guess is that it’s something with the flags, but I don’t seem
to find the correct flag…

> My guess is that it’s something with the flags, but I don’t seem

to find the correct flag…

Maybe not. The symlink name is
\.\name
where “name” is what will go after "??" in kernel mode.

Max

Maby you need use NtCreateFile instead CreateFIle?
Regards
Mark
Paul Bunn wrote:

Have you verified that the value of SymbolicLinkName is identical in both
cases ?

You’ll also need to set FILE_SHARE READ | FILE_SHARE_WRITE to the 3rd
parameter of CreateFile.

As previously pointed out, you’ll need to set the Exclusive bit to FALSE
when calling IoCreateDevice().

Regards,

Paul Bunn, UltraBac.Com, 425-644-6000
Microsoft MVP - WindowsNT
http://www.ultrabac.com

-----Original Message-----
From: Barak Mandelovich [mailto:xxxxx@conduct.com]
Sent: Tuesday, March 21, 2000 4:44 AM
To: NT Developers Interest List
Subject: [ntdev] problems using CreateFile

Hi everybody, and sorry for troubling you with
newbies questions, but I have a problem with CreateFile
that I just can’t figure out:

I have a driver, to which I want to connect from my application,
using CreateFile(), and I have 2 processes that try to
attach to the driver.

The first succeeds, and the second fails with error code #2
(ERROR_FILE_NOT_FOUND).

The CreateFile line is this:
CreateFile(SymbolicLinkName,
GENERIC_WRITE | GENERIC_READ,
0,
NULL,
CREATE_ALWAYS,
FILE_FLAG_OVERLAPPED,0);

My guess is that it’s something with the flags, but I don’t seem
to find the correct flag…


You are currently subscribed to ntdev as: xxxxx@arx.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)