VirtualBox

Changeset 17862 in vbox


Ignore:
Timestamp:
Mar 13, 2009 10:51:44 PM (16 years ago)
Author:
vboxsync
Message:

Fe/Qt: AppKit hack.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
2 edited

Legend:

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

    r11725 r17862  
    2222#include <VBox/sup.h>
    2323
     24#ifdef RT_OS_DARWIN
     25extern "C" DECLEXPORT(int) issetugid(void)
     26{
     27    return 0;
     28}
     29#endif
    2430
    2531int main(int argc, char **argv, char **envp)
  • trunk/src/VBox/Frontends/VirtualBox/src/main.cpp

    r17632 r17862  
    106106}
    107107
    108 #endif
     108#endif /* DEBUG && X11 && LINUX*/
     109
     110#if defined(RT_OS_DARWIN) && defined(RT_ARCH_AMD64)
     111# include <dlfcn.h>
     112# include <sys/mman.h>
     113# include <iprt/asm.h>
     114
     115/** Really ugly hack to shut up a silly check in AppKit. */
     116static void ShutUpAppKit(void)
     117{
     118    /*
     119     * Find issetguid() and make it always return 0 by modifying the code.
     120     */
     121    void *addr = dlsym(RTLD_DEFAULT, "issetugid");
     122    int rc = mprotect((void *)((uintptr_t)addr & ~(uintptr_t)0xfff), 0x2000, PROT_WRITE|PROT_READ|PROT_EXEC);
     123    if (!rc)
     124        ASMAtomicWriteU32((volatile uint32_t *)addr, 0xccc3c031); /* xor eax, eax; ret; int3 */
     125}
     126#endif /* DARWIN + AMD64 */
    109127
    110128static void QtMessageOutput (QtMsgType type, const char *msg)
     
    201219{
    202220    LogFlowFuncEnter();
     221# if defined(RT_OS_DARWIN) && defined(RT_ARCH_AMD64)
     222    ShutUpAppKit();
     223# endif
    203224
    204225#ifdef Q_WS_WIN
     
    464485extern "C" DECLEXPORT(void) TrustedError (const char *pszWhere, SUPINITOP enmWhat, int rc, const char *pszMsgFmt, va_list va)
    465486{
     487# if defined(RT_OS_DARWIN) && defined(RT_ARCH_AMD64)
     488    ShutUpAppKit();
     489# endif
     490
    466491    /*
    467492     * Init the Qt application object. This is a bit hackish as we
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