pywin32-checkins Mailing List for Python for Windows Extensions (Page 152)
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: <ru...@us...> - 2003-10-21 02:08:31
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1:/tmp/cvs-serv19064/win32/src Modified Files: win32apimodule.cpp Log Message: Add EnumResourceTypes and EnumResourceLanguages from patch# 812181 Index: win32apimodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32apimodule.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** win32apimodule.cpp 18 Oct 2003 06:15:48 -0000 1.26 --- win32apimodule.cpp 21 Oct 2003 02:06:45 -0000 1.27 *************** *** 3672,3675 **** --- 3672,3690 ---- } + BOOL PyWinObject_AsResourceID(PyObject *ob, long *resource_id) + { + // resource names and types can be either string pointers or long ints + if (PyWinObject_AsWCHAR(ob, (WCHAR **)resource_id)) + return TRUE; + PyErr_Clear(); + if (PyInt_Check(ob)){ + *resource_id=PyInt_AsLong(ob); + return TRUE; + } + PyErr_Clear(); + PyErr_SetString(PyExc_TypeError, "Resource name/type must be integer or string"); + return FALSE; + } + BOOL CALLBACK EnumResProc(HMODULE module, LPCSTR type, LPSTR name, PyObject *param) *************** *** 3689,3692 **** --- 3704,3708 ---- } PyList_Append(param, pyname); + Py_DECREF(pyname); return TRUE; } *************** *** 3726,3729 **** --- 3742,3826 ---- } + BOOL CALLBACK EnumResourceTypesProc(HMODULE hmodule, WCHAR* typname, PyObject *ret) + { + PyObject *obname=NULL; + if (IS_INTRESOURCE(typname)) + obname=PyInt_FromLong((LONG)typname); + else + obname=PyWinObject_FromWCHAR(typname); + if (obname==NULL) + return FALSE; + PyList_Append(ret, obname); + Py_DECREF(obname); + return TRUE; + } + + // @pymethod [<o PyUnicode>,...]|win32api|EnumResourceTypes|Return name or integer id of all resource types contained in module + PyObject *PyEnumResourceTypes(PyObject *, PyObject *args) + { + PyObject *ret=NULL, *pyhandle=NULL; + HMODULE hmodule; + + // @pyparm <o PyHandle>|hmodule||The handle to the module to enumerate. + if (!PyArg_ParseTuple(args, "O:EnumResourceTypes", &pyhandle)) + return NULL; + if (!PyWinObject_AsHANDLE(pyhandle, (void **)&hmodule)) + return NULL; + ret=PyList_New(0); + if(!EnumResourceTypesW(hmodule, + reinterpret_cast<ENUMRESTYPEPROCW>(EnumResourceTypesProc), + reinterpret_cast<LONG>(ret))){ + Py_DECREF(ret); + ret=NULL; + PyWin_SetAPIError("EnumResourceTypes",GetLastError()); + } + return ret; + } + + BOOL CALLBACK EnumResourceLanguagesProc(HMODULE hmodule, WCHAR* typname, WCHAR *resname, WORD wIDLanguage, PyObject *ret) + { + long resid; + resid=wIDLanguage; + PyObject *oblangid = PyInt_FromLong(resid); + PyList_Append(ret, oblangid); + Py_DECREF(oblangid); + return TRUE; + } + + // @pymethod [<o PyUnicode>,...]|win32api|EnumResourceLanguages|List languages for a resource + PyObject *PyEnumResourceLanguages(PyObject *, PyObject *args) + { + PyObject *ret=NULL, *pyhandle=NULL; + HMODULE hmodule; + WCHAR *resname=NULL, *typname=NULL; + PyObject *obresname=NULL, *obtypname=NULL; + // @pyparm <o PyHandle>|hmodule||Handle to the module that contains resource + // @pyparm string/unicode/int|lpType||Resource type, can be string or integer + // @pyparm string/unicode/int|lpName||Resource name, can be string or integer + if (!PyArg_ParseTuple(args, "OOO:EnumResourceLanguages", &pyhandle, &obtypname, &obresname)) + return NULL; + if (!PyWinObject_AsHANDLE(pyhandle, (void **)&hmodule)) + return NULL; + if(!PyWinObject_AsResourceID(obtypname,(long *)&typname)) + goto done; + if(!PyWinObject_AsResourceID(obresname,(long *)&resname)) + goto done; + ret=PyList_New(0); + if(!EnumResourceLanguagesW(hmodule, + typname, + resname, + reinterpret_cast<ENUMRESLANGPROCW>(EnumResourceLanguagesProc), + reinterpret_cast<LONG>(ret))){ + Py_DECREF(ret); + ret=NULL; + PyWin_SetAPIError("EnumResourceLanguages",GetLastError()); + } + done: + if ((typname!=NULL)&&(!IS_INTRESOURCE(typname))) + PyWinObject_FreeWCHAR(typname); + if ((resname!=NULL)&&(!IS_INTRESOURCE(resname))) + PyWinObject_FreeWCHAR(resname); + return ret; + } // @pymethod <o PyUnicode>|win32api|Unicode|Creates a new Unicode object *************** *** 4079,4083 **** --- 4176,4182 ---- {"DuplicateHandle", PyDuplicateHandle, 1}, // @pymeth DuplicateHandle|Duplicates a handle. {"EndUpdateResource", PyEndUpdateResource, 1 }, // @pymeth EndUpdateResource|Ends a resource update cycle of a PE file. + {"EnumResourceLanguages", PyEnumResourceLanguages, 1 }, // @pymeth EnumResourceLanguages|List languages for specified resource {"EnumResourceNames", PyEnumResourceNames, 1 }, // @pymeth EnumResourceNames|Enumerates all the resources of the specified type from the nominated file. + {"EnumResourceTypes", PyEnumResourceTypes, 1 }, // @pymeth EnumResourceTypes|Return list of all resource types contained in module {"ExpandEnvironmentStrings",PyExpandEnvironmentStrings, 1}, // @pymeth ExpandEnvironmentStrings|Expands environment-variable strings and replaces them with their defined values. {"ExitWindows", PyExitWindows, 1}, // @pymeth ExitWindows|Logs off the current user *************** *** 4294,4296 **** --- 4393,4396 ---- + |
From: <mha...@us...> - 2003-10-20 10:36:49
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory sc8-pr-cvs1:/tmp/cvs-serv29948 Modified Files: testvb.py Log Message: Add some more collection tests, to ensure we don't break things while fixing them :) Index: testvb.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testvb.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** testvb.py 1 Mar 2003 00:13:27 -0000 1.13 --- testvb.py 20 Oct 2003 10:01:45 -0000 1.14 *************** *** 116,119 **** --- 116,120 ---- TestStructs(vbtest) + TestCollections(vbtest) assert vbtest.TakeByValObject(vbtest)==vbtest *************** *** 218,221 **** --- 219,270 ---- # if ret != (0,1): # raise error, "Could not increment the integer with default arg- "+str(ret) + + def _DoTestCollection(vbtest, col_name, expected): + # It sucks that some objects allow "Count()", but others "Count" + def _getcount(ob): + r = getattr(ob, "Count") + if type(r)!=type(0): + return r() + return r + c = getattr(vbtest, col_name) + check = [] + for item in c: + check.append(item) + if check != list(expected): + raise error, "Collection %s didn't have %r (had %r)" % (col_name, expected, check) + # Check len()==Count() + c = getattr(vbtest, col_name) + if len(c) != _getcount(c): + raise error, "Collection %s __len__(%r) wasn't==Count(%r)" % (col_name, len(c), _getcount(c)) + # Check we can do it with zero based indexing. + c = getattr(vbtest, col_name) + check = [] + for i in range(_getcount(c)): + check.append(c[i]) + if check != list(expected): + raise error, "Collection %s didn't have %r (had %r)" % (col_name, expected, check) + + # Check we can do it with our old "Skip/Next" methods. + c = getattr(vbtest, col_name)._NewEnum() + check = [] + while 1: + n = c.Next() + if not n: + break + check.append(n[0]) + if check != list(expected): + raise error, "Collection %s didn't have %r (had %r)" % (col_name, expected, check) + + def TestCollections(vbtest): + _DoTestCollection(vbtest, "CollectionProperty", [1,"Two", "3"]) + # zero based indexing works for simple VB collections. + if vbtest.CollectionProperty[0] != 1: + raise error, "The CollectionProperty[0] element was not the default value" + + _DoTestCollection(vbtest, "EnumerableCollectionProperty", []) + vbtest.EnumerableCollectionProperty.Add(1) + vbtest.EnumerableCollectionProperty.Add("Two") + vbtest.EnumerableCollectionProperty.Add("3") + _DoTestCollection(vbtest, "EnumerableCollectionProperty", [1,"Two", "3"]) def TestStructs(vbtest): |
From: <mha...@us...> - 2003-10-20 05:19:53
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory sc8-pr-cvs1:/tmp/cvs-serv19875 Modified Files: PyRecord.cpp oleargs.cpp Log Message: Get record objects working with copy/pickle again. Index: PyRecord.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyRecord.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PyRecord.cpp 10 Jan 2003 02:42:46 -0000 1.8 --- PyRecord.cpp 20 Oct 2003 04:48:26 -0000 1.9 *************** *** 179,188 **** } // Creates a new Record by TAKING A COPY of the passed record. ! PyObject *PyObject_FromRecordInfo(IRecordInfo *ri, void *data) { ULONG cb; HRESULT hr = ri->GetSize(&cb); if (FAILED(hr)) return PyCom_BuildPyException(hr, ri, g_IID_IRecordInfo); PyRecordBuffer *owner = new PyRecordBuffer(cb); if (PyErr_Occurred()) { // must be mem error! --- 179,192 ---- } // Creates a new Record by TAKING A COPY of the passed record. ! PyObject *PyObject_FromRecordInfo(IRecordInfo *ri, void *data, ULONG cbData) { + if ((data != NULL && cbData==0) || (data==NULL && cbData != 0)) + return PyErr_Format(PyExc_RuntimeError, "Both or neither data and size must be given"); ULONG cb; HRESULT hr = ri->GetSize(&cb); if (FAILED(hr)) return PyCom_BuildPyException(hr, ri, g_IID_IRecordInfo); + if (cbData != 0 && cbData != cb) + return PyErr_Format(PyExc_ValueError, "Expecting a string of %d bytes (got %d)", cb, cbData); PyRecordBuffer *owner = new PyRecordBuffer(cb); if (PyErr_Occurred()) { // must be mem error! *************** *** 206,217 **** PyObject *pythoncom_GetRecordFromGuids(PyObject *self, PyObject *args) { PyObject *obGuid, *obInfoGuid; int maj, min, lcid; ! if (!PyArg_ParseTuple(args, "OiiiO:GetRecordFromGuids", &obGuid, // @pyparm <o PyIID>|iid||The GUID of the type library &maj, // @pyparm int|verMajor||The major version number of the type lib. &min, // @pyparm int|verMinor||The minor version number of the type lib. &lcid, // @pyparm int|lcid||The LCID of the type lib. ! &obInfoGuid)) // @pyparm <o PyIID>|infoIID||The GUID of the record info in the library return NULL; GUID guid, infoGuid; --- 210,224 ---- PyObject *pythoncom_GetRecordFromGuids(PyObject *self, PyObject *args) { + char *data = NULL; PyObject *obGuid, *obInfoGuid; int maj, min, lcid; ! int cb = 0; ! if (!PyArg_ParseTuple(args, "OiiiO|z#:GetRecordFromGuids", &obGuid, // @pyparm <o PyIID>|iid||The GUID of the type library &maj, // @pyparm int|verMajor||The major version number of the type lib. &min, // @pyparm int|verMinor||The minor version number of the type lib. &lcid, // @pyparm int|lcid||The LCID of the type lib. ! &obInfoGuid, // @pyparm <o PyIID>|infoIID||The GUID of the record info in the library ! &data, &cb)) // @pyparm string|data|None|The raw data to initialize the record with. return NULL; GUID guid, infoGuid; *************** *** 224,228 **** if (FAILED(hr)) return PyCom_BuildPyException(hr); ! PyObject *ret = PyObject_FromRecordInfo(i, NULL); i->Release(); return ret; --- 231,235 ---- if (FAILED(hr)) return PyCom_BuildPyException(hr); ! PyObject *ret = PyObject_FromRecordInfo(i, data, cb); i->Release(); return ret; *************** *** 268,277 **** }; ! static PyObject *PyRecord_copy(PyObject *self, PyObject *args) { ! if (!PyArg_ParseTuple(args, ":copy")) ! return NULL; PyRecord *pyrec = (PyRecord *)self; ! return PyObject_FromRecordInfo(pyrec->pri, pyrec->pdata); } // The object itself. --- 275,339 ---- }; ! static PyObject *PyRecord_reduce(PyObject *self, PyObject *args) { ! PyObject *ret = NULL; PyRecord *pyrec = (PyRecord *)self; ! PyObject *obModule = NULL, *obModDict = NULL, *obFunc = NULL; ! ITypeInfo *pti = NULL; ! TYPEATTR *pta = NULL; ! ULONG cb; ! HRESULT hr; ! GUID structguid; ! if (!PyArg_ParseTuple(args, ":reduce")) ! return NULL; ! hr = pyrec->pri->GetTypeInfo(&pti); ! if (FAILED(hr)||pti==NULL) { ! PyCom_BuildPyException(hr); ! goto done; ! } ! hr = pti->GetTypeAttr(&pta); ! if (FAILED(hr)||pta==NULL) { ! PyCom_BuildPyException(hr); ! goto done; ! } ! hr = pyrec->pri->GetGuid(&structguid); ! if (FAILED(hr)) { ! PyCom_BuildPyException(hr); ! goto done; ! } ! hr = pyrec->pri->GetSize(&cb); ! if (FAILED(hr)) { ! PyCom_BuildPyException(hr); ! goto done; ! } ! obModule = PyImport_ImportModule("pythoncom"); ! if (obModule) ! obModDict = PyModule_GetDict(obModule); // no ref added! ! if (obModDict) ! obFunc = PyDict_GetItemString(obModDict, "GetRecordFromGuids"); // no ref added! ! if (!obFunc) { ! PyErr_Clear(); ! PyErr_SetString(PyExc_RuntimeError, "pythoncom.GetRecordFromGuids() can't be located!"); ! goto done; ! } ! { // scope for locals avoiding goto ! PyObject *obtlbguid = PyWinObject_FromIID(pta->guid); ! PyObject *obstructguid = PyWinObject_FromIID(structguid); ! ret = Py_BuildValue("O(NiiiNs#)", ! obFunc, ! obtlbguid, ! pta->wMajorVerNum, ! pta->wMinorVerNum, ! pta->lcid, ! obstructguid, ! pyrec->pdata, cb); ! } // end scope ! done: ! if (pta&& pti) ! pti->ReleaseTypeAttr(pta); ! if (pti) pti->Release(); ! Py_XDECREF(obModule); ! // obModDict and obFunc have no new reference. ! return ret; } // The object itself. *************** *** 279,283 **** // structure names! static struct PyMethodDef PyRecord_methods[] = { ! {"__copy__", PyRecord_copy, 1}, // This allows the copy module to work! {NULL} }; --- 341,345 ---- // structure names! static struct PyMethodDef PyRecord_methods[] = { ! {"__reduce__", PyRecord_reduce, 1}, // This allows the copy module to work! {NULL} }; Index: oleargs.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/oleargs.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** oleargs.cpp 2 Jul 2003 03:42:27 -0000 1.21 --- oleargs.cpp 20 Oct 2003 04:48:26 -0000 1.22 *************** *** 7,11 **** extern void PyCom_LogF(const TCHAR *fmt, ...); ! extern PyObject *PyObject_FromRecordInfo(IRecordInfo *, void *); extern PyObject *PyObject_FromSAFEARRAYRecordInfo(SAFEARRAY *psa); extern BOOL PyObject_AsVARIANTRecordInfo(PyObject *ob, VARIANT *pv); --- 7,11 ---- extern void PyCom_LogF(const TCHAR *fmt, ...); ! extern PyObject *PyObject_FromRecordInfo(IRecordInfo *, void *, ULONG); extern PyObject *PyObject_FromSAFEARRAYRecordInfo(SAFEARRAY *psa); extern BOOL PyObject_AsVARIANTRecordInfo(PyObject *ob, VARIANT *pv); *************** *** 332,336 **** case VT_RECORD: ! result = PyObject_FromRecordInfo(V_RECORDINFO(&varValue), V_RECORD(&varValue)); break; default: --- 332,340 ---- case VT_RECORD: ! { ! ULONG cb; ! V_RECORDINFO(&varValue)->GetSize(&cb); ! result = PyObject_FromRecordInfo(V_RECORDINFO(&varValue), V_RECORD(&varValue), cb); ! } break; default: |
From: <mha...@us...> - 2003-10-19 11:38:49
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1:/tmp/cvs-serv1460 Modified Files: PyTime.cpp Log Message: [ 808465 ] Fix PyTime.Format, from David Fraser, as demonstrated in the new test_pywintypes.py Index: PyTime.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyTime.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PyTime.cpp 10 Jan 2003 02:31:47 -0000 1.7 --- PyTime.cpp 18 Oct 2003 23:36:21 -0000 1.8 *************** *** 160,164 **** return NULL; } ! TCHAR szBuffer[128]; PyTime *pTime = (PyTime *)self; --- 160,164 ---- return NULL; } ! TCHAR szBuffer[256]; PyTime *pTime = (PyTime *)self; *************** *** 178,183 **** tm.tm_year = st.wYear - 1900; tm.tm_isdst = -1; /* have the library figure it out */ ! if (!_tcsftime(szBuffer, 128/*_countof()*/, fmt, &tm)) szBuffer[0] = '\0'; // Better error? PyObject *rc = PyWinObject_FromTCHAR(szBuffer); --- 178,191 ---- tm.tm_year = st.wYear - 1900; tm.tm_isdst = -1; /* have the library figure it out */ + /* converting to time_t and back allows us to calculate + * tm.tm_wday (day of week) and tm.tm_yday (day of year) + * though day of week is available as st.wDayOfWeek, day of year is not in st + */ + time_t time = mktime(&tm); + tm = *localtime(&time); + // tm.tm_wday = st.wDayOfWeek; + // tm.tm_yday = st. day of year; ! if (!_tcsftime(szBuffer, 256/*_countof()*/, fmt, &tm)) szBuffer[0] = '\0'; // Better error? PyObject *rc = PyWinObject_FromTCHAR(szBuffer); |
From: <mha...@us...> - 2003-10-19 08:10:02
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1:/tmp/cvs-serv19642/src Modified Files: win32apimodule.cpp Log Message: [ 805880 ] GetFileVersionInfo, from Roger Upole Index: win32apimodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32apimodule.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** win32apimodule.cpp 18 Oct 2003 05:57:59 -0000 1.25 --- win32apimodule.cpp 18 Oct 2003 06:15:48 -0000 1.26 *************** *** 3896,3899 **** --- 3896,4019 ---- } + // @pymethod |GetFileVersionInfo||Retrieve version info for specified file + PyObject *PyGetFileVersionInfo(PyObject *self, PyObject *args) + { + int wcharcmp=0, nbr_langs=0, lang_ind=0; + WORD lang=0, codepage=0; + int langret=0, codepageret=0; + DWORD *lang_codepage; + PyObject *obfile_name=NULL, *obinfo=NULL; + PyObject *ret=NULL, *ret_item=NULL, *obft=NULL; + WCHAR *file_name=NULL, *info=NULL; + DWORD dwHandle=0, buf_len=0; + UINT value_len; + VOID *buf=NULL, *value=NULL; + VS_FIXEDFILEINFO *fixed_info; + FILETIME ft; + BOOL success; + if (!PyArg_ParseTuple(args,"OO", + &obfile_name, // @pyparm string/unicode|Filename||File to query for version info + &obinfo)) // @pyparm string/unicode|SubBlock||Information to return: \ for VS_FIXEDFILEINFO, \VarFileInfo\Translation for languages/codepages available + return NULL; + if (!PyWinObject_AsWCHAR(obfile_name, &file_name, FALSE)) + goto done; + if (!PyWinObject_AsWCHAR(obinfo, &info, FALSE)) + goto done; + buf_len=GetFileVersionInfoSizeW(file_name, &dwHandle); //handle is ignored + if (buf_len==0){ + PyWin_SetAPIError("GetFileVersionInfo:GetFileVersionInfoSize",GetLastError()); + goto done; + } + buf=malloc(buf_len); + if (buf==NULL){ + PyErr_SetString(PyExc_MemoryError, "GetFileVersionInfo"); + goto done; + } + if (!GetFileVersionInfoW(file_name, dwHandle, buf_len, buf)){ + PyWin_SetAPIError("GetFileVersionInfo",GetLastError()); + goto done; + } + success=VerQueryValueW(buf, info, &value, &value_len); + + wcharcmp = CompareStringW(LOCALE_USER_DEFAULT,0,info,-1,L"\\",-1); + if (wcharcmp==CSTR_EQUAL){ + if (!success){ + PyWin_SetAPIError("GetFileVersionInfo:VerQueryValue",GetLastError()); + goto done; + } + + fixed_info=(VS_FIXEDFILEINFO *)value; + ft.dwHighDateTime=fixed_info->dwFileDateMS; + ft.dwLowDateTime=fixed_info->dwFileDateLS; + // ?????? can't find any files where these are non-zero - conversion has not been tested ?????? + if ((ft.dwHighDateTime==0)&&(ft.dwLowDateTime==0)){ + obft=Py_None; + Py_INCREF(Py_None); + } + else + obft=PyWinObject_FromFILETIME(ft); + + ret=Py_BuildValue( + "{u:l,u:l,u:l,u:l,u:l,u:l,u:l,u:l,u:l,u:l,u:l,u:N}", + L"Signature", fixed_info->dwSignature, + L"StrucVersion", fixed_info->dwStrucVersion, + L"FileVersionMS", fixed_info->dwFileVersionMS, + L"FileVersionLS", fixed_info->dwFileVersionLS, + L"ProductVersionMS", fixed_info->dwProductVersionMS, + L"ProductVersionLS", fixed_info->dwProductVersionLS, + L"FileFlagsMask", fixed_info->dwFileFlagsMask, + L"FileFlags", fixed_info->dwFileFlags, + L"FileOS", fixed_info->dwFileOS, + L"FileType", fixed_info->dwFileType, + L"FileSubtype", fixed_info->dwFileSubtype, + L"FileDate", obft); + goto done; + } + + // win32api.GetFileVersionInfo('c:/win2k/system32/cmd.exe',"\\VarFileInfo\\Translation") + wcharcmp = CompareStringW(LOCALE_USER_DEFAULT,0,info,-1,L"\\VarFileInfo\\Translation",-1); + if (wcharcmp==CSTR_EQUAL){ + if (!success){ + PyWin_SetAPIError("GetFileVersionInfo:VerQueryValue",GetLastError()); + goto done; + } + //return value consists of lang id/code page pairs as DWORDs + nbr_langs=value_len/(sizeof(DWORD)); + ret=PyTuple_New(nbr_langs); + lang_codepage=(DWORD *)value; + for (lang_ind=0;lang_ind<nbr_langs;lang_ind++){ + langret=(lang=LOWORD(*lang_codepage)); + codepageret=(codepage=HIWORD(*lang_codepage)); + ret_item=Py_BuildValue("ii",langret,codepageret); + PyTuple_SetItem(ret,lang_ind,ret_item); + lang_codepage++; + } + goto done; + } + // VerQueryValue returns false and value pointer is null if specified string doesn't exist + // This includes cases where the language and codepage are wrong, and simple misspellings of the + // standard string parms. Maybe should throw error all the time ? GetLastError returns no + // useful info, though. + if (success) + ret=PyWinObject_FromWCHAR((WCHAR *)value); + else{ + if (value==NULL){ + Py_INCREF(Py_None); + ret=Py_None; + } + else + PyWin_SetAPIError("GetFileVersionInfo:VerQueryValue",GetLastError()); + } + + done: + if (file_name) + PyWinObject_FreeWCHAR(file_name); + if (info) + PyWinObject_FreeWCHAR(info); + if (buf) + free(buf); + return ret; + } + // @pymethod |win32api|keybd_event|Simulate a keyboard event PyObject *Pykeybd_event(PyObject *self, PyObject *args) *************** *** 3909,3913 **** &dwFlags, // @pyparm DWORD|dwFlags|0|Flags specifying various function options &dwExtraInfo)) // @pyparm DWORD|dwExtraInfo|0|Additional data associated with keystroke - return NULL; // @pyseeapi keybd_event --- 4029,4032 ---- *************** *** 3989,3992 **** --- 4108,4112 ---- {"GetEnvironmentVariable", PyGetEnvironmentVariable, 1}, // @pymeth GetEnvironmentVariable|Retrieves the value of an environment variable. {"GetFileAttributes", PyGetFileAttributes,1}, // @pymeth GetFileAttributes|Retrieves the attributes for the named file. + {"GetFileVersionInfo", PyGetFileVersionInfo, 1}, //@pymeth GetFileVersionInfo|Retrieves string version info {"GetFocus", PyGetFocus, 1}, // @pymeth GetFocus|Retrieves the handle of the keyboard focus window associated with the thread that called the method. {"GetFullPathName", PyGetFullPathName,1}, // @pymeth GetFullPathName|Returns the full path of a (possibly relative) path *************** *** 4130,4133 **** --- 4250,4286 ---- PyModule_AddIntConstant(module, "REG_NOTIFY_CHANGE_LAST_SET", REG_NOTIFY_CHANGE_LAST_SET); PyModule_AddIntConstant(module, "REG_NOTIFY_CHANGE_SECURITY", REG_NOTIFY_CHANGE_SECURITY); + + // FileOS values + PyModule_AddIntConstant(module, "VOS_DOS",VOS_DOS); + PyModule_AddIntConstant(module, "VOS_NT",VOS_NT); + PyModule_AddIntConstant(module, "VOS__WINDOWS16",VOS__WINDOWS16); + PyModule_AddIntConstant(module, "VOS__WINDOWS32",VOS__WINDOWS32); + PyModule_AddIntConstant(module, "VOS_OS216",VOS_OS216); + PyModule_AddIntConstant(module, "VOS_OS232",VOS_OS232); + PyModule_AddIntConstant(module, "VOS__PM16",VOS__PM16); + PyModule_AddIntConstant(module, "VOS__PM32",VOS__PM32); + PyModule_AddIntConstant(module, "VOS_UNKNOWN",VOS_UNKNOWN); + PyModule_AddIntConstant(module, "VOS_DOS_WINDOWS16",VOS_DOS_WINDOWS16); + PyModule_AddIntConstant(module, "VOS_DOS_WINDOWS32",VOS_DOS_WINDOWS32); + PyModule_AddIntConstant(module, "VOS_NT_WINDOWS32",VOS_NT_WINDOWS32); + PyModule_AddIntConstant(module, "VOS_OS216_PM16",VOS_OS216_PM16); + PyModule_AddIntConstant(module, "VOS_OS232_PM32",VOS_OS232_PM32); + + //FileType values + PyModule_AddIntConstant(module, "VFT_UNKNOWN",VFT_UNKNOWN); + PyModule_AddIntConstant(module, "VFT_APP",VFT_APP); + PyModule_AddIntConstant(module, "VFT_DLL",VFT_DLL); + PyModule_AddIntConstant(module, "VFT_DRV",VFT_DRV); + PyModule_AddIntConstant(module, "VFT_FONT",VFT_FONT); + PyModule_AddIntConstant(module, "VFT_VXD",VFT_VXD); + PyModule_AddIntConstant(module, "VFT_STATIC_LIB",VFT_STATIC_LIB); + + //FileFlags + PyModule_AddIntConstant(module, "VS_FF_DEBUG",VS_FF_DEBUG); + PyModule_AddIntConstant(module, "VS_FF_INFOINFERRED",VS_FF_INFOINFERRED); + PyModule_AddIntConstant(module, "VS_FF_PATCHED",VS_FF_PATCHED); + PyModule_AddIntConstant(module, "VS_FF_PRERELEASE",VS_FF_PRERELEASE); + PyModule_AddIntConstant(module, "VS_FF_PRIVATEBUILD",VS_FF_PRIVATEBUILD); + PyModule_AddIntConstant(module, "VS_FF_SPECIALBUILD",VS_FF_SPECIALBUILD); HMODULE hmodule = LoadLibrary("secur32.dll"); |
From: <mha...@us...> - 2003-10-19 07:11:30
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory sc8-pr-cvs1:/tmp/cvs-serv1123 Added Files: test_pywintypes.py Log Message: [ 808464 ] add test for PyTime.Format, from David Fraser --- NEW FILE: test_pywintypes.py --- import unittest import pywintypes import time class TestCase(unittest.TestCase): def testPyTimeFormat(self): struct_current = time.localtime() pytime_current = pywintypes.Time(struct_current) # try and test all the standard parts of the format format_string = "%a %A %b %B %c %d %H %I %j %m %M %p %S %U %w %W %x %X %y %Y %Z" self.assertEquals(pytime_current.Format(format_string), time.strftime(format_string, struct_current)) if __name__ == '__main__': unittest.main() |
From: <mha...@us...> - 2003-10-19 07:01:38
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1:/tmp/cvs-serv17592 Modified Files: win32apimodule.cpp Log Message: [ 794284 ] RegEnumKeyEx and RegNotifyChangeKeyValue From Roger Upole Index: win32apimodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32apimodule.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** win32apimodule.cpp 26 Jul 2003 14:08:29 -0000 1.24 --- win32apimodule.cpp 18 Oct 2003 05:57:59 -0000 1.25 *************** *** 2037,2040 **** --- 2037,2119 ---- } + // @pymethod <o PyTuple>|win32api|RegEnumKeyEx|Returns list of subkeys, info is (name, reserved, class, last write time) - class currently not defined, will always be None, reserved always 0 + static PyObject * + PyRegEnumKeyEx( PyObject *self, PyObject *args ) + { + PyObject *obreghandle=NULL, *obretitem=NULL, *obtimestamp=NULL; + HKEY reghandle; + FILETIME timestamp; + long err; + char *key_name; + DWORD key_len=0, max_len=0, key_ind=0, nbr_keys=0; + PyObject *ret=NULL; + // @pyparm <o PyHKEY>/int|key||An already open key, or any one of the following win32con constants:<nl>HKEY_CLASSES_ROOT<nl>HKEY_CURRENT_USER<nl>HKEY_LOCAL_MACHINE<nl>HKEY_USERS. + if (!PyArg_ParseTuple(args, "O:RegEnumKeyEx", &obreghandle)) + return NULL; + if (!PyWinObject_AsHKEY(obreghandle, ®handle)) + return NULL; + + err=RegQueryInfoKey(reghandle,NULL,NULL,NULL, &nbr_keys, &max_len, NULL,NULL,NULL,NULL,NULL,NULL); + if (err!=ERROR_SUCCESS) + return ReturnAPIError("RegEnumKeyEx:RegQueryInfoKey",err); + max_len++; // trailing NULL not included + key_name=(char *)malloc(max_len); + if (key_name==NULL){ + PyErr_SetString(PyExc_MemoryError, "RegEnumKeyEx: SOM"); + return NULL; + } + + ret=PyTuple_New(nbr_keys); + for (key_ind=0;key_ind<nbr_keys;key_ind++){ + key_len=max_len; + err=RegEnumKeyEx(reghandle, key_ind, key_name, &key_len, NULL, NULL, NULL, ×tamp); + if (err!=ERROR_SUCCESS){ + Py_DECREF(ret); + ret=NULL; + PyWin_SetAPIError("RegEnumKeyEx",err); + break; + } + obtimestamp=PyWinObject_FromFILETIME(timestamp); + obretitem=Py_BuildValue("s#iOO", key_name, key_len, 0, Py_None, obtimestamp); + Py_DECREF(obtimestamp); + PyTuple_SET_ITEM(ret, key_ind, obretitem); + } + free(key_name); + return ret; + } + + // @pymethod |win32api|RegNotifyChangeKeyValue|Receive notification of registry changes + static PyObject * + PyRegNotifyChangeKeyValue( PyObject *self, PyObject *args ) + { + PyObject *obreghandle=NULL, *obevent=NULL, *ret=NULL; + HKEY reghandle; + BOOL subtree=FALSE, asynch=FALSE; + DWORD filter=0; + HANDLE hevent; + long err=0; + if (!PyArg_ParseTuple(args,"OiiOi", + &obreghandle, //@pyparm <o PyHKEY>/int|key||Handle to an open registry key + &subtree, //@pyparm int|bWatchSubTree||Boolean, notify of changes to subkeys if True + &filter, //@pyparm int|dwNotifyFilter||Combination of REG_NOTIFY_CHANGE_* constants + &obevent, //@pyparm <o PyHANDLE>|hKey||Event handle to be signalled, use None if fAsynchronous is False + &asynch)) //@pyparm int|fAsynchronous||Boolean, function returns immediately if True, waits for change if False + return NULL; + if (!PyWinObject_AsHKEY(obreghandle, ®handle)) + return NULL; + if (!PyWinObject_AsHANDLE(obevent, &hevent, TRUE)) // handle should be NULL if asynch is False + return NULL; + PyW32_BEGIN_ALLOW_THREADS + err=RegNotifyChangeKeyValue(reghandle, subtree, filter, hevent, asynch); + PyW32_END_ALLOW_THREADS + if (err==ERROR_SUCCESS) + ret=Py_None; + else + PyWin_SetAPIError("RegNotifyChangeKeyValue",err); + Py_XINCREF(ret); + return ret; + } + + // Note that fixupMultiSZ and countString have both had changes // made to support "incorrect strings". The registry specification *************** *** 3967,3970 **** --- 4046,4050 ---- {"RegDeleteValue", PyRegDeleteValue, 1}, // @pymeth RegDeleteValue|Removes a named value from the specified registry key. {"RegEnumKey", PyRegEnumKey, 1}, // @pymeth RegEnumKey|Enumerates subkeys of the specified open registry key. + {"RegEnumKeyEx", PyRegEnumKeyEx, 1}, // @pymeth RegEnumKey|Enumerates subkeys of the specified open registry key. {"RegEnumValue", PyRegEnumValue, 1}, // @pymeth RegEnumValue|Enumerates values of the specified open registry key. {"RegFlushKey", PyRegFlushKey, 1}, // @pymeth RegFlushKey|Writes all the attributes of the specified key to the registry. *************** *** 3982,3985 **** --- 4062,4066 ---- {"RegUnLoadKey", PyRegUnLoadKey, 1}, // @pymeth RegUnLoadKey|Unloads the specified registry key and its subkeys from the registry. The keys must have been loaded previously by a call to RegLoadKey. {"RegisterWindowMessage",PyRegisterWindowMessage, 1}, // @pymeth RegisterWindowMessage|Given a string, return a system wide unique message ID. + {"RegNotifyChangeKeyValue", PyRegNotifyChangeKeyValue, 1}, //@pymeth RegNotifyChangeKeyValue|Watch for registry changes {"SearchPath", PySearchPath, 1}, // @pymeth SearchPath|Searches a path for a file. {"SendMessage", PySendMessage, 1}, // @pymeth SendMessage|Send a message to a window. *************** *** 4035,4047 **** PyInt_FromLong(STD_ERROR_HANDLE)); ! PyDict_SetItemString(dict,"NameUnknown",PyInt_FromLong(NameUnknown)); ! PyDict_SetItemString(dict,"NameFullyQualifiedDN",PyInt_FromLong(NameFullyQualifiedDN)); ! PyDict_SetItemString(dict,"NameSamCompatible",PyInt_FromLong(NameSamCompatible)); ! PyDict_SetItemString(dict,"NameDisplay",PyInt_FromLong(NameDisplay)); ! PyDict_SetItemString(dict,"NameUniqueId",PyInt_FromLong(NameUniqueId)); ! PyDict_SetItemString(dict,"NameCanonical",PyInt_FromLong(NameCanonical)); ! PyDict_SetItemString(dict,"NameUserPrincipal",PyInt_FromLong(NameUserPrincipal)); ! PyDict_SetItemString(dict,"NameCanonicalEx",PyInt_FromLong(NameCanonicalEx)); ! PyDict_SetItemString(dict,"NameServicePrincipal",PyInt_FromLong(NameServicePrincipal)); HMODULE hmodule = LoadLibrary("secur32.dll"); --- 4116,4133 ---- PyInt_FromLong(STD_ERROR_HANDLE)); ! PyModule_AddIntConstant(module, "NameUnknown", NameUnknown); ! PyModule_AddIntConstant(module, "NameFullyQualifiedDN", NameFullyQualifiedDN); ! PyModule_AddIntConstant(module, "NameSamCompatible", NameSamCompatible); ! PyModule_AddIntConstant(module, "NameDisplay", NameDisplay); ! PyModule_AddIntConstant(module, "NameUniqueId", NameUniqueId); ! PyModule_AddIntConstant(module, "NameCanonical", NameCanonical); ! PyModule_AddIntConstant(module, "NameUserPrincipal", NameUserPrincipal); ! PyModule_AddIntConstant(module, "NameCanonicalEx", NameCanonicalEx); ! PyModule_AddIntConstant(module, "NameServicePrincipal", NameServicePrincipal); ! ! PyModule_AddIntConstant(module, "REG_NOTIFY_CHANGE_NAME", REG_NOTIFY_CHANGE_NAME); ! PyModule_AddIntConstant(module, "REG_NOTIFY_CHANGE_ATTRIBUTES", REG_NOTIFY_CHANGE_ATTRIBUTES); ! PyModule_AddIntConstant(module, "REG_NOTIFY_CHANGE_LAST_SET", REG_NOTIFY_CHANGE_LAST_SET); ! PyModule_AddIntConstant(module, "REG_NOTIFY_CHANGE_SECURITY", REG_NOTIFY_CHANGE_SECURITY); HMODULE hmodule = LoadLibrary("secur32.dll"); *************** *** 4055,4056 **** --- 4141,4143 ---- + |
From: <mha...@us...> - 2003-10-19 05:22:35
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/extensions In directory sc8-pr-cvs1:/tmp/cvs-serv18241 Modified Files: PyIPropertyStorage.cpp Log Message: [ 800206 ] fix for crash in PyIProperyStorage:Stat() Index: PyIPropertyStorage.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyIPropertyStorage.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyIPropertyStorage.cpp 4 Jun 2000 05:52:55 -0000 1.3 --- PyIPropertyStorage.cpp 18 Oct 2003 06:01:36 -0000 1.4 *************** *** 247,256 **** return Py_None; } PyObject *obclsid = PyWinObject_FromIID(pStg->clsid); PyObject *obmtime = PyWinObject_FromFILETIME(pStg->mtime); PyObject *obctime = PyWinObject_FromFILETIME(pStg->ctime); PyObject *obatime = PyWinObject_FromFILETIME(pStg->atime); ! PyObject *ret = Py_BuildValue("lOiOOO", pStg->fmtid, obclsid, pStg->grfFlags, obmtime, obctime, obatime); Py_XDECREF(obclsid); Py_XDECREF(obmtime); Py_XDECREF(obctime); --- 247,258 ---- return Py_None; } + PyObject *obfmtid = PyWinObject_FromIID(pStg->fmtid); PyObject *obclsid = PyWinObject_FromIID(pStg->clsid); PyObject *obmtime = PyWinObject_FromFILETIME(pStg->mtime); PyObject *obctime = PyWinObject_FromFILETIME(pStg->ctime); PyObject *obatime = PyWinObject_FromFILETIME(pStg->atime); ! PyObject *ret = Py_BuildValue("OOiOOO", obfmtid, obclsid, pStg->grfFlags, obmtime, obctime, obatime); Py_XDECREF(obclsid); + Py_XDECREF(obfmtid); Py_XDECREF(obmtime); Py_XDECREF(obctime); |
From: <mha...@us...> - 2003-10-19 04:08:46
|
Update of /cvsroot/pywin32/pywin32/win32/src/win32net In directory sc8-pr-cvs1:/tmp/cvs-serv18470 Modified Files: win32netmisc.cpp Log Message: [ 801727 ] win32net.NetServerDiskEnum only returns every other drive From Roger Upole Index: win32netmisc.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32net/win32netmisc.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** win32netmisc.cpp 7 Apr 2003 12:46:31 -0000 1.6 --- win32netmisc.cpp 18 Oct 2003 06:04:27 -0000 1.7 *************** *** 1088,1150 **** } ! // @pymethod ([dict, ...], total, resumeHandle)|win32net|NetServerDiskEnum|Retrieves the list of disk drives on a server. ! // @rdesc The result is a list of items read (with each item being a dictionary of format ! // <o PyUnicode>, depending on the level parameter), ! // the total available, and a "resume handle". If the result handle is true, you should call ! // this function again to fetch more data, passing this handle in the resumeHandle param. PyObject * PyNetServerDiskEnum(PyObject *self, PyObject *args) { ! WCHAR *szServer = NULL, *szDomain = NULL; ! PyObject *obServer, *obDomain = Py_None; PyObject *ret = NULL; DWORD err; ! DWORD dwPrefLen = 4096; ! DWORD level; ! BOOL ok = FALSE; DWORD resumeHandle = 0; DWORD numRead, i; - PyObject *list; BYTE *buf = NULL; DWORD totalEntries = 0; // @pyparm string/<o PyUnicode>|server||The name of the server to execute on, or None. ! // @pyparm int|level||The level of data required. Must be None or 0. ! // @pyparm int|resumeHandle|0|A resume handle. See the return description for more information. ! // @pyparm int|prefLen|4096|The preferred length of the data buffer. ! if (!PyArg_ParseTuple(args, "Oi|ii", &obServer, &level, &resumeHandle, &dwPrefLen)) return NULL; if (!PyWinObject_AsWCHAR(obServer, &szServer, TRUE)) ! goto done; ! if (!PyWinObject_AsWCHAR(obDomain, &szDomain, TRUE)) ! goto done; Py_BEGIN_ALLOW_THREADS err = NetServerDiskEnum(szServer, level, &buf, dwPrefLen, &numRead, &totalEntries, &resumeHandle); Py_END_ALLOW_THREADS ! if (err!=0 && err != ERROR_MORE_DATA) { ReturnNetError("NetServerDiskEnum",err); goto done; } ! list = PyList_New(numRead); ! if (list==NULL) goto done; ! // The return buffer contains drive letters as wchar_t seperated by wchar_t ! // NULLs. ! for (i=0;i<numRead;i++) { ! PyObject *sub = PyWinObject_FromWCHAR((WCHAR *)buf); ! if (sub==NULL) goto done; ! PyList_SetItem(list, i, sub); ! buf = buf + wcslen((WCHAR *)buf) + sizeof((wchar_t)0); ! } ! resumeHandle = err==0 ? 0 : resumeHandle; ! ret = Py_BuildValue("Oll", list, totalEntries, resumeHandle); ! Py_DECREF(list); ! ok = TRUE; done: if (buf) NetApiBufferFree(buf); ! if (!ok) { ! Py_XDECREF(ret); ! ret = NULL; ! } ! PyWinObject_FreeWCHAR(szServer); return ret; // @pyseeapi NetServerDiskEnum --- 1088,1138 ---- } ! // @pymethod (list|win32net|NetServerDiskEnum|Retrieves the list of disk drives on a server. ! // @rdesc The result is a list of drives on the server PyObject * PyNetServerDiskEnum(PyObject *self, PyObject *args) { ! WCHAR *szServer=NULL, *disk=NULL; ! PyObject *obServer=NULL, *obdisk=NULL; PyObject *ret = NULL; DWORD err; ! DWORD dwPrefLen = MAX_PREFERRED_LENGTH; ! DWORD level=0; DWORD resumeHandle = 0; DWORD numRead, i; BYTE *buf = NULL; DWORD totalEntries = 0; // @pyparm string/<o PyUnicode>|server||The name of the server to execute on, or None. ! // @pyparm int|level||The level of data required. Must be 0. ! if (!PyArg_ParseTuple(args, "O|i", &obServer, &level)) return NULL; if (!PyWinObject_AsWCHAR(obServer, &szServer, TRUE)) ! return NULL; Py_BEGIN_ALLOW_THREADS err = NetServerDiskEnum(szServer, level, &buf, dwPrefLen, &numRead, &totalEntries, &resumeHandle); Py_END_ALLOW_THREADS ! if (err!=0) { ReturnNetError("NetServerDiskEnum",err); goto done; } ! ret = PyTuple_New(totalEntries); ! if (ret==NULL) ! goto done; ! // The return buffer contains drive letters as 3-char segments terminated by NULLs ! for (i=0;i<totalEntries;i++){ ! disk=(WCHAR *)(buf+(i*sizeof(WCHAR)*3)); ! obdisk = PyWinObject_FromWCHAR(disk,2); ! if (obdisk==NULL){ ! Py_DECREF(ret); ! ret = NULL; ! break; ! } ! PyTuple_SetItem(ret, i, obdisk); ! } done: if (buf) NetApiBufferFree(buf); ! if (szServer) ! PyWinObject_FreeWCHAR(szServer); return ret; // @pyseeapi NetServerDiskEnum |
From: <mha...@us...> - 2003-10-18 16:52:26
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1:/tmp/cvs-serv18755 Modified Files: odbc.cpp Log Message: Fix [ 754796 ] Reference count bug in ODBC, via [ 801864 ] fix for sf bug # 754796, from Roger Upole. Index: odbc.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/odbc.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** odbc.cpp 28 Jul 2002 10:30:44 -0000 1.7 --- odbc.cpp 18 Oct 2003 06:07:16 -0000 1.8 *************** *** 1349,1352 **** --- 1349,1353 ---- Error: Py_DECREF(cur->description); + cur->description = NULL; rv = NULL; goto Cleanup; |
From: <mha...@us...> - 2003-10-18 13:41:11
|
Update of /cvsroot/pywin32/pywin32/win32/Demos In directory sc8-pr-cvs1:/tmp/cvs-serv19642/Demos Added Files: getfilever.py Log Message: [ 805880 ] GetFileVersionInfo, from Roger Upole --- NEW FILE: getfilever.py --- import os, win32api ver_strings=('Comments','InternalName','ProductName', 'CompanyName','LegalCopyright','ProductVersion', 'FileDescription','LegalTrademarks','PrivateBuild', 'FileVersion','OriginalFilename','SpecialBuild') fname = os.environ["comspec"] d=win32api.GetFileVersionInfo(fname, '\\') ## backslash as parm returns dictionary of numeric info corresponding to VS_FIXEDFILEINFO struc for n, v in d.items(): print n, v pairs=win32api.GetFileVersionInfo(fname, '\\VarFileInfo\\Translation') ## \VarFileInfo\Translation returns list of available (language, codepage) pairs that can be used to retreive string info ## any other must be of the form \StringfileInfo\%04X%04X\parm_name, middle two are language/codepage pair returned from above for lang, codepage in pairs: print 'lang: ', lang, 'codepage:', codepage for ver_string in ver_strings: str_info=u'\\StringFileInfo\\%04X%04X\\%s' %(lang,codepage,ver_string) ## print str_info print ver_string, win32api.GetFileVersionInfo(fname, str_info) |
From: <mha...@us...> - 2003-10-18 07:06:06
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory sc8-pr-cvs1:/tmp/cvs-serv17495 Modified Files: test_win32api.py Log Message: Test RegNotifyChangeKeyValue, from Roger Upole Index: test_win32api.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/test_win32api.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_win32api.py 2 Jul 2003 04:06:57 -0000 1.3 --- test_win32api.py 18 Oct 2003 05:56:27 -0000 1.4 *************** *** 3,7 **** import unittest ! import win32api, win32con class CurrentUserTestCase(unittest.TestCase): --- 3,7 ---- import unittest ! import win32api, win32con, win32event class CurrentUserTestCase(unittest.TestCase): *************** *** 24,32 **** class Registry(unittest.TestCase): def test1(self): # This used to leave a stale exception behind. - key_name = r'PythonTestHarness\Whatever' def reg_operation(): ! hkey = win32api.RegCreateKey(win32con.HKEY_CURRENT_USER, key_name) x = 3/0 # or a statement like: raise 'error' # do the test --- 24,32 ---- class Registry(unittest.TestCase): + key_name = r'PythonTestHarness\Whatever' def test1(self): # This used to leave a stale exception behind. def reg_operation(): ! hkey = win32api.RegCreateKey(win32con.HKEY_CURRENT_USER, self.key_name) x = 3/0 # or a statement like: raise 'error' # do the test *************** *** 38,44 **** 1/0 # Force exception finally: ! win32api.RegDeleteKey(win32con.HKEY_CURRENT_USER, key_name) except ZeroDivisionError: pass if __name__ == '__main__': --- 38,65 ---- 1/0 # Force exception finally: ! win32api.RegDeleteKey(win32con.HKEY_CURRENT_USER, self.key_name) except ZeroDivisionError: pass + def testNotifyChange(self): + def change(): + hkey = win32api.RegCreateKey(win32con.HKEY_CURRENT_USER, self.key_name) + try: + win32api.RegSetValue(hkey, None, win32con.REG_SZ, "foo") + finally: + win32api.RegDeleteKey(win32con.HKEY_CURRENT_USER, self.key_name) + + evt = win32event.CreateEvent(None,0,0,None) + ## REG_NOTIFY_CHANGE_LAST_SET - values + ## REG_CHANGE_NOTIFY_NAME - keys + ## REG_NOTIFY_CHANGE_SECURITY - security descriptor + ## REG_NOTIFY_CHANGE_ATTRIBUTES + win32api.RegNotifyChangeKeyValue(win32con.HKEY_CURRENT_USER,1,win32api.REG_NOTIFY_CHANGE_LAST_SET,evt,True) + ret_code=win32event.WaitForSingleObject(evt,0) + # Should be no change. + self.failUnless(ret_code==win32con.WAIT_TIMEOUT) + change() + # Our event should now be in a signalled state. + ret_code=win32event.WaitForSingleObject(evt,0) + self.failUnless(ret_code==win32con.WAIT_OBJECT_0) if __name__ == '__main__': |
From: <mha...@us...> - 2003-10-16 05:41:51
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1:/tmp/cvs-serv8692 Modified Files: PythonService.cpp Log Message: autoduck Index: PythonService.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PythonService.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PythonService.cpp 16 Oct 2003 05:27:56 -0000 1.7 --- PythonService.cpp 16 Oct 2003 05:41:34 -0000 1.8 *************** *** 347,351 **** } ! // @pymethod |Initialize|Initialize the module for hosting a service. This is generally called automatically static PyObject *PyServiceInitialize(PyObject *self, PyObject *args) { --- 347,351 ---- } ! // @pymethod |servicemanager|Initialize|Initialize the module for hosting a service. This is generally called automatically static PyObject *PyServiceInitialize(PyObject *self, PyObject *args) { *************** *** 368,372 **** } ! // @pymethod |Finalize| static PyObject *PyServiceFinalize(PyObject *self) { --- 368,372 ---- } ! // @pymethod |servicemanager|Finalize| static PyObject *PyServiceFinalize(PyObject *self) { *************** *** 376,380 **** } ! // @pymethod |PrepareToHostSingle|Prepare for hosting a single service in this EXE static PyObject *PyPrepareToHostSingle(PyObject *self, PyObject *args) { --- 376,380 ---- } ! // @pymethod |servicemanager|PrepareToHostSingle|Prepare for hosting a single service in this EXE static PyObject *PyPrepareToHostSingle(PyObject *self, PyObject *args) { *************** *** 393,397 **** } ! // @pymethod |PrepareToHostMultiple|Prepare for hosting a multiple services in this EXE static PyObject *PyPrepareToHostMultiple(PyObject *self, PyObject *args) { --- 393,397 ---- } ! // @pymethod |servicemanager|PrepareToHostMultiple|Prepare for hosting a multiple services in this EXE static PyObject *PyPrepareToHostMultiple(PyObject *self, PyObject *args) { |
From: <mha...@us...> - 2003-10-16 05:37:33
|
Update of /cvsroot/pywin32/pywin32/win32/Demos In directory sc8-pr-cvs1:/tmp/cvs-serv8118/Demos Added Files: win32gui_menu.py Log Message: New win32gui_menu demo, and the start of a win32gui_struct module. --- NEW FILE: win32gui_menu.py --- # Demonstrates some advanced menu concepts using win32gui. # This creates a taskbar icon which has some fancy menus (but note that # selecting the menu items does nothing useful - see win32gui_taskbar.py # for examples of this. # NOTE: This is a work in progress. Todo: # * The "Checked" menu items don't work correctly - I'm not sure why. # * No support for GetMenuItemInfo. # Based on Andy McKay's demo code. from win32api import * from win32gui import * from win32gui_struct import * import win32con import sys, os import struct import array this_dir = os.path.split(sys.argv[0])[0] class MainWindow: def __init__(self): message_map = { win32con.WM_DESTROY: self.OnDestroy, win32con.WM_COMMAND: self.OnCommand, win32con.WM_USER+20 : self.OnTaskbarNotify, } # Register the Window class. wc = WNDCLASS() hinst = wc.hInstance = GetModuleHandle(None) wc.lpszClassName = "PythonTaskbarDemo" wc.lpfnWndProc = message_map # could also specify a wndproc. classAtom = RegisterClass(wc) # Create the Window. style = win32con.WS_OVERLAPPED | win32con.WS_SYSMENU self.hwnd = CreateWindow( classAtom, "Taskbar Demo", style, \ 0, 0, win32con.CW_USEDEFAULT, win32con.CW_USEDEFAULT, \ 0, 0, hinst, None) UpdateWindow(self.hwnd) iconPathName = os.path.abspath(os.path.join( sys.prefix, "pyc.ico" )) if not os.path.isfile(iconPathName): # Look in the source tree. iconPathName = os.path.abspath(os.path.join( os.path.split(sys.executable)[0], "..\\PC\\pyc.ico" )) if os.path.isfile(iconPathName): icon_flags = win32con.LR_LOADFROMFILE | win32con.LR_DEFAULTSIZE hicon = LoadImage(hinst, iconPathName, win32con.IMAGE_ICON, 0, 0, icon_flags) else: print "Can't find a Python icon file - using default" hicon = LoadIcon(0, win32con.IDI_APPLICATION) flags = NIF_ICON | NIF_MESSAGE | NIF_TIP nid = (self.hwnd, 0, flags, win32con.WM_USER+20, hicon, "Python Demo") Shell_NotifyIcon(NIM_ADD, nid) print "Please right-click on the Python icon in the taskbar" def OnDestroy(self, hwnd, msg, wparam, lparam): nid = (self.hwnd, 0) Shell_NotifyIcon(NIM_DELETE, nid) PostQuitMessage(0) # Terminate the app. def OnTaskbarNotify(self, hwnd, msg, wparam, lparam): if lparam==win32con.WM_RBUTTONUP: print "You right clicked me." menu = CreatePopupMenu() # Create our 'Exit' item with the standard, ugly 'close' icon. item, extras = PackMENUITEMINFO(text = "Exit", hbmpItem=win32con.HBMMENU_MBAR_CLOSE, wID=1000) InsertMenuItem(menu, 0, 1, item) # Create a 'text only' menu via InsertMenuItem rather then # AppendMenu, just to prove we can! item, extras = PackMENUITEMINFO(text = "Text only item", wID=1001) InsertMenuItem(menu, 0, 1, item) load_bmp_flags=win32con.LR_LOADFROMFILE | \ win32con.LR_LOADTRANSPARENT # These images are "over sized", so we load them scaled. hbmp = LoadImage(0, os.path.join(this_dir, "images/smiley.bmp"), win32con.IMAGE_BITMAP, 20, 20, load_bmp_flags) # Create a top-level menu with a bitmap item, extras = PackMENUITEMINFO(text="Menu with icon", hbmpItem=hbmp, wID=1002) InsertMenuItem(menu, 0, 1, item) # Create a sub-menu, and put a few funky ones there. self.sub_menu = sub_menu = CreatePopupMenu() # A 'checkbox' menu. item, extras = PackMENUITEMINFO(fState=win32con.MFS_CHECKED, text="Checkbox menu", hbmpItem=hbmp, wID=1003) InsertMenuItem(sub_menu, 0, 1, item) # A 'radio' menu. InsertMenu(sub_menu, 0, win32con.MF_BYPOSITION, win32con.MF_SEPARATOR, None) item, extras = PackMENUITEMINFO(fType=win32con.MFT_RADIOCHECK, fState=win32con.MFS_CHECKED, text="Checkbox menu - bullet 1", hbmpItem=hbmp, wID=1004) InsertMenuItem(sub_menu, 0, 1, item) item, extras = PackMENUITEMINFO(fType=win32con.MFT_RADIOCHECK, fState=win32con.MFS_UNCHECKED, text="Checkbox menu - bullet 2", hbmpItem=hbmp, wID=1005) InsertMenuItem(sub_menu, 0, 1, item) # And add the sub-menu to the top-level menu. item, extras = PackMENUITEMINFO(text="Sub-Menu", hSubMenu=sub_menu) InsertMenuItem(menu, 0, 1, item) # Set 'Exit' as the default option. SetMenuDefaultItem(menu, 1000, 0) # And display the menu at the cursor pos. pos = GetCursorPos() SetForegroundWindow(self.hwnd) TrackPopupMenu(menu, win32con.TPM_LEFTALIGN, pos[0], pos[1], 0, self.hwnd, None) PostMessage(self.hwnd, win32con.WM_NULL, 0, 0) self.hmenu = menu return 1 def OnCommand(self, hwnd, msg, wparam, lparam): id = LOWORD(wparam) print "OnCommand for control ID", id def OnCommand(self, hwnd, msg, wparam, lparam): id = LOWORD(wparam) if id == 1000: print "Goodbye" DestroyWindow(self.hwnd) elif id==1003: # Our 'checkbox' item state = GetMenuState(self.sub_menu, id, win32con.MF_BYCOMMAND) if state==-1: raise RuntimeError, "No item found" if state & win32con.MF_CHECKED: check_flags = win32con.MF_UNCHECKED print "Menu was checked - unchecking" elif state & win32con.MF_UNCHECKED: check_flags = win32con.MF_CHECKED print "Menu was unchecked - checking" else: raise RuntimeError, "Menu is neither checked nor unchecked!" CheckMenuItem(self.sub_menu, id, win32con.MF_BYCOMMAND & check_flags) if GetMenuState(self.sub_menu, id, win32con.MF_BYCOMMAND) & win32con.MF_CHECKED != check_flags: raise RuntimeError, "The new item didn't get the new checked state!" elif id==1004 or id==1005: # Our 'checkbox' item state = GetMenuState(self.sub_menu, id, win32con.MF_BYCOMMAND) if state==-1: raise RuntimeError, "No item found" CheckMenuItem(self.sub_menu, id, win32con.MF_BYCOMMAND & win32con.MF_CHECKED) if GetMenuState(self.sub_menu, id, win32con.MF_BYCOMMAND) & win32con.MF_CHECKED == 0: raise RuntimeError, "The new item didn't get the new checked state!" else: print "OnCommand for ID", id def main(): w=MainWindow() PumpMessages() if __name__=='__main__': main() |
From: <mha...@us...> - 2003-10-16 05:37:30
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv8118/lib Added Files: win32gui_struct.py Log Message: New win32gui_menu demo, and the start of a win32gui_struct module. --- NEW FILE: win32gui_struct.py --- # This is a work in progress - see Demos/win32gui_menu.py # win32gui_struct.py - helpers for working with various win32gui structures. # As win32gui is "light-weight", it does not define objects for all possible # win32 structures - in general, "buffer" objects are passed around - it is # the callers responsibility to pack the buffer in the correct format. # # This module defines some helpers for the commonly used structures. # # In general, each structure has 3 functions: # # buffer, extras = PackSTRUCTURE(items, ...) # item, ... = UnpackSTRUCTURE(buffer) # buffer, extras = EmtpySTRUCTURE(...) # # 'extras' is always items that must be held along with the buffer, as the # buffer refers to these object's memory. # For structures that support a 'mask', this mask is hidden from the user - if # 'None' is passed, the mask flag will not be set, or on return, None will # be returned for the value if the mask is not set. # # NOTE: I considered making these structures look like real classes, and # support 'attributes' etc - however, ctypes already has a good structure # mechanism - I think it makes more sense to support ctype structures # at the win32gui level, then there will be no need for this module at all. import win32gui import win32con import struct import array # MENUITEMINFO struct # http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Resources/Menus/MenuReference/MenuStructures/MENUITEMINFO.asp # We use the struct module to pack and unpack strings as MENUITEMINFO # structures. We also have special handling for the 'fMask' item in that # structure to avoid the caller needing to explicitly check validity # (None is used if the mask excludes/should exclude the value) menuitem_fmt = '9IP2I' def PackMENUITEMINFO(fType=None, fState=None, wID=None, hSubMenu=None, hbmpChecked=None, hbmpUnchecked=None, dwTypeData=None, text=None, hbmpItem=None): # 'extras' are objects the caller must keep a reference to (as their # memory is used) for the lifetime of the INFO item. extras = [] fMask = 0 if fType is None: fType = 0 else: fMask |= win32con.MIIM_FTYPE if fState is None: fState = 0 else: fMask |= win32con.MIIM_STATE if wID is None: wID = 0 else: fMask |= win32con.MIIM_ID if hSubMenu is None: hSubMenu = 0 else: fMask |= win32con.MIIM_SUBMENU if hbmpChecked is None: assert hbmpUnchecked is None, \ "neither or both checkmark bmps must be given" hbmpChecked = hbmpUnchecked = 0 else: assert hbmpUnchecked is not None, \ "neither or both checkmark bmps must be given" fMask |= win32con.MMIM_CHECKMARKS if dwTypeData is None: dwTypeData = 0 else: fMask |= win32con.MIIM_DATA if hbmpItem is None: hbmpItem = 0 else: fMask |= win32con.MIIM_BITMAP if text is not None: fMask |= win32con.MIIM_STRING str_buf = array.array("c", text+'\0') cch = len(str_buf) # We are taking address of strbuf - it must not die until windows # has finished with our structure. lptext = str_buf.buffer_info()[0] extras.append(str_buf) else: lptext = 0 cch = 0 # Create the struct. dwItemData = 0 item = struct.pack( menuitem_fmt, struct.calcsize(menuitem_fmt), # cbSize fMask, fType, fState, wID, hSubMenu, hbmpChecked, hbmpUnchecked, dwItemData, lptext, cch, hbmpItem ) # Now copy the string to a writable buffer, so that the result # could be passed to a 'Get' function return array.array("c", item), extras def UnpackMENUITEMINFO(s): cb, fMask, fType, fState, wID, hSubMenu, hbmpChecked, hbmpUnchecked, dwItemData, lptext, cch, hbmpItem = struct.unpack(menuitem_fmt, s) assert cb==len(s) if fMask & win32con.MIIM_FTYPE==0: fType = None if fMask & win32con.MIIM_STATE==0: fState = None if fMask & win32con.MIIM_ID==0: wID = None if fMask & win32con.MIIM_SUBMENU==0: hSubMenu = None if fMask & win32con.MIIM_CHECKMARKS==0: hbmpChecked = hbmpUnchecked = None if fMask & win32con.MIIM_DATA==0: dwItemData = None if fMask & win32con.MIIM_BITMAP==0: hbmpItem = None if fMask & win32con.MIIM_STRING: text = PyGetString(lptext, cch) else: text = None return fType, fState, wID, hSubMenu, bmpChecked, bmpUnchecked, \ dwTypeData, text, hbmpItem ########################################################################## # # Tree View structure support - TVITEM, TVINSERTSTRUCT and TVDISPINFO # ########################################################################## # XXX - Note that the following implementation of TreeView structures is ripped # XXX - from the SpamBayes project. It may not quite work correctly yet - I # XXX - intend checking them later - but having them is better than not at all! # Helpers for the ugly win32 structure packing/unpacking def _GetMaskAndVal(val, default, mask, flag): if val is None: return mask, default else: mask |= flag return mask, val def PackTVINSERTSTRUCT(parent, insertAfter, tvitem): tvitem_buf, extra = PackTVITEM(*tvitem) tvitem_buf = tvitem_buf.tostring() format = "ii%ds" % len(tvitem_buf) return struct.pack(format, parent, insertAfter, tvitem_buf), extra def PackTVITEM(hitem, state, stateMask, text, image, selimage, citems, param): extra = [] # objects we must keep references to mask = 0 mask, hitem = _GetMaskAndVal(hitem, 0, mask, commctrl.TVIF_HANDLE) mask, state = _GetMaskAndVal(state, 0, mask, commctrl.TVIF_STATE) if not mask & commctrl.TVIF_STATE: stateMask = 0 mask, text = _GetMaskAndVal(text, None, mask, commctrl.TVIF_TEXT) mask, image = _GetMaskAndVal(image, 0, mask, commctrl.TVIF_IMAGE) mask, selimage = _GetMaskAndVal(selimage, 0, mask, commctrl.TVIF_SELECTEDIMAGE) mask, citems = _GetMaskAndVal(citems, 0, mask, commctrl.TVIF_CHILDREN) mask, param = _GetMaskAndVal(param, 0, mask, commctrl.TVIF_PARAM) if text is None: text_addr = text_len = 0 else: text_buffer = array.array("c", text+"\0") extra.append(text_buffer) text_addr, text_len = text_buffer.buffer_info() format = "iiiiiiiiii" buf = struct.pack(format, mask, hitem, state, stateMask, text_addr, text_len, # text image, selimage, citems, param) return array.array("c", buf), extra # Make a new buffer suitable for querying hitem's attributes. def EmptyTVITEM(hitem, mask = None, text_buf_size=512): extra = [] # objects we must keep references to if mask is None: mask = commctrl.TVIF_HANDLE | commctrl.TVIF_STATE | commctrl.TVIF_TEXT | \ commctrl.TVIF_IMAGE | commctrl.TVIF_SELECTEDIMAGE | \ commctrl.TVIF_CHILDREN | commctrl.TVIF_PARAM if mask & commctrl.TVIF_TEXT: text_buffer = array.array("c", "\0" * text_buf_size) extra.append(text_buffer) text_addr, text_len = text_buffer.buffer_info() else: text_addr = text_len = 0 format = "iiiiiiiiii" buf = struct.pack(format, mask, hitem, 0, 0, text_addr, text_len, # text 0, 0, 0, 0) return array.array("c", buf), extra def UnpackTVItem(buffer): item_mask, item_hItem, item_state, item_stateMask, \ item_textptr, item_cchText, item_image, item_selimage, \ item_cChildren, item_param = struct.unpack("10i", buffer) # ensure only items listed by the mask are valid (except we assume the # handle is always valid - some notifications (eg, TVN_ENDLABELEDIT) set a # mask that doesn't include the handle, but the docs explicity say it is.) if not (item_mask & commctrl.TVIF_TEXT): item_textptr = item_cchText = None if not (item_mask & commctrl.TVIF_CHILDREN): item_cChildren = None if not (item_mask & commctrl.TVIF_IMAGE): item_image = None if not (item_mask & commctrl.TVIF_PARAM): item_param = None if not (item_mask & commctrl.TVIF_SELECTEDIMAGE): item_selimage = None if not (item_mask & commctrl.TVIF_STATE): item_state = item_stateMask = None if item_textptr: text = win32gui.PyGetString(item_textptr) else: text = None return item_hItem, item_state, item_stateMask, \ text, item_image, item_selimage, \ item_cChildren, item_param # Unpack the lparm from a "TVNOTIFY" message def UnpackTVNOTIFY(lparam): format = "iiii40s40s" buf = win32gui.PyMakeBuffer(struct.calcsize(format), lparam) hwndFrom, id, code, action, buf_old, buf_new \ = struct.unpack(format, buf) item_old = UnpackTVItem(buf_old) item_new = UnpackTVItem(buf_new) return hwndFrom, id, code, action, item_old, item_new def UnpackTVDISPINFO(lparam): format = "iii40s" buf = win32gui.PyMakeBuffer(struct.calcsize(format), lparam) hwndFrom, id, code, buf_item = struct.unpack(format, buf) item = UnpackTVItem(buf_item) return hwndFrom, id, code, item |
From: <mha...@us...> - 2003-10-16 05:36:17
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1:/tmp/cvs-serv7345 Modified Files: Python and Extensions.dsw Log Message: New "PythonService servicemanager" project Index: Python and Extensions.dsw =================================================================== RCS file: /cvsroot/pywin32/pywin32/Python and Extensions.dsw,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Python and Extensions.dsw 7 Apr 2003 03:51:22 -0000 1.12 --- Python and Extensions.dsw 16 Oct 2003 05:36:05 -0000 1.13 *************** *** 64,69 **** {{{ Begin Project Dependency ! Project_Dep_Name PyWinTypes End Project Dependency }}} --- 64,81 ---- {{{ Begin Project Dependency ! Project_Dep_Name PythonService servicemanager End Project Dependency + }}} + + ############################################################################### + + Project: "PythonService servicemanager"=".\win32\PythonService servicemanager.dsp" - Package Owner=<4> + + Package=<5> + {{{ + }}} + + Package=<4> + {{{ }}} |
From: <mha...@us...> - 2003-10-16 05:33:16
|
Update of /cvsroot/pywin32/pywin32/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv7193 Modified Files: PythonService EXE.dsp Added Files: PythonService servicemanager.dsp Log Message: Changes to the service manager. --- NEW FILE: PythonService servicemanager.dsp --- # Microsoft Developer Studio Project File - Name="PythonService servicemanager" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=PythonService servicemanager - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "PythonService servicemanager.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "PythonService servicemanager.mak" CFG="PythonService servicemanager - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "PythonService servicemanager - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "PythonService servicemanager - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName ""$/win32", YFAAAAAA" # PROP Scc_LocalPath "." CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "PythonService servicemanager - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Build" # PROP BASE Intermediate_Dir "Build\Temp\PythonService servicemanager\Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Build" # PROP Intermediate_Dir "Build\Temp\PythonServiceDll\Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /D "NDEBUG" /D "PYSERVICE_BUILD_DLL" /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_WINDOWS" /D "__WIN32__" /D "STRICT" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" # ADD BASE RSC /l 0xc09 /d "NDEBUG" # ADD RSC /l 0xc09 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1eb00000" /dll /debug /machine:I386 /out:"Build\servicemanager.pyd" /libpath:"./Build" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "PythonService servicemanager - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Build" # PROP BASE Intermediate_Dir "Build\Temp\PythonService servicemanager\Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Build" # PROP Intermediate_Dir "Build\Temp\PythonServiceDll\Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MDd /W3 /GX /ZI /Od /D "_DEBUG" /D "PYSERVICE_BUILD_DLL" /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_WINDOWS" /D "__WIN32__" /D "STRICT" /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" # ADD BASE RSC /l 0xc09 /d "_DEBUG" # ADD RSC /l 0xc09 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1eb00000" /dll /debug /machine:I386 /out:"Build\servicemanager_d.pyd" /pdbtype:sept /libpath:"./Build" # SUBTRACT LINK32 /pdb:none !ENDIF # Begin Target # Name "PythonService servicemanager - Win32 Release" # Name "PythonService servicemanager - Win32 Debug" # Begin Source File SOURCE=.\src\PythonService.cpp # End Source File # Begin Source File SOURCE=.\src\PythonServiceMessages.mc !IF "$(CFG)" == "PythonService servicemanager - Win32 Release" # Begin Custom Build - Compiling messages InputDir=.\src IntDir=.\Build\Temp\PythonServiceDll\Release InputPath=.\src\PythonServiceMessages.mc InputName=PythonServiceMessages BuildCmds= \ mc -h $(InputDir) -r $(IntDir) $(InputPath) \ rc $(IntDir)\$(InputName).rc \ "$(IntDir)\$(InputName).res" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" $(BuildCmds) "$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" $(BuildCmds) # End Custom Build !ELSEIF "$(CFG)" == "PythonService servicemanager - Win32 Debug" # Begin Custom Build - Compiling messages InputDir=.\src IntDir=.\Build\Temp\PythonServiceDll\Debug InputPath=.\src\PythonServiceMessages.mc InputName=PythonServiceMessages BuildCmds= \ mc -h $(InputDir) -r $(IntDir) $(InputPath) \ rc $(IntDir)\$(InputName).rc \ "$(IntDir)\$(InputName).res" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" $(BuildCmds) "$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" $(BuildCmds) # End Custom Build !ENDIF # End Source File # End Target # End Project Index: PythonService EXE.dsp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/PythonService EXE.dsp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PythonService EXE.dsp 2 Mar 2000 10:23:15 -0000 1.2 --- PythonService EXE.dsp 16 Oct 2003 05:32:52 -0000 1.3 *************** *** 55,59 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 ! # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1eb00000" /subsystem:console /debug /machine:I386 /out:"Build\PythonService.exe" # SUBTRACT LINK32 /pdb:none --- 55,59 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 ! # ADD LINK32 Advapi32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Build\PythonService.exe" /libpath:"./Build" # SUBTRACT LINK32 /pdb:none *************** *** 83,87 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1eb00000" /subsystem:console /debug /machine:I386 /out:"Build\PythonService_d.exe" /pdbtype:sept # SUBTRACT LINK32 /pdb:none --- 83,87 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 Advapi32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Build\PythonService_d.exe" /pdbtype:sept /libpath:"./Build" # SUBTRACT LINK32 /pdb:none *************** *** 95,145 **** SOURCE=.\src\PythonService.cpp - # End Source File - # Begin Source File - - SOURCE=.\src\PythonServiceMessages.mc - - !IF "$(CFG)" == "PythonService EXE - Win32 Release" - - # Begin Custom Build - Compiling messages - InputDir=.\src - IntDir=.\Build\Temp\PythonServiceExe\Release - InputPath=.\src\PythonServiceMessages.mc - InputName=PythonServiceMessages - - BuildCmds= \ - mc -h $(InputDir) -r $(IntDir) $(InputPath) \ - rc $(IntDir)\$(InputName).rc \ - - - "$(IntDir)\$(InputName).res" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - - "$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - # End Custom Build - - !ELSEIF "$(CFG)" == "PythonService EXE - Win32 Debug" - - # Begin Custom Build - Compiling messages - InputDir=.\src - IntDir=.\Build\Temp\PythonServiceExe\Debug - InputPath=.\src\PythonServiceMessages.mc - InputName=PythonServiceMessages - - BuildCmds= \ - mc -h $(InputDir) -r $(IntDir) $(InputPath) \ - rc $(IntDir)\$(InputName).rc \ - - - "$(IntDir)\$(InputName).res" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - - "$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - # End Custom Build - - !ENDIF - # End Source File # End Target --- 95,98 ---- |
From: <mha...@us...> - 2003-10-16 05:31:04
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv6703 Modified Files: win32serviceutil.py Log Message: If PythonService.exe was registered but did not exist, we no longer go ahead and registered for that .EXE anyway. Allow no "pythonClassString" to be specified (useful for py2exe) Index: win32serviceutil.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/win32serviceutil.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** win32serviceutil.py 24 Apr 2003 01:30:08 -0000 1.10 --- win32serviceutil.py 16 Oct 2003 05:30:55 -0000 1.11 *************** *** 24,28 **** baseName = os.path.splitext(os.path.basename(exeName))[0] try: ! return win32api.RegQueryValue(win32con.HKEY_LOCAL_MACHINE, "Software\\Python\\%s\\%s" % (baseName, sys.winver)) except win32api.error: # OK - not there - lets go a-searchin' --- 24,34 ---- baseName = os.path.splitext(os.path.basename(exeName))[0] try: ! exeName = win32api.RegQueryValue(win32con.HKEY_LOCAL_MACHINE, ! "Software\\Python\\%s\\%s" % (baseName, sys.winver)) ! if os.path.isfile(exeName): ! return exeName ! raise RuntimeError, "The executable '%s' is registered as the Python " \ ! "service exe, but it does not exist as specified" \ ! % exeName except win32api.error: # OK - not there - lets go a-searchin' *************** *** 213,221 **** def InstallPythonClassString(pythonClassString, serviceName): # Now setup our Python specific entries. ! key = win32api.RegCreateKey(win32con.HKEY_LOCAL_MACHINE, "System\\CurrentControlSet\\Services\\%s\\PythonClass" % serviceName) ! try: ! win32api.RegSetValue(key, None, win32con.REG_SZ, pythonClassString); ! finally: ! win32api.RegCloseKey(key) # Utility functions for Services, to allow persistant properties. --- 219,228 ---- def InstallPythonClassString(pythonClassString, serviceName): # Now setup our Python specific entries. ! if pythonClassString: ! key = win32api.RegCreateKey(win32con.HKEY_LOCAL_MACHINE, "System\\CurrentControlSet\\Services\\%s\\PythonClass" % serviceName) ! try: ! win32api.RegSetValue(key, None, win32con.REG_SZ, pythonClassString); ! finally: ! win32api.RegCloseKey(key) # Utility functions for Services, to allow persistant properties. *************** *** 426,430 **** print " --password password : The password for the username" print " --startup [manual|auto|disabled] : How the service starts, default = manual" ! print " --interactive : Allow the service to interactive with the desktop." sys.exit(1) --- 433,437 ---- print " --password password : The password for the username" print " --startup [manual|auto|disabled] : How the service starts, default = manual" ! print " --interactive : Allow the service to interact with the desktop." sys.exit(1) |
From: <mha...@us...> - 2003-10-16 05:28:55
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1:/tmp/cvs-serv6536 Modified Files: PythonServiceMessages.mc Log Message: A couple of new error messages. Index: PythonServiceMessages.mc =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PythonServiceMessages.mc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PythonServiceMessages.mc 9 May 2002 05:55:15 -0000 1.2 --- PythonServiceMessages.mc 16 Oct 2003 05:28:52 -0000 1.3 *************** *** 125,130 **** MessageId=0x6 Severity=Error ! SymbolicName=E_UNUSED Language=English . --- 125,132 ---- MessageId=0x6 Severity=Error ! SymbolicName=E_PYS_NO_SERVICE Language=English + An attempt was made to start the service '%1', but this service + is not hosted in this process. . *************** *** 189,192 **** --- 191,203 ---- . + MessageId=0xE + Severity=Error + SymbolicName=PYS_E_NO_SERVICEMANAGER + Language=English + Could not locate the Python servicemanager. + %n%1 + %n%2: %3 + . + MessageId=0x80 *************** *** 236,240 **** Error %1 - %2 . - MessageId=0xF000 --- 247,250 ---- |
From: <mha...@us...> - 2003-10-16 05:28:08
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1:/tmp/cvs-serv6148 Modified Files: PythonService.cpp Log Message: Major revamp of PythonService. There now exists a 'servicemanager.pyd' file, which does all of the service work. ServiceManager.exe remains, but becomes a stub. It is now possible (although not implemented) for python.exe to host a service. New versions of py2exe will use the same executable stub for services as for other executables. Index: PythonService.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PythonService.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PythonService.cpp 8 Oct 2003 00:14:58 -0000 1.6 --- PythonService.cpp 16 Oct 2003 05:27:56 -0000 1.7 *************** *** 2,5 **** --- 2,12 ---- // // PURPOSE: An executable that hosts Python services. + // This source file is used to compile 2 discrete targets: + // * servicemanager.pyd - A Python extension that contains + // all the functionality. + // * PythonService.exe - This simply loads servicemanager.pyd, and + // calls a public function. Note that PythonService.exe may one + // day die - it is now possible for python.exe to directly host + // services. [...1487 lines suppressed...] ! Py_DECREF(f); ! if (!hmod) { ! PyErr_Format(PyExc_RuntimeError, "servicemanager.__file__ could not be loaded - win32 error code is %d", GetLastError()); ! goto failed; } ! proc = GetProcAddress(hmod, "PythonService_main"); ! if (!proc) { ! PyErr_Format(PyExc_RuntimeError, "servicemanager.__file__ does not contain PythonService_main - win32 error code is %d", GetLastError()); ! goto failed; } ! typedef int (* FNPythonService_main)(int argc, char **argv); ! return ((FNPythonService_main)proc)(argc, argv); ! failed: ! fprintf(stderr, "PythonService was unable to locate the service manager. " ! "Please see the event log for details\n"); ! ReportPythonError(PYS_E_NO_SERVICEMANAGER); ! return 1; } + #endif |
From: <mha...@us...> - 2003-10-15 23:33:37
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory sc8-pr-cvs1:/tmp/cvs-serv16305 Modified Files: win32uimodule.cpp Log Message: Patch from Larry Howard to allow a tooltip control to be directly created. Index: win32uimodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32uimodule.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** win32uimodule.cpp 8 Jun 2002 15:21:09 -0000 1.25 --- win32uimodule.cpp 15 Oct 2003 23:33:33 -0000 1.26 *************** *** 1768,1771 **** --- 1768,1772 ---- extern PyObject *PyCStatusBarCtrl_create(PyObject *self, PyObject *args); extern PyObject *PyCToolBarCtrl_create(PyObject *self, PyObject *args); + extern PyObject *PyCToolTipCtrl_create(PyObject *self, PyObject *args); extern PyObject *ui_window_create(PyObject *self, PyObject *args); extern PyObject *PyCImageList_Create(PyObject *self, PyObject *args); *************** *** 1831,1834 **** --- 1832,1836 ---- {"CreateToolBar", PyCToolBar::create, 1}, // @pymeth CreateToolBar|Creates a toolbar object. {"CreateToolBarCtrl", PyCToolBarCtrl_create, 1}, // @pymeth CreateToolBar|Creates a toolbar object. + {"CreateToolTipCtrl", PyCToolTipCtrl_create, 1}, // @pymeth CreateToolTip|Creates a tooltip control object. {"CreateThread", PyCWinThread::create, 1}, // @pymeth CreateThread|Creates a <o PyCWinThread> object. {"CreateView", PyCScrollView::create, 1}, // @pymeth CreateView|Creates a <o PyCView> object. |
From: <mha...@us...> - 2003-10-15 04:30:25
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1:/tmp/cvs-serv5469 Added Files: PyWin32.kpf Log Message: Komodo project file for these extensions. --- NEW FILE: PyWin32.kpf --- <?xml version="1.0" encoding="UTF-8"?> <!-- Komodo Project File - DO NOT EDIT --> <project kpf_version="2" name="PyWin32"> <preference-set id=""> <string id="import_exclude_matches">*.*~;*.bak;*.tmp;CVS;.#*;*.pyo;*.pyc;*.dsp</string> <string id="import_dirname">E:\src\pythonex</string> <string id="import_include_matches">*.c;*.cpp;*.h;*.def;*.mc;*.py;*.bat;*.txt;*.vbs;*.js;*.x*;*.i;</string> </preference-set> <file name="build_for_version.bat" url="build_for_version.bat"> </file> <file name="setup_win32all_core.py" url="setup_win32all_core.py"> </file> <file name="set_for_version.py" url="set_for_version.py"> </file> <folder name="com" url="com"> <file name="changes.txt" url="com/changes.txt"> </file> <file name="License.txt" url="com/License.txt"> </file> [...1873 lines suppressed...] <folder name="test" url="win32/test"> <file name="handles.py" url="win32/test/handles.py"> </file> <file name="test_clipboard.py" url="win32/test/test_clipboard.py"> </file> <file name="test_security.py" url="win32/test/test_security.py"> </file> <file name="test_win32api.py" url="win32/test/test_win32api.py"> </file> <file name="test_win32file.py" url="win32/test/test_win32file.py"> </file> <file name="test_win32pipe.py" url="win32/test/test_win32pipe.py"> </file> <file name="test_win32trace.py" url="win32/test/test_win32trace.py"> </file> <file name="test_win32wnet.py" url="win32/test/test_win32wnet.py"> </file> </folder> </folder> </project> |
From: <mha...@us...> - 2003-10-15 04:22:07
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1:/tmp/cvs-serv4066 Modified Files: win32gui.i Log Message: Lots of new menu functions. Index: win32gui.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32gui.i,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** win32gui.i 6 Oct 2003 11:06:19 -0000 1.30 --- win32gui.i 15 Oct 2003 04:22:03 -0000 1.31 *************** *** 55,58 **** --- 55,64 ---- typedef long HDC + %apply HBRUSH {long}; + typedef long HBRUSH + + %apply HRGN {long}; + typedef long HRGN + %apply HIMAGELIST {long}; typedef long HIMAGELIST *************** *** 2063,2094 **** BOOL GetOpenFileName(OPENFILENAME *INPUT); ! %typemap (python, in) MENUITEMINFO *INPUT (int size, char buffer[200]){ ! size = sizeof(MENUITEMINFO); ! $source = PyObject_Str($source); ! if ( (! PyString_Check($source)) || ((size != PyString_GET_SIZE($source)) && ! (size+4 != PyString_GET_SIZE($source))) ) { ! sprintf(buffer, "Argument must be a %d-byte string", size); ! PyErr_SetString(PyExc_TypeError, buffer); return NULL; ! } ! $target = ( MENUITEMINFO * )PyString_AS_STRING($source); } ! #ifndef MS_WINCE BOOLAPI InsertMenuItem(HMENU hMenu, UINT uItem, BOOL fByPosition, MENUITEMINFO *INPUT); #endif BOOLAPI AppendMenu(HMENU hMenu, UINT uFlags, UINT uIDNewItem, TCHAR *lpNewItem); BOOLAPI InsertMenu(HMENU hMenu, UINT uPosition, UINT uFlags, UINT uIDNewItem, TCHAR *INPUT_NULLOK); ! /* BOOLAPI DrawFocusRect(HDC hDC, RECT *INPUT); int DrawText(HDC hDC, LPCTSTR lpString, int nCount, RECT *INPUT, UINT uFormat); ! HDC BeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint); ! BOOLAPI EndPaint(HWND hWnd, PAINTSTRUCT *lpPaint); ! BOOLAPI DrawEdge(HDC hdc, LPRECT qrc, UINT edge, UINT grfFlags); int FillRect(HDC hDC, RECT *INPUT, HBRUSH hbr); - int FrameRect(HDC hDC, RECT *INPUT, HBRUSH hbr); - int GetUpdateRgn(HWND hWnd, HRGN hRgn, BOOL bErase); DWORD GetSysColor(int nIndex); BOOLAPI InvalidateRect(HWND hWnd, RECT *INPUT, BOOL bErase); */ --- 2069,2168 ---- BOOL GetOpenFileName(OPENFILENAME *INPUT); ! #ifndef MS_WINCE ! ! %typemap (python, in) MENUITEMINFO *INPUT (int target_size){ ! if (0 != PyObject_AsReadBuffer($source, (const void **)&$target, &target_size)) return NULL; ! if (sizeof MENUITEMINFO != target_size) ! return PyErr_Format(PyExc_TypeError, "Argument must be a %d-byte string/buffer (got %d bytes)", sizeof MENUITEMINFO, target_size); } ! ! %typemap (python,in) MENUITEMINFO *BOTH(int target_size) { ! if (0 != PyObject_AsWriteBuffer($source, (void **)&$target, &target_size)) ! return NULL; ! if (sizeof MENUITEMINFO != target_size) ! return PyErr_Format(PyExc_TypeError, "Argument must be a %d-byte buffer (got %d bytes)", sizeof MENUITEMINFO, target_size); ! } ! ! // @pyswig |InsertMenuItem|Inserts a menu item ! // @pyparm int|hMenu|| ! // @pyparm int|fByPosition|| ! // @pyparm buffer|menuItem||A string or buffer in the format of a MENUITEMINFO structure. BOOLAPI InsertMenuItem(HMENU hMenu, UINT uItem, BOOL fByPosition, MENUITEMINFO *INPUT); + + // @pyswig |SetMenuItemInfo|Sets menu information + // @pyparm int|hMenu|| + // @pyparm int|fByPosition|| + // @pyparm buffer|menuItem||A string or buffer in the format of a MENUITEMINFO structure. + BOOLAPI SetMenuItemInfo(HMENU hMenu, UINT uItem, BOOL fByPosition, MENUITEMINFO *INPUT); + + // @pyswig |GetMenuItemInfo|Gets menu information + // @pyparm int|hMenu|| + // @pyparm int|fByPosition|| + // @pyparm buffer|menuItem||A string or buffer in the format of a MENUITEMINFO structure. + BOOLAPI GetMenuItemInfo(HMENU hMenu, UINT uItem, BOOL fByPosition, MENUITEMINFO *BOTH); + #endif + + // @pyswig int|GetMenuItemCount| + int GetMenuItemCount(HMENU hMenu); + + // @pyswig int|GetMenuItemRect| + int GetMenuItemRect(HWND hWnd, HMENU hMenu, UINT uItem, RECT *OUTPUT); + + // @pyswig int|GetMenuState| + int GetMenuState(HMENU hMenu, UINT uID, UINT flags); + + // @pyswig |SetMenuDefaultItem| + BOOLAPI SetMenuDefaultItem(HMENU hMenu, UINT flags, UINT fByPos); + + // @pyswig |AppendMenu| BOOLAPI AppendMenu(HMENU hMenu, UINT uFlags, UINT uIDNewItem, TCHAR *lpNewItem); + + // @pyswig |InsertMenu| BOOLAPI InsertMenu(HMENU hMenu, UINT uPosition, UINT uFlags, UINT uIDNewItem, TCHAR *INPUT_NULLOK); ! // @pyswig |EnableMenuItem| ! BOOLAPI EnableMenuItem(HMENU hMenu, UINT uIDEnableItem, UINT uEnable); ! ! // @pyswig int|CheckMenuItem| ! int CheckMenuItem(HMENU hMenu, UINT uIDCheckItem, UINT uCheck); ! ! // @pyswig |ModifyMenu|Changes an existing menu item. This function is used to specify the content, appearance, and behavior of the menu item. ! BOOLAPI ModifyMenu( ! HMENU hMnu, // @pyparm int|hMnu||handle to menu ! UINT uPosition, // @pyparm int|uPosition||menu item to modify ! UINT uFlags, // @pyparm int|uFlags||options ! UINT uIDNewItem, // @pyparm int|uIDNewItem||identifier, menu, or submenu ! LPCTSTR lpNewItem // @pyparm string|newItem||menu item content ! ); ! ! // @pyswig int|GetMenuItemID|Retrieves the menu item identifier of a menu item located at the specified position in a menu. ! UINT GetMenuItemID( ! HMENU hMenu, // @pyparm int|hMenu||handle to menu ! int nPos // @pyparm int|nPos||position of menu item ! ); ! ! // @pyswig |SetMenuItemBitmaps|Associates the specified bitmap with a menu item. Whether the menu item is selected or clear, the system displays the appropriate bitmap next to the menu item. ! BOOLAPI SetMenuItemBitmaps( ! HMENU hMenu, // @pyparm int|hMenu||handle to menu ! UINT uPosition, // @pyparm int|uPosition||menu item ! UINT uFlags, // @pyparm int|uFlags||options ! HBITMAP hBitmapUnchecked, // @pyparm int|hBitmapUnchecked||handle to unchecked bitmap ! HBITMAP hBitmapChecked // @pyparm int|hBitmapChecked||handle to checked bitmap ! ); ! ! BOOLAPI DrawFocusRect(HDC hDC, RECT *INPUT); int DrawText(HDC hDC, LPCTSTR lpString, int nCount, RECT *INPUT, UINT uFormat); ! BOOLAPI DrawEdge(HDC hdc, RECT *INPUT, UINT edge, UINT grfFlags); int FillRect(HDC hDC, RECT *INPUT, HBRUSH hbr); DWORD GetSysColor(int nIndex); BOOLAPI InvalidateRect(HWND hWnd, RECT *INPUT, BOOL bErase); + int FrameRect(HDC hDC, RECT *INPUT, HBRUSH hbr); + int GetUpdateRgn(HWND hWnd, HRGN hRgn, BOOL bErase); + /* + HDC BeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint); + BOOLAPI EndPaint(HWND hWnd, PAINTSTRUCT *lpPaint); */ *************** *** 2165,2171 **** HDC hDC // @pyparm int|hDC||handle to device context ); - - %apply HRGN {long}; - typedef long HRGN // |SystemParametersInfo|queries or sets system-wide parameters. This function can also update the user profile while setting a parameter. --- 2239,2242 ---- |
From: <mha...@us...> - 2003-10-15 04:16:43
|
Update of /cvsroot/pywin32/pywin32/win32/Demos/images In directory sc8-pr-cvs1:/tmp/cvs-serv3033 Added Files: frowny.bmp smiley.bmp Log Message: Couple of small images for our demos. --- NEW FILE: frowny.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: smiley.bmp --- (This appears to be a binary file; contents omitted.) |
From: <mha...@us...> - 2003-10-15 04:16:14
|
Update of /cvsroot/pywin32/pywin32/win32/Demos/images In directory sc8-pr-cvs1:/tmp/cvs-serv2967/images Log Message: Directory /cvsroot/pywin32/pywin32/win32/Demos/images added to the repository |