This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches. git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@625 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
9b3b220a13
commit
3e9e73ec59
177 changed files with 37677 additions and 0 deletions
102
Contrib/ExDLL/exdll.c
Normal file
102
Contrib/ExDLL/exdll.c
Normal file
|
@ -0,0 +1,102 @@
|
|||
#include <windows.h>
|
||||
|
||||
typedef struct _stack_t {
|
||||
struct _stack_t *next;
|
||||
char text[1]; // this should be the length of string_size
|
||||
} stack_t;
|
||||
|
||||
int popstring(char *str); // 0 on success, 1 on empty stack
|
||||
void pushstring(char *str);
|
||||
|
||||
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_LAST
|
||||
};
|
||||
|
||||
char *getuservariable(int varnum);
|
||||
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
HWND g_hwndParent;
|
||||
int g_stringsize;
|
||||
stack_t **g_stacktop;
|
||||
char *g_variables;
|
||||
|
||||
void __declspec(dllexport) myFunction(HWND hwndParent, int string_size,
|
||||
char *variables, stack_t **stacktop)
|
||||
{
|
||||
g_hwndParent=hwndParent;
|
||||
g_stringsize=string_size;
|
||||
g_stacktop=stacktop;
|
||||
g_variables=variables;
|
||||
|
||||
// do your stuff here
|
||||
{
|
||||
char buf[1024];
|
||||
wsprintf(buf,"$0=%s\n",getuservariable(INST_0));
|
||||
MessageBox(g_hwndParent,buf,0,MB_OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||
{
|
||||
g_hInstance=hInst;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
// utility functions (not required but often useful)
|
||||
int popstring(char *str)
|
||||
{
|
||||
stack_t *th;
|
||||
if (!g_stacktop || !*g_stacktop) return 1;
|
||||
th=(*g_stacktop);
|
||||
lstrcpy(str,th->text);
|
||||
*g_stacktop = th->next;
|
||||
GlobalFree((HGLOBAL)th);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pushstring(char *str)
|
||||
{
|
||||
stack_t *th;
|
||||
if (!g_stacktop) return;
|
||||
th=(stack_t*)GlobalAlloc(GPTR,sizeof(stack_t)+g_stringsize);
|
||||
lstrcpyn(th->text,str,g_stringsize);
|
||||
th->next=*g_stacktop;
|
||||
*g_stacktop=th;
|
||||
}
|
||||
|
||||
char *getuservariable(int varnum)
|
||||
{
|
||||
if (varnum < 0 || varnum >= __INST_LAST) return NULL;
|
||||
return g_variables+varnum*g_stringsize;
|
||||
}
|
||||
|
||||
|
122
Contrib/ExDLL/exdll.dpr
Normal file
122
Contrib/ExDLL/exdll.dpr
Normal file
|
@ -0,0 +1,122 @@
|
|||
{
|
||||
NSIS ExDLL example
|
||||
(C) 2001 - Peter Windridge
|
||||
|
||||
Fixed and formatted by Alexander Tereschenko
|
||||
http://futuris.plastiqueweb.com/
|
||||
|
||||
Tested in Delphi 6.01
|
||||
}
|
||||
|
||||
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_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(str: PChar):integer;
|
||||
var
|
||||
th: pstack_t;
|
||||
begin
|
||||
if integer(g_stacktop^) = 0 then
|
||||
begin
|
||||
Result:=1;
|
||||
Exit;
|
||||
end;
|
||||
th:=g_stacktop^;
|
||||
lstrcpy(str,@th.text);
|
||||
g_stacktop^ := th.next;
|
||||
GlobalFree(HGLOBAL(th));
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
function PushString(str: PChar):integer;
|
||||
var
|
||||
th: pstack_t;
|
||||
begin
|
||||
if integer(g_stacktop) = 0 then
|
||||
begin
|
||||
Result:=1;
|
||||
Exit;
|
||||
end;
|
||||
th:=pstack_t(GlobalAlloc(GPTR,sizeof(stack_t)+g_stringsize));
|
||||
lstrcpyn(@th.text,str,g_stringsize);
|
||||
th.next:=g_stacktop^;
|
||||
g_stacktop^:=th;
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
function GetUserVariable(varnum: TVariableList):PChar;
|
||||
begin
|
||||
if (integer(varnum) < 0) or (integer(varnum) >= integer(__INST_LAST)) then
|
||||
begin
|
||||
Result:='';
|
||||
Exit;
|
||||
end;
|
||||
Result:=g_variables+integer(varnum)*g_stringsize;
|
||||
end;
|
||||
|
||||
function ex_dll(hwndParent: HWND; string_size: integer; variables: PChar; stacktop: pointer):integer; cdecl;
|
||||
var
|
||||
c: PChar;
|
||||
buf: array[0..1024] of char;
|
||||
begin
|
||||
// set up global variables
|
||||
g_stringsize:=string_size;
|
||||
g_hwndParent:=hwndParent;
|
||||
g_stringsize:=string_size;
|
||||
g_stacktop:=stacktop;
|
||||
g_variables:=variables;
|
||||
|
||||
c:=GetUserVariable(INST_0);
|
||||
MessageBox(g_hwndParent,c,'The value of $0',MB_OK);
|
||||
PopString(@buf);
|
||||
MessageBox(g_hwndParent,@buf,'pop',MB_OK);
|
||||
PushString(PChar('Hello, this is a push'));
|
||||
|
||||
Result:=1;
|
||||
end;
|
||||
|
||||
exports ex_dll;
|
||||
|
||||
begin
|
||||
end.
|
107
Contrib/ExDLL/exdll.dsp
Normal file
107
Contrib/ExDLL/exdll.dsp
Normal file
|
@ -0,0 +1,107 @@
|
|||
# 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 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXDLL_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 gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"_DllMainCRTStartup" /dll /machine:I386 /nodefaultlib /out:"../../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 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 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXDLL_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 /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"
|
||||
# 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
|
29
Contrib/ExDLL/exdll.dsw
Normal file
29
Contrib/ExDLL/exdll.dsw
Normal 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>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue