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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:32:00+00:00 2026-05-11T10:32:00+00:00

I have two questions.They both are concerning a void in C++,which I am trying

  • 0

I have two questions.They both are concerning a void in C++,which I am trying to translate in C#.

C++ code

void Func_X_2(LPBYTE stream, DWORD key, BYTE keyByte) { stream[0] ^= (stream[0] + LOBYTE(LOWORD(key)) + keyByte); stream[1] ^= (stream[1] + HIBYTE(LOWORD(key)) + keyByte); stream[2] ^= (stream[2] + LOBYTE(HIWORD(key)) + keyByte); stream[3] ^= (stream[3] + HIBYTE(HIWORD(key)) + keyByte); stream[4] ^= (stream[4] + LOBYTE(LOWORD(key)) + keyByte); stream[5] ^= (stream[5] + HIBYTE(LOWORD(key)) + keyByte); stream[6] ^= (stream[6] + LOBYTE(HIWORD(key)) + keyByte); stream[7] ^= (stream[7] + HIBYTE(HIWORD(key)) + keyByte); } 

First question:

DWORD is UInt32,BYTE is byte,but what is LPBYTE? How to use it as an array?

Second question:

How to use LOBYTE,HIBYTE,LOWORD,HIWORD in C#?

EDIT

This is how the function is being called: C++ code

Func_X_2((LPBYTE)keyArray, dwArgs[14], keyByte); 

keyArray is a DWORD(UInt32),dwArgs is an array of dword.KeyByte is a byte.

Thanks 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-11T10:32:01+00:00Added an answer on May 11, 2026 at 10:32 am

    LPBYTE is a pointer to a byte array. The equivalent in C# would be a variable of type byte[]. So you could translate your function like so:

    public static void Func_X_2(byte[] stream, int key, byte keyByte) {     stream[0] ^= (byte)(stream[0] + BitConverter.GetBytes(LoWord(key))[0]);     stream[1] ^= (byte)(stream[1] + BitConverter.GetBytes(LoWord(key))[1]);     stream[2] ^= (byte)(stream[2] + BitConverter.GetBytes(HiWord(key))[0]);     stream[3] ^= (byte)(stream[3] + BitConverter.GetBytes(HiWord(key))[1]);     stream[4] ^= (byte)(stream[4] + BitConverter.GetBytes(LoWord(key))[0]);     stream[5] ^= (byte)(stream[5] + BitConverter.GetBytes(LoWord(key))[1]);     stream[6] ^= (byte)(stream[6] + BitConverter.GetBytes(HiWord(key))[0]);     stream[7] ^= (byte)(stream[7] + BitConverter.GetBytes(HiWord(key))[1]); }  public static int LoWord(int dwValue) {     return (dwValue & 0xFFFF); }  public static int HiWord(int dwValue) {     return (dwValue >> 16) & 0xFFFF; } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.