forked from AUTOMATIC1111/IntoTheBreachLua
-
Notifications
You must be signed in to change notification settings - Fork 3
/
blob.h
70 lines (55 loc) · 1.96 KB
/
blob.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef __FILE_H__
#define __FILE_H__
#include <windows.h>
#include <string>
#include <map>
struct Blob :public IStream {
unsigned char *data;
int length;
std::string source;
Blob();
~Blob();
int position;
void reset() {
position = 0;
}
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid,_COM_Outptr_ void __RPC_FAR *__RPC_FAR *ppvObject);
ULONG STDMETHODCALLTYPE AddRef(void);
ULONG STDMETHODCALLTYPE Release(void);
HRESULT STDMETHODCALLTYPE Read(_Out_writes_bytes_to_(cb, *pcbRead) void *pv,_In_ ULONG cb,_Out_opt_ ULONG *pcbRead);
HRESULT STDMETHODCALLTYPE Write(_In_reads_bytes_(cb) const void *pv,_In_ ULONG cb,_Out_opt_ ULONG *pcbWritten);
HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER dlibMove,DWORD dwOrigin,_Out_opt_ ULARGE_INTEGER *plibNewPosition);
HRESULT STDMETHODCALLTYPE SetSize(ULARGE_INTEGER libNewSize);
HRESULT STDMETHODCALLTYPE CopyTo(_In_ IStream *pstm, ULARGE_INTEGER cb, _Out_opt_ ULARGE_INTEGER *pcbRead, _Out_opt_ ULARGE_INTEGER *pcbWritten);
HRESULT STDMETHODCALLTYPE Commit(DWORD grfCommitFlags);
HRESULT STDMETHODCALLTYPE Revert(void);
HRESULT STDMETHODCALLTYPE LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
HRESULT STDMETHODCALLTYPE UnlockRegion(ULARGE_INTEGER libOffset,ULARGE_INTEGER cb,DWORD dwLockType);
HRESULT STDMETHODCALLTYPE Stat(__RPC__out STATSTG *pstatstg,DWORD grfStatFlag);
HRESULT STDMETHODCALLTYPE Clone(__RPC__deref_out_opt IStream **ppstm);
};
struct BlobFromFile :public Blob {
BlobFromFile(const std::string & filename);
};
struct ResourceDatFile {
struct FileInfo {
size_t offset;
size_t size;
FileInfo() {
offset = 0;
size = 0;
}
FileInfo(size_t o, size_t s) {
offset = o;
size = s;
}
};
std::string filename;
std::map<std::string, FileInfo> index;
ResourceDatFile(const std::string & filename);
void reload();
};
struct BlobFromResourceDat :public Blob {
BlobFromResourceDat(const ResourceDatFile *dat,const std::string & filename);
};
#endif