Update of /cvsroot/pywin32/pywin32/win32/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15490/src
Modified Files:
Tag: py3k
PyACL.cpp PyDEVMODE.cpp PyHANDLE.cpp PyIID.cpp
PyLARGE_INTEGER.cpp PyOVERLAPPED.cpp PySECURITY_ATTRIBUTES.cpp
PySECURITY_DESCRIPTOR.cpp PySID.cpp PySecurityObjects.h
PyTime.cpp PyUnicode.cpp PyWAVEFORMATEX.cpp PyWinObjects.h
PyWinTypes.h PyWinTypesmodule.cpp PythonService.cpp
_win32sysloader.cpp dbi.cpp dbi.def mmapfilemodule.cpp
odbc.cpp stddde.h timermodule.cpp win2krasmodule.cpp
win32api_display.cpp win32api_display.h win32apimodule.cpp
win32clipboardmodule.cpp win32consolemodule.cpp
win32credmodule.cpp win32dynamicdialog.cpp
win32dynamicdialog.h win32event.i win32evtlog.i win32file.i
win32file_comm.cpp win32gui.i win32helpmodule.cpp win32job.i
win32lzmodule.cpp win32pdhmodule.cpp win32pipe.i
win32process.i win32profilemodule.cpp win32rasmodule.cpp
win32security.i win32security_sspi.cpp win32service.i
win32trace.cpp win32transactionmodule.cpp win32tsmodule.cpp
Log Message:
Changes to build for Python 3.0
Index: win32process.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32process.i,v
retrieving revision 1.33
retrieving revision 1.33.2.1
diff -C2 -d -r1.33 -r1.33.2.1
*** win32process.i 24 May 2008 00:29:55 -0000 1.33
--- win32process.i 29 Aug 2008 04:59:27 -0000 1.33.2.1
***************
*** 85,93 ****
static void deallocFunc(PyObject *ob);
! static PyObject *getattr(PyObject *self, char *name);
! static int setattr(PyObject *self, char *name, PyObject *v);
! #pragma warning( disable : 4251 )
! static struct memberlist memberlist[];
! #pragma warning( default : 4251 )
protected:
--- 85,91 ----
static void deallocFunc(PyObject *ob);
! static PyObject *getattro(PyObject *self, PyObject *obname);
! static int setattro(PyObject *self, PyObject *obname, PyObject *v);
! static struct PyMemberDef members[];
protected:
***************
*** 103,128 ****
PyTypeObject PySTARTUPINFOType =
{
! PyObject_HEAD_INIT(&PyType_Type)
! 0,
"PySTARTUPINFO",
sizeof(PySTARTUPINFO),
0,
PySTARTUPINFO::deallocFunc, /* tp_dealloc */
! 0, /* tp_print */
! PySTARTUPINFO::getattr, /* tp_getattr */
! PySTARTUPINFO::setattr, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
! 0, /* tp_as_sequence */
0, /* tp_as_mapping */
! 0,
0, /* tp_call */
! 0, /* tp_str */
};
#define OFF(e) offsetof(PySTARTUPINFO, e)
! /*static*/ struct memberlist PySTARTUPINFO::memberlist[] = {
{"dwX", T_INT, OFF(m_startupinfo.dwX)}, // @prop integer|dwX|Specifies the x offset, in pixels, of the upper left corner of a window if a new window is created. The offset is from the upper left corner of the screen.
{"dwY", T_INT, OFF(m_startupinfo.dwY)}, // @prop integer|dwY|Specifies the y offset, in pixels, of the upper left corner of a window if a new window is created. The offset is from the upper left corner of the screen.
--- 101,147 ----
PyTypeObject PySTARTUPINFOType =
{
! PYWIN_OBJECT_HEAD
"PySTARTUPINFO",
sizeof(PySTARTUPINFO),
0,
PySTARTUPINFO::deallocFunc, /* tp_dealloc */
! 0, /* tp_print */
! 0, /* tp_getattr */
! 0, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
! 0, /* tp_as_sequence */
0, /* tp_as_mapping */
! 0, /* tp_hash */
0, /* tp_call */
! 0, /* tp_str */
! PySTARTUPINFO::getattro, /* tp_getattr */
! PySTARTUPINFO::setattro, /* tp_setattr */
! 0, /*tp_as_buffer*/
! Py_TPFLAGS_DEFAULT, /* tp_flags */
! "A Python object, representing a STARTUPINFO structure", /* tp_doc */
! 0, /* tp_traverse */
! 0, /* tp_clear */
! 0, /* tp_richcompare */
! 0, /* tp_weaklistoffset */
! 0, /* tp_iter */
! 0, /* tp_iternext */
! 0, /* tp_methods */
! PySTARTUPINFO::members, /* tp_members */
! 0, /* tp_getset */
! 0, /* tp_base */
! 0, /* tp_dict */
! 0, /* tp_descr_get */
! 0, /* tp_descr_set */
! 0, /* tp_dictoffset */
! 0, /* tp_init */
! 0, /* tp_alloc */
! 0, /* tp_new */
};
#define OFF(e) offsetof(PySTARTUPINFO, e)
! /*static*/ struct PyMemberDef PySTARTUPINFO::members[] = {
{"dwX", T_INT, OFF(m_startupinfo.dwX)}, // @prop integer|dwX|Specifies the x offset, in pixels, of the upper left corner of a window if a new window is created. The offset is from the upper left corner of the screen.
{"dwY", T_INT, OFF(m_startupinfo.dwY)}, // @prop integer|dwY|Specifies the y offset, in pixels, of the upper left corner of a window if a new window is created. The offset is from the upper left corner of the screen.
***************
*** 154,159 ****
memcpy(&m_startupinfo, pSI, sizeof(m_startupinfo));
m_obStdIn = m_obStdOut = m_obStdErr = NULL;
! m_obDesktop = pSI->lpDesktop ? PyWinObject_FromTCHAR(pSI->lpDesktop) : NULL;
! m_obTitle = pSI->lpTitle ? PyWinObject_FromTCHAR(pSI->lpTitle) : NULL;
}
--- 173,180 ----
memcpy(&m_startupinfo, pSI, sizeof(m_startupinfo));
m_obStdIn = m_obStdOut = m_obStdErr = NULL;
! if (pSI->lpDesktop)
! m_startupinfo.lpDesktop = PyWin_CopyString(pSI->lpDesktop);
! if (pSI->lpTitle)
! m_startupinfo.lpTitle = PyWin_CopyString(pSI->lpTitle);
}
***************
*** 163,168 ****
Py_XDECREF(m_obStdOut);
Py_XDECREF(m_obStdErr);
! Py_XDECREF(m_obDesktop);
! Py_XDECREF(m_obTitle);
}
--- 184,189 ----
Py_XDECREF(m_obStdOut);
Py_XDECREF(m_obStdErr);
! PyWinObject_FreeTCHAR(m_startupinfo.lpDesktop);
! PyWinObject_FreeTCHAR(m_startupinfo.lpTitle);
}
***************
*** 176,182 ****
}
! PyObject *PySTARTUPINFO::getattr(PyObject *self, char *name)
{
PySTARTUPINFO *pO = (PySTARTUPINFO *)self;
// @prop integer/<o PyHANDLE>|hStdInput|
// @prop integer/<o PyHANDLE>|hStdOutput|
--- 197,206 ----
}
! PyObject *PySTARTUPINFO::getattro(PyObject *self, PyObject *obname)
{
PySTARTUPINFO *pO = (PySTARTUPINFO *)self;
+ char *name=PYWIN_ATTR_CONVERT(obname);
+ if (name == NULL)
+ return NULL;
// @prop integer/<o PyHANDLE>|hStdInput|
// @prop integer/<o PyHANDLE>|hStdOutput|
***************
*** 189,204 ****
return gethandle(pO->m_obStdErr, pO->m_startupinfo.hStdError);
// @prop string/None|lpDesktop|
! if (strcmp("lpDesktop", name)==0) {
! PyObject *rc = pO->m_obDesktop ? pO->m_obDesktop : Py_None;
! Py_INCREF(rc);
! return rc;
! }
// @prop string/None|lpTitle|
! if (strcmp("lpTitle", name)==0) {
! PyObject *rc = pO->m_obTitle ? pO->m_obTitle : Py_None;
! Py_INCREF(rc);
! return rc;
! }
! return PyMember_Get((char *)self, memberlist, name);
}
--- 213,222 ----
return gethandle(pO->m_obStdErr, pO->m_startupinfo.hStdError);
// @prop string/None|lpDesktop|
! if (strcmp("lpDesktop", name)==0)
! return PyWinObject_FromTCHAR(pO->m_startupinfo.lpDesktop);
// @prop string/None|lpTitle|
! if (strcmp("lpTitle", name)==0)
! return PyWinObject_FromTCHAR(pO->m_startupinfo.lpTitle);
! return PyObject_GenericGetAttr(self, obname);
}
***************
*** 219,223 ****
}
! int PySTARTUPINFO::setattr(PyObject *self, char *name, PyObject *v)
{
if (v == NULL) {
--- 237,241 ----
}
! int PySTARTUPINFO::setattro(PyObject *self, PyObject *obname, PyObject *v)
{
if (v == NULL) {
***************
*** 226,229 ****
--- 244,250 ----
}
PySTARTUPINFO *pO = (PySTARTUPINFO *)self;
+ char *name=PYWIN_ATTR_CONVERT(obname);
+ if (name == NULL)
+ return -1;
if (strcmp("hStdInput", name)==0)
return sethandle( &pO->m_obStdIn, &pO->m_startupinfo.hStdInput, v);
***************
*** 236,257 ****
if (strcmp("lpDesktop", name)==0) {
! if (PyWinObject_AsTCHAR(v, &pO->m_startupinfo.lpDesktop, TRUE)) {
! Py_XDECREF(pO->m_obDesktop);
! pO->m_obDesktop = v;
! Py_INCREF(v);
! return 0;
! } else
return -1;
! }
if (strcmp("lpTitle", name)==0) {
! if (PyWinObject_AsTCHAR(v, &pO->m_startupinfo.lpTitle, TRUE)) {
! Py_XDECREF(pO->m_obTitle);
! pO->m_obTitle = v;
! Py_INCREF(v);
! return 0;
! } else
return -1;
! }
! return PyMember_Set((char *)self, memberlist, name, v);
}
--- 257,277 ----
if (strcmp("lpDesktop", name)==0) {
! TCHAR *val;
! if (!PyWinObject_AsTCHAR(v, &val, TRUE))
return -1;
! PyWinObject_FreeTCHAR(pO->m_startupinfo.lpDesktop);
! pO->m_startupinfo.lpDesktop = val;
! return 0;
! }
!
if (strcmp("lpTitle", name)==0) {
! TCHAR *val;
! if (!PyWinObject_AsTCHAR(v, &val, TRUE))
return -1;
! PyWinObject_FreeTCHAR(pO->m_startupinfo.lpTitle);
! pO->m_startupinfo.lpTitle=val;
! return 0;
! }
! return PyObject_GenericSetAttr(self, obname, v);
}
***************
*** 1532,1535 ****
--- 1552,1561 ----
%init %{
+
+ #if (PY_VERSION_HEX >= 0x03000000)
+ if (PyType_Ready(&PySTARTUPINFOType) == -1)
+ return NULL;
+ #endif
+
FARPROC fp=NULL;
HMODULE hmodule=NULL;
***************
*** 1538,1546 ****
hmodule=LoadLibrary(_T("Psapi.dll"));
if (hmodule!=NULL){
! pfnEnumProcesses = (EnumProcessesfunc)GetProcAddress(hmodule, _T("EnumProcesses"));
! pfnEnumProcessModules = (EnumProcessModulesfunc)GetProcAddress(hmodule, _T("EnumProcessModules"));
! pfnGetModuleFileNameEx = (GetModuleFileNameExfunc)GetProcAddress(hmodule, _T("GetModuleFileNameExW"));
#ifndef MS_WINCE
! pfnGetProcessMemoryInfo = (GetProcessMemoryInfofunc)GetProcAddress(hmodule, _T("GetProcessMemoryInfo"));
#endif
}
--- 1564,1572 ----
hmodule=LoadLibrary(_T("Psapi.dll"));
if (hmodule!=NULL){
! pfnEnumProcesses = (EnumProcessesfunc)GetProcAddress(hmodule, "EnumProcesses");
! pfnEnumProcessModules = (EnumProcessModulesfunc)GetProcAddress(hmodule, "EnumProcessModules");
! pfnGetModuleFileNameEx = (GetModuleFileNameExfunc)GetProcAddress(hmodule, "GetModuleFileNameExW");
#ifndef MS_WINCE
! pfnGetProcessMemoryInfo = (GetProcessMemoryInfofunc)GetProcAddress(hmodule, "GetProcessMemoryInfo");
#endif
}
Index: win32trace.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32trace.cpp,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -C2 -d -r1.14 -r1.14.2.1
*** win32trace.cpp 18 May 2007 11:22:17 -0000 1.14
--- win32trace.cpp 29 Aug 2008 04:59:28 -0000 1.14.2.1
***************
*** 41,48 ****
const size_t BUFFER_SIZE = 0x20000; // Includes size integer.
! const char *MAP_OBJECT_NAME = "Global\\PythonTraceOutputMapping";
! const char *MUTEX_OBJECT_NAME = "Global\\PythonTraceOutputMutex";
! const char *EVENT_OBJECT_NAME = "Global\\PythonTraceOutputEvent";
! const char *EVENT_EMPTY_OBJECT_NAME = "Global\\PythonTraceOutputEmptyEvent";
// Global\\ etc goodness:
--- 41,48 ----
const size_t BUFFER_SIZE = 0x20000; // Includes size integer.
! const TCHAR *MAP_OBJECT_NAME = _T("Global\\PythonTraceOutputMapping");
! const TCHAR *MUTEX_OBJECT_NAME = _T("Global\\PythonTraceOutputMutex");
! const TCHAR *EVENT_OBJECT_NAME = _T("Global\\PythonTraceOutputEvent");
! const TCHAR *EVENT_EMPTY_OBJECT_NAME = _T("Global\\PythonTraceOutputEmptyEvent");
// Global\\ etc goodness:
***************
*** 72,79 ****
BOOL use_global_namespace = FALSE;
! static const char *FixupObjectName(const char *global_name)
{
if (!use_global_namespace)
! return strchr(global_name, '\\')+1;
// global prefix is ok.
return global_name;
--- 72,79 ----
BOOL use_global_namespace = FALSE;
! static const TCHAR *FixupObjectName(const TCHAR *global_name)
{
if (!use_global_namespace)
! return _tcschr(global_name, '\\')+1;
// global prefix is ok.
return global_name;
***************
*** 175,179 ****
static PyMethodDef PyTraceObject_methods[] = {
! {"blockingread", PyTraceObject_blockingread, METH_VARARGS}, // @pytmeth blockingread
{"read", PyTraceObject_read, METH_VARARGS }, // @pymeth read|
{"write", PyTraceObject_write, METH_VARARGS }, // @pymeth write|
--- 175,179 ----
static PyMethodDef PyTraceObject_methods[] = {
! {"blockingread", PyTraceObject_blockingread, METH_VARARGS}, // @pymeth blockingread
{"read", PyTraceObject_read, METH_VARARGS }, // @pymeth read|
{"write", PyTraceObject_write, METH_VARARGS }, // @pymeth write|
***************
*** 192,197 ****
static PyTypeObject PyTraceObjectType = {
! PyObject_HEAD_INIT(&PyType_Type)
! 0,
"PyTraceObject",
sizeof(PyTraceObject),
--- 192,196 ----
static PyTypeObject PyTraceObjectType = {
! PYWIN_OBJECT_HEAD
"PyTraceObject",
sizeof(PyTraceObject),
***************
*** 604,619 ****
};
! extern "C" __declspec(dllexport) void
! initwin32trace(void)
{
! PyWinGlobals_Ensure();
! PyObject *dict;
! PyObject* pModMe = Py_InitModule("win32trace", win32trace_functions);
! if (!pModMe) return;
! dict = PyModule_GetDict(pModMe);
! if (!dict) return;
! Py_INCREF(PyWinExc_ApiError);
! PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
// Allocate memory for the security descriptor.
--- 603,645 ----
};
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initwin32trace(void)
! #else
! PyObject *PyInit_win32trace(void)
! #endif
{
! PyObject *dict, *module;
! PyWinGlobals_Ensure();
! #if (PY_VERSION_HEX < 0x03000000)
! #define RETURN_ERROR return;
! module = Py_InitModule("win32trace", win32trace_functions);
! if (!module)
! return;
! dict = PyModule_GetDict(module);
! if (!dict)
! return;
! #else
! #define RETURN_ERROR return NULL;
! static PyModuleDef win32trace_def = {
! PyModuleDef_HEAD_INIT,
! "win32trace",
! "Interface to the Windows Console functions for dealing with character-mode applications.",
! -1,
! win32trace_functions
! };
! module = PyModule_Create(&win32trace_def);
! if (!module)
! return NULL;
! dict = PyModule_GetDict(module);
! if (!dict)
! return NULL;
! #endif
!
! if (PyType_Ready(&PyTraceObjectType) == -1)
! RETURN_ERROR;
! if (PyDict_SetItemString(dict, "error", PyWinExc_ApiError) == -1)
! RETURN_ERROR;
// Allocate memory for the security descriptor.
***************
*** 670,674 ****
if (hMutex==NULL) {
PyWin_SetAPIError("CreateMutex");
! return ;
}
assert (hEvent==NULL);
--- 696,700 ----
if (hMutex==NULL) {
PyWin_SetAPIError("CreateMutex");
! RETURN_ERROR ;
}
assert (hEvent==NULL);
***************
*** 676,680 ****
if (hEvent==NULL) {
PyWin_SetAPIError("CreateEvent");
! return ;
}
assert (hEventEmpty==NULL);
--- 702,706 ----
if (hEvent==NULL) {
PyWin_SetAPIError("CreateEvent");
! RETURN_ERROR;
}
assert (hEventEmpty==NULL);
***************
*** 682,686 ****
if (hEventEmpty==NULL) {
PyWin_SetAPIError("CreateEvent");
! return ;
}
}
--- 708,715 ----
if (hEventEmpty==NULL) {
PyWin_SetAPIError("CreateEvent");
! RETURN_ERROR ;
}
+ #if (PY_VERSION_HEX >= 0x03000000)
+ return module;
+ #endif
}
Index: PySECURITY_DESCRIPTOR.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PySECURITY_DESCRIPTOR.cpp,v
retrieving revision 1.19
retrieving revision 1.19.2.1
diff -C2 -d -r1.19 -r1.19.2.1
*** PySECURITY_DESCRIPTOR.cpp 24 May 2007 06:01:05 -0000 1.19
--- PySECURITY_DESCRIPTOR.cpp 29 Aug 2008 04:59:25 -0000 1.19.2.1
***************
*** 102,109 ****
if (!PyArg_ParseTuple(args, "O:SECURITY_DESCRIPTOR", &obsd))
return NULL;
! if (PyObject_AsReadBuffer(obsd, (const void **)&psd, &buf_len)==-1){
! PyErr_SetString(PyExc_TypeError,"Object has no data buffer");
return NULL;
- }
if (!IsValidSecurityDescriptor(psd)){
PyErr_SetString(PyExc_ValueError,"Data is not a valid security descriptor");
--- 102,107 ----
if (!PyArg_ParseTuple(args, "O:SECURITY_DESCRIPTOR", &obsd))
return NULL;
! if (PyObject_AsReadBuffer(obsd, (const void **)&psd, &buf_len)==-1)
return NULL;
if (!IsValidSecurityDescriptor(psd)){
PyErr_SetString(PyExc_ValueError,"Data is not a valid security descriptor");
***************
*** 680,684 ****
// @object PySECURITY_DESCRIPTOR|A Python object, representing a SECURITY_DESCRIPTOR structure
! static struct PyMethodDef PySECURITY_DESCRIPTOR_methods[] = {
{"Initialize", PySECURITY_DESCRIPTOR::Initialize, 1}, // @pymeth Initialize|Initializes the object.
{"GetSecurityDescriptorOwner", PySECURITY_DESCRIPTOR::GetSecurityDescriptorOwner, 1}, // @pymeth GetSecurityDescriptorOwner|Return the owner of the security descriptor. SID is returned.
--- 678,682 ----
// @object PySECURITY_DESCRIPTOR|A Python object, representing a SECURITY_DESCRIPTOR structure
! struct PyMethodDef PySECURITY_DESCRIPTOR::methods[] = {
{"Initialize", PySECURITY_DESCRIPTOR::Initialize, 1}, // @pymeth Initialize|Initializes the object.
{"GetSecurityDescriptorOwner", PySECURITY_DESCRIPTOR::GetSecurityDescriptorOwner, 1}, // @pymeth GetSecurityDescriptorOwner|Return the owner of the security descriptor. SID is returned.
***************
*** 699,702 ****
--- 697,721 ----
};
+ // Buffer interface in Python 3.0 has changed
+ #if (PY_VERSION_HEX < 0x03000000)
+ /*static*/ Py_ssize_t PySECURITY_DESCRIPTOR::getreadbuf(PyObject *self, Py_ssize_t index, void **ptr)
+ {
+ if ( index != 0 ) {
+ PyErr_SetString(PyExc_SystemError,
+ "accessing non-existent SID segment");
+ return -1;
+ }
+ PySECURITY_DESCRIPTOR *pysd = (PySECURITY_DESCRIPTOR *)self;
+ *ptr = pysd->m_psd;
+ return GetSecurityDescriptorLength(pysd->m_psd);
+ }
+
+ /*static*/ Py_ssize_t PySECURITY_DESCRIPTOR::getsegcount(PyObject *self, Py_ssize_t *lenp)
+ {
+ if ( lenp )
+ *lenp = GetSecurityDescriptorLength(((PySECURITY_DESCRIPTOR *)self)->m_psd);
+ return 1;
+ }
+
static PyBufferProcs PySECURITY_DESCRIPTOR_as_buffer = {
PySECURITY_DESCRIPTOR::getreadbuf,
***************
*** 706,739 ****
};
PYWINTYPES_EXPORT PyTypeObject PySECURITY_DESCRIPTORType =
{
! PyObject_HEAD_INIT(&PyType_Type)
! 0,
"PySECURITY_DESCRIPTOR",
sizeof(PySECURITY_DESCRIPTOR),
0,
PySECURITY_DESCRIPTOR::deallocFunc, /* tp_dealloc */
! 0, /* tp_print */
! PySECURITY_DESCRIPTOR::getattr, /* tp_getattr */
! PySECURITY_DESCRIPTOR::setattr, /* tp_setattr */
! 0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
! 0, /* tp_as_sequence */
0, /* tp_as_mapping */
! 0,
0, /* tp_call */
! 0, /* tp_str */
! 0, /*tp_getattro*/
! 0, /*tp_setattro*/
// @comm Note the PySECURITY_DESCRIPTOR object supports the buffer interface. Thus buffer(sd) can be used to obtain the raw bytes.
&PySECURITY_DESCRIPTOR_as_buffer, /*tp_as_buffer*/
};
- #define OFF(e) offsetof(PySECURITY_DESCRIPTOR, e)
-
- /*static*/ struct memberlist PySECURITY_DESCRIPTOR::memberlist[] = {
- {NULL} /* Sentinel */
- };
PySECURITY_DESCRIPTOR::PySECURITY_DESCRIPTOR(Py_ssize_t cb /*= 0*/)
--- 725,785 ----
};
+ #else // New buffer interface for Python 3.0
+ /*static*/ int PySECURITY_DESCRIPTOR::getbufferinfo(PyObject *self, Py_buffer *view, int flags)
+ {
+ PySECURITY_DESCRIPTOR *pysd = (PySECURITY_DESCRIPTOR *)self;
+ return PyBuffer_FillInfo(view, self, pysd->m_psd,
+ GetSecurityDescriptorLength(pysd->m_psd), 1, flags);
+ }
+
+ static PyBufferProcs PySECURITY_DESCRIPTOR_as_buffer = {
+ PySECURITY_DESCRIPTOR::getbufferinfo,
+ NULL // Don't need to release any memory from Py_buffer struct
+ };
+ #endif // PY_VERSION_HEX < 0x03000000
+
PYWINTYPES_EXPORT PyTypeObject PySECURITY_DESCRIPTORType =
{
! PYWIN_OBJECT_HEAD
"PySECURITY_DESCRIPTOR",
sizeof(PySECURITY_DESCRIPTOR),
0,
PySECURITY_DESCRIPTOR::deallocFunc, /* tp_dealloc */
! 0, /* tp_print */
! 0, /* tp_getattr */
! 0, /* tp_setattr */
! 0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
! 0, /* tp_as_sequence */
0, /* tp_as_mapping */
! 0, /* tp_hash */
0, /* tp_call */
! 0, /* tp_str */
! PyObject_GenericGetAttr, /* tp_getattro */
! PyObject_GenericSetAttr, /* tp_setattro */
// @comm Note the PySECURITY_DESCRIPTOR object supports the buffer interface. Thus buffer(sd) can be used to obtain the raw bytes.
&PySECURITY_DESCRIPTOR_as_buffer, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ PySECURITY_DESCRIPTOR::methods, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
};
PySECURITY_DESCRIPTOR::PySECURITY_DESCRIPTOR(Py_ssize_t cb /*= 0*/)
***************
*** 762,809 ****
}
- PyObject *PySECURITY_DESCRIPTOR::getattr(PyObject *self, char *name)
- {
- PyObject *res;
-
- res = Py_FindMethod(PySECURITY_DESCRIPTOR_methods, self, name);
- if (res != NULL)
- return res;
- PyErr_Clear();
- return PyMember_Get((char *)self, memberlist, name);
- }
-
- int PySECURITY_DESCRIPTOR::setattr(PyObject *self, char *name, PyObject *v)
- {
- if (v == NULL) {
- PyErr_SetString(PyExc_AttributeError, "can't delete SECURITY_DESCRIPTOR attributes");
- return -1;
- }
- return PyMember_Set((char *)self, memberlist, name, v);
- }
-
/*static*/ void PySECURITY_DESCRIPTOR::deallocFunc(PyObject *ob)
{
delete (PySECURITY_DESCRIPTOR *)ob;
}
-
- /*static*/ Py_ssize_t PySECURITY_DESCRIPTOR::getreadbuf(PyObject *self, Py_ssize_t index, void **ptr)
- {
- if ( index != 0 ) {
- PyErr_SetString(PyExc_SystemError,
- "accessing non-existent SID segment");
- return -1;
- }
- PySECURITY_DESCRIPTOR *pysd = (PySECURITY_DESCRIPTOR *)self;
- *ptr = pysd->m_psd;
- return GetSecurityDescriptorLength(pysd->m_psd);
- }
-
- /*static*/ Py_ssize_t PySECURITY_DESCRIPTOR::getsegcount(PyObject *self, Py_ssize_t *lenp)
- {
- if ( lenp )
- *lenp = GetSecurityDescriptorLength(((PySECURITY_DESCRIPTOR *)self)->m_psd);
- return 1;
- }
-
#else /* NO_PYWINTYPES_SECURITY */
--- 808,815 ----
Index: win32apimodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32apimodule.cpp,v
retrieving revision 1.89
retrieving revision 1.89.2.1
diff -C2 -d -r1.89 -r1.89.2.1
*** win32apimodule.cpp 10 Aug 2008 13:13:21 -0000 1.89
--- win32apimodule.cpp 29 Aug 2008 04:59:26 -0000 1.89.2.1
***************
*** 12,16 ****
******************************************************************/
- // #define UNICODE
#include "PyWinTypes.h"
#include "PyWinObjects.h"
--- 12,15 ----
***************
*** 22,25 ****
--- 21,25 ----
#define SECURITY_WIN32 // required by below
#include "security.h" // for GetUserNameEx
+ #include "PowrProf.h"
// Identical to PyW32_BEGIN_ALLOW_THREADS except no script "{" !!!
***************
*** 3789,3793 ****
DWORD nSubKeys, nValues;
FILETIME ft;
- PyObject *l;
// @pyparm <o PyHKEY>/int|key||An already open key, or or any one of the following win32con
--- 3789,3792 ----
***************
*** 3805,3813 ****
)!=ERROR_SUCCESS)
return ReturnAPIError("RegQueryInfoKey", rc);
! if (!(l=PyLong_FromTwoInts(ft.dwHighDateTime, ft.dwLowDateTime)))
! return NULL;
! PyObject *ret = Py_BuildValue("iiO",nSubKeys,nValues,l);
! Py_DECREF(l);
! return ret;
}
--- 3804,3808 ----
)!=ERROR_SUCCESS)
return ReturnAPIError("RegQueryInfoKey", rc);
! return Py_BuildValue("iiN",nSubKeys,nValues, PyWinObject_FromFILETIME(ft));
}
***************
*** 5456,5460 ****
ret = PyInt_AsLong(obRet);
// Exception instance to be raised.
! } else if (PyInstance_Check(obRet)) {
*ppExcType = obRet;
Py_INCREF(obRet);
--- 5451,5455 ----
ret = PyInt_AsLong(obRet);
// Exception instance to be raised.
! } else if (PyObject_IsSubclass(obRet, PyExc_Exception)) {
*ppExcType = obRet;
Py_INCREF(obRet);
***************
*** 5512,5516 ****
if (stateCur == NULL) stateCur = stateSave;
PyThreadState_Swap(stateCur);
! if (PyInstance_Check(exc_type)) {
if (exc_value != NULL)
PyErr_SetString(PyExc_TypeError, "instance exception returned from exception handler may not have a separate value");
--- 5507,5511 ----
if (stateCur == NULL) stateCur = stateSave;
PyThreadState_Swap(stateCur);
! if (PyObject_IsSubclass(exc_type, PyExc_Exception)) {
if (exc_value != NULL)
PyErr_SetString(PyExc_TypeError, "instance exception returned from exception handler may not have a separate value");
***************
*** 5518,5522 ****
// Normalize to class, instance
exc_value = exc_type;
! exc_type = (PyObject*) ((PyInstanceObject*)exc_type)->in_class;
Py_INCREF(exc_type);
PyErr_SetObject(exc_type, exc_value);
--- 5513,5517 ----
// Normalize to class, instance
exc_value = exc_type;
! exc_type = (PyObject *)exc_value->ob_type;
Py_INCREF(exc_type);
PyErr_SetObject(exc_type, exc_value);
***************
*** 5956,5959 ****
--- 5951,6008 ----
}
+ PyObject *PyWinObject_FromBATTERY_REPORTING_SCALE(PBATTERY_REPORTING_SCALE pbrs)
+ {
+ return Py_BuildValue("{s:N, s:N}",
+ "Granularity", PyLong_FromUnsignedLong(pbrs->Granularity),
+ "Capacity", PyLong_FromUnsignedLong(pbrs->Capacity));
+ }
+
+ /*
+ // @pymethod dict|win32api|GetPwrCapabilities|Retrieves system's power capabilities
+ // @pyseeapi GetPwrCapabilities
+ // @comm Requires Win2k or later.
+ // @rdesc Returns a dict representing a SYSTEM_POWER_CAPABILITIES struct
+ PyObject *PyGetPwrCapabilities(PyObject *self, PyObject *args)
+ {
+ SYSTEM_POWER_CAPABILITIES spc;
+ if (!GetPwrCapabilities(&spc))
+ return PyWin_SetAPIError("GetPwrCapabilities");
+ return Py_BuildValue(
+ "{s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N,"
+ " s:N, s:N, s:N, s:O, s:N, s:O, s:N, s:N, s:O, s:N, s:N, s:N, s:N, s:N}",
+ "PowerButtonPresent", PyBool_FromLong(spc.PowerButtonPresent),
+ "SleepButtonPresent", PyBool_FromLong(spc.SleepButtonPresent),
+ "LidPresent", PyBool_FromLong(spc.LidPresent),
+ "SystemS1", PyBool_FromLong(spc.SystemS1),
+ "SystemS2", PyBool_FromLong(spc.SystemS2),
+ "SystemS3", PyBool_FromLong(spc.SystemS3),
+ "SystemS4", PyBool_FromLong(spc.SystemS4),
+ "SystemS5", PyBool_FromLong(spc.SystemS5),
+ "HiberFilePresent", PyBool_FromLong(spc.HiberFilePresent),
+ "FullWake", PyBool_FromLong(spc.FullWake),
+ "VideoDimPresent", PyBool_FromLong(spc.VideoDimPresent),
+ "ApmPresent", PyBool_FromLong(spc.ApmPresent),
+ "UpsPresent", PyBool_FromLong(spc.UpsPresent),
+ "ThermalControl", PyBool_FromLong(spc.ThermalControl),
+ "ProcessorThrottle", PyBool_FromLong(spc.ProcessorThrottle),
+ "ProcessorMinThrottle", PyInt_FromLong(spc.ProcessorMinThrottle),
+ "ProcessorMaxThrottle", PyInt_FromLong(spc.ProcessorMaxThrottle),
+ "FastSystemS4", PyBool_FromLong(spc.FastSystemS4),
+ "spare2", Py_None, // reserved
+ "DiskSpinDown", PyBool_FromLong(spc.DiskSpinDown),
+ "spare3", Py_None, // reserved
+ "SystemBatteriesPresent", PyBool_FromLong(spc.SystemBatteriesPresent),
+ "BatteriesAreShortTerm", PyBool_FromLong(spc.BatteriesAreShortTerm),
+ "BatteryScale", Py_BuildValue("NNN",
+ PyWinObject_FromBATTERY_REPORTING_SCALE(&spc.BatteryScale[0]),
+ PyWinObject_FromBATTERY_REPORTING_SCALE(&spc.BatteryScale[1]),
+ PyWinObject_FromBATTERY_REPORTING_SCALE(&spc.BatteryScale[2])),
+ "AcOnLineWake", PyInt_FromLong(spc.AcOnLineWake),
+ "SoftLidWake", PyInt_FromLong(spc.SoftLidWake),
+ "RtcWake", PyInt_FromLong(spc.RtcWake),
+ "MinDeviceWakeState", PyInt_FromLong(spc.MinDeviceWakeState),
+ "DefaultLowLatencyWake", PyInt_FromLong(spc.DefaultLowLatencyWake));
+ }
+ */
/* List of functions exported by this module */
***************
*** 6054,6057 ****
--- 6103,6109 ----
{"GetModuleFileNameW", PyGetModuleFileNameW,1}, // @pymeth GetModuleFileNameW|Retrieves the unicode filename of the specified module.
{"GetModuleHandle", PyGetModuleHandle,1}, // @pymeth GetModuleHandle|Returns the handle of an already loaded DLL.
+
+ // {"GetPwrCapabilities", PyGetPwrCapabilities, METH_NOARGS}, // @pymeth GetPwrCapabilities|Retrieves system's power capabilities
+
{"GetProfileSection", PyGetProfileSection,1}, // @pymeth GetProfileSection|Returns a list of entries in an INI file.
{"GetProcAddress", PyGetProcAddress,1}, // @pymeth GetProcAddress|Returns the address of the specified exported dynamic-link library (DLL) function.
***************
*** 6190,6204 ****
};
! extern "C" __declspec(dllexport) void
! initwin32api(void)
{
! PyObject *dict, *module;
! PyWinGlobals_Ensure();
! module = Py_InitModule("win32api", win32api_functions);
! if (!module) /* Eeek - some serious error! */
! return;
! dict = PyModule_GetDict(module);
! if (!dict) return; /* Another serious error!*/
! Py_INCREF(PyWinExc_ApiError);
PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
PyDict_SetItemString(dict,"STD_INPUT_HANDLE",
--- 6242,6280 ----
};
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initwin32api(void)
! #else
! PyObject *PyInit_win32api(void)
! #endif
{
! PyObject *dict, *module;
! PyWinGlobals_Ensure();
!
! #if (PY_VERSION_HEX < 0x03000000)
! #define RETURN_ERROR return;
! module = Py_InitModule("win32api", win32api_functions);
! if (!module)
! return;
! dict = PyModule_GetDict(module);
! if (!dict)
! return;
! #else
! #define RETURN_ERROR return NULL;
! static PyModuleDef win32api_def = {
! PyModuleDef_HEAD_INIT,
! "win32api",
! "Wraps general API functions that are not subsumed in the more specific modules",
! -1,
! win32api_functions
! };
! module = PyModule_Create(&win32api_def);
! if (!module)
! return NULL;
! dict = PyModule_GetDict(module);
! if (!dict)
! return NULL;
! #endif
!
PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
PyDict_SetItemString(dict,"STD_INPUT_HANDLE",
***************
*** 6208,6212 ****
PyDict_SetItemString(dict,"STD_ERROR_HANDLE",
PyInt_FromLong(STD_ERROR_HANDLE));
! PyDict_SetItemString(dict, "PyDISPLAY_DEVICEType", (PyObject *)&PyDISPLAY_DEVICEType);
PyModule_AddIntConstant(module, "NameUnknown", NameUnknown);
PyModule_AddIntConstant(module, "NameFullyQualifiedDN", NameFullyQualifiedDN);
--- 6284,6293 ----
PyDict_SetItemString(dict,"STD_ERROR_HANDLE",
PyInt_FromLong(STD_ERROR_HANDLE));
!
! if (PyType_Ready(&PyDISPLAY_DEVICEType) == -1
! || PyDict_SetItemString(dict, "PyDISPLAY_DEVICEType", (PyObject *)&PyDISPLAY_DEVICEType) == -1)
! RETURN_ERROR;
!
!
PyModule_AddIntConstant(module, "NameUnknown", NameUnknown);
PyModule_AddIntConstant(module, "NameFullyQualifiedDN", NameFullyQualifiedDN);
***************
*** 6313,6315 ****
--- 6394,6399 ----
}
+ #if (PY_VERSION_HEX >= 0x03000000)
+ return module;
+ #endif
}
Index: win32evtlog.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32evtlog.i,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -C2 -d -r1.6 -r1.6.2.1
*** win32evtlog.i 15 Aug 2007 09:39:48 -0000 1.6
--- win32evtlog.i 29 Aug 2008 04:59:26 -0000 1.6.2.1
***************
*** 19,28 ****
static void deallocFunc(PyObject *ob);
!
! static PyObject *getattr(PyObject *self, char *name);
! static int setattr(PyObject *self, char *name, PyObject *v);
! //#pragma warning( disable : 4251 )
! static struct memberlist memberlist[];
! //#pragma warning( default : 4251 )
protected:
--- 19,23 ----
static void deallocFunc(PyObject *ob);
! static struct PyMemberDef members[];
protected:
***************
*** 54,79 ****
PyTypeObject PyEventLogRecordType =
{
! PyObject_HEAD_INIT(&PyType_Type)
! 0,
"PyEventLogRecord",
sizeof(PyEventLogRecord),
0,
PyEventLogRecord::deallocFunc, /* tp_dealloc */
! 0, /* tp_print */
! PyEventLogRecord::getattr, /* tp_getattr */
! PyEventLogRecord::setattr, /* tp_setattr */
! 0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
! 0, /* tp_as_sequence */
0, /* tp_as_mapping */
! 0,
0, /* tp_call */
! 0, /* tp_str */
};
#define OFF(e) offsetof(PyEventLogRecord, e)
! /*static*/ struct memberlist PyEventLogRecord::memberlist[] = {
{"Reserved", T_INT, OFF(Reserved)}, // @prop integer|Reserved|
{"RecordNumber", T_INT, OFF(RecordNumber)}, // @prop integer|RecordNumber|
--- 49,95 ----
PyTypeObject PyEventLogRecordType =
{
! PYWIN_OBJECT_HEAD
"PyEventLogRecord",
sizeof(PyEventLogRecord),
0,
PyEventLogRecord::deallocFunc, /* tp_dealloc */
! 0, /* tp_print */
! 0, /* tp_getattr */
! 0, /* tp_setattr */
! 0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
! 0, /* tp_as_sequence */
0, /* tp_as_mapping */
! 0, /* tp_hash */
0, /* tp_call */
! 0, /* tp_str */
! PyObject_GenericGetAttr, /* tp_getattro */
! PyObject_GenericSetAttr, /* tp_setattro */
! 0, /*tp_as_buffer*/
! Py_TPFLAGS_DEFAULT, /* tp_flags */
! 0, /* tp_doc */
! 0, /* tp_traverse */
! 0, /* tp_clear */
! 0, /* tp_richcompare */
! 0, /* tp_weaklistoffset */
! 0, /* tp_iter */
! 0, /* tp_iternext */
! 0, /* tp_methods */
! PyEventLogRecord::members, /* tp_members */
! 0, /* tp_getset */
! 0, /* tp_base */
! 0, /* tp_dict */
! 0, /* tp_descr_get */
! 0, /* tp_descr_set */
! 0, /* tp_dictoffset */
! 0, /* tp_init */
! 0, /* tp_alloc */
! 0, /* tp_new */
};
#define OFF(e) offsetof(PyEventLogRecord, e)
! /*static*/ struct PyMemberDef PyEventLogRecord::members[] = {
{"Reserved", T_INT, OFF(Reserved)}, // @prop integer|Reserved|
{"RecordNumber", T_INT, OFF(RecordNumber)}, // @prop integer|RecordNumber|
***************
*** 154,171 ****
}
- PyObject *PyEventLogRecord::getattr(PyObject *self, char *name)
- {
- return PyMember_Get((char *)self, memberlist, name);
- }
-
- int PyEventLogRecord::setattr(PyObject *self, char *name, PyObject *v)
- {
- if (v == NULL) {
- PyErr_SetString(PyExc_AttributeError, "can't delete EventLogRecord attributes");
- return -1;
- }
- return PyMember_Set((char *)self, memberlist, name, v);
- }
-
/*static*/ void PyEventLogRecord::deallocFunc(PyObject *ob)
{
--- 170,173 ----
Index: win32api_display.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32api_display.h,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -C2 -d -r1.3 -r1.3.2.1
*** win32api_display.h 6 Feb 2008 18:42:51 -0000 1.3
--- win32api_display.h 29 Aug 2008 04:59:26 -0000 1.3.2.1
***************
*** 43,55 ****
{
public:
- #ifdef _MSC_VER
- #pragma warning( disable : 4251 )
- #endif // _MSC_VER
static struct PyMemberDef members[];
static struct PyMethodDef methods[];
- #ifdef _MSC_VER
- #pragma warning( default : 4251 )
- #endif // _MSC_VER
-
static void deallocFunc(PyObject *ob);
PyDISPLAY_DEVICE(PDISPLAY_DEVICE);
--- 43,48 ----
Index: win32consolemodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32consolemodule.cpp,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -C2 -d -r1.13 -r1.13.2.1
*** win32consolemodule.cpp 25 Jul 2008 01:18:10 -0000 1.13
--- win32consolemodule.cpp 29 Aug 2008 04:59:26 -0000 1.13.2.1
***************
*** 149,154 ****
static PyTypeObject PySMALL_RECTType =
{
! PyObject_HEAD_INIT(&PyType_Type)
! 0,
"PySMALL_RECT",
sizeof(PySMALL_RECT),
--- 149,153 ----
static PyTypeObject PySMALL_RECTType =
{
! PYWIN_OBJECT_HEAD
"PySMALL_RECT",
sizeof(PySMALL_RECT),
***************
*** 169,173 ****
PyObject_GenericSetAttr, // tp_setattro
0, // tp_as_buffer;
! 0, // tp_flags;
"Wrapper for a SMALL_RECT struct. Create using PySMALL_RECTType(Left, Top, Right, Bottom)", // tp_doc
0, // traverseproc tp_traverse;
--- 168,172 ----
PyObject_GenericSetAttr, // tp_setattro
0, // tp_as_buffer;
! Py_TPFLAGS_DEFAULT, // tp_flags;
"Wrapper for a SMALL_RECT struct. Create using PySMALL_RECTType(Left, Top, Right, Bottom)", // tp_doc
0, // traverseproc tp_traverse;
***************
*** 212,216 ****
--- 211,219 ----
return NULL;
}
+ #if (PY_VERSION_HEX < 0x03000000)
return PyString_FromStringAndSize(buf,chars_printed);
+ #else
+ return PyUnicode_FromString(buf);
+ #endif
}
***************
*** 299,304 ****
static PyTypeObject PyCOORDType =
{
! PyObject_HEAD_INIT(&PyType_Type)
! 0,
"PyCOORD",
sizeof(PyCOORD),
--- 302,306 ----
static PyTypeObject PyCOORDType =
{
! PYWIN_OBJECT_HEAD
"PyCOORD",
sizeof(PyCOORD),
***************
*** 319,323 ****
PyObject_GenericSetAttr, // tp_setattro
0, // tp_as_buffer;
! 0, // tp_flags;
"Wrapper for a COORD struct. Create using PyCOORDType(X,Y)", // tp_doc
0, // traverseproc tp_traverse;
--- 321,325 ----
PyObject_GenericSetAttr, // tp_setattro
0, // tp_as_buffer;
! Py_TPFLAGS_DEFAULT, // tp_flags;
"Wrapper for a COORD struct. Create using PyCOORDType(X,Y)", // tp_doc
0, // traverseproc tp_traverse;
***************
*** 361,365 ****
--- 363,371 ----
return NULL;
}
+ #if (PY_VERSION_HEX < 0x03000000)
return PyString_FromStringAndSize(buf,chars_printed);
+ #else
+ return PyUnicode_FromString(buf);
+ #endif
}
***************
*** 486,490 ****
{
INPUT_RECORD *pir=&((PyINPUT_RECORD *)self)->input_record;
! char *name=PyString_AsString(obname);
if (name==NULL)
return NULL;
--- 492,496 ----
{
INPUT_RECORD *pir=&((PyINPUT_RECORD *)self)->input_record;
! char *name=PYWIN_ATTR_CONVERT(obname);
if (name==NULL)
return NULL;
***************
*** 535,539 ****
INPUT_RECORD *pir=&((PyINPUT_RECORD *)self)->input_record;
char *name;
! name=PyString_AsString(obname);
if (name==NULL)
return -1;
--- 541,545 ----
INPUT_RECORD *pir=&((PyINPUT_RECORD *)self)->input_record;
char *name;
! name=PYWIN_ATTR_CONVERT(obname);
if (name==NULL)
return -1;
***************
*** 555,558 ****
--- 561,565 ----
return -1;
}
+
#if (PY_VERSION_HEX < 0x02030000)
*dest_ptr=PyLong_AsUnsignedLong(obvalue);
***************
*** 608,613 ****
static PyTypeObject PyINPUT_RECORDType =
{
! PyObject_HEAD_INIT(&PyType_Type)
! 0,
"PyINPUT_RECORD",
sizeof(PyINPUT_RECORD),
--- 615,619 ----
static PyTypeObject PyINPUT_RECORDType =
{
! PYWIN_OBJECT_HEAD
"PyINPUT_RECORD",
sizeof(PyINPUT_RECORD),
***************
*** 628,632 ****
PyINPUT_RECORD::tp_setattro, // tp_setattro
0, // tp_as_buffer;
! 0, // tp_flags;
"Wrapper for a INPUT_RECORD struct. Create using PyINPUT_RECORDType(EventType)", // tp_doc
0, // traverseproc tp_traverse;
--- 634,638 ----
PyINPUT_RECORD::tp_setattro, // tp_setattro
0, // tp_as_buffer;
! Py_TPFLAGS_DEFAULT, // tp_flags;
"Wrapper for a INPUT_RECORD struct. Create using PyINPUT_RECORDType(EventType)", // tp_doc
0, // traverseproc tp_traverse;
***************
*** 749,753 ****
--- 755,763 ----
return NULL;
}
+ #if (PY_VERSION_HEX < 0x03000000)
return PyString_FromStringAndSize(buf,chars_printed);
+ #else
+ return PyUnicode_FromString(buf);
+ #endif
}
***************
*** 1516,1521 ****
PyTypeObject PyConsoleScreenBufferType =
{
! PyObject_HEAD_INIT(&PyType_Type)
! 0,
"PyConsoleScreenBuffer",
sizeof(PyConsoleScreenBuffer),
--- 1526,1530 ----
PyTypeObject PyConsoleScreenBufferType =
{
! PYWIN_OBJECT_HEAD
"PyConsoleScreenBuffer",
sizeof(PyConsoleScreenBuffer),
***************
*** 1536,1540 ****
PyObject_GenericSetAttr, // tp_setattro
0, // tp_as_buffer
! 0, // tp_flags
"Handle to a console screen buffer.\nCreate using CreateConsoleScreenBuffer or PyConsoleScreenBufferType(Handle)", // tp_doc
0, // tp_traverse
--- 1545,1549 ----
PyObject_GenericSetAttr, // tp_setattro
0, // tp_as_buffer
! Py_TPFLAGS_DEFAULT, // tp_flags
"Handle to a console screen buffer.\nCreate using CreateConsoleScreenBuffer or PyConsoleScreenBufferType(Handle)", // tp_doc
0, // tp_traverse
***************
*** 2056,2065 ****
! extern "C" __declspec(dllexport) void
! initwin32console(void)
{
! PyObject *dict, *mod;
PyWinGlobals_Ensure();
! mod = Py_InitModule("win32console", win32console_functions);
// load function pointers
--- 2065,2106 ----
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initwin32console(void)
! #else
! PyObject *PyInit_win32console(void)
! #endif
{
! PyObject *dict, *module;
PyWinGlobals_Ensure();
!
! #if (PY_VERSION_HEX < 0x03000000)
! #define RETURN_ERROR return;
! module = Py_InitModule("win32console", win32console_functions);
! if (!module)
! return;
! dict = PyModule_GetDict(module);
! if (!dict)
! return;
! #else
!
! #define RETURN_ERROR return NULL;
! static PyModuleDef win32console_def = {
! PyModuleDef_HEAD_INIT,
! "win32console",
! "Interface to the Windows Console functions for dealing with character-mode applications.",
! -1,
! win32console_functions
! };
! module = PyModule_Create(&win32console_def);
! if (!module)
! return NULL;
! dict = PyModule_GetDict(module);
! if (!dict)
! return NULL;
! #endif
!
! Py_INCREF(PyWinExc_ApiError);
! PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
// load function pointers
***************
*** 2085,2153 ****
}
- dict = PyModule_GetDict(mod);
- Py_INCREF(PyWinExc_ApiError);
- PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
- PyDict_SetItemString(dict, "PyConsoleScreenBufferType", (PyObject *)&PyConsoleScreenBufferType);
- PyDict_SetItemString(dict, "PySMALL_RECTType", (PyObject *)&PySMALL_RECTType);
- PyDict_SetItemString(dict, "PyCOORDType", (PyObject *)&PyCOORDType);
- PyDict_SetItemString(dict, "PyINPUT_RECORDType", (PyObject *)&PyINPUT_RECORDType);
- PyModule_AddIntConstant(mod, "CONSOLE_TEXTMODE_BUFFER", CONSOLE_TEXTMODE_BUFFER);
- PyModule_AddIntConstant(mod, "CONSOLE_FULLSCREEN", CONSOLE_FULLSCREEN);
- PyModule_AddIntConstant(mod, "CONSOLE_FULLSCREEN_HARDWARE", CONSOLE_FULLSCREEN_HARDWARE);
- PyModule_AddIntConstant(mod, "ATTACH_PARENT_PROCESS", ATTACH_PARENT_PROCESS);
! PyModule_AddIntConstant(mod, "ENABLE_LINE_INPUT", ENABLE_LINE_INPUT);
! PyModule_AddIntConstant(mod, "ENABLE_ECHO_INPUT", ENABLE_ECHO_INPUT);
! PyModule_AddIntConstant(mod, "ENABLE_PROCESSED_INPUT", ENABLE_PROCESSED_INPUT);
! PyModule_AddIntConstant(mod, "ENABLE_WINDOW_INPUT", ENABLE_WINDOW_INPUT);
! PyModule_AddIntConstant(mod, "ENABLE_MOUSE_INPUT", ENABLE_MOUSE_INPUT);
! PyModule_AddIntConstant(mod, "ENABLE_PROCESSED_OUTPUT", ENABLE_PROCESSED_OUTPUT);
! PyModule_AddIntConstant(mod, "ENABLE_WRAP_AT_EOL_OUTPUT", ENABLE_WRAP_AT_EOL_OUTPUT);
// text attribute flags - ?????? COMMON_* flags don't seem to do anything ??????
! PyModule_AddIntConstant(mod, "FOREGROUND_BLUE", FOREGROUND_BLUE);
! PyModule_AddIntConstant(mod, "FOREGROUND_GREEN", FOREGROUND_GREEN);
! PyModule_AddIntConstant(mod, "FOREGROUND_RED", FOREGROUND_RED);
! PyModule_AddIntConstant(mod, "FOREGROUND_INTENSITY", FOREGROUND_INTENSITY);
! PyModule_AddIntConstant(mod, "BACKGROUND_BLUE", BACKGROUND_BLUE);
! PyModule_AddIntConstant(mod, "BACKGROUND_GREEN", BACKGROUND_GREEN);
! PyModule_AddIntConstant(mod, "BACKGROUND_RED", BACKGROUND_RED);
! PyModule_AddIntConstant(mod, "BACKGROUND_INTENSITY", BACKGROUND_INTENSITY);
! PyModule_AddIntConstant(mod, "COMMON_LVB_LEADING_BYTE", COMMON_LVB_LEADING_BYTE);
! PyModule_AddIntConstant(mod, "COMMON_LVB_TRAILING_BYTE", COMMON_LVB_TRAILING_BYTE);
! PyModule_AddIntConstant(mod, "COMMON_LVB_GRID_HORIZONTAL", COMMON_LVB_GRID_HORIZONTAL);
! PyModule_AddIntConstant(mod, "COMMON_LVB_GRID_LVERTICAL", COMMON_LVB_GRID_LVERTICAL);
! PyModule_AddIntConstant(mod, "COMMON_LVB_GRID_RVERTICAL", COMMON_LVB_GRID_RVERTICAL);
! PyModule_AddIntConstant(mod, "COMMON_LVB_REVERSE_VIDEO", COMMON_LVB_REVERSE_VIDEO);
! PyModule_AddIntConstant(mod, "COMMON_LVB_UNDERSCORE", COMMON_LVB_UNDERSCORE);
// selection flags for GetConsoleSelectionInfo
! PyModule_AddIntConstant(mod, "CONSOLE_NO_SELECTION", CONSOLE_NO_SELECTION);
! PyModule_AddIntConstant(mod, "CONSOLE_SELECTION_IN_PROGRESS", CONSOLE_SELECTION_IN_PROGRESS);
! PyModule_AddIntConstant(mod, "CONSOLE_SELECTION_NOT_EMPTY", CONSOLE_SELECTION_NOT_EMPTY);
! PyModule_AddIntConstant(mod, "CONSOLE_MOUSE_SELECTION", CONSOLE_MOUSE_SELECTION);
! PyModule_AddIntConstant(mod, "CONSOLE_MOUSE_DOWN", CONSOLE_MOUSE_DOWN);
! PyModule_AddIntConstant(mod, "LOCALE_USER_DEFAULT", LOCALE_USER_DEFAULT);
// event types for INPUT_RECORD
! PyModule_AddIntConstant(mod, "KEY_EVENT", KEY_EVENT);
! PyModule_AddIntConstant(mod, "MOUSE_EVENT", MOUSE_EVENT);
! PyModule_AddIntConstant(mod, "WINDOW_BUFFER_SIZE_EVENT", WINDOW_BUFFER_SIZE_EVENT);
! PyModule_AddIntConstant(mod, "MENU_EVENT", MENU_EVENT);
! PyModule_AddIntConstant(mod, "FOCUS_EVENT", FOCUS_EVENT);
// Control events for GenerateConsoleCtrlEvent
! PyModule_AddIntConstant(mod, "CTRL_C_EVENT", CTRL_C_EVENT);
! PyModule_AddIntConstant(mod, "CTRL_BREAK_EVENT", CTRL_BREAK_EVENT);
// std handles
! PyModule_AddIntConstant(mod, "STD_INPUT_HANDLE", STD_INPUT_HANDLE);
! PyModule_AddIntConstant(mod, "STD_OUTPUT_HANDLE", STD_OUTPUT_HANDLE);
! PyModule_AddIntConstant(mod, "STD_ERROR_HANDLE", STD_ERROR_HANDLE);
// flags used with SetConsoleDisplayMode
// ?????? these aren't in my SDK headers
! PyModule_AddIntConstant(mod, "CONSOLE_FULLSCREEN_MODE", 1);
! PyModule_AddIntConstant(mod, "CONSOLE_WINDOWED_MODE", 2);
}
--- 2126,2212 ----
}
! if (PyType_Ready(&PyConsoleScreenBufferType)==-1)
! RETURN_ERROR;
! if (PyDict_SetItemString(dict, "PyConsoleScreenBufferType", (PyObject *)&PyConsoleScreenBufferType) == -1)
! RETURN_ERROR;
!
! if (PyType_Ready(&PySMALL_RECTType)==-1)
! RETURN_ERROR;
! if (PyDict_SetItemString(dict, "PySMALL_RECTType", (PyObject *)&PySMALL_RECTType) == -1)
! RETURN_ERROR;
!
! if (PyType_Ready(&PyCOORDType)==-1)
! RETURN_ERROR;
! if (PyDict_SetItemString(dict, "PyCOORDType", (PyObject *)&PyCOORDType) == -1)
! RETURN_ERROR;
!
! if (PyType_Ready(&PyINPUT_RECORDType)==-1)
! RETURN_ERROR;
! if (PyDict_SetItemString(dict, "PyINPUT_RECORDType", (PyObject *)&PyINPUT_RECORDType) == -1)
! RETURN_ERROR;
!
! PyModule_AddIntConstant(module, "CONSOLE_TEXTMODE_BUFFER", CONSOLE_TEXTMODE_BUFFER);
! PyModule_AddIntConstant(module, "CONSOLE_FULLSCREEN", CONSOLE_FULLSCREEN);
! PyModule_AddIntConstant(module, "CONSOLE_FULLSCREEN_HARDWARE", CONSOLE_FULLSCREEN_HARDWARE);
! PyModule_AddIntConstant(module, "ATTACH_PARENT_PROCESS", ATTACH_PARENT_PROCESS);
!
! PyModule_AddIntConstant(module, "ENABLE_LINE_INPUT", ENABLE_LINE_INPUT);
! PyModule_AddIntConstant(module, "ENABLE_ECHO_INPUT", ENABLE_ECHO_INPUT);
! PyModule_AddIntConstant(module, "ENABLE_PROCESSED_INPUT", ENABLE_PROCESSED_INPUT);
! PyModule_AddIntConstant(module, "ENABLE_WINDOW_INPUT", ENABLE_WINDOW_INPUT);
! PyModule_AddIntConstant(module, "ENABLE_MOUSE_INPUT", ENABLE_MOUSE_INPUT);
! PyModule_AddIntConstant(module, "ENABLE_PROCESSED_OUTPUT", ENABLE_PROCESSED_OUTPUT);
! PyModule_AddIntConstant(module, "ENABLE_WRAP_AT_EOL_OUTPUT", ENABLE_WRAP_AT_EOL_OUTPUT);
// text attribute flags - ?????? COMMON_* flags don't seem to do anything ??????
! PyModule_AddIntConstant(module, "FOREGROUND_BLUE", FOREGROUND_BLUE);
! PyModule_AddIntConstant(module, "FOREGROUND_GREEN", FOREGROUND_GREEN);
! PyModule_AddIntConstant(module, "FOREGROUND_RED", FOREGROUND_RED);
! PyModule_AddIntConstant(module, "FOREGROUND_INTENSITY", FOREGROUND_INTENSITY);
! PyModule_AddIntConstant(module, "BACKGROUND_BLUE", BACKGROUND_BLUE);
! PyModule_AddIntConstant(module, "BACKGROUND_GREEN", BACKGROUND_GREEN);
! PyModule_AddIntConstant(module, "BACKGROUND_RED", BACKGROUND_RED);
! PyModule_AddIntConstant(module, "BACKGROUND_INTENSITY", BACKGROUND_INTENSITY);
! PyModule_AddIntConstant(module, "COMMON_LVB_LEADING_BYTE", COMMON_LVB_LEADING_BYTE);
! PyModule_AddIntConstant(module, "COMMON_LVB_TRAILING_BYTE", COMMON_LVB_TRAILING_BYTE);
! PyModule_AddIntConstant(module, "COMMON_LVB_GRID_HORIZONTAL", COMMON_LVB_GRID_HORIZONTAL);
! PyModule_AddIntConstant(module, "COMMON_LVB_GRID_LVERTICAL", COMMON_LVB_GRID_LVERTICAL);
! PyModule_AddIntConstant(module, "COMMON_LVB_GRID_RVERTICAL", COMMON_LVB_GRID_RVERTICAL);
! PyModule_AddIntConstant(module, "COMMON_LVB_REVERSE_VIDEO", COMMON_LVB_REVERSE_VIDEO);
! PyModule_AddIntConstant(module, "COMMON_LVB_UNDERSCORE", COMMON_LVB_UNDERSCORE);
// selection flags for GetConsoleSelectionInfo
! PyModule_AddIntConstant(module, "CONSOLE_NO_SELECTION", CONSOLE_NO_SELECTION);
! PyModule_AddIntConstant(module, "CONSOLE_SELECTION_IN_PROGRESS", CONSOLE_SELECTION_IN_PROGRESS);
! PyModule_AddIntConstant(module, "CONSOLE_SELECTION_NOT_EMPTY", CONSOLE_SELECTION_NOT_EMPTY);
! PyModule_AddIntConstant(module, "CONSOLE_MOUSE_SELECTION", CONSOLE_MOUSE_SELECTION);
! PyModule_AddIntConstant(module, "CONSOLE_MOUSE_DOWN", CONSOLE_MOUSE_DOWN);
! PyModule_AddIntConstant(module, "LOCALE_USER_DEFAULT", LOCALE_USER_DEFAULT);
// event types for INPUT_RECORD
! PyModule_AddIntConstant(module, "KEY_EVENT", KEY_EVENT);
! PyModule_AddIntConstant(module, "MOUSE_EVENT", MOUSE_EVENT);
! PyModule_AddIntConstant(module, "WINDOW_BUFFER_SIZE_EVENT", WINDOW_BUFFER_SIZE_EVENT);
! PyModule_AddIntConstant(module, "MENU_EVENT", MENU_EVENT);
! PyModule_AddIntConstant(module, "FOCUS_EVENT", FOCUS_EVENT);
// Control events for GenerateConsoleCtrlEvent
! PyModule_AddIntConstant(module, "CTRL_C_EVENT", CTRL_C_EVENT);
! PyModule_AddIntConstant(module, "CTRL_BREAK_EVENT", CTRL_BREAK_EVENT);
// std handles
! PyModule_AddIntConstant(module, "STD_INPUT_HANDLE", STD_INPUT_HANDLE);
! PyModule_AddIntConstant(module, "STD_OUTPUT_HANDLE", STD_OUTPUT_HANDLE);
! PyModule_AddIntConstant(module, "STD_ERROR_HANDLE", STD_ERROR_HANDLE);
// flags used with SetConsoleDisplayMode
// ?????? these aren't in my SDK headers
! PyModule_AddIntConstant(module, "CONSOLE_FULLSCREEN_MODE", 1);
! PyModule_AddIntConstant(module, "CONSOLE_WINDOWED_MODE", 2);
!
! #if (PY_VERSION_HEX >= 0x03000000)
! return module;
! #endif
}
Index: win32transactionmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32transactionmodule.cpp,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -C2 -d -r1.3 -r1.3.2.1
*** win32transactionmodule.cpp 3 Jun 2007 14:53:07 -0000 1.3
--- win32transactionmodule.cpp 29 Aug 2008 04:59:28 -0000 1.3.2.1
***************
*** 244,253 ****
};
! extern "C" __declspec(dllexport) void
! initwin32transaction(void)
{
! PyObject *dict, *mod;
PyWinGlobals_Ensure();
! mod = Py_InitModule("win32transaction", win32transaction_functions);
// Load dll and function pointers to avoid dependency on newer libraries and headers
--- 244,281 ----
};
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initwin32transaction(void)
! #else
! PyObject *PyInit_win32transaction(void)
! #endif
{
! PyObject *dict, *module;
PyWinGlobals_Ensure();
!
! #if (PY_VERSION_HEX < 0x03000000)
! module = Py_InitModule("win32transaction", win32transaction_functions);
! if (!module)
! return;
! dict = PyModule_GetDict(module);
! if (!dict)
! return;
!
! #else
! static PyModuleDef win32transaction_def = {
! PyModuleDef_HEAD_INIT,
! "win32transaction",
! "Module wrapping Kernal Transaction Manager functions, as used with"
! " transacted NTFS and transacted registry functions.",
! -1,
! win32transaction_functions
! };
! module = PyModule_Create(&win32transaction_def);
! if (!module)
! return NULL;
! dict = PyModule_GetDict(module);
! if (!dict)
! return NULL;
! #endif
// Load dll and function pointers to avoid dependency on newer libraries and headers
***************
*** 273,279 ****
}
- dict = PyModule_GetDict(mod);
Py_INCREF(PyWinExc_ApiError);
PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
}
--- 301,309 ----
}
Py_INCREF(PyWinExc_ApiError);
PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
+ #if (PY_VERSION_HEX >= 0x03000000)
+ return module;
+ #endif
}
Index: win32profilemodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32profilemodule.cpp,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -C2 -d -r1.3 -r1.3.2.1
*** win32profilemodule.cpp 15 Aug 2007 08:04:37 -0000 1.3
--- win32profilemodule.cpp 29 Aug 2008 04:59:27 -0000 1.3.2.1
***************
*** 463,478 ****
!
! extern "C" __declspec(dllexport) void
! initwin32profile(void)
{
PyObject *dict, *module;
PyWinGlobals_Ensure();
module = Py_InitModule("win32profile", win32profile_functions);
! if (module==NULL)
return;
dict = PyModule_GetDict(module);
! if (dict==NULL)
return;
// PROFILEINFO flags
--- 463,498 ----
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initwin32profile(void)
! #else
! PyObject *PyInit_win32profile(void)
! #endif
{
PyObject *dict, *module;
PyWinGlobals_Ensure();
+
+ #if (PY_VERSION_HEX < 0x03000000)
module = Py_InitModule("win32profile", win32profile_functions);
! if (!module)
return;
dict = PyModule_GetDict(module);
! if (!dict)
return;
+ #else
+ static PyModuleDef win32profile_def = {
+ PyModuleDef_HEAD_INIT,
+ "win32profile",
+ "Interface to the Terminal Services Api.",
+ -1,
+ win32profile_functions
+ };
+ module = PyModule_Create(&win32profile_def);
+ if (!module)
+ return NULL;
+ dict = PyModule_GetDict(module);
+ if (!dict)
+ return NULL;
+ #endif
// PROFILEINFO flags
***************
*** 500,503 ****
pfnUnloadUserProfile=(UnloadUserProfilefunc)GetProcAddress(hmodule,"UnloadUserProfile");
}
}
-
--- 520,526 ----
pfnUnloadUserProfile=(UnloadUserProfilefunc)GetProcAddress(hmodule,"UnloadUserProfile");
}
+
+ #if (PY_VERSION_HEX >= 0x03000000)
+ return module;
+ #endif
}
Index: win32security.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32security.i,v
retrieving revision 1.47
retrieving revision 1.47.2.1
diff -C2 -d -r1.47 -r1.47.2.1
*** win32security.i 29 Nov 2007 06:46:12 -0000 1.47
--- win32security.i 29 Aug 2008 04:59:28 -0000 1.47.2.1
***************
*** 830,834 ****
pfnDsFreeNameResult=(DsFreeNameResultfunc)loadapifunc("DsFreeNameResultW", ntdsapi_dll);
pfnDsGetDcName=(DsGetDcNamefunc)loadapifunc("DsGetDcNameW", netapi32_dll);
!
// old names, these should not be used
PyDict_SetItemString(d, "SecBufferType", (PyObject *)&PySecBufferType);
--- 830,846 ----
pfnDsFreeNameResult=(DsFreeNameResultfunc)loadapifunc("DsFreeNameResultW", ntdsapi_dll);
pfnDsGetDcName=(DsGetDcNamefunc)loadapifunc("DsGetDcNameW", netapi32_dll);
!
! // Py3k requires that *all* types have to be initialized
! #if (PY_VERSION_HEX >= 0x03000000)
! if (PyType_Ready(&PySecBufferType) == -1)
! return NULL;
! if (PyType_Ready(&PySecBufferDescType) == -1)
! return NULL;
! if (PyType_Ready(&PyCtxtHandleType) == -1)
! return NULL;
! if (PyType_Ready(&PyCredHandleType) == -1)
! return NULL;
! #endif
!
// old names, these should not be used
PyDict_SetItemString(d, "SecBufferType", (PyObject *)&PySecBufferType);
Index: win32pipe.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32pipe.i,v
retrieving revision 1.18
retrieving revision 1.18.2.1
diff -C2 -d -r1.18 -r1.18.2.1
*** win32pipe.i 7 Jun 2008 07:23:54 -0000 1.18
--- win32pipe.i 29 Aug 2008 04:59:27 -0000 1.18.2.1
***************
*** 20,126 ****
static GetNamedPipeClientProcessIdfunc pfnGetNamedPipeClientSessionId = NULL;
static GetNamedPipeClientProcessIdfunc pfnGetNamedPipeServerSessionId = NULL;
-
-
- // Global used to determine if Win9x win32pipe hack is necessary.
- bool g_fUsingWin9x;
- CHAR g_szModulePath[_MAX_PATH + 2];
- HINSTANCE g_hInstance = NULL;
-
- /////////////////////////////////////////////////////////////////////////////
- // DLL Entry Point
-
- #ifndef BUILD_FREEZE
- // Doesnt work for freeze - but in that case, g_hInstance
- // remaims NULL, so GetModuleFileName(NULL) will be used
- // and still give the answer we are after.
- extern "C"
- BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
- {
- if (dwReason == DLL_PROCESS_ATTACH)
- g_hInstance = hInstance;
- return TRUE;
- }
- #endif // BUILD_FREEZE
-
- static BOOL LoadModulePath(void)
- {
- DWORD cbModuleFilename;
- CHAR *psz = NULL;
-
- // Note: GetModuleFileName will write nSize + 1 characters
- // to get the null terminator.
- cbModuleFilename = GetModuleFileName(
- g_hInstance,
- g_szModulePath,
- sizeof(g_szModulePath) - 1);
- if (0 == cbModuleFilename)
- {
- // hr = HRESULT_FROM_WIN32(GetLastError());
- // ErrorTrace(hr);
- return FALSE;
- }
-
- if ((sizeof(g_szModulePath) - 1) == cbModuleFilename)
- {
- // Note: This should never happen
- // hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- // ErrorTrace(hr);
- return FALSE;
- }
-
- // Start from the end of the string and insert a '\0' after the first '\\' you find.
- psz = g_szModulePath + strlen(g_szModulePath) - 1;
- while (psz > g_szModulePath && *psz != '\\')
- {
- psz--;
- }
-
- if (*psz == '\\')
- {
- psz++;
- *psz = '\0';
- }
- else
- {
- // Something wierd happened. :(
- return FALSE;
- }
- return TRUE;
- }
-
-
%}
%init %{
// All errors raised by this module are of this type.
- Py_INCREF(PyWinExc_ApiError);
PyDict_SetItemString(d, "error", PyWinExc_ApiError);
! // Setup g_fUsingWin9x and module path correctly...
! {
! LoadModulePath();
!
! OSVERSIONINFO osvi;
!
! memset(&osvi, 0, sizeof(osvi));
! osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
!
! if (!GetVersionEx(&osvi))
! {
! PyWin_SetAPIError("GetVersionEx");
! }
!
! if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
! {
! g_fUsingWin9x = TRUE;
! }
! else
! {
! g_fUsingWin9x = FALSE;
! }
! }
! HMODULE hmod=GetModuleHandle("Kernel32.dll");
if (!hmod)
! hmod=LoadLibrary("Kernel32.dll");
if (hmod){
pfnGetNamedPipeClientProcessId = (GetNamedPipeClientProcessIdfunc)GetProcAddress(hmod, "GetNamedPipeClientProcessId");
--- 20,32 ----
static GetNamedPipeClientProcessIdfunc pfnGetNamedPipeClientSessionId = NULL;
static GetNamedPipeClientProcessIdfunc pfnGetNamedPipeServerSessionId = NULL;
%}
%init %{
// All errors raised by this module are of this type.
PyDict_SetItemString(d, "error", PyWinExc_ApiError);
! HMODULE hmod=GetModuleHandle(_T("Kernel32.dll"));
if (!hmod)
! hmod=LoadLibrary(_T("Kernel32.dll"));
if (hmod){
pfnGetNamedPipeClientProcessId = (GetNamedPipeClientProcessIdfunc)GetProcAddress(hmod, "GetNamedPipeClientProcessId");
***************
*** 131,153 ****
%}
- %{
- extern PyObject *PyPopen(PyObject *self, PyObject *args);
- extern PyObject *PyPopen2(PyObject *self, PyObject *args);
- extern PyObject *PyPopen3(PyObject *self, PyObject *args);
- extern PyObject *PyPopen4(PyObject *self, PyObject *args);
-
- %}
- // @pymeth popen|Version of popen that works in a GUI
- %native(popen) PyPopen;
-
- // @pymeth popen2|Variation on popen - returns 2 pipes
- %native(popen2) Py...
[truncated message content] |