winnt-dont-display-ibm-legal-message-20040326
[openafs.git] / src / WINNT / client_creds / afscreds.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
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
8  */
9
10 #ifndef AFSCREDS_H
11 #define AFSCREDS_H
12
13
14 /*
15  * INCLUSIONS _________________________________________________________________
16  *
17  */
18
19 #include <WINNT/TaLocale.h>
20 #undef REALLOC /* RT ticket 2120; So we can redefine it later */
21 #include <windows.h>
22 #include <commctrl.h>
23 #include <regstr.h>
24 #include <time.h>
25 #include <shellapi.h>
26 #include <WINNT/al_wizard.h>
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 #include <osithrdnt.h>
31 #include <osisleep.h>
32 #include <osibasel.h>
33 #ifdef __cplusplus
34 }
35 #endif
36 #include "resource.h"
37 #include "checklist.h"
38 #include "window.h"
39 #include "shortcut.h"
40 #include "trayicon.h"
41 #include "creds.h"
42 #include "credstab.h"
43 #include "advtab.h"
44 #include "mounttab.h"
45 #include "afswiz.h"
46 #include "drivemap.h"
47 #include "help.hid"
48
49
50 /*
51  * REG PATHS __________________________________________________________________
52  *
53  */
54
55 #define REGSTR_PATH_AFS      TEXT("Software\\TransarcCorporation\\AFS Client\\CurrentVersion")
56 #define REGSTR_PATH_AFSCREDS TEXT("Software\\TransarcCorporation\\AFS Client\\AfsCreds")
57 #define REGSTR_PATH_OPENAFS_CLIENT  TEXT("SOFTWARE\\OpenAFS\\Client")
58 #define REGSTR_PATH_OPENAFS_CLIENT_REMIND  TEXT("SOFTWARE\\OpenAFS\\Client\\Reminders")
59
60 #define REGVAL_AFS_TITLE     TEXT("Title")
61 #define REGVAL_AFS_VERSION   TEXT("VersionString")
62 #define REGVAL_AFS_PATCH     TEXT("PatchLevel")
63 #define REGVAL_AFS_PATH      TEXT("PathName")
64
65 #define cszSHORTCUT_NAME     TEXT("AFS Credentials.lnk")
66
67 #define AFSCREDS_SHORTCUT_OPTIONS  TEXT("-A -M -N -Q")
68
69 /*
70  * VARIABLES __________________________________________________________________
71  *
72  */
73
74 typedef struct
75    {
76    TCHAR szCell[ MAX_PATH ];
77    TCHAR szUser[ MAX_PATH ];
78    SYSTEMTIME stExpires;
79    BOOL fRemind;
80    } CREDS, *LPCREDS;
81
82 typedef struct
83    {
84    HWND hMain;
85    CREDS *aCreds;
86    size_t cCreds;
87    DWORD tickLastRetest;
88    LONG fShowingMessage;
89    LPWIZARD pWizard;
90    BOOL fStartup;
91    BOOL fIsWinNT;
92    TCHAR szHelpFile[ MAX_PATH ];
93    osi_mutex_t expirationCheckLock;
94    osi_mutex_t credsLock;
95    } GLOBALS;
96
97 extern GLOBALS g;
98
99
100 /*
101  * TIMING _____________________________________________________________________
102  *
103  */
104
105 #define cminREMIND_TEST      1    // test every minute for expired creds
106 #define cminREMIND_WARN      15   // warn if creds expire in 15 minutes
107 #define cminRENEW            20   // renew creds when there are 20 minutes remaining
108 #define cminMINLIFE          30   // minimum life of Kerberos creds
109
110 #define cmsecMOUSEOVER       1000 // retest freq when mouse is over tray icon
111 #define cmsecSERVICE         2000 // retest freq when starting/stopping service
112
113 #define c100ns1SECOND        (LONGLONG)10000000
114 #define cmsec1SECOND         1000
115 #define cmsec1MINUTE         60000
116 #define csec1MINUTE          60
117
118
119 #define ID_REMIND_TIMER      1000
120 #define ID_SERVICE_TIMER     1001
121 #define ID_WIZARD_TIMER      1002
122
123
124 /*
125  * MACROS _____________________________________________________________________
126  *
127  */
128
129 #ifndef FileExists
130 #define FileExists(_psz)  ((GetFileAttributes (_psz) == 0xFFFFFFFF) ? FALSE : TRUE)
131 #endif
132
133 #ifndef THIS_HINST
134 #define THIS_HINST  (HINSTANCE)GetModuleHandle(NULL)
135 #endif
136
137 #ifndef iswhite
138 #define iswhite(_ch) ( ((_ch)==TEXT(' ')) || ((_ch)==TEXT('\t')) || ((_ch)==TEXT('\r')) || ((_ch)==TEXT('\n')) )
139 #endif
140
141 #ifndef cxRECT
142 #define cxRECT(_r) ((_r).right - (_r).left)
143 #endif
144
145 #ifndef cyRECT
146 #define cyRECT(_r) ((_r).bottom - (_r).top)
147 #endif
148
149 #ifndef REALLOC
150 #define REALLOC(_a,_c,_r,_i) AfsCredsReallocFunction ((LPVOID*)&_a,sizeof(*_a),&_c,_r,_i)
151 #endif
152
153
154 /*
155  * PROTOTYPES _________________________________________________________________
156  *
157  */
158
159 void Quit (void);
160
161 BOOL AfsCredsReallocFunction (LPVOID *ppTarget, size_t cbElement, size_t *pcTarget, size_t cReq, size_t cInc);
162
163 void LoadRemind (size_t iCreds);
164 void SaveRemind (size_t iCreds);
165
166 void TimeToSystemTime (SYSTEMTIME *pst, time_t TimeT);
167
168 LPARAM GetTabParam (HWND hTab, int iTab);
169 HWND GetTabChild (HWND hTab);
170
171
172 #endif
173