You are not logged in.
Pages: 1
I need to change header and have question
I know change is needed also in .pas but wonder about c sources.
Is this enough to change
define SQLITE_FILE_HEADER "SQLite format 3"
in sqlite3.c?
I'm asking becasue
I have found hardcoded strings with "SQLite format 3" in two places in shell.c
....
static int apndIsOrdinaryDatabaseFile(sqlite3_int64 sz, sqlite3_file *pFile){
int rc;
char zHdr[16];
static const char aSqliteHdr[] = "SQLite format 3";
if( sz<512 ) return 0;
rc = pFile->pMethods->xRead(pFile, zHdr, sizeof(zHdr), 0);
if( rc ) return 0;
return memcmp(zHdr, aSqliteHdr, sizeof(zHdr))==0;
}
.....
n = fread(zBuf, 16, 1, f);
if( n==1 && memcmp(zBuf, "SQLite format 3", 16)==0 ){
fclose(f);
return SHELL_OPEN_NORMAL;
Last edited by Greg0r (2019-03-09 15:13:14)
Offline
This is not a question for mORMot itself, but more a Sqlite3 question.
SQLITE_FILE_HEADER is indeed hardcoded in SQlite3 sources.
And documented as such.
See https://www.sqlite.org/fileformat.html# … ase_header
But IIRC you can customize this first 16 bytes to whatever values you expect.
Some editors may refuse to open the file (as our SynDBExplorer), but others may allow to open it, since sqlite3_open() should work even without the signature.
In my opinion, there is NO benefit of obfuscating those magic bytes. More potential pain than gain.
Online
Thanks
Offline
Pages: 1