Re: DeleteFileW returns incorrect error code in Vista for DLLs
- From: "Alexander Grigoriev" <alegr@xxxxxxxxxxxxx>
- Date: Wed, 15 Aug 2007 08:11:02 -0700
Could msgres.dll be loaded into another process at that time?
"Jon Potter" <gpsoft@xxxxxxxxxxxxx> wrote in message
news:e7W$iEs3HHA.5740@xxxxxxxxxxxxxxxxxxxxxxx
Hi,
I've found what seems to be a bug in the DeleteFileW function in Vista, I
was just wondering if this was known about already:
It seems that DeleteFileW can return an incorrect error code when
attempting to delete a DLL that is in use, _if elevation is used_.
For example, deleting an in-use DLL from the Program Files folder.
Normally this would return ERROR_SHARING_VIOLATION, however because
elevation is needed, ERROR_ACCESS_DENIED is return. This is fine, but if
elevation permission is then granted and the delete is tried again,
ERROR_ACCESS_DENIED is still returned.
You can demonstrate this quite easily using a DOS prompt. First, a
non-admin DOS prompt:
C:\Program Files\MSN Messenger>del msnmsgr.exe
C:\Program Files\MSN Messenger\msnmsgr.exe
Access is denied.
C:\Program Files\MSN Messenger>del msgsres.dll
C:\Program Files\MSN Messenger\msgsres.dll
Access is denied.
These are the expected results. However, with an administrator DOS prompt,
the results are surprising:
C:\Program Files\MSN Messenger>del msgsres.dll
C:\Program Files\MSN Messenger\msgsres.dll
Access is denied.
C:\Program Files\MSN Messenger>del msnmsgr.exe
C:\Program Files\MSN Messenger\msnmsgr.exe
The process cannot access the file because it is being used by another
process.
As you can see, the correct error code is returned for the .exe, but the
.dll error code is wrong (even though both files are in use.)
In XP, or in the case of in-use files in Vista for which elevation is not
needed in order to delete them, ERROR_SHARING_VIOLATION is returned for
both EXEs and DLLs.
Can anyone confirm this?
Cheers,
Jon
.
- Follow-Ups:
- Re: DeleteFileW returns incorrect error code in Vista for DLLs
- From: Jon Potter
- Re: DeleteFileW returns incorrect error code in Vista for DLLs
- References:
- DeleteFileW returns incorrect error code in Vista for DLLs
- From: Jon Potter
- DeleteFileW returns incorrect error code in Vista for DLLs
- Prev by Date: Re: CreateFile Question
- Next by Date: Re: DeleteFileW returns incorrect error code in Vista for DLLs
- Previous by thread: RE: DeleteFileW returns incorrect error code in Vista for DLLs
- Next by thread: Re: DeleteFileW returns incorrect error code in Vista for DLLs
- Index(es):
Relevant Pages
|