EldoS | Feel safer!

Software components for data protection, secure storage and transfer

ReparseFileNameRule behavior with DeviceIoControl

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#33906
Posted: 07/06/2015 18:17:46
by umair sadiq (Basic support level)
Joined: 01/23/2015
Posts: 7

I want to ask if DeviceIoControl works correctly with ReparseFileNameRule
1. I have a ReparseFileNameRule that redirects C:\foo to D:\foo.
2. I send two commands, a CreateFile for C:\foo with FILE_FLAG_OPEN_REPARSE_POINT followed by DeviceIoControl with FSCTL_GET_REPARSE_POINT using the handle returned by CreateFile.
3. The DeviceIOControl returns NOT_A_REPARSE_POINT.

To my understanding:
C:\foo is a ReparsePoint (because I added a ReparseFileNameRule C:\foo -> D:\foo)
D:\foo is a directory and not a ReparsePoint.

Therefore,
CreateFile(C:\foo,FILE_FLAG_OPEN_REPARSE_POINT)+DeviceIoControl should open the ReparsePoint
CreateFile(D:\foo,FILE_FLAG_OPEN_REPARSE_POINT)+DeviceIoControl should return ERROR_NOT_A_REPARSE_POINT

Currently,
CreateFile(C:\foo,FILE_FLAG_OPEN_REPARSE_POINT)+DeviceIoControl returns NOT_A_REPARSE_POINT as the call gets redirected.

Is this expected behaviour or is there a workaround to handle DeviceIOControl correctly?

The code for CreateFile and DeviceIoControl message is as follows:

Code
      handle = CreateFile(
                 L"C:\\foo",
                 FILE_READ_ATTRIBUTES,
                 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
                 NULL,
                 OPEN_EXISTING,
                 FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS,
                 NULL);


      const DWORD size = REPARSE_GUID_DATA_BUFFER_HEADER_SIZE + 1024*1024;
      char buf[size];
      DWORD bytes_read;
      BOOL result = DeviceIoControl(
                handle,
                FSCTL_GET_REPARSE_POINT,
                NULL,
                0,
                (LPVOID)buf,
                size,
                &bytes_read,
                NULL);
#33907
Posted: 07/06/2015 18:31:08
by Vladimir Cherniga (EldoS Corp.)

Reparse file name rule doesn't create reparse point, thus it doesn't support DeviceIoControl requests. Reparse file name uses reparse mechanism implemented in Windows and allow to dynamically change target file name in open/create request. Set/Get/Delete reparse point is not supported. Only file name redirection.
#33937
Posted: 07/07/2015 22:32:27
by umair sadiq (Basic support level)
Joined: 01/23/2015
Posts: 7

I see. All right, thank you for the clarification.

Reply

Statistics

Topic viewed 3942 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!