Rebase against ba9f3dc198dfc81bb40159077b73b797006bb73c

This commit is contained in:
Alistair Leslie-Hughes 2018-08-15 08:07:39 +10:00
parent 39cafb1db1
commit e7bff1bb4f
102 changed files with 208 additions and 10382 deletions

View File

@ -1,2 +1 @@
Depends: ml-array_size
Depends: ml-patches

View File

@ -1,7 +1,7 @@
From 31a5f689a12c1db6edcc86dcd8e81f38a5f19fc5 Mon Sep 17 00:00:00 2001
From baff5c160cf7f1ac0011bf8f55d506bf0346e1fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 7 Aug 2017 02:53:06 +0200
Subject: user32: Start explorer.exe using limited rights.
Subject: [PATCH] user32: Start explorer.exe using limited rights.
---
dlls/advapi32/tests/security.c | 4 ++--
@ -9,10 +9,10 @@ Subject: user32: Start explorer.exe using limited rights.
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index f1a64e29dea..52524ee6fe2 100644
index f27642e7a7..0271cd72e0 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -7387,7 +7387,7 @@ static void test_token_security_descriptor(void)
@@ -7313,7 +7313,7 @@ static void test_token_security_descriptor(void)
ret = GetTokenInformation(token4, TokenIntegrityLevel, buffer_integrity, sizeof(buffer_integrity), &size);
ok(ret, "GetTokenInformation failed with error %u\n", GetLastError());
tml = (TOKEN_MANDATORY_LABEL *)buffer_integrity;
@ -21,7 +21,7 @@ index f1a64e29dea..52524ee6fe2 100644
size = 0;
ret = GetKernelObjectSecurity(token4, LABEL_SECURITY_INFORMATION, NULL, 0, &size);
@@ -7841,7 +7841,7 @@ static void test_child_token_sd_medium(void)
@@ -7768,7 +7768,7 @@ static void test_child_token_sd_medium(void)
ret = GetTokenInformation(token, TokenIntegrityLevel, buffer_integrity, sizeof(buffer_integrity), &size);
ok(ret, "GetTokenInformation failed with error %u\n", GetLastError());
tml = (TOKEN_MANDATORY_LABEL *)buffer_integrity;
@ -31,7 +31,7 @@ index f1a64e29dea..52524ee6fe2 100644
HeapFree(GetProcessHeap(), 0, sd);
}
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index cbf22374374..ea116b9d139 100644
index cbfd8bb14a..8039f54fb0 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -43,6 +43,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(win);
@ -43,15 +43,15 @@ index cbf22374374..ea116b9d139 100644
static DWORD process_layout = ~0u;
static struct list window_surfaces = LIST_INIT( window_surfaces );
@@ -2067,6 +2069,7 @@ HWND WINAPI GetDesktopWindow(void)
WCHAR app[MAX_PATH + sizeof(explorer)/sizeof(WCHAR)];
WCHAR cmdline[MAX_PATH + (sizeof(explorer) + sizeof(args))/sizeof(WCHAR)];
@@ -2052,6 +2054,7 @@ HWND WINAPI GetDesktopWindow(void)
WCHAR app[MAX_PATH + ARRAY_SIZE( explorer )];
WCHAR cmdline[MAX_PATH + ARRAY_SIZE( explorer ) + ARRAY_SIZE( args )];
WCHAR desktop[MAX_PATH];
+ HANDLE token;
void *redir;
SERVER_START_REQ( set_user_object_info )
@@ -2099,9 +2102,12 @@ HWND WINAPI GetDesktopWindow(void)
@@ -2084,9 +2087,12 @@ HWND WINAPI GetDesktopWindow(void)
strcpyW( cmdline, app );
strcatW( cmdline, args );
@ -66,7 +66,7 @@ index cbf22374374..ea116b9d139 100644
{
TRACE( "started explorer pid %04x tid %04x\n", pi.dwProcessId, pi.dwThreadId );
WaitForInputIdle( pi.hProcess, 10000 );
@@ -2111,6 +2117,8 @@ HWND WINAPI GetDesktopWindow(void)
@@ -2096,6 +2102,8 @@ HWND WINAPI GetDesktopWindow(void)
else WARN( "failed to start explorer, err %d\n", GetLastError() );
Wow64RevertWow64FsRedirection( redir );
@ -76,5 +76,5 @@ index cbf22374374..ea116b9d139 100644
{
req->force = 1;
--
2.13.1
2.18.0

View File

@ -1,20 +1,20 @@
From 71366dad7ac934b2e24cfcf19104b4589b91652a Mon Sep 17 00:00:00 2001
From b14282d138ff6a5ad1d5c152d0a556c9ca648c36 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 7 Aug 2017 03:33:26 +0200
Subject: server: Correctly assign security labels for tokens.
Subject: [PATCH] server: Correctly assign security labels for tokens.
---
dlls/advapi32/tests/security.c | 21 ++++++++++-----------
server/process.c | 8 +-------
dlls/advapi32/tests/security.c | 21 +++++++++--------
server/process.c | 8 +------
server/security.h | 2 +-
server/token.c | 41 ++++++++++++++++++++++++-----------------
server/token.c | 41 ++++++++++++++++++++--------------
4 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index 52524ee6fe2..a35baab0e25 100644
index 0271cd72e0..3b07e7cd2f 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -7289,7 +7289,6 @@ static void test_token_security_descriptor(void)
@@ -7215,7 +7215,6 @@ static void test_token_security_descriptor(void)
defaulted = TRUE;
ret = GetSecurityDescriptorDacl(sd2, &present, &acl2, &defaulted);
ok(ret, "GetSecurityDescriptorDacl failed with error %u\n", GetLastError());
@ -22,7 +22,7 @@ index 52524ee6fe2..a35baab0e25 100644
ok(present, "DACL not present\n");
if (present)
@@ -7410,7 +7409,7 @@ static void test_token_security_descriptor(void)
@@ -7336,7 +7335,7 @@ static void test_token_security_descriptor(void)
ok(ret, "GetAce failed with error %u\n", GetLastError());
ok(ace->Header.AceType == SYSTEM_MANDATORY_LABEL_ACE_TYPE,
"Unexpected ACE type %#x\n", ace->Header.AceType);
@ -31,7 +31,7 @@ index 52524ee6fe2..a35baab0e25 100644
"Expected medium integrity level\n");
}
@@ -7463,8 +7462,8 @@ static void test_token_security_descriptor(void)
@@ -7389,8 +7388,8 @@ static void test_token_security_descriptor(void)
sacl = NULL;
ret = GetSecurityDescriptorSacl(sd3, &present, &sacl, &defaulted);
ok(ret, "GetSecurityDescriptorSacl failed with error %u\n", GetLastError());
@ -42,7 +42,7 @@ index 52524ee6fe2..a35baab0e25 100644
if (sacl)
{
@@ -7513,8 +7512,8 @@ static void test_token_security_descriptor(void)
@@ -7439,8 +7438,8 @@ static void test_token_security_descriptor(void)
sacl = NULL;
ret = GetSecurityDescriptorSacl(sd3, &present, &sacl, &defaulted);
ok(ret, "GetSecurityDescriptorSacl failed with error %u\n", GetLastError());
@ -53,7 +53,7 @@ index 52524ee6fe2..a35baab0e25 100644
if (sacl)
{
@@ -7578,8 +7577,8 @@ static void test_token_security_descriptor(void)
@@ -7504,8 +7503,8 @@ static void test_token_security_descriptor(void)
ret = GetSecurityDescriptorSacl(sd3, &present, &sacl, &defaulted);
ok(ret, "GetSecurityDescriptorSacl failed with error %u\n", GetLastError());
@ -64,7 +64,7 @@ index 52524ee6fe2..a35baab0e25 100644
if (sacl)
{
@@ -7616,8 +7615,8 @@ static void test_token_security_descriptor(void)
@@ -7542,8 +7541,8 @@ static void test_token_security_descriptor(void)
sacl = NULL;
ret = GetSecurityDescriptorSacl(sd3, &present, &sacl, &defaulted);
ok(ret, "GetSecurityDescriptorSacl failed with error %u\n", GetLastError());
@ -75,7 +75,7 @@ index 52524ee6fe2..a35baab0e25 100644
if (sacl)
{
@@ -7834,7 +7833,7 @@ static void test_child_token_sd_medium(void)
@@ -7761,7 +7760,7 @@ static void test_child_token_sd_medium(void)
ok(ret, "GetAce failed with error %u\n", GetLastError());
ok(ace_label->Header.AceType == SYSTEM_MANDATORY_LABEL_ACE_TYPE,
"Unexpected ACE type %#x\n", ace_label->Header.AceType);
@ -85,10 +85,10 @@ index 52524ee6fe2..a35baab0e25 100644
memset(buffer_integrity, 0, sizeof(buffer_integrity));
diff --git a/server/process.c b/server/process.c
index ef2452fb8fb..ae998ab80b9 100644
index 7d2206f274..74cc320f44 100644
--- a/server/process.c
+++ b/server/process.c
@@ -571,17 +571,11 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit
@@ -567,17 +567,11 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit
: alloc_handle_table( process, 0 );
/* Note: for security reasons, starting a new process does not attempt
* to use the current impersonation token for the new process */
@ -108,7 +108,7 @@ index ef2452fb8fb..ae998ab80b9 100644
if (pipe( request_pipe ) == -1)
{
diff --git a/server/security.h b/server/security.h
index 32dfe5f8db9..87377ccd673 100644
index 32dfe5f8db..87377ccd67 100644
--- a/server/security.h
+++ b/server/security.h
@@ -59,7 +59,7 @@ extern int token_assign_label( struct token *token, PSID label );
@ -121,10 +121,10 @@ index 32dfe5f8db9..87377ccd673 100644
const LUID_AND_ATTRIBUTES *reqprivs,
unsigned int count, LUID_AND_ATTRIBUTES *usedprivs);
diff --git a/server/token.c b/server/token.c
index c507294b49d..c6b0f0d39d3 100644
index 28042471b0..e5639fc0d5 100644
--- a/server/token.c
+++ b/server/token.c
@@ -686,7 +686,7 @@ static int filter_privilege( struct privilege *privilege, const LUID_AND_ATTRIBU
@@ -668,7 +668,7 @@ static int filter_privilege( struct privilege *privilege, const LUID_AND_ATTRIBU
struct token *token_duplicate( struct token *src_token, unsigned primary,
int impersonation_level, const struct security_descriptor *sd,
const LUID_AND_ATTRIBUTES *filter_privileges, unsigned int priv_count,
@ -133,7 +133,7 @@ index c507294b49d..c6b0f0d39d3 100644
{
const luid_t *modified_id =
primary || (impersonation_level == src_token->impersonation_level) ?
@@ -750,6 +750,12 @@ struct token *token_duplicate( struct token *src_token, unsigned primary,
@@ -735,6 +735,12 @@ struct token *token_duplicate( struct token *src_token, unsigned primary,
if (sd) default_set_sd( &token->obj, sd, OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION |
DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION );
@ -146,7 +146,7 @@ index c507294b49d..c6b0f0d39d3 100644
return token;
}
@@ -922,6 +928,12 @@ struct token *token_create_admin( void )
@@ -907,6 +913,12 @@ struct token *token_create_admin( void )
admin_source, NULL, -1, TokenElevationTypeFull, &high_label_sid );
/* we really need a primary group */
assert( token->primary_group );
@ -159,7 +159,7 @@ index c507294b49d..c6b0f0d39d3 100644
}
free( logon_sid );
@@ -980,6 +992,12 @@ static struct token *token_create_limited( void )
@@ -965,6 +977,12 @@ static struct token *token_create_limited( void )
admin_source, NULL, -1, TokenElevationTypeLimited, &medium_label_sid );
/* we really need a primary group */
assert( token->primary_group );
@ -172,7 +172,7 @@ index c507294b49d..c6b0f0d39d3 100644
}
free( logon_sid );
@@ -1448,7 +1466,8 @@ DECL_HANDLER(duplicate_token)
@@ -1433,7 +1451,8 @@ DECL_HANDLER(duplicate_token)
TOKEN_DUPLICATE,
&token_ops )))
{
@ -182,7 +182,7 @@ index c507294b49d..c6b0f0d39d3 100644
if (token)
{
unsigned int access = req->access ? req->access : get_handle_access( current->process, req->handle );
@@ -1478,7 +1497,7 @@ DECL_HANDLER(filter_token)
@@ -1463,7 +1482,7 @@ DECL_HANDLER(filter_token)
group_count = get_sid_count( filter_groups, get_req_data_size() - priv_count * sizeof(LUID_AND_ATTRIBUTES) );
token = token_duplicate( src_token, src_token->primary, src_token->impersonation_level, NULL,
@ -191,7 +191,7 @@ index c507294b49d..c6b0f0d39d3 100644
if (token)
{
unsigned int access = get_handle_access( current->process, req->handle );
@@ -1813,23 +1832,11 @@ DECL_HANDLER(set_token_default_dacl)
@@ -1789,23 +1808,11 @@ DECL_HANDLER(set_token_default_dacl)
DECL_HANDLER(create_token)
{
struct token *token;
@ -218,5 +218,5 @@ index c507294b49d..c6b0f0d39d3 100644
}
}
--
2.13.1
2.18.0

View File

@ -1,26 +0,0 @@
From 34607775675c9475973fd249b8a68a59935b0391 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Thu, 30 Jul 2015 11:57:28 +1000
Subject: d3dx9_36: Return a mesh in D3DXCreateTeapot
Fixes https://bugs.winehq.org/show_bug.cgi?id=36884
---
dlls/d3dx9_36/mesh.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/d3dx9_36/mesh.c b/dlls/d3dx9_36/mesh.c
index 39d279d..59e385e4 100644
--- a/dlls/d3dx9_36/mesh.c
+++ b/dlls/d3dx9_36/mesh.c
@@ -5153,7 +5153,7 @@ HRESULT WINAPI D3DXCreateTeapot(struct IDirect3DDevice9 *device,
{
FIXME("(%p, %p, %p): stub\n", device, mesh, adjacency);
- return E_NOTIMPL;
+ return D3DXCreateSphere(device, 1.0f, 4, 4, mesh, adjacency);
}
HRESULT WINAPI D3DXCreateTextA(struct IDirect3DDevice9 *device, HDC hdc, const char *text, float deviation,
--
2.5.0

View File

@ -1 +0,0 @@
Fixes: [36884] Return a valid mesh in D3DXCreateTeapot

View File

@ -1,4 +1,4 @@
From 07d42b7a75491947866e6edb9d7746ca35274238 Mon Sep 17 00:00:00 2001
From 25c2a52b1109022a01b8f59a22b8a04566af0d3c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Fri, 4 Mar 2016 22:22:42 +0100
Subject: [PATCH] ddraw: Set ddsOldCaps correctly in ddraw7_GetCaps.
@ -12,7 +12,7 @@ Subject: [PATCH] ddraw: Set ddsOldCaps correctly in ddraw7_GetCaps.
5 files changed, 106 insertions(+)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index ed90478..47f079f 100644
index ed904785dd..47f079fb97 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -1542,6 +1542,8 @@ static HRESULT WINAPI ddraw7_GetCaps(IDirectDraw7 *iface, DDCAPS *DriverCaps, DD
@ -25,10 +25,10 @@ index ed90478..47f079f 100644
if(DriverCaps)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index c767d3a..70d4b8f 100644
index d4fe1f294a..29d9d3afb7 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -11411,6 +11411,31 @@ static void test_execute_data(void)
@@ -11538,6 +11538,31 @@ static void test_execute_data(void)
DestroyWindow(window);
}
@ -60,7 +60,7 @@ index c767d3a..70d4b8f 100644
static void test_viewport(void)
{
static struct
@@ -11686,6 +11711,7 @@ START_TEST(ddraw1)
@@ -11815,6 +11840,7 @@ START_TEST(ddraw1)
test_depth_readback();
test_clear();
test_enum_surfaces();
@ -69,10 +69,10 @@ index c767d3a..70d4b8f 100644
test_viewport();
}
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 794f90b..9c6055e 100644
index 941d46bf42..752b39568d 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -12673,6 +12673,31 @@ static void test_enum_surfaces(void)
@@ -12800,6 +12800,31 @@ static void test_enum_surfaces(void)
IDirectDraw2_Release(ddraw);
}
@ -104,7 +104,7 @@ index 794f90b..9c6055e 100644
static void test_viewport(void)
{
static struct
@@ -12977,5 +13002,6 @@ START_TEST(ddraw2)
@@ -13106,5 +13131,6 @@ START_TEST(ddraw2)
test_depth_readback();
test_clear();
test_enum_surfaces();
@ -112,10 +112,10 @@ index 794f90b..9c6055e 100644
test_viewport();
}
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 172d99d..c036a6d 100644
index e81472d4f2..4e083ec503 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -14953,6 +14953,31 @@ static void test_viewport(void)
@@ -15089,6 +15089,31 @@ static void test_viewport(void)
DestroyWindow(window);
}
@ -147,17 +147,17 @@ index 172d99d..c036a6d 100644
START_TEST(ddraw4)
{
DDDEVICEIDENTIFIER identifier;
@@ -15078,4 +15103,5 @@ START_TEST(ddraw4)
@@ -15215,4 +15240,5 @@ START_TEST(ddraw4)
test_clear();
test_enum_surfaces();
test_viewport();
+ test_caps();
}
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 7cbf408..095212b 100644
index 70318a8492..f3dde436d3 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -14417,6 +14417,31 @@ static void test_color_vertex(void)
@@ -15035,6 +15035,31 @@ static void test_color_vertex(void)
DestroyWindow(window);
}
@ -189,13 +189,13 @@ index 7cbf408..095212b 100644
START_TEST(ddraw7)
{
DDDEVICEIDENTIFIER2 identifier;
@@ -14552,5 +14577,6 @@ START_TEST(ddraw7)
test_clear();
@@ -15172,5 +15197,6 @@ START_TEST(ddraw7)
test_enum_surfaces();
test_viewport();
test_device_load();
+ test_caps();
test_color_vertex();
}
--
1.9.1
2.18.0

View File

@ -1,26 +0,0 @@
From 1b821d7a8398741a164800039535aaad396c299e Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov@codeweavers.com>
Date: Tue, 31 Jul 2018 08:35:01 +0300
Subject: [PATCH] dwrite: Avoid possible out-of-bounds cluster metrics access.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
---
dlls/dwrite/layout.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c
index 306c1178d4..903e7e8978 100644
--- a/dlls/dwrite/layout.c
+++ b/dlls/dwrite/layout.c
@@ -2089,7 +2089,7 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout)
*/
if (layout->len == 0)
hr = layout_set_dummy_line_metrics(layout, 0);
- else if (layout->clustermetrics[layout->cluster_count - 1].isNewline)
+ else if (layout->cluster_count && layout->clustermetrics[layout->cluster_count - 1].isNewline)
hr = layout_set_dummy_line_metrics(layout, layout->len - 1);
if (FAILED(hr))
return hr;
--
2.18.0

View File

@ -1,2 +0,0 @@
Fixes: [45535] - dwrite Correct out of access

View File

@ -1,4 +1,4 @@
From 6cd8711153dfad60cf2816d2f9f07189bd37719b Mon Sep 17 00:00:00 2001
From de4b7a3055065faed4cdc9ca253248eed5a3a7bb Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Tue, 15 Nov 2016 13:02:13 +0800
Subject: [PATCH] kernel32: MoveFile(source, source) should succeed.
@ -11,7 +11,7 @@ Subject: [PATCH] kernel32: MoveFile(source, source) should succeed.
4 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index 232ea7e..ba75b7e 100644
index bde58e9dc4..c7c5cbd3f7 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -1354,7 +1354,7 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
@ -21,10 +21,10 @@ index 232ea7e..ba75b7e 100644
- HANDLE source_handle = 0, dest_handle;
+ HANDLE source_handle = 0, dest_handle = 0;
ANSI_STRING source_unix, dest_unix;
DWORD options;
TRACE("(%s,%s,%p,%p,%04x)\n",
@@ -1413,18 +1413,22 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
@@ -1414,18 +1414,22 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
status = NtOpenFile( &dest_handle, GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, &attr, &io, 0, options );
if (status == STATUS_SUCCESS) /* destination exists */
{
- NtClose( dest_handle );
@ -50,7 +50,7 @@ index 232ea7e..ba75b7e 100644
}
else if (status != STATUS_OBJECT_NAME_NOT_FOUND)
{
@@ -1484,6 +1488,7 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
@@ -1485,6 +1489,7 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
error:
if (source_handle) NtClose( source_handle );
@ -59,7 +59,7 @@ index 232ea7e..ba75b7e 100644
RtlFreeAnsiString( &dest_unix );
return FALSE;
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index e201f62..e152cf1 100644
index ef4eebc31c..07b3ffb77b 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -1886,7 +1886,7 @@ static void test_MoveFileA(void)
@ -72,10 +72,10 @@ index e201f62..e152cf1 100644
ret = MoveFileA(source, dest);
ok(!ret && GetLastError() == ERROR_ALREADY_EXISTS,
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
index 969902d..d6051b0 100644
index d7b82a3aae..5141622d6a 100644
--- a/dlls/msvcp120/tests/msvcp120.c
+++ b/dlls/msvcp120/tests/msvcp120.c
@@ -1402,7 +1402,7 @@ static void test_tr2_sys__Rename(void)
@@ -1524,7 +1524,7 @@ static void test_tr2_sys__Rename(void)
CloseHandle(file);
ret = p_tr2_sys__Rename("tr2_test_dir\\f1", "tr2_test_dir\\f1");
@ -85,10 +85,10 @@ index 969902d..d6051b0 100644
errno = 0xdeadbeef;
if(tests[i].val == ERROR_SUCCESS) {
diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp
index dcc9629..e16f9f3 100644
index ea4157c09d..298c4e9a9e 100644
--- a/programs/cmd/tests/test_builtins.cmd.exp
+++ b/programs/cmd/tests/test_builtins.cmd.exp
@@ -1261,8 +1261,8 @@ file move succeeded
@@ -1295,8 +1295,8 @@ file move succeeded
@todo_wine@bar@or_broken@baz
read-only files are moveable
file moved in subdirectory
@ -100,5 +100,5 @@ index dcc9629..e16f9f3 100644
simple directory move succeeded
moving a directory to itself gives error; errlevel 1
--
1.9.1
2.18.0

View File

@ -1,19 +1,19 @@
From 96e7b57c5591087cfd07b0658ac33a1ec6bde3b5 Mon Sep 17 00:00:00 2001
From 8031fda3ffc4d2469524f21198ef0aaf9725562e Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Tue, 15 Nov 2016 13:32:42 +0800
Subject: kernel32: MoveFile should make sure that it has the delete access to
the source file.
Subject: [PATCH] kernel32: MoveFile should make sure that it has the delete
access to the source file.
---
dlls/kernel32/path.c | 6 ++++--
dlls/kernel32/path.c | 4 ++--
dlls/kernel32/tests/file.c | 20 ++++++++------------
2 files changed, 12 insertions(+), 14 deletions(-)
2 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index f554d14..d7fc20e 100644
index c7c5cbd3f7..5388586094 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -1338,7 +1338,8 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
@@ -1383,7 +1383,8 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
@ -23,21 +23,19 @@ index f554d14..d7fc20e 100644
if (status == STATUS_SUCCESS)
status = wine_nt_to_unix_file_name( &nt_name, &source_unix, FILE_OPEN, FALSE );
RtlFreeUnicodeString( &nt_name );
@@ -1362,7 +1363,8 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
@@ -1407,7 +1408,6 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
SetLastError( ERROR_PATH_NOT_FOUND );
goto error;
}
- status = NtOpenFile( &dest_handle, GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, &attr, &io, 0,
+ status = NtOpenFile( &dest_handle, GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, &attr, &io,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
if (status == STATUS_SUCCESS) /* destination exists */
{
-
options = FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT;
if (flag & MOVEFILE_WRITE_THROUGH)
options |= FILE_WRITE_THROUGH;
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index f0f9232..6fcf019 100644
index 07b3ffb77b..4729e75728 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -1905,12 +1905,10 @@ static void test_MoveFileA(void)
@@ -1906,12 +1906,10 @@ static void test_MoveFileA(void)
ok(hmapfile != NULL, "CreateFileMapping: error %d\n", GetLastError());
ret = MoveFileA(source, dest);
@ -54,7 +52,7 @@ index f0f9232..6fcf019 100644
CloseHandle(hmapfile);
CloseHandle(hfile);
@@ -1925,12 +1923,10 @@ static void test_MoveFileA(void)
@@ -1926,12 +1924,10 @@ static void test_MoveFileA(void)
ok(hmapfile != NULL, "CreateFileMapping: error %d\n", GetLastError());
ret = MoveFileA(source, dest);
@ -72,5 +70,5 @@ index f0f9232..6fcf019 100644
CloseHandle(hmapfile);
CloseHandle(hfile);
--
2.9.0
2.18.0

View File

@ -1,141 +0,0 @@
From 4944b0ed67011898a68fb244bdd947a15ef1c8ab Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Wed, 18 Jul 2018 18:37:52 +0200
Subject: [PATCH] windowscodecs: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/windowscodecs/bitmap.c | 2 +-
dlls/windowscodecs/bmpencode.c | 2 +-
dlls/windowscodecs/jpegformat.c | 2 +-
dlls/windowscodecs/metadataquery.c | 10 +++++-----
dlls/windowscodecs/pngformat.c | 4 ++--
dlls/windowscodecs/tiffformat.c | 2 +-
6 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/dlls/windowscodecs/bitmap.c b/dlls/windowscodecs/bitmap.c
index f8414962f2..116fd3134a 100644
--- a/dlls/windowscodecs/bitmap.c
+++ b/dlls/windowscodecs/bitmap.c
@@ -555,7 +555,7 @@ static HRESULT WINAPI IMILBitmapImpl_GetPixelFormat(IMILBitmapSource *iface,
*format = 0;
- for (i = 0; i < sizeof(pixel_fmt_map)/sizeof(pixel_fmt_map[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(pixel_fmt_map); i++)
{
if (IsEqualGUID(pixel_fmt_map[i].WIC_format, &This->pixelformat))
{
diff --git a/dlls/windowscodecs/bmpencode.c b/dlls/windowscodecs/bmpencode.c
index 97f30d7197..aa65675a98 100644
--- a/dlls/windowscodecs/bmpencode.c
+++ b/dlls/windowscodecs/bmpencode.c
@@ -529,7 +529,7 @@ static HRESULT WINAPI BmpEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
if (ppIEncoderOptions)
{
- hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions);
+ hr = CreatePropertyBag2(opts, ARRAY_SIZE(opts), ppIEncoderOptions);
if (FAILED(hr)) return hr;
}
diff --git a/dlls/windowscodecs/jpegformat.c b/dlls/windowscodecs/jpegformat.c
index f05663f070..d24af6dc9e 100644
--- a/dlls/windowscodecs/jpegformat.c
+++ b/dlls/windowscodecs/jpegformat.c
@@ -1463,7 +1463,7 @@ static HRESULT WINAPI JpegEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
if (ppIEncoderOptions)
{
- hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions);
+ hr = CreatePropertyBag2(opts, ARRAY_SIZE(opts), ppIEncoderOptions);
if (FAILED(hr))
{
LeaveCriticalSection(&This->lock);
diff --git a/dlls/windowscodecs/metadataquery.c b/dlls/windowscodecs/metadataquery.c
index e33884881b..2d7c918921 100644
--- a/dlls/windowscodecs/metadataquery.c
+++ b/dlls/windowscodecs/metadataquery.c
@@ -164,7 +164,7 @@ static VARTYPE map_type(struct string_t *str)
{
UINT i;
- for (i = 0; i < sizeof(str2vt)/sizeof(str2vt[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(str2vt); i++)
{
if (str2vt[i].len == str->len)
{
@@ -743,7 +743,7 @@ HRESULT WINAPI WICMapGuidToShortName(REFGUID guid, UINT len, WCHAR *name, UINT *
if (!guid) return E_INVALIDARG;
- for (i = 0; i < sizeof(guid2name)/sizeof(guid2name[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(guid2name); i++)
{
if (IsEqualGUID(guid, guid2name[i].guid))
{
@@ -774,7 +774,7 @@ HRESULT WINAPI WICMapShortNameToGuid(PCWSTR name, GUID *guid)
if (!name || !guid) return E_INVALIDARG;
- for (i = 0; i < sizeof(guid2name)/sizeof(guid2name[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(guid2name); i++)
{
if (!lstrcmpiW(name, guid2name[i].name))
{
@@ -884,7 +884,7 @@ static const WCHAR *map_shortname_to_schema(const GUID *format, const WCHAR *nam
!IsEqualGUID(format, &GUID_MetadataFormatXMPStruct))
return NULL;
- for (i = 0; i < sizeof(name2schema)/sizeof(name2schema[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(name2schema); i++)
{
if (!lstrcmpW(name2schema[i].name, name))
return name2schema[i].schema;
@@ -909,7 +909,7 @@ HRESULT WINAPI WICMapSchemaToName(REFGUID format, LPWSTR schema, UINT len, WCHAR
!IsEqualGUID(format, &GUID_MetadataFormatXMPStruct))
return WINCODEC_ERR_PROPERTYNOTFOUND;
- for (i = 0; i < sizeof(name2schema)/sizeof(name2schema[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(name2schema); i++)
{
if (!lstrcmpW(name2schema[i].schema, schema))
{
diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c
index fd0d197bb3..6b13112130 100644
--- a/dlls/windowscodecs/pngformat.c
+++ b/dlls/windowscodecs/pngformat.c
@@ -1441,7 +1441,7 @@ static HRESULT WINAPI PngFrameEncode_Initialize(IWICBitmapFrameEncode *iface,
if (pIEncoderOptions)
{
- hr = IPropertyBag2_Read(pIEncoderOptions, sizeof(opts)/sizeof(opts[0]), opts, NULL, opt_values, opt_hres);
+ hr = IPropertyBag2_Read(pIEncoderOptions, ARRAY_SIZE(opts), opts, NULL, opt_values, opt_hres);
if (FAILED(hr))
return hr;
@@ -2046,7 +2046,7 @@ static HRESULT WINAPI PngEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
if (ppIEncoderOptions)
{
- hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions);
+ hr = CreatePropertyBag2(opts, ARRAY_SIZE(opts), ppIEncoderOptions);
if (FAILED(hr))
{
LeaveCriticalSection(&This->lock);
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
index 2b2f84f859..966ab3eb4b 100644
--- a/dlls/windowscodecs/tiffformat.c
+++ b/dlls/windowscodecs/tiffformat.c
@@ -1956,7 +1956,7 @@ static HRESULT WINAPI TiffEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
if (ppIEncoderOptions && SUCCEEDED(hr))
{
- hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions);
+ hr = CreatePropertyBag2(opts, ARRAY_SIZE(opts), ppIEncoderOptions);
if (SUCCEEDED(hr))
{
VARIANT v;
--
2.14.4

View File

@ -1,147 +0,0 @@
From a786168729fc3af234574a6f2a9baa7ea562a9ee Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 14:20:24 +0200
Subject: [PATCH] localspl: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/localspl/localmon.c | 10 +++++-----
dlls/localspl/provider.c | 20 ++++++++++----------
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/dlls/localspl/localmon.c b/dlls/localspl/localmon.c
index 4be1ad6101..8553aa2297 100644
--- a/dlls/localspl/localmon.c
+++ b/dlls/localspl/localmon.c
@@ -279,10 +279,10 @@ static DWORD get_type_from_name(LPCWSTR name)
{
HANDLE hfile;
- if (!strncmpW(name, portname_LPT, sizeof(portname_LPT) / sizeof(WCHAR) -1))
+ if (!strncmpW(name, portname_LPT, ARRAY_SIZE(portname_LPT) -1))
return PORT_IS_LPT;
- if (!strncmpW(name, portname_COM, sizeof(portname_COM) / sizeof(WCHAR) -1))
+ if (!strncmpW(name, portname_COM, ARRAY_SIZE(portname_COM) -1))
return PORT_IS_COM;
if (!strcmpW(name, portname_FILE))
@@ -294,10 +294,10 @@ static DWORD get_type_from_name(LPCWSTR name)
if (name[0] == '|')
return PORT_IS_PIPE;
- if (!strncmpW(name, portname_CUPS, sizeof(portname_CUPS) / sizeof(WCHAR) -1))
+ if (!strncmpW(name, portname_CUPS, ARRAY_SIZE(portname_CUPS) -1))
return PORT_IS_CUPS;
- if (!strncmpW(name, portname_LPR, sizeof(portname_LPR) / sizeof(WCHAR) -1))
+ if (!strncmpW(name, portname_LPR, ARRAY_SIZE(portname_LPR) -1))
return PORT_IS_LPR;
/* Must be a file or a directory. Does the file exist ? */
@@ -704,7 +704,7 @@ static DWORD WINAPI localmon_XcvDataPort(HANDLE hXcv, LPCWSTR pszDataName, PBYTE
{
ptr = ((xcv_t *)hXcv)->nameW;
}
- lstrcpynW(buffer, ptr, sizeof(buffer)/sizeof(WCHAR));
+ lstrcpynW(buffer, ptr, ARRAY_SIZE(buffer));
if (buffer[0]) buffer[lstrlenW(buffer)-1] = '\0'; /* remove the ':' */
res = SetDefaultCommConfigW(buffer, (LPCOMMCONFIG) pInputData, cbInputData);
TRACE("got %u with %u\n", res, GetLastError() );
diff --git a/dlls/localspl/provider.c b/dlls/localspl/provider.c
index 3538947281..c17d982fa7 100644
--- a/dlls/localspl/provider.c
+++ b/dlls/localspl/provider.c
@@ -275,7 +275,7 @@ static LONG copy_servername_from_name(LPCWSTR name, LPWSTR target)
target[serverlen] = '\0';
}
- len = sizeof(buffer) / sizeof(buffer[0]);
+ len = ARRAY_SIZE(buffer);
if (GetComputerNameW(buffer, &len)) {
if ((serverlen == len) && (strncmpiW(server, buffer, len) == 0)) {
/* The requested Servername is our computername */
@@ -693,7 +693,7 @@ static const printenv_t * validate_envW(LPCWSTR env)
TRACE("(%s)\n", debugstr_w(env));
if (env && env[0])
{
- for (i = 0; i < sizeof(all_printenv)/sizeof(all_printenv[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(all_printenv); i++)
{
if (lstrcmpiW(env, all_printenv[i]->envname) == 0)
{
@@ -749,7 +749,7 @@ static DWORD get_local_monitors(DWORD level, LPBYTE pMonitors, DWORD cbBuf, LPDW
ptr = (LPWSTR) &pMonitors[len];
numentries = 0;
- len = sizeof(buffer)/sizeof(buffer[0]);
+ len = ARRAY_SIZE(buffer);
buffer[0] = '\0';
/* Windows creates the "Monitors"-Key on reboot / start "spooler" */
@@ -802,7 +802,7 @@ static DWORD get_local_monitors(DWORD level, LPBYTE pMonitors, DWORD cbBuf, LPDW
}
}
index++;
- len = sizeof(buffer)/sizeof(buffer[0]);
+ len = ARRAY_SIZE(buffer);
buffer[0] = '\0';
}
RegCloseKey(hroot);
@@ -838,7 +838,7 @@ static DWORD get_local_printprocessors(LPWSTR regpathW, LPBYTE pPPInfo, DWORD cb
ptr = (LPWSTR) &pPPInfo[len];
numentries = 0;
- len = sizeof(buffer)/sizeof(buffer[0]);
+ len = ARRAY_SIZE(buffer);
buffer[0] = '\0';
if (RegCreateKeyW(HKEY_LOCAL_MACHINE, regpathW, &hroot) == ERROR_SUCCESS) {
@@ -852,7 +852,7 @@ static DWORD get_local_printprocessors(LPWSTR regpathW, LPBYTE pPPInfo, DWORD cb
TRACE("%p: writing PRINTPROCESSOR_INFO_1W #%d\n", ppi, numentries);
ppi->pName = ptr;
lstrcpyW(ptr, winprintW); /* Name of the Print Processor */
- ptr += sizeof(winprintW) / sizeof(WCHAR);
+ ptr += ARRAY_SIZE(winprintW);
}
/* Scan all Printprocessor Keys */
@@ -888,7 +888,7 @@ static DWORD get_local_printprocessors(LPWSTR regpathW, LPBYTE pPPInfo, DWORD cb
}
}
index++;
- len = sizeof(buffer)/sizeof(buffer[0]);
+ len = ARRAY_SIZE(buffer);
buffer[0] = '\0';
}
RegCloseKey(hroot);
@@ -1196,7 +1196,7 @@ static HANDLE printer_alloc_handle(LPCWSTR name, LPPRINTER_DEFAULTSW pDefault)
printer = NULL;
}
if (printername) {
- len = sizeof(XcvMonitorW)/sizeof(WCHAR) - 1;
+ len = ARRAY_SIZE(XcvMonitorW) - 1;
if (strncmpW(printername, XcvMonitorW, len) == 0) {
/* OpenPrinter(",XcvMonitor ", ...) detected */
TRACE(",XcvMonitor: %s\n", debugstr_w(&printername[len]));
@@ -1210,7 +1210,7 @@ static HANDLE printer_alloc_handle(LPCWSTR name, LPPRINTER_DEFAULTSW pDefault)
}
else
{
- len = sizeof(XcvPortW)/sizeof(WCHAR) - 1;
+ len = ARRAY_SIZE(XcvPortW) - 1;
if (strncmpW( printername, XcvPortW, len) == 0) {
/* OpenPrinter(",XcvPort ", ...) detected */
TRACE(",XcvPort: %s\n", debugstr_w(&printername[len]));
@@ -1303,7 +1303,7 @@ static BOOL myAddPrinterDriverEx(DWORD level, LPBYTE pDriverInfo, DWORD dwFileCo
DRIVER_INFO, that the caller supplied */
ZeroMemory(&di, sizeof(di));
- if (pDriverInfo && (level < (sizeof(di_sizeof) / sizeof(di_sizeof[0])))) {
+ if (pDriverInfo && (level < ARRAY_SIZE(di_sizeof))) {
memcpy(&di, pDriverInfo, di_sizeof[level]);
}
--
2.14.4

View File

@ -1,76 +0,0 @@
From cc5f7e223678e31439d4194fd62d6448a06570f3 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 18:13:30 +0200
Subject: [PATCH] mmdevapi: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/mmdevapi/devenum.c | 10 +++++-----
dlls/mmdevapi/main.c | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/mmdevapi/devenum.c b/dlls/mmdevapi/devenum.c
index b189e8e060..685ec27de6 100644
--- a/dlls/mmdevapi/devenum.c
+++ b/dlls/mmdevapi/devenum.c
@@ -338,7 +338,7 @@ static MMDevice *MMDevice_Create(WCHAR *name, GUID *id, EDataFlow flow, DWORD st
cur->state = state;
cur->devguid = *id;
- StringFromGUID2(&cur->devguid, guidstr, sizeof(guidstr)/sizeof(*guidstr));
+ StringFromGUID2(&cur->devguid, guidstr, ARRAY_SIZE(guidstr));
if (flow == eRender)
root = key_render;
@@ -429,7 +429,7 @@ static HRESULT load_devices_from_reg(void)
DWORD len;
PROPVARIANT pv = { VT_EMPTY };
- len = sizeof(guidvalue)/sizeof(guidvalue[0]);
+ len = ARRAY_SIZE(guidvalue);
ret = RegEnumKeyExW(cur, i++, guidvalue, &len, NULL, NULL, NULL, NULL);
if (ret == ERROR_NO_MORE_ITEMS)
{
@@ -1395,7 +1395,7 @@ static HRESULT WINAPI MMDevPropStore_GetCount(IPropertyStore *iface, DWORD *npro
return hr;
*nprops = 0;
do {
- DWORD len = sizeof(buffer)/sizeof(*buffer);
+ DWORD len = ARRAY_SIZE(buffer);
if (RegEnumValueW(propkey, i, buffer, &len, NULL, NULL, NULL, NULL) != ERROR_SUCCESS)
break;
i++;
@@ -1410,7 +1410,7 @@ static HRESULT WINAPI MMDevPropStore_GetAt(IPropertyStore *iface, DWORD prop, PR
{
MMDevPropStore *This = impl_from_IPropertyStore(iface);
WCHAR buffer[50];
- DWORD len = sizeof(buffer)/sizeof(*buffer);
+ DWORD len = ARRAY_SIZE(buffer);
HRESULT hr;
HKEY propkey;
@@ -1530,7 +1530,7 @@ static HRESULT WINAPI PB_Read(IPropertyBag *iface, LPCOLESTR name, VARIANT *var,
if (!lstrcmpW(name, dsguid))
{
WCHAR guidstr[39];
- StringFromGUID2(&This->devguid, guidstr,sizeof(guidstr)/sizeof(*guidstr));
+ StringFromGUID2(&This->devguid, guidstr,ARRAY_SIZE(guidstr));
var->n1.n2.vt = VT_BSTR;
var->n1.n2.n3.bstrVal = SysAllocString(guidstr);
return S_OK;
diff --git a/dlls/mmdevapi/main.c b/dlls/mmdevapi/main.c
index 2b0a6f946b..8886975c96 100644
--- a/dlls/mmdevapi/main.c
+++ b/dlls/mmdevapi/main.c
@@ -295,7 +295,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
return E_NOINTERFACE;
}
- for (i = 0; i < sizeof(MMDEVAPI_CF)/sizeof(MMDEVAPI_CF[0]); ++i)
+ for (i = 0; i < ARRAY_SIZE(MMDEVAPI_CF); ++i)
{
if (IsEqualGUID(rclsid, MMDEVAPI_CF[i].rclsid)) {
IClassFactory_AddRef(&MMDEVAPI_CF[i].IClassFactory_iface);
--
2.14.4

View File

@ -1,53 +0,0 @@
From 5499bc6ae7bbc3b6924ec2a692ab0821d6c7113d Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 18:16:59 +0200
Subject: [PATCH] mapi32: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/mapi32/sendmail.c | 8 ++++----
dlls/mapi32/util.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/mapi32/sendmail.c b/dlls/mapi32/sendmail.c
index 9ebb220c03..407dd13041 100644
--- a/dlls/mapi32/sendmail.c
+++ b/dlls/mapi32/sendmail.c
@@ -542,8 +542,8 @@ ULONG WINAPI MAPISendMail( LHANDLE session, ULONG_PTR uiparam,
}
/* Display an error message since we apparently have no mail clients */
- LoadStringW(hInstMAPI32, IDS_NO_MAPI_CLIENT, error_msg, sizeof(error_msg) / sizeof(WCHAR));
- LoadStringW(hInstMAPI32, IDS_SEND_MAIL, msg_title, sizeof(msg_title) / sizeof(WCHAR));
+ LoadStringW(hInstMAPI32, IDS_NO_MAPI_CLIENT, error_msg, ARRAY_SIZE(error_msg));
+ LoadStringW(hInstMAPI32, IDS_SEND_MAIL, msg_title, ARRAY_SIZE(msg_title));
MessageBoxW((HWND) uiparam, error_msg, msg_title, MB_ICONEXCLAMATION);
@@ -701,8 +701,8 @@ ULONG WINAPI MAPISendMailW(LHANDLE session, ULONG_PTR uiparam,
}
/* Display an error message since we apparently have no mail clients */
- LoadStringW(hInstMAPI32, IDS_NO_MAPI_CLIENT, error_msg, sizeof(error_msg) / sizeof(WCHAR));
- LoadStringW(hInstMAPI32, IDS_SEND_MAIL, msg_title, sizeof(msg_title) / sizeof(WCHAR));
+ LoadStringW(hInstMAPI32, IDS_NO_MAPI_CLIENT, error_msg, ARRAY_SIZE(error_msg));
+ LoadStringW(hInstMAPI32, IDS_SEND_MAIL, msg_title, ARRAY_SIZE(msg_title));
MessageBoxW((HWND) uiparam, error_msg, msg_title, MB_ICONEXCLAMATION);
diff --git a/dlls/mapi32/util.c b/dlls/mapi32/util.c
index 13e4affc39..9c3b01944a 100644
--- a/dlls/mapi32/util.c
+++ b/dlls/mapi32/util.c
@@ -903,7 +903,7 @@ BOOL WINAPI FGetComponentPath(LPCSTR component, LPCSTR qualifier, LPSTR dll_path
char lcid_ver[20];
UINT i;
- for (i = 0; i < sizeof(fmt)/sizeof(fmt[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(fmt); i++)
{
/* FIXME: what's the correct behaviour here? */
if (!qualifier || qualifier == lcid_ver)
--
2.14.4

View File

@ -1,126 +0,0 @@
From d66b0e6cc5066669c5e856d4627af51f7004fead Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 18:21:27 +0200
Subject: [PATCH] krnl386.exe16: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/krnl386.exe16/int21.c | 6 +++---
dlls/krnl386.exe16/interrupts.c | 4 ++--
dlls/krnl386.exe16/relay.c | 4 ++--
dlls/krnl386.exe16/snoop.c | 4 ++--
dlls/krnl386.exe16/vxd.c | 6 +++---
5 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/dlls/krnl386.exe16/int21.c b/dlls/krnl386.exe16/int21.c
index f32b1a767c..f5b257b6d7 100644
--- a/dlls/krnl386.exe16/int21.c
+++ b/dlls/krnl386.exe16/int21.c
@@ -814,8 +814,8 @@ static HANDLE INT21_CreateMagicDeviceHandle( LPCWSTR name )
return 0;
}
memcpy( nameW.Buffer, prefixW, sizeof(prefixW) );
- MultiByteToWideChar( CP_UNIXCP, 0, dir, -1, nameW.Buffer + sizeof(prefixW)/sizeof(WCHAR), len );
- len += sizeof(prefixW) / sizeof(WCHAR);
+ MultiByteToWideChar( CP_UNIXCP, 0, dir, -1, nameW.Buffer + ARRAY_SIZE(prefixW), len );
+ len += ARRAY_SIZE(prefixW);
nameW.Buffer[len-1] = '/';
strcpyW( nameW.Buffer + len, name );
@@ -3264,7 +3264,7 @@ static BOOL INT21_NetworkFunc (CONTEXT *context)
case 0x00: /* Get machine name. */
{
WCHAR dstW[MAX_COMPUTERNAME_LENGTH + 1];
- DWORD s = sizeof(dstW) / sizeof(WCHAR);
+ DWORD s = ARRAY_SIZE(dstW);
int len;
char *dst = CTX_SEG_OFF_TO_LIN (context,context->SegDs,context->Edx);
diff --git a/dlls/krnl386.exe16/interrupts.c b/dlls/krnl386.exe16/interrupts.c
index e1b01b7b3d..c4448c6d00 100644
--- a/dlls/krnl386.exe16/interrupts.c
+++ b/dlls/krnl386.exe16/interrupts.c
@@ -103,7 +103,7 @@ static void WINAPI DOSVM_DefaultHandler( CONTEXT *context )
*/
static INTPROC DOSVM_GetBuiltinHandler( BYTE intnum )
{
- if (intnum < sizeof(DOSVM_VectorsBuiltin)/sizeof(INTPROC)) {
+ if (intnum < ARRAY_SIZE(DOSVM_VectorsBuiltin)) {
INTPROC proc = DOSVM_VectorsBuiltin[intnum];
if (proc)
return proc;
@@ -274,7 +274,7 @@ BOOL DOSVM_EmulateInterruptPM( CONTEXT *context, BYTE intnum )
else if (wine_ldt_is_system(context->SegCs))
{
INTPROC proc;
- if (intnum >= sizeof(DOSVM_VectorsBuiltin)/sizeof(INTPROC)) return FALSE;
+ if (intnum >= ARRAY_SIZE(DOSVM_VectorsBuiltin)) return FALSE;
if (!(proc = DOSVM_VectorsBuiltin[intnum])) return FALSE;
proc( context );
}
diff --git a/dlls/krnl386.exe16/relay.c b/dlls/krnl386.exe16/relay.c
index f1fbc57a0f..264ba2c589 100644
--- a/dlls/krnl386.exe16/relay.c
+++ b/dlls/krnl386.exe16/relay.c
@@ -345,7 +345,7 @@ static int relay_call_from_16_no_debug( void *entry_point, unsigned char *args16
int args32[20];
/* look for the ret instruction */
- for (j = 0; j < sizeof(call->ret)/sizeof(call->ret[0]); j++)
+ for (j = 0; j < ARRAY_SIZE(call->ret); j++)
if (call->ret[j] == 0xca66 || call->ret[j] == 0xcb66) break;
if (call->ret[j] == 0xcb66) /* cdecl */
@@ -449,7 +449,7 @@ int relay_call_from_16( void *entry_point, unsigned char *args16, CONTEXT *conte
TRACE( "\1Call %s.%d: %s(", module, ordinal, func );
/* look for the ret instruction */
- for (j = 0; j < sizeof(call->ret)/sizeof(call->ret[0]); j++)
+ for (j = 0; j < ARRAY_SIZE(call->ret); j++)
if (call->ret[j] == 0xca66 || call->ret[j] == 0xcb66) break;
if (call->ret[j] == 0xcb66) /* cdecl */
diff --git a/dlls/krnl386.exe16/snoop.c b/dlls/krnl386.exe16/snoop.c
index 95a5154a4b..4496080dad 100644
--- a/dlls/krnl386.exe16/snoop.c
+++ b/dlls/krnl386.exe16/snoop.c
@@ -262,10 +262,10 @@ static void WINAPI SNOOP16_Entry(FARPROC proc, LPBYTE args, CONTEXT *context) {
return; /* oops */
}
while (*rets) {
- for (i=0;i<sizeof((*rets)->entry)/sizeof((*rets)->entry[0]);i++)
+ for (i=0;i<ARRAY_SIZE((*rets)->entry);i++)
if (!(*rets)->entry[i].origreturn)
break;
- if (i!=sizeof((*rets)->entry)/sizeof((*rets)->entry[0]))
+ if (i!=ARRAY_SIZE((*rets)->entry))
break;
rets = &((*rets)->next);
}
diff --git a/dlls/krnl386.exe16/vxd.c b/dlls/krnl386.exe16/vxd.c
index dc14600f5d..e103b96bb9 100644
--- a/dlls/krnl386.exe16/vxd.c
+++ b/dlls/krnl386.exe16/vxd.c
@@ -129,8 +129,8 @@ static HANDLE open_vxd_handle( LPCWSTR name )
return 0;
}
memcpy( nameW.Buffer, prefixW, sizeof(prefixW) );
- MultiByteToWideChar( CP_UNIXCP, 0, dir, -1, nameW.Buffer + sizeof(prefixW)/sizeof(WCHAR), len );
- len += sizeof(prefixW) / sizeof(WCHAR);
+ MultiByteToWideChar( CP_UNIXCP, 0, dir, -1, nameW.Buffer + ARRAY_SIZE(prefixW), len );
+ len += ARRAY_SIZE(prefixW);
nameW.Buffer[len-1] = '/';
strcpyW( nameW.Buffer + len, name );
@@ -201,7 +201,7 @@ HANDLE __wine_vxd_open( LPCWSTR filenameW, DWORD access, SECURITY_ATTRIBUTES *sa
/* normalize the filename */
- if (strlenW( filenameW ) >= sizeof(name)/sizeof(WCHAR) - 4 ||
+ if (strlenW( filenameW ) >= ARRAY_SIZE(name) - 4 ||
strchrW( filenameW, '/' ) || strchrW( filenameW, '\\' ))
{
SetLastError( ERROR_FILE_NOT_FOUND );
--
2.14.4

View File

@ -1,101 +0,0 @@
From a2c03d68887fc2bd2eb4cde9bb4ea7aa133af5ee Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 18:24:53 +0200
Subject: [PATCH] inetcpl.cpl: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/inetcpl.cpl/connections.c | 9 ++++-----
dlls/inetcpl.cpl/general.c | 4 ++--
dlls/inetcpl.cpl/security.c | 10 +++++-----
3 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/dlls/inetcpl.cpl/connections.c b/dlls/inetcpl.cpl/connections.c
index 707fb3c4f7..648cd3d002 100644
--- a/dlls/inetcpl.cpl/connections.c
+++ b/dlls/inetcpl.cpl/connections.c
@@ -273,13 +273,12 @@ static INT_PTR connections_on_notify(HWND hwnd, WPARAM wparam, LPARAM lparam)
}
TRACE("ProxyEnable set to %x\n", use_proxy);
- proxy_len = GetDlgItemTextW(hwnd, IDC_EDIT_PROXY_SERVER,
- proxy, sizeof(proxy)/sizeof(proxy[0]));
+ proxy_len = GetDlgItemTextW(hwnd, IDC_EDIT_PROXY_SERVER, proxy, ARRAY_SIZE(proxy));
if(proxy_len)
{
proxy[proxy_len++] = ':';
- port_len = GetDlgItemTextW(hwnd, IDC_EDIT_PROXY_PORT,
- proxy+proxy_len, sizeof(proxy)/sizeof(proxy[0])-proxy_len);
+ port_len = GetDlgItemTextW(hwnd, IDC_EDIT_PROXY_PORT, proxy+proxy_len,
+ ARRAY_SIZE(proxy)-proxy_len);
if(!port_len)
{
proxy[proxy_len++] = '8';
@@ -305,7 +304,7 @@ static INT_PTR connections_on_notify(HWND hwnd, WPARAM wparam, LPARAM lparam)
use_pac_script = IsDlgButtonChecked(hwnd, IDC_USE_PAC_SCRIPT);
pac_script_len = GetDlgItemTextW(hwnd, IDC_EDIT_PAC_SCRIPT,
- pac_script, sizeof(pac_script)/sizeof(pac_script[0]));
+ pac_script, ARRAY_SIZE(pac_script));
if(!pac_script_len) use_pac_script = FALSE;
if(use_pac_script)
{
diff --git a/dlls/inetcpl.cpl/general.c b/dlls/inetcpl.cpl/general.c
index e0f473caf7..b9fbf1eb0a 100644
--- a/dlls/inetcpl.cpl/general.c
+++ b/dlls/inetcpl.cpl/general.c
@@ -263,10 +263,10 @@ static INT_PTR general_on_notify(HWND hwnd, WPARAM wparam, LPARAM lparam)
if (psn->hdr.code == PSN_APPLY)
{
*buffer = 0;
- GetDlgItemTextW(hwnd, IDC_HOME_EDIT, buffer, sizeof(buffer)/sizeof(WCHAR));
+ GetDlgItemTextW(hwnd, IDC_HOME_EDIT, buffer, ARRAY_SIZE(buffer));
TRACE("EDITTEXT has %s\n", debugstr_w(buffer));
- res = parse_url_from_outside(buffer, parsed, sizeof(parsed)/sizeof(WCHAR));
+ res = parse_url_from_outside(buffer, parsed, ARRAY_SIZE(parsed));
TRACE("got %d with %s\n", res, debugstr_w(parsed));
if (res)
diff --git a/dlls/inetcpl.cpl/security.c b/dlls/inetcpl.cpl/security.c
index 543ada433d..e11caf1fc3 100644
--- a/dlls/inetcpl.cpl/security.c
+++ b/dlls/inetcpl.cpl/security.c
@@ -73,7 +73,7 @@ static DWORD url_templates[] = {URLTEMPLATE_CUSTOM,
static DWORD index_from_urltemplate(URLTEMPLATE value)
{
- DWORD index = sizeof(url_templates) / sizeof(url_templates[0]);
+ DWORD index = ARRAY_SIZE(url_templates);
while((index > 0) && (url_templates[index-1] != value))
index--;
@@ -105,12 +105,12 @@ static void update_security_level(secdlg_data *sd, DWORD lv_index, DWORD tb_inde
current_index = (tb_index > 0) ? tb_index : index_from_urltemplate(sd->levels[lv_index]);
name[0] = 0;
- LoadStringW(hcpl, IDS_SEC_LEVEL0 + current_index, name, sizeof(name)/sizeof(name[0]));
+ LoadStringW(hcpl, IDS_SEC_LEVEL0 + current_index, name, ARRAY_SIZE(name));
TRACE("new level #%d: %s\n", current_index, debugstr_w(name));
SetWindowTextW(GetDlgItem(sd->hsec, IDC_SEC_LEVEL), name);
name[0] = 0;
- LoadStringW(hcpl, IDS_SEC_LEVEL0_INFO + (current_index * 0x10), name, sizeof(name)/sizeof(name[0]));
+ LoadStringW(hcpl, IDS_SEC_LEVEL0_INFO + (current_index * 0x10), name, ARRAY_SIZE(name));
TRACE("new level info: %s\n", debugstr_w(name));
SetWindowTextW(GetDlgItem(sd->hsec, IDC_SEC_LEVEL_INFO), name);
@@ -134,8 +134,8 @@ static void update_zone_info(secdlg_data *sd, DWORD lv_index)
SetWindowTextW(GetDlgItem(sd->hsec, IDC_SEC_ZONE_INFO), za->szDescription);
- len = LoadStringW(hcpl, IDS_SEC_SETTINGS, name, sizeof(name)/sizeof(*name));
- lstrcpynW(&name[len], za->szDisplayName, sizeof(name)/sizeof(*name) - len - 1);
+ len = LoadStringW(hcpl, IDS_SEC_SETTINGS, name, ARRAY_SIZE(name));
+ lstrcpynW(&name[len], za->szDisplayName, ARRAY_SIZE(name) - len - 1);
TRACE("new title: %s\n", debugstr_w(name));
SetWindowTextW(GetDlgItem(sd->hsec, IDC_SEC_GROUP), name);
--
2.14.4

View File

@ -1,68 +0,0 @@
From 00e499b6eef608c2b3eceec3b51db412637cd803 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 20:15:42 +0200
Subject: [PATCH] hhctrl.ocx: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/hhctrl.ocx/chm.c | 12 ++++++------
dlls/hhctrl.ocx/help.c | 6 +++---
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/dlls/hhctrl.ocx/chm.c b/dlls/hhctrl.ocx/chm.c
index 8cf2539d71..01403368b0 100644
--- a/dlls/hhctrl.ocx/chm.c
+++ b/dlls/hhctrl.ocx/chm.c
@@ -483,12 +483,12 @@ LPCWSTR skip_schema(LPCWSTR url)
static const WCHAR msits_schema[] = {'m','s','-','i','t','s',':'};
static const WCHAR mk_schema[] = {'m','k',':','@','M','S','I','T','S','t','o','r','e',':'};
- if(!strncmpiW(its_schema, url, sizeof(its_schema)/sizeof(WCHAR)))
- return url+sizeof(its_schema)/sizeof(WCHAR);
- if(!strncmpiW(msits_schema, url, sizeof(msits_schema)/sizeof(WCHAR)))
- return url+sizeof(msits_schema)/sizeof(WCHAR);
- if(!strncmpiW(mk_schema, url, sizeof(mk_schema)/sizeof(WCHAR)))
- return url+sizeof(mk_schema)/sizeof(WCHAR);
+ if(!strncmpiW(its_schema, url, ARRAY_SIZE(its_schema)))
+ return url + ARRAY_SIZE(its_schema);
+ if(!strncmpiW(msits_schema, url, ARRAY_SIZE(msits_schema)))
+ return url + ARRAY_SIZE(msits_schema);
+ if(!strncmpiW(mk_schema, url, ARRAY_SIZE(mk_schema)))
+ return url + ARRAY_SIZE(mk_schema);
return url;
}
diff --git a/dlls/hhctrl.ocx/help.c b/dlls/hhctrl.ocx/help.c
index c7a2a7a9e2..75b28f2f57 100644
--- a/dlls/hhctrl.ocx/help.c
+++ b/dlls/hhctrl.ocx/help.c
@@ -241,7 +241,7 @@ static BOOL AppendFullPathURL(LPCWSTR file, LPWSTR buf, LPCWSTR index)
TRACE("%s %p %s\n", debugstr_w(file), buf, debugstr_w(index));
- if(!GetFullPathNameW(file, sizeof(full_path)/sizeof(full_path[0]), full_path, NULL)) {
+ if (!GetFullPathNameW(file, ARRAY_SIZE(full_path), full_path, NULL)) {
WARN("GetFullPathName failed: %u\n", GetLastError());
return FALSE;
}
@@ -1830,7 +1830,7 @@ HHInfo *CreateHelpViewer(HHInfo *info, LPCWSTR filename, HWND caller)
/* Set the invalid tab ID (-1) as the default value for all
* of the tabs, this matches a failed TCM_INSERTITEM call.
*/
- for(i=0;i<sizeof(info->tabs)/sizeof(HHTab);i++)
+ for (i = 0; i < ARRAY_SIZE(info->tabs); i++)
info->tabs[i].id = -1;
OleInitialize(NULL);
@@ -1867,7 +1867,7 @@ HHInfo *CreateHelpViewer(HHInfo *info, LPCWSTR filename, HWND caller)
*/
static char find_html_symbol(const char *entity, int entity_len)
{
- int max = sizeof(html_encoded_symbols)/sizeof(html_encoded_symbols[0])-1;
+ int max = ARRAY_SIZE(html_encoded_symbols)-1;
int min = 0, dir;
while(min <= max)
--
2.14.4

View File

@ -1,27 +0,0 @@
From e8731fe8f894a10182df1f2f699a0f9f107062bb Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 20:18:06 +0200
Subject: [PATCH] dpnet: Use the ARRAY_SIZE() macro
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/dpnet/address.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/dpnet/address.c b/dlls/dpnet/address.c
index 4d55caa47e..0bfa2bca03 100644
--- a/dlls/dpnet/address.c
+++ b/dlls/dpnet/address.c
@@ -150,7 +150,7 @@ static const char *debugstr_SP(const GUID *id) {
if (!id) return "(null)";
- for (i = 0; i < sizeof(guids)/sizeof(guids[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(guids); i++) {
if (IsEqualGUID(id, guids[i].guid))
return guids[i].name;
}
--
2.14.4

View File

@ -1,34 +0,0 @@
From d4c354720d4534593b3a49ece07b40ea4be4b92d Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 20:19:12 +0200
Subject: [PATCH] dx8vb: Use the ARRAY_SIZE() macro
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/dx8vb/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/dx8vb/main.c b/dlls/dx8vb/main.c
index aa6b9436ce..a1ee7c918e 100644
--- a/dlls/dx8vb/main.c
+++ b/dlls/dx8vb/main.c
@@ -157,13 +157,13 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
&& !IsEqualGUID( &IID_IUnknown, riid))
return E_NOINTERFACE;
- for (i = 0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(object_creation); i++)
{
if (IsEqualGUID(object_creation[i].clsid, rclsid))
break;
}
- if (i == sizeof(object_creation)/sizeof(object_creation[0]))
+ if (i == ARRAY_SIZE(object_creation))
{
FIXME("%s: no class found.\n", debugstr_guid(rclsid));
return CLASS_E_CLASSNOTAVAILABLE;
--
2.14.4

View File

@ -1,78 +0,0 @@
From 7e95288b2d586f41e746cf930a1a75979591399a Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 20:22:05 +0200
Subject: [PATCH] fusion: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/fusion/asmcache.c | 8 ++++----
dlls/fusion/fusion.c | 10 +++++-----
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/dlls/fusion/asmcache.c b/dlls/fusion/asmcache.c
index 668aa8777e..deca5f4c37 100644
--- a/dlls/fusion/asmcache.c
+++ b/dlls/fusion/asmcache.c
@@ -117,14 +117,14 @@ static BOOL get_assembly_directory(LPWSTR dir, DWORD size, const char *version,
if (!strcmp(version, "v4.0.30319"))
{
strcpyW(dir + len, dotnet);
- len += sizeof(dotnet)/sizeof(WCHAR) -1;
+ len += ARRAY_SIZE(dotnet) - 1;
strcpyW(dir + len, gac + 1);
- len += sizeof(gac)/sizeof(WCHAR) - 2;
+ len += ARRAY_SIZE(gac) - 2;
}
else
{
strcpyW(dir + len, gac);
- len += sizeof(gac)/sizeof(WCHAR) - 1;
+ len += ARRAY_SIZE(gac) - 1;
}
switch (architecture)
{
@@ -433,7 +433,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface,
WCHAR asmdir[MAX_PATH], *p, **external_files = NULL, *dst_dir = NULL;
PEKIND architecture;
char *clr_version;
- DWORD i, count = 0, src_len, dst_len = sizeof(format_v40)/sizeof(format_v40[0]);
+ DWORD i, count = 0, src_len, dst_len = ARRAY_SIZE(format_v40);
HRESULT hr;
TRACE("(%p, %d, %s, %p)\n", iface, dwFlags,
diff --git a/dlls/fusion/fusion.c b/dlls/fusion/fusion.c
index b038b38092..a57d7e067c 100644
--- a/dlls/fusion/fusion.c
+++ b/dlls/fusion/fusion.c
@@ -144,9 +144,9 @@ HRESULT WINAPI GetCachePath(ASM_CACHE_FLAGS dwCacheFlags, LPWSTR pwzCachePath,
case ASM_CACHE_GAC:
{
strcpyW(path + len, assembly);
- len += sizeof(assembly)/sizeof(WCHAR) - 1;
+ len += ARRAY_SIZE(assembly) - 1;
strcpyW(path + len, gac);
- len += sizeof(gac)/sizeof(WCHAR) - 1;
+ len += ARRAY_SIZE(gac) - 1;
break;
}
case ASM_CACHE_DOWNLOAD:
@@ -156,13 +156,13 @@ HRESULT WINAPI GetCachePath(ASM_CACHE_FLAGS dwCacheFlags, LPWSTR pwzCachePath,
}
case ASM_CACHE_ROOT:
strcpyW(path + len, assembly);
- len += sizeof(assembly)/sizeof(WCHAR) - 1;
+ len += ARRAY_SIZE(assembly) - 1;
break;
case ASM_CACHE_ROOT_EX:
strcpyW(path + len, dotnet);
- len += sizeof(dotnet)/sizeof(WCHAR) - 1;
+ len += ARRAY_SIZE(dotnet) - 1;
strcpyW(path + len, assembly);
- len += sizeof(assembly)/sizeof(WCHAR) - 1;
+ len += ARRAY_SIZE(assembly) - 1;
break;
default:
return E_INVALIDARG;
--
2.14.4

View File

@ -1,33 +0,0 @@
From aca6266ebe1ead32e12dfb0c9aec035fec0c1363 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 20:28:08 +0200
Subject: [PATCH] evr: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/evr/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/evr/main.c b/dlls/evr/main.c
index ed5c9f4c79..313d518b76 100644
--- a/dlls/evr/main.c
+++ b/dlls/evr/main.c
@@ -154,13 +154,13 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
&& !IsEqualGUID( &IID_IUnknown, riid))
return E_NOINTERFACE;
- for (i = 0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(object_creation); i++)
{
if (IsEqualGUID(object_creation[i].clsid, rclsid))
break;
}
- if (i == sizeof(object_creation)/sizeof(object_creation[0]))
+ if (i == ARRAY_SIZE(object_creation))
{
FIXME("%s: no class found.\n", debugstr_guid(rclsid));
return CLASS_E_CLASSNOTAVAILABLE;
--
2.14.4

View File

@ -1,36 +0,0 @@
From ab5ec464cf9178ec1466bf6af36ba6584ceda982 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 20:31:59 +0200
Subject: [PATCH] d3d10: Use the ARRAY_SIZE() macro
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/d3d10/effect.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index 10d8404559..cd6f4a3e1d 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -1139,7 +1139,7 @@ static const struct d3d10_effect_state_property_info *get_property_info(UINT id)
{
unsigned int i;
- for (i = 0; i < sizeof(property_info) / sizeof(*property_info); ++i)
+ for (i = 0; i < ARRAY_SIZE(property_info); ++i)
{
if (property_info[i].id == id)
return &property_info[i];
@@ -1152,7 +1152,7 @@ static const struct d3d10_effect_state_storage_info *get_storage_info(D3D_SHADER
{
unsigned int i;
- for (i = 0; i < sizeof(d3d10_effect_state_storage_info) / sizeof(*d3d10_effect_state_storage_info); ++i)
+ for (i = 0; i < ARRAY_SIZE(d3d10_effect_state_storage_info); ++i)
{
if (d3d10_effect_state_storage_info[i].id == id)
return &d3d10_effect_state_storage_info[i];
--
2.14.4

View File

@ -1,36 +0,0 @@
From 68a223a5b2faac1fae87a9e1125f923d62b06c80 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 20:33:14 +0200
Subject: [PATCH] d3d8: Use the ARRAY_SIZE() macro
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/d3d8/device.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index c967a33d8c..364798f79b 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -2126,7 +2126,7 @@ static HRESULT WINAPI d3d8_device_GetTextureStageState(IDirect3DDevice8 *iface,
TRACE("iface %p, stage %u, state %#x, value %p.\n", iface, stage, Type, value);
- if (Type >= sizeof(tss_lookup) / sizeof(*tss_lookup))
+ if (Type >= ARRAY_SIZE(tss_lookup))
{
WARN("Invalid Type %#x passed.\n", Type);
return D3D_OK;
@@ -2152,7 +2152,7 @@ static HRESULT WINAPI d3d8_device_SetTextureStageState(IDirect3DDevice8 *iface,
TRACE("iface %p, stage %u, state %#x, value %#x.\n", iface, stage, type, value);
- if (type >= sizeof(tss_lookup) / sizeof(*tss_lookup))
+ if (type >= ARRAY_SIZE(tss_lookup))
{
WARN("Invalid type %#x passed.\n", type);
return D3D_OK;
--
2.14.4

View File

@ -1,51 +0,0 @@
From 87f229b2bc6347493ea602ac51ff7b0271c9cbb6 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 20:34:30 +0200
Subject: [PATCH] d3dcompiler: Use the ARRAY_SIZE() macro
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/d3dcompiler_43/compiler.c | 2 +-
dlls/d3dcompiler_43/utils.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dcompiler_43/compiler.c b/dlls/d3dcompiler_43/compiler.c
index 36e793ed01..10c6d01878 100644
--- a/dlls/d3dcompiler_43/compiler.c
+++ b/dlls/d3dcompiler_43/compiler.c
@@ -570,7 +570,7 @@ static const struct target_info targets_info[] = {
static const struct target_info * get_target_info(const char *target)
{
LONG min = 0;
- LONG max = sizeof(targets_info) / sizeof(targets_info[0]) - 1;
+ LONG max = ARRAY_SIZE(targets_info) - 1;
LONG cur;
int res;
diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c
index 79f3be8840..b0232f375d 100644
--- a/dlls/d3dcompiler_43/utils.c
+++ b/dlls/d3dcompiler_43/utils.c
@@ -1165,7 +1165,7 @@ static enum hlsl_base_type expr_common_base_type(enum hlsl_base_type t1, enum hl
};
int t1_idx = -1, t2_idx = -1, i;
- for (i = 0; i < sizeof(types) / sizeof(types[0]); ++i)
+ for (i = 0; i < ARRAY_SIZE(types); ++i)
{
/* Always convert away from HLSL_TYPE_HALF */
if (t1 == types[i])
@@ -1943,7 +1943,7 @@ static const char *debug_node_type(enum hlsl_ir_node_type type)
"HLSL_IR_SWIZZLE",
};
- if (type >= sizeof(names) / sizeof(names[0]))
+ if (type >= ARRAY_SIZE(names))
return "Unexpected node type";
return names[type];
}
--
2.14.4

View File

@ -1,34 +0,0 @@
From 647edc04f021e10ccb1e6417056c32d251856abf Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 20:36:58 +0200
Subject: [PATCH] d3dxof: Use the ARRAY_SIZE() macro
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/d3dxof/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dxof/main.c b/dlls/d3dxof/main.c
index 572f38831f..385609ace0 100644
--- a/dlls/d3dxof/main.c
+++ b/dlls/d3dxof/main.c
@@ -195,13 +195,13 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
&& ! IsEqualGUID( &IID_IUnknown, riid) )
return E_NOINTERFACE;
- for (i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(object_creation); i++)
{
if (IsEqualGUID(object_creation[i].clsid, rclsid))
break;
}
- if (i == sizeof(object_creation)/sizeof(object_creation[0]))
+ if (i == ARRAY_SIZE(object_creation))
{
FIXME("%s: no class found.\n", debugstr_guid(rclsid));
return CLASS_E_CLASSNOTAVAILABLE;
--
2.14.4

View File

@ -1,44 +0,0 @@
From febcd7051a70405d6a4a4882f9fc41314445ca0e Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 20:39:05 +0200
Subject: [PATCH] dnsapi: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/dnsapi/query.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/dnsapi/query.c b/dlls/dnsapi/query.c
index 74b70967ae..19eecfded1 100644
--- a/dlls/dnsapi/query.c
+++ b/dlls/dnsapi/query.c
@@ -618,7 +618,7 @@ static DNS_STATUS dns_do_query( PCSTR name, WORD type, DWORD options, PDNS_RECOR
goto exit;
}
- for (i = 0; i < sizeof(sections)/sizeof(sections[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(sections); i++)
{
for (num = 0; num < ns_msg_count( msg, sections[i] ); num++)
{
@@ -771,7 +771,7 @@ static DNS_STATUS dns_get_hostname_a( COMPUTER_NAME_FORMAT format,
PSTR buffer, PDWORD len )
{
char name[256];
- DWORD size = sizeof(name)/sizeof(name[0]);
+ DWORD size = ARRAY_SIZE(name);
if (!GetComputerNameExA( format, name, &size ))
return DNS_ERROR_NAME_DOES_NOT_EXIST;
@@ -790,7 +790,7 @@ static DNS_STATUS dns_get_hostname_w( COMPUTER_NAME_FORMAT format,
PWSTR buffer, PDWORD len )
{
WCHAR name[256];
- DWORD size = sizeof(name)/sizeof(name[0]);
+ DWORD size = ARRAY_SIZE(name);
if (!GetComputerNameExW( format, name, &size ))
return DNS_ERROR_NAME_DOES_NOT_EXIST;
--
2.14.4

View File

@ -1,47 +0,0 @@
From 86bb2d2b580b4f5c77fcdb75be9d68522bd9807d Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 08:57:48 +0200
Subject: [PATCH] amstream: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/amstream/main.c | 4 ++--
dlls/amstream/tests/amstream.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/amstream/main.c b/dlls/amstream/main.c
index 2cadf9c32f..65aafba3e6 100644
--- a/dlls/amstream/main.c
+++ b/dlls/amstream/main.c
@@ -174,13 +174,13 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
&& ! IsEqualGUID( &IID_IUnknown, riid) )
return E_NOINTERFACE;
- for (i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(object_creation); i++)
{
if (IsEqualGUID(object_creation[i].clsid, rclsid))
break;
}
- if (i == sizeof(object_creation)/sizeof(object_creation[0]))
+ if (i == ARRAY_SIZE(object_creation))
{
FIXME("%s: no class found.\n", debugstr_guid(rclsid));
return CLASS_E_CLASSNOTAVAILABLE;
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c
index 1a14572c8a..52e691fea4 100644
--- a/dlls/amstream/tests/amstream.c
+++ b/dlls/amstream/tests/amstream.c
@@ -479,7 +479,7 @@ static void test_media_streams(void)
ok(!lstrcmpW(info.achName, id), "Pin name is %s instead of %s\n", wine_dbgstr_w(info.achName), wine_dbgstr_w(id));
hr = IPin_EnumMediaTypes(pins[i], &enum_media_types);
ok(hr == S_OK, "IPin_EnumMediaTypes returned: %x\n", hr);
- hr = IEnumMediaTypes_Next(enum_media_types, sizeof(media_types) / sizeof(media_types[0]), media_types, &nb_media_types);
+ hr = IEnumMediaTypes_Next(enum_media_types, ARRAY_SIZE(media_types), media_types, &nb_media_types);
ok(SUCCEEDED(hr), "IEnumMediaTypes_Next returned: %x\n", hr);
ok(nb_media_types > 0, "nb_media_types should be >0\n");
IEnumMediaTypes_Release(enum_media_types);
--
2.14.4

View File

@ -1,26 +0,0 @@
From a12472814a32462fd5e1b23efe0bbae33b76ee1c Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 08:58:41 +0200
Subject: [PATCH] browseui: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/browseui/progressdlg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/browseui/progressdlg.c b/dlls/browseui/progressdlg.c
index 7cba7d6464..2355b0cfa0 100644
--- a/dlls/browseui/progressdlg.c
+++ b/dlls/browseui/progressdlg.c
@@ -114,7 +114,7 @@ static LPWSTR load_string(HINSTANCE hInstance, UINT uiResourceId)
WCHAR string[256];
LPWSTR ret;
- LoadStringW(hInstance, uiResourceId, string, sizeof(string)/sizeof(string[0]));
+ LoadStringW(hInstance, uiResourceId, string, ARRAY_SIZE(string));
ret = HeapAlloc(GetProcessHeap(), 0, (strlenW(string) + 1) * sizeof(WCHAR));
strcpyW(ret, string);
return ret;
--
2.14.4

View File

@ -1,35 +0,0 @@
From 908e14ff27dc82ade08cc05573b4963179d05791 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 09:01:38 +0200
Subject: [PATCH] gameux: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/gameux/gameexplorer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/gameux/gameexplorer.c b/dlls/gameux/gameexplorer.c
index 63bf69d736..6495c78b38 100644
--- a/dlls/gameux/gameexplorer.c
+++ b/dlls/gameux/gameexplorer.c
@@ -150,7 +150,7 @@ HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
if(gameInstanceId)
{
if(SUCCEEDED(hr))
- hr = (StringFromGUID2(gameInstanceId, sInstanceId, sizeof(sInstanceId)/sizeof(sInstanceId[0])) ? S_OK : E_FAIL);
+ hr = (StringFromGUID2(gameInstanceId, sInstanceId, ARRAY_SIZE(sInstanceId)) ? S_OK : E_FAIL);
if(SUCCEEDED(hr))
{
@@ -219,7 +219,7 @@ static HRESULT GAMEUX_WriteRegistryRecord(struct GAMEUX_GAME_DATA *GameData)
hr = GAMEUX_buildGameRegistryPath(GameData->installScope, &GameData->guidInstanceId, &lpRegistryKey);
if(SUCCEEDED(hr))
- hr = (StringFromGUID2(&GameData->guidApplicationId, sGameApplicationId, sizeof(sGameApplicationId)/sizeof(sGameApplicationId[0])) ? S_OK : E_FAIL);
+ hr = (StringFromGUID2(&GameData->guidApplicationId, sGameApplicationId, ARRAY_SIZE(sGameApplicationId)) ? S_OK : E_FAIL);
if(SUCCEEDED(hr))
hr = HRESULT_FROM_WIN32(RegCreateKeyExW(HKEY_LOCAL_MACHINE, lpRegistryKey,
--
2.14.4

View File

@ -1,104 +0,0 @@
From 1e5920e18facb943edaf4bff76dd863550338cf1 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 09:10:49 +0200
Subject: [PATCH] inetcomm: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/inetcomm/mimeole.c | 7 +++----
dlls/inetcomm/protocol.c | 18 +++++++++---------
2 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/dlls/inetcomm/mimeole.c b/dlls/inetcomm/mimeole.c
index 681ca820d4..cb9ebcc382 100644
--- a/dlls/inetcomm/mimeole.c
+++ b/dlls/inetcomm/mimeole.c
@@ -1581,9 +1581,8 @@ static HRESULT decode_base64(IStream *input, IStream **ret_stream)
while(1) {
/* skip invalid chars */
- while(ptr < end &&
- (*ptr >= sizeof(base64_decode_table)/sizeof(*base64_decode_table)
- || base64_decode_table[*ptr] == -1))
+ while(ptr < end && (*ptr >= ARRAY_SIZE(base64_decode_table)
+ || base64_decode_table[*ptr] == -1))
ptr++;
if(ptr == end)
break;
@@ -3715,7 +3714,7 @@ HRESULT WINAPI MimeOleObjectFromMoniker(BINDF bindf, IMoniker *moniker, IBindCtx
return E_OUTOFMEMORY;
memcpy(mhtml_url, mhtml_prefixW, sizeof(mhtml_prefixW));
- strcpyW(mhtml_url + sizeof(mhtml_prefixW)/sizeof(WCHAR), display_name);
+ strcpyW(mhtml_url + ARRAY_SIZE(mhtml_prefixW), display_name);
HeapFree(GetProcessHeap(), 0, display_name);
hres = CreateURLMoniker(NULL, mhtml_url, moniker_new);
diff --git a/dlls/inetcomm/protocol.c b/dlls/inetcomm/protocol.c
index 028463a269..c6a59fee7c 100644
--- a/dlls/inetcomm/protocol.c
+++ b/dlls/inetcomm/protocol.c
@@ -83,16 +83,16 @@ static HRESULT parse_mhtml_url(const WCHAR *url, mhtml_url_t *r)
{
const WCHAR *p;
- if(strncmpiW(url, mhtml_prefixW, sizeof(mhtml_prefixW)/sizeof(WCHAR)))
+ if(strncmpiW(url, mhtml_prefixW, ARRAY_SIZE(mhtml_prefixW)))
return E_FAIL;
- r->mhtml = url + sizeof(mhtml_prefixW)/sizeof(WCHAR);
+ r->mhtml = url + ARRAY_SIZE(mhtml_prefixW);
p = strchrW(r->mhtml, '!');
if(p) {
r->mhtml_len = p - r->mhtml;
/* FIXME: We handle '!' and '!x-usc:' in URLs as the same thing. Those should not be the same. */
- if(!strncmpW(p, mhtml_separatorW, sizeof(mhtml_separatorW)/sizeof(WCHAR)))
- p += sizeof(mhtml_separatorW)/sizeof(WCHAR);
+ if(!strncmpW(p, mhtml_separatorW, ARRAY_SIZE(mhtml_separatorW)))
+ p += ARRAY_SIZE(mhtml_separatorW);
else
p++;
}else {
@@ -657,7 +657,7 @@ static HRESULT WINAPI MimeHtmlProtocolInfo_CombineUrl(IInternetProtocolInfo *ifa
DWORD cchResult, DWORD* pcchResult, DWORD dwReserved)
{
MimeHtmlProtocol *This = impl_from_IInternetProtocolInfo(iface);
- size_t len = sizeof(mhtml_prefixW)/sizeof(WCHAR);
+ size_t len = ARRAY_SIZE(mhtml_prefixW);
mhtml_url_t url;
WCHAR *p;
HRESULT hres;
@@ -670,26 +670,26 @@ static HRESULT WINAPI MimeHtmlProtocolInfo_CombineUrl(IInternetProtocolInfo *ifa
if(FAILED(hres))
return hres;
- if(!strncmpiW(pwzRelativeUrl, mhtml_prefixW, sizeof(mhtml_prefixW)/sizeof(WCHAR))) {
+ if(!strncmpiW(pwzRelativeUrl, mhtml_prefixW, ARRAY_SIZE(mhtml_prefixW))) {
FIXME("Relative URL is mhtml protocol\n");
return INET_E_USE_DEFAULT_PROTOCOLHANDLER;
}
len += url.mhtml_len;
if(*pwzRelativeUrl)
- len += strlenW(pwzRelativeUrl) + sizeof(mhtml_separatorW)/sizeof(WCHAR);
+ len += strlenW(pwzRelativeUrl) + ARRAY_SIZE(mhtml_separatorW);
if(len >= cchResult) {
*pcchResult = 0;
return E_FAIL;
}
memcpy(pwzResult, mhtml_prefixW, sizeof(mhtml_prefixW));
- p = pwzResult + sizeof(mhtml_prefixW)/sizeof(WCHAR);
+ p = pwzResult + ARRAY_SIZE(mhtml_prefixW);
memcpy(p, url.mhtml, url.mhtml_len*sizeof(WCHAR));
p += url.mhtml_len;
if(*pwzRelativeUrl) {
memcpy(p, mhtml_separatorW, sizeof(mhtml_separatorW));
- p += sizeof(mhtml_separatorW)/sizeof(WCHAR);
+ p += ARRAY_SIZE(mhtml_separatorW);
strcpyW(p, pwzRelativeUrl);
}else {
*p = 0;
--
2.14.4

View File

@ -1,67 +0,0 @@
From 8b38172e836c44f5fd8ed98f7cb20702d0435d35 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 09:15:07 +0200
Subject: [PATCH] iphlpapi: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/iphlpapi/iphlpapi_main.c | 2 +-
dlls/iphlpapi/ipstats.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c
index 7911e9d8cf..7de70c9ef4 100644
--- a/dlls/iphlpapi/iphlpapi_main.c
+++ b/dlls/iphlpapi/iphlpapi_main.c
@@ -1717,7 +1717,7 @@ DWORD WINAPI GetIfEntry(PMIB_IFROW pIfRow)
*/
DWORD WINAPI GetIfEntry2( MIB_IF_ROW2 *row2 )
{
- DWORD ret, len = sizeof(row2->Description)/sizeof(row2->Description[0]);
+ DWORD ret, len = ARRAY_SIZE(row2->Description);
char buf[MAX_ADAPTER_NAME], *name;
MIB_IFROW row;
diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c
index 8f6720ea52..799d03d574 100644
--- a/dlls/iphlpapi/ipstats.c
+++ b/dlls/iphlpapi/ipstats.c
@@ -666,7 +666,7 @@ DWORD WINAPI GetIcmpStatisticsEx(PMIB_ICMP_EX stats, DWORD family)
continue;
}
- for (i = 0; i < sizeof(icmpinstatlist)/sizeof(icmpinstatlist[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(icmpinstatlist); i++)
{
if (!strcasecmp(buf, icmpinstatlist[i].name))
{
@@ -688,7 +688,7 @@ DWORD WINAPI GetIcmpStatisticsEx(PMIB_ICMP_EX stats, DWORD family)
continue;
}
- for (i = 0; i < sizeof(icmpoutstatlist)/sizeof(icmpoutstatlist[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(icmpoutstatlist); i++)
{
if (!strcasecmp(buf, icmpoutstatlist[i].name))
{
@@ -819,7 +819,7 @@ DWORD WINAPI GetIpStatisticsEx(PMIB_IPSTATS stats, DWORD family)
if ((ptr = strchr(value, '\n')))
*ptr='\0';
- for (i = 0; i < sizeof(ipstatlist)/sizeof(ipstatlist[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(ipstatlist); i++)
if (!strcasecmp(buf, ipstatlist[i].name))
{
if (sscanf(value, "%d", &res)) *ipstatlist[i].elem = res;
@@ -1209,7 +1209,7 @@ DWORD WINAPI GetUdpStatisticsEx(PMIB_UDPSTATS stats, DWORD family)
if ((ptr = strchr(value, '\n')))
*ptr='\0';
- for (i = 0; i < sizeof(udpstatlist)/sizeof(udpstatlist[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(udpstatlist); i++)
if (!strcasecmp(buf, udpstatlist[i].name))
{
if (sscanf(value, "%d", &res)) *udpstatlist[i].elem = res;
--
2.14.4

View File

@ -1,26 +0,0 @@
From 26098afa5665e6e3eb70d4560e2059ce97ae3a96 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 09:18:52 +0200
Subject: [PATCH] itss: Remove a superfluous variable initialization
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/itss/moniker.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/itss/moniker.c b/dlls/itss/moniker.c
index 0509c9e1a5..3315b914d3 100644
--- a/dlls/itss/moniker.c
+++ b/dlls/itss/moniker.c
@@ -287,7 +287,7 @@ static HRESULT WINAPI ITS_IMonikerImpl_GetDisplayName(
ITS_IMonikerImpl *This = impl_from_IMoniker(iface);
static const WCHAR szFormat[] = {
'm','s','-','i','t','s',':','%','s',':',':','%','s',0 };
- DWORD len = sizeof szFormat / sizeof(WCHAR);
+ DWORD len;
LPWSTR str;
TRACE("%p %p %p %p\n", iface, pbc, pmkToLeft, ppszDisplayName);
--
2.14.4

View File

@ -1,50 +0,0 @@
From 54586555e7ea3b721741b0937f6a909f9a58baf2 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 09:21:21 +0200
Subject: [PATCH] itss: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/itss/moniker.c | 2 +-
dlls/itss/protocol.c | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/itss/moniker.c b/dlls/itss/moniker.c
index 3315b914d3..6c61f47482 100644
--- a/dlls/itss/moniker.c
+++ b/dlls/itss/moniker.c
@@ -435,7 +435,7 @@ static HRESULT WINAPI ITS_IParseDisplayNameImpl_ParseDisplayName(
{
static const WCHAR szPrefix[] = {
'@','M','S','I','T','S','t','o','r','e',':',0 };
- const DWORD prefix_len = (sizeof szPrefix/sizeof szPrefix[0])-1;
+ const DWORD prefix_len = ARRAY_SIZE(szPrefix)-1;
DWORD n;
ITS_IParseDisplayNameImpl *This = impl_from_IParseDisplayName(iface);
diff --git a/dlls/itss/protocol.c b/dlls/itss/protocol.c
index 1cdb365002..a7c40077cc 100644
--- a/dlls/itss/protocol.c
+++ b/dlls/itss/protocol.c
@@ -153,12 +153,12 @@ static LPCWSTR skip_schema(LPCWSTR url)
static const WCHAR msits_schema[] = {'m','s','-','i','t','s',':'};
static const WCHAR mk_schema[] = {'m','k',':','@','M','S','I','T','S','t','o','r','e',':'};
- if(!strncmpiW(its_schema, url, sizeof(its_schema)/sizeof(WCHAR)))
- return url+sizeof(its_schema)/sizeof(WCHAR);
- if(!strncmpiW(msits_schema, url, sizeof(msits_schema)/sizeof(WCHAR)))
- return url+sizeof(msits_schema)/sizeof(WCHAR);
- if(!strncmpiW(mk_schema, url, sizeof(mk_schema)/sizeof(WCHAR)))
- return url+sizeof(mk_schema)/sizeof(WCHAR);
+ if(!strncmpiW(its_schema, url, ARRAY_SIZE(its_schema)))
+ return url + ARRAY_SIZE(its_schema);
+ if(!strncmpiW(msits_schema, url, ARRAY_SIZE(msits_schema)))
+ return url + ARRAY_SIZE(msits_schema);
+ if(!strncmpiW(mk_schema, url, ARRAY_SIZE(mk_schema)))
+ return url + ARRAY_SIZE(mk_schema);
return NULL;
}
--
2.14.4

View File

@ -1,44 +0,0 @@
From 8bf0cb26484dcfd57220fde43e6ff5d91aa86b26 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 11:27:34 +0200
Subject: [PATCH] attrib: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/attrib/attrib.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/programs/attrib/attrib.c b/programs/attrib/attrib.c
index a5742048bc..79a599aafd 100644
--- a/programs/attrib/attrib.c
+++ b/programs/attrib/attrib.c
@@ -36,7 +36,7 @@ static WCHAR *ATTRIB_LoadMessage(UINT id)
static WCHAR msg[MAXSTRING];
const WCHAR failedMsg[] = {'F', 'a', 'i', 'l', 'e', 'd', '!', 0};
- if (!LoadStringW(GetModuleHandleW(NULL), id, msg, sizeof(msg)/sizeof(WCHAR))) {
+ if (!LoadStringW(GetModuleHandleW(NULL), id, msg, ARRAY_SIZE(msg))) {
WINE_FIXME("LoadString failed with %d\n", GetLastError());
lstrcpyW(msg, failedMsg);
}
@@ -236,7 +236,7 @@ static BOOL ATTRIB_processdirectory(const WCHAR *rootdir, const WCHAR *filespec,
strcpyW(buffer, rootdir);
strcatW(buffer, fd.cFileName);
ATTRIB_wprintf(fmt, flags, buffer);
- for (count = 0; count < (sizeof(flags)/sizeof(WCHAR) - 1); count++) flags[count] = ' ';
+ for (count = 0; count < (ARRAY_SIZE(flags) - 1); count++) flags[count] = ' ';
found = TRUE;
}
} while (FindNextFileW(hff, &fd) != 0);
@@ -302,7 +302,7 @@ int wmain(int argc, WCHAR *argv[])
/* Name may be a relative or explicit path, so calculate curdir based on
current locations, stripping off the filename */
WINE_TRACE("Supplied name: '%s'\n", wine_dbgstr_w(originalname));
- GetFullPathNameW(originalname, sizeof(curdir)/sizeof(WCHAR), curdir, &namepart);
+ GetFullPathNameW(originalname, ARRAY_SIZE(curdir), curdir, &namepart);
WINE_TRACE("Result: '%s'\n", wine_dbgstr_w(curdir));
if (namepart) {
strcpyW(name, namepart);
--
2.14.4

View File

@ -1,58 +0,0 @@
From be9c79bb13ad9d354c458b5af5c4ea83edb2e29a Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 11:53:50 +0200
Subject: [PATCH] clock: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/clock/main.c | 4 ++--
programs/clock/winclock.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/programs/clock/main.c b/programs/clock/main.c
index 04bfe64424..3ad636be43 100644
--- a/programs/clock/main.c
+++ b/programs/clock/main.c
@@ -72,7 +72,7 @@ static VOID CLOCK_UpdateWindowCaption(VOID)
/* Set frame caption */
if (Globals.bDate) {
chars = GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, NULL, NULL,
- szCaption, sizeof(szCaption)/sizeof(WCHAR));
+ szCaption, ARRAY_SIZE(szCaption));
if (chars) {
--chars;
szCaption[chars++] = ' ';
@@ -255,7 +255,7 @@ static int CLOCK_MenuCommand (WPARAM wParam)
}
/* show "about" box */
case IDM_ABOUT: {
- LoadStringW(Globals.hInstance, IDS_CLOCK, szApp, sizeof(szApp)/sizeof(WCHAR));
+ LoadStringW(Globals.hInstance, IDS_CLOCK, szApp, ARRAY_SIZE(szApp));
lstrcpyW(szAppRelease,szApp);
ShellAboutW(Globals.hMainWnd, szApp, szAppRelease, 0);
break;
diff --git a/programs/clock/winclock.c b/programs/clock/winclock.c
index 0b2def11ab..53c3821d95 100644
--- a/programs/clock/winclock.c
+++ b/programs/clock/winclock.c
@@ -187,7 +187,7 @@ HFONT SizeFont(HDC dc, int x, int y, BOOL bSeconds, const LOGFONTW* font)
int chars;
chars = GetTimeFormatW(LOCALE_USER_DEFAULT, bSeconds ? 0 : TIME_NOSECONDS, NULL,
- NULL, szTime, sizeof(szTime)/sizeof(WCHAR));
+ NULL, szTime, ARRAY_SIZE(szTime));
if (!chars)
return 0;
@@ -219,7 +219,7 @@ void DigitalClock(HDC dc, int x, int y, BOOL bSeconds, HFONT font)
int chars;
chars = GetTimeFormatW(LOCALE_USER_DEFAULT, bSeconds ? 0 : TIME_NOSECONDS, NULL,
- NULL, szTime, sizeof(szTime)/sizeof(WCHAR));
+ NULL, szTime, ARRAY_SIZE(szTime));
if (!chars)
return;
--chars;
--
2.14.4

View File

@ -1,55 +0,0 @@
From 6efa8387411c9db492b2f965e9daf976abe04d40 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 13:14:34 +0200
Subject: [PATCH] hostname: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/hostname/hostname.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/programs/hostname/hostname.c b/programs/hostname/hostname.c
index 8bf8676a97..3e1f2bdda3 100644
--- a/programs/hostname/hostname.c
+++ b/programs/hostname/hostname.c
@@ -90,8 +90,7 @@ static int hostname_message_printfW(int msg, ...)
WCHAR msg_buffer[8192];
int len;
- LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer,
- sizeof(msg_buffer)/sizeof(WCHAR));
+ LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
va_start(va_args, msg);
len = hostname_vprintfW(msg_buffer, va_args);
@@ -105,8 +104,7 @@ static int hostname_message(int msg)
static const WCHAR formatW[] = {'%','s',0};
WCHAR msg_buffer[8192];
- LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer,
- sizeof(msg_buffer)/sizeof(WCHAR));
+ LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
return hostname_printfW(formatW, msg_buffer);
}
@@ -119,7 +117,7 @@ static void display_computer_name(void)
WCHAR nameW[256];
gethostname(nameA, sizeof(nameA));
- MultiByteToWideChar(CP_UNIXCP, 0, nameA, sizeof(nameA), nameW, sizeof(nameW)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_UNIXCP, 0, nameA, sizeof(nameA), nameW, ARRAY_SIZE(nameW));
hostname_printfW(fmtW, nameW);
}
@@ -132,7 +130,7 @@ int wmain(int argc, WCHAR *argv[])
unsigned int i;
- if (!strncmpW(argv[1], slashHelpW, sizeof(slashHelpW)/sizeof(WCHAR) - 1))
+ if (!strncmpW(argv[1], slashHelpW, ARRAY_SIZE(slashHelpW) - 1))
{
hostname_message(STRING_USAGE);
return 1;
--
2.14.4

View File

@ -1,26 +0,0 @@
From a11a1464b49a115d73c8b787ad2e55327f668c5e Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 16:40:31 +0200
Subject: [PATCH] icinfo: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/icinfo/icinfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/programs/icinfo/icinfo.c b/programs/icinfo/icinfo.c
index 601ec8c8b3..1059183361 100644
--- a/programs/icinfo/icinfo.c
+++ b/programs/icinfo/icinfo.c
@@ -33,7 +33,7 @@ static int mywprintf(const WCHAR *format, ...)
HANDLE hout = GetStdHandle(STD_OUTPUT_HANDLE);
va_start(parms, format);
- vsnprintfW(output_bufW, sizeof(output_bufW)/sizeof(output_bufW[0]), format, parms);
+ vsnprintfW(output_bufW, ARRAY_SIZE(output_bufW), format, parms);
va_end(parms);
/* Try to write as unicode whenever we think it's a console */
--
2.14.4

View File

@ -1,63 +0,0 @@
From a2a7e76379da5eaf1d521e95f9337661bb49ed84 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 17:01:22 +0200
Subject: [PATCH] net: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/net/net.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/programs/net/net.c b/programs/net/net.c
index d8123ebf97..8a4c3f1132 100644
--- a/programs/net/net.c
+++ b/programs/net/net.c
@@ -61,8 +61,7 @@ static int output_vprintf(const WCHAR* fmt, __ms_va_list va_args)
int len;
SetLastError(NO_ERROR);
- len = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, fmt, 0, 0, str,
- sizeof(str)/sizeof(*str), &va_args);
+ len = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, fmt, 0, 0, str, ARRAY_SIZE(str), &va_args);
if (len == 0 && GetLastError() != NO_ERROR)
WINE_FIXME("Could not format string: le=%u, fmt=%s\n", GetLastError(), wine_dbgstr_w(fmt));
else
@@ -85,7 +84,7 @@ static int WINAPIV output_string(int msg, ...)
WCHAR fmt[8192];
__ms_va_list arguments;
- LoadStringW(GetModuleHandleW(NULL), msg, fmt, sizeof(fmt)/sizeof(fmt[0]));
+ LoadStringW(GetModuleHandleW(NULL), msg, fmt, ARRAY_SIZE(fmt));
__ms_va_start(arguments, msg);
output_vprintf(fmt, arguments);
__ms_va_end(arguments);
@@ -119,7 +118,7 @@ static BOOL net_use(int argc, const WCHAR* argv[])
HMODULE hmod = GetModuleHandleW(NULL);
/* Load the status strings */
- for (i = 0; i < sizeof(status)/sizeof(*status); i++)
+ for (i = 0; i < ARRAY_SIZE(status); i++)
{
status[i] = HeapAlloc(GetProcessHeap(), 0, 1024 * sizeof(**status));
LoadStringW(hmod, STRING_OK+i, status[i], 1024);
@@ -147,7 +146,7 @@ static BOOL net_use(int argc, const WCHAR* argv[])
} while (rc == ERROR_MORE_DATA);
/* Release the status strings */
- for (i = 0; i < sizeof(status)/sizeof(*status); i++)
+ for (i = 0; i < ARRAY_SIZE(status); i++)
HeapFree(GetProcessHeap(), 0, status[i]);
return TRUE;
@@ -256,7 +255,7 @@ static BOOL net_service(int operation, const WCHAR* service_name)
return FALSE;
}
- buffer_size = sizeof(service_display_name)/sizeof(*service_display_name);
+ buffer_size = ARRAY_SIZE(service_display_name);
GetServiceDisplayNameW(SCManager, service_name, service_display_name, &buffer_size);
if (!service_display_name[0]) lstrcpyW(service_display_name, service_name);
--
2.14.4

View File

@ -1,46 +0,0 @@
From b9918474575b009cc132f5df5a7b29e839772d88 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 19:13:54 +0200
Subject: [PATCH] taskkill: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/taskkill/taskkill.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/programs/taskkill/taskkill.c b/programs/taskkill/taskkill.c
index 6e4e1eb55a..59ce98dc6d 100644
--- a/programs/taskkill/taskkill.c
+++ b/programs/taskkill/taskkill.c
@@ -47,7 +47,7 @@ static int taskkill_vprintfW(const WCHAR *msg, __ms_va_list va_args)
WCHAR msg_buffer[8192];
wlen = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, msg, 0, 0, msg_buffer,
- sizeof(msg_buffer)/sizeof(*msg_buffer), &va_args);
+ ARRAY_SIZE(msg_buffer), &va_args);
ret = WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), msg_buffer, wlen, &count, NULL);
if (!ret)
@@ -92,8 +92,7 @@ static int WINAPIV taskkill_message_printfW(int msg, ...)
WCHAR msg_buffer[8192];
int len;
- LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer,
- sizeof(msg_buffer)/sizeof(WCHAR));
+ LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
__ms_va_start(va_args, msg);
len = taskkill_vprintfW(msg_buffer, va_args);
@@ -107,8 +106,7 @@ static int taskkill_message(int msg)
static const WCHAR formatW[] = {'%','1',0};
WCHAR msg_buffer[8192];
- LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer,
- sizeof(msg_buffer)/sizeof(WCHAR));
+ LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
return taskkill_printfW(formatW, msg_buffer);
}
--
2.14.4

View File

@ -1,152 +0,0 @@
From 081705a865b159a13be0afe8235f8cc7b62a635f Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 19:18:13 +0200
Subject: [PATCH] ipconfig: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/ipconfig/ipconfig.c | 40 ++++++++++++++++++----------------------
1 file changed, 18 insertions(+), 22 deletions(-)
diff --git a/programs/ipconfig/ipconfig.c b/programs/ipconfig/ipconfig.c
index 936dfa2ea8..4370a28a44 100644
--- a/programs/ipconfig/ipconfig.c
+++ b/programs/ipconfig/ipconfig.c
@@ -35,7 +35,7 @@ static int ipconfig_vprintfW(const WCHAR *msg, __ms_va_list va_args)
WCHAR msg_buffer[8192];
wlen = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, msg, 0, 0, msg_buffer,
- sizeof(msg_buffer)/sizeof(*msg_buffer), &va_args);
+ ARRAY_SIZE(msg_buffer), &va_args);
ret = WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), msg_buffer, wlen, &count, NULL);
if (!ret)
@@ -80,8 +80,7 @@ static int WINAPIV ipconfig_message_printfW(int msg, ...)
WCHAR msg_buffer[8192];
int len;
- LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer,
- sizeof(msg_buffer)/sizeof(WCHAR));
+ LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
__ms_va_start(va_args, msg);
len = ipconfig_vprintfW(msg_buffer, va_args);
@@ -95,8 +94,7 @@ static int ipconfig_message(int msg)
static const WCHAR formatW[] = {'%','1',0};
WCHAR msg_buffer[8192];
- LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer,
- sizeof(msg_buffer)/sizeof(WCHAR));
+ LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
return ipconfig_printfW(formatW, msg_buffer);
}
@@ -118,8 +116,7 @@ static const WCHAR *iftype_to_string(DWORD type)
msg = STRING_UNKNOWN;
}
- LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer,
- sizeof(msg_buffer)/sizeof(WCHAR));
+ LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
return msg_buffer;
}
@@ -130,10 +127,10 @@ static void print_field(int msg, const WCHAR *value)
WCHAR field[] = {'.',' ','.',' ','.',' ','.',' ','.',' ','.',' ','.',' ','.',' ','.',
' ','.',' ','.',' ','.',' ','.',' ','.',' ','.',' ','.',' ','.',' ',0};
- WCHAR name_buffer[sizeof(field)/sizeof(WCHAR)];
+ WCHAR name_buffer[ARRAY_SIZE(field)];
- LoadStringW(GetModuleHandleW(NULL), msg, name_buffer, sizeof(name_buffer)/sizeof(WCHAR));
- memcpy(field, name_buffer, sizeof(WCHAR) * min(strlenW(name_buffer), sizeof(field)/sizeof(WCHAR) - 1));
+ LoadStringW(GetModuleHandleW(NULL), msg, name_buffer, ARRAY_SIZE(name_buffer));
+ memcpy(field, name_buffer, sizeof(WCHAR) * min(strlenW(name_buffer), ARRAY_SIZE(field) - 1));
ipconfig_printfW(formatW, field, value);
}
@@ -189,22 +186,22 @@ static void print_basic_information(void)
for (addr = p->FirstUnicastAddress; addr; addr = addr->Next)
{
if (addr->Address.lpSockaddr->sa_family == AF_INET &&
- socket_address_to_string(addr_buf, sizeof(addr_buf)/sizeof(WCHAR), &addr->Address))
+ socket_address_to_string(addr_buf, ARRAY_SIZE(addr_buf), &addr->Address))
print_field(STRING_IP_ADDRESS, addr_buf);
else if (addr->Address.lpSockaddr->sa_family == AF_INET6 &&
- socket_address_to_string(addr_buf, sizeof(addr_buf)/sizeof(WCHAR), &addr->Address))
+ socket_address_to_string(addr_buf, ARRAY_SIZE(addr_buf), &addr->Address))
print_field(STRING_IP6_ADDRESS, addr_buf);
/* FIXME: Output corresponding subnet mask. */
}
if (p->FirstGatewayAddress)
{
- if (socket_address_to_string(addr_buf, sizeof(addr_buf)/sizeof(WCHAR), &p->FirstGatewayAddress->Address))
+ if (socket_address_to_string(addr_buf, ARRAY_SIZE(addr_buf), &p->FirstGatewayAddress->Address))
print_field(STRING_DEFAULT_GATEWAY, addr_buf);
for (gateway = p->FirstGatewayAddress->Next; gateway; gateway = gateway->Next)
{
- if (socket_address_to_string(addr_buf, sizeof(addr_buf)/sizeof(WCHAR), &gateway->Address))
+ if (socket_address_to_string(addr_buf, ARRAY_SIZE(addr_buf), &gateway->Address))
print_value(addr_buf);
}
}
@@ -243,8 +240,7 @@ static const WCHAR *nodetype_to_string(DWORD type)
msg = STRING_UNKNOWN;
}
- LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer,
- sizeof(msg_buffer)/sizeof(WCHAR));
+ LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
return msg_buffer;
}
@@ -277,7 +273,7 @@ static const WCHAR *boolean_to_string(int value)
static WCHAR msg_buffer[15];
LoadStringW(GetModuleHandleW(NULL), value ? STRING_YES : STRING_NO,
- msg_buffer, sizeof(msg_buffer)/sizeof(WCHAR));
+ msg_buffer, ARRAY_SIZE(msg_buffer));
return msg_buffer;
}
@@ -301,7 +297,7 @@ static void print_full_information(void)
{
WCHAR hostnameW[MAX_HOSTNAME_LEN + 4];
- MultiByteToWideChar(CP_ACP, 0, info->HostName, -1, hostnameW, sizeof(hostnameW)/sizeof(hostnameW[0]));
+ MultiByteToWideChar(CP_ACP, 0, info->HostName, -1, hostnameW, ARRAY_SIZE(hostnameW));
print_field(STRING_HOSTNAME, hostnameW);
/* FIXME: Output primary DNS suffix. */
@@ -348,22 +344,22 @@ static void print_full_information(void)
for (addr = p->FirstUnicastAddress; addr; addr = addr->Next)
{
if (addr->Address.lpSockaddr->sa_family == AF_INET &&
- socket_address_to_string(addr_buf, sizeof(addr_buf)/sizeof(WCHAR), &addr->Address))
+ socket_address_to_string(addr_buf, ARRAY_SIZE(addr_buf), &addr->Address))
print_field(STRING_IP_ADDRESS, addr_buf);
else if (addr->Address.lpSockaddr->sa_family == AF_INET6 &&
- socket_address_to_string(addr_buf, sizeof(addr_buf)/sizeof(WCHAR), &addr->Address))
+ socket_address_to_string(addr_buf, ARRAY_SIZE(addr_buf), &addr->Address))
print_field(STRING_IP6_ADDRESS, addr_buf);
/* FIXME: Output corresponding subnet mask. */
}
if (p->FirstGatewayAddress)
{
- if (socket_address_to_string(addr_buf, sizeof(addr_buf)/sizeof(WCHAR), &p->FirstGatewayAddress->Address))
+ if (socket_address_to_string(addr_buf, ARRAY_SIZE(addr_buf), &p->FirstGatewayAddress->Address))
print_field(STRING_DEFAULT_GATEWAY, addr_buf);
for (gateway = p->FirstGatewayAddress->Next; gateway; gateway = gateway->Next)
{
- if (socket_address_to_string(addr_buf, sizeof(addr_buf)/sizeof(WCHAR), &gateway->Address))
+ if (socket_address_to_string(addr_buf, ARRAY_SIZE(addr_buf), &gateway->Address))
print_value(addr_buf);
}
}
--
2.14.4

View File

@ -1,31 +0,0 @@
From 3c68cac0e75c47c9bc0c3e0265d37d42668af0c7 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 19:19:29 +0200
Subject: [PATCH] msiexec: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/msiexec/msiexec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/programs/msiexec/msiexec.c b/programs/msiexec/msiexec.c
index 5a471a2184..47cef7e0fa 100644
--- a/programs/msiexec/msiexec.c
+++ b/programs/msiexec/msiexec.c
@@ -71,11 +71,11 @@ static void ShowUsage(int ExitCode)
/* MsiGetFileVersion need the full path */
*filename = 0;
- res = GetModuleFileNameW(hmsi, filename, sizeof(filename) / sizeof(filename[0]));
+ res = GetModuleFileNameW(hmsi, filename, ARRAY_SIZE(filename));
if (!res)
WINE_ERR("GetModuleFileName failed: %d\n", GetLastError());
- len = sizeof(msiexec_version) / sizeof(msiexec_version[0]);
+ len = ARRAY_SIZE(msiexec_version);
*msiexec_version = 0;
res = MsiGetFileVersionW(filename, msiexec_version, &len, NULL, NULL);
if (res)
--
2.14.4

View File

@ -1,505 +0,0 @@
From 18a03a7294b0cfb4155cd128eb0c45fb07352b1b Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 19:38:53 +0200
Subject: [PATCH] taskmgr: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/taskmgr/about.c | 2 +-
programs/taskmgr/affinity.c | 16 +++++++--------
programs/taskmgr/applpage.c | 14 ++++++-------
programs/taskmgr/column.c | 50 ++++++++++++++++++++++-----------------------
programs/taskmgr/dbgchnl.c | 8 ++++----
programs/taskmgr/debug.c | 16 +++++++--------
programs/taskmgr/endproc.c | 14 ++++++-------
programs/taskmgr/perfdata.c | 2 +-
programs/taskmgr/perfpage.c | 4 ++--
programs/taskmgr/priority.c | 10 ++++-----
programs/taskmgr/procpage.c | 4 ++--
programs/taskmgr/taskmgr.c | 32 ++++++++++++++---------------
programs/taskmgr/trayicon.c | 6 +++---
13 files changed, 88 insertions(+), 90 deletions(-)
diff --git a/programs/taskmgr/about.c b/programs/taskmgr/about.c
index c625139645..1eff50f003 100644
--- a/programs/taskmgr/about.c
+++ b/programs/taskmgr/about.c
@@ -36,7 +36,7 @@ void OnAbout(void)
WCHAR copy[] = {'B','r','i','a','n',' ',
'P','a','l','m','e','r',' ',
'<','b','r','i','a','n','p','@','r','e','a','c','t','o','s','.','o','r','g','>',0};
- LoadStringW( hInst, IDC_TASKMGR, appname, sizeof(appname)/sizeof(WCHAR) );
+ LoadStringW( hInst, IDC_TASKMGR, appname, ARRAY_SIZE( appname ));
ShellAboutW( hMainWnd, appname, copy,
LoadImageA( hInst, (LPSTR)IDI_TASKMANAGER, IMAGE_ICON, 48, 48, LR_SHARED ));
}
diff --git a/programs/taskmgr/affinity.c b/programs/taskmgr/affinity.c
index c195a2d7ce..4e33f50d4f 100644
--- a/programs/taskmgr/affinity.c
+++ b/programs/taskmgr/affinity.c
@@ -51,9 +51,9 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
* the number of CPUs present in the system
*/
if (!GetProcessAffinityMask(hProcessAffinityHandle, &dwProcessAffinityMask, &dwSystemAffinityMask)) {
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
EndDialog(hDlg, 0);
- LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, sizeof(wszUnable2Access)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, ARRAY_SIZE(wszUnable2Access));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Access, MB_OK|MB_ICONSTOP);
}
@@ -291,8 +291,8 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
if (!dwProcessAffinityMask) {
WCHAR wszErrorMsg[255];
WCHAR wszErrorTitle[255];
- LoadStringW(hInst, IDS_AFFINITY_ERROR_MESSAGE, wszErrorMsg, sizeof(wszErrorMsg)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_AFFINITY_ERROR_TITLE, wszErrorTitle, sizeof(wszErrorTitle)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_AFFINITY_ERROR_MESSAGE, wszErrorMsg, ARRAY_SIZE(wszErrorMsg));
+ LoadStringW(hInst, IDS_AFFINITY_ERROR_TITLE, wszErrorTitle, ARRAY_SIZE(wszErrorTitle));
MessageBoxW(hDlg, wszErrorMsg, wszErrorTitle, MB_OK|MB_ICONSTOP);
return TRUE;
}
@@ -301,9 +301,9 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
* Try to set the process affinity
*/
if (!SetProcessAffinityMask(hProcessAffinityHandle, dwProcessAffinityMask)) {
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
EndDialog(hDlg, LOWORD(wParam));
- LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, sizeof(wszUnable2Access)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, ARRAY_SIZE(wszUnable2Access));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Access, MB_OK|MB_ICONSTOP);
}
@@ -341,8 +341,8 @@ void ProcessPage_OnSetAffinity(void)
return;
hProcessAffinityHandle = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_SET_INFORMATION, FALSE, dwProcessId);
if (!hProcessAffinityHandle) {
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, sizeof(wszUnable2Access)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
+ LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, ARRAY_SIZE(wszUnable2Access));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Access, MB_OK|MB_ICONSTOP);
return;
}
diff --git a/programs/taskmgr/applpage.c b/programs/taskmgr/applpage.c
index e2874b5943..ae881b530c 100644
--- a/programs/taskmgr/applpage.c
+++ b/programs/taskmgr/applpage.c
@@ -249,10 +249,8 @@ static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
return TRUE;
/* Check and see if this is a top-level app window */
- if (!GetWindowTextW(hWnd, wszText, sizeof(wszText)/sizeof(WCHAR)) ||
- !IsWindowVisible(hWnd) ||
- (GetParent(hWnd) != NULL) ||
- (GetWindow(hWnd, GW_OWNER) != NULL) ||
+ if (!GetWindowTextW(hWnd, wszText, ARRAY_SIZE(wszText)) || !IsWindowVisible(hWnd) ||
+ (GetParent(hWnd) != NULL) || (GetWindow(hWnd, GW_OWNER) != NULL) ||
(GetWindowLongW(hWnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW))
{
return TRUE; /* Skip this window */
@@ -415,8 +413,8 @@ static void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam)
WCHAR wszNotResponding[255];
WCHAR wszRunning[255];
- LoadStringW(hInst, IDS_APPLICATION_NOT_RESPONDING, wszNotResponding, sizeof(wszNotResponding)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_APPLICATION_RUNNING, wszRunning, sizeof(wszRunning)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_APPLICATION_NOT_RESPONDING, wszNotResponding, ARRAY_SIZE(wszNotResponding));
+ LoadStringW(hInst, IDS_APPLICATION_RUNNING, wszRunning, ARRAY_SIZE(wszRunning));
pnmh = (LPNMHDR) lParam;
pnmdi = (LV_DISPINFOW*) lParam;
@@ -842,8 +840,8 @@ ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
WCHAR wszTask[255];
WCHAR wszStatus[255];
- LoadStringW(hInst, IDS_APPLICATION_TASK, wszTask, sizeof(wszTask)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_APPLICATION_STATUS, wszStatus, sizeof(wszStatus)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_APPLICATION_TASK, wszTask, ARRAY_SIZE(wszTask));
+ LoadStringW(hInst, IDS_APPLICATION_STATUS, wszStatus, ARRAY_SIZE(wszStatus));
switch (message) {
case WM_INITDIALOG:
diff --git a/programs/taskmgr/column.c b/programs/taskmgr/column.c
index 35ba2a0b94..27c5926b5b 100644
--- a/programs/taskmgr/column.c
+++ b/programs/taskmgr/column.c
@@ -63,31 +63,31 @@ static WCHAR wszIOOtherBytes[255];
static void load_column_headers(void)
{
- LoadStringW(hInst, IDS_IMAGENAME, wszImageName, sizeof(wszImageName)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_PID, wszPID, sizeof(wszPID)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_USERNAME, wszUserName, sizeof(wszUserName)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_SESSIONID, wszSessionID, sizeof(wszSessionID)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_CPUUSAGE, wszCPU, sizeof(wszCPU)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_CPUTIME, wszCPUTime, sizeof(wszCPUTime)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_MEMORYUSAGE, wszMemUsage, sizeof(wszMemUsage)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_PEAKMEMORYUSAGE, wszPeakMemUsage, sizeof(wszPeakMemUsage)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_MEMORYUSAGEDELTA, wszMemDelta, sizeof(wszMemDelta)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_PAGEFAULTS, wszPageFaults, sizeof(wszPageFaults)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_PAGEFAULTSDELTA, wszPFDelta, sizeof(wszPFDelta)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_VIRTUALMEMORYSIZE, wszVMSize, sizeof(wszVMSize)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_PAGEDPOOL, wszPagedPool, sizeof(wszPagedPool)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_NONPAGEDPOOL, wszNPPool, sizeof(wszNPPool)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_BASEPRIORITY, wszBasePri, sizeof(wszBasePri)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_HANDLECOUNT, wszHandles, sizeof(wszHandles)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_THREADCOUNT, wszThreads, sizeof(wszThreads)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_USEROBJECTS, wszUSERObjects, sizeof(wszUSERObjects)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_GDIOBJECTS, wszGDIObjects, sizeof(wszGDIObjects)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_IOREADS, wszIOReads, sizeof(wszIOReads)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_IOWRITES, wszIOWrites, sizeof(wszIOWrites)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_IOOTHER, wszIOOther, sizeof(wszIOOther)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_IOREADBYTES, wszIOReadBytes, sizeof(wszIOReadBytes)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_IOWRITEBYTES, wszIOWriteBytes, sizeof(wszIOWriteBytes)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_IOOTHERBYTES, wszIOOtherBytes, sizeof(wszIOOtherBytes)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_IMAGENAME, wszImageName, ARRAY_SIZE(wszImageName));
+ LoadStringW(hInst, IDS_PID, wszPID, ARRAY_SIZE(wszPID));
+ LoadStringW(hInst, IDS_USERNAME, wszUserName, ARRAY_SIZE(wszUserName));
+ LoadStringW(hInst, IDS_SESSIONID, wszSessionID, ARRAY_SIZE(wszSessionID));
+ LoadStringW(hInst, IDS_CPUUSAGE, wszCPU, ARRAY_SIZE(wszCPU));
+ LoadStringW(hInst, IDS_CPUTIME, wszCPUTime, ARRAY_SIZE(wszCPUTime));
+ LoadStringW(hInst, IDS_MEMORYUSAGE, wszMemUsage, ARRAY_SIZE(wszMemUsage));
+ LoadStringW(hInst, IDS_PEAKMEMORYUSAGE, wszPeakMemUsage, ARRAY_SIZE(wszPeakMemUsage));
+ LoadStringW(hInst, IDS_MEMORYUSAGEDELTA, wszMemDelta, ARRAY_SIZE(wszMemDelta));
+ LoadStringW(hInst, IDS_PAGEFAULTS, wszPageFaults, ARRAY_SIZE(wszPageFaults));
+ LoadStringW(hInst, IDS_PAGEFAULTSDELTA, wszPFDelta, ARRAY_SIZE(wszPFDelta));
+ LoadStringW(hInst, IDS_VIRTUALMEMORYSIZE, wszVMSize, ARRAY_SIZE(wszVMSize));
+ LoadStringW(hInst, IDS_PAGEDPOOL, wszPagedPool, ARRAY_SIZE(wszPagedPool));
+ LoadStringW(hInst, IDS_NONPAGEDPOOL, wszNPPool, ARRAY_SIZE(wszNPPool));
+ LoadStringW(hInst, IDS_BASEPRIORITY, wszBasePri, ARRAY_SIZE(wszBasePri));
+ LoadStringW(hInst, IDS_HANDLECOUNT, wszHandles, ARRAY_SIZE(wszHandles));
+ LoadStringW(hInst, IDS_THREADCOUNT, wszThreads, ARRAY_SIZE(wszThreads));
+ LoadStringW(hInst, IDS_USEROBJECTS, wszUSERObjects, ARRAY_SIZE(wszUSERObjects));
+ LoadStringW(hInst, IDS_GDIOBJECTS, wszGDIObjects, ARRAY_SIZE(wszGDIObjects));
+ LoadStringW(hInst, IDS_IOREADS, wszIOReads, ARRAY_SIZE(wszIOReads));
+ LoadStringW(hInst, IDS_IOWRITES, wszIOWrites, ARRAY_SIZE(wszIOWrites));
+ LoadStringW(hInst, IDS_IOOTHER, wszIOOther, ARRAY_SIZE(wszIOOther));
+ LoadStringW(hInst, IDS_IOREADBYTES, wszIOReadBytes, ARRAY_SIZE(wszIOReadBytes));
+ LoadStringW(hInst, IDS_IOWRITEBYTES, wszIOWriteBytes, ARRAY_SIZE(wszIOWriteBytes));
+ LoadStringW(hInst, IDS_IOOTHERBYTES, wszIOOtherBytes, ARRAY_SIZE(wszIOOtherBytes));
}
static int InsertColumn(int nCol, LPCWSTR lpszColumnHeading, int nFormat, int nWidth, int nSubItem)
diff --git a/programs/taskmgr/dbgchnl.c b/programs/taskmgr/dbgchnl.c
index 6e2dea0e14..7200eb476c 100644
--- a/programs/taskmgr/dbgchnl.c
+++ b/programs/taskmgr/dbgchnl.c
@@ -113,7 +113,7 @@ static int list_channel_CB(HANDLE hProcess, void* addr, struct __wine_debug_
int index;
HWND hChannelLV = user;
- MultiByteToWideChar(CP_ACP, 0, channel->name, sizeof(channel->name), nameW, sizeof(nameW)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, channel->name, sizeof(channel->name), nameW, ARRAY_SIZE(nameW));
lvitem.mask = LVIF_TEXT;
lvitem.pszText = nameW;
@@ -231,7 +231,7 @@ static void DebugChannels_OnCreate(HWND hwndDlg)
LVCOLUMNW lvc;
WCHAR debug_channelW[255];
- LoadStringW(hInst, IDS_DEBUG_CHANNEL, debug_channelW, sizeof(debug_channelW)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_DEBUG_CHANNEL, debug_channelW, ARRAY_SIZE(debug_channelW));
lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
lvc.fmt = LVCFMT_LEFT;
@@ -293,8 +293,8 @@ static void DebugChannels_OnNotify(HWND hDlg, LPARAM lParam)
unsigned bitmask = 1 << (lhti.iSubItem - 1);
struct cce_user user;
- ListView_GetItemTextA(hChannelLV, lhti.iItem, 0, name, sizeof(name) / sizeof(name[0]));
- ListView_GetItemTextW(hChannelLV, lhti.iItem, lhti.iSubItem, val, sizeof(val) / sizeof(val[0]));
+ ListView_GetItemTextA(hChannelLV, lhti.iItem, 0, name, ARRAY_SIZE(name));
+ ListView_GetItemTextW(hChannelLV, lhti.iItem, lhti.iSubItem, val, ARRAY_SIZE(val));
user.name = name;
user.value = (val[0] == 'x') ? 0 : bitmask;
user.mask = bitmask;
diff --git a/programs/taskmgr/debug.c b/programs/taskmgr/debug.c
index 10fa912feb..ceb27d11f9 100644
--- a/programs/taskmgr/debug.c
+++ b/programs/taskmgr/debug.c
@@ -57,9 +57,9 @@ void ProcessPage_OnDebug(void)
'A','e','D','e','b','u','g',0};
static const WCHAR wszDebugger[] = {'D','e','b','u','g','g','e','r',0};
- LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, sizeof(wszWarnTitle)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_DEBUG_UNABLE2DEBUG, wszUnable2Debug, sizeof(wszUnable2Debug)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_DEBUG_MESSAGE, wszWarnMsg, sizeof(wszWarnMsg)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, ARRAY_SIZE(wszWarnTitle));
+ LoadStringW(hInst, IDS_DEBUG_UNABLE2DEBUG, wszUnable2Debug, ARRAY_SIZE(wszUnable2Debug));
+ LoadStringW(hInst, IDS_DEBUG_MESSAGE, wszWarnMsg, ARRAY_SIZE(wszWarnMsg));
Count = SendMessageW(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0);
for (Index=0; Index<Count; Index++)
@@ -82,14 +82,14 @@ void ProcessPage_OnDebug(void)
if (MessageBoxW(hMainWnd, wszWarnMsg, wszWarnTitle, MB_YESNO|MB_ICONWARNING) != IDYES)
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP);
return;
}
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wszSubKey, 0, KEY_READ, &hKey) != ERROR_SUCCESS)
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP);
return;
}
@@ -97,7 +97,7 @@ void ProcessPage_OnDebug(void)
dwDebuggerSize = 260;
if (RegQueryValueExW(hKey, wszDebugger, NULL, NULL, (LPBYTE)wstrDebugger, &dwDebuggerSize) != ERROR_SUCCESS)
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP);
RegCloseKey(hKey);
return;
@@ -108,7 +108,7 @@ void ProcessPage_OnDebug(void)
hDebugEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
if (!hDebugEvent)
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP);
return;
}
@@ -120,7 +120,7 @@ void ProcessPage_OnDebug(void)
si.cb = sizeof(STARTUPINFOW);
if (!CreateProcessW(NULL, wstrDebugPath, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP);
}
diff --git a/programs/taskmgr/endproc.c b/programs/taskmgr/endproc.c
index 89c2d7bf80..7ed5ff08c6 100644
--- a/programs/taskmgr/endproc.c
+++ b/programs/taskmgr/endproc.c
@@ -38,9 +38,9 @@ static WCHAR wszUnable2Terminate[255];
static void load_message_strings(void)
{
- LoadStringW(hInst, IDS_TERMINATE_MESSAGE, wszWarnMsg, sizeof(wszWarnMsg)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_TERMINATE_UNABLE2TERMINATE, wszUnable2Terminate, sizeof(wszUnable2Terminate)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, sizeof(wszWarnTitle)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_TERMINATE_MESSAGE, wszWarnMsg, ARRAY_SIZE(wszWarnMsg));
+ LoadStringW(hInst, IDS_TERMINATE_UNABLE2TERMINATE, wszUnable2Terminate, ARRAY_SIZE(wszUnable2Terminate));
+ LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, ARRAY_SIZE(wszWarnTitle));
}
void ProcessPage_OnEndProcess(void)
@@ -79,14 +79,14 @@ void ProcessPage_OnEndProcess(void)
if (!hProcess)
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText,wszUnable2Terminate, MB_OK|MB_ICONSTOP);
return;
}
if (!TerminateProcess(hProcess, 0))
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText,wszUnable2Terminate, MB_OK|MB_ICONSTOP);
}
@@ -129,14 +129,14 @@ void ProcessPage_OnEndProcessTree(void)
if (!hProcess)
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText,wszUnable2Terminate, MB_OK|MB_ICONSTOP);
return;
}
if (!TerminateProcess(hProcess, 0))
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText,wszUnable2Terminate, MB_OK|MB_ICONSTOP);
}
diff --git a/programs/taskmgr/perfdata.c b/programs/taskmgr/perfdata.c
index aa19914d61..f86d52159f 100644
--- a/programs/taskmgr/perfdata.c
+++ b/programs/taskmgr/perfdata.c
@@ -248,7 +248,7 @@ void PerfDataRefresh(void)
else
{
WCHAR idleW[255];
- LoadStringW(hInst, IDS_SYSTEM_IDLE_PROCESS, idleW, sizeof(idleW)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_SYSTEM_IDLE_PROCESS, idleW, ARRAY_SIZE(idleW));
lstrcpyW(pPerfData[Idx].ImageName, idleW );
}
diff --git a/programs/taskmgr/perfpage.c b/programs/taskmgr/perfpage.c
index 3969ce41a2..63fb009eda 100644
--- a/programs/taskmgr/perfpage.c
+++ b/programs/taskmgr/perfpage.c
@@ -141,7 +141,7 @@ static DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
static const WCHAR wszFormatDigit[] = {'%','u',0};
WCHAR wszMemUsage[255];
- LoadStringW(hInst, IDS_STATUS_BAR_MEMORY_USAGE, wszMemUsage, sizeof(wszMemUsage)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_STATUS_BAR_MEMORY_USAGE, wszMemUsage, ARRAY_SIZE(wszMemUsage));
/* Create the event */
hPerformancePageEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
@@ -190,7 +190,7 @@ static DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
args[1] = CommitChargeLimit;
FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY,
wszMemUsage, 0, 0, Text,
- sizeof(Text)/sizeof(*Text), (__ms_va_list*)args);
+ ARRAY_SIZE(Text), (__ms_va_list*)args);
SendMessageW(hStatusWnd, SB_SETTEXTW, 2, (LPARAM)Text);
/*
diff --git a/programs/taskmgr/priority.c b/programs/taskmgr/priority.c
index 577a1aee14..90323db0c4 100644
--- a/programs/taskmgr/priority.c
+++ b/programs/taskmgr/priority.c
@@ -44,9 +44,9 @@ static void DoSetPriority(DWORD priority)
WCHAR wszWarnTitle[255];
WCHAR wszUnable2Change[255];
- LoadStringW(hInst, IDS_PRIORITY_CHANGE_MESSAGE, wszWarnMsg, sizeof(wszWarnMsg)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, sizeof(wszWarnTitle)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_PRIORITY_UNABLE2CHANGE, wszUnable2Change, sizeof(wszUnable2Change)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_PRIORITY_CHANGE_MESSAGE, wszWarnMsg, ARRAY_SIZE(wszWarnMsg));
+ LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, ARRAY_SIZE(wszWarnTitle));
+ LoadStringW(hInst, IDS_PRIORITY_UNABLE2CHANGE, wszUnable2Change, ARRAY_SIZE(wszUnable2Change));
Count = SendMessageW(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0);
for (Index=0; Index<Count; Index++)
@@ -74,14 +74,14 @@ static void DoSetPriority(DWORD priority)
if (!hProcess)
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Change, MB_OK|MB_ICONSTOP);
return;
}
if (!SetPriorityClass(hProcess, priority))
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Change, MB_OK|MB_ICONSTOP);
}
diff --git a/programs/taskmgr/procpage.c b/programs/taskmgr/procpage.c
index beccd86e5f..5ea2e6b044 100644
--- a/programs/taskmgr/procpage.c
+++ b/programs/taskmgr/procpage.c
@@ -384,8 +384,8 @@ static DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
WCHAR wszCPU_Usage[255];
WCHAR wszProcesses[255];
- LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, sizeof(wszCPU_Usage)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_STATUS_BAR_PROCESSES, wszProcesses, sizeof(wszProcesses)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, ARRAY_SIZE(wszCPU_Usage));
+ LoadStringW(hInst, IDS_STATUS_BAR_PROCESSES, wszProcesses, ARRAY_SIZE(wszProcesses));
/* Create the event */
hProcessPageEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
diff --git a/programs/taskmgr/taskmgr.c b/programs/taskmgr/taskmgr.c
index b280f7975d..1983d4d443 100644
--- a/programs/taskmgr/taskmgr.c
+++ b/programs/taskmgr/taskmgr.c
@@ -122,9 +122,9 @@ static BOOL OnCreate(HWND hWnd)
static WCHAR wszProcesses[255];
static WCHAR wszPerformance[255];
- LoadStringW(hInst, IDS_APPLICATIONS, wszApplications, sizeof(wszApplications)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_PROCESSES, wszProcesses, sizeof(wszProcesses)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_PERFORMANCE, wszPerformance, sizeof(wszPerformance)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_APPLICATIONS, wszApplications, ARRAY_SIZE(wszApplications));
+ LoadStringW(hInst, IDS_PROCESSES, wszProcesses, ARRAY_SIZE(wszProcesses));
+ LoadStringW(hInst, IDS_PERFORMANCE, wszPerformance, ARRAY_SIZE(wszPerformance));
SendMessageW(hMainWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIconW(hInst, MAKEINTRESOURCEW(IDI_TASKMANAGER)));
SendMessageW(hMainWnd, WM_SETICON, ICON_SMALL,
@@ -501,8 +501,8 @@ static void TaskManager_OnExitMenuLoop(HWND hWnd)
WCHAR wszCPU_Usage[255];
WCHAR wszProcesses[255];
- LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, sizeof(wszCPU_Usage)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_STATUS_BAR_PROCESSES, wszProcesses, sizeof(wszProcesses)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, ARRAY_SIZE(wszCPU_Usage));
+ LoadStringW(hInst, IDS_STATUS_BAR_PROCESSES, wszProcesses, ARRAY_SIZE(wszProcesses));
bInMenuLoop = FALSE;
/* Update the status bar pane sizes */
@@ -522,7 +522,7 @@ static void TaskManager_OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU
{
WCHAR wstr[256] = {0};
- LoadStringW(hInst, nItemID, wstr, sizeof(wstr)/sizeof(WCHAR));
+ LoadStringW(hInst, nItemID, wstr, ARRAY_SIZE(wstr));
SendMessageW(hStatusWnd, SB_SETTEXTW, 0, (LPARAM)wstr);
}
@@ -610,16 +610,16 @@ static void TaskManager_OnTabWndSelChange(void)
WCHAR wszCPUHistory[255];
WCHAR wszShowKernelTimes[255];
- LoadStringW(hInst, IDS_VIEW_LARGE, wszLargeIcons, sizeof(wszLargeIcons)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_VIEW_SMALL, wszSmallIcons, sizeof(wszSmallIcons)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_VIEW_DETAILS, wszDetails, sizeof(wszDetails)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_WINDOWS, wszWindows, sizeof(wszWindows)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_VIEW_SELECTCOLUMNS, wszSelectColumns, sizeof(wszSelectColumns)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_OPTIONS_SHOW16BITTASKS, wszShow16bTasks, sizeof(wszShow16bTasks)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_VIEW_CPUHISTORY_ONEGRAPHALL, wszOneGraphAllCPU, sizeof(wszOneGraphAllCPU)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_VIEW_CPUHISTORY_ONEGRAPHPERCPU, wszOneGraphPerCPU, sizeof(wszOneGraphPerCPU)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_VIEW_CPUHISTORY, wszCPUHistory, sizeof(wszCPUHistory)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_VIEW_SHOWKERNELTIMES, wszShowKernelTimes, sizeof(wszShowKernelTimes)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_VIEW_LARGE, wszLargeIcons, ARRAY_SIZE(wszLargeIcons));
+ LoadStringW(hInst, IDS_VIEW_SMALL, wszSmallIcons, ARRAY_SIZE(wszSmallIcons));
+ LoadStringW(hInst, IDS_VIEW_DETAILS, wszDetails, ARRAY_SIZE(wszDetails));
+ LoadStringW(hInst, IDS_WINDOWS, wszWindows, ARRAY_SIZE(wszWindows));
+ LoadStringW(hInst, IDS_VIEW_SELECTCOLUMNS, wszSelectColumns, ARRAY_SIZE(wszSelectColumns));
+ LoadStringW(hInst, IDS_OPTIONS_SHOW16BITTASKS, wszShow16bTasks, ARRAY_SIZE(wszShow16bTasks));
+ LoadStringW(hInst, IDS_VIEW_CPUHISTORY_ONEGRAPHALL, wszOneGraphAllCPU, ARRAY_SIZE(wszOneGraphAllCPU));
+ LoadStringW(hInst, IDS_VIEW_CPUHISTORY_ONEGRAPHPERCPU, wszOneGraphPerCPU, ARRAY_SIZE(wszOneGraphPerCPU));
+ LoadStringW(hInst, IDS_VIEW_CPUHISTORY, wszCPUHistory, ARRAY_SIZE(wszCPUHistory));
+ LoadStringW(hInst, IDS_VIEW_SHOWKERNELTIMES, wszShowKernelTimes, ARRAY_SIZE(wszShowKernelTimes));
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
diff --git a/programs/taskmgr/trayicon.c b/programs/taskmgr/trayicon.c
index af98474c24..b814e8c7c0 100644
--- a/programs/taskmgr/trayicon.c
+++ b/programs/taskmgr/trayicon.c
@@ -140,7 +140,7 @@ BOOL TrayIcon_ShellAddTrayIcon(void)
BOOL bRetVal;
WCHAR wszCPU_Usage[255];
- LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, sizeof(wszCPU_Usage)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, ARRAY_SIZE(wszCPU_Usage));
memset(&nid, 0, sizeof(NOTIFYICONDATAW));
@@ -187,8 +187,8 @@ BOOL TrayIcon_ShellUpdateTrayIcon(void)
BOOL bRetVal;
WCHAR wszCPU_Usage[255];
- LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, sizeof(wszCPU_Usage)/sizeof(WCHAR));
-
+ LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, ARRAY_SIZE(wszCPU_Usage));
+
memset(&nid, 0, sizeof(NOTIFYICONDATAW));
hIcon = TrayIcon_GetProcessorUsageIcon();
--
2.14.4

View File

@ -1,37 +0,0 @@
From 1c97d42e6271b8f81a3561d2480a4877014d5fd3 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Tue, 24 Jul 2018 15:35:50 +0200
Subject: [PATCH] uninstaller: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/uninstaller/main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/programs/uninstaller/main.c b/programs/uninstaller/main.c
index 736593e27d..142d3d16f7 100644
--- a/programs/uninstaller/main.c
+++ b/programs/uninstaller/main.c
@@ -102,7 +102,7 @@ static void WINAPIV output_message(unsigned int id, ...)
WCHAR fmt[1024];
__ms_va_list va_args;
- if (!LoadStringW(GetModuleHandleW(NULL), id, fmt, sizeof(fmt)/sizeof(fmt[0])))
+ if (!LoadStringW(GetModuleHandleW(NULL), id, fmt, ARRAY_SIZE(fmt)))
{
WINE_FIXME("LoadString failed with %d\n", GetLastError());
return;
@@ -342,8 +342,8 @@ static void UninstallProgram(void)
WCHAR sUninstallFailed[MAX_STRING_LEN];
HINSTANCE hInst = GetModuleHandleW(0);
- LoadStringW(hInst, IDS_APPNAME, sAppName, sizeof(sAppName)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_UNINSTALLFAILED, sUninstallFailed, sizeof(sUninstallFailed)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_APPNAME, sAppName, ARRAY_SIZE(sAppName));
+ LoadStringW(hInst, IDS_UNINSTALLFAILED, sUninstallFailed, ARRAY_SIZE(sUninstallFailed));
wsprintfW(errormsg, sUninstallFailed, entries[i].command);
if(MessageBoxW(0, errormsg, sAppName, MB_YESNO | MB_ICONQUESTION)==IDYES)
{
--
2.14.4

View File

@ -1,53 +0,0 @@
From efcc9e39250c4a511faf265b81da85e41a466b1d Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Tue, 24 Jul 2018 16:51:27 +0200
Subject: [PATCH] wineboot: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/wineboot/wineboot.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c
index 2a65b9e8b3..17ef9cbcca 100644
--- a/programs/wineboot/wineboot.c
+++ b/programs/wineboot/wineboot.c
@@ -401,7 +401,7 @@ static void create_volatile_environment_registry_key(void)
set_reg_value( hkey, HomeDriveW, path );
}
- size = sizeof(path)/sizeof(path[0]);
+ size = ARRAY_SIZE(path);
if (GetUserNameW( path, &size )) set_reg_value( hkey, UserNameW, path );
set_reg_value( hkey, HomeShareW, EmptyW );
@@ -410,7 +410,7 @@ static void create_volatile_environment_registry_key(void)
if (SUCCEEDED(hr))
set_reg_value( hkey, LocalAppDataW, path );
- size = (sizeof(computername)/sizeof(WCHAR)) - 2;
+ size = ARRAY_SIZE(computername) - 2;
if (GetComputerNameW(&computername[2], &size))
{
set_reg_value( hkey, UserDomainW, &computername[2] );
@@ -433,7 +433,7 @@ static BOOL wininit(void)
static const WCHAR wininitbakW[] = {'w','i','n','i','n','i','t','.','b','a','k',0};
WCHAR initial_buffer[1024];
WCHAR *str, *buffer = initial_buffer;
- DWORD size = sizeof(initial_buffer)/sizeof(WCHAR);
+ DWORD size = ARRAY_SIZE(initial_buffer);
DWORD res;
for (;;)
@@ -948,7 +948,7 @@ static HANDLE start_rundll32( const char *inf_path, BOOL wow64 )
static const WCHAR wowinstall[] = {' ','W','o','w','6','4','I','n','s','t','a','l','l',0};
static const WCHAR inf[] = {' ','1','2','8',' ','\\','\\','?','\\','u','n','i','x',0 };
- WCHAR app[MAX_PATH + sizeof(rundll)/sizeof(WCHAR)];
+ WCHAR app[MAX_PATH + ARRAY_SIZE(rundll)];
STARTUPINFOW si;
PROCESS_INFORMATION pi;
WCHAR *buffer;
--
2.14.4

View File

@ -1,73 +0,0 @@
From 3574168c07cb94f4bb391cac1bda6b3ea63afc4a Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Tue, 24 Jul 2018 17:28:23 +0200
Subject: [PATCH] wordpad: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/wordpad/wordpad.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/programs/wordpad/wordpad.c b/programs/wordpad/wordpad.c
index 904867f617..1ced34c7ff 100644
--- a/programs/wordpad/wordpad.c
+++ b/programs/wordpad/wordpad.c
@@ -250,7 +250,7 @@ static void set_caption(LPCWSTR wszNewFileName)
memcpy(wszCaption, wszNewFileName, lstrlenW(wszNewFileName)*sizeof(WCHAR));
length += lstrlenW(wszNewFileName);
memcpy(wszCaption + length, wszSeparator, sizeof(wszSeparator));
- length += sizeof(wszSeparator) / sizeof(WCHAR);
+ length += ARRAY_SIZE(wszSeparator);
memcpy(wszCaption + length, wszAppTitle, sizeof(wszAppTitle));
SetWindowTextW(hMainWnd, wszCaption);
@@ -398,7 +398,7 @@ static void populate_size_list(HWND hSizeListWnd)
GetDeviceCaps(hdc, LOGPIXELSY)));
} else
{
- for(i = 0; i < sizeof(choices)/sizeof(choices[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(choices); i++)
add_size(hSizeListWnd, choices[i]);
}
@@ -1124,7 +1124,7 @@ static void dialog_viewproperties(void)
psp[0].lParam = reg_formatindex(SF_TEXT);
psp[0].pfnCallback = NULL;
psp[0].pszTitle = MAKEINTRESOURCEW(STRING_VIEWPROPS_TEXT);
- for(i = 1; i < sizeof(psp)/sizeof(psp[0]); i++)
+ for(i = 1; i < ARRAY_SIZE(psp); i++)
{
psp[i].dwSize = psp[0].dwSize;
psp[i].dwFlags = psp[0].dwFlags;
@@ -1141,7 +1141,7 @@ static void dialog_viewproperties(void)
psh.hwndParent = hMainWnd;
psh.hInstance = hInstance;
psh.pszCaption = MAKEINTRESOURCEW(STRING_VIEWPROPS_TITLE);
- psh.nPages = sizeof(psp)/sizeof(psp[0]);
+ psh.nPages = ARRAY_SIZE(psp);
U3(psh).ppsp = ppsp;
U(psh).pszIcon = MAKEINTRESOURCEW(IDI_WORDPAD);
@@ -1235,7 +1235,7 @@ static LRESULT handle_findmsg(LPFINDREPLACEW pFr)
if (pFr->lpstrFindWhat != custom_data->findBuffer)
{
lstrcpynW(custom_data->findBuffer, pFr->lpstrFindWhat,
- sizeof(custom_data->findBuffer) / sizeof(WCHAR));
+ ARRAY_SIZE(custom_data->findBuffer));
pFr->lpstrFindWhat = custom_data->findBuffer;
}
@@ -1885,8 +1885,8 @@ static LRESULT OnCreate( HWND hWnd )
font = (HFONT)SendMessageW(hFontListWnd, WM_GETFONT, 0, 0);
hdc = GetDC(hFontListWnd);
font = SelectObject(hdc, font);
- GetTextExtentPointW(hdc, font_text, sizeof(font_text) / sizeof(font_text[0]) - 1, &name_sz);
- GetTextExtentPointW(hdc, size_text, sizeof(size_text) / sizeof(size_text[0]) - 1, &size_sz);
+ GetTextExtentPointW(hdc, font_text, ARRAY_SIZE(font_text) - 1, &name_sz);
+ GetTextExtentPointW(hdc, size_text, ARRAY_SIZE(size_text) - 1, &size_sz);
font = SelectObject(hdc, font);
ReleaseDC(hFontListWnd, hdc);
rbb.hwndChild = hFontListWnd;
--
2.14.4

View File

@ -1,49 +0,0 @@
From d3b1d2f5c710ffbb778ae739b3068eb982d0b901 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Tue, 24 Jul 2018 18:43:24 +0200
Subject: [PATCH] winetest: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/winetest/gui.c | 2 +-
programs/winetest/main.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/programs/winetest/gui.c b/programs/winetest/gui.c
index 2948d7e1ad..bda00f3707 100644
--- a/programs/winetest/gui.c
+++ b/programs/winetest/gui.c
@@ -547,7 +547,7 @@ report (enum report_type t, ...)
}
va_start (ap, t);
- if (t < sizeof text_funcs / sizeof text_funcs[0]) ret = funcs[t](ap);
+ if (t < ARRAY_SIZE(text_funcs)) ret = funcs[t](ap);
else report (R_WARNING, "unimplemented report type: %d", t);
va_end (ap);
return ret;
diff --git a/programs/winetest/main.c b/programs/winetest/main.c
index b3c3c1c850..56044095f3 100644
--- a/programs/winetest/main.c
+++ b/programs/winetest/main.c
@@ -461,7 +461,7 @@ static void print_language(void)
if (pGetSystemPreferredUILanguages && !running_under_wine())
{
WCHAR langW[32];
- ULONG num, size = sizeof(langW)/sizeof(langW[0]);
+ ULONG num, size = ARRAY_SIZE(langW);
if (pGetSystemPreferredUILanguages(MUI_LANGUAGE_ID, &num, langW, &size))
{
char lang[32], *p = lang;
@@ -1263,7 +1263,7 @@ int main( int argc, char *argv[] )
exit (0);
}
else if ((argv[i][0] != '-' && argv[i][0] != '/') || argv[i][2]) {
- if (nb_filters == sizeof(filters)/sizeof(filters[0]))
+ if (nb_filters == ARRAY_SIZE(filters))
{
report (R_ERROR, "Too many test filters specified");
exit (2);
--
2.14.4

View File

@ -1,44 +0,0 @@
From 34a20bf87deab524a00c1be9d60a6f78306359b4 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Tue, 24 Jul 2018 18:56:16 +0200
Subject: [PATCH] mountmgr.sys: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/mountmgr.sys/device.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c
index 1437bfc853..f96b05e4da 100644
--- a/dlls/mountmgr.sys/device.c
+++ b/dlls/mountmgr.sys/device.c
@@ -658,7 +658,7 @@ static void create_drive_devices(void)
if (!RegQueryValueExW( drives_key, driveW, NULL, &type, (BYTE *)buffer, &size ) &&
type == REG_SZ)
{
- for (j = 0; j < sizeof(drive_types)/sizeof(drive_types[0]); j++)
+ for (j = 0; j < ARRAY_SIZE(drive_types); j++)
if (drive_types[j][0] && !strcmpiW( buffer, drive_types[j] ))
{
drive_type = j;
@@ -1123,7 +1123,7 @@ static void create_port_devices( DRIVER_OBJECT *driver )
p[1] = 'o';
p[2] = 'm';
search_paths = serial_search_paths;
- num_search_paths = sizeof(serial_search_paths)/sizeof(serial_search_paths[0]);
+ num_search_paths = ARRAY_SIZE(serial_search_paths);
windows_ports_key_name = serialcomm_keyW;
}
else
@@ -1132,7 +1132,7 @@ static void create_port_devices( DRIVER_OBJECT *driver )
p[1] = 'p';
p[2] = 't';
search_paths = parallel_search_paths;
- num_search_paths = sizeof(parallel_search_paths)/sizeof(parallel_search_paths[0]);
+ num_search_paths = ARRAY_SIZE(parallel_search_paths);
windows_ports_key_name = parallel_ports_keyW;
}
p += 3;
--
2.14.4

View File

@ -1,38 +0,0 @@
From b8b021f3724c4a5705cde344a806ab30218670f7 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Wed, 25 Jul 2018 09:06:44 +0200
Subject: [PATCH] mpr: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/mpr/wnet.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/dlls/mpr/wnet.c b/dlls/mpr/wnet.c
index 78759ecb15..ad4f1ddb65 100644
--- a/dlls/mpr/wnet.c
+++ b/dlls/mpr/wnet.c
@@ -130,9 +130,8 @@ static void _tryLoadProvider(PCWSTR provider)
HKEY hKey;
TRACE("%s\n", debugstr_w(provider));
- snprintfW(serviceName, sizeof(serviceName) / sizeof(WCHAR), serviceFmt,
- servicePrefix, provider);
- serviceName[sizeof(serviceName) / sizeof(WCHAR) - 1] = '\0';
+ snprintfW(serviceName, ARRAY_SIZE(serviceName), serviceFmt, servicePrefix, provider);
+ serviceName[ARRAY_SIZE(serviceName) - 1] = '\0';
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, serviceName, 0, KEY_READ, &hKey) ==
ERROR_SUCCESS)
{
@@ -2127,7 +2126,7 @@ DWORD WINAPI WNetGetConnectionA( LPCSTR lpLocalName,
if (wideLocalName)
{
WCHAR wideRemoteStatic[MAX_PATH];
- DWORD wideRemoteSize = sizeof(wideRemoteStatic) / sizeof(WCHAR);
+ DWORD wideRemoteSize = ARRAY_SIZE(wideRemoteStatic);
MultiByteToWideChar(CP_ACP, 0, lpLocalName, -1, wideLocalName, len);
--
2.14.4

View File

@ -1,172 +0,0 @@
From 23b2b3e7e76161f3780551a9de77f8ccc5815e33 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Wed, 25 Jul 2018 09:21:17 +0200
Subject: [PATCH] msacm32: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/msacm32/filter.c | 4 ++--
dlls/msacm32/format.c | 18 +++++++++---------
dlls/msacm32/internal.c | 14 +++++++-------
dlls/msacm32/pcmconverter.c | 15 +++++++--------
dlls/msacm32/tests/msacm.c | 2 +-
5 files changed, 26 insertions(+), 27 deletions(-)
diff --git a/dlls/msacm32/filter.c b/dlls/msacm32/filter.c
index 53db82777d..8d5abced9d 100644
--- a/dlls/msacm32/filter.c
+++ b/dlls/msacm32/filter.c
@@ -361,8 +361,8 @@ MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd
if (mmr == MMSYSERR_NOERROR &&
paftd->dwFilterTag == WAVE_FORMAT_PCM && paftd->szFilterTag[0] == 0)
- MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFilterTag,
- sizeof(paftd->szFilterTag)/sizeof(WCHAR) );
+ MultiByteToWideChar(CP_ACP, 0, "PCM", -1, paftd->szFilterTag,
+ ARRAY_SIZE(paftd->szFilterTag));
return mmr;
}
diff --git a/dlls/msacm32/format.c b/dlls/msacm32/format.c
index b3d2900393..fcc0d9b1c6 100644
--- a/dlls/msacm32/format.c
+++ b/dlls/msacm32/format.c
@@ -503,9 +503,9 @@ MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD
wsprintfW(pafd->szFormat + lstrlenW(pafd->szFormat), fmt2,
pafd->pwfx->wBitsPerSample);
}
- MultiByteToWideChar( CP_ACP, 0, (pafd->pwfx->nChannels == 1) ? "; Mono" : "; Stereo", -1,
- pafd->szFormat + strlenW(pafd->szFormat),
- sizeof(pafd->szFormat)/sizeof(WCHAR) - strlenW(pafd->szFormat) );
+ MultiByteToWideChar(CP_ACP, 0, (pafd->pwfx->nChannels == 1) ? "; Mono" : "; Stereo", -1,
+ pafd->szFormat + strlenW(pafd->szFormat),
+ ARRAY_SIZE(pafd->szFormat) - strlenW(pafd->szFormat));
}
TRACE("=> %d\n", mmr);
@@ -929,8 +929,8 @@ MMRESULT WINAPI acmFormatTagDetailsW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd
if (mmr == MMSYSERR_NOERROR &&
paftd->dwFormatTag == WAVE_FORMAT_PCM && paftd->szFormatTag[0] == 0)
- MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
- sizeof(paftd->szFormatTag)/sizeof(WCHAR) );
+ MultiByteToWideChar(CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
+ ARRAY_SIZE(paftd->szFormatTag));
return mmr;
}
@@ -1036,8 +1036,8 @@ MMRESULT WINAPI acmFormatTagEnumW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd,
(LPARAM)paftd, ACM_FORMATTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) {
if (paftd->dwFormatTag == WAVE_FORMAT_PCM) {
if (paftd->szFormatTag[0] == 0)
- MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
- sizeof(paftd->szFormatTag)/sizeof(WCHAR) );
+ MultiByteToWideChar(CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
+ ARRAY_SIZE(paftd->szFormatTag));
/* (WS) I'm preserving this PCM hack since it seems to be
* correct. Please notice this block was borrowed from
* below.
@@ -1062,8 +1062,8 @@ MMRESULT WINAPI acmFormatTagEnumW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd,
(LPARAM)paftd, ACM_FORMATTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) {
if (paftd->dwFormatTag == WAVE_FORMAT_PCM) {
if (paftd->szFormatTag[0] == 0)
- MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
- sizeof(paftd->szFormatTag)/sizeof(WCHAR) );
+ MultiByteToWideChar(CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
+ ARRAY_SIZE(paftd->szFormatTag));
/* FIXME (EPP): I'm not sure this is the correct
* algorithm (should make more sense to apply the same
* for all already loaded formats, but this will do
diff --git a/dlls/msacm32/internal.c b/dlls/msacm32/internal.c
index 7bafcaad5e..aad071e8ad 100644
--- a/dlls/msacm32/internal.c
+++ b/dlls/msacm32/internal.c
@@ -72,7 +72,7 @@ PWINE_ACMDRIVERID MSACM_RegisterDriverFromRegistry(LPCWSTR pszRegEntry)
/* The requested registry entry must have the format msacm.XXXXX in order to
be recognized in any future sessions of msacm
*/
- if (0 == strncmpiW(pszRegEntry, msacmW, sizeof(msacmW)/sizeof(WCHAR))) {
+ if (0 == strncmpiW(pszRegEntry, msacmW, ARRAY_SIZE(msacmW))) {
lRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE, drvkey, 0, KEY_QUERY_VALUE, &hKey);
if (lRet != ERROR_SUCCESS) {
WARN("unable to open registry key - 0x%08x\n", lRet);
@@ -373,31 +373,31 @@ void MSACM_RegisterAllDrivers(void)
if (lRet == ERROR_SUCCESS) {
RegQueryInfoKeyW( hKey, 0, 0, 0, &cnt, 0, 0, 0, 0, 0, 0, 0);
for (i = 0; i < cnt; i++) {
- bufLen = sizeof(buf) / sizeof(buf[0]);
+ bufLen = ARRAY_SIZE(buf);
lRet = RegEnumKeyExW(hKey, i, buf, &bufLen, 0, 0, 0, &lastWrite);
if (lRet != ERROR_SUCCESS) continue;
- if (strncmpiW(buf, msacmW, sizeof(msacmW)/sizeof(msacmW[0]))) continue;
+ if (strncmpiW(buf, msacmW, ARRAY_SIZE(msacmW))) continue;
if (!(name = strchrW(buf, '='))) continue;
*name = 0;
MSACM_RegisterDriver(buf, name + 1, 0);
}
i = 0;
- cnt = sizeof(valname) / sizeof(*valname);
+ cnt = ARRAY_SIZE(valname);
bufLen = sizeof(buf);
while(RegEnumValueW(hKey, i, valname, &cnt, 0,
&type, (BYTE*)buf, &bufLen) == ERROR_SUCCESS){
- if(!strncmpiW(valname, msacmW, sizeof(msacmW) / sizeof(*msacmW)))
+ if (!strncmpiW(valname, msacmW, ARRAY_SIZE(msacmW)))
MSACM_RegisterDriver(valname, buf, 0);
++i;
}
RegCloseKey( hKey );
}
- if (GetPrivateProfileSectionW(drv32, buf, sizeof(buf)/sizeof(buf[0]), sys))
+ if (GetPrivateProfileSectionW(drv32, buf, ARRAY_SIZE(buf), sys))
{
for(s = buf; *s; s += strlenW(s) + 1)
{
- if (strncmpiW(s, msacmW, sizeof(msacmW)/sizeof(msacmW[0]))) continue;
+ if (strncmpiW(s, msacmW, ARRAY_SIZE(msacmW))) continue;
if (!(name = strchrW(s, '='))) continue;
*name = 0;
MSACM_RegisterDriver(s, name + 1, 0);
diff --git a/dlls/msacm32/pcmconverter.c b/dlls/msacm32/pcmconverter.c
index f26f125fcd..dc10f11e7a 100644
--- a/dlls/msacm32/pcmconverter.c
+++ b/dlls/msacm32/pcmconverter.c
@@ -984,14 +984,13 @@ static LRESULT PCM_DriverDetails(PACMDRIVERDETAILSW add)
add->cFormatTags = 1;
add->cFilterTags = 0;
add->hicon = NULL;
- MultiByteToWideChar( CP_ACP, 0, "MS-PCM", -1,
- add->szShortName, sizeof(add->szShortName)/sizeof(WCHAR) );
- MultiByteToWideChar( CP_ACP, 0, "Wine PCM converter", -1,
- add->szLongName, sizeof(add->szLongName)/sizeof(WCHAR) );
- MultiByteToWideChar( CP_ACP, 0, "Brought to you by the Wine team...", -1,
- add->szCopyright, sizeof(add->szCopyright)/sizeof(WCHAR) );
- MultiByteToWideChar( CP_ACP, 0, "Refer to LICENSE file", -1,
- add->szLicensing, sizeof(add->szLicensing)/sizeof(WCHAR) );
+ MultiByteToWideChar(CP_ACP, 0, "MS-PCM", -1, add->szShortName, ARRAY_SIZE(add->szShortName));
+ MultiByteToWideChar(CP_ACP, 0, "Wine PCM converter", -1,
+ add->szLongName, ARRAY_SIZE(add->szLongName));
+ MultiByteToWideChar(CP_ACP, 0, "Brought to you by the Wine team...", -1,
+ add->szCopyright, ARRAY_SIZE(add->szCopyright));
+ MultiByteToWideChar(CP_ACP, 0, "Refer to LICENSE file", -1,
+ add->szLicensing, ARRAY_SIZE(add->szLicensing) );
add->szFeatures[0] = 0;
return MMSYSERR_NOERROR;
diff --git a/dlls/msacm32/tests/msacm.c b/dlls/msacm32/tests/msacm.c
index 959ec7f0c0..180639fa54 100644
--- a/dlls/msacm32/tests/msacm.c
+++ b/dlls/msacm32/tests/msacm.c
@@ -1106,7 +1106,7 @@ static void test_convert(void)
MMRESULT mmr;
unsigned i;
- for (i = 0; i < sizeof(expected_output)/sizeof(struct stream_output); i++)
+ for (i = 0; i < ARRAY_SIZE(expected_output); i++)
{
mmr = acmStreamOpen(&has, NULL, (WAVEFORMATEX *)&expected_output[i].src, (WAVEFORMATEX *)&expected_output[i].dst, NULL, 0, 0, 0);
ok(mmr == MMSYSERR_NOERROR, "#%d: open failed: 0x%x\n", i, mmr);
--
2.14.4

View File

@ -1,39 +0,0 @@
From a14a92dc9859ab9ae40b81a103f5efa528c4efc6 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Wed, 25 Jul 2018 18:37:36 +0200
Subject: [PATCH] msrle32: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/msrle32/msrle32.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/msrle32/msrle32.c b/dlls/msrle32/msrle32.c
index 66880408d4..5bcfa86f97 100644
--- a/dlls/msrle32/msrle32.c
+++ b/dlls/msrle32/msrle32.c
@@ -1183,8 +1183,8 @@ static LRESULT GetInfo(const CodecInfo *pi, ICINFO *icinfo, DWORD dwSize)
icinfo->dwVersion = ICVERSION;
icinfo->dwVersionICM = ICVERSION;
- LoadStringW(MSRLE32_hModule, IDS_NAME, icinfo->szName, sizeof(icinfo->szName)/sizeof(WCHAR));
- LoadStringW(MSRLE32_hModule, IDS_DESCRIPTION, icinfo->szDescription, sizeof(icinfo->szDescription)/sizeof(WCHAR));
+ LoadStringW(MSRLE32_hModule, IDS_NAME, icinfo->szName, ARRAY_SIZE(icinfo->szName));
+ LoadStringW(MSRLE32_hModule, IDS_DESCRIPTION, icinfo->szDescription, ARRAY_SIZE(icinfo->szDescription));
return sizeof(ICINFO);
}
@@ -1206,8 +1206,8 @@ static LRESULT About(CodecInfo *pi, HWND hWnd)
/* pre-condition */
assert(MSRLE32_hModule != 0);
- LoadStringW(MSRLE32_hModule, IDS_NAME, szTitle, sizeof(szTitle)/sizeof(szTitle[0]));
- LoadStringW(MSRLE32_hModule, IDS_ABOUT, szAbout, sizeof(szAbout)/sizeof(szAbout[0]));
+ LoadStringW(MSRLE32_hModule, IDS_NAME, szTitle, ARRAY_SIZE(szTitle));
+ LoadStringW(MSRLE32_hModule, IDS_ABOUT, szAbout, ARRAY_SIZE(szAbout));
MessageBoxW(hWnd, szAbout, szTitle, MB_OK|MB_ICONINFORMATION);
--
2.14.4

View File

@ -1,291 +0,0 @@
From eb0325daf599408d5d606bade6fd47ac7c78d3cb Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Wed, 25 Jul 2018 18:44:28 +0200
Subject: [PATCH] msvcrt: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/msvcrt/console.c | 2 +-
dlls/msvcrt/ctype.c | 2 +-
dlls/msvcrt/errno.c | 2 +-
dlls/msvcrt/except.c | 3 +--
dlls/msvcrt/exit.c | 3 +--
dlls/msvcrt/file.c | 20 ++++++++++----------
dlls/msvcrt/locale.c | 12 ++++++------
dlls/msvcrt/printf.h | 4 ++--
dlls/msvcrt/process.c | 2 +-
dlls/msvcrt/scheduler.c | 8 ++++----
dlls/msvcrt/wcs.c | 2 +-
11 files changed, 29 insertions(+), 31 deletions(-)
diff --git a/dlls/msvcrt/console.c b/dlls/msvcrt/console.c
index 75e95ebcfc..3a2301ef18 100644
--- a/dlls/msvcrt/console.c
+++ b/dlls/msvcrt/console.c
@@ -124,7 +124,7 @@ static BOOL handle_enhanced_keys(INPUT_RECORD *ir, unsigned char *ch1, unsigned
{
int i;
- for (i = 0; i < sizeof(enh_map) / sizeof(enh_map[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(enh_map); i++)
{
if (ir->Event.KeyEvent.wVirtualScanCode == enh_map[i].vk)
{
diff --git a/dlls/msvcrt/ctype.c b/dlls/msvcrt/ctype.c
index 2c39a56686..758411a7a4 100644
--- a/dlls/msvcrt/ctype.c
+++ b/dlls/msvcrt/ctype.c
@@ -493,7 +493,7 @@ unsigned short __cdecl wctype(const char *property)
};
unsigned int i;
- for(i=0; i<sizeof(properties)/sizeof(properties[0]); i++)
+ for(i=0; i<ARRAY_SIZE(properties); i++)
if(!strcmp(property, properties[i].name))
return properties[i].mask;
diff --git a/dlls/msvcrt/errno.c b/dlls/msvcrt/errno.c
index c5fbae21a8..a80ac61f11 100644
--- a/dlls/msvcrt/errno.c
+++ b/dlls/msvcrt/errno.c
@@ -123,7 +123,7 @@ char *MSVCRT__sys_errlist[] =
str_generic_error
};
-unsigned int MSVCRT__sys_nerr = sizeof(MSVCRT__sys_errlist)/sizeof(MSVCRT__sys_errlist[0]) - 1;
+unsigned int MSVCRT__sys_nerr = ARRAY_SIZE(MSVCRT__sys_errlist) - 1;
static MSVCRT_invalid_parameter_handler invalid_parameter_handler = NULL;
diff --git a/dlls/msvcrt/except.c b/dlls/msvcrt/except.c
index 8fccd8ed5d..da0ac9219e 100644
--- a/dlls/msvcrt/except.c
+++ b/dlls/msvcrt/except.c
@@ -136,8 +136,7 @@ static LONG msvcrt_exception_filter(struct _EXCEPTION_POINTERS *except)
int float_signal = MSVCRT__FPE_INVALID;
sighandlers[MSVCRT_SIGFPE] = MSVCRT_SIG_DFL;
- for (i = 0; i < sizeof(float_exception_map) /
- sizeof(float_exception_map[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(float_exception_map); i++)
{
if (float_exception_map[i].status ==
except->ExceptionRecord->ExceptionCode)
diff --git a/dlls/msvcrt/exit.c b/dlls/msvcrt/exit.c
index b84c50adbc..51bc6f07e1 100644
--- a/dlls/msvcrt/exit.c
+++ b/dlls/msvcrt/exit.c
@@ -209,8 +209,7 @@ static void DoMessageBoxW(const MSVCRT_wchar_t *lead, const MSVCRT_wchar_t *mess
MSVCRT_wchar_t text[2048];
INT ret;
- MSVCRT__snwprintf(text, sizeof(text)/sizeof(text[0]), message_format,
- lead, MSVCRT__wpgmptr, message);
+ MSVCRT__snwprintf(text, ARRAY_SIZE(text), message_format, lead, MSVCRT__wpgmptr, message);
msgbox.cbSize = sizeof(msgbox);
msgbox.hwndOwner = GetActiveWindow();
diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index 2c05f25c6a..224e6eae0c 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -1223,7 +1223,7 @@ void msvcrt_free_io(void)
MSVCRT__flushall();
MSVCRT__fcloseall();
- for(i=0; i<sizeof(MSVCRT___pioinfo)/sizeof(MSVCRT___pioinfo[0]); i++)
+ for(i=0; i<ARRAY_SIZE(MSVCRT___pioinfo); i++)
{
if(!MSVCRT___pioinfo[i])
continue;
@@ -1246,7 +1246,7 @@ void msvcrt_free_io(void)
}
}
- for(i=0; i<sizeof(MSVCRT_fstream)/sizeof(MSVCRT_fstream[0]); i++)
+ for(i=0; i<ARRAY_SIZE(MSVCRT_fstream); i++)
MSVCRT_free(MSVCRT_fstream[i]);
}
@@ -1606,29 +1606,29 @@ static int msvcrt_get_flags(const MSVCRT_wchar_t* mode, int *open_flags, int* st
mode++;
while(*mode == ' ') mode++;
- if(!MSVCRT_CHECK_PMT(!strncmpW(ccs, mode, sizeof(ccs)/sizeof(ccs[0]))))
+ if(!MSVCRT_CHECK_PMT(!strncmpW(ccs, mode, ARRAY_SIZE(ccs))))
return -1;
- mode += sizeof(ccs)/sizeof(ccs[0]);
+ mode += ARRAY_SIZE(ccs);
while(*mode == ' ') mode++;
if(!MSVCRT_CHECK_PMT(*mode == '='))
return -1;
mode++;
while(*mode == ' ') mode++;
- if(!strncmpiW(utf8, mode, sizeof(utf8)/sizeof(utf8[0])))
+ if(!strncmpiW(utf8, mode, ARRAY_SIZE(utf8)))
{
*open_flags |= MSVCRT__O_U8TEXT;
- mode += sizeof(utf8)/sizeof(utf8[0]);
+ mode += ARRAY_SIZE(utf8);
}
- else if(!strncmpiW(utf16le, mode, sizeof(utf16le)/sizeof(utf16le[0])))
+ else if(!strncmpiW(utf16le, mode, ARRAY_SIZE(utf16le)))
{
*open_flags |= MSVCRT__O_U16TEXT;
- mode += sizeof(utf16le)/sizeof(utf16le[0]);
+ mode += ARRAY_SIZE(utf16le);
}
- else if(!strncmpiW(unicode, mode, sizeof(unicode)/sizeof(unicode[0])))
+ else if(!strncmpiW(unicode, mode, ARRAY_SIZE(unicode)))
{
*open_flags |= MSVCRT__O_WTEXT;
- mode += sizeof(unicode)/sizeof(unicode[0]);
+ mode += ARRAY_SIZE(unicode);
}
else
{
diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c
index 8c9bece774..1e56395dbb 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -94,7 +94,7 @@ static const char * const _country_synonyms[] =
static void remap_synonym(char *name)
{
unsigned int i;
- for (i = 0; i < sizeof(_country_synonyms)/sizeof(char*); i += 2 )
+ for (i = 0; i < ARRAY_SIZE(_country_synonyms); i += 2)
{
if (!strcasecmp(_country_synonyms[i],name))
{
@@ -595,7 +595,7 @@ void* CDECL _Gettnames(void)
TRACE("\n");
- for(i=0; i<sizeof(cur->str.str)/sizeof(cur->str.str[0]); i++)
+ for(i=0; i<ARRAY_SIZE(cur->str.str); i++)
size += strlen(cur->str.str[i])+1;
ret = MSVCRT_malloc(size);
@@ -604,7 +604,7 @@ void* CDECL _Gettnames(void)
memcpy(ret, cur, size);
size = 0;
- for(i=0; i<sizeof(cur->str.str)/sizeof(cur->str.str[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(cur->str.str); i++) {
ret->str.str[i] = &ret->data[size];
size += strlen(&ret->data[size])+1;
}
@@ -1605,7 +1605,7 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
size = sizeof(MSVCRT___lc_time_data);
lcid_tmp = lcid[MSVCRT_LC_TIME] ? lcid[MSVCRT_LC_TIME] : MAKELCID(LANG_ENGLISH, SORT_DEFAULT);
- for(i=0; i<sizeof(time_data)/sizeof(time_data[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(time_data); i++) {
if(time_data[i]==LOCALE_SSHORTDATE && !lcid[MSVCRT_LC_TIME]) {
size += sizeof(cloc_short_date) + sizeof(cloc_short_dateW);
}else if(time_data[i]==LOCALE_SLONGDATE && !lcid[MSVCRT_LC_TIME]) {
@@ -1637,7 +1637,7 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
}
ret = 0;
- for(i=0; i<sizeof(time_data)/sizeof(time_data[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(time_data); i++) {
locinfo->lc_time_curr->str.str[i] = &locinfo->lc_time_curr->data[ret];
if(time_data[i]==LOCALE_SSHORTDATE && !lcid[MSVCRT_LC_TIME]) {
memcpy(&locinfo->lc_time_curr->data[ret], cloc_short_date, sizeof(cloc_short_date));
@@ -1653,7 +1653,7 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
&locinfo->lc_time_curr->data[ret], size-ret);
}
}
- for(i=0; i<sizeof(time_data)/sizeof(time_data[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(time_data); i++) {
locinfo->lc_time_curr->wstr.wstr[i] = (MSVCRT_wchar_t*)&locinfo->lc_time_curr->data[ret];
if(time_data[i]==LOCALE_SSHORTDATE && !lcid[MSVCRT_LC_TIME]) {
memcpy(&locinfo->lc_time_curr->data[ret], cloc_short_dateW, sizeof(cloc_short_dateW));
diff --git a/dlls/msvcrt/printf.h b/dlls/msvcrt/printf.h
index ee8120e149..077dafa550 100644
--- a/dlls/msvcrt/printf.h
+++ b/dlls/msvcrt/printf.h
@@ -518,7 +518,7 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
flags.PadZero = '0';
i = flags.Precision;
flags.Precision = 2*sizeof(void*);
- FUNC_NAME(pf_integer_conv)(buf, sizeof(buf)/sizeof(APICHAR), &flags,
+ FUNC_NAME(pf_integer_conv)(buf, ARRAY_SIZE(buf), &flags,
(ULONG_PTR)pf_args(args_ctx, pos, VT_PTR, valist).get_ptr);
flags.PadZero = 0;
flags.Precision = i;
@@ -549,7 +549,7 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
flags.Precision = flags.FieldLength - 2;
max_len = (flags.FieldLength>flags.Precision ? flags.FieldLength : flags.Precision) + 10;
- if(max_len > sizeof(buf)/sizeof(APICHAR))
+ if(max_len > ARRAY_SIZE(buf))
tmp = HeapAlloc(GetProcessHeap(), 0, max_len);
if(!tmp)
return -1;
diff --git a/dlls/msvcrt/process.c b/dlls/msvcrt/process.c
index fac3bd4d20..9a192e7e9b 100644
--- a/dlls/msvcrt/process.c
+++ b/dlls/msvcrt/process.c
@@ -345,7 +345,7 @@ static MSVCRT_wchar_t *msvcrt_get_comspec(void)
MSVCRT_wchar_t *ret;
unsigned int len;
- if (!(len = GetEnvironmentVariableW(comspec, NULL, 0))) len = sizeof(cmd)/sizeof(MSVCRT_wchar_t);
+ if (!(len = GetEnvironmentVariableW(comspec, NULL, 0))) len = ARRAY_SIZE(cmd);
if ((ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(MSVCRT_wchar_t))))
{
if (!GetEnvironmentVariableW(comspec, ret, len)) strcpyW(ret, cmd);
diff --git a/dlls/msvcrt/scheduler.c b/dlls/msvcrt/scheduler.c
index c6c0fa7e38..55ab1c549e 100644
--- a/dlls/msvcrt/scheduler.c
+++ b/dlls/msvcrt/scheduler.c
@@ -344,7 +344,7 @@ static void ExternalContextBase_dtor(ExternalContextBase *this)
int i;
/* TODO: move the allocator cache to scheduler so it can be reused */
- for(i=0; i<sizeof(this->allocator_cache)/sizeof(this->allocator_cache[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(this->allocator_cache); i++) {
for(cur = this->allocator_cache[i]; cur; cur=next) {
next = cur->free.next;
MSVCRT_operator_delete(cur);
@@ -413,10 +413,10 @@ void * CDECL Concurrency_Alloc(MSVCRT_size_t size)
int i;
C_ASSERT(sizeof(union allocator_cache_entry) <= 1 << 4);
- for(i=0; i<sizeof(context->allocator_cache)/sizeof(context->allocator_cache[0]); i++)
+ for(i=0; i<ARRAY_SIZE(context->allocator_cache); i++)
if (1 << (i+4) >= size) break;
- if(i==sizeof(context->allocator_cache)/sizeof(context->allocator_cache[0])) {
+ if(i==ARRAY_SIZE(context->allocator_cache)) {
p = MSVCRT_operator_new(size);
p->alloc.bucket = -1;
}else if (context->allocator_cache[i]) {
@@ -446,7 +446,7 @@ void CDECL Concurrency_Free(void* mem)
if (context->context.vtable != &MSVCRT_ExternalContextBase_vtable) {
MSVCRT_operator_delete(p);
}else {
- if(bucket >= 0 && bucket < sizeof(context->allocator_cache)/sizeof(context->allocator_cache[0]) &&
+ if(bucket >= 0 && bucket < ARRAY_SIZE(context->allocator_cache) &&
(!context->allocator_cache[bucket] || context->allocator_cache[bucket]->free.depth < 20)) {
p->free.next = context->allocator_cache[bucket];
p->free.depth = p->free.next ? p->free.next->free.depth+1 : 0;
diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c
index 098e0d5ba8..ed73fc6163 100644
--- a/dlls/msvcrt/wcs.c
+++ b/dlls/msvcrt/wcs.c
@@ -2109,7 +2109,7 @@ static int wctoint(WCHAR c, int base)
0xd66, 0xe50, 0xed0, 0xf20, 0x1040, 0x17e0, 0x1810, 0xff10
};
int i;
- for (i = 0; i < sizeof(zeros)/sizeof(zeros[0]) && c >= zeros[i]; ++i) {
+ for (i = 0; i < ARRAY_SIZE(zeros) && c >= zeros[i]; ++i) {
if (zeros[i] <= c && c <= zeros[i] + 9) {
v = c - zeros[i];
break;
--
2.14.4

View File

@ -1,35 +0,0 @@
From 5675688cff4eb773a4b531423f72267823caec3b Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Wed, 25 Jul 2018 19:17:44 +0200
Subject: [PATCH] scrobj: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/scrobj/scrobj.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/scrobj/scrobj.c b/dlls/scrobj/scrobj.c
index 3e6535a607..989a648370 100644
--- a/dlls/scrobj/scrobj.c
+++ b/dlls/scrobj/scrobj.c
@@ -102,7 +102,7 @@ static void release_typelib(void)
if (!typelib)
return;
- for (i = 0; i < sizeof(typeinfos)/sizeof(*typeinfos); i++)
+ for (i = 0; i < ARRAY_SIZE(typeinfos); i++)
if (typeinfos[i])
ITypeInfo_Release(typeinfos[i]);
@@ -369,7 +369,7 @@ static HRESULT WINAPI scriptlet_typelib_get_GUID(IGenScriptletTLib *iface, BSTR
if (FAILED(hr))
return hr;
- hr = StringFromGUID2(&guid, guidW, sizeof(guidW)/sizeof(guidW[0]));
+ hr = StringFromGUID2(&guid, guidW, ARRAY_SIZE(guidW));
if (FAILED(hr))
return hr;
--
2.14.4

View File

@ -1,68 +0,0 @@
From c4428ddee47ee8f189552442261adf72fbe9c1c8 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Wed, 25 Jul 2018 19:23:08 +0200
Subject: [PATCH] storage.dll16: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/storage.dll16/storage.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/storage.dll16/storage.c b/dlls/storage.dll16/storage.c
index 865411f9cb..23e88b42d1 100644
--- a/dlls/storage.dll16/storage.c
+++ b/dlls/storage.dll16/storage.c
@@ -776,8 +776,8 @@ STORAGE_init_storage(stream_access16 *str) {
/* block 1 is the root directory entry */
memset(block,0x00,sizeof(block));
stde = (struct storage_pps_entry*)block;
- MultiByteToWideChar( CP_ACP, 0, "RootEntry", -1, stde->pps_rawname,
- sizeof(stde->pps_rawname)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, "RootEntry", -1, stde->pps_rawname,
+ ARRAY_SIZE(stde->pps_rawname));
stde->pps_sizeofname = (strlenW(stde->pps_rawname)+1) * sizeof(WCHAR);
stde->pps_type = 5;
stde->pps_dir = -1;
@@ -1750,8 +1750,8 @@ HRESULT CDECL IStorage16_fnCreateStorage(IStorage16 *iface, LPCOLESTR16 pwcsName
assert(ret);
nPPSEntries = STORAGE_get_pps_entry(&lpstg->str,ppsent,&(lpstg->stde));
assert(nPPSEntries == 1);
- MultiByteToWideChar( CP_ACP, 0, pwcsName, -1, lpstg->stde.pps_rawname,
- sizeof(lpstg->stde.pps_rawname)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, pwcsName, -1, lpstg->stde.pps_rawname,
+ ARRAY_SIZE(lpstg->stde.pps_rawname));
lpstg->stde.pps_sizeofname = (strlenW(lpstg->stde.pps_rawname)+1)*sizeof(WCHAR);
lpstg->stde.pps_next = -1;
lpstg->stde.pps_prev = -1;
@@ -1813,8 +1813,8 @@ HRESULT CDECL IStorage16_fnCreateStream(IStorage16 *iface, LPCOLESTR16 pwcsName,
assert(ret);
nPPSEntries = STORAGE_get_pps_entry(&lpstr->str,ppsent,&(lpstr->stde));
assert(nPPSEntries == 1);
- MultiByteToWideChar( CP_ACP, 0, pwcsName, -1, lpstr->stde.pps_rawname,
- sizeof(lpstr->stde.pps_rawname)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, pwcsName, -1, lpstr->stde.pps_rawname,
+ ARRAY_SIZE(lpstr->stde.pps_rawname));
lpstr->stde.pps_sizeofname = (strlenW(lpstr->stde.pps_rawname)+1) * sizeof(WCHAR);
lpstr->stde.pps_next = -1;
lpstr->stde.pps_prev = -1;
@@ -1855,7 +1855,7 @@ HRESULT CDECL IStorage16_fnOpenStorage(IStorage16 *iface, LPCOLESTR16 pwcsName,
lpstg->str.lockbytes = This->str.lockbytes;
_ilockbytes16_addref(This->str.lockbytes);
}
- MultiByteToWideChar( CP_ACP, 0, pwcsName, -1, name, sizeof(name)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, pwcsName, -1, name, ARRAY_SIZE(name));
newpps = STORAGE_look_for_named_pps(&lpstg->str,This->stde.pps_dir,name);
if (newpps==-1) {
IStorage16_fnRelease(&lpstg->IStorage16_iface);
@@ -1897,7 +1897,7 @@ HRESULT CDECL IStorage16_fnOpenStream(IStorage16 *iface, LPCOLESTR16 pwcsName, v
lpstr->str.lockbytes = This->str.lockbytes;
_ilockbytes16_addref(This->str.lockbytes);
}
- MultiByteToWideChar( CP_ACP, 0, pwcsName, -1, name, sizeof(name)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, pwcsName, -1, name, ARRAY_SIZE(name));
newpps = STORAGE_look_for_named_pps(&lpstr->str,This->stde.pps_dir,name);
if (newpps==-1) {
IStream16_fnRelease(&lpstr->IStream16_iface);
--
2.14.4

View File

@ -1,40 +0,0 @@
From 897ed8f10acb62fca27c4ecb04b06bb9e29449e9 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Wed, 25 Jul 2018 19:35:09 +0200
Subject: [PATCH] urlmon: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/urlmon/urlmon_main.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/urlmon/urlmon_main.c b/dlls/urlmon/urlmon_main.c
index 5968a6ce55..06f0698efa 100644
--- a/dlls/urlmon/urlmon_main.c
+++ b/dlls/urlmon/urlmon_main.c
@@ -409,7 +409,7 @@ static void init_session(void)
{
unsigned int i;
- for(i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++) {
+ for(i = 0; i < ARRAY_SIZE(object_creation); i++) {
if(object_creation[i].protocol)
register_namespace(object_creation[i].cf, object_creation[i].clsid,
object_creation[i].protocol, TRUE);
@@ -438,10 +438,10 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
unsigned int i;
HRESULT hr;
-
+
TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
-
- for (i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++)
+
+ for (i = 0; i < ARRAY_SIZE(object_creation); i++)
{
if (IsEqualGUID(object_creation[i].clsid, rclsid))
return IClassFactory_QueryInterface(object_creation[i].cf, riid, ppv);
--
2.14.4

View File

@ -1,26 +0,0 @@
From dbdf14d77be88f1e380b9e5d0638d5f55137e8ca Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Wed, 25 Jul 2018 19:13:30 +0200
Subject: [PATCH] msvideo.dll16: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/msvideo.dll16/msvideo16.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/msvideo.dll16/msvideo16.c b/dlls/msvideo.dll16/msvideo16.c
index d390020ecc..bc239a8ab3 100644
--- a/dlls/msvideo.dll16/msvideo16.c
+++ b/dlls/msvideo.dll16/msvideo16.c
@@ -889,7 +889,7 @@ DWORD WINAPI VideoCapDriverDescAndVer16(WORD nr, LPSTR buf1, WORD buf1len,
RegQueryInfoKeyA( hKey, 0, 0, 0, &cnt, 0, 0, 0, 0, 0, 0, 0);
for (i = 0; i < cnt; i++)
{
- bufLen = sizeof(buf) / sizeof(buf[0]);
+ bufLen = ARRAY_SIZE(buf);
lRet = RegEnumKeyExA(hKey, i, buf, &bufLen, 0, 0, 0, &lastWrite);
if (lRet != ERROR_SUCCESS) continue;
if (strncasecmp(buf, "vid", 3)) continue;
--
2.14.4

View File

@ -1,138 +0,0 @@
From bb748f41222a923e002ebbf2ffc0c904ba139db2 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Wed, 25 Jul 2018 18:35:21 +0200
Subject: [PATCH] mscoree: Use the ARRAY_SIZE() macro
Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/mscoree/config.c | 18 +++++++-----------
dlls/mscoree/corruntimehost.c | 6 +++---
dlls/mscoree/mscoree_main.c | 4 ++--
3 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/dlls/mscoree/config.c b/dlls/mscoree/config.c
index 48f12f4d53..a5c0666904 100644
--- a/dlls/mscoree/config.c
+++ b/dlls/mscoree/config.c
@@ -417,7 +417,7 @@ static HRESULT WINAPI ConfigFileHandler_startElement(ISAXContentHandler *iface,
TRACE("%s %s %s\n", debugstr_wn(pNamespaceUri,nNamespaceUri),
debugstr_wn(pLocalName,nLocalName), debugstr_wn(pQName,nQName));
- if (This->statenum == sizeof(This->states) / sizeof(This->states[0]) - 1)
+ if (This->statenum == ARRAY_SIZE(This->states) - 1)
{
ERR("file has too much nesting\n");
return E_FAIL;
@@ -426,8 +426,7 @@ static HRESULT WINAPI ConfigFileHandler_startElement(ISAXContentHandler *iface,
switch (This->states[This->statenum])
{
case STATE_ROOT:
- if (nLocalName == sizeof(configuration)/sizeof(WCHAR)-1 &&
- lstrcmpW(pLocalName, configuration) == 0)
+ if (nLocalName == ARRAY_SIZE(configuration) - 1 && lstrcmpW(pLocalName, configuration) == 0)
{
This->states[++This->statenum] = STATE_CONFIGURATION;
break;
@@ -435,15 +434,13 @@ static HRESULT WINAPI ConfigFileHandler_startElement(ISAXContentHandler *iface,
else
goto unknown;
case STATE_CONFIGURATION:
- if (nLocalName == sizeof(startup)/sizeof(WCHAR)-1 &&
- lstrcmpW(pLocalName, startup) == 0)
+ if (nLocalName == ARRAY_SIZE(startup) - 1 && lstrcmpW(pLocalName, startup) == 0)
{
hr = parse_startup(This, pAttr);
This->states[++This->statenum] = STATE_STARTUP;
break;
}
- else if (nLocalName == sizeof(runtime)/sizeof(WCHAR)-1 &&
- lstrcmpW(pLocalName, runtime) == 0)
+ else if (nLocalName == ARRAY_SIZE(runtime) - 1 && lstrcmpW(pLocalName, runtime) == 0)
{
This->states[++This->statenum] = STATE_RUNTIME;
break;
@@ -451,7 +448,7 @@ static HRESULT WINAPI ConfigFileHandler_startElement(ISAXContentHandler *iface,
else
goto unknown;
case STATE_RUNTIME:
- if (nLocalName == sizeof(assemblyBinding)/sizeof(WCHAR)-1 &&
+ if (nLocalName == ARRAY_SIZE(assemblyBinding) - 1 &&
lstrcmpW(pLocalName, assemblyBinding) == 0)
{
This->states[++This->statenum] = STATE_ASSEMBLY_BINDING;
@@ -460,8 +457,7 @@ static HRESULT WINAPI ConfigFileHandler_startElement(ISAXContentHandler *iface,
else
goto unknown;
case STATE_ASSEMBLY_BINDING:
- if (nLocalName == sizeof(probing)/sizeof(WCHAR)-1 &&
- lstrcmpW(pLocalName, probing) == 0)
+ if (nLocalName == ARRAY_SIZE(probing) - 1 && lstrcmpW(pLocalName, probing) == 0)
{
hr = parse_probing(This, pAttr);
This->states[++This->statenum] = STATE_PROBING;
@@ -470,7 +466,7 @@ static HRESULT WINAPI ConfigFileHandler_startElement(ISAXContentHandler *iface,
else
goto unknown;
case STATE_STARTUP:
- if (nLocalName == sizeof(supportedRuntime)/sizeof(WCHAR)-1 &&
+ if (nLocalName == ARRAY_SIZE(supportedRuntime) - 1 &&
lstrcmpW(pLocalName, supportedRuntime) == 0)
{
hr = parse_supported_runtime(This, pAttr);
diff --git a/dlls/mscoree/corruntimehost.c b/dlls/mscoree/corruntimehost.c
index 0c933cac29..5c4e7f1d6e 100644
--- a/dlls/mscoree/corruntimehost.c
+++ b/dlls/mscoree/corruntimehost.c
@@ -138,7 +138,7 @@ static HRESULT RuntimeHost_GetDefaultDomain(RuntimeHost *This, const WCHAR *conf
if (!config_path)
{
- DWORD len = sizeof(config_dir)/sizeof(*config_dir);
+ DWORD len = ARRAY_SIZE(config_dir);
static const WCHAR machine_configW[] = {'\\','C','O','N','F','I','G','\\','m','a','c','h','i','n','e','.','c','o','n','f','i','g',0};
@@ -159,7 +159,7 @@ static HRESULT RuntimeHost_GetDefaultDomain(RuntimeHost *This, const WCHAR *conf
goto end;
}
- GetModuleFileNameW(NULL, base_dir, sizeof(base_dir) / sizeof(*base_dir));
+ GetModuleFileNameW(NULL, base_dir, ARRAY_SIZE(base_dir));
base_dirA = WtoA(base_dir);
if (!base_dirA)
{
@@ -1674,7 +1674,7 @@ HRESULT create_monodata(REFIID riid, LPVOID *ppObj )
if (res != ERROR_SUCCESS || numKeys == 0)
goto cleanup;
numKeys--;
- keyLength = sizeof(subkeyName) / sizeof(WCHAR);
+ keyLength = ARRAY_SIZE(subkeyName);
res = RegEnumKeyExW(key, numKeys, subkeyName, &keyLength, 0, 0, 0, 0);
if (res != ERROR_SUCCESS)
goto cleanup;
diff --git a/dlls/mscoree/mscoree_main.c b/dlls/mscoree/mscoree_main.c
index eda380a1ca..5612ff6b89 100644
--- a/dlls/mscoree/mscoree_main.c
+++ b/dlls/mscoree/mscoree_main.c
@@ -751,7 +751,7 @@ static BOOL install_wine_mono(void)
}
}
- len = GetSystemDirectoryW(app, MAX_PATH-sizeof(controlW)/sizeof(WCHAR));
+ len = GetSystemDirectoryW(app, MAX_PATH - ARRAY_SIZE(controlW));
memcpy(app+len, controlW, sizeof(controlW));
args = HeapAlloc(GetProcessHeap(), 0, (len*sizeof(WCHAR) + sizeof(controlW) + sizeof(argsW)));
@@ -759,7 +759,7 @@ static BOOL install_wine_mono(void)
return FALSE;
memcpy(args, app, len*sizeof(WCHAR) + sizeof(controlW));
- memcpy(args + len + sizeof(controlW)/sizeof(WCHAR)-1, argsW, sizeof(argsW));
+ memcpy(args + len + ARRAY_SIZE(controlW) - 1, argsW, sizeof(argsW));
TRACE("starting %s\n", debugstr_w(args));
--
2.14.4

View File

@ -1,433 +0,0 @@
From dc0c77b7ac781b47159fba8c2e043bcfb226912b Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Sat, 28 Jul 2018 00:04:52 +0200
Subject: [PATCH] dxdiagn: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/dxdiagn/provider.c | 92 +++++++++++++++++-----------------
include/wine/server_protocol.h | 21 +++++++-
server/request.h | 8 +++
server/trace.c | 15 ++++++
4 files changed, 90 insertions(+), 46 deletions(-)
diff --git a/dlls/dxdiagn/provider.c b/dlls/dxdiagn/provider.c
index 1fdab5e2db..ec30574b84 100644
--- a/dlls/dxdiagn/provider.c
+++ b/dlls/dxdiagn/provider.c
@@ -494,7 +494,7 @@ static BOOL is_netmeeting_running(void)
for (i = 0; i < list_count; i++)
{
- if (get_process_name_from_pid(pid_list[i], process_name, sizeof(process_name)/sizeof(WCHAR)) &&
+ if (get_process_name_from_pid(pid_list[i], process_name, ARRAY_SIZE(process_name)) &&
!lstrcmpW(conf_exe, process_name))
{
HeapFree(GetProcessHeap(), 0, pid_list);
@@ -518,21 +518,23 @@ static HRESULT fill_language_information(IDxDiagContainerImpl_Container *node)
HRESULT hr;
/* szLanguagesLocalized */
- GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_SNATIVELANGNAME, system_lang, sizeof(system_lang)/sizeof(WCHAR));
- LoadStringW(dxdiagn_instance, IDS_REGIONAL_SETTING, regional_setting, sizeof(regional_setting)/sizeof(WCHAR));
- GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SNATIVELANGNAME, user_lang, sizeof(user_lang)/sizeof(WCHAR));
+ GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_SNATIVELANGNAME, system_lang, ARRAY_SIZE(system_lang));
+ LoadStringW(dxdiagn_instance, IDS_REGIONAL_SETTING, regional_setting, ARRAY_SIZE(regional_setting));
+ GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SNATIVELANGNAME, user_lang, ARRAY_SIZE(user_lang));
- snprintfW(language_str, sizeof(language_str)/sizeof(WCHAR), languages_fmtW, system_lang, regional_setting, user_lang);
+ snprintfW(language_str, ARRAY_SIZE(language_str), languages_fmtW, system_lang, regional_setting,
+ user_lang);
hr = add_bstr_property(node, szLanguagesLocalized, language_str);
if (FAILED(hr))
return hr;
/* szLanguagesEnglish */
- GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_SENGLANGUAGE, system_lang, sizeof(system_lang)/sizeof(WCHAR));
- GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SENGLANGUAGE, user_lang, sizeof(user_lang)/sizeof(WCHAR));
+ GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_SENGLANGUAGE, system_lang, ARRAY_SIZE(system_lang));
+ GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SENGLANGUAGE, user_lang, ARRAY_SIZE(user_lang));
- snprintfW(language_str, sizeof(language_str)/sizeof(WCHAR), languages_fmtW, system_lang, regional_setting_engW, user_lang);
+ snprintfW(language_str, ARRAY_SIZE(language_str), languages_fmtW, system_lang,
+ regional_setting_engW, user_lang);
hr = add_bstr_property(node, szLanguagesEnglish, language_str);
if (FAILED(hr))
@@ -555,21 +557,21 @@ static HRESULT fill_datetime_information(IDxDiagContainerImpl_Container *node)
GetLocalTime(&curtime);
- GetTimeFormatW(LOCALE_NEUTRAL, 0, &curtime, time_fmtW, time_str, sizeof(time_str)/sizeof(WCHAR));
+ GetTimeFormatW(LOCALE_NEUTRAL, 0, &curtime, time_fmtW, time_str, ARRAY_SIZE(time_str));
/* szTimeLocalized */
- GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, &curtime, NULL, date_str, sizeof(date_str)/sizeof(WCHAR));
+ GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, &curtime, NULL, date_str, ARRAY_SIZE(date_str));
- snprintfW(datetime_str, sizeof(datetime_str)/sizeof(WCHAR), datetime_fmtW, date_str, time_str);
+ snprintfW(datetime_str, ARRAY_SIZE(datetime_str), datetime_fmtW, date_str, time_str);
hr = add_bstr_property(node, szTimeLocalized, datetime_str);
if (FAILED(hr))
return hr;
/* szTimeEnglish */
- GetDateFormatW(LOCALE_NEUTRAL, 0, &curtime, date_fmtW, date_str, sizeof(date_str)/sizeof(WCHAR));
+ GetDateFormatW(LOCALE_NEUTRAL, 0, &curtime, date_fmtW, date_str, ARRAY_SIZE(date_str));
- snprintfW(datetime_str, sizeof(datetime_str)/sizeof(WCHAR), datetime_fmtW, date_str, time_str);
+ snprintfW(datetime_str, ARRAY_SIZE(datetime_str), datetime_fmtW, date_str, time_str);
hr = add_bstr_property(node, szTimeEnglish, datetime_str);
if (FAILED(hr))
@@ -596,7 +598,7 @@ static HRESULT fill_os_string_information(IDxDiagContainerImpl_Container *node,
/* FIXME: OS detection should be performed, and localized OS strings
* should contain translated versions of the "build" phrase. */
- for (i = 0; i < sizeof(prop_list)/sizeof(prop_list[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(prop_list); i++)
{
hr = add_bstr_property(node, prop_list[i], winxpW);
if (FAILED(hr))
@@ -798,25 +800,26 @@ static HRESULT build_systeminfo_tree(IDxDiagContainerImpl_Container *node)
return hr;
/* FIXME: Roundoff should not be done with truncated division. */
- snprintfW(print_buf, sizeof(print_buf)/sizeof(WCHAR), physmem_fmtW, (DWORD)(msex.ullTotalPhys / (1024 * 1024)));
+ snprintfW(print_buf, ARRAY_SIZE(print_buf), physmem_fmtW,
+ (DWORD)(msex.ullTotalPhys / (1024 * 1024)));
hr = add_bstr_property(node, szPhysicalMemoryEnglish, print_buf);
if (FAILED(hr))
return hr;
usedpage_mb = (DWORD)((msex.ullTotalPageFile - msex.ullAvailPageFile) / (1024 * 1024));
availpage_mb = (DWORD)(msex.ullAvailPageFile / (1024 * 1024));
- LoadStringW(dxdiagn_instance, IDS_PAGE_FILE_FORMAT, localized_pagefile_fmt, sizeof(localized_pagefile_fmt)/sizeof(WCHAR));
+ LoadStringW(dxdiagn_instance, IDS_PAGE_FILE_FORMAT, localized_pagefile_fmt,
+ ARRAY_SIZE(localized_pagefile_fmt));
args[0] = usedpage_mb;
args[1] = availpage_mb;
- FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY,
- localized_pagefile_fmt, 0, 0, print_buf,
- sizeof(print_buf)/sizeof(*print_buf), (__ms_va_list*)args);
+ FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY, localized_pagefile_fmt,
+ 0, 0, print_buf, ARRAY_SIZE(print_buf), (__ms_va_list*)args);
hr = add_bstr_property(node, szPageFileLocalized, print_buf);
if (FAILED(hr))
return hr;
- snprintfW(print_buf, sizeof(print_buf)/sizeof(WCHAR), pagefile_fmtW, usedpage_mb, availpage_mb);
+ snprintfW(print_buf, ARRAY_SIZE(print_buf), pagefile_fmtW, usedpage_mb, availpage_mb);
hr = add_bstr_property(node, szPageFileEnglish, print_buf);
if (FAILED(hr))
@@ -828,7 +831,7 @@ static HRESULT build_systeminfo_tree(IDxDiagContainerImpl_Container *node)
if (FAILED(hr))
return hr;
- count = sizeof(computer_name)/sizeof(WCHAR);
+ count = ARRAY_SIZE(computer_name);
if (!GetComputerNameW(computer_name, &count))
return E_FAIL;
@@ -984,7 +987,7 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node
DWORD available_mem = 0;
BOOL hardware_accel;
- snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), adapterid_fmtW, index);
+ snprintfW(buffer, ARRAY_SIZE(buffer), adapterid_fmtW, index);
display_adapter = allocate_information_node(buffer);
if (!display_adapter)
{
@@ -1001,9 +1004,11 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node
WCHAR descriptionW[sizeof(adapter_info.Description)];
WCHAR devicenameW[sizeof(adapter_info.DeviceName)];
- MultiByteToWideChar(CP_ACP, 0, adapter_info.Driver, -1, driverW, sizeof(driverW)/sizeof(WCHAR));
- MultiByteToWideChar(CP_ACP, 0, adapter_info.Description, -1, descriptionW, sizeof(descriptionW)/sizeof(WCHAR));
- MultiByteToWideChar(CP_ACP, 0, adapter_info.DeviceName, -1, devicenameW, sizeof(devicenameW)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, adapter_info.Driver, -1, driverW, ARRAY_SIZE(driverW));
+ MultiByteToWideChar(CP_ACP, 0, adapter_info.Description, -1, descriptionW,
+ ARRAY_SIZE(descriptionW));
+ MultiByteToWideChar(CP_ACP, 0, adapter_info.DeviceName, -1, devicenameW,
+ ARRAY_SIZE(devicenameW));
hr = add_bstr_property(display_adapter, szDriverName, driverW);
if (FAILED(hr))
@@ -1017,7 +1022,7 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node
if (FAILED(hr))
goto cleanup;
- snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), driverversion_fmtW,
+ snprintfW(buffer, ARRAY_SIZE(buffer), driverversion_fmtW,
HIWORD(adapter_info.DriverVersion.u.HighPart), LOWORD(adapter_info.DriverVersion.u.HighPart),
HIWORD(adapter_info.DriverVersion.u.LowPart), LOWORD(adapter_info.DriverVersion.u.LowPart));
@@ -1025,22 +1030,22 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node
if (FAILED(hr))
goto cleanup;
- snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), id_fmtW, adapter_info.VendorId);
+ snprintfW(buffer, ARRAY_SIZE(buffer), id_fmtW, adapter_info.VendorId);
hr = add_bstr_property(display_adapter, szVendorId, buffer);
if (FAILED(hr))
goto cleanup;
- snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), id_fmtW, adapter_info.DeviceId);
+ snprintfW(buffer, ARRAY_SIZE(buffer), id_fmtW, adapter_info.DeviceId);
hr = add_bstr_property(display_adapter, szDeviceId, buffer);
if (FAILED(hr))
goto cleanup;
- snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), subsysid_fmtW, adapter_info.SubSysId);
+ snprintfW(buffer, ARRAY_SIZE(buffer), subsysid_fmtW, adapter_info.SubSysId);
hr = add_bstr_property(display_adapter, szSubSysId, buffer);
if (FAILED(hr))
goto cleanup;
- snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), id_fmtW, adapter_info.Revision);
+ snprintfW(buffer, ARRAY_SIZE(buffer), id_fmtW, adapter_info.Revision);
hr = add_bstr_property(display_adapter, szRevisionId, buffer);
if (FAILED(hr))
goto cleanup;
@@ -1074,7 +1079,7 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node
if (FAILED(hr))
goto cleanup;
- snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), mode_fmtW, adapter_mode.Width, adapter_mode.Height,
+ snprintfW(buffer, ARRAY_SIZE(buffer), mode_fmtW, adapter_mode.Width, adapter_mode.Height,
depth_for_pixelformat(adapter_mode.Format), adapter_mode.RefreshRate);
hr = add_bstr_property(display_adapter, szDisplayModeLocalized, buffer);
@@ -1109,7 +1114,7 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node
if (!get_texture_memory(&adapter_info.DeviceIdentifier, &available_mem))
WARN("get_texture_memory helper failed\n");
- snprintfW(buffer, sizeof(buffer)/sizeof(buffer[0]), mem_fmt, available_mem / 1000000.0f);
+ snprintfW(buffer, ARRAY_SIZE(buffer), mem_fmt, available_mem / 1000000.0f);
hr = add_bstr_property(display_adapter, szDisplayMemoryLocalized, buffer);
if (FAILED(hr))
@@ -1288,7 +1293,7 @@ static HRESULT fill_display_information_fallback(IDxDiagContainerImpl_Container
{
static const WCHAR mem_fmt[] = {'%','.','1','f',' ','M','B',0};
- snprintfW(buffer, sizeof(buffer)/sizeof(buffer[0]), mem_fmt, tmp / 1000000.0f);
+ snprintfW(buffer, ARRAY_SIZE(buffer), mem_fmt, tmp / 1000000.0f);
hr = add_bstr_property(display_adapter, szDisplayMemoryLocalized, buffer);
if (FAILED(hr))
@@ -1329,7 +1334,7 @@ static HRESULT fill_display_information_fallback(IDxDiagContainerImpl_Container
if (FAILED(hr))
goto cleanup;
- for (tmp = 0; tmp < sizeof(empty_properties)/sizeof(empty_properties[0]); tmp++)
+ for (tmp = 0; tmp < ARRAY_SIZE(empty_properties); tmp++)
{
hr = add_bstr_property(display_adapter, empty_properties[tmp], szEmpty);
if (FAILED(hr))
@@ -1465,12 +1470,9 @@ static HRESULT fill_file_description(IDxDiagContainerImpl_Container *node, const
if (boolret)
{
- snprintfW(szVersion_v, sizeof(szVersion_v)/sizeof(szVersion_v[0]),
- szVersionFormat,
- HIWORD(pFileInfo->dwFileVersionMS),
- LOWORD(pFileInfo->dwFileVersionMS),
- HIWORD(pFileInfo->dwFileVersionLS),
- LOWORD(pFileInfo->dwFileVersionLS));
+ snprintfW(szVersion_v, ARRAY_SIZE(szVersion_v), szVersionFormat,
+ HIWORD(pFileInfo->dwFileVersionMS), LOWORD(pFileInfo->dwFileVersionMS),
+ HIWORD(pFileInfo->dwFileVersionLS), LOWORD(pFileInfo->dwFileVersionLS));
TRACE("Found version as (%s)\n", debugstr_w(szVersion_v));
@@ -1542,14 +1544,14 @@ static HRESULT build_directxfiles_tree(IDxDiagContainerImpl_Container *node)
GetSystemDirectoryW(szFilePath, MAX_PATH);
- for (i = 0; i < sizeof(dlls) / sizeof(dlls[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(dlls); i++)
{
static const WCHAR szFormat[] = {'%','d',0};
WCHAR szFileID[5];
IDxDiagContainerImpl_Container *file_container;
- snprintfW(szFileID, sizeof(szFileID)/sizeof(szFileID[0]), szFormat, i);
+ snprintfW(szFileID, ARRAY_SIZE(szFileID), szFormat, i);
file_container = allocate_information_node(szFileID);
if (!file_container)
@@ -1624,7 +1626,7 @@ static HRESULT fill_filter_data_information(IDxDiagContainerImpl_Container *subc
goto cleanup;
pRF = ((REGFILTER2**)ppRF)[0];
- snprintfW(bufferW, sizeof(bufferW)/sizeof(bufferW[0]), szVersionFormat, pRF->dwVersion);
+ snprintfW(bufferW, ARRAY_SIZE(bufferW), szVersionFormat, pRF->dwVersion);
hr = add_bstr_property(subcont, szVersionW, bufferW);
if (FAILED(hr))
goto cleanup;
@@ -1796,7 +1798,7 @@ static HRESULT build_directshowfilters_tree(IDxDiagContainerImpl_Container *node
WCHAR bufferW[10];
IDxDiagContainerImpl_Container *subcont;
- snprintfW(bufferW, sizeof(bufferW)/sizeof(bufferW[0]), szIdFormat, i);
+ snprintfW(bufferW, ARRAY_SIZE(bufferW), szIdFormat, i);
subcont = allocate_information_node(bufferW);
if (!subcont)
{
@@ -1893,7 +1895,7 @@ static HRESULT build_information_tree(IDxDiagContainerImpl_Container **pinfo_roo
if (!info_root)
return E_OUTOFMEMORY;
- for (index = 0; index < sizeof(root_children)/sizeof(root_children[0]); index++)
+ for (index = 0; index < ARRAY_SIZE(root_children); index++)
{
IDxDiagContainerImpl_Container *node;
HRESULT hr;
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 511ad5c628..b776d8dc6d 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -1839,6 +1839,22 @@ struct open_console_reply
+struct attach_console_request
+{
+ struct request_header __header;
+ process_id_t pid;
+};
+struct attach_console_reply
+{
+ struct reply_header __header;
+ obj_handle_t std_in;
+ obj_handle_t std_out;
+ obj_handle_t std_err;
+ char __pad_20[4];
+};
+
+
+
struct get_console_wait_event_request
{
struct request_header __header;
@@ -5697,6 +5713,7 @@ enum request
REQ_free_console,
REQ_get_console_renderer_events,
REQ_open_console,
+ REQ_attach_console,
REQ_get_console_wait_event,
REQ_get_console_mode,
REQ_set_console_mode,
@@ -5993,6 +6010,7 @@ union generic_request
struct free_console_request free_console_request;
struct get_console_renderer_events_request get_console_renderer_events_request;
struct open_console_request open_console_request;
+ struct attach_console_request attach_console_request;
struct get_console_wait_event_request get_console_wait_event_request;
struct get_console_mode_request get_console_mode_request;
struct set_console_mode_request set_console_mode_request;
@@ -6287,6 +6305,7 @@ union generic_reply
struct free_console_reply free_console_reply;
struct get_console_renderer_events_reply get_console_renderer_events_reply;
struct open_console_reply open_console_reply;
+ struct attach_console_reply attach_console_reply;
struct get_console_wait_event_reply get_console_wait_event_reply;
struct get_console_mode_reply get_console_mode_reply;
struct set_console_mode_reply set_console_mode_reply;
@@ -6514,6 +6533,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply;
};
-#define SERVER_PROTOCOL_VERSION 555
+#define SERVER_PROTOCOL_VERSION 560
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/request.h b/server/request.h
index 10fd850ec1..d3028f0b1d 100644
--- a/server/request.h
+++ b/server/request.h
@@ -176,6 +176,7 @@ DECL_HANDLER(alloc_console);
DECL_HANDLER(free_console);
DECL_HANDLER(get_console_renderer_events);
DECL_HANDLER(open_console);
+DECL_HANDLER(attach_console);
DECL_HANDLER(get_console_wait_event);
DECL_HANDLER(get_console_mode);
DECL_HANDLER(set_console_mode);
@@ -471,6 +472,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_free_console,
(req_handler)req_get_console_renderer_events,
(req_handler)req_open_console,
+ (req_handler)req_attach_console,
(req_handler)req_get_console_wait_event,
(req_handler)req_get_console_mode,
(req_handler)req_set_console_mode,
@@ -1120,6 +1122,12 @@ C_ASSERT( FIELD_OFFSET(struct open_console_request, share) == 24 );
C_ASSERT( sizeof(struct open_console_request) == 32 );
C_ASSERT( FIELD_OFFSET(struct open_console_reply, handle) == 8 );
C_ASSERT( sizeof(struct open_console_reply) == 16 );
+C_ASSERT( FIELD_OFFSET(struct attach_console_request, pid) == 12 );
+C_ASSERT( sizeof(struct attach_console_request) == 16 );
+C_ASSERT( FIELD_OFFSET(struct attach_console_reply, std_in) == 8 );
+C_ASSERT( FIELD_OFFSET(struct attach_console_reply, std_out) == 12 );
+C_ASSERT( FIELD_OFFSET(struct attach_console_reply, std_err) == 16 );
+C_ASSERT( sizeof(struct attach_console_reply) == 24 );
C_ASSERT( sizeof(struct get_console_wait_event_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_console_wait_event_reply, handle) == 8 );
C_ASSERT( sizeof(struct get_console_wait_event_reply) == 16 );
diff --git a/server/trace.c b/server/trace.c
index e6ed964e16..17d25bbf79 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -1989,6 +1989,18 @@ static void dump_open_console_reply( const struct open_console_reply *req )
fprintf( stderr, " handle=%04x", req->handle );
}
+static void dump_attach_console_request( const struct attach_console_request *req )
+{
+ fprintf( stderr, " pid=%04x", req->pid );
+}
+
+static void dump_attach_console_reply( const struct attach_console_reply *req )
+{
+ fprintf( stderr, " std_in=%04x", req->std_in );
+ fprintf( stderr, ", std_out=%04x", req->std_out );
+ fprintf( stderr, ", std_err=%04x", req->std_err );
+}
+
static void dump_get_console_wait_event_request( const struct get_console_wait_event_request *req )
{
}
@@ -4595,6 +4607,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_free_console_request,
(dump_func)dump_get_console_renderer_events_request,
(dump_func)dump_open_console_request,
+ (dump_func)dump_attach_console_request,
(dump_func)dump_get_console_wait_event_request,
(dump_func)dump_get_console_mode_request,
(dump_func)dump_set_console_mode_request,
@@ -4887,6 +4900,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
NULL,
(dump_func)dump_get_console_renderer_events_reply,
(dump_func)dump_open_console_reply,
+ (dump_func)dump_attach_console_reply,
(dump_func)dump_get_console_wait_event_reply,
(dump_func)dump_get_console_mode_reply,
NULL,
@@ -5179,6 +5193,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"free_console",
"get_console_renderer_events",
"open_console",
+ "attach_console",
"get_console_wait_event",
"get_console_mode",
"set_console_mode",
--
2.18.0

View File

@ -1,52 +0,0 @@
From 100f6ad44eacdb2265652b56c048a68efbbff7c0 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 30 Jul 2018 21:18:07 +0200
Subject: [PATCH] localui: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/localui/localui.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/localui/localui.c b/dlls/localui/localui.c
index 9fb975c..77c8bf0 100644
--- a/dlls/localui/localui.c
+++ b/dlls/localui/localui.c
@@ -375,7 +375,7 @@ static INT_PTR CALLBACK dlgproc_lptconfig(HWND hwnd, UINT msg, WPARAM wparam, LP
status = FALSE;
res = GetDlgItemInt(hwnd, LPTCONFIG_EDIT, (BOOL *) &status, FALSE);
/* length is in WCHAR, including the '\0' */
- GetDlgItemTextW(hwnd, LPTCONFIG_EDIT, bufferW, sizeof(bufferW) / sizeof(bufferW[0]));
+ GetDlgItemTextW(hwnd, LPTCONFIG_EDIT, bufferW, ARRAY_SIZE(bufferW));
TRACE("got %s and %u (translated: %u)\n", debugstr_w(bufferW), res, status);
/* native localui.dll use the same limits */
@@ -416,10 +416,10 @@ static DWORD get_type_from_name(LPCWSTR name)
{
HANDLE hfile;
- if (!strncmpiW(name, portname_LPT, sizeof(portname_LPT) / sizeof(WCHAR) -1))
+ if (!strncmpiW(name, portname_LPT, ARRAY_SIZE(portname_LPT) -1))
return PORT_IS_LPT;
- if (!strncmpiW(name, portname_COM, sizeof(portname_COM) / sizeof(WCHAR) -1))
+ if (!strncmpiW(name, portname_COM, ARRAY_SIZE(portname_COM) -1))
return PORT_IS_COM;
if (!strcmpiW(name, portname_FILE))
@@ -431,10 +431,10 @@ static DWORD get_type_from_name(LPCWSTR name)
if (name[0] == '|')
return PORT_IS_PIPE;
- if (!strncmpW(name, portname_CUPS, sizeof(portname_CUPS) / sizeof(WCHAR) -1))
+ if (!strncmpW(name, portname_CUPS, ARRAY_SIZE(portname_CUPS) -1))
return PORT_IS_CUPS;
- if (!strncmpW(name, portname_LPR, sizeof(portname_LPR) / sizeof(WCHAR) -1))
+ if (!strncmpW(name, portname_LPR, ARRAY_SIZE(portname_LPR) -1))
return PORT_IS_LPR;
/* Must be a file or a directory. Does the file exist ? */
--
1.9.1

View File

@ -1,35 +0,0 @@
From ed22fdf12f19983647bfd60230dc1325998f95fd Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 30 Jul 2018 21:18:08 +0200
Subject: [PATCH] inetmib1: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/inetmib1/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/inetmib1/main.c b/dlls/inetmib1/main.c
index c0719c1..2f7b9ca 100644
--- a/dlls/inetmib1/main.c
+++ b/dlls/inetmib1/main.c
@@ -1321,7 +1321,7 @@ BOOL WINAPI SnmpExtensionInit(DWORD dwUptimeReference,
pFirstSupportedRegion);
minSupportedIDLength = UINT_MAX;
- for (i = 0; i < sizeof(supportedIDs) / sizeof(supportedIDs[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(supportedIDs); i++)
{
if (supportedIDs[i].init)
supportedIDs[i].init();
@@ -1337,7 +1337,7 @@ static void cleanup(void)
{
UINT i;
- for (i = 0; i < sizeof(supportedIDs) / sizeof(supportedIDs[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(supportedIDs); i++)
if (supportedIDs[i].cleanup)
supportedIDs[i].cleanup();
}
--
1.9.1

View File

@ -1,778 +0,0 @@
From 92a6c434182962704a0cc20bb675655063d2d894 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 30 Jul 2018 21:18:09 +0200
Subject: [PATCH] kernel32: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/kernel32/computername.c | 4 +--
dlls/kernel32/console.c | 4 +--
dlls/kernel32/file.c | 2 +-
dlls/kernel32/lcformat.c | 54 ++++++++++++++++++------------------
dlls/kernel32/locale.c | 66 +++++++++++++++++++++-----------------------
dlls/kernel32/module.c | 3 +-
dlls/kernel32/path.c | 2 +-
dlls/kernel32/process.c | 26 ++++++++---------
dlls/kernel32/profile.c | 7 ++---
dlls/kernel32/sync.c | 8 ++----
dlls/kernel32/term.c | 2 +-
dlls/kernel32/volume.c | 12 ++++----
12 files changed, 91 insertions(+), 99 deletions(-)
diff --git a/dlls/kernel32/computername.c b/dlls/kernel32/computername.c
index 1b5f4aa..720d4ba 100644
--- a/dlls/kernel32/computername.c
+++ b/dlls/kernel32/computername.c
@@ -538,9 +538,9 @@ static WCHAR netbios_char ( WCHAR wc )
static const WCHAR special[] = {'!','@','#','$','%','^','&','\'',')','(','-','_','{','}','~'};
static const WCHAR deflt = '_';
unsigned int i;
-
+
if ( isalnumW ( wc ) ) return wc;
- for ( i = 0; i < sizeof (special) / sizeof (WCHAR); i++ )
+ for ( i = 0; i < ARRAY_SIZE( special ); i++ )
if ( wc == special[i] ) return wc;
return deflt;
}
diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c
index 51061de..8b98a50 100644
--- a/dlls/kernel32/console.c
+++ b/dlls/kernel32/console.c
@@ -1156,7 +1156,7 @@ static enum read_console_input_return bare_console_fetch_input(HANDLE handle, in
break;
case -1:
/* we haven't found the string into key-db, push full input string into server */
- idxw = MultiByteToWideChar(CP_UNIXCP, 0, input, idx, inputw, sizeof(inputw) / sizeof(inputw[0]));
+ idxw = MultiByteToWideChar(CP_UNIXCP, 0, input, idx, inputw, ARRAY_SIZE(inputw));
/* we cannot translate yet... likely we need more chars (wait max 1/2s for next char) */
if (idxw == 0)
@@ -1831,7 +1831,7 @@ BOOL WINAPI SetConsoleInputExeNameW(LPCWSTR name)
}
RtlEnterCriticalSection(&CONSOLE_CritSect);
- if (strlenW(name) < sizeof(input_exe)/sizeof(WCHAR)) strcpyW(input_exe, name);
+ if (strlenW(name) < ARRAY_SIZE(input_exe)) strcpyW(input_exe, name);
RtlLeaveCriticalSection(&CONSOLE_CritSect);
return TRUE;
diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c
index 1e5b9fe..0c30fb7 100644
--- a/dlls/kernel32/file.c
+++ b/dlls/kernel32/file.c
@@ -1513,7 +1513,7 @@ HANDLE WINAPI CreateFileW( LPCWSTR filename, DWORD access, DWORD sharing,
static const WCHAR conW[] = {'C','O','N'};
if (LOWORD(dosdev) == sizeof(conW) &&
- !memicmpW( filename + HIWORD(dosdev)/sizeof(WCHAR), conW, sizeof(conW)/sizeof(WCHAR)))
+ !memicmpW( filename + HIWORD(dosdev)/sizeof(WCHAR), conW, ARRAY_SIZE( conW )))
{
switch (access & (GENERIC_READ|GENERIC_WRITE))
{
diff --git a/dlls/kernel32/lcformat.c b/dlls/kernel32/lcformat.c
index aeb48c6..b1dd32d 100644
--- a/dlls/kernel32/lcformat.c
+++ b/dlls/kernel32/lcformat.c
@@ -104,7 +104,7 @@ static DWORD NLS_GetLocaleNumber(LCID lcid, DWORD dwFlags)
DWORD dwVal = 0;
szBuff[0] = '\0';
- GetLocaleInfoW(lcid, dwFlags, szBuff, sizeof(szBuff) / sizeof(WCHAR));
+ GetLocaleInfoW(lcid, dwFlags, szBuff, ARRAY_SIZE(szBuff));
if (szBuff[0] && szBuff[1] == ';' && szBuff[2] != '0')
dwVal = (szBuff[0] - '0') * 10 + (szBuff[2] - '0');
@@ -129,7 +129,7 @@ static WCHAR* NLS_GetLocaleString(LCID lcid, DWORD dwFlags)
DWORD dwLen;
szBuff[0] = '\0';
- GetLocaleInfoW(lcid, dwFlags, szBuff, sizeof(szBuff) / sizeof(WCHAR));
+ GetLocaleInfoW(lcid, dwFlags, szBuff, ARRAY_SIZE(szBuff));
dwLen = strlenW(szBuff) + 1;
str = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
if (str)
@@ -258,7 +258,7 @@ static const NLS_FORMAT_NODE *NLS_GetFormats(LCID lcid, DWORD dwFlags)
GET_LOCALE_STRING(new_node->cyfmt.lpCurrencySymbol, LOCALE_SCURRENCY);
/* Date/Time Format info, negative character, etc */
- for (i = 0; i < sizeof(NLS_LocaleIndices)/sizeof(NLS_LocaleIndices[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(NLS_LocaleIndices); i++)
{
GET_LOCALE_STRING(new_node->lppszStrings[i], NLS_LocaleIndices[i]);
}
@@ -302,7 +302,7 @@ static const NLS_FORMAT_NODE *NLS_GetFormats(LCID lcid, DWORD dwFlags)
/* We raced and lost: The node was already added by another thread.
* node points to the currently cached node, so free new_node.
*/
- for (i = 0; i < sizeof(NLS_LocaleIndices)/sizeof(NLS_LocaleIndices[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(NLS_LocaleIndices); i++)
HeapFree(GetProcessHeap(), 0, new_node->lppszStrings[i]);
HeapFree(GetProcessHeap(), 0, new_node->fmt.lpDecimalSep);
HeapFree(GetProcessHeap(), 0, new_node->fmt.lpThousandSep);
@@ -677,7 +677,7 @@ static INT NLS_GetDateTimeFormatW(LCID lcid, DWORD dwFlags,
{
static const WCHAR fmtW[] = {'%','.','*','d',0};
/* We have a numeric value to add */
- snprintfW(buff, sizeof(buff)/sizeof(WCHAR), fmtW, count, dwVal);
+ snprintfW(buff, ARRAY_SIZE(buff), fmtW, count, dwVal);
}
dwLen = szAdd ? strlenW(szAdd) : 0;
@@ -773,10 +773,10 @@ static INT NLS_GetDateTimeFormatA(LCID lcid, DWORD dwFlags,
}
if (lpFormat)
- MultiByteToWideChar(cp, 0, lpFormat, -1, szFormat, sizeof(szFormat)/sizeof(WCHAR));
+ MultiByteToWideChar(cp, 0, lpFormat, -1, szFormat, ARRAY_SIZE(szFormat));
- if (cchOut > (int)(sizeof(szOut)/sizeof(WCHAR)))
- cchOut = sizeof(szOut)/sizeof(WCHAR);
+ if (cchOut > (int) ARRAY_SIZE(szOut))
+ cchOut = ARRAY_SIZE(szOut);
szOut[0] = '\0';
@@ -1063,21 +1063,21 @@ INT WINAPI GetNumberFormatA(LCID lcid, DWORD dwFlags,
pfmt = &fmt;
if (lpFormat->lpDecimalSep)
{
- MultiByteToWideChar(cp, 0, lpFormat->lpDecimalSep, -1, szDec, sizeof(szDec)/sizeof(WCHAR));
+ MultiByteToWideChar(cp, 0, lpFormat->lpDecimalSep, -1, szDec, ARRAY_SIZE(szDec));
fmt.lpDecimalSep = szDec;
}
if (lpFormat->lpThousandSep)
{
- MultiByteToWideChar(cp, 0, lpFormat->lpThousandSep, -1, szGrp, sizeof(szGrp)/sizeof(WCHAR));
+ MultiByteToWideChar(cp, 0, lpFormat->lpThousandSep, -1, szGrp, ARRAY_SIZE(szGrp));
fmt.lpThousandSep = szGrp;
}
}
if (lpszValue)
- MultiByteToWideChar(cp, 0, lpszValue, -1, szIn, sizeof(szIn)/sizeof(WCHAR));
+ MultiByteToWideChar(cp, 0, lpszValue, -1, szIn, ARRAY_SIZE(szIn));
- if (cchOut > (int)(sizeof(szOut)/sizeof(WCHAR)))
- cchOut = sizeof(szOut)/sizeof(WCHAR);
+ if (cchOut > (int) ARRAY_SIZE(szOut))
+ cchOut = ARRAY_SIZE(szOut);
szOut[0] = '\0';
@@ -1112,7 +1112,7 @@ INT WINAPI GetNumberFormatW(LCID lcid, DWORD dwFlags,
LPCWSTR lpszValue, const NUMBERFMTW *lpFormat,
LPWSTR lpNumberStr, int cchOut)
{
- WCHAR szBuff[128], *szOut = szBuff + sizeof(szBuff) / sizeof(WCHAR) - 1;
+ WCHAR szBuff[128], *szOut = szBuff + ARRAY_SIZE(szBuff) - 1;
WCHAR szNegBuff[8];
const WCHAR *lpszNeg = NULL, *lpszNegStart, *szSrc;
DWORD dwState = 0, dwDecimals = 0, dwGroupCount = 0, dwCurrentGroupCount = 0;
@@ -1140,7 +1140,7 @@ INT WINAPI GetNumberFormatW(LCID lcid, DWORD dwFlags,
else
{
GetLocaleInfoW(lcid, LOCALE_SNEGATIVESIGN|(dwFlags & LOCALE_NOUSEROVERRIDE),
- szNegBuff, sizeof(szNegBuff)/sizeof(WCHAR));
+ szNegBuff, ARRAY_SIZE(szNegBuff));
lpszNegStart = lpszNeg = szNegBuff;
}
lpszNeg = lpszNeg + strlenW(lpszNeg) - 1;
@@ -1427,26 +1427,26 @@ INT WINAPI GetCurrencyFormatA(LCID lcid, DWORD dwFlags,
pfmt = &fmt;
if (lpFormat->lpDecimalSep)
{
- MultiByteToWideChar(cp, 0, lpFormat->lpDecimalSep, -1, szDec, sizeof(szDec)/sizeof(WCHAR));
+ MultiByteToWideChar(cp, 0, lpFormat->lpDecimalSep, -1, szDec, ARRAY_SIZE(szDec));
fmt.lpDecimalSep = szDec;
}
if (lpFormat->lpThousandSep)
{
- MultiByteToWideChar(cp, 0, lpFormat->lpThousandSep, -1, szGrp, sizeof(szGrp)/sizeof(WCHAR));
+ MultiByteToWideChar(cp, 0, lpFormat->lpThousandSep, -1, szGrp, ARRAY_SIZE(szGrp));
fmt.lpThousandSep = szGrp;
}
if (lpFormat->lpCurrencySymbol)
{
- MultiByteToWideChar(cp, 0, lpFormat->lpCurrencySymbol, -1, szCy, sizeof(szCy)/sizeof(WCHAR));
+ MultiByteToWideChar(cp, 0, lpFormat->lpCurrencySymbol, -1, szCy, ARRAY_SIZE(szCy));
fmt.lpCurrencySymbol = szCy;
}
}
if (lpszValue)
- MultiByteToWideChar(cp, 0, lpszValue, -1, szIn, sizeof(szIn)/sizeof(WCHAR));
+ MultiByteToWideChar(cp, 0, lpszValue, -1, szIn, ARRAY_SIZE(szIn));
- if (cchOut > (int)(sizeof(szOut)/sizeof(WCHAR)))
- cchOut = sizeof(szOut)/sizeof(WCHAR);
+ if (cchOut > (int) ARRAY_SIZE(szOut))
+ cchOut = ARRAY_SIZE(szOut);
szOut[0] = '\0';
@@ -1502,7 +1502,7 @@ INT WINAPI GetCurrencyFormatW(LCID lcid, DWORD dwFlags,
CF_CY_LEFT|CF_CY_SPACE, /* $ 1.1 */
CF_CY_RIGHT|CF_CY_SPACE, /* 1.1 $ */
};
- WCHAR szBuff[128], *szOut = szBuff + sizeof(szBuff) / sizeof(WCHAR) - 1;
+ WCHAR szBuff[128], *szOut = szBuff + ARRAY_SIZE(szBuff) - 1;
WCHAR szNegBuff[8];
const WCHAR *lpszNeg = NULL, *lpszNegStart, *szSrc, *lpszCy, *lpszCyStart;
DWORD dwState = 0, dwDecimals = 0, dwGroupCount = 0, dwCurrentGroupCount = 0, dwFmt;
@@ -1533,7 +1533,7 @@ INT WINAPI GetCurrencyFormatW(LCID lcid, DWORD dwFlags,
else
{
GetLocaleInfoW(lcid, LOCALE_SNEGATIVESIGN|(dwFlags & LOCALE_NOUSEROVERRIDE),
- szNegBuff, sizeof(szNegBuff)/sizeof(WCHAR));
+ szNegBuff, ARRAY_SIZE(szNegBuff));
lpszNegStart = lpszNeg = szNegBuff;
}
dwFlags &= (LOCALE_NOUSEROVERRIDE|LOCALE_USE_CP_ACP);
@@ -1841,9 +1841,9 @@ static BOOL NLS_EnumDateFormats(const struct enumdateformats_context *ctxt)
lctype |= ctxt->flags & LOCALE_USE_CP_ACP;
if (ctxt->unicode)
- ret = GetLocaleInfoW(ctxt->lcid, lctype, bufW, sizeof(bufW)/sizeof(bufW[0]));
+ ret = GetLocaleInfoW(ctxt->lcid, lctype, bufW, ARRAY_SIZE(bufW));
else
- ret = GetLocaleInfoA(ctxt->lcid, lctype, bufA, sizeof(bufA)/sizeof(bufA[0]));
+ ret = GetLocaleInfoA(ctxt->lcid, lctype, bufA, ARRAY_SIZE(bufA));
if (ret)
{
@@ -1994,9 +1994,9 @@ static BOOL NLS_EnumTimeFormats(struct enumtimeformats_context *ctxt)
lctype |= ctxt->flags & LOCALE_USE_CP_ACP;
if (ctxt->unicode)
- ret = GetLocaleInfoW(ctxt->lcid, lctype, bufW, sizeof(bufW)/sizeof(bufW[0]));
+ ret = GetLocaleInfoW(ctxt->lcid, lctype, bufW, ARRAY_SIZE(bufW));
else
- ret = GetLocaleInfoA(ctxt->lcid, lctype, bufA, sizeof(bufA)/sizeof(bufA[0]));
+ ret = GetLocaleInfoA(ctxt->lcid, lctype, bufA, ARRAY_SIZE(bufA));
if (ret)
{
diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index 2e0cf83..0f37027 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -355,8 +355,7 @@ static UINT find_charset( const WCHAR *name )
if (isalnum((unsigned char)name[i])) charset_name[j++] = name[i];
charset_name[j] = 0;
- entry = bsearch( charset_name, charset_names,
- sizeof(charset_names)/sizeof(charset_names[0]),
+ entry = bsearch( charset_name, charset_names, ARRAY_SIZE( charset_names ),
sizeof(charset_names[0]), charset_cmp );
if (entry) return entry->codepage;
return 0;
@@ -395,8 +394,7 @@ static BOOL CALLBACK find_locale_id_callback( HMODULE hModule, LPCWSTR type,
/* first check exact name */
if (data->win_name[0] &&
- GetLocaleInfoW( lcid, LOCALE_SNAME | LOCALE_NOUSEROVERRIDE,
- buffer, sizeof(buffer)/sizeof(WCHAR) ))
+ GetLocaleInfoW( lcid, LOCALE_SNAME | LOCALE_NOUSEROVERRIDE, buffer, ARRAY_SIZE( buffer )))
{
if (!strcmpiW( data->win_name, buffer ))
{
@@ -406,7 +404,7 @@ static BOOL CALLBACK find_locale_id_callback( HMODULE hModule, LPCWSTR type,
}
if (!GetLocaleInfoW( lcid, LOCALE_SISO639LANGNAME | LOCALE_NOUSEROVERRIDE,
- buffer, sizeof(buffer)/sizeof(WCHAR) ))
+ buffer, ARRAY_SIZE( buffer )))
return TRUE;
if (strcmpiW( buffer, data->lang )) return TRUE;
matches++; /* language name matched */
@@ -414,7 +412,7 @@ static BOOL CALLBACK find_locale_id_callback( HMODULE hModule, LPCWSTR type,
if (data->script)
{
if (GetLocaleInfoW( lcid, LOCALE_SSCRIPTS | LOCALE_NOUSEROVERRIDE,
- buffer, sizeof(buffer)/sizeof(WCHAR) ))
+ buffer, ARRAY_SIZE( buffer )))
{
const WCHAR *p = buffer;
unsigned int len = strlenW( data->script );
@@ -432,7 +430,7 @@ static BOOL CALLBACK find_locale_id_callback( HMODULE hModule, LPCWSTR type,
if (data->country)
{
if (GetLocaleInfoW( lcid, LOCALE_SISO3166CTRYNAME|LOCALE_NOUSEROVERRIDE,
- buffer, sizeof(buffer)/sizeof(WCHAR) ))
+ buffer, ARRAY_SIZE( buffer )))
{
if (strcmpiW( buffer, data->country )) goto done;
matches++; /* country name matched */
@@ -490,7 +488,7 @@ static void parse_locale_name( const WCHAR *str, struct locale_name *name )
name->matches = 0;
name->codepage = 0;
name->win_name[0] = 0;
- lstrcpynW( name->lang, str, sizeof(name->lang)/sizeof(WCHAR) );
+ lstrcpynW( name->lang, str, ARRAY_SIZE( name->lang ));
if (!*name->lang)
{
@@ -816,8 +814,7 @@ static BOOL locale_update_registry( HKEY hkey, const WCHAR *name, LCID lcid,
for (i = 0; i < nb_values; i++)
{
- GetLocaleInfoW( lcid, values[i] | LOCALE_NOUSEROVERRIDE, bufferW,
- sizeof(bufferW)/sizeof(WCHAR) );
+ GetLocaleInfoW( lcid, values[i] | LOCALE_NOUSEROVERRIDE, bufferW, ARRAY_SIZE( bufferW ));
SetLocaleInfoW( lcid, values[i], bufferW );
}
return TRUE;
@@ -905,19 +902,19 @@ void LOCALE_InitRegistry(void)
return; /* don't do anything if we can't create the registry key */
locale_update_registry( hkey, localeW, lcid_LC_MESSAGES, lc_messages_values,
- sizeof(lc_messages_values)/sizeof(lc_messages_values[0]) );
+ ARRAY_SIZE( lc_messages_values ));
locale_update_registry( hkey, lc_monetaryW, lcid_LC_MONETARY, lc_monetary_values,
- sizeof(lc_monetary_values)/sizeof(lc_monetary_values[0]) );
+ ARRAY_SIZE( lc_monetary_values ));
locale_update_registry( hkey, lc_numericW, lcid_LC_NUMERIC, lc_numeric_values,
- sizeof(lc_numeric_values)/sizeof(lc_numeric_values[0]) );
+ ARRAY_SIZE( lc_numeric_values ));
locale_update_registry( hkey, lc_timeW, lcid_LC_TIME, lc_time_values,
- sizeof(lc_time_values)/sizeof(lc_time_values[0]) );
+ ARRAY_SIZE( lc_time_values ));
locale_update_registry( hkey, lc_measurementW, lcid_LC_MEASUREMENT, lc_measurement_values,
- sizeof(lc_measurement_values)/sizeof(lc_measurement_values[0]) );
+ ARRAY_SIZE( lc_measurement_values ));
locale_update_registry( hkey, lc_telephoneW, lcid_LC_TELEPHONE, lc_telephone_values,
- sizeof(lc_telephone_values)/sizeof(lc_telephone_values[0]) );
+ ARRAY_SIZE( lc_telephone_values ));
locale_update_registry( hkey, lc_paperW, lcid_LC_PAPER, lc_paper_values,
- sizeof(lc_paper_values)/sizeof(lc_paper_values[0]) );
+ ARRAY_SIZE( lc_paper_values ));
if (locale_update_registry( hkey, lc_ctypeW, lcid_LC_CTYPE, NULL, 0 ))
{
@@ -943,10 +940,10 @@ void LOCALE_InitRegistry(void)
nameW.Length = len * sizeof(WCHAR);
if (!NtCreateKey( &nls_key, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ))
{
- for (i = 0; i < sizeof(update_cp_values)/sizeof(update_cp_values[0]); i++)
+ for (i = 0; i < ARRAY_SIZE( update_cp_values ); i++)
{
count = GetLocaleInfoW( lcid, update_cp_values[i].value | LOCALE_NOUSEROVERRIDE,
- bufferW, sizeof(bufferW)/sizeof(WCHAR) );
+ bufferW, ARRAY_SIZE( bufferW ));
RtlInitUnicodeString( &nameW, update_cp_values[i].name );
NtSetValueKey( nls_key, &nameW, 0, REG_SZ, bufferW, count * sizeof(WCHAR) );
}
@@ -1112,7 +1109,7 @@ static UINT setup_unix_locales(void)
if ((locale = get_locale( LC_CTYPE, "LC_CTYPE" )))
{
- strcpynAtoW( ctype_buff, locale, sizeof(ctype_buff)/sizeof(WCHAR) );
+ strcpynAtoW( ctype_buff, locale, ARRAY_SIZE( ctype_buff ));
parse_locale_name( ctype_buff, &locale_name );
lcid_LC_CTYPE = locale_name.lcid;
unix_cp = locale_name.codepage;
@@ -1126,7 +1123,7 @@ static UINT setup_unix_locales(void)
#define GET_UNIX_LOCALE(cat) do \
if ((locale = get_locale( cat, #cat ))) \
{ \
- strcpynAtoW( buffer, locale, sizeof(buffer)/sizeof(WCHAR) ); \
+ strcpynAtoW( buffer, locale, ARRAY_SIZE(buffer) ); \
if (!strcmpW( buffer, ctype_buff )) lcid_##cat = lcid_LC_CTYPE; \
else { \
parse_locale_name( buffer, &locale_name ); \
@@ -1444,7 +1441,7 @@ INT WINAPI LCIDToLocaleName( LCID lcid, LPWSTR name, INT count, DWORD flags )
static struct registry_value *get_locale_registry_value( DWORD lctype )
{
int i;
- for (i=0; i < sizeof(registry_values)/sizeof(registry_values[0]); i++)
+ for (i = 0; i < ARRAY_SIZE( registry_values ); i++)
if (registry_values[i].lctype == lctype)
return &registry_values[i];
return NULL;
@@ -1698,7 +1695,7 @@ INT WINAPI GetLocaleInfoW( LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len )
if (lcflags & LOCALE_RETURN_NUMBER)
{
WCHAR tmp[16];
- ret = get_registry_locale_info( value, tmp, sizeof(tmp)/sizeof(WCHAR) );
+ ret = get_registry_locale_info( value, tmp, ARRAY_SIZE( tmp ));
if (ret > 0)
{
WCHAR *end;
@@ -2219,7 +2216,7 @@ BOOL WINAPI GetCPInfoExW( UINT codepage, DWORD dwFlags, LPCPINFOEXW cpinfo )
cpinfo->CodePage = table->info.codepage;
cpinfo->UnicodeDefaultChar = table->info.def_unicode_char;
MultiByteToWideChar( CP_ACP, 0, table->info.name, -1, cpinfo->CodePageName,
- sizeof(cpinfo->CodePageName)/sizeof(WCHAR));
+ ARRAY_SIZE( cpinfo->CodePageName ));
break;
}
}
@@ -2269,7 +2266,7 @@ BOOL WINAPI EnumSystemCodePagesW( CODEPAGE_ENUMPROCW lpfnCodePageEnum, DWORD fla
for (;;)
{
if (!(table = wine_cp_enum_table( index++ ))) break;
- p = buffer + sizeof(buffer)/sizeof(WCHAR);
+ p = buffer + ARRAY_SIZE( buffer );
*--p = 0;
page = table->info.codepage;
do
@@ -2989,7 +2986,7 @@ static BOOL CALLBACK enum_locale_ex_proc( HMODULE module, LPCWSTR type,
unsigned int flags;
GetLocaleInfoW( MAKELCID( lang, SORT_DEFAULT ), LOCALE_SNAME | LOCALE_NOUSEROVERRIDE,
- buffer, sizeof(buffer) / sizeof(WCHAR) );
+ buffer, ARRAY_SIZE( buffer ));
if (!GetLocaleInfoW( MAKELCID( lang, SORT_DEFAULT ),
LOCALE_INEUTRAL | LOCALE_NOUSEROVERRIDE | LOCALE_RETURN_NUMBER,
(LPWSTR)&neutral, sizeof(neutral) / sizeof(WCHAR) ))
@@ -3254,7 +3251,7 @@ static INT compose_katakana( LPCWSTR src, INT srclen, LPWSTR dst )
default:
{
int shift = *src - 0xff61;
- if (shift < 0 || shift >= sizeof(katakana_map)/sizeof(katakana_map[0]) )
+ if (shift < 0 || shift >= ARRAY_SIZE( katakana_map ))
return 0;
else
*dst = katakana_map[shift] | 0x3000;
@@ -3362,7 +3359,7 @@ static INT decompose_katakana( WCHAR c, LPWSTR dst, INT dstlen )
INT len = 0, shift = c - 0x3099;
BYTE k;
- if (shift < 0 || shift >= sizeof(katakana_map)/sizeof(katakana_map[0]))
+ if (shift < 0 || shift >= ARRAY_SIZE( katakana_map ))
return 0;
k = katakana_map[shift];
@@ -4382,7 +4379,7 @@ static BOOL NLS_EnumSystemLanguageGroups(ENUMLANGUAGEGROUP_CALLBACKS *lpProcs)
{
WCHAR szGrpName[48];
- if (!NLS_GetLanguageGroupName( lgrpid, szGrpName, sizeof(szGrpName) / sizeof(WCHAR) ))
+ if (!NLS_GetLanguageGroupName( lgrpid, szGrpName, ARRAY_SIZE( szGrpName )))
szGrpName[0] = '\0';
if (lpProcs->procW)
@@ -4390,7 +4387,7 @@ static BOOL NLS_EnumSystemLanguageGroups(ENUMLANGUAGEGROUP_CALLBACKS *lpProcs)
lpProcs->lParam );
else
{
- char szNumberA[sizeof(szNumber)/sizeof(WCHAR)];
+ char szNumberA[ARRAY_SIZE( szNumber )];
char szGrpNameA[48];
/* FIXME: MSDN doesn't say which code page the W->A translation uses,
@@ -4584,7 +4581,7 @@ static BOOL NLS_EnumLanguageGroupLocales(ENUMLANGUAGEGROUPLOCALE_CALLBACKS *lpPr
bContinue = lpProcs->procW( lgrpid, lcid, szNumber, lpProcs->lParam );
else
{
- char szNumberA[sizeof(szNumber)/sizeof(WCHAR)];
+ char szNumberA[ARRAY_SIZE( szNumber )];
WideCharToMultiByte(CP_ACP, 0, szNumber, -1, szNumberA, sizeof(szNumberA), 0, 0);
@@ -5174,7 +5171,7 @@ static const struct geoinfo_t *get_geoinfo_dataptr(GEOID geoid)
int min, max;
min = 0;
- max = sizeof(geoinfodata)/sizeof(struct geoinfo_t)-1;
+ max = ARRAY_SIZE(geoinfodata)-1;
while (min <= max) {
const struct geoinfo_t *ptr;
@@ -5324,7 +5321,7 @@ BOOL WINAPI EnumSystemGeoID(GEOCLASS geoclass, GEOID parent, GEO_ENUMPROC enumpr
return FALSE;
}
- for (i = 0; i < sizeof(geoinfodata)/sizeof(struct geoinfo_t); i++) {
+ for (i = 0; i < ARRAY_SIZE(geoinfodata); i++) {
const struct geoinfo_t *ptr = &geoinfodata[i];
if (geoclass == GEOCLASS_NATION && (ptr->kind == LOCATION_REGION))
@@ -5682,8 +5679,7 @@ INT WINAPI IdnToNameprepUnicode(DWORD dwFlags, LPCWSTR lpUnicodeCharStr, INT cch
}
}
- norm_len = FoldStringW(MAP_FOLDCZONE, map_str, map_len,
- norm_str, sizeof(norm_str)/sizeof(WCHAR)-1);
+ norm_len = FoldStringW(MAP_FOLDCZONE, map_str, map_len, norm_str, ARRAY_SIZE(norm_str)-1);
if(map_str != buf)
HeapFree(GetProcessHeap(), 0, map_str);
if(!norm_len) {
diff --git a/dlls/kernel32/module.c b/dlls/kernel32/module.c
index 3ab70e8..1188298 100644
--- a/dlls/kernel32/module.c
+++ b/dlls/kernel32/module.c
@@ -1142,8 +1142,7 @@ static BOOL load_library_as_datafile( LPCWSTR name, HMODULE *hmod, DWORD flags )
if (flags & LOAD_LIBRARY_AS_IMAGE_RESOURCE) protect |= SEC_IMAGE;
- if (SearchPathW( NULL, name, dotDLL, sizeof(filenameW) / sizeof(filenameW[0]),
- filenameW, NULL ))
+ if (SearchPathW( NULL, name, dotDLL, ARRAY_SIZE( filenameW ), filenameW, NULL ))
{
hFile = CreateFileW( filenameW, GENERIC_READ, sharing, NULL, OPEN_EXISTING, 0, 0 );
}
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index a389743..489f59e 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -893,7 +893,7 @@ static NTSTATUS find_actctx_dllpath(const WCHAR *libname, WCHAR **path)
strcpyW( p, DIR_Windows );
p += strlenW(p);
memcpy( p, winsxsW, sizeof(winsxsW) );
- p += sizeof(winsxsW) / sizeof(WCHAR);
+ p += ARRAY_SIZE( winsxsW );
memcpy( p, info->lpAssemblyDirectoryName, info->ulAssemblyDirectoryNameLength );
p += info->ulAssemblyDirectoryNameLength / sizeof(WCHAR);
*p++ = '\\';
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 4e6ba11..5aa245c 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -377,7 +377,7 @@ static void set_registry_variables( HANDLE hkey, ULONG type )
}
/* PATH is magic */
if (env_name.Length == sizeof(pathW) &&
- !memicmpW( env_name.Buffer, pathW, sizeof(pathW)/sizeof(WCHAR) ) &&
+ !memicmpW( env_name.Buffer, pathW, ARRAY_SIZE( pathW )) &&
!RtlQueryEnvironmentVariable_U( NULL, &env_name, &tmp ))
{
RtlAppendUnicodeToString( &tmp, sep );
@@ -528,7 +528,7 @@ static void set_additional_environment(void)
DWORD len;
/* ComputerName */
- len = sizeof(buf) / sizeof(WCHAR);
+ len = ARRAY_SIZE( buf );
if (GetComputerNameW( buf, &len ))
SetEnvironmentVariableW( computernameW, buf );
@@ -606,7 +606,7 @@ static void set_wow64_environment(void)
/* set the PROCESSOR_ARCHITECTURE variable */
- if (GetEnvironmentVariableW( arch6432W, arch, sizeof(arch)/sizeof(WCHAR) ))
+ if (GetEnvironmentVariableW( arch6432W, arch, ARRAY_SIZE( arch )))
{
if (is_win64)
{
@@ -614,7 +614,7 @@ static void set_wow64_environment(void)
SetEnvironmentVariableW( arch6432W, NULL );
}
}
- else if (GetEnvironmentVariableW( archW, arch, sizeof(arch)/sizeof(WCHAR) ))
+ else if (GetEnvironmentVariableW( archW, arch, ARRAY_SIZE( arch )))
{
if (is_wow64)
{
@@ -1002,7 +1002,7 @@ static void start_wineboot( HANDLE handles[2] )
PROCESS_INFORMATION pi;
void *redir;
WCHAR app[MAX_PATH];
- WCHAR cmdline[MAX_PATH + (sizeof(wineboot) + sizeof(args)) / sizeof(WCHAR)];
+ WCHAR cmdline[MAX_PATH + ARRAY_SIZE( wineboot ) + ARRAY_SIZE( args )];
memset( &si, 0, sizeof(si) );
si.cb = sizeof(si);
@@ -1011,7 +1011,7 @@ static void start_wineboot( HANDLE handles[2] )
si.hStdOutput = 0;
si.hStdError = GetStdHandle( STD_ERROR_HANDLE );
- GetSystemDirectoryW( app, MAX_PATH - sizeof(wineboot)/sizeof(WCHAR) );
+ GetSystemDirectoryW( app, MAX_PATH - ARRAY_SIZE( wineboot ));
lstrcatW( app, wineboot );
Wow64DisableWow64FsRedirection( &redir );
@@ -1291,7 +1291,7 @@ void CDECL __wine_kernel_init(void)
}
args[0] = (DWORD_PTR)main_exe_name;
FormatMessageW( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY,
- NULL, error, 0, msgW, sizeof(msgW)/sizeof(WCHAR), (__ms_va_list *)args );
+ NULL, error, 0, msgW, ARRAY_SIZE( msgW ), (__ms_va_list *)args );
WideCharToMultiByte( CP_UNIXCP, 0, msgW, -1, msg, sizeof(msg), NULL, NULL );
MESSAGE( "wine: %s", msg );
ExitProcess( error );
@@ -1440,7 +1440,7 @@ static char **build_envp( const WCHAR *envW )
for (p = env; *p; p += strlen(p) + 1)
if (is_special_env_var( p )) length += 4; /* prefix it with "WINE" */
- for (i = 0; i < sizeof(unix_vars)/sizeof(unix_vars[0]); i++)
+ for (i = 0; i < ARRAY_SIZE( unix_vars ); i++)
{
if (!(p = getenv(unix_vars[i]))) continue;
length += strlen(unix_vars[i]) + strlen(p) + 2;
@@ -1453,7 +1453,7 @@ static char **build_envp( const WCHAR *envW )
char *dst = (char *)(envp + count);
/* some variables must not be modified, so we get them directly from the unix env */
- for (i = 0; i < sizeof(unix_vars)/sizeof(unix_vars[0]); i++)
+ for (i = 0; i < ARRAY_SIZE( unix_vars ); i++)
{
if (!(p = getenv(unix_vars[i]))) continue;
*envptr++ = strcpy( dst, unix_vars[i] );
@@ -2048,7 +2048,7 @@ static BOOL create_process( HANDLE hFile, LPCWSTR filename, LPWSTR cmd_line, LPW
while (*env_end)
{
static const WCHAR WINEDEBUG[] = {'W','I','N','E','D','E','B','U','G','=',0};
- if (!winedebug && !strncmpW( env_end, WINEDEBUG, sizeof(WINEDEBUG)/sizeof(WCHAR) - 1 ))
+ if (!winedebug && !strncmpW( env_end, WINEDEBUG, ARRAY_SIZE( WINEDEBUG ) - 1 ))
{
DWORD len = WideCharToMultiByte( CP_UNIXCP, 0, env_end, -1, NULL, 0, NULL, NULL );
if ((winedebug = HeapAlloc( GetProcessHeap(), 0, len )))
@@ -2219,7 +2219,7 @@ static BOOL create_cmd_process( LPCWSTR filename, LPWSTR cmd_line, LPVOID env, L
WCHAR *newcmdline;
BOOL ret;
- if (!GetEnvironmentVariableW( comspecW, comspec, sizeof(comspec)/sizeof(WCHAR) ))
+ if (!GetEnvironmentVariableW( comspecW, comspec, ARRAY_SIZE( comspec )))
return FALSE;
if (!(newcmdline = HeapAlloc( GetProcessHeap(), 0,
(strlenW(comspec) + 7 + strlenW(cmd_line) + 2) * sizeof(WCHAR))))
@@ -2340,7 +2340,7 @@ static BOOL create_process_impl( LPCWSTR app_name, LPWSTR cmd_line, LPSECURITY_A
TRACE("app %s cmdline %s\n", debugstr_w(app_name), debugstr_w(cmd_line) );
- if (!(tidy_cmdline = get_file_name( app_name, cmd_line, name, sizeof(name)/sizeof(WCHAR),
+ if (!(tidy_cmdline = get_file_name( app_name, cmd_line, name, ARRAY_SIZE( name ),
&hFile, &binary_info )))
return FALSE;
if (hFile == INVALID_HANDLE_VALUE) goto done;
@@ -3624,7 +3624,7 @@ BOOL WINAPI QueryFullProcessImageNameW(HANDLE hProcess, DWORD dwFlags, LPWSTR lp
drive[0] = result->Buffer[0];
drive[1] = ':';
drive[2] = 0;
- if (!QueryDosDeviceW(drive, device, sizeof(device)/sizeof(*device)))
+ if (!QueryDosDeviceW(drive, device, ARRAY_SIZE(device)))
{
status = STATUS_NO_SUCH_DEVICE;
goto cleanup;
diff --git a/dlls/kernel32/profile.c b/dlls/kernel32/profile.c
index 0974aaf..65a8f28 100644
--- a/dlls/kernel32/profile.c
+++ b/dlls/kernel32/profile.c
@@ -772,7 +772,7 @@ static BOOL PROFILE_Open( LPCWSTR filename, BOOL write_access )
else
{
LPWSTR dummy;
- GetFullPathNameW(filename, sizeof(buffer)/sizeof(buffer[0]), buffer, &dummy);
+ GetFullPathNameW(filename, ARRAY_SIZE(buffer), buffer, &dummy);
}
TRACE("path: %s\n", debugstr_w(buffer));
@@ -1238,9 +1238,8 @@ UINT WINAPI GetPrivateProfileIntW( LPCWSTR section, LPCWSTR entry,
UNICODE_STRING bufferW;
ULONG result;
- if (GetPrivateProfileStringW( section, entry, emptystringW,
- buffer, sizeof(buffer)/sizeof(WCHAR),
- filename ) == 0)
+ if (GetPrivateProfileStringW( section, entry, emptystringW, buffer, ARRAY_SIZE( buffer ),
+ filename ) == 0)
return def_val;
/* FIXME: if entry can be found but it's empty, then Win16 is
diff --git a/dlls/kernel32/sync.c b/dlls/kernel32/sync.c
index 343998e..6c7249c 100644
--- a/dlls/kernel32/sync.c
+++ b/dlls/kernel32/sync.c
@@ -1594,7 +1594,7 @@ BOOL WINAPI WaitNamedPipeW (LPCWSTR name, DWORD nTimeOut)
if (nt_name.Length >= MAX_PATH * sizeof(WCHAR) ||
nt_name.Length < sizeof(leadin) ||
- strncmpiW( nt_name.Buffer, leadin, sizeof(leadin)/sizeof(WCHAR)) != 0)
+ strncmpiW( nt_name.Buffer, leadin, ARRAY_SIZE( leadin )) != 0)
{
RtlFreeUnicodeString( &nt_name );
SetLastError( ERROR_PATH_NOT_FOUND );
@@ -1630,8 +1630,7 @@ BOOL WINAPI WaitNamedPipeW (LPCWSTR name, DWORD nTimeOut)
else
pipe_wait->Timeout.QuadPart = (ULONGLONG)nTimeOut * -10000;
pipe_wait->NameLength = nt_name.Length - sizeof(leadin);
- memcpy(pipe_wait->Name, nt_name.Buffer + sizeof(leadin)/sizeof(WCHAR),
- pipe_wait->NameLength);
+ memcpy( pipe_wait->Name, nt_name.Buffer + ARRAY_SIZE( leadin ), pipe_wait->NameLength );
RtlFreeUnicodeString( &nt_name );
status = NtFsControlFile( pipe_dev, NULL, NULL, NULL, &iosb, FSCTL_PIPE_WAIT,
@@ -2084,8 +2083,7 @@ BOOL WINAPI CreatePipe( PHANDLE hReadPipe, PHANDLE hWritePipe,
'\\','W','i','n','3','2','.','P','i','p','e','s','.','%','0','8','l',
'u','.','%','0','8','u','\0' };
- snprintfW(name, sizeof(name) / sizeof(name[0]), nameFmt,
- GetCurrentProcessId(), ++index);
+ snprintfW(name, ARRAY_SIZE(name), nameFmt, GetCurrentProcessId(), ++index);
RtlInitUnicodeString(&nt_name, name);
status = NtCreateNamedPipeFile(&hr, GENERIC_READ | SYNCHRONIZE, &attr, &iosb,
FILE_SHARE_WRITE, FILE_OVERWRITE_IF,
diff --git a/dlls/kernel32/term.c b/dlls/kernel32/term.c
index 171476a..b8877d4 100644
--- a/dlls/kernel32/term.c
+++ b/dlls/kernel32/term.c
@@ -373,7 +373,7 @@ static BOOL TERM_BuildKeyDB(void)
struct dbkey_descr descr;
char tmp[64];
- for (i = 0; i < sizeof(TERM_dbkey_init) / sizeof(TERM_dbkey_init[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(TERM_dbkey_init); i++)
{
if (!TERM_AddKeyDescr(tigetstr((char *)TERM_dbkey_init[i].string_normal), &TERM_dbkey_init[i].descr))
return FALSE;
diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c
index 3a4edf8..1208436 100644
--- a/dlls/kernel32/volume.c
+++ b/dlls/kernel32/volume.c
@@ -420,7 +420,7 @@ static BOOL UDF_Find_PVD( HANDLE handle, BYTE pvd[] )
DWORD offset;
INT locations[] = { 256, -1, -257, 512 };
- for(i=0; i<sizeof(locations)/sizeof(locations[0]); i++)
+ for(i=0; i<ARRAY_SIZE(locations); i++)
{
if (!VOLUME_ReadCDBlock(handle, pvd, locations[i]*BLOCK_SIZE))
return FALSE;
@@ -982,7 +982,7 @@ BOOL WINAPI GetVolumeNameForVolumeMountPointA( LPCSTR path, LPSTR volume, DWORD
{
BOOL ret;
WCHAR volumeW[50], *pathW = NULL;
- DWORD len = min( sizeof(volumeW) / sizeof(WCHAR), size );
+ DWORD len = min(ARRAY_SIZE(volumeW), size );
TRACE("(%s, %p, %x)\n", debugstr_a(path), volume, size);
@@ -1105,7 +1105,7 @@ BOOL WINAPI GetVolumeNameForVolumeMountPointW( LPCWSTR path, LPWSTR volume, DWOR
debugstr_wn((WCHAR*)((char *)output + o1->DeviceNameOffset),
o1->DeviceNameLength/sizeof(WCHAR)));
- if (!strncmpW( p, volumeW, sizeof(volumeW)/sizeof(WCHAR) ))
+ if (!strncmpW( p, volumeW, ARRAY_SIZE( volumeW )))
{
/* is there space in the return variable ?? */
if ((o1->SymbolicLinkNameLength/sizeof(WCHAR))+2 > size)
@@ -1763,7 +1763,7 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu
goto cleanup;
}
}
- else if (GetCurrentDirectoryW( sizeof(cwdW)/sizeof(cwdW[0]), cwdW ))
+ else if (GetCurrentDirectoryW(ARRAY_SIZE(cwdW), cwdW ))
{
/* if the path is completely bogus then revert to the drive of the working directory */
fallbackpathW[0] = cwdW[0];
@@ -1942,12 +1942,12 @@ BOOL WINAPI GetVolumePathNamesForVolumeNameW(LPCWSTR volumename, LPWSTR volumepa
linkname = (const WCHAR *)((const char *)link + link->MountPoints[j].SymbolicLinkNameOffset);
if (link->MountPoints[j].SymbolicLinkNameLength == sizeof(dosdevicesW) + 2 * sizeof(WCHAR) &&
- !memicmpW( linkname, dosdevicesW, sizeof(dosdevicesW) / sizeof(WCHAR) ))
+ !memicmpW( linkname, dosdevicesW, ARRAY_SIZE( dosdevicesW )))
{
len += 4;
if (volumepathname && len < buflen)
{
- path[0] = linkname[sizeof(dosdevicesW) / sizeof(WCHAR)];
+ path[0] = linkname[ARRAY_SIZE( dosdevicesW )];
path[1] = ':';
path[2] = '\\';
path[3] = 0;
--
1.9.1

View File

@ -1,26 +0,0 @@
From 3508dde97fce11ef0b8ad570b1305aacec34db2e Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 30 Jul 2018 21:18:10 +0200
Subject: [PATCH] mciwave: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/mciwave/mciwave.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/mciwave/mciwave.c b/dlls/mciwave/mciwave.c
index fd4d6f6..0fa9b20 100644
--- a/dlls/mciwave/mciwave.c
+++ b/dlls/mciwave/mciwave.c
@@ -427,7 +427,7 @@ static DWORD create_tmp_file(HMMIO* hFile, LPWSTR* pszTmpFileName)
szPrefix[2] = 'I';
szPrefix[3] = '\0';
- if (!GetTempPathW(sizeof(szTmpPath)/sizeof(szTmpPath[0]), szTmpPath)) {
+ if (!GetTempPathW(ARRAY_SIZE(szTmpPath), szTmpPath)) {
WARN("can't retrieve temp path!\n");
*pszTmpFileName = NULL;
return MCIERR_FILE_NOT_FOUND;
--
1.9.1

View File

@ -1,26 +0,0 @@
From dbea486286c0794f4a0f145b7c6b44d075ab7170 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 30 Jul 2018 21:18:11 +0200
Subject: [PATCH] midimap: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/midimap/midimap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/midimap/midimap.c b/dlls/midimap/midimap.c
index 1b35da7..290300a 100644
--- a/dlls/midimap/midimap.c
+++ b/dlls/midimap/midimap.c
@@ -172,7 +172,7 @@ static BOOL MIDIMAP_LoadSettingsScheme(MIDIMAPDATA* mom, const WCHAR* scheme)
return FALSE;
}
- for (idx = 0; !RegEnumKeyW(hKey, idx, buffer, sizeof(buffer)/sizeof(buffer[0])); idx++)
+ for (idx = 0; !RegEnumKeyW(hKey, idx, buffer, ARRAY_SIZE(buffer)); idx++)
{
if (RegOpenKeyW(hKey, buffer, &hPortKey)) continue;
--
1.9.1

View File

@ -1,26 +0,0 @@
From e8135dad94110944af7a599dc1310bcbd96eb548 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 30 Jul 2018 21:18:12 +0200
Subject: [PATCH] mscms: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/mscms/profile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/mscms/profile.c b/dlls/mscms/profile.c
index f0c4087..cb4908c 100644
--- a/dlls/mscms/profile.c
+++ b/dlls/mscms/profile.c
@@ -295,7 +295,7 @@ BOOL WINAPI GetColorDirectoryW( PCWSTR machine, PWSTR buffer, PDWORD size )
if (machine || !size) return FALSE;
- GetSystemDirectoryW( colordir, sizeof(colordir) / sizeof(WCHAR) );
+ GetSystemDirectoryW( colordir, ARRAY_SIZE( colordir ));
lstrcatW( colordir, colorsubdir );
len = lstrlenW( colordir ) * sizeof(WCHAR);
--
1.9.1

View File

@ -1,26 +0,0 @@
From d6b9f1cef89956e4cc7ddd3e01d843cf9da2f770 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 30 Jul 2018 21:18:13 +0200
Subject: [PATCH] msctf: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/msctf/documentmgr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/msctf/documentmgr.c b/dlls/msctf/documentmgr.c
index cf4c601..9fa6b0f 100644
--- a/dlls/msctf/documentmgr.c
+++ b/dlls/msctf/documentmgr.c
@@ -188,7 +188,7 @@ static HRESULT WINAPI DocumentMgr_Pop(ITfDocumentMgr *iface, DWORD dwFlags)
{
int i;
- for (i = 0; i < sizeof(This->contextStack)/sizeof(This->contextStack[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(This->contextStack); i++)
if (This->contextStack[i])
{
ITfThreadMgrEventSink_OnPopContext(This->ThreadMgrSink, This->contextStack[i]);
--
1.9.1

View File

@ -1,26 +0,0 @@
From 0c5f59d4379c6ae8ce9ea64c525c8957a5665d57 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 30 Jul 2018 21:18:14 +0200
Subject: [PATCH] msscript.ocx: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/msscript.ocx/msscript.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/msscript.ocx/msscript.c b/dlls/msscript.ocx/msscript.c
index 746c2d3..ae5edb7 100644
--- a/dlls/msscript.ocx/msscript.c
+++ b/dlls/msscript.ocx/msscript.c
@@ -169,7 +169,7 @@ static void release_typelib(void)
if(!typelib)
return;
- for(i=0; i < sizeof(typeinfos)/sizeof(*typeinfos); i++)
+ for(i = 0; i < ARRAY_SIZE(typeinfos); i++)
if(typeinfos[i])
ITypeInfo_Release(typeinfos[i]);
--
1.9.1

View File

@ -1,75 +0,0 @@
From d466b7735488b900ae331a5541bbe8db7d760afc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 25 Jul 2018 22:00:42 +0200
Subject: [PATCH 01/24] wined3d: Fix WINED3D_MCS_COLOR2.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Don't use it unless we have a specular color in the vertex attributes,
but allow it if there's no diffuse color.
Signed-off-by: Stefan Dösinger <stefan@codeweavers.com>
---
dlls/wined3d/utils.c | 37 ++++++++++++++++++++++++++++++++-----
1 file changed, 32 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 937c1bc..ccf5b84 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -5854,6 +5854,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_d3d_info *d3d_info = context->d3d_info;
unsigned int coord_idx, i;
+ BOOL has_diffuse, has_specular;
memset(settings, 0, sizeof(*settings));
@@ -5911,12 +5912,38 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
settings->point_size = state->gl_primitive_type == GL_POINTS;
settings->per_vertex_point_size = !!(si->use_map & 1u << WINED3D_FFP_PSIZE);
- if (state->render_states[WINED3D_RS_COLORVERTEX] && (si->use_map & (1u << WINED3D_FFP_DIFFUSE)))
+ has_diffuse = si->use_map & (1u << WINED3D_FFP_DIFFUSE);
+ has_specular = si->use_map & (1u << WINED3D_FFP_SPECULAR);
+
+ if (state->render_states[WINED3D_RS_COLORVERTEX] && (has_diffuse || has_specular))
{
- settings->diffuse_source = state->render_states[WINED3D_RS_DIFFUSEMATERIALSOURCE];
- settings->emissive_source = state->render_states[WINED3D_RS_EMISSIVEMATERIALSOURCE];
- settings->ambient_source = state->render_states[WINED3D_RS_AMBIENTMATERIALSOURCE];
- settings->specular_source = state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE];
+ if (state->render_states[WINED3D_RS_DIFFUSEMATERIALSOURCE] == WINED3D_MCS_COLOR1 && has_diffuse)
+ settings->diffuse_source = WINED3D_MCS_COLOR1;
+ else if (state->render_states[WINED3D_RS_DIFFUSEMATERIALSOURCE] == WINED3D_MCS_COLOR2 && has_specular)
+ settings->diffuse_source = WINED3D_MCS_COLOR2;
+ else
+ settings->diffuse_source = WINED3D_MCS_MATERIAL;
+
+ if (state->render_states[WINED3D_RS_EMISSIVEMATERIALSOURCE] == WINED3D_MCS_COLOR1 && has_diffuse)
+ settings->emissive_source = WINED3D_MCS_COLOR1;
+ else if (state->render_states[WINED3D_RS_EMISSIVEMATERIALSOURCE] == WINED3D_MCS_COLOR2 && has_specular)
+ settings->emissive_source = WINED3D_MCS_COLOR2;
+ else
+ settings->emissive_source = WINED3D_MCS_MATERIAL;
+
+ if (state->render_states[WINED3D_RS_AMBIENTMATERIALSOURCE] == WINED3D_MCS_COLOR1 && has_diffuse)
+ settings->ambient_source = WINED3D_MCS_COLOR1;
+ else if (state->render_states[WINED3D_RS_AMBIENTMATERIALSOURCE] == WINED3D_MCS_COLOR2 && has_specular)
+ settings->ambient_source = WINED3D_MCS_COLOR2;
+ else
+ settings->ambient_source = WINED3D_MCS_MATERIAL;
+
+ if (state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE] == WINED3D_MCS_COLOR1 && has_diffuse)
+ settings->specular_source = WINED3D_MCS_COLOR1;
+ else if (state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE] == WINED3D_MCS_COLOR2 && has_specular)
+ settings->specular_source = WINED3D_MCS_COLOR2;
+ else
+ settings->specular_source = WINED3D_MCS_MATERIAL;
}
else
{
--
1.9.1

View File

@ -1,145 +0,0 @@
From 11bcbf7ddfb38cd895c6465d188fd441e364e4aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 25 Jul 2018 22:00:43 +0200
Subject: [PATCH 02/24] d3d9/tests: Add a test for D3DMCS_COLOR{1/2}.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stefan Dösinger <stefan@codeweavers.com>
---
dlls/d3d9/tests/visual.c | 113 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 113 insertions(+)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index b36c189..4be84a9 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -24027,6 +24027,118 @@ done:
DestroyWindow(window);
}
+static void test_color_vertex(void)
+{
+ IDirect3D9 *d3d;
+ IDirect3DDevice9 *device;
+ D3DCOLOR color;
+ ULONG refcount;
+ HWND window;
+ HRESULT hr;
+ D3DMATERIAL9 material;
+ unsigned int i;
+
+ /* The idea here is to set up ambient light parameters in a way that the ambient color from the
+ * material is just passed through. The emissive color is just passed through anyway. The sum of
+ * ambient + emissive should allow deduction of where the material color came from.
+ *
+ * Note that in cases without a D3DFVF_DIFFUSE flag the first color value in the struct will be
+ * fed into the specular vertex color slot. */
+ static const struct
+ {
+ DWORD fvf, color_vertex, ambient, emissive, result;
+ }
+ tests[] =
+ {
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, FALSE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x000000c0},
+
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ffff00},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_MATERIAL, D3DMCS_COLOR2, 0x0000ff80},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x00ff0040},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR1, 0x00ff0000},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR2, D3DMCS_COLOR2, 0x0000ff00},
+
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ff0080},
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x000000c0},
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_MATERIAL, D3DMCS_COLOR2, 0x00ff0080},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ff0040},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x00ff0040},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR2, D3DMCS_MATERIAL, 0x000000c0},
+
+ {0, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x000000c0},
+ };
+
+ static const struct
+ {
+ struct vec3 position;
+ DWORD diffuse;
+ DWORD specular;
+ }
+ quad[] =
+ {
+ {{-1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{-1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{ 1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{ 1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ };
+
+ window = create_window();
+ ok(!!window, "Failed to create a window.\n");
+
+ d3d = Direct3DCreate9(D3D_SDK_VERSION);
+ ok(!!d3d, "Failed to create a D3D object.\n");
+ if (!(device = create_device(d3d, window, window, TRUE)))
+ {
+ skip("Failed to create a D3D device, skipping tests.\n");
+ IDirect3D9_Release(d3d);
+ DestroyWindow(window);
+ return;
+ }
+
+ hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, TRUE);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetRenderState(device, D3DRS_AMBIENT, 0xffffffff);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+
+ memset(&material, 0, sizeof(material));
+ material.Ambient.b = 0.5;
+ material.Emissive.b = 0.25;
+ hr = IDirect3DDevice9_SetMaterial(device, &material);
+ ok(SUCCEEDED(hr), "Failed to set material, hr %#x\n", hr);
+
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
+ hr = IDirect3DDevice9_SetRenderState(device, D3DRS_COLORVERTEX, tests[i].color_vertex);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetRenderState(device, D3DRS_AMBIENTMATERIALSOURCE, tests[i].ambient);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetRenderState(device, D3DRS_EMISSIVEMATERIALSOURCE, tests[i].emissive);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | tests[i].fvf);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x77777777, 0.0f, 0);
+ ok(SUCCEEDED(hr), "Failed to clear depth/stencil, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice9_BeginScene(device);
+ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(quad[0]));
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_EndScene(device);
+ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+
+ color = getPixelColor(device, 320, 240);
+ ok(color_match(color, tests[i].result, 1),
+ "Expected color 0x%08x for test %u, got 0x%08x.\n",
+ tests[i].result, i, color);
+ }
+
+ refcount = IDirect3DDevice9_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+ IDirect3D9_Release(d3d);
+ DestroyWindow(window);
+}
+
START_TEST(visual)
{
D3DADAPTER_IDENTIFIER9 identifier;
@@ -24164,4 +24276,5 @@ START_TEST(visual)
test_mvp_software_vertex_shaders();
test_null_format();
test_map_synchronisation();
+ test_color_vertex();
}
--
1.9.1

View File

@ -1,144 +0,0 @@
From 57b372d60b79f1bd08253181e15078f101055c7d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 25 Jul 2018 22:00:44 +0200
Subject: [PATCH 03/24] d3d8/tests: Add a test for D3DMCS_COLOR{1/2}.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stefan Dösinger <stefan@codeweavers.com>
---
dlls/d3d8/tests/visual.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 112 insertions(+)
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c
index bed70d8..c60af69 100644
--- a/dlls/d3d8/tests/visual.c
+++ b/dlls/d3d8/tests/visual.c
@@ -10279,6 +10279,117 @@ done:
DestroyWindow(window);
}
+static void test_color_vertex(void)
+{
+ IDirect3D8 *d3d;
+ IDirect3DDevice8 *device;
+ D3DCOLOR color;
+ ULONG refcount;
+ HWND window;
+ HRESULT hr;
+ D3DMATERIAL8 material;
+ unsigned int i;
+
+ /* The idea here is to set up ambient light parameters in a way that the ambient color from the
+ * material is just passed through. The emissive color is just passed through anyway. The sum of
+ * ambient + emissive should allow deduction of where the material color came from.
+ *
+ * Note that in cases without a D3DFVF_DIFFUSE flag the first color value in the struct will be
+ * fed into the specular vertex color slot. */
+ static const struct
+ {
+ DWORD fvf, color_vertex, ambient, emissive, result;
+ }
+ tests[] =
+ {
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, FALSE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x000000c0},
+
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ffff00},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_MATERIAL, D3DMCS_COLOR2, 0x0000ff80},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x00ff0040},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR1, 0x00ff0000},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR2, D3DMCS_COLOR2, 0x0000ff00},
+
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ff0080},
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x000000c0},
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_MATERIAL, D3DMCS_COLOR2, 0x00ff0080},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ff0040},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x00ff0040},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR2, D3DMCS_MATERIAL, 0x000000c0},
+
+ {0, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x000000c0},
+ };
+ static const struct
+ {
+ struct vec3 position;
+ DWORD diffuse;
+ DWORD specular;
+ }
+ quad[] =
+ {
+ {{-1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{-1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{ 1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{ 1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ };
+
+ window = create_window();
+ ok(!!window, "Failed to create a window.\n");
+
+ d3d = Direct3DCreate8(D3D_SDK_VERSION);
+ ok(!!d3d, "Failed to create a D3D object.\n");
+ if (!(device = create_device(d3d, window, window, TRUE)))
+ {
+ skip("Failed to create a D3D device, skipping tests.\n");
+ IDirect3D8_Release(d3d);
+ DestroyWindow(window);
+ return;
+ }
+
+ hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, TRUE);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_SetRenderState(device, D3DRS_AMBIENT, 0xffffffff);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+
+ memset(&material, 0, sizeof(material));
+ material.Ambient.b = 0.5;
+ material.Emissive.b = 0.25;
+ hr = IDirect3DDevice8_SetMaterial(device, &material);
+ ok(SUCCEEDED(hr), "Failed to set material, hr %#x\n", hr);
+
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
+ hr = IDirect3DDevice8_SetRenderState(device, D3DRS_COLORVERTEX, tests[i].color_vertex);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_SetRenderState(device, D3DRS_AMBIENTMATERIALSOURCE, tests[i].ambient);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_SetRenderState(device, D3DRS_EMISSIVEMATERIALSOURCE, tests[i].emissive);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | tests[i].fvf);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x77777777, 0.0f, 0);
+ ok(SUCCEEDED(hr), "Failed to clear depth/stencil, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice8_BeginScene(device);
+ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(quad[0]));
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_EndScene(device);
+ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+
+ color = getPixelColor(device, 320, 240);
+ ok(color_match(color, tests[i].result, 1),
+ "Expected color 0x%08x for test %u, got 0x%08x.\n",
+ tests[i].result, i, color);
+ }
+
+ refcount = IDirect3DDevice8_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+ IDirect3D8_Release(d3d);
+ DestroyWindow(window);
+}
+
START_TEST(visual)
{
D3DADAPTER_IDENTIFIER8 identifier;
@@ -10352,4 +10463,5 @@ START_TEST(visual)
test_drawindexedprimitiveup();
test_map_synchronisation();
test_viewport();
+ test_color_vertex();
}
--
1.9.1

View File

@ -1,172 +0,0 @@
From 32b2c4ee0b87bcfabccb5d84090c964094a29ed0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 25 Jul 2018 22:00:45 +0200
Subject: [PATCH 04/24] ddraw/tests: Add a test for D3DMCS_COLOR{1/2}.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
A ddraw4 version is on my TODO list. ddraw1 and ddraw2 cannot use
lighting and per-vertex color at the same time due to the predefined
D3D*VERTEX structs. ddraw4 can, and it has D3DLIGHTSTATE_COLORVERTEX,
but the material source states are missing. I assume that one or more of
the material properties then track the vertex color, but I have to find
out which.
Signed-off-by: Stefan Dösinger <stefan@codeweavers.com>
---
dlls/ddraw/tests/ddraw7.c | 133 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 133 insertions(+)
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 35a45c0..bf34962 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -14267,6 +14267,138 @@ static void test_viewport(void)
DestroyWindow(window);
}
+static void test_color_vertex(void)
+{
+ IDirectDrawSurface7 *rt;
+ IDirect3DDevice7 *device;
+ unsigned int i;
+ ULONG refcount;
+ HWND window;
+ HRESULT hr;
+ D3DMATERIAL7 material;
+ D3DCOLOR color;
+
+ static struct
+ {
+ struct vec3 position;
+ DWORD diffuse;
+ DWORD specular;
+ }
+ quad_2c[] =
+ {
+ {{-1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{-1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{ 1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{ 1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ };
+ static struct
+ {
+ struct vec3 position;
+ DWORD color;
+ }
+ quad_1c[] =
+ {
+ {{-1.0f, -1.0f, 0.0f}, 0xffff0000},
+ {{-1.0f, 1.0f, 0.0f}, 0xffff0000},
+ {{ 1.0f, -1.0f, 0.0f}, 0xffff0000},
+ {{ 1.0f, 1.0f, 0.0f}, 0xffff0000},
+ };
+ static struct
+ {
+ struct vec3 position;
+ }
+ quad_0c[] =
+ {
+ {{-1.0f, -1.0f, 0.0f}},
+ {{-1.0f, 1.0f, 0.0f}},
+ {{ 1.0f, -1.0f, 0.0f}},
+ {{ 1.0f, 1.0f, 0.0f}},
+ };
+
+ /* The idea here is to set up ambient light parameters in a way that the ambient color from the
+ * material is just passed through. The emissive color is just passed through anyway. The sum of
+ * ambient + emissive should allow deduction of where the material color came from. */
+ static const struct
+ {
+ DWORD fvf, color_vertex, ambient, emissive, result;
+ void *vtx;
+ }
+ tests[] =
+ {
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, FALSE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x000000c0, quad_2c},
+
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ffff00, quad_2c},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_MATERIAL, D3DMCS_COLOR2, 0x0000ff80, quad_2c},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x00ff0040, quad_2c},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR1, 0x00ff0000, quad_2c},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR2, D3DMCS_COLOR2, 0x0000ff00, quad_2c},
+
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ff0080, quad_1c},
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x000000c0, quad_1c},
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_MATERIAL, D3DMCS_COLOR2, 0x00ff0080, quad_1c},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ff0040, quad_1c},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x00ff0040, quad_1c},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR2, D3DMCS_MATERIAL, 0x000000c0, quad_1c},
+
+ {0, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x000000c0, quad_0c},
+ };
+
+ window = CreateWindowA("static", "d3d7_test", WS_OVERLAPPEDWINDOW,
+ 0, 0, 640, 480, 0, 0, 0, 0);
+ if (!(device = create_device(window, DDSCL_NORMAL)))
+ {
+ skip("Failed to create a 3D device, skipping test.\n");
+ DestroyWindow(window);
+ return;
+ }
+ hr = IDirect3DDevice7_GetRenderTarget(device, &rt);
+ ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, TRUE);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_AMBIENT, 0xffffffff);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+
+ memset(&material, 0, sizeof(material));
+ U3(U1(material).ambient).b = 0.5;
+ U3(U3(material).emissive).b = 0.25f;
+ hr = IDirect3DDevice7_SetMaterial(device, &material);
+ ok(SUCCEEDED(hr), "Failed to set material, hr %#x\n", hr);
+
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_COLORVERTEX, tests[i].color_vertex);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_AMBIENTMATERIALSOURCE, tests[i].ambient);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_EMISSIVEMATERIALSOURCE, tests[i].emissive);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x77777777, 0.0f, 0);
+ ok(SUCCEEDED(hr), "Failed to clear depth/stencil, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice7_BeginScene(device);
+ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ | tests[i].fvf,
+ tests[i].vtx, 4, 0);
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_EndScene(device);
+ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+
+ color = get_surface_color(rt, 320, 240);
+ ok(compare_color(color, tests[i].result, 1),
+ "Expected color 0x%08x for test %u, got 0x%08x.\n",
+ tests[i].result, i, color);
+ }
+
+ IDirectDrawSurface7_Release(rt);
+ refcount = IDirect3DDevice7_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+ DestroyWindow(window);
+}
+
START_TEST(ddraw7)
{
DDDEVICEIDENTIFIER2 identifier;
@@ -14402,4 +14534,5 @@ START_TEST(ddraw7)
test_clear();
test_enum_surfaces();
test_viewport();
+ test_color_vertex();
}
--
1.9.1

View File

@ -1,33 +0,0 @@
From 0eeb6d6b57cb8e1c50c65915799fbd4a7b2b6c43 Mon Sep 17 00:00:00 2001
From: Andrew Eikum <aeikum@codeweavers.com>
Date: Tue, 24 Jul 2018 11:05:06 -0500
Subject: [PATCH 05/24] dsound: Correctly calculate angle between vectors with
equal and opposite directions
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
---
dlls/dsound/sound3d.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/dsound/sound3d.c b/dlls/dsound/sound3d.c
index 03fd3d4..118bb60 100644
--- a/dlls/dsound/sound3d.c
+++ b/dlls/dsound/sound3d.c
@@ -111,7 +111,13 @@ static inline D3DVALUE AngleBetweenVectorsRad (const D3DVECTOR *a, const D3DVECT
return 0;
cos = product/(la*lb);
- angle = acos(cos);
+ if(cos > 1.f){
+ angle = 0;
+ }else if(cos < -1.f){
+ angle = M_PI;
+ }else{
+ angle = acos(cos);
+ }
TRACE("angle between (%f,%f,%f) and (%f,%f,%f) = %f radians (%f degrees)\n", a->x, a->y, a->z, b->x,
b->y, b->z, angle, RadToDeg(angle));
return angle;
--
1.9.1

View File

@ -1,26 +0,0 @@
From 45cf0122c89190fe8264be3e9b5e4ab65814fa87 Mon Sep 17 00:00:00 2001
From: Gijs Vermeulen <gijsvrm@gmail.com>
Date: Wed, 25 Jul 2018 01:52:06 +0200
Subject: [PATCH 07/24] wine.inf: Add "Sources" key.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=44981
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
---
loader/wine.inf.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/loader/wine.inf.in b/loader/wine.inf.in
index 9a76509..7774289 100644
--- a/loader/wine.inf.in
+++ b/loader/wine.inf.in
@@ -3416,6 +3416,7 @@ HKLM,%CurrentVersionNT%\SvcHost,"netsvcs",0x00010008,"Schedule"
HKLM,%CurrentVersion%\RunServices,"winemenubuilder",2,"%11%\winemenubuilder.exe -a -r"
HKLM,"System\CurrentControlSet\Services\Eventlog\Application",,16
HKLM,"System\CurrentControlSet\Services\Eventlog\System",,16
+HKLM,"System\CurrentControlSet\Services\Eventlog\System","Sources",0x10000,""
HKLM,"System\CurrentControlSet\Services\Tcpip\Parameters",,16
HKLM,"System\CurrentControlSet\Services\VxD\MSTCP",,16
HKLM,"System\CurrentControlSet\Services\Winsock\Parameters",,16
--
1.9.1

View File

@ -1,114 +0,0 @@
From c5f3c80ec9c35af958a232a9deb8f98f2225b992 Mon Sep 17 00:00:00 2001
From: Andrey Gusev <andrey.goosev@gmail.com>
Date: Mon, 23 Jul 2018 15:07:39 +0300
Subject: [PATCH 09/24] api-ms-win-devices-config-l1-1-0: Add dll.
Signed-off-by: Andrey Gusev <andrey.goosev@gmail.com>
---
configure | 2 ++
configure.ac | 1 +
dlls/api-ms-win-devices-config-l1-1-0/Makefile.in | 1 +
.../api-ms-win-devices-config-l1-1-0.spec | 38 ++++++++++++++++++++++
tools/make_specfiles | 1 +
5 files changed, 43 insertions(+)
create mode 100644 dlls/api-ms-win-devices-config-l1-1-0/Makefile.in
create mode 100644 dlls/api-ms-win-devices-config-l1-1-0/api-ms-win-devices-config-l1-1-0.spec
diff --git a/configure b/configure
index 337ce91..fd58e15 100755
--- a/configure
+++ b/configure
@@ -1045,6 +1045,7 @@ enable_api_ms_win_crt_stdio_l1_1_0
enable_api_ms_win_crt_string_l1_1_0
enable_api_ms_win_crt_time_l1_1_0
enable_api_ms_win_crt_utility_l1_1_0
+enable_api_ms_win_devices_config_l1_1_0
enable_api_ms_win_devices_config_l1_1_1
enable_api_ms_win_devices_query_l1_1_1
enable_api_ms_win_downlevel_advapi32_l1_1_0
@@ -19137,6 +19138,7 @@ wine_fn_config_makefile dlls/api-ms-win-crt-stdio-l1-1-0 enable_api_ms_win_crt_s
wine_fn_config_makefile dlls/api-ms-win-crt-string-l1-1-0 enable_api_ms_win_crt_string_l1_1_0
wine_fn_config_makefile dlls/api-ms-win-crt-time-l1-1-0 enable_api_ms_win_crt_time_l1_1_0
wine_fn_config_makefile dlls/api-ms-win-crt-utility-l1-1-0 enable_api_ms_win_crt_utility_l1_1_0
+wine_fn_config_makefile dlls/api-ms-win-devices-config-l1-1-0 enable_api_ms_win_devices_config_l1_1_0
wine_fn_config_makefile dlls/api-ms-win-devices-config-l1-1-1 enable_api_ms_win_devices_config_l1_1_1
wine_fn_config_makefile dlls/api-ms-win-devices-query-l1-1-1 enable_api_ms_win_devices_query_l1_1_1
wine_fn_config_makefile dlls/api-ms-win-downlevel-advapi32-l1-1-0 enable_api_ms_win_downlevel_advapi32_l1_1_0
diff --git a/configure.ac b/configure.ac
index be247ea..ddf7ee3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2998,6 +2998,7 @@ WINE_CONFIG_MAKEFILE(dlls/api-ms-win-crt-stdio-l1-1-0)
WINE_CONFIG_MAKEFILE(dlls/api-ms-win-crt-string-l1-1-0)
WINE_CONFIG_MAKEFILE(dlls/api-ms-win-crt-time-l1-1-0)
WINE_CONFIG_MAKEFILE(dlls/api-ms-win-crt-utility-l1-1-0)
+WINE_CONFIG_MAKEFILE(dlls/api-ms-win-devices-config-l1-1-0)
WINE_CONFIG_MAKEFILE(dlls/api-ms-win-devices-config-l1-1-1)
WINE_CONFIG_MAKEFILE(dlls/api-ms-win-devices-query-l1-1-1)
WINE_CONFIG_MAKEFILE(dlls/api-ms-win-downlevel-advapi32-l1-1-0)
diff --git a/dlls/api-ms-win-devices-config-l1-1-0/Makefile.in b/dlls/api-ms-win-devices-config-l1-1-0/Makefile.in
new file mode 100644
index 0000000..1e11946
--- /dev/null
+++ b/dlls/api-ms-win-devices-config-l1-1-0/Makefile.in
@@ -0,0 +1 @@
+MODULE = api-ms-win-devices-config-l1-1-0.dll
diff --git a/dlls/api-ms-win-devices-config-l1-1-0/api-ms-win-devices-config-l1-1-0.spec b/dlls/api-ms-win-devices-config-l1-1-0/api-ms-win-devices-config-l1-1-0.spec
new file mode 100644
index 0000000..fcd3aaa
--- /dev/null
+++ b/dlls/api-ms-win-devices-config-l1-1-0/api-ms-win-devices-config-l1-1-0.spec
@@ -0,0 +1,38 @@
+@ stub CM_Delete_Class_Key
+@ stub CM_Delete_DevNode_Key
+@ stub CM_Delete_Device_Interface_KeyW
+@ stub CM_Disable_DevNode
+@ stub CM_Enable_DevNode
+@ stdcall CM_Get_Child(ptr long long) setupapi.CM_Get_Child
+@ stub CM_Get_Class_PropertyW
+@ stub CM_Get_Class_Property_Keys
+@ stdcall CM_Get_Class_Registry_PropertyW(ptr long ptr ptr long long ptr) setupapi.CM_Get_Class_Registry_PropertyW
+@ stub CM_Get_Depth
+@ stub CM_Get_DevNode_PropertyW
+@ stub CM_Get_DevNode_Property_Keys
+@ stdcall CM_Get_DevNode_Registry_PropertyW(long long ptr ptr ptr long) setupapi.CM_Get_DevNode_Registry_PropertyW
+@ stdcall CM_Get_DevNode_Status(ptr ptr long long) setupapi.CM_Get_DevNode_Status
+@ stdcall CM_Get_Device_IDW(ptr ptr long long) setupapi.CM_Get_Device_IDW
+@ stdcall CM_Get_Device_ID_ListW(wstr ptr long long) setupapi.CM_Get_Device_ID_ListW
+@ stdcall CM_Get_Device_ID_List_SizeW(ptr wstr long) setupapi.CM_Get_Device_ID_List_SizeW
+@ stdcall CM_Get_Device_ID_Size(ptr ptr long) setupapi.CM_Get_Device_ID_Size
+@ stub CM_Get_Device_Interface_ListW
+@ stdcall CM_Get_Device_Interface_List_SizeW(ptr ptr wstr long) setupapi.CM_Get_Device_Interface_List_SizeW
+@ stub CM_Get_Device_Interface_PropertyW
+@ stub CM_Get_Device_Interface_Property_KeysW
+@ stdcall CM_Get_Parent(ptr long long) setupapi.CM_Get_Parent
+@ stub CM_Get_Sibling
+@ stdcall CM_Locate_DevNodeW(ptr wstr long) setupapi.CM_Locate_DevNodeW
+@ stub CM_Open_Class_KeyW
+@ stdcall CM_Open_DevNode_Key(long long long long ptr long) setupapi.CM_Open_DevNode_Key
+@ stub CM_Open_Device_Interface_KeyW
+@ stub CM_Query_And_Remove_SubTreeW
+@ stub CM_Register_Notification
+@ stub CM_Set_Class_PropertyW
+@ stdcall CM_Set_Class_Registry_PropertyW(ptr long ptr long long ptr) setupapi.CM_Set_Class_Registry_PropertyW
+@ stub CM_Set_DevNode_PropertyW
+@ stub CM_Set_DevNode_Registry_PropertyW
+@ stub CM_Set_Device_Interface_PropertyW
+@ stub CM_Setup_DevNode
+@ stub CM_Uninstall_DevNode
+@ stub CM_Unregister_Notification
diff --git a/tools/make_specfiles b/tools/make_specfiles
index 4faf665..cd3af87 100755
--- a/tools/make_specfiles
+++ b/tools/make_specfiles
@@ -105,6 +105,7 @@ my @dll_groups =
[
"setupapi",
"cfgmgr32",
+ "api-ms-win-devices-config-l1-1-0",
"api-ms-win-devices-config-l1-1-1",
"api-ms-win-devices-query-l1-1-1",
],
--
1.9.1

View File

@ -1,50 +0,0 @@
From 569cd096daa90aa4d4fb8602453843f73feb7fe6 Mon Sep 17 00:00:00 2001
From: Fabian Maurer <dark.shadow4@web.de>
Date: Fri, 20 Jul 2018 21:05:05 +0200
Subject: [PATCH 10/24] wnet: Make WNetGetUniversalNameW return required size
when buffer is too small and add test
The pointer is set to the required size not only when the input size
is 0, but generally when it is too small.
Signed-off-by: Fabian Maurer <dark.shadow4@web.de>
---
dlls/mpr/tests/mpr.c | 5 ++++-
dlls/mpr/wnet.c | 1 +
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/mpr/tests/mpr.c b/dlls/mpr/tests/mpr.c
index fc067d9..3e5ca09 100644
--- a/dlls/mpr/tests/mpr.c
+++ b/dlls/mpr/tests/mpr.c
@@ -51,11 +51,14 @@ static void test_WNetGetUniversalName(void)
ok(info_size == sizeof(buffer), "Got wrong size: %u\n", info_size);
- fail_size = 0;
+ fail_size = 1;
ret = WNetGetUniversalNameA(driveA, UNIVERSAL_NAME_INFO_LEVEL,
buffer, &fail_size);
if(drive_type == DRIVE_REMOTE)
+ {
todo_wine ok(ret == WN_BAD_VALUE || ret == WN_MORE_DATA, "WNetGetUniversalNameA failed: %08x\n", ret);
+ ok(fail_size > 1, "Got %d\n", fail_size);
+ }
else
ok(ret == WN_NOT_CONNECTED || ret == WN_NO_NET_OR_BAD_PATH,
"(%s) WNetGetUniversalNameW gave wrong error: %u\n", driveA, ret);
diff --git a/dlls/mpr/wnet.c b/dlls/mpr/wnet.c
index ad4f1dd..a2f8a04 100644
--- a/dlls/mpr/wnet.c
+++ b/dlls/mpr/wnet.c
@@ -2385,6 +2385,7 @@ DWORD WINAPI WNetGetUniversalNameW ( LPCWSTR lpLocalPath, DWORD dwInfoLevel,
size = sizeof(*info) + (lstrlenW(lpLocalPath) + 1) * sizeof(WCHAR);
if (*lpBufferSize < size)
{
+ *lpBufferSize = size;
err = WN_MORE_DATA;
break;
}
--
1.9.1

View File

@ -1,43 +0,0 @@
From 98b0a706020f3728e01cc7d38a6bba8ed8dd91f5 Mon Sep 17 00:00:00 2001
From: Piotr Caban <piotr@codeweavers.com>
Date: Thu, 26 Jul 2018 14:40:21 +0200
Subject: [PATCH 11/24] msvcp90: Fix EOF delimiter handling in
basic_istream<char>::ignore.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45495
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
---
dlls/msvcp60/ios.c | 2 +-
dlls/msvcp90/ios.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcp60/ios.c b/dlls/msvcp60/ios.c
index 8a5813e..518c8da 100644
--- a/dlls/msvcp60/ios.c
+++ b/dlls/msvcp60/ios.c
@@ -8101,7 +8101,7 @@ basic_istream_char* __thiscall basic_istream_char_ignore(basic_istream_char *thi
break;
}
- if(ch==(unsigned char)delim)
+ if(ch==delim)
break;
this->count++;
diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index 6a82db6..e71d30f 100644
--- a/dlls/msvcp90/ios.c
+++ b/dlls/msvcp90/ios.c
@@ -8583,7 +8583,7 @@ basic_istream_char* __thiscall basic_istream_char_ignore(basic_istream_char *thi
break;
}
- if(ch==(unsigned char)delim)
+ if(ch==delim)
break;
this->count++;
--
1.9.1

View File

@ -1,33 +0,0 @@
From 7a654e3796602a21c0e8cd93f12e16446ea26678 Mon Sep 17 00:00:00 2001
From: Fabian Maurer <dark.shadow4@web.de>
Date: Sat, 28 Jul 2018 16:31:46 +0200
Subject: [PATCH 12/24] ntoskrnl: Emulate sti/cli instructions on x86_64
Fixes bug 45521.
Thanks to Anastasius Focht for the clear bug report.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45521
Signed-off-by: Fabian Maurer <dark.shadow4@web.de>
---
dlls/ntoskrnl.exe/instr.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/dlls/ntoskrnl.exe/instr.c b/dlls/ntoskrnl.exe/instr.c
index b2dac58..67cdd32 100644
--- a/dlls/ntoskrnl.exe/instr.c
+++ b/dlls/ntoskrnl.exe/instr.c
@@ -815,6 +815,11 @@ static DWORD emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context )
}
break; /* Unable to emulate it */
}
+
+ case 0xfa: /* cli */
+ case 0xfb: /* sti */
+ context->Rip += prefixlen + 1;
+ return ExceptionContinueExecution;
}
return ExceptionContinueSearch; /* Unable to emulate it */
}
--
1.9.1

View File

@ -1,68 +0,0 @@
From 65af7470de21a5d3b99ed8bc96f57d3f93012b56 Mon Sep 17 00:00:00 2001
From: Fabian Maurer <dark.shadow4@web.de>
Date: Fri, 3 Aug 2018 07:55:03 -0500
Subject: [PATCH] winmm: Don't crash in waveOutOpen when nSamplesPerSec is 0
and add tests
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45530
Signed-off-by: Fabian Maurer <dark.shadow4@web.de>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
---
dlls/winmm/tests/wave.c | 22 ++++++++++++++++++++++
dlls/winmm/waveform.c | 7 +++++++
2 files changed, 29 insertions(+)
diff --git a/dlls/winmm/tests/wave.c b/dlls/winmm/tests/wave.c
index b402e21917..c106594b3f 100644
--- a/dlls/winmm/tests/wave.c
+++ b/dlls/winmm/tests/wave.c
@@ -1415,6 +1415,28 @@ static void wave_out_test_device(UINT_PTR device)
} else
trace("waveOutOpen(%s): 32 bit float samples not supported\n",
dev_name(device));
+
+ /* Test invalid parameters */
+
+ format.wFormatTag = WAVE_FORMAT_PCM;
+ format.nChannels = 1;
+ format.nSamplesPerSec = 11025;
+ format.nBlockAlign = 1;
+ format.nAvgBytesPerSec = 11025 * 1;
+ format.wBitsPerSample = 8;
+ format.cbSize = 0;
+
+ format.nAvgBytesPerSec = 0;
+ rc = waveOutOpen(&wout, device, &format, 0, 0, 0);
+ ok(rc == MMSYSERR_NOERROR,
+ "waveOutOpen(%s): returned %s\n",dev_name(device),wave_out_error(rc));
+ waveOutClose(wout);
+ format.nAvgBytesPerSec = 11025 * 1;
+
+ format.nSamplesPerSec = 0;
+ rc = waveOutOpen(&wout, device, &format, 0, 0, 0);
+ ok(rc == MMSYSERR_INVALPARAM || rc == WAVERR_BADFORMAT, /* XP and lower return WAVERR_BADFORMAT */
+ "waveOutOpen(%s): returned %s\n",dev_name(device),wave_out_error(rc));
}
static void wave_out_tests(void)
diff --git a/dlls/winmm/waveform.c b/dlls/winmm/waveform.c
index 045bf4ac20..0a259c0f74 100644
--- a/dlls/winmm/waveform.c
+++ b/dlls/winmm/waveform.c
@@ -1088,6 +1088,13 @@ static LRESULT WINMM_OpenDevice(WINMM_Device *device, WINMM_OpenInfo *info,
}
if(info->format->wFormatTag == WAVE_FORMAT_PCM){
+
+ if (info->format->nSamplesPerSec == 0)
+ {
+ ret = MMSYSERR_INVALPARAM;
+ goto error;
+ }
+
/* we aren't guaranteed that the struct in lpFormat is a full
* WAVEFORMATEX struct, which IAC::IsFormatSupported requires */
device->orig_fmt = HeapAlloc(GetProcessHeap(), 0, sizeof(WAVEFORMATEX));
--
2.18.0

View File

@ -1,63 +0,0 @@
From 47e5c48c7eadb3dd96d5fa3eb130f75f6c371c4b Mon Sep 17 00:00:00 2001
From: Zebediah Figura <zfigura@codeweavers.com>
Date: Mon, 30 Jul 2018 14:11:11 -0500
Subject: [PATCH 16/24] msi: Generate unique names for 32- and 64-bit custom
action server pipes.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
---
dlls/msi/custom.c | 6 ++++--
programs/msiexec/msiexec.c | 4 ++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c
index 1a8a982..51755f2 100644
--- a/dlls/msi/custom.c
+++ b/dlls/msi/custom.c
@@ -590,7 +590,7 @@ UINT CDECL __wine_msi_call_dll_function(const GUID *guid)
static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch)
{
- static const WCHAR pipe_name[] = {'\\','\\','.','\\','p','i','p','e','\\','m','s','i','c','a','_','%','x',0};
+ static const WCHAR pipe_name[] = {'\\','\\','.','\\','p','i','p','e','\\','m','s','i','c','a','_','%','x','_','%','d',0};
static const WCHAR msiexecW[] = {'\\','m','s','i','e','x','e','c','.','e','x','e',0};
static const WCHAR argsW[] = {'%','s',' ','-','E','m','b','e','d','d','i','n','g',' ','%','d',0};
@@ -606,9 +606,11 @@ static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch)
(arch == SCS_64BIT_BINARY && package->custom_server_64_process))
return ERROR_SUCCESS;
- sprintfW(buffer, pipe_name, GetCurrentProcessId());
+ sprintfW(buffer, pipe_name, GetCurrentProcessId(), arch == SCS_32BIT_BINARY ? 32 : 64);
pipe = CreateNamedPipeW(buffer, PIPE_ACCESS_DUPLEX, 0, 1, sizeof(DWORD64),
sizeof(GUID), 0, NULL);
+ if (pipe == INVALID_HANDLE_VALUE)
+ ERR("Failed to create custom action client pipe: %u\n", GetLastError());
if (sizeof(void *) == 8 && arch == SCS_32BIT_BINARY)
GetSystemWow64DirectoryW(path, MAX_PATH - sizeof(msiexecW)/sizeof(WCHAR));
diff --git a/programs/msiexec/msiexec.c b/programs/msiexec/msiexec.c
index 47cef7e..ead3bfb 100644
--- a/programs/msiexec/msiexec.c
+++ b/programs/msiexec/msiexec.c
@@ -406,7 +406,7 @@ static DWORD CALLBACK custom_action_thread(void *arg)
static int custom_action_server(const WCHAR *arg)
{
- static const WCHAR pipe_name[] = {'\\','\\','.','\\','p','i','p','e','\\','m','s','i','c','a','_','%','x',0};
+ static const WCHAR pipe_name[] = {'\\','\\','.','\\','p','i','p','e','\\','m','s','i','c','a','_','%','x','_','%','d',0};
DWORD client_pid = atoiW(arg);
DWORD64 thread64;
WCHAR buffer[24];
@@ -423,7 +423,7 @@ static int custom_action_server(const WCHAR *arg)
return 1;
}
- sprintfW(buffer, pipe_name, client_pid);
+ sprintfW(buffer, pipe_name, client_pid, sizeof(void *) * 8);
pipe = CreateFileW(buffer, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (pipe == INVALID_HANDLE_VALUE)
{
--
1.9.1

View File

@ -1,62 +0,0 @@
From 29c5d550d65f9d03be8319eeec75904ecdc88ce9 Mon Sep 17 00:00:00 2001
From: Jacek Caban <jacek@codeweavers.com>
Date: Fri, 27 Jul 2018 15:30:49 +0200
Subject: [PATCH 17/24] winevulkan: Expose driver vkGetInstanceProcAddr via
winevulkan exports.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
---
dlls/winevulkan/make_vulkan | 1 +
dlls/winevulkan/vulkan.c | 10 ++++++++++
dlls/winevulkan/winevulkan.spec | 1 +
3 files changed, 12 insertions(+)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan
index fe742b7..fae6ab0 100755
--- a/dlls/winevulkan/make_vulkan
+++ b/dlls/winevulkan/make_vulkan
@@ -2282,6 +2282,7 @@ class VkGenerator(object):
self._generate_copyright(f, spec_file=True)
f.write("@ stdcall vk_icdGetInstanceProcAddr(ptr str) wine_vk_icdGetInstanceProcAddr\n")
f.write("@ stdcall vk_icdNegotiateLoaderICDInterfaceVersion(ptr) wine_vk_icdNegotiateLoaderICDInterfaceVersion\n")
+ f.write("@ cdecl -norelay native_vkGetInstanceProcAddrWINE(ptr str)\n")
# Export symbols for all Vulkan Core functions.
for func in self.registry.funcs.values():
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c
index 0bb68c2..bd652a5 100644
--- a/dlls/winevulkan/vulkan.c
+++ b/dlls/winevulkan/vulkan.c
@@ -1163,3 +1163,13 @@ static void *wine_vk_get_global_proc_addr(const char *name)
}
return NULL;
}
+
+/*
+ * Wrapper around driver vkGetInstanceProcAddr implementation.
+ * Allows winelib applications to access Vulkan functions with Wine
+ * additions and native ABI.
+ */
+void *native_vkGetInstanceProcAddrWINE(VkInstance instance, const char *name)
+{
+ return vk_funcs->p_vkGetInstanceProcAddr(instance, name);
+}
diff --git a/dlls/winevulkan/winevulkan.spec b/dlls/winevulkan/winevulkan.spec
index 8aab0fe..f979458 100644
--- a/dlls/winevulkan/winevulkan.spec
+++ b/dlls/winevulkan/winevulkan.spec
@@ -36,6 +36,7 @@
@ stdcall vk_icdGetInstanceProcAddr(ptr str) wine_vk_icdGetInstanceProcAddr
@ stdcall vk_icdNegotiateLoaderICDInterfaceVersion(ptr) wine_vk_icdNegotiateLoaderICDInterfaceVersion
+@ cdecl -norelay native_vkGetInstanceProcAddrWINE(ptr str)
@ stdcall wine_vkAcquireNextImage2KHR(ptr ptr ptr)
@ stdcall wine_vkAcquireNextImageKHR(ptr int64 int64 int64 int64 ptr)
@ stdcall wine_vkAllocateCommandBuffers(ptr ptr ptr)
--
1.9.1

View File

@ -1,425 +0,0 @@
From cef9ec3da9c0861b03a6b98fe318b21add0f6f16 Mon Sep 17 00:00:00 2001
From: Jacek Caban <jacek@codeweavers.com>
Date: Fri, 27 Jul 2018 15:31:01 +0200
Subject: [PATCH 18/24] winevulkan: Mark ICD and thunking functions as private.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We don't need them in importlib. We use them only for vulkan-1
forwarding, which doesn't need an importlib.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
---
dlls/winevulkan/make_vulkan | 6 +-
dlls/winevulkan/winevulkan.spec | 360 ++++++++++++++++++++--------------------
2 files changed, 183 insertions(+), 183 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan
index fae6ab0..73bba78 100755
--- a/dlls/winevulkan/make_vulkan
+++ b/dlls/winevulkan/make_vulkan
@@ -647,7 +647,7 @@ class VkFunction(object):
spec = ""
params = " ".join([p.spec() for p in self.params])
if prefix is not None:
- spec += "@ stdcall {0}{1}({2})".format(prefix, self.name, params)
+ spec += "@ stdcall -private {0}{1}({2})".format(prefix, self.name, params)
else:
spec += "@ stdcall {0}({1})".format(self.name, params)
@@ -2280,8 +2280,8 @@ class VkGenerator(object):
def generate_vulkan_spec(self, f):
self._generate_copyright(f, spec_file=True)
- f.write("@ stdcall vk_icdGetInstanceProcAddr(ptr str) wine_vk_icdGetInstanceProcAddr\n")
- f.write("@ stdcall vk_icdNegotiateLoaderICDInterfaceVersion(ptr) wine_vk_icdNegotiateLoaderICDInterfaceVersion\n")
+ f.write("@ stdcall -private vk_icdGetInstanceProcAddr(ptr str) wine_vk_icdGetInstanceProcAddr\n")
+ f.write("@ stdcall -private vk_icdNegotiateLoaderICDInterfaceVersion(ptr) wine_vk_icdNegotiateLoaderICDInterfaceVersion\n")
f.write("@ cdecl -norelay native_vkGetInstanceProcAddrWINE(ptr str)\n")
# Export symbols for all Vulkan Core functions.
diff --git a/dlls/winevulkan/winevulkan.spec b/dlls/winevulkan/winevulkan.spec
index f979458..b075e9f 100644
--- a/dlls/winevulkan/winevulkan.spec
+++ b/dlls/winevulkan/winevulkan.spec
@@ -34,195 +34,195 @@
# but only in their entirety and only with respect to the Combined Software.
#
-@ stdcall vk_icdGetInstanceProcAddr(ptr str) wine_vk_icdGetInstanceProcAddr
-@ stdcall vk_icdNegotiateLoaderICDInterfaceVersion(ptr) wine_vk_icdNegotiateLoaderICDInterfaceVersion
+@ stdcall -private vk_icdGetInstanceProcAddr(ptr str) wine_vk_icdGetInstanceProcAddr
+@ stdcall -private vk_icdNegotiateLoaderICDInterfaceVersion(ptr) wine_vk_icdNegotiateLoaderICDInterfaceVersion
@ cdecl -norelay native_vkGetInstanceProcAddrWINE(ptr str)
-@ stdcall wine_vkAcquireNextImage2KHR(ptr ptr ptr)
-@ stdcall wine_vkAcquireNextImageKHR(ptr int64 int64 int64 int64 ptr)
-@ stdcall wine_vkAllocateCommandBuffers(ptr ptr ptr)
-@ stdcall wine_vkAllocateDescriptorSets(ptr ptr ptr)
-@ stdcall wine_vkAllocateMemory(ptr ptr ptr ptr)
-@ stdcall wine_vkBeginCommandBuffer(ptr ptr)
-@ stdcall wine_vkBindBufferMemory(ptr int64 int64 int64)
-@ stdcall wine_vkBindBufferMemory2(ptr long ptr)
-@ stdcall wine_vkBindImageMemory(ptr int64 int64 int64)
-@ stdcall wine_vkBindImageMemory2(ptr long ptr)
-@ stdcall wine_vkCmdBeginQuery(ptr int64 long long)
-@ stdcall wine_vkCmdBeginRenderPass(ptr ptr long)
-@ stdcall wine_vkCmdBindDescriptorSets(ptr long int64 long long ptr long ptr)
-@ stdcall wine_vkCmdBindIndexBuffer(ptr int64 int64 long)
-@ stdcall wine_vkCmdBindPipeline(ptr long int64)
-@ stdcall wine_vkCmdBindVertexBuffers(ptr long long ptr ptr)
-@ stdcall wine_vkCmdBlitImage(ptr int64 long int64 long long ptr long)
-@ stdcall wine_vkCmdClearAttachments(ptr long ptr long ptr)
-@ stdcall wine_vkCmdClearColorImage(ptr int64 long ptr long ptr)
-@ stdcall wine_vkCmdClearDepthStencilImage(ptr int64 long ptr long ptr)
-@ stdcall wine_vkCmdCopyBuffer(ptr int64 int64 long ptr)
-@ stdcall wine_vkCmdCopyBufferToImage(ptr int64 int64 long long ptr)
-@ stdcall wine_vkCmdCopyImage(ptr int64 long int64 long long ptr)
-@ stdcall wine_vkCmdCopyImageToBuffer(ptr int64 long int64 long ptr)
-@ stdcall wine_vkCmdCopyQueryPoolResults(ptr int64 long long int64 int64 int64 long)
-@ stdcall wine_vkCmdDispatch(ptr long long long)
-@ stdcall wine_vkCmdDispatchBase(ptr long long long long long long)
-@ stdcall wine_vkCmdDispatchIndirect(ptr int64 int64)
-@ stdcall wine_vkCmdDraw(ptr long long long long)
-@ stdcall wine_vkCmdDrawIndexed(ptr long long long long long)
-@ stdcall wine_vkCmdDrawIndexedIndirect(ptr int64 int64 long long)
-@ stdcall wine_vkCmdDrawIndirect(ptr int64 int64 long long)
-@ stdcall wine_vkCmdEndQuery(ptr int64 long)
-@ stdcall wine_vkCmdEndRenderPass(ptr)
-@ stdcall wine_vkCmdExecuteCommands(ptr long ptr)
-@ stdcall wine_vkCmdFillBuffer(ptr int64 int64 int64 long)
-@ stdcall wine_vkCmdNextSubpass(ptr long)
-@ stdcall wine_vkCmdPipelineBarrier(ptr long long long long ptr long ptr long ptr)
-@ stdcall wine_vkCmdPushConstants(ptr int64 long long long ptr)
-@ stdcall wine_vkCmdResetEvent(ptr int64 long)
-@ stdcall wine_vkCmdResetQueryPool(ptr int64 long long)
-@ stdcall wine_vkCmdResolveImage(ptr int64 long int64 long long ptr)
-@ stdcall wine_vkCmdSetBlendConstants(ptr ptr)
-@ stdcall wine_vkCmdSetDepthBias(ptr float float float)
-@ stdcall wine_vkCmdSetDepthBounds(ptr float float)
-@ stdcall wine_vkCmdSetDeviceMask(ptr long)
-@ stdcall wine_vkCmdSetEvent(ptr int64 long)
-@ stdcall wine_vkCmdSetLineWidth(ptr float)
-@ stdcall wine_vkCmdSetScissor(ptr long long ptr)
-@ stdcall wine_vkCmdSetStencilCompareMask(ptr long long)
-@ stdcall wine_vkCmdSetStencilReference(ptr long long)
-@ stdcall wine_vkCmdSetStencilWriteMask(ptr long long)
-@ stdcall wine_vkCmdSetViewport(ptr long long ptr)
-@ stdcall wine_vkCmdUpdateBuffer(ptr int64 int64 int64 ptr)
-@ stdcall wine_vkCmdWaitEvents(ptr long ptr long long long ptr long ptr long ptr)
-@ stdcall wine_vkCmdWriteTimestamp(ptr long int64 long)
-@ stdcall wine_vkCreateBuffer(ptr ptr ptr ptr)
-@ stdcall wine_vkCreateBufferView(ptr ptr ptr ptr)
-@ stdcall wine_vkCreateCommandPool(ptr ptr ptr ptr)
-@ stdcall wine_vkCreateComputePipelines(ptr int64 long ptr ptr ptr)
-@ stdcall wine_vkCreateDescriptorPool(ptr ptr ptr ptr)
-@ stdcall wine_vkCreateDescriptorSetLayout(ptr ptr ptr ptr)
-@ stdcall wine_vkCreateDescriptorUpdateTemplate(ptr ptr ptr ptr)
-@ stdcall wine_vkCreateDevice(ptr ptr ptr ptr)
+@ stdcall -private wine_vkAcquireNextImage2KHR(ptr ptr ptr)
+@ stdcall -private wine_vkAcquireNextImageKHR(ptr int64 int64 int64 int64 ptr)
+@ stdcall -private wine_vkAllocateCommandBuffers(ptr ptr ptr)
+@ stdcall -private wine_vkAllocateDescriptorSets(ptr ptr ptr)
+@ stdcall -private wine_vkAllocateMemory(ptr ptr ptr ptr)
+@ stdcall -private wine_vkBeginCommandBuffer(ptr ptr)
+@ stdcall -private wine_vkBindBufferMemory(ptr int64 int64 int64)
+@ stdcall -private wine_vkBindBufferMemory2(ptr long ptr)
+@ stdcall -private wine_vkBindImageMemory(ptr int64 int64 int64)
+@ stdcall -private wine_vkBindImageMemory2(ptr long ptr)
+@ stdcall -private wine_vkCmdBeginQuery(ptr int64 long long)
+@ stdcall -private wine_vkCmdBeginRenderPass(ptr ptr long)
+@ stdcall -private wine_vkCmdBindDescriptorSets(ptr long int64 long long ptr long ptr)
+@ stdcall -private wine_vkCmdBindIndexBuffer(ptr int64 int64 long)
+@ stdcall -private wine_vkCmdBindPipeline(ptr long int64)
+@ stdcall -private wine_vkCmdBindVertexBuffers(ptr long long ptr ptr)
+@ stdcall -private wine_vkCmdBlitImage(ptr int64 long int64 long long ptr long)
+@ stdcall -private wine_vkCmdClearAttachments(ptr long ptr long ptr)
+@ stdcall -private wine_vkCmdClearColorImage(ptr int64 long ptr long ptr)
+@ stdcall -private wine_vkCmdClearDepthStencilImage(ptr int64 long ptr long ptr)
+@ stdcall -private wine_vkCmdCopyBuffer(ptr int64 int64 long ptr)
+@ stdcall -private wine_vkCmdCopyBufferToImage(ptr int64 int64 long long ptr)
+@ stdcall -private wine_vkCmdCopyImage(ptr int64 long int64 long long ptr)
+@ stdcall -private wine_vkCmdCopyImageToBuffer(ptr int64 long int64 long ptr)
+@ stdcall -private wine_vkCmdCopyQueryPoolResults(ptr int64 long long int64 int64 int64 long)
+@ stdcall -private wine_vkCmdDispatch(ptr long long long)
+@ stdcall -private wine_vkCmdDispatchBase(ptr long long long long long long)
+@ stdcall -private wine_vkCmdDispatchIndirect(ptr int64 int64)
+@ stdcall -private wine_vkCmdDraw(ptr long long long long)
+@ stdcall -private wine_vkCmdDrawIndexed(ptr long long long long long)
+@ stdcall -private wine_vkCmdDrawIndexedIndirect(ptr int64 int64 long long)
+@ stdcall -private wine_vkCmdDrawIndirect(ptr int64 int64 long long)
+@ stdcall -private wine_vkCmdEndQuery(ptr int64 long)
+@ stdcall -private wine_vkCmdEndRenderPass(ptr)
+@ stdcall -private wine_vkCmdExecuteCommands(ptr long ptr)
+@ stdcall -private wine_vkCmdFillBuffer(ptr int64 int64 int64 long)
+@ stdcall -private wine_vkCmdNextSubpass(ptr long)
+@ stdcall -private wine_vkCmdPipelineBarrier(ptr long long long long ptr long ptr long ptr)
+@ stdcall -private wine_vkCmdPushConstants(ptr int64 long long long ptr)
+@ stdcall -private wine_vkCmdResetEvent(ptr int64 long)
+@ stdcall -private wine_vkCmdResetQueryPool(ptr int64 long long)
+@ stdcall -private wine_vkCmdResolveImage(ptr int64 long int64 long long ptr)
+@ stdcall -private wine_vkCmdSetBlendConstants(ptr ptr)
+@ stdcall -private wine_vkCmdSetDepthBias(ptr float float float)
+@ stdcall -private wine_vkCmdSetDepthBounds(ptr float float)
+@ stdcall -private wine_vkCmdSetDeviceMask(ptr long)
+@ stdcall -private wine_vkCmdSetEvent(ptr int64 long)
+@ stdcall -private wine_vkCmdSetLineWidth(ptr float)
+@ stdcall -private wine_vkCmdSetScissor(ptr long long ptr)
+@ stdcall -private wine_vkCmdSetStencilCompareMask(ptr long long)
+@ stdcall -private wine_vkCmdSetStencilReference(ptr long long)
+@ stdcall -private wine_vkCmdSetStencilWriteMask(ptr long long)
+@ stdcall -private wine_vkCmdSetViewport(ptr long long ptr)
+@ stdcall -private wine_vkCmdUpdateBuffer(ptr int64 int64 int64 ptr)
+@ stdcall -private wine_vkCmdWaitEvents(ptr long ptr long long long ptr long ptr long ptr)
+@ stdcall -private wine_vkCmdWriteTimestamp(ptr long int64 long)
+@ stdcall -private wine_vkCreateBuffer(ptr ptr ptr ptr)
+@ stdcall -private wine_vkCreateBufferView(ptr ptr ptr ptr)
+@ stdcall -private wine_vkCreateCommandPool(ptr ptr ptr ptr)
+@ stdcall -private wine_vkCreateComputePipelines(ptr int64 long ptr ptr ptr)
+@ stdcall -private wine_vkCreateDescriptorPool(ptr ptr ptr ptr)
+@ stdcall -private wine_vkCreateDescriptorSetLayout(ptr ptr ptr ptr)
+@ stdcall -private wine_vkCreateDescriptorUpdateTemplate(ptr ptr ptr ptr)
+@ stdcall -private wine_vkCreateDevice(ptr ptr ptr ptr)
@ stub vkCreateDisplayModeKHR
@ stub vkCreateDisplayPlaneSurfaceKHR
-@ stdcall wine_vkCreateEvent(ptr ptr ptr ptr)
-@ stdcall wine_vkCreateFence(ptr ptr ptr ptr)
-@ stdcall wine_vkCreateFramebuffer(ptr ptr ptr ptr)
-@ stdcall wine_vkCreateGraphicsPipelines(ptr int64 long ptr ptr ptr)
-@ stdcall wine_vkCreateImage(ptr ptr ptr ptr)
-@ stdcall wine_vkCreateImageView(ptr ptr ptr ptr)
-@ stdcall wine_vkCreateInstance(ptr ptr ptr)
-@ stdcall wine_vkCreatePipelineCache(ptr ptr ptr ptr)
-@ stdcall wine_vkCreatePipelineLayout(ptr ptr ptr ptr)
-@ stdcall wine_vkCreateQueryPool(ptr ptr ptr ptr)
-@ stdcall wine_vkCreateRenderPass(ptr ptr ptr ptr)
-@ stdcall wine_vkCreateSampler(ptr ptr ptr ptr)
-@ stdcall wine_vkCreateSamplerYcbcrConversion(ptr ptr ptr ptr)
-@ stdcall wine_vkCreateSemaphore(ptr ptr ptr ptr)
-@ stdcall wine_vkCreateShaderModule(ptr ptr ptr ptr)
+@ stdcall -private wine_vkCreateEvent(ptr ptr ptr ptr)
+@ stdcall -private wine_vkCreateFence(ptr ptr ptr ptr)
+@ stdcall -private wine_vkCreateFramebuffer(ptr ptr ptr ptr)
+@ stdcall -private wine_vkCreateGraphicsPipelines(ptr int64 long ptr ptr ptr)
+@ stdcall -private wine_vkCreateImage(ptr ptr ptr ptr)
+@ stdcall -private wine_vkCreateImageView(ptr ptr ptr ptr)
+@ stdcall -private wine_vkCreateInstance(ptr ptr ptr)
+@ stdcall -private wine_vkCreatePipelineCache(ptr ptr ptr ptr)
+@ stdcall -private wine_vkCreatePipelineLayout(ptr ptr ptr ptr)
+@ stdcall -private wine_vkCreateQueryPool(ptr ptr ptr ptr)
+@ stdcall -private wine_vkCreateRenderPass(ptr ptr ptr ptr)
+@ stdcall -private wine_vkCreateSampler(ptr ptr ptr ptr)
+@ stdcall -private wine_vkCreateSamplerYcbcrConversion(ptr ptr ptr ptr)
+@ stdcall -private wine_vkCreateSemaphore(ptr ptr ptr ptr)
+@ stdcall -private wine_vkCreateShaderModule(ptr ptr ptr ptr)
@ stub vkCreateSharedSwapchainsKHR
-@ stdcall wine_vkCreateSwapchainKHR(ptr ptr ptr ptr)
-@ stdcall wine_vkCreateWin32SurfaceKHR(ptr ptr ptr ptr)
-@ stdcall wine_vkDestroyBuffer(ptr int64 ptr)
-@ stdcall wine_vkDestroyBufferView(ptr int64 ptr)
-@ stdcall wine_vkDestroyCommandPool(ptr int64 ptr)
-@ stdcall wine_vkDestroyDescriptorPool(ptr int64 ptr)
-@ stdcall wine_vkDestroyDescriptorSetLayout(ptr int64 ptr)
-@ stdcall wine_vkDestroyDescriptorUpdateTemplate(ptr int64 ptr)
-@ stdcall wine_vkDestroyDevice(ptr ptr)
-@ stdcall wine_vkDestroyEvent(ptr int64 ptr)
-@ stdcall wine_vkDestroyFence(ptr int64 ptr)
-@ stdcall wine_vkDestroyFramebuffer(ptr int64 ptr)
-@ stdcall wine_vkDestroyImage(ptr int64 ptr)
-@ stdcall wine_vkDestroyImageView(ptr int64 ptr)
-@ stdcall wine_vkDestroyInstance(ptr ptr)
-@ stdcall wine_vkDestroyPipeline(ptr int64 ptr)
-@ stdcall wine_vkDestroyPipelineCache(ptr int64 ptr)
-@ stdcall wine_vkDestroyPipelineLayout(ptr int64 ptr)
-@ stdcall wine_vkDestroyQueryPool(ptr int64 ptr)
-@ stdcall wine_vkDestroyRenderPass(ptr int64 ptr)
-@ stdcall wine_vkDestroySampler(ptr int64 ptr)
-@ stdcall wine_vkDestroySamplerYcbcrConversion(ptr int64 ptr)
-@ stdcall wine_vkDestroySemaphore(ptr int64 ptr)
-@ stdcall wine_vkDestroyShaderModule(ptr int64 ptr)
-@ stdcall wine_vkDestroySurfaceKHR(ptr int64 ptr)
-@ stdcall wine_vkDestroySwapchainKHR(ptr int64 ptr)
-@ stdcall wine_vkDeviceWaitIdle(ptr)
-@ stdcall wine_vkEndCommandBuffer(ptr)
-@ stdcall wine_vkEnumerateDeviceExtensionProperties(ptr str ptr ptr)
-@ stdcall wine_vkEnumerateDeviceLayerProperties(ptr ptr ptr)
-@ stdcall wine_vkEnumerateInstanceExtensionProperties(str ptr ptr)
-@ stdcall wine_vkEnumerateInstanceLayerProperties(ptr ptr)
-@ stdcall wine_vkEnumerateInstanceVersion(ptr)
-@ stdcall wine_vkEnumeratePhysicalDeviceGroups(ptr ptr ptr)
-@ stdcall wine_vkEnumeratePhysicalDevices(ptr ptr ptr)
-@ stdcall wine_vkFlushMappedMemoryRanges(ptr long ptr)
-@ stdcall wine_vkFreeCommandBuffers(ptr int64 long ptr)
-@ stdcall wine_vkFreeDescriptorSets(ptr int64 long ptr)
-@ stdcall wine_vkFreeMemory(ptr int64 ptr)
-@ stdcall wine_vkGetBufferMemoryRequirements(ptr int64 ptr)
-@ stdcall wine_vkGetBufferMemoryRequirements2(ptr ptr ptr)
-@ stdcall wine_vkGetDescriptorSetLayoutSupport(ptr ptr ptr)
-@ stdcall wine_vkGetDeviceGroupPeerMemoryFeatures(ptr long long long long)
-@ stdcall wine_vkGetDeviceGroupPresentCapabilitiesKHR(ptr ptr)
-@ stdcall wine_vkGetDeviceGroupSurfacePresentModesKHR(ptr int64 long)
-@ stdcall wine_vkGetDeviceMemoryCommitment(ptr int64 ptr)
-@ stdcall wine_vkGetDeviceProcAddr(ptr str)
-@ stdcall wine_vkGetDeviceQueue(ptr long long ptr)
-@ stdcall wine_vkGetDeviceQueue2(ptr ptr ptr)
+@ stdcall -private wine_vkCreateSwapchainKHR(ptr ptr ptr ptr)
+@ stdcall -private wine_vkCreateWin32SurfaceKHR(ptr ptr ptr ptr)
+@ stdcall -private wine_vkDestroyBuffer(ptr int64 ptr)
+@ stdcall -private wine_vkDestroyBufferView(ptr int64 ptr)
+@ stdcall -private wine_vkDestroyCommandPool(ptr int64 ptr)
+@ stdcall -private wine_vkDestroyDescriptorPool(ptr int64 ptr)
+@ stdcall -private wine_vkDestroyDescriptorSetLayout(ptr int64 ptr)
+@ stdcall -private wine_vkDestroyDescriptorUpdateTemplate(ptr int64 ptr)
+@ stdcall -private wine_vkDestroyDevice(ptr ptr)
+@ stdcall -private wine_vkDestroyEvent(ptr int64 ptr)
+@ stdcall -private wine_vkDestroyFence(ptr int64 ptr)
+@ stdcall -private wine_vkDestroyFramebuffer(ptr int64 ptr)
+@ stdcall -private wine_vkDestroyImage(ptr int64 ptr)
+@ stdcall -private wine_vkDestroyImageView(ptr int64 ptr)
+@ stdcall -private wine_vkDestroyInstance(ptr ptr)
+@ stdcall -private wine_vkDestroyPipeline(ptr int64 ptr)
+@ stdcall -private wine_vkDestroyPipelineCache(ptr int64 ptr)
+@ stdcall -private wine_vkDestroyPipelineLayout(ptr int64 ptr)
+@ stdcall -private wine_vkDestroyQueryPool(ptr int64 ptr)
+@ stdcall -private wine_vkDestroyRenderPass(ptr int64 ptr)
+@ stdcall -private wine_vkDestroySampler(ptr int64 ptr)
+@ stdcall -private wine_vkDestroySamplerYcbcrConversion(ptr int64 ptr)
+@ stdcall -private wine_vkDestroySemaphore(ptr int64 ptr)
+@ stdcall -private wine_vkDestroyShaderModule(ptr int64 ptr)
+@ stdcall -private wine_vkDestroySurfaceKHR(ptr int64 ptr)
+@ stdcall -private wine_vkDestroySwapchainKHR(ptr int64 ptr)
+@ stdcall -private wine_vkDeviceWaitIdle(ptr)
+@ stdcall -private wine_vkEndCommandBuffer(ptr)
+@ stdcall -private wine_vkEnumerateDeviceExtensionProperties(ptr str ptr ptr)
+@ stdcall -private wine_vkEnumerateDeviceLayerProperties(ptr ptr ptr)
+@ stdcall -private wine_vkEnumerateInstanceExtensionProperties(str ptr ptr)
+@ stdcall -private wine_vkEnumerateInstanceLayerProperties(ptr ptr)
+@ stdcall -private wine_vkEnumerateInstanceVersion(ptr)
+@ stdcall -private wine_vkEnumeratePhysicalDeviceGroups(ptr ptr ptr)
+@ stdcall -private wine_vkEnumeratePhysicalDevices(ptr ptr ptr)
+@ stdcall -private wine_vkFlushMappedMemoryRanges(ptr long ptr)
+@ stdcall -private wine_vkFreeCommandBuffers(ptr int64 long ptr)
+@ stdcall -private wine_vkFreeDescriptorSets(ptr int64 long ptr)
+@ stdcall -private wine_vkFreeMemory(ptr int64 ptr)
+@ stdcall -private wine_vkGetBufferMemoryRequirements(ptr int64 ptr)
+@ stdcall -private wine_vkGetBufferMemoryRequirements2(ptr ptr ptr)
+@ stdcall -private wine_vkGetDescriptorSetLayoutSupport(ptr ptr ptr)
+@ stdcall -private wine_vkGetDeviceGroupPeerMemoryFeatures(ptr long long long long)
+@ stdcall -private wine_vkGetDeviceGroupPresentCapabilitiesKHR(ptr ptr)
+@ stdcall -private wine_vkGetDeviceGroupSurfacePresentModesKHR(ptr int64 long)
+@ stdcall -private wine_vkGetDeviceMemoryCommitment(ptr int64 ptr)
+@ stdcall -private wine_vkGetDeviceProcAddr(ptr str)
+@ stdcall -private wine_vkGetDeviceQueue(ptr long long ptr)
+@ stdcall -private wine_vkGetDeviceQueue2(ptr ptr ptr)
@ stub vkGetDisplayModePropertiesKHR
@ stub vkGetDisplayPlaneCapabilitiesKHR
@ stub vkGetDisplayPlaneSupportedDisplaysKHR
-@ stdcall wine_vkGetEventStatus(ptr int64)
-@ stdcall wine_vkGetFenceStatus(ptr int64)
-@ stdcall wine_vkGetImageMemoryRequirements(ptr int64 ptr)
-@ stdcall wine_vkGetImageMemoryRequirements2(ptr ptr ptr)
-@ stdcall wine_vkGetImageSparseMemoryRequirements(ptr int64 ptr ptr)
-@ stdcall wine_vkGetImageSparseMemoryRequirements2(ptr ptr ptr ptr)
-@ stdcall wine_vkGetImageSubresourceLayout(ptr int64 ptr ptr)
-@ stdcall wine_vkGetInstanceProcAddr(ptr str)
+@ stdcall -private wine_vkGetEventStatus(ptr int64)
+@ stdcall -private wine_vkGetFenceStatus(ptr int64)
+@ stdcall -private wine_vkGetImageMemoryRequirements(ptr int64 ptr)
+@ stdcall -private wine_vkGetImageMemoryRequirements2(ptr ptr ptr)
+@ stdcall -private wine_vkGetImageSparseMemoryRequirements(ptr int64 ptr ptr)
+@ stdcall -private wine_vkGetImageSparseMemoryRequirements2(ptr ptr ptr ptr)
+@ stdcall -private wine_vkGetImageSubresourceLayout(ptr int64 ptr ptr)
+@ stdcall -private wine_vkGetInstanceProcAddr(ptr str)
@ stub vkGetPhysicalDeviceDisplayPlanePropertiesKHR
@ stub vkGetPhysicalDeviceDisplayPropertiesKHR
@ stub vkGetPhysicalDeviceExternalBufferProperties
@ stub vkGetPhysicalDeviceExternalFenceProperties
@ stub vkGetPhysicalDeviceExternalSemaphoreProperties
-@ stdcall wine_vkGetPhysicalDeviceFeatures(ptr ptr)
-@ stdcall wine_vkGetPhysicalDeviceFeatures2(ptr ptr)
-@ stdcall wine_vkGetPhysicalDeviceFormatProperties(ptr long ptr)
-@ stdcall wine_vkGetPhysicalDeviceFormatProperties2(ptr long ptr)
-@ stdcall wine_vkGetPhysicalDeviceImageFormatProperties(ptr long long long long long ptr)
-@ stdcall wine_vkGetPhysicalDeviceImageFormatProperties2(ptr ptr ptr)
-@ stdcall wine_vkGetPhysicalDeviceMemoryProperties(ptr ptr)
-@ stdcall wine_vkGetPhysicalDeviceMemoryProperties2(ptr ptr)
-@ stdcall wine_vkGetPhysicalDevicePresentRectanglesKHR(ptr int64 ptr ptr)
-@ stdcall wine_vkGetPhysicalDeviceProperties(ptr ptr)
-@ stdcall wine_vkGetPhysicalDeviceProperties2(ptr ptr)
-@ stdcall wine_vkGetPhysicalDeviceQueueFamilyProperties(ptr ptr ptr)
-@ stdcall wine_vkGetPhysicalDeviceQueueFamilyProperties2(ptr ptr ptr)
-@ stdcall wine_vkGetPhysicalDeviceSparseImageFormatProperties(ptr long long long long long ptr ptr)
-@ stdcall wine_vkGetPhysicalDeviceSparseImageFormatProperties2(ptr ptr ptr ptr)
-@ stdcall wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(ptr int64 ptr)
-@ stdcall wine_vkGetPhysicalDeviceSurfaceFormatsKHR(ptr int64 ptr ptr)
-@ stdcall wine_vkGetPhysicalDeviceSurfacePresentModesKHR(ptr int64 ptr long)
-@ stdcall wine_vkGetPhysicalDeviceSurfaceSupportKHR(ptr long int64 ptr)
-@ stdcall wine_vkGetPhysicalDeviceWin32PresentationSupportKHR(ptr long)
-@ stdcall wine_vkGetPipelineCacheData(ptr int64 ptr ptr)
-@ stdcall wine_vkGetQueryPoolResults(ptr int64 long long long ptr int64 long)
-@ stdcall wine_vkGetRenderAreaGranularity(ptr int64 ptr)
-@ stdcall wine_vkGetSwapchainImagesKHR(ptr int64 ptr ptr)
-@ stdcall wine_vkInvalidateMappedMemoryRanges(ptr long ptr)
-@ stdcall wine_vkMapMemory(ptr int64 int64 int64 long ptr)
-@ stdcall wine_vkMergePipelineCaches(ptr int64 long ptr)
-@ stdcall wine_vkQueueBindSparse(ptr long ptr int64)
-@ stdcall wine_vkQueuePresentKHR(ptr ptr)
-@ stdcall wine_vkQueueSubmit(ptr long ptr int64)
-@ stdcall wine_vkQueueWaitIdle(ptr)
-@ stdcall wine_vkResetCommandBuffer(ptr long)
-@ stdcall wine_vkResetCommandPool(ptr int64 long)
-@ stdcall wine_vkResetDescriptorPool(ptr int64 long)
-@ stdcall wine_vkResetEvent(ptr int64)
-@ stdcall wine_vkResetFences(ptr long ptr)
-@ stdcall wine_vkSetEvent(ptr int64)
-@ stdcall wine_vkTrimCommandPool(ptr int64 long)
-@ stdcall wine_vkUnmapMemory(ptr int64)
-@ stdcall wine_vkUpdateDescriptorSetWithTemplate(ptr int64 int64 ptr)
-@ stdcall wine_vkUpdateDescriptorSets(ptr long ptr long ptr)
-@ stdcall wine_vkWaitForFences(ptr long ptr long int64)
+@ stdcall -private wine_vkGetPhysicalDeviceFeatures(ptr ptr)
+@ stdcall -private wine_vkGetPhysicalDeviceFeatures2(ptr ptr)
+@ stdcall -private wine_vkGetPhysicalDeviceFormatProperties(ptr long ptr)
+@ stdcall -private wine_vkGetPhysicalDeviceFormatProperties2(ptr long ptr)
+@ stdcall -private wine_vkGetPhysicalDeviceImageFormatProperties(ptr long long long long long ptr)
+@ stdcall -private wine_vkGetPhysicalDeviceImageFormatProperties2(ptr ptr ptr)
+@ stdcall -private wine_vkGetPhysicalDeviceMemoryProperties(ptr ptr)
+@ stdcall -private wine_vkGetPhysicalDeviceMemoryProperties2(ptr ptr)
+@ stdcall -private wine_vkGetPhysicalDevicePresentRectanglesKHR(ptr int64 ptr ptr)
+@ stdcall -private wine_vkGetPhysicalDeviceProperties(ptr ptr)
+@ stdcall -private wine_vkGetPhysicalDeviceProperties2(ptr ptr)
+@ stdcall -private wine_vkGetPhysicalDeviceQueueFamilyProperties(ptr ptr ptr)
+@ stdcall -private wine_vkGetPhysicalDeviceQueueFamilyProperties2(ptr ptr ptr)
+@ stdcall -private wine_vkGetPhysicalDeviceSparseImageFormatProperties(ptr long long long long long ptr ptr)
+@ stdcall -private wine_vkGetPhysicalDeviceSparseImageFormatProperties2(ptr ptr ptr ptr)
+@ stdcall -private wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(ptr int64 ptr)
+@ stdcall -private wine_vkGetPhysicalDeviceSurfaceFormatsKHR(ptr int64 ptr ptr)
+@ stdcall -private wine_vkGetPhysicalDeviceSurfacePresentModesKHR(ptr int64 ptr long)
+@ stdcall -private wine_vkGetPhysicalDeviceSurfaceSupportKHR(ptr long int64 ptr)
+@ stdcall -private wine_vkGetPhysicalDeviceWin32PresentationSupportKHR(ptr long)
+@ stdcall -private wine_vkGetPipelineCacheData(ptr int64 ptr ptr)
+@ stdcall -private wine_vkGetQueryPoolResults(ptr int64 long long long ptr int64 long)
+@ stdcall -private wine_vkGetRenderAreaGranularity(ptr int64 ptr)
+@ stdcall -private wine_vkGetSwapchainImagesKHR(ptr int64 ptr ptr)
+@ stdcall -private wine_vkInvalidateMappedMemoryRanges(ptr long ptr)
+@ stdcall -private wine_vkMapMemory(ptr int64 int64 int64 long ptr)
+@ stdcall -private wine_vkMergePipelineCaches(ptr int64 long ptr)
+@ stdcall -private wine_vkQueueBindSparse(ptr long ptr int64)
+@ stdcall -private wine_vkQueuePresentKHR(ptr ptr)
+@ stdcall -private wine_vkQueueSubmit(ptr long ptr int64)
+@ stdcall -private wine_vkQueueWaitIdle(ptr)
+@ stdcall -private wine_vkResetCommandBuffer(ptr long)
+@ stdcall -private wine_vkResetCommandPool(ptr int64 long)
+@ stdcall -private wine_vkResetDescriptorPool(ptr int64 long)
+@ stdcall -private wine_vkResetEvent(ptr int64)
+@ stdcall -private wine_vkResetFences(ptr long ptr)
+@ stdcall -private wine_vkSetEvent(ptr int64)
+@ stdcall -private wine_vkTrimCommandPool(ptr int64 long)
+@ stdcall -private wine_vkUnmapMemory(ptr int64)
+@ stdcall -private wine_vkUpdateDescriptorSetWithTemplate(ptr int64 int64 ptr)
+@ stdcall -private wine_vkUpdateDescriptorSets(ptr long ptr long ptr)
+@ stdcall -private wine_vkWaitForFences(ptr long ptr long int64)
--
1.9.1

View File

@ -1,67 +0,0 @@
From 0c8b27474062d1908a821c4887fb49d8f5711406 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov@codeweavers.com>
Date: Tue, 31 Jul 2018 15:40:08 +0300
Subject: [PATCH 19/24] wmp: Make it possible to query IUnknown from
IWMPControls.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
---
dlls/wmp/player.c | 4 +++-
dlls/wmp/tests/oleobj.c | 10 ++++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/dlls/wmp/player.c b/dlls/wmp/player.c
index 97fd66b..56b408f 100644
--- a/dlls/wmp/player.c
+++ b/dlls/wmp/player.c
@@ -1365,7 +1365,9 @@ static const IWMPNetworkVtbl WMPNetworkVtbl = {
static HRESULT WINAPI WMPControls_QueryInterface(IWMPControls *iface, REFIID riid, void **ppv)
{
- if(IsEqualGUID(riid, &IID_IDispatch)) {
+ if(IsEqualGUID(riid, &IID_IUnknown)) {
+ *ppv = iface;
+ }else if(IsEqualGUID(riid, &IID_IDispatch)) {
*ppv = iface;
}else if(IsEqualGUID(riid, &IID_IWMPControls)) {
*ppv = iface;
diff --git a/dlls/wmp/tests/oleobj.c b/dlls/wmp/tests/oleobj.c
index 6dfaa1c..472b985 100644
--- a/dlls/wmp/tests/oleobj.c
+++ b/dlls/wmp/tests/oleobj.c
@@ -889,7 +889,6 @@ static void test_ConnectionPoint(IOleObject *unk)
IConnectionPoint_Release(point);
}
-
static void test_wmp_ifaces(IOleObject *oleobj)
{
IWMPSettings *settings, *settings_qi;
@@ -899,6 +898,7 @@ static void test_wmp_ifaces(IOleObject *oleobj)
IWMPControls *controls;
VARIANT_BOOL vbool;
IWMPNetwork *network;
+ IUnknown *unk;
HRESULT hres;
BSTR filename;
BSTR url;
@@ -913,9 +913,15 @@ static void test_wmp_ifaces(IOleObject *oleobj)
player = NULL;
hres = IWMPControls_QueryInterface(controls, &IID_IWMPPlayer, (void**)&player);
- ok(hres != S_OK, "Getting IWMPPlayer from IWMPControls SUCCEEDED\n");
+ ok(hres == E_NOINTERFACE, "Getting IWMPPlayer from IWMPControls SUCCEEDED\n");
ok(player == NULL, "player != NULL\n");
+ unk = NULL;
+ hres = IWMPControls_QueryInterface(controls, &IID_IUnknown, (void **)&unk);
+ ok(hres == S_OK, "Failed to get IUnknown, hr %#x.\n", hres);
+ ok(unk != NULL, "Unexpected interface pointer.\n");
+ IUnknown_Release(unk);
+
IWMPControls_Release(controls);
/* IWPNetwork */
--
1.9.1

View File

@ -1,26 +0,0 @@
From bc1d6f652f351e3b418d321af20df3a205e6cb09 Mon Sep 17 00:00:00 2001
From: Matteo Bruni <mbruni@codeweavers.com>
Date: Tue, 31 Jul 2018 15:04:53 +0200
Subject: [PATCH 21/24] d3dcompiler: Make types array static const.
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
---
dlls/d3dcompiler_43/utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c
index b0232f3..748501f 100644
--- a/dlls/d3dcompiler_43/utils.c
+++ b/dlls/d3dcompiler_43/utils.c
@@ -1154,7 +1154,7 @@ static BOOL expr_compatible_data_types(struct hlsl_type *t1, struct hlsl_type *t
static enum hlsl_base_type expr_common_base_type(enum hlsl_base_type t1, enum hlsl_base_type t2)
{
- enum hlsl_base_type types[] =
+ static const enum hlsl_base_type types[] =
{
HLSL_TYPE_BOOL,
HLSL_TYPE_INT,
--
1.9.1

View File

@ -1,90 +0,0 @@
From 99ff0c4871819ad0eef719e22ce8bd61c90ff1b6 Mon Sep 17 00:00:00 2001
From: Piotr Caban <piotr@codeweavers.com>
Date: Wed, 1 Aug 2018 17:23:23 +0200
Subject: [PATCH 23/24] wbemprox: Add
Win32_NetworkAdapterConfiguration::IPAddress property.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
---
dlls/wbemprox/builtin.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index 73f4192..532ee88 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -255,6 +255,8 @@ static const WCHAR prop_interfacetypeW[] =
{'I','n','t','e','r','f','a','c','e','T','y','p','e',0};
static const WCHAR prop_intvalueW[] =
{'I','n','t','e','g','e','r','V','a','l','u','e',0};
+static const WCHAR prop_ipaddressW[] =
+ {'I','P','A','d','d','r','e','s','s',0};
static const WCHAR prop_ipconnectionmetricW[] =
{'I','P','C','o','n','n','e','c','t','i','o','n','M','e','t','r','i','c',0};
static const WCHAR prop_ipenabledW[] =
@@ -553,6 +555,7 @@ static const struct column col_networkadapterconfig[] =
{ prop_dnshostnameW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_dnsserversearchorderW, CIM_STRING|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC },
{ prop_indexW, CIM_UINT32|COL_FLAG_KEY, VT_I4 },
+ { prop_ipaddressW, CIM_STRING|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC },
{ prop_ipconnectionmetricW, CIM_UINT32, VT_I4 },
{ prop_ipenabledW, CIM_BOOLEAN },
{ prop_macaddressW, CIM_STRING|COL_FLAG_DYNAMIC },
@@ -970,6 +973,7 @@ struct record_networkadapterconfig
const WCHAR *dnshostname;
const struct array *dnsserversearchorder;
UINT32 index;
+ const struct array *ipaddress;
UINT32 ipconnectionmetric;
int ipenabled;
const WCHAR *mac_address;
@@ -2426,6 +2430,38 @@ static struct array *get_dnsserversearchorder( IP_ADAPTER_DNS_SERVER_ADDRESS *li
ret->ptr = ptr;
return ret;
}
+static struct array *get_ipaddress( IP_ADAPTER_UNICAST_ADDRESS_LH *list )
+{
+ IP_ADAPTER_UNICAST_ADDRESS_LH *address;
+ struct array *ret;
+ ULONG buflen, i = 0, count = 0;
+ WCHAR **ptr, buf[54]; /* max IPv6 address length */
+
+ if (!list) return NULL;
+ for (address = list; address; address = address->Next) count++;
+
+ if (!(ret = heap_alloc( sizeof(*ret) ))) return NULL;
+ if (!(ptr = heap_alloc( sizeof(*ptr) * count )))
+ {
+ heap_free( ret );
+ return NULL;
+ }
+ for (address = list; address; address = address->Next)
+ {
+ buflen = sizeof(buf)/sizeof(buf[0]);
+ if (WSAAddressToStringW( address->Address.lpSockaddr, address->Address.iSockaddrLength,
+ NULL, buf, &buflen) || !(ptr[i++] = heap_strdupW( buf )))
+ {
+ for (; i > 0; i--) heap_free( ptr[i - 1] );
+ heap_free( ptr );
+ heap_free( ret );
+ return NULL;
+ }
+ }
+ ret->count = count;
+ ret->ptr = ptr;
+ return ret;
+}
static WCHAR *get_settingid( UINT32 index )
{
GUID guid;
@@ -2475,6 +2511,7 @@ static enum fill_status fill_networkadapterconfig( struct table *table, const st
rec->dnshostname = get_dnshostname( aa->FirstUnicastAddress );
rec->dnsserversearchorder = get_dnsserversearchorder( aa->FirstDnsServerAddress );
rec->index = aa->u.s.IfIndex;
+ rec->ipaddress = get_ipaddress( aa->FirstUnicastAddress );
rec->ipconnectionmetric = 20;
rec->ipenabled = -1;
rec->mac_address = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength );
--
1.9.1

View File

@ -1,118 +0,0 @@
From 9a8c43ec5ce2155b66de3623bf2af036f959a964 Mon Sep 17 00:00:00 2001
From: Piotr Caban <piotr@codeweavers.com>
Date: Wed, 1 Aug 2018 17:23:29 +0200
Subject: [PATCH 24/24] wbemprox: Add
Win32_NetworkAdapterConfiguration::IPSubnet property.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
---
dlls/wbemprox/builtin.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index 532ee88..190f710 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -49,6 +49,7 @@
#include "wbemcli.h"
#include "wbemprov.h"
#include "iphlpapi.h"
+#include "netioapi.h"
#include "tlhelp32.h"
#include "d3d10.h"
#include "winternl.h"
@@ -261,6 +262,8 @@ static const WCHAR prop_ipconnectionmetricW[] =
{'I','P','C','o','n','n','e','c','t','i','o','n','M','e','t','r','i','c',0};
static const WCHAR prop_ipenabledW[] =
{'I','P','E','n','a','b','l','e','d',0};
+static const WCHAR prop_ipsubnet[] =
+ {'I','P','S','u','b','n','e','t',0};
static const WCHAR prop_lastbootuptimeW[] =
{'L','a','s','t','B','o','o','t','U','p','T','i','m','e',0};
static const WCHAR prop_levelW[] =
@@ -558,6 +561,7 @@ static const struct column col_networkadapterconfig[] =
{ prop_ipaddressW, CIM_STRING|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC },
{ prop_ipconnectionmetricW, CIM_UINT32, VT_I4 },
{ prop_ipenabledW, CIM_BOOLEAN },
+ { prop_ipsubnet, CIM_STRING|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC },
{ prop_macaddressW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_settingidW, CIM_STRING|COL_FLAG_DYNAMIC }
};
@@ -976,6 +980,7 @@ struct record_networkadapterconfig
const struct array *ipaddress;
UINT32 ipconnectionmetric;
int ipenabled;
+ const struct array *ipsubnet;
const WCHAR *mac_address;
const WCHAR *settingid;
};
@@ -2462,6 +2467,58 @@ static struct array *get_ipaddress( IP_ADAPTER_UNICAST_ADDRESS_LH *list )
ret->ptr = ptr;
return ret;
}
+static struct array *get_ipsubnet( IP_ADAPTER_UNICAST_ADDRESS_LH *list )
+{
+ IP_ADAPTER_UNICAST_ADDRESS_LH *address;
+ struct array *ret;
+ ULONG i = 0, count = 0;
+ WCHAR **ptr;
+
+ if (!list) return NULL;
+ for (address = list; address; address = address->Next) count++;
+
+ if (!(ret = heap_alloc( sizeof(*ret) ))) return NULL;
+ if (!(ptr = heap_alloc( sizeof(*ptr) * count )))
+ {
+ heap_free( ret );
+ return NULL;
+ }
+ for (address = list; address; address = address->Next)
+ {
+ if (address->Address.lpSockaddr->sa_family == AF_INET)
+ {
+ WCHAR buf[INET_ADDRSTRLEN];
+ SOCKADDR_IN addr;
+ ULONG buflen = sizeof(buf)/sizeof(buf[0]);
+
+ memset( &addr, 0, sizeof(addr) );
+ addr.sin_family = AF_INET;
+ if (ConvertLengthToIpv4Mask( address->OnLinkPrefixLength, &addr.sin_addr.S_un.S_addr ) != NO_ERROR
+ || WSAAddressToStringW( (SOCKADDR*)&addr, sizeof(addr), NULL, buf, &buflen))
+ ptr[i] = NULL;
+ else
+ ptr[i] = heap_strdupW( buf );
+ }
+ else
+ {
+ static const WCHAR fmtW[] = {'%','u',0};
+ WCHAR buf[11];
+
+ sprintfW(buf, fmtW, address->OnLinkPrefixLength);
+ ptr[i] = heap_strdupW( buf );
+ }
+ if (!ptr[i++])
+ {
+ for (; i > 0; i--) heap_free( ptr[i - 1] );
+ heap_free( ptr );
+ heap_free( ret );
+ return NULL;
+ }
+ }
+ ret->count = count;
+ ret->ptr = ptr;
+ return ret;
+}
static WCHAR *get_settingid( UINT32 index )
{
GUID guid;
@@ -2514,6 +2571,7 @@ static enum fill_status fill_networkadapterconfig( struct table *table, const st
rec->ipaddress = get_ipaddress( aa->FirstUnicastAddress );
rec->ipconnectionmetric = 20;
rec->ipenabled = -1;
+ rec->ipsubnet = get_ipsubnet( aa->FirstUnicastAddress );
rec->mac_address = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength );
rec->settingid = get_settingid( rec->index );
if (!match_row( table, row, cond, &status ))
--
1.9.1

View File

@ -1 +0,0 @@
Fixes: [34989] Multiple installers using Caphyon 'Advanced Installer' (AI) technology hang (Atlassian SourceTree v1.3.2, League of Legends 2013+) (deferred type 1 custom action executed before regular type 1 custom action)

View File

@ -1,389 +0,0 @@
From 9ae94214e0afa58f6b518ec34fd325a1ae57230a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 31 Mar 2016 00:58:04 +0200
Subject: msvfw32: Try different formarts in ICGetDisplayFormat.
---
dlls/msvfw32/msvideo_main.c | 90 +++++++++++++----
dlls/msvfw32/tests/msvfw.c | 240 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 308 insertions(+), 22 deletions(-)
diff --git a/dlls/msvfw32/msvideo_main.c b/dlls/msvfw32/msvideo_main.c
index cc5c85d..25b80ff 100644
--- a/dlls/msvfw32/msvideo_main.c
+++ b/dlls/msvfw32/msvideo_main.c
@@ -718,25 +718,80 @@ HIC VFWAPI ICGetDisplayFormat(
HIC hic,LPBITMAPINFOHEADER lpbiIn,LPBITMAPINFOHEADER lpbiOut,
INT depth,INT dx,INT dy)
{
- HIC tmphic = hic;
+ static const struct
+ {
+ int depth;
+ int compression;
+ }
+ try_depths[] =
+ {
+ { 8, BI_RGB},
+ {16, BI_RGB},
+ {16, BI_BITFIELDS},
+ {24, BI_RGB},
+ {32, BI_RGB},
+ };
- TRACE("(%p,%p,%p,%d,%d,%d)!\n",hic,lpbiIn,lpbiOut,depth,dx,dy);
+ int screen_depth, i;
+ BOOL found = FALSE;
+ HIC tmphic;
+ HDC hdc;
- if (!tmphic) {
- tmphic=ICLocate(ICTYPE_VIDEO,0,lpbiIn,NULL,ICMODE_DECOMPRESS);
- if (!tmphic)
- return tmphic;
- }
- if ((dy == lpbiIn->biHeight) && (dx == lpbiIn->biWidth))
- dy = dx = 0; /* no resize needed */
+ TRACE("(%p,%p,%p,%d,%d,%d)!\n", hic, lpbiIn, lpbiOut, depth, dx, dy);
+
+ tmphic = hic ? hic : ICLocate(ICTYPE_VIDEO, 0, lpbiIn, NULL, ICMODE_DECOMPRESS);
+ if (!tmphic) return tmphic;
+
+ hdc = GetDC(0);
+ screen_depth = GetDeviceCaps(hdc, BITSPIXEL) * GetDeviceCaps(hdc, PLANES);
+ ReleaseDC(0, hdc);
+
+ if (!dx) dx = lpbiIn->biWidth;
+ if (!dy) dy = lpbiIn->biHeight;
+ if (!depth) depth = screen_depth;
/* Can we decompress it ? */
- if (ICDecompressQuery(tmphic,lpbiIn,NULL) != 0)
+ if (ICDecompressQuery(tmphic, lpbiIn, NULL) != ICERR_OK)
goto errout; /* no, sorry */
ICSendMessage(tmphic, ICM_DECOMPRESS_GET_FORMAT, (DWORD_PTR)lpbiIn, (DWORD_PTR)lpbiOut);
- if (lpbiOut->biCompression != 0) {
+ lpbiOut->biSize = sizeof(BITMAPINFOHEADER);
+ lpbiOut->biWidth = dx;
+ lpbiOut->biHeight = dy;
+ lpbiOut->biPlanes = 1;
+ lpbiOut->biSizeImage = 0;
+
+ for (i = 0; i < sizeof(try_depths) / sizeof(try_depths[0]); i++)
+ {
+ if (!found && try_depths[i].depth != depth)
+ continue;
+
+ found = TRUE;
+ lpbiOut->biBitCount = try_depths[i].depth;
+ lpbiOut->biCompression = try_depths[i].compression;
+
+ if (ICDecompressQuery(tmphic, lpbiIn, lpbiOut) == ICERR_OK)
+ goto success;
+ }
+
+ if (!found)
+ {
+ lpbiOut->biBitCount = depth;
+ lpbiOut->biCompression = BI_RGB;
+ if (ICDecompressQuery(tmphic, lpbiIn, lpbiOut) == ICERR_OK)
+ goto success;
+
+ lpbiOut->biBitCount = screen_depth;
+ lpbiOut->biCompression = BI_RGB;
+ if (ICDecompressQuery(tmphic, lpbiIn, lpbiOut) == ICERR_OK)
+ goto success;
+ }
+
+ if (ICSendMessage(tmphic, ICM_DECOMPRESS_GET_FORMAT, (DWORD_PTR)lpbiIn, (DWORD_PTR)lpbiOut))
+ goto errout;
+
+ if (lpbiOut->biCompression != 0) {
FIXME("Ooch, how come decompressor outputs compressed data (%d)??\n",
lpbiOut->biCompression);
}
@@ -745,20 +800,11 @@ HIC VFWAPI ICGetDisplayFormat(
lpbiOut->biSize);
lpbiOut->biSize = sizeof(*lpbiOut);
}
- if (!depth) {
- HDC hdc;
-
- hdc = GetDC(0);
- depth = GetDeviceCaps(hdc,BITSPIXEL)*GetDeviceCaps(hdc,PLANES);
- ReleaseDC(0,hdc);
- if (depth==15) depth = 16;
- if (depth<8) depth = 8;
- }
- if (lpbiIn->biBitCount == 8)
- depth = 8;
+success:
TRACE("=> %p\n", tmphic);
return tmphic;
+
errout:
if (hic!=tmphic)
ICClose(tmphic);
diff --git a/dlls/msvfw32/tests/msvfw.c b/dlls/msvfw32/tests/msvfw.c
index 3fe6702..22b32ee 100644
--- a/dlls/msvfw32/tests/msvfw.c
+++ b/dlls/msvfw32/tests/msvfw.c
@@ -285,6 +285,245 @@ static void test_ICSeqCompress(void)
ok(err == ICERR_BADHANDLE, "Expected -8, got %d\n", err);
}
+struct msg_result
+{
+ int msg_index;
+ UINT msg;
+ BOOL output_format;
+ int width;
+ int height;
+ int bits;
+ int compression;
+ LRESULT result;
+ BOOL todo;
+};
+
+static struct msg_result expected_msgs[] =
+{
+ /* Wine bug - shouldn't be called */
+ { 0, DRV_LOAD, FALSE, 0, 0, 0, 0, TRUE, TRUE},
+ { 0, DRV_ENABLE, FALSE, 0, 0, 0, 0, 0, TRUE},
+
+ { 0, DRV_OPEN, FALSE, 0, 0, 0, 0, 0xdeadbeef, FALSE},
+
+ /* test 1 */
+ { 1, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE},
+ { 2, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_BADFORMAT, FALSE},
+ { 3, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 8, BI_RGB, ICERR_BADFORMAT, FALSE},
+ { 4, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 16, BI_RGB, ICERR_BADFORMAT, FALSE},
+ { 5, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 16, BI_BITFIELDS, ICERR_BADFORMAT, FALSE},
+ { 6, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 24, BI_RGB, ICERR_BADFORMAT, FALSE},
+ { 7, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 32, BI_RGB, ICERR_BADFORMAT, FALSE},
+ { 8, ICM_DECOMPRESS_GET_FORMAT, TRUE, 640, 480, 32, BI_RGB, ICERR_OK, FALSE},
+
+ /* test 2 */
+ { 9, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE},
+ {10, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_BADFORMAT, FALSE},
+ {11, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 8, BI_RGB, ICERR_BADFORMAT, FALSE},
+ {12, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 16, BI_RGB, ICERR_OK, FALSE},
+
+ /* test 3 */
+ {13, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE},
+ {14, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE},
+ {15, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 8, BI_RGB, ICERR_BADFORMAT, FALSE},
+ {16, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 16, BI_RGB, ICERR_OK, FALSE},
+
+ /* test 4 */
+ {17, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE},
+ {18, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_BADFORMAT, FALSE},
+ {19, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 24, BI_RGB, ICERR_BADFORMAT, FALSE},
+ {20, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 32, BI_RGB, ICERR_BADFORMAT, FALSE},
+ {21, ICM_DECOMPRESS_GET_FORMAT, TRUE, 640, 480, 32, BI_RGB, ICERR_OK, FALSE},
+
+ /* test 5 */
+ {22, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE},
+ {23, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE},
+ {24, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 32, BI_RGB, ICERR_OK, FALSE},
+
+ /* test 6 */
+ {25, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE},
+ {26, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE},
+ {27, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 32, BI_RGB, ICERR_OK, FALSE},
+
+ /* test 7 */
+ {28, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE},
+ {29, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE},
+ {30, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 9, BI_RGB, ICERR_BADFORMAT, FALSE},
+ {31, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 32, BI_RGB, ICERR_BADFORMAT, FALSE},
+ {32, ICM_DECOMPRESS_GET_FORMAT, TRUE, 640, 480, 32, BI_RGB, ICERR_OK, FALSE},
+
+ /* test 8 */
+ {33, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE},
+ {34, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE},
+ {35, ICM_DECOMPRESS_QUERY, TRUE, 800, 600, 32, BI_RGB, ICERR_OK, FALSE},
+
+ /* Wine bug - shouldn't be called */
+ {36, DRV_DISABLE, FALSE, 0, 0, 0, 0, ICERR_OK, TRUE},
+ {36, DRV_FREE, FALSE, 0, 0, 0, 0, ICERR_OK, TRUE},
+};
+
+static int msg_index = 0;
+
+static struct msg_result *get_expected_msg(UINT msg)
+{
+ int i = 0;
+ for(; i < sizeof(expected_msgs) / sizeof(expected_msgs[0]); i++)
+ {
+ if (expected_msgs[i].msg_index == msg_index && expected_msgs[i].msg == msg)
+ return &expected_msgs[i];
+ }
+ return NULL;
+}
+
+LRESULT WINAPI driver_proc_test(DWORD_PTR dwDriverId, HDRVR hdrvr, UINT msg,
+ LPARAM lParam1, LPARAM lParam2)
+{
+ struct msg_result *expected = get_expected_msg(msg);
+ LRESULT res = expected ? expected->result : ICERR_UNSUPPORTED;
+
+ if (msg == DRV_CLOSE)
+ return ICERR_OK;
+
+ if (!expected)
+ {
+ ok(0, "unexpected message: %04x %ld %ld at msg index %d\n",
+ msg, lParam1, lParam2, msg_index);
+ return ICERR_UNSUPPORTED;
+ }
+ else if (expected->todo)
+ {
+ todo_wine ok(0, "unexpected message: %04x %ld %ld at msg index %d\n",
+ msg, lParam1, lParam2, msg_index);
+ return res;
+ }
+
+ switch (msg)
+ {
+ case ICM_DECOMPRESS_QUERY:
+ {
+ BITMAPINFOHEADER *out = (BITMAPINFOHEADER *)lParam2;
+
+ if (!lParam2)
+ {
+ trace("query -> without format\n");
+ ok(!expected->output_format, "Expected no output format pointer\n");
+ break;
+ }
+
+ ok(expected->output_format, "Expected output format pointer\n");
+ ok(out->biWidth == expected->width,
+ "Expected width %d, got %d\n", expected->width, out->biWidth);
+ ok(out->biHeight == expected->height,
+ "Expected height %d, got %d\n", expected->height, out->biHeight);
+ ok(out->biBitCount == expected->bits,
+ "Expected biBitCount %d, got %d\n", expected->bits, out->biBitCount);
+ ok(out->biCompression == expected->compression,
+ "Expected compression %d, got %d\n", expected->compression, out->biCompression);
+
+ trace("query -> width: %d, height: %d, bit: %d, compression: %d\n",
+ out->biWidth, out->biHeight, out->biBitCount, out->biCompression);
+ break;
+ }
+
+ case ICM_DECOMPRESS_GET_FORMAT:
+ {
+ BITMAPINFOHEADER *out = (BITMAPINFOHEADER *)lParam2;
+
+ if (!lParam2)
+ {
+ trace("format -> without format\n");
+ ok(!expected->output_format, "Expected no output format pointer\n");
+ break;
+ }
+
+ ok(expected->output_format, "Expected output format pointer\n");
+ ok(out->biWidth == expected->width,
+ "Expected width %d, got %d\n", expected->width, out->biWidth);
+ ok(out->biHeight == expected->height,
+ "Expected height %d, got %d\n", expected->height, out->biHeight);
+ ok(out->biBitCount == expected->bits,
+ "Expected biBitCount %d, got %d\n", expected->bits, out->biBitCount);
+ ok(out->biCompression == expected->compression,
+ "Expected compression %d, got %d\n", expected->compression, out->biCompression);
+
+ trace("format -> width: %d, height: %d, bit: %d, compression: %d\n",
+ out->biWidth, out->biHeight, out->biBitCount, out->biCompression);
+
+ out->biBitCount = 64;
+ break;
+ }
+ }
+
+ msg_index++;
+ return res;
+}
+
+
+void test_ICGetDisplayFormat(void)
+{
+ static const struct
+ {
+ int bits_wanted;
+ int bits_expected;
+ int dx;
+ int width_expected;
+ int dy;
+ int height_expected;
+ int msg_index;
+ }
+ tests[] =
+ {
+ { 8, 64, 0, 640, 0, 480, 9},
+ { 8, 16, 0, 640, 0, 480, 13},
+ { 8, 16, 0, 640, 0, 480, 17},
+ {24, 64, 0, 640, 0, 480, 22},
+ {32, 32, 0, 640, 0, 480, 25},
+ { 0, 32, 0, 640, 0, 480, 28},
+ { 9, 64, 0, 640, 0, 480, 33},
+ {32, 32, 800, 800, 600, 600, 36},
+ };
+
+ HIC ic, ic2;
+ BITMAPINFOHEADER in;
+ BITMAPINFOHEADER out;
+ int i;
+
+ ic = ICOpenFunction(ICTYPE_VIDEO, 0xdeadbeef, ICMODE_DECOMPRESS, driver_proc_test);
+ ok(!!ic, "Opening driver failed\n");
+
+ for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
+ {
+ memset(&in, 0, sizeof(in));
+ memset(&out, 0, sizeof(out));
+
+ in.biSize = sizeof(in);
+ in.biWidth = 640;
+ in.biHeight = 480;
+ in.biPlanes = 1;
+ in.biBitCount = 32;
+ in.biCompression = BI_PNG;
+ in.biSizeImage = 1024;
+
+ out.biBitCount = 16;
+ out.biWidth = 320;
+ out.biHeight = 240;
+
+ ic2 = ICGetDisplayFormat(ic, &in, &out, tests[i].bits_wanted, tests[i].dx, tests[i].dy);
+ ok(!!ic2, "Expected ICGetDisplayFormat to succeeded\n");
+
+ ok(out.biBitCount == tests[i].bits_expected,
+ "Expected biBitCount %d, got %d\n", tests[i].bits_expected, out.biBitCount);
+ ok(out.biWidth == tests[i].width_expected,
+ "Expected biWidth %d, got %d\n", tests[i].width_expected, out.biWidth);
+ ok(out.biHeight == tests[i].height_expected,
+ "Expected biHeight %d, got %d\n", tests[i].height_expected, out.biHeight);
+ ok(msg_index == tests[i].msg_index,
+ "Expected msg_index %d, got %d\n", tests[i].msg_index, msg_index);
+ }
+
+ ICClose(ic);
+}
+
static void test_ICInfo(void)
{
ICINFO info, info2;
@@ -324,5 +563,6 @@ START_TEST(msvfw)
test_OpenCase();
test_Locate();
test_ICSeqCompress();
+ test_ICGetDisplayFormat();
test_ICInfo();
}
--
2.9.0

View File

@ -1,64 +0,0 @@
From 37a47ad2b8a776a15d1e0431c0e1c1924884fbe1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 31 Mar 2016 17:17:20 +0200
Subject: msvfw32: Add test for negative width/height values passed to
ICGetDisplayFormat.
---
dlls/msvfw32/msvideo_main.c | 4 ++--
dlls/msvfw32/tests/msvfw.c | 16 ++++++++++++++--
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/dlls/msvfw32/msvideo_main.c b/dlls/msvfw32/msvideo_main.c
index 28f405e..41bd234 100644
--- a/dlls/msvfw32/msvideo_main.c
+++ b/dlls/msvfw32/msvideo_main.c
@@ -747,8 +747,8 @@ HIC VFWAPI ICGetDisplayFormat(
screen_depth = GetDeviceCaps(hdc, BITSPIXEL) * GetDeviceCaps(hdc, PLANES);
ReleaseDC(0, hdc);
- if (!dx) dx = lpbiIn->biWidth;
- if (!dy) dy = lpbiIn->biHeight;
+ if (dx <= 0) dx = lpbiIn->biWidth;
+ if (dy <= 0) dy = lpbiIn->biHeight;
if (!depth) depth = screen_depth;
/* Can we decompress it ? */
diff --git a/dlls/msvfw32/tests/msvfw.c b/dlls/msvfw32/tests/msvfw.c
index 7fd4c43..36dec1d 100644
--- a/dlls/msvfw32/tests/msvfw.c
+++ b/dlls/msvfw32/tests/msvfw.c
@@ -357,9 +357,19 @@ static struct msg_result expected_msgs[] =
{34, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE},
{35, ICM_DECOMPRESS_QUERY, TRUE, 800, 600, 32, BI_RGB, ICERR_OK, FALSE},
+ /* test 9 */
+ {36, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE},
+ {37, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE},
+ {38, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 32, BI_RGB, ICERR_OK, FALSE},
+
+ /* test 10 */
+ {39, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE},
+ {40, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE},
+ {41, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 32, BI_RGB, ICERR_OK, FALSE},
+
/* Wine bug - shouldn't be called */
- {36, DRV_DISABLE, FALSE, 0, 0, 0, 0, ICERR_OK, TRUE},
- {36, DRV_FREE, FALSE, 0, 0, 0, 0, ICERR_OK, TRUE},
+ {42, DRV_DISABLE, FALSE, 0, 0, 0, 0, ICERR_OK, TRUE},
+ {42, DRV_FREE, FALSE, 0, 0, 0, 0, ICERR_OK, TRUE},
};
static int msg_index = 0;
@@ -481,6 +491,8 @@ void test_ICGetDisplayFormat(void)
{ 0, 32, 0, 640, 0, 480, 28},
{ 9, 64, 0, 640, 0, 480, 33},
{32, 32, 800, 800, 600, 600, 36},
+ {32, 32, -1, 640, -1, 480, 39},
+ {32, 32, -90, 640, -60, 480, 42},
};
HIC ic, ic2;
--
2.7.1

View File

@ -1,95 +0,0 @@
From cd04ddddb9d9fcf5011b49320682fefb0b7a28c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 2 Apr 2016 16:13:44 +0200
Subject: msvfw32: Set biSizeImage correctly in ICGetDisplayFormat.
---
dlls/msvfw32/msvideo_main.c | 4 +++-
dlls/msvfw32/tests/msvfw.c | 15 +++++++++++----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/dlls/msvfw32/msvideo_main.c b/dlls/msvfw32/msvideo_main.c
index 41bd234..6f91859 100644
--- a/dlls/msvfw32/msvideo_main.c
+++ b/dlls/msvfw32/msvideo_main.c
@@ -761,7 +761,6 @@ HIC VFWAPI ICGetDisplayFormat(
lpbiOut->biWidth = dx;
lpbiOut->biHeight = dy;
lpbiOut->biPlanes = 1;
- lpbiOut->biSizeImage = 0;
for (i = 0; i < sizeof(try_depths) / sizeof(try_depths[0]); i++)
{
@@ -771,6 +770,7 @@ HIC VFWAPI ICGetDisplayFormat(
found = TRUE;
lpbiOut->biBitCount = try_depths[i].depth;
lpbiOut->biCompression = try_depths[i].compression;
+ lpbiOut->biSizeImage = dx * dy * lpbiOut->biBitCount / 8;
if (ICDecompressQuery(tmphic, lpbiIn, lpbiOut) == ICERR_OK)
goto success;
@@ -780,11 +780,13 @@ HIC VFWAPI ICGetDisplayFormat(
{
lpbiOut->biBitCount = depth;
lpbiOut->biCompression = BI_RGB;
+ lpbiOut->biSizeImage = (dx * dy * depth) / 8;
if (ICDecompressQuery(tmphic, lpbiIn, lpbiOut) == ICERR_OK)
goto success;
lpbiOut->biBitCount = screen_depth;
lpbiOut->biCompression = BI_RGB;
+ lpbiOut->biSizeImage = dx * dy * screen_depth / 8;
if (ICDecompressQuery(tmphic, lpbiIn, lpbiOut) == ICERR_OK)
goto success;
}
diff --git a/dlls/msvfw32/tests/msvfw.c b/dlls/msvfw32/tests/msvfw.c
index 36dec1d..252aba2 100644
--- a/dlls/msvfw32/tests/msvfw.c
+++ b/dlls/msvfw32/tests/msvfw.c
@@ -429,9 +429,12 @@ LRESULT WINAPI driver_proc_test(DWORD_PTR dwDriverId, HDRVR hdrvr, UINT msg,
"Expected biBitCount %d, got %d\n", expected->bits, out->biBitCount);
ok(out->biCompression == expected->compression,
"Expected compression %d, got %d\n", expected->compression, out->biCompression);
+ ok(out->biSizeImage == (out->biWidth * out->biHeight * out->biBitCount) / 8,
+ "Expected biSizeImage %d, got %d\n", (out->biWidth * out->biHeight * out->biBitCount) / 8,
+ out->biSizeImage);
- trace("query -> width: %d, height: %d, bit: %d, compression: %d\n",
- out->biWidth, out->biHeight, out->biBitCount, out->biCompression);
+ trace("query -> width: %d, height: %d, bit: %d, compression: %d, size: %d\n",
+ out->biWidth, out->biHeight, out->biBitCount, out->biCompression, out->biSizeImage);
break;
}
@@ -456,8 +459,8 @@ LRESULT WINAPI driver_proc_test(DWORD_PTR dwDriverId, HDRVR hdrvr, UINT msg,
ok(out->biCompression == expected->compression,
"Expected compression %d, got %d\n", expected->compression, out->biCompression);
- trace("format -> width: %d, height: %d, bit: %d, compression: %d\n",
- out->biWidth, out->biHeight, out->biBitCount, out->biCompression);
+ trace("format -> width: %d, height: %d, bit: %d, compression: %d, size: %d\n",
+ out->biWidth, out->biHeight, out->biBitCount, out->biCompression, out->biSizeImage);
out->biBitCount = 64;
break;
@@ -498,6 +501,7 @@ void test_ICGetDisplayFormat(void)
HIC ic, ic2;
BITMAPINFOHEADER in;
BITMAPINFOHEADER out;
+ int real_depth;
int i;
ic = ICOpenFunction(ICTYPE_VIDEO, 0xdeadbeef, ICMODE_DECOMPRESS, driver_proc_test);
@@ -529,6 +533,9 @@ void test_ICGetDisplayFormat(void)
"Expected biWidth %d, got %d\n", tests[i].width_expected, out.biWidth);
ok(out.biHeight == tests[i].height_expected,
"Expected biHeight %d, got %d\n", tests[i].height_expected, out.biHeight);
+ real_depth = (out.biBitCount > 32) ? 4 : out.biBitCount / 8;
+ ok(out.biSizeImage == out.biWidth * out.biHeight * real_depth,
+ "Expected biSizeImage %d, got %d\n", out.biWidth * out.biHeight * real_depth, out.biSizeImage);
ok(msg_index == tests[i].msg_index,
"Expected msg_index %d, got %d\n", tests[i].msg_index, msg_index);
}
--
2.7.1

View File

@ -1,146 +0,0 @@
From 6c25d94295130d7ab3e07dd985311520d303aad2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 3 Apr 2016 17:47:43 +0200
Subject: msvfw32: Take stride into account and ask for palette in
ICGetDisplayFormat.
---
dlls/msvfw32/msvideo_main.c | 15 ++++++++++++---
dlls/msvfw32/tests/msvfw.c | 45 ++++++++++++++++++++++++++++++++++++++-------
2 files changed, 50 insertions(+), 10 deletions(-)
diff --git a/dlls/msvfw32/msvideo_main.c b/dlls/msvfw32/msvideo_main.c
index 6f91859..e3a7719 100644
--- a/dlls/msvfw32/msvideo_main.c
+++ b/dlls/msvfw32/msvideo_main.c
@@ -98,6 +98,11 @@ static const char *wine_dbgstr_icerr( int ret )
return str;
}
+static inline int get_stride(int width, int depth)
+{
+ return ((depth * width + 31) >> 3) & ~3;
+}
+
static WINE_HIC* MSVIDEO_FirstHic /* = NULL */;
typedef struct _reg_driver reg_driver;
@@ -770,23 +775,27 @@ HIC VFWAPI ICGetDisplayFormat(
found = TRUE;
lpbiOut->biBitCount = try_depths[i].depth;
lpbiOut->biCompression = try_depths[i].compression;
- lpbiOut->biSizeImage = dx * dy * lpbiOut->biBitCount / 8;
+ lpbiOut->biSizeImage = dx * get_stride(dy, lpbiOut->biBitCount);
if (ICDecompressQuery(tmphic, lpbiIn, lpbiOut) == ICERR_OK)
+ {
+ if (try_depths[i].depth == 8)
+ ICDecompressGetPalette(tmphic, lpbiIn, lpbiOut);
goto success;
+ }
}
if (!found)
{
lpbiOut->biBitCount = depth;
lpbiOut->biCompression = BI_RGB;
- lpbiOut->biSizeImage = (dx * dy * depth) / 8;
+ lpbiOut->biSizeImage = dx * get_stride(dy, lpbiOut->biBitCount);
if (ICDecompressQuery(tmphic, lpbiIn, lpbiOut) == ICERR_OK)
goto success;
lpbiOut->biBitCount = screen_depth;
lpbiOut->biCompression = BI_RGB;
- lpbiOut->biSizeImage = dx * dy * screen_depth / 8;
+ lpbiOut->biSizeImage = dx * get_stride(dy, lpbiOut->biBitCount);
if (ICDecompressQuery(tmphic, lpbiIn, lpbiOut) == ICERR_OK)
goto success;
}
diff --git a/dlls/msvfw32/tests/msvfw.c b/dlls/msvfw32/tests/msvfw.c
index 252aba2..91628e2 100644
--- a/dlls/msvfw32/tests/msvfw.c
+++ b/dlls/msvfw32/tests/msvfw.c
@@ -25,6 +25,11 @@
#include "wine/test.h"
+static inline int get_stride(int width, int depth)
+{
+ return ((depth * width + 31) >> 3) & ~3;
+}
+
static void test_OpenCase(void)
{
HIC h;
@@ -367,9 +372,30 @@ static struct msg_result expected_msgs[] =
{40, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE},
{41, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 32, BI_RGB, ICERR_OK, FALSE},
+ /* test 11 */
+ {42, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE},
+ {43, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE},
+ {44, ICM_DECOMPRESS_QUERY, TRUE, 270, 270, 8, BI_RGB, ICERR_OK, FALSE},
+ {45, ICM_DECOMPRESS_GET_PALETTE, FALSE, 0, 0, 0, 0, ICERR_UNSUPPORTED, FALSE},
+
+ /* test 12 */
+ {46, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE},
+ {47, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE},
+ {48, ICM_DECOMPRESS_QUERY, TRUE, 270, 270, 16, BI_RGB, ICERR_OK, FALSE},
+
+ /* test 13 */
+ {49, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE},
+ {50, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE},
+ {51, ICM_DECOMPRESS_QUERY, TRUE, 270, 270, 24, BI_RGB, ICERR_OK, FALSE},
+
+ /* test 14 */
+ {52, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE},
+ {53, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE},
+ {54, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 4, BI_RGB, ICERR_OK, FALSE},
+
/* Wine bug - shouldn't be called */
- {42, DRV_DISABLE, FALSE, 0, 0, 0, 0, ICERR_OK, TRUE},
- {42, DRV_FREE, FALSE, 0, 0, 0, 0, ICERR_OK, TRUE},
+ {55, DRV_DISABLE, FALSE, 0, 0, 0, 0, ICERR_OK, TRUE},
+ {55, DRV_FREE, FALSE, 0, 0, 0, 0, ICERR_OK, TRUE},
};
static int msg_index = 0;
@@ -429,8 +455,8 @@ LRESULT WINAPI driver_proc_test(DWORD_PTR dwDriverId, HDRVR hdrvr, UINT msg,
"Expected biBitCount %d, got %d\n", expected->bits, out->biBitCount);
ok(out->biCompression == expected->compression,
"Expected compression %d, got %d\n", expected->compression, out->biCompression);
- ok(out->biSizeImage == (out->biWidth * out->biHeight * out->biBitCount) / 8,
- "Expected biSizeImage %d, got %d\n", (out->biWidth * out->biHeight * out->biBitCount) / 8,
+ ok(out->biSizeImage == get_stride(out->biWidth, out->biBitCount) * out->biHeight,
+ "Expected biSizeImage %d, got %d\n", get_stride(out->biWidth, out->biBitCount) * out->biHeight,
out->biSizeImage);
trace("query -> width: %d, height: %d, bit: %d, compression: %d, size: %d\n",
@@ -496,6 +522,10 @@ void test_ICGetDisplayFormat(void)
{32, 32, 800, 800, 600, 600, 36},
{32, 32, -1, 640, -1, 480, 39},
{32, 32, -90, 640, -60, 480, 42},
+ { 8, 8, 270, 270, 270, 270, 46},
+ {16, 16, 270, 270, 270, 270, 49},
+ {24, 24, 270, 270, 270, 270, 52},
+ { 4, 4, 0, 640, 0, 480, 55},
};
HIC ic, ic2;
@@ -533,9 +563,10 @@ void test_ICGetDisplayFormat(void)
"Expected biWidth %d, got %d\n", tests[i].width_expected, out.biWidth);
ok(out.biHeight == tests[i].height_expected,
"Expected biHeight %d, got %d\n", tests[i].height_expected, out.biHeight);
- real_depth = (out.biBitCount > 32) ? 4 : out.biBitCount / 8;
- ok(out.biSizeImage == out.biWidth * out.biHeight * real_depth,
- "Expected biSizeImage %d, got %d\n", out.biWidth * out.biHeight * real_depth, out.biSizeImage);
+ real_depth = (out.biBitCount > 32) ? 32 : out.biBitCount;
+ ok(out.biSizeImage == get_stride(out.biWidth, real_depth) * out.biHeight,
+ "Expected biSizeImage %d, got %d\n", get_stride(out.biWidth, real_depth) * out.biHeight,
+ out.biSizeImage);
ok(msg_index == tests[i].msg_index,
"Expected msg_index %d, got %d\n", tests[i].msg_index, msg_index);
}
--
2.7.1

View File

@ -1,15 +1,15 @@
From cd25e5befd357c848ae4e82f5166ea2465bd6ad7 Mon Sep 17 00:00:00 2001
From 9508597f0940703a95edd8fde9584ef11a9a1e1a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 3 Apr 2016 18:22:29 +0200
Subject: [PATCH] iccvid: Fix calculation of stride and size.
---
dlls/iccvid/iccvid.c | 10 +++++++---
dlls/msvfw32/tests/msvfw.c | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 3 deletions(-)
dlls/iccvid/iccvid.c | 10 ++++++---
dlls/msvfw32/tests/msvfw.c | 45 ++++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/dlls/iccvid/iccvid.c b/dlls/iccvid/iccvid.c
index 89d282b..3977d95 100644
index 89d282ba78..3977d95a41 100644
--- a/dlls/iccvid/iccvid.c
+++ b/dlls/iccvid/iccvid.c
@@ -169,6 +169,10 @@ int x, y;
@ -45,10 +45,22 @@ index 89d282b..3977d95 100644
}
return size;
diff --git a/dlls/msvfw32/tests/msvfw.c b/dlls/msvfw32/tests/msvfw.c
index 127dc24..2507ead 100644
index 406a35b8f1..42f148230e 100644
--- a/dlls/msvfw32/tests/msvfw.c
+++ b/dlls/msvfw32/tests/msvfw.c
@@ -93,6 +93,7 @@ static void test_Locate(void)
@@ -25,6 +25,11 @@
#include "wine/test.h"
+static inline int get_stride(int width, int depth)
+{
+ return ((depth * width + 31) >> 3) & ~3;
+}
+
static void test_OpenCase(void)
{
HIC h;
@@ -88,6 +93,7 @@ static void test_Locate(void)
{
static BITMAPINFOHEADER bi = {sizeof(BITMAPINFOHEADER),32,8, 1,8, BI_RLE8, 0,100000,100000, 0,0};
static BITMAPINFOHEADER bo = {sizeof(BITMAPINFOHEADER),32,8, 1,8, BI_RGB, 0,100000,100000, 0,0};
@ -56,7 +68,7 @@ index 127dc24..2507ead 100644
HIC h;
DWORD err;
@@ -128,6 +129,45 @@ static void test_Locate(void)
@@ -123,6 +129,45 @@ static void test_Locate(void)
ok(err == ICERR_OK, "Query cvid->RGB32 height<0: %d\n", err);
bo.biHeight = -bo.biHeight;
@ -103,5 +115,5 @@ index 127dc24..2507ead 100644
bo.biBitCount = bi.biBitCount = 8;
--
1.9.1
2.18.0

View File

@ -1,18 +1,18 @@
From 83b15590acbeec9bae0d6ebefb50db07a6bd0b18 Mon Sep 17 00:00:00 2001
From ff5a1ffd966ca678a579f2b1da63290ae107d71c Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 22 Jul 2017 07:21:45 +0200
Subject: ntdll: Improve heap allocation performance. (v2)
Subject: [PATCH] ntdll: Improve heap allocation performance. (v2)
---
configure.ac | 9 ++
dlls/ntdll/heap.c | 322 ++++++++++++++++++++++++++++++++++++++----------------
2 files changed, 234 insertions(+), 97 deletions(-)
dlls/ntdll/heap.c | 321 ++++++++++++++++++++++++++++++++--------------
2 files changed, 234 insertions(+), 96 deletions(-)
diff --git a/configure.ac b/configure.ac
index 44c7eed86f8..b37693c01aa 100644
index b4b3c7c55d..0c9bfe4628 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2655,6 +2655,15 @@ then
@@ -2829,6 +2829,15 @@ then
AC_DEFINE(HAVE___BUILTIN_CLZ, 1, [Define to 1 if you have the `__builtin_clz' built-in function.])
fi
@ -29,7 +29,7 @@ index 44c7eed86f8..b37693c01aa 100644
AC_CACHE_CHECK([for __builtin_popcount], ac_cv_have___builtin_popcount,
AC_LINK_IFELSE([AC_LANG_PROGRAM(,[[return __builtin_popcount(1)]])],
diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index b47c2e69feb..effda46d0bf 100644
index 3f1afd6f0f..a06ba32024 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -3,6 +3,7 @@
@ -96,11 +96,10 @@ index b47c2e69feb..effda46d0bf 100644
/* minimum size that must remain to shrink an allocated block */
#define HEAP_MIN_SHRINK_SIZE (HEAP_MIN_DATA_SIZE+sizeof(ARENA_FREE))
/* minimum size to start allocating large blocks */
@@ -113,24 +121,14 @@ C_ASSERT( sizeof(ARENA_LARGE) % LARGE_ALIGNMENT == 0 );
/* extra size to add at the end of block for tail checking */
@@ -114,23 +122,14 @@ C_ASSERT( sizeof(ARENA_LARGE) % LARGE_ALIGNMENT == 0 );
#define HEAP_TAIL_EXTRA_SIZE(flags) \
((flags & HEAP_TAIL_CHECKING_ENABLED) || RUNNING_ON_VALGRIND ? ALIGNMENT : 0)
-
-/* There will be a free list bucket for every arena size up to and including this value */
-#define HEAP_MAX_SMALL_FREE_LIST 0x100
-C_ASSERT( HEAP_MAX_SMALL_FREE_LIST % ALIGNMENT == 0 );
@ -111,7 +110,7 @@ index b47c2e69feb..effda46d0bf 100644
-{
- 0x200, 0x400, 0x1000, ~0UL
-};
-#define HEAP_NB_FREE_LISTS (sizeof(HEAP_freeListSizes) / sizeof(HEAP_freeListSizes[0]) + HEAP_NB_SMALL_FREE_LISTS)
-#define HEAP_NB_FREE_LISTS (ARRAY_SIZE( HEAP_freeListSizes ) + HEAP_NB_SMALL_FREE_LISTS)
-
-typedef union
-{
@ -129,7 +128,7 @@ index b47c2e69feb..effda46d0bf 100644
struct tagHEAP;
@@ -163,9 +161,17 @@ typedef struct tagHEAP
@@ -163,9 +162,17 @@ typedef struct tagHEAP
DWORD pending_pos; /* Position in pending free requests ring */
ARENA_INUSE **pending_free; /* Ring buffer for pending free requests */
RTL_CRITICAL_SECTION critSection; /* Critical section for serialization */
@ -148,7 +147,7 @@ index b47c2e69feb..effda46d0bf 100644
#define HEAP_MAGIC ((DWORD)('H' | ('E'<<8) | ('A'<<16) | ('P'<<24)))
#define HEAP_DEF_SIZE 0x110000 /* Default heap size = 1Mb + 64Kb */
@@ -182,6 +188,30 @@ static HEAP *processHeap; /* main process heap */
@@ -182,6 +189,30 @@ static HEAP *processHeap; /* main process heap */
static BOOL HEAP_IsRealArena( HEAP *heapPtr, DWORD flags, LPCVOID block, BOOL quiet );
@ -179,7 +178,7 @@ index b47c2e69feb..effda46d0bf 100644
/* mark a block of memory as free for debugging purposes */
static inline void mark_block_free( void *ptr, SIZE_T size, DWORD flags )
{
@@ -303,20 +333,6 @@ static void subheap_notify_free_all(SUBHEAP const *subheap)
@@ -303,20 +334,6 @@ static void subheap_notify_free_all(SUBHEAP const *subheap)
#endif
}
@ -200,7 +199,7 @@ index b47c2e69feb..effda46d0bf 100644
/* get the memory protection type to use for a given heap */
static inline ULONG get_protection_type( DWORD flags )
{
@@ -344,13 +360,31 @@ static void HEAP_Dump( HEAP *heap )
@@ -344,13 +361,31 @@ static void HEAP_Dump( HEAP *heap )
DPRINTF( "Next: %p Sub-heaps:", LIST_ENTRY( heap->entry.next, HEAP, entry ) );
LIST_FOR_EACH_ENTRY( subheap, &heap->subheap_list, SUBHEAP, entry ) DPRINTF( " %p", subheap );
@ -238,7 +237,7 @@ index b47c2e69feb..effda46d0bf 100644
LIST_FOR_EACH_ENTRY( subheap, &heap->subheap_list, SUBHEAP, entry )
{
@@ -365,11 +399,32 @@ static void HEAP_Dump( HEAP *heap )
@@ -365,11 +400,32 @@ static void HEAP_Dump( HEAP *heap )
if (*(DWORD *)ptr & ARENA_FLAG_FREE)
{
ARENA_FREE *pArena = (ARENA_FREE *)ptr;
@ -276,7 +275,7 @@ index b47c2e69feb..effda46d0bf 100644
ptr += sizeof(*pArena) + (pArena->size & ARENA_SIZE_MASK);
arenaSize += sizeof(ARENA_FREE);
freeSize += pArena->size & ARENA_SIZE_MASK;
@@ -477,20 +532,19 @@ static HEAP *HEAP_GetPtr(
@@ -477,20 +533,19 @@ static HEAP *HEAP_GetPtr(
*/
static inline void HEAP_InsertFreeBlock( HEAP *heap, ARENA_FREE *pArena, BOOL last )
{
@ -305,7 +304,7 @@ index b47c2e69feb..effda46d0bf 100644
}
@@ -501,7 +555,19 @@ static inline void HEAP_InsertFreeBlock( HEAP *heap, ARENA_FREE *pArena, BOOL la
@@ -501,7 +556,19 @@ static inline void HEAP_InsertFreeBlock( HEAP *heap, ARENA_FREE *pArena, BOOL la
*/
static inline void HEAP_DeleteFreeBlock( HEAP *heap, ARENA_FREE *pArena )
{
@ -326,7 +325,7 @@ index b47c2e69feb..effda46d0bf 100644
}
@@ -881,6 +947,15 @@ static BOOL validate_large_arena( HEAP *heap, const ARENA_LARGE *arena, BOOL qui
@@ -881,6 +948,15 @@ static BOOL validate_large_arena( HEAP *heap, const ARENA_LARGE *arena, BOOL qui
}
@ -342,7 +341,7 @@ index b47c2e69feb..effda46d0bf 100644
/***********************************************************************
* HEAP_CreateSubHeap
*/
@@ -888,7 +963,6 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
@@ -888,7 +964,6 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
SIZE_T commitSize, SIZE_T totalSize )
{
SUBHEAP *subheap;
@ -350,7 +349,7 @@ index b47c2e69feb..effda46d0bf 100644
unsigned int i;
if (!address)
@@ -949,17 +1023,21 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
@@ -949,17 +1024,21 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
subheap->headerSize = ROUND_SIZE( sizeof(HEAP) );
list_add_head( &heap->subheap_list, &subheap->entry );
@ -382,7 +381,7 @@ index b47c2e69feb..effda46d0bf 100644
/* Initialize critical section */
@@ -1002,6 +1080,34 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
@@ -1002,6 +1081,34 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
}
@ -417,7 +416,7 @@ index b47c2e69feb..effda46d0bf 100644
/***********************************************************************
* HEAP_FindFreeBlock
*
@@ -1011,26 +1117,39 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
@@ -1011,26 +1118,39 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, SIZE_T size,
SUBHEAP **ppSubHeap )
{
@ -469,7 +468,7 @@ index b47c2e69feb..effda46d0bf 100644
}
/* If no block was found, attempt to grow the heap */
@@ -1076,13 +1195,10 @@ static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, SIZE_T size,
@@ -1076,13 +1196,10 @@ static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, SIZE_T size,
*/
static BOOL HEAP_IsValidArenaPtr( const HEAP *heap, const ARENA_FREE *ptr )
{
@ -483,7 +482,7 @@ index b47c2e69feb..effda46d0bf 100644
return FALSE;
}
@@ -1094,7 +1210,7 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
@@ -1094,7 +1211,7 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
{
DWORD flags = subheap->heap->flags;
SIZE_T size;
@ -492,7 +491,7 @@ index b47c2e69feb..effda46d0bf 100644
char *heapEnd = (char *)subheap->base + subheap->size;
/* Check for unaligned pointers */
@@ -1111,7 +1227,8 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
@@ -1111,7 +1228,8 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
return FALSE;
}
/* Check size flags */
@ -502,7 +501,7 @@ index b47c2e69feb..effda46d0bf 100644
(pArena->size & ARENA_FLAG_PREV_FREE))
{
ERR("Heap %p: bad flags %08x for free arena %p\n",
@@ -1125,34 +1242,45 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
@@ -1125,34 +1243,45 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
ERR("Heap %p: bad size %08lx for free arena %p\n", subheap->heap, size, pArena );
return FALSE;
}
@ -557,5 +556,5 @@ index b47c2e69feb..effda46d0bf 100644
subheap->heap, prev, pArena );
return FALSE;
--
2.14.1
2.18.0

View File

@ -1,8 +1,8 @@
From 2db198094888b7de074fcac0f27758364d07ef55 Mon Sep 17 00:00:00 2001
From b0535885132a6e2a6e7bebd9a0bad90a4414172b Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 10 Apr 2015 08:17:22 +0200
Subject: Revert "opengl32: Return a NULL pointer for functions requiring
unsupported or disabled extensions."
Subject: [PATCH] Revert "opengl32: Return a NULL pointer for functions
requiring unsupported or disabled extensions."
This reverts commit bfd4836867d6d90eaeae6ccbc02e37678b59b8f1 and following changes.
---
@ -10,10 +10,10 @@ This reverts commit bfd4836867d6d90eaeae6ccbc02e37678b59b8f1 and following chang
1 file changed, 17 deletions(-)
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index f3f78ef..75d3796 100644
index 04ace8effe..716081125e 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -877,24 +877,7 @@ PROC WINAPI wglGetProcAddress( LPCSTR name )
@@ -883,24 +883,7 @@ PROC WINAPI wglGetProcAddress( LPCSTR name )
void *driver_func = funcs->wgl.p_wglGetProcAddress( name );
if (!is_extension_supported(ext_ret->extension))
@ -25,7 +25,7 @@ index f3f78ef..75d3796 100644
- { "glVertexAttribDivisor", "glVertexAttribDivisorARB"}, /* needed by Caffeine */
- };
-
- for (i = 0; i < sizeof(alternatives)/sizeof(alternatives[0]); i++)
- for (i = 0; i < ARRAY_SIZE(alternatives); i++)
- {
- if (strcmp( name, alternatives[i].name )) continue;
- WARN("Extension %s required for %s not supported, trying %s\n",
@ -39,5 +39,5 @@ index f3f78ef..75d3796 100644
if (driver_func == NULL)
{
--
2.6.2
2.18.0

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "25cc380b8ed41652b135657ef7651beef2f20ae4"
echo "ba9f3dc198dfc81bb40159077b73b797006bb73c"
}
# Show version information
@ -115,7 +115,6 @@ patch_enable_all ()
enable_d3dx9_36_32bpp_Alpha_Channel="$1"
enable_d3dx9_36_BumpLuminance="$1"
enable_d3dx9_36_CloneEffect="$1"
enable_d3dx9_36_D3DXCreateTeapot="$1"
enable_d3dx9_36_D3DXDisassembleShader="$1"
enable_d3dx9_36_D3DXOptimizeVertices="$1"
enable_d3dx9_36_D3DXStubs="$1"
@ -145,7 +144,6 @@ patch_enable_all ()
enable_dsound_Fast_Mixer="$1"
enable_dsound_Revert_Cleanup="$1"
enable_dwrite_FontFallback="$1"
enable_dwrite_layout_check="$1"
enable_dxdiagn_Enumerate_DirectSound="$1"
enable_dxdiagn_GetChildContainer_Leaf_Nodes="$1"
enable_dxgi_GammaRamp="$1"
@ -189,13 +187,11 @@ patch_enable_all ()
enable_libs_Debug_Channel="$1"
enable_libs_Unicode_Collation="$1"
enable_loader_OSX_Preloader="$1"
enable_ml_array_size="$1"
enable_ml_patches="$1"
enable_mmsystem_dll16_MIDIHDR_Refcount="$1"
enable_mountmgr_DosDevices="$1"
enable_mscoree_CorValidateImage="$1"
enable_mshtml_HTMLLocation_put_hash="$1"
enable_msi_Deferral="$1"
enable_msi_MsiGetDatabaseState="$1"
enable_msi_msi_vcl_get_cost="$1"
enable_msidb_Implementation="$1"
@ -381,7 +377,6 @@ patch_enable_all ()
enable_wined3d_UAV_Counters="$1"
enable_wined3d_WINED3DFMT_B8G8R8X8_UNORM="$1"
enable_wined3d_WINED3D_RS_COLORWRITEENABLE="$1"
enable_wined3d_texture_blt_device="$1"
enable_wined3d_wined3d_guess_gl_vendor="$1"
enable_winedbg_Process_Arguments="$1"
enable_winedevice_Default_Drivers="$1"
@ -401,7 +396,6 @@ patch_enable_all ()
enable_winex11_Window_Style="$1"
enable_winex11_XEMBED="$1"
enable_winex11__NET_ACTIVE_WINDOW="$1"
enable_winex11_compile_vulkan="$1"
enable_winex11_wglShareLists="$1"
enable_winhttp_Accept_Headers="$1"
enable_winhttp_System_Proxy_Autoconfig="$1"
@ -531,9 +525,6 @@ patch_enable ()
d3dx9_36-CloneEffect)
enable_d3dx9_36_CloneEffect="$2"
;;
d3dx9_36-D3DXCreateTeapot)
enable_d3dx9_36_D3DXCreateTeapot="$2"
;;
d3dx9_36-D3DXDisassembleShader)
enable_d3dx9_36_D3DXDisassembleShader="$2"
;;
@ -621,9 +612,6 @@ patch_enable ()
dwrite-FontFallback)
enable_dwrite_FontFallback="$2"
;;
dwrite-layout-check)
enable_dwrite_layout_check="$2"
;;
dxdiagn-Enumerate_DirectSound)
enable_dxdiagn_Enumerate_DirectSound="$2"
;;
@ -753,9 +741,6 @@ patch_enable ()
loader-OSX_Preloader)
enable_loader_OSX_Preloader="$2"
;;
ml-array_size)
enable_ml_array_size="$2"
;;
ml-patches)
enable_ml_patches="$2"
;;
@ -771,9 +756,6 @@ patch_enable ()
mshtml-HTMLLocation_put_hash)
enable_mshtml_HTMLLocation_put_hash="$2"
;;
msi-Deferral)
enable_msi_Deferral="$2"
;;
msi-MsiGetDatabaseState)
enable_msi_MsiGetDatabaseState="$2"
;;
@ -1329,9 +1311,6 @@ patch_enable ()
wined3d-WINED3D_RS_COLORWRITEENABLE)
enable_wined3d_WINED3D_RS_COLORWRITEENABLE="$2"
;;
wined3d-texture-blt-device)
enable_wined3d_texture_blt_device="$2"
;;
wined3d-wined3d_guess_gl_vendor)
enable_wined3d_wined3d_guess_gl_vendor="$2"
;;
@ -1389,9 +1368,6 @@ patch_enable ()
winex11-_NET_ACTIVE_WINDOW)
enable_winex11__NET_ACTIVE_WINDOW="$2"
;;
winex11-compile-vulkan)
enable_winex11_compile_vulkan="$2"
;;
winex11-wglShareLists)
enable_winex11_wglShareLists="$2"
;;
@ -2353,13 +2329,9 @@ if test "$enable_advapi32_LsaLookupSids" -eq 1; then
fi
if test "$enable_Compiler_Warnings" -eq 1; then
if test "$enable_ml_array_size" -gt 1; then
abort "Patchset ml-array_size disabled, but Compiler_Warnings depends on that."
fi
if test "$enable_ml_patches" -gt 1; then
abort "Patchset ml-patches disabled, but Compiler_Warnings depends on that."
fi
enable_ml_array_size=1
enable_ml_patches=1
fi
@ -2379,220 +2351,28 @@ if test "$enable_patchlist" -eq 1; then
fi
# Patchset ml-array_size
# |
# | Modified files:
# | * dlls/amstream/main.c, dlls/amstream/tests/amstream.c, dlls/browseui/progressdlg.c, dlls/d3d10/effect.c,
# | dlls/d3d8/device.c, dlls/d3dcompiler_43/compiler.c, dlls/d3dcompiler_43/utils.c, dlls/d3dxof/main.c,
# | dlls/dnsapi/query.c, dlls/dpnet/address.c, dlls/dx8vb/main.c, dlls/dxdiagn/provider.c, dlls/evr/main.c,
# | dlls/fusion/asmcache.c, dlls/fusion/fusion.c, dlls/gameux/gameexplorer.c, dlls/hhctrl.ocx/chm.c, dlls/hhctrl.ocx/help.c,
# | dlls/inetcomm/mimeole.c, dlls/inetcomm/protocol.c, dlls/inetcpl.cpl/connections.c, dlls/inetcpl.cpl/general.c,
# | dlls/inetcpl.cpl/security.c, dlls/inetmib1/main.c, dlls/iphlpapi/iphlpapi_main.c, dlls/iphlpapi/ipstats.c,
# | dlls/itss/moniker.c, dlls/itss/protocol.c, dlls/kernel32/computername.c, dlls/kernel32/console.c, dlls/kernel32/file.c,
# | dlls/kernel32/lcformat.c, dlls/kernel32/locale.c, dlls/kernel32/module.c, dlls/kernel32/path.c, dlls/kernel32/process.c,
# | dlls/kernel32/profile.c, dlls/kernel32/sync.c, dlls/kernel32/term.c, dlls/kernel32/volume.c, dlls/krnl386.exe16/int21.c,
# | dlls/krnl386.exe16/interrupts.c, dlls/krnl386.exe16/relay.c, dlls/krnl386.exe16/snoop.c, dlls/krnl386.exe16/vxd.c,
# | dlls/localspl/localmon.c, dlls/localspl/provider.c, dlls/localui/localui.c, dlls/mapi32/sendmail.c, dlls/mapi32/util.c,
# | dlls/mciwave/mciwave.c, dlls/midimap/midimap.c, dlls/mmdevapi/devenum.c, dlls/mmdevapi/main.c,
# | dlls/mountmgr.sys/device.c, dlls/mpr/wnet.c, dlls/msacm32/filter.c, dlls/msacm32/format.c, dlls/msacm32/internal.c,
# | dlls/msacm32/pcmconverter.c, dlls/msacm32/tests/msacm.c, dlls/mscms/profile.c, dlls/mscoree/config.c,
# | dlls/mscoree/corruntimehost.c, dlls/mscoree/mscoree_main.c, dlls/msctf/documentmgr.c, dlls/msrle32/msrle32.c,
# | dlls/msscript.ocx/msscript.c, dlls/msvcrt/console.c, dlls/msvcrt/ctype.c, dlls/msvcrt/errno.c, dlls/msvcrt/except.c,
# | dlls/msvcrt/exit.c, dlls/msvcrt/file.c, dlls/msvcrt/locale.c, dlls/msvcrt/printf.h, dlls/msvcrt/process.c,
# | dlls/msvcrt/scheduler.c, dlls/msvcrt/wcs.c, dlls/msvideo.dll16/msvideo16.c, dlls/scrobj/scrobj.c,
# | dlls/storage.dll16/storage.c, dlls/urlmon/urlmon_main.c, dlls/windowscodecs/bitmap.c, dlls/windowscodecs/bmpencode.c,
# | dlls/windowscodecs/jpegformat.c, dlls/windowscodecs/metadataquery.c, dlls/windowscodecs/pngformat.c,
# | dlls/windowscodecs/tiffformat.c, include/wine/server_protocol.h, programs/attrib/attrib.c, programs/clock/main.c,
# | programs/clock/winclock.c, programs/hostname/hostname.c, programs/icinfo/icinfo.c, programs/ipconfig/ipconfig.c,
# | programs/msiexec/msiexec.c, programs/net/net.c, programs/taskkill/taskkill.c, programs/taskmgr/about.c,
# | programs/taskmgr/affinity.c, programs/taskmgr/applpage.c, programs/taskmgr/column.c, programs/taskmgr/dbgchnl.c,
# | programs/taskmgr/debug.c, programs/taskmgr/endproc.c, programs/taskmgr/perfdata.c, programs/taskmgr/perfpage.c,
# | programs/taskmgr/priority.c, programs/taskmgr/procpage.c, programs/taskmgr/taskmgr.c, programs/taskmgr/trayicon.c,
# | programs/uninstaller/main.c, programs/wineboot/wineboot.c, programs/winetest/gui.c, programs/winetest/main.c,
# | programs/wordpad/wordpad.c, server/request.h, server/trace.c
# |
if test "$enable_ml_array_size" -eq 1; then
patch_apply ml-array_size/0001-windowscodecs-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0003-localspl-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0004-mmdevapi-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0005-mapi32-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0006-krnl386.exe16-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0007-inetcpl.cpl-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0008-hhctrl.ocx-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0009-dpnet-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0010-dx8vb-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0011-fusion-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0012-evr-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0013-d3d10-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0014-d3d8-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0015-d3dcompiler-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0016-d3dxof-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0017-dnsapi-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0019-amstream-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0020-browseui-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0021-gameux-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0022-inetcomm-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0023-iphlpapi-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0024-itss-Remove-a-superfluous-variable-initialization.patch
patch_apply ml-array_size/0025-itss-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0026-attrib-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0027-clock-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0028-hostname-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0029-icinfo-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0030-net-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0031-taskkill-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0032-ipconfig-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0033-msiexec-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0034-taskmgr-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0035-uninstaller-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0036-wineboot-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0037-wordpad-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0038-winetest-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0039-mountmgr.sys-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0040-mpr-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0041-msacm32-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0042-msrle32-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0043-msvcrt-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0044-scrobj-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0045-storage.dll16-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0046-urlmon-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0047-msvideo.dll16-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0048-mscoree-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0049-dxdiagn-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0050-localui-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0051-inetmib1-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0052-kernel32-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0053-mciwave-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0054-midimap-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0055-mscms-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0056-msctf-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0057-msscript.ocx-Use-the-ARRAY_SIZE-macro.patch
(
printf '%s\n' '+ { "Michael Stefaniuc", "windowscodecs: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "localspl: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "mmdevapi: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "mapi32: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "krnl386.exe16: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "inetcpl.cpl: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "hhctrl.ocx: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "dpnet: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "dx8vb: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "fusion: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "evr: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "d3d10: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "d3d8: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "d3dcompiler: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "d3dxof: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "dnsapi: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "amstream: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "browseui: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "gameux: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "inetcomm: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "iphlpapi: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "itss: Remove a superfluous variable initialization.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "itss: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "attrib: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "clock: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "hostname: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "icinfo: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "net: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "taskkill: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "ipconfig: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "msiexec: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "taskmgr: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "uninstaller: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "wineboot: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "wordpad: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "winetest: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "mountmgr.sys: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "mpr: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "msacm32: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "msrle32: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "msvcrt: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "scrobj: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "storage.dll16: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "urlmon: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "msvideo.dll16: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "mscoree: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "dxdiagn: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "localui: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "inetmib1: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "kernel32: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "mciwave: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "midimap: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "mscms: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "msctf: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "msscript.ocx: Use the ARRAY_SIZE() macro.", 1 },';
) >> "$patchlist"
fi
# Patchset ml-patches
# |
# | Modified files:
# | * configure, configure.ac, dlls/api-ms-win-devices-config-l1-1-0/Makefile.in, dlls/api-ms-win-devices-config-l1-1-0/api-
# | ms-win-devices-config-l1-1-0.spec, dlls/d3d8/tests/visual.c, dlls/d3d9/tests/visual.c, dlls/d3dcompiler_43/utils.c,
# | dlls/ddraw/tests/ddraw7.c, dlls/dsound/sound3d.c, dlls/hidclass.sys/hid.h, dlls/hidclass.sys/main.c,
# | dlls/hidclass.sys/pnp.c, dlls/kernel32/process.c, dlls/mpr/tests/mpr.c, dlls/mpr/wnet.c, dlls/msi/custom.c,
# | dlls/msvcp60/ios.c, dlls/msvcp90/ios.c, dlls/ntoskrnl.exe/instr.c, dlls/odbc32/odbc32.spec, dlls/odbc32/proxyodbc.c,
# | dlls/wbemprox/builtin.c, dlls/winebus.sys/bus.h, dlls/winebus.sys/bus_iohid.c, dlls/winebus.sys/bus_sdl.c,
# | dlls/winebus.sys/bus_udev.c, dlls/winebus.sys/main.c, dlls/wined3d/utils.c, dlls/winevulkan/make_vulkan,
# | dlls/winevulkan/vulkan.c, dlls/winevulkan/winevulkan.spec, dlls/winmm/tests/wave.c, dlls/winmm/waveform.c,
# | dlls/wmp/player.c, dlls/wmp/tests/oleobj.c, libs/wine/loader.c, loader/wine.inf.in,
# | programs/cmd/tests/test_builtins.cmd, programs/cmd/tests/test_builtins.cmd.exp, programs/cmd/wcmdmain.c,
# | programs/msiexec/msiexec.c, programs/winecfg/resource.h, programs/winecfg/theme.c, programs/winecfg/winecfg.rc,
# | programs/winemenubuilder/winemenubuilder.c, tools/make_specfiles
# | * dlls/hidclass.sys/hid.h, dlls/hidclass.sys/main.c, dlls/hidclass.sys/pnp.c, dlls/kernel32/process.c,
# | dlls/winebus.sys/bus.h, dlls/winebus.sys/bus_iohid.c, dlls/winebus.sys/bus_sdl.c, dlls/winebus.sys/bus_udev.c,
# | dlls/winebus.sys/main.c, libs/wine/loader.c, programs/cmd/tests/test_builtins.cmd,
# | programs/cmd/tests/test_builtins.cmd.exp, programs/cmd/wcmdmain.c, programs/winecfg/resource.h,
# | programs/winecfg/theme.c, programs/winecfg/winecfg.rc, programs/winemenubuilder/winemenubuilder.c
# |
if test "$enable_ml_patches" -eq 1; then
patch_apply ml-patches/0001-wined3d-Fix-WINED3D_MCS_COLOR2.patch
patch_apply ml-patches/0002-d3d9-tests-Add-a-test-for-D3DMCS_COLOR-1-2.patch
patch_apply ml-patches/0003-d3d8-tests-Add-a-test-for-D3DMCS_COLOR-1-2.patch
patch_apply ml-patches/0004-ddraw-tests-Add-a-test-for-D3DMCS_COLOR-1-2.patch
patch_apply ml-patches/0005-dsound-Correctly-calculate-angle-between-vectors-wit.patch
patch_apply ml-patches/0006-hidclass.sys-Unload-all-devices-before-unloading-a-m.patch
patch_apply ml-patches/0007-wine.inf-Add-Sources-key.patch
patch_apply ml-patches/0008-programs-Allow-to-disable-MIME-type-associations.patch
patch_apply ml-patches/0009-api-ms-win-devices-config-l1-1-0-Add-dll.patch
patch_apply ml-patches/0010-wnet-Make-WNetGetUniversalNameW-return-required-size.patch
patch_apply ml-patches/0011-msvcp90-Fix-EOF-delimiter-handling-in-basic_istream-.patch
patch_apply ml-patches/0012-ntoskrnl-Emulate-sti-cli-instructions-on-x86_64.patch
patch_apply ml-patches/0013-winebus.sys-Do-not-report-HID-report-read-errors-unc.patch
patch_apply ml-patches/0014-odbc32-Rename-functions-to-avoid-conflicts-with-nati.patch
patch_apply ml-patches/0015-winmm-Don-t-crash-in-waveOutOpen-when-nSamplesPerSec.patch
patch_apply ml-patches/0016-msi-Generate-unique-names-for-32-and-64-bit-custom-a.patch
patch_apply ml-patches/0017-winevulkan-Expose-driver-vkGetInstanceProcAddr-via-w.patch
patch_apply ml-patches/0018-winevulkan-Mark-ICD-and-thunking-functions-as-privat.patch
patch_apply ml-patches/0019-wmp-Make-it-possible-to-query-IUnknown-from-IWMPCont.patch
patch_apply ml-patches/0020-libwine-Use-getsegmentdata-3-on-Mac-OS-to-find-the-e.patch
patch_apply ml-patches/0021-d3dcompiler-Make-types-array-static-const.patch
patch_apply ml-patches/0022-kernel32-Set-environment-variable-PUBLIC-on-the-proc.patch
patch_apply ml-patches/0023-wbemprox-Add-Win32_NetworkAdapterConfiguration-IPAdd.patch
patch_apply ml-patches/0024-wbemprox-Add-Win32_NetworkAdapterConfiguration-IPSub.patch
patch_apply ml-patches/0028-cmd-Handle-quotes-when-parsing-the-folders-in-the-PA.patch
(
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Fix WINED3D_MCS_COLOR2.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "d3d9/tests: Add a test for D3DMCS_COLOR{1/2}.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "d3d8/tests: Add a test for D3DMCS_COLOR{1/2}.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "ddraw/tests: Add a test for D3DMCS_COLOR{1/2}.", 1 },';
printf '%s\n' '+ { "Andrew Eikum", "dsound: Correctly calculate angle between vectors with equal and opposite directions.", 1 },';
printf '%s\n' '+ { "Aric Stewart", "hidclass.sys: Unload all devices before unloading a minidriver.", 1 },';
printf '%s\n' '+ { "Gijs Vermeulen", "wine.inf: Add \"Sources\" key.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "programs: Allow to disable MIME-type associations.", 1 },';
printf '%s\n' '+ { "Andrey Gusev", "api-ms-win-devices-config-l1-1-0: Add dll.", 1 },';
printf '%s\n' '+ { "Fabian Maurer", "wnet: Make WNetGetUniversalNameW return required size when buffer is too small and add test.", 1 },';
printf '%s\n' '+ { "Piotr Caban", "msvcp90: Fix EOF delimiter handling in basic_istream<char>::ignore.", 1 },';
printf '%s\n' '+ { "Fabian Maurer", "ntoskrnl: Emulate sti/cli instructions on x86_64.", 1 },';
printf '%s\n' '+ { "Kai Krakow", "winebus.sys: Do not report HID report read errors unconditionally.", 1 },';
printf '%s\n' '+ { "Daniel Lehman", "odbc32: Rename functions to avoid conflicts with native drivers.", 1 },';
printf '%s\n' '+ { "Fabian Maurer", "winmm: Don'\''t crash in waveOutOpen when nSamplesPerSec is 0 and add tests.", 1 },';
printf '%s\n' '+ { "Zebediah Figura", "msi: Generate unique names for 32- and 64-bit custom action server pipes.", 1 },';
printf '%s\n' '+ { "Jacek Caban", "winevulkan: Expose driver vkGetInstanceProcAddr via winevulkan exports.", 1 },';
printf '%s\n' '+ { "Jacek Caban", "winevulkan: Mark ICD and thunking functions as private.", 1 },';
printf '%s\n' '+ { "Nikolay Sivov", "wmp: Make it possible to query IUnknown from IWMPControls.", 1 },';
printf '%s\n' '+ { "Chip Davis", "libwine: Use getsegmentdata(3) on Mac OS to find the end of the __TEXT segment.", 1 },';
printf '%s\n' '+ { "Matteo Bruni", "d3dcompiler: Make types array static const.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "kernel32: Set environment variable %PUBLIC% on the process start-up.", 1 },';
printf '%s\n' '+ { "Piotr Caban", "wbemprox: Add Win32_NetworkAdapterConfiguration::IPAddress property.", 1 },';
printf '%s\n' '+ { "Piotr Caban", "wbemprox: Add Win32_NetworkAdapterConfiguration::IPSubnet property.", 1 },';
printf '%s\n' '+ { "Fabian Maurer", "cmd: Handle quotes when parsing the folders in the PATH environment variable.", 1 },';
) >> "$patchlist"
fi
@ -2600,7 +2380,7 @@ fi
# Patchset Compiler_Warnings
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ml-array_size, ml-patches
# | * ml-patches
# |
# | Modified files:
# | * dlls/amstream/mediastreamfilter.c, dlls/d2d1/brush.c, dlls/d2d1/geometry.c, dlls/d3d11/view.c, dlls/d3d8/texture.c,
@ -3425,21 +3205,6 @@ if test "$enable_d3dx9_36_CloneEffect" -eq 1; then
) >> "$patchlist"
fi
# Patchset d3dx9_36-D3DXCreateTeapot
# |
# | This patchset fixes the following Wine bugs:
# | * [#36884] Return a valid mesh in D3DXCreateTeapot
# |
# | Modified files:
# | * dlls/d3dx9_36/mesh.c
# |
if test "$enable_d3dx9_36_D3DXCreateTeapot" -eq 1; then
patch_apply d3dx9_36-D3DXCreateTeapot/0001-d3dx9_36-Return-a-mesh-in-D3DXCreateTeapot.patch
(
printf '%s\n' '+ { "Alistair Leslie-Hughes", "d3dx9_36: Return a mesh in D3DXCreateTeapot.", 1 },';
) >> "$patchlist"
fi
# Patchset d3dx9_36-D3DXDisassembleShader
# |
# | Modified files:
@ -3962,21 +3727,6 @@ if test "$enable_dwrite_FontFallback" -eq 1; then
) >> "$patchlist"
fi
# Patchset dwrite-layout-check
# |
# | This patchset fixes the following Wine bugs:
# | * [#45535] - dwrite Correct out of access
# |
# | Modified files:
# | * dlls/dwrite/layout.c
# |
if test "$enable_dwrite_layout_check" -eq 1; then
patch_apply dwrite-layout-check/0001-dwrite-Avoid-possible-out-of-bounds-cluster-metrics-.patch
(
printf '%s\n' '+ { "Nikolay Sivov", "dwrite: Avoid possible out-of-bounds cluster metrics access.", 1 },';
) >> "$patchlist"
fi
# Patchset dxdiagn-Enumerate_DirectSound
# |
# | This patchset fixes the following Wine bugs:
@ -4808,23 +4558,6 @@ if test "$enable_mshtml_HTMLLocation_put_hash" -eq 1; then
) >> "$patchlist"
fi
# Patchset msi-Deferral
# |
# | This patchset fixes the following Wine bugs:
# | * [#34989] Multiple installers using Caphyon 'Advanced Installer' (AI) technology hang (Atlassian SourceTree v1.3.2,
# | League of Legends 2013+) (deferred type 1 custom action executed before regular type 1 custom action)
# |
# | Modified files:
# | * dlls/msi/action.c, dlls/msi/assembly.c, dlls/msi/classes.c, dlls/msi/custom.c, dlls/msi/files.c, dlls/msi/font.c,
# | dlls/msi/msipriv.h, dlls/msi/tests/custom.c, dlls/msi/tests/install.c
# |
if test "$enable_msi_Deferral" -eq 1; then
patch_apply msi-Deferral/0001-msi-Implement-deferral-for-standard-and-custom-actio.patch
(
printf '%s\n' '+ { "Zebediah Figura", "msi: Implement deferral for standard and custom actions.", 1 },';
) >> "$patchlist"
fi
# Patchset msi-MsiGetDatabaseState
# |
# | Modified files:
@ -4907,21 +4640,13 @@ fi
# | * [#14695] Implement support for converting 16 bit depth to 24 bit in msvidc32
# |
# | Modified files:
# | * dlls/iccvid/iccvid.c, dlls/msvfw32/msvideo_main.c, dlls/msvfw32/tests/msvfw.c, dlls/msvidc32/msvideo1.c
# | * dlls/iccvid/iccvid.c, dlls/msvfw32/tests/msvfw.c, dlls/msvidc32/msvideo1.c
# |
if test "$enable_msvfw32_ICGetDisplayFormat" -eq 1; then
patch_apply msvfw32-ICGetDisplayFormat/0001-msvfw32-Try-different-formarts-in-ICGetDisplayFormat.patch
patch_apply msvfw32-ICGetDisplayFormat/0002-msvfw32-Add-test-for-negative-width-height-values-pa.patch
patch_apply msvfw32-ICGetDisplayFormat/0003-msvfw32-Set-biSizeImage-correctly-in-ICGetDisplayFor.patch
patch_apply msvfw32-ICGetDisplayFormat/0004-msvfw32-Take-stride-into-account-and-ask-for-palette.patch
patch_apply msvfw32-ICGetDisplayFormat/0005-iccvid-Fix-calculation-of-stride-and-size.patch
patch_apply msvfw32-ICGetDisplayFormat/0006-msvidc32-Add-support-for-converting-16-bit-depth-to-.patch
patch_apply msvfw32-ICGetDisplayFormat/0007-msvidc32-Fix-calculation-of-stride-and-size.patch
(
printf '%s\n' '+ { "Michael Müller", "msvfw32: Try different formarts in ICGetDisplayFormat.", 1 },';
printf '%s\n' '+ { "Michael Müller", "msvfw32: Add test for negative width/height values passed to ICGetDisplayFormat.", 1 },';
printf '%s\n' '+ { "Michael Müller", "msvfw32: Set biSizeImage correctly in ICGetDisplayFormat.", 1 },';
printf '%s\n' '+ { "Michael Müller", "msvfw32: Take stride into account and ask for palette in ICGetDisplayFormat.", 1 },';
printf '%s\n' '+ { "Michael Müller", "iccvid: Fix calculation of stride and size.", 1 },';
printf '%s\n' '+ { "Michael Müller", "msvidc32: Add support for converting 16 bit depth to 24 bit.", 1 },';
printf '%s\n' '+ { "Michael Müller", "msvidc32: Fix calculation of stride and size.", 1 },';
@ -5873,7 +5598,7 @@ fi
# Patchset ntoskrnl-Stubs
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ml-array_size, ml-patches, Compiler_Warnings
# | * ml-patches, Compiler_Warnings
# |
# | Modified files:
# | * dlls/ntoskrnl.exe/ntoskrnl.c, dlls/ntoskrnl.exe/ntoskrnl.exe.spec, dlls/ntoskrnl.exe/tests/driver.c, include/ddk/wdm.h,
@ -8040,21 +7765,6 @@ if test "$enable_wined3d_WINED3DFMT_B8G8R8X8_UNORM" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-texture-blt-device
# |
# | This patchset fixes the following Wine bugs:
# | * [#45382] Stop the Sting demo crashing
# |
# | Modified files:
# | * dlls/wined3d/texture.c
# |
if test "$enable_wined3d_texture_blt_device" -eq 1; then
patch_apply wined3d-texture-blt-device/0001-wined3d-Dont-blt-textures-on-different-devices.patch
(
printf '%s\n' '+ { "Józef Kucia", "wined3d: Dont blt textures on different devices.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-wined3d_guess_gl_vendor
# |
# | This patchset fixes the following Wine bugs:
@ -8085,7 +7795,7 @@ fi
# Patchset winedevice-Default_Drivers
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * dxva2-Video_Decoder, ml-array_size, ml-patches, Compiler_Warnings, ntoskrnl-Stubs
# | * dxva2-Video_Decoder, ml-patches, Compiler_Warnings, ntoskrnl-Stubs
# |
# | Modified files:
# | * configure.ac, dlls/dxgkrnl.sys/Makefile.in, dlls/dxgkrnl.sys/dxgkrnl.sys.spec, dlls/dxgkrnl.sys/main.c,
@ -8363,21 +8073,6 @@ if test "$enable_winex11_XEMBED" -eq 1; then
) >> "$patchlist"
fi
# Patchset winex11-compile-vulkan
# |
# | This patchset fixes the following Wine bugs:
# | * [#45554] - Correct compile error with gcc 4.5
# |
# | Modified files:
# | * dlls/winex11.drv/vulkan.c
# |
if test "$enable_winex11_compile_vulkan" -eq 1; then
patch_apply winex11-compile-vulkan/0001-winex11.drv-Correct-bBuild-fail-with-GCC-4.5.patch
(
printf '%s\n' '+ { "Józef Kucia", "winex11.drv: Correct bBuild fail with GCC 4.5.", 1 },';
) >> "$patchlist"
fi
# Patchset winex11-wglShareLists
# |
# | This patchset fixes the following Wine bugs:

View File

@ -1,4 +1,4 @@
From e0d173b54b5c76ffc1eda2f973d0d470e3c20cca Mon Sep 17 00:00:00 2001
From ad95d230cde0c3fe96259e823ed46be34f801fc2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Fri, 18 Aug 2017 23:51:59 +0200
Subject: [PATCH] wined3d: Implement dual source blending.
@ -14,10 +14,10 @@ Subject: [PATCH] wined3d: Implement dual source blending.
7 files changed, 74 insertions(+), 9 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 413c07a..b44d5b5 100644
index e6e3c215c1..6e025d23ab 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -27727,7 +27727,7 @@ static void test_dual_blending(void)
@@ -27869,7 +27869,7 @@ static void test_dual_blending(void)
ID3D11DeviceContext_ClearRenderTargetView(context, rtv[1], white);
ID3D11DeviceContext_Draw(context, 3, 0);
@ -27,7 +27,7 @@ index 413c07a..b44d5b5 100644
ID3D11BlendState_Release(blend_state);
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 21ad11d..ec5af4f 100644
index 21ad11d958..ec5af4f5a4 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -3131,10 +3131,19 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const
@ -52,10 +52,10 @@ index 21ad11d..ec5af4f 100644
{
i = wined3d_bit_scan(&mask);
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 9ecc4ed..dae2ba7 100644
index 3a958991b1..552a4b9a1c 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -3515,6 +3515,12 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
@@ -3544,6 +3544,12 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
gl_info->limits.buffers = min(MAX_RENDER_TARGET_VIEWS, gl_max);
TRACE("Max draw buffers: %u.\n", gl_max);
}
@ -68,7 +68,7 @@ index 9ecc4ed..dae2ba7 100644
if (gl_info->supported[ARB_MULTITEXTURE])
{
if (gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
@@ -4314,6 +4320,10 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
@@ -4343,6 +4349,10 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
for (i = 0; i < gl_info->limits.buffers; ++i)
d3d_info->valid_rt_mask |= (1u << i);
@ -80,7 +80,7 @@ index 9ecc4ed..dae2ba7 100644
{
/* We do not want to deal with re-creating immutable texture storage for color keying emulation. */
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index af50c8b..fc61b6f 100644
index a4e66ccca7..49fb5f7c59 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -3036,6 +3036,7 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
@ -91,7 +91,7 @@ index af50c8b..fc61b6f 100644
if (reg->idx[0].offset >= gl_info->limits.buffers)
WARN("Write to render target %u, only %d supported.\n",
reg->idx[0].offset, gl_info->limits.buffers);
@@ -7892,7 +7893,10 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
@@ -7896,7 +7897,10 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
{
const struct wined3d_shader_signature *output_signature = &shader->output_signature;
@ -103,7 +103,7 @@ index af50c8b..fc61b6f 100644
if (output_signature->element_count)
{
for (i = 0; i < output_signature->element_count; ++i)
@@ -7907,7 +7911,12 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
@@ -7911,7 +7915,12 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
continue;
}
if (shader_glsl_use_explicit_attrib_location(gl_info))
@ -117,7 +117,7 @@ index af50c8b..fc61b6f 100644
shader_addline(buffer, "out %s4 color_out%u;\n",
component_type_info[output->component_type].glsl_vector_type, output->semantic_idx);
}
@@ -7920,7 +7929,12 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
@@ -7924,7 +7933,12 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
{
i = wined3d_bit_scan(&mask);
if (shader_glsl_use_explicit_attrib_location(gl_info))
@ -132,7 +132,7 @@ index af50c8b..fc61b6f 100644
}
}
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 20d4f07..f2e3c23 100644
index 20d4f0773d..f2e3c23976 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -4101,6 +4101,8 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
@ -145,7 +145,7 @@ index 20d4f07..f2e3c23 100644
static HRESULT pixel_shader_init(struct wined3d_shader *shader, struct wined3d_device *device,
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 3b2f845..6d243a4 100644
index 2dd6ac2a63..a2e95a4a56 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -533,12 +533,14 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_st
@ -188,7 +188,7 @@ index 3b2f845..6d243a4 100644
state->render_states[WINED3D_RS_SRCBLEND],
state->render_states[WINED3D_RS_DESTBLEND], rt_format);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index a25c296..b41d65c 100644
index 368b817950..c3a3c16aa0 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -190,6 +190,7 @@ struct wined3d_d3d_info
@ -209,17 +209,17 @@ index a25c296..b41d65c 100644
};
enum fog_src_type
@@ -1911,7 +1913,8 @@ struct wined3d_context
DWORD transform_feedback_paused : 1;
@@ -1913,7 +1915,8 @@ struct wined3d_context
DWORD shader_update_mask : 6; /* WINED3D_SHADER_TYPE_COUNT, 6 */
DWORD clip_distance_mask : 8; /* MAX_CLIP_DISTANCES, 8 */
- DWORD padding : 9;
DWORD num_untracked_materials : 2; /* Max value 2 */
- DWORD padding : 7;
+ DWORD last_was_dual_blend : 1;
+ DWORD padding : 8;
+ DWORD padding : 6;
DWORD constant_update_mask;
DWORD numbered_array_mask;
@@ -2536,6 +2539,7 @@ struct wined3d_fbo_ops
@@ -2540,6 +2543,7 @@ struct wined3d_fbo_ops
struct wined3d_gl_limits
{
UINT buffers;
@ -227,7 +227,7 @@ index a25c296..b41d65c 100644
UINT lights;
UINT textures;
UINT texture_coords;
@@ -2877,6 +2881,22 @@ struct wined3d_state
@@ -2881,6 +2885,22 @@ struct wined3d_state
struct wined3d_rasterizer_state *rasterizer_state;
};
@ -251,5 +251,5 @@ index a25c296..b41d65c 100644
{
GLuint tex_1d;
--
2.7.4
2.18.0

View File

@ -1,26 +1,18 @@
From feccefdad49772bbc87502daca1a78bbfbaaf85e Mon Sep 17 00:00:00 2001
From 63321a59b4769c96ad2a1e852c363e7a5cd2b1c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 31 Aug 2017 00:23:43 +0200
Subject: d3d9/tests: Test normal calculation when indexed vertex blending is
enabled.
Subject: [PATCH] d3d9/tests: Test normal calculation when indexed vertex
blending is enabled.
---
dlls/d3d9/tests/visual.c | 115 ++++++++++++++++++++++++++++++++++++++---------
dlls/d3d9/tests/visual.c | 115 +++++++++++++++++++++++++++++++--------
1 file changed, 93 insertions(+), 22 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 6d05d68..052327c 100644
index dbf2a22d94..5af2c23769 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -20265,6 +20265,7 @@ done:
static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char *test_id_str)
{
+ IDirect3DPixelShader9 *ps;
D3DCAPS9 caps;
D3DCOLOR color;
HRESULT hr;
@@ -20281,31 +20282,49 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
@@ -20203,28 +20203,28 @@ static void test_vertex_blending(void)
{{{
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
@ -51,6 +43,20 @@ index 6d05d68..052327c 100644
- 0.0f, 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f, 2.0f, 0.0f,
4.0f, -4.0f, 0.0f, 1.0f
}}};
@@ -20446,6 +20446,7 @@ done:
static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char *test_id_str)
{
+ IDirect3DPixelShader9 *ps;
D3DCAPS9 caps;
D3DCOLOR color;
HRESULT hr;
@@ -20485,8 +20486,26 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
4.0f, -4.0f, 0.0f, 1.0f
+ }}},
+ identity =
+ {{{
@ -74,7 +80,7 @@ index 6d05d68..052327c 100644
static const POINT quad_upper_right_points[] =
{
{576, 48}, {-1, -1},
@@ -20346,6 +20365,7 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
@@ -20527,6 +20546,7 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
struct vec3 position;
struct vec3 blendweights;
DWORD matrixIndices;
@ -82,7 +88,7 @@ index 6d05d68..052327c 100644
}
vertex_data[4];
const POINT *quad_points;
@@ -20355,34 +20375,34 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
@@ -20536,34 +20556,34 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
{
/* upper right */
{
@ -133,7 +139,7 @@ index 6d05d68..052327c 100644
quad_fullscreen_points, quad_fullscreen_empty_points
}
};
@@ -20417,21 +20437,32 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
@@ -20598,21 +20618,32 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
ok(hr == D3D_OK, "(%s) IDirect3DDevice9_SetRenderState D3DRS_INDEXEDVERTEXBLENDENABLE failed %08x.\n",
test_id_str, hr);
@ -168,7 +174,7 @@ index 6d05d68..052327c 100644
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
hr = IDirect3DDevice9_EndScene(device);
@@ -20455,7 +20486,47 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
@@ -20636,7 +20667,47 @@ static void do_test_indexed_vertex_blending(IDirect3DDevice9 *device, const char
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
@ -217,5 +223,5 @@ index 6d05d68..052327c 100644
static void test_indexed_vertex_blending(void)
--
2.7.4
2.18.0

View File

@ -1,30 +0,0 @@
From e6e3c84e63ad7e10d76fef20d7526bcc7b29586c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B3zef=20Kucia?= <jkucia@codeweavers.com>
Date: Thu, 28 Jun 2018 14:03:41 +1000
Subject: [PATCH] wined3d: Dont blt textures on different devices
Fixes: https://bugs.winehq.org/show_bug.cgi?id=45382
---
dlls/wined3d/texture.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index c316906..d54a648 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -3097,6 +3097,12 @@ HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned
return WINED3DERR_INVALIDCALL;
}
+ if (dst_texture->resource.device != src_texture->resource.device)
+ {
+ ERR("Rejecting blit.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
wined3d_cs_emit_blt_sub_resource(dst_texture->resource.device->cs, &dst_texture->resource, dst_sub_resource_idx,
&dst_box, &src_texture->resource, src_sub_resource_idx, &src_box, flags, fx, filter);
--
1.9.1

View File

@ -1,2 +0,0 @@
Fixes: [45382] Stop the Sting demo crashing

View File

@ -1,15 +1,15 @@
From 8f8bc662fcb84375077636896f724fb6b1e7a7c3 Mon Sep 17 00:00:00 2001
From a652b6aef0055d851b630b195181f152472f18ed Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 4 Nov 2015 02:57:56 +0100
Subject: [PATCH 1/7] winepulse.drv: Use a separate mainloop and ctx for
Subject: [PATCH] winepulse.drv: Use a separate mainloop and ctx for
pulse_test_connect.
---
dlls/winepulse.drv/mmdevdrv.c | 59 ++++++++++++++++++++-----------------------
dlls/winepulse.drv/mmdevdrv.c | 59 ++++++++++++++++-------------------
1 file changed, 27 insertions(+), 32 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
index 32f7acb..f192b1d 100644
index 8d57f1a45a..f6466c3602 100644
--- a/dlls/winepulse.drv/mmdevdrv.c
+++ b/dlls/winepulse.drv/mmdevdrv.c
@@ -369,7 +369,7 @@ static DWORD pulse_channel_map_to_channel_mask(const pa_channel_map *map) {
@ -61,7 +61,7 @@ index 32f7acb..f192b1d 100644
- pa_mainloop_set_poll_func(pulse_ml, pulse_poll_func, NULL);
+ pa_mainloop_set_poll_func(ml, pulse_poll_func, NULL);
GetModuleFileNameW(NULL, path, sizeof(path)/sizeof(*path));
GetModuleFileNameW(NULL, path, ARRAY_SIZE(path));
name = strrchrW(path, '\\');
@@ -547,24 +549,23 @@ static HRESULT pulse_test_connect(void)
str = pa_xmalloc(len);
@ -147,5 +147,5 @@ index 32f7acb..f192b1d 100644
}
--
1.9.1
2.18.0

View File

@ -1,7 +1,7 @@
From 96f3c707d891d972a57d5879b55813c063c392f9 Mon Sep 17 00:00:00 2001
From 0fb0fcc51b4b9e167289ad92d01cc5179bef2f50 Mon Sep 17 00:00:00 2001
From: Mark Harmstone <mark@harmstone.com>
Date: Sun, 21 Dec 2014 23:49:41 +0000
Subject: [PATCH 6/7] winepulse: fetch actual program name if possible
Subject: [PATCH] winepulse: fetch actual program name if possible
Changes by Sebastian Lackner <sebastian@fds-team.de>:
* Improved error handling, fix memory leak
@ -10,11 +10,11 @@ Changes by Sebastian Lackner <sebastian@fds-team.de>:
* Simplify algorithm to choose best translation.
---
dlls/winepulse.drv/Makefile.in | 2 +-
dlls/winepulse.drv/mmdevdrv.c | 123 ++++++++++++++++++++++++++++++++++++++---
2 files changed, 116 insertions(+), 9 deletions(-)
dlls/winepulse.drv/mmdevdrv.c | 124 ++++++++++++++++++++++++++++++---
2 files changed, 117 insertions(+), 9 deletions(-)
diff --git a/dlls/winepulse.drv/Makefile.in b/dlls/winepulse.drv/Makefile.in
index d660063..2448789 100644
index d660063236..2448789ded 100644
--- a/dlls/winepulse.drv/Makefile.in
+++ b/dlls/winepulse.drv/Makefile.in
@@ -1,5 +1,5 @@
@ -25,7 +25,7 @@ index d660063..2448789 100644
EXTRAINCL = $(PULSE_CFLAGS)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
index 8311cbd..becf6a3 100644
index 32e32cefbe..089d5b9c2f 100644
--- a/dlls/winepulse.drv/mmdevdrv.c
+++ b/dlls/winepulse.drv/mmdevdrv.c
@@ -43,6 +43,7 @@
@ -146,10 +146,10 @@ index 8311cbd..becf6a3 100644
static HRESULT pulse_connect(void)
{
int len;
@@ -494,14 +598,17 @@ static HRESULT pulse_connect(void)
@@ -494,14 +598,18 @@ static HRESULT pulse_connect(void)
pa_context_unref(pulse_ctx);
GetModuleFileNameW(NULL, path, sizeof(path)/sizeof(*path));
GetModuleFileNameW(NULL, path, ARRAY_SIZE(path));
- name = strrchrW(path, '\\');
- if (!name)
- name = path;
@ -169,9 +169,10 @@ index 8311cbd..becf6a3 100644
+ str = pa_xmalloc(len);
+ WideCharToMultiByte(CP_UNIXCP, 0, name, -1, str, len, NULL, NULL);
+ }
+
TRACE("Name: %s\n", str);
pulse_ctx = pa_context_new(pa_mainloop_get_api(pulse_ml), str);
pa_xfree(str);
--
1.9.1
2.18.0

Some files were not shown because too many files have changed in this diff Show More