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
fcde02f9
Commit
fcde02f9
authored
Apr 16, 2009
by
Vincent Povirk
Committed by
Alexandre Julliard
Apr 20, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Implement SHGetNewLinkInfo[AW].
parent
ed20ac87
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
108 additions
and
5 deletions
+108
-5
shellord.c
dlls/shell32/shellord.c
+56
-5
shlfileop.c
dlls/shell32/tests/shlfileop.c
+52
-0
No files found.
dlls/shell32/shellord.c
View file @
fcde02f9
...
...
@@ -1914,19 +1914,70 @@ BOOL WINAPI SHObjectProperties(HWND hwnd, DWORD dwType, LPCWSTR szObject, LPCWST
BOOL
WINAPI
SHGetNewLinkInfoA
(
LPCSTR
pszLinkTo
,
LPCSTR
pszDir
,
LPSTR
pszName
,
BOOL
*
pfMustCopy
,
UINT
uFlags
)
{
FIXME
(
"%s, %s, %p, %p, 0x%08x - stub
\n
"
,
debugstr_a
(
pszLinkTo
),
debugstr_a
(
pszDir
),
pszName
,
pfMustCopy
,
uFlags
);
WCHAR
wszLinkTo
[
MAX_PATH
];
WCHAR
wszDir
[
MAX_PATH
];
WCHAR
wszName
[
MAX_PATH
];
BOOL
res
;
return
FALSE
;
MultiByteToWideChar
(
CP_ACP
,
0
,
pszLinkTo
,
-
1
,
wszLinkTo
,
MAX_PATH
);
MultiByteToWideChar
(
CP_ACP
,
0
,
pszDir
,
-
1
,
wszDir
,
MAX_PATH
);
res
=
SHGetNewLinkInfoW
(
wszLinkTo
,
wszDir
,
wszName
,
pfMustCopy
,
uFlags
);
if
(
res
)
WideCharToMultiByte
(
CP_ACP
,
0
,
wszName
,
-
1
,
pszName
,
MAX_PATH
,
NULL
,
NULL
);
return
res
;
}
BOOL
WINAPI
SHGetNewLinkInfoW
(
LPCWSTR
pszLinkTo
,
LPCWSTR
pszDir
,
LPWSTR
pszName
,
BOOL
*
pfMustCopy
,
UINT
uFlags
)
{
FIXME
(
"%s, %s, %p, %p, 0x%08x - stub
\n
"
,
debugstr_w
(
pszLinkTo
),
debugstr_w
(
pszDir
),
const
WCHAR
*
basename
;
WCHAR
*
dst_basename
;
int
i
=
2
;
static
const
WCHAR
lnkformat
[]
=
{
'%'
,
's'
,
'.'
,
'l'
,
'n'
,
'k'
,
0
};
static
const
WCHAR
lnkformatnum
[]
=
{
'%'
,
's'
,
' '
,
'('
,
'%'
,
'd'
,
')'
,
'.'
,
'l'
,
'n'
,
'k'
,
0
};
TRACE
(
"(%s, %s, %p, %p, 0x%08x)
\n
"
,
debugstr_w
(
pszLinkTo
),
debugstr_w
(
pszDir
),
pszName
,
pfMustCopy
,
uFlags
);
return
FALSE
;
*
pfMustCopy
=
FALSE
;
if
(
uFlags
&
SHGNLI_PIDL
)
{
FIXME
(
"SHGNLI_PIDL flag unsupported
\n
"
);
return
FALSE
;
}
if
(
uFlags
)
FIXME
(
"ignoring flags: 0x%08x
\n
"
,
uFlags
);
/* FIXME: should test if the file is a shortcut or DOS program */
if
(
GetFileAttributesW
(
pszLinkTo
)
==
INVALID_FILE_ATTRIBUTES
)
return
FALSE
;
basename
=
strrchrW
(
pszLinkTo
,
'\\'
);
if
(
basename
)
basename
=
basename
+
1
;
else
basename
=
pszLinkTo
;
lstrcpynW
(
pszName
,
pszDir
,
MAX_PATH
);
if
(
!
PathAddBackslashW
(
pszName
))
return
FALSE
;
dst_basename
=
pszName
+
strlenW
(
pszName
);
snprintfW
(
dst_basename
,
pszName
+
MAX_PATH
-
dst_basename
,
lnkformat
,
basename
);
while
(
GetFileAttributesW
(
pszName
)
!=
INVALID_FILE_ATTRIBUTES
)
{
snprintfW
(
dst_basename
,
pszName
+
MAX_PATH
-
dst_basename
,
lnkformatnum
,
basename
,
i
);
i
++
;
}
return
TRUE
;
}
HRESULT
WINAPI
SHStartNetConnectionDialog
(
HWND
hwnd
,
LPCSTR
pszRemoteName
,
DWORD
dwType
)
...
...
dlls/shell32/tests/shlfileop.c
View file @
fcde02f9
...
...
@@ -2051,6 +2051,54 @@ static void test_sh_path_prepare(void)
RemoveDirectoryW
(
UNICODE_PATH
);
}
static
void
test_sh_new_link_info
(
void
)
{
BOOL
ret
,
mustcopy
=
TRUE
;
CHAR
linkto
[
MAX_PATH
];
CHAR
destdir
[
MAX_PATH
];
CHAR
result
[
MAX_PATH
];
CHAR
result2
[
MAX_PATH
];
/* source file does not exist */
set_curr_dir_path
(
linkto
,
"nosuchfile.txt
\0
"
);
set_curr_dir_path
(
destdir
,
"testdir2
\0
"
);
ret
=
SHGetNewLinkInfoA
(
linkto
,
destdir
,
result
,
&
mustcopy
,
0
);
ok
(
ret
==
FALSE
,
"SHGetNewLinkInfoA succeeded
\n
"
);
ok
(
mustcopy
==
FALSE
,
"mustcopy should be FALSE
\n
"
);
/* dest dir does not exist */
set_curr_dir_path
(
linkto
,
"test1.txt
\0
"
);
set_curr_dir_path
(
destdir
,
"nosuchdir
\0
"
);
ret
=
SHGetNewLinkInfoA
(
linkto
,
destdir
,
result
,
&
mustcopy
,
0
);
ok
(
ret
==
TRUE
,
"SHGetNewLinkInfoA failed, err=%i
\n
"
,
GetLastError
());
ok
(
mustcopy
==
FALSE
,
"mustcopy should be FALSE
\n
"
);
/* source file exists */
set_curr_dir_path
(
linkto
,
"test1.txt
\0
"
);
set_curr_dir_path
(
destdir
,
"testdir2
\0
"
);
ret
=
SHGetNewLinkInfoA
(
linkto
,
destdir
,
result
,
&
mustcopy
,
0
);
ok
(
ret
==
TRUE
,
"SHGetNewLinkInfoA failed, err=%i
\n
"
,
GetLastError
());
ok
(
mustcopy
==
FALSE
,
"mustcopy should be FALSE
\n
"
);
ok
(
CompareStringA
(
LOCALE_SYSTEM_DEFAULT
,
NORM_IGNORECASE
,
destdir
,
lstrlenA
(
destdir
),
result
,
lstrlenA
(
destdir
))
==
CSTR_EQUAL
,
"%s does not start with %s
\n
"
,
result
,
destdir
);
ok
(
lstrlenA
(
result
)
>
4
&&
lstrcmpiA
(
result
+
lstrlenA
(
result
)
-
4
,
".lnk"
)
==
0
,
"%s does not end with .lnk
\n
"
,
result
);
/* preferred target name already exists */
createTestFile
(
result
);
ret
=
SHGetNewLinkInfoA
(
linkto
,
destdir
,
result2
,
&
mustcopy
,
0
);
ok
(
ret
==
TRUE
,
"SHGetNewLinkInfoA failed, err=%i
\n
"
,
GetLastError
());
ok
(
mustcopy
==
FALSE
,
"mustcopy should be FALSE
\n
"
);
ok
(
CompareStringA
(
LOCALE_SYSTEM_DEFAULT
,
NORM_IGNORECASE
,
destdir
,
lstrlenA
(
destdir
),
result2
,
lstrlenA
(
destdir
))
==
CSTR_EQUAL
,
"%s does not start with %s
\n
"
,
result2
,
destdir
);
ok
(
lstrlenA
(
result2
)
>
4
&&
lstrcmpiA
(
result2
+
lstrlenA
(
result2
)
-
4
,
".lnk"
)
==
0
,
"%s does not end with .lnk
\n
"
,
result2
);
ok
(
lstrcmpiA
(
result
,
result2
)
!=
0
,
"%s and %s are the same
\n
"
,
result
,
result2
);
DeleteFileA
(
result
);
}
static
void
test_unicode
(
void
)
{
SHFILEOPSTRUCTW
shfoW
;
...
...
@@ -2158,5 +2206,9 @@ START_TEST(shlfileop)
test_sh_path_prepare
();
clean_after_shfo_tests
();
init_shfo_tests
();
test_sh_new_link_info
();
clean_after_shfo_tests
();
test_unicode
();
}
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