scrrun: Implement Skip() for drive collection.
This commit is contained in:
parent
770213e16c
commit
a30a2abbc4
|
@ -1103,16 +1103,18 @@ static HRESULT WINAPI drivecoll_enumvariant_Next(IEnumVARIANT *iface, ULONG celt
|
|||
{
|
||||
struct enumvariant *This = impl_from_IEnumVARIANT(iface);
|
||||
ULONG count = 0;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p)->(%d %p %p)\n", This, celt, var, fetched);
|
||||
|
||||
if (fetched)
|
||||
*fetched = 0;
|
||||
|
||||
if (!celt) return S_OK;
|
||||
|
||||
while (find_next_drive(This) == S_OK)
|
||||
{
|
||||
IDrive *drive;
|
||||
HRESULT hr;
|
||||
|
||||
hr = create_drive('A' + This->data.u.drivecoll.cur, &drive);
|
||||
if (FAILED(hr)) return hr;
|
||||
|
@ -1123,22 +1125,24 @@ static HRESULT WINAPI drivecoll_enumvariant_Next(IEnumVARIANT *iface, ULONG celt
|
|||
if (++count >= celt) break;
|
||||
}
|
||||
|
||||
if (count < celt)
|
||||
return S_FALSE;
|
||||
|
||||
if (fetched)
|
||||
*fetched = count;
|
||||
|
||||
return S_OK;
|
||||
return (count < celt) ? S_FALSE : S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI drivecoll_enumvariant_Skip(IEnumVARIANT *iface, ULONG celt)
|
||||
{
|
||||
struct enumvariant *This = impl_from_IEnumVARIANT(iface);
|
||||
|
||||
FIXME("(%p)->(%d): stub\n", This, celt);
|
||||
TRACE("(%p)->(%d)\n", This, celt);
|
||||
|
||||
return E_NOTIMPL;
|
||||
if (!celt) return S_OK;
|
||||
|
||||
while (celt && find_next_drive(This) == S_OK)
|
||||
celt--;
|
||||
|
||||
return celt ? S_FALSE : S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI drivecoll_enumvariant_Reset(IEnumVARIANT *iface)
|
||||
|
|
|
@ -1142,6 +1142,47 @@ todo_wine
|
|||
IFileCollection_Release(files);
|
||||
}
|
||||
|
||||
static void test_DriveCollection(void)
|
||||
{
|
||||
IDriveCollection *drives;
|
||||
IEnumVARIANT *enumvar;
|
||||
ULONG fetched;
|
||||
VARIANT var;
|
||||
HRESULT hr;
|
||||
LONG count;
|
||||
|
||||
hr = IFileSystem3_get_Drives(fs3, &drives);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
hr = IDriveCollection_get__NewEnum(drives, (IUnknown**)&enumvar);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
count = 0;
|
||||
hr = IDriveCollection_get_Count(drives, &count);
|
||||
todo_wine {
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(count > 0, "got %d\n", count);
|
||||
}
|
||||
V_VT(&var) = VT_EMPTY;
|
||||
fetched = -1;
|
||||
hr = IEnumVARIANT_Next(enumvar, 0, &var, &fetched);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(fetched == 0, "got %d\n", fetched);
|
||||
|
||||
hr = IEnumVARIANT_Skip(enumvar, 0);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
hr = IEnumVARIANT_Skip(enumvar, count);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
hr = IEnumVARIANT_Skip(enumvar, 1);
|
||||
todo_wine
|
||||
ok(hr == S_FALSE, "got 0x%08x\n", hr);
|
||||
|
||||
IEnumVARIANT_Release(enumvar);
|
||||
IDriveCollection_Release(drives);
|
||||
}
|
||||
|
||||
START_TEST(filesystem)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
@ -1169,6 +1210,7 @@ START_TEST(filesystem)
|
|||
test_GetFolder();
|
||||
test_FolderCollection();
|
||||
test_FileCollection();
|
||||
test_DriveCollection();
|
||||
|
||||
IFileSystem3_Release(fs3);
|
||||
|
||||
|
|
Loading…
Reference in New Issue