1
我試圖讓Firefox(16.0.2在Windows 7 x64 Professional下)檢測到一個空白的NPAPI插件。這是我的代碼。未檢測到Firefox的NPAPI插件
nplithium.def
LIBRARY nplithium
EXPORTS
NP_GetEntryPoints @1
NP_Initialize @2
NP_Shutdown @3
nplithium.rc
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Antek SRL"
VALUE "FileDescription", "Example Lithium"
VALUE "FileVersion", "1.0.0.2"
VALUE "InternalName", "nplithium"
VALUE "LegalCopyright", "Copyright (C) Marco Buzzanca 2012"
VALUE "MIMEType", "application/x-lithium"
VALUE "OriginalFilename", "nplithium.dll"
VALUE "ProductName", "lithium"
VALUE "ProductVersion", "1.0.0.1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
dll_entry.cpp
#include "npapi.h"
#include "npfunctions.h"
extern "C"
{
NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* functions)
{
if(functions == NULL)
return NPERR_INVALID_FUNCTABLE_ERROR;
if(functions->size < sizeof(NPPluginFuncs))
return NPERR_INVALID_FUNCTABLE_ERROR;
functions->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
functions->newp = NULL;
functions->destroy = NULL;
functions->setwindow = NULL;
functions->newstream = NULL;
functions->destroystream = NULL;
functions->asfile = NULL;
functions->writeready = NULL;
functions->write = NULL;
functions->print = NULL;
functions->event = NULL;
functions->urlnotify = NULL;
functions->getvalue = NULL;
functions->setvalue = NULL;
functions->javaClass = NULL;
return NPERR_NO_ERROR;
}
NPError OSCALL NP_Initialize(NPNetscapeFuncs* functions)
{
return NPERR_NO_ERROR;
}
NPError OSCALL NP_Shutdown()
{
return NPERR_NO_ERROR;
}
}
不幸的是,所有的樣品插件和教程,我在網上找到不是過時就是不完整。 MDN也沒有任何幫助,因爲它幾乎不提供關於瀏覽器期望這些功能的信息(NP_GetEntryPoints完全沒有記錄)。
有什麼我失蹤了嗎?我不想讓插件做任何事情,我只是想讓Firefox檢測到它。