[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 @@ -2188,6 +2221,7 @@
117 /* find the network connection for a given drive; helper for WNetGetConnection */
118 static DWORD get_drive_connection( WCHAR letter, LPWSTR remote, LPDWORD size )
119 {
120 +#ifndef __REACTOS__
121 char buffer[1024];
122 struct mountmgr_unix_drive *data = (struct mountmgr_unix_drive *)buffer;
123 HANDLE mgr;
124 @@ -2230,6 +2264,32 @@
125 }
126 CloseHandle( mgr );
127 return ret;
128 +#else
129 + DWORD ret = WN_NO_NETWORK;
130 + DWORD index;
131 + WCHAR local[3] = {letter, ':', 0};
132 +
133 + if (providerTable != NULL)
134 + {
135 + for (index = 0; index < providerTable->numProviders; index++)
136 + {
137 + if(providerTable->table[index].getCaps(WNNC_CONNECTION) &
138 + WNNC_CON_GETCONNECTIONS)
139 + {
140 + if (providerTable->table[index].getConnection)
141 + ret = providerTable->table[index].getConnection(
142 + local, remote, size);
143 + else
144 + ret = WN_NO_NETWORK;
145 + if (ret == WN_SUCCESS || ret == WN_MORE_DATA)
146 + break;
147 + }
148 + }
149 + }
150 + if (ret)
151 + SetLastError(ret);
152 + return ret;
153 +#endif
154 }
155
156 /**************************************************************************