No formal product support is available from Microsoft for this Beta product. For information about obtaining support for a Beta release, please see the documentation included with the Beta product files, or check the Web location from which you downloaded the release. The information in this article applies to:
SUMMARYDevices like hard disks, serial ports, and parallel ports have an internal Windows NT device name and may optionally have an MS-DOS device name. These names are located in the Windows NT Object Manager's namespace. While Windows NT itself and kernel-mode drivers use NT device names, Win32 programs must use the MS-DOS device names. The MS-DOS device name is a symbolic link to the underlying NT device name. This article explains device names, symbolic links, and how Win32 programs can create and remove symbolic links. MORE INFORMATIONInternal NT Device NamesWhen a kernel-mode device driver is loaded, its initialization routine registers a device name with Windows NT's Object Manager. This name is referred to as the Windows NT device name. The kernel-mode components of Windows NT and kernel-mode drivers reference devices by their Windows NT device names. These names have a format, such as \Device\CDRom0 and \Device\Serial0 and also exist in the \device directory of the Object Manager's namespace.Win32 programs cannot use internal Windows NT device names to access devices because the Win32 subsystem and Win32 API require the more familiar drive letters and MS-DOS device names, such as A:, C:, COM1:, and LPT1:. Although Win32 programs may not use Windows NT device names, they can however, define and remove MS-DOS device names to access devices. They can also retrieve the internal Windows NT device name associated with an MS-DOS device name. The example code in the "Symbolic Links" section of this article demonstrates how to do this. To gain a better understanding of how the Object Manager tracks names to devices and other system objects, you can view the Object Manager's namespace with the WinObj.exe tool in the Platform SDK. MS-DOS Device NamesWin32 programs use devices like drives, serial ports, and parallel ports through their MS-DOS device names. For disk drives, these are drive letters like A: and C:. For serial and parallel ports these are names like COM1:, COM2:, and LPT1:. Like Windows NT device names, these names reside in the Object Manager's namespace, but in the \?? directory, which is visible to user-mode Win32 programs.What makes MS-DOS device names different from Windows NT device names is that they are not used by the Windows NT kernel or kernel-mode drivers. Their purpose is simply to refer to Windows NT device names so that Win32 programs can use the familiar drive letters and device names; for example, COM1:, to access the Windows NT devices. Thus, MS-DOS device names are called "symbolic links" to Windows NT device names. That is, an MS-DOS device name exists in the Object Manager's \?? directory and points to a Windows NT device name in the Object Manager's \device directory. Each MS-DOS device name can point to at most one internal Windows NT device. However, multiple MS-DOS device names can point to a single device. For example, while C: can only point to a single partition, it is possible to have two or more drive letters, like D:, E:, and Z:, point to the same partition. Symbolic LinksSymbolic links created by the system persist across computer restarts because they are stored in the registry. Applications may also create symbolic links with the DefineDosDevice() API. These links are valid only until the computer is restarted or turned off unless the registry keys containing information about the links are updated.There can be multiple symbolic links to a Windows NT device name. However, only the MS-DOS device name that the system initially assigned to the internal Windows NT device remains across reboots. Therefore, it is possible to create additional symbolic links that assign multiple drive letters to a single CD-ROM drive, but the additional drive letters will only remain until the machine is turned off or restarted. Win32 programs can retrieve the Windows NT device name that is associated with a given MS-DOS device name by calling QueryDosDevice() with the MS-DOS device name. Following is example code that shows how to do this:
Win32 programs can create and delete symbolic links by calling
DefineDosDevice(). To create a symbolic link, call DefineDosDevice with the
DDD_RAW_TARGET_PATH flag. To remove a symbolic link, call it with the
DDD_REMOVE_DEFINITION and DDD_RAW_TARGET_PATH flags. The following sample
program demonstrates both of these operations:
Additional query words: DOS DEVICE
Keywords : kbKernBase kbNTOS400 kbWinOS2000 kbSDKPlatform kbSDKWin32 kbDSupport kbGrpKernBase |
Last Reviewed: January 11, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |