◐ Shell
reader mode source ↗
Skip to content

Commit 589f89e

Browse files
committed
Removed a Windows 9x trick used before LoadLibraryExW.
Windows 9x has long been unsupported and the result of GetFullPathName was not even being used in the first place.
1 parent 51fcb81 commit 589f89e

1 file changed

Lines changed: 8 additions & 17 deletions

File tree

  • Python
    Lines changed: 8 additions & 17 deletions
    Original file line numberDiff line numberDiff line change
    @@ -185,28 +185,19 @@ dl_funcptr _PyImport_GetDynLoadWindows(const char *shortname,
    185185

    186186
    {
    187187
    HINSTANCE hDLL = NULL;
    188-
    wchar_t pathbuf[260];
    189188
    unsigned int old_mode;
    190189
    ULONG_PTR cookie = 0;
    191-
    /* We use LoadLibraryEx so Windows looks for dependent DLLs
    192-
    in directory of pathname first. However, Windows95
    193-
    can sometimes not work correctly unless the absolute
    194-
    path is used. If GetFullPathName() fails, the LoadLibrary
    195-
    will certainly fail too, so use its error code */
    196-
    190+
    197191
    /* Don't display a message box when Python can't load a DLL */
    198192
    old_mode = SetErrorMode(SEM_FAILCRITICALERRORS);
    199193

    200-
    if (GetFullPathNameW(PyUnicode_AS_UNICODE(pathname),
    201-
    sizeof(pathbuf) / sizeof(pathbuf[0]),
    202-
    pathbuf,
    203-
    NULL)) {
    204-
    ULONG_PTR cookie = _Py_ActivateActCtx();
    205-
    /* XXX This call doesn't exist in Windows CE */
    206-
    hDLL = LoadLibraryExW(PyUnicode_AS_UNICODE(pathname), NULL,
    207-
    LOAD_WITH_ALTERED_SEARCH_PATH);
    208-
    _Py_DeactivateActCtx(cookie);
    209-
    }
    194+
    cookie = _Py_ActivateActCtx();
    195+
    /* We use LoadLibraryEx so Windows looks for dependent DLLs
    196+
    in directory of pathname first. */
    197+
    /* XXX This call doesn't exist in Windows CE */
    198+
    hDLL = LoadLibraryExW(PyUnicode_AS_UNICODE(pathname), NULL,
    199+
    LOAD_WITH_ALTERED_SEARCH_PATH);
    200+
    _Py_DeactivateActCtx(cookie);
    210201

    211202
    /* restore old error mode settings */
    212203
    SetErrorMode(old_mode);

    0 commit comments

    Comments
     (0)