@@ -60,10 +60,7 @@ BOOLEAN RtlpNotAllowingMultipleActivation;
6060#define STRSECTION_MAGIC 0x64487353 /* dHsS */
6161#define GUIDSECTION_MAGIC 0x64487347 /* dHsG */
6262
63- #define ACTCTX_MAGIC_MARKER (PVOID)'gMcA'
64-
6563#define ACTCTX_FAKE_HANDLE ((HANDLE) 0xf00baa)
66- #define ACTCTX_FAKE_COOKIE ((ULONG_PTR) 0xf00bad)
6764
6865/* we don't want to include winuser.h */
6966#define RT_MANIFEST ((ULONG_PTR)24)
@@ -569,8 +566,9 @@ typedef struct _ASSEMBLY_STORAGE_MAP
569566
570567typedef struct _ACTIVATION_CONTEXT
571568{
569+ ULONG magic ;
570+ LONG ref_count ;
572571#ifdef __REACTOS__
573- LONG ref_count ;
574572 ULONG Flags ;
575573 LIST_ENTRY Links ;
576574 PACTIVATION_CONTEXT_DATA ActivationContextData ;
@@ -582,9 +580,6 @@ typedef struct _ACTIVATION_CONTEXT
582580 PASSEMBLY_STORAGE_MAP_ENTRY InlineStorageMapEntries ;
583581 ULONG StackTraceIndex ;
584582 PVOID StackTraces [4 ][4 ];
585- #else
586- ULONG magic ;
587- int ref_count ;
588583#endif // __REACTOS__
589584 struct file_info config ;
590585 struct file_info appdir ;
@@ -627,63 +622,6 @@ static const WCHAR current_archW[] = {'n','o','n','e',0};
627622static const WCHAR asmv1W [] = {'u' ,'r' ,'n' ,':' ,'s' ,'c' ,'h' ,'e' ,'m' ,'a' ,'s' ,'-' ,'m' ,'i' ,'c' ,'r' ,'o' ,'s' ,'o' ,'f' ,'t' ,'-' ,'c' ,'o' ,'m' ,':' ,'a' ,'s' ,'m' ,'.' ,'v' ,'1' ,0 };
628623static const WCHAR asmv2W [] = {'u' ,'r' ,'n' ,':' ,'s' ,'c' ,'h' ,'e' ,'m' ,'a' ,'s' ,'-' ,'m' ,'i' ,'c' ,'r' ,'o' ,'s' ,'o' ,'f' ,'t' ,'-' ,'c' ,'o' ,'m' ,':' ,'a' ,'s' ,'m' ,'.' ,'v' ,'2' ,0 };
629624static const WCHAR asmv3W [] = {'u' ,'r' ,'n' ,':' ,'s' ,'c' ,'h' ,'e' ,'m' ,'a' ,'s' ,'-' ,'m' ,'i' ,'c' ,'r' ,'o' ,'s' ,'o' ,'f' ,'t' ,'-' ,'c' ,'o' ,'m' ,':' ,'a' ,'s' ,'m' ,'.' ,'v' ,'3' ,0 };
630-
631- #ifdef __REACTOS__
632- typedef struct _ACTIVATION_CONTEXT_WRAPPED
633- {
634- PVOID MagicMarker ;
635- ACTIVATION_CONTEXT ActivationContext ;
636- } ACTIVATION_CONTEXT_WRAPPED , * PACTIVATION_CONTEXT_WRAPPED ;
637-
638- VOID
639- NTAPI
640- RtlpSxsBreakOnInvalidMarker (IN PACTIVATION_CONTEXT ActCtx ,
641- IN ULONG FailureCode )
642- {
643- EXCEPTION_RECORD ExceptionRecord ;
644-
645- /* Fatal SxS exception header */
646- ExceptionRecord .ExceptionRecord = NULL ;
647- ExceptionRecord .ExceptionCode = STATUS_SXS_CORRUPTION ;
648- ExceptionRecord .ExceptionFlags = EXCEPTION_NONCONTINUABLE ;
649-
650- /* With SxS-specific information plus the context itself */
651- ExceptionRecord .ExceptionInformation [0 ] = 1 ;
652- ExceptionRecord .ExceptionInformation [1 ] = FailureCode ;
653- ExceptionRecord .ExceptionInformation [2 ] = (ULONG_PTR )ActCtx ;
654- ExceptionRecord .NumberParameters = 3 ;
655-
656- /* Raise it */
657- RtlRaiseException (& ExceptionRecord );
658- }
659-
660- FORCEINLINE
661- VOID
662- RtlpValidateActCtx (IN PACTIVATION_CONTEXT ActCtx )
663- {
664- PACTIVATION_CONTEXT_WRAPPED pActual ;
665-
666- /* Get the caller-opaque header */
667- pActual = CONTAINING_RECORD (ActCtx ,
668- ACTIVATION_CONTEXT_WRAPPED ,
669- ActivationContext );
670-
671- /* Check if the header matches as expected */
672- if (pActual -> MagicMarker != ACTCTX_MAGIC_MARKER )
673- {
674- /* Nope, print out a warning, assert, and then throw an exception */
675- DbgPrint ("%s : Invalid activation context marker %p found in activation context %p\n"
676- " This means someone stepped on the allocation, or someone is using a\n"
677- " deallocated activation context\n" ,
678- __FUNCTION__ ,
679- pActual -> MagicMarker ,
680- ActCtx );
681- ASSERT (pActual -> MagicMarker == ACTCTX_MAGIC_MARKER );
682- RtlpSxsBreakOnInvalidMarker (ActCtx , 1 );
683- }
684- }
685- #endif // __REACTOS__
686-
687625static const WCHAR assemblyW [] = {'a' ,'s' ,'s' ,'e' ,'m' ,'b' ,'l' ,'y' ,0 };
688626static const WCHAR assemblyIdentityW [] = {'a' ,'s' ,'s' ,'e' ,'m' ,'b' ,'l' ,'y' ,'I' ,'d' ,'e' ,'n' ,'t' ,'i' ,'t' ,'y' ,0 };
689627static const WCHAR bindingRedirectW [] = {'b' ,'i' ,'n' ,'d' ,'i' ,'n' ,'g' ,'R' ,'e' ,'d' ,'i' ,'r' ,'e' ,'c' ,'t' ,0 };
@@ -828,9 +766,9 @@ static const WCHAR dotManifestW[] = {'.','m','a','n','i','f','e','s','t',0};
828766static const WCHAR version_formatW [] = {'%' ,'u' ,'.' ,'%' ,'u' ,'.' ,'%' ,'u' ,'.' ,'%' ,'u' ,0 };
829767static const WCHAR wildcardW [] = {'*' ,0 };
830768
831- static ACTIVATION_CONTEXT_WRAPPED system_actctx = { ACTCTX_MAGIC_MARKER , { 1 } };
832- static ACTIVATION_CONTEXT * process_actctx = & system_actctx . ActivationContext ;
833- static ACTIVATION_CONTEXT * implicit_actctx = & system_actctx . ActivationContext ;
769+ static ACTIVATION_CONTEXT system_actctx = { ACTCTX_MAGIC , 1 };
770+ static ACTIVATION_CONTEXT * process_actctx = & system_actctx ;
771+ static ACTIVATION_CONTEXT * implicit_actctx = & system_actctx ;
834772
835773static WCHAR * strdupW (const WCHAR * str )
836774{
@@ -1259,16 +1197,11 @@ static WCHAR *build_assembly_id( const struct assembly_identity *ai )
12591197static ACTIVATION_CONTEXT * check_actctx ( HANDLE h )
12601198{
12611199 ACTIVATION_CONTEXT * ret = NULL , * actctx = h ;
1262- PACTIVATION_CONTEXT_WRAPPED pActual ;
12631200
12641201 if (!h || h == INVALID_HANDLE_VALUE ) return NULL ;
12651202 __TRY
12661203 {
1267- if (actctx )
1268- {
1269- pActual = CONTAINING_RECORD (actctx , ACTIVATION_CONTEXT_WRAPPED , ActivationContext );
1270- if (pActual -> MagicMarker == ACTCTX_MAGIC_MARKER ) ret = & pActual -> ActivationContext ;
1271- }
1204+ if (actctx -> magic == ACTCTX_MAGIC ) ret = actctx ;
12721205 }
12731206 __EXCEPT_PAGE_FAULT
12741207 {
@@ -1285,8 +1218,6 @@ static inline void actctx_addref( ACTIVATION_CONTEXT *actctx )
12851218
12861219static void actctx_release ( ACTIVATION_CONTEXT * actctx )
12871220{
1288- PACTIVATION_CONTEXT_WRAPPED pActual ;
1289-
12901221 if (!InterlockedDecrement ( & actctx -> ref_count ))
12911222 {
12921223 unsigned int i , j ;
@@ -1318,10 +1249,8 @@ static void actctx_release( ACTIVATION_CONTEXT *actctx )
13181249 RtlFreeHeap ( GetProcessHeap (), 0 , actctx -> ifaceps_section );
13191250 RtlFreeHeap ( GetProcessHeap (), 0 , actctx -> clrsurrogate_section );
13201251 RtlFreeHeap ( GetProcessHeap (), 0 , actctx -> progid_section );
1321-
1322- pActual = CONTAINING_RECORD (actctx , ACTIVATION_CONTEXT_WRAPPED , ActivationContext );
1323- pActual -> MagicMarker = 0 ;
1324- RtlFreeHeap (GetProcessHeap (), 0 , pActual );
1252+ actctx -> magic = 0 ;
1253+ RtlFreeHeap ( GetProcessHeap (), 0 , actctx );
13251254 }
13261255}
13271256
@@ -5211,7 +5140,6 @@ RtlCreateActivationContext(IN ULONG Flags,
52115140{
52125141 const ACTCTXW * pActCtx = (PVOID )ActivationContextData ;
52135142 const WCHAR * directory = NULL ;
5214- PACTIVATION_CONTEXT_WRAPPED ActualActCtx ;
52155143 ACTIVATION_CONTEXT * actctx ;
52165144 UNICODE_STRING nameW ;
52175145 ULONG lang = 0 ;
@@ -5226,12 +5154,10 @@ RtlCreateActivationContext(IN ULONG Flags,
52265154 return STATUS_INVALID_PARAMETER ;
52275155
52285156
5229- if (!(ActualActCtx = RtlAllocateHeap (GetProcessHeap (), HEAP_ZERO_MEMORY , sizeof (* ActualActCtx ) )))
5157+ if (!(actctx = RtlAllocateHeap ( GetProcessHeap (), HEAP_ZERO_MEMORY , sizeof (* actctx ) )))
52305158 return STATUS_NO_MEMORY ;
52315159
5232- ActualActCtx -> MagicMarker = ACTCTX_MAGIC_MARKER ;
5233-
5234- actctx = & ActualActCtx -> ActivationContext ;
5160+ actctx -> magic = ACTCTX_MAGIC ;
52355161 actctx -> ref_count = 1 ;
52365162 actctx -> config .type = ACTIVATION_CONTEXT_PATH_TYPE_NONE ;
52375163 actctx -> config .info = NULL ;
@@ -5349,55 +5275,6 @@ RtlCreateActivationContext(IN ULONG Flags,
53495275 return status ;
53505276}
53515277
5352- #if 0
5353- #define ACT_CTX_VALID (p ) ((((ULONG_PTR)p - 1) | 7) != -1)
5354-
5355- VOID
5356- NTAPI
5357- RtlAddRefActivationContext (IN PACTIVATION_CONTEXT Handle )
5358- {
5359- PIACTIVATION_CONTEXT ActCtx = (PIACTIVATION_CONTEXT )Handle ;
5360- LONG OldRefCount , NewRefCount ;
5361-
5362- if ((ActCtx ) && (ACT_CTX_VALID (ActCtx )) && (ActCtx -> RefCount != LONG_MAX ))
5363- {
5364- RtlpValidateActCtx (ActCtx );
5365-
5366- while (TRUE)
5367- {
5368- OldRefCount = ActCtx -> RefCount ;
5369- ASSERT (OldRefCount > 0 );
5370-
5371- if (OldRefCount == LONG_MAX ) break ;
5372-
5373- NewRefCount = OldRefCount + 1 ;
5374- if (InterlockedCompareExchange (& ActCtx -> RefCount ,
5375- NewRefCount ,
5376- OldRefCount ) == OldRefCount )
5377- {
5378- break ;
5379- }
5380- }
5381-
5382- NewRefCount = LONG_MAX ;
5383- ASSERT (NewRefCount > 0 );
5384- }
5385- }
5386-
5387- VOID
5388- NTAPI
5389- RtlReleaseActivationContext ( HANDLE handle )
5390- {
5391- PIACTIVATION_CONTEXT ActCtx = (PIACTIVATION_CONTEXT ) Handle ;
5392-
5393- if ((ActCtx ) && (ACT_CTX_VALID (ActCtx )) && (ActCtx -> RefCount != LONG_MAX ))
5394- {
5395- RtlpValidateActCtx (ActCtx );
5396-
5397- actctx_release (ActCtx );
5398- }
5399- }
5400- #else
54015278
54025279/***********************************************************************
54035280 * RtlAddRefActivationContext (NTDLL.@)
@@ -5420,8 +5297,6 @@ void WINAPI RtlReleaseActivationContext( HANDLE handle )
54205297 if ((actctx = check_actctx ( handle ))) actctx_release ( actctx );
54215298}
54225299
5423- #endif
5424-
54255300/******************************************************************
54265301 * RtlZombifyActivationContext (NTDLL.@)
54275302 *
0 commit comments