Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3027

__asm equivalent for 64 bit?

$
0
0
Hi, I am trying to compile killtt (http://www.codeproject.com/Articles/...-More-Tooltips) for 64 bit Windows (since 32 bit version doesnt kill tooltips in 64 bit applications) with Visual Studio 6 but I dont know almost nothing about programming (only had contact with Pascal while in school).

I read from here (http://www.zabkat.com/blog/26Oct08-x...6-and-ATL3.htm
https://vcpptips.wordpress.com/tag/c...-into-unicode/) how to compile for 64 bit with Visual Studio 6 and how to convert project to unicode and I think I changed everything compiler was showing as error except __asm part which is not supported in 64 bit. I dont even know what it does (but I guess its related to unloading dll from process since if killtt is compiled without that part it just crashes window instead of killing tooltips) and I wouldnt know how to rewrite that, so if some expert could help me with their knowledge I would be very grateful. Thanks in advance.

ttproc.asm
Code:

        // lParam
        // wParam
        // uMsg
        // hwnd
        // Return Address
        // Old EBP            <-EBP
        __asm {
                push ebp

                mov eax, 0xFFFFFFFF // DllPresent flag
                cmp dword ptr[eax], 0
                je retold
                mov eax, 0x88888888 // Hooking flag
                cmp dword ptr[eax], 0
                je retold

                mov ebp, esp
                mov eax, dword ptr[ebp + 12]

                cmp eax, TTM_POPUP
                je ret0
                cmp eax, TTM_TRACKACTIVATE
                je ret0
                cmp eax, TTM_TRACKPOSITION
                je ret0
                cmp eax, TTM_RELAYEVENT
                je ret0
                cmp eax, TTM_ACTIVATE
                je ret0

                cmp eax, WM_NCDESTROY
                jne retold

// lParam            // thisptr                    4
// wParam            // 0                          8
// uMsg              // GetProcessHeap            12
// hwnd              // Return Address            16
// Return Address    // lParam                    20
// Old EBP            // wParam                    24
                      // uMsg                      28
                      // hwnd                      32
                      // HeapFree                  36
                      // Old EBP                    40

                add ebp, 24

                mov dword ptr[ebp - 28], eax  // Move uMsg

                mov eax, dword ptr[ebp - 16]  // Move hwnd
                mov dword ptr[ebp - 32], eax

                mov dword ptr[ebp - 36], 0xCCCCCCCC // Store HeapFree

                mov eax, dword ptr[ebp - 24] // Move EBP
                mov dword ptr[ebp - 40], eax

                mov eax, dword ptr[ebp - 8] // Move wParam
                mov dword ptr[ebp - 24], eax

                mov eax, dword ptr[ebp - 20] // Move Return Address
                mov dword ptr[ebp - 16], eax

                mov eax, dword ptr[ebp - 4] // Move lParam
                mov dword ptr[ebp - 20], eax

                mov dword ptr[ebp - 12], 0xDDDDDDDD // Store GetProcessHeap
                mov dword ptr[ebp - 8], 0 // Store 0
                mov dword ptr[ebp - 4], 0xEEEEEEEE // Store ThisPtr

                sub esp, 16
retold:
                pop ebp
                pop eax
                push 0xAAAAAAAA    // Old window proc
                push eax
                mov eax, 0xBBBBBBBB  // CallWindowProc
                jmp eax

ret0:
                xor eax, eax
                pop ebp
                ret 16

killtt_helper.cpp __asm part
Code:

DWORD WINAPI WaitForUnload(LPVOID lpParameter)
{
        HANDLE hEvent = CreateEvent(NULL, TRUE, FALSE, (LPCTSTR)L"KillTT_DLLUnloadEvent");

        while(WaitForSingleObject(hEvent, INFINITE) != WAIT_OBJECT_0) {}

        CloseHandle(hEvent);

        __asm {
                push 0
                push lpParameter
                push ExitThread
                push FreeLibrary
                ret
        }

        return 0;
}

Attached Files

Viewing all articles
Browse latest Browse all 3027

Latest Images

Trending Articles



Latest Images