summaryrefslogtreecommitdiffstats
path: root/private/ntos/arcinst/jzcrap.c
blob: 8cc77c1a913c2b5e7f2a897f361fcce47822a81e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "precomp.h"
#pragma hdrstop

VOID
JzDeleteVariableSegment (
    PCHAR VariableName,
    ULONG Selection
    )
{
    PCHAR Variable;
    CHAR VariableValue[MAXIMUM_ENVIRONMENT_VALUE];
    ULONG Index;
    ULONG Count;
    BOOLEAN FirstSegment;

    if ((Variable = ArcGetEnvironmentVariable(VariableName)) == NULL) {
        return;
    }

    FirstSegment = TRUE;
    Index = 0;
    *VariableValue = 0;
    while (strchr(Variable,';') != NULL) {
        Count = strchr(Variable,';') - Variable;
        if (Index != Selection) {
            if (!FirstSegment) {
                strcat(VariableValue,";");
            }
            strncat(VariableValue, Variable, Count);
            FirstSegment = FALSE;
        }
        Variable += Count + 1;
        Index++;
    }

    if (Index != Selection) {
        if (!FirstSegment) {
            strcat(VariableValue,";");
        }
        strcat(VariableValue,Variable);
    }

    ArcSetEnvironmentVariable(VariableName, VariableValue);
    return;
}

PCHAR BootString[] = { "LOADIDENTIFIER",
                       "SYSTEMPARTITION",
                       "OSLOADER",
                       "OSLOADPARTITION",
                       "OSLOADFILENAME",
                       "OSLOADOPTIONS" };