c++ - writing in memory after reserving and committing memory using virtualAlloc -
i new c++. have written c++ code (visual basic c++) reserves , commits memory using virtual alloc following https://msdn.microsoft.com/en-us/library/windows/desktop/aa366803%28v=vs.85%29.aspx . problem need write whole page have pattern 'a'.should use loop or memcopy or memmove ? have used getsysteminfo page size 4096. how can it. have modify chunk?
for (i=0; < pagelimit*dwpagesize; i++) { __try { // write memory. lpptr[i] = 'a'; } any appreciated.
neither memcpy or memmove seems suited task @ hand.
obvious choices memset, std::fill, std::fill_n, or for loop.
of those, memset works if , if want fill memory char-sized items. personally, i'd use std::fill_n.
Comments
Post a Comment