Silence GCC warnings.
[reactos.git] / reactos / dll / win32 / kernel32 / thread / thread.c
index 7ee17ca..746c693 100644 (file)
 #define HIGH_PRIORITY 31
 
 /* FUNCTIONS *****************************************************************/
-_SEH_FILTER(BaseThreadExceptionFilter)
+static
+LONG BaseThreadExceptionFilter(EXCEPTION_POINTERS * ExceptionInfo)
 {
-   EXCEPTION_POINTERS * ExceptionInfo = _SEH_GetExceptionPointers();
    LONG ExceptionDisposition = EXCEPTION_EXECUTE_HANDLER;
 
    if (GlobalTopLevelExceptionFilter != NULL)
    {
-      _SEH_TRY
+      _SEH2_TRY
       {
          ExceptionDisposition = GlobalTopLevelExceptionFilter(ExceptionInfo);
       }
-      _SEH_HANDLE
+      _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
       {
          ExceptionDisposition = UnhandledExceptionFilter(ExceptionInfo);
       }
-      _SEH_END;
+      _SEH2_END;
    }
 
    return ExceptionDisposition;
@@ -49,17 +49,17 @@ BaseThreadStartup(LPTHREAD_START_ROUTINE lpStartAddress,
     volatile UINT uExitCode = 0;
 
     /* Attempt to call the Thread Start Address */
-    _SEH_TRY
+    _SEH2_TRY
     {
         /* Get the exit code from the Thread Start */
         uExitCode = (lpStartAddress)((PVOID)lpParameter);
     }
-    _SEH_EXCEPT(BaseThreadExceptionFilter)
+    _SEH2_EXCEPT(BaseThreadExceptionFilter(_SEH2_GetExceptionInformation()))
     {
         /* Get the Exit code from the SEH Handler */
-        uExitCode = _SEH_GetExceptionCode();
-    } _SEH_END;
-   
+        uExitCode = _SEH2_GetExceptionCode();
+    } _SEH2_END;
+
     /* Exit the Thread */
     ExitThread(uExitCode);
 }
@@ -107,41 +107,41 @@ CreateRemoteThread(HANDLE hProcess,
     POBJECT_ATTRIBUTES ObjectAttributes;
     HANDLE hThread;
     ULONG Dummy;
-    
+
     DPRINT("CreateRemoteThread: hProcess: %ld dwStackSize: %ld lpStartAddress"
-            ": %p lpParameter: %lx, dwCreationFlags: %lx\n", hProcess, 
+            ": %p lpParameter: %lx, dwCreationFlags: %lx\n", hProcess,
             dwStackSize, lpStartAddress, lpParameter, dwCreationFlags);
-    
+
     /* Clear the Context */
     RtlZeroMemory(&Context, sizeof(CONTEXT));
-    
+
     /* Write PID */
     ClientId.UniqueProcess = hProcess;
-    
+
     /* Create the Stack */
     Status = BasepCreateStack(hProcess,
                               dwStackSize,
                               dwCreationFlags & STACK_SIZE_PARAM_IS_A_RESERVATION ?
                               dwStackSize : 0,
-                              &InitialTeb);    
+                              &InitialTeb);
     if(!NT_SUCCESS(Status))
     {
         SetLastErrorByStatus(Status);
         return NULL;
     }
-    
+
     /* Create Initial Context */
     BasepInitializeContext(&Context,
                            lpParameter,
                            lpStartAddress,
                            InitialTeb.StackBase,
                            1);
-    
+
     /* initialize the attributes for the thread object */
     ObjectAttributes = BasepConvertObjectAttributes(&LocalObjectAttributes,
                                                     lpThreadAttributes,
                                                     NULL);
-    
+
     /* Create the Kernel Thread Object */
     Status = NtCreateThread(&hThread,
                             THREAD_ALL_ACCESS,
@@ -157,7 +157,7 @@ CreateRemoteThread(HANDLE hProcess,
         SetLastErrorByStatus(Status);
         return NULL;
     }
-    
+
     #ifdef SXS_SUPPORT_ENABLED
     /* Are we in the same process? */
     if (Process = NtCurrentProcess())
@@ -167,21 +167,21 @@ CreateRemoteThread(HANDLE hProcess,
         PTHREAD_BASIC_INFORMATION ThreadBasicInfo;
         PACTIVATION_CONTEXT_BASIC_INFORMATION ActivationCtxInfo;
         ULONG_PTR Cookie;
-        
+
         /* Get the TEB */
         Status = NtQueryInformationThread(hThread,
                                           ThreadBasicIformation,
                                           &ThreadBasicInfo,
                                           sizeof(ThreadBasicInfo),
                                           NULL);
-                                          
+
         /* Allocate the Activation Context Stack */
         Status = RtlAllocateActivationContextStack(&ActivationContextStack);
         Teb = ThreadBasicInfo.TebBaseAddress;
-        
+
         /* Save it */
         Teb->ActivationContextStackPointer = ActivationContextStack;
-        
+
         /* Query the Context */
         Status = RtlQueryInformationActivationContext(1,
                                                       0,
@@ -190,7 +190,7 @@ CreateRemoteThread(HANDLE hProcess,
                                                       &ActivationCtxInfo,
                                                       sizeof(ActivationCtxInfo),
                                                       NULL);
-                                                      
+
         /* Does it need to be activated? */
         if (!ActivationCtxInfo.hActCtx)
         {
@@ -202,18 +202,18 @@ CreateRemoteThread(HANDLE hProcess,
         }
     }
     #endif
-    
+
     /* FIXME: Notify CSR */
 
     /* Success */
     if(lpThreadId) *lpThreadId = (DWORD)ClientId.UniqueThread;
-    
+
     /* Resume it if asked */
     if (!(dwCreationFlags & CREATE_SUSPENDED))
     {
         NtResumeThread(hThread, &Dummy);
     }
-    
+
     /* Return handle to thread */
     return hThread;
 }
@@ -227,7 +227,7 @@ ExitThread(DWORD uExitCode)
 {
     NTSTATUS Status;
     BOOLEAN LastThread;
-    
+
     /*
      * Terminate process if this is the last thread
      * of the current process
@@ -245,11 +245,11 @@ ExitThread(DWORD uExitCode)
 
     /* Notify DLLs and TLS Callbacks of termination */
     LdrShutdownThread();
-    
+
     /* Tell the Kernel to free the Stack */
     NtCurrentTeb()->FreeStackOnTermination = TRUE;
     NtTerminateThread(NULL, uExitCode);
-    
+
     /* We will never reach this place. This silences the compiler */
     ExitThread(uExitCode);
 }
@@ -532,7 +532,7 @@ WINAPI
 SetThreadPriority(HANDLE hThread,
                   int nPriority)
 {
-    ULONG Prio = nPriority;
+    LONG Prio = nPriority;
     NTSTATUS Status;
 
     /* Check if values forcing saturation should be used */
@@ -549,7 +549,7 @@ SetThreadPriority(HANDLE hThread,
     Status = NtSetInformationThread(hThread,
                                     ThreadBasePriority,
                                     &Prio,
-                                    sizeof(ULONG));
+                                    sizeof(LONG));
     if (!NT_SUCCESS(Status))
     {
         /* Failure */
@@ -973,7 +973,7 @@ RegisterWaitForSingleObjectEx(
 {
     NTSTATUS Status;
     HANDLE hNewWaitObject;
-    
+
     Status = RtlRegisterWait( &hNewWaitObject,
                                hObject,
                                Callback,