Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
f426ece3
Commit
f426ece3
authored
Jun 08, 2016
by
Hugh McMaster
Committed by
Alexandre Julliard
Jun 08, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg: Recognise switches beginning with a forward slash or hyphen.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
57c39cf2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
43 deletions
+56
-43
reg.c
programs/reg/reg.c
+52
-39
reg.c
programs/reg/tests/reg.c
+4
-4
No files found.
programs/reg/reg.c
View file @
f426ece3
...
...
@@ -858,16 +858,11 @@ int wmain(int argc, WCHAR *argvW[])
{
int
i
,
op
,
ret
;
BOOL
show_op_help
=
FALSE
;
static
const
WCHAR
switchVAW
[]
=
{
'v'
,
'a'
,
0
};
static
const
WCHAR
switchVEW
[]
=
{
'v'
,
'e'
,
0
};
WCHAR
*
key_name
,
*
path
,
*
value_name
=
NULL
,
*
type
=
NULL
,
*
data
=
NULL
,
separator
=
'\0'
;
BOOL
value_empty
=
FALSE
,
value_all
=
FALSE
,
recurse
=
FALSE
,
force
=
FALSE
;
HKEY
root
;
static
const
WCHAR
slashDW
[]
=
{
'/'
,
'd'
,
0
};
static
const
WCHAR
slashFW
[]
=
{
'/'
,
'f'
,
0
};
static
const
WCHAR
slashSW
[]
=
{
'/'
,
's'
,
0
};
static
const
WCHAR
slashTW
[]
=
{
'/'
,
't'
,
0
};
static
const
WCHAR
slashVW
[]
=
{
'/'
,
'v'
,
0
};
static
const
WCHAR
slashVAW
[]
=
{
'/'
,
'v'
,
'a'
,
0
};
static
const
WCHAR
slashVEW
[]
=
{
'/'
,
'v'
,
'e'
,
0
};
if
(
argc
==
1
)
{
...
...
@@ -928,54 +923,72 @@ int wmain(int argc, WCHAR *argvW[])
for
(
i
=
3
;
i
<
argc
;
i
++
)
{
if
(
!
lstrcmpiW
(
argvW
[
i
],
slashVW
)
)
if
(
argvW
[
i
][
0
]
==
'/'
||
argvW
[
i
][
0
]
==
'-'
)
{
if
(
value_name
||
!
(
value_name
=
argvW
[
++
i
]))
WCHAR
*
ptr
=
&
argvW
[
i
][
1
];
if
(
!
lstrcmpiW
(
ptr
,
switchVEW
))
{
output_message
(
STRING_INVALID_CMDLINE
)
;
return
1
;
value_empty
=
TRUE
;
continue
;
}
}
else
if
(
!
lstrcmpiW
(
argvW
[
i
],
slashVEW
))
value_empty
=
TRUE
;
else
if
(
!
lstrcmpiW
(
argvW
[
i
],
slashVAW
))
value_all
=
TRUE
;
else
if
(
!
lstrcmpiW
(
argvW
[
i
],
slashTW
))
{
if
(
type
||
!
(
type
=
argvW
[
++
i
]))
else
if
(
!
lstrcmpiW
(
ptr
,
switchVAW
))
{
output_message
(
STRING_INVALID_CMDLINE
)
;
return
1
;
value_all
=
TRUE
;
continue
;
}
}
else
if
(
!
lstrcmpiW
(
argvW
[
i
],
slashDW
))
{
if
(
data
||
!
(
data
=
argvW
[
++
i
]))
else
if
(
ptr
[
1
])
{
output_message
(
STRING_INVALID_CMDLINE
);
return
1
;
}
}
else
if
(
!
lstrcmpiW
(
argvW
[
i
],
slashSW
))
{
WCHAR
*
ptr
;
if
(
op
==
REG_QUERY
)
switch
(
tolowerW
(
argvW
[
i
][
1
])
)
{
recurse
=
TRUE
;
continue
;
}
case
'v'
:
if
(
value_name
||
!
(
value_name
=
argvW
[
++
i
]))
{
output_message
(
STRING_INVALID_CMDLINE
);
return
1
;
}
break
;
case
't'
:
if
(
type
||
!
(
type
=
argvW
[
++
i
]))
{
output_message
(
STRING_INVALID_CMDLINE
);
return
1
;
}
break
;
case
'd'
:
if
(
data
||
!
(
data
=
argvW
[
++
i
]))
{
output_message
(
STRING_INVALID_CMDLINE
);
return
1
;
}
break
;
case
's'
:
if
(
op
==
REG_QUERY
)
{
recurse
=
TRUE
;
break
;
}
ptr
=
argvW
[
++
i
];
if
(
!
ptr
||
strlenW
(
ptr
)
!=
1
)
{
ptr
=
argvW
[
++
i
];
if
(
!
ptr
||
strlenW
(
ptr
)
!=
1
)
{
output_message
(
STRING_INVALID_CMDLINE
);
return
1
;
}
separator
=
ptr
[
0
];
break
;
case
'f'
:
force
=
TRUE
;
break
;
default:
output_message
(
STRING_INVALID_CMDLINE
);
return
1
;
}
separator
=
ptr
[
0
];
}
else
if
(
!
lstrcmpiW
(
argvW
[
i
],
slashFW
))
force
=
TRUE
;
}
if
((
value_name
&&
value_empty
)
||
(
value_name
&&
value_all
)
||
(
value_empty
&&
value_all
))
...
...
programs/reg/tests/reg.c
View file @
f426ece3
...
...
@@ -452,16 +452,16 @@ static void test_add(void)
/* Test invalid switches */
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /v invalid1 /a"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u, expected 1
\n
"
,
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u, expected 1
\n
"
,
r
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /v invalid2 /ae"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u, expected 1
\n
"
,
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u, expected 1
\n
"
,
r
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /v invalid3 /"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u, expected 1
\n
"
,
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u, expected 1
\n
"
,
r
);
run_reg_exe
(
"reg add HKCU
\\
"
KEY_BASE
" /v invalid4 -"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u, expected 1
\n
"
,
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %u, expected 1
\n
"
,
r
);
err
=
RegDeleteKeyA
(
HKEY_CURRENT_USER
,
KEY_BASE
);
ok
(
err
==
ERROR_SUCCESS
,
"got %d
\n
"
,
err
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment