[SHLWAPI_WINETEST] Sync with Wine Staging 3.3. CORE-14434

This commit is contained in:
Amine Khaldi 2018-03-04 13:26:14 +01:00
parent e2e63ede68
commit 6cdd1357d6
13 changed files with 461 additions and 230 deletions

View file

@ -20,7 +20,7 @@ list(APPEND SOURCE
add_executable(shlwapi_winetest ${SOURCE} testlist.c)
target_link_libraries(shlwapi_winetest uuid)
set_module_type(shlwapi_winetest win32cui)
add_importlibs(shlwapi_winetest shlwapi ole32 oleaut32 user32 advapi32 msvcrt kernel32)
add_importlibs(shlwapi_winetest shlwapi shell32 mlang oleaut32 ole32 user32 advapi32 msvcrt kernel32)
if(MSVC)
add_importlibs(shlwapi_winetest ntdll)

View file

@ -17,14 +17,19 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "precomp.h"
#include <stdarg.h>
#define expect(expected, got) ok ( expected == got, "Expected %d, got %d\n", expected, got)
#define expect_hr(expected, got) ok ( expected == got, "Expected %08x, got %08x\n", expected, got)
#include "wine/test.h"
#include "shlwapi.h"
#include "shlguid.h"
#define expect(expected, got) ok( (expected) == (got), "Expected %d, got %d\n", (expected), (got))
#define expect_hr(expected, got) ok( (expected) == (got), "Expected %08x, got %08x\n", (expected), (got))
static HRESULT (WINAPI *pAssocQueryStringA)(ASSOCF,ASSOCSTR,LPCSTR,LPCSTR,LPSTR,LPDWORD) = NULL;
static HRESULT (WINAPI *pAssocQueryStringW)(ASSOCF,ASSOCSTR,LPCWSTR,LPCWSTR,LPWSTR,LPDWORD) = NULL;
static HRESULT (WINAPI *pAssocCreate)(CLSID, REFIID, void **) = NULL;
static HRESULT (WINAPI *pAssocGetPerceivedType)(LPCWSTR, PERCEIVED *, INT *, LPWSTR *) = NULL;
/* Every version of Windows with IE should have this association? */
static const WCHAR dotHtml[] = { '.','h','t','m','l',0 };
@ -302,6 +307,283 @@ static void test_assoc_create(void)
}
}
/* Based on http://www.geoffchappell.com/studies/windows/shell/shlwapi/api/assocapi/getperceivedtype.htm */
struct assoc_test_struct
{
PCSTR extension;
PERCEIVED perceived;
INT flags;
PCSTR type;
DWORD minversion;
HRESULT hr;
};
#define HARDCODED_NATIVE_WMSDK (PERCEIVEDFLAG_HARDCODED | PERCEIVEDFLAG_NATIVESUPPORT | PERCEIVEDFLAG_WMSDK)
#define HARDCODED_NATIVE_GDIPLUS (PERCEIVEDFLAG_HARDCODED | PERCEIVEDFLAG_NATIVESUPPORT | PERCEIVEDFLAG_GDIPLUS)
#define HARDCODED_NATIVE_ZIPFLDR (PERCEIVEDFLAG_HARDCODED | PERCEIVEDFLAG_NATIVESUPPORT | PERCEIVEDFLAG_ZIPFOLDER)
#define SOFTCODED_NATIVESUPPORT (PERCEIVEDFLAG_SOFTCODED | PERCEIVEDFLAG_NATIVESUPPORT)
static const struct assoc_test_struct assoc_perceived_types[] =
{
/* builtins */
{ ".aif", PERCEIVED_TYPE_AUDIO, HARDCODED_NATIVE_WMSDK, "audio" },
{ ".aifc", PERCEIVED_TYPE_AUDIO, HARDCODED_NATIVE_WMSDK, "audio" },
{ ".aiff", PERCEIVED_TYPE_AUDIO, HARDCODED_NATIVE_WMSDK, "audio" },
{ ".asf", PERCEIVED_TYPE_VIDEO, HARDCODED_NATIVE_WMSDK, "video" },
{ ".asx", PERCEIVED_TYPE_VIDEO, HARDCODED_NATIVE_WMSDK, "video" },
{ ".au", PERCEIVED_TYPE_AUDIO, HARDCODED_NATIVE_WMSDK, "audio" },
{ ".avi", PERCEIVED_TYPE_VIDEO, HARDCODED_NATIVE_WMSDK, "video" },
{ ".bas", PERCEIVED_TYPE_APPLICATION, PERCEIVEDFLAG_HARDCODED, "application" },
{ ".bat", PERCEIVED_TYPE_APPLICATION, PERCEIVEDFLAG_HARDCODED, "application" },
{ ".bmp", PERCEIVED_TYPE_IMAGE, HARDCODED_NATIVE_GDIPLUS, "image" },
{ ".cmd", PERCEIVED_TYPE_APPLICATION, PERCEIVEDFLAG_HARDCODED, "application" },
{ ".com", PERCEIVED_TYPE_APPLICATION, PERCEIVEDFLAG_HARDCODED, "application" },
{ ".cpl", PERCEIVED_TYPE_SYSTEM, PERCEIVEDFLAG_HARDCODED, "system", 0x600 },
{ ".dib", PERCEIVED_TYPE_IMAGE, HARDCODED_NATIVE_GDIPLUS, "image" },
{ ".dvr-ms", PERCEIVED_TYPE_VIDEO, HARDCODED_NATIVE_WMSDK, "video" },
{ ".emf", PERCEIVED_TYPE_IMAGE, HARDCODED_NATIVE_GDIPLUS, "image" },
{ ".exe", PERCEIVED_TYPE_APPLICATION, PERCEIVEDFLAG_HARDCODED, "application" },
{ ".gif", PERCEIVED_TYPE_IMAGE, HARDCODED_NATIVE_GDIPLUS, "image" },
{ ".hta", PERCEIVED_TYPE_APPLICATION, PERCEIVEDFLAG_HARDCODED, "application" },
/* htm & html are PERCEIVED_TYPE_TEXT, PERCEIVEDFLAG_NATIVESUPPORT | PERCEIVEDFLAG_SOFTCODED in w2k3 */
{ ".htm", PERCEIVED_TYPE_DOCUMENT, PERCEIVEDFLAG_HARDCODED, "document", 0x600 },
{ ".html", PERCEIVED_TYPE_DOCUMENT, PERCEIVEDFLAG_HARDCODED, "document", 0x600 },
{ ".ico", PERCEIVED_TYPE_IMAGE, HARDCODED_NATIVE_GDIPLUS, "image" },
{ ".IVF", PERCEIVED_TYPE_VIDEO, HARDCODED_NATIVE_WMSDK, "video" },
{ ".jfif", PERCEIVED_TYPE_IMAGE, HARDCODED_NATIVE_GDIPLUS, "image" },
{ ".jpe", PERCEIVED_TYPE_IMAGE, HARDCODED_NATIVE_GDIPLUS, "image" },
{ ".jpeg", PERCEIVED_TYPE_IMAGE, HARDCODED_NATIVE_GDIPLUS, "image" },
{ ".jpg", PERCEIVED_TYPE_IMAGE, HARDCODED_NATIVE_GDIPLUS, "image" },
{ ".lnk", PERCEIVED_TYPE_UNSPECIFIED, PERCEIVEDFLAG_HARDCODED, NULL, 0x600, E_FAIL },
{ ".m1v", PERCEIVED_TYPE_VIDEO, HARDCODED_NATIVE_WMSDK, "video" },
{ ".m3u", PERCEIVED_TYPE_AUDIO, HARDCODED_NATIVE_WMSDK, "audio" },
{ ".mht", PERCEIVED_TYPE_DOCUMENT, PERCEIVEDFLAG_HARDCODED, "document", 0x600 },
{ ".mid", PERCEIVED_TYPE_AUDIO, HARDCODED_NATIVE_WMSDK, "audio" },
{ ".midi", PERCEIVED_TYPE_AUDIO, HARDCODED_NATIVE_WMSDK, "audio" },
{ ".msi", PERCEIVED_TYPE_APPLICATION, PERCEIVEDFLAG_HARDCODED, "application" },
/* below win8 this is defined to be video */
{ ".mp2", PERCEIVED_TYPE_AUDIO, HARDCODED_NATIVE_WMSDK, "audio", 0x602 },
{ ".mp2v", PERCEIVED_TYPE_VIDEO, HARDCODED_NATIVE_WMSDK, "video" },
{ ".mp3", PERCEIVED_TYPE_AUDIO, HARDCODED_NATIVE_WMSDK, "audio" },
{ ".mpa", PERCEIVED_TYPE_VIDEO, HARDCODED_NATIVE_WMSDK, "video" },
{ ".mpe", PERCEIVED_TYPE_VIDEO, HARDCODED_NATIVE_WMSDK, "video" },
{ ".mpeg", PERCEIVED_TYPE_VIDEO, HARDCODED_NATIVE_WMSDK, "video" },
{ ".mpg", PERCEIVED_TYPE_VIDEO, HARDCODED_NATIVE_WMSDK, "video" },
{ ".mpv2", PERCEIVED_TYPE_VIDEO, HARDCODED_NATIVE_WMSDK, "video" },
{ ".pif", PERCEIVED_TYPE_APPLICATION, PERCEIVEDFLAG_HARDCODED, "application" },
{ ".png", PERCEIVED_TYPE_IMAGE, HARDCODED_NATIVE_GDIPLUS, "image" },
{ ".reg", PERCEIVED_TYPE_APPLICATION, PERCEIVEDFLAG_HARDCODED, "application" },
{ ".rle", PERCEIVED_TYPE_IMAGE, HARDCODED_NATIVE_GDIPLUS, "image" },
{ ".rmi", PERCEIVED_TYPE_AUDIO, HARDCODED_NATIVE_WMSDK, "audio" },
{ ".scr", PERCEIVED_TYPE_APPLICATION, PERCEIVEDFLAG_HARDCODED, "application" },
{ ".search-ms", PERCEIVED_TYPE_UNSPECIFIED, PERCEIVEDFLAG_HARDCODED, NULL, 0x600, E_FAIL },
{ ".snd", PERCEIVED_TYPE_AUDIO, HARDCODED_NATIVE_WMSDK, "audio" },
{ ".tif", PERCEIVED_TYPE_IMAGE, HARDCODED_NATIVE_GDIPLUS, "image" },
{ ".tiff", PERCEIVED_TYPE_IMAGE, HARDCODED_NATIVE_GDIPLUS, "image" },
{ ".vb", PERCEIVED_TYPE_APPLICATION, PERCEIVEDFLAG_HARDCODED, "application" },
{ ".wav", PERCEIVED_TYPE_AUDIO, HARDCODED_NATIVE_WMSDK, "audio" },
{ ".wax", PERCEIVED_TYPE_AUDIO, HARDCODED_NATIVE_WMSDK, "audio" },
{ ".wm", PERCEIVED_TYPE_VIDEO, HARDCODED_NATIVE_WMSDK, "video" },
{ ".wma", PERCEIVED_TYPE_AUDIO, HARDCODED_NATIVE_WMSDK, "audio" },
{ ".wmf", PERCEIVED_TYPE_IMAGE, HARDCODED_NATIVE_GDIPLUS, "image" },
{ ".wmv", PERCEIVED_TYPE_VIDEO, HARDCODED_NATIVE_WMSDK, "video" },
{ ".wmx", PERCEIVED_TYPE_VIDEO, HARDCODED_NATIVE_WMSDK, "video" },
{ ".wvx", PERCEIVED_TYPE_VIDEO, HARDCODED_NATIVE_WMSDK, "video" },
{ ".zip", PERCEIVED_TYPE_COMPRESSED, HARDCODED_NATIVE_ZIPFLDR, "compressed" },
/* found in the registry under HKEY_CLASSES_ROOT on a new Win7 VM */
{ ".386", PERCEIVED_TYPE_SYSTEM, PERCEIVEDFLAG_SOFTCODED, "system" },
{ ".3g2", PERCEIVED_TYPE_VIDEO, PERCEIVEDFLAG_SOFTCODED, "video", 0x601 },
{ ".3gp", PERCEIVED_TYPE_VIDEO, PERCEIVEDFLAG_SOFTCODED, "video", 0x601 },
{ ".3gp2", PERCEIVED_TYPE_VIDEO, PERCEIVEDFLAG_SOFTCODED, "video", 0x601 },
{ ".3gpp", PERCEIVED_TYPE_VIDEO, PERCEIVEDFLAG_SOFTCODED, "video", 0x601 },
{ ".AAC", PERCEIVED_TYPE_AUDIO, PERCEIVEDFLAG_SOFTCODED, "audio", 0x601 },
{ ".ADT", PERCEIVED_TYPE_AUDIO, PERCEIVEDFLAG_SOFTCODED, "audio", 0x601 },
{ ".ADTS", PERCEIVED_TYPE_AUDIO, PERCEIVEDFLAG_SOFTCODED, "audio", 0x601 },
{ ".asm", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".asmx", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".aspx", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".c", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".cab", PERCEIVED_TYPE_COMPRESSED, PERCEIVEDFLAG_SOFTCODED, "compressed", 0x600 },
{ ".chk", PERCEIVED_TYPE_SYSTEM, PERCEIVEDFLAG_SOFTCODED, "system" },
{ ".cpp", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".css", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".cxx", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".def", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".diz", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".docx", PERCEIVED_TYPE_DOCUMENT, PERCEIVEDFLAG_SOFTCODED, "document", 0x601 },
{ ".drv", PERCEIVED_TYPE_SYSTEM, PERCEIVEDFLAG_SOFTCODED, "system", 0x600 },
{ ".gz", PERCEIVED_TYPE_COMPRESSED, PERCEIVEDFLAG_SOFTCODED, "compressed" },
{ ".h", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".hpp", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".hxx", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".inc", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".ini", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text", 0x600 },
{ ".java", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".local", PERCEIVED_TYPE_SYSTEM, PERCEIVEDFLAG_SOFTCODED, "system" },
{ ".M2T", PERCEIVED_TYPE_VIDEO, PERCEIVEDFLAG_SOFTCODED, "video", 0x601 },
{ ".M2TS", PERCEIVED_TYPE_VIDEO, PERCEIVEDFLAG_SOFTCODED, "video", 0x601 },
{ ".M2V", PERCEIVED_TYPE_VIDEO, PERCEIVEDFLAG_SOFTCODED, "video", 0x601 },
{ ".m4a", PERCEIVED_TYPE_AUDIO, PERCEIVEDFLAG_SOFTCODED, "audio", 0x601 },
{ ".m4b", PERCEIVED_TYPE_AUDIO, PERCEIVEDFLAG_SOFTCODED, "audio", 0x601 },
{ ".m4p", PERCEIVED_TYPE_AUDIO, PERCEIVEDFLAG_SOFTCODED, "audio", 0x601 },
{ ".m4v", PERCEIVED_TYPE_VIDEO, PERCEIVEDFLAG_SOFTCODED, "video", 0x601 },
{ ".manifest", PERCEIVED_TYPE_SYSTEM, PERCEIVEDFLAG_SOFTCODED, "system" },
{ ".MOD", PERCEIVED_TYPE_VIDEO, PERCEIVEDFLAG_SOFTCODED, "video", 0x601 },
{ ".mov", PERCEIVED_TYPE_VIDEO, PERCEIVEDFLAG_SOFTCODED, "video", 0x601 },
{ ".mp4", PERCEIVED_TYPE_VIDEO, PERCEIVEDFLAG_SOFTCODED, "video", 0x601 },
{ ".mp4v", PERCEIVED_TYPE_VIDEO, PERCEIVEDFLAG_SOFTCODED, "video", 0x601 },
{ ".MTS", PERCEIVED_TYPE_VIDEO, PERCEIVEDFLAG_SOFTCODED, "video", 0x601 },
{ ".nvr", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".ocx", PERCEIVED_TYPE_SYSTEM, PERCEIVEDFLAG_SOFTCODED, "system" },
{ ".odt", PERCEIVED_TYPE_DOCUMENT, PERCEIVEDFLAG_SOFTCODED, "document", 0x601 },
{ ".php3", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".pl", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".plg", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".ps1xml", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "Text" },
{ ".rtf", PERCEIVED_TYPE_DOCUMENT, PERCEIVEDFLAG_SOFTCODED, "document", 0x600 },
{ ".sed", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".shtml", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".sql", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".sys", PERCEIVED_TYPE_SYSTEM, PERCEIVEDFLAG_SOFTCODED, "system", 0x600 },
{ ".tar", PERCEIVED_TYPE_COMPRESSED, PERCEIVEDFLAG_SOFTCODED, "compressed" },
{ ".text", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".tgz", PERCEIVED_TYPE_COMPRESSED, PERCEIVEDFLAG_SOFTCODED, "compressed" },
{ ".TS", PERCEIVED_TYPE_VIDEO, PERCEIVEDFLAG_SOFTCODED, "video", 0x601 },
{ ".tsv", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".TTS", PERCEIVED_TYPE_VIDEO, PERCEIVEDFLAG_SOFTCODED, "video", 0x601 },
{ ".txt", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".vob", PERCEIVED_TYPE_VIDEO, PERCEIVEDFLAG_SOFTCODED, "video", 0x601 },
{ ".vxd", PERCEIVED_TYPE_SYSTEM, PERCEIVEDFLAG_SOFTCODED, "system" },
{ ".wdp", PERCEIVED_TYPE_IMAGE, PERCEIVEDFLAG_SOFTCODED, "image" },
{ ".wmz", PERCEIVED_TYPE_COMPRESSED, PERCEIVEDFLAG_SOFTCODED, "compressed" },
{ ".wpl", PERCEIVED_TYPE_AUDIO, PERCEIVEDFLAG_SOFTCODED, "audio", 0x601 },
{ ".wsz", PERCEIVED_TYPE_COMPRESSED, PERCEIVEDFLAG_SOFTCODED, "compressed" },
{ ".x", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text" },
{ ".xml", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text", 0x601 },
{ ".xsl", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text", 0x601 },
{ ".z", PERCEIVED_TYPE_COMPRESSED, PERCEIVEDFLAG_SOFTCODED, "compressed" },
/* found in the registry under HKEY_CLASSES_ROOT\PerceivedType */
{ ".doc", PERCEIVED_TYPE_DOCUMENT, PERCEIVEDFLAG_SOFTCODED, "document", 0x600 },
{ ".dot", PERCEIVED_TYPE_DOCUMENT, PERCEIVEDFLAG_SOFTCODED, "document", 0x600 },
{ ".mhtml", PERCEIVED_TYPE_DOCUMENT, PERCEIVEDFLAG_SOFTCODED, "document", 0x600 },
{ ".pot", PERCEIVED_TYPE_DOCUMENT, PERCEIVEDFLAG_SOFTCODED, "document", 0x600 },
{ ".ppt", PERCEIVED_TYPE_DOCUMENT, PERCEIVEDFLAG_SOFTCODED, "document", 0x600 },
{ ".rtf", PERCEIVED_TYPE_DOCUMENT, PERCEIVEDFLAG_SOFTCODED, "document", 0x600 },
{ ".wri", PERCEIVED_TYPE_DOCUMENT, PERCEIVEDFLAG_SOFTCODED, "document", 0x600 },
{ ".xls", PERCEIVED_TYPE_DOCUMENT, PERCEIVEDFLAG_SOFTCODED, "document", 0x600 },
{ ".xlt", PERCEIVED_TYPE_DOCUMENT, PERCEIVEDFLAG_SOFTCODED, "document", 0x600 },
};
static void test_assoc_one(const struct assoc_test_struct* test)
{
LPWSTR extension, type_expected, type_returned;
PERCEIVED perceived;
HRESULT hr;
INT flags;
/* if SHStrDupA receives a nullptr as input, it will null the output */
SHStrDupA(test->extension, &extension);
SHStrDupA(test->type, &type_expected);
perceived = 0xdeadbeef;
flags = 0xdeadbeef;
hr = pAssocGetPerceivedType(extension, &perceived, &flags, NULL);
expect_hr(type_expected ? S_OK : test->hr, hr);
ok(perceived == test->perceived, "%s: got perceived 0x%x, expected 0x%x\n",
test->extension, perceived, test->perceived);
ok(flags == test->flags, "%s: got flags 0x%x, expected 0x%x\n",
test->extension, flags, test->flags);
type_returned = (void *)0xdeadbeef;
perceived = 0xdeadbeef;
flags = 0xdeadbeef;
hr = pAssocGetPerceivedType(extension, &perceived, &flags, &type_returned);
expect_hr(type_expected ? S_OK : test->hr, hr);
ok(perceived == test->perceived, "%s: got perceived 0x%x, expected 0x%x\n",
test->extension, perceived, test->perceived);
ok(flags == test->flags, "%s: got flags 0x%x, expected 0x%x\n",
test->extension, flags, test->flags);
if (!type_expected)
{
ok(type_returned == (void *)0xdeadbeef || broken(type_returned == NULL) /* Win 8 */,
"%s: got type %p, expected 0xdeadbeef\n", test->extension, type_returned);
}
else if (type_returned == (void *)0xdeadbeef)
{
ok(type_returned != (void *)0xdeadbeef, "%s: got type %p, expected '%s'\n",
test->extension, type_returned, test->type);
}
else
{
ok(StrCmpIW(type_expected, type_returned) == 0, "%s: got type %s, expected '%s'\n",
test->extension, wine_dbgstr_w(type_returned), test->type);
}
CoTaskMemFree(type_returned);
CoTaskMemFree(extension);
CoTaskMemFree(type_expected);
}
static void test_assoc_perceived(void)
{
static const struct assoc_test_struct should_not_exist =
{ ".should_not_exist", PERCEIVED_TYPE_UNSPECIFIED, PERCEIVEDFLAG_UNDEFINED, NULL, 0, 0x80070002 };
static const struct assoc_test_struct htm[] =
{
{ ".htm", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text", 0x600 },
{ ".html", PERCEIVED_TYPE_TEXT, SOFTCODED_NATIVESUPPORT, "text", 0x600 },
};
static const struct assoc_test_struct mp2 =
{ ".mp2", PERCEIVED_TYPE_VIDEO, HARDCODED_NATIVE_WMSDK, "video" };
OSVERSIONINFOEXW osvi;
DWORD version;
size_t i;
if (!pAssocGetPerceivedType)
{
win_skip("AssocGetPerceivedType() is missing\n");
return;
}
memset(&osvi, 0, sizeof(osvi));
osvi.dwOSVersionInfoSize = sizeof(osvi);
GetVersionExW((LPOSVERSIONINFOW)&osvi);
version = (osvi.dwMajorVersion << 8) | osvi.dwMinorVersion;
/* invalid entry results in HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) */
test_assoc_one(&should_not_exist);
for (i = 0; i < sizeof(assoc_perceived_types) / sizeof(assoc_perceived_types[0]); ++i)
{
if (assoc_perceived_types[i].minversion && assoc_perceived_types[i].minversion > version)
continue;
if (!(assoc_perceived_types[i].flags & PERCEIVEDFLAG_HARDCODED))
todo_wine test_assoc_one(&assoc_perceived_types[i]);
else
test_assoc_one(&assoc_perceived_types[i]);
}
/* below Vista */
if (version < 0x600)
{
todo_wine
test_assoc_one(&htm[0]);
todo_wine
test_assoc_one(&htm[1]);
}
/* below Win8 */
if (version < 0x602)
{
test_assoc_one(&mp2);
}
}
START_TEST(assoc)
{
HMODULE hshlwapi;
@ -309,9 +591,11 @@ START_TEST(assoc)
pAssocQueryStringA = (void*)GetProcAddress(hshlwapi, "AssocQueryStringA");
pAssocQueryStringW = (void*)GetProcAddress(hshlwapi, "AssocQueryStringW");
pAssocCreate = (void*)GetProcAddress(hshlwapi, "AssocCreate");
pAssocGetPerceivedType = (void*)GetProcAddress(hshlwapi, "AssocGetPerceivedType");
test_getstring_bad();
test_getstring_basic();
test_getstring_no_extra();
test_assoc_create();
test_assoc_perceived();
}

View file

@ -17,7 +17,13 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "precomp.h"
#define COBJMACROS
#include <stdarg.h>
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
typedef struct tagSHLWAPI_CLIST
{
@ -212,7 +218,7 @@ static IStreamVtbl iclvt =
static HMODULE SHLWAPI_hshlwapi = 0;
static VOID (WINAPI *pSHLWAPI_19)(LPSHLWAPI_CLIST);
static HRESULT (WINAPI *pSHLWAPI_20)(LPSHLWAPI_CLIST*,LPCSHLWAPI_CLIST);
static BOOL (WINAPI *pSHLWAPI_20)(LPSHLWAPI_CLIST*,LPCSHLWAPI_CLIST);
static BOOL (WINAPI *pSHLWAPI_21)(LPSHLWAPI_CLIST*,ULONG);
static LPSHLWAPI_CLIST (WINAPI *pSHLWAPI_22)(LPSHLWAPI_CLIST,ULONG);
static HRESULT (WINAPI *pSHLWAPI_17)(IStream*, SHLWAPI_CLIST*);
@ -286,6 +292,7 @@ static void test_CList(void)
struct dummystream streamobj;
LPSHLWAPI_CLIST list = NULL;
LPCSHLWAPI_CLIST item = SHLWAPI_CLIST_items;
BOOL bRet;
HRESULT hRet;
LPSHLWAPI_CLIST inserted;
BYTE buff[64];
@ -306,10 +313,10 @@ static void test_CList(void)
buff[sizeof(SHLWAPI_CLIST)+i] = i*2;
/* Add it */
hRet = pSHLWAPI_20(&list, inserted);
ok(hRet > S_OK, "failed list add\n");
bRet = pSHLWAPI_20(&list, inserted);
ok(bRet == TRUE, "failed list add\n");
if (hRet > S_OK)
if (bRet == TRUE)
{
ok(list && list->ulSize, "item not added\n");
@ -384,11 +391,8 @@ static void test_CList(void)
inserted = (LPSHLWAPI_CLIST)buff;
inserted->ulSize = sizeof(SHLWAPI_CLIST) -1;
inserted->ulId = 33;
/* The call succeeds but the item is not inserted, except on some early
* versions which return failure. Wine behaves like later versions.
*/
pSHLWAPI_20(&list, inserted);
bRet = pSHLWAPI_20(&list, inserted);
ok(bRet == FALSE, "Expected failure\n");
inserted = pSHLWAPI_22(list, 33);
ok(inserted == NULL, "inserted bad element size\n");
@ -396,9 +400,8 @@ static void test_CList(void)
inserted = (LPSHLWAPI_CLIST)buff;
inserted->ulSize = 44;
inserted->ulId = ~0U;
/* See comment above, some early versions fail this call */
pSHLWAPI_20(&list, inserted);
bRet = pSHLWAPI_20(&list, inserted);
ok(bRet == FALSE, "Expected failure\n");
item = SHLWAPI_CLIST_items;

View file

@ -17,10 +17,17 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "precomp.h"
#include <stdio.h>
#include <olectl.h>
#include <initguid.h>
#include "wine/test.h"
#include "winbase.h"
#include "winerror.h"
#include "winnls.h"
#include "winuser.h"
#include "initguid.h"
#include "shlguid.h"
#include "shobjidl.h"
#include "olectl.h"
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);

View file

@ -5,7 +5,22 @@
* Unit tests for data structure packing
*/
#include "precomp.h"
#ifndef __REACTOS__
#define WINVER 0x0501
#define _WIN32_IE 0x0501
#define _WIN32_WINNT 0x0501
#endif
#define WINE_NOWINSOCK
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wtypes.h"
#include "winreg.h"
#include "shlwapi.h"
#include "wine/test.h"
/***********************************************************************
* Compatibility macros

View file

@ -17,7 +17,16 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "precomp.h"
#define COBJMACROS
#include <stdarg.h>
#include <stdio.h>
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "shlwapi.h"
static void test_IStream_invalid_operations(IStream * stream, DWORD mode)
{

View file

@ -17,12 +17,25 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "precomp.h"
#include <stdio.h>
#define COBJMACROS
#define CONST_VTABLE
#include "wine/test.h"
#include "winbase.h"
#include "winerror.h"
#include "winuser.h"
#include "ole2.h"
#include "oaidl.h"
#include "ocidl.h"
#include "mlang.h"
#include "shlwapi.h"
#include "docobj.h"
#include "shobjidl.h"
#include "shlobj.h"
/* Function ptrs for ordinal calls */
static HMODULE hShlwapi;
static BOOL is_win2k_and_lower;
static BOOL is_win9x;
static int (WINAPI *pSHSearchMapInt)(const int*,const int*,int,int);
static HRESULT (WINAPI *pGetAcceptLanguagesA)(LPSTR,LPDWORD);
@ -74,12 +87,6 @@ typedef struct SHELL_USER_PERMISSION {
static SECURITY_DESCRIPTOR* (WINAPI *pGetShellSecurityDescriptor)(const SHELL_USER_PERMISSION**,int);
static HMODULE hmlang;
static HRESULT (WINAPI *pLcidToRfc1766A)(LCID, LPSTR, INT);
static HMODULE hshell32;
static HRESULT (WINAPI *pSHGetDesktopFolder)(IShellFolder**);
static const CHAR ie_international[] = {
'S','o','f','t','w','a','r','e','\\',
'M','i','c','r','o','s','o','f','t','\\',
@ -192,11 +199,6 @@ static void test_GetAcceptLanguagesA(void)
LPCSTR entry;
INT i = 0;
if (!pGetAcceptLanguagesA) {
win_skip("GetAcceptLanguagesA is not available\n");
return;
}
lcid = GetUserDefaultLCID();
/* Get the original Value */
@ -242,10 +244,8 @@ static void test_GetAcceptLanguagesA(void)
if (lstrcmpA(buffer, language)) {
/* some windows versions use "lang" or "lang-country" as default */
language[0] = 0;
if (pLcidToRfc1766A) {
hr = pLcidToRfc1766A(lcid, language, sizeof(language));
ok(hr == S_OK, "LcidToRfc1766A returned 0x%x and %s\n", hr, language);
}
hr = LcidToRfc1766A(lcid, language, sizeof(language));
ok(hr == S_OK, "LcidToRfc1766A returned 0x%x and %s\n", hr, language);
}
ok(!lstrcmpA(buffer, language),
@ -556,7 +556,6 @@ static void test_alloc_shared_remote(DWORD procid, HANDLE hmem)
SetLastError(0xdeadbeef);
hmem2 = pSHMapHandle(NULL, procid, GetCurrentProcessId(), 0, 0);
ok(hmem2 == NULL, "expected NULL, got new handle\n");
todo_wine
ok(GetLastError() == 0xdeadbeef, "last error should not have changed, got %u\n", GetLastError());
hmem2 = pSHMapHandle(hmem, procid, GetCurrentProcessId(), 0, 0);
@ -699,40 +698,20 @@ static void test_GetShellSecurityDescriptor(void)
&supCurrentUserFull, &supEveryoneDenied,
};
SECURITY_DESCRIPTOR* psd;
void *pChrCmpIW = GetProcAddress(hShlwapi, "ChrCmpIW");
if(!pGetShellSecurityDescriptor)
if(!pGetShellSecurityDescriptor) /* vista and later */
{
win_skip("GetShellSecurityDescriptor not available\n");
return;
}
if(pChrCmpIW && pChrCmpIW == pGetShellSecurityDescriptor) /* win2k */
{
win_skip("Skipping for GetShellSecurityDescriptor, same ordinal used for ChrCmpIW\n");
return;
}
psd = pGetShellSecurityDescriptor(NULL, 2);
ok(psd==NULL ||
broken(psd==INVALID_HANDLE_VALUE), /* IE5 */
"GetShellSecurityDescriptor should fail\n");
ok(psd==NULL, "GetShellSecurityDescriptor should fail\n");
psd = pGetShellSecurityDescriptor(rgsup, 0);
ok(psd==NULL, "GetShellSecurityDescriptor should fail, got %p\n", psd);
SetLastError(0xdeadbeef);
psd = pGetShellSecurityDescriptor(rgsup, 2);
if (psd == NULL && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
/* The previous calls to GetShellSecurityDescriptor don't set the last error */
win_skip("GetShellSecurityDescriptor is not implemented\n");
return;
}
if (psd == INVALID_HANDLE_VALUE)
{
win_skip("GetShellSecurityDescriptor is broken on IE5\n");
return;
}
ok(psd!=NULL, "GetShellSecurityDescriptor failed\n");
if (psd!=NULL)
{
@ -807,9 +786,6 @@ static void test_SHPackDispParams(void)
VARIANT vars[10];
HRESULT hres;
if(!pSHPackDispParams)
win_skip("SHPackSidpParams not available\n");
memset(&params, 0xc0, sizeof(params));
memset(vars, 0xc0, sizeof(vars));
hres = pSHPackDispParams(&params, vars, 1, VT_I4, 0xdeadbeef);
@ -1480,12 +1456,6 @@ static void test_IConnectionPoint(void)
DISPPARAMS params;
VARIANT vars[10];
if (!pIConnectionPoint_SimpleInvoke || !pConnectToConnectionPoint)
{
win_skip("IConnectionPoint Apis not present\n");
return;
}
container = HeapAlloc(GetProcessHeap(),0,sizeof(Contain));
container->IConnectionPointContainer_iface.lpVtbl = &contain_vtbl;
container->refCount = 1;
@ -1504,18 +1474,13 @@ static void test_IConnectionPoint(void)
rc = pIConnectionPoint_SimpleInvoke(point,0xa0,NULL);
ok(rc == S_OK, "pConnectToConnectionPoint failed with %x\n",rc);
if (pSHPackDispParams)
{
memset(&params, 0xc0, sizeof(params));
memset(vars, 0xc0, sizeof(vars));
rc = pSHPackDispParams(&params, vars, 2, VT_I4, 0xdeadbeef, VT_BSTR, 0xdeadcafe);
ok(rc == S_OK, "SHPackDispParams failed: %08x\n", rc);
memset(&params, 0xc0, sizeof(params));
memset(vars, 0xc0, sizeof(vars));
rc = pSHPackDispParams(&params, vars, 2, VT_I4, 0xdeadbeef, VT_BSTR, 0xdeadcafe);
ok(rc == S_OK, "SHPackDispParams failed: %08x\n", rc);
rc = pIConnectionPoint_SimpleInvoke(point,0xa1,&params);
ok(rc == S_OK, "pConnectToConnectionPoint failed with %x\n",rc);
}
else
win_skip("pSHPackDispParams not present\n");
rc = pIConnectionPoint_SimpleInvoke(point,0xa1,&params);
ok(rc == S_OK, "pConnectToConnectionPoint failed with %x\n",rc);
rc = pConnectToConnectionPoint(NULL, &IID_NULL, FALSE, (IUnknown*)container, &cookie, NULL);
ok(rc == S_OK, "pConnectToConnectionPoint failed with %x\n",rc);
@ -1619,12 +1584,6 @@ static void test_SHPropertyBag_ReadLONG(void)
LONG out;
static const WCHAR szName1[] = {'n','a','m','e','1',0};
if (!pSHPropertyBag_ReadLONG)
{
win_skip("SHPropertyBag_ReadLONG not present\n");
return;
}
pb = HeapAlloc(GetProcessHeap(),0,sizeof(PropBag));
pb->refCount = 1;
pb->IPropertyBag_iface.lpVtbl = &prop_vtbl;
@ -1650,12 +1609,6 @@ static void test_SHSetWindowBits(void)
DWORD style, styleold;
WNDCLASSA clsA;
if(!pSHSetWindowBits)
{
win_skip("SHSetWindowBits is not available\n");
return;
}
clsA.style = 0;
clsA.lpfnWndProc = DefWindowProcA;
clsA.cbClsExtra = 0;
@ -1676,8 +1629,7 @@ static void test_SHSetWindowBits(void)
SetLastError(0xdeadbeef);
style = pSHSetWindowBits(NULL, GWL_STYLE, 0, 0);
ok(style == 0, "expected 0 retval, got %d\n", style);
ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE ||
broken(GetLastError() == 0xdeadbeef), /* Win9x/WinMe */
ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE,
"expected ERROR_INVALID_WINDOW_HANDLE, got %d\n", GetLastError());
/* zero mask, zero flags */
@ -1727,12 +1679,6 @@ static void test_SHFormatDateTimeA(void)
DWORD flags;
INT ret;
if(!pSHFormatDateTimeA)
{
win_skip("pSHFormatDateTimeA isn't available\n");
return;
}
if (0)
{
/* crashes on native */
@ -1777,8 +1723,7 @@ if (0)
SetLastError(0xdeadbeef);
ret = pSHFormatDateTimeA(&filetime, &flags, buff, sizeof(buff));
ok(ret == lstrlenA(buff)+1, "got %d\n", ret);
ok(GetLastError() == 0xdeadbeef ||
broken(GetLastError() == ERROR_INVALID_FLAGS), /* Win9x/WinMe */
ok(GetLastError() == 0xdeadbeef,
"expected 0xdeadbeef, got %d\n", GetLastError());
/* now check returned strings */
@ -1889,12 +1834,6 @@ static void test_SHFormatDateTimeW(void)
#define UNICODE_LTR_MARK 0x200e
#define UNICODE_RTL_MARK 0x200f
if(!pSHFormatDateTimeW)
{
win_skip("pSHFormatDateTimeW isn't available\n");
return;
}
if (0)
{
/* crashes on native */
@ -1940,8 +1879,7 @@ if (0)
ret = pSHFormatDateTimeW(&filetime, &flags, buff, sizeof(buff)/sizeof(WCHAR));
ok(ret == lstrlenW(buff)+1 || ret == lstrlenW(buff),
"expected %d or %d, got %d\n", lstrlenW(buff)+1, lstrlenW(buff), ret);
ok(GetLastError() == 0xdeadbeef ||
broken(GetLastError() == ERROR_INVALID_FLAGS), /* Win9x/WinMe/NT4 */
ok(GetLastError() == 0xdeadbeef,
"expected 0xdeadbeef, got %d\n", GetLastError());
/* now check returned strings */
@ -1951,11 +1889,6 @@ if (0)
"expected %d or %d, got %d\n", lstrlenW(buff)+1, lstrlenW(buff), ret);
SetLastError(0xdeadbeef);
ret = GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, NULL, buff2, sizeof(buff2)/sizeof(WCHAR));
if (ret == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
win_skip("Needed W-functions are not implemented\n");
return;
}
ok(ret == lstrlenW(buff2)+1, "expected %d, got %d\n", lstrlenW(buff2)+1, ret);
ok(lstrcmpW(buff, buff2) == 0, "expected equal strings\n");
@ -2103,24 +2036,11 @@ static void test_SHGetObjectCompatFlags(void)
};
static const char compat_path[] = "Software\\Microsoft\\Windows\\CurrentVersion\\ShellCompatibility\\Objects";
void *pColorAdjustLuma = GetProcAddress(hShlwapi, "ColorAdjustLuma");
CHAR keyA[39]; /* {CLSID} */
HKEY root;
DWORD ret;
int i;
if (!pSHGetObjectCompatFlags)
{
win_skip("SHGetObjectCompatFlags isn't available\n");
return;
}
if (pColorAdjustLuma && pColorAdjustLuma == pSHGetObjectCompatFlags) /* win2k */
{
win_skip("Skipping SHGetObjectCompatFlags, same ordinal used for ColorAdjustLuma\n");
return;
}
/* null args */
ret = pSHGetObjectCompatFlags(NULL, NULL);
ok(ret == 0, "got %d\n", ret);
@ -2377,14 +2297,6 @@ static void test_IUnknown_QueryServiceExec(void)
call_trace_t trace_expected;
HRESULT hr;
/* on <=W2K platforms same ordinal used for another export with different
prototype, so skipping using this indirect condition */
if (is_win2k_and_lower)
{
win_skip("IUnknown_QueryServiceExec is not available\n");
return;
}
provider = IServiceProviderImpl_Construct();
/* null source pointer */
@ -2494,14 +2406,6 @@ static void test_IUnknown_ProfferService(void)
HRESULT hr;
DWORD cookie;
/* on <=W2K platforms same ordinal used for another export with different
prototype, so skipping using this indirect condition */
if (is_win2k_and_lower)
{
win_skip("IUnknown_ProfferService is not available\n");
return;
}
provider = IServiceProviderImpl_Construct();
proff = IProfferServiceImpl_Construct();
@ -2565,12 +2469,6 @@ static void test_SHCreateWorkerWindowA(void)
LONG_PTR ret;
BOOL res;
if (is_win2k_and_lower)
{
win_skip("SHCreateWorkerWindowA not available\n");
return;
}
hwnd = pSHCreateWorkerWindowA(0, NULL, 0, 0, 0, 0);
ok(hwnd != 0, "expected window\n");
@ -2739,7 +2637,7 @@ static void test_SHIShellFolder_EnumObjects(void)
HRESULT hres;
IShellFolder *folder;
if(!pSHIShellFolder_EnumObjects || is_win2k_and_lower){
if(!pSHIShellFolder_EnumObjects){ /* win7 and later */
win_skip("SHIShellFolder_EnumObjects not available\n");
return;
}
@ -2756,7 +2654,7 @@ static void test_SHIShellFolder_EnumObjects(void)
ok(enm == (IEnumIDList*)0xcafebabe, "Didn't get expected enumerator location, instead: %p\n", enm);
/* SHIShellFolder_EnumObjects isn't strict about the IShellFolder object */
hres = pSHGetDesktopFolder(&folder);
hres = SHGetDesktopFolder(&folder);
ok(hres == S_OK, "SHGetDesktopFolder failed: 0x%08x\n", hres);
enm = NULL;
@ -2825,11 +2723,6 @@ static void test_SHGetIniString(void)
static const WCHAR testpathW[] = {'C',':','\\','t','e','s','t','.','i','n','i',0};
WCHAR pathW[MAX_PATH];
if(!pSHGetIniStringW || is_win2k_and_lower){
win_skip("SHGetIniStringW is not available\n");
return;
}
lstrcpyW(pathW, testpathW);
if (!write_inifile(pathW))
@ -2880,11 +2773,6 @@ static void test_SHSetIniString(void)
static const WCHAR NewKeyW[] = {'N','e','w','K','e','y',0};
static const WCHAR AValueW[] = {'A','V','a','l','u','e',0};
if(!pSHSetIniStringW || is_win2k_and_lower){
win_skip("SHSetIniStringW is not available\n");
return;
}
if (!write_inifile(TestIniW))
return;
@ -2929,30 +2817,10 @@ static void test_SHGetShellKey(void)
static const WCHAR ShellFoldersW[] = { 'S','h','e','l','l',' ','F','o','l','d','e','r','s',0 };
static const WCHAR WineTestW[] = { 'W','i','n','e','T','e','s','t',0 };
void *pPathBuildRootW = GetProcAddress(hShlwapi, "PathBuildRootW");
DWORD *alloc_data, data, size;
HKEY hkey;
HRESULT hres;
if (!pSHGetShellKey)
{
win_skip("SHGetShellKey(ordinal 491) isn't available\n");
return;
}
/* some win2k */
if (pPathBuildRootW && pPathBuildRootW == pSHGetShellKey)
{
win_skip("SHGetShellKey(ordinal 491) used for PathBuildRootW\n");
return;
}
if (is_win9x || is_win2k_and_lower)
{
win_skip("Ordinal 491 used for another call, skipping SHGetShellKey tests\n");
return;
}
/* Vista+ limits SHKEY enumeration values */
SetLastError(0xdeadbeef);
hkey = pSHGetShellKey(SHKEY_Key_Explorer, ShellFoldersW, FALSE);
@ -2991,12 +2859,6 @@ static void test_SHGetShellKey(void)
ok(hkey != NULL, "Can't create key\n");
RegCloseKey(hkey);
if (!pSKGetValueW || !pSKSetValueW || !pSKDeleteValueW || !pSKAllocValueW)
{
win_skip("SKGetValueW, SKSetValueW, SKDeleteValueW or SKAllocValueW not available\n");
return;
}
size = sizeof(data);
hres = pSKGetValueW(SHKEY_Root_HKLM, WineTestW, NULL, NULL, &data, &size);
ok(hres == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "hres = %x\n", hres);
@ -3084,12 +2946,6 @@ static void test_SHSetParentHwnd(void)
HWND hwnd, hwnd2, ret;
DWORD style;
if (!pSHSetParentHwnd)
{
win_skip("SHSetParentHwnd not available\n");
return;
}
hwnd = CreateWindowA("Button", "", WS_VISIBLE, 0, 0, 10, 10, NULL, NULL, NULL, NULL);
ok(hwnd != NULL, "got %p\n", hwnd);
@ -3264,14 +3120,6 @@ START_TEST(ordinal)
int argc;
hShlwapi = GetModuleHandleA("shlwapi.dll");
is_win2k_and_lower = GetProcAddress(hShlwapi, "StrChrNW") == 0;
is_win9x = GetProcAddress(hShlwapi, (LPSTR)99) == 0; /* StrCpyNXA */
/* SHCreateStreamOnFileEx was introduced in shlwapi v6.0 */
if(!GetProcAddress(hShlwapi, "SHCreateStreamOnFileEx")){
win_skip("Too old shlwapi version\n");
return;
}
init_pointers();
@ -3286,12 +3134,6 @@ START_TEST(ordinal)
return;
}
hmlang = LoadLibraryA("mlang.dll");
pLcidToRfc1766A = (void *)GetProcAddress(hmlang, "LcidToRfc1766A");
hshell32 = LoadLibraryA("shell32.dll");
pSHGetDesktopFolder = (void *)GetProcAddress(hshell32, "SHGetDesktopFolder");
test_GetAcceptLanguagesA();
test_SHSearchMapInt();
test_alloc_shared(argc, argv);
@ -3314,7 +3156,4 @@ START_TEST(ordinal)
test_SHSetParentHwnd();
test_IUnknown_GetClassID();
test_DllGetVersion();
FreeLibrary(hshell32);
FreeLibrary(hmlang);
}

View file

@ -17,7 +17,15 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "precomp.h"
#include <stdarg.h>
#include <stdio.h>
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "shlwapi.h"
#include "wininet.h"
static BOOL (WINAPI *pPathIsValidCharA)(char,DWORD);
static BOOL (WINAPI *pPathIsValidCharW)(WCHAR,DWORD);

View file

@ -1,3 +1,4 @@
#ifndef _SHLWAPI_WINETEST_PRECOMP_H_
#define _SHLWAPI_WINETEST_PRECOMP_H_

View file

@ -17,7 +17,16 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "precomp.h"
#include <stdarg.h>
#include <stdio.h>
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "winreg.h"
#include "winuser.h"
#include "shlwapi.h"
/* Keys used for testing */
#define REG_TEST_KEY "Software\\Wine\\Test"

View file

@ -17,7 +17,18 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "precomp.h"
#include <stdio.h>
#include "wine/test.h"
#include "winbase.h"
#include "winerror.h"
#include "winnls.h"
#define NO_SHLWAPI_REG
#define NO_SHLWAPI_PATH
#define NO_SHLWAPI_GDI
#define NO_SHLWAPI_STREAM
#include "shlwapi.h"
#include "shtypes.h"
#define expect_eq(expr, val, type, fmt) do { \
type ret = expr; \

View file

@ -17,7 +17,19 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "precomp.h"
#include <stdio.h>
#include <stdarg.h>
#define COBJMACROS
#define CONST_VTABLE
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "ole2.h"
#include "shlwapi.h"
#include "wine/test.h"
static HRESULT (WINAPI *pSHCreateThreadRef)(LONG*, IUnknown**);
static HRESULT (WINAPI *pSHGetThreadRef)(IUnknown**);

View file

@ -18,9 +18,16 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "precomp.h"
#include <stdarg.h>
#include <stdio.h>
#include <intshcut.h>
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "shlwapi.h"
#include "wininet.h"
#include "intshcut.h"
/* ################ */
static HMODULE hShlwapi;
@ -197,7 +204,15 @@ static const TEST_URL_CANONICALIZE TEST_CANONICALIZE[] = {
{"///A/../B", URL_WININET_COMPATIBILITY, S_OK, "///B", FALSE},
{"A", 0, S_OK, "A", FALSE},
{"../A", 0, S_OK, "../A", FALSE},
{".\\A", 0, S_OK, ".\\A", FALSE},
{"A\\.\\B", 0, S_OK, "A\\.\\B", FALSE},
{"A/../B", 0, S_OK, "B", TRUE},
{"A/../B/./../C", 0, S_OK, "C", TRUE},
{"A/../B/./../C", URL_DONT_SIMPLIFY, S_OK, "A/../B/./../C", FALSE},
{".", 0, S_OK, "/", TRUE},
{"./A", 0, S_OK, "A", TRUE},
{"A/./B", 0, S_OK, "A/B", TRUE},
{"/:test\\", 0, S_OK, "/:test\\", TRUE},
{"/uri-res/N2R?urn:sha1:B3K", URL_DONT_ESCAPE_EXTRA_INFO | URL_WININET_COMPATIBILITY /*0x82000000*/, S_OK, "/uri-res/N2R?urn:sha1:B3K", FALSE} /*LimeWire online installer calls this*/,
{"http:www.winehq.org/dir/../index.html", 0, S_OK, "http:www.winehq.org/index.html"},
{"http://localhost/test.html", URL_FILE_USE_PATHURL, S_OK, "http://localhost/test.html"},
@ -351,6 +366,7 @@ typedef struct _TEST_URL_COMBINE {
DWORD flags;
HRESULT expectret;
const char *expecturl;
BOOL todo;
} TEST_URL_COMBINE;
static const TEST_URL_COMBINE TEST_COMBINE[] = {
@ -372,6 +388,15 @@ static const TEST_URL_COMBINE TEST_COMBINE[] = {
{"http://www.winehq.org/test14#aaa/bbb#ccc", "#", 0, S_OK, "http://www.winehq.org/test14#"},
{"http://www.winehq.org/tests/?query=x/y/z", "tests15", 0, S_OK, "http://www.winehq.org/tests/tests15"},
{"http://www.winehq.org/tests/?query=x/y/z#example", "tests16", 0, S_OK, "http://www.winehq.org/tests/tests16"},
{"http://www.winehq.org/tests17", ".", 0, S_OK, "http://www.winehq.org/"},
{"http://www.winehq.org/tests18/test", ".", 0, S_OK, "http://www.winehq.org/tests18/"},
{"http://www.winehq.org/tests19/test", "./", 0, S_OK, "http://www.winehq.org/tests19/", FALSE},
{"http://www.winehq.org/tests20/test", "/", 0, S_OK, "http://www.winehq.org/", FALSE},
{"http://www.winehq.org/tests/test", "./test21", 0, S_OK, "http://www.winehq.org/tests/test21", FALSE},
{"http://www.winehq.org/tests/test", "./test22/../test", 0, S_OK, "http://www.winehq.org/tests/test", FALSE},
{"http://www.winehq.org/tests/", "http://www.winehq.org:80/tests23", 0, S_OK, "http://www.winehq.org/tests23", TRUE},
{"http://www.winehq.org/tests/", "tests24/./test/../test", 0, S_OK, "http://www.winehq.org/tests/tests24/test", FALSE},
{"http://www.winehq.org/tests/./tests25", "./", 0, S_OK, "http://www.winehq.org/tests/", FALSE},
{"file:///C:\\dir\\file.txt", "test.txt", 0, S_OK, "file:///C:/dir/test.txt"},
{"file:///C:\\dir\\file.txt#hash\\hash", "test.txt", 0, S_OK, "file:///C:/dir/file.txt#hash/test.txt"},
{"file:///C:\\dir\\file.html#hash\\hash", "test.html", 0, S_OK, "file:///C:/dir/test.html"},
@ -1190,7 +1215,7 @@ static void test_UrlCanonicalizeW(void)
/* ########################### */
static void test_url_combine(const char *szUrl1, const char *szUrl2, DWORD dwFlags, HRESULT dwExpectReturn, const char *szExpectUrl)
static void test_url_combine(const char *szUrl1, const char *szUrl2, DWORD dwFlags, HRESULT dwExpectReturn, const char *szExpectUrl, BOOL todo)
{
HRESULT hr;
CHAR szReturnUrl[INTERNET_MAX_URL_LENGTH];
@ -1215,34 +1240,42 @@ static void test_url_combine(const char *szUrl1, const char *szUrl2, DWORD dwFla
dwSize = 0;
hr = pUrlCombineA(szUrl1, szUrl2, NULL, &dwSize, dwFlags);
ok(hr == E_POINTER, "Checking length of string, return was 0x%08x, expected 0x%08x\n", hr, E_POINTER);
ok(dwSize == dwExpectLen+1, "Got length %d, expected %d\n", dwSize, dwExpectLen+1);
ok(todo || dwSize == dwExpectLen+1, "Got length %d, expected %d\n", dwSize, dwExpectLen+1);
dwSize--;
hr = pUrlCombineA(szUrl1, szUrl2, szReturnUrl, &dwSize, dwFlags);
ok(hr == E_POINTER, "UrlCombineA returned 0x%08x, expected 0x%08x\n", hr, E_POINTER);
ok(dwSize == dwExpectLen+1, "Got length %d, expected %d\n", dwSize, dwExpectLen+1);
ok(todo || dwSize == dwExpectLen+1, "Got length %d, expected %d\n", dwSize, dwExpectLen+1);
hr = pUrlCombineA(szUrl1, szUrl2, szReturnUrl, &dwSize, dwFlags);
ok(hr == dwExpectReturn, "UrlCombineA returned 0x%08x, expected 0x%08x\n", hr, dwExpectReturn);
ok(dwSize == dwExpectLen, "Got length %d, expected %d\n", dwSize, dwExpectLen);
if(SUCCEEDED(hr)) {
ok(strcmp(szReturnUrl,szExpectUrl)==0, "Expected %s, but got %s\n", szExpectUrl, szReturnUrl);
if (todo)
{
todo_wine ok(dwSize == dwExpectLen && (FAILED(hr) || strcmp(szReturnUrl, szExpectUrl)==0),
"Expected %s (len=%d), but got %s (len=%d)\n", szExpectUrl, dwExpectLen, SUCCEEDED(hr) ? szReturnUrl : "(null)", dwSize);
}
else
{
ok(dwSize == dwExpectLen, "Got length %d, expected %d\n", dwSize, dwExpectLen);
if (SUCCEEDED(hr))
ok(strcmp(szReturnUrl, szExpectUrl)==0, "Expected %s, but got %s\n", szExpectUrl, szReturnUrl);
}
if (pUrlCombineW) {
dwSize = 0;
hr = pUrlCombineW(wszUrl1, wszUrl2, NULL, &dwSize, dwFlags);
ok(hr == E_POINTER, "Checking length of string, return was 0x%08x, expected 0x%08x\n", hr, E_POINTER);
ok(dwSize == dwExpectLen+1, "Got length %d, expected %d\n", dwSize, dwExpectLen+1);
ok(todo || dwSize == dwExpectLen+1, "Got length %d, expected %d\n", dwSize, dwExpectLen+1);
dwSize--;
hr = pUrlCombineW(wszUrl1, wszUrl2, wszReturnUrl, &dwSize, dwFlags);
ok(hr == E_POINTER, "UrlCombineW returned 0x%08x, expected 0x%08x\n", hr, E_POINTER);
ok(dwSize == dwExpectLen+1, "Got length %d, expected %d\n", dwSize, dwExpectLen+1);
ok(todo || dwSize == dwExpectLen+1, "Got length %d, expected %d\n", dwSize, dwExpectLen+1);
hr = pUrlCombineW(wszUrl1, wszUrl2, wszReturnUrl, &dwSize, dwFlags);
ok(hr == dwExpectReturn, "UrlCombineW returned 0x%08x, expected 0x%08x\n", hr, dwExpectReturn);
ok(dwSize == dwExpectLen, "Got length %d, expected %d\n", dwSize, dwExpectLen);
ok(todo || dwSize == dwExpectLen, "Got length %d, expected %d\n", dwSize, dwExpectLen);
if(SUCCEEDED(hr)) {
wszConvertedUrl = GetWideString(szReturnUrl);
ok(lstrcmpW(wszReturnUrl, wszConvertedUrl)==0, "Strings didn't match between ascii and unicode UrlCombine!\n");
@ -1262,7 +1295,7 @@ static void test_UrlCombine(void)
unsigned int i;
for(i=0; i<sizeof(TEST_COMBINE)/sizeof(TEST_COMBINE[0]); i++) {
test_url_combine(TEST_COMBINE[i].url1, TEST_COMBINE[i].url2, TEST_COMBINE[i].flags,
TEST_COMBINE[i].expectret, TEST_COMBINE[i].expecturl);
TEST_COMBINE[i].expectret, TEST_COMBINE[i].expecturl, TEST_COMBINE[i].todo);
}
}