Registry Write Privileges on Windows 7 with Delphi 7 - delphi

I was built an application on Delphi 7 + Windows XP Pro Sp3 platform, the application run correctly, than i sent this application to my friend that have a Windows 7 OS, my application cannot write the initialization data to the registry with an error "Failed to set data ...", i was suggesst my friend to right clik and choose "Run as Administrator...". How can i build my application on Delphi 7 that can run and write a registry on Windows 7?
Please help, because i could not find the right solution on google right now...
Thanks in advance...
Regards
Chrisna Obaja

Modern versions of Windows have their users running without admin rights by default. This is controlled by UAC.
The solution is usually not to attempt to gain admin rights. Instead you should stop attempting things that need admin rights unless you really do need to. Typically only install programs need admin rights.
You don't say why you are writing to a restricted area of the registry but you should be able to find an alternative to doing so.

You can only write without restriction in HKEY_CURRENT_USER section only - and that will almost be suficient.
To write other parts of registry make an installer.
Otherwise you need Administrator Rights or manifest file.

Related

Can Delphi 6 be installed in Windows 10

Previously, a few weeks back,
I asked a similar question regarding D6 and Windows 7.
After installing Delphi 6 in another path, it worked.
BUT now,
after upgrading from W7 to Windows 10 it no longer works.
I am prompted to register the software.
I do that, and am told the registration was successful.
Attempting to start again I am told license information
is invalid or missing.
The program will not start.
What is needed to run D6 in a Windows 10 machine?
There is an Howto I've found at ViaSoftThink I've translated it for you
How to:
Don’t install under C:\Programme (x86) use another folder e.g. C:\software_old
After the installation you're forced to register. Whether the registration process was canceled or successful you probably get an error message:
"License information is invalid or missing Please register"
Now do the following:
Execute c:\software_old\Borland\Delphi6\bin\D6RegClean.exe
After this install Delphi 6 from your CD but this time choose "repair"
To use the Help System you need to install WinHlp32.exe Microsoft doesn’t give you an Installation Package but you can download it here
If you follow the steps above and still have a registration error pop up there might be that you need to edit the registry at:
HKEY_CURRENT_USER\SOFTWARE\Borland\Delphi\6.0
On the right side you'll find an entry which is called LM
Delete that key and try again registering...
Please note: Messing around with the registry can break your system only do it if you know what your doing
Deletion of LM key, worked for me,
Delete key.
Reboot.
Launch Delphi, choose register later, quit.
Launch Delphi again, works OK.
Also, I modified authorization of c:/programmes/borland/delphi/bin to total control and delphi32.exe compatibility properties to Windows XP and executed as administrator.
Restart Delphi and choose register later.
New LM key will be created and you can continue unregistered
Needed to fix legacy code from 2005

Delphi 5 Unknown Publisher Version Info

I build a number of executable applications in Delphi 5 which talk to databases over a network. On my Windows 7 PC and other PCs they run without any warning but on some client PCs it gives an 'unknown publisher' warning which doesn't look professional and may be causing other permission issues.
My question is as follows:
Can anything be added to an application at design time e.g. in Version Info to make it a more trusted application. Is this actually possible in Delphi5?
Is there anything I must request from Microsoft as an application builder to help them trust my applications?
Failing the above, how do I disable the 'Trusted Publisher' warning in Windows 7? (apologies this is not a Delphi question)
Thanks
You need to sign your executable with a Code Signing security certificate. That is what the warning is referring to on those client PCs - Windows is not able to verify the integrity of the executable. The certificate identifies who created the executable, and also ensures that the executable has not been modified after you signed it.

Cannot debug Delphi process because of UAC

I found interesting problem with Win7/X64 machine.
For this time I haven't got problem with Delphi 6 and UAC.
The exes are working in their's place, so I can use Delphi debugger with them.
But today I got error on run the project: "Unable to create process. For this operation you need higher user level".
How can I prevent this side-effect?
What causes this?
I don't understand why the older projects are running fine, but this new isn't...
Thanks for every idea, link, information!
Additional info:
Normally I using the Delphi 6 IDE with normal starting (without SysAdmin rigths).
So it is never asking me with "really?" kind UAC questions.
And every of the older projects are usable with Delphi 6 - I can build, run, debug everything.
This problem happened with only this project, so I try to find the differences if possible to solve the problem.
I using normal directory ("c:\dev\anyproject"), others are using "c:\dev\otherproject1..2..n").
Does your application request elevation when started from Windows Explorer?
Does it have a manifest?
The name of the exe, like setup.exe, could also trigger elevation. See an outline of the Installer detection technology.
Non-elevated process can't debug elevated process.
If your application requires elevation at the start, then you would need to run the IDE elevated to be able to debug it.
Starting your IDE as an administrator should solve the problem (option in the context menu).
If not, you could always disable UAC while developing.
There is a number of limitations that needs administrator's rights.
For example: you cannot write data directly into program files directory.

Developing Apps with Administrator Rights in Delphi

I'm using D2010 under Windows 7 to write an app that seems to require admin rights (I think because it uses COM to communicate with a third party .exe, which also requires admin rights).
I've added the manifest resource as required, but when I try to debug the app from the IDE, it reports
"Unable to create process. The
requested operation requires
elevation"
...and it won't run. If I run Delphi as administrator, then my app runs correctly, but this feels like a dangerous brute force approach, especially as most of the apps I develop don't need admin privileges.
Is there any way of getting Delphi to prompt for elevation just when I run my app, rather than having the whole IDE run elevated?
UAC also catches any application that has the words "setup", "update" or "install" in their name or in many of the Version Resource fields. (Company name, App Name, Description etc.
It considers any such application to be a potential "installer" application and therefore must be run with Admin privileges.
Sounds crazy, but it's true. See the "Installer Detection" section in this document.
You can get around this by including a manifest that says that it doesn't need admin privileges.
There is none, it also doesn't work for VS:
https://stackoverflow.com/questions/3265787/how-do-i-debug-an-process-as-elevated-with-visual-studio-2008-sp1-on-windows-7
I guess you could run the remote debugger elevated and attach the IDE using remote debugging though.
It doesn't work, because the process is running as another user (or using another user token).
The IDE is trying to run the debugging process using CreateProcess and that fails when the application requires elavation, more details can be found in this article:
http://www.codeproject.com/KB/vista-security/UAC__The_Definitive_Guide.aspx
RAD Studio could run the application using ShellExecute with the "runas" verb, but this still doesn't solve the "debugging process under other user context" issue.
In other words: An elevated process can only be debugged by an elavated debugger.
Edit:
The Delphi XE2 IDE is 32-Bit and can debug 64-Bit applications only through the remote debugger (which is cleverly hidden from the user).
I guess Embarcadero could make it possible to debug elevated applications in a similar fashion.
The only way I know to debug such an app is to run the IDE as administrator. I wouldn't recommend doing this routinely, just for debugging sessions.
Actually it may be possible to debug a process with "higher level access" from a process with "normal level access".
At least until Windows XP it is sufficient to add your user account to the Debugger Users group to debug processes running e.g. with Administrator privileges.
That doesn't solve Delphi 2010s problem to run the process at all, but may be useful if you try to attach the debugger to a already running process.
I don't think this works on UAC enabled Vista+, but I thought I'd mention it anyway. :)
To be exact the UAC split token concept disables the SeDebugPrivilege:
http://blogs.msdn.com/b/greggm/archive/2006/03/30/565303.aspx
http://blogs.msdn.com/b/mithuns/archive/2006/04/04/568291.aspx
Run Delphi (any version) as Administrator.
You can change Delphi shortcut properties also (to run it always as administrator).

Windows 7 is blocking my application. What should I do?

When my application is installed in "C:\Program Files..." in Win7 when I launch it, it can't have access to another executable file in the same directory. Other applications work well with this version of Windows except my app :((
I'm using Delphi 7
There is a really good article here on developing apps for Windows 7 that addresses UAC issues specifically.
The upshot is, Program Files is regarded as a directory that should not be messed with lightly, Windows 7 wants elevated privileges to access resources from there.
Craig Stuntz typed here very good like that :
For Vista/Win7, your app can't put the files in a subfolder of Program Files / Programs unless UAC is turned off or the app is running as elevated. Note that "elevated" does not necessarily mean "logged in as Administrator." Non-administrator users can elevate, and Administrator isn't necessarily elevated.

Resources