Commit in reactos/lib/kernel32 on MAIN
file/move.c+1-91.15 -> 1.16
k32.h+21.14 -> 1.15
misc/console.c+158-11.85 -> 1.86
    /ldr.c+3-11.21 -> 1.22
    /stubs.c+1-371.100 -> 1.101
process/create.c+1-21.90 -> 1.91
thread/thread.c+1-21.59 -> 1.60
+167-52
7 modified files
implemented undocumented GetConsoleInputExeNameA/W() and SetConsoleInputExeNameA/W() used by NT's cmd.exe

reactos/lib/kernel32/file
move.c 1.15 -> 1.16
diff -u -r1.15 -r1.16
--- move.c	4 Dec 2004 15:38:22 -0000	1.15
+++ move.c	18 Dec 2004 13:26:57 -0000	1.16
@@ -1,4 +1,4 @@
-/* $Id: move.c,v 1.15 2004/12/04 15:38:22 hbirr Exp $
+/* $Id: move.c,v 1.16 2004/12/18 13:26:57 weiden Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -18,14 +18,6 @@
 
 /* GLOBALS *****************************************************************/
 
-#if defined(__GNUC__)
-void * alloca(size_t size);
-#elif defined(_MSC_VER)
-void* _alloca(size_t size);
-#else
-#error Unknown compiler for alloca intrinsic stack allocation "function"
-#endif
-
 /* FUNCTIONS ****************************************************************/
 
 static BOOL

reactos/lib/kernel32
k32.h 1.14 -> 1.15
diff -u -r1.14 -r1.15
--- k32.h	14 Dec 2004 22:15:52 -0000	1.14
+++ k32.h	18 Dec 2004 13:26:57 -0000	1.15
@@ -36,3 +36,5 @@
 #include <rosrtl/registry.h>
 
 #include "include/kernel32.h"
+
+#include <pseh/framebased.h>

reactos/lib/kernel32/misc
console.c 1.85 -> 1.86
diff -u -r1.85 -r1.86
--- console.c	18 Dec 2004 00:28:16 -0000	1.85
+++ console.c	18 Dec 2004 13:26:57 -0000	1.86
@@ -1,4 +1,4 @@
-/* $Id: console.c,v 1.85 2004/12/18 00:28:16 gdalsnes Exp $
+/* $Id: console.c,v 1.86 2004/12/18 13:26:57 weiden Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -31,6 +31,7 @@
 
 static PHANDLER_ROUTINE* CtrlHandlers = NULL;
 static ULONG NrCtrlHandlers = 0;
+static WCHAR InputExeName[MAX_PATH + 1] = L"";
 
 /* Default Console Control Handler *******************************************/
 
@@ -3412,4 +3413,160 @@
   return NT_SUCCESS(Status);
 }
 
+
+/*--------------------------------------------------------------
+ * 	SetConsoleInputExeNameW
+ *
+ * @implemented
+ */
+BOOL STDCALL
+SetConsoleInputExeNameW(LPCWSTR lpInputExeName)
+{
+  int lenName = lstrlenW(lpInputExeName);
+
+  if(lenName < 1 ||
+     lenName > (sizeof(InputExeName) / sizeof(InputExeName[0])) - 1)
+  {
+    /* Fail if string is empty or too long */
+    SetLastError(ERROR_INVALID_PARAMETER);
+    return FALSE;
+  }
+  
+  RtlEnterCriticalSection(&ConsoleLock);
+  RtlCopyMemory(InputExeName, lpInputExeName, lenName * sizeof(WCHAR));
+  InputExeName[lenName] = L'\0';
+  RtlLeaveCriticalSection(&ConsoleLock);
+  
+  return TRUE;
+}
+
+
+/*--------------------------------------------------------------
+ * 	SetConsoleInputExeNameA
+ *
+ * @implemented
+ */
+BOOL STDCALL
+SetConsoleInputExeNameA(LPCSTR lpInputExeName)
+{
+  ANSI_STRING InputExeNameA;
+  UNICODE_STRING InputExeNameU;
+  NTSTATUS Status;
+  BOOL Ret;
+  
+  RtlInitAnsiString(&InputExeNameA, lpInputExeName);
+  
+  if(InputExeNameA.Length < sizeof(InputExeNameA.Buffer[0]) ||
+     InputExeNameA.Length >= (sizeof(InputExeName) / sizeof(InputExeName[0])) - 1)
+  {
+    /* Fail if string is empty or too long */
+    SetLastError(ERROR_INVALID_PARAMETER);
+    return FALSE;
+  }
+  
+  Status = RtlAnsiStringToUnicodeString(&InputExeNameU, &InputExeNameA, TRUE);
+  if(NT_SUCCESS(Status))
+  {
+    Ret = SetConsoleInputExeNameW(InputExeNameU.Buffer);
+    RtlFreeUnicodeString(&InputExeNameU);
+  }
+  else
+  {
+    SetLastErrorByStatus(Status);
+    Ret = FALSE;
+  }
+
+  return Ret;
+}
+
+
+/*--------------------------------------------------------------
+ * 	GetConsoleInputExeNameW
+ *
+ * @implemented
+ */
+DWORD STDCALL
+GetConsoleInputExeNameW(DWORD nBufferLength, LPWSTR lpBuffer)
+{
+  int lenName;
+
+  RtlEnterCriticalSection(&ConsoleLock);
+
+  lenName = lstrlenW(InputExeName);
+  if(lenName >= nBufferLength)
+  {
+    /* buffer is not large enough, return the required size */
+    RtlLeaveCriticalSection(&ConsoleLock);
+    return lenName + 1;
+  }
+
+  /* wrap copying into SEH as we may copy to invalid buffer and in case of an
+     exception the console lock would've never been released, which would cause
+     further calls (if the exception was handled by the caller) to recursively
+     acquire the lock... */
+  _SEH_TRY
+  {
+    RtlCopyMemory(lpBuffer, InputExeName, (lenName + 1) * sizeof(WCHAR));
+  }
+  _SEH_HANDLE
+  {
+    lenName = 0;
+    SetLastErrorByStatus(_SEH_GetExceptionCode());
+  }
+  _SEH_END;
+  
+  RtlLeaveCriticalSection(&ConsoleLock);
+
+  return lenName;
+}
+
+
+/*--------------------------------------------------------------
+ * 	GetConsoleInputExeNameA
+ *
+ * @implemented
+ */
+DWORD STDCALL
+GetConsoleInputExeNameA(DWORD nBufferLength, LPSTR lpBuffer)
+{
+  WCHAR *Buffer;
+  DWORD Ret;
+  
+  if(nBufferLength > 0)
+  {
+    Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, nBufferLength * sizeof(WCHAR));
+    if(Buffer == NULL)
+    {
+      SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+      return 0;
+    }
+  }
+  else
+  {
+    Buffer = NULL;
+  }
+  
+  Ret = GetConsoleInputExeNameW(nBufferLength, Buffer);
+  if(nBufferLength > 0)
+  {
+    if(Ret > 0)
+    {
+      UNICODE_STRING BufferU;
+      ANSI_STRING BufferA;
+      
+      RtlInitUnicodeString(&BufferU, Buffer);
+
+      BufferA.Length = 0;
+      BufferA.MaximumLength = nBufferLength;
+      BufferA.Buffer = lpBuffer;
+      
+      RtlUnicodeStringToAnsiString(&BufferA, &BufferU, FALSE);
+    }
+    
+    RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
+  }
+  
+  return Ret;
+}
+
 /* EOF */

reactos/lib/kernel32/misc
ldr.c 1.21 -> 1.22
diff -u -r1.21 -r1.22
--- ldr.c	13 Jun 2004 20:04:56 -0000	1.21
+++ ldr.c	18 Dec 2004 13:26:57 -0000	1.22
@@ -1,4 +1,4 @@
-/* $Id: ldr.c,v 1.21 2004/06/13 20:04:56 navaraf Exp $
+/* $Id: ldr.c,v 1.22 2004/12/18 13:26:57 weiden Exp $
  *
  * COPYRIGHT: See COPYING in the top level directory
  * PROJECT  : ReactOS user mode libraries
@@ -72,6 +72,8 @@
 	NTSTATUS Status;
 
         (void)hFile;
+        
+        DbgPrint("LoadLibraryExA: 0x%x (=%s) 0x%x, 0x%x\n", lpLibFileName, lpLibFileName ? lpLibFileName : "NULL", hFile, dwFlags);
 
 	RtlInitAnsiString (&LibFileName,
 	                   (LPSTR)lpLibFileName);

reactos/lib/kernel32/misc
stubs.c 1.100 -> 1.101
diff -u -r1.100 -r1.101
--- stubs.c	9 Dec 2004 19:11:07 -0000	1.100
+++ stubs.c	18 Dec 2004 13:26:57 -0000	1.101
@@ -1,4 +1,4 @@
-/* $Id: stubs.c,v 1.100 2004/12/09 19:11:07 weiden Exp $
+/* $Id: stubs.c,v 1.101 2004/12/18 13:26:57 weiden Exp $
  *
  * KERNEL32.DLL stubs (STUB functions)
  * Remove from this file, if you implement them.
@@ -1673,24 +1673,6 @@
 /*
  * @unimplemented
  */
-BOOL STDCALL SetConsoleInputExeNameA(LPCSTR name)
-{
-    STUB;
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL STDCALL SetConsoleInputExeNameW(LPCWSTR name)
-{
-    STUB;
-    return 0;
-}
-
-/*
- * @unimplemented
- */
 BOOL STDCALL UTRegister( HMODULE hModule, LPSTR lpsz16BITDLL,
                         LPSTR lpszInitName, LPSTR lpszProcName,
                         FARPROC *ppfn32Thunk, FARPROC pfnUT32CallBack,
@@ -1733,24 +1715,6 @@
 /*
  * @unimplemented
  */
-BOOL STDCALL GetConsoleInputExeNameA(ULONG length,LPCSTR name)
-{
-    STUB;
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL STDCALL GetConsoleInputExeNameW(ULONG length,LPCWSTR name)
-{
-    STUB;
-    return 0;
-}
-
-/*
- * @unimplemented
- */
 BOOL STDCALL IsValidUILanguage(LANGID langid)
 {
     STUB;

reactos/lib/kernel32/process
create.c 1.90 -> 1.91
diff -u -r1.90 -r1.91
--- create.c	13 Dec 2004 13:32:24 -0000	1.90
+++ create.c	18 Dec 2004 13:26:57 -0000	1.91
@@ -1,4 +1,4 @@
-/* $Id: create.c,v 1.90 2004/12/13 13:32:24 navaraf Exp $
+/* $Id: create.c,v 1.91 2004/12/18 13:26:57 weiden Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -12,7 +12,6 @@
 /* INCLUDES ****************************************************************/
 
 #include <k32.h>
-#include <pseh/framebased.h>
 
 #define NDEBUG
 #include "../include/debug.h"

reactos/lib/kernel32/thread
thread.c 1.59 -> 1.60
diff -u -r1.59 -r1.60
--- thread.c	13 Dec 2004 13:32:24 -0000	1.59
+++ thread.c	18 Dec 2004 13:26:57 -0000	1.60
@@ -1,4 +1,4 @@
-/* $Id: thread.c,v 1.59 2004/12/13 13:32:24 navaraf Exp $
+/* $Id: thread.c,v 1.60 2004/12/18 13:26:57 weiden Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -14,7 +14,6 @@
 /* INCLUDES ******************************************************************/
 
 #include <k32.h>
-#include <pseh/framebased.h>
 
 #define NDEBUG
 #include "../include/debug.h"
CVSspam 0.2.8