#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2002
    Posts
    86
    Rep Power
    13

    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.

    Thank you!

    Greg
    Last edited by dlumley; July 17th, 2012 at 02:06 PM.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2008
    Posts
    356
    Rep Power
    7
    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 02:56 PM.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2006
    Location
    Carlsbad, CA
    Posts
    2,057
    Rep Power
    383
    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.

    Clive
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2008
    Posts
    356
    Rep Power
    7
    Hi Clive,

    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.


    Greg,

    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..
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2002
    Posts
    86
    Rep Power
    13

    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
    Hi Clive,

    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.


    Greg,

    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..
    Last edited by dlumley; July 17th, 2012 at 03:31 PM.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2008
    Posts
    356
    Rep Power
    7
    Greg,

    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.
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2002
    Posts
    86
    Rep Power
    13

    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...

    Greg.


    Originally Posted by majlumbo
    Greg,

    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.

IMN logo majestic logo threadwatch logo seochat tools logo