mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 15:23:03 +00:00
Stefan Ginsberg <stefan__100__@hotmail.com>
- Remove usage of unexported RtlDuplicateUnicodeString in green.sys driver (this is basically the same fix which Herve applied to blue.sys). svn path=/trunk/; revision=33758
This commit is contained in:
parent
802eba95c5
commit
c5fa27e2d7
3 changed files with 59 additions and 12 deletions
|
@ -41,13 +41,13 @@ DriverEntry(
|
||||||
}
|
}
|
||||||
RtlZeroMemory(DriverExtension, sizeof(GREEN_DRIVER_EXTENSION));
|
RtlZeroMemory(DriverExtension, sizeof(GREEN_DRIVER_EXTENSION));
|
||||||
|
|
||||||
Status = RtlDuplicateUnicodeString(
|
Status = GreenDuplicateUnicodeString(
|
||||||
0,
|
0,
|
||||||
RegistryPath,
|
RegistryPath,
|
||||||
&DriverExtension->RegistryPath);
|
&DriverExtension->RegistryPath);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("RtlDuplicateUnicodeString() failed with status 0x%08lx\n", Status);
|
DPRINT("GreenDuplicateUnicodeString() failed with status 0x%08lx\n", Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,3 +66,48 @@ DriverEntry(
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
GreenDuplicateUnicodeString(
|
||||||
|
IN ULONG Flags,
|
||||||
|
IN PCUNICODE_STRING SourceString,
|
||||||
|
OUT PUNICODE_STRING DestinationString)
|
||||||
|
{
|
||||||
|
if (SourceString == NULL || DestinationString == NULL
|
||||||
|
|| SourceString->Length > SourceString->MaximumLength
|
||||||
|
|| (SourceString->Length == 0 && SourceString->MaximumLength > 0 && SourceString->Buffer == NULL)
|
||||||
|
|| Flags == RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING || Flags >= 4)
|
||||||
|
{
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ((SourceString->Length == 0)
|
||||||
|
&& (Flags != (RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE |
|
||||||
|
RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING)))
|
||||||
|
{
|
||||||
|
DestinationString->Length = 0;
|
||||||
|
DestinationString->MaximumLength = 0;
|
||||||
|
DestinationString->Buffer = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
USHORT DestMaxLength = SourceString->Length;
|
||||||
|
|
||||||
|
if (Flags & RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE)
|
||||||
|
DestMaxLength += sizeof(UNICODE_NULL);
|
||||||
|
|
||||||
|
DestinationString->Buffer = ExAllocatePool(PagedPool, DestMaxLength);
|
||||||
|
if (DestinationString->Buffer == NULL)
|
||||||
|
return STATUS_NO_MEMORY;
|
||||||
|
|
||||||
|
RtlCopyMemory(DestinationString->Buffer, SourceString->Buffer, SourceString->Length);
|
||||||
|
DestinationString->Length = SourceString->Length;
|
||||||
|
DestinationString->MaximumLength = DestMaxLength;
|
||||||
|
|
||||||
|
if (Flags & RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE)
|
||||||
|
DestinationString->Buffer[DestinationString->Length / sizeof(WCHAR)] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
|
@ -9,15 +9,8 @@ typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES;
|
||||||
#include <wincon.h>
|
#include <wincon.h>
|
||||||
#include <drivers/blue/ntddblue.h>
|
#include <drivers/blue/ntddblue.h>
|
||||||
|
|
||||||
NTSYSAPI
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
RtlDuplicateUnicodeString(
|
|
||||||
IN ULONG Flags,
|
|
||||||
IN PCUNICODE_STRING SourceString,
|
|
||||||
OUT PUNICODE_STRING DestinationString
|
|
||||||
);
|
|
||||||
#define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE 1
|
#define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE 1
|
||||||
|
#define RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING 2
|
||||||
|
|
||||||
#define INFINITE -1
|
#define INFINITE -1
|
||||||
#define KEYBOARD_BUFFER_SIZE 100
|
#define KEYBOARD_BUFFER_SIZE 100
|
||||||
|
@ -190,3 +183,11 @@ NTSTATUS
|
||||||
ScreenDeviceControl(
|
ScreenDeviceControl(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp);
|
IN PIRP Irp);
|
||||||
|
|
||||||
|
/************************************ green.c */
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
GreenDuplicateUnicodeString(
|
||||||
|
IN ULONG Flags,
|
||||||
|
IN PCUNICODE_STRING SourceString,
|
||||||
|
OUT PUNICODE_STRING DestinationString);
|
||||||
|
|
|
@ -343,7 +343,7 @@ GreenQueryId(
|
||||||
{
|
{
|
||||||
UNICODE_STRING SourceU, String;
|
UNICODE_STRING SourceU, String;
|
||||||
RtlInitUnicodeString(&SourceU, Source);
|
RtlInitUnicodeString(&SourceU, Source);
|
||||||
Status = RtlDuplicateUnicodeString(
|
Status = GreenDuplicateUnicodeString(
|
||||||
RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
|
RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
|
||||||
&SourceU,
|
&SourceU,
|
||||||
&String);
|
&String);
|
||||||
|
@ -377,7 +377,7 @@ GreenQueryId(
|
||||||
if (SourceU.Length)
|
if (SourceU.Length)
|
||||||
{
|
{
|
||||||
UNICODE_STRING String;
|
UNICODE_STRING String;
|
||||||
Status = RtlDuplicateUnicodeString(
|
Status = GreenDuplicateUnicodeString(
|
||||||
RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
|
RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
|
||||||
&SourceU,
|
&SourceU,
|
||||||
&String);
|
&String);
|
||||||
|
@ -560,3 +560,4 @@ GreenPnp(
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue