http://bugs.winehq.org/show_bug.cgi?id=27708
Summary: GetThreadSelectorEntry fails Product: Wine Version: 1.2.2 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: ntdll AssignedTo: wine-bugs@winehq.org ReportedBy: nitsuja-@hotmail.com
Created an attachment (id=35459) --> (http://bugs.winehq.org/attachment.cgi?id=35459) binary (and source code) of the test case
When a program calls GetThreadSelectorEntry after creating a process, it fails in Wine (returns FALSE and sets lasterror to 5), but succeeds in Windows. This is a problem for a program I made which needs this function to work, so I've boiled it down to a tiny test case which still fails in the same way, and is attached. When run on Windows, this exe brings up a messagebox saying "ALL OK", but when run on Wine, it says "ERROR: GetThreadSelectorEntry failed". Here's the source code:
#define WIN32_LEAN_AND_MEAN #define _WIN32_WINNT 0x0500 #include <windows.h> void AssertSuccess(BOOL success, const char* errorMessage);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { // it doesn't matter which exe I start, so for this example I use the current exe path CHAR filename[MAX_PATH]; GetModuleFileName(NULL, filename, MAX_PATH); STARTUPINFO startupInfo = {sizeof(STARTUPINFO)}; PROCESS_INFORMATION processInfo = {}; BOOL success = CreateProcess(filename, NULL, NULL, NULL, FALSE, CREATE_SUSPENDED | DEBUG_PROCESS, NULL, NULL, &startupInfo, &processInfo); AssertSuccess(success, "ERROR: CreateProcess failed.\n"); HANDLE hThread = processInfo.hThread;
CONTEXT context; context.ContextFlags = CONTEXT_SEGMENTS; success = GetThreadContext(hThread, &context); AssertSuccess(success, "ERROR: GetThreadContext failed.\n");
LDT_ENTRY ldtEntry; success = GetThreadSelectorEntry(hThread, context.SegFs, &ldtEntry); AssertSuccess(success, "ERROR: GetThreadSelectorEntry failed.\n");
if(success) MessageBox(NULL, "ALL OK.", "DONE", MB_ICONASTERISK);
return success ? 0 : -1; }
void AssertSuccess(BOOL success, const char* errorMessage) { if(!success) MessageBox(NULL, errorMessage, "ERROR", MB_ICONERROR); }
http://bugs.winehq.org/show_bug.cgi?id=27708
nitsuja-@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, source, testcase
http://bugs.winehq.org/show_bug.cgi?id=27708
--- Comment #1 from André H. nerv@dawncrow.de 2011-07-06 12:13:49 CDT --- Created an attachment (id=35463) --> (http://bugs.winehq.org/attachment.cgi?id=35463) bad test for the wine testsuite
attached is a bad implemented test for our testsuite in case someone ones to pick it up.
http://bugs.winehq.org/show_bug.cgi?id=27708
--- Comment #2 from nitsuja-@hotmail.com 2011-07-08 01:35:10 CDT --- (In reply to comment #1)
attached is a bad implemented test for our testsuite in case someone ones to pick it up.
Thanks, although, I'm not sure it's OK to remove CREATE_SUSPENDED from the test case. Without that, won't the spawned process start doing who-knows-what (potentially spawning itself again or already exiting) while we're trying to query its information? Also, the actual program that this test code was derived from needs to use CREATE_SUSPENDED for other reasons (it wasn't added arbitrarily). As for DEBUG_PROCESS, the only reason for that was to guarantee that the spawned process will be terminated when the current process exits.
http://bugs.winehq.org/show_bug.cgi?id=27708
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1
--- Comment #3 from Austin English austinenglish@gmail.com 2013-09-18 17:09:22 CDT --- Still in wine-1.7.2-78-gfb96cb5
https://bugs.winehq.org/show_bug.cgi?id=27708
super_man@post.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |super_man@post.com
--- Comment #4 from super_man@post.com --- still fails and I get a crash too.
wine 1.7.51
https://bugs.winehq.org/show_bug.cgi?id=27708
zaplo00@mailfence.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |zaplo00@mailfence.com
--- Comment #5 from zaplo00@mailfence.com --- This works in wine-3.10, test program returns ALL OK.
https://bugs.winehq.org/show_bug.cgi?id=27708
Dmitry Timoshkov dmitry@baikal.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Fixed by SHA1| |d039d188f49d97b92694dbebcbb | |c72a8b30f29e0 Resolution|--- |FIXED
--- Comment #6 from Dmitry Timoshkov dmitry@baikal.ru --- The bug was fixed some time ago.
https://bugs.winehq.org/show_bug.cgi?id=27708
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #7 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 3.11.
https://bugs.winehq.org/show_bug.cgi?id=27708
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |pjb82@outlook.com
--- Comment #8 from Anastasius Focht focht@gmx.net --- *** Bug 40583 has been marked as a duplicate of this bug. ***