Thread: Embedded file (C++ and SQL)

  1. #1
    Registered User
    Join Date
    Nov 2005
    Location
    Canada
    Posts
    80

    Embedded file (C++ and SQL)

    I have an exe file (my.exe) that needs to be protected from unauthorized users. I want to embed this file within a wrapper file so the user runs the latter instead of the actual executable. When this happens:

    - the user is prompted for username/pass (non-GUI)
    - the combination is compared to the entries within an external sql db
    - if match, then run my.exe, else exit

    I think what gives me difficulty is implementing the sql commands within C++. Is CQL++ useful? I know I may need to install a new lib but which lib is suitable/easy to use? I also don't have a clue on how to embed the executable within the wrapper... I have done plenty of research but I am still in confusion.

    Any help is greatly appreciated.

  2. #2
    Registered User
    Join Date
    Jan 2006
    Location
    Europe/Belgrade
    Posts
    78
    If you use SQL, does it mean that you have some database server? Then you should utilise some C/C++ library for connecting and executing queries on the database server. This library is probably part of the database distribution.

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,412
    If you want an embedded database engine, you might want to check out SQLite. The author provides a proprietary extension for encrypted databases.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Registered User
    Join Date
    Nov 2005
    Location
    Canada
    Posts
    80
    right, thanks. How would I embed this file anyway? If resource files are what i need to use, then can you give me an example on how to create a .rtc file? I have looked all over the 'net, searching for "c++ resource files" but nothing helpful.
    Last edited by Opel_Corsa; 12-11-2006 at 01:32 AM.

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    You do realise that unless you encrypt the embedded exe and obtain a decryption key from an external database server, what you're doing is completely useless, right?
    And even if you encrypt it, it would still be trivial to intercept the decryption key you receive.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed