title: CreateRemoteThread: Memory Management
body: <p>I'm wondering about the <code>LPVOID lpParameter</code> parameter of the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms682437%28v=vs.85%29.aspx" rel="nofollow noreferrer">CreateRemoteThread</a> function. Because processes don't share memory, the remote thread can't access a struct in our process. So, does the function copy the parameter and manages it by it own or do we need to allocate memory with <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa366890%28v=vs.85%29.aspx" rel="nofollow noreferrer">VirtualAllocEx</a> and then call <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms681674%28v=vs.85%29.aspx" rel="nofollow noreferrer">WriteProcessMemory</a> to actually copy the struct into the remote process? </p>