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
3c6de3b3
Commit
3c6de3b3
authored
Mar 04, 2011
by
Akihiro Sagawa
Committed by
Alexandre Julliard
Mar 07, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regedit: Export a decent newline in Unicode format.
parent
19fca272
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
11 deletions
+14
-11
regproc.c
programs/regedit/regproc.c
+14
-11
No files found.
programs/regedit/regproc.c
View file @
3c6de3b3
...
...
@@ -23,6 +23,8 @@
#include <limits.h>
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
#include <windows.h>
#include <winnt.h>
#include <winreg.h>
...
...
@@ -987,9 +989,9 @@ static void REGPROC_export_binary(WCHAR **line_buf, DWORD *line_buf_size, DWORD
const
WCHAR
*
hex_prefix
;
const
WCHAR
hex
[]
=
{
'h'
,
'e'
,
'x'
,
':'
,
0
};
WCHAR
hex_buf
[
17
];
const
WCHAR
concat
[]
=
{
'\\'
,
'\n'
,
' '
,
' '
,
0
};
const
WCHAR
concat
[]
=
{
'\\'
,
'\
r'
,
'\
n'
,
' '
,
' '
,
0
};
DWORD
concat_prefix
,
concat_len
;
const
WCHAR
newline
[]
=
{
'\n'
,
0
};
const
WCHAR
newline
[]
=
{
'\
r'
,
'\
n'
,
0
};
CHAR
*
value_multibyte
=
NULL
;
if
(
type
==
REG_BINARY
)
{
...
...
@@ -1098,7 +1100,7 @@ static void export_hkey(FILE *file, HKEY key,
DWORD
i
;
BOOL
more_data
;
LONG
ret
;
WCHAR
key_format
[]
=
{
'\
n'
,
'['
,
'%'
,
's'
,
']
'
,
'\n'
,
0
};
WCHAR
key_format
[]
=
{
'\
r'
,
'\n'
,
'['
,
'%'
,
's'
,
']'
,
'\r
'
,
'\n'
,
0
};
/* get size information and resize the buffers if necessary */
if
(
RegQueryInfoKeyW
(
key
,
NULL
,
NULL
,
NULL
,
NULL
,
...
...
@@ -1168,7 +1170,7 @@ static void export_hkey(FILE *file, HKEY key,
REGPROC_export_binary
(
line_buf
,
line_buf_size
,
&
line_len
,
value_type
,
*
val_buf
,
val_size1
,
unicode
);
}
else
{
const
WCHAR
start
[]
=
{
'"'
,
0
};
const
WCHAR
end
[]
=
{
'"'
,
'\n'
,
0
};
const
WCHAR
end
[]
=
{
'"'
,
'\
r'
,
'\
n'
,
0
};
DWORD
len
;
len
=
lstrlenW
(
start
);
...
...
@@ -1189,7 +1191,7 @@ static void export_hkey(FILE *file, HKEY key,
case
REG_DWORD
:
{
WCHAR
format
[]
=
{
'd'
,
'w'
,
'o'
,
'r'
,
'd'
,
':'
,
'%'
,
'0'
,
'8'
,
'x'
,
'\n'
,
0
};
WCHAR
format
[]
=
{
'd'
,
'w'
,
'o'
,
'r'
,
'd'
,
':'
,
'%'
,
'0'
,
'8'
,
'x'
,
'\
r'
,
'\
n'
,
0
};
REGPROC_resize_char_buffer
(
line_buf
,
line_buf_size
,
line_len
+
15
);
sprintfW
(
*
line_buf
+
line_len
,
format
,
*
((
DWORD
*
)
*
val_buf
));
...
...
@@ -1254,19 +1256,20 @@ static void export_hkey(FILE *file, HKEY key,
}
/******************************************************************************
* Open file for export.
* Open file
in binary mode
for export.
*/
static
FILE
*
REGPROC_open_export_file
(
WCHAR
*
file_name
,
BOOL
unicode
)
{
FILE
*
file
;
WCHAR
dash
=
'-'
;
if
(
strncmpW
(
file_name
,
&
dash
,
1
)
==
0
)
if
(
strncmpW
(
file_name
,
&
dash
,
1
)
==
0
)
{
file
=
stdout
;
else
_setmode
(
_fileno
(
file
),
_O_BINARY
);
}
else
{
CHAR
*
file_nameA
=
GetMultiByteString
(
file_name
);
file
=
fopen
(
file_nameA
,
"w"
);
file
=
fopen
(
file_nameA
,
"w
b
"
);
if
(
!
file
)
{
perror
(
""
);
fprintf
(
stderr
,
"%s: Can't open file
\"
%s
\"\n
"
,
getAppName
(),
file_nameA
);
...
...
@@ -1278,12 +1281,12 @@ static FILE *REGPROC_open_export_file(WCHAR *file_name, BOOL unicode)
if
(
unicode
)
{
const
BYTE
unicode_seq
[]
=
{
0xff
,
0xfe
};
const
WCHAR
header
[]
=
{
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
' '
,
'R'
,
'e'
,
'g'
,
'i'
,
's'
,
't'
,
'r'
,
'y'
,
' '
,
'E'
,
'd'
,
'i'
,
't'
,
'o'
,
'r'
,
' '
,
'V'
,
'e'
,
'r'
,
's'
,
'i'
,
'o'
,
'n'
,
' '
,
'5'
,
'.'
,
'0'
,
'0'
,
'\n'
};
const
WCHAR
header
[]
=
{
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
' '
,
'R'
,
'e'
,
'g'
,
'i'
,
's'
,
't'
,
'r'
,
'y'
,
' '
,
'E'
,
'd'
,
'i'
,
't'
,
'o'
,
'r'
,
' '
,
'V'
,
'e'
,
'r'
,
's'
,
'i'
,
'o'
,
'n'
,
' '
,
'5'
,
'.'
,
'0'
,
'0'
,
'\
r'
,
'\
n'
};
fwrite
(
unicode_seq
,
sizeof
(
BYTE
),
sizeof
(
unicode_seq
)
/
sizeof
(
unicode_seq
[
0
]),
file
);
fwrite
(
header
,
sizeof
(
WCHAR
),
sizeof
(
header
)
/
sizeof
(
header
[
0
]),
file
);
}
else
{
fputs
(
"REGEDIT4
\n
"
,
file
);
fputs
(
"REGEDIT4
\
r\
n
"
,
file
);
}
return
file
;
...
...
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