| |
|
|
|
Description:
GetSecurityDescriptorOwner determined whom SID the Eigentümers one Objektes from the Security Descriptor. These function there only NT-based Windowssystemen.
Deklaration:
DEF @GetSecurityDescriptorOwner(3) !ADVAPI32,GetSecurityDescriptorOwner
Parameter:
1.Parameter: Memory-Variable with of/ one SECURITY_DESCRIPTOR structure, from the one whom proprietor read wants. 2.Parameter: 4 byte Memory-Variable, The The address of/ one SID structure aufnimmt, The whom proprietor the Objektes angibt. 3.Parameter: 2 byte large Memory-Variable or SECURITY_DESCRIPTOR_CONTROL structure, its worth angibt, whether the proprietor by a Default-machinery set watts. (=0 No, <>0 Yes)
Return Value:
1 with success, 0 with Error.
Examples:
DEF @IsValidSecurityDescriptor(1) !"ADVAPI32","IsValidSecurityDescriptor"
DEF @GetFileSecurity(5) !"ADVAPI32","GetFileSecurityA"
DEF @GetLastError(0) !"KERNEL32","GetLastError"
DEF @SetLastError(1) !"KERNEL32","SetLastError"
DEF @GetSecurityDescriptorOwner(3) !"ADVAPI32","GetSecurityDescriptorOwner"
DEF @IsValidSid(1) !"ADVAPI32","IsValidSid"
DEF @LookupAccountSid(7) !"ADVAPI32","LookupAccountSidA"
Declare NEEDED#,SIDa#,Fehler&,NEEDED&,PSECURITY_DESCRIPTOR#
Declare FILENAME$,SID#,GFLAG#,SYstem$
Declare SID_NAME_USE#,ACCOUNT_NAME#,Domain#
Declare SIZE_ACCOUNT#,SIZE_DOMAIN#
DIM Needed#,4
LET FILENAME$=@LOADFILE$("Datei wählen","*.*")
ADDSTRING "Security Descriptor of "+FILENAME$
Clear Needed#
LET Fehler&=@GetFileSecurity(@ADDR(Filename$),$1 | $2 | $4,0,0,Needed#)
ADDSTRING "Rückgabe of GetFileSecurity="+@STR$(Fehler&)
ADDSTRING "Letzter API-Fehler="+@STR$(@GetLastError())
LET NEEDED&=@LONG(Needed#,0)
ADDSTRING "Erforderliche length the Security Descriptor="+@STR$(Needed&)
CASE NEEDED&=0 : LET NEEDED&=1024
DIM PSECURITY_DESCRIPTOR#,Needed&
Clear PSECURITY_DESCRIPTOR#
@SetLastError(0)
LET Fehler&=@GetFileSecurity(@ADDR(Filename$),$1 | $2 | $4,PSECURITY_DESCRIPTOR#,NEEDED&,Needed#)
ADDSTRING "Rückgabe of GetFileSecurity="+@STR$(Fehler&)
ADDSTRING "Letzter API-Fehler="+@STR$(@GetLastError())
LET Fehler&=@IsValidSecurityDescriptor(PSECURITY_DESCRIPTOR#)
ADDSTRING "Rückgabe of IsValidSecurityDescriptor="+@STR$(Fehler&)
ADDSTRING "Letzter API-Fehler="+@STR$(@GetLastError())
DIM SID#,4
DIM GFlag#,2
Clear SID#
Clear GFLAG#
LET FEHLER&=@GetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR#,SID#,GFLAG#)
ADDSTRING "Rückgabe of GetSecurityDescriptorOwner="+@STR$(Fehler&)
ADDSTRING "Letzter API-Fehler="+@STR$(@GetLastError())
LET Fehler&=@IsValidSid(@long(SID#,0))
ADDSTRING "Rückgabe of IsValidSid for Besitzer="+@STR$(Fehler&)
ADDSTRING "Letzter API-Fehler="+@STR$(@GetLastError())
LET Fehler&=@IsValidSid(@long(SID#,0))
ADDSTRING "Rückgabe of IsValidSid for Besitzer="+@STR$(Fehler&)
ADDSTRING "Letzter API-Fehler="+@STR$(@GetLastError())
DIM ACCOUNT_NAME#,256
DIM SIZE_ACCOUNT#,4
DIM Domain#,256
DIM SIZE_DOMAIN#,4
DIM SID_NAME_USE#,4
Clear SID_NAME_USE#,SYSTEM$
Clear ACCOUNT_NAME#,Domain#
LONG SIZE_ACCOUNT#,0=255
LONG SIZE_DOMAIN#,0=255
LET FEHLER&=@LookupAccountSid(@ADDR(system$),@Long(SID#,0),ACCOUNT_NAME#,SIZE_ACCOUNT#,Domain#,SIZE_DOMAIN#,SID_NAME_USE#)
ADDSTRING "Rückgabe of LookupAccountSid="+@STR$(Fehler&)
ADDSTRING "Letzter API-Fehler="+@STR$(@GetLastError())
ADDSTRING "Reset the API-Fehlers becomes durchgeführt"
@SetLastError(0)
ADDSTRING "Besitzer the Datei="+@String $(ACCOUNT_NAME#,0)
ADDSTRING "Control Flag="+@STR$(@Word(GFLAG#,0))
Dispose SID_NAME_USE#
Dispose ACCOUNT_NAME#
Dispose Domain#
Dispose SIZE_ACCOUNT#
Dispose SIZE_DOMAIN#
Dispose NEEDED#
Dispose PSECURITY_DESCRIPTOR#
Dispose SID#
Dispose GFLAG#
@EDITBOX("Rückgaben",1)
[keywords:b74f001168] proprietor Owner owner File Objekt Key Registry Security Descriptor SID Security Identifier [/keywords:b74f001168] |
|
|
| |
|
|