Skip to main content
CheckNameLegalDOS8Dot3 function

Determines whether the specified name can be used to create a file on a FAT file system.


BOOL WINAPI CheckNameLegalDOS8Dot3(
  _In_      LPCTSTR lpName,
  _Out_opt_ LPSTR   lpOemName,
  _In_      DWORD   OemNameSize,
  _Out_opt_ PBOOL   pbNameContainsSpaces,
  _Out_     PBOOL   pbNameLegal


lpName [in]

The file name, in 8.3 format.

lpOemName [out, optional]

A pointer to a buffer that receives the OEM string that corresponds to Name. This parameter can be NULL.

OemNameSize [in]

The size of the lpOemName buffer, in characters. If lpOemName is NULL, this parameter must be 0 (zero).

pbNameContainsSpaces [out, optional]

Indicates whether or not a name contains spaces. This parameter can be NULL. If the name is not a valid 8.3 FAT file system name, this parameter is undefined.

pbNameLegal [out]

If the function succeeds, this parameter indicates whether a file name is a valid 8.3 FAT file name when the current OEM code page is applied to the file name.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is 0 (zero). To get extended error information, call GetLastError.


This function can be used to determine whether or not a file name can be passed to a 16-bit Windows-based application or an MS-DOS-based application.

In Windows 8 and Windows Server 2012, this function is supported by the following technologies.


Server Message Block (SMB) 3.0 protocol


SMB 3.0 Transparent Failover (TFO)

See remarks

SMB 3.0 with Scale-out File Shares (SO)

See remarks

Cluster Shared Volume File System (CsvFS)


Resilient File System (ReFS)



Note that SMB 3.0 does not support short names on shares with continuous availability capability, so function will always return zero (fail).


Minimum supported client

Windows Vista, Windows XP with SP1 [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]


WinBase.h (include Windows.h)





Unicode and ANSI names

CheckNameLegalDOS8Dot3W (Unicode) and CheckNameLegalDOS8Dot3A (ANSI)

See also

File Management Functions