Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- 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
June 2018
- 68 participants
- 1149 messages
Re: [PATCH v2] hnetcfg: Store the full path in INetFwAuthorizedApplication_put_ProcessImageFileName().
by Alexandre Julliard
Zebediah Figura <z.figura12(a)gmail.com> writes:
> Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
> ---
> dlls/hnetcfg/apps.c | 17 ++++++++++++-----
> dlls/hnetcfg/tests/policy.c | 5 ++++-
> 2 files changed, 16 insertions(+), 6 deletions(-)
It doesn't work here:
../../../tools/runtest -q -P wine -T ../../.. -M hnetcfg.dll -p hnetcfg_test.exe.so policy && touch policy.ok
0009:err:seh:raise_exception Unhandled exception code c0000005 flags 0 addr 0x7bc4ed69
Makefile:183: recipe for target 'policy.ok' failed
--
Alexandre Julliard
julliard(a)winehq.org
June 25, 2018
[PATCH v2 4/4] winemac.drv: Implement waking up the display when activity occurs.
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/winemac.drv/macdrv_main.c | 12 ++++++++++++
dlls/winemac.drv/winemac.drv.spec | 3 +++
2 files changed, 15 insertions(+)
diff --git a/dlls/winemac.drv/macdrv_main.c b/dlls/winemac.drv/macdrv_main.c
index 491ab06..ea0beec 100644
--- a/dlls/winemac.drv/macdrv_main.c
+++ b/dlls/winemac.drv/macdrv_main.c
@@ -451,3 +451,15 @@ BOOL CDECL macdrv_SystemParametersInfo( UINT action, UINT int_param, void *ptr_p
}
return FALSE;
}
+
+/***********************************************************************
+ * wine_notify_activity (MACDRV.@)
+ *
+ * Notify the display server that activity has occurred, e.g. to wake up
+ * the display and reset any power management related timeouts.
+ */
+void CDECL macdrv_notify_activity(void)
+{
+ static IOPMAssertionID assertion;
+ IOPMAssertionDeclareUserActivity(CFSTR("Wine user input"), kIOPMUserActiveLocal, &assertion);
+}
diff --git a/dlls/winemac.drv/winemac.drv.spec b/dlls/winemac.drv/winemac.drv.spec
index 6fa723a..9658fad 100644
--- a/dlls/winemac.drv/winemac.drv.spec
+++ b/dlls/winemac.drv/winemac.drv.spec
@@ -45,6 +45,9 @@
@ cdecl WindowPosChanged(long long long ptr ptr ptr ptr ptr) macdrv_WindowPosChanged
@ cdecl WindowPosChanging(long long long ptr ptr ptr ptr) macdrv_WindowPosChanging
+# Desktop
+@ cdecl wine_notify_activity() macdrv_notify_activity
+
# System tray
@ cdecl wine_notify_icon(long ptr)
--
2.7.4
June 25, 2018
[PATCH v2 3/4] winex11.drv: Implement waking up the display when activity occurs.
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/winex11.drv/winex11.drv.spec | 1 +
dlls/winex11.drv/x11drv_main.c | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec
index 614f0b9..c833edb 100644
--- a/dlls/winex11.drv/winex11.drv.spec
+++ b/dlls/winex11.drv/winex11.drv.spec
@@ -57,6 +57,7 @@
# Desktop
@ cdecl wine_create_desktop(long long) X11DRV_create_desktop
+@ cdecl wine_notify_activity() X11DRV_notify_activity
# System tray
@ cdecl wine_notify_icon(long ptr)
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index 4654556..0dbd4f6 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -739,3 +739,15 @@ BOOL CDECL X11DRV_SystemParametersInfo( UINT action, UINT int_param, void *ptr_p
}
return FALSE; /* let user32 handle it */
}
+
+/***********************************************************************
+ * wine_notify_activity (X11DRV.@)
+ *
+ * Notify the display server that activity has occurred, e.g. to wake up
+ * the display and reset any power management related timeouts.
+ */
+void CDECL X11DRV_notify_activity(void)
+{
+ XResetScreenSaver( gdi_display );
+ XFlush( gdi_display );
+}
--
2.7.4
June 25, 2018
[PATCH v2 2/4] dinput: Notify the desktop window when device input is received.
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/dinput/device.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index 7b83a39..daa6406 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -39,6 +39,8 @@
#include "device_private.h"
#include "dinput_private.h"
+#define WM_WINE_NOTIFY_ACTIVITY WM_USER
+
WINE_DEFAULT_DEBUG_CHANNEL(dinput);
static inline IDirectInputDeviceImpl *impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
@@ -935,6 +937,8 @@ void queue_event(LPDIRECTINPUTDEVICE8A iface, int inst_id, DWORD data, DWORD tim
/* Event is being set regardless of the queue state */
if (This->hEvent) SetEvent(This->hEvent);
+ SendMessageW(GetDesktopWindow(), WM_WINE_NOTIFY_ACTIVITY, 0, 0);
+
if (!This->queue_len || This->overflow || ofs < 0) return;
next_pos = (This->queue_head + 1) % This->queue_len;
--
2.7.4
June 25, 2018
[PATCH v2 1/4] explorer: Add a private message to notify the graphics driver when activity occurs.
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
programs/explorer/desktop.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c
index a2d9e1a..f5a01c2 100644
--- a/programs/explorer/desktop.c
+++ b/programs/explorer/desktop.c
@@ -46,6 +46,10 @@ static const WCHAR default_driver[] = {'m','a','c',',','x','1','1',0};
static const WCHAR default_driver[] = {'x','1','1',0};
#endif
+static void (CDECL *wine_notify_activity)(void);
+
+#define WM_WINE_NOTIFY_ACTIVITY WM_USER
+
static BOOL using_root;
struct launcher
@@ -661,6 +665,11 @@ static LRESULT WINAPI desktop_wnd_proc( HWND hwnd, UINT message, WPARAM wp, LPAR
}
return 0;
+ case WM_WINE_NOTIFY_ACTIVITY:
+ if (wine_notify_activity)
+ wine_notify_activity();
+ return 0;
+
default:
return DefWindowProcW( hwnd, message, wp, lp );
}
@@ -1005,6 +1014,8 @@ void manage_desktop( WCHAR *arg )
{
pShellDDEInit( TRUE );
}
+
+ wine_notify_activity = (void *)GetProcAddress( graphics_driver, "wine_notify_activity" );
}
}
--
2.7.4
June 25, 2018
[PATCH] gdi32/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/gdi32/tests/bitmap.c | 10 ++++-----
dlls/gdi32/tests/brush.c | 2 +-
dlls/gdi32/tests/dc.c | 6 +++---
dlls/gdi32/tests/dib.c | 38 ++++++++++++++++-----------------
dlls/gdi32/tests/font.c | 52 ++++++++++++++++++++++-----------------------
dlls/gdi32/tests/gdiobj.c | 2 +-
dlls/gdi32/tests/icm.c | 2 +-
dlls/gdi32/tests/metafile.c | 7 +++---
dlls/gdi32/tests/path.c | 14 ++++++------
dlls/gdi32/tests/pen.c | 2 +-
10 files changed, 67 insertions(+), 68 deletions(-)
diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c
index a4002c83b5..4748691791 100644
--- a/dlls/gdi32/tests/bitmap.c
+++ b/dlls/gdi32/tests/bitmap.c
@@ -84,7 +84,7 @@ static void test_bitmap_info(HBITMAP hbm, INT expected_depth, const BITMAPINFOHE
SetLastError(0xdeadbeef);
test_size[0] = bm.bmWidthBytes * bm.bmHeight;
/* NULL output buffer with different count values */
- for (i = 0; i < sizeof(test_size) / sizeof(test_size[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(test_size); i++)
{
ret = GetBitmapBits(hbm, test_size[i], NULL);
ok(ret == bm.bmWidthBytes * bm.bmHeight, "%d != %d\n", ret, bm.bmWidthBytes * bm.bmHeight);
@@ -94,7 +94,7 @@ static void test_bitmap_info(HBITMAP hbm, INT expected_depth, const BITMAPINFOHE
memset(buf_cmp, 0, bm.bmWidthBytes * bm.bmHeight);
/* Correct output buffer with different count values */
- for (i = 0; i < sizeof(test_size) / sizeof(test_size[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(test_size); i++)
{
int expect = i == 1 ? 0 : bm.bmWidthBytes * bm.bmHeight;
memset(buf, 0xAA, sizeof(buf));
@@ -1745,7 +1745,7 @@ static void test_mono_bitmap(void)
SelectObject( hdc, hbmp );
- for (col = 0; col < sizeof(colors) / sizeof(colors[0]); col++)
+ for (col = 0; col < ARRAY_SIZE(colors); col++)
{
SetTextColor( hdc, colors[col][0] );
SetBkColor( hdc, colors[col][1] );
@@ -2690,7 +2690,7 @@ static void test_select_object(void)
DeleteObject(hbm);
- for(i = 0; i < sizeof(depths)/sizeof(depths[0]); i++) {
+ for(i = 0; i < ARRAY_SIZE(depths); i++) {
/* test a color bitmap to dc bpp matching */
planes = GetDeviceCaps(hdc, PLANES);
bpp = GetDeviceCaps(hdc, BITSPIXEL);
@@ -5710,7 +5710,7 @@ static void test_D3DKMTCreateDCFromMemory( void )
status = pD3DKMTCreateDCFromMemory( NULL );
ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#x.\n", status);
- for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
+ for (i = 0; i < ARRAY_SIZE(test_data); ++i)
{
memset( data, 0xaa, sizeof(data) );
diff --git a/dlls/gdi32/tests/brush.c b/dlls/gdi32/tests/brush.c
index 1a10429c05..a3ebb91e1e 100644
--- a/dlls/gdi32/tests/brush.c
+++ b/dlls/gdi32/tests/brush.c
@@ -48,7 +48,7 @@ static void test_solidbrush(void)
size_t i;
INT ret;
- for(i=0; i<sizeof(stock)/sizeof(stock[0]); i++) {
+ for(i = 0; i < ARRAY_SIZE(stock); i++) {
solidBrush = CreateSolidBrush(stock[i].color);
if(stock[i].stockobj != -1) {
diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c
index 3c1fa603a6..5ad3b31483 100644
--- a/dlls/gdi32/tests/dc.c
+++ b/dlls/gdi32/tests/dc.c
@@ -361,7 +361,7 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale
if (GetObjectType( hdc ) == OBJ_METADC)
{
- for (i = 0; i < sizeof(caps)/sizeof(caps[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(caps); i++)
ok( GetDeviceCaps( hdc, caps[i] ) == (caps[i] == TECHNOLOGY ? DT_METAFILE : 0),
"wrong caps on %s for %u: %u\n", descr, caps[i],
GetDeviceCaps( hdc, caps[i] ) );
@@ -384,7 +384,7 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale
}
else
{
- for (i = 0; i < sizeof(caps)/sizeof(caps[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(caps); i++)
{
INT precision = 0;
INT hdc_caps = GetDeviceCaps( hdc, caps[i] );
@@ -506,7 +506,7 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale
dib = CreateDIBSection( ref_dc, info, DIB_RGB_COLORS, NULL, NULL, 0 );
old = SelectObject( hdc, dib );
- for (i = 0; i < sizeof(caps)/sizeof(caps[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(caps); i++)
ok( GetDeviceCaps( hdc, caps[i] ) == GetDeviceCaps( ref_dc, caps[i] ),
"mismatched caps on %s and DIB for %u: %u/%u\n", descr, caps[i],
GetDeviceCaps( hdc, caps[i] ), GetDeviceCaps( ref_dc, caps[i] ) );
diff --git a/dlls/gdi32/tests/dib.c b/dlls/gdi32/tests/dib.c
index e3f188749d..d16cb0df5c 100644
--- a/dlls/gdi32/tests/dib.c
+++ b/dlls/gdi32/tests/dib.c
@@ -1559,7 +1559,7 @@ static const POINT polypoly_lines[] =
static const DWORD polypoly_counts[] =
{
- sizeof(polypoly_lines)/sizeof(polypoly_lines[0])
+ ARRAY_SIZE(polypoly_lines)
};
static const RECT patblt_clips[] =
@@ -1816,7 +1816,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
}
compare_hash(hdc, bmi, bits, "diagonal solid lines");
- for(i = 0; i < sizeof(bias_check) / sizeof(bias_check[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(bias_check); i++)
{
MoveToEx(hdc, bias_check[i].left, bias_check[i].top, NULL);
LineTo(hdc, bias_check[i].right, bias_check[i].bottom);
@@ -1851,21 +1851,21 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
ExtSelectClipRgn(hdc, hrgn, RGN_COPY);
DeleteObject(hrgn2);
- for(i = 0; i < sizeof(hline_clips)/sizeof(hline_clips[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(hline_clips); i++)
{
MoveToEx(hdc, hline_clips[i].left, hline_clips[i].top, NULL);
LineTo(hdc, hline_clips[i].right, hline_clips[i].bottom);
}
compare_hash(hdc, bmi, bits, "clipped solid hlines");
- for(i = 0; i < sizeof(vline_clips)/sizeof(vline_clips[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(vline_clips); i++)
{
MoveToEx(hdc, vline_clips[i].left, vline_clips[i].top, NULL);
LineTo(hdc, vline_clips[i].right, vline_clips[i].bottom);
}
compare_hash(hdc, bmi, bits, "clipped solid vlines");
- for(i = 0; i < sizeof(line_clips)/sizeof(line_clips[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(line_clips); i++)
{
MoveToEx(hdc, line_clips[i].left, line_clips[i].top, NULL);
LineTo(hdc, line_clips[i].right, line_clips[i].bottom);
@@ -1873,7 +1873,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
compare_hash(hdc, bmi, bits, "clipped solid diagonal lines");
/* clipped PatBlt */
- for(i = 0; i < sizeof(patblt_clips) / sizeof(patblt_clips[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(patblt_clips); i++)
{
PatBlt(hdc, patblt_clips[i].left, patblt_clips[i].top,
patblt_clips[i].right - patblt_clips[i].left,
@@ -1887,35 +1887,35 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
SetBkMode(hdc, TRANSPARENT);
SetBkColor(hdc, RGB(0, 0xff, 0));
- for(i = 0; i < sizeof(hline_clips)/sizeof(hline_clips[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(hline_clips); i++)
{
MoveToEx(hdc, hline_clips[i].left, hline_clips[i].top, NULL);
LineTo(hdc, hline_clips[i].right, hline_clips[i].bottom);
}
compare_hash(hdc, bmi, bits, "clipped dashed hlines");
- for(i = 0; i < sizeof(hline_clips)/sizeof(hline_clips[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(hline_clips); i++)
{
MoveToEx(hdc, hline_clips[i].right - 1, hline_clips[i].bottom, NULL);
LineTo(hdc, hline_clips[i].left - 1, hline_clips[i].top);
}
compare_hash(hdc, bmi, bits, "clipped dashed hlines r -> l");
- for(i = 0; i < sizeof(vline_clips)/sizeof(vline_clips[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(vline_clips); i++)
{
MoveToEx(hdc, vline_clips[i].left, vline_clips[i].top, NULL);
LineTo(hdc, vline_clips[i].right, vline_clips[i].bottom);
}
compare_hash(hdc, bmi, bits, "clipped dashed vlines");
- for(i = 0; i < sizeof(vline_clips)/sizeof(vline_clips[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(vline_clips); i++)
{
MoveToEx(hdc, vline_clips[i].right, vline_clips[i].bottom - 1, NULL);
LineTo(hdc, vline_clips[i].left, vline_clips[i].top - 1);
}
compare_hash(hdc, bmi, bits, "clipped dashed vlines b -> t");
- for(i = 0; i < sizeof(line_clips)/sizeof(line_clips[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(line_clips); i++)
{
MoveToEx(hdc, line_clips[i].left, line_clips[i].top, NULL);
LineTo(hdc, line_clips[i].right, line_clips[i].bottom);
@@ -1924,7 +1924,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
SetBkMode(hdc, OPAQUE);
- for(i = 0; i < sizeof(line_clips)/sizeof(line_clips[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(line_clips); i++)
{
MoveToEx(hdc, line_clips[i].left, line_clips[i].top, NULL);
LineTo(hdc, line_clips[i].right, line_clips[i].bottom);
@@ -2163,13 +2163,13 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
SelectObject(hdc, solid_pen);
SelectObject(hdc, solid_brush);
- for(i = 0; i < sizeof(rectangles)/sizeof(rectangles[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(rectangles); i++)
{
Rectangle(hdc, rectangles[i].left, rectangles[i].top, rectangles[i].right, rectangles[i].bottom);
}
SelectObject(hdc, dashed_pen);
- for(i = 0; i < sizeof(rectangles)/sizeof(rectangles[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(rectangles); i++)
{
Rectangle(hdc, rectangles[i].left, rectangles[i].top + 150, rectangles[i].right, rectangles[i].bottom + 150);
}
@@ -2775,7 +2775,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
wide_pen = CreatePen( PS_SOLID, 7, RGB( 0xff, 0, 0 ) );
SelectObject( hdc, wide_pen );
- for (i = 0; i < sizeof( wide_lines ) / sizeof( wide_lines[0] ); i++)
+ for (i = 0; i < ARRAY_SIZE(wide_lines); i++)
{
MoveToEx( hdc, wide_lines[i].left, wide_lines[i].top, NULL );
LineTo( hdc, wide_lines[i].right, wide_lines[i].bottom );
@@ -2794,7 +2794,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
9, &log_brush, 0, NULL );
SelectObject( hdc, wide_pen );
SetBrushOrgEx( hdc, 3, 3, NULL );
- Polyline( hdc, poly_lines, sizeof(poly_lines) / sizeof(poly_lines[0]) );
+ Polyline( hdc, poly_lines, ARRAY_SIZE( poly_lines ));
compare_hash_broken_todo( hdc, bmi, bits, "wide pen - flat caps, mitred", is_ddb, is_ddb );
SetBrushOrgEx( hdc, 0, 0, NULL );
@@ -2805,7 +2805,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
16, &log_brush, 0, NULL );
SelectObject( hdc, wide_pen );
- Polyline( hdc, poly_lines, sizeof(poly_lines) / sizeof(poly_lines[0]) );
+ Polyline( hdc, poly_lines, ARRAY_SIZE( poly_lines ));
compare_hash_broken_todo( hdc, bmi, bits, "wide pen - square caps, bevelled", is_ddb, is_ddb );
SelectObject( hdc, orig_pen );
@@ -2815,7 +2815,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
9, &log_brush, 0, NULL );
SelectObject( hdc, wide_pen );
- PolyPolyline( hdc, polypoly_lines, polypoly_counts, sizeof(polypoly_counts)/sizeof(polypoly_counts[0]) );
+ PolyPolyline( hdc, polypoly_lines, polypoly_counts, ARRAY_SIZE( polypoly_counts ));
compare_hash_broken_todo( hdc, bmi, bits, "wide pen - empty segments", is_ddb, is_ddb );
SelectObject( hdc, orig_pen );
@@ -2833,7 +2833,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
12, &log_brush, 0, NULL );
ok( wide_pen != 0, "failed to create pen\n" );
SelectObject( hdc, wide_pen );
- Polyline( hdc, poly_lines, sizeof(poly_lines) / sizeof(poly_lines[0]) );
+ Polyline( hdc, poly_lines, ARRAY_SIZE( poly_lines ));
for (i = 1; i < 20; i++)
{
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 6243a6d339..8f5454b918 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -937,7 +937,7 @@ static void test_bitmap_font_metrics(void)
screen_log_pixels = GetDeviceCaps(hdc, LOGPIXELSY);
diff = 32768;
font_res = 0;
- for (i = 0; i < sizeof(font_log_pixels)/sizeof(font_log_pixels[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(font_log_pixels); i++)
{
int new_diff = abs(font_log_pixels[i] - screen_log_pixels);
if (new_diff < diff)
@@ -948,7 +948,7 @@ static void test_bitmap_font_metrics(void)
}
trace("best font resolution is %d\n", font_res);
- for (i = 0; i < sizeof(fd)/sizeof(fd[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(fd); i++)
{
int bit, height;
@@ -1190,7 +1190,7 @@ static void test_GetCharABCWidths(void)
UINT cs;
UINT a;
UINT w;
- BOOL r[sizeof range / sizeof range[0]];
+ BOOL r[ARRAY_SIZE(range)];
} c[] =
{
{ANSI_CHARSET, 0x30, 0x30,
@@ -1253,7 +1253,7 @@ static void test_GetCharABCWidths(void)
hfont = SelectObject(hdc, hfont);
DeleteObject(hfont);
- for (i = 0; i < sizeof c / sizeof c[0]; ++i)
+ for (i = 0; i < ARRAY_SIZE(c); ++i)
{
ABC a[2], w[2];
ABC full[256];
@@ -1285,7 +1285,7 @@ static void test_GetCharABCWidths(void)
ok(memcmp(&a[0], &full[code], sizeof(ABC)) == 0,
"GetCharABCWidthsA info should match. codepage = %u\n", c[i].cs);
- for (j = 0; j < sizeof range / sizeof range[0]; ++j)
+ for (j = 0; j < ARRAY_SIZE(range); ++j)
{
memset(full, 0xdd, sizeof full);
ret = pGetCharABCWidthsA(hdc, range[j].first, range[j].last, full);
@@ -1774,7 +1774,7 @@ static void test_GetKerningPairs(void)
return;
}
- for (i = 0; i < sizeof(kd)/sizeof(kd[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(kd); i++)
{
OUTLINETEXTMETRICW otm;
UINT uiRet;
@@ -2095,7 +2095,7 @@ static void test_height_selection_vdmx( HDC hdc )
return;
}
- for (i = 0; i < sizeof(data) / sizeof(data[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(data); i++)
{
res = get_res_data( "wine_vdmx.ttf", &size );
@@ -2356,7 +2356,7 @@ static void testJustification(HDC hdc, PCSTR str, RECT *clientArea)
{
SetTextJustification(hdc, areaWidth - size.cx, breakCount);
GetTextExtentPoint32A(hdc, pFirstChar, pLastChar - pFirstChar, &size);
- if (size.cx != areaWidth && nErrors < sizeof(error)/sizeof(error[0]) - 1)
+ if (size.cx != areaWidth && nErrors < ARRAY_SIZE(error) - 1)
{
error[nErrors].start = pFirstChar;
error[nErrors].len = pLastChar - pFirstChar;
@@ -2613,7 +2613,7 @@ static void test_font_charset(void)
return;
}
- for (i = 0; i < sizeof(cd)/sizeof(cd[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(cd); i++)
{
if (cd[i].charset == SYMBOL_CHARSET)
{
@@ -2687,7 +2687,7 @@ static void test_GdiGetCodePage(void)
acp = GetACP();
- for (i = 0; i < sizeof(matching_data) / sizeof(struct _matching_data); i++)
+ for (i = 0; i < ARRAY_SIZE(matching_data); i++)
{
/* only test data matched current locale codepage */
if (matching_data[i].current_codepage != acp)
@@ -3700,7 +3700,7 @@ static int match_name_table_language( const sfnt_name *name, LANGID lang )
break;
case TT_PLATFORM_MACINTOSH:
if (!IsValidCodePage( get_mac_code_page( name ))) return 0;
- if (GET_BE_WORD(name->language_id) >= sizeof(mac_langid_table)/sizeof(mac_langid_table[0])) return 0;
+ if (GET_BE_WORD(name->language_id) >= ARRAY_SIZE(mac_langid_table)) return 0;
name_lang = mac_langid_table[GET_BE_WORD(name->language_id)];
break;
case TT_PLATFORM_APPLE_UNICODE:
@@ -3710,7 +3710,7 @@ static int match_name_table_language( const sfnt_name *name, LANGID lang )
case TT_APPLE_ID_DEFAULT:
case TT_APPLE_ID_ISO_10646:
case TT_APPLE_ID_UNICODE_2_0:
- if (GET_BE_WORD(name->language_id) >= sizeof(mac_langid_table)/sizeof(mac_langid_table[0])) return 0;
+ if (GET_BE_WORD(name->language_id) >= ARRAY_SIZE(mac_langid_table)) return 0;
name_lang = mac_langid_table[GET_BE_WORD(name->language_id)];
break;
default:
@@ -4105,7 +4105,7 @@ static void test_nonexistent_font(void)
hdc = CreateCompatibleDC(0);
- for (i = 0; i < sizeof(shell_subst)/sizeof(shell_subst[0]); i++)
+ 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);
@@ -4201,7 +4201,7 @@ todo_wine /* Wine uses Arial for all substitutions */
ok(cs == ANSI_CHARSET, "expected ANSI_CHARSET, got %d\n", cs);
DeleteObject(SelectObject(hdc, hfont));
- for (i = 0; i < sizeof(font_subst)/sizeof(font_subst[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(font_subst); i++)
{
ret = is_font_installed(font_subst[i].name);
todo_wine
@@ -4487,8 +4487,8 @@ static void test_GetTextFace(void)
dc = GetDC(NULL);
g = SelectObject(dc, f);
- n = GetTextFaceW(dc, sizeof bufW / sizeof bufW[0], bufW);
- ok(n == sizeof faceW / sizeof faceW[0], "GetTextFaceW returned %d\n", n);
+ n = GetTextFaceW(dc, ARRAY_SIZE(bufW), bufW);
+ ok(n == ARRAY_SIZE(faceW), "GetTextFaceW returned %d\n", n);
ok(lstrcmpW(faceW, bufW) == 0, "GetTextFaceW\n");
/* Play with the count arg. */
@@ -4508,7 +4508,7 @@ static void test_GetTextFace(void)
ok(bufW[0] == faceW[0] && bufW[1] == '\0', "GetTextFaceW didn't copy\n");
n = GetTextFaceW(dc, 0, NULL);
- ok(n == sizeof faceW / sizeof faceW[0], "GetTextFaceW returned %d\n", n);
+ ok(n == ARRAY_SIZE(faceW), "GetTextFaceW returned %d\n", n);
DeleteObject(SelectObject(dc, g));
ReleaseDC(NULL, dc);
@@ -4719,7 +4719,7 @@ static void test_GetGlyphOutline(void)
if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
ok(ret == GDI_ERROR, "GetGlyphOutlineW should return an error when the buffer size is too small.\n");
- for (i = 0; i < sizeof(fmt) / sizeof(fmt[0]); ++i)
+ for (i = 0; i < ARRAY_SIZE(fmt); ++i)
{
DWORD dummy;
@@ -4785,7 +4785,7 @@ static void test_GetGlyphOutline(void)
SelectObject(hdc, old_hfont);
DeleteObject(hfont);
- for (i = 0; i < sizeof c / sizeof c[0]; ++i)
+ for (i = 0; i < ARRAY_SIZE(c); ++i)
{
static const MAT2 rotate_mat = {{0, 0}, {0, -1}, {0, 1}, {0, 0}};
TEXTMETRICA tm;
@@ -4955,7 +4955,7 @@ static void test_CreateFontIndirect(void)
lf.lfItalic = FALSE;
lf.lfWeight = FW_DONTCARE;
- for (i = 0; i < sizeof(TestName)/sizeof(TestName[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(TestName); i++)
{
lstrcpyA(lf.lfFaceName, TestName[i]);
hfont = CreateFontIndirectA(&lf);
@@ -5409,7 +5409,7 @@ static void test_fullname(void)
lf.lfItalic = FALSE;
lf.lfWeight = FW_DONTCARE;
- for (i = 0; i < sizeof(TestName) / sizeof(TestName[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(TestName); i++)
{
if (!is_font_installed_fullname("Lucida Sans", TestName[i]))
{
@@ -6058,7 +6058,7 @@ static void test_vertical_font(void)
ok(hgi != vgi, "same glyph h:%u v:%u\n", hgi, vgi);
- for (i = 0; i < sizeof(face_list)/sizeof(face_list[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(face_list); i++) {
const char* face = face_list[i];
if (!is_truetype_font_installed(face)) {
skip("%s is not installed\n", face);
@@ -6092,7 +6092,7 @@ static void test_east_asian_font_selection(void)
hdc = GetDC(NULL);
- for (i = 0; i < sizeof(charset)/sizeof(charset[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(charset); i++)
{
LOGFONTA lf;
HFONT hfont;
@@ -6214,7 +6214,7 @@ static void test_stock_fonts(void)
};
int i, j;
- for (i = 0; i < sizeof(font)/sizeof(font[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(font); i++)
{
HFONT hfont;
LOGFONTA lf;
@@ -6314,7 +6314,7 @@ static void test_max_height(void)
DeleteObject(SelectObject(hdc, hfont_old));
/* test an invalid value */
- for (i = 0; i < sizeof(invalid_height)/sizeof(invalid_height[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(invalid_height); i++) {
lf.lfHeight = invalid_height[i];
hfont = CreateFontIndirectA(&lf);
hfont_old = SelectObject(hdc, hfont);
@@ -6638,7 +6638,7 @@ static void test_bitmap_font_glyph_index(void)
bmi.bmiHeader.biHeight = 32;
bmi.bmiHeader.biCompression = BI_RGB;
- for (i = 0; i < sizeof(bitmap_font_list)/sizeof(bitmap_font_list[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(bitmap_font_list); i++) {
memset(&lf, 0, sizeof(lf));
lf.lfCharSet = bitmap_font_list[i].charset;
strcpy(lf.lfFaceName, bitmap_font_list[i].face);
diff --git a/dlls/gdi32/tests/gdiobj.c b/dlls/gdi32/tests/gdiobj.c
index 65374ea85d..8f3d01c27d 100644
--- a/dlls/gdi32/tests/gdiobj.c
+++ b/dlls/gdi32/tests/gdiobj.c
@@ -345,7 +345,7 @@ static void test_handles_on_win64(void)
if (sizeof(void*) != 8)
return;
- for (i = 0; i < sizeof(cases)/sizeof(cases[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(cases); i++)
{
hrgn = CreateRectRgn(10, 10, 20, 20);
hrgn_test = (HRGN)(ULONG_PTR)((ULONG_PTR)hrgn | ((ULONGLONG)cases[i].high << 32) | cases[i].low);
diff --git a/dlls/gdi32/tests/icm.c b/dlls/gdi32/tests/icm.c
index 620809018a..340ebeef55 100644
--- a/dlls/gdi32/tests/icm.c
+++ b/dlls/gdi32/tests/icm.c
@@ -278,7 +278,7 @@ static void test_SetICMProfileW( HDC dc )
return;
}
- len = sizeof(profile)/sizeof(profile[0]);
+ len = ARRAY_SIZE(profile);
ret = GetICMProfileW( dc, &len, profile );
ok(ret, "GetICMProfileW failed %u\n", GetLastError());
diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c
index 780b65f1b6..230d1e6d84 100644
--- a/dlls/gdi32/tests/metafile.c
+++ b/dlls/gdi32/tests/metafile.c
@@ -183,7 +183,7 @@ static void test_ExtTextOut(void)
static const RECT rc = { 0, 0, 100, 100 };
BOOL ret;
- assert(sizeof(dx)/sizeof(dx[0]) >= lstrlenA(text));
+ assert(ARRAY_SIZE(dx) >= lstrlenA(text));
/* Win9x doesn't play EMFs on invisible windows */
hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
@@ -3895,8 +3895,7 @@ static void test_emf_GradientFill(void)
* written to the EMF, but is not considered in the bounds
* calculation.
*/
- ret = GdiGradientFill( mf, v, sizeof(v) / sizeof(v[0]), tri, sizeof(tri) / sizeof(tri[0]),
- GRADIENT_FILL_TRIANGLE );
+ ret = GdiGradientFill( mf, v, ARRAY_SIZE(v), tri, ARRAY_SIZE(tri), GRADIENT_FILL_TRIANGLE );
ok( ret, "GradientFill\n" );
hemf = CloseEnhMetaFile( mf );
@@ -4117,7 +4116,7 @@ static void test_emf_WorldTransform(void)
{ "manual modify", TRUE, FALSE }
};
- for(i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
+ for(i = 0; i < ARRAY_SIZE(test_data); ++i)
{
hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL);
ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
diff --git a/dlls/gdi32/tests/path.c b/dlls/gdi32/tests/path.c
index 48ef4f016a..80145fc6b2 100644
--- a/dlls/gdi32/tests/path.c
+++ b/dlls/gdi32/tests/path.c
@@ -495,7 +495,7 @@ static void test_arcto(void)
CloseFigure(hdc);
EndPath(hdc);
- ok_path(hdc, "arcto_path", arcto_path, sizeof(arcto_path)/sizeof(path_test_t));
+ ok_path(hdc, "arcto_path", arcto_path, ARRAY_SIZE(arcto_path));
done:
ReleaseDC(0, hdc);
}
@@ -540,7 +540,7 @@ static void test_anglearc(void)
CloseFigure(hdc);
EndPath(hdc);
- ok_path(hdc, "anglearc_path", anglearc_path, sizeof(anglearc_path)/sizeof(path_test_t));
+ ok_path(hdc, "anglearc_path", anglearc_path, ARRAY_SIZE(anglearc_path));
done:
ReleaseDC(0, hdc);
}
@@ -681,7 +681,7 @@ static void test_polydraw(void)
ok( pos.x == 80 && pos.y == 80, "wrong pos %d,%d\n", pos.x, pos.y );
EndPath(hdc);
- ok_path(hdc, "polydraw_path", polydraw_path, sizeof(polydraw_path)/sizeof(path_test_t));
+ ok_path(hdc, "polydraw_path", polydraw_path, ARRAY_SIZE(polydraw_path));
GetCurrentPositionEx( hdc, &pos );
ok( pos.x == 80 && pos.y == 80, "wrong pos %d,%d\n", pos.x, pos.y );
done:
@@ -966,7 +966,7 @@ static void test_rectangle(void)
SetArcDirection( hdc, AD_COUNTERCLOCKWISE );
EndPath( hdc );
SetMapMode( hdc, MM_TEXT );
- ok_path( hdc, "rectangle_path", rectangle_path, sizeof(rectangle_path)/sizeof(path_test_t) );
+ ok_path( hdc, "rectangle_path", rectangle_path, ARRAY_SIZE(rectangle_path) );
ReleaseDC( 0, hdc );
}
@@ -1327,7 +1327,7 @@ static void test_roundrect(void)
SetArcDirection( hdc, AD_COUNTERCLOCKWISE );
EndPath( hdc );
SetMapMode( hdc, MM_TEXT );
- ok_path( hdc, "roundrect_path", roundrect_path, sizeof(roundrect_path)/sizeof(path_test_t) );
+ ok_path( hdc, "roundrect_path", roundrect_path, ARRAY_SIZE(roundrect_path) );
ReleaseDC( 0, hdc );
}
@@ -1707,7 +1707,7 @@ static void test_ellipse(void)
SetArcDirection( hdc, AD_COUNTERCLOCKWISE );
EndPath( hdc );
SetMapMode( hdc, MM_TEXT );
- ok_path( hdc, "ellipse_path", ellipse_path, sizeof(ellipse_path)/sizeof(path_test_t) );
+ ok_path( hdc, "ellipse_path", ellipse_path, ARRAY_SIZE(ellipse_path) );
}
static const path_test_t all_funcs_path[] =
@@ -1890,7 +1890,7 @@ static void test_all_functions(void)
LineTo( hdc, 150, 150 );
/* FIXME: ExtTextOut */
EndPath( hdc );
- ok_path( hdc, "all_funcs_path", all_funcs_path, sizeof(all_funcs_path)/sizeof(path_test_t) );
+ ok_path( hdc, "all_funcs_path", all_funcs_path, ARRAY_SIZE(all_funcs_path) );
ReleaseDC( 0, hdc );
}
diff --git a/dlls/gdi32/tests/pen.c b/dlls/gdi32/tests/pen.c
index 43f00d8f50..badc585f57 100644
--- a/dlls/gdi32/tests/pen.c
+++ b/dlls/gdi32/tests/pen.c
@@ -72,7 +72,7 @@ static void test_logpen(void)
EXTLOGPEN *ext_pen = (EXTLOGPEN *)elp_buffer;
DWORD *ext_style = ext_pen->elpStyleEntry;
- for (i = 0; i < sizeof(pen)/sizeof(pen[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(pen); i++)
{
trace("%d: testing style %u\n", i, pen[i].style);
--
2.14.4
June 25, 2018
Re: [PATCH] hnetcfg: Store the full path in INetFwAuthorizedApplication_put_ProcessImageFileName().
by Zebediah Figura
On 25/06/18 08:20, Nikolay Sivov wrote:
> On 06/25/2018 06:46 AM, Zebediah Figura wrote:
>
>> Should hopefully fix test failures on Windows.
>>
>> Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
>> ---
>> dlls/hnetcfg/apps.c | 17 ++++++++++++-----
>> dlls/hnetcfg/tests/policy.c | 5 ++++-
>> 2 files changed, 16 insertions(+), 6 deletions(-)
>>
>> diff --git a/dlls/hnetcfg/apps.c b/dlls/hnetcfg/apps.c
>> index 34ef108..fe47721 100644
>> --- a/dlls/hnetcfg/apps.c
>> +++ b/dlls/hnetcfg/apps.c
>> @@ -268,7 +268,7 @@ static HRESULT WINAPI
>> fw_app_put_ProcessImageFileName(
>> {
>> fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
>> UNIVERSAL_NAME_INFOW *info;
>> - WCHAR *netpath;
>> + WCHAR *path;
>> DWORD res;
>> DWORD sz;
>> @@ -281,22 +281,29 @@ static HRESULT WINAPI
>> fw_app_put_ProcessImageFileName(
>> res = WNetGetUniversalNameW(image, UNIVERSAL_NAME_INFO_LEVEL,
>> NULL, &sz);
>> if (res == WN_MORE_DATA)
>> {
>> - if (!(netpath = heap_alloc(sz)))
>> + if (!(path = heap_alloc(sz)))
>> return E_OUTOFMEMORY;
>> - info = (UNIVERSAL_NAME_INFOW *)&netpath;
>> + info = (UNIVERSAL_NAME_INFOW *)&path;
>> res = WNetGetUniversalNameW(image,
>> UNIVERSAL_NAME_INFO_LEVEL, &info, &sz);
>> if (res == NO_ERROR)
>> {
>> SysFreeString(This->filename);
>> This->filename = SysAllocString(info->lpUniversalName);
>> }
>> - heap_free(netpath);
>> + heap_free(path);
>> return HRESULT_FROM_WIN32(res);
>> }
>> + sz = GetFullPathNameW(image, 0, NULL, NULL);
>> + if (!(path = heap_alloc(++sz)))
>> + return E_OUTOFMEMORY;
>> +
>> + GetFullPathNameW(image, sz, path, NULL);
>
> ...
>
>>
>> + GetFullPathNameW(image, sizeof(fullpath), fullpath, NULL);
> ...
>
> This one takes character length I think, not byte length.
>
>
Thanks for the catch; resent.
June 25, 2018
[PATCH v2] hnetcfg: Store the full path in INetFwAuthorizedApplication_put_ProcessImageFileName().
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/hnetcfg/apps.c | 17 ++++++++++++-----
dlls/hnetcfg/tests/policy.c | 5 ++++-
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/dlls/hnetcfg/apps.c b/dlls/hnetcfg/apps.c
index 34ef108..fe47721 100644
--- a/dlls/hnetcfg/apps.c
+++ b/dlls/hnetcfg/apps.c
@@ -268,7 +268,7 @@ static HRESULT WINAPI fw_app_put_ProcessImageFileName(
{
fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
UNIVERSAL_NAME_INFOW *info;
- WCHAR *netpath;
+ WCHAR *path;
DWORD res;
DWORD sz;
@@ -281,22 +281,29 @@ static HRESULT WINAPI fw_app_put_ProcessImageFileName(
res = WNetGetUniversalNameW(image, UNIVERSAL_NAME_INFO_LEVEL, NULL, &sz);
if (res == WN_MORE_DATA)
{
- if (!(netpath = heap_alloc(sz)))
+ if (!(path = heap_alloc(sz)))
return E_OUTOFMEMORY;
- info = (UNIVERSAL_NAME_INFOW *)&netpath;
+ info = (UNIVERSAL_NAME_INFOW *)&path;
res = WNetGetUniversalNameW(image, UNIVERSAL_NAME_INFO_LEVEL, &info, &sz);
if (res == NO_ERROR)
{
SysFreeString(This->filename);
This->filename = SysAllocString(info->lpUniversalName);
}
- heap_free(netpath);
+ heap_free(path);
return HRESULT_FROM_WIN32(res);
}
+ sz = GetFullPathNameW(image, 0, NULL, NULL);
+ if (!(path = heap_alloc(++sz)))
+ return E_OUTOFMEMORY;
+
+ GetFullPathNameW(image, sz, path, NULL);
+
SysFreeString( This->filename );
- This->filename = SysAllocString(image);
+ This->filename = SysAllocString(path);
+ heap_free(path);
return This->filename ? S_OK : E_OUTOFMEMORY;
}
diff --git a/dlls/hnetcfg/tests/policy.c b/dlls/hnetcfg/tests/policy.c
index f2d1372..954af5c 100644
--- a/dlls/hnetcfg/tests/policy.c
+++ b/dlls/hnetcfg/tests/policy.c
@@ -107,6 +107,7 @@ static void test_NetFwAuthorizedApplication(void)
INetFwAuthorizedApplication *app;
static WCHAR empty[] = {0};
UNIVERSAL_NAME_INFOW *info;
+ WCHAR fullpath[MAX_PATH];
WCHAR netpath[MAX_PATH];
WCHAR image[MAX_PATH];
HRESULT hr;
@@ -138,13 +139,15 @@ static void test_NetFwAuthorizedApplication(void)
ok(hr == S_OK, "got: %08x\n", hr);
SysFreeString(bstr);
+ GetFullPathNameW(image, ARRAY_SIZE(fullpath), fullpath, NULL);
+
info = (UNIVERSAL_NAME_INFOW *)&netpath;
sz = sizeof(netpath);
hr = WNetGetUniversalNameW(image, UNIVERSAL_NAME_INFO_LEVEL, &info, &sz);
if (hr != NO_ERROR)
{
info->lpUniversalName = netpath + sizeof(*info)/sizeof(WCHAR);
- lstrcpyW(info->lpUniversalName, image);
+ lstrcpyW(info->lpUniversalName, fullpath);
}
hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, &bstr);
--
2.7.4
June 25, 2018
[PATCH] hnetcfg: GetModuleFileNameW gets characters, not bytes (Coverity)
by Marcus Meissner
CID 1437516
Signed-off-by: Marcus Meissner <meissner(a)suse.de>
---
dlls/hnetcfg/tests/policy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/hnetcfg/tests/policy.c b/dlls/hnetcfg/tests/policy.c
index f2d1372ba6..b28535d448 100644
--- a/dlls/hnetcfg/tests/policy.c
+++ b/dlls/hnetcfg/tests/policy.c
@@ -117,7 +117,7 @@ static void test_NetFwAuthorizedApplication(void)
&IID_INetFwAuthorizedApplication, (void**)&app);
ok(hr == S_OK, "got: %08x\n", hr);
- hr = GetModuleFileNameW(NULL, image, sizeof(image));
+ hr = GetModuleFileNameW(NULL, image, ARRAY_SIZE(image));
ok(hr, "GetModuleFileName failed: %u\n", GetLastError());
hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, NULL);
--
2.17.1
June 25, 2018
[PATCH v3] comctl32/imagelist: fix ImageList_Read
by Denis Malikov
Fix for versions x600 and x620 and pointer calculation for mixing image and mask bits.
Tested on *.reg files extracted from:
- XP/2003 key HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\TrayNotify;
- Vista/7 key HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify
Signed-off-by: Denis Malikov <mdn40000(a)mail.ru>
---
dlls/comctl32/imagelist.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index a08d60752e..be901462a0 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -2267,7 +2267,9 @@ HIMAGELIST WINAPI ImageList_Read(IStream *pstm)
return NULL;
if (ilHead.usMagic != (('L' << 8) | 'I'))
return NULL;
- if (ilHead.usVersion != 0x101) /* probably version? */
+ if (ilHead.usVersion != 0x101 &&
+ ilHead.usVersion != 0x600 && /* XP/2003 version */
+ ilHead.usVersion != 0x620) /* Vista/7 version */
return NULL;
TRACE("cx %u, cy %u, flags 0x%04x, cCurImage %u, cMaxImage %u\n",
@@ -2296,23 +2298,25 @@ HIMAGELIST WINAPI ImageList_Read(IStream *pstm)
{
DWORD *ptr = image_bits;
BYTE *mask_ptr = mask_bits;
- int stride = himl->cy * image_info->bmiHeader.biWidth;
+ int stride = himl->cy * (ilHead.usVersion != 0x101 ? himl->cx : image_info->bmiHeader.biWidth);
+ int image_step = ilHead.usVersion != 0x101 ? 1 : TILE_COUNT;
+ int mask_step = ilHead.usVersion != 0x101 ? 4 : 8;
if (image_info->bmiHeader.biHeight > 0) /* bottom-up */
{
ptr += image_info->bmiHeader.biHeight * image_info->bmiHeader.biWidth - stride;
- mask_ptr += (image_info->bmiHeader.biHeight * image_info->bmiHeader.biWidth - stride) / 8;
+ mask_ptr += (image_info->bmiHeader.biHeight * image_info->bmiHeader.biWidth - stride) / mask_step;
stride = -stride;
image_info->bmiHeader.biHeight = himl->cy;
}
else image_info->bmiHeader.biHeight = -himl->cy;
- for (i = 0; i < ilHead.cCurImage; i += TILE_COUNT)
+ for (i = 0; i < ilHead.cCurImage; i += image_step)
{
- add_dib_bits( himl, i, min( ilHead.cCurImage - i, TILE_COUNT ),
+ add_dib_bits( himl, i, min( ilHead.cCurImage - i, image_step ),
himl->cx, himl->cy, image_info, mask_info, ptr, mask_ptr );
ptr += stride;
- mask_ptr += stride / 8;
+ mask_ptr += stride / mask_step;
}
}
else
--
2.16.2.windows.1
June 25, 2018