I sterated using "Standard User Analyzer" from Application Compatibility toolkit and it reported that my app is not UAC compatible because:
"DeleteFileA: File (\Device\HarddiskVolume1\Documents and Settings\Administrator\Local Settings\Temp\mtgstudio.madExcept) is denied 'DELETE' access with error 0x5."
"DeleteFileA: File (\Device\HarddiskVolume1\Documents and Settings\Administrator\Local Settings\Temp) is denied 'DELETE' access with error 0x5."
Checking the madExcept.pas file I found:
function GetTempPath : AnsiString;
var arrCh : array [0..MAX_PATH] of AnsiChar;
begin
if windows.GetTempPathA(MAX_PATH, arrCh) > 0 then begin
result := arrCh;
if result <> '' then begin
CreateDirectoryA(PAnsiChar(result), nil);
if result[Length(result)] <> '\' then
result := result + '\';
result := result + KillExt(ExtractFileName(ModuleName(0))) + '.madExcept';
CreateDirectoryA(PAnsiChar(result), nil);
result := result + '\';
end;
end else
result := '';
end;
Is there a good way to overwrite the madExcept behaviour and store the temp files in a UAC allowed location?