Important alert: (current site time 7/28/2014 1:56:20 AM EDT)
 

winzip icon

FINAL V6 -NT Master Class! - EFS | NTFS Security | Process and Service Mgmt | User and Group Mgmt

Email
Submitted on: 6/3/2006 3:27:55 PM
By: Steppenwolfe 
Level: Intermediate
User Rating: By 31 Users
Compatibility: VB 6.0
Views: 26287
(About the author)
 
     All of the most difficult and hard to find subjects covered in one unifying project. NT Master class encompasses a wide range of security functions, allowing you to create applications with a broad scope of features, that call through a single, powerful, class interface. Features include interfaces into EFS (Encrypted File System), NTFS File Security, NTFS Registry Security, a wide array of User and Group management calls, and Service and Process management. Class is written for speed and functionality, and includes error handling and events, along with a demonstration project. The five worksheets from each subject are also included, so that you may use them seperately.. _________________________________________________ V3 is Up! Added some service functions, expanded user management, some small fixes/enhancements. _________________________________________________ V4 is Up! Added three new user management routines, applied some fixes to class and example. _________________________________________________ V5 is Up! Final rev is up, added 14 new functions!! All process functions mirrored to psapi for W2K server compliance. Added get/set thread priority, and get/set process class. Added Kill thread, load/unload user hive and create/remove user profile to user management. Now 60 functions in class, each one is now proofed and working well. Added an extended example to the demo, which goes through the complete cycle of adding/modifying a user/group, then launching a process with the new credentials. _________________________________________________ V6 is Up! Added a routine to service management, that changes the service description in mmc. Proofed and rewrote Service_Add and Service_Remove functions. Added optional machine name to service routines, making remote administration possible, (thanks Lite). Hope ya like it.. Cheers John

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 16 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

4/17/2006 5:36:11 AMLight Templer

Hi John,
you submit the most complete collection of stuff like this I 've ever found ;-)! Of course a fiver ***** - Thx and regards - LiTe
(If this comment was disrespectful, please report it.)

 
4/17/2006 8:55:01 AMDave

Excellent work John. You really know your way about the Windows OS :-) Another excellent submission and very useful too.
(If this comment was disrespectful, please report it.)

 
4/17/2006 9:11:11 AMIvar

Thanks a lot! I was just investigating how to impersonate a user.
(If this comment was disrespectful, please report it.)

 
4/17/2006 9:29:56 AMSteppenwolfe

Thanks Lite.. I could never find good examples of these things, so I felt this was needed.
People, some things will work on 98/ME, like Service and Process management, but for the rest you need newer OS, (NT4/W2K/XP/2003/Vista). You need to have NTFS partition or NTFS controls are disabled automatically.. enjoy.
John
(If this comment was disrespectful, please report it.)

 
4/17/2006 10:01:41 AMtheNerd

Thank you very much, this is brilliant!
(If this comment was disrespectful, please report it.)

 
4/17/2006 9:28:14 PMHeriberto Mantilla Santamaria

Wow, Jhon this code is amaizing.

One question, the level is correct?
(If this comment was disrespectful, please report it.)

 
4/18/2006 9:09:51 AMSteppenwolfe

Heriberto, the level is in the eye of the betrother ;o)
(If this comment was disrespectful, please report it.)

 
4/20/2006 12:27:38 AMJoe Jordan

Wow, fantastic! I've been dabbling with some of this stuff recently as well, but you've taken care of everything and more. How you suffered through MSDN for all of this info I'll never know. :) 5 globes.
(If this comment was disrespectful, please report it.)

 
4/20/2006 9:47:16 AMSteppenwolfe

Hi Joe, yes MSDN was big help, also binaryworld has good examples, and of course allapi.net. Lately though, I find it is just easier to read through header files for this stuff, usually name of call and structure are enough to figure it out, example, look in LMACCESS.H..
I've added a couple more routines, and expanded some others, expect an update in a couple of days.
(If this comment was disrespectful, please report it.)

 
4/23/2006 3:17:26 PMSebastian Mares

I was wondering about something... Does Windows XP Home have the needed files for creating encrypted files? I know you cannot set the attribute to "Encrypted" using Windows Explorer, but while you also cannot set what user is allowed to read the file, write to the file etc., the functionality is there because there is a tool that adds the Users tab to the properties dialog.
(If this comment was disrespectful, please report it.)

 
4/23/2006 6:45:14 PMSteppenwolfe

Sebastion
A couple prereqiusites first. Partition must be formatted with NTFS, (for Access Security and Encryption). You can see dialog for user permissions by going into explorer ->Tools -> Folder Options ->View tab and turn off 'Use Simple File Sharing'.
Then Security tab should be visible on File/Folder properties, (..on an NTFS drive).
As for Encryption, it is under Properties -> Advanced -> Encryption and Compression Attributes.
Both encryption and NTFS security use calls primarily located in advapi32.dll. I don't imagine the two OSs (Pro/Home), would use a different library, if features are disabled I think it more likely it is simply absent or disabled at user options level, (if this app works on Home, then I guess this must be so)..
(If this comment was disrespectful, please report it.)

 
4/23/2006 9:58:15 PMenmity

process->module enum, never return modules, CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, lProcess) always = -1
(If this comment was disrespectful, please report it.)

 
4/23/2006 9:59:47 PMenmity

dirNTFS.Path = m_NTFSDrive + "NMC\"

NTFSDrive is always "Z:\", so it always throw: path not found
(If this comment was disrespectful, please report it.)

 
4/24/2006 11:21:34 AMSteppenwolfe

Enmity, not all processes have modules.. try enum modules with vb6.exe selected, [for example], then you will see modules. NTFS drive is last NTFS partition found on hard drive. Check loops through partitions, checking each one for file system, if they are NTFS, it is returned true, if there are none, no NTFS partitions are present on your system. Path 'nmc\' is hard coded for sake of the example..
(If this comment was disrespectful, please report it.)

 
4/27/2006 5:55:53 AMPaul Caton

All the stuff I really, really hate having to deal with myself. 5x*
(If this comment was disrespectful, please report it.)

 
4/27/2006 12:53:23 PMSteppenwolfe

Updated with a fix for the user_create function, and added three more user management functions for V4..
(If this comment was disrespectful, please report it.)

 
4/27/2006 9:18:31 PMSteppenwolfe

Paul, this is the stuff I like.. nothing like api with little/no documentation for a good challenge.. (a la M$ security via obscurity fiasco ;o)
(If this comment was disrespectful, please report it.)

 
4/27/2006 10:38:34 PMenmity

@Steppenwolfe
what the process I am testing is definitely has modules, since I am now writing a large free tool and process explorer is one of them and I have accomplished that feature with EnumProcessModules from psapi.dll, I think Module32First/Module32Next is good for win9x/me, and EnumProcessModules is good for NT.
(If this comment was disrespectful, please report it.)

 
4/27/2006 10:42:03 PMenmity

and i think that you are missing some functions for process/thread: TerminateThread, GetPriorityClass,SetThreadPriority, even the "SetProcessWorkingSetSize"...
(If this comment was disrespectful, please report it.)

 
4/28/2006 9:10:09 AMSteppenwolfe

Enmity, I am running XP, and it works fine here, maybe you are still using 2003 server? Of course there are a few more functions I could add, but it is a choice between making class too bulky, and adding features that are commonly used.. I may add terminate thread, and a couple more things, but next rev is likely to be the last.
(If this comment was disrespectful, please report it.)

 
4/30/2006 9:25:35 AMSteppenwolfe

Hey all, added a bunch of new routines, and went through and proofed it all. Extended the example to demonstrate some of the new functions, and added options for kill thread, get/set thread priority and process class..
(If this comment was disrespectful, please report it.)

 
4/30/2006 9:27:51 AMSteppenwolfe

Also, all of process routines are now NT server compliant, routines mirrored to functions using psapi.dll, and 98/ME functions using kernal32.dll.
(If this comment was disrespectful, please report it.)

 
4/30/2006 11:39:45 PMSteppenwolfe

I went over the project again today, testing every function, and found only one small bug. I re-uploaded with the fix, but if you want to do it yourself, it is pretty easy. Find the two api declarations in the NMC class: NetLocalGroupDel and NetGroupDel. Change the value types on both declartaions to: servername As Byte, groupname As Byte. Apply the same change to prjUsers class.. If you find anything else, just send me an email.. John
(If this comment was disrespectful, please report it.)

 
5/3/2006 9:22:44 AMSteppenwolfe

Thanks to everyone who took the time to vote..
Glad you guys liked it, and I hope people get some use out of this.
Expect another project in a week or so..
John
(If this comment was disrespectful, please report it.)

 
5/6/2006 3:55:35 PMSAP BASIS Administrator

Nice work! I think your work would really be of great help in system administration. Though the functions are available already via Windows OS yet what you did was a user-friendly consolidation which would really benefit people like us. Nice work! Definitely a 5 to you!!!
(If this comment was disrespectful, please report it.)

 
5/18/2006 9:15:28 AM

Wow! Veru cool code!
(If this comment was disrespectful, please report it.)

 
6/3/2006 5:01:20 AMLight Templer

Hi John, really great job and thx for suppporting AFTER submission it here! Suggestion: Don't skip this NICE little first parameter of e.g. OpenSCManager(...,..., ... ) in e.g. Service_Add(...) of clsServices ;-))) This would extend the usage for remote support applications a lot! I know, ok, final ... But: Whats really final in VB ;-) ? Kind regards - LiTe
(If this comment was disrespectful, please report it.)

 
6/3/2006 10:31:08 AMSteppenwolfe

Hi Lite
Yes, you can add domain qualifier to routines, maybe I will do it lator ;o) I am writing a 'true' service component now, so went back and borrowed some stuff from this class, hence the update. Maybe I will publish the service lator as an example.. (we'll see..)
(If this comment was disrespectful, please report it.)

 
6/3/2006 5:03:25 PMNajeeb Puthiyallam

i'm Sorry PSC only allows me give Thanks and Rating Only upto 5* ! I will compain against it , Really ! Becoz coders like u need some more extra *s ! Keep Coding !
Make PSC outstanding with Codes like these . LET'S WORK HARD ! if ur intrested u can check my codes too . but not just like urs ! its simple ! But just check it ! Najeeb Puthiyallam ! www.najeeb_puthiyallam@hotmail.com
www.nsunlimited.blogspot.com
(If this comment was disrespectful, please report it.)

 
6/4/2006 4:33:59 AMLight Templer

John, all the times I red its not possible to write services in pure VB. The MS NTSVC.OCX is a very good solution to overcome this limitation, even with single step debugging in IDE! I 've used this control many times an it works perfectly stable from NT4 upto XP. If you need any additional DLL to get a VB service to run its not worth to substitute this OCX, only a pure VB solution, maybe with a tweak in compiler switches like the control panel solution submited today would be a good deal ;-))
(If this comment was disrespectful, please report it.)

 
6/4/2006 11:04:03 AMSteppenwolfe

Lite, I've already written the service in vb, (no form, no ocx, and runs unattended - it is running on my machine right now ;o)
It uses a typelib, but could be done without it, (-but- there is nothing wrong with using a typelib, automation interface is used in many languages, and is a very handy thing, particularly in vb)..
It was for a directory monitor I built, that I think is one of the best codes I have written. Maybe I will put an example together today..
(If this comment was disrespectful, please report it.)

 
12/22/2006 1:07:17 AMDewey

wow nice,,,can you tell me how to find a PID with an EXE name.
(If this comment was disrespectful, please report it.)

 
6/28/2009 8:26:39 AMHStrix

This tool is a very nice on ;-)
But I'm missing the detection of the existing version of NTFS in your NTFS project ..
(If this comment was disrespectful, please report it.)

 
10/25/2011 3:02:20 AMplease answer me

hello
i found a big problem in your "NTFS security program"
if we have not user or group in file or folder security tab . program can't add users and change permissions but windows can add a users easily. can you please help me ? i really need help..!
my e-mail: karimi@mail.org
(If this comment was disrespectful, please report it.)

 
10/25/2011 8:29:22 PMSteppenwolfe

@please answer me
I have not programmed in vb6 in many years, and do not even have a compiler for it any more.. but the whole point of putting this source code up here was so that people can learn from and expand it. I learned how to use the api by searching the internet for scraps of code in various languages, (typically C for this sort of programming), and learning correct api call spec from msdn, I learned alot by doing the leg work, suggest you do the same..
(If this comment was disrespectful, please report it.)

 
10/29/2011 3:33:32 PMplease answer me

thank you very much
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.