pywin32-checkins Mailing List for Python for Windows Extensions (Page 110)
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(6) |
Jul
(50) |
Aug
(11) |
Sep
(24) |
Oct
(184) |
Nov
(118) |
Dec
(22) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(31) |
Feb
(25) |
Mar
(34) |
Apr
(105) |
May
(49) |
Jun
(38) |
Jul
(39) |
Aug
(7) |
Sep
(98) |
Oct
(79) |
Nov
(20) |
Dec
(17) |
2005 |
Jan
(66) |
Feb
(32) |
Mar
(43) |
Apr
(30) |
May
(58) |
Jun
(30) |
Jul
(16) |
Aug
(4) |
Sep
(21) |
Oct
(42) |
Nov
(11) |
Dec
(14) |
2006 |
Jan
(42) |
Feb
(30) |
Mar
(22) |
Apr
(1) |
May
(9) |
Jun
(15) |
Jul
(20) |
Aug
(9) |
Sep
(8) |
Oct
(1) |
Nov
(9) |
Dec
(43) |
2007 |
Jan
(52) |
Feb
(45) |
Mar
(20) |
Apr
(12) |
May
(59) |
Jun
(39) |
Jul
(35) |
Aug
(31) |
Sep
(17) |
Oct
(20) |
Nov
(4) |
Dec
(4) |
2008 |
Jan
(28) |
Feb
(111) |
Mar
(4) |
Apr
(27) |
May
(40) |
Jun
(27) |
Jul
(32) |
Aug
(94) |
Sep
(87) |
Oct
(153) |
Nov
(336) |
Dec
(331) |
2009 |
Jan
(298) |
Feb
(127) |
Mar
(20) |
Apr
(8) |
May
|
Jun
(10) |
Jul
(6) |
Aug
|
Sep
(2) |
Oct
(2) |
Nov
|
Dec
(1) |
2010 |
Jan
(7) |
Feb
(1) |
Mar
|
Apr
|
May
(15) |
Jun
(4) |
Jul
(3) |
Aug
(28) |
Sep
(1) |
Oct
(19) |
Nov
(16) |
Dec
(6) |
2011 |
Jan
(2) |
Feb
(18) |
Mar
(17) |
Apr
(12) |
May
(5) |
Jun
(11) |
Jul
(7) |
Aug
(2) |
Sep
(2) |
Oct
(4) |
Nov
(4) |
Dec
|
2012 |
Jan
(6) |
Feb
(2) |
Mar
|
Apr
(8) |
May
(4) |
Jun
(3) |
Jul
(13) |
Aug
(27) |
Sep
(8) |
Oct
(9) |
Nov
(3) |
Dec
(2) |
2013 |
Jan
|
Feb
(1) |
Mar
(5) |
Apr
(10) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(9) |
2014 |
Jan
(2) |
Feb
(4) |
Mar
(4) |
Apr
(1) |
May
(4) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(1) |
2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
(6) |
May
(2) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
(3) |
Feb
(2) |
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: Mark H. <mha...@us...> - 2005-07-29 01:33:20
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19483 Modified Files: PyACL.cpp PyDEVMODE.cpp win32inet.i Log Message: Allow things to build on VC6 without a platform SDK installed. Index: win32inet.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32inet.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** win32inet.i 12 Jun 2004 13:40:34 -0000 1.1 --- win32inet.i 29 Jul 2005 01:33:08 -0000 1.2 *************** *** 422,425 **** --- 422,426 ---- ); + %ifdef WINVER >= 0x0500 // @pyswig <o PyHINTERNET>|FtpCommand|Allows an application to send commands directly to an FTP server. BOOLAPI FtpCommand( *************** *** 435,439 **** PyHINTERNET *OUTPUT ); ! %init %{ --- 436,440 ---- PyHINTERNET *OUTPUT ); ! %endif %init %{ Index: PyACL.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyACL.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PyACL.cpp 2 Jun 2005 06:28:47 -0000 1.14 --- PyACL.cpp 29 Jul 2005 01:33:08 -0000 1.15 *************** *** 292,295 **** --- 292,296 ---- break; } + #if WINVER >= 0x0501 case TRUSTEE_IS_OBJECTS_AND_SID: case TRUSTEE_IS_OBJECTS_AND_NAME:{ *************** *** 297,300 **** --- 298,302 ---- return FALSE; } + #endif default:{ PyErr_SetString(PyExc_ValueError, "Invalid value for TrusteeForm"); Index: PyDEVMODE.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyDEVMODE.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyDEVMODE.cpp 10 Sep 2004 03:40:21 -0000 1.2 --- PyDEVMODE.cpp 29 Jul 2005 01:33:08 -0000 1.3 *************** *** 1,3 **** --- 1,4 ---- // @doc - This file contains autoduck documentation + #include "PyWinTypes.h" #include "structmember.h" *************** *** 43,47 **** {"PelsHeight", T_ULONG, OFF(devmode.dmPelsHeight), 0, "Pixel height of display"}, {"DisplayFlags", T_ULONG, OFF(devmode.dmDisplayFlags), 0, "Combination of DM_GRAYSCALE and DM_INTERLACED"}, - {"Nup", T_ULONG, OFF(devmode.dmNup), 0, "DMNUP_SYSTEM or DMNUP_ONEUP"}, // wtf is a "Nup"? {"DisplayFrequency",T_ULONG, OFF(devmode.dmDisplayFrequency), 0, "Refresh rate"}, {"ICMMethod", T_ULONG, OFF(devmode.dmICMMethod), 0, ""}, --- 44,47 ---- *************** *** 51,57 **** {"Reserved1", T_ULONG, OFF(devmode.dmReserved1), 0, ""}, {"Reserved2", T_ULONG, OFF(devmode.dmReserved2), 0, ""}, {"PanningWidth", T_ULONG, OFF(devmode.dmPanningWidth), 0, ""}, {"PanningHeight", T_ULONG, OFF(devmode.dmPanningHeight), 0, ""}, ! {"DriverData", T_OBJECT, OFF(obdummy), 0, "Driver data appended to end of structure"}, {NULL} }; --- 51,60 ---- {"Reserved1", T_ULONG, OFF(devmode.dmReserved1), 0, ""}, {"Reserved2", T_ULONG, OFF(devmode.dmReserved2), 0, ""}, + {"DriverData", T_OBJECT, OFF(obdummy), 0, "Driver data appended to end of structure"}, + #if WINVER >= 0x0500 + {"Nup", T_ULONG, OFF(devmode.dmNup), 0, "DMNUP_SYSTEM or DMNUP_ONEUP"}, // wtf is a "Nup"? {"PanningWidth", T_ULONG, OFF(devmode.dmPanningWidth), 0, ""}, {"PanningHeight", T_ULONG, OFF(devmode.dmPanningHeight), 0, ""}, ! #endif {NULL} }; |
From: Mark H. <mha...@us...> - 2005-07-29 01:33:20
|
Update of /cvsroot/pywin32/pywin32/win32/src/win32net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19483/win32net Modified Files: win32net.h win32netmisc.cpp win32netmodule.cpp Log Message: Allow things to build on VC6 without a platform SDK installed. Index: win32netmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32net/win32netmodule.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** win32netmodule.cpp 8 Jun 2005 01:34:25 -0000 1.19 --- win32netmodule.cpp 29 Jul 2005 01:33:08 -0000 1.20 *************** *** 39,43 **** --- 39,45 ---- #include "assert.h" + #if WINVER >= 0x0500 NetGetJoinInformationfunc pfnNetGetJoinInformation=NULL; + #endif /*****************************************************************************/ *************** *** 942,945 **** --- 944,949 ---- } + #if WINVER >= 0x0500 + // @pymethod <o PyUnicode>, int|win32net|NetGetJoinInformation|Retrieves join status information for the specified computer. static PyObject *PyNetGetJoinInformation(PyObject *self, PyObject *args) *************** *** 972,975 **** --- 976,981 ---- return ret; } + #endif // WINVER + /************************************************************************************************************* ** *************** *** 1046,1050 **** --- 1052,1058 ---- // @module win32net|A module encapsulating the Windows Network API. static struct PyMethodDef win32net_functions[] = { + #if WINVER >= 0x0500 {"NetGetJoinInformation", PyNetGetJoinInformation, 1}, // @pymeth NetGetJoinInformation|Retrieves join status information for the specified computer. + #endif {"NetGroupGetInfo", PyNetGroupGetInfo, 1}, // @pymeth NetGroupGetInfo|Retrieves information about a particular group on a server. {"NetGroupGetUsers", PyNetGroupGetUsers, 1}, // @pymeth NetGroupGetUsers|Enumerates the users in a group. *************** *** 1118,1122 **** --- 1126,1132 ---- {"NetFileGetInfo", PyNetFileGetInfo, 1}, // @pymeth NetFileGetInfo|Get info about files open on the server. {"NetStatisticsGet", PyNetStatisticsGet, 1}, // @pymeth NetStatisticsGet|Return server or workstation stats + #if WINVER >= 0x0500 {"NetValidateName", PyNetValidateName, 1}, // @pymeth NetValidateName|Verify that computer/domain name is valid for given context + #endif {NULL, NULL} }; *************** *** 1151,1154 **** --- 1161,1165 ---- HMODULE hmodule=GetModuleHandle(_T("netapi32")); + #if WINVER >= 0x0500 if (hmodule==NULL) hmodule=LoadLibrary(_T("netapi32")); *************** *** 1157,1159 **** --- 1168,1171 ---- pfnNetGetJoinInformation=(NetGetJoinInformationfunc)GetProcAddress(hmodule,"NetGetJoinInformation"); } + #endif } Index: win32net.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32net/win32net.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** win32net.h 8 Jun 2005 01:34:24 -0000 1.4 --- win32net.h 29 Jul 2005 01:33:08 -0000 1.5 *************** *** 61,64 **** --- 61,65 ---- PyObject *PyDoGroupDelMembers(PyObject *self, PyObject *args); + #if WINVER >= 0x0500 typedef NET_API_STATUS (NET_API_FUNCTION *NetValidateNamefunc)(LPCWSTR, LPCWSTR, LPCWSTR, LPCWSTR, NETSETUP_NAME_TYPE); extern NetValidateNamefunc pfnNetValidateName; *************** *** 66,67 **** --- 67,69 ---- typedef NET_API_STATUS (NET_API_FUNCTION *NetGetJoinInformationfunc)(LPCWSTR, LPWSTR *, PNETSETUP_JOIN_STATUS); extern NetGetJoinInformationfunc pfnNetGetJoinInformation; + #endif // WINVER Index: win32netmisc.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32net/win32netmisc.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** win32netmisc.cpp 12 Jan 2005 07:38:20 -0000 1.10 --- win32netmisc.cpp 29 Jul 2005 01:33:08 -0000 1.11 *************** *** 1270,1273 **** --- 1270,1275 ---- } + #if WINVER >= 0x0500 + extern "C" NetValidateNamefunc pfnNetValidateName=NULL; // @pymethod |win32net|NetValidateName|Checks that domain/machine/workgroup name is valid for given context *************** *** 1313,1314 **** --- 1315,1317 ---- return ret; } + #endif // WINVER |
From: Mark H. <mha...@us...> - 2005-07-27 06:16:03
|
Update of /cvsroot/pywin32/pywin32/isapi/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1033 Modified Files: PyFilterObjects.cpp PyFilterObjects.h Log Message: Add HTTP_FILTER_LOG support Index: PyFilterObjects.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/PyFilterObjects.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyFilterObjects.h 6 Oct 2004 05:11:53 -0000 1.1 --- PyFilterObjects.h 27 Jul 2005 06:15:52 -0000 1.2 *************** *** 110,113 **** --- 110,128 ---- }; + class PyFILTER_LOG:public PyObject + { + public: + PyHFC *m_parent; + public: + PyFILTER_LOG(PyHFC *); + ~PyFILTER_LOG(); + HTTP_FILTER_LOG *GetFilterLog(); + public: + // Python support + static void deallocFunc(PyObject *ob); + static PyObject *getattr(PyObject *self, char *name); + static int setattr(PyObject *self, char *name, PyObject *v); + }; + // error handling Index: PyFilterObjects.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/PyFilterObjects.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyFilterObjects.cpp 26 Oct 2004 01:30:30 -0000 1.2 --- PyFilterObjects.cpp 27 Jul 2005 06:15:52 -0000 1.3 *************** *** 160,163 **** --- 160,166 ---- case SF_NOTIFY_PREPROC_HEADERS: return new PyPREPROC_HEADERS(me); + // @flag SF_NOTIFY_LOG|<o HTTP_FILTER_LOG> + case SF_NOTIFY_LOG: + return new PyFILTER_LOG(me); default: PyErr_Format(PyExc_ValueError, "Don't understand data of type 0x%x", me->m_notificationType); *************** *** 614,615 **** --- 617,756 ---- } + ///////////////////////////////////////////////////////////////////////// + // PyFILTER_LOG object + ///////////////////////////////////////////////////////////////////////// + // @object HTTP_FILTER_LOG|A Python representation of an ISAPI + // HTTP_FILTER_LOG structure. + PyTypeObject PyFILTER_LOGType = + { + PyObject_HEAD_INIT(&PyType_Type) + 0, + "HTTP_FILTER_LOG", + sizeof(PyFILTER_LOG), + 0, + PyFILTER_LOG::deallocFunc, /* tp_dealloc */ + 0, /* tp_print */ + PyFILTER_LOG::getattr, /* tp_getattr */ + PyFILTER_LOG::setattr, /* tp_setattr */ + 0, + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, + 0, /* tp_call */ + 0, /* tp_str */ + }; + + + PyFILTER_LOG::PyFILTER_LOG(PyHFC *pParent) + { + ob_type = &PyFILTER_LOGType; + _Py_NewReference(this); + + m_parent = pParent; + Py_INCREF(m_parent); + } + + PyFILTER_LOG::~PyFILTER_LOG() + { + Py_XDECREF(m_parent); + } + + HTTP_FILTER_LOG *PyFILTER_LOG::GetFilterLog() + { + HTTP_FILTER_CONTEXT *pFC; + void *vdata; + DWORD requestType; + m_parent->GetFilterContext()->GetFilterData(&pFC, &requestType, &vdata); + assert(requestType==SF_NOTIFY_LOG); + return (HTTP_FILTER_LOG *)vdata; + + } + + PyObject *PyFILTER_LOG::getattr(PyObject *self, char *name) + { + HTTP_FILTER_LOG *pLog = ((PyFILTER_LOG *)self)->GetFilterLog(); + if (!pLog) + return NULL; + // @prop string|ClientHostName| + if (strcmp(name, "ClientHostName")==0) + return PyString_FromString(pLog->pszClientHostName); + // @prop string|ClientUserName| + if (strcmp(name, "ClientUserName")==0) + return PyString_FromString(pLog->pszClientUserName); + // @prop string|ServerName| + if (strcmp(name, "ServerName")==0) + return PyString_FromString(pLog->pszServerName); + // @prop string|Operation| + if (strcmp(name, "Operation")==0) + return PyString_FromString(pLog->pszOperation); + // @prop string|Target| + if (strcmp(name, "Target")==0) + return PyString_FromString(pLog->pszTarget); + // @prop string|Parameters| + if (strcmp(name, "Parameters")==0) + return PyString_FromString(pLog->pszParameters); + // @prop int|HttpStatus| + if (strcmp(name, "HttpStatus")==0) + return PyInt_FromLong(pLog->dwHttpStatus); + // @prop int|HttpStatus| + if (strcmp(name, "Win32Status")==0) + return PyInt_FromLong(pLog->dwWin32Status); + PyErr_Format(PyExc_AttributeError, "PyFILTER_LOG objects have no attribute '%s'", name); + return NULL; + } + + // Note that to set the strings, we use the AllocMem function - this allows + // IIS to automatically free the memory once the request has completed. + + #define CHECK_SET_FILTER_LOG_STRING(struct_elem) \ + if (strcmp(name, #struct_elem)==0) { \ + if (!PyString_Check(v)) { \ + PyErr_Format(PyExc_TypeError, #struct_elem " must be a string"); \ + return -1; \ + } \ + int cc = PyString_Size(v) + sizeof(CHAR); \ + char *buf = (char *)pFC->AllocMem(pFC, cc, 0); \ + if (!buf) { \ + PyErr_NoMemory(); \ + return -1; \ + } \ + _tcsncpy(buf, PyString_AS_STRING(v), cc); \ + pLog->psz##struct_elem = buf; \ + return 0; \ + } + + #define CHECK_SET_FILTER_LOG_LONG(struct_elem) \ + if (strcmp(name, #struct_elem)==0) { \ + if (!PyInt_Check(v)) { \ + PyErr_Format(PyExc_TypeError, #struct_elem " must be an integer"); \ + return -1; \ + } \ + pLog->dw##struct_elem = PyInt_AsLong(v); \ + return 0; \ + } + + int PyFILTER_LOG::setattr(PyObject *self, char *name, PyObject *v) + { + HTTP_FILTER_CONTEXT *pFC; + ((PyFILTER_LOG *)self)->m_parent->GetFilterContext()->GetFilterData(&pFC, NULL, NULL); + HTTP_FILTER_LOG *pLog = ((PyFILTER_LOG *)self)->GetFilterLog(); + if (!pLog || !pFC) + return NULL; + CHECK_SET_FILTER_LOG_STRING(ClientHostName) + CHECK_SET_FILTER_LOG_STRING(ClientUserName) + CHECK_SET_FILTER_LOG_STRING(ServerName) + CHECK_SET_FILTER_LOG_STRING(Operation) + CHECK_SET_FILTER_LOG_STRING(Target) + CHECK_SET_FILTER_LOG_STRING(Parameters) + CHECK_SET_FILTER_LOG_LONG(HttpStatus); + CHECK_SET_FILTER_LOG_LONG(Win32Status); + PyErr_Format(PyExc_AttributeError, "PyFILTER_LOG object has no attribute '%s'", name); + return -1; + } + + void PyFILTER_LOG::deallocFunc(PyObject *ob) + { + delete (PyFILTER_LOG *)ob; + } |
From: Mark H. <mha...@us...> - 2005-07-07 14:46:26
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12286/Pythonwin/pywin/framework Modified Files: app.py Log Message: * Write Lib\site-packages\pywin32.version.txt with setup.py's build_id * Pythonwin's Help->About reads this value * binary installer's title is now 'pywin32-2xx' - now fits on the screen! * directsound extension optional based on existance of dsound.h * Check MSVC dirs as well as SDK dirs for optional include files. Index: app.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/app.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** app.py 11 Apr 2004 04:44:24 -0000 1.10 --- app.py 7 Jul 2005 14:46:17 -0000 1.11 *************** *** 332,339 **** self.SetDlgItemText(win32ui.IDC_EDIT1, text) # Get the build number - written by installers. ! # For distutils build, use the uninstall key. ! key_name = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion" \ ! "\\Uninstall\\pywin32-py%d.%d" % sys.version_info[:2] ! ver = _GetRegistryValue(key_name, "DisplayName") if ver is None: # See if we are Part of Active Python --- 332,343 ---- self.SetDlgItemText(win32ui.IDC_EDIT1, text) # Get the build number - written by installers. ! # For distutils build, read pywin32.version.txt ! import distutils.sysconfig ! site_packages = distutils.sysconfig.get_python_lib(plat_specific=1) ! try: ! build_no = open(os.path.join(site_packages, "pywin32.version.txt")).read().strip() ! ver = "pywin32 build %s" % build_no ! except EnvironmentError: ! ver = None if ver is None: # See if we are Part of Active Python |
From: Mark H. <mha...@us...> - 2005-07-07 14:46:26
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12286 Modified Files: setup.py Log Message: * Write Lib\site-packages\pywin32.version.txt with setup.py's build_id * Pythonwin's Help->About reads this value * binary installer's title is now 'pywin32-2xx' - now fits on the screen! * directsound extension optional based on existance of dsound.h * Check MSVC dirs as well as SDK dirs for optional include files. Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** setup.py 4 Jul 2005 05:40:27 -0000 1.12 --- setup.py 7 Jul 2005 14:46:07 -0000 1.13 *************** *** 1,3 **** ! build_number=204.1 # Putting buildno at the top prevents automatic __doc__ assignment, and # I *want* the build number at the top :) --- 1,3 ---- ! build_id="204.2" # Putting buildno at the top prevents automatic __doc__ assignment, and # I *want* the build number at the top :) *************** *** 49,52 **** --- 49,53 ---- from distutils.command.install_lib import install_lib from distutils.command.build_ext import build_ext + from distutils.command.build import build from distutils.command.install_data import install_data from distutils.dep_util import newer_group, newer *************** *** 266,269 **** --- 267,282 ---- ################################################################ + class my_build(build): + def run(self): + build.run(self) + # write a pywin32.version.txt. + ver_fname = os.path.join(self.build_base, "pywin32.version.txt") + try: + f = open(ver_fname, "wU") + f.write("%s\n" % build_id) + f.close() + except EnvironmentError, why: + print "Failed to open '%s': %s" % (ver_fname, why) + class my_build_ext(build_ext): *************** *** 329,334 **** % (ext.windows_h_version, self.windows_h_version) for h in ext.optional_headers: ! for d in self.include_dirs: if os.path.isfile(os.path.join(d, h)): break --- 342,348 ---- % (ext.windows_h_version, self.windows_h_version) + look_dirs = self.include_dirs + self.compiler.get_msvc_paths("include") for h in ext.optional_headers: ! for d in look_dirs: if os.path.isfile(os.path.join(d, h)): break *************** *** 549,553 **** objects, ext_filename, **kw) - def build_extension(self, ext): # It is well known that some of these extensions are difficult to --- 563,566 ---- *************** *** 774,786 **** class my_install_data(install_data): ! """A custom install_data command, which will install it's files ! into the standard directories (normally lib/site-packages). ! """ ! def finalize_options(self): ! if self.install_dir is None: ! installobj = self.distribution.get_command_obj('install') ! self.install_dir = installobj.install_lib ! print 'Installing data files to %s' % self.install_dir ! install_data.finalize_options(self) ################################################################ --- 787,799 ---- class my_install_data(install_data): ! """A custom install_data command, which will install it's files ! into the standard directories (normally lib/site-packages). ! """ ! def finalize_options(self): ! if self.install_dir is None: ! installobj = self.distribution.get_command_obj('install') ! self.install_dir = installobj.install_lib ! print 'Installing data files to %s' % self.install_dir ! install_data.finalize_options(self) ################################################################ *************** *** 944,947 **** --- 957,961 ---- WinExt_win32com('ifilter', libraries='ntquery'), WinExt_win32com('directsound', pch_header='directsound_pch.h', + optional_headers = ['dsound.h'], libraries='user32 dsound dxguid'), ] *************** *** 1200,1204 **** dist = setup(name="pywin32", ! version=str(build_number), description="Python for Window Extensions", long_description="Python extensions for Microsoft Windows\n" --- 1214,1218 ---- dist = setup(name="pywin32", ! version=str(build_id), description="Python for Window Extensions", long_description="Python extensions for Microsoft Windows\n" *************** *** 1211,1214 **** --- 1225,1229 ---- license="PSA", cmdclass = { #'install_lib': my_install_lib, + 'build': my_build, 'build_ext': my_build_ext, 'install_data': my_install_data, *************** *** 1217,1221 **** {"install_script": "pywin32_postinstall.py", "pre_install_script": "pywin32_preinstall.py", ! "title": "pywin32 extensions (build %s)" % (build_number,), }, }, --- 1232,1236 ---- {"install_script": "pywin32_postinstall.py", "pre_install_script": "pywin32_preinstall.py", ! "title": "pywin32-%s" % (build_id,), }, }, *************** *** 1232,1239 **** py_modules = py_modules, ! data_files=convert_optional_data_files([ 'PyWin32.chm', ]) + ! convert_data_files([ 'pythonwin/pywin/*.cfg', 'pythonwin/pywin/Demos/*.py', --- 1247,1255 ---- py_modules = py_modules, ! data_files=[('', ('build/pywin32.version.txt',))] + ! convert_optional_data_files([ 'PyWin32.chm', ]) + ! convert_data_files([ 'pythonwin/pywin/*.cfg', 'pythonwin/pywin/Demos/*.py', |
From: Mark H. <mha...@us...> - 2005-07-04 05:40:39
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25402/win32/src Modified Files: .cvsignore Added Files: win32crypt.i Log Message: New win32crypt module (only 2 functions for now, but its a start!) Index: .cvsignore =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/.cvsignore,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** .cvsignore 10 Feb 2005 23:57:30 -0000 1.4 --- .cvsignore 4 Jul 2005 05:40:29 -0000 1.5 *************** *** 1,4 **** --- 1,5 ---- PythonServiceMessages.h *_wrap.doc + win32cryptmodule.cpp win32eventmodule_win*.cpp win32evtlog_messages.h --- NEW FILE: win32crypt.i --- /* File : win32crypt.i */ %module win32crypt // An interface to the win32 Cryptography API %{ #include "windows.h" #include "wincrypt.h" #include "PyWinTypes.h" #include "malloc.h" %} %include "typemaps.i" %include "pywin32.i" %apply HWND {long}; typedef long HWND %{ BOOL PyWinObject_AsDATA_BLOB(PyObject *ob, DATA_BLOB *b) { PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj, const void **buffer, int *buffer_len); return PyObject_AsReadBuffer(ob, (const void **)(&b->pbData), (int *)(&b->cbData))==0; } PyObject *PyWinObject_FromDATA_BLOB(DATA_BLOB *b) { return PyString_FromStringAndSize((char *)b->pbData, b->cbData); } %} %typemap(python,argout) WCHAR **CUD_OUTPUT { PyObject *o; o = PyWinObject_FromWCHAR(*$source); // Output string must be LocalFree'd if (*$source) LocalFree(*$source); if (!$target) { $target = o; } else if ($target == Py_None) { Py_DECREF(Py_None); $target = o; } else { if (!PyList_Check($target)) { PyObject *o2 = $target; $target = PyList_New(0); PyList_Append($target,o2); Py_XDECREF(o2); } PyList_Append($target,o); Py_XDECREF(o); } } %typemap(python,ignore) WCHAR **CUD_OUTPUT(WCHAR *temp) { temp = NULL; $target = &temp; } %typemap(python,in) DATA_BLOB * { $target = (DATA_BLOB *)_alloca(sizeof(DATA_BLOB)); if (!PyWinObject_AsDATA_BLOB($source, $target)) return NULL; } %typemap(python,in) DATA_BLOB *INPUT_NULLOK { if ($source==Py_None) $target = NULL; else { $target = (DATA_BLOB *)_alloca(sizeof(DATA_BLOB)); if (!PyWinObject_AsDATA_BLOB($source, $target)) return NULL; } } %typemap(python,argout) DATA_BLOB *OUTPUT { PyObject *o; o = PyWinObject_FromDATA_BLOB($source); // Output DATA_BLOB data pointers must be LocalFree'd if ($source->pbData) LocalFree($source->pbData); if (!$target) { $target = o; } else if ($target == Py_None) { Py_DECREF(Py_None); $target = o; } else { if (!PyList_Check($target)) { PyObject *o2 = $target; $target = PyList_New(0); PyList_Append($target,o2); Py_XDECREF(o2); } PyList_Append($target,o); Py_XDECREF(o); } } %typemap(python,ignore) DATA_BLOB *OUTPUT(DATA_BLOB temp) { temp.cbData = 0; temp.pbData = NULL; $target = &temp; } // @object PyCRYPTPROTECT_PROMPTSTRUCT|A tuple representing a CRYPTPROTECT_PROMPTSTRUCT structure // @tupleitem 0|int|flags| // @tupleitem 1|int|hwndApp|parent hwnd (default is 0) // @tupleitem 2|<o PyUnicode>|prompt|A prompt string (default is None) %typemap(python,in) CRYPTPROTECT_PROMPTSTRUCT * { if ($source == Py_None) $target = NULL; else if (PyTuple_Check($source)) { $target = (CRYPTPROTECT_PROMPTSTRUCT *)_alloca(sizeof(CRYPTPROTECT_PROMPTSTRUCT)); PyObject *obPrompt = Py_None; memset($target, 0, sizeof(*$target)); $target->cbSize = sizeof(*$target); if (!PyArg_ParseTuple($source, "l|lO", &$target->dwPromptFlags, &$target->hwndApp, &obPrompt)) return NULL; if (!PyWinObject_AsWCHAR(obPrompt, (WCHAR **)(&$target->szPrompt), TRUE)) return NULL; } else { PyErr_Format(PyExc_TypeError, "CRYPTPROTECT_PROMPTSTRUCT must be None or a tuple (got %s)", $source->ob_type->tp_name); return NULL; } } %typemap(python,freearg) CRYPTPROTECT_PROMPTSTRUCT { PyWinObject_FreeTCHAR($target->szPrompt); } %typedef void *NULL_ONLY %typemap(python,in) NULL_ONLY { if ($source != Py_None) { PyErr_SetString(PyExc_TypeError, "This param must be None"); return NULL; } $target = NULL; } // @pyswig string|CryptProtectData| BOOLAPI CryptProtectData( DATA_BLOB* pDataIn, // @pyparm buffer|data||Data to be encrypted. WCHAR *szDataDescr, // @pyparm <o PyUnicode>|description||Description to add to the data DATA_BLOB* INPUT_NULLOK, // @pyparm buffer|optionalEntropy|| NULL_ONLY pvReserved, // @pyparm None|reserved||Must be None CRYPTPROTECT_PROMPTSTRUCT* pPromptStruct, //@pyparm <o PyCRYPTPROTECT_PROMPTSTRUCT>/None|promptStruct|| DWORD dwFlags, //@pyparm int|flags|| DATA_BLOB* OUTPUT ); // @pyswig (string, string)|CryptUnprotectData| // @rdesc The result is a tuple of (description, data) where description // is the description that was passed to <om win32crypt.CryptProtectData>, and // data is the unencrypted data. BOOLAPI CryptUnprotectData( DATA_BLOB* pDataIn, // buffer|data||The data to unprotect WCHAR **CUD_OUTPUT, DATA_BLOB* INPUT_NULLOK, // @pyparm buffer|optionalEntropy||The entropy passed to CryptProtectData NULL_ONLY pvReserved, // @pyparm None|reserved||Must be None CRYPTPROTECT_PROMPTSTRUCT* pPromptStruct,//@pyparm <o PyCRYPTPROTECT_PROMPTSTRUCT>/None|promptStruct|| DWORD dwFlags, //@pyparm int|flags|| DATA_BLOB* OUTPUT ); %init %{ PyEval_InitThreads(); /* Start the interpreter's thread-awareness */ PyDict_SetItemString(d, "error", PyWinExc_ApiError); %} |
From: Mark H. <mha...@us...> - 2005-07-04 05:40:39
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25402/win32/test Added Files: test_win32crypt.py Log Message: New win32crypt module (only 2 functions for now, but its a start!) --- NEW FILE: test_win32crypt.py --- # Test module for win32timezone import unittest import win32crypt class Crypt(unittest.TestCase): def testSimple(self): data = "My test data" entropy = None desc = "My description" flags = 0 ps = None blob = win32crypt.CryptProtectData(data, desc, entropy, None, ps, flags) got_desc, got_data = win32crypt.CryptUnprotectData(blob, entropy, None, ps, flags) self.failUnlessEqual(data, got_data) self.failUnlessEqual(desc, got_desc) def testEntropy(self): data = "My test data" entropy = "My test entropy" desc = "My description" flags = 0 ps = None blob = win32crypt.CryptProtectData(data, desc, entropy, None, ps, flags) got_desc, got_data = win32crypt.CryptUnprotectData(blob, entropy, None, ps, flags) self.failUnlessEqual(data, got_data) self.failUnlessEqual(desc, got_desc) if __name__ == '__main__': unittest.main() |
From: Mark H. <mha...@us...> - 2005-07-04 05:40:38
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25402 Modified Files: setup.py Log Message: New win32crypt module (only 2 functions for now, but its a start!) Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** setup.py 21 Jun 2005 13:54:18 -0000 1.11 --- setup.py 4 Jul 2005 05:40:27 -0000 1.12 *************** *** 812,815 **** --- 812,816 ---- ("win2kras", "rasapi32", False, 0x0500), ("win32api", "user32 advapi32 shell32 version", False, 0x0500), + ("win32crypt", "Crypt32", False, 0x0500, 'win32/src/win32crypt.i win32/src/win32cryptmodule.cpp'), ("win32file", "oleaut32", False, 0x0500), ("win32event", "user32", False), |
From: Mark H. <mha...@us...> - 2005-07-04 05:40:38
|
Update of /cvsroot/pywin32/pywin32/AutoDuck In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25402/AutoDuck Modified Files: pywin32.mak Log Message: New win32crypt module (only 2 functions for now, but its a start!) Index: pywin32.mak =================================================================== RCS file: /cvsroot/pywin32/pywin32/AutoDuck/pywin32.mak,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** pywin32.mak 26 May 2005 11:41:43 -0000 1.13 --- pywin32.mak 4 Jul 2005 05:40:27 -0000 1.14 *************** *** 43,47 **** $(GENDIR)/win32service.d $(GENDIR)/win32pipe.d $(GENDIR)/win32security.d \ $(GENDIR)/win32process.d $(GENDIR)/wincerapi.d $(GENDIR)/win32gui.d \ ! $(GENDIR)/win32inet.d $(GENDIR)/_winxptheme.d \ winxpgui.d --- 43,47 ---- $(GENDIR)/win32service.d $(GENDIR)/win32pipe.d $(GENDIR)/win32security.d \ $(GENDIR)/win32process.d $(GENDIR)/wincerapi.d $(GENDIR)/win32gui.d \ ! $(GENDIR)/win32inet.d $(GENDIR)/_winxptheme.d $(GENDIR)/win32crypt.d \ winxpgui.d *************** *** 161,164 **** --- 161,167 ---- $(PYTHON) makedfromi.py -o$*.d $(WIN32_SOURCE_DIR)/$(*B).i + $(GENDIR)/win32crypt.d: $(WIN32_SOURCE_DIR)/$(*B).i + $(PYTHON) makedfromi.py -o$*.d $(WIN32_SOURCE_DIR)/$(*B).i + ## ## win32com generated |
From: Mark H. <mha...@us...> - 2005-07-04 05:40:38
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25402/win32/Lib Added Files: win32cryptcon.py Log Message: New win32crypt module (only 2 functions for now, but its a start!) --- NEW FILE: win32cryptcon.py --- # Generated by h2py from WinCrypt.h def GET_ALG_CLASS(x): return (x & (7 << 13)) def GET_ALG_TYPE(x): return (x & (15 << 9)) def GET_ALG_SID(x): return (x & (511)) ALG_CLASS_ANY = (0) ALG_CLASS_SIGNATURE = (1 << 13) ALG_CLASS_MSG_ENCRYPT = (2 << 13) ALG_CLASS_DATA_ENCRYPT = (3 << 13) ALG_CLASS_HASH = (4 << 13) ALG_CLASS_KEY_EXCHANGE = (5 << 13) ALG_CLASS_ALL = (7 << 13) ALG_TYPE_ANY = (0) ALG_TYPE_DSS = (1 << 9) ALG_TYPE_RSA = (2 << 9) ALG_TYPE_BLOCK = (3 << 9) ALG_TYPE_STREAM = (4 << 9) [...1632 lines suppressed...] MICROSOFT_ROOT_CERT_CHAIN_POLICY_ENABLE_TEST_ROOT_FLAG = 0x00010000 CRYPT_STRING_BASE64HEADER = 0x00000000 CRYPT_STRING_BASE64 = 0x00000001 CRYPT_STRING_BINARY = 0x00000002 CRYPT_STRING_BASE64REQUESTHEADER = 0x00000003 CRYPT_STRING_HEX = 0x00000004 CRYPT_STRING_HEXASCII = 0x00000005 CRYPT_STRING_BASE64_ANY = 0x00000006 CRYPT_STRING_ANY = 0x00000007 CRYPT_STRING_HEX_ANY = 0x00000008 CRYPT_STRING_BASE64X509CRLHEADER = 0x00000009 CRYPT_STRING_HEXADDR = 0x0000000a CRYPT_STRING_HEXASCIIADDR = 0x0000000b CRYPT_STRING_NOCR = (-2147483648) CRYPT_USER_KEYSET = 0x00001000 PKCS12_IMPORT_RESERVED_MASK = (-65536) REPORT_NO_PRIVATE_KEY = 0x0001 REPORT_NOT_ABLE_TO_EXPORT_PRIVATE_KEY = 0x0002 EXPORT_PRIVATE_KEYS = 0x0004 PKCS12_EXPORT_RESERVED_MASK = (-65536) |
From: Mark H. <mha...@us...> - 2005-07-04 05:39:16
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24745/win32/src Modified Files: PyUnicode.cpp Log Message: Update autoduck comments on Unicode objects to the present day reality. Index: PyUnicode.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyUnicode.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** PyUnicode.cpp 26 May 2004 08:51:33 -0000 1.20 --- PyUnicode.cpp 4 Jul 2005 05:39:03 -0000 1.21 *************** *** 13,16 **** --- 13,23 ---- #endif + // @object PyUnicode|A Python object, representing a Unicode string. + // @comm pywin32 uses the builtin Python Unicode object + // <nl>In general, any pywin32/COM function documented as taking a + // PyUnicode parameter will also accept a Python string object, which will + // be automatically encoded using the MBCS encoding before being passed to the function. + // Note that the reverse is generally *not* true - a function documented as accepting + // a string must be passed a string. #ifndef MS_WINCE *************** *** 409,418 **** } - - // @object PyUnicode|A Python object, representing a Unicode string. - // @comm A PyUnicode object is used primarily when exchanging string - // information across a COM interface. - - static PySequenceMethods PyUnicode_SequenceMethods = { (inquiry)PyUnicode::lengthFunc, /*sq_length*/ --- 416,419 ---- *************** *** 433,451 **** 0, PyUnicode::deallocFunc, /* tp_dealloc */ - // @pymeth __print__|Used when the object is printed. PyUnicode::printFunc, /* tp_print */ PyUnicode::getattrFunc, /* tp_getattr */ 0, /* tp_setattr */ - // @pymeth __cmp__|Used when Unicode objects are compared. PyUnicode::compareFunc, /* tp_compare */ - // @pymeth __repr__|Used when repr(object) is used. PyUnicode::reprFunc, /* tp_repr */ 0, /* tp_as_number */ &PyUnicode_SequenceMethods, /* tp_as_sequence */ 0, /* tp_as_mapping */ - // @pymeth __hash__|Used when the hash value of an object is required PyUnicode::hashFunc, /* tp_hash */ 0, /* tp_call */ - // @pymeth __str__|Used when an (8-bit) string representation is required PyUnicode::strFunc, /* tp_str */ }; --- 434,447 ---- |
From: Mark H. <mha...@us...> - 2005-06-29 01:37:29
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13899/test Modified Files: test_win32file.py Log Message: Test queued completion ports. Index: test_win32file.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/test_win32file.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_win32file.py 2 Jun 2005 00:03:34 -0000 1.7 --- test_win32file.py 29 Jun 2005 01:37:21 -0000 1.8 *************** *** 1,4 **** import unittest ! import win32api, win32file, win32pipe, win32con, pywintypes, winerror import sys import os --- 1,4 ---- import unittest ! import win32api, win32file, win32pipe, win32con, pywintypes, winerror, win32event import sys import os *************** *** 178,181 **** --- 178,192 ---- self.failUnlessEqual(hr, winerror.ERROR_INVALID_HANDLE) + def testCompletionPortsQueued(self): + class Foo: pass + io_req_port = win32file.CreateIoCompletionPort(-1, None, 0, 0) + overlapped = pywintypes.OVERLAPPED() + overlapped.object = Foo() + win32file.PostQueuedCompletionStatus(io_req_port, 0, 99, overlapped) + errCode, bytes, key, overlapped = \ + win32file.GetQueuedCompletionStatus(io_req_port, win32event.INFINITE) + self.failUnlessEqual(errCode, 0) + self.failUnless(isinstance(overlapped.object, Foo)) + def _IOCPServerThread(self, handle, port, drop_overlapped_reference): overlapped = pywintypes.OVERLAPPED() |
From: Mark H. <mha...@us...> - 2005-06-29 01:36:21
|
Update of /cvsroot/pywin32/pywin32/isapi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13222 Modified Files: threaded_extension.py Log Message: typo in docstring Index: threaded_extension.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/threaded_extension.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** threaded_extension.py 26 Oct 2004 01:29:32 -0000 1.2 --- threaded_extension.py 29 Jun 2005 01:36:12 -0000 1.3 *************** *** 120,124 **** This class creates a thread-pool using a Windows completion port, and dispatches requests via this port. Sub-classes can generally ! implementeach connection request using blocking reads and writes, and the thread-pool will still provide decent response to the end user. --- 120,124 ---- This class creates a thread-pool using a Windows completion port, and dispatches requests via this port. Sub-classes can generally ! implement each connection request using blocking reads and writes, and the thread-pool will still provide decent response to the end user. |
From: Mark H. <mha...@us...> - 2005-06-28 12:36:12
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20512 Modified Files: PyOVERLAPPED.cpp win32file.i Log Message: Fix errors in OVERLAPPED.object reference counting for 'queued' completion status. Index: PyOVERLAPPED.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyOVERLAPPED.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PyOVERLAPPED.cpp 7 Nov 2003 03:58:17 -0000 1.8 --- PyOVERLAPPED.cpp 28 Jun 2005 12:35:54 -0000 1.9 *************** *** 203,206 **** --- 203,209 ---- /*static*/ void PyOVERLAPPED::deallocFunc(PyObject *ob) { + // set memory to zero, so our clunky check for an invalid object in + // win32file has more chance of success. + memset(ob, 0, sizeof(PyOVERLAPPED)); delete (PyOVERLAPPED *)ob; } Index: win32file.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32file.i,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** win32file.i 2 Jun 2005 00:03:33 -0000 1.47 --- win32file.i 28 Jun 2005 12:35:59 -0000 1.48 *************** *** 1237,1241 **** // makes it impossible it has died, but other functions do not as they // don't know if the OVERLAPPED will end up in a IOCP) ! if (po->ob_refcnt<=0) { PyErr_SetString(PyExc_RuntimeError, "This overlapped object has lost all its references so was destroyed"); return NULL; --- 1237,1244 ---- // makes it impossible it has died, but other functions do not as they // don't know if the OVERLAPPED will end up in a IOCP) ! // Also check it is a valid write pointer (we don't write to it, but all ! // PyObjects are writable, so that extra check is worthwhile) ! // This is NOT foolproof - screw up reference counting and things may die! ! if (po->ob_refcnt<=0 || po->ob_type==0 || IsBadWritePtr(po, sizeof(PyOVERLAPPED))) { PyErr_SetString(PyExc_RuntimeError, "This overlapped object has lost all its references so was destroyed"); return NULL; *************** *** 1262,1269 **** if (!po) return FALSE; ! PyOVERLAPPED::sMyOverlapped *pMyOverlapped = (PyOVERLAPPED::sMyOverlapped *)po; // Add a fake reference so the object lives while in the queue, and add the flag Py_INCREF(ob); ! pMyOverlapped->isArtificialReference = TRUE; *ppOverlapped = po->GetOverlapped(); return TRUE; --- 1265,1273 ---- if (!po) return FALSE; ! ! PyOVERLAPPED *pO = (PyOVERLAPPED *)po; // Add a fake reference so the object lives while in the queue, and add the flag Py_INCREF(ob); ! pO->m_overlapped.isArtificialReference = TRUE; *ppOverlapped = po->GetOverlapped(); return TRUE; |
From: Mark H. <mha...@us...> - 2005-06-28 12:34:52
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19489 Modified Files: win32apimodule.cpp Log Message: * Release the thread-lock during GetUserNameEx, GetComputerNameEx and GetComputerObjectName * win32api.GetConsoleTitle coudl return (0, 'No Error') when the console has no title - return an empty string in this case. Index: win32apimodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32apimodule.cpp,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** win32apimodule.cpp 2 May 2005 03:31:11 -0000 1.48 --- win32apimodule.cpp 28 Jun 2005 12:34:37 -0000 1.49 *************** *** 734,740 **** if (!PyArg_ParseTuple (args, ":GetConsoleTitle")) return NULL; ! char title[128]; // @pyseeapi GetConsoleTitle ! if (GetConsoleTitle(title, sizeof(title))==0) return ReturnAPIError("GetConsoleTitle"); return Py_BuildValue("s", title); --- 734,740 ---- if (!PyArg_ParseTuple (args, ":GetConsoleTitle")) return NULL; ! char title[128] = ""; // @pyseeapi GetConsoleTitle ! if (GetConsoleTitle(title, sizeof(title))==0 && ::GetLastError() != 0) return ReturnAPIError("GetConsoleTitle"); return Py_BuildValue("s", title); *************** *** 769,772 **** --- 769,773 ---- PyObject *ret = NULL; ULONG nSize=0; + BOOL ok; if (!PyArg_ParseTuple (args, "i:GetComputerNameEx", &fmt)) return NULL; *************** *** 780,784 **** if (!formattedname) return PyErr_NoMemory(); ! if (!myGetComputerNameEx(fmt,formattedname,&nSize)){ PyWin_SetAPIError("GetComputerNameEx"); goto done; --- 781,788 ---- if (!formattedname) return PyErr_NoMemory(); ! PyW32_BEGIN_ALLOW_THREADS ! ok = (*myGetComputerNameEx)(fmt,formattedname,&nSize); ! PyW32_END_ALLOW_THREADS ! if (!ok){ PyWin_SetAPIError("GetComputerNameEx"); goto done; *************** *** 802,805 **** --- 806,810 ---- PyObject *ret = NULL; ULONG nSize=0; + BOOL ok; if (!PyArg_ParseTuple (args, "i:GetComputerObjectName", &fmt)) return NULL; *************** *** 813,817 **** if (!formattedname) return PyErr_NoMemory(); ! if (!myGetComputerObjectName(fmt,formattedname,&nSize)){ PyWin_SetAPIError("GetComputerObjectName"); goto done; --- 818,826 ---- if (!formattedname) return PyErr_NoMemory(); ! PyW32_BEGIN_ALLOW_THREADS ! ok = (*myGetComputerObjectName)(fmt,formattedname,&nSize); ! PyW32_END_ALLOW_THREADS ! ! if (!ok){ PyWin_SetAPIError("GetComputerObjectName"); goto done; *************** *** 849,852 **** --- 858,862 ---- PyObject *ret = NULL; ULONG nSize=0; + BOOL ok; if (!PyArg_ParseTuple (args, "i:GetUserNameEx", &fmt)) return NULL; *************** *** 860,864 **** if (!formattedname) return PyErr_NoMemory(); ! if (!myGetUserNameEx(fmt,formattedname,&nSize)){ PyWin_SetAPIError("GetUserNameEx"); goto done; --- 870,877 ---- if (!formattedname) return PyErr_NoMemory(); ! PyW32_BEGIN_ALLOW_THREADS ! ok = (*myGetUserNameEx)(fmt,formattedname,&nSize); ! PyW32_END_ALLOW_THREADS ! if (!ok){ PyWin_SetAPIError("GetUserNameEx"); goto done; |
From: Mark H. <mha...@us...> - 2005-06-28 12:33:05
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18800 Modified Files: win32gui.i Log Message: PostMessage's wparam and lparam params now default to 0 - like SendMessage Index: win32gui.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32gui.i,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** win32gui.i 24 Jun 2005 03:27:58 -0000 1.66 --- win32gui.i 28 Jun 2005 12:32:47 -0000 1.67 *************** *** 1667,1673 **** // @pyparm int|hwnd||The handle to the Window // @pyparm int|message||The ID of the message to post ! // @pyparm int|wparam||An integer whose value depends on the message ! // @pyparm int|lparam||An integer whose value depends on the message ! BOOLAPI PostMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); // @pyswig |PostThreadMessage| --- 1667,1673 ---- // @pyparm int|hwnd||The handle to the Window // @pyparm int|message||The ID of the message to post ! // @pyparm int|wparam|0|An integer whose value depends on the message ! // @pyparm int|lparam|0|An integer whose value depends on the message ! BOOLAPI PostMessage(HWND hwnd, UINT msg, WPARAM wParam = 0, LPARAM lParam = 0); // @pyswig |PostThreadMessage| |
From: Mark H. <mha...@us...> - 2005-06-27 12:40:15
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26448/client Modified Files: genpy.py Log Message: Fix [ 1202308 ] genpy.py doesn't catch all dispatchable interfaces. Index: genpy.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/genpy.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** genpy.py 12 Apr 2005 04:27:08 -0000 1.46 --- genpy.py 27 Jun 2005 12:40:05 -0000 1.47 *************** *** 24,28 **** error = "makepy.error" ! makepy_version = "0.4.93" # Written to generated file. GEN_FULL="full" --- 24,28 ---- error = "makepy.error" ! makepy_version = "0.4.94" # Written to generated file. GEN_FULL="full" *************** *** 678,682 **** for info, info_type, refType, doc, refAttr, flags in coclass_info: # sys.stderr.write("Attr typeflags for coclass referenced object %s=%d (%d), typekind=%d\n" % (name, refAttr.wTypeFlags, refAttr.wTypeFlags & pythoncom.TYPEFLAG_FDUAL,refAttr.typekind)) ! if refAttr.typekind == pythoncom.TKIND_DISPATCH: clsid = refAttr[0] if oleItems.has_key(clsid): --- 678,683 ---- for info, info_type, refType, doc, refAttr, flags in coclass_info: # sys.stderr.write("Attr typeflags for coclass referenced object %s=%d (%d), typekind=%d\n" % (name, refAttr.wTypeFlags, refAttr.wTypeFlags & pythoncom.TYPEFLAG_FDUAL,refAttr.typekind)) ! if refAttr.typekind == pythoncom.TKIND_DISPATCH or \ ! (refAttr.typekind == pythoncom.TKIND_INTERFACE and refAttr[11] & pythoncom.TYPEFLAG_FDISPATCHABLE): clsid = refAttr[0] if oleItems.has_key(clsid): *************** *** 704,712 **** info, infotype, doc, attr = type_info_tuple oleItem = vtableItem = None ! if infotype == pythoncom.TKIND_DISPATCH: oleItem = DispatchItem(info, attr, doc) # If this DISPATCH interface dual, then build that too. if (attr.wTypeFlags & pythoncom.TYPEFLAG_FDUAL): - # sys.stderr.write("interface " + doc[0] + " is not dual\n"); # Get the vtable interface refhtype = info.GetRefTypeOfImplType(-1) --- 705,713 ---- info, infotype, doc, attr = type_info_tuple oleItem = vtableItem = None ! if infotype == pythoncom.TKIND_DISPATCH or \ ! (infotype == pythoncom.TKIND_INTERFACE and attr[11] & pythoncom.TYPEFLAG_FDISPATCHABLE): oleItem = DispatchItem(info, attr, doc) # If this DISPATCH interface dual, then build that too. if (attr.wTypeFlags & pythoncom.TYPEFLAG_FDUAL): # Get the vtable interface refhtype = info.GetRefTypeOfImplType(-1) |
From: Mark H. <mha...@us...> - 2005-06-27 11:02:58
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9704/win32com/test Modified Files: testPyComTest.py Log Message: Fix [ 1203980 ] Universal Gateway mishandles ByRef Variant arguments Index: testPyComTest.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testPyComTest.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** testPyComTest.py 8 Jun 2005 05:19:04 -0000 1.21 --- testPyComTest.py 27 Jun 2005 11:02:42 -0000 1.22 *************** *** 173,176 **** --- 173,186 ---- if o.GetSetInterface(o).__class__ != o.__class__: raise error, "GetSetDispatch failed" + if o.GetSetVariant(4) != 4: + raise error, "GetSetVariant (int) failed" + if o.GetSetVariant("foo") != "foo": + raise error, "GetSetVariant (str) failed" + if o.GetSetVariant(o) != o: + raise error, "GetSetVariant (dispatch) failed" + if o.TestByRefVariant(2) != 4: + raise error, "TestByRefVariant failed" + if o.TestByRefString("Foo") != "FooFoo": + raise error, "TestByRefString failed" # Pass some non-sequence objects to our array decoder, and watch it fail. |
From: Mark H. <mha...@us...> - 2005-06-27 11:02:56
|
Update of /cvsroot/pywin32/pywin32/com/TestSources/PyCOMTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9704/TestSources/PyCOMTest Modified Files: PyCOMImpl.cpp PyCOMImpl.h PyCOMTest.idl Log Message: Fix [ 1203980 ] Universal Gateway mishandles ByRef Variant arguments Index: PyCOMTest.idl =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/TestSources/PyCOMTest/PyCOMTest.idl,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PyCOMTest.idl 31 May 2005 12:37:18 -0000 1.10 --- PyCOMTest.idl 27 Jun 2005 11:02:41 -0000 1.11 *************** *** 174,177 **** --- 174,180 ---- HRESULT GetSetDispatch([in] IDispatch *indisp, [out, retval] IDispatch **outdisp); HRESULT GetSetUnknown([in] IUnknown *inunk, [out, retval] IUnknown **outunk); + HRESULT GetSetVariant([in] VARIANT vin, [out, retval] VARIANT *vout); + HRESULT TestByRefVariant([in, out] VARIANT *v); + HRESULT TestByRefString([in, out] BSTR *v); HRESULT TakeByRefTypedDispatch([in, out] IPyCOMTest **inout); HRESULT TakeByRefDispatch([in, out] IDispatch **inout); Index: PyCOMImpl.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/TestSources/PyCOMTest/PyCOMImpl.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PyCOMImpl.h 31 May 2005 12:37:18 -0000 1.9 --- PyCOMImpl.h 27 Jun 2005 11:02:41 -0000 1.10 *************** *** 65,68 **** --- 65,71 ---- STDMETHOD(GetSetDispatch)(IDispatch *indisp, IDispatch **outdisp); STDMETHOD(GetSetUnknown)(IUnknown *inunk, IUnknown **outunk); + STDMETHOD(GetSetVariant)(VARIANT vin, VARIANT *vout); + STDMETHOD(TestByRefVariant)(VARIANT *v); + STDMETHOD(TestByRefString)(BSTR *v); STDMETHOD(TakeByRefTypedDispatch)(IPyCOMTest **inout); STDMETHOD(TakeByRefDispatch)(IDispatch **inout); Index: PyCOMImpl.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/TestSources/PyCOMTest/PyCOMImpl.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PyCOMImpl.cpp 31 May 2005 12:37:18 -0000 1.10 --- PyCOMImpl.cpp 27 Jun 2005 11:02:40 -0000 1.11 *************** *** 195,198 **** --- 195,223 ---- } + STDMETHODIMP CPyCOMTest::GetSetVariant(VARIANT var, VARIANT *out) + { + VariantClear(out); // necessary? + return VariantCopy(out, &var); + } + + STDMETHODIMP CPyCOMTest::TestByRefVariant(VARIANT *v) + { + if (V_VT(v)==VT_I4) { + V_I4(v) *= 2; + return S_OK; + } + return E_FAIL; + } + + STDMETHODIMP CPyCOMTest::TestByRefString(BSTR *v) + { + BSTR out = SysAllocStringLen(NULL, SysStringLen(*v)*2); + wcscpy(out, *v); + wcscat(out, *v); + SysFreeString(*v); + *v = out; + return S_OK; + } + STDMETHODIMP CPyCOMTest::TakeByRefTypedDispatch(IPyCOMTest **inout) { *************** *** 462,465 **** --- 487,494 ---- CHECK_TRUE(outstr == L"FooFoo"); + instr = L"Foo"; + CHECK_HR(tester->TestByRefString(&instr)); + CHECK_TRUE(instr == L"FooFoo"); + // Arrays int result; *************** *** 489,492 **** --- 518,536 ---- CComPtr<IPyCOMTest>obresult; CHECK_HR(tester->GetSetInterface(param, &obresult)); + + VARIANT v1, v2; + VariantInit(&v1); + VariantInit(&v2); + V_VT(&v1) = VT_I4; + V_I4(&v1) = 99; + CHECK_HR(tester->GetSetVariant(v1, &v2)); + CHECK_TRUE(V_VT(&v2)==VT_I4); + CHECK_TRUE(V_I4(&v2)==99); + CHECK_HR(tester->TestByRefVariant(&v2)); + CHECK_TRUE(V_VT(&v2)==VT_I4); + CHECK_TRUE(V_I4(&v2)==198); + VariantClear(&v1); + VariantClear(&v2); + // Make a vtable call on the returned object, so we // crash if a bad vtable. Don't care about the value tho. |
From: Mark H. <mha...@us...> - 2005-06-27 11:02:55
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9704/win32com/src Modified Files: oleargs.cpp univgw_dataconv.cpp Log Message: Fix [ 1203980 ] Universal Gateway mishandles ByRef Variant arguments Index: univgw_dataconv.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/univgw_dataconv.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** univgw_dataconv.cpp 31 May 2005 12:36:02 -0000 1.8 --- univgw_dataconv.cpp 27 Jun 2005 11:02:41 -0000 1.9 *************** *** 694,703 **** obArg = PyCom_PyObjectFromVariant(&var); break; ! case VT_VARIANT: { ! // A pointer to a _real_ variant. ! VARIANT *pVar = (VARIANT *)pb; ! obArg = PyCom_PyObjectFromVariant(pVar); break; - } case VT_LPSTR: obArg = PyString_FromString(*(CHAR **)pb); --- 694,704 ---- obArg = PyCom_PyObjectFromVariant(&var); break; ! case VT_VARIANT: ! // A _real_ variant. ! if (bIsByRef) ! obArg = PyCom_PyObjectFromVariant(*(VARIANT**)pb); ! else ! obArg = PyCom_PyObjectFromVariant((VARIANT*)pb); break; case VT_LPSTR: obArg = PyString_FromString(*(CHAR **)pb); Index: oleargs.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/oleargs.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** oleargs.cpp 31 May 2005 12:36:02 -0000 1.29 --- oleargs.cpp 27 Jun 2005 11:02:41 -0000 1.30 *************** *** 733,738 **** break; }; ! default: ! OleSetTypeError("The VARIANT type is not supported for SAFEARRAYS"); } if (FAILED(hres)) { --- 733,741 ---- break; }; ! default: { ! TCHAR buf[200]; ! wsprintf(buf, _T("The VARIANT type 0x%x is not supported for SAFEARRAYS"), vt); ! OleSetTypeErrorT(buf); ! } } if (FAILED(hres)) { |
From: Mark H. <mha...@us...> - 2005-06-27 11:02:50
|
Update of /cvsroot/pywin32/pywin32/com/win32com/servers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9704/win32com/servers Modified Files: test_pycomtest.py Log Message: Fix [ 1203980 ] Universal Gateway mishandles ByRef Variant arguments Index: test_pycomtest.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/servers/test_pycomtest.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_pycomtest.py 8 Jun 2005 05:19:04 -0000 1.9 --- test_pycomtest.py 27 Jun 2005 11:02:41 -0000 1.10 *************** *** 48,51 **** --- 48,60 ---- return wrap(self) + def GetSetVariant(self, indisp): + return indisp + + def TestByRefVariant(self, v): + return v * 2 + + def TestByRefString(self, v): + return v * 2 + # Result is of type IPyCOMTest def GetSetInterfaceArray(self, ininterface): |
From: Mark H. <mha...@us...> - 2005-06-26 12:59:43
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9022 Modified Files: win32bitmap.cpp Log Message: Fix [ 1208530 ] PyBitmap.GetBitmapBits Memory Leak Index: win32bitmap.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32bitmap.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** win32bitmap.cpp 1 Sep 1999 23:33:00 -0000 1.1 --- win32bitmap.cpp 26 Jun 2005 12:59:33 -0000 1.2 *************** *** 467,489 **** BITMAP bm; if (pBitmap->GetObject(sizeof(bm), &bm)==0) ! RETURN_ERR("GetObject failed on bitmap"); ! UINT cnt = bm.bmHeight*bm.bmWidthBytes*bm.bmPlanes; ! HGLOBAL hMem = GlobalAlloc(GHND, cnt); ! if (!hMem) { ! RETURN_ERR("GlobalAlloc failed on bitmap"); ! } ! LPBYTE lpbDst=(LPBYTE)GlobalLock(hMem); HBITMAP handle = (HBITMAP)pBitmap->GetSafeHandle(); ! DWORD bytes = GetBitmapBits(handle, cnt, (LPVOID)lpbDst); ! if (bytes != (DWORD)cnt) { ! GlobalUnlock(hMem); ! RETURN_ERR("GetBitmapBits failed on bitmap"); ! } PyObject* rc = PyTuple_New(cnt); for (UINT i = 0; i < cnt; i++) { ! PyTuple_SetItem(rc, i, Py_BuildValue("i", (int)lpbDst[i])); } ! GlobalUnlock(hMem); ! return rc; } --- 467,487 ---- BITMAP bm; if (pBitmap->GetObject(sizeof(bm), &bm)==0) ! RETURN_ERR("GetObject failed on bitmap"); ! UINT cnt = bm.bmHeight*bm.bmWidthBytes*bm.bmPlanes; ! char *bits = (char *)malloc(cnt); ! if (!bits) ! return PyErr_NoMemory(); HBITMAP handle = (HBITMAP)pBitmap->GetSafeHandle(); ! DWORD bytes = GetBitmapBits(handle, cnt, (void *)bits); ! if (bytes != (DWORD)cnt) { ! free(bits); ! RETURN_ERR("GetBitmapBits failed on bitmap"); ! } PyObject* rc = PyTuple_New(cnt); for (UINT i = 0; i < cnt; i++) { ! PyTuple_SetItem(rc, i, Py_BuildValue("i", (int)bits[i])); } ! free(bits); ! return rc; } |
From: Mark H. <mha...@us...> - 2005-06-26 12:47:06
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2992 Modified Files: win32serviceutil.py Log Message: [ 1208081 ] Fix: WaitForServiceStatus doesn't work for remote boxes Index: win32serviceutil.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/win32serviceutil.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** win32serviceutil.py 17 Jun 2005 07:30:54 -0000 1.20 --- win32serviceutil.py 26 Jun 2005 12:46:57 -0000 1.21 *************** *** 342,346 **** should have already requested the service to enter that state""" for i in range(waitSecs*4): ! now_status = QueryServiceStatus(serviceName)[1] if now_status == status: break --- 342,346 ---- should have already requested the service to enter that state""" for i in range(waitSecs*4): ! now_status = QueryServiceStatus(serviceName, machine)[1] if now_status == status: break |
From: Mark H. <mha...@us...> - 2005-06-24 03:28:09
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28745 Modified Files: win32gui.i Log Message: * Add support for GetObject() returning a BITMAP object. * Add SetStretchBltMode() Index: win32gui.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32gui.i,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** win32gui.i 27 May 2005 07:13:00 -0000 1.65 --- win32gui.i 24 Jun 2005 03:27:58 -0000 1.66 *************** *** 852,855 **** --- 852,961 ---- %{ + // Support for a BITMAP object. + class PyBITMAP : public PyObject + { + public: + BITMAP *GetBM() {return &m_BITMAP;} + PyBITMAP(void); + PyBITMAP(const BITMAP *pBM); + ~PyBITMAP(); + + /* Python support */ + 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 ) + BITMAP m_BITMAP; + }; + #define PyBITMAP_Check(ob) ((ob)->ob_type == &PyBITMAPType) + + // @object PyBITMAP|A Python object, representing an PyBITMAP structure + // @comm Typically you get one of these from GetObject. Note that currently + // the bitmap bits are not exposed via this type - but the value of the + // pointer is. You can use the struct and win32gui functions to unpack + // these bits manually if you really need them. + // Note that you are still responsible for the life of the win32 bitmap object. + // The object can then be passed to any function which takes an BITMAP object + PyTypeObject PyBITMAPType = + { + PyObject_HEAD_INIT(&PyType_Type) + 0, + "PyBITMAP", + sizeof(PyBITMAP), + 0, + PyBITMAP::deallocFunc, /* tp_dealloc */ + 0, /* tp_print */ + PyBITMAP::getattr, /* tp_getattr */ + PyBITMAP::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 */ + }; + #undef OFF + #define OFF(e) offsetof(PyBITMAP, e) + + /*static*/ struct memberlist PyBITMAP::memberlist[] = { + {"bmType", T_LONG, OFF(m_BITMAP.bmType)}, // @prop integer|bmType| + {"bmWidth", T_LONG, OFF(m_BITMAP.bmWidth)}, // @prop integer|bmWidth| + {"bmHeight", T_LONG, OFF(m_BITMAP.bmHeight)}, // @prop integer|bmHeight| + {"bmWidthBytes", T_LONG, OFF(m_BITMAP.bmWidthBytes)}, // @prop integer|bmWidthBytes| + {"bmPlanes", T_SHORT, OFF(m_BITMAP.bmPlanes)}, // @prop integer|bmPlanes| + {"bmBitsPixel", T_SHORT, OFF(m_BITMAP.bmBitsPixel)}, // @prop integer|| + {NULL} + }; + + + PyBITMAP::PyBITMAP() + { + ob_type = &PyBITMAPType; + _Py_NewReference(this); + memset(&m_BITMAP, 0, sizeof(m_BITMAP)); + } + + PyBITMAP::PyBITMAP(const BITMAP *pBM) + { + ob_type = &PyBITMAPType; + _Py_NewReference(this); + memcpy(&m_BITMAP, pBM, sizeof(m_BITMAP)); + } + + PyBITMAP::~PyBITMAP(void) + { + } + + PyObject *PyBITMAP::getattr(PyObject *self, char *name) + { + PyBITMAP *pB = (PyBITMAP *)self; + if (strcmp("bmBits", name)==0) { + return PyLong_FromVoidPtr(pB->m_BITMAP.bmBits); + } + return PyMember_Get((char *)self, memberlist, name); + } + + int PyBITMAP::setattr(PyObject *self, char *name, PyObject *v) + { + if (v == NULL) { + PyErr_SetString(PyExc_AttributeError, "can't delete BITMAP attributes"); + return -1; + } + if (strcmp("bmBits", name)==0) { + PyBITMAP *pB = (PyBITMAP *)self; + pB->m_BITMAP.bmBits = PyLong_AsVoidPtr(v); + return PyErr_Occurred() ? -1 : 0; + } + return PyMember_Set((char *)self, memberlist, name, v); + } + + /*static*/ void PyBITMAP::deallocFunc(PyObject *ob) + { + delete (PyBITMAP *)ob; + } // Support for a LOGFONT object. *************** *** 1060,1063 **** --- 1166,1175 ---- return new PyLOGFONT(&lf); } + case OBJ_BITMAP: { + BITMAP bm; + if (GetObject((HGDIOBJ)hob, sizeof(BITMAP), &bm)==0) + return PyWin_SetAPIError("GetObject"); + return new PyBITMAP(&bm); + } default: PyErr_SetString(PyExc_ValueError, "This GDI object type is not supported"); *************** *** 2071,2074 **** --- 2183,2193 ---- ); + // @pyswig int|SetStretchBltMode| + // @rdesc If the function succeeds, the return value is the previous stretching mode. + // <nl>If the function fails, the return value is zero. + int SetStretchBltMode(HDC dc, int mode); + // @pyparm int|dc|| + // @pyparm int|mode|| + %ifdef WINXPGUI // @pyswig |MaskBlt|Combines the color data for the source and destination |
From: Mark H. <mha...@us...> - 2005-06-21 17:52:14
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23638 Modified Files: setup.py Log Message: Patch from Trent to do a better job at finding the platform SDK. Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** setup.py 27 May 2005 07:09:35 -0000 1.10 --- setup.py 21 Jun 2005 13:54:18 -0000 1.11 *************** *** 281,290 **** # (Note that just having them in INCLUDE/LIB does *not* work - # distutils thinks it knows better, and resets those vars. ! try: ! key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, ! r"Software\Microsoft\MicrosoftSDK\Directories") ! sdk_dir, ignore = _winreg.QueryValueEx(key, "Install Dir") ! except OSError: ! sdk_dir = None if sdk_dir: extra = os.path.join(sdk_dir, 'include') --- 281,285 ---- # (Note that just having them in INCLUDE/LIB does *not* work - # distutils thinks it knows better, and resets those vars. ! sdk_dir = find_platform_sdk_dir() if sdk_dir: extra = os.path.join(sdk_dir, 'include') *************** *** 1031,1034 **** --- 1026,1098 ---- swig_include_files = "mapilib adsilib".split() + + def find_platform_sdk_dir(): + # Finding the Platform SDK install dir is a treat. There can be some + # dead ends so we only consider the job done if we find the "windows.h" + # landmark. + DEBUG = False + landmark = "include\\windows.h" + # 1. The use might have their current environment setup for the + # SDK, in which case the "MSSdk" env var is set. + sdkdir = os.environ.get("MSSdk") + if sdkdir: + if DEBUG: + print "PSDK: try %MSSdk%: '%s'" % sdkdir + if os.path.isfile(os.path.join(sdkdir, landmark)): + return sdkdir + # 2. The "Install Dir" value in the + # HKLM\Software\Microsoft\MicrosoftSDK\Directories registry key + # sometimes points to the right thing. However, after upgrading to + # the "Platform SDK for Windows Server 2003 SP1" this is dead end. + try: + key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, + r"Software\Microsoft\MicrosoftSDK\Directories") + sdkdir, ignore = _winreg.QueryValueEx(key, "Install Dir") + except EnvironmentError: + pass + else: + if DEBUG: + print r"PSDK: try 'HKLM\Software\Microsoft\MicrosoftSDK"\ + "\Directories\Install Dir': '%s'" % sdkdir + if os.path.isfile(os.path.join(sdkdir, landmark)): + return sdkdir + # 3. Each installed SDK (not just the platform SDK) seems to have GUID + # subkey of HKLM\Software\Microsoft\MicrosoftSDK\InstalledSDKs and + # it *looks* like the latest installed Platform SDK will be the + # only one with an "Install Dir" sub-value. + try: + key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, + r"Software\Microsoft\MicrosoftSDK\InstalledSDKs") + i = 0 + while True: + guid = _winreg.EnumKey(key, i) + guidkey = _winreg.OpenKey(key, guid) + try: + sdkdir, ignore = _winreg.QueryValueEx(guidkey, "Install Dir") + except EnvironmentError: + pass + else: + if DEBUG: + print r"PSDK: try 'HKLM\Software\Microsoft\MicrosoftSDK"\ + "\InstallSDKs\%s\Install Dir': '%s'"\ + % (guid, sdkdir) + if os.path.isfile(os.path.join(sdkdir, landmark)): + return sdkdir + i += 1 + except EnvironmentError: + pass + # 4. Failing this just try a few well-known default install locations. + progfiles = os.environ.get("ProgramFiles", r"C:\Program Files") + defaultlocs = [ + os.path.join(progfiles, "Microsoft Platform SDK"), + os.path.join(progfiles, "Microsoft SDK"), + ] + for sdkdir in defaultlocs: + if DEBUG: + print "PSDK: try default location: '%s'" % sdkdir + if os.path.isfile(os.path.join(sdkdir, landmark)): + return sdkdir + + # Helper to allow our script specifications to include wildcards. def expand_modules(module_dir): |