Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Define callbacks do plugin
- EXPORT NPError WINAPI OSCALL
- NP_GetEntryPoints(NPPluginFuncs *nppFuncs) {
- _log("called");
- nppFuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
- nppFuncs->newp = plugin_new;
- nppFuncs->destroy = plugin_destroy;
- nppFuncs->getvalue = plugin_getValue;
- nppFuncs->event = plugin_handleEvent;
- nppFuncs->setwindow = plugin_setWindow;
- nppFuncs->size = sizeof(*nppFuncs);
- nppFuncs->newstream = plugin_newStream;
- nppFuncs->destroystream = plugin_destroyStream;
- nppFuncs->asfile = plugin_streamAsFile;
- nppFuncs->writeready = plugin_writeReady;
- nppFuncs->write = plugin_write;
- nppFuncs->print = plugin_print;
- nppFuncs->urlnotify = plugin_URLNotify;
- nppFuncs->setvalue = plugin_setValue;
- return NPERR_NO_ERROR;
- }
- #ifndef _WIN32
- #define HIBYTE(x) ((((uint32_t)(x)) & 0xff00) >> 8)
- #endif
- #ifndef _WIN32
- NPError OSCALL WINAPI
- NP_Initialize(NPNetscapeFuncs *npnf, NPPluginFuncs *nppfuncs) {
- _log("called");
- if (npnf == 0)
- return NPERR_INVALID_FUNCTABLE_ERROR;
- if (HIBYTE(npnf->version) > NP_VERSION_MAJOR)
- return NPERR_INVALID_FUNCTABLE_ERROR;
- npnfuncs = npnf;
- NP_GetEntryPoints(nppfuncs);
- return NPERR_NO_ERROR;
- }
- #else
- EXPORT NPError OSCALL
- NP_Initialize(NPNetscapeFuncs* bFuncs) {
- _log("called");
- npnfuncs = bFuncs;
- }
- #endif
- EXPORT NPError WINAPI OSCALL
- NP_Shutdown() {
- _log("called");
- return NPERR_NO_ERROR;
- }
- EXPORT const char *
- NP_GetMIMEDescription(void) {
- _log("called");
- return "application/x-example-info:.npexample:example@ex.com";
- }
- EXPORT NPError WINAPI OSCALL
- NP_GetValue(void *npp, NPPVariable variable, void *value) {
- _log("called");
- inst = (NPP) npp;
- return plugin_getValue((NPP) npp, variable, value);
- }
- #ifdef _WIN32
- BOOL WINAPI
- DllMain (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
- {
- switch (dwReason)
- {
- case DLL_PROCESS_ATTACH:
- // Code to run when the DLL is loaded
- break;
- case DLL_PROCESS_DETACH:
- // Code to run when the DLL is freed
- break;
- case DLL_THREAD_ATTACH:
- // Code to run when a thread is created during the DLL's lifetime
- break;
- case DLL_THREAD_DETACH:
- // Code to run when a thread ends normally.
- break;
- }
- return TRUE;
- }
- #define STDAPI_EXPORTED EXPORT HRESULT
- //Not implemented yet
- STDAPI_EXPORTED DllRegisterServer(void)
- {
- return S_OK;
- }
- //Not implemented yet
- STDAPI_EXPORTED DllUnregisterServer(void)
- {
- return S_OK;
- }
- BOOL WINAPI DllEntryPoint(HINSTANCE hInstance, ULONG ulReason, LPVOID pv) {
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement