Skip to content

Commit

Permalink
fix #1648
Browse files Browse the repository at this point in the history
  • Loading branch information
henrypp committed Nov 29, 2023
1 parent c04f0e9 commit f72a038
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
23 changes: 9 additions & 14 deletions src/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -2041,16 +2041,16 @@ HBITMAP _app_bitmapfrompng (
BOOLEAN _app_wufixenabled ()
{
WCHAR file_path[256];
BOOLEAN is_enabled;

_r_str_printf (file_path, RTL_NUMBER_OF (file_path), L"%s\\wusvc.exe", _r_sys_getsystemdirectory ()->buffer);
if (!_r_config_getboolean (L"IsWUFixEnabled", FALSE))
return FALSE;

is_enabled = _r_config_getboolean (L"IsWUFixEnabled", FALSE);
_r_str_printf (file_path, RTL_NUMBER_OF (file_path), L"%s\\wusvc.exe", _r_sys_getsystemdirectory ()->buffer);

if (is_enabled)
is_enabled = _r_fs_exists (file_path);
if (_r_fs_exists (file_path))
return TRUE;

return is_enabled;
return FALSE;
}

VOID _app_wufixhelper (
Expand All @@ -2069,12 +2069,7 @@ VOID _app_wufixhelper (
BOOLEAN is_enabled = FALSE;
NTSTATUS status;

_r_str_printf (
reg_key,
RTL_NUMBER_OF (reg_key),
L"SYSTEM\\CurrentControlSet\\Services\\%s",
service_name
);
_r_str_printf (reg_key, RTL_NUMBER_OF (reg_key), L"SYSTEM\\CurrentControlSet\\Services\\%s", service_name);

status = _r_reg_openkey (HKEY_LOCAL_MACHINE, reg_key, KEY_READ | KEY_WRITE, &hkey);

Expand Down Expand Up @@ -2106,7 +2101,7 @@ VOID _app_wufixhelper (
// restart service
if (is_enable != is_enabled)
{
hsvc = OpenService (hsvcmgr, service_name, SERVICE_START | SERVICE_STOP | SERVICE_QUERY_STATUS);
hsvc = OpenServiceW (hsvcmgr, service_name, SERVICE_START | SERVICE_STOP | SERVICE_QUERY_STATUS);

if (hsvc)
{
Expand Down Expand Up @@ -2137,7 +2132,7 @@ VOID _app_wufixenable (
_r_str_printf (buffer1, RTL_NUMBER_OF (buffer1), L"%s\\svchost.exe", _r_sys_getsystemdirectory ()->buffer);
_r_str_printf (buffer2, RTL_NUMBER_OF (buffer2), L"%s\\wusvc.exe", _r_sys_getsystemdirectory ()->buffer);

hsvcmgr = OpenSCManager (NULL, NULL, SC_MANAGER_CONNECT | SERVICE_START | SERVICE_STOP | SERVICE_QUERY_STATUS);
hsvcmgr = OpenSCManagerW (NULL, NULL, SC_MANAGER_CONNECT | SERVICE_START | SERVICE_STOP | SERVICE_QUERY_STATUS);

if (!hsvcmgr)
return;
Expand Down
2 changes: 1 addition & 1 deletion src/wfp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2634,7 +2634,7 @@ VOID NTAPI _wfp_applythread (
if (context->is_install)
{
if (_r_sys_isosversiongreaterorequal (WINDOWS_10))
_app_wufixenable (context->hwnd, _app_wufixenabled ());
_app_wufixenable (context->hwnd, _r_config_getboolean (L"IsWUFixEnabled", FALSE));

if (_wfp_initialize (context->hwnd, engine_handle))
_wfp_installfilters (engine_handle);
Expand Down

0 comments on commit f72a038

Please sign in to comment.