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
601870a4
Commit
601870a4
authored
Jan 07, 2009
by
Hans Leidekker
Committed by
Alexandre Julliard
Jan 07, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Add some tests for StringTableLookUpStringEx. Make them pass.
parent
0184dea2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
3 deletions
+35
-3
stringtable.c
dlls/setupapi/stringtable.c
+3
-2
stringtable.c
dlls/setupapi/tests/stringtable.c
+32
-1
No files found.
dlls/setupapi/stringtable.c
View file @
601870a4
...
...
@@ -273,6 +273,7 @@ StringTableAddStringEx(HSTRING_TABLE hStringTable, LPWSTR lpString,
return
~
0u
;
}
memcpy
(
pStringTable
->
pSlots
[
i
].
pData
,
lpExtraData
,
dwExtraDataSize
);
pStringTable
->
pSlots
[
i
].
dwSize
=
dwExtraDataSize
;
pStringTable
->
dwUsedSlots
++
;
return
i
+
1
;
}
...
...
@@ -492,7 +493,7 @@ StringTableLookUpStringEx(HSTRING_TABLE hStringTable,
if
(
!
lstrcmpW
(
pStringTable
->
pSlots
[
i
].
pString
,
lpString
))
{
if
(
lpExtraData
)
memcpy
(
lpExtraData
,
pStringTable
->
pSlots
[
i
].
pData
,
pStringTable
->
pSlots
[
i
].
dwSize
);
memcpy
(
lpExtraData
,
pStringTable
->
pSlots
[
i
].
pData
,
(
DWORD
)
lpReserved
);
return
i
+
1
;
}
}
...
...
@@ -501,7 +502,7 @@ StringTableLookUpStringEx(HSTRING_TABLE hStringTable,
if
(
!
lstrcmpiW
(
pStringTable
->
pSlots
[
i
].
pString
,
lpString
))
{
if
(
lpExtraData
)
memcpy
(
lpExtraData
,
pStringTable
->
pSlots
[
i
].
pData
,
pStringTable
->
pSlots
[
i
].
dwSize
);
memcpy
(
lpExtraData
,
pStringTable
->
pSlots
[
i
].
pData
,
(
DWORD
)
lpReserved
);
return
i
+
1
;
}
}
...
...
dlls/setupapi/tests/stringtable.c
View file @
601870a4
...
...
@@ -44,6 +44,7 @@ static DWORD (WINAPI *pStringTableAddStringEx)(HSTRING_TABLE, LPWSTR, DWORD,
static
VOID
(
WINAPI
*
pStringTableDestroy
)(
HSTRING_TABLE
);
static
HSTRING_TABLE
(
WINAPI
*
pStringTableDuplicate
)(
HSTRING_TABLE
hStringTable
);
static
HSTRING_TABLE
(
WINAPI
*
pStringTableInitialize
)(
VOID
);
static
HSTRING_TABLE
(
WINAPI
*
pStringTableInitializeEx
)(
DWORD
,
DWORD
);
static
DWORD
(
WINAPI
*
pStringTableLookUpString
)(
HSTRING_TABLE
,
LPWSTR
,
DWORD
);
static
DWORD
(
WINAPI
*
pStringTableLookUpStringEx
)(
HSTRING_TABLE
,
LPWSTR
,
DWORD
,
LPVOID
,
LPDWORD
);
static
LPWSTR
(
WINAPI
*
pStringTableStringFromId
)(
HSTRING_TABLE
,
DWORD
);
...
...
@@ -65,6 +66,10 @@ static void load_it_up(void)
if
(
!
pStringTableInitialize
)
pStringTableInitialize
=
(
void
*
)
GetProcAddress
(
hdll
,
"pSetupStringTableInitialize"
);
pStringTableInitializeEx
=
(
void
*
)
GetProcAddress
(
hdll
,
"StringTableInitializeEx"
);
if
(
!
pStringTableInitializeEx
)
pStringTableInitializeEx
=
(
void
*
)
GetProcAddress
(
hdll
,
"pSetupStringTableInitializeEx"
);
pStringTableAddString
=
(
void
*
)
GetProcAddress
(
hdll
,
"StringTableAddString"
);
if
(
!
pStringTableAddString
)
pStringTableAddString
=
(
void
*
)
GetProcAddress
(
hdll
,
"pSetupStringTableAddString"
);
...
...
@@ -221,8 +226,10 @@ static void test_StringTableLookUpString(void)
static
void
test_StringTableLookUpStringEx
(
void
)
{
DWORD
retval
,
retval2
,
hstring
,
hString
,
hfoo
;
static
WCHAR
uilevel
[]
=
{
'U'
,
'I'
,
'L'
,
'E'
,
'V'
,
'E'
,
'L'
,
0
};
DWORD
retval
,
retval2
,
hstring
,
hString
,
hfoo
,
data
;
HANDLE
table
,
table2
;
char
buffer
[
4
];
table
=
pStringTableInitialize
();
ok
(
table
!=
NULL
,
"Failed to Initialize String Table
\n
"
);
...
...
@@ -273,6 +280,30 @@ static void test_StringTableLookUpStringEx(void)
retval
,
hString
);
pStringTableDestroy
(
table
);
table
=
pStringTableInitializeEx
(
0x1000
,
0
);
ok
(
table
!=
NULL
,
"failed to initialize string table
\n
"
);
data
=
0xaaaaaaaa
;
retval
=
pStringTableAddStringEx
(
table
,
uilevel
,
0x5
,
&
data
,
sizeof
(
data
));
ok
(
retval
!=
~
0u
,
"failed to add 'UILEVEL' to string table
\n
"
);
memset
(
buffer
,
0x55
,
sizeof
(
buffer
));
retval
=
pStringTableLookUpStringEx
(
table
,
uilevel
,
ST_CASE_SENSITIVE_COMPARE
,
buffer
,
(
LPDWORD
)
0
);
ok
(
retval
!=
~
0u
,
"failed find 'UILEVEL' in string table
\n
"
);
ok
(
memcmp
(
buffer
,
&
data
,
4
),
"unexpected data
\n
"
);
memset
(
buffer
,
0x55
,
sizeof
(
buffer
));
retval
=
pStringTableLookUpStringEx
(
table
,
uilevel
,
ST_CASE_SENSITIVE_COMPARE
,
buffer
,
(
LPDWORD
)
2
);
ok
(
retval
!=
~
0u
,
"failed find 'UILEVEL' in string table
\n
"
);
ok
(
!
memcmp
(
buffer
,
&
data
,
2
),
"unexpected data
\n
"
);
memset
(
buffer
,
0x55
,
sizeof
(
buffer
));
retval
=
pStringTableLookUpStringEx
(
table
,
uilevel
,
ST_CASE_SENSITIVE_COMPARE
,
buffer
,
(
LPDWORD
)
sizeof
(
buffer
));
ok
(
retval
!=
~
0u
,
"failed find 'UILEVEL' in string table
\n
"
);
ok
(
!
memcmp
(
buffer
,
&
data
,
4
),
"unexpected data
\n
"
);
pStringTableDestroy
(
table
);
}
static
void
test_StringTableStringFromId
(
void
)
...
...
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