Wine-devel
Threads by month
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
April 2022
- 87 participants
- 938 discussions
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/wineoss.drv/mmdevdrv.c | 30 +++++++++++++-----------------
1 file changed, 13 insertions(+), 17 deletions(-)
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c
index 0269f0fa536..c72f29b5540 100644
--- a/dlls/wineoss.drv/mmdevdrv.c
+++ b/dlls/wineoss.drv/mmdevdrv.c
@@ -346,27 +346,23 @@ static void get_device_guid(EDataFlow flow, const char *device, GUID *guid)
RegCloseKey(key);
}
-static const char *oss_clean_devnode(const char *devnode)
+/* dst must be large enough to hold devnode */
+static void oss_clean_devnode(char *dest, const char *devnode)
{
- static char ret[OSS_DEVNODE_SIZE];
-
const char *dot, *slash;
size_t len;
- dot = strrchr(devnode, '.');
+ strcpy(dest, devnode);
+ dot = strrchr(dest, '.');
if(!dot)
- return devnode;
+ return;
- slash = strrchr(devnode, '/');
+ slash = strrchr(dest, '/');
if(slash && dot < slash)
- return devnode;
-
- len = dot - devnode;
-
- memcpy(ret, devnode, len);
- ret[len] = '\0';
+ return;
- return ret;
+ len = dot - dest;
+ dest[len] = '\0';
}
static UINT get_default_index(EDataFlow flow)
@@ -374,7 +370,7 @@ static UINT get_default_index(EDataFlow flow)
int fd = -1, err;
UINT i;
oss_audioinfo ai;
- const char *devnode;
+ char devnode[OSS_DEVNODE_SIZE];
OSSDevice *dev_item;
if(flow == eRender)
@@ -397,7 +393,7 @@ static UINT get_default_index(EDataFlow flow)
close(fd);
TRACE("Default devnode: %s\n", ai.devnode);
- devnode = oss_clean_devnode(ai.devnode);
+ oss_clean_devnode(devnode, ai.devnode);
i = 0;
LIST_FOR_EACH_ENTRY(dev_item, &g_devices, OSSDevice, entry){
if(dev_item->flow == flow){
@@ -465,7 +461,7 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, GUID **guids,
*num = 0;
for(i = 0; i < sysinfo.numaudios; ++i){
oss_audioinfo ai = {0};
- const char *devnode;
+ char devnode[OSS_DEVNODE_SIZE];
OSSDevice *dev_item;
int fd;
@@ -476,7 +472,7 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, GUID **guids,
continue;
}
- devnode = oss_clean_devnode(ai.devnode);
+ oss_clean_devnode(devnode, ai.devnode);
/* check for duplicates */
LIST_FOR_EACH_ENTRY(dev_item, &g_devices, OSSDevice, entry){
--
2.25.1
2
1
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/wineoss.drv/Makefile.in | 4 +-
dlls/wineoss.drv/mmdevdrv.c | 60 ++++++-----------------
dlls/wineoss.drv/oss.c | 94 ++++++++++++++++++++++++++++++++++++
dlls/wineoss.drv/unixlib.h | 40 +++++++++++++++
4 files changed, 153 insertions(+), 45 deletions(-)
create mode 100644 dlls/wineoss.drv/oss.c
create mode 100644 dlls/wineoss.drv/unixlib.h
diff --git a/dlls/wineoss.drv/Makefile.in b/dlls/wineoss.drv/Makefile.in
index ce96ca73bf4..d48db94b929 100644
--- a/dlls/wineoss.drv/Makefile.in
+++ b/dlls/wineoss.drv/Makefile.in
@@ -1,5 +1,6 @@
EXTRADEFS = -DWINE_NO_LONG_TYPES
MODULE = wineoss.drv
+UNIXLIB = wineoss.so
IMPORTS = uuid ole32 user32 advapi32
DELAYIMPORTS = winmm
EXTRALIBS = $(OSS4_LIBS)
@@ -11,4 +12,5 @@ C_SRCS = \
midi.c \
midipatch.c \
mmaux.c \
- mmdevdrv.c
+ mmdevdrv.c \
+ oss.c
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c
index b340db00c3c..0269f0fa536 100644
--- a/dlls/wineoss.drv/mmdevdrv.c
+++ b/dlls/wineoss.drv/mmdevdrv.c
@@ -1,5 +1,6 @@
/*
* Copyright 2011 Andrew Eikum for CodeWeavers
+ * 2022 Huw Davies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -35,10 +36,9 @@
#include "windef.h"
#include "winbase.h"
+#include "winternl.h"
#include "winnls.h"
#include "winreg.h"
-#include "wine/debug.h"
-#include "wine/list.h"
#include "ole2.h"
#include "mmdeviceapi.h"
@@ -51,10 +51,18 @@
#include "audiopolicy.h"
#include "audioclient.h"
+#include "wine/debug.h"
+#include "wine/list.h"
+#include "wine/unixlib.h"
+
+#include "unixlib.h"
+
WINE_DEFAULT_DEBUG_CHANNEL(oss);
#define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER)
+unixlib_handle_t oss_handle = 0;
+
static const REFERENCE_TIME DefaultPeriod = 100000;
static const REFERENCE_TIME MinimumPeriod = 50000;
@@ -233,6 +241,9 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved)
switch (reason)
{
case DLL_PROCESS_ATTACH:
+ if(NtQueryVirtualMemory(GetCurrentProcess(), dll, MemoryWineUnixFuncs,
+ &oss_handle, sizeof(oss_handle), NULL))
+ return FALSE;
g_timer_q = CreateTimerQueue();
if(!g_timer_q)
return FALSE;
@@ -254,52 +265,13 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved)
return TRUE;
}
-/* From <dlls/mmdevapi/mmdevapi.h> */
-enum DriverPriority {
- Priority_Unavailable = 0,
- Priority_Low,
- Priority_Neutral,
- Priority_Preferred
-};
-
int WINAPI AUDDRV_GetPriority(void)
{
- int mixer_fd;
- oss_sysinfo sysinfo;
-
- /* Attempt to determine if we are running on OSS or ALSA's OSS
- * compatibility layer. There is no official way to do that, so just check
- * for validity as best as possible, without rejecting valid OSS
- * implementations. */
-
- mixer_fd = open("/dev/mixer", O_RDONLY, 0);
- if(mixer_fd < 0){
- TRACE("Priority_Unavailable: open failed\n");
- return Priority_Unavailable;
- }
-
- sysinfo.version[0] = 0xFF;
- sysinfo.versionnum = ~0;
- if(ioctl(mixer_fd, SNDCTL_SYSINFO, &sysinfo) < 0){
- TRACE("Priority_Unavailable: ioctl failed\n");
- close(mixer_fd);
- return Priority_Unavailable;
- }
-
- close(mixer_fd);
-
- if(sysinfo.version[0] < '4' || sysinfo.version[0] > '9'){
- TRACE("Priority_Low: sysinfo.version[0]: %x\n", sysinfo.version[0]);
- return Priority_Low;
- }
- if(sysinfo.versionnum & 0x80000000){
- TRACE("Priority_Low: sysinfo.versionnum: %x\n", sysinfo.versionnum);
- return Priority_Low;
- }
+ struct test_connect_params params;
- TRACE("Priority_Preferred: Seems like valid OSS!\n");
+ OSS_CALL(test_connect, ¶ms);
- return Priority_Preferred;
+ return params.priority;
}
static void set_device_guid(EDataFlow flow, HKEY drv_key, const WCHAR *key_name,
diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c
new file mode 100644
index 00000000000..9c1de25acb5
--- /dev/null
+++ b/dlls/wineoss.drv/oss.c
@@ -0,0 +1,94 @@
+/*
+ * OSS driver (unixlib)
+ *
+ * Copyright 2011 Andrew Eikum for CodeWeavers
+ * 2022 Huw Davies
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#if 0
+#pragma makedep unix
+#endif
+
+#include <stdarg.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/soundcard.h>
+
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
+#include "winternl.h"
+
+#include "wine/debug.h"
+#include "wine/unixlib.h"
+
+#include "unixlib.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(oss);
+
+static NTSTATUS test_connect(void *args)
+{
+ struct test_connect_params *params = args;
+ int mixer_fd;
+ oss_sysinfo sysinfo;
+
+ /* Attempt to determine if we are running on OSS or ALSA's OSS
+ * compatibility layer. There is no official way to do that, so just check
+ * for validity as best as possible, without rejecting valid OSS
+ * implementations. */
+
+ mixer_fd = open("/dev/mixer", O_RDONLY, 0);
+ if(mixer_fd < 0){
+ TRACE("Priority_Unavailable: open failed\n");
+ params->priority = Priority_Unavailable;
+ return STATUS_SUCCESS;
+ }
+
+ sysinfo.version[0] = 0xFF;
+ sysinfo.versionnum = ~0;
+ if(ioctl(mixer_fd, SNDCTL_SYSINFO, &sysinfo) < 0){
+ TRACE("Priority_Unavailable: ioctl failed\n");
+ close(mixer_fd);
+ params->priority = Priority_Unavailable;
+ return STATUS_SUCCESS;
+ }
+
+ close(mixer_fd);
+
+ if(sysinfo.version[0] < '4' || sysinfo.version[0] > '9'){
+ TRACE("Priority_Low: sysinfo.version[0]: %x\n", sysinfo.version[0]);
+ params->priority = Priority_Low;
+ return STATUS_SUCCESS;
+ }
+ if(sysinfo.versionnum & 0x80000000){
+ TRACE("Priority_Low: sysinfo.versionnum: %x\n", sysinfo.versionnum);
+ params->priority = Priority_Low;
+ return STATUS_SUCCESS;
+ }
+
+ TRACE("Priority_Preferred: Seems like valid OSS!\n");
+
+ params->priority = Priority_Preferred;
+ return STATUS_SUCCESS;
+}
+
+unixlib_entry_t __wine_unix_call_funcs[] =
+{
+ test_connect,
+};
diff --git a/dlls/wineoss.drv/unixlib.h b/dlls/wineoss.drv/unixlib.h
new file mode 100644
index 00000000000..d4fb5db3102
--- /dev/null
+++ b/dlls/wineoss.drv/unixlib.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 Huw Davies
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+/* From <dlls/mmdevapi/mmdevapi.h> */
+enum DriverPriority
+{
+ Priority_Unavailable = 0,
+ Priority_Low,
+ Priority_Neutral,
+ Priority_Preferred
+};
+
+struct test_connect_params
+{
+ enum DriverPriority priority;
+};
+
+enum oss_funcs
+{
+ oss_test_connect,
+};
+
+extern unixlib_handle_t oss_handle;
+
+#define OSS_CALL(func, params) __wine_unix_call(oss_handle, oss_ ## func, params)
--
2.25.1
2
1
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/shell32/tests/assoc.c | 7 +++----
dlls/shell32/tests/autocomplete.c | 5 ++---
dlls/shell32/tests/ebrowser.c | 13 ++++++-------
dlls/shell32/tests/msg.h | 9 ++++-----
dlls/shell32/tests/shelldispatch.c | 5 ++---
dlls/shell32/tests/shelllink.c | 5 ++---
dlls/shell32/tests/shlexec.c | 9 ++++-----
dlls/shell32/tests/shlfolder.c | 21 ++++++++++-----------
dlls/shell32/tests/shlview.c | 9 ++++-----
9 files changed, 37 insertions(+), 46 deletions(-)
diff --git a/dlls/shell32/tests/assoc.c b/dlls/shell32/tests/assoc.c
index 403390d8a09..0e28d9f0355 100644
--- a/dlls/shell32/tests/assoc.c
+++ b/dlls/shell32/tests/assoc.c
@@ -25,7 +25,6 @@
#include "shlguid.h"
#include "shobjidl.h"
-#include "wine/heap.h"
#include "wine/test.h"
@@ -104,8 +103,8 @@ static struct assoc_getstring_test getstring_tests[] =
static void getstring_test(LPCWSTR assocName, HKEY progIdKey, ASSOCSTR str, LPCWSTR expected_string, int line)
{
IQueryAssociations *assoc;
+ WCHAR *buffer;
HRESULT hr;
- WCHAR *buffer = NULL;
DWORD len;
hr = CoCreateInstance(&CLSID_QueryAssociations, NULL, CLSCTX_INPROC_SERVER, &IID_IQueryAssociations, (void*)&assoc);
@@ -122,19 +121,19 @@ static void getstring_test(LPCWSTR assocName, HKEY progIdKey, ASSOCSTR str, LPCW
return;
}
- buffer = heap_alloc(len * sizeof(WCHAR));
+ buffer = malloc(len * sizeof(WCHAR));
ok_(__FILE__, line)(buffer != NULL, "out of memory\n");
hr = IQueryAssociations_GetString(assoc, 0, str, NULL, buffer, &len);
ok_(__FILE__, line)(hr == S_OK, "GetString returned 0x%lx, expected S_OK\n", hr);
ok_(__FILE__, line)(lstrcmpW(buffer, expected_string) == 0, "GetString returned %s, expected %s\n",
wine_dbgstr_w(buffer), wine_dbgstr_w(expected_string));
+ free(buffer);
} else {
ok_(__FILE__, line)(FAILED(hr), "GetString returned 0x%lx, expected failure\n", hr);
}
IQueryAssociations_Release(assoc);
- heap_free(buffer);
}
static void test_IQueryAssociations_GetString(void)
diff --git a/dlls/shell32/tests/autocomplete.c b/dlls/shell32/tests/autocomplete.c
index 0631126c021..d0df5b225c1 100644
--- a/dlls/shell32/tests/autocomplete.c
+++ b/dlls/shell32/tests/autocomplete.c
@@ -28,7 +28,6 @@
#include "shldisp.h"
#include "shlobj.h"
-#include "wine/heap.h"
#include "wine/test.h"
static HWND hMainWnd, hEdit;
@@ -317,7 +316,7 @@ static ULONG WINAPI string_enumerator_Release(IEnumString *iface)
ULONG ref = InterlockedDecrement(&this->ref);
if (!ref)
- heap_free(this);
+ free(this);
return ref;
}
@@ -426,7 +425,7 @@ static HRESULT string_enumerator_create(void **ppv, WCHAR **suggestions, int cou
{
struct string_enumerator *object;
- object = heap_alloc_zero(sizeof(*object));
+ object = calloc(1, sizeof(*object));
object->IEnumString_iface.lpVtbl = &string_enumerator_vtbl;
object->IACList_iface.lpVtbl = &aclist_vtbl;
object->ref = 1;
diff --git a/dlls/shell32/tests/ebrowser.c b/dlls/shell32/tests/ebrowser.c
index 257084053a7..9402388f643 100644
--- a/dlls/shell32/tests/ebrowser.c
+++ b/dlls/shell32/tests/ebrowser.c
@@ -26,7 +26,6 @@
#include "shlobj.h"
#include "shlwapi.h"
-#include "wine/heap.h"
#include "wine/test.h"
#include "initguid.h"
@@ -193,7 +192,7 @@ static ULONG WINAPI IExplorerPaneVisibility_fnRelease(IExplorerPaneVisibility *i
ULONG ref = InterlockedDecrement(&This->ref);
if(!ref)
- heap_free(This);
+ free(This);
return ref;
}
@@ -239,7 +238,7 @@ static IExplorerPaneVisibilityImpl *create_explorerpanevisibility(void)
{
IExplorerPaneVisibilityImpl *epv;
- epv = heap_alloc_zero(sizeof(*epv));
+ epv = calloc(1, sizeof(*epv));
epv->IExplorerPaneVisibility_iface.lpVtbl = &epvvt;
epv->ref = 1;
@@ -282,7 +281,7 @@ static ULONG WINAPI ICommDlgBrowser3_fnRelease(ICommDlgBrowser3 *iface)
ULONG ref = InterlockedDecrement(&This->ref);
if(!ref)
- heap_free(This);
+ free(This);
return ref;
}
@@ -393,7 +392,7 @@ static ICommDlgBrowser3Impl *create_commdlgbrowser3(void)
{
ICommDlgBrowser3Impl *cdb;
- cdb = heap_alloc_zero(sizeof(*cdb));
+ cdb = calloc(1, sizeof(*cdb));
cdb->ICommDlgBrowser3_iface.lpVtbl = &cdbvtbl;
cdb->ref = 1;
@@ -450,7 +449,7 @@ static ULONG WINAPI IServiceProvider_fnRelease(IServiceProvider *iface)
LONG ref = InterlockedDecrement(&This->ref);
if(!ref)
- heap_free(This);
+ free(This);
return ref;
}
@@ -491,7 +490,7 @@ static const IServiceProviderVtbl spvtbl =
static IServiceProviderImpl *create_serviceprovider(void)
{
- IServiceProviderImpl *sp = heap_alloc(sizeof(*sp));
+ IServiceProviderImpl *sp = malloc(sizeof(*sp));
sp->IServiceProvider_iface.lpVtbl = &spvtbl;
sp->ref = 1;
return sp;
diff --git a/dlls/shell32/tests/msg.h b/dlls/shell32/tests/msg.h
index a6c16ae05e6..a2b723cfb89 100644
--- a/dlls/shell32/tests/msg.h
+++ b/dlls/shell32/tests/msg.h
@@ -21,7 +21,6 @@
#include <assert.h>
#include <windows.h>
-#include "wine/heap.h"
#include "wine/test.h"
/* undocumented SWP flags - from SDK 3.1 */
@@ -68,13 +67,13 @@ static void add_message(struct msg_sequence **seq, int sequence_index,
if (!msg_seq->sequence)
{
msg_seq->size = 10;
- msg_seq->sequence = heap_alloc(msg_seq->size * sizeof (struct message));
+ msg_seq->sequence = malloc(msg_seq->size * sizeof (struct message));
}
if (msg_seq->count == msg_seq->size)
{
msg_seq->size *= 2;
- msg_seq->sequence = heap_realloc(msg_seq->sequence, msg_seq->size * sizeof (struct message));
+ msg_seq->sequence = realloc(msg_seq->sequence, msg_seq->size * sizeof (struct message));
}
assert(msg_seq->sequence);
@@ -91,7 +90,7 @@ static void add_message(struct msg_sequence **seq, int sequence_index,
static void flush_sequence(struct msg_sequence **seg, int sequence_index)
{
struct msg_sequence *msg_seq = seg[sequence_index];
- heap_free(msg_seq->sequence);
+ free(msg_seq->sequence);
msg_seq->sequence = NULL;
msg_seq->count = msg_seq->size = 0;
}
@@ -289,5 +288,5 @@ static void init_msg_sequences(struct msg_sequence **seq, int n)
int i;
for (i = 0; i < n; i++)
- seq[i] = heap_alloc_zero(sizeof(struct msg_sequence));
+ seq[i] = calloc(1, sizeof(struct msg_sequence));
}
diff --git a/dlls/shell32/tests/shelldispatch.c b/dlls/shell32/tests/shelldispatch.c
index 3894f67dd11..67659f72345 100644
--- a/dlls/shell32/tests/shelldispatch.c
+++ b/dlls/shell32/tests/shelldispatch.c
@@ -27,7 +27,6 @@
#include "shlwapi.h"
#include "winsvc.h"
-#include "wine/heap.h"
#include "wine/test.h"
#include "initguid.h"
@@ -278,7 +277,7 @@ static void test_namespace(void)
GetFullPathNameW(winetestW, MAX_PATH, tempW, NULL);
len = GetLongPathNameW(tempW, NULL, 0);
- long_pathW = heap_alloc(len * sizeof(WCHAR));
+ long_pathW = malloc(len * sizeof(WCHAR));
GetLongPathNameW(tempW, long_pathW, len);
V_VT(&var) = VT_BSTR;
@@ -350,7 +349,7 @@ static void test_namespace(void)
SysFreeString(V_BSTR(&var));
}
- heap_free(long_pathW);
+ free(long_pathW);
RemoveDirectoryW(winetestW);
SetCurrentDirectoryW(curW);
IShellDispatch_Release(sd);
diff --git a/dlls/shell32/tests/shelllink.c b/dlls/shell32/tests/shelllink.c
index e4e1e664038..8cbc46696ab 100644
--- a/dlls/shell32/tests/shelllink.c
+++ b/dlls/shell32/tests/shelllink.c
@@ -29,7 +29,6 @@
#include "shellapi.h"
#include "commoncontrols.h"
-#include "wine/heap.h"
#include "wine/test.h"
#include "shell32_test.h"
@@ -70,12 +69,12 @@ static LPITEMIDLIST path_to_pidl(const char* path)
int len;
len=MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
- pathW = heap_alloc(len * sizeof(WCHAR));
+ pathW = malloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, path, -1, pathW, len);
r=pSHILCreateFromPath(pathW, &pidl, NULL);
ok(r == S_OK, "SHILCreateFromPath failed (0x%08lx)\n", r);
- heap_free(pathW);
+ free(pathW);
}
return pidl;
}
diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c
index cea7245f387..50c2e84578b 100644
--- a/dlls/shell32/tests/shlexec.c
+++ b/dlls/shell32/tests/shlexec.c
@@ -40,7 +40,6 @@
#include "shlwapi.h"
#include "ddeml.h"
-#include "wine/heap.h"
#include "wine/test.h"
#include "shell32_test.h"
@@ -756,7 +755,7 @@ static LSTATUS myRegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey)
if (dwMaxLen > ARRAY_SIZE(szNameBuf))
{
/* Name too big: alloc a buffer for it */
- if (!(lpszName = heap_alloc(dwMaxLen*sizeof(CHAR))))
+ if (!(lpszName = malloc(dwMaxLen*sizeof(CHAR))))
{
ret = ERROR_NOT_ENOUGH_MEMORY;
goto cleanup;
@@ -791,7 +790,7 @@ static LSTATUS myRegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey)
cleanup:
/* Free buffer if allocated */
if (lpszName != szNameBuf)
- heap_free(lpszName);
+ free(lpszName);
if(lpszSubKey)
RegCloseKey(hSubKey);
return ret;
@@ -851,11 +850,11 @@ static void create_test_verb_dde(const char* classname, const char* verb,
}
else
{
- cmd = heap_alloc(strlen(argv0) + 10 + strlen(child_file) + 2 + strlen(cmdtail) + 1);
+ cmd = malloc(strlen(argv0) + 10 + strlen(child_file) + 2 + strlen(cmdtail) + 1);
sprintf(cmd,"%s shlexec \"%s\" %s", argv0, child_file, cmdtail);
rc=RegSetValueExA(hkey_cmd, NULL, 0, REG_SZ, (LPBYTE)cmd, strlen(cmd)+1);
ok(rc == ERROR_SUCCESS, "setting command failed with %ld\n", rc);
- heap_free(cmd);
+ free(cmd);
}
if (ddeexec)
diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c
index 7b81ef98110..f99045c33d5 100644
--- a/dlls/shell32/tests/shlfolder.c
+++ b/dlls/shell32/tests/shlfolder.c
@@ -37,7 +37,6 @@
#include "ocidl.h"
#include "oleauto.h"
-#include "wine/heap.h"
#include "wine/test.h"
#include <initguid.h>
@@ -75,7 +74,7 @@ static WCHAR *make_wstr(const char *str)
if(!len || len < 0)
return NULL;
- ret = heap_alloc(len * sizeof(WCHAR));
+ ret = malloc(len * sizeof(WCHAR));
if(!ret)
return NULL;
@@ -3032,7 +3031,7 @@ static void test_SHGetIDListFromObject(void)
hres = pSHGetIDListFromObject(NULL, &pidl);
ok(hres == E_NOINTERFACE, "Got %lx\n", hres);
- punkimpl = heap_alloc(sizeof(*punkimpl));
+ punkimpl = malloc(sizeof(*punkimpl));
punkimpl->IUnknown_iface.lpVtbl = &vt_IUnknown;
punkimpl->ifaces = ifaces;
punkimpl->unknown = 0;
@@ -3049,7 +3048,7 @@ static void test_SHGetIDListFromObject(void)
"interface not requested.\n");
ok(!punkimpl->unknown, "Got %ld unknown.\n", punkimpl->unknown);
- heap_free(punkimpl);
+ free(punkimpl);
pidl_desktop = NULL;
SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
@@ -3203,7 +3202,7 @@ static void test_SHGetItemFromObject(void)
hres = pSHGetItemFromObject(NULL, &IID_IUnknown, (void**)&punk);
ok(hres == E_NOINTERFACE, "Got 0x%08lx\n", hres);
- punkimpl = heap_alloc(sizeof(*punkimpl));
+ punkimpl = malloc(sizeof(*punkimpl));
punkimpl->IUnknown_iface.lpVtbl = &vt_IUnknown;
punkimpl->ifaces = ifaces;
punkimpl->unknown = 0;
@@ -3221,7 +3220,7 @@ static void test_SHGetItemFromObject(void)
"interface not requested.\n");
ok(!punkimpl->unknown, "Got %ld unknown.\n", punkimpl->unknown);
- heap_free(punkimpl);
+ free(punkimpl);
/* Test IShellItem */
hres = pSHGetItemFromObject((IUnknown*)psfdesktop, &IID_IShellItem, (void**)&psi);
@@ -4584,7 +4583,7 @@ static void r_verify_pidl(unsigned l, LPCITEMIDLIST pidl, const WCHAR *path)
WCHAR *strW = make_wstr(U(filename).cStr);
ok_(__FILE__,l)(!lstrcmpW(path, strW), "didn't get expected path (%s), instead: %s\n",
wine_dbgstr_w(path), U(filename).cStr);
- heap_free(strW);
+ free(strW);
}
IShellFolder_Release(parent);
@@ -4918,8 +4917,8 @@ static LRESULT CALLBACK testwindow_wndproc(HWND hwnd, UINT msg, WPARAM wparam, L
path2 = make_wstr(exp_data->path_2);
verify_pidl(pidls[0], path1);
verify_pidl(pidls[1], path2);
- heap_free(path1);
- heap_free(path2);
+ free(path1);
+ free(path2);
exp_data->missing_events--;
@@ -5027,8 +5026,8 @@ static void test_SHChangeNotify(BOOL test_new_delivery)
do_events();
ok(exp_data->missing_events == 0, "%s: Expected wndproc to be called\n", exp_data->id);
- heap_free(path1);
- heap_free(path2);
+ free(path1);
+ free(path2);
}
}
diff --git a/dlls/shell32/tests/shlview.c b/dlls/shell32/tests/shlview.c
index b405a84bc19..a83f3137509 100644
--- a/dlls/shell32/tests/shlview.c
+++ b/dlls/shell32/tests/shlview.c
@@ -38,7 +38,6 @@
#include "initguid.h"
-#include "wine/heap.h"
#include "wine/test.h"
#include "msg.h"
@@ -150,7 +149,7 @@ static IDataObject* IDataObjectImpl_Construct(void)
{
IDataObjectImpl *obj;
- obj = heap_alloc(sizeof(*obj));
+ obj = malloc(sizeof(*obj));
obj->IDataObject_iface.lpVtbl = &IDataObjectImpl_Vtbl;
obj->ref = 1;
@@ -188,7 +187,7 @@ static ULONG WINAPI IDataObjectImpl_Release(IDataObject * iface)
ULONG ref = InterlockedDecrement(&This->ref);
if (!ref)
- heap_free(This);
+ free(This);
return ref;
}
@@ -275,7 +274,7 @@ static IShellBrowser* IShellBrowserImpl_Construct(void)
{
IShellBrowserImpl *browser;
- browser = heap_alloc(sizeof(*browser));
+ browser = malloc(sizeof(*browser));
browser->IShellBrowser_iface.lpVtbl = &IShellBrowserImpl_Vtbl;
browser->ref = 1;
@@ -318,7 +317,7 @@ static ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface)
ULONG ref = InterlockedDecrement(&This->ref);
if (!ref)
- heap_free(This);
+ free(This);
return ref;
}
--
2.35.1
2
1
[tools] testbot: GetTaskURL() should load URI::Escape only when needed.
by Francois Gouget 05 Apr '22
by Francois Gouget 05 Apr '22
05 Apr '22
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
The build VM does not have URI::Escape and this dependency caused the
build to fail (Reconfig.pl which uses Utils.pm failed to start).
There is really no compeling reason to install URI::Escape on the
build VM so I decided to tweak GetTaskURL() to only import URI::Escape
when needed which should not happen in the VM code.
What this really shows is that GetTaskURL() probably does not belong in
Utils but I'm not sure where else to put it. So that patch will at
least fix the immediate issue. Since GetTaskURL() depends closely on
the web side some place in WineTestBot::CGI may seem logical. But it's
actually used by non-CGI scripts and having them use CGI::something
would be wrong. Maybe the Tasks module is the least bad option though
that's another place that should really not depend on URI::escape.
---
testbot/lib/WineTestBot/Utils.pm | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/testbot/lib/WineTestBot/Utils.pm b/testbot/lib/WineTestBot/Utils.pm
index 13529c323..cf749310d 100644
--- a/testbot/lib/WineTestBot/Utils.pm
+++ b/testbot/lib/WineTestBot/Utils.pm
@@ -34,7 +34,6 @@ our @EXPORT = qw(SecureConnection MakeSecureURL GetTaskURL GenerateRandomString
BatchQuote ShQuote ShArgv2Cmd);
use Fcntl qw(O_CREAT O_EXCL O_WRONLY);
-use URI::Escape;
use WineTestBot::Config;
@@ -89,7 +88,11 @@ sub GetTaskURL($$$;$$)
my $StepTask = 100 * $StepNo + $TaskNo;
my $URL = "/JobDetails.pl?Key=$JobId";
$URL .= "&s$StepTask=1" if ($ShowScreenshot);
- $URL .= "&f$StepTask=". uri_escape($LogName) if ($LogName);
+ if (defined $LogName)
+ {
+ require URI::Escape;
+ $URL .= "&f$StepTask=". URI::Escape::uri_escape($LogName);
+ }
return "$URL#k$StepTask";
}
--
2.30.2
1
0
05 Apr '22
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 308bdda13..77fa41c86 100644
--- a/configure.ac
+++ b/configure.ac
@@ -126,7 +126,7 @@ AS_IF([test "x$with_spirv_tools" = "xyes"],
HAVE_XCB=no
AS_IF([test "x$with_xcb" != "xno"],
- [PKG_CHECK_MODULES([XCB], [xcb xcb-keysyms],
+ [PKG_CHECK_MODULES([XCB], [xcb xcb-event xcb-icccm xcb-keysyms],
[AC_DEFINE([HAVE_XCB], [1], [Define to 1 if you have libxcb.])
HAVE_XCB=yes],
[HAVE_XCB=no])])
--
2.35.1
4
14
05 Apr '22
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/xmllite/tests/writer.c | 674 ++++++++++++++----------------------
1 file changed, 266 insertions(+), 408 deletions(-)
diff --git a/dlls/xmllite/tests/writer.c b/dlls/xmllite/tests/writer.c
index 2f6edb26d16..3e1c362664e 100644
--- a/dlls/xmllite/tests/writer.c
+++ b/dlls/xmllite/tests/writer.c
@@ -32,8 +32,6 @@
#include "initguid.h"
DEFINE_GUID(IID_IXmlWriterOutput, 0xc1131708, 0x0f59, 0x477f, 0x93, 0x59, 0x7d, 0x33, 0x24, 0x51, 0xbc, 0x1a);
-static const WCHAR aW[] = {'a',0};
-
#define EXPECT_REF(obj, ref) _expect_ref((IUnknown *)obj, ref, __LINE__)
static void _expect_ref(IUnknown *obj, ULONG ref, int line)
{
@@ -92,19 +90,6 @@ static void check_output(IStream *stream, const char *expected, BOOL todo, int l
#define CHECK_OUTPUT_TODO(stream, expected) check_output(stream, expected, TRUE, __LINE__)
#define CHECK_OUTPUT_RAW(stream, expected, size) check_output_raw(stream, expected, size, __LINE__)
-static WCHAR *strdupAtoW(const char *str)
-{
- WCHAR *ret = NULL;
- DWORD len;
-
- if (!str) return ret;
- len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
- ret = malloc(len * sizeof(WCHAR));
- if (ret)
- MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
- return ret;
-}
-
static void writer_set_property(IXmlWriter *writer, XmlWriterProperty property)
{
HRESULT hr;
@@ -116,30 +101,29 @@ static void writer_set_property(IXmlWriter *writer, XmlWriterProperty property)
/* used to test all Write* methods for consistent error state */
static void check_writer_state(IXmlWriter *writer, HRESULT exp_hr)
{
- static const WCHAR aW[] = {'a',0};
HRESULT hr;
/* FIXME: add WriteAttributes */
- hr = IXmlWriter_WriteAttributeString(writer, NULL, aW, NULL, aW);
+ hr = IXmlWriter_WriteAttributeString(writer, NULL, L"a", NULL, L"a");
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteCData(writer, aW);
+ hr = IXmlWriter_WriteCData(writer, L"a");
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteCharEntity(writer, aW[0]);
+ hr = IXmlWriter_WriteCharEntity(writer, 'a');
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteChars(writer, aW, 1);
+ hr = IXmlWriter_WriteChars(writer, L"a", 1);
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteComment(writer, aW);
+ hr = IXmlWriter_WriteComment(writer, L"a");
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteDocType(writer, aW, NULL, NULL, NULL);
+ hr = IXmlWriter_WriteDocType(writer, L"a", NULL, NULL, NULL);
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteElementString(writer, NULL, aW, NULL, aW);
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"a", NULL, L"a");
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteEndDocument(writer);
@@ -148,40 +132,40 @@ static void check_writer_state(IXmlWriter *writer, HRESULT exp_hr)
hr = IXmlWriter_WriteEndElement(writer);
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteEntityRef(writer, aW);
+ hr = IXmlWriter_WriteEntityRef(writer, L"a");
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteFullEndElement(writer);
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteName(writer, aW);
+ hr = IXmlWriter_WriteName(writer, L"a");
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteNmToken(writer, aW);
+ hr = IXmlWriter_WriteNmToken(writer, L"a");
ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
/* FIXME: add WriteNode */
/* FIXME: add WriteNodeShallow */
- hr = IXmlWriter_WriteProcessingInstruction(writer, aW, aW);
+ hr = IXmlWriter_WriteProcessingInstruction(writer, L"a", L"a");
ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteQualifiedName(writer, aW, NULL);
+ hr = IXmlWriter_WriteQualifiedName(writer, L"a", NULL);
ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteRaw(writer, aW);
+ hr = IXmlWriter_WriteRaw(writer, L"a");
ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteRawChars(writer, aW, 1);
+ hr = IXmlWriter_WriteRawChars(writer, L"a", 1);
ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr);
- hr = IXmlWriter_WriteString(writer, aW);
+ hr = IXmlWriter_WriteString(writer, L"a");
ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr);
/* FIXME: add WriteSurrogateCharEntity */
@@ -340,25 +324,25 @@ static void test_invalid_output_encoding(IXmlWriter *writer, IUnknown *output)
/* TODO: WriteAttributes */
- hr = IXmlWriter_WriteAttributeString(writer, NULL, aW, NULL, aW);
+ hr = IXmlWriter_WriteAttributeString(writer, NULL, L"a", NULL, L"a");
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteCData(writer, aW);
+ hr = IXmlWriter_WriteCData(writer, L"a");
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteCharEntity(writer, 0x100);
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteChars(writer, aW, 1);
+ hr = IXmlWriter_WriteChars(writer, L"a", 1);
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteComment(writer, aW);
+ hr = IXmlWriter_WriteComment(writer, L"a");
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteDocType(writer, aW, NULL, NULL, NULL);
+ hr = IXmlWriter_WriteDocType(writer, L"a", NULL, NULL, NULL);
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteElementString(writer, NULL, aW, NULL, NULL);
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"a", NULL, NULL);
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer);
@@ -367,40 +351,40 @@ static void test_invalid_output_encoding(IXmlWriter *writer, IUnknown *output)
hr = IXmlWriter_WriteEndElement(writer);
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteEntityRef(writer, aW);
+ hr = IXmlWriter_WriteEntityRef(writer, L"a");
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteFullEndElement(writer);
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteName(writer, aW);
+ hr = IXmlWriter_WriteName(writer, L"a");
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteNmToken(writer, aW);
+ hr = IXmlWriter_WriteNmToken(writer, L"a");
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
/* TODO: WriteNode */
/* TODO: WriteNodeShallow */
- hr = IXmlWriter_WriteProcessingInstruction(writer, aW, aW);
+ hr = IXmlWriter_WriteProcessingInstruction(writer, L"a", L"a");
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteQualifiedName(writer, aW, NULL);
+ hr = IXmlWriter_WriteQualifiedName(writer, L"a", NULL);
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteRaw(writer, aW);
+ hr = IXmlWriter_WriteRaw(writer, L"a");
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteRawChars(writer, aW, 1);
+ hr = IXmlWriter_WriteRawChars(writer, L"a", 1);
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteString(writer, aW);
+ hr = IXmlWriter_WriteString(writer, L"a");
ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
/* TODO: WriteSurrogateCharEntity */
@@ -412,9 +396,6 @@ static void test_invalid_output_encoding(IXmlWriter *writer, IUnknown *output)
static void test_writeroutput(void)
{
- static const WCHAR utf16W[] = {'u','t','f','-','1','6',0};
- static const WCHAR usasciiW[] = {'u','s','-','a','s','c','i','i',0};
- static const WCHAR dummyW[] = {'d','u','m','m','y',0};
static const WCHAR utf16_outputW[] = {0xfeff,'<','a'};
IXmlWriterOutput *output;
IXmlWriter *writer;
@@ -428,7 +409,7 @@ static void test_writeroutput(void)
EXPECT_REF(output, 1);
IUnknown_Release(output);
- hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, utf16W, &output);
+ hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, L"utf-16", &output);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
unk = NULL;
hr = IUnknown_QueryInterface(output, &IID_IXmlWriterOutput, (void**)&unk);
@@ -458,7 +439,7 @@ static void test_writeroutput(void)
/* create with us-ascii */
output = NULL;
- hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, usasciiW, &output);
+ hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, L"us-ascii", &output);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IUnknown_Release(output);
@@ -475,7 +456,7 @@ static void test_writeroutput(void)
hr = IXmlWriter_SetOutput(writer, output);
ok(hr == S_OK, "Failed to set writer output, hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Write failed, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -505,7 +486,7 @@ static void test_writeroutput(void)
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
output = NULL;
- hr = CreateXmlWriterOutputWithEncodingName((IUnknown *)stream, NULL, dummyW, &output);
+ hr = CreateXmlWriterOutputWithEncodingName((IUnknown *)stream, NULL, L"dummy", &output);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
test_invalid_output_encoding(writer, output);
@@ -522,9 +503,6 @@ static void test_writestartdocument(void)
static const char fullprolog[] = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
static const char *prologversion2 = "<?xml version=\"1.0\" encoding=\"uS-asCii\"?>";
static const char prologversion[] = "<?xml version=\"1.0\"?>";
- static const WCHAR versionW[] = {'v','e','r','s','i','o','n','=','"','1','.','0','"',0};
- static const WCHAR usasciiW[] = {'u','S','-','a','s','C','i','i',0};
- static const WCHAR xmlW[] = {'x','m','l',0};
IXmlWriterOutput *output;
IXmlWriter *writer;
IStream *stream;
@@ -537,7 +515,7 @@ static void test_writestartdocument(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW);
+ hr = IXmlWriter_WriteProcessingInstruction(writer, L"xml", L"version=\"1.0\"");
ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -565,7 +543,7 @@ static void test_writestartdocument(void)
/* now add PI manually, and try to start a document */
stream = writer_set_output(writer);
- hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW);
+ hr = IXmlWriter_WriteProcessingInstruction(writer, L"xml", L"version=\"1.0\"");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
@@ -575,7 +553,7 @@ static void test_writestartdocument(void)
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
/* another attempt to add 'xml' PI */
- hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW);
+ hr = IXmlWriter_WriteProcessingInstruction(writer, L"xml", L"version=\"1.0\"");
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -591,7 +569,7 @@ static void test_writestartdocument(void)
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
output = NULL;
- hr = CreateXmlWriterOutputWithEncodingName((IUnknown *)stream, NULL, usasciiW, &output);
+ hr = CreateXmlWriterOutputWithEncodingName((IUnknown *)stream, NULL, L"uS-asCii", &output);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = CreateXmlWriter(&IID_IXmlWriter, (void **)&writer, NULL);
@@ -646,8 +624,6 @@ static void test_flush(void)
static void test_omitxmldeclaration(void)
{
static const char prologversion[] = "<?xml version=\"1.0\"?>";
- static const WCHAR versionW[] = {'v','e','r','s','i','o','n','=','"','1','.','0','"',0};
- static const WCHAR xmlW[] = {'x','m','l',0};
IXmlWriter *writer;
HGLOBAL hglobal;
IStream *stream;
@@ -683,7 +659,7 @@ static void test_omitxmldeclaration(void)
/* now add PI manually, and try to start a document */
stream = writer_set_output(writer);
- hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW);
+ hr = IXmlWriter_WriteProcessingInstruction(writer, L"xml", L"version=\"1.0\"");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -708,7 +684,7 @@ static void test_omitxmldeclaration(void)
CHECK_OUTPUT(stream, prologversion);
/* another attempt to add 'xml' PI */
- hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW);
+ hr = IXmlWriter_WriteProcessingInstruction(writer, L"xml", L"version=\"1.0\"");
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -723,9 +699,6 @@ static void test_bom(void)
static const WCHAR piW[] = {0xfeff,'<','?','x','m','l',' ','v','e','r','s','i','o','n','=','"','1','.','0','"','?','>'};
static const WCHAR aopenW[] = {0xfeff,'<','a'};
static const WCHAR afullW[] = {0xfeff,'<','a',' ','/','>'};
- static const WCHAR versionW[] = {'v','e','r','s','i','o','n','=','"','1','.','0','"',0};
- static const WCHAR utf16W[] = {'u','t','f','-','1','6',0};
- static const WCHAR xmlW[] = {'x','m','l',0};
static const WCHAR bomW[] = {0xfeff};
IXmlWriterOutput *output;
IXmlWriter *writer;
@@ -736,7 +709,7 @@ static void test_bom(void)
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
+ hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, L"utf-16", &output);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
@@ -763,13 +736,13 @@ static void test_bom(void)
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
+ hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, L"utf-16", &output);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_SetOutput(writer, output);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW);
+ hr = IXmlWriter_WriteProcessingInstruction(writer, L"xml", L"version=\"1.0\"");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -784,13 +757,13 @@ static void test_bom(void)
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
+ hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, L"utf-16", &output);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_SetOutput(writer, output);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -805,7 +778,7 @@ static void test_bom(void)
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
+ hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, L"utf-16", &output);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_SetOutput(writer, output);
@@ -813,7 +786,7 @@ static void test_bom(void)
writer_set_property(writer, XmlWriterProperty_Indent);
- hr = IXmlWriter_WriteElementString(writer, NULL, aW, NULL, NULL);
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"a", NULL, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -830,67 +803,13 @@ static void test_bom(void)
IXmlWriter_Release(writer);
}
-static HRESULT write_start_element(IXmlWriter *writer, const char *prefix, const char *local,
- const char *uri)
-{
- WCHAR *prefixW, *localW, *uriW;
- HRESULT hr;
-
- prefixW = strdupAtoW(prefix);
- localW = strdupAtoW(local);
- uriW = strdupAtoW(uri);
-
- hr = IXmlWriter_WriteStartElement(writer, prefixW, localW, uriW);
-
- free(prefixW);
- free(localW);
- free(uriW);
-
- return hr;
-}
-
-static HRESULT write_element_string(IXmlWriter *writer, const char *prefix, const char *local,
- const char *uri, const char *value)
-{
- WCHAR *prefixW, *localW, *uriW, *valueW;
- HRESULT hr;
-
- prefixW = strdupAtoW(prefix);
- localW = strdupAtoW(local);
- uriW = strdupAtoW(uri);
- valueW = strdupAtoW(value);
-
- hr = IXmlWriter_WriteElementString(writer, prefixW, localW, uriW, valueW);
-
- free(prefixW);
- free(localW);
- free(uriW);
- free(valueW);
-
- return hr;
-}
-
-static HRESULT write_string(IXmlWriter *writer, const char *str)
-{
- WCHAR *strW;
- HRESULT hr;
-
- strW = strdupAtoW(str);
-
- hr = IXmlWriter_WriteString(writer, strW);
-
- free(strW);
-
- return hr;
-}
-
static void test_WriteStartElement(void)
{
static const struct
{
- const char *prefix;
- const char *local;
- const char *uri;
+ const WCHAR *prefix;
+ const WCHAR *local;
+ const WCHAR *uri;
const char *output;
const char *output_partial;
HRESULT hr;
@@ -899,22 +818,21 @@ static void test_WriteStartElement(void)
}
start_element_tests[] =
{
- { "prefix", "local", "uri", "<prefix:local xmlns:prefix=\"uri\" />", "<prefix:local" },
- { NULL, "local", "uri", "<local xmlns=\"uri\" />", "<local" },
- { "", "local", "uri", "<local xmlns=\"uri\" />", "<local" },
- { "", "local", "uri", "<local xmlns=\"uri\" />", "<local" },
+ { L"prefix", L"local", L"uri", "<prefix:local xmlns:prefix=\"uri\" />", "<prefix:local" },
+ { NULL, L"local", L"uri", "<local xmlns=\"uri\" />", "<local" },
+ { L"", L"local", L"uri", "<local xmlns=\"uri\" />", "<local" },
+ { L"", L"local", L"uri", "<local xmlns=\"uri\" />", "<local" },
- { "prefix", NULL, NULL, NULL, NULL, E_INVALIDARG },
- { NULL, NULL, "uri", NULL, NULL, E_INVALIDARG },
+ { L"prefix", NULL, NULL, NULL, NULL, E_INVALIDARG },
+ { NULL, NULL, L"uri", NULL, NULL, E_INVALIDARG },
{ NULL, NULL, NULL, NULL, NULL, E_INVALIDARG },
- { NULL, "prefix:local", "uri", NULL, NULL, WC_E_NAMECHARACTER },
- { "pre:fix", "local", "uri", NULL, NULL, WC_E_NAMECHARACTER },
- { NULL, ":local", "uri", NULL, NULL, WC_E_NAMECHARACTER },
- { ":", "local", "uri", NULL, NULL, WC_E_NAMECHARACTER },
- { NULL, "local", "http://www.w3.org/2000/xmlns/", NULL, NULL, WR_E_XMLNSPREFIXDECLARATION },
- { "prefix", "local", "http://www.w3.org/2000/xmlns/", NULL, NULL, WR_E_XMLNSURIDECLARATION },
+ { NULL, L"prefix:local", L"uri", NULL, NULL, WC_E_NAMECHARACTER },
+ { L"pre:fix", L"local", L"uri", NULL, NULL, WC_E_NAMECHARACTER },
+ { NULL, L":local", L"uri", NULL, NULL, WC_E_NAMECHARACTER },
+ { L":", L"local", L"uri", NULL, NULL, WC_E_NAMECHARACTER },
+ { NULL, L"local", L"http://www.w3.org/2000/xmlns/", NULL, NULL, WR_E_XMLNSPREFIXDECLARATION },
+ { L"prefix", L"local", L"http://www.w3.org/2000/xmlns/", NULL, NULL, WR_E_XMLNSURIDECLARATION },
};
- static const WCHAR aW[] = {'a',0};
IXmlWriter *writer;
IStream *stream;
unsigned int i;
@@ -923,12 +841,12 @@ static void test_WriteStartElement(void)
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_start_element(writer, NULL, "a", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer);
- hr = write_start_element(writer, NULL, "a", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
@@ -945,7 +863,7 @@ static void test_WriteStartElement(void)
hr = IXmlWriter_WriteStartElement(writer, NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteProcessingInstruction(writer, aW, aW);
+ hr = IXmlWriter_WriteProcessingInstruction(writer, L"a", L"a");
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
IStream_Release(stream);
@@ -955,27 +873,27 @@ static void test_WriteStartElement(void)
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_element_string(writer, NULL, "b", NULL, "value");
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"b", NULL, L"value");
ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer);
- hr = write_start_element(writer, "prefix", "a", "uri");
+ hr = IXmlWriter_WriteStartElement(writer, L"prefix", L"a", L"uri");
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
- hr = write_element_string(writer, NULL, "b", NULL, "value");
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"b", NULL, L"value");
ok(hr == S_OK, "Failed to write element string, hr %#lx.\n", hr);
- hr = write_element_string(writer, NULL, "c", NULL, NULL);
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"c", NULL, NULL);
ok(hr == S_OK, "Failed to write element string, hr %#lx.\n", hr);
- hr = write_start_element(writer, NULL, "d", "uri");
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"d", L"uri");
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
- hr = write_start_element(writer, "", "e", "uri");
+ hr = IXmlWriter_WriteStartElement(writer, L"", L"e", L"uri");
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
- hr = write_start_element(writer, "prefix2", "f", "uri");
+ hr = IXmlWriter_WriteStartElement(writer, L"prefix2", L"f", L"uri");
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -1001,7 +919,7 @@ static void test_WriteStartElement(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Failed to start document, hr %#lx.\n", hr);
- hr = write_start_element(writer, start_element_tests[i].prefix, start_element_tests[i].local,
+ hr = IXmlWriter_WriteStartElement(writer, start_element_tests[i].prefix, start_element_tests[i].local,
start_element_tests[i].uri);
ok(hr == start_element_tests[i].hr, "%u: unexpected hr %#lx.\n", i, hr);
@@ -1031,39 +949,39 @@ static void test_WriteElementString(void)
{
static const struct
{
- const char *prefix;
- const char *local;
- const char *uri;
- const char *value;
+ const WCHAR *prefix;
+ const WCHAR *local;
+ const WCHAR *uri;
+ const WCHAR *value;
const char *output;
HRESULT hr;
int todo;
}
element_string_tests[] =
{
- { "prefix", "local", "uri", "value", "<prefix:local xmlns:prefix=\"uri\">value</prefix:local>" },
- { NULL, "local", "uri", "value", "<local xmlns=\"uri\">value</local>" },
- { "", "local", "uri", "value", "<local xmlns=\"uri\">value</local>" },
- { "prefix", "local", "uri", NULL, "<prefix:local xmlns:prefix=\"uri\" />" },
- { NULL, "local", "uri", NULL, "<local xmlns=\"uri\" />" },
- { "", "local", "uri", NULL, "<local xmlns=\"uri\" />" },
- { NULL, "local", NULL, NULL, "<local />" },
- { "prefix", "local", "uri", "", "<prefix:local xmlns:prefix=\"uri\"></prefix:local>" },
- { NULL, "local", "uri", "", "<local xmlns=\"uri\"></local>" },
- { "", "local", "uri", "", "<local xmlns=\"uri\"></local>" },
- { NULL, "local", NULL, "", "<local></local>" },
- { "", "local", "http://www.w3.org/2000/xmlns/", NULL, "<local xmlns=\"http://www.w3.org/2000/xmlns/\" />" },
-
- { "prefix", NULL, NULL, "value", NULL, E_INVALIDARG },
- { NULL, NULL, "uri", "value", NULL, E_INVALIDARG },
- { NULL, NULL, NULL, "value", NULL, E_INVALIDARG },
- { NULL, "prefix:local", "uri", "value", NULL, WC_E_NAMECHARACTER },
- { NULL, ":local", "uri", "value", NULL, WC_E_NAMECHARACTER },
- { ":", "local", "uri", "value", NULL, WC_E_NAMECHARACTER },
- { "prefix", "local", NULL, "value", NULL, WR_E_NSPREFIXWITHEMPTYNSURI },
- { "prefix", "local", "", "value", NULL, WR_E_NSPREFIXWITHEMPTYNSURI },
- { NULL, "local", "http://www.w3.org/2000/xmlns/", "value", NULL, WR_E_XMLNSPREFIXDECLARATION },
- { "prefix", "local", "http://www.w3.org/2000/xmlns/", "value", NULL, WR_E_XMLNSURIDECLARATION },
+ { L"prefix", L"local", L"uri", L"value", "<prefix:local xmlns:prefix=\"uri\">value</prefix:local>" },
+ { NULL, L"local", L"uri", L"value", "<local xmlns=\"uri\">value</local>" },
+ { L"", L"local", L"uri", L"value", "<local xmlns=\"uri\">value</local>" },
+ { L"prefix", L"local", L"uri", NULL, "<prefix:local xmlns:prefix=\"uri\" />" },
+ { NULL, L"local", L"uri", NULL, "<local xmlns=\"uri\" />" },
+ { L"", L"local", L"uri", NULL, "<local xmlns=\"uri\" />" },
+ { NULL, L"local", NULL, NULL, "<local />" },
+ { L"prefix", L"local", L"uri", L"", "<prefix:local xmlns:prefix=\"uri\"></prefix:local>" },
+ { NULL, L"local", L"uri", L"", "<local xmlns=\"uri\"></local>" },
+ { L"", L"local", L"uri", L"", "<local xmlns=\"uri\"></local>" },
+ { NULL, L"local", NULL, L"", "<local></local>" },
+ { L"", L"local", L"http://www.w3.org/2000/xmlns/", NULL, "<local xmlns=\"http://www.w3.org/2000/xmlns/\" />" },
+
+ { L"prefix", NULL, NULL, L"value", NULL, E_INVALIDARG },
+ { NULL, NULL, L"uri", L"value", NULL, E_INVALIDARG },
+ { NULL, NULL, NULL, L"value", NULL, E_INVALIDARG },
+ { NULL, L"prefix:local", L"uri", L"value", NULL, WC_E_NAMECHARACTER },
+ { NULL, L":local", L"uri", L"value", NULL, WC_E_NAMECHARACTER },
+ { L":", L"local", L"uri", L"value", NULL, WC_E_NAMECHARACTER },
+ { L"prefix", L"local", NULL, L"value", NULL, WR_E_NSPREFIXWITHEMPTYNSURI },
+ { L"prefix", L"local", L"", L"value", NULL, WR_E_NSPREFIXWITHEMPTYNSURI },
+ { NULL, L"local", L"http://www.w3.org/2000/xmlns/", L"value", NULL, WR_E_XMLNSPREFIXDECLARATION },
+ { L"prefix", L"local", L"http://www.w3.org/2000/xmlns/", L"value", NULL, WR_E_XMLNSURIDECLARATION },
};
IXmlWriter *writer;
IStream *stream;
@@ -1073,48 +991,48 @@ static void test_WriteElementString(void)
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_element_string(writer, NULL, "b", NULL, "value");
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"b", NULL, L"value");
ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer);
- hr = write_start_element(writer, NULL, "a", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_element_string(writer, NULL, "b", NULL, "value");
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"b", NULL, L"value");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_element_string(writer, NULL, "b", NULL, NULL);
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"b", NULL, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_element_string(writer, "prefix", "b", "uri", NULL);
+ hr = IXmlWriter_WriteElementString(writer, L"prefix", L"b", L"uri", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_start_element(writer, "prefix", "c", "uri");
+ hr = IXmlWriter_WriteStartElement(writer, L"prefix", L"c", L"uri");
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
- hr = write_element_string(writer, "prefix", "d", NULL, NULL);
+ hr = IXmlWriter_WriteElementString(writer, L"prefix", L"d", NULL, NULL);
ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
- hr = write_element_string(writer, "prefix2", "d", "uri", NULL);
+ hr = IXmlWriter_WriteElementString(writer, L"prefix2", L"d", L"uri", NULL);
ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
- hr = write_element_string(writer, NULL, "e", "uri", NULL);
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"e", L"uri", NULL);
ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
- hr = write_element_string(writer, "prefix", "f", "uri2", NULL);
+ hr = IXmlWriter_WriteElementString(writer, L"prefix", L"f", L"uri2", NULL);
ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
- hr = write_element_string(writer, NULL, "g", "uri3", NULL);
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"g", L"uri3", NULL);
ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
- hr = write_element_string(writer, "prefix", "h", NULL, NULL);
+ hr = IXmlWriter_WriteElementString(writer, L"prefix", L"h", NULL, NULL);
ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
- hr = write_element_string(writer, "prefix_i", "i", NULL, NULL);
+ hr = IXmlWriter_WriteElementString(writer, L"prefix_i", L"i", NULL, NULL);
ok(hr == WR_E_NSPREFIXWITHEMPTYNSURI, "Failed to write element, hr %#lx.\n", hr);
- hr = write_element_string(writer, "", "j", "uri", NULL);
+ hr = IXmlWriter_WriteElementString(writer, L"", L"j", L"uri", NULL);
ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -1143,7 +1061,7 @@ static void test_WriteElementString(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Failed to start document, hr %#lx.\n", hr);
- hr = write_element_string(writer, element_string_tests[i].prefix, element_string_tests[i].local,
+ hr = IXmlWriter_WriteElementString(writer, element_string_tests[i].prefix, element_string_tests[i].local,
element_string_tests[i].uri, element_string_tests[i].value);
ok(hr == element_string_tests[i].hr, "%u: unexpected hr %#lx.\n", i, hr);
@@ -1180,10 +1098,10 @@ static void test_WriteEndElement(void)
stream = writer_set_output(writer);
- hr = write_start_element(writer, NULL, "a", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_start_element(writer, NULL, "b", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndElement(writer);
@@ -1203,8 +1121,6 @@ static void test_WriteEndElement(void)
static void test_writeenddocument(void)
{
- static const WCHAR aW[] = {'a',0};
- static const WCHAR bW[] = {'b',0};
IXmlWriter *writer;
IStream *stream;
HGLOBAL hglobal;
@@ -1229,16 +1145,16 @@ static void test_writeenddocument(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_SetOutput(writer, (IUnknown*)stream);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer);
@@ -1262,9 +1178,6 @@ static void test_writeenddocument(void)
static void test_WriteComment(void)
{
- static const WCHAR closeW[] = {'-','-','>',0};
- static const WCHAR aW[] = {'a',0};
- static const WCHAR bW[] = {'b',0};
IXmlWriter *writer;
IStream *stream;
HRESULT hr;
@@ -1274,7 +1187,7 @@ static void test_WriteComment(void)
writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration);
- hr = IXmlWriter_WriteComment(writer, aW);
+ hr = IXmlWriter_WriteComment(writer, L"a");
ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer);
@@ -1282,19 +1195,19 @@ static void test_WriteComment(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteComment(writer, aW);
+ hr = IXmlWriter_WriteComment(writer, L"a");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteComment(writer, aW);
+ hr = IXmlWriter_WriteComment(writer, L"a");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteComment(writer, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteComment(writer, closeW);
+ hr = IXmlWriter_WriteComment(writer, L"-->");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -1308,10 +1221,6 @@ static void test_WriteComment(void)
static void test_WriteCData(void)
{
- static const WCHAR closeW[] = {']',']','>',0};
- static const WCHAR close2W[] = {'a',']',']','>','b',0};
- static const WCHAR aW[] = {'a',0};
- static const WCHAR bW[] = {'b',0};
IXmlWriter *writer;
IStream *stream;
HRESULT hr;
@@ -1321,24 +1230,24 @@ static void test_WriteCData(void)
writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration);
- hr = IXmlWriter_WriteCData(writer, aW);
+ hr = IXmlWriter_WriteCData(writer, L"a");
ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer);
- hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteCData(writer, aW);
+ hr = IXmlWriter_WriteCData(writer, L"a");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteCData(writer, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteCData(writer, closeW);
+ hr = IXmlWriter_WriteCData(writer, L"]]>");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteCData(writer, close2W);
+ hr = IXmlWriter_WriteCData(writer, L"a]]>b");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -1359,8 +1268,7 @@ static void test_WriteCData(void)
static void test_WriteRaw(void)
{
- static const WCHAR rawW[] = {'a','<',':',0};
- static const WCHAR aW[] = {'a',0};
+ static const WCHAR rawW[] = L"a<:";
IXmlWriter *writer;
IStream *stream;
HRESULT hr;
@@ -1391,7 +1299,7 @@ static void test_WriteRaw(void)
hr = IXmlWriter_WriteRaw(writer, rawW);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteElementString(writer, NULL, aW, NULL, aW);
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"a", NULL, L"a");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
@@ -1417,7 +1325,6 @@ static void test_WriteRaw(void)
static void test_writer_state(void)
{
- static const WCHAR aW[] = {'a',0};
IXmlWriter *writer;
IStream *stream;
HRESULT hr;
@@ -1440,7 +1347,7 @@ static void test_writer_state(void)
/* WriteAttributeString */
stream = writer_set_output(writer);
- hr = IXmlWriter_WriteAttributeString(writer, NULL, aW, NULL, aW);
+ hr = IXmlWriter_WriteAttributeString(writer, NULL, L"a", NULL, L"a");
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
check_writer_state(writer, WR_E_INVALIDACTION);
@@ -1467,7 +1374,7 @@ static void test_writer_state(void)
/* WriteCData */
stream = writer_set_output(writer);
- hr = IXmlWriter_WriteCData(writer, aW);
+ hr = IXmlWriter_WriteCData(writer, L"a");
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
check_writer_state(writer, WR_E_INVALIDACTION);
@@ -1476,7 +1383,7 @@ static void test_writer_state(void)
/* WriteName */
stream = writer_set_output(writer);
- hr = IXmlWriter_WriteName(writer, aW);
+ hr = IXmlWriter_WriteName(writer, L"a");
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
check_writer_state(writer, WR_E_INVALIDACTION);
@@ -1485,7 +1392,7 @@ static void test_writer_state(void)
/* WriteNmToken */
stream = writer_set_output(writer);
- hr = IXmlWriter_WriteNmToken(writer, aW);
+ hr = IXmlWriter_WriteNmToken(writer, L"a");
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
check_writer_state(writer, WR_E_INVALIDACTION);
@@ -1494,7 +1401,7 @@ static void test_writer_state(void)
/* WriteString */
stream = writer_set_output(writer);
- hr = IXmlWriter_WriteString(writer, aW);
+ hr = IXmlWriter_WriteString(writer, L"a");
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
check_writer_state(writer, WR_E_INVALIDACTION);
@@ -1505,9 +1412,6 @@ static void test_writer_state(void)
static void test_indentation(void)
{
- static const WCHAR commentW[] = {'c','o','m','m','e','n','t',0};
- static const WCHAR aW[] = {'a',0};
- static const WCHAR bW[] = {'b',0};
IXmlWriter *writer;
IStream *stream;
HRESULT hr;
@@ -1523,13 +1427,13 @@ static void test_indentation(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteComment(writer, commentW);
+ hr = IXmlWriter_WriteComment(writer, L"comment");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer);
@@ -1549,13 +1453,13 @@ static void test_indentation(void)
/* WriteElementString */
stream = writer_set_output(writer);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteElementString(writer, NULL, bW, NULL, NULL);
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"b", NULL, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteElementString(writer, NULL, bW, NULL, NULL);
+ hr = IXmlWriter_WriteElementString(writer, NULL, L"b", NULL, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndElement(writer);
@@ -1575,35 +1479,14 @@ static void test_indentation(void)
IXmlWriter_Release(writer);
}
-static HRESULT write_attribute_string(IXmlWriter *writer, const char *prefix, const char *local,
- const char *uri, const char *value)
-{
- WCHAR *prefixW, *localW, *uriW, *valueW;
- HRESULT hr;
-
- prefixW = strdupAtoW(prefix);
- localW = strdupAtoW(local);
- uriW = strdupAtoW(uri);
- valueW = strdupAtoW(value);
-
- hr = IXmlWriter_WriteAttributeString(writer, prefixW, localW, uriW, valueW);
-
- free(prefixW);
- free(localW);
- free(uriW);
- free(valueW);
-
- return hr;
-}
-
static void test_WriteAttributeString(void)
{
static const struct
{
- const char *prefix;
- const char *local;
- const char *uri;
- const char *value;
+ const WCHAR *prefix;
+ const WCHAR *local;
+ const WCHAR *uri;
+ const WCHAR *value;
const char *output;
const char *output_partial;
HRESULT hr;
@@ -1613,62 +1496,62 @@ static void test_WriteAttributeString(void)
}
attribute_tests[] =
{
- { NULL, "a", NULL, "b", "<e a=\"b\" />", "<e a=\"b\"" },
- { "", "a", NULL, "b", "<e a=\"b\" />", "<e a=\"b\"" },
- { NULL, "a", "", "b", "<e a=\"b\" />", "<e a=\"b\"" },
- { "", "a", "", "b", "<e a=\"b\" />", "<e a=\"b\"" },
- { "prefix", "local", "uri", "b", "<e prefix:local=\"b\" xmlns:prefix=\"uri\" />", "<e prefix:local=\"b\"" },
- { NULL, "a", "http://www.w3.org/2000/xmlns/", "defuri", "<e xmlns:a=\"defuri\" />", "<e xmlns:a=\"defuri\"" },
- { "xmlns", "a", NULL, "uri", "<e xmlns:a=\"uri\" />", "<e xmlns:a=\"uri\"" },
- { "xmlns", "a", "", "uri", "<e xmlns:a=\"uri\" />", "<e xmlns:a=\"uri\"" },
- { "prefix", "xmlns", "uri", "value", "<e prefix:xmlns=\"value\" xmlns:prefix=\"uri\" />", "<e prefix:xmlns=\"value\"" },
- { "prefix", "xmlns", "uri", NULL, "<e prefix:xmlns=\"\" xmlns:prefix=\"uri\" />", "<e prefix:xmlns=\"\"" },
- { "prefix", "xmlns", "uri", "", "<e prefix:xmlns=\"\" xmlns:prefix=\"uri\" />", "<e prefix:xmlns=\"\"" },
- { "prefix", "xmlns", NULL, "uri", "<e xmlns=\"uri\" />", "<e xmlns=\"uri\"" },
- { "prefix", "xmlns", "", "uri", "<e xmlns=\"uri\" />", "<e xmlns=\"uri\"" },
- { "xml", "space", NULL, "preserve", "<e xml:space=\"preserve\" />", "<e xml:space=\"preserve\"" },
- { "xml", "space", "", "preserve", "<e xml:space=\"preserve\" />", "<e xml:space=\"preserve\"" },
- { "xml", "space", NULL, "default", "<e xml:space=\"default\" />", "<e xml:space=\"default\"" },
- { "xml", "space", "", "default", "<e xml:space=\"default\" />", "<e xml:space=\"default\"" },
- { "xml", "a", NULL, "value", "<e xml:a=\"value\" />", "<e xml:a=\"value\"" },
- { "xml", "a", "", "value", "<e xml:a=\"value\" />", "<e xml:a=\"value\"" },
+ { NULL, L"a", NULL, L"b", "<e a=\"b\" />", "<e a=\"b\"" },
+ { L"", L"a", NULL, L"b", "<e a=\"b\" />", "<e a=\"b\"" },
+ { NULL, L"a", L"", L"b", "<e a=\"b\" />", "<e a=\"b\"" },
+ { L"", L"a", L"", L"b", "<e a=\"b\" />", "<e a=\"b\"" },
+ { L"prefix", L"local", L"uri", L"b", "<e prefix:local=\"b\" xmlns:prefix=\"uri\" />", "<e prefix:local=\"b\"" },
+ { NULL, L"a", L"http://www.w3.org/2000/xmlns/", L"defuri", "<e xmlns:a=\"defuri\" />", "<e xmlns:a=\"defuri\"" },
+ { L"xmlns", L"a", NULL, L"uri", "<e xmlns:a=\"uri\" />", "<e xmlns:a=\"uri\"" },
+ { L"xmlns", L"a", L"", L"uri", "<e xmlns:a=\"uri\" />", "<e xmlns:a=\"uri\"" },
+ { L"prefix", L"xmlns", L"uri", L"value", "<e prefix:xmlns=\"value\" xmlns:prefix=\"uri\" />", "<e prefix:xmlns=\"value\"" },
+ { L"prefix", L"xmlns", L"uri", NULL, "<e prefix:xmlns=\"\" xmlns:prefix=\"uri\" />", "<e prefix:xmlns=\"\"" },
+ { L"prefix", L"xmlns", L"uri", L"", "<e prefix:xmlns=\"\" xmlns:prefix=\"uri\" />", "<e prefix:xmlns=\"\"" },
+ { L"prefix", L"xmlns", NULL, L"uri", "<e xmlns=\"uri\" />", "<e xmlns=\"uri\"" },
+ { L"prefix", L"xmlns", L"", L"uri", "<e xmlns=\"uri\" />", "<e xmlns=\"uri\"" },
+ { L"xml", L"space", NULL, L"preserve", "<e xml:space=\"preserve\" />", "<e xml:space=\"preserve\"" },
+ { L"xml", L"space", L"", L"preserve", "<e xml:space=\"preserve\" />", "<e xml:space=\"preserve\"" },
+ { L"xml", L"space", NULL, L"default", "<e xml:space=\"default\" />", "<e xml:space=\"default\"" },
+ { L"xml", L"space", L"", L"default", "<e xml:space=\"default\" />", "<e xml:space=\"default\"" },
+ { L"xml", L"a", NULL, L"value", "<e xml:a=\"value\" />", "<e xml:a=\"value\"" },
+ { L"xml", L"a", L"", L"value", "<e xml:a=\"value\" />", "<e xml:a=\"value\"" },
/* Autogenerated prefix names. */
- { NULL, "a", "defuri", NULL, "<e p1:a=\"\" xmlns:p1=\"defuri\" />", "<e p1:a=\"\"", S_OK, 1, 1, 1 },
- { NULL, "a", "defuri", "b", "<e p1:a=\"b\" xmlns:p1=\"defuri\" />", "<e p1:a=\"b\"", S_OK, 1, 1, 1 },
- { "", "a", "defuri", NULL, "<e p1:a=\"\" xmlns:p1=\"defuri\" />", "<e p1:a=\"\"", S_OK, 1, 1, 1 },
- { NULL, "a", "defuri", "", "<e p1:a=\"\" xmlns:p1=\"defuri\" />", "<e p1:a=\"\"", S_OK, 1, 1, 1 },
- { "", "a", "defuri", "b", "<e p1:a=\"b\" xmlns:p1=\"defuri\" />", "<e p1:a=\"b\"", S_OK, 1, 1, 1 },
+ { NULL, L"a", L"defuri", NULL, "<e p1:a=\"\" xmlns:p1=\"defuri\" />", "<e p1:a=\"\"", S_OK, 1, 1, 1 },
+ { NULL, L"a", L"defuri", L"b", "<e p1:a=\"b\" xmlns:p1=\"defuri\" />", "<e p1:a=\"b\"", S_OK, 1, 1, 1 },
+ { L"", L"a", L"defuri", NULL, "<e p1:a=\"\" xmlns:p1=\"defuri\" />", "<e p1:a=\"\"", S_OK, 1, 1, 1 },
+ { NULL, L"a", L"defuri", L"", "<e p1:a=\"\" xmlns:p1=\"defuri\" />", "<e p1:a=\"\"", S_OK, 1, 1, 1 },
+ { L"", L"a", L"defuri", L"b", "<e p1:a=\"b\" xmlns:p1=\"defuri\" />", "<e p1:a=\"b\"", S_OK, 1, 1, 1 },
/* Failing cases. */
- { NULL, NULL, "http://www.w3.org/2000/xmlns/", "defuri", "<e />", "<e", E_INVALIDARG },
- { "", "a", "http://www.w3.org/2000/xmlns/", "defuri", "<e />", "<e", WR_E_XMLNSPREFIXDECLARATION, 1, 1, 1 },
- { "", NULL, "http://www.w3.org/2000/xmlns/", "defuri", "<e />", "<e", E_INVALIDARG },
- { "", "", "http://www.w3.org/2000/xmlns/", "defuri", "<e />", "<e", E_INVALIDARG, 1, 1, 1 },
- { NULL, "", "http://www.w3.org/2000/xmlns/", "defuri", "<e />", "<e", E_INVALIDARG, 1, 1, 1 },
- { "prefix", "a", "http://www.w3.org/2000/xmlns/", "defuri", "<e />", "<e", WR_E_XMLNSURIDECLARATION, 1, 1, 1 },
- { "prefix", NULL, "http://www.w3.org/2000/xmlns/", "defuri", "<e />", "<e", E_INVALIDARG },
- { "prefix", NULL, NULL, "b", "<e />", "<e", E_INVALIDARG },
- { "prefix", NULL, "uri", NULL, "<e />", "<e", E_INVALIDARG },
- { "xml", NULL, NULL, "value", "<e />", "<e", E_INVALIDARG },
- { "xmlns", "a", "defuri", NULL, "<e />", "<e", WR_E_XMLNSPREFIXDECLARATION },
- { "xmlns", "a", "b", "uri", "<e />", "<e", WR_E_XMLNSPREFIXDECLARATION },
- { NULL, "xmlns", "uri", NULL, "<e />", "<e", WR_E_XMLNSPREFIXDECLARATION, 0, 0, 1 },
- { "xmlns", NULL, "uri", NULL, "<e />", "<e", WR_E_XMLNSPREFIXDECLARATION, 0, 0, 1 },
- { "pre:fix", "local", "uri", "b", "<e />", "<e", WC_E_NAMECHARACTER },
- { "pre:fix", NULL, "uri", "b", "<e />", "<e", E_INVALIDARG },
- { "prefix", "lo:cal", "uri", "b", "<e />", "<e", WC_E_NAMECHARACTER },
- { "xmlns", NULL, NULL, "uri", "<e />", "<e", WR_E_NSPREFIXDECLARED },
- { "xmlns", NULL, "", "uri", "<e />", "<e", WR_E_NSPREFIXDECLARED },
- { "xmlns", "", NULL, "uri", "<e />", "<e", WR_E_NSPREFIXDECLARED },
- { "xmlns", "", "", "uri", "<e />", "<e", WR_E_NSPREFIXDECLARED },
- { "xml", "space", "", "value", "<e />", "<e", WR_E_INVALIDXMLSPACE },
- { "xml", "space", NULL, "value", "<e />", "<e", WR_E_INVALIDXMLSPACE },
- { "xml", "a", "uri", "value", "<e />", "<e", WR_E_XMLPREFIXDECLARATION },
- { "xml", "space", NULL, "preServe", "<e />", "<e", WR_E_INVALIDXMLSPACE },
- { "xml", "space", NULL, "defAult", "<e />", "<e", WR_E_INVALIDXMLSPACE },
- { "xml", "space", NULL, NULL, "<e />", "<e", WR_E_INVALIDXMLSPACE },
- { "xml", "space", NULL, "", "<e />", "<e", WR_E_INVALIDXMLSPACE },
+ { NULL, NULL, L"http://www.w3.org/2000/xmlns/", L"defuri", "<e />", "<e", E_INVALIDARG },
+ { L"", L"a", L"http://www.w3.org/2000/xmlns/", L"defuri", "<e />", "<e", WR_E_XMLNSPREFIXDECLARATION, 1, 1, 1 },
+ { L"", NULL, L"http://www.w3.org/2000/xmlns/", L"defuri", "<e />", "<e", E_INVALIDARG },
+ { L"", L"", L"http://www.w3.org/2000/xmlns/", L"defuri", "<e />", "<e", E_INVALIDARG, 1, 1, 1 },
+ { NULL, L"", L"http://www.w3.org/2000/xmlns/", L"defuri", "<e />", "<e", E_INVALIDARG, 1, 1, 1 },
+ { L"prefix", L"a", L"http://www.w3.org/2000/xmlns/", L"defuri", "<e />", "<e", WR_E_XMLNSURIDECLARATION, 1, 1, 1 },
+ { L"prefix", NULL, L"http://www.w3.org/2000/xmlns/", L"defuri", "<e />", "<e", E_INVALIDARG },
+ { L"prefix", NULL, NULL, L"b", "<e />", "<e", E_INVALIDARG },
+ { L"prefix", NULL, L"uri", NULL, "<e />", "<e", E_INVALIDARG },
+ { L"xml", NULL, NULL, L"value", "<e />", "<e", E_INVALIDARG },
+ { L"xmlns", L"a", L"defuri", NULL, "<e />", "<e", WR_E_XMLNSPREFIXDECLARATION },
+ { L"xmlns", L"a", L"b", L"uri", "<e />", "<e", WR_E_XMLNSPREFIXDECLARATION },
+ { NULL, L"xmlns", L"uri", NULL, "<e />", "<e", WR_E_XMLNSPREFIXDECLARATION, 0, 0, 1 },
+ { L"xmlns", NULL, L"uri", NULL, "<e />", "<e", WR_E_XMLNSPREFIXDECLARATION, 0, 0, 1 },
+ { L"pre:fix", L"local", L"uri", L"b", "<e />", "<e", WC_E_NAMECHARACTER },
+ { L"pre:fix", NULL, L"uri", L"b", "<e />", "<e", E_INVALIDARG },
+ { L"prefix", L"lo:cal", L"uri", L"b", "<e />", "<e", WC_E_NAMECHARACTER },
+ { L"xmlns", NULL, NULL, L"uri", "<e />", "<e", WR_E_NSPREFIXDECLARED },
+ { L"xmlns", NULL, L"", L"uri", "<e />", "<e", WR_E_NSPREFIXDECLARED },
+ { L"xmlns", L"", NULL, L"uri", "<e />", "<e", WR_E_NSPREFIXDECLARED },
+ { L"xmlns", L"", L"", L"uri", "<e />", "<e", WR_E_NSPREFIXDECLARED },
+ { L"xml", L"space", L"", L"value", "<e />", "<e", WR_E_INVALIDXMLSPACE },
+ { L"xml", L"space", NULL, L"value", "<e />", "<e", WR_E_INVALIDXMLSPACE },
+ { L"xml", L"a", L"uri", L"value", "<e />", "<e", WR_E_XMLPREFIXDECLARATION },
+ { L"xml", L"space", NULL, L"preServe", "<e />", "<e", WR_E_INVALIDXMLSPACE },
+ { L"xml", L"space", NULL, L"defAult", "<e />", "<e", WR_E_INVALIDXMLSPACE },
+ { L"xml", L"space", NULL, NULL, "<e />", "<e", WR_E_INVALIDXMLSPACE },
+ { L"xml", L"space", NULL, L"", "<e />", "<e", WR_E_INVALIDXMLSPACE },
};
IXmlWriter *writer;
@@ -1688,10 +1571,10 @@ static void test_WriteAttributeString(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Failed to start document, hr %#lx.\n", hr);
- hr = write_start_element(writer, NULL, "e", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"e", NULL);
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
- hr = write_attribute_string(writer, attribute_tests[i].prefix, attribute_tests[i].local,
+ hr = IXmlWriter_WriteAttributeString(writer, attribute_tests[i].prefix, attribute_tests[i].local,
attribute_tests[i].uri, attribute_tests[i].value);
todo_wine_if(attribute_tests[i].todo_hr)
ok(hr == attribute_tests[i].hr, "%u: unexpected hr %#lx, expected %#lx.\n", i, hr, attribute_tests[i].hr);
@@ -1717,32 +1600,32 @@ static void test_WriteAttributeString(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_start_element(writer, "p", "a", "outeruri");
+ hr = IXmlWriter_WriteStartElement(writer, L"p", L"a", L"outeruri");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_attribute_string(writer, "prefix", "local", "uri", "b");
+ hr = IXmlWriter_WriteAttributeString(writer, L"prefix", L"local", L"uri", L"b");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_attribute_string(writer, NULL, "a", NULL, "b");
+ hr = IXmlWriter_WriteAttributeString(writer, NULL, L"a", NULL, L"b");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_attribute_string(writer, "xmlns", "prefix", NULL, "uri");
+ hr = IXmlWriter_WriteAttributeString(writer, L"xmlns", L"prefix", NULL, L"uri");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_attribute_string(writer, "p", "attr", NULL, "value");
+ hr = IXmlWriter_WriteAttributeString(writer, L"p", L"attr", NULL, L"value");
ok(hr == S_OK, "Failed to write attribute string, hr %#lx.\n", hr);
- hr = write_attribute_string(writer, "prefix", "local", NULL, "b");
+ hr = IXmlWriter_WriteAttributeString(writer, L"prefix", L"local", NULL, L"b");
todo_wine
ok(hr == WR_E_DUPLICATEATTRIBUTE, "Unexpected hr %#lx.\n", hr);
- hr = write_start_element(writer, NULL, "b", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_attribute_string(writer, NULL, "attr2", "outeruri", "value");
+ hr = IXmlWriter_WriteAttributeString(writer, NULL, L"attr2", L"outeruri", L"value");
ok(hr == S_OK, "Failed to write attribute string, hr %#lx.\n", hr);
- hr = write_attribute_string(writer, "pr", "attr3", "outeruri", "value");
+ hr = IXmlWriter_WriteAttributeString(writer, L"pr", L"attr3", L"outeruri", L"value");
ok(hr == S_OK, "Failed to write attribute string, hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer);
@@ -1764,13 +1647,13 @@ static void test_WriteAttributeString(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_start_element(writer, NULL, "e", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"e", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_attribute_string(writer, "xmlns", "prefix", NULL, "uri");
+ hr = IXmlWriter_WriteAttributeString(writer, L"xmlns", L"prefix", NULL, L"uri");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_attribute_string(writer, "prefix", "attr", NULL, "value");
+ hr = IXmlWriter_WriteAttributeString(writer, L"prefix", L"attr", NULL, L"value");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer);
@@ -1789,7 +1672,6 @@ static void test_WriteAttributeString(void)
static void test_WriteFullEndElement(void)
{
- static const WCHAR aW[] = {'a',0};
IXmlWriter *writer;
IStream *stream;
HRESULT hr;
@@ -1806,7 +1688,7 @@ static void test_WriteFullEndElement(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteFullEndElement(writer);
@@ -1831,10 +1713,10 @@ static void test_WriteFullEndElement(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteFullEndElement(writer);
@@ -1857,7 +1739,6 @@ static void test_WriteFullEndElement(void)
static void test_WriteCharEntity(void)
{
- static const WCHAR aW[] = {'a',0};
IXmlWriter *writer;
IStream *stream;
HRESULT hr;
@@ -1873,13 +1754,13 @@ static void test_WriteCharEntity(void)
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteCharEntity(writer, 0x100);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer);
@@ -1906,31 +1787,31 @@ static void test_WriteString(void)
writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration);
- hr = write_string(writer, "a");
+ hr = IXmlWriter_WriteString(writer, L"a");
ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
- hr = write_string(writer, NULL);
+ hr = IXmlWriter_WriteString(writer, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_string(writer, "");
+ hr = IXmlWriter_WriteString(writer, L"");
ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer);
- hr = write_start_element(writer, NULL, "b", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_string(writer, NULL);
+ hr = IXmlWriter_WriteString(writer, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_string(writer, "");
+ hr = IXmlWriter_WriteString(writer, L"");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_string(writer, "a");
+ hr = IXmlWriter_WriteString(writer, L"a");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* WriteString automatically escapes markup characters */
- hr = write_string(writer, "<&\">=");
+ hr = IXmlWriter_WriteString(writer, L"<&\">=");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -1942,10 +1823,10 @@ static void test_WriteString(void)
stream = writer_set_output(writer);
- hr = write_start_element(writer, NULL, "b", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- hr = write_string(writer, NULL);
+ hr = IXmlWriter_WriteString(writer, NULL);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -1954,7 +1835,7 @@ static void test_WriteString(void)
CHECK_OUTPUT(stream,
"<b");
- hr = write_string(writer, "");
+ hr = IXmlWriter_WriteString(writer, L"");
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -1974,13 +1855,13 @@ static void test_WriteString(void)
writer_set_property(writer, XmlWriterProperty_Indent);
- hr = write_start_element(writer, NULL, "a", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
- hr = write_start_element(writer, NULL, "b", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL);
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
- hr = write_string(writer, "text");
+ hr = IXmlWriter_WriteString(writer, L"text");
ok(hr == S_OK, "Failed to write a string, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -2015,10 +1896,10 @@ static void test_WriteString(void)
stream = writer_set_output(writer);
- hr = write_start_element(writer, NULL, "a", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL);
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
- hr = write_start_element(writer, NULL, "b", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL);
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndElement(writer);
@@ -2031,10 +1912,10 @@ static void test_WriteString(void)
"<a>\r\n"
" <b />");
- hr = write_start_element(writer, NULL, "c", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"c", NULL);
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
- hr = write_attribute_string(writer, NULL, "attr", NULL, "value");
+ hr = IXmlWriter_WriteAttributeString(writer, NULL, L"attr", NULL, L"value");
ok(hr == S_OK, "Failed to write attribute string, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -2045,7 +1926,7 @@ static void test_WriteString(void)
" <b />\r\n"
" <c attr=\"value\"");
- hr = write_string(writer, "text");
+ hr = IXmlWriter_WriteString(writer, L"text");
ok(hr == S_OK, "Failed to write a string, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer);
@@ -2067,10 +1948,10 @@ static void test_WriteString(void)
" <b />\r\n"
" <c attr=\"value\">text</c>");
- hr = write_start_element(writer, NULL, "d", NULL);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"d", NULL);
ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
- hr = write_string(writer, "");
+ hr = IXmlWriter_WriteString(writer, L"");
ok(hr == S_OK, "Failed to write a string, hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndElement(writer);
@@ -2102,60 +1983,37 @@ static void test_WriteString(void)
IStream_Release(stream);
}
-static HRESULT write_doctype(IXmlWriter *writer, const char *name, const char *pubid, const char *sysid,
- const char *subset)
-{
- WCHAR *nameW, *pubidW, *sysidW, *subsetW;
- HRESULT hr;
-
- nameW = strdupAtoW(name);
- pubidW = strdupAtoW(pubid);
- sysidW = strdupAtoW(sysid);
- subsetW = strdupAtoW(subset);
-
- hr = IXmlWriter_WriteDocType(writer, nameW, pubidW, sysidW, subsetW);
-
- free(nameW);
- free(pubidW);
- free(sysidW);
- free(subsetW);
-
- return hr;
-}
-
static void test_WriteDocType(void)
{
static const struct
{
- const char *name;
- const char *pubid;
- const char *sysid;
- const char *subset;
+ const WCHAR *name;
+ const WCHAR *pubid;
+ const WCHAR *sysid;
+ const WCHAR *subset;
const char *output;
}
doctype_tests[] =
{
- { "a", "", NULL, NULL, "<!DOCTYPE a PUBLIC \"\" \"\">" },
- { "a", NULL, NULL, NULL, "<!DOCTYPE a>" },
- { "a", NULL, "", NULL, "<!DOCTYPE a SYSTEM \"\">" },
- { "a", "", "", NULL, "<!DOCTYPE a PUBLIC \"\" \"\">" },
- { "a", "pubid", "", NULL, "<!DOCTYPE a PUBLIC \"pubid\" \"\">" },
- { "a", "pubid", NULL, NULL, "<!DOCTYPE a PUBLIC \"pubid\" \"\">" },
- { "a", "", "sysid", NULL, "<!DOCTYPE a PUBLIC \"\" \"sysid\">" },
- { "a", NULL, NULL, "", "<!DOCTYPE a []>" },
- { "a", NULL, NULL, "subset", "<!DOCTYPE a [subset]>" },
- { "a", "", NULL, "subset", "<!DOCTYPE a PUBLIC \"\" \"\" [subset]>" },
- { "a", NULL, "", "subset", "<!DOCTYPE a SYSTEM \"\" [subset]>" },
- { "a", "", "", "subset", "<!DOCTYPE a PUBLIC \"\" \"\" [subset]>" },
- { "a", "pubid", NULL, "subset", "<!DOCTYPE a PUBLIC \"pubid\" \"\" [subset]>" },
- { "a", "pubid", "", "subset", "<!DOCTYPE a PUBLIC \"pubid\" \"\" [subset]>" },
- { "a", NULL, "sysid", "subset", "<!DOCTYPE a SYSTEM \"sysid\" [subset]>" },
- { "a", "", "sysid", "subset", "<!DOCTYPE a PUBLIC \"\" \"sysid\" [subset]>" },
- { "a", "pubid", "sysid", "subset", "<!DOCTYPE a PUBLIC \"pubid\" \"sysid\" [subset]>" },
+ { L"a", L"", NULL, NULL, "<!DOCTYPE a PUBLIC \"\" \"\">" },
+ { L"a", NULL, NULL, NULL, "<!DOCTYPE a>" },
+ { L"a", NULL, L"", NULL, "<!DOCTYPE a SYSTEM \"\">" },
+ { L"a", L"", L"", NULL, "<!DOCTYPE a PUBLIC \"\" \"\">" },
+ { L"a", L"pubid", L"", NULL, "<!DOCTYPE a PUBLIC \"pubid\" \"\">" },
+ { L"a", L"pubid", NULL, NULL, "<!DOCTYPE a PUBLIC \"pubid\" \"\">" },
+ { L"a", L"", L"sysid", NULL, "<!DOCTYPE a PUBLIC \"\" \"sysid\">" },
+ { L"a", NULL, NULL, L"", "<!DOCTYPE a []>" },
+ { L"a", NULL, NULL, L"subset", "<!DOCTYPE a [subset]>" },
+ { L"a", L"", NULL, L"subset", "<!DOCTYPE a PUBLIC \"\" \"\" [subset]>" },
+ { L"a", NULL, L"", L"subset", "<!DOCTYPE a SYSTEM \"\" [subset]>" },
+ { L"a", L"", L"", L"subset", "<!DOCTYPE a PUBLIC \"\" \"\" [subset]>" },
+ { L"a", L"pubid", NULL, L"subset", "<!DOCTYPE a PUBLIC \"pubid\" \"\" [subset]>" },
+ { L"a", L"pubid", L"", L"subset", "<!DOCTYPE a PUBLIC \"pubid\" \"\" [subset]>" },
+ { L"a", NULL, L"sysid", L"subset", "<!DOCTYPE a SYSTEM \"sysid\" [subset]>" },
+ { L"a", L"", L"sysid", L"subset", "<!DOCTYPE a PUBLIC \"\" \"sysid\" [subset]>" },
+ { L"a", L"pubid", L"sysid", L"subset", "<!DOCTYPE a PUBLIC \"pubid\" \"sysid\" [subset]>" },
};
static const WCHAR pubidW[] = {'p',0x100,'i','d',0};
- static const WCHAR nameW[] = {'-','a',0};
- static const WCHAR emptyW[] = { 0 };
IXmlWriter *writer;
IStream *stream;
unsigned int i;
@@ -2169,15 +2027,15 @@ static void test_WriteDocType(void)
hr = IXmlWriter_WriteDocType(writer, NULL, NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
- hr = IXmlWriter_WriteDocType(writer, emptyW, NULL, NULL, NULL);
+ hr = IXmlWriter_WriteDocType(writer, L"", NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
/* Name validation. */
- hr = IXmlWriter_WriteDocType(writer, nameW, NULL, NULL, NULL);
+ hr = IXmlWriter_WriteDocType(writer, L"-a", NULL, NULL, NULL);
ok(hr == WC_E_NAMECHARACTER, "Unexpected hr %#lx.\n", hr);
/* Pubid validation. */
- hr = IXmlWriter_WriteDocType(writer, aW, pubidW, NULL, NULL);
+ hr = IXmlWriter_WriteDocType(writer, L"a", pubidW, NULL, NULL);
ok(hr == WC_E_PUBLICID, "Unexpected hr %#lx.\n", hr);
IStream_Release(stream);
@@ -2186,7 +2044,7 @@ static void test_WriteDocType(void)
{
stream = writer_set_output(writer);
- hr = write_doctype(writer, doctype_tests[i].name, doctype_tests[i].pubid, doctype_tests[i].sysid,
+ hr = IXmlWriter_WriteDocType(writer, doctype_tests[i].name, doctype_tests[i].pubid, doctype_tests[i].sysid,
doctype_tests[i].subset);
ok(hr == S_OK, "%u: failed to write doctype, hr %#lx.\n", i, hr);
@@ -2195,7 +2053,7 @@ static void test_WriteDocType(void)
CHECK_OUTPUT(stream, doctype_tests[i].output);
- hr = write_doctype(writer, doctype_tests[i].name, doctype_tests[i].pubid, doctype_tests[i].sysid,
+ hr = IXmlWriter_WriteDocType(writer, doctype_tests[i].name, doctype_tests[i].pubid, doctype_tests[i].sysid,
doctype_tests[i].subset);
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
--
2.35.1
1
0
Microsoft Edge calls this function expecting an
implementation. Without it, Internet browsing
does not work.
Signed-off-by: Mohamad Al-Jaf <mohamadaljaf(a)gmail.com>
---
If you want to test this patch in Microsoft Edge, you have to wait
a few minutes after opening it before it becomes usable.
---
dlls/ncrypt/main.c | 24 ++++++++++++++++++++++--
dlls/ncrypt/ncrypt.spec | 2 +-
include/ncrypt.h | 1 +
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/dlls/ncrypt/main.c b/dlls/ncrypt/main.c
index cc979a539d2..912f7ef643e 100644
--- a/dlls/ncrypt/main.c
+++ b/dlls/ncrypt/main.c
@@ -415,8 +415,28 @@ SECURITY_STATUS WINAPI NCryptImportKey(NCRYPT_PROV_HANDLE provider, NCRYPT_KEY_H
SECURITY_STATUS WINAPI NCryptIsAlgSupported(NCRYPT_PROV_HANDLE provider, const WCHAR *algid, DWORD flags)
{
- FIXME("(%#Ix, %s, %#lx): stub\n", provider, wine_dbgstr_w(algid), flags);
- return NTE_NOT_SUPPORTED;
+ NCRYPT_KEY_HANDLE key;
+ SECURITY_STATUS status;
+
+ TRACE("(%#Ix, %s, %#lx)\n", provider, wine_dbgstr_w(algid), flags);
+
+ if (!provider) return NTE_INVALID_HANDLE;
+ if (!algid) return HRESULT_FROM_WIN32(RPC_X_NULL_REF_POINTER);
+ if (flags == NCRYPT_SILENT_FLAG)
+ {
+ FIXME("Silent flag not implemented\n");
+ }
+ else if (flags)
+ {
+ ERR("Invalid flags %#lx\n", flags);
+ return NTE_BAD_FLAGS;
+ }
+
+ status = NCryptCreatePersistedKey(provider, &key, algid, NULL, 0, 0);
+ NCryptFinalizeKey(key, 0);
+ NCryptFreeObject(key);
+ NCryptFreeObject(provider);
+ return status;
}
BOOL WINAPI NCryptIsKeyHandle(NCRYPT_KEY_HANDLE hKey)
diff --git a/dlls/ncrypt/ncrypt.spec b/dlls/ncrypt/ncrypt.spec
index bb914616373..60b367260d5 100644
--- a/dlls/ncrypt/ncrypt.spec
+++ b/dlls/ncrypt/ncrypt.spec
@@ -77,7 +77,7 @@
@ stdcall NCryptGetProperty(ptr wstr ptr long ptr long)
@ stub NCryptGetProtectionDescriptorInfo
@ stdcall NCryptImportKey(long long wstr ptr ptr ptr long long)
-@ stub NCryptIsAlgSupported(long wstr long)
+@ stdcall NCryptIsAlgSupported(long wstr long)
@ stdcall NCryptIsKeyHandle(long)
@ stub NCryptKeyDerivation
@ stub NCryptNotifyChangeKey
diff --git a/include/ncrypt.h b/include/ncrypt.h
index c09a1ec8676..18198fdc5bb 100644
--- a/include/ncrypt.h
+++ b/include/ncrypt.h
@@ -118,6 +118,7 @@ SECURITY_STATUS WINAPI NCryptFreeObject(NCRYPT_HANDLE);
SECURITY_STATUS WINAPI NCryptGetProperty(NCRYPT_HANDLE, const WCHAR *, BYTE *, DWORD, DWORD *, DWORD);
SECURITY_STATUS WINAPI NCryptImportKey(NCRYPT_PROV_HANDLE, NCRYPT_KEY_HANDLE, const WCHAR *, NCryptBufferDesc *,
NCRYPT_KEY_HANDLE *, BYTE *, DWORD, DWORD);
+SECURITY_STATUS WINAPI NCryptIsAlgSupported(NCRYPT_PROV_HANDLE, const WCHAR *, DWORD);
SECURITY_STATUS WINAPI NCryptOpenKey(NCRYPT_PROV_HANDLE, NCRYPT_KEY_HANDLE *, const WCHAR *, DWORD, DWORD);
SECURITY_STATUS WINAPI NCryptOpenStorageProvider(NCRYPT_PROV_HANDLE *, const WCHAR *, DWORD);
SECURITY_STATUS WINAPI NCryptSetProperty(NCRYPT_HANDLE, const WCHAR *, BYTE *, DWORD, DWORD);
--
2.35.1
2
4
Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com>
---
dlls/d2d1/effect.c | 1 +
dlls/d2d1/tests/d2d1.c | 119 ++++++++++++++++++++++++++++++++++----
include/d2d1effects_2.idl | 1 +
3 files changed, 111 insertions(+), 10 deletions(-)
diff --git a/dlls/d2d1/effect.c b/dlls/d2d1/effect.c
index e7215c4b38a..601932b005b 100644
--- a/dlls/d2d1/effect.c
+++ b/dlls/d2d1/effect.c
@@ -27,6 +27,7 @@ static const struct d2d_effect_info builtin_effects[] =
{&CLSID_D2D1Composite, 2, 1, 0xffffffff},
{&CLSID_D2D1Crop, 1, 1, 1},
{&CLSID_D2D1Shadow, 1, 1, 1},
+ {&CLSID_D2D1Grayscale, 1, 1, 1},
};
static inline struct d2d_effect *impl_from_ID2D1Effect(ID2D1Effect *iface)
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 722f46bffe6..826526d9d38 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -20,7 +20,7 @@
#include <limits.h>
#include <math.h>
#include <float.h>
-#include "d2d1_1.h"
+#include "d2d1_3.h"
#include "d3d11.h"
#include "wincrypt.h"
#include "wine/test.h"
@@ -9925,13 +9925,15 @@ static void test_mt_factory(BOOL d3d11)
static void test_effect(BOOL d3d11)
{
- unsigned int i, j, min_inputs, max_inputs, str_size, input_count;
+ unsigned int i, j, min_inputs, max_inputs, str_size, input_count, factory_version;
D2D1_BITMAP_PROPERTIES bitmap_desc;
D2D1_BUFFER_PRECISION precision;
ID2D1Image *image_a, *image_b;
struct d2d1_test_context ctx;
ID2D1DeviceContext *context;
- ID2D1Factory1 *factory;
+ ID2D1Factory1 *factory1;
+ ID2D1Factory2 *factory2;
+ ID2D1Factory3 *factory3;
ID2D1Bitmap *bitmap;
ID2D1Effect *effect;
D2D1_SIZE_U size;
@@ -9943,28 +9945,43 @@ static void test_effect(BOOL d3d11)
const struct effect_test
{
const CLSID *clsid;
+ UINT32 factory_version;
UINT32 default_input_count;
UINT32 min_inputs;
UINT32 max_inputs;
}
effect_tests[] =
{
- {&CLSID_D2D12DAffineTransform, 1, 1, 1},
- {&CLSID_D2D13DPerspectiveTransform, 1, 1, 1},
- {&CLSID_D2D1Composite, 2, 1, 0xffffffff},
- {&CLSID_D2D1Crop, 1, 1, 1},
- {&CLSID_D2D1Shadow, 1, 1, 1},
+ {&CLSID_D2D12DAffineTransform, 1, 1, 1, 1},
+ {&CLSID_D2D13DPerspectiveTransform, 1, 1, 1, 1},
+ {&CLSID_D2D1Composite, 1, 2, 1, 0xffffffff},
+ {&CLSID_D2D1Crop, 1, 1, 1, 1},
+ {&CLSID_D2D1Shadow, 1, 1, 1, 1},
+ {&CLSID_D2D1Grayscale, 3, 1, 1, 1},
};
if (!init_test_context(&ctx, d3d11))
return;
- if (FAILED(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory1, NULL, (void **)&factory)))
+ if (FAILED(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory1, NULL, (void **)&factory1)))
{
win_skip("ID2D1Factory1 is not supported.\n");
release_test_context(&ctx);
return;
}
+ factory_version = 1;
+ if (SUCCEEDED(ID2D1Factory1_QueryInterface(factory1, &IID_ID2D1Factory2, (void **)&factory2)))
+ {
+ ID2D1Factory2_Release(factory2);
+ factory_version = 2;
+ }
+ if (SUCCEEDED(ID2D1Factory1_QueryInterface(factory1, &IID_ID2D1Factory3, (void **)&factory3)))
+ {
+ ID2D1Factory3_Release(factory3);
+ factory_version = 3;
+ }
+ if (factory_version < 3)
+ win_skip("ID2D1Factory%u is not supported.\n", factory_version + 1);
hr = ID2D1RenderTarget_QueryInterface(ctx.rt, &IID_ID2D1DeviceContext, (void **)&context);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
@@ -9973,6 +9990,9 @@ static void test_effect(BOOL d3d11)
{
const struct effect_test *test = effect_tests + i;
+ if (factory_version < test->factory_version)
+ continue;
+
winetest_push_context("Test %u", i);
hr = ID2D1DeviceContext_CreateEffect(context, test->clsid, &effect);
@@ -10109,7 +10129,7 @@ static void test_effect(BOOL d3d11)
}
ID2D1DeviceContext_Release(context);
- ID2D1Factory1_Release(factory);
+ ID2D1Factory1_Release(factory1);
release_test_context(&ctx);
}
@@ -10350,6 +10370,84 @@ static void test_effect_crop(BOOL d3d11)
release_test_context(&ctx);
}
+static void test_effect_grayscale(BOOL d3d11)
+{
+ DWORD colour, expected_colour, luminance;
+ D2D1_BITMAP_PROPERTIES1 bitmap_desc;
+ struct d2d1_test_context ctx;
+ struct resource_readback rb;
+ ID2D1DeviceContext *context;
+ D2D1_SIZE_U input_size;
+ ID2D1Factory3 *factory;
+ ID2D1Bitmap1 *bitmap;
+ ID2D1Effect *effect;
+ ID2D1Image *output;
+ unsigned int i;
+ HRESULT hr;
+
+ const DWORD test_pixels[] = {0xffffffff, 0x12345678, 0x89abcdef, 0x77777777, 0xdeadbeef};
+
+ if (!init_test_context(&ctx, d3d11))
+ return;
+
+ if (FAILED(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory3, NULL, (void **)&factory)))
+ {
+ win_skip("ID2D1Factory3 is not supported.\n");
+ release_test_context(&ctx);
+ return;
+ }
+
+ hr = ID2D1RenderTarget_QueryInterface(ctx.rt, &IID_ID2D1DeviceContext, (void **)&context);
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+
+ hr = ID2D1DeviceContext_CreateEffect(context, &CLSID_D2D1Grayscale, &effect);
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+
+ for (i = 0; i < ARRAY_SIZE(test_pixels); ++i)
+ {
+ DWORD pixel = test_pixels[i];
+ winetest_push_context("Test %u", i);
+
+ set_size_u(&input_size, 1, 1);
+ bitmap_desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM;
+ bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
+ bitmap_desc.dpiX = 96.0f;
+ bitmap_desc.dpiY = 96.0f;
+ bitmap_desc.bitmapOptions = D2D1_BITMAP_OPTIONS_NONE;
+ bitmap_desc.colorContext = NULL;
+ hr = ID2D1DeviceContext_CreateBitmap(context, input_size, &pixel, sizeof(pixel), &bitmap_desc, &bitmap);
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+
+ ID2D1Effect_SetInput(effect, 0, (ID2D1Image *)bitmap, FALSE);
+ ID2D1Effect_GetOutput(effect, &output);
+
+ ID2D1DeviceContext_BeginDraw(context);
+ ID2D1DeviceContext_Clear(context, 0);
+ ID2D1DeviceContext_DrawImage(context, output, NULL, NULL, 0, 0);
+ hr = ID2D1DeviceContext_EndDraw(context, NULL, NULL);
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+
+ get_surface_readback(&ctx, &rb);
+ colour = get_readback_colour(&rb, 0, 0);
+ luminance = (DWORD)(0.299f * ((pixel >> 16) & 0xff)
+ + 0.587f * ((pixel >> 8) & 0xff)
+ + 0.114f * ((pixel >> 0) & 0xff) + 0.5f);
+ expected_colour = (pixel & 0xff000000) | (luminance << 16) | (luminance << 8) | luminance;
+ todo_wine ok(compare_colour(colour, expected_colour, 1),
+ "Got unexpected colour %#lx, expected %#lx.\n", colour, expected_colour);
+ release_resource_readback(&rb);
+
+ ID2D1Image_Release(output);
+ ID2D1Bitmap1_Release(bitmap);
+ winetest_pop_context();
+ }
+
+ ID2D1Effect_Release(effect);
+ ID2D1DeviceContext_Release(context);
+ ID2D1Factory3_Release(factory);
+ release_test_context(&ctx);
+}
+
static void test_stroke_contains_point(BOOL d3d11)
{
ID2D1TransformedGeometry *transformed_geometry;
@@ -10735,6 +10833,7 @@ START_TEST(d2d1)
queue_test(test_effect);
queue_test(test_effect_2d_affine);
queue_test(test_effect_crop);
+ queue_test(test_effect_grayscale);
queue_d3d10_test(test_stroke_contains_point);
run_queued_tests();
diff --git a/include/d2d1effects_2.idl b/include/d2d1effects_2.idl
index 79895361118..9cd93a8d3bf 100644
--- a/include/d2d1effects_2.idl
+++ b/include/d2d1effects_2.idl
@@ -18,6 +18,7 @@
import "d2d1effects_1.idl";
+cpp_quote("DEFINE_GUID(CLSID_D2D1Grayscale, 0x36dde0eb,0x3725,0x42e0,0x83,0x6d,0x52,0xfb,0x20,0xae,0xe6,0x44);")
cpp_quote("DEFINE_GUID(CLSID_D2D1HighlightsShadows, 0xcadc8384,0x323f,0x4c7e,0xa3,0x61,0x2e,0x2b,0x24,0xdf,0x6e,0xe4);")
typedef enum D2D1_HIGHLIGHTSANDSHADOWS_PROP
--
2.25.1
3
2
[PATCH] combase/tests: Add some RoGetActivationFactory tests with manifest.
by Rémi Bernon 05 Apr '22
by Rémi Bernon 05 Apr '22
05 Apr '22
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
dlls/combase/tests/Makefile.in | 7 +-
dlls/combase/tests/combase.manifest | 15 ++
dlls/combase/tests/combase.rc | 22 +++
dlls/combase/tests/roapi.c | 52 +++++++
dlls/combase/tests/wine.combase.test.c | 159 ++++++++++++++++++++++
dlls/combase/tests/wine.combase.test.spec | 3 +
6 files changed, 256 insertions(+), 2 deletions(-)
create mode 100644 dlls/combase/tests/combase.manifest
create mode 100644 dlls/combase/tests/combase.rc
create mode 100644 dlls/combase/tests/wine.combase.test.c
create mode 100644 dlls/combase/tests/wine.combase.test.spec
diff --git a/dlls/combase/tests/Makefile.in b/dlls/combase/tests/Makefile.in
index 1c3d77725b3..99c036b78d9 100644
--- a/dlls/combase/tests/Makefile.in
+++ b/dlls/combase/tests/Makefile.in
@@ -1,6 +1,9 @@
TESTDLL = combase.dll
IMPORTS = combase
-C_SRCS = \
+SOURCES = \
roapi.c \
- string.c
+ string.c \
+ combase.rc \
+ wine.combase.test.c \
+ wine.combase.test.spec
diff --git a/dlls/combase/tests/combase.manifest b/dlls/combase/tests/combase.manifest
new file mode 100644
index 00000000000..72f3ac915e0
--- /dev/null
+++ b/dlls/combase/tests/combase.manifest
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity
+ type="win32"
+ name="wine.combase.test"
+ version="1.0.0.0"
+ processorArchitecture="*"
+ />
+<description>Wine combase test suite</description>
+<file name="wine.combase.test.dll">
+ <activatableClass name="Wine.Test.Missing" threadingModel="both" xmlns="urn:schemas-microsoft-com:winrt.v1"/>
+ <activatableClass name="Wine.Test.Class" threadingModel="both" xmlns="urn:schemas-microsoft-com:winrt.v1"/>
+ <activatableClass name="Wine.Test.Trusted" threadingModel="both" xmlns="urn:schemas-microsoft-com:winrt.v1"/>
+</file>
+</assembly>
diff --git a/dlls/combase/tests/combase.rc b/dlls/combase/tests/combase.rc
new file mode 100644
index 00000000000..865bf703d5c
--- /dev/null
+++ b/dlls/combase/tests/combase.rc
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2022 Rémi Bernon for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "winuser.h"
+
+/* @makedep: combase.manifest */
+1 RT_MANIFEST combase.manifest
diff --git a/dlls/combase/tests/roapi.c b/dlls/combase/tests/roapi.c
index b1ac15a08cb..1fb8e3e5dc0 100644
--- a/dlls/combase/tests/roapi.c
+++ b/dlls/combase/tests/roapi.c
@@ -28,12 +28,31 @@
#include "wine/test.h"
+static void load_resource(const WCHAR *filename)
+{
+ DWORD written;
+ HANDLE file;
+ HRSRC res;
+ void *ptr;
+
+ file = CreateFileW(filename, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
+ ok(file != INVALID_HANDLE_VALUE, "failed to create %s, error %lu\n", debugstr_w(filename), GetLastError());
+
+ res = FindResourceW(NULL, filename, L"TESTDLL");
+ ok(res != 0, "couldn't find resource\n");
+ ptr = LockResource(LoadResource(GetModuleHandleW(NULL), res));
+ WriteFile(file, ptr, SizeofResource(GetModuleHandleW(NULL), res), &written, NULL);
+ ok(written == SizeofResource(GetModuleHandleW(NULL), res), "couldn't write resource\n");
+ CloseHandle(file);
+}
+
static void test_ActivationFactories(void)
{
HRESULT hr;
HSTRING str, str2;
IActivationFactory *factory = NULL;
IInspectable *inspect = NULL;
+ ULONG ref;
hr = WindowsCreateString(L"Windows.Data.Xml.Dom.XmlDocument",
ARRAY_SIZE(L"Windows.Data.Xml.Dom.XmlDocument") - 1, &str);
@@ -63,10 +82,43 @@ static void test_ActivationFactories(void)
WindowsDeleteString(str2);
WindowsDeleteString(str);
+
+ hr = WindowsCreateString(L"Wine.Test.Missing", ARRAY_SIZE(L"Wine.Test.Missing") - 1, &str);
+ ok(hr == S_OK, "WindowsCreateString returned %#lx.\n", hr);
+ hr = RoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory);
+ ok(hr == REGDB_E_CLASSNOTREG, "RoGetActivationFactory returned %#lx.\n", hr);
+ ok(factory == NULL, "got factory %p.\n", factory);
+ WindowsDeleteString(str);
+ hr = WindowsCreateString(L"Wine.Test.Class", ARRAY_SIZE(L"Wine.Test.Class") - 1, &str);
+ ok(hr == S_OK, "WindowsCreateString returned %#lx.\n", hr);
+ hr = RoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory);
+ todo_wine
+ ok(hr == E_NOTIMPL, "RoGetActivationFactory returned %#lx.\n", hr);
+ ok(factory == NULL, "got factory %p.\n", factory);
+ WindowsDeleteString(str);
+ hr = WindowsCreateString(L"Wine.Test.Trusted", ARRAY_SIZE(L"Wine.Test.Trusted") - 1, &str);
+ ok(hr == S_OK, "WindowsCreateString returned %#lx.\n", hr);
+ hr = RoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory);
+ todo_wine
+ ok(hr == S_OK, "RoGetActivationFactory returned %#lx.\n", hr);
+ todo_wine
+ ok(!!factory, "got factory %p.\n", factory);
+ if (!factory) ref = 0;
+ else ref = IActivationFactory_Release(factory);
+ ok(ref == 0, "Release returned %lu\n", ref);
+ WindowsDeleteString(str);
+
RoUninitialize();
}
START_TEST(roapi)
{
+ BOOL ret;
+
+ load_resource(L"wine.combase.test.dll");
+
test_ActivationFactories();
+
+ ret = DeleteFileW(L"wine.combase.test.dll");
+ ok(ret, "Failed to delete file, error %lu\n", GetLastError());
}
diff --git a/dlls/combase/tests/wine.combase.test.c b/dlls/combase/tests/wine.combase.test.c
new file mode 100644
index 00000000000..e6171c6c6e7
--- /dev/null
+++ b/dlls/combase/tests/wine.combase.test.c
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2022 Rémi Bernon for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+#include <stddef.h>
+
+#define COBJMACROS
+#include "windef.h"
+#include "winbase.h"
+
+#include "initguid.h"
+#include "inspectable.h"
+#include "roapi.h"
+#include "winstring.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(combase);
+
+struct factory
+{
+ IActivationFactory IActivationFactory_iface;
+ LONG ref;
+ BOOL trusted;
+};
+
+static inline struct factory *impl_from_IActivationFactory(IActivationFactory *iface)
+{
+ return CONTAINING_RECORD(iface, struct factory, IActivationFactory_iface);
+}
+
+static HRESULT WINAPI factory_QueryInterface(IActivationFactory *iface, REFIID iid, void **out)
+{
+ struct factory *impl = impl_from_IActivationFactory(iface);
+
+ TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
+
+ if (IsEqualGUID(iid, &IID_IUnknown)
+ || IsEqualGUID(iid, &IID_IInspectable)
+ || IsEqualGUID(iid, &IID_IAgileObject)
+ || IsEqualGUID(iid, &IID_IActivationFactory))
+ {
+ IInspectable_AddRef((*out = &impl->IActivationFactory_iface));
+ return S_OK;
+ }
+
+ FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
+ *out = NULL;
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI factory_AddRef(IActivationFactory *iface)
+{
+ struct factory *impl = impl_from_IActivationFactory(iface);
+ ULONG ref = InterlockedIncrement(&impl->ref);
+ TRACE("iface %p increasing refcount to %lu.\n", iface, ref);
+ return ref;
+}
+
+static ULONG WINAPI factory_Release(IActivationFactory *iface)
+{
+ struct factory *impl = impl_from_IActivationFactory(iface);
+ ULONG ref = InterlockedDecrement(&impl->ref);
+ TRACE("iface %p decreasing refcount to %lu.\n", iface, ref);
+ return ref;
+}
+
+static HRESULT WINAPI factory_GetIids(IActivationFactory *iface, ULONG *iid_count, IID **iids)
+{
+ FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI factory_GetRuntimeClassName(IActivationFactory *iface, HSTRING *class_name)
+{
+ FIXME("iface %p, class_name %p stub!\n", iface, class_name);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI factory_GetTrustLevel(IActivationFactory *iface, TrustLevel *trust_level)
+{
+ struct factory *impl = impl_from_IActivationFactory(iface);
+
+ FIXME("iface %p, trust_level %p stub!\n", iface, trust_level);
+
+ if (!impl->trusted) return E_NOTIMPL;
+
+ *trust_level = BaseTrust;
+ return S_OK;
+}
+
+static HRESULT WINAPI factory_ActivateInstance(IActivationFactory *iface, IInspectable **instance)
+{
+ FIXME("iface %p, instance %p stub!\n", iface, instance);
+ return E_NOTIMPL;
+}
+
+static const struct IActivationFactoryVtbl factory_vtbl =
+{
+ factory_QueryInterface,
+ factory_AddRef,
+ factory_Release,
+ /* IInspectable methods */
+ factory_GetIids,
+ factory_GetRuntimeClassName,
+ factory_GetTrustLevel,
+ /* IActivationFactory methods */
+ factory_ActivateInstance,
+};
+
+static struct factory class_factory = {{&factory_vtbl}, 0};
+static struct factory trusted_factory = {{&factory_vtbl}, 0, TRUE};
+
+HRESULT WINAPI DllCanUnloadNow(void)
+{
+ FIXME("stub!\n");
+ return S_OK;
+}
+
+HRESULT WINAPI DllGetActivationFactory(HSTRING classid, IActivationFactory **factory)
+{
+ const WCHAR *buffer = WindowsGetStringRawBuffer(classid, NULL);
+
+ FIXME("class %s, factory %p stub!\n", debugstr_w(buffer), factory);
+
+ if (!wcscmp(buffer, L"Wine.Test.Class"))
+ {
+ IActivationFactory_AddRef((*factory = &class_factory.IActivationFactory_iface));
+ return S_OK;
+ }
+ if (!wcscmp(buffer, L"Wine.Test.Trusted"))
+ {
+ IActivationFactory_AddRef((*factory = &trusted_factory.IActivationFactory_iface));
+ return S_OK;
+ }
+
+ return REGDB_E_CLASSNOTREG;
+}
+
+HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out)
+{
+ FIXME("clsid %s, riid %s, out %p stub!\n", debugstr_guid(clsid), debugstr_guid(riid), out);
+ return CLASS_E_CLASSNOTAVAILABLE;
+}
diff --git a/dlls/combase/tests/wine.combase.test.spec b/dlls/combase/tests/wine.combase.test.spec
new file mode 100644
index 00000000000..20a8bfa98ea
--- /dev/null
+++ b/dlls/combase/tests/wine.combase.test.spec
@@ -0,0 +1,3 @@
+@ stdcall -private DllCanUnloadNow()
+@ stdcall -private DllGetActivationFactory(ptr ptr)
+@ stdcall -private DllGetClassObject(ptr ptr ptr)
--
2.35.1
2
1
[PATCH vkd3d 01/11] vkd3d-shader/hlsl: Report failure when encountering matrix instructions.
by Matteo Bruni 05 Apr '22
by Matteo Bruni 05 Apr '22
05 Apr '22
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
---
The immediate reason for this patch is to avoid returning a broken
shader in test_reflection() in Wine's d3dcompiler:hlsl_d3d11 tests.
libs/vkd3d-shader/hlsl_sm4.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/hlsl_sm4.c b/libs/vkd3d-shader/hlsl_sm4.c
index 94765f9e..9b6fa371 100644
--- a/libs/vkd3d-shader/hlsl_sm4.c
+++ b/libs/vkd3d-shader/hlsl_sm4.c
@@ -2067,7 +2067,7 @@ static void write_sm4_block(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *
{
if (instr->data_type->type == HLSL_CLASS_MATRIX)
{
- FIXME("Matrix operations need to be lowered.\n");
+ hlsl_fixme(ctx, &instr->loc, "Matrix operations need to be lowered.");
break;
}
else if (instr->data_type->type == HLSL_CLASS_OBJECT)
--
2.34.1
2
21