Mega Search
23.2 Million


Sign Up

Make a donation  
BDE, Paradox on UAC OS [Edit]  
News Group: embarcadero.public.bde.general

Hi,
using a multithreaded app on UAC OS:es with Paradox tables. The default location for the PDOXUSRS.NET file is C:\ which is now write protected by default on a UAC OS. This is fine for single-threaded BDE Paradox (and maybe other types too) database apps but with multithreaded it fails since the PDOXUSRS.NET cannot be written to.

So, I plan to do the following automation in my app:

- Detect if running on UAC OS
- If so, programmatically alter the NET DIR setting in the idapi32.cfg file for Paradox tables
- Set the BDE Paradox NET DIR to the CSIDL_COMMON_DOCUMENTS or %PUBLIC% with the \Borland\BDE subfolder. The %PUBLIC% folder has write permission for all users by default so it is very suitable

As I see it I am merely "correcting" a problem with BDE on UAC and I am doing it for all potential users of BDE on the computers where my app is installed. I cannot see any problem with this but if anyone has any comments about this method please let me know, thanks!

Regards
Goran

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 20-Feb-2014, at 4:48 AM EST
From: Goran Ekstrom
 
Re: BDE, Paradox on UAC OS [Edit]  
News Group: embarcadero.public.bde.general
Well it seems no matter what I do I am at a loss. It doesn't matter if I re-direct BDE to a new directory that is write-enabled to all users, the .NET file that is created there is still owned by the User that created it so if another user starts the app, same problem with read-only.

Would skipping the .NET file location change (keeping at the default c:\) and instead change the .NET file security to write-permission for all users be a better approach?

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 20-Feb-2014, at 1:22 PM EST
From: Goran Ekstrom
 
Re: BDE, Paradox on UAC OS [Edit] [Edit]  
News Group: embarcadero.public.bde.general
> I think your problem is that you are still trying to use the old BDE 
> installer which defaults to C:\ for the NetDir...

I am using the latest MergeModule provided by Embarcadero.

I have had a quick look at your installer. I am using InstallAware 12 supplied with XE2, should I just add a Run statement to your installer? Before or after my app is installed (in IA12)?

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 24-Feb-2014, at 4:24 AM EST
From: Goran Ekstrom
 
Re: BDE, Paradox on UAC OS [Edit] [Edit]  
News Group: embarcadero.public.bde.general
> > I am using InstallAware 12
> > supplied with XE2, should I just add a Run statement to your installer?
> > Before or after my app is installed (in IA12)?
> 
> I should point out that the BDE licence states that only Installshield and
> Wise installers can be used with the BDE, not that I think Borland cares
> anymore.

Outdated license no doubt, Embarcadero is now offering InstallAware, they still have the BDE Mergemodule in the downloads and BDE is still in XEx.

> That aside...

One more thing. How do you "bypass" the BDE .NET file ownership/write blocking on UAC in your package? If I redirect the NET DIR location, isn't UAC file security still in play, i.e. if I run a BDE app on User A, wont User A get ownership of the .NET file and lock other users out just as I am having problems with right now?

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 27-Feb-2014, at 12:10 PM EST
From: Goran Ekstrom
 
Re: BDE, Paradox on UAC OS [Edit] [Edit]  
News Group: embarcadero.public.bde.general
> {quote:title=Leslie Milburn wrote:}{quote}
>  wrote:
> >
> > So, I plan to do the following automation in my app:
> >
> > - Detect if running on UAC OS
> 
> This is irrelevant as the netdir path could be set to a read only or 
> non-accessible location on Windows XP and will fail in the same manner.

Alreay noted, the default C:\ will fail on an XPSP3 aswell when running as non-admin user.

> > - If so, programmatically alter the NET DIR setting in the idapi32.cfg 
> > file for Paradox tables
> No, you should not do this because it will affect all other BDE/Paradox 
> applications on the machine.

Isn't the idapi32.cfg file only read once at app-start, i.e. any running BDE app will not be affected and any starting app will be happy to use the new location? I am assuming that if you have any more complicated setup such as network you specify your own NET DIR in the APP anyway and the default location isn't that important.

> A better method is to open a new session and for that session set the Net 
> Dir location - this should be done at runtime not install time. This means 
> that only that session will use that Net Dir - no impact on anyone else.

This is what I do:

	SpeakerListThreadTableSession = new TSession(0);
	SpeakerListThreadTableSession->NetFileDir = MainForm->DataBaseNetFileDirectory;
	SpeakerListThreadTableSession->PrivateDir = SpeakerListThreadTableSessionPrivateDir;
	SpeakerListThreadTableSession->SessionName = "SpeakerListThreadTable";
	SpeakerListThreadTableSession->Active = true;

	SpeakerListThreadTable = new TTable(0);
	SpeakerListThreadTable->DatabaseName = MainForm->DataBaseConfigurationDirectory;
	SpeakerListThreadTable->TableType = ttParadox;
	SpeakerListThreadTable->TableName = "SpeakerList.db";
	SpeakerListThreadTable->IndexName = "byEntryOrderNumber";
	SpeakerListThreadTable->SessionName = SpeakerListThreadTableSession->SessionName;
	SpeakerListThreadTable->Exclusive = false;

	SpeakerListThreadTable->EmptyTable();
	SpeakerListThreadTable->Active = true;

I set the NETDIR directory, my app uses my specific NETDIR directory when it eventually is running but regardless, BDE needs to access the "default" .NET file for some reason when the app starts and it fails to start with an exception if it is located in a read-only folder such as C:\.

> Having said that when the BDE is installed for the first time there is no 
> reason why it cannot set the default netdir location to say C:\BDE\NetDir - 
> see below. Really after that time the default location should not be meddled 
> with.

That is really my assumption, that it can be "my" location hust as well as c:\

> > As I see it I am merely "correcting" a problem with BDE on UAC and I am 
> > doing it for all potential users of BDE on the computers where my app is 
> > installed. I cannot see any problem with this but if anyone has any 
> > comments about this method please let me know, thanks!
> Sure but you need to consider other BDE applications that are on the 
> machine. The BDE itself has no problem with UAC it is the default 
> installation settings that do. Do not forget that out of the box the BDE 
> uses the registry to store all settings and not the cfg file which means 
> that registry permissions also come into play.
> Change all of those and you will be fine.

In my case it is only the write persmission to the .NET file location that is the problem. I use the DbiInit, DbiOpenCfgInfoList, DbiSetToBegin, DbiGetNextRecord, etc. functions to alter the BDE NET DIR setting which works fine and it is the idapi32.cfg file that updates with the new NET DIR path.

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 20-Feb-2014, at 2:09 PM EST
From: Goran Ekstrom
 
Re: BDE, Paradox on UAC OS [Edit] [Edit] [Edit]  
News Group: embarcadero.public.bde.general
> For our last remaining BDE application here is what we do:...

When is BDE actually "started" in the app? Is it before Main is called?  Do you override the default "BDE Init" in the app, or where do you place this code?

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 24-Feb-2014, at 4:34 AM EST
From: Goran Ekstrom
 
Re: BDE, Paradox on UAC OS [Edit]  
News Group: embarcadero.public.bde.general
Hi again Leslie,
I now have what I think is a working solution, what do you think of this:

During installation I check if the BDE NET DIR setting points to a directory called BDE_NETDIR. If not, this new directory is created with full access rights for Admins, Authenticated Users and Guests but not Anonymous users. The new directory is created in the Windows "Allusers->Application Data" (actual path read from OS) folder as "Borland\BDE_NETDIR".

All seem to work now, admins, regular and guest users can run the app. I know I do not adress the other BDE issues but my DB requirements are small and I let other app installers such as yours handle that if they require it.

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 11-Mar-2014, at 12:42 PM EST
From: Goran Ekstrom
 
Re: BDE, Paradox on UAC OS [Edit] [Edit] [Edit] [Edit]  
News Group: embarcadero.public.bde.general
> > When is BDE actually "started" in the app? Is it before Main is called? 
> > Do you override the default "BDE Init" in the app, or where do you place 
> > this code?
> 
> In WinMain() - almost immediately.

Forgot to mention I am doing VCL-apps so "WinMain" is out of sight for me, ... or did I miss something? I've never had the need to learn this low level BDE "stuff" since I use the VCL DataModule.

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 27-Feb-2014, at 12:11 PM EST
From: Goran Ekstrom
 
Re: BDE, Paradox on UAC OS [Edit] [Edit]  
News Group: embarcadero.public.bde.general
> By placing the default netdir in a location accessible by all users...

Thanks Leslie, I now have a few suggestions to test, I'll be back when I have some results.

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 4-Mar-2014, at 9:13 AM EST
From: Goran Ekstrom