Commit cf188c83 authored by Erich E. Hoover's avatar Erich E. Hoover Committed by Vitaly Lipatov

ntdll: Strip the wine prefix from reparse point paths external to the prefix.

parent ddc31659
......@@ -6031,6 +6031,33 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer,
}
void strip_external_path( char *path, SIZE_T *len )
{
static char *unix_root = NULL;
static int unix_root_len = 0;
if (unix_root == NULL)
{
OBJECT_ATTRIBUTES attr;
UNICODE_STRING nameW;
WCHAR *nt_name;
if (unix_to_nt_file_name( "/", &nt_name ) != STATUS_SUCCESS) return;
nameW.Buffer = nt_name;
nameW.Length = wcslen(nt_name) * sizeof(WCHAR);
InitializeObjectAttributes( &attr, &nameW, OBJ_CASE_INSENSITIVE, 0, NULL );
nt_to_unix_file_name( &attr, &unix_root, FILE_OPEN );
free( nt_name );
if (unix_root == NULL) return;
unix_root_len = strlen(unix_root);
}
if (strncmp( unix_root, path, unix_root_len ) != 0) return;
*len -= unix_root_len;
memmove( path, &path[unix_root_len - 1], *len + 1 );
}
/*
* Retrieve the unix name corresponding to a file handle, remove that directory, and then symlink
* the requested directory to the location of the old directory.
......@@ -6175,6 +6202,8 @@ have_dest:
goto cleanup;
}
}
else
strip_external_path( unix_dest, &unix_dest_len );
TRACE( "Linking %s to %s\n", unix_src, &unix_dest[relative_offset] );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment