-/* $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,
ULONG Offset = 0;
ULONG Data;
+ if(!ResourceDataEntry)
+ return STATUS_RESOURCE_DATA_NOT_FOUND;
+
Data = (ULONG)RtlImageDirectoryEntryToData (BaseAddress,
TRUE,
IMAGE_DIRECTORY_ENTRY_RESOURCE,
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)
if (Resource)
{
- *Resource = (PVOID)(ResourceDataEntry->OffsetToData - Offset + (ULONG)BaseAddress);
+ *Resource = (PVOID)(ResourceDataEntry->OffsetToData - Offset + ((ULONG_PTR)BaseAddress & ~1));
}
if (Size)
}
+/*
+ * @implemented
+ */
NTSTATUS STDCALL
LdrFindResource_U(PVOID BaseAddress,
PLDR_RESOURCE_INFO ResourceInfo,
{
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;
}
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 */