00328 :
00329
00330 This
is the main entry routine
for this test.
00331
00332 Arguments:
00333
00334 NONE
00335
00336
00337 Return Value:
00338
00339
00340
00341
00342 --*/
00343 {
00344
NTSTATUS
00345 NtStatus;
00346
00347 HANDLE
00348 h1, h2, h3;
00349
00350 OBJECT_ATTRIBUTES
00351
ObjectAttributes;
00352
00353 SECURITY_QUALITY_OF_SERVICE
00354 Qos;
00355
00356
00357
00358
00359
00360
00361 NtStatus =
NtOpenProcessToken( NtCurrentProcess(),
00362 TOKEN_DUPLICATE,
00363 &h1);
00364 printf(
"Test: Open Process Token: 0x%lx\n", NtStatus);
00365
00366 InitializeObjectAttributes( &ObjectAttributes, NULL, 0, 0, NULL );
00367 NtStatus =
NtDuplicateToken( h1,
00368 TOKEN_DUPLICATE,
00369 &ObjectAttributes,
00370 FALSE,
00371 TokenImpersonation,
00372 &h2);
00373 printf(
"Test: Duplicate Primary to anonymous Impersonation: 0x%lx\n", NtStatus);
00374
00375
00376
00377
00378
00379 NtStatus =
NtDuplicateToken( h2,
00380 TOKEN_DUPLICATE,
00381 &ObjectAttributes,
00382 FALSE,
00383 TokenPrimary,
00384 &h3);
00385 printf(
"Test: Duplicate anonymous Impersonation to Primary: 0x%lx\n", NtStatus);
00386
00387
00388
00389
00390
00391 Qos.Length =
sizeof(Qos);
00392 Qos.ImpersonationLevel = SecurityImpersonation;
00393 Qos.ContextTrackingMode = SECURITY_STATIC_TRACKING;
00394 Qos.EffectiveOnly =
FALSE;
00395
00396 InitializeObjectAttributes( &ObjectAttributes, NULL, 0, 0, NULL );
00397
ObjectAttributes.SecurityQualityOfService = &Qos;
00398
00399 NtStatus =
NtDuplicateToken( h1,
00400 TOKEN_DUPLICATE,
00401 &ObjectAttributes,
00402 FALSE,
00403 TokenImpersonation,
00404 &h2);
00405 printf(
"Test: Duplicate Primary to IMPERSONATE Impersonation: 0x%lx\n", NtStatus);
00406
00407
00408
00409
00410
00411 NtStatus =
NtDuplicateToken( h2,
00412 TOKEN_DUPLICATE,
00413 &ObjectAttributes,
00414 FALSE,
00415 TokenPrimary,
00416 &h3);
00417 printf(
"Test: Duplicate IMPERSONATE Impersonation to Primary: 0x%lx\n", NtStatus);
00418
00419
return;
00420 }