mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-20 00:49:23 +00:00
scrrun: Implement Count() property for file collection.
This commit is contained in:
parent
2b628405cd
commit
108c27313b
|
@ -1831,8 +1831,32 @@ static HRESULT WINAPI filecoll_get__NewEnum(IFileCollection *iface, IUnknown **p
|
|||
static HRESULT WINAPI filecoll_get_Count(IFileCollection *iface, LONG *count)
|
||||
{
|
||||
struct filecollection *This = impl_from_IFileCollection(iface);
|
||||
FIXME("(%p)->(%p)\n", This, count);
|
||||
return E_NOTIMPL;
|
||||
static const WCHAR allW[] = {'\\','*',0};
|
||||
WIN32_FIND_DATAW data;
|
||||
WCHAR pathW[MAX_PATH];
|
||||
HANDLE handle;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, count);
|
||||
|
||||
if(!count)
|
||||
return E_POINTER;
|
||||
|
||||
*count = 0;
|
||||
|
||||
strcpyW(pathW, This->path);
|
||||
strcatW(pathW, allW);
|
||||
handle = FindFirstFileW(pathW, &data);
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
|
||||
do
|
||||
{
|
||||
if (is_file_data(&data))
|
||||
*count += 1;
|
||||
} while (FindNextFileW(handle, &data));
|
||||
FindClose(handle);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IFileCollectionVtbl filecollectionvtbl = {
|
||||
|
|
|
@ -1084,9 +1084,7 @@ static void test_FileCollection(void)
|
|||
|
||||
count = 0;
|
||||
hr = IFileCollection_get_Count(files, &count);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
todo_wine
|
||||
ok(count == 2, "got %d\n", count);
|
||||
|
||||
lstrcpyW(pathW, buffW);
|
||||
|
@ -1097,9 +1095,7 @@ todo_wine
|
|||
/* every time property is requested it scans directory */
|
||||
count = 0;
|
||||
hr = IFileCollection_get_Count(files, &count);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
todo_wine
|
||||
ok(count == 3, "got %d\n", count);
|
||||
|
||||
hr = IFileCollection_get__NewEnum(files, NULL);
|
||||
|
|
Loading…
Reference in a new issue