Advertisement
TShiva

QLZ

Mar 21st, 2019
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.87 KB | None | 0 0
  1. #include <windows.h>
  2. #include <iostream>
  3.  
  4. int main() {
  5.     size_t(*m_pQlzGetSetting)(int);
  6.     size_t(*m_pQlzCompress)(const void *source, char *destination, size_t size, char *scratch_compress);
  7.     size_t(*m_pQlzSizeDecompressed)(const char *source);
  8.     size_t(*m_pQlzSizeCompressed)(const char *source);
  9.     size_t(*m_pQlzDecompress)(const char *source, void *destination, char *scratch_decompress);
  10.     int m_iQlzCompressionLevel;
  11.     int m_iQlzScratchCompress;
  12.     int m_iQlzScratchDecompress;
  13.     int m_iQlzStreamingBuffer;
  14.     int m_iQlzVersionMajor;
  15.     int m_iQlzVersionMinor;
  16.     int m_iQlzVersionRevision;
  17.     HMODULE m_hLibQLZ = LoadLibrary("devlib.dll");
  18.     if (m_hLibQLZ != NULL)
  19.     {
  20.         bool error = false;
  21.         m_pQlzGetSetting = (size_t(__cdecl *)(int))GetProcAddress(m_hLibQLZ, "?qlz_get_setting@@YAHH@Z");
  22.         if (m_pQlzGetSetting == NULL)
  23.         {
  24.             std::cout << "Can't find qlz_get_setting in devlib.dll";
  25.             error = true;
  26.         }
  27.  
  28.         m_pQlzCompress = (size_t(__cdecl *)(const void *, char *, size_t, char *))GetProcAddress(m_hLibQLZ, "?qlz_compress@@YAIPBXPADI1@Z");
  29.         if (m_pQlzCompress == NULL)
  30.         {
  31.             std::cout << "Can't find qlz_compress in devlib.dll";
  32.             error = true;
  33.         }
  34.  
  35.         m_pQlzSizeDecompressed = (size_t(__cdecl *)(const char *source))GetProcAddress(m_hLibQLZ, "?qlz_size_decompressed@@YAIPBD@Z");
  36.         if (m_pQlzSizeDecompressed == NULL)
  37.         {
  38.             std::cout << "Can't find qlz_size_decompressed in devlib.dll";
  39.             error = true;
  40.         }
  41.  
  42.         m_pQlzSizeCompressed = (size_t(__cdecl *)(const char *source))GetProcAddress(m_hLibQLZ, "?qlz_size_compressed@@YAIPBD@Z");
  43.         if (m_pQlzSizeCompressed == NULL)
  44.         {
  45.             std::cout << "Can't find qlz_size_compressed in devlib.dll";
  46.             error = true;
  47.         }
  48.  
  49.         m_pQlzDecompress = (size_t(__cdecl *)(const char *source, void *destination, char *scratch_decompress))GetProcAddress(m_hLibQLZ, "?qlz_decompress@@YAIPBDPAXPAD@Z");
  50.         if (m_pQlzDecompress == NULL)
  51.         {
  52.             std::cout << "Can't find qlz_decompress in devlib.dll";
  53.             error = true;
  54.         }
  55.  
  56.         if (!error)
  57.         {
  58.             m_iQlzCompressionLevel = m_pQlzGetSetting(0);
  59.             m_iQlzScratchCompress = m_pQlzGetSetting(1);
  60.             m_iQlzScratchDecompress = m_pQlzGetSetting(2);
  61.             m_iQlzStreamingBuffer = m_pQlzGetSetting(3);
  62.             //TRACE("Is memory safe = %d\n", m_pQlzGetSetting(6));
  63.             m_iQlzVersionMajor = m_pQlzGetSetting(7);
  64.             m_iQlzVersionMinor = m_pQlzGetSetting(8);
  65.             m_iQlzVersionRevision = m_pQlzGetSetting(9);
  66.  
  67.             std::cout << " QLZ Version in devlib.dll " << m_iQlzVersionMajor << m_iQlzVersionMinor << m_iQlzVersionRevision <<std::endl;
  68.             std::cout << " QLZ compression level = " << m_iQlzCompressionLevel << "Memory safe = " << m_pQlzGetSetting << " Streaming buffer = " << m_iQlzStreamingBuffer <<std::endl;
  69.             std::cout << " QlzScratchCompress = " << m_iQlzScratchCompress << " QlzScratchDecompress = " << m_iQlzScratchDecompress;
  70.  
  71.         }
  72.     }
  73.     else
  74.     {
  75.         std::cout << "Can't load library: devlib.dll";
  76.     }
  77.     system("PAUSE");
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement