fix(installer): the driver's failure reason reads as Korean, not garbled text

The app writes the reason in UTF-8; FileRead took it for the system's ANSI
code page, so a declined driver install showed mojibake in the message box
and in the details. Read the file's bytes and convert them from UTF-8, for the
install and the uninstall message alike.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-15 00:30:41 +09:00
parent 61d9c06a6b
commit f71c72d3a1
2 changed files with 23 additions and 9 deletions

View File

@@ -98,6 +98,22 @@ FunctionEnd
${Loop}
!macroend
; The driver's result file (why it failed) as text: the app writes it in UTF-8, which FileRead
; would take for the system's ANSI code page. OUT is empty when there is no file.
!macro ReadUtf8 FILE OUT
StrCpy ${OUT} ""
System::Call 'kernel32::CreateFileW(w "${FILE}", i 0x80000000, i 1, p 0, i 3, i 0, p 0) p .r7'
${If} $7 P<> -1
System::Alloc 1024 ; zeroed, and at most 1023 bytes read: always ends with a NUL
Pop $6
System::Call 'kernel32::ReadFile(p r7, p r6, i 1023, *i .r5, p 0)'
System::Call 'kernel32::CloseHandle(p r7)'
System::Call 'kernel32::MultiByteToWideChar(i 65001, i 0, p r6, i -1, w .s, i ${NSIS_MAX_STRLEN})'
Pop ${OUT}
System::Free $6
${EndIf}
!macroend
; The installer's lock: Jarvis does not start while it is held (app/src/setup_lock.rs); taken
; before waiting for a running Jarvis, closed once every change is done (before the app is started
; again). Another installer or uninstaller holding it (or a lock that cannot be made) means this
@@ -239,9 +255,7 @@ Section "가상 모니터 드라이버" SecDriver
${EndIf}
ExecWait '"$INSTDIR\jarvis.exe" --display-driver install --result "$PLUGINSDIR\vdd.txt"' $0
${If} $0 != 0
FileOpen $1 "$PLUGINSDIR\vdd.txt" r
FileRead $1 $2
FileClose $1
!insertmacro ReadUtf8 "$PLUGINSDIR\vdd.txt" $2
DetailPrint "가상 모니터 드라이버를 설치하지 못했습니다: $2"
${IfNot} ${Silent}
MessageBox MB_ICONEXCLAMATION "가상 모니터 드라이버를 설치하지 못했습니다. 나중에 기능 화면에서 다시 설치할 수 있습니다.$\r$\n$2"
@@ -276,10 +290,7 @@ Section "Uninstall"
ExecWait '"$INSTDIR\jarvis.exe" --display-driver uninstall --result "$TEMP\jarvis-vdd-uninstall.txt"' $0
${If} $0 != 0
${AndIf} $0 != 2
StrCpy $2 ""
FileOpen $1 "$TEMP\jarvis-vdd-uninstall.txt" r
FileRead $1 $2
FileClose $1
!insertmacro ReadUtf8 "$TEMP\jarvis-vdd-uninstall.txt" $2
Delete "$TEMP\jarvis-vdd-uninstall.txt"
DetailPrint "가상 모니터 드라이버를 지우지 못했습니다 ($0): $2"
${IfNot} ${Silent}

View File

@@ -730,7 +730,8 @@ come with the first-run wizard into the data folder, which the installer never t
- Components: Jarvis (always), start menu shortcut (on), desktop shortcut (off), the virtual
monitor's driver (on, so it comes with the app; the app's elevated half, `jarvis.exe
--display-driver install`, so Windows asks the SignPath question once; a failure says it can be
installed later from the features screen and the app is installed all the same; never in a
installed later from the features screen, with the reason the app wrote (UTF-8), and the app is
installed all the same; never in a
silent install, so an update neither asks nor brings back a driver the person removed).
Shortcuts are for every user of the PC.
- The WebView2 runtime is installed with Microsoft's bootstrapper (inside the installer) only when
@@ -834,7 +835,9 @@ detection off) and its settings. A removal forgets the driver only when no devic
is gone or was not in the store; a failed install forgets it only under the same rule (and never
when it was ours before), reporting both reasons otherwise; a leftover offers removal; driver tasks refused while the services start, and a start (and a
second task) refused while one runs, also after it failed; removing a driver that is not ours says
there is nothing to remove. The installer (by hand on a Windows VM): installing into a folder that
there is nothing to remove. The installer (by hand on a Windows VM): with the default components the
driver is installed (Windows' question answered yes), and answered no the app is installed all the
same and the message gives the reason in readable Korean; installing into a folder that
holds other files and uninstalling keeps them; a driver removal that fails stops the uninstall with
the files and entry kept, and nothing to remove lets it finish; with no WebView2 and its installer
failing nothing is installed or started; an update end to end (0.1.0 installed, a release server