ntdll: Move create_startup_info() to env.c.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
a7a1e2643a
commit
8e7c6422e5
|
@ -1897,6 +1897,23 @@ static inline WCHAR *get_dos_path( WCHAR *nt_path )
|
||||||
return nt_path;
|
return nt_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline const WCHAR *get_params_string( const RTL_USER_PROCESS_PARAMETERS *params,
|
||||||
|
const UNICODE_STRING *str )
|
||||||
|
{
|
||||||
|
if (params->Flags & PROCESS_PARAMS_FLAG_NORMALIZED) return str->Buffer;
|
||||||
|
return (const WCHAR *)((const char *)params + (UINT_PTR)str->Buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline DWORD append_string( void **ptr, const RTL_USER_PROCESS_PARAMETERS *params,
|
||||||
|
const UNICODE_STRING *str )
|
||||||
|
{
|
||||||
|
const WCHAR *buffer = get_params_string( params, str );
|
||||||
|
memcpy( *ptr, buffer, str->Length );
|
||||||
|
*ptr = (WCHAR *)*ptr + str->Length / sizeof(WCHAR);
|
||||||
|
return str->Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* build_initial_params
|
* build_initial_params
|
||||||
*
|
*
|
||||||
|
@ -2113,6 +2130,58 @@ void init_startup_info(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* create_startup_info
|
||||||
|
*/
|
||||||
|
void *create_startup_info( const RTL_USER_PROCESS_PARAMETERS *params, DWORD *info_size )
|
||||||
|
{
|
||||||
|
startup_info_t *info;
|
||||||
|
DWORD size;
|
||||||
|
void *ptr;
|
||||||
|
|
||||||
|
size = sizeof(*info);
|
||||||
|
size += params->CurrentDirectory.DosPath.Length;
|
||||||
|
size += params->DllPath.Length;
|
||||||
|
size += params->ImagePathName.Length;
|
||||||
|
size += params->CommandLine.Length;
|
||||||
|
size += params->WindowTitle.Length;
|
||||||
|
size += params->Desktop.Length;
|
||||||
|
size += params->ShellInfo.Length;
|
||||||
|
size += params->RuntimeInfo.Length;
|
||||||
|
size = (size + 1) & ~1;
|
||||||
|
*info_size = size;
|
||||||
|
|
||||||
|
if (!(info = calloc( size, 1 ))) return NULL;
|
||||||
|
|
||||||
|
info->debug_flags = params->DebugFlags;
|
||||||
|
info->console_flags = params->ConsoleFlags;
|
||||||
|
info->console = wine_server_obj_handle( params->ConsoleHandle );
|
||||||
|
info->hstdin = wine_server_obj_handle( params->hStdInput );
|
||||||
|
info->hstdout = wine_server_obj_handle( params->hStdOutput );
|
||||||
|
info->hstderr = wine_server_obj_handle( params->hStdError );
|
||||||
|
info->x = params->dwX;
|
||||||
|
info->y = params->dwY;
|
||||||
|
info->xsize = params->dwXSize;
|
||||||
|
info->ysize = params->dwYSize;
|
||||||
|
info->xchars = params->dwXCountChars;
|
||||||
|
info->ychars = params->dwYCountChars;
|
||||||
|
info->attribute = params->dwFillAttribute;
|
||||||
|
info->flags = params->dwFlags;
|
||||||
|
info->show = params->wShowWindow;
|
||||||
|
|
||||||
|
ptr = info + 1;
|
||||||
|
info->curdir_len = append_string( &ptr, params, ¶ms->CurrentDirectory.DosPath );
|
||||||
|
info->dllpath_len = append_string( &ptr, params, ¶ms->DllPath );
|
||||||
|
info->imagepath_len = append_string( &ptr, params, ¶ms->ImagePathName );
|
||||||
|
info->cmdline_len = append_string( &ptr, params, ¶ms->CommandLine );
|
||||||
|
info->title_len = append_string( &ptr, params, ¶ms->WindowTitle );
|
||||||
|
info->desktop_len = append_string( &ptr, params, ¶ms->Desktop );
|
||||||
|
info->shellinfo_len = append_string( &ptr, params, ¶ms->ShellInfo );
|
||||||
|
info->runtime_len = append_string( &ptr, params, ¶ms->RuntimeInfo );
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* NtGetNlsSectionPtr (NTDLL.@)
|
* NtGetNlsSectionPtr (NTDLL.@)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -156,74 +156,6 @@ static char **build_argv( const UNICODE_STRING *cmdline, int reserved )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline const WCHAR *get_params_string( const RTL_USER_PROCESS_PARAMETERS *params,
|
|
||||||
const UNICODE_STRING *str )
|
|
||||||
{
|
|
||||||
if (params->Flags & PROCESS_PARAMS_FLAG_NORMALIZED) return str->Buffer;
|
|
||||||
return (const WCHAR *)((const char *)params + (UINT_PTR)str->Buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline DWORD append_string( void **ptr, const RTL_USER_PROCESS_PARAMETERS *params,
|
|
||||||
const UNICODE_STRING *str )
|
|
||||||
{
|
|
||||||
const WCHAR *buffer = get_params_string( params, str );
|
|
||||||
memcpy( *ptr, buffer, str->Length );
|
|
||||||
*ptr = (WCHAR *)*ptr + str->Length / sizeof(WCHAR);
|
|
||||||
return str->Length;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* create_startup_info
|
|
||||||
*/
|
|
||||||
static startup_info_t *create_startup_info( const RTL_USER_PROCESS_PARAMETERS *params, DWORD *info_size )
|
|
||||||
{
|
|
||||||
startup_info_t *info;
|
|
||||||
DWORD size;
|
|
||||||
void *ptr;
|
|
||||||
|
|
||||||
size = sizeof(*info);
|
|
||||||
size += params->CurrentDirectory.DosPath.Length;
|
|
||||||
size += params->DllPath.Length;
|
|
||||||
size += params->ImagePathName.Length;
|
|
||||||
size += params->CommandLine.Length;
|
|
||||||
size += params->WindowTitle.Length;
|
|
||||||
size += params->Desktop.Length;
|
|
||||||
size += params->ShellInfo.Length;
|
|
||||||
size += params->RuntimeInfo.Length;
|
|
||||||
size = (size + 1) & ~1;
|
|
||||||
*info_size = size;
|
|
||||||
|
|
||||||
if (!(info = calloc( size, 1 ))) return NULL;
|
|
||||||
|
|
||||||
info->debug_flags = params->DebugFlags;
|
|
||||||
info->console_flags = params->ConsoleFlags;
|
|
||||||
info->console = wine_server_obj_handle( params->ConsoleHandle );
|
|
||||||
info->hstdin = wine_server_obj_handle( params->hStdInput );
|
|
||||||
info->hstdout = wine_server_obj_handle( params->hStdOutput );
|
|
||||||
info->hstderr = wine_server_obj_handle( params->hStdError );
|
|
||||||
info->x = params->dwX;
|
|
||||||
info->y = params->dwY;
|
|
||||||
info->xsize = params->dwXSize;
|
|
||||||
info->ysize = params->dwYSize;
|
|
||||||
info->xchars = params->dwXCountChars;
|
|
||||||
info->ychars = params->dwYCountChars;
|
|
||||||
info->attribute = params->dwFillAttribute;
|
|
||||||
info->flags = params->dwFlags;
|
|
||||||
info->show = params->wShowWindow;
|
|
||||||
|
|
||||||
ptr = info + 1;
|
|
||||||
info->curdir_len = append_string( &ptr, params, ¶ms->CurrentDirectory.DosPath );
|
|
||||||
info->dllpath_len = append_string( &ptr, params, ¶ms->DllPath );
|
|
||||||
info->imagepath_len = append_string( &ptr, params, ¶ms->ImagePathName );
|
|
||||||
info->cmdline_len = append_string( &ptr, params, ¶ms->CommandLine );
|
|
||||||
info->title_len = append_string( &ptr, params, ¶ms->WindowTitle );
|
|
||||||
info->desktop_len = append_string( &ptr, params, ¶ms->Desktop );
|
|
||||||
info->shellinfo_len = append_string( &ptr, params, ¶ms->ShellInfo );
|
|
||||||
info->runtime_len = append_string( &ptr, params, ¶ms->RuntimeInfo );
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* get_so_file_info
|
* get_so_file_info
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -141,6 +141,7 @@ extern struct ldt_copy __wine_ldt_copy DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
extern void init_environment( int argc, char *argv[], char *envp[] ) DECLSPEC_HIDDEN;
|
extern void init_environment( int argc, char *argv[], char *envp[] ) DECLSPEC_HIDDEN;
|
||||||
extern void init_startup_info(void) DECLSPEC_HIDDEN;
|
extern void init_startup_info(void) DECLSPEC_HIDDEN;
|
||||||
|
extern void *create_startup_info( const RTL_USER_PROCESS_PARAMETERS *params, DWORD *info_size ) DECLSPEC_HIDDEN;
|
||||||
extern DWORD ntdll_umbstowcs( const char *src, DWORD srclen, WCHAR *dst, DWORD dstlen ) DECLSPEC_HIDDEN;
|
extern DWORD ntdll_umbstowcs( const char *src, DWORD srclen, WCHAR *dst, DWORD dstlen ) DECLSPEC_HIDDEN;
|
||||||
extern int ntdll_wcstoumbs( const WCHAR *src, DWORD srclen, char *dst, DWORD dstlen, BOOL strict ) DECLSPEC_HIDDEN;
|
extern int ntdll_wcstoumbs( const WCHAR *src, DWORD srclen, char *dst, DWORD dstlen, BOOL strict ) DECLSPEC_HIDDEN;
|
||||||
extern char **build_envp( const WCHAR *envW ) DECLSPEC_HIDDEN;
|
extern char **build_envp( const WCHAR *envW ) DECLSPEC_HIDDEN;
|
||||||
|
|
Loading…
Reference in New Issue