update for HEAD-2002110701
[reactos.git] / lib / kernel32 / process / create.c
index 9abb98f..34748ee 100644 (file)
@@ -167,20 +167,22 @@ CreateProcessA (LPCSTR                    lpApplicationName,
        return Result;
 }
 
+struct _CONTEXT;
+struct __EXCEPTION_RECORD;
+
+static
+EXCEPTION_DISPOSITION
+__cdecl
+_except_handler(
+    struct _EXCEPTION_RECORD *ExceptionRecord,
+    void * EstablisherFrame,
+    struct _CONTEXT *ContextRecord,
+    void * DispatcherContext )
+{
+       DPRINT("Process terminated abnormally...\n");
 
-static\r
-EXCEPTION_DISPOSITION\r
-__cdecl\r
-_except_handler(\r
-    struct _EXCEPTION_RECORD *ExceptionRecord,\r
-    void * EstablisherFrame,\r
-    struct _CONTEXT *ContextRecord,\r
-    void * DispatcherContext )\r
-{\r
-       DPRINT("Process terminated abnormally...\n");\r
-\r
-       if (/* FIXME: */ TRUE) /* Not a service */\r
-       {\r
+       if (/* FIXME: */ TRUE) /* Not a service */
+       {
                ExitProcess(0);
        }
        else
@@ -190,17 +192,17 @@ _except_handler(
 
        /* We should not get to here */
        return ExceptionContinueSearch;
-}\r
+}
 
 VOID STDCALL
 BaseProcessStart(LPTHREAD_START_ROUTINE lpStartAddress,
-                                DWORD lpParameter)
+                DWORD lpParameter)
 {
        UINT uExitCode = 0;
 
        __try1(_except_handler)
        {
-               uExitCode = (lpStartAddress)(lpParameter);
+               uExitCode = (lpStartAddress)((PVOID)lpParameter);
        } __except1
        {
        }
@@ -520,7 +522,7 @@ KlInitPeb (HANDLE ProcessHandle,
 
    /* create the PPB */
    PpbBase = NULL;
-   PpbSize = Ppb->AllocationSize;\r
+   PpbSize = Ppb->AllocationSize;
    Status = NtAllocateVirtualMemory(ProcessHandle,
                                    &PpbBase,
                                    0,
@@ -536,7 +538,7 @@ KlInitPeb (HANDLE ProcessHandle,
    NtWriteVirtualMemory(ProcessHandle,
                        PpbBase,
                        Ppb,
-                       Ppb->AllocationSize,\r
+                       Ppb->AllocationSize,
                        &BytesWritten);
 
    /* write pointer to environment */
@@ -658,7 +660,7 @@ CreateProcessW(LPCWSTR lpApplicationName,
       {
          s = TempApplicationNameW;
       }
-      s = wcsrchr(TempApplicationNameW, L'.');
+      s = wcsrchr(s, L'.');
       if (s == NULL)
         wcscat(TempApplicationNameW, L".exe");
    }
@@ -798,23 +800,23 @@ CreateProcessW(LPCWSTR lpApplicationName,
    /*
     * Translate some handles for the new process
     */
-   if (Ppb->CurrentDirectoryHandle)\r
+   if (Ppb->CurrentDirectoryHandle)
    {
       Status = NtDuplicateObject (NtCurrentProcess(), 
-                        Ppb->CurrentDirectoryHandle,\r
+                        Ppb->CurrentDirectoryHandle,
                         hProcess,
-                        &Ppb->CurrentDirectoryHandle,\r
+                        &Ppb->CurrentDirectoryHandle,
                         0,
                         TRUE,
                         DUPLICATE_SAME_ACCESS);
    }
 
-   if (Ppb->hConsole)\r
+   if (Ppb->hConsole)
    {
       Status = NtDuplicateObject (NtCurrentProcess(), 
-                        Ppb->hConsole,\r
+                        Ppb->hConsole,
                         hProcess,
-                        &Ppb->hConsole,\r
+                        &Ppb->hConsole,
                         0,
                         TRUE,
                         DUPLICATE_SAME_ACCESS);
@@ -862,31 +864,31 @@ CreateProcessW(LPCWSTR lpApplicationName,
      }
 
    // Set the child console handles 
-   Ppb->hStdInput = NtCurrentPeb()->ProcessParameters->hStdInput;\r
-   Ppb->hStdOutput = NtCurrentPeb()->ProcessParameters->hStdOutput;\r
-   Ppb->hStdError = NtCurrentPeb()->ProcessParameters->hStdError;\r
+   Ppb->hStdInput = NtCurrentPeb()->ProcessParameters->hStdInput;
+   Ppb->hStdOutput = NtCurrentPeb()->ProcessParameters->hStdOutput;
+   Ppb->hStdError = NtCurrentPeb()->ProcessParameters->hStdError;
 
    if (lpStartupInfo && (lpStartupInfo->dwFlags & STARTF_USESTDHANDLES))
    {
       if (lpStartupInfo->hStdInput)
-        Ppb->hStdInput = lpStartupInfo->hStdInput;\r
+        Ppb->hStdInput = lpStartupInfo->hStdInput;
       if (lpStartupInfo->hStdOutput)
-        Ppb->hStdOutput = lpStartupInfo->hStdOutput;\r
+        Ppb->hStdOutput = lpStartupInfo->hStdOutput;
       if (lpStartupInfo->hStdError)
-        Ppb->hStdError = lpStartupInfo->hStdError;\r
+        Ppb->hStdError = lpStartupInfo->hStdError;
    }
 
-   if (IsConsoleHandle(Ppb->hStdInput))\r
+   if (IsConsoleHandle(Ppb->hStdInput))
    {
-      Ppb->hStdInput = CsrReply.Data.CreateProcessReply.InputHandle;\r
+      Ppb->hStdInput = CsrReply.Data.CreateProcessReply.InputHandle;
    }
    else
    {
       DPRINT("Duplicate input handle\n");
       Status = NtDuplicateObject (NtCurrentProcess(), 
-                                 Ppb->hStdInput,\r
+                                 Ppb->hStdInput,
                                  hProcess,
-                                 &Ppb->hStdInput,\r
+                                 &Ppb->hStdInput,
                                  0,
                                  TRUE,
                                  DUPLICATE_SAME_ACCESS);
@@ -896,17 +898,17 @@ CreateProcessW(LPCWSTR lpApplicationName,
       }
    }
 
-   if (IsConsoleHandle(Ppb->hStdOutput))\r
+   if (IsConsoleHandle(Ppb->hStdOutput))
    {
-      Ppb->hStdOutput = CsrReply.Data.CreateProcessReply.OutputHandle;\r
+      Ppb->hStdOutput = CsrReply.Data.CreateProcessReply.OutputHandle;
    }
    else
    {
       DPRINT("Duplicate output handle\n");
       Status = NtDuplicateObject (NtCurrentProcess(), 
-                                 Ppb->hStdOutput,\r
+                                 Ppb->hStdOutput,
                                  hProcess,
-                                 &Ppb->hStdOutput,\r
+                                 &Ppb->hStdOutput,
                                  0,
                                  TRUE,
                                  DUPLICATE_SAME_ACCESS);
@@ -915,17 +917,17 @@ CreateProcessW(LPCWSTR lpApplicationName,
         DPRINT("NtDuplicateObject failed, status %x\n", Status);
       }
    }
-   if (IsConsoleHandle(Ppb->hStdError))\r
+   if (IsConsoleHandle(Ppb->hStdError))
    {
-      Ppb->hStdError = CsrReply.Data.CreateProcessReply.OutputHandle;\r
+      Ppb->hStdError = CsrReply.Data.CreateProcessReply.OutputHandle;
    }
    else
    {
       DPRINT("Duplicate error handle\n");
       Status = NtDuplicateObject (NtCurrentProcess(), 
-                                 Ppb->hStdError,\r
+                                 Ppb->hStdError,
                                  hProcess,
-                                 &Ppb->hStdError,\r
+                                 &Ppb->hStdError,
                                  0,
                                  TRUE,
                                  DUPLICATE_SAME_ACCESS);
@@ -940,20 +942,20 @@ CreateProcessW(LPCWSTR lpApplicationName,
     */
    if (lpStartupInfo)
      {
-       Ppb->dwFlags = lpStartupInfo->dwFlags;\r
-       if (Ppb->dwFlags & STARTF_USESHOWWINDOW)\r
+       Ppb->dwFlags = lpStartupInfo->dwFlags;
+       if (Ppb->dwFlags & STARTF_USESHOWWINDOW)
         {
-          Ppb->wShowWindow = lpStartupInfo->wShowWindow;\r
+          Ppb->wShowWindow = lpStartupInfo->wShowWindow;
         }
        else
         {
-          Ppb->wShowWindow = SW_SHOWDEFAULT;\r
+          Ppb->wShowWindow = SW_SHOWDEFAULT;
         }
-       Ppb->dwX = lpStartupInfo->dwX;\r
-       Ppb->dwY = lpStartupInfo->dwY;\r
-       Ppb->dwXSize = lpStartupInfo->dwXSize;\r
-       Ppb->dwYSize = lpStartupInfo->dwYSize;\r
-       Ppb->dwFillAttribute = lpStartupInfo->dwFillAttribute;\r
+       Ppb->dwX = lpStartupInfo->dwX;
+       Ppb->dwY = lpStartupInfo->dwY;
+       Ppb->dwXSize = lpStartupInfo->dwXSize;
+       Ppb->dwYSize = lpStartupInfo->dwYSize;
+       Ppb->dwFillAttribute = lpStartupInfo->dwFillAttribute;
      }
    else
      {