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
53c1c8a8
Commit
53c1c8a8
authored
Dec 02, 2008
by
Vincent Povirk
Committed by
Alexandre Julliard
Dec 05, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Add test for localized filenames in desktop.ini.
parent
3e548402
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
148 additions
and
0 deletions
+148
-0
Makefile.in
dlls/shell32/tests/Makefile.in
+2
-0
rsrc.rc
dlls/shell32/tests/rsrc.rc
+28
-0
shlfolder.c
dlls/shell32/tests/shlfolder.c
+118
-0
No files found.
dlls/shell32/tests/Makefile.in
View file @
53c1c8a8
...
...
@@ -18,6 +18,8 @@ CTESTS = \
string.c
\
systray.c
RC_SRCS
=
rsrc.rc
@MAKE_TEST_RULES@
@DEPENDENCIES@
# everything below this line is overwritten by make depend
dlls/shell32/tests/rsrc.rc
0 → 100644
View file @
53c1c8a8
/* String resource for shlfolder test.
*
* Copyright 2008 Vincent Povirk for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "windef.h"
#include "winuser.h"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
STRINGTABLE
{
1 "Folder Name Resource"
}
dlls/shell32/tests/shlfolder.c
View file @
53c1c8a8
...
...
@@ -1488,6 +1488,123 @@ static void testSHGetFolderPathAndSubDirA(void)
RemoveDirectoryA
(
testpath
);
}
static
const
char
*
wine_dbgstr_w
(
LPCWSTR
str
)
{
static
char
buf
[
512
];
if
(
!
str
)
return
"(null)"
;
WideCharToMultiByte
(
CP_ACP
,
0
,
str
,
-
1
,
buf
,
sizeof
(
buf
),
NULL
,
NULL
);
return
buf
;
}
static
void
test_LocalizedNames
(
void
)
{
static
char
cCurrDirA
[
MAX_PATH
];
WCHAR
cCurrDirW
[
MAX_PATH
],
tempbufW
[
25
];
IShellFolder
*
IDesktopFolder
,
*
testIShellFolder
;
ITEMIDLIST
*
newPIDL
;
int
len
;
HRESULT
hr
;
static
char
resourcefile
[
MAX_PATH
];
DWORD
res
;
HANDLE
file
;
STRRET
strret
;
static
const
char
desktopini_contents1
[]
=
"[.ShellClassInfo]
\r\n
"
"LocalizedResourceName=@"
;
static
const
char
desktopini_contents2
[]
=
",-1
\r\n
"
;
static
WCHAR
foldernameW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
'f'
,
'o'
,
'l'
,
'd'
,
'e'
,
'r'
,
0
};
static
const
WCHAR
folderdisplayW
[]
=
{
'F'
,
'o'
,
'l'
,
'd'
,
'e'
,
'r'
,
' '
,
'N'
,
'a'
,
'm'
,
'e'
,
' '
,
'R'
,
'e'
,
's'
,
'o'
,
'u'
,
'r'
,
'c'
,
'e'
,
0
};
/* create folder with desktop.ini and localized name in GetModuleFileNameA(NULL) */
CreateDirectoryA
(
".
\\
testfolder"
,
NULL
);
SetFileAttributesA
(
".
\\
testfolder"
,
GetFileAttributesA
(
".
\\
testfolder"
)
|
FILE_ATTRIBUTE_SYSTEM
);
GetModuleFileNameA
(
NULL
,
resourcefile
,
MAX_PATH
);
file
=
CreateFileA
(
".
\\
testfolder
\\
desktop.ini"
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFileA failed %i
\n
"
,
GetLastError
());
ok
(
WriteFile
(
file
,
desktopini_contents1
,
strlen
(
desktopini_contents1
),
&
res
,
NULL
)
&&
WriteFile
(
file
,
resourcefile
,
strlen
(
resourcefile
),
&
res
,
NULL
)
&&
WriteFile
(
file
,
desktopini_contents2
,
strlen
(
desktopini_contents2
),
&
res
,
NULL
),
"WriteFile failed %i
\n
"
,
GetLastError
());
CloseHandle
(
file
);
/* get IShellFolder for parent */
GetCurrentDirectoryA
(
MAX_PATH
,
cCurrDirA
);
len
=
lstrlenA
(
cCurrDirA
);
if
(
len
==
0
)
{
trace
(
"GetCurrentDirectoryA returned empty string. Skipping test_LocalizedNames
\n
"
);
goto
cleanup
;
}
if
(
cCurrDirA
[
len
-
1
]
==
'\\'
)
cCurrDirA
[
len
-
1
]
=
0
;
MultiByteToWideChar
(
CP_ACP
,
0
,
cCurrDirA
,
-
1
,
cCurrDirW
,
MAX_PATH
);
hr
=
SHGetDesktopFolder
(
&
IDesktopFolder
);
ok
(
hr
==
S_OK
,
"SHGetDesktopfolder failed %08x
\n
"
,
hr
);
hr
=
IShellFolder_ParseDisplayName
(
IDesktopFolder
,
NULL
,
NULL
,
cCurrDirW
,
NULL
,
&
newPIDL
,
0
);
ok
(
hr
==
S_OK
,
"ParseDisplayName failed %08x
\n
"
,
hr
);
hr
=
IShellFolder_BindToObject
(
IDesktopFolder
,
newPIDL
,
NULL
,
(
REFIID
)
&
IID_IShellFolder
,
(
LPVOID
*
)
&
testIShellFolder
);
ok
(
hr
==
S_OK
,
"BindToObject failed %08x
\n
"
,
hr
);
IMalloc_Free
(
ppM
,
newPIDL
);
/* windows reads the display name from the resource */
hr
=
IShellFolder_ParseDisplayName
(
testIShellFolder
,
NULL
,
NULL
,
foldernameW
,
NULL
,
&
newPIDL
,
0
);
ok
(
hr
==
S_OK
,
"ParseDisplayName failed %08x
\n
"
,
hr
);
hr
=
IShellFolder_GetDisplayNameOf
(
testIShellFolder
,
newPIDL
,
SHGDN_INFOLDER
,
&
strret
);
ok
(
hr
==
S_OK
,
"ParseDisplayName failed %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
)
&&
pStrRetToBufW
)
{
hr
=
pStrRetToBufW
(
&
strret
,
newPIDL
,
tempbufW
,
sizeof
(
tempbufW
)
/
sizeof
(
WCHAR
));
ok
(
SUCCEEDED
(
hr
),
"StrRetToBufW failed! hr = %08x
\n
"
,
hr
);
todo_wine
ok
(
!
lstrcmpiW
(
tempbufW
,
folderdisplayW
),
"GetDisplayNameOf returned %s
\n
"
,
wine_dbgstr_w
(
tempbufW
));
}
/* editing name is also read from the resource */
hr
=
IShellFolder_GetDisplayNameOf
(
testIShellFolder
,
newPIDL
,
SHGDN_INFOLDER
|
SHGDN_FOREDITING
,
&
strret
);
ok
(
hr
==
S_OK
,
"ParseDisplayName failed %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
)
&&
pStrRetToBufW
)
{
hr
=
pStrRetToBufW
(
&
strret
,
newPIDL
,
tempbufW
,
sizeof
(
tempbufW
)
/
sizeof
(
WCHAR
));
ok
(
SUCCEEDED
(
hr
),
"StrRetToBufW failed! hr = %08x
\n
"
,
hr
);
todo_wine
ok
(
!
lstrcmpiW
(
tempbufW
,
folderdisplayW
),
"GetDisplayNameOf returned %s
\n
"
,
wine_dbgstr_w
(
tempbufW
));
}
/* parsing name is unchanged */
hr
=
IShellFolder_GetDisplayNameOf
(
testIShellFolder
,
newPIDL
,
SHGDN_INFOLDER
|
SHGDN_FORPARSING
,
&
strret
);
ok
(
hr
==
S_OK
,
"ParseDisplayName failed %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
)
&&
pStrRetToBufW
)
{
hr
=
pStrRetToBufW
(
&
strret
,
newPIDL
,
tempbufW
,
sizeof
(
tempbufW
)
/
sizeof
(
WCHAR
));
ok
(
SUCCEEDED
(
hr
),
"StrRetToBufW failed! hr = %08x
\n
"
,
hr
);
ok
(
!
lstrcmpiW
(
tempbufW
,
foldernameW
),
"GetDisplayNameOf returned %s
\n
"
,
wine_dbgstr_w
(
tempbufW
));
}
IShellFolder_Release
(
IDesktopFolder
);
IShellFolder_Release
(
testIShellFolder
);
IMalloc_Free
(
ppM
,
newPIDL
);
cleanup:
DeleteFileA
(
".
\\
testfolder
\\
desktop.ini"
);
SetFileAttributesA
(
".
\\
testfolder"
,
GetFileAttributesA
(
".
\\
testfolder"
)
&~
FILE_ATTRIBUTE_SYSTEM
);
RemoveDirectoryA
(
".
\\
testfolder"
);
}
START_TEST
(
shlfolder
)
{
...
...
@@ -1509,6 +1626,7 @@ START_TEST(shlfolder)
testSHGetFolderPathAndSubDirA
();
else
skip
(
"SHGetFolderPathAndSubDirA not present
\n
"
);
test_LocalizedNames
();
OleUninitialize
();
}
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