Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexey Alyaev
wine
Commits
9d85d46a
Commit
9d85d46a
authored
14 years ago
by
Andrew Nguyen
Committed by
Alexandre Julliard
14 years ago
Browse files
Options
Downloads
Patches
Plain Diff
propsys: Implement PSPropertyKeyFromString.
parent
c20908bf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dlls/propsys/propsys.spec
+1
-1
1 addition, 1 deletion
dlls/propsys/propsys.spec
dlls/propsys/propsys_main.c
+142
-0
142 additions, 0 deletions
dlls/propsys/propsys_main.c
include/propsys.idl
+1
-0
1 addition, 0 deletions
include/propsys.idl
with
144 additions
and
1 deletion
dlls/propsys/propsys.spec
+
1
−
1
View file @
9d85d46a
...
...
@@ -87,7 +87,7 @@
@ stub PSGetPropertySystem
@ stub PSGetPropertyValue
@ stub PSLookupPropertyHandlerCLSID
@ st
ub
PSPropertyKeyFromString
@ st
dcall
PSPropertyKeyFromString
(wstr ptr)
@ stub PSRefreshPropertySchema
@ stdcall PSRegisterPropertySchema(wstr)
@ stub PSSetPropertyValue
...
...
This diff is collapsed.
Click to expand it.
dlls/propsys/propsys_main.c
+
142
−
0
View file @
9d85d46a
/*
* propsys main
*
* Copyright 1997, 2002 Alexandre Julliard
* Copyright 2008 James Hawkins
*
* This library is free software; you can redistribute it and/or
...
...
@@ -130,3 +131,144 @@ HRESULT WINAPI PSStringFromPropertyKey(REFPROPERTYKEY pkey, LPWSTR psz, UINT cch
return
HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
);
}
}
static
const
BYTE
hex2bin
[]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
/* 0x00 */
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
/* 0x10 */
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
/* 0x20 */
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
0
,
0
,
0
,
0
,
0
,
0
,
/* 0x30 */
0
,
10
,
11
,
12
,
13
,
14
,
15
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
/* 0x40 */
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
/* 0x50 */
0
,
10
,
11
,
12
,
13
,
14
,
15
/* 0x60 */
};
static
BOOL
validate_indices
(
LPCWSTR
s
,
int
min
,
int
max
)
{
int
i
;
for
(
i
=
min
;
i
<=
max
;
i
++
)
{
if
(
!
s
[
i
])
return
FALSE
;
if
(
i
==
0
)
{
if
(
s
[
i
]
!=
'{'
)
return
FALSE
;
}
else
if
(
i
==
9
||
i
==
14
||
i
==
19
||
i
==
24
)
{
if
(
s
[
i
]
!=
'-'
)
return
FALSE
;
}
else
if
(
i
==
37
)
{
if
(
s
[
i
]
!=
'}'
)
return
FALSE
;
}
else
{
if
(
s
[
i
]
>
'f'
||
(
!
hex2bin
[
s
[
i
]]
&&
s
[
i
]
!=
'0'
))
return
FALSE
;
}
}
return
TRUE
;
}
/* Adapted from CLSIDFromString helper in dlls/ole32/compobj.c and
* UuidFromString in dlls/rpcrt4/rpcrt4_main.c. */
static
BOOL
string_to_guid
(
LPCWSTR
s
,
LPGUID
id
)
{
/* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */
if
(
!
validate_indices
(
s
,
0
,
8
))
return
FALSE
;
id
->
Data1
=
(
hex2bin
[
s
[
1
]]
<<
28
|
hex2bin
[
s
[
2
]]
<<
24
|
hex2bin
[
s
[
3
]]
<<
20
|
hex2bin
[
s
[
4
]]
<<
16
|
hex2bin
[
s
[
5
]]
<<
12
|
hex2bin
[
s
[
6
]]
<<
8
|
hex2bin
[
s
[
7
]]
<<
4
|
hex2bin
[
s
[
8
]]);
if
(
!
validate_indices
(
s
,
9
,
14
))
return
FALSE
;
id
->
Data2
=
hex2bin
[
s
[
10
]]
<<
12
|
hex2bin
[
s
[
11
]]
<<
8
|
hex2bin
[
s
[
12
]]
<<
4
|
hex2bin
[
s
[
13
]];
if
(
!
validate_indices
(
s
,
15
,
19
))
return
FALSE
;
id
->
Data3
=
hex2bin
[
s
[
15
]]
<<
12
|
hex2bin
[
s
[
16
]]
<<
8
|
hex2bin
[
s
[
17
]]
<<
4
|
hex2bin
[
s
[
18
]];
/* these are just sequential bytes */
if
(
!
validate_indices
(
s
,
20
,
21
))
return
FALSE
;
id
->
Data4
[
0
]
=
hex2bin
[
s
[
20
]]
<<
4
|
hex2bin
[
s
[
21
]];
if
(
!
validate_indices
(
s
,
22
,
24
))
return
FALSE
;
id
->
Data4
[
1
]
=
hex2bin
[
s
[
22
]]
<<
4
|
hex2bin
[
s
[
23
]];
if
(
!
validate_indices
(
s
,
25
,
26
))
return
FALSE
;
id
->
Data4
[
2
]
=
hex2bin
[
s
[
25
]]
<<
4
|
hex2bin
[
s
[
26
]];
if
(
!
validate_indices
(
s
,
27
,
28
))
return
FALSE
;
id
->
Data4
[
3
]
=
hex2bin
[
s
[
27
]]
<<
4
|
hex2bin
[
s
[
28
]];
if
(
!
validate_indices
(
s
,
29
,
30
))
return
FALSE
;
id
->
Data4
[
4
]
=
hex2bin
[
s
[
29
]]
<<
4
|
hex2bin
[
s
[
30
]];
if
(
!
validate_indices
(
s
,
31
,
32
))
return
FALSE
;
id
->
Data4
[
5
]
=
hex2bin
[
s
[
31
]]
<<
4
|
hex2bin
[
s
[
32
]];
if
(
!
validate_indices
(
s
,
33
,
34
))
return
FALSE
;
id
->
Data4
[
6
]
=
hex2bin
[
s
[
33
]]
<<
4
|
hex2bin
[
s
[
34
]];
if
(
!
validate_indices
(
s
,
35
,
37
))
return
FALSE
;
id
->
Data4
[
7
]
=
hex2bin
[
s
[
35
]]
<<
4
|
hex2bin
[
s
[
36
]];
return
TRUE
;
}
HRESULT
WINAPI
PSPropertyKeyFromString
(
LPCWSTR
pszString
,
PROPERTYKEY
*
pkey
)
{
int
has_minus
=
0
;
TRACE
(
"(%s, %p)
\n
"
,
debugstr_w
(
pszString
),
pkey
);
if
(
!
pszString
||
!
pkey
)
return
E_POINTER
;
memset
(
pkey
,
0
,
sizeof
(
PROPERTYKEY
));
if
(
!
string_to_guid
(
pszString
,
&
pkey
->
fmtid
))
return
E_INVALIDARG
;
pszString
+=
GUIDSTRING_MAX
-
1
;
if
(
!*
pszString
)
return
E_INVALIDARG
;
/* Only the space seems to be recognized as whitespace. */
while
(
*
pszString
==
' '
)
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
==
'-'
)
{
has_minus
=
1
;
pszString
++
;
}
/* Skip any remaining spaces after minus sign. */
while
(
*
pszString
==
' '
)
pszString
++
;
/* Overflow is not checked. */
while
(
isdigitW
(
*
pszString
))
{
pkey
->
pid
*=
10
;
pkey
->
pid
+=
(
*
pszString
-
'0'
);
pszString
++
;
}
if
(
has_minus
)
pkey
->
pid
=
~
pkey
->
pid
+
1
;
return
S_OK
;
}
This diff is collapsed.
Click to expand it.
include/propsys.idl
+
1
−
0
View file @
9d85d46a
...
...
@@ -800,6 +800,7 @@ cpp_quote("#define GUIDSTRING_MAX 39")
cpp_quote("#define PKEYSTR_MAX (GUIDSTRING_MAX + 1 + PKEY_PIDSTR_MAX)")
cpp_quote("HRESULT WINAPI PSStringFromPropertyKey(REFPROPERTYKEY,LPWSTR,UINT);")
cpp_quote("HRESULT WINAPI PSPropertyKeyFromString(LPCWSTR,PROPERTYKEY*);")
/* TODO: Add remainder of the C api here */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment