summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/HistoryPlusPlus/HistoryForm.pas8
-rw-r--r--plugins/HistoryPlusPlus/hpp_events.pas35
-rw-r--r--plugins/HistoryPlusPlus/hpp_externalgrid.pas22
-rw-r--r--plugins/HistoryPlusPlus/hpp_global.pas7
4 files changed, 56 insertions, 16 deletions
diff --git a/plugins/HistoryPlusPlus/HistoryForm.pas b/plugins/HistoryPlusPlus/HistoryForm.pas
index 403a62a62b..3b50cfe5a5 100644
--- a/plugins/HistoryPlusPlus/HistoryForm.pas
+++ b/plugins/HistoryPlusPlus/HistoryForm.pas
@@ -3820,18 +3820,18 @@ begin
hDBEvent := History[GridIndexToHistory(Index)];
if hDBEvent <> 0 then
begin
- DBEventInfo.d := GetEventInfo(hDBEvent);
- DBEventInfo.d.szModule := nil;
+ DBEventInfo := GetOldEventInfo(hDBEvent);
+ DBEventInfo.szModule := nil;
DBEventInfo.cbSize := sizeof(DBEventInfo);
- Item.Size := sizeof(DBEventInfo) + Cardinal(DBEventInfo.d.cbBlob);
+ Item.Size := sizeof(DBEventInfo) + Cardinal(DBEventInfo.cbBlob);
end;
if Item.Size > 0 then
begin
GetMem(Item.Buffer, Item.Size);
DataOffset := PAnsiChar(Item.Buffer) + sizeof(DBEventInfo);
Move(DBEventInfo, Item.Buffer^, sizeof(DBEventInfo));
- Move(DBEventInfo.d.pBlob^, DataOffset^, DBEventInfo.d.cbBlob);
+ Move(DBEventInfo.pBlob^, DataOffset^, DBEventInfo.cbBlob);
end;
end
else if Stage = ssDone then
diff --git a/plugins/HistoryPlusPlus/hpp_events.pas b/plugins/HistoryPlusPlus/hpp_events.pas
index 2996009325..004095c98f 100644
--- a/plugins/HistoryPlusPlus/hpp_events.pas
+++ b/plugins/HistoryPlusPlus/hpp_events.pas
@@ -101,6 +101,7 @@ function TimestampToDateTime(const Timestamp: DWord): TDateTime;
function TimestampToString(const Timestamp: DWord): String;
// general routine
function ReadEvent(hDBEvent: THandle; UseCP: Cardinal = CP_ACP): THistoryItem;
+function GetOldEventInfo(hDBEvent: THANDLE): TOldDBEventInfo;
function GetEventInfo(hDBEvent: THANDLE): TDBEventInfo;
function GetEventTimestamp(hDBEvent: THandle): DWord;
function GetEventMessageType(hDBEvent: THandle): TMessageTypes;
@@ -405,6 +406,40 @@ begin
Result.cbBlob := 0;
end;
+function GetOldEventInfo(hDBEvent: THANDLE): TOldDBEventInfo;
+var
+ BlobSize: integer;
+ dbei: TDBEventInfo;
+begin
+ ZeroMemory(@Result, SizeOf(Result));
+ BlobSize := db_event_getBlobSize(hDBEvent);
+ if BlobSize > 0 then
+ begin
+ EventBuffer.Allocate(BlobSize+2); // cheat, for possible crash avoid
+ Result.pBlob := EventBuffer.Buffer;
+ end
+ else
+ BlobSize := 0;
+
+ dbei.cbBlob := BlobSize;
+ dbei.pBlob := Result.pBlob;
+ if db_event_get(hDBEvent, @dbei) = 0 then
+ begin
+ Result.cbBlob := BlobSize;
+ if BlobSize > 0 then
+ begin
+ PAnsiChar(Result.pBlob)[BlobSize ]:=#0;
+ PAnsiChar(Result.pBlob)[BlobSize+1]:=#0;
+ end;
+ end
+ else
+ Result.cbBlob := 0;
+
+ Result.flags := dbei.flags;
+ Result.timestamp := dbei.timestamp;
+ Result.eventType := dbei.eventType;
+end;
+
function GetMessageType(EventInfo: TDBEventInfo; var EventIndex: Integer): TMessageTypes;
var
i: Integer;
diff --git a/plugins/HistoryPlusPlus/hpp_externalgrid.pas b/plugins/HistoryPlusPlus/hpp_externalgrid.pas
index a8ca592519..364e3b0331 100644
--- a/plugins/HistoryPlusPlus/hpp_externalgrid.pas
+++ b/plugins/HistoryPlusPlus/hpp_externalgrid.pas
@@ -1226,15 +1226,15 @@ begin
begin
ZeroMemory(@DBEventInfo, SizeOf(DBEventInfo));
DBEventInfo.cbSize := SizeOf(DBEventInfo);
- DBEventInfo.d.timestamp := Items[Index].CustomEvent.Time;
- DBEventInfo.d.flags := DBEF_READ or DBEF_UTF;
+ DBEventInfo.timestamp := Items[Index].CustomEvent.Time;
+ DBEventInfo.flags := DBEF_READ or DBEF_UTF;
if Items[Index].CustomEvent.Sent then
- DBEventInfo.d.flags := DBEventInfo.d.flags or DBEF_SENT;
- DBEventInfo.d.EventType := EVENTTYPE_MESSAGE;
+ DBEventInfo.flags := DBEventInfo.flags or DBEF_SENT;
+ DBEventInfo.EventType := EVENTTYPE_MESSAGE;
TextUTF := Items[Index].CustomEvent.Text + #0;
- DBEventInfo.d.cbBlob := Length(TextUTF) + 1;
- DBEventInfo.d.pBlob := Pointer(TextUTF);
- Item.Size := Cardinal(DBEventInfo.cbSize) + Cardinal(DBEventInfo.d.cbBlob);
+ DBEventInfo.cbBlob := Length(TextUTF) + 1;
+ DBEventInfo.pBlob := Pointer(TextUTF);
+ Item.Size := Cardinal(DBEventInfo.cbSize) + Cardinal(DBEventInfo.cbBlob);
end
else
begin
@@ -1242,9 +1242,9 @@ begin
if hDBEvent <> 0 then
begin
DBEventInfo.cbSize := SizeOf(DBEventInfo);
- DBEventInfo.d := GetEventInfo(hDBEvent);
- DBEventInfo.d.szModule := nil;
- Item.Size := Cardinal(DBEventInfo.cbSize) + Cardinal(DBEventInfo.d.cbBlob);
+ DBEventInfo := GetOldEventInfo(hDBEvent);
+ DBEventInfo.szModule := nil;
+ Item.Size := Cardinal(DBEventInfo.cbSize) + Cardinal(DBEventInfo.cbBlob);
end;
end;
if Item.Size > 0 then
@@ -1252,7 +1252,7 @@ begin
GetMem(Item.Buffer, Item.Size);
DataOffset := PAnsiChar(Item.Buffer) + DBEventInfo.cbSize;
Move(DBEventInfo, Item.Buffer^, DBEventInfo.cbSize);
- Move(DBEventInfo.d.pBlob^, DataOffset^, DBEventInfo.d.cbBlob);
+ Move(DBEventInfo.pBlob^, DataOffset^, DBEventInfo.cbBlob);
end;
end
else if Stage = ssDone then
diff --git a/plugins/HistoryPlusPlus/hpp_global.pas b/plugins/HistoryPlusPlus/hpp_global.pas
index fc115b0727..6af8367813 100644
--- a/plugins/HistoryPlusPlus/hpp_global.pas
+++ b/plugins/HistoryPlusPlus/hpp_global.pas
@@ -75,7 +75,12 @@ type
TOldDBEventInfo = record
cbSize : dword;
- d : TDBEventInfo;
+ szModule : PAnsiChar; // module that 'owns' this event and controls the data format
+ timestamp: dword; // timestamp in UNIX time
+ flags : dword; // the DBEF_* flags above
+ eventType: word; // event type, such as message, can be module defined
+ cbBlob : dword; // size in bytes of pBlob^
+ pBlob : PByte; // pointer to buffer containing the module defined event data
end;
PHistoryItem = ^THistoryItem;