mirror of
https://github.com/AppleWin/AppleWin.git
synced 2026-04-20 00:17:16 +00:00
Replace StringCbPrintf() with StrFormat() (PR #1032)
This commit is contained in:
+9
-12
@@ -30,6 +30,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#include "Registry.h"
|
||||
#include "CmdLine.h"
|
||||
#include "StrFormat.h"
|
||||
|
||||
namespace _ini {
|
||||
//===========================================================================
|
||||
@@ -60,14 +61,13 @@ BOOL RegLoadString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPTSTR buffer, D
|
||||
if (!g_sConfigFile.empty())
|
||||
return _ini::RegLoadString(section, key, peruser, buffer, chars);
|
||||
|
||||
TCHAR fullkeyname[256];
|
||||
StringCbPrintf(fullkeyname, 256, TEXT("Software\\AppleWin\\CurrentVersion\\%s"), section);
|
||||
std::string fullkeyname = std::string("Software\\AppleWin\\CurrentVersion\\") + section;
|
||||
|
||||
BOOL success = FALSE;
|
||||
HKEY keyhandle;
|
||||
LSTATUS status = RegOpenKeyEx(
|
||||
(peruser ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE),
|
||||
fullkeyname,
|
||||
fullkeyname.c_str(),
|
||||
0,
|
||||
KEY_READ,
|
||||
&keyhandle);
|
||||
@@ -119,14 +119,13 @@ void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, const std::strin
|
||||
if (!g_sConfigFile.empty())
|
||||
return _ini::RegSaveString(section, key, peruser, buffer);
|
||||
|
||||
TCHAR fullkeyname[256];
|
||||
StringCbPrintf(fullkeyname, 256, TEXT("Software\\AppleWin\\CurrentVersion\\%s"), section);
|
||||
std::string fullkeyname = std::string("Software\\AppleWin\\CurrentVersion\\") + section;
|
||||
|
||||
HKEY keyhandle;
|
||||
DWORD disposition;
|
||||
LSTATUS status = RegCreateKeyEx(
|
||||
(peruser ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE),
|
||||
fullkeyname,
|
||||
fullkeyname.c_str(),
|
||||
0,
|
||||
NULL,
|
||||
REG_OPTION_NON_VOLATILE,
|
||||
@@ -149,9 +148,8 @@ void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, const std::strin
|
||||
|
||||
//===========================================================================
|
||||
void RegSaveValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD value) {
|
||||
TCHAR buffer[32] = TEXT("");
|
||||
StringCbPrintf(buffer, 32, "%d", value);
|
||||
RegSaveString(section, key, peruser, buffer);
|
||||
std::string strValue = StrFormat("%d", value);
|
||||
RegSaveString(section, key, peruser, strValue.c_str());
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
@@ -188,13 +186,12 @@ void RegDeleteConfigSlotSection(UINT slot)
|
||||
return _ini::RegDeleteString(section.c_str(), peruser);
|
||||
}
|
||||
|
||||
TCHAR fullkeyname[256];
|
||||
StringCbPrintf(fullkeyname, 256, TEXT("Software\\AppleWin\\CurrentVersion\\%s"), REG_CONFIG);
|
||||
std::string fullkeyname = std::string("Software\\AppleWin\\CurrentVersion\\") + REG_CONFIG;
|
||||
|
||||
HKEY keyhandle;
|
||||
LSTATUS status = RegOpenKeyEx(
|
||||
(peruser ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE),
|
||||
fullkeyname,
|
||||
fullkeyname.c_str(),
|
||||
0,
|
||||
KEY_READ,
|
||||
&keyhandle);
|
||||
|
||||
Reference in New Issue
Block a user