Showing posts with label VNC. Show all posts
Showing posts with label VNC. Show all posts

Next-Generation ThinVNC Access Point Delivers Unique Web Access to LAN Computers through RDP Connections

Cybele Software, Inc. releases the new ThinVNC Access Point, providing remote users an HTML5 Remote Desktop access point to any PC via a secure HTTPS/Websockets connection

For Immediate Release

WILMINGTON, DE, May 31, 2011—Cybele Software, Inc. announces the release of ThinVNC Access Point, a leading edge software tool that provides a single entry point for Remote Desktop access to any PC in the corporate LAN using a secure, firewall-friendly connection.

With ThinVNC Access Point, users gain an expanded range of telecommunicating and remote communication options. The HTML5-to-RDP Gateway allows users with an Internet connection and an HTML5 Web Browser to access business computers through an intuitive Web user interface. ThinVNC Access Point elevates business communication to a whole new level by allowing users to share their full Windows Desktop, or a single application in it, while using their preferred tablet, laptop, or computer.

ThinVNC Access Point ensures that IT personnel retain control of security and access. After completing a credentialed log in, system administrators designate PC(s) in the LAN/WAN as accessible on a user-by-user basis. Users select the computer to access through a secure HTTPS address.

ThinVNC Access Point comes with a Remote Installation Tool that allows IT personnel easily complete installation. After installation, IT personnel can access the PC at all times through a Wake-on-LAN link. This feature streamlines routine maintenance tasks and ensures that emergency situations can be handled in an efficient and timely manner.

ThinVNC Access Point Highlights

  • Single access point for Remote Desktop access to any PC in the LAN
  • ThinVNC bridge extends ThinVNC to allow access through just one public IP address
  • HTML5-to-RDP gateway allows access to any Windows PC or RDP server from a HTML5-compliant web browser
  • Secure (HTTPS / WebSockets+SSL) firewall-friendly access point
  • Web user interface for users and PCs administration
  • Windows Login Support
  • Remote Installation Tool allows for easy ThinVNC setup on a remote PC
  • Wake-On-LAN (WOL) link enables administrators to remotely turn on any listed PCs

ThinVNC Access Point Requirements

- Server:
  • Any PC with Windows XP and higher

- LAN PC:
  • ThinVNC running on any PC with Wndows XP and higher
  • For RDP access, any Windows PC with Remote Desktop service configured
  • Any Linux running XRDP or any other RDP server

- Client:
  • Any PC or tablet with an HTML5-compliant Web browser (i.e. IE 9, Google Chrome, Firefox, Safari, Opera, etc.)

Contact

For more information about our WEB RDP solutions contact Cybele Software, Inc.
3422 Old Capitol Trail, Suite 1125, Wilmington, DE 19808 USA.
Phone: (302) 892-9625 or (866) 462-9768
Email: info@cybelesoft.com
Website: www.cybelesoft.com

ThinVNC gets secure gateway for corporate remote sessions

ThinVNC Remote Access Server enables an HTML5 Remote Desktop access point to any PC within the corporate LAN/WAN, administering and redirecting ThinVNC’s HTTPS/WebSockets traffic. With the ability to define users and PCs, ThinVNC Remote Access Server is the perfect tool for secure telecommuting, remote support and administration.


Cybele Software, Inc. announces a final release of ThinVNC Remote Access Server, a tool that provides an access point for remote screen sessions. ThinVNC Remote Access Server, redirects ThinVNC’s HTTPS/Websockets traffic enabling secure access to any PC on the LAN through just one public IP address, using native, firewall-friendly protocols and ports.

ThinVNC Remote Access Server offers an easy-to-use web interface targeted to both administrators and end-users. After sign in with their credentials, administrators can manage end-users and assign PCs they can get access to. As a result, end-users are presented with a list of their authorized PCs, making them accessible with a click.

ThinVNC Remote Access Server requires a copy of ThinVNC running on each remote PC. To ease the installation task, ThinVNC Remote Access Server provides a Remote Install tool, enabling on-demand remote ThinVNC installation.

What if the target PC is turned off? ThinVNC Remote Access Server solves this very common obstacle for remote access. When the PC is off, end-users can remotely turn it on with a single click, sending a Wake-On-LAN packet over the network. This option makes it unnecessary to leave PCs permanently on, thus saving energy and helping to keep data privacy while the user is not sitting at desk.

ThinVNC Remote Access Server Highlights:
- Secure (SSL), Firewall-friendly Remote Desktop Access Point
- Web User Interface
- Users/PCs Administration
- Windows Logon Support
- Remote Install Tool
- Wake-On-Lan (WOL)

ThinVNC Remote Access Server can be installed on Windows 2000/XP/2003/Vista/Win 7/Windows Server 2008. On the client side, both tools are compatible with any Operating System and any HTML5-compliant Web Browser such as Mozilla Firefox, Google Chrome, Opera, Safari, etc.

For more information about ThinVNC and ThinVNC Remote Access Server, contact Cybele Software, Inc.
3422 Old Capitol Trail, Suite 1125, Wilmington, DE 19808 USA.
Phone: (302) 892-9625 or (866) 462-9768
Email: info@cybelesoft.com
Website: www.cybelesoft.com


###

Cybele Software, Inc. announces the release of ThinVNC Remote Access Server


ThinVNC Remote Access Server enables external HTML5 Remote Desktop Access to any PC within the corporate LAN/WAN, tunneling ThinVNC traffic over HTTP/WebSockets and SSL. With the ability to define users and PCs, ThinVNC Remote Access Server is the perfect tool for secure telecommuting, remote support and administration.

Cybele Software, Inc. announces a public beta release of ThinVNC Remote Access Server, a software solution to grant full-external HTML5 Remote Desktop Access to any PC within the LAN. ThinVNC Remote Access Server tunnels ThinVNC traffic over HTTP/WebSockets and SSL, enabling secure access to any PC through just one public IP, using firewall-friendly protocols and port.
ThinVNC Remote Access Server provides an easy-to-use web interface targeted to both administrators and end-users. Using ThinVNC Remote Access Server, administrators can manage users and assign the PCs they can gain access to. End-users simply see a list with their assigned PCs, making them possible the remote desktop access with a simple click. Furthermore, when the remote PC is off, end-users can remotely turn the PC on using the Wake-On-LAN feature, making unnecessary to leave all PC permanently on.
ThinVNC Remote Access Server requires a copy of ThinVNC running on each remote PC. To ease the installation task, ThinVNC Remote Access Server provides a Remote Install tool, enabling on-demand and remote ThinVNC installation.

ThinVNC Remote Access Server Highlights:

- Secure (SSL), Firewall-Friendly External Remote Desktop Access to every PC on the LAN
- ThinVNC traffic tunneling
- Pure-Web Access, HTML5 Based
- Users/PCs Administration
- Windows Logon Support
- Remote Install Tool
- Wake-On-Lan (WOL)

Whenever required, ThinVNC Remote Access Server grants remote access to every PC Desktop in the LAN/WAN:
· Home users or corporate employees can work remotely virtually from anywhere: with ThinVNC Remote Access Server, telecommuting only requires internet connection and a HTML5 capable browser. Severe weather condition, traffic jams and business trips are no longer an obstacle to get the work done.
· Sharing the full Windows Desktop or a single application with someone outside the LAN can become an impossible mission: security rules and firewall settings usually do not support them. ThinVNC Remote Access Server provides secure, but still firewall-friendly tools to invite a customer to see a presentation or allow a colleague to join in a collaboration session.
· IT personnel often requires to solve typical issues like changing printer settings, removing virus and installing driver updates remotely: ThinVNC Remote Access Server guarantees the remote desktop access to any PC on the network even if the PC is off.
· With the use of ThinVNC Remote Access Server, highly delicate servers and databases can be securely managed without delay. Either on regular basis maintenance or during an emergency, the remote access to a corporate Windows 2003 Server, for instance, makes possible to System and Network Administrators to perform any required duty with efficiency.
ThinVNC Remote Access Server can be installed on Windows 2000/XP/2003/Vista/Win 7/Windows Server 2008. On the client side, ThinVNC is compatible with any Operating System and any HTML5-compliant Web Browser such as Mozilla Firefox, Google Chrome, Opera, Safari, etc.

Cybele Software’s Development News

We are glad to inform you of our latest Development News:

TN Bridge Host Integration Pack on the new Embarcadero’s Delphi XE
TN Bridge Host Integration Pack is now compatible with the new Embarcadero’s Delphi XE development environment. So now, TN Bridge Host Integration Pack supports Embarcadero’s Delphi 5 through XE, any ActiveX compatible Development Environment and .NET framework and programming languages.

z/Scope for iPad/Android
We are currently extending z/Scope to enable Terminal Emulation access from iPad, tablet devices and smart phones running Apple iOS and Google Android’s OS. We would like to know about your current needs and what features you consider a must for a mobile OS Terminal Emulator. You can send us your comments and suggestions and we’d be happy to evaluate any special need or request you may have.

Web RDP client reaching its final release
Our new Web RDP client it is now getting close to its official release. We are thrilled about the amazing performance it is showing due to the full WebSockets implementation and Video Driver support, among other improvements. We are also planning full Chrome, Firefox and Internet Explorer compatibility and many other enhacements. Stay tunned!

ThinVNC HTML5 Remote Desktop, now with WebSockets and Seamless Windows

ThinVNC newest beta build is now available on the product site. With this build, added to its pure HTML5 web browser client, ThinVNC brings a brand new native MS Windows client with Seamless Windows support. Now, you can access a remote computer and work with remote and local applications seamlessly integrated on the same local desktop.

The new ThinVNC Windows Client connects to ThinVNC server using the WebSockets protocol, enabling native HTTP(S) firewall-friendly connections without the typical overhead of an HTTP encapsulation. A new WebSockets-enabled HTTP(S) Server is now in place to allow parallel WebSockets and AJAX long-poll implementation.

Additionally, ThinVNC gateway functionality has been enhanced to proxy other ThinVNC servers using WebSockets protocol, easing the external access to intranet PCs using pure HTTP and SSL3/TLS1.

On its pure-web remote access mode, this new build brings full clipboard support and several fixes. A WebSockets native browser client is under development and expected to be released soon.

What’s new?

· New WebSockets-enabled HTTP(S) Server.

· New Windows Client with WebSockets and Seamless Windows support

· HTML5 browser client clipboard support

· Fixed scale issues on Firefox

· Optimized Google Chrome Frame installation for IE

· Solved drawing delay when switching tabs during a presentation

· Fixed other miscellaneous errors

Are you a developer or beta tester working with ThinVNC? We want to hear from you! Send your feedback to support@cybelesoft.com or join us on Twitter to let us know your experiences: @cybelesoft


ThinVNC - Digging into the code, Part II

Introduction

In the first part of this article I showed how to do the screen capture, window by window and, using clipping regions and bitmap comparison, how to build a list of changed bitmap regions to send to the client. In this second part, we'll see how to send all this information to the client. 

The code - Part II

The following JSON is an example of a desktop capture.  
 Collapse
{"status:":1,"desktopWidth":1280,"desktopHeight":800,"cursor":"default","cursorX":241,"cursorY":525,
 "windows": [ { "hwnd":"196724","zidx":1,"desktop":"Default","left":0,"top":0,"width":1280,"height":800},
    { "hwnd":"8521744","zidx":2,"desktop":"Default","left":364,"top":59,"width":806,"height":667},
    { "hwnd":"8129930","zidx":3,"desktop":"Default","left":-8,"top":-8,"width":1296,"height":776},
    { "hwnd":"1247020","zidx":4,"desktop":"Default","left":244,"top":28,"width":1023,"height":728},
    { "hwnd":"8785068","zidx":5,"desktop":"Default","left":-8,"top":-8,"width":1296,"height":776,"imgs": [ { "x":8,"y":8,"w":1280,"h":123,"img": "data:image/jpeg;base64,/9j/4......" }]},
    { "hwnd":"6033806","zidx":6,"desktop":"Default","left":-1,"top":479,"width":426,"height":22,"imgs": [ { "x":1,"y":0,"w":425,"h":22,"img": "data:image/jpeg;base64,/9j/4AAQ......" }]},
    { "hwnd":"196708","zidx":7,"desktop":"Default","left":0,"top":760,"width":1280,"height":40,"imgs": [ { "x":53,"y":0,"w":1227,"h":40,"img": "data:image/jpeg;base64,/9j/4AA......" }]},
    { "hwnd":"131186","zidx":8,"desktop":"Default","left":0,"top":760,"width":54,"height":40,"imgs": [ { "x":0,"y":0,"w":54,"h":40,"img": "data:image/jpeg;base64,/9j/4AAQSkZJ......" }]}]]}   
The "windows" array contains all the visible windows on the desktop. Each item contains the window handle (for identification purpouses), its bounding rectangle, the desktop to which it belongs, its relative z-order and an array of images. Each image corresponds to changed region on that specific window. If there are no changes, the "imgs" array doesn't exist. 
 Collapse
function reload() {
    scale = getScale();
    var url = baseUrl + "json?id=" + sessionStatus.id;
    clearTimeout(jsonTimeout);
    jsonTimeout = setTimeout(onJsonTimeout,jsonTimeoutValue);
    $.getJSON(url, function (obj) {
        try {

            $.each(obj.windows, function (i, win) {
                processWindow(win);
            })

            for (var i = deskDiv.children.length - 1; i >= 0; i--) {

                var found = false;
                var canvas = deskDiv.children[i];

                $.each(obj.windows, function (i, win) {
                    var canvasid = "canvas" + win.hwnd;
                    if (canvas.id == canvasid) {
                        found = true;
                    }
                })
                if (!found) {
                    canvas.style.display = "none";
                    canvas.innerHTML = '';
                    deskDiv.removeChild(canvas);
                }
            }

        }
        catch (err) {
            if (sessionStatus.active) {
                setTimeout(reload, 1);
            }
        }
    });
}
For each "window" item received, the processWindow method is called, creating or reusing a canvas element. All canvas elements belonging to windows that aren't present in this JSON correspond to windows that have already been closed. These are erased on the "for (var i = deskDiv.children.length - 1; i >= 0; i--)" loop. 
ProcesWindows function creates or reuses a canvas per window, using the hwnd as part its id. It also sets the canvas coordinates and its zindex according to the received information, and iterates over the images array to copy them on the canvas surface.
 Collapse
function createCanvas(win) {
    var canvas = document.createElement("canvas");
    
    canvas.visibility = 'visible';
    canvas.display = 'block';
    canvas.style.position = 'absolute';
    canvas.style.left = (win.left-sessionStatus.viewLeft)+'px';
    canvas.style.top = (win.top-sessionStatus.viewTop)+'px';
    canvas.style.zIndex = win.zidx;
    canvas.width = deskDiv.offsetWidth;
    canvas.height = deskDiv.offsetHeight;
    canvas.id = "canvas" + win.hwnd;
    deskDiv.appendChild(canvas);
    return canvas;
}

function processWindow(win) {
    var canvasid = "canvas" + win.hwnd;
    var canvas = document.getElementById(canvasid);
    if (!canvas) {
        canvas = createCanvas(win);
    }

    deskDiv.style.marginLeft = getDeltaX() + 'px';
    deskDiv.style.marginTop = getDeltaY() + 'px';
    if ((win.width == 0) || (win.height == 0)) {
        canvas.style.visibility = "hidden";
        canvas.style.zIndex = -1;
    } else {
        canvas.style.left = (win.left-sessionStatus.viewLeft) + 'px';
        canvas.style.top = (win.top-sessionStatus.viewTop) + 'px';
        canvas.style.clip = 'rect(0px,' + win.width + 'px,' + win.height + 'px,0px)';

        canvas.style.visibility = "visible";
        canvas.style.zIndex = win.zidx;
    }
    
    if (win.imgs != null) {
        var context = canvas.getContext('2d');
        if (!context || !context.drawImage) {
            alert("no hay canvas");
            return;
        };

        $.each(win.imgs, function (i, imgpart) {
            var img = new Image();
            img.id = "imgcanvas";
            img.style.display = "none";
            img.onload = function () {
                context.drawImage(img, imgpart.x , imgpart.y, img.width, img.height);
            }
            img.src = imgpart.img;
        })
    }
};  

The updated source code can always be found here.   

VNC got thin! New pure-web remote desktop solution

Cybele Software, Inc. introduces ThinVNC, a new remote desktop solution that boosts and enhances remote technical support and administration tasks, allowing users to remotely access a desktop using just a web browser.

ThinVNC was built from the ground up taking full advantage of AJAX, JSON and HTML5 technologies. By implementing a number of techniques not available in traditional AT&T RFB protocol, it achieves a remarkable performance, rivaling any traditional VNC.

ThinVNC exploits HTML5 canvas to display a remote PC desktop, not requiring any additional plugin, add-on or installation of any kind on the client side. Regardless of the computer or mobile operating system, ThinVNC provides native, secure data transmission using HTTP and SSL.

Users can use the ThinVNC Presentation Manager to invite people to attend online demonstrations or trainings. Running on the web browser, ThinVNC removes the need of a “viewer” download making the attendance of non-tech people smooth and free of any setup issue.

On corporate environments, ThinVNC can be set up as a gateway to proxy other ThinVNC instances. By publishing only one IP, users can remotely get access to desktops on the LAN just by entering the internal IP/PC name in the welcome screen.

ThinVNC Server works on Windows 2000/XP/2003/Vista/Win 7/Windows Server 8. On the client side, ThinVNC is compatible with any Operating System and an HTML5 compliant browser such as Mozilla Firefox, Chrome, Internet Explorer, Opera, Safari, etc.


Recent news (2022):


- ThinVNC has evolved into Thinfinity VNC.

- Full ThinVNC SDK 2.0 can be downloaded, being available on a royalty fee basis. Contact us for pricing and licensing information.
-The old ThinVNC Open Source (version 0.9) must be taken as a technology preview, you can download the latest zip file from Source Forge



Remote Access: TCP Port Vulnerabilities Now Superseded.

The practice of remote access can result in exposure to multiple security threats if approached superficially. Inaccurate information about the many factors involved in the process of two computers communicating can be misleading. And ignoring the exact functioning of your software can result in unwanted security issues.

Remote access software that performs a direct connection between the supporter and the client forces either of them to acts as a host and to consequently be subject to unnecessary exposure.

Let’s analyze the facts: every time an application performs a communication between two computers, it will necessarily involve two TCP Ports. One of the ends opens an incoming TCP port to act as a host to which the other PC will connect. While an outgoing connection poses no significant threat, an open incoming TCP port translates into an instant weakness. An open port in your computer is like an unlocked window or door in your home.

Risks derivable from an open TCP port include enabling access for malicious software to act as a service and communicate with a remote attacker. Also port scanning software is used to find open or unfiltered ports. Attackers can then exploit potential vulnerabilities in any services they find.

SupportSmith IT Support works by connecting both ends of the communication through outgoing connections to a server machine, which handles the communication between both. This way neither users nor technicians need compromising their security. And because it’s deployed in the company’s own secure infrastructure, it doesn’t need to rely on third party security policies.

The structure of SupportSmith IT Support not only renders the preoccupation about the hazards of TCP connections anachronistic, but also employs SSH/2 and 128-bit encryption. In this way it attends to the communications scenario ensuring maximum commitment with each phase of the process.

Need Secure Remote Desktop Access software? Contact us. We have a solution for you.



















How to protect end-user privacy on a remote support session

Most of the available remote support tools address the concept of security from the standpoint of communications and end-users’ computer access. But in a corporate scenario, one more issue must be attended: end-user’s privacy. What if the technician accesses the user’s desktop while they are working on sensitive, confidential data that shouldn’t be available for regular employees?

A typical approach for ensuring end user’s privacy consists on a single prompt for denial/authorization of the access request. However, this one-time verification does not suffice for all the possible remote activities, individuals and scenarios.

With SupportSmith IT Support, we have made sure that the spectrum of situations involving different privacy levels will be handled properly. When dealing with particular situations, IT Managers can now apply specific permission rules for each User / Group.

For instance, the personnel who handle very delicate information need a high privacy level. Does this mean that these users should not be remotely assisted? Not at all. They can be remotely assisted in a secure way through SupportSmith IT Support. Consider these possible settings:
  • Shared Desktop Access Request with prompt. Access denial upon timeout expiration. This setting ensures that the technician won’t get access to the remote user’s desktop unless granted by their response. Whether the remote user denies the request or doesn’t respond (probably because they are away), technician access is denied.
Depending on whether the support session can run unattended or not, two more possibilities are available:
  • Exclusive Desktop Access Request with prompt. Access allowance upon timeout expiration 
    Because technicians are aware of the user logon state (through the SupportSmith Support Manager), they can initiate the remote support session and ask for exclusive desktop access when the user is logged off. Also, in the event of the user still logged on, they will be prompted to grant or deny the exclusive desktop control request. In any case, as the remote control takes place in another Windows session, there’s no possibility of seeing the remote user’s desktop content.
  • Exclusive Desktop Access request always denied. If the remote user wishes to always supervise the support session, the exclusive control option can be disabled. This way, only shared desktop access can be requested.
Additionally, end-users can manually restrict access to their own PC by establishing a user-defined password for remote access or requiring Windows’ log on credentials.

This small example illustrates how different privacy rules can be quickly set to different user groups with as much detail as any company concerned with security and effectiveness will need.


Need Secure Remote Desktop Access software? Contact us. We have a solution for you.
















ThinVNC - Digging into the code, Part I

Introduction

I found interesting the idea of a pure HTML5 Remote Desktop client for cross-browser cross-platform access to a PC. Despite that there are some AJAX VNC/RFB implementations, I thought in a simpler way to build a remote desktop solution using web standards and simple image processing.

This solution is built using AJAX, HTML5, JSON and simple JPEG/PNG images. The required server-side code is written in Delphi 2010.

The code - Part I

In this first part we'll see the code to do the screen capture. The standard aproach is to capture the whole desktop. However, in this case, we'll capture every window individually, applying clipping regions and saving the individual bitmap for later comparison and difference extracting.

Firstly we need to enumerate all visible top windows:

TWin = class(TObject)
private
  Wnd : Hwnd;
  Rect : TRect;
  Pid : Cardinal;
public
  constructor Create(AWnd:HWND;ARect:TRect;APid:Cardinal);
end;

function EnumWindowsProc(Wnd: HWnd; const obj:TList<TWin>): Bool; export; stdcall;
var ProcessId : Cardinal;
  R,R1 : TRect;
  Win : TWin;
begin
  Result:=True;
  GetWindowThreadProcessId(Wnd,ProcessId);
  if IsWindowVisible(Wnd) and not IsIconic(wnd)then begin
    GetWindowRect(Wnd,R);
    IntersectRect(R1,R,Screen.DesktopRect);
    if not IsRectEmpty(R1) then begin
      win := TWin.Create(Wnd,R,ProcessId);
      obj.Add(win);
    end;
  end;
end;

procedure GetProcessWindowList(WinList:TList<TWin>);
begin
  WinList.Clear;
  EnumWindows(@EnumWindowsProc, Longint(WinList));
end;

We want to keep a list of windows, with their basic attributes and their
bitmaps, so we can compare with the new ones and send the differences to the
client. Here we merge the window list into a list of TWindowMirror:

TWindowMirror = class
private
  FIndex : Integer;
  FRgn : HRGN;
  FHandle : THandle;
  FBoundsRect : TRect;
  FProcessId : Integer;
  FImage : TBitmap;
  FDiffStreamList : TList<TImagePart>;
  ...
  ...
end;

procedure TMirrorManager.RefreshMirrorList(out OneMoved:Boolean);
  procedure GetProcessWindowList(WinList:TList<TWin>);
  begin
    WinList.Clear;
    EnumWindows(@EnumWindowsProc, Longint(WinList));
  end;

var
  wl : TList<TWin>;
  n : Integer;
  wm : TWindowMirror;
begin
  OneMoved:=False;

  wl := TList<TWin>.Create;
  try
    // Enumerates top windows
    GetProcessWindowList(wl);
    try
      for n := wl.Count - 1 downto 0 do begin
        // Looks for a cached window
        wm:=GetWindowMirror(FMirrorList,wl[n].Wnd);
       if assigned(wm) then begin
        if IsIconic(wl[n].Wnd) then
           wm.SetBoundsRect(Rect(0,0,0,0))
       else wm.SetBoundsRect(wl[n].Rect);

          // Returns true when at least one window moved
       OneMoved:=OneMoved or (DateTimeToTimeStamp(Now-wm.FMoved).time<MOVE_TIME);
        end else begin
         // Do not create a TWindowMirror for invisible windows
         if IsIconic(wl[n].Wnd) then Continue;

       wm:=TWindowMirror.Create(Self,wl[n].Wnd,wl[n].Rect, wl[n].pid);
       FMirrorList.Add(wm);
        end;
        // Saves the zIndex
        wm.FIndex:=wl.Count-n;
        // Generates clipping regions
        wm.GenRegions(wl,n);
      end;
    finally
      ClearList(wl);
    end;
    // Sorts the mirror list by zIndex
    FMirrorList.Sort;
  finally
    wl.free;
  end;
end;

Finally we do the capture:

function TWindowMirror.Capture(ANewImage:TBitmap): Boolean;
  function BitBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC;
                   XSrc, YSrc: Integer; Rop: DWORD): BOOL;
  begin
    // Capture only visible regions
    SelectClipRgn(DestDC,FRgn);
    result:=Windows.BitBlt(DestDC, X, Y, Width, Height, SrcDC,
                           XSrc, YSrc, Rop);
    SelectClipRgn(DestDC,0);
  end;

var
  DC : HDC;
  RasterOp,ExStyle: DWORD;
begin
  RasterOp := SRCCOPY;
  ExStyle:=GetWindowLong(FHandle, GWL_EXSTYLE);
  if (ExStyle and WS_EX_LAYERED) = WS_EX_LAYERED then
  RasterOp := SRCCOPY or CAPTUREBLT;

  DC := GetDCEx(FHandle,0,DCX_WINDOW or DCX_NORESETATTRS or DCX_CACHE);
  try
    Result:=BitBlt(ANewImage.Canvas.Handle,0,0,
    Width(FBoundsRect),Height(FBoundsRect),DC,0,0, RasterOp)
  finally
    ReleaseDC(FHandle,DC);
  end;
end;

Now that we have captured all visible regions we need to get the bitmap
differences against the previous capture. We do this by looping through the
windows, then their visible regions and finally calculating the regions where we
find bitmap differences:

function TWindowMirror.CaptureDifferences(reset:boolean=false): Boolean;
  ....
begin
 ...
 result:=Capture(TmpImage);
 if result then begin
   ...
   ra:=ExtractClippingRegions(Rect(0,0,TmpImage.Width,TmpImage.Height));
   for n := 0 to Length(ra) - 1 do begin
     ra2:=GetDiffRects(FImage,TmpImage,ra[n]);
     for m := 0 to Length(ra2) - 1 do begin
       Jpg := TJpegImage.Create;
       ...
       CopyBmpToJpg(Jpg,TmpImage,ra2[m]);
       FDiffStreamList.Add(TImagePart.Create(rbmp,'jpeg'));
       Jpg.SaveToStream(FDiffStreamList[FDiffStreamList.Count-1].FStream);
       ... 
       Bitblt(FImage.Canvas.Handle,
       ra2[m].Left,ra2[m].Top,Width(ra2[m]),Height(ra2[m]),
       TmpImage.Canvas.handle, rbmp.Left,ra2[m].Top,SRCCOPY);
     end;
   end;
   ...
end;

On the next post we'll focus on the protocol with the client and the client code.

HTML5 remote desktop open source

You can download the full source code from Source Forge.


UPDATE: There's a commercial version with PRO features available here.