BDE、Windows 7 和 UAC

发布于 2024-10-25 10:17:31 字数 206 浏览 6 评论 0原文

我有一个用 delphi 5 编写的非常旧的应用程序,在一些使用 BDE 的客户中运行。现在,一些使用 Windows Vista 和 7 的用户已经尝试了多用户访问的一些问题。我认为这些问题与 net. 和 .lck 文件的位置有关。所以问题是在 Windows Vista 和 7 下配置 BDE 以避免权限和 UAC 冲突的正确方法是什么?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

两人的回忆 2024-11-01 10:17:31

除了上述答案之外,您还需要确保 .net 和 .lck 文件位于 Windows 7 下的用户特定目录中,具体来说:

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

这些是当前用户始终拥有完全控制权的唯一文件夹超过。

您可以使用以下代码获取此文件夹:

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;

然后将 {Your Company Name}{Your Application Name} 附加到返回的值中。您需要包含 ShlObj 单元。

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.

蘸点软妹酱 2024-11-01 10:17:31

我记得的一件事是配置会话将此类文件放在普通用户具有写入权限的文件夹中。

据我所知,这些属性

Session.PrivateDir
Session.NetFileDir

是相关的。

正确的位置取决于并发访问、您要连接的数据库、数据位置(在出现悖论或 dbf 的情况下)以及是否使用缓存更新。

我维护一个最初用 D4 编写的应用程序,现在在很少需要的时候使用 D2007 进行编译,并且它在 vista+ 上运行良好,使用它及其特定的配置和需求(没有悖论/dbf)。

One such thing I remember is to configure the Session to put that kind of files on folders where a normal user have write-privileges.

From what I remember, the properties

Session.PrivateDir
Session.NetFileDir

Are the relevant ones.

The correct location will depend on concurrent access, the database you're connecting to, data location –in case of paradox or dbf's– and if you use cached updates or not.

I maintain an application written originally in D4, now compiled with D2007 when rarely needed and it works well on vista+ using this with it's particular configuration and needs (no paradox/dbf's).

云淡月浅 2024-11-01 10:17:31

如果您不想解决 BDE 默认安装中的安全错误(正如其他答案提到的 - 授予 BDE 安装程序忘记授予的权限),您只需以管理员

您有几个选择:

  1. 告诉用户每次都右键单击并选择以管理员身份运行
  2. 转到程序的“兼容性”选项卡,然后选中以管理员身份运行此程序(其效果与 1)
  3. 转到程序的“兼容性”选项卡,然后以兼容模式运行此程序 code> 对于 Windows XP(与 2 具有相同的效果)
  4. 创建清单 MyApp.exe.manifest 并包含 requestedExecutionLevel>requireAdministrator (与 3 具有相同的效果)

换句话说:您的应用程序,就目前而言,需要管理访问权限才能运行 - 因此只需以管理员身份运行它。

另一方面,您可以进行一些简单的更改,您的应用程序将不再需要以管理员身份运行;你们让世界变得更加美好!

If you don't want to work around the security bugs in a default install of the BDE (as other answers mention - granting permissions that the BDE installer forgot to), you can just run your application as an administrator.

You have a few options:

  1. Tell the user to right-click and select Run As Administrator every time.
  2. Go to the program's Compatibility tab, and check Run this program as an administrator (which has the same effect as 1)
  3. Go to the program's Compatibility tab, and Run this program in compatibility mode for Windows XP (which has the same effect as 2)
  4. Create a manifest MyApp.exe.manifest and include the requestedExecutionLevel of requireAdministrator (which has the same effect as 3)

In other words: Your application, as it stands right now, requires administrative access to run - so just run it as an administrator.

On the other hand you can make a few simple changes and your application will no longer need to run as an administrator; you've made the world a better place for all humanity!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文