July 17th, 2012, 12:57 PM
Please help "access violation" permissions problem I think...
I have an app using a SQLite database -
Database installs to: %appdata%
Application installs to: Program Files (x86) directory....
When run the program I get the following error:
"Access violation at address 74971A8B in module ntdll.dll Write of address"
If I move the program files to the %appdata% directory, it runs perfectly...
I have double checked that the database path is correct in the program and if I run the program on the development machine it works perfectly (of course it does)
It seems as though the program cannot "control" the database from program files %appdata% directory....
I really don't now how to solve this I've tried changing permissions but with no success....
Please assist if you know how.
Last edited by dlumley; July 17th, 2012 at 01:06 PM.
July 17th, 2012, 01:30 PM
Since the application works when you copy the application to the %appdata% directory with the database, then there are probably DLL file(s) located there that your application needs. More than likely, %appdata% is not on your path (nor should it be), causing the problem.
Ensure the DLL files are located in your program directory, the system32 directory, or somewhere else on your path.
Last edited by majlumbo; July 17th, 2012 at 01:56 PM.
July 17th, 2012, 01:59 PM
Like majlumbo I have not worked with SQLite (although I am considering it for a small app).
However, if it does require any additional DLLs their location might need to be on the PATH environment
and they might need registering (with regsvr32).
Just general thoughts from experience.
Not based upon specific knowledge I am afraid.
July 17th, 2012, 02:06 PM
I agree that it may be a requirement to register support DLLs, however, my (albeit limited) research turned up that SQLite does not actually have to be installed on a system for it to work, which tends to imply that any support DLL would not have to be registered.
One thing you do want to avoid is having the DLL in more than one place though. Having it in %appdata% and in your program directory and/or etc... would only lead to confusion as to which one your application is actually using..
July 17th, 2012, 02:28 PM
Could be a bug in the wrapper
Hi guys, thank you so much for your help... I appreciate it!
Very strange behaviour... I think it's a bug in the SQLite wrapper I'm using... (I think, my programming ability is not the worst I've seen but it's not by any means what it should be)
In case you are wondering (http://www.itwriting.com/sqlitesimple.php)
Realizing that it could be a permissions problem I manually enabled full control on the Installation Directory
It immediately creates a "blank" database then gives a "table not found" error, I also tried moving the SQLlite3.dll to the system directory which did not work, it did work in the SYSwow directory though... it's as though the app is purposefully "ignoring" data folder for some reason.
I even have a If FileExists check which passes....
I have double and triple checked that I'm linking to the correct appdata folder and I am...
Sooooo frustrating, I have a working app and now because of this I've spent hours and hours trying to figure out what the problem is and I'm stumped! ... I guess that's programming....
This could easily be avoided if I could simply leave the database in the app folder and enable full permissons on it... I can't understand half the time why MS UAC needs to be so damn restrictive!
Originally Posted by majlumbo
Last edited by dlumley; July 17th, 2012 at 02:31 PM.
July 17th, 2012, 02:45 PM
Your application has little control on loading the SQLite.DLL file. This is accomplished by the operating system. My understanding is that the OS will First look in the application directory, then go down 1 by 1 all the directories in your "path" environment variable. If it doesn't find it in any of those locations, it gives up. Bottom line is, doing a FileExists() from within your application to see if it's in the directory you expect doesn't help the OS find the DLL.
You just have to make sure the DLL is in your program directory, or in one of the directories on your path. I'd suggest putting it into your program directory since that way you would not have to edit your user's path environment variable on his target machine.
July 17th, 2012, 03:25 PM
Found it!!!! And the culprit is... -->ME<--
I haaaaaaaaate to admit this but it was my fault! I had a function calling the db right in the beginning that I was looking past! Such a stupid, stupid mistake....
Because it was kicking out an error so quickly I assumed it was not "seeing" the db everywhere else... this is because I did not setup a public connection variable to start off with! a lesson learned the hard way!
It did not help that the SQLlite wrapper was automatically creating a db in the root folder because that meant all kinds of misleading (for me anyway) theories on what the problem was....
Thank you so much for taking the time to try and assist...
Originally Posted by majlumbo