CVS: winex/dlls/ntdll nt.c, 1.17, 1.18 ntdll.spec, 1.52, 1.53

[email protected] 12 Sep 2007 12:30:25 -0000
Newsgroups gmane.comp.emulators.winex.cvs
Message-ID <[email protected]>
Subject: winex/dlls/ntdll nt.c,1.17,1.18 ntdll.spec,1.52,1.53Update of /var/lib/cvsd/cvsroot/winex/dlls/ntdll
In directory agravaine:/tmp/cvs-serv10592/dlls/ntdll

Modified Files:
	nt.c ntdll.spec 
Log Message:

- added support for the ThreadBasicInformation query in NtQueryInformationThread().
- fixed the prototypes for NtQueryInformationThread() and ZwQueryInformationThread() in the .spec file



Index: nt.c
===================================================================
RCS file: /var/lib/cvsd/cvsroot/winex/dlls/ntdll/nt.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- nt.c	31 Jul 2007 19:41:18 -0000	1.17
+++ nt.c	12 Sep 2007 12:30:23 -0000	1.18
@@ -249,10 +249,90 @@
 	IN ULONG ThreadInformationLength,
 	OUT PULONG ReturnLength)
 {
-	FIXME("(0x%08x,0x%08x,%p,0x%08lx,%p),stub!\n",
-		ThreadHandle, ThreadInformationClass, ThreadInformation,
-		ThreadInformationLength, ReturnLength);
-	return 0;
+    NTSTATUS result;
+
+
+    FIXME("(0x%08x,0x%08x,%p,0x%08lx,%p), mostly-stub!\n",
+            ThreadHandle, ThreadInformationClass, ThreadInformation,
+            ThreadInformationLength, ReturnLength);
+
+
+    /* passing NULL for the buffer results in an access violation and <ReturnLength> unmodified */
+    if (ThreadInformation == NULL)
+        return STATUS_ACCESS_VIOLATION;
+
+
+    switch (ThreadInformationClass){
+        case ThreadBasicInformation:
+            TRACE("gathering basic thread information\n");
+
+            /* make sure the buffer is large enough to hold our results.  Native always
+               returns STATUS_INFO_LENGTH_MISMATCH if the buffer is too small. */
+            if (ThreadInformationLength < sizeof(THREAD_BASIC_INFORMATION))
+                return STATUS_INFO_LENGTH_MISMATCH;
+
+
+            /* ask the wine server for info about the requested thread */
+            SERVER_START_REQ(get_thread_info)
+            {
+                req->handle = ThreadHandle;
+                req->tid_in = 0;
+
+                result = wine_server_call(req);
+
+                if (result == STATUS_SUCCESS){
+                    THREAD_BASIC_INFORMATION *  tbi = (THREAD_BASIC_INFORMATION *)ThreadInformation;
+
+
+                    tbi->ExitStatus =                reply->exit_code;
+                    tbi->TebBaseAddress =            reply->teb;
+                    tbi->ClientId.UniqueProcess =    ((HANDLE)(ULONG_PTR) (reply->pid) );
+                    tbi->ClientId.UniqueThread =     ((HANDLE)(ULONG_PTR) (reply->tid) );
+                    tbi->AffinityMask =              reply->affinity;
+                    tbi->Priority =                  reply->priority;
+                    tbi->BasePriority =              reply->priority;   /* FIXME: this info is neither stored nor passed back! */
+
+                    /* set the number of bytes that was written to the output buffer */
+                    if (ReturnLength)
+                        *ReturnLength = sizeof(THREAD_BASIC_INFORMATION);
+                }
+            }
+            SERVER_END_REQ;
+
+
+            /* server call failed => make sure to return an error code.  This likely isn't the correct
+               error code, but windows doesn't have an analogue to this case so i'm guessing here. */
+            if (result != STATUS_SUCCESS)
+                return STATUS_NO_MEMORY;
+
+            break;
+
+        case ThreadTimes:
+        case ThreadPriority:
+        case ThreadBasePriority:
+        case ThreadAffinityMask:
+        case ThreadImpersonationToken:
+        case ThreadDescriptorTableEntry:
+        case ThreadEnableAlignmentFaultFixup:
+        case ThreadEventPair_Reusable:
+        case ThreadQuerySetWin32StartAddress:
+        case ThreadZeroTlsCell:
+        case ThreadPerformanceCount:
+        case ThreadAmILastThread:
+        case ThreadIdealProcessor:
+        case ThreadPriorityBoost:
+        case ThreadSetTlsArrayAddress:
+        case ThreadIsIoPending:
+        case MaxThreadInfoClass:
+            FIXME("implement me!! {ThreadInformationClass = 0x%08x}\n", ThreadInformationClass);
+            break;
+
+        default:
+            ERR("unknown information class! {ThreadInformationClass = 0x%08x}\n", ThreadInformationClass);
+            break;
+    }
+
+	return STATUS_SUCCESS;
 }
 
 /******************************************************************************

Index: ntdll.spec
===================================================================
RCS file: /var/lib/cvsd/cvsroot/winex/dlls/ntdll/ntdll.spec,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- ntdll.spec	12 Sep 2007 12:16:58 -0000	1.52
+++ ntdll.spec	12 Sep 2007 12:30:23 -0000	1.53
@@ -169,7 +169,7 @@
 @ stdcall NtQueryInformationFile(long long long long long) NtQueryInformationFile
 @ stub NtQueryInformationPort
 @ stdcall NtQueryInformationProcess(long long long long long) NtQueryInformationProcess
-@ stdcall NtQueryInformationThread (long long long long long) NtQueryInformationThread
+@ stdcall NtQueryInformationThread (long long ptr long ptr) NtQueryInformationThread
 @ stdcall NtQueryInformationToken (long long long long long) NtQueryInformationToken
 @ stub NtQueryIntervalProfile
 @ stub NtQueryIoCompletion
@@ -695,7 +695,7 @@
 @ stdcall ZwQueryInformationFile(long long long long long) NtQueryInformationFile
 @ stub ZwQueryInformationPort
 @ stdcall ZwQueryInformationProcess(long long long long long) NtQueryInformationProcess
-@ stdcall ZwQueryInformationThread(long long long long long) NtQueryInformationThread
+@ stdcall ZwQueryInformationThread(long long ptr long ptr) NtQueryInformationThread
 @ stdcall ZwQueryInformationToken(long long long long long) NtQueryInformationToken
 @ stub ZwQueryIntervalProfile
 @ stub ZwQueryIoCompletion