I have a logging file that my driver writes to on the average of every 10
seconds or so. I have an assertion there to catch if it ever fails, and I
don’t think it ever had until yesterday. It failed just once, after it had
already written to it many times, and after that single failure, it
continued to write to it just fine.
My ZwWriteFile command ended up returning the error 0xC0000054
STATUS_FILE_LOCK_CONFLICT, which apparently means “A requested read/write
cannot be granted due to a conflicting file lock.” I’ve looked around in
the DDK, SDK, NTdev archives, some books, and on The Net, and have come up
with nothing other than that.
I open the file with only SHARED_READ, so it can’t be that someone else was
writing to it.
Does anyone know what this error REALLY means, and what some possible causes
of it could be?
Thanks!
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> My ZwWriteFile command ended up returning the error 0xC0000054
STATUS_FILE_LOCK_CONFLICT, which apparently means “A requested read/write
cannot be granted due to a conflicting file lock.”
I open the file with only SHARED_READ, so it can’t be that someone else was
writing to it.
New information: apparently, somone was copying the file (and thus opened
as read-only) at the time. Again, since I’m only sharing read access, and
they would have only had it open for reading, then why whould that cause a
problem?
I’ve tried reproducing it, but I’ve been unable to, so it’s seemingly some
very particular circumstances.
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> > My ZwWriteFile command ended up returning the error 0xC0000054
> STATUS_FILE_LOCK_CONFLICT, which apparently means “A requested read/write
> cannot be granted due to a conflicting file lock.”
> I open the file with only SHARED_READ, so it can’t be that someone else was
> writing to it.
New information: apparently, somone was using the file (opened
as read-only) at the time. Again, since I’m only sharing read access, and
they would have only had it open for reading, then why whould that cause a
problem?
Newer information:
This only happens if I open the file in Excel 98/2000. It reports that it
is a read-only file, and then once I say to open it as Read-Only, my driver
starts having the problem.
I’ve tried opening it with many other applications, but Excel is the only
program that seems to do it.
Any ideas?
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> My ZwWriteFile command ended up returning the error 0xC0000054
STATUS_FILE_LOCK_CONFLICT, which apparently means “A requested read/write
cannot be granted due to a conflicting file lock.”
I open the file with only SHARED_READ, so it can’t be that someone else was
writing to it.
The answer is that an application opened the file and did a LockFile() on
part(s) of it. Even if you only have read access, you can lock the file,
thus preventing a write. Personally, that seems like a denial-of-service
security issue, but oh well.
There’s no way to prevent it, and if I’m going to share read access, I just
have to deal with the error…
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com