diff --git a/cpp/mimis/.cproject b/cpp/mimis/.cproject deleted file mode 100644 index 276a595..0000000 --- a/cpp/mimis/.cproject +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cpp/mimis/.project b/cpp/mimis/.project index f1b2b27..ff367d2 100644 --- a/cpp/mimis/.project +++ b/cpp/mimis/.project @@ -1,27 +1,18 @@ - cpp.mimis + jlibmimis - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, + org.eclipse.jdt.core.javabuilder - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.springsource.ide.eclipse.gradle.core.nature + org.eclipse.jdt.core.javanature diff --git a/cpp/mimis/Debug/copy.bat b/cpp/mimis/Debug/copy.bat deleted file mode 100644 index 5cf0cbe..0000000 --- a/cpp/mimis/Debug/copy.bat +++ /dev/null @@ -1 +0,0 @@ -copy mimis.dll ..\..\..\java\mimis\mimis.dll \ No newline at end of file diff --git a/cpp/mimis/Release/copy.bat b/cpp/mimis/Release/copy.bat deleted file mode 100644 index 5cf0cbe..0000000 --- a/cpp/mimis/Release/copy.bat +++ /dev/null @@ -1 +0,0 @@ -copy mimis.dll ..\..\..\java\mimis\mimis.dll \ No newline at end of file diff --git a/cpp/mimis/Release/mimis.dll b/cpp/mimis/Release/mimis.dll deleted file mode 100644 index 1006621..0000000 Binary files a/cpp/mimis/Release/mimis.dll and /dev/null differ diff --git a/cpp/mimis/src/mimis.cpp b/cpp/mimis/src/mimis.cpp deleted file mode 100644 index 79eb8d3..0000000 --- a/cpp/mimis/src/mimis.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#include "mimis.h" -#include -#include - -bool getProcessEntry32(const char *program, PROCESSENTRY32 *pe32) { - HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); - if (hSnapshot == INVALID_HANDLE_VALUE) { - return false; - } - bool bFound = false; - while (Process32Next(hSnapshot, pe32) != false) { - if (strcmp(program, pe32->szExeFile) == 0) { - bFound = true; - break; - } - } - CloseHandle(hSnapshot); - return bFound; -} - -bool getProcess(const char *program, HANDLE *hProcess) { - PROCESSENTRY32 *pe32 = new PROCESSENTRY32; - bool bResult = false; - if (getProcessEntry32(program, pe32)) { - *hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, pe32->th32ProcessID); - bResult = true; - } - delete pe32; - return bResult; -} - -JNIEXPORT jint JNICALL Java_mimis_util_Native_getHandle(JNIEnv *env, jclass cls, jstring jwindow) { - const char *window = env->GetStringUTFChars(jwindow, 0); - return (int) FindWindow(window, NULL); -} - -JNIEXPORT jint JNICALL Java_mimis_util_Native_sendMessage(JNIEnv *env, jclass cls, jint handle, jint message, jint wParam, jint lParam) { - return SendMessage((HWND) handle, message, wParam, lParam); -} - -JNIEXPORT jint JNICALL Java_mimis_util_Native_postMessage(JNIEnv *env, jclass cls, jint handle, jint message, jint wParam, jint lParam) { - return PostMessage((HWND) handle, message, wParam, lParam); -} - -JNIEXPORT jint JNICALL Java_mimis_util_Native_mapVirtualKey(JNIEnv *env, jclass cls, jint map, jint type) { - return MapVirtualKey(map, type); -} - -JNIEXPORT jboolean JNICALL Java_mimis_util_Native_isRunning(JNIEnv *env, jclass cls, jstring jprogram) { - const char *program = env->GetStringUTFChars(jprogram, 0); - PROCESSENTRY32 *pe32 = new PROCESSENTRY32; - bool bRunning = getProcessEntry32(program, pe32); - delete pe32; - return bRunning; -} - -JNIEXPORT jboolean JNICALL Java_mimis_util_Native_terminate(JNIEnv *env, jclass cls, jstring jprogram) { - const char *program = env->GetStringUTFChars(jprogram, 0); - HANDLE *hProcess = new HANDLE; - bool bResult = false; - if (getProcess(program, hProcess)) { - bResult = TerminateProcess(*hProcess, 0); - } - delete hProcess; - return bResult; -} - -JNIEXPORT jstring JNICALL Java_mimis_util_Native_getValue(JNIEnv *env, jclass cls, jint registry, jstring jkey, jstring jname) { - const char *key = env->GetStringUTFChars(jkey, 0); - const char *name = env->GetStringUTFChars(jname, 0); - HKEY hKey; - char *value = NULL; - if (RegOpenKey((HKEY) registry, key, &hKey) == ERROR_SUCCESS) { - char nameBuffer[255]; - byte valueBuffer[255]; - DWORD dwNameSize = sizeof(nameBuffer); - DWORD dwValueSize = sizeof(valueBuffer); - int i = 0; - while (RegEnumValue(hKey, i++, nameBuffer, &dwNameSize, NULL, NULL, valueBuffer, &dwValueSize) == ERROR_SUCCESS) { - if (strcmp(name, nameBuffer) == 0) { - value = (char*) valueBuffer; - break; - } - dwNameSize = sizeof(nameBuffer); - } - } - RegCloseKey(hKey); - return env->NewStringUTF(value); -} diff --git a/cpp/mimis/src/mimis.h b/cpp/mimis/src/mimis.h deleted file mode 100644 index af79db2..0000000 --- a/cpp/mimis/src/mimis.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef MIMIS_H_ -#define MIMIS_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: mimis_util_Native - * Method: getHandle - * Signature: (Ljava/lang/String;)I - */ -JNIEXPORT jint JNICALL Java_mimis_util_Native_getHandle - (JNIEnv *, jclass, jstring); - -/* - * Class: mimis_util_Native - * Method: sendMessage - * Signature: (IIII)I - */ -JNIEXPORT jint JNICALL Java_mimis_util_Native_sendMessage - (JNIEnv *, jclass, jint, jint, jint, jint); - -/* - * Class: mimis_util_Native - * Method: postMessage - * Signature: (IIII)I - */ -JNIEXPORT jint JNICALL Java_mimis_util_Native_postMessage - (JNIEnv *, jclass, jint, jint, jint, jint); - -/* - * Class: mimis_util_Native - * Method: mapVirtualKey - * Signature: (II)I - */ -JNIEXPORT jint JNICALL Java_mimis_util_Native_mapVirtualKey - (JNIEnv *, jclass, jint, jint); - -/* - * Class: mimis_util_Native - * Method: isRunning - * Signature: (Ljava/lang/String;)Z - */ -JNIEXPORT jboolean JNICALL Java_mimis_util_Native_isRunning - (JNIEnv *, jclass, jstring); - -/* - * Class: mimis_util_Native - * Method: terminate - * Signature: (Ljava/lang/String;)Z - */ -JNIEXPORT jboolean JNICALL Java_mimis_util_Native_terminate - (JNIEnv *, jclass, jstring); - -/* - * Class: mimis_util_Native - * Method: getValue - * Signature: (Lmimis/value/Registry;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_mimis_util_Native_getValue - (JNIEnv *, jclass, jint, jstring, jstring); - -#ifdef __cplusplus -} -#endif -#endif