2002-03-10 00:29:33 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2000 Juergen Schmied
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-03-10 00:29:33 +01:00
|
|
|
*/
|
|
|
|
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
#ifndef __WINE_NTDLL_MISC_H
|
|
|
|
#define __WINE_NTDLL_MISC_H
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2007-01-12 20:15:52 +01:00
|
|
|
#include <signal.h>
|
2007-10-20 16:56:44 +02:00
|
|
|
#include <sys/types.h>
|
2009-03-30 15:05:07 +02:00
|
|
|
#include <pthread.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
|
|
|
|
#include "windef.h"
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
#include "winnt.h"
|
2002-09-13 00:07:02 +02:00
|
|
|
#include "winternl.h"
|
2003-04-03 00:48:59 +02:00
|
|
|
#include "wine/server.h"
|
2019-05-14 12:30:46 +02:00
|
|
|
#include "wine/asm.h"
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
|
2020-04-11 07:16:26 +02:00
|
|
|
#define DECLARE_CRITICAL_SECTION(cs) \
|
|
|
|
static RTL_CRITICAL_SECTION cs; \
|
|
|
|
static RTL_CRITICAL_SECTION_DEBUG cs##_debug = \
|
|
|
|
{ 0, 0, &cs, { &cs##_debug.ProcessLocksList, &cs##_debug.ProcessLocksList }, \
|
|
|
|
0, 0, { (DWORD_PTR)(__FILE__ ": " # cs) }}; \
|
|
|
|
static RTL_CRITICAL_SECTION cs = { &cs##_debug, -1, 0, 0, 0, 0 };
|
|
|
|
|
2005-07-14 14:33:30 +02:00
|
|
|
#define MAX_NT_PATH_LENGTH 277
|
|
|
|
|
2007-10-18 15:16:07 +02:00
|
|
|
#define MAX_DOS_DRIVES 26
|
|
|
|
|
2019-10-28 21:07:53 +01:00
|
|
|
#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
|
2013-01-08 14:00:06 +01:00
|
|
|
static const UINT_PTR page_size = 0x1000;
|
|
|
|
#else
|
|
|
|
extern UINT_PTR page_size DECLSPEC_HIDDEN;
|
|
|
|
#endif
|
|
|
|
|
2007-10-18 15:16:07 +02:00
|
|
|
struct drive_info
|
|
|
|
{
|
|
|
|
dev_t dev;
|
|
|
|
ino_t ino;
|
|
|
|
};
|
|
|
|
|
2011-04-21 10:32:31 +02:00
|
|
|
extern NTSTATUS close_handle( HANDLE ) DECLSPEC_HIDDEN;
|
2015-01-21 13:24:14 +01:00
|
|
|
extern ULONG_PTR get_system_affinity_mask(void) DECLSPEC_HIDDEN;
|
2010-12-02 11:33:03 +01:00
|
|
|
|
2005-11-02 21:54:12 +01:00
|
|
|
/* exceptions */
|
2011-04-21 10:32:31 +02:00
|
|
|
extern void wait_suspend( CONTEXT *context ) DECLSPEC_HIDDEN;
|
|
|
|
extern NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, int first_chance, CONTEXT *context ) DECLSPEC_HIDDEN;
|
|
|
|
extern LONG call_vectored_handlers( EXCEPTION_RECORD *rec, CONTEXT *context ) DECLSPEC_HIDDEN;
|
2020-04-16 00:06:40 +02:00
|
|
|
extern void DECLSPEC_NORETURN raise_status( NTSTATUS status, EXCEPTION_RECORD *rec ) DECLSPEC_HIDDEN;
|
2011-04-21 10:32:31 +02:00
|
|
|
extern NTSTATUS context_to_server( context_t *to, const CONTEXT *from ) DECLSPEC_HIDDEN;
|
|
|
|
extern NTSTATUS context_from_server( CONTEXT *to, const context_t *from ) DECLSPEC_HIDDEN;
|
2018-06-12 10:46:27 +02:00
|
|
|
extern NTSTATUS set_thread_context( HANDLE handle, const context_t *context, BOOL *self ) DECLSPEC_HIDDEN;
|
|
|
|
extern NTSTATUS get_thread_context( HANDLE handle, context_t *context, unsigned int flags, BOOL *self ) DECLSPEC_HIDDEN;
|
2020-04-01 12:33:29 +02:00
|
|
|
extern NTSTATUS get_thread_ldt_entry( HANDLE handle, void *data, ULONG len, ULONG *ret_len ) DECLSPEC_HIDDEN;
|
2018-10-09 14:42:30 +02:00
|
|
|
extern LONG WINAPI call_unhandled_exception_filter( PEXCEPTION_POINTERS eptr ) DECLSPEC_HIDDEN;
|
2005-05-07 20:10:30 +02:00
|
|
|
|
2019-08-19 13:21:47 +02:00
|
|
|
#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
|
2020-04-24 03:17:31 +02:00
|
|
|
extern RUNTIME_FUNCTION *lookup_function_info( ULONG_PTR pc, ULONG_PTR *base, LDR_DATA_TABLE_ENTRY **module ) DECLSPEC_HIDDEN;
|
2019-08-19 13:21:47 +02:00
|
|
|
#endif
|
|
|
|
|
2009-02-16 11:46:44 +01:00
|
|
|
/* debug helpers */
|
2011-04-21 10:32:31 +02:00
|
|
|
extern LPCSTR debugstr_us( const UNICODE_STRING *str ) DECLSPEC_HIDDEN;
|
|
|
|
extern LPCSTR debugstr_ObjectAttributes(const OBJECT_ATTRIBUTES *oa) DECLSPEC_HIDDEN;
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
|
2003-11-04 05:50:18 +01:00
|
|
|
/* init routines */
|
2020-04-28 13:26:34 +02:00
|
|
|
extern SIZE_T signal_stack_size DECLSPEC_HIDDEN;
|
|
|
|
extern SIZE_T signal_stack_mask DECLSPEC_HIDDEN;
|
2020-04-28 13:17:07 +02:00
|
|
|
extern void signal_init_threading(void) DECLSPEC_HIDDEN;
|
2020-04-28 13:34:57 +02:00
|
|
|
extern NTSTATUS signal_alloc_thread( TEB *teb ) DECLSPEC_HIDDEN;
|
2011-04-21 10:32:31 +02:00
|
|
|
extern void signal_free_thread( TEB *teb ) DECLSPEC_HIDDEN;
|
|
|
|
extern void signal_init_thread( TEB *teb ) DECLSPEC_HIDDEN;
|
2017-11-29 17:11:10 +01:00
|
|
|
extern void signal_init_process(void) DECLSPEC_HIDDEN;
|
2017-11-30 16:00:14 +01:00
|
|
|
extern void signal_start_thread( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend ) DECLSPEC_HIDDEN;
|
|
|
|
extern void signal_start_process( LPTHREAD_START_ROUTINE entry, BOOL suspend ) DECLSPEC_HIDDEN;
|
2017-12-14 10:54:56 +01:00
|
|
|
extern void DECLSPEC_NORETURN signal_exit_thread( int status ) DECLSPEC_HIDDEN;
|
|
|
|
extern void DECLSPEC_NORETURN signal_exit_process( int status ) DECLSPEC_HIDDEN;
|
2019-11-07 16:54:31 +01:00
|
|
|
extern void version_init(void) DECLSPEC_HIDDEN;
|
2011-04-21 10:32:31 +02:00
|
|
|
extern void debug_init(void) DECLSPEC_HIDDEN;
|
2019-11-07 17:00:39 +01:00
|
|
|
extern TEB *thread_init(void) DECLSPEC_HIDDEN;
|
2011-04-21 10:32:31 +02:00
|
|
|
extern void actctx_init(void) DECLSPEC_HIDDEN;
|
|
|
|
extern void virtual_init(void) DECLSPEC_HIDDEN;
|
|
|
|
extern void fill_cpu_info(void) DECLSPEC_HIDDEN;
|
|
|
|
extern void heap_set_debug_flags( HANDLE handle ) DECLSPEC_HIDDEN;
|
2019-11-13 20:55:03 +01:00
|
|
|
extern void init_unix_codepage(void) DECLSPEC_HIDDEN;
|
2019-11-19 10:08:27 +01:00
|
|
|
extern void init_locale( HMODULE module ) DECLSPEC_HIDDEN;
|
2019-02-12 11:13:57 +01:00
|
|
|
extern void init_user_process_params( SIZE_T data_size ) DECLSPEC_HIDDEN;
|
2020-04-27 12:35:19 +02:00
|
|
|
extern void init_paths(void) DECLSPEC_HIDDEN;
|
2019-11-12 21:48:49 +01:00
|
|
|
extern char **build_envp( const WCHAR *envW ) DECLSPEC_HIDDEN;
|
2019-11-11 21:04:27 +01:00
|
|
|
extern NTSTATUS restart_process( RTL_USER_PROCESS_PARAMETERS *params, NTSTATUS status ) DECLSPEC_HIDDEN;
|
2003-03-31 03:37:04 +02:00
|
|
|
|
2020-04-09 11:48:43 +02:00
|
|
|
extern int __wine_main_argc;
|
|
|
|
extern char **__wine_main_argv;
|
|
|
|
extern WCHAR **__wine_main_wargv;
|
|
|
|
|
2003-11-06 01:08:05 +01:00
|
|
|
/* server support */
|
2020-04-27 12:35:19 +02:00
|
|
|
extern const char *build_dir DECLSPEC_HIDDEN;
|
|
|
|
extern const char *data_dir DECLSPEC_HIDDEN;
|
2020-04-27 12:34:07 +02:00
|
|
|
extern const char *config_dir DECLSPEC_HIDDEN;
|
2020-04-27 12:35:39 +02:00
|
|
|
extern const char **dll_paths DECLSPEC_HIDDEN;
|
|
|
|
extern size_t dll_path_maxlen DECLSPEC_HIDDEN;
|
2011-04-21 10:32:31 +02:00
|
|
|
extern timeout_t server_start_time DECLSPEC_HIDDEN;
|
|
|
|
extern unsigned int server_cpus DECLSPEC_HIDDEN;
|
2013-12-09 10:34:53 +01:00
|
|
|
extern BOOL is_wow64 DECLSPEC_HIDDEN;
|
2020-04-28 11:28:29 +02:00
|
|
|
extern NTSTATUS exec_wineloader( char **argv, int socketfd, const pe_image_info_t *pe_info ) DECLSPEC_HIDDEN;
|
2011-04-21 10:32:31 +02:00
|
|
|
extern void server_init_process(void) DECLSPEC_HIDDEN;
|
2017-11-30 16:00:14 +01:00
|
|
|
extern void server_init_process_done(void) DECLSPEC_HIDDEN;
|
2017-11-30 11:01:47 +01:00
|
|
|
extern size_t server_init_thread( void *entry_point, BOOL *suspend ) DECLSPEC_HIDDEN;
|
2011-04-21 10:32:31 +02:00
|
|
|
extern void DECLSPEC_NORETURN abort_thread( int status ) DECLSPEC_HIDDEN;
|
|
|
|
extern void DECLSPEC_NORETURN exit_thread( int status ) DECLSPEC_HIDDEN;
|
|
|
|
extern sigset_t server_block_set DECLSPEC_HIDDEN;
|
2017-09-22 14:58:09 +02:00
|
|
|
extern unsigned int server_call_unlocked( void *req_ptr ) DECLSPEC_HIDDEN;
|
2011-04-21 10:32:31 +02:00
|
|
|
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;
|
2020-04-10 01:05:29 +02:00
|
|
|
extern unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT flags,
|
2020-04-20 00:02:29 +02:00
|
|
|
timeout_t abs_timeout, CONTEXT *context, RTL_CRITICAL_SECTION *cs, user_apc_t *user_apc ) DECLSPEC_HIDDEN;
|
2020-04-10 01:05:19 +02:00
|
|
|
extern unsigned int server_wait( const select_op_t *select_op, data_size_t size,
|
|
|
|
UINT flags, const LARGE_INTEGER *timeout ) DECLSPEC_HIDDEN;
|
2013-08-22 11:38:58 +02:00
|
|
|
extern unsigned int server_queue_process_apc( HANDLE process, const apc_call_t *call, apc_result_t *result ) DECLSPEC_HIDDEN;
|
2011-04-21 10:32:31 +02:00
|
|
|
extern int server_remove_fd_from_cache( HANDLE handle ) DECLSPEC_HIDDEN;
|
2008-12-08 16:05:17 +01:00
|
|
|
extern int server_get_unix_fd( HANDLE handle, unsigned int access, int *unix_fd,
|
2011-04-21 10:32:31 +02:00
|
|
|
int *needs_close, enum server_fd_type *type, unsigned int *options ) DECLSPEC_HIDDEN;
|
|
|
|
extern int server_pipe( int fd[2] ) DECLSPEC_HIDDEN;
|
2016-01-15 09:40:56 +01:00
|
|
|
extern NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_attributes **ret,
|
|
|
|
data_size_t *ret_len ) DECLSPEC_HIDDEN;
|
2016-01-29 06:57:04 +01:00
|
|
|
extern NTSTATUS validate_open_object_attributes( const OBJECT_ATTRIBUTES *attr ) DECLSPEC_HIDDEN;
|
2007-10-25 20:09:54 +02:00
|
|
|
|
2003-03-07 00:41:37 +01:00
|
|
|
/* module handling */
|
2013-12-23 18:16:51 +01:00
|
|
|
extern LIST_ENTRY tls_links DECLSPEC_HIDDEN;
|
2004-06-15 02:47:00 +02:00
|
|
|
extern FARPROC RELAY_GetProcAddress( HMODULE module, const IMAGE_EXPORT_DIRECTORY *exports,
|
2011-04-21 10:32:31 +02:00
|
|
|
DWORD exp_size, FARPROC proc, DWORD ordinal, const WCHAR *user ) DECLSPEC_HIDDEN;
|
2004-06-15 02:47:00 +02:00
|
|
|
extern FARPROC SNOOP_GetProcAddress( HMODULE hmod, const IMAGE_EXPORT_DIRECTORY *exports, DWORD exp_size,
|
2011-04-21 10:32:31 +02:00
|
|
|
FARPROC origfun, DWORD ordinal, const WCHAR *user ) DECLSPEC_HIDDEN;
|
|
|
|
extern void RELAY_SetupDLL( HMODULE hmod ) DECLSPEC_HIDDEN;
|
|
|
|
extern void SNOOP_SetupDLL( HMODULE hmod ) DECLSPEC_HIDDEN;
|
2018-02-19 19:38:29 +01:00
|
|
|
extern const WCHAR system_dir[] DECLSPEC_HIDDEN;
|
2019-10-22 10:15:28 +02:00
|
|
|
extern const WCHAR syswow64_dir[] DECLSPEC_HIDDEN;
|
2003-04-08 01:27:54 +02:00
|
|
|
|
2017-12-04 13:13:05 +01:00
|
|
|
extern void (WINAPI *kernel32_start_process)(LPTHREAD_START_ROUTINE,void*) DECLSPEC_HIDDEN;
|
2008-02-12 22:39:19 +01:00
|
|
|
|
2003-06-24 21:28:21 +02:00
|
|
|
/* Device IO */
|
2004-03-05 00:00:18 +01:00
|
|
|
extern NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
|
2003-06-24 21:28:21 +02:00
|
|
|
HANDLE hEvent, PIO_APC_ROUTINE UserApcRoutine,
|
|
|
|
PVOID UserApcContext,
|
|
|
|
PIO_STATUS_BLOCK piosb,
|
|
|
|
ULONG IoControlCode,
|
|
|
|
LPVOID lpInBuffer, DWORD nInBufferSize,
|
2011-04-21 10:32:31 +02:00
|
|
|
LPVOID lpOutBuffer, DWORD nOutBufferSize) DECLSPEC_HIDDEN;
|
2006-01-12 13:32:51 +01:00
|
|
|
extern NTSTATUS COMM_DeviceIoControl(HANDLE hDevice,
|
|
|
|
HANDLE hEvent, PIO_APC_ROUTINE UserApcRoutine,
|
|
|
|
PVOID UserApcContext,
|
|
|
|
PIO_STATUS_BLOCK piosb,
|
|
|
|
ULONG IoControlCode,
|
|
|
|
LPVOID lpInBuffer, DWORD nInBufferSize,
|
2011-04-21 10:32:31 +02:00
|
|
|
LPVOID lpOutBuffer, DWORD nOutBufferSize) DECLSPEC_HIDDEN;
|
2006-01-26 13:23:08 +01:00
|
|
|
extern NTSTATUS TAPE_DeviceIoControl(HANDLE hDevice,
|
|
|
|
HANDLE hEvent, PIO_APC_ROUTINE UserApcRoutine,
|
|
|
|
PVOID UserApcContext,
|
|
|
|
PIO_STATUS_BLOCK piosb,
|
|
|
|
ULONG IoControlCode,
|
|
|
|
LPVOID lpInBuffer, DWORD nInBufferSize,
|
2011-04-21 10:32:31 +02:00
|
|
|
LPVOID lpOutBuffer, DWORD nOutBufferSize) DECLSPEC_HIDDEN;
|
2013-09-05 00:10:19 +02:00
|
|
|
extern NTSTATUS COMM_FlushBuffersFile( int fd ) DECLSPEC_HIDDEN;
|
2003-06-24 21:28:21 +02:00
|
|
|
|
2004-03-16 02:32:02 +01:00
|
|
|
/* file I/O */
|
2009-11-18 17:23:55 +01:00
|
|
|
struct stat;
|
2011-04-21 10:32:31 +02:00
|
|
|
extern NTSTATUS FILE_GetNtStatus(void) DECLSPEC_HIDDEN;
|
2014-08-20 04:31:00 +02:00
|
|
|
extern int get_file_info( const char *path, struct stat *st, ULONG *attr ) DECLSPEC_HIDDEN;
|
|
|
|
extern NTSTATUS fill_file_info( const struct stat *st, ULONG attr, void *ptr,
|
|
|
|
FILE_INFORMATION_CLASS class ) DECLSPEC_HIDDEN;
|
2011-04-21 10:32:31 +02:00
|
|
|
extern NTSTATUS server_get_unix_name( HANDLE handle, ANSI_STRING *unix_name ) DECLSPEC_HIDDEN;
|
2018-02-19 19:38:29 +01:00
|
|
|
extern void init_directories(void) DECLSPEC_HIDDEN;
|
2011-04-21 10:32:31 +02:00
|
|
|
extern BOOL DIR_is_hidden_file( const UNICODE_STRING *name ) DECLSPEC_HIDDEN;
|
|
|
|
extern NTSTATUS DIR_unmount_device( HANDLE handle ) DECLSPEC_HIDDEN;
|
|
|
|
extern NTSTATUS DIR_get_unix_cwd( char **cwd ) DECLSPEC_HIDDEN;
|
|
|
|
extern unsigned int DIR_get_drives_info( struct drive_info info[MAX_DOS_DRIVES] ) DECLSPEC_HIDDEN;
|
|
|
|
extern NTSTATUS file_id_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, ANSI_STRING *unix_name_ret ) DECLSPEC_HIDDEN;
|
2009-12-01 17:07:55 +01:00
|
|
|
extern NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_STRING *unix_name_ret,
|
2011-04-21 10:32:31 +02:00
|
|
|
UINT disposition ) DECLSPEC_HIDDEN;
|
2004-03-16 02:32:02 +01:00
|
|
|
|
|
|
|
/* virtual memory */
|
2020-04-30 10:07:36 +02:00
|
|
|
extern NTSTATUS virtual_alloc( PVOID *ret, unsigned short zero_bits_64, SIZE_T *size_ptr,
|
|
|
|
ULONG type, ULONG protect ) DECLSPEC_HIDDEN;
|
2019-08-01 10:07:44 +02:00
|
|
|
extern NTSTATUS virtual_map_section( HANDLE handle, PVOID *addr_ptr, unsigned short zero_bits_64, SIZE_T commit_size,
|
2019-08-01 10:07:38 +02:00
|
|
|
const LARGE_INTEGER *offset_ptr, SIZE_T *size_ptr, ULONG alloc_type,
|
|
|
|
ULONG protect, pe_image_info_t *image_info ) DECLSPEC_HIDDEN;
|
2011-04-21 10:32:31 +02:00
|
|
|
extern void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info ) DECLSPEC_HIDDEN;
|
|
|
|
extern NTSTATUS virtual_create_builtin_view( void *base ) DECLSPEC_HIDDEN;
|
2020-04-30 10:05:56 +02:00
|
|
|
extern TEB * virtual_alloc_first_teb(void) DECLSPEC_HIDDEN;
|
2020-04-28 13:34:57 +02:00
|
|
|
extern NTSTATUS virtual_alloc_teb( TEB **teb ) DECLSPEC_HIDDEN;
|
|
|
|
extern void virtual_free_teb( TEB *teb ) DECLSPEC_HIDDEN;
|
2019-06-14 17:32:43 +02:00
|
|
|
extern NTSTATUS virtual_alloc_thread_stack( INITIAL_TEB *stack, SIZE_T reserve_size,
|
2017-12-26 10:14:38 +01:00
|
|
|
SIZE_T commit_size, SIZE_T *pthread_size ) DECLSPEC_HIDDEN;
|
2017-12-04 13:56:32 +01:00
|
|
|
extern void virtual_clear_thread_stack( void *stack_end ) DECLSPEC_HIDDEN;
|
2019-08-24 12:24:09 +02:00
|
|
|
extern int virtual_handle_stack_fault( void *addr ) DECLSPEC_HIDDEN;
|
2013-02-12 19:56:08 +01:00
|
|
|
extern BOOL virtual_is_valid_code_address( const void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
|
2015-02-10 14:54:25 +01:00
|
|
|
extern NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack ) DECLSPEC_HIDDEN;
|
2017-09-22 14:58:09 +02:00
|
|
|
extern unsigned int virtual_locked_server_call( void *req_ptr ) DECLSPEC_HIDDEN;
|
2017-09-22 15:04:34 +02:00
|
|
|
extern ssize_t virtual_locked_read( int fd, void *addr, size_t size ) DECLSPEC_HIDDEN;
|
|
|
|
extern ssize_t virtual_locked_pread( int fd, void *addr, size_t size, off_t offset ) DECLSPEC_HIDDEN;
|
2011-04-21 10:32:31 +02:00
|
|
|
extern BOOL virtual_check_buffer_for_read( const void *ptr, SIZE_T size ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL virtual_check_buffer_for_write( void *ptr, SIZE_T size ) DECLSPEC_HIDDEN;
|
2014-10-14 06:22:55 +02:00
|
|
|
extern SIZE_T virtual_uninterrupted_read_memory( const void *addr, void *buffer, SIZE_T size ) DECLSPEC_HIDDEN;
|
2017-09-06 17:16:25 +02:00
|
|
|
extern NTSTATUS virtual_uninterrupted_write_memory( void *addr, const void *buffer, SIZE_T size ) DECLSPEC_HIDDEN;
|
2011-04-21 10:32:31 +02:00
|
|
|
extern void VIRTUAL_SetForceExec( BOOL enable ) DECLSPEC_HIDDEN;
|
2013-04-04 13:00:47 +02:00
|
|
|
extern void virtual_release_address_space(void) DECLSPEC_HIDDEN;
|
|
|
|
extern void virtual_set_large_address_space(void) DECLSPEC_HIDDEN;
|
2018-10-24 12:32:30 +02:00
|
|
|
extern void virtual_fill_image_information( const pe_image_info_t *pe_info,
|
|
|
|
SECTION_IMAGE_INFORMATION *info ) DECLSPEC_HIDDEN;
|
2011-04-21 10:32:31 +02:00
|
|
|
extern struct _KUSER_SHARED_DATA *user_shared_data DECLSPEC_HIDDEN;
|
2020-05-11 13:12:48 +02:00
|
|
|
extern HANDLE user_shared_data_init_done(void) DECLSPEC_HIDDEN;
|
2003-12-08 22:58:55 +01:00
|
|
|
|
2008-12-27 19:47:46 +01:00
|
|
|
/* completion */
|
|
|
|
extern NTSTATUS NTDLL_AddCompletion( HANDLE hFile, ULONG_PTR CompletionValue,
|
2019-02-21 15:10:14 +01:00
|
|
|
NTSTATUS CompletionStatus, ULONG Information, BOOL async) DECLSPEC_HIDDEN;
|
2008-12-27 19:47:46 +01:00
|
|
|
|
2019-11-13 20:55:03 +01:00
|
|
|
/* locale */
|
|
|
|
extern LCID user_lcid, system_lcid;
|
2020-02-11 09:15:19 +01:00
|
|
|
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;
|
2004-01-18 23:11:52 +01:00
|
|
|
|
2011-04-21 10:32:31 +02:00
|
|
|
extern int CDECL NTDLL__vsnprintf( char *str, SIZE_T len, const char *format, __ms_va_list args ) DECLSPEC_HIDDEN;
|
|
|
|
extern int CDECL NTDLL__vsnwprintf( WCHAR *str, SIZE_T len, const WCHAR *format, __ms_va_list args ) DECLSPEC_HIDDEN;
|
2009-01-28 19:17:34 +01:00
|
|
|
|
2006-02-22 16:30:05 +01:00
|
|
|
/* load order */
|
|
|
|
|
|
|
|
enum loadorder
|
|
|
|
{
|
|
|
|
LO_INVALID,
|
|
|
|
LO_DISABLED,
|
|
|
|
LO_NATIVE,
|
|
|
|
LO_BUILTIN,
|
|
|
|
LO_NATIVE_BUILTIN, /* native then builtin */
|
|
|
|
LO_BUILTIN_NATIVE, /* builtin then native */
|
|
|
|
LO_DEFAULT /* nothing specified, use default strategy */
|
|
|
|
};
|
|
|
|
|
2019-02-08 22:07:54 +01:00
|
|
|
extern enum loadorder get_load_order( const WCHAR *app_name, const UNICODE_STRING *nt_name ) DECLSPEC_HIDDEN;
|
2006-02-22 16:30:05 +01:00
|
|
|
|
2005-06-06 22:04:33 +02:00
|
|
|
struct debug_info
|
|
|
|
{
|
2019-04-03 14:16:29 +02:00
|
|
|
unsigned int str_pos; /* current position in strings buffer */
|
|
|
|
unsigned int out_pos; /* current position in output buffer */
|
|
|
|
char strings[1024]; /* buffer for temporary strings */
|
|
|
|
char output[1024]; /* current output line */
|
2005-06-06 22:04:33 +02:00
|
|
|
};
|
|
|
|
|
2017-07-19 15:18:29 +02:00
|
|
|
/* thread private data, stored in NtCurrentTeb()->GdiTebBatch */
|
2005-06-06 22:04:33 +02:00
|
|
|
struct ntdll_thread_data
|
|
|
|
{
|
2017-07-19 15:18:29 +02:00
|
|
|
struct debug_info *debug_info; /* info for debugstr functions */
|
2017-11-29 10:44:21 +01:00
|
|
|
void *start_stack; /* stack for thread startup */
|
2017-07-19 15:18:29 +02:00
|
|
|
int request_fd; /* fd for sending server requests */
|
|
|
|
int reply_fd; /* fd for receiving server replies */
|
|
|
|
int wait_fd[2]; /* fd for sleeping server requests */
|
|
|
|
BOOL wow64_redir; /* Wow64 filesystem redirection flag */
|
|
|
|
pthread_t pthread_id; /* pthread thread id */
|
|
|
|
};
|
|
|
|
|
|
|
|
C_ASSERT( sizeof(struct ntdll_thread_data) <= sizeof(((TEB *)0)->GdiTebBatch) );
|
2005-06-06 22:04:33 +02:00
|
|
|
|
|
|
|
static inline struct ntdll_thread_data *ntdll_get_thread_data(void)
|
|
|
|
{
|
2017-07-19 15:18:29 +02:00
|
|
|
return (struct ntdll_thread_data *)&NtCurrentTeb()->GdiTebBatch;
|
2006-01-13 13:58:14 +01:00
|
|
|
}
|
|
|
|
|
2019-05-14 21:02:50 +02:00
|
|
|
static inline int get_unix_exit_code( NTSTATUS status )
|
|
|
|
{
|
|
|
|
/* prevent a nonzero exit code to end up truncated to zero in unix */
|
|
|
|
if (status && !(status & 0xff)) return 1;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2011-05-26 18:15:51 +02:00
|
|
|
extern mode_t FILE_umask DECLSPEC_HIDDEN;
|
2013-08-28 21:10:50 +02:00
|
|
|
extern HANDLE keyed_event DECLSPEC_HIDDEN;
|
2019-02-14 19:41:34 +01:00
|
|
|
extern SYSTEM_CPU_INFORMATION cpu_info DECLSPEC_HIDDEN;
|
2011-05-26 18:15:51 +02:00
|
|
|
|
2013-07-20 07:15:34 +02:00
|
|
|
#define HASH_STRING_ALGORITHM_DEFAULT 0
|
|
|
|
#define HASH_STRING_ALGORITHM_X65599 1
|
|
|
|
#define HASH_STRING_ALGORITHM_INVALID 0xffffffff
|
|
|
|
|
2013-08-02 13:45:46 +02:00
|
|
|
NTSTATUS WINAPI RtlHashUnicodeString(PCUNICODE_STRING,BOOLEAN,ULONG,ULONG*);
|
2019-02-14 16:49:09 +01:00
|
|
|
void WINAPI LdrInitializeThunk(CONTEXT*,void**,ULONG_PTR,ULONG_PTR);
|
2013-08-02 13:45:46 +02:00
|
|
|
|
2020-05-02 15:10:04 +02:00
|
|
|
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
|
|
|
|
#define InterlockedCompareExchange64(dest,xchg,cmp) RtlInterlockedCompareExchange64(dest,xchg,cmp)
|
|
|
|
#endif
|
|
|
|
|
2019-03-26 10:26:43 +01:00
|
|
|
/* string functions */
|
2020-03-27 13:36:05 +01:00
|
|
|
int __cdecl NTDLL_tolower( int c );
|
|
|
|
int __cdecl _stricmp( LPCSTR str1, LPCSTR str2 );
|
|
|
|
int __cdecl NTDLL__wcsicmp( LPCWSTR str1, LPCWSTR str2 );
|
|
|
|
int __cdecl NTDLL__wcsnicmp( LPCWSTR str1, LPCWSTR str2, size_t n );
|
|
|
|
int __cdecl NTDLL_wcscmp( LPCWSTR str1, LPCWSTR str2 );
|
|
|
|
int __cdecl NTDLL_wcsncmp( LPCWSTR str1, LPCWSTR str2, size_t n );
|
|
|
|
WCHAR __cdecl NTDLL_towlower( WCHAR ch );
|
|
|
|
WCHAR __cdecl NTDLL_towupper( WCHAR ch );
|
|
|
|
LPWSTR __cdecl NTDLL__wcslwr( LPWSTR str );
|
|
|
|
LPWSTR __cdecl NTDLL__wcsupr( LPWSTR str );
|
|
|
|
LPWSTR __cdecl NTDLL_wcscpy( LPWSTR dst, LPCWSTR src );
|
|
|
|
LPWSTR __cdecl NTDLL_wcscat( LPWSTR dst, LPCWSTR src );
|
|
|
|
LPWSTR __cdecl NTDLL_wcschr( LPCWSTR str, WCHAR ch );
|
|
|
|
size_t __cdecl NTDLL_wcslen( LPCWSTR str );
|
|
|
|
size_t __cdecl NTDLL_wcscspn( LPCWSTR str, LPCWSTR reject );
|
|
|
|
LPWSTR __cdecl NTDLL_wcsncat( LPWSTR s1, LPCWSTR s2, size_t n );
|
|
|
|
LPWSTR __cdecl NTDLL_wcsncpy( LPWSTR s1, LPCWSTR s2, size_t n );
|
|
|
|
LPWSTR __cdecl NTDLL_wcspbrk( LPCWSTR str, LPCWSTR accept );
|
|
|
|
LPWSTR __cdecl NTDLL_wcsrchr( LPCWSTR str, WCHAR ch );
|
|
|
|
size_t __cdecl NTDLL_wcsspn( LPCWSTR str, LPCWSTR accept );
|
|
|
|
LPWSTR __cdecl NTDLL_wcsstr( LPCWSTR str, LPCWSTR sub );
|
|
|
|
LPWSTR __cdecl NTDLL_wcstok( LPWSTR str, LPCWSTR delim );
|
|
|
|
LONG __cdecl NTDLL_wcstol( LPCWSTR s, LPWSTR *end, INT base );
|
|
|
|
ULONG __cdecl NTDLL_wcstoul( LPCWSTR s, LPWSTR *end, INT base );
|
2020-03-30 22:18:41 +02:00
|
|
|
int WINAPIV NTDLL_swprintf( WCHAR *str, const WCHAR *format, ... );
|
2020-05-13 14:38:36 +02:00
|
|
|
int WINAPIV _snwprintf_s( WCHAR *str, SIZE_T size, SIZE_T len, const WCHAR *format, ... );
|
2020-03-27 13:36:05 +01:00
|
|
|
|
2020-03-27 13:38:09 +01:00
|
|
|
#define wcsicmp(s1,s2) NTDLL__wcsicmp(s1,s2)
|
2020-03-27 13:38:33 +01:00
|
|
|
#define wcsnicmp(s1,s2,n) NTDLL__wcsnicmp(s1,s2,n)
|
2020-03-30 12:05:16 +02:00
|
|
|
#define towupper(c) NTDLL_towupper(c)
|
2020-03-27 13:44:03 +01:00
|
|
|
#define wcslwr(s) NTDLL__wcslwr(s)
|
2020-03-27 13:43:20 +01:00
|
|
|
#define wcsupr(s) NTDLL__wcsupr(s)
|
2020-03-31 11:37:58 +02:00
|
|
|
#define wcscpy(d,s) NTDLL_wcscpy(d,s)
|
2020-03-31 11:41:22 +02:00
|
|
|
#define wcscat(d,s) NTDLL_wcscat(d,s)
|
2020-03-31 11:43:50 +02:00
|
|
|
#define wcschr(s,c) NTDLL_wcschr(s,c)
|
2020-03-31 11:46:29 +02:00
|
|
|
#define wcspbrk(s,a) NTDLL_wcspbrk(s,a)
|
2020-03-31 11:47:47 +02:00
|
|
|
#define wcsrchr(s,c) NTDLL_wcsrchr(s,c)
|
2020-03-30 12:09:49 +02:00
|
|
|
#define wcstoul(s,e,b) NTDLL_wcstoul(s,e,b)
|
2020-03-31 11:50:16 +02:00
|
|
|
#define wcslen(s) NTDLL_wcslen(s)
|
2020-03-31 11:52:07 +02:00
|
|
|
#define wcscspn(s,r) NTDLL_wcscspn(s,r)
|
2020-03-31 11:53:34 +02:00
|
|
|
#define wcsspn(s,a) NTDLL_wcsspn(s,a)
|
2020-03-31 11:54:39 +02:00
|
|
|
#define wcscmp(s1,s2) NTDLL_wcscmp(s1,s2)
|
2020-03-31 11:55:51 +02:00
|
|
|
#define wcsncmp(s1,s2,n) NTDLL_wcsncmp(s1,s2,n)
|
2020-03-27 13:38:09 +01:00
|
|
|
|
2020-03-27 13:40:37 +01:00
|
|
|
/* convert from straight ASCII to Unicode without depending on the current codepage */
|
|
|
|
static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
|
|
|
|
{
|
|
|
|
while (len--) *dst++ = (unsigned char)*src++;
|
|
|
|
}
|
|
|
|
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
#endif
|