@@ -449,6 +449,32 @@ PPH_STRING PhGetAppContainerName(
449
449
appContainerName = PhCreateString (packageMonikerName );
450
450
AppContainerFreeMemory_I (packageMonikerName );
451
451
}
452
+ else // Check the local system account appcontainer mappings. (dmex)
453
+ {
454
+ static PH_STRINGREF appcontainerMappings = PH_STRINGREF_INIT (L"Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows\\CurrentVersion\\AppContainer\\Mappings\\" );
455
+ static PH_STRINGREF appcontainerDefaultMappings = PH_STRINGREF_INIT (L".DEFAULT\\" );
456
+ HANDLE keyHandle ;
457
+ PPH_STRING sidString ;
458
+ PPH_STRING keyPath ;
459
+
460
+ sidString = PhSidToStringSid (AppContainerSid );
461
+ keyPath = PhConcatStringRef3 (& appcontainerDefaultMappings , & appcontainerMappings , & sidString -> sr );
462
+
463
+ if (NT_SUCCESS (PhOpenKey (
464
+ & keyHandle ,
465
+ KEY_READ ,
466
+ PH_KEY_USERS ,
467
+ & keyPath -> sr ,
468
+ 0
469
+ )))
470
+ {
471
+ PhMoveReference (& appContainerName , PhQueryRegistryString (keyHandle , L"Moniker" ));
472
+ NtClose (keyHandle );
473
+ }
474
+
475
+ PhDereferenceObject (keyPath );
476
+ PhDereferenceObject (sidString );
477
+ }
452
478
453
479
return appContainerName ;
454
480
}
@@ -481,6 +507,7 @@ PPH_STRING PhGetAppContainerPackageName(
481
507
)
482
508
{
483
509
static PH_STRINGREF appcontainerMappings = PH_STRINGREF_INIT (L"Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows\\CurrentVersion\\AppContainer\\Mappings\\" );
510
+ static PH_STRINGREF appcontainerDefaultMappings = PH_STRINGREF_INIT (L".DEFAULT\\" );
484
511
HANDLE keyHandle ;
485
512
PPH_STRING sidString ;
486
513
PPH_STRING keyPath ;
@@ -509,6 +536,27 @@ PPH_STRING PhGetAppContainerPackageName(
509
536
}
510
537
511
538
PhDereferenceObject (keyPath );
539
+
540
+ // Check the local system account appcontainer mappings. (dmex)
541
+ if (PhIsNullOrEmptyString (packageName ))
542
+ {
543
+ keyPath = PhConcatStringRef3 (& appcontainerDefaultMappings , & appcontainerMappings , & sidString -> sr );
544
+
545
+ if (NT_SUCCESS (PhOpenKey (
546
+ & keyHandle ,
547
+ KEY_READ ,
548
+ PH_KEY_USERS ,
549
+ & keyPath -> sr ,
550
+ 0
551
+ )))
552
+ {
553
+ PhMoveReference (& packageName , PhQueryRegistryString (keyHandle , L"Moniker" ));
554
+ NtClose (keyHandle );
555
+ }
556
+
557
+ PhDereferenceObject (keyPath );
558
+ }
559
+
512
560
PhDereferenceObject (sidString );
513
561
514
562
return packageName ;
0 commit comments