 |
|
 |
Thanks for the great work!
There seems to be a memory leak (windows handle not closed) if you call so.Permissions.GetEffectiveRights(Me.WinUser) on an SecuredObject so.
Regards, Georg
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I've used this for setting permissions on shares. Doing this it fails in the UnsafeSetNamedSecurityInfo method in the Win32helper.cs file with a null pointer exception.
The error is due to a operator overload in the Sid class (Sid.cs). The overload operator calls a method called UnsafeEqualsSids which starts like this:
private static unsafe bool UnsafeEqualsSids(Sid s1, Sid s2) { if (object.ReferenceEquals(s1, null) || object.ReferenceEquals(s2, null)) { return false; }
This method fails if both sids are null. The following code inserts another tests which checks if both sids are null and then return true instead of false.
private static unsafe bool UnsafeEqualsSids(Sid s1, Sid s2) { if (object.ReferenceEquals(s1, null) && object.ReferenceEquals(s2, null)) { return true; } if (object.ReferenceEquals(s1, null) || object.ReferenceEquals(s2, null)) { return false; }
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi folks I am a sporadic Dot Net developer and haven't worked for about half a year with VS2005.
So forgive me my question: To use the mmsseclib.dll do I have to use regasm? Anything else to do before I can use mmsseclib (using mmsseclib)?
BTW: I want to use mmsseclib to give a web server on the fly the rights for a certain directory so that it can create a text file in it, when needed.
Any experiences how to do that/an example?
Best JL
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
My feeling is that this section of codeproject is dead. As since march 2006 no answeres are visible.
Maybe the author passed away.
R.I.P.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
There are still some console freaks like me (system administrators) out there that have used MS tools like (X)Cacls to automate several tasks. But due to several problems with (X)Cacls I had to resort to manual labour . But here it is!! A great library of David Hall! Have created a shell around it to make it more coworker friendly:->. You can find it on LiQuick.net. When all bugs are out, I'll try to write an add-on article to this page. Code of the console can be requested for by e-Mail.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi there,
I'm tring to compile the TestSec.cs using C# compiler, but no matter what I do, I allways get the same error:
The type or namespace name 'mmsseclib' could not be found (are you missing a using directive or an assembly reference?)
But the refence was there. I had copy the mmsseclib.dll to the same folder of TestSec.cs, access the command prompt, go to path of the TestSec.cs and mmsseclib.dll and type:
csc /target:exe /r:mmsseclib.dll TestSec.cs
How I can reference the dll to compile the program?
Eduardo tw latin america
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
David, can I use your nice and straightforward dll in the commercial product? What I shall do for that? Dmitry.
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
Hi, I have an asp application that needs to launch PowerPoint. At installation, i would like to give the "ASPNET" account the ability to launch and execute Powerpoint. I tried with the following code below but It just allows this account to "read" the registry key.
Do you have any idea or where to modify to allow "Execution" from "ASPNET" account ? Thanks. Karim
WindowsUser kuser = new WindowsUser("ASPNET"); Console.WriteLine(kuser.FullName); SecuredObject sec =null string skey=@"Software\Classes\AppID\{64818D10-4F9B-11CF-86EA-00AA00B929E8}"; IntPtr hKey; int rc = Win32.RegOpenKey(Win32.HKEY_LOCAL_MACHINE,skey, out hKey); if (rc == 0) { sec = new SecuredObject(hKey, SecuredObjectType.RegistryKey); DumpObject(sec); sec.Permissions.SetAccess(kuser, AccessRights.GenericExecute,AceInheritanceFlags.ContainerInherit|AceInheritanceFlags.ObjectInherit); DumpObject(sec); Win32.RegCloseKey(hKey); }
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi there, I kept getting the following exception while attempting to load an existing user.
System.ComponentModel.Win32Exception: No mapping between account names and security IDs was done at Microsoft.Win32.Security.WindowsUser.Load(String accountName, String system) at Microsoft.Win32.Security.WindowsUser..ctor(String accountName) at RegStudent.RegisterStudent.CreateUserAccount(String username, String password, String subjectCode, String firstName, String surname, String studentDir, String virtualDir, String adminUser, String adminPass)
can anyone tell me why this is so? or what can cause this exception to occur. Many thanks
Regards
|
| Sign In·View Thread·PermaLink | 1.50/5 |
|
|
|
 |
|
 |
I had the ecxact same problem, it can be different things, but what you want to do first is to make sure the username and password matches up.
"if run from command line" try to not enter username and password when you run the command line, then you will get a form, asking you for username and password, if you can enter username and password here, and the service installs correct, then you know that the username and password matches up. If not, then you need to figure out how to write it, it could be like this
.\administrator 'localmachine MyDomain\administrator 'network
"Usefull solution" I tried to print out the username and password after I putted them on my ServiceProcessInstaller.
System.Diagnostics.EventLog.WriteEntry("ServiceTest", "User:""" & Me.processInstaller.Username & """ Password:""" & Me.processInstaller.Password & """", EventLogEntryType.Warning)
If the username and password arent set properly here, you will get the Win32Exception.
My problem, was I had switched the username and password
MrBonus
|
| Sign In·View Thread·PermaLink | 5.00/5 |
|
|
|
 |
|
 |
First off, I have to say this is awesome code. I've been searching for something to set ntfs without having to shell out for a while now and this does everything I need and more. Couldn't have been simpler. I am however having an issue using the dll in 2005. When the object is used in code I get the following error:
'mmsseclib.dll' is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.
This issue is only with 2005 and it works fine in 2003. I tried doing a simple conversion of the source to 2005 to see if that cleared the error, but the 2005 compiler threw another error compiling the dll:
Error 1 error C2872: 'FILETIME' : ambiguous symbol C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\lmaccess.h 1390 Has anyone tried this component in .Net 2.0? Any help would be greatly appreciated...
Thanks, Landon.
|
| Sign In·View Thread·PermaLink | 5.00/5 |
|
|
|
 |
|
 |
I had the same problem when trying to compile.
Switch "FILETIME" to "System::Runtime::InteropServices::FILETIME" and it should compile for you in VS 2005.
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
following this link http://www.be-st.it/Blog/tabid/79/EntryID/2/Default.aspx
try to set this [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework] MDA = 0
Good luck ))
oli
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I had the same issue and replaced: System::Runtime::InteropServices::ComTypes::FILETIME with FILETIME in lmaccess.h
Mike
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I installed this dll on to our Project and it works for me on XP and 2000. Afterwards there was a requirement for us to install our Project on Win NT 4.0 Sp6 application. It is crashing at this mmsseclib.dll saying advapi32.dll(system32) is giving probem.
Unless i build this dll on NT machine, I will not able to fix my problem. Since Visual Studio.NET cannot be installed on Windows NT SP6.0, Can you suggest some way around for me to build this application on Visual Studio 6.0 VC++ 6.0., so that i can add this dll on NT.
Thanks in advance,
KK
KK
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I'm not sure it will compile without a bunch of work. It may be easier to look through the code and find any functions referenced from advapi32 that do not work under NT4 and then change that code.
- David
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
David,
Thanks for the Reply.
Can you suggest me any dll/code which works similar to your mmseclib.dll written in VisualC++ 6.0, I need similar functionality for me, but i need it visual C++6.0 so that i can build on NT and use on my project.
Thanks in Advance.
KK
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
The ATL library has much of this functionality, but I'm not sure if it was added in the 6.0 product. That is the only other source I am aware of.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Somebody help me correct this error. I get "Object reference not to instance of an object" and sometimes "System.OutOfMemoryException" error at the same statement.
Following is the code snippet for your reference:
private void grantRights(string grantType) { try { //Store the path of the Selected Directory //Get the path from the type propery of the treeview control String dirPath = @"C:\InetPub\WWWRoot\AD"; //Initialise AccessRight to 0 (none) AccessRights rights=0;
//Get the access rights choosen by the user //Full Control if(grantType=="Full Control") rights = AccessRights.FileFullControl;
//Write if(grantType=="Write") rights = AccessRights.FileWrite;
//Read Only if(grantType=="Read Only") rights = AccessRights.FileRead;
//Create WindowUser instance to provide the Access Rights WindowsUser user = new WindowsUser ("amol","active");
//Create SecuredObject instance to denote the selected Directory SecuredObject sec = new SecuredObject(dirPath, SecuredObjectType.FileObject); //I SOMETIMES get above mentioned error here
//Set the rights or permissions sec.Permissions.SetAccess(user, rights, AceInheritanceFlags.ContainerInherit|AceInheritanceFlags.ObjectInherit); } } //Show success message HandleSuccess(grantType + " Permission was given for the selected users."); } catch(Exception ex) { //Show error HandleException(ex.Message); } }
The above mentioned error does not occur every time I run the code. It occurs sometimes. At other times the code works fine. I dont understand why this happens.
I am working on Active Directories. I have to provide access rights for particular users for the directories in IIS 6.0 Web Server.
I am using ASP .Net and C#, Visual Studio .Net 2003, Microsoft .Net Framework 1.1.
Please provide a solution for this as early as possible. Your help will be highly appreciated.
-Vikram Saraf
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Hi,
I have not been able to figure out how to create a SecuredObject for a named pipe. I tried:
SecuredObject sec = new SecuredObject("\\\\.\\pipe\\namedpipename",SecuredObjectType.FileObject);
but I get a "The parameter is incorrect" exception.
Any suggestions?
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
David,
Thanks for posting this code, it's very useful.
I have taken over a long-running project that uses your code. Unfortunately, the original developer on this project is no longer available to answer questions. I have noticed that "our" version of the source code differs slightly from yours, and I'm wondering which is right.
In "ours", AceInheritanceFlags is of type Int16 and contains SUB_CONTAINERS_AND_OBJECTS_INHERIT. In the version currently on Code Project, AceInheritanceFlags is of type Byte, and does not contain SUB_CONTAINERS_AND_OBJECTS_INHERIT.
I'm not sure whether our version is out of date, or if the differences are bug fixes made by my predecessor. Given my description above, are you able to tell me which is correct?
Many thanks,
John
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I checked and that enum is still a byte and I do not have that item. It must be from your predecessor. I'm guessing that he changed to a short since that will show up in VB.NET without manipulation and that flag is a combination of some others to make it easier to code.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Below is my code (written in vb.net) '******************************************************************************************* ‘Call the setPermission procedure setPermission(”C:\Inetpub\www\MyWebsite”, “JOP\ASPNET”) ‘And the actual method Sub setPermission(ByRef vPath As String, ByVal UserName As String) Dim user As WindowsUser = New WindowsUser(UserName) Dim sec As SecuredObject = New SecuredObject(vPath, SecuredObjectType.FileObject) sec.Permissions.GrantAccess(user, AccessRights.FileExecute, AceInheritanceFlags.ContainerInherit) End Sub '******************************************************************************************* Tthe code works perfectly find, but when I check Security properties on the folder, I find that ASP.Net account has “Special Permissions” in stead of normal Read, Write and Execute permissions. I am not sure if anyway I can add Regular Read, Write and Execute permissions using the above code, as users get access denied error message when they try to upload files to the folder.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |