diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2013-05-14 20:52:44 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2013-05-14 20:52:44 +0000 |
commit | b28379050fa05a1a6642548d9d31c4d7d2779815 (patch) | |
tree | fd93a62553e590851c22775ac15703af9efd6734 /protocols/Skype/src/skype_runtime.cpp | |
parent | 7babc5212cc846d2a7d1ffa964663dea497d3ef4 (diff) |
- added contact sending (via SendReceiveContacts) and receiving
- some few bug fixed
git-svn-id: http://svn.miranda-ng.org/main/trunk@4653 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype_runtime.cpp')
-rw-r--r-- | protocols/Skype/src/skype_runtime.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/protocols/Skype/src/skype_runtime.cpp b/protocols/Skype/src/skype_runtime.cpp index a9588d8ff1..be83b788ad 100644 --- a/protocols/Skype/src/skype_runtime.cpp +++ b/protocols/Skype/src/skype_runtime.cpp @@ -46,7 +46,7 @@ int CSkypeProto::StartSkypeRuntime(const wchar_t *profileName) STARTUPINFO cif = {0};
cif.cb = sizeof(STARTUPINFO);
cif.dwFlags = STARTF_USESHOWWINDOW;
- cif.wShowWindow = SW_HIDE;
+ cif.wShowWindow = SW_HIDE;
wchar_t fileName[MAX_PATH];
::GetModuleFileName(g_hInstance, fileName, MAX_PATH);
@@ -59,13 +59,15 @@ int CSkypeProto::StartSkypeRuntime(const wchar_t *profileName) PROCESSENTRY32 entry;
entry.dwSize = sizeof(PROCESSENTRY32);
+ // todo: rework
HANDLE snapshot = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
- if (::Process32First(snapshot, &entry) == TRUE) {
- while (::Process32Next(snapshot, &entry) == TRUE) {
- if (::wcsicmp(entry.szExeFile, L"SkypeKit.exe") == 0) {
- HANDLE hProcess = ::OpenProcess(PROCESS_ALL_ACCESS, FALSE, entry.th32ProcessID);
- this->runtimePort += rand() % 8963 + 1000;
- ::CloseHandle(hProcess);
+ if (::Process32First(snapshot, &entry) == TRUE)
+ {
+ while (::Process32Next(snapshot, &entry) == TRUE)
+ {
+ if (::wcsicmp(entry.szExeFile, L"SkypeKit.exe") == 0)
+ {
+ this->skypeKitPort += rand() % 1000 + 8963;
break;
}
}
@@ -73,21 +75,21 @@ int CSkypeProto::StartSkypeRuntime(const wchar_t *profileName) ::CloseHandle(snapshot);
wchar_t param[128];
- //PROCESS_INFORMATION pi;
VARST dbPath( _T("%miranda_userdata%\\SkypeKit"));
- ::swprintf(param, SIZEOF(param), L"-p -P %d -f \"%s\"", this->runtimePort, dbPath);
+ ::swprintf(param, SIZEOF(param), L"-p -P %d -f \"%s\"", this->skypeKitPort, dbPath);
int startingrt = ::CreateProcess(
fileName, param,
NULL, NULL, FALSE,
CREATE_NEW_CONSOLE,
- NULL, NULL, &cif, &this->pi);
+ NULL, NULL, &cif, &this->skypeKitProcessInfo);
return startingrt;
}
void CSkypeProto::StopSkypeRuntime()
{
- DWORD exitCode = 0;
- GetExitCodeProcess(this->pi.hProcess, &exitCode);
- TerminateProcess(this->pi.hProcess, exitCode);
+ ::TerminateProcess(this->skypeKitProcessInfo.hProcess, 0);
+ ::CloseHandle(this->skypeKitProcessInfo.hThread);
+ ::CloseHandle(this->skypeKitProcessInfo.hProcess);
+
}
\ No newline at end of file |