summaryrefslogtreecommitdiffhomepage
path: root/src/argv
diff options
context:
space:
mode:
Diffstat (limited to 'src/argv')
-rw-r--r--src/argv/ntapi_tt_argv_envp.c58
1 files changed, 31 insertions, 27 deletions
diff --git a/src/argv/ntapi_tt_argv_envp.c b/src/argv/ntapi_tt_argv_envp.c
index 11a9f67..9c769ac 100644
--- a/src/argv/ntapi_tt_argv_envp.c
+++ b/src/argv/ntapi_tt_argv_envp.c
@@ -517,44 +517,48 @@ int32_t __stdcall __ntapi_tt_get_argv_envp_utf16(
rtdata->peb_wenvp = main_params->wenvp_buffer;
/* integral wargv, wenvp, argv, envp */
- if (rtdata->wargv) {
- rtdata->wargv += (uintptr_t)rtdata / sizeof(wchar16_t *);
+ if (!(rtdata->flags & NT_RUNTIME_DATA_ARGV_ENVP_RELOCATED)) {
+ if (rtdata->wargv) {
+ rtdata->wargv += (uintptr_t)rtdata / sizeof(wchar16_t *);
- for (wch_p=rtdata->wargv; *wch_p; wch_p++)
- *wch_p += (uintptr_t)rtdata / sizeof(wchar16_t);
- };
+ for (wch_p=rtdata->wargv; *wch_p; wch_p++)
+ *wch_p += (uintptr_t)rtdata / sizeof(wchar16_t);
+ };
- if (rtdata->wenvp) {
- rtdata->wenvp += (uintptr_t)rtdata / sizeof(wchar16_t *);
+ if (rtdata->wenvp) {
+ rtdata->wenvp += (uintptr_t)rtdata / sizeof(wchar16_t *);
- for (wch_p=rtdata->wenvp; *wch_p; wch_p++)
- *wch_p += (uintptr_t)rtdata / sizeof(wchar16_t);
- }
+ for (wch_p=rtdata->wenvp; *wch_p; wch_p++)
+ *wch_p += (uintptr_t)rtdata / sizeof(wchar16_t);
+ }
- if (rtdata->argv) {
- rtdata->argv += (uintptr_t)rtdata / sizeof(char *);
+ if (rtdata->argv) {
+ rtdata->argv += (uintptr_t)rtdata / sizeof(char *);
- for (ch_p=rtdata->argv; *ch_p; ch_p++)
- *ch_p += (uintptr_t)rtdata;
+ for (ch_p=rtdata->argv; *ch_p; ch_p++)
+ *ch_p += (uintptr_t)rtdata;
- rtdata->argc = (int32_t)(ch_p - rtdata->argv);
- };
+ rtdata->argc = (int32_t)(ch_p - rtdata->argv);
+ };
- if (rtdata->envp) {
- rtdata->envp += (uintptr_t)rtdata / sizeof(char *);
+ if (rtdata->envp) {
+ rtdata->envp += (uintptr_t)rtdata / sizeof(char *);
- for (ch_p=rtdata->envp; *ch_p; ch_p++)
- *ch_p += (uintptr_t)rtdata;
+ for (ch_p=rtdata->envp; *ch_p; ch_p++)
+ *ch_p += (uintptr_t)rtdata;
- rtdata->envc = (int32_t)(ch_p - rtdata->envp);
- };
+ rtdata->envc = (int32_t)(ch_p - rtdata->envp);
+ };
- if (rtdata->w32_envp) {
- rtdata->w32_envp += (uintptr_t)rtdata / sizeof(char *);
+ if (rtdata->w32_envp) {
+ rtdata->w32_envp += (uintptr_t)rtdata / sizeof(char *);
- for (ch_p=rtdata->w32_envp; *ch_p; ch_p++)
- *ch_p += (uintptr_t)rtdata;
- };
+ for (ch_p=rtdata->w32_envp; *ch_p; ch_p++)
+ *ch_p += (uintptr_t)rtdata;
+ };
+
+ rtdata->flags |= NT_RUNTIME_DATA_ARGV_ENVP_RELOCATED;
+ }
}
/* we're good */