summaryrefslogtreecommitdiffhomepage
path: root/desktop/packages/windows-utils/src/index.cts
blob: 011e6e8217fd1cb9467456436a197bb5be55c83c (plain)
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
// This module is the CJS entry point for the library.

// The Rust addon.
import * as addon from './load.cjs';

// Use this declaration to assign types to the addon's exports,
// which otherwise by default are `any`.
declare module './load.cjs' {
  function readShortcut(linkPath: string): string | null;
  function pipeIsAdminOwned(pipePath: string): boolean;
}

/**
 * Return path for a shortcut.
 * @param linkPath absolute path to a `.lnk`.
 */
export function readShortcut(linkPath: string): string | null {
  return addon.readShortcut(linkPath);
}

/**
 * Return whether a named pipe is owned by the admin or SYSTEM account.
 * @param pipePath path to a named pipe.
 */
export function pipeIsAdminOwned(pipePath: string): boolean {
  return addon.pipeIsAdminOwned(pipePath);
}