diff options
author | Rich Salz <rsalz@openssl.org> | 2016-03-22 14:33:00 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2016-03-23 08:34:33 -0400 |
commit | 3d8b2ec42bcb1cfe2f6f502ea8c6f098202a2906 (patch) | |
tree | c6b33600fafbb424e4ccbeb0e93f8dc620521d00 /crypto/dso/dso_win32.c | |
parent | de7058241083e9ec80c4ad27e7bb4f2bd79e36f2 (diff) |
Remove several unused undocumented functions.
Removed the following:
DSO_bind_var, DSO_bind_var, DSO_get_default_method,
DSO_get_loaded_filename, DSO_get_loaded_filename, DSO_get_method,
DSO_new_method, DSO_pathbyaddr, DSO_set_default_method, DSO_set_method,
DSO_set_name_converter, DSO_set_name_converter
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/dso/dso_win32.c')
-rw-r--r-- | crypto/dso/dso_win32.c | 138 |
1 files changed, 0 insertions, 138 deletions
diff --git a/crypto/dso/dso_win32.c b/crypto/dso/dso_win32.c index e378d68946..01d2a72020 100644 --- a/crypto/dso/dso_win32.c +++ b/crypto/dso/dso_win32.c @@ -108,12 +108,10 @@ static HINSTANCE LoadLibraryA(LPCSTR lpLibFileName) static int win32_load(DSO *dso); static int win32_unload(DSO *dso); -static void *win32_bind_var(DSO *dso, const char *symname); static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname); 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 void *win32_globallookup(const char *name); static const char *openssl_strnchr(const char *string, int c, size_t len); @@ -122,14 +120,12 @@ static DSO_METHOD dso_meth_win32 = { "OpenSSL 'win32' shared library method", win32_load, win32_unload, - win32_bind_var, win32_bind_func, NULL, /* ctrl */ win32_name_converter, win32_merger, NULL, /* init */ NULL, /* finish */ - win32_pathbyaddr, win32_globallookup }; @@ -208,40 +204,6 @@ static int win32_unload(DSO *dso) return (1); } -/* - * 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; - union { - void *p; - FARPROC f; - } sym; - - if ((dso == NULL) || (symname == NULL)) { - DSOerr(DSO_F_WIN32_BIND_VAR, ERR_R_PASSED_NULL_PARAMETER); - return (NULL); - } - if (sk_void_num(dso->meth_data) < 1) { - DSOerr(DSO_F_WIN32_BIND_VAR, DSO_R_STACK_ERROR); - return (NULL); - } - 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); - return (NULL); - } - sym.f = GetProcAddress(*ptr, symname); - if (sym.p == NULL) { - DSOerr(DSO_F_WIN32_BIND_VAR, DSO_R_SYM_FAILURE); - ERR_add_error_data(3, "symname(", symname, ")"); - return (NULL); - } - return (sym.p); -} - static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname) { HINSTANCE *ptr; @@ -593,106 +555,6 @@ typedef HANDLE(WINAPI *CREATETOOLHELP32SNAPSHOT) (DWORD, DWORD); typedef BOOL(WINAPI *CLOSETOOLHELP32SNAPSHOT) (HANDLE); typedef BOOL(WINAPI *MODULE32) (HANDLE, MODULEENTRY32 *); -static int win32_pathbyaddr(void *addr, char *path, int sz) -{ - HMODULE dll; - HANDLE hModuleSnap = INVALID_HANDLE_VALUE; - MODULEENTRY32 me32; - CREATETOOLHELP32SNAPSHOT create_snap; - CLOSETOOLHELP32SNAPSHOT close_snap; - MODULE32 module_first, module_next; - - if (addr == NULL) { - union { - int (*f) (void *, char *, int); - void *p; - } t = { - win32_pathbyaddr - }; - addr = t.p; - } - - dll = LoadLibrary(TEXT(DLLNAME)); - if (dll == NULL) { - DSOerr(DSO_F_WIN32_PATHBYADDR, DSO_R_UNSUPPORTED); - return -1; - } - - create_snap = (CREATETOOLHELP32SNAPSHOT) - GetProcAddress(dll, "CreateToolhelp32Snapshot"); - if (create_snap == NULL) { - FreeLibrary(dll); - DSOerr(DSO_F_WIN32_PATHBYADDR, DSO_R_UNSUPPORTED); - return -1; - } - /* We take the rest for granted... */ -# ifdef _WIN32_WCE - close_snap = (CLOSETOOLHELP32SNAPSHOT) - GetProcAddress(dll, "CloseToolhelp32Snapshot"); -# else - close_snap = (CLOSETOOLHELP32SNAPSHOT) CloseHandle; -# endif - module_first = (MODULE32) GetProcAddress(dll, "Module32First"); - module_next = (MODULE32) GetProcAddress(dll, "Module32Next"); - - hModuleSnap = (*create_snap) (TH32CS_SNAPMODULE, 0); - if (hModuleSnap == INVALID_HANDLE_VALUE) { - FreeLibrary(dll); - DSOerr(DSO_F_WIN32_PATHBYADDR, DSO_R_UNSUPPORTED); - return -1; - } - - me32.dwSize = sizeof(me32); - - if (!(*module_first) (hModuleSnap, &me32)) { - (*close_snap) (hModuleSnap); - FreeLibrary(dll); - DSOerr(DSO_F_WIN32_PATHBYADDR, DSO_R_FAILURE); - return -1; - } - - do { - if ((BYTE *) addr >= me32.modBaseAddr && - (BYTE *) addr < me32.modBaseAddr + me32.modBaseSize) { - (*close_snap) (hModuleSnap); - FreeLibrary(dll); -# ifdef _WIN32_WCE -# if _WIN32_WCE >= 101 - return WideCharToMultiByte(CP_ACP, 0, me32.szExePath, -1, - path, sz, NULL, NULL); -# else - { - int i, len = (int)wcslen(me32.szExePath); - if (sz <= 0) - return len + 1; - if (len >= sz) - len = sz - 1; - for (i = 0; i < len; i++) - path[i] = (char)me32.szExePath[i]; - path[len++] = 0; - return len; - } -# endif -# else - { - int len = (int)strlen(me32.szExePath); - if (sz <= 0) - return len + 1; - if (len >= sz) - len = sz - 1; - memcpy(path, me32.szExePath, len); - path[len++] = 0; - return len; - } -# endif - } - } while ((*module_next) (hModuleSnap, &me32)); - - (*close_snap) (hModuleSnap); - FreeLibrary(dll); - return 0; -} - static void *win32_globallookup(const char *name) { HMODULE dll; |