//
// Need a class to serve as a tag that we can use to overload New/Delete.
-#define forDbi (*(forDbiWorker *)NULL)
+forDbiWorker forDbi;
void * operator new(size_t lenBytes, const forDbiWorker &)
{
RSDebuggingInfo g_RSDebuggingInfo_OutOfProc = {0 }; // set to NULL
RSDebuggingInfo * g_pRSDebuggingInfo = &g_RSDebuggingInfo_OutOfProc;
+// The following instances are used for invoking overloaded new/delete
+forDbiWorker forDbi;
#ifdef _DEBUG
// For logs, we can print the string name for the debug codes.
USHORT m_usPort;
};
-#define forDbi (*(forDbiWorker *)NULL)
+extern forDbiWorker forDbi;
// for dbi we just default to new, but we need to have these defined for both dac and dbi
inline void * operator new(size_t lenBytes, const forDbiWorker &)
bool g_EnableSIS = false;
+// The following instances are used for invoking overloaded new/delete
+InteropSafe interopsafe;
+InteropSafeExecutable interopsafeEXEC;
#ifndef DACCESS_COMPILE
* ------------------------------------------------------------------------ */
class InteropSafe {};
-#define interopsafe (*(InteropSafe*)NULL)
+extern InteropSafe interopsafe;
class InteropSafeExecutable {};
-#define interopsafeEXEC (*(InteropSafeExecutable*)NULL)
+extern InteropSafeExecutable interopsafeEXEC;
#ifndef DACCESS_COMPILE
inline void * __cdecl operator new(size_t n, const InteropSafe&)
{
// Help mitigate the impact of buffer overflow
// Fail fast with a null-reference AV
- return *(static_cast<T*>(0)) ;
+ volatile char* nullPointer = nullptr;
+ *nullPointer;
}
return m_array[ i ];
}
template<class T> void DeleteDbiMemory(T *p);
// Need a class to serve as a tag that we can use to overload New/Delete.
class forDbiWorker {};
-#define forDbi (*(forDbiWorker *)NULL)
+extern forDbiWorker forDbi;
extern void * operator new(size_t lenBytes, const forDbiWorker &);
extern void * operator new[](size_t lenBytes, const forDbiWorker &);
extern void operator delete(void *p, const forDbiWorker &);
{
// The exception happened in the page right below the stack limit,
// so it is a stack overflow
- write(STDERR_FILENO, StackOverflowMessage, sizeof(StackOverflowMessage) - 1);
+ (void)write(STDERR_FILENO, StackOverflowMessage, sizeof(StackOverflowMessage) - 1);
PROCAbort();
}
}
return GetFullPathNameW(fileName, nBufferLength, lpBuffer, NULL);
#else
char nativeFullPath[MAX_PATH];
- realpath(HackyConvertToSTR(fileName), nativeFullPath);
+ (void)realpath(HackyConvertToSTR(fileName), nativeFullPath);
LPWSTR fullPathForCLR = HackyConvertToWSTR(nativeFullPath);
wcscpy_s(lpBuffer, MAX_PATH, fullPathForCLR);
return wcslen(lpBuffer);
typedef void* ULONG_PTR;
typedef unsigned error_t;
typedef void* LPVOID;
-typedef char BYTE;
+typedef unsigned char BYTE;
typedef WCHAR OLECHAR;
#endif
typedef void* ULONG_PTR;
typedef unsigned error_t;
typedef void* LPVOID;
-typedef char BYTE;
+typedef unsigned char BYTE;
typedef WCHAR OLECHAR;
typedef unsigned int UINT_PTR;
#define FALSE 0
#endif
-#endif //_INTEROP_TYPES__H
\ No newline at end of file
+#endif //_INTEROP_TYPES__H