~rdoering/ubuntu/karmic/erlang/fix-535090

« back to all changes in this revision

Viewing changes to erts/emulator/sys/win32/erl_win32_sys_ddll.c

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-02-15 16:42:52 UTC
  • mfrom: (3.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090215164252-q5x4rcf8a5pbesb1
Tags: 1:12.b.5-dfsg-2
Upload to unstable after lenny is released.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
 */
48
48
int erts_sys_ddll_open(char *full_name, void **handle)
49
49
{
50
 
    HINSTANCE hinstance;
51
50
    int len;
52
 
    int ret = ERL_DE_NO_ERROR;
53
 
    char dlname[MAXPATHLEN + EXT_LEN + 1];
54
 
 
55
 
    if ((len = sys_strlen(full_name)) > MAXPATHLEN-EXT_LEN-1) {
56
 
        ret = ERL_DE_LOAD_ERROR_NAME_TO_LONG;
57
 
        goto done;
 
51
    char dlname[MAXPATHLEN + 1];
 
52
    
 
53
    if ((len = sys_strlen(full_name)) >= MAXPATHLEN - EXT_LEN) {
 
54
        return ERL_DE_LOAD_ERROR_NAME_TO_LONG;
58
55
    }
59
56
    sys_strcpy(dlname, full_name);
60
57
    sys_strcpy(dlname+len, FILE_EXT);
 
58
    return erts_sys_ddll_open_noext(dlname, handle);
 
59
}
 
60
int erts_sys_ddll_open_noext(char *dlname, void **handle)
 
61
{
 
62
    HINSTANCE hinstance;
 
63
    
61
64
    if ((hinstance = LoadLibrary(dlname)) == NULL) {
62
 
        ret = ERL_DE_DYNAMIC_ERROR_OFFSET - GetLastError();
63
 
        goto done;
 
65
        return ERL_DE_DYNAMIC_ERROR_OFFSET - GetLastError();
64
66
    } else {
65
67
        *handle = (void *) hinstance;
 
68
        return ERL_DE_NO_ERROR;
66
69
    }
67
 
 done:
68
 
    return ret;
69
70
}
70
71
 
71
72
/*