pywin32-checkins Mailing List for Python for Windows Extensions (Page 93)
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-04-01 13:24:09
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23323/win32/src Modified Files: win32gui.i Log Message: Add DrawTextW Index: win32gui.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32gui.i,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** win32gui.i 28 Mar 2007 12:29:33 -0000 1.104 --- win32gui.i 1 Apr 2007 13:24:04 -0000 1.105 *************** *** 74,77 **** --- 74,79 ---- typedef DWORD (WINAPI *SetLayoutfunc)(HDC, DWORD); static SetLayoutfunc pfnSetLayout=NULL; + typedef int (WINAPI *DrawTextWfunc)(HDC,LPWSTR,int,LPRECT,UINT); + static DrawTextWfunc pfnDrawTextW = NULL; static PyObject *g_AtomMap = NULL; // Mapping class atoms to Python WNDPROC *************** *** 234,244 **** for (PyMethodDef *pmd = win32guiMethods; pmd->ml_name; pmd++) #endif ! if (strcmp(pmd->ml_name, "SetLayeredWindowAttributes")==0 || ! strcmp(pmd->ml_name, "GetLayeredWindowAttributes")==0 || ! strcmp(pmd->ml_name, "UpdateLayeredWindow")==0 || ! strcmp(pmd->ml_name, "AnimateWindow")==0 || ! strcmp(pmd->ml_name, "GetOpenFileNameW")==0 || ! strcmp(pmd->ml_name, "GetSaveFileNameW")==0 || ! strcmp(pmd->ml_name, "SystemParametersInfo")==0) pmd->ml_flags = METH_VARARGS | METH_KEYWORDS; --- 236,248 ---- for (PyMethodDef *pmd = win32guiMethods; pmd->ml_name; pmd++) #endif ! if (strcmp(pmd->ml_name, "SetLayeredWindowAttributes")==0 ! ||strcmp(pmd->ml_name, "GetLayeredWindowAttributes")==0 ! ||strcmp(pmd->ml_name, "UpdateLayeredWindow")==0 ! ||strcmp(pmd->ml_name, "AnimateWindow")==0 ! ||strcmp(pmd->ml_name, "GetOpenFileNameW")==0 ! ||strcmp(pmd->ml_name, "GetSaveFileNameW")==0 ! ||strcmp(pmd->ml_name, "SystemParametersInfo")==0 ! ||strcmp(pmd->ml_name, "DrawTextW")==0 ! ) pmd->ml_flags = METH_VARARGS | METH_KEYWORDS; *************** *** 253,256 **** --- 257,261 ---- pfnGetMenuInfo=(GetMenuInfofunc)GetProcAddress(hmodule,"GetMenuInfo"); pfnSetMenuInfo=(SetMenuInfofunc)GetProcAddress(hmodule,"SetMenuInfo"); + pfnDrawTextW=(DrawTextWfunc)GetProcAddress(hmodule, "DrawTextW"); } *************** *** 268,272 **** pfnGetLayout=(GetLayoutfunc)GetProcAddress(hmodule,"GetLayout"); pfnSetLayout=(SetLayoutfunc)GetProcAddress(hmodule,"SetLayout"); - } --- 273,276 ---- *************** *** 389,393 **** } - // @object PyRECT|Tuple of 4 ints defining a rectangle: (left, top, right, bottom) %typemap(python,in) RECT *INPUT(RECT rect_input) { --- 393,396 ---- *************** *** 7183,7184 **** --- 7186,7228 ---- %native (CreateBrushIndirect) PyCreateBrushIndirect; %native (ExtCreatePen) PyExtCreatePen; + + // @pyswig int,<o PyRECT>|DrawTextW|Draws Unicode text on a device context. + // @comm Accepts keyword args. + // @rdesc Returns the height of the drawn text, and the rectangle coordinates + %{ + PyObject *PyDrawTextW(PyObject *self, PyObject *args, PyObject *kwargs) + { + CHECK_PFN(DrawTextW); + static char *keywords[]={"hDC","String","Count","Rect","Format", NULL}; + HDC hdc; + WCHAR *input_text; + int len, height; + RECT rc; + UINT fmt; + PyObject *obhdc, *obtxt, *obrc; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOiOI:DrawTextW", keywords, + &obhdc, // @pyparm <o PyHANDLE>|hDC||Handle to a device context + &obtxt, // @pyparm <o PyUnicode>|String||Text to be drawn + &len, // @pyparm int|Count||Number of characters to draw, use -1 for entire null terminated string + &obrc, // @pyparm <o PyRECT>|Rect||Rectangle in which to draw text + &fmt)) // @pyparm int|Format||Formatting flags, combination of win32con.DT_* values + return NULL; + if (!PyWinObject_AsHANDLE(obhdc, (HANDLE *)&hdc, FALSE)) + return NULL; + if (!PyWinObject_AsRECT(obrc, &rc)) + return NULL; + if (!PyWinObject_AsWCHAR(obtxt, &input_text, FALSE)) + return NULL; + + height=(*pfnDrawTextW)(hdc, input_text, len, &rc, fmt); + PyWinObject_FreeWCHAR(input_text); + if (!height) + return PyWin_SetAPIError("DrawTextW"); + return Py_BuildValue("iN", + height, + PyWinObject_FromRECT(&rc)); + } + PyCFunction pfnPyDrawTextW=(PyCFunction)PyDrawTextW; + %} + %native (DrawTextW) pfnPyDrawTextW; |
From: Roger U. <ru...@us...> - 2007-04-01 13:07:44
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17137/win32/src Modified Files: PyWinTypes.h PyWinTypesmodule.cpp win32api_display.cpp Log Message: Move RECT conversion functions into pywintypes Index: win32api_display.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32api_display.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** win32api_display.cpp 12 Jul 2006 11:30:01 -0000 1.3 --- win32api_display.cpp 1 Apr 2007 13:07:41 -0000 1.4 *************** *** 277,303 **** } - // @object PyRECT|Tuple of 4 ints: (left, top, right, bottom) - BOOL PyWinObject_AsRECT(PyObject *obrect, LPRECT prect) - { - if (!PyTuple_Check(obrect)){ - PyErr_SetString(PyExc_TypeError, "RECT must be a tuple of 4 ints (left, top, right, bottom)"); - return FALSE; - } - return PyArg_ParseTuple(obrect, "llll;RECT must be a tuple of 4 ints (left, top, right, bottom)", - &prect->left, &prect->top, &prect->right, &prect->bottom); - } - - PyObject *PyWinObject_FromRECT(LPRECT prect) - { - if (prect==NULL){ - Py_INCREF(Py_None); - return Py_None; - } - return Py_BuildValue("llll", - prect->left, prect->top, - prect->right, prect->bottom); - } - - // @pymethod int|win32api|ChangeDisplaySettings|Changes video mode for default display // @rdesc Returns DISP_CHANGE_SUCCESSFUL on success, or one of the DISP_CHANGE_* error constants on failure --- 277,280 ---- *************** *** 362,366 **** // @pyparm int|DevNum|0|Index of device of interest, starting with zero // @pyparm int|Flags|0|Reserved, use 0 if passed in ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|zkk", keywords, &Device, &DevNum, &Flags)) return NULL; --- 339,343 ---- // @pyparm int|DevNum|0|Index of device of interest, starting with zero // @pyparm int|Flags|0|Reserved, use 0 if passed in ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|zkk:EnumDisplayDevices", keywords, &Device, &DevNum, &Flags)) return NULL; *************** *** 457,461 **** LPRECT prect; PyObject *obhdc=Py_None, *obrect=Py_None; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO", keywords, &obhdc, // @pyparm <o PyHANDLE>|hdc|None|Handle to device context, use None for virtual desktop &obrect)) // @pyparm <o PyRECT>|rcClip|None|Clipping rectangle, can be None --- 434,438 ---- LPRECT prect; PyObject *obhdc=Py_None, *obrect=Py_None; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:EnumDisplayMonitors", keywords, &obhdc, // @pyparm <o PyHANDLE>|hdc|None|Handle to device context, use None for virtual desktop &obrect)) // @pyparm <o PyRECT>|rcClip|None|Clipping rectangle, can be None Index: PyWinTypesmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypesmodule.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** PyWinTypesmodule.cpp 20 Feb 2007 10:05:39 -0000 1.26 --- PyWinTypesmodule.cpp 1 Apr 2007 13:07:41 -0000 1.27 *************** *** 647,650 **** --- 647,672 ---- } + // @object PyRECT|Tuple of 4 ints defining a rectangle: (left, top, right, bottom) + BOOL PyWinObject_AsRECT(PyObject *obrect, LPRECT prect) + { + if (!PyTuple_Check(obrect)){ + PyErr_SetString(PyExc_TypeError, "RECT must be a tuple of 4 ints (left, top, right, bottom)"); + return FALSE; + } + return PyArg_ParseTuple(obrect, "llll;RECT must be a tuple of 4 ints (left, top, right, bottom)", + &prect->left, &prect->top, &prect->right, &prect->bottom); + } + + PyObject *PyWinObject_FromRECT(LPRECT prect) + { + if (prect==NULL){ + Py_INCREF(Py_None); + return Py_None; + } + return Py_BuildValue("llll", + prect->left, prect->top, + prect->right, prect->bottom); + } + /* List of functions exported by this module */ Index: PyWinTypes.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypes.h,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** PyWinTypes.h 14 Mar 2007 04:29:35 -0000 1.36 --- PyWinTypes.h 1 Apr 2007 13:07:41 -0000 1.37 *************** *** 356,359 **** --- 356,364 ---- PYWINTYPES_EXPORT BOOL PyWinObject_AsPARAM(PyObject *ob, WPARAM *pparam); + // RECT conversions + // @object PyRECT|Tuple of 4 ints defining a rectangle: (left, top, right, bottom) + PYWINTYPES_EXPORT BOOL PyWinObject_AsRECT(PyObject *obrect, LPRECT prect); + PYWINTYPES_EXPORT PyObject *PyWinObject_FromRECT(LPRECT prect); + /* ** SECURITY_ATTRIBUTES support |
From: Mark H. <mha...@us...> - 2007-03-28 12:34:51
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27242/com/win32com/client Modified Files: makepy.py Log Message: Allow GetTypeLibsForSpec (and therefore the makepy cmdline) to accept a ProgID of a COM object along with a typelib spec) Index: makepy.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/makepy.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** makepy.py 12 Jul 2006 12:39:28 -0000 1.22 --- makepy.py 28 Mar 2007 12:34:51 -0000 1.23 *************** *** 70,74 **** import selecttlb import gencache ! from win32com.client import NeedUnicodeConversions bForDemandDefault = 0 # Default value of bForDemand - toggle this to change the world - see also gencache.py --- 70,74 ---- import selecttlb import gencache ! from win32com.client import NeedUnicodeConversions, Dispatch bForDemandDefault = 0 # Default value of bForDemand - toggle this to change the world - see also gencache.py *************** *** 164,170 **** def GetTypeLibsForSpec(arg): ! """Given an argument on the command line (either a file name or a library description) ! return a list of actual typelibs to use. ! """ typelibs = [] try: --- 164,170 ---- def GetTypeLibsForSpec(arg): ! """Given an argument on the command line (either a file name, library ! description, or ProgID of an object) return a list of actual typelibs ! to use. """ typelibs = [] try: *************** *** 178,181 **** --- 178,192 ---- tlbs = selecttlb.FindTlbsWithDescription(arg) if len(tlbs)==0: + # Maybe it is the name of a COM object? + try: + ob = Dispatch(arg) + # and if so, it must support typelib info + tlb, index = ob._oleobj_.GetTypeInfo().GetContainingTypeLib() + spec = selecttlb.TypelibSpec(None, 0,0,0) + spec.FromTypelib(tlb) + tlbs.append(spec) + except pythoncom.com_error: + pass + if len(tlbs)==0: print "Could not locate a type library matching '%s'" % (arg) for spec in tlbs: |
From: Mark H. <mha...@us...> - 2007-03-28 12:30:33
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/extensions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26080/com/win32com/src/extensions Modified Files: PyTYPEATTR.cpp Log Message: autoduck Index: PyTYPEATTR.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyTYPEATTR.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyTYPEATTR.cpp 1 Sep 1999 23:03:33 -0000 1.1 --- PyTYPEATTR.cpp 28 Mar 2007 12:30:33 -0000 1.2 *************** *** 71,75 **** /*static*/ struct memberlist PyTYPEATTR::memberlist[] = { ! {"iid", T_OBJECT,OFF(iid)},// @prop <o PyIID>|IID|The IID {"lcid", T_INT, OFF(lcid)}, // @prop int|lcid|The lcid {"memidConstructor",T_INT, OFF(memidConstructor)}, // @prop int|memidConstructor|ID of constructor --- 71,75 ---- /*static*/ struct memberlist PyTYPEATTR::memberlist[] = { ! {"iid", T_OBJECT,OFF(iid)},// @prop <o PyIID>|iid|The IID {"lcid", T_INT, OFF(lcid)}, // @prop int|lcid|The lcid {"memidConstructor",T_INT, OFF(memidConstructor)}, // @prop int|memidConstructor|ID of constructor *************** *** 85,90 **** {"wMajorVerNum", T_INT, OFF(wMajorVerNum)}, // @prop int|wMajorVerNum|Major version number. {"wMinorVerNum", T_INT, OFF(wMinorVerNum)}, // @prop int|wMinorVerNum|Minor version number. ! {"tdescAlias", T_OBJECT,OFF(obDescAlias)}, // @prop <o TYPEDESC>|obDescAlias|If TypeKind == pythoncom.TKIND_ALIAS, specifies the type for which this type is an alias. ! {"idldescType", T_OBJECT,OFF(obIDLDesc)}, // @prop <o IDLDESC>|obIDLDesc|IDL attributes of the described type. {NULL} }; --- 85,90 ---- {"wMajorVerNum", T_INT, OFF(wMajorVerNum)}, // @prop int|wMajorVerNum|Major version number. {"wMinorVerNum", T_INT, OFF(wMinorVerNum)}, // @prop int|wMinorVerNum|Minor version number. ! {"tdescAlias", T_OBJECT,OFF(obDescAlias)}, // @prop <o TYPEDESC>|tdescAlias|If TypeKind == pythoncom.TKIND_ALIAS, specifies the type for which this type is an alias. ! {"idldescType", T_OBJECT,OFF(obIDLDesc)}, // @prop <o IDLDESC>|idldeskType|IDL attributes of the described type. {NULL} }; |
From: Mark H. <mha...@us...> - 2007-03-28 12:29:34
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25289/win32/src Modified Files: win32gui.i Log Message: Provide useful info in a TypeError relating to OPENFILENAME and document return/exception semantics for GetOpenFileNameW Index: win32gui.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32gui.i,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** win32gui.i 5 Mar 2007 05:55:47 -0000 1.103 --- win32gui.i 28 Mar 2007 12:29:33 -0000 1.104 *************** *** 3562,3568 **** %typemap (python, in) OPENFILENAME *INPUT (int size){ size = sizeof(OPENFILENAME); ! /* $source = PyObject_Str($source); */ ! if ( (! PyString_Check($source)) || (size != PyString_GET_SIZE($source)) ) { ! PyErr_Format(PyExc_TypeError, "Argument must be a %d-byte string", size); return NULL; } --- 3562,3573 ---- %typemap (python, in) OPENFILENAME *INPUT (int size){ size = sizeof(OPENFILENAME); ! if (!PyString_Check($source)) { ! PyErr_Format(PyExc_TypeError, "Argument must be a %d-byte string (got type %s)", ! size, $source->ob_type->tp_name); ! return NULL; ! } ! if (size != PyString_GET_SIZE($source)) { ! PyErr_Format(PyExc_TypeError, "Argument must be a %d-byte string (got string of %d bytes)", ! size, PyString_GET_SIZE($source)); return NULL; } *************** *** 6108,6111 **** --- 6113,6119 ---- // @comm Accepts keyword arguments, all arguments optional // Input parameters and return values are identical to <om win32gui.GetSaveFileNameW> + // @rdesc The result is a tuple of (filename, filter, flags), where the first 2 elements are + // unicode strings, and the last an integer. If the user presses cancel or an error occurs, a + // win32gui.error is raised (and if the user pressed cancel, the error number will be zero) static PyObject *PyGetOpenFileNameW(PyObject *self, PyObject *args, PyObject *kwargs) { |
From: Mark H. <mha...@us...> - 2007-03-28 12:26:53
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24514/Pythonwin Modified Files: win32uimodule.cpp Log Message: Happy New Year :) Index: win32uimodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32uimodule.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** win32uimodule.cpp 11 Jul 2006 05:18:30 -0000 1.32 --- win32uimodule.cpp 28 Mar 2007 12:26:50 -0000 1.33 *************** *** 2241,2245 **** // drop email addy - too many ppl use it for support requests for other // tools that simply embed Pythonwin... ! PyObject *copyright = PyString_FromString("Copyright 1994-2006 Mark Hammond"); PyDict_SetItemString(dict, "copyright", copyright); Py_XDECREF(copyright); --- 2241,2245 ---- // drop email addy - too many ppl use it for support requests for other // tools that simply embed Pythonwin... ! PyObject *copyright = PyString_FromString("Copyright 1994-2007 Mark Hammond"); PyDict_SetItemString(dict, "copyright", copyright); Py_XDECREF(copyright); |
From: Roger U. <ru...@us...> - 2007-03-18 11:53:56
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15569/win32/src Modified Files: win32file.i Log Message: Add DuplicateEncryptionInfoFile, standardize function pointer loading Index: win32file.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32file.i,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** win32file.i 15 Mar 2007 17:54:01 -0000 1.75 --- win32file.i 17 Mar 2007 03:41:53 -0000 1.76 *************** *** 2665,2678 **** static GetVolumePathNamesForVolumeNamefunc pfnGetVolumePathNamesForVolumeName = NULL; ! static BOOL (WINAPI *pfnEncryptFile)(WCHAR *)=NULL; ! static BOOL (WINAPI *pfnDecryptFile)(WCHAR *, DWORD)=NULL; ! static BOOL (WINAPI *pfnEncryptionDisable)(WCHAR *, BOOL)=NULL; ! static BOOL (WINAPI *pfnFileEncryptionStatus)(WCHAR *, LPDWORD)=NULL; ! static DWORD (WINAPI *pfnQueryUsersOnEncryptedFile)(WCHAR *, PENCRYPTION_CERTIFICATE_HASH_LIST *)=NULL; ! static BOOL (WINAPI *pfnFreeEncryptionCertificateHashList)(PENCRYPTION_CERTIFICATE_HASH_LIST)=NULL; ! static DWORD (WINAPI *pfnQueryRecoveryAgentsOnEncryptedFile)(WCHAR *, PENCRYPTION_CERTIFICATE_HASH_LIST *)=NULL; ! static DWORD (WINAPI *pfnRemoveUsersFromEncryptedFile)(WCHAR *, PENCRYPTION_CERTIFICATE_HASH_LIST)=NULL; ! static DWORD (WINAPI *pfnAddUsersToEncryptedFile)(WCHAR *, PENCRYPTION_CERTIFICATE_LIST)=NULL; ! typedef BOOL (WINAPI *CreateHardLinkfunc)(LPWSTR, LPWSTR, LPSECURITY_ATTRIBUTES); --- 2665,2688 ---- static GetVolumePathNamesForVolumeNamefunc pfnGetVolumePathNamesForVolumeName = NULL; ! typedef BOOL (WINAPI *EncryptFilefunc)(WCHAR *); ! static EncryptFilefunc pfnEncryptFile=NULL; ! typedef BOOL (WINAPI *DecryptFilefunc)(WCHAR *, DWORD); ! static DecryptFilefunc pfnDecryptFile=NULL; ! typedef BOOL (WINAPI *EncryptionDisablefunc)(WCHAR *, BOOL); ! static EncryptionDisablefunc pfnEncryptionDisable=NULL; ! typedef BOOL (WINAPI *FileEncryptionStatusfunc)(WCHAR *, LPDWORD); ! static FileEncryptionStatusfunc pfnFileEncryptionStatus=NULL; ! typedef DWORD (WINAPI *QueryUsersOnEncryptedFilefunc)(WCHAR *, PENCRYPTION_CERTIFICATE_HASH_LIST *); ! static QueryUsersOnEncryptedFilefunc pfnQueryUsersOnEncryptedFile=NULL; ! typedef BOOL (WINAPI *FreeEncryptionCertificateHashListfunc)(PENCRYPTION_CERTIFICATE_HASH_LIST); ! static FreeEncryptionCertificateHashListfunc pfnFreeEncryptionCertificateHashList=NULL; ! typedef DWORD (WINAPI *QueryRecoveryAgentsOnEncryptedFilefunc)(WCHAR *, PENCRYPTION_CERTIFICATE_HASH_LIST *); ! static QueryRecoveryAgentsOnEncryptedFilefunc pfnQueryRecoveryAgentsOnEncryptedFile=NULL; ! typedef DWORD (WINAPI *RemoveUsersFromEncryptedFilefunc)(WCHAR *, PENCRYPTION_CERTIFICATE_HASH_LIST); ! static RemoveUsersFromEncryptedFilefunc pfnRemoveUsersFromEncryptedFile=NULL; ! typedef DWORD (WINAPI *AddUsersToEncryptedFilefunc)(WCHAR *, PENCRYPTION_CERTIFICATE_LIST); ! static AddUsersToEncryptedFilefunc pfnAddUsersToEncryptedFile=NULL; ! typedef DWORD (WINAPI *DuplicateEncryptionInfoFilefunc)(LPWSTR,LPWSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES); ! static DuplicateEncryptionInfoFilefunc pfnDuplicateEncryptionInfoFile = NULL; typedef BOOL (WINAPI *CreateHardLinkfunc)(LPWSTR, LPWSTR, LPSECURITY_ATTRIBUTES); *************** *** 2868,2872 **** static char *keywords[]={"FileName","BufferLength", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|l:GetVolumePathName", keywords, ! &obpath, // @pyparm <o PyUnicode|FileName||File/dir for which to return volume mount point &bufsize)) // @pyparm int|BufferLength|0|Optional parm to allocate extra space for returned string return NULL; --- 2878,2882 ---- static char *keywords[]={"FileName","BufferLength", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|l:GetVolumePathName", keywords, ! &obpath, // @pyparm <o PyUnicode>|FileName||File/dir for which to return volume mount point &bufsize)) // @pyparm int|BufferLength|0|Optional parm to allocate extra space for returned string return NULL; *************** *** 3093,3113 **** py_EncryptFile(PyObject *self, PyObject *args) { ! // @pyparm string/unicode|filename||File to encrypt - PyObject *ret=NULL, *obfname=NULL; - WCHAR *fname = NULL; - if (pfnEncryptFile==NULL) - return PyErr_Format(PyExc_NotImplementedError,"EncryptFile not supported by this version of Windows"); if (!PyArg_ParseTuple(args,"O:EncryptFile", &obfname)) ! return NULL; ! if (!PyWinObject_AsWCHAR(obfname, &fname, FALSE)) ! return NULL; if (!(*pfnEncryptFile)(fname)) ! PyWin_SetAPIError("EncryptFile"); ! else ! ret=Py_None; ! PyWinObject_FreeWCHAR(fname); ! Py_XINCREF(ret); ! return ret; } --- 3103,3122 ---- py_EncryptFile(PyObject *self, PyObject *args) { ! CHECK_PFN(EncryptFile); ! // @pyparm string/unicode|filename||File to encrypt ! PyObject *ret=NULL, *obfname=NULL; ! WCHAR *fname = NULL; if (!PyArg_ParseTuple(args,"O:EncryptFile", &obfname)) ! return NULL; ! if (!PyWinObject_AsWCHAR(obfname, &fname, FALSE)) ! return NULL; if (!(*pfnEncryptFile)(fname)) ! PyWin_SetAPIError("EncryptFile"); ! else ! ret=Py_None; ! PyWinObject_FreeWCHAR(fname); ! Py_XINCREF(ret); ! return ret; } *************** *** 3116,3125 **** py_DecryptFile(PyObject *self, PyObject *args) { // @pyparm string/unicode|filename||File to decrypt PyObject *ret=NULL, *obfname=NULL; WCHAR *fname = NULL; DWORD reserved=0; ! if (pfnDecryptFile==NULL) ! return PyErr_Format(PyExc_NotImplementedError,"DecryptFile not supported by this version of Windows"); if (!PyArg_ParseTuple(args,"O:DecryptFile", &obfname)) return NULL; --- 3125,3134 ---- py_DecryptFile(PyObject *self, PyObject *args) { + CHECK_PFN(DecryptFile); // @pyparm string/unicode|filename||File to decrypt PyObject *ret=NULL, *obfname=NULL; WCHAR *fname = NULL; DWORD reserved=0; ! if (!PyArg_ParseTuple(args,"O:DecryptFile", &obfname)) return NULL; *************** *** 3139,3160 **** py_EncryptionDisable(PyObject *self, PyObject *args) { ! // @pyparm string/unicode|DirName||Directory to enable or disable // @pyparm boolean|Disable||Set to False to enable encryption ! PyObject *ret=NULL, *obfname=NULL; ! WCHAR *fname = NULL; BOOL Disable; ! if (pfnEncryptionDisable==NULL) ! return PyErr_Format(PyExc_NotImplementedError,"EncryptionDisable not supported by this version of Windows"); if (!PyArg_ParseTuple(args,"Oi:EncryptionDisable", &obfname, &Disable)) ! return NULL; ! if (!PyWinObject_AsWCHAR(obfname, &fname, FALSE)) ! return NULL; if (!(*pfnEncryptionDisable)(fname,Disable)) ! PyWin_SetAPIError("EncryptionDisable"); ! else ! ret=Py_None; ! PyWinObject_FreeWCHAR(fname); ! Py_XINCREF(ret); ! return ret; } --- 3148,3169 ---- py_EncryptionDisable(PyObject *self, PyObject *args) { ! CHECK_PFN(EncryptionDisable); ! // @pyparm string/unicode|DirName||Directory to enable or disable // @pyparm boolean|Disable||Set to False to enable encryption ! PyObject *ret=NULL, *obfname=NULL; ! WCHAR *fname = NULL; BOOL Disable; ! if (!PyArg_ParseTuple(args,"Oi:EncryptionDisable", &obfname, &Disable)) ! return NULL; ! if (!PyWinObject_AsWCHAR(obfname, &fname, FALSE)) ! return NULL; if (!(*pfnEncryptionDisable)(fname,Disable)) ! PyWin_SetAPIError("EncryptionDisable"); ! else ! ret=Py_None; ! PyWinObject_FreeWCHAR(fname); ! Py_XINCREF(ret); ! return ret; } *************** *** 3168,3187 **** py_FileEncryptionStatus(PyObject *self, PyObject *args) { ! // @pyparm string/unicode|FileName||file to query ! PyObject *ret=NULL, *obfname=NULL; ! WCHAR *fname = NULL; DWORD Status=0; ! if (pfnFileEncryptionStatus==NULL) ! return PyErr_Format(PyExc_NotImplementedError,"FileEncryptionStatus not supported by this version of Windows"); if (!PyArg_ParseTuple(args,"O:FileEncryptionStatus", &obfname)) ! return NULL; ! if (!PyWinObject_AsWCHAR(obfname, &fname, FALSE)) ! return NULL; if (!(*pfnFileEncryptionStatus)(fname, &Status)) ! PyWin_SetAPIError("FileEncryptionStatus"); ! else ! ret=Py_BuildValue("i",Status); ! PyWinObject_FreeWCHAR(fname); ! return ret; } --- 3177,3196 ---- py_FileEncryptionStatus(PyObject *self, PyObject *args) { ! CHECK_PFN(FileEncryptionStatus); ! // @pyparm string/unicode|FileName||file to query ! PyObject *ret=NULL, *obfname=NULL; ! WCHAR *fname = NULL; DWORD Status=0; ! if (!PyArg_ParseTuple(args,"O:FileEncryptionStatus", &obfname)) ! return NULL; ! if (!PyWinObject_AsWCHAR(obfname, &fname, FALSE)) ! return NULL; if (!(*pfnFileEncryptionStatus)(fname, &Status)) ! PyWin_SetAPIError("FileEncryptionStatus"); ! else ! ret=Py_BuildValue("i",Status); ! PyWinObject_FreeWCHAR(fname); ! return ret; } *************** *** 3456,3462 **** py_QueryUsersOnEncryptedFile(PyObject *self, PyObject *args) { ! // @pyparm string/unicode|FileName||file to query ! if ((pfnQueryUsersOnEncryptedFile==NULL)||(pfnFreeEncryptionCertificateHashList==NULL)) ! return PyErr_Format(PyExc_NotImplementedError,"QueryUsersOnEncryptedFile not supported by this version of Windows"); PyObject *ret=NULL, *obfname=NULL, *ret_item=NULL; WCHAR *fname=NULL; --- 3465,3470 ---- py_QueryUsersOnEncryptedFile(PyObject *self, PyObject *args) { ! CHECK_PFN(QueryUsersOnEncryptedFile); ! // @pyparm string/unicode|FileName||file to query PyObject *ret=NULL, *obfname=NULL, *ret_item=NULL; WCHAR *fname=NULL; *************** *** 3488,3494 **** py_QueryRecoveryAgentsOnEncryptedFile(PyObject *self, PyObject *args) { ! // @pyparm string/unicode|FileName||file to query ! if ((pfnQueryRecoveryAgentsOnEncryptedFile==NULL)||(pfnFreeEncryptionCertificateHashList==NULL)) ! return PyErr_Format(PyExc_NotImplementedError,"QueryRecoveryAgentsOnEncryptedFile not supported by this version of Windows"); PyObject *ret=NULL, *obfname=NULL, *ret_item=NULL; WCHAR *fname=NULL; --- 3496,3501 ---- py_QueryRecoveryAgentsOnEncryptedFile(PyObject *self, PyObject *args) { ! CHECK_PFN(QueryRecoveryAgentsOnEncryptedFile); ! // @pyparm string/unicode|FileName||file to query PyObject *ret=NULL, *obfname=NULL, *ret_item=NULL; WCHAR *fname=NULL; *************** *** 3509,3516 **** if (fname!=NULL) ! PyWinObject_FreeWCHAR(fname); if (pechl!=NULL) (*pfnFreeEncryptionCertificateHashList)(pechl); ! return ret; } --- 3516,3523 ---- if (fname!=NULL) ! PyWinObject_FreeWCHAR(fname); if (pechl!=NULL) (*pfnFreeEncryptionCertificateHashList)(pechl); ! return ret; } *************** *** 3519,3526 **** py_RemoveUsersFromEncryptedFile(PyObject *self, PyObject *args) { ! // @pyparm string/unicode|FileName||File from which to remove users // @pyparm ((<o PySID>,string,unicode),...)|pHashes||Sequence representing an ENCRYPTION_CERTIFICATE_HASH_LIST structure, as returned by QueryUsersOnEncryptedFile - if (pfnRemoveUsersFromEncryptedFile==NULL) - return PyErr_Format(PyExc_NotImplementedError,"RemoveUsersFromEncryptedFile not supported by this version of Windows"); PyObject *ret=NULL, *obfname=NULL, *obechl=NULL; WCHAR *fname=NULL; --- 3526,3532 ---- py_RemoveUsersFromEncryptedFile(PyObject *self, PyObject *args) { ! CHECK_PFN(RemoveUsersFromEncryptedFile); ! // @pyparm string/unicode|FileName||File from which to remove users // @pyparm ((<o PySID>,string,unicode),...)|pHashes||Sequence representing an ENCRYPTION_CERTIFICATE_HASH_LIST structure, as returned by QueryUsersOnEncryptedFile PyObject *ret=NULL, *obfname=NULL, *obechl=NULL; WCHAR *fname=NULL; *************** *** 3545,3549 **** PyWinObject_FreeWCHAR(fname); Py_XINCREF(ret); ! return ret; } --- 3551,3555 ---- PyWinObject_FreeWCHAR(fname); Py_XINCREF(ret); ! return ret; } *************** *** 3552,3555 **** --- 3558,3562 ---- py_AddUsersToEncryptedFile(PyObject *self, PyObject *args) { + CHECK_PFN(AddUsersToEncryptedFile); // @pyparm string/unicode|FileName||File that additional users will be allowed to decrypt // @pyparm ((<o PySID>,string,int),...)|pUsers||Sequence representing *************** *** 3557,3562 **** // users' Sid, encoded EFS certficate (user must export a .cer to obtain // this data), and encoding type (usually 1 for X509_ASN_ENCODING) - if (pfnAddUsersToEncryptedFile==NULL) - return PyErr_Format(PyExc_NotImplementedError,"AddUsersToEncryptedFile not supported by this version of Windows"); PyObject *ret=NULL, *obfname=NULL, *obecl=NULL; WCHAR *fname=NULL; --- 3564,3567 ---- *************** *** 3577,3586 **** ret=Py_None; if (fname!=NULL) ! PyWinObject_FreeWCHAR(fname); PyWinObject_FreePENCRYPTION_CERTIFICATE_LIST(&ecl); Py_XINCREF(ret); ! return ret; } // @pyswig (int, buffer, int)|BackupRead|Reads streams of data from a file // @comm Returns number of bytes read, data buffer, and context pointer for next operation --- 3582,3629 ---- ret=Py_None; if (fname!=NULL) ! PyWinObject_FreeWCHAR(fname); PyWinObject_FreePENCRYPTION_CERTIFICATE_LIST(&ecl); Py_XINCREF(ret); ! return ret; } + // @pyswig |DuplicateEncryptionInfoFile|Duplicates EFS encryption from one file to another + // @pyseeapi DuplicateEncryptionInfoFile + // @comm Requires Windows XP or later + // @comm Accepts keyword arguments. + static PyObject *py_DuplicateEncryptionInfoFile(PyObject *self, PyObject *args, PyObject *kwargs) + { + CHECK_PFN(DuplicateEncryptionInfoFile); + WCHAR *src=NULL, *dst=NULL; + PSECURITY_ATTRIBUTES psa; + PyObject *obsrc, *obdst, *obsa=Py_None, *ret=NULL; + DWORD disp, attr; + static char *keywords[]={"SrcFileName","DstFileName","CreationDisposition","Attributes","SecurityAttributes", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOkk|O:DuplicateEncryptionInfoFile", keywords, + &obsrc, // @pyparm <o PyUnicode>|SrcFileName||Encrypted file to read EFS metadata from + &obdst, // @pyparm <o PyUnicode>|DstFileName||File to be encrypted using EFS data from source file + &disp, // @pyparm int|CreationDisposition||Specifies whether an existing file should be overwritten (CREATE_NEW or CREATE_ALWAYS) + &attr, // @pyparm int|Attributes||File attributes + &obsa)) // @pyparm <o PySECURITY_ATTRIBUTES>|SecurityAttributes|None|Specifies security for destination file + return NULL; + + if (PyWinObject_AsWCHAR(obsrc, &src, FALSE) + &&PyWinObject_AsWCHAR(obdst, &dst, FALSE) + &&PyWinObject_AsSECURITY_ATTRIBUTES(obsa, &psa, TRUE)){ + DWORD err=(*pfnDuplicateEncryptionInfoFile)(src, dst, disp, attr, psa); + if (err==ERROR_SUCCESS){ + Py_INCREF(Py_None); + ret=Py_None; + } + else + PyWin_SetAPIError("DuplicateEncryptionInfoFile", err); + } + PyWinObject_FreeWCHAR(src); + PyWinObject_FreeWCHAR(dst); + return ret; + } + PyCFunction pfnpy_DuplicateEncryptionInfoFile=(PyCFunction)py_DuplicateEncryptionInfoFile; + // @pyswig (int, buffer, int)|BackupRead|Reads streams of data from a file // @comm Returns number of bytes read, data buffer, and context pointer for next operation *************** *** 4760,4763 **** --- 4803,4808 ---- %native (RemoveUsersFromEncryptedFile) py_RemoveUsersFromEncryptedFile; %native (AddUsersToEncryptedFile) py_AddUsersToEncryptedFile; + %native (DuplicateEncryptionInfoFile) pfnpy_DuplicateEncryptionInfoFile; + %native (BackupRead) py_BackupRead; %native (BackupSeek) py_BackupSeek; *************** *** 4813,4816 **** --- 4858,4862 ---- ||(strcmp(pmd->ml_name, "GetVolumePathName")==0) ||(strcmp(pmd->ml_name, "GetVolumePathNamesForVolumeName")==0) + ||(strcmp(pmd->ml_name, "DuplicateEncryptionInfoFile")==0) ||(strcmp(pmd->ml_name, "GetFullPathNameTransacted")==0) // not impl yet ||(strcmp(pmd->ml_name, "GetLongPathNameTransacted")==0) // not impl yet *************** *** 4823,4857 **** HMODULE hmodule; - FARPROC fp; hmodule=GetModuleHandle("AdvAPI32.dll"); if (hmodule==NULL) hmodule=LoadLibrary("AdvAPI32.dll"); if (hmodule){ ! fp=GetProcAddress(hmodule,"EncryptFileW"); ! if (fp) pfnEncryptFile=(BOOL (WINAPI *)(WCHAR *))(fp); ! ! fp=GetProcAddress(hmodule,"DecryptFileW"); ! if (fp) pfnDecryptFile=(BOOL (WINAPI *)(WCHAR *, DWORD))(fp); ! ! fp=GetProcAddress(hmodule,"EncryptionDisable"); ! if (fp) pfnEncryptionDisable=(BOOL (WINAPI *)(WCHAR *, BOOL))(fp); ! ! fp=GetProcAddress(hmodule,"FileEncryptionStatusW"); ! if (fp) pfnFileEncryptionStatus=(BOOL (WINAPI *)(WCHAR *, LPDWORD))(fp); ! ! fp=GetProcAddress(hmodule,"QueryUsersOnEncryptedFile"); ! if (fp) pfnQueryUsersOnEncryptedFile=(DWORD (WINAPI *)(WCHAR *, PENCRYPTION_CERTIFICATE_HASH_LIST *))(fp); ! ! fp=GetProcAddress(hmodule,"FreeEncryptionCertificateHashList"); ! if (fp) pfnFreeEncryptionCertificateHashList=(BOOL (WINAPI *)(PENCRYPTION_CERTIFICATE_HASH_LIST))(fp); ! ! fp=GetProcAddress(hmodule,"QueryRecoveryAgentsOnEncryptedFile"); ! if (fp) pfnQueryRecoveryAgentsOnEncryptedFile=(DWORD (WINAPI *)(WCHAR *,PENCRYPTION_CERTIFICATE_HASH_LIST *))(fp); ! ! fp=GetProcAddress(hmodule,"RemoveUsersFromEncryptedFile"); ! if (fp) pfnRemoveUsersFromEncryptedFile=(DWORD (WINAPI *)(WCHAR *,PENCRYPTION_CERTIFICATE_HASH_LIST))(fp); ! ! fp=GetProcAddress(hmodule,"AddUsersToEncryptedFile"); ! if (fp) pfnAddUsersToEncryptedFile=(DWORD (WINAPI *)(WCHAR *,PENCRYPTION_CERTIFICATE_LIST))(fp); pfnOpenEncryptedFileRaw=(OpenEncryptedFileRawfunc)GetProcAddress(hmodule, "OpenEncryptedFileRawW"); --- 4869,4886 ---- HMODULE hmodule; hmodule=GetModuleHandle("AdvAPI32.dll"); if (hmodule==NULL) hmodule=LoadLibrary("AdvAPI32.dll"); if (hmodule){ ! pfnEncryptFile=(EncryptFilefunc)GetProcAddress(hmodule, "EncryptFileW"); ! pfnDecryptFile=(DecryptFilefunc)GetProcAddress(hmodule, "DecryptFileW"); ! pfnEncryptionDisable=(EncryptionDisablefunc)GetProcAddress(hmodule, "EncryptionDisable"); ! pfnFileEncryptionStatus=(FileEncryptionStatusfunc)GetProcAddress(hmodule, "FileEncryptionStatusW"); ! pfnQueryUsersOnEncryptedFile=(QueryUsersOnEncryptedFilefunc)GetProcAddress(hmodule, "QueryUsersOnEncryptedFile"); ! pfnFreeEncryptionCertificateHashList=(FreeEncryptionCertificateHashListfunc)GetProcAddress(hmodule, "FreeEncryptionCertificateHashList"); ! pfnQueryRecoveryAgentsOnEncryptedFile=(QueryRecoveryAgentsOnEncryptedFilefunc)GetProcAddress(hmodule, "QueryRecoveryAgentsOnEncryptedFile"); ! pfnRemoveUsersFromEncryptedFile=(RemoveUsersFromEncryptedFilefunc)GetProcAddress(hmodule, "RemoveUsersFromEncryptedFile"); ! pfnAddUsersToEncryptedFile=(AddUsersToEncryptedFilefunc)GetProcAddress(hmodule, "AddUsersToEncryptedFile"); ! pfnDuplicateEncryptionInfoFile=(DuplicateEncryptionInfoFilefunc)GetProcAddress(hmodule, "DuplicateEncryptionInfoFile"); pfnOpenEncryptedFileRaw=(OpenEncryptedFileRawfunc)GetProcAddress(hmodule, "OpenEncryptedFileRawW"); |
From: Roger U. <ru...@us...> - 2007-03-15 17:54:07
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3177/win32/src Modified Files: win32file.i Log Message: Add GetVolumePathNamesForVolumeName, and convert the volume mount point functions to keyword args Index: win32file.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32file.i,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** win32file.i 4 Mar 2007 03:33:30 -0000 1.74 --- win32file.i 15 Mar 2007 17:54:01 -0000 1.75 *************** *** 2653,2659 **** %{ #define CHECK_PFN(fname) if (pfn##fname==NULL) return PyErr_Format(PyExc_NotImplementedError,"%s is not available on this platform", #fname); ! static BOOL (WINAPI *pfnGetVolumeNameForVolumeMountPointW)(LPCWSTR, LPCWSTR, DWORD) = NULL; ! static BOOL (WINAPI *pfnSetVolumeMountPointW)(LPCWSTR, LPCWSTR) = NULL; ! static BOOL (WINAPI *pfnDeleteVolumeMountPointW)(LPCWSTR) = NULL; static BOOL (WINAPI *pfnEncryptFile)(WCHAR *)=NULL; static BOOL (WINAPI *pfnDecryptFile)(WCHAR *, DWORD)=NULL; --- 2653,2668 ---- %{ #define CHECK_PFN(fname) if (pfn##fname==NULL) return PyErr_Format(PyExc_NotImplementedError,"%s is not available on this platform", #fname); ! ! typedef BOOL (WINAPI *GetVolumeNameForVolumeMountPointfunc)(LPCWSTR, LPCWSTR, DWORD); ! static GetVolumeNameForVolumeMountPointfunc pfnGetVolumeNameForVolumeMountPoint = NULL; ! typedef BOOL (WINAPI *SetVolumeMountPointfunc)(LPCWSTR, LPCWSTR); ! static SetVolumeMountPointfunc pfnSetVolumeMountPoint = NULL; ! typedef BOOL (WINAPI *DeleteVolumeMountPointfunc)(LPCWSTR); ! static DeleteVolumeMountPointfunc pfnDeleteVolumeMountPoint = NULL; ! typedef BOOL (WINAPI *GetVolumePathNamefunc)(WCHAR *, WCHAR *, DWORD); ! static GetVolumePathNamefunc pfnGetVolumePathName=NULL; ! typedef BOOL (WINAPI *GetVolumePathNamesForVolumeNamefunc)(LPCWSTR,LPWSTR,DWORD,PDWORD); ! static GetVolumePathNamesForVolumeNamefunc pfnGetVolumePathNamesForVolumeName = NULL; ! static BOOL (WINAPI *pfnEncryptFile)(WCHAR *)=NULL; static BOOL (WINAPI *pfnDecryptFile)(WCHAR *, DWORD)=NULL; *************** *** 2665,2669 **** static DWORD (WINAPI *pfnRemoveUsersFromEncryptedFile)(WCHAR *, PENCRYPTION_CERTIFICATE_HASH_LIST)=NULL; static DWORD (WINAPI *pfnAddUsersToEncryptedFile)(WCHAR *, PENCRYPTION_CERTIFICATE_LIST)=NULL; ! static BOOL (WINAPI *pfnGetVolumePathNameW)(WCHAR *, WCHAR *, DWORD)=NULL; typedef BOOL (WINAPI *CreateHardLinkfunc)(LPWSTR, LPWSTR, LPSECURITY_ATTRIBUTES); --- 2674,2678 ---- static DWORD (WINAPI *pfnRemoveUsersFromEncryptedFile)(WCHAR *, PENCRYPTION_CERTIFICATE_HASH_LIST)=NULL; static DWORD (WINAPI *pfnAddUsersToEncryptedFile)(WCHAR *, PENCRYPTION_CERTIFICATE_LIST)=NULL; ! typedef BOOL (WINAPI *CreateHardLinkfunc)(LPWSTR, LPWSTR, LPSECURITY_ATTRIBUTES); *************** *** 2749,2841 **** ! // @pyswig <o PyUnicode>|SetVolumeMountPoint|Mounts the specified volume at the specified volume mount point. static PyObject* ! py_SetVolumeMountPoint(PyObject *self, PyObject *args) { ! // @ex Usage|SetVolumeMountPoint('h:\tmp\','c:\') ! // @pyparm string|mountPoint||The mount point - must be an existing empty directory on an NTFS volume ! // @pyparm string|volumeName||The volume to mount there ! // @comm Note that both parameters must have trailing backslashes. ! // @rdesc The result is the GUID of the volume mounted, as a string. ! // @comm This method exists only on Windows 2000.If there ! // is an attempt to use it on these platforms, an error with E_NOTIMPL will be raised. ! PyObject *ret=NULL; ! PyObject *volume_obj = NULL, *mount_point_obj = NULL; ! // LPWSTR volume = NULL, mount_point = NULL; ! ! WCHAR *volume = NULL; ! WCHAR *mount_point = NULL; ! WCHAR volume_name[50]; ! if ((pfnSetVolumeMountPointW==NULL)||(pfnGetVolumeNameForVolumeMountPointW==NULL)) ! return PyErr_Format(PyExc_NotImplementedError,"SetVolumeMountPoint not supported by this version of Windows"); ! ! if (!PyArg_ParseTuple(args,"OO:SetVolumeMountPoint", &mount_point_obj, &volume_obj)) ! return NULL; ! ! if (!PyWinObject_AsWCHAR(mount_point_obj, &mount_point, false)){ ! PyErr_SetString(PyExc_TypeError,"Mount point must be string or unicode"); ! goto cleanup; ! } ! if (!PyWinObject_AsWCHAR(volume_obj, &volume, false)){ ! PyErr_SetString(PyExc_TypeError,"Volume name must be string or unicode"); ! goto cleanup; ! } ! assert(pfnGetVolumeNameForVolumeMountPointW); ! if (!(*pfnGetVolumeNameForVolumeMountPointW)(volume,volume_name,sizeof(volume_name)/sizeof(volume_name[0]))){ ! PyWin_SetAPIError("GetVolumeNameForVolumeMountPoint"); ! goto cleanup; ! } ! assert(pfnSetVolumeMountPointW); ! if (!(*pfnSetVolumeMountPointW)(mount_point, volume_name)){ ! PyWin_SetAPIError("SetVolumeMountPoint"); ! goto cleanup; ! } ! ret=PyWinObject_FromWCHAR(volume_name); ! cleanup: ! PyWinObject_FreeWCHAR(volume); ! PyWinObject_FreeWCHAR(mount_point); ! return ret; } ! // @pyswig |DeleteVolumeMountPoint|Unmounts the volume from the specified volume mount point. ! static PyObject* ! py_DeleteVolumeMountPoint(PyObject *self, PyObject *args) { ! // @ex Usage|DeleteVolumeMountPoint('h:\tmp\') ! // @pyparm string|mountPoint||The mount point to delete - must have a trailing backslash. ! // @comm Throws an error if it is not a valid mount point, returns None on success. ! // <nl>Use carefully - will remove drive letter assignment if no directory specified ! // @comm This method exists only on Windows 2000.If there ! // is an attempt to use it on these platforms, an error with E_NOTIMPL will be raised. ! PyObject *ret=NULL; ! PyObject *mount_point_obj = NULL; ! WCHAR *mount_point = NULL; ! if (pfnDeleteVolumeMountPointW==NULL) ! return PyErr_Format(PyExc_NotImplementedError,"DeleteVolumeMountPoint not supported by this version of Windows"); ! if (!PyArg_ParseTuple(args,"O:DeleteVolumeMountPoint", &mount_point_obj)) ! return NULL; ! if (!PyWinObject_AsWCHAR(mount_point_obj, &mount_point, false)){ ! PyErr_SetString(PyExc_TypeError,"Mount point must be string or unicode"); ! goto cleanup; ! } ! if (!(*pfnDeleteVolumeMountPointW)(mount_point)){ ! PyWin_SetAPIError("DeleteVolumeMountPoint"); ! } ! else ! ret=Py_None; ! PyWinObject_FreeWCHAR(mount_point); ! cleanup: ! Py_XINCREF(ret); ! return ret; } // @pyswig |CreateHardLink|Establishes an NTFS hard link between an existing file and a new file. --- 2758,2940 ---- ! // @pyswig <o PyUnicode>|SetVolumeMountPoint|Mounts the specified volume at the specified volume mount point. ! // @comm Accepts keyword args. static PyObject* ! py_SetVolumeMountPoint(PyObject *self, PyObject *args, PyObject *kwargs) { ! // @ex Usage|SetVolumeMountPoint('h:\tmp\','c:\') ! // @comm Note that both parameters must have trailing backslashes. ! // @rdesc The result is the GUID of the volume mounted, as a string. ! // @comm This method exists only on Windows 2000 or later. On earlier platforms, NotImplementedError will be raised. ! CHECK_PFN(GetVolumeNameForVolumeMountPoint); ! CHECK_PFN(SetVolumeMountPoint); ! PyObject *ret=NULL; ! PyObject *volume_obj = NULL, *mount_point_obj = NULL; ! WCHAR *volume = NULL; ! WCHAR *mount_point = NULL; ! WCHAR volume_name[50]; ! static char *keywords[]={"VolumeMountPoint", "VolumeName", NULL}; ! if (!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:SetVolumeMountPoint",keywords, ! &mount_point_obj, // @pyparm <o PyUnicode>|VolumeMountPoint||The mount point - must be an existing empty directory on an NTFS volume ! &volume_obj)) // @pyparm <o PyUnicode>|VolumeName||The volume to mount there ! return NULL; ! if (PyWinObject_AsWCHAR(mount_point_obj, &mount_point, false) ! &&PyWinObject_AsWCHAR(volume_obj, &volume, false)){ ! if (!(*pfnGetVolumeNameForVolumeMountPoint)(volume,volume_name,sizeof(volume_name)/sizeof(volume_name[0]))) ! PyWin_SetAPIError("GetVolumeNameForVolumeMountPoint"); ! else if (!(*pfnSetVolumeMountPoint)(mount_point, volume_name)) ! PyWin_SetAPIError("SetVolumeMountPoint"); ! else ! ret=PyWinObject_FromWCHAR(volume_name); ! } ! PyWinObject_FreeWCHAR(volume); ! PyWinObject_FreeWCHAR(mount_point); ! return ret; ! } ! PyCFunction pfnpy_SetVolumeMountPoint=(PyCFunction)py_SetVolumeMountPoint; ! // @pyswig |DeleteVolumeMountPoint|Unmounts the volume from the specified volume mount point. ! // @comm Accepts keyword args. ! static PyObject* ! py_DeleteVolumeMountPoint(PyObject *self, PyObject *args, PyObject *kwargs) ! { ! // @ex Usage|DeleteVolumeMountPoint('h:\tmp\') ! // @comm Throws an error if it is not a valid mount point, returns None on success. ! // <nl>Use carefully - will remove drive letter assignment if no directory specified ! // @comm This method requires Windows 2000 or later. On earlier platforms, NotImplementedError will be raised. ! CHECK_PFN(DeleteVolumeMountPoint); ! PyObject *ret=NULL; ! PyObject *mount_point_obj = NULL; ! WCHAR *mount_point = NULL; ! static char *keywords[]={"VolumeMountPoint", NULL}; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:DeleteVolumeMountPoint", keywords, ! &mount_point_obj)) // @pyparm <o PyUnicode>|VolumeMountPoint||The mount point to delete - must have a trailing backslash. ! return NULL; ! if (!PyWinObject_AsWCHAR(mount_point_obj, &mount_point, FALSE)) ! return NULL; ! if (!(*pfnDeleteVolumeMountPoint)(mount_point)) ! PyWin_SetAPIError("DeleteVolumeMountPoint"); ! else{ ! Py_INCREF(Py_None); ! ret=Py_None; ! } ! PyWinObject_FreeWCHAR(mount_point); ! return ret; } + PyCFunction pfnpy_DeleteVolumeMountPoint=(PyCFunction)py_DeleteVolumeMountPoint; ! // @pyswig <o PyUnicode>|GetVolumeNameForVolumeMountPoint|Returns unique volume name. ! // @comm Requires Win2K or later. ! // @comm Accepts keyword args. ! static PyObject *py_GetVolumeNameForVolumeMountPoint(PyObject *self, PyObject *args, PyObject *kwargs) { ! PyObject *ret=NULL; ! PyObject *obvolume_name = NULL, *obmount_point = NULL; ! WCHAR *mount_point = NULL; ! WCHAR volume_name[50]; ! CHECK_PFN(GetVolumeNameForVolumeMountPoint); ! static char *keywords[]={"VolumeMountPoint", NULL}; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GetVolumeNameForVolumeMountPoint", keywords, ! &obmount_point)) // @pyparm <o PyUnicode>|VolumeMountPoint||Volume mount point or root drive - trailing backslash required ! return NULL; ! if (!PyWinObject_AsWCHAR(obmount_point, &mount_point, false)) ! return NULL; ! if (!(*pfnGetVolumeNameForVolumeMountPoint)(mount_point, volume_name, sizeof(volume_name)/sizeof(volume_name[0]))) ! PyWin_SetAPIError("GetVolumeNameForVolumeMountPoint"); ! else ! ret=PyWinObject_FromWCHAR(volume_name); ! PyWinObject_FreeWCHAR(mount_point); ! return ret; ! } ! PyCFunction pfnpy_GetVolumeNameForVolumeMountPoint=(PyCFunction)py_GetVolumeNameForVolumeMountPoint; ! // @pyswig <o PyUnicode>|GetVolumePathName|Returns volume mount point for a path ! // @comm Api gives no indication of how much memory is needed, so function assumes returned path ! // will not be longer that length of input path + 1. ! // Use GetFullPathName first for relative paths, or GetLongPathName for 8.3 paths. ! // Optional second parm can also be used to override the buffer size for returned path ! // @comm Accepts keyword args. ! static PyObject *py_GetVolumePathName(PyObject *self, PyObject *args, PyObject *kwargs) ! { ! PyObject *ret=NULL; ! PyObject *obpath = NULL; ! WCHAR *path=NULL, *mount_point=NULL; ! DWORD pathlen, bufsize=0; ! CHECK_PFN(GetVolumePathName); ! static char *keywords[]={"FileName","BufferLength", NULL}; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|l:GetVolumePathName", keywords, ! &obpath, // @pyparm <o PyUnicode|FileName||File/dir for which to return volume mount point ! &bufsize)) // @pyparm int|BufferLength|0|Optional parm to allocate extra space for returned string ! return NULL; ! if (!PyWinObject_AsWCHAR(obpath, &path, FALSE, &pathlen)) ! return NULL; ! // yet another function that doesn't tell us how much memory it needs ... ! if (bufsize>0) ! bufsize+=1; ! else ! bufsize=pathlen+2; // enough to accomodate trailing null, and possibly extra backslash ! mount_point=(WCHAR *)malloc(bufsize*sizeof(WCHAR)); ! if (mount_point==NULL) ! PyErr_SetString(PyExc_MemoryError,"GetVolumePathName: Unable to allocate return buffer"); ! else ! if (!(*pfnGetVolumePathName)(path, mount_point, bufsize)) ! PyWin_SetAPIError("GetVolumePathName"); ! else ! ret=PyWinObject_FromWCHAR(mount_point); ! if (path != NULL) ! PyWinObject_FreeWCHAR(path); ! if (mount_point!=NULL) ! free(mount_point); ! return ret; ! } ! PyCFunction pfnpy_GetVolumePathName=(PyCFunction)py_GetVolumePathName; ! // @pyswig [<o PyUnicode>,...]|GetVolumePathNamesForVolumeName|Returns mounted paths for a volume ! // @comm Requires WinXP or later ! // @comm Accepts keyword args ! static PyObject *py_GetVolumePathNamesForVolumeName(PyObject *self, PyObject *args, PyObject *kwargs) ! { ! PyObject *obvolume, *ret=NULL; ! WCHAR *volume=NULL, *paths=NULL; ! // Preallocate for most common case: 'x:\\' + 2 nulls ! DWORD buf_len=5, reqd_len=0, err; ! static char *keywords[]={"VolumeName", NULL}; ! CHECK_PFN(GetVolumePathNamesForVolumeName); ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GetVolumePathNamesForVolumeName", keywords, ! &obvolume)) // @pyparm <o PyUnicode>|VolumeName||Name of a volume as returned by <om win32file.GetVolumeNameForVolumeMountPoint> ! return NULL; ! if (!PyWinObject_AsWCHAR(obvolume, &volume, FALSE)) ! return NULL; ! while(true){ ! if (paths) ! free(paths); ! paths=(WCHAR *)malloc(buf_len*sizeof(WCHAR)); ! if (paths==NULL){ ! PyErr_Format(PyExc_MemoryError,"Unable to allocate %d characters", buf_len); ! break; ! } ! if ((*pfnGetVolumePathNamesForVolumeName)(volume, paths, buf_len, &reqd_len)){ ! ret=PyWinObject_FromMultipleString(paths); ! break; ! } ! err=GetLastError(); ! if (err!=ERROR_MORE_DATA){ ! PyWin_SetAPIError("GetVolumePathNamesForVolumeName", err); ! break; ! } ! buf_len=reqd_len+2; ! } ! PyWinObject_FreeWCHAR(volume); ! if (paths) ! free(paths); ! return ret; } + PyCFunction pfnpy_GetVolumePathNamesForVolumeName=(PyCFunction)py_GetVolumePathNamesForVolumeName; // @pyswig |CreateHardLink|Establishes an NTFS hard link between an existing file and a new file. *************** *** 2990,3065 **** PyCFunction pfnpy_CreateSymbolicLinkTransacted=(PyCFunction)py_CreateSymbolicLinkTransacted; - // @pyswig <o PyUnicode>|GetVolumeNameForVolumeMountPoint|Returns unique volume name (Win2k or later) - static PyObject* - py_GetVolumeNameForVolumeMountPoint(PyObject *self, PyObject *args) - { - // @pyparm string|mountPoint||Volume mount point or root drive - trailing backslash required - PyObject *ret=NULL; - PyObject *obvolume_name = NULL, *obmount_point = NULL; - - WCHAR *mount_point = NULL; - WCHAR volume_name[50]; - if (pfnGetVolumeNameForVolumeMountPointW==NULL) - return PyErr_Format(PyExc_NotImplementedError,"GetVolumeNameForVolumeMountPoint not supported by this version of Windows"); - - if (!PyArg_ParseTuple(args,"O:GetVolumeNameForVolumeMountPoint", &obmount_point)) - return NULL; - - if (!PyWinObject_AsWCHAR(obmount_point, &mount_point, false)){ - PyErr_SetString(PyExc_TypeError,"Mount point must be string or unicode"); - goto cleanup; - } - - assert(pfnGetVolumeNameForVolumeMountPointW); - if (!(*pfnGetVolumeNameForVolumeMountPointW)(mount_point, volume_name, sizeof(volume_name)/sizeof(volume_name[0]))) - PyWin_SetAPIError("GetVolumeNameForVolumeMountPoint"); - else - ret=PyWinObject_FromWCHAR(volume_name); - cleanup: - PyWinObject_FreeWCHAR(mount_point); - return ret; - } - - // @pyswig <o PyUnicode>|GetVolumePathName|Returns volume mount point for a path - // @comm Api gives no indication of how much memory is needed, so function assumes returned path - // will not be longer that length of input path + 1. - // Use GetFullPathName first for relative paths, or GetLongPathName for 8.3 paths. - // Optional second parm can also be used to override the buffer size for returned path - static PyObject* - py_GetVolumePathName(PyObject *self, PyObject *args) - { - // @pyparm string/unicode|FileName||File/dir for which to return volume mount point - // @pyparm int|bufsize|0|Optional parm to allocate extra space for returned string - PyObject *ret=NULL; - PyObject *obpath = NULL; - WCHAR *path=NULL, *mount_point=NULL; - DWORD pathlen, bufsize=0; - if (pfnGetVolumePathNameW==NULL) - return PyErr_Format(PyExc_NotImplementedError,"GetVolumePathName not supported by this version of Windows"); - if (!PyArg_ParseTuple(args,"O|l:GetVolumePathName", &obpath, &bufsize)) - return NULL; - if (!PyWinObject_AsWCHAR(obpath, &path, FALSE, &pathlen)) - return NULL; - - // yet another function that doesn't tell us how much memory it needs ... - if (bufsize>0) - bufsize+=1; - else - bufsize=pathlen+2; // enough to accomodate trailing null, and possibly extra backslash - mount_point=(WCHAR *)malloc(bufsize*sizeof(WCHAR)); - if (mount_point==NULL) - PyErr_SetString(PyExc_MemoryError,"GetVolumePathName: Unable to allocate return buffer"); - else - if (!(*pfnGetVolumePathNameW)(path, mount_point, bufsize)) - PyWin_SetAPIError("GetVolumePathName"); - else - ret=PyWinObject_FromWCHAR(mount_point); - if (path != NULL) - PyWinObject_FreeWCHAR(path); - if (mount_point!=NULL) - free(mount_point); - return ret; - } - // @pyswig |EncryptFile|Encrypts specified file (requires Win2k or higher and NTFS) static PyObject* --- 3089,3092 ---- *************** *** 4713,4724 **** %} ! %native (SetVolumeMountPoint) py_SetVolumeMountPoint; ! %native (DeleteVolumeMountPoint) py_DeleteVolumeMountPoint; %native (CreateHardLink) pfnpy_CreateHardLink; %native (CreateHardLinkTransacted) pfnpy_CreateHardLinkTransacted; %native (CreateSymbolicLink) pfnpy_CreateSymbolicLink; %native (CreateSymbolicLinkTransacted) pfnpy_CreateSymbolicLinkTransacted; - %native (GetVolumeNameForVolumeMountPoint) py_GetVolumeNameForVolumeMountPoint; - %native (GetVolumePathName) py_GetVolumePathName; // end of win2k volume mount functions. --- 4740,4753 ---- %} ! %native (SetVolumeMountPoint) pfnpy_SetVolumeMountPoint; ! %native (DeleteVolumeMountPoint) pfnpy_DeleteVolumeMountPoint; ! %native (GetVolumeNameForVolumeMountPoint) pfnpy_GetVolumeNameForVolumeMountPoint; ! %native (GetVolumePathName) pfnpy_GetVolumePathName; ! %native (GetVolumePathNamesForVolumeName) pfnpy_GetVolumePathNamesForVolumeName; ! %native (CreateHardLink) pfnpy_CreateHardLink; %native (CreateHardLinkTransacted) pfnpy_CreateHardLinkTransacted; %native (CreateSymbolicLink) pfnpy_CreateSymbolicLink; %native (CreateSymbolicLinkTransacted) pfnpy_CreateSymbolicLinkTransacted; // end of win2k volume mount functions. *************** *** 4779,4782 **** --- 4808,4816 ---- ||(strcmp(pmd->ml_name, "FindStreams")==0) ||(strcmp(pmd->ml_name, "GetFinalPathNameByHandle")==0) + ||(strcmp(pmd->ml_name, "SetVolumeMountPoint")==0) + ||(strcmp(pmd->ml_name, "DeleteVolumeMountPoint")==0) + ||(strcmp(pmd->ml_name, "GetVolumeNameForVolumeMountPoint")==0) + ||(strcmp(pmd->ml_name, "GetVolumePathName")==0) + ||(strcmp(pmd->ml_name, "GetVolumePathNamesForVolumeName")==0) ||(strcmp(pmd->ml_name, "GetFullPathNameTransacted")==0) // not impl yet ||(strcmp(pmd->ml_name, "GetLongPathNameTransacted")==0) // not impl yet *************** *** 4831,4845 **** hmodule=LoadLibrary("kernel32.dll"); if (hmodule){ ! fp = GetProcAddress(hmodule, "GetVolumeNameForVolumeMountPointW"); ! if (fp) pfnGetVolumeNameForVolumeMountPointW = (BOOL (WINAPI *)(LPCWSTR, LPCWSTR, DWORD))(fp); ! ! fp = GetProcAddress(hmodule, "GetVolumePathNameW"); ! if (fp) pfnGetVolumePathNameW = (BOOL (WINAPI *)(WCHAR *, WCHAR *, DWORD))(fp); ! ! fp = GetProcAddress(hmodule, "SetVolumeMountPointW"); ! if (fp) pfnSetVolumeMountPointW = (BOOL (WINAPI *)(LPCWSTR, LPCWSTR))(fp); ! ! fp = GetProcAddress(hmodule, "DeleteVolumeMountPointW"); ! if (fp) pfnDeleteVolumeMountPointW = (BOOL (WINAPI *)(LPCWSTR))(fp); pfnCreateHardLink=(CreateHardLinkfunc)GetProcAddress(hmodule, "CreateHardLinkW"); --- 4865,4873 ---- hmodule=LoadLibrary("kernel32.dll"); if (hmodule){ ! pfnSetVolumeMountPoint=(SetVolumeMountPointfunc)GetProcAddress(hmodule, "SetVolumeMountPointW"); ! pfnDeleteVolumeMountPoint=(DeleteVolumeMountPointfunc)GetProcAddress(hmodule, "DeleteVolumeMountPointW"); ! pfnGetVolumeNameForVolumeMountPoint=(GetVolumeNameForVolumeMountPointfunc)GetProcAddress(hmodule, "GetVolumeNameForVolumeMountPointW"); ! pfnGetVolumePathName=(GetVolumePathNamefunc)GetProcAddress(hmodule, "GetVolumePathNameW"); ! pfnGetVolumePathNamesForVolumeName=(GetVolumePathNamesForVolumeNamefunc)GetProcAddress(hmodule, "GetVolumePathNamesForVolumeNameW"); pfnCreateHardLink=(CreateHardLinkfunc)GetProcAddress(hmodule, "CreateHardLinkW"); |
From: Roger U. <ru...@us...> - 2007-03-14 23:25:58
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11540/win32/src Modified Files: PyUnicode.cpp Log Message: In PyWinObject_FromMultipleString, return empty list instead of list containing an empty string if no strings present Index: PyUnicode.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyUnicode.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** PyUnicode.cpp 14 Mar 2007 04:29:35 -0000 1.22 --- PyUnicode.cpp 14 Mar 2007 23:25:58 -0000 1.23 *************** *** 1037,1041 **** { PyObject *obelement, *ret=NULL; ! int elementlen; if (multistring==NULL){ Py_INCREF(Py_None); --- 1037,1041 ---- { PyObject *obelement, *ret=NULL; ! size_t elementlen; if (multistring==NULL){ Py_INCREF(Py_None); *************** *** 1046,1050 **** return NULL; elementlen=wcslen(multistring); ! do{ obelement=PyWinObject_FromWCHAR(multistring, elementlen); if ((obelement==NULL)||(PyList_Append(ret,obelement)==-1)){ --- 1046,1050 ---- return NULL; elementlen=wcslen(multistring); ! while (elementlen){ obelement=PyWinObject_FromWCHAR(multistring, elementlen); if ((obelement==NULL)||(PyList_Append(ret,obelement)==-1)){ *************** *** 1057,1061 **** elementlen=wcslen(multistring); } - while (elementlen>0); return ret; } --- 1057,1060 ---- *************** *** 1064,1068 **** { PyObject *obelement, *ret=NULL; ! int elementlen; if (multistring==NULL){ Py_INCREF(Py_None); --- 1063,1067 ---- { PyObject *obelement, *ret=NULL; ! size_t elementlen; if (multistring==NULL){ Py_INCREF(Py_None); *************** *** 1073,1077 **** return NULL; elementlen=strlen(multistring); ! do{ obelement=PyString_FromStringAndSize(multistring, elementlen); if ((obelement==NULL)||(PyList_Append(ret,obelement)==-1)){ --- 1072,1076 ---- return NULL; elementlen=strlen(multistring); ! while (elementlen){ obelement=PyString_FromStringAndSize(multistring, elementlen); if ((obelement==NULL)||(PyList_Append(ret,obelement)==-1)){ *************** *** 1084,1088 **** elementlen=strlen(multistring); } - while (elementlen>0); return ret; } --- 1083,1086 ---- |
From: Roger U. <ru...@us...> - 2007-03-14 22:28:54
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21553/win32/src Modified Files: win32service.i Log Message: Return service dependencies as a list, add autoduck for QUERY_SERVICE_CONFIG tuple Index: win32service.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32service.i,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** win32service.i 24 Feb 2007 00:21:03 -0000 1.11 --- win32service.i 14 Mar 2007 22:28:53 -0000 1.12 *************** *** 1028,1035 **** // @pyswig tuple|QueryServiceConfig|Retrieves configuration parameters for a service - // @rdesc Returns a tuple representing a QUERY_SERVICE_CONFIG struct: - // (ServiceType, StartType, ErrorControl, BinaryPathName, LoadOrderGroup, TagId, Dependencies, ServiceStartName, DisplayName) %native (QueryServiceConfig) MyQueryServiceConfig; - %{ static PyObject *MyQueryServiceConfig(PyObject *self, PyObject *args) --- 1028,1032 ---- *************** *** 1070,1094 **** } ! PyObject *obBinaryPathName = PyWinObject_FromTCHAR(config->lpBinaryPathName); ! PyObject *obLoadOrderGroup = PyWinObject_FromTCHAR(config->lpLoadOrderGroup); ! PyObject *obDependencies = PyWinObject_FromTCHAR(config->lpDependencies); ! PyObject *obServiceStartName = PyWinObject_FromTCHAR(config->lpServiceStartName); ! PyObject *obDisplayName = PyWinObject_FromTCHAR(config->lpDisplayName); ! PyObject *retval = Py_BuildValue("lllOOlOOO", config->dwServiceType, config->dwStartType, config->dwErrorControl, ! obBinaryPathName, ! obLoadOrderGroup, config->dwTagId, ! obDependencies, ! obServiceStartName, ! obDisplayName); ! Py_XDECREF(obBinaryPathName); ! Py_XDECREF(obLoadOrderGroup); ! Py_XDECREF(obDependencies); ! Py_XDECREF(obServiceStartName); ! Py_XDECREF(obDisplayName); ! delete buffer; return retval; --- 1067,1090 ---- } ! // @rdesc Returns a tuple representing a QUERY_SERVICE_CONFIG struct: ! // @tupleitem 0|int|ServiceType|Combination of SERVICE_*_DRIVER or SERVICE_*_PROCESS constants ! // @tupleitem 1|int|StartType|One of SERVICE_*_START constants ! // @tupleitem 2|int|ErrorControl|One of SERVICE_ERROR_* constants ! // @tupleitem 3|<o PyUnicode>|BinaryPathName|Service's binary executable, can also contain command line args ! // @tupleitem 4|<o PyUnicode>|LoadOrderGroup|Loading group that service is a member of ! // @tupleitem 5|int|TagId|Order of service within its load order group ! // @tupleitem 6|[<o PyUnicode>,...]|Dependencies|Sequence of names of services on which this service depends ! // @tupleitem 7|<o PyUnicode>|ServiceStartName|Account name under which service will run ! // @tupleitem 8|<o PyUnicode>|DisplayName|Name of service ! PyObject *retval = Py_BuildValue("lllNNlNNN", config->dwServiceType, config->dwStartType, config->dwErrorControl, ! PyWinObject_FromTCHAR(config->lpBinaryPathName), ! PyWinObject_FromTCHAR(config->lpLoadOrderGroup), config->dwTagId, ! PyWinObject_FromMultipleString(config->lpDependencies), ! PyWinObject_FromTCHAR(config->lpServiceStartName), ! PyWinObject_FromTCHAR(config->lpDisplayName)); delete buffer; return retval; |
From: Roger U. <ru...@us...> - 2007-03-14 04:29:36
|
Update of /cvsroot/pywin32/pywin32/win32/src/win32print In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5944/win32/src/win32print Modified Files: win32print.cpp Log Message: Move function to convert consecutive strings into pywintypes Index: win32print.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32print/win32print.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** win32print.cpp 9 Dec 2006 02:56:36 -0000 1.23 --- win32print.cpp 14 Mar 2007 04:29:35 -0000 1.24 *************** *** 1334,1365 **** return ret; } - - PyObject * PyWinObject_FromWCHARMultiple(WCHAR *multistring) - { - PyObject *obelement, *ret=NULL; - // takes a consecutive sequence of NULL terminated unicode strings, - // terminated by an additional NULL and returns a list - int elementlen; - if (multistring==NULL){ - Py_INCREF(Py_None); - return Py_None; - } - ret=PyList_New(0); - if (ret==NULL) - return NULL; - elementlen=wcslen(multistring); - do{ - obelement=PyWinObject_FromWCHAR(multistring, elementlen); - if ((obelement==NULL)||(PyList_Append(ret,obelement)==-1)){ - Py_DECREF(ret); - return NULL; - } - Py_DECREF(obelement); - multistring+=elementlen+1; - elementlen=wcslen(multistring); - } - while (elementlen>0); - return ret; - } // @pymethod (dict,...)|win32print|EnumPrinterDrivers|Lists installed printer drivers --- 1334,1337 ---- *************** *** 1446,1450 **** di3=(DRIVER_INFO_3W *)buf; for (i=0; i<return_cnt; i++){ ! tuple_item=Py_BuildValue("{s:l,s:u,s:u,s:u,s:u,s:u,s:u,s:O&,s:u,s:u}", "Version",di3->cVersion, "Name",di3->pName, --- 1418,1422 ---- di3=(DRIVER_INFO_3W *)buf; for (i=0; i<return_cnt; i++){ ! tuple_item=Py_BuildValue("{s:l,s:u,s:u,s:u,s:u,s:u,s:u,s:N,s:u,s:u}", "Version",di3->cVersion, "Name",di3->pName, *************** *** 1454,1458 **** "ConfigFile",di3->pConfigFile, "HelpFile", di3->pHelpFile, ! "DependentFiles",PyWinObject_FromWCHARMultiple,di3->pDependentFiles, "MonitorName",di3->pMonitorName, "DefaultDataType",di3->pDefaultDataType); --- 1426,1430 ---- "ConfigFile",di3->pConfigFile, "HelpFile", di3->pHelpFile, ! "DependentFiles",PyWinObject_FromMultipleString(di3->pDependentFiles), "MonitorName",di3->pMonitorName, "DefaultDataType",di3->pDefaultDataType); *************** *** 1469,1473 **** di4=(DRIVER_INFO_4W *)buf; for (i=0; i<return_cnt; i++){ ! tuple_item=Py_BuildValue("{s:l,s:u,s:u,s:u,s:u,s:u,s:u,s:O&,s:u,s:u,s:u}", "Version",di4->cVersion, "Name",di4->pName, --- 1441,1445 ---- di4=(DRIVER_INFO_4W *)buf; for (i=0; i<return_cnt; i++){ ! tuple_item=Py_BuildValue("{s:l,s:u,s:u,s:u,s:u,s:u,s:u,s:N,s:u,s:u,s:u}", "Version",di4->cVersion, "Name",di4->pName, *************** *** 1477,1481 **** "ConfigFile",di4->pConfigFile, "HelpFile", di4->pHelpFile, ! "DependentFiles",PyWinObject_FromWCHARMultiple,di4->pDependentFiles, "MonitorName",di4->pMonitorName, "DefaultDataType",di4->pDefaultDataType, --- 1449,1453 ---- "ConfigFile",di4->pConfigFile, "HelpFile", di4->pHelpFile, ! "DependentFiles",PyWinObject_FromMultipleString(di4->pDependentFiles), "MonitorName",di4->pMonitorName, "DefaultDataType",di4->pDefaultDataType, *************** *** 1515,1519 **** di6=(DRIVER_INFO_6W *)buf; for (i=0; i<return_cnt; i++){ ! tuple_item=Py_BuildValue("{s:l,s:u,s:u,s:u,s:u,s:u,s:u,s:O&,s:u,s:u,s:u,s:O&,s:L,s:u,s:u,s:u}", "Version",di6->cVersion, "Name",di6->pName, --- 1487,1491 ---- di6=(DRIVER_INFO_6W *)buf; for (i=0; i<return_cnt; i++){ ! tuple_item=Py_BuildValue("{s:l,s:u,s:u,s:u,s:u,s:u,s:u,s:N,s:u,s:u,s:u,s:O&,s:L,s:u,s:u,s:u}", "Version",di6->cVersion, "Name",di6->pName, *************** *** 1523,1527 **** "ConfigFile",di6->pConfigFile, "HelpFile", di6->pHelpFile, ! "DependentFiles",PyWinObject_FromWCHARMultiple,di6->pDependentFiles, "MonitorName",di6->pMonitorName, "DefaultDataType",di6->pDefaultDataType, --- 1495,1499 ---- "ConfigFile",di6->pConfigFile, "HelpFile", di6->pHelpFile, ! "DependentFiles",PyWinObject_FromMultipleString(di6->pDependentFiles), "MonitorName",di6->pMonitorName, "DefaultDataType",di6->pDefaultDataType, |
From: Roger U. <ru...@us...> - 2007-03-14 04:29:36
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5944/win32/src Modified Files: PyUnicode.cpp PyWinTypes.h Log Message: Move function to convert consecutive strings into pywintypes Index: PyUnicode.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyUnicode.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** PyUnicode.cpp 4 Jul 2005 05:39:03 -0000 1.21 --- PyUnicode.cpp 14 Mar 2007 04:29:35 -0000 1.22 *************** *** 1030,1031 **** --- 1030,1088 ---- PyMem_Free(str); } + + // Converts a series of consecutive null terminated strings into a list + // Note that a read overflow can result if the input is not properly terminated with an extra NULL. + // Should probably also add a counted version, as win32api uses for REG_MULTI_SZ + PyObject *PyWinObject_FromMultipleString(WCHAR *multistring) + { + PyObject *obelement, *ret=NULL; + int elementlen; + if (multistring==NULL){ + Py_INCREF(Py_None); + return Py_None; + } + ret=PyList_New(0); + if (ret==NULL) + return NULL; + elementlen=wcslen(multistring); + do{ + obelement=PyWinObject_FromWCHAR(multistring, elementlen); + if ((obelement==NULL)||(PyList_Append(ret,obelement)==-1)){ + Py_XDECREF(obelement); + Py_DECREF(ret); + return NULL; + } + Py_DECREF(obelement); + multistring+=elementlen+1; + elementlen=wcslen(multistring); + } + while (elementlen>0); + return ret; + } + + PyObject *PyWinObject_FromMultipleString(char *multistring) + { + PyObject *obelement, *ret=NULL; + int elementlen; + if (multistring==NULL){ + Py_INCREF(Py_None); + return Py_None; + } + ret=PyList_New(0); + if (ret==NULL) + return NULL; + elementlen=strlen(multistring); + do{ + obelement=PyString_FromStringAndSize(multistring, elementlen); + if ((obelement==NULL)||(PyList_Append(ret,obelement)==-1)){ + Py_XDECREF(obelement); + Py_DECREF(ret); + return NULL; + } + Py_DECREF(obelement); + multistring+=elementlen+1; + elementlen=strlen(multistring); + } + while (elementlen>0); + return ret; + } Index: PyWinTypes.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypes.h,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** PyWinTypes.h 1 Mar 2007 00:21:16 -0000 1.35 --- PyWinTypes.h 14 Mar 2007 04:29:35 -0000 1.36 *************** *** 174,177 **** --- 174,181 ---- #define PyWinObject_FromWCHAR PyWinObject_FromOLECHAR + // Converts a series of consecutive null terminated strings into a list + PYWINTYPES_EXPORT PyObject *PyWinObject_FromMultipleString(WCHAR *multistring); + PYWINTYPES_EXPORT PyObject *PyWinObject_FromMultipleString(char *multistring); + PYWINTYPES_EXPORT PyObject *PyString_FromUnicode( const OLECHAR *str ); PYWINTYPES_EXPORT PyObject *PyUnicodeObject_FromString(const char *string); |
From: Mark H. <mha...@us...> - 2007-03-08 23:39:59
|
Update of /cvsroot/pywin32/pywin32/com/win32com/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30330/com/win32com/server Modified Files: register.py Log Message: Remove existing 'DefaultIcon' key when re-registering. Index: register.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/server/register.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** register.py 26 May 2004 09:42:30 -0000 1.19 --- register.py 8 Mar 2007 23:39:59 -0000 1.20 *************** *** 23,27 **** finally: win32api.RegCloseKey(hkey) ! def _set_string(path, value, base=win32con.HKEY_CLASSES_ROOT): "Set a string value in the registry." --- 23,27 ---- finally: win32api.RegCloseKey(hkey) ! def _set_string(path, value, base=win32con.HKEY_CLASSES_ROOT): "Set a string value in the registry." *************** *** 250,253 **** --- 250,255 ---- if defIcon: _set_string(keyNameRoot + '\\DefaultIcon', defIcon) + else: + _remove_key(keyNameRoot + '\\DefaultIcon') if addnPath: |
From: Mark H. <mha...@us...> - 2007-03-08 23:39:00
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29938/com/win32comext/shell/src Modified Files: PyIShellFolder.cpp Log Message: Initialize an out variable to NULL, as per MS docs. Index: PyIShellFolder.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIShellFolder.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PyIShellFolder.cpp 21 Jan 2007 15:24:02 -0000 1.13 --- PyIShellFolder.cpp 8 Mar 2007 23:38:59 -0000 1.14 *************** *** 387,391 **** HWND hwndOwner; ITEMIDLIST *pidl=NULL; ! ITEMIDLIST *pidlRet; LPOLESTR lpszName=NULL; DWORD flags; --- 387,391 ---- HWND hwndOwner; ITEMIDLIST *pidl=NULL; ! ITEMIDLIST *pidlRet = NULL; LPOLESTR lpszName=NULL; DWORD flags; |
From: Mark H. <mha...@us...> - 2007-03-07 01:54:15
|
Update of /cvsroot/pywin32/pywin32/isapi/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18021/src Modified Files: PyExtensionObjects.cpp PyExtensionObjects.h Log Message: Change how we check for a valid ECB and remove some unused and unreliable code Index: PyExtensionObjects.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/PyExtensionObjects.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyExtensionObjects.h 4 Jan 2007 08:19:59 -0000 1.3 --- PyExtensionObjects.h 7 Mar 2007 01:54:13 -0000 1.4 *************** *** 65,76 **** PyObject * m_logData; // log data string - bool m_bAsyncDone; // sent the async done - public: PyECB(CControlBlock * pcb = NULL); ~PyECB(); ! ! bool FinishedResponse(void) { return m_bAsyncDone; } ! public: // Python support static void deallocFunc(PyObject *ob); --- 65,80 ---- PyObject * m_logData; // log data string public: PyECB(CControlBlock * pcb = NULL); ~PyECB(); ! ! BOOL Check() { ! if (!m_pcb || !m_pcb->GetECB()) { ! assert(!PyErr_Occurred()); ! PyErr_SetString(PyExc_RuntimeError, "Invalid ECB (DoneWithSession has been called)"); ! return FALSE; ! } ! return TRUE; ! } // Python support static void deallocFunc(PyObject *ob); *************** *** 98,108 **** static PyObject * IsSessionActive(PyObject *self, PyObject * args); - protected: - #pragma warning( disable : 4251 ) static struct memberlist PyECB_memberlist[]; #pragma warning( default : 4251 ) - }; --- 102,109 ---- *************** *** 111,114 **** PyObject * SetPyECBError(char *fnName, long err=0); ! ! #endif // __PyExtensionObjects_H__ \ No newline at end of file --- 112,114 ---- PyObject * SetPyECBError(char *fnName, long err=0); ! #endif // __PyExtensionObjects_H__ Index: PyExtensionObjects.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/PyExtensionObjects.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PyExtensionObjects.cpp 4 Jan 2007 08:19:59 -0000 1.6 --- PyExtensionObjects.cpp 7 Mar 2007 01:54:13 -0000 1.7 *************** *** 153,157 **** {"DoneWithSession", PyECB::DoneWithSession, 1}, // @pymeth DoneWithSession| {"close", PyECB::DoneWithSession, 1}, // @pymeth close|A synonym for DoneWithSession. - {"IsSessionActive", PyECB::IsSessionActive,1}, // @pymeth IsSessionActive|Indicates if DoneWithSession has been called {"Redirect", PyECB::Redirect,1}, // @pymeth Redirect| {"IsKeepAlive", PyECB::IsKeepAlive,1}, // @pymeth IsKeepAlive| --- 153,156 ---- *************** *** 199,205 **** m_HttpStatusCode(0), // @prop int|HttpStatusCode|The status of the current transaction when the request is completed. ! m_logData(NULL), // @prop string|LogData|log data string ! ! m_bAsyncDone(false) // async done { ob_type = &PyECBType; --- 198,202 ---- m_HttpStatusCode(0), // @prop int|HttpStatusCode|The status of the current transaction when the request is completed. ! m_logData(NULL) // @prop string|LogData|log data string { ob_type = &PyECBType; *************** *** 393,442 **** PyObject * PyECB::ReadClient(PyObject *self, PyObject *args) { - PyECB * pecb = (PyECB *) self; BOOL bRes = FALSE; BYTE * pBuff = NULL; ! DWORD nSize = 0; ! ! if (pecb->m_pcb){ ! nSize = pecb->m_totalBytes - pecb->m_available; ! } ! // @pyparm int|nbytes|0| if (!PyArg_ParseTuple(args, "|l:ReadClient", &nSize)) return NULL; ! ! if (pecb->m_pcb){ ! Py_BEGIN_ALLOW_THREADS ! if (nSize < 1) ! nSize = 1; ! DWORD orgSize = nSize; ! DWORD bytesGot= nSize; ! pBuff = new BYTE[nSize]; ! bRes = pecb->m_pcb->ReadClient(pBuff, &bytesGot); ! if (bytesGot<orgSize){ ! DWORD extraBytes = orgSize-bytesGot; ! DWORD offset=bytesGot; ! while (extraBytes > 0){ bytesGot=extraBytes; ! bRes = pecb->m_pcb->ReadClient(&pBuff[offset], &bytesGot); ! if (bytesGot <1) ! break; ! ! extraBytes -= bytesGot; offset += bytesGot; } if (extraBytes>0) nSize -= extraBytes; ! } ! ! Py_END_ALLOW_THREADS ! if (!bRes){ ! delete [] pBuff; ! return SetPyECBError("ReadClient"); ! } } --- 390,430 ---- PyObject * PyECB::ReadClient(PyObject *self, PyObject *args) { PyECB * pecb = (PyECB *) self; + if (!pecb || !pecb->Check()) return NULL; BOOL bRes = FALSE; BYTE * pBuff = NULL; ! DWORD nSize = pecb->m_totalBytes - pecb->m_available; ! // @pyparm int|nbytes||Default is to read all available data. if (!PyArg_ParseTuple(args, "|l:ReadClient", &nSize)) return NULL; ! Py_BEGIN_ALLOW_THREADS ! assert (nSize >= 0); // DWORD == unsigned == >= 0 ! DWORD orgSize = nSize; ! DWORD bytesGot= nSize; ! pBuff = new BYTE[nSize]; ! bRes = pecb->m_pcb->ReadClient(pBuff, &bytesGot); ! if (bytesGot<orgSize){ ! DWORD extraBytes = orgSize-bytesGot; ! DWORD offset=bytesGot; ! while (extraBytes > 0){ bytesGot=extraBytes; ! bRes = pecb->m_pcb->ReadClient(&pBuff[offset], &bytesGot); ! if (bytesGot <1) ! break; ! ! extraBytes -= bytesGot; offset += bytesGot; } if (extraBytes>0) nSize -= extraBytes; ! } ! Py_END_ALLOW_THREADS ! if (!bRes){ ! delete [] pBuff; ! return SetPyECBError("ReadClient"); } *************** *** 450,454 **** return pyRes; - } --- 438,441 ---- *************** *** 463,466 **** --- 450,454 ---- PyECB * pecb = (PyECB *) self; + if (!pecb || !pecb->Check()) return NULL; // @pyparm string|reply|| *************** *** 489,492 **** --- 477,481 ---- PyECB * pecb = (PyECB *) self; + if (!pecb || !pecb->Check()) return NULL; // @pyparm string|url||The URL to redirect to *************** *** 513,516 **** --- 502,506 ---- PyECB * pecb = (PyECB *) self; + if (!pecb || !pecb->Check()) return NULL; HANDLE handle; BOOL bRes; *************** *** 530,533 **** --- 520,524 ---- PyECB * pecb = (PyECB *) self; + if (!pecb || !pecb->Check()) return NULL; BOOL bRes, bIs; Py_BEGIN_ALLOW_THREADS *************** *** 620,623 **** --- 611,615 ---- PyECB * pecb = (PyECB *) self; + if (!pecb || !pecb->Check()) return NULL; BOOL bRes; *************** *** 642,645 **** --- 634,638 ---- PyECB * pecb = (PyECB *) self; + if (!pecb || !pecb->Check()) return NULL; if (!PyArg_ParseTuple(args, ":IsKeepAlive")) *************** *** 659,662 **** --- 652,656 ---- { PyECB * pecb = (PyECB *) self; + if (!pecb || !pecb->Check()) return NULL; // todo - handle ERROR_INSUFFICIENT_BUFFER - but 4k will do for now. char buffer[1024*4]; *************** *** 683,686 **** --- 677,681 ---- DWORD status = HSE_STATUS_SUCCESS; PyECB * pecb = (PyECB *) self; + if (!pecb || !pecb->Check()) return NULL; // @pyparm int|status|HSE_STATUS_SUCCESS|An optional status. *************** *** 689,718 **** return NULL; ! if (pecb->m_pcb){ ! Py_BEGIN_ALLOW_THREADS ! pecb->m_pcb->DoneWithSession(status); ! pecb->m_bAsyncDone = true; ! Py_END_ALLOW_THREADS ! } Py_INCREF(Py_None); return Py_None; } - // @pymethod bool|EXTENSION_CONTROL_BLOCK|IsSessionActive|Indicates if <om EXTENSION_CONTROL_BLOCK.DoneWithSession> - // has been called. - PyObject * PyECB::IsSessionActive(PyObject *self, PyObject * args) - { - PyECB * pecb = (PyECB *) self; - - if (!PyArg_ParseTuple(args, ":IsSessionActive")) - return NULL; - - BOOL bActive = FALSE; - if (pecb->m_pcb){ - bActive = (pecb->m_bAsyncDone) ? FALSE : TRUE; - } - return PyBool_FromLong(bActive); - } - // Setup an exception --- 684,696 ---- return NULL; ! Py_BEGIN_ALLOW_THREADS ! pecb->m_pcb->DoneWithSession(status); ! Py_END_ALLOW_THREADS ! pecb->m_pcb->Done(); ! pecb->m_pcb = NULL; Py_INCREF(Py_None); return Py_None; } // Setup an exception |
From: Mark H. <mha...@us...> - 2007-03-07 01:52:50
|
Update of /cvsroot/pywin32/pywin32/isapi/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17588/src Modified Files: ControlBlock.h Log Message: Remove unused copy constructors etc, which are unused and would have undesirable side effects if used. Index: ControlBlock.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/ControlBlock.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ControlBlock.h 4 Jan 2007 08:19:59 -0000 1.4 --- ControlBlock.h 7 Mar 2007 01:52:46 -0000 1.5 *************** *** 8,37 **** { public: ! CControlBlock(EXTENSION_CONTROL_BLOCK *pECB=NULL) : m_pECB(pECB) { } - ~CControlBlock() { } ! ! CControlBlock(const CControlBlock & rhs) ! { ! Copy(rhs); ! } ! ! CControlBlock & operator=(const CControlBlock & rhs) ! { ! if (this != &rhs) ! Copy(rhs); ! return *this; } - // member retrieval functions - - EXTENSION_CONTROL_BLOCK * GetECB(void) { return m_pECB; } --- 8,27 ---- { public: ! CControlBlock(EXTENSION_CONTROL_BLOCK *pECB) : m_pECB(pECB) { + assert(pECB); } ~CControlBlock() { } ! void Done() { ! assert(m_pECB); // destructed more than once? ! m_pECB = NULL; } // member retrieval functions EXTENSION_CONTROL_BLOCK * GetECB(void) { + assert(m_pECB); return m_pECB; } *************** *** 153,163 **** private: EXTENSION_CONTROL_BLOCK * m_pECB; // IIS control block - private: - - void Copy(const CControlBlock & rhs) - { - m_pECB = rhs.m_pECB; - } }; ! #endif // __CONTROL_BLOCK_H__ \ No newline at end of file --- 143,147 ---- private: EXTENSION_CONTROL_BLOCK * m_pECB; // IIS control block }; ! #endif // __CONTROL_BLOCK_H__ |
From: Mark H. <mha...@us...> - 2007-03-07 01:47:40
|
Update of /cvsroot/pywin32/pywin32/isapi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15687 Modified Files: install.py Log Message: Only write the 'Deleted Virtual Directory' message if it was actually deleted. Index: install.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/install.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** install.py 3 Jan 2007 03:39:37 -0000 1.10 --- install.py 7 Mar 2007 01:47:39 -0000 1.11 *************** *** 434,437 **** --- 434,438 ---- parent = GetObject(directory.Parent) parent.Delete(directory.Class, directory.Name) + log (1, "Deleted Virtual Directory: %s" % (vd.Name,)) except: exc_val = sys.exc_info()[1] *************** *** 439,443 **** _CallHook(vd, "PostRemove", options) - log (1, "Deleted Virtual Directory: %s" % (vd.Name,)) for filter_def in params.Filters: --- 440,443 ---- |
From: Roger U. <ru...@us...> - 2007-03-06 19:44:12
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6403/win32/src Modified Files: win32process.i Log Message: Add GetProcessId Index: win32process.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32process.i,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** win32process.i 24 Feb 2007 00:29:07 -0000 1.27 --- win32process.i 6 Mar 2007 19:44:06 -0000 1.28 *************** *** 26,29 **** --- 26,31 ---- typedef DWORD (WINAPI *GetModuleFileNameExfunc)(HANDLE, HMODULE, WCHAR *, DWORD); static GetModuleFileNameExfunc pfnGetModuleFileNameEx = NULL; + typedef DWORD (WINAPI *GetProcessIdfunc)(HANDLE); + static GetProcessIdfunc pfnGetProcessId = NULL; #ifndef MS_WINCE *************** *** 932,935 **** --- 934,955 ---- "UserTime", PyLong_FromUnsignedLongLong(usertime.QuadPart)); } + + // @pyswig int|GetProcessId|Returns the Pid for a process handle + static PyObject *PyGetProcessId(PyObject *self, PyObject *args) + { + CHECK_PFN(GetProcessId); + PyObject *obhprocess; + HANDLE hprocess; + DWORD pid; + if (!PyArg_ParseTuple(args, "O:GetProcessId", + &obhprocess)) // @pyparm <o PyHANDLE>|Process||Handle to a process + return NULL; + if (!PyWinObject_AsHANDLE(obhprocess, &hprocess, FALSE)) + return NULL; + pid=(*pfnGetProcessId)(hprocess); + if (pid==0) + return PyWin_SetAPIError("GetProcessId"); + return PyLong_FromUnsignedLong(pid); + } %} %native (GetProcessPriorityBoost) PyGetProcessPriorityBoost; *************** *** 939,942 **** --- 959,963 ---- %native (GetThreadIOPendingFlag) PyGetThreadIOPendingFlag; %native (GetThreadTimes) PyGetThreadTimes; + %native (GetProcessId) PyGetProcessId; #ifndef MS_WINCE *************** *** 1513,1516 **** --- 1534,1538 ---- pfnSetThreadIdealProcessor=(SetThreadIdealProcessorfunc)GetProcAddress(hmodule,"SetThreadIdealProcessor"); pfnSetProcessAffinityMask=(SetProcessAffinityMaskfunc)GetProcAddress(hmodule,"SetProcessAffinityMask"); + pfnGetProcessId=(GetProcessIdfunc)GetProcAddress(hmodule, "GetProcessId"); } |
From: Roger U. <ru...@us...> - 2007-03-06 19:43:06
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5949/win32/src Modified Files: win32apimodule.cpp Log Message: Add SetLocalTime Index: win32apimodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32apimodule.cpp,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** win32apimodule.cpp 27 Feb 2007 02:58:47 -0000 1.73 --- win32apimodule.cpp 6 Mar 2007 19:42:34 -0000 1.74 *************** *** 4510,4513 **** --- 4510,4528 ---- } + // @pymethod |win32api|SetLocalTime|Changes the system's local time + static PyObject *PySetLocalTime (PyObject * self, PyObject * args) + { + SYSTEMTIME st; + PyObject *obst; + if (!PyArg_ParseTuple (args, "O:SetLocalTime", + &obst)) // @pyparm <o PyTime>|SystemTime||The local time to be set. Can also be a time tuple. + return NULL; + if (!PyWinObject_AsSYSTEMTIME(obst, &st)) + return NULL; + if (!SetLocalTime(&st)) + return PyWin_SetAPIError("SetLocalTime"); + Py_INCREF(Py_None); + return Py_None; + } // @pymethod int|win32api|SetSystemTime|Returns the current system time *************** *** 5641,5644 **** --- 5656,5660 ---- {"SetLastError", PySetLastError, 1}, // @pymeth SetLastError|Sets the last error code known for the current thread. {"SetSysColors", PySetSysColors, 1}, // @pymeth SetSysColors|Changes color of various window elements + {"SetLocalTime", PySetLocalTime, 1}, // @pymeth SetLocalTime|Changes the system's local time. {"SetSystemTime", PySetSystemTime, 1}, // @pymeth SetSystemTime|Sets the system time. {"SetClassLong", PySetClassLong,1}, // @pymeth SetClassLong|Replaces the specified 32-bit (long) value at the specified offset into the extra class memory for the window. |
From: Mark H. <mha...@us...> - 2007-03-05 05:55:49
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7127 Modified Files: win32gui.i Log Message: Move SetMenuInfo and GetMenuInfo into win32gui as winxpgui now fails to import on win2k and earlier Index: win32gui.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32gui.i,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** win32gui.i 22 Feb 2007 20:40:54 -0000 1.102 --- win32gui.i 5 Mar 2007 05:55:47 -0000 1.103 *************** *** 66,69 **** --- 66,73 ---- typedef BOOL (WINAPI *AnimateWindowfunc)(HWND,DWORD,DWORD); static AnimateWindowfunc pfnAnimateWindow=NULL; + typedef BOOL (WINAPI *GetMenuInfofunc)(HMENU, LPCMENUINFO); + static GetMenuInfofunc pfnGetMenuInfo=NULL; + typedef BOOL (WINAPI *SetMenuInfofunc)(HMENU, LPCMENUINFO); + static GetMenuInfofunc pfnSetMenuInfo=NULL; typedef DWORD (WINAPI *GetLayoutfunc)(HDC); static GetLayoutfunc pfnGetLayout=NULL; *************** *** 247,250 **** --- 251,256 ---- pfnUpdateLayeredWindow=(UpdateLayeredWindowfunc)GetProcAddress(hmodule,"UpdateLayeredWindow"); pfnAnimateWindow=(AnimateWindowfunc)GetProcAddress(hmodule,"AnimateWindow"); + pfnGetMenuInfo=(GetMenuInfofunc)GetProcAddress(hmodule,"GetMenuInfo"); + pfnSetMenuInfo=(SetMenuInfofunc)GetProcAddress(hmodule,"SetMenuInfo"); } *************** *** 4535,4555 **** ); - %ifdef WINXPGUI // @pyswig |SetMenuInfo|Sets information for a specified menu. ! // @comm To avoid complications with Windows NT, this function only exists in winxpgui (not win32gui) ! BOOLAPI SetMenuInfo( ! HMENU hmenu, // @pyparm int|hmenu||handle to menu ! MENUINFO *INPUT // @pyparm <o MENUINFO>|info||menu information in the format of a buffer. ! // See win32gui_struct for helper functions. ! ); // @pyswig |GetMenuInfo|Gets information about a specified menu. ! // @comm To avoid complications with Windows NT, this function only exists in winxpgui (not win32gui) ! BOOLAPI GetMenuInfo( ! HMENU hMenu, // @pyparm int|hmenu||handle to menu ! MENUINFO *BOTH // @pyparm buffer|info||A buffer to fill with the information. ! ); ! %endif // @pyswig |DrawFocusRect|Draws a standard focus outline around a rectangle --- 4541,4617 ---- ); // @pyswig |SetMenuInfo|Sets information for a specified menu. ! // @comm See win32gui_struct for helper functions. ! // @comm This function will raise NotImplementedError on early platforms (eg, Windows NT.) ! %{ ! PyObject *PySetMenuInfo(PyObject *self, PyObject *args) ! { ! CHECK_PFN(SetMenuInfo); ! PyObject *obMenu, *obInfo; ! HMENU hmenu; ! int cbInfo; ! MENUINFO *pInfo; ! BOOL result; ! // @pyparm int|hmenu||handle to menu ! // @pyparm <o MENUINFO>|info||menu information in the format of a buffer. ! if (!PyArg_ParseTuple(args, "OO", &obMenu, &obInfo)) ! return NULL; ! ! if (!PyWinObject_AsHANDLE(obMenu, (HANDLE *)&hmenu, FALSE)) ! return NULL; ! ! if (0 != PyObject_AsReadBuffer(obInfo, (const void **)&pInfo, &cbInfo)) ! return NULL; ! if (sizeof MENUINFO != cbInfo) ! return PyErr_Format(PyExc_TypeError, "Argument must be a %d byte string/buffer (got %d bytes)", sizeof MENUINFO, cbInfo); ! ! Py_BEGIN_ALLOW_THREADS ! result = (*pfnSetMenuInfo)(hmenu, pInfo); ! Py_END_ALLOW_THREADS ! if (!result) ! return PyWin_SetAPIError("SetMenuInfo"); ! Py_INCREF(Py_None); ! return Py_None; ! } ! %} ! %native (SetMenuInfo) PySetMenuInfo; ! // @pyswig |GetMenuInfo|Gets information about a specified menu. ! // @comm See win32gui_struct for helper functions. ! // @comm This function will raise NotImplementedError on early platforms (eg, Windows NT.) ! %{ ! PyObject *PyGetMenuInfo(PyObject *self, PyObject *args) ! { ! CHECK_PFN(GetMenuInfo); ! PyObject *obMenu, *obInfo; ! HMENU hmenu; ! int cbInfo; ! MENUINFO *pInfo; ! BOOL result; ! // @pyparm int|hmenu||handle to menu ! // @pyparm buffer|info||A buffer to fill with the information. ! if (!PyArg_ParseTuple(args, "OO", &obMenu, &obInfo)) ! return NULL; ! ! if (!PyWinObject_AsHANDLE(obMenu, (HANDLE *)&hmenu, FALSE)) ! return NULL; ! ! if (0 != PyObject_AsWriteBuffer(obInfo, (void **)&pInfo, &cbInfo)) ! return NULL; ! if (sizeof MENUINFO != cbInfo) ! return PyErr_Format(PyExc_TypeError, "Argument must be a %d byte buffer (got %d bytes)", sizeof MENUINFO, cbInfo); + Py_BEGIN_ALLOW_THREADS + result = (*pfnGetMenuInfo)(hmenu, pInfo); + Py_END_ALLOW_THREADS + if (!result) + return PyWin_SetAPIError("GetMenuInfo"); + Py_INCREF(Py_None); + return Py_None; + } + %} + + %native (GetMenuInfo) PyGetMenuInfo; // @pyswig |DrawFocusRect|Draws a standard focus outline around a rectangle |
From: Roger U. <ru...@us...> - 2007-03-04 03:34:00
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25021/win32/src Modified Files: win32file.i Log Message: Add GetFinalPathNameByHandle and a couple more function prototypes Index: win32file.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32file.i,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** win32file.i 22 Feb 2007 18:51:39 -0000 1.73 --- win32file.i 4 Mar 2007 03:33:30 -0000 1.74 *************** *** 2727,2730 **** --- 2727,2732 ---- typedef HANDLE (WINAPI *FindFirstStreamTransactedfunc)(LPWSTR, STREAM_INFO_LEVELS, LPVOID, DWORD, HANDLE); static FindFirstStreamTransactedfunc pfnFindFirstStreamTransacted=NULL; + typedef DWORD (WINAPI *GetFinalPathNameByHandlefunc)(HANDLE,LPWSTR,DWORD,DWORD); + static GetFinalPathNameByHandlefunc pfnGetFinalPathNameByHandle = NULL; // These aren't used yet *************** *** 2733,2736 **** --- 2735,2745 ---- typedef DWORD (WINAPI *GetLongPathNameTransactedfunc)(LPCTSTR,LPTSTR,DWORD,HANDLE); static GetLongPathNameTransactedfunc pfnGetLongPathNameTransacted = NULL; + typedef HANDLE (WINAPI *FindFirstFileNamefunc)(LPCWSTR,DWORD,LPDWORD,PWCHAR); + static FindFirstFileNamefunc pfnFindFirstFileName = NULL; + typedef HANDLE (WINAPI *FindFirstFileNameTransactedfunc)(LPCWSTR,DWORD,LPDWORD,PWCHAR,HANDLE); + static FindFirstFileNameTransactedfunc pfnFindFirstFileNameTransacted = NULL; // HFILE_ERROR + // static char *keywords[]={"FileName","Flags","StringLength","LinkName","Transaction", NULL}; + typedef BOOL (WINAPI *FindNextFileNamefunc)(HANDLE,LPDWORD,PWCHAR); + static FindNextFileNamefunc pfnFindNextFileName = NULL; // ERROR_HANDLE_EOF /* FILE_INFO_BY_HANDLE_CLASS and various structs used by this function are in fileextd.h, can be downloaded here: http://www.microsoft.com/downloads/details.aspx?familyid=1decc547-ab00-4963-a360-e4130ec079b8&displaylang=en *************** *** 4663,4666 **** --- 4672,4714 ---- } PyCFunction pfnpy_FindStreams=(PyCFunction)py_FindStreams; + + // @pyswig <o PyUnicode>|GetFinalPathNameByHandle|Returns the file name for an open file handle + // @pyseeapi GetFinalPathNameByHandle + // @comm Exists on Windows Vista or later. + // @comm Accepts keyword arguments. + static PyObject *py_GetFinalPathNameByHandle(PyObject *self, PyObject *args, PyObject *kwargs) + { + CHECK_PFN(GetFinalPathNameByHandle); + WCHAR *path=NULL; + DWORD path_len=0, reqd_len, flags; + HANDLE hfile; + PyObject *obhfile, *ret=NULL; + static char *keywords[]={"File","Flags", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Ok:GetFinalPathNameByHandle", keywords, + &obhfile, // @pyparm <o PyHANDLE>|File||An open file handle + &flags)) // @pyparm int|Flags||Specifies type of path to return. (win32con.FILE_NAME_NORMALIZED,FILE_NAME_OPENED,VOLUME_NAME_DOS,VOLUME_NAME_GUID,VOLUME_NAME_NONE,VOLUME_NAME_NT) + return NULL; + if (!PyWinObject_AsHANDLE(obhfile, &hfile, FALSE)) + return NULL; + + reqd_len=(*pfnGetFinalPathNameByHandle)(hfile, path, path_len, flags); + if (reqd_len==0) + return PyWin_SetAPIError("GetFinalPathNameByHandle"); + path_len=reqd_len+1; // returned valued doesn't include NULL terminator + path=(WCHAR *)malloc(path_len*sizeof(WCHAR)); + if (path==NULL) + return PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", path_len*sizeof(WCHAR)); + reqd_len=(*pfnGetFinalPathNameByHandle)(hfile, path, path_len, flags); + if (reqd_len==0) + PyWin_SetAPIError("GetFinalPathNameByHandle"); + else if (reqd_len > path_len) // should not happen + PyErr_Format(PyExc_RuntimeError, "Unexpected increase in reqd_len %d - %d", path_len, reqd_len); + else + ret=PyWinObject_FromWCHAR(path,reqd_len); + free(path); + return ret; + } + PyCFunction pfnpy_GetFinalPathNameByHandle=(PyCFunction)py_GetFinalPathNameByHandle; %} *************** *** 4705,4708 **** --- 4753,4757 ---- %native (FindFilesIterator) pfnpy_FindFilesIterator; %native (FindStreams) pfnpy_FindStreams; + %native (GetFinalPathNameByHandle) pfnpy_GetFinalPathNameByHandle; *************** *** 4729,4734 **** --- 4778,4787 ---- ||(strcmp(pmd->ml_name, "FindFilesIterator")==0) ||(strcmp(pmd->ml_name, "FindStreams")==0) + ||(strcmp(pmd->ml_name, "GetFinalPathNameByHandle")==0) ||(strcmp(pmd->ml_name, "GetFullPathNameTransacted")==0) // not impl yet ||(strcmp(pmd->ml_name, "GetLongPathNameTransacted")==0) // not impl yet + ||(strcmp(pmd->ml_name, "FindFirstFileName")==0) // not impl yet + ||(strcmp(pmd->ml_name, "FindFirstFileNameTransacted")==0) // not impl yet + ||(strcmp(pmd->ml_name, "FindNextFileName")==0) // not impl yet ||(strcmp(pmd->ml_name, "GetFileInformationByHandleEx")==0) // not impl yet ) *************** *** 4813,4819 **** --- 4866,4877 ---- pfnFindFirstStreamTransacted=(FindFirstStreamTransactedfunc)GetProcAddress(hmodule, "FindFirstStreamTransactedW"); pfnFindFirstFileTransacted=(FindFirstFileTransactedfunc)GetProcAddress(hmodule, "FindFirstFileTransactedW"); + pfnGetFinalPathNameByHandle=(GetFinalPathNameByHandlefunc)GetProcAddress(hmodule, "GetFinalPathNameByHandleW"); + // these aren't wrapped yet pfnGetFullPathNameTransacted=(GetFullPathNameTransactedfunc)GetProcAddress(hmodule, "GetFullPathNameTransactedW"); pfnGetLongPathNameTransacted=(GetLongPathNameTransactedfunc)GetProcAddress(hmodule, "GetLongPathNameTransactedW"); + pfnFindFirstFileName=(FindFirstFileNamefunc)GetProcAddress(hmodule, "FindFirstFileNameW"); + pfnFindFirstFileNameTransacted=(FindFirstFileNameTransactedfunc)GetProcAddress(hmodule, "FindFirstFileNameTransactedW"); + pfnFindNextFileName=(FindNextFileNamefunc)GetProcAddress(hmodule, "FindNextFileNameW"); // pfnGetFileInformationByHandleEx=(GetFileInformationByHandleExfunc)GetProcAddress(hmodule, "GetFileInformationByHandleEx"); } |
From: Mark H. <mha...@us...> - 2007-03-01 00:21:21
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6442/win32/src Modified Files: PyWinTypes.h Log Message: Add utility functions that take a Py_LONG_LONG Index: PyWinTypes.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypes.h,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** PyWinTypes.h 20 Feb 2007 10:05:39 -0000 1.34 --- PyWinTypes.h 1 Mar 2007 00:21:16 -0000 1.35 *************** *** 229,232 **** --- 229,240 ---- #define PyLong_FromLARGE_INTEGER PyWinObject_FromLARGE_INTEGER #define PyLong_FromULARGE_INTEGER PyWinObject_FromULARGE_INTEGER + // Helpers that take a Py_LONG_LONG, but (a) have pywin32 consistent signatures + // and (b) handle int *and* long (where Python only starts doing that in the + // PyLong_* APIs post 2.4) + // We also happen to know a LARGE_INTEGER is an __int64, so do it the easy way + #define PyWinObject_AsPY_LONG_LONG(ob, pResult) PyWinObject_AsLARGE_INTEGER((ob), (LARGE_INTEGER *)(pResult)) + #define PyWinObject_AsUPY_LONG_LONG(ob, pResult) PyWinObject_AsULARGE_INTEGER((ob), (ULARGE_INTEGER *)(pResult)) + #define PyWinObject_FromPY_LONG_LONG(val) PyWinObject_FromLARGE_INTEGER((LARGE_INTEGER)val) + #define PyWinObject_FromUPY_LONG_LONG(val) PyWinObject_FromULARGE_INTEGER((ULARGE_INTEGER)val) PyObject *PyLong_FromI64(__int64 ival); *************** *** 411,415 **** --- 419,426 ---- PYWINTYPES_EXPORT BOOL PyWinObject_AsHANDLE(PyObject *ob, HANDLE *pRes, BOOL bNoneOK = FALSE); + // For handles that use PyHANDLE. PYWINTYPES_EXPORT PyObject *PyWinObject_FromHANDLE(HANDLE h); + // For handles that aren't returned as PyHANDLE or a subclass thereof (HDC, HWND, etc). + // Return as python ints or longs PYWINTYPES_EXPORT PyObject *PyWinLong_FromHANDLE(HANDLE h); |
From: Roger U. <ru...@us...> - 2007-02-27 02:58:51
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32520/win32/src Modified Files: win32apimodule.cpp Log Message: Add RegCopyTree and RegDeleteTree Index: win32apimodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32apimodule.cpp,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** win32apimodule.cpp 20 Feb 2007 10:31:15 -0000 1.72 --- win32apimodule.cpp 27 Feb 2007 02:58:47 -0000 1.73 *************** *** 71,74 **** --- 71,78 ---- typedef LONG (WINAPI *RegOpenKeyTransactedfunc)(HKEY,LPWSTR,DWORD,REGSAM,PHKEY,HANDLE,PVOID); static RegOpenKeyTransactedfunc pfnRegOpenKeyTransacted = NULL; + typedef LONG (WINAPI *RegCopyTreefunc)(HKEY,LPWSTR,HKEY); + static RegCopyTreefunc pfnRegCopyTree = NULL; + typedef LONG (WINAPI *RegDeleteTreefunc)(HKEY,LPWSTR); + static RegDeleteTreefunc pfnRegDeleteTree = NULL; *************** *** 2547,2550 **** --- 2551,2587 ---- // If the function fails, an exception is raised. } + + // @pymethod |win32api|RegCopyTree|Copies an entire registry key to another location + // @comm Accepts keyword args. + // @comm Requires Vista or later. + static PyObject *PyRegCopyTree(PyObject *self, PyObject *args, PyObject *kwargs) + { + CHECK_PFN(RegCopyTree); + static char *keywords[]={"KeySrc","SubKey","KeyDest", NULL}; + HKEY src, dst; + PyObject *obsrc, *obsubkey, *obdst, *ret=NULL; + WCHAR *subkey=NULL; + long rc; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:RegCopyTree", keywords, + &obsrc, // @pyparm <o PyHKEY>|KeySrc||Registry key to be copied + &obsubkey, // @pyparm <o PyUnicode>|SubKey||Subkey to be copied, can be None + &obdst)) // @pyparm <o PyHKEY>|KeyDest||The destination key + return NULL; + if (PyWinObject_AsHKEY(obsrc, &src) + &&PyWinObject_AsWCHAR(obsubkey, &subkey, TRUE) + &&PyWinObject_AsHKEY(obdst, &dst)){ + rc=(*pfnRegCopyTree)(src, subkey, dst); + if (rc!=ERROR_SUCCESS) + PyWin_SetAPIError("RegCopyTree", rc); + else{ + Py_INCREF(Py_None); + ret=Py_None; + } + } + PyWinObject_FreeWCHAR(subkey); + return ret; + } + // @pymethod <o PyHKEY>|win32api|RegCreateKey|Creates the specified key, or opens the key if it already exists. static PyObject * *************** *** 2699,2703 **** PyObject *obKey, *obsubKey, *obtrans, *ret=NULL; PVOID extparam=NULL; // Reserved, ignore for now ! WCHAR *subKey=NULL, *class_name=NULL; REGSAM access=0; DWORD reserved=0; --- 2736,2740 ---- PyObject *obKey, *obsubKey, *obtrans, *ret=NULL; PVOID extparam=NULL; // Reserved, ignore for now ! WCHAR *subKey=NULL; REGSAM access=0; DWORD reserved=0; *************** *** 2727,2730 **** --- 2764,2797 ---- } + // @pymethod |win32api|RegDeleteTree|Recursively deletes a key's subkeys and values + // @comm Accepts keyword args. + // @comm Requires Vista or later. + static PyObject *PyRegDeleteTree(PyObject *self, PyObject *args, PyObject *kwargs) + { + CHECK_PFN(RegDeleteTree); + HKEY hKey; + PyObject *obKey, *obsubKey, *ret=NULL; + WCHAR *subKey=NULL; + long rc; + static char *keywords[]={"Key","SubKey", NULL}; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:RegDeleteTree", keywords, + &obKey, // @pyparm <o PyHKEY>|Key||Handle to a registry key + &obsubKey)) // @pyparm <o PyUnicode>|SubKey||Name of subkey to be deleted, or None for all subkeys and values + return NULL; + + if (PyWinObject_AsHKEY(obKey, &hKey) + &&PyWinObject_AsWCHAR(obsubKey, &subKey, TRUE)){ + rc=(*pfnRegDeleteTree)(hKey, subKey); + if (rc!=ERROR_SUCCESS) + PyWin_SetAPIError("RegDeleteTree", rc); + else{ + Py_INCREF(Py_None); + ret=Py_None; + } + } + PyWinObject_FreeWCHAR(subKey); + return ret; + } + // @pymethod |win32api|RegDeleteValue|Removes a named value from the specified registry key. static PyObject * *************** *** 5534,5537 **** --- 5601,5605 ---- {"RegCloseKey", PyRegCloseKey, 1}, // @pymeth RegCloseKey|Closes a registry key. {"RegConnectRegistry", PyRegConnectRegistry, 1}, // @pymeth RegConnectRegistry|Establishes a connection to a predefined registry handle on another computer. + {"RegCopyTree", (PyCFunction)PyRegCopyTree, METH_KEYWORDS|METH_VARARGS}, // @pymeth RegCopyTree|Copies an entire registry key to another location {"RegCreateKey", PyRegCreateKey, 1}, // @pymeth RegCreateKey|Creates the specified key, or opens the key if it already exists. {"RegCreateKeyEx", (PyCFunction)PyRegCreateKeyEx, METH_KEYWORDS|METH_VARARGS}, // @pymeth RegCreateKeyEx|Extended version of RegCreateKey *************** *** 5539,5542 **** --- 5607,5611 ---- {"RegDeleteKey", PyRegDeleteKey, 1}, // @pymeth RegDeleteKey|Deletes the specified key. {"RegDeleteKeyTransacted",(PyCFunction)PyRegDeleteKeyTransacted, METH_KEYWORDS|METH_VARARGS}, // @pymeth RegDeleteKeyTransacted|Deletes a registry key as part of a transaction + {"RegDeleteTree", (PyCFunction)PyRegDeleteTree, METH_KEYWORDS|METH_VARARGS}, // @pymeth RegDeleteTree|Recursively deletes a key's subkeys and values {"RegDeleteValue", PyRegDeleteValue, 1}, // @pymeth RegDeleteValue|Removes a named value from the specified registry key. {"RegEnumKey", PyRegEnumKey, 1}, // @pymeth RegEnumKey|Enumerates subkeys of the specified open registry key. *************** *** 5718,5721 **** --- 5787,5792 ---- pfnRegOpenKeyTransacted=(RegOpenKeyTransactedfunc)GetProcAddress(hmodule, "RegOpenKeyTransactedW"); pfnRegDeleteKeyTransacted=(RegDeleteKeyTransactedfunc)GetProcAddress(hmodule, "RegDeleteKeyTransactedW"); + pfnRegCopyTree=(RegCopyTreefunc)GetProcAddress(hmodule, "RegCopyTreeW"); + pfnRegDeleteTree=(RegDeleteTreefunc)GetProcAddress(hmodule, "RegDeleteTreeW"); } |
From: Roger U. <ru...@us...> - 2007-02-26 17:08:17
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5160/win32/src Modified Files: win32transactionmodule.cpp Log Message: Add GetTransactionId and OpenTransaction Index: win32transactionmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32transactionmodule.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** win32transactionmodule.cpp 3 Feb 2007 21:07:33 -0000 1.1 --- win32transactionmodule.cpp 26 Feb 2007 17:08:12 -0000 1.2 *************** *** 14,20 **** typedef BOOL (WINAPI *CommitTransactionAsyncfunc)(HANDLE); static CommitTransactionAsyncfunc pfnCommitTransactionAsync=NULL; - typedef BOOL (WINAPI *GetTransactionIdfunc)(HANDLE,LPGUID); static GetTransactionIdfunc pfnGetTransactionId = NULL; typedef BOOL (WINAPI *GetTransactionInformationfunc)(HANDLE,PDWORD,PDWORD,PDWORD,PDWORD,DWORD,LPWSTR); static GetTransactionInformationfunc pfnGetTransactionInformation = NULL; --- 14,23 ---- typedef BOOL (WINAPI *CommitTransactionAsyncfunc)(HANDLE); static CommitTransactionAsyncfunc pfnCommitTransactionAsync=NULL; typedef BOOL (WINAPI *GetTransactionIdfunc)(HANDLE,LPGUID); static GetTransactionIdfunc pfnGetTransactionId = NULL; + typedef HANDLE (WINAPI *OpenTransactionfunc)(DWORD,LPGUID); + static OpenTransactionfunc pfnOpenTransaction = NULL; + + typedef BOOL (WINAPI *GetTransactionInformationfunc)(HANDLE,PDWORD,PDWORD,PDWORD,PDWORD,DWORD,LPWSTR); static GetTransactionInformationfunc pfnGetTransactionInformation = NULL; *************** *** 22,28 **** static SetTransactionInformationfunc pfnSetTransactionInformation = NULL; // static char *keywords[]={"TransactionHandle","IsolationLevel","IsolationFlags","Timeout","Description", NULL}; - typedef HANDLE (WINAPI *OpenTransactionfunc)(DWORD,LPGUID); - static OpenTransactionfunc pfnOpenTransaction = NULL; - // static char *keywords[]={"DesiredAccess","TransactionId", NULL}; typedef HANDLE (WINAPI *OpenResourceManagerfunc)(DWORD,HANDLE,LPGUID); static OpenResourceManagerfunc pfnOpenResourceManager = NULL; --- 25,28 ---- *************** *** 176,179 **** --- 176,224 ---- } + // @pymethod <o PyIID>|win32transaction|GetTransactionId|Returns the transaction's GUID + static PyObject *PyGetTransactionId(PyObject *self, PyObject *args, PyObject *kwargs) + { + CHECK_PFN(GetTransactionId); + PyObject *obtrans; + HANDLE htrans; + BOOL ret; + GUID guid; + static char *keywords[]={"TransactionHandle", NULL}; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GetTransactionId", keywords, + &obtrans)) // @pyparm <o PyHANDLE>|TransactionHandle||Handle to a transaction + return NULL; + if (!PyWinObject_AsHANDLE(obtrans, &htrans, FALSE)) + return NULL; + Py_BEGIN_ALLOW_THREADS + ret=(*pfnGetTransactionId)(htrans, &guid); + Py_END_ALLOW_THREADS + if (!ret) + return PyWin_SetAPIError("GetTransactionId"); + return PyWinObject_FromIID(guid); + } + + // @pymethod <o PyHANDLE>|win32transaction|OpenTransaction|Creates a handle to an existing transaction + static PyObject *PyOpenTransaction(PyObject *self, PyObject *args, PyObject *kwargs) + { + CHECK_PFN(OpenTransaction); + PyObject *obguid; + HANDLE htrans; + DWORD access; + GUID guid; + static char *keywords[]={"DesiredAccess","TransactionId", NULL}; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "kO:OpenTransaction", keywords, + &access, // @pyparm int|DesiredAccess||Combination of TRANSACTION_* access rights + &obguid)) // @pyparm <o PyIID>|TransactionId||GUID identifying the transaction + return NULL; + if (!PyWinObject_AsIID(obguid, &guid)) + return NULL; + Py_BEGIN_ALLOW_THREADS + htrans=(*pfnOpenTransaction)(access, &guid); + Py_END_ALLOW_THREADS + if (htrans==INVALID_HANDLE_VALUE) + return PyWin_SetAPIError("OpenTransaction"); + return PyWinObject_FromHANDLE(htrans); + } + // @module win32transaction|Module wrapping Kernal Transaction Manager functions, as used with *************** *** 192,195 **** --- 237,244 ---- // @pymeth CommitTransactionAsync|Commits a transaction asynchronously { "CommitTransactionAsync", (PyCFunction)PyCommitTransactionAsync, METH_KEYWORDS|METH_VARARGS}, + // @pymeth GetTransactionId|Returns the transaction's GUID + { "GetTransactionId", (PyCFunction)PyGetTransactionId, METH_KEYWORDS|METH_VARARGS}, + // @pymeth OpenTransaction|Creates a handle to an existing transaction + { "OpenTransaction", (PyCFunction)PyOpenTransaction, METH_KEYWORDS|METH_VARARGS}, { NULL, NULL } }; *************** *** 229,291 **** } - - /* Transaction access rights used with OpenTransaction: - TRANSACTION_QUERY_INFORMATION - TRANSACTION_SET_INFORMATION - TRANSACTION_ENLIST - TRANSACTION_COMMIT - TRANSACTION_ROLLBACK - TRANSACTION_GENERIC_READ - TRANSACTION_GENERIC_WRITE - TRANSACTION_GENERIC_EXECUTE - TRANSACTION_ALL_ACCESS - TRANSACTION_RESOURCE_MANAGER_RIGHTS - TRANSACTION_PROPAGATE - */ - - /* - Transaction manager access rights used with OpenTransactionManager - TRANSACTIONMANAGER_QUERY_INFORMATION - TRANSACTIONMANAGER_SET_INFORMATION - TRANSACTIONMANAGER_RECOVER - TRANSACTIONMANAGER_RENAME - TRANSACTIONMANAGER_CREATE_RM - TRANSACTIONMANAGER_GENERIC_READ - TRANSACTIONMANAGER_GENERIC_WRITE - TRANSACTIONMANAGER_GENERIC_EXECUTE - TRANSACTIONMANAGER_ALL_ACCESS - */ - - /* - Resource manager rights: - RESOURCEMANAGER_QUERY_INFORMATION - RESOURCEMANAGER_SET_INFORMATION - RESOURCEMANAGER_RECOVER - RESOURCEMANAGER_ENLIST - RESOURCEMANAGER_GET_NOTIFICATION - RESOURCEMANAGER_GENERIC_READ - RESOURCEMANAGER_GENERIC_WRITE - RESOURCEMANAGER_GENERIC_EXECUTE - RESOURCEMANAGER_ALL_ACCESS - */ - - /* NOTIFICATION_MASK enum: - TRANSACTION_NOTIFY_MASK - TRANSACTION_NOTIFY_PREPREPARE - TRANSACTION_NOTIFY_PREPARE - TRANSACTION_NOTIFY_COMMIT - TRANSACTION_NOTIFY_ROLLBACK - TRANSACTION_NOTIFY_PREPREPARE_COMPLETE - TRANSACTION_NOTIFY_PREPARE_COMPLETE - TRANSACTION_NOTIFY_COMMIT_COMPLETE - TRANSACTION_NOTIFY_ROLLBACK_COMPLETE - TRANSACTION_NOTIFY_RECOVER - TRANSACTION_NOTIFY_SINGLE_PHASE_COMMIT - TRANSACTION_NOTIFY_DELEGATE_COMMIT - TRANSACTION_NOTIFY_RECOVER_QUERY - TRANSACTION_NOTIFY_ENLIST_PREPREPARE - TRANSACTION_NOTIFY_LAST_RECOVER - TRANSACTION_NOTIFY_INDOUBT - TRANSACTION_NOTIFY_TM_ONLINE - TRANSACTION_NOTIFY_REQUEST_OUTCOME - */ --- 278,279 ---- |
From: Roger U. <ru...@us...> - 2007-02-26 17:07:28
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4800/win32/Lib Modified Files: winnt.py Log Message: Add transaction and transaction manager access modes Index: winnt.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/winnt.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** winnt.py 30 Nov 2006 05:24:56 -0000 1.4 --- winnt.py 26 Feb 2007 17:07:19 -0000 1.5 *************** *** 1108,1109 **** --- 1108,1254 ---- TAPE_INITIATOR_PARTITIONS = 2 + TRANSACTIONMANAGER_QUERY_INFORMATION = 0x0001 + TRANSACTIONMANAGER_SET_INFORMATION = 0x0002 + TRANSACTIONMANAGER_RECOVER = 0x0004 + TRANSACTIONMANAGER_RENAME = 0x0008 + TRANSACTIONMANAGER_CREATE_RM = 0x0010 + TRANSACTIONMANAGER_BIND_TRANSACTION = 0x0020 + TRANSACTIONMANAGER_GENERIC_READ = STANDARD_RIGHTS_READ|TRANSACTIONMANAGER_QUERY_INFORMATION + TRANSACTIONMANAGER_GENERIC_WRITE = STANDARD_RIGHTS_WRITE |\ + TRANSACTIONMANAGER_SET_INFORMATION |\ + TRANSACTIONMANAGER_RECOVER |\ + TRANSACTIONMANAGER_RENAME |\ + TRANSACTIONMANAGER_CREATE_RM + TRANSACTIONMANAGER_GENERIC_EXECUTE = STANDARD_RIGHTS_EXECUTE + TRANSACTIONMANAGER_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED |\ + TRANSACTIONMANAGER_GENERIC_READ |\ + TRANSACTIONMANAGER_GENERIC_WRITE |\ + TRANSACTIONMANAGER_GENERIC_EXECUTE |\ + TRANSACTIONMANAGER_BIND_TRANSACTION + + TRANSACTION_QUERY_INFORMATION = 0x0001 + TRANSACTION_SET_INFORMATION = 0x0002 + TRANSACTION_ENLIST = 0x0004 + TRANSACTION_COMMIT = 0x0008 + TRANSACTION_ROLLBACK = 0x0010 + TRANSACTION_PROPAGATE = 0x0020 + TRANSACTION_SAVEPOINT = 0x0040 + TRANSACTION_MARSHALL = TRANSACTION_QUERY_INFORMATION + TRANSACTION_GENERIC_READ = STANDARD_RIGHTS_READ |\ + TRANSACTION_QUERY_INFORMATION |\ + SYNCHRONIZE + TRANSACTION_GENERIC_WRITE = STANDARD_RIGHTS_WRITE |\ + TRANSACTION_SET_INFORMATION |\ + TRANSACTION_COMMIT |\ + TRANSACTION_ENLIST |\ + TRANSACTION_ROLLBACK |\ + TRANSACTION_PROPAGATE |\ + TRANSACTION_SAVEPOINT |\ + SYNCHRONIZE + TRANSACTION_GENERIC_EXECUTE = STANDARD_RIGHTS_EXECUTE |\ + TRANSACTION_COMMIT |\ + TRANSACTION_ROLLBACK |\ + SYNCHRONIZE + TRANSACTION_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED |\ + TRANSACTION_GENERIC_READ |\ + TRANSACTION_GENERIC_WRITE |\ + TRANSACTION_GENERIC_EXECUTE + TRANSACTION_RESOURCE_MANAGER_RIGHTS = TRANSACTION_GENERIC_READ |\ + STANDARD_RIGHTS_WRITE |\ + TRANSACTION_SET_INFORMATION |\ + TRANSACTION_ENLIST |\ + TRANSACTION_ROLLBACK |\ + TRANSACTION_PROPAGATE |\ + SYNCHRONIZE + + RESOURCEMANAGER_QUERY_INFORMATION = 0x0001 + RESOURCEMANAGER_SET_INFORMATION = 0x0002 + RESOURCEMANAGER_RECOVER = 0x0004 + RESOURCEMANAGER_ENLIST = 0x0008 + RESOURCEMANAGER_GET_NOTIFICATION = 0x0010 + RESOURCEMANAGER_REGISTER_PROTOCOL = 0x0020 + RESOURCEMANAGER_COMPLETE_PROPAGATION = 0x0040 + RESOURCEMANAGER_GENERIC_READ = STANDARD_RIGHTS_READ |\ + RESOURCEMANAGER_QUERY_INFORMATION |\ + SYNCHRONIZE + RESOURCEMANAGER_GENERIC_WRITE = STANDARD_RIGHTS_WRITE |\ + RESOURCEMANAGER_SET_INFORMATION |\ + RESOURCEMANAGER_RECOVER |\ + RESOURCEMANAGER_ENLIST |\ + RESOURCEMANAGER_GET_NOTIFICATION |\ + RESOURCEMANAGER_REGISTER_PROTOCOL |\ + RESOURCEMANAGER_COMPLETE_PROPAGATION |\ + SYNCHRONIZE + RESOURCEMANAGER_GENERIC_EXECUTE = STANDARD_RIGHTS_EXECUTE |\ + RESOURCEMANAGER_RECOVER |\ + RESOURCEMANAGER_ENLIST |\ + RESOURCEMANAGER_GET_NOTIFICATION |\ + RESOURCEMANAGER_COMPLETE_PROPAGATION |\ + SYNCHRONIZE + RESOURCEMANAGER_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED |\ + RESOURCEMANAGER_GENERIC_READ |\ + RESOURCEMANAGER_GENERIC_WRITE |\ + RESOURCEMANAGER_GENERIC_EXECUTE + + ENLISTMENT_QUERY_INFORMATION = 0x0001 + ENLISTMENT_SET_INFORMATION = 0x0002 + ENLISTMENT_RECOVER = 0x0004 + ENLISTMENT_SUBORDINATE_RIGHTS = 0x0008 + ENLISTMENT_SUPERIOR_RIGHTS = 0x0010 + ENLISTMENT_GENERIC_READ = STANDARD_RIGHTS_READ | ENLISTMENT_QUERY_INFORMATION + ENLISTMENT_GENERIC_WRITE = STANDARD_RIGHTS_WRITE |\ + ENLISTMENT_SET_INFORMATION |\ + ENLISTMENT_RECOVER |\ + ENLISTMENT_SUBORDINATE_RIGHTS |\ + ENLISTMENT_SUPERIOR_RIGHTS + ENLISTMENT_GENERIC_EXECUTE = STANDARD_RIGHTS_EXECUTE |\ + ENLISTMENT_RECOVER |\ + ENLISTMENT_SUBORDINATE_RIGHTS |\ + ENLISTMENT_SUPERIOR_RIGHTS + ENLISTMENT_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED |\ + ENLISTMENT_GENERIC_READ |\ + ENLISTMENT_GENERIC_WRITE |\ + ENLISTMENT_GENERIC_EXECUTE + + + ## TRANSACTION_OUTCOME enum + TransactionOutcomeUndetermined = 1 + TransactionOutcomeCommitted = 2 + TransactionOutcomeAborted = 3 + + ## TRANSACTION_STATE enum + TransactionStateNormal = 1 + TransactionStateIndoubt = 2 + TransactionStateCommittedNotify = 3 + + ## TRANSACTION_INFORMATION_CLASS enum + TransactionBasicInformation = 0 + TransactionPropertiesInformation = 1 + TransactionEnlistmentInformation = 2 + TransactionFullInformation = 3 + + ## TRANSACTIONMANAGER_INFORMATION_CLASS enum + TransactionManagerBasicInformation = 0 + TransactionManagerLogInformation = 1 + TransactionManagerLogPathInformation = 2 + TransactionManagerOnlineProbeInformation = 3 + + ## RESOURCEMANAGER_INFORMATION_CLASS ENUM + ResourceManagerBasicInformation = 0 + ResourceManagerCompletionInformation = 1 + ResourceManagerFullInformation = 2 + ResourceManagerNameInformation = 3 + + ## ENLISTMENT_INFORMATION_CLASS enum + EnlistmentBasicInformation = 0 + EnlistmentRecoveryInformation = 1 + EnlistmentFullInformation = 2 + EnlistmentNameInformation = 3 + + ## KTMOBJECT_TYPE enum + KTMOBJECT_TRANSACTION = 0 + KTMOBJECT_TRANSACTION_MANAGER = 1 + KTMOBJECT_RESOURCE_MANAGER = 2 + KTMOBJECT_ENLISTMENT = 3 + KTMOBJECT_INVALID = 4 + |