VirtualBox

Changeset 19078 in vbox for trunk/src/VBox/Main/cbinding


Ignore:
Timestamp:
Apr 21, 2009 1:28:53 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
46216
Message:

Main/cbindings: Updated VBoxGetXPCOMCFunctions to support the old interface version.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/cbinding/VBoxXPCOMC.cpp

    r18998 r19078  
    174174VBoxGetXPCOMCFunctions(unsigned uVersion)
    175175{
    176     /* The current version. */
     176    /*
     177     * The current interface version.
     178     */
    177179    static const VBOXXPCOMC s_Functions =
    178180    {
     
    197199    };
    198200
    199     if ((uVersion & 0xffff0000U) != VBOX_XPCOMC_VERSION)
    200         return NULL; /* not supported. */
    201 
    202     return &s_Functions;
     201    if ((uVersion & 0xffff0000U) == (VBOX_XPCOMC_VERSION & 0xffff0000U))
     202        return &s_Functions;
     203
     204    /*
     205     * Legacy interface version 1.0.
     206     */
     207    static const struct VBOXXPCOMCV1
     208    {
     209        /** The size of the structure. */
     210        unsigned cb;
     211        /** The structure version. */
     212        unsigned uVersion;
     213
     214        unsigned int (*pfnGetVersion)(void);
     215
     216        void  (*pfnComInitialize)(IVirtualBox **virtualBox, ISession **session);
     217        void  (*pfnComUninitialize)(void);
     218
     219        void  (*pfnComUnallocMem)(void *pv);
     220        void  (*pfnUtf16Free)(PRUnichar *pwszString);
     221        void  (*pfnUtf8Free)(char *pszString);
     222
     223        int   (*pfnUtf16ToUtf8)(const PRUnichar *pwszString, char **ppszString);
     224        int   (*pfnUtf8ToUtf16)(const char *pszString, PRUnichar **ppwszString);
     225
     226        /** Tail version, same as uVersion. */
     227        unsigned uEndVersion;
     228    } s_Functions_v1_0 =
     229    {
     230        sizeof(s_Functions_v1_0),
     231        0x00010000U,
     232
     233        VBoxVersion,
     234
     235        VBoxComInitialize,
     236        VBoxComUninitialize,
     237
     238        VBoxComUnallocMem,
     239        VBoxUtf16Free,
     240        VBoxUtf8Free,
     241
     242        VBoxUtf16ToUtf8,
     243        VBoxUtf8ToUtf16,
     244
     245        0x00010000U
     246    };
     247
     248    if ((uVersion & 0xffff0000U) == 0x00010000U)
     249        return (PCVBOXXPCOM)&s_Functions_v1_0;
     250
     251    /*
     252     * Unsupported interface version.
     253     */
     254    return NULL;
    203255}
    204256
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