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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:19:53+00:00 2026-05-23T11:19:53+00:00

I need to port the inline assembler to be able to compile on x64.

  • 0

I need to port the inline assembler to be able to compile on x64.
I’m trying to get familiar with the x64 Intrinsics etc but I guess someone being into it could easily help me out.

void __stdcall Hook(P1, P2)
{
    __asm pushad

    static void* OriginalFunctionPointer =
        GetProcAddress(GetModuleHandleA("Some.dll"), "[...]");

    // [...]

    __asm popad

    __asm push (P2)
    __asm push (P1)
    __asm call (OriginalFunctionPointer)
}
  • 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-05-23T11:19:53+00:00Added an answer on May 23, 2026 at 11:19 am

    seems you need a hooking library like this one(or this if you want a C++ API) along with a function proto, then no inline assembly is needed, in 32 or 64-bit mode. also, those pushad/popad’s aren’t needed when you are doing inline assembly.

    typedef void (__stdcall*myfp)(int,int);
    void __stdcall MyHook(int arg1, int arg2)
    {
        static myfp TheFP = (myfp)GetProcAddress(GetModuleHandleA("Some.dll"), "[...]");
    
       //your extra code
       TheFP(arg1,arg2);
    }
    

    of course the injection of this hook needs to take place somewhere else.
    for hooking classes you need to account for the hidden this pointer (pDevice in this case):

    #define D3D8FUNC(name,...) typedef HRESULT (__stdcall * name)(__VA_ARGS__)
    D3D8FUNC(D3D8SetTexture,void* pDevice, DWORD dwStage, void* pTexture);
    
    HRESULT __stdcall D3DSetTexture(void* pDevice, DWORD dwStage, void* pTexture)
    {
        LOG("[D3DSetTexture][0x%p] Device: 0x%p Stage: %u Texture: 0x%p\n",_ReturnAddress(),pDevice,dwStage,pTexture);
        return Direct3D::gpfD3D8SetTexture(pDevice,dwStage,pTexture);
    }
    
    //in the init
    Direct3D::gpfD3D8SetTexture = System::VirtualFunctionHook<Direct3D::D3D8SetTexture>(Direct3D::gpDevice,61,D3DSetTexture);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a problem converting an inline assembler function to .asm file. I need
I need to port a screen capture utility to Linux. I'm not familiar with
I have application that use mysql database, but now i need to port it
I need to port my app from iPhone to blackberry, but I'm new in
I need to port the following from the ASP.NET MVC 2 sourcecode from C#
I have the following VB.net interface that I need to port to C#. C#
I have a win32 GUI (MFC) application which I need to port to a
I have a Django app that use a django-tagging. I need to port this
Hey can any one tell me should i need open a port for outgoing
I need to access COM port (console) via script to access our DSL modem.

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.