Author Topic: C# CopyMemory  (Read 8575 times)

0 Members and 3 Guests are viewing this topic.

Offline abc

  • Hero Member
  • *****
  • Posts: 576
    • View Profile
C# CopyMemory
« 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?

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: C# CopyMemory
« Reply #1 on: April 20, 2007, 05:17:25 pm »
CopyMemory is a Windows API call... just learn how to call API functions in C#.

Offline abc

  • Hero Member
  • *****
  • Posts: 576
    • View Profile
Re: C# CopyMemory
« Reply #2 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.

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: C# CopyMemory
« Reply #3 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."

Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: C# CopyMemory
« Reply #4 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.
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline abc

  • Hero Member
  • *****
  • Posts: 576
    • View Profile
Re: C# CopyMemory
« Reply #5 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.

Offline warz

  • Hero Member
  • *****
  • Posts: 1134
    • View Profile
    • chyea.org
Re: C# CopyMemory
« Reply #6 on: April 20, 2007, 09:28:18 pm »
You shouldn't need to use CopyMemory even without C#, most of the time.
http://www.chyea.org/ - web based markup debugger

Offline MyndFyre

  • Boticulator Extraordinaire
  • x86
  • Hero Member
  • *****
  • Posts: 4540
  • The wait is over.
    • View Profile
    • JinxBot :: the evolution in boticulation
Re: C# CopyMemory
« Reply #7 on: April 21, 2007, 12:27:39 am »
Since the people who have replied haven't posted the alternative to using CopyMemory, I will.  You want to use the BitConverter class.
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Our species really annoys me.

Offline abc

  • Hero Member
  • *****
  • Posts: 576
    • View Profile
Re: C# CopyMemory
« Reply #8 on: April 21, 2007, 11:14:40 am »
<3

Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: C# CopyMemory
« Reply #9 on: April 21, 2007, 12:05:40 pm »
Making him do a little homework. So what? :(
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline MyndFyre

  • Boticulator Extraordinaire
  • x86
  • Hero Member
  • *****
  • Posts: 4540
  • The wait is over.
    • View Profile
    • JinxBot :: the evolution in boticulation
Re: C# CopyMemory
« Reply #10 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.
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Our species really annoys me.