pywin32-checkins Mailing List for Python for Windows Extensions (Page 109)
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-09-20 12:46:54
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10130 Modified Files: genpy.py Log Message: Ignore errors loading a dependent typelib. Index: genpy.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/genpy.py,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** genpy.py 27 Jun 2005 12:40:05 -0000 1.47 --- genpy.py 20 Sep 2005 12:46:46 -0000 1.48 *************** *** 665,669 **** for j in range(attr[8]): flags = info.GetImplTypeFlags(j) ! refType = info.GetRefTypeInfo(info.GetRefTypeOfImplType(j)) refAttr = refType.GetTypeAttr() child_infos.append( (info, refAttr.typekind, refType, refType.GetDocumentation(-1), refAttr, flags) ) --- 665,673 ---- for j in range(attr[8]): flags = info.GetImplTypeFlags(j) ! try: ! refType = info.GetRefTypeInfo(info.GetRefTypeOfImplType(j)) ! except pythoncom.com_error: ! # Can't load a dependent typelib? ! continue refAttr = refType.GetTypeAttr() child_infos.append( (info, refAttr.typekind, refType, refType.GetDocumentation(-1), refAttr, flags) ) |
From: Mark H. <mha...@us...> - 2005-09-20 12:45:22
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9664 Modified Files: PythonService.cpp Log Message: SetEventSourceName takes an optional second param which indicates if the event source should be registered immediately (True) or when the first event log record is written (False - the default and old behaviour) Index: PythonService.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PythonService.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** PythonService.cpp 11 Apr 2005 00:34:30 -0000 1.18 --- PythonService.cpp 20 Sep 2005 12:45:07 -0000 1.19 *************** *** 46,49 **** --- 46,50 ---- static void ReportPythonError(DWORD); static BOOL ReportError(DWORD, LPCTSTR *inserts = NULL, WORD errorType = EVENTLOG_ERROR_TYPE); + static void CheckRegisterEventSourceFile(); #include "PythonServiceMessages.h" *************** *** 286,290 **** { PyObject *obName; ! if (!PyArg_ParseTuple(args, "O:SetEventSourceName", &obName)) return NULL; TCHAR *msg; --- 287,302 ---- { PyObject *obName; ! // @pyparm string|sourceName||The event source name ! // @pyparm bool|registerNow|False|If True, the event source name in the ! // registry will be updated immediately. ! // If False, the name will be registered the first time an event log entry ! // is written via any pythonservice methods (or possibly never if no record ! // if written). ! // <nl>Note that in some cases, the service itself will not have permission ! // to write the event source in the registry. Therefore, it would be ! // prudent for your installation program to call this function with ! // registerNow=True, to ensure your services can write useful entries. ! int registerNow = 0; ! if (!PyArg_ParseTuple(args, "O|i:SetEventSourceName", &obName, ®isterNow)) return NULL; TCHAR *msg; *************** *** 295,298 **** --- 307,312 ---- PyWinObject_FreeTCHAR(msg); g_bRegisteredEventSource = FALSE; // so this name re-registered. + if (registerNow) + CheckRegisterEventSourceFile(); Py_INCREF(Py_None); return Py_None; |
From: Mark H. <mha...@us...> - 2005-09-20 12:41:38
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9182 Modified Files: win32security.i Log Message: Release the GIL while calling out to potentially slow functions. Index: win32security.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32security.i,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** win32security.i 29 Aug 2005 21:40:53 -0000 1.28 --- win32security.i 20 Sep 2005 12:41:31 -0000 1.29 *************** *** 843,847 **** --- 843,849 ---- // Get the SID size. + Py_BEGIN_ALLOW_THREADS LookupAccountName(szSystemName, szAcctName, pSid, &sidSize, refDomain, &refDomainSize, &sidType); + Py_END_ALLOW_THREADS if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) { *************** *** 901,905 **** goto done; ! if (!LookupAccountSid(szSystemName, pSid, szRetAcctName, &retAcctNameSize, refDomain, &refDomainSize, &sidType)) { PyWin_SetAPIError("LookupAccountSid"); goto done; --- 903,912 ---- goto done; ! BOOL ok; ! Py_BEGIN_ALLOW_THREADS ! ok = LookupAccountSid(szSystemName, pSid, szRetAcctName, &retAcctNameSize, refDomain, &refDomainSize, &sidType); ! Py_END_ALLOW_THREADS ! ! if (!ok) { PyWin_SetAPIError("LookupAccountSid"); goto done; |
From: Mark H. <mha...@us...> - 2005-09-20 12:16:36
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4895 Modified Files: win32serviceutil.py Log Message: More reliable debug mode detection (endwith '_d' rather than any '_d') Index: win32serviceutil.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/win32serviceutil.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** win32serviceutil.py 26 Jun 2005 12:46:57 -0000 1.21 --- win32serviceutil.py 20 Sep 2005 12:16:22 -0000 1.22 *************** *** 16,20 **** # use it. Otherwise look down sys.path, and the global PATH environment. if exeName is None: ! if win32service.__file__.find("_d")>=0: exeName = "PythonService_d.exe" else: --- 16,20 ---- # use it. Otherwise look down sys.path, and the global PATH environment. if exeName is None: ! if os.path.splitext(win32service.__file__)[0].endswith("_d"): exeName = "PythonService_d.exe" else: |
From: Roger U. <ru...@us...> - 2005-09-20 05:24:55
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24234/win32/src Modified Files: win32consolemodule.cpp Log Message: Throw an error if attempt is made to delete an attribute of PyINPUT_RECORD Index: win32consolemodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32consolemodule.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** win32consolemodule.cpp 20 Sep 2005 01:59:54 -0000 1.4 --- win32consolemodule.cpp 20 Sep 2005 05:24:46 -0000 1.5 *************** *** 539,543 **** if (name==NULL) return -1; ! // ??? should probably add some EventType/attribute validation for everything done thru // the normal structmember api also ??? --- 539,546 ---- if (name==NULL) return -1; ! if (obvalue==NULL){ ! PyErr_SetString(PyExc_AttributeError, "PyINPUT_RECORD members can't be removed"); ! return -1; ! } // ??? should probably add some EventType/attribute validation for everything done thru // the normal structmember api also ??? |
From: Roger U. <ru...@us...> - 2005-09-20 02:00:10
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23912/win32/src Modified Files: win32consolemodule.cpp Log Message: Add a PyINPUT_RECORD object, and ReadConsoleInput, WriteConsoleInput, and PeekConsoleInput that use it Make all params to CreateConsoleScreenBuffer optional Index: win32consolemodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32consolemodule.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** win32consolemodule.cpp 14 Sep 2005 03:38:13 -0000 1.3 --- win32consolemodule.cpp 20 Sep 2005 01:59:54 -0000 1.4 *************** *** 18,21 **** --- 18,23 ---- typedef BOOL (WINAPI *GetConsoleDisplayModefunc)(LPDWORD); static GetConsoleDisplayModefunc pfnGetConsoleDisplayMode=NULL; + typedef BOOL (WINAPI *SetConsoleDisplayModefunc)(HANDLE, DWORD, PCOORD); + static SetConsoleDisplayModefunc pfnSetConsoleDisplayMode; typedef BOOL (WINAPI *AttachConsolefunc)(DWORD); static AttachConsolefunc pfnAttachConsole=NULL; *************** *** 43,46 **** --- 45,49 ---- static SetConsoleFontfunc pfnSetConsoleFont=NULL; + // convert python object to array of WORDS/USHORTS // ?????? should move this into Pywintypes, similar code used in win32security_ds.cpp *************** *** 98,101 **** --- 101,120 ---- } + // convert python object to single unicode character + // object *must* be unicode, and onechar should be allocated for a single WCHAR + // used mostly for putting a WCHAR inside an existing struct - would be nice if the + // structmember framework provided a format code for this + BOOL PyWinObject_AsSingleWCHAR(PyObject *obchar, WCHAR *onechar) + { + if (!PyUnicode_Check(obchar) || (PyUnicode_GET_SIZE(obchar)!=1)){ + PyErr_SetString(PyExc_ValueError, "Object must be a single unicode character"); + return FALSE; + } + if (PyUnicode_AsWideChar((PyUnicodeObject *)obchar, onechar, 1)==-1) + return FALSE; + return TRUE; + } + + // @object PySMALL_RECT|Wrapper for a SMALL_RECT struct // Create using PySMALL_RECTType(Left, Top, Right, Bottom). All params optional, defaulting to 0 *************** *** 106,110 **** static struct PyMemberDef members[]; // static struct PyMethodDef methods[]; ! static void deallocFunc(PyObject *ob); SMALL_RECT rect; PySMALL_RECT(SMALL_RECT *); --- 125,129 ---- static struct PyMemberDef members[]; // static struct PyMethodDef methods[]; ! static void tp_dealloc(PyObject *ob); SMALL_RECT rect; PySMALL_RECT(SMALL_RECT *); *************** *** 112,118 **** static PyObject *tp_new(PyTypeObject *tp, PyObject *args, PyObject *kwargs); static PyObject *tp_str(PyObject *self); - protected: - ~PySMALL_RECT(); - }; --- 131,134 ---- *************** *** 139,143 **** sizeof(PySMALL_RECT), 0, ! PySMALL_RECT::deallocFunc, 0, // tp_print 0, // tp_getattr --- 155,159 ---- sizeof(PySMALL_RECT), 0, ! PySMALL_RECT::tp_dealloc, 0, // tp_print 0, // tp_getattr *************** *** 214,222 **** } ! PySMALL_RECT::~PySMALL_RECT() ! { ! } ! ! void PySMALL_RECT::deallocFunc(PyObject *ob) { delete (PySMALL_RECT *)ob; --- 230,234 ---- } ! void PySMALL_RECT::tp_dealloc(PyObject *ob) { delete (PySMALL_RECT *)ob; *************** *** 376,380 **** } ! BOOL PyCOORD_check(PyObject *ob) { if (ob->ob_type!=&PyCOORDType){ --- 388,392 ---- } ! BOOL PyCOORD_Check(PyObject *ob) { if (ob->ob_type!=&PyCOORDType){ *************** *** 394,398 **** return FALSE; } ! if (!PyCOORD_check(obcoord)) return FALSE; *ppcoord=&((PyCOORD *)obcoord)->coord; --- 406,410 ---- return FALSE; } ! if (!PyCOORD_Check(obcoord)) return FALSE; *ppcoord=&((PyCOORD *)obcoord)->coord; *************** *** 409,412 **** --- 421,750 ---- + // @object PyINPUT_RECORD|Interface to the INPUT_RECORD struct used with console IO functions. Create using PyINPUT_RECORDType(EventType) + // @comm Only attributes that apply to each particular EventType can be accessed:<nl> + // KEY_EVENT: KeyDown, RepeatCount, VirtualKeyCode, VirtualScanCode, ControlKeyState<nl> + // MOUSE_EVENT: MousePosition, ButtonState, ControlKeyState, EventFlags<nl> + // WINDOW_BUFFER_SIZE_EVENT: Size<nl> + // FOCUS_EVENT: SetFocus<nl> + // MENU_EVENT: CommandId<nl> + + class PyINPUT_RECORD : public PyObject + { + public: + static struct PyMemberDef members[]; + // static struct PyMethodDef methods[]; + static void tp_dealloc(PyObject *self); + INPUT_RECORD input_record; + PyINPUT_RECORD(INPUT_RECORD *); + PyINPUT_RECORD(WORD EventType); + PyCOORD *obcoord; + static PyObject *tp_new(PyTypeObject *tp, PyObject *args, PyObject *kwargs); + static PyObject *tp_str(PyObject *self); + static PyObject *tp_getattro(PyObject *self, PyObject *obname); + static int tp_setattro(PyObject *self, PyObject *obname, PyObject *obvalue); + }; + + + // Many of these are handled manually in PyINPUT_RECORD::tp_setattro and tp_getattro, + // but kept here so they are visible + struct PyMemberDef PyINPUT_RECORD::members[] = { + // @prop int|EventType|One of KEY_EVENT, MOUSE_EVENT, WINDOW_BUFFER_SIZE_EVENT, MENU_EVENT, FOCUS_EVENT. Cannot be changed after object is created + {"EventType", T_USHORT, offsetof(PyINPUT_RECORD, input_record.EventType), READONLY, + "One of KEY_EVENT, MOUSE_EVENT, WINDOW_BUFFER_SIZE_EVENT, MENU_EVENT, FOCUS_EVENT. Cannot be changed after object is created"}, + // @prop boolean|KeyDown|True for a key press, False for key release + {"KeyDown", T_LONG, offsetof(PyINPUT_RECORD, input_record.Event.KeyEvent.bKeyDown), 0, "True for a key press, False for key release"}, + // @prop int|RepeatCount|Nbr of repeats generated (key was held down if >1) + {"RepeatCount", T_USHORT, offsetof(PyINPUT_RECORD, input_record.Event.KeyEvent.wRepeatCount), 0, "Nbr of repeats generated (key was held down if >1)"}, + // @prop int|VirtualKeyCode|Device-independent key code, win32con.VK_* + {"VirtualKeyCode", T_USHORT, offsetof(PyINPUT_RECORD, input_record.Event.KeyEvent.wVirtualKeyCode), 0, "Device-independent key code, win32con.VK_*"}, + // @prop int|VirtualScanCode|Device-dependent scan code generated by keyboard + {"VirtualScanCode", T_USHORT, offsetof(PyINPUT_RECORD, input_record.Event.KeyEvent.wVirtualScanCode), 0, "Device-dependent scan code generated by keyboard"}, + // @prop <o PyUnicode>|Char|Single unicode character generated by the keypress + {"Char", T_LONG, 0, 0, "Single unicode character generated by the keypress"}, + // @prop int|ControlKeyState|State of modifier keys, combination of CAPSLOCK_ON, ENHANCED_KEY, LEFT_ALT_PRESSED, + // LEFT_CTRL_PRESSED, NUMLOCK_ON, RIGHT_ALT_PRESSED, RIGHT_CTRL_PRESSED, SCROLLLOCK_ON, SHIFT_PRESSED + {"ControlKeyState", T_ULONG, 0, 0, + "State of modifier keys, combination of CAPSLOCK_ON, ENHANCED_KEY, LEFT_ALT_PRESSED, LEFT_CTRL_PRESSED," + "NUMLOCK_ON, RIGHT_ALT_PRESSED, RIGHT_CTRL_PRESSED, SCROLLLOCK_ON, SHIFT_PRESSED"}, + // @prop int|ButtonState|Bitmask representing which mouse buttons were pressed. + {"ButtonState", T_ULONG, offsetof(PyINPUT_RECORD, input_record.Event.MouseEvent.dwButtonState), 0, + "Bitmask representing which mouse buttons were pressed"}, + // @prop int|EventFlags|DOUBLE_CLICK, MOUSE_MOVED or MOUSE_WHEELED, or 0. If 0, indicates a mouse button press + {"EventFlags", T_ULONG, offsetof(PyINPUT_RECORD, input_record.Event.MouseEvent.dwEventFlags), 0, + "DOUBLE_CLICK, MOUSE_MOVED or MOUSE_WHEELED, or 0. If 0, indicates a mouse button press"}, + // @prop <o PyCOORD>|MousePosition|Position in character coordinates + {"MousePosition", T_ULONG, 0, 0, "Position in character coordinates"}, + // @prop <o PyCOORD>|Size|New size of screen buffer in character rows/columns + {"Size", T_ULONG, 0, 0, "New size of screen buffer in character rows/columns"}, + // @prop boolean|SetFocus|Reserved - Used only with type FOCUS_EVENT. This event is Reserved, and should be ignored. + {"SetFocus", T_ULONG, offsetof(PyINPUT_RECORD,input_record.Event.FocusEvent.bSetFocus), 0, "Reserved"}, + // @prop int|CommandId|Used only with event type MENU_EVENT, which is reserved and should not be used + {"CommandId", T_ULONG, offsetof(PyINPUT_RECORD,input_record.Event.MenuEvent.dwCommandId), 0, "Reserved"}, + {NULL} + }; + + PyObject *PyINPUT_RECORD::tp_getattro(PyObject *self, PyObject *obname) + { + INPUT_RECORD *pir=&((PyINPUT_RECORD *)self)->input_record; + char *name=PyString_AsString(obname); + if (name==NULL) + return NULL; + if (strcmp(name,"ControlKeyState")==0){ + DWORD *src_ptr; + if (pir->EventType==KEY_EVENT) + src_ptr=&pir->Event.KeyEvent.dwControlKeyState; + else if (pir->EventType==MOUSE_EVENT) + src_ptr=&pir->Event.MouseEvent.dwControlKeyState; + else{ + PyErr_SetString(PyExc_AttributeError,"'ConrolKeyState' is only valid for KEY_EVENT or MOUSE_EVENT"); + return NULL; + } + return PyLong_FromUnsignedLong(*src_ptr); + } + + if (strcmp(name,"Char")==0){ + if (pir->EventType!=KEY_EVENT){ + PyErr_SetString(PyExc_AttributeError,"'Char' is only valid for type KEY_EVENT"); + return NULL; + } + return PyWinObject_FromWCHAR(&pir->Event.KeyEvent.uChar.UnicodeChar, 1); + } + + if (strcmp(name,"Size")==0){ + if (pir->EventType!=WINDOW_BUFFER_SIZE_EVENT){ + PyErr_SetString(PyExc_AttributeError,"'Size' is only valid for type WINDOW_BUFFER_SIZE_EVENT"); + return NULL; + } + Py_INCREF(((PyINPUT_RECORD *)self)->obcoord); + return ((PyINPUT_RECORD *)self)->obcoord; + } + + if (strcmp(name,"MousePosition")==0){ + if (pir->EventType!=MOUSE_EVENT){ + PyErr_SetString(PyExc_AttributeError,"'MousePosition' is only valid for type MOUSE_EVENT"); + return NULL; + } + Py_INCREF(((PyINPUT_RECORD *)self)->obcoord); + return ((PyINPUT_RECORD *)self)->obcoord; + } + + return PyObject_GenericGetAttr(self,obname); + } + + int PyINPUT_RECORD::tp_setattro(PyObject *self, PyObject *obname, PyObject *obvalue) + { + INPUT_RECORD *pir=&((PyINPUT_RECORD *)self)->input_record; + char *name; + name=PyString_AsString(obname); + if (name==NULL) + return -1; + + // ??? should probably add some EventType/attribute validation for everything done thru + // the normal structmember api also ??? + if (strcmp(name,"ControlKeyState")==0){ + // Event union contains 2 different ConrolKeyState's at different offsets depending on event type + DWORD *dest_ptr; + if (pir->EventType==KEY_EVENT) + dest_ptr=&pir->Event.KeyEvent.dwControlKeyState; + else if (pir->EventType==MOUSE_EVENT) + dest_ptr=&pir->Event.MouseEvent.dwControlKeyState; + else{ + PyErr_SetString(PyExc_AttributeError,"'ConrolKeyState' is only valid for KEY_EVENT or MOUSE_EVENT"); + return -1; + } + *dest_ptr=PyInt_AsUnsignedLongMask(obvalue); + if ((*dest_ptr==(DWORD)-1) && PyErr_Occurred()) + return -1; + return 0; + } + + if (strcmp(name,"Char")==0){ + if (pir->EventType!=KEY_EVENT){ + PyErr_SetString(PyExc_AttributeError,"'Char' is only valid for type KEY_EVENT"); + return -1; + } + if (!PyWinObject_AsSingleWCHAR(obvalue, &pir->Event.KeyEvent.uChar.UnicodeChar)) + return -1; + return 0; + } + + if (strcmp(name,"Size")==0){ + if (pir->EventType!=WINDOW_BUFFER_SIZE_EVENT){ + PyErr_SetString(PyExc_AttributeError,"'Size' is only valid for type WINDOW_BUFFER_SIZE_EVENT"); + return -1; + } + if (!PyCOORD_Check(obvalue)) + return -1; + ((PyINPUT_RECORD *)self)->input_record.Event.WindowBufferSizeEvent.dwSize=((PyCOORD *)obvalue)->coord; + Py_DECREF(((PyINPUT_RECORD *)self)->obcoord); + Py_INCREF(obvalue); + ((PyINPUT_RECORD *)self)->obcoord=(PyCOORD *)obvalue; + return 0; + } + + if (strcmp(name,"MousePosition")==0){ + if (pir->EventType!=MOUSE_EVENT){ + PyErr_SetString(PyExc_AttributeError,"'MousePosition' is only valid for type MOUSE_EVENT"); + return -1; + } + if (!PyCOORD_Check(obvalue)) + return -1; + ((PyINPUT_RECORD *)self)->input_record.Event.MouseEvent.dwMousePosition=((PyCOORD *)obvalue)->coord; + Py_DECREF(((PyINPUT_RECORD *)self)->obcoord); + Py_INCREF(obvalue); + ((PyINPUT_RECORD *)self)->obcoord=(PyCOORD *)obvalue; + return 0; + } + + return PyObject_GenericSetAttr(self, obname, obvalue); + } + + static PyTypeObject PyINPUT_RECORDType = + { + PyObject_HEAD_INIT(&PyType_Type) + 0, + "PyINPUT_RECORD", + sizeof(PyINPUT_RECORD), + 0, + PyINPUT_RECORD::tp_dealloc, + 0, // tp_print + 0, // tp_getattr + 0, // tp_setattr + 0, // tp_compare + PyINPUT_RECORD::tp_str, // tp_repr + 0, // tp_as_number + 0, // tp_as_sequence + 0, // tp_as_mapping + 0, // tp_hash + 0, // tp_call + PyINPUT_RECORD::tp_str, // tp_str + PyINPUT_RECORD::tp_getattro, // tp_getattro + 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; + 0, // tp_clear; + 0, // tp_richcompare; + 0, // tp_weaklistoffset; + 0, // tp_iter + 0, // tp_iternext + 0, // PySMALL_RECT::methods + PyINPUT_RECORD::members, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + PyINPUT_RECORD::tp_new + }; + + PyINPUT_RECORD::PyINPUT_RECORD(WORD EventType) + { + // EventType can't be changed after object is created + ob_type = &PyINPUT_RECORDType; + ZeroMemory(&input_record, sizeof(INPUT_RECORD)); + input_record.EventType=EventType; + // keep a reference to a PyCOORD, used by 2 different types of events + if ((EventType==MOUSE_EVENT) || (EventType==WINDOW_BUFFER_SIZE_EVENT)) + obcoord=new PyCOORD(); + else + obcoord=NULL; + _Py_NewReference(this); + } + + PyINPUT_RECORD::PyINPUT_RECORD(INPUT_RECORD *pinput_record) + { + ob_type = &PyINPUT_RECORDType; + input_record=*pinput_record; + if (input_record.EventType==MOUSE_EVENT) + obcoord=new PyCOORD(&input_record.Event.MouseEvent.dwMousePosition); + else if (input_record.EventType==WINDOW_BUFFER_SIZE_EVENT) + obcoord=new PyCOORD(&input_record.Event.WindowBufferSizeEvent.dwSize); + else + obcoord=NULL; + _Py_NewReference(this); + } + + void PyINPUT_RECORD::tp_dealloc(PyObject *self) + { + Py_XDECREF(((PyINPUT_RECORD *)self)->obcoord); + delete (PyINPUT_RECORD *)self; + } + + BOOL PyINPUT_RECORD_Check(PyObject *ob) + { + if (ob->ob_type!=&PyINPUT_RECORDType){ + PyErr_SetString(PyExc_TypeError,"Object must be a PyINPUT_RECORD"); + return FALSE; + } + return TRUE; + } + + BOOL PyWinObject_AsINPUT_RECORD(PyObject *obir, INPUT_RECORD **ppir) + { + if (!PyINPUT_RECORD_Check(obir)) + return FALSE; + *ppir=&((PyINPUT_RECORD *)obir)->input_record; + // pick up any changes to the PyCOORD associated with the input record + if ((*ppir)->EventType==MOUSE_EVENT) + (*ppir)->Event.MouseEvent.dwMousePosition=((PyINPUT_RECORD *)obir)->obcoord->coord; + else if ((*ppir)->EventType==WINDOW_BUFFER_SIZE_EVENT) + (*ppir)->Event.WindowBufferSizeEvent.dwSize=((PyINPUT_RECORD *)obir)->obcoord->coord; + return TRUE; + } + + PyObject *PyWinObject_FromINPUT_RECORD(INPUT_RECORD *pinput_record){ + PyObject *ret=new PyINPUT_RECORD(pinput_record); + if (ret==NULL) + PyErr_SetString(PyExc_MemoryError, "Unable to create PyINPUT_RECORD"); + return ret; + } + + PyObject *PyINPUT_RECORD::tp_new(PyTypeObject *tp, PyObject *args, PyObject *kwargs) + { + static char *keywords[]={"EventType", NULL}; + WORD EventType; + PyObject *ret; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "H:PyINPUT_RECORDType", keywords, &EventType)) + return NULL; + ret=new PyINPUT_RECORD(EventType); + if (ret==NULL) + PyErr_SetString(PyExc_MemoryError,"Unable to create PyINPUT_RECORD object"); + return ret; + } + + PyObject *PyINPUT_RECORD::tp_str(PyObject *self) + { + char buf[100]; + char *rec_type; + int chars_printed; + + if (((PyINPUT_RECORD *)self)->input_record.EventType==KEY_EVENT) + rec_type="KEY_EVENT"; + else if (((PyINPUT_RECORD *)self)->input_record.EventType==MOUSE_EVENT) + rec_type="MOUSE_EVENT"; + else if (((PyINPUT_RECORD *)self)->input_record.EventType==WINDOW_BUFFER_SIZE_EVENT) + rec_type="WINDOW_BUFFER_SIZE_EVENT"; + else if (((PyINPUT_RECORD *)self)->input_record.EventType==MENU_EVENT) + rec_type="MENU_EVENT"; + else if (((PyINPUT_RECORD *)self)->input_record.EventType==FOCUS_EVENT) + rec_type="FOCUS_EVENT"; + else + rec_type="<Unknown>"; + + chars_printed=_snprintf(buf, 100, "PyINPUT_RECORD(EventType=%d) (%s)", + ((PyINPUT_RECORD *)self)->input_record.EventType, rec_type); + if (chars_printed<0){ + PyErr_SetString(PyExc_SystemError, "String representation of PyINPUT_RECORD too long for buffer"); + return NULL; + } + return PyString_FromStringAndSize(buf,chars_printed); + } + + // @object PyConsoleScreenBuffer|Handle to a console screen buffer // Create using <om win32console.CreateConsoleScreenBuffer> or <om win32console.GetStdHandle> *************** *** 450,453 **** --- 788,795 ---- static PyObject *PySetConsoleFont(PyObject *self, PyObject *args, PyObject *kwargs); static PyObject *PySetStdHandle(PyObject *self, PyObject *args, PyObject *kwargs); + static PyObject *PySetConsoleDisplayMode(PyObject *self, PyObject *args, PyObject *kwargs); + static PyObject *PyWriteConsoleInput(PyObject *self, PyObject *args, PyObject *kwargs); + static PyObject *PyReadConsoleInput(PyObject *self, PyObject *args, PyObject *kwargs); + static PyObject *PyPeekConsoleInput(PyObject *self, PyObject *args, PyObject *kwargs); }; *************** *** 532,535 **** --- 874,889 ---- {"SetStdHandle", (PyCFunction)PyConsoleScreenBuffer::PySetStdHandle, METH_VARARGS|METH_KEYWORDS, "Replaces one of calling process's standard handles with this handle"}, + // @pymeth SetConsoleDisplayMode|Sets the display mode of the console buffer + {"SetConsoleDisplayMode", (PyCFunction)PyConsoleScreenBuffer::PySetConsoleDisplayMode, METH_VARARGS|METH_KEYWORDS, + "Sets the display mode of the console buffer"}, + // @pymeth WriteConsoleInput|Places input records in the console's input queue + {"WriteConsoleInput", (PyCFunction)PyConsoleScreenBuffer::PyWriteConsoleInput, METH_VARARGS|METH_KEYWORDS, + "Places input records in the console's input queue"}, + // @pymeth ReadConsoleInput|Reads input records and removes them from the input queue + {"ReadConsoleInput", (PyCFunction)PyConsoleScreenBuffer::PyReadConsoleInput, METH_VARARGS|METH_KEYWORDS, + "Reads input records and removes them from the input queue"}, + // @pymeth PeekConsoleInput|Returns pending input records without removing them from the input queue + {"PeekConsoleInput", (PyCFunction)PyConsoleScreenBuffer::PyPeekConsoleInput, METH_VARARGS|METH_KEYWORDS, + "Returns pending input records without removing them from the input queue"}, {NULL} }; *************** *** 690,694 **** &obcoord)) // @pyparm <o PyCOORD>|CursorPosition||A PyCOORD containing the new cursor position return NULL; ! if (!PyWinObject_AsCOORD(obcoord, &pcoord)) return NULL; if (!SetConsoleCursorPosition(((PyConsoleScreenBuffer *)self)->m_handle, *pcoord)) --- 1044,1048 ---- &obcoord)) // @pyparm <o PyCOORD>|CursorPosition||A PyCOORD containing the new cursor position return NULL; ! if (!PyWinObject_AsCOORD(obcoord, &pcoord, FALSE)) return NULL; if (!SetConsoleCursorPosition(((PyConsoleScreenBuffer *)self)->m_handle, *pcoord)) *************** *** 786,792 **** { static char *keywords[]={"Character", "Length", "WriteCoord", NULL}; ! DWORD len, charlen, nbrwritten; ! PyObject *obfillchar, *obcoord, *ret=NULL; ! WCHAR *fillchar=NULL; PCOORD pcoord; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OlO:FillConsoleOutputCharacter", keywords, --- 1140,1146 ---- { static char *keywords[]={"Character", "Length", "WriteCoord", NULL}; ! DWORD len, nbrwritten; ! PyObject *obfillchar, *obcoord; ! WCHAR fillchar; PCOORD pcoord; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OlO:FillConsoleOutputCharacter", keywords, *************** *** 797,811 **** if (!PyWinObject_AsCOORD(obcoord, &pcoord, FALSE)) return NULL; ! if (!PyWinObject_AsWCHAR(obfillchar, &fillchar, FALSE, &charlen)) return NULL; ! if (charlen!=1) ! PyErr_SetString(PyExc_ValueError, "Character must be a single character"); ! else ! if (!FillConsoleOutputCharacter(((PyConsoleScreenBuffer *)self)->m_handle, *fillchar, len, *pcoord, &nbrwritten)) ! PyWin_SetAPIError("FillConsoleOutputCharacter"); ! else ! ret=PyInt_FromLong(nbrwritten); ! PyWinObject_FreeWCHAR(fillchar); ! return ret; } --- 1151,1159 ---- if (!PyWinObject_AsCOORD(obcoord, &pcoord, FALSE)) return NULL; ! if (!PyWinObject_AsSingleWCHAR(obfillchar, &fillchar)) return NULL; ! if (!FillConsoleOutputCharacter(((PyConsoleScreenBuffer *)self)->m_handle, fillchar, len, *pcoord, &nbrwritten)) ! return PyWin_SetAPIError("FillConsoleOutputCharacter"); ! return PyInt_FromLong(nbrwritten); } *************** *** 929,938 **** static char *keywords[]={"ScrollRectangle", "ClipRectangle", "DestinationOrigin", "FillCharacter", "FillAttribute", NULL}; ! PyObject *obscrollrect, *obcliprect, *obdestcoord, *obfillchar, *ret=NULL; PSMALL_RECT pscrollrect, pcliprect; PCOORD pdestcoord; CHAR_INFO char_info; ! DWORD charlen; ! WCHAR *fillchar=NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOH:ScrollConsoleScreenBuffer", keywords, &obscrollrect, // @pyparm <o PySMALL_RECT>|ScrollRectangle||The region to be scrolled --- 1277,1285 ---- static char *keywords[]={"ScrollRectangle", "ClipRectangle", "DestinationOrigin", "FillCharacter", "FillAttribute", NULL}; ! PyObject *obscrollrect, *obcliprect, *obdestcoord, *obfillchar; PSMALL_RECT pscrollrect, pcliprect; PCOORD pdestcoord; CHAR_INFO char_info; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOH:ScrollConsoleScreenBuffer", keywords, &obscrollrect, // @pyparm <o PySMALL_RECT>|ScrollRectangle||The region to be scrolled *************** *** 945,964 **** &&PyWinObject_AsSMALL_RECT(obcliprect, &pcliprect, TRUE) &&PyWinObject_AsCOORD(obdestcoord, &pdestcoord, FALSE) ! &&PyWinObject_AsWCHAR(obfillchar, &fillchar, FALSE, &charlen)){ ! if (charlen!=1) ! PyErr_SetString(PyExc_ValueError, "FillCharacter must be a single character"); else{ ! char_info.Char.UnicodeChar=*fillchar; ! if (!ScrollConsoleScreenBuffer(((PyConsoleScreenBuffer *)self)->m_handle, pscrollrect, pcliprect, ! *pdestcoord, &char_info)) ! PyWin_SetAPIError("ScrollConsoleScreenBuffer"); ! else{ ! Py_INCREF(Py_None); ! ret=Py_None; ! } } ! } ! PyWinObject_FreeWCHAR(fillchar); ! return ret; } --- 1292,1304 ---- &&PyWinObject_AsSMALL_RECT(obcliprect, &pcliprect, TRUE) &&PyWinObject_AsCOORD(obdestcoord, &pdestcoord, FALSE) ! &&PyWinObject_AsSingleWCHAR(obfillchar, &char_info.Char.UnicodeChar)) ! if (!ScrollConsoleScreenBuffer(((PyConsoleScreenBuffer *)self)->m_handle, pscrollrect, pcliprect, ! *pdestcoord, &char_info)) ! PyWin_SetAPIError("ScrollConsoleScreenBuffer"); else{ ! Py_INCREF(Py_None); ! return Py_None; } ! return NULL; } *************** *** 1029,1032 **** --- 1369,1501 ---- } + // @pymethod |PyConsoleScreenBuffer|SetConsoleDisplayMode|Sets the display mode of the console buffer + PyObject *PyConsoleScreenBuffer::PySetConsoleDisplayMode(PyObject *self, PyObject *args, PyObject *kwargs) + { + CHECK_PFN(SetConsoleDisplayMode); + static char *keywords[]={"Flags", "NewScreenBufferDimensions", NULL}; + DWORD flags; + PCOORD dim; + PyObject *obdim; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "kO:SetConsoleDisplayMode", keywords, + &flags, // @pyparm int|Flags||CONSOLE_FULLSCREEN_MODE or CONSOLE_WINDOWED_MODE + &obdim)) // @pyparm <o PyCOORD>|NewScreenBufferDimensions||New size of the screen buffer in characters + return NULL; + if (!PyWinObject_AsCOORD(obdim, &dim, FALSE)) + return NULL; + if (!(*pfnSetConsoleDisplayMode)(((PyConsoleScreenBuffer *)self)->m_handle, flags, dim)) + return PyWin_SetAPIError("SetConsoleDisplayMode"); + Py_INCREF(Py_None); + return Py_None; + + } + + // @pymethod int|PyConsoleScreenBuffer|WriteConsoleInput|Places input records in the console's input queue + // @rdesc Returns the number of records written + PyObject *PyConsoleScreenBuffer::PyWriteConsoleInput(PyObject *self, PyObject *args, PyObject *kwargs) + { + static char *keywords[]={"Buffer", NULL}; + INPUT_RECORD *pinput_records=NULL, *pinput_record; + DWORD nbrofrecords, nbrwritten, tuple_index; + PyObject *obbuf, *obtuple=NULL, *obinput_record, *ret=NULL; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:WriteConsoleInput", keywords, + &obbuf)) // @pyparm (<o PyINPUT_RECORD>,...)|Buffer||A sequence of <o PyINPUT_RECORD> objects + return NULL; + obtuple=PySequence_Tuple(obbuf); + if (obtuple==NULL) + return NULL; + nbrofrecords=PyTuple_GET_SIZE(obtuple); + pinput_records=(INPUT_RECORD *)malloc(nbrofrecords *sizeof(INPUT_RECORD)); + if (pinput_records==NULL){ + PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", nbrofrecords *sizeof(INPUT_RECORD)); + goto done; + } + for (tuple_index=0; tuple_index<nbrofrecords; tuple_index++){ + obinput_record=PyTuple_GET_ITEM(obtuple, tuple_index); + if (!PyWinObject_AsINPUT_RECORD(obinput_record, &pinput_record)) + goto done; + pinput_records[tuple_index]=*pinput_record; + } + if (!WriteConsoleInput(((PyConsoleScreenBuffer *)self)->m_handle, pinput_records, nbrofrecords, &nbrwritten)) + PyWin_SetAPIError("WriteConsoleInput"); + else + ret=PyLong_FromUnsignedLong(nbrwritten); + done: + if (pinput_records!=NULL) + free(pinput_records); + Py_XDECREF(obtuple); + return ret; + } + + // @pymethod (<o PyINPUT_RECORD>,...)|PyConsoleScreenBuffer|ReadConsoleInput|Reads input records and removes them from the input queue + // @rdesc Returns a sequence of <o PyINPUT_RECORD> objects + // @comm This functions blocks until at least one record is read.<nl> + // The number of records returned may be less than the nbr requested + PyObject *PyConsoleScreenBuffer::PyReadConsoleInput(PyObject *self, PyObject *args, PyObject *kwargs) + { + static char *keywords[]={"Length", NULL}; + INPUT_RECORD *pinput_records=NULL; + DWORD nbrofrecords, nbrread, tuple_index; + PyObject *ret=NULL, *ret_item; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "k:ReadConsoleInput", keywords, + &nbrofrecords)) // @pyparm int|Length||The number of input records to read + return NULL; + pinput_records=(INPUT_RECORD *)malloc(nbrofrecords *sizeof(INPUT_RECORD)); + if (pinput_records==NULL) + return PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", nbrofrecords *sizeof(INPUT_RECORD)); + if (!ReadConsoleInput(((PyConsoleScreenBuffer *)self)->m_handle, pinput_records, nbrofrecords, &nbrread)) + PyWin_SetAPIError("ReadConsoleInput"); + else{ + ret=PyTuple_New(nbrread); + if (ret!=NULL) + for (tuple_index=0; tuple_index<nbrread; tuple_index++){ + ret_item=PyWinObject_FromINPUT_RECORD(&pinput_records[tuple_index]); + if (ret_item==NULL){ + Py_DECREF(ret); + ret=NULL; + break; + } + PyTuple_SET_ITEM(ret, tuple_index, ret_item); + } + } + free(pinput_records); + return ret; + } + + // @pymethod (<o PyINPUT_RECORD>,...)|PyConsoleScreenBuffer|PeekConsoleInput|Returns pending input records without removing them from the input queue + // @rdesc Returns a sequence of <o PyINPUT_RECORD> objects + // @comm This function does not block as ReadConsoleInput does.<nl> + // The number of records returned may be less than the nbr requested + PyObject *PyConsoleScreenBuffer::PyPeekConsoleInput(PyObject *self, PyObject *args, PyObject *kwargs) + { + static char *keywords[]={"Length", NULL}; + INPUT_RECORD *pinput_records=NULL; + DWORD nbrofrecords, nbrread, tuple_index; + PyObject *ret=NULL, *ret_item; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "k:PeekConsoleInput", keywords, + &nbrofrecords)) // @pyparm int|Length||The number of input records to read + return NULL; + pinput_records=(INPUT_RECORD *)malloc(nbrofrecords *sizeof(INPUT_RECORD)); + if (pinput_records==NULL) + return PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", nbrofrecords *sizeof(INPUT_RECORD)); + if (!PeekConsoleInput(((PyConsoleScreenBuffer *)self)->m_handle, pinput_records, nbrofrecords, &nbrread)) + PyWin_SetAPIError("PeekConsoleInput"); + else{ + ret=PyTuple_New(nbrread); + if (ret!=NULL) + for (tuple_index=0; tuple_index<nbrread; tuple_index++){ + ret_item=PyWinObject_FromINPUT_RECORD(&pinput_records[tuple_index]); + if (ret_item==NULL){ + Py_DECREF(ret); + ret=NULL; + break; + } + PyTuple_SET_ITEM(ret, tuple_index, ret_item); + } + } + free(pinput_records); + return ret; + } + + PyTypeObject PyConsoleScreenBufferType = *************** *** 1111,1115 **** static PyObject *PyCreateConsoleScreenBuffer(PyObject *self, PyObject *args, PyObject *kwargs) { ! DWORD access, sharemode, flags=CONSOLE_TEXTMODE_BUFFER; SECURITY_ATTRIBUTES* psa=NULL; LPVOID reserved=NULL; --- 1580,1584 ---- static PyObject *PyCreateConsoleScreenBuffer(PyObject *self, PyObject *args, PyObject *kwargs) { ! DWORD access=GENERIC_READ|GENERIC_WRITE, sharemode=FILE_SHARE_READ|FILE_SHARE_WRITE, flags=CONSOLE_TEXTMODE_BUFFER; SECURITY_ATTRIBUTES* psa=NULL; LPVOID reserved=NULL; *************** *** 1117,1123 **** PyObject *obsa=Py_None; static char *keywords[]={"DesiredAccess","ShareMode","SecurityAttributes","Flags",0}; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "kk|Ok", keywords, ! &access, // @pyparm int|DesiredAccess||GENERIC_READ and/or GENERIC_WRITE ! &sharemode, // @pyparm int|ShareMode||FILE_SHARE_READ and/or FILE_SHARE_WRITE &obsa, // @pyparm <o PySECURITY_ATTRIBUTES>|SecurityAttributes|None|Specifies security descriptor and inheritance for handle &flags)) // @pyparm int|Flags|CONSOLE_TEXTMODE_BUFFER|CONSOLE_TEXTMODE_BUFFER is currently only valid flag --- 1586,1592 ---- PyObject *obsa=Py_None; static char *keywords[]={"DesiredAccess","ShareMode","SecurityAttributes","Flags",0}; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|kkOk", keywords, ! &access, // @pyparm int|DesiredAccess|GENERIC_READ and GENERIC_WRITE|GENERIC_READ and/or GENERIC_WRITE ! &sharemode, // @pyparm int|ShareMode|FILE_SHARE_READ and FILE_SHARE_WRITE|FILE_SHARE_READ and/or FILE_SHARE_WRITE &obsa, // @pyparm <o PySECURITY_ATTRIBUTES>|SecurityAttributes|None|Specifies security descriptor and inheritance for handle &flags)) // @pyparm int|Flags|CONSOLE_TEXTMODE_BUFFER|CONSOLE_TEXTMODE_BUFFER is currently only valid flag *************** *** 1560,1563 **** --- 2029,2033 ---- pfnGetConsoleProcessList=(GetConsoleProcessListfunc)GetProcAddress(kernel32_dll, "GetConsoleProcessList"); pfnGetConsoleDisplayMode=(GetConsoleDisplayModefunc)GetProcAddress(kernel32_dll, "GetConsoleDisplayMode"); + pfnSetConsoleDisplayMode=(SetConsoleDisplayModefunc)GetProcAddress(kernel32_dll, "SetConsoleDisplayMode"); pfnAttachConsole=(AttachConsolefunc)GetProcAddress(kernel32_dll, "AttachConsole"); pfnAddConsoleAlias=(AddConsoleAliasfunc)GetProcAddress(kernel32_dll, "AddConsoleAliasW"); *************** *** 1580,1583 **** --- 2050,2054 ---- 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); *************** *** 1634,1636 **** --- 2105,2112 ---- 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); } |
From: Roger U. <ru...@us...> - 2005-09-19 12:25:43
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6146 Modified Files: setup.py Log Message: Write pywin32.version.txt to the temp directory so it can be found even when a build directory is specified Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** setup.py 16 Sep 2005 00:32:36 -0000 1.18 --- setup.py 19 Sep 2005 12:25:27 -0000 1.19 *************** *** 344,348 **** 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") --- 344,348 ---- build.run(self) # write a pywin32.version.txt. ! ver_fname = os.path.join(os.environ['temp'], "pywin32.version.txt") try: f = open(ver_fname, "wU") *************** *** 1291,1295 **** py_modules = py_modules, ! data_files=[('', ('build/pywin32.version.txt',))] + convert_optional_data_files([ 'PyWin32.chm', --- 1291,1295 ---- py_modules = py_modules, ! data_files=[('', (os.path.join(os.environ['temp'],'pywin32.version.txt'),))] + convert_optional_data_files([ 'PyWin32.chm', |
From: Mark H. <mha...@us...> - 2005-09-17 01:58:37
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17397 Modified Files: win32gui.i Log Message: * Add autoduck comments for GetMessage * Add PeekMessage and GetFocus * Fix return value from SetCapture Index: win32gui.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32gui.i,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** win32gui.i 28 Jun 2005 12:32:47 -0000 1.67 --- win32gui.i 17 Sep 2005 01:58:29 -0000 1.68 *************** *** 2383,2386 **** --- 2383,2389 ---- HWND SetFocus(HWND hwnd); + // @pyswig |GetFocus|Returns the HWND of the window with focus. + HWND GetFocus(); + // @pyswig |UpdateWindow| // @pyparm int|hwnd||The handle to the window *************** *** 2592,2596 **** // @pyswig MSG|GetMessage| ! BOOL GetMessage(MSG *OUTPUT, HWND hwnd, UINT min, UINT max); // @pyswig int|TranslateMessage| --- 2595,2602 ---- // @pyswig MSG|GetMessage| ! BOOL GetMessage(MSG *OUTPUT, ! HWND hwnd, // @pyparm int|hwnd|| ! UINT min, // @pyparm int|max|| ! UINT max); // @pyparm int|min|| // @pyswig int|TranslateMessage| *************** *** 2609,2612 **** --- 2615,2625 ---- ); + // @pyswig MSG|PeekMessage| + BOOL PeekMessage(MSG *OUTPUT, + HWND hwnd, // @pyparm int|hwnd|| + UINT min, // @pyparm int|filterMin|| + UINT max, // @pyparm int|filterMax|| + UINT remove); // @pyparm int|removalOptions|| + // DELETE ME! %{ *************** *** 3254,3258 **** HWND GetCapture(); // @pyswig |SetCapture|Captures the mouse for the specified window. ! BOOLAPI SetCapture(HWND hWnd); // @pyswig |_TrackMouseEvent|Posts messages when the mouse pointer leaves a window or hovers over a window for a specified amount of time. // @pyparm <o TRACKMOUSEEVENT>|tme|| --- 3267,3271 ---- HWND GetCapture(); // @pyswig |SetCapture|Captures the mouse for the specified window. ! HWND SetCapture(HWND hWnd); // @pyswig |_TrackMouseEvent|Posts messages when the mouse pointer leaves a window or hovers over a window for a specified amount of time. // @pyparm <o TRACKMOUSEEVENT>|tme|| |
From: Roger U. <ru...@us...> - 2005-09-16 00:32:44
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28057 Modified Files: setup.py Log Message: Add version info to all built pyds, dlls, and exes Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** setup.py 11 Sep 2005 15:17:23 -0000 1.17 --- setup.py 16 Sep 2005 00:32:36 -0000 1.18 *************** *** 60,63 **** --- 60,66 ---- import _winreg + pywin32_version='.'.join(sys.version.split('.')[:2])+'.'+build_id + print pywin32_version + # Python 2.2 has no True/False try: *************** *** 349,352 **** --- 352,381 ---- print "Failed to open '%s': %s" % (ver_fname, why) + ## add version info to dll's, exe's, and pyd's + if 'install' not in sys.argv: + import optparse + try: + import win32verstamp + except ImportError: + log.info('Unable to import verstamp, no version info will be added') + else: + v=optparse.Values() + v.ensure_value('version',pywin32_version) + v.ensure_value('comments',None) + v.ensure_value('company',None) + v.ensure_value('description',None) + v.ensure_value('internal_name',None) + v.ensure_value('copyright',None) + v.ensure_value('trademarks',None) + v.ensure_value('original_filename',None) + v.ensure_value('product','Pywin32') + v.ensure_value('dll',None) + v.ensure_value('debug',None) + v.ensure_value('verbose','1') + for dirname, subdirs, fnames in os.walk(self.build_base): + for fname in fnames: + if os.path.splitext(fname)[1].lower() in ('.dll','.exe','.pyd'): + win32verstamp.stamp(os.path.join(dirname,fname),v) + class my_build_ext(build_ext): |
From: Roger U. <ru...@us...> - 2005-09-16 00:03:15
|
Update of /cvsroot/pywin32/pywin32/win32/scripts/VersionStamp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22061/win32/scripts/VersionStamp Removed Files: verstamp.py Log Message: Move verstamp.py to \win32\lib as win32verstamp.py --- verstamp.py DELETED --- |
From: Roger U. <ru...@us...> - 2005-09-15 23:54:59
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20248/win32/Lib Added Files: win32verstamp.py Log Message: Move verstamp.py from \win32\scripts\VersionStamp to \win32\lib so it can be imported, and rename to win32verstamp.py --- NEW FILE: win32verstamp.py --- """ Stamp a Win32 binary with version information. """ from win32api import BeginUpdateResource, UpdateResource, EndUpdateResource, Unicode U = Unicode import os import struct import glob import optparse VS_FFI_SIGNATURE = -17890115 # 0xFEEF04BD VS_FFI_STRUCVERSION = 0x00010000 VS_FFI_FILEFLAGSMASK = 0x0000003f VOS_NT_WINDOWS32 = 0x00040004 # # Set VS_FF_PRERELEASE and DEBUG if Debug # def file_flags(debug): if debug: return 3 # VS_FF_DEBUG | VS_FF_PRERELEASE return 0 def file_type(is_dll): if is_dll: return 2 # VFT_DLL return 1 # VFT_APP def VS_FIXEDFILEINFO(maj, min, sub, build, debug=0, is_dll=1): return struct.pack('lllllllllllll', VS_FFI_SIGNATURE, # dwSignature VS_FFI_STRUCVERSION, # dwStrucVersion (maj << 16) | min, # dwFileVersionMS (sub << 16) | build,# dwFileVersionLS (maj << 16) | min, # dwProductVersionMS (sub << 16) | build, # dwProductVersionLS VS_FFI_FILEFLAGSMASK, # dwFileFlagsMask file_flags(debug), # dwFileFlags VOS_NT_WINDOWS32, # dwFileOS file_type(is_dll), # dwFileType 0x00000000, # dwFileSubtype 0x00000000, # dwFileDateMS 0x00000000, # dwFileDateLS ) def nullterm(s): try: return buffer(unicode(s)) + "\0\0" except NameError: # No unicode builtin return U(s).raw + '\0\0' def pad32(s, extra=2): # extra is normally 2 to deal with wLength l = 4 - ((len(s) + extra) & 3) if l < 4: return s + ('\0' * l) return s def addlen(s): return struct.pack('h', len(s) + 2) + s def String(key, value): key = nullterm(key) value = nullterm(value) result = struct.pack('hh', len(value)/2, 1) # wValueLength, wType result = result + key result = pad32(result) + value return addlen(result) def StringTable(key, data): key = nullterm(key) result = struct.pack('hh', 0, 1) # wValueLength, wType result = result + key for k, v in data.items(): result = result + String(k, v) result = pad32(result) return addlen(result) def StringFileInfo(data): result = struct.pack('hh', 0, 1) # wValueLength, wType result = result + nullterm('StringFileInfo') # result = pad32(result) + StringTable('040904b0', data) result = pad32(result) + StringTable('040904E4', data) return addlen(result) def Var(key, value): result = struct.pack('hh', len(value), 0) # wValueLength, wType result = result + nullterm(key) result = pad32(result) + value return addlen(result) def VarFileInfo(data): result = struct.pack('hh', 0, 1) # wValueLength, wType result = result + nullterm('VarFileInfo') result = pad32(result) for k, v in data.items(): result = result + Var(k, v) return addlen(result) def VS_VERSION_INFO(maj, min, sub, build, sdata, vdata, debug=0, is_dll=1): ffi = VS_FIXEDFILEINFO(maj, min, sub, build, debug, is_dll) result = struct.pack('hh', len(ffi), 0) # wValueLength, wType result = result + nullterm('VS_VERSION_INFO') result = pad32(result) + ffi result = pad32(result) + StringFileInfo(sdata) + VarFileInfo(vdata) return addlen(result) def stamp(pathname, options): # For some reason, the API functions report success if the file is open # but doesnt work! Try and open the file for writing, just to see if it is # likely the stamp will work! try: f = open(pathname, "a+b") f.close() except IOError, why: print "WARNING: File %s could not be opened - %s" % (pathname, why) ver = options.version try: bits = [int(i) for i in ver.split(".")] vmaj, vmin, vsub, vbuild = bits except (IndexError, TypeError, ValueError): parser.error("--version must be a.b.c.d (all integers)") ifn = options.internal_name if not ifn: ifn = os.path.basename(pathname) ofn = options.original_filename if not ofn: ofn = os.path.basename(pathname) sdata = { 'Comments' : options.comments, 'CompanyName' : options.company, 'FileDescription' : options.description, 'FileVersion' : ver, 'InternalName' : ifn, 'LegalCopyright' : options.copyright, 'LegalTrademarks' : options.trademarks, 'OriginalFilename' : ofn, 'ProductName' : options.product, 'ProductVersion' : ver, } vdata = { 'Translation' : struct.pack('hh', 0x409,1252), } is_dll = options.dll if is_dll is None: is_dll = os.path.splitext(pathname)[1].lower() in '.dll .pyd'.split() is_debug = options.debug if is_debug is None: is_debug = os.path.splitext(pathname)[0].lower().endswith("_d") # convert None to blank strings for k, v in sdata.items(): if v is None: sdata[k] = "" vs = VS_VERSION_INFO(vmaj, vmin, vsub, vbuild, sdata, vdata, is_debug, is_dll) h = BeginUpdateResource(pathname, 0) UpdateResource(h, 16, 1, vs) EndUpdateResource(h, 0) if options.verbose: print "Stamped:", pathname if __name__ == '__main__': parser = optparse.OptionParser("%prog [options] filespec ...", description=__doc__) parser.add_option("-q", "--quiet", action="store_false", dest="verbose", default=True, help="don't print status messages to stdout") parser.add_option("", "--version", default="0.0.0.0", help="The version number as m.n.s.b") parser.add_option("", "--dll", help="""Stamp the file as a DLL. Default is to look at the file extension for .dll or .pyd.""") parser.add_option("", "--debug", help="""Stamp the file as a debug binary.""") parser.add_option("", "--product", help="""The product name to embed.""") parser.add_option("", "--company", help="""The company name to embed.""") parser.add_option("", "--trademarks", help="The trademark string to embed.") parser.add_option("", "--comments", help="The comments string to embed.") parser.add_option("", "--copyright", help="""The copyright message string to embed.""") parser.add_option("", "--description", metavar="DESC", help="The description to embed.") parser.add_option("", "--internal-name", metavar="NAME", help="""The internal filename to embed. If not specified the base filename is used.""") parser.add_option("", "--original-filename", help="""The original filename to embed. If not specified the base filename is used.""") options, args = parser.parse_args() if not args: parser.error("You must supply a file to stamp. Use --help for details.") for g in args: for f in glob.glob(g): stamp(f, options) |
From: Roger U. <ru...@us...> - 2005-09-14 03:38:21
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27457/win32/src Modified Files: win32consolemodule.cpp Log Message: Add GetStdHandle and SetStdHandle Don't automatically close handles obtained from an external source Index: win32consolemodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32consolemodule.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** win32consolemodule.cpp 13 Sep 2005 04:14:28 -0000 1.2 --- win32consolemodule.cpp 14 Sep 2005 03:38:13 -0000 1.3 *************** *** 410,423 **** // @object PyConsoleScreenBuffer|Handle to a console screen buffer ! // Create using <om win32console.CreateConsoleScreenBuffer>. // Use PyConsoleScreenBufferType(Handle) to wrap a pre-existing handle as returned by <om win32api.GetStdHandle>. ! // Will also accept a handle created by <om win32file.CreateFile> for CONIN$ or CONOUT$ class PyConsoleScreenBuffer : public PyHANDLE { public: ! PyConsoleScreenBuffer(HANDLE hconsole); ~PyConsoleScreenBuffer(void); ! static void deallocFunc(PyObject *ob); ! static struct PyMemberDef members[]; static struct PyMethodDef methods[]; static PyObject *tp_new(PyTypeObject *tp, PyObject *args, PyObject *kwargs); --- 410,426 ---- // @object PyConsoleScreenBuffer|Handle to a console screen buffer ! // Create using <om win32console.CreateConsoleScreenBuffer> or <om win32console.GetStdHandle> // Use PyConsoleScreenBufferType(Handle) to wrap a pre-existing handle as returned by <om win32api.GetStdHandle>. ! // Will also accept a handle created by <om win32file.CreateFile> for CONIN$ or CONOUT$. ! // Only handles created by CreateConsoleScreenBuffer will be closed when Python object is destroyed class PyConsoleScreenBuffer : public PyHANDLE { public: ! PyConsoleScreenBuffer(HANDLE hconsole, BOOL bautoclose); ~PyConsoleScreenBuffer(void); ! static void tp_dealloc(PyObject *ob); ! const char *GetTypeName() {return "PyConsoleScreenBuffer";} ! BOOL bAutoClose; ! // static struct PyMemberDef members[]; static struct PyMethodDef methods[]; static PyObject *tp_new(PyTypeObject *tp, PyObject *args, PyObject *kwargs); *************** *** 446,449 **** --- 449,453 ---- static PyObject *PyGetConsoleFontSize(PyObject *self, PyObject *args, PyObject *kwargs); static PyObject *PySetConsoleFont(PyObject *self, PyObject *args, PyObject *kwargs); + static PyObject *PySetStdHandle(PyObject *self, PyObject *args, PyObject *kwargs); }; *************** *** 516,522 **** {"ScrollConsoleScreenBuffer", (PyCFunction)PyConsoleScreenBuffer::PyScrollConsoleScreenBuffer, METH_VARARGS|METH_KEYWORDS, "Scrolls a region of the display"}, ! // @pymeth GetCurrentConsoleFont|Returns the font size for the console screen buffer {"GetCurrentConsoleFont", (PyCFunction)PyConsoleScreenBuffer::PyGetCurrentConsoleFont, METH_VARARGS|METH_KEYWORDS, ! "Returns the current font for the console"}, // @pymeth GetConsoleFontSize|Returns size of specified font for the console {"GetConsoleFontSize", (PyCFunction)PyConsoleScreenBuffer::PyGetConsoleFontSize, METH_VARARGS|METH_KEYWORDS, --- 520,526 ---- {"ScrollConsoleScreenBuffer", (PyCFunction)PyConsoleScreenBuffer::PyScrollConsoleScreenBuffer, METH_VARARGS|METH_KEYWORDS, "Scrolls a region of the display"}, ! // @pymeth GetCurrentConsoleFont|Returns the currently displayed font {"GetCurrentConsoleFont", (PyCFunction)PyConsoleScreenBuffer::PyGetCurrentConsoleFont, METH_VARARGS|METH_KEYWORDS, ! "Returns the currently displayed font"}, // @pymeth GetConsoleFontSize|Returns size of specified font for the console {"GetConsoleFontSize", (PyCFunction)PyConsoleScreenBuffer::PyGetConsoleFontSize, METH_VARARGS|METH_KEYWORDS, *************** *** 525,537 **** {"SetConsoleFont", (PyCFunction)PyConsoleScreenBuffer::PySetConsoleFont, METH_VARARGS|METH_KEYWORDS, "Changes the font used by the screen buffer"}, {NULL} }; ! ! struct PyMemberDef PyConsoleScreenBuffer::members[] = { {NULL} }; ! // @pymethod |<o PyConsoleScreenBuffer>|SetConsoleActiveScreenBuffer|Sets this handle as the currently displayed screen buffer PyObject *PyConsoleScreenBuffer::PySetConsoleActiveScreenBuffer(PyObject *self, PyObject *args) { --- 529,550 ---- {"SetConsoleFont", (PyCFunction)PyConsoleScreenBuffer::PySetConsoleFont, METH_VARARGS|METH_KEYWORDS, "Changes the font used by the screen buffer"}, + // @pymeth SetStdHandle|Replaces one of calling process's standard handles with this handle + {"SetStdHandle", (PyCFunction)PyConsoleScreenBuffer::PySetStdHandle, METH_VARARGS|METH_KEYWORDS, + "Replaces one of calling process's standard handles with this handle"}, {NULL} }; ! /* ! ?????? Class members can't be accessed thru normal means due to offsetof failing for derived classes ! which have a base with virtual methods ! Maybe expose AutoClose via Get/Set methods ??????? ! struct PyMemberDef PyConsoleScreenBuffer::members[] = ! { ! {"AutoClose", T_INT, offsetof(PyConsoleScreenBuffer, bAutoClose), 0, "Indicates whether handle should be closed when python object is destroyed"}, {NULL} }; + */ ! // @pymethod |PyConsoleScreenBuffer|SetConsoleActiveScreenBuffer|Sets this handle as the currently displayed screen buffer PyObject *PyConsoleScreenBuffer::PySetConsoleActiveScreenBuffer(PyObject *self, PyObject *args) { *************** *** 950,954 **** } ! // @pymethod (int, <o PyCOORD>)|PyConsoleScreenBuffer|GetCurrentConsoleFont|Returns the font size for the console screen buffer // @rdesc Returns the index of current font and window size // @comm Only exists on XP or later.<nl> --- 963,967 ---- } ! // @pymethod (int, <o PyCOORD>)|PyConsoleScreenBuffer|GetCurrentConsoleFont|Returns currently displayed font // @rdesc Returns the index of current font and window size // @comm Only exists on XP or later.<nl> *************** *** 1002,1005 **** --- 1015,1032 ---- } + // @pymethod |PyConsoleScreenBuffer|SetStdHandle|Replaces one of calling process's standard handles with this handle + PyObject *PyConsoleScreenBuffer::PySetStdHandle(PyObject *self, PyObject *args, PyObject *kwargs) + { + static char *keywords[]={"StdHandle", NULL}; + DWORD StdHandle; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "k:SetStdHandle", keywords, + &StdHandle)) // @pyparm int|StdHandle||Specifies handle to be replaced - STD_INPUT_HANDLE, STD_OUTPUT_HANDLE, or STD_ERROR_HANDLE + return NULL; + if (!SetStdHandle(StdHandle, ((PyConsoleScreenBuffer *)self)->m_handle)) + return PyWin_SetAPIError("SetStdHandle"); + Py_INCREF(Py_None); + return Py_None; + } + PyTypeObject PyConsoleScreenBufferType = *************** *** 1010,1019 **** sizeof(PyConsoleScreenBuffer), 0, ! PyConsoleScreenBuffer::deallocFunc, // tp_dealloc 0, // tp_print 0, // tp_getattr 0, // tp_setattr 0, // tp_compare ! 0, // tp_repr PyHANDLEType.tp_as_number, // tp_as_number 0, // tp_as_sequence --- 1037,1046 ---- sizeof(PyConsoleScreenBuffer), 0, ! PyConsoleScreenBuffer::tp_dealloc, // tp_dealloc 0, // tp_print 0, // tp_getattr 0, // tp_setattr 0, // tp_compare ! PyHANDLE::strFunc, // tp_repr PyHANDLEType.tp_as_number, // tp_as_number 0, // tp_as_sequence *************** *** 1021,1025 **** 0, // tp_hash 0, // tp_call ! 0, // tp_str PyObject_GenericGetAttr, // tp_getattro PyObject_GenericSetAttr, // tp_setattro --- 1048,1052 ---- 0, // tp_hash 0, // tp_call ! PyHANDLE::strFunc, // tp_str PyObject_GenericGetAttr, // tp_getattro PyObject_GenericSetAttr, // tp_setattro *************** *** 1034,1038 **** 0, // tp_iternext PyConsoleScreenBuffer::methods, // tp_methods ! PyConsoleScreenBuffer::members, // tp_members 0, // tp_getset 0, // tp_base --- 1061,1065 ---- 0, // tp_iternext PyConsoleScreenBuffer::methods, // tp_methods ! 0, // PyConsoleScreenBuffer::members, // tp_members 0, // tp_getset 0, // tp_base *************** *** 1055,1074 **** if (!PyArg_ParseTupleAndKeywords(args, kwargs, "l", keywords, &h)) return NULL; ! return new PyConsoleScreenBuffer(h); } ! PyConsoleScreenBuffer::PyConsoleScreenBuffer(HANDLE hconsole) : PyHANDLE(hconsole) { ob_type = &PyConsoleScreenBufferType; } PyConsoleScreenBuffer::~PyConsoleScreenBuffer(void) { ! // don't try to close handle if it's been Detached ! if (m_handle) ! ::CloseHandle(m_handle); } ! void PyConsoleScreenBuffer::deallocFunc(PyObject *ob) { delete (PyConsoleScreenBuffer *)ob; --- 1082,1103 ---- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "l", keywords, &h)) return NULL; ! return new PyConsoleScreenBuffer(h, FALSE); } ! PyConsoleScreenBuffer::PyConsoleScreenBuffer(HANDLE hconsole, BOOL bautoclose) : PyHANDLE(hconsole) { ob_type = &PyConsoleScreenBufferType; + bAutoClose=bautoclose; } PyConsoleScreenBuffer::~PyConsoleScreenBuffer(void) { ! // Only close handles explicitely created by CreateConsoleScreenBuffer ! // Let PyHANDLE's exception catching logic take care of it ! if (this->bAutoClose) ! this->Close(); } ! void PyConsoleScreenBuffer::tp_dealloc(PyObject *ob) { delete (PyConsoleScreenBuffer *)ob; *************** *** 1100,1104 **** if (hconsole==INVALID_HANDLE_VALUE) return PyWin_SetAPIError("CreateConsoleScreenBuffer"); ! return new PyConsoleScreenBuffer(hconsole); } --- 1129,1133 ---- if (hconsole==INVALID_HANDLE_VALUE) return PyWin_SetAPIError("CreateConsoleScreenBuffer"); ! return new PyConsoleScreenBuffer(hconsole, TRUE); } *************** *** 1365,1369 **** return NULL; h=(*pfnGetConsoleWindow)(); ! return PyInt_FromLong((long)h); } --- 1394,1398 ---- return NULL; h=(*pfnGetConsoleWindow)(); ! return PyWinObject_FromHANDLE(h); } *************** *** 1449,1452 **** --- 1478,1502 ---- } + // @pymethod <o PyConsoleScreenBuffer>|win32console|GetStdHandle|Returns one of calling process's standard handles + // @rdesc Returns a <o PyConsoleScreenBuffer> wrapping the handle, or None if specified handle does not exist + PyObject* PyGetStdHandle(PyObject *self, PyObject *args, PyObject *kwargs) + { + static char *keywords[]={"StdHandle", NULL}; + DWORD StdHandle; + HANDLE h; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "k:GetStdHandle", keywords, + &StdHandle)) // @pyparm int|StdHandle||Specifies the handle to return - STD_INPUT_HANDLE, STD_OUTPUT_HANDLE, or STD_ERROR_HANDLE + return NULL; + h=GetStdHandle(StdHandle); + if (h==INVALID_HANDLE_VALUE) + return PyWin_SetAPIError("GetStdHandle"); + if (h==NULL){ + Py_INCREF(Py_None); + return Py_None; + } + return new PyConsoleScreenBuffer(h, FALSE); + } + + // @module win32console|Interface to the Windows Console functions for dealing with character-mode applications static struct PyMethodDef win32console_functions[] = { *************** *** 1483,1493 **** // @pymeth GetNumberOfConsoleFonts|Returns the number of fonts available to the console {"GetNumberOfConsoleFonts", PyGetNumberOfConsoleFonts, METH_VARARGS, "Returns the number of fonts available to the console"}, ! // @pymeth SetConsoleTitle|Sets the title of the console window ! {"SetConsoleTitle", (PyCFunction)PySetConsoleTitle, METH_VARARGS|METH_KEYWORDS, "Sets the title of the console window"}, ! // @pymeth GetConsoleTitle|Returns the title of the console window ! {"GetConsoleTitle", PyGetConsoleTitle, METH_VARARGS, "Returns the title of the console window"}, // @pymeth GenerateConsoleCtrlEvent|Sends a control signal to a group of processes attached to a common console {"GenerateConsoleCtrlEvent", (PyCFunction)PyGenerateConsoleCtrlEvent, METH_VARARGS|METH_KEYWORDS, "Sends a control signal to a group of processes attached to a common console"}, {NULL, NULL} }; --- 1533,1545 ---- // @pymeth GetNumberOfConsoleFonts|Returns the number of fonts available to the console {"GetNumberOfConsoleFonts", PyGetNumberOfConsoleFonts, METH_VARARGS, "Returns the number of fonts available to the console"}, ! // @pymeth SetConsoleTitle|Sets the title of calling process's console ! {"SetConsoleTitle", (PyCFunction)PySetConsoleTitle, METH_VARARGS|METH_KEYWORDS, "Sets the title of calling process's console"}, ! // @pymeth GetConsoleTitle|Returns the title of console to which calling process is attached ! {"GetConsoleTitle", PyGetConsoleTitle, METH_VARARGS, "Returns the title of console to which calling process is attached"}, // @pymeth GenerateConsoleCtrlEvent|Sends a control signal to a group of processes attached to a common console {"GenerateConsoleCtrlEvent", (PyCFunction)PyGenerateConsoleCtrlEvent, METH_VARARGS|METH_KEYWORDS, "Sends a control signal to a group of processes attached to a common console"}, + // @pymeth GetStdHandle|Returns one of calling process's standard handles + {"GetStdHandle", (PyCFunction)PyGetStdHandle, METH_VARARGS|METH_KEYWORDS, "Returns one of calling process's standard handles"}, {NULL, NULL} }; *************** *** 1578,1580 **** PyModule_AddIntConstant(mod, "CTRL_BREAK_EVENT", CTRL_BREAK_EVENT); ! } --- 1630,1636 ---- 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); ! } |
From: Roger U. <ru...@us...> - 2005-09-13 04:14:36
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5499/win32/src Modified Files: win32consolemodule.cpp Log Message: Add font functions, and unicode versions of some functions already in win32api Index: win32consolemodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32consolemodule.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** win32consolemodule.cpp 11 Sep 2005 15:17:23 -0000 1.1 --- win32consolemodule.cpp 13 Sep 2005 04:14:28 -0000 1.2 *************** *** 36,43 **** typedef COORD (WINAPI *GetConsoleFontSizefunc)(HANDLE, DWORD); static GetConsoleFontSizefunc pfnGetConsoleFontSize=NULL; - typedef BOOL (WINAPI *GetConsoleSelectionInfofunc)(PCONSOLE_SELECTION_INFO); static GetConsoleSelectionInfofunc pfnGetConsoleSelectionInfo=NULL; ! // convert python object to array of WORDS/USHORTS --- 36,45 ---- typedef COORD (WINAPI *GetConsoleFontSizefunc)(HANDLE, DWORD); static GetConsoleFontSizefunc pfnGetConsoleFontSize=NULL; typedef BOOL (WINAPI *GetConsoleSelectionInfofunc)(PCONSOLE_SELECTION_INFO); static GetConsoleSelectionInfofunc pfnGetConsoleSelectionInfo=NULL; ! typedef DWORD (WINAPI *GetNumberOfConsoleFontsfunc)(VOID); ! static GetNumberOfConsoleFontsfunc pfnGetNumberOfConsoleFonts=NULL; ! typedef BOOL (WINAPI *SetConsoleFontfunc)(HANDLE, DWORD); ! static SetConsoleFontfunc pfnSetConsoleFont=NULL; // convert python object to array of WORDS/USHORTS *************** *** 441,444 **** --- 443,449 ---- static PyObject *PyWriteConsoleOutputAttribute(PyObject *self, PyObject *args, PyObject *kwargs); static PyObject *PyScrollConsoleScreenBuffer(PyObject *self, PyObject *args, PyObject *kwargs); + static PyObject *PyGetCurrentConsoleFont(PyObject *self, PyObject *args, PyObject *kwargs); + static PyObject *PyGetConsoleFontSize(PyObject *self, PyObject *args, PyObject *kwargs); + static PyObject *PySetConsoleFont(PyObject *self, PyObject *args, PyObject *kwargs); }; *************** *** 511,514 **** --- 516,528 ---- {"ScrollConsoleScreenBuffer", (PyCFunction)PyConsoleScreenBuffer::PyScrollConsoleScreenBuffer, METH_VARARGS|METH_KEYWORDS, "Scrolls a region of the display"}, + // @pymeth GetCurrentConsoleFont|Returns the font size for the console screen buffer + {"GetCurrentConsoleFont", (PyCFunction)PyConsoleScreenBuffer::PyGetCurrentConsoleFont, METH_VARARGS|METH_KEYWORDS, + "Returns the current font for the console"}, + // @pymeth GetConsoleFontSize|Returns size of specified font for the console + {"GetConsoleFontSize", (PyCFunction)PyConsoleScreenBuffer::PyGetConsoleFontSize, METH_VARARGS|METH_KEYWORDS, + "Returns size of specified font for the console"}, + // @pymeth SetConsoleFont|Changes the font used by the screen buffer + {"SetConsoleFont", (PyCFunction)PyConsoleScreenBuffer::PySetConsoleFont, METH_VARARGS|METH_KEYWORDS, + "Changes the font used by the screen buffer"}, {NULL} }; *************** *** 696,700 **** PSMALL_RECT prect; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "lO:SetConsoleWindowInfo", keywords, ! &absolut, // @pyparm boolean|Absolute||Nbr of characters per line &obrect)) // @pyparm <o PySMALL_RECT>|ConsoleWindow||A SMALL_RECT containing the new window coordinates return NULL; --- 710,714 ---- PSMALL_RECT prect; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "lO:SetConsoleWindowInfo", keywords, ! &absolut, // @pyparm boolean|Absolute||If False, coordinates are relative to current position &obrect)) // @pyparm <o PySMALL_RECT>|ConsoleWindow||A SMALL_RECT containing the new window coordinates return NULL; *************** *** 908,912 **** DWORD charlen; WCHAR *fillchar=NULL; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOH", keywords, &obscrollrect, // @pyparm <o PySMALL_RECT>|ScrollRectangle||The region to be scrolled &obcliprect, // @pyparm <o PySMALL_RECT>|ClipRectangle||Rectangle that limits display area affected, can be None --- 922,926 ---- DWORD charlen; WCHAR *fillchar=NULL; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOH:ScrollConsoleScreenBuffer", keywords, &obscrollrect, // @pyparm <o PySMALL_RECT>|ScrollRectangle||The region to be scrolled &obcliprect, // @pyparm <o PySMALL_RECT>|ClipRectangle||Rectangle that limits display area affected, can be None *************** *** 936,954 **** } ! /* ! BOOL GetCurrentConsoleFont( ! HANDLE hConsoleOutput, ! BOOL bMaximumWindow, ! PCONSOLE_FONT_INFO lpConsoleCurrentFont ! ); ! typedef struct _CONSOLE_FONT_INFO { DWORD nFont; COORD dwFontSize; ! } CONSOLE_FONT_INFO, *PCONSOLE_FONT_INFO; - COORD GetConsoleFontSize( - HANDLE hConsoleOutput, - DWORD nFont - ); - */ PyTypeObject PyConsoleScreenBufferType = --- 950,1005 ---- } ! // @pymethod (int, <o PyCOORD>)|PyConsoleScreenBuffer|GetCurrentConsoleFont|Returns the font size for the console screen buffer ! // @rdesc Returns the index of current font and window size ! // @comm Only exists on XP or later.<nl> ! // MSDN docs claim the returned COORD is the font size, but it's actually the window size.<nl> ! // Use <om PyConsoleScreenBuffer.GetConsoleFontSize> for the font size. ! PyObject *PyConsoleScreenBuffer::PyGetCurrentConsoleFont(PyObject *self, PyObject *args, PyObject *kwargs) ! { ! static char *keywords[]={"MaximumWindow", NULL}; ! CONSOLE_FONT_INFO cfi; ! BOOL bmax=FALSE; ! CHECK_PFN(GetCurrentConsoleFont); ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|l:GetCurrentConsoleFont", keywords, ! &bmax)) // @pyparm boolean|MaximumWindow|False|If True, retrieves font size for maximum window size ! return NULL; ! if (!(*pfnGetCurrentConsoleFont)(((PyConsoleScreenBuffer *)self)->m_handle, bmax, &cfi)) ! return PyWin_SetAPIError("GetCurrentConsoleFont"); ! return Py_BuildValue("lO", cfi.nFont, PyWinObject_FromCOORD(&cfi.dwFontSize)); ! } ! // @pymethod <o PyCOORD>|PyConsoleScreenBuffer|GetConsoleFontSize|Returns size of specified font for the console ! // @comm Only exists on XP or later. ! PyObject *PyConsoleScreenBuffer::PyGetConsoleFontSize(PyObject *self, PyObject *args, PyObject *kwargs) ! { ! static char *keywords[]={"Font", NULL}; ! DWORD font; ! COORD fontsize; ! CHECK_PFN(GetConsoleFontSize); ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "l:GetConsoleFontSize", keywords, ! &font)) // @pyparm int|Font||Index of font as returned by GetCurrentConsoleFont ! return NULL; ! fontsize=(*pfnGetConsoleFontSize)(((PyConsoleScreenBuffer *)self)->m_handle, font); ! if (fontsize.X==0 && fontsize.Y==0) ! return PyWin_SetAPIError("GetConsoleFontSize"); ! return PyWinObject_FromCOORD(&fontsize); ! } ! ! // @pymethod |PyConsoleScreenBuffer|SetConsoleFont|Changes the font used by the screen buffer ! // @comm Function is not documented on MSDN ! PyObject *PyConsoleScreenBuffer::PySetConsoleFont(PyObject *self, PyObject *args, PyObject *kwargs) ! { ! static char *keywords[]={"Font", NULL}; ! DWORD font; ! CHECK_PFN(SetConsoleFont); ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "l:SetConsoleFont", keywords, ! &font)) // @pyparm int|Font||The number of the font to be set ! return NULL; ! if (!(*pfnSetConsoleFont)(((PyConsoleScreenBuffer *)self)->m_handle, font)) ! return PyWin_SetAPIError("SetConsoleFont"); ! Py_INCREF(Py_None); ! return Py_None; ! } PyTypeObject PyConsoleScreenBufferType = *************** *** 1317,1320 **** --- 1368,1451 ---- } + // @pymethod int|win32console|GetNumberOfConsoleFonts|Returns the number of fonts available to the console + // @comm Function is not documented in MSDN + PyObject *PyGetNumberOfConsoleFonts(PyObject *self, PyObject *args) + { + DWORD nbroffonts; + CHECK_PFN(GetNumberOfConsoleFonts); + if (!PyArg_ParseTuple(args, ":GetNumberOfConsoleFonts")) + return NULL; + nbroffonts=(*pfnGetNumberOfConsoleFonts)(); + return PyLong_FromLong(nbroffonts); + } + + // @pymethod |win32console|SetConsoleTitle|Sets the title of the console window + PyObject *PySetConsoleTitle(PyObject *self, PyObject *args, PyObject *kwargs) + { + static char *keywords[]={"ConsoleTitle", NULL}; + WCHAR *title=NULL; + PyObject *obtitle, *ret=NULL; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:SetConsoleTitle", keywords, + &obtitle)) // @pyparm <o PyUNICODE>|ConsoleTitle||New title for the console + return NULL; + if (!PyWinObject_AsWCHAR(obtitle, &title, FALSE)) + return NULL; + if (!SetConsoleTitle(title)) + PyWin_SetAPIError("SetConsoleTitle"); + else{ + Py_INCREF(Py_None); + ret=Py_None; + } + PyWinObject_FreeWCHAR(title); + return ret; + } + + // @pymethod <o PyUNICODE>|win32console|GetConsoleTitle|Returns the title of the console window + PyObject *PyGetConsoleTitle(PyObject *self, PyObject *args) + { + WCHAR *title=NULL; + DWORD chars_allocated=64, chars_returned; + PyObject *ret=NULL; + if (!PyArg_ParseTuple(args, ":GetConsoleTitle")) + return NULL;\ + + // if buffer is too small, function still copies as much of title as will fit, + // so loop until fewer characters returned than were allocated + while (TRUE){ + if (title!=NULL){ + free(title); + chars_allocated*=2; + } + title=(WCHAR *)malloc(chars_allocated*sizeof(WCHAR)); + if (title==NULL) + return PyErr_Format(PyExc_MemoryError, "GetConsoleTitle: unable to allocate %d bytes", chars_allocated*sizeof(WCHAR)); + chars_returned=GetConsoleTitle(title, chars_allocated); + if (chars_returned==0){ + PyWin_SetAPIError("GetConsoleTitle"); + break; + } + if ((chars_returned+1)<chars_allocated){ // returned length does *not* includes the NULL terminator + ret=PyWinObject_FromWCHAR(title); + break; + } + } + free(title); + return ret; + } + + // @pymethod |win32console|GenerateConsoleCtrlEvent|Sends a control signal to a group of processes attached to a common console + PyObject *PyGenerateConsoleCtrlEvent(PyObject *self, PyObject *args, PyObject *kwargs) + { + static char *keywords[]={"CtrlEvent" ,"ProcessGroupId", NULL}; + DWORD evt, pid=0; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "k|k:GenerateConsoleCtrlEvent", keywords, + &evt, // @pyparm int|CtrlEvent||Signal to be sent to specified process group - CTRL_C_EVENT or CTRL_BREAK_EVENT + &pid)) // @pyparm int|ProcessGroupId|0|Pid of a process group, use 0 for calling process + return NULL; + if (!GenerateConsoleCtrlEvent(evt, pid)) + return PyWin_SetAPIError("GenerateConsoleCtrlEvent"); + Py_INCREF(Py_None); + return Py_None; + } // @module win32console|Interface to the Windows Console functions for dealing with character-mode applications *************** *** 1350,1353 **** --- 1481,1493 ---- // @pymeth GetConsoleWindow|Returns a handle to the console's window, or 0 if none exists {"GetConsoleWindow", PyGetConsoleWindow, METH_VARARGS, "Returns a handle to the console's window, or 0 if none exists"}, + // @pymeth GetNumberOfConsoleFonts|Returns the number of fonts available to the console + {"GetNumberOfConsoleFonts", PyGetNumberOfConsoleFonts, METH_VARARGS, "Returns the number of fonts available to the console"}, + // @pymeth SetConsoleTitle|Sets the title of the console window + {"SetConsoleTitle", (PyCFunction)PySetConsoleTitle, METH_VARARGS|METH_KEYWORDS, "Sets the title of the console window"}, + // @pymeth GetConsoleTitle|Returns the title of the console window + {"GetConsoleTitle", PyGetConsoleTitle, METH_VARARGS, "Returns the title of the console window"}, + // @pymeth GenerateConsoleCtrlEvent|Sends a control signal to a group of processes attached to a common console + {"GenerateConsoleCtrlEvent", (PyCFunction)PyGenerateConsoleCtrlEvent, METH_VARARGS|METH_KEYWORDS, + "Sends a control signal to a group of processes attached to a common console"}, {NULL, NULL} }; *************** *** 1378,1382 **** pfnGetConsoleFontSize=(GetConsoleFontSizefunc)GetProcAddress(kernel32_dll, "GetConsoleFontSize"); pfnGetConsoleSelectionInfo=(GetConsoleSelectionInfofunc)GetProcAddress(kernel32_dll, "GetConsoleSelectionInfo"); ! } dict = PyModule_GetDict(mod); --- 1518,1524 ---- pfnGetConsoleFontSize=(GetConsoleFontSizefunc)GetProcAddress(kernel32_dll, "GetConsoleFontSize"); pfnGetConsoleSelectionInfo=(GetConsoleSelectionInfofunc)GetProcAddress(kernel32_dll, "GetConsoleSelectionInfo"); ! pfnGetNumberOfConsoleFonts=(GetNumberOfConsoleFontsfunc)GetProcAddress(kernel32_dll, "GetNumberOfConsoleFonts"); ! pfnSetConsoleFont=(SetConsoleFontfunc)GetProcAddress(kernel32_dll, "SetConsoleFont"); ! } dict = PyModule_GetDict(mod); *************** *** 1432,1434 **** --- 1574,1580 ---- 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); + } |
From: Roger U. <ru...@us...> - 2005-09-11 15:19:21
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15669/win32/src Modified Files: win32service.i Log Message: Documentation fix Index: win32service.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32service.i,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** win32service.i 31 Jan 2005 03:28:08 -0000 1.8 --- win32service.i 11 Sep 2005 15:19:07 -0000 1.9 *************** *** 277,281 **** } ! // @pymethod (PyUNICODE,...)|<o PyHWINSTA>|EnumDesktops|Lists names of desktops in the window station PyObject *PyHWINSTA::EnumDesktops(PyObject *self, PyObject *args) { --- 277,281 ---- } ! // @pymethod (PyUNICODE,...)|PyHWINSTA|EnumDesktops|Lists names of desktops in the window station PyObject *PyHWINSTA::EnumDesktops(PyObject *self, PyObject *args) { |
From: Roger U. <ru...@us...> - 2005-09-11 15:17:32
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15386/win32/src Added Files: win32consolemodule.cpp Log Message: Add win32console module, wrapping Windows console API functions --- NEW FILE: win32consolemodule.cpp --- // @doc #define _WIN32_WINNT 0x501 #include "PyWinTypes.h" #include "PyWinObjects.h" #include "structmember.h" #include "malloc.h" #define PyW32_BEGIN_ALLOW_THREADS PyThreadState *_save = PyEval_SaveThread(); #define PyW32_END_ALLOW_THREADS PyEval_RestoreThread(_save); #define PyW32_BLOCK_THREADS Py_BLOCK_THREADS // function pointers #define CHECK_PFN(fname)if (pfn##fname==NULL) return PyErr_Format(PyExc_NotImplementedError,"%s is not available on this platform", #fname); HMODULE kernel32_dll; typedef DWORD (WINAPI* GetConsoleProcessListfunc)(LPDWORD, DWORD); static GetConsoleProcessListfunc pfnGetConsoleProcessList=NULL; typedef BOOL (WINAPI *GetConsoleDisplayModefunc)(LPDWORD); static GetConsoleDisplayModefunc pfnGetConsoleDisplayMode=NULL; [...1395 lines suppressed...] 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); } |
From: Roger U. <ru...@us...> - 2005-09-11 15:17:32
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15386 Modified Files: setup.py Log Message: Add win32console module, wrapping Windows console API functions Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** setup.py 22 Aug 2005 03:14:37 -0000 1.16 --- setup.py 11 Sep 2005 15:17:23 -0000 1.17 *************** *** 921,924 **** --- 921,925 ---- ("win32wnet", "netapi32 mpr", False), ("win32inet", "wininet", False), + ("win32console", "kernel32", True, 0x0501, "win32/src/win32consolemodule.cpp"), ): *************** *** 1028,1032 **** WinExt_win32com('axdebug', dsp_file=r"com\Active Debugging.dsp", ! libraries="axscript", pch_header = "stdafx.h", optional_headers = ["activdbg.h"], --- 1029,1033 ---- WinExt_win32com('axdebug', dsp_file=r"com\Active Debugging.dsp", ! libraries="axscript ad1", pch_header = "stdafx.h", optional_headers = ["activdbg.h"], |
From: Roger U. <ru...@us...> - 2005-08-29 21:41:03
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16094/win32/src Modified Files: win32security.i Log Message: Add CreateWellKnownSid Index: win32security.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32security.i,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** win32security.i 31 May 2005 02:07:34 -0000 1.27 --- win32security.i 29 Aug 2005 21:40:53 -0000 1.28 *************** *** 80,83 **** --- 80,86 ---- static TranslateNamefunc pfnTranslateName=NULL; + typedef BOOL (WINAPI *CreateWellKnownSidfunc)(WELL_KNOWN_SID_TYPE, PSID, PSID, DWORD *); + static CreateWellKnownSidfunc pfnCreateWellKnownSid=NULL; + // function pointers used in win32security_sspi.cpp and win32security_ds.cpp extern DsBindfunc pfnDsBind=NULL; *************** *** 650,654 **** pfnTranslateName=(TranslateNamefunc)loadapifunc("TranslateNameW",secur32_dll); ! pfnDsBind=(DsBindfunc)loadapifunc("DsBindW", ntdsapi_dll); pfnDsUnBind=(DsUnBindfunc)loadapifunc("DsUnBindW", ntdsapi_dll); --- 653,658 ---- pfnTranslateName=(TranslateNamefunc)loadapifunc("TranslateNameW",secur32_dll); ! pfnCreateWellKnownSid=(CreateWellKnownSidfunc)loadapifunc("CreateWellKnownSid",advapi32_dll); ! pfnDsBind=(DsBindfunc)loadapifunc("DsBindW", ntdsapi_dll); pfnDsUnBind=(DsUnBindfunc)loadapifunc("DsUnBindW", ntdsapi_dll); *************** *** 656,668 **** pfnDsWriteAccountSpn=(DsWriteAccountSpnfunc)loadapifunc("DsWriteAccountSpnW", ntdsapi_dll); pfnDsFreeSpnArray=(DsFreeSpnArrayfunc)loadapifunc("DsFreeSpnArrayW", ntdsapi_dll); ! pfnDsCrackNames=(DsCrackNamesfunc)loadapifunc("DsCrackNamesW", ntdsapi_dll); ! pfnDsListInfoForServer=(DsListInfoForServerfunc)loadapifunc("DsListInfoForServerW", ntdsapi_dll); ! pfnDsListDomainsInSite=(DsListDomainsInSitefunc)loadapifunc("DsListDomainsInSiteW", ntdsapi_dll); ! pfnDsListServersForDomainInSite=(DsListServersForDomainInSitefunc)loadapifunc("DsListServersForDomainInSiteW", ntdsapi_dll); ! pfnDsListServersInSite=(DsListServersInSitefunc)loadapifunc("DsListServersInSiteW", ntdsapi_dll); ! pfnDsListSites=(DsListSitesfunc)loadapifunc("DsListSitesW", ntdsapi_dll); ! pfnDsListRoles=(DsListRolesfunc)loadapifunc("DsListRolesW", ntdsapi_dll); ! pfnDsFreeNameResult=(DsFreeNameResultfunc)loadapifunc("DsFreeNameResultW", ntdsapi_dll); pfnDsGetDcName=(DsGetDcNamefunc)loadapifunc("DsGetDcNameW", netapi32_dll); --- 660,672 ---- pfnDsWriteAccountSpn=(DsWriteAccountSpnfunc)loadapifunc("DsWriteAccountSpnW", ntdsapi_dll); pfnDsFreeSpnArray=(DsFreeSpnArrayfunc)loadapifunc("DsFreeSpnArrayW", ntdsapi_dll); ! pfnDsCrackNames=(DsCrackNamesfunc)loadapifunc("DsCrackNamesW", ntdsapi_dll); ! pfnDsListInfoForServer=(DsListInfoForServerfunc)loadapifunc("DsListInfoForServerW", ntdsapi_dll); ! pfnDsListDomainsInSite=(DsListDomainsInSitefunc)loadapifunc("DsListDomainsInSiteW", ntdsapi_dll); ! pfnDsListServersForDomainInSite=(DsListServersForDomainInSitefunc)loadapifunc("DsListServersForDomainInSiteW", ntdsapi_dll); ! pfnDsListServersInSite=(DsListServersInSitefunc)loadapifunc("DsListServersInSiteW", ntdsapi_dll); ! pfnDsListSites=(DsListSitesfunc)loadapifunc("DsListSitesW", ntdsapi_dll); ! pfnDsListRoles=(DsListRolesfunc)loadapifunc("DsListRolesW", ntdsapi_dll); ! pfnDsFreeNameResult=(DsFreeNameResultfunc)loadapifunc("DsFreeNameResultW", ntdsapi_dll); pfnDsGetDcName=(DsGetDcNamefunc)loadapifunc("DsGetDcNameW", netapi32_dll); *************** *** 3476,3479 **** --- 3480,3513 ---- %} + // @pyswig |CreateWellKnownSid|Returns one of the predefined well known sids + %native(CreateWellKnownSid) PyCreateWellKnownSid; + %{ + static PyObject *PyCreateWellKnownSid(PyObject *self, PyObject *args) + { + PyObject *obDomainSid=Py_None, *ret=NULL; + PSID DomainSid=NULL, outsid=NULL; + WELL_KNOWN_SID_TYPE sidtype; + DWORD bufsize=SECURITY_MAX_SID_SIZE; + CHECK_PFN(CreateWellKnownSid); + + outsid=malloc(bufsize); + if (outsid==NULL) + return PyErr_Format(PyExc_MemoryError, "CreateWellKnownSid: Unable to allocate %d bytes", bufsize); + + if (!PyArg_ParseTuple(args, "k|O", + &sidtype, // @pyparm int|WellKnownSidType||One of the Win*Sid constants + &obDomainSid)) // @pyparm <o PySID>|DomainSid|None|Domain for the new SID, or None for local machine + return NULL; + if (!PyWinObject_AsSID(obDomainSid, &DomainSid, TRUE)) + return NULL; + if (!(*pfnCreateWellKnownSid)(sidtype, DomainSid, outsid, &bufsize)) + PyWin_SetAPIError("CreateWellKnownSid"); + else + ret=new PySID(outsid); + free(outsid); + return ret; + } + %} + #define TOKEN_ADJUST_DEFAULT TOKEN_ADJUST_DEFAULT // Required to change the default ACL, primary group, or owner of an access token. #define TOKEN_ADJUST_GROUPS TOKEN_ADJUST_GROUPS // Required to change the groups specified in an access token. *************** *** 3780,3785 **** #define DS_SPN_SERVICE DS_SPN_SERVICE ! #Spn operations used with DsWriteAccountSpn #define DS_SPN_ADD_SPN_OP DS_SPN_ADD_SPN_OP #define DS_SPN_REPLACE_SPN_OP DS_SPN_REPLACE_SPN_OP #define DS_SPN_DELETE_SPN_OP DS_SPN_DELETE_SPN_OP --- 3814,3882 ---- #define DS_SPN_SERVICE DS_SPN_SERVICE ! // Spn operations used with DsWriteAccountSpn #define DS_SPN_ADD_SPN_OP DS_SPN_ADD_SPN_OP #define DS_SPN_REPLACE_SPN_OP DS_SPN_REPLACE_SPN_OP #define DS_SPN_DELETE_SPN_OP DS_SPN_DELETE_SPN_OP + + // WELL_KNOWN_SID_TYPE used with CreateWellKnownSid + #define WinNullSid WinNullSid + #define WinWorldSid WinWorldSid + #define WinLocalSid WinLocalSid + #define WinCreatorOwnerSid WinCreatorOwnerSid + #define WinCreatorGroupSid WinCreatorGroupSid + #define WinCreatorOwnerServerSid WinCreatorOwnerServerSid + #define WinCreatorGroupServerSid WinCreatorGroupServerSid + #define WinNtAuthoritySid WinNtAuthoritySid + #define WinDialupSid WinDialupSid + #define WinNetworkSid WinNetworkSid + #define WinBatchSid WinBatchSid + #define WinInteractiveSid WinInteractiveSid + #define WinServiceSid WinServiceSid + #define WinAnonymousSid WinAnonymousSid + #define WinProxySid WinProxySid + #define WinEnterpriseControllersSid WinEnterpriseControllersSid + #define WinSelfSid WinSelfSid + #define WinAuthenticatedUserSid WinAuthenticatedUserSid + #define WinRestrictedCodeSid WinRestrictedCodeSid + #define WinTerminalServerSid WinTerminalServerSid + #define WinRemoteLogonIdSid WinRemoteLogonIdSid + #define WinLogonIdsSid WinLogonIdsSid + #define WinLocalSystemSid WinLocalSystemSid + #define WinLocalServiceSid WinLocalServiceSid + #define WinNetworkServiceSid WinNetworkServiceSid + #define WinBuiltinDomainSid WinBuiltinDomainSid + #define WinBuiltinAdministratorsSid WinBuiltinAdministratorsSid + #define WinBuiltinUsersSid WinBuiltinUsersSid + #define WinBuiltinGuestsSid WinBuiltinGuestsSid + #define WinBuiltinPowerUsersSid WinBuiltinPowerUsersSid + #define WinBuiltinAccountOperatorsSid WinBuiltinAccountOperatorsSid + #define WinBuiltinSystemOperatorsSid WinBuiltinSystemOperatorsSid + #define WinBuiltinPrintOperatorsSid WinBuiltinPrintOperatorsSid + #define WinBuiltinBackupOperatorsSid WinBuiltinBackupOperatorsSid + #define WinBuiltinReplicatorSid WinBuiltinReplicatorSid + #define WinBuiltinPreWindows2000CompatibleAccessSid WinBuiltinPreWindows2000CompatibleAccessSid + #define WinBuiltinRemoteDesktopUsersSid WinBuiltinRemoteDesktopUsersSid + #define WinBuiltinNetworkConfigurationOperatorsSid WinBuiltinNetworkConfigurationOperatorsSid + #define WinAccountAdministratorSid WinAccountAdministratorSid + #define WinAccountGuestSid WinAccountGuestSid + #define WinAccountKrbtgtSid WinAccountKrbtgtSid + #define WinAccountDomainAdminsSid WinAccountDomainAdminsSid + #define WinAccountDomainUsersSid WinAccountDomainUsersSid + #define WinAccountDomainGuestsSid WinAccountDomainGuestsSid + #define WinAccountComputersSid WinAccountComputersSid + #define WinAccountControllersSid WinAccountControllersSid + #define WinAccountCertAdminsSid WinAccountCertAdminsSid + #define WinAccountSchemaAdminsSid WinAccountSchemaAdminsSid + #define WinAccountEnterpriseAdminsSid WinAccountEnterpriseAdminsSid + #define WinAccountPolicyAdminsSid WinAccountPolicyAdminsSid + #define WinAccountRasAndIasServersSid WinAccountRasAndIasServersSid + #define WinNTLMAuthenticationSid WinNTLMAuthenticationSid + #define WinDigestAuthenticationSid WinDigestAuthenticationSid + #define WinSChannelAuthenticationSid WinSChannelAuthenticationSid + #define WinThisOrganizationSid WinThisOrganizationSid + #define WinOtherOrganizationSid WinOtherOrganizationSid + #define WinBuiltinIncomingForestTrustBuildersSid WinBuiltinIncomingForestTrustBuildersSid + #define WinBuiltinPerfMonitoringUsersSid WinBuiltinPerfMonitoringUsersSid + #define WinBuiltinPerfLoggingUsersSid WinBuiltinPerfLoggingUsersSid + // #define WinBuiltinAuthorizationAccessSid WinBuiltinAuthorizationAccessSid + // #define WinBuiltinTerminalServerLicenseServersSid WinBuiltinTerminalServerLicenseServersSid |
From: Roger U. <ru...@us...> - 2005-08-29 09:51:58
|
Update of /cvsroot/pywin32/pywin32/win32/src/win32net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18346/win32/src/win32net Modified Files: win32netfile.cpp win32netmisc.cpp win32netmodule.cpp Log Message: Add NetServerComputerNameAdd and NetServerComputerNameDel, autoduck fixes Index: win32netmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32net/win32netmodule.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** win32netmodule.cpp 29 Jul 2005 01:33:08 -0000 1.20 --- win32netmodule.cpp 29 Aug 2005 09:51:45 -0000 1.21 *************** *** 1049,1052 **** --- 1049,1055 ---- extern PyObject * PyNetValidateName(PyObject *self, PyObject *args); + extern PyObject * PyNetServerComputerNameAdd(PyObject *self, PyObject *args); + extern PyObject * PyNetServerComputerNameDel(PyObject *self, PyObject *args); + /* List of functions exported by this module */ // @module win32net|A module encapsulating the Windows Network API. *************** *** 1126,1129 **** --- 1129,1134 ---- {"NetFileGetInfo", PyNetFileGetInfo, 1}, // @pymeth NetFileGetInfo|Get info about files open on the server. {"NetStatisticsGet", PyNetStatisticsGet, 1}, // @pymeth NetStatisticsGet|Return server or workstation stats + {"NetServerComputerNameAdd",PyNetServerComputerNameAdd,1}, // @pymeth NetServerComputerNameAdd|Adds an extra network name for a server + {"NetServerComputerNameDel",PyNetServerComputerNameDel,1}, // @pymeth NetServerComputerNameDel|Deletes an emulated computer name created by <om win32net.PyNetServerComputerNameAdd> #if WINVER >= 0x0500 {"NetValidateName", PyNetValidateName, 1}, // @pymeth NetValidateName|Verify that computer/domain name is valid for given context Index: win32netfile.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32net/win32netfile.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** win32netfile.cpp 13 Jan 2005 06:29:32 -0000 1.4 --- win32netfile.cpp 29 Aug 2005 09:51:45 -0000 1.5 *************** *** 142,146 **** } ! // @pymethod (dict,...)|win32net|NetFileClose|Closes an open network resource on a server PyObject * PyNetFileClose(PyObject *self, PyObject *args) --- 142,146 ---- } ! // @pymethod |win32net|NetFileClose|Closes an open network resource on a server PyObject * PyNetFileClose(PyObject *self, PyObject *args) Index: win32netmisc.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32net/win32netmisc.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** win32netmisc.cpp 29 Jul 2005 01:33:08 -0000 1.11 --- win32netmisc.cpp 29 Aug 2005 09:51:45 -0000 1.12 *************** *** 1270,1273 **** --- 1270,1332 ---- } + + + // @pymethod |win32net|NetServerComputerNameAdd|Adds an additional network name for a server + // @rdesc Returns none on success + PyObject * PyNetServerComputerNameAdd(PyObject *self, PyObject *args) + { + // @pyparm string/<o PyUnicode>|ServerName||Name of server that will receive additional name + // @pyparm string/<o PyUnicode>|EmulatedDomainName||Domain under which to add the new server name, can be None + // @pyparm string/<o PyUnicode>|EmulatedServerName||New network name that server will respond to + NET_API_STATUS err; + WCHAR *servername=NULL, *domain=NULL, *newname=NULL; + PyObject *observername, *obdomain, *obnewname; + PyObject *ret=NULL; + if (!PyArg_ParseTuple(args,"OOO", &observername, &obdomain, &obnewname)) + return NULL; + if (PyWinObject_AsWCHAR(observername, &servername, FALSE) + &&PyWinObject_AsWCHAR(obdomain, &domain, TRUE) + &&PyWinObject_AsWCHAR(obnewname, &newname, FALSE)){ + err=NetServerComputerNameAdd(servername, domain, newname); + if (err==NERR_Success){ + Py_INCREF(Py_None); + ret=Py_None; + } + else + ReturnNetError("NetServerComputerNameAdd", err); + } + PyWinObject_FreeWCHAR(servername); + PyWinObject_FreeWCHAR(domain); + PyWinObject_FreeWCHAR(newname); + return ret; + } + + // @pymethod |win32net|NetServerComputerNameDel|Removes a network name added by <om win32net.NetServerComputerNameAdd> + // @rdesc Returns none on success + PyObject * PyNetServerComputerNameDel(PyObject *self, PyObject *args) + { + // @pyparm string/<o PyUnicode>|ServerName||Name of server on which to operate + // @pyparm string/<o PyUnicode>|EmulatedServerName||Network name to be removed + NET_API_STATUS err; + WCHAR *servername=NULL, *newname=NULL; + PyObject *observername, *obnewname; + PyObject *ret=NULL; + if (!PyArg_ParseTuple(args,"OO", &observername, &obnewname)) + return NULL; + if (PyWinObject_AsWCHAR(observername, &servername, FALSE) + &&PyWinObject_AsWCHAR(obnewname, &newname, FALSE)){ + err=NetServerComputerNameDel(servername, newname); + if (err==NERR_Success){ + Py_INCREF(Py_None); + ret=Py_None; + } + else + ReturnNetError("NetServerComputerNameDel", err); + } + PyWinObject_FreeWCHAR(servername); + PyWinObject_FreeWCHAR(newname); + return ret; + } + #if WINVER >= 0x0500 |
From: Mark H. <mha...@us...> - 2005-08-22 03:14:46
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/mapi/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4419/com/win32comext/mapi/src Modified Files: PyIDistList.i Log Message: Patch from Jurgen that corrects PyIDistList to derive from PyIMAPIContainer Index: PyIDistList.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/mapi/src/PyIDistList.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyIDistList.i 1 Sep 1999 23:17:16 -0000 1.1 --- PyIDistList.i 22 Aug 2005 03:14:38 -0000 1.2 *************** *** 15,19 **** PyIDistList::PyIDistList(IUnknown *pDisp) : ! PyIMAPIProp(pDisp) { ob_type = &type; --- 15,19 ---- PyIDistList::PyIDistList(IUnknown *pDisp) : ! PyIMAPIContainer(pDisp) { ob_type = &type; |
From: Mark H. <mha...@us...> - 2005-08-22 03:14:45
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4419 Modified Files: setup.py Log Message: Patch from Jurgen that corrects PyIDistList to derive from PyIMAPIContainer Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** setup.py 31 Jul 2005 09:01:59 -0000 1.15 --- setup.py 22 Aug 2005 03:14:37 -0000 1.16 *************** *** 1090,1094 **** 'PyIAddrBook': 'IMAPIProp', 'PyIAttach': 'IMAPIProp', ! 'PyIDistList': 'IMAPIProp', 'PyIMailUser': 'IMAPIContainer', 'PyIMAPIContainer': 'IMAPIProp', --- 1090,1094 ---- 'PyIAddrBook': 'IMAPIProp', 'PyIAttach': 'IMAPIProp', ! 'PyIDistList': 'IMAPIContainer', 'PyIMailUser': 'IMAPIContainer', 'PyIMAPIContainer': 'IMAPIProp', |
From: Mark H. <mha...@us...> - 2005-07-31 09:02:09
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21674 Modified Files: setup.py Log Message: win32help with new platform SDK requires bufferoverflowu.lib - this also involved moving find_platform_sdk(). Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** setup.py 29 Jul 2005 01:36:25 -0000 1.14 --- setup.py 31 Jul 2005 09:01:59 -0000 1.15 *************** *** 88,91 **** --- 88,161 ---- os.chdir(os.path.dirname(this_file)) + # We need to know the platform SDK dir before we can list the extensions. + 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 + + sdk_dir = find_platform_sdk_dir() + class WinExt (Extension): # Base class for all win32 extensions, with some predefined *************** *** 294,298 **** # (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') --- 364,368 ---- # (Note that just having them in INCLUDE/LIB does *not* work - # distutils thinks it knows better, and resets those vars. ! # Note: sdk_dir is a global. if sdk_dir: extra = os.path.join(sdk_dir, 'include') *************** *** 831,835 **** ("win32evtlog", "advapi32 oleaut32", False), # win32gui handled below - ("win32help", "htmlhelp user32 advapi32", False, 0x0500), ("win32lz", "lz32", False), ("win32net", "netapi32", True, None, """ --- 901,904 ---- *************** *** 908,911 **** --- 977,992 ---- ] + # win32help uses htmlhelp.lib which is built with MSVC7 and /GS. This + # causes problems with references to the @__security_check_cookie magic. + # Use bufferoverflowu.lib if it exists. + win32help_libs = "htmlhelp user32 advapi32" + if sdk_dir and os.path.exists(os.path.join(sdk_dir, "Lib", "bufferoverflowu.lib")): + win32help_libs += " bufferoverflowu" + win32_extensions += [ + WinExt_win32('win32help', + libraries=win32help_libs, + windows_h_version = 0x500), + ] + dirs = { 'adsi' : 'com/win32comext/adsi/src', *************** *** 1043,1115 **** 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): --- 1124,1127 ---- |
From: Mark H. <mha...@us...> - 2005-07-29 05:32:25
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17582/src Modified Files: shell_pch.h Log Message: Work with latest platform SDK Index: shell_pch.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/shell_pch.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** shell_pch.h 19 Mar 2004 04:33:16 -0000 1.5 --- shell_pch.h 29 Jul 2005 05:32:17 -0000 1.6 *************** *** 1,4 **** --- 1,6 ---- // shell_pch.h : header file for PCH generation for the shell COM extension + #define _WIN32_IE 0x0601 + #include <windows.h> #include <oleauto.h> |
From: Mark H. <mha...@us...> - 2005-07-29 05:30:46
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/axdebug/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17420/src Modified Files: stdafx.h Log Message: Latest platform SDK removed lots of contants from dbgprop.h Index: stdafx.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axdebug/src/stdafx.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** stdafx.h 26 Jan 2005 01:53:03 -0000 1.2 --- stdafx.h 29 Jul 2005 05:30:32 -0000 1.3 *************** *** 26,29 **** --- 26,73 ---- #include "activdbg.h" + #if defined(__REQUIRED_RPCNDR_H_VERSION__) + // for some strange reason, these no longer exist in dbgprop.h !?!? + enum __MIDL___MIDL_itf_dbgprop_0000_0001 + { DBGPROP_ATTRIB_NO_ATTRIB = 0, + DBGPROP_ATTRIB_VALUE_IS_INVALID = 0x8, + DBGPROP_ATTRIB_VALUE_IS_EXPANDABLE = 0x10, + DBGPROP_ATTRIB_VALUE_READONLY = 0x800, + DBGPROP_ATTRIB_ACCESS_PUBLIC = 0x1000, + DBGPROP_ATTRIB_ACCESS_PRIVATE = 0x2000, + DBGPROP_ATTRIB_ACCESS_PROTECTED = 0x4000, + DBGPROP_ATTRIB_ACCESS_FINAL = 0x8000, + DBGPROP_ATTRIB_STORAGE_GLOBAL = 0x10000, + DBGPROP_ATTRIB_STORAGE_STATIC = 0x20000, + DBGPROP_ATTRIB_STORAGE_FIELD = 0x40000, + DBGPROP_ATTRIB_STORAGE_VIRTUAL = 0x80000, + DBGPROP_ATTRIB_TYPE_IS_CONSTANT = 0x100000, + DBGPROP_ATTRIB_TYPE_IS_SYNCHRONIZED = 0x200000, + DBGPROP_ATTRIB_TYPE_IS_VOLATILE = 0x400000, + DBGPROP_ATTRIB_HAS_EXTENDED_ATTRIBS = 0x800000 + }; + typedef DWORD DBGPROP_ATTRIB_FLAGS; + + + enum __MIDL___MIDL_itf_dbgprop_0000_0002 + { DBGPROP_INFO_NAME = 0x1, + DBGPROP_INFO_TYPE = 0x2, + DBGPROP_INFO_VALUE = 0x4, + DBGPROP_INFO_FULLNAME = 0x20, + DBGPROP_INFO_ATTRIBUTES = 0x8, + DBGPROP_INFO_DEBUGPROP = 0x10, + DBGPROP_INFO_AUTOEXPAND = 0x8000000 + }; + typedef DWORD DBGPROP_INFO_FLAGS; + + enum { + EX_DBGPROP_INFO_ID =0x0100, + EX_DBGPROP_INFO_NTYPE =0x0200, + EX_DBGPROP_INFO_NVALUE =0x0400, + EX_DBGPROP_INFO_LOCKBYTES =0x0800, + EX_DBGPROP_INFO_DEBUGEXTPROP =0x1000 + }; + + #endif + // PythonAX Helpers. extern BOOL PyAXDebug_PySOURCE_TEXT_ATTR_Length( PyObject *obAttr, ULONG *pLength ); |
From: Mark H. <mha...@us...> - 2005-07-29 05:11:27
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15761/include Modified Files: stdafx.h Log Message: Get things working with latest platform sdk. Index: stdafx.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/stdafx.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** stdafx.h 8 Nov 2003 05:38:17 -0000 1.3 --- stdafx.h 29 Jul 2005 05:11:19 -0000 1.4 *************** *** 8,12 **** // #define _WIN32_DCOM ! // PyWinTypes.h pulls in Python.h and windows.h. #include <PyWinTypes.h> --- 8,13 ---- // #define _WIN32_DCOM ! #define _WIN32_WINNT 0x0501 // we use some of these features. // PyWinTypes.h pulls in Python.h and windows.h. + #include <PyWinTypes.h> |
From: Mark H. <mha...@us...> - 2005-07-29 01:36:35
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19927 Modified Files: setup.py Log Message: Flag a few modules as requiring a recent windows.h Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** setup.py 7 Jul 2005 14:46:07 -0000 1.13 --- setup.py 29 Jul 2005 01:36:25 -0000 1.14 *************** *** 841,848 **** ("win32pdh", "", False), ("win32pipe", "", False), ! ("win32print", "winspool user32 gdi32", False), ("win32process", "advapi32 user32", False, 0x0500), ("win32ras", "rasapi32 user32", False), ! ("win32security", "advapi32 user32 netapi32", True, None, """ win32/src/win32security.i win32/src/win32securitymodule.cpp win32/src/win32security_sspi.cpp win32/src/win32security_ds.cpp --- 841,848 ---- ("win32pdh", "", False), ("win32pipe", "", False), ! ("win32print", "winspool user32 gdi32", False, 0x0500), ("win32process", "advapi32 user32", False, 0x0500), ("win32ras", "rasapi32 user32", False), ! ("win32security", "advapi32 user32 netapi32", True, 0x0500, """ win32/src/win32security.i win32/src/win32securitymodule.cpp win32/src/win32security_sspi.cpp win32/src/win32security_ds.cpp *************** *** 877,880 **** --- 877,881 ---- win32/src/win32gui.i win32/src/win32guimodule.cpp """.split(), + windows_h_version=0x0500, libraries="gdi32 user32 comdlg32 comctl32 shell32", define_macros = [("WIN32GUI", None)], *************** *** 888,891 **** --- 889,893 ---- """.split(), libraries="gdi32 user32 comdlg32 comctl32 shell32", + windows_h_version=0x0500, define_macros = [("WIN32GUI",None), ("WINXPGUI",None)], extra_swig_commands=["-DWINXPGUI"], *************** *** 945,949 **** WinExt_win32com('axdebug', dsp_file=r"com\Active Debugging.dsp", ! libraries="axscript ad1", pch_header = "stdafx.h", optional_headers = ["activdbg.h"], --- 947,951 ---- WinExt_win32com('axdebug', dsp_file=r"com\Active Debugging.dsp", ! libraries="axscript", pch_header = "stdafx.h", optional_headers = ["activdbg.h"], |