Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
434c345e
Commit
434c345e
authored
Mar 30, 2021
by
Hugh McMaster
Committed by
Alexandre Julliard
Mar 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg: Parse 'reg delete' command-line arguments in delete.c.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
62f96b03
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
19 deletions
+67
-19
delete.c
programs/reg/delete.c
+59
-2
reg.c
programs/reg/reg.c
+7
-15
reg.h
programs/reg/reg.h
+1
-2
No files found.
programs/reg/delete.c
View file @
434c345e
...
...
@@ -18,8 +18,8 @@
#include "reg.h"
int
reg
_delete
(
HKEY
root
,
WCHAR
*
path
,
WCHAR
*
key_name
,
WCHAR
*
value_name
,
BOOL
value_empty
,
BOOL
value_all
,
BOOL
force
)
static
int
run
_delete
(
HKEY
root
,
WCHAR
*
path
,
WCHAR
*
key_name
,
WCHAR
*
value_name
,
BOOL
value_empty
,
BOOL
value_all
,
BOOL
force
)
{
HKEY
key
;
...
...
@@ -105,3 +105,60 @@ int reg_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name,
output_message
(
STRING_SUCCESS
);
return
0
;
}
int
reg_delete
(
int
argc
,
WCHAR
*
argvW
[])
{
HKEY
root
;
WCHAR
*
path
,
*
key_name
,
*
value_name
=
NULL
;
BOOL
value_all
=
FALSE
,
value_empty
=
FALSE
,
force
=
FALSE
;
int
i
;
if
(
!
parse_registry_key
(
argvW
[
2
],
&
root
,
&
path
,
&
key_name
))
return
1
;
for
(
i
=
3
;
i
<
argc
;
i
++
)
{
if
(
argvW
[
i
][
0
]
==
'/'
||
argvW
[
i
][
0
]
==
'-'
)
{
WCHAR
*
str
=
&
argvW
[
i
][
1
];
if
(
!
lstrcmpiW
(
str
,
L"va"
))
{
if
(
value_all
)
goto
invalid
;
value_all
=
TRUE
;
continue
;
}
else
if
(
!
lstrcmpiW
(
str
,
L"ve"
))
{
if
(
value_empty
)
goto
invalid
;
value_empty
=
TRUE
;
continue
;
}
else
if
(
!
str
[
0
]
||
str
[
1
])
goto
invalid
;
switch
(
towlower
(
*
str
))
{
case
'v'
:
if
(
value_name
||
!
(
value_name
=
argvW
[
++
i
]))
goto
invalid
;
break
;
case
'f'
:
if
(
force
)
goto
invalid
;
force
=
TRUE
;
break
;
default:
goto
invalid
;
}
}
}
if
((
value_name
&&
value_empty
)
||
(
value_name
&&
value_all
)
||
(
value_empty
&&
value_all
))
goto
invalid
;
return
run_delete
(
root
,
path
,
key_name
,
value_name
,
value_empty
,
value_all
,
force
);
invalid:
output_message
(
STRING_INVALID_CMDLINE
);
return
1
;
}
programs/reg/reg.c
View file @
434c345e
...
...
@@ -333,11 +333,10 @@ static enum operations get_operation(const WCHAR *str, int *op_help)
int
__cdecl
wmain
(
int
argc
,
WCHAR
*
argvW
[])
{
int
i
,
op
,
op_help
,
ret
;
static
const
WCHAR
switchVAW
[]
=
{
'v'
,
'a'
,
0
};
int
i
,
op
,
op_help
;
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
,
force
=
FALSE
;
BOOL
value_empty
=
FALSE
,
force
=
FALSE
;
HKEY
root
;
if
(
argc
==
1
)
...
...
@@ -374,6 +373,9 @@ int __cdecl wmain(int argc, WCHAR *argvW[])
return
0
;
}
if
(
op
==
REG_DELETE
)
return
reg_delete
(
argc
,
argvW
);
if
(
op
==
REG_EXPORT
)
return
reg_export
(
argc
,
argvW
);
...
...
@@ -397,11 +399,6 @@ int __cdecl wmain(int argc, WCHAR *argvW[])
value_empty
=
TRUE
;
continue
;
}
else
if
(
!
lstrcmpiW
(
ptr
,
switchVAW
))
{
value_all
=
TRUE
;
continue
;
}
else
if
(
!
ptr
[
0
]
||
ptr
[
1
])
{
output_message
(
STRING_INVALID_CMDLINE
);
...
...
@@ -450,16 +447,11 @@ int __cdecl wmain(int argc, WCHAR *argvW[])
}
}
if
(
(
value_name
&&
value_empty
)
||
(
value_name
&&
value_all
)
||
(
value_empty
&&
value_all
)
)
if
(
value_name
&&
value_empty
)
{
output_message
(
STRING_INVALID_CMDLINE
);
return
1
;
}
if
(
op
==
REG_ADD
)
ret
=
reg_add
(
root
,
path
,
value_name
,
value_empty
,
type
,
separator
,
data
,
force
);
else
ret
=
reg_delete
(
root
,
path
,
key_name
,
value_name
,
value_empty
,
value_all
,
force
);
return
ret
;
return
reg_add
(
root
,
path
,
value_name
,
value_empty
,
type
,
separator
,
data
,
force
);
}
programs/reg/reg.h
View file @
434c345e
...
...
@@ -47,8 +47,7 @@ int reg_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty,
WCHAR
*
type
,
WCHAR
separator
,
WCHAR
*
data
,
BOOL
force
);
/* delete.c */
int
reg_delete
(
HKEY
root
,
WCHAR
*
path
,
WCHAR
*
key_name
,
WCHAR
*
value_name
,
BOOL
value_empty
,
BOOL
value_all
,
BOOL
force
);
int
reg_delete
(
int
argc
,
WCHAR
*
argvW
[]);
/* export.c */
int
reg_export
(
int
argc
,
WCHAR
*
argvW
[]);
...
...
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