advpack: Improve DelNode and tests
Alexandre Julliard
julliard at winehq.org
Mon Jun 26 02:39:35 CDT 2017
"katahiromz ." <katayama.hirofumi.mz at gmail.com> writes:
> @@ -327,6 +328,149 @@ done:
> return HRESULT_FROM_WIN32(dwLastError);
> }
>
> +static HRESULT DELNODE_delete_file(LPWSTR fname)
> +{
> + if (GetFileAttributesW(fname) != INVALID_FILE_ATTRIBUTES)
> + {
> + SetFileAttributesW(fname, FILE_ATTRIBUTE_NORMAL);
> + if (DeleteFileW(fname))
> + {
> + return S_OK;
> + }
> + }
There shouldn't be any reason to retrieve attributes first.
> + /* generate a path with wildcard suitable for iterating */
> + fname_len = lstrlenW(fname);
> + if (fname_len && fname[fname_len - 1] != L'\\')
> + {
> + fname[fname_len++] = L'\\';
Please don't use wide character constants.
> C_SRCS = \
> advpack.c \
> + delnode.c \
> files.c \
> install.c
Please don't create a new file, the tests should go into files.c.
> +static const NODEW s_nodesW[] =
> +{
> + { L"dir1", TRUE }, /* 0 */
> + { L"dir1\\dir2", TRUE }, /* 1 */
> + { L"dir1\\dir2\\file1", FALSE }, /* 2 */
You can't use wide character strings in Wine.
> +START_TEST(delnode)
> +{
> + s_hAdvPack = LoadLibraryA("advpack.dll");
> + if (s_hAdvPack == NULL)
> + {
> + skip("unable to load advpack.dll\n");
> + return;
> + }
This shouldn't be necessary.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list