forked from microsoft/ebpf-for-windows
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add additional netsh tests (microsoft#298)
Fix a couple bugs that the tests uncovered Remove duplicate "error: error:" prefix in messages on verification Fixes microsoft#240 Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com> Co-authored-by: Alan Jowett <alanjo@microsoft.com>
- Loading branch information
1 parent
b0bb089
commit 5a5dbc6
Showing
7 changed files
with
140 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// SPDX-License-Identifier: MIT | ||
#pragma once | ||
#include "ebpf_api.h" | ||
#include "ebpf_core.h" | ||
#include "mock.h" | ||
|
||
BOOL | ||
GlueCloseHandle(ebpf_handle_t hObject); | ||
|
||
ebpf_handle_t | ||
GlueCreateFileW( | ||
PCWSTR lpFileName, | ||
DWORD dwDesiredAccess, | ||
DWORD dwShareMode, | ||
PSECURITY_ATTRIBUTES lpSecurityAttributes, | ||
DWORD dwCreationDisposition, | ||
DWORD dwFlagsAndAttributes, | ||
ebpf_handle_t hTemplateFile); | ||
|
||
BOOL | ||
GlueDeviceIoControl( | ||
ebpf_handle_t hDevice, | ||
DWORD dwIoControlCode, | ||
PVOID lpInBuffer, | ||
DWORD nInBufferSize, | ||
LPVOID lpOutBuffer, | ||
DWORD nOutBufferSize, | ||
PDWORD lpBytesReturned, | ||
OVERLAPPED* lpOverlapped); | ||
|
||
class _test_helper_end_to_end | ||
{ | ||
public: | ||
_test_helper_end_to_end() | ||
{ | ||
device_io_control_handler = GlueDeviceIoControl; | ||
create_file_handler = GlueCreateFileW; | ||
close_handle_handler = GlueCloseHandle; | ||
REQUIRE(ebpf_core_initiate() == EBPF_SUCCESS); | ||
ec_initialized = true; | ||
REQUIRE(ebpf_api_initiate() == EBPF_SUCCESS); | ||
api_initialized = true; | ||
} | ||
~_test_helper_end_to_end() | ||
{ | ||
if (api_initialized) | ||
ebpf_api_terminate(); | ||
if (ec_initialized) | ||
ebpf_core_terminate(); | ||
|
||
device_io_control_handler = nullptr; | ||
create_file_handler = nullptr; | ||
close_handle_handler = nullptr; | ||
} | ||
|
||
private: | ||
bool ec_initialized = false; | ||
bool api_initialized = false; | ||
}; |
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