Native programma list.exe grondig aangepast. Command line param w geeft lijst met handle, pid en titel, command line param p geeft lijst met pid en process naam (exe). Let op: nog aanpassen in java native class!

This commit is contained in:
2011-06-10 09:46:07 +00:00
parent 954bd90f1e
commit 3ad2653145
9 changed files with 53 additions and 91 deletions

View File

@@ -1,19 +1,62 @@
#include <windows.h>
#include <iostream>
#include <tlhelp32.h>
#include <tchar.h>
BOOL CALLBACK EnumProc(HWND hWnd, LPARAM lParam);
BOOL GetProcessList();
using namespace std;
BOOL CALLBACK EnumProc(HWND hWnd, LPARAM lParam);
int main() {
EnumWindows(EnumProc, 0);
return 0;
int main(int argc, char **argv) {
if (argc == 2) {
if (*argv[1] == 'w') {
printf("handle\tpid\ttitle\n");
EnumWindows(EnumProc, 0);
return 0;
} else if (*argv[1] == 'p') {
printf("pid\tname\n");
GetProcessList();
return 0;
}
}
return 1;
}
BOOL CALLBACK EnumProc(HWND hWnd, LPARAM lParam) {
TCHAR title[500];
ZeroMemory(title, sizeof(title));
GetWindowText(hWnd, title, sizeof(title) / sizeof(title[0]));
printf("%d\n%s\n", hWnd, title);
return TRUE;
DWORD processId;
GetWindowThreadProcessId(hWnd, &processId);
TCHAR title[500];
ZeroMemory(title, sizeof(title));
GetWindowText(hWnd, title, sizeof(title) / sizeof(title[0]));
printf("%d\t%d\t%s\n", hWnd, processId, title);
return TRUE;
}
BOOL GetProcessList() {
HANDLE hProcessSnap;
HANDLE hProcess;
PROCESSENTRY32 pe32;
hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hProcessSnap == INVALID_HANDLE_VALUE) {
return FALSE;
}
pe32.dwSize = sizeof(PROCESSENTRY32);
if(!Process32First( hProcessSnap, &pe32 ) ) {
CloseHandle(hProcessSnap);
return FALSE;
}
do {
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID);
if( hProcess != NULL ) {
CloseHandle( hProcess );
}
printf("%d\t%s\n", pe32.th32ProcessID, pe32.szExeFile);
} while (Process32Next(hProcessSnap, &pe32));
CloseHandle( hProcessSnap );
return TRUE;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,81 +0,0 @@
% Configfile_begin
% config file for wiiscan
% all usb device ids, not used yet in the scanning
all_usb_hubs=""
% single power controlling usb hub, only nessesary when powerering over usb, for automatic resetting. If not used, put ""
% active_usb_hub="@PCI\VEN_8086&DEV_2934&SUBSYS_20F017AA&REV_03\3&B1BFB68&0&E8"
active_usb_hub=""
% a list of allowed wiimotes in the form xx:xx:xx:xx:xx:xx, wildcard match is 00:00:00:00:00:00
%allowed_wiimote_adr=00:00:00:00:00:00
% my set of wiimotes
allowed_wiimote_adr=00:19:?D:??:6?:?? 00:1F:C5:??:??:?? 00:17:AB:39:69:87
% launching exe file have a problem with spaces, hence renamed exe, replaced space with underscores
% The original Johnny Chung Lee wb software version 0.3, downloaded from [http://johnnylee.net/projects/wii/]
% may not work yet, missing library integration
%whiteboard_software="d:/WiimoteWhiteboard/WiimoteWhiteboard_v0.3.exe"
% same stuff, but binary build from sources and redistributed in this package
whiteboard_software="WiimoteWhiteboard.exe"
% Boon Jin's wb software version 0.6, does not work yet, missing library integration
%whiteboard_software="d:/wsb/WiimoteSmoothboard.exe"
% wiiscan parameters
%option_device="Nintendo RVL-CNT-01"
% number of bt scanning attempts in a autoscan, timout is increased for every scan as retryattempt*option_timeout
option_scanretries=1
% long time (4000 and above, or increase option_scanretries) when matching name, short (1000-2000) when matching address
option_timeout=4000
% wiimote scanning time, only applicable used for wiilib
option_wiitimeout=1000
% delay bewteen powerdown/up, see man for details
option_usbsleep=1000
option_usbmsleep=1000
%option_btsleep=2000
% start wb at successfull connect, 0 or 1
option_startwhiteboard=1
% output verbose flag, 0 or 1
option_debug=1
% logging output file, put nothing if no logging is wanted
option_logfile=wiiscan_log.txt
%option_logfile=
% wiimote connection library, use none, wiiuse, or wiimotelib
option_wiilib=wiimotelib
% 0=no power cycle, 1=USB hub control, 2=USBm IO, 3=USB Devcon
option_usbpowermode=3
% 0=remove if not connectable, 1=always remove, 2=never remove
%option_forceremove=0
% bt radio to use, not working yet
%option_btradio=00:50:B6:A0:48:8C
% wiiscantray options
% number of connection attempts before autoscan i restarted
option_tray_pool_retries=2
% retry sleep, keep it low (<1000) to catch an open connection
option_tray_sleep_between_pool_retries=250
% sleep bewteen polls, when wiimote is succeful connected, keep it hight (>2000) to avoid to much CPU usage
option_tray_sleep_between_pool_loops=2000
% final connection step reqires some sleep before windows PnP is ready
option_sleep_before_final_connect=1500
% delay after launch of wb software, keep it at a medium value (2000-10000)
option_sleep_after_startwhiteboard=4000
% Configfile_end

Binary file not shown.