Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(985)

Side by Side Diff: Python/dynload_win.c

Issue 13210: Support Visual Studio 2010
Patch Set: Created 1 year ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « PC/pyconfig.h ('k') | Tools/buildbot/build-amd64.bat » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* Support for dynamic loading of extension modules */ 2 /* Support for dynamic loading of extension modules */
3 3
4 #include "Python.h" 4 #include "Python.h"
5 5
6 #ifdef HAVE_DIRECT_H 6 #ifdef HAVE_DIRECT_H
7 #include <direct.h> 7 #include <direct.h>
8 #endif 8 #endif
9 #include <ctype.h> 9 #include <ctype.h>
10 10
11 #include "importdl.h" 11 #include "importdl.h"
12 #include <windows.h> 12 #include <windows.h>
13 13
14 // "activation context" magic - see dl_nt.c... 14 // "activation context" magic - see dl_nt.c...
15 #if HAVE_SXS
15 extern ULONG_PTR _Py_ActivateActCtx(); 16 extern ULONG_PTR _Py_ActivateActCtx();
16 void _Py_DeactivateActCtx(ULONG_PTR cookie); 17 void _Py_DeactivateActCtx(ULONG_PTR cookie);
18 #endif
17 19
18 const char *_PyImport_DynLoadFiletab[] = { 20 const char *_PyImport_DynLoadFiletab[] = {
19 #ifdef _DEBUG 21 #ifdef _DEBUG
20 "_d.pyd", 22 "_d.pyd",
21 #else 23 #else
22 ".pyd", 24 ".pyd",
23 #endif 25 #endif
24 NULL 26 NULL
25 }; 27 };
26 28
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 186
185 wpathname = PyUnicode_AsUnicode(pathname); 187 wpathname = PyUnicode_AsUnicode(pathname);
186 if (wpathname == NULL) 188 if (wpathname == NULL)
187 return NULL; 189 return NULL;
188 190
189 PyOS_snprintf(funcname, sizeof(funcname), "PyInit_%.200s", shortname); 191 PyOS_snprintf(funcname, sizeof(funcname), "PyInit_%.200s", shortname);
190 192
191 { 193 {
192 HINSTANCE hDLL = NULL; 194 HINSTANCE hDLL = NULL;
193 unsigned int old_mode; 195 unsigned int old_mode;
196 #if HAVE_SXS
194 ULONG_PTR cookie = 0; 197 ULONG_PTR cookie = 0;
198 #endif
195 199
196 /* Don't display a message box when Python can't load a DLL */ 200 /* Don't display a message box when Python can't load a DLL */
197 old_mode = SetErrorMode(SEM_FAILCRITICALERRORS); 201 old_mode = SetErrorMode(SEM_FAILCRITICALERRORS);
198 202
203 #if HAVE_SXS
199 cookie = _Py_ActivateActCtx(); 204 cookie = _Py_ActivateActCtx();
205 #endif
200 /* We use LoadLibraryEx so Windows looks for dependent DLLs 206 /* We use LoadLibraryEx so Windows looks for dependent DLLs
201 in directory of pathname first. */ 207 in directory of pathname first. */
202 /* XXX This call doesn't exist in Windows CE */ 208 /* XXX This call doesn't exist in Windows CE */
203 hDLL = LoadLibraryExW(wpathname, NULL, 209 hDLL = LoadLibraryExW(wpathname, NULL,
204 LOAD_WITH_ALTERED_SEARCH_PATH); 210 LOAD_WITH_ALTERED_SEARCH_PATH);
211 #if HAVE_SXS
205 _Py_DeactivateActCtx(cookie); 212 _Py_DeactivateActCtx(cookie);
213 #endif
206 214
207 /* restore old error mode settings */ 215 /* restore old error mode settings */
208 SetErrorMode(old_mode); 216 SetErrorMode(old_mode);
209 217
210 if (hDLL==NULL){ 218 if (hDLL==NULL){
211 PyObject *message; 219 PyObject *message;
212 unsigned int errorCode; 220 unsigned int errorCode;
213 221
214 /* Get an error string from Win32 error code */ 222 /* Get an error string from Win32 error code */
215 wchar_t theInfo[256]; /* Pointer to error text 223 wchar_t theInfo[256]; /* Pointer to error text
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 import_python); 287 import_python);
280 FreeLibrary(hDLL); 288 FreeLibrary(hDLL);
281 return NULL; 289 return NULL;
282 } 290 }
283 } 291 }
284 p = GetProcAddress(hDLL, funcname); 292 p = GetProcAddress(hDLL, funcname);
285 } 293 }
286 294
287 return p; 295 return p;
288 } 296 }
OLDNEW
« no previous file with comments | « PC/pyconfig.h ('k') | Tools/buildbot/build-amd64.bat » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7