From c3954623835df54346b25479ec2e7bd0462e47e6 Mon Sep 17 00:00:00 2001 From: Adonais Romero Gonzalez Date: Mon, 29 Jan 2024 14:23:14 -0800 Subject: Remove WinHEC 2017 samples --- .../App/CustomCapability/cpp/RpcClient.cpp | 177 --------------------- 1 file changed, 177 deletions(-) delete mode 100644 general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcClient.cpp (limited to 'general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcClient.cpp') diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcClient.cpp b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcClient.cpp deleted file mode 100644 index 870d6306..00000000 --- a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcClient.cpp +++ /dev/null @@ -1,177 +0,0 @@ -//********************************************************* -// -// Copyright (c) Microsoft. All rights reserved. -// This code is licensed under the MIT License (MIT). -// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY -// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR -// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. -// -//********************************************************* - -// There is an error in the system header files that incorrectly -// places RpcStringBindingCompose in the app partition. -// Work around it by changing the WINAPI_FAMILY to desktop temporarily. -#pragma push_macro("WINAPI_FAMILY") -#undef WINAPI_FAMILY -#define WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP -#include "RpcClient.h" -#pragma pop_macro("WINAPI_FAMILY") - -using namespace SDKTemplate; - -__int64 RpcClient::Initialize() -{ - RPC_STATUS status; - RPC_WSTR pszStringBinding = nullptr; - - status = RpcStringBindingCompose( - NULL, - reinterpret_cast(L"ncalrpc"), - NULL, - reinterpret_cast(RPC_STATIC_ENDPOINT), - NULL, - &pszStringBinding); - - if (status) - { - goto error_status; - } - - status = RpcBindingFromStringBinding( - pszStringBinding, - &hRpcBinding); - - if (status) - { - goto error_status; - } - - status = RpcStringFree(&pszStringBinding); - - if (status) - { - goto error_status; - } - - RpcTryExcept - { - ::RemoteOpen(hRpcBinding, &phContext); - } - RpcExcept(1) - { - status = RpcExceptionCode(); - } - RpcEndExcept - -error_status: - - return status; -} - -// -// Make RPC call to start metering. This is a blocking call and -// will return only after StopMetering is called. -// -__int64 RpcClient::StartMeteringAndWaitForStop(__int64 samplePeriod) -{ - __int64 ulCode = 0; - CallbackCount = 0; - MeteringData = 0; - - RpcTryExcept - { - ::StartMetering(phContext, samplePeriod, (__int64)this); - } - RpcExcept(1) - { - ulCode = RpcExceptionCode(); - } - RpcEndExcept - - return ulCode; -} - - -// -// Make rpc call SetSampleRate -// -__int64 RpcClient::SetSampleRate(int rate) -{ - __int64 ulCode = 0; - RpcTryExcept - { - ::SetSamplePeriod(phContext, rate); - } - RpcExcept(1) - { - ulCode = RpcExceptionCode(); - } - RpcEndExcept - return ulCode; -} - -// -// Make rpc call StopMetering -// -__int64 RpcClient::StopMetering() -{ - __int64 ulCode = 0; - RpcTryExcept - { - ::StopMetering(phContext); - } - RpcExcept(1) - { - ulCode = RpcExceptionCode(); - } - RpcEndExcept - return ulCode; -} - -RpcClient::~RpcClient() -{ - RPC_STATUS status; - - if (hRpcBinding != NULL) - { - RpcTryExcept - { - ::RemoteClose(&phContext); - } - RpcExcept(1) - { - // Ignoring the result of RemoteClose as nothing can be - // done on the client side with this return code - status = RpcExceptionCode(); - } - RpcEndExcept - - status = RpcBindingFree(&hRpcBinding); - hRpcBinding = NULL; - } -} - -// -// Metering rpc callback -// -void MeteringDataEvent(__int64 data, __int64 context) -{ - RpcClient* client = static_cast((PVOID)context); - client->MeteringData = data; - ++client->CallbackCount; -} - -///******************************************************/ -///* MIDL allocate and free */ -///******************************************************/ - -void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) -{ - return(malloc(len)); -} - -void __RPC_USER midl_user_free(void __RPC_FAR * ptr) -{ - free(ptr); -} \ No newline at end of file -- cgit v1.3.1