1 | /* $Id: reg_odin.cpp,v 1.1 2000-08-24 09:32:43 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Win32 URL-handling APIs for OS/2
|
---|
5 | *
|
---|
6 | * Copyright 1999 Patrick Haller <phaller@gmx.net>
|
---|
7 | *
|
---|
8 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
9 | *
|
---|
10 | * Copyright 1996,1998 Marcus Meissner
|
---|
11 | * Copyright 1996 Jukka Iivonen
|
---|
12 | * Copyright 1997 Uwe Bonnes
|
---|
13 | * Copyright 1999 Jens Wiessner
|
---|
14 | */
|
---|
15 |
|
---|
16 |
|
---|
17 | #include <odin.h>
|
---|
18 | #include <odinwrap.h>
|
---|
19 | #include <os2sel.h>
|
---|
20 |
|
---|
21 | #include <string.h>
|
---|
22 | #include <ctype.h>
|
---|
23 | #include <wctype.h>
|
---|
24 | #define HAVE_WCTYPE_H
|
---|
25 |
|
---|
26 | #include "debugtools.h"
|
---|
27 | #include "winnls.h"
|
---|
28 | #include "winversion.h"
|
---|
29 | #include "winreg.h"
|
---|
30 |
|
---|
31 | #include <heapstring.h>
|
---|
32 | #include <misc.h>
|
---|
33 | #include <win\winerror.h>
|
---|
34 | #include "shlwapi_odin.h"
|
---|
35 |
|
---|
36 |
|
---|
37 | ODINDEBUGCHANNEL(SHLWAPI-REG)
|
---|
38 |
|
---|
39 |
|
---|
40 | /*****************************************************************************
|
---|
41 | * Name : DWORD SHRegCreateUSKeyA
|
---|
42 | * Purpose :
|
---|
43 | * Parameters:
|
---|
44 | * Variables :
|
---|
45 | * Result :
|
---|
46 | * Remark : SHLWAPI.594 SHLWAPI.SHRegCreateUSKeyA
|
---|
47 | * Status : STUB UNTESTED
|
---|
48 | *
|
---|
49 | * Author : Patrick Haller [Wed, 1999/12/29 23:02]
|
---|
50 | *****************************************************************************/
|
---|
51 |
|
---|
52 | ODINFUNCTION5(DWORD, SHRegCreateUSKeyA,
|
---|
53 | LPSTR, lpszKeyName,
|
---|
54 | DWORD, arg1,
|
---|
55 | DWORD, arg2,
|
---|
56 | DWORD, arg3,
|
---|
57 | DWORD, arg4)
|
---|
58 | {
|
---|
59 | dprintf(("not implemented\n"));
|
---|
60 | return 0;
|
---|
61 | }
|
---|
62 |
|
---|
63 |
|
---|
64 | /*****************************************************************************
|
---|
65 | * Name : DWORD SHRegCreateUSKeyW
|
---|
66 | * Purpose :
|
---|
67 | * Parameters:
|
---|
68 | * Variables :
|
---|
69 | * Result :
|
---|
70 | * Remark : SHLWAPI.595 SHLWAPI.SHRegCreateUSKeyW
|
---|
71 | * Status : STUB UNTESTED
|
---|
72 | *
|
---|
73 | * Author : Patrick Haller [Wed, 1999/12/29 23:02]
|
---|
74 | *****************************************************************************/
|
---|
75 |
|
---|
76 | ODINFUNCTION5(DWORD, SHRegCreateUSKeyW,
|
---|
77 | LPWSTR, lpszKeyName,
|
---|
78 | DWORD, arg1,
|
---|
79 | DWORD, arg2,
|
---|
80 | DWORD, arg3,
|
---|
81 | DWORD, arg4)
|
---|
82 | {
|
---|
83 | char szBuffer[256];
|
---|
84 |
|
---|
85 | // convert unicode to ascii
|
---|
86 | if (0 == WideCharToMultiByte(0,
|
---|
87 | 0,
|
---|
88 | lpszKeyName,
|
---|
89 | -1,
|
---|
90 | szBuffer,
|
---|
91 | sizeof(szBuffer),
|
---|
92 | 0,
|
---|
93 | 0))
|
---|
94 | return GetLastError();
|
---|
95 |
|
---|
96 | return SHRegCreateUSKeyA(szBuffer,
|
---|
97 | arg1,
|
---|
98 | arg2,
|
---|
99 | arg3,
|
---|
100 | arg4);
|
---|
101 | }
|
---|
102 |
|
---|
103 |
|
---|
104 |
|
---|
105 | /*
|
---|
106 | shlwapi functions that have found their way in because most of
|
---|
107 | shlwapi is unimplemented and doesn't have a home.
|
---|
108 |
|
---|
109 | FIXME: move to a more appropriate file( when one exists )
|
---|
110 | */
|
---|
111 |
|
---|
112 |
|
---|
113 | /* gets a user-specific registry value. */
|
---|
114 |
|
---|
115 |
|
---|
116 | /*****************************************************************************
|
---|
117 | * Name : DWORD SHRegGetBoolUSValueA
|
---|
118 | * Purpose : unknown
|
---|
119 | * Parameters: unknown
|
---|
120 | * Variables :
|
---|
121 | * Result : unknown
|
---|
122 | * Remark : SHLWAPI.SHRegGetBoolUSValueA
|
---|
123 | * Status : COMPLETELY IMPLEMENTED ? UNTESTED
|
---|
124 | *
|
---|
125 | * Author : Patrick Haller [Wed, 1999/12/29 23:02]
|
---|
126 | *****************************************************************************/
|
---|
127 |
|
---|
128 | ODINFUNCTION4(BOOL, SHRegGetBoolUSValueA,
|
---|
129 | LPCSTR, pszSubKey,
|
---|
130 | LPCSTR, pszValue,
|
---|
131 | BOOL, fIgnoreHKCU,
|
---|
132 | BOOL, fDefault)
|
---|
133 | {
|
---|
134 | char szBuffer[260];
|
---|
135 | DWORD dwLength = sizeof(szBuffer);
|
---|
136 | LONG rc;
|
---|
137 |
|
---|
138 | dprintf(("subkey=%s, value=%s\n",
|
---|
139 | pszSubKey,
|
---|
140 | pszValue));
|
---|
141 |
|
---|
142 | rc = SHRegGetUSValueA(pszSubKey,
|
---|
143 | pszValue,
|
---|
144 | &fDefault,
|
---|
145 | szBuffer,
|
---|
146 | &dwLength,
|
---|
147 | fIgnoreHKCU,
|
---|
148 | fDefault ? "YES" : "NO",
|
---|
149 | fDefault ? 4 : 3);
|
---|
150 | if (rc != ERROR_SUCCESS)
|
---|
151 | return rc;
|
---|
152 |
|
---|
153 | if (lstrcmpiA("YES",
|
---|
154 | szBuffer) == 0)
|
---|
155 | return 1;
|
---|
156 | else
|
---|
157 | if (lstrcmpiA("TRUE",
|
---|
158 | szBuffer) == 0)
|
---|
159 | return 1;
|
---|
160 | else
|
---|
161 | if (lstrcmpiA("NO",
|
---|
162 | szBuffer) == 0)
|
---|
163 | return 0;
|
---|
164 | else
|
---|
165 | if (lstrcmpiA("FALSE",
|
---|
166 | szBuffer) == 0)
|
---|
167 | return 0;
|
---|
168 |
|
---|
169 |
|
---|
170 | return ERROR_SUCCESS; /* return success */
|
---|
171 | }
|
---|
172 |
|
---|
173 |
|
---|
174 | /*****************************************************************************
|
---|
175 | * Name : DWORD SHRegGetBoolUSValueW
|
---|
176 | * Purpose : unknown
|
---|
177 | * Parameters: unknown
|
---|
178 | * Variables :
|
---|
179 | * Result : unknown
|
---|
180 | * Remark : SHLWAPI.SHRegGetBoolUSValueW
|
---|
181 | * Status : STUB UNTESTED
|
---|
182 | *
|
---|
183 | * Author : Patrick Haller [Wed, 1999/12/29 23:02]
|
---|
184 | *****************************************************************************/
|
---|
185 |
|
---|
186 | ODINFUNCTION4(BOOL, SHRegGetBoolUSValueW,
|
---|
187 | LPCWSTR, pszSubKey,
|
---|
188 | LPCWSTR, pszValue,
|
---|
189 | BOOL, fIgnoreHKCU,
|
---|
190 | BOOL, fDefault)
|
---|
191 | {
|
---|
192 | char szBuffer[264];
|
---|
193 | int iLength;
|
---|
194 |
|
---|
195 | dprintf(("(%p),stub!\n", pszSubKey));
|
---|
196 |
|
---|
197 | return ERROR_SUCCESS; /* return success */
|
---|
198 | }
|
---|
199 |
|
---|
200 |
|
---|
201 | /*****************************************************************************
|
---|
202 | * Name : DWORD SHRegSetUSValueA
|
---|
203 | * Purpose :
|
---|
204 | * Parameters:
|
---|
205 | * Variables :
|
---|
206 | * Result :
|
---|
207 | * Remark : SHLWAPI.SHRegSetUSValueA SHLWAPI.615
|
---|
208 | * Status : STUB UNTESTED
|
---|
209 | *
|
---|
210 | * Author : Patrick Haller [Wed, 1999/12/29 23:02]
|
---|
211 | *****************************************************************************/
|
---|
212 |
|
---|
213 | ODINFUNCTION6(LONG, SHRegSetUSValueA,
|
---|
214 | HKEY, hKey,
|
---|
215 | DWORD, arg2,
|
---|
216 | DWORD, arg3,
|
---|
217 | DWORD, arg4,
|
---|
218 | DWORD, arg5,
|
---|
219 | DWORD, arg6)
|
---|
220 | {
|
---|
221 | LONG rc;
|
---|
222 |
|
---|
223 | #if 0
|
---|
224 | rc = SHRegCreateUSKeyA(hKey,
|
---|
225 | 3,
|
---|
226 | 0,
|
---|
227 | &hKey);
|
---|
228 | if (rc == ERROR_SUCCESS)
|
---|
229 | {
|
---|
230 | rc = SHRegWriteUSValueA(hKey,
|
---|
231 | arg2,
|
---|
232 | arg3,
|
---|
233 | arg4,
|
---|
234 | arg5,
|
---|
235 | arg6);
|
---|
236 | SHRegCloseUSKey(hKey);
|
---|
237 | }
|
---|
238 | #endif
|
---|
239 |
|
---|
240 | return rc;
|
---|
241 | }
|
---|
242 |
|
---|
243 |
|
---|
244 |
|
---|
245 |
|
---|
246 | /*****************************************************************************
|
---|
247 | * Name : DWORD SHRegSetUSValueW
|
---|
248 | * Purpose :
|
---|
249 | * Parameters:
|
---|
250 | * Variables :
|
---|
251 | * Result :
|
---|
252 | * Remark : SHLWAPI.SHRegSetUSValueW SHLWAPI.616
|
---|
253 | * Status : STUB UNTESTED
|
---|
254 | *
|
---|
255 | * Author : Patrick Haller [Wed, 1999/12/29 23:02]
|
---|
256 | *****************************************************************************/
|
---|
257 |
|
---|
258 | ODINFUNCTION6(LONG, SHRegSetUSValueW,
|
---|
259 | HKEY, hKey,
|
---|
260 | DWORD, arg2,
|
---|
261 | DWORD, arg3,
|
---|
262 | DWORD, arg4,
|
---|
263 | DWORD, arg5,
|
---|
264 | DWORD, arg6)
|
---|
265 | {
|
---|
266 | LONG rc;
|
---|
267 |
|
---|
268 | #if 0
|
---|
269 | rc = SHRegCreateUSKeyW(hKey,
|
---|
270 | 3,
|
---|
271 | 0,
|
---|
272 | &hKey);
|
---|
273 | if (rc == ERROR_SUCCESS)
|
---|
274 | {
|
---|
275 | rc = SHRegWriteUSValueW(hKey,
|
---|
276 | arg2,
|
---|
277 | arg3,
|
---|
278 | arg4,
|
---|
279 | arg5,
|
---|
280 | arg6);
|
---|
281 | SHRegCloseUSKey(hKey);
|
---|
282 | }
|
---|
283 | #endif
|
---|
284 |
|
---|
285 | return rc;
|
---|
286 | }
|
---|
287 |
|
---|
288 |
|
---|