reshuffling of dlls
[reactos.git] / reactos / dll / mpr / nps.c
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22 #include "config.h"
23
24 #include <stdarg.h>
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "netspi.h"
30 #include "wine/debug.h"
31 #include "winerror.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(mpr);
34
35 #include "wine/unicode.h"
36
37 #include "mprres.h"
38
39 /***********************************************************************
40 * NPS_ProxyPasswordDialog
41 */
42 static INT_PTR WINAPI NPS_ProxyPasswordDialog(
43 HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
44 {
45 HWND hitem;
46 LPAUTHDLGSTRUCTA lpAuthDlgStruct;
47
48 if( uMsg == WM_INITDIALOG )
49 {
50 TRACE("WM_INITDIALOG (%08lx)\n", lParam);
51
52 /* save the parameter list */
53 lpAuthDlgStruct = (LPAUTHDLGSTRUCTA) lParam;
54 SetWindowLongPtrW( hdlg, GWLP_USERDATA, lParam );
55
56 if( lpAuthDlgStruct->lpExplainText )
57 {
58 hitem = GetDlgItem( hdlg, IDC_EXPLAIN );
59 SetWindowTextA( hitem, lpAuthDlgStruct->lpExplainText );
60 }
61
62 /* extract the Realm from the proxy response and show it */
63 if( lpAuthDlgStruct->lpResource )
64 {
65 hitem = GetDlgItem( hdlg, IDC_REALM );
66 SetWindowTextA( hitem, lpAuthDlgStruct->lpResource );
67 }
68
69 return TRUE;
70 }
71
72 lpAuthDlgStruct = (LPAUTHDLGSTRUCTA) GetWindowLongPtrW( hdlg, GWLP_USERDATA );
73
74 switch( uMsg )
75 {
76 case WM_COMMAND:
77 if( wParam == IDOK )
78 {
79 WCHAR username[0x20], password[0x20];
80
81 username[0] = 0;
82 hitem = GetDlgItem( hdlg, IDC_USERNAME );
83 if( hitem )
84 GetWindowTextA( hitem, lpAuthDlgStruct->lpUsername, lpAuthDlgStruct->cbUsername );
85
86 password[0] = 0;
87 hitem = GetDlgItem( hdlg, IDC_PASSWORD );
88 if( hitem )
89 GetWindowTextA( hitem, lpAuthDlgStruct->lpPassword, lpAuthDlgStruct->cbPassword );
90
91 EndDialog( hdlg, WN_SUCCESS );
92 return TRUE;
93 }
94 if( wParam == IDCANCEL )
95 {
96 EndDialog( hdlg, WN_CANCEL );
97 return TRUE;
98 }
99 break;
100 }
101 return FALSE;
102 }
103
104 /*****************************************************************
105 * NPSAuthenticationDialogA [MPR.@]
106 */
107 DWORD WINAPI NPSAuthenticationDialogA( LPAUTHDLGSTRUCTA lpAuthDlgStruct )
108 {
109 HMODULE hwininet = GetModuleHandleA( "mpr.dll" );
110
111 TRACE("%p\n", lpAuthDlgStruct);
112
113 if( !lpAuthDlgStruct )
114 return WN_BAD_POINTER;
115 if( lpAuthDlgStruct->cbStructure < sizeof *lpAuthDlgStruct )
116 return WN_BAD_POINTER;
117
118 TRACE("%s %s %s\n",lpAuthDlgStruct->lpResource,
119 lpAuthDlgStruct->lpOUTitle, lpAuthDlgStruct->lpExplainText);
120
121 return DialogBoxParamW( hwininet, MAKEINTRESOURCEW( IDD_PROXYDLG ),
122 lpAuthDlgStruct->hwndOwner, NPS_ProxyPasswordDialog,
123 (LPARAM) lpAuthDlgStruct );
124 }
125
126 /*****************************************************************
127 * NPSGetProviderHandleA [MPR.@]
128 */
129 DWORD WINAPI NPSGetProviderHandleA( PHPROVIDER phProvider )
130 {
131 FIXME( "(%p): stub\n", phProvider );
132 return WN_NOT_SUPPORTED;
133 }
134
135 /*****************************************************************
136 * NPSGetProviderNameA [MPR.@]
137 */
138 DWORD WINAPI NPSGetProviderNameA( HPROVIDER hProvider, LPCSTR *lpszProviderName )
139 {
140 FIXME( "(%p, %p): stub\n", hProvider, lpszProviderName );
141 return WN_NOT_SUPPORTED;
142 }
143
144 /*****************************************************************
145 * NPSGetSectionNameA [MPR.@]
146 */
147 DWORD WINAPI NPSGetSectionNameA( HPROVIDER hProvider, LPCSTR *lpszSectionName )
148 {
149 FIXME( "(%p, %p): stub\n", hProvider, lpszSectionName );
150 return WN_NOT_SUPPORTED;
151 }
152
153 /*****************************************************************
154 * NPSSetExtendedErrorA [MPR.@]
155 */
156 DWORD WINAPI NPSSetExtendedErrorA( DWORD NetSpecificError, LPSTR lpExtendedErrorText )
157 {
158 FIXME( "(%08lx, %s): stub\n", NetSpecificError, debugstr_a(lpExtendedErrorText) );
159 return WN_NOT_SUPPORTED;
160 }
161
162 /*****************************************************************
163 * NPSSetCustomTextA [MPR.@]
164 */
165 VOID WINAPI NPSSetCustomTextA( LPSTR lpCustomErrorText )
166 {
167 FIXME( "(%s): stub\n", debugstr_a(lpCustomErrorText) );
168 }
169
170 /*****************************************************************
171 * NPSCopyStringA [MPR.@]
172 */
173 DWORD WINAPI NPSCopyStringA( LPCSTR lpString, LPVOID lpBuffer, LPDWORD lpdwBufferSize )
174 {
175 FIXME( "(%s, %p, %p): stub\n", debugstr_a(lpString), lpBuffer, lpdwBufferSize );
176 return WN_NOT_SUPPORTED;
177 }
178
179 /*****************************************************************
180 * NPSDeviceGetNumberA [MPR.@]
181 */
182 DWORD WINAPI NPSDeviceGetNumberA( LPSTR lpLocalName, LPDWORD lpdwNumber, LPDWORD lpdwType )
183 {
184 FIXME( "(%s, %p, %p): stub\n", debugstr_a(lpLocalName), lpdwNumber, lpdwType );
185 return WN_NOT_SUPPORTED;
186 }
187
188 /*****************************************************************
189 * NPSDeviceGetStringA [MPR.@]
190 */
191 DWORD WINAPI NPSDeviceGetStringA( DWORD dwNumber, DWORD dwType, LPSTR lpLocalName, LPDWORD lpdwBufferSize )
192 {
193 FIXME( "(%ld, %ld, %p, %p): stub\n", dwNumber, dwType, lpLocalName, lpdwBufferSize );
194 return WN_NOT_SUPPORTED;
195 }
196
197 /*****************************************************************
198 * NPSNotifyRegisterA [MPR.@]
199 */
200 DWORD WINAPI NPSNotifyRegisterA( enum NOTIFYTYPE NotifyType, NOTIFYCALLBACK pfNotifyCallBack )
201 {
202 FIXME( "(%d, %p): stub\n", NotifyType, pfNotifyCallBack );
203 return WN_NOT_SUPPORTED;
204 }
205
206 /*****************************************************************
207 * NPSNotifyGetContextA [MPR.@]
208 */
209 LPVOID WINAPI NPSNotifyGetContextA( NOTIFYCALLBACK pfNotifyCallBack )
210 {
211 FIXME( "(%p): stub\n", pfNotifyCallBack );
212 return NULL;
213 }