-
Notifications
You must be signed in to change notification settings - Fork 0
/
inet-refresh.js
34 lines (28 loc) · 948 Bytes
/
inet-refresh.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
'use strict';
/**
* node wininet.dll refresh Internet Setting for proxy
* using ffi, wininet.dll
*
* you may can use InternetSetOptionA instead of InternetSetOptionW
*
* @author SnooeyNET <sople1@snooey.net>
*/
const ffi = require('ffi-napi');
const opt = {
INTERNET_OPTION_REFRESH: 37,
INTERNET_OPTION_SETTINGS_CHANGED: 39
};
let inet = ffi.Library('wininet', {
'InternetSetOptionW': ["bool", ['int', 'int', 'int', 'int']]
});
function main() {
inet.InternetSetOptionW(0, opt.INTERNET_OPTION_REFRESH, 0, 0); // InternetSetOption(0, INTERNET_OPTION_REFRESH, IntPtr.Zero, 0);
inet.InternetSetOptionW(0, opt.INTERNET_OPTION_SETTINGS_CHANGED, 0, 0); // InternetSetOption(0, INTERNET_OPTION_SETTINGS_CHANGED, IntPtr.Zero, 0);
console.log("InternetSetOption refresh launched.");
}
if (typeof require != 'undefined' && require.main === module) {
main();
}
module.exports = {
run: () => main()
};