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
0481f31d
Commit
0481f31d
authored
Apr 25, 2017
by
Hugh McMaster
Committed by
Alexandre Julliard
Apr 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regedit: Simplify parseKeyName.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
bb52c598
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
38 deletions
+15
-38
regproc.c
programs/regedit/regproc.c
+15
-38
No files found.
programs/regedit/regproc.c
View file @
0481f31d
...
...
@@ -301,50 +301,27 @@ static int REGPROC_unescape_string(WCHAR* str)
return
val_idx
;
}
static
BOOL
parseKeyName
(
LPWSTR
lpKeyName
,
HKEY
*
hKey
,
LPWSTR
*
lpKeyPath
)
static
HKEY
parseKeyName
(
LPWSTR
lpKeyName
,
LPWSTR
*
lpKeyPath
)
{
WCHAR
*
lpSlash
=
NULL
;
unsigned
int
i
,
len
;
unsigned
int
i
;
if
(
lpKeyName
==
NULL
)
return
FALSE
;
return
0
;
for
(
i
=
0
;
*
(
lpKeyName
+
i
)
!=
0
;
i
++
)
{
if
(
*
(
lpKeyName
+
i
)
==
'\\'
)
{
lpSlash
=
lpKeyName
+
i
;
break
;
}
}
*
lpKeyPath
=
strchrW
(
lpKeyName
,
'\\'
);
if
(
*
lpKeyPath
)
(
*
lpKeyPath
)
++
;
if
(
lpSlash
)
{
len
=
lpSlash
-
lpKeyName
;
}
else
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
reg_class_keys
);
i
++
)
{
len
=
lstrlenW
(
lpKeyName
);
lpSlash
=
lpKeyName
+
len
;
}
*
hKey
=
NULL
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
reg_class_keys
);
i
++
)
{
if
(
CompareStringW
(
LOCALE_USER_DEFAULT
,
0
,
lpKeyName
,
len
,
reg_class_namesW
[
i
],
-
1
)
==
CSTR_EQUAL
&&
len
==
lstrlenW
(
reg_class_namesW
[
i
]))
{
*
hKey
=
reg_class_keys
[
i
];
break
;
int
len
=
lstrlenW
(
reg_class_namesW
[
i
]);
if
(
!
strncmpW
(
lpKeyName
,
reg_class_namesW
[
i
],
len
)
&&
(
lpKeyName
[
len
]
==
0
||
lpKeyName
[
len
]
==
'\\'
))
{
return
reg_class_keys
[
i
];
}
}
if
(
*
hKey
==
NULL
)
return
FALSE
;
if
(
*
lpSlash
!=
'\0'
)
lpSlash
++
;
*
lpKeyPath
=
lpSlash
;
return
TRUE
;
return
0
;
}
/* Globals used by the setValue() & co */
...
...
@@ -490,7 +467,7 @@ static LONG openKeyW(WCHAR* stdInput)
return
ERROR_INVALID_PARAMETER
;
/* Get the registry class */
if
(
!
parseKeyName
(
stdInput
,
&
keyClass
,
&
keyPath
))
if
(
!
(
keyClass
=
parseKeyName
(
stdInput
,
&
keyPath
)
))
return
ERROR_INVALID_PARAMETER
;
res
=
RegCreateKeyExW
(
...
...
@@ -1323,7 +1300,7 @@ BOOL export_registry_key(WCHAR *file_name, WCHAR *reg_key_name, DWORD format)
lstrcpyW
(
reg_key_name_buf
,
reg_key_name
);
/* open the specified key */
if
(
!
parseKeyName
(
reg_key_name
,
&
reg_key_class
,
&
branch_name
))
{
if
(
!
(
reg_key_class
=
parseKeyName
(
reg_key_name
,
&
branch_name
)
))
{
output_message
(
STRING_INCORRECT_REG_CLASS
,
reg_key_name
);
exit
(
1
);
}
...
...
@@ -1408,7 +1385,7 @@ void delete_registry_key(WCHAR *reg_key_name)
if
(
!
reg_key_name
||
!
reg_key_name
[
0
])
return
;
if
(
!
parseKeyName
(
reg_key_name
,
&
key_class
,
&
key_name
))
{
if
(
!
(
key_class
=
parseKeyName
(
reg_key_name
,
&
key_name
)
))
{
output_message
(
STRING_INCORRECT_REG_CLASS
,
reg_key_name
);
exit
(
1
);
}
...
...
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