This commit is contained in:
cfif 2026-03-25 14:15:28 +03:00
parent a5cc146c1c
commit 81d1154b8f
2 changed files with 26 additions and 25 deletions

View File

@ -10,15 +10,16 @@
#include <time.h> #include <time.h>
/* ------------------------------------------------------------------------- /* -------------------------------------------------------------------------
* Упакованные структуры BLF (повторяем из оригинального заголовка) * Упакованные структуры BLF
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
#if defined(_MSC_VER) #ifdef _MSC_VER
#pragma pack(push, 1) #pragma pack(push, 1)
#define PACKED_STRUCT
#else #else
#define PACKED __attribute__((packed)) #define PACKED_STRUCT __attribute__((packed))
#endif #endif
typedef struct PACKED { typedef struct {
uint16_t year; uint16_t year;
uint16_t month; uint16_t month;
uint16_t dayOfWeek; uint16_t dayOfWeek;
@ -27,9 +28,9 @@ typedef struct PACKED {
uint16_t minute; uint16_t minute;
uint16_t second; uint16_t second;
uint16_t milliseconds; uint16_t milliseconds;
} SYSTEMTIME_PACKED; } PACKED_STRUCT SYSTEMTIME_PACKED;
typedef struct PACKED { typedef struct {
uint32_t signature; uint32_t signature;
uint32_t statisticsSize; uint32_t statisticsSize;
uint32_t apiNumber; uint32_t apiNumber;
@ -45,33 +46,33 @@ typedef struct PACKED {
SYSTEMTIME_PACKED lastObjectTime; SYSTEMTIME_PACKED lastObjectTime;
uint64_t restorePointsOffset; uint64_t restorePointsOffset;
uint32_t reservedFileStatistics[16]; uint32_t reservedFileStatistics[16];
} FileHeader; } PACKED_STRUCT FileHeader;
typedef struct PACKED { typedef struct {
uint32_t mSignature; uint32_t mSignature;
uint16_t mHeaderSize; uint16_t mHeaderSize;
uint16_t mHeaderVersion; uint16_t mHeaderVersion;
uint32_t mObjectSize; uint32_t mObjectSize;
uint32_t mObjectType; uint32_t mObjectType;
} VBLObjectHeaderBase; } PACKED_STRUCT VBLObjectHeaderBase;
typedef struct PACKED { typedef struct {
VBLObjectHeaderBase mBase; VBLObjectHeaderBase mBase;
uint32_t mObjectFlags; uint32_t mObjectFlags;
uint16_t mClientIndex; uint16_t mClientIndex;
uint16_t mObjectVersion; uint16_t mObjectVersion;
uint64_t mObjectTimeStamp; uint64_t mObjectTimeStamp;
} VBLObjectHeader; } PACKED_STRUCT VBLObjectHeader;
typedef struct PACKED { typedef struct {
uint16_t mChannel; uint16_t mChannel;
uint8_t mFlags; uint8_t mFlags;
uint8_t mDLC; uint8_t mDLC;
uint32_t mID; uint32_t mID;
uint8_t mData[8]; uint8_t mData[8];
} VBLCANMessage; } PACKED_STRUCT VBLCANMessage;
typedef struct PACKED { typedef struct {
uint16_t mChannel; uint16_t mChannel;
uint8_t mID; uint8_t mID;
uint8_t mDLC; uint8_t mDLC;
@ -83,9 +84,9 @@ typedef struct PACKED {
uint16_t mCRC; uint16_t mCRC;
uint8_t mDir; uint8_t mDir;
uint8_t mReserved; uint8_t mReserved;
} VBLLINMessage; } PACKED_STRUCT VBLLINMessage;
typedef struct PACKED { typedef struct {
uint16_t mChannel; uint16_t mChannel;
uint8_t mID; uint8_t mID;
uint8_t mDLC; uint8_t mDLC;
@ -93,31 +94,29 @@ typedef struct PACKED {
uint8_t mFSMState; uint8_t mFSMState;
uint8_t mHeaderTime; uint8_t mHeaderTime;
uint8_t mFullTime; uint8_t mFullTime;
} VBLLINSendError; } PACKED_STRUCT VBLLINSendError;
typedef struct PACKED { typedef struct {
uint16_t compressionMethod; uint16_t compressionMethod;
uint16_t reserved1; uint16_t reserved1;
uint32_t reserved2; uint32_t reserved2;
uint32_t uncompressedFileSize; uint32_t uncompressedFileSize;
uint32_t reserved3; uint32_t reserved3;
} LogContainerData; } PACKED_STRUCT LogContainerData;
typedef struct PACKED { typedef struct {
VBLObjectHeaderBase base; VBLObjectHeaderBase base;
LogContainerData data; LogContainerData data;
} ContainerHeader; } PACKED_STRUCT ContainerHeader;
#if defined(_MSC_VER) #ifdef _MSC_VER
#pragma pack(pop) #pragma pack(pop)
#else
#undef PACKED
#endif #endif
/* ------------------------------------------------------------------------- /* -------------------------------------------------------------------------
* Контекст (полное определение) * Контекст (полное определение)
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
typedef struct { typedef struct BLFContext {
FILE* fp; FILE* fp;
FileHeader header; FileHeader header;
long headerPos; long headerPos;

2
msvs.txt Normal file
View File

@ -0,0 +1,2 @@
cl /LD /O2 /MT /D "BLF_BUILD_DLL" /Fe:blf_x86.dll blf.c /link /MACHINE:X86
cl /LD /O2 /MT /D "BLF_BUILD_DLL" /Fe:blf_x64.dll blf.c /link /MACHINE:X64