HANDLE hProcess; DWORD codebase = 0x0040000; DWORD oldattr; VirtualProtectEx(hProcess, LPVOID(codebase), 4096, PGAE_READWRITE, &oldattr); I want to convert this piece of C code to ASM and I converted it this way: .data hProcess dd ? codebase dd ? oldattr dd ? .code .... mov codebase, 400000h invoke VirtualProtectEx, hProcess, codebase, 4096, PAGE_READWRITE, addr oldattr and also tried this one: .data hProcess dd ? codebase dd ? oldattr dd ? .code .... mov codebase, 400000h invoke VirtualProtectEx, hProcess, addr codebase, 4096, PAGE_READWRITE, addr oldattr In both ways GetLastError returns ErrCode 57h or Invalid Parameter. So what have I to do? 10x in Advance +ZergoMan
Posted on 2001-02-14 00:33:00 by +ZergoMan
mov codebase, 400000h invoke VirtualProtectEx, hProcess, codebase, 4096, PAGE_READWRITE, addr oldattr By looking at the C code, don't you give too many "0" in codebase?
Posted on 2001-02-14 02:00:00 by Iczelion
@@Done: cmp hMyProcess, 0 je @@NotFound mov region, 400000h invoke VirtualProtectEx, hMyProcess, region, 4096, PAGE_READWRITE, addr oldattr invoke GetLastError invoke VirtualProtectEx, hMyProcess, region, 4096, oldattr, addr oldattr @@NotFound: This is directly copied from my source and GetLastError returns 57h. Any other ideas... +ZergoMan
Posted on 2001-02-14 12:38:00 by +ZergoMan
As Icz said, your C code in the first post gives: codebase = 0x40000 you have too many 0s in your assignment ;) mov region, 40000h ;not 400000h !!! Mirno
Posted on 2001-02-14 13:15:00 by Mirno
The problem is not in the count of the 0s. I'm retrieving the base address from SoftIce and it's the right one. I tryed with one zero less but again there is this error 57. if you are going to post a reply please try it yourself before writing anything... 10x in advance +ZergoMan
Posted on 2001-02-15 09:13:00 by +ZergoMan