They may be useful if the installation is allowed for users without
Administrator privileges.
---
Makefile | 17 +++++++++++------
install.reg.in | 23 ++++++++---------------
systeminfo.c | 50 +++++++++++++++++++++++++++-----------------------
uninstall.reg | 12 +++++-------
4 files changed, 51 insertions(+), 51 deletions(-)
diff --git a/Makefile b/Makefile
index 6c5d576..4042879 100644
--- a/Makefile
+++ b/Makefile
@@ -23,18 +23,23 @@ factory.o: factory.h ext.h menu.h
menu.o: menu.h ext.h debug.h systeminfo.h
systeminfo.o: systeminfo.h
-install: all install.reg
- regsvr32 -s git_shell_ext.dll
- regedit -s install.reg
+inst%: inst%.reg all
+ regsvr32 -s $(DLL_PATH)
+ regedit -s $<
-uninstall:
- regsvr32 -u -s git_shell_ext.dll
- regedit -s uninstall.reg
+uninst%: uninst%.reg
+ regsvr32 -u -s $(DLL_PATH)
+ regedit -s $<
install.reg: install.reg.in Makefile
sed < $< > $@ \
-e 's|@@MSYSGIT_PATH@@|$(MSYSGIT_PATH)|' \
-e 's|@@DLL_PATH@@|$(DLL_PATH)|'
+%-user.reg: %.reg
+ sed < $< > $@ \
+ -e 's|HKEY_LOCAL_MACHINE\\|HKEY_CURRENT_USER\\|' \
+ -e
's|HKEY_CLASSES_ROOT\\|HKEY_CURRENT_USER\\Software\\Classes\\|'
+
clean:
-rm -f $(OBJECTS) $(TARGET)
diff --git a/install.reg.in b/install.reg.in
index 79195f4..2eb8f13 100644
--- a/install.reg.in
+++ b/install.reg.in
@@ -10,6 +10,12 @@ Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Git-Cheetah]
"PathToMsys"="@@MSYSGIT_PATH@@"
+[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell
Extensions\Approved]
+"{ca586c80-7c84-4b88-8537-726724df6929}"="Git-Cheetah"
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell
Extensions\Approved\{ca586c80-7c84-4b88-8537-726724df6929}]
[EMAIL PROTECTED]"Git-Cheetah"
+
[HKEY_CLASSES_ROOT\CLSID\{ca586c80-7c84-4b88-8537-726724df6929}]
[HKEY_CLASSES_ROOT\CLSID\{ca586c80-7c84-4b88-8537-726724df6929}]
@@ -21,12 +27,9 @@ Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\CLSID\{ca586c80-7c84-4b88-8537-726724df6929}\InProcServer
32]
"ThreadingModel"="Apartment"
-[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell
Extensions\Approved]
-"{ca586c80-7c84-4b88-8537-726724df6929}"="Git-Cheetah"
-
-[HKEY_CLASSES_ROOT\txtfile\shellex\ContextMenuHandlers\Git-Cheetah]
+[HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\Git-Cheetah]
-[HKEY_CLASSES_ROOT\txtfile\shellex\ContextMenuHandlers\Git-Cheetah]
+[HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\Git-Cheetah]
@="{ca586c80-7c84-4b88-8537-726724df6929}"
[HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\Git-Cheetah]
@@ -49,17 +52,7 @@ Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Folder\shellex\ContextMenuHandlers\Git-Cheetah]
@="{ca586c80-7c84-4b88-8537-726724df6929}"
-[HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\Git-Cheetah]
-
-[HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\Git-Cheetah]
[EMAIL PROTECTED]"{ca586c80-7c84-4b88-8537-726724df6929}"
-
[HKEY_CLASSES_ROOT\InternetShortcut\shellex\ContextMenuHandlers\Git-Cheetah]
[HKEY_CLASSES_ROOT\InternetShortcut\shellex\ContextMenuHandlers\Git-Cheetah]
@="{ca586c80-7c84-4b88-8537-726724df6929}"
-
-[HKEY_CLASSES_ROOT\lnkfile\shellex\ContextMenuHandlers\Git-Cheetah]
-
-[HKEY_CLASSES_ROOT\lnkfile\shellex\ContextMenuHandlers\Git-Cheetah]
[EMAIL PROTECTED]"{ca586c80-7c84-4b88-8537-726724df6929}"
diff --git a/systeminfo.c b/systeminfo.c
index 08429bf..2b046df 100644
--- a/systeminfo.c
+++ b/systeminfo.c
@@ -3,37 +3,41 @@
static TCHAR msysPath[MAX_PATH];
+static int get_msys_path_from_registry (HKEY root) {
+ HKEY key;
+ DWORD path_len = sizeof (msysPath);
+
+ LONG result = RegOpenKeyEx(root, GIT_CHEETAH_REG_PATH,
+ 0, KEY_QUERY_VALUE, &key);
+ if (ERROR_SUCCESS != result)
+ return 0;
+
+ result = RegQueryValueEx(key,
+ GIT_CHEETAH_REG_PATHTOMSYS,
+ NULL, NULL, (LPBYTE)msysPath, &path_len);
+
+ RegCloseKey(key);
+
+ return ERROR_SUCCESS == result;
+}
+
TCHAR * msys_path(void)
{
static int found_path = 0;
- HKEY hKey;
- LONG lRet;
/* Only bother to get it once. */
if (found_path)
return msysPath;
- lRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- TEXT(GIT_CHEETAH_REG_PATH),
- 0, KEY_QUERY_VALUE, &hKey);
-
- if (lRet == ERROR_SUCCESS)
- {
- DWORD msysPathLen = MAX_PATH * sizeof(TCHAR);
-
- lRet = RegQueryValueEx(hKey,
- TEXT(GIT_CHEETAH_REG_PATHTOMSYS),
- NULL, NULL,
- (LPBYTE)msysPath,
- &msysPathLen);
- RegCloseKey(hKey);
-
- if (lRet == ERROR_SUCCESS)
- {
- found_path = 1;
- return msysPath;
- }
- }
+ /* try to find user-specific settings first */
+ found_path = get_msys_path_from_registry (HKEY_CURRENT_USER);
+
+ /* if not found in user settings, try machine-wide */
+ if (! found_path)
+ found_path = get_msys_path_from_registry
(HKEY_LOCAL_MACHINE);
+
+ if (found_path)
+ return msysPath;
return NULL;
}
diff --git a/uninstall.reg b/uninstall.reg
index 20100a8..bd33685 100644
--- a/uninstall.reg
+++ b/uninstall.reg
@@ -7,12 +7,14 @@ Windows Registry Editor Version 5.00
[-HKEY_LOCAL_MACHINE\SOFTWARE\Git-Cheetah]
-[-HKEY_CLASSES_ROOT\CLSID\{ca586c80-7c84-4b88-8537-726724df6929}]
-
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell
Extensions\Approved]
"{ca586c80-7c84-4b88-8537-726724df6929}"=-
-[-HKEY_CLASSES_ROOT\txtfile\shellex\ContextMenuHandlers\Git-Cheetah]
+[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell
Extensions\Approved\{ca586c80-7c84-4b88-8537-726724df6929}]
+
+[-HKEY_CLASSES_ROOT\CLSID\{ca586c80-7c84-4b88-8537-726724df6929}]
+
+[-HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\Git-Cheetah]
[-HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\Git-Cheetah]
@@ -22,8 +24,4 @@ Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Folder\shellex\ContextMenuHandlers\Git-Cheetah]
-[-HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\Git-Cheetah]
-
[-HKEY_CLASSES_ROOT\InternetShortcut\shellex\ContextMenuHandlers\Git-Cheetah
]
-
-[-HKEY_CLASSES_ROOT\lnkfile\shellex\ContextMenuHandlers\Git-Cheetah]
\ No newline at end of file
--
1.5.4.rc0.929.g50e2