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
5d90f2bc
Commit
5d90f2bc
authored
May 16, 2005
by
Juan Lang
Committed by
Alexandre Julliard
May 16, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store property names in the code page of the property set.
parent
0d5d7199
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
46 deletions
+52
-46
stg_prop.c
dlls/ole32/stg_prop.c
+52
-46
No files found.
dlls/ole32/stg_prop.c
View file @
5d90f2bc
...
...
@@ -249,8 +249,25 @@ static PROPVARIANT *PropertyStorage_FindPropertyByName(
assert
(
This
);
if
(
!
name
)
return
NULL
;
if
(
dictionary_find
(
This
->
name_to_propid
,
name
,
(
void
**
)
&
propid
))
ret
=
PropertyStorage_FindProperty
(
This
,
(
PROPID
)
propid
);
if
(
This
->
codePage
==
CP_UNICODE
)
{
if
(
dictionary_find
(
This
->
name_to_propid
,
name
,
(
void
**
)
&
propid
))
ret
=
PropertyStorage_FindProperty
(
This
,
(
PROPID
)
propid
);
}
else
{
LPSTR
ansiName
;
HRESULT
hr
=
PropertyStorage_StringCopy
((
LPCSTR
)
name
,
&
ansiName
,
This
->
codePage
,
CP_UNICODE
);
if
(
SUCCEEDED
(
hr
))
{
if
(
dictionary_find
(
This
->
name_to_propid
,
ansiName
,
(
void
**
)
&
propid
))
ret
=
PropertyStorage_FindProperty
(
This
,
(
PROPID
)
propid
);
CoTaskMemFree
(
ansiName
);
}
}
TRACE
(
"returning %p
\n
"
,
ret
);
return
ret
;
}
...
...
@@ -474,24 +491,22 @@ static HRESULT PropertyStorage_StorePropWithId(PropertyStorage_impl *This,
static
HRESULT
PropertyStorage_StoreNameWithIdW
(
PropertyStorage_impl
*
This
,
LPCWSTR
srcName
,
PROPID
id
)
{
size_t
len
;
LPWSTR
name
;
LPSTR
name
;
HRESULT
hr
;
assert
(
srcName
);
len
=
strlenW
(
srcName
)
+
1
;
name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
if
(
name
)
hr
=
PropertyStorage_StringCopy
((
LPCSTR
)
srcName
,
&
name
,
This
->
codePage
,
CP_UNICODE
);
if
(
SUCCEEDED
(
hr
)
)
{
strcpyW
(
name
,
srcName
);
TRACE
(
"Adding prop name %s, propid %ld
\n
"
,
debugstr_w
(
name
),
id
);
TRACE
(
"Adding prop name %s, propid %ld
\n
"
,
This
->
codePage
==
CP_UNICODE
?
debugstr_w
((
LPCWSTR
)
name
)
:
debugstr_a
(
name
),
id
);
dictionary_insert
(
This
->
name_to_propid
,
name
,
(
void
*
)
id
);
dictionary_insert
(
This
->
propid_to_name
,
(
void
*
)
id
,
name
);
hr
=
S_OK
;
}
else
hr
=
STG_E_INSUFFICIENTMEMORY
;
return
hr
;
}
...
...
@@ -890,14 +905,22 @@ static int PropertyStorage_PropNameCompare(const void *a, const void *b,
{
PropertyStorage_impl
*
This
=
(
PropertyStorage_impl
*
)
extra
;
TRACE
(
"(%s, %s)
\n
"
,
debugstr_w
(
a
),
debugstr_w
(
b
));
/* FIXME: this assumes property names are always Unicode, but they
* might be ANSI, depending on whether This->codePage is CP_UNICODE.
*/
if
(
This
->
grfFlags
&
PROPSETFLAG_CASE_SENSITIVE
)
return
strcmpW
((
LPCWSTR
)
a
,
(
LPCWSTR
)
b
);
if
(
This
->
codePage
==
CP_UNICODE
)
{
TRACE
(
"(%s, %s)
\n
"
,
debugstr_w
(
a
),
debugstr_w
(
b
));
if
(
This
->
grfFlags
&
PROPSETFLAG_CASE_SENSITIVE
)
return
lstrcmpW
((
LPCWSTR
)
a
,
(
LPCWSTR
)
b
);
else
return
lstrcmpiW
((
LPCWSTR
)
a
,
(
LPCWSTR
)
b
);
}
else
return
strcmpiW
((
LPCWSTR
)
a
,
(
LPCWSTR
)
b
);
{
TRACE
(
"(%s, %s)
\n
"
,
debugstr_a
(
a
),
debugstr_a
(
b
));
if
(
This
->
grfFlags
&
PROPSETFLAG_CASE_SENSITIVE
)
return
lstrcmpA
((
LPCSTR
)
a
,
(
LPCSTR
)
b
);
else
return
lstrcmpiA
((
LPCSTR
)
a
,
(
LPCSTR
)
b
);
}
}
static
void
PropertyStorage_PropNameDestroy
(
void
*
k
,
void
*
d
,
void
*
extra
)
...
...
@@ -940,8 +963,6 @@ static void PropertyStorage_ByteSwapString(LPWSTR str, size_t len)
* the entries according to the values of This->codePage and This->locale.
* FIXME: there isn't any checking whether the read property extends past the
* end of the buffer.
* FIXME: this always stores dictionary entries as Unicode, but it should store
* them as ANSI if This->codePage is not CP_UNICODE.
*/
static
HRESULT
PropertyStorage_ReadDictionary
(
PropertyStorage_impl
*
This
,
BYTE
*
ptr
)
...
...
@@ -960,7 +981,7 @@ static HRESULT PropertyStorage_ReadDictionary(PropertyStorage_impl *This,
{
PROPID
propid
;
DWORD
cbEntry
;
LP
W
STR
name
=
NULL
;
LPSTR
name
=
NULL
;
StorageUtl_ReadDWord
(
ptr
,
0
,
&
propid
);
ptr
+=
sizeof
(
PROPID
);
...
...
@@ -971,7 +992,7 @@ static HRESULT PropertyStorage_ReadDictionary(PropertyStorage_impl *This,
{
/* Make sure the source string is NULL-terminated */
ptr
[
cbEntry
-
1
]
=
'\0'
;
hr
=
PropertyStorage_StringCopy
(
ptr
,
(
LPSTR
*
)
&
name
,
CP_UNICODE
,
hr
=
PropertyStorage_StringCopy
(
ptr
,
&
name
,
This
->
codePage
,
This
->
codePage
);
}
else
...
...
@@ -979,7 +1000,7 @@ static HRESULT PropertyStorage_ReadDictionary(PropertyStorage_impl *This,
/* Make sure the source string is NULL-terminated */
*
((
LPWSTR
)
ptr
+
cbEntry
/
sizeof
(
WCHAR
))
=
'\0'
;
PropertyStorage_ByteSwapString
(
ptr
,
cbEntry
/
sizeof
(
WCHAR
));
hr
=
PropertyStorage_StringCopy
(
ptr
,
(
LPSTR
*
)
&
name
,
CP_UNICODE
,
hr
=
PropertyStorage_StringCopy
(
ptr
,
&
name
,
This
->
codePage
,
This
->
codePage
);
/* Unicode entries are padded to DWORD boundaries */
if
(
cbEntry
%
sizeof
(
DWORD
))
...
...
@@ -989,7 +1010,9 @@ static HRESULT PropertyStorage_ReadDictionary(PropertyStorage_impl *This,
{
dictionary_insert
(
This
->
name_to_propid
,
name
,
(
void
*
)
propid
);
dictionary_insert
(
This
->
propid_to_name
,
(
void
*
)
propid
,
name
);
TRACE
(
"Property %s maps to id %ld
\n
"
,
debugstr_w
(
name
),
propid
);
TRACE
(
"Property %s maps to id %ld
\n
"
,
This
->
codePage
==
CP_UNICODE
?
debugstr_w
((
LPCWSTR
)
name
)
:
debugstr_a
(
name
),
propid
);
}
ptr
+=
sizeof
(
DWORD
)
+
cbEntry
;
}
...
...
@@ -1465,34 +1488,17 @@ static BOOL PropertyStorage_DictionaryWriter(const void *key,
}
else
{
int
len
=
WideCharToMultiByte
(
This
->
codePage
,
0
,
(
LPWSTR
)
key
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
LPBYTE
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
DWORD
dwLen
;
DWORD
keyLen
;
if
(
!
buf
)
{
c
->
hr
=
STG_E_INSUFFICIENTMEMORY
;
goto
end
;
}
WideCharToMultiByte
(
This
->
codePage
,
0
,
(
LPWSTR
)
key
,
-
1
,
buf
,
len
,
NULL
,
NULL
);
StorageUtl_WriteDWord
((
LPBYTE
)
&
dwLen
,
0
,
len
);
c
->
hr
=
IStream_Write
(
This
->
stm
,
&
dwLen
,
sizeof
(
dwLen
),
&
count
);
StorageUtl_WriteDWord
((
LPBYTE
)
&
keyLen
,
0
,
strlen
((
LPCSTR
)
key
)
+
1
);
c
->
hr
=
IStream_Write
(
This
->
stm
,
&
keyLen
,
sizeof
(
keyLen
),
&
count
);
if
(
FAILED
(
c
->
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
goto
end
;
}
c
->
bytesWritten
+=
sizeof
(
DWORD
);
c
->
hr
=
IStream_Write
(
This
->
stm
,
buf
,
l
en
,
&
count
);
c
->
hr
=
IStream_Write
(
This
->
stm
,
key
,
keyL
en
,
&
count
);
if
(
FAILED
(
c
->
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
goto
end
;
}
c
->
bytesWritten
+=
len
;
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
c
->
bytesWritten
+=
keyLen
;
}
end:
return
SUCCEEDED
(
c
->
hr
);
...
...
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