amitbet / vnc2video

A fully featured VNC client written in golang
MIT License
156 stars 39 forks source link

Recording crash with TightVNC server on Windows 10: unknown message-type: 6 #13

Open gmarec opened 4 years ago

gmarec commented 4 years ago

I'm using https://github.com/saily/vnc-recorder, but randomly I've got :

INFO[0411] ========got server message, msgType=6
panic: unknown message-type: 6

In your code I can see :

// Server-to-Client message types const ( FramebufferUpdateMsgType ServerMessageType = iota SetColorMapEntriesMsgType BellMsgType ServerCutTextMsgType )

So there's no type 6 and I don't know what is a type 6 message, RFB protocol tells "Possibly used by UltraVNC".

Have you any idea how to fix this ?

Thanks

amitbet commented 4 years ago

First tell me, which server are you using? is it UltraVNC?

In any case, since RFB is a binary protocol which has no message size, untreated messages can break the system: reading the wrong size (or not reading something), means that you are now off by some bits, so you don't know where the next message begins.

to fix this you should first see that you are really getting this message type and not just failing on a previous message and wrongly reading the next message and it's type. (check for any previous silent failures by opening up debug level / adding some logs) if it is a correct message type, then you should implement this message type (just by reading & skipping it):

You should also try to understand when the server is sending the problematic message, it can furtehr your understanding about what the problem really is (it might be when you are in fullscreen, or when you open some spacial image remotely, when pressing ctrl+c / ctrl+v, or maybe when the mouse hover over something and changes the cursor, etc.)

Ultra vnc source is available for download here: (it's actually GPL opensource) https://www.uvnc.com/downloads/ultravnc/100-download-ultravnc-10962.html look at rfb/rfbproto.h and other files in that area. Their code doesn't indicate using server message type = 6 as far as I can see.

gmarec commented 4 years ago

@amitbet I use TightVNC for Windows (Version 2.8.27) on Windows 10 64 bits.

I will try to investigate on server side, thanks for your help.