From 66fba2f89d2aaa72e6707dd2aa9cade1eec4bd23 Mon Sep 17 00:00:00 2001 From: The Wine Synchronizer Date: Thu, 29 Nov 2007 10:50:33 +0000 Subject: [PATCH] Autosyncing with Wine HEAD svn path=/trunk/; revision=30871 --- reactos/dll/win32/mpr/mpr.rbuild | 9 +- reactos/dll/win32/mpr/mpr_Bg.rc | 18 ++-- reactos/dll/win32/mpr/mpr_Ko.rc | 4 +- reactos/dll/win32/mpr/mpr_No.rc | 2 +- reactos/dll/win32/mpr/mpr_Pl.rc | 4 +- reactos/dll/win32/mpr/mpr_Sv.rc | 10 +- reactos/dll/win32/mpr/mpr_ros.diff | 55 +--------- reactos/dll/win32/mpr/nps.c | 4 +- reactos/dll/win32/mpr/pwcache.c | 13 +-- reactos/dll/win32/mpr/wnet.c | 164 ++++++++++++++++++++++++++--- 10 files changed, 185 insertions(+), 98 deletions(-) diff --git a/reactos/dll/win32/mpr/mpr.rbuild b/reactos/dll/win32/mpr/mpr.rbuild index 5db8307bacb..ddffb6fa545 100644 --- a/reactos/dll/win32/mpr/mpr.rbuild +++ b/reactos/dll/win32/mpr/mpr.rbuild @@ -1,13 +1,12 @@ + + . include/reactos/wine - - - 0x600 - 0x501 - 0x501 + 0x600 + 0x600 wine user32 advapi32 diff --git a/reactos/dll/win32/mpr/mpr_Bg.rc b/reactos/dll/win32/mpr/mpr_Bg.rc index 5e0f071a862..a37f7961be1 100644 --- a/reactos/dll/win32/mpr/mpr_Bg.rc +++ b/reactos/dll/win32/mpr/mpr_Bg.rc @@ -1,7 +1,7 @@ /* - * MPR dll resources + * MPR Bulgarian resource * - * Copyright (C) 2004 Juan Lang + * Copyright 2005 Milko Krachounov * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -27,20 +27,20 @@ STRINGTABLE DISCARDABLE IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Âúâåäåòå ïàðîëà çà ìðåæàòà" +CAPTION "Âúâåäåòå ìðåæîâà ïàðîëà" FONT 8, "MS Shell Dlg" { - LTEXT "Âúâåäåòå ñâîèòå ïîòðåáèòåëñêî èìå è ïàðîëà:", IDC_EXPLAIN, 40, 6, 150, 15 - LTEXT "Ïðåçñúðâúð", -1, 40, 26, 50, 10 -/* LTEXT "Ñòðàíà", -1, 40, 46, 50, 10 */ + LTEXT "Âúâåäåòå âàøåòî ïîòðåáèòåëñêî èìå è ïàðîëà:", IDC_EXPLAIN, 40, 6, 150, 15 + LTEXT "Ïðîêñè", -1, 40, 26, 50, 10 +/* LTEXT "Realm", -1, 40, 46, 50, 10 */ LTEXT "Ïîòðåáèòåë", -1, 40, 66, 50, 10 LTEXT "Ïàðîëà", -1, 40, 86, 50, 10 LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0 LTEXT "" IDC_REALM, 80, 46, 150, 14, 0 EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD - CHECKBOX "&Ñúõðàíÿâàíå íà ïàðîëàòà (íåáåçîïàñíî)", IDC_SAVEPASSWORD, + CHECKBOX "&Save this password (Insecure)", IDC_SAVEPASSWORD, 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - PUSHBUTTON "Äîáðå", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON - PUSHBUTTON "Îòêàç", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Îòìåíè", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } diff --git a/reactos/dll/win32/mpr/mpr_Ko.rc b/reactos/dll/win32/mpr/mpr_Ko.rc index 651ff6a68d1..e2c53ccd4e6 100644 --- a/reactos/dll/win32/mpr/mpr_Ko.rc +++ b/reactos/dll/win32/mpr/mpr_Ko.rc @@ -2,7 +2,7 @@ * MPR dll resources * * Copyright (C) 2004 Juan Lang - * Copyright 2005 YunSong Hwang + * Copyright 2005,2007 YunSong Hwang * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ FONT 8, "MS Shell Dlg" LTEXT "" IDC_REALM, 80, 46, 150, 14, 0 EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD - CHECKBOX "¾ÏÈ£ ÀúÀå(&S) (Insecure)", IDC_SAVEPASSWORD, + CHECKBOX "¾ÏÈ£ ÀúÀå(&S) (º¸¾È¿¡ ÁÖÀÇ)", IDC_SAVEPASSWORD, 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP PUSHBUTTON "È®ÀÎ", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "Ãë¼Ò", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP diff --git a/reactos/dll/win32/mpr/mpr_No.rc b/reactos/dll/win32/mpr/mpr_No.rc index db4b3dd481c..32833542db9 100644 --- a/reactos/dll/win32/mpr/mpr_No.rc +++ b/reactos/dll/win32/mpr/mpr_No.rc @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL +LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL STRINGTABLE DISCARDABLE { diff --git a/reactos/dll/win32/mpr/mpr_Pl.rc b/reactos/dll/win32/mpr/mpr_Pl.rc index 40263b0ec56..a6f2446f3ea 100644 --- a/reactos/dll/win32/mpr/mpr_Pl.rc +++ b/reactos/dll/win32/mpr/mpr_Pl.rc @@ -28,7 +28,7 @@ STRINGTABLE DISCARDABLE IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "WprowadŸ has³o do sieci" +CAPTION "Wpisz has³o sieci" FONT 8, "MS Shell Dlg" { LTEXT "Proszê wprowadziæ nazwê u¿ytkownika i has³o:", IDC_EXPLAIN, 40, 6, 150, 15 @@ -40,7 +40,7 @@ FONT 8, "MS Shell Dlg" LTEXT "" IDC_REALM, 80, 46, 150, 14, 0 EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD - CHECKBOX "&Zapamiêtaj to has³o (nie bezpieczne)", IDC_SAVEPASSWORD, + CHECKBOX "&Zapisz to has³o (niebezpieczne)", IDC_SAVEPASSWORD, 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "Anuluj", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP diff --git a/reactos/dll/win32/mpr/mpr_Sv.rc b/reactos/dll/win32/mpr/mpr_Sv.rc index f83cbfcef90..3a0e4236da6 100644 --- a/reactos/dll/win32/mpr/mpr_Sv.rc +++ b/reactos/dll/win32/mpr/mpr_Sv.rc @@ -1,7 +1,7 @@ /* - * MPR dll Swedish resources + * MPR dll resources * - * Copyright (C) 2005 Andreas Bjerkeholt + * Copyright (C) 2007 Daniel Nylander * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -15,10 +15,10 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL +LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE { @@ -39,7 +39,7 @@ FONT 8, "MS Shell Dlg" LTEXT "" IDC_REALM, 80, 46, 150, 14, 0 EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD - CHECKBOX "&Spara detta lösenord (Osäkert)", IDC_SAVEPASSWORD, + CHECKBOX "&Spara detta lösenord (osäkert)", IDC_SAVEPASSWORD, 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "Avbryt", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP diff --git a/reactos/dll/win32/mpr/mpr_ros.diff b/reactos/dll/win32/mpr/mpr_ros.diff index 8d1c83a78cb..d8337d176b1 100644 --- a/reactos/dll/win32/mpr/mpr_ros.diff +++ b/reactos/dll/win32/mpr/mpr_ros.diff @@ -2,12 +2,12 @@ Index: mpr.rc =================================================================== --- mpr.rc (revision 23782) +++ mpr.rc (working copy) -@@ -39,4 +39,7 @@ +@@ -39,5 +39,7 @@ #include "mpr_No.rc" #include "mpr_Pl.rc" #include "mpr_Pt.rc" +#include "mpr_Ru.rc" -+#include "mpr_Sv.rc" + #include "mpr_Sv.rc" #include "mpr_Tr.rc" +#include "mpr_Uk.rc" Index: mpr_Ru.rc @@ -61,57 +61,6 @@ Index: mpr_Ru.rc + PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Îòìåíà", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP +} -Index: mpr_Sv.rc -=================================================================== ---- mpr_Sv.rc (revision 23782) -+++ mpr_Sv.rc (working copy) -@@ -0,0 +1,46 @@ -+/* -+ * MPR dll Swedish resources -+ * -+ * Copyright (C) 2005 Andreas Bjerkeholt -+ * -+ * 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 -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL -+ -+STRINGTABLE DISCARDABLE -+{ -+ IDS_ENTIRENETWORK "Hela nätverket" -+} -+ -+IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 -+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -+CAPTION "Ange nätverkslösenord" -+FONT 8, "MS Shell Dlg" -+{ -+ LTEXT "Ange ditt användarnamn och lösenord:", IDC_EXPLAIN, 40, 6, 150, 15 -+ LTEXT "Proxy", -1, 40, 26, 50, 10 -+/* LTEXT "Realm", -1, 40, 46, 50, 10 */ -+ LTEXT "Användare", -1, 40, 66, 50, 10 -+ LTEXT "Lösenord", -1, 40, 86, 50, 10 -+ LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0 -+ LTEXT "" IDC_REALM, 80, 46, 150, 14, 0 -+ EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP -+ EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD -+ CHECKBOX "&Spara detta lösenord (Osäkert)", IDC_SAVEPASSWORD, -+ 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP -+ PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON -+ PUSHBUTTON "Avbryt", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP -+} Index: mpr_Uk.rc =================================================================== --- mpr_Uk.rc (revision 23782) diff --git a/reactos/dll/win32/mpr/nps.c b/reactos/dll/win32/mpr/nps.c index a290e28f8ef..2f75674b903 100644 --- a/reactos/dll/win32/mpr/nps.c +++ b/reactos/dll/win32/mpr/nps.c @@ -82,7 +82,7 @@ static INT_PTR WINAPI NPS_ProxyPasswordDialog( hitem = GetDlgItem( hdlg, IDC_USERNAME ); if( hitem ) GetWindowTextA( hitem, lpAuthDlgStruct->lpUsername, lpAuthDlgStruct->cbUsername ); - + password[0] = 0; hitem = GetDlgItem( hdlg, IDC_PASSWORD ); if( hitem ) @@ -119,7 +119,7 @@ DWORD WINAPI NPSAuthenticationDialogA( LPAUTHDLGSTRUCTA lpAuthDlgStruct ) lpAuthDlgStruct->lpOUTitle, lpAuthDlgStruct->lpExplainText); return DialogBoxParamW( hwininet, MAKEINTRESOURCEW( IDD_PROXYDLG ), - lpAuthDlgStruct->hwndOwner, NPS_ProxyPasswordDialog, + lpAuthDlgStruct->hwndOwner, NPS_ProxyPasswordDialog, (LPARAM) lpAuthDlgStruct ); } diff --git a/reactos/dll/win32/mpr/pwcache.c b/reactos/dll/win32/mpr/pwcache.c index 6678dac2fda..a760dd26d25 100644 --- a/reactos/dll/win32/mpr/pwcache.c +++ b/reactos/dll/win32/mpr/pwcache.c @@ -56,8 +56,9 @@ static LPSTR MPR_GetValueName( LPCSTR pbResource, WORD cbResource, BYTE nType ) DWORD i; name = HeapAlloc( GetProcessHeap(), 0, 6+cbResource*2 ); - if( name ) - sprintf( name, "X-%02X-", nType ); + if( !name ) return NULL; + + sprintf( name, "X-%02X-", nType ); for(i=0; i>4); @@ -107,7 +108,7 @@ DWORD WINAPI WNetCachePassword( valname = MPR_GetValueName( pbResource, cbResource, nType ); if( valname ) { - r = RegSetValueExA( hkey, valname, 0, REG_BINARY, + r = RegSetValueExA( hkey, valname, 0, REG_BINARY, (LPBYTE)pbPassword, cbPassword ); if( r ) r = WN_CANCEL; @@ -221,9 +222,9 @@ DWORD WINAPI WNetGetCachedPassword( * * NOTES * the parameter count is verifyed - * + * * This function is a huge security risk, as virii and such can use - * it to grab all the passwords in the cache. It's bad enough to + * it to grab all the passwords in the cache. It's bad enough to * store the passwords (insecurely). * * bpPrefix and cbPrefix are used to filter the returned passwords @@ -306,7 +307,7 @@ UINT WINAPI WNetEnumCachedPasswords( entry->cbPassword = data_sz; entry->iEntry = i; entry->nType = nType; - r = RegEnumValueA( hkey, i, NULL, &val_sz, NULL, &type, + r = RegEnumValueA( hkey, i, NULL, &val_sz, NULL, &type, &entry->abResource[val_sz], &data_sz ); if( r == ERROR_SUCCESS ) enumPasswordProc( entry, param ); diff --git a/reactos/dll/win32/mpr/wnet.c b/reactos/dll/win32/mpr/wnet.c index afc7c06517b..36fb93cff59 100644 --- a/reactos/dll/win32/mpr/wnet.c +++ b/reactos/dll/win32/mpr/wnet.c @@ -52,6 +52,7 @@ typedef struct _WNetProvider PF_NPOpenEnum openEnum; PF_NPEnumResource enumResource; PF_NPCloseEnum closeEnum; + PF_NPGetResourceInformation getResourceInformation; } WNetProvider, *PWNetProvider; typedef struct _WNetProviderTable @@ -133,7 +134,7 @@ static void _tryLoadProvider(PCWSTR provider) { static const WCHAR szProviderName[] = { 'N','a','m','e',0 }; PWSTR name = NULL; - + size = 0; RegQueryValueExW(hKey, szProviderName, NULL, NULL, NULL, &size); if (size) @@ -182,6 +183,10 @@ static void _tryLoadProvider(PCWSTR provider) provider->closeEnum = (PF_NPCloseEnum) GetProcAddress(hLib, "NPCloseEnum"); TRACE("closeEnum is %p\n", provider->closeEnum); + provider->getResourceInformation = (PF_NPGetResourceInformation) + GetProcAddress(hLib, "NPGetResourceInformation"); + TRACE("getResourceInformation is %p\n", + provider->getResourceInformation); if (!provider->openEnum || !provider->enumResource || !provider->closeEnum) { @@ -731,7 +736,7 @@ DWORD WINAPI WNetOpenEnumW( DWORD dwScope, DWORD dwType, DWORD dwUsage, if (index != BAD_PROVIDER_INDEX) { if (providerTable->table[index].openEnum && - providerTable->table[index].dwEnumScopes & dwScope) + providerTable->table[index].dwEnumScopes & WNNC_ENUM_GLOBAL) { HANDLE handle; @@ -893,7 +898,7 @@ static DWORD _enumerateProvidersW(PWNetEnumerator enumerator, LPDWORD lpcCount, if (*lpBufferSize < sizeof(NETRESOURCEA)) return WN_MORE_DATA; - if (!providerTable || enumerator->providerIndex >= + if (!providerTable || enumerator->providerIndex >= providerTable->numProviders) ret = WN_NO_MORE_ENTRIES; else @@ -964,6 +969,7 @@ static DWORD _globalEnumeratorAdvance(PWNetEnumerator enumerator) if (enumerator->providerDone) { + DWORD dwEnum = 0; enumerator->providerDone = FALSE; if (enumerator->handle) { @@ -972,10 +978,15 @@ static DWORD _globalEnumeratorAdvance(PWNetEnumerator enumerator) enumerator->handle = NULL; enumerator->providerIndex++; } + if (enumerator->dwScope == RESOURCE_CONNECTED) + dwEnum = WNNC_ENUM_LOCAL; + else if (enumerator->dwScope == RESOURCE_GLOBALNET) + dwEnum = WNNC_ENUM_GLOBAL; + else if (enumerator->dwScope == RESOURCE_CONTEXT) + dwEnum = WNNC_ENUM_CONTEXT; for (; enumerator->providerIndex < providerTable->numProviders && - !(enumerator->dwScope & providerTable->table - [enumerator->providerIndex].dwEnumScopes); - enumerator->providerIndex++) + !(providerTable->table[enumerator->providerIndex].dwEnumScopes + & dwEnum); enumerator->providerIndex++) ; } return enumerator->providerIndex < providerTable->numProviders ? @@ -1275,30 +1286,157 @@ DWORD WINAPI WNetCloseEnum( HANDLE hEnum ) /********************************************************************* * WNetGetResourceInformationA [MPR.@] + * + * See WNetGetResourceInformationW */ DWORD WINAPI WNetGetResourceInformationA( LPNETRESOURCEA lpNetResource, LPVOID lpBuffer, LPDWORD cbBuffer, LPSTR *lplpSystem ) { - FIXME( "(%p, %p, %p, %p): stub\n", + DWORD ret; + + TRACE( "(%p, %p, %p, %p)\n", lpNetResource, lpBuffer, cbBuffer, lplpSystem ); - SetLastError(WN_NO_NETWORK); - return WN_NO_NETWORK; + if (!providerTable || providerTable->numProviders == 0) + ret = WN_NO_NETWORK; + else if (lpNetResource) + { + LPNETRESOURCEW lpNetResourceW = NULL; + DWORD size = 1024, count = 1; + DWORD len; + + lpNetResourceW = HeapAlloc(GetProcessHeap(), 0, size); + ret = _thunkNetResourceArrayAToW(lpNetResource, &count, lpNetResourceW, &size); + if (ret == WN_MORE_DATA) + { + lpNetResourceW = HeapAlloc(GetProcessHeap(), 0, size); + if (lpNetResourceW) + ret = _thunkNetResourceArrayAToW(lpNetResource, + &count, lpNetResourceW, &size); + else + ret = WN_OUT_OF_MEMORY; + } + if (ret == WN_SUCCESS) + { + LPWSTR lpSystemW = NULL; + LPVOID lpBufferW; + size = 1024; + lpBufferW = HeapAlloc(GetProcessHeap(), 0, size); + if (lpBufferW) + { + ret = WNetGetResourceInformationW(lpNetResourceW, + lpBufferW, &size, &lpSystemW); + if (ret == WN_MORE_DATA) + { + HeapFree(GetProcessHeap(), 0, lpBufferW); + lpBufferW = HeapAlloc(GetProcessHeap(), 0, size); + if (lpBufferW) + ret = WNetGetResourceInformationW(lpNetResourceW, + lpBufferW, &size, &lpSystemW); + else + ret = WN_OUT_OF_MEMORY; + } + if (ret == WN_SUCCESS) + { + ret = _thunkNetResourceArrayWToA(lpBufferW, + &count, lpBuffer, cbBuffer); + lpNetResourceW = lpBufferW; + size = sizeof(NETRESOURCEA); + size += WideCharToMultiByte(CP_ACP, 0, lpNetResourceW->lpRemoteName, + -1, NULL, 0, NULL, NULL); + size += WideCharToMultiByte(CP_ACP, 0, lpNetResourceW->lpProvider, + -1, NULL, 0, NULL, NULL); + + len = WideCharToMultiByte(CP_ACP, 0, lpSystemW, + -1, NULL, 0, NULL, NULL); + if ((len) && ( size + len < *cbBuffer)) + { + *lplpSystem = (char*)lpBuffer + *cbBuffer - len; + WideCharToMultiByte(CP_ACP, 0, lpSystemW, -1, + *lplpSystem, len, NULL, NULL); + ret = WN_SUCCESS; + } + else + ret = WN_MORE_DATA; + } + else + ret = WN_OUT_OF_MEMORY; + HeapFree(GetProcessHeap(), 0, lpBufferW); + } + else + ret = WN_OUT_OF_MEMORY; + HeapFree(GetProcessHeap(), 0, lpSystemW); + } + HeapFree(GetProcessHeap(), 0, lpNetResourceW); + } + else + ret = WN_NO_NETWORK; + + if (ret) + SetLastError(ret); + TRACE("Returning %d\n", ret); + return ret; } /********************************************************************* * WNetGetResourceInformationW [MPR.@] + * + * WNetGetResourceInformationW function identifies the network provider + * that owns the resource and gets information about the type of the resource. + * + * PARAMS: + * lpNetResource [ I] the pointer to NETRESOURCEW structure, that + * defines a network resource. + * lpBuffer [ O] the pointer to buffer, containing result. It + * contains NETRESOURCEW structure and strings to + * which the members of the NETRESOURCEW structure + * point. + * cbBuffer [I/O] the pointer to DWORD number - size of buffer + * in bytes. + * lplpSystem [ O] the pointer to string in the output buffer, + * containing the part of the resource name without + * names of the server and share. + * + * RETURNS: + * NO_ERROR if the function succeeds. System error code if the function fails. */ + DWORD WINAPI WNetGetResourceInformationW( LPNETRESOURCEW lpNetResource, LPVOID lpBuffer, LPDWORD cbBuffer, LPWSTR *lplpSystem ) { - FIXME( "(%p, %p, %p, %p): stub\n", - lpNetResource, lpBuffer, cbBuffer, lplpSystem ); + DWORD ret = WN_NO_NETWORK; + DWORD index; - SetLastError(WN_NO_NETWORK); - return WN_NO_NETWORK; + TRACE( "(%p, %p, %p, %p)\n", + lpNetResource, lpBuffer, cbBuffer, lplpSystem); + + if (!(lpBuffer)) + ret = WN_OUT_OF_MEMORY; + else + { + /* FIXME: For function value of a variable is indifferent, it does + * search of all providers in a network. + */ + for (index = 0; index < providerTable->numProviders; index++) + { + if(providerTable->table[index].getCaps(WNNC_DIALOG) & + WNNC_DLG_GETRESOURCEINFORMATION) + { + if (providerTable->table[index].getResourceInformation) + ret = providerTable->table[index].getResourceInformation( + lpNetResource, lpBuffer, cbBuffer, lplpSystem); + else + ret = WN_NO_NETWORK; + if (ret == WN_SUCCESS) + break; + } + } + } + if (ret) + SetLastError(ret); + return ret; } /*********************************************************************