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
4c7f9efd
Commit
4c7f9efd
authored
Jul 27, 2010
by
Andrew Nguyen
Committed by
Alexandre Julliard
Jul 28, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
propsys: Fix comma processing in PSPropertyKeyFromString.
parent
067168b6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
18 deletions
+89
-18
propsys_main.c
dlls/propsys/propsys_main.c
+41
-18
propsys.c
dlls/propsys/tests/propsys.c
+48
-0
No files found.
dlls/propsys/propsys_main.c
View file @
4c7f9efd
...
...
@@ -216,7 +216,7 @@ static BOOL string_to_guid(LPCWSTR s, LPGUID id)
HRESULT
WINAPI
PSPropertyKeyFromString
(
LPCWSTR
pszString
,
PROPERTYKEY
*
pkey
)
{
int
has_minus
=
0
;
int
has_minus
=
0
,
has_comma
=
0
;
TRACE
(
"(%s, %p)
\n
"
,
debugstr_w
(
pszString
),
pkey
);
...
...
@@ -233,31 +233,54 @@ HRESULT WINAPI PSPropertyKeyFromString(LPCWSTR pszString, PROPERTYKEY *pkey)
if
(
!*
pszString
)
return
E_INVALIDARG
;
/* Only the space seems to be recognized as whitespace. */
while
(
*
pszString
==
' '
)
/* Only the space seems to be recognized as whitespace. The comma is only
* recognized once and processing terminates if another comma is found. */
while
(
*
pszString
==
' '
||
*
pszString
==
','
)
{
if
(
*
pszString
==
','
)
{
if
(
has_comma
)
return
S_OK
;
else
has_comma
=
1
;
}
pszString
++
;
}
if
(
!*
pszString
)
return
E_INVALIDARG
;
/* Only two minus signs are recognized. The first is ignored, and the
* second is interpreted. */
if
(
*
pszString
==
'-'
)
pszString
++
;
/* Skip any intermediate spaces after the first minus sign. */
while
(
*
pszString
==
' '
)
pszString
++
;
if
(
*
pszString
==
'-'
)
/* Only two minus signs are recognized if no comma is detected. The first
* sign is ignored, and the second is interpreted. If a comma is detected
* before the minus sign, then only one minus sign counts, and property ID
* interpretation begins with the next character. */
if
(
has_comma
)
{
has_minus
=
1
;
pszString
++
;
if
(
*
pszString
==
'-'
)
{
has_minus
=
1
;
pszString
++
;
}
}
else
{
if
(
*
pszString
==
'-'
)
pszString
++
;
/* Skip any remaining spaces after minus sign. */
while
(
*
pszString
==
' '
)
pszString
++
;
/* Skip any intermediate spaces after the first minus sign. */
while
(
*
pszString
==
' '
)
pszString
++
;
if
(
*
pszString
==
'-'
)
{
has_minus
=
1
;
pszString
++
;
}
/* Skip any remaining spaces after minus sign. */
while
(
*
pszString
==
' '
)
pszString
++
;
}
/* Overflow is not checked. */
while
(
isdigitW
(
*
pszString
))
...
...
dlls/propsys/tests/propsys.c
View file @
4c7f9efd
...
...
@@ -290,6 +290,42 @@ static void test_PSPropertyKeyFromString(void)
static
const
WCHAR
fmtid_overflowpidW
[]
=
{
'{'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'-'
,
'1'
,
'2'
,
'3'
,
'4'
,
'-'
,
'1'
,
'2'
,
'3'
,
'4'
,
'-'
,
'1'
,
'2'
,
'3'
,
'4'
,
'-'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'0'
,
'1'
,
'2'
,
'}'
,
' '
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'0'
,
'1'
,
0
};
static
const
WCHAR
fmtid_commapidW
[]
=
{
'{'
,
'1'
,
'2'
,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
'6'
,
'7'
,
'8'
,
'-'
,
'1'
,
'2'
,
'3'
,
'4'
,
'-'
,
'1'
,
'2'
,
'3'
,
'4'
,
'-'
,
'1'
,
'2'
,
'3'
,
'4'
,
'-'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'0'
,
'1'
,
'2'
,
'}'
,
','
,
'-'
,
' '
,
'1'
,
'3'
,
'5'
,
'7'
,
'9'
,
0
};
static
const
WCHAR
fmtid_negcommapidW
[]
=
{
'{'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'-'
,
'1'
,
'2'
,
'3'
,
'4'
,
'-'
,
'1'
,
'2'
,
'3'
,
'4'
,
'-'
,
'1'
,
'2'
,
'3'
,
'4'
,
'-'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'0'
,
'1'
,
'2'
,
'}'
,
'-'
,
','
,
'1'
,
'3'
,
'5'
,
'7'
,
'9'
,
0
};
static
const
WCHAR
fmtid_normalpidW
[]
=
{
'{'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'-'
,
'1'
,
'2'
,
'3'
,
'4'
,
'-'
,
'1'
,
'2'
,
'3'
,
'4'
,
'-'
,
'1'
,
'2'
,
'3'
,
'4'
,
'-'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'0'
,
'1'
,
'2'
,
'}'
,
' '
,
'1'
,
'3'
,
'5'
,
'7'
,
'9'
,
0
};
...
...
@@ -357,6 +393,18 @@ static void test_PSPropertyKeyFromString(void)
{
fmtid_hexpidW
,
&
out
,
S_OK
,
{
expect_guid
,
0
}},
{
fmtid_mixedpidW
,
&
out
,
S_OK
,
{
expect_guid
,
0
}},
{
fmtid_overflowpidW
,
&
out
,
S_OK
,
{
expect_guid
,
3755744309U
}},
{
fmtid_commapidW
,
&
out
,
S_OK
,
{
expect_guid
,
13579
}},
{
fmtid_commaspidW
,
&
out
,
S_OK
,
{
expect_guid
,
0
}},
{
fmtid_commaspacepidW
,
&
out
,
S_OK
,
{
expect_guid
,
13579
}},
{
fmtid_spacecommapidW
,
&
out
,
S_OK
,
{
expect_guid
,
13579
}},
{
fmtid_spccommaspcpidW
,
&
out
,
S_OK
,
{
expect_guid
,
13579
}},
{
fmtid_spacescommaspidW
,
&
out
,
S_OK
,
{
expect_guid
,
0
}},
{
fmtid_commanegpidW
,
&
out
,
S_OK
,
{
expect_guid
,
4294953717U
}},
{
fmtid_spccommanegpidW
,
&
out
,
S_OK
,
{
expect_guid
,
4294953717U
}},
{
fmtid_commaspcnegpidW
,
&
out
,
S_OK
,
{
expect_guid
,
4294953717U
}},
{
fmtid_spccommaspcnegpidW
,
&
out
,
S_OK
,
{
expect_guid
,
4294953717U
}},
{
fmtid_commanegspcpidW
,
&
out
,
S_OK
,
{
expect_guid
,
0U
}},
{
fmtid_negcommapidW
,
&
out
,
S_OK
,
{
expect_guid
,
0
}},
{
fmtid_normalpidW
,
&
out
,
S_OK
,
{
expect_guid
,
13579
}},
};
...
...
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