当前位置 : 主页 > 编程语言 > delphi >

delphi应用程序有权限问题.为什么?

来源:互联网 收集:自由互联 发布时间:2021-06-23
Delphi 2010 Windows 7 – 64位. 我有一个相当微不足道的应用程序.这是一个数据库应用程序.它启动,找到它的当前目录,查找数据库文件IN THAT DIRECTORY,打开它,并显示一些数据.它在我的开发计算
Delphi 2010

Windows 7 – 64位.

我有一个相当微不足道的应用程序.这是一个数据库应用程序.它启动,找到它的当前目录,查找数据库文件IN THAT DIRECTORY,打开它,并显示一些数据.它在我的开发计算机上工作正常.我把它带到另一台计算机,也是Windows 7,64位,我收到一个错误. (具体来自数据库库 – 组件Ace – 表示列不存在).我不得不相信这是一个通用的访问错误.当我右键单击桌面图标,然后选择RUN AS ADMINISTRATOR时,它运行正常.我没有明确地锁定任何东西.我作为管理员用户在计算机上.管理员已安装该应用.我正在尝试将此应用分发给多个人.我正在使用的安装例程是InnoSetup.遇到什么类型的权限问题?

为了完整起见,我包含了INNO SETUP.iss文件.
谢谢
GS

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "DocAssist"
#define MyAppVerName "DocAssist 3.2"
#define MyAppPublisher "GS"
#define MyAppExeName "DocAssist.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{6F34D198-14A0-4398-8E82-34232956CC5B}
AppName={#MyAppName}
AppVerName={#MyAppVerName}
AppPublisher={#MyAppPublisher}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
OutputDir=D:\Projects\DocAssist\DISTR
OutputBaseFilename=DocAssistV3Setup
Compression=lzma
SolidCompression=yes
AppCopyright=GS
VersionInfoVersion=3.2

[Languages]
Name: english; MessagesFile: compiler:Default.isl

[Tasks]
; Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons};

[Files]
Source: D:\Projects\DocAssist\DISTR\DocAssist.exe; DestDir: {app}; Flags: ignoreversion
Source: D:\Projects\DocAssist\DISTR\DocAssist.ABS; DestDir: {app}; Flags: ignoreversion
Source: D:\Projects\DocAssist\DISTR\StopWords.txt; DestDir: {app}; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: DocAssist Version 3_2.pdf; DestDir: {app}; Flags: isreadme
; Add-in dll
Source: D:\Projects\DocAssist\DISTR\DocAssistCom.dll; DestDir: {app}; Flags: regserver
Source: D:\Projects\DocAssist\DISTR\gdiplus.dll;      DestDir: {app}; Flags: ignoreversion

[Icons]
Name: {group}\{#MyAppName}; Filename: {app}\{#MyAppExeName}
Name: {group}\{cm:UninstallProgram,{#MyAppName}}; Filename: {uninstallexe}
Name: {commondesktop}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Tasks: desktopicon

[Run]
Filename: {app}\{#MyAppExeName}; Description: {cm:LaunchProgram,{#MyAppName}}; Flags: nowait postinstall skipifsilent


[Registry]
Root: HKLM; Subkey: SOFTWARE\DocAssist; ValueType: none; Permissions: admins-full; Flags: uninsdeletekey createvalueifdoesntexist;
Root: HKLM; Subkey: SOFTWARE\DocAssist; ValueType: string; ValueName: InstallDir; ValueData: {app}; Permissions: admins-full; Flags: uninsdeletekey createvalueifdoesntexist
您不应该写入程序文件目录中的文件.自Windows 95以来,这已被弃用,但从Windows Vista开始,它变得更加严格,默认情况下不允许写入,除非您是管理员.

您可以写入许多其他地方,App Data是常用文件夹,My Documents也是如此.您可以使用SHGetSpecialFolderLocation api查找这些特殊文件夹的确切位置(因为它因安装而异).

B.t.w.如果必须使用应用程序目录,请使用Application.ExeName或ParamStr(0)而不是当前目录.

网友评论