Remove implicit conversion operator from RString to const char* (Win32)

follows up on 6a29f651c7 and ecfcb11a00
This commit is contained in:
sukibaby
2025-06-11 07:32:24 -07:00
committed by teejusb
parent d65140c6fd
commit 8c6c2524bb
11 changed files with 60 additions and 59 deletions
+4 -4
View File
@@ -53,7 +53,7 @@ static INT_PTR CALLBACK OKWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
// Set static text.
RString sMessage = g_sMessage;
Replace(sMessage, "\n", "\r\n" );
SetWindowText( GetDlgItem(hWnd, IDC_MESSAGE), sMessage );
SetWindowText( GetDlgItem(hWnd, IDC_MESSAGE), sMessage.c_str() );
// Focus is on any of the controls in the dialog by default.
// I'm not sure why. Set focus to the button manually. -Chris
@@ -119,7 +119,7 @@ Dialog::Result DialogDriver_Win32::OKCancel( RString sMessage, RString sID )
#if !defined(SMPACKAGE)
//DialogBox( handle.Get(), MAKEINTRESOURCE(IDD_OK), ::GetHwnd(), OKWndProc );
int result = ::MessageBox( nullptr, sMessage, GetWindowTitle(), MB_OKCANCEL );
int result = ::MessageBox( nullptr, sMessage.c_str(), GetWindowTitle().c_str(), MB_OKCANCEL );
#else
int result = ::AfxMessageBox( ConvertUTF8ToACP(sMessage).c_str(), MB_OKCANCEL, 0 );
#endif
@@ -149,7 +149,7 @@ static INT_PTR CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM
// Set static text
RString sMessage = g_sErrorString;
Replace(sMessage, "\n", "\r\n" );
SetWindowText( GetDlgItem(hWnd, IDC_EDIT_ERROR), sMessage );
SetWindowText( GetDlgItem(hWnd, IDC_EDIT_ERROR), sMessage.c_str() );
}
break;
case WM_COMMAND:
@@ -163,7 +163,7 @@ static INT_PTR CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM
RString sAppDataDir = SpecialDirs::GetAppDataDir();
RString sCommand = "notepad \"" + sAppDataDir + PRODUCT_ID + "/Logs/log.txt\"";
CreateProcess(
CreateProcess( // TODO: resolve Warning C6335 "leaking process information"
nullptr, // pointer to name of executable module
const_cast<char *>(sCommand.c_str()), // pointer to command line string
nullptr, // process security attributes
@@ -154,7 +154,7 @@ LightsDriver_SextetStreamToFile::LightsDriver_SextetStreamToFile(const RString&
{
#ifdef WINDOWS
_impl = new SextetImpl(CreateFile(
filename, // pipe name
filename.c_str(), // pipe name
GENERIC_WRITE,
0, // no sharing
NULL, // default security attributes
@@ -170,7 +170,7 @@ LightsDriver_SextetStreamToFile::LightsDriver_SextetStreamToFile()
{
#ifdef WINDOWS
_impl = new SextetImpl(CreateFile(
g_sSextetStreamOutputFilename.Get(), // pipe name
g_sSextetStreamOutputFilename.Get().c_str(), // pipe name
GENERIC_WRITE,
0, // no sharing
NULL, // default security attributes
@@ -42,19 +42,19 @@ static void DestroyGraphicsWindowAndOpenGLContext()
void *LowLevelWindow_Win32::GetProcAddress( RString s )
{
void *pRet = (void*) wglGetProcAddress( s );
void *pRet = (void*) wglGetProcAddress( s.c_str() );
if( pRet != nullptr )
return pRet;
if (g_HGL_Module != nullptr)
{
pRet = (void *) ::GetProcAddress( g_HGL_Module, s );
pRet = (void *) ::GetProcAddress( g_HGL_Module, s.c_str() );
if (pRet != nullptr)
return pRet;
}
return (void*) ::GetProcAddress( GetModuleHandle(nullptr), s );
return (void*) ::GetProcAddress( GetModuleHandle(nullptr), s.c_str() );
}
LowLevelWindow_Win32::LowLevelWindow_Win32()
@@ -29,7 +29,7 @@ static bool TestReady( const RString &sDrive, RString &sVolumeLabelOut )
TCHAR szFileSystemNameBuffer[MAX_PATH];
if( !GetVolumeInformation(
sDrive,
sDrive.c_str(),
szVolumeNameBuffer,
sizeof(szVolumeNameBuffer),
&dwVolumeSerialNumber,
@@ -76,7 +76,7 @@ static bool IsFloppyDrive( const RString &sDrive )
{
char szBuf[1024];
int iRet = QueryDosDevice( sDrive, szBuf, 1024 );
int iRet = QueryDosDevice( sDrive.c_str(), szBuf, 1024 );
if( iRet == 0 )
{
LOG->Warn( werr_ssprintf(GetLastError(), "QueryDosDevice(%s)", sDrive.c_str()) );
@@ -116,7 +116,8 @@ void MemoryCardDriverThreaded_Windows::GetUSBStorageDevices( std::vector<UsbStor
LOG->Trace( sDrive );
if( IsFloppyDrive(sDrive) )
// we definitely don't need this lol
if (IsFloppyDrive(sDrive.c_str()))
{
LOG->Trace( "IsFloppyDrive" );
continue;
@@ -127,7 +128,7 @@ void MemoryCardDriverThreaded_Windows::GetUSBStorageDevices( std::vector<UsbStor
bool bIsSpecifiedMountPoint = false;
FOREACH_ENUM( PlayerNumber, p )
bIsSpecifiedMountPoint |= EqualsNoCase(MEMCARDMAN->m_sMemoryCardOsMountPoint[p].Get(), sDrive);
bIsSpecifiedMountPoint |= EqualsNoCase(MEMCARDMAN->m_sMemoryCardOsMountPoint[p].Get(), sDrive.c_str());
RString sDrivePath = sDrive + "\\";
@@ -137,7 +138,7 @@ void MemoryCardDriverThreaded_Windows::GetUSBStorageDevices( std::vector<UsbStor
}
else
{
if( GetDriveType(sDrivePath) != DRIVE_REMOVABLE )
if( GetDriveType(sDrivePath.c_str()) != DRIVE_REMOVABLE )
{
LOG->Trace( "not DRIVE_REMOVABLE" );
continue;
@@ -145,7 +146,7 @@ void MemoryCardDriverThreaded_Windows::GetUSBStorageDevices( std::vector<UsbStor
}
RString sVolumeLabel;
if( !TestReady(sDrivePath, sVolumeLabel) )
if( !TestReady(sDrivePath.c_str(), sVolumeLabel) )
{
LOG->Trace( "not TestReady" );
continue;
@@ -153,8 +154,8 @@ void MemoryCardDriverThreaded_Windows::GetUSBStorageDevices( std::vector<UsbStor
vDevicesOut.push_back( UsbStorageDevice() );
UsbStorageDevice &usbd = vDevicesOut.back();
usbd.SetOsMountDir( sDrive );
usbd.sDevice = "\\\\.\\" + sDrive;
usbd.SetOsMountDir( sDrive.c_str() );
usbd.sDevice = RString("\\\\.\\") + sDrive.c_str();
usbd.sVolumeLabel = sVolumeLabel;
}
@@ -171,7 +172,7 @@ void MemoryCardDriverThreaded_Windows::GetUSBStorageDevices( std::vector<UsbStor
DWORD dwNumberOfFreeClusters;
DWORD dwTotalNumberOfClusters;
if( GetDiskFreeSpace(
usbd.sOsMountDir,
usbd.sOsMountDir.c_str(),
&dwSectorsPerCluster,
&dwBytesPerSector,
&dwNumberOfFreeClusters,
@@ -196,7 +197,7 @@ bool MemoryCardDriverThreaded_Windows::Mount( UsbStorageDevice* pDevice )
void MemoryCardDriverThreaded_Windows::Unmount( UsbStorageDevice* pDevice )
{
/* Try to flush the device before returning. This requires administrator priviliges. */
HANDLE hDevice = CreateFile( pDevice->sDevice, GENERIC_WRITE,
HANDLE hDevice = CreateFile( pDevice->sDevice.c_str(), GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr );
+1 -1
View File
@@ -586,7 +586,7 @@ static void debug_crash()
* If iID == GetInvalidThreadId(), then output a stack trace for every thread. */
void CrashHandler::ForceDeadlock( RString reason, uint64_t iID )
{
strncpy( g_CrashInfo.m_CrashReason, reason, sizeof(g_CrashInfo.m_CrashReason) );
strncpy( g_CrashInfo.m_CrashReason, reason.c_str(), sizeof(g_CrashInfo.m_CrashReason) );
g_CrashInfo.m_CrashReason[ sizeof(g_CrashInfo.m_CrashReason)-1 ] = 0;
/* Suspend the other thread we're going to backtrace. (We need to at least
+15 -15
View File
@@ -411,7 +411,7 @@ RString SpliceProgramPath( RString fn )
char szModName[MAX_PATH];
char *pszFile;
GetFullPathName( szBuf, sizeof(szModName), szModName, &pszFile );
strcpy( pszFile, fn );
strcpy( pszFile, fn.c_str() );
return szModName;
}
@@ -501,8 +501,8 @@ static void DoSave( const RString &sReport )
{
RString sName = SpliceProgramPath( "../crashinfo.txt" );
SetFileAttributes( sName, FILE_ATTRIBUTE_NORMAL );
FILE *pFile = fopen( sName, "w+" );
SetFileAttributes( sName.c_str(), FILE_ATTRIBUTE_NORMAL );
FILE *pFile = fopen( sName.c_str(), "w+" );
if( pFile == nullptr )
return;
fprintf( pFile, "%s", sReport.c_str() );
@@ -510,7 +510,7 @@ static void DoSave( const RString &sReport )
fclose( pFile );
// Discourage changing crashinfo.txt.
SetFileAttributes( sName, FILE_ATTRIBUTE_READONLY );
SetFileAttributes( sName.c_str(), FILE_ATTRIBUTE_READONLY );
}
bool ReadCrashDataFromParent( int iFD, CompleteCrashData &Data )
@@ -683,8 +683,8 @@ void CrashDialog::SetDialogInitial()
{
HWND hDlg = GetHwnd();
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), A_CRASH_HAS_OCCURRED.GetValue() );
SetWindowText( GetDlgItem(hDlg, IDC_BUTTON_CLOSE), CLOSE.GetValue() );
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), A_CRASH_HAS_OCCURRED.GetValue().c_str() );
SetWindowText( GetDlgItem(hDlg, IDC_BUTTON_CLOSE), CLOSE.GetValue().c_str() );
ShowWindow( GetDlgItem(hDlg, IDC_PROGRESS), false );
ShowWindow( GetDlgItem(hDlg, IDC_BUTTON_AUTO_REPORT), true );
}
@@ -745,7 +745,7 @@ INT_PTR CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
case IDC_VIEW_LOG:
{
RString sLogPath;
FILE *pFile = fopen( SpliceProgramPath("../Portable.ini"), "r" );
FILE *pFile = fopen( SpliceProgramPath("../Portable.ini").c_str(), "r" );
if(pFile != nullptr)
{
sLogPath = SpliceProgramPath("../Logs/log.txt");
@@ -754,11 +754,11 @@ INT_PTR CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
else
sLogPath = SpecialDirs::GetAppDataDir() + PRODUCT_ID +"/Logs/log.txt";
ShellExecute( nullptr, "open", sLogPath, "", "", SW_SHOWNORMAL );
ShellExecute( nullptr, "open", sLogPath.c_str(), "", "", SW_SHOWNORMAL );
}
break;
case IDC_CRASH_SAVE:
ShellExecute( nullptr, "open", SpliceProgramPath("../crashinfo.txt"), "", "", SW_SHOWNORMAL );
ShellExecute( nullptr, "open", SpliceProgramPath("../crashinfo.txt").c_str(), "", "", SW_SHOWNORMAL );
return TRUE;
case IDC_BUTTON_RESTART:
Win32RestartProgram();
@@ -810,21 +810,21 @@ INT_PTR CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
/* On error, don't show the "report" button again. If the submission was actually
* successful, then it'd be too easy to accidentally spam the server by holding
* down the button. */
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), ERROR_SENDING_REPORT.GetValue() );
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), ERROR_SENDING_REPORT.GetValue().c_str() );
}
else if( xml.GetChildValue("UpdateAvailable", m_sUpdateURL) )
{
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), UPDATE_IS_AVAILABLE.GetValue() );
SetWindowText( GetDlgItem(hDlg, IDC_BUTTON_AUTO_REPORT), VIEW_UPDATE.GetValue() );
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), UPDATE_IS_AVAILABLE.GetValue().c_str() );
SetWindowText( GetDlgItem(hDlg, IDC_BUTTON_AUTO_REPORT), VIEW_UPDATE.GetValue().c_str() );
ShowWindow( GetDlgItem(hDlg, IDC_BUTTON_AUTO_REPORT), true );
}
else if( xml.GetChildValue("ReportId", iID) )
{
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), UPDATE_IS_NOT_AVAILABLE.GetValue() );
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), UPDATE_IS_NOT_AVAILABLE.GetValue().c_str() );
}
else
{
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), ERROR_SENDING_REPORT.GetValue() );
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), ERROR_SENDING_REPORT.GetValue().c_str() );
}
if( xml.GetChildValue("ReportId", iID) )
@@ -835,7 +835,7 @@ INT_PTR CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
}
ShowWindow( GetDlgItem(hDlg, IDC_PROGRESS), false );
SetWindowText( GetDlgItem(hDlg, IDC_BUTTON_CLOSE), CLOSE.GetValue() );
SetWindowText( GetDlgItem(hDlg, IDC_BUTTON_CLOSE), CLOSE.GetValue().c_str() );
}
}
}
@@ -366,7 +366,7 @@ void NetworkStream_Win32::Open( const RString &sHost, int iPort, ConnectionType
m_hResolve = WSAAsyncGetHostByName(
mw.GetHwnd(),
WM_USER,
m_sHost,
m_sHost.c_str(),
(char *) pHost,
MAXGETHOSTSTRUCT
);
+13 -13
View File
@@ -88,13 +88,13 @@ static LRESULT CALLBACK GraphicsWindow_WndProc( HWND hWnd, UINT msg, WPARAM wPar
* because that's where most other apps seem to do it. */
if( g_bHasFocus && !bHadFocus )
{
ChangeDisplaySettingsEx( g_CurrentParams.sDisplayId, &g_FullScreenDevMode, nullptr, CDS_FULLSCREEN, nullptr );
ChangeDisplaySettingsEx( g_CurrentParams.sDisplayId.c_str(), &g_FullScreenDevMode, nullptr, CDS_FULLSCREEN, nullptr );
ShowWindow( g_hWndMain, SW_SHOWNORMAL );
SetWindowPos( g_hWndMain, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
}
else if( !g_bHasFocus && bHadFocus )
{
ChangeDisplaySettingsEx(g_CurrentParams.sDisplayId, nullptr, nullptr, 0, nullptr);
ChangeDisplaySettingsEx(g_CurrentParams.sDisplayId.c_str(), nullptr, nullptr, 0, nullptr);
}
}
@@ -197,7 +197,7 @@ static void AdjustVideoModeParams( VideoModeParams &p )
DEVMODE dm;
ZERO( dm );
dm.dmSize = sizeof(dm);
if (!EnumDisplaySettings(p.sDisplayId, ENUM_CURRENT_SETTINGS, &dm))
if (!EnumDisplaySettings(p.sDisplayId.c_str(), ENUM_CURRENT_SETTINGS, &dm))
{
p.rate = 60;
LOG->Warn( "%s", werr_ssprintf(GetLastError(), "EnumDisplaySettings failed").c_str() );
@@ -233,7 +233,7 @@ RString GraphicsWindow::SetScreenMode( const VideoModeParams &p )
if( p.windowed )
{
// We're going windowed. If we were previously fullscreen, reset.
ChangeDisplaySettingsEx( p.sDisplayId, nullptr, nullptr, 0, nullptr );
ChangeDisplaySettingsEx( p.sDisplayId.c_str(), nullptr, nullptr, 0, nullptr );
return RString();
}
@@ -251,13 +251,13 @@ RString GraphicsWindow::SetScreenMode( const VideoModeParams &p )
DevMode.dmDisplayFrequency = p.rate;
DevMode.dmFields |= DM_DISPLAYFREQUENCY;
}
ChangeDisplaySettingsEx(p.sDisplayId, nullptr, nullptr, 0, nullptr);
ChangeDisplaySettingsEx(p.sDisplayId.c_str(), nullptr, nullptr, 0, nullptr);
int ret = ChangeDisplaySettingsEx( p.sDisplayId, &DevMode, nullptr, CDS_FULLSCREEN, nullptr );
int ret = ChangeDisplaySettingsEx( p.sDisplayId.c_str(), &DevMode, nullptr, CDS_FULLSCREEN, nullptr );
if( ret != DISP_CHANGE_SUCCESSFUL && (DevMode.dmFields & DM_DISPLAYFREQUENCY) )
{
DevMode.dmFields &= ~DM_DISPLAYFREQUENCY;
ret = ChangeDisplaySettingsEx( p.sDisplayId, &DevMode, nullptr, CDS_FULLSCREEN, nullptr );
ret = ChangeDisplaySettingsEx( p.sDisplayId.c_str(), &DevMode, nullptr, CDS_FULLSCREEN, nullptr );
}
// XXX: append error
@@ -309,7 +309,7 @@ void GraphicsWindow::CreateGraphicsWindow( const VideoModeParams &p, bool bForce
pos.y = 0;
// Look for the preferred display's position.
if (EnumDisplaySettingsEx(p.sDisplayId, ENUM_CURRENT_SETTINGS, &devmode, 0) && deviceModeIsValid(devmode)
if (EnumDisplaySettingsEx(p.sDisplayId.c_str(), ENUM_CURRENT_SETTINGS, &devmode, 0) && deviceModeIsValid(devmode)
&& (devmode.dmFields & DM_POSITION))
{
pos = devmode.dmPosition;
@@ -321,7 +321,7 @@ void GraphicsWindow::CreateGraphicsWindow( const VideoModeParams &p, bool bForce
int iWindowStyle = GetWindowStyle( p.windowed , p.bWindowIsFullscreenBorderless );
AppInstance inst;
HWND hWnd = CreateWindow( g_sClassName, "app", iWindowStyle,
HWND hWnd = CreateWindow( g_sClassName.c_str(), "app", iWindowStyle,
0, 0, 0, 0, nullptr, nullptr, inst, nullptr );
if( hWnd == nullptr )
RageException::Throw( "%s", werr_ssprintf( GetLastError(), "CreateWindow" ).c_str() );
@@ -353,7 +353,7 @@ void GraphicsWindow::CreateGraphicsWindow( const VideoModeParams &p, bool bForce
break;
}
SetWindowTextA( g_hWndMain, ConvertUTF8ToACP(p.sWindowTitle) );
SetWindowTextA( g_hWndMain, ConvertUTF8ToACP(p.sWindowTitle).c_str() );
} while(0);
// Update the window icon.
@@ -500,7 +500,7 @@ void GraphicsWindow::Initialize( bool bD3D )
LoadCursor( nullptr, IDC_ARROW ), /* default cursor */
nullptr, /* hbrBackground */
nullptr, /* lpszMenuName */
g_sClassName /* lpszClassName */
g_sClassName.c_str() /* lpszClassName */
};
m_bWideWindowClass = false;
@@ -519,10 +519,10 @@ void GraphicsWindow::Shutdown()
* It'd be nice to not do this: Windows will do it when we quit, and if
* we're shutting down OpenGL to try D3D, this will cause extra mode
* switches. However, we need to do this before displaying dialogs. */
ChangeDisplaySettingsEx( g_CurrentParams.sDisplayId, nullptr, nullptr, 0, nullptr );
ChangeDisplaySettingsEx( g_CurrentParams.sDisplayId.c_str(), nullptr, nullptr, 0, nullptr );
AppInstance inst;
UnregisterClass( g_sClassName, inst );
UnregisterClass( g_sClassName.c_str(), inst );
}
HDC GraphicsWindow::GetHDC()
+2 -2
View File
@@ -18,14 +18,14 @@ MessageWindow::MessageWindow( const RString &sClassName )
LoadCursor( nullptr, IDC_ARROW ), /* default cursor */
nullptr, /* hbrBackground */
nullptr, /* lpszMenuName */
sClassName /* lpszClassName */
sClassName.c_str() /* lpszClassName */
};
if( !RegisterClassA(&WindowClass) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS )
RageException::Throw( "%s", werr_ssprintf( GetLastError(), "RegisterClass" ).c_str() );
// XXX: on 2k/XP, use HWND_MESSAGE as parent
m_hWnd = CreateWindow( sClassName, sClassName, WS_DISABLED, 0, 0, 0, 0, nullptr, nullptr, inst, nullptr );
m_hWnd = CreateWindow( sClassName.c_str(), sClassName.c_str(), WS_DISABLED, 0, 0, 0, 0, nullptr, nullptr, inst, nullptr );
ASSERT( m_hWnd != nullptr );
SetProp( m_hWnd, "MessageWindow", this );
+6 -6
View File
@@ -49,7 +49,7 @@ static HKEY OpenRegKey( const RString &sKey, RegKeyMode mode, bool bWarnOnError
return nullptr;
HKEY hRetKey;
LONG retval = RegOpenKeyEx( hType, sSubkey, 0, (mode==READ) ? KEY_READ:KEY_WRITE, &hRetKey );
LONG retval = RegOpenKeyEx( hType, sSubkey.c_str(), 0, (mode==READ) ? KEY_READ:KEY_WRITE, &hRetKey );
if ( retval != ERROR_SUCCESS )
{
if( bWarnOnError )
@@ -69,7 +69,7 @@ bool RegistryAccess::GetRegValue( const RString &sKey, const RString &sName, RSt
char sBuffer[MAX_PATH];
DWORD iSize = sizeof(sBuffer);
DWORD iType;
LONG iRet = RegQueryValueEx( hKey, sName, nullptr, &iType, (LPBYTE)sBuffer, &iSize );
LONG iRet = RegQueryValueEx( hKey, sName.c_str(), nullptr, &iType, (LPBYTE)sBuffer, &iSize );
RegCloseKey( hKey );
if( iRet != ERROR_SUCCESS )
return false;
@@ -95,7 +95,7 @@ bool RegistryAccess::GetRegValue( const RString &sKey, const RString &sName, int
DWORD iValue;
DWORD iSize = sizeof(iValue);
DWORD iType;
LONG iRet = RegQueryValueEx( hKey, sName, nullptr, &iType, (LPBYTE) &iValue, &iSize );
LONG iRet = RegQueryValueEx( hKey, sName.c_str(), nullptr, &iType, (LPBYTE) &iValue, &iSize );
RegCloseKey( hKey );
if( iRet != ERROR_SUCCESS )
return false;
@@ -169,7 +169,7 @@ bool RegistryAccess::SetRegValue( const RString &sKey, const RString &sName, con
strcpy( sz, sVal.c_str() );
LONG lResult = ::RegSetValueEx(hKey, LPCTSTR(sName), 0, REG_SZ, (LPBYTE)sz, strlen(sz) + 1);
LONG lResult = ::RegSetValueEx(hKey, LPCTSTR(sName.c_str()), 0, REG_SZ, (LPBYTE)sz, strlen(sz) + 1);
if( lResult != ERROR_SUCCESS )
bSuccess = false;
@@ -185,7 +185,7 @@ bool RegistryAccess::SetRegValue( const RString &sKey, const RString &sName, boo
bool bSuccess = true;
if (::RegSetValueEx(hKey, LPCTSTR(sName), 0,
if (::RegSetValueEx(hKey, LPCTSTR(sName.c_str()), 0,
REG_BINARY, (LPBYTE)&bVal, sizeof(bVal))
!= ERROR_SUCCESS)
bSuccess = false;
@@ -205,7 +205,7 @@ bool RegistryAccess::CreateKey( const RString &sKey )
DWORD dwDisposition = 0;
if( ::RegCreateKeyEx(
hType,
sSubkey,
sSubkey.c_str(),
0,
nullptr,
REG_OPTION_NON_VOLATILE,
+2 -2
View File
@@ -56,7 +56,7 @@ bool USBDevice::Open( int iVID, int iPID, int iBlockSize, int iNum, void (*pfnIn
RString path;
while( (path = GetUSBDevicePath(iIndex++)) != "" )
{
HANDLE h = CreateFile( path, GENERIC_READ,
HANDLE h = CreateFile( path.c_str(), GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr );
if( h == INVALID_HANDLE_VALUE )
@@ -138,7 +138,7 @@ bool WindowsFileIO::Open( RString path, int iBlockSize )
if( m_Handle != INVALID_HANDLE_VALUE )
CloseHandle( m_Handle );
m_Handle = CreateFile( path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
m_Handle = CreateFile( path.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, nullptr );
if( m_Handle == INVALID_HANDLE_VALUE )