[MPR]
[reactos.git] / reactos / dll / win32 / mpr / mpr_ros.diff
1 Index: mpr.spec
2 ===================================================================
3 --- mpr.spec (revision 49877)
4 +++ mpr.spec (working copy)
5 @@ -1,23 +1,23 @@
6 # ordinal exports
7 - 1 stub @
8 - 2 stub @
9 - 3 stub @
10 - 4 stub @
11 - 5 stub @
12 - 6 stub @
13 - 7 stub @
14 - 8 stub @
15 - 9 stub @
16 -12 stub @
17 -13 stub @
18 -14 stub @
19 -15 stub @
20 -16 stub @
21 -17 stub @
22 -18 stub @
23 -19 stub @
24 -20 stub @
25 -21 stub @
26 + 1 stub MPR_1
27 + 2 stub MPR_2
28 + 3 stub MPR_3
29 + 4 stub MPR_4
30 + 5 stub MPR_5
31 + 6 stub MPR_6
32 + 7 stub MPR_7
33 + 8 stub MPR_8
34 + 9 stub MPR_9
35 +12 stub MPR_12
36 +13 stub MPR_13
37 +14 stub MPR_14
38 +15 stub MPR_15
39 +16 stub MPR_16
40 +17 stub MPR_17
41 +18 stub MPR_18
42 +19 stub MPR_19
43 +20 stub MPR_20
44 +21 stub MPR_21
45 22 stdcall @(long) MPR_Alloc
46 23 stdcall @(ptr long) MPR_ReAlloc
47 24 stdcall @(ptr) MPR_Free
48 Index: wnet.c
49 ===================================================================
50 --- wnet.c (revision 71983)
51 +++ wnet.c (working copy)
52 @@ -60,6 +50,9 @@
53 PF_NPAddConnection addConnection;
54 PF_NPAddConnection3 addConnection3;
55 PF_NPCancelConnection cancelConnection;
56 +#ifdef __REACTOS__
57 + PF_NPGetConnection getConnection;
58 +#endif
59 } WNetProvider, *PWNetProvider;
60
61 typedef struct _WNetProviderTable
62 @@ -214,6 +207,9 @@
63 provider->addConnection = MPR_GETPROC(NPAddConnection);
64 provider->addConnection3 = MPR_GETPROC(NPAddConnection3);
65 provider->cancelConnection = MPR_GETPROC(NPCancelConnection);
66 +#ifdef __REACTOS__
67 + provider->getConnection = MPR_GETPROC(NPGetConnection);
68 +#endif
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 @@
73 }
74 }
75
76 +#ifdef __REACTOS__
77 + if (ret == WN_SUCCESS && ctxt->flags & CONNECT_UPDATE_PROFILE)
78 + {
79 + HKEY user_profile;
80 +
81 + if (netres.dwType == RESOURCETYPE_PRINT)
82 + {
83 + FIXME("Persistent connection are not supported for printers\n");
84 + return ret;
85 + }
86 +
87 + if (RegOpenCurrentUser(KEY_ALL_ACCESS, &user_profile) == ERROR_SUCCESS)
88 + {
89 + HKEY network;
90 + WCHAR subkey[10] = {'N', 'e', 't', 'w', 'o', 'r', 'k', '\\', netres.lpLocalName[0], 0};
91 +
92 + if (RegCreateKeyExW(user_profile, subkey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &network, NULL) == ERROR_SUCCESS)
93 + {
94 + DWORD dword_arg = RESOURCETYPE_DISK;
95 + DWORD len = (strlenW(provider->name) + 1) * sizeof(WCHAR);
96 +
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);
103 + len = 0;
104 + RegSetValueExW(network, L"UserName", 0, REG_SZ, (const BYTE *)netres.lpRemoteName, len);
105 + RegCloseKey(network);
106 + }
107 +
108 + RegCloseKey(user_profile);
109 + }
110 + }
111 +#endif
112 +
113 return ret;
114 }
115
116 @@ -2061,6 +2094,37 @@
117 }
118 }
119 }
120 +#ifdef __REACTOS__
121 +
122 + if (dwFlags & CONNECT_UPDATE_PROFILE)
123 + {
124 + HKEY user_profile;
125 + WCHAR *coma = strchrW(lpName, ':');
126 +
127 + if (coma && RegOpenCurrentUser(KEY_ALL_ACCESS, &user_profile) == ERROR_SUCCESS)
128 + {
129 + WCHAR *subkey;
130 + DWORD len;
131 +
132 + len = (ULONG_PTR)coma - (ULONG_PTR)lpName + sizeof(L"Network\\");
133 + subkey = HeapAlloc(GetProcessHeap(), 0, len);
134 + if (subkey)
135 + {
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;
139 +
140 + TRACE("Removing: %S\n", subkey);
141 +
142 + RegDeleteKeyW(user_profile, subkey);
143 + HeapFree(GetProcessHeap(), 0, subkey);
144 + }
145 +
146 + RegCloseKey(user_profile);
147 + }
148 + }
149 +
150 +#endif
151 return ret;
152 }
153
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 )
157 {
158 +#ifndef __REACTOS__
159 char buffer[1024];
160 struct mountmgr_unix_drive *data = (struct mountmgr_unix_drive *)buffer;
161 HANDLE mgr;
162 @@ -2230,6 +2295,32 @@
163 }
164 CloseHandle( mgr );
165 return ret;
166 +#else
167 + DWORD ret = WN_NO_NETWORK;
168 + DWORD index;
169 + WCHAR local[3] = {letter, ':', 0};
170 +
171 + if (providerTable != NULL)
172 + {
173 + for (index = 0; index < providerTable->numProviders; index++)
174 + {
175 + if(providerTable->table[index].getCaps(WNNC_CONNECTION) &
176 + WNNC_CON_GETCONNECTIONS)
177 + {
178 + if (providerTable->table[index].getConnection)
179 + ret = providerTable->table[index].getConnection(
180 + local, remote, size);
181 + else
182 + ret = WN_NO_NETWORK;
183 + if (ret == WN_SUCCESS || ret == WN_MORE_DATA)
184 + break;
185 + }
186 + }
187 + }
188 + if (ret)
189 + SetLastError(ret);
190 + return ret;
191 +#endif
192 }
193
194 /**************************************************************************