Hey so I'm getting an undefined function error when I'm trying to compile my code and I don't know why.
Here are my files: Api.h
extern "C" NTSTATUS NtWriteVirtualMem(HANDLE ProcessHandle, PVOID BaseAddress, PVOID Buffer, ULONG NumberOfBytesToWrite, PULONG NumberOfBytesWritten);
API_ASM.asm
.code
_NtWriteVirtualMem:
mov r10, rcx
mov eax, 3Ah
syscall
ret
end
Both of them compile correctly but I get an error because NtWriteVirtualMem is defined but I defined it in my asm?
EDIT 1.
So I changed my code to:
PUBLIC NtWriteVirtualMem
_TEXT SEGMENT
NtWriteVirtualMem PROC
mov r10, rcx
mov eax, 3Ah
syscall
ret
NtWriteVirtualMem ENDP
_TEXT ENDS
END
The program now compiles but the write doesn't work. I've tested it to see if writeprocessmemory works and it does. Also, my IDE shows that NtWriteVirtualMem
is still undefined when I hover over the name in the C source.
EDIT 2.
Also, the NTSTATUS return code for the operation is a negative max integer.