summaryrefslogtreecommitdiff
path: root/src/pal/inc
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal/inc')
-rw-r--r--src/pal/inc/mbusafecrt.h2
-rw-r--r--src/pal/inc/pal.h878
-rw-r--r--src/pal/inc/pal_char16.h5
-rw-r--r--src/pal/inc/pal_mstypes.h10
-rw-r--r--src/pal/inc/rt/intsafe.h44
-rw-r--r--src/pal/inc/rt/palrt.h51
-rw-r--r--src/pal/inc/rt/safecrt.h8
-rw-r--r--src/pal/inc/rt/sal.h2
-rw-r--r--src/pal/inc/rt/specstrings_strict.h2
-rw-r--r--src/pal/inc/rt/specstrings_undef.h2
-rw-r--r--src/pal/inc/rt/vsassert.h5
-rw-r--r--src/pal/inc/strsafe.h593
-rw-r--r--src/pal/inc/unixasmmacrosarm64.inc3
13 files changed, 42 insertions, 1563 deletions
diff --git a/src/pal/inc/mbusafecrt.h b/src/pal/inc/mbusafecrt.h
index 8cf050f..f030b7d 100644
--- a/src/pal/inc/mbusafecrt.h
+++ b/src/pal/inc/mbusafecrt.h
@@ -56,7 +56,7 @@ extern WCHAR* wcstok_s( WCHAR* inString, const WCHAR* inControl, WCHAR** ioConte
// strnlen is not required unless the source string is completely untrusted (e.g. anonymous input on a website)
#ifndef SUPPRESS_STRNLEN
extern size_t PAL_strnlen( const char* inString, size_t inMaxSize );
- extern size_t wcsnlen( const WCHAR* inString, size_t inMaxSize );
+ extern size_t PAL_wcsnlen( const WCHAR* inString, size_t inMaxSize );
#endif
extern errno_t _itoa_s( int inValue, char* outBuffer, size_t inDestBufferSize, int inRadix );
diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h
index 0d7c89e..d0b78e9 100644
--- a/src/pal/inc/pal.h
+++ b/src/pal/inc/pal.h
@@ -50,7 +50,6 @@ Abstract:
extern "C" {
#endif
-#if defined (PLATFORM_UNIX)
// This macro is used to standardize the wide character string literals between UNIX and Windows.
// Unix L"" is UTF32, and on windows it's UTF16. Because of built-in assumptions on the size
// of string literals, it's important to match behaviour between Unix and Windows. Unix will be defined
@@ -65,8 +64,6 @@ extern "C" {
#define QUOTE_MACRO_u_HELPER(x) u###x
#define QUOTE_MACRO_u(x) QUOTE_MACRO_u_HELPER(x)
-#endif
-
#include <pal_char16.h>
#include <pal_error.h>
#include <pal_mstypes.h>
@@ -83,16 +80,6 @@ extern "C" {
#define _M_IX86 400
#elif defined(__i386__) && !defined(_M_IX86)
#define _M_IX86 300
-#elif defined(__ppc__) && !defined(_M_PPC)
-#define _M_PPC 100
-#elif defined(_AIX) && defined(_POWER) && !defined(_M_PPC)
-#define _M_PPC 100
-#elif defined(__sparc__) && !defined(_M_SPARC)
-#define _M_SPARC 100
-#elif defined(__hppa__) && !defined(_M_PARISC)
-#define _M_PARISC 100
-#elif defined(__ia64__) && !defined(_M_IA64)
-#define _M_IA64 64100
#elif defined(__x86_64__) && !defined(_M_AMD64)
#define _M_AMD64 100
#elif defined(__arm__) && !defined(_M_ARM)
@@ -103,20 +90,6 @@ extern "C" {
#if defined(_M_IX86) && !defined(_X86_)
#define _X86_
-#elif defined(_M_ALPHA) && !defined(_ALPHA_)
-#define _ALPHA_
-#elif defined(_M_PPC) && !defined(_PPC_)
-#define _PPC_
-#elif defined(_M_SPARC) && !defined(_SPARC_)
-#define _SPARC_
-#elif defined(_M_PARISC) && !defined(_PARISC_)
-#define _PARISC_
-#elif defined(_M_MRX000) && !defined(_MIPS_)
-#define _MIPS_
-#elif defined(_M_M68K) && !defined(_68K_)
-#define _68K_
-#elif defined(_M_IA64) && !defined(_IA64_)
-#define _IA64_
#elif defined(_M_AMD64) && !defined(_AMD64_)
#define _AMD64_
#elif defined(_M_ARM) && !defined(_ARM_)
@@ -129,10 +102,6 @@ extern "C" {
/******************* ABI-specific glue *******************************/
-#if defined(_PPC_) || defined(_PPC64_) || defined(_SPARC_) || defined(_PARISC_) || defined(_IA64_)
-#define BIGENDIAN 1
-#endif
-
#ifdef __APPLE__
// Both PowerPC, i386 and x86_64 on Mac OS X use 16-byte alignment.
#define STACK_ALIGN_BITS 4
@@ -191,19 +160,7 @@ extern "C" {
#define __annotation(x)
#endif //!MSC_VER
-#ifdef _MSC_VER
-
-#if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64)
-#define UNALIGNED __unaligned
-#else
#define UNALIGNED
-#endif
-
-#else // _MSC_VER
-
-#define UNALIGNED
-
-#endif // _MSC_VER
#ifndef FORCEINLINE
#if _MSC_VER < 1200
@@ -215,75 +172,19 @@ extern "C" {
#ifndef PAL_STDCPP_COMPAT
-#ifdef _M_ALPHA
+#if __GNUC__
-typedef struct {
- char *a0; /* pointer to first homed integer argument */
- int offset; /* byte offset of next parameter */
-} va_list;
-
-#define va_start(list, v) __builtin_va_start(list, v, 1)
-#define va_end(list)
-
-#elif __GNUC__
-
-#if defined(_AIX)
-
-typedef __builtin_va_list __gnuc_va_list;
typedef __builtin_va_list va_list;
-#define va_start(v,l) __builtin_va_start(v,l)
-#define va_end __builtin_va_end
-#define va_arg __builtin_va_arg
-
-#else // _AIX
-
-#if __GNUC__ == 2
-typedef void * va_list;
-#else
-typedef __builtin_va_list va_list;
-#endif // __GNUC__
/* We should consider if the va_arg definition here is actually necessary.
Could we use the standard va_arg definition? */
-#if __GNUC__ == 2
-#if defined(_SPARC_) || defined(_PARISC_) // ToDo: is this the right thing for PARISC?
-#define va_start(list, v) (__builtin_next_arg(v), list = (char *) __builtin_saveregs())
-#define __va_rounded_size(TYPE) \
- (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
-#define __record_type_class 12
-#define __real_type_class 8
-#define va_arg(pvar,TYPE) \
-__extension__ \
-(*({((__builtin_classify_type (*(TYPE*) 0) >= __record_type_class \
- || (__builtin_classify_type (*(TYPE*) 0) == __real_type_class \
- && sizeof (TYPE) == 16)) \
- ? ((pvar) = (char *)(pvar) + __va_rounded_size (TYPE *), \
- *(TYPE **) (void *) ((char *)(pvar) - __va_rounded_size (TYPE *))) \
- : __va_rounded_size (TYPE) == 8 \
- ? ({ union {char __d[sizeof (TYPE)]; int __i[2];} __u; \
- __u.__i[0] = ((int *) (void *) (pvar))[0]; \
- __u.__i[1] = ((int *) (void *) (pvar))[1]; \
- (pvar) = (char *)(pvar) + 8; \
- (TYPE *) (void *) __u.__d; }) \
- : ((pvar) = (char *)(pvar) + __va_rounded_size (TYPE), \
- ((TYPE *) (void *) ((char *)(pvar) - __va_rounded_size (TYPE)))));}))
-#else // _SPARC_ or _PARISC_
-// GCC 2.95.3 on non-SPARC
-#define __va_size(type) (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
-#define va_start(list, v) ((list) = (va_list) __builtin_next_arg(v))
-#define va_arg(ap, type) (*(type *)((ap) += __va_size(type), (ap) - __va_size(type)))
-#endif // _SPARC_ or _PARISC_
-#else // __GNUC__ == 2
#define va_start __builtin_va_start
#define va_arg __builtin_va_arg
-#endif // __GNUC__ == 2
#define va_copy __builtin_va_copy
#define va_end __builtin_va_end
-#endif // _AIX
-
#define VOID void
#define PUB __attribute__((visibility("default")))
@@ -628,26 +529,6 @@ PAL_Random(
IN OUT LPVOID lpBuffer,
IN DWORD dwLength);
-#ifdef PLATFORM_UNIX
-
-PALIMPORT
-DWORD
-PALAPI
-PAL_CreateExecWatchpoint(
- HANDLE hThread,
- PVOID pvInstruction
- );
-
-PALIMPORT
-DWORD
-PALAPI
-PAL_DeleteExecWatchpoint(
- HANDLE hThread,
- PVOID pvInstruction
- );
-
-#endif
-
PALIMPORT
BOOL
PALAPI
@@ -1845,6 +1726,15 @@ QueueUserAPC(
#define CONTEXT_EXCEPTION_REQUEST 0x40000000L
#define CONTEXT_EXCEPTION_REPORTING 0x80000000L
+//
+// This flag is set by the unwinder if it has unwound to a call
+// site, and cleared whenever it unwinds through a trap frame.
+// It is used by language-specific exception handlers to help
+// differentiate exception scopes during dispatching.
+//
+
+#define CONTEXT_UNWOUND_TO_CALL 0x20000000
+
typedef struct _FLOATING_SAVE_AREA {
DWORD ControlWord;
DWORD StatusWord;
@@ -1905,658 +1795,21 @@ typedef struct _CONTEXT {
typedef struct _KNONVOLATILE_CONTEXT_POINTERS {
- // TODO WIP x86/Linux, need to fix this.
- PDWORD Ebx;
- PDWORD Esi;
+ // The ordering of these fields should be aligned with that
+ // of corresponding fields in CONTEXT
+ //
+ // (See FillRegDisplay in inc/regdisp.h for details)
PDWORD Edi;
+ PDWORD Esi;
+ PDWORD Ebx;
+ PDWORD Edx;
+ PDWORD Ecx;
+ PDWORD Eax;
+
PDWORD Ebp;
} KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
-#elif defined(_PPC_)
-
-//
-// ***********************************************************************************
-//
-// NOTE: These context definitions are replicated in ndp/clr/src/debug/inc/DbgTargetContext.h (for the
-// purposes manipulating contexts from different platforms during remote debugging). Be sure to keep those
-// definitions in sync if you make any changes here.
-//
-// ***********************************************************************************
-//
-
-#define CONTEXT_CONTROL 0x00000001L
-#define CONTEXT_FLOATING_POINT 0x00000002L
-#define CONTEXT_INTEGER 0x00000004L
-
-#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
-#define CONTEXT_ALL CONTEXT_FULL
-
-typedef struct _CONTEXT {
-
- //
- // This section is specified/returned if the ContextFlags word contains
- // the flag CONTEXT_FLOATING_POINT.
- //
-
- double Fpr0; // Floating registers 0..31
- double Fpr1;
- double Fpr2;
- double Fpr3;
- double Fpr4;
- double Fpr5;
- double Fpr6;
- double Fpr7;
- double Fpr8;
- double Fpr9;
- double Fpr10;
- double Fpr11;
- double Fpr12;
- double Fpr13;
- double Fpr14;
- double Fpr15;
- double Fpr16;
- double Fpr17;
- double Fpr18;
- double Fpr19;
- double Fpr20;
- double Fpr21;
- double Fpr22;
- double Fpr23;
- double Fpr24;
- double Fpr25;
- double Fpr26;
- double Fpr27;
- double Fpr28;
- double Fpr29;
- double Fpr30;
- double Fpr31;
- double Fpscr; // Floating point status/control reg
-
- //
- // This section is specified/returned if the ContextFlags word contains
- // the flag CONTEXT_INTEGER.
- //
-
- ULONG Gpr0; // General registers 0..31
- ULONG Gpr1; // StackPointer
- ULONG Gpr2;
- ULONG Gpr3;
- ULONG Gpr4;
- ULONG Gpr5;
- ULONG Gpr6;
- ULONG Gpr7;
- ULONG Gpr8;
- ULONG Gpr9;
- ULONG Gpr10;
- ULONG Gpr11;
- ULONG Gpr12;
- ULONG Gpr13;
- ULONG Gpr14;
- ULONG Gpr15;
- ULONG Gpr16;
- ULONG Gpr17;
- ULONG Gpr18;
- ULONG Gpr19;
- ULONG Gpr20;
- ULONG Gpr21;
- ULONG Gpr22;
- ULONG Gpr23;
- ULONG Gpr24;
- ULONG Gpr25;
- ULONG Gpr26;
- ULONG Gpr27;
- ULONG Gpr28;
- ULONG Gpr29;
- ULONG Gpr30;
- ULONG Gpr31;
-
- ULONG Cr; // Condition register
- ULONG Xer; // Fixed point exception register
-
- //
- // This section is specified/returned if the ContextFlags word contains
- // the flag CONTEXT_CONTROL.
- //
-
- ULONG Msr; // Machine status register
- ULONG Iar; // Instruction address register
- ULONG Lr; // Link register
- ULONG Ctr; // Count register
-
- //
- // The flags values within this flag control the contents of
- // a CONTEXT record.
- //
- // If the context record is used as an input parameter, then
- // for each portion of the context record controlled by a flag
- // whose value is set, it is assumed that that portion of the
- // context record contains valid context. If the context record
- // is being used to modify a thread's context, then only that
- // portion of the threads context will be modified.
- //
- // If the context record is used as an IN OUT parameter to capture
- // the context of a thread, then only those portions of the thread's
- // context corresponding to set flags will be returned.
- //
- // The context record is never used as an OUT only parameter.
- //
-
- ULONG ContextFlags;
-
- ULONG Fill[3]; // Pad out to multiple of 16 bytes
-
- //
- // This section is specified/returned if CONTEXT_DEBUG_REGISTERS is
- // set in ContextFlags. Note that CONTEXT_DEBUG_REGISTERS is NOT
- // included in CONTEXT_FULL.
- //
- ULONG Dr0; // Breakpoint Register 1
- ULONG Dr1; // Breakpoint Register 2
- ULONG Dr2; // Breakpoint Register 3
- ULONG Dr3; // Breakpoint Register 4
- ULONG Dr4; // Breakpoint Register 5
- ULONG Dr5; // Breakpoint Register 6
- ULONG Dr6; // Debug Status Register
- ULONG Dr7; // Debug Control Register
-
-} CONTEXT, *PCONTEXT, *LPCONTEXT;
-
-#elif defined(_SPARC_)
-
-#define CONTEXT_CONTROL 0x00000001L
-#define CONTEXT_FLOATING_POINT 0x00000002L
-#define CONTEXT_INTEGER 0x00000004L
-
-#define COUNT_FLOATING_REGISTER 32
-#define COUNT_DOUBLE_REGISTER 16
-#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
-#define CONTEXT_ALL CONTEXT_FULL
-
-typedef struct _CONTEXT {
- //
- // This section is specified/returned if the ContextFlags word contains
- // the flag CONTEXT_INTEGER.
- //
- ULONG g0;
- ULONG g1;
- ULONG g2;
- ULONG g3;
- ULONG g4;
- ULONG g5;
- ULONG g6;
- ULONG g7;
- ULONG o0;
- ULONG o1;
- ULONG o2;
- ULONG o3;
- ULONG o4;
- ULONG o5;
- ULONG sp;
- ULONG o7;
- ULONG l0;
- ULONG l1;
- ULONG l2;
- ULONG l3;
- ULONG l4;
- ULONG l5;
- ULONG l6;
- ULONG l7;
- ULONG i0;
- ULONG i1;
- ULONG i2;
- ULONG i3;
- ULONG i4;
- ULONG i5;
- ULONG fp;
- ULONG i7;
-
- ULONG y;
-
- //
- // This section is specified/returned if the ContextFlags word contains
- // the flag CONTEXT_CONTROL.
- //
-#if defined(__sparcv9)
- ULONG ccr;
-#else
- ULONG psr;
-#endif
- ULONG pc; // program counter
- ULONG npc; // next address to be executed
-
- ULONG ContextFlags;
-
- //
- // This section is specified/returned if the ContextFlags word contains
- // the flag CONTEXT_FLOATING_POINT.
- //
- ULONGLONG fsr;
- union {
- float f[COUNT_FLOATING_REGISTER];
- double d[COUNT_DOUBLE_REGISTER];
- } fprs;
-
-} CONTEXT, *PCONTEXT, *LPCONTEXT;
-
-#elif defined(_PARISC_)
-
-// ToDo: Get this correct for PARISC architecture
-#define CONTEXT_CONTROL 0x00000001L
-#define CONTEXT_FLOATING_POINT 0x00000002L
-#define CONTEXT_INTEGER 0x00000004L
-
-#define COUNT_FLOATING_REGISTER 32
-#define COUNT_DOUBLE_REGISTER 16
-#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
-#define CONTEXT_ALL CONTEXT_FULL
-
-typedef struct _CONTEXT {
- //
- // This section is specified/returned if the ContextFlags word contains
- // the flag CONTEXT_INTEGER.
- //
- ULONG g0;
- ULONG g1;
- ULONG g2;
- ULONG g3;
- ULONG g4;
- ULONG g5;
- ULONG g6;
- ULONG g7;
- ULONG o0;
- ULONG o1;
- ULONG o2;
- ULONG o3;
- ULONG o4;
- ULONG o5;
- ULONG sp;
- ULONG o7;
- ULONG l0;
- ULONG l1;
- ULONG l2;
- ULONG l3;
- ULONG l4;
- ULONG l5;
- ULONG l6;
- ULONG l7;
- ULONG i0;
- ULONG i1;
- ULONG i2;
- ULONG i3;
- ULONG i4;
- ULONG i5;
- ULONG fp;
- ULONG i7;
-
- ULONG y;
-
- //
- // This section is specified/returned if the ContextFlags word contains
- // the flag CONTEXT_CONTROL.
- //
- ULONG psr;
- ULONG pc; // program counter
- ULONG npc; // next address to be executed
-
- ULONG ContextFlags;
-
- //
- // This section is specified/returned if the ContextFlags word contains
- // the flag CONTEXT_FLOATING_POINT.
- //
- ULONGLONG fsr;
- union {
- float f[COUNT_FLOATING_REGISTER];
- double d[COUNT_DOUBLE_REGISTER];
- } fprs;
-
-} CONTEXT, *PCONTEXT, *LPCONTEXT;
-
-#elif defined(_IA64_)
-
-// copied from winnt.h
-typedef struct _FLOAT128 {
- __int64 LowPart;
- __int64 HighPart;
-} FLOAT128;
-
-typedef FLOAT128 *PFLOAT128;
-
-// begin_ntddk begin_nthal
-
-//
-// The following flags control the contents of the CONTEXT structure.
-//
-
-#if !defined(RC_INVOKED)
-
-#define CONTEXT_IA64 0x00080000
-
-#define CONTEXT_CONTROL (CONTEXT_IA64 | 0x00000001L)
-#define CONTEXT_LOWER_FLOATING_POINT (CONTEXT_IA64 | 0x00000002L)
-#define CONTEXT_HIGHER_FLOATING_POINT (CONTEXT_IA64 | 0x00000004L)
-#define CONTEXT_INTEGER (CONTEXT_IA64 | 0x00000008L)
-#define CONTEXT_DEBUG (CONTEXT_IA64 | 0x00000010L)
-#define CONTEXT_IA32_CONTROL (CONTEXT_IA64 | 0x00000020L) // Includes StIPSR
-
-
-#define CONTEXT_FLOATING_POINT (CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT)
-#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_IA32_CONTROL)
-#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_DEBUG | CONTEXT_IA32_CONTROL)
-
-#define CONTEXT_EXCEPTION_ACTIVE 0x8000000
-#define CONTEXT_SERVICE_ACTIVE 0x10000000
-#define CONTEXT_EXCEPTION_REQUEST 0x40000000
-#define CONTEXT_EXCEPTION_REPORTING 0x80000000
-
-#endif // !defined(RC_INVOKED)
-
-//
-// Context Frame
-//
-// This frame has a several purposes: 1) it is used as an argument to
-// NtContinue, 2) it is used to construct a call frame for APC delivery,
-// 3) it is used to construct a call frame for exception dispatching
-// in user mode, 4) it is used in the user level thread creation
-// routines, and 5) it is used to to pass thread state to debuggers.
-//
-// N.B. Because this record is used as a call frame, it must be EXACTLY
-// a multiple of 16 bytes in length and aligned on a 16-byte boundary.
-//
-
-typedef struct _CONTEXT {
-
- //
- // The flags values within this flag control the contents of
- // a CONTEXT record.
- //
- // If the context record is used as an input parameter, then
- // for each portion of the context record controlled by a flag
- // whose value is set, it is assumed that that portion of the
- // context record contains valid context. If the context record
- // is being used to modify a thread's context, then only that
- // portion of the threads context will be modified.
- //
- // If the context record is used as an IN OUT parameter to capture
- // the context of a thread, then only those portions of the thread's
- // context corresponding to set flags will be returned.
- //
- // The context record is never used as an OUT only parameter.
- //
-
- DWORD ContextFlags;
- DWORD Fill1[3]; // for alignment of following on 16-byte boundary
-
- //
- // This section is specified/returned if the ContextFlags word contains
- // the flag CONTEXT_DEBUG.
- //
- // N.B. CONTEXT_DEBUG is *not* part of CONTEXT_FULL.
- //
-
- ULONGLONG DbI0;
- ULONGLONG DbI1;
- ULONGLONG DbI2;
- ULONGLONG DbI3;
- ULONGLONG DbI4;
- ULONGLONG DbI5;
- ULONGLONG DbI6;
- ULONGLONG DbI7;
-
- ULONGLONG DbD0;
- ULONGLONG DbD1;
- ULONGLONG DbD2;
- ULONGLONG DbD3;
- ULONGLONG DbD4;
- ULONGLONG DbD5;
- ULONGLONG DbD6;
- ULONGLONG DbD7;
-
- //
- // This section is specified/returned if the ContextFlags word contains
- // the flag CONTEXT_LOWER_FLOATING_POINT.
- //
-
- FLOAT128 FltS0;
- FLOAT128 FltS1;
- FLOAT128 FltS2;
- FLOAT128 FltS3;
- FLOAT128 FltT0;
- FLOAT128 FltT1;
- FLOAT128 FltT2;
- FLOAT128 FltT3;
- FLOAT128 FltT4;
- FLOAT128 FltT5;
- FLOAT128 FltT6;
- FLOAT128 FltT7;
- FLOAT128 FltT8;
- FLOAT128 FltT9;
-
- //
- // This section is specified/returned if the ContextFlags word contains
- // the flag CONTEXT_HIGHER_FLOATING_POINT.
- //
-
- FLOAT128 FltS4;
- FLOAT128 FltS5;
- FLOAT128 FltS6;
- FLOAT128 FltS7;
- FLOAT128 FltS8;
- FLOAT128 FltS9;
- FLOAT128 FltS10;
- FLOAT128 FltS11;
- FLOAT128 FltS12;
- FLOAT128 FltS13;
- FLOAT128 FltS14;
- FLOAT128 FltS15;
- FLOAT128 FltS16;
- FLOAT128 FltS17;
- FLOAT128 FltS18;
- FLOAT128 FltS19;
-
- FLOAT128 FltF32;
- FLOAT128 FltF33;
- FLOAT128 FltF34;
- FLOAT128 FltF35;
- FLOAT128 FltF36;
- FLOAT128 FltF37;
- FLOAT128 FltF38;
- FLOAT128 FltF39;
-
- FLOAT128 FltF40;
- FLOAT128 FltF41;
- FLOAT128 FltF42;
- FLOAT128 FltF43;
- FLOAT128 FltF44;
- FLOAT128 FltF45;
- FLOAT128 FltF46;
- FLOAT128 FltF47;
- FLOAT128 FltF48;
- FLOAT128 FltF49;
-
- FLOAT128 FltF50;
- FLOAT128 FltF51;
- FLOAT128 FltF52;
- FLOAT128 FltF53;
- FLOAT128 FltF54;
- FLOAT128 FltF55;
- FLOAT128 FltF56;
- FLOAT128 FltF57;
- FLOAT128 FltF58;
- FLOAT128 FltF59;
-
- FLOAT128 FltF60;
- FLOAT128 FltF61;
- FLOAT128 FltF62;
- FLOAT128 FltF63;
- FLOAT128 FltF64;
- FLOAT128 FltF65;
- FLOAT128 FltF66;
- FLOAT128 FltF67;
- FLOAT128 FltF68;
- FLOAT128 FltF69;
-
- FLOAT128 FltF70;
- FLOAT128 FltF71;
- FLOAT128 FltF72;
- FLOAT128 FltF73;
- FLOAT128 FltF74;
- FLOAT128 FltF75;
- FLOAT128 FltF76;
- FLOAT128 FltF77;
- FLOAT128 FltF78;
- FLOAT128 FltF79;
-
- FLOAT128 FltF80;
- FLOAT128 FltF81;
- FLOAT128 FltF82;
- FLOAT128 FltF83;
- FLOAT128 FltF84;
- FLOAT128 FltF85;
- FLOAT128 FltF86;
- FLOAT128 FltF87;
- FLOAT128 FltF88;
- FLOAT128 FltF89;
-
- FLOAT128 FltF90;
- FLOAT128 FltF91;
- FLOAT128 FltF92;
- FLOAT128 FltF93;
- FLOAT128 FltF94;
- FLOAT128 FltF95;
- FLOAT128 FltF96;
- FLOAT128 FltF97;
- FLOAT128 FltF98;
- FLOAT128 FltF99;
-
- FLOAT128 FltF100;
- FLOAT128 FltF101;
- FLOAT128 FltF102;
- FLOAT128 FltF103;
- FLOAT128 FltF104;
- FLOAT128 FltF105;
- FLOAT128 FltF106;
- FLOAT128 FltF107;
- FLOAT128 FltF108;
- FLOAT128 FltF109;
-
- FLOAT128 FltF110;
- FLOAT128 FltF111;
- FLOAT128 FltF112;
- FLOAT128 FltF113;
- FLOAT128 FltF114;
- FLOAT128 FltF115;
- FLOAT128 FltF116;
- FLOAT128 FltF117;
- FLOAT128 FltF118;
- FLOAT128 FltF119;
-
- FLOAT128 FltF120;
- FLOAT128 FltF121;
- FLOAT128 FltF122;
- FLOAT128 FltF123;
- FLOAT128 FltF124;
- FLOAT128 FltF125;
- FLOAT128 FltF126;
- FLOAT128 FltF127;
-
- //
- // This section is specified/returned if the ContextFlags word contains
- // the flag CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT | CONTEXT_CONTROL.
- //
-
- ULONGLONG StFPSR; // FP status
-
- //
- // This section is specified/returned if the ContextFlags word contains
- // the flag CONTEXT_INTEGER.
- //
- // N.B. The registers gp, sp, rp are part of the control context
- //
-
- ULONGLONG IntGp; // r1, volatile
- ULONGLONG IntT0; // r2-r3, volatile
- ULONGLONG IntT1; //
- ULONGLONG IntS0; // r4-r7, preserved
- ULONGLONG IntS1;
- ULONGLONG IntS2;
- ULONGLONG IntS3;
- ULONGLONG IntV0; // r8, volatile
- ULONGLONG IntT2; // r9-r11, volatile
- ULONGLONG IntT3;
- ULONGLONG IntT4;
- ULONGLONG IntSp; // stack pointer (r12), special
- ULONGLONG IntTeb; // teb (r13), special
- ULONGLONG IntT5; // r14-r31, volatile
- ULONGLONG IntT6;
- ULONGLONG IntT7;
- ULONGLONG IntT8;
- ULONGLONG IntT9;
- ULONGLONG IntT10;
- ULONGLONG IntT11;
- ULONGLONG IntT12;
- ULONGLONG IntT13;
- ULONGLONG IntT14;
- ULONGLONG IntT15;
- ULONGLONG IntT16;
- ULONGLONG IntT17;
- ULONGLONG IntT18;
- ULONGLONG IntT19;
- ULONGLONG IntT20;
- ULONGLONG IntT21;
- ULONGLONG IntT22;
-
- ULONGLONG IntNats; // Nat bits for r1-r31
- // r1-r31 in bits 1 thru 31.
- ULONGLONG Preds; // predicates, preserved
-
- ULONGLONG BrRp; // return pointer, b0, preserved
- ULONGLONG BrS0; // b1-b5, preserved
- ULONGLONG BrS1;
- ULONGLONG BrS2;
- ULONGLONG BrS3;
- ULONGLONG BrS4;
- ULONGLONG BrT0; // b6-b7, volatile
- ULONGLONG BrT1;
-
- //
- // This section is specified/returned if the ContextFlags word contains
- // the flag CONTEXT_CONTROL.
- //
-
- // Other application registers
- ULONGLONG ApUNAT; // User Nat collection register, preserved
- ULONGLONG ApLC; // Loop counter register, preserved
- ULONGLONG ApEC; // Epilog counter register, preserved
- ULONGLONG ApCCV; // CMPXCHG value register, volatile
- ULONGLONG ApDCR; // Default control register (TBD)
-
- // Register stack info
- ULONGLONG RsPFS; // Previous function state, preserved
- ULONGLONG RsBSP; // Backing store pointer, preserved
- ULONGLONG RsBSPSTORE;
- ULONGLONG RsRSC; // RSE configuration, volatile
- ULONGLONG RsRNAT; // RSE Nat collection register, preserved
-
- // Trap Status Information
- ULONGLONG StIPSR; // Interruption Processor Status
- ULONGLONG StIIP; // Interruption IP
- ULONGLONG StIFS; // Interruption Function State
-
- // iA32 related control registers
- ULONGLONG StFCR; // copy of Ar21
- ULONGLONG Eflag; // Eflag copy of Ar24
- ULONGLONG SegCSD; // iA32 CSDescriptor (Ar25)
- ULONGLONG SegSSD; // iA32 SSDescriptor (Ar26)
- ULONGLONG Cflag; // Cr0+Cr4 copy of Ar27
- ULONGLONG StFSR; // x86 FP status (copy of AR28)
- ULONGLONG StFIR; // x86 FP status (copy of AR29)
- ULONGLONG StFDR; // x86 FP status (copy of AR30)
-
- ULONGLONG UNUSEDPACK; // added to pack StFDR to 16-bytes
-
-} CONTEXT, *PCONTEXT, *LPCONTEXT;
#elif defined(_AMD64_)
// copied from winnt.h
@@ -3286,13 +2539,9 @@ PALIMPORT BOOL PALAPI PAL_VirtualUnwindOutOfProc(CONTEXT *context,
#define GetLogicalProcessorCacheSizeFromOS PAL_GetLogicalProcessorCacheSizeFromOS
-#ifdef PLATFORM_UNIX
-
/* PAL_CS_NATIVE_DATA_SIZE is defined as sizeof(PAL_CRITICAL_SECTION_NATIVE_DATA) */
-#if defined(_AIX)
-#define PAL_CS_NATIVE_DATA_SIZE 100
-#elif defined(__APPLE__) && defined(__i386__)
+#if defined(__APPLE__) && defined(__i386__)
#define PAL_CS_NATIVE_DATA_SIZE 76
#elif defined(__APPLE__) && defined(__x86_64__)
#define PAL_CS_NATIVE_DATA_SIZE 120
@@ -3300,8 +2549,6 @@ PALIMPORT BOOL PALAPI PAL_VirtualUnwindOutOfProc(CONTEXT *context,
#define PAL_CS_NATIVE_DATA_SIZE 12
#elif defined(__FreeBSD__) && defined(__x86_64__)
#define PAL_CS_NATIVE_DATA_SIZE 24
-#elif defined(__hpux__) && (defined(__hppa__) || defined (__ia64__))
-#define PAL_CS_NATIVE_DATA_SIZE 148
#elif defined(__linux__) && defined(_ARM_)
#define PAL_CS_NATIVE_DATA_SIZE 80
#elif defined(__linux__) && defined(_ARM64_)
@@ -3314,25 +2561,13 @@ PALIMPORT BOOL PALAPI PAL_VirtualUnwindOutOfProc(CONTEXT *context,
#define PAL_CS_NATIVE_DATA_SIZE 96
#elif defined(__NetBSD__) && defined(__earm__)
#define PAL_CS_NATIVE_DATA_SIZE 56
-#elif defined(__NetBSD__) && defined(__hppa__)
-#define PAL_CS_NATIVE_DATA_SIZE 92
#elif defined(__NetBSD__) && defined(__i386__)
#define PAL_CS_NATIVE_DATA_SIZE 56
-#elif defined(__NetBSD__) && defined(__mips__)
-#define PAL_CS_NATIVE_DATA_SIZE 56
-#elif defined(__NetBSD__) && (defined(__sparc__) && !defined(__sparc64__))
-#define PAL_CS_NATIVE_DATA_SIZE 56
-#elif defined(__NetBSD__) && defined(__sparc64__)
-#define PAL_CS_NATIVE_DATA_SIZE 92
-#elif defined(__sun__)
-#define PAL_CS_NATIVE_DATA_SIZE 48
#else
#warning
#error PAL_CS_NATIVE_DATA_SIZE is not defined for this architecture
#endif
-#endif // PLATFORM_UNIX
-
//
typedef struct _CRITICAL_SECTION {
PVOID DebugInfo;
@@ -3342,7 +2577,6 @@ typedef struct _CRITICAL_SECTION {
HANDLE LockSemaphore;
ULONG_PTR SpinCount;
-#ifdef PLATFORM_UNIX
BOOL bInternal;
volatile DWORD dwInitState;
union CSNativeDataStorage
@@ -3350,7 +2584,6 @@ typedef struct _CRITICAL_SECTION {
BYTE rgNativeDataStorage[PAL_CS_NATIVE_DATA_SIZE];
VOID * pvAlign; // make sure the storage is machine-pointer-size aligned
} csnds;
-#endif // PLATFORM_UNIX
} CRITICAL_SECTION, *PCRITICAL_SECTION, *LPCRITICAL_SECTION;
PALIMPORT VOID PALAPI EnterCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);
@@ -4554,33 +3787,6 @@ PAL_GetCalendar(
#define GEOID_NOT_AVAILABLE -1
-// "a number", might represent different types
-typedef struct PALNUMBER__* PALNUMBER;
-
-// return NULL on OOM
-PALIMPORT PALNUMBER PALAPI PAL_DoubleToNumber(double);
-PALIMPORT PALNUMBER PALAPI PAL_Int64ToNumber(INT64);
-PALIMPORT PALNUMBER PALAPI PAL_UInt64ToNumber(UINT64);
-PALIMPORT PALNUMBER PALAPI PAL_IntToNumber(int);
-PALIMPORT PALNUMBER PALAPI PAL_UIntToNumber(unsigned int);
-
-PALIMPORT void PALAPI PAL_ReleaseNumber(PALNUMBER);
-
-
-// return string length if Buffer is NULL or the result fits in cchBuffer, otherwise -1
-PALIMPORT int PALAPI PAL_FormatScientific(LPCWSTR sLocale, LPWSTR pBuffer, SIZE_T cchBuffer, PALNUMBER number, int nMinDigits, int nMaxDigits,
- LPCWSTR sExponent, LPCWSTR sNumberDecimal, LPCWSTR sPositive, LPCWSTR sNegative, LPCWSTR sZero);
-
-PALIMPORT int PALAPI PAL_FormatCurrency(LPCWSTR sLocale, LPWSTR pBuffer, SIZE_T cchBuffer, PALNUMBER number, int nMinDigits, int nMaxDigits, int iNegativeFormat, int iPositiveFormat,
- int iPrimaryGroup, int iSecondaryGroup, LPCWSTR sCurrencyDecimal, LPCWSTR sCurrencyGroup, LPCWSTR sNegative, LPCWSTR sCurrency, LPCWSTR sZero);
-
-PALIMPORT int PALAPI PAL_FormatPercent(LPCWSTR sLocale, LPWSTR pBuffer, SIZE_T cchBuffer, PALNUMBER number, int nMinDigits, int nMaxDigits,int iNegativeFormat, int iPositiveFormat,
- int iPrimaryGroup, int iSecondaryGroup, LPCWSTR sPercentDecimal, LPCWSTR sPercentGroup, LPCWSTR sNegative, LPCWSTR sPercent, LPCWSTR sZero);
-
-PALIMPORT int PALAPI PAL_FormatDecimal(LPCWSTR sLocale, LPWSTR pBuffer, SIZE_T cchBuffer, PALNUMBER number, int nMinDigits, int nMaxDigits, int iNegativeFormat,
- int iPrimaryGroup, int iSecondaryGroup, LPCWSTR sDecimal, LPCWSTR sGroup, LPCWSTR sNegative, LPCWSTR sZero);
-
-
#define DATE_USE_ALT_CALENDAR 0x00000004
#if ENABLE_DOWNLEVEL_FOR_NLS
@@ -4706,7 +3912,7 @@ enum {
//
typedef struct _RUNTIME_FUNCTION {
DWORD BeginAddress;
-#ifdef _AMD64_
+#ifdef _TARGET_AMD64_
DWORD EndAddress;
#endif
DWORD UnwindData;
@@ -5660,14 +4866,12 @@ CoCreateGuid(OUT GUID * pguid);
/* Some C runtime functions needs to be reimplemented by the PAL.
To avoid name collisions, those functions have been renamed using
defines */
-#ifdef PLATFORM_UNIX
#ifndef PAL_STDCPP_COMPAT
#define exit PAL_exit
#define atexit PAL_atexit
#define printf PAL_printf
#define vprintf PAL_vprintf
#define wprintf PAL_wprintf
-#define swprintf PAL_swprintf
#define wcsspn PAL_wcsspn
#define wcstod PAL_wcstod
#define wcstol PAL_wcstol
@@ -5694,8 +4898,6 @@ CoCreateGuid(OUT GUID * pguid);
#define iswxdigit PAL_iswxdigit
#define towlower PAL_towlower
#define towupper PAL_towupper
-#define vsprintf PAL_vsprintf
-#define vswprintf PAL_vswprintf
#define realloc PAL_realloc
#define fopen PAL_fopen
#define strtok PAL_strtok
@@ -5758,8 +4960,8 @@ CoCreateGuid(OUT GUID * pguid);
#define _close PAL__close
#define _wcstoui64 PAL__wcstoui64
#define _flushall PAL__flushall
-#define _vsnprintf PAL__vsnprintf
#define strnlen PAL_strnlen
+#define wcsnlen PAL_wcsnlen
#ifdef _AMD64_
#define _mm_getcsr PAL__mm_getcsr
@@ -5767,7 +4969,6 @@ CoCreateGuid(OUT GUID * pguid);
#endif // _AMD64_
#endif // !PAL_STDCPP_COMPAT
-#endif // PLATFORM_UNIX
#ifndef _CONST_RETURN
#ifdef __cplusplus
@@ -5836,7 +5037,6 @@ PALIMPORT char * __cdecl strstr(const char *, const char *);
PALIMPORT char * __cdecl strtok(char *, const char *);
PALIMPORT size_t __cdecl strspn(const char *, const char *);
PALIMPORT size_t __cdecl strcspn(const char *, const char *);
-PALIMPORT int __cdecl vsprintf(char *, const char *, va_list);
PALIMPORT int __cdecl atoi(const char *);
PALIMPORT LONG __cdecl atol(const char *);
PALIMPORT ULONG __cdecl strtoul(const char *, char **, int);
@@ -5900,7 +5100,6 @@ PALIMPORT WCHAR * __cdecl PAL_wcstok(WCHAR *, const WCHAR *);
PALIMPORT size_t __cdecl PAL_wcscspn(const WCHAR *, const WCHAR *);
PALIMPORT int __cdecl PAL_swprintf(WCHAR *, const WCHAR *, ...);
PALIMPORT int __cdecl PAL_vswprintf(WCHAR *, const WCHAR *, va_list);
-PALIMPORT int __cdecl PAL__vsnprintf(LPSTR Buffer, size_t Count, LPCSTR Format, va_list ap);
PALIMPORT int __cdecl PAL_swscanf(const WCHAR *, const WCHAR *, ...);
PALIMPORT LONG __cdecl PAL_wcstol(const WCHAR *, WCHAR **, int);
PALIMPORT ULONG __cdecl PAL_wcstoul(const WCHAR *, WCHAR **, int);
@@ -6048,17 +5247,11 @@ PALIMPORT char * __cdecl _strdup(const char *);
#if defined(_MSC_VER)
#define alloca _alloca
-#elif defined(PLATFORM_UNIX)
-#define _alloca alloca
#else
-// MingW
-#define _alloca __builtin_alloca
-#define alloca __builtin_alloca
+#define _alloca alloca
#endif //_MSC_VER
-#if defined(__GNUC__) && defined(PLATFORM_UNIX)
#define alloca __builtin_alloca
-#endif // __GNUC__
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
@@ -6527,10 +5720,10 @@ public:
}
};
-typedef BOOL (PALAPI *PHARDWARE_EXCEPTION_HANDLER)(PAL_SEHException* ex);
-typedef BOOL (PALAPI *PHARDWARE_EXCEPTION_SAFETY_CHECK_FUNCTION)(PCONTEXT contextRecord, PEXCEPTION_RECORD exceptionRecord);
-typedef VOID (PALAPI *PTERMINATION_REQUEST_HANDLER)();
-typedef DWORD (PALAPI *PGET_GCMARKER_EXCEPTION_CODE)(LPVOID ip);
+typedef BOOL (*PHARDWARE_EXCEPTION_HANDLER)(PAL_SEHException* ex);
+typedef BOOL (*PHARDWARE_EXCEPTION_SAFETY_CHECK_FUNCTION)(PCONTEXT contextRecord, PEXCEPTION_RECORD exceptionRecord);
+typedef VOID (*PTERMINATION_REQUEST_HANDLER)();
+typedef DWORD (*PGET_GCMARKER_EXCEPTION_CODE)(LPVOID ip);
PALIMPORT
VOID
@@ -6819,24 +6012,13 @@ public:
// Platform-specific library naming
//
-#ifdef PLATFORM_UNIX
#ifdef __APPLE__
#define MAKEDLLNAME_W(name) u"lib" name u".dylib"
#define MAKEDLLNAME_A(name) "lib" name ".dylib"
-#elif defined(_AIX)
-#define MAKEDLLNAME_W(name) L"lib" name L".a"
-#define MAKEDLLNAME_A(name) "lib" name ".a"
-#elif defined(__hppa__) || defined(_IA64_)
-#define MAKEDLLNAME_W(name) L"lib" name L".sl"
-#define MAKEDLLNAME_A(name) "lib" name ".sl"
#else
#define MAKEDLLNAME_W(name) u"lib" name u".so"
#define MAKEDLLNAME_A(name) "lib" name ".so"
#endif
-#else
-#define MAKEDLLNAME_W(name) name L".dll"
-#define MAKEDLLNAME_A(name) name ".dll"
-#endif
#ifdef UNICODE
#define MAKEDLLNAME(x) MAKEDLLNAME_W(x)
@@ -6848,10 +6030,6 @@ public:
#if __APPLE__
#define PAL_SHLIB_SUFFIX ".dylib"
-#elif _AIX
-#define PAL_SHLIB_SUFFIX ".a"
-#elif _HPUX_
-#define PAL_SHLIB_SUFFIX ".sl"
#else
#define PAL_SHLIB_SUFFIX ".so"
#endif
diff --git a/src/pal/inc/pal_char16.h b/src/pal/inc/pal_char16.h
index 4600cc7..0697b23 100644
--- a/src/pal/inc/pal_char16.h
+++ b/src/pal/inc/pal_char16.h
@@ -27,12 +27,10 @@ This file is used to define the wchar_t type as a 16-bit type on Unix.
// vc++, for whom wchar_t is already a typedef instead of a built-in.
#ifndef PAL_STDCPP_COMPAT
-#if defined (PLATFORM_UNIX) && defined(__GNUC__)
#undef wchar_t
#undef __WCHAR_TYPE__
#define __WCHAR_TYPE__ __wchar_16_cpp__
#define wchar_t __wchar_16_cpp__
-#endif // PLATFORM_UNIX
// Set up the wchar_t type (which got preprocessed to __wchar_16_cpp__).
// In C++11, the standard gives us char16_t, which is what we want (and matches types with u"")
@@ -40,7 +38,6 @@ This file is used to define the wchar_t type as a 16-bit type on Unix.
// **** WARNING: Linking C and C++ objects will break with -fstrict-aliasing with GCC/Clang
// due to conditional typedef
#if !defined(_WCHAR_T_DEFINED) || !defined(_MSC_VER)
-#if defined (PLATFORM_UNIX)
#if defined(__cplusplus)
#undef __WCHAR_TYPE__
#define __WCHAR_TYPE__ char16_t
@@ -50,7 +47,7 @@ typedef char16_t wchar_t;
#define __WCHAR_TYPE__ unsigned short
typedef unsigned short wchar_t;
#endif // __cplusplus
-#endif // PLATFORM_UNIX
+
#ifndef _WCHAR_T_DEFINED
#define _WCHAR_T_DEFINED
#endif // !_WCHAR_T_DEFINED
diff --git a/src/pal/inc/pal_mstypes.h b/src/pal/inc/pal_mstypes.h
index b9c3ac2..1f5c11d 100644
--- a/src/pal/inc/pal_mstypes.h
+++ b/src/pal/inc/pal_mstypes.h
@@ -235,13 +235,8 @@ typedef long double LONG_DOUBLE;
typedef void VOID;
-#ifndef PLATFORM_UNIX
-typedef long LONG;
-typedef unsigned long ULONG;
-#else
typedef int LONG; // NOTE: diff from windows.h, for LP64 compat
typedef unsigned int ULONG; // NOTE: diff from windows.h, for LP64 compat
-#endif
typedef __int64 LONGLONG;
typedef unsigned __int64 ULONGLONG;
@@ -260,12 +255,7 @@ typedef UCHAR *PUCHAR;
typedef char *PSZ;
typedef ULONGLONG DWORDLONG;
-#ifndef PLATFORM_UNIX
-typedef unsigned long DWORD;
-#else
typedef unsigned int DWORD; // NOTE: diff from windows.h, for LP64 compat
-#endif
-
typedef unsigned int DWORD32, *PDWORD32;
typedef int BOOL;
diff --git a/src/pal/inc/rt/intsafe.h b/src/pal/inc/rt/intsafe.h
index 2ab2cf1..4ed70e7 100644
--- a/src/pal/inc/rt/intsafe.h
+++ b/src/pal/inc/rt/intsafe.h
@@ -38,47 +38,6 @@ UnsignedMultiply128 (
#endif
#endif // _AMD64_
-#ifndef FEATURE_PAL
-
-#ifdef _WIN64
-typedef unsigned __int64 size_t;
-typedef unsigned __int64 UINT_PTR;
-typedef unsigned __int64 ULONG_PTR;
-typedef unsigned __int64 DWORD_PTR;
-typedef unsigned __int64 SIZE_T;
-#else
-typedef __w64 unsigned int size_t;
-typedef __w64 unsigned int UINT_PTR;
-typedef __w64 unsigned long ULONG_PTR;
-typedef __w64 unsigned long DWORD_PTR;
-typedef __w64 unsigned long SIZE_T;
-#endif
-typedef char CHAR;
-typedef int INT;
-typedef long LONG;
-typedef unsigned char UCHAR;
-typedef unsigned short USHORT;
-typedef unsigned short WORD;
-typedef unsigned int UINT;
-typedef unsigned long ULONG;
-typedef unsigned long DWORD;
-typedef unsigned __int64 ULONGLONG;
-
-
-typedef LONG HRESULT;
-
-#ifndef SUCCEEDED
-#define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)
-#endif
-
-#ifndef FAILED
-#define FAILED(hr) (((HRESULT)(hr)) < 0)
-#endif
-
-#define S_OK ((HRESULT)0x00000000L)
-
-#endif // !FEATURE_PAL
-
#define INTSAFE_E_ARITHMETIC_OVERFLOW ((HRESULT)0x80070216L) // 0x216 = 534 = ERROR_ARITHMETIC_OVERFLOW
#ifndef LOWORD
@@ -93,8 +52,7 @@ typedef LONG HRESULT;
#define LODWORD(_qw) ((ULONG)(_qw))
#if defined(MIDL_PASS) || defined(RC_INVOKED) || defined(_M_CEE_PURE) \
- || defined(_68K_) || defined(_MPPC_) || defined(_PPC_) \
- || defined(_M_IA64) || defined(_M_AMD64) || defined(__ARM_ARCH)
+ || defined(_M_AMD64) || defined(__ARM_ARCH)
#ifndef UInt32x32To64
#define UInt32x32To64(a, b) ((unsigned __int64)((ULONG)(a)) * (unsigned __int64)((ULONG)(b)))
diff --git a/src/pal/inc/rt/palrt.h b/src/pal/inc/rt/palrt.h
index c181f38..059d3a6 100644
--- a/src/pal/inc/rt/palrt.h
+++ b/src/pal/inc/rt/palrt.h
@@ -223,19 +223,11 @@ inline void *__cdecl operator new(size_t, void *_P)
// PAL_safe_offsetof is a version of offsetof that protects against an
// overridden operator&
-#if defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 5 || __GNUC__ > 3)
#define FIELD_OFFSET(type, field) __builtin_offsetof(type, field)
#ifndef offsetof
#define offsetof(type, field) __builtin_offsetof(type, field)
#endif
#define PAL_safe_offsetof(type, field) __builtin_offsetof(type, field)
-#else
-#define FIELD_OFFSET(type, field) (((LONG)(LONG_PTR)&(((type *)64)->field)) - 64)
-#ifndef offsetof
-#define offsetof(s,m) ((size_t)((ptrdiff_t)&(((s *)64)->m)) - 64)
-#endif
-#define PAL_safe_offsetof(s,m) ((size_t)((ptrdiff_t)&(char&)(((s *)64)->m))-64)
-#endif
#define CONTAINING_RECORD(address, type, field) \
((type *)((LONG_PTR)(address) - FIELD_OFFSET(type, field)))
@@ -243,7 +235,7 @@ inline void *__cdecl operator new(size_t, void *_P)
#define ARGUMENT_PRESENT(ArgumentPointer) (\
(CHAR *)(ArgumentPointer) != (CHAR *)(NULL) )
-#if defined(_WIN64) || defined(_M_ALPHA)
+#if defined(_WIN64)
#define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
#else
#define MAX_NATURAL_ALIGNMENT sizeof(ULONG)
@@ -893,7 +885,6 @@ Remember to fix the errcode defintion in safecrt.h.
*/
#define _wcslwr_s _wcslwr_unsafe
-#define _snprintf_s _snprintf_unsafe
#define swscanf_s swscanf
#define _wfopen_s _wfopen_unsafe
@@ -903,8 +894,6 @@ Remember to fix the errcode defintion in safecrt.h.
#define _vscprintf _vscprintf_unsafe
-#define vsprintf_s _vsnprintf
-
extern "C++" {
#include <safemath.h>
@@ -959,8 +948,11 @@ inline int __cdecl _vscprintf_unsafe(const char *_Format, va_list _ArgList)
if(buf == nullptr)
return 0;
- int ret = _vsnprintf(buf, guess, _Format, _ArgList);
+ va_list argListCopy;
+ va_copy(argListCopy, _ArgList);
+ int ret = _vsnprintf_s(buf, guess, _TRUNCATE, _Format, argListCopy);
free(buf);
+ va_end(argListCopy);
if ((ret != -1) && (ret < guess))
return ret;
@@ -969,28 +961,6 @@ inline int __cdecl _vscprintf_unsafe(const char *_Format, va_list _ArgList)
}
}
-inline int __cdecl _vsnprintf_unsafe(char *_Dst, size_t _SizeInWords, size_t _Count, const char *_Format, va_list _ArgList)
-{
- if (_Count == _TRUNCATE) _Count = _SizeInWords - 1;
- int ret = _vsnprintf(_Dst, _Count, _Format, _ArgList);
- _Dst[_SizeInWords - 1] = L'\0';
- if (ret < 0 && errno == 0)
- {
- errno = ERANGE;
- }
- return ret;
-}
-
-inline int __cdecl _snprintf_unsafe(char *_Dst, size_t _SizeInWords, size_t _Count, const char *_Format, ...)
-{
- int ret;
- va_list _ArgList;
- va_start(_ArgList, _Format);
- ret = _vsnprintf_unsafe(_Dst, _SizeInWords, _Count, _Format, _ArgList);
- va_end(_ArgList);
- return ret;
-}
-
inline errno_t __cdecl _wfopen_unsafe(PAL_FILE * *ff, const WCHAR *fileName, const WCHAR *mode)
{
PAL_FILE *result = _wfopen(fileName, mode);
@@ -1208,7 +1178,6 @@ typedef VOID (__stdcall *WAITORTIMERCALLBACK)(PVOID, BOOLEAN);
#define _ReturnAddress() __builtin_return_address(0)
-#ifdef PLATFORM_UNIX
#define DIRECTORY_SEPARATOR_CHAR_A '/'
#define DIRECTORY_SEPARATOR_CHAR_W W('/')
#define DIRECTORY_SEPARATOR_STR_A "/"
@@ -1216,15 +1185,6 @@ typedef VOID (__stdcall *WAITORTIMERCALLBACK)(PVOID, BOOLEAN);
#define PATH_SEPARATOR_CHAR_W W(':')
#define PATH_SEPARATOR_STR_W W(":")
#define VOLUME_SEPARATOR_CHAR_W W('/')
-#else // PLATFORM_UNIX
-#define DIRECTORY_SEPARATOR_CHAR_A '\\'
-#define DIRECTORY_SEPARATOR_CHAR_W W('\\')
-#define DIRECTORY_SEPARATOR_STR_A "\\"
-#define DIRECTORY_SEPARATOR_STR_W W("\\")
-#define PATH_SEPARATOR_CHAR_W W(';')
-#define PATH_SEPARATOR_STR_W W(";")
-#define VOLUME_SEPARATOR_CHAR_W W(':')
-#endif // PLATFORM_UNIX
#ifndef IMAGE_IMPORT_DESC_FIELD
#define IMAGE_IMPORT_DESC_FIELD(img, f) ((img).u.f)
@@ -1546,6 +1506,7 @@ typedef struct _DISPATCHER_CONTEXT {
PEXCEPTION_ROUTINE LanguageHandler;
PVOID HandlerData;
PUNWIND_HISTORY_TABLE HistoryTable;
+ BOOLEAN ControlPcIsUnwound;
} DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
#else
diff --git a/src/pal/inc/rt/safecrt.h b/src/pal/inc/rt/safecrt.h
index 3cc10ce..92366df 100644
--- a/src/pal/inc/rt/safecrt.h
+++ b/src/pal/inc/rt/safecrt.h
@@ -135,11 +135,7 @@ typedef _W64 unsigned int uintptr_t;
#define _UINTPTR_T_DEFINED
#endif
-#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ >= 3))
#define SAFECRT_DEPRECATED __declspec(deprecated)
-#else
-#define SAFECRT_DEPRECATED
-#endif
/* errno_t */
#if !defined(_ERRCODE_DEFINED)
@@ -3253,10 +3249,6 @@ int __cdecl vswprintf_s(WCHAR (&_Dst)[_SizeInWords], const WCHAR *_Format, va_li
* return -1 if the formatted string does not entirely fit into _Dst (we will not call _SAFECRT_INVALID_PARAMETER);
* if _Count == 0, then (_Dst == nullptr && _SizeInBytes == 0) is allowed
*/
-_SAFECRT__EXTERN_C
-int __cdecl _snprintf_s(char *_Dst, size_t _SizeInBytes, size_t _Count, const char *_Format, ...);
-_SAFECRT__EXTERN_C
-int __cdecl _vsnprintf_s(char *_Dst, size_t _SizeInBytes, size_t _Count, const char *_Format, va_list _ArgList);
#if defined(__cplusplus) && _SAFECRT_USE_CPP_OVERLOADS
template <size_t _SizeInBytes>
diff --git a/src/pal/inc/rt/sal.h b/src/pal/inc/rt/sal.h
index 0e3eaaa..0746864 100644
--- a/src/pal/inc/rt/sal.h
+++ b/src/pal/inc/rt/sal.h
@@ -2861,7 +2861,7 @@ of each annotation, see the advanced annotations section.
#define __success(expr) _Success_(expr)
#define __nullterminated _Null_terminated_
#define __nullnullterminated
-#define __reserved _SAL1_Source_(__reserved, (), _Reserved_)
+#define __clr_reserved _SAL1_Source_(__reserved, (), _Reserved_)
#define __checkReturn _SAL1_Source_(__checkReturn, (), _Check_return_)
#define __typefix(ctype) _SAL1_Source_(__typefix, (ctype), __inner_typefix(ctype))
#define __override __inner_override
diff --git a/src/pal/inc/rt/specstrings_strict.h b/src/pal/inc/rt/specstrings_strict.h
index 514106e..08d323c 100644
--- a/src/pal/inc/rt/specstrings_strict.h
+++ b/src/pal/inc/rt/specstrings_strict.h
@@ -626,7 +626,7 @@
#define __in_awcount(expr,size) __allowed(on_parameter)
#define __nullterminated _SAL_VERSION_CHECK(__nullterminated)
#define __nullnullterminated _SAL_VERSION_CHECK(__nullnullterminated)
-#define __reserved _SAL_VERSION_CHECK(__reserved)
+#define __clr_reserved _SAL_VERSION_CHECK(__reserved)
#define __checkReturn _SAL_VERSION_CHECK(__checkReturn)
#define __typefix(ctype) __allowed(on_parameter_or_return)
#define __override __allowed(on_function)
diff --git a/src/pal/inc/rt/specstrings_undef.h b/src/pal/inc/rt/specstrings_undef.h
index b462dc2..69fc01c 100644
--- a/src/pal/inc/rt/specstrings_undef.h
+++ b/src/pal/inc/rt/specstrings_undef.h
@@ -445,7 +445,7 @@
#undef __readableTo
#undef __readonly
#undef __refparam
-#undef __reserved
+#undef __clr_reserved
#undef __rpc_entry
#undef __source_code_content
#undef __struct_bcount
diff --git a/src/pal/inc/rt/vsassert.h b/src/pal/inc/rt/vsassert.h
index 1f16cf1..2a7fa5f 100644
--- a/src/pal/inc/rt/vsassert.h
+++ b/src/pal/inc/rt/vsassert.h
@@ -11,10 +11,6 @@
#ifndef __VSASSERT_H__
#define __VSASSERT_H__
-#ifndef FEATURE_PAL
-#error "FEATURE_PAL must be defined for this file"
-#else // FEATURE_PAL
-
#define VSASSERT(e, szMsg) \
do { \
if (!(e)) { \
@@ -94,5 +90,4 @@ do { \
#define VsIgnoreAllocs(f)
-#endif // FEATURE_PAL
#endif // __VSASSERT_H__
diff --git a/src/pal/inc/strsafe.h b/src/pal/inc/strsafe.h
index 58749f2..f32f5e6 100644
--- a/src/pal/inc/strsafe.h
+++ b/src/pal/inc/strsafe.h
@@ -24,14 +24,6 @@
#pragma once
#endif
-#if defined(PLATFORM_UNIX) && !defined (FEATURE_PAL)
-#define _NATIVE_WCHAR_T_DEFINED
-#endif // defined(PLATFORM_UNIX) && !defined (FEATURE_PAL)
-
-#if defined(PLATFORM_UNIX) && !defined (FEATURE_PAL)
-#define _vsnprintf vsnprintf
-#endif // defined(PLATFORM_UNIX) && !defined (FEATURE_PAL)
-
#include <stdio.h> // for _vsnprintf, getc, getwc
#include <string.h> // for memset
#include <stdarg.h> // for va_start, etc.
@@ -51,13 +43,6 @@ typedef char16_t WCHAR;
#define _WCHAR_T_DEFINED
#endif
-#ifndef FEATURE_PAL
-#ifndef _HRESULT_DEFINED
-#define _HRESULT_DEFINED
-typedef LONG HRESULT;
-#endif // !_HRESULT_DEFINED
-#endif // !FEATURE_PAL
-
#ifndef SUCCEEDED
#define SUCCEEDED(hr) ((HRESULT)(hr) >= 0)
#endif
@@ -150,14 +135,6 @@ STRSAFEAPI StringLengthWorkerA(const char* psz, size_t cchMax, size_t* pcch);
STRSAFEAPI StringLengthWorkerW(const WCHAR* psz, size_t cchMax, size_t* pcch);
#endif // STRSAFE_INLINE
-#ifndef STRSAFE_LIB_IMPL
-#ifndef FEATURE_PAL
-// these functions are always inline
-STRSAFE_INLINE_API StringGetsExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags);
-STRSAFE_INLINE_API StringGetsExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags);
-#endif // !FEATURE_PAL
-#endif
-
#ifndef STRSAFE_NO_CCH_FUNCTIONS
/*++
@@ -247,7 +224,6 @@ STRSAFEAPI StringCchCopyA(char* pszDest, size_t cchDest, const char* pszSrc)
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCchCopyW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc)
{
HRESULT hr;
@@ -263,7 +239,6 @@ STRSAFEAPI StringCchCopyW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc)
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // STRSAFE_INLINE
#endif // !STRSAFE_NO_CCH_FUNCTIONS
@@ -361,7 +336,6 @@ STRSAFEAPI StringCbCopyA(char* pszDest, size_t cbDest, const char* pszSrc)
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCbCopyW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc)
{
HRESULT hr;
@@ -381,7 +355,6 @@ STRSAFEAPI StringCbCopyW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc)
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // STRSAFE_INLINE
#endif // !STRSAFE_NO_CB_FUNCTIONS
@@ -506,7 +479,6 @@ STRSAFEAPI StringCchCopyExA(char* pszDest, size_t cchDest, const char* pszSrc, c
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCchCopyExW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
{
HRESULT hr;
@@ -527,7 +499,6 @@ STRSAFEAPI StringCchCopyExW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc,
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // STRSAFE_INLINE
#endif // !STRSAFE_NO_CCH_FUNCTIONS
@@ -660,7 +631,6 @@ STRSAFEAPI StringCbCopyExA(char* pszDest, size_t cbDest, const char* pszSrc, cha
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCbCopyExW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, WCHAR** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags)
{
HRESULT hr;
@@ -689,7 +659,6 @@ STRSAFEAPI StringCbCopyExW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, W
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // STRSAFE_INLINE
#endif // !STRSAFE_NO_CB_FUNCTIONS
@@ -784,7 +753,6 @@ STRSAFEAPI StringCchCopyNA(char* pszDest, size_t cchDest, const char* pszSrc, si
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCchCopyNW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, size_t cchSrc)
{
HRESULT hr;
@@ -801,7 +769,6 @@ STRSAFEAPI StringCchCopyNW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc,
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // STRSAFE_INLINE
#endif // !STRSAFE_NO_CCH_FUNCTIONS
@@ -902,7 +869,6 @@ STRSAFEAPI StringCbCopyNA(char* pszDest, size_t cbDest, const char* pszSrc, size
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCbCopyNW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, size_t cbSrc)
{
HRESULT hr;
@@ -925,7 +891,6 @@ STRSAFEAPI StringCbCopyNW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, si
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // STRSAFE_INLINE
#endif // !STRSAFE_NO_CB_FUNCTIONS
@@ -1060,7 +1025,6 @@ STRSAFEAPI StringCchCopyNExA(char* pszDest, size_t cchDest, const char* pszSrc,
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCchCopyNExW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, size_t cchSrc, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
{
HRESULT hr;
@@ -1082,7 +1046,6 @@ STRSAFEAPI StringCchCopyNExW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // STRSAFE_INLINE
#endif // !STRSAFE_NO_CCH_FUNCTIONS
@@ -1226,7 +1189,6 @@ STRSAFEAPI StringCbCopyNExA(char* pszDest, size_t cbDest, const char* pszSrc, si
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCbCopyNExW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, size_t cbSrc, WCHAR** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags)
{
HRESULT hr;
@@ -1258,7 +1220,6 @@ STRSAFEAPI StringCbCopyNExW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc,
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // STRSAFE_INLINE
#endif // !STRSAFE_NO_CB_FUNCTIONS
@@ -1345,7 +1306,6 @@ STRSAFEAPI StringCchCatA(char* pszDest, size_t cchDest, const char* pszSrc)
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCchCatW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc)
{
HRESULT hr;
@@ -1361,7 +1321,6 @@ STRSAFEAPI StringCchCatW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc)
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // STRSAFE_INLINE
#endif // !STRSAFE_NO_CCH_FUNCTIONS
@@ -1451,7 +1410,6 @@ STRSAFEAPI StringCbCatA(char* pszDest, size_t cbDest, const char* pszSrc)
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCbCatW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc)
{
HRESULT hr;
@@ -1470,7 +1428,6 @@ STRSAFEAPI StringCbCatW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc)
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // STRSAFE_INLINE
#endif // !STRSAFE_NO_CB_FUNCTIONS
@@ -1598,7 +1555,6 @@ STRSAFEAPI StringCchCatExA(char* pszDest, size_t cchDest, const char* pszSrc, ch
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCchCatExW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
{
HRESULT hr;
@@ -1619,7 +1575,6 @@ STRSAFEAPI StringCchCatExW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc,
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // STRSAFE_INLINE
#endif // !STRSAFE_NO_CCH_FUNCTIONS
@@ -1755,7 +1710,6 @@ STRSAFEAPI StringCbCatExA(char* pszDest, size_t cbDest, const char* pszSrc, char
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCbCatExW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, WCHAR** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags)
{
HRESULT hr;
@@ -1784,7 +1738,6 @@ STRSAFEAPI StringCbCatExW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, WC
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // STRSAFE_INLINE
#endif // !STRSAFE_NO_CB_FUNCTIONS
@@ -1877,7 +1830,6 @@ STRSAFEAPI StringCchCatNA(char* pszDest, size_t cchDest, const char* pszSrc, siz
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCchCatNW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, size_t cchMaxAppend)
{
HRESULT hr;
@@ -1893,7 +1845,6 @@ STRSAFEAPI StringCchCatNW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, s
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // STRSAFE_INLINE
#endif // !STRSAFE_NO_CCH_FUNCTIONS
@@ -1993,7 +1944,6 @@ STRSAFEAPI StringCbCatNA(char* pszDest, size_t cbDest, const char* pszSrc, size_
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCbCatNW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, size_t cbMaxAppend)
{
HRESULT hr;
@@ -2016,7 +1966,6 @@ STRSAFEAPI StringCbCatNW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, siz
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // STRSAFE_INLINE
#endif // !STRSAFE_NO_CB_FUNCTIONS
@@ -2147,7 +2096,6 @@ STRSAFEAPI StringCchCatNExA(char* pszDest, size_t cchDest, const char* pszSrc, s
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCchCatNExW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, size_t cchMaxAppend, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
{
HRESULT hr;
@@ -2168,7 +2116,6 @@ STRSAFEAPI StringCchCatNExW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc,
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // STRSAFE_INLINE
#endif // !STRSAFE_NO_CCH_FUNCTIONS
@@ -2311,7 +2258,6 @@ STRSAFEAPI StringCbCatNExA(char* pszDest, size_t cbDest, const char* pszSrc, siz
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCbCatNExW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, size_t cbMaxAppend, WCHAR** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags)
{
HRESULT hr;
@@ -2344,7 +2290,6 @@ STRSAFEAPI StringCbCatNExW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, s
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // STRSAFE_INLINE
#endif // !STRSAFE_NO_CB_FUNCTIONS
@@ -2403,62 +2348,7 @@ Return Value:
--*/
-#ifndef FEATURE_PAL
-#ifndef STRSAFE_LIB_IMPL
-STRSAFE_INLINE_API StringCchGetsA(char* pszDest, size_t cchDest);
-STRSAFE_INLINE_API StringCchGetsW(WCHAR* pszDest, size_t cchDest);
-#ifdef UNICODE
-#define StringCchGets StringCchGetsW
-#else
-#define StringCchGets StringCchGetsA
-#endif // !UNICODE
-
-STRSAFE_INLINE_API StringCchGetsA(char* pszDest, size_t cchDest)
-{
- HRESULT hr;
-
- if (cchDest > STRSAFE_MAX_CCH)
- {
- hr = STRSAFE_E_INVALID_PARAMETER;
- }
- else
- {
- size_t cbDest;
-
- // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1
- cbDest = cchDest * sizeof(char);
-
- hr = StringGetsExWorkerA(pszDest, cchDest, cbDest, NULL, NULL, 0);
- }
-
- return hr;
-}
-
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFE_INLINE_API StringCchGetsW(WCHAR* pszDest, size_t cchDest)
-{
- HRESULT hr;
-
- if (cchDest > STRSAFE_MAX_CCH)
- {
- hr = STRSAFE_E_INVALID_PARAMETER;
- }
- else
- {
- size_t cbDest;
-
- // safe to multiply cchDest * sizeof(WCHAR) since cchDest < STRSAFE_MAX_CCH and sizeof(WCHAR) is 2
- cbDest = cchDest * sizeof(WCHAR);
-
- hr = StringGetsExWorkerW(pszDest, cchDest, cbDest, NULL, NULL, 0);
- }
-
- return hr;
-}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // !STRSAFE_NO_CCH_FUNCTIONS
-#endif // !STRSAFE_LIB_IMPL
-#endif // !FEATURE_PAL
#ifndef STRSAFE_NO_CB_FUNCTIONS
/*++
@@ -2514,60 +2404,7 @@ Return Value:
--*/
-#ifndef FEATURE_PAL
-#ifndef STRSAFE_LIB_IMPL
-STRSAFE_INLINE_API StringCbGetsA(char* pszDest, size_t cbDest);
-STRSAFE_INLINE_API StringCbGetsW(WCHAR* pszDest, size_t cbDest);
-#ifdef UNICODE
-#define StringCbGets StringCbGetsW
-#else
-#define StringCbGets StringCbGetsA
-#endif // !UNICODE
-
-STRSAFE_INLINE_API StringCbGetsA(char* pszDest, size_t cbDest)
-{
- HRESULT hr;
- size_t cchDest;
-
- // convert to count of characters
- cchDest = cbDest / sizeof(char);
-
- if (cchDest > STRSAFE_MAX_CCH)
- {
- hr = STRSAFE_E_INVALID_PARAMETER;
- }
- else
- {
- hr = StringGetsExWorkerA(pszDest, cchDest, cbDest, NULL, NULL, 0);
- }
-
- return hr;
-}
-
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFE_INLINE_API StringCbGetsW(WCHAR* pszDest, size_t cbDest)
-{
- HRESULT hr;
- size_t cchDest;
-
- // convert to count of characters
- cchDest = cbDest / sizeof(WCHAR);
-
- if (cchDest > STRSAFE_MAX_CCH)
- {
- hr = STRSAFE_E_INVALID_PARAMETER;
- }
- else
- {
- hr = StringGetsExWorkerW(pszDest, cchDest, cbDest, NULL, NULL, 0);
- }
-
- return hr;
-}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // !STRSAFE_NO_CB_FUNCTIONS
-#endif // !STRSAFE_LIB_IMPL
-#endif // !FEATURE_PAL
#ifndef STRSAFE_NO_CCH_FUNCTIONS
/*++
@@ -2650,62 +2487,7 @@ Return Value:
--*/
-#ifndef FEATURE_PAL
-#ifndef STRSAFE_LIB_IMPL
-STRSAFE_INLINE_API StringCchGetsExA(char* pszDest, size_t cchDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags);
-STRSAFE_INLINE_API StringCchGetsExW(WCHAR* pszDest, size_t cchDest, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags);
-#ifdef UNICODE
-#define StringCchGetsEx StringCchGetsExW
-#else
-#define StringCchGetsEx StringCchGetsExA
-#endif // !UNICODE
-
-STRSAFE_INLINE_API StringCchGetsExA(char* pszDest, size_t cchDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
-{
- HRESULT hr;
-
- if (cchDest > STRSAFE_MAX_CCH)
- {
- hr = STRSAFE_E_INVALID_PARAMETER;
- }
- else
- {
- size_t cbDest;
-
- // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1
- cbDest = cchDest * sizeof(char);
-
- hr = StringGetsExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags);
- }
-
- return hr;
-}
-
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFE_INLINE_API StringCchGetsExW(WCHAR* pszDest, size_t cchDest, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
-{
- HRESULT hr;
-
- if (cchDest > STRSAFE_MAX_CCH)
- {
- hr = STRSAFE_E_INVALID_PARAMETER;
- }
- else
- {
- size_t cbDest;
-
- // safe to multiply cchDest * sizeof(WCHAR) since cchDest < STRSAFE_MAX_CCH and sizeof(WCHAR) is 2
- cbDest = cchDest * sizeof(WCHAR);
-
- hr = StringGetsExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags);
- }
-
- return hr;
-}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // !STRSAFE_NO_CCH_FUNCTIONS
-#endif // !STRSAFE_LIB_IMPL
-#endif // !FEATURE_PAL
#ifndef STRSAFE_NO_CB_FUNCTIONS
/*++
@@ -2788,82 +2570,7 @@ Return Value:
--*/
-#ifndef FEATURE_PAL
-#ifndef STRSAFE_LIB_IMPL
-STRSAFE_INLINE_API StringCbGetsExA(char* pszDest, size_t cbDest, char** ppszDestEnd, size_t* pbRemaining, unsigned long dwFlags);
-STRSAFE_INLINE_API StringCbGetsExW(WCHAR* pszDest, size_t cbDest, WCHAR** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags);
-#ifdef UNICODE
-#define StringCbGetsEx StringCbGetsExW
-#else
-#define StringCbGetsEx StringCbGetsExA
-#endif // !UNICODE
-
-STRSAFE_INLINE_API StringCbGetsExA(char* pszDest, size_t cbDest, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags)
-{
- HRESULT hr;
- size_t cchDest;
- size_t cchRemaining = 0;
-
- cchDest = cbDest / sizeof(char);
-
- if (cchDest > STRSAFE_MAX_CCH)
- {
- hr = STRSAFE_E_INVALID_PARAMETER;
- }
- else
- {
- hr = StringGetsExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags);
- }
-
- if (SUCCEEDED(hr) ||
- (hr == STRSAFE_E_INSUFFICIENT_BUFFER) ||
- (hr == STRSAFE_E_END_OF_FILE))
- {
- if (pcbRemaining)
- {
- // safe to multiply cchRemaining * sizeof(char) since cchRemaining < STRSAFE_MAX_CCH and sizeof(char) is 1
- *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char));
- }
- }
-
- return hr;
-}
-
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFE_INLINE_API StringCbGetsExW(WCHAR* pszDest, size_t cbDest, WCHAR** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags)
-{
- HRESULT hr;
- size_t cchDest;
- size_t cchRemaining = 0;
-
- cchDest = cbDest / sizeof(WCHAR);
-
- if (cchDest > STRSAFE_MAX_CCH)
- {
- hr = STRSAFE_E_INVALID_PARAMETER;
- }
- else
- {
- hr = StringGetsExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags);
- }
-
- if (SUCCEEDED(hr) ||
- (hr == STRSAFE_E_INSUFFICIENT_BUFFER) ||
- (hr == STRSAFE_E_END_OF_FILE))
- {
- if (pcbRemaining)
- {
- // safe to multiply cchRemaining * sizeof(WCHAR) since cchRemaining < STRSAFE_MAX_CCH and sizeof(WCHAR) is 2
- *pcbRemaining = (cchRemaining * sizeof(WCHAR)) + (cbDest % sizeof(WCHAR));
- }
- }
-
- return hr;
-}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // !STRSAFE_NO_CB_FUNCTIONS
-#endif // !STRSAFE_LIB_IMPL
-#endif // !FEATURE_PAL
#ifndef STRSAFE_NO_CCH_FUNCTIONS
/*++
@@ -2937,7 +2644,6 @@ STRSAFEAPI StringCchLengthA(const char* psz, size_t cchMax, size_t* pcch)
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCchLengthW(const WCHAR* psz, size_t cchMax, size_t* pcch)
{
HRESULT hr;
@@ -2953,7 +2659,6 @@ STRSAFEAPI StringCchLengthW(const WCHAR* psz, size_t cchMax, size_t* pcch)
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // STRSAFE_INLINE
#endif // !STRSAFE_NO_CCH_FUNCTIONS
@@ -3040,7 +2745,6 @@ STRSAFEAPI StringCbLengthA(const char* psz, size_t cbMax, size_t* pcb)
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCbLengthW(const WCHAR* psz, size_t cbMax, size_t* pcb)
{
HRESULT hr;
@@ -3066,7 +2770,6 @@ STRSAFEAPI StringCbLengthW(const WCHAR* psz, size_t cbMax, size_t* pcb)
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // STRSAFE_INLINE
#endif // !STRSAFE_NO_CB_FUNCTIONS
@@ -3103,7 +2806,6 @@ STRSAFEAPI StringCopyWorkerA(char* pszDest, size_t cchDest, const char* pszSrc)
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCopyWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc)
{
HRESULT hr = S_OK;
@@ -3133,7 +2835,6 @@ STRSAFEAPI StringCopyWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
STRSAFEAPI StringCopyExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
{
@@ -3273,7 +2974,6 @@ STRSAFEAPI StringCopyExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, con
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCopyExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, const WCHAR* pszSrc, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
{
HRESULT hr = S_OK;
@@ -3411,7 +3111,6 @@ STRSAFEAPI StringCopyExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, co
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
STRSAFEAPI StringCopyNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchSrc)
{
@@ -3444,7 +3143,6 @@ STRSAFEAPI StringCopyNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc,
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCopyNWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, size_t cchSrc)
{
HRESULT hr = S_OK;
@@ -3475,7 +3173,6 @@ STRSAFEAPI StringCopyNWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSr
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
STRSAFEAPI StringCopyNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, size_t cchSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
{
@@ -3616,7 +3313,6 @@ STRSAFEAPI StringCopyNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, co
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCopyNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, const WCHAR* pszSrc, size_t cchSrc, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
{
HRESULT hr = S_OK;
@@ -3755,7 +3451,6 @@ STRSAFEAPI StringCopyNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, c
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
STRSAFEAPI StringCatWorkerA(char* pszDest, size_t cchDest, const char* pszSrc)
{
@@ -3774,7 +3469,6 @@ STRSAFEAPI StringCatWorkerA(char* pszDest, size_t cchDest, const char* pszSrc)
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCatWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc)
{
HRESULT hr;
@@ -3791,7 +3485,6 @@ STRSAFEAPI StringCatWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc)
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
STRSAFEAPI StringCatExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
{
@@ -3940,7 +3633,6 @@ STRSAFEAPI StringCatExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, cons
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCatExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, const WCHAR* pszSrc, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
{
HRESULT hr = S_OK;
@@ -4086,7 +3778,6 @@ STRSAFEAPI StringCatExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, con
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
STRSAFEAPI StringCatNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchMaxAppend)
{
@@ -4106,7 +3797,6 @@ STRSAFEAPI StringCatNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc,
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCatNWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, size_t cchMaxAppend)
{
HRESULT hr;
@@ -4124,7 +3814,6 @@ STRSAFEAPI StringCatNWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
STRSAFEAPI StringCatNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, size_t cchMaxAppend, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
{
@@ -4272,7 +3961,6 @@ STRSAFEAPI StringCatNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, con
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringCatNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, const WCHAR* pszSrc, size_t cchMaxAppend, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
{
HRESULT hr = S_OK;
@@ -4419,7 +4107,6 @@ STRSAFEAPI StringCatNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, co
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
STRSAFEAPI StringLengthWorkerA(const char* psz, size_t cchMax, size_t* pcch)
{
@@ -4446,7 +4133,6 @@ STRSAFEAPI StringLengthWorkerA(const char* psz, size_t cchMax, size_t* pcch)
return hr;
}
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
STRSAFEAPI StringLengthWorkerW(const WCHAR* psz, size_t cchMax, size_t* pcch)
{
HRESULT hr = S_OK;
@@ -4471,285 +4157,6 @@ STRSAFEAPI StringLengthWorkerW(const WCHAR* psz, size_t cchMax, size_t* pcch)
return hr;
}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
#endif // STRSAFE_INLINE
-#ifndef STRSAFE_LIB_IMPL
-#ifndef FEATURE_PAL
-STRSAFE_INLINE_API StringGetsExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
-{
- HRESULT hr = S_OK;
- char* pszDestEnd = pszDest;
- size_t cchRemaining = 0;
-
- // ASSERT(cbDest == (cchDest * sizeof(char)) ||
- // cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char)));
-
- // only accept valid flags
- if (dwFlags & (~STRSAFE_VALID_FLAGS))
- {
- hr = STRSAFE_E_INVALID_PARAMETER;
- }
- else
- {
- if (dwFlags & STRSAFE_IGNORE_NULLS)
- {
- if (pszDest == NULL)
- {
- if ((cchDest != 0) || (cbDest != 0))
- {
- // NULL pszDest and non-zero cchDest/cbDest is invalid
- hr = STRSAFE_E_INVALID_PARAMETER;
- }
- }
- }
-
- if (SUCCEEDED(hr))
- {
- if (cchDest <= 1)
- {
- pszDestEnd = pszDest;
- cchRemaining = cchDest;
-
- if (cchDest == 1)
- {
- *pszDestEnd = '\0';
- }
-
- hr = STRSAFE_E_INSUFFICIENT_BUFFER;
- }
- else
- {
- char ch;
-
- pszDestEnd = pszDest;
- cchRemaining = cchDest;
-
- while ((cchRemaining > 1) && (ch = (char)getc(stdin)) != '\n')
- {
- if (ch == EOF)
- {
- if (pszDestEnd == pszDest)
- {
- // we failed to read anything from stdin
- hr = STRSAFE_E_END_OF_FILE;
- }
- break;
- }
-
- *pszDestEnd = ch;
-
- pszDestEnd++;
- cchRemaining--;
- }
-
- if (cchRemaining > 0)
- {
- // there is extra room
- if (dwFlags & STRSAFE_FILL_BEHIND_NULL)
- {
- memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(char)) + (cbDest % sizeof(char)));
- }
- }
-
- *pszDestEnd = '\0';
- }
- }
- }
-
- if (FAILED(hr))
- {
- if (pszDest)
- {
- if (dwFlags & STRSAFE_FILL_ON_FAILURE)
- {
- memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
-
- if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0)
- {
- pszDestEnd = pszDest;
- cchRemaining = cchDest;
- }
- else if (cchDest > 0)
- {
- pszDestEnd = pszDest + cchDest - 1;
- cchRemaining = 1;
-
- // null terminate the end of the string
- *pszDestEnd = '\0';
- }
- }
-
- if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION))
- {
- if (cchDest > 0)
- {
- pszDestEnd = pszDest;
- cchRemaining = cchDest;
-
- // null terminate the beginning of the string
- *pszDestEnd = '\0';
- }
- }
- }
- }
-
- if (SUCCEEDED(hr) ||
- (hr == STRSAFE_E_INSUFFICIENT_BUFFER) ||
- (hr == STRSAFE_E_END_OF_FILE))
- {
- if (ppszDestEnd)
- {
- *ppszDestEnd = pszDestEnd;
- }
-
- if (pcchRemaining)
- {
- *pcchRemaining = cchRemaining;
- }
- }
-
- return hr;
-}
-
-#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX)
-STRSAFE_INLINE_API StringGetsExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags)
-{
- HRESULT hr = S_OK;
- WCHAR* pszDestEnd = pszDest;
- size_t cchRemaining = 0;
-
- // ASSERT(cbDest == (cchDest * sizeof(char)) ||
- // cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char)));
-
- // only accept valid flags
- if (dwFlags & (~STRSAFE_VALID_FLAGS))
- {
- hr = STRSAFE_E_INVALID_PARAMETER;
- }
- else
- {
- if (dwFlags & STRSAFE_IGNORE_NULLS)
- {
- if (pszDest == NULL)
- {
- if ((cchDest != 0) || (cbDest != 0))
- {
- // NULL pszDest and non-zero cchDest/cbDest is invalid
- hr = STRSAFE_E_INVALID_PARAMETER;
- }
- }
- }
-
- if (SUCCEEDED(hr))
- {
- if (cchDest <= 1)
- {
- pszDestEnd = pszDest;
- cchRemaining = cchDest;
-
- if (cchDest == 1)
- {
- *pszDestEnd = L'\0';
- }
-
- hr = STRSAFE_E_INSUFFICIENT_BUFFER;
- }
- else
- {
- WCHAR ch;
-
- pszDestEnd = pszDest;
- cchRemaining = cchDest;
-
- while ((cchRemaining > 1) && (ch = (WCHAR)getwc(stdin)) != L'\n')
- {
- if (ch == EOF)
- {
- if (pszDestEnd == pszDest)
- {
- // we failed to read anything from stdin
- hr = STRSAFE_E_END_OF_FILE;
- }
- break;
- }
-
- *pszDestEnd = ch;
-
- pszDestEnd++;
- cchRemaining--;
- }
-
- if (cchRemaining > 0)
- {
- // there is extra room
- if (dwFlags & STRSAFE_FILL_BEHIND_NULL)
- {
- memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(WCHAR)) + (cbDest % sizeof(WCHAR)));
- }
- }
-
- *pszDestEnd = L'\0';
- }
- }
- }
-
- if (FAILED(hr))
- {
- if (pszDest)
- {
- if (dwFlags & STRSAFE_FILL_ON_FAILURE)
- {
- memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest);
-
- if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0)
- {
- pszDestEnd = pszDest;
- cchRemaining = cchDest;
- }
- else if (cchDest > 0)
- {
- pszDestEnd = pszDest + cchDest - 1;
- cchRemaining = 1;
-
- // null terminate the end of the string
- *pszDestEnd = L'\0';
- }
- }
-
- if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION))
- {
- if (cchDest > 0)
- {
- pszDestEnd = pszDest;
- cchRemaining = cchDest;
-
- // null terminate the beginning of the string
- *pszDestEnd = L'\0';
- }
- }
- }
- }
-
- if (SUCCEEDED(hr) ||
- (hr == STRSAFE_E_INSUFFICIENT_BUFFER) ||
- (hr == STRSAFE_E_END_OF_FILE))
- {
- if (ppszDestEnd)
- {
- *ppszDestEnd = pszDestEnd;
- }
-
- if (pcchRemaining)
- {
- *pcchRemaining = cchRemaining;
- }
- }
-
- return hr;
-}
-#endif // FEATURE_PAL || !PLATFORM_UNIX
-#endif // !FEATURE_PAL
-#endif // !STRSAFE_LIB_IMPL
-
#endif // _STRSAFE_H_INCLUDED_
diff --git a/src/pal/inc/unixasmmacrosarm64.inc b/src/pal/inc/unixasmmacrosarm64.inc
index 6014205..359f27f 100644
--- a/src/pal/inc/unixasmmacrosarm64.inc
+++ b/src/pal/inc/unixasmmacrosarm64.inc
@@ -37,7 +37,8 @@ C_FUNC(\Name\()_End):
.endm
.macro PREPARE_EXTERNAL_VAR Name, HelperReg
- ldr \HelperReg, [pc, #C_FUNC(\Name)@GOTPCREL]
+ adrp \HelperReg, \Name
+ add \HelperReg, \HelperReg, :lo12:\Name
.endm
.macro PROLOG_STACK_ALLOC Size