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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:37:45+00:00 2026-06-01T07:37:45+00:00

I have the C source code of a keygen to generate Master Codes for

  • 0

I have the C source code of a keygen to generate “Master Codes” for Dell locked BIOSes.

Tried hard, hard to understand it, and got various results after many weeks of reading and asking.

However, there are many things that I don’t know how to write them in C# code, which is my goal, for adventure and academic purposes.

For example, I say unsigned char outData[16] on C

In C# I rewrote this as follows:

byte* outData = stackalloc byte[16];

By this way, the byte values stored on C# are of the same size on RAM as a unsigned char on C (based on http://bytes.com/topic/c-sharp/answers/658913-unsigned-char)

Then I can do the following in C#:

int* testPointer = (int*) outData;
*testPointer = 0x67452301;

By doing that, I’ve modified the positions 0, 1, 2 and 3 of outData (byte is a quarter of a int on C# (8 bits vs 32 bits), same relation as unsigned char and int on C if I’m not wrong).

All the above thing of byte outData and testPointer thing could be done by this way on C:

unsigned char outData[16];
*(int *)(&outData[0]) = 0x67452301;

And then again, positions 1, 2, 3 and 4 of outData are changed (indexes starts from 1 in this case because it’s C, not C#).

So, done technically, change values of a unsigned char with a 32 bit integer pointer, ported to C#, and it technically must give same results as on C.

Now, I want to change the values of outData from a function on C# via a 32 bit int pointer, but, I won’t to give it as a parameter. So, only one solution, make outData a global variable. Then comes the big trouble… if i put outData as global, it must be contained in a class or a struct if it isn’t in a method (variables on methods aren’t and can’t be globals as long as I know).

If I do that global outData thing via struct/class (only way as per I know), outData becomes a managed data type and it moves from here to there on RAM due to the GC (GarbageCollector), and using pointers to outData becomes a bigger trouble. So, here comes the fixed statement for help to put temporarily outData on a fixed place on RAM, but also with a trouble, casting is not allowed on fixed statements, and then I can’t do this: int* testPointer = (int*) outData;, where outData has another block size than testPointer and casting is needed.

Said all the previous stuff, comes the real question. How can I change the values of outData from a function on C#, via a 32 bit int pointer? OR… What algorithm can I use to make these changes to outData whitout using pointers, and supposing that outData would become a standard value type that doesn’t needs unsafe contexts?

Really would love much, much more answers for second question, because the real objective that I want to accomplish is port C code to C#, and use a OO (Object Oriented) paradigm.

I’m going crazy to trying to understand a algorithm to make those changes of values stored on RAM via pointers and using different block sizes, and just have a method to do this and be pointers-free to be ready to use on C# and others OO programming languages.

Anticipated thanks for any answer!

And, for reference, here is the complete C code of the program that I wanna port:

http://pastebin.com/w8VQjVBu

I’ve done around 40% porting, those C functions going to pointers, different block sizes and that stuff has been really a pain on the %*& for weeks!

  • 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-01T07:37:47+00:00Added an answer on June 1, 2026 at 7:37 am

    It sounds like you’re trying to copy the value of 32 bit int into the first four bytes of a byte array.

    To do that use the BitConverter.GetBytes method and copy the resulting bytes to your other array:

    var n = 0xFAFBFCFD;
    var a = new byte[16];
    var temp = BitConverter.GetBytes(n);
    temp.CopyTo(a, 0);
    

    Now:

    a[0] == 0xFD
    a[1] == 0xFC
    a[2] == 0xFB
    a[3] == 0xFA
    

    Like some of the comments say, it’s a bad idea to try to write C# as if it were C.

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

Sidebar

Related Questions

I have this source code where I got it from net tutsplus. I have
I have lots of source code files. I have lots of hard coded string.
I have a source code that is needed to be converted by creating classes,
I have some source code to get the file name of an url for
I have this source code from 2001 that I would like to compile. It
I have standard source code package under Linux which requires to run ./configure make
I have this source code: idx=0 b=plt.psd(dOD[:,idx],Fs=self.fs,NFFT=512) B=np.zeros((2*len(self.Chan),len(b[0]))) B[idx,:]=20*log10(b[0]) c=plt.psd(dOD_filt[:,idx],Fs=self.fs,NFFT=512) C=np.zeros((2*len(self.Chan),len(b[0]))) C[idx,:]=20*log10(c[0]) for idx
I have java source code in a text file. There has to be entered
I have an installer for which I don't have any source code. I need
Let's say I have created a program in C/C++ and have a source code.

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.