mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-26 19:33:31 +00:00
[SHLWAPI_WINETEST] Sync to wine-10.0 (#8303)
- [SHLWAPI_WINETEST] Sync to wine-10.0
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
|
||||
add_definitions(-D__ROS_LONG64__)
|
||||
include_directories(BEFORE ${REACTOS_SOURCE_DIR}/sdk/include/wine)
|
||||
remove_definitions(-DWINVER=0x502 -D_WIN32_WINNT=0x502)
|
||||
add_definitions(-DWINVER=0x0600 -D_WIN32_WINNT=0x0600 -DNTDDI_VERSION=0x06000100)
|
||||
|
||||
add_definitions(
|
||||
-DUSE_WINE_TODOS
|
||||
-DWINETEST_USE_DBGSTR_LONGLONG)
|
||||
-DWINETEST_USE_DBGSTR_LONGLONG
|
||||
-Dstrdup=_strdup)
|
||||
|
||||
list(APPEND SOURCE
|
||||
assoc.c
|
||||
@@ -30,6 +34,18 @@ add_importlibs(shlwapi_winetest shlwapi shell32 mlang oleaut32 ole32 user32 adva
|
||||
|
||||
if(MSVC)
|
||||
add_importlibs(shlwapi_winetest ntdll)
|
||||
target_compile_options(shlwapi_winetest PRIVATE
|
||||
/wd4113
|
||||
/wd4028
|
||||
/utf-8)
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
|
||||
CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_compile_options(shlwapi_winetest PRIVATE
|
||||
-Wno-format
|
||||
-Wno-discarded-qualifiers
|
||||
-Wno-incompatible-pointer-types)
|
||||
endif()
|
||||
|
||||
add_pch(shlwapi_winetest precomp.h "${PCH_SKIP_SOURCE}")
|
||||
|
||||
@@ -23,20 +23,14 @@
|
||||
#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))
|
||||
#define expect(expected, got) ok ( expected == got, "Expected %ld, got %ld\n", expected, got)
|
||||
#define expect_hr(expected, got) ok ( expected == got, "Expected %08lx, got %08lx\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 };
|
||||
static const WCHAR badBad[] = { 'b','a','d','b','a','d',0 };
|
||||
static const WCHAR dotBad[] = { '.','b','a','d',0 };
|
||||
static const WCHAR open[] = { 'o','p','e','n',0 };
|
||||
static const WCHAR invalid[] = { 'i','n','v','a','l','i','d',0 };
|
||||
/* Should every version of Windows with IE have .html association? */
|
||||
|
||||
static void test_getstring_bad(void)
|
||||
{
|
||||
@@ -52,75 +46,75 @@ static void test_getstring_bad(void)
|
||||
}
|
||||
|
||||
len = 0xdeadbeef;
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, NULL, open, NULL, &len);
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, NULL, L"open", NULL, &len);
|
||||
expect_hr(E_INVALIDARG, hr);
|
||||
ok(len == 0xdeadbeef, "got %u\n", len);
|
||||
ok(len == 0xdeadbeef, "got %lu\n", len);
|
||||
|
||||
len = 0xdeadbeef;
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, badBad, open, NULL, &len);
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, L"badbad", L"open", NULL, &len);
|
||||
ok(hr == E_FAIL ||
|
||||
hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
|
||||
"Unexpected result : %08x\n", hr);
|
||||
ok(len == 0xdeadbeef, "got %u\n", len);
|
||||
"Unexpected result : %08lx\n", hr);
|
||||
ok(len == 0xdeadbeef, "got %lu\n", len);
|
||||
|
||||
len = ARRAY_SIZE(buf);
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotBad, open, buf, &len);
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, L".bad", L"open", buf, &len);
|
||||
ok(hr == E_FAIL ||
|
||||
hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ ||
|
||||
hr == S_OK /* Win8 */,
|
||||
"Unexpected result : %08x\n", hr);
|
||||
"Unexpected result : %08lx\n", hr);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
ok(len < ARRAY_SIZE(buf), "got %u\n", len);
|
||||
ok(len < ARRAY_SIZE(buf), "got %lu\n", len);
|
||||
ok(!lstrcmpiW(buf + len - ARRAY_SIZE(openwith), openwith), "wrong data\n");
|
||||
}
|
||||
|
||||
len = 0xdeadbeef;
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotHtml, invalid, NULL, &len);
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, L".html", L"invalid", NULL, &len);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
|
||||
hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
|
||||
"Unexpected result : %08x\n", hr);
|
||||
ok(len == 0xdeadbeef, "got %u\n", len);
|
||||
"Unexpected result : %08lx\n", hr);
|
||||
ok(len == 0xdeadbeef, "got %lu\n", len);
|
||||
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotHtml, open, NULL, NULL);
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, L".html", L"open", NULL, NULL);
|
||||
ok(hr == E_UNEXPECTED ||
|
||||
hr == E_INVALIDARG, /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
|
||||
"Unexpected result : %08x\n", hr);
|
||||
"Unexpected result : %08lx\n", hr);
|
||||
|
||||
len = 0xdeadbeef;
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, NULL, open, NULL, &len);
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, NULL, L"open", NULL, &len);
|
||||
expect_hr(E_INVALIDARG, hr);
|
||||
ok(len == 0xdeadbeef, "got %u\n", len);
|
||||
ok(len == 0xdeadbeef, "got %lu\n", len);
|
||||
|
||||
len = 0xdeadbeef;
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, badBad, open, NULL, &len);
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, L"badbad", L"open", NULL, &len);
|
||||
ok(hr == E_FAIL ||
|
||||
hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
|
||||
"Unexpected result : %08x\n", hr);
|
||||
ok(len == 0xdeadbeef, "got %u\n", len);
|
||||
"Unexpected result : %08lx\n", hr);
|
||||
ok(len == 0xdeadbeef, "got %lu\n", len);
|
||||
|
||||
len = 0xdeadbeef;
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotBad, open, NULL, &len);
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, L".bad", L"open", NULL, &len);
|
||||
ok(hr == E_FAIL ||
|
||||
hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ ||
|
||||
hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND) /* Win8 */ ||
|
||||
hr == S_FALSE, /* Win10 */
|
||||
"Unexpected result : %08x\n", hr);
|
||||
"Unexpected result : %08lx\n", hr);
|
||||
ok((hr == S_FALSE && len < ARRAY_SIZE(buf)) || len == 0xdeadbeef,
|
||||
"got hr=%08x and len=%u\n", hr, len);
|
||||
"got hr=%08lx and len=%lu\n", hr, len);
|
||||
|
||||
len = 0xdeadbeef;
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotHtml, invalid, NULL, &len);
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, L".html", L"invalid", NULL, &len);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
|
||||
hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) || /* W2K/Vista/W2K8 */
|
||||
hr == E_FAIL, /* Win9x/WinMe/NT4 */
|
||||
"Unexpected result : %08x\n", hr);
|
||||
ok(len == 0xdeadbeef, "got %u\n", len);
|
||||
"Unexpected result : %08lx\n", hr);
|
||||
ok(len == 0xdeadbeef, "got %lu\n", len);
|
||||
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotHtml, open, NULL, NULL);
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, L".html", L"open", NULL, NULL);
|
||||
ok(hr == E_UNEXPECTED ||
|
||||
hr == E_INVALIDARG, /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
|
||||
"Unexpected result : %08x\n", hr);
|
||||
"Unexpected result : %08lx\n", hr);
|
||||
}
|
||||
|
||||
static void test_getstring_basic(void)
|
||||
@@ -136,7 +130,7 @@ static void test_getstring_basic(void)
|
||||
return;
|
||||
}
|
||||
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotHtml, open, NULL, &len);
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, L".html", L"open", NULL, &len);
|
||||
expect_hr(S_FALSE, hr);
|
||||
if (hr != S_FALSE)
|
||||
{
|
||||
@@ -153,19 +147,19 @@ static void test_getstring_basic(void)
|
||||
}
|
||||
|
||||
len2 = len;
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotHtml, open,
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, L".html", L"open",
|
||||
executableName, &len2);
|
||||
expect_hr(S_OK, hr);
|
||||
slen = lstrlenW(executableName) + 1;
|
||||
expect(len, len2);
|
||||
expect(len, slen);
|
||||
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotHtml, open, NULL,
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, L".html", L"open", NULL,
|
||||
&len);
|
||||
ok(hr == S_FALSE ||
|
||||
hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) /* Win9x/NT4 */ ||
|
||||
hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), /* Win8 */
|
||||
"Unexpected result : %08x\n", hr);
|
||||
"Unexpected result : %08lx\n", hr);
|
||||
if (hr != S_FALSE)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, executableName);
|
||||
@@ -183,7 +177,7 @@ static void test_getstring_basic(void)
|
||||
}
|
||||
|
||||
len2 = len;
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotHtml, open,
|
||||
hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, L".html", L"open",
|
||||
friendlyName, &len2);
|
||||
expect_hr(S_OK, hr);
|
||||
slen = lstrlenW(friendlyName) + 1;
|
||||
@@ -256,7 +250,7 @@ static void test_getstring_no_extra(void)
|
||||
hr = pAssocQueryStringA(0, ASSOCSTR_EXECUTABLE, dotWinetest, NULL, buf, &len);
|
||||
ok(hr == S_OK ||
|
||||
hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP and W2K3 */
|
||||
"Unexpected result : %08x\n", hr);
|
||||
"Unexpected result : %08lx\n", hr);
|
||||
hr = pAssocQueryStringA(0, ASSOCSTR_EXECUTABLE, dotWinetest, "foo", buf, &len);
|
||||
expect_hr(S_OK, hr);
|
||||
ok(strstr(buf, action) != NULL,
|
||||
@@ -280,19 +274,19 @@ static void test_assoc_create(void)
|
||||
}
|
||||
|
||||
hr = pAssocCreate(IID_NULL, &IID_NULL, NULL);
|
||||
ok(hr == E_INVALIDARG, "Unexpected result : %08x\n", hr);
|
||||
ok(hr == E_INVALIDARG, "Unexpected result : %08lx\n", hr);
|
||||
|
||||
hr = pAssocCreate(CLSID_QueryAssociations, &IID_NULL, (LPVOID*)&pqa);
|
||||
ok(hr == CLASS_E_CLASSNOTAVAILABLE || hr == E_NOTIMPL || hr == E_NOINTERFACE
|
||||
, "Unexpected result : %08x\n", hr);
|
||||
, "Unexpected result : %08lx\n", hr);
|
||||
|
||||
hr = pAssocCreate(IID_NULL, &IID_IQueryAssociations, (LPVOID*)&pqa);
|
||||
ok(hr == CLASS_E_CLASSNOTAVAILABLE || hr == E_NOTIMPL || hr == E_INVALIDARG
|
||||
, "Unexpected result : %08x\n", hr);
|
||||
, "Unexpected result : %08lx\n", hr);
|
||||
|
||||
hr = pAssocCreate(CLSID_QueryAssociations, &IID_IQueryAssociations, (LPVOID*)&pqa);
|
||||
ok(hr == S_OK || hr == E_NOTIMPL /* win98 */
|
||||
, "Unexpected result : %08x\n", hr);
|
||||
, "Unexpected result : %08lx\n", hr);
|
||||
if(hr == S_OK)
|
||||
{
|
||||
IQueryAssociations_Release(pqa);
|
||||
@@ -300,290 +294,13 @@ static void test_assoc_create(void)
|
||||
|
||||
hr = pAssocCreate(CLSID_QueryAssociations, &IID_IUnknown, (LPVOID*)&pqa);
|
||||
ok(hr == S_OK || hr == E_NOTIMPL /* win98 */
|
||||
, "Unexpected result : %08x\n", hr);
|
||||
, "Unexpected result : %08lx\n", hr);
|
||||
if(hr == S_OK)
|
||||
{
|
||||
IQueryAssociations_Release(pqa);
|
||||
}
|
||||
}
|
||||
|
||||
/* 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;
|
||||
@@ -591,11 +308,9 @@ 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();
|
||||
}
|
||||
|
||||
@@ -24,17 +24,10 @@
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "objbase.h"
|
||||
|
||||
typedef struct tagSHLWAPI_CLIST
|
||||
{
|
||||
ULONG ulSize;
|
||||
ULONG ulId;
|
||||
} SHLWAPI_CLIST, *LPSHLWAPI_CLIST;
|
||||
|
||||
typedef const SHLWAPI_CLIST* LPCSHLWAPI_CLIST;
|
||||
#include "shlobj.h"
|
||||
|
||||
/* Items to add */
|
||||
static const SHLWAPI_CLIST SHLWAPI_CLIST_items[] =
|
||||
static const DATABLOCK_HEADER clist_items[] =
|
||||
{
|
||||
{4, 1},
|
||||
{8, 3},
|
||||
@@ -66,7 +59,7 @@ struct dummystream
|
||||
int seekcalls;
|
||||
int statcalls;
|
||||
BOOL failstatcall;
|
||||
LPCSHLWAPI_CLIST item;
|
||||
const DATABLOCK_HEADER *item;
|
||||
ULARGE_INTEGER pos;
|
||||
};
|
||||
|
||||
@@ -126,7 +119,7 @@ static HRESULT WINAPI Read(IStream *iface, void *lpMem, ULONG ulSize, ULONG *lpR
|
||||
if (ulSize == sizeof(ULONG))
|
||||
{
|
||||
/* Read size of item */
|
||||
*((ULONG*)lpMem) = This->item->ulSize ? This->item->ulSize + sizeof(SHLWAPI_CLIST) : 0;
|
||||
*((ULONG*)lpMem) = This->item->cbSize ? This->item->cbSize + sizeof(DATABLOCK_HEADER) : 0;
|
||||
*lpRead = ulSize;
|
||||
}
|
||||
else
|
||||
@@ -135,16 +128,16 @@ static HRESULT WINAPI Read(IStream *iface, void *lpMem, ULONG ulSize, ULONG *lpR
|
||||
char* buff = lpMem;
|
||||
|
||||
/* Read item data */
|
||||
if (!This->item->ulSize)
|
||||
if (!This->item->cbSize)
|
||||
{
|
||||
This->readbeyondend = TRUE;
|
||||
*lpRead = 0;
|
||||
return E_FAIL; /* Should never happen */
|
||||
}
|
||||
*((ULONG*)lpMem) = This->item->ulId;
|
||||
*((ULONG *)lpMem) = This->item->dwSignature;
|
||||
*lpRead = ulSize;
|
||||
|
||||
for (i = 0; i < This->item->ulSize; i++)
|
||||
for (i = 0; i < This->item->cbSize; i++)
|
||||
buff[4+i] = i*2;
|
||||
|
||||
This->item++;
|
||||
@@ -217,18 +210,18 @@ static IStreamVtbl iclvt =
|
||||
/* Function ptrs for ordinal calls */
|
||||
static HMODULE SHLWAPI_hshlwapi = 0;
|
||||
|
||||
static VOID (WINAPI *pSHLWAPI_19)(LPSHLWAPI_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*);
|
||||
static HRESULT (WINAPI *pSHLWAPI_18)(IStream*, SHLWAPI_CLIST**);
|
||||
static void (WINAPI *pSHFreeDataBlockList)(DATABLOCK_HEADER *);
|
||||
static HRESULT (WINAPI *pSHAddDataBlock)(DATABLOCK_HEADER **, DATABLOCK_HEADER *);
|
||||
static BOOL (WINAPI *pSHRemoveDataBlock)(DATABLOCK_HEADER **,ULONG);
|
||||
static DATABLOCK_HEADER *(WINAPI *pSHFindDataBlock)(DATABLOCK_HEADER *,ULONG);
|
||||
static HRESULT (WINAPI *pSHWriteDataBlockList)(IStream *, DATABLOCK_HEADER *);
|
||||
static HRESULT (WINAPI *pSHReadDataBlockList)(IStream *, DATABLOCK_HEADER **);
|
||||
|
||||
static BOOL (WINAPI *pSHLWAPI_166)(IStream*);
|
||||
static HRESULT (WINAPI *pSHLWAPI_184)(IStream*, void*, ULONG);
|
||||
static HRESULT (WINAPI *pSHLWAPI_212)(IStream*, const void*, ULONG);
|
||||
static HRESULT (WINAPI *pSHLWAPI_213)(IStream*);
|
||||
static HRESULT (WINAPI *pSHLWAPI_214)(IStream*, ULARGE_INTEGER*);
|
||||
static BOOL (WINAPI *pSHIsEmptyStream)(IStream *);
|
||||
static HRESULT (WINAPI *pIStream_Read)(IStream *, void *, ULONG);
|
||||
static HRESULT (WINAPI *pIStream_Write)(IStream *, const void *, ULONG);
|
||||
static HRESULT (WINAPI *pIStream_Reset)(IStream *);
|
||||
static HRESULT (WINAPI *pIStream_Size)(IStream *, ULARGE_INTEGER *);
|
||||
|
||||
|
||||
static BOOL InitFunctionPtrs(void)
|
||||
@@ -241,28 +234,28 @@ static BOOL InitFunctionPtrs(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pSHLWAPI_17 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)17);
|
||||
ok(pSHLWAPI_17 != 0, "No Ordinal 17\n");
|
||||
pSHLWAPI_18 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)18);
|
||||
ok(pSHLWAPI_18 != 0, "No Ordinal 18\n");
|
||||
pSHLWAPI_19 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)19);
|
||||
ok(pSHLWAPI_19 != 0, "No Ordinal 19\n");
|
||||
pSHLWAPI_20 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)20);
|
||||
ok(pSHLWAPI_20 != 0, "No Ordinal 20\n");
|
||||
pSHLWAPI_21 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)21);
|
||||
ok(pSHLWAPI_21 != 0, "No Ordinal 21\n");
|
||||
pSHLWAPI_22 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)22);
|
||||
ok(pSHLWAPI_22 != 0, "No Ordinal 22\n");
|
||||
pSHLWAPI_166 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)166);
|
||||
ok(pSHLWAPI_166 != 0, "No Ordinal 166\n");
|
||||
pSHLWAPI_184 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)184);
|
||||
ok(pSHLWAPI_184 != 0, "No Ordinal 184\n");
|
||||
pSHLWAPI_212 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)212);
|
||||
ok(pSHLWAPI_212 != 0, "No Ordinal 212\n");
|
||||
pSHLWAPI_213 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)213);
|
||||
ok(pSHLWAPI_213 != 0, "No Ordinal 213\n");
|
||||
pSHLWAPI_214 = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)214);
|
||||
ok(pSHLWAPI_214 != 0, "No Ordinal 214\n");
|
||||
pSHWriteDataBlockList = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)17);
|
||||
ok(pSHWriteDataBlockList != 0, "No Ordinal 17\n");
|
||||
pSHReadDataBlockList = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)18);
|
||||
ok(pSHReadDataBlockList != 0, "No Ordinal 18\n");
|
||||
pSHFreeDataBlockList = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)19);
|
||||
ok(pSHFreeDataBlockList != 0, "No Ordinal 19\n");
|
||||
pSHAddDataBlock = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)20);
|
||||
ok(pSHAddDataBlock != 0, "No Ordinal 20\n");
|
||||
pSHRemoveDataBlock = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)21);
|
||||
ok(pSHRemoveDataBlock != 0, "No Ordinal 21\n");
|
||||
pSHFindDataBlock = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)22);
|
||||
ok(pSHFindDataBlock != 0, "No Ordinal 22\n");
|
||||
pSHIsEmptyStream = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)166);
|
||||
ok(pSHIsEmptyStream != 0, "No Ordinal 166\n");
|
||||
pIStream_Read = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)184);
|
||||
ok(pIStream_Read != 0, "No Ordinal 184\n");
|
||||
pIStream_Write = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)212);
|
||||
ok(pIStream_Write != 0, "No Ordinal 212\n");
|
||||
pIStream_Reset = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)213);
|
||||
ok(pIStream_Reset != 0, "No Ordinal 213\n");
|
||||
pIStream_Size = (void *)GetProcAddress( SHLWAPI_hshlwapi, (LPSTR)214);
|
||||
ok(pIStream_Size != 0, "No Ordinal 214\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -282,7 +275,7 @@ static void InitDummyStream(struct dummystream *obj)
|
||||
obj->seekcalls = 0;
|
||||
obj->statcalls = 0;
|
||||
obj->failstatcall = FALSE;
|
||||
obj->item = SHLWAPI_CLIST_items;
|
||||
obj->item = clist_items;
|
||||
obj->pos.QuadPart = 0;
|
||||
}
|
||||
|
||||
@@ -290,67 +283,65 @@ static void InitDummyStream(struct dummystream *obj)
|
||||
static void test_CList(void)
|
||||
{
|
||||
struct dummystream streamobj;
|
||||
LPSHLWAPI_CLIST list = NULL;
|
||||
LPCSHLWAPI_CLIST item = SHLWAPI_CLIST_items;
|
||||
BOOL bRet;
|
||||
DATABLOCK_HEADER *list = NULL;
|
||||
const DATABLOCK_HEADER *item = clist_items;
|
||||
HRESULT hRet;
|
||||
LPSHLWAPI_CLIST inserted;
|
||||
DATABLOCK_HEADER *inserted;
|
||||
BYTE buff[64];
|
||||
unsigned int i;
|
||||
BOOL ret;
|
||||
|
||||
if (!pSHLWAPI_17 || !pSHLWAPI_18 || !pSHLWAPI_19 || !pSHLWAPI_20 ||
|
||||
!pSHLWAPI_21 || !pSHLWAPI_22)
|
||||
if (!pSHWriteDataBlockList || !pSHReadDataBlockList || !pSHFreeDataBlockList || !pSHAddDataBlock ||
|
||||
!pSHRemoveDataBlock || !pSHFindDataBlock)
|
||||
return;
|
||||
|
||||
/* Populate a list and test the items are added correctly */
|
||||
while (item->ulSize)
|
||||
while (item->cbSize)
|
||||
{
|
||||
/* Create item and fill with data */
|
||||
inserted = (LPSHLWAPI_CLIST)buff;
|
||||
inserted->ulSize = item->ulSize + sizeof(SHLWAPI_CLIST);
|
||||
inserted->ulId = item->ulId;
|
||||
for (i = 0; i < item->ulSize; i++)
|
||||
buff[sizeof(SHLWAPI_CLIST)+i] = i*2;
|
||||
inserted = (DATABLOCK_HEADER *)buff;
|
||||
inserted->cbSize = item->cbSize + sizeof(DATABLOCK_HEADER);
|
||||
inserted->dwSignature = item->dwSignature;
|
||||
for (i = 0; i < item->cbSize; i++)
|
||||
buff[sizeof(DATABLOCK_HEADER) + i] = i * 2;
|
||||
|
||||
/* Add it */
|
||||
bRet = pSHLWAPI_20(&list, inserted);
|
||||
ok(bRet == TRUE, "failed list add\n");
|
||||
ret = pSHAddDataBlock(&list, inserted);
|
||||
ok(ret == TRUE, "got %d\n", ret);
|
||||
|
||||
if (bRet == TRUE)
|
||||
if (ret == TRUE)
|
||||
{
|
||||
ok(list && list->ulSize, "item not added\n");
|
||||
ok(list && list->cbSize, "item not added\n");
|
||||
|
||||
/* Find it */
|
||||
inserted = pSHLWAPI_22(list, item->ulId);
|
||||
inserted = pSHFindDataBlock(list, item->dwSignature);
|
||||
ok(inserted != NULL, "lost after adding\n");
|
||||
|
||||
ok(!inserted || inserted->ulId != ~0U, "find returned a container\n");
|
||||
ok(!inserted || inserted->dwSignature != ~0U, "find returned a container\n");
|
||||
|
||||
/* Check size */
|
||||
if (inserted && inserted->ulSize & 0x3)
|
||||
if (inserted && (inserted->cbSize & 0x3))
|
||||
{
|
||||
/* Contained */
|
||||
ok(inserted[-1].ulId == ~0U, "invalid size is not countained\n");
|
||||
ok(inserted[-1].ulSize > inserted->ulSize+sizeof(SHLWAPI_CLIST),
|
||||
ok(inserted[-1].dwSignature == ~0U, "invalid size is not countained\n");
|
||||
ok(inserted[-1].cbSize > inserted->cbSize + sizeof(DATABLOCK_HEADER),
|
||||
"container too small\n");
|
||||
}
|
||||
else if (inserted)
|
||||
{
|
||||
ok(inserted->ulSize==item->ulSize+sizeof(SHLWAPI_CLIST),
|
||||
"id %d wrong size %d\n", inserted->ulId, inserted->ulSize);
|
||||
ok(inserted->cbSize == item->cbSize + sizeof(DATABLOCK_HEADER),
|
||||
"id %ld wrong size %ld\n", inserted->dwSignature, inserted->cbSize);
|
||||
}
|
||||
if (inserted)
|
||||
{
|
||||
BOOL bDataOK = TRUE;
|
||||
LPBYTE bufftest = (LPBYTE)inserted;
|
||||
|
||||
for (i = 0; i < inserted->ulSize - sizeof(SHLWAPI_CLIST); i++)
|
||||
if (bufftest[sizeof(SHLWAPI_CLIST)+i] != i*2)
|
||||
for (i = 0; i < inserted->cbSize - sizeof(DATABLOCK_HEADER); i++)
|
||||
if (bufftest[sizeof(DATABLOCK_HEADER) + i] != i * 2)
|
||||
bDataOK = FALSE;
|
||||
|
||||
ok(bDataOK == TRUE, "data corrupted on insert\n");
|
||||
}
|
||||
ok(!inserted || inserted->ulId==item->ulId, "find got wrong item\n");
|
||||
ok(!inserted || inserted->dwSignature == item->dwSignature, "find got wrong item\n");
|
||||
}
|
||||
item++;
|
||||
}
|
||||
@@ -358,12 +349,12 @@ static void test_CList(void)
|
||||
/* Write the list */
|
||||
InitDummyStream(&streamobj);
|
||||
|
||||
hRet = pSHLWAPI_17(&streamobj.IStream_iface, list);
|
||||
hRet = pSHWriteDataBlockList(&streamobj.IStream_iface, list);
|
||||
ok(hRet == S_OK, "write failed\n");
|
||||
if (hRet == S_OK)
|
||||
{
|
||||
/* 1 call for each element, + 1 for OK (use our null element for this) */
|
||||
ok(streamobj.writecalls == ARRAY_SIZE(SHLWAPI_CLIST_items), "wrong call count\n");
|
||||
ok(streamobj.writecalls == ARRAY_SIZE(clist_items), "wrong call count\n");
|
||||
ok(streamobj.readcalls == 0,"called Read() in write\n");
|
||||
ok(streamobj.seekcalls == 0,"called Seek() in write\n");
|
||||
}
|
||||
@@ -371,7 +362,7 @@ static void test_CList(void)
|
||||
/* Failure cases for writing */
|
||||
InitDummyStream(&streamobj);
|
||||
streamobj.failwritecall = TRUE;
|
||||
hRet = pSHLWAPI_17(&streamobj.IStream_iface, list);
|
||||
hRet = pSHWriteDataBlockList(&streamobj.IStream_iface, list);
|
||||
ok(hRet == STG_E_ACCESSDENIED, "changed object failure return\n");
|
||||
ok(streamobj.writecalls == 1, "called object after failure\n");
|
||||
ok(streamobj.readcalls == 0,"called Read() after failure\n");
|
||||
@@ -379,7 +370,7 @@ static void test_CList(void)
|
||||
|
||||
InitDummyStream(&streamobj);
|
||||
streamobj.failwritesize = TRUE;
|
||||
hRet = pSHLWAPI_17(&streamobj.IStream_iface, list);
|
||||
hRet = pSHWriteDataBlockList(&streamobj.IStream_iface, list);
|
||||
ok(hRet == STG_E_MEDIUMFULL || broken(hRet == E_FAIL) /* Win7 */,
|
||||
"changed size failure return\n");
|
||||
ok(streamobj.writecalls == 1, "called object after size failure\n");
|
||||
@@ -387,83 +378,87 @@ static void test_CList(void)
|
||||
ok(streamobj.seekcalls == 0,"called Seek() after failure\n");
|
||||
|
||||
/* Invalid inputs for adding */
|
||||
inserted = (LPSHLWAPI_CLIST)buff;
|
||||
inserted->ulSize = sizeof(SHLWAPI_CLIST) -1;
|
||||
inserted->ulId = 33;
|
||||
bRet = pSHLWAPI_20(&list, inserted);
|
||||
ok(bRet == FALSE, "Expected failure\n");
|
||||
inserted = (DATABLOCK_HEADER *)buff;
|
||||
inserted->cbSize = sizeof(DATABLOCK_HEADER) - 1;
|
||||
inserted->dwSignature = 33;
|
||||
|
||||
inserted = pSHLWAPI_22(list, 33);
|
||||
ret = pSHAddDataBlock(NULL, inserted);
|
||||
ok(!ret, "got %d\n", ret);
|
||||
|
||||
ret = pSHAddDataBlock(&list, inserted);
|
||||
ok(!ret, "got %d\n", ret);
|
||||
|
||||
inserted = pSHFindDataBlock(list, 33);
|
||||
ok(inserted == NULL, "inserted bad element size\n");
|
||||
|
||||
inserted = (LPSHLWAPI_CLIST)buff;
|
||||
inserted->ulSize = 44;
|
||||
inserted->ulId = ~0U;
|
||||
bRet = pSHLWAPI_20(&list, inserted);
|
||||
ok(bRet == FALSE, "Expected failure\n");
|
||||
inserted = (DATABLOCK_HEADER *)buff;
|
||||
inserted->cbSize = 44;
|
||||
inserted->dwSignature = ~0U;
|
||||
|
||||
item = SHLWAPI_CLIST_items;
|
||||
ret = pSHAddDataBlock(&list, inserted);
|
||||
ok(!ret, "got %d\n", ret);
|
||||
|
||||
item = clist_items;
|
||||
|
||||
/* Look for nonexistent item in populated list */
|
||||
inserted = pSHLWAPI_22(list, 99999999);
|
||||
inserted = pSHFindDataBlock(list, 99999999);
|
||||
ok(inserted == NULL, "found a nonexistent item\n");
|
||||
|
||||
while (item->ulSize)
|
||||
while (item->cbSize)
|
||||
{
|
||||
/* Delete items */
|
||||
BOOL bRet = pSHLWAPI_21(&list, item->ulId);
|
||||
BOOL bRet = pSHRemoveDataBlock(&list, item->dwSignature);
|
||||
ok(bRet == TRUE, "couldn't find item to delete\n");
|
||||
item++;
|
||||
}
|
||||
|
||||
/* Look for nonexistent item in empty list */
|
||||
inserted = pSHLWAPI_22(list, 99999999);
|
||||
inserted = pSHFindDataBlock(list, 99999999);
|
||||
ok(inserted == NULL, "found an item in empty list\n");
|
||||
|
||||
/* Create a list by reading in data */
|
||||
InitDummyStream(&streamobj);
|
||||
|
||||
hRet = pSHLWAPI_18(&streamobj.IStream_iface, &list);
|
||||
hRet = pSHReadDataBlockList(&streamobj.IStream_iface, &list);
|
||||
ok(hRet == S_OK, "failed create from Read()\n");
|
||||
if (hRet == S_OK)
|
||||
{
|
||||
ok(streamobj.readbeyondend == FALSE, "read beyond end\n");
|
||||
/* 2 calls per item, but only 1 for the terminator */
|
||||
ok(streamobj.readcalls == ARRAY_SIZE(SHLWAPI_CLIST_items) * 2 - 1, "wrong call count\n");
|
||||
ok(streamobj.readcalls == ARRAY_SIZE(clist_items) * 2 - 1, "wrong call count\n");
|
||||
ok(streamobj.writecalls == 0, "called Write() from create\n");
|
||||
ok(streamobj.seekcalls == 0,"called Seek() from create\n");
|
||||
|
||||
item = SHLWAPI_CLIST_items;
|
||||
item = clist_items;
|
||||
|
||||
/* Check the items were added correctly */
|
||||
while (item->ulSize)
|
||||
while (item->cbSize)
|
||||
{
|
||||
inserted = pSHLWAPI_22(list, item->ulId);
|
||||
inserted = pSHFindDataBlock(list, item->dwSignature);
|
||||
ok(inserted != NULL, "lost after adding\n");
|
||||
|
||||
ok(!inserted || inserted->ulId != ~0U, "find returned a container\n");
|
||||
ok(!inserted || inserted->dwSignature != ~0U, "find returned a container\n");
|
||||
|
||||
/* Check size */
|
||||
if (inserted && inserted->ulSize & 0x3)
|
||||
if (inserted && inserted->cbSize & 0x3)
|
||||
{
|
||||
/* Contained */
|
||||
ok(inserted[-1].ulId == ~0U, "invalid size is not countained\n");
|
||||
ok(inserted[-1].ulSize > inserted->ulSize+sizeof(SHLWAPI_CLIST),
|
||||
ok(inserted[-1].dwSignature == ~0U, "invalid size is not countained\n");
|
||||
ok(inserted[-1].cbSize > inserted->cbSize + sizeof(DATABLOCK_HEADER),
|
||||
"container too small\n");
|
||||
}
|
||||
else if (inserted)
|
||||
{
|
||||
ok(inserted->ulSize==item->ulSize+sizeof(SHLWAPI_CLIST),
|
||||
"id %d wrong size %d\n", inserted->ulId, inserted->ulSize);
|
||||
ok(inserted->cbSize == item->cbSize + sizeof(DATABLOCK_HEADER),
|
||||
"id %ld wrong size %ld\n", inserted->dwSignature, inserted->cbSize);
|
||||
}
|
||||
ok(!inserted || inserted->ulId==item->ulId, "find got wrong item\n");
|
||||
ok(!inserted || inserted->dwSignature == item->dwSignature, "find got wrong item\n");
|
||||
if (inserted)
|
||||
{
|
||||
BOOL bDataOK = TRUE;
|
||||
LPBYTE bufftest = (LPBYTE)inserted;
|
||||
|
||||
for (i = 0; i < inserted->ulSize - sizeof(SHLWAPI_CLIST); i++)
|
||||
if (bufftest[sizeof(SHLWAPI_CLIST)+i] != i*2)
|
||||
for (i = 0; i < inserted->cbSize - sizeof(DATABLOCK_HEADER); i++)
|
||||
if (bufftest[sizeof(DATABLOCK_HEADER) + i] != i * 2)
|
||||
bDataOK = FALSE;
|
||||
|
||||
ok(bDataOK == TRUE, "data corrupted on insert\n");
|
||||
@@ -475,7 +470,7 @@ static void test_CList(void)
|
||||
/* Failure cases for reading */
|
||||
InitDummyStream(&streamobj);
|
||||
streamobj.failreadcall = TRUE;
|
||||
hRet = pSHLWAPI_18(&streamobj.IStream_iface, &list);
|
||||
hRet = pSHReadDataBlockList(&streamobj.IStream_iface, &list);
|
||||
ok(hRet == STG_E_ACCESSDENIED, "changed object failure return\n");
|
||||
ok(streamobj.readbeyondend == FALSE, "read beyond end\n");
|
||||
ok(streamobj.readcalls == 1, "called object after read failure\n");
|
||||
@@ -485,26 +480,26 @@ static void test_CList(void)
|
||||
/* Read returns large object */
|
||||
InitDummyStream(&streamobj);
|
||||
streamobj.readreturnlarge = TRUE;
|
||||
hRet = pSHLWAPI_18(&streamobj.IStream_iface, &list);
|
||||
hRet = pSHReadDataBlockList(&streamobj.IStream_iface, &list);
|
||||
ok(hRet == S_OK, "failed create from Read() with large item\n");
|
||||
ok(streamobj.readbeyondend == FALSE, "read beyond end\n");
|
||||
ok(streamobj.readcalls == 1,"wrong call count\n");
|
||||
ok(streamobj.writecalls == 0,"called Write() after read failure\n");
|
||||
ok(streamobj.seekcalls == 2,"wrong Seek() call count (%d)\n", streamobj.seekcalls);
|
||||
|
||||
pSHLWAPI_19(list);
|
||||
pSHFreeDataBlockList(list);
|
||||
}
|
||||
|
||||
static BOOL test_SHLWAPI_166(void)
|
||||
static BOOL test_SHIsEmptyStream(void)
|
||||
{
|
||||
struct dummystream streamobj;
|
||||
BOOL bRet;
|
||||
|
||||
if (!pSHLWAPI_166)
|
||||
if (!pSHIsEmptyStream)
|
||||
return FALSE;
|
||||
|
||||
InitDummyStream(&streamobj);
|
||||
bRet = pSHLWAPI_166(&streamobj.IStream_iface);
|
||||
bRet = pSHIsEmptyStream(&streamobj.IStream_iface);
|
||||
|
||||
if (bRet != TRUE)
|
||||
return FALSE; /* This version doesn't support stream ops on clists */
|
||||
@@ -517,7 +512,7 @@ static BOOL test_SHLWAPI_166(void)
|
||||
streamobj.statcalls = 0;
|
||||
streamobj.pos.QuadPart = 50001;
|
||||
|
||||
bRet = pSHLWAPI_166(&streamobj.IStream_iface);
|
||||
bRet = pSHIsEmptyStream(&streamobj.IStream_iface);
|
||||
|
||||
ok(bRet == FALSE, "failed after seek adjusted\n");
|
||||
ok(streamobj.readcalls == 0, "called Read()\n");
|
||||
@@ -529,7 +524,7 @@ static BOOL test_SHLWAPI_166(void)
|
||||
InitDummyStream(&streamobj);
|
||||
streamobj.pos.QuadPart = 50001;
|
||||
streamobj.failstatcall = TRUE; /* 1: Stat() Bad, Read() OK */
|
||||
bRet = pSHLWAPI_166(&streamobj.IStream_iface);
|
||||
bRet = pSHIsEmptyStream(&streamobj.IStream_iface);
|
||||
ok(bRet == FALSE, "should be FALSE after read is OK\n");
|
||||
ok(streamobj.readcalls == 1, "wrong call count\n");
|
||||
ok(streamobj.writecalls == 0, "called Write()\n");
|
||||
@@ -541,7 +536,7 @@ static BOOL test_SHLWAPI_166(void)
|
||||
streamobj.pos.QuadPart = 50001;
|
||||
streamobj.failstatcall = TRUE;
|
||||
streamobj.failreadcall = TRUE; /* 2: Stat() Bad, Read() Bad Also */
|
||||
bRet = pSHLWAPI_166(&streamobj.IStream_iface);
|
||||
bRet = pSHIsEmptyStream(&streamobj.IStream_iface);
|
||||
ok(bRet == TRUE, "Should be true after read fails\n");
|
||||
ok(streamobj.readcalls == 1, "wrong call count\n");
|
||||
ok(streamobj.writecalls == 0, "called Write()\n");
|
||||
@@ -551,17 +546,17 @@ static BOOL test_SHLWAPI_166(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void test_SHLWAPI_184(void)
|
||||
static void test_IStream_Read(void)
|
||||
{
|
||||
struct dummystream streamobj;
|
||||
char buff[256];
|
||||
HRESULT hRet;
|
||||
|
||||
if (!pSHLWAPI_184)
|
||||
if (!pIStream_Read)
|
||||
return;
|
||||
|
||||
InitDummyStream(&streamobj);
|
||||
hRet = pSHLWAPI_184(&streamobj.IStream_iface, buff, sizeof(buff));
|
||||
hRet = pIStream_Read(&streamobj.IStream_iface, buff, sizeof(buff));
|
||||
|
||||
ok(hRet == S_OK, "failed Read()\n");
|
||||
ok(streamobj.readcalls == 1, "wrong call count\n");
|
||||
@@ -569,17 +564,17 @@ static void test_SHLWAPI_184(void)
|
||||
ok(streamobj.seekcalls == 0, "called Seek()\n");
|
||||
}
|
||||
|
||||
static void test_SHLWAPI_212(void)
|
||||
static void test_IStream_Write(void)
|
||||
{
|
||||
struct dummystream streamobj;
|
||||
char buff[256];
|
||||
char buff[256] = {0};
|
||||
HRESULT hRet;
|
||||
|
||||
if (!pSHLWAPI_212)
|
||||
if (!pIStream_Write)
|
||||
return;
|
||||
|
||||
InitDummyStream(&streamobj);
|
||||
hRet = pSHLWAPI_212(&streamobj.IStream_iface, buff, sizeof(buff));
|
||||
hRet = pIStream_Write(&streamobj.IStream_iface, buff, sizeof(buff));
|
||||
|
||||
ok(hRet == S_OK, "failed Write()\n");
|
||||
ok(streamobj.readcalls == 0, "called Read()\n");
|
||||
@@ -587,14 +582,14 @@ static void test_SHLWAPI_212(void)
|
||||
ok(streamobj.seekcalls == 0, "called Seek()\n");
|
||||
}
|
||||
|
||||
static void test_SHLWAPI_213(void)
|
||||
static void test_IStream_Reset(void)
|
||||
{
|
||||
struct dummystream streamobj;
|
||||
ULARGE_INTEGER ul;
|
||||
LARGE_INTEGER ll;
|
||||
HRESULT hRet;
|
||||
|
||||
if (!pSHLWAPI_213 || !pSHLWAPI_214)
|
||||
if (!pIStream_Reset || !pIStream_Size)
|
||||
return;
|
||||
|
||||
InitDummyStream(&streamobj);
|
||||
@@ -602,26 +597,26 @@ static void test_SHLWAPI_213(void)
|
||||
Seek(&streamobj.IStream_iface, ll, 0, NULL); /* Seek to 5000l */
|
||||
|
||||
streamobj.seekcalls = 0;
|
||||
pSHLWAPI_213(&streamobj.IStream_iface); /* Should rewind */
|
||||
pIStream_Reset(&streamobj.IStream_iface);
|
||||
ok(streamobj.statcalls == 0, "called Stat()\n");
|
||||
ok(streamobj.readcalls == 0, "called Read()\n");
|
||||
ok(streamobj.writecalls == 0, "called Write()\n");
|
||||
ok(streamobj.seekcalls == 1, "wrong call count\n");
|
||||
|
||||
ul.QuadPart = 50001;
|
||||
hRet = pSHLWAPI_214(&streamobj.IStream_iface, &ul);
|
||||
hRet = pIStream_Size(&streamobj.IStream_iface, &ul);
|
||||
ok(hRet == S_OK, "failed Stat()\n");
|
||||
ok(ul.QuadPart == 0, "213 didn't rewind stream\n");
|
||||
}
|
||||
|
||||
static void test_SHLWAPI_214(void)
|
||||
static void test_IStream_Size(void)
|
||||
{
|
||||
struct dummystream streamobj;
|
||||
ULARGE_INTEGER ul;
|
||||
LARGE_INTEGER ll;
|
||||
HRESULT hRet;
|
||||
|
||||
if (!pSHLWAPI_214)
|
||||
if (!pIStream_Size)
|
||||
return;
|
||||
|
||||
InitDummyStream(&streamobj);
|
||||
@@ -629,7 +624,7 @@ static void test_SHLWAPI_214(void)
|
||||
Seek(&streamobj.IStream_iface, ll, 0, NULL);
|
||||
ul.QuadPart = 0;
|
||||
streamobj.seekcalls = 0;
|
||||
hRet = pSHLWAPI_214(&streamobj.IStream_iface, &ul);
|
||||
hRet = pIStream_Size(&streamobj.IStream_iface, &ul);
|
||||
|
||||
ok(hRet == S_OK, "failed Stat()\n");
|
||||
ok(streamobj.statcalls == 1, "wrong call count\n");
|
||||
@@ -647,11 +642,11 @@ START_TEST(clist)
|
||||
test_CList();
|
||||
|
||||
/* Test streaming if this version supports it */
|
||||
if (test_SHLWAPI_166())
|
||||
if (test_SHIsEmptyStream())
|
||||
{
|
||||
test_SHLWAPI_184();
|
||||
test_SHLWAPI_212();
|
||||
test_SHLWAPI_213();
|
||||
test_SHLWAPI_214();
|
||||
test_IStream_Read();
|
||||
test_IStream_Write();
|
||||
test_IStream_Reset();
|
||||
test_IStream_Size();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ DEFINE_OLEGUID(WINE_IID_IDelayedRelease, 0x000214EDL, 0, 0);
|
||||
|
||||
/* Function ptrs for ordinal calls */
|
||||
static HMODULE hShlwapi = 0;
|
||||
static BOOL (WINAPI *pSHLWAPI_269)(LPCSTR, CLSID *) = 0;
|
||||
static DWORD (WINAPI *pSHLWAPI_23)(REFGUID, LPSTR, INT) = 0;
|
||||
static BOOL (WINAPI *pGUIDFromStringA)(LPCSTR, CLSID *) = 0;
|
||||
static DWORD (WINAPI *pSHStringFromGUIDA)(REFGUID, LPSTR, INT) = 0;
|
||||
|
||||
/* GUIDs to test */
|
||||
static const GUID * TEST_guids[] = {
|
||||
@@ -109,16 +109,16 @@ static void test_ClassIDs(void)
|
||||
int i = 0;
|
||||
BOOL is_vista = FALSE;
|
||||
|
||||
if (!pSHLWAPI_269 || !pSHLWAPI_23)
|
||||
if (!pGUIDFromStringA || !pSHStringFromGUIDA)
|
||||
return;
|
||||
|
||||
while (*guids)
|
||||
{
|
||||
dwLen = pSHLWAPI_23(*guids, szBuff, 256);
|
||||
dwLen = pSHStringFromGUIDA(*guids, szBuff, 256);
|
||||
if (!i && dwLen == S_OK) is_vista = TRUE; /* seems to return an HRESULT on vista */
|
||||
ok(dwLen == (is_vista ? S_OK : 39), "wrong size %u for id %d\n", dwLen, i);
|
||||
ok(dwLen == (is_vista ? S_OK : 39), "wrong size %lu for id %d\n", dwLen, i);
|
||||
|
||||
bRet = pSHLWAPI_269(szBuff, &guid);
|
||||
bRet = pGUIDFromStringA(szBuff, &guid);
|
||||
ok(bRet != FALSE, "created invalid string '%s'\n", szBuff);
|
||||
|
||||
if (bRet)
|
||||
@@ -129,34 +129,33 @@ static void test_ClassIDs(void)
|
||||
}
|
||||
|
||||
/* Test endianness */
|
||||
dwLen = pSHLWAPI_23(&IID_Endianness, szBuff, 256);
|
||||
ok(dwLen == (is_vista ? S_OK : 39), "wrong size %u for IID_Endianness\n", dwLen);
|
||||
dwLen = pSHStringFromGUIDA(&IID_Endianness, szBuff, 256);
|
||||
ok(dwLen == (is_vista ? S_OK : 39), "wrong size %lu for IID_Endianness\n", dwLen);
|
||||
|
||||
ok(!strcmp(szBuff, "{01020304-0506-0708-090A-0B0C0D0E0F0A}"),
|
||||
"Endianness Broken, got '%s'\n", szBuff);
|
||||
|
||||
/* test lengths */
|
||||
szBuff[0] = ':';
|
||||
dwLen = pSHLWAPI_23(&IID_Endianness, szBuff, 0);
|
||||
dwLen = pSHStringFromGUIDA(&IID_Endianness, szBuff, 0);
|
||||
ok(dwLen == (is_vista ? E_FAIL : 0), "accepted bad length\n");
|
||||
ok(szBuff[0] == ':', "wrote to buffer with no length\n");
|
||||
|
||||
szBuff[0] = ':';
|
||||
dwLen = pSHLWAPI_23(&IID_Endianness, szBuff, 38);
|
||||
dwLen = pSHStringFromGUIDA(&IID_Endianness, szBuff, 38);
|
||||
ok(dwLen == (is_vista ? E_FAIL : 0), "accepted bad length\n");
|
||||
ok(szBuff[0] == ':', "wrote to buffer with no length\n");
|
||||
|
||||
szBuff[0] = ':';
|
||||
dwLen = pSHLWAPI_23(&IID_Endianness, szBuff, 39);
|
||||
dwLen = pSHStringFromGUIDA(&IID_Endianness, szBuff, 39);
|
||||
ok(dwLen == (is_vista ? S_OK : 39), "rejected ok length\n");
|
||||
ok(szBuff[0] == '{', "Didn't write to buffer with ok length\n");
|
||||
|
||||
/* Test string */
|
||||
strcpy(szBuff, "{xxx-");
|
||||
bRet = pSHLWAPI_269(szBuff, &guid);
|
||||
bRet = pGUIDFromStringA(szBuff, &guid);
|
||||
ok(bRet == FALSE, "accepted invalid string\n");
|
||||
|
||||
dwLen = pSHLWAPI_23(&IID_Endianness, szBuff, 39);
|
||||
dwLen = pSHStringFromGUIDA(&IID_Endianness, szBuff, 39);
|
||||
ok(dwLen == (is_vista ? S_OK : 39), "rejected ok length\n");
|
||||
ok(szBuff[0] == '{', "Didn't write to buffer with ok length\n");
|
||||
}
|
||||
@@ -172,14 +171,14 @@ static void test_CLSIDFromProgIDWrap(void)
|
||||
pCLSIDFromProgIDWrap = (void*)GetProcAddress(hShlwapi,(char*)435);
|
||||
|
||||
hres = pCLSIDFromProgIDWrap(wszStdPicture, &clsid);
|
||||
ok(hres == S_OK, "CLSIDFromProgIDWrap failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "CLSIDFromProgIDWrap failed: %08lx\n", hres);
|
||||
ok(IsEqualGUID(&CLSID_StdPicture, &clsid), "wrong clsid\n");
|
||||
|
||||
hres = pCLSIDFromProgIDWrap(NULL, &clsid);
|
||||
ok(hres == E_INVALIDARG, "CLSIDFromProgIDWrap failed: %08x, expected E_INVALIDARG\n", hres);
|
||||
ok(hres == E_INVALIDARG, "CLSIDFromProgIDWrap failed: %08lx, expected E_INVALIDARG\n", hres);
|
||||
|
||||
hres = pCLSIDFromProgIDWrap(wszStdPicture, NULL);
|
||||
ok(hres == E_INVALIDARG, "CLSIDFromProgIDWrap failed: %08x, expected E_INVALIDARG\n", hres);
|
||||
ok(hres == E_INVALIDARG, "CLSIDFromProgIDWrap failed: %08lx, expected E_INVALIDARG\n", hres);
|
||||
}
|
||||
|
||||
START_TEST(clsid)
|
||||
@@ -192,8 +191,8 @@ START_TEST(clsid)
|
||||
return;
|
||||
}
|
||||
|
||||
pSHLWAPI_269 = (void*)GetProcAddress(hShlwapi, (LPSTR)269);
|
||||
pSHLWAPI_23 = (void*)GetProcAddress(hShlwapi, (LPSTR)23);
|
||||
pGUIDFromStringA = (void*)GetProcAddress(hShlwapi, (LPSTR)269);
|
||||
pSHStringFromGUIDA = (void*)GetProcAddress(hShlwapi, (LPSTR)23);
|
||||
|
||||
test_ClassIDs();
|
||||
test_CLSIDFromProgIDWrap();
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
|
||||
# define _TYPE_ALIGNMENT(type) __alignof(type)
|
||||
#elif defined(__GNUC__)
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
# define _TYPE_ALIGNMENT(type) __alignof__(type)
|
||||
#else
|
||||
/*
|
||||
@@ -52,23 +52,23 @@
|
||||
* Test helper macros
|
||||
*/
|
||||
|
||||
#define TEST_TYPE_SIZE(type, size) C_ASSERT(sizeof(type) == size);
|
||||
#define TEST_TYPE_SIZE(type, size) C_ASSERT(sizeof(type) == size);
|
||||
|
||||
#ifdef TYPE_ALIGNMENT
|
||||
# define TEST_TYPE_ALIGN(type, align) C_ASSERT(TYPE_ALIGNMENT(type) == align);
|
||||
# define TEST_TYPE_ALIGN(type, align) C_ASSERT(TYPE_ALIGNMENT(type) == align);
|
||||
#else
|
||||
# define TEST_TYPE_ALIGN(type, align)
|
||||
#endif
|
||||
|
||||
#ifdef _TYPE_ALIGNMENT
|
||||
# define TEST_TARGET_ALIGN(type, align) C_ASSERT(_TYPE_ALIGNMENT(*(type)0) == align);
|
||||
# define TEST_FIELD_ALIGN(type, field, align) C_ASSERT(_TYPE_ALIGNMENT(((type*)0)->field) == align);
|
||||
# define TEST_TARGET_ALIGN(type, align) C_ASSERT(_TYPE_ALIGNMENT(*(type)0) == align);
|
||||
# define TEST_FIELD_ALIGN(type, field, align) C_ASSERT(_TYPE_ALIGNMENT(((type*)0)->field) == align);
|
||||
#else
|
||||
# define TEST_TARGET_ALIGN(type, align)
|
||||
# define TEST_FIELD_ALIGN(type, field, align)
|
||||
#endif
|
||||
|
||||
#define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) == offset);
|
||||
#define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) == offset);
|
||||
|
||||
#define TEST_TARGET_SIZE(type, size) TEST_TYPE_SIZE(*(type)0, size)
|
||||
#define TEST_FIELD_SIZE(type, field, size) TEST_TYPE_SIZE((((type*)0)->field), size)
|
||||
|
||||
@@ -39,28 +39,28 @@ static void test_IStream_invalid_operations(IStream * stream, DWORD mode)
|
||||
ULONG count;
|
||||
char data[256];
|
||||
|
||||
U(uzero).HighPart = 0;
|
||||
U(uzero).LowPart = 0;
|
||||
U(uret).HighPart = 0;
|
||||
U(uret).LowPart = 0;
|
||||
U(zero).HighPart = 0;
|
||||
U(zero).LowPart = 0;
|
||||
uzero.HighPart = 0;
|
||||
uzero.LowPart = 0;
|
||||
uret.HighPart = 0;
|
||||
uret.LowPart = 0;
|
||||
zero.HighPart = 0;
|
||||
zero.LowPart = 0;
|
||||
|
||||
/* IStream::Read */
|
||||
|
||||
/* IStream_Read from the COBJMACROS is undefined by shlwapi.h, replaced by the IStream_Read helper function. */
|
||||
|
||||
ret = stream->lpVtbl->Read(stream, NULL, 0, &count);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
|
||||
|
||||
ret = stream->lpVtbl->Read(stream, data, 5, NULL);
|
||||
ok(ret == S_FALSE || ret == S_OK, "expected S_FALSE or S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_FALSE || ret == S_OK, "expected S_FALSE or S_OK, got 0x%08lx\n", ret);
|
||||
|
||||
ret = stream->lpVtbl->Read(stream, data, 0, NULL);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
|
||||
|
||||
ret = stream->lpVtbl->Read(stream, data, 3, &count);
|
||||
ok(ret == S_FALSE || ret == S_OK, "expected S_FALSE or S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_FALSE || ret == S_OK, "expected S_FALSE or S_OK, got 0x%08lx\n", ret);
|
||||
|
||||
/* IStream::Write */
|
||||
|
||||
@@ -70,104 +70,104 @@ static void test_IStream_invalid_operations(IStream * stream, DWORD mode)
|
||||
if (mode == STGM_READ)
|
||||
{
|
||||
ok(ret == STG_E_ACCESSDENIED /* XP */ || broken(ret == S_OK) /* Win2000 + IE5 */,
|
||||
"expected STG_E_ACCESSDENIED, got 0x%08x\n", ret);
|
||||
"expected STG_E_ACCESSDENIED, got 0x%08lx\n", ret);
|
||||
}
|
||||
else
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
|
||||
|
||||
strcpy(data, "Hello");
|
||||
ret = stream->lpVtbl->Write(stream, data, 5, NULL);
|
||||
if (mode == STGM_READ)
|
||||
ok(ret == STG_E_ACCESSDENIED,
|
||||
"expected STG_E_ACCESSDENIED, got 0x%08x\n", ret);
|
||||
"expected STG_E_ACCESSDENIED, got 0x%08lx\n", ret);
|
||||
else
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
|
||||
|
||||
strcpy(data, "Hello");
|
||||
ret = stream->lpVtbl->Write(stream, data, 0, NULL);
|
||||
if (mode == STGM_READ)
|
||||
ok(ret == STG_E_ACCESSDENIED,
|
||||
"expected STG_E_ACCESSDENIED, got 0x%08x\n", ret);
|
||||
"expected STG_E_ACCESSDENIED, got 0x%08lx\n", ret);
|
||||
else
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
|
||||
|
||||
strcpy(data, "Hello");
|
||||
ret = stream->lpVtbl->Write(stream, data, 0, &count);
|
||||
if (mode == STGM_READ)
|
||||
ok(ret == STG_E_ACCESSDENIED,
|
||||
"expected STG_E_ACCESSDENIED, got 0x%08x\n", ret);
|
||||
"expected STG_E_ACCESSDENIED, got 0x%08lx\n", ret);
|
||||
else
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
|
||||
|
||||
strcpy(data, "Hello");
|
||||
ret = stream->lpVtbl->Write(stream, data, 3, &count);
|
||||
if (mode == STGM_READ)
|
||||
ok(ret == STG_E_ACCESSDENIED,
|
||||
"expected STG_E_ACCESSDENIED, got 0x%08x\n", ret);
|
||||
"expected STG_E_ACCESSDENIED, got 0x%08lx\n", ret);
|
||||
else
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
|
||||
|
||||
/* IStream::Seek */
|
||||
|
||||
ret = IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
|
||||
|
||||
ret = IStream_Seek(stream, zero, 20, NULL);
|
||||
ok(ret == E_INVALIDARG,
|
||||
"expected E_INVALIDARG, got 0x%08x\n", ret);
|
||||
"expected E_INVALIDARG, got 0x%08lx\n", ret);
|
||||
|
||||
/* IStream::CopyTo */
|
||||
|
||||
ret = IStream_CopyTo(stream, NULL, uzero, &uret, &uret);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
|
||||
|
||||
clone = NULL;
|
||||
ret = IStream_CopyTo(stream, clone, uzero, &uret, &uret);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
|
||||
|
||||
ret = IStream_CopyTo(stream, stream, uzero, &uret, &uret);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
|
||||
|
||||
ret = IStream_CopyTo(stream, stream, uzero, &uret, NULL);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
|
||||
|
||||
ret = IStream_CopyTo(stream, stream, uzero, NULL, &uret);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
|
||||
|
||||
/* IStream::Commit */
|
||||
|
||||
ret = IStream_Commit(stream, STGC_DEFAULT);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
|
||||
|
||||
/* IStream::Revert */
|
||||
|
||||
ret = IStream_Revert(stream);
|
||||
ok(ret == E_NOTIMPL, "expected E_NOTIMPL, got 0x%08x\n", ret);
|
||||
ok(ret == E_NOTIMPL, "expected E_NOTIMPL, got 0x%08lx\n", ret);
|
||||
|
||||
/* IStream::LockRegion */
|
||||
|
||||
ret = IStream_LockRegion(stream, uzero, uzero, 0);
|
||||
ok(ret == E_NOTIMPL /* XP */ || ret == S_OK /* Vista */,
|
||||
"expected E_NOTIMPL or S_OK, got 0x%08x\n", ret);
|
||||
"expected E_NOTIMPL or S_OK, got 0x%08lx\n", ret);
|
||||
|
||||
/* IStream::UnlockRegion */
|
||||
|
||||
if (ret == E_NOTIMPL) /* XP */ {
|
||||
ret = IStream_UnlockRegion(stream, uzero, uzero, 0);
|
||||
ok(ret == E_NOTIMPL, "expected E_NOTIMPL, got 0x%08x\n", ret);
|
||||
ok(ret == E_NOTIMPL, "expected E_NOTIMPL, got 0x%08lx\n", ret);
|
||||
} else /* Vista */ {
|
||||
ret = IStream_UnlockRegion(stream, uzero, uzero, 0);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
|
||||
|
||||
ret = IStream_UnlockRegion(stream, uzero, uzero, 0);
|
||||
ok(ret == STG_E_LOCKVIOLATION, "expected STG_E_LOCKVIOLATION, got 0x%08x\n", ret);
|
||||
ok(ret == STG_E_LOCKVIOLATION, "expected STG_E_LOCKVIOLATION, got 0x%08lx\n", ret);
|
||||
}
|
||||
|
||||
/* IStream::Stat */
|
||||
|
||||
ret = IStream_Stat(stream, NULL, 0);
|
||||
ok(ret == STG_E_INVALIDPOINTER,
|
||||
"expected STG_E_INVALIDPOINTER or E_NOTIMPL, got 0x%08x\n", ret);
|
||||
"expected STG_E_INVALIDPOINTER or E_NOTIMPL, got 0x%08lx\n", ret);
|
||||
|
||||
/* IStream::Clone */
|
||||
|
||||
@@ -175,12 +175,12 @@ static void test_IStream_invalid_operations(IStream * stream, DWORD mode)
|
||||
|
||||
clone = NULL;
|
||||
ret = IStream_Clone(stream, &clone);
|
||||
ok(ret == E_NOTIMPL, "expected E_NOTIMPL, got 0x%08x\n", ret);
|
||||
ok(ret == E_NOTIMPL, "expected E_NOTIMPL, got 0x%08lx\n", ret);
|
||||
ok(clone == NULL, "expected a NULL IStream object, got %p\n", stream);
|
||||
|
||||
if (clone) {
|
||||
refcount = IStream_Release(clone);
|
||||
ok(refcount == 0, "expected 0, got %d\n", refcount);
|
||||
ok(refcount == 0, "expected 0, got %ld\n", refcount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,63 +199,63 @@ static void test_stream_read_write(IStream *stream, DWORD mode)
|
||||
ret = stream->lpVtbl->Write(stream, "\x5e\xa7", 2, &written);
|
||||
if (mode == STGM_WRITE || mode == STGM_READWRITE)
|
||||
{
|
||||
ok(ret == S_OK, "IStream_Write error %#x (access %#x)\n", ret, mode);
|
||||
ok(written == 2, "expected 2, got %u\n", written);
|
||||
ok(ret == S_OK, "IStream_Write error %#lx (access %#lx)\n", ret, mode);
|
||||
ok(written == 2, "expected 2, got %lu\n", written);
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(ret == STG_E_ACCESSDENIED || broken(ret == S_OK) /* win2000 */, "expected STG_E_ACCESSDENIED, got %#x (access %#x)\n", ret, mode);
|
||||
ok(written == 0xdeadbeaf || broken(written == 2) /* win2000 */, "expected 0xdeadbeaf, got %#x\n", written);
|
||||
ok(ret == STG_E_ACCESSDENIED || broken(ret == S_OK) /* win2000 */, "expected STG_E_ACCESSDENIED, got %#lx (access %#lx)\n", ret, mode);
|
||||
ok(written == 0xdeadbeaf || broken(written == 2) /* win2000 */, "expected 0xdeadbeaf, got %#lx\n", written);
|
||||
written = 0;
|
||||
if (ret == S_OK) return; /* no point in further testing */
|
||||
}
|
||||
|
||||
ret = stream->lpVtbl->Seek(stream, start, STREAM_SEEK_SET, NULL);
|
||||
ok(ret == S_OK, "Seek error %#x\n", ret);
|
||||
ok(ret == S_OK, "Seek error %#lx\n", ret);
|
||||
|
||||
count = 0xdeadbeaf;
|
||||
ret = stream->lpVtbl->Read(stream, buf, 2, &count);
|
||||
if (written != 0)
|
||||
{
|
||||
ok(ret == S_OK || broken(ret == S_FALSE) /* win2000 */, "IStream_Read error %#x (access %#x, written %u)\n", ret, mode, written);
|
||||
ok(ret == S_OK || broken(ret == S_FALSE) /* win2000 */, "IStream_Read error %#lx (access %#lx, written %lu)\n", ret, mode, written);
|
||||
if (ret == S_OK && (mode == STGM_WRITE || mode == STGM_READWRITE))
|
||||
{
|
||||
ok(count == 2, "expected 2, got %u\n", count);
|
||||
ok(count == 2, "expected 2, got %lu\n", count);
|
||||
ok(buf[0] == 0x5e && buf[1] == 0xa7, "expected 5ea7, got %02x%02x\n", buf[0], buf[1]);
|
||||
}
|
||||
else
|
||||
ok(count == 0, "expected 0, got %u\n", count);
|
||||
ok(count == 0, "expected 0, got %lu\n", count);
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(ret == S_FALSE, "expected S_FALSE, got %#x (access %#x, written %u)\n", ret, mode, written);
|
||||
ok(count == 0, "expected 0, got %u\n", count);
|
||||
ok(ret == S_FALSE, "expected S_FALSE, got %#lx (access %#lx, written %lu)\n", ret, mode, written);
|
||||
ok(count == 0, "expected 0, got %lu\n", count);
|
||||
}
|
||||
|
||||
ret = stream->lpVtbl->Seek(stream, start, STREAM_SEEK_SET, NULL);
|
||||
ok(ret == S_OK, "Seek error %#x\n", ret);
|
||||
ok(ret == S_OK, "Seek error %#lx\n", ret);
|
||||
|
||||
count = 0xdeadbeaf;
|
||||
ret = stream->lpVtbl->Read(stream, buf, 0, &count);
|
||||
ok(ret == S_OK, "IStream_Read error %#x (access %#x, written %u)\n", ret, mode, written);
|
||||
ok(count == 0, "expected 0, got %u\n", count);
|
||||
ok(ret == S_OK, "IStream_Read error %#lx (access %#lx, written %lu)\n", ret, mode, written);
|
||||
ok(count == 0, "expected 0, got %lu\n", count);
|
||||
|
||||
count = 0xdeadbeaf;
|
||||
ret = stream->lpVtbl->Read(stream, buf, sizeof(buf), &count);
|
||||
ok(ret == S_FALSE, "expected S_FALSE, got %#x (access %#x, written %u)\n", ret, mode, written);
|
||||
ok(count == written, "expected %u, got %u\n", written, count);
|
||||
ok(ret == S_FALSE, "expected S_FALSE, got %#lx (access %#lx, written %lu)\n", ret, mode, written);
|
||||
ok(count == written, "expected %lu, got %lu\n", written, count);
|
||||
if (count)
|
||||
ok(buf[0] == 0x5e && buf[1] == 0xa7, "expected 5ea7, got %02x%02x\n", buf[0], buf[1]);
|
||||
|
||||
memset(&statstg, 0xff, sizeof(statstg));
|
||||
ret = IStream_Stat(stream, &statstg, 0);
|
||||
ok(ret == S_OK, "Stat failed, hr %#x.\n", ret);
|
||||
ok(ret == S_OK, "Stat failed, hr %#lx.\n", ret);
|
||||
ok(statstg.pwcsName != NULL, "Unexpected name %s.\n", wine_dbgstr_w(statstg.pwcsName));
|
||||
CoTaskMemFree(statstg.pwcsName);
|
||||
|
||||
memset(&statstg, 0xff, sizeof(statstg));
|
||||
ret = IStream_Stat(stream, &statstg, STATFLAG_NONAME);
|
||||
ok(ret == S_OK, "Stat failed, hr %#x.\n", ret);
|
||||
ok(ret == S_OK, "Stat failed, hr %#lx.\n", ret);
|
||||
ok(statstg.pwcsName == NULL, "Unexpected name %s.\n", wine_dbgstr_w(statstg.pwcsName));
|
||||
}
|
||||
|
||||
@@ -265,18 +265,17 @@ static void test_stream_qi(IStream *stream)
|
||||
HRESULT hr;
|
||||
|
||||
hr = IStream_QueryInterface(stream, &IID_IStream, (void **)&unk);
|
||||
ok(SUCCEEDED(hr), "Failed to get IStream interface, hr %#x.\n", hr);
|
||||
ok(SUCCEEDED(hr), "Failed to get IStream interface, hr %#lx.\n", hr);
|
||||
IUnknown_Release(unk);
|
||||
|
||||
unk = NULL;
|
||||
hr = IStream_QueryInterface(stream, &IID_ISequentialStream, (void **)&unk);
|
||||
todo_wine
|
||||
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* XP */, "Failed to get ISequentialStream interface, hr %#x.\n", hr);
|
||||
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* XP */, "Failed to get ISequentialStream interface, hr %#lx.\n", hr);
|
||||
if (unk)
|
||||
IUnknown_Release(unk);
|
||||
|
||||
hr = IStream_QueryInterface(stream, &IID_IUnknown, (void **)&unk);
|
||||
ok(SUCCEEDED(hr), "Failed to get IUnknown interface, hr %#x.\n", hr);
|
||||
ok(SUCCEEDED(hr), "Failed to get IUnknown interface, hr %#lx.\n", hr);
|
||||
IUnknown_Release(unk);
|
||||
}
|
||||
|
||||
@@ -288,7 +287,7 @@ static void test_SHCreateStreamOnFileA(DWORD mode, DWORD stgm)
|
||||
char test_file[MAX_PATH];
|
||||
static const CHAR testA_txt[] = "\\testA.txt";
|
||||
|
||||
trace("SHCreateStreamOnFileA: testing mode %d, STGM flags %08x\n", mode, stgm);
|
||||
trace("SHCreateStreamOnFileA: testing mode %ld, STGM flags %08lx\n", mode, stgm);
|
||||
|
||||
/* Don't used a fixed path for the testA.txt file */
|
||||
GetTempPathA(MAX_PATH, test_file);
|
||||
@@ -306,40 +305,40 @@ static void test_SHCreateStreamOnFileA(DWORD mode, DWORD stgm)
|
||||
ok(ret == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) /* NT */ ||
|
||||
ret == HRESULT_FROM_WIN32(ERROR_BAD_PATHNAME) /* 9x */,
|
||||
"SHCreateStreamOnFileA: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) "
|
||||
"or HRESULT_FROM_WIN32(ERROR_BAD_PATHNAME), got 0x%08x\n", ret);
|
||||
"or HRESULT_FROM_WIN32(ERROR_BAD_PATHNAME), got 0x%08lx\n", ret);
|
||||
ok(stream == NULL, "SHCreateStreamOnFileA: expected a NULL IStream object, got %p\n", stream);
|
||||
|
||||
if (0) /* This test crashes on WinXP SP2 */
|
||||
{
|
||||
ret = SHCreateStreamOnFileA(test_file, mode | stgm, NULL);
|
||||
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08x\n", ret);
|
||||
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08lx\n", ret);
|
||||
}
|
||||
|
||||
stream = NULL;
|
||||
ret = SHCreateStreamOnFileA(test_file, mode | STGM_CONVERT | stgm, &stream);
|
||||
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08x\n", ret);
|
||||
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08lx\n", ret);
|
||||
ok(stream == NULL, "SHCreateStreamOnFileA: expected a NULL IStream object, got %p\n", stream);
|
||||
|
||||
stream = NULL;
|
||||
ret = SHCreateStreamOnFileA(test_file, mode | STGM_DELETEONRELEASE | stgm, &stream);
|
||||
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08x\n", ret);
|
||||
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08lx\n", ret);
|
||||
ok(stream == NULL, "SHCreateStreamOnFileA: expected a NULL IStream object, got %p\n", stream);
|
||||
|
||||
stream = NULL;
|
||||
ret = SHCreateStreamOnFileA(test_file, mode | STGM_TRANSACTED | stgm, &stream);
|
||||
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08x\n", ret);
|
||||
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08lx\n", ret);
|
||||
ok(stream == NULL, "SHCreateStreamOnFileA: expected a NULL IStream object, got %p\n", stream);
|
||||
|
||||
/* file does not exist */
|
||||
|
||||
stream = NULL;
|
||||
ret = SHCreateStreamOnFileA(test_file, mode | STGM_FAILIFTHERE | stgm, &stream);
|
||||
ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "SHCreateStreamOnFileA: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08x\n", ret);
|
||||
ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "SHCreateStreamOnFileA: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08lx\n", ret);
|
||||
ok(stream == NULL, "SHCreateStreamOnFileA: expected a NULL IStream object, got %p\n", stream);
|
||||
|
||||
stream = NULL;
|
||||
ret = SHCreateStreamOnFileA(test_file, mode | STGM_CREATE | stgm, &stream);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileA: expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileA: expected S_OK, got 0x%08lx\n", ret);
|
||||
ok(stream != NULL, "SHCreateStreamOnFileA: expected a valid IStream object, got NULL\n");
|
||||
|
||||
if (stream) {
|
||||
@@ -347,7 +346,7 @@ if (0) /* This test crashes on WinXP SP2 */
|
||||
test_IStream_invalid_operations(stream, mode);
|
||||
|
||||
refcount = IStream_Release(stream);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileA: expected 0, got %d\n", refcount);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileA: expected 0, got %ld\n", refcount);
|
||||
}
|
||||
|
||||
/* NOTE: don't delete the file, as it will be used for the file exists tests. */
|
||||
@@ -356,19 +355,19 @@ if (0) /* This test crashes on WinXP SP2 */
|
||||
|
||||
stream = NULL;
|
||||
ret = SHCreateStreamOnFileA(test_file, mode | STGM_FAILIFTHERE | stgm, &stream);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileA: expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileA: expected S_OK, got 0x%08lx\n", ret);
|
||||
ok(stream != NULL, "SHCreateStreamOnFileA: expected a valid IStream object, got NULL\n");
|
||||
|
||||
if (stream) {
|
||||
test_IStream_invalid_operations(stream, mode);
|
||||
|
||||
refcount = IStream_Release(stream);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileA: expected 0, got %d\n", refcount);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileA: expected 0, got %ld\n", refcount);
|
||||
}
|
||||
|
||||
stream = NULL;
|
||||
ret = SHCreateStreamOnFileA(test_file, mode | STGM_CREATE | stgm, &stream);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileA: expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileA: expected S_OK, got 0x%08lx\n", ret);
|
||||
ok(stream != NULL, "SHCreateStreamOnFileA: expected a valid IStream object, got NULL\n");
|
||||
|
||||
if (stream) {
|
||||
@@ -378,10 +377,10 @@ if (0) /* This test crashes on WinXP SP2 */
|
||||
test_IStream_invalid_operations(stream, mode);
|
||||
|
||||
refcount = IStream_Release(stream);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileA: expected 0, got %d\n", refcount);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileA: expected 0, got %ld\n", refcount);
|
||||
|
||||
delret = DeleteFileA(test_file);
|
||||
ok(delret, "SHCreateStreamOnFileA: could not delete file '%s', got error %d\n",
|
||||
ok(delret, "SHCreateStreamOnFileA: could not delete file '%s', got error %ld\n",
|
||||
test_file, GetLastError());
|
||||
}
|
||||
}
|
||||
@@ -396,7 +395,7 @@ static void test_SHCreateStreamOnFileW(DWORD mode, DWORD stgm)
|
||||
CHAR test_fileA[MAX_PATH];
|
||||
static const CHAR testW_txt[] = "\\testW.txt";
|
||||
|
||||
trace("SHCreateStreamOnFileW: testing mode %d, STGM flags %08x\n", mode, stgm);
|
||||
trace("SHCreateStreamOnFileW: testing mode %ld, STGM flags %08lx\n", mode, stgm);
|
||||
|
||||
/* Don't used a fixed path for the testW.txt file */
|
||||
GetTempPathA(MAX_PATH, test_fileA);
|
||||
@@ -412,7 +411,7 @@ static void test_SHCreateStreamOnFileW(DWORD mode, DWORD stgm)
|
||||
ret = SHCreateStreamOnFileW(NULL, mode | stgm, &stream);
|
||||
ok(ret == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) || /* XP */
|
||||
ret == E_INVALIDARG /* Vista */,
|
||||
"SHCreateStreamOnFileW: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) or E_INVALIDARG, got 0x%08x\n", ret);
|
||||
"SHCreateStreamOnFileW: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) or E_INVALIDARG, got 0x%08lx\n", ret);
|
||||
ok(stream == NULL, "SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n", stream);
|
||||
}
|
||||
|
||||
@@ -420,22 +419,22 @@ static void test_SHCreateStreamOnFileW(DWORD mode, DWORD stgm)
|
||||
{
|
||||
/* This test crashes on WinXP SP2 */
|
||||
ret = SHCreateStreamOnFileW(test_file, mode | stgm, NULL);
|
||||
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08x\n", ret);
|
||||
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08lx\n", ret);
|
||||
}
|
||||
|
||||
stream = NULL;
|
||||
ret = SHCreateStreamOnFileW(test_file, mode | STGM_CONVERT | stgm, &stream);
|
||||
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08x\n", ret);
|
||||
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08lx\n", ret);
|
||||
ok(stream == NULL, "SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n", stream);
|
||||
|
||||
stream = NULL;
|
||||
ret = SHCreateStreamOnFileW(test_file, mode | STGM_DELETEONRELEASE | stgm, &stream);
|
||||
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08x\n", ret);
|
||||
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08lx\n", ret);
|
||||
ok(stream == NULL, "SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n", stream);
|
||||
|
||||
stream = NULL;
|
||||
ret = SHCreateStreamOnFileW(test_file, mode | STGM_TRANSACTED | stgm, &stream);
|
||||
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08x\n", ret);
|
||||
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08lx\n", ret);
|
||||
ok(stream == NULL, "SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n", stream);
|
||||
|
||||
/* file does not exist */
|
||||
@@ -447,12 +446,12 @@ static void test_SHCreateStreamOnFileW(DWORD mode, DWORD stgm)
|
||||
return;
|
||||
}
|
||||
|
||||
ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "SHCreateStreamOnFileW: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08x\n", ret);
|
||||
ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "SHCreateStreamOnFileW: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08lx\n", ret);
|
||||
ok(stream == NULL, "SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n", stream);
|
||||
|
||||
stream = NULL;
|
||||
ret = SHCreateStreamOnFileW(test_file, mode | STGM_CREATE | stgm, &stream);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileW: expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileW: expected S_OK, got 0x%08lx\n", ret);
|
||||
ok(stream != NULL, "SHCreateStreamOnFileW: expected a valid IStream object, got NULL\n");
|
||||
|
||||
if (stream) {
|
||||
@@ -460,7 +459,7 @@ static void test_SHCreateStreamOnFileW(DWORD mode, DWORD stgm)
|
||||
test_IStream_invalid_operations(stream, mode);
|
||||
|
||||
refcount = IStream_Release(stream);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileW: expected 0, got %d\n", refcount);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileW: expected 0, got %ld\n", refcount);
|
||||
}
|
||||
|
||||
/* NOTE: don't delete the file, as it will be used for the file exists tests. */
|
||||
@@ -469,19 +468,19 @@ static void test_SHCreateStreamOnFileW(DWORD mode, DWORD stgm)
|
||||
|
||||
stream = NULL;
|
||||
ret = SHCreateStreamOnFileW(test_file, mode | STGM_FAILIFTHERE | stgm, &stream);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileW: expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileW: expected S_OK, got 0x%08lx\n", ret);
|
||||
ok(stream != NULL, "SHCreateStreamOnFileW: expected a valid IStream object, got NULL\n");
|
||||
|
||||
if (stream) {
|
||||
test_IStream_invalid_operations(stream, mode);
|
||||
|
||||
refcount = IStream_Release(stream);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileW: expected 0, got %d\n", refcount);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileW: expected 0, got %ld\n", refcount);
|
||||
}
|
||||
|
||||
stream = NULL;
|
||||
ret = SHCreateStreamOnFileW(test_file, mode | STGM_CREATE | stgm, &stream);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileW: expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileW: expected S_OK, got 0x%08lx\n", ret);
|
||||
ok(stream != NULL, "SHCreateStreamOnFileW: expected a valid IStream object, got NULL\n");
|
||||
|
||||
if (stream) {
|
||||
@@ -491,10 +490,10 @@ static void test_SHCreateStreamOnFileW(DWORD mode, DWORD stgm)
|
||||
test_IStream_invalid_operations(stream, mode);
|
||||
|
||||
refcount = IStream_Release(stream);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileW: expected 0, got %d\n", refcount);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileW: expected 0, got %ld\n", refcount);
|
||||
|
||||
delret = DeleteFileA(test_fileA);
|
||||
ok(delret, "SHCreateStreamOnFileW: could not delete the test file, got error %d\n",
|
||||
ok(delret, "SHCreateStreamOnFileW: could not delete the test file, got error %ld\n",
|
||||
GetLastError());
|
||||
}
|
||||
}
|
||||
@@ -512,7 +511,7 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
|
||||
BOOL delret;
|
||||
|
||||
if (winetest_debug > 1)
|
||||
trace("SHCreateStreamOnFileEx: testing mode %d, STGM flags %08x\n", mode, stgm);
|
||||
trace("SHCreateStreamOnFileEx: testing mode %ld, STGM flags %08lx\n", mode, stgm);
|
||||
|
||||
/* Don't used a fixed path for the testEx.txt file */
|
||||
GetTempPathA(MAX_PATH, test_fileA);
|
||||
@@ -528,7 +527,7 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
|
||||
ret = SHCreateStreamOnFileEx(NULL, mode, 0, FALSE, NULL, &stream);
|
||||
ok(ret == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) || /* XP */
|
||||
ret == E_INVALIDARG /* Vista */,
|
||||
"SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) or E_INVALIDARG, got 0x%08x\n", ret);
|
||||
"SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) or E_INVALIDARG, got 0x%08lx\n", ret);
|
||||
ok(stream == NULL, "SHCreateStreamOnFileEx: expected a NULL IStream object, got %p\n", stream);
|
||||
}
|
||||
|
||||
@@ -542,7 +541,7 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
|
||||
ok( ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
|
||||
ret == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER),
|
||||
"SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) or "
|
||||
"HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got 0x%08x\n", ret);
|
||||
"HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got 0x%08lx\n", ret);
|
||||
|
||||
ok(stream == NULL, "SHCreateStreamOnFileEx: expected a NULL IStream object, got %p\n", stream);
|
||||
|
||||
@@ -550,7 +549,7 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
|
||||
{
|
||||
/* This test crashes on WinXP SP2 */
|
||||
ret = SHCreateStreamOnFileEx(test_file, mode, 0, FALSE, NULL, NULL);
|
||||
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileEx: expected E_INVALIDARG, got 0x%08x\n", ret);
|
||||
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileEx: expected E_INVALIDARG, got 0x%08lx\n", ret);
|
||||
}
|
||||
|
||||
/* file does not exist */
|
||||
@@ -559,7 +558,7 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
|
||||
ret = SHCreateStreamOnFileEx(test_file, mode | STGM_FAILIFTHERE | stgm, 0, FALSE, NULL, &stream);
|
||||
if ((stgm & STGM_TRANSACTED) == STGM_TRANSACTED && mode == STGM_READ) {
|
||||
ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) /* XP */ || ret == E_INVALIDARG /* Vista */,
|
||||
"SHCreateStreamOnFileEx: expected E_INVALIDARG or HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08x\n", ret);
|
||||
"SHCreateStreamOnFileEx: expected E_INVALIDARG or HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08lx\n", ret);
|
||||
|
||||
if (ret == E_INVALIDARG) {
|
||||
skip("SHCreateStreamOnFileEx: STGM_TRANSACTED not supported in this configuration.\n");
|
||||
@@ -569,7 +568,7 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
|
||||
ok( ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
|
||||
ret == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER),
|
||||
"SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) or "
|
||||
"HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got 0x%08x\n", ret);
|
||||
"HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got 0x%08lx\n", ret);
|
||||
}
|
||||
ok(stream == NULL, "SHCreateStreamOnFileEx: expected a NULL IStream object, got %p\n", stream);
|
||||
|
||||
@@ -582,7 +581,7 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
|
||||
return;
|
||||
}
|
||||
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08lx\n", ret);
|
||||
ok(stream != NULL, "SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
|
||||
|
||||
if (stream) {
|
||||
@@ -590,10 +589,10 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
|
||||
test_IStream_invalid_operations(stream, mode);
|
||||
|
||||
refcount = IStream_Release(stream);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %ld\n", refcount);
|
||||
|
||||
delret = DeleteFileA(test_fileA);
|
||||
ok(delret, "SHCreateStreamOnFileEx: could not delete the test file, got error %d\n",
|
||||
ok(delret, "SHCreateStreamOnFileEx: could not delete the test file, got error %ld\n",
|
||||
GetLastError());
|
||||
}
|
||||
|
||||
@@ -604,17 +603,17 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
|
||||
Sleep(1000);
|
||||
ret = SHCreateStreamOnFileEx(test_file, mode | STGM_CREATE | stgm, 0, FALSE, NULL, &stream);
|
||||
}
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08lx\n", ret);
|
||||
ok(stream != NULL, "SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
|
||||
|
||||
if (stream) {
|
||||
test_IStream_invalid_operations(stream, mode);
|
||||
|
||||
refcount = IStream_Release(stream);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %ld\n", refcount);
|
||||
|
||||
delret = DeleteFileA(test_fileA);
|
||||
ok(delret, "SHCreateStreamOnFileEx: could not delete the test file, got error %d\n",
|
||||
ok(delret, "SHCreateStreamOnFileEx: could not delete the test file, got error %ld\n",
|
||||
GetLastError());
|
||||
}
|
||||
|
||||
@@ -625,14 +624,14 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
|
||||
Sleep(1000);
|
||||
ret = SHCreateStreamOnFileEx(test_file, mode | STGM_CREATE | stgm, 0, TRUE, NULL, &stream);
|
||||
}
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08lx\n", ret);
|
||||
ok(stream != NULL, "SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
|
||||
|
||||
if (stream) {
|
||||
test_IStream_invalid_operations(stream, mode);
|
||||
|
||||
refcount = IStream_Release(stream);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %ld\n", refcount);
|
||||
}
|
||||
|
||||
/* NOTE: don't delete the file, as it will be used for the file exists tests. */
|
||||
@@ -641,47 +640,47 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
|
||||
|
||||
stream = NULL;
|
||||
ret = SHCreateStreamOnFileEx(test_file, mode | STGM_FAILIFTHERE | stgm, 0, FALSE, NULL, &stream);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08lx\n", ret);
|
||||
ok(stream != NULL, "SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
|
||||
|
||||
if (stream) {
|
||||
test_IStream_invalid_operations(stream, mode);
|
||||
|
||||
refcount = IStream_Release(stream);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %ld\n", refcount);
|
||||
}
|
||||
|
||||
stream = NULL;
|
||||
ret = SHCreateStreamOnFileEx(test_file, mode | STGM_FAILIFTHERE | stgm, 0, TRUE, NULL, &stream);
|
||||
ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), got 0x%08x\n", ret);
|
||||
ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), got 0x%08lx\n", ret);
|
||||
ok(stream == NULL, "SHCreateStreamOnFileEx: expected a NULL IStream object, got %p\n", stream);
|
||||
|
||||
stream = NULL;
|
||||
ret = SHCreateStreamOnFileEx(test_file, mode | STGM_CREATE | stgm, 0, FALSE, NULL, &stream);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08lx\n", ret);
|
||||
ok(stream != NULL, "SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
|
||||
|
||||
if (stream) {
|
||||
test_IStream_invalid_operations(stream, mode);
|
||||
|
||||
refcount = IStream_Release(stream);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %ld\n", refcount);
|
||||
}
|
||||
|
||||
stream = NULL;
|
||||
ret = SHCreateStreamOnFileEx(test_file, mode | STGM_CREATE | stgm, 0, TRUE, NULL, &stream);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n", ret);
|
||||
ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08lx\n", ret);
|
||||
ok(stream != NULL, "SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
|
||||
|
||||
if (stream) {
|
||||
test_IStream_invalid_operations(stream, mode);
|
||||
|
||||
refcount = IStream_Release(stream);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
|
||||
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %ld\n", refcount);
|
||||
}
|
||||
|
||||
delret = DeleteFileA(test_fileA);
|
||||
ok(delret, "SHCreateStreamOnFileEx: could not delete the test file, got error %d\n",
|
||||
ok(delret, "SHCreateStreamOnFileEx: could not delete the test file, got error %ld\n",
|
||||
GetLastError());
|
||||
}
|
||||
|
||||
@@ -700,32 +699,32 @@ static void test_SHCreateStreamOnFileEx_CopyTo(void)
|
||||
|
||||
GetTempPathW(MAX_PATH, tmpPath);
|
||||
ret = GetTempFileNameW(tmpPath, prefix, 0, srcFileName);
|
||||
ok(ret != 0, "GetTempFileName failed, got error %d\n", GetLastError());
|
||||
ok(ret != 0, "GetTempFileName failed, got error %ld\n", GetLastError());
|
||||
ret = GetTempFileNameW(tmpPath, prefix, 0, dstFileName);
|
||||
ok(ret != 0, "GetTempFileName failed, got error %d\n", GetLastError());
|
||||
ok(ret != 0, "GetTempFileName failed, got error %ld\n", GetLastError());
|
||||
|
||||
ret = SHCreateStreamOnFileEx(srcFileName, STGM_CREATE | STGM_READWRITE | STGM_DELETEONRELEASE, FILE_ATTRIBUTE_TEMPORARY, FALSE, NULL, &src);
|
||||
ok(SUCCEEDED(ret), "SHCreateStreamOnFileEx failed with ret=0x%08x\n", ret);
|
||||
ok(SUCCEEDED(ret), "SHCreateStreamOnFileEx failed with ret=0x%08lx\n", ret);
|
||||
|
||||
written.QuadPart = 0;
|
||||
ret = IStream_Write(src, srcContents, sizeof(srcContents), &U(written).LowPart);
|
||||
ok(SUCCEEDED(ret), "ISequentialStream_Write failed with ret=0x%08x\n", ret);
|
||||
ret = IStream_Write(src, srcContents, sizeof(srcContents), &written.LowPart);
|
||||
ok(SUCCEEDED(ret), "ISequentialStream_Write failed with ret=0x%08lx\n", ret);
|
||||
|
||||
distance.QuadPart = 0;
|
||||
ret = IStream_Seek(src, distance, STREAM_SEEK_SET, &written);
|
||||
ok(SUCCEEDED(ret), "ISequentialStream_Seek failed with ret=0x%08x\n", ret);
|
||||
ok(SUCCEEDED(ret), "ISequentialStream_Seek failed with ret=0x%08lx\n", ret);
|
||||
|
||||
ret = SHCreateStreamOnFileEx(dstFileName, STGM_CREATE | STGM_READWRITE | STGM_DELETEONRELEASE, FILE_ATTRIBUTE_TEMPORARY, FALSE, NULL, &dst);
|
||||
ok(SUCCEEDED(ret), "SHCreateStreamOnFileEx failed with ret=0x%08x\n", ret);
|
||||
ok(SUCCEEDED(ret), "SHCreateStreamOnFileEx failed with ret=0x%08lx\n", ret);
|
||||
|
||||
/* Test using a count larger than the source file, so that the Read operation will fall short */
|
||||
count.QuadPart = 2;
|
||||
|
||||
ret = IStream_CopyTo(src, dst, count, &read, &written);
|
||||
ok(SUCCEEDED(ret), "CopyTo failed with ret=0x%08x\n", ret);
|
||||
ok(SUCCEEDED(ret), "CopyTo failed with ret=0x%08lx\n", ret);
|
||||
|
||||
ok(read.QuadPart == 1, "read does not match size: %d != 1\n", U(read).LowPart);
|
||||
ok(written.QuadPart == 1, "written does not match size: %d != 1\n", U(written).LowPart);
|
||||
ok(read.QuadPart == 1, "read does not match size: %ld != 1\n", read.LowPart);
|
||||
ok(written.QuadPart == 1, "written does not match size: %ld != 1\n", written.LowPart);
|
||||
|
||||
IStream_Release(dst);
|
||||
IStream_Release(src);
|
||||
@@ -737,8 +736,10 @@ static void test_SHCreateMemStream(void)
|
||||
{
|
||||
static const BYTE initial[10];
|
||||
IStream *stream, *stream2;
|
||||
LARGE_INTEGER off;
|
||||
IUnknown *unk;
|
||||
char buff[10];
|
||||
ULONG i, num;
|
||||
HRESULT hr;
|
||||
|
||||
stream = SHCreateMemStream(initial, 0);
|
||||
@@ -753,18 +754,76 @@ static void test_SHCreateMemStream(void)
|
||||
ok(stream != NULL, "Failed to create a stream.\n");
|
||||
|
||||
hr = IStream_QueryInterface(stream, &IID_ISequentialStream, (void **)&unk);
|
||||
todo_wine
|
||||
ok(hr == S_OK || broken(hr == E_NOINTERFACE) /* WinXP */, "Failed to QI, hr %#x.\n", hr);
|
||||
ok(hr == S_OK || broken(hr == E_NOINTERFACE) /* WinXP */, "Failed to QI, hr %#lx.\n", hr);
|
||||
if (unk)
|
||||
IUnknown_Release(unk);
|
||||
|
||||
hr = IStream_Read(stream, buff, sizeof(buff), NULL);
|
||||
todo_wine
|
||||
ok(hr == S_FALSE || broken(hr == S_OK) /* WinXP */, "Unexpected hr %#x.\n", hr);
|
||||
num = ~0;
|
||||
hr = IStream_Read(stream, buff, sizeof(buff), &num);
|
||||
#ifdef __REACTOS__
|
||||
ok(hr == S_FALSE || broken(hr == S_OK) /* WS03 */, "Unexpected hr %#lx.\n", hr);
|
||||
#else
|
||||
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
|
||||
#endif
|
||||
ok(num == 0, "expected 0, got 0x%08lx\n", num);
|
||||
|
||||
num = ~0;
|
||||
memset(buff, 0x55, sizeof(buff));
|
||||
hr = IStream_Write(stream, buff, sizeof(buff), &num);
|
||||
ok(hr == S_OK, "Failed to write, hr %#lx.\n", hr);
|
||||
ok(num == sizeof(buff), "expected %Iu, got %lu\n", sizeof(buff), num);
|
||||
|
||||
off.QuadPart = 0;
|
||||
hr = IStream_Seek(stream, off, STREAM_SEEK_SET, NULL);
|
||||
ok(hr == S_OK, "Failed to seek, hr %#lx.\n", hr);
|
||||
|
||||
num = ~0;
|
||||
memset(buff, 0, sizeof(buff));
|
||||
hr = IStream_Read(stream, buff, sizeof(buff), &num);
|
||||
ok(hr == S_OK, "Failed to read, hr %#lx.\n", hr);
|
||||
ok(num == sizeof(buff), "expected %Iu, got %lu\n", sizeof(buff), num);
|
||||
for (i = 0; i < ARRAY_SIZE(buff); i++)
|
||||
ok(buff[i] == 0x55, "expected 0x55, got 0x%02x at %lu\n", buff[i], i);
|
||||
|
||||
num = ~0;
|
||||
hr = IStream_Read(stream, buff, sizeof(buff), &num);
|
||||
#ifdef __REACTOS__
|
||||
ok(hr == S_FALSE || broken(hr == S_OK) /* WS03 */, "Unexpected hr %#lx.\n", hr);
|
||||
#else
|
||||
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
|
||||
#endif
|
||||
ok(num == 0, "expected 0, got 0x%08lx\n", num);
|
||||
|
||||
num = ~0;
|
||||
memset(buff, 0x11, sizeof(buff));
|
||||
hr = IStream_Write(stream, buff, sizeof(buff), &num);
|
||||
ok(hr == S_OK, "Failed to write, hr %#lx.\n", hr);
|
||||
ok(num == sizeof(buff), "expected %Iu, got %lu\n", sizeof(buff), num);
|
||||
|
||||
off.QuadPart = -sizeof(buff);
|
||||
hr = IStream_Seek(stream, off, STREAM_SEEK_CUR, NULL);
|
||||
ok(hr == S_OK, "Failed to seek, hr %#lx.\n", hr);
|
||||
|
||||
num = ~0;
|
||||
memset(buff, 0, sizeof(buff));
|
||||
hr = IStream_Read(stream, buff, sizeof(buff), &num);
|
||||
ok(hr == S_OK, "Failed to read, hr %#lx.\n", hr);
|
||||
ok(num == sizeof(buff), "expected %Iu, got %lu\n", sizeof(buff), num);
|
||||
for (i = 0; i < ARRAY_SIZE(buff); i++)
|
||||
ok(buff[i] == 0x11, "expected 0x11, got 0x%02x at %lu\n", buff[i], i);
|
||||
|
||||
num = ~0;
|
||||
hr = IStream_Read(stream, buff, sizeof(buff), &num);
|
||||
#ifdef __REACTOS__
|
||||
ok(hr == S_FALSE || broken(hr == S_OK) /* WS03 */, "Unexpected hr %#lx.\n", hr);
|
||||
#else
|
||||
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
|
||||
#endif
|
||||
ok(num == 0, "expected 0, got 0x%08lx\n", num);
|
||||
|
||||
hr = IStream_Clone(stream, &stream2);
|
||||
todo_wine
|
||||
ok(hr == S_OK || broken(hr == E_NOTIMPL) /* < Win8 */, "Failed to clone a stream, hr %#x.\n", hr);
|
||||
todo_wine
|
||||
ok(hr == S_OK || broken(hr == E_NOTIMPL) /* < Win8 */, "Failed to clone a stream, hr %#lx.\n", hr);
|
||||
if (hr == S_OK)
|
||||
IStream_Release(stream2);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -190,27 +190,13 @@ static LPWSTR GetWideString(const char *src)
|
||||
if (!src)
|
||||
return NULL;
|
||||
|
||||
ret = HeapAlloc(GetProcessHeap(), 0, (2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR));
|
||||
ret = malloc(2 * INTERNET_MAX_URL_LENGTH * sizeof(WCHAR));
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, src, -1, ret, INTERNET_MAX_URL_LENGTH);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void FreeWideString(LPWSTR wszString)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, wszString);
|
||||
}
|
||||
|
||||
static LPSTR strdupA(LPCSTR p)
|
||||
{
|
||||
LPSTR ret;
|
||||
DWORD len = (strlen(p) + 1);
|
||||
ret = HeapAlloc(GetProcessHeap(), 0, len);
|
||||
memcpy(ret, p, len);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* ################ */
|
||||
|
||||
static void test_PathSearchAndQualify(void)
|
||||
@@ -279,19 +265,19 @@ static void test_PathCreateFromUrl(void)
|
||||
/* Won't say how much is needed without a buffer */
|
||||
len = 0xdeca;
|
||||
ret = pPathCreateFromUrlA("file://foo", NULL, &len, 0);
|
||||
ok(ret == E_INVALIDARG, "got 0x%08x expected E_INVALIDARG\n", ret);
|
||||
ok(len == 0xdeca, "got %x expected 0xdeca\n", len);
|
||||
ok(ret == E_INVALIDARG, "got 0x%08lx expected E_INVALIDARG\n", ret);
|
||||
ok(len == 0xdeca, "got %lx expected 0xdeca\n", len);
|
||||
|
||||
/* Test the decoding itself */
|
||||
for (i = 0; i < ARRAY_SIZE(TEST_PATHFROMURL); i++) {
|
||||
len = INTERNET_MAX_URL_LENGTH;
|
||||
ret = pPathCreateFromUrlA(TEST_PATHFROMURL[i].url, ret_path, &len, 0);
|
||||
todo_wine_if (TEST_PATHFROMURL[i].todo & 0x1)
|
||||
ok(ret == TEST_PATHFROMURL[i].ret, "ret %08x from url %s\n", ret, TEST_PATHFROMURL[i].url);
|
||||
ok(ret == TEST_PATHFROMURL[i].ret, "ret %08lx from url %s\n", ret, TEST_PATHFROMURL[i].url);
|
||||
if(SUCCEEDED(ret) && TEST_PATHFROMURL[i].path) {
|
||||
if(!(TEST_PATHFROMURL[i].todo & 0x2)) {
|
||||
ok(!lstrcmpiA(ret_path, TEST_PATHFROMURL[i].path), "got %s expected %s from url %s\n", ret_path, TEST_PATHFROMURL[i].path, TEST_PATHFROMURL[i].url);
|
||||
ok(len == strlen(ret_path), "ret len %d from url %s\n", len, TEST_PATHFROMURL[i].url);
|
||||
ok(len == strlen(ret_path), "ret len %ld from url %s\n", len, TEST_PATHFROMURL[i].url);
|
||||
} else todo_wine
|
||||
/* Wrong string, don't bother checking the length */
|
||||
ok(!lstrcmpiA(ret_path, TEST_PATHFROMURL[i].path), "got %s expected %s from url %s\n", ret_path, TEST_PATHFROMURL[i].path, TEST_PATHFROMURL[i].url);
|
||||
@@ -304,12 +290,12 @@ static void test_PathCreateFromUrl(void)
|
||||
ret = pPathCreateFromUrlW(urlW, ret_pathW, &len, 0);
|
||||
WideCharToMultiByte(CP_ACP, 0, ret_pathW, -1, ret_path, sizeof(ret_path),NULL,NULL);
|
||||
todo_wine_if (TEST_PATHFROMURL[i].todo & 0x1)
|
||||
ok(ret == TEST_PATHFROMURL[i].ret, "ret %08x from url L\"%s\"\n", ret, TEST_PATHFROMURL[i].url);
|
||||
ok(ret == TEST_PATHFROMURL[i].ret, "ret %08lx from url L\"%s\"\n", ret, TEST_PATHFROMURL[i].url);
|
||||
if(SUCCEEDED(ret) && TEST_PATHFROMURL[i].path) {
|
||||
if(!(TEST_PATHFROMURL[i].todo & 0x2)) {
|
||||
ok(!lstrcmpiW(ret_pathW, pathW), "got %s expected %s from url L\"%s\"\n",
|
||||
ret_path, TEST_PATHFROMURL[i].path, TEST_PATHFROMURL[i].url);
|
||||
ok(len == lstrlenW(ret_pathW), "ret len %d from url L\"%s\"\n", len, TEST_PATHFROMURL[i].url);
|
||||
ok(len == lstrlenW(ret_pathW), "ret len %ld from url L\"%s\"\n", len, TEST_PATHFROMURL[i].url);
|
||||
} else todo_wine
|
||||
/* Wrong string, don't bother checking the length */
|
||||
ok(!lstrcmpiW(ret_pathW, pathW), "got %s expected %s from url L\"%s\"\n",
|
||||
@@ -321,13 +307,13 @@ static void test_PathCreateFromUrl(void)
|
||||
/* Check what happens if the buffer is too small */
|
||||
len2 = 2;
|
||||
ret = pPathCreateFromUrlW(urlW, ret_pathW, &len2, 0);
|
||||
ok(ret == E_POINTER, "ret %08x, expected E_POINTER from url %s\n", ret, TEST_PATHFROMURL[i].url);
|
||||
ok(ret == E_POINTER, "ret %08lx, expected E_POINTER from url %s\n", ret, TEST_PATHFROMURL[i].url);
|
||||
todo_wine_if (TEST_PATHFROMURL[i].todo & 0x4)
|
||||
ok(len2 == len + 1, "got len = %d expected %d from url %s\n", len2, len + 1, TEST_PATHFROMURL[i].url);
|
||||
ok(len2 == len + 1, "got len = %ld expected %ld from url %s\n", len2, len + 1, TEST_PATHFROMURL[i].url);
|
||||
}
|
||||
|
||||
FreeWideString(urlW);
|
||||
FreeWideString(pathW);
|
||||
free(urlW);
|
||||
free(pathW);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,9 +324,9 @@ static void test_PathCreateFromUrl(void)
|
||||
|
||||
pathW = NULL;
|
||||
ret = pPathCreateFromUrlAlloc(fileW, &pathW, 0);
|
||||
ok(ret == S_OK, "got 0x%08x expected S_OK\n", ret);
|
||||
ok(ret == S_OK, "got 0x%08lx expected S_OK\n", ret);
|
||||
ok(lstrcmpiW(pathW, fooW) == 0, "got %s expected %s\n", wine_dbgstr_w(pathW), wine_dbgstr_w(fooW));
|
||||
HeapFree(GetProcessHeap(), 0, pathW);
|
||||
LocalFree(pathW);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -513,7 +499,7 @@ static void test_PathCombineW(void)
|
||||
return;
|
||||
}
|
||||
|
||||
wszString2 = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR));
|
||||
wszString2 = malloc(MAX_PATH * sizeof(WCHAR));
|
||||
|
||||
/* NULL test */
|
||||
wszString = pPathCombineW(NULL, NULL, NULL);
|
||||
@@ -529,7 +515,7 @@ static void test_PathCombineW(void)
|
||||
broken(wszString2[0] == 'a'), /* Win95 and some W2K */
|
||||
"Destination string not empty\n");
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, wszString2);
|
||||
free(wszString2);
|
||||
|
||||
/* overflow test */
|
||||
wstr2[0] = wstr2[1] = wstr2[2] = 'A';
|
||||
@@ -566,19 +552,19 @@ static void test_PathCombineA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
str = PathCombineA(NULL, "C:\\", "one\\two\\three");
|
||||
ok(str == NULL, "Expected NULL, got %p\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try NULL dest and NULL directory */
|
||||
SetLastError(0xdeadbeef);
|
||||
str = PathCombineA(NULL, NULL, "one\\two\\three");
|
||||
ok(str == NULL, "Expected NULL, got %p\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try all NULL*/
|
||||
SetLastError(0xdeadbeef);
|
||||
str = PathCombineA(NULL, NULL, NULL);
|
||||
ok(str == NULL, "Expected NULL, got %p\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try NULL file part */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -586,7 +572,7 @@ static void test_PathCombineA(void)
|
||||
str = PathCombineA(dest, "C:\\", NULL);
|
||||
ok(str == dest, "Expected str == dest, got %p\n", str);
|
||||
ok(!lstrcmpA(str, "C:\\"), "Expected C:\\, got %s\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try empty file part */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -594,7 +580,7 @@ static void test_PathCombineA(void)
|
||||
str = PathCombineA(dest, "C:\\", "");
|
||||
ok(str == dest, "Expected str == dest, got %p\n", str);
|
||||
ok(!lstrcmpA(str, "C:\\"), "Expected C:\\, got %s\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try empty directory and file part */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -604,7 +590,7 @@ static void test_PathCombineA(void)
|
||||
ok(!lstrcmpA(str, "\\") ||
|
||||
broken(!lstrcmpA(str, "control")), /* Win95 and some W2K */
|
||||
"Expected \\, got %s\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try NULL directory */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -612,7 +598,7 @@ static void test_PathCombineA(void)
|
||||
str = PathCombineA(dest, NULL, "one\\two\\three");
|
||||
ok(str == dest, "Expected str == dest, got %p\n", str);
|
||||
ok(!lstrcmpA(str, "one\\two\\three"), "Expected one\\two\\three, got %s\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try NULL directory and empty file part */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -624,7 +610,7 @@ static void test_PathCombineA(void)
|
||||
"Expected \\, got %s\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef ||
|
||||
broken(GetLastError() == ERROR_INVALID_PARAMETER), /* Win95 */
|
||||
"Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
"Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try NULL directory and file part */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -635,7 +621,7 @@ static void test_PathCombineA(void)
|
||||
"Expected str == NULL, got %p\n", str);
|
||||
ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
|
||||
"Expected 0 length, got %i\n", lstrlenA(dest));
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try directory without backslash */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -643,7 +629,7 @@ static void test_PathCombineA(void)
|
||||
str = PathCombineA(dest, "C:", "one\\two\\three");
|
||||
ok(str == dest, "Expected str == dest, got %p\n", str);
|
||||
ok(!lstrcmpA(str, "C:\\one\\two\\three"), "Expected C:\\one\\two\\three, got %s\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try directory with backslash */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -651,7 +637,7 @@ static void test_PathCombineA(void)
|
||||
str = PathCombineA(dest, "C:\\", "one\\two\\three");
|
||||
ok(str == dest, "Expected str == dest, got %p\n", str);
|
||||
ok(!lstrcmpA(str, "C:\\one\\two\\three"), "Expected C:\\one\\two\\three, got %s\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try directory with backslash and file with prepended backslash */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -659,7 +645,7 @@ static void test_PathCombineA(void)
|
||||
str = PathCombineA(dest, "C:\\", "\\one\\two\\three");
|
||||
ok(str == dest, "Expected str == dest, got %p\n", str);
|
||||
ok(!lstrcmpA(str, "C:\\one\\two\\three"), "Expected C:\\one\\two\\three, got %s\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try previous test, with backslash appended as well */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -667,13 +653,13 @@ static void test_PathCombineA(void)
|
||||
str = PathCombineA(dest, "C:\\", "\\one\\two\\three\\");
|
||||
ok(str == dest, "Expected str == dest, got %p\n", str);
|
||||
ok(!lstrcmpA(str, "C:\\one\\two\\three\\"), "Expected C:\\one\\two\\three\\, got %s\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try a relative directory */
|
||||
SetLastError(0xdeadbeef);
|
||||
lstrcpyA(dest, "control");
|
||||
str = PathCombineA(dest, "relative\\dir", "\\one\\two\\three\\");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
/* Vista fails which probably makes sense as PathCombineA expects an absolute dir */
|
||||
if (str)
|
||||
{
|
||||
@@ -687,7 +673,7 @@ static void test_PathCombineA(void)
|
||||
str = PathCombineA(dest, "C:\\", "one/two/three\\");
|
||||
ok(str == dest, "Expected str == dest, got %p\n", str);
|
||||
ok(!lstrcmpA(str, "C:\\one/two/three\\"), "Expected one/two/three\\, got %s\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try a really weird directory */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -695,7 +681,7 @@ static void test_PathCombineA(void)
|
||||
str = PathCombineA(dest, "C:\\/\\/", "\\one\\two\\three\\");
|
||||
ok(str == dest, "Expected str == dest, got %p\n", str);
|
||||
ok(!lstrcmpA(str, "C:\\one\\two\\three\\"), "Expected C:\\one\\two\\three\\, got %s\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try periods */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -703,7 +689,7 @@ static void test_PathCombineA(void)
|
||||
str = PathCombineA(dest, "C:\\", "one\\..\\two\\.\\three");
|
||||
ok(str == dest, "Expected str == dest, got %p\n", str);
|
||||
ok(!lstrcmpA(str, "C:\\two\\three"), "Expected C:\\two\\three, got %s\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try .. as file */
|
||||
/* try forward slashes */
|
||||
@@ -712,7 +698,16 @@ static void test_PathCombineA(void)
|
||||
str = PathCombineA(dest, "C:\\", "..");
|
||||
ok(str == dest, "Expected str == dest, got %p\n", str);
|
||||
ok(!lstrcmpA(str, "C:\\"), "Expected C:\\, got %s\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try relative paths */
|
||||
/* try forward slashes */
|
||||
SetLastError(0xdeadbeef);
|
||||
lstrcpyA(dest, "control");
|
||||
str = PathCombineA(dest, "../../../one/two/", "*");
|
||||
ok(str == dest, "Expected str == dest, got %p\n", str);
|
||||
ok(!lstrcmpA(str, "../../../one/two/\\*"), "Expected ../../../one/two/\\*, got %s\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
memset(too_long, 'a', LONG_LEN);
|
||||
too_long[LONG_LEN - 1] = '\0';
|
||||
@@ -724,7 +719,7 @@ static void test_PathCombineA(void)
|
||||
ok(str == NULL, "Expected str == NULL, got %p\n", str);
|
||||
ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
|
||||
"Expected 0 length, got %i\n", lstrlenA(dest));
|
||||
todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try a directory longer than MAX_PATH */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -733,7 +728,7 @@ static void test_PathCombineA(void)
|
||||
ok(str == NULL, "Expected str == NULL, got %p\n", str);
|
||||
ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
|
||||
"Expected 0 length, got %i\n", lstrlenA(dest));
|
||||
todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
memset(one, 'b', HALF_LEN);
|
||||
memset(two, 'c', HALF_LEN);
|
||||
@@ -747,7 +742,7 @@ static void test_PathCombineA(void)
|
||||
ok(str == NULL, "Expected str == NULL, got %p\n", str);
|
||||
ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
|
||||
"Expected 0 length, got %i\n", lstrlenA(dest));
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
}
|
||||
|
||||
static void test_PathAddBackslash(void)
|
||||
@@ -760,7 +755,7 @@ static void test_PathAddBackslash(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
str = PathAddBackslashA(NULL);
|
||||
ok(str == NULL, "Expected str == NULL, got %p\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try an empty path */
|
||||
path[0] = '\0';
|
||||
@@ -768,7 +763,7 @@ static void test_PathAddBackslash(void)
|
||||
str = PathAddBackslashA(path);
|
||||
ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
|
||||
ok(!path[0], "Expected empty string, got %i\n", lstrlenA(path));
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try a relative path */
|
||||
lstrcpyA(path, "one\\two");
|
||||
@@ -776,7 +771,7 @@ static void test_PathAddBackslash(void)
|
||||
str = PathAddBackslashA(path);
|
||||
ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
|
||||
ok(!lstrcmpA(path, "one\\two\\"), "Expected one\\two\\, got %s\n", path);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try periods */
|
||||
lstrcpyA(path, "one\\..\\two");
|
||||
@@ -784,7 +779,7 @@ static void test_PathAddBackslash(void)
|
||||
str = PathAddBackslashA(path);
|
||||
ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
|
||||
ok(!lstrcmpA(path, "one\\..\\two\\"), "Expected one\\..\\two\\, got %s\n", path);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try just a space */
|
||||
lstrcpyA(path, " ");
|
||||
@@ -792,7 +787,7 @@ static void test_PathAddBackslash(void)
|
||||
str = PathAddBackslashA(path);
|
||||
ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
|
||||
ok(!lstrcmpA(path, " \\"), "Expected \\, got %s\n", path);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* path already has backslash */
|
||||
lstrcpyA(path, "C:\\one\\");
|
||||
@@ -800,7 +795,7 @@ static void test_PathAddBackslash(void)
|
||||
str = PathAddBackslashA(path);
|
||||
ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
|
||||
ok(!lstrcmpA(path, "C:\\one\\"), "Expected C:\\one\\, got %s\n", path);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
memset(too_long, 'a', LONG_LEN);
|
||||
too_long[LONG_LEN - 1] = '\0';
|
||||
@@ -809,7 +804,7 @@ static void test_PathAddBackslash(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
str = PathAddBackslashA(too_long);
|
||||
ok(str == NULL, "Expected str == NULL, got %p\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
}
|
||||
|
||||
static void test_PathAppendA(void)
|
||||
@@ -825,28 +820,28 @@ static void test_PathAppendA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathAppendA(path, NULL);
|
||||
ok(!res, "Expected failure\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(path, "C:\\one"), "Expected C:\\one, got %s\n", path);
|
||||
|
||||
/* try empty pszMore */
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathAppendA(path, "");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(path, "C:\\one"), "Expected C:\\one, got %s\n", path);
|
||||
|
||||
/* try NULL pszPath */
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathAppendA(NULL, "two\\three");
|
||||
ok(!res, "Expected failure\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try empty pszPath */
|
||||
path[0] = '\0';
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathAppendA(path, "two\\three");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(path, "two\\three"), "Expected \\two\\three, got %s\n", path);
|
||||
|
||||
/* try empty pszPath and empty pszMore */
|
||||
@@ -854,7 +849,7 @@ static void test_PathAppendA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathAppendA(path, "");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(path, "\\"), "Expected \\, got %s\n", path);
|
||||
|
||||
/* try legit params */
|
||||
@@ -862,7 +857,7 @@ static void test_PathAppendA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathAppendA(path, "two\\three");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(path, "C:\\one\\two\\three"), "Expected C:\\one\\two\\three, got %s\n", path);
|
||||
|
||||
/* try pszPath with backslash after it */
|
||||
@@ -870,7 +865,7 @@ static void test_PathAppendA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathAppendA(path, "two\\three");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(path, "C:\\one\\two\\three"), "Expected C:\\one\\two\\three, got %s\n", path);
|
||||
|
||||
/* try pszMore with backslash before it */
|
||||
@@ -878,7 +873,7 @@ static void test_PathAppendA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathAppendA(path, "\\two\\three");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(path, "C:\\one\\two\\three"), "Expected C:\\one\\two\\three, got %s\n", path);
|
||||
|
||||
/* try pszMore with backslash after it */
|
||||
@@ -886,7 +881,7 @@ static void test_PathAppendA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathAppendA(path, "two\\three\\");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(path, "C:\\one\\two\\three\\"), "Expected C:\\one\\two\\three\\, got %s\n", path);
|
||||
|
||||
/* try spaces in pszPath */
|
||||
@@ -894,7 +889,7 @@ static void test_PathAppendA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathAppendA(path, "two\\three");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(path, "C: \\ one \\two\\three"), "Expected C: \\ one \\two\\three, got %s\n", path);
|
||||
|
||||
/* try spaces in pszMore */
|
||||
@@ -902,7 +897,7 @@ static void test_PathAppendA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathAppendA(path, " two \\ three ");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(path, "C:\\one\\ two \\ three "), "Expected 'C:\\one\\ two \\ three ', got %s\n", path);
|
||||
|
||||
/* pszPath is too long */
|
||||
@@ -911,7 +906,7 @@ static void test_PathAppendA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathAppendA(too_long, "two\\three");
|
||||
ok(!res, "Expected failure\n");
|
||||
todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!too_long[0] || broken(lstrlenA(too_long) == (LONG_LEN - 1)), /* Win95 and some W2K */
|
||||
"Expected length of too_long to be zero, got %i\n", lstrlenA(too_long));
|
||||
|
||||
@@ -922,7 +917,7 @@ static void test_PathAppendA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathAppendA(path, too_long);
|
||||
ok(!res, "Expected failure\n");
|
||||
todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!path[0] || broken(!lstrcmpA(path, "C:\\one")), /* Win95 and some W2K */
|
||||
"Expected length of path to be zero, got %i\n", lstrlenA(path));
|
||||
|
||||
@@ -936,7 +931,7 @@ static void test_PathAppendA(void)
|
||||
ok(!res, "Expected failure\n");
|
||||
ok(!path[0] || broken(lstrlenA(path) == (HALF_LEN - 1)), /* Win95 and some W2K */
|
||||
"Expected length of path to be zero, got %i\n", lstrlenA(path));
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
}
|
||||
|
||||
static void test_PathCanonicalizeA(void)
|
||||
@@ -951,7 +946,7 @@ static void test_PathCanonicalizeA(void)
|
||||
res = PathCanonicalizeA(dest, NULL);
|
||||
ok(!res, "Expected failure\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
||||
ok(dest[0] == 0 || !lstrcmpA(dest, "test"),
|
||||
"Expected either an empty string (Vista) or test, got %s\n", dest);
|
||||
|
||||
@@ -960,7 +955,7 @@ static void test_PathCanonicalizeA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathCanonicalizeA(dest, "");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(dest, "\\") ||
|
||||
broken(!lstrcmpA(dest, "test")), /* Win95 and some W2K */
|
||||
"Expected \\, got %s\n", dest);
|
||||
@@ -970,14 +965,14 @@ static void test_PathCanonicalizeA(void)
|
||||
res = PathCanonicalizeA(NULL, "C:\\");
|
||||
ok(!res, "Expected failure\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
||||
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
||||
|
||||
/* try empty dest */
|
||||
dest[0] = '\0';
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathCanonicalizeA(dest, "C:\\");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(dest, "C:\\"), "Expected C:\\, got %s\n", dest);
|
||||
|
||||
/* try non-empty dest */
|
||||
@@ -985,7 +980,7 @@ static void test_PathCanonicalizeA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathCanonicalizeA(dest, "C:\\");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(dest, "C:\\"), "Expected C:\\, got %s\n", dest);
|
||||
|
||||
/* try a space for source */
|
||||
@@ -993,7 +988,7 @@ static void test_PathCanonicalizeA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathCanonicalizeA(dest, " ");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(dest, " "), "Expected ' ', got %s\n", dest);
|
||||
|
||||
/* try a relative path */
|
||||
@@ -1001,7 +996,7 @@ static void test_PathCanonicalizeA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathCanonicalizeA(dest, "one\\two");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(dest, "one\\two"), "Expected one\\two, got %s\n", dest);
|
||||
|
||||
/* try current dir and previous dir */
|
||||
@@ -1009,7 +1004,7 @@ static void test_PathCanonicalizeA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathCanonicalizeA(dest, "C:\\one\\.\\..\\two\\three\\..");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(dest, "C:\\two"), "Expected C:\\two, got %s\n", dest);
|
||||
|
||||
/* try simple forward slashes */
|
||||
@@ -1017,7 +1012,7 @@ static void test_PathCanonicalizeA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathCanonicalizeA(dest, "C:\\one/two/three\\four/five\\six");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(dest, "C:\\one/two/three\\four/five\\six"),
|
||||
"Expected C:\\one/two/three\\four/five\\six, got %s\n", dest);
|
||||
|
||||
@@ -1026,7 +1021,7 @@ static void test_PathCanonicalizeA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathCanonicalizeA(dest, "C:\\one/.\\two");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(dest, "C:\\one/.\\two"), "Expected C:\\one/.\\two, got %s\n", dest);
|
||||
|
||||
/* try simple forward slashes with change dir */
|
||||
@@ -1034,11 +1029,27 @@ static void test_PathCanonicalizeA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathCanonicalizeA(dest, "C:\\one/.\\two\\..");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(dest, "C:\\one/.") ||
|
||||
!lstrcmpA(dest, "C:\\one/"), /* Vista */
|
||||
"Expected \"C:\\one/.\" or \"C:\\one/\", got \"%s\"\n", dest);
|
||||
|
||||
/* try relative forward slashes */
|
||||
lstrcpyA(dest, "test");
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathCanonicalizeA(dest, "../../one/two/");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(dest, "../../one/two/"), "Expected ../../one/two/, got %s\n", dest);
|
||||
|
||||
/* try relative forward slashes */
|
||||
lstrcpyA(dest, "test");
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathCanonicalizeA(dest, "../../one/two/\\*");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(dest, "../../one/two/\\*"), "Expected ../../one/two/\\*, got %s\n", dest);
|
||||
|
||||
/* try forward slashes with change dirs
|
||||
* NOTE: if there is a forward slash in between two backslashes,
|
||||
* everything in between the two backslashes is considered on dir
|
||||
@@ -1047,7 +1058,7 @@ static void test_PathCanonicalizeA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathCanonicalizeA(dest, "C:\\one/.\\..\\two/three\\..\\four/.five");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
ok(!lstrcmpA(dest, "C:\\four/.five"), "Expected C:\\four/.five, got %s\n", dest);
|
||||
|
||||
/* try src is too long */
|
||||
@@ -1062,7 +1073,7 @@ static void test_PathCanonicalizeA(void)
|
||||
todo_wine
|
||||
{
|
||||
ok(GetLastError() == 0xdeadbeef || GetLastError() == ERROR_FILENAME_EXCED_RANGE /* Vista */,
|
||||
"Expected 0xdeadbeef or ERROR_FILENAME_EXCED_RANGE, got %d\n", GetLastError());
|
||||
"Expected 0xdeadbeef or ERROR_FILENAME_EXCED_RANGE, got %ld\n", GetLastError());
|
||||
}
|
||||
ok(lstrlenA(too_long) == LONG_LEN - 1, "Expected length LONG_LEN - 1, got %i\n", lstrlenA(too_long));
|
||||
}
|
||||
@@ -1077,7 +1088,7 @@ static void test_PathFindExtensionA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
ext = PathFindExtensionA(NULL);
|
||||
ok(ext == NULL, "Expected NULL, got %p\n", ext);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try an empty path */
|
||||
path[0] = '\0';
|
||||
@@ -1085,7 +1096,7 @@ static void test_PathFindExtensionA(void)
|
||||
ext = PathFindExtensionA(path);
|
||||
ok(ext == path, "Expected ext == path, got %p\n", ext);
|
||||
ok(!ext[0], "Expected length 0, got %i\n", lstrlenA(ext));
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try a path without an extension */
|
||||
lstrcpyA(path, "file");
|
||||
@@ -1093,7 +1104,7 @@ static void test_PathFindExtensionA(void)
|
||||
ext = PathFindExtensionA(path);
|
||||
ok(ext == path + lstrlenA(path), "Expected ext == path, got %p\n", ext);
|
||||
ok(!ext[0], "Expected length 0, got %i\n", lstrlenA(ext));
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try a path with an extension */
|
||||
lstrcpyA(path, "file.txt");
|
||||
@@ -1102,7 +1113,7 @@ static void test_PathFindExtensionA(void)
|
||||
ok(ext == path + lstrlenA("file"),
|
||||
"Expected ext == path + lstrlenA(\"file\"), got %p\n", ext);
|
||||
ok(!lstrcmpA(ext, ".txt"), "Expected .txt, got %s\n", ext);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try a path with two extensions */
|
||||
lstrcpyA(path, "file.txt.doc");
|
||||
@@ -1111,7 +1122,7 @@ static void test_PathFindExtensionA(void)
|
||||
ok(ext == path + lstrlenA("file.txt"),
|
||||
"Expected ext == path + lstrlenA(\"file.txt\"), got %p\n", ext);
|
||||
ok(!lstrcmpA(ext, ".doc"), "Expected .txt, got %s\n", ext);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try a path longer than MAX_PATH without an extension*/
|
||||
memset(too_long, 'a', LONG_LEN);
|
||||
@@ -1119,7 +1130,7 @@ static void test_PathFindExtensionA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
ext = PathFindExtensionA(too_long);
|
||||
ok(ext == too_long + LONG_LEN - 1, "Expected ext == too_long + LONG_LEN - 1, got %p\n", ext);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try a path longer than MAX_PATH with an extension*/
|
||||
memset(too_long, 'a', LONG_LEN);
|
||||
@@ -1130,7 +1141,7 @@ static void test_PathFindExtensionA(void)
|
||||
ext = PathFindExtensionA(too_long);
|
||||
ok(ext == too_long + 300, "Expected ext == too_long + 300, got %p\n", ext);
|
||||
ok(lstrlenA(ext) == LONG_LEN - 301, "Expected LONG_LEN - 301, got %i\n", lstrlenA(ext));
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
}
|
||||
|
||||
static void test_PathBuildRootA(void)
|
||||
@@ -1153,7 +1164,7 @@ static void test_PathBuildRootA(void)
|
||||
root = PathBuildRootA(path, j);
|
||||
ok(root == path, "Expected root == path, got %p\n", root);
|
||||
ok(!lstrcmpA(root, root_expected[j]), "Expected %s, got %s\n", root_expected[j], root);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
}
|
||||
|
||||
/* test a negative drive number */
|
||||
@@ -1163,7 +1174,7 @@ static void test_PathBuildRootA(void)
|
||||
ok(root == path, "Expected root == path, got %p\n", root);
|
||||
ok(!lstrcmpA(path, "aaaaaaaaa") || !path[0], /* Vista */
|
||||
"Expected aaaaaaaaa or empty string, got %s\n", path);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* test a drive number greater than 25 */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -1172,7 +1183,7 @@ static void test_PathBuildRootA(void)
|
||||
ok(root == path, "Expected root == path, got %p\n", root);
|
||||
ok(!lstrcmpA(path, "aaaaaaaaa") || !path[0], /* Vista */
|
||||
"Expected aaaaaaaaa or empty string, got %s\n", path);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* length of path is less than 4 */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -1180,13 +1191,13 @@ static void test_PathBuildRootA(void)
|
||||
root = PathBuildRootA(path, 0);
|
||||
ok(root == path, "Expected root == path, got %p\n", root);
|
||||
ok(!lstrcmpA(path, "A:\\"), "Expected A:\\, got %s\n", path);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* path is NULL */
|
||||
SetLastError(0xdeadbeef);
|
||||
root = PathBuildRootA(NULL, 0);
|
||||
ok(root == NULL, "Expected root == NULL, got %p\n", root);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
}
|
||||
|
||||
static void test_PathCommonPrefixA(void)
|
||||
@@ -1206,7 +1217,7 @@ static void test_PathCommonPrefixA(void)
|
||||
ok(!lstrcmpA(out, "aaa"), "Expected aaa, got %s\n", out);
|
||||
}
|
||||
ok(!lstrcmpA(path2, "C:\\"), "Expected C:\\, got %s\n", path2);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* test NULL path2 */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -1219,7 +1230,7 @@ static void test_PathCommonPrefixA(void)
|
||||
ok(!lstrcmpA(out, "aaa"), "Expected aaa, got %s\n", out);
|
||||
}
|
||||
ok(!lstrcmpA(path1, "C:\\"), "Expected C:\\, got %s\n", path1);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* test empty path1 */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -1231,7 +1242,7 @@ static void test_PathCommonPrefixA(void)
|
||||
ok(!out[0], "Expected 0 length out, got %i\n", lstrlenA(out));
|
||||
ok(!path1[0], "Expected 0 length path1, got %i\n", lstrlenA(path1));
|
||||
ok(!lstrcmpA(path2, "C:\\"), "Expected C:\\, got %s\n", path2);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* test empty path1 */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -1243,7 +1254,7 @@ static void test_PathCommonPrefixA(void)
|
||||
ok(!out[0], "Expected 0 length out, got %i\n", lstrlenA(out));
|
||||
ok(!path2[0], "Expected 0 length path2, got %i\n", lstrlenA(path2));
|
||||
ok(!lstrcmpA(path1, "C:\\"), "Expected C:\\, got %s\n", path1);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* paths are legit, out is NULL */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -1253,7 +1264,7 @@ static void test_PathCommonPrefixA(void)
|
||||
ok(count == 3, "Expected 3, got %i\n", count);
|
||||
ok(!lstrcmpA(path1, "C:\\"), "Expected C:\\, got %s\n", path1);
|
||||
ok(!lstrcmpA(path2, "C:\\"), "Expected C:\\, got %s\n", path2);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* all parameters legit */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -1265,7 +1276,7 @@ static void test_PathCommonPrefixA(void)
|
||||
ok(!lstrcmpA(path1, "C:\\"), "Expected C:\\, got %s\n", path1);
|
||||
ok(!lstrcmpA(path2, "C:\\"), "Expected C:\\, got %s\n", path2);
|
||||
ok(!lstrcmpA(out, "C:\\"), "Expected C:\\, got %s\n", out);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* path1 and path2 not the same, but common prefix */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -1277,7 +1288,7 @@ static void test_PathCommonPrefixA(void)
|
||||
ok(!lstrcmpA(path1, "C:\\one\\two"), "Expected C:\\one\\two, got %s\n", path1);
|
||||
ok(!lstrcmpA(path2, "C:\\one\\three"), "Expected C:\\one\\three, got %s\n", path2);
|
||||
ok(!lstrcmpA(out, "C:\\one"), "Expected C:\\one, got %s\n", out);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try . prefix */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -1289,7 +1300,7 @@ static void test_PathCommonPrefixA(void)
|
||||
ok(!lstrcmpA(path1, "one\\.two"), "Expected one\\.two, got %s\n", path1);
|
||||
ok(!lstrcmpA(path2, "one\\.three"), "Expected one\\.three, got %s\n", path2);
|
||||
ok(!lstrcmpA(out, "one"), "Expected one, got %s\n", out);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try .. prefix */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -1301,7 +1312,7 @@ static void test_PathCommonPrefixA(void)
|
||||
ok(!lstrcmpA(path1, "one\\..two"), "Expected one\\..two, got %s\n", path1);
|
||||
ok(!lstrcmpA(path2, "one\\..three"), "Expected one\\..three, got %s\n", path2);
|
||||
ok(!lstrcmpA(out, "one"), "Expected one, got %s\n", out);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try ... prefix */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -1313,7 +1324,7 @@ static void test_PathCommonPrefixA(void)
|
||||
ok(!lstrcmpA(path1, "one\\...two"), "Expected one\\...two, got %s\n", path1);
|
||||
ok(!lstrcmpA(path2, "one\\...three"), "Expected one\\...three, got %s\n", path2);
|
||||
ok(!lstrcmpA(out, "one"), "Expected one, got %s\n", out);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try .\ prefix */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -1325,7 +1336,7 @@ static void test_PathCommonPrefixA(void)
|
||||
ok(!lstrcmpA(path1, "one\\.\\two"), "Expected one\\.\\two, got %s\n", path1);
|
||||
ok(!lstrcmpA(path2, "one\\.\\three"), "Expected one\\.\\three, got %s\n", path2);
|
||||
ok(!lstrcmpA(out, "one\\."), "Expected one\\., got %s\n", out);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try ..\ prefix */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -1337,7 +1348,7 @@ static void test_PathCommonPrefixA(void)
|
||||
ok(!lstrcmpA(path1, "one\\..\\two"), "Expected one\\..\\two, got %s\n", path1);
|
||||
ok(!lstrcmpA(path2, "one\\..\\three"), "Expected one\\..\\three, got %s\n", path2);
|
||||
ok(!lstrcmpA(out, "one\\.."), "Expected one\\.., got %s\n", out);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try ...\\ prefix */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -1349,7 +1360,7 @@ static void test_PathCommonPrefixA(void)
|
||||
ok(!lstrcmpA(path1, "one\\...\\two"), "Expected one\\...\\two, got %s\n", path1);
|
||||
ok(!lstrcmpA(path2, "one\\...\\three"), "Expected one\\...\\three, got %s\n", path2);
|
||||
ok(!lstrcmpA(out, "one\\..."), "Expected one\\..., got %s\n", out);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try prefix that is not an msdn labeled prefix type */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -1361,7 +1372,7 @@ static void test_PathCommonPrefixA(void)
|
||||
ok(!lstrcmpA(path1, "same"), "Expected same, got %s\n", path1);
|
||||
ok(!lstrcmpA(path2, "same"), "Expected same, got %s\n", path2);
|
||||
ok(!lstrcmpA(out, "same"), "Expected same, got %s\n", out);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try . after directory */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -1373,7 +1384,7 @@ static void test_PathCommonPrefixA(void)
|
||||
ok(!lstrcmpA(path1, "one\\mid.\\two"), "Expected one\\mid.\\two, got %s\n", path1);
|
||||
ok(!lstrcmpA(path2, "one\\mid.\\three"), "Expected one\\mid.\\three, got %s\n", path2);
|
||||
ok(!lstrcmpA(out, "one\\mid."), "Expected one\\mid., got %s\n", out);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try . in the middle of a directory */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -1385,7 +1396,7 @@ static void test_PathCommonPrefixA(void)
|
||||
ok(!lstrcmpA(path1, "one\\mid.end\\two"), "Expected one\\mid.end\\two, got %s\n", path1);
|
||||
ok(!lstrcmpA(path2, "one\\mid.end\\three"), "Expected one\\mid.end\\three, got %s\n", path2);
|
||||
ok(!lstrcmpA(out, "one\\mid.end"), "Expected one\\mid.end, got %s\n", out);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try comparing a .. with the expanded path */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -1397,7 +1408,7 @@ static void test_PathCommonPrefixA(void)
|
||||
ok(!lstrcmpA(path1, "one\\..\\two"), "Expected one\\..\\two, got %s\n", path1);
|
||||
ok(!lstrcmpA(path2, "two"), "Expected two, got %s\n", path2);
|
||||
ok(!out[0], "Expected 0 length out, got %i\n", lstrlenA(out));
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
}
|
||||
|
||||
static void test_PathUnquoteSpaces(void)
|
||||
@@ -1405,7 +1416,7 @@ static void test_PathUnquoteSpaces(void)
|
||||
int i;
|
||||
for (i = 0; i < ARRAY_SIZE(TEST_PATH_UNQUOTE_SPACES); i++)
|
||||
{
|
||||
char *path = strdupA(TEST_PATH_UNQUOTE_SPACES[i].path);
|
||||
char *path = strdup(TEST_PATH_UNQUOTE_SPACES[i].path);
|
||||
WCHAR *pathW = GetWideString(TEST_PATH_UNQUOTE_SPACES[i].path);
|
||||
WCHAR *resultW = GetWideString(TEST_PATH_UNQUOTE_SPACES[i].result);
|
||||
|
||||
@@ -1417,9 +1428,9 @@ static void test_PathUnquoteSpaces(void)
|
||||
PathUnquoteSpacesW(pathW);
|
||||
ok(!lstrcmpW(pathW, resultW), "%s (W): strings differ\n",
|
||||
TEST_PATH_UNQUOTE_SPACES[i].path);
|
||||
FreeWideString(pathW);
|
||||
FreeWideString(resultW);
|
||||
HeapFree(GetProcessHeap(), 0, path);
|
||||
free(pathW);
|
||||
free(resultW);
|
||||
free(path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1439,7 +1450,7 @@ static void test_PathGetDriveNumber(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = PathGetDriveNumberA(NULL);
|
||||
ok(ret == -1, "got %d\n", ret);
|
||||
ok(GetLastError() == 0xdeadbeef, "got %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "got %ld\n", GetLastError());
|
||||
|
||||
ret = PathGetDriveNumberA(test1A);
|
||||
ok(ret == 0, "got %d\n", ret);
|
||||
@@ -1482,20 +1493,20 @@ static void test_PathUnExpandEnvStrings(void)
|
||||
ok(ret, "got %d\n", ret);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pPathUnExpandEnvStringsA(envvarA, buff, sizeof(buff));
|
||||
ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %d\n", ret, GetLastError());
|
||||
ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
|
||||
|
||||
ret = GetEnvironmentVariableW(computernameW, envvarW, ARRAY_SIZE(envvarW));
|
||||
ok(ret, "got %d\n", ret);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pPathUnExpandEnvStringsW(envvarW, buffW, ARRAY_SIZE(buffW));
|
||||
ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %d\n", ret, GetLastError());
|
||||
ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
|
||||
|
||||
/* something that can't be represented with env var */
|
||||
strcpy(path, "somepath_name");
|
||||
strcpy(buff, "xx");
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pPathUnExpandEnvStringsA(path, buff, sizeof(buff));
|
||||
ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %d\n", ret, GetLastError());
|
||||
ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
|
||||
ok(buff[0] == 'x', "wrong return string %s\n", buff);
|
||||
|
||||
len = GetSystemDirectoryA(path, MAX_PATH);
|
||||
@@ -1515,7 +1526,7 @@ static void test_PathUnExpandEnvStrings(void)
|
||||
strcpy(buff, "xx");
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pPathUnExpandEnvStringsA(path, buff, sizeof(sysrootA));
|
||||
ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %d\n", ret, GetLastError());
|
||||
ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
|
||||
ok(buff[0] == 'x', "wrong return string %s\n", buff);
|
||||
|
||||
/* enough size */
|
||||
@@ -1548,7 +1559,7 @@ static void test_PathUnExpandEnvStrings(void)
|
||||
strcat(path, sysdrvA);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pPathUnExpandEnvStringsA(path, buff, sizeof(buff));
|
||||
ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %d\n", ret, GetLastError());
|
||||
ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
|
||||
|
||||
ret = SetEnvironmentVariableA("SystemDrive", envvarA);
|
||||
ok(ret, "got %d\n", ret);
|
||||
@@ -1560,7 +1571,7 @@ static void test_PathUnExpandEnvStrings(void)
|
||||
buffW[0] = 'x'; buffW[1] = 0;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pPathUnExpandEnvStringsW(pathW, buffW, ARRAY_SIZE(buffW));
|
||||
ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %d\n", ret, GetLastError());
|
||||
ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
|
||||
ok(buffW[0] == 'x', "wrong return string %s\n", wine_dbgstr_w(buffW));
|
||||
|
||||
len = GetSystemDirectoryW(pathW, MAX_PATH);
|
||||
@@ -1574,14 +1585,14 @@ static void test_PathUnExpandEnvStrings(void)
|
||||
buffW[0] = 'x'; buffW[1] = 0;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pPathUnExpandEnvStringsW(pathW, buffW, 5);
|
||||
ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %d\n", ret, GetLastError());
|
||||
ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
|
||||
ok(buffW[0] == 'x', "wrong return string %s\n", wine_dbgstr_w(buffW));
|
||||
|
||||
/* buffer size is enough to hold variable name only */
|
||||
buffW[0] = 'x'; buffW[1] = 0;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pPathUnExpandEnvStringsW(pathW, buffW, ARRAY_SIZE(sysrootW));
|
||||
ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %d\n", ret, GetLastError());
|
||||
ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
|
||||
ok(buffW[0] == 'x', "wrong return string %s\n", wine_dbgstr_w(buffW));
|
||||
|
||||
/* enough size */
|
||||
@@ -1655,7 +1666,7 @@ static void test_PathIsRelativeW(void)
|
||||
"PathIsRelativeW(\"%s\") expects %d, got %d.\n",
|
||||
test_path_is_relative[i].path, test_path_is_relative[i].expect, ret);
|
||||
|
||||
FreeWideString(path);
|
||||
free(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ static HKEY create_test_entries(void)
|
||||
SetEnvironmentVariableA("FOO", sEnvvar2);
|
||||
|
||||
ret = RegCreateKeyA(HKEY_CURRENT_USER, REG_TEST_KEY, &hKey);
|
||||
ok( ERROR_SUCCESS == ret, "RegCreateKeyA failed, ret=%u\n", ret);
|
||||
ok( ERROR_SUCCESS == ret, "RegCreateKeyA failed, ret=%lu\n", ret);
|
||||
|
||||
if (hKey)
|
||||
{
|
||||
@@ -98,13 +98,13 @@ static HKEY create_test_entries(void)
|
||||
nExpectedLen1 = strlen(sTestpath1) - strlen("%LONGSYSTEMVAR%") + strlen(sEnvvar1) + 1;
|
||||
nExpectedLen2 = strlen(sTestpath2) - strlen("%FOO%") + strlen(sEnvvar2) + 1;
|
||||
/* ExpandEnvironmentStringsA on NT4 returns 2x the correct result */
|
||||
trace("sExplen1 = (%d)\n", nExpLen1);
|
||||
trace("sExplen1 = (%ld)\n", nExpLen1);
|
||||
if (nExpectedLen1 != nExpLen1)
|
||||
trace( "Expanding %s failed (expected %d) - known bug in NT4\n", sTestpath1, nExpectedLen1 );
|
||||
trace( "Expanding %s failed (expected %ld) - known bug in NT4\n", sTestpath1, nExpectedLen1 );
|
||||
|
||||
trace("sExplen2 = (%d)\n", nExpLen2);
|
||||
trace("sExplen2 = (%ld)\n", nExpLen2);
|
||||
if (nExpectedLen2 != nExpLen2)
|
||||
trace( "Expanding %s failed (expected %d) - known bug in NT4\n", sTestpath2, nExpectedLen2 );
|
||||
trace( "Expanding %s failed (expected %ld) - known bug in NT4\n", sTestpath2, nExpectedLen2 );
|
||||
|
||||
/* Make sure we carry on with correct values */
|
||||
nExpLen1 = nExpectedLen1;
|
||||
@@ -123,21 +123,21 @@ static void test_SHGetValue(void)
|
||||
dwSize = MAX_PATH;
|
||||
dwType = -1;
|
||||
dwRet = SHGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", &dwType, buf, &dwSize);
|
||||
ok( ERROR_SUCCESS == dwRet, "SHGetValueA failed, ret=%u\n", dwRet);
|
||||
ok( ERROR_SUCCESS == dwRet, "SHGetValueA failed, ret=%lu\n", dwRet);
|
||||
ok( 0 == strcmp(sExpTestpath1, buf) ||
|
||||
broken(0 == strcmp(sTestpath1, buf)), /* IE4.x */
|
||||
"Comparing of (%s) with (%s) failed\n", buf, sExpTestpath1);
|
||||
ok( REG_SZ == dwType ||
|
||||
broken(REG_EXPAND_SZ == dwType), /* IE4.x */
|
||||
"Expected REG_SZ, got (%u)\n", dwType);
|
||||
"Expected REG_SZ, got (%lu)\n", dwType);
|
||||
|
||||
strcpy(buf, sEmptyBuffer);
|
||||
dwSize = MAX_PATH;
|
||||
dwType = -1;
|
||||
dwRet = SHGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test2", &dwType, buf, &dwSize);
|
||||
ok( ERROR_SUCCESS == dwRet, "SHGetValueA failed, ret=%u\n", dwRet);
|
||||
ok( ERROR_SUCCESS == dwRet, "SHGetValueA failed, ret=%lu\n", dwRet);
|
||||
ok( 0 == strcmp(sTestpath1, buf) , "Comparing of (%s) with (%s) failed\n", buf, sTestpath1);
|
||||
ok( REG_SZ == dwType , "Expected REG_SZ, got (%u)\n", dwType);
|
||||
ok( REG_SZ == dwType , "Expected REG_SZ, got (%lu)\n", dwType);
|
||||
}
|
||||
|
||||
static void test_SHRegGetValue(void)
|
||||
@@ -151,31 +151,31 @@ static void test_SHRegGetValue(void)
|
||||
|
||||
size = MAX_PATH;
|
||||
ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", SRRF_RT_REG_EXPAND_SZ, &type, data, &size);
|
||||
ok(ret == ERROR_INVALID_PARAMETER, "SHRegGetValue failed, ret=%u\n", ret);
|
||||
ok(ret == ERROR_INVALID_PARAMETER, "SHRegGetValue failed, ret=%lu\n", ret);
|
||||
|
||||
size = MAX_PATH;
|
||||
ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", SRRF_RT_REG_SZ, &type, data, &size);
|
||||
ok(ret == ERROR_SUCCESS, "SHRegGetValue failed, ret=%u\n", ret);
|
||||
ok(ret == ERROR_SUCCESS, "SHRegGetValue failed, ret=%lu\n", ret);
|
||||
ok(!strcmp(data, sExpTestpath1), "data = %s, expected %s\n", data, sExpTestpath1);
|
||||
ok(type == REG_SZ, "type = %d, expected REG_SZ\n", type);
|
||||
ok(type == REG_SZ, "type = %ld, expected REG_SZ\n", type);
|
||||
|
||||
size = MAX_PATH;
|
||||
ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", SRRF_RT_REG_DWORD, &type, data, &size);
|
||||
ok(ret == ERROR_UNSUPPORTED_TYPE, "SHRegGetValue failed, ret=%u\n", ret);
|
||||
ok(ret == ERROR_UNSUPPORTED_TYPE, "SHRegGetValue failed, ret=%lu\n", ret);
|
||||
|
||||
size = MAX_PATH;
|
||||
ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test2", SRRF_RT_REG_EXPAND_SZ, &type, data, &size);
|
||||
ok(ret == ERROR_INVALID_PARAMETER, "SHRegGetValue failed, ret=%u\n", ret);
|
||||
ok(ret == ERROR_INVALID_PARAMETER, "SHRegGetValue failed, ret=%lu\n", ret);
|
||||
|
||||
size = MAX_PATH;
|
||||
ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test2", SRRF_RT_REG_SZ, &type, data, &size);
|
||||
ok(ret == ERROR_SUCCESS, "SHRegGetValue failed, ret=%u\n", ret);
|
||||
ok(ret == ERROR_SUCCESS, "SHRegGetValue failed, ret=%lu\n", ret);
|
||||
ok(!strcmp(data, sTestpath1), "data = %s, expected %s\n", data, sTestpath1);
|
||||
ok(type == REG_SZ, "type = %d, expected REG_SZ\n", type);
|
||||
ok(type == REG_SZ, "type = %ld, expected REG_SZ\n", type);
|
||||
|
||||
size = MAX_PATH;
|
||||
ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test2", SRRF_RT_REG_QWORD, &type, data, &size);
|
||||
ok(ret == ERROR_UNSUPPORTED_TYPE, "SHRegGetValue failed, ret=%u\n", ret);
|
||||
ok(ret == ERROR_UNSUPPORTED_TYPE, "SHRegGetValue failed, ret=%lu\n", ret);
|
||||
}
|
||||
|
||||
static void test_SHGetRegPath(void)
|
||||
@@ -188,7 +188,7 @@ static void test_SHGetRegPath(void)
|
||||
|
||||
strcpy(buf, sEmptyBuffer);
|
||||
dwRet = (*pSHRegGetPathA)(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", buf, 0);
|
||||
ok( ERROR_SUCCESS == dwRet, "SHRegGetPathA failed, ret=%u\n", dwRet);
|
||||
ok( ERROR_SUCCESS == dwRet, "SHRegGetPathA failed, ret=%lu\n", dwRet);
|
||||
ok( 0 == strcmp(sExpTestpath1, buf) , "Comparing (%s) with (%s) failed\n", buf, sExpTestpath1);
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ static void test_SHQueryValueEx(void)
|
||||
|
||||
sTestedFunction = "RegOpenKeyExA";
|
||||
dwRet = RegOpenKeyExA(HKEY_CURRENT_USER, REG_TEST_KEY, 0, KEY_QUERY_VALUE, &hKey);
|
||||
ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%u\n", sTestedFunction, dwRet);
|
||||
ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%lu\n", sTestedFunction, dwRet);
|
||||
|
||||
/****** SHQueryValueExA ******/
|
||||
|
||||
@@ -215,15 +215,15 @@ static void test_SHQueryValueEx(void)
|
||||
* Case 1.1 All arguments are NULL
|
||||
*/
|
||||
dwRet = SHQueryValueExA( hKey, "Test1", NULL, NULL, NULL, NULL);
|
||||
ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%u\n", sTestedFunction, dwRet);
|
||||
ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%lu\n", sTestedFunction, dwRet);
|
||||
|
||||
/*
|
||||
* Case 1.2 dwType is set
|
||||
*/
|
||||
dwType = -1;
|
||||
dwRet = SHQueryValueExA( hKey, "Test1", NULL, &dwType, NULL, NULL);
|
||||
ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%u\n", sTestedFunction, dwRet);
|
||||
ok( REG_SZ == dwType , "Expected REG_SZ, got (%u)\n", dwType);
|
||||
ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%lu\n", sTestedFunction, dwRet);
|
||||
ok( REG_SZ == dwType , "Expected REG_SZ, got (%lu)\n", dwType);
|
||||
|
||||
/*
|
||||
* dwSize is set
|
||||
@@ -231,18 +231,18 @@ static void test_SHQueryValueEx(void)
|
||||
*/
|
||||
dwSize = 6;
|
||||
dwRet = SHQueryValueExA( hKey, "Test1", NULL, NULL, NULL, &dwSize);
|
||||
ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%u\n", sTestedFunction, dwRet);
|
||||
ok( dwSize == nUsedBuffer1, "Buffer sizes (%u) and (%u) are not equal\n", dwSize, nUsedBuffer1);
|
||||
ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%lu\n", sTestedFunction, dwRet);
|
||||
ok( dwSize == nUsedBuffer1, "Buffer sizes (%lu) and (%lu) are not equal\n", dwSize, nUsedBuffer1);
|
||||
|
||||
/*
|
||||
* dwExpanded > dwUnExpanded
|
||||
*/
|
||||
dwSize = 6;
|
||||
dwRet = SHQueryValueExA( hKey, "Test3", NULL, NULL, NULL, &dwSize);
|
||||
ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%u\n", sTestedFunction, dwRet);
|
||||
ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%lu\n", sTestedFunction, dwRet);
|
||||
ok( dwSize >= nUsedBuffer2 ||
|
||||
broken(dwSize == (strlen(sTestpath2) + 1)), /* < IE4.x */
|
||||
"Buffer size (%u) should be >= (%u)\n", dwSize, nUsedBuffer2);
|
||||
"Buffer size (%lu) should be >= (%lu)\n", dwSize, nUsedBuffer2);
|
||||
|
||||
/*
|
||||
* Case 1 string shrinks during expanding
|
||||
@@ -251,12 +251,12 @@ static void test_SHQueryValueEx(void)
|
||||
dwSize = 6;
|
||||
dwType = -1;
|
||||
dwRet = SHQueryValueExA( hKey, "Test1", NULL, &dwType, buf, &dwSize);
|
||||
ok( ERROR_MORE_DATA == dwRet, "Expected ERROR_MORE_DATA, got (%u)\n", dwRet);
|
||||
ok( ERROR_MORE_DATA == dwRet, "Expected ERROR_MORE_DATA, got (%lu)\n", dwRet);
|
||||
ok( 0 == strcmp(sEmptyBuffer, buf) , "Comparing (%s) with (%s) failed\n", buf, sEmptyBuffer);
|
||||
ok( dwSize == nUsedBuffer1, "Buffer sizes (%u) and (%u) are not equal\n", dwSize, nUsedBuffer1);
|
||||
ok( dwSize == nUsedBuffer1, "Buffer sizes (%lu) and (%lu) are not equal\n", dwSize, nUsedBuffer1);
|
||||
ok( REG_SZ == dwType ||
|
||||
broken(REG_EXPAND_SZ == dwType), /* < IE6 */
|
||||
"Expected REG_SZ, got (%u)\n", dwType);
|
||||
"Expected REG_SZ, got (%lu)\n", dwType);
|
||||
|
||||
/*
|
||||
* string grows during expanding
|
||||
@@ -266,14 +266,14 @@ static void test_SHQueryValueEx(void)
|
||||
dwSize = 6;
|
||||
dwType = -1;
|
||||
dwRet = SHQueryValueExA( hKey, "Test3", NULL, &dwType, buf, &dwSize);
|
||||
ok( ERROR_MORE_DATA == dwRet, "Expected ERROR_MORE_DATA, got (%u)\n", dwRet);
|
||||
ok( ERROR_MORE_DATA == dwRet, "Expected ERROR_MORE_DATA, got (%lu)\n", dwRet);
|
||||
ok( 0 == strcmp(sEmptyBuffer, buf) , "Comparing (%s) with (%s) failed\n", buf, sEmptyBuffer);
|
||||
ok( dwSize >= nUsedBuffer2 ||
|
||||
broken(dwSize == (strlen(sTestpath2) + 1)), /* < IE6 */
|
||||
"Buffer size (%u) should be >= (%u)\n", dwSize, nUsedBuffer2);
|
||||
"Buffer size (%lu) should be >= (%lu)\n", dwSize, nUsedBuffer2);
|
||||
ok( REG_SZ == dwType ||
|
||||
broken(REG_EXPAND_SZ == dwType), /* < IE6 */
|
||||
"Expected REG_SZ, got (%u)\n", dwType);
|
||||
"Expected REG_SZ, got (%lu)\n", dwType);
|
||||
|
||||
/*
|
||||
* string grows during expanding
|
||||
@@ -288,18 +288,15 @@ static void test_SHQueryValueEx(void)
|
||||
ok( ERROR_MORE_DATA == dwRet ||
|
||||
broken(ERROR_ENVVAR_NOT_FOUND == dwRet) || /* IE5.5 */
|
||||
broken(ERROR_SUCCESS == dwRet), /* < IE5.5*/
|
||||
"Expected ERROR_MORE_DATA, got (%u)\n", dwRet);
|
||||
"Expected ERROR_MORE_DATA, got (%lu)\n", dwRet);
|
||||
|
||||
todo_wine
|
||||
{
|
||||
ok( (0 == strcmp("", buf)) || (0 == strcmp(sTestpath2, buf)),
|
||||
"Expected empty or unexpanded string (win98), got (%s)\n", buf);
|
||||
}
|
||||
ok( !strcmp("", buf) || !strcmp(sTestpath2, buf),
|
||||
"Expected empty or unexpanded string (win98), got (%s)\n", buf);
|
||||
|
||||
ok( dwSize >= nUsedBuffer2 ||
|
||||
broken(dwSize == (strlen("") + 1)), /* < IE 5.5 */
|
||||
"Buffer size (%u) should be >= (%u)\n", dwSize, nUsedBuffer2);
|
||||
ok( REG_SZ == dwType , "Expected REG_SZ, got (%u)\n", dwType);
|
||||
"Buffer size (%lu) should be >= (%lu)\n", dwSize, nUsedBuffer2);
|
||||
ok( REG_SZ == dwType , "Expected REG_SZ, got (%lu)\n", dwType);
|
||||
|
||||
/*
|
||||
* string grows during expanding
|
||||
@@ -314,20 +311,17 @@ static void test_SHQueryValueEx(void)
|
||||
ok( ERROR_MORE_DATA == dwRet ||
|
||||
broken(ERROR_ENVVAR_NOT_FOUND == dwRet) || /* IE5.5 */
|
||||
broken(ERROR_SUCCESS == dwRet), /* < IE5.5 */
|
||||
"Expected ERROR_MORE_DATA, got (%u)\n", dwRet);
|
||||
"Expected ERROR_MORE_DATA, got (%lu)\n", dwRet);
|
||||
|
||||
todo_wine
|
||||
{
|
||||
ok( (0 == strcmp("", buf)) || (0 == strcmp(sEnvvar2, buf)) ||
|
||||
broken(0 == strcmp(sTestpath2, buf)), /* IE 5.5 */
|
||||
"Expected empty or first part of the string \"%s\", got \"%s\"\n", sEnvvar2, buf);
|
||||
}
|
||||
ok( !strcmp("", buf) || !strcmp(sEnvvar2, buf) ||
|
||||
broken(0 == strcmp(sTestpath2, buf)), /* IE 5.5 */
|
||||
"Expected empty or first part of the string \"%s\", got \"%s\"\n", sEnvvar2, buf);
|
||||
|
||||
ok( dwSize >= nUsedBuffer2 ||
|
||||
broken(dwSize == (strlen(sEnvvar2) + 1)) || /* IE4.01 SP1 (W98) and IE5 (W98SE) */
|
||||
broken(dwSize == (strlen("") + 1)), /* IE4.01 (NT4) and IE5.x (W2K) */
|
||||
"Buffer size (%u) should be >= (%u)\n", dwSize, nUsedBuffer2);
|
||||
ok( REG_SZ == dwType , "Expected REG_SZ, got (%u)\n", dwType);
|
||||
"Buffer size (%lu) should be >= (%lu)\n", dwSize, nUsedBuffer2);
|
||||
ok( REG_SZ == dwType , "Expected REG_SZ, got (%lu)\n", dwType);
|
||||
|
||||
/*
|
||||
* The buffer is NULL but the size is set
|
||||
@@ -336,11 +330,11 @@ static void test_SHQueryValueEx(void)
|
||||
dwSize = 6;
|
||||
dwType = -1;
|
||||
dwRet = SHQueryValueExA( hKey, "Test3", NULL, &dwType, NULL, &dwSize);
|
||||
ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%u\n", sTestedFunction, dwRet);
|
||||
ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%lu\n", sTestedFunction, dwRet);
|
||||
ok( dwSize >= nUsedBuffer2 ||
|
||||
broken(dwSize == (strlen(sTestpath2) + 1)), /* IE4.01 SP1 (Win98) */
|
||||
"Buffer size (%u) should be >= (%u)\n", dwSize, nUsedBuffer2);
|
||||
ok( REG_SZ == dwType , "Expected REG_SZ, got (%u)\n", dwType);
|
||||
"Buffer size (%lu) should be >= (%lu)\n", dwSize, nUsedBuffer2);
|
||||
ok( REG_SZ == dwType , "Expected REG_SZ, got (%lu)\n", dwType);
|
||||
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
@@ -368,7 +362,7 @@ static void test_SHCopyKey(void)
|
||||
dwRet = RegCreateKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination", &hKeyDst);
|
||||
if (dwRet || !hKeyDst)
|
||||
{
|
||||
ok( 0, "Destination couldn't be created, RegCreateKeyA returned (%u)\n", dwRet);
|
||||
ok( 0, "Destination couldn't be created, RegCreateKeyA returned (%lu)\n", dwRet);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -376,13 +370,13 @@ static void test_SHCopyKey(void)
|
||||
dwRet = RegOpenKeyA(HKEY_LOCAL_MACHINE, REG_CURRENT_VERSION, &hKeySrc);
|
||||
if (dwRet || !hKeySrc)
|
||||
{
|
||||
ok( 0, "Source couldn't be opened, RegOpenKeyA returned (%u)\n", dwRet);
|
||||
ok( 0, "Source couldn't be opened, RegOpenKeyA returned (%lu)\n", dwRet);
|
||||
RegCloseKey(hKeyDst);
|
||||
return;
|
||||
}
|
||||
|
||||
dwRet = (*pSHCopyKeyA)(hKeySrc, NULL, hKeyDst, 0);
|
||||
ok ( ERROR_SUCCESS == dwRet, "Copy failed, ret=(%u)\n", dwRet);
|
||||
ok ( ERROR_SUCCESS == dwRet, "Copy failed, ret=(%lu)\n", dwRet);
|
||||
|
||||
RegCloseKey(hKeySrc);
|
||||
RegCloseKey(hKeyDst);
|
||||
@@ -392,7 +386,7 @@ static void test_SHCopyKey(void)
|
||||
dwRet = RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination\\Shell Folders", &hKeyDst);
|
||||
if (dwRet || !hKeyDst)
|
||||
{
|
||||
ok ( 0, "Copy couldn't be opened, RegOpenKeyA returned (%u)\n", dwRet);
|
||||
ok ( 0, "Copy couldn't be opened, RegOpenKeyA returned (%lu)\n", dwRet);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -433,7 +427,7 @@ static void test_SHDeleteKey(void)
|
||||
{
|
||||
|
||||
dwRet = SHDeleteKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\ODBC");
|
||||
ok ( ERROR_SUCCESS == dwRet, "SHDeleteKey failed, ret=(%u)\n", dwRet);
|
||||
ok ( ERROR_SUCCESS == dwRet, "SHDeleteKey failed, ret=(%lu)\n", dwRet);
|
||||
|
||||
dwRet = RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\ODBC", &hKeyS);
|
||||
ok ( ERROR_FILE_NOT_FOUND == dwRet, "SHDeleteKey did not delete\n");
|
||||
@@ -457,7 +451,7 @@ static void test_SHRegCreateUSKeyW(void)
|
||||
}
|
||||
|
||||
ret = pSHRegCreateUSKeyW(subkeyW, KEY_ALL_ACCESS, NULL, NULL, SHREGSET_FORCE_HKCU);
|
||||
ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
|
||||
ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
|
||||
}
|
||||
|
||||
static void test_SHRegCloseUSKey(void)
|
||||
@@ -473,20 +467,20 @@ static void test_SHRegCloseUSKey(void)
|
||||
}
|
||||
|
||||
ret = pSHRegCloseUSKey(NULL);
|
||||
ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
|
||||
ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
|
||||
|
||||
ret = pSHRegOpenUSKeyW(localW, KEY_ALL_ACCESS, NULL, &key, FALSE);
|
||||
ok(ret == ERROR_SUCCESS, "got %d\n", ret);
|
||||
ok(ret == ERROR_SUCCESS, "got %ld\n", ret);
|
||||
|
||||
ret = pSHRegCloseUSKey(key);
|
||||
ok(ret == ERROR_SUCCESS, "got %d\n", ret);
|
||||
ok(ret == ERROR_SUCCESS, "got %ld\n", ret);
|
||||
|
||||
/* Test with limited rights, specially without KEY_SET_VALUE */
|
||||
ret = pSHRegOpenUSKeyW(localW, KEY_QUERY_VALUE, NULL, &key, FALSE);
|
||||
ok(ret == ERROR_SUCCESS, "got %d\n", ret);
|
||||
ok(ret == ERROR_SUCCESS, "got %ld\n", ret);
|
||||
|
||||
ret = pSHRegCloseUSKey(key);
|
||||
ok(ret == ERROR_SUCCESS, "got %d\n", ret);
|
||||
ok(ret == ERROR_SUCCESS, "got %ld\n", ret);
|
||||
}
|
||||
|
||||
START_TEST(shreg)
|
||||
|
||||
@@ -52,6 +52,7 @@ static DWORD (WINAPI *pStrCatChainW)(LPWSTR,DWORD,DWORD,LPCWSTR);
|
||||
static LPSTR (WINAPI *pStrCpyNXA)(LPSTR,LPCSTR,int);
|
||||
static LPWSTR (WINAPI *pStrCpyNXW)(LPWSTR,LPCWSTR,int);
|
||||
static LPSTR (WINAPI *pStrFormatByteSize64A)(LONGLONG,LPSTR,UINT);
|
||||
static HRESULT (WINAPI *pStrFormatByteSizeEx)(LONGLONG,SFBS_FLAGS,LPWSTR,UINT);
|
||||
static LPSTR (WINAPI *pStrFormatKBSizeA)(LONGLONG,LPSTR,UINT);
|
||||
static LPWSTR (WINAPI *pStrFormatKBSizeW)(LONGLONG,LPWSTR,UINT);
|
||||
static BOOL (WINAPI *pStrIsIntlEqualA)(BOOL,LPCSTR,LPCSTR,int);
|
||||
@@ -69,12 +70,6 @@ static LPWSTR (WINAPI *pStrChrNW)(LPCWSTR,WCHAR,UINT);
|
||||
static BOOL (WINAPI *pStrToInt64ExA)(LPCSTR,DWORD,LONGLONG*);
|
||||
static BOOL (WINAPI *pStrToInt64ExW)(LPCWSTR,DWORD,LONGLONG*);
|
||||
|
||||
static int strcmpW(const WCHAR *str1, const WCHAR *str2)
|
||||
{
|
||||
while (*str1 && (*str1 == *str2)) { str1++; str2++; }
|
||||
return *str1 - *str2;
|
||||
}
|
||||
|
||||
/* StrToInt/StrToIntEx results */
|
||||
typedef struct tagStrToIntResult
|
||||
{
|
||||
@@ -82,6 +77,7 @@ typedef struct tagStrToIntResult
|
||||
int str_to_int;
|
||||
LONGLONG str_to_int64_ex;
|
||||
LONGLONG str_to_int64_hex;
|
||||
BOOL failure;
|
||||
} StrToIntResult;
|
||||
|
||||
static const StrToIntResult StrToInt_results[] = {
|
||||
@@ -95,11 +91,12 @@ static const StrToIntResult StrToInt_results[] = {
|
||||
{ "0x2bdc546291f4b1", 0, 0, ((LONGLONG)0x2bdc54 << 32) | 0x6291f4b1 },
|
||||
{ "+0x44f4", 0, 0, 0x44f4 },
|
||||
{ "-0x44fd", 0, 0, 0x44fd },
|
||||
{ "+ 88987", 0, 0, 0 },
|
||||
{ "- 55", 0, 0, 0 },
|
||||
{ "- 0", 0, 0, 0 },
|
||||
{ "+ 0x44f4", 0, 0, 0 },
|
||||
{ "--0x44fd", 0, 0, 0 },
|
||||
{ "+ 88987", 0, 0, 0, TRUE },
|
||||
|
||||
{ "- 55", 0, 0, 0, TRUE },
|
||||
{ "- 0", 0, 0, 0, TRUE },
|
||||
{ "+ 0x44f4", 0, 0, 0, TRUE },
|
||||
{ "--0x44fd", 0, 0, 0, TRUE },
|
||||
{ " 1999", 0, 1999, 1999 },
|
||||
{ " +88987", 0, 88987, 88987 },
|
||||
{ " 012", 0, 12, 12 },
|
||||
@@ -107,6 +104,10 @@ static const StrToIntResult StrToInt_results[] = {
|
||||
{ " 0x44ff", 0, 0, 0x44ff },
|
||||
{ " +0x44f4", 0, 0, 0x44f4 },
|
||||
{ " -0x44fd", 0, 0, 0x44fd },
|
||||
{ "\t\n +3", 0, 3, 3 },
|
||||
{ "\v+4", 0, 0, 0, TRUE },
|
||||
{ "\f+5", 0, 0, 0, TRUE },
|
||||
{ "\r+6", 0, 0, 0, TRUE },
|
||||
{ NULL, 0, 0, 0 }
|
||||
};
|
||||
|
||||
@@ -494,8 +495,10 @@ static void test_StrToIntExA(void)
|
||||
{
|
||||
return_val = -1;
|
||||
bRet = StrToIntExA(result->string,0,&return_val);
|
||||
ok(!bRet || return_val != -1, "No result returned from '%s'\n",
|
||||
result->string);
|
||||
if (result->failure)
|
||||
ok(!bRet, "Got %d instead of failure for '%s'\n", return_val, result->string);
|
||||
else
|
||||
ok(bRet, "Failed for '%s'\n", result->string);
|
||||
if (bRet)
|
||||
ok(return_val == (int)result->str_to_int64_ex, "converted '%s' wrong (%d)\n",
|
||||
result->string, return_val);
|
||||
@@ -507,8 +510,10 @@ static void test_StrToIntExA(void)
|
||||
{
|
||||
return_val = -1;
|
||||
bRet = StrToIntExA(result->string,STIF_SUPPORT_HEX,&return_val);
|
||||
ok(!bRet || return_val != -1, "No result returned from '%s'\n",
|
||||
result->string);
|
||||
if (result->failure)
|
||||
ok(!bRet, "Got %d instead of failure for '%s'\n", return_val, result->string);
|
||||
else
|
||||
ok(bRet, "Failed for '%s'\n", result->string);
|
||||
if (bRet)
|
||||
ok(return_val == (int)result->str_to_int64_hex, "converted '%s' wrong (%d)\n",
|
||||
result->string, return_val);
|
||||
@@ -528,8 +533,10 @@ static void test_StrToIntExW(void)
|
||||
return_val = -1;
|
||||
MultiByteToWideChar(CP_ACP, 0, result->string, -1, szBuff, ARRAY_SIZE(szBuff));
|
||||
bRet = StrToIntExW(szBuff, 0, &return_val);
|
||||
ok(!bRet || return_val != -1, "No result returned from '%s'\n",
|
||||
result->string);
|
||||
if (result->failure)
|
||||
ok(!bRet, "Got %d instead of failure for '%s'\n", return_val, result->string);
|
||||
else
|
||||
ok(bRet, "Failed for '%s'\n", result->string);
|
||||
if (bRet)
|
||||
ok(return_val == (int)result->str_to_int64_ex, "converted '%s' wrong (%d)\n",
|
||||
result->string, return_val);
|
||||
@@ -542,13 +549,23 @@ static void test_StrToIntExW(void)
|
||||
return_val = -1;
|
||||
MultiByteToWideChar(CP_ACP, 0, result->string, -1, szBuff, ARRAY_SIZE(szBuff));
|
||||
bRet = StrToIntExW(szBuff, STIF_SUPPORT_HEX, &return_val);
|
||||
ok(!bRet || return_val != -1, "No result returned from '%s'\n",
|
||||
result->string);
|
||||
if (result->failure)
|
||||
ok(!bRet, "Got %d instead of failure for '%s'\n", return_val, result->string);
|
||||
else
|
||||
ok(bRet, "Failed for '%s'\n", result->string);
|
||||
if (bRet)
|
||||
ok(return_val == (int)result->str_to_int64_hex, "converted '%s' wrong (%d)\n",
|
||||
result->string, return_val);
|
||||
result++;
|
||||
}
|
||||
|
||||
return_val = -1;
|
||||
bRet = StrToIntExW(L"\x0661\x0662", 0, &return_val);
|
||||
ok( !bRet, "Returned %d for Unicode digits\n", return_val );
|
||||
bRet = StrToIntExW(L"\x07c3\x07c4", 0, &return_val);
|
||||
ok( !bRet, "Returned %d for Unicode digits\n", return_val );
|
||||
bRet = StrToIntExW(L"\xa0-2", 0, &return_val);
|
||||
ok( !bRet, "Returned %d for Unicode space\n", return_val );
|
||||
}
|
||||
|
||||
static void test_StrToInt64ExA(void)
|
||||
@@ -567,8 +584,11 @@ static void test_StrToInt64ExA(void)
|
||||
{
|
||||
return_val = -1;
|
||||
bRet = pStrToInt64ExA(result->string,0,&return_val);
|
||||
ok(!bRet || return_val != -1, "No result returned from '%s'\n",
|
||||
result->string);
|
||||
if (result->failure)
|
||||
ok(!bRet, "Got %s instead of failure for '%s'\n",
|
||||
wine_dbgstr_longlong(return_val), result->string);
|
||||
else
|
||||
ok(bRet, "Failed for '%s'\n", result->string);
|
||||
if (bRet)
|
||||
ok(return_val == result->str_to_int64_ex, "converted '%s' wrong (%s)\n",
|
||||
result->string, wine_dbgstr_longlong(return_val));
|
||||
@@ -580,8 +600,11 @@ static void test_StrToInt64ExA(void)
|
||||
{
|
||||
return_val = -1;
|
||||
bRet = pStrToInt64ExA(result->string,STIF_SUPPORT_HEX,&return_val);
|
||||
ok(!bRet || return_val != -1, "No result returned from '%s'\n",
|
||||
result->string);
|
||||
if (result->failure)
|
||||
ok(!bRet, "Got %s instead of failure for '%s'\n",
|
||||
wine_dbgstr_longlong(return_val), result->string);
|
||||
else
|
||||
ok(bRet, "Failed for '%s'\n", result->string);
|
||||
if (bRet)
|
||||
ok(return_val == result->str_to_int64_hex, "converted '%s' wrong (%s)\n",
|
||||
result->string, wine_dbgstr_longlong(return_val));
|
||||
@@ -607,8 +630,11 @@ static void test_StrToInt64ExW(void)
|
||||
return_val = -1;
|
||||
MultiByteToWideChar(CP_ACP, 0, result->string, -1, szBuff, ARRAY_SIZE(szBuff));
|
||||
bRet = pStrToInt64ExW(szBuff, 0, &return_val);
|
||||
ok(!bRet || return_val != -1, "No result returned from '%s'\n",
|
||||
result->string);
|
||||
if (result->failure)
|
||||
ok(!bRet, "Got %s instead of failure for '%s'\n",
|
||||
wine_dbgstr_longlong(return_val), result->string);
|
||||
else
|
||||
ok(bRet, "Failed for '%s'\n", result->string);
|
||||
if (bRet)
|
||||
ok(return_val == result->str_to_int64_ex, "converted '%s' wrong (%s)\n",
|
||||
result->string, wine_dbgstr_longlong(return_val));
|
||||
@@ -621,13 +647,24 @@ static void test_StrToInt64ExW(void)
|
||||
return_val = -1;
|
||||
MultiByteToWideChar(CP_ACP, 0, result->string, -1, szBuff, ARRAY_SIZE(szBuff));
|
||||
bRet = pStrToInt64ExW(szBuff, STIF_SUPPORT_HEX, &return_val);
|
||||
ok(!bRet || return_val != -1, "No result returned from '%s'\n",
|
||||
result->string);
|
||||
if (result->failure)
|
||||
ok(!bRet, "Got %s instead of failure for '%s'\n",
|
||||
wine_dbgstr_longlong(return_val), result->string);
|
||||
else
|
||||
ok(bRet, "Failed for '%s'\n", result->string);
|
||||
if (bRet)
|
||||
ok(return_val == result->str_to_int64_hex, "converted '%s' wrong (%s)\n",
|
||||
result->string, wine_dbgstr_longlong(return_val));
|
||||
result++;
|
||||
}
|
||||
|
||||
return_val = -1;
|
||||
bRet = pStrToInt64ExW(L"\x0661\x0662", 0, &return_val);
|
||||
ok( !bRet, "Returned %s for Unicode digits\n", wine_dbgstr_longlong(return_val) );
|
||||
bRet = pStrToInt64ExW(L"\x07c3\x07c4", 0, &return_val);
|
||||
ok( !bRet, "Returned %s for Unicode digits\n", wine_dbgstr_longlong(return_val) );
|
||||
bRet = pStrToInt64ExW(L"\xa0-2", 0, &return_val);
|
||||
ok( !bRet, "Returned %s for Unicode space\n", wine_dbgstr_longlong(return_val) );
|
||||
}
|
||||
|
||||
static void test_StrDupA(void)
|
||||
@@ -679,6 +716,38 @@ static void test_StrFormatByteSize64A(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void test_StrFormatByteSizeEx(void)
|
||||
{
|
||||
WCHAR szBuff[256];
|
||||
HRESULT hr;
|
||||
LONGLONG test_value = 2147483647;
|
||||
|
||||
if (!pStrFormatByteSizeEx)
|
||||
{
|
||||
win_skip("StrFormatByteSizeEx is not available \n");
|
||||
return;
|
||||
}
|
||||
|
||||
hr = pStrFormatByteSizeEx(0xdeadbeef,
|
||||
SFBS_FLAGS_TRUNCATE_UNDISPLAYED_DECIMAL_DIGITS, szBuff, 0);
|
||||
ok(hr == E_INVALIDARG, "Unexpected hr: %#lx expected: %#lx\n", hr, E_INVALIDARG);
|
||||
|
||||
hr = pStrFormatByteSizeEx(0xdeadbeef, 10, szBuff, 256);
|
||||
ok(hr == E_INVALIDARG, "Unexpected hr: %#lx expected: %#lx\n", hr, E_INVALIDARG);
|
||||
|
||||
hr = pStrFormatByteSizeEx(test_value, SFBS_FLAGS_ROUND_TO_NEAREST_DISPLAYED_DIGIT,
|
||||
szBuff, 256);
|
||||
ok(hr == S_OK, "Invalid arguments \n");
|
||||
ok(!wcscmp(szBuff, L"2.00 GB"), "Formatted %s wrong: got %ls, expected 2.00 GB\n",
|
||||
wine_dbgstr_longlong(test_value), szBuff);
|
||||
|
||||
hr = pStrFormatByteSizeEx(test_value, SFBS_FLAGS_TRUNCATE_UNDISPLAYED_DECIMAL_DIGITS,
|
||||
szBuff, 256);
|
||||
ok(hr == S_OK, "Invalid arguments \n");
|
||||
ok(!wcscmp(szBuff, L"1.99 GB"), "Formatted %s wrong: got %ls, expected 1.99 GB\n",
|
||||
wine_dbgstr_longlong(test_value), szBuff);
|
||||
}
|
||||
|
||||
static void test_StrFormatKBSizeW(void)
|
||||
{
|
||||
WCHAR szBuffW[256];
|
||||
@@ -736,7 +805,7 @@ static void test_StrFromTimeIntervalA(void)
|
||||
{
|
||||
StrFromTimeIntervalA(szBuff, 256, result->ms, result->digits);
|
||||
|
||||
ok(!strcmp(result->time_interval, szBuff), "Formatted %d %d wrong: %s\n",
|
||||
ok(!strcmp(result->time_interval, szBuff), "Formatted %ld %d wrong: %s\n",
|
||||
result->ms, result->digits, szBuff);
|
||||
result++;
|
||||
}
|
||||
@@ -827,26 +896,26 @@ static void test_StrRetToBSTR(void)
|
||||
}
|
||||
|
||||
strret.uType = STRRET_WSTR;
|
||||
U(strret).pOleStr = CoDupStrW("Test");
|
||||
strret.pOleStr = CoDupStrW("Test");
|
||||
bstr = 0;
|
||||
ret = pStrRetToBSTR(&strret, NULL, &bstr);
|
||||
ok(ret == S_OK && bstr && !strcmpW(bstr, szTestW),
|
||||
"STRRET_WSTR: dup failed, ret=0x%08x, bstr %p\n", ret, bstr);
|
||||
ok(ret == S_OK && bstr && !wcscmp(bstr, szTestW),
|
||||
"STRRET_WSTR: dup failed, ret=0x%08lx, bstr %p\n", ret, bstr);
|
||||
SysFreeString(bstr);
|
||||
|
||||
strret.uType = STRRET_CSTR;
|
||||
lstrcpyA(U(strret).cStr, "Test");
|
||||
lstrcpyA(strret.cStr, "Test");
|
||||
ret = pStrRetToBSTR(&strret, NULL, &bstr);
|
||||
ok(ret == S_OK && bstr && !strcmpW(bstr, szTestW),
|
||||
"STRRET_CSTR: dup failed, ret=0x%08x, bstr %p\n", ret, bstr);
|
||||
ok(ret == S_OK && bstr && !wcscmp(bstr, szTestW),
|
||||
"STRRET_CSTR: dup failed, ret=0x%08lx, bstr %p\n", ret, bstr);
|
||||
SysFreeString(bstr);
|
||||
|
||||
strret.uType = STRRET_OFFSET;
|
||||
U(strret).uOffset = 1;
|
||||
strret.uOffset = 1;
|
||||
strcpy((char*)&iidl, " Test");
|
||||
ret = pStrRetToBSTR(&strret, iidl, &bstr);
|
||||
ok(ret == S_OK && bstr && !strcmpW(bstr, szTestW),
|
||||
"STRRET_OFFSET: dup failed, ret=0x%08x, bstr %p\n", ret, bstr);
|
||||
ok(ret == S_OK && bstr && !wcscmp(bstr, szTestW),
|
||||
"STRRET_OFFSET: dup failed, ret=0x%08lx, bstr %p\n", ret, bstr);
|
||||
SysFreeString(bstr);
|
||||
|
||||
/* Native crashes if str is NULL */
|
||||
@@ -951,7 +1020,7 @@ static void test_SHAnsiToAnsi(void)
|
||||
memset(dest, '\n', sizeof(dest));
|
||||
dwRet = pSHAnsiToAnsi("hello", dest, ARRAY_SIZE(dest));
|
||||
ok(dwRet == 6 && !memcmp(dest, "hello\0\n\n", sizeof(dest)),
|
||||
"SHAnsiToAnsi: expected 6, \"hello\\0\\n\\n\", got %d, \"%d,%d,%d,%d,%d,%d,%d,%d\"\n",
|
||||
"SHAnsiToAnsi: expected 6, \"hello\\0\\n\\n\", got %ld, \"%d,%d,%d,%d,%d,%d,%d,%d\"\n",
|
||||
dwRet, dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]);
|
||||
}
|
||||
|
||||
@@ -978,7 +1047,7 @@ static void test_SHUnicodeToUnicode(void)
|
||||
memcpy(dest, lpInit, sizeof(lpInit));
|
||||
dwRet = pSHUnicodeToUnicode(lpSrc, dest, ARRAY_SIZE(dest));
|
||||
ok(dwRet == 6 && !memcmp(dest, lpRes, sizeof(dest)),
|
||||
"SHUnicodeToUnicode: expected 6, \"hello\\0\\n\\n\", got %d, \"%d,%d,%d,%d,%d,%d,%d,%d\"\n",
|
||||
"SHUnicodeToUnicode: expected 6, \"hello\\0\\n\\n\", got %ld, \"%d,%d,%d,%d,%d,%d,%d,%d\"\n",
|
||||
dwRet, dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]);
|
||||
}
|
||||
|
||||
@@ -1059,10 +1128,10 @@ if (0)
|
||||
{
|
||||
memset(wbuf, 0xbf, sizeof(wbuf));
|
||||
strret.uType = STRRET_WSTR;
|
||||
U(strret).pOleStr = StrDupW(wstr1);
|
||||
strret.pOleStr = StrDupW(wstr1);
|
||||
hres = pStrRetToBufW(&strret, NULL, wbuf, 10);
|
||||
ok(hres == E_NOT_SUFFICIENT_BUFFER || broken(hres == S_OK) /* winxp */,
|
||||
"StrRetToBufW returned %08x\n", hres);
|
||||
"StrRetToBufW returned %08lx\n", hres);
|
||||
if (hres == E_NOT_SUFFICIENT_BUFFER)
|
||||
expect_eq(wbuf[0], 0, WCHAR, "%x");
|
||||
expect_eq(wbuf[9], 0, WCHAR, "%x");
|
||||
@@ -1070,16 +1139,16 @@ if (0)
|
||||
|
||||
memset(wbuf, 0xbf, sizeof(wbuf));
|
||||
strret.uType = STRRET_CSTR;
|
||||
StrCpyNA(U(strret).cStr, str1, MAX_PATH);
|
||||
StrCpyNA(strret.cStr, str1, MAX_PATH);
|
||||
hres = pStrRetToBufW(&strret, NULL, wbuf, 10);
|
||||
ok(hres == S_OK, "StrRetToBufW returned %08x\n", hres);
|
||||
ok(hres == S_OK, "StrRetToBufW returned %08lx\n", hres);
|
||||
ok(!memcmp(wbuf, wstr1, 9*sizeof(WCHAR)) && !wbuf[9], "StrRetToBuf returned %s\n", wine_dbgstr_w(wbuf));
|
||||
|
||||
memset(wbuf, 0xbf, sizeof(wbuf));
|
||||
strret.uType = STRRET_WSTR;
|
||||
U(strret).pOleStr = NULL;
|
||||
strret.pOleStr = NULL;
|
||||
hres = pStrRetToBufW(&strret, NULL, wbuf, 10);
|
||||
ok(hres == E_FAIL, "StrRetToBufW returned %08x\n", hres);
|
||||
ok(hres == E_FAIL, "StrRetToBufW returned %08lx\n", hres);
|
||||
ok(!wbuf[0], "StrRetToBuf returned %s\n", wine_dbgstr_w(wbuf));
|
||||
}
|
||||
else
|
||||
@@ -1089,8 +1158,8 @@ if (0)
|
||||
{
|
||||
memset(buf, 0xbf, sizeof(buf));
|
||||
strret.uType = STRRET_CSTR;
|
||||
StrCpyNA(U(strret).cStr, str1, MAX_PATH);
|
||||
expect_eq2(pStrRetToBufA(&strret, NULL, buf, 10), S_OK, E_NOT_SUFFICIENT_BUFFER /* Vista */, HRESULT, "%x");
|
||||
StrCpyNA(strret.cStr, str1, MAX_PATH);
|
||||
expect_eq2(pStrRetToBufA(&strret, NULL, buf, 10), S_OK, E_NOT_SUFFICIENT_BUFFER /* Vista */, HRESULT, "%lx");
|
||||
expect_eq(buf[9], 0, CHAR, "%x");
|
||||
expect_eq(buf[10], (CHAR)0xbf, CHAR, "%x");
|
||||
}
|
||||
@@ -1104,6 +1173,37 @@ if (0)
|
||||
ok(broken(ret == 9) || ret == -1 /* Vista */, "Unexpected wnsprintfA return %d, expected 9 or -1\n", ret);
|
||||
expect_eq(buf[9], 0, CHAR, "%x");
|
||||
expect_eq(buf[10], (CHAR)0xbf, CHAR, "%x");
|
||||
|
||||
memset(buf, 0xbf, sizeof(buf));
|
||||
ret = pwnsprintfA(buf + 1, -1, "%s", str1);
|
||||
#ifdef __REACTOS__
|
||||
ok(ret == -1 || broken(ret == 0) /* WS03 */, "got %d.\n", ret);
|
||||
#else
|
||||
ok(ret == -1, "got %d.\n", ret);
|
||||
#endif
|
||||
expect_eq(buf[0], (CHAR)0xbf, CHAR, "%x");
|
||||
if (!broken(1))
|
||||
{
|
||||
/* This is 0xbf before Win8. */
|
||||
expect_eq(buf[1], 0, CHAR, "%x");
|
||||
}
|
||||
expect_eq(buf[2], (CHAR)0xbf, CHAR, "%x");
|
||||
|
||||
memset(buf, 0xbf, sizeof(buf));
|
||||
ret = pwnsprintfA(buf + 1, 0, "%s", str1);
|
||||
#ifdef __REACTOS__
|
||||
ok(ret == -1 || broken(ret == 0) /* WS03 */, "got %d.\n", ret);
|
||||
#else
|
||||
ok(ret == -1, "got %d.\n", ret);
|
||||
#endif
|
||||
expect_eq(buf[0], (CHAR)0xbf, CHAR, "%x");
|
||||
expect_eq(buf[1], (CHAR)0xbf, CHAR, "%x");
|
||||
|
||||
memset(buf, 0xbf, sizeof(buf));
|
||||
ret = pwnsprintfA(buf, 1, "");
|
||||
ok(!ret, "got %d.\n", ret);
|
||||
expect_eq(buf[0], 0, CHAR, "%x");
|
||||
expect_eq(buf[1], (CHAR)0xbf, CHAR, "%x");
|
||||
}
|
||||
else
|
||||
win_skip("wnsprintfA() is not available\n");
|
||||
@@ -1115,6 +1215,37 @@ if (0)
|
||||
ok(broken(ret == 9) || ret == -1 /* Vista */, "Unexpected wnsprintfW return %d, expected 9 or -1\n", ret);
|
||||
expect_eq(wbuf[9], 0, WCHAR, "%x");
|
||||
expect_eq(wbuf[10], (WCHAR)0xbfbf, WCHAR, "%x");
|
||||
|
||||
memset(wbuf, 0xbf, sizeof(wbuf));
|
||||
ret = pwnsprintfW(wbuf + 1, -1, fmt, wstr1);
|
||||
#ifdef __REACTOS__
|
||||
ok(ret == -1 || broken(ret == 0) /* WS03 */, "got %d.\n", ret);
|
||||
#else
|
||||
ok(ret == -1, "got %d.\n", ret);
|
||||
#endif
|
||||
expect_eq(wbuf[0], (WCHAR)0xbfbf, WCHAR, "%x");
|
||||
if (!broken(1))
|
||||
{
|
||||
/* This is 0xbfbf before Win8. */
|
||||
expect_eq(wbuf[1], 0, WCHAR, "%x");
|
||||
}
|
||||
expect_eq(wbuf[2], (WCHAR)0xbfbf, WCHAR, "%x");
|
||||
|
||||
memset(wbuf, 0xbf, sizeof(wbuf));
|
||||
ret = pwnsprintfW(wbuf + 1, 0, fmt, wstr1);
|
||||
#ifdef __REACTOS__
|
||||
ok(ret == -1 || broken(ret == 0) /* WS03 */, "got %d.\n", ret);
|
||||
#else
|
||||
ok(ret == -1, "got %d.\n", ret);
|
||||
#endif
|
||||
expect_eq(wbuf[0], (WCHAR)0xbfbf, WCHAR, "%x");
|
||||
expect_eq(wbuf[1], (WCHAR)0xbfbf, WCHAR, "%x");
|
||||
|
||||
memset(wbuf, 0xbf, sizeof(wbuf));
|
||||
ret = pwnsprintfW(wbuf, 1, L"");
|
||||
ok(!ret, "got %d.\n", ret);
|
||||
expect_eq(wbuf[0], 0, WCHAR, "%x");
|
||||
expect_eq(wbuf[1], (WCHAR)0xbfbf, WCHAR, "%x");
|
||||
}
|
||||
else
|
||||
win_skip("wnsprintfW() is not available\n");
|
||||
@@ -1518,43 +1649,43 @@ static void test_StrCatChainW(void)
|
||||
|
||||
/* Test with NULL buffer */
|
||||
ret = pStrCatChainW(NULL, 0, 0, beefW);
|
||||
ok(ret == 0, "Expected StrCatChainW to return 0, got %u\n", ret);
|
||||
ok(ret == 0, "Expected StrCatChainW to return 0, got %lu\n", ret);
|
||||
|
||||
/* Test with empty buffer */
|
||||
memset(buf, 0x11, sizeof(buf));
|
||||
ret = pStrCatChainW(buf, 0, 0, beefW);
|
||||
ok(ret == 0, "Expected StrCatChainW to return 0, got %u\n", ret);
|
||||
ok(ret == 0, "Expected StrCatChainW to return 0, got %lu\n", ret);
|
||||
ok(buf[0] == 0x1111, "Expected buf[0] = 0x1111, got %x\n", buf[0]);
|
||||
|
||||
memcpy(buf, deadbeefW, sizeof(deadbeefW));
|
||||
ret = pStrCatChainW(buf, 0, -1, beefW);
|
||||
ok(ret == 8, "Expected StrCatChainW to return 8, got %u\n", ret);
|
||||
ok(ret == 8, "Expected StrCatChainW to return 8, got %lu\n", ret);
|
||||
ok(!memcmp(buf, deadbeefW, sizeof(deadbeefW)), "Buffer contains wrong data\n");
|
||||
|
||||
/* Append data to existing string with offset = -1 */
|
||||
memset(buf, 0x11, sizeof(buf));
|
||||
ret = pStrCatChainW(buf, 32, 0, deadW);
|
||||
ok(ret == 4, "Expected StrCatChainW to return 4, got %u\n", ret);
|
||||
ok(ret == 4, "Expected StrCatChainW to return 4, got %lu\n", ret);
|
||||
ok(!memcmp(buf, deadW, sizeof(deadW)), "Buffer contains wrong data\n");
|
||||
|
||||
ret = pStrCatChainW(buf, 32, -1, beefW);
|
||||
ok(ret == 8, "Expected StrCatChainW to return 8, got %u\n", ret);
|
||||
ok(ret == 8, "Expected StrCatChainW to return 8, got %lu\n", ret);
|
||||
ok(!memcmp(buf, deadbeefW, sizeof(deadbeefW)), "Buffer contains wrong data\n");
|
||||
|
||||
/* Append data at a fixed offset */
|
||||
memset(buf, 0x11, sizeof(buf));
|
||||
ret = pStrCatChainW(buf, 32, 0, deadW);
|
||||
ok(ret == 4, "Expected StrCatChainW to return 4, got %u\n", ret);
|
||||
ok(ret == 4, "Expected StrCatChainW to return 4, got %lu\n", ret);
|
||||
ok(!memcmp(buf, deadW, sizeof(deadW)), "Buffer contains wrong data\n");
|
||||
|
||||
ret = pStrCatChainW(buf, 32, 4, beefW);
|
||||
ok(ret == 8, "Expected StrCatChainW to return 8, got %u\n", ret);
|
||||
ok(ret == 8, "Expected StrCatChainW to return 8, got %lu\n", ret);
|
||||
ok(!memcmp(buf, deadbeefW, sizeof(deadbeefW)), "Buffer contains wrong data\n");
|
||||
|
||||
/* Buffer exactly sufficient for string + terminating null */
|
||||
memset(buf, 0x11, sizeof(buf));
|
||||
ret = pStrCatChainW(buf, 5, 0, deadW);
|
||||
ok(ret == 4, "Expected StrCatChainW to return 4, got %u\n", ret);
|
||||
ok(ret == 4, "Expected StrCatChainW to return 4, got %lu\n", ret);
|
||||
ok(!memcmp(buf, deadW, sizeof(deadW)), "Buffer contains wrong data\n");
|
||||
|
||||
/* Buffer too small, string will be truncated */
|
||||
@@ -1568,14 +1699,14 @@ static void test_StrCatChainW(void)
|
||||
win_skip("Windows2000/XP behaviour detected for StrCatChainW, skipping tests\n");
|
||||
return;
|
||||
}
|
||||
ok(ret == 3, "Expected StrCatChainW to return 3, got %u\n", ret);
|
||||
ok(ret == 3, "Expected StrCatChainW to return 3, got %lu\n", ret);
|
||||
ok(!memcmp(buf, deadW, 3 * sizeof(WCHAR)), "Buffer contains wrong data\n");
|
||||
ok(!buf[3], "String is not nullterminated\n");
|
||||
ok(buf[4] == 0x1111, "Expected buf[4] = 0x1111, got %x\n", buf[4]);
|
||||
|
||||
/* Overwrite part of an existing string */
|
||||
ret = pStrCatChainW(buf, 4, 1, beefW);
|
||||
ok(ret == 3, "Expected StrCatChainW to return 3, got %u\n", ret);
|
||||
ok(ret == 3, "Expected StrCatChainW to return 3, got %lu\n", ret);
|
||||
ok(buf[0] == 'D', "Expected buf[0] = 'D', got %x\n", buf[0]);
|
||||
ok(buf[1] == 'B', "Expected buf[1] = 'B', got %x\n", buf[1]);
|
||||
ok(buf[2] == 'e', "Expected buf[2] = 'e', got %x\n", buf[2]);
|
||||
@@ -1587,39 +1718,217 @@ static void test_StrCatChainW(void)
|
||||
memcpy(buf, deadbeefW, sizeof(deadbeefW));
|
||||
memcpy(buf + 9, deadW, sizeof(deadW));
|
||||
ret = pStrCatChainW(buf, 9, 8, beefW);
|
||||
ok(ret == 8, "Expected StrCatChainW to return 8, got %u\n", ret);
|
||||
ok(ret == 8, "Expected StrCatChainW to return 8, got %lu\n", ret);
|
||||
ok(!memcmp(buf, deadbeefW, sizeof(deadbeefW)), "Buffer contains wrong data\n");
|
||||
ok(!memcmp(buf + 9, deadW, sizeof(deadW)), "Buffer contains wrong data\n");
|
||||
|
||||
/* Offset points at the end of the buffer */
|
||||
ret = pStrCatChainW(buf, 9, 9, beefW);
|
||||
ok(ret == 8, "Expected StrCatChainW to return 8, got %u\n", ret);
|
||||
ok(ret == 8, "Expected StrCatChainW to return 8, got %lu\n", ret);
|
||||
ok(!memcmp(buf, deadbeefW, sizeof(deadbeefW)), "Buffer contains wrong data\n");
|
||||
ok(!memcmp(buf + 9, deadW, sizeof(deadW)), "Buffer contains wrong data\n");
|
||||
|
||||
/* Offset points outside of the buffer */
|
||||
ret = pStrCatChainW(buf, 9, 10, beefW);
|
||||
ok(ret == 10, "Expected StrCatChainW to return 10, got %u\n", ret);
|
||||
ok(ret == 10, "Expected StrCatChainW to return 10, got %lu\n", ret);
|
||||
ok(!memcmp(buf, deadbeefW, sizeof(deadbeefW)), "Buffer contains wrong data\n");
|
||||
ok(!memcmp(buf + 9, deadW, sizeof(deadW)), "Buffer contains wrong data\n");
|
||||
|
||||
/* The same but without nullterminated string */
|
||||
memcpy(buf, deadbeefW, sizeof(deadbeefW));
|
||||
ret = pStrCatChainW(buf, 5, -1, deadW);
|
||||
ok(ret == 8, "Expected StrCatChainW to return 8, got %u\n", ret);
|
||||
ok(ret == 8, "Expected StrCatChainW to return 8, got %lu\n", ret);
|
||||
ok(!memcmp(buf, deadbeefW, sizeof(deadbeefW)), "Buffer contains wrong data\n");
|
||||
|
||||
ret = pStrCatChainW(buf, 5, 5, deadW);
|
||||
ok(ret == 4, "Expected StrCatChainW to return 4, got %u\n", ret);
|
||||
ok(ret == 4, "Expected StrCatChainW to return 4, got %lu\n", ret);
|
||||
ok(!memcmp(buf, deadW, sizeof(deadW)), "Buffer contains wrong data\n");
|
||||
ok(buf[5] == 'e', "Expected buf[5] = 'e', got %x\n", buf[5]);
|
||||
|
||||
ret = pStrCatChainW(buf, 5, 6, deadW);
|
||||
ok(ret == 6, "Expected StrCatChainW to return 6, got %u\n", ret);
|
||||
ok(ret == 6, "Expected StrCatChainW to return 6, got %lu\n", ret);
|
||||
ok(!memcmp(buf, deadW, sizeof(deadW)), "Buffer contains wrong data\n");
|
||||
ok(buf[5] == 'e', "Expected buf[5] = 'e', got %x\n", buf[5]);
|
||||
}
|
||||
|
||||
static void test_printf_format(void)
|
||||
{
|
||||
const struct
|
||||
{
|
||||
const char *spec;
|
||||
unsigned int arg_size;
|
||||
ULONG64 arg;
|
||||
const void *argw;
|
||||
}
|
||||
tests[] =
|
||||
{
|
||||
{ "%qu", 0, 10 },
|
||||
{ "%ll", 0, 10 },
|
||||
{ "%lu", sizeof(ULONG), 65537 },
|
||||
{ "%llu", sizeof(ULONG64), 10 },
|
||||
{ "%lllllllu", sizeof(ULONG64), 10 },
|
||||
{ "%#lx", sizeof(ULONG), 10 },
|
||||
{ "%#llx", sizeof(ULONG64), 0x1000000000 },
|
||||
{ "%#lllx", sizeof(ULONG64), 0x1000000000 },
|
||||
{ "%hu", sizeof(ULONG), 65537 },
|
||||
{ "%hlu", sizeof(ULONG), 65537 },
|
||||
{ "%hllx", sizeof(ULONG64), 0x100000010 },
|
||||
{ "%hlllx", sizeof(ULONG64), 0x100000010 },
|
||||
{ "%llhx", sizeof(ULONG64), 0x100000010 },
|
||||
{ "%lllhx", sizeof(ULONG64), 0x100000010 },
|
||||
{ "%lhu", sizeof(ULONG), 65537 },
|
||||
{ "%hhu", sizeof(ULONG), 65537 },
|
||||
{ "%hwu", sizeof(ULONG), 65537 },
|
||||
{ "%whu", sizeof(ULONG), 65537 },
|
||||
{ "%##lhllwlx", sizeof(ULONG64), 0x1000000010 },
|
||||
{ "%##lhlwlx", sizeof(ULONG), 0x1000000010 },
|
||||
{ "%04lhlwllx", sizeof(ULONG64), 0x1000000010 },
|
||||
{ "%s", sizeof(ULONG_PTR), (ULONG_PTR)"str", L"str" },
|
||||
{ "%S", sizeof(ULONG_PTR), (ULONG_PTR)L"str", "str" },
|
||||
{ "%ls", sizeof(ULONG_PTR), (ULONG_PTR)L"str" },
|
||||
{ "%lS", sizeof(ULONG_PTR), (ULONG_PTR)L"str" },
|
||||
{ "%lls", sizeof(ULONG_PTR), (ULONG_PTR)"str", L"str" },
|
||||
{ "%llS", sizeof(ULONG_PTR), (ULONG_PTR)L"str", "str" },
|
||||
{ "%llls", sizeof(ULONG_PTR), (ULONG_PTR)L"str" },
|
||||
{ "%lllS", sizeof(ULONG_PTR), (ULONG_PTR)L"str" },
|
||||
{ "%lllls", sizeof(ULONG_PTR), (ULONG_PTR)"str", L"str" },
|
||||
{ "%llllS", sizeof(ULONG_PTR), (ULONG_PTR)L"str", "str" },
|
||||
{ "%hs", sizeof(ULONG_PTR), (ULONG_PTR)"str" },
|
||||
{ "%hS", sizeof(ULONG_PTR), (ULONG_PTR)"str" },
|
||||
{ "%ws", sizeof(ULONG_PTR), (ULONG_PTR)L"str" },
|
||||
{ "%wS", sizeof(ULONG_PTR), (ULONG_PTR)L"str" },
|
||||
{ "%hhs", sizeof(ULONG_PTR), (ULONG_PTR)"str" },
|
||||
{ "%hhS", sizeof(ULONG_PTR), (ULONG_PTR)"str" },
|
||||
{ "%wws", sizeof(ULONG_PTR), (ULONG_PTR)L"str" },
|
||||
{ "%wwS", sizeof(ULONG_PTR), (ULONG_PTR)L"str" },
|
||||
{ "%wwws", sizeof(ULONG_PTR), (ULONG_PTR)L"str" },
|
||||
{ "%wwwS", sizeof(ULONG_PTR), (ULONG_PTR)L"str" },
|
||||
{ "%hws", sizeof(ULONG_PTR), (ULONG_PTR)L"str", "str" },
|
||||
{ "%hwS", sizeof(ULONG_PTR), (ULONG_PTR)L"str", "str" },
|
||||
{ "%whs", sizeof(ULONG_PTR), (ULONG_PTR)L"str", "str" },
|
||||
{ "%whS", sizeof(ULONG_PTR), (ULONG_PTR)L"str", "str" },
|
||||
{ "%hwls", sizeof(ULONG_PTR), (ULONG_PTR)L"str", "str" },
|
||||
{ "%hwlls", sizeof(ULONG_PTR), (ULONG_PTR)L"str", "str" },
|
||||
{ "%hwlS", sizeof(ULONG_PTR), (ULONG_PTR)L"str", "str" },
|
||||
{ "%hwllS", sizeof(ULONG_PTR), (ULONG_PTR)L"str", "str" },
|
||||
{ "%lhws", sizeof(ULONG_PTR), (ULONG_PTR)L"str", "str" },
|
||||
{ "%llhws", sizeof(ULONG_PTR), (ULONG_PTR)L"str", "str" },
|
||||
{ "%lhwS", sizeof(ULONG_PTR), (ULONG_PTR)L"str", "str" },
|
||||
{ "%llhwS", sizeof(ULONG_PTR), (ULONG_PTR)L"str", "str" },
|
||||
{ "%c", sizeof(SHORT), 0x95c8 },
|
||||
{ "%lc", sizeof(SHORT), 0x95c8 },
|
||||
{ "%llc", sizeof(SHORT), 0x95c8 },
|
||||
{ "%lllc", sizeof(SHORT), 0x95c8 },
|
||||
{ "%llllc", sizeof(SHORT), 0x95c8 },
|
||||
{ "%lllllc", sizeof(SHORT), 0x95c8 },
|
||||
{ "%C", sizeof(SHORT), 0x95c8 },
|
||||
{ "%lC", sizeof(SHORT), 0x95c8 },
|
||||
{ "%llC", sizeof(SHORT), 0x95c8 },
|
||||
{ "%lllC", sizeof(SHORT), 0x95c8 },
|
||||
{ "%llllC", sizeof(SHORT), 0x95c8 },
|
||||
{ "%lllllC", sizeof(SHORT), 0x95c8 },
|
||||
{ "%hc", sizeof(BYTE), 0x95c8 },
|
||||
{ "%hhc", sizeof(BYTE), 0x95c8 },
|
||||
{ "%hhhc", sizeof(BYTE), 0x95c8 },
|
||||
{ "%wc", sizeof(BYTE), 0x95c8 },
|
||||
{ "%wC", sizeof(BYTE), 0x95c8 },
|
||||
{ "%hwc", sizeof(BYTE), 0x95c8 },
|
||||
{ "%whc", sizeof(BYTE), 0x95c8 },
|
||||
{ "%hwC", sizeof(BYTE), 0x95c8 },
|
||||
{ "%whC", sizeof(BYTE), 0x95c8 },
|
||||
{ "%I64u", sizeof(ULONG64), 10 },
|
||||
{ "%llI64u", sizeof(ULONG64), 10 },
|
||||
{ "%I64llu", sizeof(ULONG64), 10 },
|
||||
{ "%I64s", sizeof(ULONG_PTR), (ULONG_PTR)"str", L"str" },
|
||||
{ "%q%u", sizeof(ULONG), 10 },
|
||||
{ "%lhw%u", 0, 10 },
|
||||
{ "%u% ", sizeof(ULONG), 10 },
|
||||
{ "%u% %u", sizeof(ULONG), 10 },
|
||||
{ "% ll u", 0, 10 },
|
||||
{ "% llu", sizeof(ULONG64), 10 },
|
||||
{ "%# llx", sizeof(ULONG64), 10 },
|
||||
{ "% #llx", sizeof(ULONG64), 10 },
|
||||
};
|
||||
int (WINAPIV *ntdll__snprintf)(char *str, size_t len, const char *format, ...);
|
||||
int (WINAPIV *ntdll__snwprintf)( WCHAR *str, size_t len, const WCHAR *format, ... );
|
||||
WCHAR ws[256], expectedw[256], specw[256];
|
||||
unsigned int i, j;
|
||||
char expected[256], spec[256], s[256];
|
||||
int len_a, len_w = 0, expected_len_a, expected_len_w = 0;
|
||||
HANDLE hntdll = GetModuleHandleW(L"ntdll.dll");
|
||||
|
||||
ntdll__snprintf = (void *)GetProcAddress(hntdll, "_snprintf");
|
||||
ok(!!ntdll__snprintf, "_snprintf not found.\n");
|
||||
ntdll__snwprintf = (void *)GetProcAddress(hntdll, "_snwprintf");
|
||||
ok(!!ntdll__snwprintf, "_snwprintf not found.\n");
|
||||
#ifdef __REACTOS__
|
||||
DWORD _ntVersion = GetVersion();
|
||||
BYTE _ntMajor = LOBYTE(LOWORD(_ntVersion));
|
||||
BYTE _ntMinor = HIBYTE(LOWORD(_ntVersion));
|
||||
|
||||
if (_ntMajor < 6 || (_ntMajor == 6 && _ntMinor == 0)) {
|
||||
skip("These tests are broken on WS03 and Vista.\n");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(tests); ++i)
|
||||
{
|
||||
strcpy(spec, tests[i].spec);
|
||||
winetest_push_context("%s", spec);
|
||||
strcat(spec,"|%s");
|
||||
*s = 0;
|
||||
*ws = 0;
|
||||
j = 0;
|
||||
do
|
||||
specw[j] = spec[j];
|
||||
while (specw[j++]);
|
||||
if (tests[i].argw)
|
||||
{
|
||||
len_w = pwnsprintfW(ws, ARRAY_SIZE(ws), specw, tests[i].argw, L"end");
|
||||
expected_len_w = ntdll__snwprintf(expectedw, ARRAY_SIZE(expectedw), specw, tests[i].argw, L"end");
|
||||
}
|
||||
switch (tests[i].arg_size)
|
||||
{
|
||||
case 0:
|
||||
len_a = pwnsprintfA(s, ARRAY_SIZE(s), spec, "end");
|
||||
expected_len_a = ntdll__snprintf(expected, ARRAY_SIZE(expected), spec, "end");
|
||||
len_w = pwnsprintfW(ws, ARRAY_SIZE(ws), specw, L"end");
|
||||
expected_len_w = ntdll__snwprintf(expectedw, ARRAY_SIZE(expectedw), specw, L"end");
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
len_a = pwnsprintfA(s, ARRAY_SIZE(s), spec, (ULONG)tests[i].arg, "end");
|
||||
expected_len_a = ntdll__snprintf(expected, ARRAY_SIZE(expected), spec, (ULONG)tests[i].arg, "end");
|
||||
if (!tests[i].argw)
|
||||
{
|
||||
len_w = pwnsprintfW(ws, ARRAY_SIZE(ws), specw, (ULONG)tests[i].arg, L"end");
|
||||
expected_len_w = ntdll__snwprintf(expectedw, ARRAY_SIZE(expectedw), specw, (ULONG)tests[i].arg, L"end");
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
len_a = pwnsprintfA(s, ARRAY_SIZE(s), spec, (ULONG64)tests[i].arg, "end");
|
||||
expected_len_a = ntdll__snprintf(expected, ARRAY_SIZE(s), spec, (ULONG64)tests[i].arg, "end");
|
||||
if (!tests[i].argw)
|
||||
{
|
||||
len_w = pwnsprintfW(ws, ARRAY_SIZE(ws), specw, (ULONG64)tests[i].arg, L"end");
|
||||
expected_len_w = ntdll__snwprintf(expectedw, ARRAY_SIZE(expectedw), specw, (ULONG64)tests[i].arg, L"end");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
len_a = len_w = expected_len_a = expected_len_w = 0;
|
||||
ok(0, "unknown length %u.\n", tests[i].arg_size);
|
||||
break;
|
||||
}
|
||||
ok(len_a == expected_len_a, "got len %d, expected %d.\n", len_a, expected_len_a);
|
||||
ok(!strcmp(s, expected), "got %s, expected %s.\n", debugstr_a(s), debugstr_a(expected));
|
||||
ok(len_w == expected_len_w, "got len %d, expected %d.\n", len_a, expected_len_a);
|
||||
ok(!wcscmp(ws, expectedw), "got %s, expected %s.\n", debugstr_w(ws), debugstr_w(expectedw));
|
||||
winetest_pop_context();
|
||||
}
|
||||
}
|
||||
|
||||
START_TEST(string)
|
||||
{
|
||||
HMODULE hShlwapi;
|
||||
@@ -1644,6 +1953,7 @@ START_TEST(string)
|
||||
pStrCpyNXW = (void *)GetProcAddress(hShlwapi, (LPSTR)400);
|
||||
pStrChrNW = (void *)GetProcAddress(hShlwapi, "StrChrNW");
|
||||
pStrFormatByteSize64A = (void *)GetProcAddress(hShlwapi, "StrFormatByteSize64A");
|
||||
pStrFormatByteSizeEx = (void *)GetProcAddress(hShlwapi, "StrFormatByteSizeEx");
|
||||
pStrFormatKBSizeA = (void *)GetProcAddress(hShlwapi, "StrFormatKBSizeA");
|
||||
pStrFormatKBSizeW = (void *)GetProcAddress(hShlwapi, "StrFormatKBSizeW");
|
||||
pStrIsIntlEqualA = (void *)GetProcAddress(hShlwapi, "StrIsIntlEqualA");
|
||||
@@ -1680,6 +1990,7 @@ START_TEST(string)
|
||||
if (is_lang_english() && is_locale_english())
|
||||
{
|
||||
test_StrFormatByteSize64A();
|
||||
test_StrFormatByteSizeEx();
|
||||
test_StrFormatKBSizeA();
|
||||
test_StrFormatKBSizeW();
|
||||
}
|
||||
@@ -1706,6 +2017,7 @@ START_TEST(string)
|
||||
test_StrStrNW();
|
||||
test_StrStrNIW();
|
||||
test_StrCatChainW();
|
||||
test_printf_format();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
||||
@@ -104,44 +104,44 @@ static void test_SHCreateThreadRef(void)
|
||||
|
||||
/* start with a clean state */
|
||||
hr = pSHSetThreadRef(NULL);
|
||||
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
|
||||
ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
|
||||
|
||||
pobj = NULL;
|
||||
refcount = 0xdeadbeef;
|
||||
hr = pSHCreateThreadRef(&refcount, &pobj);
|
||||
ok((hr == S_OK) && pobj && (refcount == 1),
|
||||
"got 0x%x and %p with %d (expected S_OK and '!= NULL' with 1)\n",
|
||||
"got 0x%lx and %p with %ld (expected S_OK and '!= NULL' with 1)\n",
|
||||
hr, pobj, refcount);
|
||||
|
||||
/* the object is not automatic set as ThreadRef */
|
||||
punk = NULL;
|
||||
hr = pSHGetThreadRef(&punk);
|
||||
ok( (hr == E_NOINTERFACE) && (punk == NULL),
|
||||
"got 0x%x and %p (expected E_NOINTERFACE and NULL)\n", hr, punk);
|
||||
"got 0x%lx and %p (expected E_NOINTERFACE and NULL)\n", hr, punk);
|
||||
|
||||
/* set the object */
|
||||
hr = pSHSetThreadRef(pobj);
|
||||
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
|
||||
ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
|
||||
|
||||
/* read back */
|
||||
punk = NULL;
|
||||
hr = pSHGetThreadRef(&punk);
|
||||
ok( (hr == S_OK) && (punk == pobj) && (refcount == 2),
|
||||
"got 0x%x and %p with %d (expected S_OK and %p with 2)\n",
|
||||
"got 0x%lx and %p with %ld (expected S_OK and %p with 2)\n",
|
||||
hr, punk, refcount, pobj);
|
||||
|
||||
/* free the ref from SHGetThreadRef */
|
||||
if (SUCCEEDED(hr)) {
|
||||
hr = IUnknown_Release(pobj);
|
||||
ok((hr == 1) && (hr == refcount),
|
||||
"got %d with %d (expected 1 with 1)\n", hr, refcount);
|
||||
"got %ld with %ld (expected 1 with 1)\n", hr, refcount);
|
||||
}
|
||||
|
||||
/* free the object */
|
||||
if (pobj) {
|
||||
hr = IUnknown_Release(pobj);
|
||||
ok((hr == 0) && (hr == refcount),
|
||||
"got %d with %d (expected 0 with 0)\n", hr, refcount);
|
||||
"got %ld with %ld (expected 0 with 0)\n", hr, refcount);
|
||||
}
|
||||
|
||||
if (0) {
|
||||
@@ -149,25 +149,25 @@ static void test_SHCreateThreadRef(void)
|
||||
but the object no longer exist after the *_Release */
|
||||
punk = NULL;
|
||||
hr = pSHGetThreadRef(&punk);
|
||||
trace("got 0x%x and %p with %d\n", hr, punk, refcount);
|
||||
trace("got 0x%lx and %p with %ld\n", hr, punk, refcount);
|
||||
}
|
||||
|
||||
/* remove the dead object pointer */
|
||||
hr = pSHSetThreadRef(NULL);
|
||||
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
|
||||
ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
|
||||
|
||||
/* parameter check */
|
||||
if (0) {
|
||||
/* vista: E_INVALIDARG, XP: crash */
|
||||
pobj = NULL;
|
||||
hr = pSHCreateThreadRef(NULL, &pobj);
|
||||
ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
|
||||
ok(hr == E_INVALIDARG, "got 0x%lx (expected E_INVALIDARG)\n", hr);
|
||||
|
||||
refcount = 0xdeadbeef;
|
||||
/* vista: E_INVALIDARG, XP: crash */
|
||||
hr = pSHCreateThreadRef(&refcount, NULL);
|
||||
ok( (hr == E_INVALIDARG) && (refcount == 0xdeadbeef),
|
||||
"got 0x%x with 0x%x (expected E_INVALIDARG and oxdeadbeef)\n",
|
||||
"got 0x%lx with 0x%lx (expected E_INVALIDARG and oxdeadbeef)\n",
|
||||
hr, refcount);
|
||||
}
|
||||
}
|
||||
@@ -187,7 +187,7 @@ static void test_SHGetThreadRef(void)
|
||||
punk = NULL;
|
||||
hr = pSHGetThreadRef(&punk);
|
||||
ok( (hr == E_NOINTERFACE) && (punk == NULL),
|
||||
"got 0x%x and %p (expected E_NOINTERFACE and NULL)\n", hr, punk);
|
||||
"got 0x%lx and %p (expected E_NOINTERFACE and NULL)\n", hr, punk);
|
||||
|
||||
if (0) {
|
||||
/* this crash on Windows */
|
||||
@@ -210,7 +210,7 @@ static void test_SHSetThreadRef(void)
|
||||
|
||||
/* start with a clean state */
|
||||
hr = pSHSetThreadRef(NULL);
|
||||
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
|
||||
ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
|
||||
|
||||
/* build and set out object */
|
||||
init_threadref(&ref, &refcount);
|
||||
@@ -218,7 +218,7 @@ static void test_SHSetThreadRef(void)
|
||||
refcount = 1;
|
||||
hr = pSHSetThreadRef(&ref.IUnknown_iface);
|
||||
ok( (hr == S_OK) && (refcount == 1) && (!AddRef_called),
|
||||
"got 0x%x with %d, %d (expected S_OK with 1, 0)\n",
|
||||
"got 0x%lx with %ld, %ld (expected S_OK with 1, 0)\n",
|
||||
hr, refcount, AddRef_called);
|
||||
|
||||
/* read back our object */
|
||||
@@ -227,17 +227,17 @@ static void test_SHSetThreadRef(void)
|
||||
punk = NULL;
|
||||
hr = pSHGetThreadRef(&punk);
|
||||
ok( (hr == S_OK) && (punk == &ref.IUnknown_iface) && (refcount == 2) && (AddRef_called == 1),
|
||||
"got 0x%x and %p with %d, %d (expected S_OK and %p with 2, 1)\n",
|
||||
"got 0x%lx and %p with %ld, %ld (expected S_OK and %p with 2, 1)\n",
|
||||
hr, punk, refcount, AddRef_called, &ref);
|
||||
|
||||
/* clear the object pointer */
|
||||
hr = pSHSetThreadRef(NULL);
|
||||
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
|
||||
ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
|
||||
|
||||
/* verify, that our object is no longer known as ThreadRef */
|
||||
hr = pSHGetThreadRef(&punk);
|
||||
ok( (hr == E_NOINTERFACE) && (punk == NULL),
|
||||
"got 0x%x and %p (expected E_NOINTERFACE and NULL)\n", hr, punk);
|
||||
"got 0x%lx and %p (expected E_NOINTERFACE and NULL)\n", hr, punk);
|
||||
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user