3월, 2022의 게시물 표시

[NSIS] 인증서 설치

# https://nsis.sourceforge.io/Import_Root_Certificate # 사용 예 # ${AddCertificateToStore} $0 "$VAR_INSTDIR\rootcert.cer" !define CERT_QUERY_OBJECT_FILE 1 !define CERT_QUERY_CONTENT_FLAG_ALL 16382 !define CERT_QUERY_FORMAT_FLAG_ALL 14 !define CERT_STORE_PROV_SYSTEM 10 !define CERT_STORE_OPEN_EXISTING_FLAG 0x4000 !define CERT_SYSTEM_STORE_LOCAL_MACHINE 0x20000 !define CERT_STORE_ADD_ALWAYS 4 !macro _AddCertificateToStore un Function ${un}_AddCertificateToStore Exch $0 Push $1 Push $R0 System::Call "crypt32::CryptQueryObject(i ${CERT_QUERY_OBJECT_FILE}, w r0, \ i ${CERT_QUERY_CONTENT_FLAG_ALL}, i ${CERT_QUERY_FORMAT_FLAG_ALL}, \ i 0, i 0, i 0, i 0, i 0, i 0, *i .r0) i .R0" ${If} $R0 0 System::Call "crypt32::CertOpenStore(i ${CERT_STORE_PROV_SYSTEM}, i 0, i 0, \ i ${CERT_STORE_OPEN_EXISTING_FLAG}|${CERT_SYSTEM_STORE_LOCAL_MACHINE}, \ w 'ROOT') i .r1" ${If} $1 0 System::Call "crypt32::CertAddCe...

[NSIS] 권한 상승

# https://nsis.sourceforge.io/UAC_plug-in !macro _UAC_Elevation un Function ${un}_UAC_Elevation Push $R0 Exch Pop $R0 uac_tryagain: !insertmacro UAC_RunElevated ${Switch} $0 ${Case} 0 ${IfThen} $1 = 1 ${|} Quit ${|} ;we are the outer process, the inner process has done its work, we are done ${IfThen} $3 0 ${|} ${Break} ${|} ;we are admin, let the show go on ${If} $1 = 3 ;RunAs completed successfully, but with a non-admin user MessageBox mb_YesNo|mb_IconExclamation|mb_TopMost|mb_SetForeground "This $R0 requires admin privileges, try again" /SD IDNO IDYES uac_tryagain IDNO 0 ${EndIf} ;fall-through and die ${Case} 1223 MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "This $R0 requires admin privileges, aborting!" Quit ${Case} 1062 MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Logon service not running, aborting!" Quit ${Default} MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Unable to...

[NSIS] 특수 경로 얻어오기

# 설치 경로에 '$'가 포함된 특수 경로이면 해당 경로를 찾아서 SetOutPath 설정, '$'가 포함되어 있지 않으면 들어온 경로 그대로 설정. # 호출 예 # ${GetSpecialPathReplaced} '반환' '특수 경로가 포함된 경로' # ${GetSpecialPathReplaced} $0 "$DESKTOP\test" # $0 == '$DESKTOP 부분이 로컬 PC의 환경에 맞춰 경로를 얻어오고 나머지 뒷 부분은 그대로.' !define CSIDL_DESKTOP '0x0' # Desktop path ($DESKTOP) !define CSIDL_PROGRAMS '0x2' # Programs path !define CSIDL_PERSONAL '0x5' # My document path !define CSIDL_FAVORITES '0x6' # Favorites path ($FAVORITES) !define CSIDL_STARTUP '0x7' # Startup path !define CSIDL_RECENT '0x8' # Recent documents path ($RECENT) !define CSIDL_SENDTO '0x9' # Sendto documents path ($SENDTO) !define CSIDL_STARTMENU '0xB' # StartMenu path !define CSIDL_MUSIC '0xD' # My Music path ($MUSIC) !define CSIDL_DESKTOPDIR '0x10' # Desktop Directory path !define CSIDL_COMPUTER '0x11' # My Compute...