CheckNameLegalDOS8Dot3A function (winbase.h)

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

Syntax

BOOL CheckNameLegalDOS8Dot3A(
  [in]            LPCSTR lpName,
  [out, optional] LPSTR  lpOemName,
  [in]            DWORD  OemNameSize,
  [out, optional] PBOOL  pbNameContainsSpaces,
  [out]           PBOOL  pbNameLegal
);

Parameters

[in] lpName

The file name, in 8.3 format.

[out, optional] lpOemName

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

[in] OemNameSize

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

[out, optional] pbNameContainsSpaces

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.

[out] pbNameLegal

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.

Remarks

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.

Technology Supported
Server Message Block (SMB) 3.0 protocol Yes
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) Yes
Resilient File System (ReFS) Yes
 

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

Note

The winbase.h header defines CheckNameLegalDOS8Dot3 as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows Vista, Windows XP with SP1 [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header winbase.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also

File Management Functions

GetOEMCP