mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 631840 - Remove nsProcess plugin and associated code since it is no longer used. r=jimm, a=approval2.0
This commit is contained in:
parent
5c75a42173
commit
579aa9797d
@ -32,13 +32,3 @@ http://nsis.sourceforge.net/ApplicationID_plug-in
|
|||||||
Unicode support and taskbar resource deleteion was added for this plugin. A diff
|
Unicode support and taskbar resource deleteion was added for this plugin. A diff
|
||||||
of the changes to the source is available at:
|
of the changes to the source is available at:
|
||||||
https://bugzilla.mozilla.org/show_bug.cgi?id=521141
|
https://bugzilla.mozilla.org/show_bug.cgi?id=521141
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
nsProcess NSIS plugin v1.5
|
|
||||||
http://nsis.sourceforge.net/NsProcess_plugin
|
|
||||||
Unicode support was added for this plugin. A diff of the changes to the source
|
|
||||||
are available at:
|
|
||||||
https://bugzilla.mozilla.org/show_bug.cgi?id=473348
|
|
||||||
https://bugzilla.mozilla.org/attachment.cgi?id=357012
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
|
@ -1,59 +0,0 @@
|
|||||||
*****************************************************************
|
|
||||||
*** nsProcess NSIS plugin v1.5 ***
|
|
||||||
*****************************************************************
|
|
||||||
|
|
||||||
2006 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
|
|
||||||
|
|
||||||
Source function FIND_PROC_BY_NAME based
|
|
||||||
upon the Ravi Kochhar (kochhar@physiology.wisc.edu) code
|
|
||||||
Thanks iceman_k (FindProcDLL plugin) and
|
|
||||||
DITMan (KillProcDLL plugin) for direct me
|
|
||||||
|
|
||||||
|
|
||||||
Features:
|
|
||||||
- Find a process by name
|
|
||||||
- Kill a process by name
|
|
||||||
- Kill all processes with specified name (not only one)
|
|
||||||
- The process name is case-insensitive
|
|
||||||
- Win95/98/ME/NT/2000/XP support
|
|
||||||
- Small plugin size (4 Kb)
|
|
||||||
|
|
||||||
|
|
||||||
**** Find process ****
|
|
||||||
${nsProcess::FindProcess} "[file.exe]" $var
|
|
||||||
|
|
||||||
"[file.exe]" - Process name (e.g. "notepad.exe")
|
|
||||||
|
|
||||||
$var 0 Success
|
|
||||||
603 Process was not currently running
|
|
||||||
604 Unable to identify system type
|
|
||||||
605 Unsupported OS
|
|
||||||
606 Unable to load NTDLL.DLL
|
|
||||||
607 Unable to get procedure address from NTDLL.DLL
|
|
||||||
608 NtQuerySystemInformation failed
|
|
||||||
609 Unable to load KERNEL32.DLL
|
|
||||||
610 Unable to get procedure address from KERNEL32.DLL
|
|
||||||
611 CreateToolhelp32Snapshot failed
|
|
||||||
|
|
||||||
|
|
||||||
**** Kill process ****
|
|
||||||
${nsProcess::KillProcess} "[file.exe]" $var
|
|
||||||
|
|
||||||
"[file.exe]" - Process name (e.g. "notepad.exe")
|
|
||||||
|
|
||||||
$var 0 Success
|
|
||||||
601 No permission to terminate process
|
|
||||||
602 Not all processes terminated successfully
|
|
||||||
603 Process was not currently running
|
|
||||||
604 Unable to identify system type
|
|
||||||
605 Unsupported OS
|
|
||||||
606 Unable to load NTDLL.DLL
|
|
||||||
607 Unable to get procedure address from NTDLL.DLL
|
|
||||||
608 NtQuerySystemInformation failed
|
|
||||||
609 Unable to load KERNEL32.DLL
|
|
||||||
610 Unable to get procedure address from KERNEL32.DLL
|
|
||||||
611 CreateToolhelp32Snapshot failed
|
|
||||||
|
|
||||||
|
|
||||||
**** Unload plugin ****
|
|
||||||
${nsProcess::Unload}
|
|
@ -1,820 +0,0 @@
|
|||||||
/*****************************************************************
|
|
||||||
* Conversion functions header v1.9 *
|
|
||||||
* *
|
|
||||||
* 2006 Shengalts Aleksander aka Instructor (Shengalts@mail.ru) *
|
|
||||||
* *
|
|
||||||
* *
|
|
||||||
*Functions (ALLCONVFUNC): *
|
|
||||||
* xatoi, xatoiW, xitoa, xitoaW, xatoui, xatouiW, *
|
|
||||||
* xuitoa, xuitoaW, xatoi64, xatoi64W, xi64toa, xi64toaW, *
|
|
||||||
* hex2dec, hex2decW, dec2hex, dec2hexW *
|
|
||||||
* *
|
|
||||||
*Special functions (ALLCONVFUNCS): *
|
|
||||||
* str2hex, hex2str *
|
|
||||||
* *
|
|
||||||
*****************************************************************/
|
|
||||||
|
|
||||||
#ifndef _CONVFUNC_
|
|
||||||
#define _CONVFUNC_
|
|
||||||
|
|
||||||
int xatoi(char *str);
|
|
||||||
int xatoiW(wchar_t *wstr);
|
|
||||||
char* xitoa(int number, char *str, int width);
|
|
||||||
wchar_t* xitoaW(int number, wchar_t *wstr, int width);
|
|
||||||
unsigned int xatoui(char *str);
|
|
||||||
unsigned int xatouiW(wchar_t *wstr);
|
|
||||||
char* xuitoa(unsigned int number, char *str, int width);
|
|
||||||
wchar_t* xuitoaW(unsigned int number, wchar_t *wstr, int width);
|
|
||||||
__int64 xatoi64(char *str);
|
|
||||||
__int64 xatoi64W(wchar_t *wstr);
|
|
||||||
char* xi64toa(__int64 number, char *str, int width);
|
|
||||||
wchar_t* xi64toaW(__int64 number, wchar_t *wstr, int width);
|
|
||||||
int hex2dec(char *hex);
|
|
||||||
int hex2decW(wchar_t *whex);
|
|
||||||
void dec2hex(unsigned int dec, char *hex, BOOL lowercase, unsigned int width);
|
|
||||||
void dec2hexW(unsigned int dec, wchar_t *whex, BOOL lowercase, unsigned int width);
|
|
||||||
|
|
||||||
void str2hex(unsigned char *str, char *hex, BOOL lowercase, unsigned int bytes);
|
|
||||||
void hex2str(char *hex, char *str);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
*
|
|
||||||
* xatoi
|
|
||||||
*
|
|
||||||
*Converts string to int.
|
|
||||||
*
|
|
||||||
*[in] char *str -string number
|
|
||||||
*
|
|
||||||
*Returns: integer
|
|
||||||
*
|
|
||||||
*Examples:
|
|
||||||
* xatoi("45") == 45;
|
|
||||||
* xatoi(" -0045:value") == -45;
|
|
||||||
********************************************************************/
|
|
||||||
#if defined xatoi || defined ALLCONVFUNC
|
|
||||||
#define xatoi_INCLUDED
|
|
||||||
#undef xatoi
|
|
||||||
int xatoi(char *str)
|
|
||||||
{
|
|
||||||
int nNumber=0;
|
|
||||||
BOOL bMinus=FALSE;
|
|
||||||
|
|
||||||
while (*str == ' ')
|
|
||||||
++str;
|
|
||||||
if (*str == '+')
|
|
||||||
++str;
|
|
||||||
else if (*str == '-')
|
|
||||||
{
|
|
||||||
bMinus=TRUE;
|
|
||||||
++str;
|
|
||||||
}
|
|
||||||
for (; *str != '\0' && *str >= '0' && *str <= '9'; ++str)
|
|
||||||
nNumber=(nNumber * 10) + (*str - '0');
|
|
||||||
if (bMinus == TRUE)
|
|
||||||
nNumber=0 - nNumber;
|
|
||||||
return nNumber;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
*
|
|
||||||
* xatoiW
|
|
||||||
*
|
|
||||||
*Converts unicode string to int.
|
|
||||||
*
|
|
||||||
*[in] wchar_t *wstr -string number
|
|
||||||
*
|
|
||||||
*Returns: integer
|
|
||||||
*
|
|
||||||
*Examples:
|
|
||||||
* xatoiW(L"45") == 45;
|
|
||||||
* xatoiW(L" -0045:value") == -45;
|
|
||||||
********************************************************************/
|
|
||||||
#if defined xatoiW || defined ALLCONVFUNC
|
|
||||||
#define xatoiW_INCLUDED
|
|
||||||
#undef xatoiW
|
|
||||||
int xatoiW(wchar_t *wstr)
|
|
||||||
{
|
|
||||||
int nNumber=0;
|
|
||||||
BOOL bMinus=FALSE;
|
|
||||||
|
|
||||||
while (*wstr == ' ')
|
|
||||||
++wstr;
|
|
||||||
if (*wstr == '+')
|
|
||||||
++wstr;
|
|
||||||
else if (*wstr == '-')
|
|
||||||
{
|
|
||||||
bMinus=TRUE;
|
|
||||||
++wstr;
|
|
||||||
}
|
|
||||||
for (; *wstr != '\0' && *wstr >= '0' && *wstr <= '9'; ++wstr)
|
|
||||||
nNumber=(nNumber * 10) + (*wstr - '0');
|
|
||||||
if (bMinus == TRUE)
|
|
||||||
nNumber=0 - nNumber;
|
|
||||||
return nNumber;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
*
|
|
||||||
* xitoa [API: wsprintf(szResult, "%d", 45)]
|
|
||||||
*
|
|
||||||
*Converts int to string.
|
|
||||||
*
|
|
||||||
*[in] int number -integer
|
|
||||||
*[out] char *str -string number
|
|
||||||
*[in] int width -minimum number of characters to the output
|
|
||||||
*
|
|
||||||
*Returns: a pointer to string
|
|
||||||
*
|
|
||||||
*Examples:
|
|
||||||
* xitoa(45, szResult, 0); //szResult == "45"
|
|
||||||
* xitoa(-45, szResult, 0); //szResult == "-45"
|
|
||||||
* xitoa(45, szResult, 4); //szResult == "0045"
|
|
||||||
********************************************************************/
|
|
||||||
#if defined xitoa || defined ALLCONVFUNC
|
|
||||||
#define xitoa_INCLUDED
|
|
||||||
#undef xitoa
|
|
||||||
char* xitoa(int number, char *str, int width)
|
|
||||||
{
|
|
||||||
char tmp[128]="";
|
|
||||||
int a=0;
|
|
||||||
int b=0;
|
|
||||||
|
|
||||||
if (number == 0)
|
|
||||||
{
|
|
||||||
str[0]='0';
|
|
||||||
--width;
|
|
||||||
b=1;
|
|
||||||
}
|
|
||||||
else if (number < 0)
|
|
||||||
{
|
|
||||||
str[0]='-';
|
|
||||||
number=0 - number;
|
|
||||||
--width;
|
|
||||||
b=1;
|
|
||||||
}
|
|
||||||
for (tmp[a]='\0'; number != 0; ++a)
|
|
||||||
{
|
|
||||||
tmp[a]=(number % 10) + '0';
|
|
||||||
number=number / 10;
|
|
||||||
}
|
|
||||||
for (; width > a; ++a) tmp[a]='0';
|
|
||||||
for (--a; a >= 0; --a, ++b) str[b]=tmp[a];
|
|
||||||
|
|
||||||
str[b]='\0';
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
*
|
|
||||||
* xitoaW [API: wsprintfW(wszResult, L"%d", 45)]
|
|
||||||
*
|
|
||||||
*Converts int to unicode string.
|
|
||||||
*
|
|
||||||
*[in] int number -integer
|
|
||||||
*[out] wchar_t *wstr -unicode string number
|
|
||||||
*[in] int width -minimum number of characters to the output
|
|
||||||
*
|
|
||||||
*Returns: a pointer to unicode string
|
|
||||||
*
|
|
||||||
*Examples:
|
|
||||||
* xitoaW(45, wszResult, 0); //wszResult == L"45"
|
|
||||||
* xitoaW(-45, wszResult, 0); //wszResult == L"-45"
|
|
||||||
* xitoaW(45, wszResult, 4); //wszResult == L"0045"
|
|
||||||
********************************************************************/
|
|
||||||
#if defined xitoaW || defined ALLCONVFUNC
|
|
||||||
#define xitoaW_INCLUDED
|
|
||||||
#undef xitoaW
|
|
||||||
wchar_t* xitoaW(int number, wchar_t *wstr, int width)
|
|
||||||
{
|
|
||||||
wchar_t wtmp[128]=L"";
|
|
||||||
int a=0;
|
|
||||||
int b=0;
|
|
||||||
|
|
||||||
if (number == 0)
|
|
||||||
{
|
|
||||||
wstr[0]='0';
|
|
||||||
--width;
|
|
||||||
b=1;
|
|
||||||
}
|
|
||||||
else if (number < 0)
|
|
||||||
{
|
|
||||||
wstr[0]='-';
|
|
||||||
number=0 - number;
|
|
||||||
--width;
|
|
||||||
b=1;
|
|
||||||
}
|
|
||||||
for (wtmp[a]='\0'; number != 0; ++a)
|
|
||||||
{
|
|
||||||
wtmp[a]=(number % 10) + '0';
|
|
||||||
number=number / 10;
|
|
||||||
}
|
|
||||||
for (; width > a; ++a) wtmp[a]='0';
|
|
||||||
for (--a; a >= 0; --a, ++b) wstr[b]=wtmp[a];
|
|
||||||
|
|
||||||
wstr[b]='\0';
|
|
||||||
return wstr;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
*
|
|
||||||
* xatoui
|
|
||||||
*
|
|
||||||
*Converts string to unsigned int.
|
|
||||||
*
|
|
||||||
*[in] char *str -string number
|
|
||||||
*
|
|
||||||
*Returns: unsigned integer
|
|
||||||
*
|
|
||||||
*Examples:
|
|
||||||
* xatoui("45") == 45;
|
|
||||||
* xatoui(" -0045:value") == 0;
|
|
||||||
********************************************************************/
|
|
||||||
#if defined xatoui || defined ALLCONVFUNC
|
|
||||||
#define xatoui_INCLUDED
|
|
||||||
#undef xatoui
|
|
||||||
unsigned int xatoui(char *str)
|
|
||||||
{
|
|
||||||
unsigned int nNumber=0;
|
|
||||||
|
|
||||||
while (*str == ' ')
|
|
||||||
++str;
|
|
||||||
if (*str == '+')
|
|
||||||
++str;
|
|
||||||
else if (*str == '-')
|
|
||||||
return 0;
|
|
||||||
for (; *str != '\0' && *str >= '0' && *str <= '9'; ++str)
|
|
||||||
nNumber=(nNumber * 10) + (*str - '0');
|
|
||||||
return nNumber;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
*
|
|
||||||
* xatouiW
|
|
||||||
*
|
|
||||||
*Converts unicode string to unsigned int.
|
|
||||||
*
|
|
||||||
*[in] wchar_t *wstr -unicode string number
|
|
||||||
*
|
|
||||||
*Returns: unsigned integer
|
|
||||||
*
|
|
||||||
*Examples:
|
|
||||||
* xatouiW(L"45") == 45;
|
|
||||||
* xatouiW(L" -0045:value") == 0;
|
|
||||||
********************************************************************/
|
|
||||||
#if defined xatouiW || defined ALLCONVFUNC
|
|
||||||
#define xatouiW_INCLUDED
|
|
||||||
#undef xatouiW
|
|
||||||
unsigned int xatouiW(wchar_t *wstr)
|
|
||||||
{
|
|
||||||
unsigned int nNumber=0;
|
|
||||||
|
|
||||||
while (*wstr == ' ')
|
|
||||||
++wstr;
|
|
||||||
if (*wstr == '+')
|
|
||||||
++wstr;
|
|
||||||
else if (*wstr == '-')
|
|
||||||
return 0;
|
|
||||||
for (; *wstr != '\0' && *wstr >= '0' && *wstr <= '9'; ++wstr)
|
|
||||||
nNumber=(nNumber * 10) + (*wstr - '0');
|
|
||||||
return nNumber;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
*
|
|
||||||
* xuitoa
|
|
||||||
*
|
|
||||||
*Converts unsigned int to string.
|
|
||||||
*
|
|
||||||
*[in] unsigned int number -unsigned integer
|
|
||||||
*[out] char *str -string number
|
|
||||||
*[in] int width -minimum number of characters to the output
|
|
||||||
*
|
|
||||||
*Returns: a pointer to string
|
|
||||||
*
|
|
||||||
*Examples:
|
|
||||||
* xuitoa(45, szResult, 0); //szResult == "45"
|
|
||||||
* xuitoa(45, szResult, 4); //szResult == "0045"
|
|
||||||
********************************************************************/
|
|
||||||
#if defined xuitoa || defined ALLCONVFUNC
|
|
||||||
#define xuitoa_INCLUDED
|
|
||||||
#undef xuitoa
|
|
||||||
char* xuitoa(unsigned int number, char *str, int width)
|
|
||||||
{
|
|
||||||
char tmp[128]="";
|
|
||||||
int a=0;
|
|
||||||
int b=0;
|
|
||||||
|
|
||||||
if (number == 0)
|
|
||||||
{
|
|
||||||
str[0]='0';
|
|
||||||
--width;
|
|
||||||
b=1;
|
|
||||||
}
|
|
||||||
for (tmp[a]='\0'; number != 0; ++a)
|
|
||||||
{
|
|
||||||
tmp[a]=(number % 10) + '0';
|
|
||||||
number=number / 10;
|
|
||||||
}
|
|
||||||
for (; width > a; ++a) tmp[a]='0';
|
|
||||||
for (--a; a >= 0; --a, ++b) str[b]=tmp[a];
|
|
||||||
|
|
||||||
str[b]='\0';
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
*
|
|
||||||
* xuitoaW
|
|
||||||
*
|
|
||||||
*Converts unsigned int to unicode string.
|
|
||||||
*
|
|
||||||
*[in] unsigned int number -unsigned integer
|
|
||||||
*[out] wchar_t *wstr -unicode string number
|
|
||||||
*[in] int width -minimum number of characters to the output
|
|
||||||
*
|
|
||||||
*Returns: a pointer to unicode string
|
|
||||||
*
|
|
||||||
*Examples:
|
|
||||||
* xuitoaW(45, wszResult, 0); //wszResult == L"45"
|
|
||||||
* xuitoaW(45, wszResult, 4); //wszResult == L"0045"
|
|
||||||
********************************************************************/
|
|
||||||
#if defined xuitoaW || defined ALLCONVFUNC
|
|
||||||
#define xuitoaW_INCLUDED
|
|
||||||
#undef xuitoaW
|
|
||||||
wchar_t* xuitoaW(unsigned int number, wchar_t *wstr, int width)
|
|
||||||
{
|
|
||||||
wchar_t wtmp[128]=L"";
|
|
||||||
int a=0;
|
|
||||||
int b=0;
|
|
||||||
|
|
||||||
if (number == 0)
|
|
||||||
{
|
|
||||||
wstr[0]='0';
|
|
||||||
--width;
|
|
||||||
b=1;
|
|
||||||
}
|
|
||||||
for (wtmp[a]='\0'; number != 0; ++a)
|
|
||||||
{
|
|
||||||
wtmp[a]=(number % 10) + '0';
|
|
||||||
number=number / 10;
|
|
||||||
}
|
|
||||||
for (; width > a; ++a) wtmp[a]='0';
|
|
||||||
for (--a; a >= 0; --a, ++b) wstr[b]=wtmp[a];
|
|
||||||
|
|
||||||
wstr[b]='\0';
|
|
||||||
return wstr;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
*
|
|
||||||
* xatoi64
|
|
||||||
*
|
|
||||||
*Converts string to int64.
|
|
||||||
*
|
|
||||||
*[in] char *str -string number
|
|
||||||
*
|
|
||||||
*Returns: 64-bit integer
|
|
||||||
*
|
|
||||||
*Examples:
|
|
||||||
* xatoi64("45") == 45;
|
|
||||||
* xatoi64(" -0045:value") == -45;
|
|
||||||
********************************************************************/
|
|
||||||
#if defined xatoi64 || defined ALLCONVFUNC
|
|
||||||
#define xatoi64_INCLUDED
|
|
||||||
#undef xatoi64
|
|
||||||
__int64 xatoi64(char *str)
|
|
||||||
{
|
|
||||||
__int64 nNumber=0;
|
|
||||||
BOOL bMinus=FALSE;
|
|
||||||
|
|
||||||
while (*str == ' ')
|
|
||||||
++str;
|
|
||||||
if (*str == '+')
|
|
||||||
++str;
|
|
||||||
else if (*str == '-')
|
|
||||||
{
|
|
||||||
bMinus=TRUE;
|
|
||||||
++str;
|
|
||||||
}
|
|
||||||
for (; *str != '\0' && *str >= '0' && *str <= '9'; ++str)
|
|
||||||
nNumber=(nNumber * 10) + (*str - '0');
|
|
||||||
if (bMinus == TRUE)
|
|
||||||
nNumber=0 - nNumber;
|
|
||||||
return nNumber;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
*
|
|
||||||
* xatoi64W
|
|
||||||
*
|
|
||||||
*Converts unicode string to int64.
|
|
||||||
*
|
|
||||||
*[in] wchar_t *wstr -unicode string number
|
|
||||||
*
|
|
||||||
*Returns: 64-bit integer
|
|
||||||
*
|
|
||||||
*Examples:
|
|
||||||
* xatoi64W(L"45") == 45;
|
|
||||||
* xatoi64W(L" -0045:value") == -45;
|
|
||||||
********************************************************************/
|
|
||||||
#if defined xatoi64W || defined ALLCONVFUNC
|
|
||||||
#define xatoi64W_INCLUDED
|
|
||||||
#undef xatoi64W
|
|
||||||
__int64 xatoi64W(wchar_t *wstr)
|
|
||||||
{
|
|
||||||
__int64 nNumber=0;
|
|
||||||
BOOL bMinus=FALSE;
|
|
||||||
|
|
||||||
while (*wstr == ' ')
|
|
||||||
++wstr;
|
|
||||||
if (*wstr == '+')
|
|
||||||
++wstr;
|
|
||||||
else if (*wstr == '-')
|
|
||||||
{
|
|
||||||
bMinus=TRUE;
|
|
||||||
++wstr;
|
|
||||||
}
|
|
||||||
for (; *wstr != '\0' && *wstr >= '0' && *wstr <= '9'; ++wstr)
|
|
||||||
nNumber=(nNumber * 10) + (*wstr - '0');
|
|
||||||
if (bMinus == TRUE)
|
|
||||||
nNumber=0 - nNumber;
|
|
||||||
return nNumber;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
*
|
|
||||||
* xitoa64
|
|
||||||
*
|
|
||||||
*Converts int64 to string.
|
|
||||||
*
|
|
||||||
*[in] __int64 number -64-bit integer
|
|
||||||
*[out] char *str -string number
|
|
||||||
*[in] int width -minimum number of characters to the output
|
|
||||||
*
|
|
||||||
*Returns: a pointer to string
|
|
||||||
*
|
|
||||||
*Examples:
|
|
||||||
* xi64toa(45, szResult, 0); //szResult == "45"
|
|
||||||
* xi64toa(-45, szResult, 0); //szResult == "-45"
|
|
||||||
* xi64toa(45, szResult, 4); //szResult == "0045"
|
|
||||||
********************************************************************/
|
|
||||||
#if defined xi64toa || defined ALLCONVFUNC
|
|
||||||
#define xi64toa_INCLUDED
|
|
||||||
#undef xi64toa
|
|
||||||
char* xi64toa(__int64 number, char *str, int width)
|
|
||||||
{
|
|
||||||
char tmp[128]="";
|
|
||||||
int a=0;
|
|
||||||
int b=0;
|
|
||||||
|
|
||||||
if (number == 0)
|
|
||||||
{
|
|
||||||
str[0]='0';
|
|
||||||
--width;
|
|
||||||
b=1;
|
|
||||||
}
|
|
||||||
else if (number < 0)
|
|
||||||
{
|
|
||||||
str[0]='-';
|
|
||||||
number=0 - number;
|
|
||||||
--width;
|
|
||||||
b=1;
|
|
||||||
}
|
|
||||||
for (tmp[a]='\0'; number != 0; ++a)
|
|
||||||
{
|
|
||||||
tmp[a]=(char)((number % 10) + '0');
|
|
||||||
number=number / 10;
|
|
||||||
}
|
|
||||||
for (; width > a; ++a) tmp[a]='0';
|
|
||||||
for (--a; a >= 0; --a, ++b) str[b]=tmp[a];
|
|
||||||
|
|
||||||
str[b]='\0';
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
*
|
|
||||||
* xitoa64W
|
|
||||||
*
|
|
||||||
*Converts int64 to unicode string.
|
|
||||||
*
|
|
||||||
*[in] __int64 number -64-bit integer
|
|
||||||
*[out] wchar_t *wstr -unicode string number
|
|
||||||
*[in] int width -minimum number of characters to the output
|
|
||||||
*
|
|
||||||
*Returns: a pointer to unicode string
|
|
||||||
*
|
|
||||||
*Examples:
|
|
||||||
* xi64toaW(45, wszResult, 0); //wszResult == L"45"
|
|
||||||
* xi64toaW(-45, wszResult, 0); //wszResult == L"-45"
|
|
||||||
* xi64toaW(45, wszResult, 4); //wszResult == L"0045"
|
|
||||||
********************************************************************/
|
|
||||||
#if defined xi64toaW || defined ALLCONVFUNC
|
|
||||||
#define xi64toaW_INCLUDED
|
|
||||||
#undef xi64toaW
|
|
||||||
wchar_t* xi64toaW(__int64 number, wchar_t *wstr, int width)
|
|
||||||
{
|
|
||||||
wchar_t wtmp[128]=L"";
|
|
||||||
int a=0;
|
|
||||||
int b=0;
|
|
||||||
|
|
||||||
if (number == 0)
|
|
||||||
{
|
|
||||||
wstr[0]='0';
|
|
||||||
--width;
|
|
||||||
b=1;
|
|
||||||
}
|
|
||||||
else if (number < 0)
|
|
||||||
{
|
|
||||||
wstr[0]='-';
|
|
||||||
number=0 - number;
|
|
||||||
--width;
|
|
||||||
b=1;
|
|
||||||
}
|
|
||||||
for (wtmp[a]='\0'; number != 0; ++a)
|
|
||||||
{
|
|
||||||
wtmp[a]=(char)((number % 10) + '0');
|
|
||||||
number=number / 10;
|
|
||||||
}
|
|
||||||
for (; width > a; ++a) wtmp[a]='0';
|
|
||||||
for (--a; a >= 0; --a, ++b) wstr[b]=wtmp[a];
|
|
||||||
|
|
||||||
wstr[b]='\0';
|
|
||||||
return wstr;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
*
|
|
||||||
* hex2dec
|
|
||||||
*
|
|
||||||
*Converts hex value to decimal.
|
|
||||||
*
|
|
||||||
*[in] char *hex -hex value
|
|
||||||
*
|
|
||||||
*Returns: integer
|
|
||||||
* -1 wrong hex value
|
|
||||||
*
|
|
||||||
*Examples:
|
|
||||||
* hex2dec("A1F") == 2591;
|
|
||||||
********************************************************************/
|
|
||||||
#if defined hex2dec || defined ALLCONVFUNC
|
|
||||||
#define hex2dec_INCLUDED
|
|
||||||
#undef hex2dec
|
|
||||||
int hex2dec(char *hex)
|
|
||||||
{
|
|
||||||
int a;
|
|
||||||
int b=0;
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
a=*hex++;
|
|
||||||
if (a >= '0' && a <= '9') a-='0';
|
|
||||||
else if (a >= 'a' && a <= 'f') a-='a'-10;
|
|
||||||
else if (a >= 'A' && a <= 'F') a-='A'-10;
|
|
||||||
else return -1;
|
|
||||||
|
|
||||||
if (*hex) b=(b + a) * 16;
|
|
||||||
else return (b + a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
*
|
|
||||||
* hex2decW
|
|
||||||
*
|
|
||||||
*Converts unicode hex value to decimal.
|
|
||||||
*
|
|
||||||
*[in] wchar_t *whex -unicode hex value
|
|
||||||
*
|
|
||||||
*Returns: integer
|
|
||||||
* -1 wrong hex value
|
|
||||||
*
|
|
||||||
*Examples:
|
|
||||||
* hex2decW(L"A1F") == 2591;
|
|
||||||
********************************************************************/
|
|
||||||
#if defined hex2decW || defined ALLCONVFUNC
|
|
||||||
#define hex2decW_INCLUDED
|
|
||||||
#undef hex2decW
|
|
||||||
int hex2decW(wchar_t *whex)
|
|
||||||
{
|
|
||||||
int a;
|
|
||||||
int b=0;
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
a=*whex++;
|
|
||||||
if (a >= '0' && a <= '9') a-='0';
|
|
||||||
else if (a >= 'a' && a <= 'f') a-='a'-10;
|
|
||||||
else if (a >= 'A' && a <= 'F') a-='A'-10;
|
|
||||||
else return -1;
|
|
||||||
|
|
||||||
if (*whex) b=(b + a) * 16;
|
|
||||||
else return (b + a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
*
|
|
||||||
* dec2hex [API: wsprintf(szResult, "%02x", 2591)]
|
|
||||||
*
|
|
||||||
*Converts decimal to hex value.
|
|
||||||
*
|
|
||||||
*[in] unsigned int dec -positive integer
|
|
||||||
*[out] char *hex -hex value (output)
|
|
||||||
*[in] BOOL lowercase -if TRUE hexadecimal value in lowercase
|
|
||||||
* if FALSE in uppercase.
|
|
||||||
*[in] unsigned int width -minimum number of characters to the output
|
|
||||||
*
|
|
||||||
*Examples:
|
|
||||||
* dec2hex(2591, szResult, FALSE, 2); //szResult == "A1F"
|
|
||||||
* dec2hex(10, szResult, TRUE, 2); //szResult == "0a"
|
|
||||||
********************************************************************/
|
|
||||||
#if defined dec2hex || defined ALLCONVFUNC
|
|
||||||
#define dec2hex_INCLUDED
|
|
||||||
#undef dec2hex
|
|
||||||
void dec2hex(unsigned int dec, char *hex, BOOL lowercase, unsigned int width)
|
|
||||||
{
|
|
||||||
unsigned int a=dec;
|
|
||||||
unsigned int b=0;
|
|
||||||
unsigned int c=0;
|
|
||||||
char d='1';
|
|
||||||
if (a == 0) d='0';
|
|
||||||
|
|
||||||
while (a)
|
|
||||||
{
|
|
||||||
b=a % 16;
|
|
||||||
a=a / 16;
|
|
||||||
if (b < 10) hex[c++]=b + '0';
|
|
||||||
else if (lowercase == TRUE) hex[c++]=b + 'a' - 10;
|
|
||||||
else hex[c++]=b + 'A' - 10;
|
|
||||||
}
|
|
||||||
while (width > c) hex[c++]='0';
|
|
||||||
hex[c]='\0';
|
|
||||||
|
|
||||||
if (d == '1')
|
|
||||||
for (b=0, --c; b < c; d=hex[b], hex[b++]=hex[c], hex[c--]=d);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
*
|
|
||||||
* dec2hexW [API: wsprintfW(wszResult, L"%02x", 2591)]
|
|
||||||
*
|
|
||||||
*Converts decimal to unicode hex value.
|
|
||||||
*
|
|
||||||
*[in] unsigned int dec -positive integer
|
|
||||||
*[out] wchar_t *whex -unicode hex value (output)
|
|
||||||
*[in] BOOL lowercase -if TRUE hexadecimal value in lowercase
|
|
||||||
* if FALSE in uppercase.
|
|
||||||
*[in] unsigned int width -minimum number of characters to the output
|
|
||||||
*
|
|
||||||
*Examples:
|
|
||||||
* dec2hexW(2591, wszResult, FALSE, 2); //wszResult == L"A1F"
|
|
||||||
* dec2hexW(10, wszResult, TRUE, 2); //wszResult == L"0a"
|
|
||||||
********************************************************************/
|
|
||||||
#if defined dec2hexW || defined ALLCONVFUNC
|
|
||||||
#define dec2hexW_INCLUDED
|
|
||||||
#undef dec2hexW
|
|
||||||
void dec2hexW(unsigned int dec, wchar_t *whex, BOOL lowercase, unsigned int width)
|
|
||||||
{
|
|
||||||
unsigned int a=dec;
|
|
||||||
unsigned int b=0;
|
|
||||||
unsigned int c=0;
|
|
||||||
wchar_t d='1';
|
|
||||||
if (a == 0) d='0';
|
|
||||||
|
|
||||||
while (a)
|
|
||||||
{
|
|
||||||
b=a % 16;
|
|
||||||
a=a / 16;
|
|
||||||
if (b < 10) whex[c++]=b + '0';
|
|
||||||
else if (lowercase == TRUE) whex[c++]=b + 'a' - 10;
|
|
||||||
else whex[c++]=b + 'A' - 10;
|
|
||||||
}
|
|
||||||
while (width > c) whex[c++]='0';
|
|
||||||
whex[c]='\0';
|
|
||||||
|
|
||||||
if (d == '1')
|
|
||||||
for (b=0, --c; b < c; d=whex[b], whex[b++]=whex[c], whex[c--]=d);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
*
|
|
||||||
* str2hex
|
|
||||||
*
|
|
||||||
*Converts string to hex values.
|
|
||||||
*
|
|
||||||
*[in] unsigned char *str -string
|
|
||||||
*[out] char *hex -hex string
|
|
||||||
*[in] BOOL lowercase -if TRUE hexadecimal value in lowercase
|
|
||||||
* if FALSE in uppercase.
|
|
||||||
*[in] unsigned int bytes -number of bytes in string
|
|
||||||
*
|
|
||||||
*Note:
|
|
||||||
* str2hex uses dec2hex
|
|
||||||
*
|
|
||||||
*Examples:
|
|
||||||
* str2hex((unsigned char *)"Some Text", szResult, TRUE, lstrlen("Some Text")); //szResult == "536f6d652054657874"
|
|
||||||
********************************************************************/
|
|
||||||
#if defined str2hex || defined ALLCONVFUNCS
|
|
||||||
#define str2hex_INCLUDED
|
|
||||||
#undef str2hex
|
|
||||||
void str2hex(unsigned char *str, char *hex, BOOL lowercase, unsigned int bytes)
|
|
||||||
{
|
|
||||||
char a[16];
|
|
||||||
unsigned int b=0;
|
|
||||||
|
|
||||||
for (hex[0]='\0'; b < bytes; ++b)
|
|
||||||
{
|
|
||||||
//wsprintf(a, "%02x", (unsigned int)str[b]);
|
|
||||||
dec2hex((unsigned int)str[b], a, lowercase, 2);
|
|
||||||
lstrcat(hex, a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
*
|
|
||||||
* hex2str
|
|
||||||
*
|
|
||||||
*Converts hex values to string.
|
|
||||||
*
|
|
||||||
*[in] char *hex -hex string
|
|
||||||
*[out] char *str -string
|
|
||||||
*
|
|
||||||
*Examples:
|
|
||||||
* hex2str("536f6d652054657874", szResult); //szResult == "Some Text"
|
|
||||||
********************************************************************/
|
|
||||||
#if defined hex2str || defined ALLCONVFUNCS
|
|
||||||
#define hex2str_INCLUDED
|
|
||||||
#undef hex2str
|
|
||||||
void hex2str(char *hex, char *str)
|
|
||||||
{
|
|
||||||
char a[4];
|
|
||||||
int b;
|
|
||||||
|
|
||||||
while (*hex)
|
|
||||||
{
|
|
||||||
a[0]=*hex;
|
|
||||||
a[1]=*++hex;
|
|
||||||
a[2]='\0';
|
|
||||||
|
|
||||||
if (*hex++)
|
|
||||||
{
|
|
||||||
if ((b=hex2dec(a)) > 0) *str++=b;
|
|
||||||
else break;
|
|
||||||
}
|
|
||||||
else break;
|
|
||||||
}
|
|
||||||
*str='\0';
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
* *
|
|
||||||
* Example *
|
|
||||||
* *
|
|
||||||
********************************************************************
|
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <windows.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "ConvFunc.h"
|
|
||||||
|
|
||||||
//insert functions
|
|
||||||
#define xatoi
|
|
||||||
#define xitoa
|
|
||||||
#include "ConvFunc.h"
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
char szResult[MAX_PATH]="43";
|
|
||||||
char *pResult;
|
|
||||||
int nError;
|
|
||||||
|
|
||||||
nError=xatoi(szResult);
|
|
||||||
printf("nError={%d}\n", nError);
|
|
||||||
|
|
||||||
pResult=xitoa(45, szResult, 0);
|
|
||||||
printf("szResult={%s}, pResult={%s}\n", szResult, pResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
@ -1,435 +0,0 @@
|
|||||||
/*****************************************************************
|
|
||||||
* nsProcess NSIS plugin v1.5 *
|
|
||||||
* *
|
|
||||||
* 2006 Shengalts Aleksander aka Instructor (Shengalts@mail.ru) *
|
|
||||||
* *
|
|
||||||
* Source function FIND_PROC_BY_NAME based *
|
|
||||||
* upon the Ravi Kochhar (kochhar@physiology.wisc.edu) code *
|
|
||||||
* Thanks iceman_k (FindProcDLL plugin) and *
|
|
||||||
* DITMan (KillProcDLL plugin) for point me up *
|
|
||||||
*****************************************************************/
|
|
||||||
|
|
||||||
#define UNICODE
|
|
||||||
#define _UNICODE
|
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <windows.h>
|
|
||||||
#include <Tlhelp32.h>
|
|
||||||
#include "ConvFunc.h"
|
|
||||||
|
|
||||||
/* Defines */
|
|
||||||
#define NSIS_MAX_STRLEN 1024
|
|
||||||
|
|
||||||
#define SystemProcessInformation 5
|
|
||||||
#define STATUS_SUCCESS 0x00000000L
|
|
||||||
#define STATUS_INFO_LENGTH_MISMATCH 0xC0000004L
|
|
||||||
|
|
||||||
typedef struct _SYSTEM_THREAD_INFO {
|
|
||||||
FILETIME ftCreationTime;
|
|
||||||
DWORD dwUnknown1;
|
|
||||||
DWORD dwStartAddress;
|
|
||||||
DWORD dwOwningPID;
|
|
||||||
DWORD dwThreadID;
|
|
||||||
DWORD dwCurrentPriority;
|
|
||||||
DWORD dwBasePriority;
|
|
||||||
DWORD dwContextSwitches;
|
|
||||||
DWORD dwThreadState;
|
|
||||||
DWORD dwUnknown2;
|
|
||||||
DWORD dwUnknown3;
|
|
||||||
DWORD dwUnknown4;
|
|
||||||
DWORD dwUnknown5;
|
|
||||||
DWORD dwUnknown6;
|
|
||||||
DWORD dwUnknown7;
|
|
||||||
} SYSTEM_THREAD_INFO;
|
|
||||||
|
|
||||||
typedef struct _SYSTEM_PROCESS_INFO {
|
|
||||||
DWORD dwOffset;
|
|
||||||
DWORD dwThreadCount;
|
|
||||||
DWORD dwUnkown1[6];
|
|
||||||
FILETIME ftCreationTime;
|
|
||||||
DWORD dwUnkown2;
|
|
||||||
DWORD dwUnkown3;
|
|
||||||
DWORD dwUnkown4;
|
|
||||||
DWORD dwUnkown5;
|
|
||||||
DWORD dwUnkown6;
|
|
||||||
WCHAR *pszProcessName;
|
|
||||||
DWORD dwBasePriority;
|
|
||||||
DWORD dwProcessID;
|
|
||||||
DWORD dwParentProcessID;
|
|
||||||
DWORD dwHandleCount;
|
|
||||||
DWORD dwUnkown7;
|
|
||||||
DWORD dwUnkown8;
|
|
||||||
DWORD dwVirtualBytesPeak;
|
|
||||||
DWORD dwVirtualBytes;
|
|
||||||
DWORD dwPageFaults;
|
|
||||||
DWORD dwWorkingSetPeak;
|
|
||||||
DWORD dwWorkingSet;
|
|
||||||
DWORD dwUnkown9;
|
|
||||||
DWORD dwPagedPool;
|
|
||||||
DWORD dwUnkown10;
|
|
||||||
DWORD dwNonPagedPool;
|
|
||||||
DWORD dwPageFileBytesPeak;
|
|
||||||
DWORD dwPageFileBytes;
|
|
||||||
DWORD dwPrivateBytes;
|
|
||||||
DWORD dwUnkown11;
|
|
||||||
DWORD dwUnkown12;
|
|
||||||
DWORD dwUnkown13;
|
|
||||||
DWORD dwUnkown14;
|
|
||||||
SYSTEM_THREAD_INFO ati[ANYSIZE_ARRAY];
|
|
||||||
} SYSTEM_PROCESS_INFO;
|
|
||||||
|
|
||||||
|
|
||||||
/* Include conversion functions */
|
|
||||||
#ifdef UNICODE
|
|
||||||
#define xatoiW
|
|
||||||
#define xitoaW
|
|
||||||
#else
|
|
||||||
#define xatoi
|
|
||||||
#define xitoa
|
|
||||||
#endif
|
|
||||||
#include "ConvFunc.h"
|
|
||||||
|
|
||||||
/* NSIS stack structure */
|
|
||||||
typedef struct _stack_t {
|
|
||||||
struct _stack_t *next;
|
|
||||||
TCHAR text[1];
|
|
||||||
} stack_t;
|
|
||||||
|
|
||||||
stack_t **g_stacktop;
|
|
||||||
TCHAR *g_variables;
|
|
||||||
unsigned int g_stringsize;
|
|
||||||
|
|
||||||
#define EXDLL_INIT() \
|
|
||||||
{ \
|
|
||||||
g_stacktop=stacktop; \
|
|
||||||
g_variables=variables; \
|
|
||||||
g_stringsize=string_size; \
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Global variables */
|
|
||||||
TCHAR szBuf[NSIS_MAX_STRLEN];
|
|
||||||
|
|
||||||
/* Funtions prototypes and macros */
|
|
||||||
int FIND_PROC_BY_NAME(TCHAR *szProcessName, BOOL bTerminate);
|
|
||||||
int popinteger();
|
|
||||||
void pushinteger(int integer);
|
|
||||||
int popstring(TCHAR *str, int len);
|
|
||||||
void pushstring(const TCHAR *str, int len);
|
|
||||||
|
|
||||||
|
|
||||||
/* NSIS functions code */
|
|
||||||
void __declspec(dllexport) _FindProcess(HWND hwndParent, int string_size,
|
|
||||||
TCHAR *variables, stack_t **stacktop)
|
|
||||||
{
|
|
||||||
EXDLL_INIT();
|
|
||||||
{
|
|
||||||
int nError;
|
|
||||||
|
|
||||||
popstring(szBuf, NSIS_MAX_STRLEN);
|
|
||||||
nError=FIND_PROC_BY_NAME(szBuf, FALSE);
|
|
||||||
pushinteger(nError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void __declspec(dllexport) _KillProcess(HWND hwndParent, int string_size,
|
|
||||||
TCHAR *variables, stack_t **stacktop)
|
|
||||||
{
|
|
||||||
EXDLL_INIT();
|
|
||||||
{
|
|
||||||
int nError;
|
|
||||||
|
|
||||||
popstring(szBuf, NSIS_MAX_STRLEN);
|
|
||||||
nError=FIND_PROC_BY_NAME(szBuf, TRUE);
|
|
||||||
pushinteger(nError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void __declspec(dllexport) _Unload(HWND hwndParent, int string_size,
|
|
||||||
TCHAR *variables, stack_t **stacktop)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int FIND_PROC_BY_NAME(TCHAR *szProcessName, BOOL bTerminate)
|
|
||||||
// Find the process "szProcessName" if it is currently running.
|
|
||||||
// This works for Win95/98/ME and also WinNT/2000/XP.
|
|
||||||
// The process name is case-insensitive, i.e. "notepad.exe" and "NOTEPAD.EXE"
|
|
||||||
// will both work. If bTerminate is TRUE, then process will be terminated.
|
|
||||||
//
|
|
||||||
// Return codes are as follows:
|
|
||||||
// 0 = Success
|
|
||||||
// 601 = No permission to terminate process
|
|
||||||
// 602 = Not all processes terminated successfully
|
|
||||||
// 603 = Process was not currently running
|
|
||||||
// 604 = Unable to identify system type
|
|
||||||
// 605 = Unsupported OS
|
|
||||||
// 606 = Unable to load NTDLL.DLL
|
|
||||||
// 607 = Unable to get procedure address from NTDLL.DLL
|
|
||||||
// 608 = NtQuerySystemInformation failed
|
|
||||||
// 609 = Unable to load KERNEL32.DLL
|
|
||||||
// 610 = Unable to get procedure address from KERNEL32.DLL
|
|
||||||
// 611 = CreateToolhelp32Snapshot failed
|
|
||||||
//
|
|
||||||
// Change history:
|
|
||||||
// created 06/23/2000 - Ravi Kochhar (kochhar@physiology.wisc.edu)
|
|
||||||
// http://www.neurophys.wisc.edu/ravi/software/
|
|
||||||
// modified 03/08/2002 - Ravi Kochhar (kochhar@physiology.wisc.edu)
|
|
||||||
// - Borland-C compatible if BORLANDC is defined as
|
|
||||||
// suggested by Bob Christensen
|
|
||||||
// modified 03/10/2002 - Ravi Kochhar (kochhar@physiology.wisc.edu)
|
|
||||||
// - Removed memory leaks as suggested by
|
|
||||||
// Jonathan Richard-Brochu (handles to Proc and Snapshot
|
|
||||||
// were not getting closed properly in some cases)
|
|
||||||
// modified 14/11/2005 - Shengalts Aleksander aka Instructor (Shengalts@mail.ru):
|
|
||||||
// - Combine functions FIND_PROC_BY_NAME and KILL_PROC_BY_NAME
|
|
||||||
// - Code has been optimized
|
|
||||||
// - Now kill all processes with specified name (not only one)
|
|
||||||
// - Cosmetic improvements
|
|
||||||
// - Removed error 632 (Invalid process name)
|
|
||||||
// - Changed error 602 (Unable to terminate process for some other reason)
|
|
||||||
// - BORLANDC define not needed
|
|
||||||
// modified 04/01/2006 - Shengalts Aleksander aka Instructor (Shengalts@mail.ru):
|
|
||||||
// - Removed CRT dependency
|
|
||||||
// modified 21/04/2006 - Shengalts Aleksander aka Instructor (Shengalts@mail.ru):
|
|
||||||
// - Removed memory leak as suggested by {_trueparuex^}
|
|
||||||
// (handle to hSnapShot was not getting closed properly in some cases)
|
|
||||||
// modified 21/04/2006 - Shengalts Aleksander aka Instructor (Shengalts@mail.ru):
|
|
||||||
// - Removed memory leak as suggested by {_trueparuex^}
|
|
||||||
// (handle to hSnapShot was not getting closed properly in some cases)
|
|
||||||
// modified 19/07/2006 - Shengalts Aleksander aka Instructor (Shengalts@mail.ru):
|
|
||||||
// - Code for WinNT/2000/XP has been rewritten
|
|
||||||
// - Changed error codes
|
|
||||||
// modified 31/08/2006 - Shengalts Aleksander aka Instructor (Shengalts@mail.ru):
|
|
||||||
// - Removed memory leak as suggested by Daniel Vanesse
|
|
||||||
{
|
|
||||||
#ifndef UNICODE
|
|
||||||
char szName[MAX_PATH];
|
|
||||||
#endif
|
|
||||||
OSVERSIONINFO osvi;
|
|
||||||
HMODULE hLib;
|
|
||||||
HANDLE hProc;
|
|
||||||
ULONG uError;
|
|
||||||
BOOL bFound=FALSE;
|
|
||||||
BOOL bSuccess=FALSE;
|
|
||||||
BOOL bFailed=FALSE;
|
|
||||||
|
|
||||||
// First check what version of Windows we're in
|
|
||||||
osvi.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
|
|
||||||
if (!GetVersionEx(&osvi)) return 604;
|
|
||||||
|
|
||||||
if (osvi.dwPlatformId != VER_PLATFORM_WIN32_NT &&
|
|
||||||
osvi.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS)
|
|
||||||
return 605;
|
|
||||||
|
|
||||||
if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)
|
|
||||||
{
|
|
||||||
// WinNT/2000/XP
|
|
||||||
|
|
||||||
SYSTEM_PROCESS_INFO *spi;
|
|
||||||
SYSTEM_PROCESS_INFO *spiCount;
|
|
||||||
DWORD dwSize=0x4000;
|
|
||||||
DWORD dwData;
|
|
||||||
ULONG (WINAPI *NtQuerySystemInformationPtr)(ULONG, PVOID, LONG, PULONG);
|
|
||||||
|
|
||||||
if (hLib=LoadLibraryA("NTDLL.DLL"))
|
|
||||||
{
|
|
||||||
NtQuerySystemInformationPtr=(ULONG(WINAPI *)(ULONG, PVOID, LONG, PULONG))GetProcAddress(hLib, "NtQuerySystemInformation");
|
|
||||||
|
|
||||||
if (NtQuerySystemInformationPtr)
|
|
||||||
{
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
if (spi=LocalAlloc(LMEM_FIXED, dwSize))
|
|
||||||
{
|
|
||||||
uError=(*NtQuerySystemInformationPtr)(SystemProcessInformation, spi, dwSize, &dwData);
|
|
||||||
|
|
||||||
if (uError == STATUS_SUCCESS) break;
|
|
||||||
|
|
||||||
LocalFree(spi);
|
|
||||||
|
|
||||||
if (uError != STATUS_INFO_LENGTH_MISMATCH)
|
|
||||||
{
|
|
||||||
uError=608;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
uError=608;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
dwSize*=2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else uError=607;
|
|
||||||
|
|
||||||
FreeLibrary(hLib);
|
|
||||||
}
|
|
||||||
else uError=606;
|
|
||||||
|
|
||||||
if (uError != STATUS_SUCCESS) return uError;
|
|
||||||
|
|
||||||
spiCount=spi;
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
if (spiCount->pszProcessName)
|
|
||||||
{
|
|
||||||
#ifdef UNICODE
|
|
||||||
if (!lstrcmpi(spiCount->pszProcessName, szProcessName))
|
|
||||||
#else
|
|
||||||
WideCharToMultiByte(CP_ACP, 0, spiCount->pszProcessName, -1, szName, MAX_PATH, NULL, NULL);
|
|
||||||
|
|
||||||
if (!lstrcmpi(szName, szProcessName))
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
// Process found
|
|
||||||
bFound=TRUE;
|
|
||||||
|
|
||||||
if (bTerminate == TRUE)
|
|
||||||
{
|
|
||||||
// Open for termination
|
|
||||||
if (hProc=OpenProcess(PROCESS_TERMINATE, FALSE, spiCount->dwProcessID))
|
|
||||||
{
|
|
||||||
if (TerminateProcess(hProc, 0))
|
|
||||||
bSuccess=TRUE;
|
|
||||||
else
|
|
||||||
bFailed=TRUE;
|
|
||||||
CloseHandle(hProc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (spiCount->dwOffset == 0) break;
|
|
||||||
spiCount=(SYSTEM_PROCESS_INFO *)((char *)spiCount + spiCount->dwOffset);
|
|
||||||
}
|
|
||||||
LocalFree(spi);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Win95/98/ME
|
|
||||||
|
|
||||||
PROCESSENTRY32 pe;
|
|
||||||
TCHAR *pName;
|
|
||||||
HANDLE hSnapShot;
|
|
||||||
BOOL bResult;
|
|
||||||
HANDLE (WINAPI *CreateToolhelp32SnapshotPtr)(DWORD, DWORD);
|
|
||||||
BOOL (WINAPI *Process32FirstPtr)(HANDLE, LPPROCESSENTRY32);
|
|
||||||
BOOL (WINAPI *Process32NextPtr)(HANDLE, LPPROCESSENTRY32);
|
|
||||||
|
|
||||||
if (hLib=LoadLibraryA("KERNEL32.DLL"))
|
|
||||||
{
|
|
||||||
CreateToolhelp32SnapshotPtr=(HANDLE(WINAPI *)(DWORD, DWORD)) GetProcAddress(hLib, "CreateToolhelp32Snapshot");
|
|
||||||
Process32FirstPtr=(BOOL(WINAPI *)(HANDLE, LPPROCESSENTRY32)) GetProcAddress(hLib, "Process32First");
|
|
||||||
Process32NextPtr=(BOOL(WINAPI *)(HANDLE, LPPROCESSENTRY32)) GetProcAddress(hLib, "Process32Next");
|
|
||||||
|
|
||||||
if (CreateToolhelp32SnapshotPtr && Process32NextPtr && Process32FirstPtr)
|
|
||||||
{
|
|
||||||
// Get a handle to a Toolhelp snapshot of all the systems processes.
|
|
||||||
if ((hSnapShot=(*CreateToolhelp32SnapshotPtr)(TH32CS_SNAPPROCESS, 0)) != INVALID_HANDLE_VALUE)
|
|
||||||
{
|
|
||||||
// Get the first process' information.
|
|
||||||
pe.dwSize=sizeof(PROCESSENTRY32);
|
|
||||||
bResult=(*Process32FirstPtr)(hSnapShot, &pe);
|
|
||||||
|
|
||||||
// While there are processes, keep looping and checking.
|
|
||||||
while (bResult)
|
|
||||||
{
|
|
||||||
//Get file name
|
|
||||||
for (pName=pe.szExeFile + lstrlen(pe.szExeFile) - 1; *pName != '\\' && *pName != '\0'; --pName);
|
|
||||||
|
|
||||||
if (!lstrcmpi(++pName, szProcessName))
|
|
||||||
{
|
|
||||||
// Process found
|
|
||||||
bFound=TRUE;
|
|
||||||
|
|
||||||
if (bTerminate == TRUE)
|
|
||||||
{
|
|
||||||
// Open for termination
|
|
||||||
if (hProc=OpenProcess(PROCESS_TERMINATE, FALSE, pe.th32ProcessID))
|
|
||||||
{
|
|
||||||
if (TerminateProcess(hProc, 0))
|
|
||||||
bSuccess=TRUE;
|
|
||||||
else
|
|
||||||
bFailed=TRUE;
|
|
||||||
CloseHandle(hProc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else break;
|
|
||||||
}
|
|
||||||
//Keep looking
|
|
||||||
bResult=(*Process32NextPtr)(hSnapShot, &pe);
|
|
||||||
}
|
|
||||||
CloseHandle(hSnapShot);
|
|
||||||
}
|
|
||||||
else uError=611;
|
|
||||||
}
|
|
||||||
else uError=610;
|
|
||||||
|
|
||||||
FreeLibrary(hLib);
|
|
||||||
}
|
|
||||||
else uError=609;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bFound == FALSE) return 603;
|
|
||||||
if (bTerminate == TRUE)
|
|
||||||
{
|
|
||||||
if (bSuccess == FALSE) return 601;
|
|
||||||
if (bFailed == TRUE) return 602;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int popinteger()
|
|
||||||
{
|
|
||||||
TCHAR szInt[32];
|
|
||||||
|
|
||||||
popstring(szInt, 32);
|
|
||||||
#ifdef UNICODE
|
|
||||||
return xatoiW(szInt);
|
|
||||||
#else
|
|
||||||
return xatoi(szInt);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void pushinteger(int integer)
|
|
||||||
{
|
|
||||||
TCHAR szInt[32];
|
|
||||||
|
|
||||||
#ifdef UNICODE
|
|
||||||
xitoaW(integer, szInt, 0);
|
|
||||||
#else
|
|
||||||
xitoa(integer, szInt, 0);
|
|
||||||
#endif
|
|
||||||
pushstring(szInt, 32);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Function: Removes the element from the top of the NSIS stack and puts it in the buffer
|
|
||||||
int popstring(TCHAR *str, int len)
|
|
||||||
{
|
|
||||||
stack_t *th;
|
|
||||||
|
|
||||||
if (!g_stacktop || !*g_stacktop) return 1;
|
|
||||||
th=(*g_stacktop);
|
|
||||||
lstrcpyn(str, th->text, len);
|
|
||||||
*g_stacktop=th->next;
|
|
||||||
GlobalFree((HGLOBAL)th);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Function: Adds an element to the top of the NSIS stack
|
|
||||||
void pushstring(const TCHAR *str, int len)
|
|
||||||
{
|
|
||||||
stack_t *th;
|
|
||||||
|
|
||||||
if (!g_stacktop) return;
|
|
||||||
th=(stack_t*)GlobalAlloc(GPTR, sizeof(stack_t) + len);
|
|
||||||
lstrcpyn(th->text, str, len);
|
|
||||||
th->next=*g_stacktop;
|
|
||||||
*g_stacktop=th;
|
|
||||||
}
|
|
@ -1,108 +0,0 @@
|
|||||||
# Microsoft Developer Studio Project File - Name="nsProcess" - Package Owner=<4>
|
|
||||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
|
||||||
# ** DO NOT EDIT **
|
|
||||||
|
|
||||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
|
||||||
|
|
||||||
CFG=nsProcess - Win32 Debug
|
|
||||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
|
||||||
!MESSAGE use the Export Makefile command and run
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE NMAKE /f "nsProcess.mak".
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE You can specify a configuration when running NMAKE
|
|
||||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE NMAKE /f "nsProcess.mak" CFG="nsProcess - Win32 Debug"
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE Possible choices for configuration are:
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE "nsProcess - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
|
||||||
!MESSAGE "nsProcess - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
|
||||||
!MESSAGE
|
|
||||||
|
|
||||||
# Begin Project
|
|
||||||
# PROP AllowPerConfigDependencies 0
|
|
||||||
# PROP Scc_ProjName ""
|
|
||||||
# PROP Scc_LocalPath ""
|
|
||||||
CPP=cl.exe
|
|
||||||
MTL=midl.exe
|
|
||||||
RSC=rc.exe
|
|
||||||
|
|
||||||
!IF "$(CFG)" == "nsProcess - Win32 Release"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 0
|
|
||||||
# PROP BASE Output_Dir "Release"
|
|
||||||
# PROP BASE Intermediate_Dir "Release"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 0
|
|
||||||
# PROP Output_Dir "Release"
|
|
||||||
# PROP Intermediate_Dir "Release"
|
|
||||||
# PROP Ignore_Export_Lib 0
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "nsProcess_EXPORTS" /YX /FD /c
|
|
||||||
# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "nsProcess_EXPORTS" /YX /FD /c
|
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
|
||||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
|
||||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
|
||||||
# ADD LINK32 kernel32.lib user32.lib /nologo /entry:"DllMain" /dll /machine:I386 /nodefaultlib /out:"nsProcess.dll" /opt:nowin98
|
|
||||||
# SUBTRACT LINK32 /pdb:none
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "nsProcess - Win32 Debug"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 1
|
|
||||||
# PROP BASE Output_Dir "Debug"
|
|
||||||
# PROP BASE Intermediate_Dir "Debug"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 1
|
|
||||||
# PROP Output_Dir "Debug"
|
|
||||||
# PROP Intermediate_Dir "Debug"
|
|
||||||
# PROP Ignore_Export_Lib 0
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "nsProcess_EXPORTS" /YX /FD /GZ /c
|
|
||||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "nsProcess_EXPORTS" /YX /FD /GZ /c
|
|
||||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
|
||||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
|
||||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
|
||||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
|
||||||
# ADD LINK32 kernel32.lib user32.lib libcd.lib /nologo /dll /debug /machine:I386 /nodefaultlib /pdbtype:sept
|
|
||||||
|
|
||||||
!ENDIF
|
|
||||||
|
|
||||||
# Begin Target
|
|
||||||
|
|
||||||
# Name "nsProcess - Win32 Release"
|
|
||||||
# Name "nsProcess - Win32 Debug"
|
|
||||||
# Begin Group "Source Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\nsProcess.c
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
|
||||||
# Begin Group "Header Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
|
||||||
# End Group
|
|
||||||
# Begin Group "Resource Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
|
||||||
# End Group
|
|
||||||
# End Target
|
|
||||||
# End Project
|
|
@ -1,29 +0,0 @@
|
|||||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
|
||||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "nsProcess"=.\nsProcess.dsp - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Global:
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<3>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
Binary file not shown.
@ -36,6 +36,7 @@
|
|||||||
#
|
#
|
||||||
# ***** END LICENSE BLOCK *****
|
# ***** END LICENSE BLOCK *****
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Helper defines and macros for toolkit applications
|
# Helper defines and macros for toolkit applications
|
||||||
|
|
||||||
@ -119,6 +120,7 @@
|
|||||||
|
|
||||||
!define SHORTCUTS_LOG "shortcuts_log.ini"
|
!define SHORTCUTS_LOG "shortcuts_log.ini"
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Macros for debugging
|
# Macros for debugging
|
||||||
|
|
||||||
@ -645,113 +647,6 @@
|
|||||||
!endif
|
!endif
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
/**
|
|
||||||
* Posts WM_QUIT to the application's message window which is found using the
|
|
||||||
* message window's class. This macro uses the nsProcess plugin available
|
|
||||||
* from http://nsis.sourceforge.net/NsProcess_plugin
|
|
||||||
*
|
|
||||||
* @param _MSG
|
|
||||||
* The message text to display in the message box.
|
|
||||||
* @param _PROMPT
|
|
||||||
* If false don't prompt the user and automatically exit the
|
|
||||||
* application if it is running.
|
|
||||||
*
|
|
||||||
* $R6 = return value for nsProcess::_FindProcess and nsProcess::_KillProcess
|
|
||||||
* $R7 = return value from FindWindow
|
|
||||||
* $R8 = _PROMPT
|
|
||||||
* $R9 = _MSG
|
|
||||||
*/
|
|
||||||
!macro CloseApp
|
|
||||||
|
|
||||||
!ifndef ${_MOZFUNC_UN}CloseApp
|
|
||||||
!verbose push
|
|
||||||
!verbose ${_MOZFUNC_VERBOSE}
|
|
||||||
!define ${_MOZFUNC_UN}CloseApp "!insertmacro ${_MOZFUNC_UN}CloseAppCall"
|
|
||||||
|
|
||||||
Function ${_MOZFUNC_UN}CloseApp
|
|
||||||
Exch $R9
|
|
||||||
Exch 1
|
|
||||||
Exch $R8
|
|
||||||
Push $R7
|
|
||||||
Push $R6
|
|
||||||
|
|
||||||
loop:
|
|
||||||
Push $R6
|
|
||||||
nsProcess::_FindProcess /NOUNLOAD "${FileMainEXE}"
|
|
||||||
Pop $R6
|
|
||||||
StrCmp $R6 0 +1 end
|
|
||||||
|
|
||||||
StrCmp $R8 "false" +2 +1
|
|
||||||
MessageBox MB_OKCANCEL|MB_ICONQUESTION "$R9" IDCANCEL exit 0
|
|
||||||
|
|
||||||
FindWindow $R7 "${WindowClass}"
|
|
||||||
IntCmp $R7 0 +4 +1 +1
|
|
||||||
System::Call 'user32::PostMessage(i R7, i ${WM_QUIT}, i 0, i 0)'
|
|
||||||
; The amount of time to wait for the app to shutdown before prompting again
|
|
||||||
Sleep 5000
|
|
||||||
|
|
||||||
Push $R6
|
|
||||||
nsProcess::_FindProcess /NOUNLOAD "${FileMainEXE}"
|
|
||||||
Pop $R6
|
|
||||||
StrCmp $R6 0 +1 end
|
|
||||||
Push $R6
|
|
||||||
nsProcess::_KillProcess /NOUNLOAD "${FileMainEXE}"
|
|
||||||
Pop $R6
|
|
||||||
Sleep 2000
|
|
||||||
|
|
||||||
Goto loop
|
|
||||||
|
|
||||||
exit:
|
|
||||||
nsProcess::_Unload
|
|
||||||
Quit
|
|
||||||
|
|
||||||
end:
|
|
||||||
nsProcess::_Unload
|
|
||||||
|
|
||||||
Pop $R6
|
|
||||||
Pop $R7
|
|
||||||
Exch $R8
|
|
||||||
Exch 1
|
|
||||||
Exch $R9
|
|
||||||
FunctionEnd
|
|
||||||
|
|
||||||
!verbose pop
|
|
||||||
!endif
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!macro CloseAppCall _MSG _PROMPT
|
|
||||||
!verbose push
|
|
||||||
!verbose ${_MOZFUNC_VERBOSE}
|
|
||||||
Push "${_MSG}"
|
|
||||||
Push "${_PROMPT}"
|
|
||||||
Call CloseApp
|
|
||||||
!verbose pop
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!macro un.CloseApp
|
|
||||||
!ifndef un.CloseApp
|
|
||||||
!verbose push
|
|
||||||
!verbose ${_MOZFUNC_VERBOSE}
|
|
||||||
!undef _MOZFUNC_UN
|
|
||||||
!define _MOZFUNC_UN "un."
|
|
||||||
|
|
||||||
!insertmacro CloseApp
|
|
||||||
|
|
||||||
!undef _MOZFUNC_UN
|
|
||||||
!define _MOZFUNC_UN
|
|
||||||
!verbose pop
|
|
||||||
!endif
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!macro un.CloseAppCall _MSG _PROMPT
|
|
||||||
!verbose push
|
|
||||||
!verbose ${_MOZFUNC_VERBOSE}
|
|
||||||
Push "${_MSG}"
|
|
||||||
Push "${_PROMPT}"
|
|
||||||
Call un.CloseApp
|
|
||||||
!verbose pop
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Macros for working with the registry
|
# Macros for working with the registry
|
||||||
@ -1515,10 +1410,10 @@
|
|||||||
!endif
|
!endif
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Macros for handling DLL registration
|
# Macros for handling DLL registration
|
||||||
|
|
||||||
|
|
||||||
!macro RegisterDLL DLL
|
!macro RegisterDLL DLL
|
||||||
|
|
||||||
; The x64 regsvr32.exe registers x86 DLL's properly on Windows Vista and above
|
; The x64 regsvr32.exe registers x86 DLL's properly on Windows Vista and above
|
||||||
@ -1552,6 +1447,7 @@
|
|||||||
!define RegisterDLL `!insertmacro RegisterDLL`
|
!define RegisterDLL `!insertmacro RegisterDLL`
|
||||||
!define UnregisterDLL `!insertmacro UnregisterDLL`
|
!define UnregisterDLL `!insertmacro UnregisterDLL`
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Macros for retrieving existing install paths
|
# Macros for retrieving existing install paths
|
||||||
|
|
||||||
@ -6024,6 +5920,7 @@
|
|||||||
!macroend
|
!macroend
|
||||||
!define DeleteShortcutsLogFile "!insertmacro DeleteShortcutsLogFile"
|
!define DeleteShortcutsLogFile "!insertmacro DeleteShortcutsLogFile"
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Macros for managing specific Windows version features
|
# Macros for managing specific Windows version features
|
||||||
|
|
||||||
|
@ -57,7 +57,6 @@ CUSTOM_NSIS_PLUGINS = \
|
|||||||
AccessControl.dll \
|
AccessControl.dll \
|
||||||
AppAssocReg.dll \
|
AppAssocReg.dll \
|
||||||
ApplicationID.dll \
|
ApplicationID.dll \
|
||||||
nsProcess.dll \
|
|
||||||
ShellLink.dll \
|
ShellLink.dll \
|
||||||
UAC.dll \
|
UAC.dll \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user