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
f49a3016
Commit
f49a3016
authored
Sep 01, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Fix sharing modes when loading/saving link files.
parent
e4e26bbc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
6 deletions
+48
-6
shelllink.c
dlls/shell32/shelllink.c
+2
-3
shelllink.c
dlls/shell32/tests/shelllink.c
+46
-3
No files found.
dlls/shell32/shelllink.c
View file @
f49a3016
...
@@ -277,8 +277,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFile
...
@@ -277,8 +277,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFile
TRACE
(
"(%p, %s, %lx)
\n
"
,
This
,
debugstr_w
(
pszFileName
),
dwMode
);
TRACE
(
"(%p, %s, %lx)
\n
"
,
This
,
debugstr_w
(
pszFileName
),
dwMode
);
if
(
dwMode
==
0
)
if
(
dwMode
==
0
)
dwMode
=
STGM_READ
;
dwMode
=
STGM_READ
|
STGM_SHARE_DENY_WRITE
;
r
=
SHCreateStreamOnFileW
(
pszFileName
,
dwMode
,
&
stm
);
r
=
SHCreateStreamOnFileW
(
pszFileName
,
dwMode
,
&
stm
);
if
(
SUCCEEDED
(
r
)
)
if
(
SUCCEEDED
(
r
)
)
{
{
...
@@ -371,7 +370,7 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFile
...
@@ -371,7 +370,7 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFile
fRemember
=
FALSE
;
fRemember
=
FALSE
;
}
}
r
=
SHCreateStreamOnFileW
(
pszFileName
,
STGM_READWRITE
|
STGM_CREATE
|
STGM_SHARE_
EXCLUSIV
E
,
&
stm
);
r
=
SHCreateStreamOnFileW
(
pszFileName
,
STGM_READWRITE
|
STGM_CREATE
|
STGM_SHARE_
DENY_WRIT
E
,
&
stm
);
if
(
SUCCEEDED
(
r
)
)
if
(
SUCCEEDED
(
r
)
)
{
{
r
=
IPersistStream_Save
(
StreamThis
,
stm
,
FALSE
);
r
=
IPersistStream_Save
(
StreamThis
,
stm
,
FALSE
);
...
...
dlls/shell32/tests/shelllink.c
View file @
f49a3016
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include "shlguid.h"
#include "shlguid.h"
#include "shobjidl.h"
#include "shobjidl.h"
#include "shlobj.h"
#include "shlobj.h"
#include "shlwapi.h"
#include "shellapi.h"
#include "shellapi.h"
#include "commoncontrols.h"
#include "commoncontrols.h"
...
@@ -619,6 +620,9 @@ static void test_load_save(void)
...
@@ -619,6 +620,9 @@ static void test_load_save(void)
char
mypath
[
MAX_PATH
];
char
mypath
[
MAX_PATH
];
char
mydir
[
MAX_PATH
];
char
mydir
[
MAX_PATH
];
char
realpath
[
MAX_PATH
];
char
realpath
[
MAX_PATH
];
IPersistFile
*
pf
;
IShellLinkA
*
sl
;
IStream
*
stm
;
char
*
p
;
char
*
p
;
HANDLE
hf
;
HANDLE
hf
;
DWORD
r
;
DWORD
r
;
...
@@ -809,13 +813,52 @@ static void test_load_save(void)
...
@@ -809,13 +813,52 @@ static void test_load_save(void)
r
=
DeleteFileA
(
realpath
);
r
=
DeleteFileA
(
realpath
);
ok
(
r
,
"failed to delete file %s (%ld)
\n
"
,
realpath
,
GetLastError
());
ok
(
r
,
"failed to delete file %s (%ld)
\n
"
,
realpath
,
GetLastError
());
/* test sharing modes */
r
=
CoCreateInstance
(
&
CLSID_ShellLink
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IShellLinkA
,
(
LPVOID
*
)
&
sl
);
ok
(
r
==
S_OK
,
"no IID_IShellLinkA (0x%08lx)
\n
"
,
r
);
r
=
IShellLinkA_QueryInterface
(
sl
,
&
IID_IPersistFile
,
(
void
**
)
&
pf
);
ok
(
r
==
S_OK
,
"no IID_IPersistFile (0x%08lx)
\n
"
,
r
);
r
=
SHCreateStreamOnFileW
(
lnkfile
,
STGM_READ
,
&
stm
);
ok
(
!
r
,
"SHCreateStreamOnFileW failed %lx
\n
"
,
r
);
r
=
IPersistFile_Save
(
pf
,
lnkfile
,
FALSE
);
ok
(
r
==
S_OK
,
"IPersistFile_Save failed (0x%08lx)
\n
"
,
r
);
r
=
IPersistFile_Load
(
pf
,
lnkfile
,
0
);
ok
(
r
==
S_OK
,
"IPersistFile_Load failed (0x%08lx)
\n
"
,
r
);
IStream_Release
(
stm
);
r
=
SHCreateStreamOnFileW
(
lnkfile
,
STGM_READ
|
STGM_SHARE_DENY_WRITE
,
&
stm
);
ok
(
r
==
S_OK
,
"SHCreateStreamOnFileW failed %lx
\n
"
,
r
);
r
=
IPersistFile_Save
(
pf
,
lnkfile
,
FALSE
);
ok
(
r
==
HRESULT_FROM_WIN32
(
ERROR_SHARING_VIOLATION
),
"IPersistFile_Save failed (0x%08lx)
\n
"
,
r
);
r
=
IPersistFile_Load
(
pf
,
lnkfile
,
0
);
ok
(
r
==
S_OK
,
"IPersistFile_Load failed (0x%08lx)
\n
"
,
r
);
IStream_Release
(
stm
);
r
=
SHCreateStreamOnFileW
(
lnkfile
,
STGM_READWRITE
|
STGM_SHARE_DENY_WRITE
,
&
stm
);
ok
(
r
==
S_OK
,
"SHCreateStreamOnFileW failed %lx
\n
"
,
r
);
r
=
IPersistFile_Save
(
pf
,
lnkfile
,
FALSE
);
ok
(
r
==
HRESULT_FROM_WIN32
(
ERROR_SHARING_VIOLATION
),
"IPersistFile_Save failed (0x%08lx)
\n
"
,
r
);
r
=
IPersistFile_Load
(
pf
,
lnkfile
,
0
);
ok
(
r
==
S_OK
,
"IPersistFile_Load failed (0x%08lx)
\n
"
,
r
);
IStream_Release
(
stm
);
r
=
SHCreateStreamOnFileW
(
lnkfile
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
&
stm
);
ok
(
r
==
S_OK
,
"SHCreateStreamOnFileW failed %lx
\n
"
,
r
);
r
=
IPersistFile_Save
(
pf
,
lnkfile
,
FALSE
);
ok
(
r
==
HRESULT_FROM_WIN32
(
ERROR_SHARING_VIOLATION
),
"IPersistFile_Save failed (0x%08lx)
\n
"
,
r
);
r
=
IPersistFile_Load
(
pf
,
lnkfile
,
0
);
ok
(
r
==
HRESULT_FROM_WIN32
(
ERROR_SHARING_VIOLATION
),
"IPersistFile_Load failed (0x%08lx)
\n
"
,
r
);
IStream_Release
(
stm
);
IShellLinkA_Release
(
sl
);
IPersistFile_Release
(
pf
);
/* FIXME: Also test saving a .lnk pointing to a pidl that cannot be
/* FIXME: Also test saving a .lnk pointing to a pidl that cannot be
* represented as a path.
* represented as a path.
*/
*/
/* DeleteFileW is not implemented on Win9x */
DeleteFileW
(
lnkfile
);
r
=
DeleteFileA
(
lnkfileA
);
ok
(
r
,
"failed to delete link '%s' (%ld)
\n
"
,
lnkfileA
,
GetLastError
());
}
}
static
void
test_datalink
(
void
)
static
void
test_datalink
(
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