1;-------------------------------- 2;Include nsdialogs and 64bit checks 3 4!include "x64.nsh" 5!include LogicLib.nsh 6!include nsDialogs.nsh 7!include WinMessages.nsh 8!include "eidmw_version.nsh" 9!include WinVer.nsh 10!include "buttons.nsh" 11!include "fileSearch.nsh" 12 13;-------------------------------- 14;General 15;inner dialog size in units in classic nsdialogs: 266 * 130 16;in modern UI: 300 * 140 17 18 19;defines 20!addplugindir "NSIS_Plugins\beidread\Release" 21;Name and file 22Name "Belgium eID-QuickInstaller ${EIDMW_VERSION}" 23OutFile "Belgium eID-QuickInstaller ${EIDMW_VERSION}.exe" 24VIProductVersion "${EIDMW_VERSION}" 25VIAddVersionKey "FileVersion" "${EIDMW_VERSION}" 26VIAddVersionKey "CompanyName" "Belgian Government" 27VIAddVersionKey "LegalCopyright" "Copyright (C) ${EIDMW_YEAR}" 28VIAddVersionKey "FileDescription" "Belgium eID MiddleWare" 29 30;Default installation folder 31InstallDir "$PROGRAMFILES\Belgium Identity Card" 32 33;Request application privileges for Windows Vista 34RequestExecutionLevel admin 35XPStyle on 36Icon beID.ico 37 38caption $(ls_caption) 39 40 Var versionMajor 41 Var versionMinor 42 Var retval 43 Var readercount 44 Var lastname 45 Var firstletterthirdname 46 Var firstname 47 48 Var nsdCustomDialog 49 Var Label 50 Var Background_Image 51 Var Background_Image_Handle 52 Var Background_Image2 53 Var Background_Image_Handle2 54 Var Button 55 Var Font_Title 56 Var Font_Info 57 Var FileToCopy 58 Var LogFile 59 ;Var TestLogFile 60 Var TempFile 61 Var firstLine 62 Var MsiResponse 63 Var InstallFailed 64 Var ReaderFailed 65 Var FindCardFailed 66 Var FAQ_url 67 68;-------------------------------- 69 ;Interface Settings 70BrandingText " " 71InstProgressFlags smooth 72;do not show installation details 73;ShowInstDetails nevershow 74;ShowUninstDetails nevershow 75 76Function InstShow 77SetCtlColors $HWNDPARENT 0 0xFFFFFF ; parent background white, black text 78 79GetDlgItem $0 $HWNDPARENT 1028 ;1028 is the bar between the default buttons 80SetCtlColors $0 0 0xFFFFFF ; background white, black text 81 82FindWindow $0 "#32770" "" $HWNDPARENT ; get the inner dialog 83SetCtlColors $0 0 0xFFFFFF ; make the background white, black text 84GetDlgItem $1 $0 1006 ; get the item handle of detail text 85SetCtlColors $1 0 0xFFFFFF ; make that item's background white, black text 86FunctionEnd 87 88;-------------------------------- 89;Pages 90 91Page custom nsdWelcome nsdWelcomeLeave 92;Page license "" show_instfiles "" 93Page instfiles "" show_instfiles "" 94Page custom nsdInstallCheck nsdInstallCheckLeave 95Page custom nsdDone nsdDoneLeave 96Page custom nsdConnectReader nsdConnectReaderLeave 97Page custom nsdReaderCheck nsdReaderCheckLeave 98Page custom nsdInsertCard nsdInsertCardLeave 99Page custom nsdCardCheck nsdCardCheckLeave 100Page custom nsdCardData nsdCardDataLeave 101 102;-------------------------------- 103;Languages 104; its all in "eIDTranslations.nsh" 105;-------------------------------- 106!include "eIDTranslations.nsh" 107 108 109MiscButtonText $(ls_back) $(ls_next) $(ls_cancel) $(ls_close) 110; MessageBox MB_OK "A translated message: $(message)" 111;LicenseLangString license ${LANG_ENGLISH} "..\..\doc\licenses\English\License_en.rtf" 112;LicenseLangString license ${LANG_GERMAN} "..\..\doc\licenses\German\License_de.rtf" 113;LicenseLangString license ${LANG_FRENCH} "..\..\doc\licenses\French\License_fr.rtf" 114;LicenseLangString license ${LANG_DUTCH} "..\..\doc\licenses\Dutch\License_nl.rtf" 115 116;LicenseData $(license) 117 118 119;-------------------------------- 120;Installer Sections 121 122Section "Belgium Eid Crypto Modules" BeidCrypto 123 SetOutPath "$INSTDIR" 124 CreateDirectory "$INSTDIR\log" 125 126 ${WinVerGetMajor} $versionMajor 127 ${WinVerGetMinor} $versionMinor 128 129 StrCpy $FAQ_url "https://eid.belgium.be/" 130 131 ${If} ${RunningX64} 132 ClearErrors 133 StrCpy $FileToCopy "$INSTDIR\BeidMW_64.msi" 134 File "..\eid-mw\Windows\bin\BeidMW_64.msi" 135 IfErrors 0 +2 136 Call ErrorHandler_file 137 ClearErrors 138 139 StrCpy $LogFile "$INSTDIR\log\install_eidmw64_log.txt" 140 StrCpy $TempFile "$INSTDIR\log\1612_count.txt" 141 ;delete previous log 142 ;Delete "$LogFile" 143 ExecWait 'msiexec /quiet /norestart /log "$LogFile" /i "$INSTDIR\BeidMW_64.msi"' $MsiResponse 144 ;for testing 145 ;StrCpy $MsiResponse 1603 146 ;StrCpy $TestLogFile "$INSTDIR\log\install_eidmw64_error_1612_log.txt" 147 ${Switch} $MsiResponse 148 ${Case} 1603 149 ;general failure, parse through the log file to find the root cause 150 ;check if error 1612 occured 151 ;for testing 152 ;ExecWait 'cmd.exe /C FIND "1612" "$TestLogFile" | FIND /C "error code 1612" > "$TempFile"' $retval 153 ExecWait 'cmd.exe /C FIND "1612" "$LogFile" | FIND /C "error code 1612" > "$TempFile"' $retval 154 !insertmacro GetFirstLineOfFile $TempFile $firstLine 155 DetailPrint "MSI error 1612, count = $firstLine" 156 StrCmp "$firstLine" "" +2 0 157 StrCmp "$firstLine" "0" 0 MSI_1612_Error_64 158 ${Break} 159 ${Case} 1612 160 MSI_1612_Error_64: 161 DetailPrint "$(ls_errorinstallmsi_1612) $\r$\n $(ls_error) = $MsiResponse" 162 ;Refer to the FAQ where the user can find a manuel to manually repair the registry, or to run a MS tool that does the cleanup 163 StrCpy $FAQ_url "$(ls_errorinstallmsi_1612_FAQurl)" 164 ;The installation source for this product is not available. Verify that the source exists and that you can access it. 165 ;often caused by registry not cleaned when cleanup tools remove previously installed msi files 166 ${Break} 167 ${Case} 1622 168 ;install log failure, try to install without logging 169 ExecWait 'msiexec /quiet /norestart /i "$INSTDIR\BeidMW_64.msi"' $MsiResponse 170 ${Break} 171 ${Default} 172 DetailPrint "MsiResponse = $MsiResponse" 173 ${Break} 174 ${EndSwitch} 175 ;IfErrors 0 +2 176 ; Call ErrorHandler_msiexec 177 178 ;WriteRegDWORD HKCU "Software\BEID\Installer\Components" "BeidCrypto64" 0x1 179 Delete "$INSTDIR\BeidMW_64.msi" 180 ${Else} 181 ClearErrors 182 StrCpy $FileToCopy "$INSTDIR\BeidMW_32.msi" 183 File "..\eid-mw\Windows\bin\BeidMW_32.msi" 184 IfErrors 0 +2 185 Call ErrorHandler_file 186 ClearErrors 187 ;delete previous log 188 StrCpy $LogFile "$INSTDIR\log\install_eidmw32_log.txt" 189 ;Delete "$LogFile" 190 ExecWait 'msiexec /quiet /norestart /log "$LogFile" /i "$INSTDIR\BeidMW_32.msi"' $MsiResponse 191 192 ;try to recover from some errors 193 ${Switch} $MsiResponse 194 ${Case} 1603 195 ;general failure, parse through the log file to find the root cause 196 ;check if error 1612 occured 197 ExecWait 'cmd.exe /C FIND "1612" "$LogFile" | FIND /C "error code 1612" > "$TempFile"' $retval 198 !insertmacro GetFirstLineOfFile $TempFile $firstLine 199 DetailPrint "MSI error 1612, count = $firstLine" 200 StrCmp "$firstLine" "" +2 0 201 StrCmp "$firstLine" "0" 0 MSI_1612_Error_32 202 ${Break} 203 ${Case} 1612 204 MSI_1612_Error_32: 205 DetailPrint "$(ls_errorinstallmsi_1612) $\r$\n $(ls_error) = $MsiResponse" 206 ;Refer to the FAQ where the user can find a manuel to manually repair the registry, or to run a MS tool that does the cleanup 207 StrCpy $FAQ_url "$(ls_errorinstallmsi_1612_FAQurl)" 208 ;The installation source for this product is not available. Verify that the source exists and that you can access it. 209 ;often caused by registry not cleaned when cleanup tools remove previously installed msi files 210 ${Break} 211 ${Case} 1622 212 ;install log failure, try to install without logging 213 ExecWait 'msiexec /quiet /norestart /i "$INSTDIR\BeidMW_32.msi"' $MsiResponse 214 ${Break} 215 ${Default} 216 DetailPrint "MsiResponse = $MsiResponse" 217 ${Break} 218 ${EndSwitch} 219 ;IfErrors 0 +2 220 ; Call ErrorHandler_msiexec 221 ;WriteRegDWORD HKCU "Software\BEID\Installer\Components" "BeidCrypto32" 0x1 222 Delete "$INSTDIR\BeidMW_32.msi" 223 ${EndIf} 224 225 ;check if msi install went ok (initially or after correction) 226 ${Switch} $MsiResponse 227 ${Case} 0 228 ${Case} 3010 229 StrCpy $InstallFailed 0 230 ;3010 is 'success, but reboot requiered' 231 ${Break} 232 ${Case} 1618 233 ;the installer is already running in another instance 234 MessageBox MB_OK "$(ls_errorinstallmsi_1618) $\r$\n $(ls_error) = $MsiResponse" 235 StrCpy $InstallFailed $MsiResponse 236 ${Break} 237 ${Default} 238 StrCpy $InstallFailed $MsiResponse 239 ;Call ErrorHandler_msiexec 240 ${EndSwitch} 241 242 File /r "Drivers" 243 244${DisableX64FSRedirection} 245 246 ${If} $versionMajor == 6 247 ${AndIf} $versionMinor == 0 248 ;vista 249 nsExec::ExecToLog '"$SYSDIR\PnPutil.exe" /a "$INSTDIR\Drivers\XP-WIN8\ACR38U\a38usb.inf"' 250 nsExec::ExecToLog '"$SYSDIR\PnPutil.exe" /a "$INSTDIR\Drivers\XP-WIN7\OmniKey3121\cxbu0wdm.inf"' 251 nsExec::ExecToLog '"$SYSDIR\PnPutil.exe" /a "$INSTDIR\Drivers\XP-WIN7\SCR331\scr3xx.inf"' 252 nsExec::ExecToLog '"$SYSDIR\PnPutil.exe" /a "$INSTDIR\Drivers\XP-WIN7\VascoDP509\usbccid.inf"' 253 nsExec::ExecToLog '"$SYSDIR\PnPutil.exe" /a "$INSTDIR\Drivers\XP-WIN7\SPR532\Spr332.inf"' 254 ${EndIf} 255 256 ${If} $versionMajor == 6 257 ${AndIf} $versionMinor == 1 258 ;windows 7 259 nsExec::ExecToLog '"$SYSDIR\PnPutil.exe" /a "$INSTDIR\Drivers\XP-WIN8\ACR38U\a38usb.inf"' 260 nsExec::ExecToLog '"$SYSDIR\PnPutil.exe" /a "$INSTDIR\Drivers\XP-WIN7\OmniKey3121\cxbu0wdm.inf"' 261 nsExec::ExecToLog '"$SYSDIR\PnPutil.exe" /a "$INSTDIR\Drivers\XP-WIN7\SCR331\scr3xx.inf"' 262 nsExec::ExecToLog '"$SYSDIR\PnPutil.exe" /a "$INSTDIR\Drivers\XP-WIN7\VascoDP509\usbccid.inf"' 263 nsExec::ExecToLog '"$SYSDIR\PnPutil.exe" /a "$INSTDIR\Drivers\XP-WIN7\SPR532\Spr332.inf"' 264 nsExec::ExecToLog '"$SYSDIR\Robocopy.exe" "$INSTDIR\Drivers\XP-WIN8\beidmdrv" "$INSTDIR\Drivers\WINALL\beidmdrv" beidmdrv.cat' 265 ${EndIf} 266 267 ${If} $versionMajor == 6 268 ${AndIf} $versionMinor == 2 269 ;windows 8 270 nsExec::ExecToLog '"$SYSDIR\Robocopy.exe" "$INSTDIR\Drivers\XP-WIN8\beidmdrv" "$INSTDIR\Drivers\WINALL\beidmdrv" beidmdrv.cat' 271 nsExec::ExecToLog '"$SYSDIR\PnPutil.exe" /a "$INSTDIR\Drivers\XP-WIN8\ACR38U\a38usb.inf"' 272 ${EndIf} 273 274 ${If} $versionMajor == 6 275 ${AndIf} $versionMinor == 3 276 ;windows 8.1 277 nsExec::ExecToLog '"$SYSDIR\Robocopy.exe" "$INSTDIR\Drivers\XP-WIN8\beidmdrv" "$INSTDIR\Drivers\WINALL\beidmdrv" beidmdrv.cat' 278 nsExec::ExecToLog '"$SYSDIR\PnPutil.exe" /a "$INSTDIR\Drivers\XP-WIN8\ACR38U\a38usb.inf"' 279 ${EndIf} 280 ;driver to install on all OS's 281 282 nsExec::ExecToLog '"$SYSDIR\PnPutil.exe" /a "$INSTDIR\Drivers\WINALL\APG8201Z\apg8201z.inf"' 283 284 ;install the eid minidriver 285 nsExec::ExecToLog '"$SYSDIR\PnPutil.exe" /a "$INSTDIR\Drivers\WINALL\beidmdrv\beidmdrv.inf"' 286 287${EnableX64FSRedirection} 288 289 RMDir /r /REBOOTOK $INSTDIR\Drivers 290 291SectionEnd 292 293 294Function ErrorHandler_file 295IfSilent +2 0 296 MessageBox MB_ICONSTOP "$(ls_errorcopyfile) $FileToCopy" 297 Abort 298FunctionEnd 299 300 301;-------------------------------- 302;Installer Functions 303 304Function .onInit 305;images used by this installer 306InitPluginsDir 307;extract the bitmaps to the temporary pluginsdir (which will be auto removed after installation) 308File /oname=$PLUGINSDIR\"welcome.bmp" "welcome.bmp" 309File /oname=$PLUGINSDIR\"done.bmp" "done.bmp" 310File /oname=$PLUGINSDIR\"insert_card.bmp" "insert_card.bmp" 311File /oname=$PLUGINSDIR\"connect_reader.bmp" "connect_reader.bmp" 312File /oname=$PLUGINSDIR\"Failed.bmp" "failed.bmp" 313File /oname=$PLUGINSDIR\"White.bmp" "white.bmp" 314;File /oname=$PLUGINSDIR\"bannrbmp.bmp" "bannrbmp.bmp" 315 316;for testing different languages 317 ;Push ${LANG_GERMAN} 318 ;Pop $LANGUAGE 319 ;Language selection dialog 320 321; Push ${LANG_ENGLISH} 322; Pop $LANGUAGE 323; Push ${LANG_DUTCH} 324; Pop $LANGUAGE 325; Push ${LANG_FRENCH} 326; Pop $LANGUAGE 327; Push ${LANG_GERMAN} 328; Pop $LANGUAGE 329 330; Push A ; A means auto count languages 331 ; for the auto count to work the first empty push (Push "") must remain 332; LangDLL::LangDialog "Installer Language" "Please select the language of the installer" 333 334; Pop $LANGUAGE 335; StrCmp $LANGUAGE "cancel" 0 +2 336; Abort 337 338 339FunctionEnd 340 341Function .onInstSuccess 342FunctionEnd 343 344Function nsdWelcome 345 ;File "welcome.bmp" 346 ;skip the windows when silent 347 IfSilent 0 +2 348 Abort 349 350 nsDialogs::Create 1018 351 Pop $nsdCustomDialog ;popped from the stack to prevent stack corruption 352 ${If} $nsdCustomDialog == error 353 Abort 354 ${EndIf} 355 356 Call InstShow 357 358 ${NSD_CreateLabel} 0 25% 100% 16u "$(ls_welcome_short)" 359 Pop $Label 360 SetCtlColors $Label 0x008080 transparent 361 ${NSD_AddStyle} $Label ${SS_CENTER} ;center the text 362 CreateFont $Font_Title "Arial" "18" "700" ;/UNDERLINE 363 SendMessage $Label ${WM_SETFont} $Font_Title 1 364 365 ${NSD_CreateLabel} 0 45% 100% 12u "$(ls_welcome_info)" 366 Pop $Label 367 ${NSD_AddStyle} $Label ${SS_CENTER} ;center the text 368 CreateFont $Font_Info "Arial" "9" "500" ;/UNDERLINE 369 SendMessage $Label ${WM_SETFont} $Font_Info 1 370 SetCtlColors $Label 0x000000 transparent 371 372 ${NSD_CreateBitmap} 0 0 266u 124u "" 373 Pop $Background_Image 374 ${NSD_SetStretchedImage} $Background_Image "$PLUGINSDIR\welcome.bmp" $Background_Image_Handle 375 SetCtlColors $Background_Image 0xFFFFFF transparent 376 377 GetDlgItem $Button $HWNDPARENT 1 ; next=1, cancel=2, back=3 378 SendMessage $Button ${WM_SETTEXT} 0 "STR:$(ls_install)" 379 ; hide the Back button 380 ${buttonVisible} "Back" 0 381 382 nsDialogs::Show 383 ${NSD_FreeImage} $Background_Image_Handle 384 385FunctionEnd 386 387Function nsdWelcomeLeave 388FunctionEnd 389 390Function RelGotoPage 391 IntCmp $R9 0 0 Move Move 392 StrCmp $R9 "X" 0 Move 393 StrCpy $R9 "120" 394 395 Move: 396 SendMessage $HWNDPARENT "0x408" "$R9" "" 397FunctionEnd 398 399Function GotoNextPage 400 StrCpy $R9 "1" 401 Call RelGotoPage 402FunctionEnd 403 404Function GotoPrevPage 405 StrCpy $R9 "-1" 406 Call RelGotoPage 407FunctionEnd 408 409Function show_instfiles 410 GetDlgItem $Button $HWNDPARENT 1 ; next=1, cancel=2, back=3 411 SendMessage $Button ${WM_SETTEXT} 0 "STR:$(ls_next)" 412 GetDlgItem $Button $HWNDPARENT 2 ; next=1, cancel=2, back=3 413 SendMessage $Button ${WM_SETTEXT} 0 "STR:$(ls_cancel)" 414 415 Call InstShow 416 ${buttonVisible} "Back" 0 417FunctionEnd 418 419 420Function nsdInstallCheck 421 422 423 ${If} $InstallFailed == 0 424 ;MessageBox MB_OK "Install ok, skipping error" 425 Abort 426 ${EndIf} 427 428 429 ;abort the installer when silent and error occured 430 IfSilent 0 +3 431 SetErrorLevel 3 432 Quit 433 434 nsDialogs::Create 1018 435 Pop $nsdCustomDialog 436 ${If} $nsdCustomDialog == error 437 Abort 438 ${EndIf} 439 440 Call InstShow 441 442 ${NSD_CreateLabel} 0 40% 100% 20u "$(ls_install_failed)" 443 Pop $Label 444 SetCtlColors $Label 0x008080 transparent 445 ${NSD_AddStyle} $Label ${SS_CENTER} ;center the text 446 CreateFont $Font_Title "Arial" "18" "700" ;/UNDERLINE 447 SendMessage $Label ${WM_SETFont} $Font_Title 1 448 449 ${NSD_CreateLabel} 0 60% 100% 16u "$(ls_error) $InstallFailed" 450 Pop $Label 451 ${NSD_AddStyle} $Label ${SS_CENTER} ;center the text 452 CreateFont $Font_Info "Arial" "9" "500" ;/UNDERLINE 453 SendMessage $Label ${WM_SETFont} $Font_Info 1 454 SetCtlColors $Label 0x008080 transparent 455 456 ${NSD_CreateLabel} 0 70% 100% 36u "$(ls_install_failed_info)" 457 Pop $Label 458 ${NSD_AddStyle} $Label ${SS_CENTER} ;center the text 459 CreateFont $Font_Info "Arial" "9" "500" ;/UNDERLINE 460 SendMessage $Label ${WM_SETFont} $Font_Info 1 461 SetCtlColors $Label 0x000000 transparent 462 463 ${NSD_CreateBitmap} 0 0 266u 124u "" 464 Pop $Background_Image 465 ${NSD_SetStretchedImage} $Background_Image "$PLUGINSDIR\Failed.bmp" $Background_Image_Handle 466 467 ;first page after install page doesn't get its inner dialog color correct (not even when refreshed), 468 ;so we add a white background 469;${NSD_CreateBitmap} 0 0 266u 124u "" 470; Pop $Background_Image2 471 ; ${NSD_SetStretchedImage} $Background_Image2 "$PLUGINSDIR\White.bmp" $Background_Image_Handle2 472 473 ;GetDlgItem $NextButton $nsdDoneDialog 1 ; next=1, cancel=2, back=3 474 GetDlgItem $Button $HWNDPARENT 1 ; next=1, cancel=2, back=3 475 SendMessage $Button ${WM_SETTEXT} 0 "STR:$(ls_helpsite)" 476 GetDlgItem $Button $HWNDPARENT 2 ; next=1, cancel=2, back=3 477 SendMessage $Button ${WM_SETTEXT} 0 "STR:$(ls_finish)" 478 479 ${buttonVisible} "Back" 0 480 ${buttonVisible} "Next" 1 481 ${buttonVisible} "Cancel" 1 482 483 nsDialogs::Show 484 ${NSD_FreeImage} $Background_Image_Handle 485 486FunctionEnd 487 488Function nsdInstallCheckLeave 489 call FindSolutionButton_click 490FunctionEnd 491 492Function nsdDone 493 494 ;skip the window when silent 495 IfSilent 0 +2 496 Abort 497 498 nsDialogs::Create 1018 499 Pop $nsdCustomDialog 500 ${If} $nsdCustomDialog == error 501 Abort 502 ${EndIf} 503 504 Call InstShow 505 506;FindWindow $0 "#32770" "" $HWNDPARENT ; get the inner dialog 507;SetCtlColors $0 0 0 508;; ShowWindow $0 ${SW_HIDE} 509; ShowWindow $0 ${SW_SHOW} 510 511 512 513 ${NSD_CreateLabel} 0 40% 100% 18u "$(ls_complete)" 514 Pop $Label 515 SetCtlColors $Label 0x008080 transparent 516 ${NSD_AddStyle} $Label ${SS_CENTER} ;center the text 517 CreateFont $Font_Title "Arial" "18" "700" ;/UNDERLINE 518 SendMessage $Label ${WM_SETFont} $Font_Title 1 519 520 ${NSD_CreateLabel} 0 60% 100% 36u "$(ls_complete_info)" 521 Pop $Label 522 ${NSD_AddStyle} $Label ${SS_CENTER} ;center the text 523 CreateFont $Font_Info "Arial" "9" "500" ;/UNDERLINE 524 SendMessage $Label ${WM_SETFont} $Font_Info 1 525 SetCtlColors $Label 0x000000 transparent 526 527 ${NSD_CreateBitmap} 0 0 266u 124u "" 528 Pop $Background_Image 529 ${NSD_SetStretchedImage} $Background_Image "$PLUGINSDIR\Done.bmp" $Background_Image_Handle 530 531 ;first page after install page doesn't get its inner dialog color correct (not even when refreshed), 532 ;so we add a white background 533 ${NSD_CreateBitmap} 0 124u 266u 130u "" 534 Pop $Background_Image2 535 ${NSD_SetStretchedImage} $Background_Image2 "$PLUGINSDIR\White.bmp" $Background_Image_Handle2 536 537 ;GetDlgItem $NextButton $nsdDoneDialog 1 ; next=1, cancel=2, back=3 538 GetDlgItem $Button $HWNDPARENT 1 ; next=1, cancel=2, back=3 539 SendMessage $Button ${WM_SETTEXT} 0 "STR:$(ls_test)" 540 GetDlgItem $Button $HWNDPARENT 2 ; next=1, cancel=2, back=3 541 SendMessage $Button ${WM_SETTEXT} 0 "STR:$(ls_finish)" 542 ;EnableWindow $NextButton 1 ;enable the previous button 543 ;SetCtlColors $NextButton 0xFF0000 0x00FF00 544 545 ${buttonVisible} "Back" 0 546 ${buttonVisible} "Next" 1 547 ${buttonVisible} "Cancel" 1 548 549 ;GetDlgItem $0 $HWNDPARENT 1 ;move the next button 550 ;System::Call 'user32::MoveWindow(i $0, i 100, i 50, i 200, i 30, i 1)' 551 552 nsDialogs::Show 553 554 ${NSD_FreeImage} $Background_Image_Handle 555 ${NSD_FreeImage} $Background_Image_Handle2 556 557FunctionEnd 558 559Function nsdDoneLeave 560FunctionEnd 561 562Function nsdConnectReader 563 ;skip the window when silent 564 IfSilent 0 +2 565 Abort 566 567 ;File "connect_reader.bmp" 568 nsDialogs::Create 1018 569 Pop $nsdCustomDialog 570 571 ${If} $nsdCustomDialog == error 572 Abort 573 ${EndIf} 574 575 Call InstShow 576 577 ${NSD_CreateLabel} 0 -40u 100% 40u "$(ls_pleaseconnect)" 578 Pop $Label 579 SetCtlColors $Label 0x008080 transparent 580 ${NSD_AddStyle} $Label ${SS_CENTER} ;center the text 581 CreateFont $Font_Title "Arial" "14" "700" ;/UNDERLINE 582 SendMessage $Label ${WM_SETFont} $Font_Title 1 583 584 585 ${NSD_CreateBitmap} 0 0 266u 124u "" 586 Pop $Background_Image 587 ${NSD_SetStretchedImage} $Background_Image "$PLUGINSDIR\connect_reader.bmp" $Background_Image_Handle 588 589 ${buttonVisible} "Back" 0 590 ${buttonVisible} "Next" 1 591 ${buttonVisible} "Cancel" 1 592 593 nsDialogs::Show 594 ${NSD_FreeImage} $Background_Image_Handle 595FunctionEnd 596 597Function nsdConnectReaderLeave 598 ;skip the window when silent 599 IfSilent 0 +2 600 Abort 601 602 beid::GetReaderCount 0 603 Pop $retval 604 605 ${If} $retval <> '0' 606 StrCpy $ReaderFailed $retval 607 ;MessageBox MB_OK "$(ls_errorreadersearch) $\r$\n $(ls_error) = $retval" 608 ;Abort 609 ${EndIf} 610 Pop $readercount 611 ${If} $readercount > 0 612 StrCpy $ReaderFailed 0 613 ;MessageBox MB_OK "$$readercount is $readercount" 614 ${Else} 615 ;MessageBox MB_OK "$(ls_noreaderfound)" 616 StrCpy $ReaderFailed "$(ls_noreaderfound)" 617 ;Abort 618 ${EndIf} 619FunctionEnd 620 621Function nsdReaderCheck 622 ;skip the window when silent 623 IfSilent 0 +2 624 Abort 625 626 ${If} $ReaderFailed == 0 627 ;MessageBox MB_OK "Reader found, skipping reader error" 628 Abort 629 ${EndIf} 630 nsDialogs::Create 1018 631 Pop $nsdCustomDialog 632 ${If} $nsdCustomDialog == error 633 MessageBox MB_OK "nsdCustomDialog error" 634 Abort 635 ${EndIf} 636 637 Call InstShow 638 639 ${NSD_CreateLabel} 0 40% 100% 20u "$(ls_cardreader_failed)" 640 Pop $Label 641 SetCtlColors $Label 0x008080 transparent 642 ${NSD_AddStyle} $Label ${SS_CENTER} ;center the text 643 CreateFont $Font_Title "Arial" "18" "700" ;/UNDERLINE 644 SendMessage $Label ${WM_SETFont} $Font_Title 1 645 646 ${NSD_CreateLabel} 0 60% 100% 16u "$(ls_error) $ReaderFailed" 647 Pop $Label 648 ${NSD_AddStyle} $Label ${SS_CENTER} ;center the text 649 CreateFont $Font_Info "Arial" "9" "500" ;/UNDERLINE 650 SendMessage $Label ${WM_SETFont} $Font_Info 1 651 SetCtlColors $Label 0x008080 transparent 652 653 ${NSD_CreateLabel} 0 70% 100% 36u "$(ls_cardreader_failed_info)" 654 Pop $Label 655 ${NSD_AddStyle} $Label ${SS_CENTER} ;center the text 656 CreateFont $Font_Info "Arial" "9" "500" ;/UNDERLINE 657 SendMessage $Label ${WM_SETFont} $Font_Info 1 658 SetCtlColors $Label 0x000000 transparent 659 660 ${NSD_CreateBitmap} 0 0 266u 124u "" 661 Pop $Background_Image 662 ${NSD_SetStretchedImage} $Background_Image "$PLUGINSDIR\Failed.bmp" $Background_Image_Handle 663 664 ;GetDlgItem $NextButton $nsdDoneDialog 1 ; next=1, cancel=2, back=3 665 GetDlgItem $Button $HWNDPARENT 1 ; next=1, cancel=2, back=3 666 SendMessage $Button ${WM_SETTEXT} 0 "STR:$(ls_helpsite)" 667 GetDlgItem $Button $HWNDPARENT 2 ; next=1, cancel=2, back=3 668 SendMessage $Button ${WM_SETTEXT} 0 "STR:$(ls_finish)" 669 GetDlgItem $Button $HWNDPARENT 3 ; next=1, cancel=2, back=3 670 SendMessage $Button ${WM_SETTEXT} 0 "STR:$(ls_retry)" 671 672 ${buttonVisible} "Back" 1 673 ${buttonVisible} "Next" 1 674 ${buttonVisible} "Cancel" 1 675 676 nsDialogs::Show 677 ${NSD_FreeImage} $Background_Image_Handle 678 679FunctionEnd 680 681Function nsdReaderCheckLeave 682 ;skip the window when silent 683 IfSilent 0 +2 684 Abort 685 686 call FindSolutionButton_click 687FunctionEnd 688 689 690Function nsdInsertCard 691 ;skip the window when silent 692 IfSilent 0 +2 693 Abort 694 695 ;File "insert_card.bmp" 696 nsDialogs::Create 1018 697 Pop $nsdCustomDialog 698 ${If} $nsdCustomDialog == error 699 Abort 700 ${EndIf} 701 702 Call InstShow 703 ${NSD_CreateLabel} 0 -40u 100% 40u "$(ls_pleaseinsertcard)" 704 Pop $Label 705 SetCtlColors $Label 0x008080 transparent 706 ${NSD_AddStyle} $Label ${SS_CENTER} ;center the text 707 CreateFont $Font_Title "Arial" "14" "700" ;/UNDERLINE 708 SendMessage $Label ${WM_SETFont} $Font_Title 1 709 710 711 ${NSD_CreateBitmap} 0 0 100% 100% "$(ls_bitmapinsertcard)" 712 Pop $Background_Image 713 ${NSD_SetStretchedImage} $Background_Image "$PLUGINSDIR\insert_card.bmp" $Background_Image_Handle 714 715 ${buttonVisible} "Back" 1 716 ${buttonVisible} "Next" 1 717 ${buttonVisible} "Cancel" 1 718 719 nsDialogs::Show 720 ${NSD_FreeImage} $Background_Image_Handle 721FunctionEnd 722 723Function nsdInsertCardLeave 724 ;skip the window when silent 725 IfSilent 0 +2 726 Abort 727 728 ;GetReaderCount 1 in order to get the readers with an eID card inserted 729 beid::GetReaderCount 1 730 Pop $retval 731 732 ;the instruction below is just for testing 733 ;StrCpy $retval 004180 734 735 ${If} $retval <> '0' 736 StrCpy $FindCardFailed $retval 737 ;MessageBox MB_OK "$(ls_errorreadingcard)" 738 ;Abort 739 ${EndIf} 740 Pop $readercount 741 ${If} $readercount > '0' 742 StrCpy $FindCardFailed '0' 743 ;MessageBox MB_OK "number of beidcards found is $readercount" 744 ${Else} 745 StrCpy $FindCardFailed "$(ls_nocardfound)" 746 ;MessageBox MB_OK "$(ls_nocardfound)" 747 ;Abort 748 ${EndIf} 749FunctionEnd 750 751Function nsdCardCheck 752 ;skip the window when silent 753 IfSilent 0 +2 754 Abort 755 756 ${If} $FindCardFailed == '0' 757 ;MessageBox MB_OK "Card found, skipping card error" 758 Abort 759 ${EndIf} 760 nsDialogs::Create 1018 761 Pop $nsdCustomDialog 762 ${If} $nsdCustomDialog == error 763 Abort 764 ${EndIf} 765 766 Call InstShow 767 768 ${NSD_CreateLabel} 0 40% 100% 20u "$(ls_test_failed)" 769 Pop $Label 770 SetCtlColors $Label 0x008080 transparent 771 ${NSD_AddStyle} $Label ${SS_CENTER} ;center the text 772 CreateFont $Font_Title "Arial" "18" "700" ;/UNDERLINE 773 SendMessage $Label ${WM_SETFont} $Font_Title 1 774 775 ${NSD_CreateLabel} 0 60% 100% 16u "$(ls_error) $FindCardFailed" 776 Pop $Label 777 ${NSD_AddStyle} $Label ${SS_CENTER} ;center the text 778 CreateFont $Font_Info "Arial" "9" "500" ;/UNDERLINE 779 SendMessage $Label ${WM_SETFont} $Font_Info 1 780 SetCtlColors $Label 0x008080 transparent 781 782 ${NSD_CreateLabel} 0 70% 100% 36u "$(ls_test_failed_info)" 783 Pop $Label 784 ${NSD_AddStyle} $Label ${SS_CENTER} ;center the text 785 CreateFont $Font_Info "Arial" "9" "500" ;/UNDERLINE 786 SendMessage $Label ${WM_SETFont} $Font_Info 1 787 SetCtlColors $Label 0x000000 transparent 788 789 ${NSD_CreateBitmap} 0 0 266u 124u "" 790 Pop $Background_Image 791 ${NSD_SetStretchedImage} $Background_Image "$PLUGINSDIR\Failed.bmp" $Background_Image_Handle 792 793 ;GetDlgItem $NextButton $nsdDoneDialog 1 ; next=1, cancel=2, back=3 794 GetDlgItem $Button $HWNDPARENT 1 ; next=1, cancel=2, back=3 795 SendMessage $Button ${WM_SETTEXT} 0 "STR:$(ls_helpsite)" 796 GetDlgItem $Button $HWNDPARENT 2 ; next=1, cancel=2, back=3 797 SendMessage $Button ${WM_SETTEXT} 0 "STR:$(ls_finish)" 798 799 ${buttonVisible} "Back" 1 800 ${buttonVisible} "Next" 1 801 ${buttonVisible} "Cancel" 1 802 803 nsDialogs::Show 804 ${NSD_FreeImage} $Background_Image_Handle 805 806FunctionEnd 807 808Function nsdCardCheckLeave 809 ;skip the window when silent 810 IfSilent 0 +2 811 Abort 812 813 call FindSolutionButton_click 814FunctionEnd 815 816 817Function nsdCardData 818 ;skip the window when silent 819 IfSilent 0 +2 820 Abort 821 822 nsDialogs::Create 1018 823 Pop $nsdCustomDialog 824 ${If} $nsdCustomDialog == error 825 Abort 826 ${EndIf} 827 828 Call InstShow 829 830 beid::ReadCardData 831 Pop $retval 832 833 ;for testing 834 ;StrCpy $retval 004180 835 836 ${If} $retval == '0' 837 838 Pop $lastname 839 Pop $firstletterthirdname 840 Pop $firstname 841 842 ;all went well, show a succes message on this final page 843 ${NSD_CreateLabel} 0 40% 100% 36u "$(ls_testcomplete_pre) $firstname $(ls_testcomplete_post)" 844 Pop $Label 845 SetCtlColors $Label 0x008080 transparent 846 ${NSD_AddStyle} $Label ${SS_CENTER} ;center the text 847 CreateFont $Font_Title "Arial" "18" "700" ;/UNDERLINE 848 SendMessage $Label ${WM_SETFont} $Font_Title 1 849 850 ${NSD_CreateLabel} 0 80% 100% 36u "$(ls_testcomplete_info)" 851 Pop $Label 852 ${NSD_AddStyle} $Label ${SS_CENTER} ;center the text 853 CreateFont $Font_Info "Arial" "9" "700" ;/UNDERLINE 854 SendMessage $Label ${WM_SETFont} $Font_Info 1 855 SetCtlColors $Label 0x000000 transparent 856 857 ${NSD_CreateBitmap} 0 0 266u 124u "" 858 Pop $Background_Image 859 ${NSD_SetStretchedImage} $Background_Image "$PLUGINSDIR\Done.bmp" $Background_Image_Handle 860 861 GetDlgItem $Button $HWNDPARENT 1 ; next=1, cancel=2, back=3 862 SendMessage $Button ${WM_SETTEXT} 0 "STR:$(ls_close)" 863 GetDlgItem $Button $HWNDPARENT 2 ; next=1, cancel=2, back=3 864 SendMessage $Button ${WM_SETTEXT} 0 "STR:$(ls_finish)" 865 866 ${buttonVisible} "Back" 1 867 ${buttonVisible} "Next" 1 868 ${buttonVisible} "Cancel" 0 869 ${Else} 870 871 ${NSD_CreateLabel} 0 40% 100% 20u "$(ls_errorreadingcard)" 872 Pop $Label 873 SetCtlColors $Label 0x008080 transparent 874 ${NSD_AddStyle} $Label ${SS_CENTER} ;center the text 875 CreateFont $Font_Title "Arial" "18" "700" ;/UNDERLINE 876 SendMessage $Label ${WM_SETFont} $Font_Title 1 877 878 ${NSD_CreateLabel} 0 60% 100% 16u "$(ls_error) R$retval" 879 Pop $Label 880 ${NSD_AddStyle} $Label ${SS_CENTER} ;center the text 881 CreateFont $Font_Info "Arial" "9" "500" ;/UNDERLINE 882 SendMessage $Label ${WM_SETFont} $Font_Info 1 883 SetCtlColors $Label 0x008080 transparent 884 885 ${NSD_CreateLabel} 0 70% 100% 36u "$(ls_test_failed_info)" 886 Pop $Label 887 ${NSD_AddStyle} $Label ${SS_CENTER} ;center the text 888 CreateFont $Font_Info "Arial" "9" "500" ;/UNDERLINE 889 SendMessage $Label ${WM_SETFont} $Font_Info 1 890 SetCtlColors $Label 0x000000 transparent 891 892 ${NSD_CreateBitmap} 0 0 266u 124u "" 893 Pop $Background_Image 894 ${NSD_SetStretchedImage} $Background_Image "$PLUGINSDIR\Failed.bmp" $Background_Image_Handle 895 896 ;GetDlgItem $NextButton $nsdDoneDialog 1 ; next=1, cancel=2, back=3 897 GetDlgItem $Button $HWNDPARENT 1 ; next=1, cancel=2, back=3 898 SendMessage $Button ${WM_SETTEXT} 0 "STR:$(ls_helpsite)" 899 GetDlgItem $Button $HWNDPARENT 2 ; next=1, cancel=2, back=3 900 SendMessage $Button ${WM_SETTEXT} 0 "STR:$(ls_finish)" 901 902 ;enable the cancel(finish) button 903 GetDlgItem $1 $HWNDPARENT 2 904 EnableWindow $1 1 905 906 ${buttonVisible} "Back" 1 907 ${buttonVisible} "Next" 1 908 ${buttonVisible} "Cancel" 1 909 910 ${EndIf} 911 912 nsDialogs::Show 913 ${NSD_FreeImage} $Background_Image_Handle 914FunctionEnd 915 916Function nsdCardDataLeave 917 ;skip the window when silent 918 IfSilent 0 +2 919 Abort 920 921 ${If} $retval <> '0' 922 call FindSolutionButton_click 923 ${EndIf} 924FunctionEnd 925 926Function FindSolutionButton_click 927 ExecShell "open" "$FAQ_url" 928 ;when keeping the nsis installer alive, it can permit the webbrowser to take the foreground. 929 ;should we quit in stead, the webbrowser will be openened in the background 930 Abort 931 ;Quit 932FunctionEnd 933 934Function RetryCardReader_click 935 Call GotoPrevPage 936FunctionEnd 937 938 939 940 941 942 943