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 "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 hitem = GetDlgItem( hdlg, IDC_USERNAME ); 80 if( hitem ) 81 GetWindowTextA( hitem, lpAuthDlgStruct->lpUsername, lpAuthDlgStruct->cbUsername ); 82 83 hitem = GetDlgItem( hdlg, IDC_PASSWORD ); 84 if( hitem ) 85 GetWindowTextA( hitem, lpAuthDlgStruct->lpPassword, lpAuthDlgStruct->cbPassword ); 86 87 EndDialog( hdlg, WN_SUCCESS ); 88 return TRUE; 89 } 90 if( wParam == IDCANCEL ) 91 { 92 EndDialog( hdlg, WN_CANCEL ); 93 return TRUE; 94 } 95 break; 96 } 97 return FALSE; 98 } 99 100 /***************************************************************** 101 * NPSAuthenticationDialogA [MPR.@] 102 */ 103 DWORD WINAPI NPSAuthenticationDialogA( LPAUTHDLGSTRUCTA lpAuthDlgStruct ) 104 { 105 HMODULE hwininet = GetModuleHandleA( "mpr.dll" ); 106 107 TRACE("%p\n", lpAuthDlgStruct); 108 109 if( !lpAuthDlgStruct ) 110 return WN_BAD_POINTER; 111 if( lpAuthDlgStruct->cbStructure < sizeof *lpAuthDlgStruct ) 112 return WN_BAD_POINTER; 113 114 TRACE("%s %s %s\n",lpAuthDlgStruct->lpResource, 115 lpAuthDlgStruct->lpOUTitle, lpAuthDlgStruct->lpExplainText); 116 117 return DialogBoxParamW( hwininet, MAKEINTRESOURCEW( IDD_PROXYDLG ), 118 lpAuthDlgStruct->hwndOwner, NPS_ProxyPasswordDialog, 119 (LPARAM) lpAuthDlgStruct ); 120 } 121 122 /***************************************************************** 123 * NPSGetProviderHandleA [MPR.@] 124 */ 125 DWORD WINAPI NPSGetProviderHandleA( PHPROVIDER phProvider ) 126 { 127 FIXME( "(%p): stub\n", phProvider ); 128 return WN_NOT_SUPPORTED; 129 } 130 131 /***************************************************************** 132 * NPSGetProviderNameA [MPR.@] 133 */ 134 DWORD WINAPI NPSGetProviderNameA( HPROVIDER hProvider, LPCSTR *lpszProviderName ) 135 { 136 FIXME( "(%p, %p): stub\n", hProvider, lpszProviderName ); 137 return WN_NOT_SUPPORTED; 138 } 139 140 /***************************************************************** 141 * NPSGetSectionNameA [MPR.@] 142 */ 143 DWORD WINAPI NPSGetSectionNameA( HPROVIDER hProvider, LPCSTR *lpszSectionName ) 144 { 145 FIXME( "(%p, %p): stub\n", hProvider, lpszSectionName ); 146 return WN_NOT_SUPPORTED; 147 } 148 149 /***************************************************************** 150 * NPSSetExtendedErrorA [MPR.@] 151 */ 152 DWORD WINAPI NPSSetExtendedErrorA( DWORD NetSpecificError, LPSTR lpExtendedErrorText ) 153 { 154 FIXME( "(%08x, %s): stub\n", NetSpecificError, debugstr_a(lpExtendedErrorText) ); 155 return WN_NOT_SUPPORTED; 156 } 157 158 /***************************************************************** 159 * NPSSetCustomTextA [MPR.@] 160 */ 161 VOID WINAPI NPSSetCustomTextA( LPSTR lpCustomErrorText ) 162 { 163 FIXME( "(%s): stub\n", debugstr_a(lpCustomErrorText) ); 164 } 165 166 /***************************************************************** 167 * NPSCopyStringA [MPR.@] 168 */ 169 DWORD WINAPI NPSCopyStringA( LPCSTR lpString, LPVOID lpBuffer, LPDWORD lpdwBufferSize ) 170 { 171 FIXME( "(%s, %p, %p): stub\n", debugstr_a(lpString), lpBuffer, lpdwBufferSize ); 172 return WN_NOT_SUPPORTED; 173 } 174 175 /***************************************************************** 176 * NPSDeviceGetNumberA [MPR.@] 177 */ 178 DWORD WINAPI NPSDeviceGetNumberA( LPSTR lpLocalName, LPDWORD lpdwNumber, LPDWORD lpdwType ) 179 { 180 FIXME( "(%s, %p, %p): stub\n", debugstr_a(lpLocalName), lpdwNumber, lpdwType ); 181 return WN_NOT_SUPPORTED; 182 } 183 184 /***************************************************************** 185 * NPSDeviceGetStringA [MPR.@] 186 */ 187 DWORD WINAPI NPSDeviceGetStringA( DWORD dwNumber, DWORD dwType, LPSTR lpLocalName, LPDWORD lpdwBufferSize ) 188 { 189 FIXME( "(%d, %d, %p, %p): stub\n", dwNumber, dwType, lpLocalName, lpdwBufferSize ); 190 return WN_NOT_SUPPORTED; 191 } 192 193 /***************************************************************** 194 * NPSNotifyRegisterA [MPR.@] 195 */ 196 DWORD WINAPI NPSNotifyRegisterA( enum NOTIFYTYPE NotifyType, NOTIFYCALLBACK pfNotifyCallBack ) 197 { 198 FIXME( "(%d, %p): stub\n", NotifyType, pfNotifyCallBack ); 199 return WN_NOT_SUPPORTED; 200 } 201 202 /***************************************************************** 203 * NPSNotifyGetContextA [MPR.@] 204 */ 205 LPVOID WINAPI NPSNotifyGetContextA( NOTIFYCALLBACK pfNotifyCallBack ) 206 { 207 FIXME( "(%p): stub\n", pfNotifyCallBack ); 208 return NULL; 209 } 210 211 /***************************************************************** 212 * PwdGetPasswordStatusA [MPR.@] 213 */ 214 DWORD WINAPI PwdGetPasswordStatusA( LPCSTR lpProvider, DWORD dwIndex, LPDWORD status ) 215 { 216 FIXME("%s %d %p\n", debugstr_a(lpProvider), dwIndex, status ); 217 *status = 0; 218 return WN_SUCCESS; 219 } 220 221 /***************************************************************** 222 * PwdGetPasswordStatusA [MPR.@] 223 */ 224 DWORD WINAPI PwdGetPasswordStatusW( LPCWSTR lpProvider, DWORD dwIndex, LPDWORD status ) 225 { 226 FIXME("%s %d %p\n", debugstr_w(lpProvider), dwIndex, status ); 227 *status = 0; 228 return WN_SUCCESS; 229 } 230 231 /***************************************************************** 232 * PwdSetPasswordStatusA [MPR.@] 233 */ 234 DWORD WINAPI PwdSetPasswordStatusA( LPCSTR lpProvider, DWORD dwIndex, DWORD status ) 235 { 236 FIXME("%s %d %d\n", debugstr_a(lpProvider), dwIndex, status ); 237 return WN_SUCCESS; 238 } 239 240 /***************************************************************** 241 * PwdSetPasswordStatusW [MPR.@] 242 */ 243 DWORD WINAPI PwdSetPasswordStatusW( LPCWSTR lpProvider, DWORD dwIndex, DWORD status ) 244 { 245 FIXME("%s %d %d\n", debugstr_w(lpProvider), dwIndex, status ); 246 return WN_SUCCESS; 247 } 248 249 typedef struct _CHANGEPWDINFOA { 250 LPSTR lpUsername; 251 LPSTR lpPassword; 252 DWORD cbPassword; 253 } CHANGEPWDINFOA, *LPCHANGEPWDINFOA; 254 255 typedef struct _CHANGEPWDINFOW { 256 LPWSTR lpUsername; 257 LPWSTR lpPassword; 258 DWORD cbPassword; 259 } CHANGEPWDINFOW, *LPCHANGEPWDINFOW; 260 261 /***************************************************************** 262 * PwdChangePasswordA [MPR.@] 263 */ 264 DWORD WINAPI PwdChangePasswordA( LPCSTR lpProvider, HWND hWnd, DWORD flags, LPCHANGEPWDINFOA info ) 265 { 266 FIXME("%s %p %x %p\n", debugstr_a(lpProvider), hWnd, flags, info ); 267 return WN_SUCCESS; 268 } 269 270 /***************************************************************** 271 * PwdChangePasswordA [MPR.@] 272 */ 273 DWORD WINAPI PwdChangePasswordW( LPCWSTR lpProvider, HWND hWnd, DWORD flags, LPCHANGEPWDINFOW info ) 274 { 275 FIXME("%s %p %x %p\n", debugstr_w(lpProvider), hWnd, flags, info ); 276 return WN_SUCCESS; 277 } 278