mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Fixed command line code.
Fixed Rtl string functions. svn path=/trunk/; revision=846
This commit is contained in:
parent
c7b7c5b0b6
commit
a1c7df6990
5 changed files with 156 additions and 130 deletions
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: cmdline.c,v 1.9 1999/12/10 17:47:29 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/kernel32/proc/proc.c
|
||||
|
@ -10,7 +11,7 @@
|
|||
|
||||
/* INCLUDES ****************************************************************/
|
||||
|
||||
#define UNICODE
|
||||
//#define UNICODE
|
||||
#include <ddk/ntddk.h>
|
||||
#include <windows.h>
|
||||
#include <kernel32/proc.h>
|
||||
|
@ -18,29 +19,76 @@
|
|||
#include <wchar.h>
|
||||
#include <string.h>
|
||||
#include <internal/teb.h>
|
||||
#include <ntdll/rtl.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <kernel32/kernel32.h>
|
||||
|
||||
/* GLOBALS ******************************************************************/
|
||||
|
||||
static UNICODE_STRING CommandLineStringW;
|
||||
static ANSI_STRING CommandLineStringA;
|
||||
|
||||
static WCHAR CommandLineW[MAX_PATH];
|
||||
static CHAR CommandLineA[MAX_PATH];
|
||||
|
||||
static WINBOOL bCommandLineInitialized = FALSE;
|
||||
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
static VOID
|
||||
InitCommandLines (VOID)
|
||||
{
|
||||
PPPB Ppb;
|
||||
|
||||
// initialize command line buffers
|
||||
CommandLineW[0] = 0;
|
||||
CommandLineStringW.Buffer = CommandLineW;
|
||||
CommandLineStringW.Length = 0;
|
||||
CommandLineStringW.MaximumLength = MAX_PATH * sizeof(WCHAR);
|
||||
|
||||
CommandLineA[0] = 0;
|
||||
CommandLineStringA.Buffer = CommandLineA;
|
||||
CommandLineStringA.Length = 0;
|
||||
CommandLineStringA.MaximumLength = MAX_PATH;
|
||||
|
||||
// get command line
|
||||
Ppb = NtCurrentPeb()->Ppb;
|
||||
RtlNormalizeProcessParams (Ppb);
|
||||
|
||||
RtlCopyUnicodeString (&CommandLineStringW,
|
||||
&(Ppb->CommandLine));
|
||||
RtlUnicodeStringToAnsiString (&CommandLineStringA,
|
||||
&CommandLineStringW,
|
||||
FALSE);
|
||||
|
||||
bCommandLineInitialized = TRUE;
|
||||
}
|
||||
|
||||
|
||||
LPSTR STDCALL GetCommandLineA(VOID)
|
||||
{
|
||||
ULONG i;
|
||||
PWSTR CommandLineW;
|
||||
|
||||
CommandLineW = GetCommandLineW();
|
||||
for (i=0; i<MAX_PATH && CommandLineW[i]!=0; i++)
|
||||
{
|
||||
CommandLineA[i] = (CHAR)CommandLineW[i];
|
||||
}
|
||||
CommandLineA[i] = 0;
|
||||
return(CommandLineA);
|
||||
if (bCommandLineInitialized == FALSE)
|
||||
{
|
||||
InitCommandLines ();
|
||||
}
|
||||
|
||||
DPRINT ("CommandLine \'%s\'\n", CommandLineA);
|
||||
|
||||
return(CommandLineA);
|
||||
}
|
||||
|
||||
LPWSTR STDCALL GetCommandLineW (VOID)
|
||||
{
|
||||
return (NtCurrentPeb()->Ppb->CommandLine.Buffer);
|
||||
if (bCommandLineInitialized == FALSE)
|
||||
{
|
||||
InitCommandLines ();
|
||||
}
|
||||
|
||||
DPRINT ("CommandLine \'%w\'\n", CommandLineW);
|
||||
|
||||
return(CommandLineW);
|
||||
}
|
||||
|
||||
/* EOF */
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: create.c,v 1.15 1999/12/08 12:58:44 ekohl Exp $
|
||||
/* $Id: create.c,v 1.16 1999/12/10 17:47:29 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -359,23 +359,7 @@ CreatePeb (
|
|||
ULONG PpbSize;
|
||||
ULONG BytesWritten;
|
||||
|
||||
PebBase = (PVOID)PEB_BASE;
|
||||
PebSize = 0x1000;
|
||||
|
||||
NtReadVirtualMemory(ProcessHandle,
|
||||
(PVOID)PEB_BASE,
|
||||
&Peb,
|
||||
sizeof(Peb),
|
||||
&BytesWritten);
|
||||
|
||||
Peb.Ppb = (PPPB)PEB_STARTUPINFO;
|
||||
|
||||
NtWriteVirtualMemory(ProcessHandle,
|
||||
(PVOID)PEB_BASE,
|
||||
&Peb,
|
||||
sizeof(Peb),
|
||||
&BytesWritten);
|
||||
|
||||
/* create the PPB */
|
||||
PpbBase = (PVOID)PEB_STARTUPINFO;
|
||||
PpbSize = Ppb->TotalSize;
|
||||
Status = NtAllocateVirtualMemory(ProcessHandle,
|
||||
|
@ -389,13 +373,39 @@ CreatePeb (
|
|||
return(Status);
|
||||
}
|
||||
|
||||
DPRINT("Ppb size %x\n", Ppb->TotalSize);
|
||||
ZwWriteVirtualMemory(ProcessHandle,
|
||||
(PVOID)PEB_STARTUPINFO,
|
||||
&Ppb,
|
||||
DPRINT("Ppb->TotalSize %x\n", Ppb->TotalSize);
|
||||
NtWriteVirtualMemory(ProcessHandle,
|
||||
PpbBase,
|
||||
Ppb,
|
||||
Ppb->TotalSize,
|
||||
&BytesWritten);
|
||||
|
||||
|
||||
/* create the PEB */
|
||||
PebBase = (PVOID)PEB_BASE;
|
||||
PebSize = 0x1000;
|
||||
|
||||
Status = NtAllocateVirtualMemory(ProcessHandle,
|
||||
&PebBase,
|
||||
0,
|
||||
&PebSize,
|
||||
MEM_COMMIT,
|
||||
PAGE_READWRITE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
|
||||
DPRINT("Peb created\n");
|
||||
|
||||
Peb.Ppb = (PPPB)PpbBase;
|
||||
|
||||
NtWriteVirtualMemory(ProcessHandle,
|
||||
PebBase,
|
||||
&Peb,
|
||||
sizeof(Peb),
|
||||
&BytesWritten);
|
||||
|
||||
*PebPtr = (PPEB)PebBase;
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
|
@ -459,6 +469,8 @@ CreateProcessW (
|
|||
&CommandLine_U,
|
||||
TempCommandLine);
|
||||
|
||||
DPRINT("CommandLine_U %w\n", CommandLine_U.Buffer);
|
||||
|
||||
RtlCreateProcessParameters (
|
||||
&Ppb,
|
||||
&CommandLine_U,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: process.c,v 1.6 1999/12/08 12:58:26 ekohl Exp $
|
||||
/* $Id: process.c,v 1.7 1999/12/10 17:48:34 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -477,7 +477,7 @@ RtlCreateProcessParameters (
|
|||
DataSize += (Reserved->Length + sizeof(WCHAR));
|
||||
|
||||
/* Calculate the required block size */
|
||||
RegionSize = DataSize;
|
||||
RegionSize = ROUNDUP(DataSize, PAGESIZE);
|
||||
|
||||
Status = NtAllocateVirtualMemory (
|
||||
NtCurrentProcess (),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: unicode.c,v 1.10 1999/11/25 23:43:44 ekohl Exp $
|
||||
/* $Id: unicode.c,v 1.11 1999/12/10 17:48:34 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -81,8 +81,6 @@ RtlAnsiStringToUnicodeString(
|
|||
if (Length > 65535)
|
||||
return STATUS_INVALID_PARAMETER_2;
|
||||
|
||||
DestinationString->Length = Length;
|
||||
|
||||
if (AllocateDestinationString == TRUE)
|
||||
{
|
||||
DestinationString->MaximumLength = Length + sizeof(WCHAR);
|
||||
|
@ -95,9 +93,10 @@ RtlAnsiStringToUnicodeString(
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Length > DestinationString->Length)
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
if (Length >= DestinationString->MaximumLength)
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
DestinationString->Length = Length;
|
||||
|
||||
RtlZeroMemory (DestinationString->Buffer,
|
||||
DestinationString->Length);
|
||||
|
@ -470,7 +469,6 @@ RtlDowncaseUnicodeString (
|
|||
|
||||
if (AllocateDestinationString == TRUE)
|
||||
{
|
||||
DestinationString->Length = SourceString->Length;
|
||||
DestinationString->MaximumLength = SourceString->Length + sizeof(WCHAR);
|
||||
DestinationString->Buffer = RtlAllocateHeap (RtlGetProcessHeap (),
|
||||
0,
|
||||
|
@ -479,8 +477,9 @@ RtlDowncaseUnicodeString (
|
|||
else
|
||||
{
|
||||
if (SourceString->Length >= DestinationString->MaximumLength)
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
DestinationString->Length = SourceString->Length;
|
||||
|
||||
Src = SourceString->Buffer;
|
||||
Dest = DestinationString->Buffer;
|
||||
|
@ -855,8 +854,6 @@ RtlOemStringToUnicodeString (
|
|||
if (Length > 65535)
|
||||
return STATUS_INVALID_PARAMETER_2;
|
||||
|
||||
DestinationString->Length = Length;
|
||||
|
||||
if (AllocateDestinationString == TRUE)
|
||||
{
|
||||
DestinationString->MaximumLength = Length + sizeof(WCHAR);
|
||||
|
@ -869,13 +866,13 @@ RtlOemStringToUnicodeString (
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Length > DestinationString->Length)
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
if (Length > DestinationString->MaximumLength)
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
DestinationString->Length = Length;
|
||||
|
||||
memset (DestinationString->Buffer,
|
||||
0,
|
||||
DestinationString->Length);
|
||||
RtlZeroMemory (DestinationString->Buffer,
|
||||
DestinationString->Length);
|
||||
|
||||
Status = RtlOemToUnicodeN (DestinationString->Buffer,
|
||||
DestinationString->Length,
|
||||
|
@ -931,12 +928,6 @@ RtlUnicodeStringToAnsiString (
|
|||
else
|
||||
Length = SourceString->Length / sizeof(WCHAR);
|
||||
|
||||
/* this doesn't make sense */
|
||||
// if (Length > 65535)
|
||||
// return STATUS_INVALID_PARAMETER_2;
|
||||
|
||||
DestinationString->Length = Length;
|
||||
|
||||
if (AllocateDestinationString == TRUE)
|
||||
{
|
||||
DestinationString->MaximumLength = Length + sizeof(CHAR);
|
||||
|
@ -949,9 +940,10 @@ RtlUnicodeStringToAnsiString (
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Length >= DestinationString->Length)
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
if (Length >= DestinationString->MaximumLength)
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
DestinationString->Length = Length;
|
||||
|
||||
RtlZeroMemory (DestinationString->Buffer,
|
||||
DestinationString->Length);
|
||||
|
@ -963,10 +955,12 @@ RtlUnicodeStringToAnsiString (
|
|||
SourceString->Length);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
if (AllocateDestinationString)
|
||||
if (AllocateDestinationString == TRUE)
|
||||
{
|
||||
RtlFreeHeap (RtlGetProcessHeap (),
|
||||
0,
|
||||
DestinationString->Buffer);
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -1079,11 +1073,6 @@ RtlUnicodeStringToOemString (
|
|||
else
|
||||
Length = SourceString->Length / sizeof(WCHAR);
|
||||
|
||||
// if (Length > 65535)
|
||||
// return STATUS_INVALID_PARAMETER_2;
|
||||
|
||||
DestinationString->Length = Length;
|
||||
|
||||
if (AllocateDestinationString == TRUE)
|
||||
{
|
||||
DestinationString->MaximumLength = Length + sizeof(CHAR);
|
||||
|
@ -1096,9 +1085,10 @@ RtlUnicodeStringToOemString (
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Length >= DestinationString->Length)
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
if (Length >= DestinationString->MaximumLength)
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
DestinationString->Length = Length;
|
||||
|
||||
RtlZeroMemory (DestinationString->Buffer,
|
||||
DestinationString->Length);
|
||||
|
@ -1154,8 +1144,6 @@ RtlUpcaseUnicodeString (
|
|||
ULONG i;
|
||||
PWCHAR Src, Dest;
|
||||
|
||||
DestinationString->Length = SourceString->Length;
|
||||
|
||||
if (AllocateDestinationString == TRUE)
|
||||
{
|
||||
DestinationString->MaximumLength=SourceString->Length+sizeof(WCHAR);
|
||||
|
@ -1165,6 +1153,12 @@ RtlUpcaseUnicodeString (
|
|||
if (DestinationString->Buffer == NULL)
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SourceString->Length >= DestinationString->MaximumLength)
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
DestinationString->Length = SourceString->Length;
|
||||
|
||||
Src = SourceString->Buffer;
|
||||
Dest = DestinationString->Buffer;
|
||||
|
@ -1196,11 +1190,6 @@ RtlUpcaseUnicodeStringToAnsiString (
|
|||
else
|
||||
Length = SourceString->Length / sizeof(WCHAR);
|
||||
|
||||
// if (Length > 65535)
|
||||
// return STATUS_INVALID_PARAMETER_2;
|
||||
|
||||
DestinationString->Length = Length;
|
||||
|
||||
if (AllocateDestinationString == TRUE)
|
||||
{
|
||||
DestinationString->MaximumLength = Length + sizeof(CHAR);
|
||||
|
@ -1212,9 +1201,10 @@ RtlUpcaseUnicodeStringToAnsiString (
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Length >= DestinationString->Length)
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
if (Length >= DestinationString->MaximumLength)
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
DestinationString->Length = Length;
|
||||
|
||||
RtlZeroMemory (DestinationString->Buffer,
|
||||
DestinationString->Length);
|
||||
|
@ -1262,11 +1252,6 @@ RtlUpcaseUnicodeStringToOemString (
|
|||
else
|
||||
Length = SourceString->Length / sizeof(WCHAR);
|
||||
|
||||
// if (Length > 65535)
|
||||
// return STATUS_INVALID_PARAMETER_2;
|
||||
|
||||
DestinationString->Length = Length;
|
||||
|
||||
if (AllocateDestinationString == TRUE)
|
||||
{
|
||||
DestinationString->MaximumLength = Length + sizeof(CHAR);
|
||||
|
@ -1278,9 +1263,10 @@ RtlUpcaseUnicodeStringToOemString (
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Length >= DestinationString->Length)
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
if (Length >= DestinationString->MaximumLength)
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
DestinationString->Length = Length;
|
||||
|
||||
RtlZeroMemory (DestinationString->Buffer,
|
||||
DestinationString->Length);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: unicode.c,v 1.10 1999/11/25 23:34:43 ekohl Exp $
|
||||
/* $Id: unicode.c,v 1.11 1999/12/10 17:49:21 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -76,8 +76,6 @@ RtlAnsiStringToUnicodeString (
|
|||
if (Length > 65535)
|
||||
return STATUS_INVALID_PARAMETER_2;
|
||||
|
||||
DestinationString->Length = Length;
|
||||
|
||||
if (AllocateDestinationString == TRUE)
|
||||
{
|
||||
DestinationString->MaximumLength = Length + sizeof(WCHAR);
|
||||
|
@ -89,13 +87,13 @@ RtlAnsiStringToUnicodeString (
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Length > DestinationString->Length)
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
if (Length > DestinationString->MaximumLength)
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
DestinationString->Length = Length;
|
||||
|
||||
memset (DestinationString->Buffer,
|
||||
0,
|
||||
DestinationString->Length);
|
||||
RtlZeroMemory (DestinationString->Buffer,
|
||||
DestinationString->Length);
|
||||
|
||||
Status = RtlMultiByteToUnicodeN (DestinationString->Buffer,
|
||||
DestinationString->Length,
|
||||
|
@ -464,7 +462,6 @@ RtlDowncaseUnicodeString (
|
|||
|
||||
if (AllocateDestinationString == TRUE)
|
||||
{
|
||||
DestinationString->Length = SourceString->Length;
|
||||
DestinationString->MaximumLength = SourceString->Length + sizeof(WCHAR);
|
||||
DestinationString->Buffer = ExAllocatePool (NonPagedPool,
|
||||
SourceString->Length + sizeof(WCHAR));
|
||||
|
@ -474,8 +471,9 @@ RtlDowncaseUnicodeString (
|
|||
else
|
||||
{
|
||||
if (SourceString->Length >= DestinationString->MaximumLength)
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
DestinationString->Length = SourceString->Length;
|
||||
|
||||
Src = SourceString->Buffer;
|
||||
Dest = DestinationString->Buffer;
|
||||
|
@ -844,8 +842,6 @@ RtlOemStringToUnicodeString (
|
|||
if (Length > 65535)
|
||||
return STATUS_INVALID_PARAMETER_2;
|
||||
|
||||
DestinationString->Length = Length;
|
||||
|
||||
if (AllocateDestinationString == TRUE)
|
||||
{
|
||||
DestinationString->MaximumLength = Length + sizeof(WCHAR);
|
||||
|
@ -857,13 +853,13 @@ RtlOemStringToUnicodeString (
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Length > DestinationString->Length)
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
if (Length >= DestinationString->MaximumLength)
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
DestinationString->Length = Length;
|
||||
|
||||
memset (DestinationString->Buffer,
|
||||
0,
|
||||
DestinationString->Length);
|
||||
RtlZeroMemory (DestinationString->Buffer,
|
||||
DestinationString->Length);
|
||||
|
||||
Status = RtlOemToUnicodeN (DestinationString->Buffer,
|
||||
DestinationString->Length,
|
||||
|
@ -913,11 +909,6 @@ RtlUnicodeStringToAnsiString (
|
|||
else
|
||||
Length = SourceString->Length / sizeof(WCHAR);
|
||||
|
||||
// if (Length > 65535)
|
||||
// return STATUS_INVALID_PARAMETER_2;
|
||||
|
||||
DestinationString->Length = Length;
|
||||
|
||||
if (AllocateDestinationString == TRUE)
|
||||
{
|
||||
DestinationString->MaximumLength = Length + sizeof(CHAR);
|
||||
|
@ -928,9 +919,10 @@ RtlUnicodeStringToAnsiString (
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Length >= DestinationString->Length)
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
if (Length >= DestinationString->MaximumLength)
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
DestinationString->Length = Length;
|
||||
|
||||
RtlZeroMemory (DestinationString->Buffer,
|
||||
DestinationString->Length);
|
||||
|
@ -1058,11 +1050,6 @@ RtlUnicodeStringToOemString (
|
|||
else
|
||||
Length = SourceString->Length / sizeof(WCHAR);
|
||||
|
||||
// if (Length > 65535)
|
||||
// return STATUS_INVALID_PARAMETER_2;
|
||||
|
||||
DestinationString->Length = Length;
|
||||
|
||||
if (AllocateDestinationString == TRUE)
|
||||
{
|
||||
DestinationString->MaximumLength = Length + sizeof(CHAR);
|
||||
|
@ -1074,9 +1061,10 @@ RtlUnicodeStringToOemString (
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Length >= DestinationString->Length)
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
if (Length >= DestinationString->MaximumLength)
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
DestinationString->Length = Length;
|
||||
|
||||
RtlZeroMemory (DestinationString->Buffer,
|
||||
DestinationString->Length);
|
||||
|
@ -1130,7 +1118,6 @@ RtlUpcaseUnicodeString (
|
|||
|
||||
if (AllocateDestinationString == TRUE)
|
||||
{
|
||||
DestinationString->Length = SourceString->Length;
|
||||
DestinationString->MaximumLength = SourceString->Length + sizeof(WCHAR);
|
||||
DestinationString->Buffer = ExAllocatePool (NonPagedPool,
|
||||
SourceString->Length + sizeof(WCHAR));
|
||||
|
@ -1140,8 +1127,9 @@ RtlUpcaseUnicodeString (
|
|||
else
|
||||
{
|
||||
if (SourceString->Length >= DestinationString->MaximumLength)
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
DestinationString->Length = SourceString->Length;
|
||||
|
||||
Src = SourceString->Buffer;
|
||||
Dest = DestinationString->Buffer;
|
||||
|
@ -1173,11 +1161,6 @@ RtlUpcaseUnicodeStringToAnsiString (
|
|||
else
|
||||
Length = SourceString->Length / sizeof(WCHAR);
|
||||
|
||||
// if (Length > 65535)
|
||||
// return STATUS_INVALID_PARAMETER_2;
|
||||
|
||||
DestinationString->Length = Length;
|
||||
|
||||
if (AllocateDestinationString == TRUE)
|
||||
{
|
||||
DestinationString->MaximumLength = Length + sizeof(CHAR);
|
||||
|
@ -1188,9 +1171,10 @@ RtlUpcaseUnicodeStringToAnsiString (
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Length >= DestinationString->Length)
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
if (Length >= DestinationString->MaximumLength)
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
DestinationString->Length = Length;
|
||||
|
||||
RtlZeroMemory (DestinationString->Buffer,
|
||||
DestinationString->Length);
|
||||
|
@ -1234,11 +1218,6 @@ RtlUpcaseUnicodeStringToOemString (
|
|||
else
|
||||
Length = SourceString->Length / sizeof(WCHAR);
|
||||
|
||||
// if (Length > 65535)
|
||||
// return STATUS_INVALID_PARAMETER_2;
|
||||
|
||||
DestinationString->Length = Length;
|
||||
|
||||
if (AllocateDestinationString == TRUE)
|
||||
{
|
||||
DestinationString->MaximumLength = Length + sizeof(CHAR);
|
||||
|
@ -1249,9 +1228,10 @@ RtlUpcaseUnicodeStringToOemString (
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Length >= DestinationString->Length)
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
if (Length >= DestinationString->MaximumLength)
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
DestinationString->Length = Length;
|
||||
|
||||
RtlZeroMemory (DestinationString->Buffer,
|
||||
DestinationString->Length);
|
||||
|
|
Loading…
Reference in a new issue