diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/internal/ptycon_open_impl.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/internal/ptycon_open_impl.c b/src/internal/ptycon_open_impl.c index 8ab9d61..24318fd 100644 --- a/src/internal/ptycon_open_impl.c +++ b/src/internal/ptycon_open_impl.c @@ -67,12 +67,42 @@ static int32_t ptyc_open( options | NT_FILE_SYNCHRONOUS_IO_ALERT); } +static int32_t ptyc_open_volume( + void ** hfile, + void * hat, + const char * arg, + uint32_t options, + bool fprivate) +{ + int32_t status; + void * hvolume = 0; + wchar16_t drive = arg[0]; + + if ((arg[1]==':') && ((arg[2]=='\\') || (arg[2]=='/'))) { + if ((status = ntapi->tt_get_dos_drive_root_handle( + &hvolume,&drive))) + return status; + + hat = hvolume; + arg = &arg[3]; + } + + status = ptyc_open( + hfile,hat,arg, + options,fprivate); + + if (hvolume) + ntapi->zw_close(hvolume); + + return status; +} + int32_t ptyc_open_file(void ** hfile, void * hat, const char * arg, bool fprivate) { - return ptyc_open(hfile,hat,arg,NT_FILE_NON_DIRECTORY_FILE,fprivate); + return ptyc_open_volume(hfile,hat,arg,NT_FILE_NON_DIRECTORY_FILE,fprivate); } int32_t ptyc_open_dir(void ** hfile, void * hat, const char * arg, bool fprivate) { - return ptyc_open(hfile,hat,arg,NT_FILE_DIRECTORY_FILE,fprivate); + return ptyc_open_volume(hfile,hat,arg,NT_FILE_DIRECTORY_FILE,fprivate); } |