[KERNEL32] Initial implementation for BaseCheckRunApp, calling into apphelp to check...
[reactos.git] / reactos / dll / win32 / kernel32 / client / utils.c
index f82437f..e0654c9 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
- * FILE:            lib/kernel32/misc/utils.c
+ * FILE:            dll/win32/kernel32/client/utils.c
  * PURPOSE:         Utility and Support Functions
  * PROGRAMMER:      Alex Ionescu (alex@relsoft.net)
  *                  Pierre Schweitzer (pierre.schweitzer@reactos.org)
@@ -548,7 +548,7 @@ BaseInitializeContext(IN PCONTEXT Context,
 
         /* Is FPU state required? */
         Context->ContextFlags |= ContextFlags;
-        if (ContextFlags == CONTEXT_FLOATING_POINT)
+        if ((ContextFlags & CONTEXT_FLOATING_POINT) == CONTEXT_FLOATING_POINT)
         {
             /* Set an initial state */
             Context->FloatSave.ControlWord = 0x27F;
@@ -606,6 +606,33 @@ BaseInitializeContext(IN PCONTEXT Context,
 
     /* Give it some room for the Parameter */
     Context->Rsp -= sizeof(PVOID);
+#elif defined(_M_ARM)
+    DPRINT("BaseInitializeContext: %p\n", Context);
+
+    // FIXME: check if this is correct!
+    /* Setup the Initial Win32 Thread Context */
+    Context->R0 = (ULONG_PTR)StartAddress;
+    Context->R1 = (ULONG_PTR)Parameter;
+    Context->Sp = (ULONG_PTR)StackAddress;
+
+    if (ContextType == 1)      /* For Threads */
+    {
+        Context->Pc = (ULONG_PTR)BaseThreadStartupThunk;
+    }
+    else if (ContextType == 2) /* For Fibers */
+    {
+        Context->Pc = (ULONG_PTR)BaseFiberStartup;
+    }
+    else                       /* For first thread in a Process */
+    {
+        Context->Pc = (ULONG_PTR)BaseProcessStartThunk;
+    }
+
+    /* Set the Context Flags */
+    Context->ContextFlags = CONTEXT_FULL;
+
+    /* Give it some room for the Parameter */
+    Context->Sp -= sizeof(PVOID);
 #else
 #warning Unknown architecture
     UNIMPLEMENTED;
@@ -874,26 +901,6 @@ BaseMarkFileForDelete(IN HANDLE FileHandle,
                          FileDispositionInformation);
 }
 
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-BaseCheckRunApp(IN DWORD Unknown1,
-                IN DWORD Unknown2,
-                IN DWORD Unknown3,
-                IN DWORD Unknown4,
-                IN DWORD Unknown5,
-                IN DWORD Unknown6,
-                IN DWORD Unknown7,
-                IN DWORD Unknown8,
-                IN DWORD Unknown9,
-                IN DWORD Unknown10)
-{
-    STUB;
-    return FALSE;
-}
-
 /*
  * @unimplemented
  */
@@ -907,7 +914,7 @@ BasepCheckWinSaferRestrictions(IN HANDLE UserToken,
                                OUT PHANDLE JobHandle)
 {
     NTSTATUS Status;
-    
+
     /* Validate that there's a name */
     if ((ApplicationName) && *(ApplicationName))
     {
@@ -915,7 +922,7 @@ BasepCheckWinSaferRestrictions(IN HANDLE UserToken,
         if ((InJob) && (NewToken) && (JobHandle))
         {
             /* Do the work (one day...) */
-            UNIMPLEMENTED;
+            DPRINT("BasepCheckWinSaferRestrictions is UNIMPLEMENTED\n");
             Status = STATUS_SUCCESS;
         }
         else