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 8183097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:03:34+00:00 2026-06-07T01:03:34+00:00

I am developing a plugin for NSIS (Unicode) and I am trying to use

  • 0

I am developing a plugin for NSIS (Unicode) and I am trying to use InternetCrackUrl() to get the hostname of a URL (ie: http://www.google.com/test.html -> http://www.google.com) but instead of lpszHostName just returning “www.google.com”, it returns “www.google.com/test.html”.

Here is my code:

void __declspec(dllexport) Example(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra) {
    g_hwndParent=hwndParent;

    EXDLL_INIT();

    LPWSTR szURI = new WCHAR[string_size];
    URL_COMPONENTS urlComp;

    // Sets szURI to "http://www.xyz.com/test.html"
    popstring(szURI);

    wstring strUri = szURI;

    ZeroMemory(&urlComp, sizeof(urlComp));
    urlComp.dwStructSize = sizeof(urlComp);

    // Set required component lengths to non-zero so that they are cracked.
    urlComp.dwHostNameLength = static_cast<DWORD>(-1);
    urlComp.dwSchemeLength = static_cast<DWORD>(-1);
    urlComp.dwUrlPathLength = static_cast<DWORD>(-1);
    urlComp.dwExtraInfoLength = static_cast<DWORD>(-1);

    if (!InternetCrackUrlW(strUri.c_str(), strUri.length(), 0, &urlComp)) {
        return _T("InternetCrackUrl failed");
    }

    // urlComp.lpszHostName = www.xyz.com/test.html
}

Any ideas?

  • 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-07T01:03:36+00:00Added an answer on June 7, 2026 at 1:03 am

    If you don’t provide your own buffer InternetCrackUrl will return pointers to characters in the original string you pass as input. It doesn’t copy the string.

    So, lpszHostName will point to the first character, and dwHostNameLength will give you the number of chars that make the host name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm very new to jQuery and i'm developing a plugin (for my own use)
I'm developing a plugin in Wordpress and am having difficulty trying to post data
I'm attempting to create a bare bones app for use in developing a plugin.
I am developing a plugin, and I need to get browser proxy for a
I'm developing a Solr plugin and using the Solr test-framework I place a test
I am developing an Eclipse plugin and I use maven to coordinate my source
I'm developing maven plugin <modelVersion>4.0.0</modelVersion> <groupId>com.breedish.cfit</groupId> <artifactId>maven-cfitautomator-plugin</artifactId> <version>1.0-SNAPSHOT</version> <packaging>maven-plugin</packaging> <name>cfitautomator</name> But how i can
I'm developing an Eclipse plugin. I have been reading how to subscribe get notification
I am developing eclipse plugin for our organization . We are opening multiple servers[minimum
I am developing a plugin for eclipse. In this plugin I need to be

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.