Clan x86

Technical (Development, Security, etc.) => General Programming => Topic started by: abc on April 20, 2007, 04:57:13 pm

Title: C# CopyMemory
Post by: abc on April 20, 2007, 04:57:13 pm
In C#, How would I go about using the CopyMemory API, I have the CopyMemory API in Visual Basic 6.

Any links?
Title: Re: C# CopyMemory
Post by: Sidoh on April 20, 2007, 05:17:25 pm
CopyMemory is a Windows API call... just learn how to call API functions in C#.
Title: Re: C# CopyMemory
Post by: abc on April 20, 2007, 05:26:24 pm
Er, I googled tons, I never found a decent tutorial. All I've got is

Code: [Select]
[DllImport("kernel32")]
heh.
Title: Re: C# CopyMemory
Post by: Sidoh on April 20, 2007, 05:33:54 pm
http://www.csharphelp.com/archives/archive79.html

First result in the list of results for "C# Windows API."
Title: Re: C# CopyMemory
Post by: Warrior on April 20, 2007, 06:44:45 pm
What are you using CopyMemory for? Please don't tell me it's for any kind of Packet Buffer. It's completely unnecessary.

Directly porting things from non .NET to .NET should be done with care to avoid doing more work than you should.
Title: Re: C# CopyMemory
Post by: abc on April 20, 2007, 07:32:17 pm
You're right Warrior, Thanks, I think I remember some thread on vL about not using CopyMemory now.
Title: Re: C# CopyMemory
Post by: warz on April 20, 2007, 09:28:18 pm
You shouldn't need to use CopyMemory even without C#, most of the time.
Title: Re: C# CopyMemory
Post by: MyndFyre on April 21, 2007, 12:27:39 am
Since the people who have replied haven't posted the alternative to using CopyMemory (http://forum.valhallalegends.com/index.php?topic=15794.msg159080#msg159080), I will.  You want to use the BitConverter (http://msdn2.microsoft.com/en-us/library/system.bitconverter.aspx) class.
Title: Re: C# CopyMemory
Post by: abc on April 21, 2007, 11:14:40 am
<3
Title: Re: C# CopyMemory
Post by: Warrior on April 21, 2007, 12:05:40 pm
Making him do a little homework. So what? :(
Title: Re: C# CopyMemory
Post by: MyndFyre on April 23, 2007, 04:31:10 am
Making him do a little homework. So what? :(
Neither you nor Sidoh provided even a hint as to how to do this appropriately.  I know you specifically knew the right answer.

Referencing the BitConverter class still makes him do homework.