Commits

Anthony Tuininga committed 504eb4f

Exclude the Windows directory and the side-by-side installation directory
when determining DLLs to copy. Errors in side-by-side installations are very
difficult to determine so its best by default not to even try but instead rely
on the distributable installers that have been created for the purpose.

Comments (0)

Files changed (2)

 
 if sys.platform == "win32":
     pythonDll = "python%s%s.dll" % sys.version_info[:2]
-    GLOBAL_BIN_PATH_EXCLUDES = [cx_Freeze.util.GetSystemDir()]
+    systemDir = cx_Freeze.util.GetSystemDir()
+    windowsDir = cx_Freeze.util.GetWindowsDir()
+    GLOBAL_BIN_PATH_EXCLUDES = \
+            [windowsDir, systemDir, os.path.join(windowsDir, "WinSxS")]
     GLOBAL_BIN_INCLUDES = [
             pythonDll,
             "gdiplus.dll",
 
 //-----------------------------------------------------------------------------
 // ExtGetSystemDir()
-//   Return the Windows directory (C:\Windows for example).
+//   Return the Windows system directory (C:\Windows\system for example).
 //-----------------------------------------------------------------------------
 static PyObject *ExtGetSystemDir(
     PyObject *self,                     // passthrough argument
     PyErr_SetExcFromWindowsErr(PyExc_RuntimeError, GetLastError());
     return NULL;
 }
+
+
+//-----------------------------------------------------------------------------
+// ExtGetWindowsDir()
+//   Return the Windows directory (C:\Windows for example).
+//-----------------------------------------------------------------------------
+static PyObject *ExtGetWindowsDir(
+    PyObject *self,                     // passthrough argument
+    PyObject *args)                     // arguments (ignored)
+{
+    char dir[MAX_PATH + 1];
+
+    if (GetWindowsDirectory(dir, sizeof(dir)))
+        return PyString_FromString(dir);
+    PyErr_SetExcFromWindowsErr(PyExc_RuntimeError, GetLastError());
+    return NULL;
+}
 #endif
 
 
     { "AddIcon", ExtAddIcon, METH_VARARGS },
     { "GetDependentFiles", ExtGetDependentFiles, METH_VARARGS },
     { "GetSystemDir", ExtGetSystemDir, METH_NOARGS },
+    { "GetWindowsDir", ExtGetWindowsDir, METH_NOARGS },
 #endif
     { NULL }
 };