diff --git a/dlls/krnl386.exe16/selector.c b/dlls/krnl386.exe16/selector.c index ab5881c8927..7d2984cf777 100644 --- a/dlls/krnl386.exe16/selector.c +++ b/dlls/krnl386.exe16/selector.c @@ -68,12 +68,10 @@ static LDT_ENTRY ldt_make_entry( const void *base, unsigned int limit, unsigned */ void init_selectors(void) { - const struct ldt_copy **ldt_copy_ptr; if (!is_gdt_sel( get_gs() )) first_ldt_entry += 512; if (!is_gdt_sel( get_fs() )) first_ldt_entry += 512; RtlSetBits( &ldt_bitmap, 0, first_ldt_entry ); - ldt_copy_ptr = (void *)GetProcAddress( GetModuleHandleA("ntdll.dll"), "__wine_ldt_copy" ); - if (ldt_copy_ptr) ldt_copy = *ldt_copy_ptr; + NtQueryInformationProcess( GetCurrentProcess(), ProcessWineLdtCopy, &ldt_copy, sizeof(ldt_copy), NULL ); } /*********************************************************************** diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 7a5a5afdb6b..1d4218e7b52 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1694,7 +1694,6 @@ @ stdcall -syscall __wine_unix_spawnvp(long ptr) @ stdcall __wine_ctrl_routine(ptr) @ extern __wine_syscall_dispatcher -@ extern -arch=i386 __wine_ldt_copy @ extern -arch=arm64 __wine_current_teb # Debugging diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index c8e1b495ac0..90198697051 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -59,8 +59,6 @@ static inline struct x86_thread_data *x86_thread_data(void) return (struct x86_thread_data *)&NtCurrentTeb()->GdiTebBatch; } -struct ldt_copy *__wine_ldt_copy = NULL; - /* Exception record for handling exceptions happening inside exception handlers */ typedef struct { diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 35f2e5f986f..8a6200c7454 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1062,13 +1062,6 @@ static void load_ntdll_functions( HMODULE module ) GET_FUNC( RtlUserThreadStart ); GET_FUNC( __wine_ctrl_routine ); GET_FUNC( __wine_syscall_dispatcher ); -#ifdef __i386__ - { - void **p__wine_ldt_copy; - GET_FUNC( __wine_ldt_copy ); - *p__wine_ldt_copy = &__wine_ldt_copy; - } -#endif #ifdef __aarch64__ { void **p__wine_current_teb; diff --git a/dlls/ntdll/unix/process.c b/dlls/ntdll/unix/process.c index 83888717a5c..503ef93d966 100644 --- a/dlls/ntdll/unix/process.c +++ b/dlls/ntdll/unix/process.c @@ -1500,6 +1500,20 @@ NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class else ret = STATUS_INFO_LENGTH_MISMATCH; break; + case ProcessWineLdtCopy: + if (handle == NtCurrentProcess()) + { +#ifdef __i386__ + len = sizeof(struct ldt_copy *); + if (size == len) *(struct ldt_copy **)info = &__wine_ldt_copy; + else ret = STATUS_INFO_LENGTH_MISMATCH; +#else + ret = STATUS_NOT_IMPLEMENTED; +#endif + } + else ret = STATUS_INVALID_PARAMETER; + break; + default: FIXME("(%p,info_class=%d,%p,0x%08x,%p) Unknown information class\n", handle, class, info, size, ret_len ); diff --git a/dlls/wow64/process.c b/dlls/wow64/process.c index a810d5e5543..46bd6bfec36 100644 --- a/dlls/wow64/process.c +++ b/dlls/wow64/process.c @@ -846,6 +846,9 @@ NTSTATUS WINAPI wow64_NtQueryInformationProcess( UINT *args ) if (retlen) *retlen = sizeof(SECTION_IMAGE_INFORMATION32); return STATUS_INFO_LENGTH_MISMATCH; + case ProcessWineLdtCopy: + return STATUS_NOT_IMPLEMENTED; + default: FIXME( "unsupported class %u\n", class ); return STATUS_INVALID_INFO_CLASS; diff --git a/include/winternl.h b/include/winternl.h index 26e61463f35..54c8903c534 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -1577,6 +1577,7 @@ typedef enum _PROCESSINFOCLASS { MaxProcessInfoClass, #ifdef __WINESRC__ ProcessWineMakeProcessSystem = 1000, + ProcessWineLdtCopy, #endif } PROCESSINFOCLASS, PROCESS_INFORMATION_CLASS;