| 1 | /* $Id: reg.cpp,v 1.3 2000-06-12 11:35:14 phaller 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 | #include <odin.h>
|
|---|
| 26 |
|
|---|
| 27 | #include "debugtools.h"
|
|---|
| 28 | #include "winnls.h"
|
|---|
| 29 | #include "winversion.h"
|
|---|
| 30 | #include "winreg.h"
|
|---|
| 31 |
|
|---|
| 32 | #include <heapstring.h>
|
|---|
| 33 | #include <misc.h>
|
|---|
| 34 | #include <win\winerror.h>
|
|---|
| 35 | #include "shlwapi.h"
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 | ODINDEBUGCHANNEL(SHLWAPI-REG)
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 | /*****************************************************************************
|
|---|
| 42 | * Name : DWORD SHRegCreateUSKeyA
|
|---|
| 43 | * Purpose :
|
|---|
| 44 | * Parameters:
|
|---|
| 45 | * Variables :
|
|---|
| 46 | * Result :
|
|---|
| 47 | * Remark : SHLWAPI.594 SHLWAPI.SHRegCreateUSKeyA
|
|---|
| 48 | * Status : UNTESTED
|
|---|
| 49 | *
|
|---|
| 50 | * Author : Patrick Haller [Wed, 1999/12/29 23:02]
|
|---|
| 51 | *****************************************************************************/
|
|---|
| 52 |
|
|---|
| 53 | ODINFUNCTION5(DWORD, SHRegCreateUSKeyA,
|
|---|
| 54 | LPSTR, lpszKeyName,
|
|---|
| 55 | DWORD, arg1,
|
|---|
| 56 | DWORD, arg2,
|
|---|
| 57 | DWORD, arg3,
|
|---|
| 58 | DWORD, arg4)
|
|---|
| 59 | {
|
|---|
| 60 | dprintf(("not implemented\n"));
|
|---|
| 61 | return 0;
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 | /*****************************************************************************
|
|---|
| 66 | * Name : DWORD SHRegCreateUSKeyW
|
|---|
| 67 | * Purpose :
|
|---|
| 68 | * Parameters:
|
|---|
| 69 | * Variables :
|
|---|
| 70 | * Result :
|
|---|
| 71 | * Remark : SHLWAPI.595 SHLWAPI.SHRegCreateUSKeyW
|
|---|
| 72 | * Status : UNTESTED
|
|---|
| 73 | *
|
|---|
| 74 | * Author : Patrick Haller [Wed, 1999/12/29 23:02]
|
|---|
| 75 | *****************************************************************************/
|
|---|
| 76 |
|
|---|
| 77 | ODINFUNCTION5(DWORD, SHRegCreateUSKeyW,
|
|---|
| 78 | LPWSTR, lpszKeyName,
|
|---|
| 79 | DWORD, arg1,
|
|---|
| 80 | DWORD, arg2,
|
|---|
| 81 | DWORD, arg3,
|
|---|
| 82 | DWORD, arg4)
|
|---|
| 83 | {
|
|---|
| 84 | char szBuffer[256];
|
|---|
| 85 |
|
|---|
| 86 | // convert unicode to ascii
|
|---|
| 87 | if (0 == WideCharToMultiByte(0,
|
|---|
| 88 | 0,
|
|---|
| 89 | lpszKeyName,
|
|---|
| 90 | -1,
|
|---|
| 91 | szBuffer,
|
|---|
| 92 | sizeof(szBuffer),
|
|---|
| 93 | 0,
|
|---|
| 94 | 0))
|
|---|
| 95 | return GetLastError();
|
|---|
| 96 |
|
|---|
| 97 | return SHRegCreateUSKeyA(szBuffer,
|
|---|
| 98 | arg1,
|
|---|
| 99 | arg2,
|
|---|
| 100 | arg3,
|
|---|
| 101 | arg4);
|
|---|
| 102 | }
|
|---|
| 103 |
|
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 | /*
|
|---|
| 107 | shlwapi functions that have found their way in because most of
|
|---|
| 108 | shlwapi is unimplemented and doesn't have a home.
|
|---|
| 109 |
|
|---|
| 110 | FIXME: move to a more appropriate file( when one exists )
|
|---|
| 111 | */
|
|---|
| 112 |
|
|---|
| 113 | /* SHGetValue: Gets a value from the registry */
|
|---|
| 114 |
|
|---|
| 115 | ODINFUNCTION6(DWORD,SHGetValueA,HKEY, hkey,
|
|---|
| 116 | LPCSTR, pSubKey,
|
|---|
| 117 | LPCSTR, pValue,
|
|---|
| 118 | LPDWORD, pwType,
|
|---|
| 119 | LPVOID, pvData,
|
|---|
| 120 | LPDWORD, pbData)
|
|---|
| 121 | {
|
|---|
| 122 | dprintf(("(%p),stub!\n", pSubKey));
|
|---|
| 123 |
|
|---|
| 124 | return ERROR_SUCCESS; /* return success */
|
|---|
| 125 | }
|
|---|
| 126 |
|
|---|
| 127 | ODINFUNCTION6(DWORD,SHGetValueW,HKEY, hkey,
|
|---|
| 128 | LPCWSTR, pSubKey,
|
|---|
| 129 | LPCWSTR, pValue,
|
|---|
| 130 | LPDWORD, pwType,
|
|---|
| 131 | LPVOID, pvData,
|
|---|
| 132 | LPDWORD, pbData)
|
|---|
| 133 | {
|
|---|
| 134 | dprintf(("(%p),stub!\n", pSubKey));
|
|---|
| 135 |
|
|---|
| 136 | return ERROR_SUCCESS; /* return success */
|
|---|
| 137 | }
|
|---|
| 138 |
|
|---|
| 139 | /* gets a user-specific registry value. */
|
|---|
| 140 |
|
|---|
| 141 | ODINFUNCTION8(LONG,SHRegGetUSValueA,LPCSTR, pSubKey,
|
|---|
| 142 | LPCSTR, pValue,
|
|---|
| 143 | LPDWORD, pwType,
|
|---|
| 144 | LPVOID, pvData,
|
|---|
| 145 | LPDWORD, pbData,
|
|---|
| 146 | BOOL, fIgnoreHKCU,
|
|---|
| 147 | LPVOID, pDefaultData,
|
|---|
| 148 | DWORD, wDefaultDataSize)
|
|---|
| 149 | {
|
|---|
| 150 | FIXME("(%p),stub!\n", pSubKey);
|
|---|
| 151 |
|
|---|
| 152 | return ERROR_SUCCESS; /* return success */
|
|---|
| 153 | }
|
|---|
| 154 |
|
|---|
| 155 | ODINFUNCTION8(LONG,SHRegGetUSValueW,LPCWSTR, pSubKey,
|
|---|
| 156 | LPCWSTR, pValue,
|
|---|
| 157 | LPDWORD, pwType,
|
|---|
| 158 | LPVOID, pvData,
|
|---|
| 159 | LPDWORD, pbData,
|
|---|
| 160 | BOOL, flagIgnoreHKCU,
|
|---|
| 161 | LPVOID, pDefaultData,
|
|---|
| 162 | DWORD, wDefaultDataSize)
|
|---|
| 163 | {
|
|---|
| 164 | dprintf(("(%p),stub!\n", pSubKey));
|
|---|
| 165 |
|
|---|
| 166 | return ERROR_SUCCESS; /* return success */
|
|---|
| 167 | }
|
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 | /*****************************************************************************
|
|---|
| 171 | * Name : DWORD SHRegGetBoolUSValueA
|
|---|
| 172 | * Purpose : unknown
|
|---|
| 173 | * Parameters: unknown
|
|---|
| 174 | * Variables :
|
|---|
| 175 | * Result : unknown
|
|---|
| 176 | * Remark : SHLWAPI.SHRegGetBoolUSValueA
|
|---|
| 177 | * Status : UNTESTED
|
|---|
| 178 | *
|
|---|
| 179 | * Author : Patrick Haller [Wed, 1999/12/29 23:02]
|
|---|
| 180 | *****************************************************************************/
|
|---|
| 181 |
|
|---|
| 182 | ODINFUNCTION4(BOOL, SHRegGetBoolUSValueA,
|
|---|
| 183 | LPCSTR, pszSubKey,
|
|---|
| 184 | LPCSTR, pszValue,
|
|---|
| 185 | BOOL, fIgnoreHKCU,
|
|---|
| 186 | BOOL, fDefault)
|
|---|
| 187 | {
|
|---|
| 188 | char szBuffer[260];
|
|---|
| 189 | DWORD dwLength = sizeof(szBuffer);
|
|---|
| 190 | LONG rc;
|
|---|
| 191 |
|
|---|
| 192 | dprintf(("subkey=%s, value=%s\n",
|
|---|
| 193 | pszSubKey,
|
|---|
| 194 | pszValue));
|
|---|
| 195 |
|
|---|
| 196 | rc = SHRegGetUSValueA(pszSubKey,
|
|---|
| 197 | pszValue,
|
|---|
| 198 | &fDefault,
|
|---|
| 199 | szBuffer,
|
|---|
| 200 | &dwLength,
|
|---|
| 201 | fIgnoreHKCU,
|
|---|
| 202 | fDefault ? "YES" : "NO",
|
|---|
| 203 | fDefault ? 4 : 3);
|
|---|
| 204 | if (rc != ERROR_SUCCESS)
|
|---|
| 205 | return rc;
|
|---|
| 206 |
|
|---|
| 207 | if (lstrcmpiA("YES",
|
|---|
| 208 | szBuffer) == 0)
|
|---|
| 209 | return 1;
|
|---|
| 210 | else
|
|---|
| 211 | if (lstrcmpiA("TRUE",
|
|---|
| 212 | szBuffer) == 0)
|
|---|
| 213 | return 1;
|
|---|
| 214 | else
|
|---|
| 215 | if (lstrcmpiA("NO",
|
|---|
| 216 | szBuffer) == 0)
|
|---|
| 217 | return 0;
|
|---|
| 218 | else
|
|---|
| 219 | if (lstrcmpiA("FALSE",
|
|---|
| 220 | szBuffer) == 0)
|
|---|
| 221 | return 0;
|
|---|
| 222 |
|
|---|
| 223 |
|
|---|
| 224 | return ERROR_SUCCESS; /* return success */
|
|---|
| 225 | }
|
|---|
| 226 |
|
|---|
| 227 |
|
|---|
| 228 | /*****************************************************************************
|
|---|
| 229 | * Name : DWORD SHRegGetBoolUSValueW
|
|---|
| 230 | * Purpose : unknown
|
|---|
| 231 | * Parameters: unknown
|
|---|
| 232 | * Variables :
|
|---|
| 233 | * Result : unknown
|
|---|
| 234 | * Remark : SHLWAPI.SHRegGetBoolUSValueW
|
|---|
| 235 | * Status : UNTESTED
|
|---|
| 236 | *
|
|---|
| 237 | * Author : Patrick Haller [Wed, 1999/12/29 23:02]
|
|---|
| 238 | *****************************************************************************/
|
|---|
| 239 |
|
|---|
| 240 | ODINFUNCTION4(BOOL, SHRegGetBoolUSValueW,
|
|---|
| 241 | LPCWSTR, pszSubKey,
|
|---|
| 242 | LPCWSTR, pszValue,
|
|---|
| 243 | BOOL, fIgnoreHKCU,
|
|---|
| 244 | BOOL, fDefault)
|
|---|
| 245 | {
|
|---|
| 246 | char szBuffer[264];
|
|---|
| 247 | int iLength;
|
|---|
| 248 |
|
|---|
| 249 | dprintf(("(%p),stub!\n", pszSubKey));
|
|---|
| 250 |
|
|---|
| 251 | return ERROR_SUCCESS; /* return success */
|
|---|
| 252 | }
|
|---|
| 253 |
|
|---|
| 254 |
|
|---|
| 255 | /*****************************************************************************
|
|---|
| 256 | * Name : DWORD SHRegSetUSValueA
|
|---|
| 257 | * Purpose :
|
|---|
| 258 | * Parameters:
|
|---|
| 259 | * Variables :
|
|---|
| 260 | * Result :
|
|---|
| 261 | * Remark : SHLWAPI.SHRegSetUSValueA SHLWAPI.615
|
|---|
| 262 | * Status : UNTESTED
|
|---|
| 263 | *
|
|---|
| 264 | * Author : Patrick Haller [Wed, 1999/12/29 23:02]
|
|---|
| 265 | *****************************************************************************/
|
|---|
| 266 |
|
|---|
| 267 | ODINFUNCTION6(LONG, SHRegSetUSValueA,
|
|---|
| 268 | HKEY, hKey,
|
|---|
| 269 | DWORD, arg2,
|
|---|
| 270 | DWORD, arg3,
|
|---|
| 271 | DWORD, arg4,
|
|---|
| 272 | DWORD, arg5,
|
|---|
| 273 | DWORD, arg6)
|
|---|
| 274 | {
|
|---|
| 275 | LONG rc;
|
|---|
| 276 |
|
|---|
| 277 | #if 0
|
|---|
| 278 | rc = SHRegCreateUSKeyA(hKey,
|
|---|
| 279 | 3,
|
|---|
| 280 | 0,
|
|---|
| 281 | &hKey);
|
|---|
| 282 | if (rc == ERROR_SUCCESS)
|
|---|
| 283 | {
|
|---|
| 284 | rc = SHRegWriteUSValueA(hKey,
|
|---|
| 285 | arg2,
|
|---|
| 286 | arg3,
|
|---|
| 287 | arg4,
|
|---|
| 288 | arg5,
|
|---|
| 289 | arg6);
|
|---|
| 290 | SHRegCloseUSKey(hKey);
|
|---|
| 291 | }
|
|---|
| 292 | #endif
|
|---|
| 293 |
|
|---|
| 294 | return rc;
|
|---|
| 295 | }
|
|---|
| 296 |
|
|---|
| 297 |
|
|---|
| 298 |
|
|---|
| 299 |
|
|---|
| 300 | /*****************************************************************************
|
|---|
| 301 | * Name : DWORD SHRegSetUSValueW
|
|---|
| 302 | * Purpose :
|
|---|
| 303 | * Parameters:
|
|---|
| 304 | * Variables :
|
|---|
| 305 | * Result :
|
|---|
| 306 | * Remark : SHLWAPI.SHRegSetUSValueW SHLWAPI.616
|
|---|
| 307 | * Status : UNTESTED
|
|---|
| 308 | *
|
|---|
| 309 | * Author : Patrick Haller [Wed, 1999/12/29 23:02]
|
|---|
| 310 | *****************************************************************************/
|
|---|
| 311 |
|
|---|
| 312 | ODINFUNCTION6(LONG, SHRegSetUSValueW,
|
|---|
| 313 | HKEY, hKey,
|
|---|
| 314 | DWORD, arg2,
|
|---|
| 315 | DWORD, arg3,
|
|---|
| 316 | DWORD, arg4,
|
|---|
| 317 | DWORD, arg5,
|
|---|
| 318 | DWORD, arg6)
|
|---|
| 319 | {
|
|---|
| 320 | LONG rc;
|
|---|
| 321 |
|
|---|
| 322 | #if 0
|
|---|
| 323 | rc = SHRegCreateUSKeyW(hKey,
|
|---|
| 324 | 3,
|
|---|
| 325 | 0,
|
|---|
| 326 | &hKey);
|
|---|
| 327 | if (rc == ERROR_SUCCESS)
|
|---|
| 328 | {
|
|---|
| 329 | rc = SHRegWriteUSValueW(hKey,
|
|---|
| 330 | arg2,
|
|---|
| 331 | arg3,
|
|---|
| 332 | arg4,
|
|---|
| 333 | arg5,
|
|---|
| 334 | arg6);
|
|---|
| 335 | SHRegCloseUSKey(hKey);
|
|---|
| 336 | }
|
|---|
| 337 | #endif
|
|---|
| 338 |
|
|---|
| 339 | return rc;
|
|---|
| 340 | }
|
|---|
| 341 |
|
|---|
| 342 |
|
|---|