diff options
| author | J M Rossy <[email protected]> | 2015-07-29 15:40:09 -0700 |
|---|---|---|
| committer | J M Rossy <[email protected]> | 2015-07-29 16:34:40 -0700 |
| commit | 5d61a4a79a1e96dc5d9af1e5e712c84507307544 (patch) | |
| tree | 49ed270893578cd18758b74ffcca16dc7ab948d6 /network/trans/WFPSampler/lib/HelperFunctions_FwpmEngine.cpp | |
| parent | 5d41613e26e147d2300c786bb2b34cb4b4067a25 (diff) | |
Samples update for public Windows 10 release
Fix #2 Enabling WPP Recorder in Sensors Samples causes errors
Fix #4 Add back fixed KMDOD sample
Add new BarcodeScanner sample in pos folder
Add new MagneticStripeReader sample in pos folder
Add new SynpaticsTouch sample in input folder
Add new Power Engine Plugin sample in pofx folder
Add new DeviceMft sample in avstream folder
Add new AvsCamera sample in root
Add new SimBatt sample in root
Add other pre-existing samples not yet released for Win10
Diffstat (limited to 'network/trans/WFPSampler/lib/HelperFunctions_FwpmEngine.cpp')
| -rw-r--r-- | network/trans/WFPSampler/lib/HelperFunctions_FwpmEngine.cpp | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/network/trans/WFPSampler/lib/HelperFunctions_FwpmEngine.cpp b/network/trans/WFPSampler/lib/HelperFunctions_FwpmEngine.cpp new file mode 100644 index 00000000..4ea15a8a --- /dev/null +++ b/network/trans/WFPSampler/lib/HelperFunctions_FwpmEngine.cpp @@ -0,0 +1,126 @@ +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2012 Microsoft Corporation. All Rights Reserved. +// +// Module Name: +// HelperFunctions_FwpmEngine.cpp +// +// Abstract: +// This module contains functions which assist in actions pertaining to BFE engine objects. +// +// Naming Convention: +// +// <Scope><Module><Object><Action><Modifier> +// +// i.e. +// +// <Scope> +// { +// - Function is likely visible to other modules. +// } +// <Module> +// { +// Hlpr - Function is from HelperFunctions_* Modules. +// } +// <Object> +// { +// FwpmEngine - Function pertains to BFE engine objects. +// } +// <Action> +// { +// Close - Function destroys a handle. +// Open - Function creates a handle. +// } +// <Modifier> +// { +// } +// +// Private Functions: +// +// Public Functions: +// HlprFwpmEngineClose(), +// HlprFwpmEngineOpen() +// +// Author: +// Dusty Harper (DHarper) +// +// Revision History: +// +// [ Month ][Day] [Year] - [Revision]-[ Comments ] +// May 01, 2010 - 1.0 - Creation +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "HelperFunctions_Include.h" /// . + +/** + @helper_function="HlprFwpmEngineOpen" + + Purpose: Wrapper for the FwpmEngineClose API. <br> + <br> + Notes: <br> + <br> + MSDN_Ref: HTTP://MSDN.Microsoft.com/En-US/Library/AA364034.aspx <br> +*/ +_When_(return == NO_ERROR, _At_(*pEngineHandle, _Post_ _Null_)) +_Success_(return == NO_ERROR) +UINT32 HlprFwpmEngineClose(_Inout_ HANDLE* pEngineHandle) +{ + ASSERT(pEngineHandle); + + UINT32 status = NO_ERROR; + + if(*pEngineHandle) + { + status = FwpmEngineClose(*pEngineHandle); + if(status != NO_ERROR) + { + HlprLogError(L"HlprFwpmEngineClose : FwpmEngineClose() [status: %#x]", + status); + + HLPR_BAIL; + } + + *pEngineHandle = 0; + } + + HLPR_BAIL_LABEL: + + return status; +} + +/** + @helper_function="HlprFwpmEngineOpen" + + Purpose: Wrapper for the FwpmEngineOpen API. <br> + <br> + Notes: <br> + <br> + MSDN_Ref: HTTP://MSDN.Microsoft.com/En-US/Library/AA364040.aspx <br> +*/ +_At_(*pEngineHandle, _Pre_ _Null_) +_When_(return != NO_ERROR, _At_(*pEngineHandle, _Post_ _Null_)) +_When_(return == NO_ERROR, _At_(*pEngineHandle, _Post_ _Notnull_)) +_Success_(return == NO_ERROR) +UINT32 HlprFwpmEngineOpen(_Out_ HANDLE* pEngineHandle, + _In_ const UINT32 sessionFlags) /* FWPM_SESSION_FLAG_NONDYNAMIC */ +{ + ASSERT(pEngineHandle); + + UINT32 status = NO_ERROR; + FWPM_SESSION session = {0}; + + session.displayData.name = L"WFPSampler's User Mode Session"; + session.flags = sessionFlags; + + status = FwpmEngineOpen(0, + RPC_C_AUTHN_WINNT, + 0, + &session, + pEngineHandle); + if(status != NO_ERROR) + HlprLogError(L"HlprFwpmEngineOpen : FwpmEngineOpen() [status: %#x]", + status); + + return status; +} |
