INFO: Accesssing a Device on Windows 2000 Terminal Server Through CreateFile() (259131)



The information in this article applies to:

  • Microsoft Win32 Application Programming Interface (API), when used with:
    • the operating system: Microsoft Windows NT 4.0
    • the operating system: Microsoft Windows 2000

This article was previously published under Q259131

SUMMARY

The CreateFile function allows an application to obtain a handle to a device by specifying the device in the lpFileName parameter by using the following format:

\\.\DEVICEX

When an application obtains a handle to a device in a remote Terminal Server session, the CreateFile function may fail with error code 2 (ERROR_FILE_NOT_FOUND) because the system is searching the local session namespace instead of the global namespace.

To ensure that the system searches for the device in the global namespace, the following format may be used for the device name:

\\.\Global\DEVICEX

Note that the Global keyword is case sensitive.

Modification Type:MajorLast Reviewed:11/18/2003
Keywords:kbinfo KB259131