473,395 Members | 1,466 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,395 software developers and data experts.

NTFS and share permissions on a folder

Hello,

I'm trying to get the permissions on a shared folder using
NetShareGetInfo api.
I've got this function above that is supposed to give me the
permission thanks to shi2_permission.
The thing is that it always return '0' whether the permission is set
with "Read" or both "Read/Change" (Full control).
So can anyone explain to me what does that mean ? or let me know if
there is a problem with this function.

Thanks in advance.
static string NetShareGetPermission(string serverName, string
netName)
{
string permission = null;
IntPtr ptr = IntPtr.Zero;
int level = 2;

int errCode = NetShareGetInfo(serverName, netName, level,
ref ptr);

if (errCode == NERR_Success)
{
SHARE_INFO_2 shareInfo = (SHARE_INFO_2)
Marshal.PtrToStructure(ptr, typeof(SHARE_INFO_2));

permission = shareInfo.shi2_permissions.ToString();
Console.WriteLine("Path : \t\t" +
shareInfo.shi2_path.ToString());
Console.WriteLine("Max Users : \t" +
shareInfo.shi2_max_uses.ToString());
Console.WriteLine("Description : \t" +
shareInfo.shi2_remark.ToString());
NetApiBufferFree(ptr);
}
else
{
Console.WriteLine(FormatMessage(errCode));
return "Error";
}
return permission;
}
Jun 27 '08 #1
2 2900
On Thu, 05 Jun 2008 07:34:13 -0700, Thierry Kennes <tp******@gmail.com>
wrote:
I'm trying to get the permissions on a shared folder using
NetShareGetInfo api.
That's not a .NET function, so your question is very much off-topic here.

That said, the field you are looking at applies only if the share is
configured with share-level permissions. These days, it's very unusual to
see that; usually permissions are set with user-level permissions. So
maybe you're simply not looking at the right information?

In any case, there's really nothing about your question that pertains to
..NET, never mind C#. For a really good answer, you'll probably want to
find a more appropriate newsgroup.

Pete
Jun 27 '08 #2
On 5 juin, 20:27, "Peter Duniho" <NpOeStPe...@nnowslpianmk.comwrote:
On Thu, 05 Jun 2008 07:34:13 -0700, Thierry Kennes <tpken...@gmail.com*
wrote:
I'm trying to get the permissions on a shared folder using
NetShareGetInfo api.

That's not a .NET function, so your question is very much off-topic here.

That said, the field you are looking at applies only if the share is *
configured with share-level permissions. *These days, it's very unusual to *
see that; usually permissions are set with user-level permissions. *So *
maybe you're simply not looking at the right information?

In any case, there's really nothing about your question that pertains to *
.NET, never mind C#. *For a really good answer, you'll probably want to *
find a more appropriate newsgroup.

Pete
Thanks anyway. I actually need this information even though it's
unusual :)
Jun 27 '08 #3

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

Similar topics

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...
9
by: Ben Dewey | last post by:
Project: ---------------------------- I am creating a HTTPS File Transfer App using ASP.NET and C#. I am utilizing ActiveDirectory and windows security to manage the permissions. Why reinvent...
2
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...
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...
0
by: desarrollo_cpd_gr | last post by:
I need to know how to set a DACL in a folder using NTFS in order to establish the permissions for the folder, I have already acomplished this with a share object but I also want to put security in...
3
by: Ray Cassick \(Home\) | last post by:
I am starting to think there is some kind of conspiracy :) but everywhere I try to locate some (working) code showing how to change NTFS partitions on a network share I end up at a dead end. I...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.