#135 WinVNC service mode does not work on Windows 7

trunk
closed-fixed
None
5
2014-02-10
2013-12-16
Peter Åstrand
No

The current WinVNC does not work in service mode on Windows 7. As DRC says on http://article.gmane.org/gmane.network.vnc.tigervnc.user/759:

"There are major known issues with using the server on Windows 7-- service mode does not work properly, for instance, and it won't ever work without a complete rearchitecting of the code. Basically, the service needs to be separated into a different process from the GUI, since services under Win7 can no longer access GUI functions."

After running the installer, the service has been started properly. However, there's no password configured, and there's no easy way of configuring one: Selecting "Configure VNC Server" under the "service mode" folder on the start menu gives you an "insufficient permission" error.

Discussion

  • Jochen Tucht
    Jochen Tucht
    2013-12-25

    Please find attached my proposal to address the issue.
    It follows the two-process approach and is distilled from code found in UltraVNC.

    Since I found no apparent way to trigger the Ctrl+Alt+Del simulation logic from VNC Viewer, I left that part unfinished for now.

     
    Last edit: Jochen Tucht 2013-12-26
  • Peter Åstrand
    Peter Åstrand
    2014-01-09

    Thanks for your work. Can you provide a patch in "diff -u" format? Also, what do you mean with that you cannot trigger Ctrl+Alt+Del simulation: Both the TigerVNC and the UltraVNC viewer (as far as I know) has an option for "Send Ctrl-Alt-Del", have you tried that?

     
  • Peter Åstrand
    Peter Åstrand
    2014-01-09

    Btw, I also got a build error:

    tigervnc/win/winvnc/VNCServerService.cxx: In function 'void LaunchProcessWin(DWORD)':
    tigervnc/win/winvnc/VNCServerService.cxx:102:71: error: '_countof' was not declared in this scope
    tigervnc/win/winvnc/VNCServerService.cxx: In member function 'virtual DWORD winvnc::VNCServerService::serviceMain(int, TCHAR)':
    tigervnc/win/winvnc/VNCServerService.cxx:159:41: warning: suggest parentheses around '&&' within '||'
    tigervnc/win/winvnc/VNCServerService.cxx:124:10: warning: unused variable 'Slow_connect'
    tigervnc/win/winvnc/VNCServerService.cxx:125:10: warning: unused variable 'last_con'
    make[5]:
    [win/winvnc/CMakeFiles/winvnc4.dir/VNCServerService.cxx.obj] Fel 1

    If you want, feel free to continue discussion on the tigervnc-devel mailing list.

     
  • Jochen Tucht
    Jochen Tucht
    2014-01-09

    Please find updated patch attached. It addresses the build issues and also elaborates Ctrl+Alt+Del simulation logic. (I was not aware of the menu key, hence my wondering how to make the viewer send Ctrl+Alt+Del.)

    Ctrl+Alt+Del simulation on Windows 7 must be enabled as per the following registry excerpt:

    REGEDIT4

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
    "SoftwareSASGeneration"=dword:00000001

    If the SoftwareSASGeneration entry already exists, its value must be bit-wise ORed with 1.

     
  • Peter Åstrand
    Peter Åstrand
    2014-01-13

    Build works now. However, when I'm trying to configure the service, by clicking on the "Configure VNC Server" (under Service mode), I get "Insufficient permissions to run the applet", just as before.

     
    • Jochen Tucht
      Jochen Tucht
      2014-01-16

      Looks like a setup issue. The menu item should be configured to run as administrator.
      What happens when you right-click the TigerVNC tray icon and invoke "Options..."?

       
      • Peter Åstrand
        Peter Åstrand
        2014-01-17

        Looks like a setup issue. The menu item should be configured to run as administrator.

        I see. In that case, I guess we need to tweak the installer so that it configures the shortcut this way. Can you provide a patch for this as well?

        What happens when you right-click the TigerVNC tray icon and invoke >"Options..."?

        That works, and I'm able to set a VNC password. However, when I'm connecting from another machine, I just get:

        CConn: connected to host lab-23 port 5900
        CConnection: Server supports RFB protocol version 3.8
        CConnection: Using RFB protocol version 3.8
        main: End of stream

        So something is still wrong. Would it be possible for you to publish the winvnc binary EXE? This way, we can rule out any problems with our build environment, and others can test.

        Btw, I just noted that none of the options I configure "stays". The next time I open the VNC configurations, my changes are gone. That probably explains the "End of stream" problem.

         
        • Jochen Tucht
          Jochen Tucht
          2014-01-18

          I saw the same behavior before the issue magically disappeared. Some more investigation revealed that vncconfig.exe does not save any settings made in frame "Authentication" unless you also check the "None" option in frame "Session encryption".

           
        • Jochen Tucht
          Jochen Tucht
          2014-01-23

          Now that you know a workaround for the options GUI issue, what is the outcome of repeating your test with a valid password?

           
          • Peter Åstrand
            Peter Åstrand
            2014-01-23

            I've delegated testing to a collegue of mine, Samuel Mannehed. He will follow up soon; probably today.

             
  • Hello Jochen.

    I have tested the patch in both Windows 7 and Windows XP and there are problems in both operating systems. Can you fix these?

    Windows XP:
    The patch seem to have broken two ways of opening the Properties window:

    • Opening the Properties window from the "Options" button in the menu from the tray icon

    • Opening the Properties window from the "Properties" button in the Control Panel

    The vncconfig.exe process is still started but no window pops up. The owner of the vncconfig.exe process, when starting it through the two broken ways mentioned above, is different with and without the patch. With the patch the owner is SYSTEM, and without the patch the owner is the user.
    The Properties window can still be opened properly by selecting "Configure VNC Service" from the Start Menu. When opening the window in this way, the owner of the process is the user. To me it seems like Windows XP requires the owner to be the user in order for the window to properly show.
    I have verified that all three ways of opening this window work without
    the patch.

    Windows 7
    As Peter mentioned, the shortcuts in the Start Menu requires the user to right-click and choose "Run as administator". Otherwise an error is shown: "unable to open the service: Access is denied. (5)"

    Edit: formatting

     
    Last edit: Samuel Mannehed 2014-01-23
  • Jochen Tucht
    Jochen Tucht
    2014-01-24

    Windows XP:
    It turns out that on Windows XP, STARTUPINFO::lpDesktop, if specified, must include the window station name. This is "WinSta0" for the interactive window station.
    Based on this insight, fix-vncconfig-visibility-issue-on-windows-xp.patch should fix the issue.

    Windows 7:
    The "Run as administrator" issue should preferably be solved in setup. I will take a look into this later.

    Edit: winvnc-service-mode-setup.patch adds PascalScript code to the installer to modify the Service-Mode start menu commands so they run as administrator, as well as set up the SoftwareSASGeneration system policy so as to allow services to simulate Ctrl+Alt+Del.

     
    Last edit: Jochen Tucht 2014-01-26
  • Thank you for the fixes, it seems to work fine now!
    This can be regarded as a bounty well earned in my eyes. Peter will handle this. Thank you!

     
  • This is now committed, revision 5158.

     
    Last edit: Samuel Mannehed 2014-02-07
    • status: open --> closed-fixed
     
  • Peter Åstrand
    Peter Åstrand
    2014-02-10

    Jochen Tucht, thanks for your work! Please create a claim at Bountysource.com to receive the bounty amount.