mirror of
https://github.com/reactos/reactos.git
synced 2024-07-21 11:48:04 +00:00
Revert last patch.
svn path=/trunk/; revision=3186
This commit is contained in:
parent
8fc03ec0f6
commit
5e114ab271
|
@ -1,4 +1,4 @@
|
|||
/* $Id: env.c,v 1.14 2002/07/05 17:23:05 ekohl Exp $
|
||||
/* $Id: env.c,v 1.15 2002/07/06 17:38:06 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -180,6 +180,7 @@ copy:
|
|||
dst_max--;
|
||||
src_len--;
|
||||
}
|
||||
|
||||
Destination->Length = (d - Destination->Buffer) * sizeof(WCHAR);
|
||||
if (Length != NULL)
|
||||
*Length = Destination->Length;
|
||||
|
@ -187,7 +188,7 @@ copy:
|
|||
Destination->Buffer[Destination->Length / sizeof(WCHAR)] = 0;
|
||||
|
||||
DPRINT("Destination %wZ\n", Destination);
|
||||
return Status;
|
||||
return(Status);
|
||||
}
|
||||
|
||||
|
||||
|
@ -218,7 +219,7 @@ RtlSetEnvironmentVariable(PWSTR *Environment,
|
|||
PUNICODE_STRING Value)
|
||||
{
|
||||
MEMORY_BASIC_INFORMATION mbi;
|
||||
UNICODE_STRING var, ExpandedValue;
|
||||
UNICODE_STRING var;
|
||||
int hole_len, new_len, env_len = 0;
|
||||
WCHAR *new_env = 0, *env_end = 0, *wcs, *env, *val = 0, *tail = 0, *hole = 0;
|
||||
PWSTR head = NULL;
|
||||
|
@ -283,45 +284,11 @@ RtlSetEnvironmentVariable(PWSTR *Environment,
|
|||
}
|
||||
|
||||
found:
|
||||
/* Perform inline replacement if Value references existing vars */
|
||||
/* ex: SET PATH=C:\MinGW\Bin;%PATH% */
|
||||
|
||||
ExpandedValue.MaximumLength = (env_len + Value->Length) * 2 * sizeof(WCHAR);
|
||||
ExpandedValue.Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
|
||||
0,
|
||||
ExpandedValue.MaximumLength + 1);
|
||||
if (ExpandedValue.Buffer == NULL)
|
||||
{
|
||||
if (Environment == NULL)
|
||||
{
|
||||
RtlReleasePebLock();
|
||||
}
|
||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||
}
|
||||
ExpandedValue.Length = 0;
|
||||
ExpandedValue.Buffer[0] = (WCHAR)'\0';
|
||||
|
||||
Status = RtlExpandEnvironmentStrings_U(env,
|
||||
Value,
|
||||
&ExpandedValue,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RtlFreeHeap(RtlGetProcessHeap(),
|
||||
0,
|
||||
ExpandedValue.Buffer);
|
||||
if (Environment == NULL)
|
||||
{
|
||||
RtlReleasePebLock();
|
||||
}
|
||||
return(Status);
|
||||
}
|
||||
|
||||
if (ExpandedValue.Length > 0)
|
||||
if (Value->Length > 0)
|
||||
{
|
||||
hole_len = tail - hole;
|
||||
/* calculate new environment size */
|
||||
new_size = ExpandedValue.Length + sizeof(WCHAR);
|
||||
new_size = Value->Length + sizeof(WCHAR);
|
||||
/* adding new variable */
|
||||
if (f)
|
||||
new_size += Name->Length + sizeof(WCHAR);
|
||||
|
@ -345,9 +312,6 @@ found:
|
|||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RtlFreeHeap(RtlGetProcessHeap(),
|
||||
0,
|
||||
ExpandedValue.Buffer);
|
||||
if (Environment == NULL)
|
||||
{
|
||||
RtlReleasePebLock();
|
||||
|
@ -367,9 +331,6 @@ found:
|
|||
PAGE_READWRITE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RtlFreeHeap(RtlGetProcessHeap(),
|
||||
0,
|
||||
ExpandedValue.Buffer);
|
||||
if (Environment == NULL)
|
||||
{
|
||||
RtlReleasePebLock();
|
||||
|
@ -428,9 +389,9 @@ found:
|
|||
|
||||
/* copy value */
|
||||
memmove(hole,
|
||||
ExpandedValue.Buffer,
|
||||
ExpandedValue.Length);
|
||||
hole += ExpandedValue.Length / sizeof(WCHAR);
|
||||
Value->Buffer,
|
||||
Value->Length);
|
||||
hole += Value->Length / sizeof(WCHAR);
|
||||
*hole = 0;
|
||||
}
|
||||
else
|
||||
|
@ -448,9 +409,6 @@ found:
|
|||
}
|
||||
}
|
||||
|
||||
RtlFreeHeap(RtlGetProcessHeap(),
|
||||
0,
|
||||
ExpandedValue.Buffer);
|
||||
if (Environment == NULL)
|
||||
{
|
||||
RtlReleasePebLock();
|
||||
|
@ -483,7 +441,7 @@ RtlQueryEnvironmentVariable_U(PWSTR Environment,
|
|||
}
|
||||
|
||||
if (Environment == NULL)
|
||||
return STATUS_VARIABLE_NOT_FOUND;
|
||||
return(STATUS_VARIABLE_NOT_FOUND);
|
||||
|
||||
Value->Length = 0;
|
||||
if (SysEnvUsed == TRUE)
|
||||
|
@ -522,7 +480,7 @@ RtlQueryEnvironmentVariable_U(PWSTR Environment,
|
|||
if (SysEnvUsed == TRUE)
|
||||
RtlReleasePebLock();
|
||||
|
||||
return Status;
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
wcs++;
|
||||
|
@ -532,7 +490,7 @@ RtlQueryEnvironmentVariable_U(PWSTR Environment,
|
|||
RtlReleasePebLock();
|
||||
|
||||
DPRINT("Return STATUS_VARIABLE_NOT_FOUND\n");
|
||||
return STATUS_VARIABLE_NOT_FOUND;
|
||||
return(STATUS_VARIABLE_NOT_FOUND);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue