Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Wed, 20 Aug 2008 13:13:38 +0300,    group: microsoft.public.platformsdk.security        back       


Network folder permission check   
Hi,

I want to know what permissions are granted to the network folder with 
read-only access. I have tried to use AccessCheck function and it 
returns that I have full access on this folder.

I have given the code snippet here

HANDLE hToken;
PRIVILEGE_SET PrivilegeSet;
DWORD dwPrivSetSize = sizeof( PRIVILEGE_SET );
BOOL fAccessGranted=FALSE;
DWORD dwAccessDesired = STANDARD_RIGHTS_ALL | SPECIFIC_RIGHTS_ALL;
GENERIC_MAPPING Generic;       // generic mapping for object
DWORD dwAccessAllowed;
SECURITY_DESCRIPTOR *lpSD = NULL;
PSID lpSid = NULL;
PSID lpSidGrp = NULL;
PACL lpAcl = NULL;

dwAccessDesired = FILE_ALL_ACCESS;
Generic.GenericAll = FILE_ALL_ACCESS;

GetNamedSecurityInfo(_T("\\\\vmtest\\aaa"),SE_FILE_OBJECT, 
DACL_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION | 
GROUP_SECURITY_INFORMATION, &lpSid, &lpSidGrp, &lpAcl, NULL, 
(PSECURITY_DESCRIPTOR*)&lpSD);

ImpersonateSelf(SecurityImpersonation);
OpenThreadToken( GetCurrentThread(), TOKEN_DUPLICATE | 
TOKEN_QUERY,TRUE,&hToken );
RevertToSelf();


MapGenericMask( &dwAccessDesired, &Generic );

AccessCheck(lpSD,hToken,dwAccessDesired,&Generic,&PrivilegeSet,&dwPrivSetSize,&dwAccessAllowed,&fAccessGranted);

At the end I see that fAccessGranted = 1 and dwAccessAllowed = 
FILE_ALL_ACCESS.

What is wrong in my code? How to know the real permissions?

Any help would be appreciated.

Ilia
date: Wed, 20 Aug 2008 13:13:38 +0300   author:   Ilia Golubev

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us