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
c345f7b9
Commit
c345f7b9
authored
Jul 10, 2002
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created registry unit test and added tests for RegEnumValue[AW].
parent
c1dddbea
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
220 additions
and
1 deletion
+220
-1
configure
configure
+5
-0
configure.ac
configure.ac
+1
-0
Makefile.in
dlls/advapi32/Makefile.in
+5
-1
.cvsignore
dlls/advapi32/tests/.cvsignore
+3
-0
registry.c
dlls/advapi32/tests/registry.c
+206
-0
No files found.
configure
View file @
c345f7b9
...
...
@@ -13222,6 +13222,8 @@ fi
ac_config_commands
=
"
$ac_config_commands
controls"
ac_config_commands
=
"
$ac_config_commands
dlls/advapi32/tests"
ac_config_commands
=
"
$ac_config_commands
dlls/ddraw/d3ddevice"
ac_config_commands
=
"
$ac_config_commands
dlls/ddraw/dclipper"
...
...
@@ -13927,6 +13929,7 @@ do
"tsx11/Makefile" ) CONFIG_FILES="
$CONFIG_FILES
tsx11/Makefile" ;;
"unicode/Makefile" ) CONFIG_FILES="
$CONFIG_FILES
unicode/Makefile" ;;
"controls" ) CONFIG_COMMANDS="
$CONFIG_COMMANDS
controls" ;;
"dlls/advapi32/tests" ) CONFIG_COMMANDS="
$CONFIG_COMMANDS
dlls/advapi32/tests" ;;
"dlls/ddraw/d3ddevice" ) CONFIG_COMMANDS="
$CONFIG_COMMANDS
dlls/ddraw/d3ddevice" ;;
"dlls/ddraw/dclipper" ) CONFIG_COMMANDS="
$CONFIG_COMMANDS
dlls/ddraw/dclipper" ;;
"dlls/ddraw/ddraw" ) CONFIG_COMMANDS="
$CONFIG_COMMANDS
dlls/ddraw/ddraw" ;;
...
...
@@ -14607,6 +14610,8 @@ echo "$as_me: executing $ac_dest commands" >&6;}
case
$ac_dest
in
controls ) test -d "controls" || ({ echo "
$as_me
:
$LINENO
: creating controls" >&5
echo "
$as_me
: creating controls" >&6;} && mkdir "controls") ;;
dlls/advapi32/tests ) test -d "dlls/advapi32/tests" || ({ echo "
$as_me
:
$LINENO
: creating dlls/advapi32/tests" >&5
echo "
$as_me
: creating dlls/advapi32/tests" >&6;} && mkdir "dlls/advapi32/tests") ;;
dlls/ddraw/d3ddevice ) test -d "dlls/ddraw/d3ddevice" || ({ echo "
$as_me
:
$LINENO
: creating dlls/ddraw/d3ddevice" >&5
echo "
$as_me
: creating dlls/ddraw/d3ddevice" >&6;} && mkdir "dlls/ddraw/d3ddevice") ;;
dlls/ddraw/dclipper ) test -d "dlls/ddraw/dclipper" || ({ echo "
$as_me
:
$LINENO
: creating dlls/ddraw/dclipper" >&5
...
...
configure.ac
View file @
c345f7b9
...
...
@@ -1192,6 +1192,7 @@ dnl **** Generate output files ****
AH_TOP([#define __WINE_CONFIG_H])
WINE_CONFIG_EXTRA_DIR(controls)
WINE_CONFIG_EXTRA_DIR(dlls/advapi32/tests)
WINE_CONFIG_EXTRA_DIR(dlls/ddraw/d3ddevice)
WINE_CONFIG_EXTRA_DIR(dlls/ddraw/dclipper)
WINE_CONFIG_EXTRA_DIR(dlls/ddraw/ddraw)
...
...
dlls/advapi32/Makefile.in
View file @
c345f7b9
...
...
@@ -17,7 +17,11 @@ C_SRCS = \
security.c
\
service.c
CTESTS
=
\
tests/registry.c
EXTRASUBDIRS
=
tests
@MAKE_DLL_RULES@
### Dependencies:
dlls/advapi32/tests/.cvsignore
0 → 100644
View file @
c345f7b9
advapi32_test.exe.spec.c
registry.ok
testlist.c
dlls/advapi32/tests/registry.c
0 → 100644
View file @
c345f7b9
/*
* Unit tests for registry functions
*
* Copyright (c) 2002 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <assert.h>
#include "wine/test.h"
#include "winreg.h"
#include "winerror.h"
static
HKEY
hkey_main
;
/* delete key and all its subkeys */
static
DWORD
delete_key
(
HKEY
hkey
)
{
WCHAR
name
[
MAX_PATH
];
DWORD
ret
;
while
(
!
(
ret
=
RegEnumKeyW
(
hkey
,
0
,
name
,
sizeof
(
name
))))
{
if
((
ret
=
delete_key
(
hkey
)))
break
;
}
if
(
ret
!=
ERROR_NO_MORE_ITEMS
)
return
ret
;
RegDeleteKeyA
(
hkey
,
NULL
);
return
0
;
}
static
void
setup_main_key
(
void
)
{
if
(
RegOpenKeyA
(
HKEY_CURRENT_USER
,
"Software
\\
Wine
\\
Test"
,
&
hkey_main
))
delete_key
(
hkey_main
);
assert
(
!
RegCreateKeyExA
(
HKEY_CURRENT_USER
,
"Software
\\
Wine
\\
Test"
,
0
,
NULL
,
REG_OPTION_VOLATILE
,
KEY_ALL_ACCESS
,
NULL
,
&
hkey_main
,
NULL
));
}
static
void
test_enum_value
(
void
)
{
DWORD
res
;
char
value
[
20
],
data
[
20
];
WCHAR
valueW
[
20
],
dataW
[
20
];
DWORD
val_count
,
data_count
,
type
;
static
const
WCHAR
foobarW
[]
=
{
'f'
,
'o'
,
'o'
,
'b'
,
'a'
,
'r'
,
0
};
static
const
WCHAR
testW
[]
=
{
'T'
,
'e'
,
's'
,
't'
,
0
};
static
const
WCHAR
xxxW
[]
=
{
'x'
,
'x'
,
'x'
,
'x'
,
'x'
,
'x'
,
'x'
,
'x'
,
0
};
res
=
RegSetValueExA
(
hkey_main
,
"Test"
,
0
,
REG_SZ
,
(
BYTE
*
)
"foobar"
,
7
);
ok
(
res
==
0
,
"RegSetValueExA failed error %ld"
,
res
);
/* overflow both name and data */
val_count
=
2
;
data_count
=
2
;
type
=
1234
;
strcpy
(
value
,
"xxxxxxxxxx"
);
strcpy
(
data
,
"xxxxxxxxxx"
);
res
=
RegEnumValueA
(
hkey_main
,
0
,
value
,
&
val_count
,
NULL
,
&
type
,
data
,
&
data_count
);
ok
(
res
==
ERROR_MORE_DATA
,
"expected ERROR_MORE_DATA, got %ld"
,
res
);
ok
(
val_count
==
2
,
"val_count set to %ld"
,
val_count
);
ok
(
data_count
==
7
,
"data_count set to %ld instead of 7"
,
data_count
);
ok
(
type
==
REG_SZ
,
"type %ld is not REG_SZ"
,
type
);
ok
(
!
strcmp
(
value
,
"xxxxxxxxxx"
),
"value set to '%s'"
,
value
);
ok
(
!
strcmp
(
data
,
"xxxxxxxxxx"
),
"data set to '%s'"
,
data
);
/* overflow name */
val_count
=
3
;
data_count
=
20
;
type
=
1234
;
strcpy
(
value
,
"xxxxxxxxxx"
);
strcpy
(
data
,
"xxxxxxxxxx"
);
res
=
RegEnumValueA
(
hkey_main
,
0
,
value
,
&
val_count
,
NULL
,
&
type
,
data
,
&
data_count
);
ok
(
res
==
ERROR_MORE_DATA
,
"expected ERROR_MORE_DATA, got %ld"
,
res
);
ok
(
val_count
==
3
,
"val_count set to %ld"
,
val_count
);
ok
(
data_count
==
7
,
"data_count set to %ld instead of 7"
,
data_count
);
ok
(
type
==
REG_SZ
,
"type %ld is not REG_SZ"
,
type
);
ok
(
!
strcmp
(
value
,
"Te"
),
"value set to '%s' instead of 'Te'"
,
value
);
ok
(
!
strcmp
(
data
,
"foobar"
),
"data set to '%s' instead of 'foobar'"
,
data
);
/* overflow empty name */
val_count
=
0
;
data_count
=
20
;
type
=
1234
;
strcpy
(
value
,
"xxxxxxxxxx"
);
strcpy
(
data
,
"xxxxxxxxxx"
);
res
=
RegEnumValueA
(
hkey_main
,
0
,
value
,
&
val_count
,
NULL
,
&
type
,
data
,
&
data_count
);
ok
(
res
==
ERROR_MORE_DATA
,
"expected ERROR_MORE_DATA, got %ld"
,
res
);
ok
(
val_count
==
0
,
"val_count set to %ld"
,
val_count
);
ok
(
data_count
==
7
,
"data_count set to %ld instead of 7"
,
data_count
);
ok
(
type
==
REG_SZ
,
"type %ld is not REG_SZ"
,
type
);
ok
(
!
strcmp
(
value
,
"xxxxxxxxxx"
),
"value set to '%s'"
,
value
);
ok
(
!
strcmp
(
data
,
"foobar"
),
"data set to '%s' instead of 'foobar'"
,
data
);
/* overflow data */
val_count
=
20
;
data_count
=
2
;
type
=
1234
;
strcpy
(
value
,
"xxxxxxxxxx"
);
strcpy
(
data
,
"xxxxxxxxxx"
);
res
=
RegEnumValueA
(
hkey_main
,
0
,
value
,
&
val_count
,
NULL
,
&
type
,
data
,
&
data_count
);
ok
(
res
==
ERROR_MORE_DATA
,
"expected ERROR_MORE_DATA, got %ld"
,
res
);
ok
(
val_count
==
20
,
"val_count set to %ld"
,
val_count
);
ok
(
data_count
==
7
,
"data_count set to %ld instead of 7"
,
data_count
);
ok
(
type
==
REG_SZ
,
"type %ld is not REG_SZ"
,
type
);
ok
(
!
strcmp
(
value
,
"xxxxxxxxxx"
),
"value set to '%s'"
,
value
);
ok
(
!
strcmp
(
data
,
"xxxxxxxxxx"
),
"data set to '%s'"
,
data
);
/* no overflow */
val_count
=
20
;
data_count
=
20
;
type
=
1234
;
strcpy
(
value
,
"xxxxxxxxxx"
);
strcpy
(
data
,
"xxxxxxxxxx"
);
res
=
RegEnumValueA
(
hkey_main
,
0
,
value
,
&
val_count
,
NULL
,
&
type
,
data
,
&
data_count
);
ok
(
res
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %ld"
,
res
);
ok
(
val_count
==
4
,
"val_count set to %ld instead of 4"
,
val_count
);
ok
(
data_count
==
7
,
"data_count set to %ld instead of 7"
,
data_count
);
ok
(
type
==
REG_SZ
,
"type %ld is not REG_SZ"
,
type
);
ok
(
!
strcmp
(
value
,
"Test"
),
"value is '%s' instead of Test"
,
value
);
ok
(
!
strcmp
(
data
,
"foobar"
),
"data is '%s' instead of foobar"
,
data
);
/* Unicode tests */
res
=
RegSetValueExW
(
hkey_main
,
testW
,
0
,
REG_SZ
,
(
BYTE
*
)
foobarW
,
7
*
sizeof
(
WCHAR
)
);
ok
(
res
==
0
,
"RegSetValueExW failed error %ld"
,
res
);
/* overflow both name and data */
val_count
=
2
;
data_count
=
2
;
type
=
1234
;
memcpy
(
valueW
,
xxxW
,
sizeof
(
xxxW
)
);
memcpy
(
dataW
,
xxxW
,
sizeof
(
xxxW
)
);
res
=
RegEnumValueW
(
hkey_main
,
0
,
valueW
,
&
val_count
,
NULL
,
&
type
,
(
BYTE
*
)
dataW
,
&
data_count
);
ok
(
res
==
ERROR_MORE_DATA
,
"expected ERROR_MORE_DATA, got %ld"
,
res
);
ok
(
val_count
==
2
,
"val_count set to %ld"
,
val_count
);
ok
(
data_count
==
7
*
sizeof
(
WCHAR
),
"data_count set to %ld instead of 7*sizeof(WCHAR)"
,
data_count
);
ok
(
type
==
REG_SZ
,
"type %ld is not REG_SZ"
,
type
);
ok
(
!
memcmp
(
valueW
,
xxxW
,
sizeof
(
xxxW
)
),
"value modified"
);
ok
(
!
memcmp
(
dataW
,
xxxW
,
sizeof
(
xxxW
)
),
"data modified"
);
/* overflow name */
val_count
=
3
;
data_count
=
20
;
type
=
1234
;
memcpy
(
valueW
,
xxxW
,
sizeof
(
xxxW
)
);
memcpy
(
dataW
,
xxxW
,
sizeof
(
xxxW
)
);
res
=
RegEnumValueW
(
hkey_main
,
0
,
valueW
,
&
val_count
,
NULL
,
&
type
,
(
BYTE
*
)
dataW
,
&
data_count
);
ok
(
res
==
ERROR_MORE_DATA
,
"expected ERROR_MORE_DATA, got %ld"
,
res
);
ok
(
val_count
==
3
,
"val_count set to %ld"
,
val_count
);
ok
(
data_count
==
7
*
sizeof
(
WCHAR
),
"data_count set to %ld instead of 7*sizeof(WCHAR)"
,
data_count
);
ok
(
type
==
REG_SZ
,
"type %ld is not REG_SZ"
,
type
);
ok
(
!
memcmp
(
valueW
,
xxxW
,
sizeof
(
xxxW
)
),
"value modified"
);
ok
(
!
memcmp
(
dataW
,
xxxW
,
sizeof
(
xxxW
)
),
"data modified"
);
/* overflow data */
val_count
=
20
;
data_count
=
2
;
type
=
1234
;
memcpy
(
valueW
,
xxxW
,
sizeof
(
xxxW
)
);
memcpy
(
dataW
,
xxxW
,
sizeof
(
xxxW
)
);
res
=
RegEnumValueW
(
hkey_main
,
0
,
valueW
,
&
val_count
,
NULL
,
&
type
,
(
BYTE
*
)
dataW
,
&
data_count
);
ok
(
res
==
ERROR_MORE_DATA
,
"expected ERROR_MORE_DATA, got %ld"
,
res
);
ok
(
val_count
==
4
,
"val_count set to %ld instead of 4"
,
val_count
);
ok
(
data_count
==
7
*
sizeof
(
WCHAR
),
"data_count set to %ld instead of 7*sizeof(WCHAR)"
,
data_count
);
ok
(
type
==
REG_SZ
,
"type %ld is not REG_SZ"
,
type
);
ok
(
!
memcmp
(
valueW
,
testW
,
sizeof
(
testW
)
),
"value is not 'Test'"
);
ok
(
!
memcmp
(
dataW
,
xxxW
,
sizeof
(
xxxW
)
),
"data modified"
);
/* no overflow */
val_count
=
20
;
data_count
=
20
;
type
=
1234
;
memcpy
(
valueW
,
xxxW
,
sizeof
(
xxxW
)
);
memcpy
(
dataW
,
xxxW
,
sizeof
(
xxxW
)
);
res
=
RegEnumValueW
(
hkey_main
,
0
,
valueW
,
&
val_count
,
NULL
,
&
type
,
(
BYTE
*
)
dataW
,
&
data_count
);
ok
(
res
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %ld"
,
res
);
ok
(
val_count
==
4
,
"val_count set to %ld instead of 4"
,
val_count
);
ok
(
data_count
==
7
*
sizeof
(
WCHAR
),
"data_count set to %ld instead of 7*sizeof(WCHAR)"
,
data_count
);
ok
(
type
==
REG_SZ
,
"type %ld is not REG_SZ"
,
type
);
ok
(
!
memcmp
(
valueW
,
testW
,
sizeof
(
testW
)
),
"value is not 'Test'"
);
ok
(
!
memcmp
(
dataW
,
foobarW
,
sizeof
(
foobarW
)
),
"data is not 'foobar'"
);
/* cleanup */
RegDeleteValueA
(
hkey_main
,
"Test"
);
}
START_TEST
(
registry
)
{
setup_main_key
();
test_enum_value
();
/* cleanup */
delete_key
(
hkey_main
);
}
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