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
c23da6c3
Commit
c23da6c3
authored
Jul 09, 2008
by
Alexander Nicolaysen Sørnes
Committed by
Alexandre Julliard
Jul 10, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regedit: Use RegSetValueExW when importing data.
parent
f4c3e0f4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
13 deletions
+18
-13
regproc.c
programs/regedit/regproc.c
+18
-13
No files found.
programs/regedit/regproc.c
View file @
c23da6c3
...
@@ -202,11 +202,11 @@ static DWORD getDataType(LPSTR *lpValue, DWORD* parse_type)
...
@@ -202,11 +202,11 @@ static DWORD getDataType(LPSTR *lpValue, DWORD* parse_type)
/******************************************************************************
/******************************************************************************
* Replaces escape sequences with the characters.
* Replaces escape sequences with the characters.
*/
*/
static
void
REGPROC_unescape_string
(
LPSTR
str
)
static
void
REGPROC_unescape_string
(
WCHAR
*
str
)
{
{
int
str_idx
=
0
;
/* current character under analysis */
int
str_idx
=
0
;
/* current character under analysis */
int
val_idx
=
0
;
/* the last character of the unescaped string */
int
val_idx
=
0
;
/* the last character of the unescaped string */
int
len
=
strlen
(
str
);
int
len
=
lstrlenW
(
str
);
for
(
str_idx
=
0
;
str_idx
<
len
;
str_idx
++
,
val_idx
++
)
{
for
(
str_idx
=
0
;
str_idx
<
len
;
str_idx
++
,
val_idx
++
)
{
if
(
str
[
str_idx
]
==
'\\'
)
{
if
(
str
[
str_idx
]
==
'\\'
)
{
str_idx
++
;
str_idx
++
;
...
@@ -328,7 +328,7 @@ static HKEY currentKeyHandle = NULL;
...
@@ -328,7 +328,7 @@ static HKEY currentKeyHandle = NULL;
* val_name - name of the registry value
* val_name - name of the registry value
* val_data - registry value data
* val_data - registry value data
*/
*/
static
LONG
setValue
(
LPSTR
val_name
,
LPSTR
val_data
)
static
LONG
setValue
(
WCHAR
*
val_name
,
LPSTR
val_data
)
{
{
LONG
res
;
LONG
res
;
DWORD
dwDataType
,
dwParseType
;
DWORD
dwDataType
,
dwParseType
;
...
@@ -340,7 +340,7 @@ static LONG setValue(LPSTR val_name, LPSTR val_data)
...
@@ -340,7 +340,7 @@ static LONG setValue(LPSTR val_name, LPSTR val_data)
if
(
strcmp
(
val_data
,
"-"
)
==
0
)
if
(
strcmp
(
val_data
,
"-"
)
==
0
)
{
{
res
=
RegDeleteValue
(
currentKeyHandle
,
val_name
);
res
=
RegDeleteValue
W
(
currentKeyHandle
,
val_name
);
return
(
res
==
ERROR_FILE_NOT_FOUND
?
ERROR_SUCCESS
:
res
);
return
(
res
==
ERROR_FILE_NOT_FOUND
?
ERROR_SUCCESS
:
res
);
}
}
...
@@ -349,19 +349,21 @@ static LONG setValue(LPSTR val_name, LPSTR val_data)
...
@@ -349,19 +349,21 @@ static LONG setValue(LPSTR val_name, LPSTR val_data)
if
(
dwParseType
==
REG_SZ
)
/* no conversion for string */
if
(
dwParseType
==
REG_SZ
)
/* no conversion for string */
{
{
REGPROC_unescape_string
(
val_data
);
WCHAR
*
val_dataW
=
GetWideString
(
val_data
,
lstrlenA
(
val_data
)
+
1
);
REGPROC_unescape_string
(
val_dataW
);
/* Compute dwLen after REGPROC_unescape_string because it may
/* Compute dwLen after REGPROC_unescape_string because it may
* have changed the string length and we don't want to store
* have changed the string length and we don't want to store
* the extra garbage in the registry.
* the extra garbage in the registry.
*/
*/
dwLen
=
strlen
(
val_data
);
dwLen
=
lstrlenW
(
val_dataW
);
if
(
dwLen
>
0
&&
val_data
[
dwLen
-
1
]
==
'"'
)
if
(
dwLen
>
0
&&
val_data
W
[
dwLen
-
1
]
==
'"'
)
{
{
dwLen
--
;
dwLen
--
;
val_data
[
dwLen
]
=
'\0'
;
val_data
W
[
dwLen
]
=
'\0'
;
}
}
lpbData
=
(
BYTE
*
)
val_data
;
lpbData
=
(
BYTE
*
)
val_data
W
;
dwLen
++
;
/* include terminating null */
dwLen
++
;
/* include terminating null */
dwLen
=
dwLen
*
sizeof
(
WCHAR
);
/* size is in bytes */
}
}
else
if
(
dwParseType
==
REG_DWORD
)
/* Convert the dword types */
else
if
(
dwParseType
==
REG_DWORD
)
/* Convert the dword types */
{
{
...
@@ -382,14 +384,14 @@ static LONG setValue(LPSTR val_name, LPSTR val_data)
...
@@ -382,14 +384,14 @@ static LONG setValue(LPSTR val_name, LPSTR val_data)
return
ERROR_INVALID_DATA
;
return
ERROR_INVALID_DATA
;
}
}
res
=
RegSetValueEx
(
res
=
RegSetValueEx
W
(
currentKeyHandle
,
currentKeyHandle
,
val_name
,
val_name
,
0
,
/* Reserved */
0
,
/* Reserved */
dwDataType
,
dwDataType
,
lpbData
,
lpbData
,
dwLen
);
dwLen
);
if
(
dwParseType
==
REG_BINARY
)
if
(
dwParseType
==
REG_BINARY
||
dwParseType
==
REG_SZ
)
HeapFree
(
GetProcessHeap
(),
0
,
lpbData
);
HeapFree
(
GetProcessHeap
(),
0
,
lpbData
);
return
res
;
return
res
;
}
}
...
@@ -465,6 +467,7 @@ static void processSetValue(LPSTR line)
...
@@ -465,6 +467,7 @@ static void processSetValue(LPSTR line)
{
{
LPSTR
val_name
;
/* registry value name */
LPSTR
val_name
;
/* registry value name */
LPSTR
val_data
;
/* registry value data */
LPSTR
val_data
;
/* registry value data */
WCHAR
*
val_nameW
;
int
line_idx
=
0
;
/* current character under analysis */
int
line_idx
=
0
;
/* current character under analysis */
LONG
res
;
LONG
res
;
...
@@ -504,8 +507,10 @@ static void processSetValue(LPSTR line)
...
@@ -504,8 +507,10 @@ static void processSetValue(LPSTR line)
line_idx
++
;
/* skip the '=' character */
line_idx
++
;
/* skip the '=' character */
val_data
=
line
+
line_idx
;
val_data
=
line
+
line_idx
;
REGPROC_unescape_string
(
val_name
);
val_nameW
=
GetWideString
(
val_name
,
lstrlenA
(
val_name
)
+
1
);
res
=
setValue
(
val_name
,
val_data
);
REGPROC_unescape_string
(
val_nameW
);
res
=
setValue
(
val_nameW
,
val_data
);
HeapFree
(
GetProcessHeap
(),
0
,
val_nameW
);
if
(
res
!=
ERROR_SUCCESS
)
if
(
res
!=
ERROR_SUCCESS
)
fprintf
(
stderr
,
"%s: ERROR Key %s not created. Value: %s, Data: %s
\n
"
,
fprintf
(
stderr
,
"%s: ERROR Key %s not created. Value: %s, Data: %s
\n
"
,
getAppName
(),
getAppName
(),
...
...
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