I do understand what an APC is, how it works, It works fine in exe. though it 's not working in dll once I copy the whole code into dll. Here is the code snippet below.
...
typedef struct
{
LPCSTR lpCmdLine;
UINT uCmdShow;
}test;
typedef UINT(WINAPI *WINEXEC)(LPCSTR, UINT);
HMODULE hModule = GetModuleHandleA("kernel32.dll");
LPVOID pFunc1 = GetProcAddress(hModule, "WinExec");
((WINEXEC)pFunc1)("notepad.exe", SW_SHOW);
test a = { "notepad.exe", SW_SHOW };
...
hThread = OpenThread(THREAD_ALL_ACCESS, FALSE, TID);
QueueUserAPC((PAPCFUNC)pFunc1, hThread , (ULONG_PTR)&a);
..
please help me to resolve this issue. Looking forward to hearing back from you soon.
Rose It seems APC is pretty obvious at the moment, let me check in the evening when I back from work. Have you ever checked the address of the functions you used for the importing in dll vs exe? Best Regards.