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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:48:53+00:00 2026-06-16T03:48:53+00:00

For a function marshalled like that: /************************************************* * DWORD WINAPI WlanHostedNetworkSetProperty( * _In_ HANDLE

  • 0

For a function marshalled like that:

/*************************************************
*  DWORD WINAPI WlanHostedNetworkSetProperty(
*      _In_        HANDLE hClientHandle,
*      _In_        _WLAN_HOSTED_NETWORK_OPCODE OpCode,
*      _In_        DWORD dwDataSize,
*      _In_        PVOID pvData,
*      _Out_opt_   P_WLAN_HOSTED_NETWORK_REASON pFailReason,
*      _Reserved_  PVOID pvReserved
*  );
*************************************************/
[DllImport("Wlanapi.dll", SetLastError = true)]
public static extern UInt32 WlanHostedNetworkSetProperty(
    [In] IntPtr hClientHandle,
    [In] _WLAN_HOSTED_NETWORK_OPCODE OpCode,
    [In] UInt32 dwDataSize,
    [In] IntPtr pvData,
    [Out] out _WLAN_HOSTED_NETWORK_REASON pFailReason,
    [In, Out] IntPtr pvReserved
);

Microsoft documentation says that when I pass

_WLAN_HOSTED_NETWORK_OPCODE._WLAN_HOSTED_NETWORK_OPCODE_enable

as a parameter of OpCode, the value of pvData should be a pointer to a Boolean value.
Hereis the documentation for that function
I have no idea though how to get an IntPtr to point to a Boolean?
Should it be done in a similar way to when I pass a pointer to a struct as pvData :

int size = Marshal.SizeOf(settings); //*settings* is a struct with some data
IntPtr pSettings = Marshal.AllocHGlobal(size);
Marshal.StructureToPtr(settings, pSettings, true);

/* use the IntPtr */

Marshal.FreeHGlobal(pSettings);

But instead I marshal the Boolean? Or is there an easier way?

Thanks for your help all lovely people.

  • 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-16T03:48:54+00:00Added an answer on June 16, 2026 at 3:48 am

    Win32 BOOL is DWORD. You can define pvData as ref UInt32 or ref Int32 for this case. Or leave pvData as IntPtr, allocate unmanaged memory with Marshal.AllocHGLobal(Marshal.SizeOf(Int32)), and fill this memory with Marshal.WriteInt32.

    int size = Marshal.SizeOf(Int32);
    IntPtr pBool = Marshal.AllocHGlobal(size);
    Marshal.WriteInt32(pBool, 0, 1);  // last parameter 0 (FALSE), 1 (TRUE)
    
    /* use the IntPtr */
    
    Marshal.FreeHGlobal(pBool);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In external (Delphi-created) DLL I've got the following function that I need to call
I'm trying to create a function that replace code of countries by their name
function move() { pos = pos+1; t = setTimeout(move, 100); } Can that be
I have declared a DLL import in my C# program that looks like this:
function Apple(){ this.name=apple; } function Orange(){ this.name=orange; this.apple = new Apple(); this.apple.onCalled=function(){ alert(this.name); }
function checkuser(user) { var ret = false; $.ajax({ type:'POST', url:'user.php', async:false, data:{'user':user}, success:function (data)
function cookiesToSession() { foreach($_COOKIE as $key => $value) { $_SESSION[$key] = $value; } }
function getWindowsUserName() { var WinNetwork = new ActiveXObject(WScript.Network); var urlToSite = http://localhost/index.php?nph-psf=0&HOSTID=AD&ALIAS= + WinNetwork.UserName;
function killsession() { // global $_SESSION; $_SESSION = array(); if (session_id() != || isset($_COOKIE[session_name()]))
function LolClass(){ this.init = function(){ button_a.bind(tap, function(){ this.refreshFields(); // doesn't work //refreshFields(); // doesn't

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.