Fix hacks from last night and properly share the code
authorAlex Ionescu <aionescu@gmail.com>
Wed, 19 Jan 2005 01:11:43 +0000 (01:11 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Wed, 19 Jan 2005 01:11:43 +0000 (01:11 +0000)
svn path=/trunk/; revision=13128

reactos/lib/ntdll/rtl/ppb.c
reactos/lib/ntdll/rtl/process.c
reactos/lib/rtl/env.c
reactos/ntoskrnl/rtl/libsupp.c

index 6db2749..d05a963 100644 (file)
 
 /* 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,
index 78d7271..36f2071 100644 (file)
@@ -48,6 +48,13 @@ static NTSTATUS RtlpCreateFirstThread
  );
 }
 
+PPEB
+STDCALL
+RtlpCurrentPeb(VOID)
+{
+    return NtCurrentPeb();
+}
+
 static NTSTATUS
 RtlpMapFile(PUNICODE_STRING ImageFileName,
             PRTL_USER_PROCESS_PARAMETERS Ppb,
index 4b91775..b12b718 100644 (file)
 #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
  */
@@ -533,12 +512,11 @@ RtlQueryEnvironmentVariable_U(PWSTR Environment,
 
    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)
index c84c112..01926e1 100644 (file)
@@ -11,6 +11,7 @@
 /* INCLUDES ******************************************************************/
 
 #include <ntoskrnl.h>
+#include <internal/ps.h>
 #define NDEBUG
 #include <internal/debug.h>
 
 
 /* FUNCTIONS *****************************************************************/
 
+/*
+ * @implemented
+ */
+VOID STDCALL
+RtlAcquirePebLock(VOID)
+{
+
+}
+
+/*
+ * @implemented
+ */
+VOID STDCALL
+RtlReleasePebLock(VOID)
+{
+
+}
+
+PPEB
+STDCALL
+RtlpCurrentPeb(VOID)
+{
+    return ((PEPROCESS)(KeGetCurrentThread()->ApcState.Process))->Peb;
+}
+
 NTSTATUS 
 STDCALL
 RtlDeleteCriticalSection(