From 63c8a3b56009f76090b91253e273f0300e7dd4d9 Mon Sep 17 00:00:00 2001 From: Alexander Morozov Date: Tue, 10 Aug 2010 19:43:12 +0400 Subject: [PATCH] ntdll: Fix a problem with starting Garant 7.5.0 (eterbug #5864). --- dlls/ntdll/loader.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 6fb81241c3..4432164dd6 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -100,7 +100,7 @@ static struct builtin_load_info *builtin_load_info = &default_load_info; static HANDLE main_exe_file; static UINT tls_module_count; /* number of modules with TLS directory */ static UINT tls_total_size; /* total size of TLS storage */ -static const IMAGE_TLS_DIRECTORY **tls_dirs; /* array of TLS directories */ +static IMAGE_TLS_DIRECTORY *tls_dirs; /* array of TLS directories */ static RTL_CRITICAL_SECTION loader_section; static RTL_CRITICAL_SECTION_DEBUG critsect_debug = @@ -854,7 +854,8 @@ static NTSTATUS alloc_process_tls(void) TRACE( "count %u size %u\n", tls_module_count, tls_total_size ); - tls_dirs = RtlAllocateHeap( GetProcessHeap(), 0, tls_module_count * sizeof(*tls_dirs) ); + tls_dirs = RtlAllocateHeap( GetProcessHeap(), 0, tls_module_count * + sizeof(IMAGE_TLS_DIRECTORY) ); if (!tls_dirs) return STATUS_NO_MEMORY; for (i = 0, entry = mark->Flink; entry != mark; entry = entry->Flink) @@ -863,8 +864,8 @@ static NTSTATUS alloc_process_tls(void) if (!(dir = RtlImageDirectoryEntryToData( mod->BaseAddress, TRUE, IMAGE_DIRECTORY_ENTRY_TLS, &size ))) continue; - tls_dirs[i] = dir; *(DWORD *)dir->AddressOfIndex = i; + memcpy( &tls_dirs[i], dir, sizeof(IMAGE_TLS_DIRECTORY) ); mod->TlsIndex = i; mod->LoadCount = -1; /* can't unload it */ i++; @@ -898,7 +899,7 @@ static NTSTATUS alloc_thread_tls(void) for (i = 0; i < tls_module_count; i++) { - const IMAGE_TLS_DIRECTORY *dir = tls_dirs[i]; + const IMAGE_TLS_DIRECTORY *dir = &tls_dirs[i]; ULONG size = dir->EndAddressOfRawData - dir->StartAddressOfRawData; TRACE( "thread %04x idx %d: %d/%d bytes from %p to %p\n", -- 2.33.8