How can I get system display name with Inno Setup?
How can I get system display name of a file, directory, or folder as it would be displayed in a system file browser? For example original CD is 开发者_Go百科named somehow and I want to do little copy protection
Inno Setup provides no such functions. However, you can easily write your own DLL that investigates the label of the CD drive of the setup program. In Pascal, just do
function GetCDLabel: string;
var
VolumeName: PChar;
dummy: cardinal;
begin
GetMem(VolumeName, MAX_PATH * sizeof(char));
try
if GetVolumeInformation(PChar('D:\'), VolumeName, MAX_PATH + 1, nil, dummy, dummy, nil, 0) then
result := VolumeName
else
RaiseLastOSError; // or result := 'Invalid';
finally
FreeMem(VolumeName);
end;
end;
Inno Setup lets you include DLLs with your setup, and call functions in these DLLs during setup. Of course, your setup must tell the DLL function its filename, so that the DLL function can use the right drive. You cannot just assume it is D:\
.
精彩评论