Results 1 to 13 of 13

Thread: Memory/Process stuff

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2004
    Location
    USA
    Posts
    172

    Talking Memory/Process stuff

    Hello. I recently got VB.net and wow, it's so much better than VB 6. Beyond compare!

    I remember vb 6 couldn't multitask or handle processes or memory too well, it always crashed and stuff. VB.net seems to be better with that kind of stuff...

    I have a question though. I'm into the whole memory string stuff (like ArtMoney). Is there a way I can search the memory of a process for a string or a number or something? This type of stuff really interests me and it's really the only thing I don't know much about.

    Thanks,
    Jake


    P.S. I know i'm asking for probably a lot of code or something. If you can point me to some examples that would be great!

    Thanks again .

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Start from this class , read about it on MSDN help:
    System.Diagnostics.Process()

    for the memory stuff , I don't think .NET Framework classes will be any better than APIs .

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2004
    Location
    USA
    Posts
    172

    Re: Memory/Process stuff

    Thanks . I just remember, VB 6 crashed with the APIs and stuff.

  4. #4
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    Re: Memory/Process stuff

    Also System.Interop.Marshalling can be used here....
    I have some of the VB6 debugger converted to .NET but it needs much work

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jun 2004
    Location
    USA
    Posts
    172

    Re: Memory/Process stuff

    Hi, I don't seem to have any kind of System.Interop.Marshalling.. ..

  6. #6
    Fanatic Member
    Join Date
    Jun 2004
    Location
    All useless places
    Posts
    917

    Re: Memory/Process stuff

    I think <Interop> specifier works only for the COM components that are being used in a .Net solution

  7. #7
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622

    Re: Memory/Process stuff

    Could he have possibly meant:

    System.Runtime.InteropServices
    System.Runtime.InteropServices.Marshal
    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Jun 2004
    Location
    USA
    Posts
    172

    Re: Memory/Process stuff

    I figure it's not going to be anything in the .NET framework. It's basically something you can only do in C++, (or by using API's written in C++), because VB.NET and C#.NET are managed code, which means they can't access memory outside of it's own variables. If you try to access an index of an array that is past the Upper bound in VB or C#, you get an index out of bounds exception, but not in C++. In C++ you will get random values from the memory. Some of C++'s methods (not the .NET framework) can read and write memory outside of it's own allocated space. It involves the risk of memory fragmentation/corruption, though that can be fixed with an easy reboot . Basically, you need to use API's in C# and VB to perform such tasks. Now, I just need to figure out what API's. Does anybody know of some examples for searching memory for strings or something like that? Thanks

  9. #9
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Re: Memory/Process stuff

    Quote Originally Posted by xjake88x
    I figure it's not going to be anything in the .NET framework. It's basically something you can only do in C++, (or by using API's written in C++), because VB.NET and C#.NET are managed code, which means they can't access memory outside of it's own variables. If you try to access an index of an array that is past the Upper bound in VB or C#, you get an index out of bounds exception, but not in C++. In C++ you will get random values from the memory. Some of C++'s methods (not the .NET framework) can read and write memory outside of it's own allocated space. It involves the risk of memory fragmentation/corruption, though that can be fixed with an easy reboot . Basically, you need to use API's in C# and VB to perform such tasks. Now, I just need to figure out what API's. Does anybody know of some examples for searching memory for strings or something like that? Thanks
    Wrong! C#,specifically, can execute unmanaged code also like using pointers (in C\C++) using unsafe keyword .

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Jun 2004
    Location
    USA
    Posts
    172

    Re: Memory/Process stuff

    Well VB can execute unmanaged code thru APIs.. If C# can do it without API's then my MCSD .NET certification course is wrong .

  11. #11
    Frenzied Member ice_531's Avatar
    Join Date
    Aug 2002
    Location
    Sitting w/ Bob Status: -Next -To- Null- Friend: Philip
    Posts
    1,152

    Re: Memory/Process stuff

    MemoryCopy api.

    Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)

    or search msdn for RTLMOVEMEMORY
    :::`DISCLAIMER`:::
    Do NOT take anything i have posted to be truthful in any way, shape or form.
    Thank You!

    --------------------------------
    "Never heard about "hiking" poles. I usualy just grab a stick from the nature, and use that as a pole." - NoteMe
    "Finaly I can look as gay as I want..." - NoteMe
    Languages: VB6, BASIC, Java, C#. C++

  12. #12
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Re: Memory/Process stuff

    I'm sorry . I wasn't clear enough . When I said "unmanaged" I meant pointers . I know VB.NET (or even old VB6) can use APIs . Here's what C# can do but not VB.NET : http://msdn.microsoft.com/library/de...clrfUnsafe.asp

  13. #13
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622

    Re: Memory/Process stuff

    VB Code:
    1. 'Memory Copying
    2. System.Runtime.InteropServices.Marshal.Copy


    VB Code:
    1. 'Reading Memory
    2. System.Runtime.InteropServices.Marshal.ReadByte()
    3. System.Runtime.InteropServices.Marshal.ReadInt16()
    4. System.Runtime.InteropServices.Marshal.ReadInt32()
    5. System.Runtime.InteropServices.Marshal.ReadInt64()
    6. 'Writing
    7. System.Runtime.InteropServices.Marshal.WriteByte()
    8. System.Runtime.InteropServices.Marshal.WriteInt16()
    9. System.Runtime.InteropServices.Marshal.WriteInt32()
    10. System.Runtime.InteropServices.Marshal.WriteInt64()

    Edit: Clarified
    Last edited by <ABX; Jan 1st, 2005 at 10:42 PM.
    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width