Fix hacks from last night and properly share the code
Modified: trunk/reactos/lib/ntdll/rtl/ppb.c
Modified: trunk/reactos/lib/ntdll/rtl/process.c
Modified: trunk/reactos/lib/rtl/env.c
Modified: trunk/reactos/ntoskrnl/rtl/libsupp.c

Modified: trunk/reactos/lib/ntdll/rtl/ppb.c
--- trunk/reactos/lib/ntdll/rtl/ppb.c	2005-01-18 22:47:16 UTC (rev 13127)
+++ trunk/reactos/lib/ntdll/rtl/ppb.c	2005-01-19 01:11:43 UTC (rev 13128)
@@ -30,6 +30,27 @@
 
 /* FUNCTIONS ****************************************************************/
 
+/*
+ * @implemented
+ */
+VOID STDCALL
+RtlAcquirePebLock(VOID)
+{
+   PPEB Peb = NtCurrentPeb ();
+   Peb->FastPebLockRoutine (Peb->FastPebLock);
+}
+
+
+/*
+ * @implemented
+ */
+VOID STDCALL
+RtlReleasePebLock(VOID)
+{
+   PPEB Peb = NtCurrentPeb ();
+   Peb->FastPebUnlockRoutine (Peb->FastPebLock);
+}
+
 static inline VOID
 RtlpCopyParameterString(PWCHAR *Ptr,
 			PUNICODE_STRING Destination,

Modified: trunk/reactos/lib/ntdll/rtl/process.c
--- trunk/reactos/lib/ntdll/rtl/process.c	2005-01-18 22:47:16 UTC (rev 13127)
+++ trunk/reactos/lib/ntdll/rtl/process.c	2005-01-19 01:11:43 UTC (rev 13128)
@@ -48,6 +48,13 @@
  );
 }
 
+PPEB
+STDCALL
+RtlpCurrentPeb(VOID)
+{
+    return NtCurrentPeb();
+}
+
 static NTSTATUS
 RtlpMapFile(PUNICODE_STRING ImageFileName,
             PRTL_USER_PROCESS_PARAMETERS Ppb,

Modified: trunk/reactos/lib/rtl/env.c
--- trunk/reactos/lib/rtl/env.c	2005-01-18 22:47:16 UTC (rev 13127)
+++ trunk/reactos/lib/rtl/env.c	2005-01-19 01:11:43 UTC (rev 13128)
@@ -20,33 +20,12 @@
 #define NDEBUG
 #include <ntdll/ntdll.h>
 
+PPEB STDCALL RtlpCurrentPeb(VOID);
 /* FUNCTIONS *****************************************************************/
 
-/* FIXME: Added here temporarly until I fix this properly tomorrow */
 /*
  * @implemented
  */
-VOID STDCALL
-RtlAcquirePebLock(VOID)
-{
-   PPEB Peb = NtCurrentPeb ();
-   Peb->FastPebLockRoutine (Peb->FastPebLock);
-}
-
-/* FIXME: Added here temporarly until I fix this properly tomorrow */
-/*
- * @implemented
- */
-VOID STDCALL
-RtlReleasePebLock(VOID)
-{
-   PPEB Peb = NtCurrentPeb ();
-   Peb->FastPebUnlockRoutine (Peb->FastPebLock);
-}
-
-/*
- * @implemented
- */
 NTSTATUS STDCALL
 RtlCreateEnvironment(BOOLEAN Inherit,
                      PWSTR *Environment)
@@ -533,12 +512,11 @@
 
    if (Environment == NULL)
    {
-      if (NtCurrentPeb() == NULL)
-      {
-         return(STATUS_VARIABLE_NOT_FOUND);
+      PPEB Peb = RtlpCurrentPeb();
+      if (Peb) {
+          Environment = Peb->ProcessParameters->Environment;
+          SysEnvUsed = TRUE;
       }
-      Environment = NtCurrentPeb()->ProcessParameters->Environment;
-      SysEnvUsed = TRUE;
    }
 
    if (Environment == NULL)

Modified: trunk/reactos/ntoskrnl/rtl/libsupp.c
--- trunk/reactos/ntoskrnl/rtl/libsupp.c	2005-01-18 22:47:16 UTC (rev 13127)
+++ trunk/reactos/ntoskrnl/rtl/libsupp.c	2005-01-19 01:11:43 UTC (rev 13128)
@@ -11,6 +11,7 @@
 /* INCLUDES ******************************************************************/
 
 #include <ntoskrnl.h>
+#include <internal/ps.h>
 #define NDEBUG
 #include <internal/debug.h>
 
@@ -19,6 +20,31 @@
 
 /* FUNCTIONS *****************************************************************/
 
+/*
+ * @implemented
+ */
+VOID STDCALL
+RtlAcquirePebLock(VOID)
+{
+
+}
+
+/*
+ * @implemented
+ */
+VOID STDCALL
+RtlReleasePebLock(VOID)
+{
+
+}
+
+PPEB
+STDCALL
+RtlpCurrentPeb(VOID)
+{
+    return ((PEPROCESS)(KeGetCurrentThread()->ApcState.Process))->Peb;
+}
+
 NTSTATUS 
 STDCALL
 RtlDeleteCriticalSection(