// Return a properly encoded version of a translation for 'txt'. // Memory for the string needs to be allocated and is cached in gTranslationCache // array. That way the client doesn't have to worry about the lifetime of the string. // All allocated strings can be freed with Trans::FreeData(), which should be // done at program exit so that we're guaranteed no-one is using the data const TCHAR *GetTranslation(const char *txt) { if (!gTranslationCache) { assert(dimof(gTranslations) == STRINGS_COUNT * LANGS_COUNT); gTranslationCache = SAZA(const TCHAR *, dimof(gTranslations)); if (!gTranslationCache) return _T("Missing translation!?"); _onexit(FreeData); }
// 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; }
// Called before main int intGlobalInit(){ fprintf(stdout,"[i] I'm a global\n"); // // These two result in populating the same LIFO queue // these are called by http://msdn.microsoft.com/en-GB/library/zb3b443a(v=vs.80).aspx // for source see CRT\SRC\ATONEXIT.C // atexit(atExit); _onexit(onExit); return 0; }
int main() { signal(SIGABRT, SignalHandler); signal(SIGTERM, SignalHandler); _onexit( exitfunc ); int i = 0; // while(1) // { // i ++ ; // } _getch(); }
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPTSTR lpCmdLine, _In_ int nCmdShow) { #ifdef _DEBUG //_CrtSetBreakAlloc(1081); _onexit(_CrtDumpMemoryLeaks); #endif if (!InitInstance (hInstance)) return FALSE; int ret = Main(); ExitInstance(); return ret; }
static void CreateEbookStyles() { const int pageBorderX = 16; const int pageBorderY = 32; // only create styles once if (styleMainWnd) return; styleMainWnd = new Style(); // TODO: support changing this color to gRenderCache.colorRange[1] // or GetSysColor(COLOR_WINDOW) if gGlobalPrefs.useSysColors styleMainWnd->Set(Prop::AllocColorSolid(PropBgColor, COLOR_SEPIA)); stylePage = new Style(); stylePage->Set(Prop::AllocPadding(pageBorderY, pageBorderX, pageBorderY, pageBorderX)); stylePage->Set(Prop::AllocColorSolid(PropBgColor, "transparent")); styleBtnNextPrevDefault = new Style(gStyleButtonDefault); styleBtnNextPrevDefault->SetBorderWidth(0.f); //styleBtnNextPrevDefault->Set(Prop::AllocPadding(1, 1, 1, 4)); styleBtnNextPrevDefault->Set(Prop::AllocPadding(0, 8, 0, 8)); styleBtnNextPrevDefault->Set(Prop::AllocWidth(PropStrokeWidth, 0.f)); styleBtnNextPrevDefault->Set(Prop::AllocColorSolid(PropFill, "gray")); styleBtnNextPrevDefault->Set(Prop::AllocColorSolid(PropBgColor, "transparent")); styleBtnNextPrevDefault->Set(Prop::AllocAlign(PropVertAlign, ElAlignCenter)); styleBtnNextPrevMouseOver = new Style(styleBtnNextPrevDefault); styleBtnNextPrevMouseOver->Set(Prop::AllocColorSolid(PropFill, "black")); styleStatus = new Style(gStyleButtonDefault); styleStatus->Set(Prop::AllocColorSolid(PropBgColor, COLOR_LIGHT_GRAY)); styleStatus->Set(Prop::AllocColorSolid(PropColor, "black")); styleStatus->Set(Prop::AllocFontSize(8)); styleStatus->Set(Prop::AllocFontWeight(FontStyleRegular)); styleStatus->Set(Prop::AllocPadding(3, 0, 3, 0)); styleStatus->SetBorderWidth(0); styleStatus->Set(Prop::AllocTextAlign(Align_Center)); styleProgress = new Style(); styleProgress->Set(Prop::AllocColorSolid(PropBgColor, COLOR_LIGHT_GRAY)); styleProgress->Set(Prop::AllocColorSolid(PropColor, COLOR_LIGHT_BLUE)); _onexit(DeleteEbookStyles); }
/* * Query 3Dfx hardware presence/kind */ static GLboolean GLAPIENTRY fxQueryHardware (void) { if (TDFX_DEBUG & VERBOSE_DRIVER) { fprintf(stderr, "fxQueryHardware()\n"); } if (!glbGlideInitialized) { grGlideInit(); glb3DfxPresent = FX_grSstQueryHardware(&glbHWConfig); glbGlideInitialized = 1; #if defined(__WIN32__) _onexit((_onexit_t) cleangraphics); #elif defined(__linux__) /* Only register handler if environment variable is not defined. */ if (!getenv("MESA_FX_NO_SIGNALS")) { atexit(cleangraphics); } #endif } return glb3DfxPresent; }
int __cdecl atexit ( _PVFV func ) { return (_onexit((_onexit_t)func) == NULL) ? -1 : 0; }