Skip to content
This repository was archived by the owner on Oct 2, 2023. It is now read-only.

Commit 2ba032e

Browse files
author
matthew-white
committed
Add version 1.1.0
1 parent 22d3899 commit 2ba032e

File tree

2 files changed

+150
-0
lines changed

2 files changed

+150
-0
lines changed

help/truecrypt.hlp

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{smcl}
2+
{* *! version 1.1.0 Matthew White 14mar2012}{...}
3+
{cmd:help truecrypt}
4+
{hline}
5+
6+
{title:Title}
7+
8+
{p2colset 5 23 25 2}{...}
9+
{p2col: {cmd:truecrypt} {hline 2} Mount or dismount a TrueCrypt volume}{p_end}
10+
{p2colreset}{...}
11+
12+
13+
{title:Syntax}
14+
15+
{phang}
16+
Mount a TrueCrypt volume
17+
18+
{p 8 10 2}
19+
{cmd:truecrypt} {it:filename}{cmd:,} [{opt m:ount}] [{it:options}]
20+
21+
22+
{phang}
23+
Dismount a TrueCrypt volume
24+
25+
{p 8 10 2}
26+
{cmd:truecrypt,} {opt dis:mount} {opt dr:ive(drive_letter)} [{it:options}]
27+
28+
29+
{synoptset 23 tabbed}{...}
30+
{synopthdr}
31+
{synoptline}
32+
{synopt :{opt m:ount}}mount the TrueCrypt volume {it:filename}{p_end}
33+
{synopt :{opt dis:mount}}dismount the TrueCrypt volume specified by {opt drive}{p_end}
34+
{synopt :{opt dr:ive(drive_letter)}}mount the volume as {it:drive_letter} or dismount the volume specified by {it:drive_letter}{p_end}
35+
{synopt :{opt prog:dir(directory_name)}}the directory that contains TrueCrypt.exe; default is {res:C:\Program Files\TrueCrypt}{p_end}
36+
{synoptline}
37+
{p2colreset}{...}
38+
39+
40+
{title:Description}
41+
42+
{pstd}
43+
{cmd:truecrypt} mounts or dismounts a TrueCrypt volume.
44+
45+
46+
{title:Options}
47+
48+
{phang}
49+
{opt m:ount} specifies that the TrueCrypt volume {it:filename} will be mounted. If neither {opt mount} nor {opt dismount} is specified, {opt mount}
50+
is implied.
51+
52+
{phang}
53+
{opt dr:ive(drive_letter)} specifies the drive letter to use for mounting or dismounting. If {opt mount} is specified and {opt drive()} is not, the
54+
first free drive letter is used.
55+
56+
57+
{title:Author}
58+
59+
{phang}Matthew White, Innovations for Poverty Action{p_end}
60+
{phang}[email protected]{p_end}

truecrypt.ado

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
*! version 1.1.0 Matthew White 14mar2012
2+
pr truecrypt
3+
vers 9
4+
if c(os) != "Windows" {
5+
di as err "Stata for Windows required"
6+
ex 198
7+
}
8+
syntax [anything(name=volume)], [Mount DISmount DRive(str) PROGdir(str)]
9+
10+
***Check syntax***
11+
* Check strings.
12+
loc volume `volume'
13+
loc temp : subinstr loc volume `"""' "", count(loc dq)
14+
if `dq' {
15+
di as err `"filename cannot contain ""'
16+
ex 198
17+
}
18+
foreach option in drive progdir {
19+
loc temp : subinstr loc `option' `"""' "", count(loc dq)
20+
if `dq' {
21+
di as err `"option `option'() cannot contain ""'
22+
ex 198
23+
}
24+
}
25+
26+
* -mount-, -dismount-
27+
if "`mount'`dismount'" == "" loc mount mount
28+
else if "`mount'" != "" & "`dismount'" != "" {
29+
di as err "options mount and dismount are mutually exclusive"
30+
ex 198
31+
}
32+
33+
* -mount- options
34+
if "`mount'" != "" {
35+
* `volume'
36+
conf f "`volume'"
37+
}
38+
* -dismount- options
39+
else {
40+
* `volume'
41+
if "`volume'" != "" {
42+
di as err "option dismount: filename not allowed"
43+
ex 198
44+
}
45+
46+
* -drive-
47+
if "`drive'" == "" {
48+
di as err "option dismount must be specified with option drive"
49+
ex 198
50+
}
51+
}
52+
53+
* -drive-
54+
if "`drive'" != "" {
55+
if !regexm("`drive'", "^[A-Za-z]:?$") {
56+
di as err "option drive(): invalid drive"
57+
ex 198
58+
}
59+
else loc drive = regexr("`drive'", ":$", "")
60+
}
61+
62+
* -progdir-
63+
if "`progdir'" == "" loc progdir C:\Program Files\TrueCrypt
64+
conf f "`progdir'\TrueCrypt.exe"
65+
66+
* Check that the drive is available if -mount- or is mounted if -dismount-.
67+
mata: st_local("mounted", strofreal(direxists("`drive':")))
68+
if "`mount'" != "" & `mounted' {
69+
di as err "mount: drive letter `drive' not available"
70+
ex 198
71+
}
72+
else if "`dismount'" != "" & !`mounted' {
73+
di as err "dismount: no volume specified by drive letter `drive'"
74+
ex 198
75+
}
76+
***End***
77+
78+
* -mount-
79+
if "`mount'" != "" ///
80+
sh "`progdir'\TrueCrypt.exe" /v "`volume'" `=cond("`drive'" != "", "/l `drive'", "")' /q
81+
* -dismount-
82+
else ///
83+
sh "`progdir'\TrueCrypt.exe" /d `drive' /q
84+
end
85+
86+
* Changes history
87+
* version 1.0.0 21feb2012
88+
* version 1.1.0 14mar2012
89+
* -progdir()- is optional
90+
* Syntax checks added

0 commit comments

Comments
 (0)