2 ===================================================================
3 --- mpr.spec (revision 49877)
4 +++ mpr.spec (working copy)
45 22 stdcall @(long) MPR_Alloc
46 23 stdcall @(ptr long) MPR_ReAlloc
47 24 stdcall @(ptr) MPR_Free
49 ===================================================================
50 --- wnet.c (revision 71983)
51 +++ wnet.c (working copy)
53 PF_NPAddConnection addConnection;
54 PF_NPAddConnection3 addConnection3;
55 PF_NPCancelConnection cancelConnection;
57 + PF_NPGetConnection getConnection;
59 } WNetProvider, *PWNetProvider;
61 typedef struct _WNetProviderTable
63 provider->addConnection = MPR_GETPROC(NPAddConnection);
64 provider->addConnection3 = MPR_GETPROC(NPAddConnection3);
65 provider->cancelConnection = MPR_GETPROC(NPCancelConnection);
67 + provider->getConnection = MPR_GETPROC(NPGetConnection);
69 TRACE("NPAddConnection %p\n", provider->addConnection);
70 TRACE("NPAddConnection3 %p\n", provider->addConnection3);
71 TRACE("NPCancelConnection %p\n", provider->cancelConnection);
72 @@ -1870,6 +1866,43 @@
77 + if (ret == WN_SUCCESS && ctxt->flags & CONNECT_UPDATE_PROFILE)
81 + if (netres.dwType == RESOURCETYPE_PRINT)
83 + FIXME("Persistent connection are not supported for printers\n");
87 + if (RegOpenCurrentUser(KEY_ALL_ACCESS, &user_profile) == ERROR_SUCCESS)
90 + WCHAR subkey[10] = {'N', 'e', 't', 'w', 'o', 'r', 'k', '\\', netres.lpLocalName[0], 0};
92 + if (RegCreateKeyExW(user_profile, subkey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &network, NULL) == ERROR_SUCCESS)
94 + DWORD dword_arg = RESOURCETYPE_DISK;
95 + DWORD len = (strlenW(provider->name) + 1) * sizeof(WCHAR);
97 + RegSetValueExW(network, L"ConnectionType", 0, REG_DWORD, (const BYTE *)&dword_arg, sizeof(DWORD));
98 + RegSetValueExW(network, L"ProviderName", 0, REG_SZ, (const BYTE *)provider->name, len);
99 + dword_arg = provider->dwNetType;
100 + RegSetValueExW(network, L"ProviderType", 0, REG_DWORD, (const BYTE *)&dword_arg, sizeof(DWORD));
101 + len = (strlenW(netres.lpRemoteName) + 1) * sizeof(WCHAR);
102 + RegSetValueExW(network, L"RemotePath", 0, REG_SZ, (const BYTE *)netres.lpRemoteName, len);
104 + RegSetValueExW(network, L"UserName", 0, REG_SZ, (const BYTE *)netres.lpRemoteName, len);
105 + RegCloseKey(network);
108 + RegCloseKey(user_profile);
116 @@ -2061,6 +2094,37 @@
122 + if (dwFlags & CONNECT_UPDATE_PROFILE)
125 + WCHAR *coma = strchrW(lpName, ':');
127 + if (coma && RegOpenCurrentUser(KEY_ALL_ACCESS, &user_profile) == ERROR_SUCCESS)
132 + len = (ULONG_PTR)coma - (ULONG_PTR)lpName + sizeof(L"Network\\");
133 + subkey = HeapAlloc(GetProcessHeap(), 0, len);
136 + strcpyW(subkey, L"Network\\");
137 + memcpy(subkey + (sizeof(L"Network\\") / sizeof(WCHAR)) - 1, lpName, (ULONG_PTR)coma - (ULONG_PTR)lpName);
138 + subkey[len / sizeof(WCHAR) - 1] = 0;
140 + TRACE("Removing: %S\n", subkey);
142 + RegDeleteKeyW(user_profile, subkey);
143 + HeapFree(GetProcessHeap(), 0, subkey);
146 + RegCloseKey(user_profile);
154 @@ -2188,6 +2252,7 @@
155 /* find the network connection for a given drive; helper for WNetGetConnection */
156 static DWORD get_drive_connection( WCHAR letter, LPWSTR remote, LPDWORD size )
160 struct mountmgr_unix_drive *data = (struct mountmgr_unix_drive *)buffer;
162 @@ -2230,6 +2295,32 @@
167 + DWORD ret = WN_NO_NETWORK;
169 + WCHAR local[3] = {letter, ':', 0};
171 + if (providerTable != NULL)
173 + for (index = 0; index < providerTable->numProviders; index++)
175 + if(providerTable->table[index].getCaps(WNNC_CONNECTION) &
176 + WNNC_CON_GETCONNECTIONS)
178 + if (providerTable->table[index].getConnection)
179 + ret = providerTable->table[index].getConnection(
180 + local, remote, size);
182 + ret = WN_NO_NETWORK;
183 + if (ret == WN_SUCCESS || ret == WN_MORE_DATA)
194 /**************************************************************************