[Patch]: NUL and other special names

Pierre A. Humblet pierre@phumblet.no-ip.org
Tue Jun 1 22:12:00 GMT 2004

Christopher Faylor wrote:
> On Mon, May 31, 2004 at 06:46:11PM -0400, Pierre A. Humblet wrote:
> >This patch prevents NtCreateFile from creating files with special
> >names such as NUL.
> >Because this needs to be checked very often, I tried to code it
> >efficiently with a binary search (it can perhaps be reused elsewhere).
> >
> >The new function is_special_name() overlaps with special_name(),
> >although there are small differences (it was designed from tests
> >on XP Home Ed). Perhaps these two can be merged one day.
> Haven't we already done a "GetFileAttributes" on the path by the time
> it reaches the NtCreateFile?  If so, couldn't we just avoid trying to
> create a file which has "bad" attributes?


Yes, we have done a "GetFileAttributes". I just checked the values. 
For AUX, CON, COMx, LPTx, NUL and PRN, the attribute is 0x20,
For conin$, conout$ and clock$ it is FFFFFFFF
So we could filter on those values and only test for special names
if necessary.
Is that what you meant?


More information about the Cygwin-patches mailing list