VirtualBox

Changeset 57747 in vbox


Ignore:
Timestamp:
Sep 14, 2015 6:31:11 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: Main.cpp cleanup/rework bit-by-bit (step 1).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/main.cpp

    r57501 r57747  
    165165#endif /* DEBUG && X11 && LINUX*/
    166166
    167 #if defined(RT_OS_DARWIN)
     167#ifdef Q_WS_MAC
    168168# include <dlfcn.h>
    169169# include <sys/mman.h>
     
    171171# include <iprt/system.h>
    172172
    173 /** Really ugly hack to shut up a silly check in AppKit. */
    174 static void ShutUpAppKit(void)
     173/** Mac OS X: Really ugly hack to prevent silly check in AppKit. */
     174static void PreventCheckInAppKit()
    175175{
    176     /* Check for Snow Leopard or higher */
     176    /* Check for Snow Leopard or higher: */
    177177    char szInfo[64];
    178     int rc = RTSystemQueryOSInfo (RTSYSOSINFO_RELEASE, szInfo, sizeof(szInfo));
    179     if (   RT_SUCCESS (rc)
    180         && szInfo[0] == '1') /* higher than 1x.x.x */
     178    int rc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, szInfo, sizeof(szInfo));
     179    if (RT_SUCCESS(rc) && szInfo[0] == '1') /* higher than 1x.x.x */
    181180    {
    182         /*
    183          * Find issetguid() and make it always return 0 by modifying the code.
    184          */
    185         void *addr = dlsym(RTLD_DEFAULT, "issetugid");
    186         int rc = mprotect((void *)((uintptr_t)addr & ~(uintptr_t)0xfff), 0x2000, PROT_WRITE|PROT_READ|PROT_EXEC);
     181        /* Find issetguid() and make it always return 0 by modifying the code: */
     182        void *pAddr = dlsym(RTLD_DEFAULT, "issetugid");
     183        int rc = mprotect((void *)((uintptr_t)pAddr & ~(uintptr_t)0xfff), 0x2000, PROT_WRITE|PROT_READ|PROT_EXEC);
    187184        if (!rc)
    188             ASMAtomicWriteU32((volatile uint32_t *)addr, 0xccc3c031); /* xor eax, eax; ret; int3 */
     185            ASMAtomicWriteU32((volatile uint32_t *)pAddr, 0xccc3c031); /* xor eax, eax; ret; int3 */
    189186    }
    190187}
    191 #endif /* DARWIN */
     188#endif /* Q_WS_MAC */
    192189
    193190static void QtMessageOutput (QtMsgType type, const char *msg)
     
    312309    do
    313310    {
    314 #ifdef RT_OS_DARWIN
    315         ShutUpAppKit();
    316 #endif /* RT_OS_DARWIN */
     311#ifdef Q_WS_MAC
     312        PreventCheckInAppKit();
     313#endif /* Q_WS_MAC */
    317314
    318315        /* Console help preprocessing: */
     
    640637extern "C" DECLEXPORT(void) TrustedError(const char *pszWhere, SUPINITOP enmWhat, int rc, const char *pszMsgFmt, va_list va)
    641638{
    642 # ifdef RT_OS_DARWIN
    643     ShutUpAppKit();
    644 # endif /* RT_OS_DARWIN */
     639# ifdef Q_WS_MAC
     640    PreventCheckInAppKit();
     641# endif /* Q_WS_MAC */
     642
    645643    char szMsgBuf[_16K];
    646644
Note: See TracChangeset for help on using the changeset viewer.

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