#include #include "viewer plugins.h" // Define the exported DLL functions extern "C" { __declspec(dllexport) BOOL DVP_IdentifyA(LPVIEWERPLUGININFOA lpVPInfo); __declspec(dllexport) BOOL DVP_IdentifyFileA(HWND hWnd,LPSTR lpszName,LPVIEWERPLUGINFILEINFOA lpVPFileInfo,HANDLE hAbortEvent); __declspec(dllexport) BOOL DVP_IdentifyFileStreamA(HWND hWnd,LPSTREAM lpStream,LPSTR lpszName,LPVIEWERPLUGINFILEINFOA lpVPFileInfo,DWORD dwStreamFlags); __declspec(dllexport) BOOL DVP_LoadTextA(LPDVPLOADTEXTDATAA lpLoadTextData); }; // {19E1003B-072E-42d8-B361-0EF64B47DE9A} static const GUID GUIDPlugin_Torrent = { 0x19e1003b, 0x72e, 0x42d8, { 0xb3, 0x61, 0xe, 0xf6, 0x4b, 0x47, 0xde, 0x9a } }; // Identify the viewer plugin to DOpus BOOL DVP_IdentifyA(LPVIEWERPLUGININFOA lpVPInfo) { // Plugin flags; we can handle streams, and only use filename extensions for identification for slow and non-random seeking media lpVPInfo->dwFlags = DVPFIF_ExtensionsOnly | DVPFIF_CanHandleStreams | DVPFIF_NoThumbnails | DVPFIF_NoFileInformation; // Version number (1.0.0.1) lpVPInfo->dwVersionHigh = MAKELPARAM(0,1); lpVPInfo->dwVersionLow = MAKELPARAM(1,0); // Preferred filename extension is .torrent lpVPInfo->lpszHandleExts = ".torrent"; // Plugin information lpVPInfo->lpszName = "Torrent"; lpVPInfo->lpszDescription = "Torrent Viewer Plugin"; lpVPInfo->lpszCopyright = "(c) Copyright 2009 Richard Fortier"; // Major type of file we handle is text lpVPInfo->uiMajorFileType = DVPMajorType_Text; // Our GUID to uniquely identify us to DOpus lpVPInfo->idPlugin = GUIDPlugin_Torrent; return TRUE; } // Identify a local disk-based file BOOL DVP_IdentifyFileA(HWND hWnd,LPSTR lpszName,LPVIEWERPLUGINFILEINFOA lpVPFileInfo,HANDLE hAbortEvent) { lpVPFileInfo->dwFlags = DVPFIF_ReturnsText; lpVPFileInfo->wMajorType = DVPMajorType_Text; lpVPFileInfo->wMinorType = 0; lpVPFileInfo->iTypeHint = DVPFITypeHint_PlainText; if (lpVPFileInfo->lpszInfo != 0 && lpVPFileInfo->cchInfoMax != 0) { lpVPFileInfo->lpszInfo[0] = '\0'; } return TRUE; } // Identify a stream-based file BOOL DVP_IdentifyFileStreamA(HWND hWnd,LPSTREAM lpStream,LPSTR lpszName,LPVIEWERPLUGINFILEINFOA lpVPFileInfo,DWORD dwStreamFlags) { return DVP_IdentifyFileA(hWnd, lpszName, lpVPFileInfo, NULL); } BOOL DVP_LoadTextA(LPDVPLOADTEXTDATAA lpLoadTextData) { lpLoadTextData->iOutTextType = DVPText_Plain; ULONG nb; lpLoadTextData->lpOutStream->Write(TEXT("salut"), 6, &nb); return TRUE; }