pywin32-checkins Mailing List for Python for Windows Extensions (Page 96)
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: Roger U. <ru...@us...> - 2007-01-22 01:20:52
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26230/com/win32com/src Modified Files: PythonCOM.cpp Log Message: CoInitializeSecurity requires an absolute security descriptor, and some more constants Index: PythonCOM.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PythonCOM.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** PythonCOM.cpp 17 Jan 2007 19:13:46 -0000 1.42 --- PythonCOM.cpp 22 Jan 2007 01:20:51 -0000 1.43 *************** *** 281,294 **** DWORD dwImpLevel; DWORD dwCapabilities; ! PSECURITY_DESCRIPTOR pSD; PyObject *obSD, *obAuthSvc, *obReserved1, *obReserved2, *obAuthInfo; if (!PyArg_ParseTuple(args, "OOOiiOiO:CoInitializeSecurity", ! &obSD, // @pyparm <o PySECURITY_DESCRIPTOR>|sd|| &obAuthSvc, // @pyparm object|authInfo||A value of None tells COM to choose which authentication services to use. An empty list means use no services. &obReserved1,// @pyparm object|reserved1||Must be None ! &dwAuthnLevel, // @pyparm int|authnLevel||The default authentication level for proxies. On the server side, COM will fail calls that arrive at a lower level. All calls to AddRef and Release are made at this level. ! &dwImpLevel, // @pyparm int|impLevel||The default impersonation level for proxies. This value is not checked on the server side. AddRef and Release calls are made with this impersonation level so even security aware apps should set this carefully. Setting IUnknown security only affects calls to QueryInterface, not AddRef or Release. &obAuthInfo, // @pyparm object|authInfo||Must be None ! &dwCapabilities, // @pyparm int|capabilities||Additional client and/or server-side capabilities. Any set of EOAC flags may be passed. Currently only EOAC_MUTUAL_AUTH, EOAC_SECURE_REFS, and EOAC_NONE are defined &obReserved2)) // @pyparm object|reserved2||Must be None return NULL; --- 281,294 ---- DWORD dwImpLevel; DWORD dwCapabilities; ! PSECURITY_DESCRIPTOR pSD, pSD_absolute=NULL; PyObject *obSD, *obAuthSvc, *obReserved1, *obReserved2, *obAuthInfo; if (!PyArg_ParseTuple(args, "OOOiiOiO:CoInitializeSecurity", ! &obSD, // @pyparm <o PySECURITY_DESCRIPTOR>|sd||Security descriptor containing access permissions for process' objects, can be None &obAuthSvc, // @pyparm object|authInfo||A value of None tells COM to choose which authentication services to use. An empty list means use no services. &obReserved1,// @pyparm object|reserved1||Must be None ! &dwAuthnLevel, // @pyparm int|authnLevel||One of pythoncom.RPC_C_AUTHN_LEVEL_* values. The default authentication level for proxies. On the server side, COM will fail calls that arrive at a lower level. All calls to AddRef and Release are made at this level. ! &dwImpLevel, // @pyparm int|impLevel||One of pythoncom.RPC_C_IMP_LEVEL_* values. The default impersonation level for proxies. This value is not checked on the server side. AddRef and Release calls are made with this impersonation level so even security aware apps should set this carefully. Setting IUnknown security only affects calls to QueryInterface, not AddRef or Release. &obAuthInfo, // @pyparm object|authInfo||Must be None ! &dwCapabilities, // @pyparm int|capabilities||Additional client and/or server-side capabilities. Any set of pythoncom.EOAC_* flags may be passed. Currently only EOAC_MUTUAL_AUTH, EOAC_SECURE_REFS, and EOAC_NONE are defined &obReserved2)) // @pyparm object|reserved2||Must be None return NULL; *************** *** 316,323 **** CoInitializeSecurityfunc mypfn=(CoInitializeSecurityfunc)fp; PY_INTERFACE_PRECALL; ! HRESULT hr = (*mypfn)(pSD, cAuthSvc, pAS, NULL, dwAuthnLevel, dwImpLevel, NULL, dwCapabilities, NULL); // HRESULT hr = CoInitializeSecurity(pSD, cAuthSvc, pAS, NULL, dwAuthnLevel, dwImpLevel, NULL, dwCapabilities, NULL); PY_INTERFACE_POSTCALL; if (FAILED(hr)) return PyCom_BuildPyException(hr); --- 316,330 ---- CoInitializeSecurityfunc mypfn=(CoInitializeSecurityfunc)fp; + // Security descriptor must be in absolute form + if (pSD!=NULL) + if (!_MakeAbsoluteSD(pSD, &pSD_absolute)) + return NULL; + PY_INTERFACE_PRECALL; ! HRESULT hr = (*mypfn)(pSD_absolute, cAuthSvc, pAS, NULL, dwAuthnLevel, dwImpLevel, NULL, dwCapabilities, NULL); // HRESULT hr = CoInitializeSecurity(pSD, cAuthSvc, pAS, NULL, dwAuthnLevel, dwImpLevel, NULL, dwCapabilities, NULL); PY_INTERFACE_POSTCALL; + if (pSD_absolute!=NULL) + FreeAbsoluteSD(pSD_absolute); if (FAILED(hr)) return PyCom_BuildPyException(hr); *************** *** 2016,2020 **** --- 2023,2030 ---- ADD_CONSTANT(ROTFLAGS_REGISTRATIONKEEPSALIVE); ADD_CONSTANT(ROTFLAGS_ALLOWANYCLIENT); + // RPC + // Authentication Level used with CoInitializeSecurity + ADD_CONSTANT(RPC_C_AUTHN_LEVEL_DEFAULT); // RPC_C_AUTHN_LEVEL_DEFAULT|Lets DCOM negotiate the authentication level automatically. (Win2k or later) ADD_CONSTANT(RPC_C_AUTHN_LEVEL_NONE); // RPC_C_AUTHN_LEVEL_NONE|Performs no authentication. ADD_CONSTANT(RPC_C_AUTHN_LEVEL_CONNECT); // RPC_C_AUTHN_LEVEL_CONNECT|Authenticates only when the client establishes a relationship with the server. Datagram transports always use RPC_AUTHN_LEVEL_PKT instead. *************** *** 2024,2027 **** --- 2034,2039 ---- ADD_CONSTANT(RPC_C_AUTHN_LEVEL_PKT_PRIVACY); // RPC_C_AUTHN_LEVEL_PKT_PRIVACY|Authenticates all previous levels and encrypts the argument value of each remote procedure call. + // Impersonation level used with CoInitializeSecurity + ADD_CONSTANT(RPC_C_IMP_LEVEL_DEFAULT); // RPC_C_IMP_LEVEL_DEFAULT|Use default impersonation level (Win2k or later) ADD_CONSTANT(RPC_C_IMP_LEVEL_ANONYMOUS); // RPC_C_IMP_LEVEL_ANONYMOUS|(Not supported in this release.) The client is anonymous to the server. The server process cannot obtain identification information about the client and it cannot impersonate the client. ADD_CONSTANT(RPC_C_IMP_LEVEL_IDENTIFY); // RPC_C_IMP_LEVEL_IDENTIFY|The server can obtain the clients identity. The server can impersonate the client for ACL checking, but cannot access system objects as the client. This information is obtained when the connection is established, not on every call.<nl>Note GetUserName will fail while impersonating at identify level. The workaround is to impersonate, OpenThreadToken, revert, call GetTokenInformation, and finally, call LookupAccountSid. *************** *** 2029,2032 **** --- 2041,2061 ---- ADD_CONSTANT(RPC_C_IMP_LEVEL_DELEGATE); // RPC_C_IMP_LEVEL_DELEGATE|(Not supported in this release.) The server process can impersonate the client's security context while acting on behalf of the client. The server process can also make outgoing calls to other servers while acting on behalf of the client. This information is obtained when the connection is established, not on every call. + // Authentication capabilities used with CoInitializeSecurity (EOLE_AUTHENTICATION_CAPABILITIES enum) + ADD_CONSTANT(EOAC_NONE); + ADD_CONSTANT(EOAC_MUTUAL_AUTH); + ADD_CONSTANT(EOAC_SECURE_REFS); + ADD_CONSTANT(EOAC_ACCESS_CONTROL); + ADD_CONSTANT(EOAC_APPID); + ADD_CONSTANT(EOAC_DYNAMIC); + ADD_CONSTANT(EOAC_STATIC_CLOAKING); + ADD_CONSTANT(EOAC_DYNAMIC_CLOAKING); + ADD_CONSTANT(EOAC_ANY_AUTHORITY); + ADD_CONSTANT(EOAC_MAKE_FULLSIC); + ADD_CONSTANT(EOAC_REQUIRE_FULLSIC); + ADD_CONSTANT(EOAC_AUTO_IMPERSONATE); + ADD_CONSTANT(EOAC_DEFAULT); + ADD_CONSTANT(EOAC_DISABLE_AAA); + ADD_CONSTANT(EOAC_NO_CUSTOM_MARSHAL); + // STDOLE ADD_CONSTANT(STDOLE_MAJORVERNUM); |
From: Roger U. <ru...@us...> - 2007-01-21 16:59:59
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/directsound/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22343/com/win32comext/directsound/src Modified Files: PyIDirectSound.cpp Log Message: Change place where HWND treated as int Index: PyIDirectSound.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/directsound/src/PyIDirectSound.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PyIDirectSound.cpp 23 Mar 2005 22:51:09 -0000 1.5 --- PyIDirectSound.cpp 21 Jan 2007 16:59:56 -0000 1.6 *************** *** 84,89 **** return NULL; ! ! if (obHWND == Py_None) { hwnd = GetForegroundWindow(); --- 84,90 ---- return NULL; ! if (!PyWinObject_AsHANDLE(obHWND, (HANDLE *)&hwnd, TRUE)) ! return NULL; ! if (hwnd == NULL) { hwnd = GetForegroundWindow(); *************** *** 93,105 **** } } - else if (PyInt_Check(obHWND)) - { - hwnd = (HWND)PyInt_AS_LONG(obHWND); - } - else - { - PyErr_SetString(PyExc_TypeError, "argument 1 must be a window handle or None"); - return NULL; - } HRESULT hr; --- 94,97 ---- |
From: Roger U. <ru...@us...> - 2007-01-21 15:25:58
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18373/com/win32comext/shell/src Modified Files: PyIShellFolder.cpp Log Message: Change places where handles were treated as longs Index: PyIShellFolder.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIShellFolder.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PyIShellFolder.cpp 26 Oct 2005 01:05:18 -0000 1.12 --- PyIShellFolder.cpp 21 Jan 2007 15:24:02 -0000 1.13 *************** *** 37,41 **** if ( pISF == NULL ) return NULL; ! // @pyparm HWND|hwndOwner||Window in which to display any dialogs or message boxes, can be 0 // @pyparm <o PyIBindCtx>|pbc||Bind context that affects how parsing is performed, can be None // @pyparm <o PyUNICODE>|DisplayName||Display name to parse, format is dependent on the shell folder. --- 37,41 ---- if ( pISF == NULL ) return NULL; ! // @pyparm <o PyHANDLE>|hwndOwner||Window in which to display any dialogs or message boxes, can be 0 // @pyparm <o PyIBindCtx>|pbc||Bind context that affects how parsing is performed, can be None // @pyparm <o PyUNICODE>|DisplayName||Display name to parse, format is dependent on the shell folder. *************** *** 46,49 **** --- 46,50 ---- PyObject *oblpszDisplayName; HWND hwndOwner; + PyObject *obhwndOwner; IBindCtx * pbcReserved; LPOLESTR lpszDisplayName; *************** *** 51,57 **** ITEMIDLIST *ppidl; ULONG pdwAttributes = 0; ! if ( !PyArg_ParseTuple(args, "lOO|k:ParseDisplayName", &hwndOwner, &obpbcReserved, &oblpszDisplayName, &pdwAttributes) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpbcReserved, IID_IBindCtx, (void **)&pbcReserved, TRUE /* bNoneOK */)) --- 52,60 ---- ITEMIDLIST *ppidl; ULONG pdwAttributes = 0; ! if ( !PyArg_ParseTuple(args, "OOO|k:ParseDisplayName", &obhwndOwner, &obpbcReserved, &oblpszDisplayName, &pdwAttributes) ) return NULL; + if (!PyWinObject_AsHANDLE(obhwndOwner, (HANDLE *)&hwndOwner, TRUE)) + return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpbcReserved, IID_IBindCtx, (void **)&pbcReserved, TRUE /* bNoneOK */)) *************** *** 84,94 **** if ( pISF == NULL ) return NULL; ! // @pyparm HWND|hwndOwner|0|Window to use if any user interaction is required // @pyparm int|grfFlags|SHCONTF_FOLDERS\|SHCONTF_NONFOLDERS\|SHCONTF_INCLUDEHIDDEN|Combination of shellcon.SHCONTF_* constants HWND hwndOwner = 0; DWORD grfFlags = SHCONTF_FOLDERS|SHCONTF_NONFOLDERS|SHCONTF_INCLUDEHIDDEN; IEnumIDList * ppeidl; ! if ( !PyArg_ParseTuple(args, "|ll:EnumObjects", &hwndOwner, &grfFlags) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; --- 87,101 ---- if ( pISF == NULL ) return NULL; ! // @pyparm <o PyHANDLE>|hwndOwner|None|Window to use if any user interaction is required // @pyparm int|grfFlags|SHCONTF_FOLDERS\|SHCONTF_NONFOLDERS\|SHCONTF_INCLUDEHIDDEN|Combination of shellcon.SHCONTF_* constants HWND hwndOwner = 0; + PyObject *obhwndOwner=Py_None; DWORD grfFlags = SHCONTF_FOLDERS|SHCONTF_NONFOLDERS|SHCONTF_INCLUDEHIDDEN; IEnumIDList * ppeidl; ! if ( !PyArg_ParseTuple(args, "|Ol:EnumObjects", &obhwndOwner, &grfFlags) ) ! return NULL; ! if (!PyWinObject_AsHANDLE(obhwndOwner, (HANDLE *)&hwndOwner, TRUE)) return NULL; + HRESULT hr; PY_INTERFACE_PRECALL; *************** *** 235,241 **** PyObject *obriid; HWND hwndOwner; IID riid; void * out; ! if ( !PyArg_ParseTuple(args, "lO:CreateViewObject", &hwndOwner, &obriid) ) return NULL; BOOL bPythonIsHappy = TRUE; --- 242,251 ---- PyObject *obriid; HWND hwndOwner; + PyObject *obhwndOwner; IID riid; void * out; ! if ( !PyArg_ParseTuple(args, "OO:CreateViewObject", &obhwndOwner, &obriid) ) ! return NULL; ! if (!PyWinObject_AsHANDLE(obhwndOwner, (HANDLE *)&hwndOwner, TRUE)) return NULL; BOOL bPythonIsHappy = TRUE; *************** *** 290,294 **** if ( pISF == NULL ) return NULL; ! // @pyparm HWND|hwndOwner||Specifies a window in which to display any required dialogs or errors, can be 0 // @pyparm (<o PyIDL>,...)|pidl||A sequence of single-level pidls identifying items in the folder // @pyparm <o PyIID>|riid||The interface to create, one of IID_IContextMenu, IID_IContextMenu2, IID_IDataObject, IID_IDropTarget, IID_IExtractIcon, IID_IQueryInfo --- 300,304 ---- if ( pISF == NULL ) return NULL; ! // @pyparm <o PyHANDLE>|hwndOwner||Specifies a window in which to display any required dialogs or errors, can be 0 // @pyparm (<o PyIDL>,...)|pidl||A sequence of single-level pidls identifying items in the folder // @pyparm <o PyIID>|riid||The interface to create, one of IID_IContextMenu, IID_IContextMenu2, IID_IDataObject, IID_IDropTarget, IID_IExtractIcon, IID_IQueryInfo *************** *** 297,300 **** --- 307,311 ---- PyObject *obriid; PyObject *obiidout = NULL; + PyObject *obhwndOwner; HWND hwndOwner; UINT cidl; *************** *** 303,307 **** UINT rgfInOut; void * out; ! if ( !PyArg_ParseTuple(args, "lOOl|O:GetUIObjectOf", &hwndOwner, &obpidl, &obriid, &rgfInOut, &obiidout) ) return NULL; BOOL bPythonIsHappy = TRUE; --- 314,320 ---- UINT rgfInOut; void * out; ! if ( !PyArg_ParseTuple(args, "OOOl|O:GetUIObjectOf", &obhwndOwner, &obpidl, &obriid, &rgfInOut, &obiidout) ) ! return NULL; ! if (!PyWinObject_AsHANDLE(obhwndOwner, (HANDLE *)&hwndOwner, TRUE)) return NULL; BOOL bPythonIsHappy = TRUE; *************** *** 371,374 **** --- 384,388 ---- PyObject *obpidl=NULL, *ret=NULL; PyObject *oblpszName=NULL; + PyObject *obhwndOwner; HWND hwndOwner; ITEMIDLIST *pidl=NULL; *************** *** 377,382 **** DWORD flags; ! if ( !PyArg_ParseTuple(args, "lOOl:SetNameOf", &hwndOwner, &obpidl, &oblpszName, &flags) ) return NULL; if (PyObject_AsPIDL(obpidl, &pidl)&& PyWinObject_AsBstr(oblpszName, &lpszName)){ --- 391,399 ---- DWORD flags; ! if ( !PyArg_ParseTuple(args, "OOOl:SetNameOf", &obhwndOwner, &obpidl, &oblpszName, &flags) ) return NULL; + if (!PyWinObject_AsHANDLE(obhwndOwner, (HANDLE *)&hwndOwner, TRUE)) + return NULL; + if (PyObject_AsPIDL(obpidl, &pidl)&& PyWinObject_AsBstr(oblpszName, &lpszName)){ *************** *** 437,441 **** oblpszDisplayName = MakeOLECHARToObj(lpszDisplayName); PyObject *result; ! HRESULT hr=InvokeViaPolicy("ParseDisplayName", &result, "lOOl", hwndOwner, obpbcReserved, oblpszDisplayName, pdwAttributes ? *pdwAttributes : 0); --- 454,458 ---- oblpszDisplayName = MakeOLECHARToObj(lpszDisplayName); PyObject *result; ! HRESULT hr=InvokeViaPolicy("ParseDisplayName", &result, "NOOl", PyWinLong_FromHANDLE(hwndOwner), obpbcReserved, oblpszDisplayName, pdwAttributes ? *pdwAttributes : 0); *************** *** 470,474 **** PY_GATEWAY_METHOD; PyObject *result; ! HRESULT hr=InvokeViaPolicy("EnumObjects", &result, "ll", hwndOwner, grfFlags); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params --- 487,491 ---- PY_GATEWAY_METHOD; PyObject *result; ! HRESULT hr=InvokeViaPolicy("EnumObjects", &result, "Nl", PyWinLong_FromHANDLE(hwndOwner), grfFlags); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params *************** *** 564,568 **** obriid = PyWinObject_FromIID(riid); PyObject *result; ! HRESULT hr=InvokeViaPolicy(szMethodName, &result, "lO", hwndOwner, obriid); Py_XDECREF(obriid); if (FAILED(hr)) return hr; --- 581,585 ---- obriid = PyWinObject_FromIID(riid); PyObject *result; ! HRESULT hr=InvokeViaPolicy(szMethodName, &result, "NO", PyWinLong_FromHANDLE(hwndOwner), obriid); Py_XDECREF(obriid); if (FAILED(hr)) return hr; *************** *** 609,613 **** obriid = PyWinObject_FromIID(riid); PyObject *result; ! HRESULT hr=InvokeViaPolicy(szMethodName, &result, "lOOl", hwndOwner, obpidl, obriid, rgfInOut ? *rgfInOut : 0); Py_XDECREF(obpidl); Py_XDECREF(obriid); --- 626,630 ---- obriid = PyWinObject_FromIID(riid); PyObject *result; ! HRESULT hr=InvokeViaPolicy(szMethodName, &result, "NOOl", PyWinLong_FromHANDLE(hwndOwner), obpidl, obriid, rgfInOut ? *rgfInOut : 0); Py_XDECREF(obpidl); Py_XDECREF(obriid); *************** *** 664,668 **** oblpszName = MakeOLECHARToObj(pszName); PyObject *result; ! HRESULT hr=InvokeViaPolicy(szMethodName, &result, "lOOl", hwnd, obpidl, oblpszName, uFlags); Py_XDECREF(obpidl); Py_XDECREF(oblpszName); --- 681,685 ---- oblpszName = MakeOLECHARToObj(pszName); PyObject *result; ! HRESULT hr=InvokeViaPolicy(szMethodName, &result, "NOOl", PyWinLong_FromHANDLE(hwnd), obpidl, oblpszName, uFlags); Py_XDECREF(obpidl); Py_XDECREF(oblpszName); |
From: Roger U. <ru...@us...> - 2007-01-21 13:34:43
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9382/com/win32comext/shell/src Modified Files: PyIQueryAssociations.cpp Log Message: Fix places where handles treated as longs Index: PyIQueryAssociations.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIQueryAssociations.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PyIQueryAssociations.cpp 7 Mar 2006 05:25:33 -0000 1.4 --- PyIQueryAssociations.cpp 21 Jan 2007 13:34:42 -0000 1.5 *************** *** 31,48 **** if ( pIQA == NULL ) return NULL; ! // @pyparm int|flags|| // @pyparm string|assoc||The string data (ie, extension, prog-id, etc) ! // @pyparm <o PyHANDLE>|hkeyProgId|0| ! // @pyparm int|hwnd|0|Must be 0 ! int flags, hwnd=0, hkProgid = 0; ! PyObject *obAssoc; WCHAR *pszAssoc = NULL; ! if (!PyArg_ParseTuple(args, "lO|ll:Init", &flags, &obAssoc, &hkProgid, &hwnd)) return NULL; if (!PyWinObject_AsWCHAR(obAssoc, &pszAssoc, TRUE)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; ! hr = pIQA->Init( flags, pszAssoc, (HKEY)hkProgid, (HWND)hwnd); PyWinObject_FreeWCHAR(pszAssoc); PY_INTERFACE_POSTCALL; --- 31,54 ---- if ( pIQA == NULL ) return NULL; ! // @pyparm int|flags||One of shellcon.ASSOCF_* flags // @pyparm string|assoc||The string data (ie, extension, prog-id, etc) ! // @pyparm <o PyHKEY>|hkeyProgId|None|Root registry key, can be None ! // @pyparm <o PyHANDLE>|hwnd|None|Reserved, must be 0 or None ! int flags; ! HWND hwnd; ! HKEY hkProgid; ! PyObject *obAssoc, *obhwnd=Py_None, *obhkProgid=Py_None; WCHAR *pszAssoc = NULL; ! if (!PyArg_ParseTuple(args, "lO|OO:Init", &flags, &obAssoc, &obhkProgid, &obhwnd)) return NULL; if (!PyWinObject_AsWCHAR(obAssoc, &pszAssoc, TRUE)) return NULL; + if (!PyWinObject_AsHKEY(obhkProgid, &hkProgid, TRUE)) + return NULL; + if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwnd, TRUE)) + return NULL; HRESULT hr; PY_INTERFACE_PRECALL; ! hr = pIQA->Init( flags, pszAssoc, hkProgid, hwnd); PyWinObject_FreeWCHAR(pszAssoc); PY_INTERFACE_POSTCALL; |
From: Roger U. <ru...@us...> - 2007-01-21 12:47:51
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24246/com/win32comext/shell/src Modified Files: PyIDropTargetHelper.cpp Log Message: Fix places where HWNDs treated as longs Index: PyIDropTargetHelper.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIDropTargetHelper.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyIDropTargetHelper.cpp 26 Jan 2005 22:31:09 -0000 1.2 --- PyIDropTargetHelper.cpp 21 Jan 2007 12:47:50 -0000 1.3 *************** *** 41,55 **** if ( pIDT == NULL ) return NULL; - // @pyparm int|hwnd|| - // @pyparm <o PyIDataObject *>|pDataObj||Description for pDataObj POINT pt; PyObject *obpt; - // @pyparm (int, int)|pt||Description for pt PyObject *obpDataObj; IDataObject *pDataObj; HWND hwnd; DWORD dwEffect; ! // @pyparm int|pdwEffect||Description for pdwEffect ! if ( !PyArg_ParseTuple(args, "lOOl:DragEnter", &hwnd, &obpDataObj, &obpt, &dwEffect) ) return NULL; BOOL bPythonIsHappy = TRUE; --- 41,59 ---- if ( pIDT == NULL ) return NULL; POINT pt; PyObject *obpt; PyObject *obpDataObj; IDataObject *pDataObj; HWND hwnd; + PyObject *obhwnd; DWORD dwEffect; ! ! if (!PyArg_ParseTuple(args, "OOOl:DragEnter", ! &obhwnd, // @pyparm <o PyHANDLE>|hwnd||Handle to target window ! &obpDataObj, // @pyparm <o PyIDataObject>|pDataObj||Object that is dragged onto the window ! &obpt, // @pyparm (int, int)|pt||Coordinates where drag operation entered the window ! &dwEffect)) // @pyparm int|dwEffect||One of shellcon.DROPEFFECT_* values ! return NULL; ! if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwnd, FALSE)) return NULL; BOOL bPythonIsHappy = TRUE; *************** *** 181,185 **** obpDataObj = PyCom_PyObjectFromIUnknown(pDataObj, IID_IDataObject, TRUE); PyObject *result; ! HRESULT hr=InvokeViaPolicy("DragEnter", &result, "OOl", obpDataObj, obpt, dwEffect); Py_XDECREF(obpDataObj); Py_DECREF(obpt); --- 185,189 ---- obpDataObj = PyCom_PyObjectFromIUnknown(pDataObj, IID_IDataObject, TRUE); PyObject *result; ! HRESULT hr=InvokeViaPolicy("DragEnter", &result, "NOOl", PyWinLong_FromHANDLE(hwnd), obpDataObj, obpt, dwEffect); Py_XDECREF(obpDataObj); Py_DECREF(obpt); |
From: Roger U. <ru...@us...> - 2007-01-21 11:40:49
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2508/com/win32comext/shell/src Modified Files: PyIContextMenu.cpp Log Message: Fix HMENU treated as int, autoduck improvements Index: PyIContextMenu.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIContextMenu.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyIContextMenu.cpp 26 Jan 2005 22:31:09 -0000 1.3 --- PyIContextMenu.cpp 21 Jan 2007 11:40:40 -0000 1.4 *************** *** 25,29 **** } ! // @pymethod |PyIContextMenu|QueryContextMenu|Description of QueryContextMenu. PyObject *PyIContextMenu::QueryContextMenu(PyObject *self, PyObject *args) { --- 25,29 ---- } ! // @pymethod |PyIContextMenu|QueryContextMenu|Adds options to a context menu PyObject *PyIContextMenu::QueryContextMenu(PyObject *self, PyObject *args) { *************** *** 31,51 **** if ( pICM == NULL ) return NULL; ! // @pyparm int|hmenu||Description for hmenu ! // @pyparm int|indexMenu||Description for indexMenu ! // @pyparm int|idCmdFirst||Description for idCmdFirst ! // @pyparm int|idCmdLast||Description for idCmdLast ! // @pyparm int|uFlags||Description for uFlags ! INT hmenu; UINT indexMenu; UINT idCmdFirst; UINT idCmdLast; UINT uFlags; ! if ( !PyArg_ParseTuple(args, "iiiii:QueryContextMenu", &hmenu, &indexMenu, &idCmdFirst, &idCmdLast, &uFlags) ) return NULL; - BOOL bPythonIsHappy = TRUE; - if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; ! hr = pICM->QueryContextMenu( (HMENU)hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags ); PY_INTERFACE_POSTCALL; --- 31,52 ---- if ( pICM == NULL ) return NULL; ! HMENU hmenu; ! PyObject *obhmenu; UINT indexMenu; UINT idCmdFirst; UINT idCmdLast; UINT uFlags; ! if ( !PyArg_ParseTuple(args, "OIIII:QueryContextMenu", ! &obhmenu, // @pyparm <o PyHANDLE>|hmenu||Handle to menu to which items should be added ! &indexMenu, // @pyparm int|indexMenu||Zero-based index at which to add first item ! &idCmdFirst, // @pyparm int|idCmdFirst||Minimum menu item Id ! &idCmdLast, // @pyparm int|idCmdLast||Max menu item Id ! &uFlags)) // @pyparm int|uFlags||Combination of shellcon.CMF_* flags, can be 0 ! return NULL; ! if (!PyWinObject_AsHANDLE(obhmenu, (HANDLE *)&hmenu, FALSE)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; ! hr = pICM->QueryContextMenu(hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags ); PY_INTERFACE_POSTCALL; *************** *** 56,60 **** } ! // @pymethod |PyIContextMenu|InvokeCommand|Description of InvokeCommand. PyObject *PyIContextMenu::InvokeCommand(PyObject *self, PyObject *args) { --- 57,61 ---- } ! // @pymethod |PyIContextMenu|InvokeCommand|Executes a context menu option PyObject *PyIContextMenu::InvokeCommand(PyObject *self, PyObject *args) { *************** *** 66,72 **** if ( !PyArg_ParseTuple(args, "O:InvokeCommand", &oblpici) ) return NULL; ! BOOL bPythonIsHappy = TRUE; ! if (bPythonIsHappy && !PyObject_AsCMINVOKECOMMANDINFO( oblpici, &ci )) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; --- 67,74 ---- if ( !PyArg_ParseTuple(args, "O:InvokeCommand", &oblpici) ) return NULL; ! ! if (!PyObject_AsCMINVOKECOMMANDINFO( oblpici, ! &ci )) // @pyparm <o PyCMINVOKECOMMANDINFO>|pici||Tuple of parameters representing a CMINVOKECOMMANDINFO struct ! return NULL; HRESULT hr; PY_INTERFACE_PRECALL; *************** *** 82,86 **** } ! // @pymethod |PyIContextMenu|GetCommandString|Description of GetCommandString. PyObject *PyIContextMenu::GetCommandString(PyObject *self, PyObject *args) { --- 84,88 ---- } ! // @pymethod |PyIContextMenu|GetCommandString|Retrieves verb or help text for a context menu option PyObject *PyIContextMenu::GetCommandString(PyObject *self, PyObject *args) { *************** *** 88,98 **** if ( pICM == NULL ) return NULL; ! // @pyparm int|idCmd||Description for idCmd ! // @pyparm int|uType||Description for uType ! // @pyparm int|cchMax|2048|Description for cchMax UINT idCmd; UINT uType; UINT cchMax = 2048; ! if ( !PyArg_ParseTuple(args, "ii|i:GetCommandString", &idCmd, &uType, &cchMax) ) return NULL; --- 90,100 ---- if ( pICM == NULL ) return NULL; ! // @pyparm int|idCmd||Id of the command ! // @pyparm int|uType||One of the shellcon.GCS_* constants ! // @pyparm int|cchMax|2048|Size of buffer to create for returned string UINT idCmd; UINT uType; UINT cchMax = 2048; ! if ( !PyArg_ParseTuple(args, "II|I:GetCommandString", &idCmd, &uType, &cchMax) ) return NULL; *************** *** 118,124 **** static struct PyMethodDef PyIContextMenu_methods[] = { ! { "QueryContextMenu", PyIContextMenu::QueryContextMenu, 1 }, // @pymeth QueryContextMenu|Description of QueryContextMenu ! { "InvokeCommand", PyIContextMenu::InvokeCommand, 1 }, // @pymeth InvokeCommand|Description of InvokeCommand ! { "GetCommandString", PyIContextMenu::GetCommandString, 1 }, // @pymeth GetCommandString|Description of GetCommandString { NULL } }; --- 120,126 ---- static struct PyMethodDef PyIContextMenu_methods[] = { ! { "QueryContextMenu", PyIContextMenu::QueryContextMenu, 1 }, // @pymeth QueryContextMenu|Adds options to a context menu ! { "InvokeCommand", PyIContextMenu::InvokeCommand, 1 }, // @pymeth InvokeCommand|Executes a context menu option ! { "GetCommandString", PyIContextMenu::GetCommandString, 1 }, // @pymeth GetCommandString|Retrieves verb or help text for a context menu option { NULL } }; *************** *** 141,145 **** PY_GATEWAY_METHOD; PyObject *ret; ! HRESULT hr=InvokeViaPolicy("QueryContextMenu", &ret, "iiiii", hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags); if (FAILED(hr)) return hr; if (PyInt_Check(ret)) --- 143,147 ---- PY_GATEWAY_METHOD; PyObject *ret; ! HRESULT hr=InvokeViaPolicy("QueryContextMenu", &ret, "NIIII", PyWinLong_FromHANDLE(hmenu), indexMenu, idCmdFirst, idCmdLast, uFlags); if (FAILED(hr)) return hr; if (PyInt_Check(ret)) *************** *** 168,172 **** PyObject *result; PY_GATEWAY_METHOD; ! HRESULT hr=InvokeViaPolicy("GetCommandString", &result, "ii", idCmd, uFlags); if (FAILED(hr)) return hr; --- 170,174 ---- PyObject *result; PY_GATEWAY_METHOD; ! HRESULT hr=InvokeViaPolicy("GetCommandString", &result, "II", idCmd, uFlags); if (FAILED(hr)) return hr; |
From: Roger U. <ru...@us...> - 2007-01-21 02:36:33
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22649/com/win32comext/shell/src Modified Files: PyIShellLink.cpp Log Message: Fix place where HWND treated as long Index: PyIShellLink.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIShellLink.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PyIShellLink.cpp 1 Jun 2006 10:23:05 -0000 1.7 --- PyIShellLink.cpp 21 Jan 2007 02:36:31 -0000 1.8 *************** *** 475,480 **** HWND hwnd; DWORD fFlags; ! if ( !PyArg_ParseTuple(args, "ll:Resolve", &hwnd, &fFlags) ) return NULL; HRESULT hr; --- 475,483 ---- HWND hwnd; + PyObject *obhwnd; DWORD fFlags; ! if ( !PyArg_ParseTuple(args, "Ol:Resolve", &obhwnd, &fFlags) ) ! return NULL; ! if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwnd, TRUE)) return NULL; HRESULT hr; |
From: Roger U. <ru...@us...> - 2007-01-20 23:33:30
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19137/win32/src Modified Files: win32pdhmodule.cpp Log Message: Fix place where HANDLE treated as long Index: win32pdhmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32pdhmodule.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** win32pdhmodule.cpp 20 Jan 2007 17:44:26 -0000 1.13 --- win32pdhmodule.cpp 20 Jan 2007 23:33:29 -0000 1.14 *************** *** 470,474 **** return PyWin_SetAPIError("AddCounter", pdhStatus); // @comm See also <om win32pdh.RemoveCounter> ! return PyInt_FromLong((long)hCounter); } --- 470,474 ---- return PyWin_SetAPIError("AddCounter", pdhStatus); // @comm See also <om win32pdh.RemoveCounter> ! return PyWinLong_FromHANDLE(hCounter); } |
From: Roger U. <ru...@us...> - 2007-01-20 22:54:51
|
Update of /cvsroot/pywin32/pywin32/win32/Demos In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4706/win32/Demos Modified Files: desktopmanager.py Log Message: Close menu handle Index: desktopmanager.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/desktopmanager.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** desktopmanager.py 3 Jul 2006 11:49:09 -0000 1.1 --- desktopmanager.py 20 Jan 2007 22:54:50 -0000 1.2 *************** *** 127,130 **** --- 127,131 ---- x,y, 0, hwnd, None) win32gui.PumpWaitingMessages() + win32gui.DestroyMenu(m) if d==desktop_cnt+1: ## Create new get_new_desktop_name(hwnd) |
From: Roger U. <ru...@us...> - 2007-01-20 22:46:31
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1387/com/win32comext/shell/src Modified Files: PyICopyHook.cpp Log Message: Fix place where HWND treated as int Check if destFile is NULL CopyCallback return value type check always failed Index: PyICopyHook.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyICopyHook.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyICopyHook.cpp 26 Jan 2005 22:31:09 -0000 1.2 --- PyICopyHook.cpp 20 Jan 2007 22:46:30 -0000 1.3 *************** *** 41,44 **** --- 41,45 ---- PyObject *obdestFile; HWND hwnd; + PyObject *obhwnd; UINT wFunc; UINT wFlags; *************** *** 47,51 **** LPTSTR destFile; DWORD destAttribs; ! if ( !PyArg_ParseTuple(args, "liiOlOl:CopyCallback", &hwnd, &wFunc, &wFlags, &obsrcFile, &srcAttribs, &obdestFile, &destAttribs) ) return NULL; BOOL bPythonIsHappy = TRUE; --- 48,54 ---- LPTSTR destFile; DWORD destAttribs; ! if ( !PyArg_ParseTuple(args, "OiiOlOl:CopyCallback", &obhwnd, &wFunc, &wFlags, &obsrcFile, &srcAttribs, &obdestFile, &destAttribs) ) ! return NULL; ! if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwnd, FALSE)) return NULL; BOOL bPythonIsHappy = TRUE; *************** *** 96,110 **** PyObject *obdestFile; obsrcFile = PyWinObject_FromTCHAR((LPTSTR)srcFile); ! obdestFile = PyWinObject_FromTCHAR((LPTSTR)destFile); PyObject *result; ! HRESULT hr=InvokeViaPolicy("CopyCallback", &result, "liiOlOl", hwnd, wFunc, wFlags, obsrcFile, srcAttribs, obdestFile, destAttribs); Py_XDECREF(obsrcFile); Py_XDECREF(obdestFile); if (FAILED(hr)) return hr; ! if (!PyInt_Check(result) || !PyLong_Check(result)) { ! PyErr_Format(PyExc_TypeError, "CopyCallBack should return an int, not a '%s'", result->ob_type->tp_name); hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("CopyCallBack"); - } else - hr = PyInt_AsLong(result); Py_DECREF(result); return hr; --- 99,117 ---- PyObject *obdestFile; obsrcFile = PyWinObject_FromTCHAR((LPTSTR)srcFile); ! // Dest file can be NULL for FO_DELETE ! if (destFile!=NULL) ! obdestFile = PyWinObject_FromTCHAR((LPTSTR)destFile); ! else{ ! obdestFile=Py_None; ! Py_INCREF(Py_None); ! } PyObject *result; ! HRESULT hr=InvokeViaPolicy("CopyCallback", &result, "NiiOlOl", PyWinLong_FromHANDLE(hwnd), wFunc, wFlags, obsrcFile, srcAttribs, obdestFile, destAttribs); Py_XDECREF(obsrcFile); Py_XDECREF(obdestFile); if (FAILED(hr)) return hr; ! hr = PyInt_AsLong(result); ! if ((hr==-1) && PyErr_Occurred()) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("CopyCallBack"); Py_DECREF(result); return hr; |
From: Roger U. <ru...@us...> - 2007-01-20 18:56:16
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9354/win32/src Modified Files: win2krasmodule.cpp Log Message: Fix place where HWND was treated as an int Index: win2krasmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win2krasmodule.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** win2krasmodule.cpp 27 Oct 2001 06:22:10 -0000 1.4 --- win2krasmodule.cpp 20 Jan 2007 18:56:13 -0000 1.5 *************** *** 134,139 **** char *phoneBook, *entry; int flags; ! int hwnd = 0; ! if (!PyArg_ParseTuple(args, "zsi|i:GetEapUserIdentity", &phoneBook, // @pyparm string|phoneBook||string containing the full path of the phone-book (PBK) file. If this parameter is None, the function will use the system phone book. &entry,// @pyparm string|entry||string containing an existing entry name. --- 134,140 ---- char *phoneBook, *entry; int flags; ! HWND hwnd; ! PyObject *obhwnd=Py_None; ! if (!PyArg_ParseTuple(args, "zsi|O:GetEapUserIdentity", &phoneBook, // @pyparm string|phoneBook||string containing the full path of the phone-book (PBK) file. If this parameter is None, the function will use the system phone book. &entry,// @pyparm string|entry||string containing an existing entry name. *************** *** 143,148 **** // @flag RASEAPF_Logon|Specifies that the user data is obtained from Winlogon. // @flag RASEAPF_Preview|Specifies that the user should be prompted for identity information before dialing. ! &hwnd)) // @pyparm int|hwnd|0|Handle to the parent window for the UI dialog. ! return NULL; --- 144,150 ---- // @flag RASEAPF_Logon|Specifies that the user data is obtained from Winlogon. // @flag RASEAPF_Preview|Specifies that the user should be prompted for identity information before dialing. ! &obhwnd)) // @pyparm <o PyHANDLE>|hwnd|None|Handle to the parent window for the UI dialog. ! return NULL; ! if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwnd, TRUE)) return NULL; *************** *** 151,155 **** RASEAPUSERIDENTITY *identity; Py_BEGIN_ALLOW_THREADS ! rc = RasGetEapUserIdentity(phoneBook, entry, flags, (HWND)hwnd, &identity); Py_END_ALLOW_THREADS if (rc != 0) --- 153,157 ---- RASEAPUSERIDENTITY *identity; Py_BEGIN_ALLOW_THREADS ! rc = RasGetEapUserIdentity(phoneBook, entry, flags, hwnd, &identity); Py_END_ALLOW_THREADS if (rc != 0) |
From: Roger U. <ru...@us...> - 2007-01-20 17:44:27
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13775/win32/src Modified Files: win32pdhmodule.cpp Log Message: Change places where Query and Counter handles treated as ints Index: win32pdhmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32pdhmodule.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** win32pdhmodule.cpp 1 Nov 2006 15:47:39 -0000 1.12 --- win32pdhmodule.cpp 20 Jan 2007 17:44:26 -0000 1.13 *************** *** 443,454 **** { HQUERY hQuery; PyObject *obPath; DWORD userData = 0; ! if (!PyArg_ParseTuple(args, "iO|i:AddCounter", ! &hQuery, // @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; ! TCHAR *szPath; if (!PyWinObject_AsTCHAR(obPath, &szPath, FALSE)) --- 443,456 ---- { HQUERY hQuery; + 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, FALSE)) ! return NULL; TCHAR *szPath; if (!PyWinObject_AsTCHAR(obPath, &szPath, FALSE)) *************** *** 475,480 **** { HQUERY handle; ! if (!PyArg_ParseTuple(args, "i:RemoveCounter", ! &handle)) // @pyparm int|handle||Handle to an open counter. return NULL; // @comm See also <om win32pdh.AddCounter> --- 477,485 ---- { HQUERY handle; ! PyObject *obhandle; ! if (!PyArg_ParseTuple(args, "O:RemoveCounter", ! &obhandle)) // @pyparm int|handle||Handle to an open counter. ! return NULL; ! if (!PyWinObject_AsHANDLE(obhandle, &handle, FALSE)) return NULL; // @comm See also <om win32pdh.AddCounter> *************** *** 513,517 **** if (pdhStatus != ERROR_SUCCESS) return PyWin_SetAPIError("OpenQuery", pdhStatus); ! return PyInt_FromLong((long)hQuery); // @comm See also <om win32pdh.CloseQuery> } --- 518,522 ---- if (pdhStatus != ERROR_SUCCESS) return PyWin_SetAPIError("OpenQuery", pdhStatus); ! return PyWinLong_FromHANDLE(hQuery); // @comm See also <om win32pdh.CloseQuery> } *************** *** 521,526 **** { HQUERY handle; ! if (!PyArg_ParseTuple(args, "i:CloseQuery", ! &handle)) // @pyparm int|handle||Handle to an open query. return NULL; // @comm See also <om win32pdh.OpenQuery> --- 526,534 ---- { HQUERY handle; ! PyObject *obhandle; ! if (!PyArg_ParseTuple(args, "O:CloseQuery", ! &obhandle)) // @pyparm int|handle||Handle to an open query. ! return NULL; ! if (!PyWinObject_AsHANDLE(obhandle, &handle, FALSE)) return NULL; // @comm See also <om win32pdh.OpenQuery> *************** *** 615,623 **** { HCOUNTER handle; BOOL bExplainText = TRUE; ! if (!PyArg_ParseTuple(args, "i|i:GetCounterInfo", ! &handle, // @pyparm int|handle||The handle of the item to query &bExplainText)) // @pyparm int|bRetrieveExplainText||Should explain text be retrieved? return NULL; // First call to get buffer size DWORD bufSize = 0; --- 623,634 ---- { HCOUNTER handle; + PyObject *obhandle; BOOL bExplainText = TRUE; ! if (!PyArg_ParseTuple(args, "O|i:GetCounterInfo", ! &obhandle, // @pyparm int|handle||The handle of the item to query &bExplainText)) // @pyparm int|bRetrieveExplainText||Should explain text be retrieved? return NULL; + if (!PyWinObject_AsHANDLE(obhandle, &handle, FALSE)) + return NULL; // First call to get buffer size DWORD bufSize = 0; *************** *** 675,684 **** { HCOUNTER handle; DWORD format; ! if (!PyArg_ParseTuple(args, "ii:GetFormattedCounterValue", ! &handle, // @pyparm int|handle||Handle to the counter &format)) // @pyparm int|format||Format of result. Can be PDH_FMT_DOUBLE, PDH_FMT_LARGE, PDH_FMT_LONG and or'd with PDH_FMT_NOSCALE, PDH_FMT_1000 return NULL; DWORD type; PDH_FMT_COUNTERVALUE result; --- 686,698 ---- { HCOUNTER handle; + PyObject *obhandle; DWORD format; ! if (!PyArg_ParseTuple(args, "Oi:GetFormattedCounterValue", ! &obhandle, // @pyparm int|handle||Handle to the counter &format)) // @pyparm int|format||Format of result. Can be PDH_FMT_DOUBLE, PDH_FMT_LARGE, PDH_FMT_LONG and or'd with PDH_FMT_NOSCALE, PDH_FMT_1000 return NULL; + if (!PyWinObject_AsHANDLE(obhandle, &handle, FALSE)) + return NULL; DWORD type; PDH_FMT_COUNTERVALUE result; *************** *** 712,719 **** { HQUERY hQuery; ! if (!PyArg_ParseTuple(args, "i:CollectQueryData", ! &hQuery)) // @pyparm int|hQuery||Handle to an open query. return NULL; - CHECK_PDH_PTR(pPdhCollectQueryData); PDH_STATUS pdhStatus; --- 726,735 ---- { HQUERY hQuery; ! PyObject *obhQuery; ! if (!PyArg_ParseTuple(args, "O:CollectQueryData", ! &obhQuery)) // @pyparm int|hQuery||Handle to an open query. ! return NULL; ! if (!PyWinObject_AsHANDLE(obhQuery, &hQuery, FALSE)) return NULL; CHECK_PDH_PTR(pPdhCollectQueryData); PDH_STATUS pdhStatus; *************** *** 872,881 **** { HCOUNTER hCounter; LONG lFactor; ! if (!PyArg_ParseTuple(args, "il:SetCounterScaleFactor", ! &hCounter, // @pyparm int|hCounter||Handle to the counter. &lFactor)) // @pyparm int|factor||power of ten used to multiply value. return NULL; ! CHECK_PDH_PTR(pPdhSetCounterScaleFactor); PyW32_BEGIN_ALLOW_THREADS --- 888,899 ---- { HCOUNTER hCounter; + PyObject *obhCounter; LONG lFactor; ! if (!PyArg_ParseTuple(args, "Ol:SetCounterScaleFactor", ! &obhCounter, // @pyparm int|hCounter||Handle to the counter. &lFactor)) // @pyparm int|factor||power of ten used to multiply value. return NULL; ! if (!PyWinObject_AsHANDLE(obhCounter, &hCounter, FALSE)) ! return NULL; CHECK_PDH_PTR(pPdhSetCounterScaleFactor); PyW32_BEGIN_ALLOW_THREADS *************** *** 926,930 **** static PyObject *PyBrowseCounters(PyObject *self, PyObject *args) { ! PyObject *obFlags; PDH_BROWSE_DLG_CONFIG cfg; PDH_BROWSE_DLG_CONFIG *pcfg = &cfg; --- 944,948 ---- static PyObject *PyBrowseCounters(PyObject *self, PyObject *args) { ! PyObject *obFlags, *obhwnd; PDH_BROWSE_DLG_CONFIG cfg; PDH_BROWSE_DLG_CONFIG *pcfg = &cfg; *************** *** 932,943 **** // Note - this has set caption and others to default of zero. memset(&cfg, 0, sizeof(cfg)); ! if (!PyArg_ParseTuple(args, "OiOi|z:BrowseCounters", &obFlags, // @pyparm tuple|flags||Tuple describing the bitmasks, or None. ! &pcfg->hWndOwner, // @pyparm int|hWnd||parent for the dialog. &myCfg.func, // @pyparm object|callback||A callable object to function as the callback. &pcfg->dwDefaultDetailLevel, // @pyparm int|defDetailLevel||The default detail level to show on startup in the Detail Level combo box. If the Detail Level combo box is not shown, this is the detail level to use in filtering the displayed performance counters and objects. &pcfg->szDialogBoxCaption)) // @pyparm string|dlgCaption||The dialog coption, or None for default. return NULL; ! if (!PyCallable_Check(myCfg.func)) { PyErr_SetString(PyExc_TypeError, "The callback object must be a callable object"); --- 950,962 ---- // Note - this has set caption and others to default of zero. memset(&cfg, 0, sizeof(cfg)); ! if (!PyArg_ParseTuple(args, "OOOi|z:BrowseCounters", &obFlags, // @pyparm tuple|flags||Tuple describing the bitmasks, or None. ! &obhwnd, // @pyparm <o PyHANDLE>|hWnd||parent for the dialog. &myCfg.func, // @pyparm object|callback||A callable object to function as the callback. &pcfg->dwDefaultDetailLevel, // @pyparm int|defDetailLevel||The default detail level to show on startup in the Detail Level combo box. If the Detail Level combo box is not shown, this is the detail level to use in filtering the displayed performance counters and objects. &pcfg->szDialogBoxCaption)) // @pyparm string|dlgCaption||The dialog coption, or None for default. return NULL; ! if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&pcfg->hWndOwner, FALSE)) ! return NULL; if (!PyCallable_Check(myCfg.func)) { PyErr_SetString(PyExc_TypeError, "The callback object must be a callable object"); |
From: Roger U. <ru...@us...> - 2007-01-19 23:05:33
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15762/win32/src Modified Files: PyOVERLAPPED.cpp Log Message: Fix places where HANDLEs treated as longs Return -1 when setting an attribute fails Index: PyOVERLAPPED.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyOVERLAPPED.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PyOVERLAPPED.cpp 22 Sep 2006 14:31:32 -0000 1.11 --- PyOVERLAPPED.cpp 19 Jan 2007 23:05:30 -0000 1.12 *************** *** 141,145 **** return pO->m_obHandle; } ! return PyInt_FromLong((long)pO->m_overlapped.hEvent); } // @prop object|object|Any python object that you want to attach to your overlapped I/O request. --- 141,145 ---- return pO->m_obHandle; } ! return PyWinLong_FromHANDLE(pO->m_overlapped.hEvent); } // @prop object|object|Any python object that you want to attach to your overlapped I/O request. *************** *** 173,185 **** if (strcmp("hEvent", name)==0) { PyOVERLAPPED *pO = (PyOVERLAPPED *)self; Py_XDECREF(pO->m_obHandle); - pO->m_obHandle = NULL; if (PyHANDLE_Check(v)) { pO->m_obHandle = v; - PyWinObject_AsHANDLE(v, &pO->m_overlapped.hEvent, FALSE); Py_INCREF(v); ! } else if (PyInt_Check(v)) { ! pO->m_overlapped.hEvent = (HANDLE)PyInt_AsLong(v); ! } return 0; } --- 173,188 ---- if (strcmp("hEvent", name)==0) { PyOVERLAPPED *pO = (PyOVERLAPPED *)self; + // Use an intermediate so the original isn't lost if conversion fails + HANDLE htmp; + if (!PyWinObject_AsHANDLE(v, &htmp, FALSE)) + return -1; + pO->m_overlapped.hEvent=htmp; Py_XDECREF(pO->m_obHandle); if (PyHANDLE_Check(v)) { pO->m_obHandle = v; Py_INCREF(v); ! } ! else ! pO->m_obHandle = NULL; return 0; } *************** *** 195,202 **** { PyOVERLAPPED *pO = (PyOVERLAPPED *)self; ! PyErr_Clear(); ! pO->m_overlapped.dwValue = PyInt_AsLong(v); ! if (PyErr_Occurred()) ! PyErr_SetString(PyExc_TypeError, "The 'dword' value must be an integer"); return 0; } --- 198,205 ---- { PyOVERLAPPED *pO = (PyOVERLAPPED *)self; ! DWORD dwordtmp=PyInt_AsLong(v); ! if ((dwordtmp==(DWORD)-1) && PyErr_Occurred()) ! return -1; ! pO->m_overlapped.dwValue=dwordtmp; return 0; } |
From: Roger U. <ru...@us...> - 2007-01-17 19:13:50
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13520/com/win32com/src Modified Files: PythonCOM.cpp Log Message: Fix places where HWNDs treated as longs Index: PythonCOM.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PythonCOM.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** PythonCOM.cpp 30 Aug 2006 10:28:25 -0000 1.41 --- PythonCOM.cpp 17 Jan 2007 19:13:46 -0000 1.42 *************** *** 1563,1570 **** PyObject *obd; HWND hwnd; ! if (!PyArg_ParseTuple(args, "lO:RegisterDragDrop", &hwnd, &obd)) return NULL; ! // @pyparm long|hwnd|| ! // @pyparm <o PyIDropTarget>|dropTarget|| IDropTarget *dt; if (!PyCom_InterfaceFromPyObject(obd, IID_IDropTarget, (void**)&dt, FALSE)) --- 1563,1573 ---- PyObject *obd; HWND hwnd; ! PyObject *obhwnd; ! if (!PyArg_ParseTuple(args, "OO:RegisterDragDrop", &obhwnd, &obd)) return NULL; ! if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwnd, FALSE)) ! return NULL; ! // @pyparm <o PyHANDLE>|hwnd||Handle to a window ! // @pyparm <o PyIDropTarget>|dropTarget||Object that implements the IDropTarget interface IDropTarget *dt; if (!PyCom_InterfaceFromPyObject(obd, IID_IDropTarget, (void**)&dt, FALSE)) *************** *** 1589,1594 **** { HWND hwnd; ! // @pyparm long|hwnd|| ! if (!PyArg_ParseTuple(args, "l:RevokeDragDrop", &hwnd)) return NULL; HRESULT hr; --- 1592,1600 ---- { HWND hwnd; ! PyObject *obhwnd; ! // @pyparm <o PyHANDLE>|hwnd||Handle to a window registered as an OLE drop target. ! if (!PyArg_ParseTuple(args, "O:RevokeDragDrop", &obhwnd)) ! return NULL; ! if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwnd, FALSE)) return NULL; HRESULT hr; |
From: Roger U. <ru...@us...> - 2007-01-17 15:00:20
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/authorization/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8288/com/win32comext/authorization/src Modified Files: PyGSecurityInformation.cpp Log Message: Fix place where HWND treated as a long Index: PyGSecurityInformation.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/authorization/src/PyGSecurityInformation.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyGSecurityInformation.cpp 20 Mar 2006 03:11:19 -0000 1.2 --- PyGSecurityInformation.cpp 17 Jan 2007 15:00:15 -0000 1.3 *************** *** 376,380 **** { PY_GATEWAY_METHOD; ! return InvokeViaPolicy("PropertySheetPageCallback", NULL, "lkk", hwnd, uMsg, uPage); } --- 376,380 ---- { PY_GATEWAY_METHOD; ! return InvokeViaPolicy("PropertySheetPageCallback", NULL, "Nkk", PyWinLong_FromHANDLE(hwnd), uMsg, uPage); } |
From: Roger U. <ru...@us...> - 2007-01-17 14:33:44
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29235/win32/src Modified Files: win32file.i Log Message: Fix place where HWND treated as a long Index: win32file.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32file.i,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** win32file.i 6 Jan 2007 19:30:53 -0000 1.68 --- win32file.i 17 Jan 2007 14:33:42 -0000 1.69 *************** *** 2193,2197 **** ( SOCKET *s, ! LONG hwnd, LONG wMsg, LONG lNetworkEvents --- 2193,2197 ---- ( SOCKET *s, ! HWND hwnd, LONG wMsg, LONG lNetworkEvents *************** *** 2200,2204 **** int rc; Py_BEGIN_ALLOW_THREADS; ! rc = WSAAsyncSelect(*s, (HWND)hwnd, wMsg, lNetworkEvents); Py_END_ALLOW_THREADS; if (rc == SOCKET_ERROR) --- 2200,2204 ---- int rc; Py_BEGIN_ALLOW_THREADS; ! rc = WSAAsyncSelect(*s, hwnd, wMsg, lNetworkEvents); Py_END_ALLOW_THREADS; if (rc == SOCKET_ERROR) *************** *** 2217,2221 **** ( SOCKET *s, // @pyparm <o PySocket>|socket||socket to attach to the event ! LONG hwnd, // @pyparm <o hwnd>|hwnd||Window handle for the socket to become attached to. LONG wMsg, // @pyparm <o int>|int||Window message that will be posted. LONG lNetworkEvents // @pyparm int|networkEvents||A bitmask of network events that will cause wMsg to be posted. e.g. (FD_CLOSE \| FD_READ) --- 2217,2221 ---- ( SOCKET *s, // @pyparm <o PySocket>|socket||socket to attach to the event ! HWND hwnd, // @pyparm <o hwnd>|hwnd||Window handle for the socket to become attached to. LONG wMsg, // @pyparm <o int>|int||Window message that will be posted. LONG lNetworkEvents // @pyparm int|networkEvents||A bitmask of network events that will cause wMsg to be posted. e.g. (FD_CLOSE \| FD_READ) |
From: Roger U. <ru...@us...> - 2007-01-17 13:55:11
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12402/com/win32comext/shell/src Modified Files: PyIActiveDesktop.cpp Log Message: Fix places where HWNDs treated as longs Index: PyIActiveDesktop.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIActiveDesktop.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyIActiveDesktop.cpp 7 Apr 2006 06:04:41 -0000 1.2 --- PyIActiveDesktop.cpp 17 Jan 2007 13:55:04 -0000 1.3 *************** *** 472,484 **** if ( pIAD == NULL ) return NULL; ! PyObject *obcomp; COMPONENT comp; DWORD flags; HWND hwnd; ! if (!PyArg_ParseTuple(args, "lOk:AddDesktopItemWithUI", ! &hwnd, // @pyparm <o PyHANDLE>|hwnd||Handle to parent window &obcomp, // @pyparm dict|comp||<o COMPONENT> dictionary &flags)) // @pyparm int|Flags||One of shellcon.DTI_ADDUI_* flags return NULL; if (!PyWinObject_AsCOMPONENT(obcomp, &comp)) return NULL; --- 472,486 ---- if ( pIAD == NULL ) return NULL; ! PyObject *obcomp, *obhwnd; COMPONENT comp; DWORD flags; HWND hwnd; ! if (!PyArg_ParseTuple(args, "OOk:AddDesktopItemWithUI", ! &obhwnd, // @pyparm <o PyHANDLE>|hwnd||Handle to parent window &obcomp, // @pyparm dict|comp||<o COMPONENT> dictionary &flags)) // @pyparm int|Flags||One of shellcon.DTI_ADDUI_* flags return NULL; + if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwnd, TRUE)) + return NULL; if (!PyWinObject_AsCOMPONENT(obcomp, &comp)) return NULL; *************** *** 657,670 **** return NULL; HWND hwnd; ! PyObject *obcomp, *obSource; WCHAR *Source=NULL; COMPONENT comp; DWORD flags; ! if ( !PyArg_ParseTuple(args, "lOOk:AddUrl", ! &hwnd, // @pyparm <o PyHANDLE>|hwnd||Parent windows for any user interactive &obSource, // @pyparm <o PyUNICODE>|Source||Source URL &obcomp, // @pyparm dict|comp||<o COMPONENT> dictionary &flags)) // @pyparm int|Flags||ADDURL_SILENT, or 0 return NULL; if (!PyWinObject_AsCOMPONENT(obcomp, &comp)) return NULL; --- 659,674 ---- return NULL; HWND hwnd; ! PyObject *obcomp, *obSource, *obhwnd; WCHAR *Source=NULL; COMPONENT comp; DWORD flags; ! if ( !PyArg_ParseTuple(args, "OOOk:AddUrl", ! &obhwnd, // @pyparm <o PyHANDLE>|hwnd||Parent windows for any user interactive &obSource, // @pyparm <o PyUNICODE>|Source||Source URL &obcomp, // @pyparm dict|comp||<o COMPONENT> dictionary &flags)) // @pyparm int|Flags||ADDURL_SILENT, or 0 return NULL; + if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwnd, TRUE)) + return NULL; if (!PyWinObject_AsCOMPONENT(obcomp, &comp)) return NULL; |
From: Roger U. <ru...@us...> - 2007-01-17 13:33:26
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/taskscheduler/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3947/com/win32comext/taskscheduler/src Modified Files: PyIScheduledWorkItem.cpp Log Message: Fix place where HWND treated as a long Index: PyIScheduledWorkItem.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/taskscheduler/src/PyIScheduledWorkItem.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyIScheduledWorkItem.cpp 28 Apr 2004 05:21:44 -0000 1.2 --- PyIScheduledWorkItem.cpp 17 Jan 2007 13:33:25 -0000 1.3 *************** *** 305,313 **** if ( pISWI == NULL ) return NULL; ! // @pyparm HWND|hParent||Reserved, use 0 if passed // @pyparm int|dwReserved||Reserved, use 0 if passed HWND hParent=NULL; DWORD dwReserved=0; ! if (!PyArg_ParseTuple(args, "|ll:PyIScheduledWorkItem::EditWorkItem", &hParent, &dwReserved)) return NULL; HRESULT hr; --- 305,316 ---- if ( pISWI == NULL ) return NULL; ! // @pyparm <o PyHANDLE>|hParent||Reserved, use 0 or None if passed // @pyparm int|dwReserved||Reserved, use 0 if passed HWND hParent=NULL; + PyObject *obhParent=Py_None; DWORD dwReserved=0; ! if (!PyArg_ParseTuple(args, "|Ol:PyIScheduledWorkItem::EditWorkItem", &obhParent, &dwReserved)) ! return NULL; ! if (!PyWinObject_AsHANDLE(obhParent, (HANDLE *)&hParent, TRUE)) return NULL; HRESULT hr; |
From: Mark H. <mha...@us...> - 2007-01-17 04:40:57
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29250 Modified Files: setup.py Log Message: pyisapi now includes message resources for writing to the event log. Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** setup.py 23 Sep 2006 00:31:53 -0000 1.52 --- setup.py 17 Jan 2007 04:40:56 -0000 1.53 *************** *** 1,3 **** ! build_id="210" # may optionally include a ".{patchno}" suffix. # Putting buildno at the top prevents automatic __doc__ assignment, and # I *want* the build number at the top :) --- 1,3 ---- ! build_id="210.1" # may optionally include a ".{patchno}" suffix. # Putting buildno at the top prevents automatic __doc__ assignment, and # I *want* the build number at the top :) *************** *** 1275,1280 **** sources=[os.path.join("isapi", "src", s) for s in """PyExtensionObjects.cpp PyFilterObjects.cpp ! pyISAPI.cpp PythonEng.cpp StdAfx.cpp ! Utils.cpp """.split()], pch_header = "StdAfx.h", --- 1275,1280 ---- sources=[os.path.join("isapi", "src", s) for s in """PyExtensionObjects.cpp PyFilterObjects.cpp ! pyISAPI.cpp pyISAPI_messages.mc ! PythonEng.cpp StdAfx.cpp Utils.cpp """.split()], pch_header = "StdAfx.h", *************** *** 1283,1287 **** TerminateExtension GetFilterVersion HttpFilterProc TerminateFilter ! PyISAPISetOptions""".split(), ) ) --- 1283,1289 ---- TerminateExtension GetFilterVersion HttpFilterProc TerminateFilter ! PyISAPISetOptions WriteEventLogMessage ! """.split(), ! libraries='advapi32', ) ) |
From: Mark H. <mha...@us...> - 2007-01-17 04:40:14
|
Update of /cvsroot/pywin32/pywin32/isapi/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28773 Modified Files: PythonEng.cpp Utils.cpp Utils.h Added Files: .cvsignore pyISAPI_messages.mc Log Message: Write filter and extension errors to the event log - ones that happen while Python is initializing are otherwise impossible to debug --- NEW FILE: .cvsignore --- pyISAPI_messages.h Index: Utils.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/Utils.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Utils.cpp 26 Oct 2004 01:30:57 -0000 1.2 --- Utils.cpp 17 Jan 2007 04:40:12 -0000 1.3 *************** *** 29,32 **** --- 29,36 ---- extern HINSTANCE g_hInstance; + static bool g_bRegisteredEventSource = false; + + static WCHAR *source_name = L"ISAPI Filter or Extension"; + // returns the pathname of this module *************** *** 91,92 **** --- 95,162 ---- return result; } + + // register the event source with the event log. + static void CheckRegisterEventSourceFile() + { + WCHAR mod_name[MAX_PATH] = L""; + if (g_bRegisteredEventSource) + return; + + GetModuleFileNameW(g_hInstance, mod_name, + sizeof mod_name/sizeof WCHAR); + if (!mod_name[0]) { + OutputDebugString("GetModuleFileNameW failed!"); + return; + } + + HKEY hkey; + WCHAR keyName[MAX_PATH]; + + wcscpy(keyName, L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\"); + wcscat(keyName, source_name); + + BOOL rc = FALSE; + if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, + keyName, + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_WRITE, NULL, + &hkey, + NULL) == ERROR_SUCCESS) { + RegSetValueExW(hkey, L"EventMessageFile", 0, REG_SZ, + (const BYTE *)mod_name, + wcslen(mod_name)*sizeof(WCHAR)); + DWORD types = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE; + RegSetValueExW(hkey, L"TypesSupported", 0, REG_DWORD, + (const BYTE *)&types, sizeof(types)); + RegCloseKey(hkey); + } + g_bRegisteredEventSource = true; + } + + // Write stuff to the event log. + BOOL WriteEventLogMessage(WORD eventType, DWORD eventID, WORD num_inserts, + const char **inserts) + { + BOOL ok = FALSE; + HANDLE hEventSource; + + CheckRegisterEventSourceFile(); + + hEventSource = RegisterEventSourceW(NULL, source_name); + if (hEventSource) { + ReportEvent(hEventSource, // handle of event source + eventType, // event type + 0, // event category + eventID, // event ID + NULL, // current user's SID + num_inserts, // strings in lpszStrings + 0, // no bytes of raw data + inserts, // array of error strings + NULL); // no raw data + DeregisterEventSource(hEventSource); + ok = TRUE; + } + return ok; + } Index: PythonEng.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/PythonEng.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PythonEng.cpp 11 Oct 2006 07:55:10 -0000 1.4 --- PythonEng.cpp 17 Jan 2007 04:40:12 -0000 1.5 *************** *** 32,35 **** --- 32,36 ---- #include "pyExtensionObjects.h" #include "pyFilterObjects.h" + #include "pyISAPI_messages.h" extern HINSTANCE g_hInstance; *************** *** 375,378 **** --- 376,382 ---- } } + const char *inserts[] = {errmsg, windows_error ? windows_error : "n/a"}; + WriteEventLogMessage(EVENTLOG_ERROR_TYPE, E_PYISAPI_EXTENSION_FAILED, + 2, inserts); if (windows_error) free(windows_error); *************** *** 381,384 **** --- 385,391 ---- void FilterError(CFilterContext *pfc, LPCTSTR errmsg) { + char *windows_error = ::GetLastError() ? + ::FormatSysError(::GetLastError()) : NULL; + CEnterLeavePython celp; PySys_WriteStderr("Internal Filter Error: %s\n", errmsg); *************** *** 387,390 **** --- 394,402 ---- PyErr_Clear(); } + const char *inserts[] = {errmsg, windows_error ? windows_error : "n/a"}; + WriteEventLogMessage(EVENTLOG_ERROR_TYPE, E_PYISAPI_FILTER_FAILED, + 2, inserts); + if (windows_error) + free(windows_error); // what else to do here? AddResponseHeaders->WriteClient? } --- NEW FILE: pyISAPI_messages.mc --- ; /* MessageIdTypedef=DWORD ;------------------------------------------------------------------------- ; MESSAGE DEFINITION SECTION ; ; Following the header section is the body of the Message Compiler ; source file. The body consists of zero or more message definitions. ; Each message definition begins with one or more of the following ; statements: ; ; MessageId = [number|+number] ; Severity = severity_name ; Facility = facility_name ; SymbolicName = name ; ; The MessageId statement marks the beginning of the message ; definition. A MessageID statement is required for each message, ; although the value is optional. If no value is specified, the value ; used is the previous value for the facility plus one. If the value ; is specified as +number then the value used is the previous value ; for the facility, plus the number after the plus sign. Otherwise, if ; a numeric value is given, that value is used. Any MessageId value ; that does not fit in 16 bits is an error. ; ; The Severity and Facility statements are optional. These statements ; specify additional bits to OR into the final 32-bit message code. If ; not specified they default to the value last specified for a message ; definition. The initial values prior to processing the first message ; definition are: ; ; Severity=Success ; Facility=Application ; ; The value associated with Severity and Facility must match one of ; the names given in the FacilityNames and SeverityNames statements in ; the header section. The SymbolicName statement allows you to ; associate a C/C++ symbolic constant with the final 32-bit message ; code. ; */ ; // For the sake of keeping common message-IDs with the pywin32 service ; // modules etc, we keep these generic messages MessageId=0xFF Severity=Error SymbolicName=PYS_E_GENERIC_ERROR Language=English %1 . MessageId=0xFF Severity=Warning SymbolicName=PYS_E_GENERIC_WARNING Language=English %1 . MessageId=0x1000 Severity=Error SymbolicName=E_PYISAPI_FILTER_FAILED Language=English The pyISAPI filter encountered an error. %n%1 %nThe last windows error was: %2 . MessageId=0x1001 Severity=Error SymbolicName=E_PYISAPI_EXTENSION_FAILED Language=English The pyISAPI extension encountered an error. %n%1 %nThe last windows error was: %2 . ; // A nod to py2exe or similar tools MessageId=0x1100 Severity=Error SymbolicName=E_PYISAPI_STARTUP_FAILED Language=English The pyISAPI extension failed to initialize. %n%1 %nThe last windows error was: %2 . Index: Utils.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/Utils.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Utils.h 6 Oct 2004 05:11:54 -0000 1.1 --- Utils.h 17 Jan 2007 04:40:12 -0000 1.2 *************** *** 58,61 **** char *GetModulePath(void); ! #endif // __UTILS_H \ No newline at end of file --- 58,64 ---- char *GetModulePath(void); + // Write entry to the event log + BOOL WriteEventLogMessage(WORD eventType, DWORD eventID, WORD num_inserts, + const char **inserts); ! #endif // __UTILS_H |
From: Mark H. <mha...@us...> - 2007-01-17 04:36:56
|
Update of /cvsroot/pywin32/pywin32/isapi/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27676 Modified Files: pyISAPI.cpp Log Message: correct typo in comment Index: pyISAPI.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/pyISAPI.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pyISAPI.cpp 14 Dec 2006 08:34:39 -0000 1.7 --- pyISAPI.cpp 17 Jan 2007 04:36:54 -0000 1.8 *************** *** 155,159 **** if (!filterHandler.Init(&pyEngine, name_filter_factory, name_filter_init, name_filter_do, name_filter_term)) ! // error already imported. return FALSE; --- 155,159 ---- if (!filterHandler.Init(&pyEngine, name_filter_factory, name_filter_init, name_filter_do, name_filter_term)) ! // error already reported. return FALSE; |
From: Roger U. <ru...@us...> - 2007-01-16 19:04:24
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18768/win32/src Modified Files: win32crypt.i win32gui.i win32inet.i win32process.i Log Message: Move Swig typemaps for HWND into pywintypes.i Index: win32process.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32process.i,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** win32process.i 15 Dec 2006 04:22:59 -0000 1.22 --- win32process.i 16 Jan 2007 19:04:21 -0000 1.23 *************** *** 15,21 **** %include "pywin32.i" - %apply HWND {long}; - typedef long HWND - %{ #include "structmember.h" --- 15,18 ---- Index: win32inet.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32inet.i,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** win32inet.i 19 Feb 2006 12:56:46 -0000 1.4 --- win32inet.i 16 Jan 2007 19:04:21 -0000 1.5 *************** *** 13,19 **** %include "pywin32.i" - %apply HWND {long}; - typedef long HWND - %{ #undef PyHANDLE // undef earlier define, so we are back to the class. --- 13,16 ---- Index: win32crypt.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32crypt.i,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** win32crypt.i 23 Oct 2005 11:33:52 -0000 1.2 --- win32crypt.i 16 Jan 2007 19:04:21 -0000 1.3 *************** *** 14,20 **** %include "pywin32.i" - %apply HWND {long}; - typedef long HWND - %{ BOOL PyWinObject_AsDATA_BLOB(PyObject *ob, DATA_BLOB *b) --- 14,17 ---- *************** *** 115,127 **** else if (PyTuple_Check($source)) { $target = (CRYPTPROTECT_PROMPTSTRUCT *)_alloca(sizeof(CRYPTPROTECT_PROMPTSTRUCT)); ! PyObject *obPrompt = Py_None; memset($target, 0, sizeof(*$target)); $target->cbSize = sizeof(*$target); ! if (!PyArg_ParseTuple($source, "l|lO", &$target->dwPromptFlags, ! &$target->hwndApp, &obPrompt)) return NULL; if (!PyWinObject_AsWCHAR(obPrompt, (WCHAR **)(&$target->szPrompt), TRUE)) return NULL; } else { PyErr_Format(PyExc_TypeError, "CRYPTPROTECT_PROMPTSTRUCT must be None or a tuple (got %s)", --- 112,126 ---- else if (PyTuple_Check($source)) { $target = (CRYPTPROTECT_PROMPTSTRUCT *)_alloca(sizeof(CRYPTPROTECT_PROMPTSTRUCT)); ! PyObject *obPrompt = Py_None, *obhwndApp = Py_None; memset($target, 0, sizeof(*$target)); $target->cbSize = sizeof(*$target); ! if (!PyArg_ParseTuple($source, "l|OO", &$target->dwPromptFlags, ! &obhwndApp, &obPrompt)) return NULL; if (!PyWinObject_AsWCHAR(obPrompt, (WCHAR **)(&$target->szPrompt), TRUE)) return NULL; + if (!PyWinObject_AsHANDLE(obhwndApp, (HANDLE *)&$target->hwndApp, TRUE)) + return NULL; } else { PyErr_Format(PyExc_TypeError, "CRYPTPROTECT_PROMPTSTRUCT must be None or a tuple (got %s)", Index: win32gui.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32gui.i,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** win32gui.i 12 Jan 2007 05:54:38 -0000 1.100 --- win32gui.i 16 Jan 2007 19:04:21 -0000 1.101 *************** *** 293,302 **** // Handles types with no specific PyHANDLE subclass, returned to Python as plain ints or longs ! typedef float HDC, HWND, HCURSOR, HINSTANCE, HMENU, HICON, HGDIOBJ, HIMAGELIST, HACCEL; ! %typemap(python, in) HDC, HWND, HCURSOR, HINSTANCE, HMENU, HICON, HGDIOBJ, HIMAGELIST, HACCEL{ if (!PyWinObject_AsHANDLE($source, (HANDLE *)&$target, FALSE)) return NULL; } ! %typemap(python, out) HDC, HWND, HCURSOR, HINSTANCE, HMENU, HICON, HGDIOBJ, HIMAGELIST, HACCEL{ $target=PyWinLong_FromHANDLE($source); } --- 293,302 ---- // Handles types with no specific PyHANDLE subclass, returned to Python as plain ints or longs ! typedef float HDC, HCURSOR, HINSTANCE, HMENU, HICON, HGDIOBJ, HIMAGELIST, HACCEL; ! %typemap(python, in) HDC, HCURSOR, HINSTANCE, HMENU, HICON, HGDIOBJ, HIMAGELIST, HACCEL{ if (!PyWinObject_AsHANDLE($source, (HANDLE *)&$target, FALSE)) return NULL; } ! %typemap(python, out) HDC, HCURSOR, HINSTANCE, HMENU, HICON, HGDIOBJ, HIMAGELIST, HACCEL{ $target=PyWinLong_FromHANDLE($source); } |
From: Roger U. <ru...@us...> - 2007-01-16 19:04:24
|
Update of /cvsroot/pywin32/pywin32/SWIG/swig_lib/python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18768/SWIG/swig_lib/python Modified Files: pywintypes.i Log Message: Move Swig typemaps for HWND into pywintypes.i Index: pywintypes.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/SWIG/swig_lib/python/pywintypes.i,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pywintypes.i 12 Jan 2007 03:35:09 -0000 1.5 --- pywintypes.i 16 Jan 2007 19:04:21 -0000 1.6 *************** *** 256,260 **** // PyHANDLE will use a PyHANDLE object. // PyHKEY will use a PyHKEY object ! // HANDLE will use an integer. //--------------------------------------------------------------------------- //typedef void *HANDLE; --- 256,260 ---- // PyHANDLE will use a PyHANDLE object. // PyHKEY will use a PyHKEY object ! // HANDLE, HWND will use an integer. //--------------------------------------------------------------------------- //typedef void *HANDLE; *************** *** 383,386 **** --- 383,397 ---- } + // HWND (used in win32process, adsi, win32inet, win32crypt) + // Has to be typedef'ed to a non-pointer type or the typemaps are ignored + typedef float HWND; + %typemap(python, in) HWND{ + if (!PyWinObject_AsHANDLE($source, (HANDLE *)&$target, FALSE)) + return NULL; + } + %typemap(python, out) HWND{ + $target=PyWinLong_FromHANDLE($source); + } + //--------------------------------------------------------------------------- // |
From: Roger U. <ru...@us...> - 2007-01-16 16:56:02
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3911/win32/src Modified Files: win32clipboardmodule.cpp Log Message: Fix places where HANDLEs were treated as ints Index: win32clipboardmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32clipboardmodule.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** win32clipboardmodule.cpp 2 Dec 2005 07:50:47 -0000 1.15 --- win32clipboardmodule.cpp 16 Jan 2007 16:55:51 -0000 1.16 *************** *** 56,64 **** HWND hWndRemove; HWND hWndNewNext; ! ! if (!PyArg_ParseTuple(args, "ii:ChangeClipboardChain", ! &hWndRemove, &hWndNewNext)) { return NULL; } BOOL rc; --- 56,68 ---- HWND hWndRemove; HWND hWndNewNext; ! PyObject *obhWndRemove, *obhWndNewNext; ! if (!PyArg_ParseTuple(args, "OO:ChangeClipboardChain", ! &obhWndRemove, &obhWndNewNext)) { return NULL; } + if (!PyWinObject_AsHANDLE(obhWndRemove, (HANDLE *)&hWndRemove, FALSE)) + return NULL; + if (!PyWinObject_AsHANDLE(obhWndNewNext, (HANDLE *)&hWndNewNext, TRUE)) + return NULL; BOOL rc; *************** *** 286,290 **** if (!handle) return ReturnAPIError("GetClipboardData"); ! return PyLong_FromVoidPtr(handle); } --- 290,294 ---- if (!handle) return ReturnAPIError("GetClipboardData"); ! return PyWinLong_FromHANDLE(handle); } *************** *** 456,465 **** py_get_global_memory(PyObject* self, PyObject* args) { ! int iglobal; ! // @pyparm int|hglobal||The handle to the global memory object ! if (!PyArg_ParseTuple(args, "i", &iglobal)) return NULL; ! HGLOBAL hglobal = (HGLOBAL)iglobal; ! DWORD size = GlobalSize(hglobal); if (!size) return ReturnAPIError("GlobalSize"); --- 460,471 ---- py_get_global_memory(PyObject* self, PyObject* args) { ! HGLOBAL hglobal; ! PyObject *obhglobal; ! // @pyparm <o PyHANDLE>|hglobal||The handle to the global memory object ! if (!PyArg_ParseTuple(args, "O", &obhglobal)) return NULL; ! if (!PyWinObject_AsHANDLE(obhglobal, &hglobal, FALSE)) ! return NULL; ! size_t size = GlobalSize(hglobal); if (!size) return ReturnAPIError("GlobalSize"); *************** *** 530,538 **** Py_END_ALLOW_THREADS; ! if (!rc) { return ReturnAPIError("GetClipboardOwner"); ! } ! ! return (Py_BuildValue("i", (int)rc)); // @comm The clipboard can still contain data even if the clipboard is not --- 536,542 ---- Py_END_ALLOW_THREADS; ! if (!rc) return ReturnAPIError("GetClipboardOwner"); ! return PyWinLong_FromHANDLE(rc); // @comm The clipboard can still contain data even if the clipboard is not *************** *** 613,621 **** Py_END_ALLOW_THREADS; ! if (!rc) { return ReturnAPIError("GetClipboardViewer"); ! } ! ! return (Py_BuildValue("i", (int)rc)); // @pyseeapi GetClipboardViewer --- 617,623 ---- Py_END_ALLOW_THREADS; ! if (!rc) return ReturnAPIError("GetClipboardViewer"); ! return PyWinLong_FromHANDLE(rc); // @pyseeapi GetClipboardViewer *************** *** 646,654 **** Py_END_ALLOW_THREADS; ! if (!rc) { return ReturnAPIError("GetOpenClipboardWindow"); - } ! return (Py_BuildValue("i", (int)rc)); // @comm If an application or dynamic-link library (DLL) specifies a NULL --- 648,655 ---- Py_END_ALLOW_THREADS; ! if (!rc) return ReturnAPIError("GetOpenClipboardWindow"); ! return PyWinLong_FromHANDLE(rc); // @comm If an application or dynamic-link library (DLL) specifies a NULL *************** *** 775,791 **** { ! // @pyparm int|hWnd||Integer handle to the window to be associated with the ! // open clipboard. If this parameter is 0, the open clipboard is associated // with the current task. ! HWND pyHwnd = 0; ! if (!PyArg_ParseTuple(args, "|i:OpenClipboard", ! &pyHwnd)) { return NULL; - } BOOL rc; Py_BEGIN_ALLOW_THREADS; ! rc = OpenClipboard(pyHwnd); Py_END_ALLOW_THREADS; --- 776,794 ---- { ! // @pyparm <o PyHANDLE>|hWnd|None|Integer handle to the window to be associated with the ! // open clipboard. If this parameter is None, the open clipboard is associated // with the current task. ! HWND hWnd; ! PyObject *obhWnd=Py_None; ! if (!PyArg_ParseTuple(args, "|O:OpenClipboard", ! &obhWnd)) return NULL; + if (!PyWinObject_AsHANDLE(obhWnd, (HANDLE *)&hWnd, TRUE)) + return NULL; BOOL rc; Py_BEGIN_ALLOW_THREADS; ! rc = OpenClipboard(hWnd); Py_END_ALLOW_THREADS; *************** *** 887,919 **** int format; HANDLE handle; ! int ihandle; ! if (PyArg_ParseTuple(args, "ii:SetClipboardData", ! &format, &ihandle)) { ! handle = (HANDLE)ihandle; ! } else { PyErr_Clear(); // @pyparmalt1 int|format||Specifies a clipboard format. For a description of // the standard clipboard formats, see Standard Clipboard Formats. - // @pyparmalt1 object|ob||An object that has a read-buffer interface. // A global memory object is allocated, and the objects buffer is copied // to the new memory. - PyObject *obBuf; const void * buf = NULL; int bufSize = 0; - if (!PyArg_ParseTuple(args, "iO:SetClipboardData", - &format, &obBuf)) - return NULL; ! if (PyObject_AsReadBuffer(obBuf,&buf,&bufSize)==-1) RETURN_TYPE_ERR("The object must support the buffer interfaces"); // size doesnt include nulls! ! if (PyString_Check(obBuf)) bufSize += 1; ! else if (PyUnicode_Check(obBuf)) bufSize += sizeof(wchar_t); // else assume buffer needs no terminator... ! handle = GlobalAlloc(GHND, (DWORD)bufSize); if (handle == NULL) { return ReturnAPIError("GlobalAlloc"); --- 890,917 ---- int format; HANDLE handle; ! PyObject *obhandle; ! if (!PyArg_ParseTuple(args, "iO:SetClipboardData", ! &format, &obhandle)) ! return NULL; ! if (!PyWinObject_AsHANDLE(obhandle , &handle, TRUE)){ PyErr_Clear(); // @pyparmalt1 int|format||Specifies a clipboard format. For a description of // the standard clipboard formats, see Standard Clipboard Formats. // @pyparmalt1 object|ob||An object that has a read-buffer interface. // A global memory object is allocated, and the objects buffer is copied // to the new memory. const void * buf = NULL; int bufSize = 0; ! if (PyObject_AsReadBuffer(obhandle,&buf,&bufSize)==-1) RETURN_TYPE_ERR("The object must support the buffer interfaces"); // size doesnt include nulls! ! if (PyString_Check(obhandle)) bufSize += 1; ! else if (PyUnicode_Check(obhandle)) bufSize += sizeof(wchar_t); // else assume buffer needs no terminator... ! handle = GlobalAlloc(GHND, bufSize); if (handle == NULL) { return ReturnAPIError("GlobalAlloc"); *************** *** 928,935 **** Py_END_ALLOW_THREADS; ! if (!data) { return ReturnAPIError("SetClipboardData"); ! } ! return (Py_BuildValue("i", (int)data)); // @comm The uFormat parameter can identify a registered clipboard format, --- 926,932 ---- Py_END_ALLOW_THREADS; ! if (!data) return ReturnAPIError("SetClipboardData"); ! return PyWinLong_FromHANDLE(data); // @comm The uFormat parameter can identify a registered clipboard format, *************** *** 988,996 **** Py_END_ALLOW_THREADS; ! if (!data) { return ReturnAPIError("SetClipboardText"); ! } ! ! return (Py_BuildValue("i", (int)data)); // @pyseeapi SetClipboardData --- 985,991 ---- Py_END_ALLOW_THREADS; ! if (!data) return ReturnAPIError("SetClipboardText"); ! return PyWinLong_FromHANDLE(data); // @pyseeapi SetClipboardData *************** *** 1006,1027 **** //***************************************************************************** // ! // @pymethod int|win32clipboard|SetClipboardViewer|The SetClipboardViewer function // adds the specified window to the chain of clipboard viewers. Clipboard // viewer windows receive a WM_DRAWCLIPBOARD message whenever the content of // the clipboard changes. ! static PyObject * py_set_clipboard_viewer(PyObject* self, PyObject* args) { ! // @pyparm int|hWndNewViewer||Integer handle to the window to be added to ! // the clipboard chain. ! HWND hWndNewViewer; ! if (!PyArg_ParseTuple(args, "i:SetClipboardViewer", ! &hWndNewViewer)) { return NULL; ! } ! HWND rc; Py_BEGIN_ALLOW_THREADS; --- 1001,1021 ---- //***************************************************************************** // ! // @pymethod <o PyHANDLE>|win32clipboard|SetClipboardViewer|The SetClipboardViewer function // adds the specified window to the chain of clipboard viewers. Clipboard // viewer windows receive a WM_DRAWCLIPBOARD message whenever the content of // the clipboard changes. ! // @rdesc Returns a handle to the next window in chain, or None if no other viewer exists. static PyObject * py_set_clipboard_viewer(PyObject* self, PyObject* args) { ! // @pyparm <o PyHANDLE>|hWndNewViewer||Integer handle to the window to be added to ! // the clipboard chain. HWND hWndNewViewer; ! PyObject *obhwnd; ! if (!PyArg_ParseTuple(args, "O:SetClipboardViewer", &obhwnd)) return NULL; ! if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hWndNewViewer, FALSE)) ! return NULL; HWND rc; Py_BEGIN_ALLOW_THREADS; *************** *** 1029,1037 **** Py_END_ALLOW_THREADS; ! if (!rc) { ! return ReturnAPIError("SetClipboardViewer"); ! } ! ! return (Py_BuildValue("i", (int)rc)); // @comm The windows that are part of the clipboard viewer chain, called --- 1023,1034 ---- Py_END_ALLOW_THREADS; ! // Function can return NULL on success if there is no other viewer ! if (rc!=NULL) ! return PyWinLong_FromHANDLE(rc); ! DWORD e=GetLastError(); ! if (e) ! return PyWin_SetAPIError("SetClipboardViewer",e); ! Py_INCREF(Py_None); ! return Py_None; // @comm The windows that are part of the clipboard viewer chain, called |
From: Roger U. <ru...@us...> - 2007-01-14 19:12:19
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26215/win32/src Modified Files: win32service.i Log Message: Return service handles as PyHANDLE subclass Index: win32service.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32service.i,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** win32service.i 11 Sep 2005 15:19:07 -0000 1.9 --- win32service.i 14 Jan 2007 16:37:37 -0000 1.10 *************** *** 48,51 **** --- 48,81 ---- %{ #include "structmember.h" + + // @object PySC_HANDLE|Handle to a service or service control manager. + // This is a variant of <o PyHANDLE> that releases its handle using CloseServiceHandle. + class PySC_HANDLE: public PyHANDLE + { + public: + PySC_HANDLE(HANDLE hInit) : PyHANDLE(hInit) {} + virtual BOOL Close(void){ + BOOL ret=TRUE; + if (m_handle!=NULL){ + ret=CloseServiceHandle((SC_HANDLE)m_handle); + m_handle = NULL; + } + if (!ret) + PyWin_SetAPIError("CloseServiceHandle"); + return ret; + } + virtual const char *GetTypeName(){ + return "PySC_HANDLE"; + } + }; + + PyObject *PyWinObject_FromSC_HANDLE(SC_HANDLE sch) + { + PyObject *ret=new PySC_HANDLE(sch); + if (ret==NULL) + PyErr_NoMemory(); + return ret; + } + // @object PyHWINSTA|Wrapper for a handle to a window station - returned by CreateWindowStation, OpenWindowStation, or GetProcessWindowStation class PyHWINSTA : public PyHANDLE *************** *** 81,85 **** static char *keywords[]={"handle",0}; HWINSTA hwinsta; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "l", keywords, &hwinsta)) return NULL; return new PyHWINSTA(hwinsta); --- 111,118 ---- static char *keywords[]={"handle",0}; HWINSTA hwinsta; ! PyObject *obh; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O", keywords, &obh)) ! return NULL; ! if (!PyWinObject_AsHANDLE(obh, (HANDLE *)&hwinsta, FALSE)) return NULL; return new PyHWINSTA(hwinsta); *************** *** 182,186 **** static char *keywords[]={"handle",0}; HDESK hdesk; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "l", keywords, &hdesk)) return NULL; return new PyHDESK(hdesk); --- 215,222 ---- static char *keywords[]={"handle",0}; HDESK hdesk; ! PyObject *obh; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O", keywords, &obh)) ! return NULL; ! if (!PyWinObject_AsHANDLE(obh, (HANDLE *)&hdesk, FALSE)) return NULL; return new PyHDESK(hdesk); *************** *** 385,389 **** %} ! // @pyswig (PyUNICODE,...)|EnumWindowStations|Lists names of window stations // @comm Only window stations for which you have WINSTA_ENUMERATE access will be returned %native(EnumWindowStations) PyEnumWindowStations; --- 421,425 ---- %} ! // @pyswig (<o PyUnicode>,,...)|EnumWindowStations|Lists names of window stations // @comm Only window stations for which you have WINSTA_ENUMERATE access will be returned %native(EnumWindowStations) PyEnumWindowStations; *************** *** 760,766 **** } else { if (bFetchTag) ! rc = Py_BuildValue("ll", sh, tagID); else ! rc = PyInt_FromLong((long)sh); } cleanup: --- 796,802 ---- } else { if (bFetchTag) ! rc = Py_BuildValue("Nl", PyWinLong_FromHANDLE(sh), tagID); else ! rc = PyWinLong_FromHANDLE(sh); } cleanup: *************** *** 858,872 **** static PyObject *MyEnumServicesStatus(PyObject *self, PyObject *args) { ! // @pyparm int|hSCManager||Handle to service control manager as returned by <om win32service.OpenSCManager> // @pyparm int|ServiceType|SERVICE_WIN32|Types of services to enumerate (SERVICE_DRIVER and/or SERVICE_WIN32) // @pyparm int|ServiceState|SERVICE_STATE_ALL|Limits to services in specified state ! SC_HANDLE hscm; DWORD serviceType = SERVICE_WIN32; DWORD serviceState = SERVICE_STATE_ALL; ! if (!PyArg_ParseTuple(args, "l|ll:EnumServicesStatus", &hscm, &serviceType, &serviceState)) { return NULL; } ! long tmp; LPENUM_SERVICE_STATUS services = (LPENUM_SERVICE_STATUS)&tmp; --- 894,910 ---- static PyObject *MyEnumServicesStatus(PyObject *self, PyObject *args) { ! // @pyparm <o PySC_HANDLE>|hSCManager||Handle to service control manager as returned by <om win32service.OpenSCManager> // @pyparm int|ServiceType|SERVICE_WIN32|Types of services to enumerate (SERVICE_DRIVER and/or SERVICE_WIN32) // @pyparm int|ServiceState|SERVICE_STATE_ALL|Limits to services in specified state ! SC_HANDLE hscm; ! PyObject *obhscm; DWORD serviceType = SERVICE_WIN32; DWORD serviceState = SERVICE_STATE_ALL; ! if (!PyArg_ParseTuple(args, "O|ll:EnumServicesStatus", &obhscm, &serviceType, &serviceState)) { return NULL; } ! if (!PyWinObject_AsHANDLE(obhscm, (HANDLE *)&hscm, FALSE)) ! return NULL; long tmp; LPENUM_SERVICE_STATUS services = (LPENUM_SERVICE_STATUS)&tmp; *************** *** 926,937 **** static PyObject *MyEnumDependentServices(PyObject *self, PyObject *args) { ! // @pyparm int|hService||Handle to service for which to list dependent services (as returned by <om win32service.OpenService>) // @pyparm int|ServiceState|SERVICE_STATE_ALL|Limits to services in specified state - One of SERVICE_STATE_ALL, SERVICE_ACTIVE, SERVICE_INACTIVE SC_HANDLE hsc; DWORD serviceState = SERVICE_STATE_ALL; ! if (!PyArg_ParseTuple(args, "l|l:EnumDependentServices", &hsc, &serviceState)) { return NULL; } long tmp; --- 964,978 ---- static PyObject *MyEnumDependentServices(PyObject *self, PyObject *args) { ! // @pyparm <o PySC_HANDLE>|hService||Handle to service for which to list dependent services (as returned by <om win32service.OpenService>) // @pyparm int|ServiceState|SERVICE_STATE_ALL|Limits to services in specified state - One of SERVICE_STATE_ALL, SERVICE_ACTIVE, SERVICE_INACTIVE SC_HANDLE hsc; + PyObject *obhsc; DWORD serviceState = SERVICE_STATE_ALL; ! if (!PyArg_ParseTuple(args, "O|l:EnumDependentServices", &obhsc, &serviceState)) { return NULL; } + if (!PyWinObject_AsHANDLE(obhsc, (HANDLE *)&hsc, FALSE)) + return NULL; long tmp; *************** *** 994,1003 **** static PyObject *MyQueryServiceConfig(PyObject *self, PyObject *args) { ! // @pyparm int|hService||Service handle as returned by <om win32service.OpenService> SC_HANDLE hsc; ! if (!PyArg_ParseTuple(args, "l:QueryServiceConfig", &hsc)) { return NULL; } long tmp; --- 1035,1047 ---- static PyObject *MyQueryServiceConfig(PyObject *self, PyObject *args) { ! // @pyparm <o PySC_HANDLE>|hService||Service handle as returned by <om win32service.OpenService> SC_HANDLE hsc; ! PyObject *obhsc; ! if (!PyArg_ParseTuple(args, "O:QueryServiceConfig", &obhsc)) { return NULL; } + if (!PyWinObject_AsHANDLE(obhsc, (HANDLE *)&hsc, FALSE)) + return NULL; long tmp; *************** *** 1052,1059 **** %} ! typedef long SC_HANDLE; // 32 bit? ! typedef long SC_LOCK; ! typedef long SERVICE_STATUS_HANDLE ! //typedef unsigned int TCHAR; %typemap(python,except) SC_HANDLE { --- 1096,1115 ---- %} ! typedef float SC_HANDLE, SERVICE_STATUS_HANDLE, SC_LOCK; // This is just to keep Swig from treating them as pointers ! %typemap(python,out) SC_HANDLE{ ! $target = PyWinObject_FromSC_HANDLE($source); ! } ! %typemap(python,in) SC_HANDLE, SERVICE_STATUS_HANDLE{ ! if (!PyWinObject_AsHANDLE($source, (HANDLE *)&$target, FALSE)) ! return NULL; ! } ! %typemap(python,out) SC_LOCK{ ! $target = PyLong_FromVoidPtr($source); ! } ! %typemap(python,in) SC_LOCK{ ! $target=PyLong_AsVoidPtr($source); ! if ($target==NULL && PyErr_Occurred()) ! return NULL; ! } %typemap(python,except) SC_HANDLE { *************** *** 1100,1124 **** // @pyswig |StartService|Starts the specified service %name (StartService) PyObject *MyStartService ( ! SC_HANDLE scHandle, // @pyparm int|scHandle||Handle to the Service Control Mananger PyObject *pyobject /* serviceArgs */); // @pyparm [string, ...]|args||Arguments to the service. ! // @pyswig int|OpenService|Returns a handle to the specified service. SC_HANDLE OpenService( ! SC_HANDLE hSCManager, // @pyparm int|scHandle||Handle to the Service Control Mananger TCHAR *name, // @pyparm <o PyUnicode>|name||The name of the service to open. unsigned long desiredAccess); // @pyparm int|desiredAccess||The access desired. ! // @pyswig int|OpenSCManager|Returns a handle to the service control manager SC_HANDLE OpenSCManager( TCHAR *INPUT_NULLOK, // @pyparm <o PyUnicode>|machineName||The name of the computer, or None TCHAR *INPUT_NULLOK, // @pyparm <o PyUnicode>|dbName||The name of the service database, or None ! unsigned long desiredAccess); // @pyparm int|desiredAccess||The access desired. ! // @pyswig |CloseServiceHandle|Closes a service handle ! BOOLAPI CloseServiceHandle(SC_HANDLE handle); // @pyparm int|scHandle||Handle to close // @pyswig <o SERVICE_STATUS>|QueryServiceStatus|Queries a service status BOOLAPI QueryServiceStatus(SC_HANDLE handle, SERVICE_STATUS *outServiceStatus); ! // @pyparm int|scHandle||Handle to query // @pyswig <o SERVICE_STATUS>|QueryServiceStatusEx|Queries a service status --- 1156,1207 ---- // @pyswig |StartService|Starts the specified service %name (StartService) PyObject *MyStartService ( ! SC_HANDLE hService, // @pyparm <o PySC_HANDLE>|hService||Handle to the service to be started PyObject *pyobject /* serviceArgs */); // @pyparm [string, ...]|args||Arguments to the service. ! // @pyswig <o PySC_HANDLE>|OpenService|Returns a handle to the specified service. SC_HANDLE OpenService( ! SC_HANDLE hSCManager, // @pyparm <o PySC_HANDLE>|scHandle||Handle to the Service Control Mananger TCHAR *name, // @pyparm <o PyUnicode>|name||The name of the service to open. unsigned long desiredAccess); // @pyparm int|desiredAccess||The access desired. ! // @pyswig <o PySC_HANDLE>|OpenSCManager|Returns a handle to the service control manager SC_HANDLE OpenSCManager( TCHAR *INPUT_NULLOK, // @pyparm <o PyUnicode>|machineName||The name of the computer, or None TCHAR *INPUT_NULLOK, // @pyparm <o PyUnicode>|dbName||The name of the service database, or None ! unsigned long desiredAccess); // @pyparm int|desiredAccess||The access desired. (combination of win32service.SC_MANAGER_* flags) ! %{ ! // @pyswig |CloseServiceHandle|Closes a service or SCM handle ! static PyObject *PyCloseServiceHandle(PyObject *self, PyObject *args) ! { ! PyObject *obsch; ! SC_HANDLE sch; ! if (!PyArg_ParseTuple(args, "O:CloseServiceHandle", ! &obsch)) // @pyparm <o PySC_HANDLE>|scHandle||Handle to close ! return NULL; ! if (PyHANDLE_Check(obsch)){ ! // Calling Close() in this manner could close any type of PyHANDLE. ! if (strcmp(((PyHANDLE *)obsch)->GetTypeName(),"PySC_HANDLE")!=0){ ! PyErr_SetString(PyExc_TypeError,"PyHANDLE passed to CloseServiceHandle must be a PySC_HANDLE"); ! return NULL; ! } ! if (!((PySC_HANDLE *)obsch)->Close()) ! return NULL; ! Py_INCREF(Py_None); ! return Py_None; ! } ! if (!PyWinObject_AsHANDLE(obsch, (HANDLE *)&sch, FALSE)) ! return NULL; ! if (!CloseServiceHandle(sch)) ! return PyWin_SetAPIError("CloseServiceHandle"); ! Py_INCREF(Py_None); ! return Py_None; ! } ! %} ! %native (CloseServiceHandle) PyCloseServiceHandle; // @pyswig <o SERVICE_STATUS>|QueryServiceStatus|Queries a service status BOOLAPI QueryServiceStatus(SC_HANDLE handle, SERVICE_STATUS *outServiceStatus); ! // @pyparm <o PySC_HANDLE>|hService||Handle to service to be queried // @pyswig <o SERVICE_STATUS>|QueryServiceStatusEx|Queries a service status *************** *** 1132,1142 **** } SC_HANDLE hService; SC_STATUS_TYPE InfoLevel=SC_STATUS_PROCESS_INFO; // only existing info level SERVICE_STATUS_PROCESS info; DWORD bufsize=sizeof(SERVICE_STATUS_PROCESS); DWORD reqdbufsize; ! // @pyparm int|scHandle||Handle to query ! if (!PyArg_ParseTuple(args,"l:QueryServiceStatusEx",&hService)) return NULL; if (!(*fpQueryServiceStatusEx)(hService,InfoLevel,(BYTE *)&info,bufsize,&reqdbufsize)) return PyWin_SetAPIError("QueryServiceStatusEx", GetLastError()); --- 1215,1229 ---- } SC_HANDLE hService; + PyObject *obhService; SC_STATUS_TYPE InfoLevel=SC_STATUS_PROCESS_INFO; // only existing info level SERVICE_STATUS_PROCESS info; DWORD bufsize=sizeof(SERVICE_STATUS_PROCESS); DWORD reqdbufsize; ! // @pyparm <o PySC_HANDLE>|hService||Handle to service to be queried ! if (!PyArg_ParseTuple(args,"O:QueryServiceStatusEx",&obhService)) return NULL; + if (!PyWinObject_AsHANDLE(obhService, (HANDLE *)&hService, FALSE)) + return NULL; + if (!(*fpQueryServiceStatusEx)(hService,InfoLevel,(BYTE *)&info,bufsize,&reqdbufsize)) return PyWin_SetAPIError("QueryServiceStatusEx", GetLastError()); *************** *** 1163,1171 **** SECURITY_INFORMATION info; SC_HANDLE hsvc; ! // @pyparm int|Handle||Service handle // @pyparm int|SecurityInformation||Type of infomation to set, combination of values from SECURITY_INFORMATION enum // @pyparm <o PySECURITY_DESCRIPTOR>|SecurityDescriptor||PySECURITY_DESCRIPTOR containing infomation to set ! if (!PyArg_ParseTuple(args,"llO:SetServiceObjectSecurity",&hsvc, &info, &obSD)) return NULL; if (!PyWinObject_AsSECURITY_DESCRIPTOR(obSD,&pSD,FALSE)) return NULL; --- 1250,1262 ---- SECURITY_INFORMATION info; SC_HANDLE hsvc; ! PyObject *obhsvc; ! // @pyparm <o PySC_HANDLE>|Handle||Service handle // @pyparm int|SecurityInformation||Type of infomation to set, combination of values from SECURITY_INFORMATION enum // @pyparm <o PySECURITY_DESCRIPTOR>|SecurityDescriptor||PySECURITY_DESCRIPTOR containing infomation to set ! if (!PyArg_ParseTuple(args,"OlO:SetServiceObjectSecurity",&obhsvc, &info, &obSD)) ! return NULL; ! if (!PyWinObject_AsHANDLE(obhsvc, (HANDLE *)&hsvc, FALSE)) return NULL; + if (!PyWinObject_AsSECURITY_DESCRIPTOR(obSD,&pSD,FALSE)) return NULL; *************** *** 1187,1194 **** DWORD err, origbufsize=SECURITY_DESCRIPTOR_MIN_LENGTH, reqdbufsize=0; SC_HANDLE hsvc; ! // @pyparm int|Handle||Service handle // @pyparm int|SecurityInformation||Type of infomation to retrieve, combination of values from SECURITY_INFORMATION enum ! if (!PyArg_ParseTuple(args,"ll:QueryServiceObjectSecurity",&hsvc, &info)) return NULL; pSD=(PSECURITY_DESCRIPTOR)malloc(origbufsize); if (pSD==NULL){ --- 1278,1289 ---- DWORD err, origbufsize=SECURITY_DESCRIPTOR_MIN_LENGTH, reqdbufsize=0; SC_HANDLE hsvc; ! PyObject *obhsvc; ! // @pyparm <o PySC_HANDLE>|Handle||Service handle // @pyparm int|SecurityInformation||Type of infomation to retrieve, combination of values from SECURITY_INFORMATION enum ! if (!PyArg_ParseTuple(args,"Ol:QueryServiceObjectSecurity",&obhsvc, &info)) ! return NULL; ! if (!PyWinObject_AsHANDLE(obhsvc, (HANDLE *)&hsvc, FALSE)) return NULL; + pSD=(PSECURITY_DESCRIPTOR)malloc(origbufsize); if (pSD==NULL){ *************** *** 1225,1236 **** PyObject *MyGetServiceKeyName(PyObject *self, PyObject *args) { ! // @pyparm int|hSCManager||Handle to service control manager as returned by <om win32service.OpenSCManager> // @pyparm <o PyUNICODE>|DisplayName||Display name of a service SC_HANDLE h; WCHAR *displayname; WCHAR keyname[MAX_SERVICE_NAME_LEN]; DWORD bufsize=MAX_SERVICE_NAME_LEN; PyObject *obdisplayname, *ret=NULL; ! if (!PyArg_ParseTuple(args,"lO", &h, &obdisplayname)) return NULL; if (!PyWinObject_AsWCHAR(obdisplayname, &displayname, FALSE)) --- 1320,1334 ---- PyObject *MyGetServiceKeyName(PyObject *self, PyObject *args) { ! // @pyparm <o PySC_HANDLE>|hSCManager||Handle to service control manager as returned by <om win32service.OpenSCManager> // @pyparm <o PyUNICODE>|DisplayName||Display name of a service SC_HANDLE h; + PyObject *obh; WCHAR *displayname; WCHAR keyname[MAX_SERVICE_NAME_LEN]; DWORD bufsize=MAX_SERVICE_NAME_LEN; PyObject *obdisplayname, *ret=NULL; ! if (!PyArg_ParseTuple(args,"OO:GetServiceKeyName", &obh, &obdisplayname)) ! return NULL; ! if (!PyWinObject_AsHANDLE(obh, (HANDLE *)&h, FALSE)) return NULL; if (!PyWinObject_AsWCHAR(obdisplayname, &displayname, FALSE)) *************** *** 1250,1261 **** PyObject *MyGetServiceDisplayName(PyObject *self, PyObject *args) { ! // @pyparm int|hSCManager||Handle to service control manager as returned by <om win32service.OpenSCManager> // @pyparm <o PyUNICODE>|ServiceName||Name of service SC_HANDLE h; WCHAR *keyname; WCHAR displayname[MAX_SERVICE_NAME_LEN]; DWORD bufsize=MAX_SERVICE_NAME_LEN; PyObject *obkeyname, *ret=NULL; ! if (!PyArg_ParseTuple(args,"lO", &h, &obkeyname)) return NULL; if (!PyWinObject_AsWCHAR(obkeyname, &keyname, FALSE)) --- 1348,1362 ---- PyObject *MyGetServiceDisplayName(PyObject *self, PyObject *args) { ! // @pyparm <o PySC_HANDLE>|hSCManager||Handle to service control manager as returned by <om win32service.OpenSCManager> // @pyparm <o PyUNICODE>|ServiceName||Name of service SC_HANDLE h; + PyObject *obh; WCHAR *keyname; WCHAR displayname[MAX_SERVICE_NAME_LEN]; DWORD bufsize=MAX_SERVICE_NAME_LEN; PyObject *obkeyname, *ret=NULL; ! if (!PyArg_ParseTuple(args,"OO:GetServiceDisplayName", &obh, &obkeyname)) ! return NULL; ! if (!PyWinObject_AsHANDLE(obh, (HANDLE *)&h, FALSE)) return NULL; if (!PyWinObject_AsWCHAR(obkeyname, &keyname, FALSE)) *************** *** 1278,1282 **** // @rdesc The result is the new service status. BOOLAPI ControlService( ! SC_HANDLE handle, // @pyparm int|scHandle||Handle to control DWORD status, // @pyparm int|code||The service control code. SERVICE_STATUS *outServiceStatus); --- 1379,1383 ---- // @rdesc The result is the new service status. BOOLAPI ControlService( ! SC_HANDLE handle, // @pyparm <o PySC_HANDLE>|scHandle||Handle to control DWORD status, // @pyparm int|code||The service control code. SERVICE_STATUS *outServiceStatus); *************** *** 1284,1294 **** // @pyswig |DeleteService|Deletes the specified service BOOLAPI DeleteService(SC_HANDLE); ! // @pyparm int|scHandle||Handle to delete ! // @pyswig int/(int, int)|CreateService|Creates a new service. %name (CreateService) PyObject * MyCreateService( ! SC_HANDLE hSCManager, // @pyparm int|scHandle||handle to service control manager database ! TCHAR *name, // @pyparm <o PyUnicode>|name||Name of service ! TCHAR *displayName, // @pyparm <o PyUnicode>|displayName||Display name DWORD dwDesiredAccess, // @pyparm int|desiredAccess||type of access to service DWORD dwServiceType, // @pyparm int|serviceType||type of service --- 1385,1395 ---- // @pyswig |DeleteService|Deletes the specified service BOOLAPI DeleteService(SC_HANDLE); ! // @pyparm <o PySC_HANDLE>|scHandle||Handle to service to be deleted ! // @pyswig <o PySC_HANDLE>/(<o PySC_HANDLE>, int)|CreateService|Creates a new service. %name (CreateService) PyObject * MyCreateService( ! SC_HANDLE hSCManager, // @pyparm <o PySC_HANDLE>|scHandle||handle to service control manager database ! TCHAR *name, // @pyparm <o PyUnicode>|name||Name of service ! TCHAR *displayName, // @pyparm <o PyUnicode>|displayName||Display name DWORD dwDesiredAccess, // @pyparm int|desiredAccess||type of access to service DWORD dwServiceType, // @pyparm int|serviceType||type of service *************** *** 1305,1309 **** // @pyswig int/None|ChangeServiceConfig|Changes the configuration of an existing service. %name (ChangeServiceConfig) PyObject * MyChangeServiceConfig( ! SC_HANDLE hSCManager, // @pyparm int|scHandle||handle to service control manager database DWORD dwServiceType, // @pyparm int|serviceType||type of service, or SERVICE_NO_CHANGE DWORD dwStartType, // @pyparm int|startType||When/how to start service, or SERVICE_NO_CHANGE --- 1406,1410 ---- // @pyswig int/None|ChangeServiceConfig|Changes the configuration of an existing service. %name (ChangeServiceConfig) PyObject * MyChangeServiceConfig( ! SC_HANDLE hService, // @pyparm <o PySC_HANDLE>|hService||handle to service to be modified DWORD dwServiceType, // @pyparm int|serviceType||type of service, or SERVICE_NO_CHANGE DWORD dwStartType, // @pyparm int|startType||When/how to start service, or SERVICE_NO_CHANGE *************** *** 1311,1324 **** TCHAR *INPUT_NULLOK, // @pyparm <o PyUnicode>|binaryFile||name of binary file, or None TCHAR *INPUT_NULLOK, // @pyparm <o PyUnicode>|loadOrderGroup||name of load ordering group , or None ! BOOL bFetchTag, // @pyparm int|bFetchTag||Should the tag be fetched and returned? If TRUE, the result is the tag, else None. PyObject *pyobject, // @pyparm [<o PyUnicode>,...]|serviceDeps||sequence of dependency names TCHAR *INPUT_NULLOK, // @pyparm <o PyUnicode>|acctName||account name of service, or None ! TCHAR *INPUT_NULLOK, // @pyparm <o PyUnicode>|password||password for service account , or None ! TCHAR *INPUT_NULLOK // @pyparm <o PyUnicode>|displayName||Display name ); // @pyswig int|LockServiceDatabase|Locks the service database. SC_LOCK LockServiceDatabase( ! SC_HANDLE handle // @pyparm int|sc_handle||A handle to the SCM. ); --- 1412,1425 ---- TCHAR *INPUT_NULLOK, // @pyparm <o PyUnicode>|binaryFile||name of binary file, or None TCHAR *INPUT_NULLOK, // @pyparm <o PyUnicode>|loadOrderGroup||name of load ordering group , or None ! BOOL bFetchTag, // @pyparm int|bFetchTag||Should the tag be fetched and returned? If TRUE, the result is the tag, else None. PyObject *pyobject, // @pyparm [<o PyUnicode>,...]|serviceDeps||sequence of dependency names TCHAR *INPUT_NULLOK, // @pyparm <o PyUnicode>|acctName||account name of service, or None ! TCHAR *INPUT_NULLOK, // @pyparm <o PyUnicode>|password||password for service account , or None ! TCHAR *INPUT_NULLOK // @pyparm <o PyUnicode>|displayName||Display name ); // @pyswig int|LockServiceDatabase|Locks the service database. SC_LOCK LockServiceDatabase( ! SC_HANDLE handle // @pyparm <o PySC_HANDLE>|sc_handle||A handle to the SCM. ); *************** *** 1332,1342 **** static PyObject *PyQueryServiceLockStatus(PyObject *self, PyObject *args) { ! long handle; ! // @pyparm int|handle||Handle to the SCM. ! if (!PyArg_ParseTuple(args, "l:QueryServiceLockStatus", &handle)) return NULL; - DWORD bufSize; ! QueryServiceLockStatus((SC_HANDLE)handle, NULL, 0, &bufSize); if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return PyWin_SetAPIError("QueryServiceLockStatus"); --- 1433,1445 ---- static PyObject *PyQueryServiceLockStatus(PyObject *self, PyObject *args) { ! SC_HANDLE handle; ! PyObject *obhandle; ! // @pyparm <o PySC_HANDLE>|hSCManager||Handle to the SCM. ! if (!PyArg_ParseTuple(args, "O:QueryServiceLockStatus", &obhandle)) ! return NULL; ! if (!PyWinObject_AsHANDLE(obhandle, (HANDLE *)&handle, FALSE)) return NULL; DWORD bufSize; ! QueryServiceLockStatus(handle, NULL, 0, &bufSize); if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return PyWin_SetAPIError("QueryServiceLockStatus"); *************** *** 1499,1502 **** --- 1602,1606 ---- } SC_HANDLE hService; + PyObject *obhService; DWORD level; BOOL bsuccess; *************** *** 1504,1511 **** SERVICE_FAILURE_ACTIONSW failure_actions_buf; PyObject *obinfo; ! // @pyparm int|hService||Service handle as returned by <om win32service.OpenService> // @pyparm int|InfoLevel||Indicates type of config parameters being set, one of SERVICE_CONFIG_DESCRIPTION or SERVICE_CONFIG_FAILURE_ACTIONS // @pyparm object|info||For SERVICE_CONFIG_DESCRIPTION a string For SERVICE_CONFIG_FAILURE_ACTIONS a <o SERVICE_FAILURE_ACTIONS> dictionary ! if (!PyArg_ParseTuple(args,"llO:ChangeServiceConfig2", &hService, &level, &obinfo)) return NULL; switch (level){ --- 1608,1617 ---- SERVICE_FAILURE_ACTIONSW failure_actions_buf; PyObject *obinfo; ! // @pyparm <o PySC_HANDLE>|hService||Service handle as returned by <om win32service.OpenService> // @pyparm int|InfoLevel||Indicates type of config parameters being set, one of SERVICE_CONFIG_DESCRIPTION or SERVICE_CONFIG_FAILURE_ACTIONS // @pyparm object|info||For SERVICE_CONFIG_DESCRIPTION a string For SERVICE_CONFIG_FAILURE_ACTIONS a <o SERVICE_FAILURE_ACTIONS> dictionary ! if (!PyArg_ParseTuple(args,"OlO:ChangeServiceConfig2", &obhService, &level, &obinfo)) ! return NULL; ! if (!PyWinObject_AsHANDLE(obhService, (HANDLE *)&hService, FALSE)) return NULL; switch (level){ *************** *** 1543,1552 **** } SC_HANDLE hService; DWORD level, bytes_needed=0, bufsize=0; LPBYTE buf=NULL; PyObject *ret=NULL; ! // @pyparm int|hService||Service handle as returned by <om win32service.OpenService> // @pyparm int|InfoLevel||SERVICE_CONFIG_DESCRIPTION or SERVICE_CONFIG_FAILURE_ACTIONS ! if (!PyArg_ParseTuple(args,"ll:QueryServiceConfig2", &hService, &level)) return NULL; (*fpQueryServiceConfig2)(hService, level, buf, bufsize, &bytes_needed); --- 1649,1661 ---- } SC_HANDLE hService; + PyObject *obhService; DWORD level, bytes_needed=0, bufsize=0; LPBYTE buf=NULL; PyObject *ret=NULL; ! // @pyparm <o PySC_HANDLE>|hService||Service handle as returned by <om win32service.OpenService> // @pyparm int|InfoLevel||SERVICE_CONFIG_DESCRIPTION or SERVICE_CONFIG_FAILURE_ACTIONS ! if (!PyArg_ParseTuple(args,"Ol:QueryServiceConfig2", &obhService, &level)) ! return NULL; ! if (!PyWinObject_AsHANDLE(obhService, (HANDLE *)&hService, FALSE)) return NULL; (*fpQueryServiceConfig2)(hService, level, buf, bufsize, &bytes_needed); |