mirror of
https://github.com/Relintai/mono.git
synced 2024-11-20 10:57:23 +01:00
Fix windows build.
This commit is contained in:
parent
7096add4fd
commit
a1f2ac9c98
@ -71,12 +71,12 @@ LONG _RegKeyQueryString(HKEY hKey, const String &p_value_name, String &r_value)
|
||||
buffer.resize(512);
|
||||
DWORD dwBufferSize = buffer.size();
|
||||
|
||||
LONG res = RegQueryValueExW(hKey, p_value_name.c_str(), 0, NULL, (LPBYTE)buffer.ptr(), &dwBufferSize);
|
||||
LONG res = RegQueryValueExW(hKey, (LPCWSTR)p_value_name.utf16().get_data(), 0, NULL, (LPBYTE)buffer.ptr(), &dwBufferSize);
|
||||
|
||||
if (res == ERROR_MORE_DATA) {
|
||||
// dwBufferSize now contains the actual size
|
||||
buffer.resize(dwBufferSize);
|
||||
res = RegQueryValueExW(hKey, p_value_name.c_str(), 0, NULL, (LPBYTE)buffer.ptr(), &dwBufferSize);
|
||||
res = RegQueryValueExW(hKey, (LPCWSTR)p_value_name.utf16().get_data(), 0, NULL, (LPBYTE)buffer.ptr(), &dwBufferSize);
|
||||
}
|
||||
|
||||
if (res == ERROR_SUCCESS) {
|
||||
@ -90,7 +90,7 @@ LONG _RegKeyQueryString(HKEY hKey, const String &p_value_name, String &r_value)
|
||||
|
||||
LONG _find_mono_in_reg(const String &p_subkey, MonoRegInfo &r_info, bool p_old_reg = false) {
|
||||
HKEY hKey;
|
||||
LONG res = _RegOpenKey(HKEY_LOCAL_MACHINE, p_subkey.c_str(), &hKey);
|
||||
LONG res = _RegOpenKey(HKEY_LOCAL_MACHINE, (LPCWSTR)p_subkey.utf16().get_data(), &hKey);
|
||||
|
||||
if (res != ERROR_SUCCESS)
|
||||
goto cleanup;
|
||||
@ -127,7 +127,7 @@ LONG _find_mono_in_reg_old(const String &p_subkey, MonoRegInfo &r_info) {
|
||||
String default_clr;
|
||||
|
||||
HKEY hKey;
|
||||
LONG res = _RegOpenKey(HKEY_LOCAL_MACHINE, p_subkey.c_str(), &hKey);
|
||||
LONG res = _RegOpenKey(HKEY_LOCAL_MACHINE, (LPCWSTR)p_subkey.utf16().get_data(), &hKey);
|
||||
|
||||
if (res != ERROR_SUCCESS)
|
||||
goto cleanup;
|
||||
|
@ -83,11 +83,13 @@ String cwd() {
|
||||
#ifdef WINDOWS_ENABLED
|
||||
const DWORD expected_size = ::GetCurrentDirectoryW(0, NULL);
|
||||
|
||||
String buffer;
|
||||
buffer.resize((int)expected_size);
|
||||
if (::GetCurrentDirectoryW(expected_size, buffer.ptrw()) == 0)
|
||||
Char16String cbuffer;
|
||||
cbuffer.resize((int)expected_size);
|
||||
if (::GetCurrentDirectoryW(expected_size, (LPWSTR)cbuffer.ptrw()) == 0)
|
||||
return ".";
|
||||
|
||||
String buffer = String::utf16(cbuffer.get_data());
|
||||
|
||||
return buffer.simplify_path();
|
||||
#else
|
||||
char buffer[PATH_MAX];
|
||||
@ -113,7 +115,7 @@ String abspath(const String &p_path) {
|
||||
String realpath(const String &p_path) {
|
||||
#ifdef WINDOWS_ENABLED
|
||||
// Open file without read/write access
|
||||
HANDLE hFile = ::CreateFileW(p_path.c_str(), 0,
|
||||
HANDLE hFile = ::CreateFileW((LPCWSTR)p_path.utf16().get_data(), 0,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
@ -127,9 +129,11 @@ String realpath(const String &p_path) {
|
||||
return p_path;
|
||||
}
|
||||
|
||||
String buffer;
|
||||
buffer.resize((int)expected_size);
|
||||
::GetFinalPathNameByHandleW(hFile, buffer.ptrw(), expected_size, FILE_NAME_NORMALIZED);
|
||||
Char16String cbuffer;
|
||||
cbuffer.resize((int)expected_size);
|
||||
::GetFinalPathNameByHandleW(hFile, (LPWSTR)cbuffer.ptrw(), expected_size, FILE_NAME_NORMALIZED);
|
||||
|
||||
String buffer = String::utf16(cbuffer.get_data());
|
||||
|
||||
::CloseHandle(hFile);
|
||||
return buffer.simplify_path();
|
||||
|
Loading…
Reference in New Issue
Block a user