build: remove unused platform/MSWindowsUtils

This commit is contained in:
sithlord48
2025-05-31 12:48:21 -04:00
committed by Nick Bolton
parent 7e4d43f1cc
commit da06e97521
3 changed files with 0 additions and 76 deletions

View File

@ -48,8 +48,6 @@ if(WIN32)
MSWindowsScreenSaver.h
MSWindowsSession.cpp
MSWindowsSession.h
MSWindowsUtil.cpp
MSWindowsUtil.h
MSWindowsWatchdog.cpp
MSWindowsWatchdog.h
)

View File

@ -1,44 +0,0 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
* SPDX-FileCopyrightText: (C) 2004 Chris Schoeneman
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
*/
#include "platform/MSWindowsUtil.h"
#include "base/String.h"
#include <stdio.h>
//
// MSWindowsUtil
//
std::string MSWindowsUtil::getString(HINSTANCE instance, DWORD id)
{
char *msg = nullptr;
int n = LoadString(instance, id, reinterpret_cast<LPSTR>(&msg), 0);
if (n <= 0) {
return std::string();
}
return std::string(msg, n);
}
std::string MSWindowsUtil::getErrorString(HINSTANCE hinstance, DWORD error, DWORD id)
{
char *buffer;
if (FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, 0, error,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&buffer, 0, nullptr
) == 0) {
std::string errorString = deskflow::string::sprintf("%d", error);
return deskflow::string::format(getString(hinstance, id).c_str(), errorString.c_str());
} else {
std::string result(buffer);
LocalFree(buffer);
return result;
}
}

View File

@ -1,30 +0,0 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
* SPDX-FileCopyrightText: (C) 2004 Chris Schoeneman
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
*/
#pragma once
#include <string>
#define WINDOWS_LEAN_AND_MEAN
#include <Windows.h>
class MSWindowsUtil
{
public:
//! Get message string
/*!
Gets a string for \p id from the string table of \p instance.
*/
static std::string getString(HINSTANCE instance, DWORD id);
//! Get error string
/*!
Gets a system error message for \p error. If the error cannot be
found return the string for \p id, replacing ${1} with \p error.
*/
static std::string getErrorString(HINSTANCE, DWORD error, DWORD id);
};