Update: UltraVNC 1.4.3.6 and UltraVNC SC 1.4.3.6: https://forum.uvnc.com/viewtopic.php?t=37885
Important: Please update to latest version before to create a reply, a topic or an issue: https://forum.uvnc.com/viewtopic.php?t=37864

Join us on social networks and share our announcements:
- Website: https://uvnc.com/
- GitHub: https://github.com/ultravnc
- Mastodon: https://mastodon.social/@ultravnc
- Facebook: https://www.facebook.com/ultravnc1
- X/Twitter: https://x.com/ultravnc1
- Reddit community: https://www.reddit.com/r/ultravnc
- OpenHub: https://openhub.net/p/ultravnc

Misleading SC error message when repeater DNS lookup fails

Single Click discussions / bugs
Post Reply
Duff
8
8
Posts: 15
Joined: 2005-09-16 03:49
Location: Austin, TX

Misleading SC error message when repeater DNS lookup fails

Post by Duff »

Per subject. I'm testing with UltraVNC SC using a repeater to communicate with the client. When it's unable to resolve the DNS name of the repeater, it pops up a message box titled (roughly) "WinVNC usage" containing the parameters being used. I find this error message to be substantially misleading.

What would it take to replace this with a more useful error message (ie. one asking the user to check their network connection)?
Duff
8
8
Posts: 15
Joined: 2005-09-16 03:49
Location: Austin, TX

Proposed patch

Post by Duff »

This is completely untested, because I don't have a copy of Visual C++... [insert usual griping about projects requiring proprietary tools to build here]...

[syntax="c"]Index: Localization.h
===================================================================
RCS file: /cvsroot/ultravnc/ultravnc/winvnc/winvncsc/Localization.h,v
retrieving revision 1.1
diff -u -3 -r1.1 Localization.h
--- Localization.h 13 Mar 2005 15:19:54 -0000 1.1
+++ Localization.h 15 Oct 2005 20:31:31 -0000
@@ -69,6 +69,8 @@
char sz_ID_DEFAULT_SYST_PROP [64]; // "WinVNC: Default Local System Properties"
char sz_ID_AUTOREJECT_U [64] ; // "AutoReject:%u"
char sz_ID_AUTOACCEPT_U [64] ; // "AutoAccept:%u"
+char sz_ID_DNS_FAILURE_1 [128] ; // "DNS failure looking up "
+char sz_ID_DNS_FAILURE_2 [128] ; // "; perhaps your network is down?"


int Load_Localization(HINSTANCE hInstance)
@@ -127,6 +129,8 @@
LoadString(hInstance, ID_DEFAULT_SYST_PROP, sz_ID_DEFAULT_SYST_PROP, 64 -1);
LoadString(hInstance, ID_AUTOREJECT_U, sz_ID_AUTOREJECT_U, 64 -1);
LoadString(hInstance, ID_AUTOACCEPT_U, sz_ID_AUTOACCEPT_U, 64 -1);
+ LoadString(hInstance, ID_DNS_FAILURE_1, sz_ID_DNS_FAILURE_1, 128 -1);
+ LoadString(hInstance, ID_DNS_FAILURE_2, sz_ID_DNS_FAILURE_2, 128 -1);


return 0;
@@ -190,4 +194,7 @@
extern char sz_ID_AUTOREJECT_U [64] ; // "AutoReject:%u"
extern char sz_ID_AUTOACCEPT_U [64] ; // "AutoReject:%u"

+extern char sz_ID_DNS_FAILURE_1 [128] ; // "DNS failure looking up "
+extern char sz_ID_DNS_FAILURE_2 [128] ; // "; perhaps your network is down?"
+
#endif
Index: resource.h
===================================================================
RCS file: /cvsroot/ultravnc/ultravnc/winvnc/winvncsc/resource.h,v
retrieving revision 1.2
diff -u -3 -r1.2 resource.h
--- resource.h 3 Apr 2005 10:30:13 -0000 1.2
+++ resource.h 15 Oct 2005 20:31:31 -0000
@@ -242,6 +242,8 @@
#define ID_DEFAULT_SYST_PROP 41050
#define ID_AUTOREJECT_U 41051
#define ID_AUTOACCEPT_U 41052
+#define ID_DNS_FAILURE_1 41053
+#define ID_DNS_FAILURE_2 41054

// Next default values for new objects
//
Index: winvncsc.cpp
===================================================================
RCS file: /cvsroot/ultravnc/ultravnc/winvnc/winvncsc/winvncsc.cpp,v
retrieving revision 1.1
diff -u -3 -r1.1 winvncsc.cpp
--- winvncsc.cpp 13 Mar 2005 15:19:56 -0000 1.1
+++ winvncsc.cpp 15 Oct 2005 20:31:31 -0000
@@ -458,6 +458,7 @@
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
setbuf(stderr, 0);
+ int alreadyPrintedError = 0;

//ACT: Load all messages from ressource file
Load_Localization(hInstance) ;
@@ -728,8 +729,18 @@
strcpy(test,name);
vnclog.Print(LL_STATE, VNCLOG("test... %s %d\n"),name,port);
VCard32 address = VSocket::Resolve(name);
- delete [] name;
- if (address != 0) {
+ if (address == 0) {
+ char *failureMessage = new char[strlen(sz_ID_DNS_FAILURE_1) + strlen(sz_ID_DNS_FAILURE_2) + strlen(address) + 1];
+ failureMessage[0] = 0;
+ strcat(failureMessage, sz_ID_DNS_FAILURE_1);
+ strcat(failureMessage, name);
+ strcat(failureMessage, sz_ID_DNS_FAILURE_2);
+ MessageBox(NULL, failureMessage, sz_ID_WINVNC_USAGE, MB_OK | MB_ICONINFORMATION);
+ delete [] name;
+ delete [] failureMessage;
+ alreadyPrintedError = 1;
+ } else {
+ delete [] name;
// Post the IP address to the server

#ifndef SINGLECLICKULTRA
@@ -757,7 +768,8 @@
// Either the user gave the -help option or there is something odd on the cmd-line!

// Show the usage dialog
- MessageBox(NULL, defaultCommandLine, sz_ID_WINVNC_USAGE, MB_OK | MB_ICONINFORMATION);
+ if (!alreadyPrintedError)
+ MessageBox(NULL, defaultCommandLine, sz_ID_WINVNC_USAGE, MB_OK | MB_ICONINFORMATION);
break;
};

Index: winvncsc.rc
===================================================================
RCS file: /cvsroot/ultravnc/ultravnc/winvnc/winvncsc/winvncsc.rc,v
retrieving revision 1.2
diff -u -3 -r1.2 winvncsc.rc
--- winvncsc.rc 3 Apr 2005 10:30:13 -0000 1.2
+++ winvncsc.rc 15 Oct 2005 20:31:31 -0000
@@ -272,6 +272,8 @@
ID_SCM_NOT_HERE " "
ID_SERV_NOT_REG " "
ID_SERV_FAIL_ST " "
+ ID_DNS_FAILURE_1 "DNS failure looking up "
+ ID_DNS_FAILURE_2 "; perhaps your network is down?"
END

STRINGTABLE DISCARDABLE [/syntax]
[mod=494,1129409654]replaced BBCode code by syntax=c and removed extra tag /code[/mod]
Last edited by Duff on 2005-10-15 20:54, edited 1 time in total.
Duff
8
8
Posts: 15
Joined: 2005-09-16 03:49
Location: Austin, TX

Fixed-up patch version

Post by Duff »

So, I've acquired part-time access to a copy of VC++, and come up with the following, improved (read: actually tested and working) patch:

[syntax="c"]Index: winvnc/winvncsc/Localization.h
===================================================================
RCS file: /cvsroot/ultravnc/ultravnc/winvnc/winvncsc/Localization.h,v
retrieving revision 1.1
diff -u -r1.1 Localization.h
--- winvnc/winvncsc/Localization.h 13 Mar 2005 15:19:54 -0000 1.1
+++ winvnc/winvncsc/Localization.h 16 Oct 2005 00:22:29 -0000
@@ -69,6 +69,8 @@
char sz_ID_DEFAULT_SYST_PROP [64]; // "WinVNC: Default Local System Properties"
char sz_ID_AUTOREJECT_U [64] ; // "AutoReject:%u"
char sz_ID_AUTOACCEPT_U [64] ; // "AutoAccept:%u"
+char sz_ID_DNS_FAILURE_1 [128] ; // "DNS failure looking up "
+char sz_ID_DNS_FAILURE_2 [128] ; // "; perhaps your network is down?"


int Load_Localization(HINSTANCE hInstance)
@@ -127,6 +129,8 @@
LoadString(hInstance, ID_DEFAULT_SYST_PROP, sz_ID_DEFAULT_SYST_PROP, 64 -1);
LoadString(hInstance, ID_AUTOREJECT_U, sz_ID_AUTOREJECT_U, 64 -1);
LoadString(hInstance, ID_AUTOACCEPT_U, sz_ID_AUTOACCEPT_U, 64 -1);
+ LoadString(hInstance, ID_DNS_FAILURE_1, sz_ID_DNS_FAILURE_1, 128 -1);
+ LoadString(hInstance, ID_DNS_FAILURE_2, sz_ID_DNS_FAILURE_2, 128 -1);


return 0;
@@ -190,4 +194,7 @@
extern char sz_ID_AUTOREJECT_U [64] ; // "AutoReject:%u"
extern char sz_ID_AUTOACCEPT_U [64] ; // "AutoReject:%u"

+extern char sz_ID_DNS_FAILURE_1 [128] ; // "DNS failure looking up "
+extern char sz_ID_DNS_FAILURE_2 [128] ; // "; perhaps your network is down?"
+
#endif
Index: winvnc/winvncsc/resource.h
===================================================================
RCS file: /cvsroot/ultravnc/ultravnc/winvnc/winvncsc/resource.h,v
retrieving revision 1.2
diff -u -r1.2 resource.h
--- winvnc/winvncsc/resource.h 3 Apr 2005 10:30:13 -0000 1.2
+++ winvnc/winvncsc/resource.h 16 Oct 2005 00:22:29 -0000
@@ -242,6 +242,8 @@
#define ID_DEFAULT_SYST_PROP 41050
#define ID_AUTOREJECT_U 41051
#define ID_AUTOACCEPT_U 41052
+#define ID_DNS_FAILURE_1 41053
+#define ID_DNS_FAILURE_2 41054

// Next default values for new objects
//
Index: winvnc/winvncsc/winvncsc.cpp
===================================================================
RCS file: /cvsroot/ultravnc/ultravnc/winvnc/winvncsc/winvncsc.cpp,v
retrieving revision 1.1
diff -u -r1.1 winvncsc.cpp
--- winvnc/winvncsc/winvncsc.cpp 13 Mar 2005 15:19:56 -0000 1.1
+++ winvnc/winvncsc/winvncsc.cpp 16 Oct 2005 00:31:15 -0000
@@ -458,6 +458,7 @@
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
setbuf(stderr, 0);
+ int alreadyPrintedError = 0;

//ACT: Load all messages from ressource file
Load_Localization(hInstance) ;
@@ -728,8 +729,18 @@
strcpy(test,name);
vnclog.Print(LL_STATE, VNCLOG("test... %s %d\n"),name,port);
VCard32 address = VSocket::Resolve(name);
- delete [] name;
- if (address != 0) {
+ if (address == 0) {
+ char *failureMessage = new char[strlen(sz_ID_DNS_FAILURE_1) + strlen(sz_ID_DNS_FAILURE_2) + strlen(name) + 1];
+ failureMessage[0] = 0;
+ strcat(failureMessage, sz_ID_DNS_FAILURE_1);
+ strcat(failureMessage, name);
+ strcat(failureMessage, sz_ID_DNS_FAILURE_2);
+ MessageBox(NULL, failureMessage, sz_ID_WINVNC_USAGE, MB_OK | MB_ICONINFORMATION);
+ delete [] name;
+ delete [] failureMessage;
+ alreadyPrintedError = 1;
+ } else {
+ delete [] name;
// Post the IP address to the server

#ifndef SINGLECLICKULTRA
@@ -757,7 +768,8 @@
// Either the user gave the -help option or there is something odd on the cmd-line!

// Show the usage dialog
- MessageBox(NULL, defaultCommandLine, sz_ID_WINVNC_USAGE, MB_OK | MB_ICONINFORMATION);
+ if (!alreadyPrintedError)
+ MessageBox(NULL, defaultCommandLine, sz_ID_WINVNC_USAGE, MB_OK | MB_ICONINFORMATION);
break;
};

Index: winvnc/winvncsc/winvncsc.rc
===================================================================
RCS file: /cvsroot/ultravnc/ultravnc/winvnc/winvncsc/winvncsc.rc,v
retrieving revision 1.2
diff -u -r1.2 winvncsc.rc
--- winvnc/winvncsc/winvncsc.rc 3 Apr 2005 10:30:13 -0000 1.2
+++ winvnc/winvncsc/winvncsc.rc 16 Oct 2005 00:22:29 -0000
@@ -272,6 +272,8 @@
ID_SCM_NOT_HERE " "
ID_SERV_NOT_REG " "
ID_SERV_FAIL_ST " "
+ ID_DNS_FAILURE_1 "DNS failure looking up "
+ ID_DNS_FAILURE_2 "; perhaps your network is down?"
END

STRINGTABLE DISCARDABLE
[/syntax]

I'm only playing with SC right now, and haven't looked into whether similar changes are needed or appropriate with other executables.
Post Reply