Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
1fadcf24
Commit
1fadcf24
authored
Mar 30, 2021
by
Hugh McMaster
Committed by
Alexandre Julliard
Mar 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg: Use wide-char string literals in import.c.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0c73f95b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
24 deletions
+12
-24
import.c
programs/reg/import.c
+12
-24
No files found.
programs/reg/import.c
View file @
1fadcf24
...
@@ -245,18 +245,13 @@ static BOOL parse_data_type(struct parser *parser, WCHAR **line)
...
@@ -245,18 +245,13 @@ static BOOL parse_data_type(struct parser *parser, WCHAR **line)
{
{
struct
data_type
{
const
WCHAR
*
tag
;
int
len
;
int
type
;
int
parse_type
;
};
struct
data_type
{
const
WCHAR
*
tag
;
int
len
;
int
type
;
int
parse_type
;
};
static
const
WCHAR
quote
[]
=
{
'"'
};
static
const
WCHAR
hex
[]
=
{
'h'
,
'e'
,
'x'
,
':'
};
static
const
WCHAR
dword
[]
=
{
'd'
,
'w'
,
'o'
,
'r'
,
'd'
,
':'
};
static
const
WCHAR
hexp
[]
=
{
'h'
,
'e'
,
'x'
,
'('
};
static
const
struct
data_type
data_types
[]
=
{
static
const
struct
data_type
data_types
[]
=
{
/* tag len type parse type */
/* tag
len type parse type */
{
quote
,
1
,
REG_SZ
,
REG_SZ
},
{
L"
\"
"
,
1
,
REG_SZ
,
REG_SZ
},
{
hex
,
4
,
REG_BINARY
,
REG_BINARY
},
{
L"hex:"
,
4
,
REG_BINARY
,
REG_BINARY
},
{
dword
,
6
,
REG_DWORD
,
REG_DWORD
},
{
L"dword:"
,
6
,
REG_DWORD
,
REG_DWORD
},
{
hexp
,
4
,
-
1
,
REG_BINARY
},
/* REG_NONE, REG_EXPAND_SZ, REG_MULTI_SZ */
{
L"hex("
,
4
,
-
1
,
REG_BINARY
},
/* REG_NONE, REG_EXPAND_SZ, REG_MULTI_SZ */
{
NULL
,
0
,
0
,
0
}
{
NULL
,
0
,
0
,
0
}
};
};
const
struct
data_type
*
ptr
;
const
struct
data_type
*
ptr
;
...
@@ -443,21 +438,17 @@ enum reg_versions {
...
@@ -443,21 +438,17 @@ enum reg_versions {
static
enum
reg_versions
parse_file_header
(
const
WCHAR
*
s
)
static
enum
reg_versions
parse_file_header
(
const
WCHAR
*
s
)
{
{
static
const
WCHAR
header_31
[]
=
{
'R'
,
'E'
,
'G'
,
'E'
,
'D'
,
'I'
,
'T'
,
0
};
static
const
WCHAR
*
header_31
=
L"REGEDIT"
;
static
const
WCHAR
header_40
[]
=
{
'R'
,
'E'
,
'G'
,
'E'
,
'D'
,
'I'
,
'T'
,
'4'
,
0
};
static
const
WCHAR
header_50
[]
=
{
'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'
,
0
};
while
(
*
s
==
' '
||
*
s
==
'\t'
)
s
++
;
while
(
*
s
==
' '
||
*
s
==
'\t'
)
s
++
;
if
(
!
lstrcmpW
(
s
,
header_31
))
if
(
!
lstrcmpW
(
s
,
header_31
))
return
REG_VERSION_31
;
return
REG_VERSION_31
;
if
(
!
lstrcmpW
(
s
,
header_40
))
if
(
!
lstrcmpW
(
s
,
L"REGEDIT4"
))
return
REG_VERSION_40
;
return
REG_VERSION_40
;
if
(
!
lstrcmpW
(
s
,
header_50
))
if
(
!
lstrcmpW
(
s
,
L"Windows Registry Editor Version 5.00"
))
return
REG_VERSION_50
;
return
REG_VERSION_50
;
/* The Windows version accepts registry file headers beginning with "REGEDIT" and ending
/* The Windows version accepts registry file headers beginning with "REGEDIT" and ending
...
@@ -511,13 +502,12 @@ static WCHAR *header_state(struct parser *parser, WCHAR *pos)
...
@@ -511,13 +502,12 @@ static WCHAR *header_state(struct parser *parser, WCHAR *pos)
static
WCHAR
*
parse_win31_line_state
(
struct
parser
*
parser
,
WCHAR
*
pos
)
static
WCHAR
*
parse_win31_line_state
(
struct
parser
*
parser
,
WCHAR
*
pos
)
{
{
WCHAR
*
line
,
*
value
;
WCHAR
*
line
,
*
value
;
static
WCHAR
hkcr
[]
=
{
'H'
,
'K'
,
'E'
,
'Y'
,
'_'
,
'C'
,
'L'
,
'A'
,
'S'
,
'S'
,
'E'
,
'S'
,
'_'
,
'R'
,
'O'
,
'O'
,
'T'
};
unsigned
int
key_end
=
0
;
unsigned
int
key_end
=
0
;
if
(
!
(
line
=
get_line
(
parser
->
file
)))
if
(
!
(
line
=
get_line
(
parser
->
file
)))
return
NULL
;
return
NULL
;
if
(
wcsncmp
(
line
,
hkcr
,
ARRAY_SIZE
(
hkcr
)))
if
(
wcsncmp
(
line
,
L"HKEY_CLASSES_ROOT"
,
17
))
/* "HKEY_CLASSES_ROOT" without NUL */
return
line
;
return
line
;
/* get key name */
/* get key name */
...
@@ -948,8 +938,7 @@ static WCHAR *get_lineW(FILE *fp)
...
@@ -948,8 +938,7 @@ static WCHAR *get_lineW(FILE *fp)
while
(
next
)
while
(
next
)
{
{
static
const
WCHAR
line_endings
[]
=
{
'\r'
,
'\n'
,
0
};
WCHAR
*
p
=
wcspbrk
(
line
,
L"
\r\n
"
);
WCHAR
*
p
=
wcspbrk
(
line
,
line_endings
);
if
(
!
p
)
if
(
!
p
)
{
{
size_t
len
,
count
;
size_t
len
,
count
;
...
@@ -986,7 +975,6 @@ int reg_import(int argc, WCHAR *argvW[])
...
@@ -986,7 +975,6 @@ int reg_import(int argc, WCHAR *argvW[])
{
{
WCHAR
*
filename
,
*
pos
;
WCHAR
*
filename
,
*
pos
;
FILE
*
fp
;
FILE
*
fp
;
static
const
WCHAR
rb_mode
[]
=
{
'r'
,
'b'
,
0
};
BYTE
s
[
2
];
BYTE
s
[
2
];
struct
parser
parser
;
struct
parser
parser
;
...
@@ -999,7 +987,7 @@ int reg_import(int argc, WCHAR *argvW[])
...
@@ -999,7 +987,7 @@ int reg_import(int argc, WCHAR *argvW[])
filename
=
argvW
[
2
];
filename
=
argvW
[
2
];
fp
=
_wfopen
(
filename
,
rb_mode
);
fp
=
_wfopen
(
filename
,
L"rb"
);
if
(
!
fp
)
if
(
!
fp
)
{
{
output_message
(
STRING_FILE_NOT_FOUND
,
filename
);
output_message
(
STRING_FILE_NOT_FOUND
,
filename
);
...
...
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