diff options
author | Jeffrey Altman <jaltman@secure-endpoints.com> | 2005-11-30 04:33:54 +0000 |
---|---|---|
committer | Jeffrey Altman <jaltman@secure-endpoints.com> | 2005-11-30 04:33:54 +0000 |
commit | 062b5d52c60fcfa282f17d1921178b8e3f367b06 (patch) | |
tree | 34985c44da1cf617c742ab04f5ffe31e91e1165f /src/windows/installer/wix/custom | |
parent | fb17705c66b593fb72c57e8a2f01c33d26c14693 (diff) | |
download | krb5-062b5d52c60fcfa282f17d1921178b8e3f367b06.tar.gz krb5-062b5d52c60fcfa282f17d1921178b8e3f367b06.tar.xz krb5-062b5d52c60fcfa282f17d1921178b8e3f367b06.zip |
Updates to Wix installer source for KFW 3.0 Beta 2
- Updates all strings
- Creates shortcuts for netidmgr.exe and netidmgr.chm
- Adds KFW Logon Network Provider
Known bugs:
- the old Leash Documentation PDF still has a shortcut
- specifying the WorkingDirectory does not work
ticket: new
component: windows
status: open
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17520 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/windows/installer/wix/custom')
-rw-r--r-- | src/windows/installer/wix/custom/custom.cpp | 109 | ||||
-rw-r--r-- | src/windows/installer/wix/custom/custom.h | 15 |
2 files changed, 122 insertions, 2 deletions
diff --git a/src/windows/installer/wix/custom/custom.cpp b/src/windows/installer/wix/custom/custom.cpp index 31fc11caad..dd1fb9c5d0 100644 --- a/src/windows/installer/wix/custom/custom.cpp +++ b/src/windows/installer/wix/custom/custom.cpp @@ -23,7 +23,9 @@ DLLEXPORTS =\ -EXPORT:AbortMsiImmediate \ -EXPORT:UninstallNsisInstallation \ -EXPORT:KillRunningProcesses \ - -EXPORT:ListRunningProcesses + -EXPORT:ListRunningProcesses \ + -EXPORT:InstallNetProvider \ + -EXPORT:UninstallNetProvider $(DLLFILE): $(OUTPATH)\custom.obj $(LINK) /OUT:$@ /DLL $** $(DLLEXPORTS) @@ -42,7 +44,7 @@ clean: #else /* -Copyright 2004 by the Massachusetts Institute of Technology +Copyright 2004,2005 by the Massachusetts Institute of Technology All rights reserved. @@ -621,6 +623,109 @@ _cleanup: } return rv; } + +/* Check and add or remove networkprovider key value + str : target string + str2: string to add/remove + bInst: == 1 if string should be added to target if not already there, + otherwise remove string from target if present. +*/ +int npi_CheckAndAddRemove( LPTSTR str, LPTSTR str2, int bInst ) { + + LPTSTR target, charset, match; + int ret=0; + + target = new TCHAR[lstrlen(str)+3]; + lstrcpy(target,_T(",")); + lstrcat(target,str); + lstrcat(target,_T(",")); + charset = new TCHAR[lstrlen(str2)+3]; + lstrcpy(charset,_T(",")); + lstrcat(charset,str2); + lstrcat(charset,_T(",")); + + match = _tcsstr(target, charset); + + if ((match) && (bInst)) { + ret = INP_ERR_PRESENT; + goto cleanup; + } + + if ((!match) && (!bInst)) { + ret = INP_ERR_ABSENT; + goto cleanup; + } + + if (bInst) // && !match + { + lstrcat(str, _T(",")); + lstrcat(str, str2); + ret = INP_ERR_ADDED; + goto cleanup; + } + + // if (!bInst) && (match) + { + lstrcpy(str+(match-target),match+lstrlen(str2)+2); + str[lstrlen(str)-1]=_T('\0'); + ret = INP_ERR_REMOVED; + goto cleanup; + } + +cleanup: + + delete target; + delete charset; + return ret; +} + +/* Sets the registry keys required for the functioning of the network provider */ + +DWORD InstNetProvider(MSIHANDLE hInstall, int bInst) { + LPTSTR strOrder; + HKEY hkOrder; + LONG rv; + DWORD dwSize; + HANDLE hProcHeap; + + strOrder = (LPTSTR) 0; + + CHECK(rv = RegOpenKeyEx( HKEY_LOCAL_MACHINE, STR_KEY_ORDER, 0, KEY_READ | KEY_WRITE, &hkOrder )); + + dwSize = 0; + CHECK(rv = RegQueryValueEx( hkOrder, STR_VAL_ORDER, NULL, NULL, NULL, &dwSize ) ); + + strOrder = new TCHAR[ (dwSize + STR_SERVICE_LEN) * sizeof(TCHAR) ]; + + CHECK(rv = RegQueryValueEx( hkOrder, STR_VAL_ORDER, NULL, NULL, (LPBYTE) strOrder, &dwSize)); + + npi_CheckAndAddRemove( strOrder, STR_SERVICE , bInst); + + dwSize = (lstrlen( strOrder ) + 1) * sizeof(TCHAR); + + CHECK(rv = RegSetValueEx( hkOrder, STR_VAL_ORDER, NULL, REG_SZ, (LPBYTE) strOrder, dwSize )); + + /* everything else should be set by the MSI tables */ + rv = ERROR_SUCCESS; +_cleanup: + + if( rv != ERROR_SUCCESS ) { + ShowMsiError( hInstall, ERR_NPI_FAILED, rv ); + } + + if(strOrder) delete strOrder; + + return rv; +} + +MSIDLLEXPORT InstallNetProvider( MSIHANDLE hInstall ) { + return InstNetProvider( hInstall, 1 ); +} + +MSIDLLEXPORT UninstallNetProvider( MSIHANDLE hInstall) { + return InstNetProvider( hInstall, 0 ); +} + #endif #ifdef __NMAKE__ !ENDIF diff --git a/src/windows/installer/wix/custom/custom.h b/src/windows/installer/wix/custom/custom.h index ee0e663191..9fcc61e65e 100644 --- a/src/windows/installer/wix/custom/custom.h +++ b/src/windows/installer/wix/custom/custom.h @@ -47,6 +47,13 @@ SOFTWARE. #define CHECK2(x,y) if((x)) { msiErr = (y); goto _cleanup; } +#define STR_KEY_ORDER _T("SYSTEM\\CurrentControlSet\\Control\\NetworkProvider\\Order") +#define STR_VAL_ORDER _T("ProviderOrder") + +#define STR_SERVICE _T("MIT Kerberos") +#define STR_SERVICE_LEN 12 + + void ShowMsiError(MSIHANDLE, DWORD, DWORD); UINT SetAllowTgtSessionKey( MSIHANDLE hInstall, BOOL pInstall ); UINT KillRunningProcessesSlave( MSIHANDLE hInstall, BOOL bKill ); @@ -58,9 +65,17 @@ MSIDLLEXPORT RevertAllowTgtSessionKey( MSIHANDLE hInstall ); MSIDLLEXPORT EnableAllowTgtSessionKey( MSIHANDLE hInstall ); MSIDLLEXPORT KillRunningProcesses( MSIHANDLE hInstall ) ; MSIDLLEXPORT ListRunningProcesses( MSIHANDLE hInstall ); +MSIDLLEXPORT InstallNetProvider( MSIHANDLE ); +MSIDLLEXPORT UninstallNetProvider ( MSIHANDLE ); + +#define INP_ERR_PRESENT 1 +#define INP_ERR_ADDED 2 +#define INP_ERR_ABSENT 3 +#define INP_ERR_REMOVED 4 /* Custom errors */ #define ERR_CUSTACTDATA 4001 #define ERR_NSS_FAILED 4003 #define ERR_ABORT 4004 #define ERR_PROC_LIST 4006 +#define ERR_NPI_FAILED 4007 |