Determine the path for an Oracle home: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Updated author and download links, and changed format of some pages.) |
m (Updated author links.) |
||
Line 1: | Line 1: | ||
{|align=right | |||
|<small>Author: [[{{ns:2}}:preisl|preisl]] ([[{{ns:3}}:preisl|talk]], [[{{ns:-1}}:Contributions/preisl|contrib]])</small> | |||
|} | |||
<br style="clear:both;"> | |||
== The Function == | == The Function == | ||
<highlight-nsis> | <highlight-nsis> | ||
Line 58: | Line 62: | ||
FunctionEnd</highlight-nsis> | FunctionEnd</highlight-nsis> | ||
Revision as of 02:55, 30 April 2005
Author: preisl (talk, contrib) |
The Function
; ; Returns the path to the given Oracle home ; ; Input: Name of the Oracle home ; Output: Path of the Oracle home ; ; Usage: ; ; Push "Oracle8iClient" ; Call OracleHomePath ; Pop "$1" ; MessageBox MB_OK|MB_ICONINFORMATION "Oracle home path: $1" ; Function OracleHomePath Exch $R3 ; Name of the Oracle ome ; Push R0-R2 on the stack Push $R2 Push $R1 Push $R0 ; Get the number of available homes ReadRegStr $R0 HKEY_LOCAL_MACHINE "SOFTWARE\ORACLE\ALL_HOMES" "HOME_COUNTER" ; Initialize counter variable R1 StrCpy $R1 0 Loop: IntCmp $R1 $R0 NotFound CheckHome NotFound CheckHome: ReadRegStr $R2 HKEY_LOCAL_MACHINE "SOFTWARE\ORACLE\ALL_HOMES\ID$R1" "NAME" StrCmp $R2 $R3 HomeFound ContinueLoop HomeFound: ReadRegStr $R2 HKEY_LOCAL_MACHINE "SOFTWARE\ORACLE\ALL_HOMES\ID$R1" "PATH" IfFileExists $R2 DirectoryFound DirectoryNotFound DirectoryFound: StrCpy $R3 $R2 Goto Done DirectoryNotFound: StrCpy $R3 "" Goto Done ContinueLoop: IntOp $R1 $R1 + 1 Goto Loop NotFound: StrCpy $R3 "" Done: ; Restore R0-R3 and put the result on the stack Pop $R0 Pop $R1 Pop $R2 Exch $R3 FunctionEnd