add_definitions(-D_WINKD_=1)
endif()
- if(CMAKE_VERSION MATCHES "ReactOS")
+ if(CMAKE_VERSION MATCHES "ReactOS" AND MSVC_VERSION LESS 1900)
set(PCH 1 CACHE BOOL "Whether to use precompiled headers")
else()
set(PCH 0 CACHE BOOL "Whether to use precompiled headers")
add_compile_flags("/FS")
endif ()
+# VS14+ tries to use thread-safe initialization
+if(MSVC_VERSION GREATER 1899)
+ add_compile_flags("/Zc:threadSafeInit-")
+endif ()
+
# Disable overly sensitive warnings as well as those that generally aren't
# useful to us.
# - C4244: implicit integer truncation
cl 2>&1 | find "16.00." > NUL && set VS_VERSION=10\r
cl 2>&1 | find "17.00." > NUL && set VS_VERSION=11\r
cl 2>&1 | find "18.00." > NUL && set VS_VERSION=12\r
+ cl 2>&1 | find "19.00." > NUL && set VS_VERSION=14\r
if not defined VS_VERSION (\r
echo Error: Visual Studio version too old or version detection failed.\r
exit /b\r
{
LocalFree(p);
}
+
+void operator delete(void *p, unsigned int)
+{
+ LocalFree(p);
+}
/* INCLUDES ******************************************************************/
+#define WIN32_NO_STATUS
+
#include <stdio.h>
-#define WIN32_NO_STATUS
/* PSDK/NDK Headers */
#include <windef.h>
}
}
+#if _MSC_VER >= 51900
+void __cdecl operator delete(void* ptr, unsigned int)
+{
+ // In Windows 2k3, they check for ptr being null.
+ // ISO, POSIX and even MSDN explains that it is allowed
+ // to call free with NULL pointer...
+ if (ptr)
+ {
+ free(ptr);
+ }
+}
+#endif
+
// Implement our own new operator so that we can throw our own exception in case
// of allocation failure.
// It could have been done using set_new_handler(), but well. MS guys didn't do it
#ifndef __NDISSYS_H
#define __NDISSYS_H
+/* portability fixes */
+#ifdef _M_AMD64
+#define KfReleaseSpinLock KeReleaseSpinLock
+#define KefAcquireSpinLockAtDpcLevel KeAcquireSpinLockAtDpcLevel
+#define KefReleaseSpinLockFromDpcLevel KeReleaseSpinLockFromDpcLevel
+#endif
+
#include <ndis.h>
#include "debug.h"
ExGetCurrentProcessorCpuUsage(
PULONG CpuUsage);
-/* portability fixes */
-#ifdef _M_AMD64
-#define KfReleaseSpinLock KeReleaseSpinLock
-#define KefAcquireSpinLockAtDpcLevel KeAcquireSpinLockAtDpcLevel
-#define KefReleaseSpinLockFromDpcLevel KeReleaseSpinLockFromDpcLevel
-#endif
-
#endif /* __NDISSYS_H */
ExFreePool(ptr);
}
+inline void __cdecl
+operator delete(
+ PVOID ptr, UINT unk)
+{
+ ExFreePool(ptr);
+}
+
#endif /* ALLOCATION_OPERATORS_DEFINED */
if (pVoid) ExFreePool(pVoid);
}
+inline void __cdecl operator delete(
+ PVOID pVoid, UINT unk)
+{
+ if (pVoid) ExFreePool(pVoid);
+}
+
#endif /* _NEW_DELETE_OPERATORS_ */
#if defined(_SYS_GUID_OPERATOR_EQ_)
}
}
+#if defined (EH_DELETE_HAS_THROW_SPEC)
+void _STLP_CALL operator delete(void* s, unsigned int) throw()
+#else
+void _STLP_CALL operator delete(void* s, unsigned int)
+#endif
+{
+ ::operator delete(s);
+}
/*===================================================================================
ClearAllocationSet (private helper)
; void __stdcall `eh vector constructor iterator'(void *,unsigned int,int,void (__thiscall*)(void *),void (__thiscall*)(void *))
DEFINE_ALIAS ??_L@YGXPAXIHP6EX0@Z1@Z, ?MSVCRTEX_eh_vector_constructor_iterator@@YGXPAXIHP6EX0@Z1@Z
+; void __stdcall `eh vector constructor iterator'(void *,unsigned int,int,void (__thiscall*)(void *),void (__thiscall*)(void *))
+DEFINE_ALIAS ??_L@YGXPAXIIP6EX0@Z1@Z, ?MSVCRTEX_eh_vector_constructor_iterator@@YGXPAXIHP6EX0@Z1@Z
+
; void __stdcall `eh vector destructor iterator'(void *,unsigned int,int,void (__thiscall*)(void *))
DEFINE_ALIAS ??_M@YGXPAXIHP6EX0@Z@Z, ?MSVCRTEX_eh_vector_destructor_iterator@@YGXPAXIHP6EX0@Z@Z
+; void __stdcall `eh vector destructor iterator'(void *,unsigned int,unsigned int,void (__thiscall*)(void *))
+DEFINE_ALIAS ??_M@YGXPAXIIP6EX0@Z@Z, ?MSVCRTEX_eh_vector_destructor_iterator@@YGXPAXIHP6EX0@Z@Z
+
+; void __cdecl operator delete(void *,unsigned int)
+DEFINE_ALIAS ??3@YAXPAXI@Z, ??3@YAXPAX@Z
+DEFINE_ALIAS ??3@YAXPAXII@Z, ??3@YAXPAX@Z
+
END
if(MSVC)
- add_definitions(-Dsnprintf=_snprintf)
+ if(MSVC_VERSION LESS 1900)
+ add_definitions(-Dsnprintf=_snprintf)
- # Add this definition for WDK only, VS 9 doesn't like that
- if(DEFINED ENV{DDKBUILDENV})
- add_definitions(-Dvsnprintf=_vsnprintf)
+ # Add this definition for WDK only, VS 9 doesn't like that
+ if(DEFINED ENV{DDKBUILDENV})
+ add_definitions(-Dvsnprintf=_vsnprintf)
+ endif()
endif()
list(APPEND SOURCE getopt.c)
if(MSVC)
- add_definitions(
- -Dsnprintf=_snprintf
- -Dstrtoull=_strtoui64
- -Dstrtoll=_strtoi64)
+ if(MSVC_VERSION LESS 1900)
+ add_definitions(
+ -Dsnprintf=_snprintf
+ -Dstrtoull=_strtoui64
+ -Dstrtoll=_strtoi64)
- # Add this definition for WDK only, VS 9 doesn't like that
- if(DEFINED ENV{DDKBUILDENV})
- add_definitions(-Dvsnprintf=_vsnprintf)
+ # Add this definition for WDK only, VS 9 doesn't like that
+ if(DEFINED ENV{DDKBUILDENV})
+ add_definitions(-Dvsnprintf=_vsnprintf)
+ endif()
endif()
endif()