- Silence TCPIP.
[reactos.git] / reactos / ntoskrnl / ldr / resource.c
index e5be565..34c8201 100644 (file)
@@ -1,22 +1,24 @@
-/* $Id: resource.c,v 1.2 2002/09/07 15:12:58 chorns Exp $
- * 
+/* $Id$
+ *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ldr/resource.c
  * PURPOSE:         Resource loader
+ *
  * PROGRAMMERS:     Eric Kohl (ekohl@rz-online.de)
  */
 
 /* INCLUDES *****************************************************************/
 
 #include <ntoskrnl.h>
-
 #define NDEBUG
 #include <internal/debug.h>
 
-
 /* FUNCTIONS ****************************************************************/
 
+/*
+ * @implemented
+ */
 NTSTATUS STDCALL
 LdrAccessResource(IN  PVOID BaseAddress,
                   IN  PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry,
@@ -31,6 +33,9 @@ LdrAccessResource(IN  PVOID BaseAddress,
    ULONG Offset = 0;
    ULONG Data;
 
+   if(!ResourceDataEntry)
+        return STATUS_RESOURCE_DATA_NOT_FOUND;
+
    Data = (ULONG)RtlImageDirectoryEntryToData (BaseAddress,
                                               TRUE,
                                               IMAGE_DIRECTORY_ENTRY_RESOURCE,
@@ -38,10 +43,10 @@ LdrAccessResource(IN  PVOID BaseAddress,
    if (Data == 0)
        return STATUS_RESOURCE_DATA_NOT_FOUND;
 
-   if ((ULONG)BaseAddress & 1)
+   if ((ULONG_PTR)BaseAddress & 1)
      {
        /* loaded as ordinary file */
-       NtHeader = RtlImageNtHeader((PVOID)((ULONG)BaseAddress & ~1UL));
+       NtHeader = RtlImageNtHeader((PVOID)((ULONG_PTR)BaseAddress & ~1));
        Offset = (ULONG)BaseAddress - Data + NtHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress;
        Section = RtlImageRvaToSection (NtHeader, BaseAddress, NtHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress);
        if (Section == NULL)
@@ -59,7 +64,7 @@ LdrAccessResource(IN  PVOID BaseAddress,
 
    if (Resource)
      {
-       *Resource = (PVOID)(ResourceDataEntry->OffsetToData - Offset + (ULONG)BaseAddress);
+       *Resource = (PVOID)(ResourceDataEntry->OffsetToData - Offset + ((ULONG_PTR)BaseAddress & ~1));
      }
 
    if (Size)
@@ -71,6 +76,9 @@ LdrAccessResource(IN  PVOID BaseAddress,
 }
 
 
+/*
+ * @implemented
+ */
 NTSTATUS STDCALL
 LdrFindResource_U(PVOID BaseAddress,
                   PLDR_RESOURCE_INFO ResourceInfo,
@@ -121,7 +129,7 @@ LdrFindResource_U(PVOID BaseAddress,
                    {
                       ws = (PWCHAR)((ULONG)ResDir + (ResEntry->Name & 0x7FFFFFFF));
                       if (!wcsncmp((PWCHAR)Id, ws + 1, *ws ) &&
-                          wcslen((PWCHAR)Id) == (int)*ws )
+                          wcslen((PWCHAR)Id) == (ULONG)*ws )
                         {
                            goto found;
                         }
@@ -182,4 +190,39 @@ found:;
   return Status;
 }
 
+/* STUBS */
+
+/*
+ * @unimplemented
+ */
+NTSTATUS
+STDCALL
+LdrFindResourceDirectory_U(
+       IN PVOID        BaseAddress,
+       IN PLDR_RESOURCE_INFO                   ResourceInfo,
+       IN  ULONG                                               Level,
+       OUT PIMAGE_RESOURCE_DIRECTORY   *ResourceDirectory
+)
+{
+       UNIMPLEMENTED;
+       return STATUS_NOT_IMPLEMENTED;
+}
+
+/*
+ * @unimplemented
+ */
+NTSTATUS
+STDCALL
+LdrEnumResources(
+       IN PVOID        BaseAddress,
+       IN PLDR_RESOURCE_INFO                   ResourceInfo,
+       IN  ULONG                                               Level,
+       IN OUT PULONG                                   ResourceCount,
+       OUT PVOID                                               Resources  OPTIONAL
+)
+{
+       UNIMPLEMENTED;
+       return STATUS_NOT_IMPLEMENTED;
+}
+
 /* EOF */