Subject Re: [firebird-support] Writing to Aliases.conf in non-admin mode
Author Venus Software Operations
Yes, thanks Walter.

On 03/11/2015 08:55 am, 'Walter R. Ojeda Valiente' sistemas2000profesional@... [firebird-support] wrote:
 
Well, the more easy answer is not install Firebird under the folder "Program files", because Windows since its Vista version has protected that folder.

You can install Firebird in C:\FIREBIRD\ or something so and no problems writing to any of its files.

Greetings.

Walter.



On Sat, Oct 24, 2015 at 1:47 AM, Venus Software Operations venussoftop@... [firebird-support] <firebird-support@yahoogroups.com> wrote:
 



On 23/10/2015 10:24 pm, Eduardo gusedum@... [firebird-support] wrote:
 

I did what (I think is what) you need many years ago. I donĀ“t remember exactly the details, but this is still working. What I did was the following:

When my application initiates, it checks if there exists a database named MYAPPLICATIONCONFIGURACION.FDB. If it doesn't exist, it creates it. When the application creates the database, it creates 3 UDFs executing SQLs begining with "DECLARE EXTERNAL FUNCTION ..."

The UDFs are the following (the names are in spanish):

MMudfUbicacionDelAlias
It is called with a parameter "Alias". It opens the file aliases.conf, look for the alias and returns a string with the path of the database.

MMudfPudeEstablecerAlias
It is called with a parameter "Alias" and a parameter "Path". It opens the file aliases.conf, and adds a new line with Alias=Path.

MMudfPudeCrearDirectorio
It is called with a parameter "Directory". It creates a folder in the hard disk with the name indicated.

In the file aliases.conf, there is a line MYAPPLICATIONCONFIGURACION = C:\...\MYAPPLICATIONCONFIGURACION.FDB.


When a user wants to create a new database, the application opens the database MYAPPLICATIONCONFIGURACION and executes the following SQL:

SELECT MMudfPudeEstablecerAlias('Alias','Path') FROM RDB$DATABASE

This can be done using the application in the server or in any client PC of the newtork.

Regards

Eduardo

Thanks Eduardo.  I would never have thought of going this way, not good with FireBird procedural coding.  Like I wrote to Stefan above I found a different way to go about this.  I took a copy of the Aliases.conf to a temp folder and updated it as necessary.  Then I used ShellExecute Windows API with "runas" parameter to run a custom batch file that does the replace of the Alias.conf file with the updated one in the temp folder.  That brings up the UAC prompt but that is fine I don't mind announcing that to the user of a system change.

Kind regards
Bhavbhuti



-- 


Thanking you.

Yours Faithfully,
For Venus Software Operations
----
Mr. Bhavbhuti Nathwani
___________________________________________
Softwares for Indian Businesses at: http://www.venussoftop.com

venussoftop@...
venussoftop@...
___________________________________________

Please note: We reserve complete rights for policy changes in the future and the same will be applicable immediately as and when made.  Attachments may get corrupted before reaching you, in such a situation please let us know and we will resend you the same at the earliest.  We do not take any responsibility for data loss of any type and kind.  Data safety remains the sole the responsibility of the users of our softwares.
___________________________________________

Internet email confidentiality:

This message may contain information that may be privileged or confidential.  If you are not the addressee nor are you responsible for the delivery of the message to the addressee indicated in this email, then you may not copy or deliver this email to anyone and you should notify the sender by reply email and then destroy this message.

Please reply email immediately to this message with REMOVE in the subject, if you or your employer do not consent to email of this kind.

Opinions, conclusions and other information in this message that do not relate to the official business of my firm shall be understood as neither given nor endorsed by my company.