Using CopyMem service to replace the "while" loop for the memory copy