3 // Copies a NULL
-terminated
array of characters
to a
string.
4 function ArrayToString(Chars
:array of Char):String;
8 Len
:=GetArrayLength(Chars
);
12 while (i
<Len
) and (Chars
[i
]<>#
0) do begin
13 Result
[i
+1]:=Chars
[i
];
20 // Copies a
string to a NULL
-terminated
array of characters
.
21 function StringToArray(Str
:String):array of Char;
26 SetArrayLength(Result
,Len
+1);
37 // Returns the path
to the common
or user shell folder
as specified
in "Param".
38 function GetShellFolder(Param
:string):string;
40 if IsAdminLoggedOn
then begin
41 Param
:='{common'+Param
+'}';
43 Param
:='{user'+Param
+'}';
45 Result
:=ExpandConstant(Param
);
48 // As IsComponentSelected() is not supported during uninstall
, this work
-around
49 // simply checks the Registry
. This
is unreliable
if the user runs the installer
50 // twice
, the first time selecting the component
, the second deselecting it
.
51 function IsComponentInstalled(Component
:String):Boolean;
53 UninstallKey
,UninstallValue
:String;
58 UninstallKey
:='SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#APP_NAME}_is1';
59 UninstallValue
:='Inno Setup: Selected Components';
61 if RegQueryStringValue(HKEY_LOCAL_MACHINE
,UninstallKey
,UninstallValue
,Value
) then begin
62 Result
:=(Pos(Component
,Value
)>0);
66 // Checks whether the specified directory can be created
and written
to.
67 // Note that the created dummy
file is not explicitly deleted here
, so that
68 // needs
to be done
as part
of the uninstall process
.
69 function IsDirWritable(DirName
:String):Boolean;
75 if not ForceDirectories(DirName
) then begin
79 FileName
:=DirName
+'\setup.ini';
81 if not SetIniBool('Dummy','Writable',true,FileName
) then begin
85 Result
:=GetIniBool('Dummy','Writable',false,FileName
);