some examples

delphi package - easy access to security apis
Post Reply
anakein
Posts: 3
Joined: Sat May 01, 2004 3:55 pm

some examples

Post by anakein »

first, great library madshi, very good work.

and now, do you have any examples for this packages?
or anybody?

thx for all and again good work.
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

A simple example:

Shares.Delete; // kills all shares

What is your aim? Maybe I can give you an example which first better to your needs.
anakein
Posts: 3
Joined: Sat May 01, 2004 3:55 pm

Post by anakein »

very simple yes. xDDDDD

ok explanied my doubt;
with this packages, i want to block one file and protect with password, is it possible?.
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

madSecurity can do what you see in the explorer in the "share" and "security" tab, but not more. So password protection is not supported. You can limit access to a file to a specific user account, but that's it (and even that works only if you have NTFS).
anakein
Posts: 3
Joined: Sat May 01, 2004 3:55 pm

Post by anakein »

ok, but, do you have into madcollection, any kinds for protect file for password?.

please, is it very important for me.
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

No, I don't have that. Probably you could kind of realize that yourself by writing file hooks with madCodeHook, but it would be very difficult to do and very time consuming on top of that. So I don't recommend doing that.
nildo
Posts: 249
Joined: Mon Mar 22, 2004 11:32 am
Contact:

Post by nildo »

Anakein, to protect a file with password, Encrypt it with some password, put an extension like ".YOUR_PROGRAM_NAME". So it will stay like this:

"Your_file.txt.xyz" (assuming that XYZ is any extension of your choice). And then you do a shell extension to open that file with your program, then the user type the password and then Decrypt it.

After that you need to hook FindFIrst, FindFirstEX, FindNext and FindNextEx. Everytime that a file with the extension .XYZ appear, you change the file name.

So...

Someone called FindFirst with "Your_file.txt.xyz"
Then you change the Result to "Your_file.txt".

So the user will think its a single file and when double clicking will open your program instead of NOTEPAD.

But this is not an efficient method. Just create one by your self =P I've just give the Idea. But with MadCodeHook, will not be possible to hook 16 bits programs (like DOS in w9x)
comrade
Posts: 3
Joined: Mon Oct 10, 2005 9:19 am

Post by comrade »

madshi wrote:A simple example:
Shares.Delete; // kills all shares
What is your aim? Maybe I can give you an example which first better to your needs.
Hi there!
Maybe that happen only to me but after I executed that code I successfully removed all shares but it also removed the tab [from file and folder properties] where I could share that folder. I tried to restart the "Server" service but it didn't help. Any ideas?
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

There are some shares like $C or $IPC or something like that. Maybe those are needed? Are you talking about the tab for drives on your own PC or for network drives?
comrade
Posts: 3
Joined: Mon Oct 10, 2005 9:19 am

Post by comrade »

madshi wrote:There are some shares like $C or $IPC or something like that. Maybe those are needed? Are you talking about the tab for drives on your own PC or for network drives?
No no no. It's a "hidden" resources for administration and inter process communication as you know.
I mentioned the security tab. Look - I've attached the image 'coz one image is worth 1024 words. :)
Here is a link:
http://comrade-b.narod.ru/The-Share-tab.png
[I hope you'll understand what I'm talking about]

Also I forgot to ask - Is it possible to get the source code for madSecurity?
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

comrade wrote:No no no. It's a "hidden" resources for administration and inter process communication as you know.
I mentioned the security tab. Look - I've attached the image 'coz one image is worth 1024 words. :)
I know what you mean. I already knew it when I wrote my previous comment. The problem is that I've no idea how "Shares.Delete" could remove this tab. All it does is deleting all shares. I can't imagine that deleting normal self made share can result in this effect. So I thought, it must be the system shares. Anyway, I'm just guessing, I've never heard about this problem yet!

Are you sure that you didn't change some user privileges at the same time as calling Shares.Delete?
mdrums wrote:Also I forgot to ask - Is it possible to get the source code for madSecurity?
Of course. The commercial edition contains the source code.
comrade
Posts: 3
Joined: Mon Oct 10, 2005 9:19 am

Post by comrade »

madshi wrote: Are you sure that you didn't change some user privileges at the same time as calling Shares.Delete?
No. I've just tested this code:

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
begin
shares.Delete;
end;

after that I got this:
http://comrade-b.narod.ru/wo-Share-tab.png

I'm not tricking you. I have win2k professional box with SP4 and all the windows updates for the current moment and Delphi 6.
I think as a developer of this collection you must know the very details of how does it actually work. :)

And I also want to suggest you to organize a special thread here on the forum calles "Examples" or "Snippets/Samples" where we can copy and paste the code, that you've already tested and we can be sure that it is 100 % working.
Post Reply