Update: UltraVNC 1.4.3.6 and UltraVNC SC 1.4.3.6: viewtopic.php?t=37885
Important: Please update to latest version before to create a reply, a topic or an issue: 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://twitter.com/ultravnc1
- Reddit community: https://www.reddit.com/r/ultravnc
- OpenHub: https://openhub.net/p/ultravnc

New option for QueryDialog if no user is logged on

Post Reply
Marscha
Former moderator
Former moderator
Posts: 464
Joined: 2004-05-14 06:48

New option for QueryDialog if no user is logged on

Post by Marscha »

I added a new option HKLM\SOFTWARE\ORL\WinVNC3\Default\QueryIfNoLogon.
This option could be used for UltraVNC in service mode.

If set to 1 and "Display Query Window" is also checked, the QueryDialog pops up even if no user is logged on to the machine.

At the moment you have to configure this option in the registry.
If there is enough demand I'll add it to the Admin Properties dialog.

Uploaded test binary to http://doc.uvnc.com/QueryIfNoLogon/winvnc.exe

Please test and let me know if it works.
redge
1000
1000
Posts: 6797
Joined: 2004-07-03 17:05
Location: Switzerland - Geneva

Post by redge »

If there is enough demand I'll add it to the Admin Properties dialog.
Better to add as official documented feature without waiting enough request (actually, known as hidden feature documented here on forum)
UltraVNC 1.0.9.6.1 (built 20110518)
OS Win: xp home + vista business + 7 home
only experienced user, not developer
swift.consult
Posts: 5
Joined: 2006-04-13 12:44
Contact:

Missing option QueryIfNoLogon

Post by swift.consult »

We want to run UltraVNC as service, but need to display the accept dialog even if nobody is logged in.
After testing the mentioned reg-key with the current "Ultr@VNC 1.0.1 Setup" version which seems to igrnore it, I tried your QueryIfNoLogon/winvnc.exe binary which produces a "beep" at the client on connection attempt from viewer, accepting or rejecting the conection depending on the QueryAccept setting.

To find out, what's going on, I downloaded the source zip from sourceforge and (since I'm using VS.NET 05) checkout the SVN repository (from http://sc.uvnc.com/svn/ultravncV1). But in booth, I can't find any handling of the QueryIfNoLogon option. I am missing something?
Do I have the current source?
Is this option already supported?

many thanks in advance
Andreas

BTW: using Windows XP (MUI), running winvnc service as local system (allowed to interact with desktop)
Marscha
Former moderator
Former moderator
Posts: 464
Joined: 2004-05-14 06:48

Post by Marscha »

I checked in the code to the UltraVNC CVS at Sourceforge:
http://sourceforge.net/cvs/?group_id=63887

I re-tested the server behavior: You are right that there is no pop-up dialog

I have to check old beta code which claims that this is working.
Maybe I have missed something.

Martin
swift.consult
Posts: 5
Joined: 2006-04-13 12:44
Contact:

display dialog in service

Post by swift.consult »

Thanks a lot for the fast awnser!

After some investigation of the source code I archived a rudimentary understanding of the coherences. In my opinion it is not possible (at least not easy) to display a dialog box from a service in Win XP Pro, when nobody is logged in.

In Google Groups I found a posting for a thread called "start exe before logon screen" talking about Window Stations and Window Desktops:
From: Igor Titov - view profile
Date: Mon, Apr 20 1998 12:00 am
Not yet rated

show options


Exactly.
But for the service you can create your own visible WindowStation (and
you MUST do it for that program) and Desktop.
Use SetProcessWindowStation to attach WindowStation to your service
process.
Then either use SetThreadDesktop function to attach current thread to
Desktop or simply use CreateProcess
with STARTUPINFO.lpDesktop parameter filled to start new process that
can use Desktop.
And only after that you can create windows.


With best regards,
Igor Titov, InFoS Soft
Instead of implementing something like that, I tried to run winvnc.exe -run with a few modifications from a startup-script or comparable but can't get this to work either.

It would be great, if you have a working version in an older beta. I didn't find something promising on random inspection of older code, but assume you are much more familiar with this.

kind regards
Andreas
Marscha
Former moderator
Former moderator
Posts: 464
Joined: 2004-05-14 06:48

Post by Marscha »

Andreas,

I have the feeling that this maybe never worked in older code.
But there is a working example in newer Realvnc 4 code.
I started to play with it here: http://sc.uvnc.com/svn/archive2/trunk
Use subversion to get a working copy.

Martin
swift.consult
Posts: 5
Joined: 2006-04-13 12:44
Contact:

Possible Solution

Post by swift.consult »

I've taken a short look at the RealVNC code, but don't understand it yet.

I managed to view the window by adding the following lines to UnltraVNC vncclient.cpp, InitAuhtenticate()

Code: Select all

HWINSTA hstation = OpenWindowStation(TEXT("WinSta0"), false, WINSTA_ALL_ACCESS);
HDESK hdesktop = OpenDesktop(TEXT("WINLOGON"), 0, false, DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL | DESKTOP_JOURNALPLAYBACK | DESKTOP_JOURNALRECORD | DESKTOP_READOBJECTS | DESKTOP_SWITCHDESKTOP | DESKTOP_WRITEOBJECTS | STANDARD_RIGHTS_REQUIRED);
BOOL res = SetThreadDesktop(hdesktop);
Now the window is always dispayed on the Winlogon desktop, even when a user is logged in and the default desktop is visible.
I will try to find out, how to determine the current visible desktop and let you know the results.

regards
Andreas
swift.consult
Posts: 5
Joined: 2006-04-13 12:44
Contact:

please check and integrate

Post by swift.consult »

Since I'm somewhat confused by the diferent SVN and CVS Repositories for UltraVNC and don't have write acces to any of them, I want to ask, if you can review and integrate the following code (tested with the SVN-Version, without QueryIfNoLogon).

original vncclient.cpp, Ln 571 (CVS)

Code: Select all

else 
{
	if ( !(acceptDlg->DoDialog()) ) verified = vncServer::aqrReject;
}
to be replaced by:

Code: Select all

else 
{
	// swift.consult@2006 - display dialog on the current desktop
	HDESK hdesktop;

	if (strcmp(username, "") != 0) // if somebody is logged in, use the default, else use the winlogon desktop to display the dialog
		hdesktop = OpenDesktop(TEXT("DEFAULT"), 0, false, DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_READOBJECTS | DESKTOP_WRITEOBJECTS | STANDARD_RIGHTS_REQUIRED);
	else
		hdesktop = OpenDesktop(TEXT("WINLOGON"), 0, false, DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_READOBJECTS | DESKTOP_WRITEOBJECTS | STANDARD_RIGHTS_REQUIRED);
					
	if (hdesktop != NULL)
		SetThreadDesktop(hdesktop);
	else
		vnclog.Print(LL_INTWARN, "OpenDesktop failed"); 

	if ( !(acceptDlg->DoDialog()) ) verified = vncServer::aqrReject;
						
	if (hdesktop != NULL)
		CloseDesktop(hdesktop);
}
many thanks for your help
Andreas
Last edited by swift.consult on 2006-04-19 12:30, edited 2 times in total.
Marscha
Former moderator
Former moderator
Posts: 464
Joined: 2004-05-14 06:48

Post by Marscha »

I'll review and try to integrate it.

I agree that it's difficult at the moment with all the different code repositories :|
swift.consult
Posts: 5
Joined: 2006-04-13 12:44
Contact:

update

Post by swift.consult »

without switching back to the original desktop, you can only view, but not interact with the server desktop from the viewer.

Code: Select all

else 
{
	// swift.consult@2006 - display dialog on the current desktop
	HDESK hdesktop;
	HDESK horgdesk = NULL;

	if (strcmp(username, "") != 0) // if somebody is logged in, use the default, else use the winlogon desktop to display the dialog
		hdesktop = OpenDesktop(TEXT("DEFAULT"), 0, false, DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_READOBJECTS | DESKTOP_WRITEOBJECTS | STANDARD_RIGHTS_REQUIRED);
	else
		hdesktop = OpenDesktop(TEXT("WINLOGON"), 0, false, DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_READOBJECTS | DESKTOP_WRITEOBJECTS | STANDARD_RIGHTS_REQUIRED);
					
	if (hdesktop != NULL)
	{
		horgdesk = GetThreadDesktop(GetCurrentThreadId());
		vnclog.Print(LL_INTINFO, "GetThreadDesktop");
		SetThreadDesktop(hdesktop);
	}
	else
		vnclog.Print(LL_INTWARN, "OpenDesktop failed"); 

	if ( !(acceptDlg->DoDialog()) ) verified = vncServer::aqrReject;
						
	if (hdesktop != NULL)
		CloseDesktop(hdesktop);
	if (horgdesk != NULL)
		SetThreadDesktop(horgdesk);
}
zschendh
Posts: 1
Joined: 2006-08-24 13:13

Re: New option for QueryDialog if no user is logged on

Post by zschendh »

Hi Guys,
i looking for exactly the same feature. my Question: did you made any progress ? where can i ge the current source code for the UVNC (the above mentioned SVN is not working for me ....?

Thanks in advance & regards
Sir Richard of Kerry ;)
Marscha
Former moderator
Former moderator
Posts: 464
Joined: 2004-05-14 06:48

Re: New option for QueryDialog if no user is logged on

Post by Marscha »

Finally found how to get the dialog showing up on the logon screen.
Change will be uploaded to CVS/SVN soon.
Test binary: http://www.uvnc.com/QueryIfNoLogon/winvnc.exe
Last edited by Marscha on 2007-02-19 13:12, edited 2 times in total.
Marscha
Former moderator
Former moderator
Posts: 464
Joined: 2004-05-14 06:48

Re: New option for QueryDialog if no user is logged on

Post by Marscha »

Uploaded change to CVS/SVN.
UltraSam
Admin & Developer
Admin & Developer
Posts: 462
Joined: 2004-04-26 20:55
Contact:

Re: New option for QueryDialog if no user is logged on

Post by UltraSam »

Thanks :)

Will be in v1.0.3
UltraSam
ticklemeozmo
Posts: 1
Joined: 2007-10-20 18:10

Re: New option for QueryDialog if no user is logged on

Post by ticklemeozmo »

Is there any way this option can include:

When winvnc.exe is used as a service,
* Querying if user is logged in
* Not query if at login screen
Post Reply