MatthewHarmon
20th July 2006 16:29 UTC
License / EULA text from external file?
Hi all...
Is there a way to have the license/EULA text be taken from the root of my distribution CD instead of baked right into the installer?
I'm using the modern UI, but can modify the macros if need be.
Thanks!
Joel
20th July 2006 16:40 UTC
And why not use, in compilation time, that license file?
MatthewHarmon
20th July 2006 16:47 UTC
Because my publisher won't let me! They want to be able to make changes to the license without needing to make a new installer.
MatthewHarmon
20th July 2006 17:13 UTC
Thanks... I found that first method and it seems to work for me. Also seems to be the "safest".
Takhir
20th July 2006 19:06 UTC
Now I see that code may be shorter and msvcrt free :)
!define FILE_SHARE_READ 1
!define GENERIC_READ 0x80000000
!define OPEN_EXISTING 3
!define FILE_BEGIN 0
!define FILE_END 2
Function addLicense
System::Call 'kernel32::CreateFile(t "$EXEDIR\${LIC_NAME}", i ${GENERIC_READ}, i ${FILE_SHARE_READ}, i 0, i ${OPEN_EXISTING}, i 0, i 0) i .r0'
IfErrors exit
System::Call 'kernel32::SetFilePointer(i r0, i 0, i 0, i ${FILE_END}) i .r1'
IntOp $1 $1 + 1 ; for terminating zero
System::Call 'kernel32::SetFilePointer(i r0, i 0, i 0, i ${FILE_BEGIN})'
System::Alloc $1
Pop $2
System::Call 'kernel32::ReadFile(i r0, i r2, i r1, *i .r3, i 0)'
System::Call 'kernel32::CloseHandle(i r0)'
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1000
SendMessage $0 ${WM_SETTEXT} $0 $2
System::Free $2
exit:
FunctionEnd
MatthewHarmon
21st July 2006 16:42 UTC
So, I assume calling the 'kernel32::' routines are "safer" than calling out to the .dll. That is, calling 'kernel32' routines are guaranteed to work?
Takhir
21st July 2006 17:09 UTC
No. 'system' plug-in adds .dll for module to load if extension was ommited, and this is not safety question. kernel32.dll calls should work on all systems beginnig Win95. msvcrt.dll appeared in Win95 second edition (?) or with any service pack (or any IE installed), but 100% waranty of msvcrt is beginning Win98 only.
vbguy
24th July 2006 03:44 UTC
Takhir, for some reason your code bails out early (it jumps to the exit) which means there is an error when loading the text file. But when I remove the IfErrors line, the file loads fine.
Is there some way to see what error the kernel is throwing? Just for safety reasons if nothing else.
Thanks,
VBGuy
Takhir
24th July 2006 07:07 UTC
Looks like error flag was set before function call, just add ClearErrors (Manual 4.9.4.3) as a first function line.