aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2013-09-24 16:19:44 +0200
committerPatrik Nyblom <[email protected]>2013-09-24 16:19:44 +0200
commit3a0402e1157a89fac210f2276d9461aab30a9968 (patch)
tree7bcb89a1b6a20a2480bbb861837cf2f2f7217402 /erts
parent6fea2c436a6f4a501be632e9bb7453570c09fb8e (diff)
downloadotp-3a0402e1157a89fac210f2276d9461aab30a9968.tar.gz
otp-3a0402e1157a89fac210f2276d9461aab30a9968.tar.bz2
otp-3a0402e1157a89fac210f2276d9461aab30a9968.zip
Fix open_ddll for win
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/sys/win32/erl_win32_sys_ddll.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/erts/emulator/sys/win32/erl_win32_sys_ddll.c b/erts/emulator/sys/win32/erl_win32_sys_ddll.c
index 553d3b0983..2d3f073cc2 100644
--- a/erts/emulator/sys/win32/erl_win32_sys_ddll.c
+++ b/erts/emulator/sys/win32/erl_win32_sys_ddll.c
@@ -63,8 +63,9 @@ int erts_sys_ddll_open2(const char *full_name, void **handle, ErtsSysDdllError*
{
HINSTANCE hinstance;
int len;
- char dlname[MAXPATHLEN + 1];
- char* wcp;
+ wchar_t* wcp;
+ Sint used;
+ int code;
if ((len = sys_strlen(full_name)) >= MAXPATHLEN - EXT_LEN) {
if (err != NULL) {
@@ -73,20 +74,23 @@ int erts_sys_ddll_open2(const char *full_name, void **handle, ErtsSysDdllError*
return ERL_DE_LOAD_ERROR_NAME_TO_LONG;
}
- wcp = erts_convert_filename_to_wchar(full_name, len, dlname, sizeof(dlname),
- ERTS_ALC_T_TMP, &used, EXT_LEN);
- wcscpy(&wcp[used], FILE_EXT_WCHAR);
+ wcp = (wchar_t*)erts_convert_filename_to_wchar((byte*)full_name, len,
+ NULL, 0,
+ ERTS_ALC_T_TMP, &used, EXT_LEN);
+ wcscpy(&wcp[used/2 - 1], FILE_EXT_WCHAR);
if ((hinstance = LoadLibraryW(wcp)) == NULL) {
- int code = ERL_DE_DYNAMIC_ERROR_OFFSET - GetLastError();
+ code = ERL_DE_DYNAMIC_ERROR_OFFSET - GetLastError();
if (err != NULL) {
err->str = erts_sys_ddll_error(code);
}
- return code;
}
-
- *handle = (void *) hinstance;
- return ERL_DE_NO_ERROR;
+ else {
+ code = ERL_DE_NO_ERROR;
+ *handle = (void *) hinstance;
+ }
+ erts_free(ERTS_ALC_T_TMP, wcp);
+ return code;
}
int erts_sys_ddll_open_noext(char *dlname, void **handle, ErtsSysDdllError* err)