Avoid 0-byte files.
[wine/dcerpc.git] / memory / environ.c
blobb74c5c12f5c2d91a1cf73cf0c0ca2b577dc08f19
1 /*
2 * Process environment management
4 * Copyright 1996, 1998 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "config.h"
22 #include "wine/port.h"
24 #include <stdlib.h>
25 #include <string.h>
27 #include "windef.h"
28 #include "winerror.h"
30 #include "wine/winbase16.h"
31 #include "wine/server.h"
32 #include "wine/library.h"
33 #include "heap.h"
34 #include "ntddk.h"
35 #include "selectors.h"
37 /* Win32 process environment database */
38 typedef struct _ENVDB
40 LPSTR env; /* 00 Process environment strings */
41 DWORD unknown1; /* 04 Unknown */
42 LPSTR cmd_line; /* 08 Command line */
43 LPSTR cur_dir; /* 0c Current directory */
44 STARTUPINFOA *startup_info; /* 10 Startup information */
45 HANDLE hStdin; /* 14 Handle for standard input */
46 HANDLE hStdout; /* 18 Handle for standard output */
47 HANDLE hStderr; /* 1c Handle for standard error */
48 DWORD unknown2; /* 20 Unknown */
49 DWORD inherit_console; /* 24 Inherit console flag */
50 DWORD break_type; /* 28 Console events flag */
51 void *break_sem; /* 2c SetConsoleCtrlHandler semaphore */
52 void *break_event; /* 30 SetConsoleCtrlHandler event */
53 void *break_thread; /* 34 SetConsoleCtrlHandler thread */
54 void *break_handlers; /* 38 List of console handlers */
55 } ENVDB;
58 /* Format of an environment block:
59 * ASCIIZ string 1 (xx=yy format)
60 * ...
61 * ASCIIZ string n
62 * BYTE 0
63 * WORD 1
64 * ASCIIZ program name (e.g. C:\WINDOWS\SYSTEM\KRNL386.EXE)
66 * Notes:
67 * - contrary to Microsoft docs, the environment strings do not appear
68 * to be sorted on Win95 (although they are on NT); so we don't bother
69 * to sort them either.
72 static const char ENV_program_name[] = "C:\\WINDOWS\\SYSTEM\\KRNL386.EXE";
74 /* Maximum length of a Win16 environment string (including NULL) */
75 #define MAX_WIN16_LEN 128
77 /* Extra bytes to reserve at the end of an environment */
78 #define EXTRA_ENV_SIZE (sizeof(BYTE) + sizeof(WORD) + sizeof(ENV_program_name))
80 /* Fill the extra bytes with the program name and stuff */
81 #define FILL_EXTRA_ENV(p) \
82 *(p) = '\0'; \
83 PUT_UA_WORD( (p) + 1, 1 ); \
84 strcpy( (p) + 3, ENV_program_name );
86 STARTUPINFOA current_startupinfo =
88 sizeof(STARTUPINFOA), /* cb */
89 0, /* lpReserved */
90 0, /* lpDesktop */
91 0, /* lpTitle */
92 0, /* dwX */
93 0, /* dwY */
94 0, /* dwXSize */
95 0, /* dwYSize */
96 0, /* dwXCountChars */
97 0, /* dwYCountChars */
98 0, /* dwFillAttribute */
99 0, /* dwFlags */
100 0, /* wShowWindow */
101 0, /* cbReserved2 */
102 0, /* lpReserved2 */
103 0, /* hStdInput */
104 0, /* hStdOutput */
105 0 /* hStdError */
108 ENVDB current_envdb =
110 0, /* environ */
111 0, /* unknown1 */
112 0, /* cmd_line */
113 0, /* cur_dir */
114 &current_startupinfo, /* startup_info */
115 0, /* hStdin */
116 0, /* hStdout */
117 0, /* hStderr */
118 0, /* unknown2 */
119 0, /* inherit_console */
120 0, /* break_type */
121 0, /* break_sem */
122 0, /* break_event */
123 0, /* break_thread */
124 0 /* break_handlers */
128 static WCHAR *cmdlineW; /* Unicode command line */
129 static WORD env_sel; /* selector to the environment */
131 /***********************************************************************
132 * ENV_FindVariable
134 * Find a variable in the environment and return a pointer to the value.
135 * Helper function for GetEnvironmentVariable and ExpandEnvironmentStrings.
137 static LPCSTR ENV_FindVariable( LPCSTR env, LPCSTR name, INT len )
139 while (*env)
141 if (!strncasecmp( name, env, len ) && (env[len] == '='))
142 return env + len + 1;
143 env += strlen(env) + 1;
145 return NULL;
149 /***********************************************************************
150 * build_environment
152 * Build the environment for the initial process
154 static BOOL build_environment(void)
156 extern char **environ;
157 LPSTR p, *e;
158 int size;
160 /* Compute the total size of the Unix environment */
162 size = EXTRA_ENV_SIZE;
163 for (e = environ; *e; e++) size += strlen(*e) + 1;
165 /* Now allocate the environment */
167 if (!(p = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE;
168 current_envdb.env = p;
169 env_sel = SELECTOR_AllocBlock( p, 0x10000, WINE_LDT_FLAGS_DATA );
171 /* And fill it with the Unix environment */
173 for (e = environ; *e; e++)
175 strcpy( p, *e );
176 p += strlen(p) + 1;
179 /* Now add the program name */
181 FILL_EXTRA_ENV( p );
182 return TRUE;
186 /***********************************************************************
187 * copy_str
189 * Small helper for ENV_InitStartupInfo.
191 inline static char *copy_str( char **dst, const char **src, size_t len )
193 char *ret;
195 if (!len) return NULL;
196 ret = *dst;
197 memcpy( ret, *src, len );
198 ret[len] = 0;
199 *dst += len + 1;
200 *src += len;
201 return ret;
205 /***********************************************************************
206 * ENV_InitStartupInfo
208 * Fill the startup info structure from the server.
210 ENVDB *ENV_InitStartupInfo( handle_t info_handle, size_t info_size,
211 char *main_exe_name, size_t main_exe_size )
213 startup_info_t info;
214 void *data;
215 char *dst;
216 const char *src;
217 size_t len;
219 if (!build_environment()) return NULL;
220 if (!info_size) return &current_envdb; /* nothing to retrieve */
222 if (!(data = HeapAlloc( GetProcessHeap(), 0, info_size ))) return NULL;
224 SERVER_START_REQ( get_startup_info )
226 req->info = info_handle;
227 req->close = TRUE;
228 wine_server_set_reply( req, data, info_size );
229 wine_server_call( req );
230 info_size = wine_server_reply_size( reply );
232 SERVER_END_REQ;
233 if (info_size < sizeof(info.size)) goto done;
234 len = min( info_size, ((startup_info_t *)data)->size );
235 memset( &info, 0, sizeof(info) );
236 memcpy( &info, data, len );
237 src = (char *)data + len;
238 info_size -= len;
240 /* fixup the lengths */
241 if (info.filename_len > info_size) info.filename_len = info_size;
242 info_size -= info.filename_len;
243 if (info.cmdline_len > info_size) info.cmdline_len = info_size;
244 info_size -= info.cmdline_len;
245 if (info.desktop_len > info_size) info.desktop_len = info_size;
246 info_size -= info.desktop_len;
247 if (info.title_len > info_size) info.title_len = info_size;
249 /* store the filename */
250 if (info.filename_len)
252 len = min( info.filename_len, main_exe_size-1 );
253 memcpy( main_exe_name, src, len );
254 main_exe_name[len] = 0;
255 src += info.filename_len;
258 /* copy the other strings */
259 len = info.cmdline_len + info.desktop_len + info.title_len;
260 if (len && (dst = HeapAlloc( GetProcessHeap(), 0, len + 3 )))
262 current_envdb.cmd_line = copy_str( &dst, &src, info.cmdline_len );
263 current_startupinfo.lpDesktop = copy_str( &dst, &src, info.desktop_len );
264 current_startupinfo.lpTitle = copy_str( &dst, &src, info.title_len );
267 current_startupinfo.dwX = info.x;
268 current_startupinfo.dwY = info.y;
269 current_startupinfo.dwXSize = info.cx;
270 current_startupinfo.dwYSize = info.cy;
271 current_startupinfo.dwXCountChars = info.x_chars;
272 current_startupinfo.dwYCountChars = info.y_chars;
273 current_startupinfo.dwFillAttribute = info.attribute;
274 current_startupinfo.wShowWindow = info.cmd_show;
275 current_startupinfo.dwFlags = info.flags;
276 done:
277 HeapFree( GetProcessHeap(), 0, data );
278 return &current_envdb;
283 /***********************************************************************
284 * set_library_argv
286 * Set the Wine library argc/argv global variables.
288 static void set_library_argv( char **argv )
290 int argc;
291 WCHAR *p;
292 WCHAR **wargv;
293 DWORD total = 0;
295 for (argc = 0; argv[argc]; argc++)
296 total += MultiByteToWideChar( CP_ACP, 0, argv[argc], -1, NULL, 0 );
298 wargv = HeapAlloc( GetProcessHeap(), 0,
299 total * sizeof(WCHAR) + (argc + 1) * sizeof(*wargv) );
300 p = (WCHAR *)(wargv + argc + 1);
301 for (argc = 0; argv[argc]; argc++)
303 DWORD len = MultiByteToWideChar( CP_ACP, 0, argv[argc], -1, p, total );
304 wargv[argc] = p;
305 p += len;
306 total -= len;
308 wargv[argc] = NULL;
310 __wine_main_argc = argc;
311 __wine_main_argv = argv;
312 __wine_main_wargv = wargv;
316 /***********************************************************************
317 * ENV_BuildCommandLine
319 * Build the command line of a process from the argv array.
321 * Note that it does NOT necessarily include the file name.
322 * Sometimes we don't even have any command line options at all.
324 * We must quote and escape characters so that the argv array can be rebuilt
325 * from the command line:
326 * - spaces and tabs must be quoted
327 * 'a b' -> '"a b"'
328 * - quotes must be escaped
329 * '"' -> '\"'
330 * - if '\'s are followed by a '"', they must be doubled and followed by '\"',
331 * resulting in an odd number of '\' followed by a '"'
332 * '\"' -> '\\\"'
333 * '\\"' -> '\\\\\"'
334 * - '\'s that are not followed by a '"' can be left as is
335 * 'a\b' == 'a\b'
336 * 'a\\b' == 'a\\b'
338 BOOL ENV_BuildCommandLine( char **argv )
340 int len;
341 char *p, **arg;
343 set_library_argv( argv );
345 if (current_envdb.cmd_line) goto done; /* already got it from the server */
347 len = 0;
348 for (arg = argv; *arg; arg++)
350 int has_space,bcount;
351 char* a;
353 has_space=0;
354 bcount=0;
355 a=*arg;
356 while (*a!='\0') {
357 if (*a=='\\') {
358 bcount++;
359 } else {
360 if (*a==' ' || *a=='\t') {
361 has_space=1;
362 } else if (*a=='"') {
363 /* doubling of '\' preceeding a '"',
364 * plus escaping of said '"'
366 len+=2*bcount+1;
368 bcount=0;
370 a++;
372 len+=(a-*arg)+1 /* for the separating space */;
373 if (has_space)
374 len+=2; /* for the quotes */
377 if (!(current_envdb.cmd_line = HeapAlloc( GetProcessHeap(), 0, len )))
378 return FALSE;
380 p = current_envdb.cmd_line;
381 for (arg = argv; *arg; arg++)
383 int has_space,has_quote;
384 char* a;
386 /* Check for quotes and spaces in this argument */
387 has_space=has_quote=0;
388 a=*arg;
389 while (*a!='\0') {
390 if (*a==' ' || *a=='\t') {
391 has_space=1;
392 if (has_quote)
393 break;
394 } else if (*a=='"') {
395 has_quote=1;
396 if (has_space)
397 break;
399 a++;
402 /* Now transfer it to the command line */
403 if (has_space)
404 *p++='"';
405 if (has_quote) {
406 int bcount;
407 char* a;
409 bcount=0;
410 a=*arg;
411 while (*a!='\0') {
412 if (*a=='\\') {
413 *p++=*a;
414 bcount++;
415 } else {
416 if (*a=='"') {
417 int i;
419 /* Double all the '\\' preceeding this '"', plus one */
420 for (i=0;i<=bcount;i++)
421 *p++='\\';
422 *p++='"';
423 } else {
424 *p++=*a;
426 bcount=0;
428 a++;
430 } else {
431 strcpy(p,*arg);
432 p+=strlen(*arg);
434 if (has_space)
435 *p++='"';
436 *p++=' ';
438 if (p > current_envdb.cmd_line)
439 p--; /* remove last space */
440 *p = '\0';
442 /* now allocate the Unicode version */
443 done:
444 len = MultiByteToWideChar( CP_ACP, 0, current_envdb.cmd_line, -1, NULL, 0 );
445 if (!(cmdlineW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
446 return FALSE;
447 MultiByteToWideChar( CP_ACP, 0, current_envdb.cmd_line, -1, cmdlineW, len );
448 return TRUE;
452 /***********************************************************************
453 * GetCommandLineA (KERNEL32.@)
455 * WARNING: there's a Windows incompatibility lurking here !
456 * Win32s always includes the full path of the program file,
457 * whereas Windows NT only returns the full file path plus arguments
458 * in case the program has been started with a full path.
459 * Win9x seems to have inherited NT behaviour.
461 * Note that both Start Menu Execute and Explorer start programs with
462 * fully specified quoted app file paths, which is why probably the only case
463 * where you'll see single file names is in case of direct launch
464 * via CreateProcess or WinExec.
466 * Perhaps we should take care of Win3.1 programs here (Win32s "feature").
468 * References: MS KB article q102762.txt (special Win32s handling)
470 LPSTR WINAPI GetCommandLineA(void)
472 return current_envdb.cmd_line;
475 /***********************************************************************
476 * GetCommandLineW (KERNEL32.@)
478 LPWSTR WINAPI GetCommandLineW(void)
480 return cmdlineW;
484 /***********************************************************************
485 * GetEnvironmentStrings (KERNEL32.@)
486 * GetEnvironmentStringsA (KERNEL32.@)
488 LPSTR WINAPI GetEnvironmentStringsA(void)
490 return current_envdb.env;
494 /***********************************************************************
495 * GetEnvironmentStringsW (KERNEL32.@)
497 LPWSTR WINAPI GetEnvironmentStringsW(void)
499 INT size;
500 LPWSTR ret;
502 RtlAcquirePebLock();
503 size = HeapSize( GetProcessHeap(), 0, current_envdb.env );
504 if ((ret = HeapAlloc( GetProcessHeap(), 0, size * sizeof(WCHAR) )) != NULL)
506 LPSTR pA = current_envdb.env;
507 LPWSTR pW = ret;
508 while (size--) *pW++ = (WCHAR)(BYTE)*pA++;
510 RtlReleasePebLock();
511 return ret;
515 /***********************************************************************
516 * FreeEnvironmentStringsA (KERNEL32.@)
518 BOOL WINAPI FreeEnvironmentStringsA( LPSTR ptr )
520 if (ptr != current_envdb.env)
522 SetLastError( ERROR_INVALID_PARAMETER );
523 return FALSE;
525 return TRUE;
529 /***********************************************************************
530 * FreeEnvironmentStringsW (KERNEL32.@)
532 BOOL WINAPI FreeEnvironmentStringsW( LPWSTR ptr )
534 return HeapFree( GetProcessHeap(), 0, ptr );
538 /***********************************************************************
539 * GetEnvironmentVariableA (KERNEL32.@)
541 DWORD WINAPI GetEnvironmentVariableA( LPCSTR name, LPSTR value, DWORD size )
543 LPCSTR p;
544 INT ret = 0;
546 if (!name || !*name)
548 SetLastError( ERROR_INVALID_PARAMETER );
549 return 0;
551 RtlAcquirePebLock();
552 if ((p = ENV_FindVariable( current_envdb.env, name, strlen(name) )))
554 ret = strlen(p);
555 if (size <= ret)
557 /* If not enough room, include the terminating null
558 * in the returned size and return an empty string */
559 ret++;
560 if (value) *value = '\0';
562 else if (value) strcpy( value, p );
564 RtlReleasePebLock();
565 if (!ret)
566 SetLastError( ERROR_ENVVAR_NOT_FOUND );
567 return ret;
571 /***********************************************************************
572 * GetEnvironmentVariableW (KERNEL32.@)
574 DWORD WINAPI GetEnvironmentVariableW( LPCWSTR nameW, LPWSTR valW, DWORD size)
576 LPSTR name = HEAP_strdupWtoA( GetProcessHeap(), 0, nameW );
577 LPSTR val = valW ? HeapAlloc( GetProcessHeap(), 0, size ) : NULL;
578 DWORD res = GetEnvironmentVariableA( name, val, size );
579 HeapFree( GetProcessHeap(), 0, name );
580 if (val)
582 if (size > 0 && !MultiByteToWideChar( CP_ACP, 0, val, -1, valW, size ))
583 valW[size-1] = 0;
584 HeapFree( GetProcessHeap(), 0, val );
586 return res;
590 /***********************************************************************
591 * SetEnvironmentVariableA (KERNEL32.@)
593 BOOL WINAPI SetEnvironmentVariableA( LPCSTR name, LPCSTR value )
595 INT old_size, len, res;
596 LPSTR p, env, new_env;
597 BOOL ret = FALSE;
599 RtlAcquirePebLock();
600 env = p = current_envdb.env;
602 /* Find a place to insert the string */
604 res = -1;
605 len = strlen(name);
606 while (*p)
608 if (!strncasecmp( name, p, len ) && (p[len] == '=')) break;
609 p += strlen(p) + 1;
611 if (!value && !*p) goto done; /* Value to remove doesn't exist */
613 /* Realloc the buffer */
615 len = value ? strlen(name) + strlen(value) + 2 : 0;
616 if (*p) len -= strlen(p) + 1; /* The name already exists */
617 old_size = HeapSize( GetProcessHeap(), 0, env );
618 if (len < 0)
620 LPSTR next = p + strlen(p) + 1; /* We know there is a next one */
621 memmove( next + len, next, old_size - (next - env) );
623 if (!(new_env = HeapReAlloc( GetProcessHeap(), 0, env, old_size + len )))
624 goto done;
625 if (env_sel) env_sel = SELECTOR_ReallocBlock( env_sel, new_env, old_size + len );
626 p = new_env + (p - env);
627 if (len > 0) memmove( p + len, p, old_size - (p - new_env) );
629 /* Set the new string */
631 if (value)
633 strcpy( p, name );
634 strcat( p, "=" );
635 strcat( p, value );
637 current_envdb.env = new_env;
638 ret = TRUE;
640 done:
641 RtlReleasePebLock();
642 return ret;
646 /***********************************************************************
647 * SetEnvironmentVariableW (KERNEL32.@)
649 BOOL WINAPI SetEnvironmentVariableW( LPCWSTR name, LPCWSTR value )
651 LPSTR nameA = HEAP_strdupWtoA( GetProcessHeap(), 0, name );
652 LPSTR valueA = HEAP_strdupWtoA( GetProcessHeap(), 0, value );
653 BOOL ret = SetEnvironmentVariableA( nameA, valueA );
654 HeapFree( GetProcessHeap(), 0, nameA );
655 HeapFree( GetProcessHeap(), 0, valueA );
656 return ret;
660 /***********************************************************************
661 * ExpandEnvironmentStringsA (KERNEL32.@)
663 * Note: overlapping buffers are not supported; this is how it should be.
665 DWORD WINAPI ExpandEnvironmentStringsA( LPCSTR src, LPSTR dst, DWORD count )
667 DWORD len, total_size = 1; /* 1 for terminating '\0' */
668 LPCSTR p, var;
670 if (!count) dst = NULL;
671 RtlAcquirePebLock();
673 while (*src)
675 if (*src != '%')
677 if ((p = strchr( src, '%' ))) len = p - src;
678 else len = strlen(src);
679 var = src;
680 src += len;
682 else /* we are at the start of a variable */
684 if ((p = strchr( src + 1, '%' )))
686 len = p - src - 1; /* Length of the variable name */
687 if ((var = ENV_FindVariable( current_envdb.env, src + 1, len )))
689 src += len + 2; /* Skip the variable name */
690 len = strlen(var);
692 else
694 var = src; /* Copy original name instead */
695 len += 2;
696 src += len;
699 else /* unfinished variable name, ignore it */
701 var = src;
702 len = strlen(src); /* Copy whole string */
703 src += len;
706 total_size += len;
707 if (dst)
709 if (count < len) len = count;
710 memcpy( dst, var, len );
711 dst += len;
712 count -= len;
715 RtlReleasePebLock();
717 /* Null-terminate the string */
718 if (dst)
720 if (!count) dst--;
721 *dst = '\0';
723 return total_size;
727 /***********************************************************************
728 * ExpandEnvironmentStringsW (KERNEL32.@)
730 DWORD WINAPI ExpandEnvironmentStringsW( LPCWSTR src, LPWSTR dst, DWORD len )
732 LPSTR srcA = HEAP_strdupWtoA( GetProcessHeap(), 0, src );
733 LPSTR dstA = dst ? HeapAlloc( GetProcessHeap(), 0, len ) : NULL;
734 DWORD ret = ExpandEnvironmentStringsA( srcA, dstA, len );
735 if (dstA)
737 ret = MultiByteToWideChar( CP_ACP, 0, dstA, -1, dst, len );
738 HeapFree( GetProcessHeap(), 0, dstA );
740 HeapFree( GetProcessHeap(), 0, srcA );
741 return ret;
745 /***********************************************************************
746 * GetDOSEnvironment (KERNEL.131)
747 * GetDOSEnvironment16 (KERNEL32.@)
749 SEGPTR WINAPI GetDOSEnvironment16(void)
751 return MAKESEGPTR( env_sel, 0 );
755 /***********************************************************************
756 * GetStdHandle (KERNEL32.@)
758 HANDLE WINAPI GetStdHandle( DWORD std_handle )
760 switch(std_handle)
762 case STD_INPUT_HANDLE: return current_envdb.hStdin;
763 case STD_OUTPUT_HANDLE: return current_envdb.hStdout;
764 case STD_ERROR_HANDLE: return current_envdb.hStderr;
766 SetLastError( ERROR_INVALID_PARAMETER );
767 return INVALID_HANDLE_VALUE;
771 /***********************************************************************
772 * SetStdHandle (KERNEL32.@)
774 BOOL WINAPI SetStdHandle( DWORD std_handle, HANDLE handle )
776 switch(std_handle)
778 case STD_INPUT_HANDLE: current_envdb.hStdin = handle; return TRUE;
779 case STD_OUTPUT_HANDLE: current_envdb.hStdout = handle; return TRUE;
780 case STD_ERROR_HANDLE: current_envdb.hStderr = handle; return TRUE;
782 SetLastError( ERROR_INVALID_PARAMETER );
783 return FALSE;
787 /***********************************************************************
788 * GetStartupInfoA (KERNEL32.@)
790 VOID WINAPI GetStartupInfoA( LPSTARTUPINFOA info )
792 *info = current_startupinfo;
796 /***********************************************************************
797 * GetStartupInfoW (KERNEL32.@)
799 VOID WINAPI GetStartupInfoW( LPSTARTUPINFOW info )
801 info->cb = sizeof(STARTUPINFOW);
802 info->dwX = current_startupinfo.dwX;
803 info->dwY = current_startupinfo.dwY;
804 info->dwXSize = current_startupinfo.dwXSize;
805 info->dwXCountChars = current_startupinfo.dwXCountChars;
806 info->dwYCountChars = current_startupinfo.dwYCountChars;
807 info->dwFillAttribute = current_startupinfo.dwFillAttribute;
808 info->dwFlags = current_startupinfo.dwFlags;
809 info->wShowWindow = current_startupinfo.wShowWindow;
810 info->cbReserved2 = current_startupinfo.cbReserved2;
811 info->lpReserved2 = current_startupinfo.lpReserved2;
812 info->hStdInput = current_startupinfo.hStdInput;
813 info->hStdOutput = current_startupinfo.hStdOutput;
814 info->hStdError = current_startupinfo.hStdError;
815 info->lpReserved = HEAP_strdupAtoW (GetProcessHeap(), 0, current_startupinfo.lpReserved );
816 info->lpDesktop = HEAP_strdupAtoW (GetProcessHeap(), 0, current_startupinfo.lpDesktop );
817 info->lpTitle = HEAP_strdupAtoW (GetProcessHeap(), 0, current_startupinfo.lpTitle );