Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <iostream>
- int main() {
- size_t(*m_pQlzGetSetting)(int);
- size_t(*m_pQlzCompress)(const void *source, char *destination, size_t size, char *scratch_compress);
- size_t(*m_pQlzSizeDecompressed)(const char *source);
- size_t(*m_pQlzSizeCompressed)(const char *source);
- size_t(*m_pQlzDecompress)(const char *source, void *destination, char *scratch_decompress);
- int m_iQlzCompressionLevel;
- int m_iQlzScratchCompress;
- int m_iQlzScratchDecompress;
- int m_iQlzStreamingBuffer;
- int m_iQlzVersionMajor;
- int m_iQlzVersionMinor;
- int m_iQlzVersionRevision;
- HMODULE m_hLibQLZ = LoadLibrary("devlib.dll");
- if (m_hLibQLZ != NULL)
- {
- bool error = false;
- m_pQlzGetSetting = (size_t(__cdecl *)(int))GetProcAddress(m_hLibQLZ, "?qlz_get_setting@@YAHH@Z");
- if (m_pQlzGetSetting == NULL)
- {
- std::cout << "Can't find qlz_get_setting in devlib.dll";
- error = true;
- }
- m_pQlzCompress = (size_t(__cdecl *)(const void *, char *, size_t, char *))GetProcAddress(m_hLibQLZ, "?qlz_compress@@YAIPBXPADI1@Z");
- if (m_pQlzCompress == NULL)
- {
- std::cout << "Can't find qlz_compress in devlib.dll";
- error = true;
- }
- m_pQlzSizeDecompressed = (size_t(__cdecl *)(const char *source))GetProcAddress(m_hLibQLZ, "?qlz_size_decompressed@@YAIPBD@Z");
- if (m_pQlzSizeDecompressed == NULL)
- {
- std::cout << "Can't find qlz_size_decompressed in devlib.dll";
- error = true;
- }
- m_pQlzSizeCompressed = (size_t(__cdecl *)(const char *source))GetProcAddress(m_hLibQLZ, "?qlz_size_compressed@@YAIPBD@Z");
- if (m_pQlzSizeCompressed == NULL)
- {
- std::cout << "Can't find qlz_size_compressed in devlib.dll";
- error = true;
- }
- m_pQlzDecompress = (size_t(__cdecl *)(const char *source, void *destination, char *scratch_decompress))GetProcAddress(m_hLibQLZ, "?qlz_decompress@@YAIPBDPAXPAD@Z");
- if (m_pQlzDecompress == NULL)
- {
- std::cout << "Can't find qlz_decompress in devlib.dll";
- error = true;
- }
- if (!error)
- {
- m_iQlzCompressionLevel = m_pQlzGetSetting(0);
- m_iQlzScratchCompress = m_pQlzGetSetting(1);
- m_iQlzScratchDecompress = m_pQlzGetSetting(2);
- m_iQlzStreamingBuffer = m_pQlzGetSetting(3);
- //TRACE("Is memory safe = %d\n", m_pQlzGetSetting(6));
- m_iQlzVersionMajor = m_pQlzGetSetting(7);
- m_iQlzVersionMinor = m_pQlzGetSetting(8);
- m_iQlzVersionRevision = m_pQlzGetSetting(9);
- std::cout << " QLZ Version in devlib.dll " << m_iQlzVersionMajor << m_iQlzVersionMinor << m_iQlzVersionRevision <<std::endl;
- std::cout << " QLZ compression level = " << m_iQlzCompressionLevel << "Memory safe = " << m_pQlzGetSetting << " Streaming buffer = " << m_iQlzStreamingBuffer <<std::endl;
- std::cout << " QlzScratchCompress = " << m_iQlzScratchCompress << " QlzScratchDecompress = " << m_iQlzScratchDecompress;
- }
- }
- else
- {
- std::cout << "Can't load library: devlib.dll";
- }
- system("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement