Delphi – BDE, Windows 7 and UAC

bdedelphidelphi-5uac

I have a very old application written in delphi 5 running in some customers which uses the BDE. Now some users with Windows Vista and 7, had experimented some problems with the multiuser access. i' think which these problems are related to the location of the net.and .lck files. so the question is which is the proper way to confgure the BDE under Windows Vista and 7 to avoid permissions and UAC conflicts?

Best Solution

In addition to the above answer, you'll want to make sure that the .net and .lck files are located in a user-specific directory under Windows 7, specifically:

C:\Users\{User Name}\AppData\Local\{Your Company Name}\{Your Application Name}

Those are the only folders that the current user will always have complete control over.

You can get this folder by using this code:

CSIDL_LOCAL_APPDATA = $001C;

function GetAppDataDirectory: AnsiString;
var
   TempBuffer: array[0..MAX_PATH] of AnsiChar;
   ResultLength: Integer;
begin
   FillChar(TempBuffer,((MAX_PATH+1)*SizeOf(AnsiChar)),0);
   ShlObj.SHGetSpecialFolderPathA(0,@TempBuffer,CSIDL_LOCAL_APPDATA,False);
   ResultLength:=StrLen(pAnsiChar(@TempBuffer));
   SetLength(Result,ResultLength);
   Move(TempBuffer[0],pAnsiChar(Result)^,(ResultLength*SizeOf(AnsiChar)));
end;

and then appending {Your Company Name} and {Your Application Name} to the value returned. You'll need to include the ShlObj unit.

Related Question