diff options
Diffstat (limited to 'db3x_autobackups')
-rw-r--r-- | db3x_autobackups/database.c | 2 | ||||
-rw-r--r-- | db3x_autobackups/db3x_8.sln | 13 | ||||
-rw-r--r-- | db3x_autobackups/db3x_8.vcproj | 271 | ||||
-rw-r--r-- | db3x_autobackups/dbcontacts.c | 94 | ||||
-rw-r--r-- | db3x_autobackups/dbevents.c | 30 | ||||
-rw-r--r-- | db3x_autobackups/dbsettings.c | 30 | ||||
-rw-r--r-- | db3x_autobackups/init.c | 45 |
7 files changed, 373 insertions, 112 deletions
diff --git a/db3x_autobackups/database.c b/db3x_autobackups/database.c index 2d815dc..703fefa 100644 --- a/db3x_autobackups/database.c +++ b/db3x_autobackups/database.c @@ -143,7 +143,7 @@ int LoadDatabaseModule(void) log0("DB logging running"); { DWORD dummy=0; - hDbFile=CreateFile(szDbPath,GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, 0, NULL); + hDbFile=CreateFile(szDbPath,GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, 0, NULL); if ( hDbFile == INVALID_HANDLE_VALUE ) { return 1; } diff --git a/db3x_autobackups/db3x_8.sln b/db3x_autobackups/db3x_8.sln index a033a41..5cd7ec0 100644 --- a/db3x_autobackups/db3x_8.sln +++ b/db3x_autobackups/db3x_8.sln @@ -5,15 +5,18 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "db3x", "db3x_8.vcproj", "{8 EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug Unicode|Win32 = Debug Unicode|Win32
Debug|Win32 = Debug|Win32
- Release (RECLAIM)|Win32 = Release (RECLAIM)|Win32
+ Release Unicode|Win32 = Release Unicode|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {8B778B6A-F5EF-49A4-8437-424832F2B280}.Debug|Win32.ActiveCfg = Release|Win32
- {8B778B6A-F5EF-49A4-8437-424832F2B280}.Debug|Win32.Build.0 = Release|Win32
- {8B778B6A-F5EF-49A4-8437-424832F2B280}.Release (RECLAIM)|Win32.ActiveCfg = Release (RECLAIM)|Win32
- {8B778B6A-F5EF-49A4-8437-424832F2B280}.Release (RECLAIM)|Win32.Build.0 = Release (RECLAIM)|Win32
+ {8B778B6A-F5EF-49A4-8437-424832F2B280}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32
+ {8B778B6A-F5EF-49A4-8437-424832F2B280}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32
+ {8B778B6A-F5EF-49A4-8437-424832F2B280}.Debug|Win32.ActiveCfg = Debug|Win32
+ {8B778B6A-F5EF-49A4-8437-424832F2B280}.Debug|Win32.Build.0 = Debug|Win32
+ {8B778B6A-F5EF-49A4-8437-424832F2B280}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32
+ {8B778B6A-F5EF-49A4-8437-424832F2B280}.Release Unicode|Win32.Build.0 = Release Unicode|Win32
{8B778B6A-F5EF-49A4-8437-424832F2B280}.Release|Win32.ActiveCfg = Release|Win32
{8B778B6A-F5EF-49A4-8437-424832F2B280}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
diff --git a/db3x_autobackups/db3x_8.vcproj b/db3x_autobackups/db3x_8.vcproj index 88639d2..03ee817 100644 --- a/db3x_autobackups/db3x_8.vcproj +++ b/db3x_autobackups/db3x_8.vcproj @@ -16,8 +16,8 @@ <Configurations>
<Configuration
Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)/Plugins"
+ IntermediateDirectory="$(SolutionDir)$(ConfigurationName)/Obj/$(ProjectName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
@@ -50,6 +50,7 @@ Optimization="0"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DB3X_EXPORTS"
+ ExceptionHandling="0"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
@@ -73,7 +74,7 @@ />
<Tool
Name="VCLinkerTool"
- OutputFile="../../bin/$(ConfigurationName)/Plugins/dbx_3x.dll"
+ OutputFile="$(OutDir)/dbx_3x.dll"
LinkIncremental="0"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
@@ -103,12 +104,13 @@ />
<Tool
Name="VCPostBuildEventTool"
+ CommandLine="sync.bat"
/>
</Configuration>
<Configuration
Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)/Plugins"
+ IntermediateDirectory="$(SolutionDir)$(ConfigurationName)/Obj/$(ProjectName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
@@ -148,7 +150,7 @@ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DB3X_EXPORTS"
StringPooling="true"
ExceptionHandling="0"
- RuntimeLibrary="0"
+ RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="commonheaders.h"
@@ -174,7 +176,7 @@ <Tool
Name="VCLinkerTool"
IgnoreImportLibrary="true"
- OutputFile="../../bin/$(ConfigurationName)/Plugins/dbx_3x.dll"
+ OutputFile="$(OutDir)/dbx_3x.dll"
LinkIncremental="0"
SuppressStartupBanner="true"
AdditionalManifestDependencies="type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df' language='*'"
@@ -211,12 +213,106 @@ />
<Tool
Name="VCPostBuildEventTool"
+ CommandLine="sync.bat"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)/Plugins"
+ IntermediateDirectory="$(SolutionDir)$(ConfigurationName)/Obj/$(ProjectName)"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/db3x.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DB3X_EXPORTS"
+ ExceptionHandling="0"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="commonheaders.h"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ CompileAs="0"
+ DisableSpecificWarnings="4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/dbx_3x.dll"
+ LinkIncremental="0"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ ImportLibrary="$(IntDir)/$(TargetName).lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="sync.bat"
/>
</Configuration>
<Configuration
- Name="Release (RECLAIM)|Win32"
- OutputDirectory="$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
+ Name="Release Unicode|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)/Plugins"
+ IntermediateDirectory="$(SolutionDir)$(ConfigurationName)/Obj/$(ProjectName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
@@ -253,10 +349,10 @@ OmitFramePointers="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="../../include"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DB3X_EXPORTS;DB_RECLAIM"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DB3X_EXPORTS"
StringPooling="true"
ExceptionHandling="0"
- RuntimeLibrary="0"
+ RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="commonheaders.h"
@@ -282,7 +378,7 @@ <Tool
Name="VCLinkerTool"
IgnoreImportLibrary="true"
- OutputFile="../../bin/$(ConfigurationName)/Plugins/dbx_3x_reclaim.dll"
+ OutputFile="$(OutDir)/dbx_3x.dll"
LinkIncremental="0"
SuppressStartupBanner="true"
AdditionalManifestDependencies="type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df' language='*'"
@@ -319,6 +415,7 @@ />
<Tool
Name="VCPostBuildEventTool"
+ CommandLine="sync.bat"
/>
</Configuration>
</Configurations>
@@ -361,7 +458,19 @@ />
</FileConfiguration>
<FileConfiguration
- Name="Release (RECLAIM)|Win32"
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;DB3X_EXPORTS;$(NoInherit)"
+ BasicRuntimeChecks="3"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -400,7 +509,18 @@ />
</FileConfiguration>
<FileConfiguration
- Name="Release (RECLAIM)|Win32"
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;DB3X_EXPORTS;$(NoInherit)"
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -439,7 +559,18 @@ />
</FileConfiguration>
<FileConfiguration
- Name="Release (RECLAIM)|Win32"
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;DB3X_EXPORTS;$(NoInherit)"
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -478,7 +609,18 @@ />
</FileConfiguration>
<FileConfiguration
- Name="Release (RECLAIM)|Win32"
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;DB3X_EXPORTS;$(NoInherit)"
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -517,7 +659,18 @@ />
</FileConfiguration>
<FileConfiguration
- Name="Release (RECLAIM)|Win32"
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;DB3X_EXPORTS;$(NoInherit)"
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -556,7 +709,18 @@ />
</FileConfiguration>
<FileConfiguration
- Name="Release (RECLAIM)|Win32"
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;DB3X_EXPORTS;$(NoInherit)"
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -595,7 +759,18 @@ />
</FileConfiguration>
<FileConfiguration
- Name="Release (RECLAIM)|Win32"
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;DB3X_EXPORTS;$(NoInherit)"
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -634,7 +809,18 @@ />
</FileConfiguration>
<FileConfiguration
- Name="Release (RECLAIM)|Win32"
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;DB3X_EXPORTS;$(NoInherit)"
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -673,7 +859,18 @@ />
</FileConfiguration>
<FileConfiguration
- Name="Release (RECLAIM)|Win32"
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;DB3X_EXPORTS;$(NoInherit)"
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -712,7 +909,18 @@ />
</FileConfiguration>
<FileConfiguration
- Name="Release (RECLAIM)|Win32"
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;DB3X_EXPORTS;$(NoInherit)"
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -755,7 +963,18 @@ />
</FileConfiguration>
<FileConfiguration
- Name="Release (RECLAIM)|Win32"
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;DB3X_EXPORTS;$(NoInherit)"
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -788,10 +1007,6 @@ RelativePath=".\options.h"
>
</File>
- <File
- RelativePath=".\resource.h"
- >
- </File>
</Filter>
<Filter
Name="Resource Files"
diff --git a/db3x_autobackups/dbcontacts.c b/db3x_autobackups/dbcontacts.c index 2a8d038..5985590 100644 --- a/db3x_autobackups/dbcontacts.c +++ b/db3x_autobackups/dbcontacts.c @@ -2,8 +2,8 @@ Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2003 Miranda ICQ/IM project,
-all portions of this codebase are copyrighted to the people
+Copyright 2000-2003 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
listed in contributors.txt.
This program is free software; you can redistribute it and/or
@@ -55,56 +55,86 @@ void UninitContacts(void) {
}
+int GetContactSettingStatic(WPARAM wParam,LPARAM lParam);
+
static int GetContactCount(WPARAM wParam,LPARAM lParam)
{
int ret;
-
+
EnterCriticalSection(&csDbAccess);
ret=dbHeader.contactCount;
LeaveCriticalSection(&csDbAccess);
return ret;
}
+#define proto_module "Protocol"
+#define proto_setting "p"
+
+static int CheckProto(HANDLE hContact, const char *proto)
+{
+ static char protobuf[MAX_PATH] = {0};
+ static DBVARIANT dbv;
+ static DBCONTACTGETSETTING sVal = {proto_module,proto_setting,&dbv};
+
+ dbv.type = DBVT_ASCIIZ;
+ dbv.pszVal = protobuf;
+ dbv.cchVal = sizeof(protobuf);
+
+ if (GetContactSettingStatic((WPARAM)hContact, (LPARAM )&sVal) != 0
+ || (dbv.type != DBVT_ASCIIZ)) return 0;
+
+ return !strcmp(protobuf,proto);
+}
+
static int FindFirstContact(WPARAM wParam,LPARAM lParam)
{
int ret = 0;
EnterCriticalSection(&csDbAccess);
ret = (int)(HANDLE)dbHeader.ofsFirstContact;
+ if (lParam && !CheckProto((HANDLE)ret,(const char*)lParam))
+ ret = FindNextContact((WPARAM)ret,lParam);
LeaveCriticalSection(&csDbAccess);
return ret;
}
static int FindNextContact(WPARAM wParam,LPARAM lParam)
{
- int ret, index;
+ int index;
struct DBContact *dbc;
- DBCachedContactValueList *VL = NULL;
-
+ DBCachedContactValueList VLtemp, *VL = NULL;
+ VLtemp.hContact = (HANDLE)wParam;
EnterCriticalSection(&csDbAccess);
- {
- DBCachedContactValueList VLtemp;
- VLtemp.hContact = (HANDLE)wParam;
+ while ( VLtemp.hContact ) {
if ( li.List_GetIndex(&lContacts,&VLtemp,&index)) {
VL = ( DBCachedContactValueList* )lContacts.items[index];
- if ( VL->hNext != NULL ) {
+ if (VL->hNext != NULL) {
+ if (!lParam || CheckProto(VL->hNext,(const char*)lParam)) {
+ LeaveCriticalSection(&csDbAccess);
+ return (int)VL->hNext;
+ }
+
+ VLtemp.hContact = VL->hNext;
+ continue;
+ } }
+
+ dbc=(struct DBContact*)DBRead((DWORD)VLtemp.hContact,sizeof(struct DBContact),NULL);
+ if (dbc->signature!=DBCONTACT_SIGNATURE)
+ break;
+ else {
+ if ( VL == NULL ) {
+ VL = (DBCachedContactValueList*)HeapAlloc(hCacheHeap,HEAP_ZERO_MEMORY,sizeof(DBCachedContactValueList));
+ VL->hContact = VLtemp.hContact;
+ li.List_Insert(&lContacts,VL,index);
+ }
+ VL->hNext = (HANDLE)dbc->ofsNext;
+ if (VL->hNext != NULL && (!lParam || CheckProto(VL->hNext,(const char*)lParam))) {
LeaveCriticalSection(&csDbAccess);
return (int)VL->hNext;
- } } }
-
- dbc=(struct DBContact*)DBRead(wParam,sizeof(struct DBContact),NULL);
- if(dbc->signature!=DBCONTACT_SIGNATURE)
- ret=(int)(HANDLE)NULL;
- else {
- if ( VL == NULL ) {
- VL = (DBCachedContactValueList*)HeapAlloc(hCacheHeap,HEAP_NO_SERIALIZE+HEAP_ZERO_MEMORY,sizeof(DBCachedContactValueList));
- VL->hContact = (HANDLE)wParam;
- li.List_Insert(&lContacts,VL,index);
- }
- VL->hNext = (HANDLE)dbc->ofsNext;
- ret=(int)(HANDLE)dbc->ofsNext;
- }
+ }
+ VLtemp.hContact = VL->hNext;
+ } }
LeaveCriticalSection(&csDbAccess);
- return ret;
+ return 0;
}
static int DeleteContact(WPARAM wParam,LPARAM lParam)
@@ -114,7 +144,7 @@ static int DeleteContact(WPARAM wParam,LPARAM lParam) struct DBContactSettings *dbcs;
struct DBEvent *dbe;
int index;
-
+
if((HANDLE)wParam==NULL) return 1;
EnterCriticalSection(&csDbAccess);
dbc=(struct DBContact*)DBRead(wParam,sizeof(struct DBContact),NULL);
@@ -143,11 +173,11 @@ static int DeleteContact(WPARAM wParam,LPARAM lParam) while ( V != NULL ) {
DBCachedContactValue* V1 = V->next;
if ( V->value.type == DBVT_ASCIIZ )
- HeapFree( hCacheHeap, HEAP_NO_SERIALIZE, V->value.pszVal );
- HeapFree( hCacheHeap, HEAP_NO_SERIALIZE, V );
+ HeapFree( hCacheHeap, 0, V->value.pszVal );
+ HeapFree( hCacheHeap, 0, V );
V = V1;
}
- HeapFree( hCacheHeap, HEAP_NO_SERIALIZE, VL );
+ HeapFree( hCacheHeap, 0, VL );
li.List_Remove(&lContacts,index);
} }
@@ -230,7 +260,7 @@ static int AddContact(WPARAM wParam,LPARAM lParam) { int index;
- DBCachedContactValueList *VL = (DBCachedContactValueList*)HeapAlloc(hCacheHeap,HEAP_NO_SERIALIZE+HEAP_ZERO_MEMORY,sizeof(DBCachedContactValueList));
+ DBCachedContactValueList *VL = (DBCachedContactValueList*)HeapAlloc(hCacheHeap,HEAP_ZERO_MEMORY,sizeof(DBCachedContactValueList));
VL->hContact = (HANDLE)ofsNew;
li.List_GetIndex(&lContacts,VL,&index);
@@ -240,7 +270,7 @@ static int AddContact(WPARAM wParam,LPARAM lParam) LeaveCriticalSection(&csDbAccess);
NotifyEventHooks(hContactAddedEvent,(WPARAM)ofsNew,0);
return (int)ofsNew;
-}
+}
static int IsDbContact(WPARAM wParam,LPARAM lParam)
{
@@ -260,7 +290,7 @@ static int IsDbContact(WPARAM wParam,LPARAM lParam) ret=dbc.signature==DBCONTACT_SIGNATURE;
if (ret) {
- VL = (DBCachedContactValueList*)HeapAlloc(hCacheHeap,HEAP_NO_SERIALIZE+HEAP_ZERO_MEMORY,sizeof(DBCachedContactValueList));
+ VL = (DBCachedContactValueList*)HeapAlloc(hCacheHeap,HEAP_ZERO_MEMORY,sizeof(DBCachedContactValueList));
VL->hContact = (HANDLE)wParam;
li.List_Insert(&lContacts,VL,index);
} } }
diff --git a/db3x_autobackups/dbevents.c b/db3x_autobackups/dbevents.c index e0f7c02..b45cee4 100644 --- a/db3x_autobackups/dbevents.c +++ b/db3x_autobackups/dbevents.c @@ -2,8 +2,8 @@ Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2003 Miranda ICQ/IM project,
-all portions of this codebase are copyrighted to the people
+Copyright 2000-2003 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
listed in contributors.txt.
This program is free software; you can redistribute it and/or
@@ -74,7 +74,7 @@ static int GetEventCount(WPARAM wParam,LPARAM lParam) {
int ret;
struct DBContact *dbc;
-
+
EnterCriticalSection(&csDbAccess);
if(wParam==0) wParam=dbHeader.ofsUser;
dbc=(struct DBContact*)DBRead(wParam,sizeof(struct DBContact),NULL);
@@ -182,7 +182,7 @@ static int DeleteEvent(WPARAM wParam,LPARAM lParam) struct DBContact dbc;
DWORD ofsContact,ofsThis;
struct DBEvent dbe,*dbeNext,*dbePrev;
-
+
EnterCriticalSection(&csDbAccess);
if(wParam==0) ofsContact=dbHeader.ofsUser;
else ofsContact=wParam;
@@ -262,7 +262,7 @@ static int GetBlobSize(WPARAM wParam,LPARAM lParam) {
int ret;
struct DBEvent *dbe;
-
+
EnterCriticalSection(&csDbAccess);
dbe=(struct DBEvent*)DBRead(wParam,sizeof(struct DBEvent),NULL);
if(dbe->signature!=DBEVENT_SIGNATURE) ret=-1;
@@ -276,8 +276,12 @@ static int GetEvent(WPARAM wParam,LPARAM lParam) struct DBEvent *dbe;
DBEVENTINFO *dbei=(DBEVENTINFO*)lParam;
int bytesToCopy,i;
-
+
if(dbei==NULL||dbei->cbSize!=sizeof(DBEVENTINFO)) return 1;
+ if(dbei->cbBlob > 0 && dbei->pBlob == NULL) {
+ dbei->cbBlob = 0;
+ return 1;
+ }
EnterCriticalSection(&csDbAccess);
dbe=(struct DBEvent*)DBRead(wParam,sizeof(struct DBEvent),NULL);
if(dbe->signature!=DBEVENT_SIGNATURE) {
@@ -312,7 +316,7 @@ static int MarkEventRead(WPARAM wParam,LPARAM lParam) struct DBEvent *dbe;
struct DBContact dbc;
DWORD ofsThis;
-
+
EnterCriticalSection(&csDbAccess);
if(wParam==0) wParam=dbHeader.ofsUser;
dbc=*(struct DBContact*)DBRead(wParam,sizeof(struct DBContact),NULL);
@@ -356,7 +360,7 @@ static int GetEventContact(WPARAM wParam,LPARAM lParam) {
int ret;
struct DBEvent *dbe;
-
+
EnterCriticalSection(&csDbAccess);
dbe=(struct DBEvent*)DBRead(wParam,sizeof(struct DBEvent),NULL);
if(dbe->signature!=DBEVENT_SIGNATURE) {
@@ -374,7 +378,7 @@ static int FindFirstEvent(WPARAM wParam,LPARAM lParam) {
int ret;
struct DBContact *dbc;
-
+
EnterCriticalSection(&csDbAccess);
if(wParam==0) wParam=dbHeader.ofsUser;
dbc=(struct DBContact*)DBRead(wParam,sizeof(struct DBContact),NULL);
@@ -388,7 +392,7 @@ static int FindFirstUnreadEvent(WPARAM wParam,LPARAM lParam) {
int ret;
struct DBContact *dbc;
-
+
EnterCriticalSection(&csDbAccess);
if(wParam==0) wParam=dbHeader.ofsUser;
dbc=(struct DBContact*)DBRead(wParam,sizeof(struct DBContact),NULL);
@@ -402,7 +406,7 @@ static int FindLastEvent(WPARAM wParam,LPARAM lParam) {
int ret;
struct DBContact *dbc;
-
+
EnterCriticalSection(&csDbAccess);
if(wParam==0) wParam=dbHeader.ofsUser;
dbc=(struct DBContact*)DBRead(wParam,sizeof(struct DBContact),NULL);
@@ -416,7 +420,7 @@ static int FindNextEvent(WPARAM wParam,LPARAM lParam) {
int ret;
struct DBEvent *dbe;
-
+
EnterCriticalSection(&csDbAccess);
dbe=(struct DBEvent*)DBRead(wParam,sizeof(struct DBEvent),NULL);
if(dbe->signature!=DBEVENT_SIGNATURE) ret=(int)(HANDLE)NULL;
@@ -429,7 +433,7 @@ static int FindPrevEvent(WPARAM wParam,LPARAM lParam) {
int ret;
struct DBEvent *dbe;
-
+
EnterCriticalSection(&csDbAccess);
dbe=(struct DBEvent*)DBRead(wParam,sizeof(struct DBEvent),NULL);
if(dbe->signature!=DBEVENT_SIGNATURE) ret=(int)(HANDLE)NULL;
diff --git a/db3x_autobackups/dbsettings.c b/db3x_autobackups/dbsettings.c index 3c40277..503a5eb 100644 --- a/db3x_autobackups/dbsettings.c +++ b/db3x_autobackups/dbsettings.c @@ -92,7 +92,7 @@ static DWORD __inline GetSettingValueLength(PBYTE pSetting) static char* InsertCachedSetting( const char* szName, size_t cbNameLen, int index )
{
- char* newValue = (char*)HeapAlloc( hCacheHeap, HEAP_NO_SERIALIZE, cbNameLen );
+ char* newValue = (char*)HeapAlloc( hCacheHeap, 0, cbNameLen );
*newValue = 0;
strcpy(newValue+1,szName+1);
li.List_Insert(&lSettings,newValue,index);
@@ -121,9 +121,9 @@ static void SetCachedVariant( DBVARIANT* s /* new */, DBVARIANT* d /* cached */ memcpy( d, s, sizeof( DBVARIANT ));
if (( s->type == DBVT_UTF8 || s->type == DBVT_ASCIIZ ) && s->pszVal != NULL ) {
if ( szSave != NULL )
- d->pszVal = (char*)HeapReAlloc(hCacheHeap,HEAP_NO_SERIALIZE,szSave,strlen(s->pszVal)+1);
+ d->pszVal = (char*)HeapReAlloc(hCacheHeap,0,szSave,strlen(s->pszVal)+1);
else
- d->pszVal = (char*)HeapAlloc(hCacheHeap,HEAP_NO_SERIALIZE,strlen(s->pszVal)+1);
+ d->pszVal = (char*)HeapAlloc(hCacheHeap,0,strlen(s->pszVal)+1);
strcpy(d->pszVal,s->pszVal);
}
@@ -139,7 +139,7 @@ static void SetCachedVariant( DBVARIANT* s /* new */, DBVARIANT* d /* cached */ static void FreeCachedVariant( DBVARIANT* V )
{
if (( V->type == DBVT_ASCIIZ || V->type == DBVT_UTF8 ) && V->pszVal != NULL )
- HeapFree(hCacheHeap,HEAP_NO_SERIALIZE,V->pszVal);
+ HeapFree(hCacheHeap,0,V->pszVal);
}
static DBVARIANT* GetCachedValuePtr( HANDLE hContact, char* szSetting, int bAllocate )
@@ -154,14 +154,14 @@ static DBVARIANT* GetCachedValuePtr( HANDLE hContact, char* szSetting, int bAllo if ( bAllocate == -1 ) {
FreeCachedVariant( &V->value );
li.List_Remove(&lGlobalSettings,index);
- HeapFree(hCacheHeap,HEAP_NO_SERIALIZE,V);
+ HeapFree(hCacheHeap,0,V);
return NULL;
} }
else {
if ( bAllocate != 1 )
return NULL;
- V = (DBCachedGlobalValue*)HeapAlloc(hCacheHeap,HEAP_NO_SERIALIZE+HEAP_ZERO_MEMORY,sizeof(DBCachedGlobalValue));
+ V = (DBCachedGlobalValue*)HeapAlloc(hCacheHeap,HEAP_ZERO_MEMORY,sizeof(DBCachedGlobalValue));
V->name = szSetting;
li.List_Insert(&lGlobalSettings,V,index);
}
@@ -177,10 +177,10 @@ static DBVARIANT* GetCachedValuePtr( HANDLE hContact, char* szSetting, int bAllo VL = (DBCachedContactValueList*)lContacts.items[index];
}
else {
- if ( bAllocate == -1 )
+ if ( bAllocate != 1 )
return NULL;
- VL = (DBCachedContactValueList*)HeapAlloc(hCacheHeap,HEAP_NO_SERIALIZE+HEAP_ZERO_MEMORY,sizeof(DBCachedContactValueList));
+ VL = (DBCachedContactValueList*)HeapAlloc(hCacheHeap,HEAP_ZERO_MEMORY,sizeof(DBCachedContactValueList));
VL->hContact = hContact;
li.List_Insert(&lContacts,VL,index);
}
@@ -189,11 +189,11 @@ static DBVARIANT* GetCachedValuePtr( HANDLE hContact, char* szSetting, int bAllo if (strcmp(V->name,szSetting)==0)
break;
- if ( V == NULL )
- { if ( bAllocate != 1 )
+ if ( V == NULL ) {
+ if ( bAllocate != 1 )
return NULL;
- V = HeapAlloc(hCacheHeap,HEAP_NO_SERIALIZE+HEAP_ZERO_MEMORY,sizeof(DBCachedContactValue));
+ V = HeapAlloc(hCacheHeap,HEAP_ZERO_MEMORY,sizeof(DBCachedContactValue));
V->next = VL->first;
VL->first = V;
V->name = szSetting;
@@ -207,7 +207,7 @@ static DBVARIANT* GetCachedValuePtr( HANDLE hContact, char* szSetting, int bAllo V1->next = V->next;
break;
}
- HeapFree(hCacheHeap,HEAP_NO_SERIALIZE,V);
+ HeapFree(hCacheHeap,0,V);
return NULL;
}
@@ -393,7 +393,7 @@ static int GetContactSettingStr(WPARAM wParam,LPARAM lParam) if ( GetContactSettingWorker(( HANDLE )wParam, dgs, 0 ))
return 1;
- if ( iSaveType == 0 || iSaveType == dgs->pValue->type )
+ if ( iSaveType == 0 || iSaveType == dgs->pValue->type )
return 0;
if ( dgs->pValue->type != DBVT_ASCIIZ && dgs->pValue->type != DBVT_UTF8 )
@@ -432,7 +432,7 @@ static int GetContactSettingStr(WPARAM wParam,LPARAM lParam) return 0;
}
-static int GetContactSettingStatic(WPARAM wParam,LPARAM lParam)
+int GetContactSettingStatic(WPARAM wParam,LPARAM lParam)
{
DBCONTACTGETSETTING* dgs = (DBCONTACTGETSETTING*)lParam;
if ( GetContactSettingWorker(( HANDLE )wParam, dgs, 1 ))
@@ -938,7 +938,7 @@ int InitSettings(void) CreateServiceFunction(MS_DB_SETSETTINGRESIDENT,SetSettingResident);
hSettingChangeEvent=CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED);
- hCacheHeap=HeapCreate(HEAP_NO_SERIALIZE,0,0);
+ hCacheHeap=HeapCreate(0,0,0);
lSettings.sortFunc=stringCompare;
lSettings.increment=50;
lContacts.sortFunc=handleCompare;
diff --git a/db3x_autobackups/init.c b/db3x_autobackups/init.c index 11b0f61..a282f0c 100644 --- a/db3x_autobackups/init.c +++ b/db3x_autobackups/init.c @@ -104,19 +104,6 @@ static int grokHeader( char * profile, int * error ) return rc;
}
-static PLUGININFO pluginInfo = {
- sizeof(PLUGININFO),
- "Miranda database - with AutoBackups",
- PLUGIN_MAKE_VERSION(0,6,0,1),
- "Provides Miranda database support: global settings, contacts, history, settings per contact.",
- "Miranda-IM project",
- "mail@scottellis.com.au",
- "Copyright 2000-2005 Miranda-IM project",
- "",
- 0,
- DEFMOD_DB
-};
-
// returns 0 if all the APIs are injected otherwise, 1
static int LoadDatabase( char * profile, void * plink )
{
@@ -164,9 +151,8 @@ static DATABASELINK dblink = { };
/*
-
-static PLUGININFO pluginInfo = {
- sizeof(PLUGININFO),
+static PLUGININFOEX pluginInfo = {
+ sizeof(PLUGININFOEX),
"Miranda database driver",
PLUGIN_MAKE_VERSION(0,6,0,1),
"Provides Miranda database support: global settings, contacts, history, settings per contact.",
@@ -175,10 +161,27 @@ static PLUGININFO pluginInfo = { "Copyright 2000-2006 Miranda IM project",
"",
0,
- DEFMOD_DB
+ DEFMOD_DB,
+ {0x1394a3ab, 0x2585, 0x4196, { 0x8f, 0x72, 0xe, 0xae, 0xc2, 0x45, 0xe, 0x11 }} //{1394A3AB-2585-4196-8F72-0EAEC2450E11}
};
*/
+
+static PLUGININFOEX pluginInfo = {
+ sizeof(PLUGININFOEX),
+ "Miranda database - with AutoBackups",
+ PLUGIN_MAKE_VERSION(0,7,0,0),
+ "Provides Miranda database support: global settings, contacts, history, settings per contact.",
+ "Miranda-IM project",
+ "mail@scottellis.com.au",
+ "Copyright 2000-2005 Miranda-IM project",
+ "",
+ 0,
+ DEFMOD_DB,
+ //{0x1394a3ab, 0x2585, 0x4196, { 0x8f, 0x72, 0xe, 0xae, 0xc2, 0x45, 0xe, 0x11 }} //{1394A3AB-2585-4196-8F72-0EAEC2450E11}
+ { 0x52bbc116, 0x188a, 0x4b55, { 0x9a, 0x4f, 0xf6, 0x84, 0xb3, 0x46, 0x8b, 0x66 } } // {52BBC116-188A-4b55-9A4F-F684B3468B66}
+};
+
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD dwReason, LPVOID reserved)
{
g_hInst = hInstDLL;
@@ -190,7 +193,7 @@ __declspec(dllexport) DATABASELINK* DatabasePluginInfo(void * reserved) return &dblink;
}
-__declspec(dllexport) PLUGININFO * MirandaPluginInfo(DWORD mirandaVersion)
+__declspec(dllexport) PLUGININFOEX * MirandaPluginInfoEx(DWORD mirandaVersion)
{
if ( mirandaVersion < PLUGIN_MAKE_VERSION(0,6,0,15)) {
MessageBox( NULL, _T("The db3x plugin cannot be loaded. It requires Miranda IM 0.6.0.15 or later."), _T("db3x Plugin"), MB_OK|MB_ICONWARNING|MB_SETFOREGROUND|MB_TOPMOST );
@@ -199,6 +202,12 @@ __declspec(dllexport) PLUGININFO * MirandaPluginInfo(DWORD mirandaVersion) return &pluginInfo;
}
+static const MUUID interfaces[] = {MIID_DATABASE, MIID_LAST};
+__declspec(dllexport) const MUUID * MirandaPluginInterfaces(void)
+{
+ return interfaces;
+}
+
int __declspec(dllexport) Load(PLUGINLINK * link)
{
return 1;
|