Initial community commit
This commit is contained in:
parent
537bcbc862
commit
fc06254474
16440 changed files with 4239995 additions and 2 deletions
31
Src/Plugins/Library/ml_local/remove.cpp
Normal file
31
Src/Plugins/Library/ml_local/remove.cpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
#include "main.h"
|
||||
#include "api_mldb.h"
|
||||
|
||||
// returns 0 on success
|
||||
// returns 1 on failure of either bad filename or invalid table
|
||||
int RemoveFileFromDB(const wchar_t *filename)
|
||||
{
|
||||
// From mldbApi
|
||||
int ret = 1;
|
||||
if (!g_table) openDb();
|
||||
if (filename && g_table)
|
||||
{
|
||||
// Issue wasabi callback for pre removal
|
||||
WASABI_API_SYSCB->syscb_issueCallback(api_mldb::SYSCALLBACK, api_mldb::MLDB_FILE_REMOVED_PRE, (size_t)filename, 0);
|
||||
EnterCriticalSection(&g_db_cs);
|
||||
|
||||
nde_scanner_t s = NDE_Table_CreateScanner(g_table);
|
||||
if (NDE_Scanner_LocateFilename(s, MAINTABLE_ID_FILENAME, FIRST_RECORD, filename))
|
||||
{
|
||||
NDE_Scanner_Delete(s);
|
||||
NDE_Scanner_Post(s);
|
||||
g_table_dirty++;
|
||||
ret = 0;
|
||||
}
|
||||
NDE_Table_DestroyScanner(g_table, s);
|
||||
LeaveCriticalSection(&g_db_cs);
|
||||
// Issue wasabi callback for post removal
|
||||
WASABI_API_SYSCB->syscb_issueCallback(api_mldb::SYSCALLBACK, api_mldb::MLDB_FILE_REMOVED_POST, (size_t)filename, 0);
|
||||
}
|
||||
return ret;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue