Commit ee5c842e authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Move the creation of the initial environment to the Unix library.

parent a4ce2f65
...@@ -51,6 +51,7 @@ C_SRCS = \ ...@@ -51,6 +51,7 @@ C_SRCS = \
threadpool.c \ threadpool.c \
time.c \ time.c \
unix/debug.c \ unix/debug.c \
unix/env.c \
unix/loader.c \ unix/loader.c \
unix/server.c \ unix/server.c \
unix/signal_arm.c \ unix/signal_arm.c \
......
...@@ -483,41 +483,17 @@ static void set_wow64_environment( WCHAR **env ) ...@@ -483,41 +483,17 @@ static void set_wow64_environment( WCHAR **env )
* *
* Build the Win32 environment from the Unix environment * Build the Win32 environment from the Unix environment
*/ */
static WCHAR *build_initial_environment( char **env ) static WCHAR *build_initial_environment( WCHAR **wargv[] )
{ {
SIZE_T size = 1; SIZE_T size = 1024;
char **e; WCHAR *ptr;
WCHAR *p, *ptr;
/* compute the total size of the Unix environment */ for (;;)
for (e = env; *e; e++)
{ {
if (is_special_env_var( *e )) continue; if (!(ptr = RtlAllocateHeap( GetProcessHeap(), 0, size * sizeof(WCHAR) ))) return NULL;
size += strlen(*e) + 1; if (!unix_funcs->get_initial_environment( wargv, ptr, &size )) break;
} RtlFreeHeap( GetProcessHeap(), 0, ptr );
if (!(ptr = RtlAllocateHeap( GetProcessHeap(), 0, size * sizeof(WCHAR) ))) return NULL;
p = ptr;
/* and fill it with the Unix environment */
for (e = env; *e; e++)
{
char *str = *e;
/* skip Unix special variables and use the Wine variants instead */
if (!strncmp( str, "WINE", 4 ))
{
if (is_special_env_var( str + 4 )) str += 4;
else if (!strncmp( str, "WINEPRELOADRESERVE=", 19 )) continue; /* skip it */
}
else if (is_special_env_var( str )) continue; /* skip it */
ntdll_umbstowcs( str, strlen(str) + 1, p, size - (p - ptr) );
p += wcslen(p) + 1;
} }
*p = 0;
first_prefix_start = set_registry_environment( &ptr, TRUE ); first_prefix_start = set_registry_environment( &ptr, TRUE );
set_additional_environment( &ptr ); set_additional_environment( &ptr );
return ptr; return ptr;
...@@ -687,14 +663,11 @@ static inline BOOL is_path_prefix( const WCHAR *prefix, const WCHAR *path, const ...@@ -687,14 +663,11 @@ static inline BOOL is_path_prefix( const WCHAR *prefix, const WCHAR *path, const
/*********************************************************************** /***********************************************************************
* get_image_path * get_image_path
*/ */
static void get_image_path( const char *argv0, UNICODE_STRING *path ) static void get_image_path( const WCHAR *name, UNICODE_STRING *path )
{ {
static const WCHAR exeW[] = {'.','e','x','e',0}; static const WCHAR exeW[] = {'.','e','x','e',0};
WCHAR *load_path, *file_part, *name, full_name[MAX_PATH]; WCHAR *load_path, *file_part, full_name[MAX_PATH];
DWORD len = strlen(argv0) + 1; DWORD len;
if (!(name = RtlAllocateHeap( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) goto failed;
ntdll_umbstowcs( argv0, len, name, len );
if (RtlDetermineDosPathNameType_U( name ) != RELATIVE_PATH || if (RtlDetermineDosPathNameType_U( name ) != RELATIVE_PATH ||
wcschr( name, '/' ) || wcschr( name, '\\' )) wcschr( name, '/' ) || wcschr( name, '\\' ))
...@@ -732,52 +705,15 @@ static void get_image_path( const char *argv0, UNICODE_STRING *path ) ...@@ -732,52 +705,15 @@ static void get_image_path( const char *argv0, UNICODE_STRING *path )
} }
done: done:
RtlCreateUnicodeString( path, full_name ); RtlCreateUnicodeString( path, full_name );
RtlFreeHeap( GetProcessHeap(), 0, name );
return; return;
failed: failed:
MESSAGE( "wine: cannot find '%s'\n", argv0 ); MESSAGE( "wine: cannot find %s\n", debugstr_w(name) );
RtlExitUserProcess( GetLastError() ); RtlExitUserProcess( GetLastError() );
} }
/*********************************************************************** /***********************************************************************
* set_library_wargv
*
* Set the Wine library Unicode argv global variables.
*/
static void set_library_wargv( char **argv, const UNICODE_STRING *image )
{
int argc;
WCHAR *p, **wargv;
DWORD total = 0;
if (image) total += 1 + image->Length / sizeof(WCHAR);
for (argc = (image != NULL); argv[argc]; argc++) total += strlen(argv[argc]) + 1;
wargv = RtlAllocateHeap( GetProcessHeap(), 0,
total * sizeof(WCHAR) + (argc + 1) * sizeof(*wargv) );
p = (WCHAR *)(wargv + argc + 1);
if (image)
{
wcscpy( p, image->Buffer );
wargv[0] = p;
p += 1 + image->Length / sizeof(WCHAR);
total -= 1 + image->Length / sizeof(WCHAR);
}
for (argc = (image != NULL); argv[argc]; argc++)
{
DWORD reslen = ntdll_umbstowcs( argv[argc], strlen(argv[argc]) + 1, p, total );
wargv[argc] = p;
p += reslen;
total -= reslen;
}
wargv[argc] = NULL;
__wine_main_wargv = wargv;
}
/***********************************************************************
* build_command_line * build_command_line
* *
* Build the command line of a process from the argv array. * Build the command line of a process from the argv array.
...@@ -1504,10 +1440,7 @@ void init_user_process_params( SIZE_T data_size ) ...@@ -1504,10 +1440,7 @@ void init_user_process_params( SIZE_T data_size )
startup_info_t *info = NULL; startup_info_t *info = NULL;
RTL_USER_PROCESS_PARAMETERS *params = NULL; RTL_USER_PROCESS_PARAMETERS *params = NULL;
UNICODE_STRING curdir, dllpath, imagepath, cmdline, title, desktop, shellinfo, runtime; UNICODE_STRING curdir, dllpath, imagepath, cmdline, title, desktop, shellinfo, runtime;
int argc; WCHAR **wargv;
char **argv, **envp;
unix_funcs->get_main_args( &argc, &argv, &envp );
if (!data_size) if (!data_size)
{ {
...@@ -1515,14 +1448,14 @@ void init_user_process_params( SIZE_T data_size ) ...@@ -1515,14 +1448,14 @@ void init_user_process_params( SIZE_T data_size )
WCHAR *env, curdir_buffer[MAX_PATH]; WCHAR *env, curdir_buffer[MAX_PATH];
NtCurrentTeb()->Peb->ProcessParameters = &initial_params; NtCurrentTeb()->Peb->ProcessParameters = &initial_params;
initial_params.Environment = build_initial_environment( envp ); initial_params.Environment = build_initial_environment( &wargv );
curdir.Buffer = curdir_buffer; curdir.Buffer = curdir_buffer;
curdir.MaximumLength = sizeof(curdir_buffer); curdir.MaximumLength = sizeof(curdir_buffer);
get_current_directory( &curdir ); get_current_directory( &curdir );
initial_params.CurrentDirectory.DosPath = curdir; initial_params.CurrentDirectory.DosPath = curdir;
get_image_path( argv[0], &initial_params.ImagePathName ); get_image_path( wargv[0], &initial_params.ImagePathName );
set_library_wargv( argv, &initial_params.ImagePathName ); wargv[0] = initial_params.ImagePathName.Buffer;
build_command_line( __wine_main_wargv, &cmdline ); build_command_line( wargv, &cmdline );
LdrGetDllPath( initial_params.ImagePathName.Buffer, 0, &load_path, &dummy ); LdrGetDllPath( initial_params.ImagePathName.Buffer, 0, &load_path, &dummy );
RtlInitUnicodeString( &dllpath, load_path ); RtlInitUnicodeString( &dllpath, load_path );
...@@ -1535,7 +1468,6 @@ void init_user_process_params( SIZE_T data_size ) ...@@ -1535,7 +1468,6 @@ void init_user_process_params( SIZE_T data_size )
params->Environment = env; params->Environment = env;
NtCurrentTeb()->Peb->ProcessParameters = params; NtCurrentTeb()->Peb->ProcessParameters = params;
RtlFreeUnicodeString( &initial_params.ImagePathName );
RtlFreeUnicodeString( &cmdline ); RtlFreeUnicodeString( &cmdline );
RtlReleasePath( load_path ); RtlReleasePath( load_path );
...@@ -1609,8 +1541,6 @@ void init_user_process_params( SIZE_T data_size ) ...@@ -1609,8 +1541,6 @@ void init_user_process_params( SIZE_T data_size )
else params->Environment[0] = 0; else params->Environment[0] = 0;
} }
set_library_wargv( argv, NULL );
done: done:
RtlFreeHeap( GetProcessHeap(), 0, info ); RtlFreeHeap( GetProcessHeap(), 0, info );
if (RtlSetCurrentDirectory_U( &params->CurrentDirectory.DosPath )) if (RtlSetCurrentDirectory_U( &params->CurrentDirectory.DosPath ))
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <locale.h>
#include <langinfo.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <signal.h> #include <signal.h>
...@@ -38,9 +36,6 @@ ...@@ -38,9 +36,6 @@
#ifdef HAVE_SYS_MMAN_H #ifdef HAVE_SYS_MMAN_H
# include <sys/mman.h> # include <sys/mman.h>
#endif #endif
#ifdef HAVE_SYS_PRCTL_H
# include <sys/prctl.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H #ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h> # include <sys/resource.h>
#endif #endif
...@@ -100,9 +95,6 @@ static const BOOL use_preloader = FALSE; ...@@ -100,9 +95,6 @@ static const BOOL use_preloader = FALSE;
static const BOOL is_win64 = (sizeof(void *) > sizeof(int)); static const BOOL is_win64 = (sizeof(void *) > sizeof(int));
static int main_argc;
static char **main_argv;
static char **main_envp;
static char *argv0; static char *argv0;
static const char *bin_dir; static const char *bin_dir;
static const char *dll_dir; static const char *dll_dir;
...@@ -113,8 +105,6 @@ const char *data_dir = NULL; ...@@ -113,8 +105,6 @@ const char *data_dir = NULL;
const char *build_dir = NULL; const char *build_dir = NULL;
const char *config_dir = NULL; const char *config_dir = NULL;
static CPTABLEINFO unix_table;
static inline void *get_rva( const IMAGE_NT_HEADERS *nt, ULONG_PTR addr ) static inline void *get_rva( const IMAGE_NT_HEADERS *nt, ULONG_PTR addr )
{ {
return (BYTE *)nt + addr; return (BYTE *)nt + addr;
...@@ -275,9 +265,6 @@ static void init_paths( int argc, char *argv[], char *envp[] ) ...@@ -275,9 +265,6 @@ static void init_paths( int argc, char *argv[], char *envp[] )
{ {
Dl_info info; Dl_info info;
__wine_main_argc = main_argc = argc;
__wine_main_argv = main_argv = argv;
__wine_main_environ = main_envp = envp;
argv0 = strdup( argv[0] ); argv0 = strdup( argv[0] );
if (!dladdr( init_paths, &info ) || !(dll_dir = realpath_dirname( info.dli_fname ))) if (!dladdr( init_paths, &info ) || !(dll_dir = realpath_dirname( info.dli_fname )))
...@@ -300,136 +287,6 @@ static void init_paths( int argc, char *argv[], char *envp[] ) ...@@ -300,136 +287,6 @@ static void init_paths( int argc, char *argv[], char *envp[] )
set_config_dir(); set_config_dir();
} }
#if !defined(__APPLE__) && !defined(__ANDROID__) /* these platforms always use UTF-8 */
/* charset to codepage map, sorted by name */
static const struct { const char *name; UINT cp; } charset_names[] =
{
{ "ANSIX341968", 20127 },
{ "BIG5", 950 },
{ "BIG5HKSCS", 950 },
{ "CP1250", 1250 },
{ "CP1251", 1251 },
{ "CP1252", 1252 },
{ "CP1253", 1253 },
{ "CP1254", 1254 },
{ "CP1255", 1255 },
{ "CP1256", 1256 },
{ "CP1257", 1257 },
{ "CP1258", 1258 },
{ "CP932", 932 },
{ "CP936", 936 },
{ "CP949", 949 },
{ "CP950", 950 },
{ "EUCJP", 20932 },
{ "EUCKR", 949 },
{ "GB18030", 936 /* 54936 */ },
{ "GB2312", 936 },
{ "GBK", 936 },
{ "IBM037", 37 },
{ "IBM1026", 1026 },
{ "IBM424", 20424 },
{ "IBM437", 437 },
{ "IBM500", 500 },
{ "IBM850", 850 },
{ "IBM852", 852 },
{ "IBM855", 855 },
{ "IBM857", 857 },
{ "IBM860", 860 },
{ "IBM861", 861 },
{ "IBM862", 862 },
{ "IBM863", 863 },
{ "IBM864", 864 },
{ "IBM865", 865 },
{ "IBM866", 866 },
{ "IBM869", 869 },
{ "IBM874", 874 },
{ "IBM875", 875 },
{ "ISO88591", 28591 },
{ "ISO885913", 28603 },
{ "ISO885915", 28605 },
{ "ISO88592", 28592 },
{ "ISO88593", 28593 },
{ "ISO88594", 28594 },
{ "ISO88595", 28595 },
{ "ISO88596", 28596 },
{ "ISO88597", 28597 },
{ "ISO88598", 28598 },
{ "ISO88599", 28599 },
{ "KOI8R", 20866 },
{ "KOI8U", 21866 },
{ "TIS620", 28601 },
{ "UTF8", CP_UTF8 }
};
static void load_unix_cptable( unsigned int cp )
{
const char *dir = build_dir ? build_dir : data_dir;
struct stat st;
char *name;
void *data;
int fd;
if (!(name = malloc( strlen(dir) + 22 ))) return;
sprintf( name, "%s/nls/c_%03u.nls", dir, cp );
if ((fd = open( name, O_RDONLY )) != -1)
{
fstat( fd, &st );
if ((data = malloc( st.st_size )) && st.st_size > 0x10000 &&
read( fd, data, st.st_size ) == st.st_size)
{
RtlInitCodePageTable( data, &unix_table );
}
else
{
free( data );
}
close( fd );
}
else ERR( "failed to load %s\n", name );
free( name );
}
static void init_unix_codepage(void)
{
char charset_name[16];
const char *name;
size_t i, j;
int min = 0, max = ARRAY_SIZE(charset_names) - 1;
setlocale( LC_CTYPE, "" );
if (!(name = nl_langinfo( CODESET ))) return;
/* remove punctuation characters from charset name */
for (i = j = 0; name[i] && j < sizeof(charset_name)-1; i++)
{
if (name[i] >= '0' && name[i] <= '9') charset_name[j++] = name[i];
else if (name[i] >= 'A' && name[i] <= 'Z') charset_name[j++] = name[i];
else if (name[i] >= 'a' && name[i] <= 'z') charset_name[j++] = name[i] + ('A' - 'a');
}
charset_name[j] = 0;
while (min <= max)
{
int pos = (min + max) / 2;
int res = strcmp( charset_names[pos].name, charset_name );
if (!res)
{
if (charset_names[pos].cp != CP_UTF8) load_unix_cptable( charset_names[pos].cp );
return;
}
if (res > 0) max = pos - 1;
else min = pos + 1;
}
ERR( "unrecognized charset '%s'\n", name );
}
#else /* __APPLE__ || __ANDROID__ */
static void init_unix_codepage(void) { }
#endif /* __APPLE__ || __ANDROID__ */
/********************************************************************* /*********************************************************************
* get_version * get_version
...@@ -474,19 +331,6 @@ void CDECL get_host_version( const char **sysname, const char **release ) ...@@ -474,19 +331,6 @@ void CDECL get_host_version( const char **sysname, const char **release )
/************************************************************************* /*************************************************************************
* get_main_args
*
* Return the initial arguments.
*/
static void CDECL get_main_args( int *argc, char **argv[], char **envp[] )
{
*argc = main_argc;
*argv = main_argv;
*envp = main_envp;
}
/*************************************************************************
* get_paths * get_paths
* *
* Return the various configuration paths. * Return the various configuration paths.
...@@ -511,17 +355,6 @@ static void CDECL get_dll_path( const char ***paths, SIZE_T *maxlen ) ...@@ -511,17 +355,6 @@ static void CDECL get_dll_path( const char ***paths, SIZE_T *maxlen )
} }
/*************************************************************************
* get_unix_codepage
*
* Return the Unix codepage data.
*/
static void CDECL get_unix_codepage( CPTABLEINFO *table )
{
*table = unix_table;
}
static void preloader_exec( char **argv ) static void preloader_exec( char **argv )
{ {
if (use_preloader) if (use_preloader)
...@@ -1065,6 +898,7 @@ static struct unix_funcs unix_funcs = ...@@ -1065,6 +898,7 @@ static struct unix_funcs unix_funcs =
fast_RtlSleepConditionVariableCS, fast_RtlSleepConditionVariableCS,
fast_RtlWakeConditionVariable, fast_RtlWakeConditionVariable,
get_main_args, get_main_args,
get_initial_environment,
get_paths, get_paths,
get_dll_path, get_dll_path,
get_unix_codepage, get_unix_codepage,
...@@ -1296,68 +1130,6 @@ static int pre_exec(void) ...@@ -1296,68 +1130,6 @@ static int pre_exec(void)
/*********************************************************************** /***********************************************************************
* set_process_name
*
* Change the process name in the ps output.
*/
static void set_process_name( int argc, char *argv[] )
{
BOOL shift_strings;
char *p, *name;
int i;
#ifdef HAVE_SETPROCTITLE
setproctitle("-%s", argv[1]);
shift_strings = FALSE;
#else
p = argv[0];
shift_strings = (argc >= 2);
for (i = 1; i < argc; i++)
{
p += strlen(p) + 1;
if (p != argv[i])
{
shift_strings = FALSE;
break;
}
}
#endif
if (shift_strings)
{
int offset = argv[1] - argv[0];
char *end = argv[argc-1] + strlen(argv[argc-1]) + 1;
memmove( argv[0], argv[1], end - argv[1] );
memset( end - offset, 0, offset );
for (i = 1; i < argc; i++)
argv[i-1] = argv[i] - offset;
argv[i-1] = NULL;
}
else
{
/* remove argv[0] */
memmove( argv, argv + 1, argc * sizeof(argv[0]) );
}
name = argv[0];
if ((p = strrchr( name, '\\' ))) name = p + 1;
if ((p = strrchr( name, '/' ))) name = p + 1;
#if defined(HAVE_SETPROGNAME)
setprogname( name );
#endif
#ifdef HAVE_PRCTL
#ifndef PR_SET_NAME
# define PR_SET_NAME 15
#endif
prctl( PR_SET_NAME, name );
#endif /* HAVE_PRCTL */
}
/***********************************************************************
* check_command_line * check_command_line
* *
* Check if command line is one that needs to be handled specially. * Check if command line is one that needs to be handled specially.
...@@ -1425,8 +1197,7 @@ void __wine_main( int argc, char *argv[], char *envp[] ) ...@@ -1425,8 +1197,7 @@ void __wine_main( int argc, char *argv[], char *envp[] )
module = load_ntdll(); module = load_ntdll();
fixup_ntdll_imports( &__wine_spec_nt_header, module ); fixup_ntdll_imports( &__wine_spec_nt_header, module );
set_process_name( argc, argv ); init_environment( argc, argv, envp );
init_unix_codepage();
#ifdef __APPLE__ #ifdef __APPLE__
apple_main_thread(); apple_main_thread();
...@@ -1460,8 +1231,7 @@ NTSTATUS __cdecl __wine_init_unix_lib( HMODULE module, const void *ptr_in, void ...@@ -1460,8 +1231,7 @@ NTSTATUS __cdecl __wine_init_unix_lib( HMODULE module, const void *ptr_in, void
map_so_dll( nt, module ); map_so_dll( nt, module );
fixup_ntdll_imports( &__wine_spec_nt_header, module ); fixup_ntdll_imports( &__wine_spec_nt_header, module );
set_process_name( __wine_main_argc, __wine_main_argv ); init_environment( __wine_main_argc, __wine_main_argv, envp );
init_unix_codepage();
*(struct unix_funcs **)ptr_out = &unix_funcs; *(struct unix_funcs **)ptr_out = &unix_funcs;
wine_mmap_enum_reserved_areas( add_area, NULL, 0 ); wine_mmap_enum_reserved_areas( add_area, NULL, 0 );
return STATUS_SUCCESS; return STATUS_SUCCESS;
......
...@@ -78,6 +78,9 @@ void CDECL mmap_remove_reserved_area( void *addr, SIZE_T size ) DECLSPEC_HIDDEN; ...@@ -78,6 +78,9 @@ void CDECL mmap_remove_reserved_area( void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
int CDECL mmap_is_in_reserved_area( void *addr, SIZE_T size ) DECLSPEC_HIDDEN; int CDECL mmap_is_in_reserved_area( void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
int CDECL mmap_enum_reserved_areas( int (CDECL *enum_func)(void *base, SIZE_T size, void *arg), void *arg, int CDECL mmap_enum_reserved_areas( int (CDECL *enum_func)(void *base, SIZE_T size, void *arg), void *arg,
int top_down ) DECLSPEC_HIDDEN; int top_down ) DECLSPEC_HIDDEN;
extern void CDECL get_main_args( int *argc, char **argv[], char **envp[] ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL get_initial_environment( WCHAR **wargv[], WCHAR *env, SIZE_T *size ) DECLSPEC_HIDDEN;
extern void CDECL get_unix_codepage( CPTABLEINFO *table ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL virtual_map_section( HANDLE handle, PVOID *addr_ptr, unsigned short zero_bits_64, SIZE_T commit_size, extern NTSTATUS CDECL virtual_map_section( HANDLE handle, PVOID *addr_ptr, unsigned short zero_bits_64, SIZE_T commit_size,
const LARGE_INTEGER *offset_ptr, SIZE_T *size_ptr, ULONG alloc_type, const LARGE_INTEGER *offset_ptr, SIZE_T *size_ptr, ULONG alloc_type,
ULONG protect, pe_image_info_t *image_info ) DECLSPEC_HIDDEN; ULONG protect, pe_image_info_t *image_info ) DECLSPEC_HIDDEN;
...@@ -123,6 +126,9 @@ extern SIZE_T signal_stack_size DECLSPEC_HIDDEN; ...@@ -123,6 +126,9 @@ extern SIZE_T signal_stack_size DECLSPEC_HIDDEN;
extern SIZE_T signal_stack_mask DECLSPEC_HIDDEN; extern SIZE_T signal_stack_mask DECLSPEC_HIDDEN;
extern struct _KUSER_SHARED_DATA *user_shared_data DECLSPEC_HIDDEN; extern struct _KUSER_SHARED_DATA *user_shared_data DECLSPEC_HIDDEN;
extern void init_environment( int argc, char *argv[], char *envp[] ) DECLSPEC_HIDDEN;
extern DWORD ntdll_umbstowcs( const char *src, DWORD srclen, WCHAR *dst, DWORD dstlen ) DECLSPEC_HIDDEN;
extern unsigned int server_call_unlocked( void *req_ptr ) DECLSPEC_HIDDEN; extern unsigned int server_call_unlocked( void *req_ptr ) DECLSPEC_HIDDEN;
extern void server_enter_uninterrupted_section( RTL_CRITICAL_SECTION *cs, sigset_t *sigset ) DECLSPEC_HIDDEN; extern void server_enter_uninterrupted_section( RTL_CRITICAL_SECTION *cs, sigset_t *sigset ) DECLSPEC_HIDDEN;
extern void server_leave_uninterrupted_section( RTL_CRITICAL_SECTION *cs, sigset_t *sigset ) DECLSPEC_HIDDEN; extern void server_leave_uninterrupted_section( RTL_CRITICAL_SECTION *cs, sigset_t *sigset ) DECLSPEC_HIDDEN;
...@@ -170,4 +176,21 @@ extern void DECLSPEC_NORETURN signal_exit_thread( int status, void (*func)(int) ...@@ -170,4 +176,21 @@ extern void DECLSPEC_NORETURN signal_exit_thread( int status, void (*func)(int)
extern void dbg_init(void) DECLSPEC_HIDDEN; extern void dbg_init(void) DECLSPEC_HIDDEN;
static inline size_t ntdll_wcslen( const WCHAR *str )
{
const WCHAR *s = str;
while (*s) s++;
return s - str;
}
static inline WCHAR *ntdll_wcscpy( WCHAR *dst, const WCHAR *src )
{
WCHAR *p = dst;
while ((*p++ = *src++));
return dst;
}
#define wcslen(str) ntdll_wcslen(str)
#define wcscpy(dst,src) ntdll_wcscpy(dst,src)
#endif /* __NTDLL_UNIX_PRIVATE_H */ #endif /* __NTDLL_UNIX_PRIVATE_H */
...@@ -28,7 +28,7 @@ struct ldt_copy; ...@@ -28,7 +28,7 @@ struct ldt_copy;
struct msghdr; struct msghdr;
/* increment this when you change the function table */ /* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 38 #define NTDLL_UNIXLIB_VERSION 39
struct unix_funcs struct unix_funcs
{ {
...@@ -171,6 +171,7 @@ struct unix_funcs ...@@ -171,6 +171,7 @@ struct unix_funcs
/* environment functions */ /* environment functions */
void (CDECL *get_main_args)( int *argc, char **argv[], char **envp[] ); void (CDECL *get_main_args)( int *argc, char **argv[], char **envp[] );
NTSTATUS (CDECL *get_initial_environment)( WCHAR **wargv[], WCHAR *env, SIZE_T *size );
void (CDECL *get_paths)( const char **builddir, const char **datadir, const char **configdir ); void (CDECL *get_paths)( const char **builddir, const char **datadir, const char **configdir );
void (CDECL *get_dll_path)( const char ***paths, SIZE_T *maxlen ); void (CDECL *get_dll_path)( const char ***paths, SIZE_T *maxlen );
void (CDECL *get_unix_codepage)( CPTABLEINFO *table ); void (CDECL *get_unix_codepage)( CPTABLEINFO *table );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment