Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8998207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:59:34+00:00 2026-06-15T23:59:34+00:00

npapi code: bool plugin_invoke(NPObject *obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result)

  • 0

npapi code:

bool plugin_invoke(NPObject *obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result) {
NPUTF8 *name = browser->utf8fromidentifier(methodName);
if(strcmp(name, plugin_method_name_getAddress) == 0){
    NPString password;
    if(argCount > 0) {
        password = NPVARIANT_TO_STRING(args[0]);
    }
    const char * StringVariable = password.UTF8Characters;
    char* npOutString = (char *)malloc(strlen(StringVariable+1));
    if (!npOutString)
        return false;
    strcpy(npOutString, StringVariable);
    STRINGZ_TO_NPVARIANT(npOutString, *result);
    browser->memfree(name);
    return true;
}
return false;

}

html code:

function run() {
    var plugin = document.getElementById("pluginId");
    var passwordBeforEncryption =  document.getElementById("passwordFeild");
    if(plugin){
        var value = plugin.getAddress("hello, just test it");
            alert(value);
    }else{
        alert("plugin is null");
    }

}

The right result should be: “hello, just test it”, but sometimes return”hello, just test itÿÿÿÿ”. It only sometimes not all time!

Please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:59:35+00:00Added an answer on June 15, 2026 at 11:59 pm

    The error is not in your html,you shuld see NPString structure.

    typedef struct _NPString {
        const NPUTF8 *UTF8Characters;
        uint32_t UTF8Length;
    } NPString;
    

    The member UTF8Length indicate the length of your string,so you should do as below:

    const char * StringVariable = password.UTF8Characters;
    char* npOutString  = (char*)browser->memalloc(password.UTF8Length+1);
    if (!npOutString) {
        return false;
    }
    memcpy(npOutString  , password.UTF8Characters, password.UTF8Length);
    npOutString[password.UTF8Length] = 0;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have compiled the NPAPI plugin for webP: http://code.google.com/p/webp-npapi-linux/ It works great from my
In my NPAPI plugin I wish to determine if an NPObject is a function
Here http://gplflash.sourceforge.net/gplflash2_blog/npapi.html Given code is switch(var) { case NPPVpluginNameString: *val = Example Plug-In; break;
I get result to JavaScript from native NPAPI/XPCOM/ActiveX. Previously user activate native GUI by:
I'm writing an NPAPI plugin. In C++ code, I can't create a JS object
I got my header files from: http://code.google.com/p/npapi-sdk/source/browse/?r=7#svn%2Fwiki So in the Initialize method, I stored
Is there a way to get IDispatch interface from NPObject in Google Chrome NPAPI
I have an NPAPI plugin for OS X using the CoreAnimation drawing model. How
I have an old NPAPI plugin for OS X that I'm trying to refit
I have a NPAPI (windowed-mode) plugin, running in a popup window. Unfortunately, there is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.