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
8dabf51d
Commit
8dabf51d
authored
Apr 11, 2005
by
Huw Davies
Committed by
Alexandre Julliard
Apr 11, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Directory items should have the SFGOA_FILESYSANCESTOR attribute.
Add a test for this and cleanup the shlfolder test a bit.
parent
81bda71e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
41 deletions
+69
-41
shlfolder.c
dlls/shell32/shlfolder.c
+3
-1
shlfolder.c
dlls/shell32/tests/shlfolder.c
+66
-40
No files found.
dlls/shell32/shlfolder.c
View file @
8dabf51d
...
...
@@ -396,7 +396,9 @@ HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWO
}
}
else
if
(
_ILGetDataPointer
(
pidl
))
{
dwAttributes
=
_ILGetFileAttributes
(
pidl
,
NULL
,
0
);
*
pdwAttributes
&=
~
SFGAO_FILESYSANCESTOR
;
if
((
SFGAO_FILESYSANCESTOR
&
*
pdwAttributes
)
&&
!
(
dwAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
*
pdwAttributes
&=
~
SFGAO_FILESYSANCESTOR
;
if
((
SFGAO_FOLDER
&
*
pdwAttributes
)
&&
!
(
dwAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
*
pdwAttributes
&=
~
(
SFGAO_FOLDER
|
SFGAO_HASSUBFOLDER
);
...
...
dlls/shell32/tests/shlfolder.c
View file @
8dabf51d
...
...
@@ -65,6 +65,7 @@ void CreateFilesFolders(void)
CreateTestFile
(
".
\\
testdir
\\
test2.txt "
);
CreateTestFile
(
".
\\
testdir
\\
test3.txt "
);
CreateDirectoryA
(
".
\\
testdir
\\
testdir2 "
,
NULL
);
CreateDirectoryA
(
".
\\
testdir
\\
testdir2
\\
subdir"
,
NULL
);
}
/* cleans after tests */
...
...
@@ -74,6 +75,7 @@ void Cleanup(void)
DeleteFileA
(
".
\\
testdir
\\
test2.txt"
);
DeleteFileA
(
".
\\
testdir
\\
test3.txt"
);
RemoveDirectoryA
(
".
\\
testdir
\\
test.txt"
);
RemoveDirectoryA
(
".
\\
testdir
\\
testdir2
\\
subdir"
);
RemoveDirectoryA
(
".
\\
testdir
\\
testdir2"
);
RemoveDirectoryA
(
".
\\
testdir"
);
}
...
...
@@ -86,7 +88,7 @@ void test_EnumObjects(IShellFolder *iFolder)
ITEMIDLIST
*
newPIDL
,
*
(
idlArr
[
5
]);
ULONG
NumPIDLs
;
int
i
=
0
,
j
;
HRESULT
nResult
;
HRESULT
hr
;
static
const
WORD
iResults
[
5
][
5
]
=
{
...
...
@@ -97,67 +99,91 @@ void test_EnumObjects(IShellFolder *iFolder)
{
1
,
1
,
1
,
1
,
0
}
};
if
SUCCEEDED
(
IShellFolder_EnumObjects
(
iFolder
,
NULL
,
SHCONTF_FOLDERS
|
SHCONTF_NONFOLDERS
|
SHCONTF_INCLUDEHIDDEN
,
&
iEnumList
))
/* Just test SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR for now */
static
const
ULONG
attrs
[
5
]
=
{
while
(
IEnumIDList_Next
(
iEnumList
,
1
,
&
newPIDL
,
&
NumPIDLs
)
==
S_OK
)
{
idlArr
[
i
++
]
=
newPIDL
;
}
/* This fails on windows */
/* IEnumIDList_Release(iEnumList); */
SFGAO_FILESYSTEM
|
SFGAO_FOLDER
|
SFGAO_FILESYSANCESTOR
,
SFGAO_FILESYSTEM
|
SFGAO_FOLDER
|
SFGAO_FILESYSANCESTOR
,
SFGAO_FILESYSTEM
,
SFGAO_FILESYSTEM
,
SFGAO_FILESYSTEM
,
};
hr
=
IShellFolder_EnumObjects
(
iFolder
,
NULL
,
SHCONTF_FOLDERS
|
SHCONTF_NONFOLDERS
|
SHCONTF_INCLUDEHIDDEN
,
&
iEnumList
);
ok
(
hr
==
S_OK
,
"EnumObjects failed %08lx
\n
"
,
hr
);
while
(
IEnumIDList_Next
(
iEnumList
,
1
,
&
newPIDL
,
&
NumPIDLs
)
==
S_OK
)
{
idlArr
[
i
++
]
=
newPIDL
;
}
hr
=
IEnumIDList_Release
(
iEnumList
);
ok
(
hr
==
S_OK
,
"IEnumIDList_Release failed %08lx
\n
"
,
hr
);
/* Sort them first in case of wrong order from system */
for
(
i
=
0
;
i
<
5
;
i
++
)
for
(
j
=
0
;
j
<
5
;
j
++
)
if
((
SHORT
)
IShellFolder_CompareIDs
(
iFolder
,
0
,
idlArr
[
i
],
idlArr
[
j
])
<
0
)
{
newPIDL
=
idlArr
[
i
];
idlArr
[
i
]
=
idlArr
[
j
];
idlArr
[
j
]
=
newPIDL
;
}
for
(
i
=
0
;
i
<
5
;
i
++
)
for
(
j
=
0
;
j
<
5
;
j
++
)
/* Sort them first in case of wrong order from system */
for
(
i
=
0
;
i
<
5
;
i
++
)
for
(
j
=
0
;
j
<
5
;
j
++
)
if
((
SHORT
)
IShellFolder_CompareIDs
(
iFolder
,
0
,
idlArr
[
i
],
idlArr
[
j
])
<
0
)
{
nResult
=
IShellFolder_CompareIDs
(
iFolder
,
0
,
idlArr
[
i
],
idlArr
[
j
]);
ok
(
nResult
==
iResults
[
i
][
j
],
"Got %lx expected [%d]-[%d]=%x
\n
"
,
nResult
,
i
,
j
,
iResults
[
i
][
j
]);
}
newPIDL
=
idlArr
[
i
];
idlArr
[
i
]
=
idlArr
[
j
];
idlArr
[
j
]
=
newPIDL
;
}
for
(
i
=
0
;
i
<
5
;
i
++
)
for
(
j
=
0
;
j
<
5
;
j
++
)
{
hr
=
IShellFolder_CompareIDs
(
iFolder
,
0
,
idlArr
[
i
],
idlArr
[
j
]);
ok
(
hr
==
iResults
[
i
][
j
],
"Got %lx expected [%d]-[%d]=%x
\n
"
,
hr
,
i
,
j
,
iResults
[
i
][
j
]);
}
for
(
i
=
0
;
i
<
5
;
i
++
)
IMalloc_Free
(
ppM
,
idlArr
[
i
]);
for
(
i
=
0
;
i
<
5
;
i
++
)
{
SFGAOF
flags
;
flags
=
SFGAO_FILESYSTEM
|
SFGAO_FOLDER
|
SFGAO_FILESYSANCESTOR
;
hr
=
IShellFolder_GetAttributesOf
(
iFolder
,
1
,
(
LPCITEMIDLIST
*
)(
idlArr
+
i
),
&
flags
);
flags
&=
SFGAO_FILESYSTEM
|
SFGAO_FOLDER
|
SFGAO_FILESYSANCESTOR
;
ok
(
hr
==
S_OK
,
"GetAttributesOf returns %08lx
\n
"
,
hr
);
ok
(
flags
==
attrs
[
i
],
"GetAttributesOf gets attrs %08lx, expects %08lx
\n
"
,
flags
,
attrs
[
i
]);
}
for
(
i
=
0
;
i
<
5
;
i
++
)
IMalloc_Free
(
ppM
,
idlArr
[
i
]);
}
START_TEST
(
shlfolder
)
{
ITEMIDLIST
*
newPIDL
;
IShellFolder
*
IDesktopFolder
,
*
testIShellFolder
;
WCHAR
cCurrDirW
[
MAX_PATH
];
static
const
WCHAR
cTestDirW
[]
=
{
'\\'
,
't'
,
'e'
,
's'
,
't'
,
'd'
,
'i'
,
'r'
,
0
};
HRESULT
hr
;
GetCurrentDirectoryW
(
MAX_PATH
,
cCurrDirW
);
strcatW
(
cCurrDirW
,
cTestDirW
);
if
(
!
SUCCEEDED
(
SHGetMalloc
(
&
ppM
)))
return
;
OleInitialize
(
NULL
);
hr
=
SHGetMalloc
(
&
ppM
);
ok
(
hr
==
S_OK
,
"SHGetMalloc failed %08lx
\n
"
,
hr
);
CreateFilesFolders
();
if
(
!
SUCCEEDED
(
SHGetDesktopFolder
(
&
IDesktopFolder
)))
return
;
hr
=
SHGetDesktopFolder
(
&
IDesktopFolder
);
ok
(
hr
==
S_OK
,
"SHGetDesktopfolder failed %08lx
\n
"
,
hr
)
;
if
(
SUCCEEDED
(
IShellFolder_ParseDisplayName
(
IDesktopFolder
,
NULL
,
NULL
,
cCurrDirW
,
NULL
,
&
newPIDL
,
0
)))
{
if
(
SUCCEEDED
(
IShellFolder_BindToObject
(
IDesktopFolder
,
newPIDL
,
NULL
,
(
REFIID
)
&
IID_IShellFolder
,
(
LPVOID
*
)
&
testIShellFolder
)))
{
test_EnumObjects
(
testIShellFolder
);
/* This fails on windows */
/* IShellFolder_Release(newIShellFolder); */
hr
=
IShellFolder_ParseDisplayName
(
IDesktopFolder
,
NULL
,
NULL
,
cCurrDirW
,
NULL
,
&
newPIDL
,
0
);
ok
(
hr
==
S_OK
,
"ParseDisplayName failed %08lx
\n
"
,
hr
);
IMalloc_Free
(
ppM
,
newPIDL
);
}
}
hr
=
IShellFolder_BindToObject
(
IDesktopFolder
,
newPIDL
,
NULL
,
(
REFIID
)
&
IID_IShellFolder
,
(
LPVOID
*
)
&
testIShellFolder
);
ok
(
hr
==
S_OK
,
"BindToObject failed %08lx
\n
"
,
hr
);
test_EnumObjects
(
testIShellFolder
);
hr
=
IShellFolder_Release
(
testIShellFolder
);
ok
(
hr
==
S_OK
,
"IShellFolder_Release failed %08lx
\n
"
,
hr
);
IMalloc_Free
(
ppM
,
newPIDL
);
Cleanup
();
}
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