Windows: afslogon network provider debug registry value
[openafs.git] / src / WINNT / afsd / afslogon.h
1 /*
2
3 Copyright 2004 by the Massachusetts Institute of Technology
4
5 All rights reserved.
6
7 Permission to use, copy, modify, and distribute this software and its
8 documentation for any purpose and without fee is hereby granted,
9 provided that the above copyright notice appear in all copies and that
10 both that copyright notice and this permission notice appear in
11 supporting documentation, and that the name of the Massachusetts
12 Institute of Technology (M.I.T.) not be used in advertising or publicity
13 pertaining to distribution of the software without specific, written
14 prior permission.
15
16 M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
17 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
18 M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
19 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
21 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
22 SOFTWARE.
23
24 */
25
26 /* We only support VC 1200 and above anyway */
27 #pragma once
28
29 #include <windows.h>
30 #include <objbase.h>
31 #include <npapi.h>
32 #if (_WIN32_WINNT < 0x0501)
33 #undef _WIN32_WINNT
34 #define _WIN32_WINNT 0x0501
35 #endif
36 #include <ntsecapi.h>
37 #include <tchar.h>
38 #include <strsafe.h>
39
40
41 #define REG_CLIENT_DOMAINS_SUBKEY       "Domain"
42 #define REG_CLIENT_RETRY_INTERVAL_PARM  "LoginRetryInterval"
43 #define REG_CLIENT_SLEEP_INTERVAL_PARM  "LoginSleepInterval"
44 #define REG_CLIENT_FAIL_SILENTLY_PARM   "FailLoginsSilently"
45 #define REG_CLIENT_TRACE_OPTION_PARM    "TraceOption"
46 #define REG_CLIENT_LOGON_OPTION_PARM    "LogonOptions"
47 #define REG_CLIENT_LOGON_SCRIPT_PARMW   L"LogonScript"
48 #define REG_CLIENT_DEBUG_PARM           "Debug"
49 #define REG_CLIENT_REALM_PARM           "Realm"
50 #define REG_CLIENT_THESE_CELLS_PARM     "TheseCells"
51 #define REG_CLIENT_LOGOFF_TOKENS_PARM   "LogoffPreserveTokens"
52 #define DEFAULT_RETRY_INTERVAL          60                        /* seconds*/
53 #define DEFAULT_FAIL_SILENTLY           FALSE
54 #define DEFAULT_SLEEP_INTERVAL          5                         /* seconds*/
55 #define DEFAULT_LOGON_OPTION                    1
56
57 #define TRACE_OPTION_EVENT 1
58
59 #define ISLOGONTRACE(v) ( ((v) & TRACE_OPTION_EVENT)==TRACE_OPTION_EVENT)
60
61 #define ISLOGONINTEGRATED(v) ( ((v) & LOGON_OPTION_INTEGRATED)==LOGON_OPTION_INTEGRATED)
62 #define ISHIGHSECURITY(v) ( ((v) & LOGON_OPTION_HIGHSECURITY)==LOGON_OPTION_HIGHSECURITY)
63
64 #define ISREMOTE(v) ( ((v) & LOGON_FLAG_REMOTE)==LOGON_FLAG_REMOTE)
65 #define ISADREALM(v) ( ((v) & LOGON_FLAG_AD_REALM)==LOGON_FLAG_AD_REALM)
66 extern DWORD TraceOption;
67
68 #define LOGON_FLAG_LOCAL        0
69 #define LOGON_FLAG_REMOTE       1
70 #define LOGON_FLAG_AD_REALM 2
71
72 typedef struct LogonOptions_type {
73         DWORD   LogonOption;
74         BOOLEAN failSilently;
75         int     retryInterval;
76         int     sleepInterval;
77         char *  smbName;
78         LPWSTR  logonScript;
79         DWORD   flags; /* LOGON_FLAG_* */
80         char *  theseCells;
81         char *  realm;
82 } LogonOptions_t;
83
84 /* */
85 #define MAX_USERNAME_LENGTH 256
86 #define MAX_PASSWORD_LENGTH 256
87 #define MAX_DOMAIN_LENGTH 256
88
89 BOOLEAN APIENTRY DllEntryPoint(HANDLE dll, DWORD reason, PVOID reserved);
90
91 DWORD APIENTRY NPGetCaps(DWORD index);
92
93 DWORD APIENTRY NPLogonNotify(
94         PLUID lpLogonId,
95         LPCWSTR lpAuthentInfoType,
96         LPVOID lpAuthentInfo,
97         LPCWSTR lpPreviousAuthentInfoType,
98         LPVOID lpPreviousAuthentInfo,
99         LPWSTR lpStationName,
100         LPVOID StationHandle,
101         LPWSTR *lpLogonScript);
102
103 DWORD APIENTRY NPPasswordChangeNotify(
104         LPCWSTR lpAuthentInfoType,
105         LPVOID lpAuthentInfo,
106         LPCWSTR lpPreviousAuthentInfoType,
107         LPVOID lpPreviousAuthentInfo,
108         LPWSTR lpStationName,
109         LPVOID StationHandle,
110         DWORD dwChangeInfo);
111
112 #ifdef __cplusplus
113 extern "C" {
114 #endif
115
116 void DebugEvent0(char *a);
117 void DebugEvent(char *b,...);
118
119 CHAR *GenRandomName(CHAR *pbuf);
120
121 BOOLEAN AFSWillAutoStart(void);
122
123 DWORD MapAuthError(DWORD code);
124
125 BOOL IsServiceRunning (void);
126
127 static BOOL WINAPI UnicodeStringToANSI(UNICODE_STRING uInputString, LPSTR lpszOutputString, int nOutStringLen);
128
129 void GetDomainLogonOptions( PLUID lpLogonId, char * username, char * domain, LogonOptions_t *opt );
130 DWORD GetFileCellName(char * path, char * cell, size_t cellLen);
131 DWORD GetAdHomePath(char * homePath, size_t homePathLen, PLUID lpLogonId, LogonOptions_t * opt);
132 DWORD QueryAdHomePathFromSid(char * homePath, size_t homePathLen, PSID psid, PWSTR domain);
133 BOOL GetLocalShortDomain(PWSTR Domain, DWORD cbDomain);
134
135 #ifdef __cplusplus
136 }
137 #endif