VirtualBox

Changeset 78151 in vbox for trunk/src/VBox/Additions/WINNT


Ignore:
Timestamp:
Apr 17, 2019 12:03:42 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
130066
Message:

Shared Clipboard: Got rid of a lot of duplicated code between Windows hosts / guests, plus a lot of renaming / cleanup, some more documentation.

Location:
trunk/src/VBox/Additions/WINNT/VBoxTray
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxTray/Makefile.kmk

    r76553 r78151  
    3737        VBoxDispIf.cpp \
    3838        VBoxSeamless.cpp \
    39         VBoxClipboard.cpp \
    4039        VBoxDisplay.cpp \
    4140        VBoxVRDP.cpp \
     
    4645VBoxTray_VBOX_IMPORT_CHECKER.win.x86 = nt4 #nt350
    4746VBoxTray_VBOX_IMPORT_CHECKER.win.amd64 = xp64
     47ifdef VBOX_WITH_SHARED_CLIPBOARD
     48 VBoxTray_DEFS     += \
     49        VBOX_WITH_SHARED_CLIPBOARD
     50 VBoxTray_SOURCES  += \
     51        VBoxClipboard.cpp \
     52        $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-win.cpp
     53endif
    4854ifdef VBOX_WITH_DRAG_AND_DROP
    4955 VBoxTray_DEFS     += \
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp

    r78142 r78151  
    2727#include <iprt/ldr.h>
    2828
    29 #include <VBox/HostServices/VBoxClipboardSvc.h>
     29#include <VBox/GuestHost/SharedClipboard.h>
     30#include <VBox/GuestHost/SharedClipboard-win.h>
    3031#include <strsafe.h>
    3132
     
    3637*   Structures and Typedefs                                                                                                      *
    3738*********************************************************************************************************************************/
    38 /* Dynamically load clipboard functions from User32.dll. */
    39 typedef BOOL WINAPI FNADDCLIPBOARDFORMATLISTENER(HWND);
    40 typedef FNADDCLIPBOARDFORMATLISTENER *PFNADDCLIPBOARDFORMATLISTENER;
    41 
    42 typedef BOOL WINAPI FNREMOVECLIPBOARDFORMATLISTENER(HWND);
    43 typedef FNREMOVECLIPBOARDFORMATLISTENER *PFNREMOVECLIPBOARDFORMATLISTENER;
    44 
    45 #ifndef WM_CLIPBOARDUPDATE
    46 #define WM_CLIPBOARDUPDATE 0x031D
    47 #endif
    48 
    49 /** Sets announced clipboard formats from the host. */
    50 #define VBOX_WM_SHCLPB_SET_FORMATS      WM_USER
    51 /** Reads data from the clipboard and sends it to the host. */
    52 #define VBOX_WM_SHCLPB_READ_DATA        WM_USER + 1
    53 
    54 typedef struct _VBOXCLIPBOARDCONTEXT
    55 {
    56     const VBOXSERVICEENV *pEnv;
    57     uint32_t              u32ClientID;
    58     ATOM                  wndClass;
    59     HWND                  hwnd;
    60     HWND                  hwndNextInChain;
    61     UINT                  timerRefresh;
    62     bool                  fCBChainPingInProcess;
    63     PFNADDCLIPBOARDFORMATLISTENER pfnAddClipboardFormatListener;
    64     PFNREMOVECLIPBOARDFORMATLISTENER pfnRemoveClipboardFormatListener;
    65 } VBOXCLIPBOARDCONTEXT, *PVBOXCLIPBOARDCONTEXT;
    66 
    67 enum { CBCHAIN_TIMEOUT = 5000 /* ms */ };
    68 
     39
     40struct _VBOXCLIPBOARDCONTEXT
     41{
     42    /** Pointer to the VBoxClient service environment. */
     43    const VBOXSERVICEENV    *pEnv;
     44    /** Client ID the service is connected to the HGCM service with. */
     45    uint32_t                 u32ClientID;
     46    /** Windows-specific context data. */
     47    VBOXCLIPBOARDWINCTX      Win;
     48};
    6949
    7050/*********************************************************************************************************************************
    71 *   Header Files                                                                                                                 *
     51*   Static variables                                                                                                             *
    7252*********************************************************************************************************************************/
    73 /** Static since it is the single instance. Directly used in the windows proc. */
     53/** Static clipboard context (since it is the single instance). Directly used in the windows proc. */
    7454static VBOXCLIPBOARDCONTEXT g_Ctx = { NULL };
    75 
    76 static char s_szClipWndClassName[] = "VBoxSharedClipboardClass";
    77 
    78 
    79 static void vboxClipboardInitNewAPI(VBOXCLIPBOARDCONTEXT *pCtx)
    80 {
    81     RTLDRMOD hUser32 = NIL_RTLDRMOD;
    82     int rc = RTLdrLoadSystem("User32.dll", /* fNoUnload = */ true, &hUser32);
    83     if (RT_SUCCESS(rc))
    84     {
    85         rc = RTLdrGetSymbol(hUser32, "AddClipboardFormatListener", (void**)&pCtx->pfnAddClipboardFormatListener);
    86         if (RT_SUCCESS(rc))
    87         {
    88             rc = RTLdrGetSymbol(hUser32, "RemoveClipboardFormatListener", (void**)&pCtx->pfnRemoveClipboardFormatListener);
    89         }
    90 
    91         RTLdrClose(hUser32);
    92     }
    93 
    94     if (RT_SUCCESS(rc))
    95     {
    96         Log(("New Clipboard API is enabled\n"));
    97     }
    98     else
    99     {
    100         pCtx->pfnAddClipboardFormatListener = NULL;
    101         pCtx->pfnRemoveClipboardFormatListener = NULL;
    102         Log(("New Clipboard API is not available. rc = %Rrc\n", rc));
    103     }
    104 }
    105 
    106 static bool vboxClipboardIsNewAPI(VBOXCLIPBOARDCONTEXT *pCtx)
    107 {
    108     return pCtx->pfnAddClipboardFormatListener != NULL;
    109 }
    110 
    111 
    112 static int vboxOpenClipboard(HWND hWnd)
    113 {
    114     /* "OpenClipboard fails if another window has the clipboard open."
    115      * So try a few times and wait up to 1 second.
    116      */
    117     BOOL fOpened = FALSE;
    118 
    119     LogFlowFunc(("hWnd=%p\n", hWnd));
    120 
    121     int i = 0;
    122     for (;;)
    123     {
    124         if (OpenClipboard(hWnd))
    125         {
    126             fOpened = TRUE;
    127             break;
    128         }
    129 
    130         if (i >= 10) /* sleep interval = [1..512] ms */
    131             break;
    132 
    133         RTThreadSleep(1 << i);
    134         ++i;
    135     }
    136 
    137 #ifdef LOG_ENABLED
    138     if (i > 0)
    139         LogFlowFunc(("%d times tried to open clipboard\n", i + 1));
    140 #endif
    141 
    142     int rc;
    143     if (fOpened)
    144         rc = VINF_SUCCESS;
    145     else
    146     {
    147         const DWORD dwLastErr = GetLastError();
    148         rc = RTErrConvertFromWin32(dwLastErr);
    149         LogRel(("Clipboard: Failed to open clipboard! Error=%ld (%Rrc)\n", dwLastErr, rc));
    150     }
    151 
    152     return rc;
    153 }
    154 
    155 
    156 static int vboxClipboardChanged(PVBOXCLIPBOARDCONTEXT pCtx)
     55/** Static window class name. */
     56static char s_szClipWndClassName[] = VBOX_CLIPBOARD_WNDCLASS_NAME;
     57
     58
     59static LRESULT vboxClipboardProcessMsg(PVBOXCLIPBOARDCONTEXT pCtx, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
    15760{
    15861    AssertPtr(pCtx);
    15962
    160     /* Query list of available formats and report to host. */
    161     int rc = vboxOpenClipboard(pCtx->hwnd);
    162     if (RT_SUCCESS(rc))
    163     {
    164         uint32_t u32Formats = 0;
    165         UINT format = 0;
    166 
    167         while ((format = EnumClipboardFormats(format)) != 0)
    168         {
    169             LogFlowFunc(("vboxClipboardChanged: format = 0x%08X\n", format));
    170             switch (format)
    171             {
    172                 case CF_UNICODETEXT:
    173                 case CF_TEXT:
    174                     u32Formats |= VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT;
    175                     break;
    176 
    177                 case CF_DIB:
    178                 case CF_BITMAP:
    179                     u32Formats |= VBOX_SHARED_CLIPBOARD_FMT_BITMAP;
    180                     break;
    181 
    182                 default:
    183                 {
    184                     if (format >= 0xC000)
    185                     {
    186                         TCHAR szFormatName[256];
    187 
    188                         int cActual = GetClipboardFormatName(format, szFormatName, sizeof(szFormatName)/sizeof (TCHAR));
    189                         if (cActual)
    190                         {
    191                             if (strcmp (szFormatName, "HTML Format") == 0)
    192                             {
    193                                 u32Formats |= VBOX_SHARED_CLIPBOARD_FMT_HTML;
    194                             }
    195                         }
    196                     }
    197                     break;
    198                 }
    199             }
    200         }
    201 
    202         CloseClipboard();
    203         rc = VbglR3ClipboardReportFormats(pCtx->u32ClientID, u32Formats);
    204     }
    205     return rc;
    206 }
    207 
    208 /* Add ourselves into the chain of cliboard listeners */
    209 static void vboxClipboardAddToCBChain(PVBOXCLIPBOARDCONTEXT pCtx)
    210 {
    211     AssertPtrReturnVoid(pCtx);
    212     if (vboxClipboardIsNewAPI(pCtx))
    213         pCtx->pfnAddClipboardFormatListener(pCtx->hwnd);
    214     else
    215         pCtx->hwndNextInChain = SetClipboardViewer(pCtx->hwnd);
    216     /** @todo r=andy Return code?? */
    217 }
    218 
    219 /* Remove ourselves from the chain of cliboard listeners */
    220 static void vboxClipboardRemoveFromCBChain(PVBOXCLIPBOARDCONTEXT pCtx)
    221 {
    222     AssertPtrReturnVoid(pCtx);
    223 
    224     if (vboxClipboardIsNewAPI(pCtx))
    225     {
    226         pCtx->pfnRemoveClipboardFormatListener(pCtx->hwnd);
    227     }
    228     else
    229     {
    230         ChangeClipboardChain(pCtx->hwnd, pCtx->hwndNextInChain);
    231         pCtx->hwndNextInChain = NULL;
    232     }
    233     /** @todo r=andy Return code?? */
    234 }
    235 
    236 /* Callback which is invoked when we have successfully pinged ourselves down the
    237  * clipboard chain.  We simply unset a boolean flag to say that we are responding.
    238  * There is a race if a ping returns after the next one is initiated, but nothing
    239  * very bad is likely to happen. */
    240 VOID CALLBACK vboxClipboardChainPingProc(HWND hWnd, UINT uMsg, ULONG_PTR dwData, LRESULT lResult)
    241 {
    242     NOREF(hWnd);
    243     NOREF(uMsg);
    244     NOREF(lResult);
    245 
    246     /** @todo r=andy Why not using SetWindowLongPtr for keeping the context? */
    247     PVBOXCLIPBOARDCONTEXT pCtx = (PVBOXCLIPBOARDCONTEXT)dwData;
    248     AssertPtr(pCtx);
    249 
    250     pCtx->fCBChainPingInProcess = FALSE;
    251 }
    252 
    253 static LRESULT vboxClipboardProcessMsg(PVBOXCLIPBOARDCONTEXT pCtx, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
    254 {
    255     AssertPtr(pCtx);
     63    const PVBOXCLIPBOARDWINCTX pWinCtx = &pCtx->Win;
    25664
    25765    LRESULT rc = 0;
     
    26674            {
    26775                /* Clipboard was updated by another application. */
    268                 vboxClipboardChanged(pCtx);
     76                uint32_t uFormats;
     77                int vboxrc = VBoxClipboardWinGetFormats(&pCtx->Win, &uFormats);
     78                if (RT_SUCCESS(vboxrc))
     79                    vboxrc = VbglR3ClipboardReportFormats(pCtx->u32ClientID, uFormats);
    26980            }
    27081        } break;
     
    27283        case WM_CHANGECBCHAIN:
    27384        {
    274             if (vboxClipboardIsNewAPI(pCtx))
     85            if (VBoxClipboardWinIsNewAPI(&pWinCtx->newAPI))
    27586            {
    27687                rc = DefWindowProc(hwnd, msg, wParam, lParam);
     
    27889            }
    27990
    280             HWND hwndRemoved = (HWND)wParam;
    281             HWND hwndNext    = (HWND)lParam;
    282 
    283             LogFlowFunc(("WM_CHANGECBCHAIN: hwndRemoved %p, hwndNext %p, hwnd %p\n", hwndRemoved, hwndNext, pCtx->hwnd));
    284 
    285             if (hwndRemoved == pCtx->hwndNextInChain)
     91            HWND hWndRemoved = (HWND)wParam;
     92            HWND hWndNext    = (HWND)lParam;
     93
     94            LogFlowFunc(("WM_CHANGECBCHAIN: hWndRemoved=%p, hWndNext=%p, hWnd=%p\n", hWndRemoved, hWndNext, pWinCtx->hWnd));
     95
     96            if (hWndRemoved == pWinCtx->hWndNextInChain)
    28697            {
    28798                /* The window that was next to our in the chain is being removed.
    28899                 * Relink to the new next window. */
    289                 pCtx->hwndNextInChain = hwndNext;
     100                pWinCtx->hWndNextInChain = hWndNext;
    290101            }
    291102            else
    292103            {
    293                 if (pCtx->hwndNextInChain)
     104                if (pWinCtx->hWndNextInChain)
    294105                {
    295106                    /* Pass the message further. */
    296107                    DWORD_PTR dwResult;
    297                     rc = SendMessageTimeout(pCtx->hwndNextInChain, WM_CHANGECBCHAIN, wParam, lParam, 0, CBCHAIN_TIMEOUT, &dwResult);
     108                    rc = SendMessageTimeout(pWinCtx->hWndNextInChain, WM_CHANGECBCHAIN, wParam, lParam, 0,
     109                                            VBOX_CLIPBOARD_CBCHAIN_TIMEOUT_MS, &dwResult);
    298110                    if (!rc)
    299111                        rc = (LRESULT) dwResult;
     
    304116        case WM_DRAWCLIPBOARD:
    305117        {
    306             LogFlowFunc(("WM_DRAWCLIPBOARD, hwnd %p\n", pCtx->hwnd));
     118            LogFlowFunc(("WM_DRAWCLIPBOARD, hwnd %p\n", pWinCtx->hWnd));
    307119
    308120            if (GetClipboardOwner() != hwnd)
     
    310122                /* Clipboard was updated by another application. */
    311123                /* WM_DRAWCLIPBOARD always expects a return code of 0, so don't change "rc" here. */
    312                 int vboxrc = vboxClipboardChanged(pCtx);
    313                 if (RT_FAILURE(vboxrc))
    314                     LogFlowFunc(("vboxClipboardChanged failed, rc = %Rrc\n", vboxrc));
    315             }
    316 
    317             if (pCtx->hwndNextInChain)
     124                uint32_t uFormats;
     125                int vboxrc = VBoxClipboardWinGetFormats(pWinCtx, &uFormats);
     126                if (RT_SUCCESS(vboxrc))
     127                    vboxrc = VbglR3ClipboardReportFormats(pCtx->u32ClientID, uFormats);
     128            }
     129
     130            if (pWinCtx->hWndNextInChain)
    318131            {
    319132                /* Pass the message to next windows in the clipboard chain. */
    320                 SendMessageTimeout(pCtx->hwndNextInChain, msg, wParam, lParam, 0, CBCHAIN_TIMEOUT, NULL);
     133                SendMessageTimeout(pWinCtx->hWndNextInChain, msg, wParam, lParam, 0, VBOX_CLIPBOARD_CBCHAIN_TIMEOUT_MS, NULL);
    321134            }
    322135        } break;
     
    324137        case WM_TIMER:
    325138        {
    326             if (vboxClipboardIsNewAPI(pCtx))
     139            if (VBoxClipboardWinIsNewAPI(&pWinCtx->newAPI))
    327140                break;
    328141
     
    331144            /* Re-register ourselves in the clipboard chain if our last ping
    332145             * timed out or there seems to be no valid chain. */
    333             if (!hViewer || pCtx->fCBChainPingInProcess)
    334             {
    335                 vboxClipboardRemoveFromCBChain(pCtx);
    336                 vboxClipboardAddToCBChain(pCtx);
    337             }
     146            if (!hViewer || pWinCtx->oldAPI.fCBChainPingInProcess)
     147            {
     148                VBoxClipboardWinRemoveFromCBChain(pWinCtx);
     149                VBoxClipboardWinAddToCBChain(pWinCtx);
     150            }
     151
    338152            /* Start a new ping by passing a dummy WM_CHANGECBCHAIN to be
    339153             * processed by ourselves to the chain. */
    340             pCtx->fCBChainPingInProcess = TRUE;
     154            pWinCtx->oldAPI.fCBChainPingInProcess = TRUE;
     155
    341156            hViewer = GetClipboardViewer();
    342157            if (hViewer)
    343                 SendMessageCallback(hViewer, WM_CHANGECBCHAIN, (WPARAM)pCtx->hwndNextInChain, (LPARAM)pCtx->hwndNextInChain, vboxClipboardChainPingProc, (ULONG_PTR)pCtx);
     158                SendMessageCallback(hViewer, WM_CHANGECBCHAIN, (WPARAM)pWinCtx->hWndNextInChain, (LPARAM)pWinCtx->hWndNextInChain,
     159                                    VBoxClipboardWinChainPingProc, (ULONG_PTR)pWinCtx);
    344160        } break;
    345161
     
    387203                /* Unsupported clipboard format is requested. */
    388204                LogFlowFunc(("Unsupported clipboard format requested: %ld\n", u32Format));
    389                 EmptyClipboard();
     205                VBoxClipboardWinClear();
    390206            }
    391207            else
     
    518334
    519335                /* Something went wrong. */
    520                 EmptyClipboard();
     336                VBoxClipboardWinClear();
    521337            }
    522338        } break;
     
    527343             * windows is to be destroyed and therefore the guest side becomes inactive.
    528344             */
    529             int vboxrc = vboxOpenClipboard(hwnd);
     345            int vboxrc = VBoxClipboardWinOpen(hwnd);
    530346            if (RT_SUCCESS(vboxrc))
    531347            {
    532                 EmptyClipboard();
    533                 CloseClipboard();
    534             }
    535         } break;
    536 
    537         case VBOX_WM_SHCLPB_SET_FORMATS:
     348                VBoxClipboardWinClear();
     349                VBoxClipboardWinClose();
     350            }
     351        } break;
     352
     353        case VBOX_CLIPBOARD_WM_SET_FORMATS:
    538354        {
    539355            /* Announce available formats. Do not insert data, they will be inserted in WM_RENDER*. */
     
    542358            LogFlowFunc(("VBOX_WM_SHCLPB_SET_FORMATS: u32Formats=0x%x\n", u32Formats));
    543359
    544             int vboxrc = vboxOpenClipboard(hwnd);
     360            int vboxrc = VBoxClipboardWinOpen(hwnd);
    545361            if (RT_SUCCESS(vboxrc))
    546362            {
    547                 EmptyClipboard();
     363                VBoxClipboardWinClear();
    548364
    549365                HANDLE hClip = NULL;
     
    562378                }
    563379
    564                 CloseClipboard();
     380                VBoxClipboardWinClose();
    565381
    566382                LogFlowFunc(("VBOX_WM_SHCLPB_SET_FORMATS: hClip=%p, lastErr=%ld\n", hClip, GetLastError()));
     
    568384        } break;
    569385
    570         case VBOX_WM_SHCLPB_READ_DATA:
     386        case VBOX_CLIPBOARD_WM_READ_DATA:
    571387        {
    572388            /* Send data in the specified format to the host. */
     
    576392            LogFlowFunc(("VBOX_WM_SHCLPB_READ_DATA: u32Formats=0x%x\n", u32Formats));
    577393
    578             int vboxrc = vboxOpenClipboard(hwnd);
     394            int vboxrc = VBoxClipboardWinOpen(hwnd);
    579395            if (RT_SUCCESS(vboxrc))
    580396            {
     
    642458                }
    643459
    644                 CloseClipboard();
     460                VBoxClipboardWinClose();
    645461            }
    646462
     
    654470        case WM_DESTROY:
    655471        {
    656             vboxClipboardRemoveFromCBChain(pCtx);
    657             if (pCtx->timerRefresh)
    658                 KillTimer(pCtx->hwnd, 0);
     472            VBoxClipboardWinRemoveFromCBChain(pWinCtx);
     473            if (pWinCtx->oldAPI.timerRefresh)
     474                KillTimer(pWinCtx->hWnd, 0);
    659475            /*
    660476             * don't need to call PostQuitMessage cause
     
    699515        wc.lpszClassName = s_szClipWndClassName;
    700516
    701         pCtx->wndClass = RegisterClassEx(&wc);
    702         if (pCtx->wndClass == 0)
     517        ATOM wndClass = RegisterClassEx(&wc);
     518        if (wndClass == 0)
    703519            rc = RTErrConvertFromWin32(GetLastError());
    704520    }
     
    706522    if (RT_SUCCESS(rc))
    707523    {
     524        const PVBOXCLIPBOARDWINCTX pWinCtx = &pCtx->Win;
     525
    708526        /* Create the window. */
    709         pCtx->hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT | WS_EX_TOPMOST,
    710                                     s_szClipWndClassName, s_szClipWndClassName,
    711                                     WS_POPUPWINDOW,
    712                                     -200, -200, 100, 100, NULL, NULL, hInstance, NULL);
    713         if (pCtx->hwnd == NULL)
     527        pWinCtx->hWnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT | WS_EX_TOPMOST,
     528                                       s_szClipWndClassName, s_szClipWndClassName,
     529                                       WS_POPUPWINDOW,
     530                                       -200, -200, 100, 100, NULL, NULL, hInstance, NULL);
     531        if (pWinCtx->hWnd == NULL)
    714532        {
    715533            rc = VERR_NOT_SUPPORTED;
     
    717535        else
    718536        {
    719             SetWindowPos(pCtx->hwnd, HWND_TOPMOST, -200, -200, 0, 0,
     537            SetWindowPos(pWinCtx->hWnd, HWND_TOPMOST, -200, -200, 0, 0,
    720538                         SWP_NOACTIVATE | SWP_HIDEWINDOW | SWP_NOCOPYBITS | SWP_NOREDRAW | SWP_NOSIZE);
    721539
    722             vboxClipboardAddToCBChain(pCtx);
    723             if (!vboxClipboardIsNewAPI(pCtx))
    724                 pCtx->timerRefresh = SetTimer(pCtx->hwnd, 0, 10 * 1000, NULL);
     540            VBoxClipboardWinAddToCBChain(pWinCtx);
     541            if (!VBoxClipboardWinIsNewAPI(&pWinCtx->newAPI))
     542                pWinCtx->oldAPI.timerRefresh = SetTimer(pWinCtx->hWnd, 0, 10 * 1000 /* 10s */, NULL);
    725543        }
    726544    }
     
    734552    AssertPtrReturnVoid(pCtx);
    735553
    736     if (pCtx->hwnd)
     554    const PVBOXCLIPBOARDWINCTX pWinCtx = &pCtx->Win;
     555
     556    if (pWinCtx->hWnd)
    737557    {
    738         DestroyWindow(pCtx->hwnd);
    739         pCtx->hwnd = NULL;
     558        DestroyWindow(pWinCtx->hWnd);
     559        pWinCtx->hWnd = NULL;
    740560    }
    741561
    742     if (pCtx->wndClass != 0)
    743     {
    744         UnregisterClass(s_szClipWndClassName, pCtx->pEnv->hInstance);
    745         pCtx->wndClass = 0;
    746     }
     562    UnregisterClass(s_szClipWndClassName, pCtx->pEnv->hInstance);
    747563}
    748564
     
    777593
    778594    RT_BZERO(pCtx, sizeof(VBOXCLIPBOARDCONTEXT));
     595
    779596    pCtx->pEnv = pEnv;
    780597
    781598    /* Check that new Clipboard API is available */
    782     vboxClipboardInitNewAPI(pCtx);
     599    VBoxClipboardWinCheckAndInitNewAPI(&pCtx->Win.newAPI);
    783600
    784601    int rc = VbglR3ClipboardConnect(&pCtx->u32ClientID);
     
    811628    RTThreadUserSignal(RTThreadSelf());
    812629
    813     PVBOXCLIPBOARDCONTEXT pCtx = (PVBOXCLIPBOARDCONTEXT)pInstance;
     630    const PVBOXCLIPBOARDCONTEXT pCtx = (PVBOXCLIPBOARDCONTEXT)pInstance;
    814631    AssertPtr(pCtx);
     632
     633    const PVBOXCLIPBOARDWINCTX pWinCtx = &pCtx->Win;
    815634
    816635    int rc;
     
    846665                     * Forward the information to the window, so it can later
    847666                     * respond to WM_RENDERFORMAT message. */
    848                     ::PostMessage(pCtx->hwnd, VBOX_WM_SHCLPB_SET_FORMATS, 0, u32Formats);
     667                    ::PostMessage(pWinCtx->hWnd, VBOX_CLIPBOARD_WM_SET_FORMATS, 0, u32Formats);
    849668                } break;
    850669
     
    852671                {
    853672                    /* The host needs data in the specified format. */
    854                     ::PostMessage(pCtx->hwnd, VBOX_WM_SHCLPB_READ_DATA, 0, u32Formats);
     673                    ::PostMessage(pWinCtx->hWnd, VBOX_CLIPBOARD_WM_READ_DATA, 0, u32Formats);
    855674                } break;
    856675
     
    927746    VBoxClipboardDestroy
    928747};
     748
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette