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
f588d96e
Commit
f588d96e
authored
Mar 05, 2022
by
Eric Pouech
Committed by
Alexandre Julliard
Mar 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests/profile: Enable compilation with long types.
Signed-off-by:
Eric Pouech
<
eric.pouech@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a9ae4866
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
174 additions
and
173 deletions
+174
-173
profile.c
dlls/kernel32/tests/profile.c
+174
-173
No files found.
dlls/kernel32/tests/profile.c
View file @
f588d96e
...
...
@@ -17,6 +17,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#undef WINE_NO_LONG_TYPES
/* temporary for migration */
#include <stdarg.h>
#include <stdio.h>
...
...
@@ -36,7 +37,7 @@ static void check_profile_string_(int line, const char *section, const char *nam
{
char
value
[
200
]
=
{
0
};
DWORD
ret
=
GetPrivateProfileStringA
(
section
,
name
,
"default"
,
value
,
sizeof
(
value
),
file
);
ok_
(
__FILE__
,
line
)(
ret
==
strlen
(
expect
),
"expected len %
u, got %
u
\n
"
,
strlen
(
expect
),
ret
);
ok_
(
__FILE__
,
line
)(
ret
==
strlen
(
expect
),
"expected len %
Iu, got %l
u
\n
"
,
strlen
(
expect
),
ret
);
ok_
(
__FILE__
,
line
)(
!
strcmp
(
value
,
expect
),
"expected %s, got %s
\n
"
,
debugstr_a
(
expect
),
debugstr_a
(
value
));
}
#define check_profile_string(a, b, c, d) check_profile_string_(__LINE__, a, b, c, d);
...
...
@@ -191,7 +192,7 @@ static void test_profile_sections(void)
ok
(
ret
==
0
,
"expected return size 0, got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
||
GetLastError
()
==
0xdeadbeef
/* Win98 */
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
if
(
GetLastError
()
==
0xdeadbeef
)
on_win98
=
TRUE
;
SetLastError
(
0xdeadbeef
);
...
...
@@ -199,35 +200,35 @@ static void test_profile_sections(void)
ok
(
ret
==
0
,
"expected return size 0, got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
||
GetLastError
()
==
0xdeadbeef
/* Win98 */
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
if
(
!
on_win98
)
{
SetLastError
(
0xdeadbeef
);
ret
=
GetPrivateProfileSectionA
(
"section1"
,
NULL
,
0
,
testfile4
);
ok
(
ret
==
0
,
"expected return size 0, got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
}
SetLastError
(
0xdeadbeef
);
ret
=
GetPrivateProfileSectionA
(
NULL
,
buf
,
sizeof
(
buf
),
testfile4
);
ok
(
ret
==
0
,
"expected return size 0, got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
"expected ERROR_INVALID_PARAMETER, got %
l
d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
GetPrivateProfileSectionA
(
"section1"
,
buf
,
sizeof
(
buf
),
NULL
);
ok
(
ret
==
0
,
"expected return size 0, got %d
\n
"
,
ret
);
todo_wine
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"expected ERROR_FILE_NOT_FOUND, got %d
\n
"
,
GetLastError
());
"expected ERROR_FILE_NOT_FOUND, got %
l
d
\n
"
,
GetLastError
());
/* Existing empty section with no keys */
SetLastError
(
0xdeadbeef
);
ret
=
GetPrivateProfileSectionA
(
"section2"
,
buf
,
sizeof
(
buf
),
testfile4
);
ok
(
ret
==
0
,
"expected return size 0, got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %d
\n
"
,
GetLastError
());
"expected ERROR_SUCCESS, got %
l
d
\n
"
,
GetLastError
());
/* Existing section with keys and values*/
SetLastError
(
0xdeadbeef
);
...
...
@@ -238,7 +239,7 @@ static void test_profile_sections(void)
ret
,
buf
);
ok
(
buf
[
ret
-
1
]
==
0
&&
buf
[
ret
]
==
0
,
"returned buffer not terminated with double-null
\n
"
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %d
\n
"
,
GetLastError
());
"expected ERROR_SUCCESS, got %
l
d
\n
"
,
GetLastError
());
/* Existing section with no keys but has values */
SetLastError
(
0xdeadbeef
);
...
...
@@ -250,7 +251,7 @@ static void test_profile_sections(void)
ret
,
buf
);
ok
(
buf
[
ret
-
1
]
==
0
&&
buf
[
ret
]
==
0
,
"returned buffer not terminated with double-null
\n
"
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %d
\n
"
,
GetLastError
());
"expected ERROR_SUCCESS, got %
l
d
\n
"
,
GetLastError
());
/* Overflow*/
ret
=
GetPrivateProfileSectionA
(
"section1"
,
buf
,
24
,
testfile4
);
...
...
@@ -394,24 +395,24 @@ static void test_profile_existing(void)
{
if
(
!
ret
)
ok
(
broken
(
GetLastError
()
==
pe
[
i
].
broken_error
),
"%d: WritePrivateProfileString failed with error %u
\n
"
,
i
,
GetLastError
()
);
"%d: WritePrivateProfileString failed with error %
l
u
\n
"
,
i
,
GetLastError
()
);
CloseHandle
(
h
);
size
=
GetPrivateProfileStringA
(
SECTION
,
KEY
,
0
,
buffer
,
MAX_PATH
,
testfile1
);
if
(
ret
)
ok
(
size
==
5
,
"%d: test failed, number of characters copied: %d instead of 5
\n
"
,
i
,
size
);
ok
(
size
==
5
,
"%d: test failed, number of characters copied: %
l
d instead of 5
\n
"
,
i
,
size
);
else
ok
(
!
size
,
"%d: test failed, number of characters copied: %d instead of 0
\n
"
,
i
,
size
);
ok
(
!
size
,
"%d: test failed, number of characters copied: %
l
d instead of 0
\n
"
,
i
,
size
);
}
else
{
DWORD
err
=
GetLastError
();
ok
(
!
ret
,
"%d: WritePrivateProfileString succeeded
\n
"
,
i
);
if
(
!
ret
)
ok
(
err
==
pe
[
i
].
write_error
,
"%d: WritePrivateProfileString failed with error %
u/%
u
\n
"
,
ok
(
err
==
pe
[
i
].
write_error
,
"%d: WritePrivateProfileString failed with error %
lu/%l
u
\n
"
,
i
,
err
,
pe
[
i
].
write_error
);
CloseHandle
(
h
);
size
=
GetPrivateProfileStringA
(
SECTION
,
KEY
,
0
,
buffer
,
MAX_PATH
,
testfile1
);
ok
(
!
size
,
"%d: test failed, number of characters copied: %d instead of 0
\n
"
,
i
,
size
);
ok
(
!
size
,
"%d: test failed, number of characters copied: %
l
d instead of 0
\n
"
,
i
,
size
);
}
ok
(
DeleteFileA
(
testfile1
),
"delete failed
\n
"
);
...
...
@@ -430,7 +431,7 @@ static void test_profile_existing(void)
SetLastError
(
0xdeadbeef
);
ret
=
GetPrivateProfileStringA
(
SECTION
,
KEY
,
NULL
,
buffer
,
MAX_PATH
,
testfile2
);
if
(
!
pe
[
i
].
read_error
)
ok
(
ret
,
"%d: GetPrivateProfileString failed with error %u
\n
"
,
i
,
GetLastError
()
);
ok
(
ret
,
"%d: GetPrivateProfileString failed with error %
l
u
\n
"
,
i
,
GetLastError
()
);
else
ok
(
!
ret
,
"%d: GetPrivateProfileString succeeded
\n
"
,
i
);
CloseHandle
(
h
);
...
...
@@ -448,12 +449,12 @@ static void test_profile_delete_on_close(void)
h
=
CreateFileA
(
testfile
,
GENERIC_WRITE
,
FILE_SHARE_READ
,
NULL
,
CREATE_ALWAYS
,
FILE_FLAG_DELETE_ON_CLOSE
,
NULL
);
res
=
WriteFile
(
h
,
contents
,
sizeof
contents
-
1
,
&
size
,
NULL
);
ok
(
res
,
"Cannot write test file: %x
\n
"
,
GetLastError
()
);
ok
(
res
,
"Cannot write test file: %
l
x
\n
"
,
GetLastError
()
);
ok
(
size
==
sizeof
contents
-
1
,
"Test file: partial write
\n
"
);
SetLastError
(
0xdeadbeef
);
res
=
GetPrivateProfileIntA
(
SECTION
,
KEY
,
0
,
testfile
);
ok
(
res
==
123
,
"Got %d instead of 123
\n
"
,
res
);
ok
(
res
==
123
,
"Got %
l
d instead of 123
\n
"
,
res
);
/* This also deletes the file */
CloseHandle
(
h
);
...
...
@@ -470,12 +471,12 @@ static void test_profile_refresh(void)
h
=
CreateFileA
(
testfile
,
GENERIC_WRITE
,
FILE_SHARE_READ
,
NULL
,
CREATE_ALWAYS
,
FILE_FLAG_DELETE_ON_CLOSE
,
NULL
);
res
=
WriteFile
(
h
,
contents1
,
sizeof
contents1
-
1
,
&
size
,
NULL
);
ok
(
res
,
"Cannot write test file: %x
\n
"
,
GetLastError
()
);
ok
(
res
,
"Cannot write test file: %
l
x
\n
"
,
GetLastError
()
);
ok
(
size
==
sizeof
contents1
-
1
,
"Test file: partial write
\n
"
);
SetLastError
(
0xdeadbeef
);
res
=
GetPrivateProfileIntA
(
SECTION
,
KEY
,
0
,
testfile
);
ok
(
res
==
123
,
"Got %d instead of 123
\n
"
,
res
);
ok
(
res
==
123
,
"Got %
l
d instead of 123
\n
"
,
res
);
CloseHandle
(
h
);
...
...
@@ -484,12 +485,12 @@ static void test_profile_refresh(void)
h
=
CreateFileA
(
testfile
,
GENERIC_WRITE
,
FILE_SHARE_READ
,
NULL
,
CREATE_ALWAYS
,
FILE_FLAG_DELETE_ON_CLOSE
,
NULL
);
res
=
WriteFile
(
h
,
contents2
,
sizeof
contents2
-
1
,
&
size
,
NULL
);
ok
(
res
,
"Cannot write test file: %x
\n
"
,
GetLastError
()
);
ok
(
res
,
"Cannot write test file: %
l
x
\n
"
,
GetLastError
()
);
ok
(
size
==
sizeof
contents2
-
1
,
"Test file: partial write
\n
"
);
SetLastError
(
0xdeadbeef
);
res
=
GetPrivateProfileIntA
(
SECTION
,
KEY
,
0
,
testfile
);
ok
(
res
==
124
,
"Got %d instead of 124
\n
"
,
res
);
ok
(
res
==
124
,
"Got %
l
d instead of 124
\n
"
,
res
);
/* This also deletes the file */
CloseHandle
(
h
);
...
...
@@ -497,7 +498,7 @@ static void test_profile_refresh(void)
/* Cache must be invalidated if file no longer exists and default must be returned */
SetLastError
(
0xdeadbeef
);
res
=
GetPrivateProfileIntA
(
SECTION
,
KEY
,
421
,
testfile
);
ok
(
res
==
421
,
"Got %d instead of 421
\n
"
,
res
);
ok
(
res
==
421
,
"Got %
l
d instead of 421
\n
"
,
res
);
}
static
void
create_test_file
(
LPCSTR
name
,
LPCSTR
data
,
DWORD
size
)
...
...
@@ -536,7 +537,7 @@ static void test_profile_directory_readonly(void)
attributes
.
nLength
=
sizeof
(
attributes
);
ret
=
ConvertStringSecurityDescriptorToSecurityDescriptorA
(
sddl_string_everyone_readonly
,
SDDL_REVISION_1
,
&
attributes
.
lpSecurityDescriptor
,
NULL
);
ok
(
ret
==
TRUE
,
"ConvertStringSecurityDescriptorToSecurityDescriptor failed: %d
\n
"
,
GetLastError
());
ok
(
ret
==
TRUE
,
"ConvertStringSecurityDescriptorToSecurityDescriptor failed: %
l
d
\n
"
,
GetLastError
());
GetTempPathA
(
MAX_PATH
,
path_folder
);
lstrcatA
(
path_folder
,
"wine-test"
);
...
...
@@ -545,7 +546,7 @@ static void test_profile_directory_readonly(void)
lstrcatA
(
path_file
,
"
\\
tmp.ini"
);
ret
=
CreateDirectoryA
(
path_folder
,
&
attributes
);
ok
(
ret
==
TRUE
,
"CreateDirectoryA failed: %d
\n
"
,
GetLastError
());
ok
(
ret
==
TRUE
,
"CreateDirectoryA failed: %
l
d
\n
"
,
GetLastError
());
ret
=
WritePrivateProfileStringA
(
"App"
,
"key"
,
"string"
,
path_file
);
ok
(
ret
==
FALSE
,
"Expected FALSE, got %d
\n
"
,
ret
);
...
...
@@ -557,7 +558,7 @@ static void test_profile_directory_readonly(void)
ok
(
ret
==
FALSE
,
"Expected FALSE, got %d
\n
"
,
ret
);
ret
=
RemoveDirectoryA
(
path_folder
);
ok
(
ret
==
TRUE
,
"RemoveDirectoryA failed: %d
\n
"
,
GetLastError
());
ok
(
ret
==
TRUE
,
"RemoveDirectoryA failed: %
l
d
\n
"
,
GetLastError
());
LocalFree
(
attributes
.
lpSecurityDescriptor
);
}
...
...
@@ -589,7 +590,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
NULL
,
"name1"
,
"default"
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
18
,
"Expected 18, got %d
\n
"
,
ret
);
ok
(
ret
==
18
,
"Expected 18, got %
l
d
\n
"
,
ret
);
len
=
lstrlenA
(
"section1"
)
+
sizeof
(
CHAR
)
+
lstrlenA
(
"section2"
)
+
2
*
sizeof
(
CHAR
);
ok
(
!
memcmp
(
buf
,
"section1
\0
section2
\0
"
,
len
),
...
...
@@ -601,7 +602,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
emptystr
,
"name1"
,
"default"
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
7
,
"Expected 7, got %d
\n
"
,
ret
);
ok
(
ret
==
7
,
"Expected 7, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"default"
),
"Expected
\"
default
\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
emptystr_ok
(
emptystr
),
"AppName modified
\n
"
);
...
...
@@ -610,7 +611,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"notasection"
,
"name1"
,
"default"
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
7
,
"Expected 7, got %d
\n
"
,
ret
);
ok
(
ret
==
7
,
"Expected 7, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"default"
),
"Expected
\"
default
\"
, got
\"
%s
\"\n
"
,
buf
);
/* lpAppName is empty, lpDefault is NULL */
...
...
@@ -618,7 +619,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
emptystr
,
"name1"
,
NULL
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
0
,
"Expected 0, got %d
\n
"
,
ret
);
ok
(
ret
==
0
,
"Expected 0, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
""
),
"Expected
\"\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
emptystr_ok
(
emptystr
),
"AppName modified
\n
"
);
...
...
@@ -627,7 +628,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
emptystr
,
"name1"
,
""
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
0
,
"Expected 0, got %d
\n
"
,
ret
);
ok
(
ret
==
0
,
"Expected 0, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
""
),
"Expected
\"\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
emptystr_ok
(
emptystr
),
"AppName modified
\n
"
);
...
...
@@ -638,7 +639,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
def_val
,
"default "
);
ret
=
GetPrivateProfileStringA
(
emptystr
,
"name1"
,
def_val
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
7
,
"Expected 7, got %d
\n
"
,
ret
);
ok
(
ret
==
7
,
"Expected 7, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"default"
),
"Expected
\"
default
\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
emptystr_ok
(
emptystr
),
"AppName modified
\n
"
);
...
...
@@ -649,7 +650,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
def_val
,
"one two "
);
ret
=
GetPrivateProfileStringA
(
emptystr
,
"name1"
,
def_val
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
7
,
"Expected 7, got %d
\n
"
,
ret
);
ok
(
ret
==
7
,
"Expected 7, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"one two"
),
"Expected
\"
one two
\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
emptystr_ok
(
emptystr
),
"AppName modified
\n
"
);
...
...
@@ -658,7 +659,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
emptystr
,
"name1"
,
"one two"
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
7
,
"Expected 7, got %d
\n
"
,
ret
);
ok
(
ret
==
7
,
"Expected 7, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"one two"
),
"Expected
\"
one two
\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
emptystr_ok
(
emptystr
),
"AppName modified
\n
"
);
...
...
@@ -667,7 +668,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
NULL
,
"default"
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
18
,
"Expected 18, got %d
\n
"
,
ret
);
ok
(
ret
==
18
,
"Expected 18, got %
l
d
\n
"
,
ret
);
ok
(
!
memcmp
(
buf
,
"name1
\0
name2
\0
name4
\0
"
,
ret
+
1
),
"Expected
\"
name1
\\
x00name2
\\
x00name4
\\
x00
\\
x00
\"
, got %s
\n
"
,
debugstr_an
(
buf
,
(
ret
+
2
>=
MAX_PATH
?
MAX_PATH
:
ret
+
1
)));
...
...
@@ -677,7 +678,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
emptystr
,
"default"
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
7
,
"Expected 7, got %d
\n
"
,
ret
);
ok
(
ret
==
7
,
"Expected 7, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"default"
),
"Expected
\"
default
\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
emptystr_ok
(
emptystr
),
"KeyName modified
\n
"
);
...
...
@@ -686,7 +687,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
"notakey"
,
"default"
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
7
,
"Expected 7, got %d
\n
"
,
ret
);
ok
(
ret
==
7
,
"Expected 7, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"default"
),
"Expected
\"
default
\"
, got
\"
%s
\"\n
"
,
buf
);
/* lpKeyName is empty, lpDefault is NULL */
...
...
@@ -694,7 +695,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
emptystr
,
NULL
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
0
,
"Expected 0, got %d
\n
"
,
ret
);
ok
(
ret
==
0
,
"Expected 0, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
""
),
"Expected
\"\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
emptystr_ok
(
emptystr
),
"KeyName modified
\n
"
);
...
...
@@ -703,7 +704,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
emptystr
,
""
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
0
,
"Expected 0, got %d
\n
"
,
ret
);
ok
(
ret
==
0
,
"Expected 0, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
""
),
"Expected
\"\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
emptystr_ok
(
emptystr
),
"KeyName modified
\n
"
);
...
...
@@ -714,7 +715,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
def_val
,
"default "
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
emptystr
,
def_val
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
7
,
"Expected 7, got %d
\n
"
,
ret
);
ok
(
ret
==
7
,
"Expected 7, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"default"
),
"Expected
\"
default
\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
emptystr_ok
(
emptystr
),
"KeyName modified
\n
"
);
...
...
@@ -730,7 +731,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
"name1"
,
"default"
,
buf
,
MAX_PATH
,
NULL
);
ok
(
ret
==
7
,
"Expected 7, got %d
\n
"
,
ret
);
ok
(
ret
==
7
,
"Expected 7, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"default"
),
"Expected
\"
default
\"
, got
\"
%s
\"\n
"
,
buf
);
/* lpFileName is empty */
...
...
@@ -738,7 +739,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
"name1"
,
"default"
,
buf
,
MAX_PATH
,
""
);
ok
(
ret
==
7
,
"Expected 7, got %d
\n
"
,
ret
);
ok
(
ret
==
7
,
"Expected 7, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"default"
),
"Expected
\"
default
\"
, got
\"
%s
\"\n
"
,
buf
);
/* lpFileName is nonexistent */
...
...
@@ -746,7 +747,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
"name1"
,
"default"
,
buf
,
MAX_PATH
,
"nonexistent"
);
ok
(
ret
==
7
,
"Expected 7, got %d
\n
"
,
ret
);
ok
(
ret
==
7
,
"Expected 7, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"default"
),
"Expected
\"
default
\"
, got
\"
%s
\"\n
"
,
buf
);
/* nSize is 0 */
...
...
@@ -754,7 +755,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
"name1"
,
"default"
,
buf
,
0
,
filename
);
ok
(
ret
==
0
,
"Expected 0, got %d
\n
"
,
ret
);
ok
(
ret
==
0
,
"Expected 0, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"kumquat"
),
"Expected buf to be unchanged, got
\"
%s
\"\n
"
,
buf
);
/* nSize is exact size of output */
...
...
@@ -762,7 +763,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
"name1"
,
"default"
,
buf
,
4
,
filename
);
ok
(
ret
==
3
,
"Expected 3, got %d
\n
"
,
ret
);
ok
(
ret
==
3
,
"Expected 3, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"val"
),
"Expected
\"
val
\"
, got
\"
%s
\"\n
"
,
buf
);
/* nSize has room for NULL terminator */
...
...
@@ -770,7 +771,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
"name1"
,
"default"
,
buf
,
5
,
filename
);
ok
(
ret
==
4
,
"Expected 4, got %d
\n
"
,
ret
);
ok
(
ret
==
4
,
"Expected 4, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"val1"
),
"Expected
\"
val1
\"
, got
\"
%s
\"\n
"
,
buf
);
/* output is 1 character */
...
...
@@ -778,7 +779,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
"name4"
,
"default"
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
1
,
"Expected 1, got %d
\n
"
,
ret
);
ok
(
ret
==
1
,
"Expected 1, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"a"
),
"Expected
\"
a
\"
, got
\"
%s
\"\n
"
,
buf
);
/* output is 1 character, no room for NULL terminator */
...
...
@@ -786,7 +787,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
"name4"
,
"default"
,
buf
,
1
,
filename
);
ok
(
ret
==
0
,
"Expected 0, got %d
\n
"
,
ret
);
ok
(
ret
==
0
,
"Expected 0, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
""
),
"Expected
\"\"
, got
\"
%s
\"\n
"
,
buf
);
/* lpAppName is NULL, not enough room for final section name */
...
...
@@ -794,7 +795,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
NULL
,
"name1"
,
"default"
,
buf
,
16
,
filename
);
ok
(
ret
==
14
,
"Expected 14, got %d
\n
"
,
ret
);
ok
(
ret
==
14
,
"Expected 14, got %
l
d
\n
"
,
ret
);
len
=
lstrlenA
(
"section1"
)
+
2
*
sizeof
(
CHAR
);
todo_wine
ok
(
!
memcmp
(
buf
,
"section1
\0
secti
\0
"
,
ret
+
2
),
...
...
@@ -806,7 +807,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
NULL
,
"default"
,
buf
,
16
,
filename
);
ok
(
ret
==
14
,
"Expected 14, got %d
\n
"
,
ret
);
ok
(
ret
==
14
,
"Expected 14, got %
l
d
\n
"
,
ret
);
todo_wine
ok
(
!
memcmp
(
buf
,
"name1
\0
name2
\0
na
\0
"
,
ret
+
2
),
"Expected
\"
name1
\\
x00name2
\\
x00na
\\
x00
\\
x00
\"
, got %s
\n
"
,
...
...
@@ -817,7 +818,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
"name2"
,
"default"
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
4
,
"Expected 4, got %d
\n
"
,
ret
);
ok
(
ret
==
4
,
"Expected 4, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"val2"
),
"Expected
\"
val2
\"
, got
\"
%s
\"\n
"
,
buf
);
/* case does not match */
...
...
@@ -825,7 +826,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
"NaMe1"
,
"default"
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
4
,
"Expected 4, got %d
\n
"
,
ret
);
ok
(
ret
==
4
,
"Expected 4, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"val1"
),
"Expected
\"
val1
\"
, got
\"
%s
\"\n
"
,
buf
);
/* only filename is used */
...
...
@@ -833,7 +834,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
"NaMe1"
,
"default"
,
buf
,
MAX_PATH
,
"winetest.ini"
);
ok
(
ret
==
7
,
"Expected 7, got %d
\n
"
,
ret
);
ok
(
ret
==
7
,
"Expected 7, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"default"
),
"Expected
\"
default
\"
, got
\"
%s
\"\n
"
,
buf
);
GetWindowsDirectoryA
(
windir
,
MAX_PATH
);
...
...
@@ -853,7 +854,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
"NaMe1"
,
"default"
,
buf
,
MAX_PATH
,
tempfile
);
ok
(
ret
==
4
,
"Expected 4, got %d
\n
"
,
ret
);
ok
(
ret
==
4
,
"Expected 4, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"val1"
),
"Expected
\"
val1
\"
, got
\"
%s
\"\n
"
,
buf
);
/* successful case */
...
...
@@ -861,7 +862,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
"name1"
,
"default"
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
4
,
"Expected 4, got %d
\n
"
,
ret
);
ok
(
ret
==
4
,
"Expected 4, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"val1"
),
"Expected
\"
val1
\"
, got
\"
%s
\"\n
"
,
buf
);
/* Existing section with no keys in an existing file */
...
...
@@ -869,12 +870,12 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
SetLastError
(
0xdeadbeef
);
ret
=
GetPrivateProfileStringA
(
"section2"
,
"DoesntExist"
,
""
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
0
,
"expected return size 0, got %d
\n
"
,
ret
);
ok
(
ret
==
0
,
"expected return size 0, got %
l
d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
""
),
"Expected
\"\"
, got
\"
%s
\"\n
"
,
buf
);
todo_wine
ok
(
GetLastError
()
==
0xdeadbeef
||
GetLastError
()
==
ERROR_FILE_NOT_FOUND
/* Win 7 */
,
"expected 0xdeadbeef or ERROR_FILE_NOT_FOUND, got %d
\n
"
,
GetLastError
());
"expected 0xdeadbeef or ERROR_FILE_NOT_FOUND, got %
l
d
\n
"
,
GetLastError
());
DeleteFileA
(
path
);
...
...
@@ -929,7 +930,7 @@ static void test_WritePrivateProfileString(void)
ret
=
WritePrivateProfileStringA
(
NULL
,
"key"
,
"string"
,
path
);
ok
(
ret
==
FALSE
,
"Expected FALSE, got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"Expected ERROR_FILE_NOT_FOUND, got %d
\n
"
,
GetLastError
());
"Expected ERROR_FILE_NOT_FOUND, got %
l
d
\n
"
,
GetLastError
());
ok
(
GetFileAttributesA
(
path
)
==
INVALID_FILE_ATTRIBUTES
,
"Expected path to not exist
\n
"
);
...
...
@@ -941,7 +942,7 @@ static void test_WritePrivateProfileString(void)
ret
=
WritePrivateProfileStringA
(
NULL
,
"key"
,
"string"
,
path
);
ok
(
ret
==
FALSE
,
"Expected FALSE, got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"Expected ERROR_FILE_NOT_FOUND, got %d
\n
"
,
GetLastError
());
"Expected ERROR_FILE_NOT_FOUND, got %
l
d
\n
"
,
GetLastError
());
ok
(
check_file_data
(
path
,
data
),
"File doesn't match
\n
"
);
DeleteFileA
(
path
);
...
...
@@ -1003,7 +1004,7 @@ static void test_WritePrivateProfileString(void)
ret
=
WritePrivateProfileStringA
(
"App"
,
"key"
,
"string"
,
""
);
ok
(
ret
==
FALSE
,
"Expected FALSE, got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"Expected ERROR_ACCESS_DENIED, got %d
\n
"
,
GetLastError
());
"Expected ERROR_ACCESS_DENIED, got %
l
d
\n
"
,
GetLastError
());
/* Relative paths are relative to X:\\%WINDIR% */
GetWindowsDirectoryA
(
path
,
MAX_PATH
);
...
...
@@ -1019,7 +1020,7 @@ static void test_WritePrivateProfileString(void)
data
=
"[App]
\r\n
"
"key=string
\r\n
"
;
ret
=
WritePrivateProfileStringA
(
"App"
,
"key"
,
"string"
,
"win1.tmp"
);
ok
(
ret
==
TRUE
,
"Expected TRUE, got %d, le=%u
\n
"
,
ret
,
GetLastError
());
ok
(
ret
==
TRUE
,
"Expected TRUE, got %d, le=%
l
u
\n
"
,
ret
,
GetLastError
());
ok
(
check_file_data
(
path
,
data
),
"File doesn't match
\n
"
);
DeleteFileA
(
path
);
}
...
...
@@ -1115,25 +1116,25 @@ static void test_profile_struct(void)
SetLastError
(
0xdeadbeef
);
ret
=
GetPrivateProfileStructA
(
"s"
,
"key"
,
buffer
,
sizeof
(
buffer
),
"./winetest.ini"
);
ok
(
!
ret
,
"expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_BAD_LENGTH
,
"got error %u
\n
"
,
GetLastError
());
todo_wine
ok
(
GetLastError
()
==
ERROR_BAD_LENGTH
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
WritePrivateProfileStructA
(
"s"
,
"key"
,
(
void
*
)
"abacus"
,
sizeof
(
"abacus"
),
"./winetest.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
ok
(
check_file_data
(
"./winetest.ini"
,
expect_data
),
"file doesn't match
\n
"
);
SetLastError
(
0xdeadbeef
);
ret
=
GetPrivateProfileStructA
(
"s"
,
"key"
,
buffer
,
6
,
"./winetest.ini"
);
ok
(
!
ret
,
"expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_BAD_LENGTH
,
"got error %u
\n
"
,
GetLastError
());
todo_wine
ok
(
GetLastError
()
==
ERROR_BAD_LENGTH
,
"got error %
l
u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
GetPrivateProfileStructA
(
"s"
,
"key"
,
buffer
,
8
,
"./winetest.ini"
);
ok
(
!
ret
,
"expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_BAD_LENGTH
,
"got error %u
\n
"
,
GetLastError
());
todo_wine
ok
(
GetLastError
()
==
ERROR_BAD_LENGTH
,
"got error %
l
u
\n
"
,
GetLastError
());
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
ret
=
GetPrivateProfileStructA
(
"s"
,
"key"
,
buffer
,
7
,
"./winetest.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
ok
(
!
strcmp
(
buffer
,
"abacus"
),
"data didn't match
\n
"
);
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
...
...
@@ -1142,39 +1143,39 @@ static void test_profile_struct(void)
ok
(
!
strcmp
(
buffer
,
"616261637573006F"
),
"got %s
\n
"
,
debugstr_a
(
buffer
));
ret
=
WritePrivateProfileStringA
(
"s"
,
"key"
,
"636163747573006F"
,
"./winetest.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
GetPrivateProfileStructA
(
"s"
,
"key"
,
buffer
,
7
,
"./winetest.ini"
);
ok
(
!
ret
,
"expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_DATA
,
"got error %u
\n
"
,
GetLastError
());
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_DATA
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
WritePrivateProfileStringA
(
"s"
,
"key"
,
"6361637475730083"
,
"./winetest.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
ret
=
GetPrivateProfileStructA
(
"s"
,
"key"
,
buffer
,
7
,
"./winetest.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
ok
(
!
strcmp
(
buffer
,
"cactus"
),
"data didn't match
\n
"
);
ret
=
WritePrivateProfileStringA
(
"s"
,
"key"
,
"636163747573008Q"
,
"./winetest.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
GetPrivateProfileStructA
(
"s"
,
"key"
,
buffer
,
7
,
"./winetest.ini"
);
ok
(
!
ret
,
"expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_DATA
,
"got error %u
\n
"
,
GetLastError
());
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_DATA
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
WritePrivateProfileStringA
(
"s"
,
"key"
,
"16361637475730083"
,
"./winetest.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
GetPrivateProfileStructA
(
"s"
,
"key"
,
buffer
,
7
,
"./winetest.ini"
);
ok
(
!
ret
,
"expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_BAD_LENGTH
,
"got error %u
\n
"
,
GetLastError
());
todo_wine
ok
(
GetLastError
()
==
ERROR_BAD_LENGTH
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
DeleteFileA
(
"./winetest.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
}
static
void
check_registry_value_
(
int
line
,
HKEY
key
,
const
char
*
value
,
const
char
*
expect
)
...
...
@@ -1185,9 +1186,9 @@ static void check_registry_value_(int line, HKEY key, const char *value, const c
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
ret
=
RegQueryValueExA
(
key
,
value
,
0
,
&
type
,
(
BYTE
*
)
buffer
,
&
size
);
ok_
(
__FILE__
,
line
)(
!
ret
,
"got error %u
\n
"
,
ret
);
ok_
(
__FILE__
,
line
)(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
ok_
(
__FILE__
,
line
)(
!
strcmp
(
buffer
,
expect
),
"expected %s, got %s
\n
"
,
debugstr_a
(
expect
),
debugstr_a
(
buffer
));
ok_
(
__FILE__
,
line
)(
type
==
REG_SZ
,
"got type %u
\n
"
,
type
);
ok_
(
__FILE__
,
line
)(
type
==
REG_SZ
,
"got type %
l
u
\n
"
,
type
);
}
#define check_registry_value(a, b, c) check_registry_value_(__LINE__, a, b, c)
...
...
@@ -1200,7 +1201,7 @@ static void test_registry_mapping(void)
/* impersonate ourselves to prevent registry virtualization */
ret
=
ImpersonateSelf
(
SecurityImpersonation
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
RegCreateKeyExA
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Windows NT
\\
CurrentVersion
\\
IniFileMapping
\\
winetest_map.ini"
,
...
...
@@ -1210,27 +1211,27 @@ static void test_registry_mapping(void)
skip
(
"Not enough permissions to write to the IniFileMapping key.
\n
"
);
return
;
}
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
ret
=
RegSetValueExA
(
mapping_key
,
"section1"
,
0
,
REG_SZ
,
(
BYTE
*
)
"USR:winetest_map"
,
sizeof
(
"USR:winetest_map"
));
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
ret
=
WritePrivateProfileStringA
(
NULL
,
NULL
,
NULL
,
"winetest_map.ini"
);
todo_wine
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
todo_wine
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
check_profile_string
(
"section1"
,
"name1"
,
"winetest_map.ini"
,
"default"
);
ret
=
WritePrivateProfileStringA
(
"section1"
,
"name1"
,
"value1"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
check_profile_string
(
"section1"
,
"name1"
,
"winetest_map.ini"
,
"value1"
);
check_profile_string
(
"section1"
,
"name1"
,
"C:/fake/path/winetest_map.ini"
,
"value1"
);
ret
=
RegOpenKeyExA
(
HKEY_CURRENT_USER
,
"winetest_map"
,
0
,
KEY_READ
|
KEY_WRITE
,
&
mapped_key
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
check_registry_value
(
mapped_key
,
"name1"
,
"value1"
);
ret
=
RegSetValueExA
(
mapped_key
,
"name2"
,
0
,
REG_SZ
,
(
BYTE
*
)
"value2"
,
sizeof
(
"value2"
));
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
check_profile_string
(
"section1"
,
"name2"
,
"winetest_map.ini"
,
"value2"
);
...
...
@@ -1238,40 +1239,40 @@ static void test_registry_mapping(void)
ok
(
ret
==
INVALID_FILE_ATTRIBUTES
,
"winetest_map.ini should not exist.
\n
"
);
ret
=
WritePrivateProfileStringA
(
"section1"
,
"name2"
,
NULL
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
RegQueryValueExA
(
mapped_key
,
"name2"
,
0
,
NULL
,
NULL
,
NULL
);
ok
(
ret
==
ERROR_FILE_NOT_FOUND
,
"got error %u
\n
"
,
ret
);
ok
(
ret
==
ERROR_FILE_NOT_FOUND
,
"got error %
l
u
\n
"
,
ret
);
/* Test non-string types. */
ret
=
RegSetValueExA
(
mapped_key
,
"name3"
,
0
,
REG_DWORD
,
(
BYTE
*
)
&
ivalue
,
sizeof
(
ivalue
));
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
check_profile_string
(
"section1"
,
"name3"
,
"winetest_map.ini"
,
"default"
);
ret
=
GetPrivateProfileIntA
(
"section1"
,
"name3"
,
0
,
"winetest_map.ini"
);
ok
(
ret
==
0
,
"got %#x
\n
"
,
ret
);
ok
(
ret
==
0
,
"got %#
l
x
\n
"
,
ret
);
ret
=
RegSetValueExA
(
mapped_key
,
"name3"
,
0
,
REG_BINARY
,
(
BYTE
*
)
"value3"
,
sizeof
(
"value3"
));
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
check_profile_string
(
"section1"
,
"name3"
,
"winetest_map.ini"
,
"default"
);
ret
=
RegSetValueExA
(
mapped_key
,
"name3"
,
0
,
REG_MULTI_SZ
,
(
BYTE
*
)
"one
\0
two
\0
"
,
sizeof
(
"one
\0
two
\0
"
));
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
check_profile_string
(
"section1"
,
"name3"
,
"winetest_map.ini"
,
"default"
);
ret
=
RegSetValueExA
(
mapped_key
,
"name3"
,
0
,
REG_EXPAND_SZ
,
(
BYTE
*
)
"x%SystemRoot%"
,
sizeof
(
"x%SystemRoot%"
));
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
check_profile_string
(
"section1"
,
"name3"
,
"winetest_map.ini"
,
"default"
);
/* Test WritePrivateProfileSection(). Unlike with .ini files, it doesn't
* remove existing entries. */
ret
=
WritePrivateProfileStringA
(
"section1"
,
"name4"
,
"value4"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
WritePrivateProfileStringA
(
"section1"
,
"name5"
,
"value5"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
WritePrivateProfileSectionA
(
"section1"
,
"name4=four
\0
name6=six
\0
"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
check_profile_string
(
"section1"
,
"name4"
,
"winetest_map.ini"
,
"four"
);
check_profile_string
(
"section1"
,
"name5"
,
"winetest_map.ini"
,
"value5"
);
check_profile_string
(
"section1"
,
"name6"
,
"winetest_map.ini"
,
"six"
);
...
...
@@ -1281,74 +1282,74 @@ static void test_registry_mapping(void)
RegCloseKey
(
mapped_key
);
ret
=
RegCreateKeyExA
(
HKEY_CURRENT_USER
,
"winetest_map
\\
subkey"
,
0
,
NULL
,
0
,
0
,
NULL
,
&
mapped_key
,
NULL
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
RegCloseKey
(
mapped_key
);
ret
=
WritePrivateProfileStringA
(
"section1"
,
"name1"
,
"value1"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
WritePrivateProfileStringA
(
"section1"
,
NULL
,
NULL
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
check_profile_string
(
"section1"
,
"name1"
,
"winetest_map.ini"
,
"default"
);
ret
=
WritePrivateProfileStringA
(
"section1"
,
"name1"
,
"value1"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
WritePrivateProfileSectionA
(
"section1"
,
NULL
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
check_profile_string
(
"section1"
,
"name1"
,
"winetest_map.ini"
,
"default"
);
ret
=
RegDeleteKeyA
(
HKEY_CURRENT_USER
,
"winetest_map
\\
subkey"
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
ret
=
RegDeleteKeyA
(
HKEY_CURRENT_USER
,
"winetest_map"
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
/* Test GetPrivateProfileSectionNames(). */
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
ret
=
GetPrivateProfileSectionNamesA
(
buffer
,
5
,
"winetest_map.ini"
);
ok
(
ret
==
3
,
"got %u
\n
"
,
ret
);
ok
(
ret
==
3
,
"got %
l
u
\n
"
,
ret
);
ok
(
!
memcmp
(
buffer
,
"sec
\0
"
,
5
),
"got %s
\n
"
,
debugstr_an
(
buffer
,
ret
));
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
ret
=
GetPrivateProfileSectionNamesA
(
buffer
,
sizeof
(
buffer
),
"winetest_map.ini"
);
ok
(
ret
==
9
,
"got %u
\n
"
,
ret
);
ok
(
ret
==
9
,
"got %
l
u
\n
"
,
ret
);
ok
(
!
memcmp
(
buffer
,
"section1
\0
"
,
10
),
"got %s
\n
"
,
debugstr_an
(
buffer
,
ret
));
ret
=
WritePrivateProfileStringA
(
"file_section"
,
"name1"
,
"value1"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
ret
=
GetPrivateProfileSectionNamesA
(
buffer
,
5
,
"winetest_map.ini"
);
ok
(
ret
==
3
,
"got %u
\n
"
,
ret
);
ok
(
ret
==
3
,
"got %
l
u
\n
"
,
ret
);
ok
(
!
memcmp
(
buffer
,
"sec
\0
"
,
5
),
"got %s
\n
"
,
debugstr_an
(
buffer
,
ret
));
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
ret
=
GetPrivateProfileSectionNamesA
(
buffer
,
sizeof
(
buffer
),
"winetest_map.ini"
);
ok
(
ret
==
22
,
"got %u
\n
"
,
ret
);
ok
(
ret
==
22
,
"got %
l
u
\n
"
,
ret
);
ok
(
!
memcmp
(
buffer
,
"section1
\0
file_section
\0
"
,
23
),
"got %s
\n
"
,
debugstr_an
(
buffer
,
ret
));
ret
=
DeleteFileA
(
"C:/windows/winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
/* Test the SYS: prefix. */
ret
=
RegSetValueExA
(
mapping_key
,
"section2"
,
0
,
REG_SZ
,
(
BYTE
*
)
"SYS:winetest_map"
,
sizeof
(
"SYS:winetest_map"
));
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
ret
=
WritePrivateProfileStringA
(
NULL
,
NULL
,
NULL
,
"winetest_map.ini"
);
todo_wine
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
todo_wine
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
check_profile_string
(
"section2"
,
"name1"
,
"winetest_map.ini"
,
"default"
);
ret
=
WritePrivateProfileStringA
(
"section2"
,
"name1"
,
"value1"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
check_profile_string
(
"section2"
,
"name1"
,
"winetest_map.ini"
,
"value1"
);
ret
=
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
"Software
\\
winetest_map"
,
0
,
KEY_READ
|
KEY_WRITE
,
&
mapped_key
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
check_registry_value
(
mapped_key
,
"name1"
,
"value1"
);
ret
=
RegSetValueExA
(
mapped_key
,
"name2"
,
0
,
REG_SZ
,
(
BYTE
*
)
"value2"
,
sizeof
(
"value2"
));
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
check_profile_string
(
"section2"
,
"name2"
,
"winetest_map.ini"
,
"value2"
);
...
...
@@ -1356,75 +1357,75 @@ static void test_registry_mapping(void)
ok
(
ret
==
INVALID_FILE_ATTRIBUTES
,
"winetest_map.ini should not exist.
\n
"
);
ret
=
RegDeleteKeyA
(
mapped_key
,
""
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
RegCloseKey
(
mapped_key
);
/* Try writing directly to the .ini file on disk instead. */
ret
=
WritePrivateProfileStringA
(
"section3"
,
"name1"
,
"value1"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
check_profile_string
(
"section3"
,
"name1"
,
"winetest_map.ini"
,
"value1"
);
ret
=
RegSetValueExA
(
mapping_key
,
"section3"
,
0
,
REG_SZ
,
(
BYTE
*
)
"USR:winetest_map"
,
sizeof
(
"USR:winetest_map"
));
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
ret
=
WritePrivateProfileStringA
(
NULL
,
NULL
,
NULL
,
"winetest_map.ini"
);
todo_wine
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
todo_wine
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
check_profile_string
(
"section3"
,
"name1"
,
"winetest_map.ini"
,
"default"
);
ret
=
RegOpenKeyExA
(
HKEY_CURRENT_USER
,
"winetest_section3"
,
0
,
KEY_READ
|
KEY_WRITE
,
&
mapped_key
);
ok
(
ret
==
ERROR_FILE_NOT_FOUND
,
"got error %u
\n
"
,
ret
);
ok
(
ret
==
ERROR_FILE_NOT_FOUND
,
"got error %
l
u
\n
"
,
ret
);
ret
=
WritePrivateProfileStringA
(
"section3"
,
"name1"
,
"value2"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
check_profile_string
(
"section3"
,
"name1"
,
"winetest_map.ini"
,
"value2"
);
ret
=
RegOpenKeyExA
(
HKEY_CURRENT_USER
,
"winetest_map"
,
0
,
KEY_READ
|
KEY_WRITE
,
&
mapped_key
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
ret
=
RegDeleteKeyA
(
mapped_key
,
""
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
RegCloseKey
(
mapped_key
);
ret
=
RegDeleteValueA
(
mapping_key
,
"section3"
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
ret
=
WritePrivateProfileStringA
(
NULL
,
NULL
,
NULL
,
"winetest_map.ini"
);
todo_wine
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
todo_wine
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
check_profile_string
(
"section3"
,
"name1"
,
"winetest_map.ini"
,
"value1"
);
ret
=
DeleteFileA
(
"C:/windows/winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
/* Test default keys. */
ret
=
WritePrivateProfileStringA
(
"section4"
,
"name1"
,
"value1"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
check_profile_string
(
"section4"
,
"name1"
,
"winetest_map.ini"
,
"value1"
);
ret
=
DeleteFileA
(
"C:/windows/winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
RegSetValueExA
(
mapping_key
,
NULL
,
0
,
REG_SZ
,
(
BYTE
*
)
"SYS:winetest_default"
,
sizeof
(
"SYS:winetest_default"
));
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
ret
=
WritePrivateProfileStringA
(
NULL
,
NULL
,
NULL
,
"winetest_map.ini"
);
todo_wine
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
todo_wine
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
WritePrivateProfileStringA
(
"section4"
,
"name1"
,
"value1"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
"Software
\\
winetest_default
\\
section4"
,
0
,
KEY_READ
,
&
mapped_key
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
check_registry_value
(
mapped_key
,
"name1"
,
"value1"
);
RegCloseKey
(
mapped_key
);
ret
=
RegCreateKeyExA
(
HKEY_LOCAL_MACHINE
,
"Software
\\
winetest_default
\\
section5"
,
0
,
NULL
,
0
,
KEY_WRITE
,
NULL
,
&
mapped_key
,
NULL
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
ret
=
RegSetValueExA
(
mapped_key
,
"name2"
,
0
,
REG_SZ
,
(
BYTE
*
)
"value2"
,
sizeof
(
"value2"
));
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
RegCloseKey
(
mapped_key
);
check_profile_string
(
"section5"
,
"name2"
,
"winetest_map.ini"
,
"value2"
);
...
...
@@ -1435,157 +1436,157 @@ static void test_registry_mapping(void)
ret
=
RegDeleteKeyA
(
HKEY_LOCAL_MACHINE
,
"Software
\\
winetest_default
\\
Section4"
);
ret
=
RegDeleteKeyA
(
HKEY_LOCAL_MACHINE
,
"Software
\\
winetest_default
\\
Section5"
);
ret
=
RegDeleteKeyA
(
HKEY_LOCAL_MACHINE
,
"Software
\\
winetest_default"
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
ret
=
RegDeleteValueA
(
mapping_key
,
NULL
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
/* Test name-specific mapping. */
ret
=
RegCreateKeyExA
(
mapping_key
,
"section6"
,
0
,
NULL
,
0
,
KEY_READ
|
KEY_WRITE
,
NULL
,
&
mapping_subkey
,
NULL
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
ret
=
RegSetValueExA
(
mapping_subkey
,
"name1"
,
0
,
REG_SZ
,
(
BYTE
*
)
"USR:winetest_name1"
,
sizeof
(
"USR:winetest_name1"
));
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
ret
=
RegSetValueExA
(
mapping_subkey
,
"name2"
,
0
,
REG_SZ
,
(
BYTE
*
)
"SYS:winetest_name2"
,
sizeof
(
"SYS:winetest_name2"
));
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
ret
=
WritePrivateProfileStringA
(
NULL
,
NULL
,
NULL
,
"winetest_map.ini"
);
todo_wine
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
todo_wine
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
WritePrivateProfileStringA
(
"section6"
,
"name1"
,
"value1"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
check_profile_string
(
"section6"
,
"name1"
,
"winetest_map.ini"
,
"value1"
);
ret
=
RegOpenKeyExA
(
HKEY_CURRENT_USER
,
"winetest_name1"
,
0
,
KEY_READ
|
KEY_WRITE
,
&
mapped_key
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
check_registry_value
(
mapped_key
,
"name1"
,
"value1"
);
ret
=
RegSetValueExA
(
mapped_key
,
"name1"
,
0
,
REG_SZ
,
(
BYTE
*
)
"one"
,
sizeof
(
"one"
));
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
check_profile_string
(
"section6"
,
"name1"
,
"winetest_map.ini"
,
"one"
);
ret
=
RegDeleteKeyA
(
mapped_key
,
""
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
RegCloseKey
(
mapped_key
);
ret
=
WritePrivateProfileStringA
(
"section6"
,
"name2"
,
"value2"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
"Software
\\
winetest_name2"
,
0
,
KEY_READ
|
KEY_WRITE
,
&
mapped_key
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
check_registry_value
(
mapped_key
,
"name2"
,
"value2"
);
ret
=
RegSetValueExA
(
mapped_key
,
"name2"
,
0
,
REG_SZ
,
(
BYTE
*
)
"two"
,
sizeof
(
"two"
));
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
check_profile_string
(
"section6"
,
"name2"
,
"winetest_map.ini"
,
"two"
);
ret
=
RegDeleteKeyA
(
mapped_key
,
""
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
RegCloseKey
(
mapped_key
);
ret
=
WritePrivateProfileStringA
(
"section6"
,
"name3"
,
"value3"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
check_profile_string
(
"section6"
,
"name3"
,
"winetest_map.ini"
,
"value3"
);
ret
=
DeleteFileA
(
"C:/windows/winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
/* Test name-specific mapping with Get/WritePrivateProfileSection(). */
ret
=
WritePrivateProfileStringA
(
"section6"
,
"name2"
,
"value2"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
WritePrivateProfileStringA
(
"section6"
,
"name3"
,
"value3"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
WritePrivateProfileSectionA
(
"section6"
,
"name1=one
\0
name3=three
\0
"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
check_profile_string
(
"section6"
,
"name1"
,
"winetest_map.ini"
,
"one"
);
check_profile_string
(
"section6"
,
"name2"
,
"winetest_map.ini"
,
"value2"
);
check_profile_string
(
"section6"
,
"name3"
,
"winetest_map.ini"
,
"value3"
);
ret
=
RegOpenKeyExA
(
HKEY_CURRENT_USER
,
"winetest_name1"
,
0
,
KEY_READ
|
KEY_WRITE
,
&
mapped_key
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
ret
=
RegDeleteValueA
(
mapped_key
,
"name1"
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
RegCloseKey
(
mapped_key
);
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
ret
=
GetPrivateProfileSectionA
(
"section6"
,
buffer
,
5
,
"winetest_map.ini"
);
ok
(
ret
==
3
,
"got %u
\n
"
,
ret
);
ok
(
ret
==
3
,
"got %
l
u
\n
"
,
ret
);
ok
(
!
memcmp
(
buffer
,
"nam
\0
"
,
5
),
"got %s
\n
"
,
debugstr_an
(
buffer
,
ret
));
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
ret
=
GetPrivateProfileSectionA
(
"section6"
,
buffer
,
sizeof
(
buffer
),
"winetest_map.ini"
);
ok
(
ret
==
26
,
"got %u
\n
"
,
ret
);
ok
(
ret
==
26
,
"got %
l
u
\n
"
,
ret
);
ok
(
!
memcmp
(
buffer
,
"name2=value2
\0
name3=value3
\0
"
,
27
),
"got %s
\n
"
,
debugstr_an
(
buffer
,
ret
));
ret
=
WritePrivateProfileStringA
(
"section6"
,
NULL
,
NULL
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
check_profile_string
(
"section6"
,
"name1"
,
"winetest_map.ini"
,
"default"
);
check_profile_string
(
"section6"
,
"name2"
,
"winetest_map.ini"
,
"default"
);
check_profile_string
(
"section6"
,
"name3"
,
"winetest_map.ini"
,
"default"
);
ret
=
RegDeleteKeyA
(
HKEY_CURRENT_USER
,
"winetest_name1"
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
ret
=
RegDeleteKeyA
(
HKEY_LOCAL_MACHINE
,
"Software
\\
winetest_name2"
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
ret
=
DeleteFileA
(
"C:/windows/winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
/* Test name-specific mapping with a default value. */
ret
=
RegSetValueExA
(
mapping_subkey
,
NULL
,
0
,
REG_SZ
,
(
BYTE
*
)
"USR:winetest_default"
,
sizeof
(
"USR:winetest_default"
));
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
ret
=
WritePrivateProfileStringA
(
NULL
,
NULL
,
NULL
,
"winetest_map.ini"
);
todo_wine
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
todo_wine
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
WritePrivateProfileStringA
(
"section6"
,
"name2"
,
"value2"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
WritePrivateProfileStringA
(
"section6"
,
"name3"
,
"value3"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
RegOpenKeyExA
(
HKEY_CURRENT_USER
,
"winetest_default"
,
0
,
KEY_READ
|
KEY_WRITE
,
&
mapped_key
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
check_registry_value
(
mapped_key
,
"name3"
,
"value3"
);
ret
=
RegSetValueExA
(
mapped_key
,
"name3"
,
0
,
REG_SZ
,
(
BYTE
*
)
"three"
,
sizeof
(
"three"
));
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
check_profile_string
(
"section6"
,
"name3"
,
"winetest_map.ini"
,
"three"
);
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
ret
=
GetPrivateProfileSectionA
(
"section6"
,
buffer
,
sizeof
(
buffer
),
"winetest_map.ini"
);
ok
(
ret
==
25
,
"got %u
\n
"
,
ret
);
ok
(
ret
==
25
,
"got %
l
u
\n
"
,
ret
);
todo_wine
ok
(
!
memcmp
(
buffer
,
"name2=value2
\0
name3=three
\0
"
,
26
),
"got %s
\n
"
,
debugstr_an
(
buffer
,
ret
));
ret
=
WritePrivateProfileSectionA
(
"section6"
,
"name2=duo
\0
name3=treis
\0
"
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
check_profile_string
(
"section6"
,
"name2"
,
"winetest_map.ini"
,
"duo"
);
check_profile_string
(
"section6"
,
"name3"
,
"winetest_map.ini"
,
"treis"
);
ret
=
WritePrivateProfileStringA
(
"section6"
,
NULL
,
NULL
,
"winetest_map.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
check_profile_string
(
"section6"
,
"name2"
,
"winetest_map.ini"
,
"default"
);
check_profile_string
(
"section6"
,
"name3"
,
"winetest_map.ini"
,
"default"
);
ret
=
RegDeleteKeyA
(
HKEY_LOCAL_MACHINE
,
"Software
\\
winetest_name2"
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
ret
=
RegDeleteKeyA
(
HKEY_CURRENT_USER
,
"winetest_name1"
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
ret
=
RegDeleteKeyA
(
mapped_key
,
""
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
RegCloseKey
(
mapped_key
);
ret
=
RegDeleteKeyA
(
mapping_subkey
,
""
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
RegCloseKey
(
mapping_subkey
);
ret
=
RegDeleteKeyA
(
mapping_key
,
""
);
ok
(
!
ret
,
"got error %u
\n
"
,
ret
);
ok
(
!
ret
,
"got error %
l
u
\n
"
,
ret
);
RegCloseKey
(
mapping_key
);
ret
=
DeleteFileA
(
"C:/windows/winetest_map.ini"
);
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"got error %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"got error %
l
u
\n
"
,
GetLastError
());
ret
=
RevertToSelf
();
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got error %
l
u
\n
"
,
GetLastError
());
}
START_TEST
(
profile
)
...
...
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