// dllmain.cpp : Defines the entry point for the DLL application. #include "pch.h" #include #include #include #include #include #include #include #include #include "..\grittibanzli.h" BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; } namespace grittibanzli { extern "C" __declspec(dllexport) bool __Grittibanzli(const uint8_t* src, size_t srcSize, uint8_t* dst1, size_t* dst1Capacity, uint8_t* dst2, size_t* dst2Capacity) { std::vectoruncompressed; std::vectorchoices_encoded; if ((Grittibanzli(src, srcSize, &uncompressed, &choices_encoded) == true) && (uncompressed.size() <= *dst1Capacity) && (choices_encoded.size() <= *dst2Capacity)) { *dst1Capacity = uncompressed.size(); memcpy(dst1, uncompressed.data(), uncompressed.size()); *dst2Capacity = choices_encoded.size(); memcpy(dst2, choices_encoded.data(), choices_encoded.size()); return true; } else { return false; } } extern "C" __declspec(dllexport) bool __Ungrittibanzli(const uint8_t* src1, size_t src1Size, const unsigned char* src2, size_t src2Size, unsigned char* dst, size_t* dstCapacity) { std::vectordeflated; if ((Ungrittibanzli(src1, src1Size, src2, src2Size, &deflated) == true) && (deflated.size() <= *dstCapacity)) { *dstCapacity = deflated.size(); memcpy(dst, deflated.data(), deflated.size()); return true; } else { return false; } } }