473,394 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Removing NTFS Folder Permissions On Win2000 In .NET Without using WMI

Ram
Hey,
I'v managed to find a way of adding NTFS permissions to a certain folder,
But the problem is, the folder has a couple of inherited permissions which I
want to delete.
How can I remove the folder's NTFS permissions WITHOUT using WMI or special
XP features?
Thanks ahead!

--Ram
Nov 16 '05 #1
2 2319

look for a library called <ADsSecurity.dll> in
msdn.microsoft.com/google.com;

this will do your job (add/edit/remove permissions on security objects (like
users/folders/files/printers) )
and it's usable from .NET too:

string _udir = rootFolder + folder;
ADsSecurity _adSec = new ADsSecurity();

IADsSecurityDescriptor _sd =
(IADsSecurityDescriptor)_adSec.GetSecurityDescript or("FILE://"+_udir );
IADsAccessControlList _dacl =
(IADsAccessControlList)_sd.DiscretionaryAcl;

_sd.Control =
(int)ActiveDs.ADS_SD_CONTROL_ENUM.ADS_SD_CONTROL_S E_DACL_PROTECTED;

ActiveDs.AccessControlEntry _ace3 = new ActiveDs.AccessControlEntry();
_ace3.Trustee = <YOUR_USER_NAME>;

//_ace3.Trustee="Internet Guest Account";
_ace3.AccessMask =
(int)ActiveDs.ADS_RIGHTS_ENUM.ADS_RIGHT_GENERIC_EX ECUTE
|(int)ActiveDs.ADS_RIGHTS_ENUM.ADS_RIGHT_GENERIC_R EAD
|(int)ActiveDs.ADS_RIGHTS_ENUM.ADS_RIGHT_READ_CONT ROL
|(int)ActiveDs.ADS_RIGHTS_ENUM.ADS_RIGHT_SYNCHRONI ZE
|(int)ActiveDs.ADS_RIGHTS_ENUM.ADS_RIGHT_GENERIC_W RITE
|(int)ActiveDs.ADS_RIGHTS_ENUM.ADS_RIGHT_GENERIC_E XECUTE;

_ace3.AceType =
(int)ActiveDs.ADS_ACETYPE_ENUM.ADS_ACETYPE_ACCESS_ ALLOWED;
_ace3.AceFlags =
(int)ActiveDs.ADS_ACEFLAG_ENUM.ADS_ACEFLAG_INHERIT _ACE|1;

_dacl.AddAce(_ace3);

//

_sd.DiscretionaryAcl = _dacl;
_adSec.SetSecurityDescriptor(_sd,"FILE://"+ _udir);

HTH,
Daniel

"Ram" <ni***@bezeqint.net> wrote in message
news:eb**************@tk2msftngp13.phx.gbl...
Hey,
I'v managed to find a way of adding NTFS permissions to a certain folder,
But the problem is, the folder has a couple of inherited permissions which I want to delete.
How can I remove the folder's NTFS permissions WITHOUT using WMI or special XP features?
Thanks ahead!

--Ram

Nov 16 '05 #2
Ram, my dilemna is somewhat the same. Please see "Converting Win32 API to VB.Net". I feel that the solution is easiest with the Win32 API, however I am not able to get it to work completely. Hence, the post for help on this site. Good luck!
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: BingoHandJob | last post by:
Hello group! I'm having a problem and I hope some of you may be able to point me in the right direction. I inherited a web site using php, running on Windows 2000 & IIS. The site was...
3
by: Kim Lots | last post by:
Hi folks Let say I have one virtual directory (IIS 5.x) pointing to a folder on my G: drive what would be the minimum NTFS permissions (w2k pro) for users & groups on this folder considering I'm...
7
by: Ron Gibson | last post by:
Lets say I have a folder members/3/ in this folder are images I have a login page that connects to a database to retrieve user info. After login the user is directed to a page that lists...
1
by: BJS | last post by:
Hi there. I have been successfully running ASP on a W2K IIS5.0 server using Anon Access enabled, but would like to be able to restrict access to a particular folder containing some ASP content...
1
by: Sharon | last post by:
Hi all. How can i change a file NTFS permissions? 10x, Sharon.
1
by: Mohamed Zaki | last post by:
Dear All, I'm facing a strange problem, I've an ASP.NET web application that contains an admin folder, in this folder the access should be restricted to specific users, as i'm using windows...
4
by: Joey | last post by:
Hey, How can I add/edit/delete Folder NTFS permissions in .NET? I have a Win2K Box, and WMI is not installed on my servers Thanks ahead! -- Joey
4
by: Ram | last post by:
Hey, I'v managed to find a way of adding NTFS permissions to a certain folder, But the problem is, the folder has a couple of inherited permissions which I want to delete. How can I remove the...
3
by: palepimp | last post by:
Hello all, I have searched far and wide for a solution to my issue. In short, here is the problem: 1. 3 PC's enter data into an Access 2003 database (PC's are running Vista w/ Office 2007...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.