From 9686e84a658226ca0fd8df01681e7938ed011e0a Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Thu, 30 Jul 2020 14:38:46 -0500 Subject: [PATCH] steam_helper: Make file extension check case-insensitive --- steam_helper/steam.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/steam_helper/steam.cpp b/steam_helper/steam.cpp index b168618c..e99c3195 100644 --- a/steam_helper/steam.cpp +++ b/steam_helper/steam.cpp @@ -466,6 +466,16 @@ static BOOL WINAPI console_ctrl_handler(DWORD dwCtrlType) return TRUE; } +static BOOL streq_niw(const WCHAR *l, const WCHAR *r, size_t len) +{ + while(len > 0){ + if(towlower(*l) != towlower(*r)) + return FALSE; + ++l; ++r; --len; + } + return TRUE; +} + static BOOL should_use_shell_execute(const WCHAR *cmdline) { BOOL use_shell_execute = TRUE; @@ -492,7 +502,7 @@ static BOOL should_use_shell_execute(const WCHAR *cmdline) { static const WCHAR exeW[] = {'.','e','x','e',0}; - if (!strncmpW(executable_name_end, exeW, wcslen(exeW))) + if (streq_niw(executable_name_end, exeW, sizeof(exeW) / sizeof(*exeW) - 1)) use_shell_execute = FALSE; }