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
f74fa4e6
Commit
f74fa4e6
authored
Jan 31, 1999
by
Juergen Schmied
Committed by
Alexandre Julliard
Jan 31, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented handling of REG_MULTI_SZ and fixed small bug in
RegSetValue.
parent
afd5580f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
40 deletions
+49
-40
registry.c
misc/registry.c
+49
-40
No files found.
misc/registry.c
View file @
f74fa4e6
...
@@ -171,7 +171,7 @@ static LPSTR lmemcpynWtoA( LPSTR dst, LPCWSTR src, INT32 n )
...
@@ -171,7 +171,7 @@ static LPSTR lmemcpynWtoA( LPSTR dst, LPCWSTR src, INT32 n )
}
}
static
void
debug_print_value
(
LPBYTE
lpbData
,
DWORD
type
,
DWORD
len
)
static
void
debug_print_value
(
LPBYTE
lpbData
,
DWORD
type
,
DWORD
len
)
{
if
(
lpbData
)
{
if
(
TRACE_ON
(
reg
)
&&
lpbData
)
{
switch
(
type
)
{
switch
(
type
)
{
case
REG_SZ
:
{
case
REG_SZ
:
TRACE
(
reg
,
" Data(sz)=%s
\n
"
,
debugstr_w
((
LPCWSTR
)
lpbData
));
TRACE
(
reg
,
" Data(sz)=%s
\n
"
,
debugstr_w
((
LPCWSTR
)
lpbData
));
...
@@ -588,6 +588,9 @@ static void _save_USTRING( FILE *F, LPWSTR wstr, int escapeeq )
...
@@ -588,6 +588,9 @@ static void _save_USTRING( FILE *F, LPWSTR wstr, int escapeeq )
/******************************************************************************
/******************************************************************************
* _savesubkey [Internal]
* _savesubkey [Internal]
*
* NOTES
* REG_MULTI_SZ is handled as binary (like in win95) (js)
*/
*/
static
int
_savesubkey
(
FILE
*
F
,
LPKEYSTRUCT
lpkey
,
int
level
,
int
all
)
static
int
_savesubkey
(
FILE
*
F
,
LPKEYSTRUCT
lpkey
,
int
level
,
int
all
)
{
{
...
@@ -611,7 +614,7 @@ static int _savesubkey( FILE *F, LPKEYSTRUCT lpkey, int level, int all )
...
@@ -611,7 +614,7 @@ static int _savesubkey( FILE *F, LPKEYSTRUCT lpkey, int level, int all )
_save_USTRING
(
F
,
val
->
name
,
0
);
_save_USTRING
(
F
,
val
->
name
,
0
);
fputc
(
'='
,
F
);
fputc
(
'='
,
F
);
fprintf
(
F
,
"%ld,%ld,"
,
val
->
type
,
val
->
lastmodified
);
fprintf
(
F
,
"%ld,%ld,"
,
val
->
type
,
val
->
lastmodified
);
if
(
(
1
<<
val
->
type
)
&
UNICONVMASK
)
if
(
val
->
type
==
REG_SZ
||
val
->
type
==
REG_EXPAND_SZ
)
_save_USTRING
(
F
,(
LPWSTR
)
val
->
data
,
0
);
_save_USTRING
(
F
,(
LPWSTR
)
val
->
data
,
0
);
else
else
for
(
j
=
0
;
j
<
val
->
len
;
j
++
)
for
(
j
=
0
;
j
<
val
->
len
;
j
++
)
...
@@ -1002,7 +1005,7 @@ static int _wine_loadsubkey( FILE *F, LPKEYSTRUCT lpkey, int level, char **buf,
...
@@ -1002,7 +1005,7 @@ static int _wine_loadsubkey( FILE *F, LPKEYSTRUCT lpkey, int level, char **buf,
/* skip the 2 , */
/* skip the 2 , */
s
=
strchr
(
s
,
','
);
s
++
;
s
=
strchr
(
s
,
','
);
s
++
;
s
=
strchr
(
s
,
','
);
s
++
;
s
=
strchr
(
s
,
','
);
s
++
;
if
(
(
1
<<
type
)
&
UNICONVMASK
)
{
if
(
type
==
REG_SZ
||
type
==
REG_EXPAND_SZ
)
{
s
=
_wine_read_USTRING
(
s
,(
LPWSTR
*
)
&
data
);
s
=
_wine_read_USTRING
(
s
,(
LPWSTR
*
)
&
data
);
if
(
data
)
if
(
data
)
len
=
lstrlen32W
((
LPWSTR
)
data
)
*
2
+
2
;
len
=
lstrlen32W
((
LPWSTR
)
data
)
*
2
+
2
;
...
@@ -2185,8 +2188,8 @@ DWORD WINAPI RegCreateKey16( HKEY hkey, LPCSTR lpszSubKey, LPHKEY retkey )
...
@@ -2185,8 +2188,8 @@ DWORD WINAPI RegCreateKey16( HKEY hkey, LPCSTR lpszSubKey, LPHKEY retkey )
*
*
* RETURNS
* RETURNS
* ERROR_SUCCESS: Success
* ERROR_SUCCESS: Success
* ERROR_MORE_DATA:
T
he specified buffer is not big enough to hold the data
* ERROR_MORE_DATA:
!!! if t
he specified buffer is not big enough to hold the data
*
!!! buffer is untouched. The MS-documentation is wrong
!!!
*
buffer is left untouched. The MS-documentation is wrong (js)
!!!
*/
*/
DWORD
WINAPI
RegQueryValueEx32W
(
HKEY
hkey
,
LPWSTR
lpValueName
,
DWORD
WINAPI
RegQueryValueEx32W
(
HKEY
hkey
,
LPWSTR
lpValueName
,
LPDWORD
lpdwReserved
,
LPDWORD
lpdwType
,
LPDWORD
lpdwReserved
,
LPDWORD
lpdwType
,
...
@@ -2245,26 +2248,15 @@ DWORD WINAPI RegQueryValueEx32W( HKEY hkey, LPWSTR lpValueName,
...
@@ -2245,26 +2248,15 @@ DWORD WINAPI RegQueryValueEx32W( HKEY hkey, LPWSTR lpValueName,
if
(
lpdwType
)
/* type required ?*/
if
(
lpdwType
)
/* type required ?*/
*
lpdwType
=
lpkey
->
values
[
i
].
type
;
*
lpdwType
=
lpkey
->
values
[
i
].
type
;
if
(
lpbData
)
/* data required ?*/
{
if
(
*
lpcbData
>=
lpkey
->
values
[
i
].
len
)
/* buffer large enought ?*/
memcpy
(
lpbData
,
lpkey
->
values
[
i
].
data
,
lpkey
->
values
[
i
].
len
);
else
ret
=
ERROR_MORE_DATA
;
}
if
(
lpcbData
)
/* size required ?*/
if
(
lpcbData
)
/* size required ?*/
{
if
(
lpbData
)
/* data required ?*/
{
*
lpcbData
=
lpkey
->
values
[
i
].
len
;
{
if
(
*
lpcbData
>=
lpkey
->
values
[
i
].
len
)
/* buffer large enought ?*/
memcpy
(
lpbData
,
lpkey
->
values
[
i
].
data
,
lpkey
->
values
[
i
].
len
);
else
ret
=
ERROR_MORE_DATA
;
}
*
lpcbData
=
lpkey
->
values
[
i
].
len
;
/* fixme: hack to fake return value for REG_MULTI_SZ */
if
(
lpkey
->
values
[
i
].
type
==
REG_MULTI_SZ
)
{
FIXME
(
reg
,
"fake empty return value for REG_MULTI_SZ
\n
"
);
*
lpcbData
=
4
;
if
(
lpbData
)
{
lpbData
[
0
]
=
0x00
;
lpbData
[
1
]
=
0x00
;
lpbData
[
2
]
=
0x00
;
lpbData
[
3
]
=
0x00
;
}
}
}
}
debug_print_value
(
lpbData
,
lpkey
->
values
[
i
].
type
,
lpkey
->
values
[
i
].
len
);
debug_print_value
(
lpbData
,
lpkey
->
values
[
i
].
type
,
lpkey
->
values
[
i
].
len
);
...
@@ -2341,7 +2333,7 @@ DWORD WINAPI RegQueryValueEx32A( HKEY hkey, LPSTR lpszValueName,
...
@@ -2341,7 +2333,7 @@ DWORD WINAPI RegQueryValueEx32A( HKEY hkey, LPSTR lpszValueName,
if
(
lpcbData
)
/* at least length requested? */
if
(
lpcbData
)
/* at least length requested? */
{
if
(
UNICONVMASK
&
(
1
<<
(
mytype
)))
/* string requested? */
{
if
(
UNICONVMASK
&
(
1
<<
(
mytype
)))
/* string requested? */
{
if
(
lpbData
)
/* value requested? */
{
if
(
lpbData
)
/* value requested? */
{
mylen
=
2
*
(
*
lpcbData
);
{
mylen
=
2
*
(
*
lpcbData
);
mybuf
=
(
LPBYTE
)
xmalloc
(
mylen
);
mybuf
=
(
LPBYTE
)
xmalloc
(
mylen
);
}
}
...
@@ -2462,6 +2454,9 @@ DWORD WINAPI RegQueryValue16( HKEY hkey, LPSTR lpszSubKey, LPSTR lpszData,
...
@@ -2462,6 +2454,9 @@ DWORD WINAPI RegQueryValue16( HKEY hkey, LPSTR lpszSubKey, LPSTR lpszData,
* RETURNS
* RETURNS
* Success: ERROR_SUCCESS
* Success: ERROR_SUCCESS
* Failure: Error code
* Failure: Error code
*
* NOTES
* win95 does not care about cbData for REG_SZ and finds out the len by itself (js)
*/
*/
DWORD
WINAPI
RegSetValueEx32W
(
HKEY
hkey
,
LPWSTR
lpszValueName
,
DWORD
WINAPI
RegSetValueEx32W
(
HKEY
hkey
,
LPWSTR
lpszValueName
,
DWORD
dwReserved
,
DWORD
dwType
,
LPBYTE
lpbData
,
DWORD
dwReserved
,
DWORD
dwType
,
LPBYTE
lpbData
,
...
@@ -2508,6 +2503,10 @@ DWORD WINAPI RegSetValueEx32W( HKEY hkey, LPWSTR lpszValueName,
...
@@ -2508,6 +2503,10 @@ DWORD WINAPI RegSetValueEx32W( HKEY hkey, LPWSTR lpszValueName,
else
else
lpkey
->
values
[
i
].
name
=
NULL
;
lpkey
->
values
[
i
].
name
=
NULL
;
}
}
if
(
dwType
==
REG_SZ
)
cbData
=
2
*
(
lstrlen32W
((
LPCWSTR
)
lpbData
)
+
1
);
lpkey
->
values
[
i
].
len
=
cbData
;
lpkey
->
values
[
i
].
len
=
cbData
;
lpkey
->
values
[
i
].
type
=
dwType
;
lpkey
->
values
[
i
].
type
=
dwType
;
if
(
lpkey
->
values
[
i
].
data
!=
NULL
)
if
(
lpkey
->
values
[
i
].
data
!=
NULL
)
...
@@ -2522,6 +2521,8 @@ DWORD WINAPI RegSetValueEx32W( HKEY hkey, LPWSTR lpszValueName,
...
@@ -2522,6 +2521,8 @@ DWORD WINAPI RegSetValueEx32W( HKEY hkey, LPWSTR lpszValueName,
/******************************************************************************
/******************************************************************************
* RegSetValueEx32A [ADVAPI32.169]
* RegSetValueEx32A [ADVAPI32.169]
*
*
* NOTES
* win95 does not care about cbData for REG_SZ and finds out the len by itself (js)
*/
*/
DWORD
WINAPI
RegSetValueEx32A
(
HKEY
hkey
,
LPSTR
lpszValueName
,
DWORD
WINAPI
RegSetValueEx32A
(
HKEY
hkey
,
LPSTR
lpszValueName
,
DWORD
dwReserved
,
DWORD
dwType
,
LPBYTE
lpbData
,
DWORD
dwReserved
,
DWORD
dwType
,
LPBYTE
lpbData
,
...
@@ -2538,7 +2539,10 @@ DWORD WINAPI RegSetValueEx32A( HKEY hkey, LPSTR lpszValueName,
...
@@ -2538,7 +2539,10 @@ DWORD WINAPI RegSetValueEx32A( HKEY hkey, LPSTR lpszValueName,
dwReserved
,
dwType
,
lpbData
,
cbData
);
dwReserved
,
dwType
,
lpbData
,
cbData
);
if
((
1
<<
dwType
)
&
UNICONVMASK
)
if
((
1
<<
dwType
)
&
UNICONVMASK
)
{
buf
=
(
LPBYTE
)
xmalloc
(
cbData
*
2
);
{
if
(
dwType
==
REG_SZ
)
cbData
=
strlen
((
LPCSTR
)
lpbData
)
+
1
;
buf
=
(
LPBYTE
)
xmalloc
(
cbData
*
2
);
lmemcpynAtoW
((
LPVOID
)
buf
,
lpbData
,
cbData
);
lmemcpynAtoW
((
LPVOID
)
buf
,
lpbData
,
cbData
);
cbData
=
2
*
cbData
;
cbData
=
2
*
cbData
;
}
}
...
@@ -2825,11 +2829,11 @@ DWORD WINAPI RegEnumKey16( HKEY hkey, DWORD iSubkey, LPSTR lpszName,
...
@@ -2825,11 +2829,11 @@ DWORD WINAPI RegEnumKey16( HKEY hkey, DWORD iSubkey, LPSTR lpszName,
* hkey [I] Handle to key to query
* hkey [I] Handle to key to query
* iValue [I] Index of value to query
* iValue [I] Index of value to query
* lpszValue [O] Value string
* lpszValue [O] Value string
* lpcchValue [
O] Size of value buffer
* lpcchValue [
I/O] Size of value buffer (in wchars)
* lpdReserved [I] Reserved
* lpdReserved [I] Reserved
* lpdwType [O] Type code
* lpdwType [O] Type code
* lpbData [O] Value data
* lpbData [O] Value data
* lpcbData [
O] Size of data buffer
* lpcbData [
I/O] Size of data buffer (in bytes)
*
*
* Note: wide character functions that take and/or return "character counts"
* Note: wide character functions that take and/or return "character counts"
* use TCHAR (that is unsigned short or char) not byte counts.
* use TCHAR (that is unsigned short or char) not byte counts.
...
@@ -2842,34 +2846,37 @@ DWORD WINAPI RegEnumValue32W( HKEY hkey, DWORD iValue, LPWSTR lpszValue,
...
@@ -2842,34 +2846,37 @@ DWORD WINAPI RegEnumValue32W( HKEY hkey, DWORD iValue, LPWSTR lpszValue,
LPKEYSTRUCT
lpkey
;
LPKEYSTRUCT
lpkey
;
LPKEYVALUE
val
;
LPKEYVALUE
val
;
TRACE
(
reg
,
"(%x,%ld,%p,%p,%p,%p,%p,%p)
\n
"
,
hkey
,
iValue
,
debugstr_w
(
lpszValue
),
TRACE
(
reg
,
"(%x,%ld,%p,%p,%p,%p,%p,%p)
\n
"
,
hkey
,
iValue
,
debugstr_w
(
lpszValue
),
lpcchValue
,
lpdReserved
,
lpdwType
,
lpbData
,
lpcbData
);
lpcchValue
,
lpdReserved
,
lpdwType
,
lpbData
,
lpcbData
);
lpkey
=
lookup_hkey
(
hkey
);
lpkey
=
lookup_hkey
(
hkey
);
if
(
!
lpkey
)
return
ERROR_INVALID_HANDLE
;
if
(
!
lpcbData
&&
lpbData
)
return
ERROR_INVALID_PARAMETER
;
if
(
!
lpkey
)
return
ERROR_INVALID_HANDLE
;
if
(
lpkey
->
nrofvalues
<=
iValue
)
if
(
lpkey
->
nrofvalues
<=
iValue
)
return
ERROR_NO_MORE_ITEMS
;
return
ERROR_NO_MORE_ITEMS
;
/* FIXME: Should this be lpkey->values + iValue * sizeof(KEYVALUE)? */
val
=
&
(
lpkey
->
values
[
iValue
]);
val
=
lpkey
->
values
+
iValue
;
if
(
val
->
name
)
{
if
(
val
->
name
)
{
if
(
lstrlen32W
(
val
->
name
)
+
1
>*
lpcchValue
)
{
if
(
lstrlen32W
(
val
->
name
)
+
1
>*
lpcchValue
)
{
*
lpcchValue
=
lstrlen32W
(
val
->
name
)
+
1
;
*
lpcchValue
=
lstrlen32W
(
val
->
name
)
+
1
;
return
ERROR_MORE_DATA
;
return
ERROR_MORE_DATA
;
}
}
memcpy
(
lpszValue
,
val
->
name
,
2
*
lstrlen32W
(
val
->
name
)
+
2
);
memcpy
(
lpszValue
,
val
->
name
,
2
*
(
lstrlen32W
(
val
->
name
)
+
1
)
);
*
lpcchValue
=
lstrlen32W
(
val
->
name
);
*
lpcchValue
=
lstrlen32W
(
val
->
name
);
}
else
{
}
else
{
*
lpszValue
=
0
;
*
lpszValue
=
0
;
*
lpcchValue
=
0
;
*
lpcchValue
=
0
;
}
}
/* Can be NULL if the type code is not required */
/* Can be NULL if the type code is not required */
if
(
lpdwType
)
if
(
lpdwType
)
*
lpdwType
=
val
->
type
;
*
lpdwType
=
val
->
type
;
if
(
lpbData
)
{
if
(
lpbData
)
{
if
(
val
->
len
>*
lpcbData
)
if
(
val
->
len
>*
lpcbData
)
...
@@ -2877,6 +2884,8 @@ DWORD WINAPI RegEnumValue32W( HKEY hkey, DWORD iValue, LPWSTR lpszValue,
...
@@ -2877,6 +2884,8 @@ DWORD WINAPI RegEnumValue32W( HKEY hkey, DWORD iValue, LPWSTR lpszValue,
memcpy
(
lpbData
,
val
->
data
,
val
->
len
);
memcpy
(
lpbData
,
val
->
data
,
val
->
len
);
*
lpcbData
=
val
->
len
;
*
lpcbData
=
val
->
len
;
}
}
debug_print_value
(
val
->
data
,
val
->
type
,
val
->
len
);
return
ERROR_SUCCESS
;
return
ERROR_SUCCESS
;
}
}
...
...
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