Skip to content

Commit

Permalink
feat: Register DLLs, install service, and get user status using gkutils
Browse files Browse the repository at this point in the history
  • Loading branch information
microshine committed May 24, 2024
1 parent d5bda83 commit ce601ef
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dist/index.js

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { promises as fs } from 'fs';
import * as path from 'path';
import { exec } from 'child_process';

const serviceFile = 'gksvc.exe';
const keyProvFile = 'gkcng.dll';
Expand All @@ -13,4 +14,15 @@ export async function installGoodKey(distDir: string, systemDir: string) {
const destPath = path.join(systemDir, file);
await fs.copyFile(srcPath, destPath);
}

// Register DLLs
await exec(`regsvr32.exe /s "${path.join(systemDir, keyProvFile)}"`);
await exec(`regsvr32.exe /s "${path.join(systemDir, certProvFile)}"`);

// Install service
await exec(`sc create gksvc binPath= "${path.join(systemDir, serviceFile)}" start= auto`);

// Get User status using gkutils
const { stdout } = await exec(`${path.join(systemDir, utilFile)} auth status`);
console.log(stdout);
}

0 comments on commit ce601ef

Please sign in to comment.