Index: /trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h
===================================================================
--- /trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h	(revision 81442)
+++ /trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h	(revision 81443)
@@ -198,4 +198,11 @@
 int shclSvcMsgGet(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
 
+int shclSvcClientInit(PSHCLCLIENT pClient, uint32_t uClientID);
+void shclSvcClientReset(PSHCLCLIENT pClient);
+
+int shclSvcClientStateInit(PSHCLCLIENTSTATE pClientState, uint32_t uClientID);
+int shclSvcClientStateDestroy(PSHCLCLIENTSTATE pClientState);
+void shclSvcClientStateReset(PSHCLCLIENTSTATE pClientState);
+
 int shclSvcClientWakeup(PSHCLCLIENT pClient);
 
Index: /trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp
===================================================================
--- /trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp	(revision 81442)
+++ /trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp	(revision 81443)
@@ -239,12 +239,4 @@
 
 /*********************************************************************************************************************************
-*   Prototypes                                                                                                                   *
-*********************************************************************************************************************************/
-static int shclSvcClientStateInit(PSHCLCLIENTSTATE pClientState, uint32_t uClientID);
-static int shclSvcClientStateDestroy(PSHCLCLIENTSTATE pClientState);
-static void shclSvcClientStateReset(PSHCLCLIENTSTATE pClientState);
-
-
-/*********************************************************************************************************************************
 *   Global Variables                                                                                                             *
 *********************************************************************************************************************************/
@@ -508,4 +500,69 @@
 
     return VINF_SUCCESS;
+}
+
+/**
+ * Initializes a Shared Clipboard client.
+ *
+ * @param   pClient             Client to initialize.
+ * @param   uClientID           HGCM client ID to assign client to.
+ */
+int shclSvcClientInit(PSHCLCLIENT pClient, uint32_t uClientID)
+{
+    AssertPtrReturn(pClient, VERR_INVALID_POINTER);
+
+    /* Assign the client ID. */
+    pClient->State.uClientID = uClientID;
+
+    LogFlowFunc(("[Client %RU32]\n", pClient->State.uClientID));
+
+    /* Create the client's own event source. */
+    int rc = ShClEventSourceCreate(&pClient->Events, 0 /* ID, ignored */);
+    if (RT_SUCCESS(rc))
+    {
+        LogFlowFunc(("[Client %RU32] Using event source %RU32\n", uClientID, pClient->Events.uID));
+
+        /* Reset the client state. */
+        shclSvcClientStateReset(&pClient->State);
+
+        /* (Re-)initialize the client state. */
+        rc = shclSvcClientStateInit(&pClient->State, uClientID);
+
+#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
+        if (RT_SUCCESS(rc))
+            rc = ShClTransferCtxInit(&pClient->TransferCtx);
+#endif
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+/**
+ * Resets a Shared Clipboard client.
+ *
+ * @param   pClient             Client to reset.
+ */
+void shclSvcClientReset(PSHCLCLIENT pClient)
+{
+    if (!pClient)
+        return;
+
+    LogFlowFunc(("[Client %RU32]\n", pClient->State.uClientID));
+
+    /* Reset message queue. */
+    shclSvcMsgQueueReset(pClient);
+
+    /* Reset event source. */
+    ShClEventSourceReset(&pClient->Events);
+
+    /* Reset pending state. */
+    RT_ZERO(pClient->Pending);
+
+#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
+    shclSvcClientTransfersReset(pClient);
+#endif
+
+    shclSvcClientStateReset(&pClient->State);
 }
 
@@ -1273,7 +1330,5 @@
     }
 
-    shclSvcClientStateReset(&pClient->State);
     shclSvcClientStateDestroy(&pClient->State);
-
     ShClEventSourceDestroy(&pClient->Events);
 
@@ -1296,37 +1351,19 @@
     AssertPtr(pvClient);
 
-    /* Assign the client ID. */
-    pClient->State.uClientID = u32ClientID;
-
-    /* Create the client's own event source. */
-    int rc = ShClEventSourceCreate(&pClient->Events, 0 /* ID, ignored */);
+    int rc = shclSvcClientInit(pClient, u32ClientID);
     if (RT_SUCCESS(rc))
     {
-        LogFlowFunc(("[Client %RU32] Using event source %RU32\n", u32ClientID, pClient->Events.uID));
-
-        /* Reset the client state. */
-        shclSvcClientStateReset(&pClient->State);
-
-        /* (Re-)initialize the client state. */
-        rc = shclSvcClientStateInit(&pClient->State, u32ClientID);
+        rc = ShClSvcImplConnect(pClient, ShClSvcGetHeadless());
         if (RT_SUCCESS(rc))
         {
-#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
-            rc = ShClTransferCtxInit(&pClient->TransferCtx);
-#endif
-            if (RT_SUCCESS(rc))
-                rc = ShClSvcImplConnect(pClient, ShClSvcGetHeadless());
-            if (RT_SUCCESS(rc))
-            {
-                /* Assign weak pointer to client map .*/
-                g_mapClients[u32ClientID] = pClient; /** @todo Handle OOM / collisions? */
-
-                /* For now we ASSUME that the first client ever connected is in charge for
-                 * communicating withe the service extension.
-                 *
-                 ** @todo This needs to be fixed ASAP w/o breaking older guest / host combos. */
-                if (g_ExtState.uClientID == 0)
-                    g_ExtState.uClientID = u32ClientID;
-            }
+            /* Assign weak pointer to client map .*/
+            g_mapClients[u32ClientID] = pClient; /** @todo Handle OOM / collisions? */
+
+            /* For now we ASSUME that the first client ever connected is in charge for
+             * communicating withe the service extension.
+             *
+             ** @todo This needs to be fixed ASAP w/o breaking older guest / host combos. */
+            if (g_ExtState.uClientID == 0)
+                g_ExtState.uClientID = u32ClientID;
         }
     }
@@ -1684,5 +1721,5 @@
  * @param   uClientID           Client ID (HGCM) to use for this client state.
  */
-static int shclSvcClientStateInit(PSHCLCLIENTSTATE pClientState, uint32_t uClientID)
+int shclSvcClientStateInit(PSHCLCLIENTSTATE pClientState, uint32_t uClientID)
 {
     LogFlowFuncEnter();
@@ -1702,5 +1739,5 @@
  * @param   pClientState        Client state to destroy.
  */
-static int shclSvcClientStateDestroy(PSHCLCLIENTSTATE pClientState)
+int shclSvcClientStateDestroy(PSHCLCLIENTSTATE pClientState)
 {
     RT_NOREF(pClientState);
@@ -1716,5 +1753,5 @@
  * @param   pClientState    Client state to reset.
  */
-static void shclSvcClientStateReset(PSHCLCLIENTSTATE pClientState)
+void shclSvcClientStateReset(PSHCLCLIENTSTATE pClientState)
 {
     LogFlowFuncEnter();
@@ -1728,6 +1765,4 @@
 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     pClientState->Transfers.enmTransferDir = SHCLTRANSFERDIR_UNKNOWN;
-#else
-    RT_NOREF(pClientState);
 #endif
 }
