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
16fe2242
Commit
16fe2242
authored
May 20, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't use the Wine debug functions.
Fixed wrong A/W length checks.
parent
d8e990c1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
module.c
dlls/kernel/tests/module.c
+7
-9
No files found.
dlls/kernel/tests/module.c
View file @
16fe2242
...
...
@@ -19,14 +19,15 @@
*/
#include "wine/test.h"
#include "wine/debug.h"
#include <windows.h>
static
BOOL
cmpStrAW
(
const
char
*
a
,
const
WCHAR
*
b
,
DWORD
len
)
static
BOOL
cmpStrAW
(
const
char
*
a
,
const
WCHAR
*
b
,
DWORD
len
A
,
DWORD
lenB
)
{
WCHAR
aw
[
1024
];
MultiByteToWideChar
(
CP_ACP
,
0
,
a
,
len
,
aw
,
sizeof
(
aw
)
/
sizeof
(
aw
[
0
])
);
DWORD
len
=
MultiByteToWideChar
(
AreFileApisANSI
()
?
CP_ACP
:
CP_OEMCP
,
0
,
a
,
lenA
,
aw
,
sizeof
(
aw
)
/
sizeof
(
aw
[
0
])
);
if
(
len
!=
lenB
)
return
FALSE
;
return
memcmp
(
aw
,
b
,
len
*
sizeof
(
WCHAR
))
==
0
;
}
...
...
@@ -35,7 +36,7 @@ static void testGetModuleFileName(const char* name)
HMODULE
hMod
;
char
bufA
[
MAX_PATH
];
WCHAR
bufW
[
MAX_PATH
];
DWORD
len1A
,
len1W
,
len2A
,
len2W
,
l
;
DWORD
len1A
,
len1W
,
len2A
,
len2W
;
hMod
=
(
name
)
?
GetModuleHandle
(
name
)
:
NULL
;
...
...
@@ -46,10 +47,9 @@ static void testGetModuleFileName(const char* name)
memset
(
bufW
,
'-'
,
sizeof
(
bufW
));
len1W
=
GetModuleFileNameW
(
hMod
,
bufW
,
sizeof
(
bufW
)
/
sizeof
(
WCHAR
));
ok
(
len1W
>
0
,
"Getting module filename for handle %p
\n
"
,
hMod
);
ok
(
len1A
==
len1W
,
"Didn't get same A/W lengths (%ld/%ld)
\n
"
,
len1A
,
len1W
);
ok
(
len1A
==
strlen
(
bufA
),
"Unexpected length of GetModuleFilenameA (%ld/%d)
\n
"
,
len1A
,
strlen
(
bufA
));
ok
(
len1W
==
lstrlenW
(
bufW
),
"Unexpected length of GetModuleFilenameW (%ld/%d)
\n
"
,
len1W
,
lstrlenW
(
bufW
));
ok
(
cmpStrAW
(
bufA
,
bufW
,
l
=
min
(
len1A
,
len1W
)
),
"Comparing GetModuleFilenameAW results
\n
"
);
ok
(
cmpStrAW
(
bufA
,
bufW
,
l
en1A
,
len1W
),
"Comparing GetModuleFilenameAW results
\n
"
);
/* second test with a buffer too small */
memset
(
bufA
,
'-'
,
sizeof
(
bufA
));
...
...
@@ -58,9 +58,7 @@ static void testGetModuleFileName(const char* name)
memset
(
bufW
,
'-'
,
sizeof
(
bufW
));
len2W
=
GetModuleFileNameW
(
hMod
,
bufW
,
len1W
/
2
);
ok
(
len2W
>
0
,
"Getting module filename for handle %p
\n
"
,
hMod
);
ok
(
len2A
==
len2W
,
"Didn't get same A/W lengths (%ld/%ld)
\n
"
,
len2A
,
len2W
);
l
=
min
(
len2A
,
len2W
);
ok
(
cmpStrAW
(
bufA
,
bufW
,
l
),
"Comparing GetModuleFilenameAW results with buffer too small %s / %s
\n
"
,
wine_dbgstr_an
(
bufA
,
l
),
wine_dbgstr_wn
(
bufW
,
l
));
ok
(
cmpStrAW
(
bufA
,
bufW
,
len2A
,
len2W
),
"Comparing GetModuleFilenameAW results with buffer too small
\n
"
);
ok
(
len1A
/
2
==
len2A
,
"Correct length in GetModuleFilenameA with buffer too small (%ld/%ld)
\n
"
,
len1A
/
2
,
len2A
);
ok
(
len1W
/
2
==
len2W
,
"Correct length in GetModuleFilenameW with buffer too small (%ld/%ld)
\n
"
,
len1W
/
2
,
len2W
);
}
...
...
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