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-10-20 16:56:44 +02:00
|
|
|
#include <sys/types.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"
|
2020-05-14 15:17:06 +02:00
|
|
|
#include "unixlib.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
|
|
|
|
|
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
|
|
|
|
|
2005-11-02 21:54:12 +01:00
|
|
|
/* exceptions */
|
2011-04-21 10:32:31 +02:00
|
|
|
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;
|
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
|
|
|
|
2021-07-07 11:39:57 +02:00
|
|
|
extern void WINAPI LdrInitializeThunk(CONTEXT*,ULONG_PTR,ULONG_PTR,ULONG_PTR) DECLSPEC_HIDDEN;
|
|
|
|
extern NTSTATUS WINAPI KiUserExceptionDispatcher(EXCEPTION_RECORD*,CONTEXT*) DECLSPEC_HIDDEN;
|
|
|
|
extern void WINAPI KiUserApcDispatcher(CONTEXT*,ULONG_PTR,ULONG_PTR,ULONG_PTR,PNTAPCFUNC) DECLSPEC_HIDDEN;
|
2021-08-17 11:55:39 +02:00
|
|
|
extern void WINAPI KiUserCallbackDispatcher(ULONG,void*,ULONG) DECLSPEC_HIDDEN;
|
2021-07-07 11:39:57 +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;
|
2021-02-05 10:21:30 +01:00
|
|
|
extern const char *debugstr_exception_code( DWORD code ) 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 */
|
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;
|
|
|
|
extern void actctx_init(void) DECLSPEC_HIDDEN;
|
2020-06-29 12:10:58 +02:00
|
|
|
extern void init_user_process_params(void) DECLSPEC_HIDDEN;
|
2020-08-20 15:27:30 +02:00
|
|
|
extern void CDECL DECLSPEC_NORETURN signal_start_thread( CONTEXT *ctx ) DECLSPEC_HIDDEN;
|
2003-03-31 03:37:04 +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;
|
2020-05-21 12:40:08 +02:00
|
|
|
extern const WCHAR windows_dir[] DECLSPEC_HIDDEN;
|
2018-02-19 19:38:29 +01:00
|
|
|
extern const WCHAR system_dir[] DECLSPEC_HIDDEN;
|
2021-03-31 10:20:02 +02:00
|
|
|
extern HMODULE kernel32_handle DECLSPEC_HIDDEN;
|
2003-04-08 01:27:54 +02:00
|
|
|
|
2020-09-01 12:48:04 +02:00
|
|
|
extern void (FASTCALL *pBaseThreadInitThunk)(DWORD,LPTHREAD_START_ROUTINE,void *) DECLSPEC_HIDDEN;
|
2020-05-14 15:17:06 +02:00
|
|
|
extern const struct unix_funcs *unix_funcs DECLSPEC_HIDDEN;
|
2008-02-12 22:39:19 +01:00
|
|
|
|
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
|
|
|
|
2021-10-22 11:12:17 +02:00
|
|
|
extern int CDECL NTDLL__vsnprintf( char *str, SIZE_T len, const char *format, va_list args ) DECLSPEC_HIDDEN;
|
|
|
|
extern int CDECL NTDLL__vsnwprintf( WCHAR *str, SIZE_T len, const WCHAR *format, va_list args ) DECLSPEC_HIDDEN;
|
2009-01-28 19:17:34 +01:00
|
|
|
|
2021-04-19 14:55:50 +02:00
|
|
|
struct dllredirect_data
|
|
|
|
{
|
|
|
|
ULONG size;
|
|
|
|
ULONG flags;
|
|
|
|
ULONG total_len;
|
|
|
|
ULONG paths_count;
|
|
|
|
ULONG paths_offset;
|
|
|
|
struct { ULONG len; ULONG offset; } paths[1];
|
|
|
|
};
|
|
|
|
|
|
|
|
#define DLL_REDIRECT_PATH_INCLUDES_BASE_NAME 1
|
|
|
|
#define DLL_REDIRECT_PATH_OMITS_ASSEMBLY_ROOT 2
|
|
|
|
#define DLL_REDIRECT_PATH_EXPAND 4
|
|
|
|
#define DLL_REDIRECT_PATH_SYSTEM_DEFAULT_REDIRECTED_SYSTEM32_DLL 8
|
2006-02-22 16:30:05 +01:00
|
|
|
|
2021-04-01 12:25:21 +02:00
|
|
|
#ifdef _WIN64
|
|
|
|
static inline TEB64 *NtCurrentTeb64(void) { return NULL; }
|
|
|
|
#else
|
2020-07-24 11:24:31 +02:00
|
|
|
static inline TEB64 *NtCurrentTeb64(void) { return (TEB64 *)NtCurrentTeb()->GdiBatchCount; }
|
|
|
|
#endif
|
|
|
|
|
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*);
|
|
|
|
|
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++;
|
|
|
|
}
|
|
|
|
|
2020-10-06 12:04:47 +02:00
|
|
|
/* FLS data */
|
2020-10-06 12:04:49 +02:00
|
|
|
extern TEB_FLS_DATA *fls_alloc_data(void) DECLSPEC_HIDDEN;
|
2020-10-06 12:04:47 +02: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
|
|
|
#endif
|