15,979
社区成员
发帖
与我相关
我的任务
分享
int nResult = FALSE;
HWND hMain = NULL;
char szFile[MAX_PATH] = "D:\\xxx.xxxe";
DWORD dwBufSize = 0;//sizeof(DROPFILES) + sizeof(szFile) + 1;
BYTE *pBuf = NULL;
DWORD dwProcessId = 0;
HANDLE hProcess = 0;
LPSTR pszRemote = NULL;
DROPFILES *pDrop;
dwBufSize = sizeof(DROPFILES) + strlen(szFile) + 1;
pBuf = new BYTE[dwBufSize];
if (pBuf == NULL)
goto Exit0;
memset(pBuf,0,dwBufSize);
pDrop = (DROPFILES *)pBuf;
pDrop->pFiles = sizeof(DROPFILES);
strcpy((char *)(pBuf + sizeof(DROPFILES)), szFile);
hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_WRITE, FALSE, 11496);
if (hProcess == 0)
{
goto Exit0;
}
pszRemote = (LPSTR)VirtualAllocEx(hProcess, NULL, dwBufSize, MEM_COMMIT, PAGE_READWRITE);
if (NULL == pszRemote)
{
goto Exit0;
}
if(WriteProcessMemory(hProcess, pszRemote, pBuf, dwBufSize, 0))
{
::SendMessage((HWND)0x000A0B5A, WM_DROPFILES, (WPARAM)pszRemote, NULL);
}
else
{
goto Exit0;
}
nResult = TRUE;
Exit0:
if (pBuf)
{
delete [] pBuf;
pBuf = NULL;
}
return nResult;