UNPKG

gpii-windows

Version:

Components of the GPII personalization infrastructure for use on Microsoft's "Windows" ™

45 lines (38 loc) 1.41 kB
/* * 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-napi"); // 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);