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

  • Home
  • SEARCH
  • 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 166265
In Process

The Archive Base Latest Questions

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

the code below(in C++) is what I am trying the convert into C# DWORD

  • 0

the code below(in C++) is what I am trying the convert into C#

DWORD Func_X_4(DWORD arg1, DWORD arg2, DWORD arg3) { LARGE_INTEGER result = {1, 0}; LARGE_INTEGER temp1 = {0}; LARGE_INTEGER temp2 = {0}; LARGE_INTEGER temp3 = {0}; LARGE_INTEGER temp4 = {0}; for(int x = 0; x < 32; ++x) {     if(arg2 & 1)     {         temp1.LowPart = arg3;         temp1.HighPart = 0;         temp2.QuadPart = temp1.QuadPart * result.QuadPart;         temp3.LowPart = arg1;         temp3.HighPart = 0;         temp4.QuadPart = temp2.QuadPart % temp3.QuadPart;         result.QuadPart = temp4.QuadPart;     }     arg2 >>= 1;     temp1.LowPart = arg3;     temp1.HighPart = 0;     temp1.QuadPart *= temp1.QuadPart;     temp2.LowPart = arg1;     temp2.HighPart = 0;     temp3.QuadPart = temp1.QuadPart % temp2.QuadPart;     arg3 = temp3.LowPart;     if(!arg2)         break; } return result.LowPart; } 

Here I tried to translate the code,but it’s too messy and I never worked with Large integers before.

Structure:

public struct LARGE_INTEGER {     UInt32 LowPart;     Int32 HighPart;     Int32 QuadPart; } 

Translated function:

    public Int32 Func_X_4(Int32 arg1, Int32 arg2, Int32 arg3)     {     LARGE_INTEGER result = {1, 0}; //this and the four below,are they correct?     LARGE_INTEGER temp1 = {0, 0};     LARGE_INTEGER temp2 = {0, 0};     LARGE_INTEGER temp3 = {0, 0};     LARGE_INTEGER temp4 = {0, 0};     for(int x = 0; x < 32; ++x)     {         if(arg2 & 1==0) //correct?         {             temp1.LowPart = arg3;             temp1.HighPart = 0;             temp2.QuadPart = temp1.QuadPart * result.QuadPart;             temp3.LowPart = arg1;             temp3.HighPart = 0;             temp4.QuadPart = temp2.QuadPart % temp3.QuadPart;             result.QuadPart = temp4.QuadPart;         }         arg2 >>= 1;         temp1.LowPart = arg3;         temp1.HighPart = 0;         temp1.QuadPart *= temp1.QuadPart;         temp2.LowPart = arg1;         temp2.HighPart = 0;         temp3.QuadPart = temp1.QuadPart % temp2.QuadPart;         arg3 = temp3.LowPart;         if(arg2 != 0) //correct?         break;     }     return result.LowPart; } 

Problems: The first problem is that I haven’t found a LARGE_INTEGER type variable in C#,so I created a strucure,I’d like to know if there is actually. As for the second problem,the function is not right,nothing worked.

Any help on that particular question will be greatfuly appreciated! Thank you in advance.

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

    A direct translation of the LARGE_INTEGER structure would be:

    [StructLayout(LayoutKind.Explicit, Size=8)] struct LARGE_INTEGER {     [FieldOffset(0)]public Int64 QuadPart;     [FieldOffset(0)]public UInt32 LowPart;     [FieldOffset(4)]public Int32 HighPart; } 

    It’s like a union in C, where QuadPart is an 8-byte value, with LowPart occupying the first 4 bytes and HighPart occupying the high 4 bytes.

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

Sidebar

Related Questions

Any help would be appreciated, I'm trying to convert the code below to C#,
In the code below I'm trying to load some images and put them in
I'm trying to use the code below to send messages via System.Net.Mail and am
So far i have got the code below which works lovely when trying an
In my code attached below, I'm trying to upload a file via ASP.NET. I
I am trying to convert a mysql DATETIME into this format m/d/y but the
Can anyone tell how correct the following code below. Iam tryin to create a
Code below does not run correctly and throws InvalidOperationExcepiton . public void Foo() {
Code below is not working as expected to detect if it is in design
The code below shows a sample that I've used recently to explain the different

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.