Archive: NT 4 crash


NT 4 crash
Ok, I decided to continue working on the stuff from yesterday and decided to popup a message box if the uninstaller can't be run. So I added that in today, but now there's a new problem. Randomly, there will be a memory read error before the message box appears.

Perhaps there's a problem with the speed since the computer is slow and it's trying the ShellExec and Exec at about the same time and that's causing the crash? I'll put a sleep delay in there and see what happens.

Here's the new code I'm using:

Function .onInit

strcpy $4 "PiCoMap"

ReadRegStr $9 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$4" "UninstallString"
strcmp $9 "" Clean PrevInst

Clean:
goto InitDone

PrevInst:

ReadRegStr $8 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$4" "DisplayName"
MessageBox MB_YESNO "$8 found$\nUninstall this version?" IDNO InitDone
ExecShell "open" "$9" SW_SHOWNORMAL

IfErrors InstErr InitDone
InstErr:
Call FailedUninst

InitDone:
FunctionEnd

Function FailedUninst
ReadRegStr $9 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$4" "UninstallString"
ClearErrors
Exec "$9"
IfErrors DisplayMsgBox Fin

DisplayMsgBox:
MessageBox MB_YESNO|MB_ICONSTOP "Uninstaller failed to load, please uninstall before continuing$\n$\n Abort installation?" IDNO Fin
Abort
Fin:
FunctionEnd


Ok, I added in the sleep and the problem seems to have gone away...


Ok, the problem isn't fixed, I got that same read memory error crash once again. So maybe it's not a problem of running ExecShell and Exec on the same program at roughly the same time.


Try offering it for download here so that we see what the problem is. If you Zip it up and add the NSI source (not in the installer) then we here at the forums will help you. I think that NSIS wasn't built for Win3.1, WinNT 4, and (I believe) Win95. This might account for the problem.

-DJ


Go to www.palmgear.com and search for apps by Hi-CE Development. Actually, it's only the in the new ones we uploaded yesterday. So PiCoMap 1.71 and WriteHere 1.4.0 will have this problem. I added in a test, but it does crash on occasion. As for the source, I tried uploading, but the unix convertion wasn't nice, and it didn't work uploading, so I'll just paste it all in here.

; Generated NSIS script file (generated by makensitemplate.phtml 0.20)
; by 141.213.34.248 on Jun 12 01 @ 18:31

; NOTE: this .NSI script is designed for NSIS v1.3+

Name "WriteHere 1.4.0"
OutFile "WriteHere_Installer140.exe"

; Some default compiler settings (uncomment and change at will):
; SetCompress auto ; (can be off or force)
; SetDatablockOptimize on ; (can be off)
; CRCCheck on ; (can be off)
; AutoCloseWindow false ; (can be true for the window go away automatically at end)
; ShowInstDetails hide ; (can be show to have them shown, or nevershow to disable)
; SetDateSave on ; (can be on to have files restored to their orginal date)

SetCompress auto ; (can be off or force)
SetDatablockOptimize on ; (can be off)
CRCCheck on ; (can be off)
AutoCloseWindow false ; (can be true for the window go away automatically at end)
SetDateSave on ; (can be on to have files restored to their orginal date)

InstType "Full"

InstallDir "$DESKTOP\Hi-CE\WriteHere"
InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Hi-CE\WriteHere" ""
DirShow show ; (make this hide to not let the user change it)
DirText "Preparing to install WriteHere"
Icon WriteHere.ico

ComponentText "Select Components to Install"
EnabledBitmap Check3.bmp
DisabledBitmap Gray3.bmp

LicenseText 'You must click "next" to agree to this license before installing.'
LicenseData "WriteHere Disclaimer.txt"

Section "WriteHere.prc (34 kb)"
;SectionIn 12345678 ; (uncomment and change this to add it to install types)
SetOutPath "$INSTDIR"
StrCpy $0 "false"
SectionEnd ; end of default section
SectionDivider ;

Section "Spellchecker Database (914 kb) [optional]"
SectionIn 1;
File "WriteHereSpellDB.pdb"
StrCpy $0 "true"
SectionEnd ; end of default section

Section "Conduit"
SectionIn 1;
StrCpy $7 "true"
SectionEnd ; end of default section

Section ""
strcpy $4 "WriteHere"

File "WriteHere.prc"
File "Readme.txt"
File "Goto_Hi-CE_Handhelds_web_site.url"
File "WriteHere_Quick_Start.pdf"
File "Getting_Started.pdf"

StrCpy $8 "erHw"

ReadRegStr $9 HKEY_CURRENT_USER "Software\U.S. Robotics\Pilot Desktop\Core" "Path"

strcmp $9 "" Bad Good

Bad:
Abort "Palm Desktop 3.x must be installed before $4 - Aborting Installation"

Good:

WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Hi-CE\$4" "" "$INSTDIR"
WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\$4" "DisplayName" "Hi-CE: $4 1.4.0 (remove only)"
WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\$4" "UninstallString" '"$INSTDIR\uninst.exe"'

strcmp $7 "true" HotSyncChk Complete

HotSyncChk:
FindWindow goto:HotSyncRunning "KittyHawk"
StrCpy $1 "false"
Goto PalmRegistry

HotSyncRunning:
ReadRegStr $6 HKEY_CURRENT_USER "Software\U.S. Robotics\Pilot Desktop\HotSync Manager" "DontAskExit"
StrCpy $1 "true"

strcmp $6 "" CloseHotSyncManager CloseDontAsk
CloseHotSyncManager:
WriteRegDword HKEY_CURRENT_USER "Software\U.S. Robotics\Pilot Desktop\HotSync Manager" "DontAskExit" 1
StrCpy $6 "true"

CloseDontAsk:
FindWindow closeinstant "KittyHawk"

PalmRegistry:
ReadRegStr $2 HKEY_LOCAL_MACHINE "SOFTWARE\Hi-CE\$4" "AppNum"
strcmp $2 "" NewInst RegChk
NewInst:
StrCpy $2 "3"

RegChk:
ReadRegStr $3 HKEY_CURRENT_USER "Software\U.S. Robotics\Pilot Desktop\Application$2" "Creator"
strcmp $3 "" BgnWrt

Strcmp $3 $8 DelConduit ChkDigits

DelConduit:
DeleteRegKey HKEY_CURRENT_USER "Software\U.S. Robotics\Pilot Desktop\Application$2"
Goto BgnWrt

ChkDigits:
Strcmp $2 "3" Set4 Set5
Set4:
StrCpy $2 "4"
Goto RegChk

Set5:
Strcmp $2 "4" Set5a Set6
Set5a:
StrCpy $2 "5"
Goto RegChk

Set6:
Strcmp $2 "5" Set6a Set7
Set6a:
StrCpy $2 "6"
Goto RegChk

Set7:
Strcmp $2 "6" Set7a Set8
Set7a:
StrCpy $2 "7"
Goto RegChk

Set8:
Strcmp $2 "7" Set8a Set9
Set8a:
StrCpy $2 "8"
Goto RegChk

Set9:
Strcmp $2 "8" Set9a Set10
Set9a:
StrCpy $2 "9"
Goto RegChk

Set10:
Strcmp $2 "9" Set10a Set11
Set10a:
StrCpy $2 "10"
Goto RegChk

Set11:
Strcmp $2 "10" Set11a Set12
Set11a:
StrCpy $2 "11"
Goto RegChk

Set12:
Strcmp $2 "11" Set12a Set13
Set12a:
StrCpy $2 "12"
Goto RegChk

Set13:
Strcmp $2 "12" Set13a Set14
Set13a:
StrCpy $2 "13"
Goto RegChk

Set14:
Strcmp $2 "13" Set14a Set15
Set14a:
StrCpy $2 "14"
Goto RegChk

Set15:
Strcmp $2 "14" Set15a Set16
Set15a:
StrCpy $2 "15"
Goto RegChk

Set16:
Strcmp $2 "15" Set16a Set17
Set16a:
StrCpy $2 "16"
Goto RegChk

Set17:
Strcmp $2 "16" Set17a Set18
Set17a:
StrCpy $2 "17"
Goto RegChk

Set18:
Strcmp $2 "17" Set18a Set19
Set18a:
StrCpy $2 "18"
Goto RegChk

Set19:
Strcmp $2 "18" Set19a Set20
Set19a:
StrCpy $2 "19"
Goto RegChk

Set20:
Strcmp $2 "19" Set20a Set21
Set20a:
StrCpy $2 "20"
Goto RegChk

Set21:
Strcmp $2 "20" Set21a Set22
Set21a:
StrCpy $2 "21"
Goto RegChk

Set22:
Strcmp $2 "21" Set22a Set23
Set22a:
StrCpy $2 "22"
Goto RegChk

Set23:
Strcmp $2 "22" Set23a Set24
Set23a:
StrCpy $2 "23"
Goto RegChk

Set24:
Strcmp $2 "23" Set24a Set25
Set24a:
StrCpy $2 "24"
Goto RegChk

Set25:
Strcmp $2 "25" SetFinal
SetFinal:
StrCpy $2 "63"
ReadRegStr $3 HKEY_CURRENT_USER "Software\U.S. Robotics\Pilot Desktop" "Application$2"
ifErrors RegAbort BgnWrt
RegAbort:
Abort "Too many conduits installed - Aborting installation"

BgnWrt:

WriteRegStr HKEY_CURRENT_USER "Software\U.S. Robotics\Pilot Desktop\Application$2" "Conduit" "$4.dll"
WriteRegStr HKEY_CURRENT_USER "Software\U.S. Robotics\Pilot Desktop\Application$2" "Remote0" "$4DB"
WriteRegDword HKEY_CURRENT_USER "Software\U.S. Robotics\Pilot Desktop\Application$2" "Creator" 0x77487265
WriteRegDword HKEY_CURRENT_USER "Software\U.S. Robotics\Pilot Desktop\Application$2" "Priority" 2
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Hi-CE\$4" "AppNum" $2

;StrCpy $4 $OUTDIR

SetOutPath $9

File "WriteHere.dll"

SetOutPath "$INSTDIR\Images"

File "Hi-CE_logo.jpeg"
File "leftArrow.gif"
File "rightArrow.gif"
File "upArrow.gif"
File "WriteHereLogo.gif"

SetOutPath "$INSTDIR\Data"

SetOutPath "$INSTDIR"

strcmp $1 "true" RestartHotSync
Goto Complete
RestartHotSync:

strcmp $6 "true" ResetKey JmpEnd
ResetKey:
WriteRegDword HKEY_CURRENT_USER "Software\U.S. Robotics\Pilot Desktop\HotSync Manager" "DontAskExit" 0

JmpEnd:

ClearErrors
ExecShell "open" "$9\HotSync.exe" SW_SHOWNORMAL
ifErrors HotSyncErr0 Complete

HotSyncErr0:
Call HotSyncFailedMsg

Complete:

MessageBox MB_YESNO|MB_ICONQUESTION|MB_TOPMOST \
"View README file?" \
IDNO SkipReadme

ExecShell "open" "$OUTDIR\Readme.txt" SW_SHOWNORMAL

SkipReadme:


MessageBox MB_YESNO|MB_ICONQUESTION \
"Would you like to view the Getting Started Page?$\n$\n(Requires Adobe Acrobat Reader)" \
IDNO SkipQSe

ExecShell "open" "$OUTDIR\Getting_Started.pdf" SW_SHOWNORMAL

SkipQSe:

MessageBox MB_YESNO|MB_ICONQUESTION \
"Would you like to view the Quick Start Guide?$\n$\n(Requires Adobe Acrobat Reader)" \
IDNO SkipQS

ExecShell "open" "$OUTDIR\$4_Quick_Start.pdf" SW_SHOWNORMAL

SkipQS:
HideWindow
strcmp $0 "true" Both One
One:

ClearErrors
Exec "$9\Instapp.exe $OUTDIR\$4.prc"
ifErrors InstAppErr0 Done

InstAppErr0:
Call InstAppFailedMsg

Goto Done

Both:

ClearErrors
Exec "$9\Instapp.exe $OUTDIR\$4.prc $OUTDIR\$4SpellDB.pdb"
ifErrors InstAppErr1 Done

InstAppErr1:
Call InstAppFailedMsg

Done:

SectionEnd ; end of default section

; begin uninstall settings/section
UninstallText "This will uninstall WriteHere 1.4.0 from your system"
UninstallExeName "uninst.exe"

Section Uninstall
; add delete commands to delete whatever files/registry keys/etc you installed here.

strcpy $4 "WriteHere"

ReadRegStr $9 HKEY_CURRENT_USER "Software\U.S. Robotics\Pilot Desktop\Core" "Path"
ReadRegStr $6 HKEY_CURRENT_USER "Software\U.S. Robotics\Pilot Desktop\HotSync Manager" "DontAskExit"

FindWindow goto:UnHotSyncRunning "KittyHawk"
StrCpy $1 "false"
Goto UnReg

UnHotSyncRunning:
StrCpy $1 "true"

strcmp $6 "" UnCloseHotSyncManager UnDontAsk

UnCloseHotSyncManager:
WriteRegDword HKEY_CURRENT_USER "Software\U.S. Robotics\Pilot Desktop\HotSync Manager" "DontAskExit" 1
StrCpy $6 "true"

UnDontAsk:
FindWindow closeinstant "KittyHawk"

UnReg:

ReadRegStr $5 HKEY_LOCAL_MACHINE "SOFTWARE\Hi-CE\$4" "AppNum"

strcmp $5 "" DelNoConduit DelConduit

DelConduit:

DeleteRegKey HKEY_CURRENT_USER "Software\U.S. Robotics\Pilot Desktop\Application$5"

DelNoConduit:
Delete "$INSTDIR\uninst.exe"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Hi-CE\$4"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$4"

strcmp $1 "true" UnRestartHotSync
Goto UnComplete
UnRestartHotSync:

strcmp $6 "true" UnResetKey UnJmpEnd
UnResetKey:
WriteRegDword HKEY_CURRENT_USER "Software\U.S. Robotics\Pilot Desktop\HotSync Manager" "DontAskExit" 0

UnJmpEnd:
ClearErrors
ExecShell "open" "$9\HotSync.exe" SW_SHOWNORMAL
ifErrors HotSyncErr0 UnComplete

HotSyncErr0:
MessageBox MB_OK|MB_ICONEXCLAMATION "HotSync Manager failed to reload.$\nPlease restart HotSync Manager before using this program."

UnComplete:

Delete /REBOOTOK "$INSTDIR\$4.prc"
Delete /REBOOTOK "$INSTDIR\Readme.txt"
Delete /REBOOTOK "$INSTDIR\Goto_Hi-CE_Handhelds_web_site.url"
Delete /REBOOTOK "$INSTDIR\$4_Quick_Start.pdf"
Delete /REBOOTOK "$INSTDIR\Getting_Started.pdf"
Delete /REBOOTOK "$INSTDIR\$4SpellDB.pdb"

strcmp $5 "" DelData

Delete /REBOOTOK "$9\WriteHere.dll"

DelData:

ClearErrors
RMDir "$INSTDIR\Data"
ifErrors Finished

SetFileAttributes "$INSTDIR\Images\" NORMAL

Delete /REBOOTOK "$INSTDIR\Images\Hi-CE_logo.jpeg"
Delete /REBOOTOK "$INSTDIR\Images\leftArrow.gif"
Delete /REBOOTOK "$INSTDIR\Images\rightArrow.gif"
Delete /REBOOTOK "$INSTDIR\Images\upArrow.gif"
Delete /REBOOTOK "$INSTDIR\Images\$4Logo.gif"
Delete /REBOOTOK "$INSTDIR\View your WriteHere docs.html"

GetParentDir $4 $INSTDIR

SetOutPath "C:\"

RMDir "$INSTDIR\Images"

RMDir "$INSTDIR"
RMDir "$4"

Finished:

SetFileAttributes "$INSTDIR\Images\" HIDDEN

SectionEnd ; end of uninstall section

Function .onInit

strcpy $4 "WriteHere"

ReadRegStr $9 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$4" "UninstallString"
strcmp $9 "" Clean PrevInst

Clean:
goto InitDone

PrevInst:

ReadRegStr $8 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$4" "DisplayName"
MessageBox MB_YESNO "$8 found$\nUninstall this version?" IDNO InitDone
ExecShell "open" "$9" SW_SHOWNORMAL
;Abort ; causes installer to quit.

IfErrors InstErr InitDone
InstErr:
Call FailedUninst

InitDone:
FunctionEnd

Function .onInstSuccess

SetFileAttributes "$INSTDIR\Images\" HIDDEN

MessageBox MB_OK "This version of WriteHere has the ability to use the Infrared Port for Printing WriteHere Documents! $\nVisit http://www.handheld.hice-dev.org/writehereAppPage.htm for a trial version of Bachmann's PrintBoy Software."

FunctionEnd

Function HotSyncFailedMsg
ReadRegStr $9 HKEY_CURRENT_USER "Software\U.S. Robotics\Pilot Desktop\Core" "Path"
ClearErrors

Sleep 500

Exec "$9\HotSync.exe"
IfErrors DisplayMsgBox Fin

DisplayMsgBox:
MessageBox MB_OK|MB_ICONEXCLAMATION "HotSync Manager failed to reload.$\nPlease restart HotSync Manager before using this program."

Fin:
FunctionEnd

Function FailedUninst
ReadRegStr $9 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$4" "UninstallString"
ClearErrors

Sleep 500

Exec "$9"
IfErrors DisplayMsgBox Fin

DisplayMsgBox:
MessageBox MB_YESNO|MB_ICONSTOP "Uninstaller failed to load, please uninstall before continuing$\n$\n Abort installation?" IDNO Fin
Abort
Fin:
FunctionEnd

Function InstAppFailedMsg
ReadRegStr $9 HKEY_CURRENT_USER "Software\U.S. Robotics\Pilot Desktop\Core" "Path"
ClearErrors

Sleep 500

StrCpy $4 "WriteHere"
Exec "$9\Instapp.exe $OUTDIR\$4.prc"
IfErrors DisplayMsgBox Fin

DisplayMsgBox:
MessageBox MB_OK|MB_ICONEXCLAMATION "InstApp failed to load.$\nPlease double-click on the .prc and .pdb files in:$\n$\n$INSTDIR."

Fin:
FunctionEnd
; eof


I have this in my installation sometimes on NT4 workstation. Memory could not be read, etc. But I had a WISE installer before, and it had the same.
I traced it to the registration of an OCX component, which 'fails' somehow. If I use Regsvr32 manually, it works.


Hmm...cool, thanks, I'll look into that when I have a few minutes next week. Working on my "normal" projects rather than the installers right now, but I'll definitely give that a look when I get a chance. Thanks.


Did I say that it only worked properly when I did it manually afterwards myself in a Command Prompt with Regsvr32?
It's really rare, because I never heard anyone about it, I'm only having it myself.
I never got it really fixed in the installer, but sometimes it doesn't occur for some reason. It's confusing.