Get ACL - write access for directory

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Taurus
Posts: 45
Joined: 20 Jan 2015, 10:31

Get ACL - write access for directory

20 Sep 2017, 07:26

Hi,

I try to get the ACL access list for a specified directory. It has to work on Windows drives as well as on shared drives (Win Server, NAS and Linux-Server).

At the moment, this is my code:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



It's working, but it's a little bit slow, because i scan for it a lot of times. Is there any faster/better way?

Thanks! ;)
Dev for a better world :) > PHP for Web > AHK H for Local > with KISS (Keep it Short and Simple) on Win 10 Pro (Version 1703) x64
teadrinker
Posts: 136
Joined: 29 Mar 2015, 09:41

Re: Get ACL - write access for directory

20 Sep 2017, 14:19

Hi, Taurus,

The easiest way to get an access list is using WMI like this:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


Results may vary, if you run the script as admin.
The code to get the full access list for files or folders:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


CIM_DataFile
CIM_Directory
File and Directory Access Rights Constants
User avatar
Taurus
Posts: 45
Joined: 20 Jan 2015, 10:31

Re: Get ACL - write access for directory

22 Sep 2017, 04:24

Thanks. I will try that out. Is there any ahk native way? I had some systems where winmgmts was broken.
Dev for a better world :) > PHP for Web > AHK H for Local > with KISS (Keep it Short and Simple) on Win 10 Pro (Version 1703) x64
User avatar
jNizM
Posts: 2273
Joined: 30 Sep 2013, 01:33
GitHub: jNizM
Contact:

Re: Get ACL - write access for directory

22 Sep 2017, 06:03

Yes with DllCall's...
See 2nd CodeBox https://autohotkey.com/boards/viewtopic.php?t=27709 by qwerty12
[AHK] 1.1.26.01 x64 Unicode | [WIN] 10 Pro (Version 1703) x64
My GitHub Profile | Donations are appreciated if I could help you
User avatar
Taurus
Posts: 45
Joined: 20 Jan 2015, 10:31

Re: Get ACL - write access for directory

25 Sep 2017, 05:05

DllCalls... maybe i should dig into it.

I found a full list of it here: https://hotkeyit.github.io/v2/docs/commands/WinApi.htm

It should be something like this: https://msdn.microsoft.com/en-us/library/windows/desktop/aa446639(v=vs.85).aspx

One question: Would you rely on WinAPI or should i better stay with ahk functions?
Dev for a better world :) > PHP for Web > AHK H for Local > with KISS (Keep it Short and Simple) on Win 10 Pro (Version 1703) x64
teadrinker
Posts: 136
Joined: 29 Mar 2015, 09:41

Re: Get ACL - write access for directory

25 Sep 2017, 13:05

Learning winapi extends your abilities. There are many things you can't achieve without using DllCall().

Return to “Ask For Help”

Who is online

Users browsing this forum: Drake, euras, Terka, Unknovvn and 46 guests