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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:35:11+00:00 2026-05-11T12:35:11+00:00

I have yet to find a good reference on this topic. For this example

  • 0

I have yet to find a good reference on this topic. For this example we will take some C++ code that I’m trying to port over to C#.

In C++ land we have the following prototype for an external library function:

extern 'C' DWORD EXPORT FILES_GetMemoryMapping(   PSTR pPathFile,   PWORD Size,   PSTR MapName,   PWORD PacketSize,   PMAPPING pMapping,   PBYTE PagesPerSector); 

and in it is used like such:

FILES_GetMemoryMapping((LPSTR)(LPCTSTR)MapFile, &Size, (LPSTR)MapName, &PacketSize, pMapping, &PagePerSector); 

Now I’m trying to port the first line over to C# and here is where I’m presented with no clear path.

This is what I’ve got so far:

[DllImport('Files.DLL')] public static extern uint FILES_GetMemoryMapping(     [MarshalAs(UnmanagedType.LPStr)]     string pPathFile,     out ushort Size,     [MarshalAs(UnmanagedType.LPStr)]     string MapName,     out ushort PacketSize,     IntPtr pMapping,     out byte PagesPerSector); 

Now the question is: Is there any good guide out there that tells me a ‘PSTR pPathFile’ should be ‘[MarshalAs(UnmanagedType.LPStr)] string pPathFile’ … Assuming that is correct?

Or, a that a pointer to a ‘PMAPPING’ struct becomes a ‘out IntPtr pMapping’ … assuming that is correct?

Any help on this one guys?

  • 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. 2026-05-11T12:35:11+00:00Added an answer on May 11, 2026 at 12:35 pm

    I have yet to find a good reference on this topic

    Here you go.

    Oddly, the site is down at the moment, but it’s a very good resource for marshalling problems. In the mean time, you can use Archive.net’s archive of pinvoke.net at http://web.archive.org/web/20080202041852/http://www.pinvoke.net

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

Sidebar

Ask A Question

Stats

  • Questions 121k
  • Answers 121k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I can think of at least 3 ways: You can… May 12, 2026 at 12:30 am
  • Editorial Team
    Editorial Team added an answer Reflection is slow because you are querying the assembly's metadata… May 12, 2026 at 12:30 am
  • Editorial Team
    Editorial Team added an answer __git_ps1 is from git-completion.bash. In zsh you probably have to… May 12, 2026 at 12:30 am

Related Questions

One thing I've run into a few times is a service class (like a
Reading about the G.729 codec , I found this interesting tidbit about Comfort Noise
I built a Winform app several months ago that schedules appointments for repair techs.
I'm after a definitive reference to what ASP.NET code is required to disabled browsers

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.