-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a500c66
commit ed5f4a8
Showing
26 changed files
with
1,233 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
TaskExplorer/API/Windows/Monitors/Etw/krabs/testing/event_filter_proxy.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
#pragma once | ||
|
||
#define INITGUID | ||
|
||
|
||
#include "../compiler_check.hpp" | ||
#include "../filtering/event_filter.hpp" | ||
#include "synth_record.hpp" | ||
|
||
namespace krabs { namespace testing { | ||
|
||
/** | ||
* <summary> | ||
* Serves as a fill-in for the event_filter class for testing purposes. | ||
* It acts as a liason for the actual filter instance and allows for forced event | ||
* testing. | ||
* </summary> | ||
*/ | ||
class event_filter_proxy { | ||
public: | ||
|
||
/** | ||
* <summary> | ||
* Constructs a proxy for the given event_filter. | ||
* </summary> | ||
* <example> | ||
* krabs::event_filter event_filter; | ||
* krabs::testing::event_filter_proxy proxy(event_filter); | ||
* </example> | ||
*/ | ||
event_filter_proxy(krabs::event_filter &filter); | ||
|
||
/** | ||
* <summary> | ||
* Pushes an event through to the proxied filter instance. | ||
* </summary> | ||
* <example> | ||
* krabs::event_filter event_filter; | ||
* krabs::testing::event_filter_proxy proxy(event_filter); | ||
* | ||
* krabs::guid powershell(L"{A0C1853B-5C40-4B15-8766-3CF1C58F985A}"); | ||
* krabs::testing::record_builder builder(powershell, krabs::id(7942), krabs::version(1)); | ||
* | ||
* builder.add_properties() | ||
* (L"ClassName", L"FakeETWEventForRealz") | ||
* (L"Message", L"This message is completely faked"); | ||
* | ||
* auto record = builder.pack_incomplete(); | ||
* proxy.push_event(record); | ||
* </example> | ||
*/ | ||
void push_event(const synth_record &record); | ||
|
||
private: | ||
krabs::event_filter &event_filter_; | ||
}; | ||
|
||
// Implementation | ||
// ------------------------------------------------------------------------ | ||
|
||
inline event_filter_proxy::event_filter_proxy(krabs::event_filter &event_filter) | ||
: event_filter_(event_filter) | ||
{ | ||
} | ||
|
||
inline void event_filter_proxy::push_event(const synth_record &record) | ||
{ | ||
event_filter_.on_event(record); | ||
} | ||
|
||
} /* namespace testing */ } /* namespace krabs */ |
Oops, something went wrong.