From: Aaron Robinson Date: Thu, 30 Aug 2018 22:01:12 +0000 (-0700) Subject: Update existing COM test assets (native/managed) to share CLSIDs with… (#19756) X-Git-Tag: accepted/tizen/unified/20190422.045933~1309 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=35ead994ccde0cf2faaf1786af49d5b9ed523074;p=platform%2Fupstream%2Fcoreclr.git Update existing COM test assets (native/managed) to share CLSIDs with… (#19756) * Update existing COM test assets (native/managed) to share CLSIDs with other projects. * Update Interop.settings.targets None of these test changes apply to Ubuntu ARM --- diff --git a/tests/src/Interop/COM/NETClients/Primitives/NETClientPrimitives.csproj b/tests/src/Interop/COM/NETClients/Primitives/NETClientPrimitives.csproj index 094bea9..56d18ef 100644 --- a/tests/src/Interop/COM/NETClients/Primitives/NETClientPrimitives.csproj +++ b/tests/src/Interop/COM/NETClients/Primitives/NETClientPrimitives.csproj @@ -28,6 +28,7 @@ + diff --git a/tests/src/Interop/COM/NETServer/NETServer.csproj b/tests/src/Interop/COM/NETServer/NETServer.csproj index cf62cc0..214bb25 100644 --- a/tests/src/Interop/COM/NETServer/NETServer.csproj +++ b/tests/src/Interop/COM/NETServer/NETServer.csproj @@ -24,6 +24,7 @@ + diff --git a/tests/src/Interop/COM/NativeServer/ArrayTesting.h b/tests/src/Interop/COM/NativeServer/ArrayTesting.h index cbf54cf..6939762 100644 --- a/tests/src/Interop/COM/NativeServer/ArrayTesting.h +++ b/tests/src/Interop/COM/NativeServer/ArrayTesting.h @@ -7,7 +7,7 @@ #include #include "Servers.h" -class DECLSPEC_UUID("B99ABE6A-DFF6-440F-BFB6-55179B8FE18E") ArrayTesting : public UnknownImpl, public IArrayTesting +class ArrayTesting : public UnknownImpl, public IArrayTesting { private: template diff --git a/tests/src/Interop/COM/NativeServer/ErrorMarshalTesting.h b/tests/src/Interop/COM/NativeServer/ErrorMarshalTesting.h index 36d758a..6dd7649 100644 --- a/tests/src/Interop/COM/NativeServer/ErrorMarshalTesting.h +++ b/tests/src/Interop/COM/NativeServer/ErrorMarshalTesting.h @@ -6,7 +6,7 @@ #include "Servers.h" -class DECLSPEC_UUID("71CF5C45-106C-4B32-B418-43A463C6041F") ErrorMarshalTesting : public UnknownImpl, public IErrorMarshalTesting +class ErrorMarshalTesting : public UnknownImpl, public IErrorMarshalTesting { public: // IErrorMarshalTesting DEF_RAWFUNC(Throw_HResult)( diff --git a/tests/src/Interop/COM/NativeServer/NumericTesting.h b/tests/src/Interop/COM/NativeServer/NumericTesting.h index 9a80230..555a38d 100644 --- a/tests/src/Interop/COM/NativeServer/NumericTesting.h +++ b/tests/src/Interop/COM/NativeServer/NumericTesting.h @@ -5,9 +5,10 @@ #pragma once #include +#include #include "Servers.h" -class DECLSPEC_UUID("53169A33-E85D-4E3C-B668-24E438D0929B") NumericTesting : public UnknownImpl, public INumericTesting +class NumericTesting : public UnknownImpl, public INumericTesting { public: DEF_RAWFUNC(Add_Byte)( diff --git a/tests/src/Interop/COM/NativeServer/Servers.h b/tests/src/Interop/COM/NativeServer/Servers.h index 5a22e80..bcfdbe2 100644 --- a/tests/src/Interop/COM/NativeServer/Servers.h +++ b/tests/src/Interop/COM/NativeServer/Servers.h @@ -4,15 +4,35 @@ #pragma once -#include "ComHelpers.h" +#include //#import "Server.Contract.tlb" no_namespace #include -#define DEF_RAWFUNC(n) virtual COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE raw_ ## n -#define DEF_FUNC(n) virtual COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE ## n +// Forward declare servers so COM clients can reference the CLSIDs +class DECLSPEC_UUID("53169A33-E85D-4E3C-B668-24E438D0929B") NumericTesting; +class DECLSPEC_UUID("B99ABE6A-DFF6-440F-BFB6-55179B8FE18E") ArrayTesting; +class DECLSPEC_UUID("C73C83E8-51A2-47F8-9B5C-4284458E47A6") StringTesting; +class DECLSPEC_UUID("71CF5C45-106C-4B32-B418-43A463C6041F") ErrorMarshalTesting; -#include "NumericTesting.h" -#include "ArrayTesting.h" -#include "StringTesting.h" -#include "ErrorMarshalTesting.h" +#define CLSID_NumericTesting __uuidof(NumericTesting) +#define CLSID_ArrayTesting __uuidof(ArrayTesting) +#define CLSID_StringTesting __uuidof(StringTesting) +#define CLSID_ErrorMarshalTesting __uuidof(ErrorMarshalTesting) + +#define IID_INumericTesting __uuidof(INumericTesting) +#define IID_IArrayTesting __uuidof(IArrayTesting) +#define IID_IStringTesting __uuidof(IStringTesting) +#define IID_IErrorMarshalTesting __uuidof(IErrorMarshalTesting) + +#ifndef COM_CLIENT + #include "ComHelpers.h" + + #define DEF_RAWFUNC(n) virtual COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE raw_ ## n + #define DEF_FUNC(n) virtual COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE ## n + + #include "NumericTesting.h" + #include "ArrayTesting.h" + #include "StringTesting.h" + #include "ErrorMarshalTesting.h" +#endif diff --git a/tests/src/Interop/COM/NativeServer/StringTesting.h b/tests/src/Interop/COM/NativeServer/StringTesting.h index 7589bf2..1f3a35c 100644 --- a/tests/src/Interop/COM/NativeServer/StringTesting.h +++ b/tests/src/Interop/COM/NativeServer/StringTesting.h @@ -6,7 +6,7 @@ #include "Servers.h" -class DECLSPEC_UUID("C73C83E8-51A2-47F8-9B5C-4284458E47A6") StringTesting : public UnknownImpl, public IStringTesting +class StringTesting : public UnknownImpl, public IStringTesting { private: template diff --git a/tests/src/Interop/COM/NativeServer/stdafx.h b/tests/src/Interop/COM/NativeServer/stdafx.h index 058ec2e..c7eb109 100644 --- a/tests/src/Interop/COM/NativeServer/stdafx.h +++ b/tests/src/Interop/COM/NativeServer/stdafx.h @@ -6,8 +6,7 @@ #define NOMINMAX #define WIN32_LEAN_AND_MEAN -// Windows Header Files -#include +#include #include #include diff --git a/tests/src/Interop/COM/ServerContracts/PrimitivesNativeServer.cs b/tests/src/Interop/COM/ServerContracts/PrimitivesNativeServer.cs index 4e02880..86a256d 100644 --- a/tests/src/Interop/COM/ServerContracts/PrimitivesNativeServer.cs +++ b/tests/src/Interop/COM/ServerContracts/PrimitivesNativeServer.cs @@ -23,7 +23,7 @@ namespace Server.Contract.Servers /// Managed activation for CoClass /// [ComImport] - [Guid("53169A33-E85D-4E3C-B668-24E438D0929B")] + [Guid(Server.Contract.Guids.NumericTesting)] internal class NumericTestingClass { } @@ -42,7 +42,7 @@ namespace Server.Contract.Servers /// Managed activation for CoClass /// [ComImport] - [Guid("B99ABE6A-DFF6-440F-BFB6-55179B8FE18E")] + [Guid(Server.Contract.Guids.ArrayTesting)] internal class ArrayTestingClass { } @@ -61,7 +61,7 @@ namespace Server.Contract.Servers /// Managed activation for CoClass /// [ComImport] - [Guid("C73C83E8-51A2-47F8-9B5C-4284458E47A6")] + [Guid(Server.Contract.Guids.StringTesting)] internal class StringTestingClass { } @@ -80,7 +80,7 @@ namespace Server.Contract.Servers /// Managed activation for CoClass /// [ComImport] - [Guid("71CF5C45-106C-4B32-B418-43A463C6041F")] + [Guid(Server.Contract.Guids.ErrorMarshalTesting)] internal class ErrorMarshalTestingClass { } diff --git a/tests/src/Interop/COM/ServerContracts/ServerGuids.cs b/tests/src/Interop/COM/ServerContracts/ServerGuids.cs new file mode 100644 index 0000000..8b89f26 --- /dev/null +++ b/tests/src/Interop/COM/ServerContracts/ServerGuids.cs @@ -0,0 +1,17 @@ +// 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. + +namespace Server.Contract +{ + /// + /// Guids for all COM Servers + /// + internal sealed class Guids + { + public const string NumericTesting = "53169A33-E85D-4E3C-B668-24E438D0929B"; + public const string ArrayTesting = "B99ABE6A-DFF6-440F-BFB6-55179B8FE18E"; + public const string StringTesting = "C73C83E8-51A2-47F8-9B5C-4284458E47A6"; + public const string ErrorMarshalTesting = "71CF5C45-106C-4B32-B418-43A463C6041F"; + } +} \ No newline at end of file diff --git a/tests/src/Interop/Interop.settings.targets b/tests/src/Interop/Interop.settings.targets index ca22f88..50e37af 100644 --- a/tests/src/Interop/Interop.settings.targets +++ b/tests/src/Interop/Interop.settings.targets @@ -1,4 +1,4 @@ - + diff --git a/tests/src/Interop/common/types.h b/tests/src/Interop/common/types.h index f183a07..37c1454 100755 --- a/tests/src/Interop/common/types.h +++ b/tests/src/Interop/common/types.h @@ -14,16 +14,8 @@ typedef int BOOL; typedef WCHAR *LPWSTR, *PWSTR; typedef const WCHAR *LPCWSTR, *PCWSTR; -#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* ULONG_PTR; diff --git a/tests/src/Interop/common/xplatform.h b/tests/src/Interop/common/xplatform.h index e262cd7..e0b939e 100644 --- a/tests/src/Interop/common/xplatform.h +++ b/tests/src/Interop/common/xplatform.h @@ -10,6 +10,14 @@ #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 + // common headers #include #include @@ -29,6 +37,7 @@ // include #ifdef _WIN32 #include + #include #ifndef snprintf #define snprintf _snprintf @@ -68,15 +77,7 @@ #endif #endif //!_WIN32 -// Ensure that both UNICODE and _UNICODE are set. -#ifndef _UNICODE - #define _UNICODE -#endif -#ifndef UNICODE - #define UNICODE -#endif - -void *CoreClrAlloc(size_t cb) +inline void *CoreClrAlloc(size_t cb) { #ifdef _WIN32 return ::CoTaskMemAlloc(cb); @@ -85,7 +86,7 @@ void *CoreClrAlloc(size_t cb) #endif } -void CoreClrFree(void *p) +inline void CoreClrFree(void *p) { #ifdef _WIN32 return ::CoTaskMemFree(p);