Skip to content

Instantly share code, notes, and snippets.

@sople1
Last active April 14, 2022 07:36
Show Gist options
  • Select an option

  • Save sople1/3caca56f0b42cd0c603df1289e3e899d to your computer and use it in GitHub Desktop.

Select an option

Save sople1/3caca56f0b42cd0c603df1289e3e899d to your computer and use it in GitHub Desktop.
node wininet.dll refresh Internet Setting for proxy
'use strict';
/**
* node wininet.dll refresh Internet Setting for proxy
* using ffi, wininet.dll
*
* you may can use InternetSetOptionA rather then InternetSetOptionW
*
* @author SnooeyNET <sople1@snooey.net>
*/
const INTERNET_OPTION_REFRESH = 37
const INTERNET_OPTION_SETTINGS_CHANGED = 39
const ffi = require('ffi');
let inet = ffi.Library('wininet', {
'InternetSetOptionW': ["bool", ['int', 'int', 'int', 'int']]
});
inet.InternetSetOptionW(0, INTERNET_OPTION_REFRESH, 0, 0); // InternetSetOption(0, INTERNET_OPTION_REFRESH, IntPtr.Zero, 0);
inet.InternetSetOptionW(0, INTERNET_OPTION_SETTINGS_CHANGED, 0, 0); // InternetSetOption(0, INTERNET_OPTION_SETTINGS_CHANGED, IntPtr.Zero, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment