Andy Raibeck
Guest
|
Posted:
Fri May 28, 2004 6:56 pm Post subject:
What rights are needed to execute FindFirstVolumeMountPoint( |
|
|
Hello,
I am trying to understand what privileges are necessary in order for
FindFirstVolumeMountPoint() to execute successfully. If I belong to the
"Administrators" group, it works fine. However, users belonging to (and only
to) "Backup Operators" fail with RC 5 (ERROR_ACCESS_DENIED).
I can not find any information on minimum privileges in the MSDN reference
information for FindFirstVolumeMountPoint(), any of the other related
information on volume management functions, or anywhere else in the MSDN.
Google and other internet searches have turned up nothing.
Apologies in advance if I am addressing the wrong newsgroup or if this
information is readily available elsewhere. Any pointers are greatly
appreciated.
The code that I am using appears below.
Thanks in advance.
Andy
///////////////////////////////////////////
#define UNICODE
#define _UNICODE
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#define DS_PATH_MAX 1024
int wmain(int argc, wchar_t *argv[])
{
TCHAR *lpszRootPathName = NULL;
TCHAR *lpszVolumeMountPoint = (TCHAR *)calloc(DS_PATH_MAX + 1,
sizeof(TCHAR));
DWORD cchBufferLength = DS_PATH_MAX;
HANDLE h = NULL;
int rc = 0;
if (argc == 1)
{
_tprintf(_T("Usage: VOLMPX rootpath1 [rootpath2 [rootpath3
[...] ] ]\n\n"));
_tprintf(_T(" Example: volmpx u:\\snapshots\\thu\\\n"));
return 1;
}
if (lpszVolumeMountPoint == NULL)
{
_tprintf(_T("Error: calloc() failed for lpszVolumeMountPoint.\n"));
return 1;
}
for (int i = 1; i < argc; i++)
{
lpszRootPathName = argv[i];
// Fails with ERROR_ACCESS_DENIED for backup operators.
h = FindFirstVolumeMountPoint(lpszRootPathName,
lpszVolumeMountPoint,
cchBufferLength);
if (h != INVALID_HANDLE_VALUE)
{
_tprintf(_T("FindFirstVolumeMountPoint() completed, ")
_T("lpszVolumeMountPoint = <%s>\n\n"),
lpszVolumeMountPoint);
FindVolumeMountPointClose(h);
}
else
{
_tprintf(_T("FindFirstVolumeMountPoint() failed, Win32 RC =
%lu\n\n"),
GetLastError());
rc = 1;
}
}
return rc;
}
/////////////////////////////////////////// |
|
Tammy Culter [MSFT]
Guest
|
Posted:
Wed Jun 02, 2004 1:44 am Post subject:
Re: What rights are needed to execute FindFirstVolumeMountPo |
|
|
Hi Andy -- This might not be exactly the right newsgroup, but I'll try to
help you anyway! I can't find any documentation on privileges for this
function either. However, I do know that the Backup Operators group doesn't
have very many rights; IIRC, they can't even change the system time,
nevermind play around with volumes.
Hopefully, this isn't a big problem for you. You might try the Power Users
group and see what happens. Or if you need more expert advise, ask at one of
the microsoft.public.platformsdk.* newsgroups.
-Tammy Culter [MSFT]
This posting is provided "AS IS" with no warranties, and confers no rights.
"Andy Raibeck" <storman@us.ibm.com> wrote in message
news:#DpzjRMREHA.3708@TK2MSFTNGP10.phx.gbl...
| Quote: | Hello,
I am trying to understand what privileges are necessary in order for
FindFirstVolumeMountPoint() to execute successfully. If I belong to the
"Administrators" group, it works fine. However, users belonging to (and
only
to) "Backup Operators" fail with RC 5 (ERROR_ACCESS_DENIED).
I can not find any information on minimum privileges in the MSDN reference
information for FindFirstVolumeMountPoint(), any of the other related
information on volume management functions, or anywhere else in the MSDN.
Google and other internet searches have turned up nothing.
Apologies in advance if I am addressing the wrong newsgroup or if this
information is readily available elsewhere. Any pointers are greatly
appreciated.
The code that I am using appears below.
Thanks in advance.
Andy
///////////////////////////////////////////
#define UNICODE
#define _UNICODE
#define _WIN32_WINNT 0x0500
#include <windows.h
#include <stdio.h
#include <tchar.h
#define DS_PATH_MAX 1024
int wmain(int argc, wchar_t *argv[])
{
TCHAR *lpszRootPathName = NULL;
TCHAR *lpszVolumeMountPoint = (TCHAR *)calloc(DS_PATH_MAX + 1,
sizeof(TCHAR));
DWORD cchBufferLength = DS_PATH_MAX;
HANDLE h = NULL;
int rc = 0;
if (argc == 1)
{
_tprintf(_T("Usage: VOLMPX rootpath1 [rootpath2 [rootpath3
[...] ] ]\n\n"));
_tprintf(_T(" Example: volmpx u:\\snapshots\\thu\\\n"));
return 1;
}
if (lpszVolumeMountPoint == NULL)
{
_tprintf(_T("Error: calloc() failed for lpszVolumeMountPoint.\n"));
return 1;
}
for (int i = 1; i < argc; i++)
{
lpszRootPathName = argv[i];
// Fails with ERROR_ACCESS_DENIED for backup operators.
h = FindFirstVolumeMountPoint(lpszRootPathName,
lpszVolumeMountPoint,
cchBufferLength);
if (h != INVALID_HANDLE_VALUE)
{
_tprintf(_T("FindFirstVolumeMountPoint() completed, ")
_T("lpszVolumeMountPoint = <%s>\n\n"),
lpszVolumeMountPoint);
FindVolumeMountPointClose(h);
}
else
{
_tprintf(_T("FindFirstVolumeMountPoint() failed, Win32 RC =
%lu\n\n"),
GetLastError());
rc = 1;
}
}
return rc;
}
///////////////////////////////////////////
|
|
|