hello, i've got a big problem... i just work on a executable encryption routine that changes the encryption key after every restart but i've got very big problems with writing to my code-seg (in mem, this has nothing to do with writing to my executable...). i get no errors from the compiler but when i run this it crashes my windows... why? i deleted all uninteresting code, thats why this snippet makes no sense... it encrypts the "REAL" code with xor key 0 ->no encryption... so it should display me a msgbox and then exit after the DEcryption process... i would be very greatfull if someone could help me out... thank you. .DATA xor_key db 0 cap_msg db "test?",0 .CODE start: lea edi,start_of_code lea ecx,end_of_code sub ecx,edi mov al,xor_key decrypt: xor byte ptr ,al inc edi loop decrypt start_of_code: invoke MessageBox,NULL,addr cap_msg,addr cap_msg,MB_OK invoke ExitProcess,NULL end_of_code: END start
Posted on 2000-12-29 06:55:00 by drcmda
the code you posted will cause a gpf as you don't have write access to the code section by default. you can change that by either changing the access protection of you code section using virtualprotect (see your win32 programmer's reference) or by directly changing the section's flags in the pe header. tola
Posted on 2000-12-29 09:37:00 by tola
thank you very much... it works fine ;)
Posted on 2000-12-29 10:21:00 by drcmda
Hi ! You also can compile the exe with write access in the code section. E.g.: If .text is your code section then add this to your linker command: /SECTION:.text,EWR That's it. yoda
Posted on 2000-12-29 13:09:00 by yoda