nps.c 8.29 KB
Newer Older
1 2
/*
 * MPR Network Provider Services functions
3 4
 *
 * Copyright 1999 Ulrich Weigand
5
 * Copyright 2004 Mike McCormack for CodeWeavers Inc.
6 7 8 9 10 11 12 13 14 15 16 17 18
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * 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 23
#include "config.h"

24 25 26
#include <stdarg.h>

#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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
#include "wine/unicode.h"

#include "mprres.h"

/***********************************************************************
 *         NPS_ProxyPasswordDialog
 */
static INT_PTR WINAPI NPS_ProxyPasswordDialog(
    HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
    HWND hitem;
    LPAUTHDLGSTRUCTA lpAuthDlgStruct;

    if( uMsg == WM_INITDIALOG )
    {
        TRACE("WM_INITDIALOG (%08lx)\n", lParam);

        /* save the parameter list */
        lpAuthDlgStruct = (LPAUTHDLGSTRUCTA) lParam;
        SetWindowLongPtrW( hdlg, GWLP_USERDATA, lParam );

        if( lpAuthDlgStruct->lpExplainText )
        {
            hitem = GetDlgItem( hdlg, IDC_EXPLAIN );
            SetWindowTextA( hitem, lpAuthDlgStruct->lpExplainText );
        }

        /* extract the Realm from the proxy response and show it */
        if( lpAuthDlgStruct->lpResource )
        {
            hitem = GetDlgItem( hdlg, IDC_REALM );
            SetWindowTextA( hitem, lpAuthDlgStruct->lpResource );
        }

        return TRUE;
    }

    lpAuthDlgStruct = (LPAUTHDLGSTRUCTA) GetWindowLongPtrW( hdlg, GWLP_USERDATA );

    switch( uMsg )
    {
    case WM_COMMAND:
        if( wParam == IDOK )
        {
            hitem = GetDlgItem( hdlg, IDC_USERNAME );
            if( hitem )
                GetWindowTextA( hitem, lpAuthDlgStruct->lpUsername, lpAuthDlgStruct->cbUsername );
82

83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
            hitem = GetDlgItem( hdlg, IDC_PASSWORD );
            if( hitem )
                GetWindowTextA( hitem, lpAuthDlgStruct->lpPassword, lpAuthDlgStruct->cbPassword );

            EndDialog( hdlg, WN_SUCCESS );
            return TRUE;
        }
        if( wParam == IDCANCEL )
        {
            EndDialog( hdlg, WN_CANCEL );
            return TRUE;
        }
        break;
    }
    return FALSE;
}
99 100

/*****************************************************************
101
 *  NPSAuthenticationDialogA [MPR.@]
102 103 104
 */
DWORD WINAPI NPSAuthenticationDialogA( LPAUTHDLGSTRUCTA lpAuthDlgStruct )
{
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
    HMODULE hwininet = GetModuleHandleA( "mpr.dll" );

    TRACE("%p\n", lpAuthDlgStruct);

    if( !lpAuthDlgStruct )
        return WN_BAD_POINTER;
    if( lpAuthDlgStruct->cbStructure < sizeof *lpAuthDlgStruct )
        return WN_BAD_POINTER;

    TRACE("%s %s %s\n",lpAuthDlgStruct->lpResource,
          lpAuthDlgStruct->lpOUTitle, lpAuthDlgStruct->lpExplainText);

    return DialogBoxParamW( hwininet, MAKEINTRESOURCEW( IDD_PROXYDLG ),
             lpAuthDlgStruct->hwndOwner, NPS_ProxyPasswordDialog, 
             (LPARAM) lpAuthDlgStruct );
120 121 122
}

/*****************************************************************
123
 *  NPSGetProviderHandleA [MPR.@]
124 125 126 127 128 129 130 131
 */
DWORD WINAPI NPSGetProviderHandleA( PHPROVIDER phProvider )
{
    FIXME( "(%p): stub\n", phProvider );
    return WN_NOT_SUPPORTED;
}

/*****************************************************************
132
 *  NPSGetProviderNameA [MPR.@]
133 134 135 136 137 138 139 140
 */
DWORD WINAPI NPSGetProviderNameA( HPROVIDER hProvider, LPCSTR *lpszProviderName )
{
    FIXME( "(%p, %p): stub\n", hProvider, lpszProviderName );
    return WN_NOT_SUPPORTED;
}

/*****************************************************************
141
 *  NPSGetSectionNameA [MPR.@]
142 143 144 145 146 147 148 149
 */
DWORD WINAPI NPSGetSectionNameA( HPROVIDER hProvider, LPCSTR *lpszSectionName )
{
    FIXME( "(%p, %p): stub\n", hProvider, lpszSectionName );
    return WN_NOT_SUPPORTED;
}

/*****************************************************************
150
 *  NPSSetExtendedErrorA [MPR.@]
151 152 153
 */
DWORD WINAPI NPSSetExtendedErrorA( DWORD NetSpecificError, LPSTR lpExtendedErrorText )
{
154
    FIXME( "(%08x, %s): stub\n", NetSpecificError, debugstr_a(lpExtendedErrorText) );
155 156 157 158
    return WN_NOT_SUPPORTED;
}

/*****************************************************************
159
 *  NPSSetCustomTextA [MPR.@]
160 161 162 163 164 165 166
 */
VOID WINAPI NPSSetCustomTextA( LPSTR lpCustomErrorText )
{
    FIXME( "(%s): stub\n", debugstr_a(lpCustomErrorText) );
}

/*****************************************************************
167
 *  NPSCopyStringA [MPR.@]
168 169 170 171 172 173 174 175
 */
DWORD WINAPI NPSCopyStringA( LPCSTR lpString, LPVOID lpBuffer, LPDWORD lpdwBufferSize )
{
    FIXME( "(%s, %p, %p): stub\n", debugstr_a(lpString), lpBuffer, lpdwBufferSize );
    return WN_NOT_SUPPORTED;
}

/*****************************************************************
176
 *  NPSDeviceGetNumberA [MPR.@]
177 178 179 180 181 182 183 184
 */
DWORD WINAPI NPSDeviceGetNumberA( LPSTR lpLocalName, LPDWORD lpdwNumber, LPDWORD lpdwType )
{
    FIXME( "(%s, %p, %p): stub\n", debugstr_a(lpLocalName), lpdwNumber, lpdwType );
    return WN_NOT_SUPPORTED;
}

/*****************************************************************
185
 *  NPSDeviceGetStringA [MPR.@]
186 187 188
 */
DWORD WINAPI NPSDeviceGetStringA( DWORD dwNumber, DWORD dwType, LPSTR lpLocalName, LPDWORD lpdwBufferSize )
{
189
    FIXME( "(%d, %d, %p, %p): stub\n", dwNumber, dwType, lpLocalName, lpdwBufferSize );
190 191 192 193
    return WN_NOT_SUPPORTED;
}

/*****************************************************************
194
 *  NPSNotifyRegisterA [MPR.@]
195 196 197 198 199 200 201 202
 */
DWORD WINAPI NPSNotifyRegisterA( enum NOTIFYTYPE NotifyType, NOTIFYCALLBACK pfNotifyCallBack )
{
    FIXME( "(%d, %p): stub\n", NotifyType, pfNotifyCallBack );
    return WN_NOT_SUPPORTED;
}

/*****************************************************************
203
 *  NPSNotifyGetContextA [MPR.@]
204 205 206 207 208 209
 */
LPVOID WINAPI NPSNotifyGetContextA( NOTIFYCALLBACK pfNotifyCallBack )
{
    FIXME( "(%p): stub\n", pfNotifyCallBack );
    return NULL;
}
210 211 212 213 214 215

/*****************************************************************
 *  PwdGetPasswordStatusA [MPR.@]
 */
DWORD WINAPI PwdGetPasswordStatusA( LPCSTR lpProvider, DWORD dwIndex, LPDWORD status )
{
216
    FIXME("%s %d %p\n", debugstr_a(lpProvider), dwIndex, status );
217 218 219 220 221 222 223 224 225
    *status = 0;
    return WN_SUCCESS;
}

/*****************************************************************
 *  PwdGetPasswordStatusA [MPR.@]
 */
DWORD WINAPI PwdGetPasswordStatusW( LPCWSTR lpProvider, DWORD dwIndex, LPDWORD status )
{
226
    FIXME("%s %d %p\n", debugstr_w(lpProvider), dwIndex, status );
227 228 229 230 231 232 233 234 235
    *status = 0;
    return WN_SUCCESS;
}

/*****************************************************************
 *  PwdSetPasswordStatusA [MPR.@]
 */
DWORD WINAPI PwdSetPasswordStatusA( LPCSTR lpProvider, DWORD dwIndex, DWORD status )
{
236
    FIXME("%s %d %d\n", debugstr_a(lpProvider), dwIndex, status );
237 238 239 240 241 242 243 244
    return WN_SUCCESS;
}

/*****************************************************************
 *  PwdSetPasswordStatusW [MPR.@]
 */
DWORD WINAPI PwdSetPasswordStatusW( LPCWSTR lpProvider, DWORD dwIndex, DWORD status )
{
245
    FIXME("%s %d %d\n", debugstr_w(lpProvider), dwIndex, status );
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
    return WN_SUCCESS;
}

typedef struct _CHANGEPWDINFOA {
    LPSTR lpUsername;
    LPSTR lpPassword;
    DWORD cbPassword;
} CHANGEPWDINFOA, *LPCHANGEPWDINFOA;

typedef struct _CHANGEPWDINFOW {
    LPWSTR lpUsername;
    LPWSTR lpPassword;
    DWORD cbPassword;
} CHANGEPWDINFOW, *LPCHANGEPWDINFOW;

/*****************************************************************
 *  PwdChangePasswordA [MPR.@]
 */
DWORD WINAPI PwdChangePasswordA( LPCSTR lpProvider, HWND hWnd, DWORD flags, LPCHANGEPWDINFOA info )
{
266
    FIXME("%s %p %x %p\n", debugstr_a(lpProvider), hWnd, flags, info );
267 268 269 270 271 272 273 274
    return WN_SUCCESS;
}

/*****************************************************************
 *  PwdChangePasswordA [MPR.@]
 */
DWORD WINAPI PwdChangePasswordW( LPCWSTR lpProvider, HWND hWnd, DWORD flags, LPCHANGEPWDINFOW info )
{
275
    FIXME("%s %p %x %p\n", debugstr_w(lpProvider), hWnd, flags, info );
276 277
    return WN_SUCCESS;
}