summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-10-09 18:30:09 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-10-09 18:30:09 +0000
commit32f99636ca70a0114499260dd425570a227647eb (patch)
tree0d1d89308dfc59db6c0c230e85f715279b3f7f15 /win32
parent8fc173423e29547f0d1de6373cac1b08dfb0c024 (diff)
downloadperl-32f99636ca70a0114499260dd425570a227647eb.tar.gz
on Windows, LoadLibrary() could load an extension DLL multiple
times if forward slashes are used in the path p4raw-id: //depot/perl@7171
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 67e8952de7..65d5f661d9 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -3564,6 +3564,25 @@ win32_dynaload(const char* filename)
{
dTHXo;
HMODULE hModule;
+ char buf[MAX_PATH+1];
+ char *first;
+
+ /* LoadLibrary() doesn't recognize forward slashes correctly,
+ * so turn 'em back. */
+ first = strchr(filename, '/');
+ if (first) {
+ STRLEN len = strlen(filename);
+ if (len <= MAX_PATH) {
+ strcpy(buf, filename);
+ filename = &buf[first - filename];
+ while (*filename) {
+ if (*filename == '/')
+ *(char*)filename = '\\';
+ ++filename;
+ }
+ filename = buf;
+ }
+ }
if (USING_WIDE()) {
WCHAR wfilename[MAX_PATH+1];
A2WHELPER(filename, wfilename, sizeof(wfilename));