ispyx 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/platform/win32/win32.js +18 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ispyx",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Local desktop-control MCP server: lets an AI use your keyboard, mouse and screen (windows, screenshots, clicks, typing, clipboard). stdio only, Windows and macOS.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/server.js",
|
|
@@ -8,6 +8,9 @@ const advapi32 = koffi.load('advapi32.dll');
|
|
|
8
8
|
const dwmapi = koffi.load('dwmapi.dll');
|
|
9
9
|
const ole32 = koffi.load('ole32.dll');
|
|
10
10
|
const winmm = koffi.load('winmm.dll');
|
|
11
|
+
const wtsapi32 = koffi.load('wtsapi32.dll');
|
|
12
|
+
const wtsQuery = wtsapi32.func('bool WTSQuerySessionInformationW(intptr_t server, uint32 session, int cls, _Out_ void **buf, _Out_ uint32_t *len)');
|
|
13
|
+
const wtsFree = wtsapi32.func('void WTSFreeMemory(void *p)');
|
|
11
14
|
const timeBeginPeriod = winmm.func('uint32 timeBeginPeriod(uint32 ms)');
|
|
12
15
|
|
|
13
16
|
export const RECT = koffi.struct('RECT', { left: 'int32', top: 'int32', right: 'int32', bottom: 'int32' });
|
|
@@ -236,12 +239,26 @@ export const rootWindowAt = (x, y) => {
|
|
|
236
239
|
};
|
|
237
240
|
export const foregroundWindow = () => f.GetForegroundWindow();
|
|
238
241
|
|
|
242
|
+
// WTSINFOEX_LEVEL1 for the current session: int32 at index 4 is SessionFlags (0 = locked, 1 = unlocked).
|
|
243
|
+
function sessionFlagsLocked() {
|
|
244
|
+
const out = [null];
|
|
245
|
+
const len = [0];
|
|
246
|
+
if (!wtsQuery(0, 0xFFFFFFFF, 25, out, len) || !out[0]) return false;
|
|
247
|
+
try {
|
|
248
|
+
return koffi.decode(out[0], koffi.array('int32_t', 5))[4] === 0;
|
|
249
|
+
} finally {
|
|
250
|
+
wtsFree(out[0]);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
239
254
|
export function isScreenLocked() {
|
|
240
255
|
// The input desktop cannot be opened while the secure (lock / UAC) desktop is active.
|
|
241
256
|
const d = f.OpenInputDesktop(0, false, 0x100);
|
|
242
257
|
if (!d) return true;
|
|
243
258
|
f.CloseDesktop(d);
|
|
244
|
-
|
|
259
|
+
// The lock screen's cover (clock and widgets, before the sign-in tiles) does not switch desktops, so the
|
|
260
|
+
// check above passes while it is showing; the session's own lock flag does not have that blind spot.
|
|
261
|
+
return sessionFlagsLocked();
|
|
245
262
|
}
|
|
246
263
|
|
|
247
264
|
export function windowDpi(hwnd) {
|