1<?php
2
3function get_sysroot() {
4	// usually c:\\windows, but not always
5	return exec('echo %SYSTEMROOT%');
6}
7
8function get_junction(){
9	// junction.exe isn't included with Windows
10	// its a sysinternals tool for working with filesystem links
11	// see: http://technet.microsoft.com/en-us/sysinternals/bb896768
12
13	// install somewhere that is on %path% or added to %path%
14	return "junction.exe";
15}
16
17function get_mountvol() {
18	$sysroot = get_sysroot();
19
20	return "$sysroot\\System32\\mountvol.exe";
21}
22
23function skipIfSeCreateSymbolicLinkPrivilegeIsDisabled(string $filename) {
24	$ln = "$filename.lnk";
25	$ret = exec("mklink $ln " . __FILE__ .' 2>&1', $out);
26	@unlink($ln);
27	if (strpos($ret, 'privilege') !== false) {
28		die('skip SeCreateSymbolicLinkPrivilege not enabled');
29	}
30}
31