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
8d9434ee
Commit
8d9434ee
authored
May 06, 2009
by
Dmitry Kislyuk
Committed by
Alexandre Julliard
May 07, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Show that NULLs need to be preserved in data before first section.
parent
585c3abb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
7 deletions
+28
-7
profile.c
dlls/kernel32/tests/profile.c
+28
-7
No files found.
dlls/kernel32/tests/profile.c
View file @
8d9434ee
...
...
@@ -824,11 +824,10 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
static
DWORD
timeout
=
0
;
static
BOOL
check_
file_data
(
LPCSTR
path
,
LPCSTR
data
)
static
BOOL
check_
binary_file_data
(
LPCSTR
path
,
const
VOID
*
data
,
DWORD
size
)
{
HANDLE
file
;
CHAR
buf
[
MAX_PATH
];
DWORD
size
;
BOOL
ret
;
/* Sleep() is needed on Win9x and WinME */
...
...
@@ -839,17 +838,23 @@ static BOOL check_file_data(LPCSTR path, LPCSTR data)
if
(
file
==
INVALID_HANDLE_VALUE
)
return
FALSE
;
size
=
GetFileSize
(
file
,
NULL
);
buf
[
size
]
=
'\0'
;
if
(
size
!=
GetFileSize
(
file
,
NULL
)
)
{
CloseHandle
(
file
);
return
FALSE
;
}
ret
=
ReadFile
(
file
,
buf
,
size
,
&
size
,
NULL
);
CloseHandle
(
file
);
if
(
!
ret
)
return
FALSE
;
if
(
!*
data
&&
size
!=
0
)
return
FALSE
;
return
!
memcmp
(
buf
,
data
,
size
);
}
return
!
lstrcmpA
(
buf
,
data
);
static
BOOL
check_file_data
(
LPCSTR
path
,
LPCSTR
data
)
{
return
check_binary_file_data
(
path
,
data
,
lstrlenA
(
data
));
}
static
void
test_WritePrivateProfileString
(
void
)
...
...
@@ -1039,7 +1044,23 @@ static void test_WritePrivateProfileString(void)
ret
=
WritePrivateProfileStringA
(
"App3"
,
"key5"
,
NULL
,
path
);
ok
(
ret
==
TRUE
,
"Expected TRUE, got %d
\n
"
,
ret
);
ok
(
check_file_data
(
path
,
data
),
"File doesn't match
\n
"
);
DeleteFileA
(
path
);
/* NULLs in file before first section. Should be preserved in output */
data
=
"Data
\0
before
\0
first
\0
section"
/* 31 bytes */
"
\r\n
[section1]
\r\n
"
/* 14 bytes */
"key1=string1
\r\n
"
;
/* 14 bytes */
GetTempFileNameA
(
temp
,
"wine"
,
0
,
path
);
create_test_file
(
path
,
data
,
31
);
ret
=
WritePrivateProfileStringA
(
"section1"
,
"key1"
,
"string1"
,
path
);
ok
(
ret
==
TRUE
,
"Expected TRUE, got %d
\n
"
,
ret
);
todo_wine
ok
(
check_binary_file_data
(
path
,
data
,
59
)
||
broken
(
check_binary_file_data
(
path
,
/* Windows 9x */
"Data
\0
before
\0
first
\0
section"
/* 31 bytes */
"
\r\n\r\n
[section1]
\r\n
"
/* 14 bytes */
"key1=string1"
/* 14 bytes */
,
59
)),
"File doesn't match
\n
"
);
DeleteFileA
(
path
);
}
...
...
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