Determine the name of the Oracle default home

From NSIS Wiki
Jump to navigationJump to search
Author: preisl (talk, contrib)


Note: the registry used in this function not exists in WIN7

The Function

;
; Returns the name of the default oracle home
;
; Requires: OracleHomePath
;    Input: none
;   Output: Name of the Oracle default home
;
; Usage:
;
;    Call OracleDefaultHome
;    Pop "$1"
;    MessageBox MB_OK|MB_ICONINFORMATION "Oracle default home: $1"
;
 
Function OracleDefaultHome
 
  ; Push R0 on the stack
  Push $R0
  Push $R1
 
  ; Read the name of the default home from the registry
  ReadRegStr $R0 HKEY_LOCAL_MACHINE "SOFTWARE\ORACLE\ALL_HOMES" "DEFAULT_HOME"
  Push $R0
  Call OracleHomePath
  Pop $R1
  StrCmp $R1 "" InvalidPath Done
  InvalidPath:
    StrCpy $R0 ""
 
  Done:
 
  ; Restore R0
  Pop $R1
  Exch $R0
 
FunctionEnd