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
b0b467ab
Commit
b0b467ab
authored
Mar 22, 2004
by
Mike McCormack
Committed by
Alexandre Julliard
Mar 22, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update path from relative path on loading.
parent
0ba5ade8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
36 deletions
+12
-36
shelllink.c
dlls/shell32/shelllink.c
+12
-36
No files found.
dlls/shell32/shelllink.c
View file @
b0b467ab
...
@@ -155,6 +155,7 @@ typedef struct
...
@@ -155,6 +155,7 @@ typedef struct
#define _ICOM_THIS_From_IPersistStream(class, name) class* This = (class*)(((char*)name)-_IPersistStream_Offset)
#define _ICOM_THIS_From_IPersistStream(class, name) class* This = (class*)(((char*)name)-_IPersistStream_Offset)
#define _IPersistStream_From_ICOM_THIS(class, name) class* StreamThis = (class*)(((char*)name)+_IPersistStream_Offset)
#define _IPersistStream_From_ICOM_THIS(class, name) class* StreamThis = (class*)(((char*)name)+_IPersistStream_Offset)
static
HRESULT
ShellLink_UpdatePath
(
LPWSTR
sPathRel
,
LPCWSTR
path
,
LPCWSTR
sWorkDir
,
LPWSTR
*
psPath
);
/* strdup on the process heap */
/* strdup on the process heap */
inline
static
LPWSTR
HEAP_strdupAtoW
(
HANDLE
heap
,
DWORD
flags
,
LPCSTR
str
)
inline
static
LPWSTR
HEAP_strdupAtoW
(
HANDLE
heap
,
DWORD
flags
,
LPCSTR
str
)
...
@@ -231,6 +232,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFile
...
@@ -231,6 +232,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFile
if
(
SUCCEEDED
(
r
)
)
if
(
SUCCEEDED
(
r
)
)
{
{
r
=
IPersistStream_Load
(
StreamThis
,
stm
);
r
=
IPersistStream_Load
(
StreamThis
,
stm
);
ShellLink_UpdatePath
(
This
->
sPathRel
,
pszFileName
,
This
->
sWorkDir
,
&
This
->
sPath
);
IStream_Release
(
stm
);
IStream_Release
(
stm
);
}
}
...
@@ -815,32 +817,24 @@ static BOOL SHELL_ExistsFileW(LPCWSTR path)
...
@@ -815,32 +817,24 @@ static BOOL SHELL_ExistsFileW(LPCWSTR path)
}
}
/**************************************************************************
/**************************************************************************
* S
HELL_S
hellLink_UpdatePath
* ShellLink_UpdatePath
* update absolute path in sPath using relative path in sPathRel
* update absolute path in sPath using relative path in sPathRel
*/
*/
static
HRESULT
S
HELL_S
hellLink_UpdatePath
(
LPWSTR
sPathRel
,
LPCWSTR
path
,
LPCWSTR
sWorkDir
,
LPWSTR
*
psPath
)
static
HRESULT
ShellLink_UpdatePath
(
LPWSTR
sPathRel
,
LPCWSTR
path
,
LPCWSTR
sWorkDir
,
LPWSTR
*
psPath
)
{
{
if
(
!
path
||
!
psPath
)
if
(
!
path
||
!
psPath
)
return
E_INVALIDARG
;
return
E_INVALIDARG
;
if
(
!*
psPath
&&
sPathRel
)
{
if
(
!*
psPath
&&
sPathRel
)
{
WCHAR
buffer
[
2
*
MAX_PATH
],
abs_path
[
2
*
MAX_PATH
];
WCHAR
buffer
[
2
*
MAX_PATH
],
abs_path
[
2
*
MAX_PATH
];
LPWSTR
final
=
NULL
;
/* first try if [directory of link file] + [relative path] finds an existing file */
/* first try if [directory of link file] + [relative path] finds an existing file */
LPCWSTR
src
=
path
;
LPWSTR
last_slash
=
NULL
;
LPWSTR
dest
=
buffer
;
LPWSTR
final
;
/* copy path without file name to buffer */
GetFullPathNameW
(
path
,
MAX_PATH
*
2
,
buffer
,
&
final
);
while
(
*
src
)
{
if
(
!
final
)
if
(
*
src
==
'/'
||
*
src
==
'\\'
)
final
=
buffer
;
last_slash
=
dest
;
lstrcpyW
(
final
,
sPathRel
);
*
dest
++
=
*
src
++
;
}
lstrcpyW
(
last_slash
?
last_slash
+
1
:
buffer
,
sPathRel
);
*
abs_path
=
'\0'
;
*
abs_path
=
'\0'
;
...
@@ -897,28 +891,10 @@ HRESULT WINAPI IShellLink_ConstructFromFile (
...
@@ -897,28 +891,10 @@ HRESULT WINAPI IShellLink_ConstructFromFile (
if
(
SUCCEEDED
(
hr
))
{
if
(
SUCCEEDED
(
hr
))
{
WCHAR
path
[
MAX_PATH
];
WCHAR
path
[
MAX_PATH
];
if
(
SHGetPathFromIDListW
(
pidl
,
path
))
{
if
(
SHGetPathFromIDListW
(
pidl
,
path
))
hr
=
IPersistFile_Load
(
ppf
,
path
,
0
);
hr
=
IPersistFile_Load
(
ppf
,
path
,
0
);
else
if
(
SUCCEEDED
(
hr
))
{
hr
=
E_FAIL
;
*
ppv
=
(
IUnknown
*
)
psl
;
/*
The following code is here, not in IPersistStream_fnLoad() because
to be able to convert the relative path into the absolute path,
we need to know the path of the shell link file.
*/
if
(
IsEqualIID
(
riid
,
&
IID_IShellLinkW
))
{
_ICOM_THIS_From_IShellLinkW
(
IShellLinkImpl
,
psl
);
hr
=
SHELL_ShellLink_UpdatePath
(
This
->
sPathRel
,
path
,
This
->
sWorkDir
,
&
This
->
sPath
);
}
else
{
ICOM_THIS
(
IShellLinkImpl
,
psl
);
hr
=
SHELL_ShellLink_UpdatePath
(
This
->
sPathRel
,
path
,
This
->
sWorkDir
,
&
This
->
sPath
);
}
}
}
IPersistFile_Release
(
ppf
);
IPersistFile_Release
(
ppf
);
}
}
...
...
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