Announcement

Collapse
No announcement yet.

MemoryEx: Function pointer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MemoryEx: Function pointer

    How do I get a pointer or a function compatible with this? (have LH compiler)

  • #2
    That was supposed to read "How do I get a pointer to a function compatible with this?"

    Comment


    • #3
      If you have a dll with that function in there, use;
      Code:
      local lpFunction = hLibrary:GetProcAddress_("FunctionName");
      If you want to create a function with MemoryEx, you could use the Assembler. A
      function you assembled, will be an actual function you can use in these kinds of
      operations.

      To get the pointer of an assembled function, use
      Code:
      local lpFunction = hAssembled.ptr
      Bas Groothedde
      Imagine Programming :: Blog

      AMS8 Plugins
      IMXLH Compiler

      Comment


      • #4
        thanks, you would not happen to have a basic MessageBox example or similar for using the assembler? I assume its stuff like this but obviously using it through Memory Ex would be different.

        Comment


        • #5
          Here's one way;
          Code:
          ASM.Initialize();
          user32 = Library.Load("user32.dll");
          mbox = user32:GetProcAddress_("MessageBoxA");
          local hASM = ASM.Assemble([[
          	USE32
          	ORG		100h
          	
          	PUSH	EBP
          	MOV		EBP, ESP
          	
          	PUSH	DWORD [EBP + 20]
          	PUSH	DWORD [EBP + 16]
          	PUSH	DWORD [EBP + 12]
          	PUSH	DWORD [EBP + 8]
          	
          	MOV		EAX, DWORD ]]..mbox..[[ 
          	CALL	EAX
          	
          	POP 	EBP
          	
          	RETN
          ]])
          
          hASM(Application.GetWndHandle(), "Hello World!", "Title", 68);
          local ptr = hASM.ptr;
          However, the dependency MessageBoxA, when you assemble using IMXLH you can
          have IMXLH automatically get the dependencies for you.
          Bas Groothedde
          Imagine Programming :: Blog

          AMS8 Plugins
          IMXLH Compiler

          Comment


          • #6
            thanks again :yes

            Comment

            Working...
            X
            😀
            🥰
            🤢
            😎
            😡
            👍
            👎