Updated gitignore and Engine/bin for ticket #1

This commit is contained in:
DavidWyand-GG 2012-09-20 12:46:44 -04:00
parent 1cca6c95f2
commit 08d5ba86f7
593 changed files with 72474 additions and 0 deletions

View file

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "exdll", "exdll.vcproj", "{5E3E2AFD-1D6B-4997-A9B5-8ECBC8F6C31A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5E3E2AFD-1D6B-4997-A9B5-8ECBC8F6C31A}.Debug|Win32.ActiveCfg = Debug|Win32
{5E3E2AFD-1D6B-4997-A9B5-8ECBC8F6C31A}.Debug|Win32.Build.0 = Debug|Win32
{5E3E2AFD-1D6B-4997-A9B5-8ECBC8F6C31A}.Release|Win32.ActiveCfg = Release|Win32
{5E3E2AFD-1D6B-4997-A9B5-8ECBC8F6C31A}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,264 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="exdll"
ProjectGUID="{5E3E2AFD-1D6B-4997-A9B5-8ECBC8F6C31A}"
RootNamespace="exdll"
TargetFrameworkVersion="0"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/exdll.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
InlineFunctionExpansion="0"
AdditionalIncludeDirectories="."
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL;EXDLL_EXPORTS;NSISCALL=__stdcall"
StringPooling="true"
RuntimeLibrary="2"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile=".\Release/exdll.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="odbc32.lib odbccp32.lib nsis\pluginapi.lib"
OutputFile=".\Release/exdll.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
IgnoreAllDefaultLibraries="true"
IgnoreDefaultLibraryNames="libc.lib"
ProgramDatabaseFile=".\Release/exdll.pdb"
OptimizeForWindows98="1"
EntryPointSymbol="DllMain"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary=".\Release/exdll.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Release/exdll.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/exdll.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="."
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL;EXDLL_EXPORTS;NSISCALL=__stdcall"
MinimalRebuild="true"
BasicRuntimeChecks="0"
RuntimeLibrary="3"
BufferSecurityCheck="false"
PrecompiledHeaderFile=".\Debug/exdll.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="odbc32.lib odbccp32.lib nsis\pluginapi.lib"
OutputFile=".\Debug/exdll.dll"
LinkIncremental="2"
SuppressStartupBanner="true"
IgnoreAllDefaultLibraries="true"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/exdll.pdb"
EntryPointSymbol="DllMain"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary=".\Debug/exdll.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Debug/exdll.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="exdll.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath="nsis\pluginapi.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,38 @@
#include <windows.h>
#include <nsis/pluginapi.h> // nsis plugin
HINSTANCE g_hInstance;
HWND g_hwndParent;
void __declspec(dllexport) myFunction(HWND hwndParent, int string_size,
char *variables, stack_t **stacktop,
extra_parameters *extra)
{
g_hwndParent=hwndParent;
EXDLL_INIT();
// note if you want parameters from the stack, pop them off in order.
// i.e. if you are called via exdll::myFunction file.dat poop.dat
// calling popstring() the first time would give you file.dat,
// and the second time would give you poop.dat.
// you should empty the stack of your parameters, and ONLY your
// parameters.
// do your stuff here
{
char buf[1024];
wsprintf(buf,"$0=%s\n",getuservariable(INST_0));
MessageBox(g_hwndParent,buf,0,MB_OK);
}
}
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
{
g_hInstance=hInst;
return TRUE;
}

View file

@ -0,0 +1,118 @@
{
NSIS ExDLL example
(C) 2001 - Peter Windridge
Fixed and formatted by Brett Dever
http://editor.nfscheats.com/
Tested in Delphi 7.0
}
library exdll;
uses Windows;
type
VarConstants = (
INST_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
);
TVariableList = INST_0..__INST_LAST;
pstack_t = ^stack_t;
stack_t = record
next: pstack_t;
text: PChar;
end;
var
g_stringsize: integer;
g_stacktop: ^pstack_t;
g_variables: PChar;
g_hwndParent: HWND;
function PopString(): string;
var
th: pstack_t;
begin
if integer(g_stacktop^) <> 0 then begin
th := g_stacktop^;
Result := PChar(@th.text);
g_stacktop^ := th.next;
GlobalFree(HGLOBAL(th));
end;
end;
procedure PushString(const str: string='');
var
th: pstack_t;
begin
if integer(g_stacktop) <> 0 then begin
th := pstack_t(GlobalAlloc(GPTR, SizeOf(stack_t) + g_stringsize));
lstrcpyn(@th.text, PChar(str), g_stringsize);
th.next := g_stacktop^;
g_stacktop^ := th;
end;
end;
function GetUserVariable(const varnum: TVariableList): string;
begin
if (integer(varnum) >= 0) and (integer(varnum) < integer(__INST_LAST)) then
Result := g_variables + integer(varnum) * g_stringsize
else
Result := '';
end;
procedure SetUserVariable(const varnum: TVariableList; const value: string);
begin
if (value <> '') and (integer(varnum) >= 0) and (integer(varnum) < integer(__INST_LAST)) then
lstrcpy(g_variables + integer(varnum) * g_stringsize, PChar(value))
end;
procedure NSISDialog(const text, caption: string; const buttons: integer);
begin
MessageBox(g_hwndParent, PChar(text), PChar(caption), buttons);
end;
procedure ex_dll(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer); cdecl;
begin
// setup global variables
g_stringsize := string_size;
g_hwndParent := hwndParent;
g_stacktop := stacktop;
g_variables := variables;
// end global variable setup
NSISDialog(GetUserVariable(INST_0), 'The value of $0', MB_OK);
NSISDialog(PopString, 'pop', MB_OK);
PushString('Hello, this is a push');
SetUserVariable(INST_0, 'This is user var $0');
end;
exports ex_dll;
begin
end.

View file

@ -0,0 +1,112 @@
# Microsoft Developer Studio Project File - Name="exdll" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=exdll - 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 "exdll.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 "exdll.mak" CFG="exdll - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "exdll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "exdll - 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)" == "exdll - 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 "EXDLL_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O1 /I "." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXDLL_EXPORTS" /D NSISCALL=__stdcall /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 gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib nsis\pluginapi.lib /nologo /entry:"DllMain" /dll /machine:I386 /nodefaultlib /out:"../../Plugins/exdll.dll" /opt:nowin98
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "exdll - 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 "EXDLL_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXDLL_EXPORTS" /D NSISCALL=__stdcall /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 nsis\pluginapi.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "exdll - Win32 Release"
# Name "exdll - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\exdll.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\nsis\pluginapi.h
# End Source File
# 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: "exdll"=.\exdll.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View file

@ -0,0 +1,31 @@
{
NSIS ExDLL2 example
Original is ExDLL
(C) 2001 - Peter Windridge
Changed with delphi unit nsis.pas
by bernhard mayer
Tested in Delphi 7.0
}
library exdll;
uses
nsis, windows;
procedure ex_dll(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer); cdecl;
begin
// set up global variables
Init(hwndParent, string_size, variables, stacktop);
NSISDialog(GetUserVariable(INST_0), 'The value of $0', MB_OK);
NSISDialog(PopString, 'pop', MB_OK);
PushString('Hello, this is a push');
SetUserVariable(INST_0, 'This is user var $0');
end;
exports ex_dll;
begin
end.

View file

@ -0,0 +1,145 @@
;################################################################
; ExtDLL header for MASM32
;
; Author: Ramon
;
; Obs: This header must be included after windows.inc and kernel32.inc
; because it need the prototypes for lstrcpy, lstrcpyn,
; GlobalAlloc and GlobalFree
;
;################################################################
stack_t struct
next dd ?
text dd ? ; 1 DUP(?) ; this should be the length of string_size
stack_t ends
.const
; For page showing plug-ins
WM_NOTIFY_OUTER_NEXT equ (WM_USER+0x8)
WM_NOTIFY_CUSTOM_READY equ (WM_USER+0xd)
NOTIFY_BYE_BYE equ 'x'
INST_0 EQU 0 ; $0
INST_1 EQU 1 ; $1
INST_2 EQU 2 ; $2
INST_3 EQU 3 ; $3
INST_4 EQU 4 ; $4
INST_5 EQU 5 ; $5
INST_6 EQU 6 ; $6
INST_7 EQU 7 ; $7
INST_8 EQU 8 ; $8
INST_9 EQU 9 ; $9
INST_R0 EQU 10 ; $R0
INST_R1 EQU 11 ; $R1
INST_R2 EQU 12 ; $R2
INST_R3 EQU 13 ; $R3
INST_R4 EQU 14 ; $R4
INST_R5 EQU 15 ; $R5
INST_R6 EQU 16 ; $R6
INST_R7 EQU 17 ; $R7
INST_R8 EQU 18 ; $R8
INST_R9 EQU 19 ; $R9
INST_CMDLINE EQU 20 ; $CMDLINE
INST_INSTDIR EQU 21 ; $INSTDIR
INST_OUTDIR EQU 22 ; $OUTDIR
INST_EXEDIR EQU 23 ; $EXEDIR
INST_LANG EQU 24 ; $LANGUAGE
__INST_LAST EQU 25
.data?
g_stringsize dd ?
g_stacktop dd ?
g_variables dd ?
m2m MACRO M1, M2
push M2
pop M1
ENDM
EXDLL_INIT MACRO
m2m g_stringsize, string_size
m2m g_stacktop, stacktop
m2m g_variables, variables
ENDM
.code
; utility functions (not required but often useful)
popstring proc uses edi pStr:DWORD
LOCAL th:DWORD
mov edi, g_stacktop
cmp edi, 0
jz STACK_ERR
mov edi, [edi]
cmp edi, 0
jz STACK_ERR
ASSUME edi:PTR stack_t
invoke lstrcpy, pStr, ADDR [edi].text
mov th , edi
mov edi, [edi].next
mov eax, g_stacktop
mov [eax], edi
invoke GlobalFree, th
ASSUME edi:PTR NOTHING
mov eax, 0
ret
STACK_ERR:
mov eax, 1
ret
popstring endp
pushstring proc uses edi pStr:DWORD
cmp g_stacktop, 0
jz STACK_ERR
mov eax, sizeof stack_t
add eax, g_stringsize
invoke GlobalAlloc, GPTR, eax
mov edi, eax
assume edi:PTR stack_t
invoke lstrcpyn, ADDR [edi].text, pStr, g_stringsize
mov eax, g_stacktop
push DWORD PTR[eax]
mov [eax], edi
pop eax
;lea edi, [edi].next ; Not needed [edi].next == edi
mov DWORD PTR[edi], eax
ASSUME edi:PTR NOTHING
STACK_ERR:
ret
pushstring endp
getuservariable proc varnum:DWORD
.if varnum < 0 || varnum >= __INST_LAST
xor eax, eax
.else
mov eax, varnum
imul eax, g_stringsize
add eax, g_variables
.endif
ret
getuservariable endp
setuservariable proc varnum:DWORD, var:DWORD
.if (var != NULL && varnum >= 0 && varnum < __INST_LAST)
mov eax, varnum
imul eax, g_stringsize
add eax, g_variables
invoke lstrcpy, eax, var
.endif
ret
setuservariable endp

View file

@ -0,0 +1,126 @@
{
Original Code from
(C) 2001 - Peter Windridge
Code in seperate unit and some changes
2003 by Bernhard Mayer
Fixed and formatted by Brett Dever
http://editor.nfscheats.com/
simply include this unit in your plugin project and export
functions as needed
}
unit nsis;
interface
uses
windows;
type
VarConstants = (
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
);
TVariableList = INST_0..__INST_LAST;
pstack_t = ^stack_t;
stack_t = record
next: pstack_t;
text: PChar;
end;
var
g_stringsize: integer;
g_stacktop: ^pstack_t;
g_variables: PChar;
g_hwndParent: HWND;
procedure Init(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer);
function PopString(): string;
procedure PushString(const str: string='');
function GetUserVariable(const varnum: TVariableList): string;
procedure SetUserVariable(const varnum: TVariableList; const value: string);
procedure NSISDialog(const text, caption: string; const buttons: integer);
implementation
procedure Init(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer);
begin
g_stringsize := string_size;
g_hwndParent := hwndParent;
g_stacktop := stacktop;
g_variables := variables;
end;
function PopString(): string;
var
th: pstack_t;
begin
if integer(g_stacktop^) <> 0 then begin
th := g_stacktop^;
Result := PChar(@th.text);
g_stacktop^ := th.next;
GlobalFree(HGLOBAL(th));
end;
end;
procedure PushString(const str: string='');
var
th: pstack_t;
begin
if integer(g_stacktop) <> 0 then begin
th := pstack_t(GlobalAlloc(GPTR, SizeOf(stack_t) + g_stringsize));
lstrcpyn(@th.text, PChar(str), g_stringsize);
th.next := g_stacktop^;
g_stacktop^ := th;
end;
end;
function GetUserVariable(const varnum: TVariableList): string;
begin
if (integer(varnum) >= 0) and (integer(varnum) < integer(__INST_LAST)) then
Result := g_variables + integer(varnum) * g_stringsize
else
Result := '';
end;
procedure SetUserVariable(const varnum: TVariableList; const value: string);
begin
if (value <> '') and (integer(varnum) >= 0) and (integer(varnum) < integer(__INST_LAST)) then
lstrcpy(g_variables + integer(varnum) * g_stringsize, PChar(value))
end;
procedure NSISDialog(const text, caption: string; const buttons: integer);
begin
MessageBox(g_hwndParent, PChar(text), PChar(caption), buttons);
end;
begin
end.

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___