mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-29 07:51:01 +00:00
Extract device creation
This commit is contained in:
29
src/windows-emulator/io_device.cpp
Normal file
29
src/windows-emulator/io_device.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "io_device.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
struct dummy_device : stateless_device
|
||||
{
|
||||
void read() override
|
||||
{
|
||||
}
|
||||
|
||||
void write() override
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
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")
|
||||
{
|
||||
return std::make_unique<dummy_device>();
|
||||
}
|
||||
|
||||
throw std::runtime_error("Unsupported device: " + std::string(device.begin(), device.end()));
|
||||
}
|
||||
Reference in New Issue
Block a user