Index: System.Data.SQLite/SQLite3.cs ================================================================== --- System.Data.SQLite/SQLite3.cs +++ System.Data.SQLite/SQLite3.cs @@ -871,28 +871,12 @@ internal override string GetFileName(string dbName) { if (_sql == null) return null; - IntPtr pDbName = IntPtr.Zero; - - try - { - pDbName = (dbName != null) ? - SQLiteString.Utf8IntPtrFromString(dbName) : IntPtr.Zero; - - return UTF8ToString(UnsafeNativeMethods.sqlite3_db_filename( - _sql, pDbName), -1); - } - finally - { - if (pDbName != IntPtr.Zero) - { - SQLiteMemory.Free(pDbName); - pDbName = IntPtr.Zero; - } - } + return UTF8ToString(UnsafeNativeMethods.sqlite3_db_filename_bytes( + _sql, ToUTF8(dbName)), -1); } internal override void Open(string strFilename, string vfsName, SQLiteConnectionFlags connectionFlags, SQLiteOpenFlagsEnum openFlags, int maxPoolSize, bool usePool) { // Index: System.Data.SQLite/UnsafeNativeMethods.cs ================================================================== --- System.Data.SQLite/UnsafeNativeMethods.cs +++ System.Data.SQLite/UnsafeNativeMethods.cs @@ -2291,10 +2291,17 @@ #else [DllImport(SQLITE_DLL)] #endif internal static extern IntPtr sqlite3_db_filename(IntPtr db, IntPtr dbName); +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_db_filename", CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_db_filename")] +#endif + internal static extern IntPtr sqlite3_db_filename_bytes(IntPtr db, byte[] dbName); + #if !PLATFORM_COMPACTFRAMEWORK [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] #else [DllImport(SQLITE_DLL)] #endif