mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-29 00:30:04 +02:00
Added check for running tomahawk.exe process and option to kill the process (or ignore) and proceed.
This commit is contained in:
8
admin/win/nsi/nsis_processes/src/StdAfx.cpp
Executable file
8
admin/win/nsi/nsis_processes/src/StdAfx.cpp
Executable file
@@ -0,0 +1,8 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// KillProcDLL.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: reference any additional headers you need in STDAFX.H
|
||||
// and not in this file
|
34
admin/win/nsi/nsis_processes/src/StdAfx.h
Executable file
34
admin/win/nsi/nsis_processes/src/StdAfx.h
Executable file
@@ -0,0 +1,34 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#if !defined(AFX_STDAFX_H__780690DC_E128_403D_BC07_780D1B2CC101__INCLUDED_)
|
||||
#define AFX_STDAFX_H__780690DC_E128_403D_BC07_780D1B2CC101__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <string> // String management...
|
||||
|
||||
//From exam28.cpp
|
||||
#include <tlhelp32.h>
|
||||
//#include <iostream.h>
|
||||
|
||||
#ifdef BORLANDC
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
//To make it a NSIS Plug-In
|
||||
#include "exdll.h"
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_STDAFX_H__780690DC_E128_403D_BC07_780D1B2CC101__INCLUDED_)
|
37
admin/win/nsi/nsis_processes/src/exdll.c
Executable file
37
admin/win/nsi/nsis_processes/src/exdll.c
Executable file
@@ -0,0 +1,37 @@
|
||||
#include <windows.h>
|
||||
#include "exdll.h"
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
|
||||
HWND g_hwndParent;
|
||||
|
||||
void __declspec(dllexport) myFunction(HWND hwndParent, int string_size,
|
||||
char *variables, stack_t **stacktop)
|
||||
{
|
||||
g_hwndParent=hwndParent;
|
||||
|
||||
EXDLL_INIT();
|
||||
|
||||
|
||||
// note if you want parameters from the stack, pop them off in order.
|
||||
// i.e. if you are called via exdll::myFunction file.dat poop.dat
|
||||
// calling popstring() the first time would give you file.dat,
|
||||
// and the second time would give you poop.dat.
|
||||
// you should empty the stack of your parameters, and ONLY your
|
||||
// parameters.
|
||||
|
||||
// do your stuff here
|
||||
{
|
||||
char buf[1024];
|
||||
wsprintf(buf,"$0=%s\n",getuservariable(INST_0));
|
||||
MessageBox(g_hwndParent,buf,0,MB_OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||
{
|
||||
g_hInstance=hInst;
|
||||
return TRUE;
|
||||
}
|
136
admin/win/nsi/nsis_processes/src/exdll.h
Executable file
136
admin/win/nsi/nsis_processes/src/exdll.h
Executable file
@@ -0,0 +1,136 @@
|
||||
#ifndef _EXDLL_H_
|
||||
#define _EXDLL_H_
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// only include this file from one place in your DLL.
|
||||
// (it is all static, if you use it in two places it will fail)
|
||||
//
|
||||
#define EXDLL_INIT() { \
|
||||
g_stringsize = string_size; \
|
||||
g_stacktop = stacktop; \
|
||||
g_variables = variables; }
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// For page showing plug-ins
|
||||
//
|
||||
#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
|
||||
#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
|
||||
#define NOTIFY_BYE_BYE 'x'
|
||||
|
||||
typedef struct _stack_t
|
||||
{
|
||||
struct _stack_t *next;
|
||||
char text[1]; // this should be the length of string_size
|
||||
} stack_t;
|
||||
|
||||
|
||||
static unsigned int g_stringsize;
|
||||
static stack_t **g_stacktop;
|
||||
static char *g_variables;
|
||||
|
||||
enum
|
||||
{
|
||||
INST_0, // $0
|
||||
INST_1, // $1
|
||||
INST_2, // $2
|
||||
INST_3, // $3
|
||||
INST_4, // $4
|
||||
INST_5, // $5
|
||||
INST_6, // $6
|
||||
INST_7, // $7
|
||||
INST_8, // $8
|
||||
INST_9, // $9
|
||||
INST_R0, // $R0
|
||||
INST_R1, // $R1
|
||||
INST_R2, // $R2
|
||||
INST_R3, // $R3
|
||||
INST_R4, // $R4
|
||||
INST_R5, // $R5
|
||||
INST_R6, // $R6
|
||||
INST_R7, // $R7
|
||||
INST_R8, // $R8
|
||||
INST_R9, // $R9
|
||||
INST_CMDLINE, // $CMDLINE
|
||||
INST_INSTDIR, // $INSTDIR
|
||||
INST_OUTDIR, // $OUTDIR
|
||||
INST_EXEDIR, // $EXEDIR
|
||||
INST_LANG, // $LANGUAGE
|
||||
__INST_LAST
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// utility functions (not required but often useful)
|
||||
//
|
||||
static int popstring( char *str )
|
||||
{
|
||||
stack_t *th;
|
||||
|
||||
|
||||
if( !g_stacktop ||
|
||||
!*g_stacktop )
|
||||
return 1;
|
||||
|
||||
th = (*g_stacktop);
|
||||
lstrcpy( str, th->text );
|
||||
*g_stacktop = th->next;
|
||||
GlobalFree( (HGLOBAL)th );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void pushstring( char *str )
|
||||
{
|
||||
stack_t *th;
|
||||
|
||||
|
||||
if( !g_stacktop )
|
||||
return;
|
||||
|
||||
th = (stack_t*)GlobalAlloc( GPTR, sizeof(stack_t) + g_stringsize );
|
||||
lstrcpyn( th->text, str, g_stringsize );
|
||||
th->next = *g_stacktop;
|
||||
*g_stacktop = th;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static char *getuservariable( int varnum )
|
||||
{
|
||||
if( varnum < 0 ||
|
||||
varnum >= __INST_LAST )
|
||||
return NULL;
|
||||
|
||||
return (g_variables + varnum*g_stringsize);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void setuservariable( int varnum, char *var )
|
||||
{
|
||||
if( var != NULL &&
|
||||
varnum >= 0 &&
|
||||
varnum < __INST_LAST )
|
||||
lstrcpy( g_variables + varnum*g_stringsize, var );
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif//_EXDLL_H_
|
411
admin/win/nsi/nsis_processes/src/processes.cpp
Executable file
411
admin/win/nsi/nsis_processes/src/processes.cpp
Executable file
@@ -0,0 +1,411 @@
|
||||
#include "stdafx.h"
|
||||
#include "processes.h"
|
||||
#include "string.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// global variables
|
||||
lpfEnumProcesses EnumProcesses;
|
||||
lpfEnumProcessModules EnumProcessModules;
|
||||
lpfGetModuleBaseName GetModuleBaseName;
|
||||
lpfEnumDeviceDrivers EnumDeviceDrivers;
|
||||
lpfGetDeviceDriverBaseName GetDeviceDriverBaseName;
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
HWND g_hwndParent;
|
||||
HINSTANCE g_hInstLib;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// main DLL entry
|
||||
BOOL WINAPI _DllMainCRTStartup( HANDLE hInst,
|
||||
ULONG ul_reason_for_call,
|
||||
LPVOID lpReserved )
|
||||
{
|
||||
g_hInstance = (struct HINSTANCE__ *)hInst;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// loads the psapi routines
|
||||
bool LoadPSAPIRoutines( void )
|
||||
{
|
||||
if( NULL == (g_hInstLib = LoadLibraryA( "PSAPI.DLL" )) )
|
||||
return false;
|
||||
|
||||
EnumProcesses = (lpfEnumProcesses) GetProcAddress( g_hInstLib, "EnumProcesses" );
|
||||
EnumProcessModules = (lpfEnumProcessModules) GetProcAddress( g_hInstLib, "EnumProcessModules" );
|
||||
GetModuleBaseName = (lpfGetModuleBaseName) GetProcAddress( g_hInstLib, "GetModuleBaseNameA" );
|
||||
EnumDeviceDrivers = (lpfEnumDeviceDrivers) GetProcAddress( g_hInstLib, "EnumDeviceDrivers" );
|
||||
GetDeviceDriverBaseName = (lpfGetDeviceDriverBaseName) GetProcAddress( g_hInstLib, "GetDeviceDriverBaseNameA" );
|
||||
|
||||
if( ( NULL == EnumProcesses ) ||
|
||||
( NULL == EnumProcessModules ) ||
|
||||
( NULL == EnumDeviceDrivers ) ||
|
||||
( NULL == GetModuleBaseName ) ||
|
||||
( NULL == GetDeviceDriverBaseName ) )
|
||||
{
|
||||
FreeLibrary( g_hInstLib );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// free the psapi routines
|
||||
bool FreePSAPIRoutines( void )
|
||||
{
|
||||
EnumProcesses = NULL;
|
||||
EnumProcessModules = NULL;
|
||||
GetModuleBaseName = NULL;
|
||||
EnumDeviceDrivers = NULL;
|
||||
|
||||
if( FALSE == FreeLibrary( g_hInstLib ) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// find a process by name
|
||||
// return value: true - process was found
|
||||
// false - process not found
|
||||
bool FindProc( char *szProcess )
|
||||
{
|
||||
char szProcessName[ 1024 ];
|
||||
char szCurrentProcessName[ 1024 ];
|
||||
DWORD dPID[ 1024 ];
|
||||
DWORD dPIDSize( 1024 );
|
||||
DWORD dSize( 1024 );
|
||||
HANDLE hProcess;
|
||||
HMODULE phModule[ 1024 ];
|
||||
|
||||
|
||||
//
|
||||
// make the name lower case
|
||||
//
|
||||
memset( szProcessName, 0, 1024*sizeof(char) );
|
||||
sprintf( szProcessName, "%s", szProcess );
|
||||
strlwr( szProcessName );
|
||||
|
||||
//
|
||||
// load PSAPI routines
|
||||
//
|
||||
if( false == LoadPSAPIRoutines() )
|
||||
return false;
|
||||
|
||||
//
|
||||
// enumerate processes names
|
||||
//
|
||||
if( FALSE == EnumProcesses( dPID, dSize, &dPIDSize ) )
|
||||
{
|
||||
FreePSAPIRoutines();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// walk trough and compare see if the process is running
|
||||
//
|
||||
for( int k( dPIDSize / sizeof( DWORD ) ); k >= 0; k-- )
|
||||
{
|
||||
memset( szCurrentProcessName, 0, 1024*sizeof(char) );
|
||||
|
||||
if( NULL != ( hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, dPID[ k ] ) ) )
|
||||
{
|
||||
if( TRUE == EnumProcessModules( hProcess, phModule, sizeof(HMODULE)*1024, &dPIDSize ) )
|
||||
if( GetModuleBaseName( hProcess, phModule[ 0 ], szCurrentProcessName, 1024 ) > 0 )
|
||||
{
|
||||
strlwr( szCurrentProcessName );
|
||||
|
||||
if( NULL != strstr( szCurrentProcessName, szProcessName ) )
|
||||
{
|
||||
FreePSAPIRoutines();
|
||||
CloseHandle( hProcess );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
CloseHandle( hProcess );
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// free PSAPI routines
|
||||
//
|
||||
FreePSAPIRoutines();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// kills a process by name
|
||||
// return value: true - process was found
|
||||
// false - process not found
|
||||
bool KillProc( char *szProcess )
|
||||
{
|
||||
char szProcessName[ 1024 ];
|
||||
char szCurrentProcessName[ 1024 ];
|
||||
DWORD dPID[ 1024 ];
|
||||
DWORD dPIDSize( 1024 );
|
||||
DWORD dSize( 1024 );
|
||||
HANDLE hProcess;
|
||||
HMODULE phModule[ 1024 ];
|
||||
|
||||
|
||||
//
|
||||
// make the name lower case
|
||||
//
|
||||
memset( szProcessName, 0, 1024*sizeof(char) );
|
||||
sprintf( szProcessName, "%s", szProcess );
|
||||
strlwr( szProcessName );
|
||||
|
||||
//
|
||||
// load PSAPI routines
|
||||
//
|
||||
if( false == LoadPSAPIRoutines() )
|
||||
return false;
|
||||
|
||||
//
|
||||
// enumerate processes names
|
||||
//
|
||||
if( FALSE == EnumProcesses( dPID, dSize, &dPIDSize ) )
|
||||
{
|
||||
FreePSAPIRoutines();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// walk trough and compare see if the process is running
|
||||
//
|
||||
for( int k( dPIDSize / sizeof( DWORD ) ); k >= 0; k-- )
|
||||
{
|
||||
memset( szCurrentProcessName, 0, 1024*sizeof(char) );
|
||||
|
||||
if( NULL != ( hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, dPID[ k ] ) ) )
|
||||
{
|
||||
if( TRUE == EnumProcessModules( hProcess, phModule, sizeof(HMODULE)*1024, &dPIDSize ) )
|
||||
if( GetModuleBaseName( hProcess, phModule[ 0 ], szCurrentProcessName, 1024 ) > 0 )
|
||||
{
|
||||
strlwr( szCurrentProcessName );
|
||||
|
||||
if( NULL != strstr( szCurrentProcessName, szProcessName ) )
|
||||
{
|
||||
FreePSAPIRoutines();
|
||||
|
||||
//
|
||||
// kill process
|
||||
//
|
||||
if( false == TerminateProcess( hProcess, 0 ) )
|
||||
{
|
||||
CloseHandle( hProcess );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// refresh systray
|
||||
//
|
||||
UpdateWindow( FindWindow( NULL, "Shell_TrayWnd" ) );
|
||||
|
||||
//
|
||||
// refresh desktop window
|
||||
//
|
||||
UpdateWindow( GetDesktopWindow() );
|
||||
|
||||
CloseHandle( hProcess );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
CloseHandle( hProcess );
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// free PSAPI routines
|
||||
//
|
||||
FreePSAPIRoutines();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
bool FindDev( char *szDriverName )
|
||||
{
|
||||
char szDeviceName[ 1024 ];
|
||||
char szCurrentDeviceName[ 1024 ];
|
||||
LPVOID lpDevices[ 1024 ];
|
||||
DWORD dDevicesSize( 1024 );
|
||||
DWORD dSize( 1024 );
|
||||
TCHAR tszCurrentDeviceName[ 1024 ];
|
||||
DWORD dNameSize( 1024 );
|
||||
|
||||
|
||||
//
|
||||
// make the name lower case
|
||||
//
|
||||
memset( szDeviceName, 0, 1024*sizeof(char) );
|
||||
sprintf( szDeviceName, "%s", strlwr( szDriverName ) );
|
||||
|
||||
//
|
||||
// load PSAPI routines
|
||||
//
|
||||
if( false == LoadPSAPIRoutines() )
|
||||
return false;
|
||||
|
||||
//
|
||||
// enumerate devices
|
||||
//
|
||||
if( FALSE == EnumDeviceDrivers( lpDevices, dSize, &dDevicesSize ) )
|
||||
{
|
||||
FreePSAPIRoutines();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// walk trough and compare see if the device driver exists
|
||||
//
|
||||
for( int k( dDevicesSize / sizeof( LPVOID ) ); k >= 0; k-- )
|
||||
{
|
||||
memset( szCurrentDeviceName, 0, 1024*sizeof(char) );
|
||||
memset( tszCurrentDeviceName, 0, 1024*sizeof(TCHAR) );
|
||||
|
||||
if( 0 != GetDeviceDriverBaseName( lpDevices[ k ], tszCurrentDeviceName, dNameSize ) )
|
||||
{
|
||||
sprintf( szCurrentDeviceName, "%S", tszCurrentDeviceName );
|
||||
|
||||
if( 0 == strcmp( strlwr( szCurrentDeviceName ), szDeviceName ) )
|
||||
{
|
||||
FreePSAPIRoutines();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// free PSAPI routines
|
||||
//
|
||||
FreePSAPIRoutines();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
extern "C" __declspec(dllexport) void FindProcess( HWND hwndParent,
|
||||
int string_size,
|
||||
char *variables,
|
||||
stack_t **stacktop )
|
||||
{
|
||||
char szParameter[ 1024 ];
|
||||
|
||||
|
||||
g_hwndParent = hwndParent;
|
||||
|
||||
EXDLL_INIT();
|
||||
{
|
||||
popstring( szParameter );
|
||||
|
||||
if( true == FindProc( szParameter ) )
|
||||
wsprintf( szParameter, "1" );
|
||||
else
|
||||
wsprintf( szParameter, "0" );
|
||||
|
||||
setuservariable( INST_R0, szParameter );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
extern "C" __declspec(dllexport) void KillProcess( HWND hwndParent,
|
||||
int string_size,
|
||||
char *variables,
|
||||
stack_t **stacktop )
|
||||
{
|
||||
char szParameter[ 1024 ];
|
||||
|
||||
|
||||
g_hwndParent = hwndParent;
|
||||
|
||||
EXDLL_INIT();
|
||||
{
|
||||
popstring( szParameter );
|
||||
|
||||
if( true == KillProc( szParameter ) )
|
||||
wsprintf( szParameter, "1" );
|
||||
else
|
||||
wsprintf( szParameter, "0" );
|
||||
|
||||
setuservariable( INST_R0, szParameter );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
extern "C" __declspec(dllexport) void FindDevice( HWND hwndParent,
|
||||
int string_size,
|
||||
char *variables,
|
||||
stack_t **stacktop )
|
||||
{
|
||||
char szParameter[ 1024 ];
|
||||
|
||||
|
||||
g_hwndParent = hwndParent;
|
||||
|
||||
EXDLL_INIT();
|
||||
{
|
||||
popstring( szParameter );
|
||||
|
||||
if( true == FindDev( szParameter ) )
|
||||
wsprintf( szParameter, "1" );
|
||||
else
|
||||
wsprintf( szParameter, "0" );
|
||||
|
||||
setuservariable( INST_R0, szParameter );
|
||||
}
|
||||
}
|
49
admin/win/nsi/nsis_processes/src/processes.h
Executable file
49
admin/win/nsi/nsis_processes/src/processes.h
Executable file
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// PSAPI function pointers
|
||||
typedef BOOL (WINAPI *lpfEnumProcesses) ( DWORD *, DWORD, DWORD * );
|
||||
typedef BOOL (WINAPI *lpfEnumProcessModules) ( HANDLE, HMODULE *, DWORD, LPDWORD );
|
||||
typedef DWORD (WINAPI *lpfGetModuleBaseName) ( HANDLE, HMODULE, LPTSTR, DWORD );
|
||||
typedef BOOL (WINAPI *lpfEnumDeviceDrivers) ( LPVOID *, DWORD, LPDWORD );
|
||||
typedef BOOL (WINAPI *lpfGetDeviceDriverBaseName)( LPVOID, LPTSTR, DWORD );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// Internal use routines
|
||||
bool LoadPSAPIRoutines( void );
|
||||
bool FreePSAPIRoutines( void );
|
||||
|
||||
bool FindProc( char *szProcess );
|
||||
bool KillProc( char *szProcess );
|
||||
|
||||
bool FindDev( char *szDriverName );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// Exported routines
|
||||
extern "C" __declspec(dllexport) void FindProcess( HWND hwndParent,
|
||||
int string_size,
|
||||
char *variables,
|
||||
stack_t **stacktop );
|
||||
|
||||
extern "C" __declspec(dllexport) void KillProcess( HWND hwndParent,
|
||||
int string_size,
|
||||
char *variables,
|
||||
stack_t **stacktop );
|
||||
|
||||
extern "C" __declspec(dllexport) void FindDevice( HWND hwndParent,
|
||||
int string_size,
|
||||
char *variables,
|
||||
stack_t **stacktop );
|
BIN
admin/win/nsi/nsis_processes/src/processes.ncb
Executable file
BIN
admin/win/nsi/nsis_processes/src/processes.ncb
Executable file
Binary file not shown.
103
admin/win/nsi/nsis_processes/src/processes.rc
Executable file
103
admin/win/nsi/nsis_processes/src/processes.rc
Executable file
@@ -0,0 +1,103 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,1
|
||||
PRODUCTVERSION 1,0,0,1
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "NSIS Plug-in for Windows process management. Only WinNT, Win2K, WinXP and Win2003 Server supported."
|
||||
VALUE "CompanyName", "Andrei Ciubotaru [Hardwired]"
|
||||
VALUE "FileDescription", "Windows Processes Management"
|
||||
VALUE "FileVersion", "1, 0, 0, 1"
|
||||
VALUE "InternalName", "Processes"
|
||||
VALUE "LegalCopyright", "Copyright (c) 2004 Hardwired. No rights reserved."
|
||||
VALUE "OriginalFilename", "Processes.dll"
|
||||
VALUE "ProductName", "Processes"
|
||||
VALUE "ProductVersion", "1, 0, 0, 1"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
21
admin/win/nsi/nsis_processes/src/processes.sln
Executable file
21
admin/win/nsi/nsis_processes/src/processes.sln
Executable file
@@ -0,0 +1,21 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "processes", "processes.vcproj", "{3438467F-A719-46DC-93E5-137A8B691727}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{3438467F-A719-46DC-93E5-137A8B691727}.Debug.ActiveCfg = Debug|Win32
|
||||
{3438467F-A719-46DC-93E5-137A8B691727}.Debug.Build.0 = Debug|Win32
|
||||
{3438467F-A719-46DC-93E5-137A8B691727}.Release.ActiveCfg = Release|Win32
|
||||
{3438467F-A719-46DC-93E5-137A8B691727}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
122
admin/win/nsi/nsis_processes/src/processes.txt
Executable file
122
admin/win/nsi/nsis_processes/src/processes.txt
Executable file
@@ -0,0 +1,122 @@
|
||||
----------------------------------------------------------------
|
||||
----------------------------------------------------------------
|
||||
Processes (Processes.dll)
|
||||
Version: 1.0.0.1
|
||||
Release: 12.december.2004
|
||||
Description:Nullsoft Installer (NSIS) plug-in for managing?!
|
||||
Windows processes.
|
||||
|
||||
Copyright: <09> 2004 Hardwired. No rights reserved.
|
||||
There is no restriction and no guaranty for using
|
||||
this software.
|
||||
|
||||
Author: Andrei Ciubotaru [Hardwired]
|
||||
Lead Developer ICode&Ideas SRL (http://www.icode.ro)
|
||||
hardwiredteks@gmail.com, hardwired@icode.ro
|
||||
|
||||
----------------------------------------------------------------
|
||||
----------------------------------------------------------------
|
||||
INTRODUCTION
|
||||
|
||||
The Need For Plug-in - I need it for the one of my installers.
|
||||
|
||||
Briefly: Use it when you need to find\kill a process when
|
||||
installing\uninstalling some application. Also, use it when you
|
||||
need to test the presence of a device driver.
|
||||
|
||||
|
||||
SUPPORT
|
||||
|
||||
Supported platforms are: WinNT,Win2K,WinXP and Win2003 Server.
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
Processes::FindProcess <process_name.exe>
|
||||
|
||||
Searches the currently running processes for the given
|
||||
process name.
|
||||
|
||||
return: 1 - the process was found
|
||||
0 - the process was not found
|
||||
|
||||
Processes::KillProcess <process_name.exe>
|
||||
|
||||
Searches the currently running processes for the given
|
||||
process name. If the process is found then the it gets
|
||||
killed.
|
||||
|
||||
return: 1 - the process was found and killed
|
||||
0 - the process was not found or the process
|
||||
cannot be killed (insuficient rights)
|
||||
|
||||
Processes::FindDevice <device_base_name>
|
||||
|
||||
Searches the installed devices drivers for the given
|
||||
device base name.
|
||||
(important: I said BASE NAME not FILENAME)
|
||||
|
||||
return: 1 - the device driver was found
|
||||
0 - the device driver was not found
|
||||
|
||||
|
||||
USAGE
|
||||
|
||||
First of all, does not matter where you use it. Ofcourse, the
|
||||
routines must be called inside of a Section/Function scope.
|
||||
|
||||
Processes::FindProcess "process_name.exe"
|
||||
Pop $R0
|
||||
|
||||
StrCmp $R0 "1" make_my_day noooooo
|
||||
|
||||
make_my_day:
|
||||
...
|
||||
|
||||
noooooo:
|
||||
...
|
||||
|
||||
|
||||
Processes::KillProcess "process_name.exe"
|
||||
Pop $R0
|
||||
|
||||
StrCmp $R0 "1" dead_meat why_wont_you_die
|
||||
|
||||
dead_meat:
|
||||
...
|
||||
|
||||
why_wont_you_die:
|
||||
...
|
||||
|
||||
|
||||
Processes::FindDevice "device_base_name"
|
||||
Pop $R0
|
||||
|
||||
StrCmp $R0 "1" blabla more_blabla
|
||||
|
||||
blabla:
|
||||
...
|
||||
|
||||
more_blabla:
|
||||
...
|
||||
|
||||
|
||||
THANKS
|
||||
|
||||
Sunil Kamath for inspiring me. I wanted to use its FindProcDLL
|
||||
but my requirements made it imposible.
|
||||
|
||||
Nullsoft for creating this very powerfull installer. One big,
|
||||
free and full-featured (hmmm... and guiless for the moment) mean
|
||||
install machine!:)
|
||||
|
||||
ME for being such a great coder...
|
||||
... HAHAHAHAHAHAHA!
|
||||
|
||||
ONE MORE THING
|
||||
|
||||
If you use the plugin or it's source-code, I would apreciate
|
||||
if my name is mentioned.
|
||||
|
||||
----------------------------------------------------------------
|
||||
----------------------------------------------------------------
|
222
admin/win/nsi/nsis_processes/src/processes.vcproj
Executable file
222
admin/win/nsi/nsis_processes/src/processes.vcproj
Executable file
@@ -0,0 +1,222 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="processes"
|
||||
SccProjectName="processes"
|
||||
SccLocalPath=".">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FINDPROCDLL_EXPORTS"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="3"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
PrecompiledHeaderFile=".\Debug/processes.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile=".\Debug/processes.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\Debug/processes.pdb"
|
||||
ImportLibrary=".\Debug/processes.lib"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Debug/processes.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1034"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="..\bin"
|
||||
IntermediateDirectory="..\bin\processes"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="TRUE">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
GlobalOptimizations="TRUE"
|
||||
InlineFunctionExpansion="1"
|
||||
FavorSizeOrSpeed="1"
|
||||
OptimizeForWindowsApplication="TRUE"
|
||||
PreprocessorDefinitions="NDEBUG;_WINDOWS;_USRDLL;FINDPROCDLL_EXPORTS"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
StructMemberAlignment="1"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="3"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
PrecompiledHeaderFile="..\bin\processes/processes.pch"
|
||||
AssemblerListingLocation="..\bin\processes/"
|
||||
ObjectFile="..\bin\processes/"
|
||||
ProgramDataBaseFileName="..\bin\processes/"
|
||||
WarningLevel="4"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libc.lib"
|
||||
OutputFile="..\bin/Processes.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
IgnoreAllDefaultLibraries="FALSE"
|
||||
ProgramDatabaseFile="..\bin/processes.pdb"
|
||||
OptimizeForWindows98="1"
|
||||
ImportLibrary="..\bin/processes.lib"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Release/processes.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||
<File
|
||||
RelativePath="processes.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;FINDPROCDLL_EXPORTS;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="1"
|
||||
PreprocessorDefinitions="NDEBUG;_WINDOWS;_MBCS;_USRDLL;FINDPROCDLL_EXPORTS;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\processes.rc">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="StdAfx.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;FINDPROCDLL_EXPORTS;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="1"
|
||||
PreprocessorDefinitions="NDEBUG;_WINDOWS;_MBCS;_USRDLL;FINDPROCDLL_EXPORTS;$(NoInherit)"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl">
|
||||
<File
|
||||
RelativePath="exdll.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\processes.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\resource.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="StdAfx.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath="processes.txt">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
15
admin/win/nsi/nsis_processes/src/resource.h
Executable file
15
admin/win/nsi/nsis_processes/src/resource.h
Executable file
@@ -0,0 +1,15 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by processes.rc
|
||||
//
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
Reference in New Issue
Block a user