| 1 |
// Licensed under the Apache License, Version 2.0 |
| 2 |
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 3 |
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. |
| 4 |
// All files in the project carrying such notice may not be copied, modified, or distributed |
| 5 |
// except according to those terms. |
| 6 |
use shared::guiddef::GUID; |
| 7 |
use shared::minwindef::{BOOL, DWORD, PULONG, ULONG, USHORT}; |
| 8 |
use um::accctrl::{ |
| 9 |
ACCESS_MODE, MULTIPLE_TRUSTEE_OPERATION, PEXPLICIT_ACCESS_A, PEXPLICIT_ACCESS_W, |
| 10 |
PFN_OBJECT_MGR_FUNCTS, PINHERITED_FROMA, PINHERITED_FROMW, POBJECTS_AND_NAME_A, |
| 11 |
POBJECTS_AND_NAME_W, POBJECTS_AND_SID, PPROG_INVOKE_SETTING, PROG_INVOKE_SETTING, PTRUSTEE_A, |
| 12 |
PTRUSTEE_W, SE_OBJECT_TYPE, TRUSTEE_FORM, TRUSTEE_TYPE |
| 13 |
}; |
| 14 |
use um::winnt::{ |
| 15 |
HANDLE, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PACCESS_MASK, PACL, PGENERIC_MAPPING, |
| 16 |
PSECURITY_DESCRIPTOR, PSID, PVOID, SECURITY_INFORMATION |
| 17 |
}; |
| 18 |
FN!{cdecl FN_PROGRESS( |
| 19 |
pObjectName: LPWSTR, |
| 20 |
Status: DWORD, |
| 21 |
pInvokeSetting: PPROG_INVOKE_SETTING, |
| 22 |
Args: PVOID, |
| 23 |
SecuritySet: BOOL, |
| 24 |
) -> ()} |
| 25 |
extern "system" { |
| 26 |
pub fn SetEntriesInAclA( |
| 27 |
cCountOfExplicitEntries: ULONG, |
| 28 |
pListOfExplicitEntries: PEXPLICIT_ACCESS_A, |
| 29 |
OldAcl: PACL, |
| 30 |
NewAcl: *mut PACL, |
| 31 |
) -> DWORD; |
| 32 |
pub fn SetEntriesInAclW( |
| 33 |
cCountOfExplicitEntries: ULONG, |
| 34 |
pListOfExplicitEntries: PEXPLICIT_ACCESS_W, |
| 35 |
OldAcl: PACL, |
| 36 |
NewAcl: *mut PACL, |
| 37 |
) -> DWORD; |
| 38 |
pub fn GetExplicitEntriesFromAclA( |
| 39 |
pacl: PACL, |
| 40 |
pcCountOfExplicitEntries: PULONG, |
| 41 |
pListOfExplicitEntries: *mut PEXPLICIT_ACCESS_A, |
| 42 |
) -> DWORD; |
| 43 |
pub fn GetExplicitEntriesFromAclW( |
| 44 |
pacl: PACL, |
| 45 |
pcCountOfExplicitEntries: PULONG, |
| 46 |
pListOfExplicitEntries: *mut PEXPLICIT_ACCESS_W, |
| 47 |
) -> DWORD; |
| 48 |
pub fn GetEffectiveRightsFromAclA( |
| 49 |
pacl: PACL, |
| 50 |
pTrustee: PTRUSTEE_A, |
| 51 |
pAccessRight: PACCESS_MASK, |
| 52 |
) -> DWORD; |
| 53 |
pub fn GetEffectiveRightsFromAclW( |
| 54 |
pacl: PACL, |
| 55 |
pTrustee: PTRUSTEE_W, |
| 56 |
pAccessRight: PACCESS_MASK, |
| 57 |
) -> DWORD; |
| 58 |
pub fn GetAuditedPermissionsFromAclA( |
| 59 |
pAcl: PACL, |
| 60 |
pTrustee: PTRUSTEE_A, |
| 61 |
pSuccessfulAuditedRights: PACCESS_MASK, |
| 62 |
pFailedAuditRights: PACCESS_MASK, |
| 63 |
) -> DWORD; |
| 64 |
pub fn GetAuditedPermissionsFromAclW( |
| 65 |
pAcl: PACL, |
| 66 |
pTrustee: PTRUSTEE_W, |
| 67 |
pSuccessfulAuditedRights: PACCESS_MASK, |
| 68 |
pFailedAuditRights: PACCESS_MASK, |
| 69 |
) -> DWORD; |
| 70 |
pub fn GetNamedSecurityInfoA( |
| 71 |
pObjectName: LPCSTR, |
| 72 |
ObjectType: SE_OBJECT_TYPE, |
| 73 |
SecurityInfo: SECURITY_INFORMATION, |
| 74 |
ppsidOwner: *mut PSID, |
| 75 |
ppsidGroup: *mut PSID, |
| 76 |
ppDacl: *mut PACL, |
| 77 |
ppSacl: *mut PACL, |
| 78 |
ppSecurityDescriptor: *mut PSECURITY_DESCRIPTOR, |
| 79 |
) -> DWORD; |
| 80 |
pub fn GetNamedSecurityInfoW( |
| 81 |
pObjectName: LPCWSTR, |
| 82 |
ObjectType: SE_OBJECT_TYPE, |
| 83 |
SecurityInfo: SECURITY_INFORMATION, |
| 84 |
ppsidOwner: *mut PSID, |
| 85 |
ppsidGroup: *mut PSID, |
| 86 |
ppDacl: *mut PACL, |
| 87 |
ppSacl: *mut PACL, |
| 88 |
ppSecurityDescriptor: *mut PSECURITY_DESCRIPTOR, |
| 89 |
) -> DWORD; |
| 90 |
pub fn GetSecurityInfo( |
| 91 |
handle: HANDLE, |
| 92 |
ObjectType: SE_OBJECT_TYPE, |
| 93 |
SecurityInfo: SECURITY_INFORMATION, |
| 94 |
ppsidOwner: *mut PSID, |
| 95 |
ppsidGroup: *mut PSID, |
| 96 |
ppDacl: *mut PACL, |
| 97 |
ppSacl: *mut PACL, |
| 98 |
ppSecurityDescriptor: *mut PSECURITY_DESCRIPTOR, |
| 99 |
) -> DWORD; |
| 100 |
pub fn SetNamedSecurityInfoA( |
| 101 |
pObjectame: LPSTR, |
| 102 |
ObjectType: SE_OBJECT_TYPE, |
| 103 |
SecurityInfo: SECURITY_INFORMATION, |
| 104 |
psidOwner: PSID, |
| 105 |
psidGroup: PSID, |
| 106 |
pDacl: PACL, |
| 107 |
pSacl: PACL, |
| 108 |
) -> DWORD; |
| 109 |
pub fn SetNamedSecurityInfoW( |
| 110 |
pObjectame: LPWSTR, |
| 111 |
ObjectType: SE_OBJECT_TYPE, |
| 112 |
SecurityInfo: SECURITY_INFORMATION, |
| 113 |
psidOwner: PSID, |
| 114 |
psidGroup: PSID, |
| 115 |
pDacl: PACL, |
| 116 |
pSacl: PACL, |
| 117 |
) -> DWORD; |
| 118 |
pub fn SetSecurityInfo( |
| 119 |
handle: HANDLE, |
| 120 |
ObjectType: SE_OBJECT_TYPE, |
| 121 |
SecurityInfo: SECURITY_INFORMATION, |
| 122 |
psidOwner: PSID, |
| 123 |
psidGroup: PSID, |
| 124 |
pDacl: PACL, |
| 125 |
pSacl: PACL, |
| 126 |
) -> DWORD; |
| 127 |
pub fn GetInheritanceSourceA( |
| 128 |
pObjectName: LPSTR, |
| 129 |
ObjectType: SE_OBJECT_TYPE, |
| 130 |
SecurityInfo: SECURITY_INFORMATION, |
| 131 |
Container: BOOL, |
| 132 |
pObjectClassGuids: *mut *mut GUID, |
| 133 |
GuidCount: DWORD, |
| 134 |
pAcl: PACL, |
| 135 |
pfnArray: PFN_OBJECT_MGR_FUNCTS, |
| 136 |
pGenericMapping: PGENERIC_MAPPING, |
| 137 |
pInheritArray: PINHERITED_FROMA, |
| 138 |
) -> DWORD; |
| 139 |
pub fn GetInheritanceSourceW( |
| 140 |
pObjectName: LPWSTR, |
| 141 |
ObjectType: SE_OBJECT_TYPE, |
| 142 |
SecurityInfo: SECURITY_INFORMATION, |
| 143 |
Container: BOOL, |
| 144 |
pObjectClassGuids: *mut *mut GUID, |
| 145 |
GuidCount: DWORD, |
| 146 |
pAcl: PACL, |
| 147 |
pfnArray: PFN_OBJECT_MGR_FUNCTS, |
| 148 |
pGenericMapping: PGENERIC_MAPPING, |
| 149 |
pInheritArray: PINHERITED_FROMW, |
| 150 |
) -> DWORD; |
| 151 |
pub fn FreeInheritedFromArray( |
| 152 |
pInheritArray: PINHERITED_FROMW, |
| 153 |
AceCnt: USHORT, |
| 154 |
pfnArray: PFN_OBJECT_MGR_FUNCTS, |
| 155 |
) -> DWORD; |
| 156 |
pub fn TreeResetNamedSecurityInfoA( |
| 157 |
pObjectName: LPSTR, |
| 158 |
ObjectType: SE_OBJECT_TYPE, |
| 159 |
SecurityInfo: SECURITY_INFORMATION, |
| 160 |
pOwner: PSID, |
| 161 |
pGroup: PSID, |
| 162 |
pDacl: PACL, |
| 163 |
pSacl: PACL, |
| 164 |
KeepExplicit: BOOL, |
| 165 |
fnProgress: FN_PROGRESS, |
| 166 |
ProgressInvokeSetting: PROG_INVOKE_SETTING, |
| 167 |
Args: PVOID, |
| 168 |
) -> DWORD; |
| 169 |
pub fn TreeResetNamedSecurityInfoW( |
| 170 |
pObjectName: LPWSTR, |
| 171 |
ObjectType: SE_OBJECT_TYPE, |
| 172 |
SecurityInfo: SECURITY_INFORMATION, |
| 173 |
pOwner: PSID, |
| 174 |
pGroup: PSID, |
| 175 |
pDacl: PACL, |
| 176 |
pSacl: PACL, |
| 177 |
KeepExplicit: BOOL, |
| 178 |
fnProgress: FN_PROGRESS, |
| 179 |
ProgressInvokeSetting: PROG_INVOKE_SETTING, |
| 180 |
Args: PVOID, |
| 181 |
) -> DWORD; |
| 182 |
pub fn TreeSetNamedSecurityInfoA( |
| 183 |
pObjectName: LPSTR, |
| 184 |
ObjectType: SE_OBJECT_TYPE, |
| 185 |
SecurityInfo: SECURITY_INFORMATION, |
| 186 |
pOwner: PSID, |
| 187 |
pGroup: PSID, |
| 188 |
pDacl: PACL, |
| 189 |
pSacl: PACL, |
| 190 |
dwAction: DWORD, |
| 191 |
fnProgress: FN_PROGRESS, |
| 192 |
ProgressInvokeSetting: PROG_INVOKE_SETTING, |
| 193 |
Args: PVOID, |
| 194 |
) -> DWORD; |
| 195 |
pub fn TreeSetNamedSecurityInfoW( |
| 196 |
pObjectName: LPWSTR, |
| 197 |
ObjectType: SE_OBJECT_TYPE, |
| 198 |
SecurityInfo: SECURITY_INFORMATION, |
| 199 |
pOwner: PSID, |
| 200 |
pGroup: PSID, |
| 201 |
pDacl: PACL, |
| 202 |
pSacl: PACL, |
| 203 |
dwAction: DWORD, |
| 204 |
fnProgress: FN_PROGRESS, |
| 205 |
ProgressInvokeSetting: PROG_INVOKE_SETTING, |
| 206 |
Args: PVOID, |
| 207 |
) -> DWORD; |
| 208 |
pub fn BuildSecurityDescriptorA( |
| 209 |
pOwner: PTRUSTEE_A, |
| 210 |
pGroup: PTRUSTEE_A, |
| 211 |
cCountOfAccessEntries: ULONG, |
| 212 |
pListOfAccessEntries: PEXPLICIT_ACCESS_A, |
| 213 |
cCountOfAuditEntries: ULONG, |
| 214 |
pListOfAuditEntries: PEXPLICIT_ACCESS_A, |
| 215 |
pOldSD: PSECURITY_DESCRIPTOR, |
| 216 |
pSizeNewSD: PULONG, |
| 217 |
pNewSD: *mut PSECURITY_DESCRIPTOR, |
| 218 |
) -> DWORD; |
| 219 |
pub fn BuildSecurityDescriptorW( |
| 220 |
pOwner: PTRUSTEE_W, |
| 221 |
pGroup: PTRUSTEE_W, |
| 222 |
cCountOfAccessEntries: ULONG, |
| 223 |
pListOfAccessEntries: PEXPLICIT_ACCESS_W, |
| 224 |
cCountOfAuditEntries: ULONG, |
| 225 |
pListOfAuditEntries: PEXPLICIT_ACCESS_W, |
| 226 |
pOldSD: PSECURITY_DESCRIPTOR, |
| 227 |
pSizeNewSD: PULONG, |
| 228 |
pNewSD: *mut PSECURITY_DESCRIPTOR, |
| 229 |
) -> DWORD; |
| 230 |
pub fn LookupSecurityDescriptorPartsA( |
| 231 |
ppOwner: *mut PTRUSTEE_A, |
| 232 |
ppGroup: *mut PTRUSTEE_A, |
| 233 |
pcCountOfAccessEntries: PULONG, |
| 234 |
ppListOfAccessEntries: *mut PEXPLICIT_ACCESS_A, |
| 235 |
pcCountOfAuditEntries: PULONG, |
| 236 |
ppListOfAuditEntries: *mut PEXPLICIT_ACCESS_A, |
| 237 |
pSD: PSECURITY_DESCRIPTOR, |
| 238 |
) -> DWORD; |
| 239 |
pub fn LookupSecurityDescriptorPartsW( |
| 240 |
ppOwner: *mut PTRUSTEE_W, |
| 241 |
ppGroup: *mut PTRUSTEE_W, |
| 242 |
pcCountOfAccessEntries: PULONG, |
| 243 |
ppListOfAccessEntries: *mut PEXPLICIT_ACCESS_W, |
| 244 |
pcCountOfAuditEntries: PULONG, |
| 245 |
ppListOfAuditEntries: *mut PEXPLICIT_ACCESS_W, |
| 246 |
pSD: PSECURITY_DESCRIPTOR, |
| 247 |
) -> DWORD; |
| 248 |
pub fn BuildExplicitAccessWithNameA( |
| 249 |
pExplicitAccess: PEXPLICIT_ACCESS_A, |
| 250 |
pTrusteeName: LPSTR, |
| 251 |
AccessPermissions: DWORD, |
| 252 |
AccessMode: ACCESS_MODE, |
| 253 |
Inheritance: DWORD, |
| 254 |
); |
| 255 |
pub fn BuildExplicitAccessWithNameW( |
| 256 |
pExplicitAccess: PEXPLICIT_ACCESS_W, |
| 257 |
pTrusteeName: LPWSTR, |
| 258 |
AccessPermissions: DWORD, |
| 259 |
AccessMode: ACCESS_MODE, |
| 260 |
Inheritance: DWORD, |
| 261 |
); |
| 262 |
pub fn BuildImpersonateExplicitAccessWithNameA( |
| 263 |
pExplicitAccess: PEXPLICIT_ACCESS_A, |
| 264 |
pTrusteeName: LPSTR, |
| 265 |
pTrustee: PTRUSTEE_A, |
| 266 |
AccessPermissions: DWORD, |
| 267 |
AccessMode: ACCESS_MODE, |
| 268 |
Inheritance: DWORD, |
| 269 |
); |
| 270 |
pub fn BuildImpersonateExplicitAccessWithNameW( |
| 271 |
pExplicitAccess: PEXPLICIT_ACCESS_W, |
| 272 |
pTrusteeName: LPWSTR, |
| 273 |
pTrustee: PTRUSTEE_W, |
| 274 |
AccessPermissions: DWORD, |
| 275 |
AccessMode: ACCESS_MODE, |
| 276 |
Inheritance: DWORD, |
| 277 |
); |
| 278 |
pub fn BuildTrusteeWithNameA( |
| 279 |
pTrustee: PTRUSTEE_A, |
| 280 |
pName: LPSTR, |
| 281 |
); |
| 282 |
pub fn BuildTrusteeWithNameW( |
| 283 |
pTrustee: PTRUSTEE_W, |
| 284 |
pName: LPWSTR, |
| 285 |
); |
| 286 |
pub fn BuildImpersonateTrusteeA( |
| 287 |
pTrustee: PTRUSTEE_A, |
| 288 |
pImpersonateTrustee: PTRUSTEE_A, |
| 289 |
); |
| 290 |
pub fn BuildImpersonateTrusteeW( |
| 291 |
pTrustee: PTRUSTEE_W, |
| 292 |
pImpersonateTrustee: PTRUSTEE_W, |
| 293 |
); |
| 294 |
pub fn BuildTrusteeWithSidA( |
| 295 |
pTrustee: PTRUSTEE_A, |
| 296 |
pSid: PSID, |
| 297 |
); |
| 298 |
pub fn BuildTrusteeWithSidW( |
| 299 |
pTrustee: PTRUSTEE_W, |
| 300 |
pSid: PSID, |
| 301 |
); |
| 302 |
pub fn BuildTrusteeWithObjectsAndSidA( |
| 303 |
pTrustee: PTRUSTEE_A, |
| 304 |
pObjSid: POBJECTS_AND_SID, |
| 305 |
pObjectGuid: *mut GUID, |
| 306 |
pInheritedObjectGuid: *mut GUID, |
| 307 |
pSid: PSID, |
| 308 |
); |
| 309 |
pub fn BuildTrusteeWithObjectsAndSidW( |
| 310 |
pTrustee: PTRUSTEE_W, |
| 311 |
pObjSid: POBJECTS_AND_SID, |
| 312 |
pObjectGuid: *mut GUID, |
| 313 |
pInheritedObjectGuid: *mut GUID, |
| 314 |
pSid: PSID, |
| 315 |
); |
| 316 |
pub fn BuildTrusteeWithObjectsAndNameA( |
| 317 |
pTrustee: PTRUSTEE_A, |
| 318 |
pObjName: POBJECTS_AND_NAME_A, |
| 319 |
ObjectType: SE_OBJECT_TYPE, |
| 320 |
ObjectTypeName: LPSTR, |
| 321 |
InheritedObjectTypeName: LPSTR, |
| 322 |
Name: LPSTR, |
| 323 |
); |
| 324 |
pub fn BuildTrusteeWithObjectsAndNameW( |
| 325 |
pTrustee: PTRUSTEE_W, |
| 326 |
pObjName: POBJECTS_AND_NAME_W, |
| 327 |
ObjectType: SE_OBJECT_TYPE, |
| 328 |
ObjectTypeName: LPWSTR, |
| 329 |
InheritedObjectTypeName: LPWSTR, |
| 330 |
Name: LPWSTR, |
| 331 |
); |
| 332 |
pub fn GetTrusteeNameA( |
| 333 |
pTrustee: PTRUSTEE_A, |
| 334 |
) -> LPSTR; |
| 335 |
pub fn GetTrusteeNameW( |
| 336 |
pTrustee: PTRUSTEE_W, |
| 337 |
) -> LPWSTR; |
| 338 |
pub fn GetTrusteeTypeA( |
| 339 |
pTrustee: PTRUSTEE_A, |
| 340 |
) -> TRUSTEE_TYPE; |
| 341 |
pub fn GetTrusteeTypeW( |
| 342 |
pTrustee: PTRUSTEE_W, |
| 343 |
) -> TRUSTEE_TYPE; |
| 344 |
pub fn GetTrusteeFormA( |
| 345 |
pTrustee: PTRUSTEE_A, |
| 346 |
) -> TRUSTEE_FORM; |
| 347 |
pub fn GetTrusteeFormW( |
| 348 |
pTrustee: PTRUSTEE_W, |
| 349 |
) -> TRUSTEE_FORM; |
| 350 |
pub fn GetMultipleTrusteeOperationA( |
| 351 |
pTrustee: PTRUSTEE_A, |
| 352 |
) -> MULTIPLE_TRUSTEE_OPERATION; |
| 353 |
pub fn GetMultipleTrusteeOperationW( |
| 354 |
pTrustee: PTRUSTEE_W, |
| 355 |
) -> MULTIPLE_TRUSTEE_OPERATION; |
| 356 |
pub fn GetMultipleTrusteeA( |
| 357 |
pTrustee: PTRUSTEE_A, |
| 358 |
) -> PTRUSTEE_A; |
| 359 |
pub fn GetMultipleTrusteeW( |
| 360 |
pTrustee: PTRUSTEE_W, |
| 361 |
) -> PTRUSTEE_W; |
| 362 |
} |