Commit d218dc15 authored by Martin v. Löwis's avatar Martin v. Löwis

Merged revisions 62177-62178,62180-62193 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r62177 | skip.montanaro | 2008-04-05 21:47:47 +0200 (Sa, 05 Apr 2008) | 2 lines

  Declare inittimezone static.
........
  r62180 | mark.hammond | 2008-04-06 03:42:06 +0200 (So, 06 Apr 2008) | 4 lines

  From issue 1753245 - better _winreg support for x64.
  Adds _winreg.DisableReflectionKey, EnableReflectionKey, QueryReflectionKey,
  KEY_WOW64_64KEY and KEY_WOW64_32KEY.
........
  r62187 | skip.montanaro | 2008-04-06 19:05:57 +0200 (So, 06 Apr 2008) | 1 line

  type
........
  r62193 | trent.nelson | 2008-04-06 22:51:23 +0200 (So, 06 Apr 2008) | 1 line

  Don't run kill_python as part of the build process.  Change the buildbots so they have to call it explicitly instead.
........
parent e9edcc40
...@@ -661,7 +661,7 @@ Convert a time tuple in local time to seconds since the Epoch."); ...@@ -661,7 +661,7 @@ Convert a time tuple in local time to seconds since the Epoch.");
#endif /* HAVE_MKTIME */ #endif /* HAVE_MKTIME */
#ifdef HAVE_WORKING_TZSET #ifdef HAVE_WORKING_TZSET
void inittimezone(PyObject *module); static void inittimezone(PyObject *module);
static PyObject * static PyObject *
time_tzset(PyObject *self, PyObject *unused) time_tzset(PyObject *self, PyObject *unused)
...@@ -697,11 +697,12 @@ the local timezone used by methods such as localtime, but this behaviour\n\ ...@@ -697,11 +697,12 @@ the local timezone used by methods such as localtime, but this behaviour\n\
should not be relied on."); should not be relied on.");
#endif /* HAVE_WORKING_TZSET */ #endif /* HAVE_WORKING_TZSET */
void inittimezone(PyObject *m) { static void
inittimezone(PyObject *m) {
/* This code moved from inittime wholesale to allow calling it from /* This code moved from inittime wholesale to allow calling it from
time_tzset. In the future, some parts of it can be moved back time_tzset. In the future, some parts of it can be moved back
(for platforms that don't HAVE_WORKING_TZSET, when we know what they (for platforms that don't HAVE_WORKING_TZSET, when we know what they
are), and the extranious calls to tzset(3) should be removed. are), and the extraneous calls to tzset(3) should be removed.
I haven't done this yet, as I don't want to change this code as I haven't done this yet, as I don't want to change this code as
little as possible when introducing the time.tzset and time.tzsetwall little as possible when introducing the time.tzset and time.tzsetwall
methods. This should simply be a method of doing the following once, methods. This should simply be a method of doing the following once,
......
...@@ -289,6 +289,22 @@ PyDoc_STRVAR(SetValueEx_doc, ...@@ -289,6 +289,22 @@ PyDoc_STRVAR(SetValueEx_doc,
"2048 bytes) should be stored as files with the filenames stored in \n" "2048 bytes) should be stored as files with the filenames stored in \n"
"the configuration registry. This helps the registry perform efficiently."); "the configuration registry. This helps the registry perform efficiently.");
PyDoc_STRVAR(DisableReflectionKey_doc,
"Disables registry reflection for 32bit processes running on a 64bit\n"
"Operating System. Will generally raise NotImplemented if executed on\n"
"a 32bit Operating System.\n"
"If the key is not on the reflection list, the function succeeds but has no effect.\n"
"Disabling reflection for a key does not affect reflection of any subkeys.");
PyDoc_STRVAR(EnableReflectionKey_doc,
"Restores registry reflection for the specified disabled key.\n"
"Will generally raise NotImplemented if executed on a 32bit Operating System.\n"
"Restoring reflection for a key does not affect reflection of any subkeys.");
PyDoc_STRVAR(QueryReflectionKey_doc,
"bool = QueryReflectionKey(hkey) - Determines the reflection state for the specified key.\n"
"Will generally raise NotImplemented if executed on a 32bit Operating System.\n");
/* PyHKEY docstrings */ /* PyHKEY docstrings */
PyDoc_STRVAR(PyHKEY_doc, PyDoc_STRVAR(PyHKEY_doc,
"PyHKEY Object - A Python object, representing a win32 registry key.\n" "PyHKEY Object - A Python object, representing a win32 registry key.\n"
...@@ -1393,12 +1409,122 @@ PySetValueEx(PyObject *self, PyObject *args) ...@@ -1393,12 +1409,122 @@ PySetValueEx(PyObject *self, PyObject *args)
return Py_None; return Py_None;
} }
static PyObject *
PyDisableReflectionKey(PyObject *self, PyObject *args)
{
HKEY hKey;
PyObject *obKey;
HMODULE hMod;
typedef LONG (WINAPI *RDRKFunc)(HKEY);
RDRKFunc pfn = NULL;
LONG rc;
if (!PyArg_ParseTuple(args, "O:DisableReflectionKey", &obKey))
return NULL;
if (!PyHKEY_AsHKEY(obKey, &hKey, FALSE))
return NULL;
// Only available on 64bit platforms, so we must load it
// dynamically.
hMod = GetModuleHandle("advapi32.dll");
if (hMod)
pfn = (RDRKFunc)GetProcAddress(hMod,
"RegDisableReflectionKey");
if (!pfn) {
PyErr_SetString(PyExc_NotImplementedError,
"not implemented on this platform");
return NULL;
}
Py_BEGIN_ALLOW_THREADS
rc = (*pfn)(hKey);
Py_END_ALLOW_THREADS
if (rc != ERROR_SUCCESS)
return PyErr_SetFromWindowsErrWithFunction(rc,
"RegDisableReflectionKey");
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *
PyEnableReflectionKey(PyObject *self, PyObject *args)
{
HKEY hKey;
PyObject *obKey;
HMODULE hMod;
typedef LONG (WINAPI *RERKFunc)(HKEY);
RERKFunc pfn = NULL;
LONG rc;
if (!PyArg_ParseTuple(args, "O:EnableReflectionKey", &obKey))
return NULL;
if (!PyHKEY_AsHKEY(obKey, &hKey, FALSE))
return NULL;
// Only available on 64bit platforms, so we must load it
// dynamically.
hMod = GetModuleHandle("advapi32.dll");
if (hMod)
pfn = (RERKFunc)GetProcAddress(hMod,
"RegEnableReflectionKey");
if (!pfn) {
PyErr_SetString(PyExc_NotImplementedError,
"not implemented on this platform");
return NULL;
}
Py_BEGIN_ALLOW_THREADS
rc = (*pfn)(hKey);
Py_END_ALLOW_THREADS
if (rc != ERROR_SUCCESS)
return PyErr_SetFromWindowsErrWithFunction(rc,
"RegEnableReflectionKey");
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *
PyQueryReflectionKey(PyObject *self, PyObject *args)
{
HKEY hKey;
PyObject *obKey;
HMODULE hMod;
typedef LONG (WINAPI *RQRKFunc)(HKEY, BOOL *);
RQRKFunc pfn = NULL;
BOOL result;
LONG rc;
if (!PyArg_ParseTuple(args, "O:QueryReflectionKey", &obKey))
return NULL;
if (!PyHKEY_AsHKEY(obKey, &hKey, FALSE))
return NULL;
// Only available on 64bit platforms, so we must load it
// dynamically.
hMod = GetModuleHandle("advapi32.dll");
if (hMod)
pfn = (RQRKFunc)GetProcAddress(hMod,
"RegQueryReflectionKey");
if (!pfn) {
PyErr_SetString(PyExc_NotImplementedError,
"not implemented on this platform");
return NULL;
}
Py_BEGIN_ALLOW_THREADS
rc = (*pfn)(hKey, &result);
Py_END_ALLOW_THREADS
if (rc != ERROR_SUCCESS)
return PyErr_SetFromWindowsErrWithFunction(rc,
"RegQueryReflectionKey");
return PyBool_FromLong(rc);
}
static struct PyMethodDef winreg_methods[] = { static struct PyMethodDef winreg_methods[] = {
{"CloseKey", PyCloseKey, METH_VARARGS, CloseKey_doc}, {"CloseKey", PyCloseKey, METH_VARARGS, CloseKey_doc},
{"ConnectRegistry", PyConnectRegistry, METH_VARARGS, ConnectRegistry_doc}, {"ConnectRegistry", PyConnectRegistry, METH_VARARGS, ConnectRegistry_doc},
{"CreateKey", PyCreateKey, METH_VARARGS, CreateKey_doc}, {"CreateKey", PyCreateKey, METH_VARARGS, CreateKey_doc},
{"DeleteKey", PyDeleteKey, METH_VARARGS, DeleteKey_doc}, {"DeleteKey", PyDeleteKey, METH_VARARGS, DeleteKey_doc},
{"DeleteValue", PyDeleteValue, METH_VARARGS, DeleteValue_doc}, {"DeleteValue", PyDeleteValue, METH_VARARGS, DeleteValue_doc},
{"DisableReflectionKey", PyDisableReflectionKey, METH_VARARGS, DisableReflectionKey_doc},
{"EnableReflectionKey", PyEnableReflectionKey, METH_VARARGS, EnableReflectionKey_doc},
{"EnumKey", PyEnumKey, METH_VARARGS, EnumKey_doc}, {"EnumKey", PyEnumKey, METH_VARARGS, EnumKey_doc},
{"EnumValue", PyEnumValue, METH_VARARGS, EnumValue_doc}, {"EnumValue", PyEnumValue, METH_VARARGS, EnumValue_doc},
{"ExpandEnvironmentStrings", PyExpandEnvironmentStrings, METH_VARARGS, {"ExpandEnvironmentStrings", PyExpandEnvironmentStrings, METH_VARARGS,
...@@ -1410,6 +1536,7 @@ static struct PyMethodDef winreg_methods[] = { ...@@ -1410,6 +1536,7 @@ static struct PyMethodDef winreg_methods[] = {
{"QueryValue", PyQueryValue, METH_VARARGS, QueryValue_doc}, {"QueryValue", PyQueryValue, METH_VARARGS, QueryValue_doc},
{"QueryValueEx", PyQueryValueEx, METH_VARARGS, QueryValueEx_doc}, {"QueryValueEx", PyQueryValueEx, METH_VARARGS, QueryValueEx_doc},
{"QueryInfoKey", PyQueryInfoKey, METH_VARARGS, QueryInfoKey_doc}, {"QueryInfoKey", PyQueryInfoKey, METH_VARARGS, QueryInfoKey_doc},
{"QueryReflectionKey",PyQueryReflectionKey,METH_VARARGS, QueryReflectionKey_doc},
{"SaveKey", PySaveKey, METH_VARARGS, SaveKey_doc}, {"SaveKey", PySaveKey, METH_VARARGS, SaveKey_doc},
{"SetValue", PySetValue, METH_VARARGS, SetValue_doc}, {"SetValue", PySetValue, METH_VARARGS, SetValue_doc},
{"SetValueEx", PySetValueEx, METH_VARARGS, SetValueEx_doc}, {"SetValueEx", PySetValueEx, METH_VARARGS, SetValueEx_doc},
...@@ -1478,6 +1605,12 @@ PyMODINIT_FUNC init_winreg(void) ...@@ -1478,6 +1605,12 @@ PyMODINIT_FUNC init_winreg(void)
ADD_INT(KEY_WRITE); ADD_INT(KEY_WRITE);
ADD_INT(KEY_EXECUTE); ADD_INT(KEY_EXECUTE);
ADD_INT(KEY_ALL_ACCESS); ADD_INT(KEY_ALL_ACCESS);
#ifdef KEY_WOW64_64KEY
ADD_INT(KEY_WOW64_64KEY);
#endif
#ifdef KEY_WOW64_32KEY
ADD_INT(KEY_WOW64_32KEY);
#endif
ADD_INT(REG_OPTION_RESERVED); ADD_INT(REG_OPTION_RESERVED);
ADD_INT(REG_OPTION_NON_VOLATILE); ADD_INT(REG_OPTION_NON_VOLATILE);
ADD_INT(REG_OPTION_VOLATILE); ADD_INT(REG_OPTION_VOLATILE);
......
...@@ -77,8 +77,6 @@ ...@@ -77,8 +77,6 @@
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
Description="Killing existing Python processes..."
CommandLine="&quot;$(KillPythonExe)&quot;"
/> />
</Configuration> </Configuration>
<Configuration <Configuration
...@@ -140,8 +138,6 @@ ...@@ -140,8 +138,6 @@
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
Description="Killing existing Python processes..."
CommandLine="&quot;$(KillPythonExe)&quot;"
/> />
</Configuration> </Configuration>
<Configuration <Configuration
...@@ -202,8 +198,6 @@ ...@@ -202,8 +198,6 @@
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
Description="Killing existing Python processes..."
CommandLine="&quot;$(KillPythonExe)&quot;"
/> />
</Configuration> </Configuration>
<Configuration <Configuration
...@@ -265,8 +259,6 @@ ...@@ -265,8 +259,6 @@
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
Description="Killing existing Python processes..."
CommandLine="&quot;$(KillPythonExe)&quot;"
/> />
</Configuration> </Configuration>
</Configurations> </Configurations>
......
...@@ -58,8 +58,8 @@ ...@@ -58,8 +58,8 @@
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
Description="Generate build information and kill existing Python processes..." Description="Generate build information..."
CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release&#x0D;&#x0A;&quot;$(KillPythonExe)&quot;" CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
...@@ -133,8 +133,8 @@ ...@@ -133,8 +133,8 @@
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
Description="Generate build information and kill existing Python processes..." Description="Generate build information..."
CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release&#x0D;&#x0A;&quot;$(KillPythonExe)&quot;" CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
...@@ -211,8 +211,8 @@ ...@@ -211,8 +211,8 @@
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
Description="Generate build information and kill existing Python processes..." Description="Generate build information..."
CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Debug&#x0D;&#x0A;&quot;$(KillPythonExe)&quot;" CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Debug"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
...@@ -289,8 +289,8 @@ ...@@ -289,8 +289,8 @@
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
Description="Generate build information and kill existing Python processes..." Description="Generate build information..."
CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Debug&#x0D;&#x0A;&quot;$(KillPythonExe)&quot;" CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Debug"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
...@@ -363,8 +363,8 @@ ...@@ -363,8 +363,8 @@
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
Description="Generate build information and kill existing Python processes..." Description="Generate build information..."
CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release&#x0D;&#x0A;&quot;$(KillPythonExe)&quot;" CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
...@@ -438,8 +438,8 @@ ...@@ -438,8 +438,8 @@
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
Description="Generate build information and kill existing Python processes..." Description="Generate build information..."
CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release&#x0D;&#x0A;&quot;$(KillPythonExe)&quot;" CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
...@@ -513,8 +513,8 @@ ...@@ -513,8 +513,8 @@
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
Description="Generate build information and kill existing Python processes..." Description="Generate build information..."
CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release&#x0D;&#x0A;&quot;$(KillPythonExe)&quot;" CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
...@@ -588,8 +588,8 @@ ...@@ -588,8 +588,8 @@
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
Description="Generate build information and kill existing Python processes..." Description="Generate build information..."
CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release&#x0D;&#x0A;&quot;$(KillPythonExe)&quot;" CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
......
...@@ -2,4 +2,5 @@ ...@@ -2,4 +2,5 @@
cmd /c Tools\buildbot\external-amd64.bat cmd /c Tools\buildbot\external-amd64.bat
call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64
cmd /c Tools\buildbot\clean-amd64.bat cmd /c Tools\buildbot\clean-amd64.bat
vcbuild /useenv PCbuild\kill_python.vcproj "Debug|x64" && PCbuild\amd64\kill_python_d.exe
vcbuild PCbuild\pcbuild.sln "Debug|x64" vcbuild PCbuild\pcbuild.sln "Debug|x64"
...@@ -2,5 +2,6 @@ ...@@ -2,5 +2,6 @@
cmd /c Tools\buildbot\external.bat cmd /c Tools\buildbot\external.bat
call "%VS90COMNTOOLS%vsvars32.bat" call "%VS90COMNTOOLS%vsvars32.bat"
cmd /c Tools\buildbot\clean.bat cmd /c Tools\buildbot\clean.bat
vcbuild /useenv PCbuild\kill_python.vcproj "Debug|Win32" && PCbuild\kill_python_d.exe
vcbuild /useenv PCbuild\pcbuild.sln "Debug|Win32" vcbuild /useenv PCbuild\pcbuild.sln "Debug|Win32"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment