summaryrefslogtreecommitdiffstats
path: root/crypto/dso/dso_win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/dso/dso_win32.c')
-rw-r--r--crypto/dso/dso_win32.c67
1 files changed, 51 insertions, 16 deletions
diff --git a/crypto/dso/dso_win32.c b/crypto/dso/dso_win32.c
index e204b6b07b..3a2baf2643 100644
--- a/crypto/dso/dso_win32.c
+++ b/crypto/dso/dso_win32.c
@@ -73,9 +73,11 @@ DSO_METHOD *DSO_METHOD_win32(void)
static int win32_load(DSO *dso, const char *filename);
static int win32_unload(DSO *dso);
-static int win32_bind(DSO *dso, const char *symname, void **symptr);
+static void *win32_bind_var(DSO *dso, const char *symname);
+static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname);
#if 0
-static int win32_unbind(DSO *dso, char *symname, void *symptr);
+static int win32_unbind_var(DSO *dso, char *symname, void *symptr);
+static int win32_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr);
static int win32_init(DSO *dso);
static int win32_finish(DSO *dso);
#endif
@@ -85,10 +87,12 @@ static DSO_METHOD dso_meth_win32 = {
"OpenSSL 'win32' shared library method",
win32_load,
win32_unload,
- win32_bind,
+ win32_bind_var,
+ win32_bind_func,
/* For now, "unbind" doesn't exist */
#if 0
- NULL, /* unbind */
+ NULL, /* unbind_var */
+ NULL, /* unbind_func */
#endif
win32_ctrl,
NULL, /* init */
@@ -180,35 +184,66 @@ static int win32_unload(DSO *dso)
return(1);
}
-static int win32_bind(DSO *dso, const char *symname, void **symptr)
+/* Using GetProcAddress for variables? TODO: Check this out in
+ * the Win32 API docs, there's probably a variant for variables. */
+static void *win32_bind_var(DSO *dso, const char *symname)
{
HINSTANCE *ptr;
void *sym;
- if((dso == NULL) || (symptr == NULL) || (symname == NULL))
+ if((dso == NULL) || (symname == NULL))
{
- DSOerr(DSO_F_WIN32_BIND,ERR_R_PASSED_NULL_PARAMETER);
- return(0);
+ DSOerr(DSO_F_WIN32_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER);
+ return(NULL);
}
if(sk_num(dso->meth_data) < 1)
{
- DSOerr(DSO_F_WIN32_BIND,DSO_R_STACK_ERROR);
- return(0);
+ DSOerr(DSO_F_WIN32_BIND_VAR,DSO_R_STACK_ERROR);
+ return(NULL);
}
ptr = (HINSTANCE *)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1);
if(ptr == NULL)
{
- DSOerr(DSO_F_WIN32_BIND,DSO_R_NULL_HANDLE);
- return(0);
+ DSOerr(DSO_F_WIN32_BIND_VAR,DSO_R_NULL_HANDLE);
+ return(NULL);
}
sym = GetProcAddress(*ptr, symname);
if(sym == NULL)
{
- DSOerr(DSO_F_WIN32_BIND,DSO_R_SYM_FAILURE);
- return(0);
+ DSOerr(DSO_F_WIN32_BIND_VAR,DSO_R_SYM_FAILURE);
+ return(NULL);
}
- *symptr = sym;
- return(1);
+ return(sym);
+ }
+
+static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname)
+ {
+ HINSTANCE *ptr;
+ void *sym;
+
+ if((dso == NULL) || (symname == NULL))
+ {
+ DSOerr(DSO_F_WIN32_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER);
+ return(NULL);
+ }
+ if(sk_num(dso->meth_data) < 1)
+ {
+ DSOerr(DSO_F_WIN32_BIND_FUNC,DSO_R_STACK_ERROR);
+ return(NULL);
+ }
+ ptr = (HINSTANCE *)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1);
+ if(ptr == NULL)
+ {
+ DSOerr(DSO_F_WIN32_BIND_FUNC,DSO_R_NULL_HANDLE);
+ return(NULL);
+ }
+ sym = GetProcAddress(*ptr, symname);
+ if(sym == NULL)
+ {
+ DSOerr(DSO_F_WIN32_BIND_FUNC,DSO_R_SYM_FAILURE);
+ return(NULL);
+ }
+ return((DSO_FUNC_TYPE)sym);
}
static long win32_ctrl(DSO *dso, int cmd, long larg, void *parg)