-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathSpiChildProcess.js
More file actions
44 lines (38 loc) · 1.38 KB
/
SpiChildProcess.js
File metadata and controls
44 lines (38 loc) · 1.38 KB
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
35
36
37
38
39
40
41
42
43
44
/*
* SPI Child Process.
* This is executed by gpii.windows.spi.callProblematicSpi, in order to invoke certain problematic SET calls to
* SystemParametersInfo in a separate process. The exit code is the return value of the function.
*
* Copyright 2016 Raising the Floor - International
*
* Licensed under the New BSD license. You may not use this file except in
* compliance with this License.
*
* The research leading to these results has received funding from the European Union's
* Seventh Framework Programme (FP7/2007-2013)
* under grant agreement no. 289016.
*
* You may obtain a copy of the License at
* https://github.com/GPII/universal/blob/master/LICENSE.txt
*/
"use strict";
var ffi = require("ffi");
// 1 if uiParam is a literal number, otherwise it's a block of data.
var pvParamPrimitive = process.env.GPII_SPI_PVPARAM_PRIMITIVE === "1";
var action = process.env.GPII_SPI_ACTION;
var uiParam = process.env.GPII_SPI_UIPARAM;
var fWinIni = process.env.GPII_SPI_FWININI;
var pvParam, type;
if (pvParamPrimitive) {
type = "uint32";
pvParam = process.env.GPII_SPI_PVPARAM;
} else {
type = "void*";
pvParam = new Buffer(process.env.GPII_SPI_PVPARAM, "hex");
}
var user32 = ffi.Library("user32", {
"SystemParametersInfoW": [
"int32", ["uint32", "uint32", type, "uint32"]
]
});
return user32.SystemParametersInfoW(action, uiParam, pvParam, fWinIni);