⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 onexit.c

📁 不错的东西 请查看 WINCE OS
💻 C
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// This source code is licensed under Microsoft Shared Source License
// Version 1.0 for Windows CE.
// For a copy of the license visit http://go.microsoft.com/fwlink/?LinkId=3223.
//
#include <corecrt.h>

extern _PVFV *__onexitbegin;
extern _PVFV *__onexitend;

#define ONEXITTBLINCR   4

_onexit_t _onexit(_onexit_t func) {
    _PVFV   *p;
    // First, make sure the table has room for a new entry
    if (!__onexitbegin || (LocalSize(__onexitbegin) < ((unsigned)__onexitend - (unsigned)__onexitbegin + sizeof(_PVFV)))) {
        // not enough room, try to grow the table
        if (!__onexitbegin)
        {
            if (!(p = (_PVFV *)LocalAlloc(0,ONEXITTBLINCR * sizeof(_PVFV))))
                return NULL;
        }
        else if (!(p = (_PVFV *)LocalReAlloc(__onexitbegin, LocalSize(__onexitbegin) + ONEXITTBLINCR * sizeof(_PVFV), 2)))
          return NULL;
        __onexitend = p + (__onexitend - __onexitbegin);
        __onexitbegin = p;
    }
    *(__onexitend++) = (_PVFV)func;
    return func;
}

int atexit(_PVFV func) {
    return (_onexit((_onexit_t)func) ? 0 : -1);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -