Kernel32QueryDosDevice(String, StringBuilder, UInt32) Method

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 junctions in the object namespace. The code that converts an MS-DOS path into a corresponding path uses these junctions to map MS-DOS devices and drive letters.

The QueryDosDevice(String, IntPtr, UInt32) function enables an application to query the names of the junctions used to implement the MS-DOS device Namespace DevCase.Interop.as well as the value of each specific junction.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Kernel32.dll", CharSet = CharSet.Unicode, BestFitMapping = false, 
	ThrowOnUnmappableChar = true, SetLastError = true)]
public static uint QueryDosDevice(
	string deviceName,
	StringBuilder targetPath,
	uint maxChars
)

Parameters

deviceName  String
An MS-DOS device name string specifying the target of the query.

The device name cannot have a trailing backslash; for example, use "C:", not "C:\".

This parameter can be . In that case, the function will store a list of all existing MS-DOS device names into the buffer pointed to by targetPath.

targetPath  StringBuilder
A pointer to a buffer that will receive the result of the query.

The function fills this buffer with one or more null-terminated strings.

The final null-terminated string is followed by an additional NULL.

If deviceName is non-, the function retrieves information about the particular MS-DOS device specified by deviceName. 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 deviceName is , 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, for example, \Device\HarddiskVolume1 or \Device\Floppy0.

maxChars  UInt32
The maximum number of characters that can be stored into the buffer pointed to by targetPath.

Return Value

UInt32
If the function succeeds, the return value is the number of characters stored into the buffer pointed to by targetPath.

If the function fails, the return value is zero.

To get extended error information, call GetLastWin32Error.

If the buffer is too small, the function fails and the last error code is ERROR_INSUFFICIENT_BUFFER.

Remarks

See Also