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
45824821
Commit
45824821
authored
Jan 28, 2009
by
Aric Stewart
Committed by
Alexandre Julliard
Jan 28, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg.exe: Implement DELETE.
parent
647a087e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
121 additions
and
1 deletion
+121
-1
En.rc
programs/reg/En.rc
+1
-0
reg.c
programs/reg/reg.c
+119
-1
reg.h
programs/reg/reg.h
+1
-0
No files found.
programs/reg/En.rc
View file @
45824821
...
...
@@ -31,4 +31,5 @@ STRINGTABLE
STRING_INVALID_KEY, "Error: Invalid key name\n"
STRING_INVALID_CMDLINE, "Error: Invalid command line parameters\n"
STRING_NO_REMOTE, "Error: Unable to add keys to remote machine\n"
STRING_CANNOT_FIND, "Error: The system was unable to find the specified registry key or value\n"
}
programs/reg/reg.c
View file @
45824821
...
...
@@ -209,11 +209,129 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
static
int
reg_delete
(
WCHAR
*
key_name
,
WCHAR
*
value_name
,
BOOL
value_empty
,
BOOL
value_all
,
BOOL
force
)
{
static
const
WCHAR
stubW
[]
=
{
'S'
,
'T'
,
'U'
,
'B'
,
' '
,
'D'
,
'E'
,
'L'
,
'E'
,
'T'
,
'E'
,
LPWSTR
p
;
HKEY
root
,
subkey
;
static
const
WCHAR
stubW
[]
=
{
'D'
,
'E'
,
'L'
,
'E'
,
'T'
,
'E'
,
' '
,
'-'
,
' '
,
'%'
,
's'
,
' '
,
'%'
,
's'
,
' '
,
'%'
,
'd'
,
' '
,
'%'
,
'd'
,
' '
,
'%'
,
'd'
,
'\n'
,
0
};
reg_printfW
(
stubW
,
key_name
,
value_name
,
value_empty
,
value_all
,
force
);
if
(
key_name
[
0
]
==
'\\'
&&
key_name
[
1
]
==
'\\'
)
{
reg_message
(
STRING_NO_REMOTE
);
return
0
;
}
p
=
strchrW
(
key_name
,
'\\'
);
if
(
!
p
)
{
reg_message
(
STRING_INVALID_KEY
);
return
0
;
}
p
++
;
root
=
get_rootkey
(
key_name
);
if
(
!
root
)
{
reg_message
(
STRING_INVALID_KEY
);
return
0
;
}
if
(
value_name
&&
value_empty
)
{
RegCloseKey
(
subkey
);
reg_message
(
STRING_INVALID_CMDLINE
);
return
0
;
}
if
(
value_empty
&&
value_all
)
{
RegCloseKey
(
subkey
);
reg_message
(
STRING_INVALID_CMDLINE
);
return
0
;
}
if
(
!
force
)
{
/* FIXME: Prompt for delete */
}
if
(
!
value_name
)
{
if
(
RegDeleteTreeW
(
root
,
p
)
!=
ERROR_SUCCESS
)
{
reg_message
(
STRING_CANNOT_FIND
);
return
0
;
}
reg_message
(
STRING_SUCCESS
);
return
1
;
}
if
(
RegOpenKeyW
(
root
,
p
,
&
subkey
)
!=
ERROR_SUCCESS
)
{
reg_message
(
STRING_CANNOT_FIND
);
return
0
;
}
if
(
value_all
)
{
LPWSTR
szValue
;
DWORD
maxValue
;
DWORD
count
;
LONG
rc
;
if
(
value_name
)
{
RegCloseKey
(
subkey
);
reg_message
(
STRING_INVALID_CMDLINE
);
return
0
;
}
rc
=
RegQueryInfoKeyW
(
subkey
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
&
maxValue
,
NULL
,
NULL
,
NULL
);
if
(
rc
!=
ERROR_SUCCESS
)
{
/* FIXME: failure */
RegCloseKey
(
subkey
);
return
0
;
}
maxValue
++
;
szValue
=
HeapAlloc
(
GetProcessHeap
(),
0
,
maxValue
*
sizeof
(
WCHAR
));
while
(
1
)
{
count
=
maxValue
;
rc
=
RegEnumValueW
(
subkey
,
0
,
value_name
,
&
count
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
rc
==
ERROR_SUCCESS
)
{
rc
=
RegDeleteValueW
(
subkey
,
value_name
);
if
(
rc
!=
ERROR_SUCCESS
)
break
;
}
else
break
;
}
if
(
rc
!=
ERROR_SUCCESS
)
{
/* FIXME delete failed */
}
}
else
if
(
value_name
)
{
if
(
RegDeleteValueW
(
subkey
,
value_name
)
!=
ERROR_SUCCESS
)
{
RegCloseKey
(
subkey
);
reg_message
(
STRING_CANNOT_FIND
);
return
0
;
}
}
else
if
(
value_empty
)
{
RegSetValueExW
(
subkey
,
NULL
,
0
,
REG_SZ
,
NULL
,
0
);
}
RegCloseKey
(
subkey
);
reg_message
(
STRING_SUCCESS
);
return
1
;
}
...
...
programs/reg/reg.h
View file @
45824821
...
...
@@ -27,3 +27,4 @@
#define STRING_INVALID_KEY 106
#define STRING_INVALID_CMDLINE 107
#define STRING_NO_REMOTE 108
#define STRING_CANNOT_FIND 109
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