Hello all,

We have also been hit by they annoying "disappearing wallpaper" bug that's
present in version 3.3.3R9 release of WinVNC. In looking through the code,
we discovered the following in file vncMenu.cpp:

...snip...
        case WM_SRV_CLIENT_AUTHENTICATED:
        case WM_SRV_CLIENT_DISCONNECT:
                // Adjust the icon accordingly
                _this->FlashTrayIcon(_this->m_server->AuthClientCount() != 0);

                if (_this->m_server->AuthClientCount() != 0) {
                                if (_this->m_server->RemoveWallpaperEnabled())
                                        KillWallpaper();
                }
                else    RestoreWallPaper();
                }
                return 0;
..snip...

As you can see, the RestoreWallPaper() function is always called when
all authenticated clients have disconnected regardless of the current
setting of the registry specifically prohibiting changes to the wallpaper.

This is not a problem when WinVNC is run as a user process, but breaks
when run as a system service. This is, what we believe, to be the primary
cause of the reports of brief changes (in NT and possibly Win2000/XP) in
wallpaper when clients are disconnecting.

The reason is that the RestoreWallPaper() function calls the
SystemsParametersInfo() function with a NULL parameter indicating that the
default desktop wallpaper should be restored. This makes sense in the
context of the current user, but when WinVNC is run as a service, there is
no such context (this is because SystemsParametersInfo() queries the
registry for HKEY_CURRENT_USER\Control Panel\Desktop\WallPaper, which
refers to the user that owns the WinVNC service, not the currently logged
in user).

The following changes to this file will fix this propblem:

...snip...
        case WM_SRV_CLIENT_AUTHENTICATED:
        case WM_SRV_CLIENT_DISCONNECT:
                // Adjust the icon accordingly
                _this->FlashTrayIcon(_this->m_server->AuthClientCount() != 0);
                if (_this->m_server->AuthClientCount() != 0)
                      {
                      if (_this->m_server->RemoveWallpaperEnabled())
                               KillWallpaper();
                      }
                else  {
                      if (_this->m_server->RemoveWallpaperEnabled())
                              RestoreWallpaper();
                      }
                return 0;
...snip...

Please note that this is only a fix if you have disabled the removal of
the wallpaper by setting the appropriate registry settings. A more
elaborate fix is required to actually consistently restore the user's
desktop wallpaper when disconnecting.

Regards,

Stephan.
--
Stephan A. Edelman
NewAce Corporation
Toll Free: 1-877-463-9223 x21
International: +1 519 336-4837 x21
-- www.planetdns.net -- Globally distributed dynamic DNS services for your
                        dynamic IP address
_______________________________________________
VNC-List mailing list
[EMAIL PROTECTED]
http://www.realvnc.com/mailman/listinfo/vnc-list

Reply via email to