Delete an ODBC entry: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Wikipedia python library) |
(SF: wether -> whether.) |
||
Line 1: | Line 1: | ||
== The Function == | == The Function == | ||
<highlight-nsis>
; | <highlight-nsis> | ||
; | |||
; Delete an existing ODBC Entry | ; Delete an existing ODBC Entry | ||
; | ; | ||
Line 29: | Line 30: | ||
DeleteEntry: | DeleteEntry: | ||
; Check | ; Check whether the ODBC entry already exists | ||
Push $R0 | Push $R0 | ||
Call ${PREFIX}ODBCEntryExists | Call ${PREFIX}ODBCEntryExists |
Revision as of 14:33, 17 April 2005
The Function
; ; Delete an existing ODBC Entry ; ; Requires: ODBCEntryExists ; Input: Name of the ODBC entry ; Output: None ; ; Usage: ; ; Push "ODBCTEST" ; Call DeleteODBCEntry ; MessageBox MB_OK|MB_ICONINFORMATION "ODBC entry 'ODBCTEST' deleted" ; !macro DeleteODBCEntryMacro PREFIX ; Clear all errors first ClearErrors ; Pop the name of the ODBC entry from the stack Exch $R0 Push $R1 IfErrors InvalidParameter DeleteEntry InvalidParameter: MessageBox MB_OK|MB_ICONEXCLAMATION "DeleteODBCEntry: Please push the name of the ODBC entry first." Goto Done DeleteEntry: ; Check whether the ODBC entry already exists Push $R0 Call ${PREFIX}ODBCEntryExists Pop $R1 StrCmp $R1 "FALSE" Done ; Delete the registry keys ClearErrors DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\ODBC\ODBC.INI\$R0" IfErrors ErrorKey DeleteValue ErrorKey: MessageBox MB_OK|MB_ICONEXCLAMATION "Could not delete the registry key:$\r$\rHKLM - SOFTWARE\ODBC\ODBC.INI\$R0$\r$\rPlease delete this registry key manually !" DeleteValue: ClearErrors DeleteRegValue HKEY_LOCAL_MACHINE "SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources" "$R0" IfErrors ErrorValue Done ErrorValue: MessageBox MB_OK|MB_ICONEXCLAMATION "Could not delete the registry value:$\r$\rHKLM - SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources\$R0$\r$\rPlease delete this registry value manually !" Done: ; Restore R0-R1 Pop $R1 Pop $R0 !macroend Function DeleteODBCEntry !insertmacro DeleteODBCEntryMacro "" FunctionEnd Function un.DeleteODBCEntry !insertmacro DeleteODBCEntryMacro "un." FunctionEnd
Page author: preisl