}
#else
-static int win32_load(DSO *dso, char *filename);
+/* Part of the hack in "win32_load" ... */
+#define DSO_MAX_TRANSLATED_SIZE 256
+
+static int win32_load(DSO *dso, const char *filename);
static int win32_unload(DSO *dso);
-static int win32_bind(DSO *dso, char *symname, void **symptr);
+static int win32_bind(DSO *dso, const char *symname, void **symptr);
#if 0
static int win32_unbind(DSO *dso, char *symname, void *symptr);
static int win32_init(DSO *dso);
static int win32_finish(DSO *dso);
#endif
+static long win32_ctrl(DSO *dso, int cmd, long larg, void *parg);
static DSO_METHOD dso_meth_win32 = {
"OpenSSL 'win32' shared library method",
#if 0
NULL, /* unbind */
#endif
+ win32_ctrl,
NULL, /* init */
NULL /* finish */
};
/* For this DSO_METHOD, our meth_data STACK will contain;
* (i) a pointer to the handle (HINSTANCE) returned from
- * LoadLibrary(), and copied.
+ * LoadLibrary(), and copied.
*/
-static int win32_load(DSO *dso, char *filename)
+static int win32_load(DSO *dso, const char *filename)
{
HINSTANCE h, *p;
+ char translated[DSO_MAX_TRANSLATED_SIZE];
+ int len;
- h = LoadLibrary(filename);
+ /* NB: This is a hideous hack, but I'm not yet sure what
+ * to replace it with. This attempts to convert any filename,
+ * that looks like it has no path information, into a
+ * translated form, e. "blah" -> "blah.dll" ... I'm more
+ * comfortable putting hacks into win32 code though ;-) */
+ len = strlen(filename);
+ if((dso->flags & DSO_FLAG_NAME_TRANSLATION) &&
+ (len + 4 < DSO_MAX_TRANSLATED_SIZE) &&
+ (strstr(filename, "/") == NULL)
+ (strstr(filename, "\\") == NULL)
+ (strstr(filename, ":") == NULL))
+ {
+ sprintf(translated, "%s.dll", filename);
+ h = LoadLibrary(translated);
+ }
+ else
+ h = LoadLibrary(filename);
if(h == NULL)
{
DSOerr(DSO_F_WIN32_LOAD,DSO_R_LOAD_FAILED);
return(1);
}
-static int win32_bind(DSO *dso, char *symname, void **symptr)
+static int win32_bind(DSO *dso, const char *symname, void **symptr)
{
HINSTANCE *ptr;
void *sym;
return(1);
}
+static int win32_ctrl(DSO *dso, int cmd, long larg, void *parg)
+ {
+ if(dso == NULL)
+ {
+ DSOerr(DSO_F_WIN32_CTRL,ERR_R_PASSED_NULL_PARAMETER);
+ return(-1);
+ }
+ switch(cmd)
+ {
+ case DSO_CTRL_GET_FLAGS:
+ return dso->flags;
+ case DSO_CTRL_SET_FLAGS:
+ dso->flags = (int)larg;
+ return(0);
+ case DSO_CTRL_OR_FLAGS:
+ dso->flags |= (int)larg;
+ return(0);
+ default:
+ break;
+ }
+ DSOerr(DSO_F_WIN32_CTRL,DSO_R_UNKNOWN_COMMAND);
+ return(-1);
+ }
+
#endif /* WIN32 */