1 // Copies a NULL
-terminated
array of characters
to a
string.
2 function ArrayToString(Chars
:array of Char):String;
6 Len
:=GetArrayLength(Chars
);
10 while (i
<Len
) and (Chars
[i
]<>#
0) do begin
11 Result
[i
+1]:=Chars
[i
];
18 // Copies a
string to a NULL
-terminated
array of characters
.
19 function StringToArray(Str
:String):array of Char;
24 SetArrayLength(Result
,Len
+1);
35 // Returns the path
to the common
or user shell folder
as specified
in "Param".
36 function GetShellFolder(Param
:string):string;
38 if IsAdminLoggedOn
then begin
39 Param
:='{common'+Param
+'}';
41 Param
:='{user'+Param
+'}';
43 Result
:=ExpandConstant(Param
);
46 // As IsComponentSelected() is not supported during uninstall
, this work
-around
47 // simply checks the Registry
. This
is unreliable
if the user runs the installer
48 // twice
, the first time selecting the component
, the second deselecting it
.
49 function IsComponentInstalled(Component
:String):Boolean;
51 UninstallKey
,UninstallValue
:String;
56 UninstallKey
:='SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#APP_NAME}_is1';
57 UninstallValue
:='Inno Setup: Selected Components';
59 if RegQueryStringValue(HKEY_LOCAL_MACHINE
,UninstallKey
,UninstallValue
,Value
) then begin
60 Result
:=(Pos(Component
,Value
)>0);
64 // Checks whether the specified directory can be created
and written
to.
65 // Note that the created dummy
file is not explicitly deleted here
, so that
66 // needs
to be done
as part
of the uninstall process
.
67 function IsDirWritable(DirName
:String):Boolean;
73 if not ForceDirectories(DirName
) then begin
77 FileName
:=DirName
+'\setup.ini';
79 if not SetIniBool('Dummy','Writable',true,FileName
) then begin
83 Result
:=GetIniBool('Dummy','Writable',false,FileName
);