[PATCH] msvcrt: Don't include MSVC 8.0+ heap functions in SOs for older DLLs

Alex Henrie alexhenrie24 at gmail.com
Thu Dec 28 11:46:53 CST 2017


Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/msvcrt/heap.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcrt/heap.c b/dlls/msvcrt/heap.c
index ed41253304..7ea80a3a50 100644
--- a/dlls/msvcrt/heap.c
+++ b/dlls/msvcrt/heap.c
@@ -373,8 +373,9 @@ MSVCRT_size_t CDECL _msize(void* mem)
   return size;
 }
 
+#if _MSVCR_VER>=80
 /*********************************************************************
- * _aligned_msize (MSVCR100.@)
+ * _aligned_msize (MSVCR80.@)
  */
 size_t CDECL _aligned_msize(void *p, MSVCRT_size_t alignment, MSVCRT_size_t offset)
 {
@@ -388,6 +389,7 @@ size_t CDECL _aligned_msize(void *p, MSVCRT_size_t alignment, MSVCRT_size_t offs
     alloc_ptr = SAVED_PTR(p);
     return _msize(*alloc_ptr)-alignment-sizeof(void*);
 }
+#endif
 
 /*********************************************************************
  *		calloc (MSVCRT.@)
@@ -405,6 +407,7 @@ void* CDECL MSVCRT_calloc(MSVCRT_size_t count, MSVCRT_size_t size)
   return msvcrt_heap_alloc(HEAP_ZERO_MEMORY, bytes);
 }
 
+#if _MSVCR_VER>=140
 /*********************************************************************
  *		_calloc_base (UCRTBASE.@)
  */
@@ -412,6 +415,7 @@ void* CDECL _calloc_base(MSVCRT_size_t count, MSVCRT_size_t size)
 {
   return MSVCRT_calloc(count, size);
 }
+#endif
 
 /*********************************************************************
  *		free (MSVCRT.@)
@@ -421,6 +425,7 @@ void CDECL MSVCRT_free(void* ptr)
   msvcrt_heap_free(ptr);
 }
 
+#if _MSVCR_VER>=140
 /*********************************************************************
  *		_free_base (UCRTBASE.@)
  */
@@ -428,6 +433,7 @@ void CDECL _free_base(void* ptr)
 {
   msvcrt_heap_free(ptr);
 }
+#endif
 
 /*********************************************************************
  *                  malloc (MSVCRT.@)
@@ -440,6 +446,7 @@ void* CDECL MSVCRT_malloc(MSVCRT_size_t size)
   return ret;
 }
 
+#if _MSVCR_VER>=140
 /*********************************************************************
  *                  _malloc_base (UCRTBASE.@)
  */
@@ -447,6 +454,7 @@ void* CDECL _malloc_base(MSVCRT_size_t size)
 {
   return MSVCRT_malloc(size);
 }
+#endif
 
 /*********************************************************************
  *		realloc (MSVCRT.@)
@@ -459,6 +467,7 @@ void* CDECL MSVCRT_realloc(void* ptr, MSVCRT_size_t size)
   return NULL;
 }
 
+#if _MSVCR_VER>=140
 /*********************************************************************
  *		_realloc_base (UCRTBASE.@)
  */
@@ -466,9 +475,11 @@ void* CDECL _realloc_base(void* ptr, MSVCRT_size_t size)
 {
   return MSVCRT_realloc(ptr, size);
 }
+#endif
 
+#if _MSVCR_VER>=80
 /*********************************************************************
- * _recalloc (MSVCR100.@)
+ * _recalloc (MSVCR80.@)
  */
 void* CDECL _recalloc(void *mem, MSVCRT_size_t num, MSVCRT_size_t size)
 {
@@ -491,6 +502,7 @@ void* CDECL _recalloc(void *mem, MSVCRT_size_t num, MSVCRT_size_t size)
         memset((BYTE*)ret+old_size, 0, size-old_size);
     return ret;
 }
+#endif
 
 /*********************************************************************
  *		__p__amblksiz (MSVCRT.@)
@@ -739,6 +751,7 @@ int CDECL MSVCRT_memmove_s(void *dest, MSVCRT_size_t numberOfElements, const voi
     return 0;
 }
 
+#if _MSVCR_VER>=100
 /*********************************************************************
  *              wmemmove_s (MSVCR100.@)
  */
@@ -761,6 +774,7 @@ int CDECL wmemmove_s(MSVCRT_wchar_t *dest, MSVCRT_size_t numberOfElements,
     memmove(dest, src, sizeof(MSVCRT_wchar_t)*count);
     return 0;
 }
+#endif
 
 /*********************************************************************
  *		memcpy_s (MSVCRT.@)
@@ -788,6 +802,7 @@ int CDECL MSVCRT_memcpy_s(void *dest, MSVCRT_size_t numberOfElements, const void
     return 0;
 }
 
+#if _MSVCR_VER>=100
 /*********************************************************************
  *              wmemcpy_s (MSVCR100.@)
  */
@@ -813,6 +828,7 @@ int CDECL wmemcpy_s(MSVCRT_wchar_t *dest, MSVCRT_size_t numberOfElements,
     memcpy(dest, src, sizeof(MSVCRT_wchar_t)*count);
     return 0;
 }
+#endif
 
 /*********************************************************************
  *		strncpy_s (MSVCRT.@)
-- 
2.15.1




More information about the wine-devel mailing list