Unify xplatform.h and platformdefines.h (#21389)
authorJeremy Koritzinsky <jkoritzinsky@gmail.com>
Fri, 18 Jan 2019 00:58:34 +0000 (16:58 -0800)
committerGitHub <noreply@github.com>
Fri, 18 Jan 2019 00:58:34 +0000 (16:58 -0800)
* Move most of xplatform.h into platformdefines.h and clean up the interop CMake files.

* Fix build-break off Windows.

* Fix typo.

* Fix another break off-Windows.

* Fix signed/unsigned mismatch

94 files changed:
tests/src/Common/Platform/platformdefines.cpp
tests/src/Common/Platform/platformdefines.h
tests/src/Interop/ArrayMarshalling/BoolArray/CMakeLists.txt
tests/src/Interop/ArrayMarshalling/BoolArray/MarshalBoolArrayNative.cpp
tests/src/Interop/ArrayMarshalling/ByValArray/CMakeLists.txt
tests/src/Interop/ArrayMarshalling/SafeArray/CMakeLists.txt
tests/src/Interop/ArrayMarshalling/SafeArray/SafeArrayNative.cpp
tests/src/Interop/BestFitMapping/BestFitMappingNative.cpp
tests/src/Interop/BestFitMapping/CMakeLists.txt
tests/src/Interop/COM/NativeClients/Primitives/NumericTests.cpp
tests/src/Interop/COM/NativeClients/Primitives/StringTests.cpp
tests/src/Interop/DllImportAttribute/ExeFile/CMakeLists.txt
tests/src/Interop/DllImportAttribute/FileNameContainDot/CMakeLists.txt
tests/src/Interop/DllImportAttribute/FileNameContainDot/DllFile.Probe.cpp
tests/src/Interop/DllImportAttribute/Simple/CMakeLists.txt
tests/src/Interop/DllImportAttribute/Simple/DllFileProbe.cpp
tests/src/Interop/ExecInDefAppDom/CMakeLists.txt
tests/src/Interop/ExecInDefAppDom/ExecInDefAppDomDll.cpp
tests/src/Interop/FuncPtrAsDelegateParam/CMakeLists.txt
tests/src/Interop/Interop.cmake
tests/src/Interop/MarshalAPI/FunctionPointer/CMakeLists.txt
tests/src/Interop/MarshalAPI/FunctionPointer/FunctionPointerNative.cpp
tests/src/Interop/MarshalAPI/IUnknown/CMakeLists.txt
tests/src/Interop/NativeCallable/CMakeLists.txt
tests/src/Interop/NativeCallable/NativeCallableDll.cpp
tests/src/Interop/NativeLibrary/CMakeLists.txt
tests/src/Interop/NativeLibrary/NativeLibrary.cpp
tests/src/Interop/PInvoke/Array/MarshalArrayAsField/LPArrayNative/CMakeLists.txt
tests/src/Interop/PInvoke/Array/MarshalArrayAsParam/LPArrayNative/CMakeLists.txt
tests/src/Interop/PInvoke/ArrayWithOffset/CMakeLists.txt
tests/src/Interop/PInvoke/AsAny/CMakeLists.txt
tests/src/Interop/PInvoke/Attributes/LCID/CMakeLists.txt
tests/src/Interop/PInvoke/BestFitMapping/Char/BestFitMappingNative.cpp
tests/src/Interop/PInvoke/BestFitMapping/Char/CMakeLists.txt
tests/src/Interop/PInvoke/BestFitMapping/LPStr/CMakeLists.txt
tests/src/Interop/PInvoke/CriticalHandles/CMakeLists.txt
tests/src/Interop/PInvoke/DateTime/CMakeLists.txt
tests/src/Interop/PInvoke/Decimal/PInvoke/CMakeLists.txt
tests/src/Interop/PInvoke/Decimal/ReversePInvoke/CMakeLists.txt
tests/src/Interop/PInvoke/Delegate/MarshalDelegateAsField/CMakeLists.txt
tests/src/Interop/PInvoke/Delegate/MarshalDelegateAsParam/CMakeLists.txt
tests/src/Interop/PInvoke/DllImportPath/CMakeLists.txt
tests/src/Interop/PInvoke/DllImportPath/DllImportPathNative.cpp
tests/src/Interop/PInvoke/ExactSpelling/CMakeLists.txt
tests/src/Interop/PInvoke/ExactSpelling/ExactSpellingNative.cpp
tests/src/Interop/PInvoke/Miscellaneous/HandleRef/CMakeLists.txt
tests/src/Interop/PInvoke/Miscellaneous/HandleRef/HandleRefNative.cpp
tests/src/Interop/PInvoke/Miscellaneous/MultipleAssembliesWithSamePInvoke/CMakeLists.txt
tests/src/Interop/PInvoke/Miscellaneous/MultipleAssembliesWithSamePInvoke/MAWSPINative.cpp
tests/src/Interop/PInvoke/NativeCallManagedComVisible/CMakeLists.txt
tests/src/Interop/PInvoke/NativeCallManagedComVisible/ComVisibleNative.cpp
tests/src/Interop/PInvoke/Primitives/Int/CMakeLists.txt
tests/src/Interop/PInvoke/Primitives/Int/PInvokeIntNative.cpp
tests/src/Interop/PInvoke/Primitives/RuntimeHandles/CMakeLists.txt
tests/src/Interop/PInvoke/Primitives/RuntimeHandles/RuntimeHandlesNative.cpp
tests/src/Interop/PInvoke/SafeHandles/CMakeLists.txt
tests/src/Interop/PInvoke/SafeHandles/Interface/CMakeLists.txt
tests/src/Interop/PInvoke/SafeHandles/Interface/InterfaceNative.cpp
tests/src/Interop/PInvoke/SafeHandles/ReleaseHandle/CMakeLists.txt
tests/src/Interop/PInvoke/SafeHandles/ReleaseHandle/ReleaseHandleNative.cpp
tests/src/Interop/PInvoke/SafeHandles/SafeHandleNative.cpp
tests/src/Interop/PInvoke/SizeParamIndex/PInvoke/PassingByOut/CMakeLists.txt
tests/src/Interop/PInvoke/SizeParamIndex/PInvoke/PassingByRef/CMakeLists.txt
tests/src/Interop/PInvoke/SizeParamIndex/ReversePInvoke/PassingByOut/CMakeLists.txt
tests/src/Interop/PInvoke/SizeParamIndex/ReversePInvoke/PassingByRef/CMakeLists.txt
tests/src/Interop/PInvoke/Varargs/CMakeLists.txt
tests/src/Interop/PInvoke/Variant/CMakeLists.txt
tests/src/Interop/PrimitiveMarshalling/Bool/BoolNative.cpp
tests/src/Interop/PrimitiveMarshalling/Bool/CMakeLists.txt
tests/src/Interop/PrimitiveMarshalling/EnumMarshalling/CMakeLists.txt
tests/src/Interop/PrimitiveMarshalling/EnumMarshalling/MarshalEnumNative.cpp
tests/src/Interop/PrimitiveMarshalling/UIntPtr/CMakeLists.txt
tests/src/Interop/RefCharArray/CMakeLists.txt
tests/src/Interop/RefCharArray/RefCharArrayNative.cpp
tests/src/Interop/RefInt/CMakeLists.txt
tests/src/Interop/SimpleStruct/CMakeLists.txt
tests/src/Interop/SizeConst/CMakeLists.txt
tests/src/Interop/SizeConst/SizeConstNative.cpp
tests/src/Interop/StringMarshalling/AnsiBSTR/AnsiBStrTestNative.cpp
tests/src/Interop/StringMarshalling/AnsiBSTR/CMakeLists.txt
tests/src/Interop/StringMarshalling/BSTR/BSTRTestNative.cpp
tests/src/Interop/StringMarshalling/BSTR/CMakeLists.txt
tests/src/Interop/StringMarshalling/LPSTR/CMakeLists.txt
tests/src/Interop/StringMarshalling/LPSTR/LPSTRTestNative.cpp
tests/src/Interop/StringMarshalling/LPTSTR/CMakeLists.txt
tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTestNative.cpp
tests/src/Interop/StringMarshalling/UTF8/CMakeLists.txt
tests/src/Interop/StringMarshalling/UTF8/UTF8TestNative.cpp
tests/src/Interop/StringMarshalling/VBByRefStr/CMakeLists.txt
tests/src/Interop/StructMarshalling/PInvoke/CMakeLists.txt
tests/src/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/CMakeLists.txt
tests/src/Interop/StructMarshalling/ReversePInvoke/MarshalSeqStruct/CMakeLists.txt
tests/src/Interop/common/types.h [deleted file]
tests/src/Interop/common/xplatform.h

index 7e21ab0..0380117 100644 (file)
@@ -159,19 +159,19 @@ error_t TP_getenv_s(size_t* pReturnValue, LPWSTR buffer, size_t sizeInWords, LPC
     return 0;
 }
 
-error_t TP_putenv_s(LPTSTR name, LPTSTR value)
+error_t TP_putenv_s(LPWSTR name, LPWSTR value)
 {
     if (NULL == name || NULL == value) return 1;
 
 #ifdef WINDOWS
-    if( 0 != _putenv_s(name, value))
+    if( 0 != _wputenv_s(name, value))
         return 2;
     else
         return 0;
 #else
     int retVal = 0;
-    char *assignment = (char*) malloc(sizeof(char) * (strlen(name) + strlen(value) + 1));
-    sprintf(assignment, "%s=%s", name, value);
+    char *assignment = (char*) malloc(sizeof(char) * (wcslen(name) + wcslen(value) + 1));
+    sprintf(assignment, "%s=%s", HackyConvertToSTR(name), HackyConvertToSTR(value));
 
     if (0 != putenv(assignment))
         retVal = 2;
@@ -445,18 +445,18 @@ BSTR TP_SysAllocString(LPCWSTR psz)
 #else
     if(psz == NULL)
         return NULL;
-    return TP_SysAllocStringLen(psz, (DWORD)wcslen(psz));
+    return CoreClrBStrAlloc(psz, (DWORD)wcslen(psz));
 #endif
 }
 
-BSTR TP_SysAllocStringLen(LPCWSTR psz, size_t len)
+BSTR CoreClrBStrAlloc(LPCWSTR psz, size_t len)
 {
     ULONG cbTotal = 0;
 
     if (FAILED(CbSysStringSize((ULONG)len, FALSE, &cbTotal)))
         return NULL;
 
-    BSTR bstr = (BSTR)TP_CoTaskMemAlloc(cbTotal);
+    BSTR bstr = (BSTR)CoreClrAlloc(cbTotal);
 
     if(bstr != NULL){
 
@@ -480,7 +480,7 @@ BSTR TP_SysAllocStringLen(LPCWSTR psz, size_t len)
     return bstr; 
 }
 
-BSTR TP_SysAllocStringByteLen(LPCSTR psz, size_t len)
+BSTR CoreClrBStrAlloc(LPCSTR psz, size_t len)
 {
 #ifdef WINDOWS    
     return SysAllocStringByteLen(psz, (UINT)len);
@@ -491,7 +491,7 @@ BSTR TP_SysAllocStringByteLen(LPCSTR psz, size_t len)
     if (FAILED(CbSysStringSize(len, TRUE, &cbTotal)))
         return NULL;
 
-    bstr = (BSTR)TP_CoTaskMemAlloc(cbTotal);
+    bstr = (BSTR)CoreClrAlloc(cbTotal);
 
     if (bstr != NULL) {
 #if defined(_WIN64)
@@ -515,14 +515,14 @@ BSTR TP_SysAllocStringByteLen(LPCSTR psz, size_t len)
 #endif    
 }
 
-void TP_SysFreeString(BSTR bstr)
+void CoreClrBStrFree(BSTR bstr)
 {
 #ifdef WINDOWS    
     return SysFreeString(bstr);
 #else
     if (bstr == NULL)
       return;
-    TP_CoTaskMemFree((BYTE *)bstr - sizeof(DWORD_PTR));  
+    CoreClrFree((BYTE *)bstr - sizeof(DWORD_PTR));  
 #endif    
 }
 
@@ -553,3 +553,63 @@ DWORD TP_SysStringLen(BSTR bstr)
     return (unsigned int)((((DWORD *)bstr)[-1]) / sizeof(OLECHAR));
 #endif
 }
+
+size_t TP_strncpy_s(char* strDest, size_t numberOfElements, const char *strSource, size_t count)
+{
+    // NOTE: Need to pass count + 1 since strncpy_s does not count null,
+    // while snprintf does. 
+    return snprintf(strDest, count + 1, "%s", strSource);
+}
+
+size_t TP_strcpy_s(char *dest, size_t n, char const *src)
+{
+    return snprintf(dest, n, "%s", src);
+}
+
+int TP_wcsncpy_s(LPWSTR strDestination, size_t size1, LPCWSTR strSource, size_t size2)
+{
+    // copy sizeInBytes bytes of strSource into strDestination
+    if (NULL == strDestination || NULL == strSource) return 1;
+
+    size_t cnt = 0;
+    while (cnt < size1 && '\0' != strSource[cnt])
+    {
+        strDestination[cnt] = strSource[cnt];
+        cnt++;
+    }
+
+    strDestination[cnt] = '\0';
+    return 0;
+}
+
+int TP_wcsncpy_s(LPWSTR strDestination, size_t size1, LPCWSTR strSource)
+{
+    return wcsncpy_s(strDestination, size1, strSource, 0);
+}
+
+int TP_wcsncmp(LPCWSTR str1, LPCWSTR str2,size_t len)
+{
+    // < 0 str1 less than str2
+    // 0  str1 identical to str2
+    // > 0 str1 greater than str2
+    if (NULL == str1 && NULL != str2) return -1;
+    if (NULL != str1 && NULL == str2) return 1;
+    if (NULL == str1 && NULL == str2) return 0;
+
+    while (*str1 == *str2 && '\0' != *str1 && '\0' != *str2 && len--!= 0)
+    {
+        str1++;
+        str2++;
+    }
+
+    if ('\0' == *str1 && '\0' == *str2) return 0;
+    if ('\0' != *str1) return -1;
+    if ('\0' != *str2) return 1;
+
+    return (*str1 > *str2) ? 1 : -1;
+}
+
+int TP_wmemcmp(LPCWSTR str1, LPCWSTR str2,size_t len)
+{
+    return wcsncmp(str1, str2, len);
+}
index 0a33bc1..0471ecd 100644 (file)
@@ -4,6 +4,7 @@
 
 
 #include <stdio.h>
+#include <memory.h>
 #include <stdlib.h>
 #include <string.h>
 #include <cstdint>
 #ifndef _PLATFORMDEFINES__H
 #define _PLATFORMDEFINES__H
 
+#ifdef _MSC_VER
+// Our tests don't care about secure CRT
+#define _CRT_SECURE_NO_WARNINGS 1
+#endif
+
+
+// Ensure that both UNICODE and _UNICODE are set.
+#ifndef _UNICODE
+#define _UNICODE
+#endif
+#ifndef UNICODE
+#define UNICODE
+#endif
+
+#include <wchar.h>
+
 //
 // types and constants
 //
 #ifdef WINDOWS
+
+#define NOMINMAX
+
 #include <windows.h>
+#include <combaseapi.h>
 
 #define FS_SEPERATOR L"\\"
 #define PATH_DELIMITER L";"
@@ -73,6 +94,10 @@ typedef unsigned int ULONG, *PULONG;
 #define WINAPI  __stdcall
 #endif
 
+#ifndef STDMETHODCALLTYPE
+#define STDMETHODCALLTYPE
+#endif
+
 #ifndef _MSC_VER
 #if __i386__
 #define __stdcall __attribute__((stdcall))
@@ -102,17 +127,14 @@ LPWSTR HackyConvertToWSTR(const char* pszInput);
 typedef pthread_t THREAD_ID;
 typedef void* (*MacWorker)(void*);
 typedef DWORD __stdcall (*LPTHREAD_START_ROUTINE)(void*);
-#ifdef UNICODE
 typedef WCHAR TCHAR;
-#else // ANSI
-typedef char TCHAR;
-#endif // UNICODE
 typedef char* LPSTR;
 typedef const char* LPCSTR;
 typedef TCHAR* LPTSTR;
 typedef const TCHAR* LPCTSTR;
 typedef void* FARPROC;
-typedef void* HMODULE;
+typedef void* HANDLE;
+typedef HANDLE HMODULE;
 typedef void* ULONG_PTR;
 typedef int error_t;
 typedef void* LPVOID;
@@ -142,14 +164,60 @@ void TP_JoinThread(THREAD_ID tThread);
 void TP_DebugBreak();
 DWORD TP_GetFullPathName(LPWSTR fileName, DWORD nBufferLength, LPWSTR lpBuffer);
 
+
+size_t TP_strncpy_s(char* strDest, size_t numberOfElements, const char *strSource, size_t count);
+size_t TP_strcpy_s(char *dest, size_t n, char const *src);
+int    TP_wcsncpy_s(LPWSTR strDestination, size_t size1, LPCWSTR strSource, size_t size2);
+int    TP_wcsncpy_s(LPWSTR strDestination, size_t size1, LPCWSTR strSource);
+int    TP_wcsncmp(LPCWSTR str1, LPCWSTR str2,size_t len);
+int    TP_wmemcmp(LPCWSTR str1, LPCWSTR str2,size_t len);
+
 typedef WCHAR* BSTR;
-BSTR TP_SysAllocStringByteLen(LPCSTR psz, size_t len);
-void TP_SysFreeString(BSTR bstr);
+
+BSTR CoreClrBStrAlloc(LPCSTR psz, size_t len);
+BSTR CoreClrBStrAlloc(LPCWSTR psz, size_t len);
+
+inline void *CoreClrBStrAlloc(size_t cb)
+{
+    // A null is automatically applied in the SysAllocStringByteLen API.
+    // Remove a single OLECHAR for the implied null.
+    // https://docs.microsoft.com/en-us/previous-versions/windows/desktop/api/oleauto/nf-oleauto-sysallocstringbytelen
+    if (cb >= sizeof(OLECHAR))
+        cb -= sizeof(OLECHAR);
+
+    return CoreClrBStrAlloc((LPCSTR)nullptr, cb);
+}
+
+void CoreClrBStrFree(BSTR bstr);
+
+inline void CoreClrBStrFree(void* p)
+{
+    CoreClrBStrFree((BSTR)p);
+}
+
 size_t TP_SysStringByteLen(BSTR bstr);
-BSTR TP_SysAllocStringLen(LPCWSTR psz, size_t len);
 BSTR TP_SysAllocString(LPCWSTR psz);
 DWORD TP_SysStringLen(BSTR bstr);
 
+
+inline void *CoreClrAlloc(size_t cb)
+{
+#ifdef WINDOWS
+    return ::CoTaskMemAlloc(cb);
+#else
+    return ::malloc(cb);
+#endif
+}
+
+inline void CoreClrFree(void *p)
+{
+#ifdef WINDOWS
+    return ::CoTaskMemFree(p);
+#else
+    return ::free(p);
+#endif
+}
+
 //
 // Method redirects
 //
@@ -158,8 +226,6 @@ DWORD TP_SysStringLen(BSTR bstr);
 #define TP_LoadLibraryW(l) LoadLibraryW(l)
 #define TP_LoadLibraryA(l) LoadLibraryA(l)
 #define TP_GetProcAddress(m,e) GetProcAddress(m,e)
-#define TP_CoTaskMemAlloc(t) CoTaskMemAlloc(t)
-#define TP_CoTaskMemFree(t) CoTaskMemFree(t)
 #define TP_DebugBreak() DebugBreak()
 #define TP_rand rand
 #define TP_srand srand
@@ -176,8 +242,6 @@ DWORD TP_SysStringLen(BSTR bstr);
 #define TP_LoadLibraryW(l) dlopen(l, 0)
 #define TP_LoadLibraryA(l) dlopen(l, 0)
 #define TP_GetProcAddress(m,e) dlsym(m,e)
-#define TP_CoTaskMemAlloc(t) malloc(t)
-#define TP_CoTaskMemFree(t) free(t)
 #define TP_rand arc4random
 #define TP_srand srandom
 #define wcscpy_s TP_scpy_s
@@ -185,13 +249,19 @@ DWORD TP_SysStringLen(BSTR bstr);
 #define GetFullPathNameW(fname,buflen,buf,filepart)  TP_GetFullPathName(fname,buflen,buf)
 #define wcslen TP_slen
 #define _wgetenv_s TP_getenv_s
-#define _putenv_s TP_putenv_s
+#define _wputenv_s TP_putenv_s
 #define ZeroMemory TP_ZeroMemory
 #define _itow_s TP_itow_s
 #define _itoa_s TP_itoa_s
 #define wcsstr TP_sstr
 #define strcmp TP_scmp_s
 #define wcscmp TP_wcmp_s
+#define strncpy_s TP_strncpy_s
+#define strcpy_s TP_strcpy_s
+#define wcsncpy_s TP_wcsncpy_s
+#define wcsncpy_s TP_wcsncpy_s
+#define wcsncmp TP_wcsncmp
+#define wmemcmp TP_wmemcmp
 #endif
 
 #endif
index 88dffee..021ad35 100644 (file)
@@ -1,6 +1,6 @@
 cmake_minimum_required (VERSION 2.6)
 project (MarshalBoolArrayNative)
-include_directories(${INC_PLATFORM_DIR})
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 set(SOURCES MarshalBoolArrayNative.cpp)
 
 # add the executable
index 043339c..5f8d5d4 100644 (file)
@@ -1,6 +1,6 @@
 cmake_minimum_required (VERSION 2.6)
 project (MarshalArrayByValNative)
-include_directories(${INC_PLATFORM_DIR})
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 set(SOURCES MarshalArrayByValNative.cpp)
 
 # add the executable
index e5ff0f6..bb80d2e 100644 (file)
@@ -1,6 +1,6 @@
 cmake_minimum_required (VERSION 2.6)
 project (SafeArrayNative)
-include_directories(${INC_PLATFORM_DIR})
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 set(SOURCES SafeArrayNative.cpp RecordNative.cpp)
 
 # add the executable
index 76f4b54..4554353 100644 (file)
@@ -5,7 +5,6 @@
 #include <xplatform.h>
 #include <oleauto.h>
 #include <algorithm>
-#include <platformdefines.h>
 
 #define RETURN_IF_FAILED(x) if(FAILED(hr = (x))) { return hr; }
 
@@ -139,7 +138,7 @@ HRESULT Reverse(StringType str, StringType *res)
 HRESULT ReverseBSTR(BSTR str, BSTR *res)
 {
     size_t strDataLen = TP_SysStringByteLen(str);
-    BSTR resLocal = TP_SysAllocStringByteLen(reinterpret_cast<LPCSTR>(str), strDataLen);
+    BSTR resLocal = CoreClrBStrAlloc(reinterpret_cast<LPCSTR>(str), strDataLen);
     if (resLocal == nullptr)
         return E_INVALIDARG;
 
index 35b4f0b..bd92382 100755 (executable)
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include <locale.h>
 #include <xplatform.h>
+#include <platformdefines.h>
 
 #pragma warning( push )
 #pragma warning( disable : 4996)
@@ -473,4 +474,4 @@ extern "C" DLL_EXPORT void __cdecl DoSCallBack_LPSTR_InOutByRef(SCallBackInOutBy
     }
     CoreClrFree(pStr);
 }
-#pragma warning( pop )
\ No newline at end of file
+#pragma warning( pop )
index 8971ec3..f2fe36f 100755 (executable)
@@ -1,18 +1,11 @@
 cmake_minimum_required (VERSION 2.6)
 project (BestFitMappingNative)
 set(SOURCES BestFitMappingNative.cpp )
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 
 # add the executable
 add_library (BestFitMappingNative SHARED ${SOURCES})
 target_link_libraries(BestFitMappingNative ${LINK_LIBRARIES_ADDITIONAL}) 
 
-#get_cmake_property(_variableNames VARIABLES)
-#foreach (_variableName ${_variableNames})
-#    message(STATUS "${_variableName}=${${_variableName}}")
-#endforeach()
-
-#SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
-
 # add the install targets
-install (TARGETS BestFitMappingNative DESTINATION bin)
\ No newline at end of file
+install (TARGETS BestFitMappingNative DESTINATION bin)
index 4afebb3..a9af956 100644 (file)
@@ -3,6 +3,7 @@
 // See the LICENSE file in the project root for more information.
 
 #include "ClientTests.h"
+#include <platformdefines.h>
 #include <cstdint>
 #include <limits>
 
index 32b5187..96a713f 100644 (file)
@@ -3,6 +3,7 @@
 // See the LICENSE file in the project root for more information.
 
 #include "ClientTests.h"
+#include <platformdefines.h>
 #include <vector>
 #include <sstream>
 
@@ -188,7 +189,7 @@ namespace
     };
 
     // BSTR string
-    using BStr = AnyStr<OLECHAR, &CoreClrBstrAlloc, &CoreClrBstrFree>;
+    using BStr = AnyStr<OLECHAR, &CoreClrBStrAlloc, &CoreClrBStrFree>;
 
     // Wide string
     using WStr = AnyStr<WCHAR, &CoreClrAlloc, &CoreClrFree>;
index 388b7bc..4ee6e21 100644 (file)
@@ -1,10 +1,11 @@
 cmake_minimum_required (VERSION 2.6)
 project (ExeFile)
 set(SOURCES ExeFile.cpp )
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 
 # add the executable
 add_executable (ExeFile ${SOURCES})
 target_link_libraries(ExeFile ${LINK_LIBRARIES_ADDITIONAL}) 
 
 # add the install targets
-install (TARGETS ExeFile DESTINATION bin)
\ No newline at end of file
+install (TARGETS ExeFile DESTINATION bin)
index 90de03e..24a960c 100644 (file)
@@ -1,10 +1,11 @@
 cmake_minimum_required (VERSION 2.6)
 project (DllFile.Probe)
 set(SOURCES DllFile.Probe.cpp )
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 
 # add the executable
 add_library (DllFile.Probe SHARED ${SOURCES})
 target_link_libraries(DllFile.Probe ${LINK_LIBRARIES_ADDITIONAL}) 
 
 # add the install targets
-install (TARGETS DllFile.Probe DESTINATION bin)
\ No newline at end of file
+install (TARGETS DllFile.Probe DESTINATION bin)
index 4dcbe60..e090949 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <locale.h>
-#include <xplatform.h>
+#include <platformdefines.h>
 
 #pragma warning( push )
 #pragma warning( disable : 4996)
@@ -13,4 +13,4 @@
 extern "C" DLL_EXPORT int __cdecl Sum(int a, int b)
 {
     return a + b;
-}
\ No newline at end of file
+}
index 71c8d39..21ac451 100644 (file)
@@ -1,10 +1,11 @@
 cmake_minimum_required (VERSION 2.6)
 project (DllFileProbe)
 set(SOURCES DllFileProbe.cpp )
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 
 # add the executable
 add_library (DllFileProbe SHARED ${SOURCES})
 target_link_libraries(DllFileProbe ${LINK_LIBRARIES_ADDITIONAL}) 
 
 # add the install targets
-install (TARGETS DllFileProbe DESTINATION bin)
\ No newline at end of file
+install (TARGETS DllFileProbe DESTINATION bin)
index 4dcbe60..e090949 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <locale.h>
-#include <xplatform.h>
+#include <platformdefines.h>
 
 #pragma warning( push )
 #pragma warning( disable : 4996)
@@ -13,4 +13,4 @@
 extern "C" DLL_EXPORT int __cdecl Sum(int a, int b)
 {
     return a + b;
-}
\ No newline at end of file
+}
index e1c903c..85cc2d8 100644 (file)
@@ -1,5 +1,6 @@
 cmake_minimum_required (VERSION 2.6)
 project (ExecInDefAppDomDll)
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 set(SOURCES ExecInDefAppDomDll.cpp )
 
 # add the executable
index 676087b..da76dda 100644 (file)
@@ -3,6 +3,7 @@
 // See the LICENSE file in the project root for more information.
 
 #include <xplatform.h>
+#include <platformdefines.h>
 
 #ifdef WINDOWS
 #include "mscoree.h"
@@ -78,4 +79,4 @@ CallExecuteInDefaultAppDomain(LPCWSTR pwzAssemblyPath,
     return E_FAIL;
 }
 
-#endif // WINDOWS
\ No newline at end of file
+#endif // WINDOWS
index 3393155..25a6b83 100644 (file)
@@ -1,6 +1,6 @@
 cmake_minimum_required (VERSION 2.6)
 project (FuncPtrAsDelegateParamNative)
-include_directories(${INC_PLATFORM_DIR})
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 set(SOURCES FuncPtrAsDelegateParamNative.cpp )
 
 # add the executable
@@ -8,4 +8,4 @@ add_library (FuncPtrAsDelegateParamNative SHARED ${SOURCES})
 target_link_libraries(FuncPtrAsDelegateParamNative ${LINK_LIBRARIES_ADDITIONAL}) 
 
 # add the install targets
-install (TARGETS FuncPtrAsDelegateParamNative DESTINATION bin)
\ No newline at end of file
+install (TARGETS FuncPtrAsDelegateParamNative DESTINATION bin)
index 64d3983..f66aece 100644 (file)
@@ -1 +1,3 @@
-# Settings for all Interop native assets
\ No newline at end of file
+# Settings for all Interop native assets
+
+include_directories(${INC_PLATFORM_DIR})
index 00d7fff..fbcb51e 100644 (file)
@@ -1,6 +1,6 @@
 cmake_minimum_required (VERSION 2.6)
 project (FunctionPointerNative)
-include_directories(${INC_PLATFORM_DIR})
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 set(SOURCES FunctionPointerNative.cpp)
 
 # add the executable
index 96b8148..4463158 100644 (file)
@@ -3,6 +3,7 @@
 // See the LICENSE file in the project root for more information.
 #include <stdio.h>
 #include <xplatform.h>
+#include <platformdefines.h>
 
 extern "C" DLL_EXPORT bool __cdecl CheckFcnPtr(bool(STDMETHODCALLTYPE *fcnptr)(__int64))
 {
index 218462f..6dfecd1 100644 (file)
@@ -1,6 +1,6 @@
 cmake_minimum_required (VERSION 2.6)
 project (IUnknownNative)
-include_directories(${INC_PLATFORM_DIR})
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 set(SOURCES IUnknownNative.cpp)
 
 # add the executable
index e8ab51f..5a178d2 100644 (file)
@@ -1,5 +1,6 @@
 cmake_minimum_required (VERSION 2.6)
 project (NativeCallableDll)
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 set(SOURCES NativeCallableDll.cpp )
 
 # add the executable
index a90109b..277d8cc 100644 (file)
@@ -2,7 +2,7 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-#include <xplatform.h> 
+#include <platformdefines.h> 
 
 typedef int (STDMETHODCALLTYPE *CALLBACKPROC)(int n);
 
index f7d98ba..b08f7b3 100644 (file)
@@ -1,6 +1,6 @@
 cmake_minimum_required (VERSION 2.6)
 project (NativeLibrary)
-include_directories(${INC_PLATFORM_DIR})
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 set(SOURCES NativeLibrary.cpp)
 
 # add the executable
index 7c1090f..4865389 100644 (file)
@@ -2,7 +2,7 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 #include <stdio.h>
-#include <xplatform.h>
+#include <platformdefines.h>
 
 extern "C" DLL_EXPORT int NativeSum(int a, int b)
 {
index f940a21..b332bcb 100644 (file)
@@ -1,9 +1,9 @@
-#VCXPROJ 
 cmake_minimum_required (VERSION 2.6) 
 project (MarshalArrayByValArrayNative) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 include_directories("../..")
-include_directories(${INC_PLATFORM_DIR})
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 set(SOURCES 
     MarshalArrayByValArrayNative.cpp 
 ) 
index 6f27e1c..4147261 100644 (file)
@@ -1,9 +1,8 @@
-#VCXPROJ 
 cmake_minimum_required (VERSION 2.6) 
 project (MarshalArrayLPArrayNative) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake")
 include_directories("../..")
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES 
     MarshalArrayLPArrayNative.cpp 
 ) 
index 5af6a50..937c3c1 100644 (file)
@@ -1,7 +1,6 @@
 cmake_minimum_required (VERSION 2.6) 
 project (ArrayWithOffsetNative) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES 
     ArrayWithOffsetNative.cpp 
 ) 
index 1c03bf3..81820ed 100644 (file)
@@ -1,7 +1,6 @@
 cmake_minimum_required (VERSION 2.6) 
 project (AsAnyNative) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES 
     AsAnyNative.cpp 
 ) 
index 18a4d9e..0aa0791 100644 (file)
@@ -1,7 +1,6 @@
 cmake_minimum_required (VERSION 2.6) 
 project (LCIDNative) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES 
     LCIDNative.cpp 
 ) 
index d8a0a2f..e691b2e 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <xplatform.h>
+#include <platformdefines.h>
 
 
 extern "C" bool DLL_EXPORT STDMETHODCALLTYPE Char_In(char c)
index 430abbe..37c6b13 100644 (file)
@@ -1,8 +1,7 @@
-#VCXPROJ 
 cmake_minimum_required (VERSION 2.6) 
 project (Char_BestFitMappingNative) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES 
     BestFitMappingNative.cpp 
 ) 
index a1940ee..971de04 100644 (file)
@@ -1,8 +1,7 @@
-#VCXPROJ 
 cmake_minimum_required (VERSION 2.6) 
 project (LPStr_BestFitMappingNative) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES 
     BestFitMappingNative.cpp 
 ) 
index 2dfa7e4..f704c03 100644 (file)
@@ -1,8 +1,7 @@
-#VCXPROJ 
 cmake_minimum_required (VERSION 2.6) 
 project (CriticalHandlesNative) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES 
     CriticalHandlesNative.cpp 
 ) 
index ada49fb..dadc5b1 100644 (file)
@@ -1,7 +1,6 @@
 cmake_minimum_required (VERSION 2.6) 
 project (NativeDateTime) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES 
     NativeDateTime.cpp 
 ) 
index edb87ee..59c293a 100644 (file)
@@ -1,8 +1,7 @@
-#VCXPROJ 
 cmake_minimum_required (VERSION 2.6) 
 project (DecNative) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES 
     DecNative.cpp 
 ) 
index a644cb4..266f473 100644 (file)
@@ -1,8 +1,7 @@
-#VCXPROJ 
 cmake_minimum_required (VERSION 2.6) 
 project (RevNative) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES 
     RevNative.cpp 
 ) 
index c0a6fc5..0b89e00 100644 (file)
@@ -1,8 +1,7 @@
-#VCXPROJ 
 cmake_minimum_required (VERSION 2.6) 
 project (PInvoke_Delegate_AsField) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES 
     AsFieldNative.cpp 
 ) 
index 1be5cfa..379f490 100644 (file)
@@ -1,8 +1,7 @@
-#VCXPROJ 
 cmake_minimum_required (VERSION 2.6) 
 project (PInvoke_Delegate_AsParam) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES 
     AsParamNative.cpp 
 ) 
index 34634b5..31b257b 100644 (file)
@@ -1,7 +1,6 @@
 cmake_minimum_required (VERSION 2.6) 
 project (DllImportPath) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES 
     DllImportPathNative.cpp 
 ) 
index e3ad7cd..113a082 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <stdio.h>
 #include <xplatform.h>
+#include <platformdefines.h>
 
 LPCWSTR strManaged = W("Managed\0String\0");
 LPCWSTR strNative = W(" Native\0String\0");
index 27850f4..9564809 100644 (file)
@@ -1,6 +1,6 @@
 cmake_minimum_required (VERSION 2.6)
 project (ExactSpellingNative)
-include_directories(${INC_PLATFORM_DIR})
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake")  
 set(SOURCES ExactSpellingNative.cpp)
 
index a4dad9d..f77c31f 100644 (file)
@@ -3,7 +3,7 @@
 // See the LICENSE file in the project root for more information.
 
 #include <stdio.h>
-#include <xplatform.h>
+#include <platformdefines.h>
 
 int intManaged = 1000;
 int intNative = 2000;
index c5f031a..b4a03d7 100644 (file)
@@ -1,8 +1,7 @@
-#VCXPROJ 
 cmake_minimum_required (VERSION 2.6) 
 project (HandleRefNative) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES 
     HandleRefNative.cpp 
 ) 
index 9104bf6..3a6c895 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <stdio.h>
 #include <xplatform.h>
+#include <platformdefines.h>
 
 const int intManaged = 1000;
 const int intNative = 2000;
index b7a9790..253c9a9 100644 (file)
@@ -1,13 +1,10 @@
-#VCXPROJ 
 cmake_minimum_required (VERSION 2.6) 
 project (MAWSPINative) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES 
     MAWSPINative.cpp 
-) 
-# Additional files to reference: 
-#    MAWSPINative.def 
+)
 # add the executable 
 add_library (MAWSPINative SHARED ${SOURCES}) 
 # add the install targets 
index 721a486..0ace6b1 100644 (file)
@@ -2,7 +2,7 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-#include <xplatform.h>
+#include <platformdefines.h>
 
 extern "C" DLL_EXPORT int STDMETHODCALLTYPE GetInt()
 {
index db15381..6630f9c 100644 (file)
@@ -1,8 +1,7 @@
-#VCXPROJ 
 cmake_minimum_required (VERSION 2.6) 
 project (ComVisibleNative) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES 
     ComVisibleNative.cpp 
 ) 
index c674f66..f79e8ac 100644 (file)
@@ -7,6 +7,7 @@
 #include <windows.h>
 #include <Objbase.h>
 #include <xplatform.h>
+#include <platformdefines.h>
 
 //
 // Standard function to call the managed COM.
index ba99147..5d6513f 100644 (file)
@@ -1,7 +1,6 @@
 cmake_minimum_required (VERSION 2.6) 
 project (PInvokeIntNative) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES PInvokeIntNative.cpp) 
 add_library (PInvokeIntNative SHARED ${SOURCES}) 
 # add the install targets 
index b18456c..b5b863c 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <stdio.h>
 #include <xplatform.h>
+#include <platformdefines.h>
 
 int intManaged = 1000;
 int intNative = 2000;
index e12b647..b9dca0a 100644 (file)
@@ -1,7 +1,6 @@
 cmake_minimum_required (VERSION 2.6) 
 project (RuntimeHandlesNative) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES RuntimeHandlesNative.cpp) 
 add_library (RuntimeHandlesNative SHARED ${SOURCES}) 
 # add the install targets 
index 2a95a1a..e9b77e3 100644 (file)
@@ -3,6 +3,7 @@
 // See the LICENSE file in the project root for more information.
 
 #include <xplatform.h>
+#include <platformdefines.h>
 
 extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE Marshal_In(HANDLE expected, HANDLE actual)
 {
index 6c1321e..0440352 100644 (file)
@@ -1,8 +1,7 @@
-#VCXPROJ 
 cmake_minimum_required (VERSION 2.6) 
 project (PInvoke_SafeHandle) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES 
     SafeHandleNative.cpp 
 ) 
index 8fd1a0f..eed1ce2 100644 (file)
@@ -1,9 +1,8 @@
-#VCXPROJ 
 cmake_minimum_required (VERSION 2.6) 
 project (PInvoke_SafeHandle_MarshalAs_Interface) 
-include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake")
-include_directories("..")
-include_directories(${INC_PLATFORM_DIR}) 
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
+include_directories("..") 
 set(SOURCES 
     InterfaceNative.cpp 
 ) 
index eaf5c8f..62983c6 100644 (file)
@@ -7,6 +7,7 @@
 #include <windows.h>
 #include <oleauto.h>
 #include <xplatform.h>
+#include <platformdefines.h>
 #include "StructDefs.h"
 
 /////////////////////////////////Internal Helper Methods
index baf7c1e..53a0288 100644 (file)
@@ -1,8 +1,7 @@
-#VCXPROJ 
 cmake_minimum_required (VERSION 2.6) 
 project (PInvoke_SafeHandle_ReleaseHandle) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES 
     ReleaseHandleNative.cpp 
 ) 
index 2f90a35..cbf76d6 100644 (file)
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include <windows.h>
 #include <xplatform.h>
+#include <platformdefines.h>
 
 bool g_myResourceReleaseMethodCalled = false;
 
index 0cbcd87..520597a 100644 (file)
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include <windows.h>
 #include <xplatform.h>
+#include <platformdefines.h>
 #include "StructDefs.h" //all the unmanaged struct defs are in this file
 
 //Global Handle Return Value
index 90058da..52a6b3e 100644 (file)
@@ -1,8 +1,7 @@
 cmake_minimum_required (VERSION 2.6) 
 project (PInvokePassingByOutNative) 
-include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake")
-include_directories("..")
-include_directories(${INC_PLATFORM_DIR}) 
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
+include_directories("..") 
 set(SOURCES 
     PInvokePassingByOutNative.cpp 
 )
index f3349b1..083a6bf 100644 (file)
@@ -1,8 +1,7 @@
 cmake_minimum_required (VERSION 2.6) 
 project (PInvokePassingByRefNative) 
-include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake")
-include_directories("..")
-include_directories(${INC_PLATFORM_DIR}) 
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
+include_directories("..") 
 set(SOURCES 
     PInvokePassingByRefNative.cpp 
 ) 
index 4dbfc7c..f9639aa 100644 (file)
@@ -1,8 +1,7 @@
 cmake_minimum_required (VERSION 2.6) 
 project (ReversePInvokePassingByOutNative) 
-include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake")
-include_directories("..")
-include_directories(${INC_PLATFORM_DIR}) 
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
+include_directories("..") 
 set(SOURCES 
     ReversePInvokePassingByOutNative.cpp 
 ) 
index 34e702b..180d43c 100644 (file)
@@ -1,8 +1,7 @@
 cmake_minimum_required (VERSION 2.6) 
 project (ReversePInvokePassingByRefNative) 
-include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake")
-include_directories("..")
-include_directories(${INC_PLATFORM_DIR}) 
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
+include_directories("..") 
 set(SOURCES 
     ReversePInvokePassingByRefNative.cpp 
 ) 
index aa5a676..2a627c0 100644 (file)
@@ -1,6 +1,6 @@
 cmake_minimum_required (VERSION 2.6)
 project (VarargsNative)
-include_directories(${INC_PLATFORM_DIR})
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 set(SOURCES VarargsNative.cpp )
 
 # add the executable
index 536ffb3..4edbe61 100644 (file)
@@ -1,6 +1,6 @@
 cmake_minimum_required (VERSION 2.6)
 project (VariantNative)
-include_directories(${INC_PLATFORM_DIR})
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 set(SOURCES VariantNative.cpp)
 
 # add the executable
index edbc8cb..fbd1859 100644 (file)
@@ -3,6 +3,7 @@
 // See the LICENSE file in the project root for more information.
 
 #include <xplatform.h>
+#include <platformdefines.h>
 #include <stdio.h>
 
 
index 4877b53..7e5c257 100644 (file)
@@ -1,6 +1,7 @@
 cmake_minimum_required (VERSION 2.6)
 project (NativeBool)
 set(SOURCES BoolNative.cpp )
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 
 # add the executable
 add_library (BoolNative SHARED ${SOURCES})
@@ -15,4 +16,4 @@ target_link_libraries(BoolNative ${LINK_LIBRARIES_ADDITIONAL})
 #SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
 
 # add the install targets
-install (TARGETS BoolNative DESTINATION bin)
\ No newline at end of file
+install (TARGETS BoolNative DESTINATION bin)
index 70dffaa..92f21f9 100644 (file)
@@ -1,10 +1,11 @@
 cmake_minimum_required (VERSION 2.6)
 project (MarshalEnumNative)
 set(SOURCES MarshalEnumNative.cpp )
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake")
 
 # add the executable
 add_library (MarshalEnumNative SHARED ${SOURCES})
 target_link_libraries(MarshalEnumNative ${LINK_LIBRARIES_ADDITIONAL}) 
 
 # add the install targets
-install (TARGETS MarshalEnumNative DESTINATION bin)
\ No newline at end of file
+install (TARGETS MarshalEnumNative DESTINATION bin)
index f46eb6a..a62e27f 100644 (file)
@@ -1,3 +1,7 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
 #include <xplatform.h>
 #include <stdio.h>
 #include <stdlib.h>
index 62ce004..2f706af 100644 (file)
@@ -1,6 +1,6 @@
 cmake_minimum_required (VERSION 2.6)
 project (UIntPtrNative)
-include_directories(${INC_PLATFORM_DIR})
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 set(SOURCES UIntPtrNative.cpp )
 
 # add the executable
index e07b407..a366c31 100755 (executable)
@@ -1,18 +1,11 @@
 cmake_minimum_required (VERSION 2.6)
 project (RefCharArrayNative)
 set(SOURCES RefCharArrayNative.cpp )
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake")
 
 # add the executable
 add_library (RefCharArrayNative SHARED ${SOURCES})
 target_link_libraries(RefCharArrayNative ${LINK_LIBRARIES_ADDITIONAL}) 
 
-#get_cmake_property(_variableNames VARIABLES)
-#foreach (_variableName ${_variableNames})
-#    message(STATUS "${_variableName}=${${_variableName}}")
-#endforeach()
-
-#SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
-
 # add the install targets
-install (TARGETS RefCharArrayNative DESTINATION bin)
\ No newline at end of file
+install (TARGETS RefCharArrayNative DESTINATION bin)
index e5972cb..9606e9c 100755 (executable)
@@ -3,6 +3,7 @@
 // See the LICENSE file in the project root for more information.
 
 #include <xplatform.h>
+#include <platformdefines.h>
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -99,4 +100,4 @@ typedef BOOL (__stdcall * DelegatePInvoke_Stdcall)(char **pstr);
 extern "C" DLL_EXPORT DelegatePInvoke_Stdcall __stdcall DelegatePinvoke_Stdcall()
 {
     return MarshalRefCharArray_Stdcall;
-}
\ No newline at end of file
+}
index 6525c0e..af63eff 100755 (executable)
@@ -1,5 +1,6 @@
 cmake_minimum_required (VERSION 2.6)
 project (RefIntNative)
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 set(SOURCES RefIntNative.cpp )
 
 # add the executable
@@ -7,4 +8,4 @@ add_library(RefIntNative SHARED ${SOURCES})
 target_link_libraries(RefIntNative ${LINK_LIBRARIES_ADDITIONAL})
 
 # add the install targets
-install (TARGETS RefIntNative DESTINATION bin)
\ No newline at end of file
+install (TARGETS RefIntNative DESTINATION bin)
index a797a26..a0ebd66 100644 (file)
@@ -1,6 +1,6 @@
 cmake_minimum_required (VERSION 2.6)
 project (SimpleStructNative)
-include_directories(${INC_PLATFORM_DIR})
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 set(SOURCES SimpleStructNative.cpp )
 
 # add the executable
index c162365..720e8f6 100644 (file)
@@ -1,5 +1,6 @@
 cmake_minimum_required (VERSION 2.6)
 project (SizeConstNative)
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 set(SOURCES SizeConstNative.cpp)
 
 # add the executable
index 05288f0..6caf4ea 100644 (file)
@@ -2,7 +2,7 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-#include <xplatform.h>
+#include <platformdefines.h>
 
 const int ARRAY_SIZE = 100;
 typedef struct { char  arr[ARRAY_SIZE]; } S_CHARByValArray;
index ca9d92c..a5214f6 100644 (file)
@@ -35,7 +35,7 @@ extern "C" DLL_EXPORT BSTR STDMETHODCALLTYPE Marshal_In(/*[in]*/ BSTR s)
         printf("\tThe length of Actual:%zd\n", len);
     }
 
-    return TP_SysAllocStringByteLen(strReturn, lenstrReturn);
+    return CoreClrBStrAlloc(strReturn, lenstrReturn);
 }
 
 //Test Method2
@@ -66,18 +66,18 @@ extern "C" DLL_EXPORT BSTR STDMETHODCALLTYPE Marshal_InOut(/*[In,Out]*/ BSTR s)
     *((UINT *)s - 1) = (UINT) TP_SysStringByteLen(s);
 
     //Return
-    return TP_SysAllocStringByteLen(strReturn, lenstrReturn);
+    return CoreClrBStrAlloc(strReturn, lenstrReturn);
 }
 extern "C" DLL_EXPORT BSTR STDMETHODCALLTYPE Marshal_Out(/*[Out]*/ BSTR s)
 {
-    s = TP_SysAllocStringByteLen(strNative, lenstrNative);
+    s = CoreClrBStrAlloc(strNative, lenstrNative);
 
     //In-Place Change
     memcpy((char *)s, strNative, lenstrNative);
     *((UINT *)s - 1) = (UINT) TP_SysStringByteLen(s);
 
     //Return
-    return TP_SysAllocStringByteLen(strReturn, lenstrReturn);
+    return CoreClrBStrAlloc(strReturn, lenstrReturn);
 }
 
 extern "C" DLL_EXPORT BSTR STDMETHODCALLTYPE MarshalPointer_In(/*[in]*/ BSTR *s)
@@ -101,7 +101,7 @@ extern "C" DLL_EXPORT BSTR STDMETHODCALLTYPE MarshalPointer_In(/*[in]*/ BSTR *s)
         printf("\tThe length of Actual:%zd\n", len);
     }
 
-    return TP_SysAllocStringByteLen(strReturn, lenstrReturn);
+    return CoreClrBStrAlloc(strReturn, lenstrReturn);
 }
 
 extern "C" DLL_EXPORT BSTR STDMETHODCALLTYPE MarshalPointer_InOut(/*[in,out]*/ BSTR *s)
@@ -128,15 +128,15 @@ extern "C" DLL_EXPORT BSTR STDMETHODCALLTYPE MarshalPointer_InOut(/*[in,out]*/ B
     }
 
     //Allocate New
-    TP_SysFreeString(*s);
-    *s = TP_SysAllocStringByteLen(strNative, lenstrNative);
+    CoreClrBStrFree(*s);
+    *s = CoreClrBStrAlloc(strNative, lenstrNative);
 
     //Return
-    return TP_SysAllocStringByteLen(strReturn, lenstrReturn);
+    return CoreClrBStrAlloc(strReturn, lenstrReturn);
 }
 
 extern "C" DLL_EXPORT BSTR STDMETHODCALLTYPE MarshalPointer_Out(/*[out]*/ BSTR *s)
 {
-    *s = TP_SysAllocStringByteLen(strNative, lenstrNative);
-    return TP_SysAllocStringByteLen(strReturn, lenstrReturn);
+    *s = CoreClrBStrAlloc(strNative, lenstrNative);
+    return CoreClrBStrAlloc(strReturn, lenstrReturn);
 }
index 2bf1435..621fed8 100644 (file)
@@ -1,6 +1,6 @@
 cmake_minimum_required (VERSION 2.6)
 project (AnsiBStrTestNative)
-include_directories(${INC_PLATFORM_DIR})
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 set(SOURCES AnsiBStrTestNative.cpp)
 
 # add the executable
index 0365167..2208d4c 100644 (file)
@@ -2,6 +2,7 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
+#include <xplatform.h>
 #include <platformdefines.h>
 
 WCHAR strManaged[] = W("Managed\0String\0");
@@ -69,7 +70,7 @@ extern "C" DLL_EXPORT BSTR MarshalPointer_InOut(/*[in,out]*/BSTR *s)
     }
 
     //Allocate New
-    TP_SysFreeString(*s);
+    CoreClrBStrFree(*s);
     *s = TP_SysAllocString(strNative);
 
     //Return
@@ -97,7 +98,7 @@ extern "C" DLL_EXPORT BOOL __cdecl RPinvoke_DelMarshal_InOut(Test_DelMarshal_InO
         return FALSE;
     }
 
-    TP_SysFreeString(str);
+    CoreClrBStrFree(str);
     return TRUE;
 }
 
@@ -211,7 +212,7 @@ extern "C" DLL_EXPORT BOOL MarshalPointer_Struct_InOut(Person* person)
 typedef BOOL (* Test_DelMarshal_Struct_In)(Person person);
 extern "C" DLL_EXPORT BOOL RPInvoke_DelMarshal_Struct_In(Test_DelMarshal_Struct_In d)
 {
-    Person * pPerson = (Person *)TP_CoTaskMemAlloc(sizeof(Person));
+    Person * pPerson = (Person *)CoreClrAlloc(sizeof(Person));
     pPerson->age = 21;
     pPerson->name =  TP_SysAllocString(strNative);
     
@@ -227,7 +228,7 @@ extern "C" DLL_EXPORT BOOL RPInvoke_DelMarshal_Struct_In(Test_DelMarshal_Struct_
 typedef BOOL (* Test_DelMarshalPointer_Struct_InOut)(Person * person);
 extern "C" DLL_EXPORT BOOL RPInvoke_DelMarshalStructPointer_InOut(Test_DelMarshalPointer_Struct_InOut d)
 {
-    Person * pPerson = (Person *)TP_CoTaskMemAlloc(sizeof(Person));
+    Person * pPerson = (Person *)CoreClrAlloc(sizeof(Person));
     pPerson->age = 21;
     pPerson->name =  TP_SysAllocString(strNative);
 
index d485437..23b559b 100644 (file)
@@ -1,6 +1,6 @@
 cmake_minimum_required (VERSION 2.6)
 project (BSTRTestNative)
-include_directories(${INC_PLATFORM_DIR})
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 set(SOURCES BSTRTestNative.cpp)
 
 # add the executable
index 3d30d82..3798d5a 100644 (file)
@@ -1,6 +1,7 @@
 cmake_minimum_required (VERSION 2.6)
 project (LPSTRTestNative)
 set(SOURCES LPSTRTestNative.cpp )
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake")
 
 # add the executable
 add_library (LPSTRTestNative SHARED ${SOURCES})
index 5a03672..399db99 100644 (file)
@@ -3,6 +3,8 @@
 // See the LICENSE file in the project root for more information.
 
 #include <xplatform.h>
+#include <platformdefines.h>
+
 const char* strManaged = "Managed\0String\0";
 size_t   lenstrManaged = 7; // the length of strManaged
 
index f99a6e5..a4c528b 100644 (file)
@@ -1,10 +1,11 @@
 cmake_minimum_required (VERSION 2.6)
 project (LPTSTRTestNative)
 set(SOURCES LPTSTRTestNative.cpp )
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake")
 
 # add the executable
 add_library (LPTSTRTestNative SHARED ${SOURCES})
 target_link_libraries(LPTSTRTestNative ${LINK_LIBRARIES_ADDITIONAL}) 
 
 # add the install targets
-install (TARGETS LPTSTRTestNative DESTINATION bin)
\ No newline at end of file
+install (TARGETS LPTSTRTestNative DESTINATION bin)
index 833c316..7396000 100644 (file)
@@ -3,6 +3,7 @@
 // See the LICENSE file in the project root for more information.
 
 #include <xplatform.h>
+#include <platformdefines.h>
 
 const WCHAR* strManaged = W("Managed\0String\0");
 size_t   lenstrManaged = 7; // the length of strManaged
index 37c952d..03b4754 100644 (file)
@@ -1,10 +1,11 @@
 cmake_minimum_required (VERSION 2.6)
 project (UTF8TestNative)
 set(SOURCES UTF8TestNative.cpp )
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake")
 
 # add the executable
 add_library (UTF8TestNative SHARED ${SOURCES})
 target_link_libraries(UTF8TestNative ${LINK_LIBRARIES_ADDITIONAL})
 
 # add the install targets
-install (TARGETS UTF8TestNative DESTINATION bin)
\ No newline at end of file
+install (TARGETS UTF8TestNative DESTINATION bin)
index 3dde7f8..0192d76 100644 (file)
@@ -3,6 +3,7 @@
 // See the LICENSE file in the project root for more information.
 
 #include <xplatform.h>
+#include <platformdefines.h>
 
 const int NSTRINGS = 6;
 #ifdef _WIN32
@@ -281,4 +282,4 @@ extern "C" DLL_EXPORT void __cdecl Utf8DelegateAsParameter(Callback managedCallb
         managedCallback(pszNative, i);
         free_utf8_string(pszNative);
     }
-}
\ No newline at end of file
+}
index 39d1f77..f736342 100644 (file)
@@ -1,6 +1,6 @@
 cmake_minimum_required (VERSION 2.6)
 project (VBByRefStrNative)
-include_directories(${INC_PLATFORM_DIR})
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 set(SOURCES VBByRefStrNative.cpp )
 
 # add the executable
index 860c2e8..5ea19af 100644 (file)
@@ -1,6 +1,6 @@
 cmake_minimum_required (VERSION 2.6)
 project (MarshalStructAsParam)
-include_directories(${INC_PLATFORM_DIR})
+include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
 set(SOURCES MarshalStructAsParamDLL.cpp)
 
 # add the executable
index 7278b94..2f49072 100644 (file)
@@ -2,7 +2,6 @@
 cmake_minimum_required (VERSION 2.6) 
 project (ReversePInvokeNative) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES 
     ExpStructAsParamNative.cpp 
 ) 
index 0b3aef3..397a73b 100644 (file)
@@ -1,7 +1,6 @@
 cmake_minimum_required (VERSION 2.6) 
 project (SeqPInvokeNative) 
 include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") 
-include_directories(${INC_PLATFORM_DIR}) 
 set(SOURCES 
     SeqStructDelRevPInvokeNative.cpp 
 ) 
diff --git a/tests/src/Interop/common/types.h b/tests/src/Interop/common/types.h
deleted file mode 100755 (executable)
index cabcd42..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-#ifndef _INTEROP_TYPES__H
-#define _INTEROP_TYPES__H
-
-#include <stddef.h>
-
-#undef INT_MIN
-#define INT_MIN           (-2147483647 - 1)
-
-typedef char16_t WCHAR;
-typedef int BOOL;
-typedef WCHAR *LPWSTR, *PWSTR;
-typedef const WCHAR *LPCWSTR, *PCWSTR;
-
-typedef char* LPSTR;
-typedef const char* LPCSTR;
-typedef void* FARPROC;
-typedef void* HANDLE;
-typedef void* HMODULE;
-typedef int error_t;
-typedef void* LPVOID;
-typedef unsigned char BYTE;
-typedef WCHAR OLECHAR;
-typedef ptrdiff_t INT_PTR;
-typedef size_t UINT_PTR;
-
-typedef unsigned long long ULONG64;
-typedef unsigned long long LONG64;
-typedef double DOUBLE;
-typedef float FLOAT;
-typedef int INT, *LPINT;
-typedef unsigned int UINT;
-typedef int LONG;
-typedef char CHAR, *PCHAR;
-typedef unsigned short USHORT;
-typedef signed short SHORT;
-typedef unsigned short WORD, *PWORD, *LPWORD;
-typedef int LONG;
-
-typedef size_t SIZE_T;
-
-typedef union tagCY {
-    struct {
-#if BIGENDIAN
-        LONG    Hi;
-        LONG   Lo;
-#else
-        LONG   Lo;
-        LONG    Hi;
-#endif
-    };
-    LONG64 int64;
-} CY, *LPCY;
-
-typedef CY CURRENCY;
-
-typedef struct tagDEC {
-    // Decimal.cs treats the first two shorts as one long
-    // And they seriable the data so we need to little endian
-    // seriliazation
-    // The wReserved overlaps with Variant's vt member
-#if BIGENDIAN
-    union {
-        struct {
-            BYTE sign;
-            BYTE scale;
-        };
-        USHORT signscale;
-    };
-    USHORT wReserved;
-#else
-    USHORT wReserved;
-    union {
-        struct {
-            BYTE scale;
-            BYTE sign;
-        };
-        USHORT signscale;
-    };
-#endif
-    LONG Hi32;
-    union {
-        struct {
-            LONG Lo32;
-            LONG Mid32;
-        };
-        ULONG64 Lo64;
-    };
-} DECIMAL, *LPDECIMAL;
-
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#endif //_INTEROP_TYPES__H
index a051692..e5ea136 100644 (file)
 #ifndef __XPLAT_H__
 #define __XPLAT_H__
 
-#ifdef _MSC_VER
-// Our tests don't care about secure CRT
-#define _CRT_SECURE_NO_WARNINGS 1
-#endif
+#include <platformdefines.h>
 
-// Ensure that both UNICODE and _UNICODE are set.
-#ifndef _UNICODE
-#define _UNICODE
-#endif
-#ifndef UNICODE
-#define UNICODE
-#endif
+#ifndef WINDOWS
 
-// common headers
-#include <stdio.h>
-#include <memory.h>
-#include <stdlib.h>
+#include <stddef.h>
 
-// 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
-// as u"" (char16_t)
-#ifdef _WIN32
-#define W(str)  L##str
-#else // !_WIN32
-#define W(str)  u##str
-#endif //_WIN32
+#undef INT_MIN
+#define INT_MIN           (-2147483647 - 1)
 
+typedef ptrdiff_t INT_PTR;
+typedef size_t UINT_PTR;
 
-//  include 
-#ifdef _WIN32
-    #define NOMINMAX
-    #include <windows.h>
-    #include <combaseapi.h>
+typedef unsigned long long ULONG64;
+typedef unsigned long long LONG64;
+typedef double DOUBLE;
+typedef float FLOAT;
+typedef int INT, *LPINT;
+typedef unsigned int UINT;
+typedef char CHAR, *PCHAR;
+typedef unsigned short USHORT;
+typedef signed short SHORT;
+typedef unsigned short WORD, *PWORD, *LPWORD;
+typedef int LONG;
 
-    #ifndef snprintf
-    #define snprintf _snprintf
-    #endif //snprintf
+typedef size_t SIZE_T;
 
+typedef union tagCY {
+    struct {
+#if BIGENDIAN
+        LONG    Hi;
+        LONG   Lo;
 #else
-    #include "types.h"
+        LONG   Lo;
+        LONG    Hi;
 #endif
-#include <wchar.h>
-
-// dllexport
-#if defined _WIN32
-#define DLL_EXPORT __declspec(dllexport)
-
-#else //!_Win32
-
-#if __GNUC__ >= 4
-#define DLL_EXPORT __attribute__ ((visibility ("default")))
+    };
+    LONG64 int64;
+} CY, *LPCY;
+
+typedef CY CURRENCY;
+
+typedef struct tagDEC {
+    // Decimal.cs treats the first two shorts as one long
+    // And they seriable the data so we need to little endian
+    // seriliazation
+    // The wReserved overlaps with Variant's vt member
+#if BIGENDIAN
+    union {
+        struct {
+            BYTE sign;
+            BYTE scale;
+        };
+        USHORT signscale;
+    };
+    USHORT wReserved;
 #else
-#define DLL_EXPORT
+    USHORT wReserved;
+    union {
+        struct {
+            BYTE scale;
+            BYTE sign;
+        };
+        USHORT signscale;
+    };
 #endif
-
-#endif //_WIN32
-
-// Calling conventions
-#ifndef _WIN32
-
-#define STDMETHODCALLTYPE
-
-#if __i386__
-#define __stdcall __attribute__((stdcall))
-#define __cdecl __attribute__((cdecl))
-#else
-#define __stdcall
-#define __cdecl
+    LONG Hi32;
+    union {
+        struct {
+            LONG Lo32;
+            LONG Mid32;
+        };
+        ULONG64 Lo64;
+    };
+} DECIMAL, *LPDECIMAL;
+
+
+#ifndef TRUE
+#define TRUE 1
 #endif
-#endif //!_WIN32
 
-inline void *CoreClrAlloc(size_t cb)
-{
-#ifdef _WIN32
-    return ::CoTaskMemAlloc(cb);
-#else
-    return ::malloc(cb);
-#endif
-}
-
-inline void CoreClrFree(void *p)
-{
-#ifdef _WIN32
-    return ::CoTaskMemFree(p);
-#else
-    return ::free(p);
-#endif
-}
-
-inline void *CoreClrBstrAlloc(size_t cb)
-{
-#ifdef _WIN32
-    // A null is automatically applied in the SysAllocStringByteLen API.
-    // Remove a single OLECHAR for the implied null.
-    // https://docs.microsoft.com/en-us/previous-versions/windows/desktop/api/oleauto/nf-oleauto-sysallocstringbytelen
-    if (cb >= sizeof(OLECHAR))
-        cb -= sizeof(OLECHAR);
-
-    return ::SysAllocStringByteLen(nullptr, static_cast<UINT>(cb));
-#else
-    return nullptr;
+#ifndef FALSE
+#define FALSE 0
 #endif
-}
-
-inline void CoreClrBstrFree(void *p)
-{
-#ifdef _WIN32
-    return ::SysFreeString((BSTR)p);
-#endif
-}
-
-// redirected types not-windows only
-#ifndef  _WIN32
 
 class IUnknown
 {
@@ -128,76 +97,6 @@ public:
     virtual unsigned long Release() = 0;
 };
 
-// function implementation
-size_t strncpy_s(char* strDest, size_t numberOfElements, const char *strSource, size_t count)
-{
-    // NOTE: Need to pass count + 1 since strncpy_s does not count null,
-    // while snprintf does. 
-    return snprintf(strDest, count + 1, "%s", strSource);
-}
-
-size_t strcpy_s(char *dest, size_t n, char const *src)
-{
-    return snprintf(dest, n, "%s", src);
-}
-
-#ifndef wcslen
-size_t wcslen(const WCHAR *str)
-{
-    size_t len = 0;
-    while ('\0' != *(str + len)) len++;
-    return len;
-}
-#endif
-
-int wcsncpy_s(LPWSTR strDestination, size_t size1, LPCWSTR strSource, size_t size2)
-{
-    // copy sizeInBytes bytes of strSource into strDestination
-    if (NULL == strDestination || NULL == strSource) return 1;
-
-    int cnt = 0;
-    while (cnt < size1 && '\0' != strSource[cnt])
-    {
-        strDestination[cnt] = strSource[cnt];
-        cnt++;
-    }
-
-    strDestination[cnt] = '\0';
-    return 0;
-}
-
-int wcsncpy_s(LPWSTR strDestination, size_t size1, LPCWSTR strSource)
-{
-    return wcsncpy_s(strDestination, size1, strSource, 0);
-}
-
-int wcsncmp(LPCWSTR str1, LPCWSTR str2,size_t len)
-{
-    // < 0 str1 less than str2
-    // 0  str1 identical to str2
-    // > 0 str1 greater than str2
-    if (NULL == str1 && NULL != str2) return -1;
-    if (NULL != str1 && NULL == str2) return 1;
-    if (NULL == str1 && NULL == str2) return 0;
-
-    while (*str1 == *str2 && '\0' != *str1 && '\0' != *str2 && len--!= 0)
-    {
-        str1++;
-        str2++;
-    }
-
-    if ('\0' == *str1 && '\0' == *str2) return 0;
-    if ('\0' != *str1) return -1;
-    if ('\0' != *str2) return 1;
-
-    return (*str1 > *str2) ? 1 : -1;
-}
-
-int wmemcmp(LPCWSTR str1, LPCWSTR str2,size_t len)
-{
-    return wcsncmp(str1, str2, len);
-}
-
 #define DECIMAL_NEG ((BYTE)0x80)
 #define DECIMAL_SCALE(dec)       ((dec).u.u.scale)
 #define DECIMAL_SIGN(dec)        ((dec).u.u.sign)