Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
October 2021
- 81 participants
- 2597 messages
[PATCH 2/3] makedep: Use -fno-builtin for CRT DLLs on PE targets.
by Jacek Caban
Just like we do for other targets with cross compiler enabled. Fixes
PE-only i686 build with llvm-mingw, which otherwise uses unexpected
optimizations.
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
tools/makedep.c | 2 ++
1 file changed, 2 insertions(+)
Oct. 1, 2021
[PATCH 1/3] configure: Don't use -fPIC on mingw targets.
by Jacek Caban
Fixes PE-only builds with llvm-mingw. The option is not relevant on
mingw. While mingw GCC ignores it, Clags issues an error.
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
configure.ac | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Oct. 1, 2021
Re: [PATCH 3/7] mshtml: Expose toString() for WineDOMTokenList.
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=99199
Your paranoid android.
=== w8adm (32 bit report) ===
mshtml:
events.c:1089: Test failed: unexpected call img_onerror
events: Timeout
Oct. 1, 2021
[PATCH vkd3d 2/2] vkd3d: Implement output merger logic ops.
by Conor McCarthy
Using vk_logic_op_from_d3d12() from a vkd3d-proton patch by Philip
Rebohle.
Signed-off-by: Conor McCarthy <cmccarthy(a)codeweavers.com>
---
libs/vkd3d/state.c | 58 ++++++++++++++++++++++++++++++++++----
libs/vkd3d/vkd3d_private.h | 2 ++
tests/d3d12.c | 1 -
3 files changed, 55 insertions(+), 6 deletions(-)
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index 9e554b44..52400d6b 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -2062,9 +2062,6 @@ static void blend_attachment_from_d3d12(struct VkPipelineColorBlendAttachmentSta
vk_desc->colorWriteMask |= VK_COLOR_COMPONENT_B_BIT;
if (d3d12_desc->RenderTargetWriteMask & D3D12_COLOR_WRITE_ENABLE_ALPHA)
vk_desc->colorWriteMask |= VK_COLOR_COMPONENT_A_BIT;
-
- if (d3d12_desc->LogicOpEnable)
- FIXME("Ignoring LogicOpEnable %#x.\n", d3d12_desc->LogicOpEnable);
}
static bool is_dual_source_blending_blend(D3D12_BLEND b)
@@ -2174,6 +2171,48 @@ static HRESULT d3d12_graphics_pipeline_state_create_render_pass(
return vkd3d_render_pass_cache_find(&device->render_pass_cache, device, &key, vk_render_pass);
}
+static VkLogicOp vk_logic_op_from_d3d12(D3D12_LOGIC_OP op)
+{
+ switch (op)
+ {
+ case D3D12_LOGIC_OP_CLEAR:
+ return VK_LOGIC_OP_CLEAR;
+ case D3D12_LOGIC_OP_SET:
+ return VK_LOGIC_OP_SET;
+ case D3D12_LOGIC_OP_COPY:
+ return VK_LOGIC_OP_COPY;
+ case D3D12_LOGIC_OP_COPY_INVERTED:
+ return VK_LOGIC_OP_COPY_INVERTED;
+ case D3D12_LOGIC_OP_NOOP:
+ return VK_LOGIC_OP_NO_OP;
+ case D3D12_LOGIC_OP_INVERT:
+ return VK_LOGIC_OP_INVERT;
+ case D3D12_LOGIC_OP_AND:
+ return VK_LOGIC_OP_AND;
+ case D3D12_LOGIC_OP_NAND:
+ return VK_LOGIC_OP_NAND;
+ case D3D12_LOGIC_OP_OR:
+ return VK_LOGIC_OP_OR;
+ case D3D12_LOGIC_OP_NOR:
+ return VK_LOGIC_OP_NOR;
+ case D3D12_LOGIC_OP_XOR:
+ return VK_LOGIC_OP_XOR;
+ case D3D12_LOGIC_OP_EQUIV:
+ return VK_LOGIC_OP_EQUIVALENT;
+ case D3D12_LOGIC_OP_AND_REVERSE:
+ return VK_LOGIC_OP_AND_REVERSE;
+ case D3D12_LOGIC_OP_AND_INVERTED:
+ return VK_LOGIC_OP_AND_INVERTED;
+ case D3D12_LOGIC_OP_OR_REVERSE:
+ return VK_LOGIC_OP_OR_REVERSE;
+ case D3D12_LOGIC_OP_OR_INVERTED:
+ return VK_LOGIC_OP_OR_INVERTED;
+ default:
+ FIXME("Unhandled logic op %#x.\n", op);
+ return VK_LOGIC_OP_NO_OP;
+ }
+}
+
static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *state,
struct d3d12_device *device, const D3D12_GRAPHICS_PIPELINE_STATE_DESC *desc)
{
@@ -2264,6 +2303,15 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
rt_count = ARRAY_SIZE(graphics->blend_attachments);
}
+ graphics->om_logic_op_enable = desc->BlendState.RenderTarget[0].LogicOpEnable
+ && device->feature_options.OutputMergerLogicOp;
+ graphics->om_logic_op = graphics->om_logic_op_enable
+ ? vk_logic_op_from_d3d12(desc->BlendState.RenderTarget[0].LogicOp)
+ : VK_LOGIC_OP_COPY;
+ if (desc->BlendState.RenderTarget[0].LogicOpEnable && !graphics->om_logic_op_enable)
+ WARN("The device does not support output merger logic ops. Ignoring logic op %#x.\n",
+ desc->BlendState.RenderTarget[0].LogicOp);
+
graphics->null_attachment_mask = 0;
for (i = 0; i < rt_count; ++i)
{
@@ -2973,8 +3021,8 @@ VkPipeline d3d12_pipeline_state_get_or_create_pipeline(struct d3d12_pipeline_sta
blend_desc.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
blend_desc.pNext = NULL;
blend_desc.flags = 0;
- blend_desc.logicOpEnable = VK_FALSE;
- blend_desc.logicOp = VK_LOGIC_OP_COPY;
+ blend_desc.logicOpEnable = graphics->om_logic_op_enable;
+ blend_desc.logicOp = graphics->om_logic_op;
blend_desc.attachmentCount = graphics->rt_count;
blend_desc.pAttachments = graphics->blend_attachments;
blend_desc.blendConstants[0] = D3D12_DEFAULT_BLEND_FACTOR_RED;
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index 0b326b11..b5bbb8e5 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -741,6 +741,8 @@ struct d3d12_graphics_pipeline_state
size_t instance_divisor_count;
size_t attribute_count;
+ bool om_logic_op_enable;
+ VkLogicOp om_logic_op;
VkPipelineColorBlendAttachmentState blend_attachments[D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT];
unsigned int rt_count;
unsigned int null_attachment_mask;
diff --git a/tests/d3d12.c b/tests/d3d12.c
index 972ec766..384e978c 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -31017,7 +31017,6 @@ static void test_output_merger_logic_op(void)
transition_resource_state(command_list, context.render_target,
D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE);
- todo_if(do_test && tests[i].logic_op != D3D12_LOGIC_OP_COPY)
check_sub_resource_uint(context.render_target, 0, queue, command_list,
do_test ? tests[i].expected_colour : 0x00ff00ff, 1);
reset_command_list(command_list, context.allocator);
--
2.32.0
Oct. 1, 2021
[PATCH vkd3d 1/2] tests: Add tests for output merger logic ops.
by Conor McCarthy
Signed-off-by: Conor McCarthy <cmccarthy(a)codeweavers.com>
---
tests/d3d12.c | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 138 insertions(+)
diff --git a/tests/d3d12.c b/tests/d3d12.c
index 89b1f000..972ec766 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -673,6 +673,21 @@ static bool is_shader_float64_supported(ID3D12Device *device)
return options.DoublePrecisionFloatShaderOps;
}
+static bool is_output_merger_logic_op_supported(ID3D12Device *device)
+{
+ D3D12_FEATURE_DATA_D3D12_OPTIONS options;
+ HRESULT hr;
+
+ if (FAILED(hr = ID3D12Device_CheckFeatureSupport(device,
+ D3D12_FEATURE_D3D12_OPTIONS, &options, sizeof(options))))
+ {
+ trace("Failed to check feature support, hr %#x.\n", hr);
+ return false;
+ }
+
+ return options.OutputMergerLogicOp;
+}
+
#define create_cb_root_signature(a, b, c, e) create_cb_root_signature_(__LINE__, a, b, c, e)
static ID3D12RootSignature *create_cb_root_signature_(unsigned int line,
ID3D12Device *device, unsigned int reg_idx, D3D12_SHADER_VISIBILITY shader_visibility,
@@ -30895,6 +30910,128 @@ static void test_dual_source_blending(void)
destroy_test_context(&context);
}
+static void test_output_merger_logic_op(void)
+{
+ D3D12_GRAPHICS_PIPELINE_STATE_DESC pso_desc;
+ ID3D12GraphicsCommandList *command_list;
+ ID3D12PipelineState *logic_pso;
+ struct test_context_desc desc;
+ struct test_context context;
+ ID3D12CommandQueue *queue;
+ unsigned int i, do_test;
+ HRESULT hr;
+
+ static const DWORD ps_code[] =
+ {
+#if 0
+ uint4 c0;
+
+ void main(const in float4 position : SV_Position, out uint4 target : SV_Target0)
+ {
+ target = c0;
+ }
+#endif
+ 0x43425844, 0xb1d5d133, 0xbd9958bf, 0xe4a12856, 0x0197481b, 0x00000001, 0x000000e0, 0x00000003,
+ 0x0000002c, 0x00000060, 0x00000094, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
+ 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x505f5653, 0x7469736f, 0x006e6f69,
+ 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000001,
+ 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x58454853, 0x00000044, 0x00000050,
+ 0x00000011, 0x0100086a, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x03000065, 0x001020f2,
+ 0x00000000, 0x06000036, 0x001020f2, 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x0100003e,
+ };
+ static const D3D12_SHADER_BYTECODE ps = {ps_code, sizeof(ps_code)};
+ static const uint32_t clear_values[4] = {0xffffffff, 0x00000000, 0xffffffff, 0x00000000};
+ static const uint32_t test_values[4] = {0xffffffff, 0xffffffff, 0x00000000, 0x00000000};
+ static const struct
+ {
+ D3D12_LOGIC_OP logic_op;
+ unsigned int expected_colour;
+ }
+ tests[] =
+ {
+ {D3D12_LOGIC_OP_CLEAR, 0x00000000},
+ {D3D12_LOGIC_OP_SET, 0xffffffff},
+ {D3D12_LOGIC_OP_COPY, 0x0000ffff},
+ {D3D12_LOGIC_OP_COPY_INVERTED, 0xffff0000},
+ {D3D12_LOGIC_OP_NOOP, 0x00ff00ff},
+ {D3D12_LOGIC_OP_INVERT, 0xff00ff00},
+ {D3D12_LOGIC_OP_AND, 0x000000ff},
+ {D3D12_LOGIC_OP_NAND, 0xffffff00},
+ {D3D12_LOGIC_OP_OR, 0x00ffffff},
+ {D3D12_LOGIC_OP_NOR, 0xff000000},
+ {D3D12_LOGIC_OP_XOR, 0x00ffff00},
+ {D3D12_LOGIC_OP_EQUIV, 0xff0000ff},
+ {D3D12_LOGIC_OP_AND_REVERSE, 0x0000ff00},
+ {D3D12_LOGIC_OP_AND_INVERTED, 0x00ff0000},
+ {D3D12_LOGIC_OP_OR_REVERSE, 0xff00ffff},
+ {D3D12_LOGIC_OP_OR_INVERTED, 0xffff00ff},
+ };
+
+ memset(&desc, 0, sizeof(desc));
+ desc.no_root_signature = true;
+ desc.ps = &ps;
+ desc.rt_format = DXGI_FORMAT_R8G8B8A8_UINT;
+ if (!init_test_context(&context, &desc))
+ return;
+ command_list = context.list;
+ queue = context.queue;
+
+ if (!is_output_merger_logic_op_supported(context.device))
+ {
+ skip("The device does not support output merger logic ops.\n");
+ destroy_test_context(&context);
+ return;
+ }
+
+ context.root_signature = create_32bit_constants_root_signature(context.device,
+ 0, sizeof(clear_values) / sizeof(uint32_t), D3D12_SHADER_VISIBILITY_PIXEL);
+
+ init_pipeline_state_desc(&pso_desc, context.root_signature,
+ context.render_target_desc.Format, NULL, &ps, NULL);
+ hr = ID3D12Device_CreateGraphicsPipelineState(context.device, &pso_desc,
+ &IID_ID3D12PipelineState, (void **)&context.pipeline_state);
+ ok(hr == S_OK, "Failed to create pipeline, hr %#x.\n", hr);
+
+ pso_desc.BlendState.RenderTarget[0].LogicOpEnable = true;
+
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
+ pso_desc.BlendState.RenderTarget[0].LogicOp = tests[i].logic_op;
+ hr = ID3D12Device_CreateGraphicsPipelineState(context.device, &pso_desc,
+ &IID_ID3D12PipelineState, (void **)&logic_pso);
+ ok(hr == S_OK, "Failed to create pipeline, hr %#x.\n", hr);
+
+ for (do_test = 0; do_test < 2; ++do_test)
+ {
+ vkd3d_test_set_context(do_test ? "Test %u" : "Clear %u", i);
+
+ ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &context.rtv, false, NULL);
+ ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature);
+ ID3D12GraphicsCommandList_SetPipelineState(command_list, do_test ? logic_pso : context.pipeline_state);
+ ID3D12GraphicsCommandList_SetGraphicsRoot32BitConstants(command_list, 0, 4,
+ do_test ? test_values : clear_values, 0);
+ ID3D12GraphicsCommandList_IASetPrimitiveTopology(command_list, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
+ ID3D12GraphicsCommandList_RSSetViewports(command_list, 1, &context.viewport);
+ ID3D12GraphicsCommandList_RSSetScissorRects(command_list, 1, &context.scissor_rect);
+ ID3D12GraphicsCommandList_DrawInstanced(command_list, 3, 1, 0, 0);
+
+ transition_resource_state(command_list, context.render_target,
+ D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE);
+ todo_if(do_test && tests[i].logic_op != D3D12_LOGIC_OP_COPY)
+ check_sub_resource_uint(context.render_target, 0, queue, command_list,
+ do_test ? tests[i].expected_colour : 0x00ff00ff, 1);
+ reset_command_list(command_list, context.allocator);
+ transition_resource_state(command_list, context.render_target,
+ D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET);
+ }
+
+ ID3D12PipelineState_Release(logic_pso);
+ }
+ vkd3d_test_set_context(NULL);
+
+ destroy_test_context(&context);
+}
+
static void test_multisample_rendering(void)
{
static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f};
@@ -35273,6 +35410,7 @@ START_TEST(d3d12)
run_test(test_command_list_initial_pipeline_state);
run_test(test_blend_factor);
run_test(test_dual_source_blending);
+ run_test(test_output_merger_logic_op);
run_test(test_multisample_rendering);
run_test(test_sample_mask);
run_test(test_coverage);
--
2.32.0
Oct. 1, 2021
Re: [PATCH 2/7] mshtml: Implement proper value for WineDOMTokenList.
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=99198
Your paranoid android.
=== w1064_tsign (32 bit report) ===
mshtml:
htmldoc.c:2541: Test failed: unexpected call UpdateUI
htmldoc.c:2853: Test failed: unexpected call Exec_UPDATECOMMANDS
=== w10pro64_ja (64 bit report) ===
mshtml:
htmldoc.c:2541: Test failed: unexpected call UpdateUI
htmldoc.c:2853: Test failed: unexpected call Exec_UPDATECOMMANDS
htmldoc.c:350: Test failed: expected Exec_SETTITLE
htmldoc.c:2859: Test failed: unexpected call Exec_SETTITLE
=== w7u_adm (32 bit report) ===
mshtml:
script.c:624: Test failed: L"/index.html?es5.js:date_now: unexpected Date.now() result 1633097514847 expected 1633097514910"
=== w7u_el (testbot log) ===
WineRunTask.pl:error: The previous 1 run(s) terminated abnormally
Oct. 1, 2021
Re: [PATCH 2/4] nsiproxy: Use str(n)casecmp() instead of _strnicmp().
by Huw Davies
Hi Jacek,
On Fri, Oct 01, 2021 at 03:01:58PM +0200, Jacek Caban wrote:
> There was a reason we avoided those in pre-PE code. Piotr should know more
> details, but I think it unreliable for Turkish locale (IIRC something about
> handling uppercased 'i'). It looks like a local helper that would just
> handle case sensitivity for ASCII subset would be enough here.
Thanks, that rings a bell. I've sent in a version that follows your
suggestion.
Thanks!
Huw.
Oct. 1, 2021
[PATCH v2 4/4] nsiproxy: Build with msvcrt.
by Huw Davies
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/nsiproxy.sys/Makefile.in | 5 +++--
dlls/nsiproxy.sys/device.c | 30 ++++++++++++++++++++++++++----
dlls/nsiproxy.sys/ip.c | 6 ++++++
dlls/nsiproxy.sys/ndis.c | 9 +++++++--
dlls/nsiproxy.sys/nsi.c | 30 ++++++++++++++++++++++++++++++
dlls/nsiproxy.sys/tcp.c | 4 ++++
dlls/nsiproxy.sys/udp.c | 4 ++++
7 files changed, 80 insertions(+), 8 deletions(-)
diff --git a/dlls/nsiproxy.sys/Makefile.in b/dlls/nsiproxy.sys/Makefile.in
index b33ea0e4c8a..95f2a205816 100644
--- a/dlls/nsiproxy.sys/Makefile.in
+++ b/dlls/nsiproxy.sys/Makefile.in
@@ -1,8 +1,9 @@
MODULE = nsiproxy.sys
-IMPORTS = ntoskrnl uuid
+UNIXLIB = nsiproxy.so
+IMPORTS = ntoskrnl
EXTRALIBS = $(PROCSTAT_LIBS)
-EXTRADLLFLAGS = -Wl,--subsystem,native -mcygwin
+EXTRADLLFLAGS = -Wl,--subsystem,native
C_SRCS = \
device.c \
diff --git a/dlls/nsiproxy.sys/device.c b/dlls/nsiproxy.sys/device.c
index 80a025acfc9..ee2feec96be 100644
--- a/dlls/nsiproxy.sys/device.c
+++ b/dlls/nsiproxy.sys/device.c
@@ -32,10 +32,24 @@
#include "netiodef.h"
#include "wine/nsi.h"
#include "wine/debug.h"
-#include "nsiproxy_private.h"
+#include "wine/unixlib.h"
WINE_DEFAULT_DEBUG_CHANNEL(nsi);
+static unixlib_handle_t nsiproxy_handle;
+
+static NTSTATUS nsiproxy_call( unsigned int code, void *args )
+{
+ return __wine_unix_call( nsiproxy_handle, code, args );
+}
+
+enum unix_calls
+{
+ nsi_enumerate_all_ex,
+ nsi_get_all_parameters_ex,
+ nsi_get_parameter_ex,
+};
+
static void nsiproxy_enumerate_all( IRP *irp )
{
IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation( irp );
@@ -73,7 +87,7 @@ static void nsiproxy_enumerate_all( IRP *irp )
enum_all.static_size = in->static_size;
enum_all.count = in->count;
- irp->IoStatus.u.Status = nsi_enumerate_all_ex( &enum_all );
+ irp->IoStatus.u.Status = nsiproxy_call( nsi_enumerate_all_ex, &enum_all );
if (irp->IoStatus.u.Status == STATUS_SUCCESS || irp->IoStatus.u.Status == STATUS_BUFFER_OVERFLOW)
{
irp->IoStatus.Information = out_len;
@@ -119,7 +133,7 @@ static void nsiproxy_get_all_parameters( IRP *irp )
get_all.static_data = out + in->rw_size + in->dynamic_size;
get_all.static_size = in->static_size;
- irp->IoStatus.u.Status = nsi_get_all_parameters_ex( &get_all );
+ irp->IoStatus.u.Status = nsiproxy_call( nsi_get_all_parameters_ex, &get_all );
irp->IoStatus.Information = (irp->IoStatus.u.Status == STATUS_SUCCESS) ? out_len : 0;
}
@@ -152,7 +166,7 @@ static void nsiproxy_get_parameter( IRP *irp )
get_param.data_size = out_len;
get_param.data_offset = in->data_offset;
- irp->IoStatus.u.Status = nsi_get_parameter_ex( &get_param );
+ irp->IoStatus.u.Status = nsiproxy_call( nsi_get_parameter_ex, &get_param );
irp->IoStatus.Information = irp->IoStatus.u.Status == STATUS_SUCCESS ? out_len : 0;
}
@@ -215,8 +229,16 @@ static int add_device( DRIVER_OBJECT *driver )
NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
{
+ HMODULE instance;
+ NTSTATUS status;
+
TRACE( "(%p, %s)\n", driver, debugstr_w( path->Buffer ) );
+ RtlPcToFileHeader( &DriverEntry, (void *)&instance );
+ status = NtQueryVirtualMemory( GetCurrentProcess(), instance, MemoryWineUnixFuncs,
+ &nsiproxy_handle, sizeof(nsiproxy_handle), NULL );
+ if (status) return status;
+
driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = nsi_ioctl;
add_device( driver );
diff --git a/dlls/nsiproxy.sys/ip.c b/dlls/nsiproxy.sys/ip.c
index 90ea7957204..2e69c289c16 100644
--- a/dlls/nsiproxy.sys/ip.c
+++ b/dlls/nsiproxy.sys/ip.c
@@ -18,6 +18,12 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#if 0
+#pragma makedep unix
+#endif
+
+#define _NTSYSTEM_
+
#include "config.h"
#include <stdarg.h>
diff --git a/dlls/nsiproxy.sys/ndis.c b/dlls/nsiproxy.sys/ndis.c
index 90112da31bb..8971b69c2db 100644
--- a/dlls/nsiproxy.sys/ndis.c
+++ b/dlls/nsiproxy.sys/ndis.c
@@ -18,6 +18,10 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#if 0
+#pragma makedep unix
+#endif
+
#include "config.h"
#include <stdarg.h>
@@ -85,6 +89,7 @@
#include "wine/nsi.h"
#include "wine/list.h"
#include "wine/debug.h"
+#include "wine/unixlib.h"
#include "nsiproxy_private.h"
@@ -251,9 +256,9 @@ static WCHAR *strdupAtoW( const char *str )
DWORD len;
if (!str) return ret;
- len = MultiByteToWideChar( CP_UNIXCP, 0, str, -1, NULL, 0 );
+ len = strlen( str ) + 1;
ret = malloc( len * sizeof(WCHAR) );
- if (ret) MultiByteToWideChar( CP_UNIXCP, 0, str, -1, ret, len );
+ if (ret) ntdll_umbstowcs( str, len, ret, len );
return ret;
}
diff --git a/dlls/nsiproxy.sys/nsi.c b/dlls/nsiproxy.sys/nsi.c
index e29446abb50..ccfc325a085 100644
--- a/dlls/nsiproxy.sys/nsi.c
+++ b/dlls/nsiproxy.sys/nsi.c
@@ -17,6 +17,9 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#if 0
+#pragma makedep unix
+#endif
#include <stdarg.h>
@@ -28,9 +31,11 @@
#include "winioctl.h"
#include "ddk/wdm.h"
#include "ifdef.h"
+#define __WINE_INIT_NPI_MODULEID
#include "netiodef.h"
#include "wine/nsi.h"
#include "wine/debug.h"
+#include "wine/unixlib.h"
#include "nsiproxy_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(nsi);
@@ -121,3 +126,28 @@ NTSTATUS nsi_get_parameter_ex( struct nsi_get_parameter_ex *params )
return entry->get_parameter( params->key, params->key_size, params->param_type,
params->data, params->data_size, params->data_offset );
}
+
+static NTSTATUS unix_nsi_enumerate_all_ex( void *args )
+{
+ struct nsi_enumerate_all_ex *params = (struct nsi_enumerate_all_ex *)args;
+ return nsi_enumerate_all_ex( params );
+}
+
+static NTSTATUS unix_nsi_get_all_parameters_ex( void *args )
+{
+ struct nsi_get_all_parameters_ex *params = (struct nsi_get_all_parameters_ex *)args;
+ return nsi_get_all_parameters_ex( params );
+}
+
+static NTSTATUS unix_nsi_get_parameter_ex( void *args )
+{
+ struct nsi_get_parameter_ex *params = (struct nsi_get_parameter_ex *)args;
+ return nsi_get_parameter_ex( params );
+}
+
+const unixlib_entry_t __wine_unix_call_funcs[] =
+{
+ unix_nsi_enumerate_all_ex,
+ unix_nsi_get_all_parameters_ex,
+ unix_nsi_get_parameter_ex
+};
diff --git a/dlls/nsiproxy.sys/tcp.c b/dlls/nsiproxy.sys/tcp.c
index b60e53ea15e..55311a4affc 100644
--- a/dlls/nsiproxy.sys/tcp.c
+++ b/dlls/nsiproxy.sys/tcp.c
@@ -19,6 +19,10 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#if 0
+#pragma makedep unix
+#endif
+
#include "config.h"
#include <stdarg.h>
diff --git a/dlls/nsiproxy.sys/udp.c b/dlls/nsiproxy.sys/udp.c
index f25aac98ba0..0cc2cadbc98 100644
--- a/dlls/nsiproxy.sys/udp.c
+++ b/dlls/nsiproxy.sys/udp.c
@@ -18,6 +18,10 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#if 0
+#pragma makedep unix
+#endif
+
#include "config.h"
#include <stdarg.h>
#include <stddef.h>
--
2.25.1
Oct. 1, 2021
[PATCH v2 3/4] nsiproxy: Switch memory allocations to malloc().
by Huw Davies
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/nsiproxy.sys/ip.c | 13 ++++++-------
dlls/nsiproxy.sys/ndis.c | 11 +++++------
dlls/nsiproxy.sys/tcp.c | 33 ++++++++++++++++-----------------
dlls/nsiproxy.sys/udp.c | 9 ++++-----
4 files changed, 31 insertions(+), 35 deletions(-)
diff --git a/dlls/nsiproxy.sys/ip.c b/dlls/nsiproxy.sys/ip.c
index 7308e4a687e..90ea7957204 100644
--- a/dlls/nsiproxy.sys/ip.c
+++ b/dlls/nsiproxy.sys/ip.c
@@ -94,7 +94,6 @@
#include "ifdef.h"
#include "ipmib.h"
#include "netiodef.h"
-#include "wine/heap.h"
#include "wine/nsi.h"
#include "wine/debug.h"
@@ -933,12 +932,12 @@ static NTSTATUS ipv4_neighbour_enumerate_all( void *key_data, DWORD key_size, vo
if (sysctl( mib, ARRAY_SIZE(mib), NULL, &needed, NULL, 0 ) == -1) return STATUS_NOT_SUPPORTED;
- buf = heap_alloc( needed );
+ buf = malloc( needed );
if (!buf) return STATUS_NO_MEMORY;
if (sysctl( mib, ARRAY_SIZE(mib), buf, &needed, NULL, 0 ) == -1)
{
- heap_free( buf );
+ free( buf );
return STATUS_NOT_SUPPORTED;
}
@@ -982,7 +981,7 @@ static NTSTATUS ipv4_neighbour_enumerate_all( void *key_data, DWORD key_size, vo
}
next += rtm->rtm_msglen;
}
- heap_free( buf );
+ free( buf );
}
#else
FIXME( "not implemented\n" );
@@ -1122,12 +1121,12 @@ static NTSTATUS ipv4_forward_enumerate_all( void *key_data, DWORD key_size, void
if (sysctl( mib, ARRAY_SIZE(mib), NULL, &needed, NULL, 0 ) < 0) return STATUS_NOT_SUPPORTED;
- buf = heap_alloc( needed );
+ buf = malloc( needed );
if (!buf) return STATUS_NO_MEMORY;
if (sysctl( mib, 6, buf, &needed, NULL, 0 ) < 0)
{
- heap_free( buf );
+ free( buf );
return STATUS_NOT_SUPPORTED;
}
@@ -1225,7 +1224,7 @@ static NTSTATUS ipv4_forward_enumerate_all( void *key_data, DWORD key_size, void
}
num++;
}
- HeapFree( GetProcessHeap (), 0, buf );
+ free( buf );
}
#else
FIXME( "not implemented\n" );
diff --git a/dlls/nsiproxy.sys/ndis.c b/dlls/nsiproxy.sys/ndis.c
index b46b53b536c..90112da31bb 100644
--- a/dlls/nsiproxy.sys/ndis.c
+++ b/dlls/nsiproxy.sys/ndis.c
@@ -84,7 +84,6 @@
#include "ddk/wdm.h"
#include "wine/nsi.h"
#include "wine/list.h"
-#include "wine/heap.h"
#include "wine/debug.h"
#include "nsiproxy_private.h"
@@ -253,7 +252,7 @@ static WCHAR *strdupAtoW( const char *str )
if (!str) return ret;
len = MultiByteToWideChar( CP_UNIXCP, 0, str, -1, NULL, 0 );
- ret = heap_alloc( len * sizeof(WCHAR) );
+ ret = malloc( len * sizeof(WCHAR) );
if (ret) MultiByteToWideChar( CP_UNIXCP, 0, str, -1, ret, len );
return ret;
}
@@ -264,7 +263,7 @@ static struct if_entry *add_entry( DWORD index, char *name )
int name_len = strlen( name );
if (name_len >= IFNAMSIZ - 1) return NULL;
- entry = heap_alloc( sizeof(*entry) );
+ entry = malloc( sizeof(*entry) );
if (!entry) return NULL;
entry->if_index = index;
@@ -272,7 +271,7 @@ static struct if_entry *add_entry( DWORD index, char *name )
entry->if_name = strdupAtoW( name );
if (!entry->if_name)
{
- heap_free( entry );
+ free( entry );
return NULL;
}
@@ -385,7 +384,7 @@ static void ifinfo_fill_dynamic( struct if_entry *entry, struct nsi_ndis_ifinfo_
struct if_data ifdata;
if (sysctl( mib, ARRAY_SIZE(mib), NULL, &needed, NULL, 0 ) == -1) goto done;
- buf = heap_alloc( needed );
+ buf = malloc( needed );
if (!buf) goto done;
if (sysctl( mib, ARRAY_SIZE(mib), buf, &needed, NULL, 0 ) == -1) goto done;
for (end = buf + needed; buf < end; buf += ifm->ifm_msglen)
@@ -408,7 +407,7 @@ static void ifinfo_fill_dynamic( struct if_entry *entry, struct nsi_ndis_ifinfo_
}
}
done:
- heap_free( buf );
+ free( buf );
}
#endif
}
diff --git a/dlls/nsiproxy.sys/tcp.c b/dlls/nsiproxy.sys/tcp.c
index 6b431e93c8e..b60e53ea15e 100644
--- a/dlls/nsiproxy.sys/tcp.c
+++ b/dlls/nsiproxy.sys/tcp.c
@@ -97,7 +97,6 @@
#include "netiodef.h"
#include "ws2ipdef.h"
#include "tcpmib.h"
-#include "wine/heap.h"
#include "wine/nsi.h"
#include "wine/debug.h"
#include "wine/server.h"
@@ -269,7 +268,7 @@ struct ipv6_addr_scope *get_ipv6_addr_scope_table( unsigned int *size )
{
if (!table_size) table_size = 4;
else table_size *= 2;
- if (!(table = heap_realloc( table, table_size * sizeof(table[0]) )))
+ if (!(table = realloc( table, table_size * sizeof(table[0]) )))
{
fclose( fp );
goto failed;
@@ -301,7 +300,7 @@ struct ipv6_addr_scope *get_ipv6_addr_scope_table( unsigned int *size )
{
if (!table_size) table_size = 4;
else table_size *= 2;
- if (!(table = heap_realloc( table, table_size * sizeof(table[0]) )))
+ if (!(table = realloc( table, table_size * sizeof(table[0]) )))
{
freeifaddrs( addrs );
goto failed;
@@ -325,7 +324,7 @@ struct ipv6_addr_scope *get_ipv6_addr_scope_table( unsigned int *size )
return table;
failed:
- heap_free( table );
+ free( table );
return NULL;
}
@@ -356,7 +355,7 @@ struct pid_map *get_pid_map( unsigned int *num_entries )
NTSTATUS ret;
char *buffer = NULL, *new_buffer;
- if (!(buffer = heap_alloc( buffer_len ))) return NULL;
+ if (!(buffer = malloc( buffer_len ))) return NULL;
for (;;)
{
@@ -371,17 +370,17 @@ struct pid_map *get_pid_map( unsigned int *num_entries )
if (ret != STATUS_INFO_LENGTH_MISMATCH) break;
- if (!(new_buffer = heap_realloc( buffer, buffer_len )))
+ if (!(new_buffer = realloc( buffer, buffer_len )))
{
- heap_free( buffer );
+ free( buffer );
return NULL;
}
buffer = new_buffer;
}
- if (!(map = heap_alloc( process_count * sizeof(*map) )))
+ if (!(map = malloc( process_count * sizeof(*map) )))
{
- heap_free( buffer );
+ free( buffer );
return NULL;
}
@@ -400,7 +399,7 @@ struct pid_map *get_pid_map( unsigned int *num_entries )
pos += process->thread_count * sizeof(struct thread_info);
}
- heap_free( buffer );
+ free( buffer );
*num_entries = process_count;
return map;
}
@@ -495,7 +494,7 @@ unsigned int find_owning_pid( struct pid_map *map, unsigned int num_entries, UIN
int fd_len = proc_pidinfo( map[i].unix_pid, PROC_PIDLISTFDS, 0, NULL, 0 );
if (fd_len <= 0) continue;
- fds = heap_alloc( fd_len );
+ fds = malloc( fd_len );
if (!fds) continue;
proc_pidinfo( map[i].unix_pid, PROC_PIDLISTFDS, 0, fds, fd_len );
@@ -507,12 +506,12 @@ unsigned int find_owning_pid( struct pid_map *map, unsigned int num_entries, UIN
proc_pidfdinfo( map[i].unix_pid, fds[j].proc_fd, PROC_PIDFDSOCKETINFO, &sock, sizeof(sock) );
if (sock.psi.soi_pcb == inode)
{
- heap_free( fds );
+ free( fds );
return map[i].pid;
}
}
- heap_free( fds );
+ free( fds );
}
return 0;
#else
@@ -638,7 +637,7 @@ static NTSTATUS tcp_conns_enumerate_all( DWORD filter, struct nsi_tcp_conn_key *
goto err;
}
- buf = heap_alloc( len );
+ buf = malloc( len );
if (!buf)
{
status = STATUS_NO_MEMORY;
@@ -728,7 +727,7 @@ static NTSTATUS tcp_conns_enumerate_all( DWORD filter, struct nsi_tcp_conn_key *
num++;
}
err:
- heap_free( buf );
+ free( buf );
}
#else
FIXME( "not implemented\n" );
@@ -738,8 +737,8 @@ static NTSTATUS tcp_conns_enumerate_all( DWORD filter, struct nsi_tcp_conn_key *
if (!want_data || num <= *count) *count = num;
else status = STATUS_BUFFER_OVERFLOW;
- heap_free( pid_map );
- heap_free( addr_scopes );
+ free( pid_map );
+ free( addr_scopes );
return status;
}
diff --git a/dlls/nsiproxy.sys/udp.c b/dlls/nsiproxy.sys/udp.c
index c2dcc2c38e8..f25aac98ba0 100644
--- a/dlls/nsiproxy.sys/udp.c
+++ b/dlls/nsiproxy.sys/udp.c
@@ -77,7 +77,6 @@
#include "netiodef.h"
#include "ws2ipdef.h"
#include "udpmib.h"
-#include "wine/heap.h"
#include "wine/nsi.h"
#include "wine/debug.h"
#include "wine/server.h"
@@ -309,7 +308,7 @@ static NTSTATUS udp_endpoint_enumerate_all( void *key_data, DWORD key_size, void
goto err;
}
- buf = heap_alloc( len );
+ buf = malloc( len );
if (!buf)
{
status = STATUS_NO_MEMORY;
@@ -386,7 +385,7 @@ static NTSTATUS udp_endpoint_enumerate_all( void *key_data, DWORD key_size, void
num++;
}
err:
- heap_free( buf );
+ free( buf );
}
#else
FIXME( "not implemented\n" );
@@ -396,8 +395,8 @@ static NTSTATUS udp_endpoint_enumerate_all( void *key_data, DWORD key_size, void
if (!want_data || num <= *count) *count = num;
else status = STATUS_BUFFER_OVERFLOW;
- heap_free( pid_map );
- heap_free( addr_scopes );
+ free( pid_map );
+ free( addr_scopes );
return status;
}
--
2.25.1
Oct. 1, 2021
[PATCH v2 2/4] nsiproxy: Use an ascii version of str(n)casecmp() instead of _strnicmp().
by Huw Davies
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/nsiproxy.sys/ip.c | 22 +++++++++++-----------
dlls/nsiproxy.sys/ndis.c | 2 +-
dlls/nsiproxy.sys/nsiproxy_private.h | 21 +++++++++++++++++++++
dlls/nsiproxy.sys/tcp.c | 4 ++--
dlls/nsiproxy.sys/udp.c | 6 +++---
5 files changed, 38 insertions(+), 17 deletions(-)
diff --git a/dlls/nsiproxy.sys/ip.c b/dlls/nsiproxy.sys/ip.c
index 12fae3f2f12..7308e4a687e 100644
--- a/dlls/nsiproxy.sys/ip.c
+++ b/dlls/nsiproxy.sys/ip.c
@@ -261,10 +261,10 @@ static NTSTATUS ipv4_icmpstats_get_all_parameters( const void *key, DWORD key_si
while ((ptr = fgets( buf, sizeof(buf), fp )))
{
- if (_strnicmp( buf, hdr, sizeof(hdr) - 1 )) continue;
+ if (ascii_strncasecmp( buf, hdr, sizeof(hdr) - 1 )) continue;
/* last line was a header, get another */
if (!(ptr = fgets( buf, sizeof(buf), fp ))) break;
- if (!_strnicmp( buf, hdr, sizeof(hdr) - 1 ))
+ if (!ascii_strncasecmp( buf, hdr, sizeof(hdr) - 1 ))
{
ptr += sizeof(hdr);
sscanf( ptr, "%u %u %*u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u",
@@ -427,13 +427,13 @@ static NTSTATUS ipv6_icmpstats_get_all_parameters( const void *key, DWORD key_si
while (*value == ' ') value++;
if ((ptr = strchr( value, '\n' ))) *ptr='\0';
- if (!_strnicmp( buf, "Icmp6InMsgs", -1 ))
+ if (!ascii_strcasecmp( buf, "Icmp6InMsgs" ))
{
if (sscanf( value, "%d", &res )) dyn.in_msgs = res;
continue;
}
- if (!_strnicmp( buf, "Icmp6InErrors", -1 ))
+ if (!ascii_strcasecmp( buf, "Icmp6InErrors" ))
{
if (sscanf( value, "%d", &res )) dyn.in_errors = res;
continue;
@@ -441,7 +441,7 @@ static NTSTATUS ipv6_icmpstats_get_all_parameters( const void *key, DWORD key_si
for (i = 0; i < ARRAY_SIZE(in_list); i++)
{
- if (!_strnicmp( buf, in_list[i].name, -1 ))
+ if (!ascii_strcasecmp( buf, in_list[i].name ))
{
if (sscanf( value, "%d", &res ))
dyn.in_type_counts[in_list[i].pos] = res;
@@ -449,13 +449,13 @@ static NTSTATUS ipv6_icmpstats_get_all_parameters( const void *key, DWORD key_si
}
}
- if (!_strnicmp( buf, "Icmp6OutMsgs", -1 ))
+ if (!ascii_strcasecmp( buf, "Icmp6OutMsgs" ))
{
if (sscanf( value, "%d", &res )) dyn.out_msgs = res;
continue;
}
- if (!_strnicmp( buf, "Icmp6OutErrors", -1 ))
+ if (!ascii_strcasecmp( buf, "Icmp6OutErrors" ))
{
if (sscanf( value, "%d", &res )) dyn.out_errors = res;
continue;
@@ -463,7 +463,7 @@ static NTSTATUS ipv6_icmpstats_get_all_parameters( const void *key, DWORD key_si
for (i = 0; i < ARRAY_SIZE(out_list); i++)
{
- if (!_strnicmp( buf, out_list[i].name, -1 ))
+ if (!ascii_strcasecmp( buf, out_list[i].name ))
{
if (sscanf( value, "%d", &res ))
dyn.out_type_counts[out_list[i].pos] = res;
@@ -504,10 +504,10 @@ static NTSTATUS ipv4_ipstats_get_all_parameters( const void *key, DWORD key_size
while ((ptr = fgets( buf, sizeof(buf), fp )))
{
- if (_strnicmp( buf, hdr, sizeof(hdr) - 1 )) continue;
+ if (ascii_strncasecmp( buf, hdr, sizeof(hdr) - 1 )) continue;
/* last line was a header, get another */
if (!(ptr = fgets( buf, sizeof(buf), fp ))) break;
- if (!_strnicmp( buf, hdr, sizeof(hdr) - 1 ))
+ if (!ascii_strncasecmp( buf, hdr, sizeof(hdr) - 1 ))
{
DWORD in_recv, in_hdr_errs, fwd_dgrams, in_delivers, out_reqs;
ptr += sizeof(hdr);
@@ -643,7 +643,7 @@ static NTSTATUS ipv6_ipstats_get_all_parameters( const void *key, DWORD key_size
if ((ptr = strchr( value, '\n' ))) *ptr = '\0';
for (i = 0; i < ARRAY_SIZE(ipstatlist); i++)
- if (!_strnicmp( buf, ipstatlist[i].name, -1 ))
+ if (!ascii_strcasecmp( buf, ipstatlist[i].name ))
{
if (ipstatlist[i].size == sizeof(long))
*(long *)ipstatlist[i].elem = strtoul( value, NULL, 10 );
diff --git a/dlls/nsiproxy.sys/ndis.c b/dlls/nsiproxy.sys/ndis.c
index 1d0e69c593c..b46b53b536c 100644
--- a/dlls/nsiproxy.sys/ndis.c
+++ b/dlls/nsiproxy.sys/ndis.c
@@ -354,7 +354,7 @@ static void ifinfo_fill_dynamic( struct if_entry *entry, struct nsi_ndis_ifinfo_
while ((ptr = fgets( buf, sizeof(buf), fp )))
{
while (*ptr && isspace( *ptr )) ptr++;
- if (!_strnicmp( ptr, entry->if_unix_name, name_len ) && ptr[name_len] == ':')
+ if (!ascii_strncasecmp( ptr, entry->if_unix_name, name_len ) && ptr[name_len] == ':')
{
unsigned long long values[9];
ptr += name_len + 1;
diff --git a/dlls/nsiproxy.sys/nsiproxy_private.h b/dlls/nsiproxy.sys/nsiproxy_private.h
index 7dd8748e3f7..acc60ce4806 100644
--- a/dlls/nsiproxy.sys/nsiproxy_private.h
+++ b/dlls/nsiproxy.sys/nsiproxy_private.h
@@ -135,3 +135,24 @@ extern const struct module ipv4_module DECLSPEC_HIDDEN;
extern const struct module ipv6_module DECLSPEC_HIDDEN;
extern const struct module tcp_module DECLSPEC_HIDDEN;
extern const struct module udp_module DECLSPEC_HIDDEN;
+
+static inline int ascii_strncasecmp( const char *s1, const char *s2, size_t n )
+{
+ int l1, l2;
+
+ while (n--)
+ {
+ l1 = (unsigned char)((*s1 >= 'A' && *s1 <= 'Z') ? *s1 + ('a' - 'A') : *s1);
+ l2 = (unsigned char)((*s2 >= 'A' && *s2 <= 'Z') ? *s2 + ('a' - 'A') : *s2);
+ if (l1 != l2) return l1 - l2;
+ if (!l1) return 0;
+ s1++;
+ s2++;
+ }
+ return 0;
+}
+
+static inline int ascii_strcasecmp( const char *s1, const char *s2 )
+{
+ return ascii_strncasecmp( s1, s2, -1 );
+}
diff --git a/dlls/nsiproxy.sys/tcp.c b/dlls/nsiproxy.sys/tcp.c
index f9ddf1a2b23..6b431e93c8e 100644
--- a/dlls/nsiproxy.sys/tcp.c
+++ b/dlls/nsiproxy.sys/tcp.c
@@ -147,10 +147,10 @@ static NTSTATUS tcp_stats_get_all_parameters( const void *key, DWORD key_size, v
while ((ptr = fgets( buf, sizeof(buf), fp )))
{
- if (_strnicmp( buf, hdr, sizeof(hdr) - 1 )) continue;
+ if (ascii_strncasecmp( buf, hdr, sizeof(hdr) - 1 )) continue;
/* last line was a header, get another */
if (!(ptr = fgets( buf, sizeof(buf), fp ))) break;
- if (!_strnicmp( buf, hdr, sizeof(hdr) - 1 ))
+ if (!ascii_strncasecmp( buf, hdr, sizeof(hdr) - 1 ))
{
DWORD in_segs, out_segs;
ptr += sizeof(hdr);
diff --git a/dlls/nsiproxy.sys/udp.c b/dlls/nsiproxy.sys/udp.c
index a0ace071753..c2dcc2c38e8 100644
--- a/dlls/nsiproxy.sys/udp.c
+++ b/dlls/nsiproxy.sys/udp.c
@@ -123,10 +123,10 @@ static NTSTATUS udp_stats_get_all_parameters( const void *key, DWORD key_size, v
while ((ptr = fgets( buf, sizeof(buf), fp )))
{
- if (_strnicmp( buf, hdr, sizeof(hdr) - 1) ) continue;
+ if (ascii_strncasecmp( buf, hdr, sizeof(hdr) - 1 )) continue;
/* last line was a header, get another */
if (!(ptr = fgets( buf, sizeof(buf), fp ))) break;
- if (!_strnicmp(buf, hdr, sizeof(hdr) - 1))
+ if (!ascii_strncasecmp( buf, hdr, sizeof(hdr) - 1 ))
{
unsigned int in_dgrams, out_dgrams;
ptr += sizeof(hdr);
@@ -176,7 +176,7 @@ static NTSTATUS udp_stats_get_all_parameters( const void *key, DWORD key_size, v
if ((ptr = strchr( value, '\n' ))) *ptr='\0';
for (i = 0; i < ARRAY_SIZE(udp_stat_list); i++)
- if (!_strnicmp( buf, udp_stat_list[i].name, -1 ) && sscanf( value, "%d", &res ))
+ if (!ascii_strcasecmp( buf, udp_stat_list[i].name ) && sscanf( value, "%d", &res ))
*udp_stat_list[i].elem = res;
}
dyn.in_dgrams = in_dgrams;
--
2.25.1
Oct. 1, 2021