2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
12 #include <WINNT/TaLocale.h>
13 #include "cpl_interface.h"
17 static HINSTANCE hinst = 0;
18 static HINSTANCE hinstResources = 0;
21 static BOOL IsWindowsNT (void)
23 static BOOL fChecked = FALSE;
24 static BOOL fIsWinNT = FALSE;
28 OSVERSIONINFO Version;
29 memset (&Version, 0x00, sizeof(Version));
30 Version.dwOSVersionInfoSize = sizeof(Version);
32 if (GetVersionEx (&Version))
34 if (Version.dwPlatformId == VER_PLATFORM_WIN32_NT)
45 static BOOL IsClientInstalled (void)
47 static BOOL fChecked = FALSE;
48 static BOOL fIsInstalled = FALSE;
53 if (RegOpenKey (HKEY_LOCAL_MACHINE, TEXT("Software\\TransarcCorporation\\AFS Client\\CurrentVersion"), &hk) == 0)
55 TCHAR szPath[ MAX_PATH ];
56 DWORD dwSize = sizeof(szPath);
57 DWORD dwType = REG_SZ;
58 if (RegQueryValueEx (hk, TEXT("PathName"), NULL, &dwType, (PBYTE)szPath, &dwSize) == 0)
69 extern "C" LONG APIENTRY CPlApplet(HWND hwndCPl, UINT uMsg, LONG lParam1, LONG lParam2)
71 LPNEWCPLINFO lpNewCPlInfo;
74 case CPL_INIT: /* first message, sent once */
75 hinst = GetModuleHandle("afs_cpa.cpl");
76 hinstResources = TaLocale_LoadCorrespondingModule (hinst);
79 case CPL_GETCOUNT: /* second message, sent once */
83 case CPL_NEWINQUIRE: /* third message, sent once per app */
84 lpNewCPlInfo = (LPNEWCPLINFO) lParam2;
86 lpNewCPlInfo->dwSize = (DWORD) sizeof(NEWCPLINFO);
87 lpNewCPlInfo->dwFlags = 0;
88 lpNewCPlInfo->dwHelpContext = 0;
89 lpNewCPlInfo->lData = 0;
90 if (IsClientInstalled() || !IsWindowsNT())
91 lpNewCPlInfo->hIcon = TaLocale_LoadIcon(IDI_AFSD);
93 lpNewCPlInfo->hIcon = TaLocale_LoadIcon(IDI_CCENTER);
94 lpNewCPlInfo->szHelpFile[0] = '\0';
96 GetString (lpNewCPlInfo->szName, (!IsWindowsNT()) ? IDS_CPL_NAME_95 : (!IsClientInstalled()) ? IDS_CPL_NAME_CCENTER : IDS_CPL_NAME_NT);
97 GetString (lpNewCPlInfo->szInfo, (!IsWindowsNT()) ? IDS_CPL_DESC_95 : (!IsClientInstalled()) ? IDS_CPL_DESC_CCENTER : IDS_CPL_DESC_NT);
100 case CPL_DBLCLK: /* applet icon double-clicked */
101 if (IsClientInstalled() || !IsWindowsNT())
102 WinExec("afs_config.exe", SW_SHOW);
104 WinExec("afs_config.exe /c", SW_SHOW);
109 FreeLibrary (hinstResources);