From 1ef5f4f917d8778db89b232c646f6094e849fac4 Mon Sep 17 00:00:00 2001 From: Felipe Vieira Aburaya Date: Sat, 25 Nov 2017 22:20:32 -0200 Subject: [PATCH] * Ported IO serialization utilities to linux * Fixed memory leaks in RPC module and its tests * Fixed crash that would happen upon transportation of exception from another thread * Fixed crash that would happen upon elaboration of report with extended RPC error information * Fixed bug in WWS module that would make channel properties (additional to the ones defined in wsutil.exe generated source) be ignored * Reduced memory footprint of WWS hosts * More fault tolerance/graceful degradation in Broker, WWS and RPC modules: attempt to recover from loss of connection or bad reply, using retries when applicable * Added capability of non-hardcoded settings in XML configuration of applications * Changes in most important parameters for tests no longer require recompilation from source because they are now XML configured * Dependency libraries on Windows are updated: Boost v1.65.1 and POCO C++ 1.7.9 * Improvements on build & setup process for POSIX * Build/install for Windows from source code of solution and dependencies is now fully automated by Powershell script * Port to Windows 7: Win32 projects now run in Win7 (and theorically XP too) when compiled by vs140_xp toolset --- .gitignore | 4 +- 3FD.sln | 597 +++++---- 3FD/3FD.WinRT.UWP.vcxproj | 12 +- 3FD/3FD.vcxproj | 142 +- 3FD/3FD.vcxproj.filters | 11 +- 3FD/3fd-config-template.xml | 87 ++ 3FD/CMakeLists.txt | 21 +- 3FD/broker.h | 6 +- 3FD/broker_impl.cpp | 99 ++ 3FD/broker_impl.h | 4 + 3FD/broker_impl_reader.cpp | 29 +- 3FD/broker_impl_writer.cpp | 41 +- 3FD/callstacktracer.cpp | 298 ++--- 3FD/callstacktracer.h | 174 +-- 3FD/config3fd-template.xml | 51 - 3FD/configuration.cpp | 890 ++++++++----- 3FD/configuration.h | 191 ++- 3FD/exceptions.h | 21 +- 3FD/gc_garbagecollector.cpp | 25 +- 3FD/logger.cpp | 31 +- 3FD/logger.h | 8 +- 3FD/logger_poco.cpp | 4 +- 3FD/logger_winrt.cpp | 4 +- 3FD/opencl_impl_context.cpp | 1042 ++++++++------- 3FD/preprocessing.h | 26 +- 3FD/rpc_helpers.h | 43 +- 3FD/rpc_impl_client.cpp | 1150 ++++++++++------- 3FD/rpc_impl_server.cpp | 4 +- 3FD/rpc_impl_server.h | 2 +- 3FD/rpc_impl_util.cpp | 78 +- 3FD/rpc_impl_util.h | 33 +- 3FD/runtime.cpp | 362 +++--- 3FD/runtime.h | 8 +- 3FD/sqlite.h | 6 +- 3FD/sqlite3.c | 6 +- 3FD/stdafx.h | 10 +- 3FD/web_wws_impl_host.cpp | 16 +- 3FD/web_wws_impl_proxy.cpp | 326 ++++- 3FD/web_wws_impl_proxy.h | 15 +- 3FD/web_wws_impl_utils.cpp | 5 +- 3FD/web_wws_impl_utils.h | 9 +- 3FD/web_wws_impl_utils_wsasyncoper.cpp | 142 -- 3FD/web_wws_impl_utils_wserror.cpp | 43 +- 3FD/web_wws_utils.h | 114 +- 3FD/web_wws_webserviceproxy.h | 22 +- Acknowledgements.txt | 2 +- ...Database.sql => CreateMsSqlSvcBrokerDB.sql | Bin 5002 -> 5870 bytes ImageTranscoder/ImageTranscoder.cpp | 2 +- ImageTranscoderApp/ImageTranscoderApp.vcxproj | 1 + .../ImageTranscoderApp_TemporaryKey.pfx | Bin 0 -> 2600 bytes ImageTranscoderApp/Package.appxmanifest | 2 +- IntegrationTests/AcmeTesting_w32.h | 29 +- IntegrationTests/AcmeTesting_w32_srv.c | 239 ++-- IntegrationTests/AcmeTesting_x64.h | 29 +- IntegrationTests/AcmeTesting_x64_srv.c | 239 ++-- IntegrationTests/CMakeLists.txt | 88 +- IntegrationTests/IntegrationTests.vcxproj | 197 +++ .../IntegrationTestsApp.WinRT.UWP.vcxproj | 7 +- ...grationTestsApp.WinRT.UWP_TemporaryKey.pfx | Bin 0 -> 2600 bytes .../WinRT.UWP/Package.appxmanifest | 37 +- IntegrationTests/application.config | 37 +- IntegrationTests/calculator.wsdl.c | 48 +- IntegrationTests/calculator.wsdl.h | 30 +- IntegrationTests/tests_broker.cpp | 19 +- IntegrationTests/tests_opencl.cpp | 62 +- IntegrationTests/tests_rpc.cpp | 74 +- IntegrationTests/tests_wws.cpp | 29 +- MidlCompileRpcTestIDL.bat | 8 +- README | 2 +- TestRpcClient/AcmeTesting_w32.h | 29 +- TestRpcClient/AcmeTesting_w32_cli.c | 280 ++-- TestRpcClient/AcmeTesting_x64.h | 29 +- TestRpcClient/AcmeTesting_x64_cli.c | 281 ++-- TestRpcClient/TestRpcClient.vcxproj | 660 ++++++---- TestRpcClient/application.config | 28 +- TestRpcClient/tests_rpc.cpp | 125 +- TestShared/AcmeTesting.idl | 16 +- TestShared/calculator.wsdl | 6 +- TestWwsClient/TestWwsClient.vcxproj | 602 ++++++--- TestWwsClient/application.config | 85 +- TestWwsClient/calculator.wsdl.c | 54 +- TestWwsClient/calculator.wsdl.h | 30 +- TestWwsClient/tests_wws.cpp | 573 ++++---- UnitTests/CMakeLists.txt | 70 +- UnitTests/UnitTests.vcxproj | 188 +++ UnitTests/WinRT.UWP/Package.appxmanifest | 2 +- .../WinRT.UWP/UnitTestsApp.WinRT.UWP.vcxproj | 7 +- .../UnitTestsApp.WinRT.UWP_TemporaryKey.pfx | Bin 0 -> 2600 bytes UnitTests/application.config | 25 +- VideoTranscoder/VideoTranscoder.cpp | 2 +- _config.yml | 1 - build.ps1 | 859 ++++++++++++ build.sh | 20 + cmake_build_scripts.tar.gz | Bin 750 -> 0 bytes configure.sh | 50 + gtest/include/gtest/internal/gtest-port.h | 2 +- gtest/msvc/gtest-md.vcxproj | 410 +++--- opencl-c-example-wrong.txt | 6 +- setup.sh | 69 + 99 files changed, 7400 insertions(+), 4502 deletions(-) create mode 100644 3FD/3fd-config-template.xml delete mode 100644 3FD/config3fd-template.xml delete mode 100644 3FD/web_wws_impl_utils_wsasyncoper.cpp rename CreateMsSqlSvcBrokerDatabase.sql => CreateMsSqlSvcBrokerDB.sql (84%) create mode 100644 ImageTranscoderApp/ImageTranscoderApp_TemporaryKey.pfx create mode 100644 IntegrationTests/WinRT.UWP/IntegrationTestsApp.WinRT.UWP_TemporaryKey.pfx create mode 100644 UnitTests/WinRT.UWP/UnitTestsApp.WinRT.UWP_TemporaryKey.pfx delete mode 100644 _config.yml create mode 100644 build.ps1 create mode 100644 build.sh delete mode 100644 cmake_build_scripts.tar.gz create mode 100644 configure.sh create mode 100644 setup.sh diff --git a/.gitignore b/.gitignore index bdac471..9ac9be6 100644 --- a/.gitignore +++ b/.gitignore @@ -85,7 +85,8 @@ ipch/ *.ncb *.opensdf *.sdf -*.db +*.VC.db +*.VC.opendb *.cachefile # Visual Studio profiler @@ -151,7 +152,6 @@ ClientBin/ *~ *.dbmdl *.[Pp]ublish.xml -*.pfx *.publishsettings *.xbf diff --git a/3FD.sln b/3FD.sln index 7db304b..dc71f7c 100644 --- a/3FD.sln +++ b/3FD.sln @@ -1,247 +1,350 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "3FD", "3FD\3FD.vcxproj", "{CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTests", "UnitTests\UnitTests.vcxproj", "{A657480D-D083-4C31-B499-42FF50481AC1}" - ProjectSection(ProjectDependencies) = postProject - {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8} = {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8} - {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B} = {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IntegrationTests", "IntegrationTests\IntegrationTests.vcxproj", "{B288E7DC-4F10-4432-8CB9-2061400F4E0C}" - ProjectSection(ProjectDependencies) = postProject - {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B} = {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest-md", "gtest\msvc\gtest-md.vcxproj", "{C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Testing", "Testing", "{8E00B911-43B2-49D5-9B4A-AB6E1ED097A1}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WinRT", "WinRT", "{EE86AB66-09DF-45EB-A42A-ED426AF3266E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestRpcClient", "TestRpcClient\TestRpcClient.vcxproj", "{6ADF3A4B-1E22-41BA-9293-96593E6A45BE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestWwsClient", "TestWwsClient\TestWwsClient.vcxproj", "{4913E097-136E-4BC4-BF8C-D3341FB1425A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VideoTranscoder", "VideoTranscoder\VideoTranscoder.vcxproj", "{84D2D4D4-0A88-477D-B645-C972EEB97464}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Real Applications", "Real Applications", "{81644728-0859-4738-A153-9130F614BE9F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageTranscoder", "ImageTranscoder\ImageTranscoder.vcxproj", "{78B91DF7-B30D-4479-BEBC-795C8617DC55}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyImagingComsWinRT", "ImageTranscoder\MyImagingComsWinRT.vcxproj", "{EF5FD437-8033-4645-9977-D07323283556}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "3FD.WinRT.UWP", "3FD\3FD.WinRT.UWP.vcxproj", "{793AC4E5-04FF-43C1-89F9-6D7212264A36}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest.WinRT.UWP", "gtest\WinRT.UWP\gtest.WinRT.UWP.vcxproj", "{B650C884-6640-4FEE-9C5B-62E4D84D9E0F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTestsApp.WinRT.UWP", "UnitTests\WinRT.UWP\UnitTestsApp.WinRT.UWP.vcxproj", "{AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IntegrationTestsApp.WinRT.UWP", "IntegrationTests\WinRT.UWP\IntegrationTestsApp.WinRT.UWP.vcxproj", "{C427C362-4B09-4C3F-8578-F58521328DF0}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageTranscoderApp", "ImageTranscoderApp\ImageTranscoderApp.vcxproj", "{A751BAC6-864F-4500-B261-B88A465C7F89}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM = Debug|ARM - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|ARM = Release|ARM - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Debug|ARM.ActiveCfg = Debug|ARM - {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Debug|ARM.Build.0 = Debug|ARM - {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Debug|x64.ActiveCfg = Debug|x64 - {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Debug|x64.Build.0 = Debug|x64 - {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Debug|x86.ActiveCfg = Debug|Win32 - {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Debug|x86.Build.0 = Debug|Win32 - {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Release|ARM.ActiveCfg = Release|ARM - {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Release|ARM.Build.0 = Release|ARM - {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Release|x64.ActiveCfg = Release|x64 - {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Release|x64.Build.0 = Release|x64 - {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Release|x86.ActiveCfg = Release|Win32 - {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Release|x86.Build.0 = Release|Win32 - {A657480D-D083-4C31-B499-42FF50481AC1}.Debug|ARM.ActiveCfg = Debug|Win32 - {A657480D-D083-4C31-B499-42FF50481AC1}.Debug|x64.ActiveCfg = Debug|x64 - {A657480D-D083-4C31-B499-42FF50481AC1}.Debug|x64.Build.0 = Debug|x64 - {A657480D-D083-4C31-B499-42FF50481AC1}.Debug|x86.ActiveCfg = Debug|Win32 - {A657480D-D083-4C31-B499-42FF50481AC1}.Debug|x86.Build.0 = Debug|Win32 - {A657480D-D083-4C31-B499-42FF50481AC1}.Release|ARM.ActiveCfg = Release|Win32 - {A657480D-D083-4C31-B499-42FF50481AC1}.Release|x64.ActiveCfg = Release|x64 - {A657480D-D083-4C31-B499-42FF50481AC1}.Release|x64.Build.0 = Release|x64 - {A657480D-D083-4C31-B499-42FF50481AC1}.Release|x86.ActiveCfg = Release|Win32 - {A657480D-D083-4C31-B499-42FF50481AC1}.Release|x86.Build.0 = Release|Win32 - {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Debug|ARM.ActiveCfg = Debug|Win32 - {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Debug|x64.ActiveCfg = Debug|x64 - {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Debug|x64.Build.0 = Debug|x64 - {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Debug|x86.ActiveCfg = Debug|Win32 - {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Debug|x86.Build.0 = Debug|Win32 - {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Release|ARM.ActiveCfg = Release|Win32 - {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Release|x64.ActiveCfg = Release|x64 - {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Release|x64.Build.0 = Release|x64 - {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Release|x86.ActiveCfg = Release|Win32 - {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Release|x86.Build.0 = Release|Win32 - {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug|ARM.ActiveCfg = Debug|Win32 - {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug|x64.ActiveCfg = Debug|x64 - {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug|x64.Build.0 = Debug|x64 - {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug|x86.ActiveCfg = Debug|Win32 - {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug|x86.Build.0 = Debug|Win32 - {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release|ARM.ActiveCfg = Release|Win32 - {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release|x64.ActiveCfg = Release|x64 - {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release|x64.Build.0 = Release|x64 - {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release|x86.ActiveCfg = Release|Win32 - {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release|x86.Build.0 = Release|Win32 - {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Debug|ARM.ActiveCfg = Debug|Win32 - {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Debug|x64.ActiveCfg = Debug|x64 - {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Debug|x64.Build.0 = Debug|x64 - {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Debug|x86.ActiveCfg = Debug|Win32 - {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Debug|x86.Build.0 = Debug|Win32 - {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Release|ARM.ActiveCfg = Release|Win32 - {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Release|x64.ActiveCfg = Release|x64 - {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Release|x64.Build.0 = Release|x64 - {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Release|x86.ActiveCfg = Release|Win32 - {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Release|x86.Build.0 = Release|Win32 - {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Debug|ARM.ActiveCfg = Debug|Win32 - {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Debug|x64.ActiveCfg = Debug|x64 - {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Debug|x64.Build.0 = Debug|x64 - {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Debug|x86.ActiveCfg = Debug|Win32 - {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Debug|x86.Build.0 = Debug|Win32 - {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Release|ARM.ActiveCfg = Release|Win32 - {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Release|x64.ActiveCfg = Release|x64 - {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Release|x64.Build.0 = Release|x64 - {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Release|x86.ActiveCfg = Release|Win32 - {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Release|x86.Build.0 = Release|Win32 - {84D2D4D4-0A88-477D-B645-C972EEB97464}.Debug|ARM.ActiveCfg = Debug|x64 - {84D2D4D4-0A88-477D-B645-C972EEB97464}.Debug|x64.ActiveCfg = Debug|x64 - {84D2D4D4-0A88-477D-B645-C972EEB97464}.Debug|x64.Build.0 = Debug|x64 - {84D2D4D4-0A88-477D-B645-C972EEB97464}.Debug|x86.ActiveCfg = Debug|x64 - {84D2D4D4-0A88-477D-B645-C972EEB97464}.Release|ARM.ActiveCfg = Release|x64 - {84D2D4D4-0A88-477D-B645-C972EEB97464}.Release|x64.ActiveCfg = Release|x64 - {84D2D4D4-0A88-477D-B645-C972EEB97464}.Release|x64.Build.0 = Release|x64 - {84D2D4D4-0A88-477D-B645-C972EEB97464}.Release|x86.ActiveCfg = Release|x64 - {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Debug|ARM.ActiveCfg = Debug|x64 - {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Debug|x64.ActiveCfg = Debug|x64 - {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Debug|x64.Build.0 = Debug|x64 - {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Debug|x86.ActiveCfg = Debug|x64 - {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Release|ARM.ActiveCfg = Release|x64 - {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Release|x64.ActiveCfg = Release|x64 - {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Release|x64.Build.0 = Release|x64 - {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Release|x86.ActiveCfg = Release|x64 - {EF5FD437-8033-4645-9977-D07323283556}.Debug|ARM.ActiveCfg = Debug|ARM - {EF5FD437-8033-4645-9977-D07323283556}.Debug|ARM.Build.0 = Debug|ARM - {EF5FD437-8033-4645-9977-D07323283556}.Debug|x64.ActiveCfg = Debug|x64 - {EF5FD437-8033-4645-9977-D07323283556}.Debug|x64.Build.0 = Debug|x64 - {EF5FD437-8033-4645-9977-D07323283556}.Debug|x86.ActiveCfg = Debug|Win32 - {EF5FD437-8033-4645-9977-D07323283556}.Debug|x86.Build.0 = Debug|Win32 - {EF5FD437-8033-4645-9977-D07323283556}.Release|ARM.ActiveCfg = Release|ARM - {EF5FD437-8033-4645-9977-D07323283556}.Release|ARM.Build.0 = Release|ARM - {EF5FD437-8033-4645-9977-D07323283556}.Release|x64.ActiveCfg = Release|x64 - {EF5FD437-8033-4645-9977-D07323283556}.Release|x64.Build.0 = Release|x64 - {EF5FD437-8033-4645-9977-D07323283556}.Release|x86.ActiveCfg = Release|Win32 - {EF5FD437-8033-4645-9977-D07323283556}.Release|x86.Build.0 = Release|Win32 - {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Debug|ARM.ActiveCfg = Debug|ARM - {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Debug|ARM.Build.0 = Debug|ARM - {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Debug|x64.ActiveCfg = Debug|x64 - {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Debug|x64.Build.0 = Debug|x64 - {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Debug|x86.ActiveCfg = Debug|Win32 - {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Debug|x86.Build.0 = Debug|Win32 - {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Release|ARM.ActiveCfg = Release|ARM - {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Release|ARM.Build.0 = Release|ARM - {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Release|x64.ActiveCfg = Release|x64 - {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Release|x64.Build.0 = Release|x64 - {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Release|x86.ActiveCfg = Release|Win32 - {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Release|x86.Build.0 = Release|Win32 - {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Debug|ARM.ActiveCfg = Debug|ARM - {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Debug|ARM.Build.0 = Debug|ARM - {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Debug|x64.ActiveCfg = Debug|x64 - {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Debug|x64.Build.0 = Debug|x64 - {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Debug|x86.ActiveCfg = Debug|Win32 - {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Debug|x86.Build.0 = Debug|Win32 - {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Release|ARM.ActiveCfg = Release|ARM - {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Release|ARM.Build.0 = Release|ARM - {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Release|x64.ActiveCfg = Release|x64 - {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Release|x64.Build.0 = Release|x64 - {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Release|x86.ActiveCfg = Release|Win32 - {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Release|x86.Build.0 = Release|Win32 - {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Debug|ARM.ActiveCfg = Debug|ARM - {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Debug|ARM.Build.0 = Debug|ARM - {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Debug|ARM.Deploy.0 = Debug|ARM - {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Debug|x64.ActiveCfg = Debug|x64 - {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Debug|x64.Build.0 = Debug|x64 - {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Debug|x64.Deploy.0 = Debug|x64 - {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Debug|x86.ActiveCfg = Debug|Win32 - {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Debug|x86.Build.0 = Debug|Win32 - {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Debug|x86.Deploy.0 = Debug|Win32 - {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Release|ARM.ActiveCfg = Release|ARM - {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Release|ARM.Build.0 = Release|ARM - {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Release|ARM.Deploy.0 = Release|ARM - {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Release|x64.ActiveCfg = Release|x64 - {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Release|x64.Build.0 = Release|x64 - {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Release|x64.Deploy.0 = Release|x64 - {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Release|x86.ActiveCfg = Release|Win32 - {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Release|x86.Build.0 = Release|Win32 - {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Release|x86.Deploy.0 = Release|Win32 - {C427C362-4B09-4C3F-8578-F58521328DF0}.Debug|ARM.ActiveCfg = Debug|ARM - {C427C362-4B09-4C3F-8578-F58521328DF0}.Debug|ARM.Build.0 = Debug|ARM - {C427C362-4B09-4C3F-8578-F58521328DF0}.Debug|ARM.Deploy.0 = Debug|ARM - {C427C362-4B09-4C3F-8578-F58521328DF0}.Debug|x64.ActiveCfg = Debug|x64 - {C427C362-4B09-4C3F-8578-F58521328DF0}.Debug|x64.Build.0 = Debug|x64 - {C427C362-4B09-4C3F-8578-F58521328DF0}.Debug|x64.Deploy.0 = Debug|x64 - {C427C362-4B09-4C3F-8578-F58521328DF0}.Debug|x86.ActiveCfg = Debug|Win32 - {C427C362-4B09-4C3F-8578-F58521328DF0}.Debug|x86.Build.0 = Debug|Win32 - {C427C362-4B09-4C3F-8578-F58521328DF0}.Debug|x86.Deploy.0 = Debug|Win32 - {C427C362-4B09-4C3F-8578-F58521328DF0}.Release|ARM.ActiveCfg = Release|ARM - {C427C362-4B09-4C3F-8578-F58521328DF0}.Release|ARM.Build.0 = Release|ARM - {C427C362-4B09-4C3F-8578-F58521328DF0}.Release|ARM.Deploy.0 = Release|ARM - {C427C362-4B09-4C3F-8578-F58521328DF0}.Release|x64.ActiveCfg = Release|x64 - {C427C362-4B09-4C3F-8578-F58521328DF0}.Release|x64.Build.0 = Release|x64 - {C427C362-4B09-4C3F-8578-F58521328DF0}.Release|x64.Deploy.0 = Release|x64 - {C427C362-4B09-4C3F-8578-F58521328DF0}.Release|x86.ActiveCfg = Release|Win32 - {C427C362-4B09-4C3F-8578-F58521328DF0}.Release|x86.Build.0 = Release|Win32 - {C427C362-4B09-4C3F-8578-F58521328DF0}.Release|x86.Deploy.0 = Release|Win32 - {A751BAC6-864F-4500-B261-B88A465C7F89}.Debug|ARM.ActiveCfg = Debug|ARM - {A751BAC6-864F-4500-B261-B88A465C7F89}.Debug|ARM.Build.0 = Debug|ARM - {A751BAC6-864F-4500-B261-B88A465C7F89}.Debug|ARM.Deploy.0 = Debug|ARM - {A751BAC6-864F-4500-B261-B88A465C7F89}.Debug|x64.ActiveCfg = Debug|x64 - {A751BAC6-864F-4500-B261-B88A465C7F89}.Debug|x64.Build.0 = Debug|x64 - {A751BAC6-864F-4500-B261-B88A465C7F89}.Debug|x64.Deploy.0 = Debug|x64 - {A751BAC6-864F-4500-B261-B88A465C7F89}.Debug|x86.ActiveCfg = Debug|Win32 - {A751BAC6-864F-4500-B261-B88A465C7F89}.Debug|x86.Build.0 = Debug|Win32 - {A751BAC6-864F-4500-B261-B88A465C7F89}.Debug|x86.Deploy.0 = Debug|Win32 - {A751BAC6-864F-4500-B261-B88A465C7F89}.Release|ARM.ActiveCfg = Release|ARM - {A751BAC6-864F-4500-B261-B88A465C7F89}.Release|ARM.Build.0 = Release|ARM - {A751BAC6-864F-4500-B261-B88A465C7F89}.Release|ARM.Deploy.0 = Release|ARM - {A751BAC6-864F-4500-B261-B88A465C7F89}.Release|x64.ActiveCfg = Release|x64 - {A751BAC6-864F-4500-B261-B88A465C7F89}.Release|x64.Build.0 = Release|x64 - {A751BAC6-864F-4500-B261-B88A465C7F89}.Release|x64.Deploy.0 = Release|x64 - {A751BAC6-864F-4500-B261-B88A465C7F89}.Release|x86.ActiveCfg = Release|Win32 - {A751BAC6-864F-4500-B261-B88A465C7F89}.Release|x86.Build.0 = Release|Win32 - {A751BAC6-864F-4500-B261-B88A465C7F89}.Release|x86.Deploy.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {A657480D-D083-4C31-B499-42FF50481AC1} = {8E00B911-43B2-49D5-9B4A-AB6E1ED097A1} - {B288E7DC-4F10-4432-8CB9-2061400F4E0C} = {8E00B911-43B2-49D5-9B4A-AB6E1ED097A1} - {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8} = {8E00B911-43B2-49D5-9B4A-AB6E1ED097A1} - {EE86AB66-09DF-45EB-A42A-ED426AF3266E} = {8E00B911-43B2-49D5-9B4A-AB6E1ED097A1} - {6ADF3A4B-1E22-41BA-9293-96593E6A45BE} = {8E00B911-43B2-49D5-9B4A-AB6E1ED097A1} - {4913E097-136E-4BC4-BF8C-D3341FB1425A} = {8E00B911-43B2-49D5-9B4A-AB6E1ED097A1} - {84D2D4D4-0A88-477D-B645-C972EEB97464} = {81644728-0859-4738-A153-9130F614BE9F} - {78B91DF7-B30D-4479-BEBC-795C8617DC55} = {81644728-0859-4738-A153-9130F614BE9F} - {EF5FD437-8033-4645-9977-D07323283556} = {81644728-0859-4738-A153-9130F614BE9F} - {B650C884-6640-4FEE-9C5B-62E4D84D9E0F} = {EE86AB66-09DF-45EB-A42A-ED426AF3266E} - {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C} = {EE86AB66-09DF-45EB-A42A-ED426AF3266E} - {C427C362-4B09-4C3F-8578-F58521328DF0} = {EE86AB66-09DF-45EB-A42A-ED426AF3266E} - {A751BAC6-864F-4500-B261-B88A465C7F89} = {81644728-0859-4738-A153-9130F614BE9F} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - VisualSVNWorkingCopyRoot = . - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Express 14 for Windows Desktop +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "3FD", "3FD\3FD.vcxproj", "{CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTests", "UnitTests\UnitTests.vcxproj", "{A657480D-D083-4C31-B499-42FF50481AC1}" + ProjectSection(ProjectDependencies) = postProject + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8} = {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8} + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B} = {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IntegrationTests", "IntegrationTests\IntegrationTests.vcxproj", "{B288E7DC-4F10-4432-8CB9-2061400F4E0C}" + ProjectSection(ProjectDependencies) = postProject + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B} = {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest-md", "gtest\msvc\gtest-md.vcxproj", "{C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Testing", "Testing", "{8E00B911-43B2-49D5-9B4A-AB6E1ED097A1}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WinRT", "WinRT", "{EE86AB66-09DF-45EB-A42A-ED426AF3266E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestRpcClient", "TestRpcClient\TestRpcClient.vcxproj", "{6ADF3A4B-1E22-41BA-9293-96593E6A45BE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestWwsClient", "TestWwsClient\TestWwsClient.vcxproj", "{4913E097-136E-4BC4-BF8C-D3341FB1425A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VideoTranscoder", "VideoTranscoder\VideoTranscoder.vcxproj", "{84D2D4D4-0A88-477D-B645-C972EEB97464}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Real Applications", "Real Applications", "{81644728-0859-4738-A153-9130F614BE9F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageTranscoder", "ImageTranscoder\ImageTranscoder.vcxproj", "{78B91DF7-B30D-4479-BEBC-795C8617DC55}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyImagingComsWinRT", "ImageTranscoder\MyImagingComsWinRT.vcxproj", "{EF5FD437-8033-4645-9977-D07323283556}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "3FD.WinRT.UWP", "3FD\3FD.WinRT.UWP.vcxproj", "{793AC4E5-04FF-43C1-89F9-6D7212264A36}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest.WinRT.UWP", "gtest\WinRT.UWP\gtest.WinRT.UWP.vcxproj", "{B650C884-6640-4FEE-9C5B-62E4D84D9E0F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTestsApp.WinRT.UWP", "UnitTests\WinRT.UWP\UnitTestsApp.WinRT.UWP.vcxproj", "{AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IntegrationTestsApp.WinRT.UWP", "IntegrationTests\WinRT.UWP\IntegrationTestsApp.WinRT.UWP.vcxproj", "{C427C362-4B09-4C3F-8578-F58521328DF0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageTranscoderApp", "ImageTranscoderApp\ImageTranscoderApp.vcxproj", "{A751BAC6-864F-4500-B261-B88A465C7F89}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug_XP|ARM = Debug_XP|ARM + Debug_XP|x64 = Debug_XP|x64 + Debug_XP|x86 = Debug_XP|x86 + Debug|ARM = Debug|ARM + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release_XP|ARM = Release_XP|ARM + Release_XP|x64 = Release_XP|x64 + Release_XP|x86 = Release_XP|x86 + Release|ARM = Release|ARM + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Debug_XP|ARM.ActiveCfg = Debug_XP|Win32 + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Debug_XP|x64.ActiveCfg = Debug_XP|x64 + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Debug_XP|x64.Build.0 = Debug_XP|x64 + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Debug_XP|x86.ActiveCfg = Debug_XP|Win32 + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Debug_XP|x86.Build.0 = Debug_XP|Win32 + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Debug|ARM.ActiveCfg = Debug|Win32 + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Debug|x64.ActiveCfg = Debug|x64 + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Debug|x64.Build.0 = Debug|x64 + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Debug|x86.ActiveCfg = Debug|Win32 + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Debug|x86.Build.0 = Debug|Win32 + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Release_XP|ARM.ActiveCfg = Release_XP|Win32 + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Release_XP|x64.ActiveCfg = Release_XP|x64 + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Release_XP|x64.Build.0 = Release_XP|x64 + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Release_XP|x86.ActiveCfg = Release_XP|Win32 + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Release_XP|x86.Build.0 = Release_XP|Win32 + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Release|ARM.ActiveCfg = Release|Win32 + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Release|x64.ActiveCfg = Release|x64 + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Release|x64.Build.0 = Release|x64 + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Release|x86.ActiveCfg = Release|Win32 + {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B}.Release|x86.Build.0 = Release|Win32 + {A657480D-D083-4C31-B499-42FF50481AC1}.Debug_XP|ARM.ActiveCfg = Debug_XP|Win32 + {A657480D-D083-4C31-B499-42FF50481AC1}.Debug_XP|x64.ActiveCfg = Debug_XP|x64 + {A657480D-D083-4C31-B499-42FF50481AC1}.Debug_XP|x64.Build.0 = Debug_XP|x64 + {A657480D-D083-4C31-B499-42FF50481AC1}.Debug_XP|x86.ActiveCfg = Debug_XP|Win32 + {A657480D-D083-4C31-B499-42FF50481AC1}.Debug_XP|x86.Build.0 = Debug_XP|Win32 + {A657480D-D083-4C31-B499-42FF50481AC1}.Debug|ARM.ActiveCfg = Debug|Win32 + {A657480D-D083-4C31-B499-42FF50481AC1}.Debug|x64.ActiveCfg = Debug|x64 + {A657480D-D083-4C31-B499-42FF50481AC1}.Debug|x64.Build.0 = Debug|x64 + {A657480D-D083-4C31-B499-42FF50481AC1}.Debug|x86.ActiveCfg = Debug|Win32 + {A657480D-D083-4C31-B499-42FF50481AC1}.Debug|x86.Build.0 = Debug|Win32 + {A657480D-D083-4C31-B499-42FF50481AC1}.Release_XP|ARM.ActiveCfg = Release_XP|Win32 + {A657480D-D083-4C31-B499-42FF50481AC1}.Release_XP|x64.ActiveCfg = Release_XP|x64 + {A657480D-D083-4C31-B499-42FF50481AC1}.Release_XP|x64.Build.0 = Release_XP|x64 + {A657480D-D083-4C31-B499-42FF50481AC1}.Release_XP|x86.ActiveCfg = Release_XP|Win32 + {A657480D-D083-4C31-B499-42FF50481AC1}.Release_XP|x86.Build.0 = Release_XP|Win32 + {A657480D-D083-4C31-B499-42FF50481AC1}.Release|ARM.ActiveCfg = Release|Win32 + {A657480D-D083-4C31-B499-42FF50481AC1}.Release|x64.ActiveCfg = Release|x64 + {A657480D-D083-4C31-B499-42FF50481AC1}.Release|x64.Build.0 = Release|x64 + {A657480D-D083-4C31-B499-42FF50481AC1}.Release|x86.ActiveCfg = Release|Win32 + {A657480D-D083-4C31-B499-42FF50481AC1}.Release|x86.Build.0 = Release|Win32 + {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Debug_XP|ARM.ActiveCfg = Debug_XP|Win32 + {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Debug_XP|x64.ActiveCfg = Debug_XP|x64 + {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Debug_XP|x64.Build.0 = Debug_XP|x64 + {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Debug_XP|x86.ActiveCfg = Debug_XP|Win32 + {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Debug_XP|x86.Build.0 = Debug_XP|Win32 + {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Debug|ARM.ActiveCfg = Debug|Win32 + {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Debug|x64.ActiveCfg = Debug|x64 + {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Debug|x64.Build.0 = Debug|x64 + {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Debug|x86.ActiveCfg = Debug|Win32 + {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Debug|x86.Build.0 = Debug|Win32 + {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Release_XP|ARM.ActiveCfg = Release_XP|Win32 + {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Release_XP|x64.ActiveCfg = Release_XP|x64 + {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Release_XP|x64.Build.0 = Release_XP|x64 + {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Release_XP|x86.ActiveCfg = Release_XP|Win32 + {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Release_XP|x86.Build.0 = Release_XP|Win32 + {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Release|ARM.ActiveCfg = Release|Win32 + {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Release|x64.ActiveCfg = Release|x64 + {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Release|x64.Build.0 = Release|x64 + {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Release|x86.ActiveCfg = Release|Win32 + {B288E7DC-4F10-4432-8CB9-2061400F4E0C}.Release|x86.Build.0 = Release|Win32 + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug_XP|ARM.ActiveCfg = Debug_XP|Win32 + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug_XP|x64.ActiveCfg = Debug_XP|x64 + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug_XP|x64.Build.0 = Debug_XP|x64 + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug_XP|x86.ActiveCfg = Debug_XP|Win32 + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug_XP|x86.Build.0 = Debug_XP|Win32 + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug|ARM.ActiveCfg = Debug|Win32 + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug|x64.ActiveCfg = Debug|x64 + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug|x64.Build.0 = Debug|x64 + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug|x86.ActiveCfg = Debug|Win32 + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Debug|x86.Build.0 = Debug|Win32 + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release_XP|ARM.ActiveCfg = Release_XP|Win32 + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release_XP|x64.ActiveCfg = Release_XP|x64 + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release_XP|x64.Build.0 = Release_XP|x64 + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release_XP|x86.ActiveCfg = Release_XP|Win32 + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release_XP|x86.Build.0 = Release_XP|Win32 + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release|ARM.ActiveCfg = Release|Win32 + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release|x64.ActiveCfg = Release|x64 + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release|x64.Build.0 = Release|x64 + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release|x86.ActiveCfg = Release|Win32 + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8}.Release|x86.Build.0 = Release|Win32 + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Debug_XP|ARM.ActiveCfg = Debug_XP|Win32 + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Debug_XP|x64.ActiveCfg = Debug_XP|x64 + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Debug_XP|x64.Build.0 = Debug_XP|x64 + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Debug_XP|x86.ActiveCfg = Debug_XP|Win32 + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Debug_XP|x86.Build.0 = Debug_XP|Win32 + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Debug|ARM.ActiveCfg = Debug|Win32 + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Debug|x64.ActiveCfg = Debug|x64 + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Debug|x64.Build.0 = Debug|x64 + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Debug|x86.ActiveCfg = Debug|Win32 + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Debug|x86.Build.0 = Debug|Win32 + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Release_XP|ARM.ActiveCfg = Release_XP|Win32 + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Release_XP|x64.ActiveCfg = Release_XP|x64 + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Release_XP|x64.Build.0 = Release_XP|x64 + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Release_XP|x86.ActiveCfg = Release_XP|Win32 + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Release_XP|x86.Build.0 = Release_XP|Win32 + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Release|ARM.ActiveCfg = Release|Win32 + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Release|x64.ActiveCfg = Release|x64 + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Release|x64.Build.0 = Release|x64 + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Release|x86.ActiveCfg = Release|Win32 + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE}.Release|x86.Build.0 = Release|Win32 + {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Debug_XP|ARM.ActiveCfg = Debug_XP|Win32 + {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Debug_XP|x64.ActiveCfg = Debug_XP|x64 + {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Debug_XP|x64.Build.0 = Debug_XP|x64 + {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Debug_XP|x86.ActiveCfg = Debug_XP|Win32 + {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Debug_XP|x86.Build.0 = Debug_XP|Win32 + {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Debug|ARM.ActiveCfg = Debug|Win32 + {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Debug|x64.ActiveCfg = Debug|x64 + {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Debug|x64.Build.0 = Debug|x64 + {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Debug|x86.ActiveCfg = Debug|Win32 + {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Debug|x86.Build.0 = Debug|Win32 + {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Release_XP|ARM.ActiveCfg = Release_XP|Win32 + {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Release_XP|x64.ActiveCfg = Release_XP|x64 + {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Release_XP|x64.Build.0 = Release_XP|x64 + {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Release_XP|x86.ActiveCfg = Release_XP|Win32 + {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Release_XP|x86.Build.0 = Release_XP|Win32 + {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Release|ARM.ActiveCfg = Release|Win32 + {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Release|x64.ActiveCfg = Release|x64 + {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Release|x64.Build.0 = Release|x64 + {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Release|x86.ActiveCfg = Release|Win32 + {4913E097-136E-4BC4-BF8C-D3341FB1425A}.Release|x86.Build.0 = Release|Win32 + {84D2D4D4-0A88-477D-B645-C972EEB97464}.Debug_XP|ARM.ActiveCfg = Release|x64 + {84D2D4D4-0A88-477D-B645-C972EEB97464}.Debug_XP|x64.ActiveCfg = Release|x64 + {84D2D4D4-0A88-477D-B645-C972EEB97464}.Debug_XP|x86.ActiveCfg = Release|x64 + {84D2D4D4-0A88-477D-B645-C972EEB97464}.Debug|ARM.ActiveCfg = Debug|x64 + {84D2D4D4-0A88-477D-B645-C972EEB97464}.Debug|x64.ActiveCfg = Debug|x64 + {84D2D4D4-0A88-477D-B645-C972EEB97464}.Debug|x64.Build.0 = Debug|x64 + {84D2D4D4-0A88-477D-B645-C972EEB97464}.Debug|x86.ActiveCfg = Debug|x64 + {84D2D4D4-0A88-477D-B645-C972EEB97464}.Release_XP|ARM.ActiveCfg = Release|x64 + {84D2D4D4-0A88-477D-B645-C972EEB97464}.Release_XP|x64.ActiveCfg = Release|x64 + {84D2D4D4-0A88-477D-B645-C972EEB97464}.Release_XP|x86.ActiveCfg = Release|x64 + {84D2D4D4-0A88-477D-B645-C972EEB97464}.Release|ARM.ActiveCfg = Release|x64 + {84D2D4D4-0A88-477D-B645-C972EEB97464}.Release|x64.ActiveCfg = Release|x64 + {84D2D4D4-0A88-477D-B645-C972EEB97464}.Release|x64.Build.0 = Release|x64 + {84D2D4D4-0A88-477D-B645-C972EEB97464}.Release|x86.ActiveCfg = Release|x64 + {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Debug_XP|ARM.ActiveCfg = Release|x64 + {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Debug_XP|x64.ActiveCfg = Release|x64 + {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Debug_XP|x86.ActiveCfg = Release|x64 + {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Debug|ARM.ActiveCfg = Debug|x64 + {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Debug|x64.ActiveCfg = Debug|x64 + {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Debug|x64.Build.0 = Debug|x64 + {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Debug|x86.ActiveCfg = Debug|x64 + {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Release_XP|ARM.ActiveCfg = Release|x64 + {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Release_XP|x64.ActiveCfg = Release|x64 + {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Release_XP|x86.ActiveCfg = Release|x64 + {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Release|ARM.ActiveCfg = Release|x64 + {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Release|x64.ActiveCfg = Release|x64 + {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Release|x64.Build.0 = Release|x64 + {78B91DF7-B30D-4479-BEBC-795C8617DC55}.Release|x86.ActiveCfg = Release|x64 + {EF5FD437-8033-4645-9977-D07323283556}.Debug_XP|ARM.ActiveCfg = Debug|ARM + {EF5FD437-8033-4645-9977-D07323283556}.Debug_XP|x64.ActiveCfg = Debug|x64 + {EF5FD437-8033-4645-9977-D07323283556}.Debug_XP|x86.ActiveCfg = Debug|Win32 + {EF5FD437-8033-4645-9977-D07323283556}.Debug|ARM.ActiveCfg = Debug|ARM + {EF5FD437-8033-4645-9977-D07323283556}.Debug|ARM.Build.0 = Debug|ARM + {EF5FD437-8033-4645-9977-D07323283556}.Debug|x64.ActiveCfg = Debug|x64 + {EF5FD437-8033-4645-9977-D07323283556}.Debug|x64.Build.0 = Debug|x64 + {EF5FD437-8033-4645-9977-D07323283556}.Debug|x86.ActiveCfg = Debug|Win32 + {EF5FD437-8033-4645-9977-D07323283556}.Debug|x86.Build.0 = Debug|Win32 + {EF5FD437-8033-4645-9977-D07323283556}.Release_XP|ARM.ActiveCfg = Release|ARM + {EF5FD437-8033-4645-9977-D07323283556}.Release_XP|x64.ActiveCfg = Release|x64 + {EF5FD437-8033-4645-9977-D07323283556}.Release_XP|x86.ActiveCfg = Release|Win32 + {EF5FD437-8033-4645-9977-D07323283556}.Release|ARM.ActiveCfg = Release|ARM + {EF5FD437-8033-4645-9977-D07323283556}.Release|ARM.Build.0 = Release|ARM + {EF5FD437-8033-4645-9977-D07323283556}.Release|x64.ActiveCfg = Release|x64 + {EF5FD437-8033-4645-9977-D07323283556}.Release|x64.Build.0 = Release|x64 + {EF5FD437-8033-4645-9977-D07323283556}.Release|x86.ActiveCfg = Release|Win32 + {EF5FD437-8033-4645-9977-D07323283556}.Release|x86.Build.0 = Release|Win32 + {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Debug_XP|ARM.ActiveCfg = Debug|ARM + {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Debug_XP|x64.ActiveCfg = Debug|x64 + {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Debug_XP|x86.ActiveCfg = Debug|Win32 + {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Debug|ARM.ActiveCfg = Debug|ARM + {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Debug|ARM.Build.0 = Debug|ARM + {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Debug|x64.ActiveCfg = Debug|x64 + {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Debug|x64.Build.0 = Debug|x64 + {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Debug|x86.ActiveCfg = Debug|Win32 + {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Debug|x86.Build.0 = Debug|Win32 + {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Release_XP|ARM.ActiveCfg = Release|ARM + {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Release_XP|x64.ActiveCfg = Release|x64 + {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Release_XP|x86.ActiveCfg = Release|Win32 + {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Release|ARM.ActiveCfg = Release|ARM + {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Release|ARM.Build.0 = Release|ARM + {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Release|x64.ActiveCfg = Release|x64 + {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Release|x64.Build.0 = Release|x64 + {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Release|x86.ActiveCfg = Release|Win32 + {793AC4E5-04FF-43C1-89F9-6D7212264A36}.Release|x86.Build.0 = Release|Win32 + {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Debug_XP|ARM.ActiveCfg = Debug|ARM + {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Debug_XP|x64.ActiveCfg = Debug|x64 + {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Debug_XP|x86.ActiveCfg = Debug|Win32 + {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Debug|ARM.ActiveCfg = Debug|ARM + {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Debug|ARM.Build.0 = Debug|ARM + {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Debug|x64.ActiveCfg = Debug|x64 + {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Debug|x64.Build.0 = Debug|x64 + {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Debug|x86.ActiveCfg = Debug|Win32 + {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Debug|x86.Build.0 = Debug|Win32 + {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Release_XP|ARM.ActiveCfg = Release|ARM + {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Release_XP|x64.ActiveCfg = Release|x64 + {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Release_XP|x86.ActiveCfg = Release|Win32 + {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Release|ARM.ActiveCfg = Release|ARM + {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Release|ARM.Build.0 = Release|ARM + {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Release|x64.ActiveCfg = Release|x64 + {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Release|x64.Build.0 = Release|x64 + {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Release|x86.ActiveCfg = Release|Win32 + {B650C884-6640-4FEE-9C5B-62E4D84D9E0F}.Release|x86.Build.0 = Release|Win32 + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Debug_XP|ARM.ActiveCfg = Debug|ARM + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Debug_XP|x64.ActiveCfg = Debug|x64 + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Debug_XP|x86.ActiveCfg = Debug|Win32 + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Debug|ARM.ActiveCfg = Debug|ARM + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Debug|ARM.Build.0 = Debug|ARM + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Debug|ARM.Deploy.0 = Debug|ARM + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Debug|x64.ActiveCfg = Debug|x64 + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Debug|x64.Build.0 = Debug|x64 + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Debug|x86.ActiveCfg = Debug|Win32 + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Debug|x86.Build.0 = Debug|Win32 + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Release_XP|ARM.ActiveCfg = Release|ARM + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Release_XP|x64.ActiveCfg = Release|x64 + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Release_XP|x86.ActiveCfg = Release|Win32 + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Release|ARM.ActiveCfg = Release|ARM + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Release|ARM.Build.0 = Release|ARM + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Release|ARM.Deploy.0 = Release|ARM + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Release|x64.ActiveCfg = Release|x64 + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Release|x64.Build.0 = Release|x64 + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Release|x64.Deploy.0 = Release|x64 + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Release|x86.ActiveCfg = Release|Win32 + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C}.Release|x86.Build.0 = Release|Win32 + {C427C362-4B09-4C3F-8578-F58521328DF0}.Debug_XP|ARM.ActiveCfg = Debug|ARM + {C427C362-4B09-4C3F-8578-F58521328DF0}.Debug_XP|x64.ActiveCfg = Debug|x64 + {C427C362-4B09-4C3F-8578-F58521328DF0}.Debug_XP|x86.ActiveCfg = Debug|Win32 + {C427C362-4B09-4C3F-8578-F58521328DF0}.Debug|ARM.ActiveCfg = Debug|ARM + {C427C362-4B09-4C3F-8578-F58521328DF0}.Debug|ARM.Build.0 = Debug|ARM + {C427C362-4B09-4C3F-8578-F58521328DF0}.Debug|ARM.Deploy.0 = Debug|ARM + {C427C362-4B09-4C3F-8578-F58521328DF0}.Debug|x64.ActiveCfg = Debug|x64 + {C427C362-4B09-4C3F-8578-F58521328DF0}.Debug|x64.Build.0 = Debug|x64 + {C427C362-4B09-4C3F-8578-F58521328DF0}.Debug|x86.ActiveCfg = Debug|Win32 + {C427C362-4B09-4C3F-8578-F58521328DF0}.Debug|x86.Build.0 = Debug|Win32 + {C427C362-4B09-4C3F-8578-F58521328DF0}.Release_XP|ARM.ActiveCfg = Release|ARM + {C427C362-4B09-4C3F-8578-F58521328DF0}.Release_XP|x64.ActiveCfg = Release|x64 + {C427C362-4B09-4C3F-8578-F58521328DF0}.Release_XP|x86.ActiveCfg = Release|Win32 + {C427C362-4B09-4C3F-8578-F58521328DF0}.Release|ARM.ActiveCfg = Release|ARM + {C427C362-4B09-4C3F-8578-F58521328DF0}.Release|ARM.Build.0 = Release|ARM + {C427C362-4B09-4C3F-8578-F58521328DF0}.Release|ARM.Deploy.0 = Release|ARM + {C427C362-4B09-4C3F-8578-F58521328DF0}.Release|x64.ActiveCfg = Release|x64 + {C427C362-4B09-4C3F-8578-F58521328DF0}.Release|x64.Build.0 = Release|x64 + {C427C362-4B09-4C3F-8578-F58521328DF0}.Release|x64.Deploy.0 = Release|x64 + {C427C362-4B09-4C3F-8578-F58521328DF0}.Release|x86.ActiveCfg = Release|Win32 + {C427C362-4B09-4C3F-8578-F58521328DF0}.Release|x86.Build.0 = Release|Win32 + {A751BAC6-864F-4500-B261-B88A465C7F89}.Debug_XP|ARM.ActiveCfg = Debug|ARM + {A751BAC6-864F-4500-B261-B88A465C7F89}.Debug_XP|x64.ActiveCfg = Debug|x64 + {A751BAC6-864F-4500-B261-B88A465C7F89}.Debug_XP|x86.ActiveCfg = Debug|Win32 + {A751BAC6-864F-4500-B261-B88A465C7F89}.Debug|ARM.ActiveCfg = Debug|ARM + {A751BAC6-864F-4500-B261-B88A465C7F89}.Debug|ARM.Build.0 = Debug|ARM + {A751BAC6-864F-4500-B261-B88A465C7F89}.Debug|ARM.Deploy.0 = Debug|ARM + {A751BAC6-864F-4500-B261-B88A465C7F89}.Debug|x64.ActiveCfg = Debug|x64 + {A751BAC6-864F-4500-B261-B88A465C7F89}.Debug|x64.Build.0 = Debug|x64 + {A751BAC6-864F-4500-B261-B88A465C7F89}.Debug|x86.ActiveCfg = Debug|Win32 + {A751BAC6-864F-4500-B261-B88A465C7F89}.Debug|x86.Build.0 = Debug|Win32 + {A751BAC6-864F-4500-B261-B88A465C7F89}.Release_XP|ARM.ActiveCfg = Release|ARM + {A751BAC6-864F-4500-B261-B88A465C7F89}.Release_XP|x64.ActiveCfg = Release|x64 + {A751BAC6-864F-4500-B261-B88A465C7F89}.Release_XP|x86.ActiveCfg = Release|Win32 + {A751BAC6-864F-4500-B261-B88A465C7F89}.Release|ARM.ActiveCfg = Release|ARM + {A751BAC6-864F-4500-B261-B88A465C7F89}.Release|ARM.Build.0 = Release|ARM + {A751BAC6-864F-4500-B261-B88A465C7F89}.Release|ARM.Deploy.0 = Release|ARM + {A751BAC6-864F-4500-B261-B88A465C7F89}.Release|x64.ActiveCfg = Release|x64 + {A751BAC6-864F-4500-B261-B88A465C7F89}.Release|x64.Build.0 = Release|x64 + {A751BAC6-864F-4500-B261-B88A465C7F89}.Release|x64.Deploy.0 = Release|x64 + {A751BAC6-864F-4500-B261-B88A465C7F89}.Release|x86.ActiveCfg = Release|Win32 + {A751BAC6-864F-4500-B261-B88A465C7F89}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {A657480D-D083-4C31-B499-42FF50481AC1} = {8E00B911-43B2-49D5-9B4A-AB6E1ED097A1} + {B288E7DC-4F10-4432-8CB9-2061400F4E0C} = {8E00B911-43B2-49D5-9B4A-AB6E1ED097A1} + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8} = {8E00B911-43B2-49D5-9B4A-AB6E1ED097A1} + {EE86AB66-09DF-45EB-A42A-ED426AF3266E} = {8E00B911-43B2-49D5-9B4A-AB6E1ED097A1} + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE} = {8E00B911-43B2-49D5-9B4A-AB6E1ED097A1} + {4913E097-136E-4BC4-BF8C-D3341FB1425A} = {8E00B911-43B2-49D5-9B4A-AB6E1ED097A1} + {84D2D4D4-0A88-477D-B645-C972EEB97464} = {81644728-0859-4738-A153-9130F614BE9F} + {78B91DF7-B30D-4479-BEBC-795C8617DC55} = {81644728-0859-4738-A153-9130F614BE9F} + {EF5FD437-8033-4645-9977-D07323283556} = {81644728-0859-4738-A153-9130F614BE9F} + {B650C884-6640-4FEE-9C5B-62E4D84D9E0F} = {EE86AB66-09DF-45EB-A42A-ED426AF3266E} + {AD508BAA-0192-4EDB-B1F5-23DC9CC2EC0C} = {EE86AB66-09DF-45EB-A42A-ED426AF3266E} + {C427C362-4B09-4C3F-8578-F58521328DF0} = {EE86AB66-09DF-45EB-A42A-ED426AF3266E} + {A751BAC6-864F-4500-B261-B88A465C7F89} = {81644728-0859-4738-A153-9130F614BE9F} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + VisualSVNWorkingCopyRoot = . + EndGlobalSection +EndGlobal diff --git a/3FD/3FD.WinRT.UWP.vcxproj b/3FD/3FD.WinRT.UWP.vcxproj index c6cf7bb..2fd3aa6 100644 --- a/3FD/3FD.WinRT.UWP.vcxproj +++ b/3FD/3FD.WinRT.UWP.vcxproj @@ -188,34 +188,34 @@ false - $(BOOST_HOME)\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(BOOST_HOME)\include;$(VC_IncludePath);$(WindowsSDK_IncludePath) $(Platform)\$(Configuration)\WinRT.UWP\ $(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)\ false - $(BOOST_HOME)\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(BOOST_HOME)\include;$(VC_IncludePath);$(WindowsSDK_IncludePath) $(Platform)\$(Configuration)\WinRT.UWP\ $(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)\ false - $(BOOST_HOME)\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(BOOST_HOME)\include;$(VC_IncludePath);$(WindowsSDK_IncludePath) $(Platform)\$(Configuration)\WinRT.UWP\ false - $(BOOST_HOME)\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(BOOST_HOME)\include;$(VC_IncludePath);$(WindowsSDK_IncludePath) $(Platform)\$(Configuration)\WinRT.UWP\ false - $(BOOST_HOME)\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(BOOST_HOME)\include;$(VC_IncludePath);$(WindowsSDK_IncludePath) $(Platform)\$(Configuration)\WinRT.UWP\ false - $(BOOST_HOME)\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(BOOST_HOME)\include;$(VC_IncludePath);$(WindowsSDK_IncludePath) $(Platform)\$(Configuration)\WinRT.UWP\ diff --git a/3FD/3FD.vcxproj b/3FD/3FD.vcxproj index ad9f410..0510446 100644 --- a/3FD/3FD.vcxproj +++ b/3FD/3FD.vcxproj @@ -1,9 +1,13 @@  - - Debug - ARM + + Debug_XP + Win32 + + + Debug_XP + x64 Debug @@ -13,9 +17,13 @@ Debug x64 - - Release - ARM + + Release_XP + Win32 + + + Release_XP + x64 Release @@ -30,6 +38,7 @@ {CCC4A0A2-15FD-4A6E-AC6C-094AAAAEC80B} Win32Proj My3FD + 8.1 @@ -38,10 +47,10 @@ v140 Unicode - + StaticLibrary true - v140 + v140_xp Unicode @@ -50,6 +59,12 @@ v140 Unicode + + StaticLibrary + true + v140_xp + Unicode + StaticLibrary false @@ -57,10 +72,10 @@ true Unicode - + StaticLibrary false - v140 + v140_xp true Unicode @@ -71,27 +86,40 @@ true Unicode + + StaticLibrary + false + v140_xp + true + Unicode + - + + + + - + + + + 433ab66f @@ -100,7 +128,7 @@ $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;$(POCO_ROOT)\Data\include;$(POCO_ROOT)\Data\ODBC\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) $(BOOST_HOME)\lib\x64;$(LibraryPath) - + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;$(POCO_ROOT)\Data\include;$(POCO_ROOT)\Data\ODBC\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) $(BOOST_HOME)\lib\x64;$(LibraryPath) @@ -110,11 +138,17 @@ $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ + + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;$(POCO_ROOT)\Data\include;$(POCO_ROOT)\Data\ODBC\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + $(BOOST_HOME)\lib\Win32;$(LibraryPath) + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;$(POCO_ROOT)\Data\include;$(POCO_ROOT)\Data\ODBC\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) $(BOOST_HOME)\lib\x64;$(LibraryPath) - + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;$(POCO_ROOT)\Data\include;$(POCO_ROOT)\Data\ODBC\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) $(BOOST_HOME)\lib\x64;$(LibraryPath) @@ -124,6 +158,12 @@ $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ + + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;$(POCO_ROOT)\Data\include;$(POCO_ROOT)\Data\ODBC\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + $(BOOST_HOME)\lib\Win32;$(LibraryPath) + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + Use @@ -143,7 +183,7 @@ esent.lib;WebServices.lib;Rpcrt4.lib;Ntdsapi.lib;Secur32.lib;Crypt32.lib;runtimeobject.lib;%(AdditionalDependencies) - + Use Level3 @@ -159,7 +199,7 @@ true - esent.lib;WebServices.lib;Rpcrt4.lib;Ntdsapi.lib;Secur32.lib;Crypt32.lib;runtimeobject.lib;%(AdditionalDependencies) + esent.lib;WebServices.lib;Rpcrt4.lib;Ntdsapi.lib;Secur32.lib;Crypt32.lib;%(AdditionalDependencies) @@ -181,6 +221,25 @@ esent.lib;WebServices.lib;Rpcrt4.lib;Ntdsapi.lib;Secur32.lib;Crypt32.lib;runtimeobject.lib;%(AdditionalDependencies) + + + Use + Level3 + Disabled + ENABLE_3FD_CST;ENABLE_3FD_ERR_IMPL_DETAILS;SQLITE_OMIT_DEPRECATED;SQLITE_OMIT_LOAD_EXTENSION;SQLITE_DEFAULT_FOREIGN_KEYS=1;_ENABLE_ATOMIC_ALIGNMENT_FIX;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;SECURITY_WIN32;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);%(PreprocessorDefinitions);%(PreprocessorDefinitions) + true + $(ProjectDir)\..\btree;$(ProjectDir)\..\OpenCL;%(AdditionalIncludeDirectories) + /D POCO_STATIC %(AdditionalOptions) + 4267 + + + Windows + true + + + esent.lib;WebServices.lib;Rpcrt4.lib;Ntdsapi.lib;Secur32.lib;Crypt32.lib;%(AdditionalDependencies) + + Level3 @@ -205,7 +264,7 @@ esent.lib;WebServices.lib;Rpcrt4.lib;Ntdsapi.lib;Secur32.lib;Crypt32.lib;runtimeobject.lib;%(AdditionalDependencies) - + Level3 Use @@ -215,7 +274,7 @@ ENABLE_3FD_CST;ENABLE_3FD_ERR_IMPL_DETAILS;SQLITE_OMIT_DEPRECATED;SQLITE_OMIT_LOAD_EXTENSION;SQLITE_DEFAULT_FOREIGN_KEYS=1;_ENABLE_ATOMIC_ALIGNMENT_FIX;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;SECURITY_WIN32;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);%(PreprocessorDefinitions);%(PreprocessorDefinitions) true $(ProjectDir)\..\btree;$(ProjectDir)\..\OpenCL;%(AdditionalIncludeDirectories) - /D POCO_STATIC %(AdditionalOptions) + /D POCO_STATIC $(MSVC_X64_RELEASE_EINSTSET) %(AdditionalOptions) 4267 NotSet @@ -226,7 +285,7 @@ true - esent.lib;WebServices.lib;Rpcrt4.lib;Ntdsapi.lib;Secur32.lib;Crypt32.lib;runtimeobject.lib;%(AdditionalDependencies) + esent.lib;WebServices.lib;Rpcrt4.lib;Ntdsapi.lib;Secur32.lib;Crypt32.lib;%(AdditionalDependencies) @@ -253,6 +312,30 @@ esent.lib;WebServices.lib;Rpcrt4.lib;Ntdsapi.lib;Secur32.lib;Crypt32.lib;runtimeobject.lib;%(AdditionalDependencies) + + + Level3 + Use + MaxSpeed + true + true + ENABLE_3FD_CST;ENABLE_3FD_ERR_IMPL_DETAILS;SQLITE_OMIT_DEPRECATED;SQLITE_OMIT_LOAD_EXTENSION;SQLITE_DEFAULT_FOREIGN_KEYS=1;_ENABLE_ATOMIC_ALIGNMENT_FIX;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;SECURITY_WIN32;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);%(PreprocessorDefinitions);%(PreprocessorDefinitions) + true + $(ProjectDir)\..\btree;$(ProjectDir)\..\OpenCL;%(AdditionalIncludeDirectories) + /D POCO_STATIC $(MSVC_X86_RELEASE_EINSTSET) %(AdditionalOptions) + 4267 + NotSet + + + Windows + true + true + true + + + esent.lib;WebServices.lib;Rpcrt4.lib;Ntdsapi.lib;Secur32.lib;Crypt32.lib;%(AdditionalDependencies) + + @@ -350,27 +433,33 @@ NotUsing - NotUsing + NotUsing NotUsing + NotUsing NotUsing - NotUsing + NotUsing NotUsing + NotUsing Create - Create + Create Create + Create Create - Create + Create Create + Create true - true + true true + true true - true + true true + true @@ -384,10 +473,9 @@ - - + Designer diff --git a/3FD/3FD.vcxproj.filters b/3FD/3FD.vcxproj.filters index 84628b7..7d84b39 100644 --- a/3FD/3FD.vcxproj.filters +++ b/3FD/3FD.vcxproj.filters @@ -380,9 +380,6 @@ Source Files\WWS - - Source Files\WWS - Source Files\core @@ -400,13 +397,13 @@ - + Resource Files - + - + Resource Files - + \ No newline at end of file diff --git a/3FD/3fd-config-template.xml b/3FD/3fd-config-template.xml new file mode 100644 index 0000000..4810c6e --- /dev/null +++ b/3FD/3fd-config-template.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/3FD/CMakeLists.txt b/3FD/CMakeLists.txt index 53590d5..76e9caa 100644 --- a/3FD/CMakeLists.txt +++ b/3FD/CMakeLists.txt @@ -6,7 +6,9 @@ cmake_minimum_required(VERSION 2.6) project(3FD) +##################### # Macro definitions: + add_definitions( -DENABLE_3FD_CST -DENABLE_3FD_ERR_IMPL_DETAILS @@ -18,18 +20,20 @@ if(buildType STREQUAL release) add_definitions(-DNDEBUG) endif() -set(POCO_ROOT "/opt/poco-1.7.5") -set(BOOST_HOME "/opt/boost-1.60") - +######################## # Include directories: + include_directories( "${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/../btree" "${PROJECT_SOURCE_DIR}/../OpenCL" - "${POCO_ROOT}/include" - "${BOOST_HOME}/include" + "$ENV{POCO_ROOT}/include" + "$ENV{BOOST_HOME}/include" ) +######################## +# Dependency libraries: + # Static library source files: add_library(3FD STATIC broker_impl.cpp @@ -69,3 +73,10 @@ add_library(3FD STATIC utils_memorypool.cpp ) +################ +# Installation: + +install( + TARGETS 3FD + DESTINATION "${PROJECT_SOURCE_DIR}/../build/bin" +) diff --git a/3FD/broker.h b/3FD/broker.h index c9c01b4..c1c221d 100644 --- a/3FD/broker.h +++ b/3FD/broker.h @@ -136,7 +136,7 @@ namespace broker { private: - Poco::Data::Session m_dbSession; + std::unique_ptr m_dbSession; string m_serviceURL; @@ -152,7 +152,6 @@ namespace broker /// /// Helps synchronizing with an asynchronous write to a broker queue. - /// The underlying implementation is NOT THREAD SAFE! /// class INTFOPT IAsyncWrite { @@ -207,13 +206,14 @@ namespace broker /// /// Represents a queue in the broker, into which /// a service can write messages to another. + /// The underlying implementation is NOT THREAD SAFE! /// /// class QueueWriter : notcopiable, OdbcClient { private: - Poco::Data::Session m_dbSession; + std::unique_ptr m_dbSession; string m_serviceURL; diff --git a/3FD/broker_impl.cpp b/3FD/broker_impl.cpp index 7544379..2d9a11a 100644 --- a/3FD/broker_impl.cpp +++ b/3FD/broker_impl.cpp @@ -1,5 +1,9 @@ #include "stdafx.h" #include "broker_impl.h" +#include "configuration.h" +#include "logger.h" +#include "utils_io.h" + #include namespace _3fd @@ -23,6 +27,7 @@ namespace broker } } + /// /// Converts an enumerated type of message content validation to a label. /// @@ -42,6 +47,7 @@ namespace broker } } + /// /// Initializes a new instance of the class. /// @@ -50,5 +56,98 @@ namespace broker Poco::Data::ODBC::Connector::registerConnector(); } + + /// + /// Gets an ODBC database connection. + /// Fails with an exception only after timeout and a number + /// of retries specified in framework configuration file. + /// + /// The connection string. + /// The succesfully established connection. + std::unique_ptr GetConnection(const string &connString) + { + int retryCount(0); + + while (true) + { + try + { + static const auto timeout = + core::AppConfig::GetSettings().framework.broker.dbConnTimeoutSecs; + + return std::unique_ptr( + new Poco::Data::Session("ODBC", connString, timeout) + ); + } + catch (Poco::Data::ConnectionFailedException &ex) + { + static const auto maxRetries = + core::AppConfig::GetSettings().framework.broker.dbConnMaxRetries; + + if (retryCount >= maxRetries) + ex.rethrow(); + } + + ++retryCount; + } + } + + + /// + /// Checks the state of a database connection. + /// Fails with an exception only if disconnected and after a + /// number of retries specified in framework configuration file. + /// + /// The connection string. + /// A refence to the checked connection. + Poco::Data::Session &CheckConnection(Poco::Data::Session &dbSession) + { + if (dbSession.isConnected()) + return dbSession; + + static const auto maxRetries = + core::AppConfig::GetSettings().framework.broker.dbConnMaxRetries; + + int retryCount(1); + + if (retryCount <= maxRetries) + { + std::array bufErrMsg; + + utils::SerializeTo(bufErrMsg, + "Lost connection to broker queue in database '", dbSession.uri(), + "'. Client will attempt reconnection up to ", maxRetries, " time(s)"); + + core::Logger::Write(bufErrMsg.data(), core::Logger::PRIO_WARNING); + } + + // loop for reconnection: + while (true) + { + try + { + dbSession.reconnect(); + + std::array bufErrMsg; + + utils::SerializeTo(bufErrMsg, + "Succesfully reconnected to broker queue in database '", + dbSession.uri(), '\''); + + core::Logger::Write(bufErrMsg.data(), core::Logger::PRIO_WARNING); + + return dbSession; + } + catch (Poco::Data::ConnectionFailedException &ex) + { + if (retryCount >= maxRetries) + ex.rethrow(); + } + + ++retryCount; + + }// end of loop + } + }// end of namespace broker }// end of namespace _3fd \ No newline at end of file diff --git a/3FD/broker_impl.h b/3FD/broker_impl.h index ba3c22a..07ddcca 100644 --- a/3FD/broker_impl.h +++ b/3FD/broker_impl.h @@ -11,6 +11,10 @@ namespace broker const char *ToString(MessageContentValidation msgContentValidation); + std::unique_ptr GetConnection(const string &connString); + + Poco::Data::Session &CheckConnection(Poco::Data::Session &dbSession); + }// end of namespace broker }// end of namespace _3fd diff --git a/3FD/broker_impl_reader.cpp b/3FD/broker_impl_reader.cpp index 8100107..fece9b2 100644 --- a/3FD/broker_impl_reader.cpp +++ b/3FD/broker_impl_reader.cpp @@ -11,6 +11,7 @@ namespace broker { using std::string; + /// /// Initializes a new instance of the class. /// @@ -26,7 +27,7 @@ namespace broker const string &serviceURL, const MessageTypeSpec &msgTypeSpec) try : - m_dbSession("ODBC", connString), + m_dbSession(GetConnection(connString)), m_serviceURL(serviceURL) { CALL_STACK_TRACE; @@ -35,9 +36,9 @@ namespace broker using namespace Poco::Data; using namespace Poco::Data::Keywords; - + // Create message type, contract, queue, service and message content data type: - m_dbSession << R"( + CheckConnection(*m_dbSession) << R"( if not exists ( select * from sys.service_queues where name = N'%s/v1_0_0/Queue' ) begin create message type [%s/v1_0_0/Message] validation = %s; @@ -68,7 +69,7 @@ namespace broker // Create stored procedure to read messages from queue: Poco::Nullable stoProcObjId; - m_dbSession << + CheckConnection(*m_dbSession) << "select object_id(N'%s/v1_0_0/ReadMessagesProc', N'P');" , serviceURL , into(stoProcObjId) @@ -76,7 +77,7 @@ namespace broker if (stoProcObjId.isNull()) { - m_dbSession << R"( + CheckConnection(*m_dbSession) << R"( create procedure [%s/v1_0_0/ReadMessagesProc] ( @recvMsgCountLimit int ,@recvTimeoutMilisecs int @@ -176,7 +177,7 @@ namespace broker , now; } - m_dbSession.setFeature("autoCommit", false); + CheckConnection(*m_dbSession).setFeature("autoCommit", false); std::ostringstream oss; oss << "Initialized successfully the reader for broker queue '" << serviceURL @@ -213,6 +214,7 @@ namespace broker throw core::AppException(oss.str()); } + /// /// Controls retrieval of results from asynchronous read of queue. /// This implementation is NOT THREAD SAFE! @@ -248,10 +250,9 @@ namespace broker using namespace Poco::Data::Keywords; - if (!dbSession.isConnected()) - dbSession.reconnect(); - - m_stoProcExecStmt.reset(new Poco::Data::Statement(dbSession)); + m_stoProcExecStmt.reset( + new Poco::Data::Statement(CheckConnection(dbSession)) + ); std::ostringstream oss; oss << "exec [" << serviceURL << "/v1_0_0/ReadMessagesProc] " @@ -259,7 +260,7 @@ namespace broker *m_stoProcExecStmt << oss.str(), into(m_messages); - dbSession.begin(); + CheckConnection(dbSession).begin(); m_messages.reserve(msgCountStepLimit); } @@ -292,6 +293,7 @@ namespace broker throw core::AppException(oss.str()); } + /// /// Finalizes an instance of the class. /// @@ -597,7 +599,10 @@ namespace broker try { return std::unique_ptr( - new AsyncReadImpl(m_dbSession, msgCountStepLimit, msgRecvTimeout, m_serviceURL) + new AsyncReadImpl(*m_dbSession, + msgCountStepLimit, + msgRecvTimeout, + m_serviceURL) ); } catch (core::IAppException &) diff --git a/3FD/broker_impl_writer.cpp b/3FD/broker_impl_writer.cpp index 086d807..91b5f44 100644 --- a/3FD/broker_impl_writer.cpp +++ b/3FD/broker_impl_writer.cpp @@ -12,6 +12,7 @@ namespace broker { using std::string; + /// /// Initializes a new instance of the class. /// @@ -27,7 +28,7 @@ namespace broker const string &serviceURL, const MessageTypeSpec &msgTypeSpec) try : - m_dbSession("ODBC", connString), + m_dbSession(GetConnection(connString)), m_serviceURL(serviceURL) { CALL_STACK_TRACE; @@ -36,9 +37,9 @@ namespace broker using namespace Poco::Data; using namespace Poco::Data::Keywords; - + // Create message type, contract, queue, service, message content data type and input stage table: - m_dbSession << R"( + CheckConnection(*m_dbSession) << R"( if not exists ( select * from sys.service_queues where name = N'%s/v1_0_0/Queue' ) begin create message type [%s/v1_0_0/Message] validation = %s; @@ -92,7 +93,7 @@ namespace broker // Create stored procedure to send messages to service queue: Poco::Nullable stoProcObjId; - m_dbSession << + CheckConnection(*m_dbSession) << "select object_id(N'%s/v1_0_0/SendMessagesProc', N'P');" , serviceURL , into(stoProcObjId) @@ -100,7 +101,7 @@ namespace broker if (stoProcObjId.isNull()) { - m_dbSession << R"( + CheckConnection(*m_dbSession) << R"( create procedure [%s/v1_0_0/SendMessagesProc] as begin try begin transaction; @@ -158,7 +159,7 @@ namespace broker // Create stored procedure to finish conversations in the initiator endpoint: - m_dbSession << + CheckConnection(*m_dbSession) << "select object_id(N'%s/v1_0_0/FinishDialogsOnEndptInitProc', N'P');" , serviceURL , into(stoProcObjId) @@ -166,7 +167,7 @@ namespace broker if (stoProcObjId.isNull()) { - m_dbSession << R"( + CheckConnection(*m_dbSession) << R"( create procedure [%s/v1_0_0/FinishDialogsOnEndptInitProc] as begin try begin transaction; @@ -232,7 +233,7 @@ namespace broker , now; } - m_dbSession.setFeature("autoCommit", false); + CheckConnection(*m_dbSession).setFeature("autoCommit", false); std::ostringstream oss; oss << "Initialized successfully the writer for broker queue '" << serviceURL @@ -269,6 +270,7 @@ namespace broker throw core::AppException(oss.str()); } + /// /// Helps synchronizing with an asynchronous write to a broker queue. /// @@ -519,6 +521,7 @@ namespace broker };// end of AsyncWriteImpl class + // Synchronously put the messages into the broker queue static void PutInQueueImpl(Poco::Data::Session &dbSession, const std::vector &messages, @@ -530,14 +533,18 @@ namespace broker try { - if (!dbSession.isConnected()) - dbSession.reconnect(); - - dbSession.begin(); + CheckConnection(dbSession).begin(); - dbSession << "insert into [%s/v1_0_0/InputStageTable] (content) values (?);", serviceURL, useRef(messages), now; + CheckConnection(dbSession) + << "insert into [%s/v1_0_0/InputStageTable] (content) values (?);" + , serviceURL + , useRef(messages) + , now; - dbSession << "exec [%s/v1_0_0/SendMessagesProc];", serviceURL, now; + CheckConnection(dbSession) + << "exec [%s/v1_0_0/SendMessagesProc];" + , serviceURL + , now; result.set_value(); } @@ -551,6 +558,7 @@ namespace broker } } + /// /// Asychonously writes the messages into the queue. /// @@ -565,11 +573,11 @@ namespace broker if (m_workerThread && m_workerThread->joinable()) m_workerThread->join(); - std::unique_ptr result(new AsyncWriteImpl(m_dbSession)); + std::unique_ptr result(new AsyncWriteImpl(*m_dbSession)); m_workerThread.reset( new std::thread(&PutInQueueImpl, - std::ref(m_dbSession), + std::ref(*m_dbSession), std::ref(messages), m_serviceURL, std::ref(static_cast (*result))) @@ -624,6 +632,7 @@ namespace broker } } + /// /// Finalizes an instance of the class. /// diff --git a/3FD/callstacktracer.cpp b/3FD/callstacktracer.cpp index 2a2832d..b62f68c 100644 --- a/3FD/callstacktracer.cpp +++ b/3FD/callstacktracer.cpp @@ -7,183 +7,183 @@ namespace _3fd { - namespace core +namespace core +{ + /////////////////////////////////////// + // CallStack Class + /////////////////////////////////////// + + /// + /// Initializes a new instance of the class. + /// + /// The log initial capacity. + CallStack::CallStack(size_t logInitialCap) { - /////////////////////////////////////// - // CallStack Class - /////////////////////////////////////// - - /// - /// Initializes a new instance of the class. - /// - /// The log initial capacity. - CallStack::CallStack(size_t logInitialCap) - { - m_stackFrames.reserve(logInitialCap); - } - - /// - /// Registers the frame. - /// - /// The file name. - /// The line number. - /// The function of the frame. - void CallStack::RegisterFrame(const char *file, - unsigned long line, - const char *function) NOEXCEPT - { - m_stackFrames.push_back( - Frame(file, function, line) - ); - } - - /// - /// Pops the last added stack frame. - /// - /// Whether the stack log is empty after popping an entry from it. - bool CallStack::PopStackFrameEntry() NOEXCEPT - { - m_stackFrames.pop_back(); - return m_stackFrames.empty(); - } + m_stackFrames.reserve(logInitialCap); + } + + /// + /// Registers the frame. + /// + /// The file name. + /// The line number. + /// The function of the frame. + void CallStack::RegisterFrame(const char *file, + unsigned long line, + const char *function) NOEXCEPT + { + m_stackFrames.push_back( + Frame(file, function, line) + ); + } + + /// + /// Pops the last added stack frame. + /// + /// Whether the stack log is empty after popping an entry from it. + bool CallStack::PopStackFrameEntry() NOEXCEPT + { + m_stackFrames.pop_back(); + return m_stackFrames.empty(); + } - // From path+fileName, gets only the file name - static const char *GetFileName(const char *fullFileName) - { + // From path+fileName, gets only the file name + static const char *GetFileName(const char *fullFileName) + { # ifdef _WIN32 - const char filePathSeparator('\\'); + const char filePathSeparator('\\'); # else - const char filePathSeparator('/'); + const char filePathSeparator('/'); # endif - const char *fileNameSubstr = strrchr(fullFileName, filePathSeparator); + const char *fileNameSubstr = strrchr(fullFileName, filePathSeparator); - if (fileNameSubstr != nullptr) - ++fileNameSubstr; - else - fileNameSubstr = fullFileName; + if (fileNameSubstr != nullptr) + ++fileNameSubstr; + else + fileNameSubstr = fullFileName; - return fileNameSubstr; - } + return fileNameSubstr; + } - /// - /// Gets the call stack trace report. - /// - /// A string which shows the current stack trace. - string CallStack::GetReport() - { + /// + /// Gets the call stack trace report. + /// + /// A string which shows the current stack trace. + string CallStack::GetReport() + { # ifdef _3FD_PLATFORM_WINRT - const char *newLine = "\n"; + const char *newLine = "\n"; # else - const char *newLine = "\r\n"; + const char *newLine = "\r\n"; # endif - std::ostringstream oss; + std::ostringstream oss; - for(int index = 0 ; index < m_stackFrames.size() ; ++index) - { - auto &frame = m_stackFrames[index]; - - oss << "$ " << GetFileName(frame.file) - << " (" << frame.line << ") @ " << frame.function - << newLine; - } + for(int index = 0 ; index < m_stackFrames.size() ; ++index) + { + auto &frame = m_stackFrames[index]; - return oss.str(); + oss << "$ " << GetFileName(frame.file) + << " (" << frame.line << ") @ " << frame.function + << newLine; } + return oss.str(); + } - ////////////////////////////////// - // CallStackTracer Class - ////////////////////////////////// - thread_local_def CallStack * CallStackTracer::callStack(nullptr); + ////////////////////////////////// + // CallStackTracer Class + ////////////////////////////////// - /// - /// Registers the current thread to have its stack traced. - /// - /// - /// whenever successful, otherwise, - /// - bool CallStackTracer::RegisterThread() + thread_local CallStack * CallStackTracer::callStack(nullptr); + + /// + /// Registers the current thread to have its stack traced. + /// + /// + /// whenever successful, otherwise, + /// + bool CallStackTracer::RegisterThread() + { + if(callStack == nullptr) { - if(callStack == nullptr) + try { - try - { - callStack = new CallStack ( - AppConfig::GetSettings().framework.stackTracing.stackLogInitialCap - ); - - return STATUS_OKAY; - } - catch(IAppException &ex) - { - // If the framework settings could not be initialized, this is a fatal error: - std::ostringstream oss; - oss << "Registration of thread with call stack tracer failed with an exception - " << ex.ToString(); - AttemptConsoleOutput(oss.str()); - exit(EXIT_FAILURE); - } - catch(std::exception &ex) - { - std::ostringstream oss; - oss << "Generic failure when attempting to register thread for call stack tracing: " << ex.what(); - AttemptConsoleOutput(oss.str()); - } - - return STATUS_FAIL; - } - - return STATUS_OKAY; - } + callStack = new CallStack ( + AppConfig::GetSettings().framework.stackTracing.stackLogInitialCap + ); - /// - /// Unregisters the current thread for stack tracing. - /// - void CallStackTracer::UnregisterThread() - { - if(callStack != nullptr) + return STATUS_OKAY; + } + catch(IAppException &ex) { - delete callStack; - callStack = nullptr; + // If the framework settings could not be initialized, this is a fatal error: + std::ostringstream oss; + oss << "Registration of thread with call stack tracer failed with an exception - " << ex.ToString(); + AttemptConsoleOutput(oss.str()); + exit(EXIT_FAILURE); + } + catch(std::exception &ex) + { + std::ostringstream oss; + oss << "Generic failure when attempting to register thread for call stack tracing: " << ex.what(); + AttemptConsoleOutput(oss.str()); } - } - /// - /// Tracks the call. - /// - /// The file name. - /// The line number. - /// The function name. - void CallStackTracer::TrackCall(const char *file, - unsigned long line, - const char *function) - { - if(callStack != nullptr) - callStack->RegisterFrame(file, line, function); - else if (RegisterThread() == STATUS_OKAY) - callStack->RegisterFrame(file, line, function); + return STATUS_FAIL; } - /// - /// Pops the last added stack frame. - /// If the stack become empty, this object will be destroyed. - /// - void CallStackTracer::PopStackFrameEntry() NOEXCEPT - { - if(callStack->PopStackFrameEntry() == false) - return; - else - UnregisterThread(); - } + return STATUS_OKAY; + } - /// - /// Gets the stack frame report. - /// - /// A text encoded report of the stack frame. - string CallStackTracer::GetStackReport() + /// + /// Unregisters the current thread for stack tracing. + /// + void CallStackTracer::UnregisterThread() + { + if(callStack != nullptr) { - return callStack->GetReport(); + delete callStack; + callStack = nullptr; } + } + + /// + /// Tracks the call. + /// + /// The file name. + /// The line number. + /// The function name. + void CallStackTracer::TrackCall(const char *file, + unsigned long line, + const char *function) + { + if(callStack != nullptr) + callStack->RegisterFrame(file, line, function); + else if (RegisterThread() == STATUS_OKAY) + callStack->RegisterFrame(file, line, function); + } + + /// + /// Pops the last added stack frame. + /// If the stack become empty, this object will be destroyed. + /// + void CallStackTracer::PopStackFrameEntry() NOEXCEPT + { + if(callStack->PopStackFrameEntry() == false) + return; + else + UnregisterThread(); + } + + /// + /// Gets the stack frame report. + /// + /// A text encoded report of the stack frame. + string CallStackTracer::GetStackReport() + { + return callStack->GetReport(); + } - }// end of namespace core +}// end of namespace core }// end of namespace _3fd diff --git a/3FD/callstacktracer.h b/3FD/callstacktracer.h index 6978402..9a746c4 100644 --- a/3FD/callstacktracer.h +++ b/3FD/callstacktracer.h @@ -8,119 +8,119 @@ namespace _3fd { - using std::string; +namespace core +{ + using std::string; - namespace core - { - ///////////////////////////////////////// - // Early class declarations - ///////////////////////////////////////// + ///////////////////////////////////////// + // Early class declarations + ///////////////////////////////////////// + + class StackTracer; + class StackDeactivationTrigger; - class StackTracer; - class StackDeactivationTrigger; + /// + /// Stores an history of procedure call events + /// + class CallStack : notcopiable + { + private: /// - /// Stores an history of procedure call events + /// Represents a stack frame traced event /// - class CallStack : notcopiable + struct Frame { - private: + const char *file; + const char *function; + unsigned long line; + + Frame(const char *p_file, + const char *p_function, + unsigned long p_line) + : file(p_file), function(p_function), line(p_line) + {} + }; - /// - /// Represents a stack frame traced event - /// - struct Frame - { - const char *file; - const char *function; - unsigned long line; + std::vector m_stackFrames; - Frame(const char *p_file, - const char *p_function, - unsigned long p_line) - : file(p_file), function(p_function), line(p_line) - {} - }; + public: - std::vector m_stackFrames; + CallStack(size_t logInitialCap); - public: + void RegisterFrame(const char *file, + unsigned long line, + const char *function) NOEXCEPT; - CallStack(size_t logInitialCap); + bool PopStackFrameEntry() NOEXCEPT; - void RegisterFrame(const char *file, - unsigned long line, - const char *function) NOEXCEPT; + string GetReport(); + }; - bool PopStackFrameEntry() NOEXCEPT; + + /// + /// A facade for the call stack tracer, which is operated through macros defined on 'preprocessing.h' + /// + class CallStackTracer + { + private: - string GetReport(); - }; + thread_local static CallStack *callStack; - /// - /// A facade for the call stack tracer, which is operated through macros defined on 'preprocessing.h' + /// Prevents a default instance of the class from being created. /// - class CallStackTracer - { - private: - - thread_local_decl static CallStack *callStack; + CallStackTracer() {} - /// - /// Prevents a default instance of the class from being created. - /// - CallStackTracer() {} + static bool RegisterThread(); + static void UnregisterThread(); - static bool RegisterThread(); - static void UnregisterThread(); + public: - public: - - /// - /// Determines whether call stack tracing is ready for the calling thread. - /// - /// 'true' if available, otherwise, 'false'. - static bool IsReady() - { - /* This method is necessary to prevent things such as an exception attempting to access CST when it is not started yet, - or any other piece of code trying to access the framework configurations before they were loaded. These situations might - take place if the initialization of the frameowrk core features runs into an error, when neither CST is ready or/nor the - configurations are available. In these cases, an exception still has to be used in order to signalize the failure, but it - cannot make use of such 'services'. - - Obs.: If the exception tries to invoke the RTM to get trace information, the framework initialization is requested again recursively, - leading to a stack overflow. */ - return callStack != nullptr; - } - - static void TrackCall(const char *file, - unsigned long line, - const char *function); - - static void PopStackFrameEntry() NOEXCEPT; - - static string GetStackReport(); - }; + /// + /// Determines whether call stack tracing is ready for the calling thread. + /// + /// 'true' if available, otherwise, 'false'. + static bool IsReady() + { + /* This method is necessary to prevent things such as an exception attempting to access CST when it is not started yet, + or any other piece of code trying to access the framework configurations before they were loaded. These situations might + take place if the initialization of the frameowrk core features runs into an error, when neither CST is ready or/nor the + configurations are available. In these cases, an exception still has to be used in order to signalize the failure, but it + cannot make use of such 'services'. + + Obs.: If the exception tries to invoke the RTM to get trace information, the framework initialization is requested again recursively, + leading to a stack overflow. */ + return callStack != nullptr; + } + + static void TrackCall(const char *file, + unsigned long line, + const char *function); + + static void PopStackFrameEntry() NOEXCEPT; + + static string GetStackReport(); + }; + + /// + /// This class is a trick to automatize the call stack tracing using scope finalizations. + /// + class StackDeactivationTrigger + { + public: /// - /// This class is a trick to automatize the call stack tracing using scope finalizations. + /// Finalizes an instance of the class. /// - class StackDeactivationTrigger + ~StackDeactivationTrigger() { - public: - - /// - /// Finalizes an instance of the class. - /// - ~StackDeactivationTrigger() - { - CallStackTracer::PopStackFrameEntry(); - } - }; + CallStackTracer::PopStackFrameEntry(); + } + }; - }// end of namespace core +}// end of namespace core }// end of namespace _3fd #endif // header guard diff --git a/3FD/config3fd-template.xml b/3FD/config3fd-template.xml deleted file mode 100644 index 76961ee..0000000 --- a/3FD/config3fd-template.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/3FD/configuration.cpp b/3FD/configuration.cpp index 274cac2..369146f 100644 --- a/3FD/configuration.cpp +++ b/3FD/configuration.cpp @@ -1,6 +1,7 @@ #include "stdafx.h" #include "configuration.h" #include "exceptions.h" +#include "utils_io.h" #ifdef _3FD_PLATFORM_WINRT # include "utils_winrt.h" @@ -12,447 +13,642 @@ #endif #include +#include #include #include +#include #include -#if defined __linux__ || defined __unix__ // POSIX: +#ifdef _WIN32 +# define strcasecmp stricmp +#elif defined __linux__ || defined __unix__ // POSIX: # include #endif namespace _3fd { - using std::ostringstream; - - namespace core +namespace core +{ + using std::ostringstream; + + ////////////////////////// + // AppFlexSettings Class + ////////////////////////// + + /// + /// Adds a pair key-value loaded from the XML configuration file. + /// + /// The key. + /// The value. + void AppFlexSettings::Add(const string &key, const string &value) + { + m_settings[key] = value; + } + + + /// + /// Gets the string value for a given key. + /// + /// The key. + /// The default value. + /// The value for the key when defined, otherwise, the default. + string AppFlexSettings::GetString(const string &key, const char *defValue) const + { + auto iter = m_settings.find(key); + + if (m_settings.end() != iter) + return iter->second; + else + return defValue; + } + + + /// + /// Gets the boolean value for a given key. + /// + /// The key. + /// The default value. + /// + /// The value for the key when defined and succesfully + /// converted to the target type, otherwise, the default. + /// + bool AppFlexSettings::GetBool(const string &key, bool defValue) const + { + auto iter = m_settings.find(key); + + if (m_settings.end() != iter) + return (strcasecmp(iter->second.c_str(), "true") == 0); + else + return defValue; + } + + + /// + /// Gets the integer value for a given key. + /// + /// The key. + /// The default value. + /// The parsed value for the key when defined, otherwise, the default. + int32_t AppFlexSettings::GetInt(const string &key, int32_t defValue) const + { + auto iter = m_settings.find(key); + + if (m_settings.end() != iter) + return strtol(iter->second.c_str(), nullptr, 10); + else + return defValue; + } + + + /// + /// Gets the unsigned integer value for a given key. + /// + /// The key. + /// The default value. + /// The parsed value for the key when defined, otherwise, the default. + uint32_t AppFlexSettings::GetUInt(const string &key, uint32_t defValue) const + { + auto iter = m_settings.find(key); + + if (m_settings.end() != iter) + return strtoul(iter->second.c_str(), nullptr, 10); + else + return defValue; + } + + + /// + /// Gets the 'floating point' number value for a given key. + /// + /// The key. + /// The default value. + /// The parsed value for the key when defined, otherwise, the default. + float AppFlexSettings::GetFloat(const string &key, float defValue) const + { + auto iter = m_settings.find(key); + + if (m_settings.end() != iter) + return static_cast (strtod(iter->second.c_str(), nullptr)); + else + return defValue; + } + + + ////////////////////////// + // AppConfig Class + ////////////////////////// + + std::unique_ptr AppConfig::uniqueObject; + + std::mutex AppConfig::initializationMutex; + + /// + /// Gets the instance already initialized. + /// + /// The unique instance of already initialized. + AppConfig & AppConfig::GetInstanceInitialized() { - std::unique_ptr AppConfig::uniqueObject; - - std::mutex AppConfig::initializationMutex; - - /// - /// Gets the instance already initialized. - /// - /// The unique instance of already initialized. - AppConfig & AppConfig::GetInstanceInitialized() + if (uniqueObject) + return *uniqueObject; + else { - static bool initialized(false); - - if(initialized) - return *uniqueObject; - else + try { - try - { - std::lock_guard lock(initializationMutex); - - if(initialized == false) - { - if (!uniqueObject) - uniqueObject.reset(new AppConfig()); + std::lock_guard lock(initializationMutex); - uniqueObject->Initialize(); - initialized = true; - } - - return *uniqueObject; - } - catch(core::IAppException &) + if(!uniqueObject) { - throw; // just forward the exceptions regarding error that are known to have been previously handled - } - catch(std::system_error &ex) - { - std::ostringstream oss; - oss << "3FD function is compromised by a critical error! " - "Failed to acquire lock before loading framework configurations: " - << core::StdLibExt::GetDetailsFromSystemError(ex); - - throw AppException(oss.str()); + uniqueObject.reset(new AppConfig()); + uniqueObject->Initialize(); } - catch (std::exception &ex) - { - std::ostringstream oss; - oss << "3FD function is compromised by a critical error! " - "Generic failure when initializing framework configurations: " << ex.what(); + + return *uniqueObject; + } + catch(core::IAppException &) + { + throw; // just forward the exceptions regarding error that are known to have been previously handled + } + catch(std::system_error &ex) + { + std::ostringstream oss; + oss << "3FD function is compromised by a critical error! " + "Failed to acquire lock before loading framework configuration: " + << core::StdLibExt::GetDetailsFromSystemError(ex); - throw AppException(oss.str()); - } + throw AppException(oss.str()); } - } + catch (std::exception &ex) + { + std::ostringstream oss; + oss << "3FD function is compromised by a critical error! " + "Generic failure when initializing framework configuration: " << ex.what(); - /// - /// Gets the application identifier. - /// - /// The application ID, which is the name of the current executable. - const string & AppConfig::GetApplicationId() - { - return GetInstanceInitialized().m_applicationId; + throw AppException(oss.str()); + } } + } - /// - /// Gets the settings. - /// - /// A reference to the hierarchy of settings loaded from the XML configuration file. - const AppConfig::Tree & AppConfig::GetSettings() - { - return GetInstanceInitialized().settings; - } + /// + /// Gets the application identifier. + /// + /// The application ID, which is the name of the current executable. + const string & AppConfig::GetApplicationId() + { + return GetInstanceInitialized().m_applicationId; + } + + /// + /// Gets the settings. + /// + /// A reference to the hierarchy of settings loaded from the XML configuration file. + const AppConfig::Tree & AppConfig::GetSettings() + { + return GetInstanceInitialized().settings; + } #if _WIN32 // Microsoft Windows: # ifdef _3FD_PLATFORM_WIN32API // Windows Desktop Apps only: - /// - /// Gets an ID for the running application, invoking a system call. - /// - /// Where to store the retrieved file path for the running application. - /// A text ID (UTF-8 encoded) for the running application. - static string CallSysForApplicationId(string &appFilePath) - { - std::array chBuffer; - - if (GetModuleFileNameW(nullptr, chBuffer.data(), chBuffer.size()) == 0) - throw AppException("It was not possible to get the full file name of the executable.", "Windows API: GetModuleFileName"); + /// + /// Gets an ID for the running application, invoking a system call. + /// + /// Where to store the retrieved file path for the running application. + /// A text ID (UTF-8 encoded) for the running application. + static string CallSysForApplicationId(string &appFilePath) + { + std::array chBuffer; - try - { - std::wstring_convert> converter; - appFilePath = converter.to_bytes(chBuffer.data()); - } - catch (std::exception &ex) - { - std::ostringstream oss; - oss << "Generic failures when determining the file name of the framework configuration file: " << ex.what(); - throw AppException(oss.str()); - } + if (GetModuleFileNameW(nullptr, chBuffer.data(), chBuffer.size()) == 0) + throw AppException("It was not possible to get the full file name of the executable.", "Windows API: GetModuleFileName"); - // The application ID is the name of the executable without the extension: - return string(appFilePath.begin() + appFilePath.rfind('\\') + 1, - appFilePath.begin() + appFilePath.rfind('.')); + try + { + std::wstring_convert> converter; + appFilePath = converter.to_bytes(chBuffer.data()); } + catch (std::exception &ex) + { + std::ostringstream oss; + oss << "Generic failures when determining the file name of the framework configuration file: " << ex.what(); + throw AppException(oss.str()); + } + + // The application ID is the name of the executable without the extension: + return string(appFilePath.begin() + appFilePath.rfind('\\') + 1, + appFilePath.begin() + appFilePath.rfind('.')); + } # elif defined _3FD_PLATFORM_WINRT // Store Apps only: - /// - /// Gets an ID for the running application, invoking a system call. - /// - /// Where to store the configuration file name for the running application. - /// A text ID (UTF-8 encoded) for the running application. - static string CallSysForApplicationId(Platform::String ^&appCfgFileName) - { - auto curPackageId = Windows::ApplicationModel::Package::Current->Id->Name; + /// + /// Gets an ID for the running application, invoking a system call. + /// + /// Where to store the configuration file name for the running application. + /// A text ID (UTF-8 encoded) for the running application. + static string CallSysForApplicationId(Platform::String ^&appCfgFileName) + { + auto curPackageId = Windows::ApplicationModel::Package::Current->Id->Name; - try - { - appCfgFileName = curPackageId + Platform::StringReference(L".3fd.config"); - std::wstring_convert> converter; - return converter.to_bytes(curPackageId->Data()); - } - catch (std::exception &ex) - { - std::ostringstream oss; - oss << "Generic failure when determining the file name of the framework configuration file: " << ex.what(); - throw AppException(oss.str()); - } + try + { + appCfgFileName = curPackageId + Platform::StringReference(L".3fd.config"); + std::wstring_convert> converter; + return converter.to_bytes(curPackageId->Data()); } + catch (std::exception &ex) + { + std::ostringstream oss; + oss << "Generic failure when determining the file name of the framework configuration file: " << ex.what(); + throw AppException(oss.str()); + } + } # endif #elif defined __linux__ || defined __unix__ // POSIX only: - /// - /// Gets an ID for the running application, invoking a system call. - /// - /// Where to store the retrieved file path for the running application. - /// A text ID (UTF-8 encoded) for the running application. - static string CallSysForApplicationId(string &appFilePath) - { - std::array chBuffer; - auto rval = readlink("/proc/self/exe", chBuffer.data(), chBuffer.size()); + /// + /// Gets an ID for the running application, invoking a system call. + /// + /// Where to store the retrieved file path for the running application. + /// A text ID (UTF-8 encoded) for the running application. + static string CallSysForApplicationId(string &appFilePath) + { + std::array chBuffer; + auto rval = readlink("/proc/self/exe", chBuffer.data(), chBuffer.size()); - if (rval != -1) - { - // The application ID is the name of the executable: - chBuffer[rval] = 0; - appFilePath = string(chBuffer.begin(), chBuffer.begin() + rval); - return string(appFilePath.begin() + appFilePath.rfind('/') + 1, appFilePath.end()); - } - else - throw std::system_error(std::make_error_code(static_cast(errno)), "POSIX API: readlink"); + if (rval != -1) + { + // The application ID is the name of the executable: + chBuffer[rval] = 0; + appFilePath = string(chBuffer.begin(), chBuffer.begin() + rval); + return string(appFilePath.begin() + appFilePath.rfind('/') + 1, appFilePath.end()); } + else + throw std::system_error(std::make_error_code(static_cast(errno)), "POSIX API: readlink"); + } #endif #ifdef _3FD_POCO_SUPPORT - /// - /// Initializes this instance with data from the XML configuration file. - /// - void AppConfig::Initialize() + /// + /// Initializes this instance with data from the XML configuration file. + /// + void AppConfig::Initialize() + { + try { - try - { - string appFilePath; - m_applicationId = CallSysForApplicationId(appFilePath); + string appFilePath; + m_applicationId = CallSysForApplicationId(appFilePath); - using Poco::AutoPtr; - using Poco::Util::XMLConfiguration; + using Poco::AutoPtr; + using Poco::Util::XMLConfiguration; - // Load the configurations in the file - AutoPtr config(new XMLConfiguration(appFilePath + ".3fd.config")); + // Load the configurations in the file + AutoPtr config(new XMLConfiguration(appFilePath + ".3fd.config")); - settings.common.log.purgeAge = config->getInt("common.log.entry[@key='purgeAge'][@value]", 30); - settings.common.log.purgeCount = config->getInt("common.log.entry[@key='purgeCount'][@value]", 16); - settings.common.log.sizeLimit = config->getInt("common.log.entry[@key='sizeLimit'][@value]", 1024); - settings.common.log.writeToConsole = config->getBool("common.log.entry[@key='writeToConsole'][@value]", false); + settings.common.log.purgeAge = config->getUInt("common.log.entry[@key='purgeAge'][@value]", 30); + settings.common.log.purgeCount = config->getUInt("common.log.entry[@key='purgeCount'][@value]", 16); + settings.common.log.sizeLimit = config->getUInt("common.log.entry[@key='sizeLimit'][@value]", 1024); + settings.common.log.writeToConsole = config->getBool("common.log.entry[@key='writeToConsole'][@value]", false); - settings.framework.dependencies.opencl = config->getBool("framework.dependencies.entry[@key='opencl'][@value]", false); + settings.framework.dependencies.opencl = config->getBool("framework.dependencies.entry[@key='opencl'][@value]", false); - settings.framework.stackTracing.stackLogInitialCap = config->getInt("framework.stackTracing.stackLogInitialCap", 32); + settings.framework.stackTracing.stackLogInitialCap = config->getUInt("framework.stackTracing.stackLogInitialCap", 32); - settings.framework.gc.msgLoopSleepTimeoutMilisecs = config->getInt("framework.gc.entry[@key='msgLoopSleepTimeoutMillisecs'][@value]", 100); - settings.framework.gc.memBlocksMemPool.initialSize = config->getInt("framework.gc.entry[@key='memoryBlocksPoolInitialSize'][@value]", 128); - settings.framework.gc.memBlocksMemPool.growingFactor = static_cast (config->getDouble("framework.gc.entry[@key='memoryBlocksPoolGrowingFactor'][@value]", 1.0)); - settings.framework.gc.sptrObjectsHashTable.initialSizeLog2 = config->getInt("framework.gc.entry[@key='sptrObjsHashTabInitSizeLog2'][@value]", 8); - settings.framework.gc.sptrObjectsHashTable.loadFactorThreshold = static_cast (config->getDouble("framework.gc.entry[@key='sptrObjsHashTabLoadFactorThreshold'][@value]", 0.7)); + settings.framework.gc.msgLoopSleepTimeoutMilisecs = config->getUInt("framework.gc.entry[@key='msgLoopSleepTimeoutMillisecs'][@value]", 100); + settings.framework.gc.memBlocksMemPool.initialSize = config->getUInt("framework.gc.entry[@key='memoryBlocksPoolInitialSize'][@value]", 128); + settings.framework.gc.memBlocksMemPool.growingFactor = static_cast (config->getDouble("framework.gc.entry[@key='memoryBlocksPoolGrowingFactor'][@value]", 1.0)); + settings.framework.gc.sptrObjectsHashTable.initialSizeLog2 = config->getUInt("framework.gc.entry[@key='sptrObjsHashTabInitSizeLog2'][@value]", 8); + settings.framework.gc.sptrObjectsHashTable.loadFactorThreshold = static_cast (config->getDouble("framework.gc.entry[@key='sptrObjsHashTabLoadFactorThreshold'][@value]", 0.7)); # ifdef _3FD_OPENCL_SUPPORT - settings.framework.opencl.maxSourceCodeLineLength = config->getInt("framework.opencl.entry[@key='maxSourceCodeLineLength'][@value]", 128); - settings.framework.opencl.maxBuildLogSize = config->getInt("framework.opencl.entry[@key='maxBuildLogSize'][@value]", 5120); + settings.framework.opencl.maxSourceCodeLineLength = config->getUInt("framework.opencl.entry[@key='maxSourceCodeLineLength'][@value]", 128); + settings.framework.opencl.maxBuildLogSize = config->getUInt("framework.opencl.entry[@key='maxBuildLogSize'][@value]", 5120); # endif # ifdef _3FD_ESENT_SUPPORT - settings.framework.isam.useWindowsFileCache = config->getBool("framework.isam.entry[@key='useWindowsFileCache'][@value]", true); + settings.framework.isam.useWindowsFileCache = config->getBool("framework.isam.entry[@key='useWindowsFileCache'][@value]", true); # endif - } - catch (std::system_error &ex) - { - std::ostringstream oss; - oss << "3FD function is compromised by a critical error! " - "Failed to initialize the application settings: " << ex.what(); - - throw AppException(oss.str()); - } - catch (Poco::Exception &ex) - { - ostringstream oss; - oss << "POCO C++ library reported: " << ex.message(); - - throw AppException( - "3FD function is compromised by a critical error! " - "Failed to initialize the application settings", - oss.str() - ); - } + settings.framework.broker.dbConnTimeoutSecs = config->getUInt("framework.broker.entry[@key='dbConnTimeoutSecs'][@value]", 60); + settings.framework.broker.dbConnMaxRetries = config->getUInt("framework.broker.entry[@key='dbConnMaxRetries'][@value]", 1); + +# ifdef _3FD_PLATFORM_WIN32API + settings.framework.rpc.cliSrvConnectMaxRetries = config->getUInt("framework.rpc.entry[@key='cliSrvConnectMaxRetries'][@value]", 10); + settings.framework.rpc.cliSrvConnRetrySleepSecs = config->getUInt("framework.rpc.entry[@key='cliSrvConnRetrySleepSecs'][@value]", 5); + settings.framework.rpc.cliCallMaxRetries = config->getUInt("framework.rpc.entry[@key='cliCallMaxRetries'][@value]", 10); + settings.framework.rpc.cliCallRetrySleepMs = config->getUInt("framework.rpc.entry[@key='cliCallRetrySleepMs'][@value]", 1000); + settings.framework.rpc.cliCallRetryTimeSlotMs = config->getUInt("framework.rpc.entry[@key='cliCallRetryTimeSlotMs'][@value]", 500); + + settings.framework.wws.proxyConnMaxRetries = config->getUInt("framework.wws.entry[@key='proxyConnMaxRetries'][@value]", 10); + settings.framework.wws.proxyCallMaxRetries = config->getUInt("framework.wws.entry[@key='proxyCallMaxRetries'][@value]", 10); + settings.framework.wws.proxyRetrySleepSecs = config->getUInt("framework.wws.entry[@key='proxyRetrySleepSecs'][@value]", 5); + settings.framework.wws.proxyRetryTimeSlotMs = config->getUInt("framework.wws.entry[@key='proxyRetryTimeSlotMs'][@value]", 750); +# endif + // Now load the flat custom settings for applications making use of this framework: + + string path; + std::vector paths; + config->keys("application", paths); + + for (auto &entry : paths) + { + utils::SerializeTo(path, "application.", entry, "[@key]"); + auto key = config->getString(path, ""); + + if (!key.empty()) + { + utils::SerializeTo(path, "application.", entry, "[@value]"); + auto value = config->getString(path, ""); + settings.application.Add(key, value); + } + } } - -#elif defined _3FD_PLATFORM_WINRT // Store Apps only: - - /// - /// Helper function to get a text value of configuration inside a DOM node. - /// - /// The node of the section where to look for the configuration. - /// The xpath for the configuration, starting from the right section. - /// The default value. - /// The configuration stored in attribute 'value'. - static string GetString( - Windows::Data::Xml::Dom::IXmlNode ^nodeSection, - const wchar_t *xpathNodeConfig, - const string &defaultValue) + catch (Poco::Exception &ex) { - if (nodeSection == nullptr) - return defaultValue; - - auto nodeConfig = nodeSection->SelectSingleNode(Platform::StringReference(xpathNodeConfig)); - if (nodeConfig == nullptr) - return defaultValue; + ostringstream oss; + oss << "POCO C++ library reported: " << ex.message(); + + throw AppException( + "3FD function is compromised by a critical error! " + "Failed to initialize the application settings", + oss.str() + ); + } + catch (std::system_error &ex) + { + std::ostringstream oss; + oss << "3FD function is compromised by a critical error! " + "Failed to initialize the application settings: " << StdLibExt::GetDetailsFromSystemError(ex); - auto attribute = nodeConfig->Attributes->GetNamedItem(Platform::StringReference(L"value")); - if (attribute == nullptr) - return defaultValue; + throw AppException(oss.str()); + } + catch (std::exception &ex) + { + std::ostringstream oss; + oss << "3FD function is compromised by a critical error! " + "Failed to initialize the application settings: " << ex.what(); - auto valAsText = attribute->InnerText; + throw AppException(oss.str()); + } + } - if (valAsText->IsEmpty() == false) - { - std::wstring_convert> converter; - return converter.to_bytes(valAsText->Data()); - } - else - return defaultValue; - } +#elif defined _3FD_PLATFORM_WINRT // Store Apps only: - /// - /// Helper function to get a boolean value of configuration inside a DOM node. - /// - /// The node of the section where to look for the configuration. - /// The xpath for the configuration, starting from the right section. - /// The default value. - /// The configuration stored in attribute 'value'. - static bool GetBoolean( - Windows::Data::Xml::Dom::IXmlNode ^nodeSection, - const wchar_t *xpathNodeConfig, - bool defaultValue) - { - if (nodeSection == nullptr) - return defaultValue; + /// + /// Helper function to get a text value of configuration inside a DOM node. + /// + /// The node of the section where to look for the configuration. + /// The xpath for the configuration, starting from the right section. + /// The default value. + /// The configuration stored in attribute 'value'. + static string GetString(Windows::Data::Xml::Dom::IXmlNode ^nodeSection, + const wchar_t *xpathNodeConfig, + const string &defaultValue) + { + if (nodeSection == nullptr) + return defaultValue; - auto nodeConfig = nodeSection->SelectSingleNode(Platform::StringReference(xpathNodeConfig)); - if (nodeConfig == nullptr) - return defaultValue; + auto nodeConfig = nodeSection->SelectSingleNode(Platform::StringReference(xpathNodeConfig)); + if (nodeConfig == nullptr) + return defaultValue; - auto attribute = nodeConfig->Attributes->GetNamedItem(Platform::StringReference(L"value")); - if (attribute == nullptr) - return defaultValue; + auto attribute = nodeConfig->Attributes->GetNamedItem(Platform::StringReference(L"value")); + if (attribute == nullptr) + return defaultValue; - auto valAsText = attribute->InnerText; + auto valAsText = attribute->InnerText; - if (valAsText->IsEmpty() == false) - { - if (wcsicmp(valAsText->Data(), L"true") == 0) - return true; - else if (wcsicmp(valAsText->Data(), L"false") == 0) - return false; - else - return defaultValue; - } + if (valAsText->IsEmpty() == false) + { + std::wstring_convert> converter; + return converter.to_bytes(valAsText->Data()); + } + else + return defaultValue; + } + + /// + /// Helper function to get a boolean value of configuration inside a DOM node. + /// + /// The node of the section where to look for the configuration. + /// The xpath for the configuration, starting from the right section. + /// The default value. + /// The configuration stored in attribute 'value'. + static bool GetBoolean(Windows::Data::Xml::Dom::IXmlNode ^nodeSection, + const wchar_t *xpathNodeConfig, + bool defaultValue) + { + if (nodeSection == nullptr) + return defaultValue; + + auto nodeConfig = nodeSection->SelectSingleNode(Platform::StringReference(xpathNodeConfig)); + if (nodeConfig == nullptr) + return defaultValue; + + auto attribute = nodeConfig->Attributes->GetNamedItem(Platform::StringReference(L"value")); + if (attribute == nullptr) + return defaultValue; + + auto valAsText = attribute->InnerText; + + if (valAsText->IsEmpty() == false) + { + if (wcsicmp(valAsText->Data(), L"true") == 0) + return true; + else if (wcsicmp(valAsText->Data(), L"false") == 0) + return false; else return defaultValue; } + else + return defaultValue; + } + + /// + /// Helper function to get an integer value of configuration inside a DOM node. + /// + /// The node of the section where to look for the configuration. + /// The xpath for the configuration, starting from the right section. + /// The default value. + /// The configuration stored in attribute 'value'. + static int32_t GetInteger(Windows::Data::Xml::Dom::IXmlNode ^nodeSection, + const wchar_t *xpathNodeConfig, + int32_t defaultValue) + { + if (nodeSection == nullptr) + return defaultValue; + + auto nodeConfig = nodeSection->SelectSingleNode(Platform::StringReference(xpathNodeConfig)); + if (nodeConfig == nullptr) + return defaultValue; + + auto attribute = nodeConfig->Attributes->GetNamedItem(Platform::StringReference(L"value")); + if (attribute == nullptr) + return defaultValue; + + auto valAsText = attribute->InnerText->Data(); + int32_t parsedVal = wcstol(valAsText, nullptr, 10); + return static_cast (parsedVal > 0 ? parsedVal : defaultValue); + } + + /// + /// Helper function to get an unsigned integer value of configuration inside a DOM node. + /// + /// The node of the section where to look for the configuration. + /// The xpath for the configuration, starting from the right section. + /// The default value. + /// The configuration stored in attribute 'value'. + static uint32_t GetUInteger(Windows::Data::Xml::Dom::IXmlNode ^nodeSection, + const wchar_t *xpathNodeConfig, + uint32_t defaultValue) + { + if (nodeSection == nullptr) + return defaultValue; + + auto nodeConfig = nodeSection->SelectSingleNode(Platform::StringReference(xpathNodeConfig)); + if (nodeConfig == nullptr) + return defaultValue; + + auto attribute = nodeConfig->Attributes->GetNamedItem(Platform::StringReference(L"value")); + if (attribute == nullptr) + return defaultValue; + + auto valAsText = attribute->InnerText->Data(); + uint32_t parsedVal = wcstoul(valAsText, nullptr, 10); + return static_cast (parsedVal > 0 ? parsedVal : defaultValue); + } + + /// + /// Helper function to get a 'double precision floating-point' number value of configuration inside a DOM node. + /// + /// The node of the section where to look for the configuration. + /// The xpath for the configuration, starting from the right section. + /// The default value. + /// The configuration stored in attribute 'value'. + static float GetFloat(Windows::Data::Xml::Dom::IXmlNode ^nodeSection, + const wchar_t *xpathNodeConfig, + float defaultValue) + { + if (nodeSection == nullptr) + return defaultValue; - /// - /// Helper function to get an integer value of configuration inside a DOM node. - /// - /// The node of the section where to look for the configuration. - /// The xpath for the configuration, starting from the right section. - /// The default value. - /// The configuration stored in attribute 'value'. - static int GetInteger( - Windows::Data::Xml::Dom::IXmlNode ^nodeSection, - const wchar_t *xpathNodeConfig, - int defaultValue) + auto nodeConfig = nodeSection->SelectSingleNode(Platform::StringReference(xpathNodeConfig)); + if (nodeConfig == nullptr) + return defaultValue; + + auto attribute = nodeConfig->Attributes->GetNamedItem(Platform::StringReference(L"value")); + if (attribute == nullptr) + return defaultValue; + + auto valAsText = attribute->InnerText->Data(); + float parsedVal = static_cast (wcstod(valAsText, nullptr)); + return parsedVal > 0.0 ? parsedVal : defaultValue; + } + + /// + /// Initializes this instance with data from the XML configuration file. + /// + void AppConfig::Initialize() + { + try { - if (nodeSection == nullptr) - return defaultValue; + using namespace Windows::Data::Xml::Dom; - auto nodeConfig = nodeSection->SelectSingleNode(Platform::StringReference(xpathNodeConfig)); - if (nodeConfig == nullptr) - return defaultValue; + Platform::String ^cfgFileName; + m_applicationId = CallSysForApplicationId(cfgFileName); - auto attribute = nodeConfig->Attributes->GetNamedItem(Platform::StringReference(L"value")); - if (attribute == nullptr) - return defaultValue; + auto file = utils::WinRTExt::WaitForAsync( + Windows::ApplicationModel::Package::Current->InstalledLocation->GetFileAsync(cfgFileName) + ); + + auto config = utils::WinRTExt::WaitForAsync(XmlDocument::LoadFromFileAsync(file)); - auto valAsText = attribute->InnerText->Data(); - long parsedVal = wcstol(valAsText, nullptr, 10); - return static_cast (parsedVal > 0 ? parsedVal : defaultValue); - } + // Logging options: + IXmlNode ^node = config->SelectSingleNode(L"/configuration/common/log"); + settings.common.log.sizeLimit = GetUInteger(node, L"./entry[@key='sizeLimit']", 2048); - /// - /// Helper function to get a floating point value of configuration inside a DOM node. - /// - /// The node of the section where to look for the configuration. - /// The xpath for the configuration, starting from the right section. - /// The default value. - /// The configuration stored in attribute 'value'. - static float GetFloat( - Windows::Data::Xml::Dom::IXmlNode ^nodeSection, - const wchar_t *xpathNodeConfig, - float defaultValue) - { - if (nodeSection == nullptr) - return defaultValue; + IXmlNode ^framework = config->SelectSingleNode(L"/configuration/framework"); - auto nodeConfig = nodeSection->SelectSingleNode(Platform::StringReference(xpathNodeConfig)); - if (nodeConfig == nullptr) - return defaultValue; + // Stack tracing options: + settings.framework.stackTracing.stackLogInitialCap = + GetUInteger(framework, L"./stackTracing/entry[@key='logInitialCap']", 32); - auto attribute = nodeConfig->Attributes->GetNamedItem(Platform::StringReference(L"value")); - if (attribute == nullptr) - return defaultValue; - - auto valAsText = attribute->InnerText->Data(); - float parsedVal = wcstod(valAsText, nullptr); - return parsedVal > 0.0 ? parsedVal : defaultValue; - } + // Garbage collector options: + node = framework->SelectSingleNode(L"./gc"); - /// - /// Initializes this instance with data from the XML configuration file. - /// - void AppConfig::Initialize() - { - try - { - Platform::String ^cfgFileName; - m_applicationId = CallSysForApplicationId(cfgFileName); + settings.framework.gc.msgLoopSleepTimeoutMilisecs = + GetUInteger(node, L"./entry[@key='msgLoopSleepTimeoutMillisecs']", 100); - auto file = utils::WinRTExt::WaitForAsync( - Windows::ApplicationModel::Package::Current->InstalledLocation->GetFileAsync(cfgFileName) - ); - - auto config = utils::WinRTExt::WaitForAsync( - Windows::Data::Xml::Dom::XmlDocument::LoadFromFileAsync(file) - ); + settings.framework.gc.memBlocksMemPool.initialSize = + GetUInteger(node, L"./entry[@key='memoryBlocksPoolInitialSize']", 128); - // Logging options: - auto node = config->SelectSingleNode(L"/configuration/common/log"); - settings.common.log.sizeLimit = GetInteger(node, L"./entry[@key='sizeLimit']", 2048); + settings.framework.gc.memBlocksMemPool.growingFactor = + GetFloat(node, L"./entry[@key='memoryBlocksPoolGrowingFactor']", 1.0); - auto framework = config->SelectSingleNode(L"/configuration/framework"); + settings.framework.gc.sptrObjectsHashTable.initialSizeLog2 = + GetUInteger(node, L"./entry[@key='sptrObjsHashTabInitSizeLog2']", 8); - // Stack tracing options: - settings.framework.stackTracing.stackLogInitialCap = - GetInteger(framework, L"./stackTracing/entry[@key='logInitialCap']", 32); + settings.framework.gc.sptrObjectsHashTable.loadFactorThreshold = + GetFloat(node, L"./entry[@key='sptrObjsHashTabLoadFactorThreshold']", 0.7F); - // Garbage collector options: - node = framework->SelectSingleNode(L"./gc"); + // ISAM options: + node = framework->SelectSingleNode(L"./isam"); + settings.framework.isam.useWindowsFileCache = + GetBoolean(node, L"./entry[@key='useWindowsFileCache']", true); - settings.framework.gc.msgLoopSleepTimeoutMilisecs = - GetInteger(node, L"./entry[@key='msgLoopSleepTimeoutMillisecs']", 100); + // Now load the flat custom settings for applications making use of this framework: - settings.framework.gc.memBlocksMemPool.initialSize = - GetInteger(node, L"./entry[@key='memoryBlocksPoolInitialSize']", 128); + std::wstring_convert> converter; - settings.framework.gc.memBlocksMemPool.growingFactor = - GetFloat(node, L"./entry[@key='memoryBlocksPoolGrowingFactor']", 1.0F); + XmlNodeList ^appSettings = config->SelectNodes( + Platform::StringReference(L"/configuration/application/entry") + ); + + for (uint32_t idx = 0; idx < appSettings->Size; ++idx) + { + node = appSettings->Item(idx); - settings.framework.gc.sptrObjectsHashTable.initialSizeLog2 = - GetInteger(node, L"./entry[@key='sptrObjsHashTabInitSizeLog2']", 8); + IXmlNode ^attrKey = node->Attributes->GetNamedItem(Platform::StringReference(L"key")); - settings.framework.gc.sptrObjectsHashTable.loadFactorThreshold = - GetFloat(node, L"./entry[@key='sptrObjsHashTabLoadFactorThreshold']", 0.7F); + if (attrKey != nullptr) + { + IXmlNode ^attrValue = node->Attributes->GetNamedItem(Platform::StringReference(L"value")); - // ISAM options: - node = framework->SelectSingleNode(L"./isam"); - settings.framework.isam.useWindowsFileCache = - GetBoolean(node, L"./entry[@key='useWindowsFileCache']", true); - } - catch (core::IAppException &) - { - throw; // forward exceptions known to have been already handled + settings.application.Add( + converter.to_bytes(attrKey->InnerText->Data()), + converter.to_bytes(attrValue->InnerText->Data()) + ); + } } - catch (Platform::Exception ^ex) - { - ostringstream oss; - oss << "Windows Runtime library reported: " << WWAPI::GetDetailsFromWinRTEx(ex); - - throw AppException( - "3FD function is compromised by a critical error! " - "Failed to initialize the application settings", - oss.str() - ); - } - catch (std::exception &ex) - { - std::ostringstream oss; - oss << "3FD function is compromised by a critical error! " - "Generic failure when initializing the application settings: " << ex.what(); + } + catch (core::IAppException &) + { + throw; // forward exceptions known to have been already handled + } + catch (Platform::Exception ^ex) + { + ostringstream oss; + oss << "Windows Runtime library reported: " << WWAPI::GetDetailsFromWinRTEx(ex); + + throw AppException( + "3FD function is compromised by a critical error! " + "Failed to initialize the application settings", + oss.str() + ); + } + catch (std::exception &ex) + { + std::ostringstream oss; + oss << "3FD function is compromised by a critical error! " + "Generic failure when initializing the application settings: " << ex.what(); - throw AppException(oss.str()); - } + throw AppException(oss.str()); } + } #endif - }// end of namespace core +}// end of namespace core }// end of namespace _3fd diff --git a/3FD/configuration.h b/3FD/configuration.h index 89b0810..40aa34d 100644 --- a/3FD/configuration.h +++ b/3FD/configuration.h @@ -2,111 +2,166 @@ #define CONFIGURATION_H #include "preprocessing.h" +#include #include #include #include #include +#include namespace _3fd { - using std::string; - - namespace core +namespace core +{ + using std::string; + + + /// + /// Holds a flexible and flat set of application settings + /// to be loaded from the XML configuration file. + /// + class AppFlexSettings + { + private: + + std::map m_settings; + + public: + + void Add(const string &key, const string &value); + + string GetString(const string &key, const char *defValue) const; + + bool GetBool(const string &key, bool defValue) const; + + int32_t GetInt(const string &key, int32_t defValue) const; + + uint32_t GetUInt(const string &key, uint32_t defValue) const; + + float GetFloat(const string &key, float defValue) const; + }; + + + /// + /// A singleton that holds the application settings. + /// + class AppConfig { - /// - /// A singleton that holds the application settings. - /// - class AppConfig - { - private: + private: - struct Tree + struct Tree + { + // Used by both application and framework: + struct { - // Used by both application and framework: struct { - struct - { #ifdef _3FD_POCO_SUPPORT // For POCO C++ logging facilities: - int purgeAge; - int purgeCount; - bool writeToConsole; + uint32_t purgeAge; + uint32_t purgeCount; + bool writeToConsole; #endif - int sizeLimit; - } log; - } common; + uint32_t sizeLimit; + } log; + } common; - // Required by the framework and for its exclusive use: + // Required by the framework and for its exclusive use: + struct + { struct { - struct - { #ifdef _3FD_OPENCL_SUPPORT - bool opencl; + bool opencl; #endif - } dependencies; + } dependencies; - struct - { - int stackLogInitialCap; - } stackTracing; + struct + { + uint32_t stackLogInitialCap; + } stackTracing; + struct + { + uint32_t msgLoopSleepTimeoutMilisecs; + struct { - int msgLoopSleepTimeoutMilisecs; - - struct - { - int initialSize; - float growingFactor; - } memBlocksMemPool; + uint32_t initialSize; + float growingFactor; + } memBlocksMemPool; - struct - { - int initialSizeLog2; - float loadFactorThreshold; - } sptrObjectsHashTable; - } gc; - -#ifdef _3FD_OPENCL_SUPPORT struct { - int maxSourceCodeLineLength; - int maxBuildLogSize; - } opencl; -#endif + uint32_t initialSizeLog2; + float loadFactorThreshold; + } sptrObjectsHashTable; + } gc; -#ifdef _3FD_ESENT_SUPPORT - struct - { - bool useWindowsFileCache; - } isam; +#ifdef _3FD_OPENCL_SUPPORT + struct + { + uint32_t maxSourceCodeLineLength; + uint32_t maxBuildLogSize; + } opencl; #endif - } framework; +#ifdef _3FD_ESENT_SUPPORT struct { - /* HERE YOU CAN INSERT YOUR OWN STRUCTURES FOR NEW KEYS IN THE XML CONFIGURATION FILE */ - } application; - } settings; + bool useWindowsFileCache; + } isam; +#endif + +#ifdef _3FD_POCO_SUPPORT + struct + { + uint32_t dbConnTimeoutSecs; + uint32_t dbConnMaxRetries; + } broker; +#endif + +#ifdef _3FD_PLATFORM_WIN32API + struct + { + uint32_t cliSrvConnectMaxRetries; + uint32_t cliSrvConnRetrySleepSecs; + uint32_t cliCallMaxRetries; + uint32_t cliCallRetrySleepMs; + uint32_t cliCallRetryTimeSlotMs; + } rpc; + + struct + { + uint32_t proxyConnMaxRetries; + uint32_t proxyCallMaxRetries; + uint32_t proxyRetrySleepSecs; + uint32_t proxyRetryTimeSlotMs; + } wws; +#endif + } framework; + + AppFlexSettings application; + + } settings; + + string m_applicationId; - string m_applicationId; + static std::unique_ptr uniqueObject; + static std::mutex initializationMutex; - static std::unique_ptr uniqueObject; - static std::mutex initializationMutex; + static AppConfig &GetInstanceInitialized(); - static AppConfig &GetInstanceInitialized(); + void Initialize(); - void Initialize(); + AppConfig() {} // empty private constructor - AppConfig() {} // empty private constructor + public: - public: + static const string &GetApplicationId(); - static const string &GetApplicationId(); - static const Tree &GetSettings(); - }; - } -} + static const Tree &GetSettings(); + }; +}// end of namespace core +}// end of namespace _3fd #endif // end of header guard diff --git a/3FD/exceptions.h b/3FD/exceptions.h index fdf66fa..254af4c 100644 --- a/3FD/exceptions.h +++ b/3FD/exceptions.h @@ -150,15 +150,28 @@ namespace core # endif } + /// + /// Initializes a new instance of the + /// class using copy semantics. + /// + /// The object whose resources will be copied. + AppException(const AppException &ob) + : StdExType(ob) + , m_details(ob.m_details) + , m_cst(ob.m_cst) + , m_innerEx(ob.m_innerEx) + { + } + /// /// Initializes a new instance of the /// class using move semantics. /// /// The object whose resources will be stolen. - AppException(AppException &&ob) : - StdExType(std::move(ob.what())), - m_details(std::move(ob.m_details)), - m_cst(std::move(ob.m_cst)) + AppException(AppException &&ob) + : StdExType(std::move(ob)) + , m_details(std::move(ob.m_details)) + , m_cst(std::move(ob.m_cst)) { m_innerEx.swap(ob.m_innerEx); } diff --git a/3FD/gc_garbagecollector.cpp b/3FD/gc_garbagecollector.cpp index 21474ba..7c4b697 100644 --- a/3FD/gc_garbagecollector.cpp +++ b/3FD/gc_garbagecollector.cpp @@ -108,19 +108,20 @@ namespace _3fd /// void GarbageCollector::Shutdown() { - if(uniqueObjectPtr != nullptr) + try { - try - { - std::lock_guard lock(singleInstanceCreationMutex); - delete uniqueObjectPtr; - uniqueObjectPtr = nullptr; - } - catch (std::system_error &) - {/* DO NOTHING: SWALLOW EXCEPTION - This method cannot throw an exception because it can be invoked by a destructor. - If an exception is thrown, memory leaks are expected. */ - } + std::lock_guard lock(singleInstanceCreationMutex); + + if(uniqueObjectPtr != nullptr) + { + delete uniqueObjectPtr; + uniqueObjectPtr = nullptr; + } + } + catch (std::system_error &) + {/* DO NOTHING: SWALLOW EXCEPTION + This method cannot throw an exception because it can be invoked by a destructor. + If an exception is thrown, memory leaks are expected. */ } } diff --git a/3FD/logger.cpp b/3FD/logger.cpp index cf44a9c..36f7641 100644 --- a/3FD/logger.cpp +++ b/3FD/logger.cpp @@ -79,20 +79,21 @@ namespace core /// void Logger::Shutdown() { - if(uniqueObjectPtr != nullptr) - { - try - { - std::lock_guard lock(singleInstanceCreationMutex); - delete uniqueObjectPtr; - uniqueObjectPtr = nullptr; - } - catch (std::system_error) - {/* DO NOTHING: SWALLOW EXCEPTION - This method cannot throw an exception because it could have been originally - invoked by a destructor. When that happens, memory leaks are expected. */ - } - } + try + { + std::lock_guard lock(singleInstanceCreationMutex); + + if (uniqueObjectPtr != nullptr) + { + delete uniqueObjectPtr; + uniqueObjectPtr = nullptr; + } + } + catch (std::system_error) + {/* DO NOTHING: SWALLOW EXCEPTION + This method cannot throw an exception because it could have been originally + invoked by a destructor. When that happens, memory leaks are expected. */ + } } /// @@ -156,7 +157,7 @@ namespace core /// The message to log. /// The priority of the message. /// When set to true, append the call stack trace. - void Logger::WriteImpl(string &&message, Priority prio, bool cst) + void Logger::WriteImpl(string &&message, Priority prio, bool cst) NOEXCEPT { WriteImpl(std::move(message), string(""), prio, cst); } diff --git a/3FD/logger.h b/3FD/logger.h index cc945bc..d7bd3fd 100644 --- a/3FD/logger.h +++ b/3FD/logger.h @@ -103,7 +103,7 @@ namespace core static void CreateInstance(const string &id, bool logToConsole); - static Logger *GetInstance(); + static Logger *GetInstance() NOEXCEPT; // Private implementations: @@ -112,9 +112,9 @@ namespace core #if defined _3FD_PLATFORM_WIN32API || defined _3FD_PLATFORM_WINRT_UWP void WriteImpl(HRESULT hr, const char *message, const char *function, Priority prio); #endif - void WriteImpl(string &&message, Priority prio, bool cst); + void WriteImpl(string &&message, Priority prio, bool cst) NOEXCEPT; - void WriteImpl(string &&what, string &&details, Priority prio, bool cst); + void WriteImpl(string &&what, string &&details, Priority prio, bool cst) NOEXCEPT; public: @@ -166,7 +166,7 @@ namespace core /// The message to log. /// The priority of the message. /// When set to true, append the call stack trace. - static void Write(string &&message, Priority prio, bool cst = false) + static void Write(string &&message, Priority prio, bool cst = false) NOEXCEPT { Logger * const singleton = GetInstance(); if (singleton != nullptr) diff --git a/3FD/logger_poco.cpp b/3FD/logger_poco.cpp index 497667f..542f598 100644 --- a/3FD/logger_poco.cpp +++ b/3FD/logger_poco.cpp @@ -22,7 +22,7 @@ namespace core /// Gets the unique instance of the singleton class. /// /// A pointer to the singleton. - Logger * Logger::GetInstance() + Logger * Logger::GetInstance() NOEXCEPT { if (uniqueObjectPtr != nullptr) return uniqueObjectPtr; @@ -173,7 +173,7 @@ namespace core /// The message details. /// The priority for the message. /// When set to true, append the call stack trace. - void Logger::WriteImpl(string &&what, string &&details, Priority prio, bool cst) + void Logger::WriteImpl(string &&what, string &&details, Priority prio, bool cst) NOEXCEPT { try { diff --git a/3FD/logger_winrt.cpp b/3FD/logger_winrt.cpp index 5475125..424af48 100644 --- a/3FD/logger_winrt.cpp +++ b/3FD/logger_winrt.cpp @@ -19,7 +19,7 @@ namespace _3fd /// Gets the unique instance of the singleton class. /// /// A pointer to the singleton. - Logger * Logger::GetInstance() + Logger * Logger::GetInstance() noexcept { if (uniqueObjectPtr != nullptr) return uniqueObjectPtr; @@ -320,7 +320,7 @@ namespace _3fd /// The message details. /// The priority for the message. /// When set to true, append the call stack trace. - void Logger::WriteImpl(string &&what, string &&details, Priority prio, bool cst) + void Logger::WriteImpl(string &&what, string &&details, Priority prio, bool cst) noexcept { if (m_txtLogFile == nullptr) return; diff --git a/3FD/opencl_impl_context.cpp b/3FD/opencl_impl_context.cpp index d6614f8..3a362be 100644 --- a/3FD/opencl_impl_context.cpp +++ b/3FD/opencl_impl_context.cpp @@ -8,619 +8,615 @@ namespace _3fd { - namespace opencl +namespace opencl +{ + /////////////////////////// + // DeviceInfo Struct + /////////////////////////// + + /// + /// Initializes a new instance of the struct. + /// + /// The device identifier. + DeviceInfo::DeviceInfo(cl_device_id deviceId) { - /////////////////////////// - // DeviceInfo Struct - /////////////////////////// - - /// - /// Initializes a new instance of the struct. - /// - /// The device identifier. - DeviceInfo::DeviceInfo(cl_device_id deviceId) - { - CALL_STACK_TRACE; + CALL_STACK_TRACE; - // Gets a unique ID for the device vendor: - GenericParam param; - param.Set(vendorId); - GetDeviceInfoImpl(deviceId, CL_DEVICE_VENDOR_ID, param); + // Gets a unique ID for the device vendor: + GenericParam param; + param.Set(vendorId); + GetDeviceInfoImpl(deviceId, CL_DEVICE_VENDOR_ID, param); - std::array strbuf; - param.Set(strbuf.data(), strbuf.size()); + std::array strbuf; + param.Set(strbuf.data(), strbuf.size()); - // ... the device vendor name: - GetDeviceInfoImpl(deviceId, CL_DEVICE_VENDOR, param); - vendorName = string(strbuf.data()); + // ... the device vendor name: + GetDeviceInfoImpl(deviceId, CL_DEVICE_VENDOR, param); + vendorName = string(strbuf.data()); - // ... the device name: - GetDeviceInfoImpl(deviceId, CL_DEVICE_NAME, param); - deviceName = string(strbuf.data()); + // ... the device name: + GetDeviceInfoImpl(deviceId, CL_DEVICE_NAME, param); + deviceName = string(strbuf.data()); - // ... and the driver version: - GetDeviceInfoImpl(deviceId, CL_DRIVER_VERSION, param); - driverVersion = string(strbuf.data()); + // ... and the driver version: + GetDeviceInfoImpl(deviceId, CL_DRIVER_VERSION, param); + driverVersion = string(strbuf.data()); - UpdateHashCode(); - } + UpdateHashCode(); + } - /// - /// Updates the hash code based on the values of the data members. - /// - /// The calculated hash code. - void DeviceInfo::UpdateHashCode() - { - std::hash hash; - size_t x = 17; - x = x * 23 + vendorId; - x = x * 23 + hash(vendorName); - x = x * 23 + hash(deviceName); - x = x * 23 + hash(driverVersion); - hashCode = x; - } + /// + /// Updates the hash code based on the values of the data members. + /// + /// The calculated hash code. + void DeviceInfo::UpdateHashCode() + { + std::hash hash; + size_t x = 17; + x = x * 23 + vendorId; + x = x * 23 + hash(vendorName); + x = x * 23 + hash(deviceName); + x = x * 23 + hash(driverVersion); + hashCode = x; + } + + + ////////////////////////// + // Context Class + ////////////////////////// + + /// + /// Initializes a new instance of the class. + /// + /// The OpenCL context object. + Context::Context(cl_context context) + try : + m_context(context) + { + CALL_STACK_TRACE; + DiscoverDevices(); + } + catch (core::IAppException &) + { + CALL_STACK_TRACE; + OPENCL_IMPORT(clReleaseContext); + cl_int status = clReleaseContext(m_context); + openclErrors.LogErrorWhen(status, "OpenCL API: clReleaseContext", core::Logger::PRIO_ERROR); + } + catch (std::exception &ex) + { + CALL_STACK_TRACE; - ////////////////////////// - // Context Class - ////////////////////////// + OPENCL_IMPORT(clReleaseContext); + cl_int status = clReleaseContext(m_context); + openclErrors.LogErrorWhen(status, "OpenCL API: clReleaseContext", core::Logger::PRIO_ERROR); - /// - /// Initializes a new instance of the class. - /// - /// The OpenCL context object. - Context::Context(cl_context context) - try : - m_context(context) - { - CALL_STACK_TRACE; - DiscoverDevices(); - } - catch (core::IAppException &) - { - CALL_STACK_TRACE; + std::ostringstream oss; + oss << "Generic failure during OpenCL context creation: " << ex.what(); + throw core::AppException(oss.str()); + } - OPENCL_IMPORT(clReleaseContext); - cl_int status = clReleaseContext(m_context); - openclErrors.LogErrorWhen(status, "OpenCL API: clReleaseContext", core::Logger::PRIO_ERROR); - } - catch (std::exception &ex) + /// + /// Finalizes an instance of the class. + /// + Context::~Context() + { + if (m_context != nullptr) { CALL_STACK_TRACE; - OPENCL_IMPORT(clReleaseContext); - cl_int status = clReleaseContext(m_context); - openclErrors.LogErrorWhen(status, "OpenCL API: clReleaseContext", core::Logger::PRIO_ERROR); - - std::ostringstream oss; - oss << "Generic failure during OpenCL context creation: " << ex.what(); - throw core::AppException(oss.str()); - } - - /// - /// Finalizes an instance of the class. - /// - Context::~Context() - { - if (m_context != nullptr) + try { - CALL_STACK_TRACE; - - try - { - OPENCL_IMPORT(clReleaseContext); - cl_int status = clReleaseContext(m_context); - openclErrors.RaiseExceptionWhen(status, "OpenCL API: clReleaseContext"); - } - catch (core::IAppException &ex) - { - core::Logger::Write(ex, core::Logger::PRIO_ERROR); - } + OPENCL_IMPORT(clReleaseContext); + cl_int status = clReleaseContext(m_context); + openclErrors.RaiseExceptionWhen(status, "OpenCL API: clReleaseContext"); + } + catch (core::IAppException &ex) + { + core::Logger::Write(ex, core::Logger::PRIO_ERROR); } } + } + + /// + /// Gets information about the context. + /// + /// The code of the parameter whose information will be requested. + /// Where to store the retrieved information. + void Context::GetContextInfo(cl_context_info paramCode, GenericParam ¶m) const + { + CALL_STACK_TRACE; + + OPENCL_IMPORT(clGetContextInfo); + cl_int status = clGetContextInfo(m_context, + paramCode, + param.size, + param.value, + ¶m.sizeRet); + + openclErrors.RaiseExceptionWhen(status, "OpenCL API: clGetContextInfo"); + } + + /// + /// Discovers all the devices for the current platform. + /// + void Context::DiscoverDevices() + { + CALL_STACK_TRACE; - /// - /// Gets information about the context. - /// - /// The code of the parameter whose information will be requested. - /// Where to store the retrieved information. - void Context::GetContextInfo(cl_context_info paramCode, GenericParam ¶m) const - { - CALL_STACK_TRACE; + cl_uint qtDevices; + GenericParam param; + param.Set(qtDevices); + GetContextInfo(CL_CONTEXT_NUM_DEVICES, param); - OPENCL_IMPORT(clGetContextInfo); - cl_int status = clGetContextInfo(m_context, - paramCode, - param.size, - param.value, - ¶m.sizeRet); + m_devices.resize(qtDevices); + param.Set(m_devices[0]); + GetContextInfo(CL_CONTEXT_DEVICES, param); - openclErrors.RaiseExceptionWhen(status, "OpenCL API: clGetContextInfo"); + // Retrieve and keep some key information about the devices: + for (auto deviceId : m_devices) + { + auto devInfo = DeviceInfo2(deviceId); + auto devHashCode = devInfo.info.hashCode; + m_devicesInfo.emplace(devHashCode, std::move(devInfo)); } + } + + /// + /// Gets the source code of a program from a text file. + /// + /// Name of the file. + /// Where to store the source code lines. + void Context::GetSourceCode(const string &fileName, + std::deque &sourceCodeLines) + { + CALL_STACK_TRACE; - /// - /// Discovers all the devices for the current platform. - /// - void Context::DiscoverDevices() + try { - CALL_STACK_TRACE; - - cl_uint qtDevices; - GenericParam param; - param.Set(qtDevices); - GetContextInfo(CL_CONTEXT_NUM_DEVICES, param); - - m_devices.resize(qtDevices); - param.Set(m_devices[0]); - GetContextInfo(CL_CONTEXT_DEVICES, param); + std::ifstream sourceCodeStream(fileName, std::ios::binary); - // Retrieve and keep some key information about the devices: - for (auto deviceId : m_devices) + if (sourceCodeStream.is_open() == false) { - auto devInfo = DeviceInfo2(deviceId); - auto devHashCode = devInfo.info.hashCode; - m_devicesInfo.emplace(devHashCode, std::move(devInfo)); + std::ostringstream oss; + oss << "Source code file was \'" << fileName << '\''; + throw core::AppException("Could not open the source code file of an OpenCL program", oss.str()); } - } - /// - /// Gets the source code of a program from a text file. - /// - /// Name of the file. - /// Where to store the source code lines. - void Context::GetSourceCode(const string &fileName, - std::deque &sourceCodeLines) - { - CALL_STACK_TRACE; + std::vector line(core::AppConfig::GetSettings().framework.opencl.maxSourceCodeLineLength); - try + while (sourceCodeStream.eof() == false) { - std::ifstream sourceCodeStream(fileName, std::ios::binary); - - if (sourceCodeStream.is_open() == false) + if (sourceCodeStream.getline(line.data(), line.size()).bad()) { std::ostringstream oss; oss << "Source code file was \'" << fileName << '\''; - throw core::AppException("Could not open the source code file of an OpenCL program", oss.str()); - } - - std::vector line(core::AppConfig::GetSettings().framework.opencl.maxSourceCodeLineLength); - - while (sourceCodeStream.eof() == false) - { - if (sourceCodeStream.getline(line.data(), line.size()).bad()) - { - std::ostringstream oss; - oss << "Source code file was \'" << fileName << '\''; - throw core::AppException("Error reading the source code file of an OpenCL program", oss.str()); - } - - sourceCodeLines.push_back(string(line.data())); + throw core::AppException("Error reading the source code file of an OpenCL program", oss.str()); } - sourceCodeStream.close(); - } - catch (core::IAppException &) - { - throw; // just forward exceptions regarding errors known to have been previously handled - } - catch (std::exception &ex) - { - std::ostringstream oss; - oss << "Generic failure when reading OpenCL program source code: " << ex.what(); - throw core::AppException(oss.str()); + sourceCodeLines.push_back(string(line.data())); } + + sourceCodeStream.close(); + } + catch (core::IAppException &) + { + throw; // just forward exceptions regarding errors known to have been previously handled + } + catch (std::exception &ex) + { + std::ostringstream oss; + oss << "Generic failure when reading OpenCL program source code: " << ex.what(); + throw core::AppException(oss.str()); } + } + + /// + /// Compiles the program from the source code. + /// + /// Source code file path. + /// The OpenCL program object for the given source. + cl_program Context::CreateProgramFromSourceCode(const string &sourceCodeFilePath) + { + CALL_STACK_TRACE; - /// - /// Compiles the program from the source code. - /// - /// Source code file path. - /// The OpenCL program object for the given source. - cl_program Context::CreateProgramFromSourceCode(const string &sourceCodeFilePath) + try { - CALL_STACK_TRACE; + // Get the source code separated in lines: + std::deque sourceCodeLines; + GetSourceCode(sourceCodeFilePath, sourceCodeLines); + std::vector sourceCodeLinePointers(sourceCodeLines.size()); - try + size_t index(0); + std::generate(sourceCodeLinePointers.begin(), sourceCodeLinePointers.end(), [&index, &sourceCodeLines]() { - // Get the source code separated in lines: - std::deque sourceCodeLines; - GetSourceCode(sourceCodeFilePath, sourceCodeLines); - std::vector sourceCodeLinePointers(sourceCodeLines.size()); + return sourceCodeLines[index++].c_str(); + }); - size_t index(0); - std::generate(sourceCodeLinePointers.begin(), sourceCodeLinePointers.end(), [&index, &sourceCodeLines]() - { - return sourceCodeLines[index++].c_str(); - }); - - // Create a program from the source: + // Create a program from the source: - OPENCL_IMPORT(clCreateProgramWithSource); - cl_int status; - cl_program program = clCreateProgramWithSource(m_context, - sourceCodeLinePointers.size(), - sourceCodeLinePointers.data(), - nullptr, - &status); + OPENCL_IMPORT(clCreateProgramWithSource); + cl_int status; + cl_program program = clCreateProgramWithSource(m_context, + sourceCodeLinePointers.size(), + sourceCodeLinePointers.data(), + nullptr, + &status); - openclErrors.RaiseExceptionWhen(status, "OpenCL API: clCreateProgramWithSource"); + openclErrors.RaiseExceptionWhen(status, "OpenCL API: clCreateProgramWithSource"); - return program; - } - catch (core::IAppException &) - { - throw; // just forward exceptions regarding errors known to have been previously handled - } - catch (std::exception &ex) - { - std::ostringstream oss; - oss << "Generic failure when creating OpenCL program from source code: " << ex.what(); - throw core::AppException(oss.str()); - } + return program; } - - /// - /// Reads the program manifest file and load program binaries from disk. - /// - /// Path to the OpenCL program manifest file. - /// - /// The OpenCL program created from the binary files, or 'nullptr' if the devices - /// described in the manifest did not match the ones in the current context. - /// - /// - /// The manifest has XML content describing the devices for which the program has previously been compiled, - /// and the names of such binary files. This method will load only the binaries for devices that exist in - /// the current context. If any loaded binary is no longer valid for its device for some reason (eg.: driver - /// update), that is reported in the log and the resulting program will lack a binary for such device. When - /// none of the loaded binaries is valid, that is considered and error and than the method throws an exception. - /// - cl_program Context::CreateProgramWithBinaries(const string &manifestFilePath) + catch (core::IAppException &) { - CALL_STACK_TRACE; + throw; // just forward exceptions regarding errors known to have been previously handled + } + catch (std::exception &ex) + { + std::ostringstream oss; + oss << "Generic failure when creating OpenCL program from source code: " << ex.what(); + throw core::AppException(oss.str()); + } + } + + /// + /// Reads the program manifest file and load program binaries from disk. + /// + /// Path to the OpenCL program manifest file. + /// + /// The OpenCL program created from the binary files, or 'nullptr' if the devices + /// described in the manifest did not match the ones in the current context. + /// + /// + /// The manifest has XML content describing the devices for which the program has previously been compiled, + /// and the names of such binary files. This method will load only the binaries for devices that exist in + /// the current context. If any loaded binary is no longer valid for its device for some reason (eg.: driver + /// update), that is reported in the log and the resulting program will lack a binary for such device. When + /// none of the loaded binaries is valid, that is considered and error and than the method throws an exception. + /// + cl_program Context::CreateProgramWithBinaries(const string &manifestFilePath) + { + CALL_STACK_TRACE; - try + try + { + // Load meta data from the program manifest: + auto manifest = ProgramManifest::LoadFrom(manifestFilePath); + auto &devsInfo = manifest.GetDeviceProgramsInfo(); + + std::vector devicesIds; // the ID of each device whose binary will be loaded + std::vector devicesHashCodes; // the hash codes for such devices + std::vector> binariesSmartPtrs; // automatically deallocates... + std::vector binariesCPtrs; // ... the buffers holding the binaries + std::vector binariesSizes; // and the sizes of the buffers + + // Reserve memory for the parameters: + const auto maxQtDevices = devsInfo.size(); + binariesSizes.reserve(maxQtDevices); + binariesCPtrs.reserve(maxQtDevices); + binariesSmartPtrs.reserve(maxQtDevices); + devicesHashCodes.reserve(maxQtDevices); + devicesIds.reserve(maxQtDevices); + + // For each binary compiled for a given device: + for (auto &info : devsInfo) { - // Load meta data from the program manifest: - auto manifest = ProgramManifest::LoadFrom(manifestFilePath); - auto &devsInfo = manifest.GetDeviceProgramsInfo(); - - std::vector devicesIds; // the ID of each device whose binary will be loaded - std::vector devicesHashCodes; // the hash codes for such devices - std::vector> binariesSmartPtrs; // automatically deallocates... - std::vector binariesCPtrs; // ... the buffers holding the binaries - std::vector binariesSizes; // and the sizes of the buffers - - // Reserve memory for the parameters: - const auto maxQtDevices = devsInfo.size(); - binariesSizes.reserve(maxQtDevices); - binariesCPtrs.reserve(maxQtDevices); - binariesSmartPtrs.reserve(maxQtDevices); - devicesHashCodes.reserve(maxQtDevices); - devicesIds.reserve(maxQtDevices); - - // For each binary compiled for a given device: - for (auto &info : devsInfo) + // Check whether the device that the binary has been compiled to belongs this context: + auto iter = m_devicesInfo.find(info.deviceInfo.hashCode); + if (m_devicesInfo.end() != iter) { - // Check whether the device that the binary has been compiled to belongs this context: - auto iter = m_devicesInfo.find(info.deviceInfo.hashCode); - if (m_devicesInfo.end() != iter) - { - devicesIds.push_back(iter->second.id); - devicesHashCodes.push_back(iter->second.info.hashCode); - } - else - continue; + devicesIds.push_back(iter->second.id); + devicesHashCodes.push_back(iter->second.info.hashCode); + } + else + continue; - // Open binary program file: - std::ifstream ifs(info.fileName, std::ios::binary); + // Open binary program file: + std::ifstream ifs(info.fileName, std::ios::binary); - if (ifs.is_open() == false) - throw core::AppException("Could not open OpenCL binary program file", info.fileName); + if (ifs.is_open() == false) + throw core::AppException("Could not open OpenCL binary program file", info.fileName); - // Get the file size: - auto qtBytes = static_cast (ifs.seekg(0, std::ios::end).tellg()); - ifs.seekg(0, std::ios::beg); // rewind + // Get the file size: + auto qtBytes = static_cast (ifs.seekg(0, std::ios::end).tellg()); + ifs.seekg(0, std::ios::beg); // rewind - // Read the file: - auto buffer = new uint8_t[qtBytes]; - binariesSmartPtrs.emplace_back(buffer); - binariesCPtrs.push_back(buffer); - binariesSizes.push_back(qtBytes); - ifs.read(reinterpret_cast (buffer), qtBytes); - _ASSERTE(ifs.gcount() == qtBytes); // it has to read all the file at once + // Read the file: + auto buffer = new uint8_t[qtBytes]; + binariesSmartPtrs.emplace_back(buffer); + binariesCPtrs.push_back(buffer); + binariesSizes.push_back(qtBytes); + ifs.read(reinterpret_cast (buffer), qtBytes); + _ASSERTE(ifs.gcount() == qtBytes); // it has to read all the file at once - if (ifs.bad()) - throw core::AppException("Failure when reading OpenCL binary program file", info.fileName); - } + if (ifs.bad()) + throw core::AppException("Failure when reading OpenCL binary program file", info.fileName); + } + + // this will receive status of creating a program for loaded binary: + std::vector binariesStatus(devicesIds.size()); + + // Finally create the program: + OPENCL_IMPORT(clCreateProgramWithBinary); + cl_int status; + cl_program program = clCreateProgramWithBinary(m_context, + devicesIds.size(), + devicesIds.data(), + binariesSizes.data(), + binariesCPtrs.data(), + binariesStatus.data(), + &status); + + // Release some significant amount of memory: + binariesSmartPtrs.clear(); + binariesCPtrs.clear(); // this here just to avoid dangling pointers :) + + // How many and what loaded binaries were successfull for creating the program? + if (status == CL_SUCCESS || status == CL_INVALID_BINARY) + { + std::ostringstream oss; - // this will receive status of creating a program for loaded binary: - std::vector binariesStatus(devicesIds.size()); - - // Finally create the program: - OPENCL_IMPORT(clCreateProgramWithBinary); - cl_int status; - cl_program program = clCreateProgramWithBinary( - m_context, - devicesIds.size(), - devicesIds.data(), - binariesSizes.data(), - binariesCPtrs.data(), - binariesStatus.data(), - &status); - - // Release some significant amount of memory: - binariesSmartPtrs.clear(); - binariesCPtrs.clear(); // this here just to avoid dangling pointers :) - - // How many and what loaded binaries were successfull for creating the program? - if (status == CL_SUCCESS || status == CL_INVALID_BINARY) + // Check the build of each binary: + int successCount(0); + for (int idx = 0; idx < binariesStatus.size(); ++idx) { - std::ostringstream oss; + auto devHashCode = devicesHashCodes[idx]; // hash code for the device associated with the binary + auto &devInfo = m_devicesInfo.find(devHashCode)->second; // information regarding such device + auto binSta = binariesStatus[idx]; // the status of program creation for such binary - // Check the build of each binary: - int successCount(0); - for (int idx = 0; idx < binariesStatus.size(); ++idx) - { - auto devHashCode = devicesHashCodes[idx]; // hash code for the device associated with the binary - auto &devInfo = m_devicesInfo.find(devHashCode)->second; // information regarding such device - auto binSta = binariesStatus[idx]; // the status of program creation for such binary - - if (binSta == CL_SUCCESS) - {// Log success with the binary for this device: - ++successCount; - - oss << "Successfully created from binary files the OpenCL program \'" << manifest.GetProgramName() - << "\' for the device \"" << devInfo.info.vendorName - << " / " << devInfo.info.deviceName - << " [" << devInfo.info.driverVersion << "]\""; - - core::Logger::Write(oss.str(), core::Logger::PRIO_INFORMATION); - oss.str(""); - } - else - {// Log failure with the binary for this device: - oss << "Could not create from binary files the OpenCL program \'" << manifest.GetProgramName() - << "\' for the device \"" << devInfo.info.vendorName - << " / " << devInfo.info.deviceName - << " [" << devInfo.info.driverVersion << "]\": invalid binary"; - - core::Logger::Write(oss.str(), core::Logger::PRIO_WARNING); - oss.str(""); - } - } + if (binSta == CL_SUCCESS) + {// Log success with the binary for this device: + ++successCount; - // If no loaded binary could be used: - if (successCount == 0) - { - oss << "Could not create OpenCL program \'" << manifest.GetProgramName() - << "\' from binary files because there was no match between the devices" - " in the current context and the ones described in the manifest file."; + oss << "Successfully created from binary files the OpenCL program \'" << manifest.GetProgramName() + << "\' for the device \"" << devInfo.info.vendorName + << " / " << devInfo.info.deviceName + << " [" << devInfo.info.driverVersion << "]\""; - core::Logger::Write(oss.str(), core::Logger::PRIO_ERROR); - return nullptr; + core::Logger::Write(oss.str(), core::Logger::PRIO_INFORMATION); + oss.str(""); + } + else + {// Log failure with the binary for this device: + oss << "Could not create from binary files the OpenCL program \'" << manifest.GetProgramName() + << "\' for the device \"" << devInfo.info.vendorName + << " / " << devInfo.info.deviceName + << " [" << devInfo.info.driverVersion << "]\": invalid binary"; + + core::Logger::Write(oss.str(), core::Logger::PRIO_WARNING); + oss.str(""); } } - else // in case of a more serious error: - openclErrors.RaiseExceptionWhen(status, "OpenCL API: clCreateProgramWithBinary"); - return program; - } - catch (core::IAppException &) - { - throw; // just forward exceptions regarding errors known to have been previously handled - } - catch (std::exception &ex) - { - std::ostringstream oss; - oss << "Generic failure when creating OpenCL program from binaries: " << ex.what(); - throw core::AppException(oss.str()); + // If no loaded binary could be used: + if (successCount == 0) + { + oss << "Could not create OpenCL program \'" << manifest.GetProgramName() + << "\' from binary files because there was no match between the devices" + " in the current context and the ones described in the manifest file."; + + core::Logger::Write(oss.str(), core::Logger::PRIO_ERROR); + return nullptr; + } } + else // in case of a more serious error: + openclErrors.RaiseExceptionWhen(status, "OpenCL API: clCreateProgramWithBinary"); + + return program; } + catch (core::IAppException &) + { + throw; // just forward exceptions regarding errors known to have been previously handled + } + catch (std::exception &ex) + { + std::ostringstream oss; + oss << "Generic failure when creating OpenCL program from binaries: " << ex.what(); + throw core::AppException(oss.str()); + } + } + + /// + /// Checks the status of the compilation process. + /// + /// The compiled OpenCL program. + void Context::CheckBuildStatus(cl_program program) + { + CALL_STACK_TRACE; - /// - /// Checks the status of the compilation process. - /// - /// The compiled OpenCL program. - void Context::CheckBuildStatus(cl_program program) + // Get information from the building process: + try { - CALL_STACK_TRACE; + cl_int status; + cl_build_status buildStatus; + OPENCL_IMPORT(clGetProgramBuildInfo); - // Get information from the building process: - try + for (cl_uint index = 0; index < m_devices.size(); ++index) { - cl_int status; - cl_build_status buildStatus; - OPENCL_IMPORT(clGetProgramBuildInfo); + status = clGetProgramBuildInfo(program, + m_devices[index], + CL_PROGRAM_BUILD_STATUS, + sizeof(cl_build_status), + static_cast (&buildStatus), + nullptr); - for (cl_uint index = 0; index < m_devices.size(); ++index) - { - status = clGetProgramBuildInfo(program, - m_devices[index], - CL_PROGRAM_BUILD_STATUS, - sizeof(cl_build_status), - static_cast (&buildStatus), - nullptr); + openclErrors.RaiseExceptionWhen(status, "OpenCL API: clGetProgramBuildInfo"); - openclErrors.RaiseExceptionWhen(status, "OpenCL API: clGetProgramBuildInfo"); - - if (buildStatus == CL_BUILD_ERROR) - { - std::vector buildLog(core::AppConfig::GetSettings().framework.opencl.maxBuildLogSize); + if (buildStatus == CL_BUILD_ERROR) + { + std::vector buildLog(core::AppConfig::GetSettings().framework.opencl.maxBuildLogSize); - size_t qtCharacters; + size_t qtCharacters; - status = clGetProgramBuildInfo(program, - m_devices[index], - CL_PROGRAM_BUILD_LOG, - sizeof(char) * buildLog.size(), - static_cast (buildLog.data()), - &qtCharacters); + status = clGetProgramBuildInfo(program, + m_devices[index], + CL_PROGRAM_BUILD_LOG, + sizeof(char) * buildLog.size(), + static_cast (buildLog.data()), + &qtCharacters); - throw core::AppException("Failed to build an OpenCL program", string(buildLog.data())); - } + throw core::AppException("Failed to build an OpenCL program", string(buildLog.data())); } } - catch (core::IAppException &) - { - throw; // just forward exceptions regarding errors known to have been previously handled - } - catch (std::exception &ex) - { - std::ostringstream oss; - oss << "Generic failure when retrieving OpenCL program build information: " << ex.what(); - throw core::AppException(oss.str()); - } } - - /// - /// Gets a device from the current context. - /// - /// The index of the device to get. - /// The properties for the command queue of the device. - /// A new object. - std::unique_ptr Context::GetDevice(cl_uint index, cl_command_queue_properties properties) const + catch (core::IAppException &) { - CALL_STACK_TRACE; + throw; // just forward exceptions regarding errors known to have been previously handled + } + catch (std::exception &ex) + { + std::ostringstream oss; + oss << "Generic failure when retrieving OpenCL program build information: " << ex.what(); + throw core::AppException(oss.str()); + } + } + + /// + /// Gets a device from the current context. + /// + /// The index of the device to get. + /// The properties for the command queue of the device. + /// A new object. + std::unique_ptr Context::GetDevice(cl_uint index, cl_command_queue_properties properties) const + { + CALL_STACK_TRACE; - _ASSERTE(m_devices.size() > index); // The specified device index is not valid + _ASSERTE(m_devices.size() > index); // The specified device index is not valid - try - { - return std::unique_ptr( - new Device(m_devices[index], m_context, properties) - ); - } - catch (core::IAppException &) - { - throw; // just forward the exceptions referring to error know to have been previously handled - } - catch (std::exception &ex) - { - std::ostringstream oss; - oss << "Generic failure when getting an OpenCL device: " << ex.what(); - throw core::AppException(oss.str()); - } + try + { + return std::unique_ptr( + new Device(m_devices[index], m_context, properties) + ); } - - /// - /// Builds an OpenCL program from its source code. - /// - /// Name of the source code file. - /// The build options. - /// A compiled OpenCL program. - std::unique_ptr Context::BuildProgramFromSource(const string &sourceCodeFilePath, const string &buildOptions) + catch (core::IAppException &) + { + throw; // just forward the exceptions referring to error know to have been previously handled + } + catch (std::exception &ex) { - CALL_STACK_TRACE; - - try - { - cl_program program = CreateProgramFromSourceCode(sourceCodeFilePath); - - // Build the program for all the devices associated to the context: - OPENCL_IMPORT(clBuildProgram); - cl_int status = clBuildProgram( - program, - 0, - nullptr, // build for all devices referred by the program - buildOptions.c_str(), - nullptr, // no callback, because this call is synchronous - nullptr); - - // Check the status of the build process: - if (status != CL_SUCCESS) - CheckBuildStatus(program); - - return std::unique_ptr(new Program(program)); - } - catch (core::IAppException &) - { - throw; // just forward the exceptions referring to error know to have been previously handled - } - catch (std::exception &ex) - { - std::ostringstream oss; - oss << "Generic failure when building OpenCL program from source: " << ex.what(); - throw core::AppException(oss.str()); - } + std::ostringstream oss; + oss << "Generic failure when getting an OpenCL device: " << ex.what(); + throw core::AppException(oss.str()); } + } + + /// + /// Builds an OpenCL program from its source code. + /// + /// Name of the source code file. + /// The build options. + /// A compiled OpenCL program. + std::unique_ptr Context::BuildProgramFromSource(const string &sourceCodeFilePath, const string &buildOptions) + { + CALL_STACK_TRACE; - /// - /// Builds an OpenCL program from its binaries. - /// - /// The file path to the program manifest. - /// The build options. - /// - /// An OpenCL program retrieved from previously compiled code, or 'nullptr' if - /// the devices described in the manifest did not match the ones in the current context. - /// - /// - /// The manifest has XML content describing the devices for which the program has previously been compiled, - /// and the names of such binary files. This method will load only the binaries for devices that exist in - /// the current context. If any loaded binary is no longer valid for its device for some reason (eg.: driver - /// update), that is reported in the log and the resulting program will lack a binary for such device. When - /// none of the loaded binaries is valid, that is considered and error and than the method throws an exception. - /// - std::unique_ptr Context::BuildProgramWithBinaries(const string &manifestFilePath, const string &buildOptions) + try { - CALL_STACK_TRACE; - - try - { - cl_program program = CreateProgramWithBinaries(manifestFilePath); - - // Build the program for all the devices associated to the context: - OPENCL_IMPORT(clBuildProgram); - cl_int status = clBuildProgram( - program, - 0, - nullptr, // build for all devices referred by the program - buildOptions.c_str(), - nullptr, // no callback, because this call is synchronous - nullptr); - - // Check the status of the build process: - if (status != CL_SUCCESS) - CheckBuildStatus(program); - - return std::unique_ptr(new Program(program)); - } - catch (core::IAppException &) - { - throw; // just forward the exceptions referring to error know to have been previously handled - } - catch (std::exception &ex) - { - std::ostringstream oss; - oss << "Generic failure when building OpenCL program from binary files: " << ex.what(); - throw core::AppException(oss.str()); - } + cl_program program = CreateProgramFromSourceCode(sourceCodeFilePath); + + // Build the program for all the devices associated to the context: + OPENCL_IMPORT(clBuildProgram); + cl_int status = clBuildProgram(program, + 0, + nullptr, // build for all devices referred by the program + buildOptions.c_str(), + nullptr, // no callback, because this call is synchronous + nullptr); + + // Check the status of the build process: + if (status != CL_SUCCESS) + CheckBuildStatus(program); + + return std::unique_ptr(new Program(program)); } + catch (core::IAppException &) + { + throw; // just forward the exceptions referring to error know to have been previously handled + } + catch (std::exception &ex) + { + std::ostringstream oss; + oss << "Generic failure when building OpenCL program from source: " << ex.what(); + throw core::AppException(oss.str()); + } + } + + /// + /// Builds an OpenCL program from its binaries. + /// + /// The file path to the program manifest. + /// The build options. + /// + /// An OpenCL program retrieved from previously compiled code, or 'nullptr' if + /// the devices described in the manifest did not match the ones in the current context. + /// + /// + /// The manifest has XML content describing the devices for which the program has previously been compiled, + /// and the names of such binary files. This method will load only the binaries for devices that exist in + /// the current context. If any loaded binary is no longer valid for its device for some reason (eg.: driver + /// update), that is reported in the log and the resulting program will lack a binary for such device. When + /// none of the loaded binaries is valid, that is considered and error and than the method throws an exception. + /// + std::unique_ptr Context::BuildProgramWithBinaries(const string &manifestFilePath, const string &buildOptions) + { + CALL_STACK_TRACE; - /// - /// Creates an OpenCL buffer. - /// - /// The size in bytes of the buffer. - /// The flags that define whether the buffer is input and/or output and how it will be initialized. - /// Address for memory in the host, where data will either be copied from or stored in. - /// An OpenCL buffer (memory object). - Buffer Context::CreateBuffer(size_t nBytes, cl_mem_flags flags, void *hostPtr) + try { - CALL_STACK_TRACE; + cl_program program = CreateProgramWithBinaries(manifestFilePath); + + // Build the program for all the devices associated to the context: + OPENCL_IMPORT(clBuildProgram); + cl_int status = clBuildProgram(program, + 0, + nullptr, // build for all devices referred by the program + buildOptions.c_str(), + nullptr, // no callback, because this call is synchronous + nullptr); + + // Check the status of the build process: + if (status != CL_SUCCESS) + CheckBuildStatus(program); + + return std::unique_ptr(new Program(program)); + } + catch (core::IAppException &) + { + throw; // just forward the exceptions referring to error know to have been previously handled + } + catch (std::exception &ex) + { + std::ostringstream oss; + oss << "Generic failure when building OpenCL program from binary files: " << ex.what(); + throw core::AppException(oss.str()); + } + } + + /// + /// Creates an OpenCL buffer. + /// + /// The size in bytes of the buffer. + /// The flags that define whether the buffer is input and/or output and how it will be initialized. + /// Address for memory in the host, where data will either be copied from or stored in. + /// An OpenCL buffer (memory object). + Buffer Context::CreateBuffer(size_t nBytes, cl_mem_flags flags, void *hostPtr) + { + CALL_STACK_TRACE; - OPENCL_IMPORT(clCreateBuffer); - cl_int status; - cl_mem buffer = clCreateBuffer( - m_context, - flags, - nBytes, - hostPtr, - &status); + OPENCL_IMPORT(clCreateBuffer); + cl_int status; + cl_mem buffer = clCreateBuffer(m_context, + flags, + nBytes, + hostPtr, + &status); - openclErrors.RaiseExceptionWhen(status, "OpenCL API: clCreateBuffer"); + openclErrors.RaiseExceptionWhen(status, "OpenCL API: clCreateBuffer"); - return Buffer(buffer, nBytes); - } + return Buffer(buffer, nBytes); + } - }// end of namespace opencl +}// end of namespace opencl }// end of namespace _3fd diff --git a/3FD/preprocessing.h b/3FD/preprocessing.h index d3f99f0..616a609 100644 --- a/3FD/preprocessing.h +++ b/3FD/preprocessing.h @@ -9,11 +9,10 @@ # define __FUNCTION__ __PRETTY_FUNCTION__ #endif -#ifdef _MSC_VER -// Microsoft Visual Studio: -# define INTFOPT __declspec(novtable) // CHANGE THIS DEFINITION ACCORDING TO YOUR COMPILER (or leave it blank) +#ifdef _MSC_VER // Microsoft Visual Studio: +# define INTFOPT __declspec(novtable) -# if _MSC_VER < 19000 +# if _MSC_VER < 1900 # define NOEXCEPT throw() # define thread_local_decl __declspec(thread) # define thread_local_def @@ -23,7 +22,7 @@ # define thread_local_def thread_local # endif #else -// Other Compilers: + // Other Compilers: # define INTFOPT # define _ASSERTE assert # include @@ -34,22 +33,28 @@ // Platform support for particular modules/features/resources: #ifdef _WIN32 -# include -# if WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP // Windows Desktop Apps only: +# ifndef _USING_V110_SDK71_ +# include +# endif +# if WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP || defined _USING_V110_SDK71_ + // Windows Desktop Apps only: # define _3FD_PLATFORM_WIN32API # define _3FD_POCO_SUPPORT # define _3FD_ESENT_SUPPORT # define _3FD_OPENCL_SUPPORT # define _3FD_CONSOLE_AVAILABLE # elif defined WINAPI_FAMILY_SYSTEM + // UWP Apps only: # define _3FD_PLATFORM_WINRT # define _3FD_PLATFORM_WINRT_UWP # define _3FD_ESENT_SUPPORT -# elif WINAPI_FAMILY == WINAPI_FAMILY_PC_APP // Windows Store Apps (& UWP) only: +# elif WINAPI_FAMILY == WINAPI_FAMILY_PC_APP + // Windows Store Apps (& UWP) only: # define _3FD_PLATFORM_WINRT # define _3FD_PLATFORM_WINRT_PC # define _3FD_ESENT_SUPPORT -# elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP // Windows Phone 8 Store Apps only: +# elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP + // Windows Phone 8 Store Apps only: # define _3FD_PLATFORM_WINRT # define _3FD_PLATFORM_WINRT_PHONE # endif @@ -65,7 +70,7 @@ // These instructions have they definition depending on whether this is a release compilation: #ifdef NDEBUG -# if defined _MSC_VER && _MSC_VER < 19000 +# if defined _MSC_VER && _MSC_VER < 1900 # define NOEXCEPT throw() # else # define NOEXCEPT noexcept @@ -83,7 +88,6 @@ # include # endif -# define dbgexhnd # define RELEASE_DEBUG_SWITCH(STATEMENT1, STATEMENT2) STATEMENT2 # define ONDEBUG(CODE_LINE) CODE_LINE #endif diff --git a/3FD/rpc_helpers.h b/3FD/rpc_helpers.h index 800b095..566d961 100644 --- a/3FD/rpc_helpers.h +++ b/3FD/rpc_helpers.h @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -57,6 +58,7 @@ namespace rpc Delegate = RPC_C_IMP_LEVEL_DELEGATE }; + /// /// Holds information that describes a X.509 certificate to use with SCHANNEL SSP. /// @@ -105,6 +107,7 @@ namespace rpc {} }; + /// /// Holds a definition for a particular RPC interface implementation. /// @@ -137,6 +140,7 @@ namespace rpc {} }; + class RpcServerImpl; /// @@ -185,16 +189,17 @@ namespace rpc static bool Wait(); - static bool Finalize() noexcept; + static bool Finalize() NOEXCEPT; }; + class SChannelCredWrapper; /// /// Implements an RPC client that provides an explicit binding handle /// to use as parameter for client stub code generated by the MIDL compiler. - /// Client code is expected to derive from this class and call - /// in order to obtain an explicit binding handle. + /// Client code must derive from this class and use + /// to wrap the stub calls with error handling. /// class RpcClient : notcopiable { @@ -202,8 +207,12 @@ namespace rpc rpc_binding_handle_t m_bindingHandle; + string m_endpoint; + std::unique_ptr m_schannelCred; + std::atomic m_isOnHold; + protected: /// @@ -212,6 +221,8 @@ namespace rpc /// The explicit binding handle expected as parameter for RPC. rpc_binding_handle_t GetBindingHandle() const { return m_bindingHandle; } + void Call(const char *tag, const std::function &rpc); + public: RpcClient( @@ -245,6 +256,7 @@ namespace rpc void ResetBindings(); }; + /// /// Uses RAII to define a scope where impersonation takes place. /// @@ -260,31 +272,6 @@ namespace rpc ~ScopedImpersonation(); }; - ///////////////////////// - // Error Helpers - ///////////////////////// - - void ThrowIfError(RPC_STATUS status, const char *message); - - void ThrowIfError( - RPC_STATUS status, - const char *message, - const string &details - ); - - void LogIfError( - RPC_STATUS status, - const char *message, - core::Logger::Priority prio - ) noexcept; - - void LogIfError( - RPC_STATUS status, - const char *message, - const string &details, - core::Logger::Priority prio - ) noexcept; - }// end of namespace rpc }// end of namespace _3fd diff --git a/3FD/rpc_impl_client.cpp b/3FD/rpc_impl_client.cpp index 80ca2d3..8630205 100644 --- a/3FD/rpc_impl_client.cpp +++ b/3FD/rpc_impl_client.cpp @@ -1,461 +1,689 @@ -#include "stdafx.h" -#include "rpc_helpers.h" -#include "rpc_impl_util.h" -#include "callstacktracer.h" -#include "logger.h" - -#include -#include -#include - -namespace _3fd -{ -namespace rpc -{ - ///////////////////////// - // RpcClient Class - ///////////////////////// - - /// - /// Releases resources of a RPC client binding handle. - /// - /// The given RPC binding handle. - static void HelpFreeBindingHandle(rpc_binding_handle_t *bindingHandle) - { - CALL_STACK_TRACE; - - if (*bindingHandle == nullptr) - return; - - auto status = RpcBindingFree(bindingHandle); - - LogIfError(status, - "Failed to release resources from binding handle of RPC client", - core::Logger::Priority::PRIO_CRITICAL); - } - - /// - /// Initializes a new instance of the class. - /// This is a basic constructor that sets everything but security options. - /// - /// The transport to use for RPC. - /// The UUID of the object in the RPC server. An empty string - /// is equivalent to a nil UUID, which is valid as long as the endpoint is specified. - /// The destination: local RPC requires the machine name, - /// while for TCP this is the network address (IP or host name). - /// The authentication level to use. - /// The endpoint: for local RPC is the application or service - /// name, while for TCP this is the port number. Specifying the endpoint is optional - /// if the server has registered its bindings with the endpoint mapper. - RpcClient::RpcClient(ProtocolSequence protSeq, - const string &objUUID, - const string &destination, - const string &endpoint) - try : - m_bindingHandle(nullptr) - { - CALL_STACK_TRACE; - - // Prepare text parameters encoded in UCS-2 - std::wstring_convert> transcoder; - - std::wstring ucs2objUuid; - RPC_WSTR paramObjUuid; - - if (objUUID.empty() || objUUID == "") - paramObjUuid = nullptr; - else - { - ucs2objUuid = transcoder.from_bytes(objUUID); - paramObjUuid = const_cast (ucs2objUuid.c_str()); - } - - std::wstring protSeqName = transcoder.from_bytes(ToString(protSeq)); - auto paramProtSeq = const_cast (protSeqName.c_str()); - - std::wstring ucs2Destination = transcoder.from_bytes(destination); - auto paramNetwAddr = const_cast (ucs2Destination.c_str()); - - std::wstring ucs2Endpoint; - RPC_WSTR paramEndpoint; - - if (endpoint.empty() || endpoint == "") - paramEndpoint = nullptr; - else - { - ucs2Endpoint = transcoder.from_bytes(endpoint); - paramEndpoint = const_cast (ucs2Endpoint.c_str()); - } - - // Compose the binding string: - RPC_WSTR bindingString; - auto status = RpcStringBindingComposeW( - paramObjUuid, - paramProtSeq, - paramNetwAddr, - paramEndpoint, - nullptr, - &bindingString - ); - - ThrowIfError(status, "Failed to compose binding string for RPC client"); - - // Create a binding handle from the composed string: - status = RpcBindingFromStringBindingW(bindingString, &m_bindingHandle); - - // Release the memory allocated for the binding string: - LogIfError( - RpcStringFreeW(&bindingString), - "Failed to release resources of binding string for RPC client", - core::Logger::Priority::PRIO_CRITICAL - ); - - ThrowIfError(status, "Failed to create binding handle for RPC client"); - - // Notify establishment of binding with this protocol sequence: - std::ostringstream oss; - oss << "RPC client for object " << objUUID << " in " << destination - << " will use protocol sequence '" << ToString(protSeq) << '\''; - - core::Logger::Write(oss.str(), core::Logger::PRIO_NOTICE); - } - catch (core::IAppException &ex) - { - CALL_STACK_TRACE; - HelpFreeBindingHandle(&m_bindingHandle); - throw core::AppException("Failed to instantiate RPC client", ex); - } - catch (std::exception &ex) - { - CALL_STACK_TRACE; - HelpFreeBindingHandle(&m_bindingHandle); - std::ostringstream oss; - oss << "Generic failure when instantiating RPC client: " << ex.what(); - throw core::AppException(oss.str()); - } - - /// - /// Initializes a new instance of the class - /// for security options of Windows SSP packages only (NTLM & Kerberos). - /// - /// The transport to use for RPC. - /// The UUID of the object in the RPC server. An empty string - /// is equivalent to a nil UUID, which is valid as long as the endpoint is specified. - /// The destination: local RPC requires the machine name, - /// while for TCP this is the network address (IP or host name). - /// The authentication security package to use. Because - /// local RPC does not support Kerberos, the requirement of mutual authentication will - /// cause NTLM to use SPN's registered in AD. This parameter is ignored if the - /// authentication level specifies that no authentication takes place. - /// The authentication level to use. - /// The level allowed for the RPC server to impersonate - /// the identity of an authorized client. This parameter is ignored if the - /// authentication level specifies that no authentication takes place. - /// The SPN as registered in AD. - /// The endpoint: for local RPC is the application or service - /// name, while for TCP this is the port number. Specifying the endpoint is optional - /// if the server has registered its bindings with the endpoint mapper. - RpcClient::RpcClient(ProtocolSequence protSeq, - const string &objUUID, - const string &destination, - AuthenticationSecurity authnSecurity, - AuthenticationLevel authnLevel, - ImpersonationLevel impLevel, - const string &spn, - const string &endpoint) - : RpcClient(protSeq, objUUID, destination, endpoint) - { - // Invalid arguments: - _ASSERTE( - authnSecurity == AuthenticationSecurity::NTLM - || authnSecurity == AuthenticationSecurity::TryKerberos - || authnSecurity == AuthenticationSecurity::RequireMutualAuthn - ); - - CALL_STACK_TRACE; - - try - { - if (authnSecurity != AuthenticationSecurity::NTLM - && authnSecurity != AuthenticationSecurity::TryKerberos - && authnSecurity != AuthenticationSecurity::RequireMutualAuthn) - { - throw core::AppException( - "Invalid argument: the constructor overload was meant to be used only " - "with authentication services Microsoft NTLM/Negotiate/Kerberos SSP" - ); - } - - /* Kerberos security package is preferable over NTLM, however, Kerberos is not - supported in local RPC, and it requires SPN registration, which is only available - with Microsoft Active Directory services: */ - - DirSvcBinding dirSvcBinding; - bool useActDirSec(false); - - /* Only try to detect AD... - - + if RPC over TCP and mutual authentication is preferable - or required, because AD is needed for that - OR - + if local RPC and mutual authentication was required, - because the protocol does not support Kerberos, - but there is mutual authentication for NTLM using SPN's */ - - if ((protSeq == ProtocolSequence::TCP && authnSecurity != AuthenticationSecurity::NTLM) - || (protSeq == ProtocolSequence::Local && authnSecurity == AuthenticationSecurity::RequireMutualAuthn)) - { - useActDirSec = DetectActiveDirectoryServices(dirSvcBinding, true); - } - - std::ostringstream oss; - std::wstring ucs2spn; - std::wstring_convert> transcoder; - - if (useActDirSec) - { - if (spn == "") - { - throw core::AppException( - "No SPN was provided to RPC client for mutual authentication" - ); - } - - ucs2spn = transcoder.from_bytes(spn); - - oss << "RPC client has to authenticate server '" << spn << '\''; - core::Logger::Write(oss.str(), core::Logger::PRIO_NOTICE); - oss.str(""); - } - // AD not available, but mutual authentication was required: - else if (authnSecurity == AuthenticationSecurity::RequireMutualAuthn) - { - oss << "Could not fulfill mutual authentication requirement of " - "RPC client for object " << objUUID << " in " << destination - << " because Microsoft Active Directory services are not available"; - - throw core::AppException(oss.str()); - } - - /* Sets the client binding handle's authentication, - authorization, and security quality-of-service: */ - - RPC_SECURITY_QOS secQOS = { 0 }; - secQOS.Version = 1; - secQOS.ImpersonationType = static_cast (impLevel); - - /* Authentication impact on performance on identity tracking - is negligible unless a remote protocol is in use: */ - if (protSeq == ProtocolSequence::TCP) - secQOS.IdentityTracking = RPC_C_QOS_IDENTITY_STATIC; - else - secQOS.IdentityTracking = RPC_C_QOS_IDENTITY_DYNAMIC; - - /* This client negotiates to use Kerberos if such security package is - available. When RPC is local, Kerberos is not supported disregarding - AD availability, so NTLM is used. Regarding the support for mutual - authentication, both Kerberos and NTLM (only for local RPC) support - it, but it requires SPN registration, hence can only be used when AD - is present: */ - - unsigned long authnService; - - if (protSeq == ProtocolSequence::Local) - { - authnService = RPC_C_AUTHN_WINNT; - - if (useActDirSec && authnSecurity == AuthenticationSecurity::RequireMutualAuthn) - { - secQOS.Capabilities = - RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH | RPC_C_QOS_CAPABILITIES_LOCAL_MA_HINT; - } - } - else - { - if (useActDirSec) - { - authnService = static_cast (authnSecurity); - - if (authnSecurity != AuthenticationSecurity::NTLM) - secQOS.Capabilities = RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH; - } - else - authnService = RPC_C_AUTHN_WINNT; - } - - auto status = RpcBindingSetAuthInfoExW( - m_bindingHandle, - const_cast (ucs2spn.empty() ? nullptr : ucs2spn.c_str()), - static_cast (authnLevel), - authnService, - nullptr, // no explicit credentials, use context - RPC_C_AUTHZ_DEFAULT, - &secQOS - ); - - ThrowIfError(status, "Failed to set security for binding handle of RPC client"); - - oss << "RPC client binding security was set to use " - << ConvertAuthnSvcOptToString(authnService) << " "; - - AppendSecQosOptsDescription(secQOS, oss); - - oss << ", " << ToString(authnLevel) - << " and " << ToString(impLevel); - - core::Logger::Write(oss.str(), core::Logger::PRIO_NOTICE); - } - catch (core::IAppException &ex) - { - HelpFreeBindingHandle(&m_bindingHandle); - throw core::AppException("Failed to instantiate RPC client", ex); - } - catch (std::exception &ex) - { - HelpFreeBindingHandle(&m_bindingHandle); - std::ostringstream oss; - oss << "Generic failure when creating RPC client: " << ex.what(); - throw core::AppException(oss.str()); - } - } - - /// - /// Initializes a new instance of the class - /// for security options of Secure Channel SSP. - /// - /// The transport to use for RPC. - /// The UUID of the object in the RPC server. An empty string - /// is equivalent to a nil UUID, which is valid as long as the endpoint is specified. - /// The destination: local RPC requires the machine name, - /// while for TCP this is the network address (IP or host name). - /// Description of the X.509 certificate to use. - /// The authentication level to use. - /// The endpoint: for local RPC is the application or service - /// name, while for TCP this is the port number. Specifying the endpoint is optional - /// if the server has registered its bindings with the endpoint mapper. - /// Because Schannel SSP is only compatible with transport - /// over TCP/IP, that is the implicitly chosen protocol sequence. - RpcClient::RpcClient(const string &objUUID, - const string &destination, - const CertInfo &certInfoX509, - AuthenticationLevel authnLevel, - const string &endpoint) - : RpcClient(ProtocolSequence::TCP, objUUID, destination, endpoint) - { - CALL_STACK_TRACE; - - try - { - SystemCertificateStore certStore(certInfoX509.storeLocation, certInfoX509.storeName); - auto certX509 = certStore.FindCertBySubject(certInfoX509.subject); - - if (certX509 == nullptr) - { - std::ostringstream oss; - oss << "Could not get from system store code " << certInfoX509.storeLocation - << " the specified X.509 certificate (subject = '" << certInfoX509.subject << "')"; - - throw core::AppException( - "Certificate for RPC client was not found in store", - oss.str() - ); - } - - auto authnService = static_cast (AuthenticationSecurity::SecureChannel); - - m_schannelCred.reset( - new SChannelCredWrapper(certX509, certInfoX509.strongerSecurity) - ); - - auto status = RpcBindingSetAuthInfoW( - m_bindingHandle, - nullptr, - static_cast (authnLevel), - authnService, - m_schannelCred->GetCredential(), - RPC_C_AUTHZ_DEFAULT - ); - - ThrowIfError(status, "Failed to set security for binding handle of RPC client"); - - std::ostringstream oss; - oss << "RPC client binding security was set to use " - << ConvertAuthnSvcOptToString(authnService) - << " with X.509 certificate (subject = '" << certInfoX509.subject - << "' in store '" << certInfoX509.storeName - << "') and " << ToString(authnLevel); - - core::Logger::Write(oss.str(), core::Logger::PRIO_NOTICE); - } - catch (core::IAppException &ex) - { - HelpFreeBindingHandle(&m_bindingHandle); - throw core::AppException("Failed to instantiate RPC client", ex); - } - catch (std::exception &ex) - { - HelpFreeBindingHandle(&m_bindingHandle); - std::ostringstream oss; - oss << "Generic failure when creating RPC client: " << ex.what(); - throw core::AppException(oss.str()); - } - } - - /// - /// Finalizes an instance of the class. - /// - RpcClient::~RpcClient() - { - CALL_STACK_TRACE; - HelpFreeBindingHandle(&m_bindingHandle); - } - - /// - /// Removes the endpoint portion of the server address in the binding handle. - /// The host remains unchanged in the binding handle. The result is a partially-bound - /// server binding handle. When the client makes the next remote procedure call using - /// the reset (partially-bound) binding, the client's run-time library automatically - /// communicates with the endpoint-mapping service on the specified remote host to obtain - /// the endpoint of a compatible server from the endpoint-map database. If a compatible - /// server is located, the RPC run-time library updates the binding with a new endpoint. - /// If a compatible server is not found, the remote procedure call fails. - /// - void RpcClient::ResetBindings() - { - CALL_STACK_TRACE; - auto status = RpcBindingReset(m_bindingHandle); - ThrowIfError(status, "Failed to reset binding handle of RPC client"); - } - - //////////////////////////////// - // ScopedImpersonation Class - //////////////////////////////// - - /// - /// Initializes a new instance of the class. - /// - /// The client binding handle - /// carrying the identity to impersonate. - ScopedImpersonation::ScopedImpersonation(rpc_binding_handle_t clientBindingHandle) - : m_clientBindingHandle(clientBindingHandle) - { - CALL_STACK_TRACE; - auto status = RpcImpersonateClient(clientBindingHandle); - ThrowIfError(status, "Failed to impersonate indentity of RPC client"); - } - - /// - /// Finalizes an instance of the class. - /// - ScopedImpersonation::~ScopedImpersonation() - { - CALL_STACK_TRACE; - - LogIfError( - RpcRevertToSelfEx(m_clientBindingHandle), - "Failed to revert impersonation of RPC client", - core::Logger::PRIO_CRITICAL); - } - -}// end of namespace rpc -}// end of namespace _3fd +#include "stdafx.h" +#include "rpc_helpers.h" +#include "rpc_impl_util.h" +#include "configuration.h" +#include "callstacktracer.h" +#include "utils_io.h" +#include "logger.h" + +#include +#include +#include +#include +#include + +namespace _3fd +{ +namespace rpc +{ + ///////////////////////// + // RpcClient Class + ///////////////////////// + + /// + /// Releases resources of a RPC client binding handle. + /// + /// The given RPC binding handle. + static void HelpFreeBindingHandle(rpc_binding_handle_t *bindingHandle) + { + CALL_STACK_TRACE; + + if (*bindingHandle == nullptr) + return; + + auto status = RpcBindingFree(bindingHandle); + + LogIfError(status, + "Failed to release resources from binding handle of RPC client", + core::Logger::Priority::PRIO_CRITICAL); + } + + + /// + /// Initializes a new instance of the class. + /// This is a basic constructor that sets everything but security options. + /// + /// The transport to use for RPC. + /// The UUID of the object in the RPC server. An empty string + /// is equivalent to a nil UUID, which is valid as long as the endpoint is specified. + /// The destination: local RPC requires the machine name, + /// while for TCP this is the network address (IP or host name). + /// The authentication level to use. + /// The endpoint: for local RPC is the application or service + /// name, while for TCP this is the port number. Specifying the endpoint is optional + /// if the server has registered its bindings with the endpoint mapper. + RpcClient::RpcClient(ProtocolSequence protSeq, + const string &objUUID, + const string &destination, + const string &endpoint) + try : + m_bindingHandle(nullptr), + m_isOnHold(false) + { + CALL_STACK_TRACE; + + std::ostringstream oss; + oss << objUUID << '#' << ToString(protSeq) << '@' << destination; + + m_endpoint = oss.str(); + + // Prepare text parameters encoded in UCS-2 + std::wstring_convert> transcoder; + + std::wstring ucs2objUuid; + RPC_WSTR paramObjUuid; + + if (objUUID.empty() || objUUID == "") + paramObjUuid = nullptr; + else + { + ucs2objUuid = transcoder.from_bytes(objUUID); + paramObjUuid = const_cast (ucs2objUuid.c_str()); + } + + std::wstring protSeqName = transcoder.from_bytes(ToString(protSeq)); + auto paramProtSeq = const_cast (protSeqName.c_str()); + + std::wstring ucs2Destination = transcoder.from_bytes(destination); + auto paramNetwAddr = const_cast (ucs2Destination.c_str()); + + std::wstring ucs2Endpoint; + RPC_WSTR paramEndpoint; + + if (endpoint.empty() || endpoint == "") + paramEndpoint = nullptr; + else + { + ucs2Endpoint = transcoder.from_bytes(endpoint); + paramEndpoint = const_cast (ucs2Endpoint.c_str()); + } + + // Compose the binding string: + RPC_WSTR bindingString; + auto status = RpcStringBindingComposeW( + paramObjUuid, + paramProtSeq, + paramNetwAddr, + paramEndpoint, + nullptr, + &bindingString + ); + + ThrowIfError(status, "Failed to compose binding string for RPC client"); + + // Create a binding handle from the composed string: + status = RpcBindingFromStringBindingW(bindingString, &m_bindingHandle); + + // Release the memory allocated for the binding string: + LogIfError( + RpcStringFreeW(&bindingString), + "Failed to release resources of binding string for RPC client", + core::Logger::Priority::PRIO_CRITICAL + ); + + ThrowIfError(status, "Failed to create binding handle for RPC client"); + + // Notify establishment of binding with this protocol sequence: + + oss.str(""); + oss << "RPC client for object " << objUUID << " in " << destination + << " will use protocol sequence '" << ToString(protSeq) << '\''; + + core::Logger::Write(oss.str(), core::Logger::PRIO_NOTICE); + } + catch (core::IAppException &ex) + { + CALL_STACK_TRACE; + HelpFreeBindingHandle(&m_bindingHandle); + throw core::AppException("Failed to instantiate RPC client", ex); + } + catch (std::exception &ex) + { + CALL_STACK_TRACE; + HelpFreeBindingHandle(&m_bindingHandle); + std::ostringstream oss; + oss << "Generic failure when instantiating RPC client: " << ex.what(); + throw core::AppException(oss.str()); + } + + + /// + /// Initializes a new instance of the class + /// for security options of Windows SSP packages only (NTLM & Kerberos). + /// + /// The transport to use for RPC. + /// The UUID of the object in the RPC server. An empty string + /// is equivalent to a nil UUID, which is valid as long as the endpoint is specified. + /// The destination: local RPC requires the machine name, + /// while for TCP this is the network address (IP or host name). + /// The authentication security package to use. Because + /// local RPC does not support Kerberos, the requirement of mutual authentication will + /// cause NTLM to use SPN's registered in AD. This parameter is ignored if the + /// authentication level specifies that no authentication takes place. + /// The authentication level to use. + /// The level allowed for the RPC server to impersonate + /// the identity of an authorized client. This parameter is ignored if the + /// authentication level specifies that no authentication takes place. + /// The SPN as registered in AD. + /// The endpoint: for local RPC is the application or service + /// name, while for TCP this is the port number. Specifying the endpoint is optional + /// if the server has registered its bindings with the endpoint mapper. + RpcClient::RpcClient(ProtocolSequence protSeq, + const string &objUUID, + const string &destination, + AuthenticationSecurity authnSecurity, + AuthenticationLevel authnLevel, + ImpersonationLevel impLevel, + const string &spn, + const string &endpoint) + : RpcClient(protSeq, objUUID, destination, endpoint) + { + // Invalid arguments: + _ASSERTE( + authnSecurity == AuthenticationSecurity::NTLM + || authnSecurity == AuthenticationSecurity::TryKerberos + || authnSecurity == AuthenticationSecurity::RequireMutualAuthn + ); + + CALL_STACK_TRACE; + + try + { + if (authnSecurity != AuthenticationSecurity::NTLM + && authnSecurity != AuthenticationSecurity::TryKerberos + && authnSecurity != AuthenticationSecurity::RequireMutualAuthn) + { + throw core::AppException( + "Invalid argument: the constructor overload was meant to be used only " + "with authentication services Microsoft NTLM/Negotiate/Kerberos SSP" + ); + } + + /* Kerberos security package is preferable over NTLM, however, Kerberos is not + supported in local RPC, and it requires SPN registration, which is only available + with Microsoft Active Directory services: */ + + DirSvcBinding dirSvcBinding; + bool useActDirSec(false); + + /* Only try to detect AD... + + + if RPC over TCP and mutual authentication is preferable + or required, because AD is needed for that + OR + + if local RPC and mutual authentication was required, + because the protocol does not support Kerberos, + but there is mutual authentication for NTLM using SPN's */ + + if ((protSeq == ProtocolSequence::TCP && authnSecurity != AuthenticationSecurity::NTLM) + || (protSeq == ProtocolSequence::Local && authnSecurity == AuthenticationSecurity::RequireMutualAuthn)) + { + useActDirSec = DetectActiveDirectoryServices(dirSvcBinding, true); + } + + std::ostringstream oss; + std::wstring ucs2spn; + std::wstring_convert> transcoder; + + if (useActDirSec) + { + if (spn == "") + { + throw core::AppException( + "No SPN was provided to RPC client for mutual authentication" + ); + } + + ucs2spn = transcoder.from_bytes(spn); + + oss << "RPC client has to authenticate server '" << spn << '\''; + core::Logger::Write(oss.str(), core::Logger::PRIO_NOTICE); + oss.str(""); + } + // AD not available, but mutual authentication was required: + else if (authnSecurity == AuthenticationSecurity::RequireMutualAuthn) + { + oss << "Could not fulfill mutual authentication requirement of " + "RPC client for object " << objUUID << " in " << destination + << " because Microsoft Active Directory services are not available"; + + throw core::AppException(oss.str()); + } + + /* Sets the client binding handle's authentication, + authorization, and security quality-of-service: */ + + RPC_SECURITY_QOS secQOS = { 0 }; + secQOS.Version = 1; + secQOS.ImpersonationType = static_cast (impLevel); + + /* Authentication impact on performance on identity tracking + is negligible unless a remote protocol is in use: */ + if (protSeq == ProtocolSequence::TCP) + secQOS.IdentityTracking = RPC_C_QOS_IDENTITY_STATIC; + else + secQOS.IdentityTracking = RPC_C_QOS_IDENTITY_DYNAMIC; + + /* This client negotiates to use Kerberos if such security package is + available. When RPC is local, Kerberos is not supported disregarding + AD availability, so NTLM is used. Regarding the support for mutual + authentication, both Kerberos and NTLM (only for local RPC) support + it, but it requires SPN registration, hence can only be used when AD + is present: */ + + unsigned long authnService; + + if (protSeq == ProtocolSequence::Local) + { + authnService = RPC_C_AUTHN_WINNT; + + if (useActDirSec && authnSecurity == AuthenticationSecurity::RequireMutualAuthn) + { + secQOS.Capabilities = + RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH | RPC_C_QOS_CAPABILITIES_LOCAL_MA_HINT; + } + } + else + { + if (useActDirSec) + { + authnService = static_cast (authnSecurity); + + if (authnSecurity != AuthenticationSecurity::NTLM) + secQOS.Capabilities = RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH; + } + else + authnService = RPC_C_AUTHN_WINNT; + } + + auto status = RpcBindingSetAuthInfoExW( + m_bindingHandle, + const_cast (ucs2spn.empty() ? nullptr : ucs2spn.c_str()), + static_cast (authnLevel), + authnService, + nullptr, // no explicit credentials, use context + RPC_C_AUTHZ_DEFAULT, + &secQOS + ); + + ThrowIfError(status, "Failed to set security for binding handle of RPC client"); + + oss << "RPC client binding security was set to use " + << ConvertAuthnSvcOptToString(authnService) << " "; + + AppendSecQosOptsDescription(secQOS, oss); + + oss << ", " << ToString(authnLevel) + << " and " << ToString(impLevel); + + core::Logger::Write(oss.str(), core::Logger::PRIO_NOTICE); + } + catch (core::IAppException &ex) + { + HelpFreeBindingHandle(&m_bindingHandle); + throw core::AppException("Failed to instantiate RPC client", ex); + } + catch (std::exception &ex) + { + HelpFreeBindingHandle(&m_bindingHandle); + std::ostringstream oss; + oss << "Generic failure when creating RPC client: " << ex.what(); + throw core::AppException(oss.str()); + } + } + + + /// + /// Initializes a new instance of the class + /// for security options of Secure Channel SSP. + /// + /// The transport to use for RPC. + /// The UUID of the object in the RPC server. An empty string + /// is equivalent to a nil UUID, which is valid as long as the endpoint is specified. + /// The destination: local RPC requires the machine name, + /// while for TCP this is the network address (IP or host name). + /// Description of the X.509 certificate to use. + /// The authentication level to use. + /// The endpoint: for local RPC is the application or service + /// name, while for TCP this is the port number. Specifying the endpoint is optional + /// if the server has registered its bindings with the endpoint mapper. + /// Because Schannel SSP is only compatible with transport + /// over TCP/IP, that is the implicitly chosen protocol sequence. + RpcClient::RpcClient(const string &objUUID, + const string &destination, + const CertInfo &certInfoX509, + AuthenticationLevel authnLevel, + const string &endpoint) + : RpcClient(ProtocolSequence::TCP, objUUID, destination, endpoint) + { + CALL_STACK_TRACE; + + try + { + SystemCertificateStore certStore(certInfoX509.storeLocation, certInfoX509.storeName); + auto certX509 = certStore.FindCertBySubject(certInfoX509.subject); + + if (certX509 == nullptr) + { + std::ostringstream oss; + oss << "Could not get from system store code " << certInfoX509.storeLocation + << " the specified X.509 certificate (subject = '" << certInfoX509.subject << "')"; + + throw core::AppException( + "Certificate for RPC client was not found in store", + oss.str() + ); + } + + auto authnService = static_cast (AuthenticationSecurity::SecureChannel); + + m_schannelCred.reset( + new SChannelCredWrapper(certX509, certInfoX509.strongerSecurity) + ); + + auto status = RpcBindingSetAuthInfoW( + m_bindingHandle, + nullptr, + static_cast (authnLevel), + authnService, + m_schannelCred->GetCredential(), + RPC_C_AUTHZ_DEFAULT + ); + + ThrowIfError(status, "Failed to set security for binding handle of RPC client"); + + std::ostringstream oss; + oss << "RPC client binding security was set to use " + << ConvertAuthnSvcOptToString(authnService) + << " with X.509 certificate (subject = '" << certInfoX509.subject + << "' in store '" << certInfoX509.storeName + << "') and " << ToString(authnLevel); + + core::Logger::Write(oss.str(), core::Logger::PRIO_NOTICE); + } + catch (core::IAppException &ex) + { + HelpFreeBindingHandle(&m_bindingHandle); + throw core::AppException("Failed to instantiate RPC client", ex); + } + catch (std::exception &ex) + { + HelpFreeBindingHandle(&m_bindingHandle); + std::ostringstream oss; + oss << "Generic failure when creating RPC client: " << ex.what(); + throw core::AppException(oss.str()); + } + } + + + /// + /// Finalizes an instance of the class. + /// + RpcClient::~RpcClient() + { + CALL_STACK_TRACE; + HelpFreeBindingHandle(&m_bindingHandle); + } + + + /// + /// Removes the endpoint portion of the server address in the binding handle. + /// The host remains unchanged in the binding handle. The result is a partially-bound + /// server binding handle. When the client makes the next remote procedure call using + /// the reset (partially-bound) binding, the client's run-time library automatically + /// communicates with the endpoint-mapping service on the specified remote host to obtain + /// the endpoint of a compatible server from the endpoint-map database. If a compatible + /// server is located, the RPC run-time library updates the binding with a new endpoint. + /// If a compatible server is not found, the remote procedure call fails. + /// + void RpcClient::ResetBindings() + { + CALL_STACK_TRACE; + auto status = RpcBindingReset(m_bindingHandle); + ThrowIfError(status, "Failed to reset binding handle of RPC client"); + } + + + /// + /// Enumerates the recommended actions for RPC errors. + /// + enum class RpcErrRecommendedAction : uint8_t + { + Retry = 0xF0, // just a mask for "retry category" + SimpleRetry = 0xF2, // for regular issues: just try again after sleeping a constant amount of time + RetryBackoff = 0xF4, // for resource related issues: try again with sleep intervals in exp back-off + Reconnect = 0x02, // for connection related issues: attempt reconnection and try RPC again + Quit = 0x04 // do not insist, just quit + }; + + + /// + /// Tells by the RPC error status returned by stub call + /// whether to retry, reconnect & retry or just quit. + /// + /// The RPC error code (status). + static RpcErrRecommendedAction GetRecommendation(RPC_STATUS errCode) + { + switch (errCode) + { + case RPC_S_CALL_CANCELLED: + case RPC_S_CALL_FAILED_DNE: + return RpcErrRecommendedAction::SimpleRetry; + + case RPC_S_SERVER_OUT_OF_MEMORY: + case RPC_S_SERVER_TOO_BUSY: + return RpcErrRecommendedAction::RetryBackoff; + + case RPC_S_COMM_FAILURE: + case RPC_S_NOT_LISTENING: + case EPT_S_NOT_REGISTERED: + case RPC_S_SERVER_UNAVAILABLE: + return RpcErrRecommendedAction::Reconnect; + + default: + return RpcErrRecommendedAction::Quit; + } + } + + + // Wraps RPC to isolate SEH code + static RPC_STATUS CallbackWrapSEH(const std::function &rpc, + rpc_binding_handle_t bindingHandle) + { + RPC_STATUS exCode; + + __try // Because RPC uses SEH, only SEH is allowed in this function + { + rpc(bindingHandle); + return RPC_S_OK; + } + // catch with default exception filter: + __except (RpcExceptionFilter(exCode = RpcExceptionCode())) + { + return exCode; + } + } + + + /// + /// Wraps an RPC (with retry loop when appropriate). + /// + /// A tag for the RPC. + /// The RPC to make. + /// The RPC binding handle. + /// The status of the RPC. + static RPC_STATUS WrapRpc(const char *tag, + const std::function &rpc, + rpc_binding_handle_t bindingHandle) + { + int retryCount(0); + + // loop for retries: + while (true) + { + auto status = CallbackWrapSEH(rpc, bindingHandle); + + if (status == RPC_S_OK) + break; + + static const auto callMaxRetries = + core::AppConfig::GetSettings().framework.rpc.cliCallMaxRetries; + + auto recomAction = GetRecommendation(status); + + bool mustNotRetry = + (static_cast (recomAction) + & static_cast (RpcErrRecommendedAction::Retry)) == 0; + + // must not try again? + if (mustNotRetry || retryCount == callMaxRetries) + { + if (retryCount > 0) + { + std::array bufErrMsg; + utils::SerializeTo(bufErrMsg, "RPC call '", tag, "' failed after ", retryCount, " attempt(s)"); + core::Logger::Write(bufErrMsg.data(), core::Logger::PRIO_INFORMATION); + } + + return status; + } + + // Wait before retry: + + uint64_t intervalMs; + + if (recomAction == RpcErrRecommendedAction::SimpleRetry) + { + static const auto callRetrySleepMs = + core::AppConfig::GetSettings().framework.rpc.cliCallRetrySleepMs; + + intervalMs = callRetrySleepMs; + } + else // with exponential back-off: + { + static const auto callRetryTimeSlotMs = + core::AppConfig::GetSettings().framework.rpc.cliCallRetryTimeSlotMs; + + intervalMs = static_cast ( + callRetryTimeSlotMs * (pow(2, retryCount) - 1) * rand() / RAND_MAX + ); + } + + std::this_thread::sleep_for(std::chrono::milliseconds(intervalMs)); + + ++retryCount; + + }// end of loop + + if (retryCount > 0) + { + std::array bufErrMsg; + utils::SerializeTo(bufErrMsg, "RPC call '", tag, "' had to retry ", retryCount, " time(s) before success"); + core::Logger::Write(bufErrMsg.data(), core::Logger::PRIO_WARNING); + } + + // quit on success + return RPC_S_OK; + } + + + /// + /// Invokes an RPC with error handling (and re-try/connect loop when appropriate). + /// + /// A tag for the RPC. + /// The RPC to make. + void RpcClient::Call(const char *tag, const std::function &rpc) + { + CALL_STACK_TRACE; + + RPC_STATUS status; + + static const auto connectMaxRetries = + core::AppConfig::GetSettings().framework.rpc.cliSrvConnectMaxRetries; + + int count; + + // loop for reconnection: + for (count = 0; count <= connectMaxRetries; ++count) + { + status = WrapRpc(tag, rpc, GetBindingHandle()); + + if (GetRecommendation(status) != RpcErrRecommendedAction::Reconnect) + break; + + /* Reset the bindings and take a nap. Next RPC will + attempt to (connect and) bind again to the server: */ + + static const auto connRetrySleepSecs = + core::AppConfig::GetSettings().framework.rpc.cliSrvConnRetrySleepSecs; + + // warn only once about lost connection: + if (!m_isOnHold.exchange(true)) + { + std::array bufErrMsg; + + utils::SerializeTo(bufErrMsg, + "RPC client stub lost connection to ", m_endpoint, + " and will attempt a reconnection every ", connRetrySleepSecs, + " seconds up to ", connectMaxRetries, " time(s)"); + + core::Logger::Write(bufErrMsg.data(), core::Logger::PRIO_WARNING); + } + + ResetBindings(); + + std::this_thread::sleep_for( + std::chrono::seconds(connRetrySleepSecs) + ); + } + + ThrowIfError(status, "Failed to invoke RPC client stub routine", tag); + + // notify only once about reconnection: + if (m_isOnHold.exchange(false)) + { + std::array bufErrMsg; + + utils::SerializeTo(bufErrMsg, + "RPC client stub succesfully reconnected to ", + m_endpoint, " after ", count, " attempt(s)"); + + core::Logger::Write(bufErrMsg.data(), core::Logger::PRIO_WARNING); + } + } + + + //////////////////////////////// + // ScopedImpersonation Class + //////////////////////////////// + + /// + /// Initializes a new instance of the class. + /// + /// The client binding handle + /// carrying the identity to impersonate. + ScopedImpersonation::ScopedImpersonation(rpc_binding_handle_t clientBindingHandle) + : m_clientBindingHandle(clientBindingHandle) + { + CALL_STACK_TRACE; + auto status = RpcImpersonateClient(clientBindingHandle); + ThrowIfError(status, "Failed to impersonate indentity of RPC client"); + } + + + /// + /// Finalizes an instance of the class. + /// + ScopedImpersonation::~ScopedImpersonation() + { + CALL_STACK_TRACE; + + LogIfError( + RpcRevertToSelfEx(m_clientBindingHandle), + "Failed to revert impersonation of RPC client", + core::Logger::PRIO_CRITICAL + ); + } + +}// end of namespace rpc +}// end of namespace _3fd diff --git a/3FD/rpc_impl_server.cpp b/3FD/rpc_impl_server.cpp index 7fd71ad..dffcb7f 100644 --- a/3FD/rpc_impl_server.cpp +++ b/3FD/rpc_impl_server.cpp @@ -570,7 +570,7 @@ namespace rpc /// Executes the rollback of interfaces registration (in runtime /// library and local enpoint-map database) upon failure. /// - void RpcServerImpl::OnStartFailureRollbackIntfReg() noexcept + void RpcServerImpl::OnStartFailureRollbackIntfReg() NOEXCEPT { CALL_STACK_TRACE; @@ -947,7 +947,7 @@ namespace rpc /// whether successful, otherwise, /// (if the server was not initialized). /// - bool RpcServer::Finalize() noexcept + bool RpcServer::Finalize() NOEXCEPT { CALL_STACK_TRACE; diff --git a/3FD/rpc_impl_server.h b/3FD/rpc_impl_server.h index 9aff1ee..02d23a4 100644 --- a/3FD/rpc_impl_server.h +++ b/3FD/rpc_impl_server.h @@ -42,7 +42,7 @@ namespace rpc State m_state; - void OnStartFailureRollbackIntfReg() noexcept; + void OnStartFailureRollbackIntfReg() NOEXCEPT; public: diff --git a/3FD/rpc_impl_util.cpp b/3FD/rpc_impl_util.cpp index cd45b07..e8549aa 100644 --- a/3FD/rpc_impl_util.cpp +++ b/3FD/rpc_impl_util.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include namespace _3fd @@ -16,6 +17,7 @@ namespace rpc { using std::string; + //////////////////////////// // Translation of Types //////////////////////////// @@ -44,6 +46,7 @@ namespace rpc } } + /// /// Converts an enumerated authentication level option /// into a descriptive label for it. @@ -66,6 +69,7 @@ namespace rpc } } + /// /// Converts an enumerated impersonation level option /// into a descriptive label for it. @@ -94,6 +98,7 @@ namespace rpc } } + /// /// Converts an authentication service option from /// Win32 API into a descriptive label for it. @@ -122,6 +127,7 @@ namespace rpc } } + /// /// Gets a structure with security QOS options for Microsoft RPC, /// generates a text description for it and append to output stream. @@ -152,6 +158,7 @@ namespace rpc } } + ////////////////////// // UUID_VECTOR Fix ////////////////////// @@ -177,7 +184,7 @@ namespace rpc } } - UUID_VECTOR * VectorOfUuids::CopyTo(UuidVectorFix &vec) noexcept + UUID_VECTOR * VectorOfUuids::CopyTo(UuidVectorFix &vec) NOEXCEPT { _ASSERTE(m_ptrs2Uuids.size() <= UUID_VECTOR_MAX_SIZE); @@ -188,6 +195,7 @@ namespace rpc return reinterpret_cast (&vec); } + /// /// Detects the presence of Microsoft Active Directory services. /// @@ -231,6 +239,7 @@ namespace rpc } } + ////////////////////////////////// // SystemCertificateStore Class ////////////////////////////////// @@ -280,6 +289,7 @@ namespace rpc throw core::AppException(oss.str()); } + /// /// Finalizes an instance of the class. /// @@ -307,6 +317,7 @@ namespace rpc } } + /// /// Finds and retrieves from the system store a /// X.509 certificate with a given subject. @@ -355,6 +366,7 @@ namespace rpc } } + ////////////////////////////////// // SChannelCredWrapper Class ////////////////////////////////// @@ -381,8 +393,10 @@ namespace rpc if (strongerSec) { - m_credStructure.dwFlags = - SCH_CRED_REVOCATION_CHECK_CHAIN | SCH_USE_STRONG_CRYPTO; + m_credStructure.dwFlags = SCH_CRED_REVOCATION_CHECK_CHAIN; +# ifndef _USING_V110_SDK71_ + m_credStructure.dwFlags |= SCH_USE_STRONG_CRYPTO; +# endif } } catch (std::exception &ex) @@ -394,6 +408,7 @@ namespace rpc throw core::AppException(oss.str()); } + /// /// Initializes a new instance of the class. /// Instances initialized by this constructor represent credentials for the RPC server. @@ -420,8 +435,10 @@ namespace rpc if (strongerSec) { - m_credStructure.dwFlags = - SCH_CRED_REVOCATION_CHECK_CHAIN | SCH_USE_STRONG_CRYPTO; + m_credStructure.dwFlags = SCH_CRED_REVOCATION_CHECK_CHAIN; +# ifndef _USING_V110_SDK71_ + m_credStructure.dwFlags |= SCH_USE_STRONG_CRYPTO; +# endif } } catch (std::exception &ex) @@ -433,6 +450,7 @@ namespace rpc throw core::AppException(oss.str()); } + /// /// Finalizes an instance of the class. /// @@ -442,6 +460,7 @@ namespace rpc delete m_credStructure.paCred; } + ///////////////////////// // Error Helpers ///////////////////////// @@ -656,6 +675,7 @@ namespace rpc RpcCodeLabelKVPair(761, "OSF_BINDING_HANDLE__NegotiateTransferSynta10") }; + /// /// Gets the label for a component, given its code /// coming from extended RPC error information. @@ -671,6 +691,7 @@ namespace rpc return componentMap[code]; } + /// /// Gets the label for a detection location, given its code /// comming from extended RPC error information. @@ -695,9 +716,10 @@ namespace rpc return "???"; // code unknown or out-of-range } + /* Wraps 'DceErrorInqTextW' in order to make it return pretty text - for the provided error code, but does not recursively generates - messages for possible failures during this process. */ + for the provided error code, but does not recursively generates + messages for possible failures during this process. */ static string GetFirstLevelRpcErrorText( RPC_STATUS errCode, std::wstring_convert> &transcoder, @@ -717,6 +739,7 @@ namespace rpc return transcoder.to_bytes(errorMessage); } + /// /// Creates an exception given the information from parameters. /// @@ -800,9 +823,11 @@ namespace rpc if ((errInfoEntry.Flags & EEInfoPreviousRecordsMissing) != 0) oss << "$ *** missing record(s) ***"; - oss << "$ host " << (errInfoEntry.ComputerName != nullptr) - ? transcoder.to_bytes(errInfoEntry.ComputerName) - : "---"; + oss << "$ host " << ( + errInfoEntry.ComputerName != nullptr + ? transcoder.to_bytes(errInfoEntry.ComputerName) + : "---" + ); oss << " / PID #" << errInfoEntry.ProcessID; @@ -815,8 +840,8 @@ namespace rpc << errInfoEntry.u.SystemTime.wSecond << ')'; oss << " [com:" << GetComponentLabel(errInfoEntry.GeneratingComponent) - << "/loc:" << GetDetectionLocationLabel(errInfoEntry.DetectionLocation) - << "/status=" << errInfoEntry.Status << ']'; + << "; loc:" << GetDetectionLocationLabel(errInfoEntry.DetectionLocation) + << "; status=" << errInfoEntry.Status << ']'; oss << " { "; @@ -887,7 +912,8 @@ namespace rpc return core::AppException(oss.str()); } } - + + /// /// Throws an exception for a RPC runtime error. /// @@ -901,16 +927,16 @@ namespace rpc throw RpcErrorHelper::CreateException(status, message, ""); } + /// /// Throws an exception for a RPC error. /// /// The status returned by the RPC API. /// The main message for the error. /// The details for the error. - void ThrowIfError( - RPC_STATUS status, - const char *message, - const string &details) + void ThrowIfError(RPC_STATUS status, + const char *message, + const string &details) { if (status == RPC_S_OK) return; @@ -918,16 +944,16 @@ namespace rpc throw RpcErrorHelper::CreateException(status, message, details); } + /// /// Logs a RPC error. /// /// The status returned by the RPC API. /// The main message for the error. /// The priority for event to be logged. - void LogIfError( - RPC_STATUS status, - const char *message, - core::Logger::Priority prio) noexcept + void LogIfError(RPC_STATUS status, + const char *message, + core::Logger::Priority prio) NOEXCEPT { if (status == RPC_S_OK) return; @@ -936,6 +962,7 @@ namespace rpc core::Logger::Write(ex, prio); } + /// /// Logs a RPC error. /// @@ -943,11 +970,10 @@ namespace rpc /// The main message for the error. /// The details for the error. /// The priority for event to be logged. - void LogIfError( - RPC_STATUS status, - const char *message, - const string &details, - core::Logger::Priority prio) noexcept + void LogIfError(RPC_STATUS status, + const char *message, + const string &details, + core::Logger::Priority prio) NOEXCEPT { if (status == RPC_S_OK) return; diff --git a/3FD/rpc_impl_util.h b/3FD/rpc_impl_util.h index ef44fda..5561731 100644 --- a/3FD/rpc_impl_util.h +++ b/3FD/rpc_impl_util.h @@ -15,6 +15,21 @@ using std::string; namespace rpc { + void ThrowIfError(RPC_STATUS status, const char *message); + + void ThrowIfError(RPC_STATUS status, + const char *message, + const string &details); + + void LogIfError(RPC_STATUS status, + const char *message, + core::Logger::Priority prio) NOEXCEPT; + + void LogIfError(RPC_STATUS status, + const char *message, + const string &details, + core::Logger::Priority prio) NOEXCEPT; + const char *ToString(ProtocolSequence protSeq); const char *ToString(AuthenticationLevel authnLevel); @@ -25,6 +40,7 @@ namespace rpc void AppendSecQosOptsDescription(const RPC_SECURITY_QOS &secQOS, std::ostringstream &oss); + /// /// RAII for RPC lib C-style strings. /// @@ -50,6 +66,7 @@ namespace rpc } }; + typedef std::pair RpcCodeLabelKVPair; /// @@ -72,13 +89,12 @@ namespace rpc static core::AppException - CreateException( - RPC_STATUS errCode, - const string &message, - const string &details - ); + CreateException(RPC_STATUS errCode, + const string &message, + const string &details); }; + const unsigned long UUID_VECTOR_MAX_SIZE(32); /// @@ -123,9 +139,10 @@ namespace rpc void Add(const UUID &uuid); - UUID_VECTOR *CopyTo(UuidVectorFix &vec) noexcept; + UUID_VECTOR *CopyTo(UuidVectorFix &vec) NOEXCEPT; }; + /// /// RAII for Directory Service binding handle. /// @@ -143,6 +160,7 @@ namespace rpc } }; + /// /// RAII for array of SPN's. /// @@ -161,8 +179,10 @@ namespace rpc } }; + bool DetectActiveDirectoryServices(DirSvcBinding &dirSvcBinding, bool isClient); + /// /// Provides access to the system certificate store. /// @@ -181,6 +201,7 @@ namespace rpc PCCERT_CONTEXT FindCertBySubject(const string &certSubject) const; }; + /// /// Wraps a credential for secure channel SSP, containing a X.509 /// certificate from the store and using RAII to control reference diff --git a/3FD/runtime.cpp b/3FD/runtime.cpp index 2636633..d7827c3 100644 --- a/3FD/runtime.cpp +++ b/3FD/runtime.cpp @@ -1,153 +1,211 @@ -#include "stdafx.h" -#include "runtime.h" -#include "exceptions.h" -#include "callstacktracer.h" -#include "logger.h" -#include "gc.h" - -#ifdef _3FD_PLATFORM_WINRT -# include "sqlite3.h" -#endif - -#include -#include -#include - -namespace _3fd -{ -namespace core -{ -#ifdef _3FD_PLATFORM_WIN32API - - /// - /// Gets the name of the current component, even - /// if this is running inside a dynamic library. - /// - /// The name of the current running module. - static std::string GetCurrentComponentName() - { - HMODULE thisModule; - - auto rv = GetModuleHandleExW( - GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT | GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, - reinterpret_cast (&GetCurrentComponentName), - &thisModule - ); - - if (rv == 0) - return "UNKNOWN"; - - std::array modFilePath; - rv = GetModuleFileNameW(thisModule, modFilePath.data(), modFilePath.size()); - - if (rv == 0) - return "UNKNOWN"; - - auto modNameStr = wcsrchr(modFilePath.data(), L'\\'); - if (modNameStr != nullptr) - ++modNameStr; - else - modNameStr = modFilePath.data(); - - std::wstring_convert> transcoder; - return transcoder.to_bytes(modNameStr); - } - - /// - /// Initializes a new instance of the class. - /// - /// The COM thread model. - FrameworkInstance::FrameworkInstance(RO_INIT_TYPE comThreadModel) - : FrameworkInstance() - { - // Initialize Windows Runtime API for COM usage of Microsoft Media Foundation - auto hr = Windows::Foundation::Initialize(comThreadModel); - - if (FAILED(hr)) - { - std::ostringstream oss; - oss << "Failed to initialize Windows Runtime API! " << core::WWAPI::GetDetailsFromHResult(hr); - - Logger::Write(oss.str(), Logger::PRIO_ERROR); - - oss.str(""); - oss << "3FD was shutdown in " << m_moduleName; - Logger::Write(oss.str(), core::Logger::PRIO_DEBUG); - Logger::Shutdown(); - - exit(EXIT_FAILURE); - } - - m_isComLibInitialized = true; - } - - /// - /// Initializes a new instance of the class. - /// - FrameworkInstance::FrameworkInstance() - : m_moduleName(GetCurrentComponentName()) - , m_isComLibInitialized(false) - { - std::ostringstream oss; - oss << "3FD has been initialized in " << m_moduleName; - Logger::Write(oss.str(), core::Logger::PRIO_DEBUG); - } - -#elif defined _3FD_PLATFORM_WINRT - - /// - /// Initializes a new instance of the class. - /// - /// Name of the this WinRT component or app. - FrameworkInstance::FrameworkInstance(const char *thisComName) - : m_moduleName(thisComName) - { - using namespace Windows::Storage; - - std::wstring_convert> transcoder; - - string tempFolderPath = transcoder.to_bytes( - ApplicationData::Current->TemporaryFolder->Path->Data() - ); - - auto tempDirStrSize = tempFolderPath.length() + 1; - sqlite3_temp_directory = (char *)sqlite3_malloc(tempDirStrSize); - - if (sqlite3_temp_directory == nullptr) - throw std::bad_alloc(); - - strncpy(sqlite3_temp_directory, tempFolderPath.data(), tempDirStrSize); - - std::ostringstream oss; - oss << "3FD has been initialized in " << m_moduleName; - Logger::Write(oss.str(), core::Logger::PRIO_DEBUG); - } - -#endif - - /// - /// Finalizes an instance of the class. - /// - FrameworkInstance::~FrameworkInstance() - { - memory::GarbageCollector::Shutdown(); - -#ifdef _WIN32 - std::ostringstream oss; - oss << "3FD was shutdown in " << m_moduleName; - - Logger::Write(oss.str(), core::Logger::PRIO_DEBUG); -#endif - Logger::Shutdown(); - -#ifdef _3FD_PLATFORM_WINRT - sqlite3_free(sqlite3_temp_directory); - -#elif defined _3FD_PLATFORM_WIN32API - if (m_isComLibInitialized) - Windows::Foundation::Uninitialize(); -#endif - } - -}// end of namespace core +#include "stdafx.h" +#include "runtime.h" +#include "exceptions.h" +#include "callstacktracer.h" +#include "logger.h" +#include "gc.h" + +#ifdef _USING_V110_SDK71_ +# include +#else +# include +#endif + +#ifdef _3FD_PLATFORM_WINRT +# include "sqlite3.h" +#endif + +#include +#include +#include + +namespace _3fd +{ +namespace core +{ +#ifdef _3FD_PLATFORM_WIN32API + + /// + /// Gets the name of the current component, even + /// if this is running inside a dynamic library. + /// + /// The name of the current running module. + static std::string GetCurrentComponentName() + { + HMODULE thisModule; + + auto rv = GetModuleHandleExW( + GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT | GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, + reinterpret_cast (&GetCurrentComponentName), + &thisModule + ); + + if (rv == 0) + return "UNKNOWN"; + + std::array modFilePath; + rv = GetModuleFileNameW(thisModule, modFilePath.data(), modFilePath.size()); + + if (rv == 0) + return "UNKNOWN"; + + auto modNameStr = wcsrchr(modFilePath.data(), L'\\'); + if (modNameStr != nullptr) + ++modNameStr; + else + modNameStr = modFilePath.data(); + + std::wstring_convert> transcoder; + return transcoder.to_bytes(modNameStr); + } + + + /// + /// Initializes a new instance of the class. + /// + /// The COM thread model. + FrameworkInstance::FrameworkInstance(MsComThreadModel threadModel) + : FrameworkInstance() + { + const char *libLabel; + bool unsupported(false); + HRESULT hr; + +# ifdef _USING_V110_SDK71_ + + libLabel = "COM library"; + + // Initialize COM library + switch (threadModel) + { + case ComSingleThreaded: + hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); + break; + case ComMultiThreaded: + hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED); + break; + default: + _ASSERTE(false); // unknown or unsupported COM thread model + unsupported = true; + break; + } +# else + libLabel = "Windows Runtime API"; + + /* Initialize Windows Runtime API for COM library usage in classic + desktop apps (for use of libraries like Microsoft Media Foundation) */ + switch (threadModel) + { + case ComSingleThreaded: + hr = Windows::Foundation::Initialize(RO_INIT_SINGLETHREADED); + break; + case ComMultiThreaded: + hr = Windows::Foundation::Initialize(RO_INIT_MULTITHREADED); + break; + default: + _ASSERTE(false); // unknown or unsupported COM thread model + unsupported = true; + break; + } +# endif + + if (FAILED(hr) || unsupported) + { + std::ostringstream oss; + oss << "Failed to initialize" << libLabel << "! "; + + if (unsupported) + oss << "Specified thread model is unknown or unsupported"; + else + oss << core::WWAPI::GetDetailsFromHResult(hr); + + Logger::Write(oss.str(), Logger::PRIO_ERROR); + + oss.str(""); + oss << "3FD was shutdown in " << m_moduleName; + Logger::Write(oss.str(), core::Logger::PRIO_DEBUG); + Logger::Shutdown(); + + exit(EXIT_FAILURE); + } + + m_isComLibInitialized = true; + } + + + /// + /// Initializes a new instance of the class. + /// + FrameworkInstance::FrameworkInstance() + : m_moduleName(GetCurrentComponentName()) + , m_isComLibInitialized(false) + { + std::ostringstream oss; + oss << "3FD has been initialized in " << m_moduleName; + Logger::Write(oss.str(), core::Logger::PRIO_DEBUG); + } + +#elif defined _3FD_PLATFORM_WINRT + + /// + /// Initializes a new instance of the class. + /// + /// Name of the this WinRT component or app. + FrameworkInstance::FrameworkInstance(const char *thisComName) + : m_moduleName(thisComName) + { + using namespace Windows::Storage; + + std::wstring_convert> transcoder; + + string tempFolderPath = transcoder.to_bytes( + ApplicationData::Current->TemporaryFolder->Path->Data() + ); + + auto tempDirStrSize = tempFolderPath.length() + 1; + sqlite3_temp_directory = (char *)sqlite3_malloc(tempDirStrSize); + + if (sqlite3_temp_directory == nullptr) + throw std::bad_alloc(); + + strncpy(sqlite3_temp_directory, tempFolderPath.data(), tempDirStrSize); + + std::ostringstream oss; + oss << "3FD has been initialized in " << m_moduleName; + Logger::Write(oss.str(), core::Logger::PRIO_DEBUG); + } + +#endif + + /// + /// Finalizes an instance of the class. + /// + FrameworkInstance::~FrameworkInstance() + { + memory::GarbageCollector::Shutdown(); + +#ifdef _WIN32 + std::ostringstream oss; + oss << "3FD was shutdown in " << m_moduleName; + + Logger::Write(oss.str(), core::Logger::PRIO_DEBUG); +#endif + Logger::Shutdown(); + +#ifdef _3FD_PLATFORM_WINRT + sqlite3_free(sqlite3_temp_directory); + +#elif defined _3FD_PLATFORM_WIN32API + if (m_isComLibInitialized) + { +# ifdef _USING_V110_SDK71_ + CoUninitialize(); +# else + Windows::Foundation::Uninitialize(); +# endif + } +#endif + } + +}// end of namespace core }// end of namespace _3fd \ No newline at end of file diff --git a/3FD/runtime.h b/3FD/runtime.h index 22de6cb..c232b81 100644 --- a/3FD/runtime.h +++ b/3FD/runtime.h @@ -6,10 +6,6 @@ #include "logger.h" #include -#ifdef _3FD_PLATFORM_WIN32API -# include -#endif - namespace _3fd { namespace core @@ -32,7 +28,9 @@ namespace core #ifdef _3FD_PLATFORM_WIN32API - FrameworkInstance(RO_INIT_TYPE comThreadModel); + enum MsComThreadModel { ComSingleThreaded, ComMultiThreaded }; + + FrameworkInstance(MsComThreadModel threadModel); FrameworkInstance(); #elif defined _3FD_PLATFORM_WINRT diff --git a/3FD/sqlite.h b/3FD/sqlite.h index 8ebb98e..bd025c8 100644 --- a/3FD/sqlite.h +++ b/3FD/sqlite.h @@ -46,11 +46,11 @@ namespace sqlite PrepStatement CreateStatement(const char *query); PrepStatement &CachedStatement(int queryId, - const string &queryCode); + const string &queryCode); PrepStatement &CachedStatement(int queryId, - const char *queryCode = nullptr, - size_t qlen = 0); + const char *queryCode = nullptr, + size_t qlen = 0); }; /// diff --git a/3FD/sqlite3.c b/3FD/sqlite3.c index 4ec1271..e7d4e7b 100644 --- a/3FD/sqlite3.c +++ b/3FD/sqlite3.c @@ -31185,7 +31185,7 @@ static int lockTrace(int fd, int op, struct flock *p){ #endif /* SQLITE_LOCK_TRACE */ /* -** Retry ftruncate() calls that fail due to EINTR +** RetryBackoff ftruncate() calls that fail due to EINTR ** ** All calls to ftruncate() within this file should be made through ** this wrapper. On the Android platform, bypassing the logic below @@ -32656,7 +32656,7 @@ static int dotlockClose(sqlite3_file *id) { #if SQLITE_ENABLE_LOCKING_STYLE /* -** Retry flock() calls that fail with EINTR +** RetryBackoff flock() calls that fail with EINTR */ #ifdef EINTR static int robust_flock(int fd, int op){ @@ -179873,7 +179873,7 @@ static int sessionApplyOneWithRetry( } /* -** Retry the changes accumulated in the pApply->constraints buffer. +** RetryBackoff the changes accumulated in the pApply->constraints buffer. */ static int sessionRetryConstraints( sqlite3 *db, diff --git a/3FD/stdafx.h b/3FD/stdafx.h index f7136d2..ecacf32 100644 --- a/3FD/stdafx.h +++ b/3FD/stdafx.h @@ -7,9 +7,13 @@ #define STDAFX_H # ifdef _MSC_VER // Visual Studio: -# include -# if WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP // Windows Desktop App: +# ifndef _USING_V110_SDK71_ +# include +# endif + + // Windows Desktop App: +# if WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP || defined _USING_V110_SDK71_ # ifdef TESTING // Test application: # include "targetver.h" @@ -41,8 +45,6 @@ # endif -// TODO: reference additional headers your program requires here - # else // QtCreator & other IDE's: # ifdef TESTING // Test application: diff --git a/3FD/web_wws_impl_host.cpp b/3FD/web_wws_impl_host.cpp index 9a59ffa..3380ec4 100644 --- a/3FD/web_wws_impl_host.cpp +++ b/3FD/web_wws_impl_host.cpp @@ -3,14 +3,14 @@ #include "callstacktracer.h" #include "logger.h" -#include "Poco\AutoPtr.h" -#include "Poco\DOM\DOMParser.h" -#include "Poco\DOM\Document.h" -#include "Poco\DOM\NodeList.h" -#include "Poco\DOM\NamedNodeMap.h" -#include "Poco\DOM\Attr.h" -#include "Poco\SAX\XMLReader.h" -#include "Poco\SAX\NamespaceSupport.h" +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include diff --git a/3FD/web_wws_impl_proxy.cpp b/3FD/web_wws_impl_proxy.cpp index fab4825..6f9c331 100644 --- a/3FD/web_wws_impl_proxy.cpp +++ b/3FD/web_wws_impl_proxy.cpp @@ -1,10 +1,17 @@ #include "stdafx.h" #include "web_wws_impl_proxy.h" - +#include "configuration.h" #include "callstacktracer.h" #include "logger.h" +#include "utils_io.h" + +#define format utils::FormatArg + +#include #include #include +#include +#include namespace _3fd { @@ -15,6 +22,39 @@ namespace wws using namespace _3fd::core; + /// + /// Enumerates the possible recommended measures when a service operation fails. + /// + enum class OpErrRecommendedAction { RetryBackoff, Reconnect, Quit }; + + + /// + /// Gets the recommended action for a given error code returned by WWS API. + /// + /// The error code. + /// The recommended action. + static OpErrRecommendedAction GetRecommendation(HRESULT hr) + { + switch (hr) + { + case E_OUTOFMEMORY: + case WS_E_ENDPOINT_NOT_AVAILABLE: + case WS_E_ENDPOINT_TOO_BUSY: + case WS_E_OPERATION_TIMED_OUT: + case WS_E_QUOTA_EXCEEDED: + return OpErrRecommendedAction::RetryBackoff; // retry with exponential back-off + + case WS_E_ENDPOINT_DISCONNECTED: + case WS_E_ENDPOINT_NOT_FOUND: + case WS_E_ENDPOINT_UNREACHABLE: + return OpErrRecommendedAction::Reconnect; // reconnect and try again + + default: + return OpErrRecommendedAction::Quit; // not fit for another attempt, just quit + } + } + + // Prepare the service proxy properties from the provided configuration static WS_PROXY_PROPERTY *PrepareSvcProxyProperties( const SvcProxyConfig &config, @@ -100,6 +140,7 @@ namespace wws CallbackWrapperCreateServiceProxy callback) try : m_wsSvcProxyHandle(nullptr), + m_isOnHold(false), m_heap(config.reservedMemory), m_proxyStateMutex() { @@ -451,34 +492,6 @@ namespace wws } - /// - /// Creates an object that keeps track of an asynchronous operation. - /// - /// - /// Size of the heap (in bytes) to provide memory for an asynchronous call in this proxy. - /// - /// A object. - WSAsyncOper WebServiceProxyImpl::CreateAsyncOperation(size_t heapSize) - { - auto promise = new std::promise(); - m_promises.push_back(promise); - return WSAsyncOper(heapSize, promise); - } - - - /// - /// Creates an object that keeps track of an asynchronous operation. - /// - /// - /// Size of the heap (in bytes) to provide memory for an asynchronous call in this proxy. - /// - /// A object. - WSAsyncOper WebServiceProxy::CreateAsyncOperation(size_t heapSize) - { - return m_pimpl->CreateAsyncOperation(heapSize); - } - - /// /// Gets the handle for this web service proxy. /// @@ -491,8 +504,11 @@ namespace wws /// /// Opens the service proxy before it can start sending requests. + /// If the proxy was already opened, nothing is done. In case of + /// failure, retry logic is applied before throwing an exception. /// - void WebServiceProxyImpl::Open() + /// Whether the service proxy was closed or at fault, and the call had to open it. + bool WebServiceProxyImpl::Open() { CALL_STACK_TRACE; @@ -505,19 +521,102 @@ namespace wws as WS_SERVICE_PROXY_STATE_OPENING or WS_SERVICE_PROXY_STATE_CLOSING. */ std::lock_guard lock(m_proxyStateMutex); - WS_ENDPOINT_ADDRESS endpointAddress = { 0 }; - endpointAddress.url.chars = const_cast (m_svcEndptAddr.data()); - endpointAddress.url.length = m_svcEndptAddr.length(); - WSError err; - auto hr = WsOpenServiceProxy( + HRESULT hr; + + // Ask for the proxy current state: + WS_SERVICE_PROXY_STATE state; + hr = WsGetServiceProxyProperty( m_wsSvcProxyHandle, - &endpointAddress, - nullptr, + WS_PROXY_PROPERTY_STATE, + &state, + sizeof state, err.GetHandle() ); + err.RaiseExceptionApiError(hr, "WsGetServiceProxyProperty", + "Failed to get state of proxy for web service"); + + if (state == WS_SERVICE_PROXY_STATE_OPEN) + return false; + + WS_ENDPOINT_ADDRESS endpointAddress = { 0 }; + endpointAddress.url.chars = const_cast (m_svcEndptAddr.data()); + endpointAddress.url.length = m_svcEndptAddr.length(); + + static const auto maxRetries = AppConfig::GetSettings().framework.wws.proxyConnMaxRetries; + + int count(0); + + clock_t startTime = clock(); + + while (true) + { + hr = WsOpenServiceProxy( + m_wsSvcProxyHandle, + &endpointAddress, + nullptr, + err.GetHandle() + ); + + if (hr == S_OK) + return true; + + OpErrRecommendedAction ra = GetRecommendation(hr); + + if (count == maxRetries || ra == OpErrRecommendedAction::Quit) + break; + + if (count == 0) + { + std::array message; + utils::SerializeTo(message, + "Failed to open proxy for web service at '", m_svcEndptAddr, + "': will re-attempt up to ", maxRetries, " time(s)"); + + Logger::Write(message.data(), Logger::PRIO_WARNING); + } + + static const auto retryTimeSlotMs = AppConfig::GetSettings().framework.wws.proxyRetryTimeSlotMs; + static const auto retrySleepTimeSecs = AppConfig::GetSettings().framework.wws.proxyRetrySleepSecs; + + uint64_t intervalMs; + + if (ra == OpErrRecommendedAction::Reconnect) + { + // connectivity related problems cause attempts with constant interval + intervalMs = 1000UL * retrySleepTimeSecs; + } + else + { + // resource related problems cause attempts with intervals in exponential back-off + intervalMs = static_cast (rand() * (pow(2, count) - 1) / RAND_MAX) * retryTimeSlotMs; + } + + std::this_thread::sleep_for( + std::chrono::milliseconds(intervalMs) + ); + + ++count; + + }// end of loop + err.RaiseExceptionApiError(hr, "WsOpenServiceProxy", "Failed to open proxy for web service"); + + if (count > 0) + { + auto elapsed = static_cast (clock() - startTime) / CLOCKS_PER_SEC; + + std::array message; + utils::SerializeTo(message, + "Proxy for web service at '", m_svcEndptAddr, + "' successfully opened after ", count, " attempt(s) within ", + format(elapsed).precision(3), " second(s)"); + + Logger::Write(message.data(), Logger::PRIO_NOTICE); + } + + return true; } catch (IAppException &) { @@ -542,13 +641,17 @@ namespace wws /// /// Opens the service proxy before it can start sending requests. + /// If the proxy was already opened, nothing is done. In case of + /// failure, retry logic is applied before throwing an exception. /// - void WebServiceProxy::Open() + /// Whether the service proxy was closed or at fault, and the call had to open it. + bool WebServiceProxy::Open() { - m_pimpl->Open(); + return m_pimpl->Open(); } + // Helps closing the proxy static void HelpCloseServiceProxy(WS_SERVICE_PROXY *wsSvcProxyHandle, WSError &err) { auto hr = WsCloseServiceProxy(wsSvcProxyHandle, nullptr, err.GetHandle()); @@ -737,6 +840,151 @@ namespace wws return m_pimpl->Abort(); } + + /// + /// Wraps a call to the proxy implementation (generated by wsutil.exe) of a service + /// operation, taking responsibility for memory allocation and error handling. + /// + /// A label for the service operation. + /// Size of the heap dedicated for the operation and its error handling. + /// A wrap around the proxy implementation for the service operation. + void WebServiceProxyImpl::Call(const char *operLabel, + size_t operHeapSize, + const WsCallWrap &operWrap) + { + CALL_STACK_TRACE; + + std::array errMsgBuffer; + + static const auto maxRetries = AppConfig::GetSettings().framework.wws.proxyCallMaxRetries; + + WSHeap heap(operHeapSize); + WSError err; + HRESULT hr; + int count; + + clock_t startTime = clock(); + + for (count = 0; true; ++count) + { + hr = operWrap(GetHandle(), heap.GetHandle(), err.GetHandle()); + + if (hr == S_OK) + { + m_isOnHold.store(false); + return; + } + + OpErrRecommendedAction ra = GetRecommendation(hr); + + if (count == maxRetries || ra == OpErrRecommendedAction::Quit) + break; + + if (!m_isOnHold.exchange(true)) + { + utils::SerializeTo(errMsgBuffer, + "Failed call to operation in web service at '", m_svcEndptAddr, + "', but the proxy will retry up to ", maxRetries, " time(s)"); + + Logger::Write(errMsgBuffer.data(), Logger::PRIO_WARNING); + } + + static const auto retryTimeSlotMs = AppConfig::GetSettings().framework.wws.proxyRetryTimeSlotMs; + static const auto retrySleepTimeSecs = AppConfig::GetSettings().framework.wws.proxyRetrySleepSecs; + + uint64_t intervalMs; + + if (ra == OpErrRecommendedAction::RetryBackoff) + { + // resource related problems cause attempts with intervals in exponential back-off + intervalMs = static_cast (rand() * (pow(2, count) - 1) / RAND_MAX) * retryTimeSlotMs; + std::this_thread::sleep_for(std::chrono::milliseconds(intervalMs)); + } + else if (Open()/* managed to re-open proxy? */) + { + utils::SerializeTo(errMsgBuffer, "Proxy for web service at '", m_svcEndptAddr, "' was re-opened after loss of connection"); + Logger::Write(errMsgBuffer.data(), Logger::PRIO_NOTICE); + } + else // proxy was already opened? + { + // connectivity related problems cause attempts with constant interval: + intervalMs = 1000UL * retrySleepTimeSecs; + std::this_thread::sleep_for(std::chrono::milliseconds(intervalMs)); + } + } + + if (count > 0) + { + auto elapsed = static_cast (clock() - startTime) / CLOCKS_PER_SEC; + + utils::SerializeTo(errMsgBuffer, + operLabel, " failed after ", count, " attempt(s) in ", + format(elapsed).precision(3), " second(s)"); + } + else + utils::SerializeTo(errMsgBuffer, operLabel, " returned an error"); + + err.RaiseExClientNotOK(hr, errMsgBuffer.data(), heap); + } + + + /// + /// Wraps a call to the proxy implementation (generated by wsutil.exe) of a service + /// operation, taking responsibility for memory allocation and error handling. + /// In cases of error due to exhaustion of resources or loss of connection, a + /// retry logic is used before throwing an exception. + /// + /// A label for the service operation. + /// Size of the heap dedicated for the operation and its error handling. + /// A wrap around the proxy implementation for the service operation. + void WebServiceProxy::Call(const char *operLabel, + size_t operHeapSize, + const WsCallWrap &operWrap) + { + m_pimpl->Call(operLabel, operHeapSize, operWrap); + } + + + /// + /// Wraps a call to the proxy implementation (generated by wsutil.exe) of + /// a service operation, starting it asynchronously and taking responsibility + /// for memory allocation and error handling. + /// In cases of error due to exhaustion of resources or loss of connection, a + /// retry logic is used before throwing an exception. + /// + /// A label for the service operation. + /// Size of the heap dedicated for the operation and its error handling. + /// A wrap around the proxy implementation for the service operation. + /// A object to await for operation completion. + std::future WebServiceProxy::CallAsync(const char *operLabel, + size_t operHeapSize, + const WsCallWrap &operWrap) + { + CALL_STACK_TRACE; + + try + { + return std::async(std::launch::async, + [this](const char *operLabel, size_t operHeapSize, const WsCallWrap &operWrap) + { + m_pimpl->Call(operLabel, operHeapSize, operWrap); + }, + operLabel, + operHeapSize, + operWrap + ); + } + catch (std::system_error &ex) + { + std::ostringstream oss; + oss << operLabel << " failed to be launched asynchronously" + << StdLibExt::GetDetailsFromSystemError(ex); + + throw AppException(oss.str()); + } + } + + }// namespace wws }// namespace web }// namespace _3fd diff --git a/3FD/web_wws_impl_proxy.h b/3FD/web_wws_impl_proxy.h index 7a6db75..a45e720 100644 --- a/3FD/web_wws_impl_proxy.h +++ b/3FD/web_wws_impl_proxy.h @@ -5,6 +5,7 @@ #include "web_wws_impl_utils.h" #include +#include #include namespace _3fd @@ -16,7 +17,7 @@ namespace wws /// /// Represents a proxy for a running web service host. /// - class WebServiceProxyImpl : notcopiable + class WebServiceProxyImpl { private: @@ -26,6 +27,8 @@ namespace wws std::mutex m_proxyStateMutex; + std::atomic m_isOnHold; + WSHeap m_heap; std::vector *> m_promises; @@ -52,9 +55,9 @@ namespace wws CallbackCreateServiceProxyImpl callback ); - ~WebServiceProxyImpl(); + WebServiceProxyImpl(const WebServiceProxyImpl &) = delete; - WSAsyncOper CreateAsyncOperation(size_t heapSize); + ~WebServiceProxyImpl(); /// /// Gets the handle for this web service proxy. @@ -62,9 +65,13 @@ namespace wws /// A handle for this web service proxy. WS_SERVICE_PROXY *GetHandle() const { return m_wsSvcProxyHandle; } - void Open(); + bool Open(); bool Close(); bool Abort(); + + void Call(const char *operLabel, + size_t operHeapSize, + const WsCallWrap &operWrap); }; }// end of namespace wws diff --git a/3FD/web_wws_impl_utils.cpp b/3FD/web_wws_impl_utils.cpp index 0e986a6..a81d8e3 100644 --- a/3FD/web_wws_impl_utils.cpp +++ b/3FD/web_wws_impl_utils.cpp @@ -1,6 +1,5 @@ #include "stdafx.h" #include "web_wws_impl_utils.h" - #include "callstacktracer.h" #include "logger.h" @@ -71,6 +70,7 @@ namespace wws return obj; } + ///////////////////////////// // WSHeap Class ///////////////////////////// @@ -131,6 +131,7 @@ namespace wws return ptr; } + ///////////////////// // Host Utilities ///////////////////// @@ -289,6 +290,7 @@ namespace wws } } + /// /// Creates a SOAP fault response from an exception (service error) /// and record it as rich error information. @@ -312,6 +314,7 @@ namespace wws ); } + /// /// Helper for HTTP header authorization. /// From the current operation context, the windows token for the (at this point) diff --git a/3FD/web_wws_impl_utils.h b/3FD/web_wws_impl_utils.h index e797d6a..534bbb4 100644 --- a/3FD/web_wws_impl_utils.h +++ b/3FD/web_wws_impl_utils.h @@ -23,6 +23,7 @@ namespace wws WS_STRING ToWsString(const string &str, WSHeap &heap); + ////////////////////// // XML Handling ////////////////////// @@ -33,6 +34,7 @@ namespace wws WS_FAULT_DETAIL_DESCRIPTION GetFaultDetailDescription(WSHeap &heap); + /// /// A wrapper for WS_XML_WRITER. /// @@ -67,6 +69,7 @@ namespace wws void WriteText(const string &content); }; + /// /// A wrapper for WS_XML_READER. /// @@ -102,12 +105,6 @@ namespace wws void ReadText(std::vector &utf8text); }; - //////////////////////////// - // Asynchronous Helper - //////////////////////////// - - void CALLBACK AsyncDoneCallback(HRESULT hres, WS_CALLBACK_MODEL model, void *state); - }// end of namespace wws }// end of namespace web }// end of namespace _3fd diff --git a/3FD/web_wws_impl_utils_wsasyncoper.cpp b/3FD/web_wws_impl_utils_wsasyncoper.cpp deleted file mode 100644 index d6fd3c8..0000000 --- a/3FD/web_wws_impl_utils_wsasyncoper.cpp +++ /dev/null @@ -1,142 +0,0 @@ -#include "stdafx.h" -#include "web_wws_impl_utils.h" - -#include "callstacktracer.h" - -namespace _3fd -{ -namespace web -{ -namespace wws -{ - using namespace _3fd::core; - - /// - /// The callback invoked when an asynchronous operation finishes. - /// This may be invoked synchronously. - /// - /// The HRESULT of status returned by the asynchronous call. - /// The asynchronous model from WWS API for the current call. - /// The state, which packs parameters for this callback. - void CALLBACK AsyncDoneCallback(HRESULT hres, WS_CALLBACK_MODEL model, void *state) - { - CALL_STACK_TRACE; - - auto &promise = *static_cast *> (state); - - try - { - promise.set_value(hres); - } - catch (std::future_error &ex) - { - std::ostringstream oss; - oss << "Failed to retrieve result from asynchronous operation: " - << StdLibExt::GetDetailsFromFutureError(ex); - - AppException appEx(oss.str()); - promise.set_exception(std::make_exception_ptr(appEx)); - } - } - - /// - /// Initializes a new instance of the class. - /// - /// - /// Size of the heap (in bytes) that provides memory for the call in the web service proxy. - /// - /// - /// A object for the asynchronous call in the web service. - /// Such an object must be allocated in a way it is allowed o outlive this object in construction, - /// which is why it will actually reside inside the web service proxy. - /// - WSAsyncOper::WSAsyncOper(size_t heapSize, std::promise *promise) - try : - m_promise(promise), - m_heap(heapSize), - m_callReturn(WS_S_ASYNC) - { - m_future = m_promise->get_future(); - } - catch (std::future_error &ex) - { - std::ostringstream oss; - oss << "Failed when preparing for asynchronous operation: " - << StdLibExt::GetDetailsFromFutureError(ex); - - throw AppException(oss.str()); - } - catch (std::exception &ex) - { - std::ostringstream oss; - oss << "Generic failure when preparing for asynchronous operation: " << ex.what(); - throw AppException(oss.str()); - } - - /// - /// Gets the context structure used by WWS API calls in asynchronous execution. - /// - /// - /// A copy of the context structure to pass as parameter for the asynchronous call. - /// - WS_ASYNC_CONTEXT WSAsyncOper::GetContext() - { - WS_ASYNC_CONTEXT ctx; - ctx.callback = AsyncDoneCallback; - ctx.callbackState = m_promise; - return ctx; - } - - /// - /// The HRESULT immediately returned by the call meant to be asynchronous. - /// - /// The immediately returned HRESULT. - void WSAsyncOper::SetCallReturn(HRESULT hres) - { - m_callReturn = hres; - } - - /// - /// Waits for the result of the asynchronous operation. - /// - void WSAsyncOper::Wait() const - { - if (m_callReturn == WS_S_ASYNC) - m_future.wait(); - } - - /// - /// Gets the result of the asynchronous operation. - /// - /// - /// The HRESULT of status returned at the end of the asynchronous operation. - /// - HRESULT WSAsyncOper::GetResult() - { - if (m_callReturn == WS_S_ASYNC) - { - try - { - return m_callReturn = m_future.get(); - } - catch (IAppException &) - { - throw; /* just forward transported exceptions which - are known to have been already handled */ - } - catch (std::future_error &ex) - { - std::ostringstream oss; - oss << "Failed to retrieve result from asynchronous operation: " - << StdLibExt::GetDetailsFromFutureError(ex); - - throw AppException(oss.str()); - } - } - else - return m_callReturn; - } - -}// end of namespace wws -}// end of namespace web -}// end of namespace _3fd diff --git a/3FD/web_wws_impl_utils_wserror.cpp b/3FD/web_wws_impl_utils_wserror.cpp index 65a5dcc..82a013e 100644 --- a/3FD/web_wws_impl_utils_wserror.cpp +++ b/3FD/web_wws_impl_utils_wserror.cpp @@ -1,6 +1,5 @@ #include "stdafx.h" #include "web_wws_impl_utils.h" - #include "callstacktracer.h" #include "logger.h" #include @@ -102,11 +101,10 @@ namespace wws /// An exception object assembled from the given information. static AppException - CreateExceptionApiError( - WS_ERROR *wsErrorHandle, - HRESULT hres, - const char *funcName, - const char *message) + CreateExceptionApiError(WS_ERROR *wsErrorHandle, + HRESULT hres, + const char *funcName, + const char *message) { try { @@ -172,10 +170,9 @@ namespace wws /// The returned HRESULT code. /// Name of the function. /// The error message. - void WSError::RaiseExceptionApiError( - HRESULT hres, - const char *funcName, - const char *message) + void WSError::RaiseExceptionApiError(HRESULT hres, + const char *funcName, + const char *message) { if (hres == S_OK || hres == WS_S_ASYNC) return; @@ -198,10 +195,9 @@ namespace wws /// The returned HRESULT code. /// Name of the function. /// The error message. - void WSError::LogApiError( - HRESULT hres, - const char *funcName, - const char *message) NOEXCEPT + void WSError::LogApiError(HRESULT hres, + const char *funcName, + const char *message) NOEXCEPT { if (hres == S_OK || hres == WS_S_ASYNC) return; @@ -225,11 +221,10 @@ namespace wws /// A heap for memory allocation. static AppException - CreateExceptionSoapFault( - WS_ERROR *wsErrorHandle, - HRESULT hres, - const char *message, - WSHeap &heap) + CreateExceptionSoapFault(WS_ERROR *wsErrorHandle, + HRESULT hres, + const char *message, + WSHeap &heap) { try { @@ -246,7 +241,7 @@ namespace wws if (hr != S_OK) { oss << "Another failure prevented retrieval of information from SOAP fault response " - "(WsGetFaultErrorProperty returned " << WWAPI::GetHResultLabel(hr) << ')'; + "(WsGetFaultErrorProperty returned " << WWAPI::GetHResultLabel(hr) << ')'; return AppException(message, oss.str()); } @@ -337,7 +332,7 @@ namespace wws auto what = oss.str(); oss.str(""); oss << "Another failure prevented retrieval of details from SOAP fault response " - "(WsGetFaultErrorDetail returned " << WWAPI::GetHResultLabel(hr) << ')'; + "(WsGetFaultErrorDetail returned " << WWAPI::GetHResultLabel(hr) << ')'; return AppException(what, oss.str()); } @@ -371,8 +366,8 @@ namespace wws catch (std::exception &ex) { std::ostringstream oss; - oss << "Another generic failure prevented retrieval of further information " - "from SOAP fault response: " << ex.what(); + oss << "Another generic failure prevented retrieval of further " + "information from SOAP fault response: " << ex.what(); return AppException(message, oss.str()); } @@ -385,7 +380,7 @@ namespace wws /// regarding the error, than raises an exception with such content. /// /// The operation result code. - /// The base message for the error. + /// A simple error message. /// A heap for memory allocation. void WSError::RaiseExClientNotOK(HRESULT hres, const char *message, WSHeap &heap) { diff --git a/3FD/web_wws_utils.h b/3FD/web_wws_utils.h index b41edb2..481c074 100644 --- a/3FD/web_wws_utils.h +++ b/3FD/web_wws_utils.h @@ -1,13 +1,11 @@ #ifndef WEB_WWS_UTILS_H // header guard #define WEB_WWS_UTILS_H -#include "base.h" #include "exceptions.h" #include #include #include -#include #define WS_HEAP_NEW(HEAPOBJ, TYPE, INITIALIZER) (new (HEAPOBJ.Alloc()) TYPE INITIALIZER) @@ -23,7 +21,7 @@ namespace wws /// A heap provides precise control over memory allocation when producing or /// consuming messages and when needing to allocate various other API structures. /// - class WSHeap : notcopiable + class WSHeap { private: @@ -36,6 +34,8 @@ namespace wws WSHeap(size_t nBytes); + WSHeap(const WSHeap &) = delete; + ~WSHeap(); /// @@ -49,7 +49,7 @@ namespace wws ob.m_wsHeapHandle = nullptr; } - void Reset() NOEXCEPT; + void Reset(); void *Alloc(size_t qtBytes); @@ -71,10 +71,11 @@ namespace wws WS_HEAP *GetHandle() { return m_wsHeapHandle; } }; + /// /// A reusable object model capable to hold rich error information. /// - class WSError : notcopiable + class WSError { private: @@ -88,6 +89,8 @@ namespace wws WSError(); ~WSError(); + WSError(const WSError &) = delete; + /// /// Initializes a new instance of the class /// with a handle for an already existent rich error info object. @@ -108,104 +111,23 @@ namespace wws ob.m_wsErrorHandle = nullptr; } - void RaiseExceptionApiError( - HRESULT hres, - const char *funcName, - const char *message); + void RaiseExceptionApiError(HRESULT hres, + const char *funcName, + const char *message); - void LogApiError( - HRESULT hres, - const char *funcName, - const char *message) NOEXCEPT; + void LogApiError(HRESULT hres, + const char *funcName, + const char *message) NOEXCEPT; - void RaiseExClientNotOK( - HRESULT hres, - const char *message, - WSHeap &heap); + void RaiseExClientNotOK(HRESULT hres, + const char *message, + WSHeap &heap); WS_ERROR *GetHandle(); - void Reset(); + void Reset() NOEXCEPT; }; - /// - /// Helper class for asynchronous operations with WWS API. - /// - class WSAsyncOper : notcopiable - { - private: - - std::promise *m_promise; - std::future m_future; - - WSHeap m_heap; - WSError m_richErrorInfo; - - /// - /// The HRESULT immediately returned by the call meant to be asynchronous. - /// - HRESULT m_callReturn; - - void Wait() const; - - HRESULT GetResult(); - - // Forbidden operation - WSAsyncOper &operator =(const WSAsyncOper &) { return *this; } - - public: - - WSAsyncOper(size_t heapSize, std::promise *promise); - - /// - /// Finalizes an instance of the class. - /// - WSAsyncOper::~WSAsyncOper() {} - - /// - /// Initializes a new instance of the class - /// using move semantics. - /// - /// The object whose resources will be stolen. - WSAsyncOper(WSAsyncOper &&ob) : - m_promise(ob.m_promise), - m_future(std::move(ob.m_future)), - m_heap(std::move(ob.m_heap)), - m_richErrorInfo(std::move(ob.m_richErrorInfo)), - m_callReturn(ob.m_callReturn) - {} - - WS_ASYNC_CONTEXT GetContext(); - - void SetCallReturn(HRESULT hres); - - /// - /// Gets the heap dedicated for this asynchronous operation. - /// - /// The heap handle. - WS_HEAP *GetHeapHandle() { return m_heap.GetHandle(); } - - /// - /// Gets the helper for rich error information - /// dedicated to this asynchronous operation. - /// - /// - /// The handle for the rich error information helper. - /// - WS_ERROR *GetErrHelperHandle() { return m_richErrorInfo.GetHandle(); } - - /// - /// Waits and checks the result code from a proxy asynchronous operation. - /// When the given result code means "NOT OKAY", populate the object with rich information - /// regarding the error, than raises an exception with such content. - /// - /// The base message for the error. - void RaiseExClientNotOK(const char *message) - { - m_richErrorInfo.RaiseExClientNotOK(GetResult(), message, m_heap); - } - }; - }// end of namespace wws }// end of namespace web }// end of namespace _3fd diff --git a/3FD/web_wws_webserviceproxy.h b/3FD/web_wws_webserviceproxy.h index 52a8ab1..d6e855d 100644 --- a/3FD/web_wws_webserviceproxy.h +++ b/3FD/web_wws_webserviceproxy.h @@ -2,6 +2,8 @@ #define WEB_WWS_WEBSERVICEPROXY_H #include "web_wws_utils.h" +#include +#include namespace _3fd { @@ -129,12 +131,16 @@ namespace wws WSError & ); + typedef std::function WsCallWrap; + class WebServiceProxyImpl; /// /// Represents a proxy for a running web service host. + /// This implementation is thread-safe, although + /// it is not meant to be used concurrently. /// - class WebServiceProxy : notcopiable + class WebServiceProxy { private: @@ -144,6 +150,14 @@ namespace wws WS_SERVICE_PROXY *GetHandle() const; + void Call(const char *operLabel, + size_t operHeapSize, + const WsCallWrap &operWrap); + + std::future CallAsync(const char *operLabel, + size_t operHeapSize, + const WsCallWrap &operWrap); + public: WebServiceProxy(const string &svcEndpointAddress, @@ -164,6 +178,8 @@ namespace wws CallbackCreateServiceProxyImpl callback ); + WebServiceProxy(const WebServiceProxy &) = delete; + /// /// Initializes a new instance of the class /// using move semantics. @@ -177,9 +193,7 @@ namespace wws ~WebServiceProxy(); - WSAsyncOper CreateAsyncOperation(size_t heapSize); - - void Open(); + bool Open(); bool Close(); bool Abort(); }; diff --git a/Acknowledgements.txt b/Acknowledgements.txt index 344357f..8d33d19 100644 --- a/Acknowledgements.txt +++ b/Acknowledgements.txt @@ -18,7 +18,7 @@ and by any means. ============================================================================== -POCO C++ Libraries v1.4-6 (http://pocoproject.org/) +POCO C++ Libraries v1.x (http://pocoproject.org/) Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by diff --git a/CreateMsSqlSvcBrokerDatabase.sql b/CreateMsSqlSvcBrokerDB.sql similarity index 84% rename from CreateMsSqlSvcBrokerDatabase.sql rename to CreateMsSqlSvcBrokerDB.sql index baa25576ddf801ccf8d0a96906814520db743b12..7e8f27c7c2dbf98500398d7b8e56dbadf3488cb9 100644 GIT binary patch delta 767 zcmbu7%}T>S6ot=D5EOz7cbZ)``UZB9CX*PYlAy|c4=rVh^d6GVYFW{rN zbE}?vW1y8vDH0|#OwRqzoI81O-p`M}KKtmxz{Utu+~OH?OfaiHtYmqS9#wDFVY#x8 z8ysLCAu^q1?ICBqi=I+qehCpFRidzdh^(|R;FlgQx$3Z@%V$7+4j(O6IO^T#9h_0; z!<-{BBDhd(IllsMpB^IRc(j+F*P2p z8%_0Uh2?s%x=lHKMr+5ESb>JHN%=dxv`U7nISfx`bBJ@@`~r78cfl)|bIdR)ITdmj z+BuiOeU>DYCk$T$ejjBwlLguL^?h&fDF16x;6WoyY4W(iU<-e|rBzQ@5W9PSnt%5j DG7aTn149 diff --git a/ImageTranscoder/ImageTranscoder.cpp b/ImageTranscoder/ImageTranscoder.cpp index bd6bce1..be598b4 100644 --- a/ImageTranscoder/ImageTranscoder.cpp +++ b/ImageTranscoder/ImageTranscoder.cpp @@ -113,7 +113,7 @@ int main(int argc, const char *argv[]) auto startTime = clock(); - FrameworkInstance _framework(RO_INIT_MULTITHREADED); + FrameworkInstance _framework(FrameworkInstance::ComMultiThreaded); CALL_STACK_TRACE; diff --git a/ImageTranscoderApp/ImageTranscoderApp.vcxproj b/ImageTranscoderApp/ImageTranscoderApp.vcxproj index e30e1f7..f654109 100644 --- a/ImageTranscoderApp/ImageTranscoderApp.vcxproj +++ b/ImageTranscoderApp/ImageTranscoderApp.vcxproj @@ -98,6 +98,7 @@ ImageTranscoderApp_TemporaryKey.pfx + BD2AD143C750BE18975B98FA70A9678EC55B2811 $(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)\ diff --git a/ImageTranscoderApp/ImageTranscoderApp_TemporaryKey.pfx b/ImageTranscoderApp/ImageTranscoderApp_TemporaryKey.pfx new file mode 100644 index 0000000000000000000000000000000000000000..5a9afc172024206e742c9f2df63ce10fbd58e88c GIT binary patch literal 2600 zcmZXUc|6qX9>;&fEJnkzj-_cRWUsLtdyyDJ3)#!Q4%x;U#`@DC8A+6_Y@r2(3}Yve zEeB=ajcn0Hma^o|>2>cpulu^M=k_1f~RtQrr2>pozp?f$Cob|t$(VQL1 zlDf#=P_rKA&%}i2gM!eJH`5CbB~$I*)#o^=SLPgrcCv7{naev>pNRDl#+b+CEsvVs z=+4}8k)gjyyVvRcI0l2P)`5%iLaK_2hBv5S+e?c=WK$t!!qy|=f<0^!FP+9M60QwI z-IAz=Tk(FUklatvGo;sR+F7J}fG?#%#A(>8Zx3W{*3|)K;8{L8f#atYyAMI&6^_`0~Dm zNcZW*ZGu&k4Sg~}5pAm@CGNuXy7H*n#pVL^d9U1tu%`q9IN^KIV0>_YpL~c2aHD!) ztFgt%Bi1-P+IbtNj^0S2x1Lc6KwZF5(>T(t4m$XTn*Vk)Hd(M3HFNRaJcZ zS^reu{F7U2=OVMHdy;P@PU6|>!zY-B=C@yvrW3%&@Ohm)zYt;NifX=G*olV-p1I$= zF{fxt-(4vl+Yh!x#qq=77IRD18O2k?lyvKU_HM45JU-6TL8r*24rZRYH_;rSTpzHS zHA`O~=A^0?$Lla9i~LM1QFZtv{E+>j1yn0UErQ46&_pwOgZjuBY8hY0z1Ld%ol=dR%`@9N*=G3LGZr z=xQKA%H>8%kjJ8L)J|u&K^I~TB8n`!7Qx3n^tM(l5Ijq%psvQ-&qzlJofXf3KL;;1 z$dAXpNm5i2h44RU+3Tg@yp9r@c&J5@8Uf#>mV%g*{N=;Tk&5P<*MnU{;WlGm zELROK%;=x1%2Mk7*lHn{CzX=?%@&D1w(MrOOV9zYAou$6`?DjR-aDq(7)JYNZNGaW zz49Z$Xk9?)OR&I!cFX> zN7aUA-oAABNIn?_7nT_lAG1Z5j>bv^g^5wxYn)oH<8RiBv)LivmDrw_@N-oZBx zj?TxY3AxEdf5377JuZ>Fa&RaV0ssKc;vdK(XMiODs=t;ppbW?Xj(`#%3%D}0$}gn| zC;*CpGlMw-IKbhTa$)2v0rHG&RR&W9To|4Upop`9BcWmC@;XL-loo=SyHa@N7*AdSoL-{XxhBh3{uB`VQiiKr}w$TfqYOUBO zB>hHRi?b0I5Ss>sksJ8WuQ7yuWctIcORQa5y_emu_0^vCLX@|b-B(X^9jZ>8=N(8k zcQ*4?Fr5CB^f65^gqO6%ZP4^bmurhZXX%0ed7FT$D~o5IJriD02~^n7J>gVW<8asW zQyIo2%X+xLML47X8rzs?-|r=Y8CQ{o#xj!_v;cag!^o;n@wrvueo0&z>mT^ZPE zHmy5>i&uTB#&)&ETQL@sPt?zJSgVco{;=Ybik#iau+7%hM-yY#vy5??wCfw~Yo6Ph z_gKI0AHT}Cx1PDKa=9QT`*M!vE}i7AQY@>HsIic&*c$eoy505@$x+$pfZ}ft&b_bW zL8IuWcTnhNwAw%Mw+juvzB1J2Pzg<pYrqsKp(EO4o&s=7^EyEv~ms@hcdvAedH z#c?%a)-K{ggG&TGrqY4xQ;9kp3Id|!m9?xBro=?UX{Ufya&^a`BWl0B&Pq)Dtm0uK z{hnAEIG(x93nW``GIdD2%BgQ-y{8k!nj|_&OAF$Ln2Wc11yBa%^2GG(i4H^qRrbT$ zPn}VdZUugO{nDN!zGx*SvG~=VJdJ?WAR&HE#gN_s{(uEmulP~1+VpABdHkxUKB7fL zKWyH0T~|}l1e3l`7`wo?yK|Trs`+9lsp#s_RW;DgXXI@!ouh~ Jl)pakzX61dk5K>s literal 0 HcmV?d00001 diff --git a/ImageTranscoderApp/Package.appxmanifest b/ImageTranscoderApp/Package.appxmanifest index 4250ee1..2b4dc2d 100644 --- a/ImageTranscoderApp/Package.appxmanifest +++ b/ImageTranscoderApp/Package.appxmanifest @@ -1,6 +1,6 @@  - + ImageTranscoderApp diff --git a/IntegrationTests/AcmeTesting_w32.h b/IntegrationTests/AcmeTesting_w32.h index 42d1584..c7e916d 100644 --- a/IntegrationTests/AcmeTesting_w32.h +++ b/IntegrationTests/AcmeTesting_w32.h @@ -8,7 +8,7 @@ */ /* Compiler settings for TestShared\AcmeTesting.idl: Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.01.0620 - protocol : dce , robust + protocol : dce , ms_ext, c_ext, robust error checks: allocation ref bounds_check enum stub_data , use_epv VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) @@ -52,22 +52,26 @@ extern "C"{ /* interface AcmeTesting */ /* [version][uuid] */ +typedef struct pair + { + int left; + int right; + } pair; + +void Invert( + /* [in] */ handle_t IDL_handle, + /* [out][in] */ pair *onePair); + void Operate( /* [in] */ handle_t IDL_handle, /* [in] */ double left, /* [in] */ double right, /* [out] */ double *result); -typedef /* [public][public][public] */ struct __MIDL_AcmeTesting_0001 - { - unsigned short size; - /* [size_is][string] */ unsigned char *data; - } cstring; - void ChangeCase( /* [in] */ handle_t IDL_handle, - /* [in] */ cstring *input, - /* [out] */ cstring *output); + /* [string][in] */ unsigned char *input, + /* [size_is][string][out] */ unsigned char *output); void WriteOnStorage( /* [in] */ handle_t IDL_handle); @@ -79,6 +83,9 @@ unsigned long Shutdown( typedef struct _AcmeTesting_v1_0_epv_t { + void ( *Invert )( + /* [in] */ handle_t IDL_handle, + /* [out][in] */ pair *onePair); void ( *Operate )( /* [in] */ handle_t IDL_handle, /* [in] */ double left, @@ -86,8 +93,8 @@ typedef struct _AcmeTesting_v1_0_epv_t /* [out] */ double *result); void ( *ChangeCase )( /* [in] */ handle_t IDL_handle, - /* [in] */ cstring *input, - /* [out] */ cstring *output); + /* [string][in] */ unsigned char *input, + /* [size_is][string][out] */ unsigned char *output); void ( *WriteOnStorage )( /* [in] */ handle_t IDL_handle); unsigned long ( *Shutdown )( diff --git a/IntegrationTests/AcmeTesting_w32_srv.c b/IntegrationTests/AcmeTesting_w32_srv.c index dd5213a..62f4a2b 100644 --- a/IntegrationTests/AcmeTesting_w32_srv.c +++ b/IntegrationTests/AcmeTesting_w32_srv.c @@ -8,7 +8,7 @@ */ /* Compiler settings for TestShared\AcmeTesting.idl: Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.01.0620 - protocol : dce , robust + protocol : dce , ms_ext, c_ext, robust error checks: allocation ref bounds_check enum stub_data , use_epv VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) @@ -34,8 +34,8 @@ #include #include "AcmeTesting_w32.h" -#define TYPE_FORMAT_STRING_SIZE 45 -#define PROC_FORMAT_STRING_SIZE 149 +#define TYPE_FORMAT_STRING_SIZE 35 +#define PROC_FORMAT_STRING_SIZE 183 #define EXPR_FORMAT_STRING_SIZE 1 #define TRANSMIT_AS_TABLE_SIZE 0 #define WIRE_MARSHAL_TABLE_SIZE 0 @@ -110,124 +110,150 @@ static const AcmeTesting_MIDL_PROC_FORMAT_STRING AcmeTesting__MIDL_ProcFormatStr 0, { - /* Procedure Operate */ + /* Procedure Invert */ 0x0, /* 0 */ - 0x4a, /* Old Flags: DCE mem package, */ + 0x48, /* Old Flags: */ /* 2 */ NdrFcLong( 0x0 ), /* 0 */ /* 6 */ NdrFcShort( 0x0 ), /* 0 */ -/* 8 */ NdrFcShort( 0x18 ), /* x86 Stack size/offset = 24 */ +/* 8 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ /* 10 */ 0x32, /* FC_BIND_PRIMITIVE */ 0x0, /* 0 */ /* 12 */ NdrFcShort( 0x0 ), /* x86 Stack size/offset = 0 */ -/* 14 */ NdrFcShort( 0x20 ), /* 32 */ -/* 16 */ NdrFcShort( 0x24 ), /* 36 */ +/* 14 */ NdrFcShort( 0x2c ), /* 44 */ +/* 16 */ NdrFcShort( 0x2c ), /* 44 */ /* 18 */ 0x40, /* Oi2 Flags: has ext, */ - 0x3, /* 3 */ + 0x1, /* 1 */ /* 20 */ 0x8, /* 8 */ 0x1, /* Ext Flags: new corr desc, */ /* 22 */ NdrFcShort( 0x0 ), /* 0 */ /* 24 */ NdrFcShort( 0x0 ), /* 0 */ /* 26 */ NdrFcShort( 0x0 ), /* 0 */ - /* Parameter left */ + /* Parameter onePair */ -/* 28 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 28 */ NdrFcShort( 0x11a ), /* Flags: must free, in, out, simple ref, */ /* 30 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ -/* 32 */ 0xc, /* FC_DOUBLE */ +/* 32 */ NdrFcShort( 0x6 ), /* Type Offset=6 */ + + /* Procedure Operate */ + +/* 34 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 36 */ NdrFcLong( 0x0 ), /* 0 */ +/* 40 */ NdrFcShort( 0x1 ), /* 1 */ +/* 42 */ NdrFcShort( 0x18 ), /* x86 Stack size/offset = 24 */ +/* 44 */ 0x32, /* FC_BIND_PRIMITIVE */ + 0x0, /* 0 */ +/* 46 */ NdrFcShort( 0x0 ), /* x86 Stack size/offset = 0 */ +/* 48 */ NdrFcShort( 0x20 ), /* 32 */ +/* 50 */ NdrFcShort( 0x24 ), /* 36 */ +/* 52 */ 0x40, /* Oi2 Flags: has ext, */ + 0x3, /* 3 */ +/* 54 */ 0x8, /* 8 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 56 */ NdrFcShort( 0x0 ), /* 0 */ +/* 58 */ NdrFcShort( 0x0 ), /* 0 */ +/* 60 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter left */ + +/* 62 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 64 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ +/* 66 */ 0xc, /* FC_DOUBLE */ 0x0, /* 0 */ /* Parameter right */ -/* 34 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ -/* 36 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ -/* 38 */ 0xc, /* FC_DOUBLE */ +/* 68 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 70 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ +/* 72 */ 0xc, /* FC_DOUBLE */ 0x0, /* 0 */ /* Parameter result */ -/* 40 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ -/* 42 */ NdrFcShort( 0x14 ), /* x86 Stack size/offset = 20 */ -/* 44 */ 0xc, /* FC_DOUBLE */ +/* 74 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ +/* 76 */ NdrFcShort( 0x14 ), /* x86 Stack size/offset = 20 */ +/* 78 */ 0xc, /* FC_DOUBLE */ 0x0, /* 0 */ /* Procedure ChangeCase */ -/* 46 */ 0x0, /* 0 */ - 0x4b, /* Old Flags: full ptr, DCE mem package, */ -/* 48 */ NdrFcLong( 0x0 ), /* 0 */ -/* 52 */ NdrFcShort( 0x1 ), /* 1 */ -/* 54 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ -/* 56 */ 0x32, /* FC_BIND_PRIMITIVE */ +/* 80 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 82 */ NdrFcLong( 0x0 ), /* 0 */ +/* 86 */ NdrFcShort( 0x2 ), /* 2 */ +/* 88 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ +/* 90 */ 0x32, /* FC_BIND_PRIMITIVE */ 0x0, /* 0 */ -/* 58 */ NdrFcShort( 0x0 ), /* x86 Stack size/offset = 0 */ -/* 60 */ NdrFcShort( 0x0 ), /* 0 */ -/* 62 */ NdrFcShort( 0x0 ), /* 0 */ -/* 64 */ 0x43, /* Oi2 Flags: srv must size, clt must size, has ext, */ +/* 92 */ NdrFcShort( 0x0 ), /* x86 Stack size/offset = 0 */ +/* 94 */ NdrFcShort( 0x0 ), /* 0 */ +/* 96 */ NdrFcShort( 0x0 ), /* 0 */ +/* 98 */ 0x43, /* Oi2 Flags: srv must size, clt must size, has ext, */ 0x2, /* 2 */ -/* 66 */ 0x8, /* 8 */ - 0x7, /* Ext Flags: new corr desc, clt corr check, srv corr check, */ -/* 68 */ NdrFcShort( 0x1 ), /* 1 */ -/* 70 */ NdrFcShort( 0x1 ), /* 1 */ -/* 72 */ NdrFcShort( 0x0 ), /* 0 */ +/* 100 */ 0x8, /* 8 */ + 0x3, /* Ext Flags: new corr desc, clt corr check, */ +/* 102 */ NdrFcShort( 0x1 ), /* 1 */ +/* 104 */ NdrFcShort( 0x0 ), /* 0 */ +/* 106 */ NdrFcShort( 0x0 ), /* 0 */ /* Parameter input */ -/* 74 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ -/* 76 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ -/* 78 */ NdrFcShort( 0x12 ), /* Type Offset=18 */ +/* 108 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ +/* 110 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ +/* 112 */ NdrFcShort( 0x14 ), /* Type Offset=20 */ /* Parameter output */ -/* 80 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ -/* 82 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ -/* 84 */ NdrFcShort( 0x12 ), /* Type Offset=18 */ +/* 114 */ NdrFcShort( 0x113 ), /* Flags: must size, must free, out, simple ref, */ +/* 116 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ +/* 118 */ NdrFcShort( 0x1a ), /* Type Offset=26 */ /* Procedure WriteOnStorage */ -/* 86 */ 0x0, /* 0 */ - 0x4a, /* Old Flags: DCE mem package, */ -/* 88 */ NdrFcLong( 0x0 ), /* 0 */ -/* 92 */ NdrFcShort( 0x2 ), /* 2 */ -/* 94 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ -/* 96 */ 0x32, /* FC_BIND_PRIMITIVE */ +/* 120 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 122 */ NdrFcLong( 0x0 ), /* 0 */ +/* 126 */ NdrFcShort( 0x3 ), /* 3 */ +/* 128 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ +/* 130 */ 0x32, /* FC_BIND_PRIMITIVE */ 0x0, /* 0 */ -/* 98 */ NdrFcShort( 0x0 ), /* x86 Stack size/offset = 0 */ -/* 100 */ NdrFcShort( 0x0 ), /* 0 */ -/* 102 */ NdrFcShort( 0x0 ), /* 0 */ -/* 104 */ 0x40, /* Oi2 Flags: has ext, */ +/* 132 */ NdrFcShort( 0x0 ), /* x86 Stack size/offset = 0 */ +/* 134 */ NdrFcShort( 0x0 ), /* 0 */ +/* 136 */ NdrFcShort( 0x0 ), /* 0 */ +/* 138 */ 0x40, /* Oi2 Flags: has ext, */ 0x0, /* 0 */ -/* 106 */ 0x8, /* 8 */ +/* 140 */ 0x8, /* 8 */ 0x1, /* Ext Flags: new corr desc, */ -/* 108 */ NdrFcShort( 0x0 ), /* 0 */ -/* 110 */ NdrFcShort( 0x0 ), /* 0 */ -/* 112 */ NdrFcShort( 0x0 ), /* 0 */ +/* 142 */ NdrFcShort( 0x0 ), /* 0 */ +/* 144 */ NdrFcShort( 0x0 ), /* 0 */ +/* 146 */ NdrFcShort( 0x0 ), /* 0 */ /* Procedure Shutdown */ -/* 114 */ 0x0, /* 0 */ - 0x4a, /* Old Flags: DCE mem package, */ -/* 116 */ NdrFcLong( 0x0 ), /* 0 */ -/* 120 */ NdrFcShort( 0x3 ), /* 3 */ -/* 122 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ -/* 124 */ 0x32, /* FC_BIND_PRIMITIVE */ +/* 148 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 150 */ NdrFcLong( 0x0 ), /* 0 */ +/* 154 */ NdrFcShort( 0x4 ), /* 4 */ +/* 156 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ +/* 158 */ 0x32, /* FC_BIND_PRIMITIVE */ 0x0, /* 0 */ -/* 126 */ NdrFcShort( 0x0 ), /* x86 Stack size/offset = 0 */ -/* 128 */ NdrFcShort( 0x0 ), /* 0 */ -/* 130 */ NdrFcShort( 0x8 ), /* 8 */ -/* 132 */ 0x44, /* Oi2 Flags: has return, has ext, */ +/* 160 */ NdrFcShort( 0x0 ), /* x86 Stack size/offset = 0 */ +/* 162 */ NdrFcShort( 0x0 ), /* 0 */ +/* 164 */ NdrFcShort( 0x8 ), /* 8 */ +/* 166 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x1, /* 1 */ -/* 134 */ 0x8, /* 8 */ +/* 168 */ 0x8, /* 8 */ 0x1, /* Ext Flags: new corr desc, */ -/* 136 */ NdrFcShort( 0x0 ), /* 0 */ -/* 138 */ NdrFcShort( 0x0 ), /* 0 */ -/* 140 */ NdrFcShort( 0x0 ), /* 0 */ +/* 170 */ NdrFcShort( 0x0 ), /* 0 */ +/* 172 */ NdrFcShort( 0x0 ), /* 0 */ +/* 174 */ NdrFcShort( 0x0 ), /* 0 */ /* Return value */ -/* 142 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 144 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ -/* 146 */ 0x8, /* FC_LONG */ +/* 176 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 178 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ +/* 180 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ 0x0 @@ -240,44 +266,35 @@ static const AcmeTesting_MIDL_TYPE_FORMAT_STRING AcmeTesting__MIDL_TypeFormatStr { NdrFcShort( 0x0 ), /* 0 */ /* 2 */ + 0x11, 0x0, /* FC_RP */ +/* 4 */ NdrFcShort( 0x2 ), /* Offset= 2 (6) */ +/* 6 */ + 0x15, /* FC_STRUCT */ + 0x3, /* 3 */ +/* 8 */ NdrFcShort( 0x8 ), /* 8 */ +/* 10 */ 0x8, /* FC_LONG */ + 0x8, /* FC_LONG */ +/* 12 */ 0x5c, /* FC_PAD */ + 0x5b, /* FC_END */ +/* 14 */ 0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */ -/* 4 */ 0xc, /* FC_DOUBLE */ +/* 16 */ 0xc, /* FC_DOUBLE */ 0x5c, /* FC_PAD */ -/* 6 */ +/* 18 */ + 0x11, 0x8, /* FC_RP [simple_pointer] */ +/* 20 */ + 0x22, /* FC_C_CSTRING */ + 0x5c, /* FC_PAD */ +/* 22 */ 0x11, 0x0, /* FC_RP */ -/* 8 */ NdrFcShort( 0xa ), /* Offset= 10 (18) */ -/* 10 */ +/* 24 */ NdrFcShort( 0x2 ), /* Offset= 2 (26) */ +/* 26 */ 0x22, /* FC_C_CSTRING */ 0x44, /* FC_STRING_SIZED */ -/* 12 */ 0x17, /* Corr desc: field pointer, FC_USHORT */ - 0x0, /* */ -/* 14 */ NdrFcShort( 0x0 ), /* 0 */ -/* 16 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ -/* 18 */ - 0x16, /* FC_PSTRUCT */ - 0x3, /* 3 */ -/* 20 */ NdrFcShort( 0x8 ), /* 8 */ -/* 22 */ - 0x4b, /* FC_PP */ - 0x5c, /* FC_PAD */ -/* 24 */ - 0x46, /* FC_NO_REPEAT */ - 0x5c, /* FC_PAD */ -/* 26 */ NdrFcShort( 0x4 ), /* 4 */ -/* 28 */ NdrFcShort( 0x4 ), /* 4 */ -/* 30 */ 0x14, 0x0, /* FC_FP */ -/* 32 */ NdrFcShort( 0xffea ), /* Offset= -22 (10) */ -/* 34 */ - 0x5b, /* FC_END */ - - 0x6, /* FC_SHORT */ -/* 36 */ 0x3e, /* FC_STRUCTPAD2 */ - 0x8, /* FC_LONG */ -/* 38 */ 0x5c, /* FC_PAD */ - 0x5b, /* FC_END */ -/* 40 */ - 0x11, 0x4, /* FC_RP [alloced_on_stack] */ -/* 42 */ NdrFcShort( 0xffe8 ), /* Offset= -24 (18) */ +/* 28 */ 0x40, /* Corr desc: constant, val=256 */ + 0x0, /* 0 */ +/* 30 */ NdrFcShort( 0x100 ), /* 256 */ +/* 32 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ 0x0 } @@ -286,17 +303,18 @@ static const AcmeTesting_MIDL_TYPE_FORMAT_STRING AcmeTesting__MIDL_TypeFormatStr static const unsigned short AcmeTesting_FormatStringOffsetTable[] = { 0, - 46, - 86, - 114 + 34, + 80, + 120, + 148 }; static const MIDL_STUB_DESC AcmeTesting_StubDesc = { (void *)& AcmeTesting___RpcServerInterface, - NdrRpcSsDefaultAllocate, - NdrRpcSsDefaultFree, + MIDL_user_allocate, + MIDL_user_free, 0, 0, 0, @@ -322,16 +340,18 @@ static const RPC_DISPATCH_FUNCTION AcmeTesting_table[] = NdrServerCall2, NdrServerCall2, NdrServerCall2, + NdrServerCall2, 0 }; static const RPC_DISPATCH_TABLE AcmeTesting_v1_0_DispatchTable = { - 4, + 5, (RPC_DISPATCH_FUNCTION*)AcmeTesting_table }; static const AcmeTesting_v1_0_epv_t DEFAULT_EPV = { + Invert, Operate, ChangeCase, WriteOnStorage, @@ -340,6 +360,7 @@ static const AcmeTesting_v1_0_epv_t DEFAULT_EPV = static const SERVER_ROUTINE AcmeTesting_ServerRoutineTable[] = { + (SERVER_ROUTINE)Invert, (SERVER_ROUTINE)Operate, (SERVER_ROUTINE)ChangeCase, (SERVER_ROUTINE)WriteOnStorage, diff --git a/IntegrationTests/AcmeTesting_x64.h b/IntegrationTests/AcmeTesting_x64.h index 59d9f85..6745022 100644 --- a/IntegrationTests/AcmeTesting_x64.h +++ b/IntegrationTests/AcmeTesting_x64.h @@ -8,7 +8,7 @@ */ /* Compiler settings for TestShared\AcmeTesting.idl: Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.01.0620 - protocol : dce , robust + protocol : dce , ms_ext, c_ext, robust error checks: allocation ref bounds_check enum stub_data , use_epv VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) @@ -52,22 +52,26 @@ extern "C"{ /* interface AcmeTesting */ /* [version][uuid] */ +typedef struct pair + { + int left; + int right; + } pair; + +void Invert( + /* [in] */ handle_t IDL_handle, + /* [out][in] */ pair *onePair); + void Operate( /* [in] */ handle_t IDL_handle, /* [in] */ double left, /* [in] */ double right, /* [out] */ double *result); -typedef /* [public][public][public] */ struct __MIDL_AcmeTesting_0001 - { - unsigned short size; - /* [size_is][string] */ unsigned char *data; - } cstring; - void ChangeCase( /* [in] */ handle_t IDL_handle, - /* [in] */ cstring *input, - /* [out] */ cstring *output); + /* [string][in] */ unsigned char *input, + /* [size_is][string][out] */ unsigned char *output); void WriteOnStorage( /* [in] */ handle_t IDL_handle); @@ -79,6 +83,9 @@ unsigned long Shutdown( typedef struct _AcmeTesting_v1_0_epv_t { + void ( *Invert )( + /* [in] */ handle_t IDL_handle, + /* [out][in] */ pair *onePair); void ( *Operate )( /* [in] */ handle_t IDL_handle, /* [in] */ double left, @@ -86,8 +93,8 @@ typedef struct _AcmeTesting_v1_0_epv_t /* [out] */ double *result); void ( *ChangeCase )( /* [in] */ handle_t IDL_handle, - /* [in] */ cstring *input, - /* [out] */ cstring *output); + /* [string][in] */ unsigned char *input, + /* [size_is][string][out] */ unsigned char *output); void ( *WriteOnStorage )( /* [in] */ handle_t IDL_handle); unsigned long ( *Shutdown )( diff --git a/IntegrationTests/AcmeTesting_x64_srv.c b/IntegrationTests/AcmeTesting_x64_srv.c index c84c47d..05dc8c6 100644 --- a/IntegrationTests/AcmeTesting_x64_srv.c +++ b/IntegrationTests/AcmeTesting_x64_srv.c @@ -8,7 +8,7 @@ */ /* Compiler settings for TestShared\AcmeTesting.idl: Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.01.0620 - protocol : dce , robust + protocol : dce , ms_ext, c_ext, robust error checks: allocation ref bounds_check enum stub_data , use_epv VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) @@ -31,8 +31,8 @@ #include #include "AcmeTesting_x64.h" -#define TYPE_FORMAT_STRING_SIZE 39 -#define PROC_FORMAT_STRING_SIZE 157 +#define TYPE_FORMAT_STRING_SIZE 35 +#define PROC_FORMAT_STRING_SIZE 193 #define EXPR_FORMAT_STRING_SIZE 1 #define TRANSMIT_AS_TABLE_SIZE 0 #define WIRE_MARSHAL_TABLE_SIZE 0 @@ -99,128 +99,155 @@ static const AcmeTesting_MIDL_PROC_FORMAT_STRING AcmeTesting__MIDL_ProcFormatStr 0, { - /* Procedure Operate */ + /* Procedure Invert */ 0x0, /* 0 */ - 0x4a, /* Old Flags: DCE mem package, */ + 0x48, /* Old Flags: */ /* 2 */ NdrFcLong( 0x0 ), /* 0 */ /* 6 */ NdrFcShort( 0x0 ), /* 0 */ -/* 8 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */ +/* 8 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ /* 10 */ 0x32, /* FC_BIND_PRIMITIVE */ 0x0, /* 0 */ /* 12 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ -/* 14 */ NdrFcShort( 0x20 ), /* 32 */ -/* 16 */ NdrFcShort( 0x24 ), /* 36 */ +/* 14 */ NdrFcShort( 0x2c ), /* 44 */ +/* 16 */ NdrFcShort( 0x2c ), /* 44 */ /* 18 */ 0x40, /* Oi2 Flags: has ext, */ - 0x3, /* 3 */ + 0x1, /* 1 */ /* 20 */ 0xa, /* 10 */ 0x1, /* Ext Flags: new corr desc, */ /* 22 */ NdrFcShort( 0x0 ), /* 0 */ /* 24 */ NdrFcShort( 0x0 ), /* 0 */ /* 26 */ NdrFcShort( 0x0 ), /* 0 */ -/* 28 */ NdrFcShort( 0x28 ), /* 40 */ +/* 28 */ NdrFcShort( 0x0 ), /* 0 */ - /* Parameter left */ + /* Parameter onePair */ -/* 30 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 30 */ NdrFcShort( 0x11a ), /* Flags: must free, in, out, simple ref, */ /* 32 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ -/* 34 */ 0xc, /* FC_DOUBLE */ +/* 34 */ NdrFcShort( 0x6 ), /* Type Offset=6 */ + + /* Procedure Operate */ + +/* 36 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 38 */ NdrFcLong( 0x0 ), /* 0 */ +/* 42 */ NdrFcShort( 0x1 ), /* 1 */ +/* 44 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */ +/* 46 */ 0x32, /* FC_BIND_PRIMITIVE */ + 0x0, /* 0 */ +/* 48 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 50 */ NdrFcShort( 0x20 ), /* 32 */ +/* 52 */ NdrFcShort( 0x24 ), /* 36 */ +/* 54 */ 0x40, /* Oi2 Flags: has ext, */ + 0x3, /* 3 */ +/* 56 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 58 */ NdrFcShort( 0x0 ), /* 0 */ +/* 60 */ NdrFcShort( 0x0 ), /* 0 */ +/* 62 */ NdrFcShort( 0x0 ), /* 0 */ +/* 64 */ NdrFcShort( 0x28 ), /* 40 */ + + /* Parameter left */ + +/* 66 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 68 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 70 */ 0xc, /* FC_DOUBLE */ 0x0, /* 0 */ /* Parameter right */ -/* 36 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ -/* 38 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ -/* 40 */ 0xc, /* FC_DOUBLE */ +/* 72 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 74 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 76 */ 0xc, /* FC_DOUBLE */ 0x0, /* 0 */ /* Parameter result */ -/* 42 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ -/* 44 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ -/* 46 */ 0xc, /* FC_DOUBLE */ +/* 78 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ +/* 80 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ +/* 82 */ 0xc, /* FC_DOUBLE */ 0x0, /* 0 */ /* Procedure ChangeCase */ -/* 48 */ 0x0, /* 0 */ - 0x4b, /* Old Flags: full ptr, DCE mem package, */ -/* 50 */ NdrFcLong( 0x0 ), /* 0 */ -/* 54 */ NdrFcShort( 0x1 ), /* 1 */ -/* 56 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ -/* 58 */ 0x32, /* FC_BIND_PRIMITIVE */ +/* 84 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 86 */ NdrFcLong( 0x0 ), /* 0 */ +/* 90 */ NdrFcShort( 0x2 ), /* 2 */ +/* 92 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ +/* 94 */ 0x32, /* FC_BIND_PRIMITIVE */ 0x0, /* 0 */ -/* 60 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ -/* 62 */ NdrFcShort( 0x0 ), /* 0 */ -/* 64 */ NdrFcShort( 0x0 ), /* 0 */ -/* 66 */ 0x43, /* Oi2 Flags: srv must size, clt must size, has ext, */ +/* 96 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 98 */ NdrFcShort( 0x0 ), /* 0 */ +/* 100 */ NdrFcShort( 0x0 ), /* 0 */ +/* 102 */ 0x43, /* Oi2 Flags: srv must size, clt must size, has ext, */ 0x2, /* 2 */ -/* 68 */ 0xa, /* 10 */ - 0x7, /* Ext Flags: new corr desc, clt corr check, srv corr check, */ -/* 70 */ NdrFcShort( 0x1 ), /* 1 */ -/* 72 */ NdrFcShort( 0x1 ), /* 1 */ -/* 74 */ NdrFcShort( 0x0 ), /* 0 */ -/* 76 */ NdrFcShort( 0x0 ), /* 0 */ +/* 104 */ 0xa, /* 10 */ + 0x3, /* Ext Flags: new corr desc, clt corr check, */ +/* 106 */ NdrFcShort( 0x1 ), /* 1 */ +/* 108 */ NdrFcShort( 0x0 ), /* 0 */ +/* 110 */ NdrFcShort( 0x0 ), /* 0 */ +/* 112 */ NdrFcShort( 0x0 ), /* 0 */ /* Parameter input */ -/* 78 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ -/* 80 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ -/* 82 */ NdrFcShort( 0x12 ), /* Type Offset=18 */ +/* 114 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ +/* 116 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 118 */ NdrFcShort( 0x14 ), /* Type Offset=20 */ /* Parameter output */ -/* 84 */ NdrFcShort( 0x4113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=16 */ -/* 86 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ -/* 88 */ NdrFcShort( 0x12 ), /* Type Offset=18 */ +/* 120 */ NdrFcShort( 0x113 ), /* Flags: must size, must free, out, simple ref, */ +/* 122 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 124 */ NdrFcShort( 0x1a ), /* Type Offset=26 */ /* Procedure WriteOnStorage */ -/* 90 */ 0x0, /* 0 */ - 0x4a, /* Old Flags: DCE mem package, */ -/* 92 */ NdrFcLong( 0x0 ), /* 0 */ -/* 96 */ NdrFcShort( 0x2 ), /* 2 */ -/* 98 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ -/* 100 */ 0x32, /* FC_BIND_PRIMITIVE */ +/* 126 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 128 */ NdrFcLong( 0x0 ), /* 0 */ +/* 132 */ NdrFcShort( 0x3 ), /* 3 */ +/* 134 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 136 */ 0x32, /* FC_BIND_PRIMITIVE */ 0x0, /* 0 */ -/* 102 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ -/* 104 */ NdrFcShort( 0x0 ), /* 0 */ -/* 106 */ NdrFcShort( 0x0 ), /* 0 */ -/* 108 */ 0x40, /* Oi2 Flags: has ext, */ +/* 138 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 140 */ NdrFcShort( 0x0 ), /* 0 */ +/* 142 */ NdrFcShort( 0x0 ), /* 0 */ +/* 144 */ 0x40, /* Oi2 Flags: has ext, */ 0x0, /* 0 */ -/* 110 */ 0xa, /* 10 */ +/* 146 */ 0xa, /* 10 */ 0x1, /* Ext Flags: new corr desc, */ -/* 112 */ NdrFcShort( 0x0 ), /* 0 */ -/* 114 */ NdrFcShort( 0x0 ), /* 0 */ -/* 116 */ NdrFcShort( 0x0 ), /* 0 */ -/* 118 */ NdrFcShort( 0x0 ), /* 0 */ +/* 148 */ NdrFcShort( 0x0 ), /* 0 */ +/* 150 */ NdrFcShort( 0x0 ), /* 0 */ +/* 152 */ NdrFcShort( 0x0 ), /* 0 */ +/* 154 */ NdrFcShort( 0x0 ), /* 0 */ /* Procedure Shutdown */ -/* 120 */ 0x0, /* 0 */ - 0x4a, /* Old Flags: DCE mem package, */ -/* 122 */ NdrFcLong( 0x0 ), /* 0 */ -/* 126 */ NdrFcShort( 0x3 ), /* 3 */ -/* 128 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ -/* 130 */ 0x32, /* FC_BIND_PRIMITIVE */ +/* 156 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 158 */ NdrFcLong( 0x0 ), /* 0 */ +/* 162 */ NdrFcShort( 0x4 ), /* 4 */ +/* 164 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 166 */ 0x32, /* FC_BIND_PRIMITIVE */ 0x0, /* 0 */ -/* 132 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ -/* 134 */ NdrFcShort( 0x0 ), /* 0 */ -/* 136 */ NdrFcShort( 0x8 ), /* 8 */ -/* 138 */ 0x44, /* Oi2 Flags: has return, has ext, */ +/* 168 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 170 */ NdrFcShort( 0x0 ), /* 0 */ +/* 172 */ NdrFcShort( 0x8 ), /* 8 */ +/* 174 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x1, /* 1 */ -/* 140 */ 0xa, /* 10 */ +/* 176 */ 0xa, /* 10 */ 0x1, /* Ext Flags: new corr desc, */ -/* 142 */ NdrFcShort( 0x0 ), /* 0 */ -/* 144 */ NdrFcShort( 0x0 ), /* 0 */ -/* 146 */ NdrFcShort( 0x0 ), /* 0 */ -/* 148 */ NdrFcShort( 0x0 ), /* 0 */ +/* 178 */ NdrFcShort( 0x0 ), /* 0 */ +/* 180 */ NdrFcShort( 0x0 ), /* 0 */ +/* 182 */ NdrFcShort( 0x0 ), /* 0 */ +/* 184 */ NdrFcShort( 0x0 ), /* 0 */ /* Return value */ -/* 150 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 152 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ -/* 154 */ 0x8, /* FC_LONG */ +/* 186 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 188 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 190 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ 0x0 @@ -233,35 +260,35 @@ static const AcmeTesting_MIDL_TYPE_FORMAT_STRING AcmeTesting__MIDL_TypeFormatStr { NdrFcShort( 0x0 ), /* 0 */ /* 2 */ + 0x11, 0x0, /* FC_RP */ +/* 4 */ NdrFcShort( 0x2 ), /* Offset= 2 (6) */ +/* 6 */ + 0x15, /* FC_STRUCT */ + 0x3, /* 3 */ +/* 8 */ NdrFcShort( 0x8 ), /* 8 */ +/* 10 */ 0x8, /* FC_LONG */ + 0x8, /* FC_LONG */ +/* 12 */ 0x5c, /* FC_PAD */ + 0x5b, /* FC_END */ +/* 14 */ 0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */ -/* 4 */ 0xc, /* FC_DOUBLE */ +/* 16 */ 0xc, /* FC_DOUBLE */ 0x5c, /* FC_PAD */ -/* 6 */ +/* 18 */ + 0x11, 0x8, /* FC_RP [simple_pointer] */ +/* 20 */ + 0x22, /* FC_C_CSTRING */ + 0x5c, /* FC_PAD */ +/* 22 */ 0x11, 0x0, /* FC_RP */ -/* 8 */ NdrFcShort( 0xa ), /* Offset= 10 (18) */ -/* 10 */ +/* 24 */ NdrFcShort( 0x2 ), /* Offset= 2 (26) */ +/* 26 */ 0x22, /* FC_C_CSTRING */ 0x44, /* FC_STRING_SIZED */ -/* 12 */ 0x17, /* Corr desc: field pointer, FC_USHORT */ - 0x0, /* */ -/* 14 */ NdrFcShort( 0x0 ), /* 0 */ -/* 16 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ -/* 18 */ - 0x1a, /* FC_BOGUS_STRUCT */ - 0x3, /* 3 */ -/* 20 */ NdrFcShort( 0x10 ), /* 16 */ -/* 22 */ NdrFcShort( 0x0 ), /* 0 */ -/* 24 */ NdrFcShort( 0x6 ), /* Offset= 6 (30) */ -/* 26 */ 0x6, /* FC_SHORT */ - 0x42, /* FC_STRUCTPAD6 */ -/* 28 */ 0x36, /* FC_POINTER */ - 0x5b, /* FC_END */ -/* 30 */ - 0x14, 0x0, /* FC_FP */ -/* 32 */ NdrFcShort( 0xffea ), /* Offset= -22 (10) */ -/* 34 */ - 0x11, 0x4, /* FC_RP [alloced_on_stack] */ -/* 36 */ NdrFcShort( 0xffee ), /* Offset= -18 (18) */ +/* 28 */ 0x40, /* Corr desc: constant, val=256 */ + 0x0, /* 0 */ +/* 30 */ NdrFcShort( 0x100 ), /* 256 */ +/* 32 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ 0x0 } @@ -270,17 +297,18 @@ static const AcmeTesting_MIDL_TYPE_FORMAT_STRING AcmeTesting__MIDL_TypeFormatStr static const unsigned short AcmeTesting_FormatStringOffsetTable[] = { 0, - 48, - 90, - 120 + 36, + 84, + 126, + 156 }; static const MIDL_STUB_DESC AcmeTesting_StubDesc = { (void *)& AcmeTesting___RpcServerInterface, - NdrRpcSsDefaultAllocate, - NdrRpcSsDefaultFree, + MIDL_user_allocate, + MIDL_user_free, 0, 0, 0, @@ -306,16 +334,18 @@ static const RPC_DISPATCH_FUNCTION AcmeTesting_table[] = NdrServerCall2, NdrServerCall2, NdrServerCall2, + NdrServerCall2, 0 }; static const RPC_DISPATCH_TABLE AcmeTesting_v1_0_DispatchTable = { - 4, + 5, (RPC_DISPATCH_FUNCTION*)AcmeTesting_table }; static const AcmeTesting_v1_0_epv_t DEFAULT_EPV = { + Invert, Operate, ChangeCase, WriteOnStorage, @@ -324,6 +354,7 @@ static const AcmeTesting_v1_0_epv_t DEFAULT_EPV = static const SERVER_ROUTINE AcmeTesting_ServerRoutineTable[] = { + (SERVER_ROUTINE)Invert, (SERVER_ROUTINE)Operate, (SERVER_ROUTINE)ChangeCase, (SERVER_ROUTINE)WriteOnStorage, diff --git a/IntegrationTests/CMakeLists.txt b/IntegrationTests/CMakeLists.txt index edc3d43..693f0f2 100644 --- a/IntegrationTests/CMakeLists.txt +++ b/IntegrationTests/CMakeLists.txt @@ -5,7 +5,6 @@ cmake_minimum_required(VERSION 2.6) project(IntegrationTests) -include(ExternalProject) ##################### # Macro definitions: @@ -16,9 +15,6 @@ add_definitions( -DTESTING ) -set(POCO_ROOT "/opt/poco-1.7.5") -set(BOOST_HOME "/opt/boost-1.60") - ######################## # Include directories: @@ -27,69 +23,49 @@ include_directories( "${PROJECT_SOURCE_DIR}/../gtest/include" "${PROJECT_SOURCE_DIR}/../OpenCL" "${PROJECT_SOURCE_DIR}/../btree" - "${POCO_ROOT}/include" - "${BOOST_HOME}/include" + "$ENV{POCO_ROOT}/include" + "$ENV{BOOST_HOME}/include" ) ######################## # Dependency libraries: -# How to build 3FD project -ExternalProject_Add(3FD_project - DOWNLOAD_COMMAND echo " 3FD source is local" - CONFIGURE_COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/../3FD && ./configure.sh - BUILD_COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/../3FD && make - INSTALL_COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/../3FD && echo " 3FD installed in " && pwd -) - -# How to build gtest project -ExternalProject_Add(gtest_project - DOWNLOAD_COMMAND echo " gtest source is local" - CONFIGURE_COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/../gtest && ./configure.sh - BUILD_COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/../gtest && make - INSTALL_COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/../gtest && echo " gtest installed in " && pwd -) - # How and what libs to link: -add_library(3FD STATIC IMPORTED) -add_library(gtest STATIC IMPORTED) -add_library(boost_system STATIC IMPORTED) -add_library(boost_thread STATIC IMPORTED) -add_library(PocoDataODBC STATIC IMPORTED) -add_library(PocoData STATIC IMPORTED) -add_library(PocoUtil STATIC IMPORTED) -add_library(PocoXML STATIC IMPORTED) +add_library(3FD STATIC IMPORTED) +add_library(gtest STATIC IMPORTED) +add_library(boost_system STATIC IMPORTED) +add_library(boost_thread STATIC IMPORTED) +add_library(PocoDataODBC STATIC IMPORTED) +add_library(PocoData STATIC IMPORTED) +add_library(PocoUtil STATIC IMPORTED) +add_library(PocoXML STATIC IMPORTED) add_library(PocoFoundation STATIC IMPORTED) # Where the lib binaries are: string(TOLOWER ${CMAKE_BUILD_TYPE} buildType) if(buildType STREQUAL release) add_definitions(-DNDEBUG) - set_target_properties(3FD PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/../3FD/lib3FD.a") - set_target_properties(gtest PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/../gtest/libgtest.a") - set_target_properties(boost_system PROPERTIES IMPORTED_LOCATION "${BOOST_HOME}/lib/libboost_system-mt.a") - set_target_properties(boost_thread PROPERTIES IMPORTED_LOCATION "${BOOST_HOME}/lib/libboost_thread-mt.a") - set_target_properties(PocoDataODBC PROPERTIES IMPORTED_LOCATION "${POCO_ROOT}/lib/libPocoDataODBC.a") - set_target_properties(PocoData PROPERTIES IMPORTED_LOCATION "${POCO_ROOT}/lib/libPocoData.a") - set_target_properties(PocoUtil PROPERTIES IMPORTED_LOCATION "${POCO_ROOT}/lib/libPocoUtil.a") - set_target_properties(PocoXML PROPERTIES IMPORTED_LOCATION "${POCO_ROOT}/lib/libPocoXML.a") - set_target_properties(PocoFoundation PROPERTIES IMPORTED_LOCATION "${POCO_ROOT}/lib/libPocoFoundation.a") + set_target_properties(3FD PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/../3FD/lib3FD.a") + set_target_properties(gtest PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/../gtest/libgtest.a") + set_target_properties(boost_system PROPERTIES IMPORTED_LOCATION "$ENV{BOOST_HOME}/lib/libboost_system-mt.a") + set_target_properties(boost_thread PROPERTIES IMPORTED_LOCATION "$ENV{BOOST_HOME}/lib/libboost_thread-mt.a") + set_target_properties(PocoDataODBC PROPERTIES IMPORTED_LOCATION "$ENV{POCO_ROOT}/lib/libPocoDataODBC.a") + set_target_properties(PocoData PROPERTIES IMPORTED_LOCATION "$ENV{POCO_ROOT}/lib/libPocoData.a") + set_target_properties(PocoUtil PROPERTIES IMPORTED_LOCATION "$ENV{POCO_ROOT}/lib/libPocoUtil.a") + set_target_properties(PocoXML PROPERTIES IMPORTED_LOCATION "$ENV{POCO_ROOT}/lib/libPocoXML.a") + set_target_properties(PocoFoundation PROPERTIES IMPORTED_LOCATION "$ENV{POCO_ROOT}/lib/libPocoFoundation.a") elseif(buildType STREQUAL debug) - set_target_properties(3FD PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/../3FD/lib3FDd.a") - set_target_properties(gtest PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/../gtest/libgtestd.a") - set_target_properties(boost_system PROPERTIES IMPORTED_LOCATION "${BOOST_HOME}/lib/libboost_system-mt-d.a") - set_target_properties(boost_thread PROPERTIES IMPORTED_LOCATION "${BOOST_HOME}/lib/libboost_thread-mt-d.a") - set_target_properties(PocoDataODBC PROPERTIES IMPORTED_LOCATION "${POCO_ROOT}/lib/libPocoDataODBCd.a") - set_target_properties(PocoData PROPERTIES IMPORTED_LOCATION "${POCO_ROOT}/lib/libPocoDatad.a") - set_target_properties(PocoUtil PROPERTIES IMPORTED_LOCATION "${POCO_ROOT}/lib/libPocoUtild.a") - set_target_properties(PocoXML PROPERTIES IMPORTED_LOCATION "${POCO_ROOT}/lib/libPocoXMLd.a") - set_target_properties(PocoFoundation PROPERTIES IMPORTED_LOCATION "${POCO_ROOT}/lib/libPocoFoundationd.a") + set_target_properties(3FD PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/../3FD/lib3FDd.a") + set_target_properties(gtest PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/../gtest/libgtestd.a") + set_target_properties(boost_system PROPERTIES IMPORTED_LOCATION "$ENV{BOOST_HOME}/lib/libboost_system-mt-d.a") + set_target_properties(boost_thread PROPERTIES IMPORTED_LOCATION "$ENV{BOOST_HOME}/lib/libboost_thread-mt-d.a") + set_target_properties(PocoDataODBC PROPERTIES IMPORTED_LOCATION "$ENV{POCO_ROOT}/lib/libPocoDataODBCd.a") + set_target_properties(PocoData PROPERTIES IMPORTED_LOCATION "$ENV{POCO_ROOT}/lib/libPocoDatad.a") + set_target_properties(PocoUtil PROPERTIES IMPORTED_LOCATION "$ENV{POCO_ROOT}/lib/libPocoUtild.a") + set_target_properties(PocoXML PROPERTIES IMPORTED_LOCATION "$ENV{POCO_ROOT}/lib/libPocoXMLd.a") + set_target_properties(PocoFoundation PROPERTIES IMPORTED_LOCATION "$ENV{POCO_ROOT}/lib/libPocoFoundationd.a") endif() -# Associate the dependencies with the corresponding projects: -add_dependencies(3FD 3FD_project) -add_dependencies(gtest gtest_project) - # Place the configuration file along with the executable: add_custom_command( OUTPUT IntegrationTests.3fd.config @@ -108,6 +84,7 @@ add_executable(IntegrationTests IntegrationTests.3fd.config ) +# Linking: target_link_libraries(IntegrationTests gtest 3FD @@ -116,3 +93,10 @@ target_link_libraries(IntegrationTests PocoDataODBC PocoData PocoUtil PocoXML PocoFoundation ) +################ +# Installation: + +install( + TARGETS IntegrationTests + DESTINATION "${PROJECT_SOURCE_DIR}/../build/bin" +) \ No newline at end of file diff --git a/IntegrationTests/IntegrationTests.vcxproj b/IntegrationTests/IntegrationTests.vcxproj index dc9b587..23c1c74 100644 --- a/IntegrationTests/IntegrationTests.vcxproj +++ b/IntegrationTests/IntegrationTests.vcxproj @@ -1,6 +1,14 @@  + + Debug_XP + Win32 + + + Debug_XP + x64 + Debug Win32 @@ -9,6 +17,14 @@ Debug x64 + + Release_XP + Win32 + + + Release_XP + x64 + Release Win32 @@ -22,6 +38,7 @@ {B288E7DC-4F10-4432-8CB9-2061400F4E0C} Win32Proj IntegrationTests + 8.1 @@ -30,12 +47,24 @@ v140 Unicode + + Application + true + v140_xp + Unicode + Application true v140 Unicode + + Application + true + v140_xp + Unicode + Application false @@ -43,6 +72,13 @@ true Unicode + + Application + false + v140_xp + true + Unicode + Application false @@ -50,21 +86,40 @@ true Unicode + + Application + false + v140_xp + true + Unicode + + + + + + + + + + + + + true @@ -73,11 +128,23 @@ $(POCO_ROOT)\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;$(POCO_ROOT)\Data\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(POCO_ROOT)\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;$(POCO_ROOT)\Data\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + true $(POCO_ROOT)\lib64;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;$(POCO_ROOT)\Data\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + + true + $(POCO_ROOT)\lib64;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;$(POCO_ROOT)\Data\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + false $(SolutionDir)$(Platform)\$(Configuration)\ @@ -85,11 +152,23 @@ $(POCO_ROOT)\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;$(POCO_ROOT)\Data\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(POCO_ROOT)\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;$(POCO_ROOT)\Data\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + false $(POCO_ROOT)\lib64;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;$(POCO_ROOT)\Data\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + + false + $(POCO_ROOT)\lib64;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;$(POCO_ROOT)\Data\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + Use @@ -108,6 +187,27 @@ copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" +copy "$(SolutionDir)TestShared\calculator.wsdl" "$(TargetDir)" + + + + + Use + Level3 + Disabled + ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;WIN32;_SCL_SECURE_NO_WARNINGS;_ENABLE_ATOMIC_ALIGNMENT_FIX;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);%(PreprocessorDefinitions) + true + $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)OpenCL;$(SolutionDir)gtest\include;$(SolutionDir)btree;%(AdditionalIncludeDirectories) + /D POCO_STATIC /D _VARIADIC_MAX=10 %(AdditionalOptions) + 4244 + + + Console + true + %(AdditionalDependencies) + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" copy "$(SolutionDir)TestShared\calculator.wsdl" "$(TargetDir)" @@ -129,6 +229,27 @@ copy "$(SolutionDir)TestShared\calculator.wsdl" "$(TargetDir)" copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" +copy "$(SolutionDir)TestShared\calculator.wsdl" "$(TargetDir)" + + + + + Use + Level3 + Disabled + ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;WIN32;_SCL_SECURE_NO_WARNINGS;_ENABLE_ATOMIC_ALIGNMENT_FIX;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)OpenCL;$(SolutionDir)gtest\include;$(SolutionDir)btree;%(AdditionalIncludeDirectories) + /D POCO_STATIC /D _VARIADIC_MAX=10 %(AdditionalOptions) + 4244 + + + Console + true + %(AdditionalDependencies) + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" copy "$(SolutionDir)TestShared\calculator.wsdl" "$(TargetDir)" @@ -155,6 +276,32 @@ copy "$(SolutionDir)TestShared\calculator.wsdl" "$(TargetDir)" copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" +copy "$(SolutionDir)TestShared\calculator.wsdl" "$(TargetDir)" + + + + + Level3 + Use + MaxSpeed + true + true + ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;WIN32;_SCL_SECURE_NO_WARNINGS;_ENABLE_ATOMIC_ALIGNMENT_FIX;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);%(PreprocessorDefinitions) + true + $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)OpenCL;$(SolutionDir)gtest\include;$(SolutionDir)btree;%(AdditionalIncludeDirectories) + /D POCO_STATIC $(MSVC_X86_RELEASE_EINSTSET) %(AdditionalOptions) + 4244 + NotSet + + + Console + true + true + true + %(AdditionalDependencies) + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" copy "$(SolutionDir)TestShared\calculator.wsdl" "$(TargetDir)" @@ -181,39 +328,85 @@ copy "$(SolutionDir)TestShared\calculator.wsdl" "$(TargetDir)" copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" +copy "$(SolutionDir)TestShared\calculator.wsdl" "$(TargetDir)" + + + + + Level3 + Use + MaxSpeed + true + true + ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;WIN32;_SCL_SECURE_NO_WARNINGS;_ENABLE_ATOMIC_ALIGNMENT_FIX;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);%(PreprocessorDefinitions) + true + $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)OpenCL;$(SolutionDir)gtest\include;$(SolutionDir)btree;%(AdditionalIncludeDirectories) + /D POCO_STATIC $(MSVC_X64_RELEASE_EINSTSET) %(AdditionalOptions) + 4244 + NotSet + + + Console + true + true + true + %(AdditionalDependencies) + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" copy "$(SolutionDir)TestShared\calculator.wsdl" "$(TargetDir)" Create + Create Create + Create Create + Create Create + Create NotUsing + NotUsing NotUsing + NotUsing NotUsing + NotUsing NotUsing + NotUsing NotUsing + NotUsing NotUsing + NotUsing NotUsing + NotUsing NotUsing + NotUsing NotUsing + NotUsing NotUsing + NotUsing NotUsing + NotUsing NotUsing + NotUsing NotUsing + NotUsing NotUsing + NotUsing NotUsing + NotUsing NotUsing + NotUsing @@ -249,9 +442,13 @@ copy "$(SolutionDir)TestShared\calculator.wsdl" "$(TargetDir)" true + true true + true true + true true + true diff --git a/IntegrationTests/WinRT.UWP/IntegrationTestsApp.WinRT.UWP.vcxproj b/IntegrationTests/WinRT.UWP/IntegrationTestsApp.WinRT.UWP.vcxproj index ea4fa5a..b1ef696 100644 --- a/IntegrationTests/WinRT.UWP/IntegrationTestsApp.WinRT.UWP.vcxproj +++ b/IntegrationTests/WinRT.UWP/IntegrationTestsApp.WinRT.UWP.vcxproj @@ -98,14 +98,15 @@ IntegrationTestsApp.WinRT.UWP_TemporaryKey.pfx + 96C28522337AD47DE34DD587105FCDA6194E93EE - $(BOOST_HOME);$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(BOOST_HOME)\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); $(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)\ $(Platform)\$(Configuration)\ - $(BOOST_HOME);$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(BOOST_HOME)\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); $(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)\ $(Platform)\$(Configuration)\ @@ -135,7 +136,7 @@ 4018;4244;4453;28204 $(SolutionDir)3FD;$(SolutionDir)3FD.WinRT\3FD.WinRT.Shared;$(SolutionDir)btree;$(SolutionDir)gtest\include;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_ENABLE_ATOMIC_ALIGNMENT_FIX;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions);%(PreprocessorDefinitions);%(PreprocessorDefinitions) - AdvancedVectorExtensions2 + NotSet diff --git a/IntegrationTests/WinRT.UWP/IntegrationTestsApp.WinRT.UWP_TemporaryKey.pfx b/IntegrationTests/WinRT.UWP/IntegrationTestsApp.WinRT.UWP_TemporaryKey.pfx new file mode 100644 index 0000000000000000000000000000000000000000..e60fac1a1e3fbf99cc86a9975f529a62582ca85a GIT binary patch literal 2600 zcmZWpcU05a68s?u>8vpRC!>enS~z61qlQHQq?Gwf$I zYU|R(xR-|`K2+E?GRME}puYBwa;*%@Y5sSN%c6KwLhM>DcByN>T+CDlYwA29Qdm6j zE%uVkX!6Qad!D%A@Fu?xo%I71V1wrrV}-{GhvjMwf>s7C zj9`Xc?;U`Xv6eG!=gj)02W`T)Jgrx*fL2B3V1YL~Z?UkUt^0Pa?Hk56T6%G@lU|3; z8(bk~n0O2{E2=%8X6r;G$3~4aIGZpKcFUJv1l+HU`MA~c(}Z1<1Bxso0eccTtlNxK zBF7CgWjm-G!EscB$ZF~s`4WVhk1;i6i{jh(P$;gY~=+4&Cs5VkcayXXzR zvs$Xkdxt1n^@wf3gH`)60jcDV#7pC3Cn$?$8z-Je-fF|~WY7oFC(K?MZ} z@%i-I$#V$rhFH<3W}oZ|`N(k?A9zI1ih3FU^Ci_?$)@Pvb1pw*Ydl%Y%PA4}q@&*k zkKQReCK(75Epvahw%V<*tdhPx4V-7LLd3sGu?tu~9R~_@R02t4Vq~Y|f{U0+m(7D^ z_o_0E+2HdltTC-g8bOyXl%+PS|9)}jQ423pUby}(f9V`gzwD!Jdpj4_{A=cAUQ2xu zAGog&LOt`c(>2;9SvU@qbo}WYRwRWur6|}`r@$Ts!6@VW?;&J*bob%prmwyE1*y5o zQGJ7oH${=mWn`K071BrFu|eu^@iByA>z<>3`Pz^WkN^!;zW8XZ%9)StUF(t8AHN8G zIA?0GAJ*#tc5)umR8fZbCO8TuL7c?5xq!Nhv{X* zB0F!ciKxOCAw*j`kg-@tOI#h4@=Wn3=W7)WMoEiNQaqy>gc~uuLg6;S`;c`k z-?}3`7#q^AYL7$UC~&U7*Cq2M1Oo&D0ssK+_z%gAFohWd%77Q30C)o`G^7G30kVJ^ z;7KzS4JiStG~`1=>HwVPDm0`>V{g&ShZg@(sL^U@TDThnvor$;0>Z0ufDlNSC13&g z)7pjrK|mdx=NKkrhfuyo5)hLy9eK2~~X4DbVOCyFYIR zc`*;W{;~7z8u5Kde@>&H?(K4cKwsr!p|Ra+w=7rB|X2`^4a4 zkhFs5JKcn5H!P4I8NP5!WF8+jGYp$()GzBAiJdu>$`n!H8L*jDI)33A_ISG@)jC!O zX%~>+Pl-@`PNy7gSAc9ep231x2c5ijAGTlGe^pGjJdar~Gb^qrfa@tjPgKI{-X+*3 zUxY3$M}4_G_olM$Or4N&nNf_ z39x*#Dt8^4H}n3paqVLnaenWff1DVvZ>MJt`+Af1>aYF>bivs?+?@Wi%dNW|Q{xJj0I3_>Ymhtr3aWGQXr^!`ow*&3{hsbeamQf8NfMc^LIs za!*bhQDp0@9z9~zC3QFYa88Of@ey<}@nTK3f`)3av5`QeGdax8&N6+WXK%M)>t&YT zK_XR4@4B+%zmhiGbc0ULFZdZ=%&a`Kn8+17B1GphIvCC(_tm&l+G8a~OCqvIZu*z_ z$1oyfFpS)aMH)dz>tisJLFVz_5*yR>v)*N{*mJ}j$DB9}7GUTK9WjF0%o-IHzV39|Rdcyjv0av#4 Ljhw4LKJdQ*Yx1Pm literal 0 HcmV?d00001 diff --git a/IntegrationTests/WinRT.UWP/Package.appxmanifest b/IntegrationTests/WinRT.UWP/Package.appxmanifest index 8071408..b458717 100644 --- a/IntegrationTests/WinRT.UWP/Package.appxmanifest +++ b/IntegrationTests/WinRT.UWP/Package.appxmanifest @@ -1,48 +1,27 @@  - - - - - - - + + + IntegrationTestsApp.WinRT.UWP Felipe Assets\StoreLogo.png - - - + - - - - + + + + - diff --git a/IntegrationTests/application.config b/IntegrationTests/application.config index 29d249d..f08dd9f 100644 --- a/IntegrationTests/application.config +++ b/IntegrationTests/application.config @@ -3,9 +3,9 @@ - - - + + + @@ -16,10 +16,10 @@ - - - - + + + + @@ -29,7 +29,30 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/IntegrationTests/calculator.wsdl.c b/IntegrationTests/calculator.wsdl.c index f53809f..86b965d 100644 --- a/IntegrationTests/calculator.wsdl.c +++ b/IntegrationTests/calculator.wsdl.c @@ -8,11 +8,11 @@ typedef struct _calculator_wsdlLocalDefinitions struct // global types { char unused; - struct // MultipurposeSingleIntegerResponse + struct // MultipurposeBooleanResponse { WS_FIELD_DESCRIPTION result; - WS_FIELD_DESCRIPTION* MultipurposeSingleIntegerResponseFields [1]; - } MultipurposeSingleIntegerResponsedescs; // end of MultipurposeSingleIntegerResponse + WS_FIELD_DESCRIPTION* MultipurposeBooleanResponseFields [1]; + } MultipurposeBooleanResponsedescs; // end of MultipurposeBooleanResponse struct // BinaryOpRequest { WS_FIELD_DESCRIPTION first; @@ -136,8 +136,8 @@ typedef struct _calculator_wsdlLocalDefinitions { WS_XML_STRING EmptyRequestTypeName; // EmptyRequest WS_XML_STRING EmptyRequestTypeNamespace; // http://calculator.example.org/ - WS_XML_STRING MultipurposeSingleIntegerResponseTypeName; // MultipurposeSingleIntegerResponse - WS_XML_STRING MultipurposeSingleIntegerResponseresultLocalName; // result + WS_XML_STRING MultipurposeBooleanResponseTypeName; // MultipurposeBooleanResponse + WS_XML_STRING MultipurposeBooleanResponseresultLocalName; // result WS_XML_STRING BinaryOpRequestTypeName; // BinaryOpRequest WS_XML_STRING BinaryOpRequestfirstLocalName; // first WS_XML_STRING BinaryOpRequestsecondLocalName; // second @@ -225,7 +225,7 @@ HRESULT CALLBACK CalcBindingHeaderAuthSSL_MultiplyOperationStub( typedef struct CalcBindingHeaderAuthSSL_CloseServiceParamStruct { - __int64* result; + BOOL* result; } CalcBindingHeaderAuthSSL_CloseServiceParamStruct; #if (_MSC_VER >=1400) @@ -320,7 +320,7 @@ HRESULT CALLBACK CalcBindingSSL_MultiplyOperationStub( typedef struct CalcBindingSSL_CloseServiceParamStruct { - __int64* result; + BOOL* result; } CalcBindingSSL_CloseServiceParamStruct; #if (_MSC_VER >=1400) @@ -415,7 +415,7 @@ HRESULT CALLBACK CalcBindingUnsecure_MultiplyOperationStub( typedef struct CalcBindingUnsecure_CloseServiceParamStruct { - __int64* result; + BOOL* result; } CalcBindingUnsecure_CloseServiceParamStruct; #if (_MSC_VER >=1400) @@ -445,22 +445,22 @@ const static _calculator_wsdlLocalDefinitions calculator_wsdlLocalDefinitions = { { // global types 0, - { // MultipurposeSingleIntegerResponse + { // MultipurposeBooleanResponse { // field description for result WS_ELEMENT_FIELD_MAPPING, - (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.MultipurposeSingleIntegerResponseresultLocalName, // result + (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.MultipurposeBooleanResponseresultLocalName, // result (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.EmptyRequestTypeNamespace, // http://calculator.example.org/ - WS_INT64_TYPE, + WS_BOOL_TYPE, 0, - WsOffsetOf(MultipurposeSingleIntegerResponse, result), + WsOffsetOf(MultipurposeBooleanResponse, result), 0, 0, 0xffffffff }, // end of field description for result - { // fields description for MultipurposeSingleIntegerResponse - (WS_FIELD_DESCRIPTION*)&calculator_wsdlLocalDefinitions.globalTypes.MultipurposeSingleIntegerResponsedescs.result, + { // fields description for MultipurposeBooleanResponse + (WS_FIELD_DESCRIPTION*)&calculator_wsdlLocalDefinitions.globalTypes.MultipurposeBooleanResponsedescs.result, }, - }, // MultipurposeSingleIntegerResponse + }, // MultipurposeBooleanResponse { // BinaryOpRequest { // field description for first WS_ELEMENT_FIELD_MAPPING, @@ -492,7 +492,7 @@ const static _calculator_wsdlLocalDefinitions calculator_wsdlLocalDefinitions = { // OperationResponse { // field description for result WS_ELEMENT_FIELD_MAPPING, - (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.MultipurposeSingleIntegerResponseresultLocalName, // result + (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.MultipurposeBooleanResponseresultLocalName, // result (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.EmptyRequestTypeNamespace, // http://calculator.example.org/ WS_DOUBLE_TYPE, 0, @@ -821,7 +821,7 @@ const static _calculator_wsdlLocalDefinitions calculator_wsdlLocalDefinitions = { // xmlStrings WS_XML_STRING_DICTIONARY_VALUE("EmptyRequest",&calculator_wsdlLocalDefinitions.dictionary.dict, 0), WS_XML_STRING_DICTIONARY_VALUE("http://calculator.example.org/",&calculator_wsdlLocalDefinitions.dictionary.dict, 1), - WS_XML_STRING_DICTIONARY_VALUE("MultipurposeSingleIntegerResponse",&calculator_wsdlLocalDefinitions.dictionary.dict, 2), + WS_XML_STRING_DICTIONARY_VALUE("MultipurposeBooleanResponse",&calculator_wsdlLocalDefinitions.dictionary.dict, 2), WS_XML_STRING_DICTIONARY_VALUE("result",&calculator_wsdlLocalDefinitions.dictionary.dict, 3), WS_XML_STRING_DICTIONARY_VALUE("BinaryOpRequest",&calculator_wsdlLocalDefinitions.dictionary.dict, 4), WS_XML_STRING_DICTIONARY_VALUE("first",&calculator_wsdlLocalDefinitions.dictionary.dict, 5), @@ -863,16 +863,16 @@ const _calculator_wsdl calculator_wsdl = 0, }, // end of struct description for EmptyRequest { - sizeof(MultipurposeSingleIntegerResponse), - __alignof(MultipurposeSingleIntegerResponse), - (WS_FIELD_DESCRIPTION**)&calculator_wsdlLocalDefinitions.globalTypes.MultipurposeSingleIntegerResponsedescs.MultipurposeSingleIntegerResponseFields, - WsCountOf(calculator_wsdlLocalDefinitions.globalTypes.MultipurposeSingleIntegerResponsedescs.MultipurposeSingleIntegerResponseFields), - (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.MultipurposeSingleIntegerResponseTypeName, // MultipurposeSingleIntegerResponse + sizeof(MultipurposeBooleanResponse), + __alignof(MultipurposeBooleanResponse), + (WS_FIELD_DESCRIPTION**)&calculator_wsdlLocalDefinitions.globalTypes.MultipurposeBooleanResponsedescs.MultipurposeBooleanResponseFields, + WsCountOf(calculator_wsdlLocalDefinitions.globalTypes.MultipurposeBooleanResponsedescs.MultipurposeBooleanResponseFields), + (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.MultipurposeBooleanResponseTypeName, // MultipurposeBooleanResponse (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.EmptyRequestTypeNamespace, // http://calculator.example.org/ 0, 0, 0, - }, // end of struct description for MultipurposeSingleIntegerResponse + }, // end of struct description for MultipurposeBooleanResponse { sizeof(BinaryOpRequest), __alignof(BinaryOpRequest), @@ -907,7 +907,7 @@ const _calculator_wsdl calculator_wsdl = (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.CloseServiceResponseTypeName, // CloseServiceResponse (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.EmptyRequestTypeNamespace, // http://calculator.example.org/ WS_STRUCT_TYPE, - (void*)&calculator_wsdl.globalTypes.MultipurposeSingleIntegerResponse, + (void*)&calculator_wsdl.globalTypes.MultipurposeBooleanResponse, }, { (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.AdditionRequestTypeName, // AdditionRequest diff --git a/IntegrationTests/calculator.wsdl.h b/IntegrationTests/calculator.wsdl.h index ac3c2fa..788305c 100644 --- a/IntegrationTests/calculator.wsdl.h +++ b/IntegrationTests/calculator.wsdl.h @@ -168,11 +168,11 @@ extern "C" { // The following types were generated: // struct EmptyRequest; -// struct MultipurposeSingleIntegerResponse; +// struct MultipurposeBooleanResponse; // struct BinaryOpRequest; // struct OperationResponse; // struct EmptyRequest; -// struct MultipurposeSingleIntegerResponse; +// struct MultipurposeBooleanResponse; // struct BinaryOpRequest; // struct OperationResponse; // struct BinaryOpRequest; @@ -194,11 +194,11 @@ extern "C" { typedef struct EmptyRequest EmptyRequest; -// typeDescription: calculator_wsdl.globalTypes.MultipurposeSingleIntegerResponse -typedef struct MultipurposeSingleIntegerResponse +// typeDescription: calculator_wsdl.globalTypes.MultipurposeBooleanResponse +typedef struct MultipurposeBooleanResponse { - __int64 result; -} MultipurposeSingleIntegerResponse; + BOOL result; +} MultipurposeBooleanResponse; // typeDescription: calculator_wsdl.globalTypes.BinaryOpRequest typedef struct BinaryOpRequest @@ -260,7 +260,7 @@ typedef HRESULT (CALLBACK* CalcBindingHeaderAuthSSL_MultiplyCallback) ( typedef HRESULT (CALLBACK* CalcBindingHeaderAuthSSL_CloseServiceCallback) ( _In_ const WS_OPERATION_CONTEXT* _context, - _Out_ __int64* result, + _Out_ BOOL* result, _In_ const WS_ASYNC_CONTEXT* _asyncContext, _In_ WS_ERROR* _error); @@ -317,7 +317,7 @@ typedef HRESULT (CALLBACK* CalcBindingSSL_MultiplyCallback) ( typedef HRESULT (CALLBACK* CalcBindingSSL_CloseServiceCallback) ( _In_ const WS_OPERATION_CONTEXT* _context, - _Out_ __int64* result, + _Out_ BOOL* result, _In_ const WS_ASYNC_CONTEXT* _asyncContext, _In_ WS_ERROR* _error); @@ -372,7 +372,7 @@ typedef HRESULT (CALLBACK* CalcBindingUnsecure_MultiplyCallback) ( typedef HRESULT (CALLBACK* CalcBindingUnsecure_CloseServiceCallback) ( _In_ const WS_OPERATION_CONTEXT* _context, - _Out_ __int64* result, + _Out_ BOOL* result, _In_ const WS_ASYNC_CONTEXT* _asyncContext, _In_ WS_ERROR* _error); @@ -398,11 +398,11 @@ typedef struct _calculator_wsdl // typeDescription: calculator_wsdl.globalTypes.EmptyRequest WS_STRUCT_DESCRIPTION EmptyRequest; - // xml type: MultipurposeSingleIntegerResponse ("http://calculator.example.org/") - // c type: MultipurposeSingleIntegerResponse + // xml type: MultipurposeBooleanResponse ("http://calculator.example.org/") + // c type: MultipurposeBooleanResponse // WS_TYPE: WS_STRUCT_TYPE - // typeDescription: calculator_wsdl.globalTypes.MultipurposeSingleIntegerResponse - WS_STRUCT_DESCRIPTION MultipurposeSingleIntegerResponse; + // typeDescription: calculator_wsdl.globalTypes.MultipurposeBooleanResponse + WS_STRUCT_DESCRIPTION MultipurposeBooleanResponse; // xml type: BinaryOpRequest ("http://calculator.example.org/") // c type: BinaryOpRequest @@ -425,7 +425,7 @@ typedef struct _calculator_wsdl WS_ELEMENT_DESCRIPTION CloseServiceRequest; // xml element: CloseServiceResponse ("http://calculator.example.org/") - // c type: MultipurposeSingleIntegerResponse + // c type: MultipurposeBooleanResponse // elementDescription: calculator_wsdl.globalElements.CloseServiceResponse WS_ELEMENT_DESCRIPTION CloseServiceResponse; @@ -483,7 +483,7 @@ typedef struct _calculator_wsdl WS_MESSAGE_DESCRIPTION CloseServiceRequestMessage; // message: CloseServiceResponseMessage - // c type: MultipurposeSingleIntegerResponse + // c type: MultipurposeBooleanResponse // action: "" // messageDescription: calculator_wsdl.messages.CloseServiceResponseMessage WS_MESSAGE_DESCRIPTION CloseServiceResponseMessage; diff --git a/IntegrationTests/tests_broker.cpp b/IntegrationTests/tests_broker.cpp index 42c53f3..83bdb68 100644 --- a/IntegrationTests/tests_broker.cpp +++ b/IntegrationTests/tests_broker.cpp @@ -1,8 +1,11 @@ #include "stdafx.h" #include "runtime.h" #include "broker.h" +#include "configuration.h" #include +#define UNDEF_BROKER_DB_CONNSTR "CONNECTION STRING FOR BROKER BACK-END IS NOT DEFINED IN XML CONFIGURATION" + namespace _3fd { namespace integration_tests @@ -15,9 +18,9 @@ namespace integration_tests work with these integration tests. */ #ifdef _WIN32 - const char *msSqlDbConnString("Driver={SQL Server Native Client 11.0};Server=(localdb)\\MSSQLLocalDB;Database=SvcBrokerTest;Trusted_Connection=yes;"); + const char *keyForBrokerDbConnStr("testBrokerWindowsMsSqlDbConnString"); #else - const char *msSqlDbConnString("Driver={ODBC Driver 13 for SQL Server};Server=tcp:192.168.1.32,1433;Database=SvcBrokerTest;Uid=tester;Pwd=tester;"); + const char *keyForBrokerDbConnStr("testBrokerLinuxMsSqlDbConnString"); #endif /// @@ -36,7 +39,7 @@ namespace integration_tests QueueReader queueReader( Backend::MsSqlServer, - msSqlDbConnString, + core::AppConfig::GetSettings().application.GetString(keyForBrokerDbConnStr, UNDEF_BROKER_DB_CONNSTR), "//SvcBrokerTest/IntegrationTestService", MessageTypeSpec { 128UL, MessageContentValidation::None } ); @@ -83,7 +86,7 @@ namespace integration_tests QueueWriter queueWriter( Backend::MsSqlServer, - msSqlDbConnString, + core::AppConfig::GetSettings().application.GetString(keyForBrokerDbConnStr, UNDEF_BROKER_DB_CONNSTR), "//SvcBrokerTest/IntegrationTestService", MessageTypeSpec{ 128UL, MessageContentValidation::None } ); @@ -124,7 +127,7 @@ namespace integration_tests // Setup the writer: QueueWriter queueWriter( Backend::MsSqlServer, - msSqlDbConnString, + core::AppConfig::GetSettings().application.GetString(keyForBrokerDbConnStr, UNDEF_BROKER_DB_CONNSTR), "//SvcBrokerTest/IntegrationTestService", MessageTypeSpec{ 128UL, MessageContentValidation::None } ); @@ -135,7 +138,7 @@ namespace integration_tests // Setup the reader: QueueReader queueReader( Backend::MsSqlServer, - msSqlDbConnString, + core::AppConfig::GetSettings().application.GetString(keyForBrokerDbConnStr, UNDEF_BROKER_DB_CONNSTR), "//SvcBrokerTest/IntegrationTestService", MessageTypeSpec{ 128UL, MessageContentValidation::None } ); @@ -286,7 +289,7 @@ namespace integration_tests // Setup the writer: QueueWriter queueWriter( Backend::MsSqlServer, - msSqlDbConnString, + core::AppConfig::GetSettings().application.GetString(keyForBrokerDbConnStr, UNDEF_BROKER_DB_CONNSTR), "//SvcBrokerTest/IntegrationTestService", MessageTypeSpec{ 128UL, MessageContentValidation::None } ); @@ -297,7 +300,7 @@ namespace integration_tests // Setup the reader: QueueReader queueReader( Backend::MsSqlServer, - msSqlDbConnString, + core::AppConfig::GetSettings().application.GetString(keyForBrokerDbConnStr, UNDEF_BROKER_DB_CONNSTR), "//SvcBrokerTest/IntegrationTestService", MessageTypeSpec{ 128UL, MessageContentValidation::None } ); diff --git a/IntegrationTests/tests_opencl.cpp b/IntegrationTests/tests_opencl.cpp index 9251627..8f20846 100644 --- a/IntegrationTests/tests_opencl.cpp +++ b/IntegrationTests/tests_opencl.cpp @@ -1,6 +1,8 @@ #include "stdafx.h" #include "runtime.h" #include "opencl.h" +#include "configuration.h" + #include #include #include @@ -11,6 +13,8 @@ #include #include +#define UNDEF_OCL_SRC_FILE "FILE PATH FOR OPENCL C SOURCE EXAMPLE IS NOT DEFINED IN XML CONFIGURATION" + namespace _3fd { namespace integration_tests @@ -22,15 +26,18 @@ namespace integration_tests void HandleException(); + static cl_device_type GetDeviceType() + { + return AppConfig::GetSettings().application.GetBool("testOclUseGpuDevice", false) ? CL_DEVICE_TYPE_GPU : CL_DEVICE_TYPE_CPU; + } + #ifdef _WIN32 - static const cl_device_type oclDeviceType = CL_DEVICE_TYPE_GPU; - static auto oclWrongExampleFilePath = "..\\..\\opencl-c-example-wrong.txt"; - static auto oclGoodExampleFilePath = "..\\..\\opencl-c-example.txt"; + static auto keyForOclWrongExampleFPath = "testOclWindowsWrongExampleFilePath"; + static auto keyForOclGoodExampleFPath = "testOclWindowsGoodExampleFilePath"; static auto currentDirectory = ".\\"; #else - static const cl_device_type oclDeviceType = CL_DEVICE_TYPE_CPU; - static auto oclWrongExampleFilePath = "../../../opencl-c-example-wrong.txt"; - static auto oclGoodExampleFilePath = "../../../opencl-c-example.txt"; + static auto keyForOclWrongExampleFPath = "testOclLinuxWrongExampleFilePath"; + static auto keyForOclGoodExampleFPath = "testOclLinuxGoodExampleFilePath"; static auto currentDirectory = "./"; #endif @@ -66,7 +73,7 @@ namespace integration_tests std::cout << "\tPlatform name: " << &strValue[0] << std::endl; // Platform::GetContext - auto context = platforms[0].CreateContextFromType(oclDeviceType); + auto context = platforms[0].CreateContextFromType(GetDeviceType()); ASSERT_GT(context.GetNumDevices(), 0); // Context::GetDevices @@ -117,12 +124,14 @@ namespace integration_tests Platform::CreatePlatformInstances(platforms); ASSERT_GT(platforms.size(), 0); - auto context = platforms[0].CreateContextFromType(oclDeviceType); + auto context = platforms[0].CreateContextFromType(GetDeviceType()); try { // Build a wrecked kernel source code - context.BuildProgramFromSource(oclWrongExampleFilePath, ""); + context.BuildProgramFromSource( + AppConfig::GetSettings().application.GetString(keyForOclWrongExampleFPath, UNDEF_OCL_SRC_FILE), "" + ); } catch(IAppException &ex) { @@ -130,7 +139,9 @@ namespace integration_tests } // Build a correct kernel source code - auto program = context.BuildProgramFromSource(oclGoodExampleFilePath, ""); + auto program = context.BuildProgramFromSource( + AppConfig::GetSettings().application.GetString(keyForOclGoodExampleFPath, UNDEF_OCL_SRC_FILE), "" + ); // Save binaries to disk: auto manifestFilePath = program->SaveAs("example", currentDirectory); @@ -167,7 +178,7 @@ namespace integration_tests Platform::CreatePlatformInstances(platforms); ASSERT_GT(platforms.size(), 0); - auto context = platforms[0].CreateContextFromType(oclDeviceType); + auto context = platforms[0].CreateContextFromType(GetDeviceType()); ASSERT_GT(context.GetNumDevices(), 0); auto device = context.GetDevice(0, GetParam() ? CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE : 0); @@ -226,7 +237,7 @@ namespace integration_tests Platform::CreatePlatformInstances(platforms); ASSERT_GT(platforms.size(), 0); - auto context = platforms[0].CreateContextFromType(oclDeviceType); + auto context = platforms[0].CreateContextFromType(GetDeviceType()); ASSERT_GT(context.GetNumDevices(), 0); auto device = context.GetDevice(0, GetParam() ? CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE : 0); @@ -304,7 +315,7 @@ namespace integration_tests Platform::CreatePlatformInstances(platforms); ASSERT_GT(platforms.size(), 0); - auto context = platforms[0].CreateContextFromType(oclDeviceType); + auto context = platforms[0].CreateContextFromType(GetDeviceType()); ASSERT_GT(context.GetNumDevices(), 0); auto device = context.GetDevice(0, GetParam() ? CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE : 0); @@ -371,7 +382,7 @@ namespace integration_tests Platform::CreatePlatformInstances(platforms); ASSERT_GT(platforms.size(), 0); - auto context = platforms[0].CreateContextFromType(oclDeviceType); + auto context = platforms[0].CreateContextFromType(GetDeviceType()); ASSERT_GT(context.GetNumDevices(), 0); auto device = context.GetDevice(0, GetParam() ? CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE : 0); @@ -442,7 +453,7 @@ namespace integration_tests Platform::CreatePlatformInstances(platforms); ASSERT_GT(platforms.size(), 0); - auto context = platforms[0].CreateContextFromType(oclDeviceType); + auto context = platforms[0].CreateContextFromType(GetDeviceType()); ASSERT_GT(context.GetNumDevices(), 0); auto device = context.GetDevice(0, GetParam() ? CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE : 0); @@ -452,7 +463,10 @@ namespace integration_tests std::unique_ptr program = context.BuildProgramWithBinaries("ocl_manifest_example.xml", ""); if (program.get() == nullptr) { - program = context.BuildProgramFromSource(oclGoodExampleFilePath, ""); + program = context.BuildProgramFromSource( + AppConfig::GetSettings().application.GetString(keyForOclGoodExampleFPath, UNDEF_OCL_SRC_FILE), "" + ); + program->SaveAs("example", currentDirectory); } @@ -467,21 +481,21 @@ namespace integration_tests // Device input buffer. Data is copied into it as of creation: auto inputBuffer1 = context.CreateBuffer(commonBufSize, - CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_WRITE_ONLY, - hostData1.data()); + CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_WRITE_ONLY, + hostData1.data()); // Device input buffer. Data is copied into it as of creation: auto inputBuffer2 = context.CreateBuffer(commonBufSize, - CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_WRITE_ONLY, - hostData2.data()); + CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_WRITE_ONLY, + hostData2.data()); // First device output buffer: auto outputBuffer1 = context.CreateBuffer(commonBufSize, - CL_MEM_WRITE_ONLY | CL_MEM_HOST_READ_ONLY, - nullptr); + CL_MEM_WRITE_ONLY | CL_MEM_HOST_READ_ONLY, + nullptr); // Seconde device output buffer: auto outputBuffer2 = context.CreateBuffer(commonBufSize, - CL_MEM_WRITE_ONLY | CL_MEM_HOST_READ_ONLY, - nullptr); + CL_MEM_WRITE_ONLY | CL_MEM_HOST_READ_ONLY, + nullptr); // Enqueues the execution of the kernel using the first input and output buffers: std::array globalWorkOffset = { 0 }; diff --git a/IntegrationTests/tests_rpc.cpp b/IntegrationTests/tests_rpc.cpp index c94bcfb..1cdcd1b 100644 --- a/IntegrationTests/tests_rpc.cpp +++ b/IntegrationTests/tests_rpc.cpp @@ -60,6 +60,16 @@ static void ImpersonateClientAndCreateFile(handle_t clientBindingHandle) } } +// Common procedure that inverts the order of a pair of numbers +void Invert( + /* [in] */ handle_t IDL_handle, + /* [out][in] */ pair *onePair) +{ + auto temp = onePair->left; + onePair->left = onePair->right; + onePair->right = temp; +} + // 1st implementation for 'Operate' void Operate( /* [in] */ handle_t IDL_handle, @@ -67,8 +77,6 @@ void Operate( /* [in] */ double right, /* [out] */ double *result) { - CALL_STACK_TRACE; - *result = left * right; } @@ -79,55 +87,41 @@ void Operate2( /* [in] */ double right, /* [out] */ double *result) { - CALL_STACK_TRACE; - *result = left + right; } // 1st implementation for 'ChangeCase' void ChangeCase( /* [in] */ handle_t IDL_handle, - /* [in] */ cstring *input, - /* [out] */ cstring *output) + /* [string][in] */ unsigned char *input, + /* [size_is][string][out] */ unsigned char *output) { - CALL_STACK_TRACE; - /* When the stubs have been generated for OSF compliance, RpcSs/RpcSm procs are to be used for dynamic allocation, instead of midl_user_allocate/free. This memory gets automatically released once this RPC returns to the caller. */ - output->data = static_cast (RpcSsAllocate(input->size)); - //output->data = static_cast (midl_user_allocate(input->size)); - output->size = input->size; - - const auto length = input->size - 1; - for (unsigned short idx = 0; idx < length; ++idx) - output->data[idx] = toupper(input->data[idx]); + int idx; + for (idx = 0; input[idx] != 0; ++idx) + output[idx] = toupper(input[idx]); - output->data[length] = 0; + output[idx] = 0; } // 2nd implementation for 'ChangeCase' void ChangeCase2( /* [in] */ handle_t IDL_handle, - /* [in] */ cstring *input, - /* [out] */ cstring *output) + /* [string][in] */ unsigned char *input, + /* [size_is][string][out] */ unsigned char *output) { - CALL_STACK_TRACE; - /* When the stubs have been generated for OSF compliance, RpcSs/RpcSm procs are to be used for dynamic allocation, instead of midl_user_allocate/free. This memory gets automatically released once this RPC returns to the caller. */ - output->data = static_cast (RpcSsAllocate(input->size)); - //output->data = static_cast (midl_user_allocate(input->size)); - output->size = input->size; - - const auto length = input->size - 1; - for (unsigned short idx = 0; idx < length; ++idx) - output->data[idx] = tolower(input->data[idx]); + int idx; + for (idx = 0; input[idx] != 0; ++idx) + output[idx] = tolower(input[idx]); - output->data[length] = 0; + output[idx] = 0; } // Common procedure that writes a file in server storage in order to test impersonation @@ -283,10 +277,10 @@ namespace integration_tests RpcServer::Initialize(ProtocolSequence::Local, "TestClient3FD"); // RPC interface implementation 1: - AcmeTesting_v1_0_epv_t intfImplFuncTable1 = { Operate, ChangeCase, WriteOnStorage, Shutdown }; + AcmeTesting_v1_0_epv_t intfImplFuncTable1 = { Invert, Operate, ChangeCase, WriteOnStorage, Shutdown }; // RPC interface implementation 2: - AcmeTesting_v1_0_epv_t intfImplFuncTable2 = { Operate2, ChangeCase2, WriteOnStorage, Shutdown }; + AcmeTesting_v1_0_epv_t intfImplFuncTable2 = { Invert, Operate2, ChangeCase2, WriteOnStorage, Shutdown }; std::vector objects; objects.reserve(2); @@ -347,10 +341,10 @@ namespace integration_tests RpcServer::Initialize(ProtocolSequence::Local, "TestClient3FD"); // RPC interface implementation 1: - AcmeTesting_v1_0_epv_t intfImplFuncTable1 = { Operate, ChangeCase, WriteOnStorage, Shutdown }; + AcmeTesting_v1_0_epv_t intfImplFuncTable1 = { Invert, Operate, ChangeCase, WriteOnStorage, Shutdown }; // RPC interface implementation 2: - AcmeTesting_v1_0_epv_t intfImplFuncTable2 = { Operate2, ChangeCase2, WriteOnStorage, Shutdown }; + AcmeTesting_v1_0_epv_t intfImplFuncTable2 = { Invert, Operate2, ChangeCase2, WriteOnStorage, Shutdown }; std::vector objects; objects.reserve(2); @@ -415,10 +409,10 @@ namespace integration_tests ); // RPC interface implementation 1: - AcmeTesting_v1_0_epv_t intfImplFuncTable1 = { Operate, ChangeCase, WriteOnStorage, Shutdown }; + AcmeTesting_v1_0_epv_t intfImplFuncTable1 = { Invert, Operate, ChangeCase, WriteOnStorage, Shutdown }; // RPC interface implementation 2: - AcmeTesting_v1_0_epv_t intfImplFuncTable2 = { Operate2, ChangeCase2, WriteOnStorage, Shutdown }; + AcmeTesting_v1_0_epv_t intfImplFuncTable2 = { Invert, Operate2, ChangeCase2, WriteOnStorage, Shutdown }; std::vector objects; objects.reserve(2); @@ -498,10 +492,10 @@ namespace integration_tests ); // RPC interface implementation 1: - AcmeTesting_v1_0_epv_t intfImplFuncTable1 = { Operate, ChangeCase, WriteOnStorage, Shutdown }; + AcmeTesting_v1_0_epv_t intfImplFuncTable1 = { Invert, Operate, ChangeCase, WriteOnStorage, Shutdown }; // RPC interface implementation 2: - AcmeTesting_v1_0_epv_t intfImplFuncTable2 = { Operate2, ChangeCase2, WriteOnStorage, Shutdown }; + AcmeTesting_v1_0_epv_t intfImplFuncTable2 = { Invert, Operate2, ChangeCase2, WriteOnStorage, Shutdown }; std::vector objects; objects.reserve(2); @@ -596,10 +590,10 @@ namespace integration_tests ); // RPC interface implementation 1: - AcmeTesting_v1_0_epv_t intfImplFuncTable1 = { Operate, ChangeCase, WriteOnStorage, Shutdown }; + AcmeTesting_v1_0_epv_t intfImplFuncTable1 = { Invert, Operate, ChangeCase, WriteOnStorage, Shutdown }; // RPC interface implementation 2: - AcmeTesting_v1_0_epv_t intfImplFuncTable2 = { Operate2, ChangeCase2, WriteOnStorage, Shutdown }; + AcmeTesting_v1_0_epv_t intfImplFuncTable2 = { Invert, Operate2, ChangeCase2, WriteOnStorage, Shutdown }; std::vector objects; objects.reserve(2); @@ -686,10 +680,10 @@ namespace integration_tests ); // RPC interface implementation 1: - AcmeTesting_v1_0_epv_t intfImplFuncTable1 = { Operate, ChangeCase, WriteOnStorage, Shutdown }; + AcmeTesting_v1_0_epv_t intfImplFuncTable1 = { Invert, Operate, ChangeCase, WriteOnStorage, Shutdown }; // RPC interface implementation 2: - AcmeTesting_v1_0_epv_t intfImplFuncTable2 = { Operate2, ChangeCase2, WriteOnStorage, Shutdown }; + AcmeTesting_v1_0_epv_t intfImplFuncTable2 = { Invert, Operate2, ChangeCase2, WriteOnStorage, Shutdown }; std::vector objects; objects.reserve(2); diff --git a/IntegrationTests/tests_wws.cpp b/IntegrationTests/tests_wws.cpp index 078e4a9..7db09b5 100644 --- a/IntegrationTests/tests_wws.cpp +++ b/IntegrationTests/tests_wws.cpp @@ -41,7 +41,7 @@ namespace integration_tests HRESULT CALLBACK CloseServiceImpl( _In_ const WS_OPERATION_CONTEXT *wsContextHandle, - _Out_ __int64 *result, + _Out_ BOOL *result, _In_ const WS_ASYNC_CONTEXT *asyncContext, _In_ WS_ERROR *wsErrorHandle ); @@ -168,25 +168,6 @@ namespace integration_tests return true; } - /// - /// Retrieves the amount of time expected to last - /// a full cycle in server of close-setup-open, based - /// on the maximum closure time for the web service - /// host registered so far. - /// - /// - /// Retrieves the maximum closure time in milliseconds. - /// - static uint32_t GetEstimateCycleTime() - { - /* In practice, measured time must be linearly - augmented for adjustment (using field data), because - apparently the server takes much longer to be available - than what the measures point out. It happens a little - after WebServiceHost::Open returns... */ - return static_cast (maxTimeSpanForSvcCycle.count() + 50); - } - /// /// Set up the test fixture. /// @@ -456,12 +437,12 @@ namespace integration_tests // Implementation for the operation "CloseService" HRESULT CALLBACK CloseServiceImpl( _In_ const WS_OPERATION_CONTEXT *wsContextHandle, - _Out_ __int64 *result, + _Out_ BOOL *result, _In_ const WS_ASYNC_CONTEXT *asyncContext, _In_ WS_ERROR *wsErrorHandle) { Framework_WWS_TestCase::SignalWebServiceClosureEvent(); - *result = Framework_WWS_TestCase::GetEstimateCycleTime(); + *result = TRUE; return S_OK; } @@ -513,7 +494,7 @@ namespace integration_tests /// Tests synchronous web service access /// with SSL over HTTP and no client certificate. /// - TEST_F(Framework_WWS_TestCase, DISABLED_Host_TransportSSL_NoClientCert_SyncTest) + TEST_F(Framework_WWS_TestCase, Host_TransportSSL_NoClientCert_SyncTest) { TestHostTransportSSL(false); } @@ -522,7 +503,7 @@ namespace integration_tests /// Tests asynchronous web service access with /// SSL over HTTP and no client certificate. /// - TEST_F(Framework_WWS_TestCase, DISABLED_Host_TransportSSL_NoClientCert_AsyncTest) + TEST_F(Framework_WWS_TestCase, Host_TransportSSL_NoClientCert_AsyncTest) { TestHostTransportSSL(false); } diff --git a/MidlCompileRpcTestIDL.bat b/MidlCompileRpcTestIDL.bat index 4c008d1..998268f 100644 --- a/MidlCompileRpcTestIDL.bat +++ b/MidlCompileRpcTestIDL.bat @@ -1,9 +1,9 @@ call "%VS140COMNTOOLS%\VsDevCmd.bat" -midl /Oicf /osf /use_epv /win32 /client none /out IntegrationTests /h AcmeTesting_w32.h /sstub AcmeTesting_w32_srv.c TestShared\AcmeTesting.idl +midl /Oicf /use_epv /win32 /client none /out IntegrationTests /h AcmeTesting_w32.h /sstub AcmeTesting_w32_srv.c TestShared\AcmeTesting.idl -midl /Oicf /osf /use_epv /amd64 /client none /out IntegrationTests /h AcmeTesting_x64.h /sstub AcmeTesting_x64_srv.c TestShared\AcmeTesting.idl +midl /Oicf /use_epv /amd64 /client none /out IntegrationTests /h AcmeTesting_x64.h /sstub AcmeTesting_x64_srv.c TestShared\AcmeTesting.idl -midl /Oicf /osf /use_epv /win32 /server none /out TestRpcClient /h AcmeTesting_w32.h /cstub AcmeTesting_w32_cli.c TestShared\AcmeTesting.idl +midl /Oicf /use_epv /win32 /server none /out TestRpcClient /h AcmeTesting_w32.h /cstub AcmeTesting_w32_cli.c TestShared\AcmeTesting.idl -midl /Oicf /osf /use_epv /amd64 /server none /out TestRpcClient /h AcmeTesting_x64.h /cstub AcmeTesting_x64_cli.c TestShared\AcmeTesting.idl +midl /Oicf /use_epv /amd64 /server none /out TestRpcClient /h AcmeTesting_x64.h /cstub AcmeTesting_x64_cli.c TestShared\AcmeTesting.idl diff --git a/README b/README index 5639111..80705be 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ A framework to help C++ programmers to code faster more robust and stable code. -The scope of this project is to provide a modern framework that simplifies common tasks like error handling and logging, ISAM/relational data access and storage, heterogeneous programming and memory management. It was carefully engineered to provide high performance, low memory footprint, verbosity in error report, a simple interface compliant to the new C++11 standard and portability to several platforms: POSIX, Windows Vista/7/8/8.1/Phone 8.1/10/10M. +The scope of this project is to provide a modern framework that simplifies common tasks like error handling and logging, ISAM/relational data access and storage, heterogeneous programming and memory management. It was carefully engineered to provide high performance, low memory footprint, verbosity in error report, a simple interface compliant to the new C++11 standard and portability to several platforms: POSIX, Windows Vista/7/8/8.1/10/10 UWP. The provided features are: diff --git a/TestRpcClient/AcmeTesting_w32.h b/TestRpcClient/AcmeTesting_w32.h index 42d1584..c7e916d 100644 --- a/TestRpcClient/AcmeTesting_w32.h +++ b/TestRpcClient/AcmeTesting_w32.h @@ -8,7 +8,7 @@ */ /* Compiler settings for TestShared\AcmeTesting.idl: Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.01.0620 - protocol : dce , robust + protocol : dce , ms_ext, c_ext, robust error checks: allocation ref bounds_check enum stub_data , use_epv VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) @@ -52,22 +52,26 @@ extern "C"{ /* interface AcmeTesting */ /* [version][uuid] */ +typedef struct pair + { + int left; + int right; + } pair; + +void Invert( + /* [in] */ handle_t IDL_handle, + /* [out][in] */ pair *onePair); + void Operate( /* [in] */ handle_t IDL_handle, /* [in] */ double left, /* [in] */ double right, /* [out] */ double *result); -typedef /* [public][public][public] */ struct __MIDL_AcmeTesting_0001 - { - unsigned short size; - /* [size_is][string] */ unsigned char *data; - } cstring; - void ChangeCase( /* [in] */ handle_t IDL_handle, - /* [in] */ cstring *input, - /* [out] */ cstring *output); + /* [string][in] */ unsigned char *input, + /* [size_is][string][out] */ unsigned char *output); void WriteOnStorage( /* [in] */ handle_t IDL_handle); @@ -79,6 +83,9 @@ unsigned long Shutdown( typedef struct _AcmeTesting_v1_0_epv_t { + void ( *Invert )( + /* [in] */ handle_t IDL_handle, + /* [out][in] */ pair *onePair); void ( *Operate )( /* [in] */ handle_t IDL_handle, /* [in] */ double left, @@ -86,8 +93,8 @@ typedef struct _AcmeTesting_v1_0_epv_t /* [out] */ double *result); void ( *ChangeCase )( /* [in] */ handle_t IDL_handle, - /* [in] */ cstring *input, - /* [out] */ cstring *output); + /* [string][in] */ unsigned char *input, + /* [size_is][string][out] */ unsigned char *output); void ( *WriteOnStorage )( /* [in] */ handle_t IDL_handle); unsigned long ( *Shutdown )( diff --git a/TestRpcClient/AcmeTesting_w32_cli.c b/TestRpcClient/AcmeTesting_w32_cli.c index 0edfa8f..9662974 100644 --- a/TestRpcClient/AcmeTesting_w32_cli.c +++ b/TestRpcClient/AcmeTesting_w32_cli.c @@ -8,7 +8,7 @@ */ /* Compiler settings for TestShared\AcmeTesting.idl: Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.01.0620 - protocol : dce , robust + protocol : dce , ms_ext, c_ext, robust error checks: allocation ref bounds_check enum stub_data , use_epv VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) @@ -33,11 +33,10 @@ #include -#include #include "AcmeTesting_w32.h" -#define TYPE_FORMAT_STRING_SIZE 45 -#define PROC_FORMAT_STRING_SIZE 149 +#define TYPE_FORMAT_STRING_SIZE 35 +#define PROC_FORMAT_STRING_SIZE 183 #define EXPR_FORMAT_STRING_SIZE 1 #define TRANSMIT_AS_TABLE_SIZE 0 #define WIRE_MARSHAL_TABLE_SIZE 0 @@ -96,6 +95,19 @@ extern const MIDL_STUB_DESC AcmeTesting_StubDesc; static RPC_BINDING_HANDLE AcmeTesting__MIDL_AutoBindHandle; +void Invert( + /* [in] */ handle_t IDL_handle, + /* [out][in] */ pair *onePair) +{ + + NdrClientCall2( + ( PMIDL_STUB_DESC )&AcmeTesting_StubDesc, + (PFORMAT_STRING) &AcmeTesting__MIDL_ProcFormatString.Format[0], + ( unsigned char * )&IDL_handle); + +} + + void Operate( /* [in] */ handle_t IDL_handle, /* [in] */ double left, @@ -105,7 +117,7 @@ void Operate( NdrClientCall2( ( PMIDL_STUB_DESC )&AcmeTesting_StubDesc, - (PFORMAT_STRING) &AcmeTesting__MIDL_ProcFormatString.Format[0], + (PFORMAT_STRING) &AcmeTesting__MIDL_ProcFormatString.Format[34], ( unsigned char * )&IDL_handle); } @@ -113,13 +125,13 @@ void Operate( void ChangeCase( /* [in] */ handle_t IDL_handle, - /* [in] */ cstring *input, - /* [out] */ cstring *output) + /* [string][in] */ unsigned char *input, + /* [size_is][string][out] */ unsigned char *output) { NdrClientCall2( ( PMIDL_STUB_DESC )&AcmeTesting_StubDesc, - (PFORMAT_STRING) &AcmeTesting__MIDL_ProcFormatString.Format[46], + (PFORMAT_STRING) &AcmeTesting__MIDL_ProcFormatString.Format[80], ( unsigned char * )&IDL_handle); } @@ -131,7 +143,7 @@ void WriteOnStorage( NdrClientCall2( ( PMIDL_STUB_DESC )&AcmeTesting_StubDesc, - (PFORMAT_STRING) &AcmeTesting__MIDL_ProcFormatString.Format[86], + (PFORMAT_STRING) &AcmeTesting__MIDL_ProcFormatString.Format[120], ( unsigned char * )&IDL_handle); } @@ -145,7 +157,7 @@ unsigned long Shutdown( _RetVal = NdrClientCall2( ( PMIDL_STUB_DESC )&AcmeTesting_StubDesc, - (PFORMAT_STRING) &AcmeTesting__MIDL_ProcFormatString.Format[114], + (PFORMAT_STRING) &AcmeTesting__MIDL_ProcFormatString.Format[148], ( unsigned char * )&IDL_handle); return ( unsigned long )_RetVal.Simple; @@ -169,124 +181,150 @@ static const AcmeTesting_MIDL_PROC_FORMAT_STRING AcmeTesting__MIDL_ProcFormatStr 0, { - /* Procedure Operate */ + /* Procedure Invert */ 0x0, /* 0 */ - 0x4a, /* Old Flags: DCE mem package, */ + 0x48, /* Old Flags: */ /* 2 */ NdrFcLong( 0x0 ), /* 0 */ /* 6 */ NdrFcShort( 0x0 ), /* 0 */ -/* 8 */ NdrFcShort( 0x18 ), /* x86 Stack size/offset = 24 */ +/* 8 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ /* 10 */ 0x32, /* FC_BIND_PRIMITIVE */ 0x0, /* 0 */ /* 12 */ NdrFcShort( 0x0 ), /* x86 Stack size/offset = 0 */ -/* 14 */ NdrFcShort( 0x20 ), /* 32 */ -/* 16 */ NdrFcShort( 0x24 ), /* 36 */ +/* 14 */ NdrFcShort( 0x2c ), /* 44 */ +/* 16 */ NdrFcShort( 0x2c ), /* 44 */ /* 18 */ 0x40, /* Oi2 Flags: has ext, */ - 0x3, /* 3 */ + 0x1, /* 1 */ /* 20 */ 0x8, /* 8 */ 0x1, /* Ext Flags: new corr desc, */ /* 22 */ NdrFcShort( 0x0 ), /* 0 */ /* 24 */ NdrFcShort( 0x0 ), /* 0 */ /* 26 */ NdrFcShort( 0x0 ), /* 0 */ - /* Parameter left */ + /* Parameter onePair */ -/* 28 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 28 */ NdrFcShort( 0x11a ), /* Flags: must free, in, out, simple ref, */ /* 30 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ -/* 32 */ 0xc, /* FC_DOUBLE */ +/* 32 */ NdrFcShort( 0x6 ), /* Type Offset=6 */ + + /* Procedure Operate */ + +/* 34 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 36 */ NdrFcLong( 0x0 ), /* 0 */ +/* 40 */ NdrFcShort( 0x1 ), /* 1 */ +/* 42 */ NdrFcShort( 0x18 ), /* x86 Stack size/offset = 24 */ +/* 44 */ 0x32, /* FC_BIND_PRIMITIVE */ + 0x0, /* 0 */ +/* 46 */ NdrFcShort( 0x0 ), /* x86 Stack size/offset = 0 */ +/* 48 */ NdrFcShort( 0x20 ), /* 32 */ +/* 50 */ NdrFcShort( 0x24 ), /* 36 */ +/* 52 */ 0x40, /* Oi2 Flags: has ext, */ + 0x3, /* 3 */ +/* 54 */ 0x8, /* 8 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 56 */ NdrFcShort( 0x0 ), /* 0 */ +/* 58 */ NdrFcShort( 0x0 ), /* 0 */ +/* 60 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter left */ + +/* 62 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 64 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ +/* 66 */ 0xc, /* FC_DOUBLE */ 0x0, /* 0 */ /* Parameter right */ -/* 34 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ -/* 36 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ -/* 38 */ 0xc, /* FC_DOUBLE */ +/* 68 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 70 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ +/* 72 */ 0xc, /* FC_DOUBLE */ 0x0, /* 0 */ /* Parameter result */ -/* 40 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ -/* 42 */ NdrFcShort( 0x14 ), /* x86 Stack size/offset = 20 */ -/* 44 */ 0xc, /* FC_DOUBLE */ +/* 74 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ +/* 76 */ NdrFcShort( 0x14 ), /* x86 Stack size/offset = 20 */ +/* 78 */ 0xc, /* FC_DOUBLE */ 0x0, /* 0 */ /* Procedure ChangeCase */ -/* 46 */ 0x0, /* 0 */ - 0x4b, /* Old Flags: full ptr, DCE mem package, */ -/* 48 */ NdrFcLong( 0x0 ), /* 0 */ -/* 52 */ NdrFcShort( 0x1 ), /* 1 */ -/* 54 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ -/* 56 */ 0x32, /* FC_BIND_PRIMITIVE */ +/* 80 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 82 */ NdrFcLong( 0x0 ), /* 0 */ +/* 86 */ NdrFcShort( 0x2 ), /* 2 */ +/* 88 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ +/* 90 */ 0x32, /* FC_BIND_PRIMITIVE */ 0x0, /* 0 */ -/* 58 */ NdrFcShort( 0x0 ), /* x86 Stack size/offset = 0 */ -/* 60 */ NdrFcShort( 0x0 ), /* 0 */ -/* 62 */ NdrFcShort( 0x0 ), /* 0 */ -/* 64 */ 0x43, /* Oi2 Flags: srv must size, clt must size, has ext, */ +/* 92 */ NdrFcShort( 0x0 ), /* x86 Stack size/offset = 0 */ +/* 94 */ NdrFcShort( 0x0 ), /* 0 */ +/* 96 */ NdrFcShort( 0x0 ), /* 0 */ +/* 98 */ 0x43, /* Oi2 Flags: srv must size, clt must size, has ext, */ 0x2, /* 2 */ -/* 66 */ 0x8, /* 8 */ - 0x7, /* Ext Flags: new corr desc, clt corr check, srv corr check, */ -/* 68 */ NdrFcShort( 0x1 ), /* 1 */ -/* 70 */ NdrFcShort( 0x1 ), /* 1 */ -/* 72 */ NdrFcShort( 0x0 ), /* 0 */ +/* 100 */ 0x8, /* 8 */ + 0x3, /* Ext Flags: new corr desc, clt corr check, */ +/* 102 */ NdrFcShort( 0x1 ), /* 1 */ +/* 104 */ NdrFcShort( 0x0 ), /* 0 */ +/* 106 */ NdrFcShort( 0x0 ), /* 0 */ /* Parameter input */ -/* 74 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ -/* 76 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ -/* 78 */ NdrFcShort( 0x12 ), /* Type Offset=18 */ +/* 108 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ +/* 110 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ +/* 112 */ NdrFcShort( 0x14 ), /* Type Offset=20 */ /* Parameter output */ -/* 80 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ -/* 82 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ -/* 84 */ NdrFcShort( 0x12 ), /* Type Offset=18 */ +/* 114 */ NdrFcShort( 0x113 ), /* Flags: must size, must free, out, simple ref, */ +/* 116 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ +/* 118 */ NdrFcShort( 0x1a ), /* Type Offset=26 */ /* Procedure WriteOnStorage */ -/* 86 */ 0x0, /* 0 */ - 0x4a, /* Old Flags: DCE mem package, */ -/* 88 */ NdrFcLong( 0x0 ), /* 0 */ -/* 92 */ NdrFcShort( 0x2 ), /* 2 */ -/* 94 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ -/* 96 */ 0x32, /* FC_BIND_PRIMITIVE */ +/* 120 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 122 */ NdrFcLong( 0x0 ), /* 0 */ +/* 126 */ NdrFcShort( 0x3 ), /* 3 */ +/* 128 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ +/* 130 */ 0x32, /* FC_BIND_PRIMITIVE */ 0x0, /* 0 */ -/* 98 */ NdrFcShort( 0x0 ), /* x86 Stack size/offset = 0 */ -/* 100 */ NdrFcShort( 0x0 ), /* 0 */ -/* 102 */ NdrFcShort( 0x0 ), /* 0 */ -/* 104 */ 0x40, /* Oi2 Flags: has ext, */ +/* 132 */ NdrFcShort( 0x0 ), /* x86 Stack size/offset = 0 */ +/* 134 */ NdrFcShort( 0x0 ), /* 0 */ +/* 136 */ NdrFcShort( 0x0 ), /* 0 */ +/* 138 */ 0x40, /* Oi2 Flags: has ext, */ 0x0, /* 0 */ -/* 106 */ 0x8, /* 8 */ +/* 140 */ 0x8, /* 8 */ 0x1, /* Ext Flags: new corr desc, */ -/* 108 */ NdrFcShort( 0x0 ), /* 0 */ -/* 110 */ NdrFcShort( 0x0 ), /* 0 */ -/* 112 */ NdrFcShort( 0x0 ), /* 0 */ +/* 142 */ NdrFcShort( 0x0 ), /* 0 */ +/* 144 */ NdrFcShort( 0x0 ), /* 0 */ +/* 146 */ NdrFcShort( 0x0 ), /* 0 */ /* Procedure Shutdown */ -/* 114 */ 0x0, /* 0 */ - 0x4a, /* Old Flags: DCE mem package, */ -/* 116 */ NdrFcLong( 0x0 ), /* 0 */ -/* 120 */ NdrFcShort( 0x3 ), /* 3 */ -/* 122 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ -/* 124 */ 0x32, /* FC_BIND_PRIMITIVE */ +/* 148 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 150 */ NdrFcLong( 0x0 ), /* 0 */ +/* 154 */ NdrFcShort( 0x4 ), /* 4 */ +/* 156 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ +/* 158 */ 0x32, /* FC_BIND_PRIMITIVE */ 0x0, /* 0 */ -/* 126 */ NdrFcShort( 0x0 ), /* x86 Stack size/offset = 0 */ -/* 128 */ NdrFcShort( 0x0 ), /* 0 */ -/* 130 */ NdrFcShort( 0x8 ), /* 8 */ -/* 132 */ 0x44, /* Oi2 Flags: has return, has ext, */ +/* 160 */ NdrFcShort( 0x0 ), /* x86 Stack size/offset = 0 */ +/* 162 */ NdrFcShort( 0x0 ), /* 0 */ +/* 164 */ NdrFcShort( 0x8 ), /* 8 */ +/* 166 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x1, /* 1 */ -/* 134 */ 0x8, /* 8 */ +/* 168 */ 0x8, /* 8 */ 0x1, /* Ext Flags: new corr desc, */ -/* 136 */ NdrFcShort( 0x0 ), /* 0 */ -/* 138 */ NdrFcShort( 0x0 ), /* 0 */ -/* 140 */ NdrFcShort( 0x0 ), /* 0 */ +/* 170 */ NdrFcShort( 0x0 ), /* 0 */ +/* 172 */ NdrFcShort( 0x0 ), /* 0 */ +/* 174 */ NdrFcShort( 0x0 ), /* 0 */ /* Return value */ -/* 142 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 144 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ -/* 146 */ 0x8, /* FC_LONG */ +/* 176 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 178 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ +/* 180 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ 0x0 @@ -299,81 +337,55 @@ static const AcmeTesting_MIDL_TYPE_FORMAT_STRING AcmeTesting__MIDL_TypeFormatStr { NdrFcShort( 0x0 ), /* 0 */ /* 2 */ + 0x11, 0x0, /* FC_RP */ +/* 4 */ NdrFcShort( 0x2 ), /* Offset= 2 (6) */ +/* 6 */ + 0x15, /* FC_STRUCT */ + 0x3, /* 3 */ +/* 8 */ NdrFcShort( 0x8 ), /* 8 */ +/* 10 */ 0x8, /* FC_LONG */ + 0x8, /* FC_LONG */ +/* 12 */ 0x5c, /* FC_PAD */ + 0x5b, /* FC_END */ +/* 14 */ 0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */ -/* 4 */ 0xc, /* FC_DOUBLE */ +/* 16 */ 0xc, /* FC_DOUBLE */ 0x5c, /* FC_PAD */ -/* 6 */ +/* 18 */ + 0x11, 0x8, /* FC_RP [simple_pointer] */ +/* 20 */ + 0x22, /* FC_C_CSTRING */ + 0x5c, /* FC_PAD */ +/* 22 */ 0x11, 0x0, /* FC_RP */ -/* 8 */ NdrFcShort( 0xa ), /* Offset= 10 (18) */ -/* 10 */ +/* 24 */ NdrFcShort( 0x2 ), /* Offset= 2 (26) */ +/* 26 */ 0x22, /* FC_C_CSTRING */ 0x44, /* FC_STRING_SIZED */ -/* 12 */ 0x17, /* Corr desc: field pointer, FC_USHORT */ - 0x0, /* */ -/* 14 */ NdrFcShort( 0x0 ), /* 0 */ -/* 16 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ -/* 18 */ - 0x16, /* FC_PSTRUCT */ - 0x3, /* 3 */ -/* 20 */ NdrFcShort( 0x8 ), /* 8 */ -/* 22 */ - 0x4b, /* FC_PP */ - 0x5c, /* FC_PAD */ -/* 24 */ - 0x46, /* FC_NO_REPEAT */ - 0x5c, /* FC_PAD */ -/* 26 */ NdrFcShort( 0x4 ), /* 4 */ -/* 28 */ NdrFcShort( 0x4 ), /* 4 */ -/* 30 */ 0x14, 0x0, /* FC_FP */ -/* 32 */ NdrFcShort( 0xffea ), /* Offset= -22 (10) */ -/* 34 */ - 0x5b, /* FC_END */ - - 0x6, /* FC_SHORT */ -/* 36 */ 0x3e, /* FC_STRUCTPAD2 */ - 0x8, /* FC_LONG */ -/* 38 */ 0x5c, /* FC_PAD */ - 0x5b, /* FC_END */ -/* 40 */ - 0x11, 0x4, /* FC_RP [alloced_on_stack] */ -/* 42 */ NdrFcShort( 0xffe8 ), /* Offset= -24 (18) */ +/* 28 */ 0x40, /* Corr desc: constant, val=256 */ + 0x0, /* 0 */ +/* 30 */ NdrFcShort( 0x100 ), /* 256 */ +/* 32 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ 0x0 } }; -static void * __RPC_USER -AcmeTesting_malloc_wrapper( size_t _Size ) -{ - return( malloc( _Size ) ); -} - -static void __RPC_USER -AcmeTesting_free_wrapper( void * _p ) -{ - free( _p ); -} - -static const MALLOC_FREE_STRUCT _MallocFreeStruct = -{ - AcmeTesting_malloc_wrapper, - AcmeTesting_free_wrapper -}; - static const unsigned short AcmeTesting_FormatStringOffsetTable[] = { 0, - 46, - 86, - 114 + 34, + 80, + 120, + 148 }; static const MIDL_STUB_DESC AcmeTesting_StubDesc = { (void *)& AcmeTesting___RpcClientInterface, - NdrRpcSmClientAllocate, - NdrRpcSmClientFree, + MIDL_user_allocate, + MIDL_user_free, &AcmeTesting__MIDL_AutoBindHandle, 0, 0, @@ -382,7 +394,7 @@ static const MIDL_STUB_DESC AcmeTesting_StubDesc = AcmeTesting__MIDL_TypeFormatString.Format, 1, /* -error bounds_check flag */ 0x50002, /* Ndr library version */ - (MALLOC_FREE_STRUCT*)&_MallocFreeStruct, + 0, 0x801026c, /* MIDL Version 8.1.620 */ 0, 0, diff --git a/TestRpcClient/AcmeTesting_x64.h b/TestRpcClient/AcmeTesting_x64.h index 59d9f85..6745022 100644 --- a/TestRpcClient/AcmeTesting_x64.h +++ b/TestRpcClient/AcmeTesting_x64.h @@ -8,7 +8,7 @@ */ /* Compiler settings for TestShared\AcmeTesting.idl: Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.01.0620 - protocol : dce , robust + protocol : dce , ms_ext, c_ext, robust error checks: allocation ref bounds_check enum stub_data , use_epv VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) @@ -52,22 +52,26 @@ extern "C"{ /* interface AcmeTesting */ /* [version][uuid] */ +typedef struct pair + { + int left; + int right; + } pair; + +void Invert( + /* [in] */ handle_t IDL_handle, + /* [out][in] */ pair *onePair); + void Operate( /* [in] */ handle_t IDL_handle, /* [in] */ double left, /* [in] */ double right, /* [out] */ double *result); -typedef /* [public][public][public] */ struct __MIDL_AcmeTesting_0001 - { - unsigned short size; - /* [size_is][string] */ unsigned char *data; - } cstring; - void ChangeCase( /* [in] */ handle_t IDL_handle, - /* [in] */ cstring *input, - /* [out] */ cstring *output); + /* [string][in] */ unsigned char *input, + /* [size_is][string][out] */ unsigned char *output); void WriteOnStorage( /* [in] */ handle_t IDL_handle); @@ -79,6 +83,9 @@ unsigned long Shutdown( typedef struct _AcmeTesting_v1_0_epv_t { + void ( *Invert )( + /* [in] */ handle_t IDL_handle, + /* [out][in] */ pair *onePair); void ( *Operate )( /* [in] */ handle_t IDL_handle, /* [in] */ double left, @@ -86,8 +93,8 @@ typedef struct _AcmeTesting_v1_0_epv_t /* [out] */ double *result); void ( *ChangeCase )( /* [in] */ handle_t IDL_handle, - /* [in] */ cstring *input, - /* [out] */ cstring *output); + /* [string][in] */ unsigned char *input, + /* [size_is][string][out] */ unsigned char *output); void ( *WriteOnStorage )( /* [in] */ handle_t IDL_handle); unsigned long ( *Shutdown )( diff --git a/TestRpcClient/AcmeTesting_x64_cli.c b/TestRpcClient/AcmeTesting_x64_cli.c index da2eb2c..8d27d9f 100644 --- a/TestRpcClient/AcmeTesting_x64_cli.c +++ b/TestRpcClient/AcmeTesting_x64_cli.c @@ -8,7 +8,7 @@ */ /* Compiler settings for TestShared\AcmeTesting.idl: Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.01.0620 - protocol : dce , robust + protocol : dce , ms_ext, c_ext, robust error checks: allocation ref bounds_check enum stub_data , use_epv VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) @@ -30,11 +30,10 @@ #include -#include #include "AcmeTesting_x64.h" -#define TYPE_FORMAT_STRING_SIZE 39 -#define PROC_FORMAT_STRING_SIZE 157 +#define TYPE_FORMAT_STRING_SIZE 35 +#define PROC_FORMAT_STRING_SIZE 193 #define EXPR_FORMAT_STRING_SIZE 1 #define TRANSMIT_AS_TABLE_SIZE 0 #define WIRE_MARSHAL_TABLE_SIZE 0 @@ -93,6 +92,20 @@ extern const MIDL_STUB_DESC AcmeTesting_StubDesc; static RPC_BINDING_HANDLE AcmeTesting__MIDL_AutoBindHandle; +void Invert( + /* [in] */ handle_t IDL_handle, + /* [out][in] */ pair *onePair) +{ + + NdrClientCall2( + ( PMIDL_STUB_DESC )&AcmeTesting_StubDesc, + (PFORMAT_STRING) &AcmeTesting__MIDL_ProcFormatString.Format[0], + IDL_handle, + onePair); + +} + + void Operate( /* [in] */ handle_t IDL_handle, /* [in] */ double left, @@ -102,7 +115,7 @@ void Operate( NdrClientCall2( ( PMIDL_STUB_DESC )&AcmeTesting_StubDesc, - (PFORMAT_STRING) &AcmeTesting__MIDL_ProcFormatString.Format[0], + (PFORMAT_STRING) &AcmeTesting__MIDL_ProcFormatString.Format[36], IDL_handle, left, right, @@ -113,13 +126,13 @@ void Operate( void ChangeCase( /* [in] */ handle_t IDL_handle, - /* [in] */ cstring *input, - /* [out] */ cstring *output) + /* [string][in] */ unsigned char *input, + /* [size_is][string][out] */ unsigned char *output) { NdrClientCall2( ( PMIDL_STUB_DESC )&AcmeTesting_StubDesc, - (PFORMAT_STRING) &AcmeTesting__MIDL_ProcFormatString.Format[48], + (PFORMAT_STRING) &AcmeTesting__MIDL_ProcFormatString.Format[84], IDL_handle, input, output); @@ -133,7 +146,7 @@ void WriteOnStorage( NdrClientCall2( ( PMIDL_STUB_DESC )&AcmeTesting_StubDesc, - (PFORMAT_STRING) &AcmeTesting__MIDL_ProcFormatString.Format[90], + (PFORMAT_STRING) &AcmeTesting__MIDL_ProcFormatString.Format[126], IDL_handle); } @@ -147,7 +160,7 @@ unsigned long Shutdown( _RetVal = NdrClientCall2( ( PMIDL_STUB_DESC )&AcmeTesting_StubDesc, - (PFORMAT_STRING) &AcmeTesting__MIDL_ProcFormatString.Format[120], + (PFORMAT_STRING) &AcmeTesting__MIDL_ProcFormatString.Format[156], IDL_handle); return ( unsigned long )_RetVal.Simple; @@ -163,128 +176,155 @@ static const AcmeTesting_MIDL_PROC_FORMAT_STRING AcmeTesting__MIDL_ProcFormatStr 0, { - /* Procedure Operate */ + /* Procedure Invert */ 0x0, /* 0 */ - 0x4a, /* Old Flags: DCE mem package, */ + 0x48, /* Old Flags: */ /* 2 */ NdrFcLong( 0x0 ), /* 0 */ /* 6 */ NdrFcShort( 0x0 ), /* 0 */ -/* 8 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */ +/* 8 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ /* 10 */ 0x32, /* FC_BIND_PRIMITIVE */ 0x0, /* 0 */ /* 12 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ -/* 14 */ NdrFcShort( 0x20 ), /* 32 */ -/* 16 */ NdrFcShort( 0x24 ), /* 36 */ +/* 14 */ NdrFcShort( 0x2c ), /* 44 */ +/* 16 */ NdrFcShort( 0x2c ), /* 44 */ /* 18 */ 0x40, /* Oi2 Flags: has ext, */ - 0x3, /* 3 */ + 0x1, /* 1 */ /* 20 */ 0xa, /* 10 */ 0x1, /* Ext Flags: new corr desc, */ /* 22 */ NdrFcShort( 0x0 ), /* 0 */ /* 24 */ NdrFcShort( 0x0 ), /* 0 */ /* 26 */ NdrFcShort( 0x0 ), /* 0 */ -/* 28 */ NdrFcShort( 0x28 ), /* 40 */ +/* 28 */ NdrFcShort( 0x0 ), /* 0 */ - /* Parameter left */ + /* Parameter onePair */ -/* 30 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 30 */ NdrFcShort( 0x11a ), /* Flags: must free, in, out, simple ref, */ /* 32 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ -/* 34 */ 0xc, /* FC_DOUBLE */ +/* 34 */ NdrFcShort( 0x6 ), /* Type Offset=6 */ + + /* Procedure Operate */ + +/* 36 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 38 */ NdrFcLong( 0x0 ), /* 0 */ +/* 42 */ NdrFcShort( 0x1 ), /* 1 */ +/* 44 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */ +/* 46 */ 0x32, /* FC_BIND_PRIMITIVE */ + 0x0, /* 0 */ +/* 48 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 50 */ NdrFcShort( 0x20 ), /* 32 */ +/* 52 */ NdrFcShort( 0x24 ), /* 36 */ +/* 54 */ 0x40, /* Oi2 Flags: has ext, */ + 0x3, /* 3 */ +/* 56 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 58 */ NdrFcShort( 0x0 ), /* 0 */ +/* 60 */ NdrFcShort( 0x0 ), /* 0 */ +/* 62 */ NdrFcShort( 0x0 ), /* 0 */ +/* 64 */ NdrFcShort( 0x28 ), /* 40 */ + + /* Parameter left */ + +/* 66 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 68 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 70 */ 0xc, /* FC_DOUBLE */ 0x0, /* 0 */ /* Parameter right */ -/* 36 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ -/* 38 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ -/* 40 */ 0xc, /* FC_DOUBLE */ +/* 72 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 74 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 76 */ 0xc, /* FC_DOUBLE */ 0x0, /* 0 */ /* Parameter result */ -/* 42 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ -/* 44 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ -/* 46 */ 0xc, /* FC_DOUBLE */ +/* 78 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ +/* 80 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ +/* 82 */ 0xc, /* FC_DOUBLE */ 0x0, /* 0 */ /* Procedure ChangeCase */ -/* 48 */ 0x0, /* 0 */ - 0x4b, /* Old Flags: full ptr, DCE mem package, */ -/* 50 */ NdrFcLong( 0x0 ), /* 0 */ -/* 54 */ NdrFcShort( 0x1 ), /* 1 */ -/* 56 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ -/* 58 */ 0x32, /* FC_BIND_PRIMITIVE */ +/* 84 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 86 */ NdrFcLong( 0x0 ), /* 0 */ +/* 90 */ NdrFcShort( 0x2 ), /* 2 */ +/* 92 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ +/* 94 */ 0x32, /* FC_BIND_PRIMITIVE */ 0x0, /* 0 */ -/* 60 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ -/* 62 */ NdrFcShort( 0x0 ), /* 0 */ -/* 64 */ NdrFcShort( 0x0 ), /* 0 */ -/* 66 */ 0x43, /* Oi2 Flags: srv must size, clt must size, has ext, */ +/* 96 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 98 */ NdrFcShort( 0x0 ), /* 0 */ +/* 100 */ NdrFcShort( 0x0 ), /* 0 */ +/* 102 */ 0x43, /* Oi2 Flags: srv must size, clt must size, has ext, */ 0x2, /* 2 */ -/* 68 */ 0xa, /* 10 */ - 0x7, /* Ext Flags: new corr desc, clt corr check, srv corr check, */ -/* 70 */ NdrFcShort( 0x1 ), /* 1 */ -/* 72 */ NdrFcShort( 0x1 ), /* 1 */ -/* 74 */ NdrFcShort( 0x0 ), /* 0 */ -/* 76 */ NdrFcShort( 0x0 ), /* 0 */ +/* 104 */ 0xa, /* 10 */ + 0x3, /* Ext Flags: new corr desc, clt corr check, */ +/* 106 */ NdrFcShort( 0x1 ), /* 1 */ +/* 108 */ NdrFcShort( 0x0 ), /* 0 */ +/* 110 */ NdrFcShort( 0x0 ), /* 0 */ +/* 112 */ NdrFcShort( 0x0 ), /* 0 */ /* Parameter input */ -/* 78 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ -/* 80 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ -/* 82 */ NdrFcShort( 0x12 ), /* Type Offset=18 */ +/* 114 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ +/* 116 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 118 */ NdrFcShort( 0x14 ), /* Type Offset=20 */ /* Parameter output */ -/* 84 */ NdrFcShort( 0x4113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=16 */ -/* 86 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ -/* 88 */ NdrFcShort( 0x12 ), /* Type Offset=18 */ +/* 120 */ NdrFcShort( 0x113 ), /* Flags: must size, must free, out, simple ref, */ +/* 122 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 124 */ NdrFcShort( 0x1a ), /* Type Offset=26 */ /* Procedure WriteOnStorage */ -/* 90 */ 0x0, /* 0 */ - 0x4a, /* Old Flags: DCE mem package, */ -/* 92 */ NdrFcLong( 0x0 ), /* 0 */ -/* 96 */ NdrFcShort( 0x2 ), /* 2 */ -/* 98 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ -/* 100 */ 0x32, /* FC_BIND_PRIMITIVE */ +/* 126 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 128 */ NdrFcLong( 0x0 ), /* 0 */ +/* 132 */ NdrFcShort( 0x3 ), /* 3 */ +/* 134 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 136 */ 0x32, /* FC_BIND_PRIMITIVE */ 0x0, /* 0 */ -/* 102 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ -/* 104 */ NdrFcShort( 0x0 ), /* 0 */ -/* 106 */ NdrFcShort( 0x0 ), /* 0 */ -/* 108 */ 0x40, /* Oi2 Flags: has ext, */ +/* 138 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 140 */ NdrFcShort( 0x0 ), /* 0 */ +/* 142 */ NdrFcShort( 0x0 ), /* 0 */ +/* 144 */ 0x40, /* Oi2 Flags: has ext, */ 0x0, /* 0 */ -/* 110 */ 0xa, /* 10 */ +/* 146 */ 0xa, /* 10 */ 0x1, /* Ext Flags: new corr desc, */ -/* 112 */ NdrFcShort( 0x0 ), /* 0 */ -/* 114 */ NdrFcShort( 0x0 ), /* 0 */ -/* 116 */ NdrFcShort( 0x0 ), /* 0 */ -/* 118 */ NdrFcShort( 0x0 ), /* 0 */ +/* 148 */ NdrFcShort( 0x0 ), /* 0 */ +/* 150 */ NdrFcShort( 0x0 ), /* 0 */ +/* 152 */ NdrFcShort( 0x0 ), /* 0 */ +/* 154 */ NdrFcShort( 0x0 ), /* 0 */ /* Procedure Shutdown */ -/* 120 */ 0x0, /* 0 */ - 0x4a, /* Old Flags: DCE mem package, */ -/* 122 */ NdrFcLong( 0x0 ), /* 0 */ -/* 126 */ NdrFcShort( 0x3 ), /* 3 */ -/* 128 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ -/* 130 */ 0x32, /* FC_BIND_PRIMITIVE */ +/* 156 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 158 */ NdrFcLong( 0x0 ), /* 0 */ +/* 162 */ NdrFcShort( 0x4 ), /* 4 */ +/* 164 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 166 */ 0x32, /* FC_BIND_PRIMITIVE */ 0x0, /* 0 */ -/* 132 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ -/* 134 */ NdrFcShort( 0x0 ), /* 0 */ -/* 136 */ NdrFcShort( 0x8 ), /* 8 */ -/* 138 */ 0x44, /* Oi2 Flags: has return, has ext, */ +/* 168 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 170 */ NdrFcShort( 0x0 ), /* 0 */ +/* 172 */ NdrFcShort( 0x8 ), /* 8 */ +/* 174 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x1, /* 1 */ -/* 140 */ 0xa, /* 10 */ +/* 176 */ 0xa, /* 10 */ 0x1, /* Ext Flags: new corr desc, */ -/* 142 */ NdrFcShort( 0x0 ), /* 0 */ -/* 144 */ NdrFcShort( 0x0 ), /* 0 */ -/* 146 */ NdrFcShort( 0x0 ), /* 0 */ -/* 148 */ NdrFcShort( 0x0 ), /* 0 */ +/* 178 */ NdrFcShort( 0x0 ), /* 0 */ +/* 180 */ NdrFcShort( 0x0 ), /* 0 */ +/* 182 */ NdrFcShort( 0x0 ), /* 0 */ +/* 184 */ NdrFcShort( 0x0 ), /* 0 */ /* Return value */ -/* 150 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ -/* 152 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ -/* 154 */ 0x8, /* FC_LONG */ +/* 186 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 188 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 190 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ 0x0 @@ -297,72 +337,55 @@ static const AcmeTesting_MIDL_TYPE_FORMAT_STRING AcmeTesting__MIDL_TypeFormatStr { NdrFcShort( 0x0 ), /* 0 */ /* 2 */ + 0x11, 0x0, /* FC_RP */ +/* 4 */ NdrFcShort( 0x2 ), /* Offset= 2 (6) */ +/* 6 */ + 0x15, /* FC_STRUCT */ + 0x3, /* 3 */ +/* 8 */ NdrFcShort( 0x8 ), /* 8 */ +/* 10 */ 0x8, /* FC_LONG */ + 0x8, /* FC_LONG */ +/* 12 */ 0x5c, /* FC_PAD */ + 0x5b, /* FC_END */ +/* 14 */ 0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */ -/* 4 */ 0xc, /* FC_DOUBLE */ +/* 16 */ 0xc, /* FC_DOUBLE */ 0x5c, /* FC_PAD */ -/* 6 */ +/* 18 */ + 0x11, 0x8, /* FC_RP [simple_pointer] */ +/* 20 */ + 0x22, /* FC_C_CSTRING */ + 0x5c, /* FC_PAD */ +/* 22 */ 0x11, 0x0, /* FC_RP */ -/* 8 */ NdrFcShort( 0xa ), /* Offset= 10 (18) */ -/* 10 */ +/* 24 */ NdrFcShort( 0x2 ), /* Offset= 2 (26) */ +/* 26 */ 0x22, /* FC_C_CSTRING */ 0x44, /* FC_STRING_SIZED */ -/* 12 */ 0x17, /* Corr desc: field pointer, FC_USHORT */ - 0x0, /* */ -/* 14 */ NdrFcShort( 0x0 ), /* 0 */ -/* 16 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ -/* 18 */ - 0x1a, /* FC_BOGUS_STRUCT */ - 0x3, /* 3 */ -/* 20 */ NdrFcShort( 0x10 ), /* 16 */ -/* 22 */ NdrFcShort( 0x0 ), /* 0 */ -/* 24 */ NdrFcShort( 0x6 ), /* Offset= 6 (30) */ -/* 26 */ 0x6, /* FC_SHORT */ - 0x42, /* FC_STRUCTPAD6 */ -/* 28 */ 0x36, /* FC_POINTER */ - 0x5b, /* FC_END */ -/* 30 */ - 0x14, 0x0, /* FC_FP */ -/* 32 */ NdrFcShort( 0xffea ), /* Offset= -22 (10) */ -/* 34 */ - 0x11, 0x4, /* FC_RP [alloced_on_stack] */ -/* 36 */ NdrFcShort( 0xffee ), /* Offset= -18 (18) */ +/* 28 */ 0x40, /* Corr desc: constant, val=256 */ + 0x0, /* 0 */ +/* 30 */ NdrFcShort( 0x100 ), /* 256 */ +/* 32 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ 0x0 } }; -static void * __RPC_USER -AcmeTesting_malloc_wrapper( size_t _Size ) -{ - return( malloc( _Size ) ); -} - -static void __RPC_USER -AcmeTesting_free_wrapper( void * _p ) -{ - free( _p ); -} - -static const MALLOC_FREE_STRUCT _MallocFreeStruct = -{ - AcmeTesting_malloc_wrapper, - AcmeTesting_free_wrapper -}; - static const unsigned short AcmeTesting_FormatStringOffsetTable[] = { 0, - 48, - 90, - 120 + 36, + 84, + 126, + 156 }; static const MIDL_STUB_DESC AcmeTesting_StubDesc = { (void *)& AcmeTesting___RpcClientInterface, - NdrRpcSmClientAllocate, - NdrRpcSmClientFree, + MIDL_user_allocate, + MIDL_user_free, &AcmeTesting__MIDL_AutoBindHandle, 0, 0, @@ -371,7 +394,7 @@ static const MIDL_STUB_DESC AcmeTesting_StubDesc = AcmeTesting__MIDL_TypeFormatString.Format, 1, /* -error bounds_check flag */ 0x50002, /* Ndr library version */ - (MALLOC_FREE_STRUCT*)&_MallocFreeStruct, + 0, 0x801026c, /* MIDL Version 8.1.620 */ 0, 0, diff --git a/TestRpcClient/TestRpcClient.vcxproj b/TestRpcClient/TestRpcClient.vcxproj index b60cd6d..1c0925c 100644 --- a/TestRpcClient/TestRpcClient.vcxproj +++ b/TestRpcClient/TestRpcClient.vcxproj @@ -1,239 +1,423 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {6ADF3A4B-1E22-41BA-9293-96593E6A45BE} - Win32Proj - TestRpcClient - 8.1 - TestRpcClient - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(POCO_ROOT)\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86 - $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - true - $(POCO_ROOT)\lib64;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64 - $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - - - false - $(POCO_ROOT)\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86 - $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - false - $(POCO_ROOT)\lib64;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64 - $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - - - - Use - Level3 - Disabled - ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;_SCL_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include - /D POCO_STATIC %(AdditionalOptions) - - - Console - true - - - copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" - - - - - Use - Level3 - Disabled - ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;_SCL_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);%(PreprocessorDefinitions) - true - $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include - /D POCO_STATIC %(AdditionalOptions) - - - Console - true - - - copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" - - - - - Level3 - Use - MaxSpeed - true - true - ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;_SCL_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include - /D POCO_STATIC $(MSVC_X86_RELEASE_EINSTSET) %(AdditionalOptions) - NotSet - - - Console - true - true - true - - - copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" - - - - - Level3 - Use - MaxSpeed - true - true - ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;_SCL_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);%(PreprocessorDefinitions) - true - $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include - /D POCO_STATIC $(MSVC_X64_RELEASE_EINSTSET) %(AdditionalOptions) - NotSet - - - Console - true - true - true - - - copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" - - - - - - - - - - - - - - - NotUsing - NotUsing - NotUsing - NotUsing - - - NotUsing - NotUsing - NotUsing - NotUsing - - - NotUsing - NotUsing - NotUsing - NotUsing - - - Create - Create - Create - Create - - - - - - - {ccc4a0a2-15fd-4a6e-ac6c-094aaaaec80b} - - - {c8f6c172-56f2-4e76-b5fa-c3b423b31be8} - - - - - - - - true - true - true - true - - - - - + + + + + Debug_XP + Win32 + + + Debug_XP + x64 + + + Debug + Win32 + + + Release_XP + Win32 + + + Release_XP + x64 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {6ADF3A4B-1E22-41BA-9293-96593E6A45BE} + Win32Proj + TestRpcClient + 8.1 + TestRpcClient + + + + Application + true + v140 + Unicode + + + Application + true + v140_xp + Unicode + + + Application + false + v140 + true + Unicode + + + Application + false + v140_xp + true + Unicode + + + Application + true + v140 + Unicode + + + Application + true + v140_xp + Unicode + + + Application + false + v140 + true + Unicode + + + Application + false + v140_xp + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + $(POCO_ROOT)\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + true + $(POCO_ROOT)\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + true + $(POCO_ROOT)\lib64;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + + + true + $(POCO_ROOT)\lib64;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + + + false + $(POCO_ROOT)\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + false + $(POCO_ROOT)\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + false + $(POCO_ROOT)\lib64;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + + + false + $(POCO_ROOT)\lib64;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + + + + Use + Level3 + Disabled + ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;_SCL_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include + /D POCO_STATIC %(AdditionalOptions) + + + Console + true + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + + + + Use + Level3 + Disabled + ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;_SCL_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include + /D POCO_STATIC %(AdditionalOptions) + + + Console + true + %(AdditionalDependencies) + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + + + + Use + Level3 + Disabled + ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;_SCL_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);%(PreprocessorDefinitions) + true + $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include + /D POCO_STATIC %(AdditionalOptions) + + + Console + true + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + + + + Use + Level3 + Disabled + ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;_SCL_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);%(PreprocessorDefinitions) + true + $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include + /D POCO_STATIC %(AdditionalOptions) + + + Console + true + %(AdditionalDependencies) + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + + + + Level3 + Use + MaxSpeed + true + true + ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;_SCL_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include + /D POCO_STATIC $(MSVC_X86_RELEASE_EINSTSET) %(AdditionalOptions) + NotSet + + + Console + true + true + true + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + + + + Level3 + Use + MaxSpeed + true + true + ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;_SCL_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include + /D POCO_STATIC $(MSVC_X86_RELEASE_EINSTSET) %(AdditionalOptions) + NotSet + + + Console + true + true + true + %(AdditionalDependencies) + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + + + + Level3 + Use + MaxSpeed + true + true + ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;_SCL_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);%(PreprocessorDefinitions) + true + $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include + /D POCO_STATIC $(MSVC_X64_RELEASE_EINSTSET) %(AdditionalOptions) + NotSet + + + Console + true + true + true + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + + + + Level3 + Use + MaxSpeed + true + true + ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;_SCL_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);%(PreprocessorDefinitions) + true + $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include + /D POCO_STATIC $(MSVC_X64_RELEASE_EINSTSET) %(AdditionalOptions) + NotSet + + + Console + true + true + true + %(AdditionalDependencies) + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + + + + + + + + + + + + + + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + + + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + + + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + + + Create + Create + Create + Create + Create + Create + Create + Create + + + + + + + {ccc4a0a2-15fd-4a6e-ac6c-094aaaaec80b} + + + {c8f6c172-56f2-4e76-b5fa-c3b423b31be8} + + + + + + + + true + true + true + true + true + true + true + true + + + + + \ No newline at end of file diff --git a/TestRpcClient/application.config b/TestRpcClient/application.config index 6824023..3c8d952 100644 --- a/TestRpcClient/application.config +++ b/TestRpcClient/application.config @@ -3,9 +3,9 @@ - - - + + + @@ -16,10 +16,10 @@ - - - - + + + + @@ -29,7 +29,21 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TestRpcClient/tests_rpc.cpp b/TestRpcClient/tests_rpc.cpp index eead680..845f62c 100644 --- a/TestRpcClient/tests_rpc.cpp +++ b/TestRpcClient/tests_rpc.cpp @@ -1,6 +1,7 @@ #include "stdafx.h" #include "runtime.h" #include "callstacktracer.h" +#include "configuration.h" #include "rpc_helpers.h" #include "rpc_test_shared.h" @@ -13,13 +14,16 @@ #include #include +#define UNDEF_SPN "RPC SERVER SPN IS UNDEFINED" +#define UNDEF_SRV_LOC "RPC SERVER LOCATION IS UNDEFINED" + // Server Principal Name (normally the FQDN of the user running the RPC server) -const char *spn = "Felipe@MyDomain.local"; +const char *keyForSPN = "testRpcServerPrincipalName"; #if defined SCENARIO_SINGLE_BOX_LOCAL_SEC || defined SCENARIO_SINGLE_BOX_AD_SEC -const char *serverLocation = "CASE"; // localhost +const char *keyForServerLocation = "testRpcServerSingleBox"; // localhost #elif defined SCENARIO_REMOTE_WITH_AD_SEC -const char *serverLocation = "MyVirtualSpare.MyDomain.local"; // FQDN of RPC server +const char *keyForServerLocation = "testRpcServerWithADSec"; // FQDN of RPC server #endif //////////////////////////// @@ -43,28 +47,9 @@ namespace integration_tests using namespace core; using namespace rpc; - void HandleException(); - RPC_STATUS OperateImpl(RPC_BINDING_HANDLE handle, double left, double right, double &result) - { - RpcTryExcept - Operate(handle, left, right, &result); - return RPC_S_OK; - RpcExcept(RpcExceptionFilter(RpcExceptionCode())) - return RpcExceptionCode(); - RpcEndExcept - } + void HandleException(); - RPC_STATUS ChangeCaseImpl(RPC_BINDING_HANDLE handle, const char *text, cstring &output) - { - RpcTryExcept - cstring input = { strlen(text) + 1, (unsigned char *)text }; - ChangeCase(handle, &input, &output); - return RPC_S_OK; - RpcExcept(RpcExceptionFilter(RpcExceptionCode())) - return RpcExceptionCode(); - RpcEndExcept - } /// /// Proxy for AcmeTesting RPC server. @@ -75,36 +60,65 @@ namespace integration_tests using RpcClient::RpcClient; + // RPC Invert + void Invert(pair &onePair) + { + Call("Invert", [&onePair](rpc_binding_handle_t bindHandle) + { + ::Invert(bindHandle, &onePair); + }); + } + + // RPC Operate double Operate(double left, double right) { double result; - auto status = OperateImpl(GetBindingHandle(), left, right, result); - ThrowIfError(status, "Failed to invoke RPC client stub routine \'Operate\'"); + + Call("Operate", [left, right, &result](rpc_binding_handle_t bindHandle) + { + ::Operate(bindHandle, left, right, &result); + }); + return result; } + // RPC ChangeCase string ChangeCase(const char *text) { - /* When the stubs have been generated for OSF compliance - the output string parameter must fulfill the memory allocation - of the buffer carrying the text: - - unsigned char buffer[128]; - cstring output { sizeof buffer, buffer }; */ - cstring output; - auto status = ChangeCaseImpl(GetBindingHandle(), text, output); - ThrowIfError(status, "Failed to invoke RPC client stub routine \'ChangeCase\'"); - return string(output.data, output.data + output.size - 1); + /* When the stubs have been generated for OSF compliance the + output string parameter must fulfill the memory allocation + of the buffer carrying the text: */ + + std::array output; + + Call("ChangeCase", [text, &output](rpc_binding_handle_t bindHandle) + { + ::ChangeCase(bindHandle, (unsigned char *)text, output.data()); + }); + + return string((char *)output.data()); } + // RPC WriteOnStorage void WriteOnStorage() { - ::WriteOnStorage(GetBindingHandle()); + Call("WriteOnStorage", [](rpc_binding_handle_t bindHandle) + { + ::WriteOnStorage(bindHandle); + }); } + // RPC Shutdown uint32_t Shutdown() { - return ::Shutdown(GetBindingHandle()); + uint32_t timeout; + + Call("WriteOnStorage", [&timeout](rpc_binding_handle_t bindHandle) + { + timeout = ::Shutdown(bindHandle); + }); + + return timeout; } }; @@ -117,7 +131,7 @@ namespace integration_tests static void SetUpTestCase() { - system("pause"); // wait until RPC server becomes available + //system("pause"); // wait until RPC server becomes available } }; @@ -138,16 +152,21 @@ namespace integration_tests AcmeRpcClient client1( ProtocolSequence::Local, objectsUuidsImpl1[5], - serverLocation + AppConfig::GetSettings().application.GetString(keyForServerLocation, UNDEF_SRV_LOC) ); + pair expPair = { 2, 1 }; + pair myPair = { 1, 2 }; + client1.Invert(myPair); + EXPECT_TRUE(memcmp(&expPair, &myPair, sizeof myPair) == 0); + EXPECT_EQ(696.0, client1.Operate(6.0, 116.0)); EXPECT_EQ("SQUIRREL", client1.ChangeCase("squirrel")); AcmeRpcClient client2( ProtocolSequence::Local, objectsUuidsImpl2[5], - serverLocation + AppConfig::GetSettings().application.GetString(keyForServerLocation, UNDEF_SRV_LOC) ); EXPECT_EQ(696.0, client2.Operate(606.0, 90.0)); @@ -187,7 +206,7 @@ namespace integration_tests static void SetUpTestCase() { - system("pause"); // wait until RPC server becomes available + //system("pause"); // wait until RPC server becomes available } }; @@ -209,24 +228,29 @@ namespace integration_tests AcmeRpcClient client1( GetParam().protocolSequence, GetParam().objectUUID1, - serverLocation, + AppConfig::GetSettings().application.GetString(keyForServerLocation, UNDEF_SRV_LOC), GetParam().authenticationSecurity, GetParam().authenticationLevel, GetParam().impersonationLevel, - spn // not used for NTLM + AppConfig::GetSettings().application.GetString(keyForSPN, UNDEF_SPN) // not used for NTLM ); + pair expPair = { 2, 1 }; + pair myPair = { 1, 2 }; + client1.Invert(myPair); + EXPECT_TRUE(memcmp(&expPair, &myPair, sizeof myPair) == 0); + EXPECT_EQ(696.0, client1.Operate(6.0, 116.0)); EXPECT_EQ("SQUIRREL", client1.ChangeCase("squirrel")); AcmeRpcClient client2( GetParam().protocolSequence, GetParam().objectUUID2, - serverLocation, + AppConfig::GetSettings().application.GetString(keyForServerLocation, UNDEF_SRV_LOC), GetParam().authenticationSecurity, GetParam().authenticationLevel, GetParam().impersonationLevel, - spn // not used for NTLM + AppConfig::GetSettings().application.GetString(keyForSPN, UNDEF_SPN) // not used for NTLM ); EXPECT_EQ(696.0, client2.Operate(606.0, 90.0)); @@ -288,7 +312,7 @@ namespace integration_tests static void SetUpTestCase() { - system("pause"); // wait until RPC server becomes available + //system("pause"); // wait until RPC server becomes available } }; @@ -316,17 +340,22 @@ namespace integration_tests AcmeRpcClient client1( GetParam().objectUUID1, - serverLocation, + AppConfig::GetSettings().application.GetString(keyForServerLocation, UNDEF_SRV_LOC), certInfo, GetParam().authenticationLevel ); + pair expPair = { 2, 1 }; + pair myPair = { 1, 2 }; + client1.Invert(myPair); + EXPECT_TRUE(memcmp(&expPair, &myPair, sizeof myPair) == 0); + EXPECT_EQ(696.0, client1.Operate(6.0, 116.0)); EXPECT_EQ("SQUIRREL", client1.ChangeCase("squirrel")); AcmeRpcClient client2( GetParam().objectUUID2, - serverLocation, + AppConfig::GetSettings().application.GetString(keyForServerLocation, UNDEF_SRV_LOC), certInfo, GetParam().authenticationLevel ); diff --git a/TestShared/AcmeTesting.idl b/TestShared/AcmeTesting.idl index 603f22b..d6f57cc 100644 --- a/TestShared/AcmeTesting.idl +++ b/TestShared/AcmeTesting.idl @@ -4,15 +4,19 @@ ] interface AcmeTesting { - void Operate([in] double left, [in] double right, [out] double *result); + #define STRBUFSIZE 256 - typedef struct + typedef struct pair { - unsigned short size; - [string, size_is(size)] char *data; - } cstring; + int left; + int right; + } pair; + + void Invert([in, out] pair *onePair); + + void Operate([in] double left, [in] double right, [out] double *result); - void ChangeCase([in] cstring *input, [out] cstring *output); + void ChangeCase([in, string] char *input, [out, string, size_is(STRBUFSIZE)] char *output); void WriteOnStorage(void); diff --git a/TestShared/calculator.wsdl b/TestShared/calculator.wsdl index 16a0672..5b8b43b 100644 --- a/TestShared/calculator.wsdl +++ b/TestShared/calculator.wsdl @@ -73,14 +73,14 @@ - + - + - + diff --git a/TestWwsClient/TestWwsClient.vcxproj b/TestWwsClient/TestWwsClient.vcxproj index 019fc35..17780a9 100644 --- a/TestWwsClient/TestWwsClient.vcxproj +++ b/TestWwsClient/TestWwsClient.vcxproj @@ -1,216 +1,388 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {4913E097-136E-4BC4-BF8C-D3341FB1425A} - Win32Proj - TestWwsClient - 8.1 - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(VC_IncludePath);$(IncludePath) - $(POCO_ROOT)\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - true - $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(VC_IncludePath);$(IncludePath) - $(POCO_ROOT)\lib64;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) - - - false - $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(VC_IncludePath);$(IncludePath) - $(POCO_ROOT)\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - false - $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(VC_IncludePath);$(IncludePath) - $(POCO_ROOT)\lib64;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include - /D POCO_STATIC %(AdditionalOptions) - - - Console - true - - - copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" - - - - - Use - Level3 - Disabled - ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;_SCL_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);%(PreprocessorDefinitions) - true - $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include - /D POCO_STATIC %(AdditionalOptions) - - - Console - true - - - copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include - /D POCO_STATIC $(MSVC_X86_RELEASE_EINSTSET) %(AdditionalOptions) - NotSet - - - Console - true - true - true - - - copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" - - - - - Level3 - Use - MaxSpeed - true - true - ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;_SCL_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);%(PreprocessorDefinitions) - true - $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include - /D POCO_STATIC $(MSVC_X64_RELEASE_EINSTSET) %(AdditionalOptions) - NotSet - - - Console - true - true - true - - - copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" - - - - - - - - - - - - - NotUsing - NotUsing - NotUsing - NotUsing - - - Create - Create - Create - Create - - - - - - - - - - {ccc4a0a2-15fd-4a6e-ac6c-094aaaaec80b} - - - {c8f6c172-56f2-4e76-b5fa-c3b423b31be8} - - - - - + + + + + Debug_XP + Win32 + + + Debug_XP + x64 + + + Debug + Win32 + + + Release_XP + Win32 + + + Release_XP + x64 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {4913E097-136E-4BC4-BF8C-D3341FB1425A} + Win32Proj + TestWwsClient + 8.1 + + + + Application + true + v140 + Unicode + + + Application + true + v140_xp + Unicode + + + Application + false + v140 + true + Unicode + + + Application + false + v140_xp + true + Unicode + + + Application + true + v140 + Unicode + + + Application + true + v140_xp + Unicode + + + Application + false + v140 + true + Unicode + + + Application + false + v140_xp + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + $(POCO_ROOT)\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + true + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + $(POCO_ROOT)\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + true + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + $(POCO_ROOT)\lib64;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) + + + true + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + $(POCO_ROOT)\lib64;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) + + + false + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + $(POCO_ROOT)\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + false + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + $(POCO_ROOT)\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + false + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + $(POCO_ROOT)\lib64;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) + + + false + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + $(POCO_ROOT)\lib64;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include + /D POCO_STATIC %(AdditionalOptions) + + + Console + true + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include + /D POCO_STATIC %(AdditionalOptions) + + + Console + true + %(AdditionalDependencies) + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + + + + Use + Level3 + Disabled + ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;_SCL_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);%(PreprocessorDefinitions) + true + $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include + /D POCO_STATIC %(AdditionalOptions) + + + Console + true + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + + + + Use + Level3 + Disabled + ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;_SCL_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);%(PreprocessorDefinitions) + true + $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include + /D POCO_STATIC %(AdditionalOptions) + + + Console + true + %(AdditionalDependencies) + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include + /D POCO_STATIC $(MSVC_X86_RELEASE_EINSTSET) %(AdditionalOptions) + NotSet + + + Console + true + true + true + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include + /D POCO_STATIC $(MSVC_X86_RELEASE_EINSTSET) %(AdditionalOptions) + NotSet + + + Console + true + true + true + %(AdditionalDependencies) + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + + + + Level3 + Use + MaxSpeed + true + true + ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;_SCL_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);%(PreprocessorDefinitions) + true + $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include + /D POCO_STATIC $(MSVC_X64_RELEASE_EINSTSET) %(AdditionalOptions) + NotSet + + + Console + true + true + true + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + + + + Level3 + Use + MaxSpeed + true + true + ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;_SCL_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);%(PreprocessorDefinitions) + true + $(SolutionDir)3FD;$(SolutionDir)TestShared;$(SolutionDir)gtest\include + /D POCO_STATIC $(MSVC_X64_RELEASE_EINSTSET) %(AdditionalOptions) + NotSet + + + Console + true + true + true + %(AdditionalDependencies) + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + + + + + + + + + + + + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + + + Create + Create + Create + Create + Create + Create + Create + Create + + + + + + + + + + {ccc4a0a2-15fd-4a6e-ac6c-094aaaaec80b} + + + {c8f6c172-56f2-4e76-b5fa-c3b423b31be8} + + + + + \ No newline at end of file diff --git a/TestWwsClient/application.config b/TestWwsClient/application.config index 63c22ae..d067b79 100644 --- a/TestWwsClient/application.config +++ b/TestWwsClient/application.config @@ -1,35 +1,56 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TestWwsClient/calculator.wsdl.c b/TestWwsClient/calculator.wsdl.c index 8cfea7b..d3cbacb 100644 --- a/TestWwsClient/calculator.wsdl.c +++ b/TestWwsClient/calculator.wsdl.c @@ -8,11 +8,11 @@ typedef struct _calculator_wsdlLocalDefinitions struct // global types { char unused; - struct // MultipurposeSingleIntegerResponse + struct // MultipurposeBooleanResponse { WS_FIELD_DESCRIPTION result; - WS_FIELD_DESCRIPTION* MultipurposeSingleIntegerResponseFields [1]; - } MultipurposeSingleIntegerResponsedescs; // end of MultipurposeSingleIntegerResponse + WS_FIELD_DESCRIPTION* MultipurposeBooleanResponseFields [1]; + } MultipurposeBooleanResponsedescs; // end of MultipurposeBooleanResponse struct // BinaryOpRequest { WS_FIELD_DESCRIPTION first; @@ -136,8 +136,8 @@ typedef struct _calculator_wsdlLocalDefinitions { WS_XML_STRING EmptyRequestTypeName; // EmptyRequest WS_XML_STRING EmptyRequestTypeNamespace; // http://calculator.example.org/ - WS_XML_STRING MultipurposeSingleIntegerResponseTypeName; // MultipurposeSingleIntegerResponse - WS_XML_STRING MultipurposeSingleIntegerResponseresultLocalName; // result + WS_XML_STRING MultipurposeBooleanResponseTypeName; // MultipurposeBooleanResponse + WS_XML_STRING MultipurposeBooleanResponseresultLocalName; // result WS_XML_STRING BinaryOpRequestTypeName; // BinaryOpRequest WS_XML_STRING BinaryOpRequestfirstLocalName; // first WS_XML_STRING BinaryOpRequestsecondLocalName; // second @@ -173,7 +173,7 @@ typedef struct CalcBindingHeaderAuthSSL_MultiplyParamStruct typedef struct CalcBindingHeaderAuthSSL_CloseServiceParamStruct { - __int64* result; + BOOL* result; } CalcBindingHeaderAuthSSL_CloseServiceParamStruct; typedef struct CalcBindingSSL_AddParamStruct @@ -192,7 +192,7 @@ typedef struct CalcBindingSSL_MultiplyParamStruct typedef struct CalcBindingSSL_CloseServiceParamStruct { - __int64* result; + BOOL* result; } CalcBindingSSL_CloseServiceParamStruct; typedef struct CalcBindingUnsecure_AddParamStruct @@ -211,28 +211,28 @@ typedef struct CalcBindingUnsecure_MultiplyParamStruct typedef struct CalcBindingUnsecure_CloseServiceParamStruct { - __int64* result; + BOOL* result; } CalcBindingUnsecure_CloseServiceParamStruct; const static _calculator_wsdlLocalDefinitions calculator_wsdlLocalDefinitions = { { // global types 0, - { // MultipurposeSingleIntegerResponse + { // MultipurposeBooleanResponse { // field description for result WS_ELEMENT_FIELD_MAPPING, - (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.MultipurposeSingleIntegerResponseresultLocalName, // result + (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.MultipurposeBooleanResponseresultLocalName, // result (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.EmptyRequestTypeNamespace, // http://calculator.example.org/ - WS_INT64_TYPE, + WS_BOOL_TYPE, 0, - WsOffsetOf(MultipurposeSingleIntegerResponse, result), + WsOffsetOf(MultipurposeBooleanResponse, result), 0, 0, 0xffffffff }, // end of field description for result - { // fields description for MultipurposeSingleIntegerResponse - (WS_FIELD_DESCRIPTION*)&calculator_wsdlLocalDefinitions.globalTypes.MultipurposeSingleIntegerResponsedescs.result, + { // fields description for MultipurposeBooleanResponse + (WS_FIELD_DESCRIPTION*)&calculator_wsdlLocalDefinitions.globalTypes.MultipurposeBooleanResponsedescs.result, }, - }, // MultipurposeSingleIntegerResponse + }, // MultipurposeBooleanResponse { // BinaryOpRequest { // field description for first WS_ELEMENT_FIELD_MAPPING, @@ -264,7 +264,7 @@ const static _calculator_wsdlLocalDefinitions calculator_wsdlLocalDefinitions = { // OperationResponse { // field description for result WS_ELEMENT_FIELD_MAPPING, - (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.MultipurposeSingleIntegerResponseresultLocalName, // result + (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.MultipurposeBooleanResponseresultLocalName, // result (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.EmptyRequestTypeNamespace, // http://calculator.example.org/ WS_DOUBLE_TYPE, 0, @@ -593,7 +593,7 @@ const static _calculator_wsdlLocalDefinitions calculator_wsdlLocalDefinitions = { // xmlStrings WS_XML_STRING_DICTIONARY_VALUE("EmptyRequest",&calculator_wsdlLocalDefinitions.dictionary.dict, 0), WS_XML_STRING_DICTIONARY_VALUE("http://calculator.example.org/",&calculator_wsdlLocalDefinitions.dictionary.dict, 1), - WS_XML_STRING_DICTIONARY_VALUE("MultipurposeSingleIntegerResponse",&calculator_wsdlLocalDefinitions.dictionary.dict, 2), + WS_XML_STRING_DICTIONARY_VALUE("MultipurposeBooleanResponse",&calculator_wsdlLocalDefinitions.dictionary.dict, 2), WS_XML_STRING_DICTIONARY_VALUE("result",&calculator_wsdlLocalDefinitions.dictionary.dict, 3), WS_XML_STRING_DICTIONARY_VALUE("BinaryOpRequest",&calculator_wsdlLocalDefinitions.dictionary.dict, 4), WS_XML_STRING_DICTIONARY_VALUE("first",&calculator_wsdlLocalDefinitions.dictionary.dict, 5), @@ -681,7 +681,7 @@ HRESULT WINAPI CalcBindingHeaderAuthSSL_Multiply( // operation: CalcBindingHeaderAuthSSL_CloseService HRESULT WINAPI CalcBindingHeaderAuthSSL_CloseService( _In_ WS_SERVICE_PROXY* _serviceProxy, - _Out_ __int64* result, + _Out_ BOOL* result, _In_ WS_HEAP* _heap, _In_reads_opt_(_callPropertyCount) const WS_CALL_PROPERTY* _callProperties, _In_ const ULONG _callPropertyCount, @@ -755,7 +755,7 @@ HRESULT WINAPI CalcBindingSSL_Multiply( // operation: CalcBindingSSL_CloseService HRESULT WINAPI CalcBindingSSL_CloseService( _In_ WS_SERVICE_PROXY* _serviceProxy, - _Out_ __int64* result, + _Out_ BOOL* result, _In_ WS_HEAP* _heap, _In_reads_opt_(_callPropertyCount) const WS_CALL_PROPERTY* _callProperties, _In_ const ULONG _callPropertyCount, @@ -829,7 +829,7 @@ HRESULT WINAPI CalcBindingUnsecure_Multiply( // operation: CalcBindingUnsecure_CloseService HRESULT WINAPI CalcBindingUnsecure_CloseService( _In_ WS_SERVICE_PROXY* _serviceProxy, - _Out_ __int64* result, + _Out_ BOOL* result, _In_ WS_HEAP* _heap, _In_reads_opt_(_callPropertyCount) const WS_CALL_PROPERTY* _callProperties, _In_ const ULONG _callPropertyCount, @@ -866,16 +866,16 @@ const _calculator_wsdl calculator_wsdl = 0, }, // end of struct description for EmptyRequest { - sizeof(MultipurposeSingleIntegerResponse), - __alignof(MultipurposeSingleIntegerResponse), - (WS_FIELD_DESCRIPTION**)&calculator_wsdlLocalDefinitions.globalTypes.MultipurposeSingleIntegerResponsedescs.MultipurposeSingleIntegerResponseFields, - WsCountOf(calculator_wsdlLocalDefinitions.globalTypes.MultipurposeSingleIntegerResponsedescs.MultipurposeSingleIntegerResponseFields), - (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.MultipurposeSingleIntegerResponseTypeName, // MultipurposeSingleIntegerResponse + sizeof(MultipurposeBooleanResponse), + __alignof(MultipurposeBooleanResponse), + (WS_FIELD_DESCRIPTION**)&calculator_wsdlLocalDefinitions.globalTypes.MultipurposeBooleanResponsedescs.MultipurposeBooleanResponseFields, + WsCountOf(calculator_wsdlLocalDefinitions.globalTypes.MultipurposeBooleanResponsedescs.MultipurposeBooleanResponseFields), + (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.MultipurposeBooleanResponseTypeName, // MultipurposeBooleanResponse (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.EmptyRequestTypeNamespace, // http://calculator.example.org/ 0, 0, 0, - }, // end of struct description for MultipurposeSingleIntegerResponse + }, // end of struct description for MultipurposeBooleanResponse { sizeof(BinaryOpRequest), __alignof(BinaryOpRequest), @@ -910,7 +910,7 @@ const _calculator_wsdl calculator_wsdl = (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.CloseServiceResponseTypeName, // CloseServiceResponse (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.EmptyRequestTypeNamespace, // http://calculator.example.org/ WS_STRUCT_TYPE, - (void*)&calculator_wsdl.globalTypes.MultipurposeSingleIntegerResponse, + (void*)&calculator_wsdl.globalTypes.MultipurposeBooleanResponse, }, { (WS_XML_STRING*)&calculator_wsdlLocalDefinitions.dictionary.xmlStrings.AdditionRequestTypeName, // AdditionRequest diff --git a/TestWwsClient/calculator.wsdl.h b/TestWwsClient/calculator.wsdl.h index 85122b4..c2f896e 100644 --- a/TestWwsClient/calculator.wsdl.h +++ b/TestWwsClient/calculator.wsdl.h @@ -162,11 +162,11 @@ extern "C" { // The following types were generated: // struct EmptyRequest; -// struct MultipurposeSingleIntegerResponse; +// struct MultipurposeBooleanResponse; // struct BinaryOpRequest; // struct OperationResponse; // struct EmptyRequest; -// struct MultipurposeSingleIntegerResponse; +// struct MultipurposeBooleanResponse; // struct BinaryOpRequest; // struct OperationResponse; // struct BinaryOpRequest; @@ -188,11 +188,11 @@ extern "C" { typedef struct EmptyRequest EmptyRequest; -// typeDescription: calculator_wsdl.globalTypes.MultipurposeSingleIntegerResponse -typedef struct MultipurposeSingleIntegerResponse +// typeDescription: calculator_wsdl.globalTypes.MultipurposeBooleanResponse +typedef struct MultipurposeBooleanResponse { - __int64 result; -} MultipurposeSingleIntegerResponse; + BOOL result; +} MultipurposeBooleanResponse; // typeDescription: calculator_wsdl.globalTypes.BinaryOpRequest typedef struct BinaryOpRequest @@ -258,7 +258,7 @@ HRESULT WINAPI CalcBindingHeaderAuthSSL_Multiply( // operation: CalcBindingHeaderAuthSSL_CloseService HRESULT WINAPI CalcBindingHeaderAuthSSL_CloseService( _In_ WS_SERVICE_PROXY* _serviceProxy, - _Out_ __int64* result, + _Out_ BOOL* result, _In_ WS_HEAP* _heap, _In_reads_opt_(_callPropertyCount) const WS_CALL_PROPERTY* _callProperties, _In_ const ULONG _callPropertyCount, @@ -314,7 +314,7 @@ HRESULT WINAPI CalcBindingSSL_Multiply( // operation: CalcBindingSSL_CloseService HRESULT WINAPI CalcBindingSSL_CloseService( _In_ WS_SERVICE_PROXY* _serviceProxy, - _Out_ __int64* result, + _Out_ BOOL* result, _In_ WS_HEAP* _heap, _In_reads_opt_(_callPropertyCount) const WS_CALL_PROPERTY* _callProperties, _In_ const ULONG _callPropertyCount, @@ -368,7 +368,7 @@ HRESULT WINAPI CalcBindingUnsecure_Multiply( // operation: CalcBindingUnsecure_CloseService HRESULT WINAPI CalcBindingUnsecure_CloseService( _In_ WS_SERVICE_PROXY* _serviceProxy, - _Out_ __int64* result, + _Out_ BOOL* result, _In_ WS_HEAP* _heap, _In_reads_opt_(_callPropertyCount) const WS_CALL_PROPERTY* _callProperties, _In_ const ULONG _callPropertyCount, @@ -389,11 +389,11 @@ typedef struct _calculator_wsdl // typeDescription: calculator_wsdl.globalTypes.EmptyRequest WS_STRUCT_DESCRIPTION EmptyRequest; - // xml type: MultipurposeSingleIntegerResponse ("http://calculator.example.org/") - // c type: MultipurposeSingleIntegerResponse + // xml type: MultipurposeBooleanResponse ("http://calculator.example.org/") + // c type: MultipurposeBooleanResponse // WS_TYPE: WS_STRUCT_TYPE - // typeDescription: calculator_wsdl.globalTypes.MultipurposeSingleIntegerResponse - WS_STRUCT_DESCRIPTION MultipurposeSingleIntegerResponse; + // typeDescription: calculator_wsdl.globalTypes.MultipurposeBooleanResponse + WS_STRUCT_DESCRIPTION MultipurposeBooleanResponse; // xml type: BinaryOpRequest ("http://calculator.example.org/") // c type: BinaryOpRequest @@ -416,7 +416,7 @@ typedef struct _calculator_wsdl WS_ELEMENT_DESCRIPTION CloseServiceRequest; // xml element: CloseServiceResponse ("http://calculator.example.org/") - // c type: MultipurposeSingleIntegerResponse + // c type: MultipurposeBooleanResponse // elementDescription: calculator_wsdl.globalElements.CloseServiceResponse WS_ELEMENT_DESCRIPTION CloseServiceResponse; @@ -474,7 +474,7 @@ typedef struct _calculator_wsdl WS_MESSAGE_DESCRIPTION CloseServiceRequestMessage; // message: CloseServiceResponseMessage - // c type: MultipurposeSingleIntegerResponse + // c type: MultipurposeBooleanResponse // action: "" // messageDescription: calculator_wsdl.messages.CloseServiceResponseMessage WS_MESSAGE_DESCRIPTION CloseServiceResponseMessage; diff --git a/TestWwsClient/tests_wws.cpp b/TestWwsClient/tests_wws.cpp index ecb80db..0b4c9b6 100644 --- a/TestWwsClient/tests_wws.cpp +++ b/TestWwsClient/tests_wws.cpp @@ -1,11 +1,17 @@ #include "stdafx.h" #include "runtime.h" +#include "configuration.h" #include "web_wws_webserviceproxy.h" #include "calculator.wsdl.h" #include #include +#define UNDEF_HOST_UNSEC "WEB SERVICE HOST UNSECURE ENDPOINT IS NOT DEFINED" +#define UNDEF_HOST_SSL "WEB SERVICE HOST SSL ENDPOINT IS NOT DEFINED" +#define UNDEF_CLIENT_CERT "WEB SERVICE CLIENT SIDE CERTIFICATE THUMBPRINT IS UNDEFINED" +#define UNDEF_HOST_SSL_HAUTH "WEB SERVICE HOST SSL WITH HEADER AUTHORIZATION ENDPOINT IS NOT DEFINED" + namespace _3fd { namespace integration_tests @@ -30,7 +36,7 @@ namespace integration_tests CalcSvcProxyUnsecure(const SvcProxyConfig &config) : WebServiceProxy( - "http://CASE:81/calculator", + AppConfig::GetSettings().application.GetString("testWwsHostUnsecEndpoint", UNDEF_HOST_UNSEC), config, &CreateWSProxy ) @@ -42,24 +48,22 @@ namespace integration_tests CALL_STACK_TRACE; double result; - WSHeap heap(proxyOperHeapSize); - WSError err; - HRESULT hr; - - hr = CalcBindingUnsecure_Add( - GetHandle(), - first, - second, - &result, - heap.GetHandle(), - nullptr, 0, - nullptr, - err.GetHandle() - ); - err.RaiseExClientNotOK(hr, "Calculator web service returned an error", heap); + Call("Calculator web service operation 'Add'", + proxyOperHeapSize, + [=,&result](WS_SERVICE_PROXY *wsProxyHandle, WS_HEAP *wsHeapHandle, WS_ERROR *wsErrorHandle) + { + return CalcBindingUnsecure_Add(wsProxyHandle, + first, + second, + &result, + wsHeapHandle, + nullptr, 0, + nullptr, + wsErrorHandle); + }); - return result; + return result; } // Synchronous 'Multiply' operation @@ -67,94 +71,73 @@ namespace integration_tests { CALL_STACK_TRACE; - double result; - WSHeap heap(proxyOperHeapSize); - WSError err; - HRESULT hr; - - hr = CalcBindingUnsecure_Multiply( - GetHandle(), - first, - second, - &result, - heap.GetHandle(), - nullptr, 0, - nullptr, - err.GetHandle() - ); + double result; - err.RaiseExClientNotOK(hr, "Calculator web service returned an error", heap); + Call("Calculator web service operation 'Multiply'", + proxyOperHeapSize, + [=, &result](WS_SERVICE_PROXY *wsProxyHandle, WS_HEAP *wsHeapHandle, WS_ERROR *wsErrorHandle) + { + return CalcBindingUnsecure_Multiply(wsProxyHandle, + first, + second, + &result, + wsHeapHandle, + nullptr, 0, + nullptr, + wsErrorHandle); + }); - return result; + return result; } // Asynchronous 'Multiply' operation - WSAsyncOper MultiplyAsync(double first, double second, double &result) + std::future MultiplyAsync(double first, double second, double &result) { CALL_STACK_TRACE; - // Prepare for an asynchronous operation: - auto asyncOp = CreateAsyncOperation(proxyOperHeapSize); - auto asyncContext = asyncOp.GetContext(); - - HRESULT hr = // this immediately returns an HRESULT code - CalcBindingUnsecure_Multiply( - GetHandle(), - first, - second, - &result, - asyncOp.GetHeapHandle(), - nullptr, 0, - &asyncContext, // this parameter asks for an asynchronous call - asyncOp.GetErrHelperHandle() - ); - - asyncOp.SetCallReturn(hr); - return std::move(asyncOp); + return CallAsync("Calculator web service operation 'Multiply'", + proxyOperHeapSize, + [=, &result](WS_SERVICE_PROXY *wsProxyHandle, WS_HEAP *wsHeapHandle, WS_ERROR *wsErrorHandle) + { + return CalcBindingUnsecure_Multiply(wsProxyHandle, + first, + second, + &result, + wsHeapHandle, + nullptr, 0, + nullptr, + wsErrorHandle); + }); } // 'CloseService' operation - uint32_t CloseHostService() + bool CloseHostService() { CALL_STACK_TRACE; - int64_t result; - WSHeap heap(proxyOperHeapSize); - WSError err; - HRESULT hr; - - hr = CalcBindingUnsecure_CloseService( - GetHandle(), - &result, - heap.GetHandle(), - nullptr, 0, - nullptr, - err.GetHandle() - ); - - err.RaiseExClientNotOK(hr, "Calculator web service returned an error", heap); - - return static_cast (result); + BOOL result; + + Call("Calculator web service operation 'CloseService'", + proxyOperHeapSize, + [&result](WS_SERVICE_PROXY *wsProxyHandle, WS_HEAP *wsHeapHandle, WS_ERROR *wsErrorHandle) + { + return CalcBindingUnsecure_CloseService(wsProxyHandle, + &result, + wsHeapHandle, + nullptr, 0, + nullptr, + wsErrorHandle); + }); + + return (result == TRUE); } }; - /// - /// Test case for WWS module. - /// - class Framework_WWS_TestCase : public ::testing::Test - { - public: - - static void SetUpTestCase() - { - system("pause"); // wait until web service host becomes available - } - }; /// /// Tests synchronous web service access without transport security. /// - TEST_F(Framework_WWS_TestCase, Proxy_TransportUnsecure_SyncTest) + TEST(Framework_WWS_TestCase, Proxy_TransportUnsecure_SyncTest) { // Ensures proper initialization/finalization of the framework _3fd::core::FrameworkInstance _framework; @@ -174,14 +157,8 @@ namespace integration_tests EXPECT_EQ(666.0, client.Multiply(111.0, 6.0)); } - /* Request the host to close the service. The host will respond - with the max expected duration (in ms) for that to complete and - the same be again available for the next test: */ - - auto timeout = client.CloseHostService(); + EXPECT_TRUE(client.CloseHostService()); client.Close(); - - std::this_thread::sleep_for(std::chrono::milliseconds(timeout)); } catch (...) { @@ -189,10 +166,11 @@ namespace integration_tests } } + /// /// Tests asynchronous web service access without transport security. /// - TEST_F(Framework_WWS_TestCase, Proxy_TransportUnsecure_AsyncTest) + TEST(Framework_WWS_TestCase, Proxy_TransportUnsecure_AsyncTest) { // Ensures proper initialization/finalization of the framework _3fd::core::FrameworkInstance _framework; @@ -209,16 +187,12 @@ namespace integration_tests const int maxAsyncCalls = 5; std::vector results(maxAsyncCalls); - std::vector asyncOps; + std::vector> asyncOps; asyncOps.reserve(maxAsyncCalls); // Fire the asynchronous requests: for (int idx = 0; idx < maxAsyncCalls; ++idx) { - /* wait a little before making the request, otherwise - the server could refuse them while it is busy */ - std::this_thread::sleep_for(std::chrono::milliseconds(50)); - asyncOps.push_back( client.MultiplyAsync(111.0, 6.0, results[idx]) ); @@ -227,23 +201,15 @@ namespace integration_tests // Get the results and check for errors: while (!asyncOps.empty()) { - asyncOps.back() - .RaiseExClientNotOK("Calculator web service returned an error"); - + asyncOps.back().get(); asyncOps.pop_back(); EXPECT_EQ(666.0, results.back()); results.pop_back(); } - /* Request the host to close the service. The host will respond - with the max expected duration (in ms) for that to complete and - the same be again available for the next test: */ - - auto timeout = client.CloseHostService(); + EXPECT_TRUE(client.CloseHostService()); client.Close(); - - std::this_thread::sleep_for(std::chrono::milliseconds(timeout)); } catch (...) { @@ -251,6 +217,7 @@ namespace integration_tests } } + //////////////////////////////// // Proxy with SSL over HTTP //////////////////////////////// @@ -265,7 +232,7 @@ namespace integration_tests // Ctor for proxy without client certificate CalcSvcProxySSL(const SvcProxyConfig &config) : WebServiceProxy( - "https://CASE:8989/calculator", + AppConfig::GetSettings().application.GetString("testWwsHostSslEndpoint", UNDEF_HOST_SSL), config, &CreateWSProxy ) @@ -274,121 +241,112 @@ namespace integration_tests // Ctor for proxy using a client certificate CalcSvcProxySSL(const SvcProxyConfig &config, const SvcProxyCertInfo &certInfo) : WebServiceProxy( - "https://CASE:8989/calculator", + AppConfig::GetSettings().application.GetString("testWwsHostSslEndpoint", UNDEF_HOST_SSL), config, certInfo, CalcBindingSSL_CreateServiceProxy ) {} + // Synchronous 'Add' operation double Add(double first, double second) { CALL_STACK_TRACE; - double result; - WSHeap heap(proxyOperHeapSize); - WSError err; - HRESULT hr; - - hr = CalcBindingSSL_Add( - GetHandle(), - first, - second, - &result, - heap.GetHandle(), - nullptr, 0, - nullptr, - err.GetHandle() - ); + double result; - err.RaiseExClientNotOK(hr, "Calculator web service returned an error", heap); + Call("Calculator web service operation 'Add'", + proxyOperHeapSize, + [=, &result](WS_SERVICE_PROXY *wsProxyHandle, WS_HEAP *wsHeapHandle, WS_ERROR *wsErrorHandle) + { + return CalcBindingSSL_Add(wsProxyHandle, + first, + second, + &result, + wsHeapHandle, + nullptr, 0, + nullptr, + wsErrorHandle); + }); - return result; + return result; } + // Synchronous 'Multiply' operation double Multiply(double first, double second) { CALL_STACK_TRACE; - double result; - WSHeap heap(proxyOperHeapSize); - WSError err; - HRESULT hr; - - hr = CalcBindingSSL_Multiply( - GetHandle(), - first, - second, - &result, - heap.GetHandle(), - nullptr, 0, - nullptr, - err.GetHandle() - ); + double result; - err.RaiseExClientNotOK(hr, "Calculator web service returned an error", heap); + Call("Calculator web service operation 'Multiply'", + proxyOperHeapSize, + [=, &result](WS_SERVICE_PROXY *wsProxyHandle, WS_HEAP *wsHeapHandle, WS_ERROR *wsErrorHandle) + { + return CalcBindingSSL_Multiply(wsProxyHandle, + first, + second, + &result, + wsHeapHandle, + nullptr, 0, + nullptr, + wsErrorHandle); + }); - return result; + return result; } // Asynchronous 'Multiply' operation - WSAsyncOper MultiplyAsync(double first, double second, double &result) + std::future MultiplyAsync(double first, double second, double &result) { CALL_STACK_TRACE; - // Prepare for an asynchronous operation: - auto asyncOp = CreateAsyncOperation(proxyOperHeapSize); - auto asyncContext = asyncOp.GetContext(); - - HRESULT hr = // this immediately returns an HRESULT code - CalcBindingSSL_Multiply( - GetHandle(), - first, - second, - &result, - asyncOp.GetHeapHandle(), - nullptr, 0, - &asyncContext, // this parameter asks for an asynchronous call - asyncOp.GetErrHelperHandle() - ); - - asyncOp.SetCallReturn(hr); - return std::move(asyncOp); + return CallAsync("Calculator web service operation 'Multiply'", + proxyOperHeapSize, + [=, &result](WS_SERVICE_PROXY *wsProxyHandle, WS_HEAP *wsHeapHandle, WS_ERROR *wsErrorHandle) + { + return CalcBindingSSL_Multiply(wsProxyHandle, + first, + second, + &result, + wsHeapHandle, + nullptr, 0, + nullptr, + wsErrorHandle); + }); } - // 'CloseService' operation - uint32_t CloseHostService() + // Synchronous 'CloseService' operation + bool CloseHostService() { CALL_STACK_TRACE; - int64_t result; - WSHeap heap(proxyOperHeapSize); - WSError err; - HRESULT hr; - - hr = CalcBindingSSL_CloseService( - GetHandle(), - &result, - heap.GetHandle(), - nullptr, 0, - nullptr, - err.GetHandle() - ); - - err.RaiseExClientNotOK(hr, "Calculator web service returned an error", heap); - - return result; + BOOL result; + + Call("Calculator web service operation 'CloseService'", + proxyOperHeapSize, + [&result](WS_SERVICE_PROXY *wsProxyHandle, WS_HEAP *wsHeapHandle, WS_ERROR *wsErrorHandle) + { + return CalcBindingSSL_CloseService(wsProxyHandle, + &result, + wsHeapHandle, + nullptr, 0, + nullptr, + wsErrorHandle); + }); + + return (result == TRUE); } }; // Thumbprint of client side certificate for transport security - const char *clientCertificateThumbprint("da834158826f2207f9a1bbcce8fed201ad391376"); + const char *keyForCliCertThumbprint("testWwsCliCertThumbprint"); /// /// Tests synchronous web service access /// with SSL over HTTP and no client certificate. /// - TEST_F(Framework_WWS_TestCase, Proxy_TransportSSL_NoClientCert_SyncTest) + TEST(Framework_WWS_TestCase, Proxy_TransportSSL_NoClientCert_SyncTest) { // Ensures proper initialization/finalization of the framework _3fd::core::FrameworkInstance _framework; @@ -408,14 +366,8 @@ namespace integration_tests EXPECT_EQ(666.0, client.Multiply(111.0, 6.0)); } - /* Request the host to close the service. The host will respond - with the max expected duration (in ms) for that to complete and - the same be again available for the next test: */ - - auto timeout = client.CloseHostService(); + EXPECT_TRUE(client.CloseHostService()); client.Close(); - - std::this_thread::sleep_for(std::chrono::milliseconds(timeout)); } catch (...) { @@ -427,7 +379,7 @@ namespace integration_tests /// Tests asynchronous web service access with /// SSL over HTTP and no client certificate. /// - TEST_F(Framework_WWS_TestCase, Proxy_TransportSSL_NoClientCert_AsyncTest) + TEST(Framework_WWS_TestCase, Proxy_TransportSSL_NoClientCert_AsyncTest) { // Ensures proper initialization/finalization of the framework _3fd::core::FrameworkInstance _framework; @@ -444,16 +396,12 @@ namespace integration_tests const int maxAsyncCalls = 5; std::vector results(maxAsyncCalls); - std::vector asyncOps; + std::vector> asyncOps; asyncOps.reserve(maxAsyncCalls); // Fire the asynchronous requests: for (int idx = 0; idx < maxAsyncCalls; ++idx) { - /* wait a little before making the request, otherwise - the server could refuse them while it is busy */ - std::this_thread::sleep_for(std::chrono::milliseconds(50)); - asyncOps.push_back( client.MultiplyAsync(111.0, 6.0, results[idx]) ); @@ -462,23 +410,15 @@ namespace integration_tests // Get the results and check for errors: while (!asyncOps.empty()) { - asyncOps.back() - .RaiseExClientNotOK("Calculator web service returned an error"); - + asyncOps.back().get(); asyncOps.pop_back(); EXPECT_EQ(666.0, results.back()); results.pop_back(); } - /* Request the host to close the service. The host will respond - with the max expected duration (in ms) for that to complete and - the same be again available for the next test: */ - - auto timeout = client.CloseHostService(); + EXPECT_TRUE(client.CloseHostService()); client.Close(); - - std::this_thread::sleep_for(std::chrono::milliseconds(timeout)); } catch (...) { @@ -490,7 +430,7 @@ namespace integration_tests /// Tests synchronous web service access, with /// SSL over HTTP and a client certificate. /// - TEST_F(Framework_WWS_TestCase, Proxy_TransportSSL_WithClientCert_SyncTest) + TEST(Framework_WWS_TestCase, Proxy_TransportSSL_WithClientCert_SyncTest) { // Ensures proper initialization/finalization of the framework _3fd::core::FrameworkInstance _framework; @@ -504,7 +444,7 @@ namespace integration_tests SvcProxyCertInfo proxyCertInfo( CERT_SYSTEM_STORE_LOCAL_MACHINE, "My", - clientCertificateThumbprint + AppConfig::GetSettings().application.GetString(keyForCliCertThumbprint, UNDEF_CLIENT_CERT) ); // Create the proxy (client): @@ -518,14 +458,8 @@ namespace integration_tests EXPECT_EQ(666.0, client.Multiply(111.0, 6.0)); } - /* Request the host to close the service. The host will respond - with the max expected duration (in ms) for that to complete and - the same be again available for the next test: */ - - auto timeout = client.CloseHostService(); + EXPECT_TRUE(client.CloseHostService()); client.Close(); - - std::this_thread::sleep_for(std::chrono::milliseconds(timeout)); } catch (...) { @@ -537,7 +471,7 @@ namespace integration_tests /// Tests asynchronous web service access, with /// SSL over HTTP and a client certificate. /// - TEST_F(Framework_WWS_TestCase, Proxy_TransportSSL_WithClientCert_AsyncTest) + TEST(Framework_WWS_TestCase, Proxy_TransportSSL_WithClientCert_AsyncTest) { // Ensures proper initialization/finalization of the framework _3fd::core::FrameworkInstance _framework; @@ -551,7 +485,7 @@ namespace integration_tests SvcProxyCertInfo proxyCertInfo( CERT_SYSTEM_STORE_LOCAL_MACHINE, "My", - clientCertificateThumbprint + AppConfig::GetSettings().application.GetString(keyForCliCertThumbprint, UNDEF_CLIENT_CERT) ); // Create the proxy (client): @@ -562,16 +496,12 @@ namespace integration_tests const int maxAsyncCalls = 5; std::vector results(maxAsyncCalls); - std::vector asyncOps; + std::vector> asyncOps; asyncOps.reserve(maxAsyncCalls); // Fire the asynchronous requests: for (int idx = 0; idx < maxAsyncCalls; ++idx) { - /* wait a little before making the request, otherwise - the server could refuse them while it is busy */ - std::this_thread::sleep_for(std::chrono::milliseconds(50)); - asyncOps.push_back( client.MultiplyAsync(111.0, 6.0, results[idx]) ); @@ -580,23 +510,15 @@ namespace integration_tests // Get the results and check for errors: while (!asyncOps.empty()) { - asyncOps.back() - .RaiseExClientNotOK("Calculator web service returned an error"); - + asyncOps.back().get(); asyncOps.pop_back(); EXPECT_EQ(666.0, results.back()); results.pop_back(); } - /* Request the host to close the service. The host will respond - with the max expected duration (in ms) for that to complete and - the same be again available for the next test: */ - - auto timeout = client.CloseHostService(); + EXPECT_TRUE(client.CloseHostService()); client.Close(); - - std::this_thread::sleep_for(std::chrono::milliseconds(timeout)); } catch (...) { @@ -614,110 +536,103 @@ namespace integration_tests // Ctor for proxy using a client certificate CalcSvcProxyHeaderAuthSSL(const SvcProxyConfig &config, const SvcProxyCertInfo &certInfo) : WebServiceProxy( - "https://CASE:8888/calculator", + AppConfig::GetSettings().application.GetString("testWwsHostHAuthEndpoint", UNDEF_HOST_SSL_HAUTH), config, certInfo, CalcBindingHeaderAuthSSL_CreateServiceProxy ) {} + // Synchronous 'Add' operation double Add(double first, double second) { CALL_STACK_TRACE; double result; - WSHeap heap(proxyOperHeapSize); - WSError err; - HRESULT hr; - - hr = CalcBindingHeaderAuthSSL_Add( - GetHandle(), - first, - second, - &result, - heap.GetHandle(), - nullptr, 0, - nullptr, - err.GetHandle() - ); - err.RaiseExClientNotOK(hr, "Calculator web service returned an error", heap); + Call("Calculator web service operation 'Add'", + proxyOperHeapSize, + [=, &result](WS_SERVICE_PROXY *wsProxyHandle, WS_HEAP *wsHeapHandle, WS_ERROR *wsErrorHandle) + { + return CalcBindingHeaderAuthSSL_Add(wsProxyHandle, + first, + second, + &result, + wsHeapHandle, + nullptr, 0, + nullptr, + wsErrorHandle); + }); return result; } + // Synchronous 'Multiply' operation double Multiply(double first, double second) { CALL_STACK_TRACE; double result; - WSHeap heap(proxyOperHeapSize); - WSError err; - HRESULT hr; - - hr = CalcBindingHeaderAuthSSL_Multiply( - GetHandle(), - first, - second, - &result, - heap.GetHandle(), - nullptr, 0, - nullptr, - err.GetHandle() - ); - err.RaiseExClientNotOK(hr, "Calculator web service returned an error", heap); + Call("Calculator web service operation 'Multiply'", + proxyOperHeapSize, + [=, &result](WS_SERVICE_PROXY *wsProxyHandle, WS_HEAP *wsHeapHandle, WS_ERROR *wsErrorHandle) + { + return CalcBindingHeaderAuthSSL_Multiply(wsProxyHandle, + first, + second, + &result, + wsHeapHandle, + nullptr, 0, + nullptr, + wsErrorHandle); + }); return result; } // Asynchronous 'Multiply' operation - WSAsyncOper MultiplyAsync(double first, double second, double &result) + std::future MultiplyAsync(double first, double second, double &result) { CALL_STACK_TRACE; - // Prepare for an asynchronous operation: - auto asyncOp = CreateAsyncOperation(proxyOperHeapSize); - auto asyncContext = asyncOp.GetContext(); - - HRESULT hr = // this immediately returns an HRESULT code - CalcBindingHeaderAuthSSL_Multiply( - GetHandle(), - first, - second, - &result, - asyncOp.GetHeapHandle(), - nullptr, 0, - &asyncContext, // this parameter asks for an asynchronous call - asyncOp.GetErrHelperHandle() - ); - - asyncOp.SetCallReturn(hr); - return std::move(asyncOp); + return CallAsync( + "Calculator web service operation 'Multiply'", + proxyOperHeapSize, + [=, &result](WS_SERVICE_PROXY *wsProxyHandle, WS_HEAP *wsHeapHandle, WS_ERROR *wsErrorHandle) + { + return CalcBindingHeaderAuthSSL_Multiply(wsProxyHandle, + first, + second, + &result, + wsHeapHandle, + nullptr, 0, + nullptr, + wsErrorHandle); + } + ); } // 'CloseService' operation - uint32_t CloseHostService() + bool CloseHostService() { CALL_STACK_TRACE; - int64_t result; - WSHeap heap(proxyOperHeapSize); - WSError err; - HRESULT hr; - - hr = CalcBindingHeaderAuthSSL_CloseService( - GetHandle(), - &result, - heap.GetHandle(), - nullptr, 0, - nullptr, - err.GetHandle() - ); - - err.RaiseExClientNotOK(hr, "Calculator web service returned an error", heap); - - return result; + BOOL result; + + Call("Calculator web service operation 'CloseService'", + proxyOperHeapSize, + [&result](WS_SERVICE_PROXY *wsProxyHandle, WS_HEAP *wsHeapHandle, WS_ERROR *wsErrorHandle) + { + return CalcBindingHeaderAuthSSL_CloseService(wsProxyHandle, + &result, + wsHeapHandle, + nullptr, 0, + nullptr, + wsErrorHandle); + }); + + return (result == TRUE); } }; @@ -725,7 +640,7 @@ namespace integration_tests /// Tests synchronous web service access, with HTTP /// header authorization, SSL and a client certificate. /// - TEST_F(Framework_WWS_TestCase, Proxy_HeaderAuthTransportSSL_WithClientCert_SyncTest) + TEST(Framework_WWS_TestCase, Proxy_HeaderAuthTransportSSL_WithClientCert_SyncTest) { // Ensures proper initialization/finalization of the framework _3fd::core::FrameworkInstance _framework; @@ -739,7 +654,7 @@ namespace integration_tests SvcProxyCertInfo proxyCertInfo( CERT_SYSTEM_STORE_LOCAL_MACHINE, "My", - clientCertificateThumbprint + AppConfig::GetSettings().application.GetString(keyForCliCertThumbprint, UNDEF_CLIENT_CERT) ); // Create the proxy (client): @@ -753,14 +668,8 @@ namespace integration_tests EXPECT_EQ(666.0, client.Multiply(111.0, 6.0)); } - /* Request the host to close the service. The host will respond - with the max expected duration (in ms) for that to complete and - the same be again available for the next test: */ - - auto timeout = client.CloseHostService(); + EXPECT_TRUE(client.CloseHostService()); client.Close(); - - std::this_thread::sleep_for(std::chrono::milliseconds(timeout)); } catch (...) { @@ -772,7 +681,7 @@ namespace integration_tests /// Tests asynchronous web service access, with HTTP /// header authorization, SSL and a client certificate. /// - TEST_F(Framework_WWS_TestCase, Proxy_HeaderAuthTransportSSL_WithClientCert_AsyncTest) + TEST(Framework_WWS_TestCase, Proxy_HeaderAuthTransportSSL_WithClientCert_AsyncTest) { // Ensures proper initialization/finalization of the framework _3fd::core::FrameworkInstance _framework; @@ -786,7 +695,7 @@ namespace integration_tests SvcProxyCertInfo proxyCertInfo( CERT_SYSTEM_STORE_LOCAL_MACHINE, "My", - clientCertificateThumbprint + AppConfig::GetSettings().application.GetString(keyForCliCertThumbprint, UNDEF_CLIENT_CERT) ); // Create the proxy (client): @@ -797,16 +706,12 @@ namespace integration_tests const int maxAsyncCalls = 5; std::vector results(maxAsyncCalls); - std::vector asyncOps; + std::vector> asyncOps; asyncOps.reserve(maxAsyncCalls); // Fire the asynchronous requests: for (int idx = 0; idx < maxAsyncCalls; ++idx) { - /* wait a little before making the request, otherwise - the server could refuse them while it is busy */ - std::this_thread::sleep_for(std::chrono::milliseconds(50)); - asyncOps.push_back( client.MultiplyAsync(111.0, 6.0, results[idx]) ); @@ -815,23 +720,15 @@ namespace integration_tests // Get the results and check for errors: while (!asyncOps.empty()) { - asyncOps.back() - .RaiseExClientNotOK("Calculator web service returned an error"); - + asyncOps.back().get(); asyncOps.pop_back(); EXPECT_EQ(666.0, results.back()); results.pop_back(); } - /* Request the host to close the service. The host will respond - with the max expected duration (in ms) for that to complete and - the same be again available for the next test: */ - - auto timeout = client.CloseHostService(); + EXPECT_TRUE(client.CloseHostService()); client.Close(); - - std::this_thread::sleep_for(std::chrono::milliseconds(timeout)); } catch (...) { @@ -842,7 +739,7 @@ namespace integration_tests /// /// Tests SOAP fault transmission in web service synchronous access. /// - TEST_F(Framework_WWS_TestCase, Proxy_SoapFault_SyncTest) + TEST(Framework_WWS_TestCase, Proxy_SoapFault_SyncTest) { // Ensures proper initialization/finalization of the framework _3fd::core::FrameworkInstance _framework; @@ -874,7 +771,7 @@ namespace integration_tests SvcProxyCertInfo proxyCertInfo( CERT_SYSTEM_STORE_LOCAL_MACHINE, "My", - clientCertificateThumbprint + AppConfig::GetSettings().application.GetString(keyForCliCertThumbprint, UNDEF_CLIENT_CERT) ); // Create a secure proxy (client): @@ -907,14 +804,8 @@ namespace integration_tests Logger::Write(ex, Logger::PRIO_ERROR); } - /* Request the host to close the service. The host will respond - with the max expected duration (in ms) for that to complete and - the same be again available for the next test: */ - - auto timeout = headerAuthSslClient.CloseHostService(); + EXPECT_TRUE(headerAuthSslClient.CloseHostService()); headerAuthSslClient.Close(); - - std::this_thread::sleep_for(std::chrono::milliseconds(timeout)); } catch (...) { @@ -925,7 +816,7 @@ namespace integration_tests /// /// Tests SOAP fault transmission in web service asynchronous access. /// - TEST_F(Framework_WWS_TestCase, Proxy_SoapFault_AsyncTest) + TEST(Framework_WWS_TestCase, Proxy_SoapFault_AsyncTest) { // Ensures proper initialization/finalization of the framework _3fd::core::FrameworkInstance _framework; @@ -949,7 +840,7 @@ namespace integration_tests /* The request generates a SOAP fault. This will wait for its completion, then it throws an exception made from the deserialized SOAP fault response: */ - asyncOp.RaiseExClientNotOK("Calculator web service returned an error"); + asyncOp.get(); } catch (IAppException &ex) {// Log the fault: @@ -963,7 +854,7 @@ namespace integration_tests SvcProxyCertInfo proxyCertInfo( CERT_SYSTEM_STORE_LOCAL_MACHINE, "My", - clientCertificateThumbprint + AppConfig::GetSettings().application.GetString(keyForCliCertThumbprint, UNDEF_CLIENT_CERT) ); // Create a secure proxy (client): @@ -979,7 +870,7 @@ namespace integration_tests /* The request generates a SOAP fault. This will wait for its completion, then it throws an exception made from the deserialized SOAP fault response: */ - asyncOp.RaiseExClientNotOK("Calculator web service returned an error"); + asyncOp.get(); } catch (IAppException &ex) {// Log the fault: @@ -1001,14 +892,14 @@ namespace integration_tests /* The request generates a SOAP fault. This will wait for its completion, then it throws an exception made from the deserialized SOAP fault response: */ - asyncOp.RaiseExClientNotOK("Calculator web service returned an error"); + asyncOp.get(); } catch (IAppException &ex) {// Log the fault: Logger::Write(ex, Logger::PRIO_ERROR); } - headerAuthSslClient.CloseHostService(); + EXPECT_TRUE(headerAuthSslClient.CloseHostService()); headerAuthSslClient.Close(); } catch (...) diff --git a/UnitTests/CMakeLists.txt b/UnitTests/CMakeLists.txt index 1c7d41d..a7496d2 100644 --- a/UnitTests/CMakeLists.txt +++ b/UnitTests/CMakeLists.txt @@ -5,7 +5,6 @@ cmake_minimum_required(VERSION 2.6) project(UnitTests) -include(ExternalProject) ##################### # Macro definitions: @@ -16,9 +15,6 @@ add_definitions( -DTESTING ) -set(POCO_ROOT "/opt/poco-1.7.5") -set(BOOST_HOME "/opt/boost-1.60") - ######################## # Include directories: @@ -26,57 +22,37 @@ include_directories( "${PROJECT_SOURCE_DIR}/../3FD" "${PROJECT_SOURCE_DIR}/../gtest/include" "${PROJECT_SOURCE_DIR}/../btree" - "${POCO_ROOT}/include" - "${BOOST_HOME}/include" + "$ENV{POCO_ROOT}/include" + "$ENV{BOOST_HOME}/include" ) ######################## # Dependency libraries: -# How to build 3FD project -ExternalProject_Add(3FD_project - DOWNLOAD_COMMAND echo " 3FD source is local" - CONFIGURE_COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/../3FD && ./configure.sh - BUILD_COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/../3FD && make - INSTALL_COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/../3FD && echo " 3FD installed in " && pwd -) - -# How to build gtest project -ExternalProject_Add(gtest_project - DOWNLOAD_COMMAND echo " gtest source is local" - CONFIGURE_COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/../gtest && ./configure.sh - BUILD_COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/../gtest && make - INSTALL_COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/../gtest && echo " gtest installed in " && pwd -) - # How and what libs to link: -add_library(3FD STATIC IMPORTED) -add_library(gtest STATIC IMPORTED) -add_library(PocoUtil STATIC IMPORTED) -add_library(PocoXML STATIC IMPORTED) +add_library(3FD STATIC IMPORTED) +add_library(gtest STATIC IMPORTED) +add_library(PocoUtil STATIC IMPORTED) +add_library(PocoXML STATIC IMPORTED) add_library(PocoFoundation STATIC IMPORTED) # Where the lib binaries are: string(TOLOWER ${CMAKE_BUILD_TYPE} buildType) if(buildType STREQUAL release) add_definitions(-DNDEBUG) - set_target_properties(3FD PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/../3FD/lib3FD.a") - set_target_properties(gtest PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/../gtest/libgtest.a") - set_target_properties(PocoUtil PROPERTIES IMPORTED_LOCATION "${POCO_ROOT}/lib/libPocoUtil.a") - set_target_properties(PocoXML PROPERTIES IMPORTED_LOCATION "${POCO_ROOT}/lib/libPocoXML.a") - set_target_properties(PocoFoundation PROPERTIES IMPORTED_LOCATION "${POCO_ROOT}/lib/libPocoFoundation.a") + set_target_properties(3FD PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/../3FD/lib3FD.a") + set_target_properties(gtest PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/../gtest/libgtest.a") + set_target_properties(PocoUtil PROPERTIES IMPORTED_LOCATION "$ENV{POCO_ROOT}/lib/libPocoUtil.a") + set_target_properties(PocoXML PROPERTIES IMPORTED_LOCATION "$ENV{POCO_ROOT}/lib/libPocoXML.a") + set_target_properties(PocoFoundation PROPERTIES IMPORTED_LOCATION "$ENV{POCO_ROOT}/lib/libPocoFoundation.a") elseif(buildType STREQUAL debug) - set_target_properties(3FD PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/../3FD/lib3FDd.a") - set_target_properties(gtest PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/../gtest/libgtestd.a") - set_target_properties(PocoUtil PROPERTIES IMPORTED_LOCATION "${POCO_ROOT}/lib/libPocoUtild.a") - set_target_properties(PocoXML PROPERTIES IMPORTED_LOCATION "${POCO_ROOT}/lib/libPocoXMLd.a") - set_target_properties(PocoFoundation PROPERTIES IMPORTED_LOCATION "${POCO_ROOT}/lib/libPocoFoundationd.a") + set_target_properties(3FD PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/../3FD/lib3FDd.a") + set_target_properties(gtest PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/../gtest/libgtestd.a") + set_target_properties(PocoUtil PROPERTIES IMPORTED_LOCATION "$ENV{POCO_ROOT}/lib/libPocoUtild.a") + set_target_properties(PocoXML PROPERTIES IMPORTED_LOCATION "$ENV{POCO_ROOT}/lib/libPocoXMLd.a") + set_target_properties(PocoFoundation PROPERTIES IMPORTED_LOCATION "$ENV{POCO_ROOT}/lib/libPocoFoundationd.a") endif() -# Associate the dependencies with the corresponding projects: -add_dependencies(3FD 3FD_project) -add_dependencies(gtest gtest_project) - # Place the configuration file along with the executable: add_custom_command( OUTPUT UnitTests.3fd.config @@ -98,5 +74,17 @@ add_executable(UnitTests ) # Linking: -target_link_libraries(UnitTests gtest 3FD pthread PocoUtil PocoXML PocoFoundation) +target_link_libraries(UnitTests + gtest + 3FD + pthread + PocoUtil PocoXML PocoFoundation +) + +################ +# Installation: +install( + TARGETS UnitTests + DESTINATION "${PROJECT_SOURCE_DIR}/../build/bin" +) \ No newline at end of file diff --git a/UnitTests/UnitTests.vcxproj b/UnitTests/UnitTests.vcxproj index 5b0bd77..9dd6e7e 100644 --- a/UnitTests/UnitTests.vcxproj +++ b/UnitTests/UnitTests.vcxproj @@ -1,6 +1,14 @@  + + Debug_XP + Win32 + + + Debug_XP + x64 + Debug Win32 @@ -9,6 +17,14 @@ Debug x64 + + Release_XP + Win32 + + + Release_XP + x64 + Release Win32 @@ -22,6 +38,7 @@ {A657480D-D083-4C31-B499-42FF50481AC1} Win32Proj UnitTests + 8.1 @@ -30,12 +47,24 @@ Unicode v140 + + Application + true + Unicode + v140_xp + Application true Unicode v140 + + Application + true + Unicode + v140_xp + Application false @@ -43,6 +72,13 @@ Unicode v140 + + Application + false + true + Unicode + v140_xp + Application false @@ -50,21 +86,40 @@ Unicode v140 + + Application + false + true + Unicode + v140_xp + + + + + + + + + + + + + true @@ -73,6 +128,13 @@ $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) $(POCO_ROOT)\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + $(POCO_ROOT)\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + true $(SolutionDir)$(Platform)\$(Configuration)\ @@ -81,6 +143,14 @@ $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) $(POCO_ROOT)\lib64;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + MinimumRecommendedRules.ruleset + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + $(POCO_ROOT)\lib64;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) + false $(SolutionDir)$(Platform)\$(Configuration)\ @@ -88,6 +158,13 @@ $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) $(POCO_ROOT)\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + $(POCO_ROOT)\lib;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + false $(SolutionDir)$(Platform)\$(Configuration)\ @@ -95,6 +172,13 @@ $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) $(POCO_ROOT)\lib64;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(BOOST_HOME)\include;$(POCO_ROOT)\Foundation\include;$(POCO_ROOT)\XML\include;$(POCO_ROOT)\Util\include;C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + $(POCO_ROOT)\lib64;C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) + Use @@ -115,6 +199,26 @@ copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + + Use + Level3 + Disabled + ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions); + $(SolutionDir)3FD;$(SolutionDir)gtest\include;$(SolutionDir)btree;%(AdditionalIncludeDirectories) + 4290;4482 + MultiThreadedDebugDLL + /D POCO_STATIC /D _VARIADIC_MAX=10 %(AdditionalOptions) + + + Console + true + %(AdditionalDependencies) + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + Use @@ -135,6 +239,26 @@ copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + + Use + Level3 + Disabled + ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);%(PreprocessorDefinitions);%(PreprocessorDefinitions) + $(SolutionDir)3FD;$(SolutionDir)gtest\include;$(SolutionDir)btree;%(AdditionalIncludeDirectories) + 4290;4482 + MultiThreadedDebugDLL + /D POCO_STATIC /D _VARIADIC_MAX=10 %(AdditionalOptions) + + + Console + true + %(AdditionalDependencies) + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + Level3 @@ -163,6 +287,34 @@ copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + + Level3 + Use + MaxSpeed + true + true + TESTING;WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(SolutionDir)3FD;$(SolutionDir)gtest\include;$(SolutionDir)btree;%(AdditionalIncludeDirectories) + OnlyExplicitInline + true + false + 4290;4482 + MultiThreadedDLL + /D POCO_STATIC $(MSVC_X86_RELEASE_EINSTSET) %(AdditionalOptions) + NotSet + + + Console + true + true + true + %(AdditionalDependencies) + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + Level3 @@ -191,12 +343,44 @@ copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + + Level3 + Use + MaxSpeed + true + true + TESTING;WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(SolutionDir)3FD;$(SolutionDir)gtest\include;$(SolutionDir)btree;%(AdditionalIncludeDirectories) + OnlyExplicitInline + true + false + 4290;4482 + MultiThreadedDLL + /D POCO_STATIC $(MSVC_X64_RELEASE_EINSTSET) %(AdditionalOptions) + NotSet + + + Console + true + true + true + %(AdditionalDependencies) + + + copy "$(ProjectDir)application.config" "$(TargetPath).3fd.config" + + Create + Create Create + Create Create + Create Create + Create @@ -205,9 +389,13 @@ true + true true + true true + true true + true diff --git a/UnitTests/WinRT.UWP/Package.appxmanifest b/UnitTests/WinRT.UWP/Package.appxmanifest index 7c37c0f..c2ee4ff 100644 --- a/UnitTests/WinRT.UWP/Package.appxmanifest +++ b/UnitTests/WinRT.UWP/Package.appxmanifest @@ -1,6 +1,6 @@  - + UnitTestsApp.WinRT.UWP diff --git a/UnitTests/WinRT.UWP/UnitTestsApp.WinRT.UWP.vcxproj b/UnitTests/WinRT.UWP/UnitTestsApp.WinRT.UWP.vcxproj index abc08d7..354ff4d 100644 --- a/UnitTests/WinRT.UWP/UnitTestsApp.WinRT.UWP.vcxproj +++ b/UnitTests/WinRT.UWP/UnitTestsApp.WinRT.UWP.vcxproj @@ -98,12 +98,17 @@ UnitTestsApp.WinRT.UWP_TemporaryKey.pfx + 6A052BC56B5F0F365BF306C65D12A329916DCC3D $(BOOST_HOME);$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)\ + $(Platform)\$(Configuration)\ $(BOOST_HOME);$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)\ + $(Platform)\$(Configuration)\ $(BOOST_HOME);$(VC_IncludePath);$(WindowsSDK_IncludePath); @@ -132,7 +137,7 @@ 4018;4453;4996;28204 $(SolutionDir)3FD;$(SolutionDir)3FD.WinRT\3FD.WinRT.Shared;$(SolutionDir)btree;$(SolutionDir)gtest\include;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) ENABLE_3FD_ERR_IMPL_DETAILS;ENABLE_3FD_CST;TESTING;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions);%(PreprocessorDefinitions);%(PreprocessorDefinitions) - AdvancedVectorExtensions2 + NotSet pch.h diff --git a/UnitTests/WinRT.UWP/UnitTestsApp.WinRT.UWP_TemporaryKey.pfx b/UnitTests/WinRT.UWP/UnitTestsApp.WinRT.UWP_TemporaryKey.pfx new file mode 100644 index 0000000000000000000000000000000000000000..345892a0fb538c0b63456e29b6f23782ea16ca62 GIT binary patch literal 2600 zcmZXUc{tSDAIHBlW-<1yD{FSbxMLqe2B9p;zAuq|Um}cUvezI<$eKMVT;gV%FhbOj z$P(F$vW{&Oce>B-cklCie$RQ%`Mf``&vMQ`=Yzu0iGV>gC>-K53?Z4MpLD)gXKOyKk1P5KE;zjD7gVFz|ih&LUF2O-gP&fz$#S5eRFQztUg3w-| zlxC$10m@)7oCLu^KK`r?(pWH%07buVHD76VjyMZdYK(N?!%CJ?4x?^)h)!QdSMh&7 zIAkE7?N}NDSBzubBT0j=D)TpeU!HOe826irturw*I6F!f0!UNcI;*I)6s)d%&>T5yC<2lj_yWj0*m>8|E zxodu!Vc5KGg43U{)A4>jFgjh6cTvMuo6!T$7~r+_Av&yn{7z@DSfG`wM}oMs4q0Kp z`h`P9WahZ6iiD}rJM0j4cA)R;&J>9rE_7V-wy3yd|CQi1k)`Nw#o5Y<+EMtd?Qo6} z!+nN7Pt|Ko+JEAWd!91}-vl#jj9g1i7Vjc2_4v_qWtOkAIfLm|n^O1XB7=wbrf+Mj z`%GrM_Qb_Zd`uu~K+H#ypNb3LU5^;lyTgQ?31+gW^WZ*e=vwYC#*}fA^bGk!w>hT9 zDd;4h)&rwO2~gi7r$uY2xECMQcm@< zfW!Rsr7*NIY*(oTnB&VizZ1VG#}j*XGlRXLC|SUX;j|CCH1nHVU95i(EGp073x9Ar zm~HT3S`8+CBDvRAq$5fmO#CiB_qpR;SgmKA@}=D?rlC7dPS6h_bs8rQ5o!I?K{NHQ zyN%IpZ|x~J(^(6cw;rk(*?0xrbm^Ti)tr4|Hjg7ZkowvD4@B;rK8we9=cr17*}YS3 z|G>6Nj$hp>eOZE<7Xkc^#v}5^u-l@JTAjvK2V4ZM%!E?By;4_Ij%`@Vp9|&39*~H6 zgw|PM{QctSCc7K*WoffXY*v>iMWv;0?k8|Xv+-U2nR|4o_lNy>Eyi6kV~CahePK_W znhIxl{}q^L)|!QPTS;n_<(s5pyNdNx9*hk?x$#?0z0q;hTZ0@@Y1SB7Ud4NXdu>W3 znmA`v6Qd-UjeKlLl#%q3iW|ow?SgB@@9aIW=(Y$vJS)rE%gPcneN3O}^^=yz`W}Ic zW3#4%)Ea5^rb737TPLq!l5W!JJEHA)Am^&7LX(2bwOYaTAMntYaIy^D4KwZr8S;K( zuTK=5M=^X)CdA_tWN#R8EMtURe2_bU*ROipT-WcOwKDQ_RuRpR9QktTc7LQK8Pbi{ z4Vfrbh`}+O9Bhb;Osh&TbYv}0|NLUO|6;W7D2v%xgu(mER`=tJOz1?~PP(zqt{mYO znFL0*P=Bu29b0(gD3J?QOH;7PRQC$=xa*?zLI%4_vR1xjgqh`u->h)ylt7P_O^`~f z@cFD$Pucik6#GBp5^+Wr27!P806>0Z6KKqk6xT z0#&O3id5wS$WpcY-^zt*uTz&iH6KmoO4JNFlmiSQ1p`4qIAvCltO>s{U<7zk+Xe#x zKnQia1EGKbU`9QE5r4pg>Sf5Ha0BVr=lsc*c{L`Rgk?>j<2cKjCxDp<2--} z^~boA($>won0<`OU_$N$pX|GkwHzm{N9TS+01wQZ5BGj2O3*Ug2q+|@eTVepgwDXn zdy)HR;=l1RNlp?gMoxAM+~Rczc`N0M82QQ#XQs{FYOLK#N?r3xz0>=2{K0YXgC%|-!~ zw!@DnT6L2|D!w*riMFC)zCTFZ{cLhZ?t?<)a~xj>#h^{0?Xv{Vz?rrzgm+^bjZ{?bVs>2X)Q0)s&EfoQC*?LjvBYRP z#A4VyxQQVo{ZUNpU9mmP>HJt)rj*jNyzU(2f?e2%SdY1GdlW{O{P7~8ow?`mgU`ID z>zrzJxyGOO;JR8>l^+94EiUi*!Biq-7k$^qoePUJ9nJ37Od%Z$7r!163BHU0JQoKB zp>t~1(YNYSp4mVPBb-mG{6jC6Mb3bji|Pluhwho4BZPjwpVMgz&v&(Tl}Jn#tdZcb zD%0sE#Ho2oy{l9@)w8|Ay7}Ra?jzX>`-hz`%j1t7chn*>>2og>e0DAeDc_uKc^jP2pJ<8Yj%5#M#<3kq1hQ{mRB^6pLkM;i9QZ!GmOLx2hOeMXs99v75x-dFINq)4>2bZ7*M z)qsInE{Jl8M7HT82e&|;ULbIsix0qpOj14v+5HF%iI=HX4cG_yI>>odQ4wQ zGla>KcX@7|9iLrrsafj#%zMome}b6*)ui37(CaKSoqB8%c_;O3)~3-}s5C3o1=Kkd z90rwQq5*S5IPzL46u($VQMN2QYs3Hs#TXO|QGv_ED4 H`oMnyUG1Hb literal 0 HcmV?d00001 diff --git a/UnitTests/application.config b/UnitTests/application.config index 5e325e9..3846831 100644 --- a/UnitTests/application.config +++ b/UnitTests/application.config @@ -3,9 +3,9 @@ - - - + + + @@ -16,10 +16,10 @@ - - - - + + + + @@ -29,6 +29,17 @@ + + + + + + + + + + + diff --git a/VideoTranscoder/VideoTranscoder.cpp b/VideoTranscoder/VideoTranscoder.cpp index 998ebcc..beeff5f 100644 --- a/VideoTranscoder/VideoTranscoder.cpp +++ b/VideoTranscoder/VideoTranscoder.cpp @@ -155,7 +155,7 @@ int main(int argc, const char *argv[]) using namespace std::chrono; using namespace _3fd::core; - FrameworkInstance frameworkInstance(RO_INIT_MULTITHREADED); + FrameworkInstance frameworkInstance(FrameworkInstance::ComMultiThreaded); CALL_STACK_TRACE; diff --git a/_config.yml b/_config.yml deleted file mode 100644 index c419263..0000000 --- a/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-cayman \ No newline at end of file diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..dbcd527 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,859 @@ +# Script written by Felipe Vieira Aburaya (last update: October 12th 2017) +# +# Usage: +# +# .\build.ps1 -arch {x86|x64|ARM|all} -xp {yes|no} -mode {debug|release} -rebuild {yes|no} +# +# Builds all the projects in VC++ solution 3FD.sln that are compilable for the given +# architecture(s). Builds are by default incremental, but can also be complete rebuilds. +# Projects of UWP apps produce packages that are easy to deploy with a click. All of +# this goes to the generated build directory in the solution root directory, along with +# headers, libraries, templates, samples and test applications. +# +# There is the option of downloading and building from source the dependency libraries +# Boost and POCO C++. They are set to the specific release with which 3FD projects are +# tested and configured to work. They are installed into a version specific directory +# in a location specified by the enviroment variables BOOST_HOME and POCO_ROOT, those +# MUST BE set prior to script execution. +# +# In order to build the projects, MSBuild is employed. The script looks for MSBuild.exe +# (32 bits) executable first in %PROGRAMFILES(x86)%\MSBuild, then in "Visual Studio 1X" +# directories, giving priority to the latest release. +# + +# ============================================= +# PARAMETERS & ENVIRONMENT +# ============================================= + +param ( + [string]$arch = $(Read-Host 'Architecture (x86, x64, ARM, all)'), + [string]$xp = $(Read-Host 'Use WinXP-compatible toolset? (no/yes)'), + [string]$mode = $(Read-Host 'Configuration (Debug, Release)'), + [string]$rebuild = $(Read-Host 'Rebuild? (no/yes)') +) + +if (($arch.ToLower() -eq 'arm') -and ($xp -eq 'yes')) +{ + Write-Host 'Nothing to build for ARM with WinXP-compatible toolset!' -ForegroundColor yellow; + exit; +} + +[string]$task; + +if ($rebuild -eq 'yes') +{ + $task = 'rebuild'; +} +else +{ + $task = 'build'; +} + + +# ============================================= +# FUNCTIONS +# ============================================= + +# # # # # +# appends a new line to the file +function AppendFile ([string]$file, [string] $line) +{ + Out-File -FilePath $file ` + -InputObject $line ` + -Encoding ASCII ` + -Append; +} + + +# # # # # +# displays a message in the console but also in the log +function WriteConsole ([string] $message) +{ + Write-Host ''; + Write-Host $message -ForegroundColor yellow; + Write-Host ''; + + $now = Get-Date -UFormat "%d-%b-%Y %H:%M:%S"; + + Out-File -FilePath '.\build.log' ` + -InputObject ($now + ' >> ' + $message) ` + -Encoding ASCII ` + -Append; +} + + +# # # # # +# displays an error message only +function DisplayError ([string] $message) +{ + Write-Host ''; + Write-Host ('ERROR! ' + $message) -ForegroundColor magenta; + Write-Host ''; + + $now = Get-Date -UFormat "%d-%b-%Y %H:%M:%S"; + + Out-File -FilePath '.\build.log' ` + -InputObject ($now + ' >> ' + $message) ` + -Encoding ASCII ` + -Append; +} + + +# # # # # +# displays an error messages and terminates script execution +function RaiseError ([string] $message) +{ + DisplayError $message; + exit; +} + + +# # # # # +# load the required .NET assemblies +function LoadDotNetAssemblies () +{ + try + { + Add-Type -Path ( + [Environment]::GetEnvironmentVariable("WINDIR") + + '\Microsoft.NET\Framework64\v4.0.30319\System.IO.Compression.FileSystem.dll' + ) 2> $null; + } + catch + { + ### + # Fix Powershell .NET Framework version: + + [string]$resetPowershell = $(Read-Host ( + 'Could not load a required assembly because your Powershell installation ' + + 'is configured to use an old verion of the .NET Framework. ' + + 'Do you wish to have it reconfigured? (no/yes)' + )); + + if ($resetPowershell -ne 'yes') + { + RaiseError 'Script execution cannot succeed!'; + } + + if ($(Test-Path "$PSHOME\powershell.exe.config")) + { + move -Force "$PSHOME\powershell.exe.config" "$PSHOME\powershell.exe.config.old"; + } + + if ($(Test-Path "$PSHOME\powershell_ise.exe.config")) + { + move -Force "$PSHOME\powershell_ise.exe.config" "$PSHOME\powershell_ise.exe.config.old"; + } + + $configText = @" + + + + + + + +"@; + $configText | Out-File "$PSHOME\powershell.exe.config" + $configText | Out-File "$PSHOME\powershell_ise.exe.config" + + WriteConsole ( + 'Your Powershell installation was reconfigured to use a newer version ' + + 'of .NET Framework. Any previous configuration has been saved. ' + + 'Please restart this prompt and try executing this script again.' + ); + + exit; + } +} + + +[string]$msBuildPath; + +# # # # # +# build solution for a given configuration +# +function MsBuild ( + [string]$what, # solution or project to build + [string]$task, # build|rebuild + [string]$arch, # x86|x64|ARM + [string]$config, # debug|release + [string]$toolset # (optional) ex: v140_xp +) +{ + ### + # single initialization: + + if (-not $global:msBuildPath) + { + $msBuildInstalls = @(gci $([Environment]::GetEnvironmentVariable("PROGRAMFILES(X86)")) ` + | Where-Object { $_.Name.Contains('Visual Studio 1') -or $_.Name.Contains('MSBuild') } ` + | Sort-Object @{ Expression="Name"; Descending=$true }); + + if ($msBuildInstalls.Length -eq 0) + { + RaiseError 'Could not find a MSBuild installation!'; + } + + $msBuildExecs = @(gci -Recurse ($msBuildInstalls[0].FullName) ` + | Where-Object { ($_.Name -eq 'MSBuild.exe') -and (-not $_.FullName.Contains('amd64')) } ` + | Sort-Object @{ Expression="FullName"; Descending=$true }); + + if ($msBuildExecs -eq 0) + { + RaiseError 'MSBuild.exe (32 bits) not found!'; + } + + $global:msBuildPath = $msBuildExecs[0].FullName; + } + + if (-not $global:msBuildPath) + { + RaiseError 'MSBuild.exe (32 bits) not found!'; + } + + ### + # assemble command: + + [string]$command = '. "' + $global:msBuildPath + '" "' + $what + '" /verbosity:minimal /m'; + + $task = $task.ToLower(); + + switch ($task) + { + "build" { $command += ' /t:build'; } + "rebuild" { $command += ' /t:rebuild'; } + default { + RaiseError ('Task <' + $task + '> is unknown!'); + } + } + + $arch = $arch.ToLower(); + + switch ($arch) + { + "x64" { $command += ' /p:Platform=x64'; } + "x86" { $command += ' /p:Platform=x86'; } + "arm" { $command += ' /p:Platform=ARM'; } + default { + RaiseError ('Architecture <' + $arch + '> is unknown!'); + } + } + + $command += ' /p:Configuration=' + $config; + + # Use custom toolset? + if ($toolset -and ($toolset -ne '')) + { + $command += ' /p:PlatformToolset=' + $toolset; + } + + Write-Host ''; + Write-Host $command -ForegroundColor Cyan; + Write-Host ''; + + Invoke-Expression -Command $command; + + if ($lastexitcode -ne 0) + { + DisplayError ('Failed to build <' + $what + '>'); + } +} + + +### +# Check BOOST_HOME: + +[string]$boostVersion = '1.65.1'; +[string]$boostZipLabel = 'boost_1_65_1'; +[string]$boostHomePathExpSuffix = 'Boost\v' + $boostVersion + '\'; + +[string]$envVarBoostHome = [Environment]::GetEnvironmentVariable("BOOST_HOME"); + +if ( + (-not $envVarBoostHome) -or + ( (-not $envVarBoostHome.ToLower().EndsWith($boostHomePathExpSuffix.ToLower())) -and + (-not ($envVarBoostHome + '\').ToLower().EndsWith($boostHomePathExpSuffix.ToLower())) ) + ) +{ + RaiseError( + 'The enviroment variable BOOST_HOME must be set! ' + + 'This build depends of Boost version ' + $boostVersion + + ', so you should set BOOST_HOME = path_of_your_choice\' + $boostHomePathExpSuffix + ); +} + +[string]$vcvarsall; + +# # # # # +# Build boost libraries +# +function BuildBoostLibs () +{ + LoadDotNetAssemblies; + + ### + # single initialization: + + if (-not $global:vcvarsall) + { + $global:vcvarsall = $(gci -Recurse ` + $($(gci $([Environment]::GetEnvironmentVariable("PROGRAMFILES(X86)")) ` + | Where-Object { $_.Name.Contains('Visual Studio 1') } ` + | Sort-Object @{ Expression="Name"; Descending=$true })[0].FullName + '\VC') ` + | Where-Object { ($_.Name -eq 'vcvarsall.bat') } + ).FullName; + } + + if (-not $global:vcvarsall) + { + RaiseError 'vcvarsall.bat not found!'; + } + + ### + # files & directories: + + if ($(Test-Path $envVarBoostHome)) + { + [string]$continue = $(Read-Host 'Boost libraries appears to be already installed. Do you want to erase and rebuild that? (no/yes)'); + + if ($continue.ToLower() -ne 'yes') + { + return; + } + + ri -Force -Recurse ($envVarBoostHome + '\*'); + } + + mkdir $envVarBoostHome -Force; + + [string]$boostDir = $(gi $(Join-Path -Path $envVarBoostHome -ChildPath '\..\')).FullName; + + [string]$boostZipFName = $boostZipLabel + '.zip'; + [string]$boostZipFPath = $boostDir + '\' + $boostZipFName; + [string]$boostInstallDir = $envVarBoostHome; + + ### + # download: + + WriteConsole 'Downloading boost source code...'; + + if ($(Test-Path $boostZipFPath)) + { + ri $boostZipFPath -Force; + } + + (New-Object System.Net.WebClient).DownloadFile( + 'https://dl.bintray.com/boostorg/release/' + $boostVersion + '/source/' + $boostZipFName, + $boostZipFPath + ); + + if (-not $(Test-Path $boostZipFPath)) + { + RaiseError 'Failed to download boost source code!'; + } + + ### + # extract: + + WriteConsole 'Extracting downloaded file...'; + + [string]$boostSourceDir = $boostDir + '\' + $boostZipLabel; + + if ($(Test-Path $boostSourceDir)) + { + ri -Force -Recurse $boostSourceDir; + } + + [System.IO.Compression.ZipFile]::ExtractToDirectory($boostZipFPath, $boostDir); + + if (-not $(Test-Path $boostSourceDir)) + { + RaiseError 'Failed to extract boost source code!'; + } + + ### + # generate build script: + + WriteConsole 'Generating build script...'; + + mkdir ($boostInstallDir + '\include') -Force; + mkdir ($boostInstallDir + '\lib\Win32') -Force; + mkdir ($boostInstallDir + '\lib\x64') -Force; + + [string]$boostBuildBatchScriptFPath = $boostSourceDir + '\build_boost.bat'; + + if ($(Test-Path $boostBuildBatchScriptFPath)) + { + ri $boostBuildBatchScriptFPath; + } + + AppendFile -file $boostBuildBatchScriptFPath -line ('call "' + $global:vcvarsall + '" x86_amd64'); + AppendFile -file $boostBuildBatchScriptFPath -line ('cd "' + $boostSourceDir + '\tools\build"'); + AppendFile -file $boostBuildBatchScriptFPath -line ('call bootstrap.bat'); + AppendFile -file $boostBuildBatchScriptFPath -line ('cd ..\..\'); + + [UInt32]$nCpuCores = $(Get-WmiObject -Class win32_processor).NumberOfCores; + + [string]$buildCmdDbgX64 = + "tools\build\b2.exe -j $nCpuCores --abbreviate-paths address-model=64 variant=debug link=static threading=multi runtime-link=shared"; + + [string]$buildCmdRelX64 = + "tools\build\b2.exe -j $nCpuCores --abbreviate-paths address-model=64 variant=release link=static threading=multi runtime-link=shared"; + + [string]$buildCmdDbgX86 = + "tools\build\b2.exe -j $nCpuCores --abbreviate-paths address-model=32 variant=debug link=static threading=multi runtime-link=shared"; + + [string]$buildCmdRelX86 = + "tools\build\b2.exe -j $nCpuCores --abbreviate-paths address-model=32 variant=release link=static threading=multi runtime-link=shared"; + + # For XP toolset: + if ($xp -eq 'yes') + { + $buildCmdDbgX64 += ' toolset=msvc-14.0_xp'; + $buildCmdRelX64 += ' toolset=msvc-14.0_xp'; + $buildCmdDbgX86 += ' toolset=msvc-14.0_xp'; + $buildCmdRelX86 += ' toolset=msvc-14.0_xp'; + } + + AppendFile -file $boostBuildBatchScriptFPath -line $buildCmdDbgX64; + AppendFile -file $boostBuildBatchScriptFPath -line $buildCmdRelX64; + AppendFile -file $boostBuildBatchScriptFPath -line ('move stage\lib\* "' + $boostInstallDir + '\lib\x64"'); + AppendFile -file $boostBuildBatchScriptFPath -line ('call "' + $global:vcvarsall + '" x86'); + AppendFile -file $boostBuildBatchScriptFPath -line $buildCmdDbgX86; + AppendFile -file $boostBuildBatchScriptFPath -line $buildCmdRelX86; + AppendFile -file $boostBuildBatchScriptFPath -line ('move stage\lib\* "' + $boostInstallDir + '\lib\Win32"'); + + ### + # start build & install: + + WriteConsole 'Building boost...'; + + $cmdPID = $(Start-Process -FilePath ('"' + $boostBuildBatchScriptFPath + '"') -PassThru).Id; + + Wait-Process -Id $cmdPID; + + if (@(gci ($boostInstallDir + '\lib\x64')).Length -eq 0) + { + RaiseError 'Failed to build boost x64!'; + } + + if (@(gci ($boostInstallDir + '\lib\Win32')).Length -eq 0) + { + RaiseError 'Failed to build boost x86!'; + } + + mv ($boostSourceDir + '\boost') ($boostInstallDir + '\include\'); + + ### + # clean-up: + + rmdir $boostSourceDir -Recurse -Force; + ri $boostZipFPath -Force; +} + + +### +# Check POCO C++ availability: + +[string]$pocoVersion = '1.7.9'; +[string]$pocoRootPathExpSuffix = 'POCO\v' + $pocoVersion + '\'; + +[string]$envVarPocoRoot = [Environment]::GetEnvironmentVariable("POCO_ROOT"); + +if ( + (-not $envVarPocoRoot) -or + ( (-not $envVarPocoRoot.ToLower().EndsWith($pocoRootPathExpSuffix.ToLower())) -and + (-not ($envVarPocoRoot + '\').ToLower().EndsWith($pocoRootPathExpSuffix.ToLower())) ) + ) +{ + RaiseError( + 'The enviroment variable POCO_ROOT must be set! ' + + 'This build depends on POCO C++ version ' + $pocoVersion + + ', so you should set POCO_ROOT = path_of_your_choice\' + $pocoRootPathExpSuffix + ); +} + +# # # # # +# Build POCO C++ libraries +# +function BuildPocoLibs () +{ + LoadDotNetAssemblies; + + if ($(Test-Path $envVarPocoRoot)) + { + [string]$continue = $(Read-Host 'POCO C++ libraries appears to be already installed. Do you want to erase and rebuild that? (no/yes)'); + + if ($continue.ToLower() -ne 'yes') + { + return; + } + + ri -Force -Recurse ($envVarPocoRoot + '\*'); + } + + mkdir -Path $envVarPocoRoot -Force; + + [string]$pocoDir = $(gi $(Join-Path -Path $envVarPocoRoot -ChildPath '\..\')).FullName; + + [string]$pocoZipLabel = 'poco-' + $pocoVersion + '-all'; + [string]$pocoZipFName = $pocoZipLabel + '.zip'; + [string]$pocoZipFPath = $pocoDir + '\' + $pocoZipFName; + [string]$pocoInstallDir = $envVarPocoRoot; + + ### + # download: + + WriteConsole 'Downloading POCO C++ source code...'; + + if ($(Test-Path $pocoZipFPath)) + { + ri $pocoZipFPath -Force; + } + + (New-Object System.Net.WebClient).DownloadFile( + 'https://pocoproject.org/releases/poco-' + $pocoVersion + '/' + $pocoZipFName, + $pocoZipFPath + ); + + if (-not $(Test-Path $pocoZipFPath)) + { + RaiseError 'Failed to download POCO C++ source code!'; + } + + ### + # extract: + + WriteConsole 'Extracting downloaded file...'; + + [string]$pocoSourceDir = $pocoDir + '\' + $pocoZipLabel; + + if ($(Test-Path $pocoSourceDir)) + { + ri -Force -Recurse $pocoSourceDir; + } + + [System.IO.Compression.ZipFile]::ExtractToDirectory($pocoZipFPath, $pocoDir); + + if (-not $(Test-Path $pocoSourceDir)) + { + RaiseError 'Failed to extract POCO C++ source code!'; + } + + mv ($pocoSourceDir + '\*') $pocoInstallDir; + ri $pocoSourceDir -Force; + + ### + # build: + + [string]$customToolset; + if ($xp -eq 'yes') + { + $customToolset = 'v140_xp'; + } + + WriteConsole 'Building POCO C++ Foundation x86...'; + + MsBuild -what ($pocoInstallDir + '\Foundation\Foundation_vs140.vcxproj') -task build -arch x86 -config debug_static_md -toolset $customToolset + MsBuild -what ($pocoInstallDir + '\Foundation\Foundation_vs140.vcxproj') -task build -arch x86 -config release_static_md -toolset $customToolset + + WriteConsole 'Building POCO C++ Foundation x64...'; + + MsBuild -what ($pocoInstallDir + '\Foundation\Foundation_x64_vs140.vcxproj') -task build -arch x64 -config debug_static_md -toolset $customToolset + MsBuild -what ($pocoInstallDir + '\Foundation\Foundation_x64_vs140.vcxproj') -task build -arch x64 -config release_static_md -toolset $customToolset + + WriteConsole 'Building POCO C++ XML x86...'; + + MsBuild -what ($pocoInstallDir + '\XML\XML_vs140.vcxproj') -task build -arch x86 -config debug_static_md -toolset $customToolset + MsBuild -what ($pocoInstallDir + '\XML\XML_vs140.vcxproj') -task build -arch x86 -config release_static_md -toolset $customToolset + + WriteConsole 'Building POCO C++ XML x64...'; + + MsBuild -what ($pocoInstallDir + '\XML\XML_x64_vs140.vcxproj') -task build -arch x64 -config debug_static_md -toolset $customToolset + MsBuild -what ($pocoInstallDir + '\XML\XML_x64_vs140.vcxproj') -task build -arch x64 -config release_static_md -toolset $customToolset + + WriteConsole 'Building POCO C++ Util x86...'; + + MsBuild -what ($pocoInstallDir + '\Util\Util_vs140.vcxproj') -task build -arch x86 -config debug_static_md -toolset $customToolset + MsBuild -what ($pocoInstallDir + '\Util\Util_vs140.vcxproj') -task build -arch x86 -config release_static_md -toolset $customToolset + + WriteConsole 'Building POCO C++ Util x64...'; + + MsBuild -what ($pocoInstallDir + '\Util\Util_x64_vs140.vcxproj') -task build -arch x64 -config debug_static_md -toolset $customToolset + MsBuild -what ($pocoInstallDir + '\Util\Util_x64_vs140.vcxproj') -task build -arch x64 -config release_static_md -toolset $customToolset + + WriteConsole 'Building POCO C++ Data x86...'; + + MsBuild -what ($pocoInstallDir + '\Data\Data_vs140.vcxproj') -task build -arch x86 -config debug_static_md -toolset $customToolset + MsBuild -what ($pocoInstallDir + '\Data\Data_vs140.vcxproj') -task build -arch x86 -config release_static_md -toolset $customToolset + + WriteConsole 'Building POCO C++ Data x64...'; + + MsBuild -what ($pocoInstallDir + '\Data\Data_x64_vs140.vcxproj') -task build -arch x64 -config debug_static_md -toolset $customToolset + MsBuild -what ($pocoInstallDir + '\Data\Data_x64_vs140.vcxproj') -task build -arch x64 -config release_static_md -toolset $customToolset + + WriteConsole 'Building POCO C++ Data\ODBC x86...'; + + MsBuild -what ($pocoInstallDir + '\Data\ODBC\ODBC_vs140.vcxproj') -task build -arch x86 -config debug_static_md -toolset $customToolset + MsBuild -what ($pocoInstallDir + '\Data\ODBC\ODBC_vs140.vcxproj') -task build -arch x86 -config release_static_md -toolset $customToolset + + WriteConsole 'Building POCO C++ Data\ODBC x64...'; + + MsBuild -what ($pocoInstallDir + '\Data\ODBC\ODBC_x64_vs140.vcxproj') -task build -arch x64 -config debug_static_md -toolset $customToolset + MsBuild -what ($pocoInstallDir + '\Data\ODBC\ODBC_x64_vs140.vcxproj') -task build -arch x64 -config release_static_md -toolset $customToolset + + ### + # clean-up: + + rmdir ($pocoInstallDir + '\Foundation\obj') -Recurse -Force; + rmdir ($pocoInstallDir + '\Foundation\obj64') -Recurse -Force; + rmdir ($pocoInstallDir + '\XML\obj') -Recurse -Force; + rmdir ($pocoInstallDir + '\XML\obj64') -Recurse -Force; + rmdir ($pocoInstallDir + '\Util\obj') -Recurse -Force; + rmdir ($pocoInstallDir + '\Util\obj64') -Recurse -Force; + rmdir ($pocoInstallDir + '\Data\obj') -Recurse -Force; + rmdir ($pocoInstallDir + '\Data\obj64') -Recurse -Force; + rmdir ($pocoInstallDir + '\Data\ODBC\obj') -Recurse -Force; + rmdir ($pocoInstallDir + '\Data\ODBC\obj64') -Recurse -Force; + + ri $pocoZipFPath -Force; +} + + +# # # # # +# Installs temporary certificates for the UWP apps +# +function InstallCertificates () +{ + WriteConsole 'Installing temporary certificates for UWP apps...'; + + $certificates = @( + @{ + path = $(pwd).Path + "\IntegrationTests\WinRT.UWP\IntegrationTestsApp.WinRT.UWP_TemporaryKey.pfx"; + password = "IntegrationTestsApp.WinRT.UWP_TemporaryKey.pfx"; + thumbprint = "96C28522337AD47DE34DD587105FCDA6194E93EE"; + }, + @{ + path = $(pwd).Path + "\UnitTests\WinRT.UWP\UnitTestsApp.WinRT.UWP_TemporaryKey.pfx"; + password = "UnitTestsApp.WinRT.UWP_TemporaryKey.pfx"; + thumbprint = "6A052BC56B5F0F365BF306C65D12A329916DCC3D"; + }, + @{ + path = $(pwd).Path + "\ImageTranscoderApp\ImageTranscoderApp_TemporaryKey.pfx"; + password = "ImageTranscoderApp_TemporaryKey.pfx"; + thumbprint = "BD2AD143C750BE18975B98FA70A9678EC55B2811"; + } + ); + + for ([Int32]$idx = 0; $idx -lt $certificates.Length; $idx++) + { + $certInfo = $certificates[$idx]; + + # certificate not yet installed? + if (@(gci cert:CurrentUser\My | Where-Object { $_.Thumbprint -eq $certInfo.thumbprint }).Length -eq 0) + { + Import-PfxCertificate -FilePath $certInfo.path ` + -CertStoreLocation cert:CurrentUser\My ` + -Password $(ConvertTo-SecureString -String $certInfo.password -Force –AsPlainText); + } + } +} + + +# # # # # +# Installs a copy of all X64 build output +# +function InstallCopyX64 ([bool]$xpToolset) +{ + [string]$outputDir; + + if ($xpToolset -eq $false) + { + $outputDir = 'x64\Release'; + } + else + { + $outputDir = 'x64\Release_XP'; + } + + mkdir -Path build\lib\x64 -Force; + mkdir -Path build\bin\x64 -Force; + + if ($(Test-Path "$outputDir\3FD.WinRT.UWP")) + { + copy "$outputDir\3FD.WinRT.UWP\*" build\lib\x64\; + } + + copy "$outputDir\3FD.lib" build\lib\x64\; + copy "$outputDir\*.exe" build\bin\x64\; + copy "$outputDir\*.config" build\bin\x64\; + copy "$outputDir\*.wsdl" build\bin\x64\; + copy "$outputDir\MetadataCopyMap.*" build\bin\x64\; + + if ($(Test-Path AppPackages)) + { + gci AppPackages ` + | gci -Filter *x64* ` + | Where-Object { -not $_.Name.Contains('Debug') } ` + | ForEach-Object -Process { move $_.FullName build\AppPackages\ -Force }; + } +} + + +# # # # # +# Installs a copy of all X86 build output +# +function InstallCopyX86 ([bool]$xpToolset) +{ + [string]$outputDir; + + if ($xpToolset -eq $false) + { + $outputDir = 'Win32\Release'; + } + else + { + $outputDir = 'Win32\Release_XP'; + } + + mkdir -Path build\lib\Win32 -Force; + mkdir -Path build\bin\Win32 -Force; + + if ($(Test-Path "$outputDir\3FD.WinRT.UWP")) + { + copy "$outputDir\3FD.WinRT.UWP\*" build\lib\Win32\; + } + + copy "$outputDir\3FD.lib" build\lib\Win32\; + copy "$outputDir\*.exe" build\bin\Win32\; + copy "$outputDir\*.config" build\bin\Win32\; + copy "$outputDir\*.wsdl" build\bin\Win32\; + copy "$outputDir\MetadataCopyMap.*" build\bin\Win32\; + + if ($(Test-Path AppPackages)) + { + gci AppPackages ` + | gci -Filter *Win32* ` + | Where-Object { -not $_.Name.Contains('Debug') } ` + | ForEach-Object -Process { move $_.FullName build\AppPackages\ -Force }; + } +} + + +# # # # # +# Installs a copy of all ARM build output +# +function InstallCopyARM ([bool]$xpToolset) +{ + if ($xpToolset -eq $false) + { + mkdir -Path build\lib\ARM -Force; + + copy ARM\Release\3FD.WinRT.UWP\* build\lib\ARM\; + + if ($(Test-Path AppPackages)) + { + gci AppPackages ` + | gci -Filter *ARM* ` + | Where-Object { -not $_.Name.Contains('Debug') } ` + | ForEach-Object -Process { move $_.FullName build\AppPackages\ -Force }; + } + } +} + + +# ============================================= +# MAIN ROUTINE +# ============================================= + +function Run () +{ + [string]$mustBuildBoost = $(Read-Host 'Build Boost libraries? (no/yes)'); + [string]$mustBuildPoco = $(Read-Host 'Build POCO C++ libraries? (no/yes)'); + + if ($mustBuildBoost -eq 'yes') + { + BuildBoostLibs; + } + + if ($mustBuildPoco -eq 'yes') + { + BuildPocoLibs; + } + + ### + # BUILD: + + if ($xp -eq 'yes') + { + $mode += '_xp'; + } + else + { + InstallCertificates; + } + + WriteConsole 'Building 3FD...'; + + if ($arch.ToLower() -eq 'all') + { + MsBuild -what 3FD.sln -task $task -arch x86 -config $mode; + MsBuild -what 3FD.sln -task $task -arch x64 -config $mode; + MsBuild -what 3FD.sln -task $task -arch ARM -config $mode; + } + else + { + MsBuild -what 3FD.sln -task $task -arch $arch -config $mode; + } + + ### + # INSTALL: + + if ($mode.ToLower().StartsWith('release') -eq $true) + { + WriteConsole 'Installing 3FD...'; + + if ($(Test-Path build)) + { + ri build -Recurse -Force; + } + + mkdir -Path build\AppPackages -Force; + + switch ($arch) + { + "x64" { InstallCopyX64 ($xp -eq 'yes'); } + "x86" { InstallCopyX86 ($xp -eq 'yes'); } + "arm" { InstallCopyARM ($xp -eq 'yes'); } + "all" { + InstallCopyX64 ($xp -eq 'yes'); + InstallCopyX86 ($xp -eq 'yes'); + InstallCopyARM ($xp -eq 'yes'); + } + default { + WriteConsole ('There is no defined installation procedure for architecture <' + $arch + '>'); + } + } + + copy 3FD\wsdl-example.wsdl build\ + copy 3FD\3fd-config-template.xml build\ + copy opencl-c-example* build\ + copy CreateMsSqlSvcBrokerDB.sql build\ + copy README build\ + copy LICENSE build\ + copy Acknowledgements.txt build\ + + mkdir -Path .\build\include\3FD -Force; + + copy 3FD\*.h build\include\3FD\; + copy btree build\include\ -Recurse; + copy OpenCL build\include\ -Recurse; + + WriteConsole ('Framework installation directory has been generated in <' + ($pwd).Path + '\build>'); + } + +}# end of Run + + +Run; diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..850d3d8 --- /dev/null +++ b/build.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +{ ls build || printf 'Run configure.sh first!'; } &> /dev/null + +cd gtest +make install +cd ../3FD +make install +cd ../UnitTests +make install +cd ../IntegrationTests +make install +cd ../ +cp 3FD/*.h build/include/3FD +cp -rf btree build/include/ +cp -rf OpenCL build/include/ +cp CreateMsSqlSvcBrokerDB.sql build/ +cp Acknowledgements.txt build/ +cp LICENSE build/ +cp README build/ diff --git a/cmake_build_scripts.tar.gz b/cmake_build_scripts.tar.gz deleted file mode 100644 index 89eec9e0e7e029ef2683ec1678a5511ea206197b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 750 zcmVJGxUr;fjKIMiyjWP$qBdrlnpP9{${?Of zMsX2bnk@V71M4iHEtSEw*5?-u#Jdxc|2_YQy9Y^r(1~2D6eYqiXne#5Rg%Yl)Uc{+ z1|>v^`(ca;tsz?NZ9TFMLVJZ!ZN@zJCwsnMUi*n6ZS-%l$$DPdEI3|&6&o7p&x54? zTDw`v94MeaB?jovgRK6}(x18W^@>TsqO5D==}%Q7qd!&R_*crhftNUQ{Xc(_C$29~ z>|h}X%vmgvDj58q z2QTVhQZmT(e~Q!ktBRtk;Qu^0SN|6`E-xO=0OB?Uh(&WiHj)JNUNb^6{^wzIuNABS zj`x2}Q^Ehau&;mlD}Y@8*Jw8X>x6*+^8oz63jg0k(n+iWlJP(E-LTXL|1HP+KfxO8 z|8n85{^jO?sgLC!&>h^zjQFKE7f6F3C16EN5sL1}m3jWW9wEoppfC{Yt zFzo;FVPF3@SpO+{cKt_S|BnwJB>!(GF#nZaT0f3J$oGGe(cg#$fdBIV{Qv*_|Ebz@x;X#< g000000000000000000000Qflk1rQtXfB;Yc0El*nU;qFB diff --git a/configure.sh b/configure.sh new file mode 100644 index 0000000..2638ec5 --- /dev/null +++ b/configure.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +MODE=$1 + +if [[ $MODE == $(echo $MODE | grep -i 'debug\|release') ]]; +then + CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=$MODE -DCMAKE_DEBUG_POSTFIX=d -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS=\"-std=c++11\"" +else + printf 'ERROR! Usage: ./configure.sh [debug|release]\n\n' + exit +fi + +export POCO_ROOT="/opt/poco-1.7.8p3" +export BOOST_HOME="/opt/boost-1.65.1" + +{ ls build/include/3FD || mkdir -p build/include/3FD; } &> /dev/null +{ ls build/lib || mkdir -p build/lib; } &> /dev/null +{ ls build/bin || mkdir -p build/bin; } &> /dev/null + +cd gtest +echo Cleaning gtest... +{ ls Makefile && make clean; } &> /dev/null +ls CMakeCache.txt &> /dev/null && rm CMakeCache.txt +ls CMakeFiles &> /dev/null && rm -rf CMakeFiles +echo Configuring gtest... +cmake $CMAKE_OPTIONS + +cd ../3FD +echo Cleaning 3FD... +{ ls Makefile && make clean; } &> /dev/null +ls CMakeCache.txt &> /dev/null && rm CMakeCache.txt +ls CMakeFiles &> /dev/null && rm -rf CMakeFiles +echo Configuring 3FD... +cmake $CMAKE_OPTIONS + +cd ../UnitTests +echo Cleaning UnitTests... +{ ls Makefile && make clean; } &> /dev/null +ls CMakeCache.txt &> /dev/null && rm CMakeCache.txt +ls CMakeFiles &> /dev/null && rm -rf CMakeFiles +echo Configuring UnitTests... +cmake $CMAKE_OPTIONS + +cd ../IntegrationTests +echo Cleaning IntegrationTests... +{ ls Makefile && make clean; } &> /dev/null +ls CMakeCache.txt &> /dev/null && rm CMakeCache.txt +ls CMakeFiles &> /dev/null && rm -rf CMakeFiles +echo Configuring IntegrationTests... +cmake $CMAKE_OPTIONS diff --git a/gtest/include/gtest/internal/gtest-port.h b/gtest/include/gtest/internal/gtest-port.h index 2423f56..e8e20da 100644 --- a/gtest/include/gtest/internal/gtest-port.h +++ b/gtest/include/gtest/internal/gtest-port.h @@ -227,7 +227,7 @@ #endif // __GNUC__ // Visual Studio: -#ifdef _MSC_VER +#if defined _MSC_VER && !defined _USING_V110_SDK71_ # include #endif diff --git a/gtest/msvc/gtest-md.vcxproj b/gtest/msvc/gtest-md.vcxproj index d0108c4..74fcf27 100644 --- a/gtest/msvc/gtest-md.vcxproj +++ b/gtest/msvc/gtest-md.vcxproj @@ -1,146 +1,266 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8} - Win32Proj - - - - StaticLibrary - v140 - MultiByte - - - StaticLibrary - v140 - MultiByte - - - StaticLibrary - v140 - MultiByte - - - StaticLibrary - v140 - MultiByte - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - - - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - Level3 - EditAndContinue - - - $(OutDir)gtestd.lib - - - - - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - $(OutDir)gtestd.lib - - - - - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - MultiThreadedDLL - - Level3 - ProgramDatabase - $(MSVC_X86_RELEASE_EINSTSET) %(AdditionalOptions) - - - $(OutDir)gtest.lib - - - - - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - $(MSVC_X64_RELEASE_EINSTSET) %(AdditionalOptions) - - - $(OutDir)gtest.lib - - - - - ..;..\include;%(AdditionalIncludeDirectories) - ..;..\include;%(AdditionalIncludeDirectories) - ..;..\include;%(AdditionalIncludeDirectories) - ..;..\include;%(AdditionalIncludeDirectories) - - - - - - - - + + + + + Debug_XP + Win32 + + + Debug_XP + x64 + + + Debug + Win32 + + + Debug + x64 + + + Release_XP + Win32 + + + Release_XP + x64 + + + Release + Win32 + + + Release + x64 + + + + {C8F6C172-56F2-4E76-B5FA-C3B423B31BE8} + Win32Proj + 8.1 + + + + StaticLibrary + v140 + MultiByte + + + StaticLibrary + v140_xp + MultiByte + + + StaticLibrary + v140 + MultiByte + + + StaticLibrary + v140_xp + MultiByte + + + StaticLibrary + v140 + MultiByte + + + StaticLibrary + v140_xp + MultiByte + + + StaticLibrary + v140 + MultiByte + + + StaticLibrary + v140_xp + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>12.0.30501.0 + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + + + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + EditAndContinue + + + $(OutDir)gtestd.lib + + + + + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + $(OutDir)gtestd.lib + + + + + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + $(OutDir)gtestd.lib + + + + + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + $(OutDir)gtestd.lib + + + + + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreadedDLL + + Level3 + ProgramDatabase + $(MSVC_X86_RELEASE_EINSTSET) %(AdditionalOptions) + + + $(OutDir)gtest.lib + + + + + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + $(MSVC_X86_RELEASE_EINSTSET) %(AdditionalOptions) + + + $(OutDir)gtest.lib + + + + + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + $(MSVC_X64_RELEASE_EINSTSET) %(AdditionalOptions) + + + $(OutDir)gtest.lib + + + + + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + $(MSVC_X64_RELEASE_EINSTSET) %(AdditionalOptions) + + + $(OutDir)gtest.lib + + + + + ..;..\include;%(AdditionalIncludeDirectories) + ..;..\include;%(AdditionalIncludeDirectories) + ..;..\include;%(AdditionalIncludeDirectories) + ..;..\include;%(AdditionalIncludeDirectories) + ..;..\include;%(AdditionalIncludeDirectories) + ..;..\include;%(AdditionalIncludeDirectories) + ..;..\include;%(AdditionalIncludeDirectories) + ..;..\include;%(AdditionalIncludeDirectories) + + + + + + + + \ No newline at end of file diff --git a/opencl-c-example-wrong.txt b/opencl-c-example-wrong.txt index 98c54a1..61e3e7d 100644 --- a/opencl-c-example-wrong.txt +++ b/opencl-c-example-wrong.txt @@ -1,6 +1,6 @@ -fucked void saxpy(const __global float * X, - __global float * Y, - const float a) +damaged void saxpy(const __global float * X, + __global float * Y, + const float a) { uint gid = get_global_id(0); Y[gid] = a* X[gid] + Y[gid]; diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..f9c4387 --- /dev/null +++ b/setup.sh @@ -0,0 +1,69 @@ +#!/bin/bash + +UBUNTU=$(cat /etc/issue | grep -i ubuntu | awk -F" " '{print $2}' | awk -F"." '{print $1}') +AMAZON=$(cat /etc/issue | grep -i "amazon linux ami release" | awk -F" " '{print $5}' | awk -F"." '{print $1}') + +# # # +# SETUP DEV ENV +# + +if [ -n "$UBUNTU" ] && [ $UBUNTU -gt 14 ]; then + apt install -y clang + apt install -y cmake + +elif [ -n "$AMAZON" ] && [ $AMAZON -gt 2017 ]; then + yum groups install -y development + yum groups install -y development-libs + yum install -y clang + export CC=clang + export CXX=clang++ + wget https://cmake.org/files/v3.8/cmake-3.8.2.tar.gz + tar -xf cmake-3.8.2.tar.gz + cd cmake-3.8.2 + ./bootstrap + make + make install + export PATH=$PATH:/usr/local/bin + cd .. + rm -rf ./cmake* + +else + echo OS UNSUPPORTED + exit +fi + +# # # +# INSTALL BOOST +# +boostVersion='1.65.1' +boostLabel="boost_1_65_1" +wget "https://dl.bintray.com/boostorg/release/$boostVersion/source/$boostLabel.tar.bz2" +tar -xf "$boostLabel.tar.bz2" +cd "$boostLabel/tools/build/" +./bootstrap.sh +cd ../../ +./tools/build/b2 -j 2 variant=debug link=static threading=multi toolset=clang runtime-link=shared --layout=tagged +./tools/build/b2 -j 2 variant=release link=static threading=multi toolset=clang runtime-link=shared --layout=tagged +BOOST_HOME="/opt/boost-$boostVersion" +mkdir $BOOST_HOME +mkdir $BOOST_HOME/include +mkdir $BOOST_HOME/lib +mv stage/lib/* $BOOST_HOME/lib/ +mv boost $BOOST_HOME/include/ +cd .. +rm -rf $boostLabel +rm "$boostLabel.tar.bz2" + +# # # +# INSTALL POCO +# +pocoLabel='poco-1.7.8p3' +wget "https://pocoproject.org/releases/poco-1.7.8/$pocoLabel.tar.gz" +tar -xf "$pocoLabel.tar.gz" +cd $pocoLabel +./configure --config=Linux-clang --static --no-tests --no-samples --prefix="/opt/$pocoLabel" +make -s -j2 +make install +cd .. +rm -rf $pocoLabel +rm "$pocoLabel.tar.gz"