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
c2a26cee
Commit
c2a26cee
authored
Aug 17, 2008
by
Michael Karcher
Committed by
Alexandre Julliard
Aug 19, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Fix profile crash on NT and up.
parent
f4a99193
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
10 deletions
+37
-10
profile.c
dlls/kernel32/tests/profile.c
+37
-10
No files found.
dlls/kernel32/tests/profile.c
View file @
c2a26cee
...
...
@@ -380,6 +380,20 @@ static void create_test_file(LPCSTR name, LPCSTR data, DWORD size)
CloseHandle
(
hfile
);
}
static
BOOL
emptystr_ok
(
CHAR
emptystr
[
MAX_PATH
])
{
int
i
;
for
(
i
=
0
;
i
<
MAX_PATH
;
++
i
)
if
(
emptystr
[
i
]
!=
0
)
{
trace
(
"emptystr[%d] = %d
\n
"
,
i
,
emptystr
[
i
]);
return
FALSE
;
}
return
TRUE
;
}
static
void
test_GetPrivateProfileString
(
void
)
{
DWORD
ret
;
...
...
@@ -387,6 +401,9 @@ static void test_GetPrivateProfileString(void)
CHAR
def_val
[
MAX_PATH
];
CHAR
path
[
MAX_PATH
];
CHAR
windir
[
MAX_PATH
];
/* NT series crashes on r/o empty strings, so pass an r/w
empty string and check for modification */
CHAR
emptystr
[
MAX_PATH
]
=
""
;
LPSTR
tempfile
;
static
const
char
filename
[]
=
".
\\
winetest.ini"
;
...
...
@@ -410,10 +427,11 @@ static void test_GetPrivateProfileString(void)
/* lpAppName is empty */
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
""
,
"name1"
,
"default"
,
ret
=
GetPrivateProfileStringA
(
emptystr
,
"name1"
,
"default"
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
7
,
"Expected 7, got %d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"default"
),
"Expected
\"
default
\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
emptystr_ok
(
emptystr
),
"AppName modified
\n
"
);
/* lpAppName is missing */
lstrcpyA
(
buf
,
"kumquat"
);
...
...
@@ -424,42 +442,47 @@ static void test_GetPrivateProfileString(void)
/* lpAppName is empty, lpDefault is NULL */
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
""
,
"name1"
,
NULL
,
ret
=
GetPrivateProfileStringA
(
emptystr
,
"name1"
,
NULL
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
0
,
"Expected 0, got %d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
""
),
"Expected
\"\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
emptystr_ok
(
emptystr
),
"AppName modified
\n
"
);
/* lpAppName is empty, lpDefault is empty */
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
""
,
"name1"
,
""
,
ret
=
GetPrivateProfileStringA
(
emptystr
,
"name1"
,
""
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
0
,
"Expected 0, got %d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
""
),
"Expected
\"\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
emptystr_ok
(
emptystr
),
"AppName modified
\n
"
);
/* lpAppName is empty, lpDefault has trailing blank characters */
lstrcpyA
(
buf
,
"kumquat"
);
/* lpDefault must be writable (trailing blanks are removed inplace in win9x) */
lstrcpyA
(
def_val
,
"default "
);
ret
=
GetPrivateProfileStringA
(
""
,
"name1"
,
def_val
,
ret
=
GetPrivateProfileStringA
(
emptystr
,
"name1"
,
def_val
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
7
,
"Expected 7, got %d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"default"
),
"Expected
\"
default
\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
emptystr_ok
(
emptystr
),
"AppName modified
\n
"
);
/* lpAppName is empty, many blank characters in lpDefault */
lstrcpyA
(
buf
,
"kumquat"
);
/* lpDefault must be writable (trailing blanks are removed inplace in win9x) */
lstrcpyA
(
def_val
,
"one two "
);
ret
=
GetPrivateProfileStringA
(
""
,
"name1"
,
def_val
,
ret
=
GetPrivateProfileStringA
(
emptystr
,
"name1"
,
def_val
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
7
,
"Expected 7, got %d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"one two"
),
"Expected
\"
one two
\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
emptystr_ok
(
emptystr
),
"AppName modified
\n
"
);
/* lpAppName is empty, blank character but not trailing in lpDefault */
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
""
,
"name1"
,
"one two"
,
ret
=
GetPrivateProfileStringA
(
emptystr
,
"name1"
,
"one two"
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
7
,
"Expected 7, got %d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"one two"
),
"Expected
\"
one two
\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
emptystr_ok
(
emptystr
),
"AppName modified
\n
"
);
/* lpKeyName is NULL */
lstrcpyA
(
buf
,
"kumquat"
);
...
...
@@ -471,10 +494,11 @@ static void test_GetPrivateProfileString(void)
/* lpKeyName is empty */
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
""
,
"default"
,
ret
=
GetPrivateProfileStringA
(
"section1"
,
emptystr
,
"default"
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
7
,
"Expected 7, got %d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"default"
),
"Expected
\"
default
\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
emptystr_ok
(
emptystr
),
"KeyName modified
\n
"
);
/* lpKeyName is missing */
lstrcpyA
(
buf
,
"kumquat"
);
...
...
@@ -485,26 +509,29 @@ static void test_GetPrivateProfileString(void)
/* lpKeyName is empty, lpDefault is NULL */
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
""
,
NULL
,
ret
=
GetPrivateProfileStringA
(
"section1"
,
emptystr
,
NULL
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
0
,
"Expected 0, got %d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
""
),
"Expected
\"\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
emptystr_ok
(
emptystr
),
"KeyName modified
\n
"
);
/* lpKeyName is empty, lpDefault is empty */
lstrcpyA
(
buf
,
"kumquat"
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
""
,
""
,
ret
=
GetPrivateProfileStringA
(
"section1"
,
emptystr
,
""
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
0
,
"Expected 0, got %d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
""
),
"Expected
\"\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
emptystr_ok
(
emptystr
),
"KeyName modified
\n
"
);
/* lpKeyName is empty, lpDefault has trailing blank characters */
lstrcpyA
(
buf
,
"kumquat"
);
/* lpDefault must be writable (trailing blanks are removed inplace in win9x) */
lstrcpyA
(
def_val
,
"default "
);
ret
=
GetPrivateProfileStringA
(
"section1"
,
""
,
def_val
,
ret
=
GetPrivateProfileStringA
(
"section1"
,
emptystr
,
def_val
,
buf
,
MAX_PATH
,
filename
);
ok
(
ret
==
7
,
"Expected 7, got %d
\n
"
,
ret
);
ok
(
!
lstrcmpA
(
buf
,
"default"
),
"Expected
\"
default
\"
, got
\"
%s
\"\n
"
,
buf
);
ok
(
emptystr_ok
(
emptystr
),
"KeyName modified
\n
"
);
if
(
0
)
/* crashes */
{
...
...
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