Added PortableApps.comInstaller for usage in our scripts to build the portable version of Greenshot

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2589 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2013-04-24 12:17:32 +00:00
parent 37ae1d914a
commit a07fcc50f9
98 changed files with 2202 additions and 0 deletions

View file

@ -0,0 +1,83 @@
/*
* apih
*
* This file is a part of NSIS.
*
* Copyright (C) 1999-2009 Nullsoft and Contributors
*
* Licensed under the zlib/libpng license (the "License");
* you may not use this file except in compliance with the License.
*
* Licence details can be found in the file COPYING.
*
* This software is provided 'as-is', without any express or implied
* warranty.
*/
#ifndef _NSIS_EXEHEAD_API_H_
#define _NSIS_EXEHEAD_API_H_
// Starting with NSIS 2.42, you can check the version of the plugin API in exec_flags->plugin_api_version
// The format is 0xXXXXYYYY where X is the major version and Y is the minor version (MAKELONG(y,x))
// When doing version checks, always remember to use >=, ex: if (pX->exec_flags->plugin_api_version >= NSISPIAPIVER_1_0) {}
#define NSISPIAPIVER_1_0 0x00010000
#define NSISPIAPIVER_CURR NSISPIAPIVER_1_0
// NSIS Plug-In Callback Messages
enum NSPIM
{
NSPIM_UNLOAD, // This is the last message a plugin gets, do final cleanup
NSPIM_GUIUNLOAD, // Called after .onGUIEnd
};
// Prototype for callbacks registered with extra_parameters->RegisterPluginCallback()
// Return NULL for unknown messages
// Should always be __cdecl for future expansion possibilities
typedef UINT_PTR (*NSISPLUGINCALLBACK)(enum NSPIM);
// extra_parameters data structures containing other interesting stuff
// but the stack, variables and HWND passed on to plug-ins.
typedef struct
{
int autoclose;
int all_user_var;
int exec_error;
int abort;
int exec_reboot; // NSIS_SUPPORT_REBOOT
int reboot_called; // NSIS_SUPPORT_REBOOT
int XXX_cur_insttype; // depreacted
int plugin_api_version; // see NSISPIAPIVER_CURR
// used to be XXX_insttype_changed
int silent; // NSIS_CONFIG_SILENT_SUPPORT
int instdir_error;
int rtl;
int errlvl;
int alter_reg_view;
int status_update;
} exec_flags_t;
#ifndef NSISCALL
# define NSISCALL __stdcall
#endif
typedef struct {
exec_flags_t *exec_flags;
int (NSISCALL *ExecuteCodeSegment)(int, HWND);
void (NSISCALL *validate_filename)(char *);
int (NSISCALL *RegisterPluginCallback)(HMODULE, NSISPLUGINCALLBACK); // returns 0 on success, 1 if already registered and < 0 on errors
} extra_parameters;
// Definitions for page showing plug-ins
// See Ui.c to understand better how they're used
// sent to the outer window to tell it to go to the next inner window
#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
// custom pages should send this message to let NSIS know they're ready
#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
// sent as wParam with WM_NOTIFY_OUTER_NEXT when user cancels - heed its warning
#define NOTIFY_BYE_BYE 'x'
#endif /* _PLUGIN_H_ */

View file

@ -0,0 +1,74 @@
#ifndef ___NSIS_PLUGIN__H___
#define ___NSIS_PLUGIN__H___
#ifdef __cplusplus
extern "C" {
#endif
#include "api.h"
#ifndef NSISCALL
# define NSISCALL __stdcall
#endif
#define EXDLL_INIT() { \
g_stringsize=string_size; \
g_stacktop=stacktop; \
g_variables=variables; }
typedef struct _stack_t {
struct _stack_t *next;
char text[1]; // this should be the length of string_size
} stack_t;
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
};
extern unsigned int g_stringsize;
extern stack_t **g_stacktop;
extern char *g_variables;
int NSISCALL popstring(char *str); // 0 on success, 1 on empty stack
int NSISCALL popstringn(char *str, int maxlen); // with length limit, pass 0 for g_stringsize
int NSISCALL popint(); // pops an integer
int NSISCALL popint_or(); // with support for or'ing (2|4|8)
int NSISCALL myatoi(const char *s); // converts a string to an integer
unsigned NSISCALL myatou(const char *s); // converts a string to an unsigned integer, decimal only
int NSISCALL myatoi_or(const char *s); // with support for or'ing (2|4|8)
void NSISCALL pushstring(const char *str);
void NSISCALL pushint(int value);
char * NSISCALL getuservariable(const int varnum);
void NSISCALL setuservariable(const int varnum, const char *var);
#ifdef __cplusplus
}
#endif
#endif//!___NSIS_PLUGIN__H___

View file

@ -0,0 +1,83 @@
/*
* apih
*
* This file is a part of NSIS.
*
* Copyright (C) 1999-2009 Nullsoft and Contributors
*
* Licensed under the zlib/libpng license (the "License");
* you may not use this file except in compliance with the License.
*
* Licence details can be found in the file COPYING.
*
* This software is provided 'as-is', without any express or implied
* warranty.
*/
#ifndef _NSIS_EXEHEAD_API_H_
#define _NSIS_EXEHEAD_API_H_
// Starting with NSIS 2.42, you can check the version of the plugin API in exec_flags->plugin_api_version
// The format is 0xXXXXYYYY where X is the major version and Y is the minor version (MAKELONG(y,x))
// When doing version checks, always remember to use >=, ex: if (pX->exec_flags->plugin_api_version >= NSISPIAPIVER_1_0) {}
#define NSISPIAPIVER_1_0 0x00010000
#define NSISPIAPIVER_CURR NSISPIAPIVER_1_0
// NSIS Plug-In Callback Messages
enum NSPIM
{
NSPIM_UNLOAD, // This is the last message a plugin gets, do final cleanup
NSPIM_GUIUNLOAD, // Called after .onGUIEnd
};
// Prototype for callbacks registered with extra_parameters->RegisterPluginCallback()
// Return NULL for unknown messages
// Should always be __cdecl for future expansion possibilities
typedef UINT_PTR (*NSISPLUGINCALLBACK)(enum NSPIM);
// extra_parameters data structures containing other interesting stuff
// but the stack, variables and HWND passed on to plug-ins.
typedef struct
{
int autoclose;
int all_user_var;
int exec_error;
int abort;
int exec_reboot; // NSIS_SUPPORT_REBOOT
int reboot_called; // NSIS_SUPPORT_REBOOT
int XXX_cur_insttype; // depreacted
int plugin_api_version; // see NSISPIAPIVER_CURR
// used to be XXX_insttype_changed
int silent; // NSIS_CONFIG_SILENT_SUPPORT
int instdir_error;
int rtl;
int errlvl;
int alter_reg_view;
int status_update;
} exec_flags_t;
#ifndef NSISCALL
# define NSISCALL __stdcall
#endif
typedef struct {
exec_flags_t *exec_flags;
int (NSISCALL *ExecuteCodeSegment)(int, HWND);
void (NSISCALL *validate_filename)(TCHAR *);
int (NSISCALL *RegisterPluginCallback)(HMODULE, NSISPLUGINCALLBACK); // returns 0 on success, 1 if already registered and < 0 on errors
} extra_parameters;
// Definitions for page showing plug-ins
// See Ui.c to understand better how they're used
// sent to the outer window to tell it to go to the next inner window
#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
// custom pages should send this message to let NSIS know they're ready
#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
// sent as wParam with WM_NOTIFY_OUTER_NEXT when user cancels - heed its warning
#define NOTIFY_BYE_BYE 'x'
#endif /* _PLUGIN_H_ */

View file

@ -0,0 +1,214 @@
/*
* nsis_tchar.h
*
* This file is a part of NSIS.
*
* Copyright (C) 1999-2007 Nullsoft and Contributors
*
* This software is provided 'as-is', without any express or implied
* warranty.
*
* For Unicode support by Jim Park -- 08/30/2007
*/
// Jim Park: Only those we use are listed here.
#pragma once
#ifdef _UNICODE
#ifndef _T
#define __T(x) L ## x
#define _T(x) __T(x)
#define _TEXT(x) __T(x)
#endif
typedef wchar_t TCHAR;
typedef wchar_t _TUCHAR;
// program
#define _tmain wmain
#define _tWinMain wWinMain
#define _tenviron _wenviron
#define __targv __wargv
// printfs
#define _ftprintf fwprintf
#define _sntprintf _snwprintf
#define _stprintf _swprintf
#define _tprintf wprintf
#define _vftprintf vfwprintf
#define _vsntprintf _vsnwprintf
#define _vstprintf _vswprintf
// scanfs
#define _tscanf wscanf
#define _stscanf swscanf
// string manipulations
#define _tcscat wcscat
#define _tcschr wcschr
#define _tcsclen wcslen
#define _tcscpy wcscpy
#define _tcsdup _wcsdup
#define _tcslen wcslen
#define _tcsnccpy wcsncpy
#define _tcsncpy wcsncpy
#define _tcsrchr wcsrchr
#define _tcsstr wcsstr
#define _tcstok wcstok
// string comparisons
#define _tcscmp wcscmp
#define _tcsicmp _wcsicmp
#define _tcsncicmp _wcsnicmp
#define _tcsncmp wcsncmp
#define _tcsnicmp _wcsnicmp
// upper / lower
#define _tcslwr _wcslwr
#define _tcsupr _wcsupr
#define _totlower towlower
#define _totupper towupper
// conversions to numbers
#define _tcstoi64 _wcstoi64
#define _tcstol wcstol
#define _tcstoul wcstoul
#define _tstof _wtof
#define _tstoi _wtoi
#define _tstoi64 _wtoi64
#define _ttoi _wtoi
#define _ttoi64 _wtoi64
#define _ttol _wtol
// conversion from numbers to strings
#define _itot _itow
#define _ltot _ltow
#define _i64tot _i64tow
#define _ui64tot _ui64tow
// file manipulations
#define _tfopen _wfopen
#define _topen _wopen
#define _tremove _wremove
#define _tunlink _wunlink
// reading and writing to i/o
#define _fgettc fgetwc
#define _fgetts fgetws
#define _fputts fputws
#define _gettchar getwchar
// directory
#define _tchdir _wchdir
// environment
#define _tgetenv _wgetenv
#define _tsystem _wsystem
// time
#define _tcsftime wcsftime
#else // ANSI
#ifndef _T
#define _T(x) x
#define _TEXT(x) x
#endif
typedef char TCHAR;
typedef unsigned char _TUCHAR;
// program
#define _tmain main
#define _tWinMain WinMain
#define _tenviron environ
#define __targv __argv
// printfs
#define _ftprintf fprintf
#define _sntprintf _snprintf
#define _stprintf sprintf
#define _tprintf printf
#define _vftprintf vfprintf
#define _vsntprintf _vsnprintf
#define _vstprintf vsprintf
// scanfs
#define _tscanf scanf
#define _stscanf sscanf
// string manipulations
#define _tcscat strcat
#define _tcschr strchr
#define _tcsclen strlen
#define _tcscnlen strnlen
#define _tcscpy strcpy
#define _tcsdup _strdup
#define _tcslen strlen
#define _tcsnccpy strncpy
#define _tcsrchr strrchr
#define _tcsstr strstr
#define _tcstok strtok
// string comparisons
#define _tcscmp strcmp
#define _tcsicmp _stricmp
#define _tcsncmp strncmp
#define _tcsncicmp _strnicmp
#define _tcsnicmp _strnicmp
// upper / lower
#define _tcslwr _strlwr
#define _tcsupr _strupr
#define _totupper toupper
#define _totlower tolower
// conversions to numbers
#define _tcstol strtol
#define _tcstoul strtoul
#define _tstof atof
#define _tstoi atoi
#define _tstoi64 _atoi64
#define _tstoi64 _atoi64
#define _ttoi atoi
#define _ttoi64 _atoi64
#define _ttol atol
// conversion from numbers to strings
#define _i64tot _i64toa
#define _itot _itoa
#define _ltot _ltoa
#define _ui64tot _ui64toa
// file manipulations
#define _tfopen fopen
#define _topen _open
#define _tremove remove
#define _tunlink _unlink
// reading and writing to i/o
#define _fgettc fgetc
#define _fgetts fgets
#define _fputts fputs
#define _gettchar getchar
// directory
#define _tchdir _chdir
// environment
#define _tgetenv getenv
#define _tsystem system
// time
#define _tcsftime strftime
#endif
// is functions (the same in Unicode / ANSI)
#define _istgraph isgraph
#define _istascii __isascii
#define __TFILE__ _T(__FILE__)
#define __TDATE__ _T(__DATE__)
#define __TTIME__ _T(__TIME__)

View file

@ -0,0 +1,101 @@
#ifndef ___NSIS_PLUGIN__H___
#define ___NSIS_PLUGIN__H___
#ifdef __cplusplus
extern "C" {
#endif
#include "api.h"
#include "nsis_tchar.h"
#ifndef NSISCALL
# define NSISCALL __stdcall
#endif
#define EXDLL_INIT() { \
g_stringsize=string_size; \
g_stacktop=stacktop; \
g_variables=variables; }
typedef struct _stack_t {
struct _stack_t *next;
TCHAR text[1]; // this should be the length of string_size
} stack_t;
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
};
extern unsigned int g_stringsize;
extern stack_t **g_stacktop;
extern TCHAR *g_variables;
int NSISCALL popstring(TCHAR *str); // 0 on success, 1 on empty stack
int NSISCALL popstringn(TCHAR *str, int maxlen); // with length limit, pass 0 for g_stringsize
int NSISCALL popint(); // pops an integer
int NSISCALL popint_or(); // with support for or'ing (2|4|8)
int NSISCALL myatoi(const TCHAR *s); // converts a string to an integer
unsigned NSISCALL myatou(const TCHAR *s); // converts a string to an unsigned integer, decimal only
int NSISCALL myatoi_or(const TCHAR *s); // with support for or'ing (2|4|8)
void NSISCALL pushstring(const TCHAR *str);
void NSISCALL pushint(int value);
TCHAR * NSISCALL getuservariable(const int varnum);
void NSISCALL setuservariable(const int varnum, const TCHAR *var);
#ifdef _UNICODE
#define PopStringW(x) popstring(x)
#define PushStringW(x) pushstring(x)
#define SetUserVariableW(x,y) setuservariable(x,y)
int NSISCALL PopStringA(char* ansiStr);
void NSISCALL PushStringA(const char* ansiStr);
void NSISCALL GetUserVariableW(const int varnum, wchar_t* wideStr);
void NSISCALL GetUserVariableA(const int varnum, char* ansiStr);
void NSISCALL SetUserVariableA(const int varnum, const char* ansiStr);
#else
// ANSI defs
#define PopStringA(x) popstring(x)
#define PushStringA(x) pushstring(x)
#define SetUserVariableA(x,y) setuservariable(x,y)
int NSISCALL PopStringW(wchar_t* wideStr);
void NSISCALL PushStringW(wchar_t* wideStr);
void NSISCALL GetUserVariableW(const int varnum, wchar_t* wideStr);
void NSISCALL GetUserVariableA(const int varnum, char* ansiStr);
void NSISCALL SetUserVariableW(const int varnum, const wchar_t* wideStr);
#endif
#ifdef __cplusplus
}
#endif
#endif//!___NSIS_PLUGIN__H___

View file

@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by selfdel.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

View file

@ -0,0 +1,324 @@
/***************************************************
* FILE NAME: selfdel.c
*
* PURPOSE:
* NSIS plug-in for self deleting uninstaller for
* Win9x/WinNT (all versions)
*
* CONSIDERATIONS
*
* MSVC6: works with Release built only, because source
* file must be compiled with /GZ turned OFF, but in
* Debug builds it is always on (basically, disable
* run-time stack checks)
*
* CHANGE HISTORY
*
* James Brown - Oct 01 2003
* - Original http://www.catch22.net/tuts/selfdel.asp
*
* Takhir Bedertdinov - Jan 21 2006
* - Converted to NSIS plug-in, rmdir implementation, MSVCRT
* dependencies removed
*
* Stuart Welch - Jul 17 2011
* - Fixed for x64 by specifying full path to explorer.exe
* - Ensures WOW64 file system redirection is enabled
* - Reduced deletion retry to 500ms
* - Built with VS2010
* - Added Unicode build
* - Added version information resource
* - Calls MoveFileEx with MOVEFILE_DELAY_UNTIL_REBOOT on failure
*
* Stuart Welch - Aug 10 2011
* - Added /REBOOT
*
**************************************************/
#define WINVER 0x0400
#define _WIN32_WINNT 0x0400
#include <windows.h>
#ifdef UNICODE
#include "nsis_unicode\pluginapi.h"
#else
#include "nsis_ansi\pluginapi.h"
#endif
#ifdef MoveFileEx
#undef MoveFileEx
#endif
#ifndef EWX_FORCEIFHUNG
#define EWX_FORCEIFHUNG 0x00000010
#endif
#pragma pack(push, 1)
#define CODESIZE 0x200
#define SWITCH_RMDIR TEXT("/RMDIR")
#define SWITCH_REBOOT TEXT("/REBOOT")
//
// Structure to inject into remote process. Contains
// function pointers and code to execute.
//
typedef struct _SELFDEL
{
struct _SELFDEL *Arg0; // pointer to self
BYTE opCodes[CODESIZE]; // code
HANDLE hParent; // parent process handle
FARPROC fnWaitForSingleObject;
FARPROC fnCloseHandle;
FARPROC fnDeleteFile;
FARPROC fnSleep;
FARPROC fnExitProcess;
FARPROC fnRemoveDirectory;
FARPROC fnGetLastError;
FARPROC fnExitWindowsEx;
TCHAR szFileName[MAX_PATH]; // file to delete
BOOL fRemDir;
BOOL fReboot;
} SELFDEL;
#pragma pack(pop)
#define NSISFUNC(name) void __declspec(dllexport) name(HWND hWndParent, int string_size, TCHAR* variables, stack_t** stacktop, extra_parameters* extra)
#define DLL_INIT() EXDLL_INIT();
typedef BOOLEAN (WINAPI* PWow64EnableWow64FsRedirection)(BOOLEAN Wow64FsEnableRedirection);
typedef BOOL (WINAPI* PMoveFileEx)(LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName, DWORD dwFlags);
#ifdef _DEBUG
#define FUNC_ADDR(func) (PVOID)(*(DWORD *)((BYTE *)func + 1) + (DWORD)((BYTE *)func + 5))
#else
#define FUNC_ADDR(func) func
#endif
/*****************************************************
* FUNCTION NAME: remote_thread()
* PURPOSE:
* Routine to execute in remote process
* SPECIAL CONSIDERATIONS:
* Takhir: I hope it still less then CODESIZE after
* I added rmdir
*****************************************************/
static void remote_thread(SELFDEL *remote)
{
TCHAR *p = remote->szFileName, *e;
// Wait for parent process to terminate
remote->fnWaitForSingleObject(remote->hParent, INFINITE);
remote->fnCloseHandle(remote->hParent);
// Try to delete the executable file
while(!remote->fnDeleteFile(remote->szFileName))
{
// Failed - try again in a bit
remote->fnSleep(500);
}
// Takhir: my rmdir add-on :)
// Do we have at least one back slash in full path-name
// strrchr() implementation
if(remote->fRemDir)
{
while(*++p != 0)
{
if(*p == '\\')
e = p;
}
*e = 0;
// Root install safe, rmdir on Wins doesn't delete 'c:'
remote->fnRemoveDirectory(remote->szFileName);
}
// Afrow UK: reboot add-on
if (remote->fReboot)
{
remote->fnExitWindowsEx(EWX_REBOOT|EWX_FORCEIFHUNG, 0);
}
// Finished! Exit so that we don't execute garbage code
remote->fnExitProcess(0);
}
/*****************************************************
* FUNCTION NAME: my_memcpy()
* PURPOSE:
* msvcrt replacement
* SPECIAL CONSIDERATIONS:
*
*****************************************************/
void my_memcpy(BYTE* dst, BYTE* src, int len)
{
int i;
for(i=0;i<len;i++)
dst[i] = src[i];
}
/*****************************************************
* FUNCTION NAME: Del()
* PURPOSE:
* Delete currently running executable and exit
* SPECIAL CONSIDERATIONS:
*
*****************************************************/
NSISFUNC(Del)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
CONTEXT context;
DWORD oldProt;
SELFDEL local;
DWORD entrypoint;
TCHAR* pszArg = (TCHAR*)LocalAlloc(LMEM_FIXED, sizeof(TCHAR) * string_size);
HMODULE hModule;
PWow64EnableWow64FsRedirection Wow64EnableWow64FsRedirection;
DLL_INIT();
// Switches?
local.fRemDir = FALSE;
local.fReboot = FALSE;
while (popstring(pszArg) == 0)
{
if (lstrcmpi(pszArg, SWITCH_RMDIR) == 0)
{
local.fRemDir = TRUE;
}
else if (lstrcmpi(pszArg, SWITCH_REBOOT) == 0)
{
local.fReboot = TRUE;
}
else
{
pushstring(pszArg); // who forgot this string in the stack ? :)
break;
}
}
// Need SE_SHUTDOWN_NAME to reboot.
if (local.fReboot)
{
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &hToken))
{
if (LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid))
{
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, NULL, 0);
}
CloseHandle(hToken);
}
}
si.cb = sizeof(STARTUPINFO);
si.cbReserved2 = 0;
si.lpDesktop = NULL;
si.lpReserved = NULL;
si.lpReserved2 = NULL;
si.lpTitle = NULL;
si.wShowWindow = 0;
// Ensure WOW64 file system redirection is enabled so we always
// execute the 32-bit copy of explorer.exe (as NSIS is 32-bit)
hModule = GetModuleHandle(TEXT("kernel32.dll"));
Wow64EnableWow64FsRedirection = (PWow64EnableWow64FsRedirection)GetProcAddress(hModule, "Wow64EnableWow64FsRedirection");
if (Wow64EnableWow64FsRedirection != NULL)
Wow64EnableWow64FsRedirection(TRUE);
// Get full path to explorer.exe
if (LOBYTE(LOWORD(GetVersion())) <= 5)
GetEnvironmentVariable(TEXT("WINDIR"), pszArg, string_size);
else
GetSystemDirectory(pszArg, string_size);
lstrcat(pszArg, TEXT("\\explorer.exe"));
// Create executable suspended
if(CreateProcess(0, pszArg, 0, 0, 0, CREATE_SUSPENDED|IDLE_PRIORITY_CLASS, 0, 0, &si, &pi))
{
local.fnWaitForSingleObject = (FARPROC)WaitForSingleObject;
local.fnCloseHandle = (FARPROC)CloseHandle;
local.fnDeleteFile = (FARPROC)DeleteFile;
local.fnSleep = (FARPROC)Sleep;
local.fnExitProcess = (FARPROC)ExitProcess;
local.fnRemoveDirectory = (FARPROC)RemoveDirectory;
local.fnGetLastError = (FARPROC)GetLastError;
local.fnExitWindowsEx = (FARPROC)ExitWindowsEx;
// Give remote process a copy of our own process handle
DuplicateHandle(GetCurrentProcess(), GetCurrentProcess(), pi.hProcess, &local.hParent, 0, FALSE, 0);
GetModuleFileName(NULL, local.szFileName, MAX_PATH);
// copy in binary code
my_memcpy(local.opCodes, (BYTE*)FUNC_ADDR(remote_thread), CODESIZE);
// Allocate some space on process's stack and place
// our SELFDEL structure there. Then set the instruction pointer
// to this location and let the process resume
context.ContextFlags = CONTEXT_INTEGER|CONTEXT_CONTROL;
GetThreadContext(pi.hThread, &context);
// Allocate space on stack (aligned to cache-line boundary)
entrypoint = (context.Esp - sizeof(SELFDEL)) & ~0x1F;
// Place a pointer to the structure at the bottom-of-stack
// this pointer is located in such a way that it becomes
// the remote_thread's first argument!!
local.Arg0 = (SELFDEL *)entrypoint;
context.Esp = entrypoint - 4; // create dummy return address
context.Eip = entrypoint + 4; // offset of opCodes within structure
// copy in our code+data at the exe's entry-point
VirtualProtectEx(pi.hProcess, (PVOID)entrypoint, sizeof(local), PAGE_EXECUTE_READWRITE, &oldProt);
WriteProcessMemory(pi.hProcess, (PVOID)entrypoint, &local, sizeof(local), 0);
FlushInstructionCache(pi.hProcess, (PVOID)entrypoint, sizeof(local));
SetThreadContext(pi.hThread, &context);
// Let the process continue
ResumeThread(pi.hThread);
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
}
else
{
#ifdef UNICODE
PMoveFileEx MoveFileEx = (PMoveFileEx)GetProcAddress(hModule, "MoveFileExW");
#else
PMoveFileEx MoveFileEx = (PMoveFileEx)GetProcAddress(hModule, "MoveFileExA");
#endif
if (MoveFileEx != NULL)
MoveFileEx(local.szFileName, NULL, MOVEFILE_DELAY_UNTIL_REBOOT);
}
LocalFree(pszArg);
}
/*****************************************************
* FUNCTION NAME: DllMain()
* PURPOSE:
* Dll main entry point
* SPECIAL CONSIDERATIONS:
*
*****************************************************/
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
{
return TRUE;
}

View file

@ -0,0 +1,110 @@
# Microsoft Developer Studio Project File - Name="selfdel" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=selfdel - 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 "selfdel.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 "selfdel.mak" CFG="selfdel - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "selfdel - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "selfdel - 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)" == "selfdel - 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 "../debug"
# PROP Intermediate_Dir "../debug"
# 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 "selfdel_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "selfdel_EXPORTS" /FD /c
# SUBTRACT CPP /YX
# 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:"..\..\plugins\SelfDel.dll" /opt:nowin98
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "selfdel - 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 "selfdel_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 "selfdel_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 gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /machine:I386 /out:"..\..\plugins\selfdel.dll" /pdbtype:sept
# SUBTRACT LINK32 /debug
!ENDIF
# Begin Target
# Name "selfdel - Win32 Release"
# Name "selfdel - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\selfdel.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

View file

@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "selfdel"=".\selfdel.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View file

@ -0,0 +1,23 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "selfdel", "selfdel.vcxproj", "{7A296601-9716-5C64-8D09-09D1C67BF8B1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release Unicode|Win32 = Release Unicode|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7A296601-9716-5C64-8D09-09D1C67BF8B1}.Debug|Win32.ActiveCfg = Debug|Win32
{7A296601-9716-5C64-8D09-09D1C67BF8B1}.Debug|Win32.Build.0 = Debug|Win32
{7A296601-9716-5C64-8D09-09D1C67BF8B1}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32
{7A296601-9716-5C64-8D09-09D1C67BF8B1}.Release Unicode|Win32.Build.0 = Release Unicode|Win32
{7A296601-9716-5C64-8D09-09D1C67BF8B1}.Release|Win32.ActiveCfg = Release|Win32
{7A296601-9716-5C64-8D09-09D1C67BF8B1}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,184 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Unicode|Win32">
<Configuration>Release Unicode</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<SccProjectName />
<SccLocalPath />
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)..\..\Plugins\</OutDir>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)..\..\Unicode\Plugins\</OutDir>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<FunctionLevelLinking>false</FunctionLevelLinking>
<Optimization>Disabled</Optimization>
<SuppressStartupBanner>true</SuppressStartupBanner>
<WarningLevel>Level3</WarningLevel>
<MinimalRebuild>true</MinimalRebuild>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;selfdel_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
</ClCompile>
<Midl>
<SuppressStartupBanner>true</SuppressStartupBanner>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TypeLibraryName>.\../Debug\selfdel.tlb</TypeLibraryName>
<MkTypLibCompatible>true</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
</Midl>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\../Debug\selfdel.bsc</OutputFile>
</Bscmake>
<Link>
<SuppressStartupBanner>true</SuppressStartupBanner>
<LinkDLL>true</LinkDLL>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>nsis_ansi\pluginapi.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>true</FunctionLevelLinking>
<Optimization>MinSpace</Optimization>
<SuppressStartupBanner>true</SuppressStartupBanner>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;selfdel_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Midl>
<SuppressStartupBanner>true</SuppressStartupBanner>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TypeLibraryName>.\../debug\selfdel.tlb</TypeLibraryName>
<MkTypLibCompatible>true</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
</Midl>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\../debug\selfdel.bsc</OutputFile>
</Bscmake>
<Link>
<SuppressStartupBanner>true</SuppressStartupBanner>
<LinkDLL>true</LinkDLL>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<AdditionalDependencies>nsis_ansi\pluginapi.lib;kernel32.lib;user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<EntryPointSymbol>DllMain</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">
<ClCompile>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>true</FunctionLevelLinking>
<Optimization>MinSpace</Optimization>
<SuppressStartupBanner>true</SuppressStartupBanner>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;selfdel_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Midl>
<SuppressStartupBanner>true</SuppressStartupBanner>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TypeLibraryName>.\../debug\selfdel.tlb</TypeLibraryName>
<MkTypLibCompatible>true</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
</Midl>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\../debug\selfdel.bsc</OutputFile>
</Bscmake>
<Link>
<SuppressStartupBanner>true</SuppressStartupBanner>
<LinkDLL>true</LinkDLL>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<AdditionalDependencies>nsis_unicode\pluginapi.lib;kernel32.lib;user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<EntryPointSymbol>DllMain</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="selfdel.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="selfdel.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="selfdel.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="selfdel.rc" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,77 @@
/*****************************************************************
* NewTextReplace NSIS plugin v0.4 *
* by Gringoloco023, 2010 *
* http://portableapps.com/node/21840 *
* Based on: *
* TextReplace NSIS plugin v1.5 *
* *
* 2006 Shengalts Aleksander aka Instructor (Shengalts@mail.ru) *
*****************************************************************/
!define ReplaceInFileUTF16LECS '!insertmacro "ReplaceInFileUTF16LECS"' ;${ReplaceInFileUTF16LECS} SOURCE_FILE SEARCH_TEXT REPLACEMENT
!define ReplaceInFileUTF16LE '!insertmacro "ReplaceInFileUTF16LE"' ;${ReplaceInFileUTF16LE} SOURCE_FILE SEARCH_TEXT REPLACEMENT
!define textreplace::FindInFile `!insertmacro textreplace::FindInFile`
!macro textreplace::FindInFile _INPUTFILE _FINDIT _OPTIONS _COUNT
newtextreplace::_FindInFile /NOUNLOAD `${_INPUTFILE}` `${_FINDIT}` `${_OPTIONS}`
Pop ${_COUNT}
!macroend
!define textreplace::ReplaceInFile `!insertmacro textreplace::ReplaceInFile`
!macro textreplace::ReplaceInFile _INPUTFILE _OUTPUTFILE _REPLACEIT _REPLACEWITH _OPTIONS _COUNT
newtextreplace::_ReplaceInFile /NOUNLOAD `${_INPUTFILE}` `${_OUTPUTFILE}` `${_REPLACEIT}` `${_REPLACEWITH}` `${_OPTIONS}`
Pop ${_COUNT}
!macroend
!define textreplace::FillReadBuffer `!insertmacro textreplace::FillReadBuffer`
!macro textreplace::FillReadBuffer _FILE _POINTER
newtextreplace::_FillReadBuffer /NOUNLOAD `${_FILE}`
Pop ${_POINTER}
!macroend
!define textreplace::FreeReadBuffer `!insertmacro textreplace::FreeReadBuffer`
!macro textreplace::FreeReadBuffer _POINTER
newtextreplace::_FreeReadBuffer /NOUNLOAD `${_POINTER}`
!macroend
!define textreplace::Unload `!insertmacro textreplace::Unload`
!macro textreplace::Unload
newtextreplace::_Unload
!macroend
/*****************************************************************
*** The following is meant to ***
*** be used in combination with ***
*** ReplaceInFileWithTextReplace.nsh ***
*****************************************************************/
!macro ReplaceInFileUTF16LECS SOURCE_FILE SEARCH_TEXT REPLACEMENT
Push `/U=1 /S=1`
Push `${SOURCE_FILE}`
Push `${SEARCH_TEXT}`
Push `${REPLACEMENT}`
Call ReplaceInFile
!macroend
!macro ReplaceInFileUTF16LE SOURCE_FILE SEARCH_TEXT REPLACEMENT
Push `/U=1 /S=0`
Push `${SOURCE_FILE}`
Push `${SEARCH_TEXT}`
Push `${REPLACEMENT}`
Call ReplaceInFile
!macroend

View file

@ -0,0 +1,195 @@
!define registry::Open `!insertmacro registry::Open`
!macro registry::Open _PATH _OPTIONS _HANDLE
registry::_Open /NOUNLOAD `${_PATH}` `${_OPTIONS}`
Pop ${_HANDLE}
!macroend
!define registry::Find `!insertmacro registry::Find`
!macro registry::Find _HANDLE _PATH _VALUEORKEY _STRING _TYPE
registry::_Find /NOUNLOAD `${_HANDLE}`
Pop ${_PATH}
Pop ${_VALUEORKEY}
Pop ${_STRING}
Pop ${_TYPE}
!macroend
!define registry::Close `!insertmacro registry::Close`
!macro registry::Close _HANDLE
registry::_Close /NOUNLOAD `${_HANDLE}`
!macroend
!define registry::KeyExists `!insertmacro registry::KeyExists`
!macro registry::KeyExists _PATH _ERR
registry::_KeyExists /NOUNLOAD `${_PATH}`
Pop ${_ERR}
!macroend
!define registry::Read `!insertmacro registry::Read`
!macro registry::Read _PATH _VALUE _STRING _TYPE
registry::_Read /NOUNLOAD `${_PATH}` `${_VALUE}`
Pop ${_STRING}
Pop ${_TYPE}
!macroend
!define registry::Write `!insertmacro registry::Write`
!macro registry::Write _PATH _VALUE _STRING _TYPE _ERR
registry::_Write /NOUNLOAD `${_PATH}` `${_VALUE}` `${_STRING}` `${_TYPE}`
Pop ${_ERR}
!macroend
!define registry::ReadExtra `!insertmacro registry::ReadExtra`
!macro registry::ReadExtra _PATH _VALUE _NUMBER _STRING _TYPE
registry::_ReadExtra /NOUNLOAD `${_PATH}` `${_VALUE}` `${_NUMBER}`
Pop ${_STRING}
Pop ${_TYPE}
!macroend
!define registry::WriteExtra `!insertmacro registry::WriteExtra`
!macro registry::WriteExtra _PATH _VALUE _STRING _ERR
registry::_WriteExtra /NOUNLOAD `${_PATH}` `${_VALUE}` `${_STRING}`
Pop ${_ERR}
!macroend
!define registry::CreateKey `!insertmacro registry::CreateKey`
!macro registry::CreateKey _PATH _ERR
registry::_CreateKey /NOUNLOAD `${_PATH}`
Pop ${_ERR}
!macroend
!define registry::DeleteValue `!insertmacro registry::DeleteValue`
!macro registry::DeleteValue _PATH _VALUE _ERR
registry::_DeleteValue /NOUNLOAD `${_PATH}` `${_VALUE}`
Pop ${_ERR}
!macroend
!define registry::DeleteKey `!insertmacro registry::DeleteKey`
!macro registry::DeleteKey _PATH _ERR
registry::_DeleteKey /NOUNLOAD `${_PATH}`
Pop ${_ERR}
!macroend
!define registry::DeleteKeyEmpty `!insertmacro registry::DeleteKeyEmpty`
!macro registry::DeleteKeyEmpty _PATH _ERR
registry::_DeleteKeyEmpty /NOUNLOAD `${_PATH}`
Pop ${_ERR}
!macroend
!define registry::CopyValue `!insertmacro registry::CopyValue`
!macro registry::CopyValue _PATH_SOURCE _VALUE_SOURCE _PATH_TARGET _VALUE_TARGET _ERR
registry::_CopyValue /NOUNLOAD `${_PATH_SOURCE}` `${_VALUE_SOURCE}` `${_PATH_TARGET}` `${_VALUE_TARGET}`
Pop ${_ERR}
!macroend
!define registry::MoveValue `!insertmacro registry::MoveValue`
!macro registry::MoveValue _PATH_SOURCE _VALUE_SOURCE _PATH_TARGET _VALUE_TARGET _ERR
registry::_MoveValue /NOUNLOAD `${_PATH_SOURCE}` `${_VALUE_SOURCE}` `${_PATH_TARGET}` `${_VALUE_TARGET}`
Pop ${_ERR}
!macroend
!define registry::CopyKey `!insertmacro registry::CopyKey`
!macro registry::CopyKey _PATH_SOURCE _PATH_TARGET _ERR
registry::_CopyKey /NOUNLOAD `${_PATH_SOURCE}` `${_PATH_TARGET}`
Pop ${_ERR}
!macroend
!define registry::MoveKey `!insertmacro registry::MoveKey`
!macro registry::MoveKey _PATH_SOURCE _PATH_TARGET _ERR
registry::_MoveKey /NOUNLOAD `${_PATH_SOURCE}` `${_PATH_TARGET}`
Pop ${_ERR}
!macroend
!define registry::SaveKey `!insertmacro registry::SaveKey`
!macro registry::SaveKey _PATH _FILE _OPTIONS _ERR
registry::_SaveKey /NOUNLOAD `${_PATH}` `${_FILE}` `${_OPTIONS}`
Pop ${_ERR}
!macroend
!define registry::RestoreKey `!insertmacro registry::RestoreKey`
!macro registry::RestoreKey _FILE _ERR
registry::_RestoreKey /NOUNLOAD `${_FILE}`
Pop ${_ERR}
IntCmp ${_ERR} -2 0 0 +10 ;REGEDIT4 ansi file
SetDetailsPrint none
IfFileExists "$SYSDIR\reg.exe" 0 +4 ;reg.exe used in Windows2K/XP/Vista/7
nsExec::ExecToStack `"$SYSDIR\reg.exe" import "${_FILE}"`
Pop ${_ERR}
StrCmp ${_ERR} 0 +5 0
IfFileExists "$WINDIR\regedit.exe" 0 +3 ;regedit.exe used in Wine
ExecWait `"$WINDIR\regedit.exe" /s "${_FILE}"` ${_ERR}
IfErrors 0 +2
StrCpy ${_ERR} -1
SetDetailsPrint lastused
!macroend
!define registry::StrToHex `!insertmacro registry::StrToHex`
!macro registry::StrToHex _STRING _HEX_STRING
registry::_StrToHex /NOUNLOAD `${_STRING}`
Pop ${_HEX_STRING}
!macroend
!define registry::HexToStr `!insertmacro registry::HexToStr`
!macro registry::HexToStr _HEX_STRING _STRING
registry::_HexToStr /NOUNLOAD `${_HEX_STRING}`
Pop ${_STRING}
!macroend
!define registry::StrToHexUTF16LE `!insertmacro registry::StrToHexUTF16LE`
!macro registry::StrToHexUTF16LE _STRING _HEX_STRING
registry::_StrToHexUTF16LE /NOUNLOAD `${_STRING}`
Pop ${_HEX_STRING}
!macroend
!define registry::HexToStrUTF16LE `!insertmacro registry::HexToStrUTF16LE`
!macro registry::HexToStrUTF16LE _HEX_STRING _STRING
registry::_HexToStrUTF16LE /NOUNLOAD `${_HEX_STRING}`
Pop ${_STRING}
!macroend
!define registry::Unload `!insertmacro registry::Unload`
!macro registry::Unload
registry::_Unload
!macroend

View file

@ -0,0 +1,77 @@
/*****************************************************************
* NewTextReplace NSIS plugin v0.4 *
* by Gringoloco023, 2010 *
* http://portableapps.com/node/21840 *
* Based on: *
* TextReplace NSIS plugin v1.5 *
* *
* 2006 Shengalts Aleksander aka Instructor (Shengalts@mail.ru) *
*****************************************************************/
;This file named TextReplace.nsh, for compatibility of old scripts !
!define ReplaceInFileUTF16LECS '!insertmacro "ReplaceInFileUTF16LECS"' ;${ReplaceInFileUTF16LECS} SOURCE_FILE SEARCH_TEXT REPLACEMENT
!define ReplaceInFileUTF16LE '!insertmacro "ReplaceInFileUTF16LE"' ;${ReplaceInFileUTF16LE} SOURCE_FILE SEARCH_TEXT REPLACEMENT
!define textreplace::FindInFile `!insertmacro textreplace::FindInFile`
!macro textreplace::FindInFile _INPUTFILE _FINDIT _OPTIONS _COUNT
newtextreplace::_FindInFile /NOUNLOAD `${_INPUTFILE}` `${_FINDIT}` `${_OPTIONS}`
Pop ${_COUNT}
!macroend
!define textreplace::ReplaceInFile `!insertmacro textreplace::ReplaceInFile`
!macro textreplace::ReplaceInFile _INPUTFILE _OUTPUTFILE _REPLACEIT _REPLACEWITH _OPTIONS _COUNT
newtextreplace::_ReplaceInFile /NOUNLOAD `${_INPUTFILE}` `${_OUTPUTFILE}` `${_REPLACEIT}` `${_REPLACEWITH}` `${_OPTIONS}`
Pop ${_COUNT}
!macroend
!define textreplace::FillReadBuffer `!insertmacro textreplace::FillReadBuffer`
!macro textreplace::FillReadBuffer _FILE _POINTER
newtextreplace::_FillReadBuffer /NOUNLOAD `${_FILE}`
Pop ${_POINTER}
!macroend
!define textreplace::FreeReadBuffer `!insertmacro textreplace::FreeReadBuffer`
!macro textreplace::FreeReadBuffer _POINTER
newtextreplace::_FreeReadBuffer /NOUNLOAD `${_POINTER}`
!macroend
!define textreplace::Unload `!insertmacro textreplace::Unload`
!macro textreplace::Unload
newtextreplace::_Unload
!macroend
/*****************************************************************
*** The following is meant to ***
*** be used in combination with ***
*** ReplaceInFileWithTextReplace.nsh ***
*****************************************************************/
!macro ReplaceInFileUTF16LECS SOURCE_FILE SEARCH_TEXT REPLACEMENT
Push `/U=1 /S=1`
Push `${SOURCE_FILE}`
Push `${SEARCH_TEXT}`
Push `${REPLACEMENT}`
Call ReplaceInFile
!macroend
!macro ReplaceInFileUTF16LE SOURCE_FILE SEARCH_TEXT REPLACEMENT
Push `/U=1 /S=0`
Push `${SOURCE_FILE}`
Push `${SEARCH_TEXT}`
Push `${REPLACEMENT}`
Call ReplaceInFile
!macroend

View file

@ -0,0 +1,74 @@
!ifndef __WIN_WINDEF__INC
!define __WIN_WINDEF__INC
!verbose push
!verbose 3
!ifndef __WIN_NOINC_WINDEF
!ifndef MAX_PATH
!define MAX_PATH 260
!endif
#define NULL 0
!macro _Win_MINMAX _intcmp _j1 _j2 _outvar _a _b
${_intcmp} "${_a}" "${_b}" ${_j1} ${_j1} ${_j2}
StrCpy ${_outvar} "${_a}"
goto +2
StrCpy ${_outvar} "${_b}"
!macroend
!ifndef __WIN_MS_NOMINMAX & min & max & min_u & max_u
!define min "!insertmacro _Win_MINMAX IntCmp +1 +3 "
!define max "!insertmacro _Win_MINMAX IntCmp +3 +1 "
!define min_u "!insertmacro _Win_MINMAX IntCmpU +1 +3 "
!define max_u "!insertmacro _Win_MINMAX IntCmpU +3 +1 "
!endif
!macro _Win_LOBYTE _outvar _in
IntOp ${_outvar} "${_in}" & 0xFF
!macroend
!define LOBYTE "!insertmacro _Win_LOBYTE "
!macro _Win_HIBYTE _outvar _in
IntOp ${_outvar} "${_in}" >> 8
${LOBYTE} ${_outvar} ${_outvar}
!macroend
!define HIBYTE "!insertmacro _Win_HIBYTE "
!macro _Win_LOWORD _outvar _in
IntOp ${_outvar} "${_in}" & 0xFFFF
!macroend
!define LOWORD "!insertmacro _Win_LOWORD "
!macro _Win_HIWORD _outvar _in
IntOp ${outvar} "${_in}" >> 16 ;sign extended :(
${LOWORD} ${_outvar} ${outvar} ;make sure we strip off the upper word
!macroend
!define HIWORD "!insertmacro _Win_HIWORD "
!macro _Win_MAKEWORD _outvar _tmpvar _lo _hi
${LOBYTE} ${_outvar} "${_hi}"
${LOBYTE} ${_tmpvar} "${_lo}"
IntOp ${_outvar} ${_outvar} << 8
IntOp ${_outvar} ${_outvar} | ${_tmpvar}
!macroend
!define MAKEWORD "!insertmacro _Win_MAKEWORD "
!macro _Win_MAKELONG32 _outvar _tmpvar _wlo _whi
${LOWORD} ${_outvar} "${_wlo}"
IntOp ${_tmpvar} "${_whi}" << 16
IntOp ${_outvar} ${_outvar} | ${_tmpvar}
!macroend
!define MAKELONG "!insertmacro _Win_MAKELONG32 "
!if "${__WIN_PTRSIZE}" <= 4
!define MAKEWPARAM "${MAKELONG}"
!define MAKELPARAM "${MAKELONG}"
!define MAKELRESULT "${MAKELONG}"
!else
!error "Missing 64bit imp!"
!endif
!endif /* __WIN_NOINC_WINDEF */
!verbose pop
!endif /* __WIN_WINDEF__INC */

View file

@ -0,0 +1,64 @@
!ifndef __WIN_WINERROR__INC
!define __WIN_WINERROR__INC
!verbose push
!verbose 3
!ifndef __WIN_NOINC_WINERROR
#define NO_ERROR 0
!define ERROR_SUCCESS 0
!define ERROR_INVALID_FUNCTION 1
!define ERROR_FILE_NOT_FOUND 2
!define ERROR_PATH_NOT_FOUND 3
!define ERROR_TOO_MANY_OPEN_FILES 4
!define ERROR_ACCESS_DENIED 5
!define ERROR_INVALID_HANDLE 6
!define ERROR_ARENA_TRASHED 7
!define ERROR_NOT_ENOUGH_MEMORY 8
!define ERROR_INVALID_BLOCK 9
!define ERROR_BAD_ENVIRONMENT 10
!define ERROR_BAD_FORMAT 11
!define ERROR_INVALID_ACCESS 12
!define ERROR_INVALID_DATA 13
!define ERROR_OUTOFMEMORY 14
!define ERROR_INVALID_DRIVE 15
!define ERROR_CURRENT_DIRECTORY 16
!define ERROR_NOT_SAME_DEVICE 17
!define ERROR_NO_MORE_FILES 18
!define ERROR_WRITE_PROTECT 19
!define ERROR_BAD_UNIT 20
!define ERROR_NOT_READY 21
!define ERROR_BAD_COMMAND 22
!define ERROR_CRC 23
!define ERROR_BAD_LENGTH 24
!define ERROR_SEEK 25
!define ERROR_NOT_DOS_DISK 26
!define ERROR_SECTOR_NOT_FOUND 27
!define ERROR_OUT_OF_PAPER 28
!define ERROR_WRITE_FAULT 29
!define ERROR_READ_FAULT 30
!define ERROR_GEN_FAILURE 31
!define ERROR_SHARING_VIOLATION 32
!define ERROR_LOCK_VIOLATION 33
!define ERROR_WRONG_DISK 34
!define ERROR_SHARING_BUFFER_EXCEEDED 36
!define ERROR_HANDLE_EOF 38
!define ERROR_HANDLE_DISK_FULL 39
!define ERROR_NOT_SUPPORTED 50
!define SEVERITY_SUCCESS 0
!define SEVERITY_ERROR 1
!define E_UNEXPECTED 0x8000FFFF
!define E_NOTIMPL 0x80004001
!define E_OUTOFMEMORY 0x8007000E
!define E_INVALIDARG 0x80070057
!define E_NOINTERFACE 0x80004002
!define E_POINTER 0x80004003
!define E_HANDLE 0x80070006
!define E_ABORT 0x80004004
!define E_FAIL 0x80004005
!define E_ACCESSDENIED 0x80070005
!define E_PENDING 0x8000000A
!endif /* __WIN_NOINC_WINERROR */
!verbose pop
!endif /* __WIN_WINERROR__INC */

View file

@ -0,0 +1,209 @@
!ifndef __WIN_WINNT__INC
!define __WIN_WINNT__INC
!verbose push
!verbose 3
!ifndef __WIN_NOINC_WINNT
#define MINCHAR 0x80
#define MAXCHAR 0x7f
!define MINSHORT 0x8000
!define MAXSHORT 0x7fff
!define MINLONG 0x80000000
!define MAXLONG 0x7fffffff
!define MAXBYTE 0xff
!define MAXWORD 0xffff
!define MAXDWORD 0xffffffff
!ifndef WIN32_NO_STATUS
!define STATUS_WAIT_0 0x00000000
!define STATUS_ABANDONED_WAIT_0 0x00000080
!define STATUS_USER_APC 0x000000C0
!define STATUS_TIMEOUT 0x00000102
!define STATUS_PENDING 0x00000103
!define DBG_EXCEPTION_HANDLED 0x00010001
!define DBG_CONTINUE 0x00010002
!define STATUS_SEGMENT_NOTIFICATION 0x40000005
!define DBG_TERMINATE_THREAD 0x40010003
!define DBG_TERMINATE_PROCESS 0x40010004
!define DBG_CONTROL_C 0x40010005
!define DBG_CONTROL_BREAK 0x40010008
!define DBG_COMMAND_EXCEPTION 0x40010009
!define STATUS_GUARD_PAGE_VIOLATION 0x80000001
!define STATUS_DATATYPE_MISALIGNMENT 0x80000002
!define STATUS_BREAKPOINT 0x80000003
!define STATUS_SINGLE_STEP 0x80000004
!define DBG_EXCEPTION_NOT_HANDLED 0x80010001
!define STATUS_ACCESS_VIOLATION 0xC0000005
!define STATUS_IN_PAGE_ERROR 0xC0000006
!define STATUS_INVALID_HANDLE 0xC0000008
!define STATUS_NO_MEMORY 0xC0000017
!define STATUS_ILLEGAL_INSTRUCTION 0xC000001D
!define STATUS_NONCONTINUABLE_EXCEPTION 0xC0000025
!define STATUS_INVALID_DISPOSITION 0xC0000026
!define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C
!define STATUS_FLOAT_DENORMAL_OPERAND 0xC000008D
!define STATUS_FLOAT_DIVIDE_BY_ZERO 0xC000008E
!define STATUS_FLOAT_INEXACT_RESULT 0xC000008F
!define STATUS_FLOAT_INVALID_OPERATION 0xC0000090
!define STATUS_FLOAT_OVERFLOW 0xC0000091
!define STATUS_FLOAT_STACK_CHECK 0xC0000092
!define STATUS_FLOAT_UNDERFLOW 0xC0000093
!define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094
!define STATUS_INTEGER_OVERFLOW 0xC0000095
!define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096
!define STATUS_STACK_OVERFLOW 0xC00000FD
!define STATUS_CONTROL_C_EXIT 0xC000013A
!define STATUS_FLOAT_MULTIPLE_FAULTS 0xC00002B4
!define STATUS_FLOAT_MULTIPLE_TRAPS 0xC00002B5
!define STATUS_REG_NAT_CONSUMPTION 0xC00002C9
!define STATUS_SXS_EARLY_DEACTIVATION 0xC015000F
!define STATUS_SXS_INVALID_DEACTIVATION 0xC0150010
!endif /*WIN32_NO_STATUS*/
#define MAXIMUM_WAIT_OBJECTS 64
!define DELETE 0x00010000
!define READ_CONTROL 0x00020000
!define WRITE_DAC 0x00040000
!define WRITE_OWNER 0x00080000
!define SYNCHRONIZE 0x00100000
!define STANDARD_RIGHTS_REQUIRED 0x000F0000
!define STANDARD_RIGHTS_READ ${READ_CONTROL}
!define STANDARD_RIGHTS_WRITE ${READ_CONTROL}
!define STANDARD_RIGHTS_EXECUTE ${READ_CONTROL}
!define STANDARD_RIGHTS_ALL 0x001F0000
!define SPECIFIC_RIGHTS_ALL 0x0000FFFF
!define ACCESS_SYSTEM_SECURITY 0x01000000
!define MAXIMUM_ALLOWED 0x02000000
!define GENERIC_READ 0x80000000
!define GENERIC_WRITE 0x40000000
!define GENERIC_EXECUTE 0x20000000
!define GENERIC_ALL 0x10000000
!define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001
!define SE_PRIVILEGE_ENABLED 0x00000002
!define SE_PRIVILEGE_REMOVED 0x00000004
!define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
!define SE_CREATE_TOKEN_NAME "SeCreateTokenPrivilege"
!define SE_ASSIGNPRIMARYTOKEN_NAME "SeAssignPrimaryTokenPrivilege"
!define SE_LOCK_MEMORY_NAME "SeLockMemoryPrivilege"
!define SE_INCREASE_QUOTA_NAME "SeIncreaseQuotaPrivilege"
!define SE_UNSOLICITED_INPUT_NAME "SeUnsolicitedInputPrivilege"
!define SE_MACHINE_ACCOUNT_NAME "SeMachineAccountPrivilege"
!define SE_TCB_NAME "SeTcbPrivilege"
!define SE_SECURITY_NAME "SeSecurityPrivilege"
!define SE_TAKE_OWNERSHIP_NAME "SeTakeOwnershipPrivilege"
!define SE_LOAD_DRIVER_NAME "SeLoadDriverPrivilege"
!define SE_SYSTEM_PROFILE_NAME "SeSystemProfilePrivilege"
!define SE_SYSTEMTIME_NAME "SeSystemtimePrivilege"
!define SE_PROF_SINGLE_PROCESS_NAME "SeProfileSingleProcessPrivilege"
!define SE_INC_BASE_PRIORITY_NAME "SeIncreaseBasePriorityPrivilege"
!define SE_CREATE_PAGEFILE_NAME "SeCreatePagefilePrivilege"
!define SE_CREATE_PERMANENT_NAME "SeCreatePermanentPrivilege"
!define SE_BACKUP_NAME "SeBackupPrivilege"
!define SE_RESTORE_NAME "SeRestorePrivilege"
!define SE_SHUTDOWN_NAME "SeShutdownPrivilege"
!define SE_DEBUG_NAME "SeDebugPrivilege"
!define SE_AUDIT_NAME "SeAuditPrivilege"
!define SE_SYSTEM_ENVIRONMENT_NAME "SeSystemEnvironmentPrivilege"
!define SE_CHANGE_NOTIFY_NAME "SeChangeNotifyPrivilege"
!define SE_REMOTE_SHUTDOWN_NAME "SeRemoteShutdownPrivilege"
!define SE_UNDOCK_NAME "SeUndockPrivilege"
!define SE_SYNC_AGENT_NAME "SeSyncAgentPrivilege"
!define SE_ENABLE_DELEGATION_NAME "SeEnableDelegationPrivilege"
!define SE_MANAGE_VOLUME_NAME "SeManageVolumePrivilege"
!define SE_IMPERSONATE_NAME "SeImpersonatePrivilege"
!define SE_CREATE_GLOBAL_NAME "SeCreateGlobalPrivilege"
!define TOKEN_ASSIGN_PRIMARY 0x0001
!define TOKEN_DUPLICATE 0x0002
!define TOKEN_IMPERSONATE 0x0004
!define TOKEN_QUERY 0x0008
!define TOKEN_QUERY_SOURCE 0x0010
!define TOKEN_ADJUST_PRIVILEGES 0x0020
!define TOKEN_ADJUST_GROUPS 0x0040
!define TOKEN_ADJUST_DEFAULT 0x0080
!define TOKEN_ADJUST_SESSIONID 0x0100
!define TOKEN_ALL_ACCESS_P 0xF00FF
!define /math TOKEN_ALL_ACCESS ${TOKEN_ALL_ACCESS_P} | ${TOKEN_ADJUST_SESSIONID}
!define /math TOKEN_READ ${STANDARD_RIGHTS_READ} | ${TOKEN_QUERY}
!define TOKEN_WRITE 0x200E0 ;(STANDARD_RIGHTS_WRITE|TOKEN_ADJUST_PRIVILEGES|TOKEN_ADJUST_GROUPS|TOKEN_ADJUST_DEFAULT)
!define TOKEN_EXECUTE ${STANDARD_RIGHTS_EXECUTE}
!define PROCESS_TERMINATE 0x0001
!define PROCESS_CREATE_THREAD 0x0002
!define PROCESS_SET_SESSIONID 0x0004
!define PROCESS_VM_OPERATION 0x0008
!define PROCESS_VM_READ 0x0010
!define PROCESS_VM_WRITE 0x0020
!define PROCESS_DUP_HANDLE 0x0040
!define PROCESS_CREATE_PROCESS 0x0080
!define PROCESS_SET_QUOTA 0x0100
!define PROCESS_SET_INFORMATION 0x0200
!define PROCESS_QUERY_INFORMATION 0x0400
!define PROCESS_SUSPEND_RESUME 0x0800
!define PROCESS_ALL_ACCESS 0x1F0FFF ;(STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFF)
!define THREAD_TERMINATE 0x0001
!define THREAD_SUSPEND_RESUME 0x0002
!define THREAD_GET_CONTEXT 0x0008
!define THREAD_SET_CONTEXT 0x0010
!define THREAD_SET_INFORMATION 0x0020
!define THREAD_QUERY_INFORMATION 0x0040
!define THREAD_SET_THREAD_TOKEN 0x0080
!define THREAD_IMPERSONATE 0x0100
!define THREAD_DIRECT_IMPERSONATION 0x0200
!define THREAD_ALL_ACCESS 0x1F03FF ;(STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3FF)
!define JOB_OBJECT_ASSIGN_PROCESS 0x0001
!define JOB_OBJECT_SET_ATTRIBUTES 0x0002
!define JOB_OBJECT_QUERY 0x0004
!define JOB_OBJECT_TERMINATE 0x0008
!define JOB_OBJECT_SET_SECURITY_ATTRIBUTES 0x0010
!define JOB_OBJECT_ALL_ACCESS 0x1F001F ;(STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1F )
!define EVENT_MODIFY_STATE 0x0002
!define EVENT_ALL_ACCESS 0x1F0003 ;(STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
!define MUTANT_QUERY_STATE 0x0001
!define MUTANT_ALL_ACCESS 0x1F0001 ;(STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|MUTANT_QUERY_STATE)
!define FILE_SHARE_READ 0x00000001
!define FILE_SHARE_WRITE 0x00000002
!define FILE_SHARE_DELETE 0x00000004
!define FILE_ATTRIBUTE_READONLY 0x00000001
!define FILE_ATTRIBUTE_HIDDEN 0x00000002
!define FILE_ATTRIBUTE_SYSTEM 0x00000004
!define FILE_ATTRIBUTE_DIRECTORY 0x00000010
!define FILE_ATTRIBUTE_ARCHIVE 0x00000020
!define FILE_ATTRIBUTE_DEVICE 0x00000040
!define FILE_ATTRIBUTE_NORMAL 0x00000080
!define FILE_ATTRIBUTE_TEMPORARY 0x00000100
!define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
!define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
!define FILE_ATTRIBUTE_COMPRESSED 0x00000800
!define FILE_ATTRIBUTE_OFFLINE 0x00001000
!define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
!define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
!define DUPLICATE_CLOSE_SOURCE 0x00000001
!define DUPLICATE_SAME_ACCESS 0x00000002
!define VER_PLATFORM_WIN32s 0
!define VER_PLATFORM_WIN32_WINDOWS 1
!define VER_PLATFORM_WIN32_NT 2
!ifndef REG_SZ & NSIS_WINDOWS__NO_REGTYPES
!define REG_NONE 0
!define REG_SZ 1
!define REG_EXPAND_SZ 2
!define REG_BINARY 3
!define REG_DWORD 4
!define REG_DWORD_LITTLE_ENDIAN 4
!define REG_DWORD_BIG_ENDIAN 5
!define REG_LINK 6
!define REG_MULTI_SZ 7
!endif
!endif /* __WIN_NOINC_WINNT */
!verbose pop
!endif /* __WIN_WINNT__INC */

View file

@ -0,0 +1,199 @@
!ifndef __WIN_WINUSER__INC
!define __WIN_WINUSER__INC
!verbose push
!verbose 3
!ifndef __WIN_MS_NOUSER & __WIN_NOINC_WINUSER
!ifndef __WIN_MS_NOVIRTUALKEYCODES
!define VK_LBUTTON 0x01
!define VK_RBUTTON 0x02
!define VK_CANCEL 0x03
!define VK_MBUTTON 0x04 /* NOT contiguous with L & RBUTTON */
!define VK_XBUTTON1 0x05 /* NOT contiguous with L & RBUTTON */
!define VK_XBUTTON2 0x06 /* NOT contiguous with L & RBUTTON */
!define VK_BACK 0x08
!define VK_TAB 0x09
!define VK_CLEAR 0x0C
!define VK_RETURN 0x0D
!define VK_SHIFT 0x10
!define VK_CONTROL 0x11
!define VK_MENU 0x12
!define VK_PAUSE 0x13
!define VK_CAPITAL 0x14
!define VK_ESCAPE 0x1B
!define VK_CONVERT 0x1C
!define VK_NONCONVERT 0x1D
!define VK_ACCEPT 0x1E
!define VK_MODECHANGE 0x1F
!define VK_SPACE 0x20
!define VK_PRIOR 0x21
!define VK_NEXT 0x22
!define VK_END 0x23
!define VK_HOME 0x24
!define VK_LEFT 0x25
!define VK_UP 0x26
!define VK_RIGHT 0x27
!define VK_DOWN 0x28
!define VK_SELECT 0x29
!define VK_PRINT 0x2A
!define VK_EXECUTE 0x2B
!define VK_SNAPSHOT 0x2C
!define VK_INSERT 0x2D
!define VK_DELETE 0x2E
!define VK_HELP 0x2F
; VK_0 - VK_9 are the same as ASCII '0' - '9' (0x30 - 0x39)
; VK_A - VK_Z are the same as ASCII 'A' - 'Z' (0x41 - 0x5A)
!define VK_LWIN 0x5B
!define VK_RWIN 0x5C
!define VK_APPS 0x5D
!define VK_SLEEP 0x5F
!define VK_NUMPAD0 0x60
!define VK_NUMPAD1 0x61
!define VK_NUMPAD2 0x62
!define VK_NUMPAD3 0x63
!define VK_NUMPAD4 0x64
!define VK_NUMPAD5 0x65
!define VK_NUMPAD6 0x66
!define VK_NUMPAD7 0x67
!define VK_NUMPAD8 0x68
!define VK_NUMPAD9 0x69
!define VK_MULTIPLY 0x6A
!define VK_ADD 0x6B
!define VK_SEPARATOR 0x6C
!define VK_SUBTRACT 0x6D
!define VK_DECIMAL 0x6E
!define VK_DIVIDE 0x6F
!define VK_F1 0x70
!define VK_F2 0x71
!define VK_F3 0x72
!define VK_F4 0x73
!define VK_F5 0x74
!define VK_F6 0x75
!define VK_F7 0x76
!define VK_F8 0x77
!define VK_F9 0x78
!define VK_F10 0x79
!define VK_F11 0x7A
!define VK_F12 0x7B
!define VK_NUMLOCK 0x90
!define VK_SCROLL 0x91
!define VK_OEM_NEC_EQUAL 0x92 ; '=' key on numpad
!define VK_LSHIFT 0xA0
!define VK_RSHIFT 0xA1
!define VK_LCONTROL 0xA2
!define VK_RCONTROL 0xA3
!define VK_LMENU 0xA4
!define VK_RMENU 0xA5
!endif
!ifndef __WIN_MS_NOWINOFFSETS
/* in nsDialogs.nsh...
!define GWL_STYLE -16
!define GWL_EXSTYLE -20 */
!define GWLP_WNDPROC -4
!define GWLP_HINSTANCE -6
!define GWLP_HWNDPARENT -8
!define GWLP_USERDATA -21
!define GWLP_ID -12
!define DWLP_MSGRESULT 0
!define /math DWLP_DLGPROC ${DWLP_MSGRESULT} + ${__WIN_PTRSIZE} ;DWLP_MSGRESULT + sizeof(LRESULT)
!define /math DWLP_USER ${DWLP_DLGPROC} + ${__WIN_PTRSIZE} ;DWLP_DLGPROC + sizeof(DLGPROC)
!endif
!ifndef __WIN_MS_NONCMESSAGES
!define HTERROR -2
!define HTTRANSPARENT -1
!define HTNOWHERE 0
!define HTCLIENT 1
!define HTCAPTION 2
!define HTSYSMENU 3
!define HTGROWBOX 4
!define HTSIZE ${HTGROWBOX}
!define HTMENU 5
!define HTHSCROLL 6
!define HTVSCROLL 7
!define HTMINBUTTON 8
!define HTMAXBUTTON 9
!define HTLEFT 10
!define HTRIGHT 11
!define HTTOP 12
!define HTTOPLEFT 13
!define HTTOPRIGHT 14
!define HTBOTTOM 15
!define HTBOTTOMLEFT 16
!define HTBOTTOMRIGHT 17
!define HTBORDER 18
!define HTREDUCE ${HTMINBUTTON}
!define HTZOOM ${HTMAXBUTTON}
!define HTSIZEFIRST ${HTLEFT}
!define HTSIZELAST ${HTBOTTOMRIGHT}
!define HTOBJECT 19
!define HTCLOSE 20
!define HTHELP 21
!endif
!ifndef __WIN_MS_NOSYSCOMMANDS
!define SC_SIZE 0xF000
!define SC_MOVE 0xF010
!define SC_MINIMIZE 0xF020
!define SC_MAXIMIZE 0xF030
!define SC_NEXTWINDOW 0xF040
!define SC_PREVWINDOW 0xF050
!define SC_CLOSE 0xF060
!define SC_VSCROLL 0xF070
!define SC_HSCROLL 0xF080
!define SC_MOUSEMENU 0xF090
!define SC_KEYMENU 0xF100
!define SC_ARRANGE 0xF110
!define SC_RESTORE 0xF120
!define SC_TASKLIST 0xF130
!define SC_SCREENSAVE 0xF140
!define SC_HOTKEY 0xF150
!define SC_DEFAULT 0xF160
!define SC_MONITORPOWER 0xF170
!define SC_CONTEXTHELP 0xF180
!define SC_SEPARATOR 0xF00F
!endif
!define IDC_ARROW 32512
!define IDC_IBEAM 32513
!define IDC_WAIT 32514
!define IDC_CROSS 32515
!define IDC_UPARROW 32516
!define IDC_SIZENWSE 32642
!define IDC_SIZENESW 32643
!define IDC_SIZEWE 32644
!define IDC_SIZENS 32645
!define IDC_SIZEALL 32646
!define IDC_NO 32648
!define IDC_HAND 32649
!define IDC_APPSTARTING 32650
!define IDC_HELP 32651
/* in nsDialogs.nsh...
!define IMAGE_BITMAP 0
!define IMAGE_ICON 1
!define IMAGE_CURSOR 2*/
/* in nsDialogs.nsh...
!define LR_DEFAULTCOLOR 0x0000
!define LR_MONOCHROME 0x0001
!define LR_COLOR 0x0002
!define LR_COPYRETURNORG 0x0004
!define LR_COPYDELETEORG 0x0008
!define LR_LOADFROMFILE 0x0010
!define LR_LOADTRANSPARENT 0x0020
!define LR_DEFAULTSIZE 0x0040
!define LR_VGACOLOR 0x0080
!define LR_LOADMAP3DCOLORS 0x1000
!define LR_CREATEDIBSECTION 0x2000
!define LR_COPYFROMRESOURCE 0x4000
!define LR_SHARED 0x8000*/
!define GA_PARENT 1
!define GA_ROOT 2
!define GA_ROOTOWNER 3
!endif /* __WIN_MS_NOUSER & __WIN_NOINC_WINUSER */
!verbose pop
!endif /* __WIN_WINUSER__INC */

View file

@ -0,0 +1,56 @@
# "Dialogs header file by Joel Almeida García"
#include once this header file
!ifndef DIALOGS_NSH
!define DIALOGS_NSH
!verbose push
!verbose 3
!ifndef LOGICLIB
#Add logic library
!include "LogicLib.nsh"
!endif
# Global stuff
!define ISTRUE 1
!define ISFALSE 0
!define NULL ""
# Returning Vars
!define VAR_0 0 # $0
!define VAR_1 1 # $1
!define VAR_2 2 # $2
!define VAR_3 3 # $3
!define VAR_4 4 # $4
!define VAR_5 5 # $5
!define VAR_6 6 # $6
!define VAR_7 7 # $7
!define VAR_8 8 # $8
!define VAR_9 9 # $9
!define VAR_R0 10 # $R0
!define VAR_R1 11 # $R1
!define VAR_R2 12 # $R2
!define VAR_R3 13 # $R3
!define VAR_R4 14 # $R4
!define VAR_R5 15 # $R5
!define VAR_R6 16 # $R6
!define VAR_R7 17 # $R7
!define VAR_R8 18 # $R8
!define VAR_R9 19 # $R9
!define VAR_CMDLINE 20 # $CMDLINE
!define VAR_INSTDIR 21 # $INSTDIR
!define VAR_OUTDIR 22 # $OUTDIR
!define VAR_EXEDIR 23 # $EXEDIR
!define VAR_LANG 24 # $LANGUAGE
# Function prototypes
!define OpenBox 'dialogsEx::FileBox ""'
!define SaveBox 'dialogsEx::FileBox "1"'
!define ClassicFolderBox 'dialogsEx::FolderBox ""'
!define ModernFolderBox 'dialogsEx::FolderBox "1"'
!define InputTextBox 'dialogsEx::InputBox ""'
!define InputPwdBox 'dialogsEx::InputBox "1"'
!define InputRegBox 'dialogsEx::InputRegBox'
!verbose pop
!endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B