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
5940ada8
Commit
5940ada8
authored
Nov 12, 2008
by
Francois Gouget
Committed by
Alexandre Julliard
Nov 12, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regedit: line_size is supposed to track a string length.
That is it does not count the trailing '\0'. Fix a few places that got this wrong and rename it to line_len.
parent
f982e731
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
28 deletions
+26
-28
regproc.c
programs/regedit/regproc.c
+26
-28
No files found.
programs/regedit/regproc.c
View file @
5940ada8
...
@@ -889,13 +889,13 @@ static void REGPROC_resize_char_buffer(WCHAR **buffer, DWORD *len, DWORD require
...
@@ -889,13 +889,13 @@ static void REGPROC_resize_char_buffer(WCHAR **buffer, DWORD *len, DWORD require
/******************************************************************************
/******************************************************************************
* Prints string str to file
* Prints string str to file
*/
*/
static
void
REGPROC_export_string
(
WCHAR
**
line_buf
,
DWORD
*
line_buf_size
,
DWORD
*
line_
size
,
WCHAR
*
str
)
static
void
REGPROC_export_string
(
WCHAR
**
line_buf
,
DWORD
*
line_buf_size
,
DWORD
*
line_
len
,
WCHAR
*
str
)
{
{
DWORD
len
=
lstrlenW
(
str
);
DWORD
len
=
lstrlenW
(
str
);
DWORD
i
;
DWORD
i
;
DWORD
extra
=
0
;
DWORD
extra
=
0
;
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
len
+
*
line_size
+
10
);
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
*
line_len
+
len
+
10
);
/* escaping characters */
/* escaping characters */
for
(
i
=
0
;
i
<
len
;
i
++
)
{
for
(
i
=
0
;
i
<
len
;
i
++
)
{
...
@@ -905,8 +905,8 @@ static void REGPROC_export_string(WCHAR **line_buf, DWORD *line_buf_size, DWORD
...
@@ -905,8 +905,8 @@ static void REGPROC_export_string(WCHAR **line_buf, DWORD *line_buf_size, DWORD
{
{
const
WCHAR
escape
[]
=
{
'\\'
,
'\\'
};
const
WCHAR
escape
[]
=
{
'\\'
,
'\\'
};
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
len
+
*
line_size
+
extra
+
1
);
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
*
line_len
+
len
+
extra
+
1
);
memcpy
(
*
line_buf
+
*
line_
size
+
i
+
extra
-
1
,
escape
,
2
*
sizeof
(
WCHAR
));
memcpy
(
*
line_buf
+
*
line_
len
+
i
+
extra
,
escape
,
2
*
sizeof
(
WCHAR
));
extra
++
;
extra
++
;
break
;
break
;
}
}
...
@@ -914,8 +914,8 @@ static void REGPROC_export_string(WCHAR **line_buf, DWORD *line_buf_size, DWORD
...
@@ -914,8 +914,8 @@ static void REGPROC_export_string(WCHAR **line_buf, DWORD *line_buf_size, DWORD
{
{
const
WCHAR
escape
[]
=
{
'\\'
,
'"'
};
const
WCHAR
escape
[]
=
{
'\\'
,
'"'
};
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
len
+
*
line_size
+
extra
+
1
);
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
*
line_len
+
len
+
extra
+
1
);
memcpy
(
*
line_buf
+
*
line_
size
+
i
+
extra
-
1
,
escape
,
2
*
sizeof
(
WCHAR
));
memcpy
(
*
line_buf
+
*
line_
len
+
i
+
extra
,
escape
,
2
*
sizeof
(
WCHAR
));
extra
++
;
extra
++
;
break
;
break
;
}
}
...
@@ -923,18 +923,18 @@ static void REGPROC_export_string(WCHAR **line_buf, DWORD *line_buf_size, DWORD
...
@@ -923,18 +923,18 @@ static void REGPROC_export_string(WCHAR **line_buf, DWORD *line_buf_size, DWORD
{
{
const
WCHAR
escape
[]
=
{
'\\'
,
'n'
};
const
WCHAR
escape
[]
=
{
'\\'
,
'n'
};
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
len
+
*
line_size
+
extra
+
1
);
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
*
line_len
+
len
+
extra
+
1
);
memcpy
(
*
line_buf
+
*
line_
size
+
i
+
extra
-
1
,
escape
,
2
*
sizeof
(
WCHAR
));
memcpy
(
*
line_buf
+
*
line_
len
+
i
+
extra
,
escape
,
2
*
sizeof
(
WCHAR
));
extra
++
;
extra
++
;
break
;
break
;
}
}
default:
default:
memcpy
(
*
line_buf
+
*
line_
size
+
i
+
extra
-
1
,
&
c
,
sizeof
(
WCHAR
));
memcpy
(
*
line_buf
+
*
line_
len
+
i
+
extra
,
&
c
,
sizeof
(
WCHAR
));
break
;
break
;
}
}
}
}
*
line_
size
+=
len
+
extra
;
*
line_
len
+=
len
+
extra
;
*
(
*
line_buf
+
*
line_
size
-
1
)
=
0
;
*
(
*
line_buf
+
*
line_
len
)
=
0
;
}
}
/******************************************************************************
/******************************************************************************
...
@@ -1017,7 +1017,7 @@ static void export_hkey(FILE *file, HKEY key,
...
@@ -1017,7 +1017,7 @@ static void export_hkey(FILE *file, HKEY key,
DWORD
value_type
;
DWORD
value_type
;
DWORD
val_name_len1
=
*
val_name_len
;
DWORD
val_name_len1
=
*
val_name_len
;
DWORD
val_size1
=
*
val_size
;
DWORD
val_size1
=
*
val_size
;
DWORD
line_
size
=
0
;
DWORD
line_
len
=
0
;
ret
=
RegEnumValueW
(
key
,
i
,
*
val_name_buf
,
&
val_name_len1
,
NULL
,
ret
=
RegEnumValueW
(
key
,
i
,
*
val_name_buf
,
&
val_name_len1
,
NULL
,
&
value_type
,
*
val_buf
,
&
val_size1
);
&
value_type
,
*
val_buf
,
&
val_size1
);
if
(
ret
!=
ERROR_SUCCESS
)
{
if
(
ret
!=
ERROR_SUCCESS
)
{
...
@@ -1031,16 +1031,14 @@ static void export_hkey(FILE *file, HKEY key,
...
@@ -1031,16 +1031,14 @@ static void export_hkey(FILE *file, HKEY key,
if
((
*
val_name_buf
)[
0
])
{
if
((
*
val_name_buf
)[
0
])
{
const
WCHAR
val_start
[]
=
{
'"'
,
'%'
,
's'
,
'"'
,
'='
,
0
};
const
WCHAR
val_start
[]
=
{
'"'
,
'%'
,
's'
,
'"'
,
'='
,
0
};
line_
size
=
4
+
lstrlenW
(
*
val_name_buf
);
line_
pos
=
line_len
=
3
+
lstrlenW
(
*
val_name_buf
);
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
line_
size
);
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
line_
len
);
wsprintfW
(
*
line_buf
,
val_start
,
*
val_name_buf
);
wsprintfW
(
*
line_buf
,
val_start
,
*
val_name_buf
);
line_pos
=
lstrlenW
(
*
line_buf
);
}
else
{
}
else
{
const
WCHAR
std_val
[]
=
{
'@'
,
'='
,
0
};
const
WCHAR
std_val
[]
=
{
'@'
,
'='
,
0
};
line_
size
=
3
;
line_
pos
=
line_len
=
2
;
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
line_
size
);
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
line_
len
);
lstrcpyW
(
*
line_buf
,
std_val
);
lstrcpyW
(
*
line_buf
,
std_val
);
line_pos
=
lstrlenW
(
*
line_buf
);
}
}
switch
(
value_type
)
{
switch
(
value_type
)
{
...
@@ -1050,14 +1048,14 @@ static void export_hkey(FILE *file, HKEY key,
...
@@ -1050,14 +1048,14 @@ static void export_hkey(FILE *file, HKEY key,
const
WCHAR
start
[]
=
{
'"'
,
0
};
const
WCHAR
start
[]
=
{
'"'
,
0
};
const
WCHAR
end
[]
=
{
'"'
,
'\n'
,
0
};
const
WCHAR
end
[]
=
{
'"'
,
'\n'
,
0
};
line_
size
+=
lstrlenW
(
start
);
line_
len
+=
lstrlenW
(
start
);
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
line_
size
);
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
line_
len
);
lstrcatW
(
*
line_buf
,
start
);
lstrcatW
(
*
line_buf
,
start
);
if
(
val_size1
)
REGPROC_export_string
(
line_buf
,
line_buf_size
,
&
line_
size
,
(
WCHAR
*
)
*
val_buf
);
if
(
val_size1
)
REGPROC_export_string
(
line_buf
,
line_buf_size
,
&
line_
len
,
(
WCHAR
*
)
*
val_buf
);
line_
size
+=
lstrlenW
(
end
);
line_
len
+=
lstrlenW
(
end
);
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
line_
size
);
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
line_
len
);
lstrcatW
(
*
line_buf
,
end
);
lstrcatW
(
*
line_buf
,
end
);
break
;
break
;
}
}
...
@@ -1066,8 +1064,8 @@ static void export_hkey(FILE *file, HKEY key,
...
@@ -1066,8 +1064,8 @@ static void export_hkey(FILE *file, HKEY key,
{
{
WCHAR
format
[]
=
{
'd'
,
'w'
,
'o'
,
'r'
,
'd'
,
':'
,
'%'
,
'0'
,
'8'
,
'x'
,
'\n'
,
0
};
WCHAR
format
[]
=
{
'd'
,
'w'
,
'o'
,
'r'
,
'd'
,
':'
,
'%'
,
'0'
,
'8'
,
'x'
,
'\n'
,
0
};
line_
size
+=
20
;
line_
len
+=
20
;
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
line_
size
);
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
line_
len
);
wsprintfW
(
*
line_buf
+
line_pos
,
format
,
*
((
DWORD
*
)
*
val_buf
));
wsprintfW
(
*
line_buf
+
line_pos
,
format
,
*
((
DWORD
*
)
*
val_buf
));
break
;
break
;
}
}
...
@@ -1116,9 +1114,9 @@ static void export_hkey(FILE *file, HKEY key,
...
@@ -1116,9 +1114,9 @@ static void export_hkey(FILE *file, HKEY key,
cur_pos
=
lstrlenW
(
delim
)
+
lstrlenW
(
hex
)
+
cur_pos
=
lstrlenW
(
delim
)
+
lstrlenW
(
hex
)
+
lstrlenW
(
*
val_name_buf
);
lstrlenW
(
*
val_name_buf
);
line_
size
+=
lstrlenW
(
hex_prefix
);
line_
len
+=
lstrlenW
(
hex_prefix
);
line_
size
+=
val_buf1_size
*
3
+
lstrlenW
(
concat
)
*
((
int
)((
float
)
val_buf1_size
*
3
.
0
/
(
float
)
REG_FILE_HEX_LINE_LEN
)
+
1
)
+
1
;
line_
len
+=
val_buf1_size
*
3
+
lstrlenW
(
concat
)
*
((
int
)((
float
)
val_buf1_size
*
3
.
0
/
(
float
)
REG_FILE_HEX_LINE_LEN
)
+
1
)
+
1
;
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
line_
size
);
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
line_
len
);
lstrcatW
(
*
line_buf
,
hex_prefix
);
lstrcatW
(
*
line_buf
,
hex_prefix
);
line_pos
+=
lstrlenW
(
hex_prefix
);
line_pos
+=
lstrlenW
(
hex_prefix
);
for
(
i1
=
0
;
i1
<
val_buf1_size
;
i1
++
)
{
for
(
i1
=
0
;
i1
<
val_buf1_size
;
i1
++
)
{
...
...
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