aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDenis Barkar <denis.barkar@gmail.com>2025-04-15 20:25:40 +0200
committerGitHub <noreply@github.com>2025-04-15 21:25:40 +0300
commit809f7e0021dbb7a0e5b2f67d54da2298f30a53c3 (patch)
treeee9b9b64a9b9cb352d4452426d2de2c9d0c76bc2 /src
parent5fd1dae9ebbca0718239168be060082a0d92ed7f (diff)
downloadlibADLMIDI-809f7e0021dbb7a0e5b2f67d54da2298f30a53c3.tar.gz
libADLMIDI-809f7e0021dbb7a0e5b2f67d54da2298f30a53c3.tar.bz2
libADLMIDI-809f7e0021dbb7a0e5b2f67d54da2298f30a53c3.zip
Serial: Fixed UWP build (#289)
Diffstat (limited to 'src')
-rw-r--r--src/chips/opl_serial_misc.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/chips/opl_serial_misc.h b/src/chips/opl_serial_misc.h
index a504a26..9fcd2e9 100644
--- a/src/chips/opl_serial_misc.h
+++ b/src/chips/opl_serial_misc.h
@@ -282,7 +282,19 @@ public:
this->close();
std::string portPath = "\\\\.\\" + portName;
- m_port = CreateFileA(portPath.c_str(), GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
+#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
+ std::wstring wportPath;
+ wportPath.resize(portPath.size());
+ int newSize = MultiByteToWideChar(CP_UTF8,
+ 0,
+ portPath.c_str(),
+ (int)portPath.size(),
+ (wchar_t *)wportPath.c_str(),
+ (int)wportPath.size());
+ m_port = CreateFile2(wportPath.c_str(), GENERIC_WRITE, 0, OPEN_EXISTING, NULL);
+#else
+ m_port = CreateFileA(portPath.c_str(), GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
+#endif
if(m_port == INVALID_HANDLE_VALUE)
{