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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
-
|
!
|
#ifndef __MODULE_DIRINFOUAC__
#define __MODULE_DIRINFOUAC__
#undef dirinfo
#module _mod_dirinfouac_
#uselib "kernel32.dll"
#func _get_temp_path_ "GetTempPathA" int, var
#func _get_module_file_name_ "GetModuleFileNameA" int, var, int
#defcfunc _dirinfo int p1
sdim rPath, $100 : sdim tmp, $100 : i = 0
switch p1
case $FFFD _get_module_file_name_ 0, rPath, $100 : swbreak
case $FFFE _get_temp_path_ $100, tmp
rPath = strmid(tmp, 0, strlen(tmp)-1) : swbreak
case $FFFF rPath = getpath(dirinfo@hsp(1), 16)
repeat 4, $10023
tmp = getpath(dirinfo@hsp(cnt), 16)
if tmp!"" {
if instr(rPath, 0, tmp)=0 {i++}
}
loop
if i!0 {rPath = dirinfo@hsp($1001A)} : swbreak
default rPath = dirinfo@hsp(p1)
swend
mref tmp,64 : tmp = i
return rPath
#define global ctype dirinfo(%1=0) _dirinfo(%1)
#define global dir_ini _dirinfo($FFFF)
#define global dir_temp _dirinfo($FFFE)
#define global dir_self _dirinfo($FFFD)
#define global dir_app _dirinfo($1001A)
#global
#endif
|