Add proxy authentication dialog.
[wine/testsucceed.git] / dlls / mpr / nps.c
bloba4e478d94f18b651bd003470b9d1f5206c1c9672
1 /*
2 * MPR Network Provider Services functions
4 * Copyright 1999 Ulrich Weigand
5 * Copyright 2004 Mike McCormack for CodeWeavers Inc.
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.
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.
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
22 #include "config.h"
24 #include <stdarg.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "winnetwk.h"
30 #include "netspi.h"
31 #include "wine/debug.h"
32 #include "winerror.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(mpr);
36 #include "wine/unicode.h"
38 #include "mprres.h"
40 /***********************************************************************
41 * NPS_ProxyPasswordDialog
43 static INT_PTR WINAPI NPS_ProxyPasswordDialog(
44 HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
46 HWND hitem;
47 LPAUTHDLGSTRUCTA lpAuthDlgStruct;
49 if( uMsg == WM_INITDIALOG )
51 TRACE("WM_INITDIALOG (%08lx)\n", lParam);
53 /* save the parameter list */
54 lpAuthDlgStruct = (LPAUTHDLGSTRUCTA) lParam;
55 SetWindowLongPtrW( hdlg, GWLP_USERDATA, lParam );
57 if( lpAuthDlgStruct->lpExplainText )
59 hitem = GetDlgItem( hdlg, IDC_EXPLAIN );
60 SetWindowTextA( hitem, lpAuthDlgStruct->lpExplainText );
63 /* extract the Realm from the proxy response and show it */
64 if( lpAuthDlgStruct->lpResource )
66 hitem = GetDlgItem( hdlg, IDC_REALM );
67 SetWindowTextA( hitem, lpAuthDlgStruct->lpResource );
70 return TRUE;
73 lpAuthDlgStruct = (LPAUTHDLGSTRUCTA) GetWindowLongPtrW( hdlg, GWLP_USERDATA );
75 switch( uMsg )
77 case WM_COMMAND:
78 if( wParam == IDOK )
80 WCHAR username[0x20], password[0x20];
82 username[0] = 0;
83 hitem = GetDlgItem( hdlg, IDC_USERNAME );
84 if( hitem )
85 GetWindowTextA( hitem, lpAuthDlgStruct->lpUsername, lpAuthDlgStruct->cbUsername );
87 password[0] = 0;
88 hitem = GetDlgItem( hdlg, IDC_PASSWORD );
89 if( hitem )
90 GetWindowTextA( hitem, lpAuthDlgStruct->lpPassword, lpAuthDlgStruct->cbPassword );
92 EndDialog( hdlg, WN_SUCCESS );
93 return TRUE;
95 if( wParam == IDCANCEL )
97 EndDialog( hdlg, WN_CANCEL );
98 return TRUE;
100 break;
102 return FALSE;
105 /*****************************************************************
106 * NPSAuthenticationDialogA [MPR.@]
108 DWORD WINAPI NPSAuthenticationDialogA( LPAUTHDLGSTRUCTA lpAuthDlgStruct )
110 HMODULE hwininet = GetModuleHandleA( "mpr.dll" );
112 TRACE("%p\n", lpAuthDlgStruct);
114 if( !lpAuthDlgStruct )
115 return WN_BAD_POINTER;
116 if( lpAuthDlgStruct->cbStructure < sizeof *lpAuthDlgStruct )
117 return WN_BAD_POINTER;
119 TRACE("%s %s %s\n",lpAuthDlgStruct->lpResource,
120 lpAuthDlgStruct->lpOUTitle, lpAuthDlgStruct->lpExplainText);
122 return DialogBoxParamW( hwininet, MAKEINTRESOURCEW( IDD_PROXYDLG ),
123 lpAuthDlgStruct->hwndOwner, NPS_ProxyPasswordDialog,
124 (LPARAM) lpAuthDlgStruct );
127 /*****************************************************************
128 * NPSGetProviderHandleA [MPR.@]
130 DWORD WINAPI NPSGetProviderHandleA( PHPROVIDER phProvider )
132 FIXME( "(%p): stub\n", phProvider );
133 return WN_NOT_SUPPORTED;
136 /*****************************************************************
137 * NPSGetProviderNameA [MPR.@]
139 DWORD WINAPI NPSGetProviderNameA( HPROVIDER hProvider, LPCSTR *lpszProviderName )
141 FIXME( "(%p, %p): stub\n", hProvider, lpszProviderName );
142 return WN_NOT_SUPPORTED;
145 /*****************************************************************
146 * NPSGetSectionNameA [MPR.@]
148 DWORD WINAPI NPSGetSectionNameA( HPROVIDER hProvider, LPCSTR *lpszSectionName )
150 FIXME( "(%p, %p): stub\n", hProvider, lpszSectionName );
151 return WN_NOT_SUPPORTED;
154 /*****************************************************************
155 * NPSSetExtendedErrorA [MPR.@]
157 DWORD WINAPI NPSSetExtendedErrorA( DWORD NetSpecificError, LPSTR lpExtendedErrorText )
159 FIXME( "(%08lx, %s): stub\n", NetSpecificError, debugstr_a(lpExtendedErrorText) );
160 return WN_NOT_SUPPORTED;
163 /*****************************************************************
164 * NPSSetCustomTextA [MPR.@]
166 VOID WINAPI NPSSetCustomTextA( LPSTR lpCustomErrorText )
168 FIXME( "(%s): stub\n", debugstr_a(lpCustomErrorText) );
171 /*****************************************************************
172 * NPSCopyStringA [MPR.@]
174 DWORD WINAPI NPSCopyStringA( LPCSTR lpString, LPVOID lpBuffer, LPDWORD lpdwBufferSize )
176 FIXME( "(%s, %p, %p): stub\n", debugstr_a(lpString), lpBuffer, lpdwBufferSize );
177 return WN_NOT_SUPPORTED;
180 /*****************************************************************
181 * NPSDeviceGetNumberA [MPR.@]
183 DWORD WINAPI NPSDeviceGetNumberA( LPSTR lpLocalName, LPDWORD lpdwNumber, LPDWORD lpdwType )
185 FIXME( "(%s, %p, %p): stub\n", debugstr_a(lpLocalName), lpdwNumber, lpdwType );
186 return WN_NOT_SUPPORTED;
189 /*****************************************************************
190 * NPSDeviceGetStringA [MPR.@]
192 DWORD WINAPI NPSDeviceGetStringA( DWORD dwNumber, DWORD dwType, LPSTR lpLocalName, LPDWORD lpdwBufferSize )
194 FIXME( "(%ld, %ld, %p, %p): stub\n", dwNumber, dwType, lpLocalName, lpdwBufferSize );
195 return WN_NOT_SUPPORTED;
198 /*****************************************************************
199 * NPSNotifyRegisterA [MPR.@]
201 DWORD WINAPI NPSNotifyRegisterA( enum NOTIFYTYPE NotifyType, NOTIFYCALLBACK pfNotifyCallBack )
203 FIXME( "(%d, %p): stub\n", NotifyType, pfNotifyCallBack );
204 return WN_NOT_SUPPORTED;
207 /*****************************************************************
208 * NPSNotifyGetContextA [MPR.@]
210 LPVOID WINAPI NPSNotifyGetContextA( NOTIFYCALLBACK pfNotifyCallBack )
212 FIXME( "(%p): stub\n", pfNotifyCallBack );
213 return NULL;