NPAPI with note One, run Npruntime demo in Chrome

Source: Internet
Author: User
Tags throw exception

The demo on chrome running Npruntime Demo,codeproject is for Firefox, and it's used on chrome to modify some of the code.

Required libraries: Windows Platform SDK and NPAPI SDK

Download the demo of Npruntime in CodeProject.


Compile-time

Missing header file npfunctions.h then found the Npapi SDK.

Not included windows.h so include a bit

np_getmimedescription method definition and SDK has conflicting

Char *np_getmimedescription () {return npp_getmimedescription ();}

Revision changed to

Const Char *    np_getmimedescription () {    return  npp_getmimedescription ();}

Compile successfully, after debugging, found that the plugin failed to load.

After a multi-party search data, modified the following part of the code finally succeeded.

Modify Code

The Np_getentrypoints method inside

  if sizeof (Nppluginfuncs))     return Nperr_invalid_functable_error;

The trace found that Chrome passed over the pfuncs->size to 80 and the actual defined Nppluginfuncs size was 84 so seriously did not pass. Comment Masking!

The Np_initialize method inside

  if sizeof (Npnetscapefuncs))     return Nperr_invalid_functable_error;

Tracking found that Chrome passed over the pfuncs->size and actually defined the size of the Npnetscapefuncs, so seriously not pass. Comment Masking!

Within the Cplugin constructor

  1 ,       &rval);

Throw exception when calling, Comment mask!

Do the above handle well debugging normal.

NPAPI with note One, run Npruntime demo in Chrome

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.