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

📄 getproc.c

📁 C标准库源代码
💻 C
字号:
/***
*getproc.c - Get the address of a procedure in a DLL.
*
*       Copyright (c) 1991-1997, Microsoft Corporation. All rights reserved.
*
*Purpose:
*       defines _getdllprocadd() - gets a procedure address by name or
*       ordinal
*
*******************************************************************************/

#include <cruntime.h>
#include <oscalls.h>
#include <process.h>

/***
*int (*)() _getdllprocaddr(handle, name, ordinal) - Get the address of a
*       DLL procedure specified by name or ordinal
*
*Purpose:
*
*Entry:
*       int handle - a DLL handle from _loaddll
*       char * name - Name of the procedure, or NULL to get by ordinal
*       int ordinal - Ordinal of the procedure, or -1 to get by name
*
*
*Exit:
*       returns a pointer to the procedure if found
*       returns NULL if not found
*
*Exceptions:
*
*******************************************************************************/

int (__cdecl * __cdecl _getdllprocaddr(int hMod,
                                             char * szProcName,
                                             int iOrdinal))()
{
    typedef int (__cdecl * PFN)();

    if (szProcName == NULL) {
        if (iOrdinal <= 65535) {
            return ((PFN)GetProcAddress((HANDLE)hMod, (LPSTR)iOrdinal));
        }
    }
    else {
        if (iOrdinal == -1) {
            return ((PFN)GetProcAddress((HANDLE)hMod, szProcName));
        }
    }

    return (NULL);

}

⌨️ 快捷键说明

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