04886 {
04887 BOOLEAN CompletionStatus =
TRUE;
04888
NTSTATUS Status;
04889
NTSTATUS IgnoreStatus;
04890
04891 PTOKEN_GROUPS NewState;
04892 PTOKEN_GROUPS PreviousState;
04893 PTOKEN_GROUPS PreGroups;
04894 PTOKEN_GROUPS PostGroups;
04895
04896 ULONG NewStateBufferLength = 600;
04897 ULONG PreviousStateBufferLength = 600;
04898 ULONG PreGroupsLength = 600;
04899 ULONG PostGroupsLength = 600;
04900
04901 ULONG ReturnLength;
04902 ULONG IgnoreReturnLength;
04903
04904
DbgPrint(
"\n");
04905
04906 PreviousState = (PTOKEN_GROUPS)TstAllocatePool(
04907 PagedPool,
04908 PreviousStateBufferLength
04909 );
04910
04911 PreGroups = (PTOKEN_GROUPS)TstAllocatePool(
04912 PagedPool,
04913 PreGroupsLength
04914 );
04915
04916 PostGroups = (PTOKEN_GROUPS)TstAllocatePool(
04917 PagedPool,
04918 PostGroupsLength
04919 );
04920
04921 NewState = (PTOKEN_GROUPS)TstAllocatePool(
04922 PagedPool,
04923 NewStateBufferLength
04924 );
04925
04926
04927
04928
04929
04931
04932
04933
04935
04936
04937
DbgPrint(
"Se: Adjust groups with no instructions ... ");
04938
04939
Status =
NtAdjustGroupsToken(
04940 SimpleToken,
04941 FALSE,
04942 NULL,
04943 0,
04944 NULL,
04945 &ReturnLength
04946 );
04947
04948
if (
Status == STATUS_INVALID_PARAMETER) {
04949
04950
DbgPrint(
"Succeeded. \n");
04951
04952 }
else {
04953
04954
DbgPrint(
"********** Failed ************\n");
04955
DbgPrint(
"Status is: 0x%lx \n", Status);
04956
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
04957 CompletionStatus =
FALSE;
04958
04959 }
04960
04961
ASSERT(Status == STATUS_INVALID_PARAMETER);
04962
04963
04965
04966
04967
04969
04970
DbgPrint(
"Se: Disable unknown group ... ");
04971
04972 PreGroups->GroupCount = 77;
04973 IgnoreStatus =
NtQueryInformationToken(
04974 TokenWithGroups,
04975 TokenGroups,
04976 PreGroups,
04977 PreGroupsLength,
04978 &IgnoreReturnLength
04979 );
04980
#ifdef TOKEN_DEBUG
04981
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
04982
#endif //TOKEN_DEBUG
04983
04984
if (IgnoreStatus != STATUS_SUCCESS) {
04985
DbgPrint(
" \n IgnoreStatus = 0x%lx \n", IgnoreStatus);
04986
DbgPrint(
" \n IgnoreReturnLength = 0x%lx \n", IgnoreReturnLength);
04987 }
04988
04989
ASSERT(PreGroups->GroupCount == GROUP_COUNT );
04990
ASSERT(PreGroups->Groups[FLINTSTONE_INDEX].Attributes == OwnerGroupAttributes);
04991
ASSERT(PreGroups->Groups[CHILD_INDEX].Attributes == OptionalGroupAttributes);
04992
ASSERT(PreGroups->Groups[NEANDERTHOL_INDEX].Attributes == OptionalGroupAttributes);
04993
ASSERT(PreGroups->Groups[WORLD_INDEX].Attributes == NormalGroupAttributes);
04994
ASSERT(
NT_SUCCESS(IgnoreStatus) );
04995
04996 NewState->GroupCount = 1;
04997 NewState->Groups[0].Sid =
RubbleSid;
04998 NewState->Groups[0].Attributes =
DisabledGroupAttributes;
04999
05000
Status =
NtAdjustGroupsToken(
05001 TokenWithGroups,
05002 FALSE,
05003 NewState,
05004 0,
05005 NULL,
05006 &ReturnLength
05007 );
05008
05009 PostGroups->GroupCount = 88;
05010 IgnoreStatus =
NtQueryInformationToken(
05011 TokenWithGroups,
05012 TokenGroups,
05013 PostGroups,
05014 PostGroupsLength,
05015 &IgnoreReturnLength
05016 );
05017
#ifdef TOKEN_DEBUG
05018
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
05019
#endif //TOKEN_DEBUG
05020
05021
ASSERT(
NT_SUCCESS(IgnoreStatus) );
05022
05023
if (
Status == STATUS_NOT_ALL_ASSIGNED) {
05024
05025
05026
05027
05028
05029
ASSERT( PostGroups->GroupCount == GROUP_COUNT );
05030
if ( (PostGroups->Groups[
FLINTSTONE_INDEX].Attributes ==
OwnerGroupAttributes) &&
05031 (PostGroups->Groups[
CHILD_INDEX].Attributes ==
OptionalGroupAttributes) &&
05032 (PostGroups->Groups[
NEANDERTHOL_INDEX].Attributes ==
OptionalGroupAttributes) &&
05033 (PostGroups->Groups[
WORLD_INDEX].Attributes ==
NormalGroupAttributes)
05034 ) {
05035
05036
DbgPrint(
"Succeeded. \n");
05037
05038 }
else {
05039
05040
DbgPrint(
"********** Failed Value Check ************\n");
05041
DbgPrint(
"Status is: 0x%lx \n", Status);
05042
05043
DbgPrint(
"Before/after Flintstone state: 0x%lx / 0x%lx \n",
05044 PreGroups->Groups[FLINTSTONE_INDEX].Attributes,
05045 PostGroups->Groups[FLINTSTONE_INDEX].Attributes);
05046
05047
DbgPrint(
"Before/after Child state: 0x%lx / 0x%lx \n",
05048 PreGroups->Groups[CHILD_INDEX].Attributes,
05049 PostGroups->Groups[CHILD_INDEX].Attributes);
05050
05051
DbgPrint(
"Before/after Neanderthol state: 0x%lx / 0x%lx \n",
05052 PreGroups->Groups[NEANDERTHOL_INDEX].Attributes,
05053 PostGroups->Groups[NEANDERTHOL_INDEX].Attributes);
05054
05055
DbgPrint(
"Before/after World state: 0x%lx / 0x%lx \n",
05056 PreGroups->Groups[WORLD_INDEX].Attributes,
05057 PostGroups->Groups[WORLD_INDEX].Attributes);
05058
05059
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
05060
05061 CompletionStatus =
FALSE;
05062
05063 }
05064
05065 }
else {
05066
05067
DbgPrint(
"********** Failed ************\n");
05068
DbgPrint(
"Status is: 0x%lx \n", Status);
05069
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
05070 CompletionStatus =
FALSE;
05071
05072 }
05073
05074
ASSERT(Status == STATUS_NOT_ALL_ASSIGNED);
05075
05076
05077
05079
05080
05081
05083
05084
DbgPrint(
"Se: Enable unknown group ... ");
05085
05086 PreGroups->GroupCount = 77;
05087 IgnoreStatus =
NtQueryInformationToken(
05088 TokenWithGroups,
05089 TokenGroups,
05090 PreGroups,
05091 PreGroupsLength,
05092 &IgnoreReturnLength
05093 );
05094
#ifdef TOKEN_DEBUG
05095
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
05096
#endif //TOKEN_DEBUG
05097
05098
ASSERT(PreGroups->GroupCount == GROUP_COUNT );
05099
ASSERT(PreGroups->Groups[FLINTSTONE_INDEX].Attributes == OwnerGroupAttributes);
05100
ASSERT(PreGroups->Groups[CHILD_INDEX].Attributes == OptionalGroupAttributes);
05101
ASSERT(PreGroups->Groups[NEANDERTHOL_INDEX].Attributes == OptionalGroupAttributes);
05102
ASSERT(PreGroups->Groups[WORLD_INDEX].Attributes == NormalGroupAttributes);
05103
ASSERT(
NT_SUCCESS(IgnoreStatus) );
05104
05105 NewState->GroupCount = 1;
05106 NewState->Groups[0].Sid =
RubbleSid;
05107 NewState->Groups[0].Attributes =
OptionalGroupAttributes;
05108
05109
Status =
NtAdjustGroupsToken(
05110 TokenWithGroups,
05111 FALSE,
05112 NewState,
05113 0,
05114 NULL,
05115 &ReturnLength
05116 );
05117
05118 PostGroups->GroupCount = 88;
05119 IgnoreStatus =
NtQueryInformationToken(
05120 TokenWithGroups,
05121 TokenGroups,
05122 PostGroups,
05123 PostGroupsLength,
05124 &IgnoreReturnLength
05125 );
05126
#ifdef TOKEN_DEBUG
05127
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
05128
#endif //TOKEN_DEBUG
05129
05130
ASSERT(
NT_SUCCESS(IgnoreStatus) );
05131
05132
if (
Status == STATUS_NOT_ALL_ASSIGNED) {
05133
05134
05135
05136
05137
05138
ASSERT( PostGroups->GroupCount == GROUP_COUNT );
05139
if ( (PostGroups->Groups[
FLINTSTONE_INDEX].Attributes ==
OwnerGroupAttributes) &&
05140 (PostGroups->Groups[
CHILD_INDEX].Attributes ==
OptionalGroupAttributes) &&
05141 (PostGroups->Groups[
NEANDERTHOL_INDEX].Attributes ==
OptionalGroupAttributes) &&
05142 (PostGroups->Groups[
WORLD_INDEX].Attributes ==
NormalGroupAttributes)
05143 ) {
05144
05145
DbgPrint(
"Succeeded. \n");
05146
05147 }
else {
05148
05149
DbgPrint(
"********** Failed Value Check ************\n");
05150
DbgPrint(
"Status is: 0x%lx \n", Status);
05151
05152
DbgPrint(
"Before/after Flintstone state: 0x%lx / 0x%lx \n",
05153 PreGroups->Groups[FLINTSTONE_INDEX].Attributes,
05154 PostGroups->Groups[FLINTSTONE_INDEX].Attributes);
05155
05156
DbgPrint(
"Before/after Child state: 0x%lx / 0x%lx \n",
05157 PreGroups->Groups[CHILD_INDEX].Attributes,
05158 PostGroups->Groups[CHILD_INDEX].Attributes);
05159
05160
DbgPrint(
"Before/after Neanderthol state: 0x%lx / 0x%lx \n",
05161 PreGroups->Groups[NEANDERTHOL_INDEX].Attributes,
05162 PostGroups->Groups[NEANDERTHOL_INDEX].Attributes);
05163
05164
DbgPrint(
"Before/after World state: 0x%lx / 0x%lx \n",
05165 PreGroups->Groups[WORLD_INDEX].Attributes,
05166 PostGroups->Groups[WORLD_INDEX].Attributes);
05167
05168
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
05169
05170 CompletionStatus =
FALSE;
05171
05172 }
05173
05174 }
else {
05175
05176
DbgPrint(
"********** Failed ************\n");
05177
DbgPrint(
"Status is: 0x%lx \n", Status);
05178
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
05179 CompletionStatus =
FALSE;
05180
05181 }
05182
05183
ASSERT(Status == STATUS_NOT_ALL_ASSIGNED);
05184
05185
05186
05188
05189
05190
05192
05193
DbgPrint(
"Se: Disable mandatory group ... ");
05194
05195 PreGroups->GroupCount = 77;
05196 IgnoreStatus =
NtQueryInformationToken(
05197 TokenWithGroups,
05198 TokenGroups,
05199 PreGroups,
05200 PreGroupsLength,
05201 &IgnoreReturnLength
05202 );
05203
#ifdef TOKEN_DEBUG
05204
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
05205
#endif //TOKEN_DEBUG
05206
05207
ASSERT(PreGroups->GroupCount == GROUP_COUNT );
05208
ASSERT(PreGroups->Groups[FLINTSTONE_INDEX].Attributes == OwnerGroupAttributes);
05209
ASSERT(PreGroups->Groups[CHILD_INDEX].Attributes == OptionalGroupAttributes);
05210
ASSERT(PreGroups->Groups[NEANDERTHOL_INDEX].Attributes == OptionalGroupAttributes);
05211
ASSERT(PreGroups->Groups[WORLD_INDEX].Attributes == NormalGroupAttributes);
05212
ASSERT(
NT_SUCCESS(IgnoreStatus) );
05213
05214 NewState->GroupCount = 1;
05215 NewState->Groups[0].Sid =
WorldSid;
05216 NewState->Groups[0].Attributes =
DisabledGroupAttributes;
05217
05218
Status =
NtAdjustGroupsToken(
05219 TokenWithGroups,
05220 FALSE,
05221 NewState,
05222 0,
05223 NULL,
05224 &ReturnLength
05225 );
05226
05227 PostGroups->GroupCount = 88;
05228 IgnoreStatus =
NtQueryInformationToken(
05229 TokenWithGroups,
05230 TokenGroups,
05231 PostGroups,
05232 PostGroupsLength,
05233 &IgnoreReturnLength
05234 );
05235
#ifdef TOKEN_DEBUG
05236
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
05237
#endif //TOKEN_DEBUG
05238
05239
ASSERT(
NT_SUCCESS(IgnoreStatus) );
05240
05241
if (
Status == STATUS_CANT_DISABLE_MANDATORY) {
05242
05243
05244
05245
05246
05247
ASSERT( PostGroups->GroupCount == GROUP_COUNT );
05248
if ( (PostGroups->Groups[
FLINTSTONE_INDEX].Attributes ==
OwnerGroupAttributes) &&
05249 (PostGroups->Groups[
CHILD_INDEX].Attributes ==
OptionalGroupAttributes) &&
05250 (PostGroups->Groups[
NEANDERTHOL_INDEX].Attributes ==
OptionalGroupAttributes) &&
05251 (PostGroups->Groups[
WORLD_INDEX].Attributes ==
NormalGroupAttributes)
05252 ) {
05253
05254
DbgPrint(
"Succeeded. \n");
05255
05256 }
else {
05257
05258
DbgPrint(
"********** Failed Value Check ************\n");
05259
DbgPrint(
"Status is: 0x%lx \n", Status);
05260
05261
DbgPrint(
"Before/after Flintstone state: 0x%lx / 0x%lx \n",
05262 PreGroups->Groups[FLINTSTONE_INDEX].Attributes,
05263 PostGroups->Groups[FLINTSTONE_INDEX].Attributes);
05264
05265
DbgPrint(
"Before/after Child state: 0x%lx / 0x%lx \n",
05266 PreGroups->Groups[CHILD_INDEX].Attributes,
05267 PostGroups->Groups[CHILD_INDEX].Attributes);
05268
05269
DbgPrint(
"Before/after Neanderthol state: 0x%lx / 0x%lx \n",
05270 PreGroups->Groups[NEANDERTHOL_INDEX].Attributes,
05271 PostGroups->Groups[NEANDERTHOL_INDEX].Attributes);
05272
05273
DbgPrint(
"Before/after World state: 0x%lx / 0x%lx \n",
05274 PreGroups->Groups[WORLD_INDEX].Attributes,
05275 PostGroups->Groups[WORLD_INDEX].Attributes);
05276
05277
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
05278
05279 CompletionStatus =
FALSE;
05280
05281 }
05282
05283 }
else {
05284
05285
DbgPrint(
"********** Failed ************\n");
05286
DbgPrint(
"Status is: 0x%lx \n", Status);
05287
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
05288 CompletionStatus =
FALSE;
05289
05290 }
05291
05292
ASSERT(Status == STATUS_CANT_DISABLE_MANDATORY);
05293
05294
05295
05296
05298
05299
05300
05302
05303
DbgPrint(
"Se: Enable mandatory group ... ");
05304
05305 PreGroups->GroupCount = 77;
05306 IgnoreStatus =
NtQueryInformationToken(
05307 TokenWithGroups,
05308 TokenGroups,
05309 PreGroups,
05310 PreGroupsLength,
05311 &IgnoreReturnLength
05312 );
05313
#ifdef TOKEN_DEBUG
05314
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
05315
#endif //TOKEN_DEBUG
05316
05317
ASSERT(PreGroups->GroupCount == GROUP_COUNT );
05318
ASSERT(PreGroups->Groups[FLINTSTONE_INDEX].Attributes == OwnerGroupAttributes);
05319
ASSERT(PreGroups->Groups[CHILD_INDEX].Attributes == OptionalGroupAttributes);
05320
ASSERT(PreGroups->Groups[NEANDERTHOL_INDEX].Attributes == OptionalGroupAttributes);
05321
ASSERT(PreGroups->Groups[WORLD_INDEX].Attributes == NormalGroupAttributes);
05322
ASSERT(
NT_SUCCESS(IgnoreStatus) );
05323
05324 NewState->GroupCount = 1;
05325 NewState->Groups[0].Sid =
WorldSid;
05326 NewState->Groups[0].Attributes =
OptionalGroupAttributes;
05327
05328
Status =
NtAdjustGroupsToken(
05329 TokenWithGroups,
05330 FALSE,
05331 NewState,
05332 0,
05333 NULL,
05334 &ReturnLength
05335 );
05336
05337 PostGroups->GroupCount = 88;
05338 IgnoreStatus =
NtQueryInformationToken(
05339 TokenWithGroups,
05340 TokenGroups,
05341 PostGroups,
05342 PostGroupsLength,
05343 &IgnoreReturnLength
05344 );
05345
#ifdef TOKEN_DEBUG
05346
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
05347
#endif //TOKEN_DEBUG
05348
05349
ASSERT(
NT_SUCCESS(IgnoreStatus) );
05350
05351
if (
Status == STATUS_SUCCESS) {
05352
05353
05354
05355
05356
05357
ASSERT( PostGroups->GroupCount == GROUP_COUNT );
05358
if ( (PostGroups->Groups[
FLINTSTONE_INDEX].Attributes ==
OwnerGroupAttributes) &&
05359 (PostGroups->Groups[
CHILD_INDEX].Attributes ==
OptionalGroupAttributes) &&
05360 (PostGroups->Groups[
NEANDERTHOL_INDEX].Attributes ==
OptionalGroupAttributes) &&
05361 (PostGroups->Groups[
WORLD_INDEX].Attributes ==
NormalGroupAttributes)
05362 ) {
05363
05364
DbgPrint(
"Succeeded. \n");
05365
05366 }
else {
05367
05368
DbgPrint(
"********** Failed Value Check ************\n");
05369
DbgPrint(
"Status is: 0x%lx \n", Status);
05370
05371
DbgPrint(
"Before/after Flintstone state: 0x%lx / 0x%lx \n",
05372 PreGroups->Groups[FLINTSTONE_INDEX].Attributes,
05373 PostGroups->Groups[FLINTSTONE_INDEX].Attributes);
05374
05375
DbgPrint(
"Before/after Child state: 0x%lx / 0x%lx \n",
05376 PreGroups->Groups[CHILD_INDEX].Attributes,
05377 PostGroups->Groups[CHILD_INDEX].Attributes);
05378
05379
DbgPrint(
"Before/after Neanderthol state: 0x%lx / 0x%lx \n",
05380 PreGroups->Groups[NEANDERTHOL_INDEX].Attributes,
05381 PostGroups->Groups[NEANDERTHOL_INDEX].Attributes);
05382
05383
DbgPrint(
"Before/after World state: 0x%lx / 0x%lx \n",
05384 PreGroups->Groups[WORLD_INDEX].Attributes,
05385 PostGroups->Groups[WORLD_INDEX].Attributes);
05386
05387
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
05388
05389 CompletionStatus =
FALSE;
05390
05391 }
05392
05393 }
else {
05394
05395
DbgPrint(
"********** Failed ************\n");
05396
DbgPrint(
"Status is: 0x%lx \n", Status);
05397
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
05398 CompletionStatus =
FALSE;
05399
05400 }
05401
05402
ASSERT(Status == STATUS_SUCCESS);
05403
05404
05405
05407
05408
05409
05411
05412
DbgPrint(
"Se: Disable optional group ... ");
05413
05414 PreGroups->GroupCount = 77;
05415 IgnoreStatus =
NtQueryInformationToken(
05416 TokenWithGroups,
05417 TokenGroups,
05418 PreGroups,
05419 PreGroupsLength,
05420 &IgnoreReturnLength
05421 );
05422
#ifdef TOKEN_DEBUG
05423
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
05424
#endif //TOKEN_DEBUG
05425
05426
ASSERT(PreGroups->GroupCount == GROUP_COUNT );
05427
ASSERT(PreGroups->Groups[FLINTSTONE_INDEX].Attributes == OwnerGroupAttributes);
05428
ASSERT(PreGroups->Groups[CHILD_INDEX].Attributes == OptionalGroupAttributes);
05429
ASSERT(PreGroups->Groups[NEANDERTHOL_INDEX].Attributes == OptionalGroupAttributes);
05430
ASSERT(PreGroups->Groups[WORLD_INDEX].Attributes == NormalGroupAttributes);
05431
ASSERT(
NT_SUCCESS(IgnoreStatus) );
05432
05433 NewState->GroupCount = 1;
05434 NewState->Groups[0].Sid =
ChildSid;
05435 NewState->Groups[0].Attributes =
DisabledGroupAttributes;
05436
05437
Status =
NtAdjustGroupsToken(
05438 TokenWithGroups,
05439 FALSE,
05440 NewState,
05441 0,
05442 NULL,
05443 &ReturnLength
05444 );
05445
05446 PostGroups->GroupCount = 88;
05447 IgnoreStatus =
NtQueryInformationToken(
05448 TokenWithGroups,
05449 TokenGroups,
05450 PostGroups,
05451 PostGroupsLength,
05452 &IgnoreReturnLength
05453 );
05454
#ifdef TOKEN_DEBUG
05455
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
05456
#endif //TOKEN_DEBUG
05457
05458
ASSERT(
NT_SUCCESS(IgnoreStatus) );
05459
05460
if (
Status == STATUS_SUCCESS) {
05461
05462
05463
05464
05465
05466
ASSERT( PostGroups->GroupCount == GROUP_COUNT );
05467
if ( (PostGroups->Groups[
FLINTSTONE_INDEX].Attributes ==
OwnerGroupAttributes) &&
05468 (PostGroups->Groups[
CHILD_INDEX].Attributes ==
DisabledGroupAttributes) &&
05469 (PostGroups->Groups[
NEANDERTHOL_INDEX].Attributes ==
OptionalGroupAttributes) &&
05470 (PostGroups->Groups[
WORLD_INDEX].Attributes ==
NormalGroupAttributes)
05471 ) {
05472
05473
DbgPrint(
"Succeeded. \n");
05474
05475 }
else {
05476
05477
DbgPrint(
"********** Failed Value Check ************\n");
05478
DbgPrint(
"Status is: 0x%lx \n", Status);
05479
05480
DbgPrint(
"Before/after Flintstone state: 0x%lx / 0x%lx \n",
05481 PreGroups->Groups[FLINTSTONE_INDEX].Attributes,
05482 PostGroups->Groups[FLINTSTONE_INDEX].Attributes);
05483
05484
DbgPrint(
"Before/after Child state: 0x%lx / 0x%lx \n",
05485 PreGroups->Groups[CHILD_INDEX].Attributes,
05486 PostGroups->Groups[CHILD_INDEX].Attributes);
05487
05488
DbgPrint(
"Before/after Neanderthol state: 0x%lx / 0x%lx \n",
05489 PreGroups->Groups[NEANDERTHOL_INDEX].Attributes,
05490 PostGroups->Groups[NEANDERTHOL_INDEX].Attributes);
05491
05492
DbgPrint(
"Before/after World state: 0x%lx / 0x%lx \n",
05493 PreGroups->Groups[WORLD_INDEX].Attributes,
05494 PostGroups->Groups[WORLD_INDEX].Attributes);
05495
05496
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
05497
05498 CompletionStatus =
FALSE;
05499
05500 }
05501
05502 }
else {
05503
05504
DbgPrint(
"********** Failed ************\n");
05505
DbgPrint(
"Status is: 0x%lx \n", Status);
05506
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
05507 CompletionStatus =
FALSE;
05508
05509 }
05510
05511
ASSERT(Status == STATUS_SUCCESS);
05512
05513
05514
05516
05517
05518
05520
05521
DbgPrint(
"Se: Disable already disabled group ... ");
05522
05523 PreGroups->GroupCount = 77;
05524 IgnoreStatus =
NtQueryInformationToken(
05525 TokenWithGroups,
05526 TokenGroups,
05527 PreGroups,
05528 PreGroupsLength,
05529 &IgnoreReturnLength
05530 );
05531
#ifdef TOKEN_DEBUG
05532
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
05533
#endif //TOKEN_DEBUG
05534
05535
ASSERT(PreGroups->GroupCount == GROUP_COUNT );
05536
ASSERT(PreGroups->Groups[FLINTSTONE_INDEX].Attributes == OwnerGroupAttributes);
05537
ASSERT(PreGroups->Groups[CHILD_INDEX].Attributes == DisabledGroupAttributes);
05538
ASSERT(PreGroups->Groups[NEANDERTHOL_INDEX].Attributes == OptionalGroupAttributes);
05539
ASSERT(PreGroups->Groups[WORLD_INDEX].Attributes == NormalGroupAttributes);
05540
ASSERT(
NT_SUCCESS(IgnoreStatus) );
05541
05542 NewState->GroupCount = 1;
05543 NewState->Groups[0].Sid =
ChildSid;
05544 NewState->Groups[0].Attributes = 0;
05545
05546
Status =
NtAdjustGroupsToken(
05547 TokenWithGroups,
05548 FALSE,
05549 NewState,
05550 0,
05551 NULL,
05552 &ReturnLength
05553 );
05554
05555 PostGroups->GroupCount = 88;
05556 IgnoreStatus =
NtQueryInformationToken(
05557 TokenWithGroups,
05558 TokenGroups,
05559 PostGroups,
05560 PostGroupsLength,
05561 &IgnoreReturnLength
05562 );
05563
#ifdef TOKEN_DEBUG
05564
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
05565
#endif //TOKEN_DEBUG
05566
05567
ASSERT(
NT_SUCCESS(IgnoreStatus) );
05568
05569
if (
Status == STATUS_SUCCESS) {
05570
05571
05572
05573
05574
05575
ASSERT( PostGroups->GroupCount == GROUP_COUNT );
05576
if ( (PostGroups->Groups[
FLINTSTONE_INDEX].Attributes ==
OwnerGroupAttributes) &&
05577 (PostGroups->Groups[
CHILD_INDEX].Attributes ==
DisabledGroupAttributes) &&
05578 (PostGroups->Groups[
NEANDERTHOL_INDEX].Attributes ==
OptionalGroupAttributes) &&
05579 (PostGroups->Groups[
WORLD_INDEX].Attributes ==
NormalGroupAttributes)
05580 ) {
05581
05582
DbgPrint(
"Succeeded. \n");
05583
05584 }
else {
05585
05586
DbgPrint(
"********** Failed Value Check ************\n");
05587
DbgPrint(
"Status is: 0x%lx \n", Status);
05588
05589
DbgPrint(
"Before/after Flintstone state: 0x%lx / 0x%lx \n",
05590 PreGroups->Groups[FLINTSTONE_INDEX].Attributes,
05591 PostGroups->Groups[FLINTSTONE_INDEX].Attributes);
05592
05593
DbgPrint(
"Before/after Child state: 0x%lx / 0x%lx \n",
05594 PreGroups->Groups[CHILD_INDEX].Attributes,
05595 PostGroups->Groups[CHILD_INDEX].Attributes);
05596
05597
DbgPrint(
"Before/after Neanderthol state: 0x%lx / 0x%lx \n",
05598 PreGroups->Groups[NEANDERTHOL_INDEX].Attributes,
05599 PostGroups->Groups[NEANDERTHOL_INDEX].Attributes);
05600
05601
DbgPrint(
"Before/after World state: 0x%lx / 0x%lx \n",
05602 PreGroups->Groups[WORLD_INDEX].Attributes,
05603 PostGroups->Groups[WORLD_INDEX].Attributes);
05604
05605
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
05606
05607 CompletionStatus =
FALSE;
05608
05609 }
05610
05611 }
else {
05612
05613
DbgPrint(
"********** Failed ************\n");
05614
DbgPrint(
"Status is: 0x%lx \n", Status);
05615
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
05616 CompletionStatus =
FALSE;
05617
05618 }
05619
05620
ASSERT(Status == STATUS_SUCCESS);
05621
05622
05623
05625
05626
05627
05629
05630
DbgPrint(
"Se: Enable optional group ... ");
05631
05632 PreGroups->GroupCount = 77;
05633 IgnoreStatus =
NtQueryInformationToken(
05634 TokenWithGroups,
05635 TokenGroups,
05636 PreGroups,
05637 PreGroupsLength,
05638 &IgnoreReturnLength
05639 );
05640
#ifdef TOKEN_DEBUG
05641
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
05642
#endif //TOKEN_DEBUG
05643
05644
ASSERT(PreGroups->GroupCount == GROUP_COUNT );
05645
ASSERT(PreGroups->Groups[FLINTSTONE_INDEX].Attributes == OwnerGroupAttributes);
05646
ASSERT(PreGroups->Groups[CHILD_INDEX].Attributes == DisabledGroupAttributes);
05647
ASSERT(PreGroups->Groups[NEANDERTHOL_INDEX].Attributes == OptionalGroupAttributes);
05648
ASSERT(PreGroups->Groups[WORLD_INDEX].Attributes == NormalGroupAttributes);
05649
ASSERT(
NT_SUCCESS(IgnoreStatus) );
05650
05651 NewState->GroupCount = 1;
05652 NewState->Groups[0].Sid =
ChildSid;
05653 NewState->Groups[0].Attributes = SE_GROUP_ENABLED;
05654
05655
Status =
NtAdjustGroupsToken(
05656 TokenWithGroups,
05657 FALSE,
05658 NewState,
05659 0,
05660 NULL,
05661 &ReturnLength
05662 );
05663
05664 PostGroups->GroupCount = 88;
05665 IgnoreStatus =
NtQueryInformationToken(
05666 TokenWithGroups,
05667 TokenGroups,
05668 PostGroups,
05669 PostGroupsLength,
05670 &IgnoreReturnLength
05671 );
05672
#ifdef TOKEN_DEBUG
05673
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
05674
#endif //TOKEN_DEBUG
05675
05676
ASSERT(
NT_SUCCESS(IgnoreStatus) );
05677
05678
if (
Status == STATUS_SUCCESS) {
05679
05680
05681
05682
05683
05684
ASSERT( PostGroups->GroupCount == GROUP_COUNT );
05685
if ( (PostGroups->Groups[
FLINTSTONE_INDEX].Attributes ==
OwnerGroupAttributes) &&
05686 (PostGroups->Groups[
CHILD_INDEX].Attributes ==
OptionalGroupAttributes) &&
05687 (PostGroups->Groups[
NEANDERTHOL_INDEX].Attributes ==
OptionalGroupAttributes) &&
05688 (PostGroups->Groups[
WORLD_INDEX].Attributes ==
NormalGroupAttributes)
05689 ) {
05690
05691
DbgPrint(
"Succeeded. \n");
05692
05693 }
else {
05694
05695
DbgPrint(
"********** Failed Value Check ************\n");
05696
DbgPrint(
"Status is: 0x%lx \n", Status);
05697
05698
DbgPrint(
"Before/after Flintstone state: 0x%lx / 0x%lx \n",
05699 PreGroups->Groups[FLINTSTONE_INDEX].Attributes,
05700 PostGroups->Groups[FLINTSTONE_INDEX].Attributes);
05701
05702
DbgPrint(
"Before/after Child state: 0x%lx / 0x%lx \n",
05703 PreGroups->Groups[CHILD_INDEX].Attributes,
05704 PostGroups->Groups[CHILD_INDEX].Attributes);
05705
05706
DbgPrint(
"Before/after Neanderthol state: 0x%lx / 0x%lx \n",
05707 PreGroups->Groups[NEANDERTHOL_INDEX].Attributes,
05708 PostGroups->Groups[NEANDERTHOL_INDEX].Attributes);
05709
05710
DbgPrint(
"Before/after World state: 0x%lx / 0x%lx \n",
05711 PreGroups->Groups[WORLD_INDEX].Attributes,
05712 PostGroups->Groups[WORLD_INDEX].Attributes);
05713
05714
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
05715
05716 CompletionStatus =
FALSE;
05717
05718 }
05719
05720 }
else {
05721
05722
DbgPrint(
"********** Failed ************\n");
05723
DbgPrint(
"Status is: 0x%lx \n", Status);
05724
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
05725 CompletionStatus =
FALSE;
05726
05727 }
05728
05729
ASSERT(Status == STATUS_SUCCESS);
05730
05731
05732
05734
05735
05736
05738
05739
DbgPrint(
"Se: Enable already enabled group ... ");
05740
05741 PreGroups->GroupCount = 77;
05742 IgnoreStatus =
NtQueryInformationToken(
05743 TokenWithGroups,
05744 TokenGroups,
05745 PreGroups,
05746 PreGroupsLength,
05747 &IgnoreReturnLength
05748 );
05749
#ifdef TOKEN_DEBUG
05750
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
05751
#endif //TOKEN_DEBUG
05752
05753
ASSERT(PreGroups->GroupCount == GROUP_COUNT );
05754
ASSERT(PreGroups->Groups[FLINTSTONE_INDEX].Attributes == OwnerGroupAttributes);
05755
ASSERT(PreGroups->Groups[CHILD_INDEX].Attributes == OptionalGroupAttributes);
05756
ASSERT(PreGroups->Groups[NEANDERTHOL_INDEX].Attributes == OptionalGroupAttributes);
05757
ASSERT(PreGroups->Groups[WORLD_INDEX].Attributes == NormalGroupAttributes);
05758
ASSERT(
NT_SUCCESS(IgnoreStatus) );
05759
05760 NewState->GroupCount = 1;
05761 NewState->Groups[0].Sid =
ChildSid;
05762 NewState->Groups[0].Attributes = SE_GROUP_ENABLED;
05763
05764
Status =
NtAdjustGroupsToken(
05765 TokenWithGroups,
05766 FALSE,
05767 NewState,
05768 0,
05769 NULL,
05770 &ReturnLength
05771 );
05772
05773 PostGroups->GroupCount = 88;
05774 IgnoreStatus =
NtQueryInformationToken(
05775 TokenWithGroups,
05776 TokenGroups,
05777 PostGroups,
05778 PostGroupsLength,
05779 &IgnoreReturnLength
05780 );
05781
#ifdef TOKEN_DEBUG
05782
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
05783
#endif //TOKEN_DEBUG
05784
05785
ASSERT(
NT_SUCCESS(IgnoreStatus) );
05786
05787
if (
Status == STATUS_SUCCESS) {
05788
05789
05790
05791
05792
05793
ASSERT( PostGroups->GroupCount == GROUP_COUNT );
05794
if ( (PostGroups->Groups[
FLINTSTONE_INDEX].Attributes ==
OwnerGroupAttributes) &&
05795 (PostGroups->Groups[
CHILD_INDEX].Attributes ==
OptionalGroupAttributes) &&
05796 (PostGroups->Groups[
NEANDERTHOL_INDEX].Attributes ==
OptionalGroupAttributes) &&
05797 (PostGroups->Groups[
WORLD_INDEX].Attributes ==
NormalGroupAttributes)
05798 ) {
05799
05800
DbgPrint(
"Succeeded. \n");
05801
05802 }
else {
05803
05804
DbgPrint(
"********** Failed Value Check ************\n");
05805
DbgPrint(
"Status is: 0x%lx \n", Status);
05806
05807
DbgPrint(
"Before/after Flintstone state: 0x%lx / 0x%lx \n",
05808 PreGroups->Groups[FLINTSTONE_INDEX].Attributes,
05809 PostGroups->Groups[FLINTSTONE_INDEX].Attributes);
05810
05811
DbgPrint(
"Before/after Child state: 0x%lx / 0x%lx \n",
05812 PreGroups->Groups[CHILD_INDEX].Attributes,
05813 PostGroups->Groups[CHILD_INDEX].Attributes);
05814
05815
DbgPrint(
"Before/after Neanderthol state: 0x%lx / 0x%lx \n",
05816 PreGroups->Groups[NEANDERTHOL_INDEX].Attributes,
05817 PostGroups->Groups[NEANDERTHOL_INDEX].Attributes);
05818
05819
DbgPrint(
"Before/after World state: 0x%lx / 0x%lx \n",
05820 PreGroups->Groups[WORLD_INDEX].Attributes,
05821 PostGroups->Groups[WORLD_INDEX].Attributes);
05822
05823
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
05824
05825 CompletionStatus =
FALSE;
05826
05827 }
05828
05829 }
else {
05830
05831
DbgPrint(
"********** Failed ************\n");
05832
DbgPrint(
"Status is: 0x%lx \n", Status);
05833
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
05834 CompletionStatus =
FALSE;
05835
05836 }
05837
05838
ASSERT(Status == STATUS_SUCCESS);
05839
05840
05841
05843
05844
05845
05847
05848
DbgPrint(
"Se: Disable optional and unknown group ... ");
05849
05850 PreGroups->GroupCount = 77;
05851 IgnoreStatus =
NtQueryInformationToken(
05852 TokenWithGroups,
05853 TokenGroups,
05854 PreGroups,
05855 PreGroupsLength,
05856 &IgnoreReturnLength
05857 );
05858
#ifdef TOKEN_DEBUG
05859
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
05860
#endif //TOKEN_DEBUG
05861
05862
ASSERT(PreGroups->GroupCount == GROUP_COUNT );
05863
ASSERT(PreGroups->Groups[FLINTSTONE_INDEX].Attributes == OwnerGroupAttributes);
05864
ASSERT(PreGroups->Groups[CHILD_INDEX].Attributes == OptionalGroupAttributes);
05865
ASSERT(PreGroups->Groups[NEANDERTHOL_INDEX].Attributes == OptionalGroupAttributes);
05866
ASSERT(PreGroups->Groups[WORLD_INDEX].Attributes == NormalGroupAttributes);
05867
ASSERT(
NT_SUCCESS(IgnoreStatus) );
05868
05869 NewState->GroupCount = 2;
05870 NewState->Groups[0].Sid =
ChildSid;
05871 NewState->Groups[1].Sid =
RubbleSid;
05872 NewState->Groups[0].Attributes =
DisabledGroupAttributes;
05873 NewState->Groups[1].Attributes =
DisabledGroupAttributes;
05874
05875
Status =
NtAdjustGroupsToken(
05876 TokenWithGroups,
05877 FALSE,
05878 NewState,
05879 0,
05880 NULL,
05881 &ReturnLength
05882 );
05883
05884 PostGroups->GroupCount = 88;
05885 IgnoreStatus =
NtQueryInformationToken(
05886 TokenWithGroups,
05887 TokenGroups,
05888 PostGroups,
05889 PostGroupsLength,
05890 &IgnoreReturnLength
05891 );
05892
#ifdef TOKEN_DEBUG
05893
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
05894
#endif //TOKEN_DEBUG
05895
05896
ASSERT(
NT_SUCCESS(IgnoreStatus) );
05897
05898
if (
Status == STATUS_NOT_ALL_ASSIGNED) {
05899
05900
05901
05902
05903
05904
ASSERT( PostGroups->GroupCount == GROUP_COUNT );
05905
if ( (PostGroups->Groups[
FLINTSTONE_INDEX].Attributes ==
OwnerGroupAttributes) &&
05906 (PostGroups->Groups[
CHILD_INDEX].Attributes ==
DisabledGroupAttributes) &&
05907 (PostGroups->Groups[
NEANDERTHOL_INDEX].Attributes ==
OptionalGroupAttributes) &&
05908 (PostGroups->Groups[
WORLD_INDEX].Attributes ==
NormalGroupAttributes)
05909 ) {
05910
05911
DbgPrint(
"Succeeded. \n");
05912
05913 }
else {
05914
05915
DbgPrint(
"********** Failed Value Check ************\n");
05916
DbgPrint(
"Status is: 0x%lx \n", Status);
05917
05918
DbgPrint(
"Before/after Flintstone state: 0x%lx / 0x%lx \n",
05919 PreGroups->Groups[FLINTSTONE_INDEX].Attributes,
05920 PostGroups->Groups[FLINTSTONE_INDEX].Attributes);
05921
05922
DbgPrint(
"Before/after Child state: 0x%lx / 0x%lx \n",
05923 PreGroups->Groups[CHILD_INDEX].Attributes,
05924 PostGroups->Groups[CHILD_INDEX].Attributes);
05925
05926
DbgPrint(
"Before/after Neanderthol state: 0x%lx / 0x%lx \n",
05927 PreGroups->Groups[NEANDERTHOL_INDEX].Attributes,
05928 PostGroups->Groups[NEANDERTHOL_INDEX].Attributes);
05929
05930
DbgPrint(
"Before/after World state: 0x%lx / 0x%lx \n",
05931 PreGroups->Groups[WORLD_INDEX].Attributes,
05932 PostGroups->Groups[WORLD_INDEX].Attributes);
05933
05934
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
05935
05936 CompletionStatus =
FALSE;
05937
05938 }
05939
05940 }
else {
05941
05942
DbgPrint(
"********** Failed ************\n");
05943
DbgPrint(
"Status is: 0x%lx \n", Status);
05944
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
05945 CompletionStatus =
FALSE;
05946
05947 }
05948
05949
ASSERT(Status == STATUS_NOT_ALL_ASSIGNED);
05950
05951
05952
05953
05955
05956
05957
05959
05960
DbgPrint(
"Se: Enable optional and unknown group ... ");
05961
05962 PreGroups->GroupCount = 77;
05963 IgnoreStatus =
NtQueryInformationToken(
05964 TokenWithGroups,
05965 TokenGroups,
05966 PreGroups,
05967 PreGroupsLength,
05968 &IgnoreReturnLength
05969 );
05970
#ifdef TOKEN_DEBUG
05971
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
05972
#endif //TOKEN_DEBUG
05973
05974
ASSERT(PreGroups->GroupCount == GROUP_COUNT );
05975
ASSERT(PreGroups->Groups[FLINTSTONE_INDEX].Attributes == OwnerGroupAttributes);
05976
ASSERT(PreGroups->Groups[CHILD_INDEX].Attributes == DisabledGroupAttributes);
05977
ASSERT(PreGroups->Groups[NEANDERTHOL_INDEX].Attributes == OptionalGroupAttributes);
05978
ASSERT(PreGroups->Groups[WORLD_INDEX].Attributes == NormalGroupAttributes);
05979
ASSERT(
NT_SUCCESS(IgnoreStatus) );
05980
05981 NewState->GroupCount = 2;
05982 NewState->Groups[0].Sid =
ChildSid;
05983 NewState->Groups[1].Sid =
RubbleSid;
05984 NewState->Groups[0].Attributes =
OptionalGroupAttributes;
05985 NewState->Groups[1].Attributes =
OptionalGroupAttributes;
05986
05987
Status =
NtAdjustGroupsToken(
05988 TokenWithGroups,
05989 FALSE,
05990 NewState,
05991 0,
05992 NULL,
05993 &ReturnLength
05994 );
05995
05996 PostGroups->GroupCount = 88;
05997 IgnoreStatus =
NtQueryInformationToken(
05998 TokenWithGroups,
05999 TokenGroups,
06000 PostGroups,
06001 PostGroupsLength,
06002 &IgnoreReturnLength
06003 );
06004
#ifdef TOKEN_DEBUG
06005
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
06006
#endif //TOKEN_DEBUG
06007
06008
ASSERT(
NT_SUCCESS(IgnoreStatus) );
06009
06010
if (
Status == STATUS_NOT_ALL_ASSIGNED) {
06011
06012
06013
06014
06015
06016
ASSERT( PostGroups->GroupCount == GROUP_COUNT );
06017
if ( (PostGroups->Groups[
FLINTSTONE_INDEX].Attributes ==
OwnerGroupAttributes) &&
06018 (PostGroups->Groups[
CHILD_INDEX].Attributes ==
OptionalGroupAttributes) &&
06019 (PostGroups->Groups[
NEANDERTHOL_INDEX].Attributes ==
OptionalGroupAttributes) &&
06020 (PostGroups->Groups[
WORLD_INDEX].Attributes ==
NormalGroupAttributes)
06021 ) {
06022
06023
DbgPrint(
"Succeeded. \n");
06024
06025 }
else {
06026
06027
DbgPrint(
"********** Failed Value Check ************\n");
06028
DbgPrint(
"Status is: 0x%lx \n", Status);
06029
06030
DbgPrint(
"Before/after Flintstone state: 0x%lx / 0x%lx \n",
06031 PreGroups->Groups[FLINTSTONE_INDEX].Attributes,
06032 PostGroups->Groups[FLINTSTONE_INDEX].Attributes);
06033
06034
DbgPrint(
"Before/after Child state: 0x%lx / 0x%lx \n",
06035 PreGroups->Groups[CHILD_INDEX].Attributes,
06036 PostGroups->Groups[CHILD_INDEX].Attributes);
06037
06038
DbgPrint(
"Before/after Neanderthol state: 0x%lx / 0x%lx \n",
06039 PreGroups->Groups[NEANDERTHOL_INDEX].Attributes,
06040 PostGroups->Groups[NEANDERTHOL_INDEX].Attributes);
06041
06042
DbgPrint(
"Before/after World state: 0x%lx / 0x%lx \n",
06043 PreGroups->Groups[WORLD_INDEX].Attributes,
06044 PostGroups->Groups[WORLD_INDEX].Attributes);
06045
06046
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
06047
06048 CompletionStatus =
FALSE;
06049
06050 }
06051
06052 }
else {
06053
06054
DbgPrint(
"********** Failed ************\n");
06055
DbgPrint(
"Status is: 0x%lx \n", Status);
06056
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
06057 CompletionStatus =
FALSE;
06058
06059 }
06060
06061
ASSERT(Status == STATUS_NOT_ALL_ASSIGNED);
06062
06063
06064
06065
06067
06068
06069
06071
06072
DbgPrint(
"Se: Disable optional and mandatory group ... ");
06073
06074 PreGroups->GroupCount = 77;
06075 IgnoreStatus =
NtQueryInformationToken(
06076 TokenWithGroups,
06077 TokenGroups,
06078 PreGroups,
06079 PreGroupsLength,
06080 &IgnoreReturnLength
06081 );
06082
#ifdef TOKEN_DEBUG
06083
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
06084
#endif //TOKEN_DEBUG
06085
06086
ASSERT(PreGroups->GroupCount == GROUP_COUNT );
06087
ASSERT(PreGroups->Groups[FLINTSTONE_INDEX].Attributes == OwnerGroupAttributes);
06088
ASSERT(PreGroups->Groups[CHILD_INDEX].Attributes == OptionalGroupAttributes);
06089
ASSERT(PreGroups->Groups[NEANDERTHOL_INDEX].Attributes == OptionalGroupAttributes);
06090
ASSERT(PreGroups->Groups[WORLD_INDEX].Attributes == NormalGroupAttributes);
06091
ASSERT(
NT_SUCCESS(IgnoreStatus) );
06092
06093 NewState->GroupCount = 2;
06094 NewState->Groups[0].Sid =
ChildSid;
06095 NewState->Groups[1].Sid =
WorldSid;
06096 NewState->Groups[0].Attributes =
DisabledGroupAttributes;
06097 NewState->Groups[1].Attributes =
DisabledGroupAttributes;
06098
06099
Status =
NtAdjustGroupsToken(
06100 TokenWithGroups,
06101 FALSE,
06102 NewState,
06103 0,
06104 NULL,
06105 &ReturnLength
06106 );
06107
06108 PostGroups->GroupCount = 88;
06109 IgnoreStatus =
NtQueryInformationToken(
06110 TokenWithGroups,
06111 TokenGroups,
06112 PostGroups,
06113 PostGroupsLength,
06114 &IgnoreReturnLength
06115 );
06116
#ifdef TOKEN_DEBUG
06117
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
06118
#endif //TOKEN_DEBUG
06119
06120
ASSERT(
NT_SUCCESS(IgnoreStatus) );
06121
06122
if (
Status == STATUS_CANT_DISABLE_MANDATORY) {
06123
06124
06125
06126
06127
06128
ASSERT( PostGroups->GroupCount == GROUP_COUNT );
06129
if ( (PostGroups->Groups[
FLINTSTONE_INDEX].Attributes ==
OwnerGroupAttributes) &&
06130 (PostGroups->Groups[
CHILD_INDEX].Attributes ==
OptionalGroupAttributes) &&
06131 (PostGroups->Groups[
NEANDERTHOL_INDEX].Attributes ==
OptionalGroupAttributes) &&
06132 (PostGroups->Groups[
WORLD_INDEX].Attributes ==
NormalGroupAttributes)
06133 ) {
06134
06135
DbgPrint(
"Succeeded. \n");
06136
06137 }
else {
06138
06139
DbgPrint(
"********** Failed Value Check ************\n");
06140
DbgPrint(
"Status is: 0x%lx \n", Status);
06141
06142
DbgPrint(
"Before/after Flintstone state: 0x%lx / 0x%lx \n",
06143 PreGroups->Groups[FLINTSTONE_INDEX].Attributes,
06144 PostGroups->Groups[FLINTSTONE_INDEX].Attributes);
06145
06146
DbgPrint(
"Before/after Child state: 0x%lx / 0x%lx \n",
06147 PreGroups->Groups[CHILD_INDEX].Attributes,
06148 PostGroups->Groups[CHILD_INDEX].Attributes);
06149
06150
DbgPrint(
"Before/after Neanderthol state: 0x%lx / 0x%lx \n",
06151 PreGroups->Groups[NEANDERTHOL_INDEX].Attributes,
06152 PostGroups->Groups[NEANDERTHOL_INDEX].Attributes);
06153
06154
DbgPrint(
"Before/after World state: 0x%lx / 0x%lx \n",
06155 PreGroups->Groups[WORLD_INDEX].Attributes,
06156 PostGroups->Groups[WORLD_INDEX].Attributes);
06157
06158
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
06159
06160 CompletionStatus =
FALSE;
06161
06162 }
06163
06164 }
else {
06165
06166
DbgPrint(
"********** Failed ************\n");
06167
DbgPrint(
"Status is: 0x%lx \n", Status);
06168
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
06169 CompletionStatus =
FALSE;
06170
06171 }
06172
06173
ASSERT(Status == STATUS_CANT_DISABLE_MANDATORY);
06174
06175
06176
06178
06179
06180
06182
06183
DbgPrint(
"Se: Enable optional and mandatory group ... ");
06184
06185 NewState->GroupCount = 1;
06186 NewState->Groups[0].Sid =
ChildSid;
06187 NewState->Groups[0].Attributes =
DisabledGroupAttributes;
06188
06189
Status =
NtAdjustGroupsToken(
06190 TokenWithGroups,
06191 FALSE,
06192 NewState,
06193 0,
06194 NULL,
06195 &ReturnLength
06196 );
06197
ASSERT(Status == STATUS_SUCCESS);
06198
06199 PreGroups->GroupCount = 77;
06200 IgnoreStatus =
NtQueryInformationToken(
06201 TokenWithGroups,
06202 TokenGroups,
06203 PreGroups,
06204 PreGroupsLength,
06205 &IgnoreReturnLength
06206 );
06207
#ifdef TOKEN_DEBUG
06208
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
06209
#endif //TOKEN_DEBUG
06210
06211
ASSERT(PreGroups->GroupCount == GROUP_COUNT );
06212
ASSERT(PreGroups->Groups[FLINTSTONE_INDEX].Attributes == OwnerGroupAttributes);
06213
ASSERT(PreGroups->Groups[CHILD_INDEX].Attributes == DisabledGroupAttributes);
06214
ASSERT(PreGroups->Groups[NEANDERTHOL_INDEX].Attributes == OptionalGroupAttributes);
06215
ASSERT(PreGroups->Groups[WORLD_INDEX].Attributes == NormalGroupAttributes);
06216
ASSERT(
NT_SUCCESS(IgnoreStatus) );
06217
06218 NewState->GroupCount = 2;
06219 NewState->Groups[0].Sid =
ChildSid;
06220 NewState->Groups[1].Sid =
WorldSid;
06221 NewState->Groups[0].Attributes =
OptionalGroupAttributes;
06222 NewState->Groups[1].Attributes =
OptionalGroupAttributes;
06223
06224
Status =
NtAdjustGroupsToken(
06225 TokenWithGroups,
06226 FALSE,
06227 NewState,
06228 0,
06229 NULL,
06230 &ReturnLength
06231 );
06232
06233 PostGroups->GroupCount = 88;
06234 IgnoreStatus =
NtQueryInformationToken(
06235 TokenWithGroups,
06236 TokenGroups,
06237 PostGroups,
06238 PostGroupsLength,
06239 &IgnoreReturnLength
06240 );
06241
#ifdef TOKEN_DEBUG
06242
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
06243
#endif //TOKEN_DEBUG
06244
06245
ASSERT(
NT_SUCCESS(IgnoreStatus) );
06246
06247
if (
Status == STATUS_SUCCESS) {
06248
06249
06250
06251
06252
06253
ASSERT( PostGroups->GroupCount == GROUP_COUNT );
06254
if ( (PostGroups->Groups[
FLINTSTONE_INDEX].Attributes ==
OwnerGroupAttributes) &&
06255 (PostGroups->Groups[
CHILD_INDEX].Attributes ==
OptionalGroupAttributes) &&
06256 (PostGroups->Groups[
NEANDERTHOL_INDEX].Attributes ==
OptionalGroupAttributes) &&
06257 (PostGroups->Groups[
WORLD_INDEX].Attributes ==
NormalGroupAttributes)
06258 ) {
06259
06260
DbgPrint(
"Succeeded. \n");
06261
06262 }
else {
06263
06264
DbgPrint(
"********** Failed Value Check ************\n");
06265
DbgPrint(
"Status is: 0x%lx \n", Status);
06266
06267
DbgPrint(
"Before/after Flintstone state: 0x%lx / 0x%lx \n",
06268 PreGroups->Groups[FLINTSTONE_INDEX].Attributes,
06269 PostGroups->Groups[FLINTSTONE_INDEX].Attributes);
06270
06271
DbgPrint(
"Before/after Child state: 0x%lx / 0x%lx \n",
06272 PreGroups->Groups[CHILD_INDEX].Attributes,
06273 PostGroups->Groups[CHILD_INDEX].Attributes);
06274
06275
DbgPrint(
"Before/after Neanderthol state: 0x%lx / 0x%lx \n",
06276 PreGroups->Groups[NEANDERTHOL_INDEX].Attributes,
06277 PostGroups->Groups[NEANDERTHOL_INDEX].Attributes);
06278
06279
DbgPrint(
"Before/after World state: 0x%lx / 0x%lx \n",
06280 PreGroups->Groups[WORLD_INDEX].Attributes,
06281 PostGroups->Groups[WORLD_INDEX].Attributes);
06282
06283
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
06284
06285 CompletionStatus =
FALSE;
06286
06287 }
06288
06289 }
else {
06290
06291
DbgPrint(
"********** Failed ************\n");
06292
DbgPrint(
"Status is: 0x%lx \n", Status);
06293
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
06294 CompletionStatus =
FALSE;
06295
06296 }
06297
06298
ASSERT(Status == STATUS_SUCCESS);
06299
06300
06301
06303
06304
06305
06306
06308
06309
06310
DbgPrint(
"Se: Too small buffer for previous state ... ");
06311
06312
06313 PreGroups->GroupCount = 77;
06314 IgnoreStatus =
NtQueryInformationToken(
06315 TokenWithGroups,
06316 TokenGroups,
06317 PreGroups,
06318 PreGroupsLength,
06319 &IgnoreReturnLength
06320 );
06321
#ifdef TOKEN_DEBUG
06322
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
06323
#endif //TOKEN_DEBUG
06324
06325
ASSERT(PreGroups->GroupCount == GROUP_COUNT );
06326
ASSERT(PreGroups->Groups[FLINTSTONE_INDEX].Attributes == OwnerGroupAttributes);
06327
ASSERT(PreGroups->Groups[CHILD_INDEX].Attributes == OptionalGroupAttributes);
06328
ASSERT(PreGroups->Groups[NEANDERTHOL_INDEX].Attributes == OptionalGroupAttributes);
06329
ASSERT(PreGroups->Groups[WORLD_INDEX].Attributes == NormalGroupAttributes);
06330
ASSERT(
NT_SUCCESS(IgnoreStatus) );
06331
06332 NewState->GroupCount = 1;
06333 NewState->Groups[0].Sid =
ChildSid;
06334 NewState->Groups[0].Attributes =
DisabledGroupAttributes;
06335
06336
Status =
NtAdjustGroupsToken(
06337 TokenWithGroups,
06338 FALSE,
06339 NewState,
06340 0,
06341 PreviousState,
06342 &ReturnLength
06343 );
06344
#ifdef TOKEN_DEBUG
06345
DbgPrint(
"\n (debug) return length: 0x%lx \n", ReturnLength);
06346
#endif //TOKEN_DEBUG
06347
06348 PostGroups->GroupCount = 88;
06349 IgnoreStatus =
NtQueryInformationToken(
06350 TokenWithGroups,
06351 TokenGroups,
06352 PostGroups,
06353 PostGroupsLength,
06354 &IgnoreReturnLength
06355 );
06356
#ifdef TOKEN_DEBUG
06357
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
06358
#endif //TOKEN_DEBUG
06359
06360
ASSERT(
NT_SUCCESS(IgnoreStatus) );
06361
06362
if (
Status == STATUS_BUFFER_TOO_SMALL) {
06363
06364
06365
06366
06367
06368
ASSERT( PostGroups->GroupCount == GROUP_COUNT );
06369
if ( (PostGroups->Groups[
FLINTSTONE_INDEX].Attributes ==
OwnerGroupAttributes) &&
06370 (PostGroups->Groups[
CHILD_INDEX].Attributes ==
OptionalGroupAttributes) &&
06371 (PostGroups->Groups[
NEANDERTHOL_INDEX].Attributes ==
OptionalGroupAttributes) &&
06372 (PostGroups->Groups[
WORLD_INDEX].Attributes ==
NormalGroupAttributes)
06373 ) {
06374
06375
DbgPrint(
"Succeeded. \n");
06376
06377 }
else {
06378
06379
DbgPrint(
"********** Failed Value Check ************\n");
06380
DbgPrint(
"Status is: 0x%lx \n", Status);
06381
06382
DbgPrint(
"Before/after Flintstone state: 0x%lx / 0x%lx \n",
06383 PreGroups->Groups[FLINTSTONE_INDEX].Attributes,
06384 PostGroups->Groups[FLINTSTONE_INDEX].Attributes);
06385
06386
DbgPrint(
"Before/after Child state: 0x%lx / 0x%lx \n",
06387 PreGroups->Groups[CHILD_INDEX].Attributes,
06388 PostGroups->Groups[CHILD_INDEX].Attributes);
06389
06390
DbgPrint(
"Before/after Neanderthol state: 0x%lx / 0x%lx \n",
06391 PreGroups->Groups[NEANDERTHOL_INDEX].Attributes,
06392 PostGroups->Groups[NEANDERTHOL_INDEX].Attributes);
06393
06394
DbgPrint(
"Before/after World state: 0x%lx / 0x%lx \n",
06395 PreGroups->Groups[WORLD_INDEX].Attributes,
06396 PostGroups->Groups[WORLD_INDEX].Attributes);
06397
06398
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
06399
06400 CompletionStatus =
FALSE;
06401
06402 }
06403
06404 }
else {
06405
06406
DbgPrint(
"********** Failed ************\n");
06407
DbgPrint(
"Status is: 0x%lx \n", Status);
06408
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
06409 CompletionStatus =
FALSE;
06410
06411 }
06412
06413
ASSERT(Status == STATUS_BUFFER_TOO_SMALL);
06414
06415
06416
06417
06419
06420
06421
06423
06424
DbgPrint(
"Se: Disable optional, requesting previous state ... ");
06425
06426 PreGroups->GroupCount = 77;
06427 IgnoreStatus =
NtQueryInformationToken(
06428 TokenWithGroups,
06429 TokenGroups,
06430 PreGroups,
06431 PreGroupsLength,
06432 &IgnoreReturnLength
06433 );
06434
#ifdef TOKEN_DEBUG
06435
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
06436
#endif //TOKEN_DEBUG
06437
06438
ASSERT(PreGroups->GroupCount == GROUP_COUNT );
06439
ASSERT(PreGroups->Groups[FLINTSTONE_INDEX].Attributes == OwnerGroupAttributes);
06440
ASSERT(PreGroups->Groups[CHILD_INDEX].Attributes == OptionalGroupAttributes);
06441
ASSERT(PreGroups->Groups[NEANDERTHOL_INDEX].Attributes == OptionalGroupAttributes);
06442
ASSERT(PreGroups->Groups[WORLD_INDEX].Attributes == NormalGroupAttributes);
06443
ASSERT(
NT_SUCCESS(IgnoreStatus) );
06444
06445 NewState->GroupCount = 2;
06446 NewState->Groups[0].Sid =
NeandertholSid;
06447 NewState->Groups[1].Sid =
ChildSid;
06448 NewState->Groups[0].Attributes =
DisabledGroupAttributes;
06449 NewState->Groups[1].Attributes =
DisabledGroupAttributes;
06450 PreviousState->GroupCount = 99;
06451
06452
Status =
NtAdjustGroupsToken(
06453 TokenWithGroups,
06454 FALSE,
06455 NewState,
06456 PreviousStateBufferLength,
06457 PreviousState,
06458 &ReturnLength
06459 );
06460
#ifdef TOKEN_DEBUG
06461
DbgPrint(
"\n (debug) return length: 0x%lx \n", ReturnLength);
06462
#endif //TOKEN_DEBUG
06463
06464 PostGroups->GroupCount = 88;
06465 IgnoreStatus =
NtQueryInformationToken(
06466 TokenWithGroups,
06467 TokenGroups,
06468 PostGroups,
06469 PostGroupsLength,
06470 &IgnoreReturnLength
06471 );
06472
#ifdef TOKEN_DEBUG
06473
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
06474
#endif //TOKEN_DEBUG
06475
06476
ASSERT(
NT_SUCCESS(IgnoreStatus) );
06477
06478
if (
Status == STATUS_SUCCESS) {
06479
06480
06481
06482
06483
06484
ASSERT( PostGroups->GroupCount == GROUP_COUNT );
06485
ASSERT( PreviousState->GroupCount == 2 );
06486
if ( (PostGroups->Groups[
FLINTSTONE_INDEX].Attributes ==
OwnerGroupAttributes) &&
06487 (PostGroups->Groups[
CHILD_INDEX].Attributes ==
DisabledGroupAttributes) &&
06488 (PostGroups->Groups[
NEANDERTHOL_INDEX].Attributes ==
DisabledGroupAttributes) &&
06489 (PostGroups->Groups[
WORLD_INDEX].Attributes ==
NormalGroupAttributes) &&
06490 (PreviousState->Groups[0].Attributes ==
OptionalGroupAttributes) &&
06491 (PreviousState->Groups[1].Attributes ==
OptionalGroupAttributes)
06492 ) {
06493
06494
DbgPrint(
"Succeeded. \n");
06495
06496 }
else {
06497
06498
DbgPrint(
"********** Failed Value Check ************\n");
06499
DbgPrint(
"Status is: 0x%lx \n", Status);
06500
06501
DbgPrint(
"Before/after Flintstone state: 0x%lx / 0x%lx \n",
06502 PreGroups->Groups[FLINTSTONE_INDEX].Attributes,
06503 PostGroups->Groups[FLINTSTONE_INDEX].Attributes);
06504
06505
DbgPrint(
"Before/after Child state: 0x%lx / 0x%lx \n",
06506 PreGroups->Groups[CHILD_INDEX].Attributes,
06507 PostGroups->Groups[CHILD_INDEX].Attributes);
06508
06509
DbgPrint(
"Before/after Neanderthol state: 0x%lx / 0x%lx \n",
06510 PreGroups->Groups[NEANDERTHOL_INDEX].Attributes,
06511 PostGroups->Groups[NEANDERTHOL_INDEX].Attributes);
06512
06513
DbgPrint(
"Before/after World state: 0x%lx / 0x%lx \n",
06514 PreGroups->Groups[WORLD_INDEX].Attributes,
06515 PostGroups->Groups[WORLD_INDEX].Attributes);
06516
06517
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
06518
06519
DbgPrint(
"Previous count is: 0x%lx \n", PreviousState->GroupCount);
06520
DbgPrint(
"Previous state of group 0 is: 0x%lx \n",
06521 PreviousState->Groups[0].Attributes);
06522
DbgPrint(
"Previous state of group 1 is: 0x%lx \n",
06523 PreviousState->Groups[1].Attributes);
06524
06525
06526 CompletionStatus =
FALSE;
06527
06528 }
06529
06530 }
else {
06531
06532
DbgPrint(
"********** Failed ************\n");
06533
DbgPrint(
"Status is: 0x%lx \n", Status);
06534
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
06535 CompletionStatus =
FALSE;
06536
06537 }
06538
06539
ASSERT(Status == STATUS_SUCCESS);
06540
06541
06542
06544
06545
06546
06548
06549
DbgPrint(
"Se: Return to previous state ... ");
06550
06551 PreGroups->GroupCount = 77;
06552 IgnoreStatus =
NtQueryInformationToken(
06553 TokenWithGroups,
06554 TokenGroups,
06555 PreGroups,
06556 PreGroupsLength,
06557 &IgnoreReturnLength
06558 );
06559
#ifdef TOKEN_DEBUG
06560
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
06561
#endif //TOKEN_DEBUG
06562
06563
ASSERT(PreGroups->GroupCount == GROUP_COUNT );
06564
ASSERT(PreGroups->Groups[FLINTSTONE_INDEX].Attributes == OwnerGroupAttributes);
06565
ASSERT(PreGroups->Groups[CHILD_INDEX].Attributes == DisabledGroupAttributes);
06566
ASSERT(PreGroups->Groups[NEANDERTHOL_INDEX].Attributes == DisabledGroupAttributes);
06567
ASSERT(PreGroups->Groups[WORLD_INDEX].Attributes == NormalGroupAttributes);
06568
ASSERT(
NT_SUCCESS(IgnoreStatus) );
06569
06570
Status =
NtAdjustGroupsToken(
06571 TokenWithGroups,
06572 FALSE,
06573 PreviousState,
06574 PreviousStateBufferLength,
06575 PreviousState,
06576 &ReturnLength
06577 );
06578
#ifdef TOKEN_DEBUG
06579
DbgPrint(
"\n (debug) return length: 0x%lx \n", ReturnLength);
06580
#endif //TOKEN_DEBUG
06581
06582 PostGroups->GroupCount = 88;
06583 IgnoreStatus =
NtQueryInformationToken(
06584 TokenWithGroups,
06585 TokenGroups,
06586 PostGroups,
06587 PostGroupsLength,
06588 &IgnoreReturnLength
06589 );
06590
#ifdef TOKEN_DEBUG
06591
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
06592
#endif //TOKEN_DEBUG
06593
06594
ASSERT(
NT_SUCCESS(IgnoreStatus) );
06595
06596
if (
Status == STATUS_SUCCESS) {
06597
06598
06599
06600
06601
06602
ASSERT( PostGroups->GroupCount == GROUP_COUNT );
06603
if ( (PostGroups->Groups[
FLINTSTONE_INDEX].Attributes ==
OwnerGroupAttributes) &&
06604 (PostGroups->Groups[
CHILD_INDEX].Attributes ==
OptionalGroupAttributes) &&
06605 (PostGroups->Groups[
NEANDERTHOL_INDEX].Attributes ==
OptionalGroupAttributes) &&
06606 (PostGroups->Groups[
WORLD_INDEX].Attributes ==
NormalGroupAttributes) &&
06607 (PreviousState->Groups[0].Attributes ==
DisabledGroupAttributes) &&
06608 (PreviousState->Groups[1].Attributes ==
DisabledGroupAttributes)
06609 ) {
06610
06611
DbgPrint(
"Succeeded. \n");
06612
06613 }
else {
06614
06615
DbgPrint(
"********** Failed Value Check ************\n");
06616
DbgPrint(
"Status is: 0x%lx \n", Status);
06617
06618
DbgPrint(
"Before/after Flintstone state: 0x%lx / 0x%lx \n",
06619 PreGroups->Groups[FLINTSTONE_INDEX].Attributes,
06620 PostGroups->Groups[FLINTSTONE_INDEX].Attributes);
06621
06622
DbgPrint(
"Before/after Child state: 0x%lx / 0x%lx \n",
06623 PreGroups->Groups[CHILD_INDEX].Attributes,
06624 PostGroups->Groups[CHILD_INDEX].Attributes);
06625
06626
DbgPrint(
"Before/after Neanderthol state: 0x%lx / 0x%lx \n",
06627 PreGroups->Groups[NEANDERTHOL_INDEX].Attributes,
06628 PostGroups->Groups[NEANDERTHOL_INDEX].Attributes);
06629
06630
DbgPrint(
"Before/after World state: 0x%lx / 0x%lx \n",
06631 PreGroups->Groups[WORLD_INDEX].Attributes,
06632 PostGroups->Groups[WORLD_INDEX].Attributes);
06633
06634
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
06635
06636 CompletionStatus =
FALSE;
06637
06638 }
06639
06640 }
else {
06641
06642
DbgPrint(
"********** Failed ************\n");
06643
DbgPrint(
"Status is: 0x%lx \n", Status);
06644
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
06645 CompletionStatus =
FALSE;
06646
06647 }
06648
06649
ASSERT(Status == STATUS_SUCCESS);
06650
06651
06652
06654
06655
06656
06658
06659
DbgPrint(
"Se: Return to previous state again ... ");
06660
06661 PreGroups->GroupCount = 77;
06662 IgnoreStatus =
NtQueryInformationToken(
06663 TokenWithGroups,
06664 TokenGroups,
06665 PreGroups,
06666 PreGroupsLength,
06667 &IgnoreReturnLength
06668 );
06669
#ifdef TOKEN_DEBUG
06670
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
06671
#endif //TOKEN_DEBUG
06672
06673
ASSERT(PreGroups->GroupCount == GROUP_COUNT );
06674
ASSERT(PreGroups->Groups[FLINTSTONE_INDEX].Attributes == OwnerGroupAttributes);
06675
ASSERT(PreGroups->Groups[CHILD_INDEX].Attributes == OptionalGroupAttributes);
06676
ASSERT(PreGroups->Groups[NEANDERTHOL_INDEX].Attributes == OptionalGroupAttributes);
06677
ASSERT(PreGroups->Groups[WORLD_INDEX].Attributes == NormalGroupAttributes);
06678
ASSERT(
NT_SUCCESS(IgnoreStatus) );
06679
06680
Status =
NtAdjustGroupsToken(
06681 TokenWithGroups,
06682 FALSE,
06683 PreviousState,
06684 PreviousStateBufferLength,
06685 PreviousState,
06686 &ReturnLength
06687 );
06688
#ifdef TOKEN_DEBUG
06689
DbgPrint(
"\n (debug) return length: 0x%lx \n", ReturnLength);
06690
#endif //TOKEN_DEBUG
06691
06692 PostGroups->GroupCount = 88;
06693 IgnoreStatus =
NtQueryInformationToken(
06694 TokenWithGroups,
06695 TokenGroups,
06696 PostGroups,
06697 PostGroupsLength,
06698 &IgnoreReturnLength
06699 );
06700
#ifdef TOKEN_DEBUG
06701
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
06702
#endif //TOKEN_DEBUG
06703
06704
ASSERT(
NT_SUCCESS(IgnoreStatus) );
06705
06706
if (
Status == STATUS_SUCCESS) {
06707
06708
06709
06710
06711
06712
ASSERT( PostGroups->GroupCount == GROUP_COUNT );
06713
if ( (PostGroups->Groups[
FLINTSTONE_INDEX].Attributes ==
OwnerGroupAttributes) &&
06714 (PostGroups->Groups[
CHILD_INDEX].Attributes ==
DisabledGroupAttributes) &&
06715 (PostGroups->Groups[
NEANDERTHOL_INDEX].Attributes ==
DisabledGroupAttributes) &&
06716 (PostGroups->Groups[
WORLD_INDEX].Attributes ==
NormalGroupAttributes) &&
06717 (PreviousState->Groups[0].Attributes ==
OptionalGroupAttributes) &&
06718 (PreviousState->Groups[1].Attributes ==
OptionalGroupAttributes)
06719 ) {
06720
06721
DbgPrint(
"Succeeded. \n");
06722
06723 }
else {
06724
06725
DbgPrint(
"********** Failed Value Check ************\n");
06726
DbgPrint(
"Status is: 0x%lx \n", Status);
06727
06728
DbgPrint(
"Before/after Flintstone state: 0x%lx / 0x%lx \n",
06729 PreGroups->Groups[FLINTSTONE_INDEX].Attributes,
06730 PostGroups->Groups[FLINTSTONE_INDEX].Attributes);
06731
06732
DbgPrint(
"Before/after Child state: 0x%lx / 0x%lx \n",
06733 PreGroups->Groups[CHILD_INDEX].Attributes,
06734 PostGroups->Groups[CHILD_INDEX].Attributes);
06735
06736
DbgPrint(
"Before/after Neanderthol state: 0x%lx / 0x%lx \n",
06737 PreGroups->Groups[NEANDERTHOL_INDEX].Attributes,
06738 PostGroups->Groups[NEANDERTHOL_INDEX].Attributes);
06739
06740
DbgPrint(
"Before/after World state: 0x%lx / 0x%lx \n",
06741 PreGroups->Groups[WORLD_INDEX].Attributes,
06742 PostGroups->Groups[WORLD_INDEX].Attributes);
06743
06744
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
06745
06746 CompletionStatus =
FALSE;
06747
06748 }
06749
06750 }
else {
06751
06752
DbgPrint(
"********** Failed ************\n");
06753
DbgPrint(
"Status is: 0x%lx \n", Status);
06754
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
06755 CompletionStatus =
FALSE;
06756
06757 }
06758
06759
ASSERT(Status == STATUS_SUCCESS);
06760
06761
06762
06763
06765
06766
06767
06769
06770
DbgPrint(
"Se: Return to default state (w/previous state) ... ");
06771
06772 PreGroups->GroupCount = 77;
06773 IgnoreStatus =
NtQueryInformationToken(
06774 TokenWithGroups,
06775 TokenGroups,
06776 PreGroups,
06777 PreGroupsLength,
06778 &IgnoreReturnLength
06779 );
06780
#ifdef TOKEN_DEBUG
06781
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
06782
#endif //TOKEN_DEBUG
06783
06784
ASSERT(PreGroups->GroupCount == GROUP_COUNT );
06785
ASSERT(PreGroups->Groups[FLINTSTONE_INDEX].Attributes == OwnerGroupAttributes);
06786
ASSERT(PreGroups->Groups[CHILD_INDEX].Attributes == DisabledGroupAttributes);
06787
ASSERT(PreGroups->Groups[NEANDERTHOL_INDEX].Attributes == DisabledGroupAttributes);
06788
ASSERT(PreGroups->Groups[WORLD_INDEX].Attributes == NormalGroupAttributes);
06789
ASSERT(
NT_SUCCESS(IgnoreStatus) );
06790
06791
Status =
NtAdjustGroupsToken(
06792 TokenWithGroups,
06793 TRUE,
06794 NULL,
06795 PreviousStateBufferLength,
06796 PreviousState,
06797 &ReturnLength
06798 );
06799
#ifdef TOKEN_DEBUG
06800
DbgPrint(
"\n (debug) return length: 0x%lx \n", ReturnLength);
06801
#endif //TOKEN_DEBUG
06802
06803 PostGroups->GroupCount = 88;
06804 IgnoreStatus =
NtQueryInformationToken(
06805 TokenWithGroups,
06806 TokenGroups,
06807 PostGroups,
06808 PostGroupsLength,
06809 &IgnoreReturnLength
06810 );
06811
#ifdef TOKEN_DEBUG
06812
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
06813
#endif //TOKEN_DEBUG
06814
06815
ASSERT(
NT_SUCCESS(IgnoreStatus) );
06816
06817
if (
Status == STATUS_SUCCESS) {
06818
06819
06820
06821
06822
06823
ASSERT( PostGroups->GroupCount == GROUP_COUNT );
06824
if ( (PostGroups->Groups[
FLINTSTONE_INDEX].Attributes ==
OwnerGroupAttributes) &&
06825 (PostGroups->Groups[
CHILD_INDEX].Attributes ==
OptionalGroupAttributes) &&
06826 (PostGroups->Groups[
NEANDERTHOL_INDEX].Attributes ==
OptionalGroupAttributes) &&
06827 (PostGroups->Groups[
WORLD_INDEX].Attributes ==
NormalGroupAttributes) &&
06828 (PreviousState->Groups[0].Attributes ==
DisabledGroupAttributes) &&
06829 (PreviousState->Groups[1].Attributes ==
DisabledGroupAttributes)
06830 ) {
06831
06832
DbgPrint(
"Succeeded. \n");
06833
06834 }
else {
06835
06836
DbgPrint(
"********** Failed Value Check ************\n");
06837
DbgPrint(
"Status is: 0x%lx \n", Status);
06838
06839
DbgPrint(
"Before/after Flintstone state: 0x%lx / 0x%lx \n",
06840 PreGroups->Groups[FLINTSTONE_INDEX].Attributes,
06841 PostGroups->Groups[FLINTSTONE_INDEX].Attributes);
06842
06843
DbgPrint(
"Before/after Child state: 0x%lx / 0x%lx \n",
06844 PreGroups->Groups[CHILD_INDEX].Attributes,
06845 PostGroups->Groups[CHILD_INDEX].Attributes);
06846
06847
DbgPrint(
"Before/after Neanderthol state: 0x%lx / 0x%lx \n",
06848 PreGroups->Groups[NEANDERTHOL_INDEX].Attributes,
06849 PostGroups->Groups[NEANDERTHOL_INDEX].Attributes);
06850
06851
DbgPrint(
"Before/after World state: 0x%lx / 0x%lx \n",
06852 PreGroups->Groups[WORLD_INDEX].Attributes,
06853 PostGroups->Groups[WORLD_INDEX].Attributes);
06854
06855
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
06856
06857 CompletionStatus =
FALSE;
06858
06859 }
06860
06861 }
else {
06862
06863
DbgPrint(
"********** Failed ************\n");
06864
DbgPrint(
"Status is: 0x%lx \n", Status);
06865
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
06866 CompletionStatus =
FALSE;
06867
06868 }
06869
06870
ASSERT(Status == STATUS_SUCCESS);
06871
06872
06873
06875
06876
06877
06879
06880
DbgPrint(
"Se: Return to default state (no previous state) ... ");
06881
06882
Status =
NtAdjustGroupsToken(
06883 TokenWithGroups,
06884 FALSE,
06885 PreviousState,
06886 0,
06887 NULL,
06888 &ReturnLength
06889 );
06890
06891
ASSERT(Status == STATUS_SUCCESS);
06892
06893 PreGroups->GroupCount = 77;
06894 IgnoreStatus =
NtQueryInformationToken(
06895 TokenWithGroups,
06896 TokenGroups,
06897 PreGroups,
06898 PreGroupsLength,
06899 &IgnoreReturnLength
06900 );
06901
#ifdef TOKEN_DEBUG
06902
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
06903
#endif //TOKEN_DEBUG
06904
06905
ASSERT(PreGroups->GroupCount == GROUP_COUNT );
06906
ASSERT(PreGroups->Groups[FLINTSTONE_INDEX].Attributes == OwnerGroupAttributes);
06907
ASSERT(PreGroups->Groups[CHILD_INDEX].Attributes == DisabledGroupAttributes);
06908
ASSERT(PreGroups->Groups[NEANDERTHOL_INDEX].Attributes == DisabledGroupAttributes);
06909
ASSERT(PreGroups->Groups[WORLD_INDEX].Attributes == NormalGroupAttributes);
06910
ASSERT(
NT_SUCCESS(IgnoreStatus) );
06911
06912
Status =
NtAdjustGroupsToken(
06913 TokenWithGroups,
06914 TRUE,
06915 NULL,
06916 0,
06917 NULL,
06918 &ReturnLength
06919 );
06920
06921 PostGroups->GroupCount = 88;
06922 IgnoreStatus =
NtQueryInformationToken(
06923 TokenWithGroups,
06924 TokenGroups,
06925 PostGroups,
06926 PostGroupsLength,
06927 &IgnoreReturnLength
06928 );
06929
#ifdef TOKEN_DEBUG
06930
DbgPrint(
"\n (debug) ignore return length: 0x%lx \n", IgnoreReturnLength);
06931
#endif //TOKEN_DEBUG
06932
06933
ASSERT(
NT_SUCCESS(IgnoreStatus) );
06934
06935
if (
Status == STATUS_SUCCESS) {
06936
06937
06938
06939
06940
06941
ASSERT( PostGroups->GroupCount == GROUP_COUNT );
06942
if ( (PostGroups->Groups[
FLINTSTONE_INDEX].Attributes ==
OwnerGroupAttributes) &&
06943 (PostGroups->Groups[
CHILD_INDEX].Attributes ==
OptionalGroupAttributes) &&
06944 (PostGroups->Groups[
NEANDERTHOL_INDEX].Attributes ==
OptionalGroupAttributes) &&
06945 (PostGroups->Groups[
WORLD_INDEX].Attributes ==
NormalGroupAttributes)
06946 ) {
06947
06948
DbgPrint(
"Succeeded. \n");
06949
06950 }
else {
06951
06952
DbgPrint(
"********** Failed Value Check ************\n");
06953
DbgPrint(
"Status is: 0x%lx \n", Status);
06954
06955
DbgPrint(
"Before/after Flintstone state: 0x%lx / 0x%lx \n",
06956 PreGroups->Groups[FLINTSTONE_INDEX].Attributes,
06957 PostGroups->Groups[FLINTSTONE_INDEX].Attributes);
06958
06959
DbgPrint(
"Before/after Child state: 0x%lx / 0x%lx \n",
06960 PreGroups->Groups[CHILD_INDEX].Attributes,
06961 PostGroups->Groups[CHILD_INDEX].Attributes);
06962
06963
DbgPrint(
"Before/after Neanderthol state: 0x%lx / 0x%lx \n",
06964 PreGroups->Groups[NEANDERTHOL_INDEX].Attributes,
06965 PostGroups->Groups[NEANDERTHOL_INDEX].Attributes);
06966
06967
DbgPrint(
"Before/after World state: 0x%lx / 0x%lx \n",
06968 PreGroups->Groups[WORLD_INDEX].Attributes,
06969 PostGroups->Groups[WORLD_INDEX].Attributes);
06970
06971
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
06972
06973 CompletionStatus =
FALSE;
06974
06975 }
06976
06977 }
else {
06978
06979
DbgPrint(
"********** Failed ************\n");
06980
DbgPrint(
"Status is: 0x%lx \n", Status);
06981
DbgPrint(
"Return Length is: 0x%lx \n", ReturnLength);
06982 CompletionStatus =
FALSE;
06983
06984 }
06985
06986
ASSERT(Status == STATUS_SUCCESS);
06987
06988
06989
06990
06992
06993
06994
06996
06997
06998
06999 TstDeallocatePool( PreviousState, PreviousStateBufferLength );
07000 TstDeallocatePool( NewState, NewStateBufferLength );
07001 TstDeallocatePool( PreGroups, PreGroupsLength );
07002 TstDeallocatePool( PostGroups, PostGroupsLength );
07003
07004
07005
return CompletionStatus;
07006 }