Split out the resource functions for finer control of debug output.

svn path=/trunk/; revision=3832
This commit is contained in:
Robert Dickenson 2002-12-08 15:57:40 +00:00
parent 688e9b05d9
commit 61bb7ba7ad
9 changed files with 1407 additions and 1194 deletions

269
reactos/lib/ntdll/ldr/res.c Normal file
View file

@ -0,0 +1,269 @@
/* $Id: res.c,v 1.1 2002/12/08 15:57:40 robd Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: lib/ntdll/ldr/res.c
* PURPOSE: Resource access for PE executables
* PROGRAMMERS: Jean Michault
* Rex Jolliff (rex@lvcablemodem.com)
* Robert Dickenson (robd@mok.lvcm.com)
*/
/*
* TODO:
* - any comments ??
*/
/* INCLUDES *****************************************************************/
#include <reactos/config.h>
#include <ddk/ntddk.h>
#include <windows.h>
#include <string.h>
#include <wchar.h>
#include <ntdll/ldr.h>
#include <ntos/minmax.h>
//#define NDEBUG
#define DBG
#include <ntdll/ntdll.h>
/* PROTOTYPES ****************************************************************/
/* FUNCTIONS *****************************************************************/
/*
Status = LdrFindResource_U (hModule,
&ResourceInfo,
RESOURCE_DATA_LEVEL,
&ResourceDataEntry);
*/
NTSTATUS STDCALL
LdrFindResource_U(PVOID BaseAddress,
PLDR_RESOURCE_INFO ResourceInfo,
ULONG Level,
PIMAGE_RESOURCE_DATA_ENTRY* ResourceDataEntry)
{
PIMAGE_RESOURCE_DIRECTORY ResDir;
PIMAGE_RESOURCE_DIRECTORY ResBase;
PIMAGE_RESOURCE_DIRECTORY_ENTRY ResEntry;
NTSTATUS Status = STATUS_SUCCESS;
ULONG EntryCount;
PWCHAR ws;
ULONG i;
ULONG Id;
//DPRINT("LdrFindResource_U()\n");
DPRINT("LdrFindResource_U(%08x, %08x, %d, %08x)\n", BaseAddress, ResourceInfo, Level, ResourceDataEntry);
/* Get the pointer to the resource directory */
ResDir = (PIMAGE_RESOURCE_DIRECTORY)RtlImageDirectoryEntryToData(BaseAddress,
TRUE, IMAGE_DIRECTORY_ENTRY_RESOURCE, &i);
if (ResDir == NULL) {
return STATUS_RESOURCE_DATA_NOT_FOUND;
}
DPRINT("ResourceDirectory: %x Size: %d\n", (ULONG)ResDir, (int)i);
ResBase = ResDir;
/* Let's go into resource tree */
for (i = 0; i < Level; i++) {
DPRINT("ResDir: %x Level: %d\n", (ULONG)ResDir, i);
Id = ((PULONG)ResourceInfo)[i];
// ResourceInfo.Type = (ULONG)lpType;
// ResourceInfo.Name = (ULONG)lpName;
// ResourceInfo.Language = (ULONG)wLanguage;
EntryCount = ResDir->NumberOfNamedEntries;
DPRINT(" Id: %d NumberOfNamedEntries: %d\n", Id, EntryCount);
ResEntry = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)(ResDir + 1);
//DPRINT("ResEntry %x\n", (ULONG)ResEntry);
if (Id & 0xFFFF0000) {
/* Resource name is a unicode string */
DPRINT("ResEntry %x - Resource name is a unicode string\n", (ULONG)ResEntry);
DPRINT("EntryCount %d\n", (ULONG)EntryCount);
for (; EntryCount--; ResEntry++) {
/* Scan entries for equal name */
if (ResEntry->Name & 0x80000000) {
ws = (PWCHAR)((ULONG)ResDir + (ResEntry->Name & 0x7FFFFFFF));
if (!wcsncmp((PWCHAR)Id, ws + 1, *ws) &&
wcslen((PWCHAR)Id) == (int)*ws) {
goto found;
}
}
}
} else {
/* We use ID number instead of string */
DPRINT("ResEntry %x - Resource ID number instead of string\n", (ULONG)ResEntry);
DPRINT("EntryCount %d\n", (ULONG)EntryCount);
ResEntry += EntryCount;
EntryCount = ResDir->NumberOfIdEntries;
DPRINT("EntryCount %d\n", (ULONG)EntryCount);
for (; EntryCount--; ResEntry++) {
/* Scan entries for equal name */
DPRINT("EntryCount %d ResEntry %x\n", (ULONG)EntryCount, ResEntry);
DPRINT("ResEntry->Name %x Id %x\n", (ULONG)ResEntry->Name, Id);
if (ResEntry->Name == Id) {
DPRINT("ID entry found %x\n", Id);
goto found;
}
}
}
//DPRINT("Error %lu\n", i);
switch (i) {
case 0:
DPRINT("Error %lu - STATUS_RESOURCE_TYPE_NOT_FOUND\n", i);
return STATUS_RESOURCE_TYPE_NOT_FOUND;
case 1:
DPRINT("Error %lu - STATUS_RESOURCE_NAME_NOT_FOUND\n", i);
return STATUS_RESOURCE_NAME_NOT_FOUND;
case 2:
if (ResDir->NumberOfNamedEntries || ResDir->NumberOfIdEntries) {
/* Use the first available language */
ResEntry = (IMAGE_RESOURCE_DIRECTORY_ENTRY*)(ResDir + 1);
break;
}
DPRINT("Error %lu - STATUS_RESOURCE_LANG_NOT_FOUND\n", i);
return STATUS_RESOURCE_LANG_NOT_FOUND;
case 3:
DPRINT("Error %lu - STATUS_RESOURCE_DATA_NOT_FOUND\n", i);
return STATUS_RESOURCE_DATA_NOT_FOUND;
default:
DPRINT("Error %lu - STATUS_INVALID_PARAMETER\n", i);
return STATUS_INVALID_PARAMETER;
}
found:;
ResDir = (PIMAGE_RESOURCE_DIRECTORY)((ULONG)ResBase +
(ResEntry->OffsetToData & 0x7FFFFFFF));
}
DPRINT("ResourceDataEntry: %x\n", (ULONG)ResDir);
if (ResourceDataEntry) {
*ResourceDataEntry = (PVOID)ResDir;
}
return Status;
}
NTSTATUS STDCALL
LdrAccessResource(IN PVOID BaseAddress,
IN PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry,
OUT PVOID* Resource OPTIONAL,
OUT PULONG Size OPTIONAL)
{
PIMAGE_SECTION_HEADER Section;
PIMAGE_NT_HEADERS NtHeader;
ULONG SectionRva;
ULONG SectionVa;
ULONG DataSize;
ULONG Offset = 0;
ULONG Data;
Data = (ULONG)RtlImageDirectoryEntryToData(BaseAddress,
TRUE, IMAGE_DIRECTORY_ENTRY_RESOURCE, &DataSize);
if (Data == 0) {
return STATUS_RESOURCE_DATA_NOT_FOUND;
}
if ((ULONG)BaseAddress & 1) {
/* loaded as ordinary file */
NtHeader = RtlImageNtHeader((PVOID)((ULONG)BaseAddress & ~1UL));
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) {
return STATUS_RESOURCE_DATA_NOT_FOUND;
}
if (Section->Misc.VirtualSize < ResourceDataEntry->OffsetToData) {
SectionRva = RtlImageRvaToSection (NtHeader, BaseAddress, ResourceDataEntry->OffsetToData)->VirtualAddress;
SectionVa = RtlImageRvaToVa(NtHeader, BaseAddress, SectionRva, NULL);
Offset = SectionRva - SectionVa + Data - Section->VirtualAddress;
}
}
if (Resource) {
*Resource = (PVOID)(ResourceDataEntry->OffsetToData - Offset + (ULONG)BaseAddress);
}
if (Size) {
*Size = ResourceDataEntry->Size;
}
return STATUS_SUCCESS;
}
NTSTATUS STDCALL
LdrFindResourceDirectory_U(IN PVOID BaseAddress,
WCHAR** name,
DWORD level,
OUT PVOID* addr)
{
PIMAGE_RESOURCE_DIRECTORY ResDir;
PIMAGE_RESOURCE_DIRECTORY_ENTRY ResEntry;
ULONG EntryCount;
ULONG i;
NTSTATUS Status = STATUS_SUCCESS;
WCHAR* ws;
/* Get the pointer to the resource directory */
ResDir = (PIMAGE_RESOURCE_DIRECTORY)
RtlImageDirectoryEntryToData(BaseAddress, TRUE, IMAGE_DIRECTORY_ENTRY_RESOURCE, &i);
if (ResDir == NULL) {
return STATUS_RESOURCE_DATA_NOT_FOUND;
}
/* Let's go into resource tree */
for (i = 0; i < level; i++, name++) {
EntryCount = ResDir->NumberOfNamedEntries;
ResEntry = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)(ResDir + 1);
if ((ULONG)(*name) & 0xFFFF0000) {
/* Resource name is a unicode string */
for (; EntryCount--; ResEntry++) {
/* Scan entries for equal name */
if (ResEntry->Name & 0x80000000) {
ws = (WCHAR*)((ULONG)ResDir + (ResEntry->Name & 0x7FFFFFFF));
if (!wcsncmp(*name, ws + 1, *ws) && wcslen(*name) == (int)*ws) {
goto found;
}
}
}
} else {
/* We use ID number instead of string */
ResEntry += EntryCount;
EntryCount = ResDir->NumberOfIdEntries;
for (; EntryCount--; ResEntry++) {
/* Scan entries for equal name */
if (ResEntry->Name == (ULONG)(*name))
goto found;
}
}
switch (i) {
case 0:
return STATUS_RESOURCE_TYPE_NOT_FOUND;
case 1:
return STATUS_RESOURCE_NAME_NOT_FOUND;
case 2:
Status = STATUS_RESOURCE_LANG_NOT_FOUND;
/* Just use first language entry */
if (ResDir->NumberOfNamedEntries || ResDir->NumberOfIdEntries) {
ResEntry = (IMAGE_RESOURCE_DIRECTORY_ENTRY*)(ResDir + 1);
break;
}
return Status;
case 3:
return STATUS_RESOURCE_DATA_NOT_FOUND;
default:
return STATUS_INVALID_PARAMETER;
}
found:;
ResDir = (PIMAGE_RESOURCE_DIRECTORY)((ULONG)ResDir + ResEntry->OffsetToData);
}
if (addr) {
*addr = (PVOID)ResDir;
}
return Status;
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: startup.c,v 1.46 2002/11/15 22:06:01 ekohl Exp $ /* $Id: startup.c,v 1.47 2002/12/08 15:57:40 robd Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -64,20 +64,20 @@ LdrInitializeThunk (ULONG Unknown1,
RtlEnterCriticalSection (NtCurrentPeb()->LoaderLock); RtlEnterCriticalSection (NtCurrentPeb()->LoaderLock);
current_entry = current_entry =
NtCurrentPeb()->Ldr->InInitializationOrderModuleList.Flink; NtCurrentPeb()->Ldr->InInitializationOrderModuleList.Flink;
while (current_entry != while (current_entry !=
&NtCurrentPeb()->Ldr->InInitializationOrderModuleList) &NtCurrentPeb()->Ldr->InInitializationOrderModuleList)
{ {
current = CONTAINING_RECORD(current_entry, LDR_MODULE, current = CONTAINING_RECORD(current_entry, LDR_MODULE,
InInitializationOrderModuleList); InInitializationOrderModuleList);
Entrypoint = (PDLLMAIN_FUNC)current->EntryPoint; Entrypoint = (PDLLMAIN_FUNC)current->EntryPoint;
if (Entrypoint != NULL && if (Entrypoint != NULL &&
current->BaseAddress != NtCurrentPeb()->ImageBaseAddress) current->BaseAddress != NtCurrentPeb()->ImageBaseAddress)
{ {
(VOID)Entrypoint(current->BaseAddress, DLL_THREAD_ATTACH, NULL); (VOID)Entrypoint(current->BaseAddress, DLL_THREAD_ATTACH, NULL);
} }
current_entry = current_entry->Flink; current_entry = current_entry->Flink;
} }
RtlLeaveCriticalSection (NtCurrentPeb()->LoaderLock); RtlLeaveCriticalSection (NtCurrentPeb()->LoaderLock);
return; return;
} }
@ -88,8 +88,8 @@ LdrInitializeThunk (ULONG Unknown1,
DPRINT("ImageBase %x\n", ImageBase); DPRINT("ImageBase %x\n", ImageBase);
if (ImageBase <= (PVOID)0x1000) if (ImageBase <= (PVOID)0x1000)
{ {
DPRINT("ImageBase is null\n"); DPRINT("ImageBase is null\n");
ZwTerminateProcess(NtCurrentProcess(), STATUS_UNSUCCESSFUL); ZwTerminateProcess(NtCurrentProcess(), STATUS_UNSUCCESSFUL);
} }
NtGlobalFlag = Peb->NtGlobalFlag; NtGlobalFlag = Peb->NtGlobalFlag;
@ -101,8 +101,8 @@ LdrInitializeThunk (ULONG Unknown1,
PEDosHeader->e_lfanew == 0L || PEDosHeader->e_lfanew == 0L ||
*(PULONG)((PUCHAR)ImageBase + PEDosHeader->e_lfanew) != IMAGE_PE_MAGIC) *(PULONG)((PUCHAR)ImageBase + PEDosHeader->e_lfanew) != IMAGE_PE_MAGIC)
{ {
DbgPrint("Image has bad header\n"); DbgPrint("Image has bad header\n");
ZwTerminateProcess(NtCurrentProcess(), STATUS_UNSUCCESSFUL); ZwTerminateProcess(NtCurrentProcess(), STATUS_UNSUCCESSFUL);
} }
/* normalize process parameters */ /* normalize process parameters */
@ -122,15 +122,15 @@ LdrInitializeThunk (ULONG Unknown1,
/* create process heap */ /* create process heap */
RtlInitializeHeapManager(); RtlInitializeHeapManager();
Peb->ProcessHeap = RtlCreateHeap(HEAP_GROWABLE, Peb->ProcessHeap = RtlCreateHeap(HEAP_GROWABLE,
(PVOID)HEAP_BASE, (PVOID)HEAP_BASE,
NTHeaders->OptionalHeader.SizeOfHeapReserve, NTHeaders->OptionalHeader.SizeOfHeapReserve,
NTHeaders->OptionalHeader.SizeOfHeapCommit, NTHeaders->OptionalHeader.SizeOfHeapCommit,
NULL, NULL,
NULL); NULL);
if (Peb->ProcessHeap == 0) if (Peb->ProcessHeap == 0)
{ {
DbgPrint("Failed to create process heap\n"); DbgPrint("Failed to create process heap\n");
ZwTerminateProcess(NtCurrentProcess(),STATUS_UNSUCCESSFUL); ZwTerminateProcess(NtCurrentProcess(),STATUS_UNSUCCESSFUL);
} }
/* initalize peb lock support */ /* initalize peb lock support */
@ -141,16 +141,16 @@ LdrInitializeThunk (ULONG Unknown1,
/* initialize tls bitmap */ /* initialize tls bitmap */
RtlInitializeBitMap (&TlsBitMap, RtlInitializeBitMap (&TlsBitMap,
Peb->TlsBitmapBits, Peb->TlsBitmapBits,
TLS_MINIMUM_AVAILABLE); TLS_MINIMUM_AVAILABLE);
Peb->TlsBitmap = &TlsBitMap; Peb->TlsBitmap = &TlsBitMap;
Peb->TlsExpansionCounter = TLS_MINIMUM_AVAILABLE; Peb->TlsExpansionCounter = TLS_MINIMUM_AVAILABLE;
/* Initialize table of callbacks for the kernel. */ /* Initialize table of callbacks for the kernel. */
Peb->KernelCallbackTable = Peb->KernelCallbackTable =
RtlAllocateHeap(RtlGetProcessHeap(), RtlAllocateHeap(RtlGetProcessHeap(),
0, 0,
sizeof(PVOID) * USER32_CALLBACK_MAXIMUM); sizeof(PVOID) * USER32_CALLBACK_MAXIMUM);
/* initalize loader lock */ /* initalize loader lock */
RtlInitializeCriticalSection (&LoaderLock); RtlInitializeCriticalSection (&LoaderLock);
@ -158,12 +158,12 @@ LdrInitializeThunk (ULONG Unknown1,
/* create loader information */ /* create loader information */
Peb->Ldr = (PPEB_LDR_DATA)RtlAllocateHeap (Peb->ProcessHeap, Peb->Ldr = (PPEB_LDR_DATA)RtlAllocateHeap (Peb->ProcessHeap,
0, 0,
sizeof(PEB_LDR_DATA)); sizeof(PEB_LDR_DATA));
if (Peb->Ldr == NULL) if (Peb->Ldr == NULL)
{ {
DbgPrint("Failed to create loader data\n"); DbgPrint("Failed to create loader data\n");
ZwTerminateProcess(NtCurrentProcess(),STATUS_UNSUCCESSFUL); ZwTerminateProcess(NtCurrentProcess(),STATUS_UNSUCCESSFUL);
} }
Peb->Ldr->Length = sizeof(PEB_LDR_DATA); Peb->Ldr->Length = sizeof(PEB_LDR_DATA);
Peb->Ldr->Initialized = FALSE; Peb->Ldr->Initialized = FALSE;
@ -178,21 +178,21 @@ LdrInitializeThunk (ULONG Unknown1,
/* add entry for ntdll */ /* add entry for ntdll */
NtModule = (PLDR_MODULE)RtlAllocateHeap (Peb->ProcessHeap, NtModule = (PLDR_MODULE)RtlAllocateHeap (Peb->ProcessHeap,
0, 0,
sizeof(LDR_MODULE)); sizeof(LDR_MODULE));
if (NtModule == NULL) if (NtModule == NULL)
{ {
DbgPrint("Failed to create loader module entry (NTDLL)\n"); DbgPrint("Failed to create loader module entry (NTDLL)\n");
ZwTerminateProcess(NtCurrentProcess(),STATUS_UNSUCCESSFUL); ZwTerminateProcess(NtCurrentProcess(),STATUS_UNSUCCESSFUL);
} }
memset(NtModule, 0, sizeof(LDR_MODULE)); memset(NtModule, 0, sizeof(LDR_MODULE));
NtModule->BaseAddress = (PVOID)&_image_base__; NtModule->BaseAddress = (PVOID)&_image_base__;
NtModule->EntryPoint = 0; /* no entry point */ NtModule->EntryPoint = 0; /* no entry point */
RtlCreateUnicodeString (&NtModule->FullDllName, RtlCreateUnicodeString (&NtModule->FullDllName,
FullNtDllPath); FullNtDllPath);
RtlCreateUnicodeString (&NtModule->BaseDllName, RtlCreateUnicodeString (&NtModule->BaseDllName,
L"ntdll.dll"); L"ntdll.dll");
NtModule->Flags = 0; NtModule->Flags = 0;
NtModule->LoadCount = -1; /* don't unload */ NtModule->LoadCount = -1; /* don't unload */
NtModule->TlsIndex = 0; NtModule->TlsIndex = 0;
@ -204,9 +204,9 @@ LdrInitializeThunk (ULONG Unknown1,
NtModule->TimeDateStamp = NTHeaders->FileHeader.TimeDateStamp; NtModule->TimeDateStamp = NTHeaders->FileHeader.TimeDateStamp;
InsertTailList(&Peb->Ldr->InLoadOrderModuleList, InsertTailList(&Peb->Ldr->InLoadOrderModuleList,
&NtModule->InLoadOrderModuleList); &NtModule->InLoadOrderModuleList);
InsertTailList(&Peb->Ldr->InInitializationOrderModuleList, InsertTailList(&Peb->Ldr->InInitializationOrderModuleList,
&NtModule->InInitializationOrderModuleList); &NtModule->InInitializationOrderModuleList);
#ifdef DBG #ifdef DBG
@ -216,12 +216,12 @@ LdrInitializeThunk (ULONG Unknown1,
/* add entry for executable (becomes first list entry) */ /* add entry for executable (becomes first list entry) */
ExeModule = (PLDR_MODULE)RtlAllocateHeap (Peb->ProcessHeap, ExeModule = (PLDR_MODULE)RtlAllocateHeap (Peb->ProcessHeap,
0, 0,
sizeof(LDR_MODULE)); sizeof(LDR_MODULE));
if (ExeModule == NULL) if (ExeModule == NULL)
{ {
DbgPrint("Failed to create loader module infomation\n"); DbgPrint("Failed to create loader module infomation\n");
ZwTerminateProcess(NtCurrentProcess(),STATUS_UNSUCCESSFUL); ZwTerminateProcess(NtCurrentProcess(),STATUS_UNSUCCESSFUL);
} }
ExeModule->BaseAddress = Peb->ImageBaseAddress; ExeModule->BaseAddress = Peb->ImageBaseAddress;
@ -233,13 +233,13 @@ LdrInitializeThunk (ULONG Unknown1,
} }
RtlCreateUnicodeString(&ExeModule->FullDllName, RtlCreateUnicodeString(&ExeModule->FullDllName,
Peb->ProcessParameters->ImagePathName.Buffer); Peb->ProcessParameters->ImagePathName.Buffer);
RtlCreateUnicodeString(&ExeModule->BaseDllName, RtlCreateUnicodeString(&ExeModule->BaseDllName,
wcsrchr(ExeModule->FullDllName.Buffer, L'\\') + 1); wcsrchr(ExeModule->FullDllName.Buffer, L'\\') + 1);
DPRINT("BaseDllName '%wZ' FullDllName '%wZ'\n", DPRINT("BaseDllName '%wZ' FullDllName '%wZ'\n",
&ExeModule->BaseDllName, &ExeModule->BaseDllName,
&ExeModule->FullDllName); &ExeModule->FullDllName);
ExeModule->Flags = 0; ExeModule->Flags = 0;
ExeModule->LoadCount = -1; /* don't unload */ ExeModule->LoadCount = -1; /* don't unload */
@ -252,7 +252,7 @@ LdrInitializeThunk (ULONG Unknown1,
ExeModule->TimeDateStamp = NTHeaders->FileHeader.TimeDateStamp; ExeModule->TimeDateStamp = NTHeaders->FileHeader.TimeDateStamp;
InsertHeadList(&Peb->Ldr->InLoadOrderModuleList, InsertHeadList(&Peb->Ldr->InLoadOrderModuleList,
&ExeModule->InLoadOrderModuleList); &ExeModule->InLoadOrderModuleList);
#ifdef DBG #ifdef DBG
@ -269,8 +269,8 @@ LdrInitializeThunk (ULONG Unknown1,
/* Check before returning that we can run the image safely. */ /* Check before returning that we can run the image safely. */
if (EntryPoint == NULL) if (EntryPoint == NULL)
{ {
DbgPrint("Failed to initialize image\n"); DbgPrint("Failed to initialize image\n");
ZwTerminateProcess(NtCurrentProcess(),STATUS_UNSUCCESSFUL); ZwTerminateProcess(NtCurrentProcess(),STATUS_UNSUCCESSFUL);
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.75 2002/10/26 00:32:18 chorns Exp $ # $Id: makefile,v 1.76 2002/12/08 15:57:39 robd Exp $
PATH_TO_TOP = ../.. PATH_TO_TOP = ../..
@ -68,6 +68,7 @@ TARGET_OBJECTS = \
$(STDLIB_OBJECTS) \ $(STDLIB_OBJECTS) \
$(STRING_OBJECTS) \ $(STRING_OBJECTS) \
stubs/stubs.o \ stubs/stubs.o \
ldr/res.o \
ldr/utils.o \ ldr/utils.o \
$(CSR_OBJECTS) $(CSR_OBJECTS)

View file

@ -1,4 +1,4 @@
/* $Id: error.c,v 1.11 2002/09/08 10:23:05 chorns Exp $ /* $Id: error.c,v 1.12 2002/12/08 15:57:38 robd Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -826,12 +826,10 @@ RPC_NT_SS_CONTEXT_MISMATCH ERROR_INVALID_HANDLE
VOID VOID
STDCALL STDCALL
RtlAssert ( RtlAssert(PVOID FailedAssertion,
PVOID FailedAssertion,
PVOID FileName, PVOID FileName,
ULONG LineNumber, ULONG LineNumber,
PCHAR Message PCHAR Message)
)
{ {
DbgPrint ("Assertion \'%s\' failed at %s line %d: %s\n", DbgPrint ("Assertion \'%s\' failed at %s line %d: %s\n",
(PCHAR)FailedAssertion, (PCHAR)FailedAssertion,
@ -881,9 +879,9 @@ RtlNtStatusToDosErrorNoTeb(NTSTATUS Status)
if (!ret) if (!ret)
ret = Status; /* 0 means 1:1 mapping */ ret = Status; /* 0 means 1:1 mapping */
else if (ret == ERROR_MR_MID_NOT_FOUND) else if (ret == ERROR_MR_MID_NOT_FOUND)
{ {
DbgPrint("RTL: RtlNtStatusToDosErrorNoTeb(0x%lx): no valid W32 error mapping\n", Status); DbgPrint("RTL: RtlNtStatusToDosErrorNoTeb(0x%lx): no valid W32 error mapping\n", Status);
} }
return ret; return ret;
} }
Table++; Table++;

View file

@ -1,4 +1,4 @@
/* $Id: largeint.c,v 1.9 2002/09/08 10:23:05 chorns Exp $ /* $Id: largeint.c,v 1.10 2002/12/08 15:57:39 robd Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -121,11 +121,9 @@ RtlExtendedLargeIntegerDivide (
LARGE_INTEGER LARGE_INTEGER
STDCALL STDCALL
RtlExtendedMagicDivide ( RtlExtendedMagicDivide(LARGE_INTEGER Dividend,
LARGE_INTEGER Dividend,
LARGE_INTEGER MagicDivisor, LARGE_INTEGER MagicDivisor,
CCHAR ShiftCount CCHAR ShiftCount)
)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
} }

View file

@ -1,4 +1,4 @@
/* $Id: mem.c,v 1.11 2002/09/08 10:23:05 chorns Exp $ /* $Id: mem.c,v 1.12 2002/12/08 15:57:39 robd Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -18,7 +18,9 @@
ULONG ULONG
STDCALL STDCALL
RtlCompareMemory(PVOID Source1, PVOID Source2, ULONG Length) RtlCompareMemory(PVOID Source1,
PVOID Source2,
ULONG Length)
/* /*
* FUNCTION: Compares blocks of memory and returns the number of equal bytes * FUNCTION: Compares blocks of memory and returns the number of equal bytes
* ARGUMENTS: * ARGUMENTS:
@ -95,11 +97,7 @@ RtlFillMemory (
UCHAR Fill UCHAR Fill
) )
{ {
memset ( memset(Destination, Fill, Length);
Destination,
Fill,
Length
);
} }
VOID VOID
@ -122,21 +120,6 @@ RtlFillMemoryUlong (
} }
VOID
STDCALL
RtlZeroMemory (
PVOID Destination,
ULONG Length
)
{
RtlFillMemory (
Destination,
Length,
0
);
}
VOID VOID
STDCALL STDCALL
RtlMoveMemory ( RtlMoveMemory (
@ -153,4 +136,19 @@ RtlMoveMemory (
} }
VOID
STDCALL
RtlZeroMemory (
PVOID Destination,
ULONG Length
)
{
RtlFillMemory (
Destination,
Length,
0
);
}
/* EOF */ /* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: time.c,v 1.13 2002/09/30 20:57:54 hbirr Exp $ /* $Id: time.c,v 1.14 2002/12/08 15:57:39 robd Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -55,43 +55,11 @@ static __inline void NormalizeTimeFields(CSHORT *FieldToNormalize,
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
VOID STDCALL VOID
RtlTimeToElapsedTimeFields(IN PLARGE_INTEGER Time, STDCALL
OUT PTIME_FIELDS TimeFields) RtlTimeToTimeFields(
{ PLARGE_INTEGER liTime,
ULONGLONG ElapsedSeconds; PTIME_FIELDS TimeFields)
ULONG SecondsInDay;
ULONG SecondsInMinute;
/* Extract millisecond from time */
TimeFields->Milliseconds = (CSHORT)((Time->QuadPart % TICKSPERSEC) / TICKSPERMSEC);
/* Compute elapsed seconds */
ElapsedSeconds = (ULONGLONG)Time->QuadPart / TICKSPERSEC;
/* Compute seconds within the day */
SecondsInDay = ElapsedSeconds % SECSPERDAY;
/* Compute elapsed minutes within the day */
SecondsInMinute = SecondsInDay % SECSPERHOUR;
/* Compute elapsed time of day */
TimeFields->Hour = (CSHORT)(SecondsInDay / SECSPERHOUR);
TimeFields->Minute = (CSHORT)(SecondsInMinute / SECSPERMIN);
TimeFields->Second = (CSHORT)(SecondsInMinute % SECSPERMIN);
/* Compute elapsed days */
TimeFields->Day = (CSHORT)(ElapsedSeconds / SECSPERDAY);
/* The elapsed number of months and days cannot be calculated */
TimeFields->Month = 0;
TimeFields->Year = 0;
}
VOID STDCALL
RtlTimeToTimeFields(PLARGE_INTEGER liTime,
PTIME_FIELDS TimeFields)
{ {
const int *Months; const int *Months;
int LeapSecondCorrections, SecondsInDay, CurYear; int LeapSecondCorrections, SecondsInDay, CurYear;
@ -169,11 +137,14 @@ RtlTimeToTimeFields(PLARGE_INTEGER liTime,
} }
BOOLEAN STDCALL BOOLEAN
RtlTimeFieldsToTime(PTIME_FIELDS tfTimeFields, STDCALL
PLARGE_INTEGER Time) RtlTimeFieldsToTime(
PTIME_FIELDS tfTimeFields,
PLARGE_INTEGER Time)
{ {
int CurYear, CurMonth; int CurYear;
int CurMonth;
long long int rcTime; long long int rcTime;
TIME_FIELDS TimeFields = *tfTimeFields; TIME_FIELDS TimeFields = *tfTimeFields;
@ -233,9 +204,11 @@ RtlTimeFieldsToTime(PTIME_FIELDS tfTimeFields,
} }
VOID STDCALL VOID
RtlSecondsSince1970ToTime(ULONG SecondsSince1970, STDCALL
PLARGE_INTEGER Time) RtlSecondsSince1970ToTime(
ULONG SecondsSince1970,
PLARGE_INTEGER Time)
{ {
LONGLONG llTime; LONGLONG llTime;
@ -245,9 +218,11 @@ RtlSecondsSince1970ToTime(ULONG SecondsSince1970,
} }
VOID STDCALL VOID
RtlSecondsSince1980ToTime(ULONG SecondsSince1980, STDCALL
PLARGE_INTEGER Time) RtlSecondsSince1980ToTime(
ULONG SecondsSince1980,
PLARGE_INTEGER Time)
{ {
LONGLONG llTime; LONGLONG llTime;
@ -257,9 +232,11 @@ RtlSecondsSince1980ToTime(ULONG SecondsSince1980,
} }
BOOLEAN STDCALL BOOLEAN
RtlTimeToSecondsSince1970(PLARGE_INTEGER Time, STDCALL
PULONG SecondsSince1970) RtlTimeToSecondsSince1970(
PLARGE_INTEGER Time,
PULONG SecondsSince1970)
{ {
LARGE_INTEGER liTime; LARGE_INTEGER liTime;
@ -267,17 +244,19 @@ RtlTimeToSecondsSince1970(PLARGE_INTEGER Time,
liTime.QuadPart = liTime.QuadPart / TICKSPERSEC; liTime.QuadPart = liTime.QuadPart / TICKSPERSEC;
if (liTime.u.HighPart != 0) if (liTime.u.HighPart != 0)
return(FALSE); return FALSE;
*SecondsSince1970 = liTime.u.LowPart; *SecondsSince1970 = liTime.u.LowPart;
return(TRUE); return TRUE;
} }
BOOLEAN STDCALL BOOLEAN
RtlTimeToSecondsSince1980(PLARGE_INTEGER Time, STDCALL
PULONG SecondsSince1980) RtlTimeToSecondsSince1980(
PLARGE_INTEGER Time,
PULONG SecondsSince1980)
{ {
LARGE_INTEGER liTime; LARGE_INTEGER liTime;
@ -285,15 +264,16 @@ RtlTimeToSecondsSince1980(PLARGE_INTEGER Time,
liTime.QuadPart = liTime.QuadPart / TICKSPERSEC; liTime.QuadPart = liTime.QuadPart / TICKSPERSEC;
if (liTime.u.HighPart != 0) if (liTime.u.HighPart != 0)
return(FALSE); return FALSE;
*SecondsSince1980 = liTime.u.LowPart; *SecondsSince1980 = liTime.u.LowPart;
return(TRUE); return TRUE;
} }
NTSTATUS STDCALL NTSTATUS
STDCALL
RtlLocalTimeToSystemTime(PLARGE_INTEGER LocalTime, RtlLocalTimeToSystemTime(PLARGE_INTEGER LocalTime,
PLARGE_INTEGER SystemTime) PLARGE_INTEGER SystemTime)
{ {
@ -314,7 +294,8 @@ RtlLocalTimeToSystemTime(PLARGE_INTEGER LocalTime,
} }
NTSTATUS STDCALL NTSTATUS
STDCALL
RtlSystemTimeToLocalTime(PLARGE_INTEGER SystemTime, RtlSystemTimeToLocalTime(PLARGE_INTEGER SystemTime,
PLARGE_INTEGER LocalTime) PLARGE_INTEGER LocalTime)
{ {
@ -334,4 +315,40 @@ RtlSystemTimeToLocalTime(PLARGE_INTEGER SystemTime,
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
VOID
STDCALL
RtlTimeToElapsedTimeFields(IN PLARGE_INTEGER Time,
OUT PTIME_FIELDS TimeFields)
{
ULONGLONG ElapsedSeconds;
ULONG SecondsInDay;
ULONG SecondsInMinute;
/* Extract millisecond from time */
TimeFields->Milliseconds = (CSHORT)((Time->QuadPart % TICKSPERSEC) / TICKSPERMSEC);
/* Compute elapsed seconds */
ElapsedSeconds = (ULONGLONG)Time->QuadPart / TICKSPERSEC;
/* Compute seconds within the day */
SecondsInDay = ElapsedSeconds % SECSPERDAY;
/* Compute elapsed minutes within the day */
SecondsInMinute = SecondsInDay % SECSPERHOUR;
/* Compute elapsed time of day */
TimeFields->Hour = (CSHORT)(SecondsInDay / SECSPERHOUR);
TimeFields->Minute = (CSHORT)(SecondsInMinute / SECSPERMIN);
TimeFields->Second = (CSHORT)(SecondsInMinute % SECSPERMIN);
/* Compute elapsed days */
TimeFields->Day = (CSHORT)(ElapsedSeconds / SECSPERDAY);
/* The elapsed number of months and days cannot be calculated */
TimeFields->Month = 0;
TimeFields->Year = 0;
}
/* EOF */ /* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: unicode.c,v 1.24 2002/10/20 03:34:00 robd Exp $ /* $Id: unicode.c,v 1.25 2002/12/08 15:57:39 robd Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -21,9 +21,8 @@
WCHAR WCHAR
STDCALL STDCALL
RtlAnsiCharToUnicodeChar ( RtlAnsiCharToUnicodeChar(
IN CHAR AnsiChar IN CHAR AnsiChar)
)
{ {
ULONG Size; ULONG Size;
WCHAR UnicodeChar; WCHAR UnicodeChar;
@ -45,9 +44,8 @@ RtlAnsiCharToUnicodeChar (
ULONG ULONG
STDCALL STDCALL
RtlAnsiStringToUnicodeSize ( RtlAnsiStringToUnicodeSize(
IN PANSI_STRING AnsiString IN PANSI_STRING AnsiString)
)
{ {
ULONG Size; ULONG Size;
@ -64,8 +62,7 @@ STDCALL
RtlAnsiStringToUnicodeString( RtlAnsiStringToUnicodeString(
IN OUT PUNICODE_STRING DestinationString, IN OUT PUNICODE_STRING DestinationString,
IN PANSI_STRING SourceString, IN PANSI_STRING SourceString,
IN BOOLEAN AllocateDestinationString IN BOOLEAN AllocateDestinationString)
)
{ {
NTSTATUS Status; NTSTATUS Status;
ULONG Length; ULONG Length;
@ -125,10 +122,9 @@ RtlAnsiStringToUnicodeString(
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlAppendAsciizToString ( RtlAppendAsciizToString(
IN OUT PSTRING Destination, IN OUT PSTRING Destination,
IN PCSZ Source IN PCSZ Source)
)
{ {
ULONG Length; ULONG Length;
PCHAR Ptr; PCHAR Ptr;
@ -155,10 +151,9 @@ RtlAppendAsciizToString (
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlAppendStringToString ( RtlAppendStringToString(
IN OUT PSTRING Destination, IN OUT PSTRING Destination,
IN PSTRING Source IN PSTRING Source)
)
{ {
PCHAR Ptr; PCHAR Ptr;
@ -183,10 +178,9 @@ RtlAppendStringToString (
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlAppendUnicodeStringToString ( RtlAppendUnicodeStringToString(
IN OUT PUNICODE_STRING Destination, IN OUT PUNICODE_STRING Destination,
IN PUNICODE_STRING Source IN PUNICODE_STRING Source)
)
{ {
PWCHAR Src; PWCHAR Src;
PWCHAR Dest; PWCHAR Dest;
@ -244,7 +238,7 @@ RtlAppendUnicodeToString(IN OUT PUNICODE_STRING Destination,
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlCharToInteger ( RtlCharToInteger(
IN PCSZ String, IN PCSZ String,
IN ULONG Base, IN ULONG Base,
IN OUT PULONG Value) IN OUT PULONG Value)
@ -285,11 +279,10 @@ RtlCharToInteger (
LONG LONG
STDCALL STDCALL
RtlCompareString ( RtlCompareString(
IN PSTRING String1, IN PSTRING String1,
IN PSTRING String2, IN PSTRING String2,
IN BOOLEAN CaseInsensitive IN BOOLEAN CaseInsensitive)
)
{ {
ULONG len1, len2; ULONG len1, len2;
PCHAR s1, s2; PCHAR s1, s2;
@ -333,11 +326,10 @@ RtlCompareString (
LONG LONG
STDCALL STDCALL
RtlCompareUnicodeString ( RtlCompareUnicodeString(
IN PUNICODE_STRING String1, IN PUNICODE_STRING String1,
IN PUNICODE_STRING String2, IN PUNICODE_STRING String2,
IN BOOLEAN CaseInsensitive IN BOOLEAN CaseInsensitive)
)
{ {
ULONG len1, len2; ULONG len1, len2;
PWCHAR s1, s2; PWCHAR s1, s2;
@ -381,10 +373,9 @@ RtlCompareUnicodeString (
VOID VOID
STDCALL STDCALL
RtlCopyString ( RtlCopyString(
IN OUT PSTRING DestinationString, IN OUT PSTRING DestinationString,
IN PSTRING SourceString IN PSTRING SourceString)
)
{ {
ULONG copylen, i; ULONG copylen, i;
PCHAR Src, Dest; PCHAR Src, Dest;
@ -414,10 +405,9 @@ RtlCopyString (
VOID VOID
STDCALL STDCALL
RtlCopyUnicodeString ( RtlCopyUnicodeString(
IN OUT PUNICODE_STRING DestinationString, IN OUT PUNICODE_STRING DestinationString,
IN PUNICODE_STRING SourceString IN PUNICODE_STRING SourceString)
)
{ {
ULONG copylen, i; ULONG copylen, i;
PWCHAR Src, Dest; PWCHAR Src, Dest;
@ -447,10 +437,9 @@ RtlCopyUnicodeString (
BOOLEAN BOOLEAN
STDCALL STDCALL
RtlCreateUnicodeString ( RtlCreateUnicodeString(
IN OUT PUNICODE_STRING Destination, IN OUT PUNICODE_STRING Destination,
IN PWSTR Source IN PWSTR Source)
)
{ {
ULONG Length; ULONG Length;
@ -473,8 +462,10 @@ RtlCreateUnicodeString (
} }
BOOLEAN STDCALL BOOLEAN
RtlCreateUnicodeStringFromAsciiz (OUT PUNICODE_STRING Destination, STDCALL
RtlCreateUnicodeStringFromAsciiz(
OUT PUNICODE_STRING Destination,
IN PCSZ Source) IN PCSZ Source)
{ {
ANSI_STRING AnsiString; ANSI_STRING AnsiString;
@ -493,11 +484,10 @@ RtlCreateUnicodeStringFromAsciiz (OUT PUNICODE_STRING Destination,
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlDowncaseUnicodeString ( RtlDowncaseUnicodeString(
IN OUT PUNICODE_STRING DestinationString, IN OUT PUNICODE_STRING DestinationString,
IN PUNICODE_STRING SourceString, IN PUNICODE_STRING SourceString,
IN BOOLEAN AllocateDestinationString IN BOOLEAN AllocateDestinationString)
)
{ {
ULONG i; ULONG i;
PWCHAR Src, Dest; PWCHAR Src, Dest;
@ -545,10 +535,9 @@ RtlDowncaseUnicodeString (
BOOLEAN BOOLEAN
STDCALL STDCALL
RtlEqualComputerName ( RtlEqualComputerName(
IN PUNICODE_STRING ComputerName1, IN PUNICODE_STRING ComputerName1,
IN PUNICODE_STRING ComputerName2 IN PUNICODE_STRING ComputerName2)
)
{ {
return RtlEqualDomainName (ComputerName1, return RtlEqualDomainName (ComputerName1,
ComputerName2); ComputerName2);
@ -586,11 +575,10 @@ RtlEqualDomainName (
BOOLEAN BOOLEAN
STDCALL STDCALL
RtlEqualString ( RtlEqualString(
IN PSTRING String1, IN PSTRING String1,
IN PSTRING String2, IN PSTRING String2,
IN BOOLEAN CaseInsensitive IN BOOLEAN CaseInsensitive)
)
{ {
ULONG i; ULONG i;
CHAR c1, c2; CHAR c1, c2;
@ -627,11 +615,10 @@ RtlEqualString (
BOOLEAN BOOLEAN
STDCALL STDCALL
RtlEqualUnicodeString ( RtlEqualUnicodeString(
IN PUNICODE_STRING String1, IN PUNICODE_STRING String1,
IN PUNICODE_STRING String2, IN PUNICODE_STRING String2,
IN BOOLEAN CaseInsensitive IN BOOLEAN CaseInsensitive)
)
{ {
ULONG i; ULONG i;
WCHAR wc1, wc2; WCHAR wc1, wc2;
@ -669,9 +656,8 @@ RtlEqualUnicodeString (
VOID VOID
STDCALL STDCALL
RtlEraseUnicodeString ( RtlEraseUnicodeString(
IN PUNICODE_STRING String IN PUNICODE_STRING String)
)
{ {
if (String->Buffer == NULL) if (String->Buffer == NULL)
return; return;
@ -689,9 +675,8 @@ RtlEraseUnicodeString (
VOID VOID
STDCALL STDCALL
RtlFreeAnsiString ( RtlFreeAnsiString(
IN PANSI_STRING AnsiString IN PANSI_STRING AnsiString)
)
{ {
if (AnsiString->Buffer == NULL) if (AnsiString->Buffer == NULL)
return; return;
@ -708,9 +693,8 @@ RtlFreeAnsiString (
VOID VOID
STDCALL STDCALL
RtlFreeOemString ( RtlFreeOemString(
IN POEM_STRING OemString IN POEM_STRING OemString)
)
{ {
if (OemString->Buffer == NULL) if (OemString->Buffer == NULL)
return; return;
@ -727,9 +711,8 @@ RtlFreeOemString (
VOID VOID
STDCALL STDCALL
RtlFreeUnicodeString ( RtlFreeUnicodeString(
IN PUNICODE_STRING UnicodeString IN PUNICODE_STRING UnicodeString)
)
{ {
if (UnicodeString->Buffer == NULL) if (UnicodeString->Buffer == NULL)
return; return;
@ -746,10 +729,9 @@ RtlFreeUnicodeString (
VOID VOID
STDCALL STDCALL
RtlInitAnsiString ( RtlInitAnsiString(
IN OUT PANSI_STRING DestinationString, IN OUT PANSI_STRING DestinationString,
IN PCSZ SourceString IN PCSZ SourceString)
)
{ {
ULONG DestSize; ULONG DestSize;
@ -770,10 +752,9 @@ RtlInitAnsiString (
VOID VOID
STDCALL STDCALL
RtlInitString ( RtlInitString(
IN OUT PSTRING DestinationString, IN OUT PSTRING DestinationString,
IN PCSZ SourceString IN PCSZ SourceString)
)
{ {
ULONG DestSize; ULONG DestSize;
@ -794,10 +775,9 @@ RtlInitString (
VOID VOID
STDCALL STDCALL
RtlInitUnicodeString ( RtlInitUnicodeString(
IN OUT PUNICODE_STRING DestinationString, IN OUT PUNICODE_STRING DestinationString,
IN PCWSTR SourceString IN PCWSTR SourceString)
)
{ {
ULONG DestSize; ULONG DestSize;
@ -818,12 +798,11 @@ RtlInitUnicodeString (
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlIntegerToChar ( RtlIntegerToChar(
IN ULONG Value, IN ULONG Value,
IN ULONG Base, IN ULONG Base,
IN ULONG Length, IN ULONG Length,
IN OUT PCHAR String IN OUT PCHAR String)
)
{ {
ULONG Radix; ULONG Radix;
CHAR temp[33]; CHAR temp[33];
@ -866,11 +845,10 @@ RtlIntegerToChar (
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlIntegerToUnicodeString ( RtlIntegerToUnicodeString(
IN ULONG Value, IN ULONG Value,
IN ULONG Base, /* optional */ IN ULONG Base, /* optional */
IN OUT PUNICODE_STRING String IN OUT PUNICODE_STRING String)
)
{ {
ANSI_STRING AnsiString; ANSI_STRING AnsiString;
CHAR Buffer[33]; CHAR Buffer[33];
@ -897,12 +875,11 @@ RtlIntegerToUnicodeString (
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlLargeIntegerToChar ( RtlLargeIntegerToChar(
IN PLARGE_INTEGER Value, IN PLARGE_INTEGER Value,
IN ULONG Base, IN ULONG Base,
IN ULONG Length, IN ULONG Length,
IN OUT PCHAR String IN OUT PCHAR String)
)
{ {
ULONG Radix; ULONG Radix;
CHAR temp[65]; CHAR temp[65];
@ -945,9 +922,8 @@ RtlLargeIntegerToChar (
ULONG ULONG
STDCALL STDCALL
RtlOemStringToUnicodeSize ( RtlOemStringToUnicodeSize(
IN POEM_STRING OemString IN POEM_STRING OemString)
)
{ {
ULONG Size; ULONG Size;
@ -961,11 +937,10 @@ RtlOemStringToUnicodeSize (
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlOemStringToUnicodeString ( RtlOemStringToUnicodeString(
IN OUT PUNICODE_STRING DestinationString, IN OUT PUNICODE_STRING DestinationString,
IN POEM_STRING SourceString, IN POEM_STRING SourceString,
IN BOOLEAN AllocateDestinationString IN BOOLEAN AllocateDestinationString)
)
{ {
NTSTATUS Status; NTSTATUS Status;
ULONG Length; ULONG Length;
@ -1025,11 +1000,10 @@ RtlOemStringToUnicodeString (
BOOLEAN BOOLEAN
STDCALL STDCALL
RtlPrefixString ( RtlPrefixString(
PANSI_STRING String1, PANSI_STRING String1,
PANSI_STRING String2, PANSI_STRING String2,
BOOLEAN CaseInsensitive BOOLEAN CaseInsensitive)
)
{ {
PCHAR pc1; PCHAR pc1;
PCHAR pc2; PCHAR pc2;
@ -1068,11 +1042,10 @@ RtlPrefixString (
BOOLEAN BOOLEAN
STDCALL STDCALL
RtlPrefixUnicodeString ( RtlPrefixUnicodeString(
PUNICODE_STRING String1, PUNICODE_STRING String1,
PUNICODE_STRING String2, PUNICODE_STRING String2,
BOOLEAN CaseInsensitive BOOLEAN CaseInsensitive)
)
{ {
PWCHAR pc1; PWCHAR pc1;
PWCHAR pc2; PWCHAR pc2;
@ -1112,9 +1085,8 @@ RtlPrefixUnicodeString (
ULONG ULONG
STDCALL STDCALL
RtlUnicodeStringToAnsiSize ( RtlUnicodeStringToAnsiSize(
IN PUNICODE_STRING UnicodeString IN PUNICODE_STRING UnicodeString)
)
{ {
ULONG Size; ULONG Size;
@ -1128,11 +1100,10 @@ RtlUnicodeStringToAnsiSize (
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlUnicodeStringToAnsiString ( RtlUnicodeStringToAnsiString(
IN OUT PANSI_STRING DestinationString, IN OUT PANSI_STRING DestinationString,
IN PUNICODE_STRING SourceString, IN PUNICODE_STRING SourceString,
IN BOOLEAN AllocateDestinationString IN BOOLEAN AllocateDestinationString)
)
{ {
NTSTATUS Status; NTSTATUS Status;
ULONG Length; ULONG Length;
@ -1186,11 +1157,10 @@ RtlUnicodeStringToAnsiString (
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlUnicodeStringToInteger ( RtlUnicodeStringToInteger(
IN PUNICODE_STRING String, IN PUNICODE_STRING String,
IN ULONG Base, IN ULONG Base,
OUT PULONG Value OUT PULONG Value)
)
{ {
PWCHAR Str; PWCHAR Str;
ULONG lenmin = 0; ULONG lenmin = 0;
@ -1276,9 +1246,8 @@ RtlUnicodeStringToInteger (
ULONG ULONG
STDCALL STDCALL
RtlUnicodeStringToOemSize ( RtlUnicodeStringToOemSize(
IN PUNICODE_STRING UnicodeString IN PUNICODE_STRING UnicodeString)
)
{ {
ULONG Size; ULONG Size;
@ -1292,11 +1261,10 @@ RtlUnicodeStringToOemSize (
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlUnicodeStringToCountedOemString ( RtlUnicodeStringToCountedOemString(
IN OUT POEM_STRING DestinationString, IN OUT POEM_STRING DestinationString,
IN PUNICODE_STRING SourceString, IN PUNICODE_STRING SourceString,
IN BOOLEAN AllocateDestinationString IN BOOLEAN AllocateDestinationString)
)
{ {
NTSTATUS Status; NTSTATUS Status;
ULONG Length; ULONG Length;
@ -1359,11 +1327,10 @@ RtlUnicodeStringToCountedOemString (
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlUnicodeStringToOemString ( RtlUnicodeStringToOemString(
IN OUT POEM_STRING DestinationString, IN OUT POEM_STRING DestinationString,
IN PUNICODE_STRING SourceString, IN PUNICODE_STRING SourceString,
IN BOOLEAN AllocateDestinationString IN BOOLEAN AllocateDestinationString)
)
{ {
NTSTATUS Status; NTSTATUS Status;
ULONG Length; ULONG Length;
@ -1426,9 +1393,7 @@ RtlUnicodeStringToOemString (
WCHAR WCHAR
STDCALL STDCALL
RtlUpcaseUnicodeChar ( RtlUpcaseUnicodeChar(IN WCHAR Source)
IN WCHAR Source
)
{ {
if (Source < L'a') if (Source < L'a')
return Source; return Source;
@ -1444,11 +1409,10 @@ RtlUpcaseUnicodeChar (
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlUpcaseUnicodeString ( RtlUpcaseUnicodeString(
IN OUT PUNICODE_STRING DestinationString, IN OUT PUNICODE_STRING DestinationString,
IN PUNICODE_STRING SourceString, IN PUNICODE_STRING SourceString,
IN BOOLEAN AllocateDestinationString IN BOOLEAN AllocateDestinationString)
)
{ {
ULONG i; ULONG i;
PWCHAR Src, Dest; PWCHAR Src, Dest;
@ -1485,11 +1449,10 @@ RtlUpcaseUnicodeString (
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlUpcaseUnicodeStringToAnsiString ( RtlUpcaseUnicodeStringToAnsiString(
IN OUT PANSI_STRING DestinationString, IN OUT PANSI_STRING DestinationString,
IN PUNICODE_STRING SourceString, IN PUNICODE_STRING SourceString,
IN BOOLEAN AllocateDestinationString IN BOOLEAN AllocateDestinationString)
)
{ {
NTSTATUS Status; NTSTATUS Status;
ULONG Length; ULONG Length;
@ -1552,11 +1515,10 @@ RtlUpcaseUnicodeStringToAnsiString (
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlUpcaseUnicodeStringToCountedOemString ( RtlUpcaseUnicodeStringToCountedOemString(
IN OUT POEM_STRING DestinationString, IN OUT POEM_STRING DestinationString,
IN PUNICODE_STRING SourceString, IN PUNICODE_STRING SourceString,
IN BOOLEAN AllocateDestinationString IN BOOLEAN AllocateDestinationString)
)
{ {
NTSTATUS Status; NTSTATUS Status;
ULONG Length; ULONG Length;
@ -1724,10 +1686,9 @@ RtlUpperChar (
VOID VOID
STDCALL STDCALL
RtlUpperString ( RtlUpperString(
IN OUT PSTRING DestinationString, IN OUT PSTRING DestinationString,
IN PSTRING SourceString IN PSTRING SourceString)
)
{ {
ULONG Length; ULONG Length;
ULONG i; ULONG i;
@ -1752,41 +1713,33 @@ RtlUpperString (
ULONG ULONG
STDCALL STDCALL
RtlxAnsiStringToUnicodeSize ( RtlxAnsiStringToUnicodeSize(IN PANSI_STRING AnsiString)
IN PANSI_STRING AnsiString
)
{ {
return RtlAnsiStringToUnicodeSize (AnsiString); return RtlAnsiStringToUnicodeSize(AnsiString);
} }
ULONG ULONG
STDCALL STDCALL
RtlxOemStringToUnicodeSize ( RtlxOemStringToUnicodeSize(IN POEM_STRING OemString)
IN POEM_STRING OemString
)
{ {
return RtlAnsiStringToUnicodeSize ((PANSI_STRING)OemString); return RtlAnsiStringToUnicodeSize((PANSI_STRING)OemString);
} }
ULONG ULONG
STDCALL STDCALL
RtlxUnicodeStringToAnsiSize ( RtlxUnicodeStringToAnsiSize(IN PUNICODE_STRING UnicodeString)
IN PUNICODE_STRING UnicodeString
)
{ {
return RtlUnicodeStringToAnsiSize (UnicodeString); return RtlUnicodeStringToAnsiSize(UnicodeString);
} }
ULONG ULONG
STDCALL STDCALL
RtlxUnicodeStringToOemSize ( RtlxUnicodeStringToOemSize(IN PUNICODE_STRING UnicodeString)
IN PUNICODE_STRING UnicodeString
)
{ {
return RtlUnicodeStringToAnsiSize (UnicodeString); return RtlUnicodeStringToAnsiSize(UnicodeString);
} }
/* EOF */ /* EOF */