Training
Module
Manage drivers and device peripherals - Training
This module introduces device drivers. Student will learn how drivers work and the tools used to manage common peripheral devices such as printers.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
An MS-DOS device name is a junction that points to the path of an MS-DOS device. These junctions make up the MS-DOS device namespace. Call the DefineDosDevice and SetVolumeMountPoint functions to create and modify these junctions. DeleteVolumeMountPoint deletes a junction created by SetVolumeMountPoint, and DefineDosDevice deletes junctions it creates.
After an MS-DOS device name is defined, it remains visible to all processes.
Multiple Local MS-DOS Device namespaces and only one Global MS-DOS Device namespace may exist at one time and on one machine.
Note that only processes running in the LocalSystem context can call DefineDosDevice to create an MS-DOS device in the Global MS-DOS device namespace. Also, the Local MS-DOS device namespace corresponding to a specific AuthenticationID is deleted when the last reference to that AuthenticationID is removed.
When your code queries an existing MS-DOS device name by calling QueryDosDevice, it first searches the Local MS-DOS Device namespace. If it is not found there, the function will then search the Global MS-DOS Device namespace. When your code queries all existing MS-DOS device names through this function, the list of names that are returned is dependent on whether it is running in the LocalSystem context. If so, only the MS-DOS device names included in the Global MS-DOS Device namespace will be returned. If not, a concatenation of the device names in the Global and Local MS-DOS Device namespaces will be returned. If a device name exists in both namespaces, QueryDosDevice will return the entry in the Local MS-DOS Device namespace. This also applies to the list of all MS-DOS device names returned by GetLogicalDrives and GetLogicalDriveStrings.
Note that the following scenario may occur:
In this scenario, User A will not have access to the device name in the Global MS-DOS Device namespace until he or she removes or renames the device name in his or her Local MS-DOS Device namespace. To reduce the likelihood of this scenario occurring, MS-DOS drive letters should be allocated in the Global MS-DOS Device namespace starting with C: and ending with Z:. This sequence should be reversed for the allocation of MS-DOS drive letters in the Local MS-DOS Device namespace.
If you are not running within the LocalSystem context, DefineDosDevice will not allow you to define a device name in the Local MS-DOS Device namespace if that device name already exists in your Local or Global MS-DOS Device namespaces. Call QueryDosDevice before calling DefineDosDevice to determine whether the device name you intend to define exists in your MS-DOS Device namespaces.
Training
Module
Manage drivers and device peripherals - Training
This module introduces device drivers. Student will learn how drivers work and the tools used to manage common peripheral devices such as printers.
Documentation
DefineDosDeviceW function (fileapi.h) - Win32 apps
Defines, redefines, or deletes MS-DOS device names. (DefineDosDeviceW)
QueryDosDeviceW function (fileapi.h) - Win32 apps
Retrieves information about MS-DOS device names. (QueryDosDeviceW)
GetVolumeNameForVolumeMountPointW function (fileapi.h) - Win32 apps
Retrieves a volume GUID path for the volume that is associated with the specified volume mount point ( drive letter, volume GUID path, or mounted folder). (GetVolumeNameForVolumeMountPointW)