Platform SDK: Files and I/O |
The QueryDosDevice function retrieves information about MS-DOS device names. The function can obtain the current mapping for a particular MS-DOS device name. The function can also obtain a list of all existing MS-DOS device names.
MS-DOS device names are stored as symbolic links in the object name space. The code that converts an MS-DOS path into a corresponding path uses these symbolic links to map MS-DOS devices and drive letters. The QueryDosDevice function provides a mechanism whereby a Win32-based application can query the names of the symbolic links used to implement the MS-DOS device namespace as well as the value of each specific symbolic link.
DWORD QueryDosDevice( LPCTSTR lpDeviceName, // MS-DOS device name string LPTSTR lpTargetPath, // query results buffer DWORD ucchMax // maximum size of buffer );
This parameter can be NULL. In that case, the QueryDosDevice function will store a list of all existing MS-DOS device names into the buffer pointed to by lpTargetPath.
If lpDeviceName is non-NULL, the function retrieves information about the particular MS-DOS device specified by lpDeviceName. The first null-terminated string stored into the buffer is the current mapping for the device. The other null-terminated strings represent undeleted prior mappings for the device.
If lpDeviceName is NULL, the function retrieves a list of all existing MS-DOS device names. Each null-terminated string stored into the buffer is the name of an existing MS-DOS device.
If the function succeeds, the return value is the number of TCHARs stored into the buffer pointed to by lpTargetPath.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
The DefineDosDevice function provides a means whereby a Win32-based application can create and modify the symbolic links used to implement the MS-DOS device namespace.
MS-DOS device names are global. After is it defined, an MS-DOS device name remains visible to all processes until either it is explicity removed or the system restarts.
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 98.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000.