I was curious on how to access the lparam passed with CreateThread in windows, I call the function as such:
push 0
push 0
push Temp
push printOne_t
push 9
push 0
call _CreateThread
9 for the stack size because I was only going to call a printf function in printOne_t which uses 8 bytes; How do I get the value of Temp inside printOne_t? I thought i'd have something to do with ebp but I just don't know anymore.
I'm asking because I need to create a thread for every client that connects to my server and I'll need a different SocketHandle for every socket. When I create the thread I'll need that function to be able to work with the involved SocketHandle ( which would obviously be lparam)
HANDLE WINAPI CreateThread(
_In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
_In_ SIZE_T dwStackSize,
_In_ LPTHREAD_START_ROUTINE lpStartAddress,
_In_opt_ LPVOID lpParameter,
_In_ DWORD dwCreationFlags,
_Out_opt_ LPDWORD lpThreadId
);
Link :
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682453%28v=vs.85%29.aspxJust so you don't have to search it ^^
I thought of a temporary solution.
I'll just push the new socket handle before pushing the params to createthread and then in the function createthread points to simply pop them the appropriate position in my dynamic array
I'll test it and post the results ^^
I just realised this wouldn't work because I'd need the value to remain constant :/