14e51a8c7e6246b456737f7b1925ebc32e1eb688
[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 #include <windows.h>
21 #include <commctrl.h>
22 #include <regstr.h>
23 #include <time.h>
24 #include <shellapi.h>
25 #include <WINNT/al_wizard.h>
26 #include "resource.h"
27 #include "checklist.h"
28 #include "window.h"
29 #include "shortcut.h"
30 #include "trayicon.h"
31 #include "creds.h"
32 #include "credstab.h"
33 #include "advtab.h"
34 #include "mounttab.h"
35 #include "afswiz.h"
36 #include "drivemap.h"
37 #include "help.hid"
38
39
40 /*
41  * REG PATHS __________________________________________________________________
42  *
43  */
44
45 #define REGSTR_BASE          HKEY_LOCAL_MACHINE
46 #define REGSTR_PATH_AFS      TEXT("Software\\TransarcCorporation\\AFS Client\\CurrentVersion")
47 #define REGSTR_PATH_AFSCREDS TEXT("Software\\TransarcCorporation\\AFS Client\\AfsCreds")
48
49 #define REGVAL_AFS_TITLE     TEXT("Title")
50 #define REGVAL_AFS_VERSION   TEXT("VersionString")
51 #define REGVAL_AFS_PATCH     TEXT("PatchLevel")
52 #define REGVAL_AFS_PATH      TEXT("PathName")
53
54 #define cszSHORTCUT_NAME     TEXT("AFS Credentials.lnk")
55
56
57 /*
58  * VARIABLES __________________________________________________________________
59  *
60  */
61
62 typedef struct
63    {
64    TCHAR szCell[ MAX_PATH ];
65    TCHAR szUser[ MAX_PATH ];
66    SYSTEMTIME stExpires;
67    BOOL fRemind;
68    } CREDS, *LPCREDS;
69
70 typedef struct
71    {
72    HWND hMain;
73    CREDS *aCreds;
74    size_t cCreds;
75    DWORD tickLastRetest;
76    LONG fShowingMessage;
77    LPWIZARD pWizard;
78    BOOL fStartup;
79    BOOL fIsWinNT;
80    TCHAR szHelpFile[ MAX_PATH ];
81    } GLOBALS;
82
83 extern GLOBALS g;
84
85
86 /*
87  * TIMING _____________________________________________________________________
88  *
89  */
90
91 #define cminREMIND_TEST      3    // test every minute for expired creds
92 #define cminREMIND_WARN      15   // warn if creds expire in 15 minutes
93
94 #define cmsecMOUSEOVER       1000 // retest freq when mouse is over tray icon
95 #define cmsecSERVICE         2000 // retest freq when starting/stopping service
96
97 #define c100ns1SECOND        (LONGLONG)10000000
98 #define cmsec1SECOND         1000
99 #define cmsec1MINUTE         60000
100 #define csec1MINUTE          60
101
102
103 #define ID_REMIND_TIMER      1000
104 #define ID_SERVICE_TIMER     1001
105 #define ID_WIZARD_TIMER      1002
106
107
108 /*
109  * MACROS _____________________________________________________________________
110  *
111  */
112
113 #ifndef FileExists
114 #define FileExists(_psz)  ((GetFileAttributes (_psz) == 0xFFFFFFFF) ? FALSE : TRUE)
115 #endif
116
117 #ifndef THIS_HINST
118 #define THIS_HINST  (HINSTANCE)GetModuleHandle(NULL)
119 #endif
120
121 #ifndef iswhite
122 #define iswhite(_ch) ( ((_ch)==TEXT(' ')) || ((_ch)==TEXT('\t')) || ((_ch)==TEXT('\r')) || ((_ch)==TEXT('\n')) )
123 #endif
124
125 #ifndef cxRECT
126 #define cxRECT(_r) ((_r).right - (_r).left)
127 #endif
128
129 #ifndef cyRECT
130 #define cyRECT(_r) ((_r).bottom - (_r).top)
131 #endif
132
133 #ifndef REALLOC
134 #define REALLOC(_a,_c,_r,_i) AfsCredsReallocFunction ((LPVOID*)&_a,sizeof(*_a),&_c,_r,_i)
135 #endif
136
137
138 /*
139  * PROTOTYPES _________________________________________________________________
140  *
141  */
142
143 void Quit (void);
144
145 BOOL AfsCredsReallocFunction (LPVOID *ppTarget, size_t cbElement, size_t *pcTarget, size_t cReq, size_t cInc);
146
147 void LoadRemind (size_t iCreds);
148 void SaveRemind (size_t iCreds);
149
150 void TimeToSystemTime (SYSTEMTIME *pst, time_t TimeT);
151
152 LPARAM GetTabParam (HWND hTab, int iTab);
153 HWND GetTabChild (HWND hTab);
154
155
156 #endif
157