Wine-devel
Threads by month
- ----- 2026 -----
- March
- February
- January
- ----- 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
December 2017
- 60 participants
- 368 discussions
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
Useful for https://bugs.winehq.org/show_bug.cgi?id=44139.
dlls/wshom.ocx/shell.c | 78 +++++++++++++++++++++++++++++++++++++++++---
dlls/wshom.ocx/tests/wshom.c | 49 ++++++++++++++++++++++++++++
2 files changed, 123 insertions(+), 4 deletions(-)
diff --git a/dlls/wshom.ocx/shell.c b/dlls/wshom.ocx/shell.c
index b00bc1060e..a023786cc1 100644
--- a/dlls/wshom.ocx/shell.c
+++ b/dlls/wshom.ocx/shell.c
@@ -1275,11 +1275,81 @@ static HRESULT WINAPI WshShell3_Run(IWshShell3 *iface, BSTR cmd, VARIANT *style,
}
}
-static HRESULT WINAPI WshShell3_Popup(IWshShell3 *iface, BSTR Text, VARIANT* SecondsToWait, VARIANT *Title, VARIANT *Type, int *button)
+struct popup_thread_param
{
- FIXME("(%s %s %s %s %p): stub\n", debugstr_w(Text), debugstr_variant(SecondsToWait),
- debugstr_variant(Title), debugstr_variant(Type), button);
- return E_NOTIMPL;
+ WCHAR *text;
+ VARIANT title;
+ VARIANT type;
+ INT button;
+};
+
+static DWORD WINAPI popup_thread_proc(void *arg)
+{
+ static const WCHAR defaulttitleW[] = {'W','i','n','d','o','w','s',' ','S','c','r','i','p','t',' ','H','o','s','t',0};
+ struct popup_thread_param *param = (struct popup_thread_param *)arg;
+
+ param->button = MessageBoxW(NULL, param->text, is_optional_argument(¶m->title) ?
+ defaulttitleW : V_BSTR(¶m->title), V_I4(¶m->type));
+ return 0;
+}
+
+static HRESULT WINAPI WshShell3_Popup(IWshShell3 *iface, BSTR text, VARIANT *seconds_to_wait, VARIANT *title,
+ VARIANT *type, int *button)
+{
+ struct popup_thread_param param;
+ DWORD tid, status;
+ VARIANT timeout;
+ HANDLE hthread;
+ HRESULT hr;
+
+ TRACE("(%s %s %s %s %p)\n", debugstr_w(text), debugstr_variant(seconds_to_wait), debugstr_variant(title),
+ debugstr_variant(type), button);
+
+ if (!seconds_to_wait || !title || !type || !button)
+ return E_POINTER;
+
+ VariantInit(&timeout);
+ if (!is_optional_argument(seconds_to_wait))
+ {
+ hr = VariantChangeType(&timeout, seconds_to_wait, 0, VT_I4);
+ if (FAILED(hr))
+ return hr;
+ }
+
+ VariantInit(¶m.type);
+ if (!is_optional_argument(type))
+ {
+ hr = VariantChangeType(¶m.type, type, 0, VT_I4);
+ if (FAILED(hr))
+ return hr;
+ }
+
+ if (is_optional_argument(title))
+ param.title = *title;
+ else
+ {
+ VariantInit(¶m.title);
+ hr = VariantChangeType(¶m.title, title, 0, VT_BSTR);
+ if (FAILED(hr))
+ return hr;
+ }
+
+ param.text = text;
+ param.button = -1;
+ hthread = CreateThread(NULL, 0, popup_thread_proc, ¶m, 0, &tid);
+ status = MsgWaitForMultipleObjects(1, &hthread, FALSE, V_I4(&timeout) ? V_I4(&timeout) * 1000: INFINITE, 0);
+ if (status == WAIT_TIMEOUT)
+ {
+ PostThreadMessageW(tid, WM_QUIT, 0, 0);
+ MsgWaitForMultipleObjects(1, &hthread, FALSE, INFINITE, 0);
+ param.button = -1;
+ }
+ *button = param.button;
+
+ VariantClear(¶m.title);
+ CloseHandle(hthread);
+
+ return S_OK;
}
static HRESULT WINAPI WshShell3_CreateShortcut(IWshShell3 *iface, BSTR PathLink, IDispatch** Shortcut)
diff --git a/dlls/wshom.ocx/tests/wshom.c b/dlls/wshom.ocx/tests/wshom.c
index 7e82f30c18..18ff4d6228 100644
--- a/dlls/wshom.ocx/tests/wshom.c
+++ b/dlls/wshom.ocx/tests/wshom.c
@@ -566,6 +566,54 @@ static void test_registry(void)
IWshShell3_Release(sh3);
}
+static void test_popup(void)
+{
+ static const WCHAR textW[] = {'T','e','x','t',0};
+ VARIANT timeout, type, title, optional;
+ IWshShell *sh;
+ int button;
+ HRESULT hr;
+ BSTR text;
+
+ hr = CoCreateInstance(&CLSID_WshShell, NULL, CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER,
+ &IID_IWshShell, (void **)&sh);
+ ok(hr == S_OK, "Failed to create WshShell object, hr %#x.\n", hr);
+
+ button = 123;
+ text = SysAllocString(textW);
+
+ hr = IWshShell_Popup(sh, NULL, NULL, NULL, NULL, &button);
+ ok(hr == E_POINTER, "Unexpected retval %#x.\n", hr);
+ ok(button == 123, "Unexpected button id %d.\n", button);
+
+ hr = IWshShell_Popup(sh, text, NULL, NULL, NULL, &button);
+ ok(hr == E_POINTER, "Unexpected retval %#x.\n", hr);
+ ok(button == 123, "Unexpected button id %d.\n", button);
+
+ V_VT(&optional) = VT_ERROR;
+ V_ERROR(&optional) = DISP_E_PARAMNOTFOUND;
+
+ V_VT(&timeout) = VT_I2;
+ V_I2(&timeout) = 1;
+
+ V_VT(&type) = VT_I2;
+ V_I2(&type) = 1;
+
+ V_VT(&title) = VT_BSTR;
+ V_BSTR(&title) = NULL;
+
+ hr = IWshShell_Popup(sh, text, &timeout, &optional, &type, &button);
+ ok(hr == S_OK, "Unexpected retval %#x.\n", hr);
+ ok(button == -1, "Unexpected button id %d.\n", button);
+
+ hr = IWshShell_Popup(sh, text, &timeout, &title, &optional, &button);
+ ok(hr == S_OK, "Unexpected retval %#x.\n", hr);
+ ok(button == -1, "Unexpected button id %d.\n", button);
+
+ SysFreeString(text);
+ IWshShell_Release(sh);
+}
+
START_TEST(wshom)
{
IUnknown *unk;
@@ -583,6 +631,7 @@ START_TEST(wshom)
test_wshshell();
test_registry();
+ test_popup();
CoUninitialize();
}
--
2.15.1
1
0
[PATCH] Revert "user32/combo: Set listbox popup height correctly and add tests." (resend)
by Alistair Leslie-Hughes 10 Dec '17
by Alistair Leslie-Hughes 10 Dec '17
10 Dec '17
From: Sebastian Lackner <sebastian(a)fds-team.de>
This partly reverts commit f7f7b89e2e9117811c91269643868c6d063db5e9.
(Tests are left inplace).
Any application that currently uses "Microsoft.Windows.Common-Controls v6" via
a Manifest has the possibility of breaking comboboxes. Using this version of
the control ensures that dropdown for comboboxes, will show multiple items,
regardless of its height in the resource.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/user32/combo.c | 8 ++++++++
dlls/user32/tests/combo.c | 20 ++++++++++----------
2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/dlls/user32/combo.c b/dlls/user32/combo.c
index 2f270e5..7d15ff7 100644
--- a/dlls/user32/combo.c
+++ b/dlls/user32/combo.c
@@ -1044,6 +1044,14 @@ static void CBDropDown( LPHEADCOMBO lphc )
if (nHeight < nDroppedHeight - COMBO_YBORDERSIZE())
nDroppedHeight = nHeight + COMBO_YBORDERSIZE();
+
+ if (nDroppedHeight < nHeight)
+ {
+ if (nItems < 5)
+ nDroppedHeight = (nItems+1)*nIHeight;
+ else if (nDroppedHeight < 6*nIHeight)
+ nDroppedHeight = 6*nIHeight;
+ }
}
r.left = rect.left;
diff --git a/dlls/user32/tests/combo.c b/dlls/user32/tests/combo.c
index 0519ace..72e8777 100644
--- a/dlls/user32/tests/combo.c
+++ b/dlls/user32/tests/combo.c
@@ -718,25 +718,25 @@ static void test_listbox_size(DWORD style)
int height_combo;
BOOL todo;
} info_height[] = {
- {2, 24},
+ {2, 24, TRUE},
{2, 41, TRUE},
- {2, 42},
- {2, 50},
+ {2, 42, TRUE},
+ {2, 50, TRUE},
{2, 60},
{2, 80},
{2, 89},
{2, 90},
{2, 100},
- {10, 24},
+ {10, 24, TRUE},
{10, 41, TRUE},
- {10, 42},
- {10, 50},
- {10, 60},
- {10, 80},
+ {10, 42, TRUE},
+ {10, 50, TRUE},
+ {10, 60, TRUE},
+ {10, 80, TRUE},
{10, 89, TRUE},
- {10, 90},
- {10, 100},
+ {10, 90, TRUE},
+ {10, 100, TRUE},
};
pGetComboBoxInfo = (void *)GetProcAddress(GetModuleHandleA("user32.dll"), "GetComboBoxInfo");
--
1.9.1
1
0
Signed-off-by: Stefan Dösinger <stefan(a)codeweavers.com>
---
I tried to test what happens if the temp path is longer than MAX_PATH
characters, but I could not get Windows to accept a long temp path. If
%TMP% is longer than 100 characters (or somewhere in that area, I did
not test the precise limit) it falls back to %TEMP%, %USERPROFILE% and
finally "C:\Windows".
I assume msvcp does not clear the extra bytes like GetTempPathW either
because it doesn't call GetTempPath and implements the logic itself or
because it writes to a temp buffer and copies the data. I don't know how
to trigger this possible case even with a manual test on Windows.
---
dlls/msvcp140/msvcp140.spec | 2 +-
dlls/msvcp140/tests/msvcp140.c | 27 +++++++++++++++++++++++++++
dlls/msvcp90/ios.c | 6 ++++++
3 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/dlls/msvcp140/msvcp140.spec b/dlls/msvcp140/msvcp140.spec
index 4fc8e3c5d5..3cd1975adf 100644
--- a/dlls/msvcp140/msvcp140.spec
+++ b/dlls/msvcp140/msvcp140.spec
@@ -3718,7 +3718,7 @@
@ stub _Strxfrm
@ cdecl _Symlink(wstr wstr) tr2_sys__Symlink_wchar
@ stub _Symlink_get
-@ stub _Temp_get
+@ cdecl _Temp_get(ptr)
@ stub _Thrd_abort
@ cdecl _Thrd_create(ptr ptr ptr) _Thrd_create
@ cdecl -norelay _Thrd_current()
diff --git a/dlls/msvcp140/tests/msvcp140.c b/dlls/msvcp140/tests/msvcp140.c
index 620e9317c9..01ed89aceb 100644
--- a/dlls/msvcp140/tests/msvcp140.c
+++ b/dlls/msvcp140/tests/msvcp140.c
@@ -177,6 +177,7 @@ static WCHAR* (__cdecl *p_Read_dir)(WCHAR*, void*, enum file_type*);
static MSVCP_bool (__cdecl *p_Remove_dir)(WCHAR const*);
static enum file_type (__cdecl *p_Stat)(WCHAR const *, int *);
static int (__cdecl *p_Symlink)(WCHAR const*, WCHAR const*);
+static WCHAR* (__cdecl *p_Temp_get)(WCHAR *);
static int (__cdecl *p_To_byte)(const WCHAR *src, char *dst);
static int (__cdecl *p_To_wide)(const char *src, WCHAR *dst);
static int (__cdecl *p_Unlink)(WCHAR const*);
@@ -258,6 +259,7 @@ static BOOL init(void)
SET(p_Remove_dir, "_Remove_dir");
SET(p_Stat, "_Stat");
SET(p_Symlink, "_Symlink");
+ SET(p_Temp_get, "_Temp_get");
SET(p_To_byte, "_To_byte");
SET(p_To_wide, "_To_wide");
SET(p_Unlink, "_Unlink");
@@ -1054,6 +1056,30 @@ static void test_Unlink(void)
ok(SetCurrentDirectoryW(current_path), "SetCurrentDirectoryW failed\n");
}
+static void test_Temp_get(void)
+{
+ WCHAR path[MAX_PATH + 1], temp_path[MAX_PATH];
+ WCHAR *retval;
+ DWORD len;
+
+ GetTempPathW(sizeof(temp_path)/sizeof(*temp_path), temp_path);
+
+ /* This crashes on Windows, the input pointer is not validated. */
+ if (0)
+ {
+ retval = p_Temp_get(NULL);
+ ok(!retval, "_Temp_get(): Got %p\n", retval);
+ }
+
+ memset(path, 0xaa, sizeof(path));
+ retval = p_Temp_get(path);
+ ok(retval == path, "_Temp_get(): Got %p, expected %p\n", retval, path);
+ ok(!wcscmp(path, temp_path), "Expected path %s, got %s\n", wine_dbgstr_w(temp_path), wine_dbgstr_w(path));
+ len = wcslen(path);
+ ok(!path[len], "Expected a 0 terminated string\n");
+ todo_wine ok(path[len + 1] == 0xaaaa, "Too many bytes were zeroed - %x\n", path[len + 1]);
+}
+
START_TEST(msvcp140)
{
if(!init()) return;
@@ -1071,5 +1097,6 @@ START_TEST(msvcp140)
test_Stat();
test_dir_operation();
test_Unlink();
+ test_Temp_get();
FreeLibrary(msvcp);
}
diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index 3f859979cb..ab9d7a44a4 100644
--- a/dlls/msvcp90/ios.c
+++ b/dlls/msvcp90/ios.c
@@ -15745,6 +15745,12 @@ enum file_type __cdecl _Lstat(WCHAR const* path, int* permissions)
return _Stat(path, permissions);
}
+WCHAR * __cdecl _Temp_get(WCHAR *dst)
+{
+ GetTempPathW(MAX_PATH, dst);
+ return dst;
+}
+
/* ??1_Winit(a)std@@QAE(a)XZ */
/* ??1_Winit(a)std@@QAE(a)XZ */
DEFINE_THISCALL_WRAPPER(_Winit_dtor, 4)
--
2.13.6
2
3
08 Dec '17
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
v3: Combined dhtmled_classes.idl into dhtmled_tlb.idl
---
configure.ac | 1 +
dlls/dhtmled.ocx/Makefile.in | 8 +
dlls/dhtmled.ocx/dhtmled.ocx.spec | 4 +
dlls/dhtmled.ocx/dhtmled_private.h | 19 ++
dlls/dhtmled.ocx/dhtmled_tlb.idl | 22 ++
dlls/dhtmled.ocx/edit.c | 534 +++++++++++++++++++++++++++++++++++++
dlls/dhtmled.ocx/main.c | 162 +++++++++++
7 files changed, 750 insertions(+)
create mode 100644 dlls/dhtmled.ocx/Makefile.in
create mode 100644 dlls/dhtmled.ocx/dhtmled.ocx.spec
create mode 100644 dlls/dhtmled.ocx/dhtmled_private.h
create mode 100644 dlls/dhtmled.ocx/dhtmled_tlb.idl
create mode 100644 dlls/dhtmled.ocx/edit.c
create mode 100644 dlls/dhtmled.ocx/main.c
diff --git a/configure.ac b/configure.ac
index 69fad417ba..dafbf6faa8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3091,6 +3091,7 @@ WINE_CONFIG_TEST(dlls/ddrawex/tests)
WINE_CONFIG_DLL(devenum,,[clean])
WINE_CONFIG_TEST(dlls/devenum/tests)
WINE_CONFIG_DLL(dhcpcsvc)
+WINE_CONFIG_DLL(dhtmled.ocx)
WINE_CONFIG_DLL(difxapi)
WINE_CONFIG_DLL(dinput,,[clean,implib,staticimplib])
WINE_CONFIG_TEST(dlls/dinput/tests)
diff --git a/dlls/dhtmled.ocx/Makefile.in b/dlls/dhtmled.ocx/Makefile.in
new file mode 100644
index 0000000000..17850f8107
--- /dev/null
+++ b/dlls/dhtmled.ocx/Makefile.in
@@ -0,0 +1,8 @@
+MODULE = dhtmled.ocx
+IMPORTS = uuid
+
+C_SRCS = \
+ edit.c \
+ main.c
+
+IDL_SRCS = dhtmled_tlb.idl
diff --git a/dlls/dhtmled.ocx/dhtmled.ocx.spec b/dlls/dhtmled.ocx/dhtmled.ocx.spec
new file mode 100644
index 0000000000..b16365d0c9
--- /dev/null
+++ b/dlls/dhtmled.ocx/dhtmled.ocx.spec
@@ -0,0 +1,4 @@
+@ stdcall -private DllCanUnloadNow()
+@ stdcall -private DllGetClassObject(ptr ptr ptr)
+@ stdcall -private DllRegisterServer()
+@ stdcall -private DllUnregisterServer()
diff --git a/dlls/dhtmled.ocx/dhtmled_private.h b/dlls/dhtmled.ocx/dhtmled_private.h
new file mode 100644
index 0000000000..5a9e89b997
--- /dev/null
+++ b/dlls/dhtmled.ocx/dhtmled_private.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2017 Alex Henrie
+ *
+ * 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
+ */
+
+extern HRESULT dhtml_edit_create(REFIID iid, void **out);
diff --git a/dlls/dhtmled.ocx/dhtmled_tlb.idl b/dlls/dhtmled.ocx/dhtmled_tlb.idl
new file mode 100644
index 0000000000..96a9444a13
--- /dev/null
+++ b/dlls/dhtmled.ocx/dhtmled_tlb.idl
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2017 Alex Henrie
+ *
+ * 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
+ */
+
+#pragma makedep register
+#pragma makedep regtypelib
+
+#include "dhtmled.idl"
diff --git a/dlls/dhtmled.ocx/edit.c b/dlls/dhtmled.ocx/edit.c
new file mode 100644
index 0000000000..6e37554119
--- /dev/null
+++ b/dlls/dhtmled.ocx/edit.c
@@ -0,0 +1,534 @@
+/*
+ * Copyright 2017 Alex Henrie
+ *
+ * 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
+ */
+
+#define COBJMACROS
+
+#include "dhtmled.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(dhtmled);
+
+typedef struct
+{
+ IDHTMLEdit IDHTMLEdit_iface;
+ LONG ref;
+} DHTMLEditImpl;
+
+static inline DHTMLEditImpl *impl_from_IDHTMLEdit(IDHTMLEdit *iface)
+{
+ return CONTAINING_RECORD(iface, DHTMLEditImpl, IDHTMLEdit_iface);
+}
+
+static HRESULT WINAPI DHTMLEdit_QueryInterface(IDHTMLEdit *iface, REFIID iid, void **out)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+
+ TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(iid), out);
+
+ if (IsEqualGUID(iid, &IID_IUnknown) ||
+ IsEqualGUID(iid, &IID_IDispatch) ||
+ IsEqualGUID(iid, &IID_IDHTMLSafe) ||
+ IsEqualGUID(iid, &IID_IDHTMLEdit))
+ {
+ IUnknown_AddRef(iface);
+ *out = iface;
+ return S_OK;
+ }
+
+ *out = NULL;
+ ERR("no interface for %s\n", debugstr_guid(iid));
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI DHTMLEdit_AddRef(IDHTMLEdit *iface)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ LONG ref = InterlockedIncrement(&This->ref);
+
+ TRACE("(%p) ref=%d\n", This, ref);
+
+ return ref;
+}
+
+static ULONG WINAPI DHTMLEdit_Release(IDHTMLEdit *iface)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ LONG ref = InterlockedDecrement(&This->ref);
+
+ TRACE("(%p) ref=%d\n", This, ref);
+
+ if (!ref)
+ HeapFree(GetProcessHeap(), 0, This);
+
+ return ref;
+}
+
+static HRESULT WINAPI DHTMLEdit_GetTypeInfoCount(IDHTMLEdit *iface, UINT *count)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, count);
+ *count = 0;
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_GetTypeInfo(IDHTMLEdit *iface, UINT type_index, LCID lcid, ITypeInfo **type_info)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%u, %08x, %p) stub\n", This, type_index, lcid, type_info);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_GetIDsOfNames(IDHTMLEdit *iface, REFIID iid, OLECHAR **names, UINT name_count,
+ LCID lcid, DISPID *disp_ids)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%s, %p, %u, %08x, %p) stub\n", This, debugstr_guid(iid), names, name_count, lcid, disp_ids);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_Invoke(IDHTMLEdit *iface, DISPID member, REFIID iid, LCID lcid, WORD flags,
+ DISPPARAMS *params, VARIANT *ret, EXCEPINFO *exception_info, UINT *error_index)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%d, %s, %08x, 0x%x, %p, %p, %p, %p) stub\n",
+ This, member, debugstr_guid(iid), lcid, flags, params, ret, exception_info, error_index);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_ExecCommand(IDHTMLEdit *iface, DHTMLEDITCMDID cmd_id, OLECMDEXECOPT options,
+ VARIANT *code_in, VARIANT *code_out)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%u, %u, %s, %p) stub\n", This, cmd_id, options, debugstr_variant(code_in), code_out);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_QueryStatus(IDHTMLEdit *iface, DHTMLEDITCMDID cmd_id, DHTMLEDITCMDF *status)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%u, %p) stub\n", This, cmd_id, status);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_SetContextMenu(IDHTMLEdit *iface, VARIANT *strings, VARIANT *states)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p, %p) stub\n", This, strings, states);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_NewDocument(IDHTMLEdit *iface)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->() stub\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_LoadURL(IDHTMLEdit *iface, BSTR url)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%s)\n", This, debugstr_w(url));
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_FilterSourceCode(IDHTMLEdit *iface, BSTR in, BSTR *out)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%s, %p)\n", This, debugstr_w(in), out);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_Refresh(IDHTMLEdit *iface)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->() stub\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_DOM(IDHTMLEdit *iface, IHTMLDocument2 **value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_DocumentHTML(IDHTMLEdit *iface, BSTR *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_DocumentHTML(IDHTMLEdit *iface, BSTR html)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%s) stub\n", This, debugstr_w(html));
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_ActivateApplets(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_ActivateApplets(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%04x) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_ActivateActiveXControls(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_ActivateActiveXControls(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%04x) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_ActivateDTCs(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_ActivateDTCs(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%04x) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_ShowDetails(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_ShowDetails(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%04x) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_ShowBorders(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_ShowBorders(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%04x) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_Appearance(IDHTMLEdit *iface, DHTMLEDITAPPEARANCE *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_Appearance(IDHTMLEdit *iface, DHTMLEDITAPPEARANCE value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%u) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_Scrollbars(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_Scrollbars(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%04x) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_ScrollbarAppearance(IDHTMLEdit *iface, DHTMLEDITAPPEARANCE *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_ScrollbarAppearance(IDHTMLEdit *iface, DHTMLEDITAPPEARANCE value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%u) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_SourceCodePreservation(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_SourceCodePreservation(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%04x) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_AbsoluteDropMode(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_AbsoluteDropMode(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%04x) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_SnapToGridX(IDHTMLEdit *iface, LONG *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_SnapToGridX(IDHTMLEdit *iface, LONG value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%d) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_SnapToGridY(IDHTMLEdit *iface, LONG *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_SnapToGridY(IDHTMLEdit *iface, LONG value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%d) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_SnapToGrid(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_SnapToGrid(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%04x) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_IsDirty(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_CurrentDocumentPath(IDHTMLEdit *iface, BSTR *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_BaseURL(IDHTMLEdit *iface, BSTR *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_BaseURL(IDHTMLEdit *iface, BSTR value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%s) stub\n", This, debugstr_w(value));
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_DocumentTitle(IDHTMLEdit *iface, BSTR *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_UseDivOnCarriageReturn(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_UseDivOnCarriageReturn(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%04x) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_Busy(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_LoadDocument(IDHTMLEdit *iface, VARIANT *path, VARIANT *prompt)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%s, %s) stub\n", This, debugstr_variant(path), debugstr_variant(prompt));
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_SaveDocument(IDHTMLEdit *iface, VARIANT *path, VARIANT *prompt)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%s, %s) stub\n", This, debugstr_variant(path), debugstr_variant(prompt));
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_PrintDocument(IDHTMLEdit *iface, VARIANT *prompt)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%s) stub\n", This, debugstr_variant(prompt));
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_BrowseMode(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%p) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_BrowseMode(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+ DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+ FIXME("(%p)->(%04x) stub\n", This, value);
+ return E_NOTIMPL;
+}
+
+static const IDHTMLEditVtbl DHTMLEditVtbl = {
+ DHTMLEdit_QueryInterface,
+ DHTMLEdit_AddRef,
+ DHTMLEdit_Release,
+ DHTMLEdit_GetTypeInfoCount,
+ DHTMLEdit_GetTypeInfo,
+ DHTMLEdit_GetIDsOfNames,
+ DHTMLEdit_Invoke,
+ DHTMLEdit_ExecCommand,
+ DHTMLEdit_QueryStatus,
+ DHTMLEdit_SetContextMenu,
+ DHTMLEdit_NewDocument,
+ DHTMLEdit_LoadURL,
+ DHTMLEdit_FilterSourceCode,
+ DHTMLEdit_Refresh,
+ DHTMLEdit_get_DOM,
+ DHTMLEdit_get_DocumentHTML,
+ DHTMLEdit_put_DocumentHTML,
+ DHTMLEdit_get_ActivateApplets,
+ DHTMLEdit_put_ActivateApplets,
+ DHTMLEdit_get_ActivateActiveXControls,
+ DHTMLEdit_put_ActivateActiveXControls,
+ DHTMLEdit_get_ActivateDTCs,
+ DHTMLEdit_put_ActivateDTCs,
+ DHTMLEdit_get_ShowDetails,
+ DHTMLEdit_put_ShowDetails,
+ DHTMLEdit_get_ShowBorders,
+ DHTMLEdit_put_ShowBorders,
+ DHTMLEdit_get_Appearance,
+ DHTMLEdit_put_Appearance,
+ DHTMLEdit_get_Scrollbars,
+ DHTMLEdit_put_Scrollbars,
+ DHTMLEdit_get_ScrollbarAppearance,
+ DHTMLEdit_put_ScrollbarAppearance,
+ DHTMLEdit_get_SourceCodePreservation,
+ DHTMLEdit_put_SourceCodePreservation,
+ DHTMLEdit_get_AbsoluteDropMode,
+ DHTMLEdit_put_AbsoluteDropMode,
+ DHTMLEdit_get_SnapToGridX,
+ DHTMLEdit_put_SnapToGridX,
+ DHTMLEdit_get_SnapToGridY,
+ DHTMLEdit_put_SnapToGridY,
+ DHTMLEdit_get_SnapToGrid,
+ DHTMLEdit_put_SnapToGrid,
+ DHTMLEdit_get_IsDirty,
+ DHTMLEdit_get_CurrentDocumentPath,
+ DHTMLEdit_get_BaseURL,
+ DHTMLEdit_put_BaseURL,
+ DHTMLEdit_get_DocumentTitle,
+ DHTMLEdit_get_UseDivOnCarriageReturn,
+ DHTMLEdit_put_UseDivOnCarriageReturn,
+ DHTMLEdit_get_Busy,
+ DHTMLEdit_LoadDocument,
+ DHTMLEdit_SaveDocument,
+ DHTMLEdit_PrintDocument,
+ DHTMLEdit_get_BrowseMode,
+ DHTMLEdit_put_BrowseMode
+};
+
+HRESULT dhtml_edit_create(REFIID iid, void **out)
+{
+ DHTMLEditImpl *This;
+
+ TRACE("(%s, %p)\n", debugstr_guid(iid), out);
+
+ *out = NULL;
+
+ This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
+ if (!This)
+ return E_OUTOFMEMORY;
+
+ This->IDHTMLEdit_iface.lpVtbl = &DHTMLEditVtbl;
+ This->ref = 1;
+
+ *out = &This->IDHTMLEdit_iface;
+ return S_OK;
+}
diff --git a/dlls/dhtmled.ocx/main.c b/dlls/dhtmled.ocx/main.c
new file mode 100644
index 0000000000..4640884934
--- /dev/null
+++ b/dlls/dhtmled.ocx/main.c
@@ -0,0 +1,162 @@
+/*
+ * Dynamic HyperText Markup Language Editing Control
+ *
+ * Copyright 2017 Alex Henrie
+ *
+ * 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
+ */
+
+#define COBJMACROS
+
+#include "initguid.h"
+#include "dhtmled.h"
+#include "dhtmled_private.h"
+#include "rpcproxy.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(dhtmled);
+
+typedef struct
+{
+ IClassFactory IClassFactory_iface;
+ HRESULT (*create)(REFIID iid, void **out);
+} ClassFactoryImpl;
+
+static inline ClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
+{
+ return CONTAINING_RECORD(iface, ClassFactoryImpl, IClassFactory_iface);
+}
+
+static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID iid, void **out)
+{
+ TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(iid), out);
+
+ if (IsEqualGUID(&IID_IUnknown, iid) || IsEqualGUID(&IID_IClassFactory, iid))
+ {
+ *out = iface;
+ IClassFactory_AddRef(iface);
+ return S_OK;
+ }
+
+ *out = NULL;
+ WARN("no interface for %s\n", debugstr_guid(iid));
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
+{
+ return 2; /* non-heap based object */
+}
+
+static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
+{
+ return 1; /* non-heap based object */
+}
+
+static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID iid, void **out)
+{
+ ClassFactoryImpl *This = impl_from_IClassFactory(iface);
+
+ TRACE("(%p)->(%p, %s, %p)\n", iface, outer, debugstr_guid(iid), out);
+
+ if (outer)
+ return CLASS_E_NOAGGREGATION;
+
+ return This->create(iid, out);
+}
+
+static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL lock)
+{
+ TRACE("(%p)->(%x)\n", iface, lock);
+ return S_OK;
+}
+
+static const IClassFactoryVtbl ClassFactoryVtbl = {
+ ClassFactory_QueryInterface,
+ ClassFactory_AddRef,
+ ClassFactory_Release,
+ ClassFactory_CreateInstance,
+ ClassFactory_LockServer
+};
+
+static HINSTANCE dhtmled_instance;
+
+/******************************************************************
+ * DllMain (dhtmled.ocx.@)
+ */
+BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, VOID *reserved)
+{
+ TRACE("(%p, %u, %p)\n", instance, reason, reserved);
+
+ switch (reason)
+ {
+ case DLL_WINE_PREATTACH:
+ /* Applications that use dhtmled.ocx usually install and register it
+ * themselves, but do not install its dependency triedit.dll.
+ * Because Wine's (currently nonexistent) triedit.dll implementation
+ * is not sufficient for native dhtmled.ocx, prefer our own. */
+ return TRUE;
+ case DLL_PROCESS_ATTACH:
+ DisableThreadLibraryCalls(instance);
+ dhtmled_instance = instance;
+ break;
+ }
+
+ return TRUE;
+}
+
+/***********************************************************************
+ * DllGetClassObject (dhtmled.ocx.@)
+ */
+HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, LPVOID *out)
+{
+ static ClassFactoryImpl dhtml_edit_cf = { {&ClassFactoryVtbl}, dhtml_edit_create };
+
+ TRACE("(%s, %s, %p)\n", debugstr_guid(clsid), debugstr_guid(iid), out);
+
+ if (IsEqualGUID(clsid, &CLSID_DHTMLEdit))
+ return IClassFactory_QueryInterface(&dhtml_edit_cf.IClassFactory_iface, iid, out);
+
+ FIXME("no class for %s\n", debugstr_guid(clsid));
+ return CLASS_E_CLASSNOTAVAILABLE;
+}
+
+/***********************************************************************
+ * DllCanUnloadNow (dhtmled.ocx.@)
+ */
+HRESULT WINAPI DllCanUnloadNow(void)
+{
+ TRACE("()\n");
+ return S_FALSE;
+}
+
+/***********************************************************************
+ * DllRegisterServer (dhtmled.ocx.@)
+ */
+HRESULT WINAPI DllRegisterServer(void)
+{
+ TRACE("()\n");
+ return __wine_register_resources(dhtmled_instance);
+}
+
+/***********************************************************************
+ * DllUnregisterServer (dhtmled.ocx.@)
+ */
+HRESULT WINAPI DllUnregisterServer(void)
+{
+ TRACE("()\n");
+ return __wine_unregister_resources(dhtmled_instance);
+}
--
2.15.1
2
4
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
v4: Added threading attribute to DHTMLEdit and DHTMLSafe
---
include/Makefile.in | 2 +
include/dhtmldid.h | 67 +++++
include/dhtmled.idl | 718 ++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 787 insertions(+)
create mode 100644 include/dhtmldid.h
create mode 100644 include/dhtmled.idl
diff --git a/include/Makefile.in b/include/Makefile.in
index fa1e42738b..430c4733af 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -58,6 +58,7 @@ IDL_SRCS = \
ddstream.idl \
devenum.idl \
devicetopology.idl \
+ dhtmled.idl \
dimm.idl \
dispex.idl \
docobj.idl \
@@ -342,6 +343,7 @@ HEADER_SRCS = \
devpkey.h \
devpropdef.h \
dhcpcsdk.h \
+ dhtmldid.h \
difxapi.h \
digitalv.h \
dinput.h \
diff --git a/include/dhtmldid.h b/include/dhtmldid.h
new file mode 100644
index 0000000000..85c286a102
--- /dev/null
+++ b/include/dhtmldid.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2017 Alex Henrie
+ *
+ * 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
+ */
+
+#define DISPID_LOADDOCUMENT 1
+#define DISPID_EXECCOMMAND 2
+#define DISPID_QUERYSTATUS 3
+#define DISPID_SAVEDOCUMENT 4
+#define DISPID_SETCONTEXTMENU 5
+#define DISPID_DOCUMENT 6
+#define DISPID_ACTIVATEAPPLETS 7
+#define DISPID_ACTIVATEACTIVEXCONTROLS 8
+#define DISPID_ACTIVATEDTCS 9
+#define DISPID_SHOWDETAILS 11
+#define DISPID_SHOWBORDERS 12
+#define DISPID_DHTMLEDITAPPEARANCE 13
+#define DISPID_DHTMLEDITSCROLLBARS 14
+#define DISPID_SCROLLBARAPPEARANCE 15
+#define DISPID_SOURCECODEPRESERVATION 16
+#define DISPID_DOCUMENTHTML 17
+#define DISPID_ABSOLUTEDROPMODE 18
+#define DISPID_SNAPTOGRIDX 19
+#define DISPID_SNAPTOGRIDY 20
+#define DISPID_SNAPTOGRID 21
+#define DISPID_ISDIRTY 22
+#define DISPID_CURRENTDOCUMENTPATH 23
+#define DISPID_BASEURL 24
+#define DISPID_DOCUMENTTITLE 25
+#define DISPID_BROWSEMODE 26
+#define DISPID_NEWDOCUMENT 27
+#define DISPID_PRINT 28
+#define DISPID_LOADURL 29
+#define DISPID_USEDIVONCR 30
+#define DISPID_FILTERSRCCODE 31
+#define DISPID_REFRESHDOC 32
+#define DISPID_BUSY 33
+
+#define DISPID_DOCUMENTCOMPLETE 1
+#define DISPID_DISPLAYCHANGED 2
+#define DISPID_SHOWCONTEXTMENU 3
+#define DISPID_CONTEXTMENUACTION 4
+#define DISPID_ONMOUSEDOWN 5
+#define DISPID_ONMOUSEMOVE 6
+#define DISPID_ONMOUSEUP 7
+#define DISPID_ONMOUSEOUT 8
+#define DISPID_ONMOUSEOVER 9
+#define DISPID_ONCLICK 10
+#define DISPID_ONDBLCLICK 11
+#define DISPID_ONKEYDOWN 12
+#define DISPID_ONKEYPRESS 13
+#define DISPID_ONKEYUP 14
+#define DISPID_ONBLUR 15
+#define DISPID_ONREADYSTATECHANGE 16
diff --git a/include/dhtmled.idl b/include/dhtmled.idl
new file mode 100644
index 0000000000..ce65fb98d2
--- /dev/null
+++ b/include/dhtmled.idl
@@ -0,0 +1,718 @@
+/*
+ * Copyright 2017 Alex Henrie
+ *
+ * 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
+ */
+
+import "oaidl.idl";
+import "ocidl.idl";
+import "docobj.idl";
+import "mshtml.idl";
+
+#include "dhtmldid.h"
+
+[
+ uuid(683364a1-b37d-11d1-adc5-006008a5848c),
+ version(1.0)
+]
+library DHTMLEDLib
+{
+ importlib("stdole2.tlb");
+
+ typedef
+ [
+ uuid(7179FC44-B2E4-11d1-ADC5-006008A5848C)
+ ]
+ enum DHTMLEDITAPPEARANCE {
+ DEAPPEARANCE_FLAT,
+ DEAPPEARANCE_3D
+ } DHTMLEDITAPPEARANCE;
+
+ typedef
+ [
+ uuid(bf82426a-b961-11d1-adc5-006008a5848c)
+ ]
+ enum DHTMLEDITCMDF {
+ DECMDF_NOTSUPPORTED = 0,
+ DECMDF_DISABLED = 1,
+ DECMDF_ENABLED = 3,
+ DECMDF_LATCHED = 7,
+ DECMDF_NINCHED = 11
+ } DHTMLEDITCMDF;
+
+ typedef enum DHTMLEDITCMDID {
+ DECMD_BOLD = 5000,
+ DECMD_COPY = 5002,
+ DECMD_CUT,
+ DECMD_DELETE,
+ DECMD_DELETECELLS,
+ DECMD_DELETECOLS,
+ DECMD_DELETEROWS,
+ DECMD_FINDTEXT,
+ DECMD_FONT,
+ DECMD_GETBACKCOLOR,
+ DECMD_GETBLOCKFMT,
+ DECMD_GETBLOCKFMTNAMES,
+ DECMD_GETFONTNAME,
+ DECMD_GETFONTSIZE,
+ DECMD_GETFORECOLOR,
+ DECMD_HYPERLINK,
+ DECMD_IMAGE,
+ DECMD_INDENT,
+ DECMD_INSERTCELL,
+ DECMD_INSERTCOL,
+ DECMD_INSERTROW,
+ DECMD_INSERTTABLE,
+ DECMD_ITALIC,
+ DECMD_JUSTIFYCENTER,
+ DECMD_JUSTIFYLEFT,
+ DECMD_JUSTIFYRIGHT,
+ DECMD_LOCK_ELEMENT,
+ DECMD_MAKE_ABSOLUTE,
+ DECMD_MERGECELLS,
+ DECMD_ORDERLIST,
+ DECMD_OUTDENT,
+ DECMD_PASTE,
+ DECMD_REDO,
+ DECMD_REMOVEFORMAT,
+ DECMD_SELECTALL,
+ DECMD_SEND_BACKWARD,
+ DECMD_BRING_FORWARD,
+ DECMD_SEND_BELOW_TEXT,
+ DECMD_BRING_ABOVE_TEXT,
+ DECMD_SEND_TO_BACK,
+ DECMD_BRING_TO_FRONT,
+ DECMD_SETBACKCOLOR,
+ DECMD_SETBLOCKFMT,
+ DECMD_SETFONTNAME,
+ DECMD_SETFONTSIZE,
+ DECMD_SETFORECOLOR,
+ DECMD_SPLITCELL,
+ DECMD_UNDERLINE,
+ DECMD_UNDO,
+ DECMD_UNLINK,
+ DECMD_UNORDERLIST,
+ DECMD_PROPERTIES
+ } DHTMLEDITCMDID;
+
+ [
+ object,
+ uuid(ce04b590-2b1f-11d2-8d1e-00a0c959bc0a),
+ dual,
+ pointer_default(unique)
+ ]
+ interface IDHTMLSafe : IDispatch
+ {
+ [
+ id(DISPID_EXECCOMMAND)
+ ]
+ HRESULT ExecCommand(
+ [in] DHTMLEDITCMDID cmd_id,
+ [in, defaultvalue(OLECMDEXECOPT_DODEFAULT)] OLECMDEXECOPT options,
+ [in, optional] VARIANT *code_in,
+ [out, retval] VARIANT *code_out
+ );
+
+ [
+ id(DISPID_QUERYSTATUS)
+ ]
+ HRESULT QueryStatus(
+ [in] DHTMLEDITCMDID cmd_id,
+ [out, retval] DHTMLEDITCMDF *status
+ );
+
+ [
+ id(DISPID_SETCONTEXTMENU)
+ ]
+ HRESULT SetContextMenu(
+ [in] VARIANT *strings,
+ [in] VARIANT *states
+ );
+
+ [
+ id(DISPID_NEWDOCUMENT)
+ ]
+ HRESULT NewDocument();
+
+ [
+ id(DISPID_LOADURL)
+ ]
+ HRESULT LoadURL(
+ [in] BSTR url
+ );
+
+ [
+ id(DISPID_FILTERSRCCODE)
+ ]
+ HRESULT FilterSourceCode(
+ [in] BSTR in,
+ [out, retval] BSTR *out
+ );
+
+ [
+ id(DISPID_REFRESHDOC)
+ ]
+ HRESULT Refresh();
+
+ [
+ propget,
+ id(DISPID_DOCUMENT)
+ ]
+ HRESULT DOM(
+ [out, retval] IHTMLDocument2 **value
+ );
+
+ [
+ propget,
+ id(DISPID_DOCUMENTHTML)
+ ]
+ HRESULT DocumentHTML(
+ [out, retval] BSTR *value
+ );
+
+ [
+ propput,
+ id(DISPID_DOCUMENTHTML)
+ ]
+ HRESULT DocumentHTML(
+ [in] BSTR html
+ );
+
+ [
+ propget,
+ id(DISPID_ACTIVATEAPPLETS)
+ ]
+ HRESULT ActivateApplets(
+ [out, retval] VARIANT_BOOL *value
+ );
+
+ [
+ propput,
+ id(DISPID_ACTIVATEAPPLETS)
+ ]
+ HRESULT ActivateApplets(
+ [in] VARIANT_BOOL value
+ );
+
+ [
+ propget,
+ id(DISPID_ACTIVATEACTIVEXCONTROLS)
+ ]
+ HRESULT ActivateActiveXControls(
+ [out, retval] VARIANT_BOOL *value
+ );
+
+ [
+ propput,
+ id(DISPID_ACTIVATEACTIVEXCONTROLS)
+ ]
+ HRESULT ActivateActiveXControls(
+ [in] VARIANT_BOOL value
+ );
+
+ [
+ propget,
+ id(DISPID_ACTIVATEDTCS)
+ ]
+ HRESULT ActivateDTCs(
+ [out, retval] VARIANT_BOOL *value
+ );
+
+ [
+ propput,
+ id(DISPID_ACTIVATEDTCS)
+ ]
+ HRESULT ActivateDTCs(
+ [in] VARIANT_BOOL value
+ );
+
+ [
+ propget,
+ id(DISPID_SHOWDETAILS)
+ ]
+ HRESULT ShowDetails(
+ [out, retval] VARIANT_BOOL *value
+ );
+
+ [
+ propput,
+ id(DISPID_SHOWDETAILS)
+ ]
+ HRESULT ShowDetails(
+ [in] VARIANT_BOOL value
+ );
+
+ [
+ propget,
+ id(DISPID_SHOWBORDERS)
+ ]
+ HRESULT ShowBorders(
+ [out, retval] VARIANT_BOOL *value
+ );
+
+ [
+ propput,
+ id(DISPID_SHOWBORDERS)
+ ]
+ HRESULT ShowBorders(
+ [in] VARIANT_BOOL value
+ );
+
+ [
+ propget,
+ id(DISPID_DHTMLEDITAPPEARANCE)
+ ]
+ HRESULT Appearance(
+ [out, retval] DHTMLEDITAPPEARANCE *value
+ );
+
+ [
+ propput,
+ id(DISPID_DHTMLEDITAPPEARANCE)
+ ]
+ HRESULT Appearance(
+ [in] DHTMLEDITAPPEARANCE value
+ );
+
+ [
+ propget,
+ id(DISPID_DHTMLEDITSCROLLBARS)
+ ]
+ HRESULT Scrollbars(
+ [out, retval] VARIANT_BOOL *value
+ );
+
+ [
+ propput,
+ id(DISPID_DHTMLEDITSCROLLBARS)
+ ]
+ HRESULT Scrollbars(
+ [in] VARIANT_BOOL value
+ );
+
+ [
+ propget,
+ id(DISPID_SCROLLBARAPPEARANCE)
+ ]
+ HRESULT ScrollbarAppearance(
+ [out, retval] DHTMLEDITAPPEARANCE *value
+ );
+
+ [
+ propput,
+ id(DISPID_SCROLLBARAPPEARANCE)
+ ]
+ HRESULT ScrollbarAppearance(
+ [in] DHTMLEDITAPPEARANCE value
+ );
+
+ [
+ propget,
+ id(DISPID_SOURCECODEPRESERVATION)
+ ]
+ HRESULT SourceCodePreservation(
+ [out, retval] VARIANT_BOOL *value
+ );
+
+ [
+ propput,
+ id(DISPID_SOURCECODEPRESERVATION)
+ ]
+ HRESULT SourceCodePreservation(
+ [in] VARIANT_BOOL value
+ );
+
+ [
+ propget,
+ id(DISPID_ABSOLUTEDROPMODE)
+ ]
+ HRESULT AbsoluteDropMode(
+ [out, retval] VARIANT_BOOL *value
+ );
+
+ [
+ propput,
+ id(DISPID_ABSOLUTEDROPMODE)
+ ]
+ HRESULT AbsoluteDropMode(
+ [in] VARIANT_BOOL value
+ );
+
+ [
+ propget,
+ id(DISPID_SNAPTOGRIDX)
+ ]
+ HRESULT SnapToGridX(
+ [out, retval] long *value
+ );
+
+ [
+ propput,
+ id(DISPID_SNAPTOGRIDX)
+ ]
+ HRESULT SnapToGridX(
+ [in] long value
+ );
+
+ [
+ propget,
+ id(DISPID_SNAPTOGRIDY)
+ ]
+ HRESULT SnapToGridY(
+ [out, retval] long *value
+ );
+
+ [
+ propput,
+ id(DISPID_SNAPTOGRIDY)
+ ]
+ HRESULT SnapToGridY(
+ [in] long value
+ );
+
+ [
+ propget,
+ id(DISPID_SNAPTOGRID)
+ ]
+ HRESULT SnapToGrid(
+ [out, retval] VARIANT_BOOL *value
+ );
+
+ [
+ propput,
+ id(DISPID_SNAPTOGRID)
+ ]
+ HRESULT SnapToGrid(
+ [in] VARIANT_BOOL value
+ );
+
+ [
+ propget,
+ id(DISPID_ISDIRTY)
+ ]
+ HRESULT IsDirty(
+ [out, retval] VARIANT_BOOL *value
+ );
+
+ [
+ propget,
+ id(DISPID_CURRENTDOCUMENTPATH)
+ ]
+ HRESULT CurrentDocumentPath(
+ [out, retval] BSTR *value
+ );
+
+ [
+ propget,
+ id(DISPID_BASEURL)
+ ]
+ HRESULT BaseURL(
+ [out, retval] BSTR *value
+ );
+
+ [
+ propput,
+ id(DISPID_BASEURL)
+ ]
+ HRESULT BaseURL(
+ [in] BSTR value
+ );
+
+ [
+ propget,
+ id(DISPID_DOCUMENTTITLE)
+ ]
+ HRESULT DocumentTitle(
+ [out, retval] BSTR *value
+ );
+
+ [
+ propget,
+ id(DISPID_USEDIVONCR)
+ ]
+ HRESULT UseDivOnCarriageReturn(
+ [out, retval] VARIANT_BOOL *value
+ );
+
+ [
+ propput,
+ id(DISPID_USEDIVONCR)
+ ]
+ HRESULT UseDivOnCarriageReturn(
+ [in] VARIANT_BOOL value
+ );
+
+ [
+ propget,
+ id(DISPID_BUSY)
+ ]
+ HRESULT Busy(
+ [out, retval] VARIANT_BOOL *value
+ );
+ };
+
+ [
+ uuid(d1fc78e8-b380-11d1-adc5-006008a5848c)
+ ]
+ dispinterface _DHTMLSafeEvents
+ {
+ properties:
+ methods:
+ [
+ id(DISPID_DOCUMENTCOMPLETE)
+ ]
+ void DocumentComplete();
+
+ [
+ id(DISPID_DISPLAYCHANGED)
+ ]
+ void DisplayChanged();
+
+ [
+ id(DISPID_SHOWCONTEXTMENU)
+ ]
+ void ShowContextMenu(
+ [in] long x,
+ [in] long y
+ );
+
+ [
+ id(DISPID_CONTEXTMENUACTION)
+ ]
+ void ContextMenuAction(
+ [in] long index
+ );
+
+ [
+ id(DISPID_ONMOUSEDOWN)
+ ]
+ void onmousedown();
+
+ [
+ id(DISPID_ONMOUSEMOVE)
+ ]
+ void onmousemove();
+
+ [
+ id(DISPID_ONMOUSEUP)
+ ]
+ void onmouseup();
+
+ [
+ id(DISPID_ONMOUSEOUT)
+ ]
+ void onmouseout();
+
+ [
+ id(DISPID_ONMOUSEOVER)
+ ]
+ void onmouseover();
+
+ [
+ id(DISPID_ONCLICK)
+ ]
+ void onclick();
+
+ [
+ id(DISPID_ONDBLCLICK)
+ ]
+ void ondblclick();
+
+ [
+ id(DISPID_ONKEYDOWN)
+ ]
+ void onkeydown();
+
+ [
+ id(DISPID_ONKEYPRESS)
+ ]
+ void onkeypress();
+
+ [
+ id(DISPID_ONKEYUP)
+ ]
+ void onkeyup();
+
+ [
+ id(DISPID_ONBLUR)
+ ]
+ void onblur();
+
+ [
+ id(DISPID_ONREADYSTATECHANGE)
+ ]
+ void onreadystatechange();
+ };
+
+ [
+ uuid(2d360201-fff5-11d1-8d03-00a0c959bc0a),
+ threading(apartment)
+ ]
+ coclass DHTMLSafe
+ {
+ [default] interface IDHTMLSafe;
+ [default, source] interface _DHTMLSafeEvents;
+ };
+
+ [
+ uuid(ce04b591-2b1f-11d2-8d1e-00a0c959bc0a),
+ dual,
+ pointer_default(unique)
+ ]
+ interface IDHTMLEdit : IDHTMLSafe
+ {
+ [
+ id(DISPID_LOADDOCUMENT)
+ ]
+ HRESULT LoadDocument(
+ [in] VARIANT *path,
+ [in, optional] VARIANT *prompt
+ );
+
+ [
+ id(DISPID_SAVEDOCUMENT)
+ ]
+ HRESULT SaveDocument(
+ [in] VARIANT *path,
+ [in, optional] VARIANT *prompt
+ );
+
+ [
+ id(DISPID_PRINT)
+ ]
+ HRESULT PrintDocument(
+ [in, optional] VARIANT *prompt
+ );
+
+ [
+ propget,
+ id(DISPID_BROWSEMODE)
+ ]
+ HRESULT BrowseMode(
+ [out, retval] VARIANT_BOOL *value
+ );
+
+ [
+ propput,
+ id(DISPID_BROWSEMODE)
+ ]
+ HRESULT BrowseMode(
+ [in] VARIANT_BOOL value
+ );
+ };
+
+ [
+ uuid(588d5040-cf28-11d1-8cd3-00a0c959bc0a)
+ ]
+ dispinterface _DHTMLEditEvents
+ {
+ properties:
+ methods:
+ [
+ id(DISPID_DOCUMENTCOMPLETE)
+ ]
+ void DocumentComplete();
+
+ [
+ id(DISPID_DISPLAYCHANGED)
+ ]
+ void DisplayChanged();
+
+ [
+ id(DISPID_SHOWCONTEXTMENU)
+ ]
+ void ShowContextMenu(
+ [in] long x,
+ [in] long y
+ );
+
+ [
+ id(DISPID_CONTEXTMENUACTION)
+ ]
+ void ContextMenuAction(
+ [in] long index
+ );
+
+ [
+ id(DISPID_ONMOUSEDOWN)
+ ]
+ void onmousedown();
+
+ [
+ id(DISPID_ONMOUSEMOVE)
+ ]
+ void onmousemove();
+
+ [
+ id(DISPID_ONMOUSEUP)
+ ]
+ void onmouseup();
+
+ [
+ id(DISPID_ONMOUSEOUT)
+ ]
+ void onmouseout();
+
+ [
+ id(DISPID_ONMOUSEOVER)
+ ]
+ void onmouseover();
+
+ [
+ id(DISPID_ONCLICK)
+ ]
+ void onclick();
+
+ [
+ id(DISPID_ONDBLCLICK)
+ ]
+ void ondblclick();
+
+ [
+ id(DISPID_ONKEYDOWN)
+ ]
+ void onkeydown();
+
+ [
+ id(DISPID_ONKEYPRESS)
+ ]
+ void onkeypress();
+
+ [
+ id(DISPID_ONKEYUP)
+ ]
+ void onkeyup();
+
+ [
+ id(DISPID_ONBLUR)
+ ]
+ void onblur();
+
+ [
+ id(DISPID_ONREADYSTATECHANGE)
+ ]
+ void onreadystatechange();
+ };
+
+ [
+ uuid(2d360200-fff5-11d1-8d03-00a0c959bc0a),
+ threading(apartment)
+ ]
+ coclass DHTMLEdit
+ {
+ [default] interface IDHTMLEdit;
+ [default, source] interface _DHTMLEditEvents;
+ };
+}
--
2.15.1
2
1
[PATCH] wined3d: Avoid calling removed/deprecated GL functions in SetupForBlit().
by Józef Kucia 08 Dec '17
by Józef Kucia 08 Dec '17
08 Dec '17
Eliminates possible GL errors when core contexts are used.
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
dlls/wined3d/context.c | 139 ++++++++++++++++++++++++++-----------------------
1 file changed, 74 insertions(+), 65 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 23f63aacda21..2e12d7521363 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -2323,10 +2323,13 @@ static void set_blit_dimension(const struct wined3d_gl_info *gl_info, UINT width
-1.0, -1.0, -1.0, 1.0,
};
- gl_info->gl_ops.gl.p_glMatrixMode(GL_PROJECTION);
- checkGLcall("glMatrixMode(GL_PROJECTION)");
- gl_info->gl_ops.gl.p_glLoadMatrixd(projection);
- checkGLcall("glLoadMatrixd");
+ if (gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
+ {
+ gl_info->gl_ops.gl.p_glMatrixMode(GL_PROJECTION);
+ checkGLcall("glMatrixMode(GL_PROJECTION)");
+ gl_info->gl_ops.gl.p_glLoadMatrixd(projection);
+ checkGLcall("glLoadMatrixd");
+ }
gl_info->gl_ops.gl.p_glViewport(0, 0, width, height);
checkGLcall("glViewport");
}
@@ -2398,10 +2401,10 @@ void context_enable_clip_distances(struct wined3d_context *context, unsigned int
/* Context activation is done by the caller. */
static void SetupForBlit(const struct wined3d_device *device, struct wined3d_context *context)
{
- int i;
const struct wined3d_gl_info *gl_info = context->gl_info;
DWORD sampler;
SIZE rt_size;
+ int i;
TRACE("Setting up context %p for blitting\n", context);
@@ -2422,17 +2425,46 @@ static void SetupForBlit(const struct wined3d_device *device, struct wined3d_con
}
context->last_was_blit = TRUE;
- /* Disable all textures. The caller can then bind a texture it wants to blit
- * from
- *
- * The blitting code uses (for now) the fixed function pipeline, so make sure to reset all fixed
- * function texture unit. No need to care for higher samplers
- */
- for (i = gl_info->limits.textures - 1; i > 0 ; --i)
+ if (gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
{
- sampler = context->rev_tex_unit_map[i];
- context_active_texture(context, gl_info, i);
+ /* Disable all textures. The caller can then bind a texture it wants to blit
+ * from
+ *
+ * The blitting code uses (for now) the fixed function pipeline, so make sure to reset all fixed
+ * function texture unit. No need to care for higher samplers
+ */
+ for (i = gl_info->limits.textures - 1; i > 0 ; --i)
+ {
+ sampler = context->rev_tex_unit_map[i];
+ context_active_texture(context, gl_info, i);
+ if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
+ {
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
+ checkGLcall("glDisable GL_TEXTURE_CUBE_MAP_ARB");
+ }
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
+ checkGLcall("glDisable GL_TEXTURE_3D");
+ if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
+ {
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
+ checkGLcall("glDisable GL_TEXTURE_RECTANGLE_ARB");
+ }
+ gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
+ checkGLcall("glDisable GL_TEXTURE_2D");
+
+ gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+ checkGLcall("glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);");
+
+ if (sampler != WINED3D_UNMAPPED_STAGE)
+ {
+ if (sampler < MAX_TEXTURES)
+ context_invalidate_state(context, STATE_TEXTURESTAGE(sampler, WINED3D_TSS_COLOR_OP));
+ context_invalidate_state(context, STATE_SAMPLER(sampler));
+ }
+ }
+
+ context_active_texture(context, gl_info, 0);
if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
{
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
@@ -2449,50 +2481,43 @@ static void SetupForBlit(const struct wined3d_device *device, struct wined3d_con
checkGLcall("glDisable GL_TEXTURE_2D");
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- checkGLcall("glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);");
- if (sampler != WINED3D_UNMAPPED_STAGE)
+ gl_info->gl_ops.gl.p_glMatrixMode(GL_TEXTURE);
+ checkGLcall("glMatrixMode(GL_TEXTURE)");
+ gl_info->gl_ops.gl.p_glLoadIdentity();
+ checkGLcall("glLoadIdentity()");
+
+ if (gl_info->supported[EXT_TEXTURE_LOD_BIAS])
{
- if (sampler < MAX_TEXTURES)
- context_invalidate_state(context, STATE_TEXTURESTAGE(sampler, WINED3D_TSS_COLOR_OP));
- context_invalidate_state(context, STATE_SAMPLER(sampler));
+ gl_info->gl_ops.gl.p_glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT,
+ GL_TEXTURE_LOD_BIAS_EXT, 0.0f);
+ checkGLcall("glTexEnvf GL_TEXTURE_LOD_BIAS_EXT ...");
}
+
+ /* Setup transforms */
+ gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
+ checkGLcall("glMatrixMode(GL_MODELVIEW)");
+ gl_info->gl_ops.gl.p_glLoadIdentity();
+ checkGLcall("glLoadIdentity()");
+ context_invalidate_state(context, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0)));
+
+ /* Other misc states */
+ gl_info->gl_ops.gl.p_glDisable(GL_ALPHA_TEST);
+ checkGLcall("glDisable(GL_ALPHA_TEST)");
+ context_invalidate_state(context, STATE_RENDER(WINED3D_RS_ALPHATESTENABLE));
+ gl_info->gl_ops.gl.p_glDisable(GL_LIGHTING);
+ checkGLcall("glDisable GL_LIGHTING");
+ context_invalidate_state(context, STATE_RENDER(WINED3D_RS_LIGHTING));
+ glDisableWINE(GL_FOG);
+ checkGLcall("glDisable GL_FOG");
+ context_invalidate_state(context, STATE_RENDER(WINED3D_RS_FOGENABLE));
}
+
if (gl_info->supported[ARB_SAMPLER_OBJECTS])
GL_EXTCALL(glBindSampler(0, 0));
context_active_texture(context, gl_info, 0);
sampler = context->rev_tex_unit_map[0];
-
- if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
- {
- gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
- checkGLcall("glDisable GL_TEXTURE_CUBE_MAP_ARB");
- }
- gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
- checkGLcall("glDisable GL_TEXTURE_3D");
- if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
- {
- gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
- checkGLcall("glDisable GL_TEXTURE_RECTANGLE_ARB");
- }
- gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
- checkGLcall("glDisable GL_TEXTURE_2D");
-
- gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
- gl_info->gl_ops.gl.p_glMatrixMode(GL_TEXTURE);
- checkGLcall("glMatrixMode(GL_TEXTURE)");
- gl_info->gl_ops.gl.p_glLoadIdentity();
- checkGLcall("glLoadIdentity()");
-
- if (gl_info->supported[EXT_TEXTURE_LOD_BIAS])
- {
- gl_info->gl_ops.gl.p_glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT,
- GL_TEXTURE_LOD_BIAS_EXT, 0.0f);
- checkGLcall("glTexEnvf GL_TEXTURE_LOD_BIAS_EXT ...");
- }
-
if (sampler != WINED3D_UNMAPPED_STAGE)
{
if (sampler < MAX_TEXTURES)
@@ -2504,18 +2529,9 @@ static void SetupForBlit(const struct wined3d_device *device, struct wined3d_con
}
/* Other misc states */
- gl_info->gl_ops.gl.p_glDisable(GL_ALPHA_TEST);
- checkGLcall("glDisable(GL_ALPHA_TEST)");
- context_invalidate_state(context, STATE_RENDER(WINED3D_RS_ALPHATESTENABLE));
- gl_info->gl_ops.gl.p_glDisable(GL_LIGHTING);
- checkGLcall("glDisable GL_LIGHTING");
- context_invalidate_state(context, STATE_RENDER(WINED3D_RS_LIGHTING));
gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_TEST);
checkGLcall("glDisable GL_DEPTH_TEST");
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_ZENABLE));
- glDisableWINE(GL_FOG);
- checkGLcall("glDisable GL_FOG");
- context_invalidate_state(context, STATE_RENDER(WINED3D_RS_FOGENABLE));
gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
checkGLcall("glDisable GL_BLEND");
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE));
@@ -2547,13 +2563,6 @@ static void SetupForBlit(const struct wined3d_device *device, struct wined3d_con
checkGLcall("glDisable(GL_COLOR_SUM_EXT)");
}
- /* Setup transforms */
- gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
- checkGLcall("glMatrixMode(GL_MODELVIEW)");
- gl_info->gl_ops.gl.p_glLoadIdentity();
- checkGLcall("glLoadIdentity()");
- context_invalidate_state(context, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0)));
-
context->last_was_rhw = TRUE;
context_invalidate_state(context, STATE_VDECL); /* because of last_was_rhw = TRUE */
--
2.13.6
4
4
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
Version 2:
* Use int for signed integers
* Remove sqrtf(m *m)
* Increase tolerance for floating-point slope scaled depth bias test to 140
---
dlls/d3d11/tests/d3d11.c | 315 ++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 298 insertions(+), 17 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 7d317dc1817c..bf62b48b8730 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -19,12 +19,13 @@
#include <assert.h>
#include <float.h>
+#include <limits.h>
+#include <math.h>
#include <stdlib.h>
#define COBJMACROS
#include "initguid.h"
#include "d3d11_1.h"
#include "wine/test.h"
-#include <limits.h>
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
@@ -1247,14 +1248,14 @@ static void draw_quad_vs(unsigned int line, struct d3d11_test_context *context,
{
static const D3D11_INPUT_ELEMENT_DESC default_layout_desc[] =
{
- {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
+ {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
};
- static const struct vec2 quad[] =
+ static const struct vec3 quad[] =
{
- {-1.0f, -1.0f},
- {-1.0f, 1.0f},
- { 1.0f, -1.0f},
- { 1.0f, 1.0f},
+ {-1.0f, -1.0f, 0.0f},
+ {-1.0f, 1.0f, 0.0f},
+ { 1.0f, -1.0f, 0.0f},
+ { 1.0f, 1.0f, 0.0f},
};
ID3D11Device *device = context->device;
@@ -15235,12 +15236,12 @@ static void test_face_culling(void)
0x00000000, 0x3f800000, 0x00000000, 0x3f800000, 0x00004002, 0x00000000, 0x00000000, 0x3f800000,
0x3f800000, 0x0100003e,
};
- static const struct vec2 ccw_quad[] =
+ static const struct vec3 ccw_quad[] =
{
- {-1.0f, 1.0f},
- {-1.0f, -1.0f},
- { 1.0f, 1.0f},
- { 1.0f, -1.0f},
+ {-1.0f, 1.0f, 0.0f},
+ {-1.0f, -1.0f, 0.0f},
+ { 1.0f, 1.0f, 0.0f},
+ { 1.0f, -1.0f, 0.0f},
};
static const struct
{
@@ -16115,12 +16116,12 @@ static void test_stencil_separate(void)
static const float red[] = {1.0f, 0.0f, 0.0f, 1.0f};
static const struct vec4 green = {0.0f, 1.0f, 0.0f, 1.0f};
- static const struct vec2 ccw_quad[] =
+ static const struct vec3 ccw_quad[] =
{
- {-1.0f, -1.0f},
- { 1.0f, -1.0f},
- {-1.0f, 1.0f},
- { 1.0f, 1.0f},
+ {-1.0f, -1.0f, 0.0f},
+ { 1.0f, -1.0f, 0.0f},
+ {-1.0f, 1.0f, 0.0f},
+ { 1.0f, 1.0f, 0.0f},
};
if (!init_test_context(&test_context, NULL))
@@ -22134,6 +22135,285 @@ static void test_gather_c(void)
release_test_context(&test_context);
}
+static void test_depth_bias(void)
+{
+ struct vec3 vertices[] =
+ {
+ {-1.0f, -1.0f, 0.5f},
+ {-1.0f, 1.0f, 0.5f},
+ { 1.0f, -1.0f, 0.5f},
+ { 1.0f, 1.0f, 0.5f},
+ };
+ struct d3d11_test_context test_context;
+ D3D11_RASTERIZER_DESC rasterizer_desc;
+ D3D11_TEXTURE2D_DESC texture_desc;
+ double m, r, bias, depth, data;
+ ID3D11DeviceContext *context;
+ struct resource_readback rb;
+ ID3D11DepthStencilView *dsv;
+ unsigned int expected_value;
+ ID3D11RasterizerState *rs;
+ ID3D11Texture2D *texture;
+ float depth_values[480];
+ unsigned int format_idx;
+ unsigned int x, y, i, j;
+ unsigned int shift = 0;
+ ID3D11Device *device;
+ DXGI_FORMAT format;
+ const UINT32 *u32;
+ const UINT16 *u16;
+ UINT32 u32_value;
+ HRESULT hr;
+
+ static const struct
+ {
+ float z;
+ float exponent;
+ }
+ quads[] =
+ {
+ {0.125f, -3.0f},
+ {0.250f, -2.0f},
+ {0.500f, -1.0f},
+ {1.000f, 0.0f},
+ };
+ static const int bias_tests[] =
+ {
+ -10000, -1000, -100, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1,
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 50, 100, 200, 500, 1000, 10000,
+ };
+ static const float quad_slopes[] =
+ {
+ 0.0f, 0.5f, 1.0f
+ };
+ static const float slope_scaled_bias_tests[] =
+ {
+ 0.0f, 0.5f, 1.0f, 2.0f, 128.0f, 1000.0f, 10000.0f,
+ };
+ static const DXGI_FORMAT formats[] =
+ {
+ DXGI_FORMAT_D32_FLOAT,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_D16_UNORM,
+ };
+
+ if (!init_test_context(&test_context, NULL))
+ return;
+
+ device = test_context.device;
+ context = test_context.immediate_context;
+
+ memset(&rasterizer_desc, 0, sizeof(rasterizer_desc));
+ rasterizer_desc.FillMode = D3D11_FILL_SOLID;
+ rasterizer_desc.CullMode = D3D11_CULL_NONE;
+ rasterizer_desc.FrontCounterClockwise = FALSE;
+ rasterizer_desc.DepthBias = 0;
+ rasterizer_desc.DepthBiasClamp = 0.0f;
+ rasterizer_desc.SlopeScaledDepthBias = 0.0f;
+ rasterizer_desc.DepthClipEnable = TRUE;
+
+ for (format_idx = 0; format_idx < ARRAY_SIZE(formats); ++format_idx)
+ {
+ format = formats[format_idx];
+
+ ID3D11Texture2D_GetDesc(test_context.backbuffer, &texture_desc);
+ texture_desc.Format = format;
+ texture_desc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
+ hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, &texture);
+ ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
+ hr = ID3D11Device_CreateDepthStencilView(device, (ID3D11Resource *)texture, NULL, &dsv);
+ ok(SUCCEEDED(hr), "Failed to create render depth stencil view, hr %#x.\n", hr);
+ ID3D11DeviceContext_OMSetRenderTargets(context, 1, &test_context.backbuffer_rtv, dsv);
+ ID3D11DeviceContext_ClearDepthStencilView(context, dsv, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0);
+ draw_quad(&test_context);
+ switch (format)
+ {
+ case DXGI_FORMAT_D32_FLOAT:
+ check_texture_float(texture, 0.0f, 0);
+ break;
+ case DXGI_FORMAT_D24_UNORM_S8_UINT:
+ /* FIXME: Depth/stencil byte order is reversed in wined3d. */
+ shift = get_texture_color(texture, 0, 0) == 0xffffff ? 0 : 8;
+ todo_wine
+ check_texture_color(texture, 0xffffff, 1);
+ break;
+ case DXGI_FORMAT_D16_UNORM:
+ get_texture_readback(texture, 0, &rb);
+ for (y = 0; y < texture_desc.Height; ++y)
+ {
+ for (x = 0; x < texture_desc.Width; ++x)
+ {
+ u16 = get_readback_data(&rb, x, y, sizeof(*u16));
+ ok(*u16 == 0xffff, "Got unexpected value %#x.\n", *u16);
+ }
+ }
+ release_resource_readback(&rb);
+ break;
+ default:
+ trace("Unhandled format %#x.\n", format);
+ break;
+ }
+
+ /* DepthBias */
+ for (i = 0; i < ARRAY_SIZE(quads); ++i)
+ {
+ for (j = 0; j < ARRAY_SIZE(vertices); ++j)
+ vertices[j].z = quads[i].z;
+ ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)test_context.vb,
+ 0, NULL, vertices, 0, 0);
+
+ for (j = 0; j < ARRAY_SIZE(bias_tests); ++j)
+ {
+ rasterizer_desc.DepthBias = bias_tests[j];
+ ID3D11Device_CreateRasterizerState(device, &rasterizer_desc, &rs);
+ ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#x.\n", hr);
+ ID3D11DeviceContext_RSSetState(context, rs);
+ ID3D11DeviceContext_ClearDepthStencilView(context, dsv, D3D11_CLEAR_DEPTH, 1.0f, 0);
+ draw_quad(&test_context);
+ switch (format)
+ {
+ case DXGI_FORMAT_D32_FLOAT:
+ bias = rasterizer_desc.DepthBias * pow(2.0f, quads[i].exponent - 23.0f);
+ depth = min(max(0.0f, quads[i].z + bias), 1.0f);
+
+ check_texture_float(texture, depth, 2);
+ break;
+ case DXGI_FORMAT_D24_UNORM_S8_UINT:
+ r = 1.0f / 16777215.0f;
+ bias = rasterizer_desc.DepthBias * r;
+ depth = min(max(0.0f, quads[i].z + bias), 1.0f);
+
+ get_texture_readback(texture, 0, &rb);
+ for (y = 0; y < texture_desc.Height; ++y)
+ {
+ expected_value = depth * 16777215.0f + 0.5f;
+ for (x = 0; x < texture_desc.Width; ++x)
+ {
+ u32 = get_readback_data(&rb, x, y, sizeof(*u32));
+ u32_value = *u32 >> shift;
+ ok(abs(u32_value - expected_value) <= 1,
+ "Got value %#x (%.8e), expected %#x (%.8e).\n",
+ u32_value, u32_value / 16777215.0f,
+ expected_value, expected_value / 16777215.0f);
+ }
+ }
+ release_resource_readback(&rb);
+ break;
+ case DXGI_FORMAT_D16_UNORM:
+ r = 1.0f / 65535.0f;
+ bias = rasterizer_desc.DepthBias * r;
+ depth = min(max(0.0f, quads[i].z + bias), 1.0f);
+
+ get_texture_readback(texture, 0, &rb);
+ for (y = 0; y < texture_desc.Height; ++y)
+ {
+ expected_value = depth * 65535.0f + 0.5f;
+ for (x = 0; x < texture_desc.Width; ++x)
+ {
+ u16 = get_readback_data(&rb, x, y, sizeof(*u16));
+ ok(abs(*u16 - expected_value) <= 1,
+ "Got value %#x (%.8e), expected %#x (%.8e).\n",
+ *u16, *u16 / 65535.0f, expected_value, expected_value / 65535.0f);
+ }
+ }
+ release_resource_readback(&rb);
+ break;
+ default:
+ break;
+ }
+ ID3D11RasterizerState_Release(rs);
+ }
+ }
+
+ /* SlopeScaledDepthBias */
+ rasterizer_desc.DepthBias = 0;
+ for (i = 0; i < ARRAY_SIZE(quad_slopes); ++i)
+ {
+ for (j = 0; j < ARRAY_SIZE(vertices); ++j)
+ vertices[j].z = j == 1 || j == 3 ? 0.0f : quad_slopes[i];
+ ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)test_context.vb,
+ 0, NULL, vertices, 0, 0);
+
+ ID3D11DeviceContext_RSSetState(context, NULL);
+ ID3D11DeviceContext_ClearDepthStencilView(context, dsv, D3D11_CLEAR_DEPTH, 1.0f, 0);
+ draw_quad(&test_context);
+ get_texture_readback(texture, 0, &rb);
+ for (y = 0; y < texture_desc.Height; ++y)
+ {
+ switch (format)
+ {
+ case DXGI_FORMAT_D32_FLOAT:
+ depth_values[y] = get_readback_float(&rb, 0, y);
+ break;
+ case DXGI_FORMAT_D24_UNORM_S8_UINT:
+ u32 = get_readback_data(&rb, 0, y, sizeof(*u32));
+ u32_value = *u32 >> shift;
+ depth_values[y] = u32_value / 16777215.0f;
+ break;
+ case DXGI_FORMAT_D16_UNORM:
+ u16 = get_readback_data(&rb, 0, y, sizeof(*u16));
+ depth_values[y] = *u16 / 65535.0f;
+ break;
+ default:
+ break;
+ }
+ }
+ release_resource_readback(&rb);
+
+ for (j = 0; j < ARRAY_SIZE(slope_scaled_bias_tests); ++j)
+ {
+ rasterizer_desc.SlopeScaledDepthBias = slope_scaled_bias_tests[j];
+ ID3D11Device_CreateRasterizerState(device, &rasterizer_desc, &rs);
+ ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#x.\n", hr);
+ ID3D11DeviceContext_RSSetState(context, rs);
+ ID3D11DeviceContext_ClearDepthStencilView(context, dsv, D3D11_CLEAR_DEPTH, 1.0f, 0);
+ draw_quad(&test_context);
+
+ m = quad_slopes[i] / texture_desc.Height;
+ bias = rasterizer_desc.SlopeScaledDepthBias * m;
+ get_texture_readback(texture, 0, &rb);
+ for (y = 0; y < texture_desc.Height; ++y)
+ {
+ depth = min(max(0.0f, depth_values[y] + bias), 1.0f);
+ switch (format)
+ {
+ case DXGI_FORMAT_D32_FLOAT:
+ data = get_readback_float(&rb, 0, y);
+ ok(compare_float(data, depth, 140),
+ "Got depth %.8e, expected %.8e.\n", data, depth);
+ break;
+ case DXGI_FORMAT_D24_UNORM_S8_UINT:
+ u32 = get_readback_data(&rb, 0, y, sizeof(*u32));
+ u32_value = *u32 >> shift;
+ expected_value = depth * 16777215.0f + 0.5f;
+ ok(abs(u32_value - expected_value) <= 3,
+ "Got value %#x (%.8e), expected %#x (%.8e).\n",
+ u32_value, u32_value / 16777215.0f,
+ expected_value, expected_value / 16777215.0f);
+ break;
+ case DXGI_FORMAT_D16_UNORM:
+ u16 = get_readback_data(&rb, 0, y, sizeof(*u16));
+ expected_value = depth * 65535.0f + 0.5f;
+ ok(abs(*u16 - expected_value) <= 1,
+ "Got value %#x (%.8e), expected %#x (%.8e).\n",
+ *u16, *u16 / 65535.0f, expected_value, expected_value / 65535.0f);
+ break;
+ default:
+ break;
+ }
+ }
+ release_resource_readback(&rb);
+ ID3D11RasterizerState_Release(rs);
+ }
+ }
+
+ ID3D11Texture2D_Release(texture);
+ ID3D11DepthStencilView_Release(dsv);
+ }
+
+ release_test_context(&test_context);
+}
+
static void test_fractional_viewports(void)
{
struct d3d11_test_context test_context;
@@ -23591,6 +23871,7 @@ START_TEST(d3d11)
test_stream_output_components();
test_gather();
test_gather_c();
+ test_depth_bias();
test_fractional_viewports();
test_early_depth_stencil();
test_conservative_depth_output();
--
2.13.6
2
3
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
---
dlls/d3dx9_24/Makefile.in | 3 +-
dlls/d3dx9_24/d3dx9_24_main.c | 60 ------------------------
dlls/d3dx9_25/Makefile.in | 3 +-
dlls/d3dx9_25/d3dx9_25_main.c | 60 ------------------------
dlls/d3dx9_26/Makefile.in | 3 +-
dlls/d3dx9_26/d3dx9_26_main.c | 60 ------------------------
dlls/d3dx9_27/Makefile.in | 3 +-
dlls/d3dx9_27/d3dx9_27_main.c | 60 ------------------------
dlls/d3dx9_28/Makefile.in | 3 +-
dlls/d3dx9_28/d3dx9_28_main.c | 60 ------------------------
dlls/d3dx9_29/Makefile.in | 3 +-
dlls/d3dx9_29/d3dx9_29_main.c | 60 ------------------------
dlls/d3dx9_30/Makefile.in | 3 +-
dlls/d3dx9_30/d3dx9_30_main.c | 77 -------------------------------
dlls/d3dx9_31/Makefile.in | 3 +-
dlls/d3dx9_31/d3dx9_31_main.c | 60 ------------------------
dlls/d3dx9_32/Makefile.in | 3 +-
dlls/d3dx9_32/d3dx9_32_main.c | 61 ------------------------
dlls/d3dx9_33/Makefile.in | 3 +-
dlls/d3dx9_33/d3dx9_33_main.c | 62 -------------------------
dlls/d3dx9_34/Makefile.in | 3 +-
dlls/d3dx9_34/d3dx9_34_main.c | 60 ------------------------
dlls/d3dx9_35/Makefile.in | 3 +-
dlls/d3dx9_35/d3dx9_35_main.c | 60 ------------------------
dlls/d3dx9_36/Makefile.in | 4 +-
dlls/d3dx9_36/{d3dx9_36_main.c => main.c} | 22 ++++-----
dlls/d3dx9_37/Makefile.in | 3 +-
dlls/d3dx9_37/d3dx9_37_main.c | 60 ------------------------
dlls/d3dx9_38/Makefile.in | 3 +-
dlls/d3dx9_38/d3dx9_38_main.c | 60 ------------------------
dlls/d3dx9_39/Makefile.in | 3 +-
dlls/d3dx9_39/d3dx9_39_main.c | 60 ------------------------
dlls/d3dx9_40/Makefile.in | 3 +-
dlls/d3dx9_40/d3dx9_40_main.c | 61 ------------------------
dlls/d3dx9_41/Makefile.in | 3 +-
dlls/d3dx9_41/d3dx9_41_main.c | 61 ------------------------
dlls/d3dx9_42/Makefile.in | 3 +-
dlls/d3dx9_42/d3dx9_42_main.c | 62 -------------------------
dlls/d3dx9_43/Makefile.in | 3 +-
dlls/d3dx9_43/d3dx9_43_main.c | 61 ------------------------
include/d3dx9core.h | 4 +-
41 files changed, 52 insertions(+), 1200 deletions(-)
delete mode 100644 dlls/d3dx9_24/d3dx9_24_main.c
delete mode 100644 dlls/d3dx9_25/d3dx9_25_main.c
delete mode 100644 dlls/d3dx9_26/d3dx9_26_main.c
delete mode 100644 dlls/d3dx9_27/d3dx9_27_main.c
delete mode 100644 dlls/d3dx9_28/d3dx9_28_main.c
delete mode 100644 dlls/d3dx9_29/d3dx9_29_main.c
delete mode 100644 dlls/d3dx9_30/d3dx9_30_main.c
delete mode 100644 dlls/d3dx9_31/d3dx9_31_main.c
delete mode 100644 dlls/d3dx9_32/d3dx9_32_main.c
delete mode 100644 dlls/d3dx9_33/d3dx9_33_main.c
delete mode 100644 dlls/d3dx9_34/d3dx9_34_main.c
delete mode 100644 dlls/d3dx9_35/d3dx9_35_main.c
rename dlls/d3dx9_36/{d3dx9_36_main.c => main.c} (73%)
delete mode 100644 dlls/d3dx9_37/d3dx9_37_main.c
delete mode 100644 dlls/d3dx9_38/d3dx9_38_main.c
delete mode 100644 dlls/d3dx9_39/d3dx9_39_main.c
delete mode 100644 dlls/d3dx9_40/d3dx9_40_main.c
delete mode 100644 dlls/d3dx9_41/d3dx9_41_main.c
delete mode 100644 dlls/d3dx9_42/d3dx9_42_main.c
delete mode 100644 dlls/d3dx9_43/d3dx9_43_main.c
diff --git a/dlls/d3dx9_24/Makefile.in b/dlls/d3dx9_24/Makefile.in
index 71dee7f7740..bd8d3a1df52 100644
--- a/dlls/d3dx9_24/Makefile.in
+++ b/dlls/d3dx9_24/Makefile.in
@@ -1,3 +1,4 @@
+EXTRADEFS = -DD3DX_SDK_VERSION=24
MODULE = d3dx9_24.dll
IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
PARENTSRC = ../d3dx9_36
@@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36
C_SRCS = \
animation.c \
core.c \
- d3dx9_24_main.c \
+ main.c \
effect.c \
font.c \
line.c \
diff --git a/dlls/d3dx9_24/d3dx9_24_main.c b/dlls/d3dx9_24/d3dx9_24_main.c
deleted file mode 100644
index 613061675a0..00000000000
--- a/dlls/d3dx9_24/d3dx9_24_main.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Direct3D X 9 main file
- *
- * Copyright (C) 2007 David Adam
- *
- * 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 "config.h"
-#include "wine/port.h"
-#include "initguid.h"
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-#include "d3dx9.h"
-
-/***********************************************************************
- * DllMain.
- */
-BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(inst);
- break;
- }
- return TRUE;
-}
-
-/***********************************************************************
- * D3DXCheckVersion
- * Checks whether we are compiling against the correct d3d and d3dx library.
- */
-BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers)
-{
- if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==24)
- return TRUE;
- else
- return FALSE;
-}
diff --git a/dlls/d3dx9_25/Makefile.in b/dlls/d3dx9_25/Makefile.in
index 9b44be8567d..17871f386fd 100644
--- a/dlls/d3dx9_25/Makefile.in
+++ b/dlls/d3dx9_25/Makefile.in
@@ -1,3 +1,4 @@
+EXTRADEFS = -DD3DX_SDK_VERSION=25
MODULE = d3dx9_25.dll
IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
PARENTSRC = ../d3dx9_36
@@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36
C_SRCS = \
animation.c \
core.c \
- d3dx9_25_main.c \
+ main.c \
effect.c \
font.c \
line.c \
diff --git a/dlls/d3dx9_25/d3dx9_25_main.c b/dlls/d3dx9_25/d3dx9_25_main.c
deleted file mode 100644
index ae4591772d6..00000000000
--- a/dlls/d3dx9_25/d3dx9_25_main.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Direct3D X 9 main file
- *
- * Copyright (C) 2007 David Adam
- *
- * 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 "config.h"
-#include "wine/port.h"
-#include "initguid.h"
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-#include "d3dx9.h"
-
-/***********************************************************************
- * DllMain.
- */
-BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(inst);
- break;
- }
- return TRUE;
-}
-
-/***********************************************************************
- * D3DXCheckVersion
- * Checks whether we are compiling against the correct d3d and d3dx library.
- */
-BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers)
-{
- if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==25)
- return TRUE;
- else
- return FALSE;
-}
diff --git a/dlls/d3dx9_26/Makefile.in b/dlls/d3dx9_26/Makefile.in
index 14a52d1a574..6a16016473d 100644
--- a/dlls/d3dx9_26/Makefile.in
+++ b/dlls/d3dx9_26/Makefile.in
@@ -1,3 +1,4 @@
+EXTRADEFS = -DD3DX_SDK_VERSION=26
MODULE = d3dx9_26.dll
IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
PARENTSRC = ../d3dx9_36
@@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36
C_SRCS = \
animation.c \
core.c \
- d3dx9_26_main.c \
+ main.c \
effect.c \
font.c \
line.c \
diff --git a/dlls/d3dx9_26/d3dx9_26_main.c b/dlls/d3dx9_26/d3dx9_26_main.c
deleted file mode 100644
index 08b48d94cbd..00000000000
--- a/dlls/d3dx9_26/d3dx9_26_main.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Direct3D X 9 main file
- *
- * Copyright (C) 2007 David Adam
- *
- * 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 "config.h"
-#include "wine/port.h"
-#include "initguid.h"
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-#include "d3dx9.h"
-
-/***********************************************************************
- * DllMain.
- */
-BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(inst);
- break;
- }
- return TRUE;
-}
-
-/***********************************************************************
- * D3DXCheckVersion
- * Checks whether we are compiling against the correct d3d and d3dx library.
- */
-BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers)
-{
- if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==26)
- return TRUE;
- else
- return FALSE;
-}
diff --git a/dlls/d3dx9_27/Makefile.in b/dlls/d3dx9_27/Makefile.in
index b2784fc619d..b3def98d6eb 100644
--- a/dlls/d3dx9_27/Makefile.in
+++ b/dlls/d3dx9_27/Makefile.in
@@ -1,3 +1,4 @@
+EXTRADEFS = -DD3DX_SDK_VERSION=27
MODULE = d3dx9_27.dll
IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
PARENTSRC = ../d3dx9_36
@@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36
C_SRCS = \
animation.c \
core.c \
- d3dx9_27_main.c \
+ main.c \
effect.c \
font.c \
line.c \
diff --git a/dlls/d3dx9_27/d3dx9_27_main.c b/dlls/d3dx9_27/d3dx9_27_main.c
deleted file mode 100644
index c418071f6b4..00000000000
--- a/dlls/d3dx9_27/d3dx9_27_main.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Direct3D X 9 main file
- *
- * Copyright (C) 2007 David Adam
- *
- * 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 "config.h"
-#include "wine/port.h"
-#include "initguid.h"
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-#include "d3dx9.h"
-
-/***********************************************************************
- * DllMain.
- */
-BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(inst);
- break;
- }
- return TRUE;
-}
-
-/***********************************************************************
- * D3DXCheckVersion
- * Checks whether we are compiling against the correct d3d and d3dx library.
- */
-BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers)
-{
- if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==27)
- return TRUE;
- else
- return FALSE;
-}
diff --git a/dlls/d3dx9_28/Makefile.in b/dlls/d3dx9_28/Makefile.in
index f6b31d658a9..c4542135e66 100644
--- a/dlls/d3dx9_28/Makefile.in
+++ b/dlls/d3dx9_28/Makefile.in
@@ -1,3 +1,4 @@
+EXTRADEFS = -DD3DX_SDK_VERSION=28
MODULE = d3dx9_28.dll
IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
PARENTSRC = ../d3dx9_36
@@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36
C_SRCS = \
animation.c \
core.c \
- d3dx9_28_main.c \
+ main.c \
effect.c \
font.c \
line.c \
diff --git a/dlls/d3dx9_28/d3dx9_28_main.c b/dlls/d3dx9_28/d3dx9_28_main.c
deleted file mode 100644
index c8292d8a15c..00000000000
--- a/dlls/d3dx9_28/d3dx9_28_main.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Direct3D X 9 main file
- *
- * Copyright (C) 2007 David Adam
- *
- * 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 "config.h"
-#include "wine/port.h"
-#include "initguid.h"
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-#include "d3dx9.h"
-
-/***********************************************************************
- * DllMain.
- */
-BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(inst);
- break;
- }
- return TRUE;
-}
-
-/***********************************************************************
- * D3DXCheckVersion
- * Checks whether we are compiling against the correct d3d and d3dx library.
- */
-BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers)
-{
- if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==28)
- return TRUE;
- else
- return FALSE;
-}
diff --git a/dlls/d3dx9_29/Makefile.in b/dlls/d3dx9_29/Makefile.in
index 9bd84beeaaf..e1b50d0e2a4 100644
--- a/dlls/d3dx9_29/Makefile.in
+++ b/dlls/d3dx9_29/Makefile.in
@@ -1,3 +1,4 @@
+EXTRADEFS = -DD3DX_SDK_VERSION=29
MODULE = d3dx9_29.dll
IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
PARENTSRC = ../d3dx9_36
@@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36
C_SRCS = \
animation.c \
core.c \
- d3dx9_29_main.c \
+ main.c \
effect.c \
font.c \
line.c \
diff --git a/dlls/d3dx9_29/d3dx9_29_main.c b/dlls/d3dx9_29/d3dx9_29_main.c
deleted file mode 100644
index 6a1174c59d4..00000000000
--- a/dlls/d3dx9_29/d3dx9_29_main.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Direct3D X 9 main file
- *
- * Copyright (C) 2007 David Adam
- *
- * 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 "config.h"
-#include "wine/port.h"
-#include "initguid.h"
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-#include "d3dx9.h"
-
-/***********************************************************************
- * DllMain.
- */
-BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(inst);
- break;
- }
- return TRUE;
-}
-
-/***********************************************************************
- * D3DXCheckVersion
- * Checks whether we are compiling against the correct d3d and d3dx library.
- */
-BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers)
-{
- if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==29)
- return TRUE;
- else
- return FALSE;
-}
diff --git a/dlls/d3dx9_30/Makefile.in b/dlls/d3dx9_30/Makefile.in
index a8ee15d46f6..6f18d145210 100644
--- a/dlls/d3dx9_30/Makefile.in
+++ b/dlls/d3dx9_30/Makefile.in
@@ -1,3 +1,4 @@
+EXTRADEFS = -DD3DX_SDK_VERSION=30
MODULE = d3dx9_30.dll
IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
PARENTSRC = ../d3dx9_36
@@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36
C_SRCS = \
animation.c \
core.c \
- d3dx9_30_main.c \
+ main.c \
effect.c \
font.c \
line.c \
diff --git a/dlls/d3dx9_30/d3dx9_30_main.c b/dlls/d3dx9_30/d3dx9_30_main.c
deleted file mode 100644
index dba15fe752b..00000000000
--- a/dlls/d3dx9_30/d3dx9_30_main.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Direct3D X 9 main file
- *
- * Copyright (C) 2007 David Adam
- *
- * 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 "config.h"
-#include "wine/port.h"
-#include "initguid.h"
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-#include "d3dx9.h"
-#include "wine/debug.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
-
-/***********************************************************************
- * DllMain.
- */
-BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(inst);
- break;
- }
- return TRUE;
-}
-
-/***********************************************************************
- * D3DXCheckVersion
- * Checks whether we are compiling against the correct d3d and d3dx library.
- */
-BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers)
-{
- if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==30)
- return TRUE;
- else
- return FALSE;
-}
-
-typedef enum _D3DX_CPU_OPTIMIZATION
-{
- D3DX_NOT_OPTIMIZED = 0,
- D3DX_3DNOW_OPTIMIZED = 1,
- D3DX_SSE2_OPTIMIZED = 2,
- D3DX_SSE_OPTIMIZED = 3
-} D3DX_CPU_OPTIMIZATION;
-
-D3DX_CPU_OPTIMIZATION WINAPI D3DXCpuOptimizations(BOOL enable)
-{
- FIXME("%i - stub\n", enable);
- return D3DX_NOT_OPTIMIZED;
-}
diff --git a/dlls/d3dx9_31/Makefile.in b/dlls/d3dx9_31/Makefile.in
index 27bd337df11..be5cdb9878f 100644
--- a/dlls/d3dx9_31/Makefile.in
+++ b/dlls/d3dx9_31/Makefile.in
@@ -1,3 +1,4 @@
+EXTRADEFS = -DD3DX_SDK_VERSION=31
MODULE = d3dx9_31.dll
IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
PARENTSRC = ../d3dx9_36
@@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36
C_SRCS = \
animation.c \
core.c \
- d3dx9_31_main.c \
+ main.c \
effect.c \
font.c \
line.c \
diff --git a/dlls/d3dx9_31/d3dx9_31_main.c b/dlls/d3dx9_31/d3dx9_31_main.c
deleted file mode 100644
index 47dc3044c9e..00000000000
--- a/dlls/d3dx9_31/d3dx9_31_main.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Direct3D X 9 main file
- *
- * Copyright (C) 2007 David Adam
- *
- * 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 "config.h"
-#include "wine/port.h"
-#include "initguid.h"
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-#include "d3dx9.h"
-
-/***********************************************************************
- * DllMain.
- */
-BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(inst);
- break;
- }
- return TRUE;
-}
-
-/***********************************************************************
- * D3DXCheckVersion
- * Checks whether we are compiling against the correct d3d and d3dx library.
- */
-BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers)
-{
- if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==31)
- return TRUE;
- else
- return FALSE;
-}
diff --git a/dlls/d3dx9_32/Makefile.in b/dlls/d3dx9_32/Makefile.in
index 1229c7fe9bf..6373c821e8a 100644
--- a/dlls/d3dx9_32/Makefile.in
+++ b/dlls/d3dx9_32/Makefile.in
@@ -1,3 +1,4 @@
+EXTRADEFS = -DD3DX_SDK_VERSION=32
MODULE = d3dx9_32.dll
IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
PARENTSRC = ../d3dx9_36
@@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36
C_SRCS = \
animation.c \
core.c \
- d3dx9_32_main.c \
+ main.c \
effect.c \
font.c \
line.c \
diff --git a/dlls/d3dx9_32/d3dx9_32_main.c b/dlls/d3dx9_32/d3dx9_32_main.c
deleted file mode 100644
index 414baa37135..00000000000
--- a/dlls/d3dx9_32/d3dx9_32_main.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Direct3D X 9 main file
- *
- * Copyright (C) 2007 David Adam
- *
- * 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 "config.h"
-#include "wine/port.h"
-#include "initguid.h"
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-#include "d3dx9.h"
-
-/***********************************************************************
- * DllMain.
- */
-BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(inst);
- break;
- }
- return TRUE;
-}
-
-
-/***********************************************************************
- * D3DXCheckVersion
- * Checks whether we are compiling against the correct d3d and d3dx library.
- */
-BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers)
-{
- if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==32)
- return TRUE;
- else
- return FALSE;
-}
diff --git a/dlls/d3dx9_33/Makefile.in b/dlls/d3dx9_33/Makefile.in
index 44bd9917713..10d0dd3ba28 100644
--- a/dlls/d3dx9_33/Makefile.in
+++ b/dlls/d3dx9_33/Makefile.in
@@ -1,3 +1,4 @@
+EXTRADEFS = -DD3DX_SDK_VERSION=33
MODULE = d3dx9_33.dll
IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
PARENTSRC = ../d3dx9_36
@@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36
C_SRCS = \
animation.c \
core.c \
- d3dx9_33_main.c \
+ main.c \
effect.c \
font.c \
line.c \
diff --git a/dlls/d3dx9_33/d3dx9_33_main.c b/dlls/d3dx9_33/d3dx9_33_main.c
deleted file mode 100644
index 3e409e329fc..00000000000
--- a/dlls/d3dx9_33/d3dx9_33_main.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Direct3D X 9 main file
- *
- * Copyright (C) 2007 David Adam
- *
- * 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 "config.h"
-#include "wine/port.h"
-#include "initguid.h"
-
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-#include "d3dx9.h"
-
-/***********************************************************************
- * DllMain.
- */
-BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(inst);
- break;
- }
- return TRUE;
-}
-
-
-/***********************************************************************
- * D3DXCheckVersion
- * Checks whether we are compiling against the correct d3d and d3dx library.
- */
-BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers)
-{
- if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==33)
- return TRUE;
- else
- return FALSE;
-}
diff --git a/dlls/d3dx9_34/Makefile.in b/dlls/d3dx9_34/Makefile.in
index 4ba14c22cbb..4f592bc3e79 100644
--- a/dlls/d3dx9_34/Makefile.in
+++ b/dlls/d3dx9_34/Makefile.in
@@ -1,3 +1,4 @@
+EXTRADEFS = -DD3DX_SDK_VERSION=34
MODULE = d3dx9_34.dll
IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
PARENTSRC = ../d3dx9_36
@@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36
C_SRCS = \
animation.c \
core.c \
- d3dx9_34_main.c \
+ main.c \
effect.c \
font.c \
line.c \
diff --git a/dlls/d3dx9_34/d3dx9_34_main.c b/dlls/d3dx9_34/d3dx9_34_main.c
deleted file mode 100644
index 17115f23eff..00000000000
--- a/dlls/d3dx9_34/d3dx9_34_main.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Direct3D X 9 main file
- *
- * Copyright (C) 2007 David Adam
- *
- * 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 "config.h"
-#include "wine/port.h"
-#include "initguid.h"
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-#include "d3dx9.h"
-
-/***********************************************************************
- * DllMain.
- */
-BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(inst);
- break;
- }
- return TRUE;
-}
-
-/***********************************************************************
- * D3DXCheckVersion
- * Checks whether we are compiling against the correct d3d and d3dx library.
- */
-BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers)
-{
- if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==34)
- return TRUE;
- else
- return FALSE;
-}
diff --git a/dlls/d3dx9_35/Makefile.in b/dlls/d3dx9_35/Makefile.in
index ee527d55e49..8ae7a9bb1b8 100644
--- a/dlls/d3dx9_35/Makefile.in
+++ b/dlls/d3dx9_35/Makefile.in
@@ -1,3 +1,4 @@
+EXTRADEFS = -DD3DX_SDK_VERSION=35
MODULE = d3dx9_35.dll
IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
PARENTSRC = ../d3dx9_36
@@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36
C_SRCS = \
animation.c \
core.c \
- d3dx9_35_main.c \
+ main.c \
effect.c \
font.c \
line.c \
diff --git a/dlls/d3dx9_35/d3dx9_35_main.c b/dlls/d3dx9_35/d3dx9_35_main.c
deleted file mode 100644
index bf0fd756dd3..00000000000
--- a/dlls/d3dx9_35/d3dx9_35_main.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Direct3D X 9 main file
- *
- * Copyright (C) 2007 David Adam
- *
- * 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 "config.h"
-#include "wine/port.h"
-#include "initguid.h"
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-#include "d3dx9.h"
-
-/***********************************************************************
- * DllMain.
- */
-BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(inst);
- break;
- }
- return TRUE;
-}
-
-/***********************************************************************
- * D3DXCheckVersion
- * Checks whether we are compiling against the correct d3d and d3dx library.
- */
-BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers)
-{
- if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==35)
- return TRUE;
- else
- return FALSE;
-}
diff --git a/dlls/d3dx9_36/Makefile.in b/dlls/d3dx9_36/Makefile.in
index 83f7d1c61b7..dec7f32472b 100644
--- a/dlls/d3dx9_36/Makefile.in
+++ b/dlls/d3dx9_36/Makefile.in
@@ -1,3 +1,5 @@
+EXTRADEFS = -DD3DX_SDK_VERSION=36
+EXTRADEFS = -DD3DX_SDK_VERSION=36
MODULE = d3dx9_36.dll
IMPORTLIB = d3dx9
IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
@@ -5,7 +7,7 @@ IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
C_SRCS = \
animation.c \
core.c \
- d3dx9_36_main.c \
+ main.c \
effect.c \
font.c \
line.c \
diff --git a/dlls/d3dx9_36/d3dx9_36_main.c b/dlls/d3dx9_36/main.c
similarity index 73%
rename from dlls/d3dx9_36/d3dx9_36_main.c
rename to dlls/d3dx9_36/main.c
index 599b76a62e8..a256d425266 100644
--- a/dlls/d3dx9_36/d3dx9_36_main.c
+++ b/dlls/d3dx9_36/main.c
@@ -26,9 +26,8 @@
#include "initguid.h"
#include "d3dx9_private.h"
-/***********************************************************************
- * DllMain.
- */
+WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
+
BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, void *reserved)
{
switch(reason)
@@ -42,14 +41,13 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, void *reserved)
return TRUE;
}
-/***********************************************************************
- * D3DXCheckVersion
- * Checks whether we are compiling against the correct d3d and d3dx library.
- */
-BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers)
+BOOL WINAPI D3DXCheckVersion(UINT d3d_sdk_ver, UINT d3dx_sdk_ver)
+{
+ return d3d_sdk_ver == D3D_SDK_VERSION && d3dx_sdk_ver == D3DX_SDK_VERSION;
+}
+
+DWORD WINAPI D3DXCpuOptimizations(BOOL enable)
{
- if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==36)
- return TRUE;
- else
- return FALSE;
+ FIXME("%#x - stub\n", enable);
+ return 0;
}
diff --git a/dlls/d3dx9_37/Makefile.in b/dlls/d3dx9_37/Makefile.in
index 61528a337e8..6b33e2e5096 100644
--- a/dlls/d3dx9_37/Makefile.in
+++ b/dlls/d3dx9_37/Makefile.in
@@ -1,3 +1,4 @@
+EXTRADEFS = -DD3DX_SDK_VERSION=37
MODULE = d3dx9_37.dll
IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
PARENTSRC = ../d3dx9_36
@@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36
C_SRCS = \
animation.c \
core.c \
- d3dx9_37_main.c \
+ main.c \
effect.c \
font.c \
line.c \
diff --git a/dlls/d3dx9_37/d3dx9_37_main.c b/dlls/d3dx9_37/d3dx9_37_main.c
deleted file mode 100644
index bbe8e7313eb..00000000000
--- a/dlls/d3dx9_37/d3dx9_37_main.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Direct3D X 9 main file
- *
- * Copyright (C) 2007 David Adam
- *
- * 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 "config.h"
-#include "wine/port.h"
-#include "initguid.h"
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-#include "d3dx9.h"
-
-/***********************************************************************
- * DllMain.
- */
-BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(inst);
- break;
- }
- return TRUE;
-}
-
-/***********************************************************************
- * D3DXCheckVersion
- * Checks whether we are compiling against the correct d3d and d3dx library.
- */
-BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers)
-{
- if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==37)
- return TRUE;
- else
- return FALSE;
-}
diff --git a/dlls/d3dx9_38/Makefile.in b/dlls/d3dx9_38/Makefile.in
index cb1507c00f0..420f93e5164 100644
--- a/dlls/d3dx9_38/Makefile.in
+++ b/dlls/d3dx9_38/Makefile.in
@@ -1,3 +1,4 @@
+EXTRADEFS = -DD3DX_SDK_VERSION=38
MODULE = d3dx9_38.dll
IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
PARENTSRC = ../d3dx9_36
@@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36
C_SRCS = \
animation.c \
core.c \
- d3dx9_38_main.c \
+ main.c \
effect.c \
font.c \
line.c \
diff --git a/dlls/d3dx9_38/d3dx9_38_main.c b/dlls/d3dx9_38/d3dx9_38_main.c
deleted file mode 100644
index 304a7ee7217..00000000000
--- a/dlls/d3dx9_38/d3dx9_38_main.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Direct3D X 9 main file
- *
- * Copyright (C) 2007 David Adam
- *
- * 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 "config.h"
-#include "wine/port.h"
-#include "initguid.h"
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-#include "d3dx9.h"
-
-/***********************************************************************
- * DllMain.
- */
-BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(inst);
- break;
- }
- return TRUE;
-}
-
-/***********************************************************************
- * D3DXCheckVersion
- * Checks whether we are compiling against the correct d3d and d3dx library.
- */
-BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers)
-{
- if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==38)
- return TRUE;
- else
- return FALSE;
-}
diff --git a/dlls/d3dx9_39/Makefile.in b/dlls/d3dx9_39/Makefile.in
index e372816ac48..faba12ec7d2 100644
--- a/dlls/d3dx9_39/Makefile.in
+++ b/dlls/d3dx9_39/Makefile.in
@@ -1,3 +1,4 @@
+EXTRADEFS = -DD3DX_SDK_VERSION=39
MODULE = d3dx9_39.dll
IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
PARENTSRC = ../d3dx9_36
@@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36
C_SRCS = \
animation.c \
core.c \
- d3dx9_39_main.c \
+ main.c \
effect.c \
font.c \
line.c \
diff --git a/dlls/d3dx9_39/d3dx9_39_main.c b/dlls/d3dx9_39/d3dx9_39_main.c
deleted file mode 100644
index 892ccf36278..00000000000
--- a/dlls/d3dx9_39/d3dx9_39_main.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Direct3D X 9 main file
- *
- * Copyright (C) 2007 David Adam
- *
- * 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 "config.h"
-#include "wine/port.h"
-#include "initguid.h"
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-#include "d3dx9.h"
-
-/***********************************************************************
- * DllMain.
- */
-BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(inst);
- break;
- }
- return TRUE;
-}
-
-/***********************************************************************
- * D3DXCheckVersion
- * Checks whether we are compiling against the correct d3d and d3dx library.
- */
-BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers)
-{
- if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==39)
- return TRUE;
- else
- return FALSE;
-}
diff --git a/dlls/d3dx9_40/Makefile.in b/dlls/d3dx9_40/Makefile.in
index b6c4dcdf0f7..2d6ac814c59 100644
--- a/dlls/d3dx9_40/Makefile.in
+++ b/dlls/d3dx9_40/Makefile.in
@@ -1,3 +1,4 @@
+EXTRADEFS = -DD3DX_SDK_VERSION=40
MODULE = d3dx9_40.dll
IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
PARENTSRC = ../d3dx9_36
@@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36
C_SRCS = \
animation.c \
core.c \
- d3dx9_40_main.c \
+ main.c \
effect.c \
font.c \
line.c \
diff --git a/dlls/d3dx9_40/d3dx9_40_main.c b/dlls/d3dx9_40/d3dx9_40_main.c
deleted file mode 100644
index 6c9cc45b95d..00000000000
--- a/dlls/d3dx9_40/d3dx9_40_main.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Direct3D X 9 main file
- *
- * Copyright (C) 2007 David Adam
- * Copyright (C) 2009 Rico Schüller
- *
- * 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 "config.h"
-#include "wine/port.h"
-#include "initguid.h"
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-#include "d3dx9.h"
-
-/***********************************************************************
- * DllMain.
- */
-BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(inst);
- break;
- }
- return TRUE;
-}
-
-/***********************************************************************
- * D3DXCheckVersion
- * Checks whether we are compiling against the correct d3d and d3dx library.
- */
-BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers)
-{
- if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==40)
- return TRUE;
- else
- return FALSE;
-}
diff --git a/dlls/d3dx9_41/Makefile.in b/dlls/d3dx9_41/Makefile.in
index 9aa91a9bac7..fbabfcb289b 100644
--- a/dlls/d3dx9_41/Makefile.in
+++ b/dlls/d3dx9_41/Makefile.in
@@ -1,3 +1,4 @@
+EXTRADEFS = -DD3DX_SDK_VERSION=41
MODULE = d3dx9_41.dll
IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
PARENTSRC = ../d3dx9_36
@@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36
C_SRCS = \
animation.c \
core.c \
- d3dx9_41_main.c \
+ main.c \
effect.c \
font.c \
line.c \
diff --git a/dlls/d3dx9_41/d3dx9_41_main.c b/dlls/d3dx9_41/d3dx9_41_main.c
deleted file mode 100644
index f37cee7f47f..00000000000
--- a/dlls/d3dx9_41/d3dx9_41_main.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Direct3D X 9 main file
- *
- * Copyright (C) 2007 David Adam
- * Copyright (C) 2009 Rico Schüller
- *
- * 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 "config.h"
-#include "wine/port.h"
-#include "initguid.h"
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-#include "d3dx9.h"
-
-/***********************************************************************
- * DllMain.
- */
-BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(inst);
- break;
- }
- return TRUE;
-}
-
-/***********************************************************************
- * D3DXCheckVersion
- * Checks whether we are compiling against the correct d3d and d3dx library.
- */
-BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers)
-{
- if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==41)
- return TRUE;
- else
- return FALSE;
-}
diff --git a/dlls/d3dx9_42/Makefile.in b/dlls/d3dx9_42/Makefile.in
index a5cc60e556f..c60062b61bf 100644
--- a/dlls/d3dx9_42/Makefile.in
+++ b/dlls/d3dx9_42/Makefile.in
@@ -1,3 +1,4 @@
+EXTRADEFS = -DD3DX_SDK_VERSION=42
MODULE = d3dx9_42.dll
IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
PARENTSRC = ../d3dx9_36
@@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36
C_SRCS = \
animation.c \
core.c \
- d3dx9_42_main.c \
+ main.c \
effect.c \
font.c \
line.c \
diff --git a/dlls/d3dx9_42/d3dx9_42_main.c b/dlls/d3dx9_42/d3dx9_42_main.c
deleted file mode 100644
index 631bd3bf407..00000000000
--- a/dlls/d3dx9_42/d3dx9_42_main.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Direct3D X 9 main file
- *
- * Copyright (C) 2007 David Adam
- * Copyright (C) 2009 Rico Schüller
- * Copyright (C) 2009 Ričardas Barkauskas
- *
- * 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 "config.h"
-#include "wine/port.h"
-#include "initguid.h"
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-#include "d3dx9.h"
-
-/***********************************************************************
- * DllMain.
- */
-BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(inst);
- break;
- }
- return TRUE;
-}
-
-/***********************************************************************
- * D3DXCheckVersion
- * Checks whether we are compiling against the correct d3d and d3dx library.
- */
-BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers)
-{
- if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==42)
- return TRUE;
- else
- return FALSE;
-}
diff --git a/dlls/d3dx9_43/Makefile.in b/dlls/d3dx9_43/Makefile.in
index cb787075690..89610de9e56 100644
--- a/dlls/d3dx9_43/Makefile.in
+++ b/dlls/d3dx9_43/Makefile.in
@@ -1,3 +1,4 @@
+EXTRADEFS = -DD3DX_SDK_VERSION=43
MODULE = d3dx9_43.dll
IMPORTS = d3d9 d3dcompiler dxguid d3dxof ole32 gdi32 user32
PARENTSRC = ../d3dx9_36
@@ -5,7 +6,7 @@ PARENTSRC = ../d3dx9_36
C_SRCS = \
animation.c \
core.c \
- d3dx9_43_main.c \
+ main.c \
effect.c \
font.c \
line.c \
diff --git a/dlls/d3dx9_43/d3dx9_43_main.c b/dlls/d3dx9_43/d3dx9_43_main.c
deleted file mode 100644
index b4a5e2b655f..00000000000
--- a/dlls/d3dx9_43/d3dx9_43_main.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Direct3D X 9 main file
- *
- * Copyright (C) 2007 David Adam
- * Copyright (C) 2009 Rico Schüller
- *
- * 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 "config.h"
-#include "wine/port.h"
-#include "initguid.h"
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-#include "d3dx9.h"
-
-/***********************************************************************
- * DllMain.
- */
-BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(inst);
- break;
- }
- return TRUE;
-}
-
-/***********************************************************************
- * D3DXCheckVersion
- * Checks whether we are compiling against the correct d3d and d3dx library.
- */
-BOOL WINAPI D3DXCheckVersion(UINT d3dsdkvers, UINT d3dxsdkvers)
-{
- if(d3dsdkvers==D3D_SDK_VERSION && d3dxsdkvers==43)
- return TRUE;
- else
- return FALSE;
-}
diff --git a/include/d3dx9core.h b/include/d3dx9core.h
index a04bced0227..e66afc4b832 100644
--- a/include/d3dx9core.h
+++ b/include/d3dx9core.h
@@ -24,11 +24,9 @@
/**********************************************
***************** Definitions ****************
**********************************************/
-/* D3DX_VERSION will be completely ignored since we are
- implementing all dlls from d3dx9_24 to d3dx9_36 */
#define D3DX_VERSION 0x0902
#ifndef D3DX_SDK_VERSION
-#define D3DX_SDK_VERSION 36
+#define D3DX_SDK_VERSION 43
#endif
#define D3DXSPRITE_DONOTSAVESTATE 0x00000001
#define D3DXSPRITE_DONOTMODIFY_RENDERSTATE 0x00000002
--
2.13.6
3
15
08 Dec '17
Although UTF-16 text is converted to UTF-8 before transmission it's stored inline
rather than in the dictionary.
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/webservices/reader.c | 12 +
dlls/webservices/webservices_private.h | 1 +
dlls/webservices/writer.c | 1411 +++++++++++++++++---------------
3 files changed, 754 insertions(+), 670 deletions(-)
diff --git a/dlls/webservices/reader.c b/dlls/webservices/reader.c
index 9d024a3446..a05b1edb33 100644
--- a/dlls/webservices/reader.c
+++ b/dlls/webservices/reader.c
@@ -788,6 +788,18 @@ WS_XML_UTF8_TEXT *alloc_utf8_text( const BYTE *data, ULONG len )
return ret;
}
+WS_XML_UTF16_TEXT *alloc_utf16_text( const BYTE *data, ULONG len )
+{
+ WS_XML_UTF16_TEXT *ret;
+
+ if (!(ret = heap_alloc( sizeof(*ret) + len ))) return NULL;
+ ret->text.textType = WS_XML_TEXT_TYPE_UTF16;
+ ret->byteCount = len;
+ ret->bytes = len ? (BYTE *)(ret + 1) : NULL;
+ if (data) memcpy( ret->bytes, data, len );
+ return ret;
+}
+
WS_XML_BASE64_TEXT *alloc_base64_text( const BYTE *data, ULONG len )
{
WS_XML_BASE64_TEXT *ret;
diff --git a/dlls/webservices/webservices_private.h b/dlls/webservices/webservices_private.h
index f8cc6d9cfe..e477e0fc3f 100644
--- a/dlls/webservices/webservices_private.h
+++ b/dlls/webservices/webservices_private.h
@@ -68,6 +68,7 @@ HRESULT read_header( WS_XML_READER *, const WS_XML_STRING *, const WS_XML_STRING
HRESULT create_header_buffer( WS_XML_READER *, WS_HEAP *, WS_XML_BUFFER ** ) DECLSPEC_HIDDEN;
WS_XML_UTF8_TEXT *alloc_utf8_text( const BYTE *, ULONG ) DECLSPEC_HIDDEN;
+WS_XML_UTF16_TEXT *alloc_utf16_text( const BYTE *, ULONG ) DECLSPEC_HIDDEN;
WS_XML_BASE64_TEXT *alloc_base64_text( const BYTE *, ULONG ) DECLSPEC_HIDDEN;
WS_XML_BOOL_TEXT *alloc_bool_text( BOOL ) DECLSPEC_HIDDEN;
WS_XML_INT32_TEXT *alloc_int32_text( INT32 ) DECLSPEC_HIDDEN;
diff --git a/dlls/webservices/writer.c b/dlls/webservices/writer.c
index 4b2466390c..be2994af83 100644
--- a/dlls/webservices/writer.c
+++ b/dlls/webservices/writer.c
@@ -667,6 +667,15 @@ static enum record_type get_attr_text_record_type( const WS_XML_TEXT *text, BOOL
if (text_utf8->value.length <= MAX_UINT16) return RECORD_CHARS16_TEXT;
return RECORD_CHARS32_TEXT;
}
+ case WS_XML_TEXT_TYPE_UTF16:
+ {
+ const WS_XML_UTF16_TEXT *text_utf16 = (const WS_XML_UTF16_TEXT *)text;
+ int len = text_utf16->byteCount / sizeof(WCHAR);
+ int len_utf8 = WideCharToMultiByte( CP_UTF8, 0, (const WCHAR *)text_utf16->bytes, len, NULL, 0, NULL, NULL );
+ if (len_utf8 <= MAX_UINT8) return RECORD_CHARS8_TEXT;
+ if (len_utf8 <= MAX_UINT16) return RECORD_CHARS16_TEXT;
+ return RECORD_CHARS32_TEXT;
+ }
case WS_XML_TEXT_TYPE_BASE64:
{
const WS_XML_BASE64_TEXT *text_base64 = (const WS_XML_BASE64_TEXT *)text;
@@ -784,153 +793,566 @@ static BOOL get_string_id( struct writer *writer, const WS_XML_STRING *str, ULON
return FALSE;
}
-static HRESULT write_attribute_value_bin( struct writer *writer, const WS_XML_TEXT *text )
+static ULONG format_bool( const BOOL *ptr, unsigned char *buf )
{
- enum record_type type;
- BOOL use_dict = FALSE;
- HRESULT hr;
- ULONG id;
-
- if (text && text->textType == WS_XML_TEXT_TYPE_UTF8)
+ static const unsigned char bool_true[] = {'t','r','u','e'}, bool_false[] = {'f','a','l','s','e'};
+ if (*ptr)
{
- const WS_XML_UTF8_TEXT *utf8 = (const WS_XML_UTF8_TEXT *)text;
- use_dict = get_string_id( writer, &utf8->value, &id );
+ memcpy( buf, bool_true, sizeof(bool_true) );
+ return sizeof(bool_true);
}
- type = get_attr_text_record_type( text, use_dict );
+ memcpy( buf, bool_false, sizeof(bool_false) );
+ return sizeof(bool_false);
+}
- if ((hr = write_grow_buffer( writer, 1 )) != S_OK) return hr;
- write_char( writer, type );
+static ULONG format_int32( const INT32 *ptr, unsigned char *buf )
+{
+ return wsprintfA( (char *)buf, "%d", *ptr );
+}
- switch (type)
+static ULONG format_int64( const INT64 *ptr, unsigned char *buf )
+{
+ return wsprintfA( (char *)buf, "%I64d", *ptr );
+}
+
+static ULONG format_uint64( const UINT64 *ptr, unsigned char *buf )
+{
+ return wsprintfA( (char *)buf, "%I64u", *ptr );
+}
+
+static ULONG format_double( const double *ptr, unsigned char *buf )
+{
+#ifdef HAVE_POWL
+ static const long double precision = 0.0000000000000001;
+ unsigned char *p = buf;
+ long double val = *ptr;
+ int neg, mag, mag2, use_exp;
+
+ if (isnan( val ))
{
- case RECORD_CHARS8_TEXT:
+ memcpy( buf, "NaN", 3 );
+ return 3;
+ }
+ if (isinf( val ))
{
- WS_XML_UTF8_TEXT *text_utf8 = (WS_XML_UTF8_TEXT *)text;
- if (!text_utf8)
+ if (val < 0)
{
- if ((hr = write_grow_buffer( writer, 1 )) != S_OK) return hr;
- write_char( writer, 0 );
- return S_OK;
+ memcpy( buf, "-INF", 4 );
+ return 4;
}
- if ((hr = write_grow_buffer( writer, 1 + text_utf8->value.length )) != S_OK) return hr;
- write_char( writer, text_utf8->value.length );
- write_bytes( writer, text_utf8->value.bytes, text_utf8->value.length );
- return S_OK;
+ memcpy( buf, "INF", 3 );
+ return 3;
}
- case RECORD_CHARS16_TEXT:
+ if (val == 0.0)
{
- WS_XML_UTF8_TEXT *text_utf8 = (WS_XML_UTF8_TEXT *)text;
- UINT16 len = text_utf8->value.length;
- if ((hr = write_grow_buffer( writer, sizeof(len) + len )) != S_OK) return hr;
- write_bytes( writer, (const BYTE *)&len, sizeof(len) );
- write_bytes( writer, text_utf8->value.bytes, len );
- return S_OK;
+ *p = '0';
+ return 1;
}
- case RECORD_BYTES8_TEXT:
+
+ if ((neg = val < 0))
{
- WS_XML_BASE64_TEXT *text_base64 = (WS_XML_BASE64_TEXT *)text;
- if ((hr = write_grow_buffer( writer, 1 + text_base64->length )) != S_OK) return hr;
- write_char( writer, text_base64->length );
- write_bytes( writer, text_base64->bytes, text_base64->length );
- return S_OK;
+ *p++ = '-';
+ val = -val;
}
- case RECORD_BYTES16_TEXT:
+
+ mag = log10l( val );
+ use_exp = (mag >= 15 || (neg && mag >= 1) || mag <= -1);
+ if (use_exp)
{
- WS_XML_BASE64_TEXT *text_base64 = (WS_XML_BASE64_TEXT *)text;
- UINT16 len = text_base64->length;
- if ((hr = write_grow_buffer( writer, sizeof(len) + len )) != S_OK) return hr;
- write_bytes( writer, (const BYTE *)&len, sizeof(len) );
- write_bytes( writer, text_base64->bytes, len );
- return S_OK;
+ if (mag < 0) mag -= 1;
+ val = val / powl( 10.0, mag );
+ mag2 = mag;
+ mag = 0;
}
- case RECORD_ZERO_TEXT:
- case RECORD_ONE_TEXT:
- case RECORD_FALSE_TEXT:
- case RECORD_TRUE_TEXT:
- return S_OK;
+ else if (mag < 1) mag = 0;
- case RECORD_INT8_TEXT:
+ while (val > precision || mag >= 0)
{
- INT8 val = get_text_value_int( text );
- if ((hr = write_grow_buffer( writer, sizeof(val) )) != S_OK) return hr;
- write_char( writer, val );
- return S_OK;
+ long double weight = powl( 10.0, mag );
+ if (weight > 0 && !isinf( weight ))
+ {
+ int digit = floorl( val / weight );
+ val -= digit * weight;
+ *(p++) = '0' + digit;
+ }
+ if (!mag && val > precision) *(p++) = '.';
+ mag--;
}
- case RECORD_INT16_TEXT:
+
+ if (use_exp)
{
- INT16 val = get_text_value_int( text );
- if ((hr = write_grow_buffer( writer, sizeof(val) )) != S_OK) return hr;
- write_bytes( writer, (const BYTE *)&val, sizeof(val) );
- return S_OK;
+ int i, j;
+ *(p++) = 'E';
+ if (mag2 > 0) *(p++) = '+';
+ else
+ {
+ *(p++) = '-';
+ mag2 = -mag2;
+ }
+ mag = 0;
+ while (mag2 > 0)
+ {
+ *(p++) = '0' + mag2 % 10;
+ mag2 /= 10;
+ mag++;
+ }
+ for (i = -mag, j = -1; i < j; i++, j--)
+ {
+ p[i] ^= p[j];
+ p[j] ^= p[i];
+ p[i] ^= p[j];
+ }
}
- case RECORD_INT32_TEXT:
+
+ return p - buf;
+#else
+ FIXME( "powl not found at build time\n" );
+ return 0;
+#endif
+}
+
+static inline int year_size( int year )
+{
+ return leap_year( year ) ? 366 : 365;
+}
+
+#define TZ_OFFSET 8
+static ULONG format_datetime( const WS_DATETIME *ptr, unsigned char *buf )
+{
+ static const char fmt[] = "%04u-%02u-%02uT%02u:%02u:%02u";
+ int day, hour, min, sec, sec_frac, month = 0, year = 1, tz_hour;
+ unsigned __int64 ticks, day_ticks;
+ ULONG len;
+
+ if (ptr->format == WS_DATETIME_FORMAT_LOCAL &&
+ ptr->ticks >= TICKS_1601_01_01 + TZ_OFFSET * TICKS_PER_HOUR)
{
- INT32 val = get_text_value_int( text );
- if ((hr = write_grow_buffer( writer, sizeof(val) )) != S_OK) return hr;
- write_bytes( writer, (const BYTE *)&val, sizeof(val) );
- return S_OK;
+ ticks = ptr->ticks - TZ_OFFSET * TICKS_PER_HOUR;
+ tz_hour = TZ_OFFSET;
}
- case RECORD_INT64_TEXT:
+ else
{
- INT64 val = get_text_value_int( text );
- if ((hr = write_grow_buffer( writer, sizeof(val) )) != S_OK) return hr;
- write_bytes( writer, (const BYTE *)&val, sizeof(val) );
- return S_OK;
+ ticks = ptr->ticks;
+ tz_hour = 0;
}
- case RECORD_UINT64_TEXT:
+ day = ticks / TICKS_PER_DAY;
+ day_ticks = ticks % TICKS_PER_DAY;
+ hour = day_ticks / TICKS_PER_HOUR;
+ min = (day_ticks % TICKS_PER_HOUR) / TICKS_PER_MIN;
+ sec = (day_ticks % TICKS_PER_MIN) / TICKS_PER_SEC;
+ sec_frac = day_ticks % TICKS_PER_SEC;
+
+ while (day >= year_size( year ))
{
- WS_XML_UINT64_TEXT *text_uint64 = (WS_XML_UINT64_TEXT *)text;
- if ((hr = write_grow_buffer( writer, sizeof(text_uint64->value) )) != S_OK) return hr;
- write_bytes( writer, (const BYTE *)&text_uint64->value, sizeof(text_uint64->value) );
- return S_OK;
+ day -= year_size( year );
+ year++;
}
- case RECORD_DOUBLE_TEXT:
+ while (day >= month_days[leap_year( year )][month])
{
- WS_XML_DOUBLE_TEXT *text_double = (WS_XML_DOUBLE_TEXT *)text;
- if ((hr = write_grow_buffer( writer, sizeof(text_double->value) )) != S_OK) return hr;
- write_bytes( writer, (const BYTE *)&text_double->value, sizeof(text_double->value) );
- return S_OK;
+ day -= month_days[leap_year( year )][month];
+ month++;
}
- case RECORD_GUID_TEXT:
+
+ len = sprintf( (char *)buf, fmt, year, month + 1, day + 1, hour, min, sec );
+ if (sec_frac)
{
- WS_XML_GUID_TEXT *text_guid = (WS_XML_GUID_TEXT *)text;
- if ((hr = write_grow_buffer( writer, sizeof(text_guid->value) )) != S_OK) return hr;
- write_bytes( writer, (const BYTE *)&text_guid->value, sizeof(text_guid->value) );
- return S_OK;
+ static const char fmt_frac[] = ".%07u";
+ len += sprintf( (char *)buf + len, fmt_frac, sec_frac );
+ while (buf[len - 1] == '0') len--;
}
- case RECORD_UNIQUE_ID_TEXT:
+ if (ptr->format == WS_DATETIME_FORMAT_UTC)
{
- WS_XML_UNIQUE_ID_TEXT *text_unique_id = (WS_XML_UNIQUE_ID_TEXT *)text;
- if ((hr = write_grow_buffer( writer, sizeof(text_unique_id->value) )) != S_OK) return hr;
- write_bytes( writer, (const BYTE *)&text_unique_id->value, sizeof(text_unique_id->value) );
- return S_OK;
+ buf[len++] = 'Z';
}
- case RECORD_DATETIME_TEXT:
+ else if (ptr->format == WS_DATETIME_FORMAT_LOCAL)
{
- WS_XML_DATETIME_TEXT *text_datetime = (WS_XML_DATETIME_TEXT *)text;
- UINT64 val = text_datetime->value.ticks;
+ static const char fmt_tz[] = "%c%02u:00";
+ len += sprintf( (char *)buf + len, fmt_tz, tz_hour ? '-' : '+', tz_hour );
+ }
- assert( val <= TICKS_MAX );
- if (text_datetime->value.format == WS_DATETIME_FORMAT_UTC) val |= (UINT64)1 << 62;
- else if (text_datetime->value.format == WS_DATETIME_FORMAT_LOCAL) val |= (UINT64)1 << 63;
+ return len;
+}
- if ((hr = write_grow_buffer( writer, sizeof(val) )) != S_OK) return hr;
- write_bytes( writer, (const BYTE *)&val, sizeof(val) );
- return S_OK;
- }
- default:
- FIXME( "unhandled record type %02x\n", type );
- return E_NOTIMPL;
- }
+static ULONG format_guid( const GUID *ptr, unsigned char *buf )
+{
+ static const char fmt[] = "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x";
+ return sprintf( (char *)buf, fmt, ptr->Data1, ptr->Data2, ptr->Data3,
+ ptr->Data4[0], ptr->Data4[1], ptr->Data4[2], ptr->Data4[3],
+ ptr->Data4[4], ptr->Data4[5], ptr->Data4[6], ptr->Data4[7] );
}
-static enum record_type get_attr_record_type( const WS_XML_ATTRIBUTE *attr, BOOL use_dict )
+static ULONG format_urn( const GUID *ptr, unsigned char *buf )
{
- if (!attr->prefix || !attr->prefix->length)
- {
- if (use_dict) return RECORD_SHORT_DICTIONARY_ATTRIBUTE;
- return RECORD_SHORT_ATTRIBUTE;
- }
+ static const char fmt[] = "urn:uuid:%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x";
+ return sprintf( (char *)buf, fmt, ptr->Data1, ptr->Data2, ptr->Data3,
+ ptr->Data4[0], ptr->Data4[1], ptr->Data4[2], ptr->Data4[3],
+ ptr->Data4[4], ptr->Data4[5], ptr->Data4[6], ptr->Data4[7] );
+}
+
+static ULONG format_qname( const WS_XML_STRING *prefix, const WS_XML_STRING *localname, unsigned char *buf )
+{
+ ULONG len = 0;
+ if (prefix && prefix->length)
+ {
+ memcpy( buf, prefix->bytes, prefix->length );
+ len += prefix->length;
+ buf[len++] = ':';
+ }
+ memcpy( buf + len, localname->bytes, localname->length );
+ return len + localname->length;
+}
+
+static ULONG encode_base64( const unsigned char *bin, ULONG len, unsigned char *buf )
+{
+ static const char base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ ULONG i = 0, x;
+
+ while (len > 0)
+ {
+ buf[i++] = base64[(bin[0] & 0xfc) >> 2];
+ x = (bin[0] & 3) << 4;
+ if (len == 1)
+ {
+ buf[i++] = base64[x];
+ buf[i++] = '=';
+ buf[i++] = '=';
+ break;
+ }
+ buf[i++] = base64[x | ((bin[1] & 0xf0) >> 4)];
+ x = (bin[1] & 0x0f) << 2;
+ if (len == 2)
+ {
+ buf[i++] = base64[x];
+ buf[i++] = '=';
+ break;
+ }
+ buf[i++] = base64[x | ((bin[2] & 0xc0) >> 6)];
+ buf[i++] = base64[bin[2] & 0x3f];
+ bin += 3;
+ len -= 3;
+ }
+ return i;
+}
+
+static HRESULT text_to_utf8text( const WS_XML_TEXT *text, const WS_XML_UTF8_TEXT *old, ULONG *offset,
+ WS_XML_UTF8_TEXT **ret )
+{
+ ULONG len_old = old ? old->value.length : 0;
+ if (offset) *offset = len_old;
+
+ switch (text->textType)
+ {
+ case WS_XML_TEXT_TYPE_UTF8:
+ {
+ const WS_XML_UTF8_TEXT *src = (const WS_XML_UTF8_TEXT *)text;
+
+ if (!(*ret = alloc_utf8_text( NULL, len_old + src->value.length ))) return E_OUTOFMEMORY;
+ if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
+ memcpy( (*ret)->value.bytes + len_old, src->value.bytes, src->value.length );
+ return S_OK;
+ }
+ case WS_XML_TEXT_TYPE_UTF16:
+ {
+ const WS_XML_UTF16_TEXT *src = (const WS_XML_UTF16_TEXT *)text;
+ const WCHAR *str = (const WCHAR *)src->bytes;
+ ULONG len = src->byteCount / sizeof(WCHAR), len_utf8;
+
+ if (src->byteCount % sizeof(WCHAR)) return E_INVALIDARG;
+ len_utf8 = WideCharToMultiByte( CP_UTF8, 0, str, len, NULL, 0, NULL, NULL );
+ if (!(*ret = alloc_utf8_text( NULL, len_old + len_utf8 ))) return E_OUTOFMEMORY;
+ if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
+ WideCharToMultiByte( CP_UTF8, 0, str, len, (char *)(*ret)->value.bytes + len_old, len_utf8, NULL, NULL );
+ return S_OK;
+ }
+ case WS_XML_TEXT_TYPE_BASE64:
+ {
+ const WS_XML_BASE64_TEXT *base64 = (const WS_XML_BASE64_TEXT *)text;
+ ULONG len = ((4 * base64->length / 3) + 3) & ~3;
+
+ if (!(*ret = alloc_utf8_text( NULL, len_old + len ))) return E_OUTOFMEMORY;
+ if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
+ (*ret)->value.length = encode_base64( base64->bytes, base64->length, (*ret)->value.bytes + len_old ) + len_old;
+ return S_OK;
+ }
+ case WS_XML_TEXT_TYPE_BOOL:
+ {
+ const WS_XML_BOOL_TEXT *bool_text = (const WS_XML_BOOL_TEXT *)text;
+
+ if (!(*ret = alloc_utf8_text( NULL, len_old + 5 ))) return E_OUTOFMEMORY;
+ if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
+ (*ret)->value.length = format_bool( &bool_text->value, (*ret)->value.bytes + len_old ) + len_old;
+ return S_OK;
+ }
+ case WS_XML_TEXT_TYPE_INT32:
+ {
+ const WS_XML_INT32_TEXT *int32_text = (const WS_XML_INT32_TEXT *)text;
+ unsigned char buf[12]; /* "-2147483648" */
+ ULONG len = format_int32( &int32_text->value, buf );
+
+ if (!(*ret = alloc_utf8_text( NULL, len_old + len ))) return E_OUTOFMEMORY;
+ if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
+ memcpy( (*ret)->value.bytes + len_old, buf, len );
+ return S_OK;
+ }
+ case WS_XML_TEXT_TYPE_INT64:
+ {
+ const WS_XML_INT64_TEXT *int64_text = (const WS_XML_INT64_TEXT *)text;
+ unsigned char buf[21]; /* "-9223372036854775808" */
+ ULONG len = format_int64( &int64_text->value, buf );
+
+ if (!(*ret = alloc_utf8_text( NULL, len_old + len ))) return E_OUTOFMEMORY;
+ if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
+ memcpy( (*ret)->value.bytes + len_old, buf, len );
+ return S_OK;
+ }
+ case WS_XML_TEXT_TYPE_UINT64:
+ {
+ const WS_XML_UINT64_TEXT *uint64_text = (const WS_XML_UINT64_TEXT *)text;
+ unsigned char buf[21]; /* "18446744073709551615" */
+ ULONG len = format_uint64( &uint64_text->value, buf );
+
+ if (!(*ret = alloc_utf8_text( NULL, len_old + len ))) return E_OUTOFMEMORY;
+ if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
+ memcpy( (*ret)->value.bytes + len_old, buf, len );
+ return S_OK;
+ }
+ case WS_XML_TEXT_TYPE_DOUBLE:
+ {
+ const WS_XML_DOUBLE_TEXT *double_text = (const WS_XML_DOUBLE_TEXT *)text;
+ unsigned char buf[32]; /* "-1.1111111111111111E-308", oversized to address Valgrind limitations */
+ unsigned short fpword;
+ ULONG len;
+
+ if (!set_fpword( 0x37f, &fpword )) return E_NOTIMPL;
+ len = format_double( &double_text->value, buf );
+ restore_fpword( fpword );
+ if (!len) return E_NOTIMPL;
+
+ if (!(*ret = alloc_utf8_text( NULL, len_old + len ))) return E_OUTOFMEMORY;
+ if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
+ memcpy( (*ret)->value.bytes + len_old, buf, len );
+ return S_OK;
+ }
+ case WS_XML_TEXT_TYPE_GUID:
+ {
+ const WS_XML_GUID_TEXT *id = (const WS_XML_GUID_TEXT *)text;
+
+ if (!(*ret = alloc_utf8_text( NULL, len_old + 37 ))) return E_OUTOFMEMORY;
+ if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
+ (*ret)->value.length = format_guid( &id->value, (*ret)->value.bytes + len_old ) + len_old;
+ return S_OK;
+ }
+ case WS_XML_TEXT_TYPE_UNIQUE_ID:
+ {
+ const WS_XML_UNIQUE_ID_TEXT *id = (const WS_XML_UNIQUE_ID_TEXT *)text;
+
+ if (!(*ret = alloc_utf8_text( NULL, len_old + 46 ))) return E_OUTOFMEMORY;
+ if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
+ (*ret)->value.length = format_urn( &id->value, (*ret)->value.bytes + len_old ) + len_old;
+ return S_OK;
+ }
+ case WS_XML_TEXT_TYPE_DATETIME:
+ {
+ const WS_XML_DATETIME_TEXT *dt = (const WS_XML_DATETIME_TEXT *)text;
+
+ if (!(*ret = alloc_utf8_text( NULL, len_old + 34 ))) return E_OUTOFMEMORY;
+ if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
+ (*ret)->value.length = format_datetime( &dt->value, (*ret)->value.bytes + len_old ) + len_old;
+ return S_OK;
+ }
+ case WS_XML_TEXT_TYPE_QNAME:
+ {
+ const WS_XML_QNAME_TEXT *qn = (const WS_XML_QNAME_TEXT *)text;
+ ULONG len = qn->localName->length;
+
+ if (qn->prefix && qn->prefix->length) len += qn->prefix->length + 1;
+ if (!(*ret = alloc_utf8_text( NULL, len_old + len ))) return E_OUTOFMEMORY;
+ if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
+ (*ret)->value.length = format_qname( qn->prefix, qn->localName, (*ret)->value.bytes + len_old ) + len_old;
+ return S_OK;
+ }
+ default:
+ FIXME( "unhandled text type %u\n", text->textType );
+ return E_NOTIMPL;
+ }
+}
+
+static HRESULT write_attribute_value_bin( struct writer *writer, const WS_XML_TEXT *text )
+{
+ enum record_type type;
+ BOOL use_dict = FALSE;
+ HRESULT hr;
+ ULONG id;
+
+ if (text && text->textType == WS_XML_TEXT_TYPE_UTF8)
+ {
+ const WS_XML_UTF8_TEXT *utf8 = (const WS_XML_UTF8_TEXT *)text;
+ use_dict = get_string_id( writer, &utf8->value, &id );
+ }
+ type = get_attr_text_record_type( text, use_dict );
+
+ if ((hr = write_grow_buffer( writer, 1 )) != S_OK) return hr;
+ write_char( writer, type );
+
+ switch (type)
+ {
+ case RECORD_CHARS8_TEXT:
+ {
+ const WS_XML_UTF8_TEXT *text_utf8;
+ WS_XML_UTF8_TEXT *new = NULL;
+ UINT8 len;
+
+ if (!text)
+ {
+ if ((hr = write_grow_buffer( writer, 1 )) != S_OK) return hr;
+ write_char( writer, 0 );
+ return S_OK;
+ }
+ if (text->textType == WS_XML_TEXT_TYPE_UTF8) text_utf8 = (const WS_XML_UTF8_TEXT *)text;
+ else
+ {
+ if ((hr = text_to_utf8text( text, NULL, NULL, &new )) != S_OK) return hr;
+ text_utf8 = new;
+ }
+ len = text_utf8->value.length;
+ if ((hr = write_grow_buffer( writer, sizeof(len) + len )) != S_OK)
+ {
+ heap_free( new );
+ return hr;
+ }
+ write_char( writer, len );
+ write_bytes( writer, text_utf8->value.bytes, len );
+ heap_free( new );
+ return S_OK;
+ }
+ case RECORD_CHARS16_TEXT:
+ {
+ const WS_XML_UTF8_TEXT *text_utf8;
+ WS_XML_UTF8_TEXT *new = NULL;
+ UINT16 len;
+
+ if (text->textType == WS_XML_TEXT_TYPE_UTF8) text_utf8 = (const WS_XML_UTF8_TEXT *)text;
+ else
+ {
+ if ((hr = text_to_utf8text( text, NULL, NULL, &new )) != S_OK) return hr;
+ text_utf8 = new;
+ }
+ len = text_utf8->value.length;
+ if ((hr = write_grow_buffer( writer, sizeof(len) + len )) != S_OK)
+ {
+ heap_free( new );
+ return hr;
+ }
+ write_bytes( writer, (const BYTE *)&len, sizeof(len) );
+ write_bytes( writer, text_utf8->value.bytes, len );
+ heap_free( new );
+ return S_OK;
+ }
+ case RECORD_BYTES8_TEXT:
+ {
+ WS_XML_BASE64_TEXT *text_base64 = (WS_XML_BASE64_TEXT *)text;
+ if ((hr = write_grow_buffer( writer, 1 + text_base64->length )) != S_OK) return hr;
+ write_char( writer, text_base64->length );
+ write_bytes( writer, text_base64->bytes, text_base64->length );
+ return S_OK;
+ }
+ case RECORD_BYTES16_TEXT:
+ {
+ WS_XML_BASE64_TEXT *text_base64 = (WS_XML_BASE64_TEXT *)text;
+ UINT16 len = text_base64->length;
+ if ((hr = write_grow_buffer( writer, sizeof(len) + len )) != S_OK) return hr;
+ write_bytes( writer, (const BYTE *)&len, sizeof(len) );
+ write_bytes( writer, text_base64->bytes, len );
+ return S_OK;
+ }
+ case RECORD_ZERO_TEXT:
+ case RECORD_ONE_TEXT:
+ case RECORD_FALSE_TEXT:
+ case RECORD_TRUE_TEXT:
+ return S_OK;
+
+ case RECORD_INT8_TEXT:
+ {
+ INT8 val = get_text_value_int( text );
+ if ((hr = write_grow_buffer( writer, sizeof(val) )) != S_OK) return hr;
+ write_char( writer, val );
+ return S_OK;
+ }
+ case RECORD_INT16_TEXT:
+ {
+ INT16 val = get_text_value_int( text );
+ if ((hr = write_grow_buffer( writer, sizeof(val) )) != S_OK) return hr;
+ write_bytes( writer, (const BYTE *)&val, sizeof(val) );
+ return S_OK;
+ }
+ case RECORD_INT32_TEXT:
+ {
+ INT32 val = get_text_value_int( text );
+ if ((hr = write_grow_buffer( writer, sizeof(val) )) != S_OK) return hr;
+ write_bytes( writer, (const BYTE *)&val, sizeof(val) );
+ return S_OK;
+ }
+ case RECORD_INT64_TEXT:
+ {
+ INT64 val = get_text_value_int( text );
+ if ((hr = write_grow_buffer( writer, sizeof(val) )) != S_OK) return hr;
+ write_bytes( writer, (const BYTE *)&val, sizeof(val) );
+ return S_OK;
+ }
+ case RECORD_UINT64_TEXT:
+ {
+ WS_XML_UINT64_TEXT *text_uint64 = (WS_XML_UINT64_TEXT *)text;
+ if ((hr = write_grow_buffer( writer, sizeof(text_uint64->value) )) != S_OK) return hr;
+ write_bytes( writer, (const BYTE *)&text_uint64->value, sizeof(text_uint64->value) );
+ return S_OK;
+ }
+ case RECORD_DOUBLE_TEXT:
+ {
+ WS_XML_DOUBLE_TEXT *text_double = (WS_XML_DOUBLE_TEXT *)text;
+ if ((hr = write_grow_buffer( writer, sizeof(text_double->value) )) != S_OK) return hr;
+ write_bytes( writer, (const BYTE *)&text_double->value, sizeof(text_double->value) );
+ return S_OK;
+ }
+ case RECORD_GUID_TEXT:
+ {
+ WS_XML_GUID_TEXT *text_guid = (WS_XML_GUID_TEXT *)text;
+ if ((hr = write_grow_buffer( writer, sizeof(text_guid->value) )) != S_OK) return hr;
+ write_bytes( writer, (const BYTE *)&text_guid->value, sizeof(text_guid->value) );
+ return S_OK;
+ }
+ case RECORD_UNIQUE_ID_TEXT:
+ {
+ WS_XML_UNIQUE_ID_TEXT *text_unique_id = (WS_XML_UNIQUE_ID_TEXT *)text;
+ if ((hr = write_grow_buffer( writer, sizeof(text_unique_id->value) )) != S_OK) return hr;
+ write_bytes( writer, (const BYTE *)&text_unique_id->value, sizeof(text_unique_id->value) );
+ return S_OK;
+ }
+ case RECORD_DATETIME_TEXT:
+ {
+ WS_XML_DATETIME_TEXT *text_datetime = (WS_XML_DATETIME_TEXT *)text;
+ UINT64 val = text_datetime->value.ticks;
+
+ assert( val <= TICKS_MAX );
+ if (text_datetime->value.format == WS_DATETIME_FORMAT_UTC) val |= (UINT64)1 << 62;
+ else if (text_datetime->value.format == WS_DATETIME_FORMAT_LOCAL) val |= (UINT64)1 << 63;
+
+ if ((hr = write_grow_buffer( writer, sizeof(val) )) != S_OK) return hr;
+ write_bytes( writer, (const BYTE *)&val, sizeof(val) );
+ return S_OK;
+ }
+ default:
+ FIXME( "unhandled record type %02x\n", type );
+ return E_NOTIMPL;
+ }
+}
+
+static enum record_type get_attr_record_type( const WS_XML_ATTRIBUTE *attr, BOOL use_dict )
+{
+ if (!attr->prefix || !attr->prefix->length)
+ {
+ if (use_dict) return RECORD_SHORT_DICTIONARY_ATTRIBUTE;
+ return RECORD_SHORT_ATTRIBUTE;
+ }
if (attr->prefix->length == 1 && attr->prefix->bytes[0] >= 'a' && attr->prefix->bytes[0] <= 'z')
{
if (use_dict) return RECORD_PREFIX_DICTIONARY_ATTRIBUTE_A + attr->prefix->bytes[0] - 'a';
@@ -1584,236 +2006,15 @@ static HRESULT write_add_attribute( struct writer *writer, const WS_XML_STRING *
/**************************************************************************
* WsWriteStartAttribute [webservices.@]
*/
-HRESULT WINAPI WsWriteStartAttribute( WS_XML_WRITER *handle, const WS_XML_STRING *prefix,
- const WS_XML_STRING *localname, const WS_XML_STRING *ns,
- BOOL single, WS_ERROR *error )
-{
- struct writer *writer = (struct writer *)handle;
- HRESULT hr;
-
- TRACE( "%p %s %s %s %d %p\n", handle, debugstr_xmlstr(prefix), debugstr_xmlstr(localname),
- debugstr_xmlstr(ns), single, error );
- if (error) FIXME( "ignoring error parameter\n" );
-
- if (!writer || !localname || !ns) return E_INVALIDARG;
-
- EnterCriticalSection( &writer->cs );
-
- if (writer->magic != WRITER_MAGIC)
- {
- LeaveCriticalSection( &writer->cs );
- return E_INVALIDARG;
- }
-
- if (writer->state != WRITER_STATE_STARTELEMENT)
- {
- LeaveCriticalSection( &writer->cs );
- return WS_E_INVALID_OPERATION;
- }
-
- if ((hr = write_add_attribute( writer, prefix, localname, ns, single )) == S_OK)
- writer->state = WRITER_STATE_STARTATTRIBUTE;
-
- LeaveCriticalSection( &writer->cs );
- return hr;
-}
-
-/* flush current start element if necessary */
-static HRESULT write_flush( struct writer *writer )
-{
- if (writer->state == WRITER_STATE_STARTELEMENT)
- {
- HRESULT hr;
- if ((hr = set_namespaces( writer )) != S_OK) return hr;
- if ((hr = write_startelement( writer )) != S_OK) return hr;
- if ((hr = write_endstartelement( writer )) != S_OK) return hr;
- writer->state = WRITER_STATE_ENDSTARTELEMENT;
- }
- return S_OK;
-}
-
-static HRESULT write_add_cdata_node( struct writer *writer )
-{
- struct node *node, *parent;
- if (!(parent = find_parent( writer ))) return WS_E_INVALID_FORMAT;
- if (!(node = alloc_node( WS_XML_NODE_TYPE_CDATA ))) return E_OUTOFMEMORY;
- write_insert_node( writer, parent, node );
- return S_OK;
-}
-
-static HRESULT write_add_endcdata_node( struct writer *writer )
-{
- struct node *node;
- if (!(node = alloc_node( WS_XML_NODE_TYPE_END_CDATA ))) return E_OUTOFMEMORY;
- node->parent = writer->current;
- list_add_tail( &node->parent->children, &node->entry );
- return S_OK;
-}
-
-static HRESULT write_cdata( struct writer *writer )
-{
- HRESULT hr;
- if ((hr = write_grow_buffer( writer, 9 )) != S_OK) return hr;
- write_bytes( writer, (const BYTE *)"<![CDATA[", 9 );
- return S_OK;
-}
-
-static HRESULT write_cdata_node( struct writer *writer )
-{
- HRESULT hr;
- if ((hr = write_flush( writer )) != S_OK) return hr;
- if ((hr = write_add_cdata_node( writer )) != S_OK) return hr;
- if ((hr = write_add_endcdata_node( writer )) != S_OK) return hr;
- if ((hr = write_cdata( writer )) != S_OK) return hr;
- writer->state = WRITER_STATE_STARTCDATA;
- return S_OK;
-}
-
-/**************************************************************************
- * WsWriteStartCData [webservices.@]
- */
-HRESULT WINAPI WsWriteStartCData( WS_XML_WRITER *handle, WS_ERROR *error )
-{
- struct writer *writer = (struct writer *)handle;
- HRESULT hr;
-
- TRACE( "%p %p\n", handle, error );
- if (error) FIXME( "ignoring error parameter\n" );
-
- if (!writer) return E_INVALIDARG;
-
- EnterCriticalSection( &writer->cs );
-
- if (writer->magic != WRITER_MAGIC)
- {
- LeaveCriticalSection( &writer->cs );
- return E_INVALIDARG;
- }
-
- hr = write_cdata_node( writer );
-
- LeaveCriticalSection( &writer->cs );
- return hr;
-}
-
-static HRESULT write_endcdata( struct writer *writer )
-{
- HRESULT hr;
- if ((hr = write_grow_buffer( writer, 3 )) != S_OK) return hr;
- write_bytes( writer, (const BYTE *)"]]>", 3 );
- return S_OK;
-}
-
-static HRESULT write_endcdata_node( struct writer *writer )
-{
- HRESULT hr;
- if ((hr = write_endcdata( writer )) != S_OK) return hr;
- writer->current = writer->current->parent;
- writer->state = WRITER_STATE_ENDCDATA;
- return S_OK;
-}
-
-/**************************************************************************
- * WsWriteEndCData [webservices.@]
- */
-HRESULT WINAPI WsWriteEndCData( WS_XML_WRITER *handle, WS_ERROR *error )
-{
- struct writer *writer = (struct writer *)handle;
- HRESULT hr;
-
- TRACE( "%p %p\n", handle, error );
- if (error) FIXME( "ignoring error parameter\n" );
-
- if (!writer) return E_INVALIDARG;
-
- EnterCriticalSection( &writer->cs );
-
- if (writer->magic != WRITER_MAGIC)
- {
- LeaveCriticalSection( &writer->cs );
- return E_INVALIDARG;
- }
-
- if (writer->state != WRITER_STATE_TEXT)
- {
- LeaveCriticalSection( &writer->cs );
- return WS_E_INVALID_OPERATION;
- }
-
- hr = write_endcdata_node( writer );
-
- LeaveCriticalSection( &writer->cs );
- return hr;
-}
-
-static HRESULT write_add_element_node( struct writer *writer, const WS_XML_STRING *prefix,
- const WS_XML_STRING *localname, const WS_XML_STRING *ns )
-{
- struct node *node, *parent;
- WS_XML_ELEMENT_NODE *elem;
-
- if (!(parent = find_parent( writer ))) return WS_E_INVALID_FORMAT;
-
- if (!prefix && node_type( parent ) == WS_XML_NODE_TYPE_ELEMENT)
- {
- elem = &parent->hdr;
- if (WsXmlStringEquals( ns, elem->ns, NULL ) == S_OK) prefix = elem->prefix;
- }
-
- if (!(node = alloc_node( WS_XML_NODE_TYPE_ELEMENT ))) return E_OUTOFMEMORY;
- elem = &node->hdr;
-
- if (prefix && !(elem->prefix = dup_xml_string( prefix, writer->dict_do_lookup )))
- {
- free_node( node );
- return E_OUTOFMEMORY;
- }
- if (!(elem->localName = dup_xml_string( localname, writer->dict_do_lookup )))
- {
- free_node( node );
- return E_OUTOFMEMORY;
- }
- if (!(elem->ns = dup_xml_string( ns, writer->dict_do_lookup )))
- {
- free_node( node );
- return E_OUTOFMEMORY;
- }
- write_insert_node( writer, parent, node );
- return S_OK;
-}
-
-static HRESULT write_add_endelement_node( struct writer *writer, struct node *parent )
-{
- struct node *node;
- if (!(node = alloc_node( WS_XML_NODE_TYPE_END_ELEMENT ))) return E_OUTOFMEMORY;
- node->parent = parent;
- list_add_tail( &parent->children, &node->entry );
- return S_OK;
-}
-
-static HRESULT write_element_node( struct writer *writer, const WS_XML_STRING *prefix,
- const WS_XML_STRING *localname, const WS_XML_STRING *ns )
-{
- HRESULT hr;
- if ((hr = write_flush( writer )) != S_OK) return hr;
- if ((hr = write_add_element_node( writer, prefix, localname, ns )) != S_OK) return hr;
- if ((hr = write_add_endelement_node( writer, writer->current )) != S_OK) return hr;
- writer->state = WRITER_STATE_STARTELEMENT;
- return S_OK;
-}
-
-/**************************************************************************
- * WsWriteStartElement [webservices.@]
- */
-HRESULT WINAPI WsWriteStartElement( WS_XML_WRITER *handle, const WS_XML_STRING *prefix,
- const WS_XML_STRING *localname, const WS_XML_STRING *ns,
- WS_ERROR *error )
+HRESULT WINAPI WsWriteStartAttribute( WS_XML_WRITER *handle, const WS_XML_STRING *prefix,
+ const WS_XML_STRING *localname, const WS_XML_STRING *ns,
+ BOOL single, WS_ERROR *error )
{
struct writer *writer = (struct writer *)handle;
HRESULT hr;
- TRACE( "%p %s %s %s %p\n", handle, debugstr_xmlstr(prefix), debugstr_xmlstr(localname),
- debugstr_xmlstr(ns), error );
+ TRACE( "%p %s %s %s %d %p\n", handle, debugstr_xmlstr(prefix), debugstr_xmlstr(localname),
+ debugstr_xmlstr(ns), single, error );
if (error) FIXME( "ignoring error parameter\n" );
if (!writer || !localname || !ns) return E_INVALIDARG;
@@ -1826,394 +2027,231 @@ HRESULT WINAPI WsWriteStartElement( WS_XML_WRITER *handle, const WS_XML_STRING *
return E_INVALIDARG;
}
- hr = write_element_node( writer, prefix, localname, ns );
+ if (writer->state != WRITER_STATE_STARTELEMENT)
+ {
+ LeaveCriticalSection( &writer->cs );
+ return WS_E_INVALID_OPERATION;
+ }
+
+ if ((hr = write_add_attribute( writer, prefix, localname, ns, single )) == S_OK)
+ writer->state = WRITER_STATE_STARTATTRIBUTE;
LeaveCriticalSection( &writer->cs );
return hr;
}
-static ULONG format_bool( const BOOL *ptr, unsigned char *buf )
+/* flush current start element if necessary */
+static HRESULT write_flush( struct writer *writer )
{
- static const unsigned char bool_true[] = {'t','r','u','e'}, bool_false[] = {'f','a','l','s','e'};
- if (*ptr)
+ if (writer->state == WRITER_STATE_STARTELEMENT)
{
- memcpy( buf, bool_true, sizeof(bool_true) );
- return sizeof(bool_true);
+ HRESULT hr;
+ if ((hr = set_namespaces( writer )) != S_OK) return hr;
+ if ((hr = write_startelement( writer )) != S_OK) return hr;
+ if ((hr = write_endstartelement( writer )) != S_OK) return hr;
+ writer->state = WRITER_STATE_ENDSTARTELEMENT;
}
- memcpy( buf, bool_false, sizeof(bool_false) );
- return sizeof(bool_false);
+ return S_OK;
}
-static ULONG format_int32( const INT32 *ptr, unsigned char *buf )
+static HRESULT write_add_cdata_node( struct writer *writer )
{
- return wsprintfA( (char *)buf, "%d", *ptr );
+ struct node *node, *parent;
+ if (!(parent = find_parent( writer ))) return WS_E_INVALID_FORMAT;
+ if (!(node = alloc_node( WS_XML_NODE_TYPE_CDATA ))) return E_OUTOFMEMORY;
+ write_insert_node( writer, parent, node );
+ return S_OK;
}
-static ULONG format_int64( const INT64 *ptr, unsigned char *buf )
+static HRESULT write_add_endcdata_node( struct writer *writer )
{
- return wsprintfA( (char *)buf, "%I64d", *ptr );
+ struct node *node;
+ if (!(node = alloc_node( WS_XML_NODE_TYPE_END_CDATA ))) return E_OUTOFMEMORY;
+ node->parent = writer->current;
+ list_add_tail( &node->parent->children, &node->entry );
+ return S_OK;
}
-static ULONG format_uint64( const UINT64 *ptr, unsigned char *buf )
+static HRESULT write_cdata( struct writer *writer )
{
- return wsprintfA( (char *)buf, "%I64u", *ptr );
+ HRESULT hr;
+ if ((hr = write_grow_buffer( writer, 9 )) != S_OK) return hr;
+ write_bytes( writer, (const BYTE *)"<![CDATA[", 9 );
+ return S_OK;
}
-static ULONG format_double( const double *ptr, unsigned char *buf )
+static HRESULT write_cdata_node( struct writer *writer )
{
-#ifdef HAVE_POWL
- static const long double precision = 0.0000000000000001;
- unsigned char *p = buf;
- long double val = *ptr;
- int neg, mag, mag2, use_exp;
+ HRESULT hr;
+ if ((hr = write_flush( writer )) != S_OK) return hr;
+ if ((hr = write_add_cdata_node( writer )) != S_OK) return hr;
+ if ((hr = write_add_endcdata_node( writer )) != S_OK) return hr;
+ if ((hr = write_cdata( writer )) != S_OK) return hr;
+ writer->state = WRITER_STATE_STARTCDATA;
+ return S_OK;
+}
- if (isnan( val ))
- {
- memcpy( buf, "NaN", 3 );
- return 3;
- }
- if (isinf( val ))
- {
- if (val < 0)
- {
- memcpy( buf, "-INF", 4 );
- return 4;
- }
- memcpy( buf, "INF", 3 );
- return 3;
- }
- if (val == 0.0)
- {
- *p = '0';
- return 1;
- }
+/**************************************************************************
+ * WsWriteStartCData [webservices.@]
+ */
+HRESULT WINAPI WsWriteStartCData( WS_XML_WRITER *handle, WS_ERROR *error )
+{
+ struct writer *writer = (struct writer *)handle;
+ HRESULT hr;
- if ((neg = val < 0))
- {
- *p++ = '-';
- val = -val;
- }
+ TRACE( "%p %p\n", handle, error );
+ if (error) FIXME( "ignoring error parameter\n" );
- mag = log10l( val );
- use_exp = (mag >= 15 || (neg && mag >= 1) || mag <= -1);
- if (use_exp)
- {
- if (mag < 0) mag -= 1;
- val = val / powl( 10.0, mag );
- mag2 = mag;
- mag = 0;
- }
- else if (mag < 1) mag = 0;
+ if (!writer) return E_INVALIDARG;
- while (val > precision || mag >= 0)
- {
- long double weight = powl( 10.0, mag );
- if (weight > 0 && !isinf( weight ))
- {
- int digit = floorl( val / weight );
- val -= digit * weight;
- *(p++) = '0' + digit;
- }
- if (!mag && val > precision) *(p++) = '.';
- mag--;
- }
+ EnterCriticalSection( &writer->cs );
- if (use_exp)
+ if (writer->magic != WRITER_MAGIC)
{
- int i, j;
- *(p++) = 'E';
- if (mag2 > 0) *(p++) = '+';
- else
- {
- *(p++) = '-';
- mag2 = -mag2;
- }
- mag = 0;
- while (mag2 > 0)
- {
- *(p++) = '0' + mag2 % 10;
- mag2 /= 10;
- mag++;
- }
- for (i = -mag, j = -1; i < j; i++, j--)
- {
- p[i] ^= p[j];
- p[j] ^= p[i];
- p[i] ^= p[j];
- }
+ LeaveCriticalSection( &writer->cs );
+ return E_INVALIDARG;
}
- return p - buf;
-#else
- FIXME( "powl not found at build time\n" );
- return 0;
-#endif
-}
+ hr = write_cdata_node( writer );
-static inline int year_size( int year )
-{
- return leap_year( year ) ? 366 : 365;
+ LeaveCriticalSection( &writer->cs );
+ return hr;
}
-#define TZ_OFFSET 8
-static ULONG format_datetime( const WS_DATETIME *ptr, unsigned char *buf )
+static HRESULT write_endcdata( struct writer *writer )
{
- static const char fmt[] = "%04u-%02u-%02uT%02u:%02u:%02u";
- int day, hour, min, sec, sec_frac, month = 0, year = 1, tz_hour;
- unsigned __int64 ticks, day_ticks;
- ULONG len;
-
- if (ptr->format == WS_DATETIME_FORMAT_LOCAL &&
- ptr->ticks >= TICKS_1601_01_01 + TZ_OFFSET * TICKS_PER_HOUR)
- {
- ticks = ptr->ticks - TZ_OFFSET * TICKS_PER_HOUR;
- tz_hour = TZ_OFFSET;
- }
- else
- {
- ticks = ptr->ticks;
- tz_hour = 0;
- }
- day = ticks / TICKS_PER_DAY;
- day_ticks = ticks % TICKS_PER_DAY;
- hour = day_ticks / TICKS_PER_HOUR;
- min = (day_ticks % TICKS_PER_HOUR) / TICKS_PER_MIN;
- sec = (day_ticks % TICKS_PER_MIN) / TICKS_PER_SEC;
- sec_frac = day_ticks % TICKS_PER_SEC;
-
- while (day >= year_size( year ))
- {
- day -= year_size( year );
- year++;
- }
- while (day >= month_days[leap_year( year )][month])
- {
- day -= month_days[leap_year( year )][month];
- month++;
- }
-
- len = sprintf( (char *)buf, fmt, year, month + 1, day + 1, hour, min, sec );
- if (sec_frac)
- {
- static const char fmt_frac[] = ".%07u";
- len += sprintf( (char *)buf + len, fmt_frac, sec_frac );
- while (buf[len - 1] == '0') len--;
- }
- if (ptr->format == WS_DATETIME_FORMAT_UTC)
- {
- buf[len++] = 'Z';
- }
- else if (ptr->format == WS_DATETIME_FORMAT_LOCAL)
- {
- static const char fmt_tz[] = "%c%02u:00";
- len += sprintf( (char *)buf + len, fmt_tz, tz_hour ? '-' : '+', tz_hour );
- }
-
- return len;
+ HRESULT hr;
+ if ((hr = write_grow_buffer( writer, 3 )) != S_OK) return hr;
+ write_bytes( writer, (const BYTE *)"]]>", 3 );
+ return S_OK;
}
-static ULONG format_guid( const GUID *ptr, unsigned char *buf )
+static HRESULT write_endcdata_node( struct writer *writer )
{
- static const char fmt[] = "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x";
- return sprintf( (char *)buf, fmt, ptr->Data1, ptr->Data2, ptr->Data3,
- ptr->Data4[0], ptr->Data4[1], ptr->Data4[2], ptr->Data4[3],
- ptr->Data4[4], ptr->Data4[5], ptr->Data4[6], ptr->Data4[7] );
+ HRESULT hr;
+ if ((hr = write_endcdata( writer )) != S_OK) return hr;
+ writer->current = writer->current->parent;
+ writer->state = WRITER_STATE_ENDCDATA;
+ return S_OK;
}
-static ULONG format_urn( const GUID *ptr, unsigned char *buf )
+/**************************************************************************
+ * WsWriteEndCData [webservices.@]
+ */
+HRESULT WINAPI WsWriteEndCData( WS_XML_WRITER *handle, WS_ERROR *error )
{
- static const char fmt[] = "urn:uuid:%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x";
- return sprintf( (char *)buf, fmt, ptr->Data1, ptr->Data2, ptr->Data3,
- ptr->Data4[0], ptr->Data4[1], ptr->Data4[2], ptr->Data4[3],
- ptr->Data4[4], ptr->Data4[5], ptr->Data4[6], ptr->Data4[7] );
-}
+ struct writer *writer = (struct writer *)handle;
+ HRESULT hr;
+
+ TRACE( "%p %p\n", handle, error );
+ if (error) FIXME( "ignoring error parameter\n" );
+
+ if (!writer) return E_INVALIDARG;
+
+ EnterCriticalSection( &writer->cs );
-static ULONG format_qname( const WS_XML_STRING *prefix, const WS_XML_STRING *localname, unsigned char *buf )
-{
- ULONG len = 0;
- if (prefix && prefix->length)
+ if (writer->magic != WRITER_MAGIC)
{
- memcpy( buf, prefix->bytes, prefix->length );
- len += prefix->length;
- buf[len++] = ':';
+ LeaveCriticalSection( &writer->cs );
+ return E_INVALIDARG;
}
- memcpy( buf + len, localname->bytes, localname->length );
- return len + localname->length;
-}
-
-static ULONG encode_base64( const unsigned char *bin, ULONG len, unsigned char *buf )
-{
- static const char base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- ULONG i = 0, x;
- while (len > 0)
+ if (writer->state != WRITER_STATE_TEXT)
{
- buf[i++] = base64[(bin[0] & 0xfc) >> 2];
- x = (bin[0] & 3) << 4;
- if (len == 1)
- {
- buf[i++] = base64[x];
- buf[i++] = '=';
- buf[i++] = '=';
- break;
- }
- buf[i++] = base64[x | ((bin[1] & 0xf0) >> 4)];
- x = (bin[1] & 0x0f) << 2;
- if (len == 2)
- {
- buf[i++] = base64[x];
- buf[i++] = '=';
- break;
- }
- buf[i++] = base64[x | ((bin[2] & 0xc0) >> 6)];
- buf[i++] = base64[bin[2] & 0x3f];
- bin += 3;
- len -= 3;
+ LeaveCriticalSection( &writer->cs );
+ return WS_E_INVALID_OPERATION;
}
- return i;
+
+ hr = write_endcdata_node( writer );
+
+ LeaveCriticalSection( &writer->cs );
+ return hr;
}
-static HRESULT text_to_utf8text( const WS_XML_TEXT *text, const WS_XML_UTF8_TEXT *old, ULONG *offset,
- WS_XML_UTF8_TEXT **ret )
+static HRESULT write_add_element_node( struct writer *writer, const WS_XML_STRING *prefix,
+ const WS_XML_STRING *localname, const WS_XML_STRING *ns )
{
- ULONG len_old = old ? old->value.length : 0;
- if (offset) *offset = len_old;
+ struct node *node, *parent;
+ WS_XML_ELEMENT_NODE *elem;
- switch (text->textType)
- {
- case WS_XML_TEXT_TYPE_UTF8:
- {
- const WS_XML_UTF8_TEXT *src = (const WS_XML_UTF8_TEXT *)text;
+ if (!(parent = find_parent( writer ))) return WS_E_INVALID_FORMAT;
- if (!(*ret = alloc_utf8_text( NULL, len_old + src->value.length ))) return E_OUTOFMEMORY;
- if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
- memcpy( (*ret)->value.bytes + len_old, src->value.bytes, src->value.length );
- return S_OK;
- }
- case WS_XML_TEXT_TYPE_UTF16:
+ if (!prefix && node_type( parent ) == WS_XML_NODE_TYPE_ELEMENT)
{
- const WS_XML_UTF16_TEXT *src = (const WS_XML_UTF16_TEXT *)text;
- const WCHAR *str = (const WCHAR *)src->bytes;
- ULONG len = src->byteCount / sizeof(WCHAR), len_utf8;
-
- if (src->byteCount % sizeof(WCHAR)) return E_INVALIDARG;
- len_utf8 = WideCharToMultiByte( CP_UTF8, 0, str, len, NULL, 0, NULL, NULL );
- if (!(*ret = alloc_utf8_text( NULL, len_old + len_utf8 ))) return E_OUTOFMEMORY;
- if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
- WideCharToMultiByte( CP_UTF8, 0, str, len, (char *)(*ret)->value.bytes + len_old, len_utf8, NULL, NULL );
- return S_OK;
+ elem = &parent->hdr;
+ if (WsXmlStringEquals( ns, elem->ns, NULL ) == S_OK) prefix = elem->prefix;
}
- case WS_XML_TEXT_TYPE_BASE64:
- {
- const WS_XML_BASE64_TEXT *base64 = (const WS_XML_BASE64_TEXT *)text;
- ULONG len = ((4 * base64->length / 3) + 3) & ~3;
- if (!(*ret = alloc_utf8_text( NULL, len_old + len ))) return E_OUTOFMEMORY;
- if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
- (*ret)->value.length = encode_base64( base64->bytes, base64->length, (*ret)->value.bytes + len_old ) + len_old;
- return S_OK;
- }
- case WS_XML_TEXT_TYPE_BOOL:
- {
- const WS_XML_BOOL_TEXT *bool_text = (const WS_XML_BOOL_TEXT *)text;
+ if (!(node = alloc_node( WS_XML_NODE_TYPE_ELEMENT ))) return E_OUTOFMEMORY;
+ elem = &node->hdr;
- if (!(*ret = alloc_utf8_text( NULL, len_old + 5 ))) return E_OUTOFMEMORY;
- if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
- (*ret)->value.length = format_bool( &bool_text->value, (*ret)->value.bytes + len_old ) + len_old;
- return S_OK;
- }
- case WS_XML_TEXT_TYPE_INT32:
+ if (prefix && !(elem->prefix = dup_xml_string( prefix, writer->dict_do_lookup )))
{
- const WS_XML_INT32_TEXT *int32_text = (const WS_XML_INT32_TEXT *)text;
- unsigned char buf[12]; /* "-2147483648" */
- ULONG len = format_int32( &int32_text->value, buf );
-
- if (!(*ret = alloc_utf8_text( NULL, len_old + len ))) return E_OUTOFMEMORY;
- if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
- memcpy( (*ret)->value.bytes + len_old, buf, len );
- return S_OK;
+ free_node( node );
+ return E_OUTOFMEMORY;
}
- case WS_XML_TEXT_TYPE_INT64:
+ if (!(elem->localName = dup_xml_string( localname, writer->dict_do_lookup )))
{
- const WS_XML_INT64_TEXT *int64_text = (const WS_XML_INT64_TEXT *)text;
- unsigned char buf[21]; /* "-9223372036854775808" */
- ULONG len = format_int64( &int64_text->value, buf );
-
- if (!(*ret = alloc_utf8_text( NULL, len_old + len ))) return E_OUTOFMEMORY;
- if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
- memcpy( (*ret)->value.bytes + len_old, buf, len );
- return S_OK;
+ free_node( node );
+ return E_OUTOFMEMORY;
}
- case WS_XML_TEXT_TYPE_UINT64:
+ if (!(elem->ns = dup_xml_string( ns, writer->dict_do_lookup )))
{
- const WS_XML_UINT64_TEXT *uint64_text = (const WS_XML_UINT64_TEXT *)text;
- unsigned char buf[21]; /* "18446744073709551615" */
- ULONG len = format_uint64( &uint64_text->value, buf );
-
- if (!(*ret = alloc_utf8_text( NULL, len_old + len ))) return E_OUTOFMEMORY;
- if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
- memcpy( (*ret)->value.bytes + len_old, buf, len );
- return S_OK;
+ free_node( node );
+ return E_OUTOFMEMORY;
}
- case WS_XML_TEXT_TYPE_DOUBLE:
- {
- const WS_XML_DOUBLE_TEXT *double_text = (const WS_XML_DOUBLE_TEXT *)text;
- unsigned char buf[32]; /* "-1.1111111111111111E-308", oversized to address Valgrind limitations */
- unsigned short fpword;
- ULONG len;
+ write_insert_node( writer, parent, node );
+ return S_OK;
+}
- if (!set_fpword( 0x37f, &fpword )) return E_NOTIMPL;
- len = format_double( &double_text->value, buf );
- restore_fpword( fpword );
- if (!len) return E_NOTIMPL;
+static HRESULT write_add_endelement_node( struct writer *writer, struct node *parent )
+{
+ struct node *node;
+ if (!(node = alloc_node( WS_XML_NODE_TYPE_END_ELEMENT ))) return E_OUTOFMEMORY;
+ node->parent = parent;
+ list_add_tail( &parent->children, &node->entry );
+ return S_OK;
+}
- if (!(*ret = alloc_utf8_text( NULL, len_old + len ))) return E_OUTOFMEMORY;
- if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
- memcpy( (*ret)->value.bytes + len_old, buf, len );
- return S_OK;
- }
- case WS_XML_TEXT_TYPE_GUID:
- {
- const WS_XML_GUID_TEXT *id = (const WS_XML_GUID_TEXT *)text;
+static HRESULT write_element_node( struct writer *writer, const WS_XML_STRING *prefix,
+ const WS_XML_STRING *localname, const WS_XML_STRING *ns )
+{
+ HRESULT hr;
+ if ((hr = write_flush( writer )) != S_OK) return hr;
+ if ((hr = write_add_element_node( writer, prefix, localname, ns )) != S_OK) return hr;
+ if ((hr = write_add_endelement_node( writer, writer->current )) != S_OK) return hr;
+ writer->state = WRITER_STATE_STARTELEMENT;
+ return S_OK;
+}
- if (!(*ret = alloc_utf8_text( NULL, len_old + 37 ))) return E_OUTOFMEMORY;
- if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
- (*ret)->value.length = format_guid( &id->value, (*ret)->value.bytes + len_old ) + len_old;
- return S_OK;
- }
- case WS_XML_TEXT_TYPE_UNIQUE_ID:
- {
- const WS_XML_UNIQUE_ID_TEXT *id = (const WS_XML_UNIQUE_ID_TEXT *)text;
+/**************************************************************************
+ * WsWriteStartElement [webservices.@]
+ */
+HRESULT WINAPI WsWriteStartElement( WS_XML_WRITER *handle, const WS_XML_STRING *prefix,
+ const WS_XML_STRING *localname, const WS_XML_STRING *ns,
+ WS_ERROR *error )
+{
+ struct writer *writer = (struct writer *)handle;
+ HRESULT hr;
- if (!(*ret = alloc_utf8_text( NULL, len_old + 46 ))) return E_OUTOFMEMORY;
- if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
- (*ret)->value.length = format_urn( &id->value, (*ret)->value.bytes + len_old ) + len_old;
- return S_OK;
- }
- case WS_XML_TEXT_TYPE_DATETIME:
- {
- const WS_XML_DATETIME_TEXT *dt = (const WS_XML_DATETIME_TEXT *)text;
+ TRACE( "%p %s %s %s %p\n", handle, debugstr_xmlstr(prefix), debugstr_xmlstr(localname),
+ debugstr_xmlstr(ns), error );
+ if (error) FIXME( "ignoring error parameter\n" );
- if (!(*ret = alloc_utf8_text( NULL, len_old + 34 ))) return E_OUTOFMEMORY;
- if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
- (*ret)->value.length = format_datetime( &dt->value, (*ret)->value.bytes + len_old ) + len_old;
- return S_OK;
- }
- case WS_XML_TEXT_TYPE_QNAME:
- {
- const WS_XML_QNAME_TEXT *qn = (const WS_XML_QNAME_TEXT *)text;
- ULONG len = qn->localName->length;
+ if (!writer || !localname || !ns) return E_INVALIDARG;
- if (qn->prefix && qn->prefix->length) len += qn->prefix->length + 1;
- if (!(*ret = alloc_utf8_text( NULL, len_old + len ))) return E_OUTOFMEMORY;
- if (old) memcpy( (*ret)->value.bytes, old->value.bytes, len_old );
- (*ret)->value.length = format_qname( qn->prefix, qn->localName, (*ret)->value.bytes + len_old ) + len_old;
- return S_OK;
- }
- default:
- FIXME( "unhandled text type %u\n", text->textType );
- return E_NOTIMPL;
+ EnterCriticalSection( &writer->cs );
+
+ if (writer->magic != WRITER_MAGIC)
+ {
+ LeaveCriticalSection( &writer->cs );
+ return E_INVALIDARG;
}
+
+ hr = write_element_node( writer, prefix, localname, ns );
+
+ LeaveCriticalSection( &writer->cs );
+ return hr;
}
static HRESULT text_to_text( const WS_XML_TEXT *text, const WS_XML_TEXT *old, ULONG *offset, WS_XML_TEXT **ret )
@@ -2238,16 +2276,14 @@ static HRESULT text_to_text( const WS_XML_TEXT *text, const WS_XML_TEXT *old, UL
case WS_XML_TEXT_TYPE_UTF16:
{
const WS_XML_UTF16_TEXT *utf16 = (const WS_XML_UTF16_TEXT *)text;
- const WS_XML_UTF8_TEXT *utf8_old = (const WS_XML_UTF8_TEXT *)old;
- WS_XML_UTF8_TEXT *new;
- const WCHAR *str = (const WCHAR *)utf16->bytes;
- ULONG len = utf16->byteCount / sizeof(WCHAR), len_utf8, len_old = utf8_old ? utf8_old->value.length : 0;
+ const WS_XML_UTF16_TEXT *utf16_old = (const WS_XML_UTF16_TEXT *)old;
+ WS_XML_UTF16_TEXT *new;
+ ULONG len = utf16->byteCount, len_old = utf16_old ? utf16_old->byteCount : 0;
if (utf16->byteCount % sizeof(WCHAR)) return E_INVALIDARG;
- len_utf8 = WideCharToMultiByte( CP_UTF8, 0, str, len, NULL, 0, NULL, NULL );
- if (!(new = alloc_utf8_text( NULL, len_old + len_utf8 ))) return E_OUTOFMEMORY;
- if (old) memcpy( new->value.bytes, utf8_old->value.bytes, len_old );
- WideCharToMultiByte( CP_UTF8, 0, str, len, (char *)new->value.bytes + len_old, len_utf8, NULL, NULL );
+ if (!(new = alloc_utf16_text( NULL, len_old + len ))) return E_OUTOFMEMORY;
+ if (utf16_old) memcpy( new->bytes, utf16_old->bytes, len_old );
+ memcpy( new->bytes + len_old, utf16->bytes, len );
if (offset) *offset = len_old;
*ret = &new->text;
return S_OK;
@@ -2477,6 +2513,15 @@ static enum record_type get_text_record_type( const WS_XML_TEXT *text, BOOL use_
if (text_utf8->value.length <= MAX_UINT16) return RECORD_CHARS16_TEXT_WITH_ENDELEMENT;
return RECORD_CHARS32_TEXT_WITH_ENDELEMENT;
}
+ case WS_XML_TEXT_TYPE_UTF16:
+ {
+ const WS_XML_UTF16_TEXT *text_utf16 = (const WS_XML_UTF16_TEXT *)text;
+ int len = text_utf16->byteCount / sizeof(WCHAR);
+ int len_utf8 = WideCharToMultiByte( CP_UTF8, 0, (const WCHAR *)text_utf16->bytes, len, NULL, 0, NULL, NULL );
+ if (len_utf8 <= MAX_UINT8) return RECORD_CHARS8_TEXT_WITH_ENDELEMENT;
+ if (len_utf8 <= MAX_UINT16) return RECORD_CHARS16_TEXT_WITH_ENDELEMENT;
+ return RECORD_CHARS32_TEXT_WITH_ENDELEMENT;
+ }
case WS_XML_TEXT_TYPE_BASE64:
{
const WS_XML_BASE64_TEXT *text_base64 = (const WS_XML_BASE64_TEXT *)text;
@@ -2570,24 +2615,50 @@ static HRESULT write_text_bin( struct writer *writer, const WS_XML_TEXT *text, U
{
case RECORD_CHARS8_TEXT_WITH_ENDELEMENT:
{
- const WS_XML_UTF8_TEXT *text_utf8 = (const WS_XML_UTF8_TEXT *)text;
- UINT8 len = text_utf8->value.length;
+ const WS_XML_UTF8_TEXT *text_utf8;
+ WS_XML_UTF8_TEXT *new = NULL;
+ UINT8 len;
- if ((hr = write_grow_buffer( writer, 1 + sizeof(len) + len )) != S_OK) return hr;
+ if (text->textType == WS_XML_TEXT_TYPE_UTF8) text_utf8 = (const WS_XML_UTF8_TEXT *)text;
+ else
+ {
+ if ((hr = text_to_utf8text( text, NULL, NULL, &new )) != S_OK) return hr;
+ text_utf8 = new;
+ }
+ len = text_utf8->value.length;
+ if ((hr = write_grow_buffer( writer, 1 + sizeof(len) + len )) != S_OK)
+ {
+ heap_free( new );
+ return hr;
+ }
write_char( writer, type );
write_char( writer, len );
write_bytes( writer, text_utf8->value.bytes, len );
+ heap_free( new );
return S_OK;
}
case RECORD_CHARS16_TEXT_WITH_ENDELEMENT:
{
- const WS_XML_UTF8_TEXT *text_utf8 = (const WS_XML_UTF8_TEXT *)text;
- UINT16 len = text_utf8->value.length;
+ const WS_XML_UTF8_TEXT *text_utf8;
+ WS_XML_UTF8_TEXT *new = NULL;
+ UINT16 len;
- if ((hr = write_grow_buffer( writer, 1 + sizeof(len) + len )) != S_OK) return hr;
+ if (text->textType == WS_XML_TEXT_TYPE_UTF8) text_utf8 = (const WS_XML_UTF8_TEXT *)text;
+ else
+ {
+ if ((hr = text_to_utf8text( text, NULL, NULL, &new )) != S_OK) return hr;
+ text_utf8 = new;
+ }
+ len = text_utf8->value.length;
+ if ((hr = write_grow_buffer( writer, 1 + sizeof(len) + len )) != S_OK)
+ {
+ heap_free( new );
+ return hr;
+ }
write_char( writer, type );
write_bytes( writer, (const BYTE *)&len, sizeof(len) );
write_bytes( writer, text_utf8->value.bytes, len );
+ heap_free( new );
return S_OK;
}
case RECORD_BYTES8_TEXT:
--
2.11.0
1
0
[PATCH 4/5] webservices: Enable dictionary lookup after setting the output buffer.
by Hans Leidekker 08 Dec '17
by Hans Leidekker 08 Dec '17
08 Dec '17
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/webservices/channel.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/dlls/webservices/channel.c b/dlls/webservices/channel.c
index cce56087b9..0765e0dc6b 100644
--- a/dlls/webservices/channel.c
+++ b/dlls/webservices/channel.c
@@ -1233,9 +1233,8 @@ static HRESULT CALLBACK dict_cb( void *state, const WS_XML_STRING *str, BOOL *fo
static HRESULT init_writer( struct channel *channel )
{
WS_XML_WRITER_BUFFER_OUTPUT buf = {{WS_XML_WRITER_OUTPUT_TYPE_BUFFER}};
- WS_XML_WRITER_TEXT_ENCODING text = {{WS_XML_WRITER_ENCODING_TYPE_TEXT}};
+ WS_XML_WRITER_TEXT_ENCODING text = {{WS_XML_WRITER_ENCODING_TYPE_TEXT}, WS_CHARSET_UTF8};
WS_XML_WRITER_BINARY_ENCODING bin = {{WS_XML_WRITER_ENCODING_TYPE_BINARY}};
- WS_XML_WRITER_ENCODING *encoding;
HRESULT hr;
if (!channel->writer && (hr = WsCreateWriter( NULL, 0, &channel->writer, NULL )) != S_OK) return hr;
@@ -1243,29 +1242,23 @@ static HRESULT init_writer( struct channel *channel )
switch (channel->encoding)
{
case WS_ENCODING_XML_UTF8:
- text.charSet = WS_CHARSET_UTF8;
- encoding = &text.encoding;
- break;
+ return WsSetOutput( channel->writer, &text.encoding, &buf.output, NULL, 0, NULL );
case WS_ENCODING_XML_BINARY_SESSION_1:
- if ((hr = writer_enable_lookup( channel->writer )) != S_OK) return hr;
clear_dict( &channel->dict_send );
bin.staticDictionary = (WS_XML_DICTIONARY *)&dict_builtin_static.dict;
bin.dynamicStringCallback = dict_cb;
bin.dynamicStringCallbackState = &channel->dict_send;
- encoding = &bin.encoding;
- break;
+ if ((hr = WsSetOutput( channel->writer, &bin.encoding, &buf.output, NULL, 0, NULL )) != S_OK) return hr;
+ return writer_enable_lookup( channel->writer );
case WS_ENCODING_XML_BINARY_1:
- encoding = &bin.encoding;
- break;
+ return WsSetOutput( channel->writer, &bin.encoding, &buf.output, NULL, 0, NULL );
default:
FIXME( "unhandled encoding %u\n", channel->encoding );
return WS_E_NOT_SUPPORTED;
}
-
- return WsSetOutput( channel->writer, encoding, &buf.output, NULL, 0, NULL );
}
/**************************************************************************
--
2.11.0
1
0