Skip to content

Commit

Permalink
Add afd endpoint device
Browse files Browse the repository at this point in the history
First step towards networking support #15
  • Loading branch information
momo5502 committed Nov 6, 2024
1 parent e80b3e5 commit 8e67dfc
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
20 changes: 20 additions & 0 deletions src/windows-emulator/devices/afd_endpoint.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "afd_endpoint.hpp"

#include "windows-emulator/windows_emulator.hpp"

namespace
{
struct afd_endpoint : stateless_device
{
NTSTATUS io_control(const io_device_context& c) override
{
c.win_emu.logger.print(color::cyan, "AFD IOCTL: %X\n", c.io_control_code);
return STATUS_SUCCESS;
}
};
}

std::unique_ptr<io_device> create_afd_endpoint()
{
return std::make_unique<afd_endpoint>();
}
4 changes: 4 additions & 0 deletions src/windows-emulator/devices/afd_endpoint.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#pragma once
#include "../io_device.hpp"

std::unique_ptr<io_device> create_afd_endpoint();
9 changes: 7 additions & 2 deletions src/windows-emulator/io_device.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "io_device.hpp"
#include "devices/afd_endpoint.hpp"

namespace
{
Expand All @@ -16,11 +17,15 @@ std::unique_ptr<io_device> create_device(const std::wstring_view device)
if (device == L"CNG"
|| device == L"KsecDD"
|| device == L"DeviceApi\\CMApi"
|| device == L"ConDrv\\Server"
|| device == L"Afd\\Endpoint")
|| device == L"ConDrv\\Server")
{
return std::make_unique<dummy_device>();
}

if (device == L"Afd\\Endpoint")
{
return create_afd_endpoint();
}

throw std::runtime_error("Unsupported device: " + std::string(device.begin(), device.end()));
}

0 comments on commit 8e67dfc

Please sign in to comment.