none
GetFinalPathNameByHandle(,VOLUME_NAME_DOS) function is not working inside container RRS feed

  • Question

  • Hello,

       I'm using Windows Server 2016 TP5.

       Simple container created using: New-Container -Name test2 -ContainerImageName WindowsServerCore

       I am having issues when trying to call function GetFinalPathNameByHandle using any path inside container.

    Sample code:

    	WCHAR path[] = L"C:\\test";
    	HANDLE h = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
    	_tprintf(L"Opened file %s, handle: %x\n", path, h);
    
    	WCHAR pFilePath[MAX_PATH];
    	DWORD filePathLen = MAX_PATH + 1;
    
    	DWORD retLen = ::GetFinalPathNameByHandle(h, pFilePath, filePathLen, VOLUME_NAME_DOS | FILE_NAME_NORMALIZED);
    	if (retLen) {
    		_tprintf(L"GetFinalPathNameByHandle(VOLUME_NAME_DOS) returned: %s\n", pFilePath);
    	} else {
    		_tprintf(L"Error: GetFinalPathNameByHandle(VOLUME_NAME_DOS) returned 0\n");
    	}

      while trying to run this sample inside container I got "The system cannot find the path specified." error.

      However, when I'm trying to use different VOLUME_NAME_* options for this function, I have normal response:

    Error: GetFinalPathNameByHandle(VOLUME_NAME_DOS) returned 0
    GetFinalPathNameByHandle(VOLUME_NAME_GUID) returned: \\?\Volume{f0df3b20-2090-11e6-a55a-e17674463e5d}\test
    GetFinalPathNameByHandle(VOLUME_NAME_NONE) returned: \test
    GetFinalPathNameByHandle(VOLUME_NAME_NT) returned: \Device\HarddiskVolume23\test

      As I understand container should have isolated drive letter for all functions inside. I'm opening file using "C:\test", but I cannot get C:\test back.

      What is desired behavior of this function inside container?

     

    Tuesday, May 24, 2016 7:47 AM

All replies