You want to learn about exploit get the book call shellcoder hand book.