Fix unicode shit
This commit is contained in:
parent
aee6d1d356
commit
2adee27862
@ -34,12 +34,12 @@ namespace Components
|
|||||||
|
|
||||||
if (hModule != NULL)
|
if (hModule != NULL)
|
||||||
{
|
{
|
||||||
if (GetModuleFileName(hModule, ownPth, MAX_PATH) == ERROR)
|
if (GetModuleFileNameA(hModule, ownPth, MAX_PATH) == ERROR)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetModuleFileName(hModule, workdir, MAX_PATH) == ERROR)
|
if (GetModuleFileNameA(hModule, workdir, MAX_PATH) == ERROR)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -61,15 +61,15 @@ namespace Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCurrentDirectory(workdir);
|
SetCurrentDirectoryA(workdir);
|
||||||
|
|
||||||
LONG openRes = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x\\shell\\open\\command", 0, KEY_ALL_ACCESS, &hKey);
|
LONG openRes = RegOpenKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x\\shell\\open\\command", 0, KEY_ALL_ACCESS, &hKey);
|
||||||
if (openRes == ERROR_SUCCESS)
|
if (openRes == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
char regred[MAX_PATH] = { 0 };
|
char regred[MAX_PATH] = { 0 };
|
||||||
|
|
||||||
// Check if the game has been moved.
|
// Check if the game has been moved.
|
||||||
openRes = RegQueryValueEx(hKey, 0, 0, 0, reinterpret_cast<BYTE*>(regred), &dwsize);
|
openRes = RegQueryValueExA(hKey, 0, 0, 0, reinterpret_cast<BYTE*>(regred), &dwsize);
|
||||||
if (openRes == ERROR_SUCCESS)
|
if (openRes == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
char* endPtr = strstr(regred, "\" \"%1\"");
|
char* endPtr = strstr(regred, "\" \"%1\"");
|
||||||
@ -85,7 +85,7 @@ namespace Components
|
|||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
if (strcmp(regred + 1, ownPth))
|
if (strcmp(regred + 1, ownPth))
|
||||||
{
|
{
|
||||||
openRes = RegDeleteKey(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x");
|
openRes = RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -94,16 +94,16 @@ namespace Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
openRes = RegDeleteKey(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x");
|
openRes = RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
openRes = RegDeleteKey(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x");
|
openRes = RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open SOFTWARE\\Classes
|
// Open SOFTWARE\\Classes
|
||||||
openRes = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE\\Classes", 0, KEY_ALL_ACCESS, &hKey);
|
openRes = RegOpenKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\Classes", 0, KEY_ALL_ACCESS, &hKey);
|
||||||
|
|
||||||
if (openRes != ERROR_SUCCESS)
|
if (openRes != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
@ -111,7 +111,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create SOFTWARE\\Classes\\iw4x
|
// Create SOFTWARE\\Classes\\iw4x
|
||||||
openRes = RegCreateKeyEx(hKey, "iw4x", 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &hKey, 0);
|
openRes = RegCreateKeyExA(hKey, "iw4x", 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &hKey, 0);
|
||||||
|
|
||||||
if (openRes != ERROR_SUCCESS)
|
if (openRes != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
@ -120,7 +120,7 @@ namespace Components
|
|||||||
|
|
||||||
// Write URL:IW4x Protocol
|
// Write URL:IW4x Protocol
|
||||||
data = "URL:IW4x Protocol";
|
data = "URL:IW4x Protocol";
|
||||||
openRes = RegSetValueEx(hKey, "URL Protocol", 0, REG_SZ, reinterpret_cast<const BYTE*>(data.data()), data.size() + 1);
|
openRes = RegSetValueExA(hKey, "URL Protocol", 0, REG_SZ, reinterpret_cast<const BYTE*>(data.data()), data.size() + 1);
|
||||||
|
|
||||||
if (openRes != ERROR_SUCCESS)
|
if (openRes != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
@ -129,7 +129,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create SOFTWARE\\Classes\\iw4x\\DefaultIcon
|
// Create SOFTWARE\\Classes\\iw4x\\DefaultIcon
|
||||||
openRes = RegCreateKeyEx(hKey, "DefaultIcon", 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &hKey, 0);
|
openRes = RegCreateKeyExA(hKey, "DefaultIcon", 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &hKey, 0);
|
||||||
|
|
||||||
if (openRes != ERROR_SUCCESS)
|
if (openRes != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
@ -137,7 +137,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
data = Utils::VA("%s,1", ownPth);
|
data = Utils::VA("%s,1", ownPth);
|
||||||
openRes = RegSetValueEx(hKey, 0, 0, REG_SZ, reinterpret_cast<const BYTE*>(data.data()), data.size() + 1);
|
openRes = RegSetValueExA(hKey, 0, 0, REG_SZ, reinterpret_cast<const BYTE*>(data.data()), data.size() + 1);
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
|
|
||||||
if (openRes != ERROR_SUCCESS)
|
if (openRes != ERROR_SUCCESS)
|
||||||
@ -146,14 +146,14 @@ namespace Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
openRes = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x", 0, KEY_ALL_ACCESS, &hKey);
|
openRes = RegOpenKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x", 0, KEY_ALL_ACCESS, &hKey);
|
||||||
|
|
||||||
if (openRes != ERROR_SUCCESS)
|
if (openRes != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
openRes = RegCreateKeyEx(hKey, "shell\\open\\command", 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &hKey, 0);
|
openRes = RegCreateKeyExA(hKey, "shell\\open\\command", 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &hKey, 0);
|
||||||
|
|
||||||
if (openRes != ERROR_SUCCESS)
|
if (openRes != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
@ -161,7 +161,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
data = Utils::VA("\"%s\" \"%s\"", ownPth, "%1");
|
data = Utils::VA("\"%s\" \"%s\"", ownPth, "%1");
|
||||||
openRes = RegSetValueEx(hKey, 0, 0, REG_SZ, reinterpret_cast<const BYTE*>(data.data()), data.size() + 1);
|
openRes = RegSetValueExA(hKey, 0, 0, REG_SZ, reinterpret_cast<const BYTE*>(data.data()), data.size() + 1);
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
|
|
||||||
if (openRes != ERROR_SUCCESS)
|
if (openRes != ERROR_SUCCESS)
|
||||||
@ -177,7 +177,7 @@ namespace Components
|
|||||||
if (ConnectProtocol::ConnectContainer.Evaluated) return;
|
if (ConnectProtocol::ConnectContainer.Evaluated) return;
|
||||||
ConnectProtocol::ConnectContainer.Evaluated = true;
|
ConnectProtocol::ConnectContainer.Evaluated = true;
|
||||||
|
|
||||||
std::string cmdLine = GetCommandLine();
|
std::string cmdLine = GetCommandLineA();
|
||||||
|
|
||||||
auto pos = cmdLine.find("iw4x://");
|
auto pos = cmdLine.find("iw4x://");
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ namespace Components
|
|||||||
{
|
{
|
||||||
std::string mapname = Dvar::Var("mapname").Get<const char*>();
|
std::string mapname = Dvar::Var("mapname").Get<const char*>();
|
||||||
std::string hostname = Colors::Strip(Dvar::Var("sv_hostname").Get<const char*>());
|
std::string hostname = Colors::Strip(Dvar::Var("sv_hostname").Get<const char*>());
|
||||||
SetConsoleTitle(hostname.data());
|
SetConsoleTitleA(hostname.data());
|
||||||
|
|
||||||
int clientCount = 0;
|
int clientCount = 0;
|
||||||
int maxclientCount = *Game::svs_numclients;
|
int maxclientCount = *Game::svs_numclients;
|
||||||
|
@ -19,7 +19,7 @@ namespace Components
|
|||||||
ltime = _localtime64(&time);
|
ltime = _localtime64(&time);
|
||||||
strftime(filename, sizeof(filename) - 1, "iw4x-" VERSION_STR "-%Y%m%d%H%M%S.dmp", ltime);
|
strftime(filename, sizeof(filename) - 1, "iw4x-" VERSION_STR "-%Y%m%d%H%M%S.dmp", ltime);
|
||||||
|
|
||||||
HANDLE hFile = CreateFile(filename, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
HANDLE hFile = CreateFileA(filename, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
|
|
||||||
if (hFile && hFile != INVALID_HANDLE_VALUE)
|
if (hFile && hFile != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ namespace Components
|
|||||||
this->mType = IPCTYPE_CLIENT;
|
this->mType = IPCTYPE_CLIENT;
|
||||||
this->SetName(name);
|
this->SetName(name);
|
||||||
|
|
||||||
this->hPipe = CreateFile(this->PipeFile, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
this->hPipe = CreateFileA(this->PipeFile, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||||
|
|
||||||
if (INVALID_HANDLE_VALUE == this->hPipe)
|
if (INVALID_HANDLE_VALUE == this->hPipe)
|
||||||
{
|
{
|
||||||
@ -60,7 +60,7 @@ namespace Components
|
|||||||
this->mType = IPCTYPE_SERVER;
|
this->mType = IPCTYPE_SERVER;
|
||||||
this->SetName(name);
|
this->SetName(name);
|
||||||
|
|
||||||
this->hPipe = CreateNamedPipe(this->PipeFile, PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, sizeof(this->mPacket), sizeof(this->mPacket), NMPWAIT_USE_DEFAULT_WAIT, NULL);
|
this->hPipe = CreateNamedPipeA(this->PipeFile, PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, sizeof(this->mPacket), sizeof(this->mPacket), NMPWAIT_USE_DEFAULT_WAIT, NULL);
|
||||||
|
|
||||||
if (INVALID_HANDLE_VALUE != this->hPipe)
|
if (INVALID_HANDLE_VALUE != this->hPipe)
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,7 @@ namespace Components
|
|||||||
|
|
||||||
if (Dedicated::IsDedicated() || ZoneBuilder::IsEnabled()) return;
|
if (Dedicated::IsDedicated() || ZoneBuilder::IsEnabled()) return;
|
||||||
|
|
||||||
Singleton::FirstInstance = (CreateMutex(NULL, FALSE, "iw4x_mutex") && GetLastError() != ERROR_ALREADY_EXISTS);
|
Singleton::FirstInstance = (CreateMutexA(NULL, FALSE, "iw4x_mutex") && GetLastError() != ERROR_ALREADY_EXISTS);
|
||||||
|
|
||||||
if (!Singleton::FirstInstance && !ConnectProtocol::Used() && MessageBoxA(0, "Do you want to start another instance?", "Game already running", MB_ICONEXCLAMATION | MB_YESNO) == IDNO)
|
if (!Singleton::FirstInstance && !ConnectProtocol::Used() && MessageBoxA(0, "Do you want to start another instance?", "Game already running", MB_ICONEXCLAMATION | MB_YESNO) == IDNO)
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,7 @@ namespace Steam
|
|||||||
RegQueryValueExA(hRegKey, "InstallPath", NULL, NULL, reinterpret_cast<BYTE*>(steamPath), &dwLength);
|
RegQueryValueExA(hRegKey, "InstallPath", NULL, NULL, reinterpret_cast<BYTE*>(steamPath), &dwLength);
|
||||||
RegCloseKey(hRegKey);
|
RegCloseKey(hRegKey);
|
||||||
|
|
||||||
SetDllDirectory(steamPath);
|
SetDllDirectoryA(steamPath);
|
||||||
|
|
||||||
Overlay = LoadLibraryA(::Utils::VA("%s\\%s", steamPath, "gameoverlayrenderer.dll"));
|
Overlay = LoadLibraryA(::Utils::VA("%s\\%s", steamPath, "gameoverlayrenderer.dll"));
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ namespace Utils
|
|||||||
|
|
||||||
void WebIO::OpenSession(std::string useragent)
|
void WebIO::OpenSession(std::string useragent)
|
||||||
{
|
{
|
||||||
WebIO::m_hSession = InternetOpen(useragent.data(), INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
|
WebIO::m_hSession = InternetOpenA(useragent.data(), INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebIO::CloseSession()
|
void WebIO::CloseSession()
|
||||||
@ -185,7 +185,7 @@ namespace Utils
|
|||||||
|
|
||||||
const char* username = (WebIO::m_username.size() ? WebIO::m_username.data() : NULL);
|
const char* username = (WebIO::m_username.size() ? WebIO::m_username.data() : NULL);
|
||||||
const char* password = (WebIO::m_password.size() ? WebIO::m_password.data() : NULL);
|
const char* password = (WebIO::m_password.size() ? WebIO::m_password.data() : NULL);
|
||||||
WebIO::m_hConnect = InternetConnect(WebIO::m_hSession, WebIO::m_sUrl.server.data(), wPort, username, password, dwService, dwFlag, 0);
|
WebIO::m_hConnect = InternetConnectA(WebIO::m_hSession, WebIO::m_sUrl.server.data(), wPort, username, password, dwService, dwFlag, 0);
|
||||||
|
|
||||||
return (WebIO::m_hConnect && WebIO::m_hConnect != INVALID_HANDLE_VALUE);
|
return (WebIO::m_hConnect && WebIO::m_hConnect != INVALID_HANDLE_VALUE);
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ namespace Utils
|
|||||||
//InternetSetOption(WebIO::m_hConnect, INTERNET_OPTION_RECEIVE_TIMEOUT, &m_timeout, sizeof(m_timeout));
|
//InternetSetOption(WebIO::m_hConnect, INTERNET_OPTION_RECEIVE_TIMEOUT, &m_timeout, sizeof(m_timeout));
|
||||||
//InternetSetOption(WebIO::m_hConnect, INTERNET_OPTION_SEND_TIMEOUT, &m_timeout, sizeof(m_timeout));
|
//InternetSetOption(WebIO::m_hConnect, INTERNET_OPTION_SEND_TIMEOUT, &m_timeout, sizeof(m_timeout));
|
||||||
|
|
||||||
WebIO::m_hFile = HttpOpenRequest(WebIO::m_hConnect, command, WebIO::m_sUrl.document.data(), NULL, NULL, acceptTypes, dwFlag, 0);
|
WebIO::m_hFile = HttpOpenRequestA(WebIO::m_hConnect, command, WebIO::m_sUrl.document.data(), NULL, NULL, acceptTypes, dwFlag, 0);
|
||||||
|
|
||||||
if (!WebIO::m_hFile || WebIO::m_hFile == INVALID_HANDLE_VALUE)
|
if (!WebIO::m_hFile || WebIO::m_hFile == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
@ -225,7 +225,7 @@ namespace Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char* headers = "Content-type: application/x-www-form-urlencoded";
|
const char* headers = "Content-type: application/x-www-form-urlencoded";
|
||||||
HttpSendRequest(WebIO::m_hFile, headers, strlen(headers), const_cast<char*>(body.data()), body.size() + 1);
|
HttpSendRequestA(WebIO::m_hFile, headers, strlen(headers), const_cast<char*>(body.data()), body.size() + 1);
|
||||||
|
|
||||||
std::string returnBuffer;
|
std::string returnBuffer;
|
||||||
|
|
||||||
@ -353,7 +353,7 @@ namespace Utils
|
|||||||
{
|
{
|
||||||
list.clear();
|
list.clear();
|
||||||
|
|
||||||
WIN32_FIND_DATA findFileData;
|
WIN32_FIND_DATAA findFileData;
|
||||||
bool result = false;
|
bool result = false;
|
||||||
DWORD dwAttribute = (files ? FILE_ATTRIBUTE_NORMAL : FILE_ATTRIBUTE_DIRECTORY);
|
DWORD dwAttribute = (files ? FILE_ATTRIBUTE_NORMAL : FILE_ATTRIBUTE_DIRECTORY);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user