123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- #include <windows.h>
- namespace DatExportApiPrivate {
- typedef int (__stdcall * OpenDatFileFunc)(
- int,
- const char*,
- unsigned int,
- int*,
- int*,
- int*,
- int*,
- unsigned long*,
- void*,
- void*
- );
- typedef int (__stdcall * GetNumSubfilesFunc)(
- int
- );
- typedef int (__stdcall * GetSubFileSizesFunc)(
- int,
- int*,
- int*,
- int*,
- int,
- int
- );
- typedef int (__stdcall * GetSubFileVersionFunc)(
- int,
- int
- );
-
- typedef int (__stdcall * GetSubfileDataFunc)(
- int,
- int,
- void*,
- int,
- int*
- );
- typedef int (__stdcall * CloseDatFileFunc)(
- int
- );
- typedef int (__stdcall * PurgeSubFileDataFunc)(
- int,
- int
- );
- typedef int (__stdcall * PutSubFileDataFunc)(
- int,
- int,
- void*,
- int,
- int,
- int,
- int,
- bool
- );
- typedef int (__stdcall * FlushFunc)(
- int
- );
- };
- class DatExportApi {
- public:
- DatExportApi();
- int OpenDatFile(int handle, const char* filename, unsigned int flags);
- int GetNumSubfiles(int handle);
- void GetSubfileSizes(int handle, int* file_ids, int* size, int* iteration, int offset, int count);
- int GetSubfileVersion(int handle, int file_id);
- int GetSubfileData(int handle, int file_id, void* target_buf, int& version);
- void CloseDatFile(int handle);
- int PurgeSubfileData(int handle, int file_id);
- int PutSubfileData(int handle, int file_id, void* data, int offset, int size, int version, int iteration, bool compress = false);
- void Flush(int handle);
- ~DatExportApi();
- private:
- HMODULE datexport_dll_;
- FARPROC open_dat_file_addr_;
- volatile DatExportApiPrivate::OpenDatFileFunc open_dat_file_func_;
- FARPROC get_num_subfiles_addr_;
- volatile DatExportApiPrivate::GetNumSubfilesFunc get_num_subfiles_func_;
- FARPROC get_subfile_sizes_addr_;
- volatile DatExportApiPrivate::GetSubFileSizesFunc get_subfile_sizes_func_;
- FARPROC get_subfile_version_addr_;
- volatile DatExportApiPrivate::GetSubFileVersionFunc get_subfile_version_func_;
- FARPROC get_subfile_data_addr_;
- volatile DatExportApiPrivate::GetSubfileDataFunc get_subfile_data_func_;
- FARPROC close_dat_file_addr_;
- volatile DatExportApiPrivate::CloseDatFileFunc close_dat_file_func_;
- FARPROC purge_subfile_data_addr_;
- volatile DatExportApiPrivate::PurgeSubFileDataFunc purge_subfile_data_func_;
- FARPROC put_subfile_data_addr_;
- volatile DatExportApiPrivate::PutSubFileDataFunc put_subfile_data_func_;
- FARPROC flush_addr_;
- volatile DatExportApiPrivate::FlushFunc flush_func_;
- };
|