Wine-Devel
Threads by month
- ----- 2026 -----
- April
- 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
- 12 participants
- 84522 discussions
[PATCH v4 1/6] d3d8/tests: Test for window changes when it's not active.
by Gabriel Ivăncescu Jan. 12, 2022
by Gabriel Ivăncescu Jan. 12, 2022
Jan. 12, 2022
Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com>
---
I'm sending these tests first to show the behavior across d3d versions. I do
not plan to fix them during code freeze, except for ddraw, since I'm not aware
of any regressions due to them. I might fix them after code freeze though.
dlls/d3d8/tests/device.c | 195 +++++++++++++++++++++++++++++++++++++++
1 file changed, 195 insertions(+)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index fc94dca..3d58628 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -3943,6 +3943,7 @@ static void test_window_style(void)
struct device_desc device_desc;
LONG style, expected_style;
IDirect3DDevice8 *device;
+ HWND active_window;
IDirect3D8 *d3d8;
HRESULT hr;
ULONG ref;
@@ -4055,6 +4056,200 @@ static void test_window_style(void)
ref = IDirect3DDevice8_Release(device);
ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);
+ DestroyWindow(device_window);
+ DestroyWindow(focus_window);
+
+ /* Window changes are done only if the current thread has the foreground window at creation */
+ focus_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0);
+ device_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0);
+ active_window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ 10, 20, 30, 40, 0, 0, 0, 0);
+
+ device_style = GetWindowLongA(device_window, GWL_STYLE);
+ device_exstyle = GetWindowLongA(device_window, GWL_EXSTYLE);
+ focus_style = GetWindowLongA(focus_window, GWL_STYLE);
+ focus_exstyle = GetWindowLongA(focus_window, GWL_EXSTYLE);
+
+ ret = SetForegroundWindow(active_window);
+ ok(ret, "Failed to set foreground window.\n");
+ ok(GetActiveWindow() == active_window, "Unexpected active window.\n");
+
+ device_desc.device_window = device_window;
+ device_desc.flags = CREATE_DEVICE_FULLSCREEN;
+ device = create_device(d3d8, focus_window, &device_desc);
+ ok(!!device, "Failed to create a D3D device.\n");
+
+ style = GetWindowLongA(device_window, GWL_STYLE);
+ todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window style %#x, got %#x.\n", device_style, style);
+ style = GetWindowLongA(device_window, GWL_EXSTYLE);
+ expected_style = device_exstyle | WS_EX_TOPMOST;
+ todo_wine ok(style == expected_style || broken(style == (expected_style & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window extended style %#x, got %#x.\n", expected_style, style);
+
+ style = GetWindowLongA(focus_window, GWL_STYLE);
+ ok(style == focus_style, "Expected focus window style %#x, got %#x.\n", focus_style, style);
+ style = GetWindowLongA(focus_window, GWL_EXSTYLE);
+ ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x.\n", focus_exstyle, style);
+
+ device_desc.flags = 0;
+ hr = reset_device(device, &device_desc);
+ ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
+
+ ret = SetForegroundWindow(GetDesktopWindow());
+ ok(ret, "Failed to set foreground window.\n");
+ device_desc.flags = CREATE_DEVICE_FULLSCREEN;
+ hr = reset_device(device, &device_desc);
+ ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
+ ShowWindow(device_window, SW_SHOWNOACTIVATE);
+
+ style = GetWindowLongA(device_window, GWL_STYLE);
+ todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window style %#x, got %#x.\n", device_style, style);
+ style = GetWindowLongA(device_window, GWL_EXSTYLE);
+ expected_style = device_exstyle | WS_EX_TOPMOST;
+ todo_wine ok(style == expected_style || broken(style == (expected_style & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window extended style %#x, got %#x.\n", expected_style, style);
+ GetWindowRect(device_window, &r);
+ ok(EqualRect(&r, &fullscreen_rect), "Expected %s, got %s.\n", wine_dbgstr_rect(&fullscreen_rect), wine_dbgstr_rect(&r));
+
+ ref = IDirect3DDevice8_Release(device);
+ ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);
+ DestroyWindow(active_window);
+ DestroyWindow(device_window);
+ DestroyWindow(focus_window);
+
+ focus_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0);
+ device_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0);
+
+ device_style = GetWindowLongA(device_window, GWL_STYLE);
+ device_exstyle = GetWindowLongA(device_window, GWL_EXSTYLE);
+ focus_style = GetWindowLongA(focus_window, GWL_STYLE);
+ focus_exstyle = GetWindowLongA(focus_window, GWL_EXSTYLE);
+
+ ret = SetForegroundWindow(GetDesktopWindow());
+ ok(ret, "Failed to set foreground window.\n");
+ SetActiveWindow(focus_window);
+ ok(GetActiveWindow() == focus_window, "Unexpected active window.\n");
+
+ device_desc.device_window = device_window;
+ device_desc.flags = CREATE_DEVICE_FULLSCREEN;
+ device = create_device(d3d8, focus_window, &device_desc);
+ ok(!!device, "Failed to create a D3D device.\n");
+ ShowWindow(device_window, SW_SHOWNOACTIVATE);
+
+ /* Windows 8 and some versions of Windows 10 have some pretty
+ inconsistent behavior but topmost is set even when inactive. */
+ style = GetWindowLongA(device_window, GWL_EXSTYLE);
+ if (broken(style & WS_EX_TOPMOST))
+ {
+ win_skip("topmost set when inactive due to inconsistent behavior, skipping related tests...\n");
+ goto skip_inactive;
+ }
+ todo_wine ok(style == device_exstyle || broken(style == (device_exstyle & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window extended style %#x, got %#x.\n", device_exstyle, style);
+ style = GetWindowLongA(device_window, GWL_STYLE);
+ todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window style %#x, got %#x.\n", device_style, style);
+
+ style = GetWindowLongA(focus_window, GWL_STYLE);
+ ok(style == focus_style, "Expected focus window style %#x, got %#x.\n", focus_style, style);
+ style = GetWindowLongA(focus_window, GWL_EXSTYLE);
+ ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x.\n", focus_exstyle, style);
+
+ device_desc.flags = 0;
+ hr = reset_device(device, &device_desc);
+ ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
+
+ ret = SetForegroundWindow(GetDesktopWindow());
+ ok(ret, "Failed to set foreground window.\n");
+ SetActiveWindow(focus_window);
+ ok(GetActiveWindow() == focus_window, "Unexpected active window.");
+ device_desc.flags = CREATE_DEVICE_FULLSCREEN;
+ hr = reset_device(device, &device_desc);
+ ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
+
+ style = GetWindowLongA(device_window, GWL_STYLE);
+ todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window style %#x, got %#x.\n", device_style, style);
+ style = GetWindowLongA(device_window, GWL_EXSTYLE);
+ todo_wine ok(style == device_exstyle || broken(style == (device_exstyle & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window extended style %#x, got %#x.\n", device_exstyle, style);
+ GetWindowRect(device_window, &r);
+ ok(EqualRect(&r, &fullscreen_rect), "Expected %s, got %s.\n", wine_dbgstr_rect(&fullscreen_rect), wine_dbgstr_rect(&r));
+
+ SetForegroundWindow(focus_window);
+ ok(ret, "Failed to set foreground window.\n");
+ hr = reset_device(device, &device_desc);
+ ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
+
+ style = GetWindowLongA(device_window, GWL_STYLE);
+ todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window style %#x, got %#x.\n", device_style, style);
+ style = GetWindowLongA(device_window, GWL_EXSTYLE);
+ todo_wine ok(style == device_exstyle || broken(style == (device_exstyle & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window extended style %#x, got %#x.\n", device_exstyle, style);
+
+ device_desc.flags = 0;
+ hr = reset_device(device, &device_desc);
+ ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
+
+ device_desc.flags = CREATE_DEVICE_FULLSCREEN;
+ hr = reset_device(device, &device_desc);
+ ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
+
+ style = GetWindowLongA(device_window, GWL_STYLE);
+ todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window style %#x, got %#x.\n", device_style, style);
+ style = GetWindowLongA(device_window, GWL_EXSTYLE);
+ todo_wine ok(style == device_exstyle || broken(style == (device_exstyle & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window extended style %#x, got %#x.\n", device_exstyle, style);
+
+ ref = IDirect3DDevice8_Release(device);
+ ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);
+ DestroyWindow(device_window);
+ DestroyWindow(focus_window);
+
+ focus_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0);
+ device_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0);
+
+ device_style = GetWindowLongA(device_window, GWL_STYLE);
+ device_exstyle = GetWindowLongA(device_window, GWL_EXSTYLE);
+ focus_style = GetWindowLongA(focus_window, GWL_STYLE);
+ focus_exstyle = GetWindowLongA(focus_window, GWL_EXSTYLE);
+
+ ret = SetForegroundWindow(GetDesktopWindow());
+ ok(ret, "Failed to set foreground window.\n");
+ SetActiveWindow(device_window);
+ ok(GetActiveWindow() == device_window, "Unexpected active window.\n");
+
+ device_desc.device_window = device_window;
+ device_desc.flags = CREATE_DEVICE_FULLSCREEN;
+ device = create_device(d3d8, focus_window, &device_desc);
+ ok(!!device, "Failed to create a D3D device.\n");
+ ShowWindow(device_window, SW_SHOWNOACTIVATE);
+
+ style = GetWindowLongA(device_window, GWL_STYLE);
+ todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window style %#x, got %#x.\n", device_style, style);
+ style = GetWindowLongA(device_window, GWL_EXSTYLE);
+ todo_wine ok(style == device_exstyle || broken(style == (device_exstyle & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */,
+ "Expected device window extended style %#x, got %#x.\n", device_exstyle, style);
+
+ style = GetWindowLongA(focus_window, GWL_STYLE);
+ ok(style == focus_style, "Expected focus window style %#x, got %#x.\n", focus_style, style);
+ style = GetWindowLongA(focus_window, GWL_EXSTYLE);
+ ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x.\n", focus_exstyle, style);
+
+skip_inactive:
+ ref = IDirect3DDevice8_Release(device);
+ ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);
done:
IDirect3D8_Release(d3d8);
--
2.34.1
3
16
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51017
Debugging sessions and the official WinRT SDK show, that hstrings
are aligned differently in memory, than they are currently used in Wine.
E.g. The string buffer is stored at the end of hstring_private.
Also if a string reference is created with WindowsCreateStringReference,
a seperate pointer is used to point at the string-source.
Signed-off-by: Bernhard Kölbl <besentv(a)gmail.com>
---
v4: Remove leftover debugging TRACE and minor style changes.
v3: Add nested hstring_header struct to hstring_private and add a test for both.
v2: I was mistaken about no reference counting being used.
---
dlls/combase/string.c | 126 ++++++++++++++++++++++--------------
dlls/combase/tests/string.c | 73 ++++++++++++++++++++-
2 files changed, 150 insertions(+), 49 deletions(-)
diff --git a/dlls/combase/string.c b/dlls/combase/string.c
index 2092e4360a3..1677915c244 100644
--- a/dlls/combase/string.c
+++ b/dlls/combase/string.c
@@ -26,44 +26,58 @@
WINE_DEFAULT_DEBUG_CHANNEL(winstring);
-struct hstring_private
+#define HSTRING_REFERENCE_FLAG 1
+
+struct hstring_header
{
- LPWSTR buffer;
+ UINT32 flags;
UINT32 length;
- BOOL reference;
- LONG refcount;
+ UINT32 padding1;
+ UINT32 padding2;
+ const WCHAR *ptr;
};
+struct hstring_private
+{
+ struct hstring_header header;
+ LONG refcount;
+ WCHAR buffer[1];
+};
+
+
static const WCHAR empty[1];
-C_ASSERT(sizeof(struct hstring_private) <= sizeof(HSTRING_HEADER));
+C_ASSERT(sizeof(struct hstring_header) <= sizeof(HSTRING_HEADER));
static inline struct hstring_private *impl_from_HSTRING(HSTRING string)
{
- return (struct hstring_private *)string;
+ return (struct hstring_private *)string;
}
static inline struct hstring_private *impl_from_HSTRING_HEADER(HSTRING_HEADER *header)
{
- return (struct hstring_private *)header;
+ return CONTAINING_RECORD(header, struct hstring_private, header);
}
static inline struct hstring_private *impl_from_HSTRING_BUFFER(HSTRING_BUFFER buffer)
{
- return (struct hstring_private *)buffer;
+ return CONTAINING_RECORD(buffer, struct hstring_private, buffer);
}
static BOOL alloc_string(UINT32 len, HSTRING *out)
{
struct hstring_private *priv;
- priv = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv) + (len + 1) * sizeof(*priv->buffer));
+ priv = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv) + len * sizeof(*priv->buffer));
if (!priv)
return FALSE;
- priv->buffer = (LPWSTR)(priv + 1);
- priv->length = len;
- priv->reference = FALSE;
+
+ priv->header.flags = 0;
+ priv->header.length = len;
+ priv->header.ptr = priv->buffer;
+
priv->refcount = 1;
priv->buffer[len] = '\0';
+
*out = (HSTRING)priv;
return TRUE;
}
@@ -115,10 +129,12 @@ HRESULT WINAPI WindowsCreateStringReference(LPCWSTR ptr, UINT32 len,
}
if (ptr == NULL)
return E_POINTER;
- priv->buffer = (LPWSTR)ptr;
- priv->length = len;
- priv->reference = TRUE;
- *out = (HSTRING)header;
+
+ priv->header.ptr = (LPWSTR)ptr;
+ priv->header.length = len;
+ priv->header.flags = HSTRING_REFERENCE_FLAG;
+
+ *out = (HSTRING)priv;
return S_OK;
}
@@ -127,16 +143,21 @@ HRESULT WINAPI WindowsCreateStringReference(LPCWSTR ptr, UINT32 len,
*/
HRESULT WINAPI WindowsDeleteString(HSTRING str)
{
- struct hstring_private *priv = impl_from_HSTRING(str);
+ struct hstring_private *priv;
TRACE("(%p)\n", str);
if (str == NULL)
return S_OK;
- if (priv->reference)
+
+ priv = impl_from_HSTRING(str);
+
+ if(priv->header.flags == HSTRING_REFERENCE_FLAG)
return S_OK;
+
if (InterlockedDecrement(&priv->refcount) == 0)
HeapFree(GetProcessHeap(), 0, priv);
+
return S_OK;
}
@@ -156,8 +177,8 @@ HRESULT WINAPI WindowsDuplicateString(HSTRING str, HSTRING *out)
*out = NULL;
return S_OK;
}
- if (priv->reference)
- return WindowsCreateString(priv->buffer, priv->length, out);
+ if (priv->header.flags == HSTRING_REFERENCE_FLAG)
+ return WindowsCreateString(priv->header.ptr, priv->header.length, out);
InterlockedIncrement(&priv->refcount);
*out = str;
return S_OK;
@@ -187,7 +208,7 @@ HRESULT WINAPI WindowsPreallocateStringBuffer(UINT32 len, WCHAR **outptr,
return E_OUTOFMEMORY;
priv = impl_from_HSTRING(str);
*outptr = priv->buffer;
- *out = (HSTRING_BUFFER)str;
+ *out = (HSTRING_BUFFER)&priv->buffer;
return S_OK;
}
@@ -196,9 +217,17 @@ HRESULT WINAPI WindowsPreallocateStringBuffer(UINT32 len, WCHAR **outptr,
*/
HRESULT WINAPI WindowsDeleteStringBuffer(HSTRING_BUFFER buf)
{
+
+ struct hstring_private *priv;
+
TRACE("(%p)\n", buf);
- return WindowsDeleteString((HSTRING)buf);
+ if(buf)
+ priv = impl_from_HSTRING_BUFFER(buf);
+ else
+ priv = NULL;
+
+ return WindowsDeleteString((HSTRING)priv);
}
/***********************************************************************
@@ -217,9 +246,9 @@ HRESULT WINAPI WindowsPromoteStringBuffer(HSTRING_BUFFER buf, HSTRING *out)
*out = NULL;
return S_OK;
}
- if (priv->buffer[priv->length] != 0 || priv->reference || priv->refcount != 1)
+ if (priv->buffer[priv->header.length] != 0 || priv->header.flags == HSTRING_REFERENCE_FLAG || priv->refcount != 1)
return E_INVALIDARG;
- *out = (HSTRING)buf;
+ *out = (HSTRING)priv;
return S_OK;
}
@@ -234,7 +263,7 @@ UINT32 WINAPI WindowsGetStringLen(HSTRING str)
if (str == NULL)
return 0;
- return priv->length;
+ return priv->header.length;
}
/***********************************************************************
@@ -253,8 +282,9 @@ LPCWSTR WINAPI WindowsGetStringRawBuffer(HSTRING str, UINT32 *len)
return empty;
}
if (len)
- *len = priv->length;
- return priv->buffer;
+ *len = priv->header.length;
+
+ return priv->header.ptr;
}
/***********************************************************************
@@ -274,9 +304,9 @@ HRESULT WINAPI WindowsStringHasEmbeddedNull(HSTRING str, BOOL *out)
*out = FALSE;
return S_OK;
}
- for (i = 0; i < priv->length; i++)
+ for (i = 0; i < (priv->header.length); i++)
{
- if (priv->buffer[i] == '\0')
+ if (priv->header.ptr[i] == '\0')
{
*out = TRUE;
return S_OK;
@@ -305,7 +335,7 @@ HRESULT WINAPI WindowsSubstring(HSTRING str, UINT32 start, HSTRING *out)
*out = NULL;
return S_OK;
}
- return WindowsCreateString(&priv->buffer[start], len - start, out);
+ return WindowsCreateString(&priv->header.ptr[start], len - start, out);
}
/***********************************************************************
@@ -327,7 +357,7 @@ HRESULT WINAPI WindowsSubstringWithSpecifiedLength(HSTRING str, UINT32 start, UI
*out = NULL;
return S_OK;
}
- return WindowsCreateString(&priv->buffer[start], len, out);
+ return WindowsCreateString(&priv->header.ptr[start], len, out);
}
/***********************************************************************
@@ -347,16 +377,16 @@ HRESULT WINAPI WindowsConcatString(HSTRING str1, HSTRING str2, HSTRING *out)
return WindowsDuplicateString(str2, out);
if (str2 == NULL)
return WindowsDuplicateString(str1, out);
- if (!priv1->length && !priv2->length)
+ if (!priv1->header.length && !priv2->header.length)
{
*out = NULL;
return S_OK;
}
- if (!alloc_string(priv1->length + priv2->length, out))
+ if (!alloc_string(priv1->header.length + priv2->header.length, out))
return E_OUTOFMEMORY;
priv = impl_from_HSTRING(*out);
- memcpy(priv->buffer, priv1->buffer, priv1->length * sizeof(*priv1->buffer));
- memcpy(priv->buffer + priv1->length, priv2->buffer, priv2->length * sizeof(*priv2->buffer));
+ memcpy(priv->buffer, priv1->header.ptr, priv1->header.length * sizeof(*priv1->buffer));
+ memcpy(priv->buffer + priv1->header.length, priv2->header.ptr, priv2->header.length * sizeof(*priv2->buffer));
return S_OK;
}
@@ -371,7 +401,7 @@ BOOL WINAPI WindowsIsStringEmpty(HSTRING str)
if (str == NULL)
return TRUE;
- return priv->length == 0;
+ return priv->header.length == 0;
}
/***********************************************************************
@@ -395,13 +425,13 @@ HRESULT WINAPI WindowsCompareStringOrdinal(HSTRING str1, HSTRING str2, INT32 *re
}
if (str1)
{
- buf1 = priv1->buffer;
- len1 = priv1->length;
+ buf1 = priv1->header.ptr;
+ len1 = priv1->header.length;
}
if (str2)
{
- buf2 = priv2->buffer;
- len2 = priv2->length;
+ buf2 = priv2->header.ptr;
+ len2 = priv2->header.length;
}
*res = CompareStringOrdinal(buf1, len1, buf2, len2, FALSE) - CSTR_EQUAL;
return S_OK;
@@ -418,19 +448,19 @@ HRESULT WINAPI WindowsTrimStringStart(HSTRING str1, HSTRING str2, HSTRING *out)
TRACE("(%p, %p, %p)\n", str1, str2, out);
- if (!out || !str2 || !priv2->length)
+ if (!out || !str2 || !priv2->header.length)
return E_INVALIDARG;
if (!str1)
{
*out = NULL;
return S_OK;
}
- for (start = 0; start < priv1->length; start++)
+ for (start = 0; start < priv1->header.length; start++)
{
- if (!wmemchr(priv2->buffer, priv1->buffer[start], priv2->length))
+ if (!wmemchr(priv2->header.ptr, priv1->header.ptr[start], priv2->header.length))
break;
}
- return start ? WindowsCreateString(&priv1->buffer[start], priv1->length - start, out) :
+ return start ? WindowsCreateString(&priv1->header.ptr[start], priv1->header.length - start, out) :
WindowsDuplicateString(str1, out);
}
@@ -445,18 +475,18 @@ HRESULT WINAPI WindowsTrimStringEnd(HSTRING str1, HSTRING str2, HSTRING *out)
TRACE("(%p, %p, %p)\n", str1, str2, out);
- if (!out || !str2 || !priv2->length)
+ if (!out || !str2 || !priv2->header.length)
return E_INVALIDARG;
if (!str1)
{
*out = NULL;
return S_OK;
}
- for (len = priv1->length; len > 0; len--)
+ for (len = priv1->header.length; len > 0; len--)
{
- if (!wmemchr(priv2->buffer, priv1->buffer[len - 1], priv2->length))
+ if (!wmemchr(priv2->header.ptr, priv1->header.ptr[len - 1], priv2->header.length))
break;
}
- return (len < priv1->length) ? WindowsCreateString(priv1->buffer, len, out) :
+ return (len < priv1->header.length) ? WindowsCreateString(priv1->header.ptr, len, out) :
WindowsDuplicateString(str1, out);
}
diff --git a/dlls/combase/tests/string.c b/dlls/combase/tests/string.c
index 5ebf669a426..bb477503a4b 100644
--- a/dlls/combase/tests/string.c
+++ b/dlls/combase/tests/string.c
@@ -37,7 +37,7 @@ static void _check_string(int line, HSTRING str, LPCWSTR content, UINT32 length,
ok_(__FILE__, line)(WindowsIsStringEmpty(str) == empty, "WindowsIsStringEmpty failed\n");
ok_(__FILE__, line)(WindowsStringHasEmbeddedNull(str, &out_null) == S_OK, "WindowsStringHasEmbeddedNull failed\n");
- ok_(__FILE__, line)(out_null == has_null, "WindowsStringHasEmbeddedNull failed\n");
+ ok_(__FILE__, line)(out_null == has_null, "WindowsStringHasEmbeddedNull failed. %d != %d \n", out_null, has_null);
ok_(__FILE__, line)(WindowsGetStringLen(str) == length, "WindowsGetStringLen failed\n");
ptr = WindowsGetStringRawBuffer(str, &out_length);
/* WindowsGetStringRawBuffer should return a non-null, null terminated empty string
@@ -479,6 +479,76 @@ static void test_trim(void)
ok(WindowsDeleteString(str1) == S_OK, "Failed to delete string\n");
}
+static void test_hstring_struct(void)
+{
+ struct hstring_header
+ {
+ UINT32 flags;
+ UINT32 length;
+ UINT32 padding1;
+ UINT32 padding2;
+ const WCHAR *ptr;
+ };
+
+ struct hstring_private
+ {
+ struct hstring_header header;
+ LONG refcount;
+ WCHAR buffer[1];
+ };
+
+ HSTRING str;
+ HSTRING str2;
+ HSTRING_HEADER hdr;
+ struct hstring_private* prv;
+ struct hstring_private* prv2;
+
+ BOOL arch64 = (sizeof(void*) == 8);
+
+ ok(arch64 ? (sizeof(prv->header) == 24) : (sizeof(prv->header) == 20), "hstring_header size incorrect.\n");
+
+ ok(WindowsCreateString(input_string, 6, &str) == S_OK, "Failed to create string.\n");
+
+ prv = CONTAINING_RECORD(str, struct hstring_private, header);
+
+ ok(prv->header.flags == 0, "Expected 0 in flags field, got 0x%x.\n", prv->header.flags);
+ ok(prv->header.length == 6, "Expected 6 in length field, got %d.\n", prv->header.length);
+ ok(prv->header.ptr != NULL, "Unexpected nullptr in ptr field.\n");
+ ok(prv->refcount == 1, "Expected 1 in refcount, got %d.\n", prv->refcount);
+ ok(prv->header.ptr == prv->buffer, "Expected ptr to point at buffer, instead pointing at %p.\n", prv->header.ptr);
+ ok(wcscmp(input_string, prv->buffer) == 0, "Strings didn't match.\n");
+
+ trace("hstr ptr(%p), flags(%d), length(%d), padding1(%p), padding2(%p), ptr(%p), refcount(%d), str(%ls)->addr(%p)\n",
+ prv, prv->header.flags, prv->header.length, &prv->header.padding1, &prv->header.padding2,
+ prv->header.ptr, prv->refcount, prv->buffer, prv->buffer);
+
+ ok(WindowsDuplicateString(str, &str2) == S_OK, "Failed to duplicate string.\n");
+
+ prv2 = CONTAINING_RECORD(str2, struct hstring_private, header);
+
+ ok(prv->refcount == 2, "Expected 2 in refcount, got %d.\n", prv->refcount);
+ ok(prv2->refcount == 2, "Expected 2 in refcount, got %d.\n", prv2->refcount);
+ ok(wcscmp(input_string, prv2->buffer) == 0, "Strings didn't match.\n");
+
+ ok(WindowsDeleteString(str) == S_OK, "Failed to delete string.\n");
+
+ ok(prv->refcount == 1, "Expected 1 in refcount, got %d.\n", prv->refcount);
+
+ ok(WindowsDeleteString(str) == S_OK, "Failed to delete string.\n");
+
+ ok(WindowsCreateStringReference(input_string, 6, &hdr, &str) == S_OK, "Failed to create string ref.\n");
+
+ prv = CONTAINING_RECORD(&hdr, struct hstring_private, header);
+ prv2 = CONTAINING_RECORD(str, struct hstring_private, header);
+
+ ok(prv == prv2, "Pointers not identical.\n");
+ ok(prv2->header.flags == 1, "HSTRING_REFERENCE_FLAG not set.\n");
+ ok(prv2->header.length == 6, "Length incorrect.\n");
+ ok(prv2->header.ptr == input_string, "Pointer not pointing at input string.\n");
+
+ ok(WindowsDeleteString(str) == S_OK, "Failed to delete string ref.\n");
+}
+
START_TEST(string)
{
test_create_delete();
@@ -489,4 +559,5 @@ START_TEST(string)
test_concat();
test_compare();
test_trim();
+ test_hstring_struct();
}
--
2.34.1
2
1
[PATCH 3/3] server: Strip terminating '\0' from the registry key name.
by Dmitry Timoshkov Jan. 12, 2022
by Dmitry Timoshkov Jan. 12, 2022
Jan. 12, 2022
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/ntdll/tests/reg.c | 18 +++++++++++++++++-
server/registry.c | 2 ++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/tests/reg.c b/dlls/ntdll/tests/reg.c
index 445c05a02e1..956df02fae4 100644
--- a/dlls/ntdll/tests/reg.c
+++ b/dlls/ntdll/tests/reg.c
@@ -456,6 +456,14 @@ todo_wine
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "NtOpenKey failed: 0x%08x\n", status );
pRtlFreeUnicodeString( &str );
+ pRtlCreateUnicodeStringFromAsciiz( &str, "\\REGISTRY\\Machine\\Software\\Classes" );
+ str.Length += sizeof(WCHAR); /* include terminating \0 in the length */
+ status = pNtOpenKey( &key, KEY_READ, &attr );
+ ok( status == STATUS_SUCCESS || broken(status == STATUS_OBJECT_NAME_NOT_FOUND) /* win8 */,
+ "NtOpenKey failed: 0x%08x\n", status );
+ if (!status) pNtClose( key );
+ pRtlFreeUnicodeString( &str );
+
if (!pNtOpenKeyEx)
{
win_skip("NtOpenKeyEx not available\n");
@@ -630,13 +638,21 @@ static void test_NtCreateKey(void)
status = pNtCreateKey( &subkey, am, &attr, 0, 0, 0, 0 );
ok( status == STATUS_SUCCESS,
"NtCreateKey failed: 0x%08x\n", status );
- if (!status) pNtClose( subkey );
+ pNtClose( subkey );
pRtlFreeUnicodeString( &str );
pRtlCreateUnicodeStringFromAsciiz( &str, "\\REGISTRY\\MACHINE\\SOFTWARE\\CLASSES" );
status = pNtCreateKey( &subkey, am, &attr, 0, 0, 0, 0 );
ok( status == STATUS_SUCCESS,
"NtCreateKey failed: 0x%08x\n", status );
+ pNtClose( subkey );
+ pRtlFreeUnicodeString( &str );
+
+ pRtlCreateUnicodeStringFromAsciiz( &str, "\\REGISTRY\\Machine\\Software\\Classes" );
+ str.Length += sizeof(WCHAR); /* include terminating \0 in the length */
+ status = pNtCreateKey( &subkey, am, &attr, 0, 0, 0, 0 );
+ ok( status == STATUS_SUCCESS || broken(status == STATUS_OBJECT_PATH_NOT_FOUND) /* win8 */,
+ "NtCreateKey failed: 0x%08x\n", status );
if (!status) pNtClose( subkey );
pRtlFreeUnicodeString( &str );
diff --git a/server/registry.c b/server/registry.c
index 2a2bc9a4e68..6a03a41a9de 100644
--- a/server/registry.c
+++ b/server/registry.c
@@ -477,6 +477,8 @@ static inline void get_req_path( struct unicode_str *str )
{
str->str = get_req_data();
str->len = (get_req_data_size() / sizeof(WCHAR)) * sizeof(WCHAR);
+
+ while (str->len && !str->str[str->len / sizeof(WCHAR) - 1]) str->len -= sizeof(WCHAR);
}
/* return the next token in a given path */
--
2.34.1
1
0
[PATCH 2/3] server: Use normal key path handling also for the '\Registry' prefix.
by Dmitry Timoshkov Jan. 12, 2022
by Dmitry Timoshkov Jan. 12, 2022
Jan. 12, 2022
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/ntdll/tests/reg.c | 3 ---
server/registry.c | 50 ++++++++++++------------------------------
2 files changed, 14 insertions(+), 39 deletions(-)
diff --git a/dlls/ntdll/tests/reg.c b/dlls/ntdll/tests/reg.c
index 91b752ac069..445c05a02e1 100644
--- a/dlls/ntdll/tests/reg.c
+++ b/dlls/ntdll/tests/reg.c
@@ -386,7 +386,6 @@ todo_wine
key = (HANDLE)0xdeadbeef;
status = pNtOpenKey(&key, KEY_READ, &attr);
todo_wine ok(status == STATUS_OBJECT_PATH_SYNTAX_BAD, "NtOpenKey Failed: 0x%08x\n", status);
-todo_wine
ok(!key, "key = %p\n", key);
pRtlFreeUnicodeString( &str );
@@ -417,7 +416,6 @@ todo_wine
pRtlCreateUnicodeStringFromAsciiz( &str, "\\Registry" );
status = pNtOpenKey(&key, KEY_READ, &attr);
- todo_wine
ok( status == STATUS_SUCCESS, "NtOpenKey failed: 0x%08x\n", status );
pNtClose( key );
pRtlFreeUnicodeString( &str );
@@ -569,7 +567,6 @@ static void test_NtCreateKey(void)
pRtlCreateUnicodeStringFromAsciiz( &str, "\\Registry" );
status = pNtCreateKey( &subkey, am, &attr, 0, 0, 0, 0 );
- todo_wine
ok( status == STATUS_SUCCESS || status == STATUS_ACCESS_DENIED,
"NtCreateKey failed: 0x%08x\n", status );
if (!status) pNtClose( subkey );
diff --git a/server/registry.c b/server/registry.c
index b00abdbc004..2a2bc9a4e68 100644
--- a/server/registry.c
+++ b/server/registry.c
@@ -127,7 +127,7 @@ static const timeout_t save_period = 30 * -TICKS_PER_SEC; /* delay between peri
static struct timeout_user *save_timeout_user; /* saving timer */
static enum prefix_type { PREFIX_UNKNOWN, PREFIX_32BIT, PREFIX_64BIT } prefix_type;
-static const WCHAR root_name[] = { '\\','R','e','g','i','s','t','r','y','\\' };
+static const WCHAR root_name[] = { '\\','R','e','g','i','s','t','r','y' };
static const WCHAR wow6432node[] = {'W','o','w','6','4','3','2','N','o','d','e'};
static const WCHAR symlink_value[] = {'S','y','m','b','o','l','i','c','L','i','n','k','V','a','l','u','e'};
static const struct unicode_str symlink_str = { symlink_value, sizeof(symlink_value) };
@@ -411,7 +411,7 @@ static WCHAR *key_get_full_name( struct object *obj, data_size_t *ret_len )
{
static const WCHAR backslash = '\\';
struct key *key = (struct key *) obj;
- data_size_t len = sizeof(root_name) - sizeof(WCHAR);
+ data_size_t len = 0;
char *ret;
if (key->flags & KEY_DELETED)
@@ -431,7 +431,6 @@ static WCHAR *key_get_full_name( struct object *obj, data_size_t *ret_len )
len -= key->namelen + sizeof(WCHAR);
memcpy( ret + len, &backslash, sizeof(WCHAR) );
}
- memcpy( ret, root_name, sizeof(root_name) - sizeof(WCHAR) );
return (WCHAR *)ret;
}
@@ -474,16 +473,10 @@ static void key_destroy( struct object *obj )
}
/* get the request vararg as registry path */
-static inline void get_req_path( struct unicode_str *str, int skip_root )
+static inline void get_req_path( struct unicode_str *str )
{
str->str = get_req_data();
str->len = (get_req_data_size() / sizeof(WCHAR)) * sizeof(WCHAR);
-
- if (skip_root && str->len >= sizeof(root_name) && !memicmp_strW( str->str, root_name, sizeof(root_name) ))
- {
- str->str += ARRAY_SIZE( root_name );
- str->len -= sizeof(root_name);
- }
}
/* return the next token in a given path */
@@ -494,19 +487,22 @@ static struct unicode_str *get_path_token( const struct unicode_str *path, struc
if (!token->str) /* first time */
{
- /* path cannot start with a backslash */
+ /* if path starts with a backslash it must be the Registry root */
if (len && path->str[0] == '\\')
{
- set_error( STATUS_OBJECT_PATH_INVALID );
- return NULL;
+ if (path->len < sizeof(root_name) || memicmp_strW( path->str, root_name, sizeof(root_name) ))
+ {
+ set_error( STATUS_OBJECT_PATH_INVALID );
+ return NULL;
+ }
}
}
else
{
i = token->str - path->str;
i += token->len / sizeof(WCHAR);
- while (i < len && path->str[i] == '\\') i++;
}
+ while (i < len && path->str[i] == '\\') i++;
token->str = path->str + i;
while (i < len && path->str[i] != '\\') i++;
token->len = (path->str + i - token->str) * sizeof(WCHAR);
@@ -730,10 +726,6 @@ static struct key *follow_symlink( struct key *key, int iteration )
path.str = value->data;
path.len = (value->len / sizeof(WCHAR)) * sizeof(WCHAR);
- if (path.len <= sizeof(root_name)) return NULL;
- if (memicmp_strW( path.str, root_name, sizeof(root_name) )) return NULL;
- path.str += ARRAY_SIZE( root_name );
- path.len -= sizeof(root_name);
key = root_key;
token.str = NULL;
@@ -1842,8 +1834,8 @@ static void init_supported_machines(void)
/* registry initialisation */
void init_registry(void)
{
- static const WCHAR HKLM[] = { 'M','a','c','h','i','n','e' };
- static const WCHAR HKU_default[] = { 'U','s','e','r','\\','.','D','e','f','a','u','l','t' };
+ static const WCHAR HKLM[] = { '\\','R','e','g','i','s','t','r','y','\\','M','a','c','h','i','n','e' };
+ static const WCHAR HKU_default[] = { '\\','R','e','g','i','s','t','r','y','\\','U','s','e','r','\\','.','D','e','f','a','u','l','t' };
static const WCHAR classes_i386[] = {'S','o','f','t','w','a','r','e','\\',
'C','l','a','s','s','e','s','\\',
'W','o','w','6','4','3','2','N','o','d','e'};
@@ -2151,13 +2143,6 @@ DECL_HANDLER(create_key)
class.str = get_req_data_after_objattr( objattr, &class.len );
class.len = (class.len / sizeof(WCHAR)) * sizeof(WCHAR);
- if (!objattr->rootdir && name.len >= sizeof(root_name) &&
- !memicmp_strW( name.str, root_name, sizeof(root_name) ))
- {
- name.str += ARRAY_SIZE( root_name );
- name.len -= sizeof(root_name);
- }
-
/* NOTE: no access rights are required from the parent handle to create a key */
if ((parent = get_parent_hkey_obj( objattr->rootdir )))
{
@@ -2184,7 +2169,7 @@ DECL_HANDLER(open_key)
/* NOTE: no access rights are required to open the parent key, only the child key */
if ((parent = get_parent_hkey_obj( req->parent )))
{
- get_req_path( &name, !req->parent );
+ get_req_path( &name );
if ((key = open_key( parent, &name, access, req->attributes )))
{
reply->hkey = alloc_handle( current->process, key, access, req->attributes );
@@ -2309,13 +2294,6 @@ DECL_HANDLER(load_registry)
return;
}
- if (!objattr->rootdir && name.len >= sizeof(root_name) &&
- !memicmp_strW( name.str, root_name, sizeof(root_name) ))
- {
- name.str += ARRAY_SIZE( root_name );
- name.len -= sizeof(root_name);
- }
-
if ((parent = get_parent_hkey_obj( objattr->rootdir )))
{
int dummy;
@@ -2344,7 +2322,7 @@ DECL_HANDLER(unload_registry)
if ((parent = get_parent_hkey_obj( req->parent )))
{
- get_req_path( &name, !req->parent );
+ get_req_path( &name );
if ((key = open_key( parent, &name, access, req->attributes )))
{
if (key->obj.handle_count)
--
2.34.1
1
0
[PATCH 1/3] ntdll: Use full registry key name in NtQueryLicenseValue.
by Dmitry Timoshkov Jan. 12, 2022
by Dmitry Timoshkov Jan. 12, 2022
Jan. 12, 2022
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/ntdll/unix/registry.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/registry.c b/dlls/ntdll/unix/registry.c
index 265ed39bd17..6628454440a 100644
--- a/dlls/ntdll/unix/registry.c
+++ b/dlls/ntdll/unix/registry.c
@@ -780,7 +780,8 @@ NTSTATUS WINAPI NtReplaceKey( OBJECT_ATTRIBUTES *attr, HANDLE key, OBJECT_ATTRIB
NTSTATUS WINAPI NtQueryLicenseValue( const UNICODE_STRING *name, ULONG *type,
void *data, ULONG length, ULONG *retlen )
{
- static const WCHAR nameW[] = {'M','a','c','h','i','n','e','\\',
+ static const WCHAR nameW[] = {'\\','R','e','g','i','s','t','r','y','\\',
+ 'M','a','c','h','i','n','e','\\',
'S','o','f','t','w','a','r','e','\\',
'W','i','n','e','\\','L','i','c','e','n','s','e',
'I','n','f','o','r','m','a','t','i','o','n',0};
--
2.34.1
1
0
[PATCH v2 2/2] gdi32/tests: Drop font test workarounds for Windows <= 2000
by Alex Henrie Jan. 12, 2022
by Alex Henrie Jan. 12, 2022
Jan. 12, 2022
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
v2: Keep the continue statement in test_bitmap_font, which is preventing
a test failure on Japanese Windows 10
---
dlls/gdi32/tests/font.c | 445 ++++++++++++----------------------------
1 file changed, 132 insertions(+), 313 deletions(-)
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 269151a1e1a..03ac72254cc 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -42,19 +42,8 @@ static inline BOOL match_off_by_n(int a, int b, unsigned int n)
static LONG (WINAPI *pGdiGetCharDimensions)(HDC hdc, LPTEXTMETRICW lptm, LONG *height);
static DWORD (WINAPI *pGdiGetCodePage)(HDC hdc);
-static BOOL (WINAPI *pGetCharABCWidthsFloatW)(HDC hdc, UINT first, UINT last, LPABCFLOAT abc);
-static BOOL (WINAPI *pGetCharWidth32W)(HDC hdc, UINT first, UINT last, LPINT buffer);
static BOOL (WINAPI *pGetCharWidthInfo)(HDC hdc, void *);
-static DWORD (WINAPI *pGetFontUnicodeRanges)(HDC hdc, LPGLYPHSET lpgs);
-static DWORD (WINAPI *pGetGlyphIndicesW)(HDC hdc, LPCWSTR lpstr, INT count, LPWORD pgi, DWORD flags);
-static BOOL (WINAPI *pGetTextExtentExPointI)(HDC hdc, const WORD *indices, INT count, INT max_ext,
- LPINT nfit, LPINT dxs, LPSIZE size );
static BOOL (WINAPI *pGdiRealizationInfo)(HDC hdc, DWORD *);
-static HFONT (WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *);
-static HANDLE (WINAPI *pAddFontMemResourceEx)(PVOID, DWORD, PVOID, DWORD *);
-static BOOL (WINAPI *pRemoveFontMemResourceEx)(HANDLE);
-static INT (WINAPI *pAddFontResourceExA)(LPCSTR, DWORD, PVOID);
-static BOOL (WINAPI *pRemoveFontResourceExA)(LPCSTR, DWORD, PVOID);
static BOOL (WINAPI *pGetFontRealizationInfo)(HDC hdc, DWORD *);
static BOOL (WINAPI *pGetFontFileInfo)(DWORD, DWORD, void *, SIZE_T, SIZE_T *);
static BOOL (WINAPI *pGetFontFileData)(DWORD, DWORD, UINT64, void *, DWORD);
@@ -84,18 +73,8 @@ static void init(void)
pGdiGetCharDimensions = (void *)GetProcAddress(hgdi32, "GdiGetCharDimensions");
pGdiGetCodePage = (void *) GetProcAddress(hgdi32,"GdiGetCodePage");
- pGetCharABCWidthsFloatW = (void *)GetProcAddress(hgdi32, "GetCharABCWidthsFloatW");
- pGetCharWidth32W = (void *)GetProcAddress(hgdi32, "GetCharWidth32W");
pGetCharWidthInfo = (void *)GetProcAddress(hgdi32, "GetCharWidthInfo");
- pGetFontUnicodeRanges = (void *)GetProcAddress(hgdi32, "GetFontUnicodeRanges");
- pGetGlyphIndicesW = (void *)GetProcAddress(hgdi32, "GetGlyphIndicesW");
- pGetTextExtentExPointI = (void *)GetProcAddress(hgdi32, "GetTextExtentExPointI");
pGdiRealizationInfo = (void *)GetProcAddress(hgdi32, "GdiRealizationInfo");
- pCreateFontIndirectExA = (void *)GetProcAddress(hgdi32, "CreateFontIndirectExA");
- pAddFontMemResourceEx = (void *)GetProcAddress(hgdi32, "AddFontMemResourceEx");
- pRemoveFontMemResourceEx = (void *)GetProcAddress(hgdi32, "RemoveFontMemResourceEx");
- pAddFontResourceExA = (void *)GetProcAddress(hgdi32, "AddFontResourceExA");
- pRemoveFontResourceExA = (void *)GetProcAddress(hgdi32, "RemoveFontResourceExA");
pGetFontRealizationInfo = (void *)GetProcAddress(hgdi32, "GetFontRealizationInfo");
pGetFontFileInfo = (void *)GetProcAddress(hgdi32, "GetFontFileInfo");
pGetFontFileData = (void *)GetProcAddress(hgdi32, "GetFontFileData");
@@ -188,32 +167,18 @@ static BOOL write_ttf_file(const char *fontname, char *tmp_name)
static void check_font(const char* test, const LOGFONTA* lf, HFONT hfont)
{
LOGFONTA getobj_lf;
- int ret, minlen = 0;
+ int ret;
if (!hfont)
return;
ret = GetObjectA(hfont, sizeof(getobj_lf), &getobj_lf);
- /* NT4 tries to be clever and only returns the minimum length */
- while (lf->lfFaceName[minlen] && minlen < LF_FACESIZE-1)
- minlen++;
- minlen += FIELD_OFFSET(LOGFONTA, lfFaceName) + 1;
- ok(ret == sizeof(LOGFONTA) || ret == minlen, "%s: GetObject returned %d\n", test, ret);
- ok(lf->lfHeight == getobj_lf.lfHeight ||
- broken((SHORT)lf->lfHeight == getobj_lf.lfHeight), /* win9x */
- "lfHeight: expect %08x got %08x\n", lf->lfHeight, getobj_lf.lfHeight);
- ok(lf->lfWidth == getobj_lf.lfWidth ||
- broken((SHORT)lf->lfWidth == getobj_lf.lfWidth), /* win9x */
- "lfWidth: expect %08x got %08x\n", lf->lfWidth, getobj_lf.lfWidth);
- ok(lf->lfEscapement == getobj_lf.lfEscapement ||
- broken((SHORT)lf->lfEscapement == getobj_lf.lfEscapement), /* win9x */
- "lfEscapement: expect %08x got %08x\n", lf->lfEscapement, getobj_lf.lfEscapement);
- ok(lf->lfOrientation == getobj_lf.lfOrientation ||
- broken((SHORT)lf->lfOrientation == getobj_lf.lfOrientation), /* win9x */
- "lfOrientation: expect %08x got %08x\n", lf->lfOrientation, getobj_lf.lfOrientation);
- ok(lf->lfWeight == getobj_lf.lfWeight ||
- broken((SHORT)lf->lfWeight == getobj_lf.lfWeight), /* win9x */
- "lfWeight: expect %08x got %08x\n", lf->lfWeight, getobj_lf.lfWeight);
+ ok(ret == sizeof(LOGFONTA), "%s: GetObject returned %d\n", test, ret);
+ ok(lf->lfHeight == getobj_lf.lfHeight, "lfHeight: expect %08x got %08x\n", lf->lfHeight, getobj_lf.lfHeight);
+ ok(lf->lfWidth == getobj_lf.lfWidth, "lfWidth: expect %08x got %08x\n", lf->lfWidth, getobj_lf.lfWidth);
+ ok(lf->lfEscapement == getobj_lf.lfEscapement, "lfEscapement: expect %08x got %08x\n", lf->lfEscapement, getobj_lf.lfEscapement);
+ ok(lf->lfOrientation == getobj_lf.lfOrientation, "lfOrientation: expect %08x got %08x\n", lf->lfOrientation, getobj_lf.lfOrientation);
+ ok(lf->lfWeight == getobj_lf.lfWeight, "lfWeight: expect %08x got %08x\n", lf->lfWeight, getobj_lf.lfWeight);
ok(lf->lfItalic == getobj_lf.lfItalic, "lfItalic: expect %02x got %02x\n", lf->lfItalic, getobj_lf.lfItalic);
ok(lf->lfUnderline == getobj_lf.lfUnderline, "lfUnderline: expect %02x got %02x\n", lf->lfUnderline, getobj_lf.lfUnderline);
ok(lf->lfStrikeOut == getobj_lf.lfStrikeOut, "lfStrikeOut: expect %02x got %02x\n", lf->lfStrikeOut, getobj_lf.lfStrikeOut);
@@ -222,9 +187,7 @@ static void check_font(const char* test, const LOGFONTA* lf, HFONT hfont)
ok(lf->lfClipPrecision == getobj_lf.lfClipPrecision, "lfClipPrecision: expect %02x got %02x\n", lf->lfClipPrecision, getobj_lf.lfClipPrecision);
ok(lf->lfQuality == getobj_lf.lfQuality, "lfQuality: expect %02x got %02x\n", lf->lfQuality, getobj_lf.lfQuality);
ok(lf->lfPitchAndFamily == getobj_lf.lfPitchAndFamily, "lfPitchAndFamily: expect %02x got %02x\n", lf->lfPitchAndFamily, getobj_lf.lfPitchAndFamily);
- ok(!lstrcmpA(lf->lfFaceName, getobj_lf.lfFaceName) ||
- broken(!memcmp(lf->lfFaceName, getobj_lf.lfFaceName, LF_FACESIZE-1)), /* win9x doesn't ensure '\0' termination */
- "%s: font names don't match: %s != %s\n", test, lf->lfFaceName, getobj_lf.lfFaceName);
+ ok(!lstrcmpA(lf->lfFaceName, getobj_lf.lfFaceName), "%s: font names don't match: %s != %s\n", test, lf->lfFaceName, getobj_lf.lfFaceName);
}
static HFONT create_font(const char* test, const LOGFONTA* lf)
@@ -325,14 +288,12 @@ static void test_font_metrics(const char *context,
{
otm.otmSize = sizeof(otm) / 2;
ret = GetOutlineTextMetricsA(hdc, otm.otmSize, &otm);
- ok(ret == sizeof(otm)/2 /* XP */ ||
- ret == 1 /* Win9x */, "expected sizeof(otm)/2, got %u\n", ret);
+ ok(ret == sizeof(otm)/2, "expected sizeof(otm)/2, got %u\n", ret);
memset(&otm, 0x1, sizeof(otm));
otm.otmSize = sizeof(otm);
ret = GetOutlineTextMetricsA(hdc, otm.otmSize, &otm);
- ok(ret == sizeof(otm) /* XP */ ||
- ret == 1 /* Win9x */, "expected sizeof(otm), got %u\n", ret);
+ ok(ret == sizeof(otm), "expected sizeof(otm), got %u\n", ret);
memset(&tm, 0x2, sizeof(tm));
ret = GetTextMetricsA(hdc, &tm);
@@ -1139,7 +1100,7 @@ static void ABCWidths_helper(const char* description, HDC hdc, WORD *glyphs, con
ok(abc->abcA * base_abcw->abcA >= 0, "%s: abcA's sign should be unchanged\n", description);
ok(abc->abcC * base_abcw->abcC >= 0, "%s: abcC's sign should be unchanged\n", description);
- ret = pGetCharABCWidthsFloatW(hdc, 'i', 'i', abcf);
+ ret = GetCharABCWidthsFloatW(hdc, 'i', 'i', abcf);
ok(ret, "%s: GetCharABCWidthsFloatW should have succeeded\n", description);
ok (abcf->abcfB > 0.0, "%s: abcfB should be positive\n", description);
ok(abcf->abcfA * base_abcf->abcfA >= 0.0, "%s: abcfA's sign should be unchanged\n", description);
@@ -1198,12 +1159,6 @@ static void test_GetCharABCWidths(void)
};
UINT i;
- if (!pGetCharABCWidthsFloatW)
- {
- win_skip("GetCharABCWidthsFloatW is not available on this platform\n");
- return;
- }
-
memset(&lf, 0, sizeof(lf));
strcpy(lf.lfFaceName, "System");
lf.lfHeight = 20;
@@ -1212,7 +1167,7 @@ static void test_GetCharABCWidths(void)
hdc = GetDC(0);
hfont = SelectObject(hdc, hfont);
- nb = pGetGlyphIndicesW(hdc, L"i", 1, glyphs, 0);
+ nb = GetGlyphIndicesW(hdc, L"i", 1, glyphs, 0);
ok(nb == 1, "GetGlyphIndicesW should have returned 1\n");
ret = GetCharABCWidthsI(NULL, 0, 1, glyphs, abc);
@@ -1233,13 +1188,13 @@ static void test_GetCharABCWidths(void)
ret = GetCharABCWidthsW(hdc, 'a', 'a', abc);
ok(!ret, "GetCharABCWidthsW should have failed\n");
- ret = pGetCharABCWidthsFloatW(NULL, 'a', 'a', abcf);
+ ret = GetCharABCWidthsFloatW(NULL, 'a', 'a', abcf);
ok(!ret, "GetCharABCWidthsFloatW should have failed\n");
- ret = pGetCharABCWidthsFloatW(hdc, 'a', 'a', NULL);
+ ret = GetCharABCWidthsFloatW(hdc, 'a', 'a', NULL);
ok(!ret, "GetCharABCWidthsFloatW should have failed\n");
- ret = pGetCharABCWidthsFloatW(hdc, 'a', 'a', abcf);
+ ret = GetCharABCWidthsFloatW(hdc, 'a', 'a', abcf);
ok(ret, "GetCharABCWidthsFloatW should have succeeded\n");
hfont = SelectObject(hdc, hfont);
@@ -1303,7 +1258,7 @@ static void test_GetCharABCWidths(void)
/* test empty glyph's metrics */
hfont = SelectObject(hdc, hfont);
- ret = pGetCharABCWidthsFloatW(hdc, ' ', ' ', abcf);
+ ret = GetCharABCWidthsFloatW(hdc, ' ', ' ', abcf);
ok(ret, "GetCharABCWidthsFloatW should have succeeded\n");
ok(abcf[0].abcfB == 1.0, "got %f\n", abcf[0].abcfB);
ret = GetCharABCWidthsW(hdc, ' ', ' ', abcw);
@@ -1393,14 +1348,14 @@ static void test_GetCharABCWidths(void)
SetMapMode(hdc, MM_ANISOTROPIC);
SelectObject(hdc, hfont);
- nb = pGetGlyphIndicesW(hdc, L"i", 1, glyphs, 0);
+ nb = GetGlyphIndicesW(hdc, L"i", 1, glyphs, 0);
ok(nb == 1, "GetGlyphIndicesW should have returned 1\n");
ret = GetCharABCWidthsI(hdc, 0, 1, glyphs, abc);
ok(ret, "GetCharABCWidthsI should have succeeded\n");
ret = GetCharABCWidthsW(hdc, 'i', 'i', abcw);
ok(ret, "GetCharABCWidthsW should have succeeded\n");
- ret = pGetCharABCWidthsFloatW(hdc, 'i', 'i', abcf);
+ ret = GetCharABCWidthsFloatW(hdc, 'i', 'i', abcf);
ok(ret, "GetCharABCWidthsFloatW should have succeeded\n");
ABCWidths_helper("LTR", hdc, glyphs, abc, abcw, abcf);
@@ -1477,17 +1432,6 @@ static void test_text_extents(void)
ok(ret, "got %d\n", ret);
ok(sz.cx == 0 && sz.cy == 0, "cx %d, cy %d\n", sz.cx, sz.cy);
- SetLastError(0xdeadbeef);
- GetTextExtentExPointW(hdc, wt, 1, 1, &fit1, &fit2, &sz1);
- if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
- {
- win_skip("Skipping remainder of text extents test on a Win9x platform\n");
- hfont = SelectObject(hdc, hfont);
- DeleteObject(hfont);
- ReleaseDC(0, hdc);
- return;
- }
-
memset(&sz, 0xcc, sizeof(sz));
ret = GetTextExtentPointW(hdc, wt, 0, &sz);
ok(ret, "got %d\n", ret);
@@ -1541,12 +1485,8 @@ static void test_text_extents(void)
/* max_extent = 0 succeeds and returns zero */
fit1 = fit2 = -215;
ret = GetTextExtentExPointA(hdc, NULL, 0, 0, &fit1, NULL, &sz);
- ok(ret == TRUE ||
- broken(ret == FALSE), /* NT4, 2k */
- "got %d\n", ret);
- ok(fit1 == 0 ||
- broken(fit1 == -215), /* NT4, 2k */
- "fit = %d\n", fit1);
+ ok(ret == TRUE, "got %d\n", ret);
+ ok(fit1 == 0, "fit = %d\n", fit1);
ret = GetTextExtentExPointW(hdc, NULL, 0, 0, &fit2, NULL, &sz1);
ok(ret == TRUE, "got %d\n", ret);
ok(fit2 == 0, "fit = %d\n", fit2);
@@ -1653,11 +1593,6 @@ static void test_GetGlyphIndices(void)
void *font;
char ttf_name[MAX_PATH];
- if (!pGetGlyphIndicesW) {
- win_skip("GetGlyphIndicesW not available on platform\n");
- return;
- }
-
hdc = GetDC(0);
memset(&lf, 0, sizeof(lf));
@@ -1672,11 +1607,11 @@ static void test_GetGlyphIndices(void)
if (textm.tmCharSet == ANSI_CHARSET)
{
flags |= GGI_MARK_NONEXISTING_GLYPHS;
- charcount = pGetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
+ charcount = GetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
ok(charcount == 5, "GetGlyphIndicesW count of glyphs should = 5 not %d\n", charcount);
ok((glyphs[4] == 0x001f || glyphs[4] == 0xffff /* Vista */), "GetGlyphIndicesW should have returned a nonexistent char not %04x\n", glyphs[4]);
flags = 0;
- charcount = pGetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
+ charcount = GetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
ok(charcount == 5, "GetGlyphIndicesW count of glyphs should = 5 not %d\n", charcount);
ok(glyphs[4] == textm.tmDefaultChar || glyphs[4] == 0x20 /* CJK Windows */,
"GetGlyphIndicesW should have returned a %04x not %04x\n", textm.tmDefaultChar, glyphs[4]);
@@ -1724,12 +1659,12 @@ static void test_GetGlyphIndices(void)
hOldFont = SelectObject(hdc, hfont);
ok(GetTextMetricsA(hdc, &textm), "GetTextMetric failed\n");
flags |= GGI_MARK_NONEXISTING_GLYPHS;
- charcount = pGetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
+ charcount = GetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
ok(charcount == 5, "GetGlyphIndicesW count of glyphs should = 5 not %d\n", charcount);
ok(glyphs[4] == 0xffff, "GetGlyphIndicesW should have returned 0xffff char not %04x\n", glyphs[4]);
flags = 0;
testtext[0] = textm.tmDefaultChar;
- charcount = pGetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
+ charcount = GetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
ok(charcount == 5, "GetGlyphIndicesW count of glyphs should = 5 not %d\n", charcount);
ok(glyphs[0] == 0, "GetGlyphIndicesW for tmDefaultChar should be 0 not %04x\n", glyphs[0]);
ok(glyphs[4] == 0, "GetGlyphIndicesW should have returned 0 not %04x\n", glyphs[4]);
@@ -1740,7 +1675,7 @@ static void test_GetGlyphIndices(void)
font = load_font(ttf_name, &font_size);
ok(font != NULL, "Failed to map font file.\n");
num_fonts = 0;
- rsrc = pAddFontMemResourceEx(font, font_size, NULL, &num_fonts);
+ rsrc = AddFontMemResourceEx(font, font_size, NULL, &num_fonts);
ok(ret != 0, "Failed to add resource, %d.\n", GetLastError());
ok(num_fonts == 1, "Unexpected number of fonts %u.\n", num_fonts);
@@ -1752,7 +1687,7 @@ static void test_GetGlyphIndices(void)
hOldFont = SelectObject(hdc, hfont);
ok(GetTextMetricsA(hdc, &textm), "GetTextMetric failed\n");
testtext[0] = 'T';
- charcount = pGetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
+ charcount = GetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
ok(charcount == 5, "GetGlyphIndicesW count of glyphs should = 5 not %d\n", charcount);
ok(glyphs[0] == 0, "GetGlyphIndicesW for tmDefaultChar should be 0 not %04x\n", glyphs[0]);
ok(glyphs[4] == 0, "GetGlyphIndicesW should have returned 0 not %04x\n", glyphs[4]);
@@ -1760,7 +1695,7 @@ static void test_GetGlyphIndices(void)
ReleaseDC(0, hdc);
- ret = pRemoveFontMemResourceEx(rsrc);
+ ret = RemoveFontMemResourceEx(rsrc);
ok(ret, "RemoveFontMemResourceEx error %d\n", GetLastError());
free_font(font);
ret = DeleteFileA(ttf_name);
@@ -1853,18 +1788,6 @@ static void test_GetKerningPairs(void)
hdc = GetDC(0);
- /* GetKerningPairsA maps unicode set of kerning pairs to current code page
- * which may render this test unusable, so we're trying to avoid that.
- */
- SetLastError(0xdeadbeef);
- GetKerningPairsW(hdc, 0, NULL);
- if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
- {
- win_skip("Skipping the GetKerningPairs test on a Win9x platform\n");
- ReleaseDC(0, hdc);
- return;
- }
-
for (i = 0; i < ARRAY_SIZE(kd); i++)
{
OUTLINETEXTMETRICW otm;
@@ -1885,7 +1808,6 @@ static void test_GetKerningPairs(void)
hfont_old = SelectObject(hdc, hfont);
SetLastError(0xdeadbeef);
- otm.otmSize = sizeof(otm); /* just in case for Win9x compatibility */
uiRet = GetOutlineTextMetricsW(hdc, sizeof(otm), &otm);
ok(uiRet == sizeof(otm), "GetOutlineTextMetricsW error %d\n", GetLastError());
@@ -2174,12 +2096,6 @@ static void test_height_selection_vdmx( HDC hdc )
void *res, *copy;
BOOL ret;
- if (!pAddFontResourceExA)
- {
- win_skip("AddFontResourceExA unavailable\n");
- return;
- }
-
for (i = 0; i < ARRAY_SIZE(data); i++)
{
res = get_res_data( "wine_vdmx.ttf", &size );
@@ -2197,13 +2113,13 @@ static void test_height_selection_vdmx( HDC hdc )
HeapFree( GetProcessHeap(), 0, copy );
ok( !is_truetype_font_installed("wine_vdmx"), "Already installed\n" );
- num = pAddFontResourceExA( ttf_name, FR_PRIVATE, 0 );
+ num = AddFontResourceExA( ttf_name, FR_PRIVATE, 0 );
if (!num) win_skip("Unable to add ttf font resource\n");
else
{
ok( is_truetype_font_installed("wine_vdmx"), "Not installed\n" );
test_height( hdc, data[i].fd );
- pRemoveFontResourceExA( ttf_name, FR_PRIVATE, 0 );
+ RemoveFontResourceExA( ttf_name, FR_PRIVATE, 0 );
}
ret = DeleteFileA( ttf_name );
ok(ret || broken(!ret && GetLastError() == ERROR_ACCESS_DENIED),
@@ -2329,49 +2245,33 @@ static void test_GetOutlineTextMetrics(void)
memset(otm, 0xAA, otm_size);
SetLastError(0xdeadbeef);
- otm->otmSize = sizeof(*otm); /* just in case for Win9x compatibility */
+ otm->otmSize = sizeof(*otm);
ret = GetOutlineTextMetricsA(hdc, otm->otmSize, otm);
- ok(ret == 1 /* Win9x */ ||
- ret == otm->otmSize /* XP*/,
- "expected %u, got %u, error %d\n", otm->otmSize, ret, GetLastError());
- if (ret != 1) /* Win9x doesn't care about pointing beyond of the buffer */
- {
- ok(otm->otmpFamilyName == NULL, "expected NULL got %p\n", otm->otmpFamilyName);
- ok(otm->otmpFaceName == NULL, "expected NULL got %p\n", otm->otmpFaceName);
- ok(otm->otmpStyleName == NULL, "expected NULL got %p\n", otm->otmpStyleName);
- ok(otm->otmpFullName == NULL, "expected NULL got %p\n", otm->otmpFullName);
- }
+ ok(ret == otm->otmSize, "expected %u, got %u, error %d\n", otm->otmSize, ret, GetLastError());
+ ok(otm->otmpFamilyName == NULL, "expected NULL got %p\n", otm->otmpFamilyName);
+ ok(otm->otmpFaceName == NULL, "expected NULL got %p\n", otm->otmpFaceName);
+ ok(otm->otmpStyleName == NULL, "expected NULL got %p\n", otm->otmpStyleName);
+ ok(otm->otmpFullName == NULL, "expected NULL got %p\n", otm->otmpFullName);
memset(otm, 0xAA, otm_size);
SetLastError(0xdeadbeef);
- otm->otmSize = otm_size; /* just in case for Win9x compatibility */
ret = GetOutlineTextMetricsA(hdc, otm->otmSize, otm);
- ok(ret == 1 /* Win9x */ ||
- ret == otm->otmSize /* XP*/,
- "expected %u, got %u, error %d\n", otm->otmSize, ret, GetLastError());
- if (ret != 1) /* Win9x doesn't care about pointing beyond of the buffer */
- {
- ok(otm->otmpFamilyName != NULL, "expected not NULL got %p\n", otm->otmpFamilyName);
- ok(otm->otmpFaceName != NULL, "expected not NULL got %p\n", otm->otmpFaceName);
- ok(otm->otmpStyleName != NULL, "expected not NULL got %p\n", otm->otmpStyleName);
- ok(otm->otmpFullName != NULL, "expected not NULL got %p\n", otm->otmpFullName);
- }
+ ok(ret == otm->otmSize, "expected %u, got %u, error %d\n", otm->otmSize, ret, GetLastError());
+ ok(otm->otmpFamilyName != NULL, "expected not NULL got %p\n", otm->otmpFamilyName);
+ ok(otm->otmpFaceName != NULL, "expected not NULL got %p\n", otm->otmpFaceName);
+ ok(otm->otmpStyleName != NULL, "expected not NULL got %p\n", otm->otmpStyleName);
+ ok(otm->otmpFullName != NULL, "expected not NULL got %p\n", otm->otmpFullName);
/* ask about truncated data */
memset(otm, 0xAA, otm_size);
memset(&unset_ptr, 0xAA, sizeof(unset_ptr));
SetLastError(0xdeadbeef);
- otm->otmSize = sizeof(*otm) - sizeof(LPSTR); /* just in case for Win9x compatibility */
+ otm->otmSize = sizeof(*otm) - sizeof(char*);
ret = GetOutlineTextMetricsA(hdc, otm->otmSize, otm);
- ok(ret == 1 /* Win9x */ ||
- ret == otm->otmSize /* XP*/,
- "expected %u, got %u, error %d\n", otm->otmSize, ret, GetLastError());
- if (ret != 1) /* Win9x doesn't care about pointing beyond of the buffer */
- {
- ok(otm->otmpFamilyName == NULL, "expected NULL got %p\n", otm->otmpFamilyName);
- ok(otm->otmpFaceName == NULL, "expected NULL got %p\n", otm->otmpFaceName);
- ok(otm->otmpStyleName == NULL, "expected NULL got %p\n", otm->otmpStyleName);
- }
+ ok(ret == otm->otmSize, "expected %u, got %u, error %d\n", otm->otmSize, ret, GetLastError());
+ ok(otm->otmpFamilyName == NULL, "expected NULL got %p\n", otm->otmpFamilyName);
+ ok(otm->otmpFaceName == NULL, "expected NULL got %p\n", otm->otmpFaceName);
+ ok(otm->otmpStyleName == NULL, "expected NULL got %p\n", otm->otmpStyleName);
ok(otm->otmpFullName == unset_ptr, "expected %p got %p\n", unset_ptr, otm->otmpFullName);
/* check handling of NULL pointer */
@@ -2505,7 +2405,6 @@ static void test_SetTextJustification(void)
testJustification("default", hdc, testText, &clientArea);
- if (!pGetTextExtentExPointI) goto done;
GetGlyphIndicesA( hdc, "A ", 2, indices, 0 );
SetTextJustification(hdc, 0, 0);
@@ -2530,9 +2429,9 @@ static void test_SetTextJustification(void)
size.cx = size.cy = 1234;
GetTextExtentPoint32A(hdc, " ", 0, &size);
ok( size.cx == 0 && size.cy == 0, "wrong size %d,%d\n", size.cx, size.cy );
- pGetTextExtentExPointI(hdc, indices, 2, -1, NULL, NULL, &expect);
+ GetTextExtentExPointI(hdc, indices, 2, -1, NULL, NULL, &expect);
SetTextJustification(hdc, 5, 1);
- pGetTextExtentExPointI(hdc, indices, 2, -1, NULL, NULL, &size);
+ GetTextExtentExPointI(hdc, indices, 2, -1, NULL, NULL, &size);
ok( size.cx == expect.cx + 5, "wrong size %d/%d\n", size.cx, expect.cx );
SetTextJustification(hdc, 0, 0);
@@ -2550,11 +2449,11 @@ static void test_SetTextJustification(void)
ok( size.cx == expect.cx + i, "wrong size %d/%d+%d\n", size.cx, expect.cx, i );
}
SetTextCharacterExtra(hdc, 0);
- pGetTextExtentExPointI(hdc, indices, 1, -1, NULL, NULL, &expect);
+ GetTextExtentExPointI(hdc, indices, 1, -1, NULL, NULL, &expect);
for (i = 0; i < 10; i++)
{
SetTextCharacterExtra(hdc, i);
- pGetTextExtentExPointI(hdc, indices, 1, -1, NULL, NULL, &size);
+ GetTextExtentExPointI(hdc, indices, 1, -1, NULL, NULL, &size);
ok( size.cx == expect.cx + i, "wrong size %d/%d+%d\n", size.cx, expect.cx, i );
}
SetTextCharacterExtra(hdc, 0);
@@ -2572,7 +2471,6 @@ static void test_SetTextJustification(void)
ok( size.cx == expect.cx + i, "wrong size %d/%d+%d\n", size.cx, expect.cx, i );
}
-done:
DeleteObject(hfont);
ReleaseDC(hwnd, hdc);
DestroyWindow(hwnd);
@@ -2647,7 +2545,7 @@ static BOOL get_glyph_indices(INT charset, UINT code_page, WORD *idx, UINT count
MultiByteToWideChar(code_page, 0, ansi_buf, count, unicode_buf, count);
SetLastError(0xdeadbeef);
- ret = pGetGlyphIndicesW(hdc, unicode_buf, count, idx, 0);
+ ret = GetGlyphIndicesW(hdc, unicode_buf, count, idx, 0);
ok(ret == count, "GetGlyphIndicesW expected %d got %d, error %u\n",
count, ret, GetLastError());
}
@@ -2686,12 +2584,6 @@ static void test_font_charset(void)
};
int i;
- if (!pGetGlyphIndicesW)
- {
- win_skip("Skipping the font charset test on a Win9x platform\n");
- return;
- }
-
if (!is_font_installed("Arial"))
{
skip("Arial is not installed\n");
@@ -2825,12 +2717,6 @@ static void test_GetFontUnicodeRanges(void)
DWORD size;
GLYPHSET *gs;
- if (!pGetFontUnicodeRanges)
- {
- win_skip("GetFontUnicodeRanges not available before W2K\n");
- return;
- }
-
memset(&lf, 0, sizeof(lf));
lstrcpyA(lf.lfFaceName, "Arial");
hfont = create_font("Arial", &lf);
@@ -2838,15 +2724,15 @@ static void test_GetFontUnicodeRanges(void)
hdc = GetDC(0);
hfont_old = SelectObject(hdc, hfont);
- size = pGetFontUnicodeRanges(NULL, NULL);
+ size = GetFontUnicodeRanges(NULL, NULL);
ok(!size, "GetFontUnicodeRanges succeeded unexpectedly\n");
- size = pGetFontUnicodeRanges(hdc, NULL);
+ size = GetFontUnicodeRanges(hdc, NULL);
ok(size, "GetFontUnicodeRanges failed unexpectedly\n");
gs = heap_alloc_zero(size);
- size = pGetFontUnicodeRanges(hdc, gs);
+ size = GetFontUnicodeRanges(hdc, gs);
ok(size, "GetFontUnicodeRanges failed\n");
ok(gs->cRanges, "Unexpected ranges count.\n");
@@ -3016,9 +2902,7 @@ static void test_EnumFontFamilies(const char *font_name, INT font_charset)
ok(efdw.total > 0, "fonts enumerated: NULL\n");
ok(ansi_charset > 0, "NULL family should enumerate ANSI_CHARSET\n");
ok(symbol_charset > 0, "NULL family should enumerate SYMBOL_CHARSET\n");
- ok(russian_charset > 0 ||
- broken(russian_charset == 0), /* NT4 */
- "NULL family should enumerate RUSSIAN_CHARSET\n");
+ ok(russian_charset > 0, "NULL family should enumerate RUSSIAN_CHARSET\n");
}
efdw.total = 0;
@@ -4005,12 +3889,10 @@ static void test_text_metrics(const LOGFONTA *lf, const NEWTEXTMETRICA *ntm)
/* Wine currently uses SYMBOL_CHARSET to identify whether the ANSI metrics need special handling */
todo_wine_if(cmap_type != cmap_ms_symbol && tmA.tmCharSet == SYMBOL_CHARSET && expect_first_A != 0x1e)
- ok(tmA.tmFirstChar == expect_first_A ||
- tmA.tmFirstChar == expect_first_A + 1 /* win9x */,
+ ok(tmA.tmFirstChar == expect_first_A,
"A: tmFirstChar for %s got %02x expected %02x\n", font_name, tmA.tmFirstChar, expect_first_A);
if (pGdiGetCodePage == NULL || ! IsDBCSLeadByteEx(pGdiGetCodePage(hdc), tmA.tmLastChar))
- ok(tmA.tmLastChar == expect_last_A ||
- tmA.tmLastChar == 0xff /* win9x */,
+ todo_wine_if(expect_last_A != 0 && expect_last_A != 0xff) ok(tmA.tmLastChar == expect_last_A,
"A: tmLastChar for %s got %02x expected %02x\n", font_name, tmA.tmLastChar, expect_last_A);
else
skip("tmLastChar is DBCS lead byte\n");
@@ -4189,9 +4071,9 @@ static void test_nonexistent_font(void)
for (i = 0; i < ARRAY_SIZE(shell_subst); i++)
{
ret = is_font_installed(shell_subst[i].name);
- ok(ret || broken(!ret) /* win2000 */, "%s should be enumerated\n", shell_subst[i].name);
+ ok(ret, "%s should be enumerated\n", shell_subst[i].name);
ret = is_truetype_font_installed(shell_subst[i].name);
- ok(ret || broken(!ret) /* win2000 */, "%s should be enumerated\n", shell_subst[i].name);
+ ok(ret, "%s should be enumerated\n", shell_subst[i].name);
memset(&lf, 0, sizeof(lf));
lf.lfHeight = -13;
@@ -4250,7 +4132,6 @@ static void test_nonexistent_font(void)
GetTextFaceA(hdc, sizeof(buf), buf);
todo_wine /* Wine uses Arial for all substitutions */
ok(!lstrcmpiA(buf, "Nonexistent font") /* XP, Vista */ ||
- !lstrcmpiA(buf, "MS Serif") || /* Win9x */
!lstrcmpiA(buf, "MS Sans Serif"), /* win2k3 */
"Got %s\n", buf);
cs = GetTextCharset(hdc);
@@ -4264,8 +4145,7 @@ todo_wine /* Wine uses Arial for all substitutions */
hfont = CreateFontIndirectA(&lf);
hfont = SelectObject(hdc, hfont);
GetTextFaceA(hdc, sizeof(buf), buf);
- ok(!lstrcmpiA(buf, "Arial") /* XP, Vista */ ||
- !lstrcmpiA(buf, "Times New Roman") /* Win9x */, "Got %s\n", buf);
+ ok(!lstrcmpiA(buf, "Arial"), "Got %s\n", buf);
cs = GetTextCharset(hdc);
ok(cs == ANSI_CHARSET, "expected ANSI_CHARSET, got %d\n", cs);
DeleteObject(SelectObject(hdc, hfont));
@@ -4286,12 +4166,10 @@ todo_wine /* Wine uses Arial for all substitutions */
{
ret = is_font_installed(font_subst[i].name);
todo_wine
- ok(ret || broken(!ret && !i) /* win2000 doesn't have Times New Roman Baltic substitution */,
- "%s should be enumerated\n", font_subst[i].name);
+ ok(ret, "%s should be enumerated\n", font_subst[i].name);
ret = is_truetype_font_installed(font_subst[i].name);
todo_wine
- ok(ret || broken(!ret && !i) /* win2000 doesn't have Times New Roman Baltic substitution */,
- "%s should be enumerated\n", font_subst[i].name);
+ ok(ret, "%s should be enumerated\n", font_subst[i].name);
memset(&lf, 0, sizeof(lf));
lf.lfHeight = -13;
@@ -4310,8 +4188,7 @@ todo_wine
{
ok(cs == ANSI_CHARSET, "expected ANSI_CHARSET, got %d for font %s\n", cs, font_subst[i].name);
GetTextFaceA(hdc, sizeof(buf), buf);
- ok(!lstrcmpiA(buf, "Arial") /* XP, Vista */ ||
- !lstrcmpiA(buf, "Times New Roman") /* Win9x */, "got %s for font %s\n", buf, font_subst[i].name);
+ ok(!lstrcmpiA(buf, "Arial"), "got %s for font %s\n", buf, font_subst[i].name);
}
DeleteObject(SelectObject(hdc, hfont));
@@ -4324,7 +4201,6 @@ todo_wine
GetTextFaceA(hdc, sizeof(buf), buf);
ok(!lstrcmpiA(buf, "Arial") /* Wine */ ||
!lstrcmpiA(buf, font_subst[i].name) /* XP, Vista */ ||
- !lstrcmpiA(buf, "MS Serif") /* Win9x */ ||
!lstrcmpiA(buf, "MS Sans Serif"), /* win2k3 */
"got %s for font %s\n", buf, font_subst[i].name);
cs = GetTextCharset(hdc);
@@ -4545,9 +4421,7 @@ static void test_GetTextFace(void)
ok(bufA[0] == faceA[0] && bufA[1] == '\0', "GetTextFaceA didn't copy\n");
n = GetTextFaceA(dc, 0, NULL);
- ok(n == sizeof faceA ||
- broken(n == 0), /* win98, winMe */
- "GetTextFaceA returned %d\n", n);
+ ok(n == sizeof faceA, "GetTextFaceA returned %d\n", n);
DeleteObject(SelectObject(dc, g));
ReleaseDC(NULL, dc);
@@ -4749,9 +4623,7 @@ static void test_GetGlyphOutline(void)
SetLastError(0xdeadbeef);
ret = GetGlyphOutlineA(hdc, 'A', GGO_METRICS, &gm, 0, NULL, NULL);
ok(ret == GDI_ERROR, "GetGlyphOutlineA should fail\n");
- ok(GetLastError() == 0xdeadbeef ||
- GetLastError() == ERROR_INVALID_PARAMETER, /* win98, winMe */
- "expected 0xdeadbeef, got %u\n", GetLastError());
+ ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %u\n", GetLastError());
memset(&gm, 0, sizeof(gm));
SetLastError(0xdeadbeef);
@@ -5089,12 +4961,8 @@ static void test_CreateFontIndirect(void)
ret = GetObjectA(hfont, sizeof(getobj_lf), &getobj_lf);
ok(ret, "GetObject failed: %d\n", GetLastError());
ok(lf.lfItalic == getobj_lf.lfItalic, "lfItalic: expect %02x got %02x\n", lf.lfItalic, getobj_lf.lfItalic);
- ok(lf.lfWeight == getobj_lf.lfWeight ||
- broken((SHORT)lf.lfWeight == getobj_lf.lfWeight), /* win9x */
- "lfWeight: expect %08x got %08x\n", lf.lfWeight, getobj_lf.lfWeight);
- ok(!lstrcmpA(lf.lfFaceName, getobj_lf.lfFaceName) ||
- broken(!memcmp(lf.lfFaceName, getobj_lf.lfFaceName, LF_FACESIZE-1)), /* win9x doesn't ensure '\0' termination */
- "font names don't match: %s != %s\n", lf.lfFaceName, getobj_lf.lfFaceName);
+ ok(lf.lfWeight == getobj_lf.lfWeight, "lfWeight: expect %08x got %08x\n", lf.lfWeight, getobj_lf.lfWeight);
+ ok(!lstrcmpA(lf.lfFaceName, getobj_lf.lfFaceName), "font names don't match: %s != %s\n", lf.lfFaceName, getobj_lf.lfFaceName);
DeleteObject(hfont);
}
}
@@ -5104,12 +4972,6 @@ static void test_CreateFontIndirectEx(void)
ENUMLOGFONTEXDVA lfex;
HFONT hfont;
- if (!pCreateFontIndirectExA)
- {
- win_skip("CreateFontIndirectExA is not available\n");
- return;
- }
-
if (!is_truetype_font_installed("Arial"))
{
skip("Arial is not installed\n");
@@ -5117,13 +4979,13 @@ static void test_CreateFontIndirectEx(void)
}
SetLastError(0xdeadbeef);
- hfont = pCreateFontIndirectExA(NULL);
+ hfont = CreateFontIndirectExA(NULL);
ok(hfont == NULL, "got %p\n", hfont);
ok(GetLastError() == 0xdeadbeef, "got error %d\n", GetLastError());
memset(&lfex, 0, sizeof(lfex));
lstrcpyA(lfex.elfEnumLogfontEx.elfLogFont.lfFaceName, "Arial");
- hfont = pCreateFontIndirectExA(&lfex);
+ hfont = CreateFontIndirectExA(&lfex);
ok(hfont != 0, "CreateFontIndirectEx failed\n");
if (hfont)
check_font("Arial", &lfex.elfEnumLogfontEx.elfLogFont, hfont);
@@ -5247,35 +5109,29 @@ static void test_AddFontMemResource(void)
HANDLE ret;
BOOL bRet;
- if (!pAddFontMemResourceEx || !pRemoveFontMemResourceEx)
- {
- win_skip("AddFontMemResourceEx is not available on this platform\n");
- return;
- }
-
SetLastError(0xdeadbeef);
- ret = pAddFontMemResourceEx(NULL, 0, NULL, NULL);
+ ret = AddFontMemResourceEx(NULL, 0, NULL, NULL);
ok(!ret, "AddFontMemResourceEx should fail\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
GetLastError());
SetLastError(0xdeadbeef);
- ret = pAddFontMemResourceEx(NULL, 10, NULL, NULL);
+ ret = AddFontMemResourceEx(NULL, 10, NULL, NULL);
ok(!ret, "AddFontMemResourceEx should fail\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
GetLastError());
SetLastError(0xdeadbeef);
- ret = pAddFontMemResourceEx(NULL, 0, NULL, &num_fonts);
+ ret = AddFontMemResourceEx(NULL, 0, NULL, &num_fonts);
ok(!ret, "AddFontMemResourceEx should fail\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
GetLastError());
SetLastError(0xdeadbeef);
- ret = pAddFontMemResourceEx(NULL, 10, NULL, &num_fonts);
+ ret = AddFontMemResourceEx(NULL, 10, NULL, &num_fonts);
ok(!ret, "AddFontMemResourceEx should fail\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
@@ -5292,7 +5148,7 @@ static void test_AddFontMemResource(void)
ok(!bRet, "Font wine_test should not be enumerated.\n");
num_fonts = 0;
- ret = pAddFontMemResourceEx(font, font_size, NULL, &num_fonts);
+ ret = AddFontMemResourceEx(font, font_size, NULL, &num_fonts);
ok(ret != 0, "Failed to add resource, %d.\n", GetLastError());
ok(num_fonts == 1, "Unexpected number of fonts %u.\n", num_fonts);
@@ -5302,7 +5158,7 @@ todo_wine
test_realization_info("wine_test", font_size, TRUE);
- bRet = pRemoveFontMemResourceEx(ret);
+ bRet = RemoveFontMemResourceEx(ret);
ok(bRet, "RemoveFontMemResourceEx error %d\n", GetLastError());
free_font(font);
@@ -5318,14 +5174,14 @@ todo_wine
}
SetLastError(0xdeadbeef);
- ret = pAddFontMemResourceEx(font, 0, NULL, NULL);
+ ret = AddFontMemResourceEx(font, 0, NULL, NULL);
ok(!ret, "AddFontMemResourceEx should fail\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
GetLastError());
SetLastError(0xdeadbeef);
- ret = pAddFontMemResourceEx(font, 10, NULL, NULL);
+ ret = AddFontMemResourceEx(font, 10, NULL, NULL);
ok(!ret, "AddFontMemResourceEx should fail\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
@@ -5333,28 +5189,25 @@ todo_wine
num_fonts = 0xdeadbeef;
SetLastError(0xdeadbeef);
- ret = pAddFontMemResourceEx(font, 0, NULL, &num_fonts);
+ ret = AddFontMemResourceEx(font, 0, NULL, &num_fonts);
ok(!ret, "AddFontMemResourceEx should fail\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
GetLastError());
ok(num_fonts == 0xdeadbeef, "number of loaded fonts should be 0xdeadbeef\n");
- if (0) /* hangs under windows 2000 */
- {
- num_fonts = 0xdeadbeef;
- SetLastError(0xdeadbeef);
- ret = pAddFontMemResourceEx(font, 10, NULL, &num_fonts);
- ok(!ret, "AddFontMemResourceEx should fail\n");
- ok(GetLastError() == 0xdeadbeef,
- "Expected GetLastError() to return 0xdeadbeef, got %u\n",
- GetLastError());
- ok(num_fonts == 0xdeadbeef, "number of loaded fonts should be 0xdeadbeef\n");
- }
+ num_fonts = 0xdeadbeef;
+ SetLastError(0xdeadbeef);
+ ret = AddFontMemResourceEx(font, 10, NULL, &num_fonts);
+ ok(!ret, "AddFontMemResourceEx should fail\n");
+ ok(GetLastError() == 0xdeadbeef,
+ "Expected GetLastError() to return 0xdeadbeef, got %u\n",
+ GetLastError());
+ ok(num_fonts == 0xdeadbeef, "number of loaded fonts should be 0xdeadbeef\n");
num_fonts = 0xdeadbeef;
SetLastError(0xdeadbeef);
- ret = pAddFontMemResourceEx(font, font_size, NULL, &num_fonts);
+ ret = AddFontMemResourceEx(font, font_size, NULL, &num_fonts);
ok(ret != 0, "AddFontMemResourceEx error %d\n", GetLastError());
ok(num_fonts != 0xdeadbeef, "number of loaded fonts should not be 0xdeadbeef\n");
ok(num_fonts != 0, "number of loaded fonts should not be 0\n");
@@ -5362,7 +5215,7 @@ todo_wine
free_font(font);
SetLastError(0xdeadbeef);
- bRet = pRemoveFontMemResourceEx(ret);
+ bRet = RemoveFontMemResourceEx(ret);
ok(bRet, "RemoveFontMemResourceEx error %d\n", GetLastError());
/* test invalid pointer to number of loaded fonts */
@@ -5370,14 +5223,14 @@ todo_wine
ok(font != NULL, "Unable to locate and load font sserife.fon\n");
SetLastError(0xdeadbeef);
- ret = pAddFontMemResourceEx(font, font_size, NULL, (void *)0xdeadbeef);
+ ret = AddFontMemResourceEx(font, font_size, NULL, (void *)0xdeadbeef);
ok(!ret, "AddFontMemResourceEx should fail\n");
ok(GetLastError() == 0xdeadbeef,
"Expected GetLastError() to return 0xdeadbeef, got %u\n",
GetLastError());
SetLastError(0xdeadbeef);
- ret = pAddFontMemResourceEx(font, font_size, NULL, NULL);
+ ret = AddFontMemResourceEx(font, font_size, NULL, NULL);
ok(!ret, "AddFontMemResourceEx should fail\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
@@ -6012,12 +5865,6 @@ static void test_CreateScalableFontResource(void)
DWORD ret;
int i;
- if (!pAddFontResourceExA || !pRemoveFontResourceExA)
- {
- win_skip("AddFontResourceExA is not available on this platform\n");
- return;
- }
-
if (!write_ttf_file("wine_test.ttf", ttf_name))
{
skip("Failed to create ttf file for testing\n");
@@ -6066,7 +5913,7 @@ static void test_CreateScalableFontResource(void)
ret = DeleteFileA(fot_name);
ok(ret, "DeleteFile() error %d\n", GetLastError());
- ret = pRemoveFontResourceExA(fot_name, 0, 0);
+ ret = RemoveFontResourceExA(fot_name, 0, 0);
ok(!ret, "RemoveFontResourceEx() should fail\n");
/* test public font resource */
@@ -6078,7 +5925,7 @@ static void test_CreateScalableFontResource(void)
ok(!ret, "font wine_test should not be enumerated\n");
SetLastError(0xdeadbeef);
- ret = pAddFontResourceExA(fot_name, 0, 0);
+ ret = AddFontResourceExA(fot_name, 0, 0);
ok(ret, "AddFontResourceEx() error %d\n", GetLastError());
ret = is_truetype_font_installed("wine_test");
@@ -6089,33 +5936,33 @@ static void test_CreateScalableFontResource(void)
test_GetGlyphOutline_character();
test_fstype_fixup();
- ret = pRemoveFontResourceExA(fot_name, FR_PRIVATE, 0);
+ ret = RemoveFontResourceExA(fot_name, FR_PRIVATE, 0);
ok(!ret, "RemoveFontResourceEx() with not matching flags should fail\n");
SetLastError(0xdeadbeef);
- ret = pRemoveFontResourceExA(fot_name, 0, 0);
+ ret = RemoveFontResourceExA(fot_name, 0, 0);
ok(ret, "RemoveFontResourceEx() error %d\n", GetLastError());
ret = is_truetype_font_installed("wine_test");
ok(!ret, "font wine_test should not be enumerated\n");
- ret = pRemoveFontResourceExA(fot_name, 0, 0);
+ ret = RemoveFontResourceExA(fot_name, 0, 0);
ok(!ret, "RemoveFontResourceEx() should fail\n");
/* test refcounting */
for (i = 0; i < 5; i++)
{
SetLastError(0xdeadbeef);
- ret = pAddFontResourceExA(fot_name, 0, 0);
+ ret = AddFontResourceExA(fot_name, 0, 0);
ok(ret, "AddFontResourceEx() error %d\n", GetLastError());
}
for (i = 0; i < 5; i++)
{
SetLastError(0xdeadbeef);
- ret = pRemoveFontResourceExA(fot_name, 0, 0);
+ ret = RemoveFontResourceExA(fot_name, 0, 0);
ok(ret, "RemoveFontResourceEx() error %d\n", GetLastError());
}
- ret = pRemoveFontResourceExA(fot_name, 0, 0);
+ ret = RemoveFontResourceExA(fot_name, 0, 0);
ok(!ret, "RemoveFontResourceEx() should fail\n");
DeleteFileA(fot_name);
@@ -6129,7 +5976,7 @@ static void test_CreateScalableFontResource(void)
ok(!ret, "font wine_test should not be enumerated\n");
SetLastError(0xdeadbeef);
- ret = pAddFontResourceExA(fot_name, 0, 0);
+ ret = AddFontResourceExA(fot_name, 0, 0);
ok(ret, "AddFontResourceEx() error %d\n", GetLastError());
ret = is_truetype_font_installed("wine_test");
@@ -6138,13 +5985,13 @@ static void test_CreateScalableFontResource(void)
/* XP allows removing a private font added with 0 flags */
SetLastError(0xdeadbeef);
- ret = pRemoveFontResourceExA(fot_name, FR_PRIVATE, 0);
+ ret = RemoveFontResourceExA(fot_name, FR_PRIVATE, 0);
ok(ret, "RemoveFontResourceEx() error %d\n", GetLastError());
ret = is_truetype_font_installed("wine_test");
ok(!ret, "font wine_test should not be enumerated\n");
- ret = pRemoveFontResourceExA(fot_name, 0, 0);
+ ret = RemoveFontResourceExA(fot_name, 0, 0);
ok(!ret, "RemoveFontResourceEx() should fail\n");
DeleteFileA(fot_name);
@@ -6194,7 +6041,7 @@ static void check_vertical_font(const char *name, BOOL *installed, BOOL *selecte
if (!*selected)
memset(gm, 0, sizeof *gm);
- ret = pGetGlyphIndicesW(hdc, str, 1, gi, 0);
+ ret = GetGlyphIndicesW(hdc, str, 1, gi, 0);
ok(ret != GDI_ERROR, "GetGlyphIndicesW failed\n");
SelectObject(hdc, hfont_prev);
@@ -6259,26 +6106,21 @@ static void check_vertical_metrics(const char *face)
int offset;
SHORT topSideBearing;
- if (!pGetGlyphIndicesW) {
- win_skip("GetGlyphIndices is not available on this platform\n");
- }
- else {
- ret = pGetGlyphIndicesW(hdc, (LPCWSTR)&code, 1, &idx, 0);
- ok(ret != 0, "GetGlyphIndicesW failed\n");
- numOfLongVerMetrics = GET_BE_WORD(numOfLongVerMetrics);
- if (numOfLongVerMetrics > idx)
- offset = idx * 2 + 1;
- else
- offset = numOfLongVerMetrics * 2 + (idx - numOfLongVerMetrics);
- ret = GetFontData(hdc, MS_MAKE_TAG('v','m','t','x'), offset * sizeof(SHORT),
- &topSideBearing, sizeof(SHORT));
- ok(ret != GDI_ERROR, "GetFontData(vmtx) failed\n");
- topSideBearing = GET_BE_WORD(topSideBearing);
- ok(match_off_by_1(vgm.gmptGlyphOrigin.x,
- MulDiv(topSideBearing, height, otm.otmEMSquare), FALSE),
- "expected %d, got %d\n",
- MulDiv(topSideBearing, height, otm.otmEMSquare), vgm.gmptGlyphOrigin.x);
- }
+ ret = GetGlyphIndicesW(hdc, (LPCWSTR)&code, 1, &idx, 0);
+ ok(ret != 0, "GetGlyphIndicesW failed\n");
+ numOfLongVerMetrics = GET_BE_WORD(numOfLongVerMetrics);
+ if (numOfLongVerMetrics > idx)
+ offset = idx * 2 + 1;
+ else
+ offset = numOfLongVerMetrics * 2 + (idx - numOfLongVerMetrics);
+ ret = GetFontData(hdc, MS_MAKE_TAG('v','m','t','x'), offset * sizeof(SHORT),
+ &topSideBearing, sizeof(SHORT));
+ ok(ret != GDI_ERROR, "GetFontData(vmtx) failed\n");
+ topSideBearing = GET_BE_WORD(topSideBearing);
+ ok(match_off_by_1(vgm.gmptGlyphOrigin.x,
+ MulDiv(topSideBearing, height, otm.otmEMSquare), FALSE),
+ "expected %d, got %d\n",
+ MulDiv(topSideBearing, height, otm.otmEMSquare), vgm.gmptGlyphOrigin.x);
}
else
{
@@ -6287,8 +6129,7 @@ static void check_vertical_metrics(const char *face)
vgm.gmptGlyphOrigin.x, rgm.gmptGlyphOrigin.x, vgm.gmCellIncX, otm.otmDescent);
}
- ok(vgm.gmptGlyphOrigin.y == abc.abcA + abc.abcB + otm.otmDescent ||
- broken(vgm.gmptGlyphOrigin.y == abc.abcA + abc.abcB - otm.otmTextMetrics.tmDescent) /* win2k */,
+ ok(vgm.gmptGlyphOrigin.y == abc.abcA + abc.abcB + otm.otmDescent,
"got %d, expected abcA(%d) + abcB(%u) + descent(%d)\n",
(INT)vgm.gmptGlyphOrigin.y, abc.abcA, abc.abcB, otm.otmDescent);
@@ -6309,19 +6150,13 @@ static void test_vertical_font(void)
"@MS UI Gothic", /* has vmtx table, available on native */
};
- if (!pAddFontResourceExA || !pRemoveFontResourceExA || !pGetGlyphIndicesW)
- {
- win_skip("AddFontResourceExA or GetGlyphIndicesW is not available on this platform\n");
- return;
- }
-
if (!write_ttf_file("vertical.ttf", ttf_name))
{
skip("Failed to create ttf file for testing\n");
return;
}
- num = pAddFontResourceExA(ttf_name, FR_PRIVATE, 0);
+ num = AddFontResourceExA(ttf_name, FR_PRIVATE, 0);
ok(num == 2, "AddFontResourceExA should add 2 fonts from vertical.ttf\n");
check_vertical_font("WineTestVertical", &installed, &selected, &gm, &hgi);
@@ -6349,7 +6184,7 @@ static void test_vertical_font(void)
check_vertical_metrics(&face[1]);
}
- ret = pRemoveFontResourceExA(ttf_name, FR_PRIVATE, 0);
+ ret = RemoveFontResourceExA(ttf_name, FR_PRIVATE, 0);
ok(ret, "RemoveFontResourceEx() error %d\n", GetLastError());
DeleteFileA(ttf_name);
@@ -6510,12 +6345,7 @@ static void test_stock_fonts(void)
ok(hfont != 0, "%d: GetStockObject(%d) failed\n", i, font[i]);
ret = GetObjectA(hfont, sizeof(lf), &lf);
- if (ret != sizeof(lf))
- {
- /* NT4 */
- win_skip("%d: GetObject returned %d instead of sizeof(LOGFONT)\n", i, ret);
- continue;
- }
+ ok(ret == sizeof(lf), "%d: GetObject returned %d instead of sizeof(LOGFONT)\n", i, ret);
for (j = 0; td[i][j].face_name[0] != 0; j++)
{
@@ -6664,12 +6494,6 @@ static void test_GetCharWidth32(void)
INT bufferW;
HWND hwnd;
- if (!pGetCharWidth32W)
- {
- win_skip("GetCharWidth32W not available on this platform\n");
- return;
- }
-
memset(&lf, 0, sizeof(lf));
strcpy(lf.lfFaceName, "System");
lf.lfHeight = 20;
@@ -6678,7 +6502,7 @@ static void test_GetCharWidth32(void)
hdc = GetDC(0);
hfont = SelectObject(hdc, hfont);
- ret = pGetCharWidth32W(hdc, 'a', 'a', &bufferW);
+ ret = GetCharWidth32W(hdc, 'a', 'a', &bufferW);
ok(ret, "GetCharWidth32W should have succeeded\n");
ret = GetCharWidth32A(hdc, 'a', 'a', &bufferA);
ok(ret, "GetCharWidth32A should have succeeded\n");
@@ -6700,25 +6524,25 @@ static void test_GetCharWidth32(void)
SetMapMode( hdc, MM_ANISOTROPIC );
SelectObject(hdc, hfont);
- ret = pGetCharWidth32W(hdc, 'a', 'a', &bufferW);
+ ret = GetCharWidth32W(hdc, 'a', 'a', &bufferW);
ok(ret, "GetCharWidth32W should have succeeded\n");
ok (bufferW > 0," Width should be greater than zero\n");
SetWindowExtEx(hdc, -1,-1,NULL);
SetGraphicsMode(hdc, GM_COMPATIBLE);
- ret = pGetCharWidth32W(hdc, 'a', 'a', &bufferW);
+ ret = GetCharWidth32W(hdc, 'a', 'a', &bufferW);
ok(ret, "GetCharWidth32W should have succeeded\n");
ok (bufferW > 0," Width should be greater than zero\n");
SetGraphicsMode(hdc, GM_ADVANCED);
- ret = pGetCharWidth32W(hdc, 'a', 'a', &bufferW);
+ ret = GetCharWidth32W(hdc, 'a', 'a', &bufferW);
ok(ret, "GetCharWidth32W should have succeeded\n");
ok (bufferW > 0," Width should be greater than zero\n");
SetWindowExtEx(hdc, 1,1,NULL);
SetGraphicsMode(hdc, GM_COMPATIBLE);
- ret = pGetCharWidth32W(hdc, 'a', 'a', &bufferW);
+ ret = GetCharWidth32W(hdc, 'a', 'a', &bufferW);
ok(ret, "GetCharWidth32W should have succeeded\n");
ok (bufferW > 0," Width should be greater than zero\n");
SetGraphicsMode(hdc, GM_ADVANCED);
- ret = pGetCharWidth32W(hdc, 'a', 'a', &bufferW);
+ ret = GetCharWidth32W(hdc, 'a', 'a', &bufferW);
ok(ret, "GetCharWidth32W should have succeeded\n");
ok (bufferW > 0," Width should be greater than zero\n");
@@ -6731,25 +6555,25 @@ static void test_GetCharWidth32(void)
SetMapMode( hdc, MM_ANISOTROPIC );
SelectObject(hdc, hfont);
- ret = pGetCharWidth32W(hdc, 'a', 'a', &bufferW);
+ ret = GetCharWidth32W(hdc, 'a', 'a', &bufferW);
ok(ret, "GetCharWidth32W should have succeeded\n");
ok (bufferW > 0," Width should be greater than zero\n");
SetWindowExtEx(hdc, -1,-1,NULL);
SetGraphicsMode(hdc, GM_COMPATIBLE);
- ret = pGetCharWidth32W(hdc, 'a', 'a', &bufferW);
+ ret = GetCharWidth32W(hdc, 'a', 'a', &bufferW);
ok(ret, "GetCharWidth32W should have succeeded\n");
ok (bufferW > 0," Width should be greater than zero\n");
SetGraphicsMode(hdc, GM_ADVANCED);
- ret = pGetCharWidth32W(hdc, 'a', 'a', &bufferW);
+ ret = GetCharWidth32W(hdc, 'a', 'a', &bufferW);
ok(ret, "GetCharWidth32W should have succeeded\n");
ok (bufferW > 0," Width should be greater than zero\n");
SetWindowExtEx(hdc, 1,1,NULL);
SetGraphicsMode(hdc, GM_COMPATIBLE);
- ret = pGetCharWidth32W(hdc, 'a', 'a', &bufferW);
+ ret = GetCharWidth32W(hdc, 'a', 'a', &bufferW);
ok(ret, "GetCharWidth32W should have succeeded\n");
ok (bufferW > 0," Width should be greater than zero\n");
SetGraphicsMode(hdc, GM_ADVANCED);
- ret = pGetCharWidth32W(hdc, 'a', 'a', &bufferW);
+ ret = GetCharWidth32W(hdc, 'a', 'a', &bufferW);
ok(ret, "GetCharWidth32W should have succeeded\n");
ok (bufferW > 0," Width should be greater than zero\n");
@@ -6903,11 +6727,6 @@ static void test_bitmap_font_glyph_index(void)
CHARSETINFO ci;
BYTE chr = '\xA9';
- if (!pGetGlyphIndicesW) {
- win_skip("GetGlyphIndices is unavailable\n");
- return;
- }
-
hdc = CreateCompatibleDC(0);
ok(hdc != NULL, "CreateCompatibleDC failed\n");
@@ -6952,7 +6771,7 @@ static void test_bitmap_font_glyph_index(void)
{
int len = lstrlenW(text);
LPWORD indices = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WORD));
- ret = pGetGlyphIndicesW(hdc, text, len, indices, 0);
+ ret = GetGlyphIndicesW(hdc, text, len, indices, 0);
ok(ret, "GetGlyphIndices failed\n");
ok(memcmp(indices, text, sizeof(WORD) * len) == 0,
"Glyph indices and text are different for %s:%d\n", lf.lfFaceName, tm.tmCharSet);
--
2.34.1
2
1
[PATCH 1/2] gdi32/tests: Mark a GetTextExtentPointW test as broken on Windows 10
by Alex Henrie Jan. 12, 2022
by Alex Henrie Jan. 12, 2022
Jan. 12, 2022
Fixes a testbot failure.
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
dlls/gdi32/tests/font.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 0c346fa5e6b..269151a1e1a 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -2457,7 +2457,8 @@ static void testJustification(const char *context, HDC hdc, PCSTR str, RECT *cli
{
/* The width returned by GetTextExtentPoint32() is exactly the same
returned by GetTextExtentExPointW() - see dlls/gdi32/font.c */
- ok(error[e].GetTextExtentExPointWWidth == areaWidth,
+ ok(error[e].GetTextExtentExPointWWidth == areaWidth ||
+ broken(abs(areaWidth - error[e].GetTextExtentExPointWWidth) <= 2) /* win10 */,
"%s: GetTextExtentPointW() for \"%.*s\" should have returned a width of %d, not %d.\n",
context, error[e].len, error[e].start, areaWidth, error[e].GetTextExtentExPointWWidth);
}
--
2.34.1
3
3
[tools] testbot/LibvirtTool: SetWinLocale does not support --vm anymore.
by Francois Gouget Jan. 11, 2022
by Francois Gouget Jan. 11, 2022
Jan. 11, 2022
Also pass the --debug option if appropriate.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/bin/LibvirtTool.pl | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl
index c4dbffbaad..70dfd34634 100755
--- a/testbot/bin/LibvirtTool.pl
+++ b/testbot/bin/LibvirtTool.pl
@@ -673,7 +673,9 @@ sub Revert()
if ($SetLocale)
{
Debug(Elapsed($Start), " Setting up the $SetLocale locale on $VMKey\n");
- if (system("$BinDir/SetWinLocale", "--vm", $VMKey, "--default", $SetLocale))
+ my @Cmd = ("$BinDir/SetWinLocale", $VM->Hostname, "--default", $SetLocale);
+ push @Cmd, "--debug" if ($Debug);
+ if (system(@Cmd))
{
FatalError("Could not set the $VMKey locale to $SetLocale\n");
}
--
2.30.2
1
0
Jan. 11, 2022
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/bin/SetWinLocale | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/testbot/bin/SetWinLocale b/testbot/bin/SetWinLocale
index c62d663335..e776e4a802 100755
--- a/testbot/bin/SetWinLocale
+++ b/testbot/bin/SetWinLocale
@@ -98,12 +98,18 @@ sub FatalError(@)
# Country and keyboard tables
#
+# Map the two-letter country identifier to the Windows country code used in
+# the registry. Note that this does not match the CTRY_XXX codes!
my %Countries = (
+ "AD" => 8, # Andorra
+ "AE" => 224, # United Arab Emirates
"AF" => 3, # Afganistan
"AL" => 6, # Albania
+ "DZ" => 4, # Algeria
"AM" => 7, # Armenia
"AR" => 11, # Argentina
"AT" => 14, # Austria
+ "AU" => 12, # Australia
"AZ" => 5, # Azerbaijan
"BA" => 25, # Bosnia and Herzegovina
"BE" => 21, # Belgium
@@ -114,7 +120,7 @@ my %Countries = (
"CA" => 39, # Canada
"CH" => 223, # Switzerland
"CN" => 45, # China
- "CX" => 12, # Australia
+ "CX" => 309, # Christmas Island
"CZ" => 75, # Czech Republic
"DE" => 94, # Germany
"DK" => 61, # Denmark
--
2.30.2
1
0
[tools] testbot/SetWinLocale: Warn when a locale may not be installed.
by Francois Gouget Jan. 11, 2022
by Francois Gouget Jan. 11, 2022
Jan. 11, 2022
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/bin/SetWinLocale | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testbot/bin/SetWinLocale b/testbot/bin/SetWinLocale
index e776e4a802..b2da673eda 100755
--- a/testbot/bin/SetWinLocale
+++ b/testbot/bin/SetWinLocale
@@ -672,7 +672,7 @@ sub GetWinKeyboardIds($)
$WinKeyboardIds{$Locale} ||= $Keyboards{$Locale};
if (!$WinKeyboardIds{$Locale})
{
- FatalError("could not find the $Locale LCID and keyboard ids\n");
+ FatalError("could not find the $Locale LCID and keyboard ids. Maybe the locale is not installed?\n");
}
my $WinLCID = uc($WinKeyboardIds{$Locale}->[0]);
--
2.30.2
1
0