summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-08-07 13:00:48 -0400
committermidipix <writeonce@midipix.org>2016-08-10 21:47:34 -0400
commit83af1d349100c3cdf6455fab2887b0d93466594f (patch)
tree8e4cbf0b0d7d6ac4a3caad05a9b9b338da54d94d /src
parent77a70734c980d1afa24c8d91112edf0d6374ed3c (diff)
downloadptycon-83af1d349100c3cdf6455fab2887b0d93466594f.tar.bz2
ptycon-83af1d349100c3cdf6455fab2887b0d93466594f.tar.xz
driver: --sysroot: support dos drive notation.
Diffstat (limited to 'src')
-rw-r--r--src/internal/ptycon_open_impl.c34
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);
}