They may be useful if the installation is allowed for users without
Administrator privileges.
---
Makefile | 21 +++++++++++++++++----
install.reg.in | 23 ++++++++---------------
systeminfo.c | 33 +++++++++++++++++++++++----------
uninstall-user.reg | 27 +++++++++++++++++++++++++++
4 files changed, 75 insertions(+), 29 deletions(-)
create mode 100644 uninstall-user.reg
diff --git a/Makefile b/Makefile
index 6c5d576..e24989a 100644
--- a/Makefile
+++ b/Makefile
@@ -23,18 +23,31 @@ 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
+install: install.reg all
+ regsvr32 -s $(DLL_PATH)
+ regedit -s $<
+
+install-user: install-user.reg all
+ regsvr32 -s $(DLL_PATH)
+ regedit -s $<
uninstall:
- regsvr32 -u -s git_shell_ext.dll
+ regsvr32 -u -s $(DLL_PATH)
regedit -s uninstall.reg
+uninstall-user:
+ regsvr32 -u -s $(DLL_PATH)
+ regedit -s uninstall-user.reg
+
install.reg: install.reg.in Makefile
sed < $< > $@ \
-e 's|@@MSYSGIT_PATH@@|$(MSYSGIT_PATH)|' \
-e 's|@@DLL_PATH@@|$(DLL_PATH)|'
+install-user.reg: install.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}\InProcServer32]
"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..07444d6 100644
--- a/systeminfo.c
+++ b/systeminfo.c
@@ -8,32 +8,45 @@ TCHAR * msys_path(void)
static int found_path = 0;
HKEY hKey;
LONG lRet;
+ DWORD msysPathLen = MAX_PATH * sizeof(TCHAR);
/* Only bother to get it once. */
if (found_path)
return msysPath;
- lRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+ /* try to find user-specific settings first */
+ lRet = RegOpenKeyEx(HKEY_CURRENT_USER,
TEXT(GIT_CHEETAH_REG_PATH),
0, KEY_QUERY_VALUE, &hKey);
-
- if (lRet == ERROR_SUCCESS)
- {
- DWORD msysPathLen = MAX_PATH * sizeof(TCHAR);
-
+ if (ERROR_SUCCESS == lRet) {
lRet = RegQueryValueEx(hKey,
TEXT(GIT_CHEETAH_REG_PATHTOMSYS),
NULL, NULL,
(LPBYTE)msysPath,
&msysPathLen);
RegCloseKey(hKey);
+ }
- if (lRet == ERROR_SUCCESS)
- {
- found_path = 1;
- return msysPath;
+ /* if current user does not have the path, try machine-wide */
+ if (ERROR_SUCCESS != lRet) {
+ lRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+ TEXT(GIT_CHEETAH_REG_PATH),
+ 0, KEY_QUERY_VALUE, &hKey);
+ if (ERROR_SUCCESS == lRet) {
+ lRet = RegQueryValueEx(hKey,
+ TEXT(GIT_CHEETAH_REG_PATHTOMSYS),
+ NULL, NULL,
+ (LPBYTE)msysPath,
+ &msysPathLen);
+ RegCloseKey(hKey);
}
}
+
+ if (lRet == ERROR_SUCCESS)
+ {
+ found_path = 1;
+ return msysPath;
+ }
return NULL;
}
diff --git a/uninstall-user.reg b/uninstall-user.reg
new file mode 100644
index 0000000..4d69f3f
--- /dev/null
+++ b/uninstall-user.reg
@@ -0,0 +1,27 @@
+Windows Registry Editor Version 5.00
+
+; This registry file creates neccessary entries for uninstallation.
+; **** If you change this file, keep install.reg in sync! ****
+;
+; This file is slated for being generated and not hard-coded.
+
+[-HKEY_CURRENT_USER\SOFTWARE\Git-Cheetah]
+
+[-HKEY_CURRENT_USER\Software\Classes\CLSID\{ca586c80-7c84-4b88-8537-726724df6929}]
+
+[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell
Extensions\Approved]
+"{ca586c80-7c84-4b88-8537-726724df6929}"=-
+
+[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell
Extensions\Approved\{ca586c80-7c84-4b88-8537-726724df6929}]
+
+[-HKEY_CURRENT_USER\Software\Classes\*\shellex\ContextMenuHandlers\Git-Cheetah]
+
+[-HKEY_CURRENT_USER\Software\Classes\Directory\shellex\ContextMenuHandlers\Git-Cheetah]
+
+[-HKEY_CURRENT_USER\Software\Classes\Directory\Background\shellex\ContextMenuHandlers\Git-Cheetah]
+
+[-HKEY_CURRENT_USER\Software\Classes\Drive\shellex\ContextMenuHandlers\Git-Cheetah]
+
+[-HKEY_CURRENT_USER\Software\Classes\Folder\shellex\ContextMenuHandlers\Git-Cheetah]
+
+[-HKEY_CURRENT_USER\Software\Classes\InternetShortcut\shellex\ContextMenuHandlers\Git-Cheetah]
--
1.5.4.rc0.929.g50e2