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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:35:28+00:00 2026-05-17T02:35:28+00:00

I was handed down a library that was developed in house as a wrapper

  • 0

I was handed down a library that was developed in house as a wrapper for BITS. I was told that if you wanted to change between the 64bit and 32bit build you would need to swap out these two commented lines.

[StructLayout(LayoutKind.Explicit, Size = 8, Pack = 4)]  //32 bit address
internal struct BG_BASIC_CREDENTIALS
{
    [FieldOffset(0)]
    [MarshalAs(UnmanagedType.LPWStr)]
    public string UserName;

    [FieldOffset(4)]
    [MarshalAs(UnmanagedType.LPWStr)]
    public string Password;
}


//[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)]  //64 bit address
//internal struct BG_BASIC_CREDENTIALS
//{
//    [FieldOffset(0)]
//    [MarshalAs(UnmanagedType.LPWStr)]
//    public string UserName;

//    [FieldOffset(8)]
//    [MarshalAs(UnmanagedType.LPWStr)]
//    public string Password;
//}

This just does not sit right with me, was the person who I got this from doing the right thing (this code is deployed on both 32 and 64 machines using the swapped comment trick so I know it works). If this is what needs to be done is there any way to make it so the comment does not need to be manually adjusted every time a 32 or 64 bit build is done? (or a way to make this dll target cpu all compatible)

Link to the MSDN of the datatype

  • 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-05-17T02:35:29+00:00Added an answer on May 17, 2026 at 2:35 am

    You don’t need todo any x64/x86 tricks, here is the pinvoke of the struct

    [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
    struct BG_BASIC_CREDENTIALS
    {
      public string UserName;
      public string Pssword;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There's an application I've had handed down to me that shows PDFs, and stores
I encountered a problem when running some old code that was handed down to
I'm working with a matlab code package that was handed down to me. It
I have been handed this project that has a large number of issues with
I'm being handed some data which is not well defined and subject to change
I've just been handed an API that seems to be a step up from
I've been tracking down a really insidious bug at work. The event that seems
After several years of following the bad practice handed down from 'architects' at my
So I have this black box authentication method, handed down to me from the
I've taken over a mixed PHP4/PHP5 project which has been handed down from developer

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.