flat assembler
Message board for the users of flat assembler.

Index > Heap > what am i doing wrong?

Author
Thread Post new topic Reply to topic
asmrox



Joined: 19 Jan 2008
Posts: 160
asmrox
Code:
#include <windows.h>
int main(){
int a, b;
if(a = OpenProcess(PROCESS_ALL_ACCESS, 0, 1168)){
while(1){
printf("%#.8x\n", b = VirtualAllocEx(a, 0, 4096, MEM_COMMIT, PAGE_EXECUTE_READWRITE));
printf("%#.8x\n--------\n", VirtualFreeEx(a, b, 4096, MEM_DECOMMIT));
}}
else puts("error");
return 0;
}    


results in killing proces cause out of memory space =(


Last edited by asmrox on 08 May 2008, 17:02; edited 1 time in total
Post 08 May 2008, 16:51
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17247
Location: In your JS exploiting you and your system
revolution
Here a few things you are doing wrong:
  • You are posting C code in an asm forum
  • You are not checking the return values from API calls for errors
  • You are using a fixed constant for the PID
  • You don't say which process is being killed. Your process or the victim?
Post 08 May 2008, 16:58
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Also, you are not using [code] tags around your code
Post 08 May 2008, 16:59
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
asmrox



Joined: 19 Jan 2008
Posts: 160
asmrox
Quote:
You are posting C code in an asm forum

Quote:
Everything not related to assembly programming should be posted here.


Quote:
You are not checking the return values from API calls for errors

Code:
printf("%#.8x\n", ...    



Quote:
You are using a fixed constant for the PID

n/c

Quote:
You don't say which process is being killed. Your process or the victim?

didnt though i have to say that... KILLED_PROCESS_PID == 1168
Post 08 May 2008, 17:04
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17247
Location: In your JS exploiting you and your system
revolution
Printing a return value is not checking a return value. while(1) exits how?
Post 08 May 2008, 17:13
View user's profile Send private message Visit poster's website Reply with quote
asmrox



Joined: 19 Jan 2008
Posts: 160
asmrox
i asked why process is beeing killed after allocating 32k+ pages of memory!
Post 08 May 2008, 17:20
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17247
Location: In your JS exploiting you and your system
revolution
What version of Windows? Maybe you should report it as a bug to MS Support.
Post 08 May 2008, 17:26
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17247
Location: In your JS exploiting you and your system
revolution
asmrox wrote:
i asked why process is beeing killed after allocating 32k+ pages of memory!
No you didn't, you asked what you were doing wrong. And myself and vid answered within that framework.
Post 08 May 2008, 17:27
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.