xref: /reactos/dll/win32/mpr/nps.c (revision 84ccccab)
1 /*
2  * MPR Network Provider Services functions
3  *
4  * Copyright 1999 Ulrich Weigand
5  * Copyright 2004 Mike McCormack for CodeWeavers Inc.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21 
22 #include "precomp.h"
23 
24 #include "netspi.h"
25 
26 /***********************************************************************
27  *         NPS_ProxyPasswordDialog
28  */
29 static INT_PTR WINAPI NPS_ProxyPasswordDialog(
30     HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
31 {
32     HWND hitem;
33     LPAUTHDLGSTRUCTA lpAuthDlgStruct;
34 
35     if( uMsg == WM_INITDIALOG )
36     {
37         TRACE("WM_INITDIALOG (%08lx)\n", lParam);
38 
39         /* save the parameter list */
40         lpAuthDlgStruct = (LPAUTHDLGSTRUCTA) lParam;
41         SetWindowLongPtrW( hdlg, GWLP_USERDATA, lParam );
42 
43         if( lpAuthDlgStruct->lpExplainText )
44         {
45             hitem = GetDlgItem( hdlg, IDC_EXPLAIN );
46             SetWindowTextA( hitem, lpAuthDlgStruct->lpExplainText );
47         }
48 
49         /* extract the Realm from the proxy response and show it */
50         if( lpAuthDlgStruct->lpResource )
51         {
52             hitem = GetDlgItem( hdlg, IDC_REALM );
53             SetWindowTextA( hitem, lpAuthDlgStruct->lpResource );
54         }
55 
56         return TRUE;
57     }
58 
59     lpAuthDlgStruct = (LPAUTHDLGSTRUCTA) GetWindowLongPtrW( hdlg, GWLP_USERDATA );
60 
61     switch( uMsg )
62     {
63     case WM_COMMAND:
64         if( wParam == IDOK )
65         {
66             hitem = GetDlgItem( hdlg, IDC_USERNAME );
67             if( hitem )
68                 GetWindowTextA( hitem, lpAuthDlgStruct->lpUsername, lpAuthDlgStruct->cbUsername );
69 
70             hitem = GetDlgItem( hdlg, IDC_PASSWORD );
71             if( hitem )
72                 GetWindowTextA( hitem, lpAuthDlgStruct->lpPassword, lpAuthDlgStruct->cbPassword );
73 
74             EndDialog( hdlg, WN_SUCCESS );
75             return TRUE;
76         }
77         if( wParam == IDCANCEL )
78         {
79             EndDialog( hdlg, WN_CANCEL );
80             return TRUE;
81         }
82         break;
83     }
84     return FALSE;
85 }
86 
87 /*****************************************************************
88  *  NPSAuthenticationDialogA [MPR.@]
89  */
90 DWORD WINAPI NPSAuthenticationDialogA( LPAUTHDLGSTRUCTA lpAuthDlgStruct )
91 {
92     HMODULE hwininet = GetModuleHandleA( "mpr.dll" );
93 
94     TRACE("%p\n", lpAuthDlgStruct);
95 
96     if( !lpAuthDlgStruct )
97         return WN_BAD_POINTER;
98     if( lpAuthDlgStruct->cbStructure < sizeof *lpAuthDlgStruct )
99         return WN_BAD_POINTER;
100 
101     TRACE("%s %s %s\n",lpAuthDlgStruct->lpResource,
102           lpAuthDlgStruct->lpOUTitle, lpAuthDlgStruct->lpExplainText);
103 
104     return DialogBoxParamW( hwininet, MAKEINTRESOURCEW( IDD_PROXYDLG ),
105              lpAuthDlgStruct->hwndOwner, NPS_ProxyPasswordDialog,
106              (LPARAM) lpAuthDlgStruct );
107 }
108 
109 /*****************************************************************
110  *  NPSGetProviderHandleA [MPR.@]
111  */
112 DWORD WINAPI NPSGetProviderHandleA( PHPROVIDER phProvider )
113 {
114     FIXME( "(%p): stub\n", phProvider );
115     return WN_NOT_SUPPORTED;
116 }
117 
118 /*****************************************************************
119  *  NPSGetProviderNameA [MPR.@]
120  */
121 DWORD WINAPI NPSGetProviderNameA( HPROVIDER hProvider, LPCSTR *lpszProviderName )
122 {
123     FIXME( "(%p, %p): stub\n", hProvider, lpszProviderName );
124     return WN_NOT_SUPPORTED;
125 }
126 
127 /*****************************************************************
128  *  NPSGetSectionNameA [MPR.@]
129  */
130 DWORD WINAPI NPSGetSectionNameA( HPROVIDER hProvider, LPCSTR *lpszSectionName )
131 {
132     FIXME( "(%p, %p): stub\n", hProvider, lpszSectionName );
133     return WN_NOT_SUPPORTED;
134 }
135 
136 /*****************************************************************
137  *  NPSSetExtendedErrorA [MPR.@]
138  */
139 DWORD WINAPI NPSSetExtendedErrorA( DWORD NetSpecificError, LPSTR lpExtendedErrorText )
140 {
141     FIXME( "(%08x, %s): stub\n", NetSpecificError, debugstr_a(lpExtendedErrorText) );
142     return WN_NOT_SUPPORTED;
143 }
144 
145 /*****************************************************************
146  *  NPSSetCustomTextA [MPR.@]
147  */
148 VOID WINAPI NPSSetCustomTextA( LPSTR lpCustomErrorText )
149 {
150     FIXME( "(%s): stub\n", debugstr_a(lpCustomErrorText) );
151 }
152 
153 /*****************************************************************
154  *  NPSCopyStringA [MPR.@]
155  */
156 DWORD WINAPI NPSCopyStringA( LPCSTR lpString, LPVOID lpBuffer, LPDWORD lpdwBufferSize )
157 {
158     FIXME( "(%s, %p, %p): stub\n", debugstr_a(lpString), lpBuffer, lpdwBufferSize );
159     return WN_NOT_SUPPORTED;
160 }
161 
162 /*****************************************************************
163  *  NPSDeviceGetNumberA [MPR.@]
164  */
165 DWORD WINAPI NPSDeviceGetNumberA( LPSTR lpLocalName, LPDWORD lpdwNumber, LPDWORD lpdwType )
166 {
167     FIXME( "(%s, %p, %p): stub\n", debugstr_a(lpLocalName), lpdwNumber, lpdwType );
168     return WN_NOT_SUPPORTED;
169 }
170 
171 /*****************************************************************
172  *  NPSDeviceGetStringA [MPR.@]
173  */
174 DWORD WINAPI NPSDeviceGetStringA( DWORD dwNumber, DWORD dwType, LPSTR lpLocalName, LPDWORD lpdwBufferSize )
175 {
176     FIXME( "(%d, %d, %p, %p): stub\n", dwNumber, dwType, lpLocalName, lpdwBufferSize );
177     return WN_NOT_SUPPORTED;
178 }
179 
180 /*****************************************************************
181  *  NPSNotifyRegisterA [MPR.@]
182  */
183 DWORD WINAPI NPSNotifyRegisterA( enum NOTIFYTYPE NotifyType, NOTIFYCALLBACK pfNotifyCallBack )
184 {
185     FIXME( "(%d, %p): stub\n", NotifyType, pfNotifyCallBack );
186     return WN_NOT_SUPPORTED;
187 }
188 
189 /*****************************************************************
190  *  NPSNotifyGetContextA [MPR.@]
191  */
192 LPVOID WINAPI NPSNotifyGetContextA( NOTIFYCALLBACK pfNotifyCallBack )
193 {
194     FIXME( "(%p): stub\n", pfNotifyCallBack );
195     return NULL;
196 }
197 
198 /*****************************************************************
199  *  PwdGetPasswordStatusA [MPR.@]
200  */
201 DWORD WINAPI PwdGetPasswordStatusA( LPCSTR lpProvider, DWORD dwIndex, LPDWORD status )
202 {
203     FIXME("%s %d %p\n", debugstr_a(lpProvider), dwIndex, status );
204     *status = 0;
205     return WN_SUCCESS;
206 }
207 
208 /*****************************************************************
209  *  PwdGetPasswordStatusA [MPR.@]
210  */
211 DWORD WINAPI PwdGetPasswordStatusW( LPCWSTR lpProvider, DWORD dwIndex, LPDWORD status )
212 {
213     FIXME("%s %d %p\n", debugstr_w(lpProvider), dwIndex, status );
214     *status = 0;
215     return WN_SUCCESS;
216 }
217 
218 /*****************************************************************
219  *  PwdSetPasswordStatusA [MPR.@]
220  */
221 DWORD WINAPI PwdSetPasswordStatusA( LPCSTR lpProvider, DWORD dwIndex, DWORD status )
222 {
223     FIXME("%s %d %d\n", debugstr_a(lpProvider), dwIndex, status );
224     return WN_SUCCESS;
225 }
226 
227 /*****************************************************************
228  *  PwdSetPasswordStatusW [MPR.@]
229  */
230 DWORD WINAPI PwdSetPasswordStatusW( LPCWSTR lpProvider, DWORD dwIndex, DWORD status )
231 {
232     FIXME("%s %d %d\n", debugstr_w(lpProvider), dwIndex, status );
233     return WN_SUCCESS;
234 }
235 
236 typedef struct _CHANGEPWDINFOA {
237     LPSTR lpUsername;
238     LPSTR lpPassword;
239     DWORD cbPassword;
240 } CHANGEPWDINFOA, *LPCHANGEPWDINFOA;
241 
242 typedef struct _CHANGEPWDINFOW {
243     LPWSTR lpUsername;
244     LPWSTR lpPassword;
245     DWORD cbPassword;
246 } CHANGEPWDINFOW, *LPCHANGEPWDINFOW;
247 
248 /*****************************************************************
249  *  PwdChangePasswordA [MPR.@]
250  */
251 DWORD WINAPI PwdChangePasswordA( LPCSTR lpProvider, HWND hWnd, DWORD flags, LPCHANGEPWDINFOA info )
252 {
253     FIXME("%s %p %x %p\n", debugstr_a(lpProvider), hWnd, flags, info );
254     return WN_SUCCESS;
255 }
256 
257 /*****************************************************************
258  *  PwdChangePasswordA [MPR.@]
259  */
260 DWORD WINAPI PwdChangePasswordW( LPCWSTR lpProvider, HWND hWnd, DWORD flags, LPCHANGEPWDINFOW info )
261 {
262     FIXME("%s %p %x %p\n", debugstr_w(lpProvider), hWnd, flags, info );
263     return WN_SUCCESS;
264 }
265