Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6286
Modified Files:
shell.cpp
Log Message:
Add IsUserAnAdmin()
Index: shell.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/shell.cpp,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -d -r1.57 -r1.58
*** shell.cpp 3 Jun 2007 14:53:07 -0000 1.57
--- shell.cpp 4 Jul 2007 01:46:55 -0000 1.58
***************
*** 90,93 ****
--- 90,96 ----
static PFNSHShellFolderView_Message pfnSHShellFolderView_Message = NULL;
+ typedef BOOL (WINAPI *PFNIsUserAnAdmin)();
+ static PFNIsUserAnAdmin pfnIsUserAnAdmin = NULL;
+
void PyShell_FreeMem(void *p)
{
***************
*** 2264,2267 ****
--- 2267,2286 ----
}
+ // @pymethod bool|shell|IsUserAnAdmin|Tests whether the current user is a member of the Administrator's group.
+ // @rdesc The result is true or false.
+ static PyObject *PyIsUserAnAdmin(PyObject *self, PyObject *args)
+ {
+ if(!PyArg_ParseTuple(args, ":IsUserAnAdmin"))
+ return NULL;
+ // @comm This method is only available with version 5 or later of the shell controls
+ if (pfnIsUserAnAdmin==NULL)
+ return OleSetOleError(E_NOTIMPL);
+ PY_INTERFACE_PRECALL;
+ BOOL r = (*pfnIsUserAnAdmin)();
+ PY_INTERFACE_POSTCALL;
+
+ return PyBool_FromLong(r);
+ }
+
/* List of module functions */
***************
*** 2273,2276 ****
--- 2292,2296 ----
{ "DragQueryFileW", PyDragQueryFileW, 1 }, // @pymeth DragQueryFileW|Retrieves the file names of dropped files that have resulted from a successful drag-and-drop operation.
{ "DragQueryPoint", PyDragQueryPoint, 1}, // @pymeth DragQueryPoint|Retrieves the position of the mouse pointer at the time a file was dropped during a drag-and-drop operation.
+ { "IsUserAnAdmin", PyIsUserAnAdmin, METH_VARARGS}, // @pymeth IsUserAnAdmin|Tests whether the current user is a member of the Administrator's group.
{ "SHGetPathFromIDList", PySHGetPathFromIDList, 1 }, // @pymeth SHGetPathFromIDList|Converts an <o PyIDL> to a path.
{ "SHGetPathFromIDListW", PySHGetPathFromIDListW, 1 }, // @pymeth SHGetPathFromIDListW|Converts an <o PyIDL> to a unicode path.
***************
*** 2402,2405 ****
--- 2422,2426 ----
pfnSHILCreateFromPath=(PFNSHILCreateFromPath)GetProcAddress(shell32, "SHILCreateFromPath");
pfnSHShellFolderView_Message=(PFNSHShellFolderView_Message)GetProcAddress(shell32, "SHShellFolderView_Message");
+ pfnIsUserAnAdmin=(PFNIsUserAnAdmin)GetProcAddress(shell32, "IsUserAnAdmin");
}
// SHGetFolderPath comes from shfolder.dll on older systems
|