ReactOS  0.4.13-dev-443-g10f00f8
nps.c
Go to the documentation of this file.
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 
34 
35 #include "wine/unicode.h"
36 
37 #include "mprres.h"
38 
39 /***********************************************************************
40  * NPS_ProxyPasswordDialog
41  */
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;
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  */
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  */
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  */
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  */
206 {
207  FIXME( "(%p): stub\n", pfNotifyCallBack );
208  return NULL;
209 }
210 
211 /*****************************************************************
212  * PwdGetPasswordStatusA [MPR.@]
213  */
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  */
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  */
235 {
236  FIXME("%s %d %d\n", debugstr_a(lpProvider), dwIndex, status );
237  return WN_SUCCESS;
238 }
239 
240 /*****************************************************************
241  * PwdSetPasswordStatusW [MPR.@]
242  */
244 {
245  FIXME("%s %d %d\n", debugstr_w(lpProvider), dwIndex, status );
246  return WN_SUCCESS;
247 }
248 
249 typedef struct _CHANGEPWDINFOA {
254 
255 typedef struct _CHANGEPWDINFOW {
260 
261 /*****************************************************************
262  * PwdChangePasswordA [MPR.@]
263  */
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  */
274 {
275  FIXME("%s %p %x %p\n", debugstr_w(lpProvider), hWnd, flags, info );
276  return WN_SUCCESS;
277 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1296
LPSTR lpPassword
Definition: nps.c:251
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define WN_SUCCESS
Definition: winnetwk.h:111
WINE_DEFAULT_DEBUG_CHANNEL(mpr)
LPWSTR lpPassword
Definition: nps.c:257
struct _CHANGEPWDINFOW CHANGEPWDINFOW
HWND hWnd
Definition: settings.c:17
DWORD WINAPI NPSGetProviderHandleA(PHPROVIDER phProvider)
Definition: nps.c:125
struct AUTHDLGSTRUCTA * LPAUTHDLGSTRUCTA
#define WN_CANCEL
Definition: winnetwk.h:114
LPSTR lpUsername
Definition: nps.c:250
UINT_PTR WPARAM
Definition: windef.h:207
#define WN_NOT_SUPPORTED
Definition: winnetwk.h:113
#define GetWindowLongPtrW
Definition: winuser.h:4698
DWORD WINAPI NPSCopyStringA(LPCSTR lpString, LPVOID lpBuffer, LPDWORD lpdwBufferSize)
Definition: nps.c:169
int32_t INT_PTR
Definition: typedefs.h:62
DWORD WINAPI PwdSetPasswordStatusW(LPCWSTR lpProvider, DWORD dwIndex, DWORD status)
Definition: nps.c:243
LPCSTR lpOUTitle
Definition: netspi.h:49
struct _CHANGEPWDINFOA CHANGEPWDINFOA
LPSTR lpUsername
Definition: netspi.h:43
char * LPSTR
Definition: xmlstorage.h:182
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
DWORD cbStructure
Definition: netspi.h:40
#define IDD_PROXYDLG
Definition: mprres.h:26
DWORD WINAPI PwdGetPasswordStatusA(LPCSTR lpProvider, DWORD dwIndex, LPDWORD status)
Definition: nps.c:214
LPWSTR lpUsername
Definition: nps.c:256
DWORD WINAPI NPSGetSectionNameA(HPROVIDER hProvider, LPCSTR *lpszSectionName)
Definition: nps.c:143
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
DWORD cbPassword
Definition: nps.c:258
#define GWLP_USERDATA
Definition: treelist.c:63
struct _CHANGEPWDINFOA * LPCHANGEPWDINFOA
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
DWORD(CALLBACK * NOTIFYCALLBACK)(LPNOTIFYINFO, LPVOID)
Definition: netspi.h:146
VOID WINAPI NPSSetCustomTextA(LPSTR lpCustomErrorText)
Definition: nps.c:161
const char * LPCSTR
Definition: xmlstorage.h:183
DWORD WINAPI PwdGetPasswordStatusW(LPCWSTR lpProvider, DWORD dwIndex, LPDWORD status)
Definition: nps.c:224
#define TRACE(s)
Definition: solgame.cpp:4
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
DWORD WINAPI PwdSetPasswordStatusA(LPCSTR lpProvider, DWORD dwIndex, DWORD status)
Definition: nps.c:234
#define debugstr_a
Definition: kernel32.h:31
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
#define WINAPI
Definition: msvc.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
LPSTR lpPassword
Definition: netspi.h:45
DWORD WINAPI NPSDeviceGetStringA(DWORD dwNumber, DWORD dwType, LPSTR lpLocalName, LPDWORD lpdwBufferSize)
Definition: nps.c:187
GLbitfield flags
Definition: glext.h:7161
DWORD WINAPI NPSGetProviderNameA(HPROVIDER hProvider, LPCSTR *lpszProviderName)
Definition: nps.c:134
LPCSTR lpExplainText
Definition: netspi.h:50
#define IDC_USERNAME
Definition: resource.h:77
static INT_PTR WINAPI NPS_ProxyPasswordDialog(HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: nps.c:42
DWORD cbPassword
Definition: nps.c:252
LPVOID WINAPI NPSNotifyGetContextA(NOTIFYCALLBACK pfNotifyCallBack)
Definition: nps.c:205
DWORD cbUsername
Definition: netspi.h:44
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
#define WN_BAD_POINTER
Definition: winnetwk.h:118
#define WM_COMMAND
Definition: winuser.h:1716
#define HPROVIDER
Definition: netspi.h:35
HPROVIDER * PHPROVIDER
Definition: netspi.h:36
DWORD WINAPI NPSDeviceGetNumberA(LPSTR lpLocalName, LPDWORD lpdwNumber, LPDWORD lpdwType)
Definition: nps.c:178
struct _CHANGEPWDINFOW * LPCHANGEPWDINFOW
unsigned int UINT
Definition: ndis.h:50
DWORD WINAPI PwdChangePasswordA(LPCSTR lpProvider, HWND hWnd, DWORD flags, LPCHANGEPWDINFOA info)
Definition: nps.c:264
DWORD cbPassword
Definition: netspi.h:46
uint32_t * LPDWORD
Definition: typedefs.h:57
DWORD WINAPI PwdChangePasswordW(LPCWSTR lpProvider, HWND hWnd, DWORD flags, LPCHANGEPWDINFOW info)
Definition: nps.c:273
DWORD WINAPI NPSNotifyRegisterA(enum NOTIFYTYPE NotifyType, NOTIFYCALLBACK pfNotifyCallBack)
Definition: nps.c:196
HWND hwndOwner
Definition: netspi.h:41
LPCSTR lpResource
Definition: netspi.h:42
#define SetWindowLongPtrW
Definition: winuser.h:5215
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
NOTIFYTYPE
Definition: netspi.h:93
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
DWORD WINAPI NPSSetExtendedErrorA(DWORD NetSpecificError, LPSTR lpExtendedErrorText)
Definition: nps.c:152
DWORD WINAPI NPSAuthenticationDialogA(LPAUTHDLGSTRUCTA lpAuthDlgStruct)
Definition: nps.c:103
#define IDC_REALM
Definition: mprres.h:29
#define IDC_PASSWORD
Definition: resource.h:12
Definition: ps.c:97
#define IDC_EXPLAIN
Definition: mprres.h:33