Thank you a lot!
I've been able to progress a bit with the plugin
Sadly, I still have questions - and sorry to keep asking them, apparently it has been a long while I've messed with platform code
I don't get the point to actually use DVP_InitEx and DVP_Uninit - I'm not initializing anything, I'll just read the target file and print the useful part of the contents for me. Right now, I'l just returning true -
Maybe I'll improve it in the future..?
Ok, now to the stuff that's been bothering me all the night:
After attaching the debugger to DOpus.exe, I keep getting this error, when I press F8 to preview the file contents:
Exception thrown at 0x00007FFA0A829E08 in dopus.exe: Microsoft C++ exception: Exiv2::BasicError<wchar_t> at memory location 0x000000B7766FEB20.
I think it's related to IStream (Microsoft's version, not the standardized one).
IStream is painful to work with. Or maybe the documentation is terrible for those who aren't used to it.
This is what I managed to do so far:
__declspec(dllexport) BOOL DVP_LoadText(LPDVPLOADTEXTDATA lpLoadTextData)
{
// Apparently, while the documentation says this is the only flag available, it is never set :(
// if (lpLoadTextData->dwFlags != DVPCVF_FromStream)
// return false;
if (lpLoadTextData->dwStreamFlags & DVPSF_NoRandomSeek)
return false;
lpLoadTextData->iOutTextType = DVPText_Plain; // TODO: Format text
ULONG bytesWritten;
std::wstring test = TEXT("Random test\nTest test.");
// Create and verify our IStream object
LPSTREAM txtStream;
if (CreateStreamOnHGlobal(NULL, true, &lpLoadTextData->lpOutStream) != S_OK)
return false;
// Write our test data
lpLoadTextData->lpOutStream->Write(test.c_str(), test.size() * sizeof(wchar_t), &bytesWritten);
// MessageBox(NULL, TEXT("DVP_LoadText"), TEXT("Function Ran"), MB_OK | MB_ICONINFORMATION);
// TODO: Actually read the file here!
return true;
}
I tried writing a '\0'
after the contents of the wstring
, but still didn't work
Any idea on how to fix that?
Thank you very much for all your patience and support!