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
a0bb9382
Commit
a0bb9382
authored
Sep 13, 2021
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Use access mask from bind context in file moniker's BindToStorage().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
01fdc50f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
26 deletions
+75
-26
filemoniker.c
dlls/ole32/filemoniker.c
+21
-25
moniker.c
dlls/ole32/tests/moniker.c
+54
-1
No files found.
dlls/ole32/filemoniker.c
View file @
a0bb9382
...
...
@@ -583,41 +583,37 @@ FileMonikerImpl_BindToObject(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft
*/
static
HRESULT
WINAPI
FileMonikerImpl_BindToStorage
(
IMoniker
*
iface
,
IBindCtx
*
pbc
,
IMoniker
*
pmkToLeft
,
REFIID
riid
,
VOID
**
ppvO
bject
)
REFIID
riid
,
void
**
o
bject
)
{
LPOLESTR
filePath
=
0
;
IStorage
*
pstg
=
0
;
HRESULT
res
;
TRACE
(
"(%p,%p,%p,%s,%p)
\n
"
,
iface
,
pbc
,
pmkToLeft
,
debugstr_guid
(
riid
),
ppvObject
);
if
(
pmkToLeft
==
NULL
){
FileMonikerImpl
*
moniker
=
impl_from_IMoniker
(
iface
);
BIND_OPTS
bind_opts
;
HRESULT
hr
;
if
(
IsEqualIID
(
&
IID_IStorage
,
riid
)){
TRACE
(
"(%p,%p,%p,%s,%p)
\n
"
,
iface
,
pbc
,
pmkToLeft
,
debugstr_guid
(
riid
),
object
);
/* get the file name */
IMoniker_GetDisplayName
(
iface
,
pbc
,
pmkToLeft
,
&
filePath
);
res
=
StgOpenStorage
(
filePath
,
NULL
,
STGM_READWRITE
|
STGM_SHARE_DENY_WRITE
,
NULL
,
0
,
&
pstg
);
if
(
!
pbc
)
return
E_INVALIDARG
;
if
(
SUCCEEDED
(
res
))
*
ppvObject
=
pstg
;
bind_opts
.
cbStruct
=
sizeof
(
bind_opts
);
hr
=
IBindCtx_GetBindOptions
(
pbc
,
&
bind_opts
);
if
(
FAILED
(
hr
))
return
hr
;
CoTaskMemFree
(
filePath
);
if
(
!
pmkToLeft
)
{
if
(
IsEqualIID
(
&
IID_IStorage
,
riid
))
{
return
StgOpenStorage
(
moniker
->
filePathName
,
NULL
,
bind_opts
.
grfMode
,
NULL
,
0
,
(
IStorage
**
)
object
);
}
else
if
((
IsEqualIID
(
&
IID_IStream
,
riid
))
||
(
IsEqualIID
(
&
IID_ILockBytes
,
riid
)))
return
E_FAIL
;
else
if
(
(
IsEqualIID
(
&
IID_IStream
,
riid
))
||
(
IsEqualIID
(
&
IID_ILockBytes
,
riid
))
)
return
E_FAIL
;
else
return
E_NOINTERFACE
;
return
E_NOINTERFACE
;
}
else
{
FIXME
(
"(%p,%p,%p,%s,%p)
\n
"
,
iface
,
pbc
,
pmkToLeft
,
debugstr_guid
(
riid
),
ppvO
bject
);
FIXME
(
"(%p,%p,%p,%s,%p)
\n
"
,
iface
,
pbc
,
pmkToLeft
,
debugstr_guid
(
riid
),
o
bject
);
return
E_NOTIMPL
;
}
return
res
;
return
E_NOTIMPL
;
}
/******************************************************************************
...
...
dlls/ole32/tests/moniker.c
View file @
a0bb9382
...
...
@@ -1980,7 +1980,13 @@ static void test_file_monikers(void)
*/
{
0x20ac
,
0x2020
,
0x100
,
0x101
,
0x102
,
0x103
,
0x104
,
0x105
,
0x106
,
0x107
,
0x108
,
0x109
,
0x10a
,
0x10b
,
0x10c
,
0
},
};
WCHAR
filename
[
MAX_PATH
],
path
[
MAX_PATH
];
BIND_OPTS
bind_opts
;
IMoniker
*
moniker
;
IStorage
*
storage
;
IBindCtx
*
bindctx
;
STATSTG
statstg
;
HRESULT
hr
;
int
i
;
trace
(
"ACP is %u
\n
"
,
GetACP
());
...
...
@@ -2004,6 +2010,53 @@ static void test_file_monikers(void)
test_file_moniker
(
wszFile
[
i
]);
}
}
/* BindToStorage() */
GetTempPathW
(
MAX_PATH
,
path
);
GetTempFileNameW
(
path
,
L"stg"
,
1
,
filename
);
hr
=
StgCreateStorageEx
(
filename
,
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
STGFMT_STORAGE
,
0
,
NULL
,
NULL
,
&
IID_IStorage
,
(
void
**
)
&
storage
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
IStorage_Release
(
storage
);
hr
=
CreateFileMoniker
(
filename
,
&
moniker
);
ok
(
hr
==
S_OK
,
"Failed to create a moniker, hr %#x.
\n
"
,
hr
);
hr
=
IMoniker_BindToStorage
(
moniker
,
NULL
,
NULL
,
&
IID_IStorage
,
(
void
**
)
&
storage
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
CreateBindCtx
(
0
,
&
bindctx
);
ok
(
hr
==
S_OK
,
"Failed to create bind context, hr %#x.
\n
"
,
hr
);
hr
=
IMoniker_BindToStorage
(
moniker
,
bindctx
,
NULL
,
&
IID_IStorage
,
(
void
**
)
&
storage
);
ok
(
hr
==
STG_E_INVALIDFLAG
,
"Unexpected hr %#x.
\n
"
,
hr
);
bind_opts
.
cbStruct
=
sizeof
(
bind_opts
);
bind_opts
.
grfMode
=
STGM_READWRITE
|
STGM_SHARE_DENY_WRITE
;
hr
=
IBindCtx_SetBindOptions
(
bindctx
,
&
bind_opts
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMoniker_BindToStorage
(
moniker
,
bindctx
,
NULL
,
&
IID_IStorage
,
(
void
**
)
&
storage
);
ok
(
hr
==
STG_E_INVALIDFLAG
,
"Unexpected hr %#x.
\n
"
,
hr
);
bind_opts
.
grfMode
=
STGM_READ
|
STGM_SHARE_DENY_WRITE
;
hr
=
IBindCtx_SetBindOptions
(
bindctx
,
&
bind_opts
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMoniker_BindToStorage
(
moniker
,
bindctx
,
NULL
,
&
IID_IStorage
,
(
void
**
)
&
storage
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
memset
(
&
statstg
,
0
,
sizeof
(
statstg
));
hr
=
IStorage_Stat
(
storage
,
&
statstg
,
STATFLAG_NONAME
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
statstg
.
grfMode
==
(
STGM_READ
|
STGM_SHARE_DENY_WRITE
),
"Unexpected mode %#x.
\n
"
,
statstg
.
grfMode
);
IStorage_Release
(
storage
);
IBindCtx_Release
(
bindctx
);
IMoniker_Release
(
moniker
);
DeleteFileW
(
filename
);
}
static
void
test_item_moniker
(
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