Get the list of ODBC entries in registry
From NSIS Wiki
Jump to navigationJump to search
Author: jasonroo (talk, contrib) |
Description
Use this function to get a list of all the ODBC entries in the Windows registry.
The Function
; ; Gets the list of ODBC entries ; ; Input: none ; Output: ODBC entry names separated by "|" ; ; Usage ; ; Call Get_ODBC_Entries ; Pop "$1" ; MessageBox MB_OK|MB_ICONINFORMATION "ODBC entries: $1" ; !ifndef Get_ODBC_Entries.Included !define Get_ODBC_Entries.Included !macro Get_ODBC_EntriesMacro ; Clear all errors at the beginning ClearErrors ; Pop the name of the ODBC entry from the stack Push $R0 Push $R1 Push $0 StrCpy $0 0 StrCpy $R0 "" loop: EnumRegValue $R1 HKEY_LOCAL_MACHINE "SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources" $0 StrCmp $R1 "" Done StrCpy $R0 "$R0|$R1" IntOp $0 $0 + 1 Goto loop Done: Pop $0 Pop $R1 Exch $R0 !macroend Function Get_ODBC_Entries !insertmacro Get_ODBC_EntriesMacro FunctionEnd Function un.Get_ODBC_Entries !insertmacro Get_ODBC_EntriesMacro FunctionEnd !endif