aboutsummaryrefslogtreecommitdiffstats
path: root/win/vncconfig
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2023-01-10 21:24:21 +0100
committerPierre Ossman <ossman@cendio.se>2023-02-04 14:03:13 +0100
commit77f0a61ec8f1488d6042b1370444bb2612604292 (patch)
tree76a965e971e87e53abd0f7cb45c1baa7fbe52e99 /win/vncconfig
parent2047dae22fb862ff43309ebb4fe2b9e7d6ce6153 (diff)
downloadtigervnc-77f0a61ec8f1488d6042b1370444bb2612604292.tar.gz
tigervnc-77f0a61ec8f1488d6042b1370444bb2612604292.zip
Get rid of TCHAR magic
We never use Windows' "UNICODE" mode anyway, so let's get rid of this complexity.
Diffstat (limited to 'win/vncconfig')
-rw-r--r--win/vncconfig/Authentication.h26
-rw-r--r--win/vncconfig/Connections.h60
-rw-r--r--win/vncconfig/Desktop.h12
-rw-r--r--win/vncconfig/Hooking.h10
-rw-r--r--win/vncconfig/Inputs.h12
-rw-r--r--win/vncconfig/Legacy.cxx108
-rw-r--r--win/vncconfig/Legacy.h8
-rw-r--r--win/vncconfig/PasswordDialog.cxx14
-rw-r--r--win/vncconfig/Sharing.h6
-rw-r--r--win/vncconfig/vncconfig.cxx18
10 files changed, 137 insertions, 137 deletions
diff --git a/win/vncconfig/Authentication.h b/win/vncconfig/Authentication.h
index 1e4ea4ac..6789a4f2 100644
--- a/win/vncconfig/Authentication.h
+++ b/win/vncconfig/Authentication.h
@@ -65,13 +65,13 @@ namespace rfb {
PasswordDialog passwdDlg(regKey, registryInsecure);
passwdDlg.showDialog(handle);
} else if (id == IDC_LOAD_CERT) {
- const TCHAR* title = _T("X509Cert");
- const TCHAR* filter =
- _T("X.509 Certificates (*.crt;*.cer;*.pem)\0*.crt;*.cer;*.pem\0All\0*.*\0");
+ const char* title = "X509Cert";
+ const char* filter =
+ "X.509 Certificates (*.crt;*.cer;*.pem)\0*.crt;*.cer;*.pem\0All\0*.*\0";
showFileChooser(regKey, title, filter, handle);
} else if (id == IDC_LOAD_CERTKEY) {
- const TCHAR* title = _T("X509Key");
- const TCHAR* filter = _T("X.509 Keys (*.key;*.pem)\0*.key;*.pem\0All\0*.*\0");
+ const char* title = "X509Key";
+ const char* filter = "X.509 Keys (*.key;*.pem)\0*.key;*.pem\0All\0*.*\0";
showFileChooser(regKey, title, filter, handle);
} else if (id == IDC_QUERY_LOGGED_ON) {
enableItem(IDC_QUERY_LOGGED_ON, enableQueryOnlyIfLoggedOn());
@@ -85,10 +85,10 @@ namespace rfb {
if (isItemChecked(IDC_AUTH_VNC))
verifyVncPassword(regKey);
else if (haveVncPassword() &&
- MsgBox(0, _T("The VNC authentication method is disabled, but a password is still stored for it.\n")
- _T("Do you want to remove the VNC authentication password from the registry?"),
+ MsgBox(0, "The VNC authentication method is disabled, but a password is still stored for it.\n"
+ "Do you want to remove the VNC authentication password from the registry?",
MB_ICONWARNING | MB_YESNO) == IDYES) {
- regKey.setBinary(_T("Password"), 0, 0);
+ regKey.setBinary("Password", 0, 0);
}
#ifdef HAVE_GNUTLS
@@ -98,9 +98,9 @@ namespace rfb {
}
#endif
- regKey.setString(_T("SecurityTypes"), security->ToString());
- regKey.setBool(_T("QueryConnect"), isItemChecked(IDC_QUERY_CONNECT));
- regKey.setBool(_T("QueryOnlyIfLoggedOn"), isItemChecked(IDC_QUERY_LOGGED_ON));
+ regKey.setString("SecurityTypes", security->ToString());
+ regKey.setBool("QueryConnect", isItemChecked(IDC_QUERY_CONNECT));
+ regKey.setBool("QueryOnlyIfLoggedOn", isItemChecked(IDC_QUERY_LOGGED_ON));
return true;
}
@@ -120,8 +120,8 @@ namespace rfb {
static void verifyVncPassword(const RegKey& regKey) {
if (!haveVncPassword()) {
- MsgBox(0, _T("The VNC authentication method is enabled, but no password is specified.\n")
- _T("The password dialog will now be shown."), MB_ICONINFORMATION | MB_OK);
+ MsgBox(0, "The VNC authentication method is enabled, but no password is specified.\n"
+ "The password dialog will now be shown.", MB_ICONINFORMATION | MB_OK);
PasswordDialog passwd(regKey, registryInsecure);
passwd.showDialog();
}
diff --git a/win/vncconfig/Connections.h b/win/vncconfig/Connections.h
index c3d67374..ff03897a 100644
--- a/win/vncconfig/Connections.h
+++ b/win/vncconfig/Connections.h
@@ -41,17 +41,17 @@ namespace rfb {
class ConnHostDialog : public Dialog {
public:
ConnHostDialog() : Dialog(GetModuleHandle(0)) {}
- bool showDialog(const TCHAR* pat) {
- pattern.replaceBuf(tstrDup(pat));
+ bool showDialog(const char* pat) {
+ pattern.replaceBuf(strDup(pat));
return Dialog::showDialog(MAKEINTRESOURCE(IDD_CONN_HOST));
}
void initDialog() {
- if (_tcslen(pattern.buf) == 0)
- pattern.replaceBuf(tstrDup("+"));
+ if (strlen(pattern.buf) == 0)
+ pattern.replaceBuf(strDup("+"));
- if (pattern.buf[0] == _T('+'))
+ if (pattern.buf[0] == '+')
setItemChecked(IDC_ALLOW, true);
- else if (pattern.buf[0] == _T('?'))
+ else if (pattern.buf[0] == '?')
setItemChecked(IDC_QUERY, true);
else
setItemChecked(IDC_DENY, true);
@@ -60,29 +60,29 @@ namespace rfb {
pattern.replaceBuf(0);
}
bool onOk() {
- TCharArray host(getItemString(IDC_HOST_PATTERN));
- TCharArray newPat(_tcslen(host.buf)+2);
+ CharArray host(getItemString(IDC_HOST_PATTERN));
+ CharArray newPat(strlen(host.buf)+2);
if (isItemChecked(IDC_ALLOW))
- newPat.buf[0] = _T('+');
+ newPat.buf[0] = '+';
else if (isItemChecked(IDC_QUERY))
- newPat.buf[0] = _T('?');
+ newPat.buf[0] = '?';
else
- newPat.buf[0] = _T('-');
+ newPat.buf[0] = '-';
newPat.buf[1] = 0;
- _tcscat(newPat.buf, host.buf);
+ strcat(newPat.buf, host.buf);
try {
- network::TcpFilter::Pattern pat(network::TcpFilter::parsePattern(CStr(newPat.buf)));
- pattern.replaceBuf(TCharArray(network::TcpFilter::patternToStr(pat)).takeBuf());
+ network::TcpFilter::Pattern pat(network::TcpFilter::parsePattern(newPat.buf));
+ pattern.replaceBuf(CharArray(network::TcpFilter::patternToStr(pat)).takeBuf());
} catch(rdr::Exception& e) {
- MsgBox(NULL, TStr(e.str()), MB_ICONEXCLAMATION | MB_OK);
+ MsgBox(NULL, e.str(), MB_ICONEXCLAMATION | MB_OK);
return false;
}
return true;
}
- const TCHAR* getPattern() {return pattern.buf;}
+ const char* getPattern() {return pattern.buf;}
protected:
- TCharArray pattern;
+ CharArray pattern;
};
class ConnectionsPage : public PropSheetPage {
@@ -106,7 +106,7 @@ namespace rfb {
CharArray first;
strSplit(tmp.buf, ',', &first.buf, &tmp.buf);
if (strlen(first.buf))
- SendMessage(listBox, LB_ADDSTRING, 0, (LPARAM)(const TCHAR*)TStr(first.buf));
+ SendMessage(listBox, LB_ADDSTRING, 0, (LPARAM)first.buf);
}
onCommand(IDC_RFB_ENABLE, EN_CHANGE);
@@ -157,9 +157,9 @@ namespace rfb {
}
case IDC_HOST_ADD:
- if (hostDialog.showDialog(_T("")))
+ if (hostDialog.showDialog(""))
{
- const TCHAR* pattern = hostDialog.getPattern();
+ const char* pattern = hostDialog.getPattern();
if (pattern)
SendMessage(GetDlgItem(handle, IDC_HOSTS), LB_ADDSTRING, 0, (LPARAM)pattern);
}
@@ -169,11 +169,11 @@ namespace rfb {
{
HWND listBox = GetDlgItem(handle, IDC_HOSTS);
int item = SendMessage(listBox, LB_GETCURSEL, 0, 0);
- TCharArray pattern(SendMessage(listBox, LB_GETTEXTLEN, item, 0)+1);
+ CharArray pattern(SendMessage(listBox, LB_GETTEXTLEN, item, 0)+1);
SendMessage(listBox, LB_GETTEXT, item, (LPARAM)pattern.buf);
if (hostDialog.showDialog(pattern.buf)) {
- const TCHAR* newPat = hostDialog.getPattern();
+ const char* newPat = hostDialog.getPattern();
if (newPat) {
item = SendMessage(listBox, LB_FINDSTRINGEXACT, item, (LPARAM)pattern.buf);
if (item != LB_ERR) {
@@ -191,7 +191,7 @@ namespace rfb {
{
HWND listBox = GetDlgItem(handle, IDC_HOSTS);
int item = SendMessage(listBox, LB_GETCURSEL, 0, 0);
- TCharArray pattern(SendMessage(listBox, LB_GETTEXTLEN, item, 0)+1);
+ CharArray pattern(SendMessage(listBox, LB_GETTEXTLEN, item, 0)+1);
SendMessage(listBox, LB_GETTEXT, item, (LPARAM)pattern.buf);
SendMessage(listBox, LB_DELETESTRING, item, 0);
SendMessage(listBox, LB_INSERTSTRING, item-1, (LPARAM)pattern.buf);
@@ -204,7 +204,7 @@ namespace rfb {
{
HWND listBox = GetDlgItem(handle, IDC_HOSTS);
int item = SendMessage(listBox, LB_GETCURSEL, 0, 0);
- TCharArray pattern(SendMessage(listBox, LB_GETTEXTLEN, item, 0)+1);
+ CharArray pattern(SendMessage(listBox, LB_GETTEXTLEN, item, 0)+1);
SendMessage(listBox, LB_GETTEXT, item, (LPARAM)pattern.buf);
SendMessage(listBox, LB_DELETESTRING, item, 0);
SendMessage(listBox, LB_INSERTSTRING, item+1, (LPARAM)pattern.buf);
@@ -225,10 +225,10 @@ namespace rfb {
return false;
}
bool onOk() {
- regKey.setInt(_T("PortNumber"), isItemChecked(IDC_RFB_ENABLE) ? getItemInt(IDC_PORT) : 0);
- regKey.setInt(_T("IdleTimeout"), getItemInt(IDC_IDLE_TIMEOUT));
- regKey.setInt(_T("LocalHost"), isItemChecked(IDC_LOCALHOST));
- regKey.setString(_T("Hosts"), TCharArray(getHosts()).buf);
+ regKey.setInt("PortNumber", isItemChecked(IDC_RFB_ENABLE) ? getItemInt(IDC_PORT) : 0);
+ regKey.setInt("IdleTimeout", getItemInt(IDC_IDLE_TIMEOUT));
+ regKey.setInt("LocalHost", isItemChecked(IDC_LOCALHOST));
+ regKey.setString("Hosts", CharArray(getHosts()).buf);
return true;
}
bool isChanged() {
@@ -248,9 +248,9 @@ namespace rfb {
HWND listBox = GetDlgItem(handle, IDC_HOSTS);
for (i=0; i<SendMessage(listBox, LB_GETCOUNT, 0, 0); i++)
bufLen+=SendMessage(listBox, LB_GETTEXTLEN, i, 0)+1;
- TCharArray hosts_str(bufLen);
+ CharArray hosts_str(bufLen);
hosts_str.buf[0] = 0;
- TCHAR* outPos = hosts_str.buf;
+ char* outPos = hosts_str.buf;
for (i=0; i<SendMessage(listBox, LB_GETCOUNT, 0, 0); i++) {
outPos += SendMessage(listBox, LB_GETTEXT, i, (LPARAM)outPos);
outPos[0] = ',';
diff --git a/win/vncconfig/Desktop.h b/win/vncconfig/Desktop.h
index a102a0c7..65d99946 100644
--- a/win/vncconfig/Desktop.h
+++ b/win/vncconfig/Desktop.h
@@ -59,14 +59,14 @@ namespace rfb {
return false;
}
bool onOk() {
- const TCHAR* action = _T("None");
+ const char* action = "None";
if (isItemChecked(IDC_DISCONNECT_LOGOFF))
- action = _T("Logoff");
+ action = "Logoff";
else if (isItemChecked(IDC_DISCONNECT_LOCK))
- action = _T("Lock");
- regKey.setString(_T("DisconnectAction"), action);
- regKey.setBool(_T("RemoveWallpaper"), isItemChecked(IDC_REMOVE_WALLPAPER));
- regKey.setBool(_T("DisableEffects"), isItemChecked(IDC_DISABLE_EFFECTS));
+ action = "Lock";
+ regKey.setString("DisconnectAction", action);
+ regKey.setBool("RemoveWallpaper", isItemChecked(IDC_REMOVE_WALLPAPER));
+ regKey.setBool("DisableEffects", isItemChecked(IDC_DISABLE_EFFECTS));
return true;
}
protected:
diff --git a/win/vncconfig/Hooking.h b/win/vncconfig/Hooking.h
index 1b02a1d5..e775f290 100644
--- a/win/vncconfig/Hooking.h
+++ b/win/vncconfig/Hooking.h
@@ -56,14 +56,14 @@ namespace rfb {
}
bool onOk() {
if (isItemChecked(IDC_USEPOLLING))
- regKey.setInt(_T("UpdateMethod"), 0);
+ regKey.setInt("UpdateMethod", 0);
if (isItemChecked(IDC_USEHOOKS))
- regKey.setInt(_T("UpdateMethod"), 1);
- regKey.setBool(_T("PollConsoleWindows"), isItemChecked(IDC_POLLCONSOLES));
- regKey.setBool(_T("UseCaptureBlt"), isItemChecked(IDC_CAPTUREBLT));
+ regKey.setInt("UpdateMethod", 1);
+ regKey.setBool("PollConsoleWindows", isItemChecked(IDC_POLLCONSOLES));
+ regKey.setBool("UseCaptureBlt", isItemChecked(IDC_CAPTUREBLT));
// *** LEGACY compatibility ***
- regKey.setBool(_T("UseHooks"), isItemChecked(IDC_USEHOOKS));
+ regKey.setBool("UseHooks", isItemChecked(IDC_USEHOOKS));
return true;
}
protected:
diff --git a/win/vncconfig/Inputs.h b/win/vncconfig/Inputs.h
index e71efde6..a2ac5a46 100644
--- a/win/vncconfig/Inputs.h
+++ b/win/vncconfig/Inputs.h
@@ -62,12 +62,12 @@ namespace rfb {
return false;
}
bool onOk() {
- regKey.setBool(_T("AcceptKeyEvents"), isItemChecked(IDC_ACCEPT_KEYS));
- regKey.setBool(_T("RawKeyboard"), isItemChecked(IDC_RAW_KEYBOARD));
- regKey.setBool(_T("AcceptPointerEvents"), isItemChecked(IDC_ACCEPT_PTR));
- regKey.setBool(_T("AcceptCutText"), isItemChecked(IDC_ACCEPT_CUTTEXT));
- regKey.setBool(_T("SendCutText"), isItemChecked(IDC_SEND_CUTTEXT));
- regKey.setBool(_T("DisableLocalInputs"), isItemChecked(IDC_DISABLE_LOCAL_INPUTS));
+ regKey.setBool("AcceptKeyEvents", isItemChecked(IDC_ACCEPT_KEYS));
+ regKey.setBool("RawKeyboard", isItemChecked(IDC_RAW_KEYBOARD));
+ regKey.setBool("AcceptPointerEvents", isItemChecked(IDC_ACCEPT_PTR));
+ regKey.setBool("AcceptCutText", isItemChecked(IDC_ACCEPT_CUTTEXT));
+ regKey.setBool("SendCutText", isItemChecked(IDC_SEND_CUTTEXT));
+ regKey.setBool("DisableLocalInputs", isItemChecked(IDC_DISABLE_LOCAL_INPUTS));
if (enableAffectSSaver) {
BOOL blocked = !isItemChecked(IDC_AFFECT_SCREENSAVER);
SystemParametersInfo(SPI_SETBLOCKSENDINPUTRESETS, blocked, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
diff --git a/win/vncconfig/Legacy.cxx b/win/vncconfig/Legacy.cxx
index 3edfd4f7..b428fd2a 100644
--- a/win/vncconfig/Legacy.cxx
+++ b/win/vncconfig/Legacy.cxx
@@ -38,7 +38,7 @@ void LegacyPage::LoadPrefs()
// settings from HKCU/Software/ORL/WinVNC3.
// Get the name of the current user
- TCharArray username;
+ CharArray username;
try {
UserName name;
username.buf = name.takeBuf();
@@ -51,19 +51,19 @@ void LegacyPage::LoadPrefs()
allowProperties = true;
RegKey winvnc3;
try {
- winvnc3.openKey(HKEY_LOCAL_MACHINE, _T("Software\\ORL\\WinVNC3"));
- int debugMode = winvnc3.getInt(_T("DebugMode"), 0);
+ winvnc3.openKey(HKEY_LOCAL_MACHINE, "Software\\ORL\\WinVNC3");
+ int debugMode = winvnc3.getInt("DebugMode", 0);
const char* debugTarget = 0;
if (debugMode & 2) debugTarget = "file";
if (debugMode & 4) debugTarget = "stderr";
if (debugTarget) {
char logSetting[32];
- sprintf(logSetting, "*:%s:%d", debugTarget, winvnc3.getInt(_T("DebugLevel"), 0));
- regKey.setString(_T("Log"), TStr(logSetting));
+ sprintf(logSetting, "*:%s:%d", debugTarget, winvnc3.getInt("DebugLevel", 0));
+ regKey.setString("Log", logSetting);
}
- TCharArray authHosts;
- authHosts.buf = winvnc3.getString(_T("AuthHosts"), 0);
+ CharArray authHosts;
+ authHosts.buf = winvnc3.getString("AuthHosts", 0);
if (authHosts.buf) {
CharArray newHosts;
newHosts.buf = strDup("");
@@ -125,27 +125,27 @@ void LegacyPage::LoadPrefs()
}
// Finally, save the Hosts value
- regKey.setString(_T("Hosts"), TStr(newHosts.buf));
+ regKey.setString("Hosts", newHosts.buf);
} catch (rdr::Exception&) {
- MsgBox(0, _T("Unable to convert AuthHosts setting to Hosts format."),
+ MsgBox(0, "Unable to convert AuthHosts setting to Hosts format.",
MB_ICONWARNING | MB_OK);
}
} else {
- regKey.setString(_T("Hosts"), _T("+"));
+ regKey.setString("Hosts", "+");
}
- regKey.setBool(_T("LocalHost"), winvnc3.getBool(_T("LoopbackOnly"), false));
+ regKey.setBool("LocalHost", winvnc3.getBool("LoopbackOnly", false));
// *** check AllowLoopback?
- if (winvnc3.getBool(_T("AuthRequired"), true))
- regKey.setString(_T("SecurityTypes"), _T("VncAuth"));
+ if (winvnc3.getBool("AuthRequired", true))
+ regKey.setString("SecurityTypes", "VncAuth");
else
- regKey.setString(_T("SecurityTypes"), _T("None"));
+ regKey.setString("SecurityTypes", "None");
- int connectPriority = winvnc3.getInt(_T("ConnectPriority"), 0);
- regKey.setBool(_T("DisconnectClients"), connectPriority == 0);
- regKey.setBool(_T("AlwaysShared"), connectPriority == 1);
- regKey.setBool(_T("NeverShared"), connectPriority == 2);
+ int connectPriority = winvnc3.getInt("ConnectPriority", 0);
+ regKey.setBool("DisconnectClients", connectPriority == 0);
+ regKey.setBool("AlwaysShared", connectPriority == 1);
+ regKey.setBool("NeverShared", connectPriority == 2);
} catch(rdr::Exception&) {
}
@@ -154,7 +154,7 @@ void LegacyPage::LoadPrefs()
allowProperties = true;
try {
RegKey userKey;
- userKey.openKey(winvnc3, _T("Default"));
+ userKey.openKey(winvnc3, "Default");
vlog.info("loading Default prefs");
LoadUserPrefs(userKey);
} catch(rdr::Exception& e) {
@@ -176,7 +176,7 @@ void LegacyPage::LoadPrefs()
if (allowProperties) {
try {
RegKey userKey;
- userKey.openKey(HKEY_CURRENT_USER, _T("Software\\ORL\\WinVNC3"));
+ userKey.openKey(HKEY_CURRENT_USER, "Software\\ORL\\WinVNC3");
vlog.info("loading global User prefs");
LoadUserPrefs(userKey);
} catch(rdr::Exception& e) {
@@ -186,57 +186,57 @@ void LegacyPage::LoadPrefs()
}
// Disable the Options menu item if appropriate
- regKey.setBool(_T("DisableOptions"), !allowProperties);
+ regKey.setBool("DisableOptions", !allowProperties);
}
void LegacyPage::LoadUserPrefs(const RegKey& key)
{
- regKey.setInt(_T("PortNumber"), key.getBool(_T("SocketConnect")) ? key.getInt(_T("PortNumber"), 5900) : 0);
- if (key.getBool(_T("AutoPortSelect"), false)) {
- MsgBox(0, _T("The AutoPortSelect setting is not supported by this release.")
- _T("The port number will default to 5900."),
+ regKey.setInt("PortNumber", key.getBool("SocketConnect") ? key.getInt("PortNumber", 5900) : 0);
+ if (key.getBool("AutoPortSelect", false)) {
+ MsgBox(0, "The AutoPortSelect setting is not supported by this release."
+ "The port number will default to 5900.",
MB_ICONWARNING | MB_OK);
- regKey.setInt(_T("PortNumber"), 5900);
+ regKey.setInt("PortNumber", 5900);
}
- regKey.setInt(_T("IdleTimeout"), key.getInt(_T("IdleTimeout"), 0));
+ regKey.setInt("IdleTimeout", key.getInt("IdleTimeout", 0));
- regKey.setBool(_T("RemoveWallpaper"), key.getBool(_T("RemoveWallpaper")));
- regKey.setBool(_T("DisableEffects"), key.getBool(_T("DisableEffects")));
+ regKey.setBool("RemoveWallpaper", key.getBool("RemoveWallpaper"));
+ regKey.setBool("DisableEffects", key.getBool("DisableEffects"));
- if (key.getInt(_T("QuerySetting"), 2) != 2) {
- regKey.setBool(_T("QueryConnect"), key.getInt(_T("QuerySetting")) > 2);
- MsgBox(0, _T("The QuerySetting option has been replaced by QueryConnect.")
- _T("Please see the documentation for details of the QueryConnect option."),
+ if (key.getInt("QuerySetting", 2) != 2) {
+ regKey.setBool("QueryConnect", key.getInt("QuerySetting") > 2);
+ MsgBox(0, "The QuerySetting option has been replaced by QueryConnect."
+ "Please see the documentation for details of the QueryConnect option.",
MB_ICONWARNING | MB_OK);
}
- regKey.setInt(_T("QueryTimeout"), key.getInt(_T("QueryTimeout"), 10));
+ regKey.setInt("QueryTimeout", key.getInt("QueryTimeout", 10));
std::vector<uint8_t> passwd;
- passwd = key.getBinary(_T("Password"));
- regKey.setBinary(_T("Password"), passwd.data(), passwd.size());
-
- bool enableInputs = key.getBool(_T("InputsEnabled"), true);
- regKey.setBool(_T("AcceptKeyEvents"), enableInputs);
- regKey.setBool(_T("AcceptPointerEvents"), enableInputs);
- regKey.setBool(_T("AcceptCutText"), enableInputs);
- regKey.setBool(_T("SendCutText"), enableInputs);
-
- switch (key.getInt(_T("LockSetting"), 0)) {
- case 0: regKey.setString(_T("DisconnectAction"), _T("None")); break;
- case 1: regKey.setString(_T("DisconnectAction"), _T("Lock")); break;
- case 2: regKey.setString(_T("DisconnectAction"), _T("Logoff")); break;
+ passwd = key.getBinary("Password");
+ regKey.setBinary("Password", passwd.data(), passwd.size());
+
+ bool enableInputs = key.getBool("InputsEnabled", true);
+ regKey.setBool("AcceptKeyEvents", enableInputs);
+ regKey.setBool("AcceptPointerEvents", enableInputs);
+ regKey.setBool("AcceptCutText", enableInputs);
+ regKey.setBool("SendCutText", enableInputs);
+
+ switch (key.getInt("LockSetting", 0)) {
+ case 0: regKey.setString("DisconnectAction", "None"); break;
+ case 1: regKey.setString("DisconnectAction", "Lock"); break;
+ case 2: regKey.setString("DisconnectAction", "Logoff"); break;
};
- regKey.setBool(_T("DisableLocalInputs"), key.getBool(_T("LocalInputsDisabled"), false));
+ regKey.setBool("DisableLocalInputs", key.getBool("LocalInputsDisabled", false));
// *** ignore polling preferences
// PollUnderCursor, PollForeground, OnlyPollConsole, OnlyPollOnEvent
- regKey.setBool(_T("UseHooks"), !key.getBool(_T("PollFullScreen"), false));
+ regKey.setBool("UseHooks", !key.getBool("PollFullScreen", false));
- if (key.isValue(_T("AllowShutdown")))
- MsgBox(0, _T("The AllowShutdown option is not supported by this release."), MB_ICONWARNING | MB_OK);
- if (key.isValue(_T("AllowEditClients")))
- MsgBox(0, _T("The AllowEditClients option is not supported by this release."), MB_ICONWARNING | MB_OK);
+ if (key.isValue("AllowShutdown"))
+ MsgBox(0, "The AllowShutdown option is not supported by this release.", MB_ICONWARNING | MB_OK);
+ if (key.isValue("AllowEditClients"))
+ MsgBox(0, "The AllowEditClients option is not supported by this release.", MB_ICONWARNING | MB_OK);
- allowProperties = key.getBool(_T("AllowProperties"), allowProperties);
+ allowProperties = key.getBool("AllowProperties", allowProperties);
}
diff --git a/win/vncconfig/Legacy.h b/win/vncconfig/Legacy.h
index 0fcf29fe..884a151a 100644
--- a/win/vncconfig/Legacy.h
+++ b/win/vncconfig/Legacy.h
@@ -44,12 +44,12 @@ namespace rfb {
case IDC_LEGACY_IMPORT:
{
DWORD result = MsgBox(0,
- _T("Importing your legacy VNC 3.3 settings will overwrite your existing settings.\n")
- _T("Are you sure you wish to continue?"),
+ "Importing your legacy VNC 3.3 settings will overwrite your existing settings.\n"
+ "Are you sure you wish to continue?",
MB_ICONWARNING | MB_YESNO);
if (result == IDYES) {
LoadPrefs();
- MsgBox(0, _T("Imported VNC 3.3 settings successfully."),
+ MsgBox(0, "Imported VNC 3.3 settings successfully.",
MB_ICONINFORMATION | MB_OK);
// Sleep to allow RegConfig thread to reload settings
@@ -65,7 +65,7 @@ namespace rfb {
return false;
}
bool onOk() {
- regKey.setBool(_T("Protocol3.3"), isItemChecked(IDC_PROTOCOL_3_3));
+ regKey.setBool("Protocol3.3", isItemChecked(IDC_PROTOCOL_3_3));
return true;
}
diff --git a/win/vncconfig/PasswordDialog.cxx b/win/vncconfig/PasswordDialog.cxx
index d26d86f6..0483e496 100644
--- a/win/vncconfig/PasswordDialog.cxx
+++ b/win/vncconfig/PasswordDialog.cxx
@@ -33,20 +33,20 @@ bool PasswordDialog::showDialog(HWND owner) {
}
bool PasswordDialog::onOk() {
- TPlainPasswd password1(getItemString(IDC_PASSWORD1));
- TPlainPasswd password2(getItemString(IDC_PASSWORD2));
- if (_tcscmp(password1.buf, password2.buf) != 0) {
- MsgBox(0, _T("The supplied passwords do not match"),
+ PlainPasswd password1(getItemString(IDC_PASSWORD1));
+ PlainPasswd password2(getItemString(IDC_PASSWORD2));
+ if (strcmp(password1.buf, password2.buf) != 0) {
+ MsgBox(0, "The supplied passwords do not match",
MB_ICONEXCLAMATION | MB_OK);
return false;
}
if (registryInsecure &&
- (MsgBox(0, _T("Please note that your password cannot be stored securely on this system. ")
- _T("Are you sure you wish to continue?"),
+ (MsgBox(0, "Please note that your password cannot be stored securely on this system. "
+ "Are you sure you wish to continue?",
MB_YESNO | MB_ICONWARNING) == IDNO))
return false;
PlainPasswd password(strDup(password1.buf));
ObfuscatedPasswd obfPwd(password);
- regKey.setBinary(_T("Password"), obfPwd.buf, obfPwd.length);
+ regKey.setBinary("Password", obfPwd.buf, obfPwd.length);
return true;
}
diff --git a/win/vncconfig/Sharing.h b/win/vncconfig/Sharing.h
index 4dcb1db9..0a2bbe40 100644
--- a/win/vncconfig/Sharing.h
+++ b/win/vncconfig/Sharing.h
@@ -43,9 +43,9 @@ namespace rfb {
return true;
}
bool onOk() {
- regKey.setBool(_T("DisconnectClients"), isItemChecked(IDC_DISCONNECT_CLIENTS));
- regKey.setBool(_T("AlwaysShared"), isItemChecked(IDC_SHARE_ALWAYS));
- regKey.setBool(_T("NeverShared"), isItemChecked(IDC_SHARE_NEVER));
+ regKey.setBool("DisconnectClients", isItemChecked(IDC_DISCONNECT_CLIENTS));
+ regKey.setBool("AlwaysShared", isItemChecked(IDC_SHARE_ALWAYS));
+ regKey.setBool("NeverShared", isItemChecked(IDC_SHARE_NEVER));
return true;
}
protected:
diff --git a/win/vncconfig/vncconfig.cxx b/win/vncconfig/vncconfig.cxx
index c58303d4..2b7eaa1e 100644
--- a/win/vncconfig/vncconfig.cxx
+++ b/win/vncconfig/vncconfig.cxx
@@ -43,7 +43,7 @@ static LogWriter vlog("main");
#include <vncconfig/Desktop.h>
-TStr rfb::win32::AppName("TigerVNC Configuration");
+const char* rfb::win32::AppName = "TigerVNC Configuration";
#ifdef _DEBUG
@@ -109,7 +109,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE /*prev*/, char* /*cmdLine*/, int /*
// Create the required configuration registry key
RegKey rootKey;
- rootKey.createKey(configKey, _T("Software\\TigerVNC\\WinVNC4"));
+ rootKey.createKey(configKey, "Software\\TigerVNC\\WinVNC4");
// Override whatever security it already had (NT only)
bool warnOnChangePassword = false;
@@ -130,8 +130,8 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE /*prev*/, char* /*cmdLine*/, int /*
// Something weird happens on NT 4.0 SP5 but I can't reproduce it on other
// NT 4.0 service pack revisions.
if (e.err == ERROR_INVALID_PARAMETER) {
- MsgBox(0, _T("Windows reported an error trying to secure the VNC Server settings for this user. ")
- _T("Your settings may not be secure!"), MB_ICONWARNING | MB_OK);
+ MsgBox(0, "Windows reported an error trying to secure the VNC Server settings for this user. "
+ "Your settings may not be secure!", MB_ICONWARNING | MB_OK);
} else if (e.err != ERROR_CALL_NOT_IMPLEMENTED &&
e.err != ERROR_NOT_LOGGED_ON) {
// If the call is not implemented, ignore the error and continue
@@ -142,7 +142,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE /*prev*/, char* /*cmdLine*/, int /*
// Start a RegConfig thread, to load in existing settings
RegConfigThread config;
- config.start(configKey, _T("Software\\TigerVNC\\WinVNC4"));
+ config.start(configKey, "Software\\TigerVNC\\WinVNC4");
// Build the dialog
std::list<PropSheetPage*> pages;
@@ -159,9 +159,9 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE /*prev*/, char* /*cmdLine*/, int /*
HICON icon = (HICON)LoadImage(inst, MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 0, 0, LR_SHARED);
// Create the PropertySheet handler
- const TCHAR* propSheetTitle = _T("VNC Server Properties (Service-Mode)");
+ const char* propSheetTitle = "VNC Server Properties (Service-Mode)";
if (configKey == HKEY_CURRENT_USER)
- propSheetTitle = _T("VNC Server Properties (User-Mode)");
+ propSheetTitle = "VNC Server Properties (User-Mode)";
PropSheet sheet(inst, propSheetTitle, pages, icon);
#ifdef _DEBUG
@@ -173,7 +173,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE /*prev*/, char* /*cmdLine*/, int /*
} catch (rdr::SystemException& e) {
switch (e.err) {
case ERROR_ACCESS_DENIED:
- MsgBox(0, _T("You do not have sufficient access rights to run the VNC Configuration applet"),
+ MsgBox(0, "You do not have sufficient access rights to run the VNC Configuration applet",
MB_ICONSTOP | MB_OK);
return 1;
};
@@ -181,7 +181,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE /*prev*/, char* /*cmdLine*/, int /*
}
} catch (rdr::Exception& e) {
- MsgBox(NULL, TStr(e.str()), MB_ICONEXCLAMATION | MB_OK);
+ MsgBox(NULL, e.str(), MB_ICONEXCLAMATION | MB_OK);
return 1;
}