00059 {
00060 PACL FredAcl = (PACL)
FredAclBuffer;
00061 PACL WilmaAcl = (PACL)
WilmaAclBuffer;
00062 PACL PebbleAcl = (PACL)
PebbleAclBuffer;
00063 PACL DinoAcl = (PACL)
DinoAclBuffer;
00064 PACL BarneyAcl = (PACL)
BarneyAclBuffer;
00065 PACL BettyAcl = (PACL)
BettyAclBuffer;
00066 PACL BambamAcl = (PACL)
BambamAclBuffer;
00067
00068 PMASK_GUID_PAIRS GuidMasks = (PMASK_GUID_PAIRS)
GuidMaskBuffer;
00069
00070 ACL_REVISION_INFORMATION AclRevisionInfo;
00071 ACL_SIZE_INFORMATION AclSizeInfo;
00072
00073
00074
00075
00076
00077
DbgPrint(
"Start Acl Test\n");
00078
00079
00080
00081
00082
00083
if (!
NT_SUCCESS(
RtlCreateAcl(FredAcl, 128, 1))) {
00084
DbgPrint(
"RtlCreateAcl Error\n");
00085 }
00086
00087
RtlDumpAcl(FredAcl);
00088
DbgPrint(
"\n");
00089
00090
00091
00092
00093
00094
AceListBuffer[0].
Header.AceType = ACCESS_ALLOWED_ACE_TYPE;
00095
AceListBuffer[0].
Header.AceSize =
sizeof(
STANDARD_ACE);
00096
AceListBuffer[0].
Header.AceFlags = 0;
00097
AceListBuffer[0].
Mask = 0x22222222;
00098 CopyGuid(&AceListBuffer[0].Guid, &FredGuid);
00099
00100
AceListBuffer[1].
Header.AceType = ACCESS_ALLOWED_ACE_TYPE;
00101
AceListBuffer[1].
Header.AceSize =
sizeof(
STANDARD_ACE);
00102
AceListBuffer[1].
Header.AceFlags = 0;
00103
AceListBuffer[1].
Mask = 0x44444444;
00104 CopyGuid(&AceListBuffer[1].Guid, &WilmaGuid);
00105
00106
if (!
NT_SUCCESS(
RtlAddAce(FredAcl, 1, 0, AceListBuffer, 2*
sizeof(
STANDARD_ACE)))) {
00107
DbgPrint(
"RtlAddAce Error\n");
00108 }
00109
00110
RtlDumpAcl(FredAcl);
00111
DbgPrint(
"\n");
00112
00113
00114
00115
00116
00117
AceListBuffer[0].
Header.AceType = SYSTEM_AUDIT_ACE_TYPE;
00118
AceListBuffer[0].
Header.AceSize =
sizeof(
STANDARD_ACE);
00119
AceListBuffer[0].
Header.AceFlags = 0;
00120
AceListBuffer[0].
Mask = 0x11111111;
00121 CopyGuid(&AceListBuffer[0].Guid, &PebbleGuid);
00122
00123
if (!
NT_SUCCESS(
RtlAddAce(FredAcl, 1, 0, AceListBuffer,
sizeof(
STANDARD_ACE)))) {
00124
DbgPrint(
"RtlAddAce Error\n");
00125 }
00126
00127
RtlDumpAcl(FredAcl);
00128
DbgPrint(
"\n");
00129
00130
00131
00132
00133
00134
AceListBuffer[0].
Header.AceType = ACCESS_DENIED_ACE_TYPE;
00135
AceListBuffer[0].
Header.AceSize =
sizeof(
STANDARD_ACE);
00136
AceListBuffer[0].
Header.AceFlags = 0;
00137
AceListBuffer[0].
Mask = 0x33333333;
00138 CopyGuid(&AceListBuffer[0].Guid, &DinoGuid);
00139
00140
if (!
NT_SUCCESS(
RtlAddAce(FredAcl, 1, 2, AceListBuffer,
sizeof(
STANDARD_ACE)))) {
00141
DbgPrint(
"RtlAddAce Error\n");
00142 }
00143
00144
RtlDumpAcl(FredAcl);
00145
DbgPrint(
"\n");
00146
00147
00148
00149
00150
00151
AceListBuffer[0].
Header.AceType = ACCESS_DENIED_ACE_TYPE;
00152
AceListBuffer[0].
Header.AceSize =
sizeof(
STANDARD_ACE);
00153
AceListBuffer[0].
Header.AceFlags = 0;
00154
AceListBuffer[0].
Mask = 0x55555555;
00155 CopyGuid(&AceListBuffer[0].Guid, &FlintstoneGuid);
00156
00157
if (!
NT_SUCCESS(
RtlAddAce(FredAcl, 1, MAXULONG, AceListBuffer,
sizeof(
STANDARD_ACE)))) {
00158
DbgPrint(
"RtlAddAce Error\n");
00159 }
00160
00161
RtlDumpAcl(FredAcl);
00162
DbgPrint(
"\n");
00163
00164
00165
00166
00167
00168 {
00169
PSTANDARD_ACE Ace;
00170
00171
if (!
NT_SUCCESS(
RtlGetAce(FredAcl, 2, (PVOID *)(&Ace)))) {
00172
DbgPrint(
"RtlGetAce Error\n");
00173 }
00174
00175
if ((Ace->
Header.AceType != ACCESS_DENIED_ACE_TYPE) ||
00176 (Ace->
Mask != 0x33333333)) {
00177
DbgPrint(
"Got bad ace from RtlGetAce\n");
00178 }
00179 }
00180
00181
00182
00183
00184
00185
if (!
NT_SUCCESS(
RtlDeleteAce(FredAcl, 2))) {
00186
DbgPrint(
"RtlDeleteAce Error\n");
00187 }
00188
00189
RtlDumpAcl(FredAcl);
00190
DbgPrint(
"\n");
00191
00192
00193
00194
00195
00196
if (!
NT_SUCCESS(
RtlQueryInformationAcl( FredAcl,
00197 (PVOID)&AclRevisionInfo,
00198
sizeof(ACL_REVISION_INFORMATION),
00199 AclRevisionInformation))) {
00200
DbgPrint(
"RtlQueryInformationAcl Error\n");
00201 }
00202
if (AclRevisionInfo.AclRevision != ACL_REVISION) {
00203
DbgPrint(
"RtlAclRevision Error\n");
00204 }
00205
00206
if (!
NT_SUCCESS(
RtlQueryInformationAcl( FredAcl,
00207 (PVOID)&AclSizeInfo,
00208
sizeof(ACL_SIZE_INFORMATION),
00209 AclSizeInformation))) {
00210
DbgPrint(
"RtlQueryInformationAcl Error\n");
00211 }
00212
if ((AclSizeInfo.AceCount != 4) ||
00213 (AclSizeInfo.AclBytesInUse != (
sizeof(ACL)+4*
sizeof(
STANDARD_ACE))) ||
00214 (AclSizeInfo.AclBytesFree != 128 - AclSizeInfo.AclBytesInUse)) {
00215
DbgPrint(
"RtlAclSize Error\n");
00216
DbgPrint(
"AclSizeInfo.AceCount = %8lx\n", AclSizeInfo.AceCount);
00217
DbgPrint(
"AclSizeInfo.AclBytesInUse = %8lx\n", AclSizeInfo.AclBytesInUse);
00218
DbgPrint(
"AclSizeInfo.AclBytesFree = %8lx\n", AclSizeInfo.AclBytesFree);
00219
DbgPrint(
"\n");
00220 }
00221
00222
00223
00224
00225
00226 GuidMasks->PairCount = 11;
00227 CopyGuid(&GuidMasks->MaskGuid[ 0].Guid, &FredGuid);
00228 CopyGuid(&GuidMasks->MaskGuid[ 1].Guid, &WilmaGuid);
00229 CopyGuid(&GuidMasks->MaskGuid[ 2].Guid, &PebbleGuid);
00230 CopyGuid(&GuidMasks->MaskGuid[ 3].Guid, &DinoGuid);
00231 CopyGuid(&GuidMasks->MaskGuid[ 4].Guid, &BarneyGuid);
00232 CopyGuid(&GuidMasks->MaskGuid[ 5].Guid, &BettyGuid);
00233 CopyGuid(&GuidMasks->MaskGuid[ 6].Guid, &BambamGuid);
00234 CopyGuid(&GuidMasks->MaskGuid[ 7].Guid, &FlintstoneGuid);
00235 CopyGuid(&GuidMasks->MaskGuid[ 8].Guid, &RubbleGuid);
00236 CopyGuid(&GuidMasks->MaskGuid[ 9].Guid, &AdultGuid);
00237 CopyGuid(&GuidMasks->MaskGuid[10].Guid, &ChildGuid);
00238
if (!
NT_SUCCESS(RtlMakeMaskFromAcl(FredAcl, GuidMasks))) {
00239
DbgPrint(
"RtlMakeMaskFromAcl Error\n");
00240 }
00241
if ((GuidMasks->MaskGuid[ 0].Mask != 0x22222222) ||
00242 (GuidMasks->MaskGuid[ 1].Mask != 0x44444444) ||
00243 (GuidMasks->MaskGuid[ 2].Mask != 0x00000000) ||
00244 (GuidMasks->MaskGuid[ 3].Mask != 0x00000000) ||
00245 (GuidMasks->MaskGuid[ 4].Mask != 0x00000000) ||
00246 (GuidMasks->MaskGuid[ 5].Mask != 0x00000000) ||
00247 (GuidMasks->MaskGuid[ 6].Mask != 0x00000000) ||
00248 (GuidMasks->MaskGuid[ 7].Mask != 0x00000000) ||
00249 (GuidMasks->MaskGuid[ 8].Mask != 0x00000000) ||
00250 (GuidMasks->MaskGuid[ 9].Mask != 0x00000000) ||
00251 (GuidMasks->MaskGuid[10].Mask != 0x00000000)) {
00252
DbgPrint(
"Make Mask Error\n");
00253
DbgPrint(
"Fred gets %8lx\n", GuidMasks->MaskGuid[ 0].Mask);
00254
DbgPrint(
"Wilma gets %8lx\n", GuidMasks->MaskGuid[ 1].Mask);
00255
DbgPrint(
"Pebble gets %8lx\n", GuidMasks->MaskGuid[ 2].Mask);
00256
DbgPrint(
"Dino gets %8lx\n", GuidMasks->MaskGuid[ 3].Mask);
00257
DbgPrint(
"Barney gets %8lx\n", GuidMasks->MaskGuid[ 4].Mask);
00258
DbgPrint(
"Betty gets %8lx\n", GuidMasks->MaskGuid[ 5].Mask);
00259
DbgPrint(
"Banbam gets %8lx\n", GuidMasks->MaskGuid[ 6].Mask);
00260
DbgPrint(
"Flintstone gets %8lx\n", GuidMasks->MaskGuid[ 7].Mask);
00261
DbgPrint(
"Rubble gets %8lx\n", GuidMasks->MaskGuid[ 8].Mask);
00262
DbgPrint(
"Adult gets %8lx\n", GuidMasks->MaskGuid[ 9].Mask);
00263
DbgPrint(
"Child gets %8lx\n", GuidMasks->MaskGuid[10].Mask);
00264 }
00265
00266
00267
00268
00269
00270 GuidMasks->PairCount = 2;
00271 GuidMasks->MaskGuid[0].Mask = 0x55555555;
00272 CopyGuid(&GuidMasks->MaskGuid[0].Guid, &BarneyGuid);
00273 GuidMasks->MaskGuid[1].Mask = 0xaaaa5555;
00274 CopyGuid(&GuidMasks->MaskGuid[1].Guid, &RubbleGuid);
00275
00276
00277
00278
00279
00280
if (!
NT_SUCCESS(RtlMakeAclFromMask(GuidMasks, AclPosixEnvironment, BarneyAcl, 128, 1))) {
00281
DbgPrint(
"RtlMakeAclFromMask Error\n");
00282 }
00283
00284
RtlDumpAcl(BarneyAcl);
00285
DbgPrint(
"\n");
00286
00287
00288
00289
00290
00291
if (!
NT_SUCCESS(RtlMakeAclFromMask(GuidMasks, AclOs2Environment, BettyAcl, 128, 1))) {
00292
DbgPrint(
"RtlMakeAclFromMask Error\n");
00293 }
00294
00295
RtlDumpAcl(BettyAcl);
00296
DbgPrint(
"\n");
00297
00298
00299
00300
00301
00302
DbgPrint(
"End Acl Test\n");
00303
00304
return TRUE;
00305 }