updated splash to new exdll. made it so that it always pushes status to the stack even if error occured

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1127 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
justin1014 2002-09-21 19:09:51 +00:00
parent 782ff9a7aa
commit f556e3d8fa
3 changed files with 16 additions and 39 deletions

View file

@ -1,20 +1,11 @@
#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);
#include "../exdll/exdll.h"
HINSTANCE g_hInstance;
stack_t **g_stacktop;
int g_stringsize;
HBITMAP g_hbm;
int sleep_val;
int g_rv;
int g_rv=-1;
static LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
@ -70,11 +61,11 @@ void __declspec(dllexport) show(HWND hwndParent, int string_size, char *variable
char temp[64];
char *sleep=temp;
g_stringsize=string_size;
g_stacktop=stacktop;
EXDLL_INIT();
popstring(fn);
popstring(sleep);
popstring(fn);
sleep_val=0;
while (*sleep >= '0' && *sleep <= '9')
@ -118,31 +109,9 @@ void __declspec(dllexport) show(HWND hwndParent, int string_size, char *variable
DeleteObject(g_hbm);
wsprintf(temp,"%d",g_rv);
pushstring(temp);
}
}
}
wsprintf(temp,"%d",g_rv);
pushstring(temp);
}
// 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;
}

View file

@ -101,6 +101,10 @@ SOURCE=.\splash.c
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\ExDLL\exdll.h
# End Source File
# End Group
# Begin Group "Resource Files"

View file

@ -18,6 +18,10 @@ Function .onInit
; File /oname=spltmp.wav "my_splashshit.wav"
splash::show 1000 $TEMP\spltmp
Pop $0 ; $0 has '1' if the user closed the splash screen early,
; '0' if everything closed normal, and '-1' if some error occured.
Delete $TEMP\spltmp.bmp
; Delete $TEMP\spltmp.wav
FunctionEnd
@ -29,7 +33,7 @@ the .bmp). The BMP file used will be this parameter.bmp, and the wave file used
(If you already have an .onInit function, put that in it)
Note: the return value of splash.exe is 1 if the user closed the splash
Note: the return value of splash is 1 if the user closed the splash
screen early (pop it from the stack)
-Justin