Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
980e00c6
Commit
980e00c6
authored
Feb 28, 2008
by
Dan Hipschman
Committed by
Alexandre Julliard
Feb 29, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qmgr: Implement IEnumBackgroundCopyFiles_Next.
parent
438fa44d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
138 additions
and
6 deletions
+138
-6
enum_files.c
dlls/qmgr/enum_files.c
+34
-4
enum_files.c
dlls/qmgr/tests/enum_files.c
+104
-2
No files found.
dlls/qmgr/enum_files.c
View file @
980e00c6
/*
* Queue Manager (BITS) File Enumerator
*
* Copyright 2007
Google (Roy Shea
)
* Copyright 2007
, 2008 Google (Roy Shea, Dan Hipschman
)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -73,15 +73,45 @@ static ULONG WINAPI BITS_IEnumBackgroundCopyFiles_Release(
return
ref
;
}
/*
** IEnumBackgroundCopyFiles methods **
*/
/*
Return reference to one or more files in the file enumerator
*/
static
HRESULT
WINAPI
BITS_IEnumBackgroundCopyFiles_Next
(
IEnumBackgroundCopyFiles
*
iface
,
ULONG
celt
,
IBackgroundCopyFile
**
rgelt
,
ULONG
*
pceltFetched
)
{
FIXME
(
"Not implemented
\n
"
);
return
E_NOTIMPL
;
EnumBackgroundCopyFilesImpl
*
This
=
(
EnumBackgroundCopyFilesImpl
*
)
iface
;
ULONG
fetched
;
ULONG
i
;
IBackgroundCopyFile
*
file
;
/* Despite documented behavior, Windows (tested on XP) is not verifying
that the caller set pceltFetched to zero. No check here. */
fetched
=
min
(
celt
,
This
->
numFiles
-
This
->
indexFiles
);
if
(
pceltFetched
)
*
pceltFetched
=
fetched
;
else
{
/* We need to initialize this array if the caller doesn't request
the length because length_is will default to celt. */
for
(
i
=
0
;
i
<
celt
;
i
++
)
rgelt
[
i
]
=
NULL
;
/* pceltFetched can only be NULL if celt is 1 */
if
(
celt
!=
1
)
return
E_INVALIDARG
;
}
/* Fill in the array of objects */
for
(
i
=
0
;
i
<
fetched
;
i
++
)
{
file
=
This
->
files
[
This
->
indexFiles
++
];
IBackgroundCopyFile_AddRef
(
file
);
rgelt
[
i
]
=
file
;
}
return
fetched
==
celt
?
S_OK
:
S_FALSE
;
}
static
HRESULT
WINAPI
BITS_IEnumBackgroundCopyFiles_Skip
(
...
...
dlls/qmgr/tests/enum_files.c
View file @
980e00c6
/*
* Unit test suite for Enum Background Copy Files Interface
*
* Copyright 2007
Google (Roy Shea
)
* Copyright 2007
, 2008 Google (Roy Shea, Dan Hipschman
)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -27,7 +27,7 @@
#include "bits.h"
/* Globals used by many tests */
#define NUM_FILES 2
#define NUM_FILES 2
/* At least two. */
static
const
WCHAR
test_remoteNameA
[]
=
{
'r'
,
'e'
,
'm'
,
'o'
,
't'
,
'e'
,
'A'
,
0
};
static
const
WCHAR
test_localNameA
[]
=
{
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
'A'
,
0
};
static
const
WCHAR
test_remoteNameB
[]
=
{
'r'
,
'e'
,
'm'
,
'o'
,
't'
,
'e'
,
'B'
,
0
};
...
...
@@ -116,12 +116,114 @@ static void test_GetCount(void)
ok
(
fileCount
==
test_fileCount
,
"Got incorrect count
\n
"
);
}
/* Test Next with a NULL pceltFetched*/
static
void
test_Next_walkListNull
(
void
)
{
HRESULT
hres
;
IBackgroundCopyFile
*
file
;
ULONG
i
;
/* Fetch the available files */
for
(
i
=
0
;
i
<
test_fileCount
;
i
++
)
{
hres
=
IEnumBackgroundCopyFiles_Next
(
test_enumFiles
,
1
,
&
file
,
NULL
);
ok
(
hres
==
S_OK
,
"Next failed: %08x
\n
"
,
hres
);
if
(
hres
!=
S_OK
)
{
skip
(
"Unable to get file from test_enumFiles
\n
"
);
return
;
}
IBackgroundCopyFile_Release
(
file
);
}
/* Attempt to fetch one more than the number of available files */
hres
=
IEnumBackgroundCopyFiles_Next
(
test_enumFiles
,
1
,
&
file
,
NULL
);
ok
(
hres
==
S_FALSE
,
"Next off end of available files failed: %08x
\n
"
,
hres
);
}
/* Test Next by requesting one file at a time */
static
void
test_Next_walkList_1
(
void
)
{
HRESULT
hres
;
IBackgroundCopyFile
*
file
;
ULONG
fetched
;
ULONG
i
;
/* Fetch the available files */
for
(
i
=
0
;
i
<
test_fileCount
;
i
++
)
{
file
=
NULL
;
fetched
=
0
;
hres
=
IEnumBackgroundCopyFiles_Next
(
test_enumFiles
,
1
,
&
file
,
&
fetched
);
ok
(
hres
==
S_OK
,
"Next failed: %08x
\n
"
,
hres
);
if
(
hres
!=
S_OK
)
{
skip
(
"Unable to get file from test_enumFiles
\n
"
);
return
;
}
ok
(
fetched
==
1
,
"Next returned the incorrect number of files: %08x
\n
"
,
hres
);
ok
(
file
!=
NULL
,
"Next returned NULL
\n
"
);
if
(
file
)
IBackgroundCopyFile_Release
(
file
);
}
/* Attempt to fetch one more than the number of available files */
fetched
=
0
;
hres
=
IEnumBackgroundCopyFiles_Next
(
test_enumFiles
,
1
,
&
file
,
&
fetched
);
ok
(
hres
==
S_FALSE
,
"Next off end of available files failed: %08x
\n
"
,
hres
);
ok
(
fetched
==
0
,
"Next returned the incorrect number of files: %08x
\n
"
,
hres
);
}
/* Test Next by requesting multiple files at a time */
static
void
test_Next_walkList_2
(
void
)
{
HRESULT
hres
;
IBackgroundCopyFile
*
files
[
NUM_FILES
];
ULONG
fetched
;
ULONG
i
;
for
(
i
=
0
;
i
<
test_fileCount
;
i
++
)
files
[
i
]
=
NULL
;
fetched
=
0
;
hres
=
IEnumBackgroundCopyFiles_Next
(
test_enumFiles
,
test_fileCount
,
files
,
&
fetched
);
ok
(
hres
==
S_OK
,
"Next failed: %08x
\n
"
,
hres
);
if
(
hres
!=
S_OK
)
{
skip
(
"Unable to get file from test_enumFiles
\n
"
);
return
;
}
ok
(
fetched
==
test_fileCount
,
"Next returned the incorrect number of files: %08x
\n
"
,
hres
);
for
(
i
=
0
;
i
<
test_fileCount
;
i
++
)
{
ok
(
files
[
i
]
!=
NULL
,
"Next returned NULL
\n
"
);
if
(
files
[
i
])
IBackgroundCopyFile_Release
(
files
[
i
]);
}
}
/* Test Next Error conditions */
static
void
test_Next_errors
(
void
)
{
HRESULT
hres
;
IBackgroundCopyFile
*
files
[
NUM_FILES
];
/* E_INVALIDARG: pceltFetched can ONLY be NULL if celt is 1 */
hres
=
IEnumBackgroundCopyFiles_Next
(
test_enumFiles
,
2
,
files
,
NULL
);
ok
(
hres
==
E_INVALIDARG
,
"Invalid call to Next succeeded: %08x
\n
"
,
hres
);
}
typedef
void
(
*
test_t
)(
void
);
START_TEST
(
enum_files
)
{
static
const
test_t
tests
[]
=
{
test_GetCount
,
test_Next_walkListNull
,
test_Next_walkList_1
,
test_Next_walkList_2
,
test_Next_errors
,
0
};
const
test_t
*
test
;
...
...
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