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:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user