{
LPTSTR Environ, Name, Value;
SETLOCAL *Saved;
/* Pop a SETLOCAL struct off of this batch file's stack */if (!bc || !(Saved = bc->setlocal))
return 0;
bc->setlocal = Saved->Prev;
bDelayedExpansion = Saved->DelayedExpansion;
/* First, clear out the environment. Since making any changes to the * environment invalidates pointers obtained from GetEnvironmentStrings(), * we must make a copy of it and get the variable names from that */
Environ = DuplicateEnvironment();
if (Environ)
{
for (Name = Environ; *Name; Name += _tcslen(Name) + 1)
{
if (!(Value = _tcschr(Name + 1, _T('='))))
continue;
*Value++ = _T('\0');
SetEnvironmentVariable(Name, NULL);
Name = Value;
}
cmd_free(Environ);
}
/* Now, restore variables from the copy saved by cmd_setlocal */for (Name = Saved->Environment; *Name; Name += _tcslen(Name) + 1)
{
if (!(Value = _tcschr(Name + 1, _T('='))))
continue;
*Value++ = _T('\0');
SetEnvironmentVariable(Name, Value);
Name = Value;
}
cmd_free(Saved->Environment);
cmd_free(Saved);
return 0;
}
Generated on Sun May 27 2012 04:46:05 for ReactOS by
1.7.6.1
ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.