X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fdso%2Fdso_win32.c;h=b8693c13e54a3029325c9faf49e6804b76422c5f;hp=73ffe3659134074b51d6ba8f9d02d9c95c6dd354;hb=c07a126fb23e9345d96e47009d4711313af11744;hpb=68b64fb6102737bf84de9e25168abbf7e969b54b diff --git a/crypto/dso/dso_win32.c b/crypto/dso/dso_win32.c index 73ffe36591..b8693c13e5 100644 --- a/crypto/dso/dso_win32.c +++ b/crypto/dso/dso_win32.c @@ -129,7 +129,7 @@ static char *win32_name_converter(DSO *dso, const char *filename); static char *win32_merger(DSO *dso, const char *filespec1, const char *filespec2); static int win32_pathbyaddr(void *addr,char *path,int sz); -static DSO_FUNC_TYPE win32_globallookup(const char *name); +static void *win32_globallookup(const char *name); static const char *openssl_strnchr(const char *string, int c, size_t len); @@ -188,7 +188,7 @@ static int win32_load(DSO *dso) goto err; } *p = h; - if(!sk_push(dso->meth_data, (char *)p)) + if(!sk_void_push(dso->meth_data, p)) { DSOerr(DSO_F_WIN32_LOAD,DSO_R_STACK_ERROR); goto err; @@ -215,9 +215,9 @@ static int win32_unload(DSO *dso) DSOerr(DSO_F_WIN32_UNLOAD,ERR_R_PASSED_NULL_PARAMETER); return(0); } - if(sk_num(dso->meth_data) < 1) + if(sk_void_num(dso->meth_data) < 1) return(1); - p = (HINSTANCE *)sk_pop(dso->meth_data); + p = sk_void_pop(dso->meth_data); if(p == NULL) { DSOerr(DSO_F_WIN32_UNLOAD,DSO_R_NULL_HANDLE); @@ -228,7 +228,7 @@ static int win32_unload(DSO *dso) DSOerr(DSO_F_WIN32_UNLOAD,DSO_R_UNLOAD_FAILED); /* We should push the value back onto the stack in * case of a retry. */ - sk_push(dso->meth_data, (char *)p); + sk_void_push(dso->meth_data, p); return(0); } /* Cleanup */ @@ -248,12 +248,12 @@ static void *win32_bind_var(DSO *dso, const char *symname) DSOerr(DSO_F_WIN32_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER); return(NULL); } - if(sk_num(dso->meth_data) < 1) + if(sk_void_num(dso->meth_data) < 1) { 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); + ptr = sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1); if(ptr == NULL) { DSOerr(DSO_F_WIN32_BIND_VAR,DSO_R_NULL_HANDLE); @@ -279,12 +279,12 @@ static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname) DSOerr(DSO_F_WIN32_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER); return(NULL); } - if(sk_num(dso->meth_data) < 1) + if(sk_void_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); + ptr = sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1); if(ptr == NULL) { DSOerr(DSO_F_WIN32_BIND_FUNC,DSO_R_NULL_HANDLE); @@ -578,14 +578,14 @@ static char *win32_merger(DSO *dso, const char *filespec1, const char *filespec2 } else { - filespec1_split = win32_splitter(dso, filespec1, 1); + filespec1_split = win32_splitter(dso, filespec1, 0); if (!filespec1_split) { DSOerr(DSO_F_WIN32_MERGER, ERR_R_MALLOC_FAILURE); return(NULL); } - filespec2_split = win32_splitter(dso, filespec2, 0); + filespec2_split = win32_splitter(dso, filespec2, 1); if (!filespec2_split) { DSOerr(DSO_F_WIN32_MERGER, @@ -698,7 +698,7 @@ static int win32_pathbyaddr(void *addr,char *path,int sz) dll = LoadLibrary(TEXT(DLLNAME)); if (dll == NULL) { - DSOerr(DSO_F_PATHBYADDR,DSO_R_UNSUPPORTED); + DSOerr(DSO_F_WIN32_PATHBYADDR,DSO_R_UNSUPPORTED); return -1; } @@ -707,7 +707,7 @@ static int win32_pathbyaddr(void *addr,char *path,int sz) if (create_snap == NULL) { FreeLibrary(dll); - DSOerr(DSO_F_PATHBYADDR,DSO_R_UNSUPPORTED); + DSOerr(DSO_F_WIN32_PATHBYADDR,DSO_R_UNSUPPORTED); return -1; } /* We take the rest for granted... */ @@ -724,7 +724,7 @@ static int win32_pathbyaddr(void *addr,char *path,int sz) if( hModuleSnap == INVALID_HANDLE_VALUE ) { FreeLibrary(dll); - DSOerr(DSO_F_PATHBYADDR,DSO_R_UNSUPPORTED); + DSOerr(DSO_F_WIN32_PATHBYADDR,DSO_R_UNSUPPORTED); return -1; } @@ -734,7 +734,7 @@ static int win32_pathbyaddr(void *addr,char *path,int sz) { (*close_snap)(hModuleSnap); FreeLibrary(dll); - DSOerr(DSO_F_PATHBYADDR,DSO_R_FAILURE); + DSOerr(DSO_F_WIN32_PATHBYADDR,DSO_R_FAILURE); return -1; } @@ -773,7 +773,7 @@ static int win32_pathbyaddr(void *addr,char *path,int sz) return 0; } -static DSO_FUNC_TYPE win32_globallookup(const char *name) +static void *win32_globallookup(const char *name) { HMODULE dll; HANDLE hModuleSnap = INVALID_HANDLE_VALUE; @@ -786,7 +786,7 @@ static DSO_FUNC_TYPE win32_globallookup(const char *name) dll = LoadLibrary(TEXT(DLLNAME)); if (dll == NULL) { - DSOerr(DSO_F_GLOBAL_LOOKUP_FUNC,DSO_R_UNSUPPORTED); + DSOerr(DSO_F_WIN32_GLOBALLOOKUP,DSO_R_UNSUPPORTED); return NULL; } @@ -795,7 +795,7 @@ static DSO_FUNC_TYPE win32_globallookup(const char *name) if (create_snap == NULL) { FreeLibrary(dll); - DSOerr(DSO_F_GLOBAL_LOOKUP_FUNC,DSO_R_UNSUPPORTED); + DSOerr(DSO_F_WIN32_GLOBALLOOKUP,DSO_R_UNSUPPORTED); return NULL; } /* We take the rest for granted... */ @@ -809,7 +809,12 @@ static DSO_FUNC_TYPE win32_globallookup(const char *name) module_next = (MODULE32)GetProcAddress(dll,"Module32Next"); hModuleSnap = (*create_snap)(TH32CS_SNAPMODULE,0); - if( hModuleSnap == INVALID_HANDLE_VALUE ) return NULL; + if( hModuleSnap == INVALID_HANDLE_VALUE ) + { + FreeLibrary(dll); + DSOerr(DSO_F_WIN32_GLOBALLOOKUP,DSO_R_UNSUPPORTED); + return NULL; + } me32.dwSize = sizeof(me32); @@ -821,7 +826,7 @@ static DSO_FUNC_TYPE win32_globallookup(const char *name) } do { - if (ret = GetProcAddress(me32.hModule,fname)) + if ((ret = GetProcAddress(me32.hModule,name))) { (*close_snap)(hModuleSnap); FreeLibrary(dll);