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

📄 kernel.odl

📁 The code for this article was written for version 1.0 of the Active Template Library (ATL). The cu
💻 ODL
📖 第 1 页 / 共 4 页
字号:

//@B Kernel
[
uuid(54674042-3A82-101B-8181-00AA003743D3),
helpstring("Windows Kernel Functions"),
#ifdef WIN32
dllname("KERNEL32.DLL")
#else
dllname("KRNL386.EXE")
#endif
]
module Kernel {
//@E Kernel

    // ****** System Information ********

    [
    usesgetlasterror,
    entry("GetVersion"),
    helpstring("Gets version numbers of Windows and MS-DOS"),
    ]
    DWORD WINAPI GetVersion();

    /* Not implemented
    BOOL WINAPI GetVersionExA(
        LPOSVERSIONINFOA lpVersionInformation
        );

    const int VER_PLATFORM_WIN32s        = 0;
    const int VER_PLATFORM_WIN32_WINDOWS = 1;
    const int VER_PLATFORM_WIN32_NT      = 2;

    typedef struct _OSVERSIONINFOA {
        DWORD dwOSVersionInfoSize;
        DWORD dwMajorVersion;
        DWORD dwMinorVersion;
        DWORD dwBuildNumber;
        DWORD dwPlatformId;
        CHAR   szCSDVersion[ 128 ];       // Maintenance string for PSS usage
    } OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;

    typedef OSVERSIONINFOA OSVERSIONINFO;
    typedef POSVERSIONINFOA POSVERSIONINFO;
    typedef LPOSVERSIONINFOA LPOSVERSIONINFO;
    */

    #ifndef WIN32
    [
    usesgetlasterror,
    entry("GetFreeSpace"),
    helpstring("Gets bytes of global heap memory available"),
    ]
    DWORD WINAPI GetFreeSpace([in] UINT fuFlags);
    #endif

    // Win32 macro
    //define GetFreeSpace(w)                (0x100000L)

    /* Omitted
    GetCurrentPDB
    */

//@B GetWindowsDirectory
    [
    #ifdef WIN32
    usesgetlasterror,
    entry("GetWindowsDirectoryA"),
    #else
    entry("GetWindowsDirectory"),
    #endif
    helpstring("Gets Windows directory"),
    ]
    UINT WINAPI GetWindowsDirectory([in, out] LPSTR lpszSysPath,
                                    [in] UINT cbSysPath);
//@E GetWindowsDirectory

    [
    #ifdef WIN32
    usesgetlasterror,
    entry("GetSystemDirectoryA"),
    #else
    entry("GetSystemDirectory"),
    #endif
    helpstring("Gets Windows System directory"),
    ]
    UINT WINAPI GetSystemDirectory([in, out] LPSTR lpszSysPath,
                                   [in] UINT cbSysPath);

    #ifndef WIN32
    [
    usesgetlasterror,
    entry("GetWinFlags"),
    helpstring("Gets system and memory configuration flags"),
    ]
    DWORD   WINAPI GetWinFlags(VOID);
    #endif

    /* Omitted
    LPSTR   WINAPI GetDOSEnvironment(void);
    DWORD   WINAPI GetCurrentTime(void);
    DWORD   WINAPI GetTimerResolution(void);
    void    WINAPI LogError(UINT err, void FAR* lpInfo);
    void    WINAPI LogParamError(UINT err, FARPROC lpfn, void FAR* param);
    BOOL    WINAPI GetWinDebugInfo(WINDEBUGINFO FAR* lpwdi, UINT flags);
    BOOL    WINAPI SetWinDebugInfo(WINDEBUGINFO FAR* lpwdi);
    void    FAR _cdecl DebugOutput(UINT flags, LPCSTR lpsz, ...);
    void    WINAPI FatalExit(int);
    void    WINAPI FatalAppExit(UINT, LPCSTR);
    */

    #ifdef WIN32
    [
    usesgetlasterror,
    entry("GetTickCount"),
    helpstring("Returns milliseconds since Windows was started"),
    ]
    DWORD   WINAPI GetTickCount(void);
    #endif

    [
    usesgetlasterror,
    entry("DebugBreak"),
    helpstring("Break into a debugger"),
    ]
    void    WINAPI DebugBreak();

    [
    #ifdef WIN32
    usesgetlasterror,
    entry("OutputDebugStringA"),
    #else
    entry("OutputDebugString"),
    #endif
    helpstring("Send string to the debugging terminal"),
    ]
    void    WINAPI OutputDebugString([in] LPCSTR lpszOutputString);

    /* Omitted
    // SetErrorMode() constants
    const UINT SEM_FAILCRITICALERRORS     = 0x0001;
    const UINT SEM_NOGPFAULTERRORBOX      = 0x0002;
    const UINT SEM_NOALIGNMENTFAULTEXCEPT = 0x0004;  // Win32 only
    const UINT SEM_NOOPENFILEERRORBOX     = 0x8000;

    UINT WINAPI SetErrorMode(
        UINT uMode
        );

    */

    // ****** Module Management *******

    /* Omitted
    HINSTANCE   WINAPI LoadModule(LPCSTR, LPVOID);
    */

    #ifndef WIN32
    [
    usesgetlasterror,
    entry("FreeModule"),
    helpstring("Free a running module"),
    ]
    BOOL        WINAPI FreeModule([in] HINSTANCE hInst);
    #endif

    [
    #ifdef WIN32
    usesgetlasterror,
    entry("LoadLibraryA"),
    #else
    entry("LoadLibrary"),
    #endif
    helpstring("Load a DLL"),
    ]
    HINSTANCE   WINAPI LoadLibrary([in] LPCSTR lpszLibFileName);

    [
    usesgetlasterror,
    entry("FreeLibrary"),
    helpstring("Free a DLL"),
    ]
    void        WINAPI FreeLibrary([in] HINSTANCE hInst);

    /* Not implemented
    HINSTANCE WINAPI LoadLibraryExA(
        LPCSTR lpLibFileName,
        HANDLE hFile,
        DWORD dwFlags
        );

    const DWORD DONT_RESOLVE_DLL_REFERENCES = 0x00000001;
    const DWORD LOAD_LIBRARY_AS_DATAFILE    = 0x00000002;

    VOID WINAPI FreeLibraryAndExitThread(
        HMODULE hLibModule,
        DWORD dwExitCode
        );

    BOOL WINAPI DisableThreadLibraryCalls(
        HMODULE hLibModule
        );
    */

    [
    usesgetlasterror,
    entry("WinExec"),
    helpstring("Run an application"),
    ]
    UINT    WINAPI WinExec([in] LPCSTR lpszCmdLine, [in] UINT fuCmdShow);

    #ifdef WIN32

    [
    usesgetlasterror,
    entry("GetBinaryTypeA"),
    helpstring("Determine whether an application is executable, and if so, on what platform"),
    ]
    BOOL WINAPI GetBinaryType([in] LPCSTR lpApplicationName,
                              [in,out] DWORD * lpBinaryType);

    [
    usesgetlasterror,
    entry("GetShortPathNameA"),
    helpstring("Gets the short path form of a specified input path"),
    ]
    DWORD WINAPI GetShortPathName([in] LPCSTR lpszLongPath,
                                  [in, out] LPSTR lpszShortPath,
                                  [in] DWORD cchBuffer);


    /* Most of process functions not implemented
    BOOL WINAPI GetProcessAffinityMask(HANDLE hProcess,
                                       LPDWORD lpProcessAffinityMask,
                                       LPDWORD lpSystemAffinityMask);
    BOOL WINAPI GetProcessTimes(HANDLE hProcess,
                                LPFILETIME lpCreationTime,
                                LPFILETIME lpExitTime,
                                LPFILETIME lpKernelTime,
                                LPFILETIME lpUserTime);
    BOOL WINAPI GetProcessWorkingSetSize(HANDLE hProcess,
                                         LPDWORD lpMinimumWorkingSetSize,
                                         LPDWORD lpMaximumWorkingSetSize);
    BOOL WINAPI SetProcessWorkingSetSize(HANDLE hProcess,
                                         DWORD  dwMinimumWorkingSetSize,
                                         DWORD  dwMaximumWorkingSetSize);
    BOOL WINAPI SetProcessShutdownParameters(DWORD dwLevel, DWORD dwFlags);
    BOOL WINAPI GetProcessShutdownParameters(LPDWORD lpdwLevel, LPDWORD lpdwFlags);
    VOID WINAPI GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo);
    LPSTR WINAPI GetCommandLineA(VOID);

    [
    usesgetlasterror,
    entry("CreateProcessA"),
    helpstring("Creates a new process and executes a specified executable file"),
    ]
    BOOL WINAPI CreateProcessA([in] LPCSTR lpApplicationName,
                               [in] LPSTR lpCommandLine,
                               [in] LPSECURITY_ATTRIBUTES lpProcessAttributes,
                               [in] LPSECURITY_ATTRIBUTES lpThreadAttributes,
                               [in] BOOL bInheritHandles,
                               [in] DWORD dwCreationFlags,
                               [in] LPVOID lpEnvironment,
                               [in] LPCSTR lpCurrentDirectory,
                               [in] LPSTARTUPINFOA lpStartupInfo,
                               [in] LPPROCESS_INFORMATION lpProcessInformation);
    */

    [
    usesgetlasterror,
    entry("OpenProcess"),
    helpstring("Given a process ID number, returns handle of existing process"),
    ]
    HANDLE WINAPI OpenProcess([in] DWORD dwDesiredAccess,
                              [in] BOOL bInheritHandle,
                              [in] DWORD dwProcessId);

    [
    usesgetlasterror,
    entry("GetCurrentProcess"),
    helpstring("Gets the process handle of the current process"),
    ]
    HANDLE WINAPI GetCurrentProcess(VOID);

    [
    usesgetlasterror,
    entry("GetCurrentProcessId"),
    helpstring("Gets the process ID number of the current process"),
    ]
    DWORD WINAPI GetCurrentProcessId(VOID);

    [
    usesgetlasterror,
    entry("GetExitCodeProcess"),
    helpstring("Gets the termination status of a given process"),
    ]
    BOOL WINAPI GetExitCodeProcess([in] HANDLE hProcess,
                                   [out] DWORD FAR * lpExitCode);

    /*
    VOID WINAPI ExitProcess(UINT uExitCode);
    BOOL WINAPI TerminateProcess(HANDLE hProcess, UINT uExitCode);
    VOID WINAPI FatalExit(int ExitCode);

    const DWORD STARTF_USESHOWWINDOW        = 0x00000001;
    const DWORD STARTF_USESIZE              = 0x00000002;
    const DWORD STARTF_USEPOSITION          = 0x00000004;
    const DWORD STARTF_USECOUNTCHARS        = 0x00000008;
    const DWORD STARTF_USEFILLATTRIBUTE     = 0x00000010;
    const DWORD STARTF_RUNFULLSCREEN        = 0x00000020;  // ignored for non-x86 platforms
    const DWORD STARTF_FORCEONFEEDBACK      = 0x00000040;
    const DWORD STARTF_FORCEOFFFEEDBACK     = 0x00000080;
    const DWORD STARTF_USESTDHANDLES        = 0x00000100;

    typedef struct _STARTUPINFOA {
        DWORD   cb;
        LPSTR   lpReserved;
        LPSTR   lpDesktop;
        LPSTR   lpTitle;
        DWORD   dwX;
        DWORD   dwY;
        DWORD   dwXSize;
        DWORD   dwYSize;
        DWORD   dwXCountChars;
        DWORD   dwYCountChars;
        DWORD   dwFillAttribute;
        DWORD   dwFlags;
        WORD    wShowWindow;
        WORD    cbReserved2;
        LPBYTE  lpReserved2;
        HANDLE  hStdInput;
        HANDLE  hStdOutput;
        HANDLE  hStdError;
    } STARTUPINFOA, *LPSTARTUPINFOA;
    */


    /* Exceptions not implemented
    VOID WINAPI RaiseException(
        DWORD dwExceptionCode,
        DWORD dwExceptionFlags,
        DWORD nNumberOfArguments,
        CONST DWORD *lpArguments
        );

    LONG WINAPI UnhandledExceptionFilter(
        struct _EXCEPTION_POINTERS *ExceptionInfo
        );

    LPTOP_LEVEL_EXCEPTION_FILTER WINAPI SetUnhandledExceptionFilter(
        LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter
        );
    */
    #endif  // WIN32


    [
    #ifdef WIN32
    usesgetlasterror,
    entry("GetModuleHandleA"),
    #else
    entry("GetModuleHandle"),
    #endif
    helpstring("Get the handle of a module from its name"),
    ]
    HMODULE WINAPI GetModuleHandle([in] LPCSTR lpszModuleName);

    #ifndef WIN32
    [
    usesgetlasterror,
    entry("GetModuleUsage"),
    helpstring("Get the reference count of a module from its handle"),
    ]
    int     WINAPI GetModuleUsage([in] HINSTANCE hInst);

⌨️ 快捷键说明

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