Index: dll/ntdll/ldr/ldrapi.c =================================================================== --- dll/ntdll/ldr/ldrapi.c (revision 68072) +++ dll/ntdll/ldr/ldrapi.c (working copy) @@ -1320,7 +1320,7 @@ PVOID EntryPoint; PLIST_ENTRY NextEntry; LIST_ENTRY UnloadList; - RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED ActCtx; + //RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED ActCtx; PVOID CorImageData; ULONG ComSectionSize; @@ -1349,6 +1349,7 @@ /* If it's a dll */ if (LdrEntry->Flags & LDRP_IMAGE_DLL) { +#ifdef PROPER_ACTCTX /* Set up the Act Ctx */ ActCtx.Size = sizeof(ActCtx); ActCtx.Format = RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER; @@ -1357,12 +1358,16 @@ /* Activate the ActCtx */ RtlActivateActivationContextUnsafeFast(&ActCtx, LdrEntry->EntryPointActivationContext); - +#else +#endif /* Update the load count */ LdrpUpdateLoadCount2(LdrEntry, LDRP_UPDATE_DEREFCOUNT); /* Release the context */ +#ifdef PROPER_ACTCTX RtlDeactivateActivationContextUnsafeFast(&ActCtx); +#else +#endif } } else @@ -1461,6 +1466,7 @@ DPRINT1("LDR: Calling deinit %p\n", EntryPoint); } +#ifdef PROPER_ACTCTX /* Set up the Act Ctx */ ActCtx.Size = sizeof(ActCtx); ActCtx.Format = RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER; @@ -1469,7 +1475,8 @@ /* Activate the ActCtx */ RtlActivateActivationContextUnsafeFast(&ActCtx, LdrEntry->EntryPointActivationContext); - +#else +#endif /* Call the entrypoint */ LdrpCallInitRoutine(LdrEntry->EntryPoint, LdrEntry->DllBase, @@ -1477,7 +1484,10 @@ NULL); /* Release the context */ +#ifdef PROPER_ACTCTX RtlDeactivateActivationContextUnsafeFast(&ActCtx); +#else +#endif } /* Remove it from the list */ Index: dll/ntdll/ldr/ldrinit.c =================================================================== --- dll/ntdll/ldr/ldrinit.c (revision 68072) +++ dll/ntdll/ldr/ldrinit.c (working copy) @@ -88,6 +88,7 @@ NTSTATUS LdrPerformRelocations(PIMAGE_NT_HEADERS NTHeaders, PVOID ImageBase); void actctx_init(void); extern BOOLEAN RtlpUse16ByteSLists; +NTSTATUS create_module_activation_context( LDR_DATA_TABLE_ENTRY *module ); #ifdef _WIN64 #define DEFAULT_SECURITY_COOKIE 0x00002B992DDFA232ll @@ -497,7 +498,7 @@ PPEB Peb = NtCurrentPeb(); PLDR_DATA_TABLE_ENTRY LdrEntry; PLIST_ENTRY NextEntry, ListHead; - RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED ActCtx; + //RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED ActCtx; NTSTATUS Status; PVOID EntryPoint; @@ -542,6 +543,7 @@ (LdrEntry->Flags & LDRP_PROCESS_ATTACH_CALLED) && (LdrEntry->Flags & LDRP_IMAGE_DLL)) { +#ifdef PROPER_ACTCTX /* Set up the Act Ctx */ ActCtx.Size = sizeof(ActCtx); ActCtx.Format = 1; @@ -550,7 +552,10 @@ /* Activate the ActCtx */ RtlActivateActivationContextUnsafeFast(&ActCtx, LdrEntry->EntryPointActivationContext); - +#else + //ULONG_PTR Cookie; + //if (LdrEntry->EntryPointActivationContext) RtlActivateActivationContext(0, LdrEntry->EntryPointActivationContext, &Cookie); +#endif /* Check if it has TLS */ if (LdrEntry->TlsIndex) { @@ -577,7 +582,11 @@ } /* Deactivate the ActCtx */ +#ifdef PROPER_ACTCTX RtlDeactivateActivationContextUnsafeFast(&ActCtx); +#else + //if (LdrEntry->EntryPointActivationContext) RtlDeactivateActivationContext(0, Cookie); +#endif } } } @@ -589,6 +598,7 @@ /* Check for TLS */ if (LdrpImageHasTls && !LdrpShutdownInProgress) { +#ifdef PROPER_ACTCTX /* Set up the Act Ctx */ ActCtx.Size = sizeof(ActCtx); ActCtx.Format = 1; @@ -597,12 +607,20 @@ /* Activate the ActCtx */ RtlActivateActivationContextUnsafeFast(&ActCtx, LdrpImageEntry->EntryPointActivationContext); +#else + //ULONG_PTR Cookie; + //if (LdrpImageEntry->EntryPointActivationContext) RtlActivateActivationContext(0, LdrpImageEntry->EntryPointActivationContext, &Cookie); +#endif /* Do TLS callbacks */ LdrpCallTlsInitializers(Peb->ImageBaseAddress, DLL_THREAD_ATTACH); /* Deactivate the ActCtx */ +#ifdef PROPER_ACTCTX RtlDeactivateActivationContextUnsafeFast(&ActCtx); +#else + //if (LdrpImageEntry->EntryPointActivationContext) RtlDeactivateActivationContext(0, Cookie); +#endif } DPRINT("LdrpInitializeThread() done\n"); @@ -621,7 +639,8 @@ //ULONG BreakOnInit; NTSTATUS Status = STATUS_SUCCESS; PPEB Peb = NtCurrentPeb(); - RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED ActCtx; + //RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED ActCtx; + //ULONG_PTR Cookie; ULONG BreakOnDllLoad; PTEB OldTldTeb; BOOLEAN DllStatus; @@ -786,6 +805,7 @@ OldInitializer = LdrpCurrentDllInitializer; LdrpCurrentDllInitializer = LdrEntry; +#ifdef PROPER_ACTCTX /* Set up the Act Ctx */ ActCtx.Size = sizeof(ActCtx); ActCtx.Format = 1; @@ -794,6 +814,9 @@ /* Activate the ActCtx */ RtlActivateActivationContextUnsafeFast(&ActCtx, LdrEntry->EntryPointActivationContext); +#else + //if (LdrpImageEntry->EntryPointActivationContext) RtlActivateActivationContext(0, LdrpImageEntry->EntryPointActivationContext, &Cookie); +#endif /* Check if it has TLS */ if (LdrEntry->TlsIndex && Context) @@ -814,7 +837,11 @@ Context); /* Deactivate the ActCtx */ +#ifdef PROPER_ACTCTX RtlDeactivateActivationContextUnsafeFast(&ActCtx); +#else + //if (LdrpImageEntry->EntryPointActivationContext) RtlDeactivateActivationContext(0, Cookie); +#endif /* Save the Current DLL Initializer */ LdrpCurrentDllInitializer = OldInitializer; @@ -852,6 +879,7 @@ /* Check for TLS */ if (LdrpImageHasTls && Context) { +#ifdef PROPER_ACTCTX /* Set up the Act Ctx */ ActCtx.Size = sizeof(ActCtx); ActCtx.Format = 1; @@ -860,12 +888,20 @@ /* Activate the ActCtx */ RtlActivateActivationContextUnsafeFast(&ActCtx, LdrpImageEntry->EntryPointActivationContext); +#else + //ULONG_PTR Cookie; + //if (LdrpImageEntry->EntryPointActivationContext) RtlActivateActivationContext(0, LdrpImageEntry->EntryPointActivationContext, &Cookie); +#endif /* Do TLS callbacks */ LdrpCallTlsInitializers(Peb->ImageBaseAddress, DLL_PROCESS_ATTACH); /* Deactivate the ActCtx */ +#ifdef PROPER_ACTCTX RtlDeactivateActivationContextUnsafeFast(&ActCtx); +#else + //if (LdrpImageEntry->EntryPointActivationContext) RtlDeactivateActivationContext(0, Cookie); +#endif } Quickie: @@ -894,7 +930,7 @@ PPEB Peb = NtCurrentPeb(); PLDR_DATA_TABLE_ENTRY LdrEntry; PLIST_ENTRY NextEntry, ListHead; - RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED ActCtx; + //RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED ActCtx; PVOID EntryPoint; DPRINT("LdrShutdownProcess() called for %wZ\n", &LdrpImageEntry->BaseDllName); @@ -946,6 +982,7 @@ (LdrEntry->Flags & LDRP_PROCESS_ATTACH_CALLED) && LdrEntry->Flags) { +#ifdef PROPER_ACTCTX /* Set up the Act Ctx */ ActCtx.Size = sizeof(ActCtx); ActCtx.Format = 1; @@ -954,6 +991,10 @@ /* Activate the ActCtx */ RtlActivateActivationContextUnsafeFast(&ActCtx, LdrEntry->EntryPointActivationContext); +#else + //ULONG_PTR Cookie; + //if (LdrEntry->EntryPointActivationContext) RtlActivateActivationContext(0, LdrEntry->EntryPointActivationContext, &Cookie); +#endif /* Check if it has TLS */ if (LdrEntry->TlsIndex) @@ -971,7 +1012,11 @@ (PVOID)1); /* Deactivate the ActCtx */ +#ifdef PROPER_ACTCTX RtlDeactivateActivationContextUnsafeFast(&ActCtx); +#else + //if (LdrEntry->EntryPointActivationContext) RtlDeactivateActivationContext(0, Cookie); +#endif } } } @@ -979,6 +1024,7 @@ /* Check for TLS */ if (LdrpImageHasTls) { +#ifdef PROPER_ACTCTX /* Set up the Act Ctx */ ActCtx.Size = sizeof(ActCtx); ActCtx.Format = 1; @@ -987,12 +1033,19 @@ /* Activate the ActCtx */ RtlActivateActivationContextUnsafeFast(&ActCtx, LdrpImageEntry->EntryPointActivationContext); - +#else + //ULONG_PTR Cookie; + //if (LdrpImageEntry->EntryPointActivationContext) RtlActivateActivationContext(0, LdrpImageEntry->EntryPointActivationContext, &Cookie); +#endif /* Do TLS callbacks */ LdrpCallTlsInitializers(Peb->ImageBaseAddress, DLL_PROCESS_DETACH); /* Deactivate the ActCtx */ +#ifdef PROPER_ACTCTX RtlDeactivateActivationContextUnsafeFast(&ActCtx); +#else + //if (LdrpImageEntry->EntryPointActivationContext) RtlDeactivateActivationContext(0, Cookie); +#endif } /* FIXME: Do Heap detection and Etw final shutdown */ @@ -1015,7 +1068,7 @@ PTEB Teb = NtCurrentTeb(); PLDR_DATA_TABLE_ENTRY LdrEntry; PLIST_ENTRY NextEntry, ListHead; - RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED ActCtx; + //RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED ActCtx; PVOID EntryPoint; DPRINT("LdrShutdownThread() called for %wZ\n", @@ -1054,6 +1107,7 @@ /* Check if we are ready to call it */ if (EntryPoint) { +#ifdef PROPER_ACTCTX /* Set up the Act Ctx */ ActCtx.Size = sizeof(ActCtx); ActCtx.Format = 1; @@ -1062,6 +1116,10 @@ /* Activate the ActCtx */ RtlActivateActivationContextUnsafeFast(&ActCtx, LdrEntry->EntryPointActivationContext); +#else + ULONG_PTR Cookie; + if (LdrEntry->EntryPointActivationContext) RtlActivateActivationContext(0, LdrEntry->EntryPointActivationContext, &Cookie); +#endif /* Check if it has TLS */ if (LdrEntry->TlsIndex) @@ -1087,7 +1145,11 @@ } /* Deactivate the ActCtx */ +#ifdef PROPER_ACTCTX RtlDeactivateActivationContextUnsafeFast(&ActCtx); +#else + if (LdrEntry->EntryPointActivationContext) RtlDeactivateActivationContext(0, Cookie); +#endif } } } @@ -1096,6 +1158,7 @@ /* Check for TLS */ if (LdrpImageHasTls) { +#ifdef PROPER_ACTCTX /* Set up the Act Ctx */ ActCtx.Size = sizeof(ActCtx); ActCtx.Format = 1; @@ -1104,12 +1167,20 @@ /* Activate the ActCtx */ RtlActivateActivationContextUnsafeFast(&ActCtx, LdrpImageEntry->EntryPointActivationContext); +#else + //ULONG_PTR Cookie; + //if (LdrpImageEntry->EntryPointActivationContext) RtlActivateActivationContext(0, LdrpImageEntry->EntryPointActivationContext, &Cookie); +#endif /* Do TLS callbacks */ LdrpCallTlsInitializers(Peb->ImageBaseAddress, DLL_THREAD_DETACH); /* Deactivate the ActCtx */ +#ifdef PROPER_ACTCTX RtlDeactivateActivationContextUnsafeFast(&ActCtx); +#else + //if (LdrpImageEntry->EntryPointActivationContext) RtlDeactivateActivationContext(0, Cookie); +#endif } /* Free TLS */ @@ -1931,6 +2002,7 @@ /* Initialize Wine's active context implementation for the current process */ actctx_init(); + create_module_activation_context(LdrpImageEntry); /* Set the current directory */ Status = RtlSetCurrentDirectory_U(&CurrentDirectory); @@ -2237,7 +2309,7 @@ LdrpInLdrInit = TRUE; /* Protect with SEH */ - _SEH2_TRY + //_SEH2_TRY { /* Initialize the Process */ LoaderStatus = LdrpInitializeProcess(Context, @@ -2251,6 +2323,7 @@ UNIMPLEMENTED; } } +#if 0 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { /* Fail with the SEH error */ @@ -2257,7 +2330,7 @@ LoaderStatus = _SEH2_GetExceptionCode(); } _SEH2_END; - +#endif /* We're not initializing anymore */ LdrpInLdrInit = FALSE; Index: dll/ntdll/ldr/ldrpe.c =================================================================== --- dll/ntdll/ldr/ldrpe.c (revision 68072) +++ dll/ntdll/ldr/ldrpe.c (working copy) @@ -684,7 +684,8 @@ LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL, IN PLDR_DATA_TABLE_ENTRY LdrEntry) { - RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED ActCtx; + //RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED ActCtx; + //ULONG_PTR Cookie; PPEB Peb = NtCurrentPeb(); NTSTATUS Status = STATUS_SUCCESS; PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundEntry = NULL; @@ -692,11 +693,6 @@ ULONG BoundSize, IatSize; DPRINT("LdrpWalkImportDescriptor('%S' %p)\n", DllPath, LdrEntry); - /* Set up the Act Ctx */ - RtlZeroMemory(&ActCtx, sizeof(ActCtx)); - ActCtx.Size = sizeof(ActCtx); - ActCtx.Format = RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER; - /* Check if we have a manifest prober routine */ if (LdrpManifestProberRoutine) { @@ -707,6 +703,7 @@ if (!NT_SUCCESS(Status)) return Status; /* Get the Active ActCtx */ +#ifdef PROPER_ACTCTX Status = RtlGetActiveActivationContext(&LdrEntry->EntryPointActivationContext); if (!NT_SUCCESS(Status)) { @@ -719,10 +716,19 @@ return Status; } + /* Set up the Act Ctx */ + RtlZeroMemory(&ActCtx, sizeof(ActCtx)); + ActCtx.Size = sizeof(ActCtx); + ActCtx.Format = RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER; + /* Activate the ActCtx */ RtlActivateActivationContextUnsafeFast(&ActCtx, LdrEntry->EntryPointActivationContext); +#else + //if (LdrEntry->EntryPointActivationContext) RtlActivateActivationContext(0, LdrEntry->EntryPointActivationContext, &Cookie); +#endif + /* Check if we were redirected */ if (!(LdrEntry->Flags & LDRP_REDIRECTED)) { @@ -788,7 +794,11 @@ } /* Release the activation context */ +#ifdef PROPER_ACTCTX RtlDeactivateActivationContextUnsafeFast(&ActCtx); +#else + //if (LdrEntry->EntryPointActivationContext) RtlDeactivateActivationContext(0, Cookie); +#endif /* Return status */ return Status; Index: dll/ntdll/ldr/ldrutils.c =================================================================== --- dll/ntdll/ldr/ldrutils.c (revision 68072) +++ dll/ntdll/ldr/ldrutils.c (working copy) @@ -11,7 +11,7 @@ #include -#define NDEBUG +//#define NDEBUG #include /* GLOBALS *******************************************************************/ @@ -1982,7 +1982,7 @@ PVOID ViewBase = NULL; SIZE_T ViewSize = 0; PIMAGE_NT_HEADERS NtHeader, NtHeader2; - DPRINT("LdrpCheckForLoadedDll('%S' '%wZ' %u %u %p)\n", DllPath ? ((ULONG_PTR)DllPath == 1 ? L"" : DllPath) : L"", DllName, Flag, RedirectedDll, LdrEntry); + //DPRINT("LdrpCheckForLoadedDll('%S' '%wZ' %u %u %p)\n", DllPath ? ((ULONG_PTR)DllPath == 1 ? L"" : DllPath) : L"", DllName, Flag, RedirectedDll, LdrEntry); /* Check if a dll name was provided */ if (!(DllName->Buffer) || !(DllName->Buffer[0])) return FALSE; @@ -2427,6 +2427,7 @@ UNICODE_STRING RawDllName; PLDR_DATA_TABLE_ENTRY LdrEntry; BOOLEAN InInit = LdrpInLdrInit; + ULONG_PTR Cookie = 0; /* Save the Raw DLL Name */ if (DllName->Length >= sizeof(NameBuffer)) return STATUS_NAME_TOO_LONG; @@ -2565,6 +2566,14 @@ InsertTailList(&Peb->Ldr->InInitializationOrderModuleList, &LdrEntry->InInitializationOrderModuleList); +#ifndef PROPER_ACTCTX + /* Create activation context for this module */ + if (!create_module_activation_context(LdrEntry)) + { + RtlActivateActivationContext(0, LdrEntry->EntryPointActivationContext, &Cookie); + } +#endif + /* If we have to run the entrypoint, make sure the DB is ready */ if (CallInit && LdrpLdrDatabaseIsSetup) { @@ -2617,6 +2626,8 @@ } } + if (LdrEntry->EntryPointActivationContext) RtlDeactivateActivationContext(0, Cookie); + Quickie: /* Release the lock */ if (!InInit) RtlLeaveCriticalSection(Peb->LoaderLock); Index: dll/win32/kernel32/client/loader.c =================================================================== --- dll/win32/kernel32/client/loader.c (revision 68072) +++ dll/win32/kernel32/client/loader.c (working copy) @@ -8,7 +8,7 @@ #include -#define NDEBUG +//#define NDEBUG #include /* FUNCTIONS ****************************************************************/ @@ -726,7 +726,7 @@ UNICODE_STRING ModuleNameU; DWORD dwValid; BOOLEAN Redirected = FALSE; // FIXME - +DPRINT1("GMH: %S\n", lpwModuleName); /* Validate parameters */ dwValid = BasepGetModuleHandleExParameterValidation(dwPublicFlags, lpwModuleName, phModule); ASSERT(dwValid == BASEP_GET_MODULE_HANDLE_EX_PARAMETER_VALIDATION_CONTINUE); @@ -848,7 +848,7 @@ /* If current module is requested - return it right away */ if (!lpModuleName) return ((HMODULE)NtCurrentPeb()->ImageBaseAddress); - + /* Use common helper routine */ Success = BasepGetModuleHandleExW(TRUE, GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, Index: dll/win32/kernel32/client/path.c =================================================================== --- dll/win32/kernel32/client/path.c (revision 68072) +++ dll/win32/kernel32/client/path.c (working copy) @@ -1459,7 +1459,7 @@ ULONG ErrorMode; BOOLEAN Found = FALSE; WIN32_FIND_DATAW FindFileData; - +DPRINT1("GetLongPathNameW: %S %p 0x%08X\n", lpszShortPath, lpszLongPath, cchBuffer); /* Initialize so Quickie knows there's nothing to do */ Buffer = Original = NULL; ReturnLength = 0; @@ -2316,7 +2316,7 @@ ReturnLength = BaseWindowsSystemDirectory.Length; } - +DPRINT1("GetSystemDirectoryW(%S %d): returns %d\n", lpBuffer, uSize, ReturnLength / sizeof(WCHAR)); return ReturnLength / sizeof(WCHAR); } @@ -2400,7 +2400,7 @@ ReturnLength = BaseWindowsDirectory.Length; } - +DPRINT1("GetSystemWindowsDirectoryW(%S %d): returns %d\n", lpBuffer, uSize, ReturnLength / sizeof(WCHAR)); return ReturnLength / sizeof(WCHAR); } Index: lib/rtl/actctx.c =================================================================== --- lib/rtl/actctx.c (revision 68072) +++ lib/rtl/actctx.c (working copy) @@ -16,7 +16,7 @@ #include -#define NDEBUG +//#define NDEBUG #include #include @@ -772,6 +772,8 @@ { struct assembly *assembly; + DPRINT1("add_assembly() actctx %p, activeframe ??\n", actctx); + if (actctx->num_assemblies == actctx->allocated_assemblies) { void *ptr; @@ -799,6 +801,7 @@ static struct dll_redirect* add_dll_redirect(struct assembly* assembly) { + DPRINT1("add_dll_redirect() to assembly %p, num_dlls %d\n", assembly, assembly->allocated_dlls); if (assembly->num_dlls == assembly->allocated_dlls) { void *ptr; @@ -3119,7 +3122,7 @@ struct dllredirect_data *data; struct string_index *index; ULONG name_offset; - +DPRINT1("actctx %p, num_assemblies %d\n", actctx, actctx->num_assemblies); /* compute section length */ for (i = 0; i < actctx->num_assemblies; i++) { @@ -3132,6 +3135,7 @@ total_len += sizeof(*index); total_len += sizeof(*data); total_len += aligned_string_len((strlenW(dll->name)+1)*sizeof(WCHAR)); + DPRINT1("assembly %d, dll %d: dll name %S\n", i, j, dll->name); } dll_count += assembly->num_dlls; @@ -3153,12 +3157,13 @@ for (i = 0; i < actctx->num_assemblies; i++) { struct assembly *assembly = &actctx->assemblies[i]; + DPRINT1("assembly->num_dlls %d\n", assembly->num_dlls); for (j = 0; j < assembly->num_dlls; j++) { struct dll_redirect *dll = &assembly->dlls[j]; UNICODE_STRING str; WCHAR *ptrW; - + DPRINT1("%d: dll name %S\n", j, dll->name); /* setup new index entry */ str.Buffer = dll->name; str.Length = strlenW(dll->name)*sizeof(WCHAR); @@ -3198,12 +3203,14 @@ { struct string_index *iter, *index = NULL; ULONG hash = 0, i; - +DPRINT1("section %p, name %wZ\n", section, name); RtlHashUnicodeString(name, TRUE, HASH_STRING_ALGORITHM_X65599, &hash); iter = (struct string_index*)((BYTE*)section + section->index_offset); for (i = 0; i < section->count; i++) { + DPRINT1("iter->hash 0x%x ?= 0x%x\n", iter->hash, hash); + DPRINT1("iter->name %S\n", (WCHAR*)((BYTE*)section + iter->name_offset)); if (iter->hash == hash) { const WCHAR *nameW = (WCHAR*)((BYTE*)section + iter->name_offset); @@ -3252,9 +3259,9 @@ { struct dllredirect_data *dll; struct string_index *index; - +DPRINT1("sections: 0x%08X\n", actctx->sections); if (!(actctx->sections & DLLREDIRECT_SECTION)) return STATUS_SXS_KEY_NOT_FOUND; - +DPRINT1("actctx->dllredirect_section: %p\n", actctx->dllredirect_section); if (!actctx->dllredirect_section) { struct strsection_header *section; @@ -3267,6 +3274,7 @@ } index = find_string_index(actctx->dllredirect_section, name); +DPRINT1("index: %d\n", index); if (!index) return STATUS_SXS_KEY_NOT_FOUND; dll = get_dllredirect_data(actctx, index); @@ -5275,28 +5283,36 @@ { PACTCTX_SECTION_KEYED_DATA data = ptr; NTSTATUS status; - +DPRINT1("RtlFindActivationContextSectionString(%x %p %x %wZ %p)\n", flags, guid, section_kind, section_name, ptr); status = RtlpFindActivationContextSection_CheckParameters(flags, guid, section_kind, section_name, data); - if (!NT_SUCCESS(status)) return status; + if (!NT_SUCCESS(status)) + { + DPRINT1("RtlFindActivationContextSectionString() failed with status %x\n", status); + return status; + } status = STATUS_SXS_KEY_NOT_FOUND; /* if there is no data, but params are valid, we return that sxs key is not found to be at least somehow compatible */ - if (!data) return status; + if (!data) + { + DPRINT1("RtlFindActivationContextSectionString() failed with status %x\n", status); + return status; + } ASSERT(NtCurrentTeb()); ASSERT(NtCurrentTeb()->ActivationContextStackPointer); - + DPRINT1("ActiveFrame: %p\n",NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame); if (NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame) { ACTIVATION_CONTEXT *actctx = check_actctx(NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame->ActivationContext); if (actctx) status = find_string( actctx, section_kind, section_name, flags, data ); } - + DPRINT1("status %x\n", status); if (status != STATUS_SUCCESS) status = find_string( process_actctx, section_kind, section_name, flags, data ); - + DPRINT1("RtlFindActivationContextSectionString() returns status %x\n", status); return status; } @@ -5421,8 +5437,12 @@ frame->Flags = 0; NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame = frame; + //RtlAddRefActivationContext( handle ); + DPRINT1("Activated actctx sp %p, active frame %p\n", NtCurrentTeb()->ActivationContextStackPointer, frame); + //if (frame == (PVOID)0x00B6F70C) DbgBreakPoint(); return STATUS_SUCCESS; + #endif } @@ -5442,7 +5462,7 @@ DPRINT1("No top frame!\n"); RtlRaiseStatus( STATUS_SXS_INVALID_DEACTIVATION ); } - + DPRINT1("Deactivated actctx %p, active frame %p, new active frame %p\n", NtCurrentTeb()->ActivationContextStackPointer, frame, frame->Previous); /* pop everything up to and including frame */ NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame = frame->Previous;