diff options
author | midipix <writeonce@midipix.org> | 2016-06-29 10:49:47 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-06-29 19:16:37 -0400 |
commit | f7b99942f85f4c8c35058f1a8b1194cd4468bc6d (patch) | |
tree | 890e0f326a2d0fbee61ae6062f26a4bd9dbef90c /src/process | |
parent | a2ea1bdf70166f887457b5462332d2df4f6f54c5 (diff) | |
download | ntapi-f7b99942f85f4c8c35058f1a8b1194cd4468bc6d.tar.bz2 ntapi-f7b99942f85f4c8c35058f1a8b1194cd4468bc6d.tar.xz |
free-standing environment: remove fluff from the argv/envp parsing facility.
Diffstat (limited to 'src/process')
-rw-r--r-- | src/process/ntapi_tt_get_runtime_data.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/process/ntapi_tt_get_runtime_data.c b/src/process/ntapi_tt_get_runtime_data.c index 4513570..e5a7d55 100644 --- a/src/process/ntapi_tt_get_runtime_data.c +++ b/src/process/ntapi_tt_get_runtime_data.c @@ -23,11 +23,11 @@ static wchar16_t runtime_arg[20] = { int32_t __stdcall __ntapi_tt_get_runtime_data( __out nt_runtime_data ** rtdata, - __in wchar16_t ** argv) + __in wchar16_t ** wargv) { int32_t status; nt_process_parameters * process_params; - nt_cmd_option_meta_utf16 cmd_opt_meta; + wchar16_t * addrarg; nt_runtime_data buffer; nt_runtime_data * prtdata; ntapi_internals * __internals; @@ -41,22 +41,24 @@ int32_t __stdcall __ntapi_tt_get_runtime_data( return NT_STATUS_SUCCESS; } - if (!(argv = argv ? argv : __internals->ntapi_img_sec_bss->argv_envp_array)) + if (!(wargv = wargv ? wargv : __internals->ntapi_img_sec_bss->argv_envp_array)) return NT_STATUS_INVALID_PARAMETER_2; + if (!wargv[1] || !wargv[2]) + return NT_STATUS_MORE_PROCESSING_REQUIRED; + /* integral process? */ - if ((status = __ntapi->tt_get_short_option_meta_utf16( - __ntapi->tt_crc32_table(), - 'r', - argv, - &cmd_opt_meta))) - return status; + if ((wargv[1][0] == '-') && (wargv[1][1] == 'r') && (wargv[1][2] == 0)) + addrarg = wargv[2]; + else + return NT_STATUS_INVALID_PARAMETER; - else if (argv[3]) + if (!addrarg || wargv[3]) status = NT_STATUS_INVALID_PARAMETER_MIX; + /* obtain pointer to data block */ if ((status = __ntapi->tt_hex_utf16_to_uintptr( - cmd_opt_meta.value, + addrarg, (uintptr_t *)&prtdata))) return status; |