updated to new exdll interface. note that /TIMEOUT must come before command now.

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1122 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
justin1014 2002-09-21 18:49:49 +00:00
parent 6afeb313a4
commit dfb549d324
6 changed files with 6 additions and 94 deletions

View file

@ -61,21 +61,13 @@ LINK32=link.exe
SOURCE=.\nsexec.c
# End Source File
# Begin Source File
SOURCE=.\nsis.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\nsexec.h
# End Source File
# Begin Source File
SOURCE=.\nsis.h
SOURCE=..\ExDLL\exdll.h
# End Source File
# End Group
# Begin Group "Resource Files"

View file

@ -5,11 +5,11 @@ without opening a dos box.
Usage
-----
nsExec::Exec path [/TIMEOUT=x]
nsExec::Exec [/TIMEOUT=x] path
-or-
nsExec::ExecToLog path [/TIMEOUT=x]
nsExec::ExecToLog [/TIMEOUT=x] path
Both functions are the same except ExecToLog will print the output
to the logwindow.

View file

@ -1,6 +1,6 @@
#include <windows.h>
#include <commctrl.h>
#include "nsexec.h"
#include "../exdll/exdll.h"
#ifndef true
#define true TRUE
@ -29,9 +29,7 @@ int my_atoi(char *s);
void __declspec(dllexport) Exec(HWND hwndParent, int string_size, char *variables, stack_t **stacktop) {
g_hwndParent=hwndParent;
g_stringsize=string_size;
g_stacktop=stacktop;
g_variables=variables;
EXDLL_INIT();
{
ExecScript(false);
}
@ -39,9 +37,7 @@ void __declspec(dllexport) Exec(HWND hwndParent, int string_size, char *variable
void __declspec(dllexport) ExecToLog(HWND hwndParent, int string_size, char *variables, stack_t **stacktop) {
g_hwndParent=hwndParent;
g_stringsize=string_size;
g_stacktop=stacktop;
g_variables=variables;
EXDLL_INIT();
{
ExecScript(true);
}

View file

@ -1,4 +0,0 @@
#ifndef nsexec_h
#define nsexec_h
#include "nsis.h"
#endif

View file

@ -1,26 +0,0 @@
#include <windows.h>
#include "nsis.h"
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;
}

View file

@ -1,46 +0,0 @@
#ifndef nsis_h
#define nsis_h
typedef struct _stack_t {
struct _stack_t *next;
char text[1];
} 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
};
int g_stringsize;
stack_t ** g_stacktop;
char * g_variables;
int popstring(char *str);
void pushstring(char *str);
char * getuservariable(int varnum);
#endif