Questions tagged [createthread]

70 questions
0
votes
3 answers

C++ - CreateThread -compilation error

This is my first time dealing with windows. I tried to create thread, but I can't compile my code. This is a part of my code: WORD _tid; HANDLE readerThread= CreateThread(0,0,readFromPort,0,0,&_tid); DWORD WINAPI readFromPort(LPVOID lpParam ){} I…
kakush
  • 3,334
  • 14
  • 47
  • 68
0
votes
2 answers

Importance of ThreadId in CreateThread() c++

I have doubt regarding the CreateThread() function in C++. What is the importance of the threadId parameter in this function? And are we able to create same thread( same name) using the same threadId. like DWORD threadId = 0; …
Aneesh Narayanan
  • 3,220
  • 11
  • 31
  • 48
-1
votes
2 answers

C++ access SOCKET from outside created thread

I create a thread from the main thread void xui(PLDR_DATA_TABLE_ENTRY ModuleHandle){ ExCreateThread(&moduleHandle, 0, &threadId, ConnectSock , (LPTHREAD_START_ROUTINE)ConnectSock, NULL, 0x02); } the thread called DWORD WINAPI ConnectSock()…
ravi_elite
  • 11
  • 6
-1
votes
1 answer

Passing struct argument to CreateThread() and not receiving char* variable

I'm reflectively injecting a dll into another processes's memory, and I need to call CreateThread() obviously. I'm passing certain parameters to the dll that I'm injecting using my loader_data struct. I have certain variables I need to pass such as…
pangea
  • 3
  • 1
  • 4
-1
votes
1 answer

How pass parameters to ZwCreateThreadEx routine?

This code below working fine to create separated threads without pass any parameter of data types. Now i want know how i can pass parameters to method that executes when ZwCreateThreadEx is called? For example, how pass a HANDLE type and a type…
user9672569
-1
votes
1 answer

Why CreateThread dont work?

I am trying to inject this code in a PE file to run my program with CreateThread to run a keylogger in an PE file but CreateThread fails with 3E6h ERROR_NOACCESS error. Where is my eerror in my source code below? procedure: sub rsp, 28h …
-1
votes
2 answers

Passing parameter fail by CreateThread?

My Code like this starts is a array of DWORD32 threads is a array of HANDLE void initThreads(HANDLE* threads, int size) { DWORD32* starts = (DWORD32*)malloc(sizeof(DWORD32) * size); for (int i = 0; i < size; ++i) { starts[i] =…
CLS
  • 131
  • 9
-2
votes
1 answer

CreateThread ends with bad output

I'm making research work about multithreading. I'm using Win32Api for CreateThread. I have char array which contains 5 drive letters. I need to MessageBox these drives one by one. Here's my code: DWORD WINAPI Fun(LPVOID param) { const char* str =…
veter0
  • 23
  • 6
-2
votes
1 answer

C++ CreateThread() strange error

I try to use CreateThread() function in my application, but I get strange error, exactly: error: invalid conversion from 'DWORD (__ attribute__((__ stdcall__)) *)() {aka long unsigned int (__ attribute__((__ stdcall__)) *)()}' to…
Waxy
  • 11
  • 4
-4
votes
1 answer

How to create multiplethreads each with different ThreadProc() function using CreateThread()

I have successfully created a single thread using CreateThread(). Now I want to create 'n' number of threads but each with a different ThreadProc(). I have tried the following code but using it, 'n' number of threads are created all performing the…
Ayse
  • 2,676
  • 10
  • 36
  • 61
1 2 3 4
5