Thread: [pywin32-checkins] pywin32/win32/src win32pdhmodule.cpp, 1.17.2.3, 1.17.2.4
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2008-09-29 01:54:21
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26055 Modified Files: Tag: py3k win32pdhmodule.cpp Log Message: Fix PDH_COUNTER_INFO return Userdata for PdhAddCounter is now a DWORD_PTR Index: win32pdhmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32pdhmodule.cpp,v retrieving revision 1.17.2.3 retrieving revision 1.17.2.4 diff -C2 -d -r1.17.2.3 -r1.17.2.4 *** win32pdhmodule.cpp 28 Sep 2008 23:38:08 -0000 1.17.2.3 --- win32pdhmodule.cpp 29 Sep 2008 01:54:04 -0000 1.17.2.4 *************** *** 73,77 **** HQUERY hQuery, // handle to the query LPCTSTR szFullCounterPath, // path of the counter ! DWORD dwUserData, // user-defined value HCOUNTER *phCounter // pointer to the counter handle buffer ); --- 73,77 ---- HQUERY hQuery, // handle to the query LPCTSTR szFullCounterPath, // path of the counter ! DWORD_PTR dwUserData, // user-defined value HCOUNTER *phCounter // pointer to the counter handle buffer ); *************** *** 429,445 **** PyObject *obhQuery; PyObject *obPath; ! DWORD userData = 0; ! if (!PyArg_ParseTuple(args, "OO|i:AddCounter", &obhQuery, // @pyparm int|hQuery||Handle to an open query. &obPath, // @pyparm string|path||Full path to the performance data ! &userData)) // @pyparm int|userData|0|User data associated with the counter. return NULL; if (!PyWinObject_AsHANDLE(obhQuery, &hQuery)) return NULL; TCHAR *szPath; if (!PyWinObject_AsTCHAR(obPath, &szPath, FALSE)) return NULL; HCOUNTER hCounter; ! CHECK_PDH_PTR(pPdhAddCounter); PyW32_BEGIN_ALLOW_THREADS PDH_STATUS pdhStatus = (*pPdhAddCounter) ( --- 429,450 ---- PyObject *obhQuery; PyObject *obPath; ! PyObject *obuserData = Py_None; // Might make more sense to use actual PyObject for userData ! DWORD_PTR userData = 0; ! CHECK_PDH_PTR(pPdhAddCounter); ! if (!PyArg_ParseTuple(args, "OO|O:AddCounter", &obhQuery, // @pyparm int|hQuery||Handle to an open query. &obPath, // @pyparm string|path||Full path to the performance data ! &obuserData)) // @pyparm int|userData|0|User data associated with the counter. return NULL; if (!PyWinObject_AsHANDLE(obhQuery, &hQuery)) return NULL; + if (obuserData != Py_None) + if (!PyWinLong_AsDWORD_PTR(obuserData, &userData)) + return NULL; TCHAR *szPath; if (!PyWinObject_AsTCHAR(obPath, &szPath, FALSE)) return NULL; HCOUNTER hCounter; ! PyW32_BEGIN_ALLOW_THREADS PDH_STATUS pdhStatus = (*pPdhAddCounter) ( *************** *** 646,671 **** PyObject *rc; if (pdhStatus != ERROR_SUCCESS) ! rc = PyWin_SetAPIError("GetCounterInfo for data", pdhStatus); else { ! if (!CheckCounterStatusOK(pInfo->CStatus)) ! rc = NULL; ! else ! rc = Py_BuildValue("iiiiiiz(zzzziz)z", ! pInfo->dwType, ! pInfo->CVersion, ! pInfo->lScale, ! pInfo->lDefaultScale, ! pInfo->dwUserData, ! pInfo->dwQueryUserData, ! pInfo->szFullPath, ! ! pInfo->szMachineName, ! pInfo->szObjectName, ! pInfo->szInstanceName, ! pInfo->szParentInstance, ! pInfo->dwInstanceIndex, ! pInfo->szCounterName, ! ! pInfo->szExplainText); } free(pInfo); --- 651,677 ---- PyObject *rc; if (pdhStatus != ERROR_SUCCESS) ! rc = PyWin_SetAPIError("GetCounterInfo for data", pdhStatus); else { ! if (!CheckCounterStatusOK(pInfo->CStatus)) ! rc = NULL; ! else ! rc = Py_BuildValue("iiiiNNN(NNNNiN)N", ! pInfo->dwType, ! pInfo->CVersion, ! // ??? CStatus is missing ??? ! pInfo->lScale, ! pInfo->lDefaultScale, ! PyWinObject_FromDWORD_PTR(pInfo->dwUserData), ! PyWinObject_FromDWORD_PTR(pInfo->dwQueryUserData), ! PyWinObject_FromTCHAR(pInfo->szFullPath), ! ! PyWinObject_FromTCHAR(pInfo->szMachineName), ! PyWinObject_FromTCHAR(pInfo->szObjectName), ! PyWinObject_FromTCHAR(pInfo->szInstanceName), ! PyWinObject_FromTCHAR(pInfo->szParentInstance), ! pInfo->dwInstanceIndex, ! PyWinObject_FromTCHAR(pInfo->szCounterName), ! ! PyWinObject_FromTCHAR(pInfo->szExplainText)); } free(pInfo); |