summaryrefslogtreecommitdiffhomepage
path: root/src/debug
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-07-17 03:00:30 -0400
committermidipix <writeonce@midipix.org>2016-07-21 03:47:29 -0400
commitacafe9829b0534d0b052f7382c77ea7fc753260c (patch)
tree9ca8b391b62662608888120be507a4c84b3c85b3 /src/debug
parentcc22daecf6700070d7a4955f1a2a0847287b0b8d (diff)
downloadptycon-acafe9829b0534d0b052f7382c77ea7fc753260c.tar.bz2
ptycon-acafe9829b0534d0b052f7382c77ea7fc753260c.tar.xz
internals: ptyc_open_file(), ptyc_open_dir(): [implementation and] integration.
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/ptyc_dbg_cat.c53
1 files changed, 1 insertions, 52 deletions
diff --git a/src/debug/ptyc_dbg_cat.c b/src/debug/ptyc_dbg_cat.c
index 9cb54f6..e8cfb16 100644
--- a/src/debug/ptyc_dbg_cat.c
+++ b/src/debug/ptyc_dbg_cat.c
@@ -11,57 +11,6 @@
#include <ptycon/ptycon.h>
#include "ptycon_driver_impl.h"
-static int32_t ptyc_open(void ** hfile, void * hat, const char * arg)
-{
- int32_t status;
- nt_oa oa;
- nt_iosb iosb;
- nt_unicode_string path;
- nt_unicode_conversion_params_utf8_to_utf16 params = {0,0,0,0,0,0,0,0,0};
- wchar16_t buffer[4096];
- wchar16_t * wch;
- size_t nbytes;
-
- /* utf-8 --> utf-16 */
- params.src = (const unsigned char *)arg;
- params.src_size_in_bytes= ntapi->tt_string_null_offset_multibyte(arg);
- params.dst = buffer;
- params.dst_size_in_bytes= sizeof(buffer);
-
- if ((status = ntapi->uc_convert_unicode_stream_utf8_to_utf16(&params)))
- return status;
-
- /* convenience */
- for (wch=buffer, nbytes=params.bytes_written; nbytes; ) {
- if (*wch == '/')
- *wch = '\\';
-
- nbytes -= sizeof(wchar16_t);
- wch++;
- }
-
- /* path */
- path.maxlen = 0;
- path.strlen = (uint16_t)params.bytes_written;
- path.buffer = buffer;
-
- /* oa */
- oa.len = sizeof(nt_oa);
- oa.root_dir = hat;
- oa.obj_name = &path;
- oa.obj_attr = 0;
- oa.sec_desc = 0;
- oa.sec_qos = 0;
-
- /* open */
- return ntapi->zw_open_file(
- hfile,
- NT_SEC_SYNCHRONIZE | NT_FILE_READ_ATTRIBUTES | NT_FILE_READ_DATA,
- &oa,&iosb,
- NT_FILE_SHARE_READ | NT_FILE_SHARE_WRITE | NT_FILE_SHARE_DELETE,
- NT_FILE_NON_DIRECTORY_FILE | NT_FILE_SYNCHRONOUS_IO_ALERT);
-}
-
static int32_t ptyc_cat(
struct ptyc_driver_ctx* dctx,
void * hat,
@@ -75,7 +24,7 @@ static int32_t ptyc_cat(
uintptr_t buffer[32768/sizeof(uintptr_t)];
char * ch;
- if ((status = ptyc_open(&hfile,hat,unit)))
+ if ((status = ptyc_open_file(&hfile,hat,unit,true)))
return status;
status = ntapi->zw_read_file(