summaryrefslogtreecommitdiffhomepage
path: root/src/argv
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2017-09-10 18:18:18 +0000
committermidipix <writeonce@midipix.org>2017-09-10 23:08:06 -0400
commita4031208e5dea11cbb0bbc95c402b57b662a94a1 (patch)
tree7e112df61f2a271f5fff985fffeffb0cc57e6be6 /src/argv
parent72ef7534b06e26796b5f608773cf4fb9febab59b (diff)
downloadntapi-a4031208e5dea11cbb0bbc95c402b57b662a94a1.tar.bz2
ntapi-a4031208e5dea11cbb0bbc95c402b57b662a94a1.tar.xz
envp primitives: integrated __ntapi_tt_get_env_var_meta_utf8().
Diffstat (limited to 'src/argv')
-rw-r--r--src/argv/ntapi_tt_env_vars.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/argv/ntapi_tt_env_vars.c b/src/argv/ntapi_tt_env_vars.c
index 9c62eb5..9b671b6 100644
--- a/src/argv/ntapi_tt_env_vars.c
+++ b/src/argv/ntapi_tt_env_vars.c
@@ -8,6 +8,40 @@
#include <ntapi/ntapi.h>
#include "ntapi_impl.h"
+int32_t __stdcall __ntapi_tt_get_env_var_meta_utf8(
+ __in char * env_var_name,
+ __in char ** envp,
+ __out nt_env_var_meta_utf8 * env_var_meta)
+{
+ char ** penv;
+ char * ch;
+
+ /* lookup */
+ for (penv=envp; *penv; penv++) {
+ for (ch=penv[0]; *ch && (*ch != '='); )
+ ch++;
+
+ if (*ch != '=')
+ return NT_STATUS_INVALID_USER_BUFFER;
+
+ if ((ch > *penv) && !(__ntapi->tt_strncmp_multibyte(
+ *penv,
+ env_var_name,
+ ch - *penv))) {
+ /* match */
+ env_var_meta->name = *penv;
+ env_var_meta->value = ++ch;
+ env_var_meta->envp_index = penv - envp;
+ env_var_meta->flags = 0;
+
+ return NT_STATUS_SUCCESS;
+ }
+ }
+
+ return NT_STATUS_NOT_FOUND;
+}
+
+
int32_t __stdcall __ntapi_tt_get_env_var_meta_utf16(
__in wchar16_t * env_var_name,
__in wchar16_t ** envp,