2 * Ntdll environment functions
4 * Copyright 1996, 1998 Alexandre Julliard
5 * Copyright 2003 Eric Pouech
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include <sys/types.h>
27 #define WIN32_NO_STATUS
30 #include "wine/debug.h"
31 #include "ntdll_misc.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(environ
);
36 static WCHAR empty
[] = L
"";
37 static const UNICODE_STRING empty_str
= { 0, sizeof(empty
), empty
};
38 static const UNICODE_STRING null_str
= { 0, 0, NULL
};
40 static const BOOL is_win64
= (sizeof(void *) > sizeof(int));
42 static inline SIZE_T
get_env_length( const WCHAR
*env
)
44 const WCHAR
*end
= env
;
45 while (*end
) end
+= wcslen(end
) + 1;
50 /***********************************************************************
51 * set_wow64_environment
53 * Set the environment variables that change across 32/64/Wow64.
55 static void set_wow64_environment( WCHAR
**env
)
57 static WCHAR archW
[] = L
"PROCESSOR_ARCHITECTURE";
58 static WCHAR arch6432W
[] = L
"PROCESSOR_ARCHITEW6432";
61 UNICODE_STRING arch_strW
= { sizeof(archW
) - sizeof(WCHAR
), sizeof(archW
), archW
};
62 UNICODE_STRING arch6432_strW
= { sizeof(arch6432W
) - sizeof(WCHAR
), sizeof(arch6432W
), arch6432W
};
63 UNICODE_STRING valW
= { 0, sizeof(buf
), buf
};
66 /* set the PROCESSOR_ARCHITECTURE variable */
68 if (!RtlQueryEnvironmentVariable_U( *env
, &arch6432_strW
, &valW
))
72 RtlSetEnvironmentVariable( env
, &arch_strW
, &valW
);
73 RtlSetEnvironmentVariable( env
, &arch6432_strW
, NULL
);
76 else if (NtCurrentTeb64() && !RtlQueryEnvironmentVariable_U( *env
, &arch_strW
, &valW
))
78 RtlSetEnvironmentVariable( env
, &arch6432_strW
, &valW
);
79 RtlInitUnicodeString( &nameW
, L
"x86" );
80 RtlSetEnvironmentVariable( env
, &arch_strW
, &nameW
);
83 /* set the ProgramFiles variables */
85 RtlInitUnicodeString( &nameW
, is_win64
? L
"ProgramW6432" : L
"ProgramFiles(x86)" );
86 if (!RtlQueryEnvironmentVariable_U( *env
, &nameW
, &valW
))
88 RtlInitUnicodeString( &nameW
, L
"ProgramFiles" );
89 RtlSetEnvironmentVariable( env
, &nameW
, &valW
);
92 /* set the CommonProgramFiles variables */
94 RtlInitUnicodeString( &nameW
, is_win64
? L
"CommonProgramW6432" : L
"CommonProgramFiles(x86)" );
95 if (!RtlQueryEnvironmentVariable_U( *env
, &nameW
, &valW
))
97 RtlInitUnicodeString( &nameW
, L
"CommonProgramFiles" );
98 RtlSetEnvironmentVariable( env
, &nameW
, &valW
);
101 RtlReAllocateHeap( GetProcessHeap(), HEAP_REALLOC_IN_PLACE_ONLY
, *env
,
102 get_env_length(*env
) * sizeof(WCHAR
) );
106 /******************************************************************************
107 * RtlCreateEnvironment [NTDLL.@]
109 NTSTATUS WINAPI
RtlCreateEnvironment(BOOLEAN inherit
, PWSTR
* env
)
113 TRACE("(%u,%p)!\n", inherit
, env
);
118 size
= get_env_length( NtCurrentTeb()->Peb
->ProcessParameters
->Environment
) * sizeof(WCHAR
);
119 if ((*env
= RtlAllocateHeap( GetProcessHeap(), 0, size
)))
120 memcpy( *env
, NtCurrentTeb()->Peb
->ProcessParameters
->Environment
, size
);
123 else *env
= RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(WCHAR
) );
125 return *env
? STATUS_SUCCESS
: STATUS_NO_MEMORY
;
128 /******************************************************************************
129 * RtlDestroyEnvironment [NTDLL.@]
131 NTSTATUS WINAPI
RtlDestroyEnvironment(PWSTR env
)
133 RtlFreeHeap( GetProcessHeap(), 0, env
);
134 return STATUS_SUCCESS
;
137 static LPCWSTR
ENV_FindVariable(PCWSTR var
, PCWSTR name
, unsigned namelen
)
141 /* match var names, but avoid setting a var with a name including a '='
142 * (a starting '=' is valid though)
144 unsigned int len
= wcslen( var
);
146 var
[namelen
] == '=' &&
147 !RtlCompareUnicodeStrings( var
, namelen
, name
, namelen
, TRUE
) &&
148 wcschr(var
+ 1, '=') == var
+ namelen
)
150 return var
+ namelen
+ 1;
157 /******************************************************************
158 * RtlQueryEnvironmentVariable_U [NTDLL.@]
160 * NOTES: when the buffer is too small, the string is not written, but if the
161 * terminating null char is the only char that cannot be written, then
162 * all chars (except the null) are written and success is returned
163 * (behavior of Win2k at least)
165 NTSTATUS WINAPI
RtlQueryEnvironmentVariable_U(PWSTR env
,
166 PUNICODE_STRING name
,
167 PUNICODE_STRING value
)
169 NTSTATUS nts
= STATUS_VARIABLE_NOT_FOUND
;
173 TRACE("%p %s %p\n", env
, debugstr_us(name
), value
);
176 namelen
= name
->Length
/ sizeof(WCHAR
);
177 if (!namelen
) return nts
;
182 var
= NtCurrentTeb()->Peb
->ProcessParameters
->Environment
;
186 var
= ENV_FindVariable(var
, name
->Buffer
, namelen
);
189 value
->Length
= wcslen(var
) * sizeof(WCHAR
);
191 if (value
->Length
<= value
->MaximumLength
)
193 memmove(value
->Buffer
, var
, min(value
->Length
+ sizeof(WCHAR
), value
->MaximumLength
));
194 nts
= STATUS_SUCCESS
;
196 else nts
= STATUS_BUFFER_TOO_SMALL
;
199 if (!env
) RtlReleasePebLock();
205 /******************************************************************
206 * RtlQueryEnvironmentVariable [NTDLL.@]
208 NTSTATUS WINAPI
RtlQueryEnvironmentVariable( WCHAR
*env
, const WCHAR
*name
, SIZE_T namelen
,
209 WCHAR
*value
, SIZE_T value_length
, SIZE_T
*return_length
)
211 NTSTATUS nts
= STATUS_VARIABLE_NOT_FOUND
;
215 if (!namelen
) return nts
;
220 var
= NtCurrentTeb()->Peb
->ProcessParameters
->Environment
;
224 var
= ENV_FindVariable(var
, name
, namelen
);
228 if (len
<= value_length
)
230 memcpy(value
, var
, min(len
+ 1, value_length
) * sizeof(WCHAR
));
231 nts
= STATUS_SUCCESS
;
236 nts
= STATUS_BUFFER_TOO_SMALL
;
239 *return_length
= len
;
241 if (!env
) RtlReleasePebLock();
246 /******************************************************************
247 * RtlSetCurrentEnvironment [NTDLL.@]
250 void WINAPI
RtlSetCurrentEnvironment(PWSTR new_env
, PWSTR
* old_env
)
254 TRACE("(%p %p)\n", new_env
, old_env
);
258 prev
= NtCurrentTeb()->Peb
->ProcessParameters
->Environment
;
259 NtCurrentTeb()->Peb
->ProcessParameters
->Environment
= new_env
;
260 NtCurrentTeb()->Peb
->ProcessParameters
->EnvironmentSize
= RtlSizeHeap( GetProcessHeap(), 0, new_env
);
267 RtlDestroyEnvironment( prev
);
271 /******************************************************************************
272 * RtlSetEnvironmentVariable [NTDLL.@]
274 NTSTATUS WINAPI
RtlSetEnvironmentVariable(PWSTR
* penv
, PUNICODE_STRING name
,
275 PUNICODE_STRING value
)
277 INT varlen
, len
, old_size
;
279 NTSTATUS nts
= STATUS_SUCCESS
;
281 TRACE("(%p, %s, %s)\n", penv
, debugstr_us(name
), debugstr_us(value
));
283 if (!name
|| !name
->Buffer
|| !name
->Length
)
284 return STATUS_INVALID_PARAMETER_1
;
286 len
= name
->Length
/ sizeof(WCHAR
);
288 /* variable names can't contain a '=' except as a first character */
289 for (p
= name
->Buffer
+ 1; p
< name
->Buffer
+ len
; p
++)
290 if (*p
== '=') return STATUS_INVALID_PARAMETER
;
295 env
= NtCurrentTeb()->Peb
->ProcessParameters
->Environment
;
298 old_size
= get_env_length( env
);
300 /* Find a place to insert the string */
301 for (p
= env
; *p
; p
+= varlen
+ 1)
304 if (varlen
> len
&& p
[len
] == '=' &&
305 !RtlCompareUnicodeStrings( name
->Buffer
, len
, p
, len
, TRUE
)) break;
307 if (!value
&& !*p
) goto done
; /* Value to remove doesn't exist */
309 /* Realloc the buffer */
310 len
= value
? len
+ value
->Length
/ sizeof(WCHAR
) + 2 : 0;
311 if (*p
) len
-= wcslen(p
) + 1; /* The name already exists */
315 LPWSTR next
= p
+ wcslen(p
) + 1; /* We know there is a next one */
316 memmove(next
+ len
, next
, (old_size
- (next
- env
)) * sizeof(WCHAR
));
319 if ((old_size
+ len
) * sizeof(WCHAR
) > RtlSizeHeap( GetProcessHeap(), 0, env
))
321 SIZE_T new_size
= (old_size
+ len
) * sizeof(WCHAR
);
322 LPWSTR new_env
= RtlAllocateHeap( GetProcessHeap(), 0, new_size
);
326 nts
= STATUS_NO_MEMORY
;
329 memcpy(new_env
, env
, (p
- env
) * sizeof(WCHAR
));
330 memcpy(new_env
+ (p
- env
) + len
, p
, (old_size
- (p
- env
)) * sizeof(WCHAR
));
331 p
= new_env
+ (p
- env
);
333 RtlDestroyEnvironment(env
);
336 NtCurrentTeb()->Peb
->ProcessParameters
->Environment
= new_env
;
337 NtCurrentTeb()->Peb
->ProcessParameters
->EnvironmentSize
= new_size
;
339 else *penv
= new_env
;
343 if (len
> 0) memmove(p
+ len
, p
, (old_size
- (p
- env
)) * sizeof(WCHAR
));
346 /* Set the new string */
349 memcpy( p
, name
->Buffer
, name
->Length
);
350 p
+= name
->Length
/ sizeof(WCHAR
);
352 memcpy( p
, value
->Buffer
, value
->Length
);
353 p
[value
->Length
/ sizeof(WCHAR
)] = 0;
357 if (!penv
) RtlReleasePebLock();
362 /******************************************************************************
363 * RtlExpandEnvironmentStrings (NTDLL.@)
365 NTSTATUS WINAPI
RtlExpandEnvironmentStrings( const WCHAR
*renv
, WCHAR
*src
, SIZE_T src_len
,
366 WCHAR
*dst
, SIZE_T count
, SIZE_T
*plen
)
368 SIZE_T len
, total_size
= 1; /* 1 for terminating '\0' */
374 env
= NtCurrentTeb()->Peb
->ProcessParameters
->Environment
;
382 for (len
= 0; len
< src_len
; len
++) if (src
[len
] == '%') break;
387 else /* we are at the start of a variable */
389 for (len
= 1; len
< src_len
; len
++) if (src
[len
] == '%') break;
392 if ((var
= ENV_FindVariable( env
, src
+ 1, len
- 1 )))
394 src
+= len
+ 1; /* Skip the variable name */
400 var
= src
; /* Copy original name instead */
406 else /* unfinished variable name, ignore it */
416 if (count
< len
) len
= count
;
417 memcpy(dst
, var
, len
* sizeof(WCHAR
));
423 if (!renv
) RtlReleasePebLock();
425 if (dst
&& count
) *dst
= '\0';
426 if (plen
) *plen
= total_size
;
428 return (count
) ? STATUS_SUCCESS
: STATUS_BUFFER_TOO_SMALL
;
431 /******************************************************************
432 * RtlExpandEnvironmentStrings_U (NTDLL.@)
434 NTSTATUS WINAPI
RtlExpandEnvironmentStrings_U( const WCHAR
*env
, const UNICODE_STRING
*src
,
435 UNICODE_STRING
*dst
, ULONG
*plen
)
440 ret
= RtlExpandEnvironmentStrings( env
, src
->Buffer
, src
->Length
/ sizeof(WCHAR
),
441 dst
->Buffer
, dst
->MaximumLength
/ sizeof(WCHAR
), &len
);
442 if (plen
) *plen
= len
* sizeof(WCHAR
); /* FIXME: check for overflow? */
443 if (len
> UNICODE_STRING_MAX_CHARS
) ret
= STATUS_BUFFER_TOO_SMALL
;
444 if (!ret
) dst
->Length
= (len
- 1) * sizeof(WCHAR
);
448 static inline void normalize( void *base
, WCHAR
**ptr
)
450 if (*ptr
) *ptr
= (WCHAR
*)((char *)base
+ (UINT_PTR
)*ptr
);
453 /******************************************************************************
454 * RtlNormalizeProcessParams [NTDLL.@]
456 PRTL_USER_PROCESS_PARAMETERS WINAPI
RtlNormalizeProcessParams( RTL_USER_PROCESS_PARAMETERS
*params
)
458 if (params
&& !(params
->Flags
& PROCESS_PARAMS_FLAG_NORMALIZED
))
460 normalize( params
, ¶ms
->CurrentDirectory
.DosPath
.Buffer
);
461 normalize( params
, ¶ms
->DllPath
.Buffer
);
462 normalize( params
, ¶ms
->ImagePathName
.Buffer
);
463 normalize( params
, ¶ms
->CommandLine
.Buffer
);
464 normalize( params
, ¶ms
->WindowTitle
.Buffer
);
465 normalize( params
, ¶ms
->Desktop
.Buffer
);
466 normalize( params
, ¶ms
->ShellInfo
.Buffer
);
467 normalize( params
, ¶ms
->RuntimeInfo
.Buffer
);
468 params
->Flags
|= PROCESS_PARAMS_FLAG_NORMALIZED
;
474 static inline void denormalize( const void *base
, WCHAR
**ptr
)
476 if (*ptr
) *ptr
= (WCHAR
*)(UINT_PTR
)((char *)*ptr
- (const char *)base
);
479 /******************************************************************************
480 * RtlDeNormalizeProcessParams [NTDLL.@]
482 PRTL_USER_PROCESS_PARAMETERS WINAPI
RtlDeNormalizeProcessParams( RTL_USER_PROCESS_PARAMETERS
*params
)
484 if (params
&& (params
->Flags
& PROCESS_PARAMS_FLAG_NORMALIZED
))
486 denormalize( params
, ¶ms
->CurrentDirectory
.DosPath
.Buffer
);
487 denormalize( params
, ¶ms
->DllPath
.Buffer
);
488 denormalize( params
, ¶ms
->ImagePathName
.Buffer
);
489 denormalize( params
, ¶ms
->CommandLine
.Buffer
);
490 denormalize( params
, ¶ms
->WindowTitle
.Buffer
);
491 denormalize( params
, ¶ms
->Desktop
.Buffer
);
492 denormalize( params
, ¶ms
->ShellInfo
.Buffer
);
493 denormalize( params
, ¶ms
->RuntimeInfo
.Buffer
);
494 params
->Flags
&= ~PROCESS_PARAMS_FLAG_NORMALIZED
;
500 #define ROUND_SIZE(size) (((size) + sizeof(void *) - 1) & ~(sizeof(void *) - 1))
502 /* append a unicode string to the process params data; helper for RtlCreateProcessParameters */
503 static void append_unicode_string( void **data
, const UNICODE_STRING
*src
,
504 UNICODE_STRING
*dst
)
506 dst
->Length
= src
->Length
;
507 dst
->MaximumLength
= src
->MaximumLength
;
508 if (dst
->MaximumLength
)
511 memcpy( dst
->Buffer
, src
->Buffer
, dst
->Length
);
512 *data
= (char *)dst
->Buffer
+ ROUND_SIZE( dst
->MaximumLength
);
514 else dst
->Buffer
= NULL
;
518 /******************************************************************************
519 * RtlCreateProcessParametersEx [NTDLL.@]
521 NTSTATUS WINAPI
RtlCreateProcessParametersEx( RTL_USER_PROCESS_PARAMETERS
**result
,
522 const UNICODE_STRING
*ImagePathName
,
523 const UNICODE_STRING
*DllPath
,
524 const UNICODE_STRING
*CurrentDirectoryName
,
525 const UNICODE_STRING
*CommandLine
,
527 const UNICODE_STRING
*WindowTitle
,
528 const UNICODE_STRING
*Desktop
,
529 const UNICODE_STRING
*ShellInfo
,
530 const UNICODE_STRING
*RuntimeInfo
,
533 UNICODE_STRING curdir
;
534 const RTL_USER_PROCESS_PARAMETERS
*cur_params
;
535 SIZE_T size
, env_size
= 0;
537 NTSTATUS status
= STATUS_SUCCESS
;
540 cur_params
= NtCurrentTeb()->Peb
->ProcessParameters
;
541 if (!DllPath
) DllPath
= &null_str
;
542 if (!CurrentDirectoryName
)
544 if (NtCurrentTeb()->Tib
.SubSystemTib
) /* FIXME: hack */
545 curdir
= ((WIN16_SUBSYSTEM_TIB
*)NtCurrentTeb()->Tib
.SubSystemTib
)->curdir
.DosPath
;
547 curdir
= cur_params
->CurrentDirectory
.DosPath
;
549 else curdir
= *CurrentDirectoryName
;
550 curdir
.MaximumLength
= MAX_PATH
* sizeof(WCHAR
);
552 if (!CommandLine
) CommandLine
= ImagePathName
;
553 if (!Environment
&& cur_params
) Environment
= cur_params
->Environment
;
554 if (!WindowTitle
) WindowTitle
= &empty_str
;
555 if (!Desktop
) Desktop
= &empty_str
;
556 if (!ShellInfo
) ShellInfo
= &empty_str
;
557 if (!RuntimeInfo
) RuntimeInfo
= &null_str
;
559 if (Environment
) env_size
= get_env_length( Environment
) * sizeof(WCHAR
);
561 size
= (sizeof(RTL_USER_PROCESS_PARAMETERS
)
562 + ROUND_SIZE( ImagePathName
->MaximumLength
)
563 + ROUND_SIZE( DllPath
->MaximumLength
)
564 + ROUND_SIZE( curdir
.MaximumLength
)
565 + ROUND_SIZE( CommandLine
->MaximumLength
)
566 + ROUND_SIZE( WindowTitle
->MaximumLength
)
567 + ROUND_SIZE( Desktop
->MaximumLength
)
568 + ROUND_SIZE( ShellInfo
->MaximumLength
)
569 + ROUND_SIZE( RuntimeInfo
->MaximumLength
));
571 if ((ptr
= RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY
, size
+ ROUND_SIZE( env_size
) )))
573 RTL_USER_PROCESS_PARAMETERS
*params
= ptr
;
574 params
->AllocationSize
= size
;
576 params
->Flags
= PROCESS_PARAMS_FLAG_NORMALIZED
;
577 params
->EnvironmentSize
= ROUND_SIZE( env_size
);
578 if (cur_params
) params
->ConsoleFlags
= cur_params
->ConsoleFlags
;
579 /* all other fields are zero */
582 append_unicode_string( &ptr
, &curdir
, ¶ms
->CurrentDirectory
.DosPath
);
583 append_unicode_string( &ptr
, DllPath
, ¶ms
->DllPath
);
584 append_unicode_string( &ptr
, ImagePathName
, ¶ms
->ImagePathName
);
585 append_unicode_string( &ptr
, CommandLine
, ¶ms
->CommandLine
);
586 append_unicode_string( &ptr
, WindowTitle
, ¶ms
->WindowTitle
);
587 append_unicode_string( &ptr
, Desktop
, ¶ms
->Desktop
);
588 append_unicode_string( &ptr
, ShellInfo
, ¶ms
->ShellInfo
);
589 append_unicode_string( &ptr
, RuntimeInfo
, ¶ms
->RuntimeInfo
);
590 if (Environment
) params
->Environment
= memcpy( ptr
, Environment
, env_size
);
592 if (!(flags
& PROCESS_PARAMS_FLAG_NORMALIZED
)) RtlDeNormalizeProcessParams( params
);
594 else status
= STATUS_NO_MEMORY
;
601 /******************************************************************************
602 * RtlCreateProcessParameters [NTDLL.@]
604 NTSTATUS WINAPI
RtlCreateProcessParameters( RTL_USER_PROCESS_PARAMETERS
**result
,
605 const UNICODE_STRING
*image
,
606 const UNICODE_STRING
*dllpath
,
607 const UNICODE_STRING
*curdir
,
608 const UNICODE_STRING
*cmdline
,
610 const UNICODE_STRING
*title
,
611 const UNICODE_STRING
*desktop
,
612 const UNICODE_STRING
*shellinfo
,
613 const UNICODE_STRING
*runtime
)
615 return RtlCreateProcessParametersEx( result
, image
, dllpath
, curdir
, cmdline
,
616 env
, title
, desktop
, shellinfo
, runtime
, 0 );
620 /******************************************************************************
621 * RtlDestroyProcessParameters [NTDLL.@]
623 void WINAPI
RtlDestroyProcessParameters( RTL_USER_PROCESS_PARAMETERS
*params
)
625 RtlFreeHeap( GetProcessHeap(), 0, params
);
629 /***********************************************************************
630 * init_user_process_params
632 * Fill the initial RTL_USER_PROCESS_PARAMETERS structure from the server.
634 void init_user_process_params(void)
637 SIZE_T size
= 0, env_size
;
638 RTL_USER_PROCESS_PARAMETERS
*new_params
, *params
= NtCurrentTeb()->Peb
->ProcessParameters
;
639 UNICODE_STRING curdir
;
641 /* environment needs to be a separate memory block */
642 env_size
= params
->EnvironmentSize
;
643 if ((env
= RtlAllocateHeap( GetProcessHeap(), 0, max( env_size
, sizeof(WCHAR
) ))))
645 if (env_size
) memcpy( env
, params
->Environment
, env_size
);
649 params
->Environment
= NULL
; /* avoid copying it */
650 if (RtlCreateProcessParametersEx( &new_params
, ¶ms
->ImagePathName
, ¶ms
->DllPath
,
651 ¶ms
->CurrentDirectory
.DosPath
,
652 ¶ms
->CommandLine
, NULL
, ¶ms
->WindowTitle
, ¶ms
->Desktop
,
653 ¶ms
->ShellInfo
, ¶ms
->RuntimeInfo
,
654 PROCESS_PARAMS_FLAG_NORMALIZED
))
657 new_params
->Environment
= env
;
658 new_params
->DebugFlags
= params
->DebugFlags
;
659 new_params
->ConsoleHandle
= params
->ConsoleHandle
;
660 new_params
->ConsoleFlags
= params
->ConsoleFlags
;
661 new_params
->hStdInput
= params
->hStdInput
;
662 new_params
->hStdOutput
= params
->hStdOutput
;
663 new_params
->hStdError
= params
->hStdError
;
664 new_params
->dwX
= params
->dwX
;
665 new_params
->dwY
= params
->dwY
;
666 new_params
->dwXSize
= params
->dwXSize
;
667 new_params
->dwYSize
= params
->dwYSize
;
668 new_params
->dwXCountChars
= params
->dwXCountChars
;
669 new_params
->dwYCountChars
= params
->dwYCountChars
;
670 new_params
->dwFillAttribute
= params
->dwFillAttribute
;
671 new_params
->dwFlags
= params
->dwFlags
;
672 new_params
->wShowWindow
= params
->wShowWindow
;
674 NtCurrentTeb()->Peb
->ProcessParameters
= new_params
;
675 NtFreeVirtualMemory( GetCurrentProcess(), (void **)¶ms
, &size
, MEM_RELEASE
);
677 if (RtlSetCurrentDirectory_U( &new_params
->CurrentDirectory
.DosPath
))
679 MESSAGE("wine: could not open working directory %s, starting in the Windows directory.\n",
680 debugstr_w( new_params
->CurrentDirectory
.DosPath
.Buffer
));
681 RtlInitUnicodeString( &curdir
, windows_dir
);
682 RtlSetCurrentDirectory_U( &curdir
);
684 set_wow64_environment( &new_params
->Environment
);
685 new_params
->EnvironmentSize
= RtlSizeHeap( GetProcessHeap(), 0, new_params
->Environment
);