1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-01-18 23:17:59 +01:00

* Cherry-picked latest tomahawk.nsi changes from master.

This commit is contained in:
Christian Muehlhaeuser 2011-03-31 04:20:57 +02:00
parent c61813915d
commit 543c3125ac
23 changed files with 1365 additions and 1 deletions

View File

0
admin/win/nsi/RELEASE_NOTES.txt Executable file → Normal file
View File

0
admin/win/nsi/installer.ico Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

View File

@ -0,0 +1,35 @@
{\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f39\fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana;}
{\f172\froman\fcharset238\fprq2 Times New Roman CE;}{\f173\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f175\froman\fcharset161\fprq2 Times New Roman Greek;}{\f176\froman\fcharset162\fprq2 Times New Roman Tur;}
{\f177\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f178\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f179\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f180\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}
{\f562\fswiss\fcharset238\fprq2 Verdana CE;}{\f563\fswiss\fcharset204\fprq2 Verdana Cyr;}{\f565\fswiss\fcharset161\fprq2 Verdana Greek;}{\f566\fswiss\fcharset162\fprq2 Verdana Tur;}{\f569\fswiss\fcharset186\fprq2 Verdana Baltic;}
{\f570\fswiss\fcharset163\fprq2 Verdana (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;
\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{
\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\*
\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}{\*\cs15 \additive \ul\cf2 \sbasedon10 \styrsid7485074 Hyperlink;}}
{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\rsidtbl \rsid6712196\rsid7485074\rsid11352300\rsid15940516}{\*\generator Microsoft Word 11.0.5604;}{\info{\title Processes v1}{\author Hardwired}{\operator Hardwired}{\creatim\yr2004\mo12\dy12\hr23\min42}
{\revtim\yr2004\mo12\dy12\hr23\min51}{\version2}{\edmins9}{\nofpages1}{\nofwords80}{\nofchars458}{\nofcharsws537}{\vern24689}}\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180
\dgvspace180\dghorigin1800\dgvorigin1440\dghshow1\dgvshow1
\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct
\asianbrkrule\rsidroot7485074\newtblstyruls\nogrowautofit \fet0\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}
{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}
{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain
\qj \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid7485074 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\b\f39\insrsid7485074\charrsid7485074 Processes v1.0}{\f39\insrsid7485074\charrsid7485074 .0.1
\par }{\f39\fs20\insrsid7485074
\par }\pard \qj \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid15940516 {\f39\fs20\insrsid15940516 This software binaries and source-code are free for any kind of use, including commercial use. }{
\f39\fs20\insrsid7485074\charrsid7485074 There is no restriction and no guaranty for using}{\f39\fs20\insrsid7485074\charrsid7485074 t}{\f39\fs20\insrsid7485074\charrsid7485074 his software}{\f39\fs20\insrsid7485074\charrsid7485074 and/or it
s source-code. }{\f39\fs20\insrsid15940516
\par I}{\f39\fs20\insrsid7485074\charrsid7485074 f you use the plug}{\f39\fs20\insrsid7485074\charrsid7485074 -}{\f39\fs20\insrsid7485074\charrsid7485074 in }{\f39\fs20\insrsid7485074\charrsid7485074 and/}{\f39\fs20\insrsid7485074\charrsid7485074 or it}{
\f39\fs20\insrsid7485074\charrsid7485074 s}{\f39\fs20\insrsid7485074\charrsid7485074 source-code, I would }{\f39\fs20\insrsid7485074\charrsid7485074 appreciate }{\f39\fs20\insrsid7485074\charrsid7485074 if my name is mentioned.}{
\f39\fs20\insrsid7485074\charrsid7485074
\par }\pard \qj \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid7485074 {\f39\fs20\insrsid7485074\charrsid7485074
\par }{\b\f39\fs20\insrsid7485074\charrsid7485074 Andrei Ciubotaru [Hardwired]
\par }{\f39\fs20\insrsid7485074\charrsid7485074 Lead Developer ICode&Ideas SRL (}{\field\flddirty{\*\fldinst {\f39\fs20\insrsid7485074\charrsid7485074 HYPERLINK "http://www.icode.ro/" }{\f39\fs20\insrsid7485074\charrsid7485074 {\*\datafield
00d0c9ea79f9bace118c8200aa004ba90b02000000170000001500000068007400740070003a002f002f007700770077002e00690063006f00640065002e0072006f002f000000e0c9ea79f9bace118c8200aa004ba90b2a00000068007400740070003a002f002f007700770077002e00690063006f00640065002e007200
6f002f000000}}}{\fldrslt {\cs15\f39\fs20\ul\cf2\insrsid7485074\charrsid7485074 http://www.icode.ro/}}}{\f39\fs20\insrsid7485074\charrsid7485074 )
\par }{\field{\*\fldinst {\f39\fs20\insrsid7485074 HYPERLINK "hardwiredteks@gmail.com" }{\f39\fs20\insrsid15940516\charrsid7485074 {\*\datafield
00d0c9ea79f9bace118c8200aa004ba90b02000000010000000303000000000000c00000000000004600001800000068617264776972656474656b7340676d61696c2e636f6d00ffffadde000000000000000000000000000000000000000000000000}}}{\fldrslt {
\cs15\f39\fs20\ul\cf2\insrsid7485074\charrsid7485074 hardwiredteks@gmail.com}}}{\f39\fs20\insrsid7485074\charrsid7485074 , }{\field{\*\fldinst {\f39\fs20\insrsid7485074 HYPERLINK "hardwired@icode.ro" }{\f39\fs20\insrsid15940516\charrsid7485074
{\*\datafield 00d0c9ea79f9bace118c8200aa004ba90b02000000010000000303000000000000c0000000000000460000130000006861726477697265644069636f64652e726f00ffffadde000000000000000000000000000000000000000000000000}}}{\fldrslt {
\cs15\f39\fs20\ul\cf2\insrsid7485074\charrsid7485074 hardwired@icode.ro}}}{\f39\fs20\insrsid7485074\charrsid7485074
\par }}

View File

@ -0,0 +1,122 @@
----------------------------------------------------------------
----------------------------------------------------------------
Processes (Processes.dll)
Version: 1.0.1.0
Release: 24.february.2005
Description: Nullsoft Installer (NSIS) plug-in for managing?!
Windows processes.
Copyright: © 2004-2005 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> ;without ".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> ; without ".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"
Pop $R0
StrCmp $R0 "1" make_my_day noooooo
make_my_day:
...
noooooo:
...
Processes::KillProcess "process_name"
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.
----------------------------------------------------------------
----------------------------------------------------------------

View 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

View 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_)

View 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;
}

View 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_

View 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 );
}
}

View 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 );

Binary file not shown.

View 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

View 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

View 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: © 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.
----------------------------------------------------------------
----------------------------------------------------------------

View 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>

View 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

0
admin/win/nsi/page_header.bmp Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

2
admin/win/nsi/revision.txt Normal file → Executable file
View File

@ -1 +1 @@
96
97

0
admin/win/nsi/tomahawk.ini Executable file → Normal file
View File

49
admin/win/nsi/tomahawk.nsi Executable file → Normal file
View File

@ -159,6 +159,45 @@ Function LaunchTomahawkAsUser
FunctionEnd
!endif
##############################################################################
# #
# PROCESS HANDLING FUNCTIONS AND MACROS #
# #
##############################################################################
!macro CheckForProcess processName gotoWhenFound gotoWhenNotFound
Processes::FindProcess ${processName}
StrCmp $R0 "0" ${gotoWhenNotFound} ${gotoWhenFound}
!macroend
!macro ConfirmEndProcess processName
MessageBox MB_YESNO|MB_ICONEXCLAMATION \
"Found ${processName} process(s) which need to be stopped.$\nDo you want the installer to stop these for you?" \
IDYES process_${processName}_kill IDNO process_${processName}_ended
process_${processName}_kill:
DetailPrint "Killing ${processName} processes."
Processes::KillProcess ${processName}
Sleep 1500
StrCmp $R0 "1" process_${processName}_ended
DetailPrint "Process to kill not found!"
process_${processName}_ended:
!macroend
!macro CheckAndConfirmEndProcess processName
!insertmacro CheckForProcess ${processName} 0 no_process_${processName}_to_end
!insertmacro ConfirmEndProcess ${processName}
no_process_${processName}_to_end:
!macroend
!macro EnsureTomahawkShutdown un
Function ${un}EnsureTomahawkShutdown
!insertmacro CheckAndConfirmEndProcess "tomahawk.exe"
FunctionEnd
!macroend
!insertmacro EnsureTomahawkShutdown ""
!insertmacro EnsureTomahawkShutdown "un."
##############################################################################
# #
# RE-INSTALLER FUNCTIONS #
@ -554,6 +593,16 @@ Function .onInit
StrCmp $R0 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running."
Abort
;Use available InstallLocation when possible. This is useful in the uninstaller
;via re-install, which would otherwise use a default location - a bug.
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tomahawk" "InstallLocation"
StrCmp $R0 "" SkipSetInstDir
StrCpy $INSTDIR $R0
SkipSetInstDir:
;Shutdown Tomahawk in case Add/Remove re-installer option used.
Call EnsureTomahawkShutdown
FunctionEnd
Function .onInstSuccess

0
admin/win/nsi/welcome.bmp Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 151 KiB