advapi32.dll - File permissions

Archives Forums/Win32 Discussion/advapi32.dll - File permissions

ozzi789(Posted 2010) [#1]

I am writting a Backup tool, everything works well, but as you know, BB's CopyFile does not care about File permissions.

I found out that the Library "advapi32" does such stuff.




my decls looks like this
.lib "advapi32.dll"
GetFileSecurityA%(lpFileName*, info% ):"GetFileSecurityA"

So im trying to use that function like this:
Print len_f_string

For i= 0 To len_f_string-1


GetFileSecurityA%(fh, 1)

But i dont get it to work at all.
So my question is, does anybody know the WinApi good?
Could you please help me, im new to this stuff and i am pretty lost.

Thank you very much, greetings

_PJ_(Posted 2010) [#2]

use <code> or <codebox> tags around oyur code, using [ and ]instead of < and > :)


I can't offer much help, except for
GetFileSecurityA%(fh, 1)

This seems to be returning a value. So you may want to check that with
Sec%=GetFileSecurityA%(fh, 1)
Print Str(Sec%)

Also, someone with more knowledge than me may be able to clarify, but I am not sure if passing the bytes for the filepath is the way to give the file to the function. You may need to use a separate dll function to get the file as a handle or something first???

ozzi789(Posted 2010) [#3]

Ok sorry i will use that next time.
Yeah i forgot, but i knew that it returns a value, but it did never work properly, for they are some optional parameters that i dont really understand.

I made a little workaround, using the tool fileacl, it does just the same ;)

Somebody told me to pass the bytes like that, i think that should be correct...

Anyway, thanks for your time :)