简体   繁体   English

在“ opcode”中获取错误内联汇编器语法错误; 发现“恒定”

[英]Getting Error inline assembler syntax error in 'opcode'; found 'constant'

I got a simple code and it gives me a compiler error for no reason 我得到了一个简单的代码,它无缘无故地给了我一个编译器错误

inline assembler syntax error in 'opcode'; 'opcode'中的内联汇编语法错误; found 'constant' 发现“恒定”

DWORD connectFunctionAddressReturn = 0x775368F7;

int __cdecl ws2_32_connect_hook_output(SOCKET s, const struct sockaddr *name, int namelen) {
    struct sockaddr_in *in = (struct sockaddr_in *)connect_name;
    printf("Attempting connect %d.%d.%d.%d : %d\n", in->sin_addr.S_un.S_un_b.s_b1, in->sin_addr.S_un.S_un_b.s_b2, in->sin_addr.S_un.S_un_b.s_b3, in->sin_addr.S_un.S_un_b.s_b4, htons(in->sin_port));
}


void __declspec(naked) ws2_32_connect_hook(void) { //ws2_32.connect = 775368F5

    __asm {
        PUSHAD //To be in safe environment
        PUSHFD //To be safe environment

        PUSH 0x10
        PUSH DWORD PTR SS:[EBP+0x8]
        PUSH DWORD PTR DS:[ESI+0x14]
        CALL DWORD PTR ws2_32_connect_hook_output  //<-- ERROR HERE
        ADD ESP, 0xC //clean __cdecl,4,8,C

        POPFD //Finish being in safe environment
        POPAD //Finish being in safe environment
        JMP connectFunctionAddressReturn // <-- ERROR HERE
    }
}

solved it, I had CALL AND JMP defined so it errored in ASM code. 解决了它,我定义了CALL和JMP,所以它在ASM代码中出错。

#define CALL 0xE8
#define JMP 0xE9

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM