diff options
author | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
---|---|---|
committer | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
commit | e611b132f9b8abe35b362e5870b74bce94a1e58e (patch) | |
tree | a5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/crt32/exec/getproc.c | |
download | NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2 NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip |
Diffstat (limited to 'private/crt32/exec/getproc.c')
-rw-r--r-- | private/crt32/exec/getproc.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/private/crt32/exec/getproc.c b/private/crt32/exec/getproc.c new file mode 100644 index 000000000..2cb78323e --- /dev/null +++ b/private/crt32/exec/getproc.c @@ -0,0 +1,62 @@ +/*** +*getproc.c - Get the address of a procedure in a DLL. +* +* Copyright (c) 1991, Microsoft Corporation. All rights reserved. +* +*Purpose: +* defines _getdllprocadd() - gets a procedure address by name or +* ordinal +* +*Revision History: +* 08-21-91 BWM Wrote module. +* +*******************************************************************************/ + +#include <cruntime.h> +#include <oscalls.h> +#include <process.h> + +#if !defined(_WIN32_) +#error ERROR - ONLY WIN32 TARGET SUPPORTED! +#endif + +/*** +*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 (_CALLTYPE1 * _CALLTYPE1 _getdllprocaddr(int hMod, + char * szProcName, + int iOrdinal))() +{ + typedef int (_CALLTYPE1 * 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); + +} |