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
|
|
|
|
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;
|
|
|
|
extern void raise_status( NTSTATUS status, EXCEPTION_RECORD *rec ) DECLSPEC_NORETURN DECLSPEC_HIDDEN;
|
|
|
|
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;
|
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__)
|
|
|
|
extern RUNTIME_FUNCTION *lookup_function_info( ULONG_PTR pc, ULONG_PTR *base, LDR_MODULE **module ) DECLSPEC_HIDDEN;
|
|
|
|
#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 */
|
2011-04-21 10:32:31 +02:00
|
|
|
extern NTSTATUS signal_alloc_thread( TEB **teb ) DECLSPEC_HIDDEN;
|
|
|
|
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;
|
2011-04-21 10:32:31 +02:00
|
|
|
extern void version_init( const WCHAR *appname ) DECLSPEC_HIDDEN;
|
|
|
|
extern void debug_init(void) DECLSPEC_HIDDEN;
|
2018-09-24 19:16:40 +02:00
|
|
|
extern void 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 virtual_init_threading(void) DECLSPEC_HIDDEN;
|
|
|
|
extern void fill_cpu_info(void) DECLSPEC_HIDDEN;
|
|
|
|
extern void heap_set_debug_flags( HANDLE handle ) DECLSPEC_HIDDEN;
|
2019-02-12 11:13:57 +01:00
|
|
|
extern void init_user_process_params( SIZE_T data_size ) DECLSPEC_HIDDEN;
|
2019-02-13 14:39:11 +01:00
|
|
|
extern void update_user_process_params( const UNICODE_STRING *image ) DECLSPEC_HIDDEN;
|
2003-03-31 03:37:04 +02:00
|
|
|
|
2003-11-06 01:08:05 +01:00
|
|
|
/* server support */
|
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;
|
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;
|
2013-08-22 11:38:58 +02:00
|
|
|
extern unsigned int server_select( const select_op_t *select_op, data_size_t size,
|
|
|
|
UINT flags, const LARGE_INTEGER *timeout ) DECLSPEC_HIDDEN;
|
|
|
|
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;
|
2018-12-01 02:03:56 +01:00
|
|
|
extern int wait_select_reply( void *cookie ) DECLSPEC_HIDDEN;
|
|
|
|
extern BOOL invoke_apc( const apc_call_t *call, apc_result_t *result ) 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 */
|
2019-08-01 10:07:44 +02:00
|
|
|
extern NTSTATUS virtual_alloc_aligned( PVOID *ret, unsigned short zero_bits_64, SIZE_T *size_ptr,
|
2019-06-13 12:48:31 +02:00
|
|
|
ULONG type, ULONG protect, ULONG alignment ) 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;
|
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;
|
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
|
|
|
|
2004-01-18 23:11:52 +01:00
|
|
|
/* code pages */
|
2011-04-21 10:32:31 +02:00
|
|
|
extern int ntdll_umbstowcs(DWORD flags, const char* src, int srclen, WCHAR* dst, int dstlen) DECLSPEC_HIDDEN;
|
2004-01-18 23:11:52 +01:00
|
|
|
extern int ntdll_wcstoumbs(DWORD flags, const WCHAR* src, int srclen, char* dst, int dstlen,
|
2011-04-21 10:32:31 +02:00
|
|
|
const char* defchar, int *used ) 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
|
|
|
|
2019-03-26 10:26:43 +01:00
|
|
|
/* string functions */
|
2019-03-26 10:26:51 +01:00
|
|
|
int __cdecl NTDLL_tolower( int c );
|
2019-03-26 10:26:43 +01:00
|
|
|
int __cdecl _stricmp( LPCSTR str1, LPCSTR str2 );
|
- 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
|