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
da466288
Commit
da466288
authored
Sep 23, 2005
by
Eric Kohl
Committed by
Alexandre Julliard
Sep 23, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- String id 0 becomes a reserved (invalid) id.
- StringTableStringFromId returns a pointer to an empty string if the string id is invalid.
parent
882023b2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
25 deletions
+25
-25
stringtable.c
dlls/setupapi/stringtable.c
+21
-20
stringtable.c
dlls/setupapi/tests/stringtable.c
+4
-5
No files found.
dlls/setupapi/stringtable.c
View file @
da466288
...
...
@@ -239,14 +239,14 @@ StringTableAddString(HSTRING_TABLE hStringTable,
{
if
(
!
lstrcmpW
(
pStringTable
->
pSlots
[
i
].
pString
,
lpString
))
{
return
i
;
return
i
+
1
;
}
}
else
{
if
(
!
lstrcmpiW
(
pStringTable
->
pSlots
[
i
].
pString
,
lpString
))
{
return
i
;
return
i
+
1
;
}
}
}
...
...
@@ -275,7 +275,7 @@ StringTableAddString(HSTRING_TABLE hStringTable,
pStringTable
->
dwUsedSlots
++
;
return
i
;
return
i
+
1
;
}
}
...
...
@@ -436,20 +436,20 @@ StringTableGetExtraData(HSTRING_TABLE hStringTable,
return
FALSE
;
}
if
(
dwId
>=
pStringTable
->
dwMaxSlots
)
if
(
dwId
==
0
||
dwId
>
pStringTable
->
dwMaxSlots
)
{
ERR
(
"Invalid Slot id!
\n
"
);
return
FALSE
;
}
if
(
pStringTable
->
pSlots
[
dwId
].
dwSize
<
dwExtraDataSize
)
if
(
pStringTable
->
pSlots
[
dwId
-
1
].
dwSize
<
dwExtraDataSize
)
{
ERR
(
"Data size is too large!
\n
"
);
return
FALSE
;
}
memcpy
(
lpExtraData
,
pStringTable
->
pSlots
[
dwId
].
pData
,
pStringTable
->
pSlots
[
dwId
-
1
].
pData
,
dwExtraDataSize
);
return
TRUE
;
...
...
@@ -496,12 +496,12 @@ StringTableLookUpString(HSTRING_TABLE hStringTable,
if
(
dwFlags
&
1
)
{
if
(
!
lstrcmpW
(
pStringTable
->
pSlots
[
i
].
pString
,
lpString
))
return
i
;
return
i
+
1
;
}
else
{
if
(
!
lstrcmpiW
(
pStringTable
->
pSlots
[
i
].
pString
,
lpString
))
return
i
;
return
i
+
1
;
}
}
}
...
...
@@ -572,7 +572,7 @@ StringTableSetExtraData(HSTRING_TABLE hStringTable,
return
FALSE
;
}
if
(
dwId
>=
pStringTable
->
dwMaxSlots
)
if
(
dwId
==
0
||
dwId
>
pStringTable
->
dwMaxSlots
)
{
ERR
(
"Invalid Slot id!
\n
"
);
return
FALSE
;
...
...
@@ -584,17 +584,17 @@ StringTableSetExtraData(HSTRING_TABLE hStringTable,
return
FALSE
;
}
pStringTable
->
pSlots
[
dwId
].
pData
=
MyMalloc
(
dwExtraDataSize
);
if
(
pStringTable
->
pSlots
[
dwId
].
pData
==
NULL
)
pStringTable
->
pSlots
[
dwId
-
1
].
pData
=
MyMalloc
(
dwExtraDataSize
);
if
(
pStringTable
->
pSlots
[
dwId
-
1
].
pData
==
NULL
)
{
ERR
(
"
\n
"
);
return
FALSE
;
}
memcpy
(
pStringTable
->
pSlots
[
dwId
].
pData
,
memcpy
(
pStringTable
->
pSlots
[
dwId
-
1
].
pData
,
lpExtraData
,
dwExtraDataSize
);
pStringTable
->
pSlots
[
dwId
].
dwSize
=
dwExtraDataSize
;
pStringTable
->
pSlots
[
dwId
-
1
].
dwSize
=
dwExtraDataSize
;
return
TRUE
;
}
...
...
@@ -618,6 +618,7 @@ StringTableStringFromId(HSTRING_TABLE hStringTable,
DWORD
dwId
)
{
PSTRING_TABLE
pStringTable
;
static
WCHAR
empty
[]
=
{
0
};
TRACE
(
"%p %lx
\n
"
,
hStringTable
,
dwId
);
...
...
@@ -628,10 +629,10 @@ StringTableStringFromId(HSTRING_TABLE hStringTable,
return
NULL
;
}
if
(
dwId
>=
pStringTable
->
dwMaxSlots
)
return
NULL
;
if
(
dwId
==
0
||
dwId
>
pStringTable
->
dwMaxSlots
)
return
empty
;
return
pStringTable
->
pSlots
[
dwId
].
pString
;
return
pStringTable
->
pSlots
[
dwId
-
1
].
pString
;
}
...
...
@@ -670,18 +671,18 @@ StringTableStringFromIdEx(HSTRING_TABLE hStringTable,
return
FALSE
;
}
if
(
dwId
>=
pStringTable
->
dwMaxSlots
||
pStringTable
->
pSlots
[
dwId
].
pString
==
NULL
)
if
(
dwId
==
0
||
dwId
>
pStringTable
->
dwMaxSlots
||
pStringTable
->
pSlots
[
dwId
-
1
].
pString
==
NULL
)
{
WARN
(
"Invalid string ID!
\n
"
);
*
lpBufferLength
=
0
;
return
FALSE
;
}
dwLength
=
(
lstrlenW
(
pStringTable
->
pSlots
[
dwId
].
pString
)
+
1
)
*
sizeof
(
WCHAR
);
dwLength
=
(
lstrlenW
(
pStringTable
->
pSlots
[
dwId
-
1
].
pString
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
dwLength
<=
*
lpBufferLength
)
{
lstrcpyW
(
lpBuffer
,
pStringTable
->
pSlots
[
dwId
].
pString
);
lstrcpyW
(
lpBuffer
,
pStringTable
->
pSlots
[
dwId
-
1
].
pString
);
bResult
=
TRUE
;
}
...
...
dlls/setupapi/tests/stringtable.c
View file @
da466288
...
...
@@ -122,15 +122,14 @@ static void test_StringTableStringFromId(void)
ok
(
string2
!=
NULL
,
"Failed to look up string by ID from String Table
\n
"
);
result
=
lstrcmpiW
(
string
,
string2
);
ok
(
result
==
0
,
"String %p does not match requested StringID %p
\n
"
,
string
,
string2
);
ok
(
result
==
0
,
"String
ID
%p does not match requested StringID %p
\n
"
,
string
,
string2
);
/* This should never work */
string3
=
pStringTableStringFromId
(
table
,
0
);
ok
(
string3
!=
NULL
,
"Failed to look up string by ID from String Table
\n
"
);
todo_wine
{
result
=
lstrcmpiW
(
string
,
string3
);
ok
(
result
!=
0
,
"String %p does not match requested StringID %p
\n
"
,
string
,
string2
);
}
result
=
lstrcmpiW
(
string
,
string3
);
ok
(
result
!=
0
,
"StringID %p matches requested StringID %p
\n
"
,
string
,
string3
);
}
START_TEST
(
stringtable
)
...
...
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