-
Notifications
You must be signed in to change notification settings - Fork 1
/
extractor.h
41 lines (34 loc) · 1.11 KB
/
extractor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// CEZEO software Ltd. https://www.cezeo.com
#pragma once
#include <windows.h>
#include <string>
#include <vector>
#include <fdi.h>
#include <map>
#include "buffer.h"
#include "dll.h"
namespace cab
{
class extractor final
{
public:
extractor();
~extractor();
bool cab_to_files(const std::wstring& cabPath, const std::wstring& outputDir);
bool memory_to_memory(uint8_t* sourceData, size_t sourceSize, std::map<std::wstring, buffer>& output);
bool resources_to_memory(const UINT cabResourceId, std::map<std::wstring, buffer>& output);
private:
void create_context();
void destroy_context();
// cabinet.dll FDI functions pointers
typedef HFDI (*fnFDICreate)(PFNALLOC, PFNFREE, PFNOPEN, PFNREAD, PFNWRITE, PFNCLOSE, PFNSEEK, int, PERF);
typedef BOOL (*fnFDICopy)(HFDI, LPSTR, LPSTR, INT, PFNFDINOTIFY, PFNFDIDECRYPT, void*);
typedef BOOL (*fnFDIDestroy)(HFDI);
fnFDICreate pfnFDICreate{nullptr};
fnFDICopy pfnFDICopy{nullptr};
fnFDIDestroy pfnFDIDestroy{nullptr};
HFDI extractHandler{nullptr};
ERF extractErrors;
dll cabinetDll;
};
}; // namespace cab