_onexit_t __cdecl _onexit (
        _onexit_t func
        )
{
        return( (__onexitbegin == (PFV *) -1)
            /* EXE */ ? (__onexit)(func)
            /* DLL */ : __dllonexit(func, &__onexitbegin, &__onexitend) );
}
// Address range: 0x401970 - 0x40199f
int32_t function_401970(int32_t (**a1)(), int32_t a2) {
    // 0x401970
    if (g10 == (void (****)())-1) {
        // 0x401979
        return (int32_t)_onexit(a1);
    }
    int32_t (**v1)() = __dllonexit(a1, (void (****)())&g10, (void (****)())&g9); // 0x401997
    return (int32_t)v1;
}
_onexit_t __cdecl _onexit (
        _onexit_t func
        )
{
#ifdef _M_IX86

        return( (__onexitbegin == (_PVFV *) -1)
             /* EXE */ ? (*_imp___onexit)(func)
             /* DLL */ : __dllonexit(func, &__onexitbegin, &__onexitend));

#else  /* _M_IX86 */

        return( (__onexitbegin == (_PVFV *) -1)
            /* EXE */ ? (*__imp__onexit)(func)
            /* DLL */ : __dllonexit(func, &__onexitbegin, &__onexitend) );

#endif  /* _M_IX86 */
}
Exemple #4
0
_onexit_t __cdecl _onexit (
        _onexit_t func
        )
{
        _PVFV * onexitbegin;
        _PVFV * onexitend;
        _onexit_t retval;

        onexitbegin = (_PVFV *)_decode_pointer(__onexitbegin);

        if (onexitbegin == (_PVFV *)-1)
        {
            /* EXE */
#ifdef _M_IX86
            return (*_imp___onexit)(func);
#else  /* _M_IX86 */
            return (*__imp__onexit)(func);
#endif  /* _M_IX86 */
        }

        /*
         * Note that we decode/encode the onexit array pointers on the
         * client side, not the CRT DLL side, to ease backwards compatibility.
         * That means we have to take a lock on this side, making the lock
         * found in __dllonexit redundant.
         */

        _lock(_EXIT_LOCK1);

        __try
        {
            onexitbegin = (_PVFV *)_decode_pointer(__onexitbegin);
            onexitend   = (_PVFV *)_decode_pointer(__onexitend);

            retval = __dllonexit(func, &onexitbegin, &onexitend);

            __onexitbegin = (_PVFV *)_encode_pointer(onexitbegin);
            __onexitend   = (_PVFV *)_encode_pointer(onexitend);
        }
        __finally
        {
            _unlock(_EXIT_LOCK1);
        }

        return retval;
}
Exemple #5
0
_onexit_t __cdecl mingw_onexit(_onexit_t func)
{
  _PVFV *onexitbegin;
  _PVFV *onexitend;
  _onexit_t retval;

  onexitbegin = (_PVFV *) _decode_pointer (__onexitbegin);

  if (onexitbegin == (_PVFV *) -1)
    return (* __MINGW_IMP_SYMBOL(_onexit)) (func);
  _lock (_EXIT_LOCK1);
  onexitbegin = (_PVFV *) _decode_pointer (__onexitbegin);
  onexitend = (_PVFV *) _decode_pointer (__onexitend);
  
  retval = __dllonexit (func, &onexitbegin, &onexitend);

  __onexitbegin = (_PVFV *) _encode_pointer (onexitbegin);
  __onexitend = (_PVFV *) _encode_pointer (onexitend);
  _unlock (_EXIT_LOCK1);
  return retval;
}