| 1 | /* $Id: shlwapi.cpp,v 1.5 2000-03-30 15:40:43 cbratschi 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 | #define ICOM_CINTERFACE 1
|
|---|
| 28 | #define CINTERFACE 1
|
|---|
| 29 |
|
|---|
| 30 | #include "debugtools.h"
|
|---|
| 31 | #include "winnls.h"
|
|---|
| 32 | #include "winversion.h"
|
|---|
| 33 | #include "winreg.h"
|
|---|
| 34 | #include "crtdll.h"
|
|---|
| 35 |
|
|---|
| 36 | #include <heapstring.h>
|
|---|
| 37 | #include <misc.h>
|
|---|
| 38 | #include <win\shell.h>
|
|---|
| 39 | #include <win\winerror.h>
|
|---|
| 40 |
|
|---|
| 41 | ODINDEBUGCHANNEL(SHLWAPI)
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 | /*
|
|---|
| 46 | shlwapi functions that have found their way in because most of
|
|---|
| 47 | shlwapi is unimplemented and doesn't have a home.
|
|---|
| 48 |
|
|---|
| 49 | FIXME: move to a more appropriate file( when one exists )
|
|---|
| 50 | */
|
|---|
| 51 |
|
|---|
| 52 | /* SHGetValue: Gets a value from the registry */
|
|---|
| 53 |
|
|---|
| 54 | ODINFUNCTION6(DWORD,SHGetValueA,HKEY, hkey,
|
|---|
| 55 | LPCSTR, pSubKey,
|
|---|
| 56 | LPCSTR, pValue,
|
|---|
| 57 | LPDWORD, pwType,
|
|---|
| 58 | LPVOID, pvData,
|
|---|
| 59 | LPDWORD, pbData)
|
|---|
| 60 | {
|
|---|
| 61 | dprintf(("(%p),stub!\n", pSubKey));
|
|---|
| 62 |
|
|---|
| 63 | return ERROR_SUCCESS; /* return success */
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|
| 66 | ODINFUNCTION6(DWORD,SHGetValueW,HKEY, hkey,
|
|---|
| 67 | LPCWSTR, pSubKey,
|
|---|
| 68 | LPCWSTR, pValue,
|
|---|
| 69 | LPDWORD, pwType,
|
|---|
| 70 | LPVOID, pvData,
|
|---|
| 71 | LPDWORD, pbData)
|
|---|
| 72 | {
|
|---|
| 73 | dprintf(("(%p),stub!\n", pSubKey));
|
|---|
| 74 |
|
|---|
| 75 | return ERROR_SUCCESS; /* return success */
|
|---|
| 76 | }
|
|---|
| 77 |
|
|---|
| 78 | /* gets a user-specific registry value. */
|
|---|
| 79 |
|
|---|
| 80 | ODINFUNCTION8(LONG,SHRegGetUSValueA,LPCSTR, pSubKey,
|
|---|
| 81 | LPCSTR, pValue,
|
|---|
| 82 | LPDWORD, pwType,
|
|---|
| 83 | LPVOID, pvData,
|
|---|
| 84 | LPDWORD, pbData,
|
|---|
| 85 | BOOL, fIgnoreHKCU,
|
|---|
| 86 | LPVOID, pDefaultData,
|
|---|
| 87 | DWORD, wDefaultDataSize)
|
|---|
| 88 | {
|
|---|
| 89 | FIXME("(%p),stub!\n", pSubKey);
|
|---|
| 90 |
|
|---|
| 91 | return ERROR_SUCCESS; /* return success */
|
|---|
| 92 | }
|
|---|
| 93 |
|
|---|
| 94 | ODINFUNCTION8(LONG,SHRegGetUSValueW,LPCWSTR, pSubKey,
|
|---|
| 95 | LPCWSTR, pValue,
|
|---|
| 96 | LPDWORD, pwType,
|
|---|
| 97 | LPVOID, pvData,
|
|---|
| 98 | LPDWORD, pbData,
|
|---|
| 99 | BOOL, flagIgnoreHKCU,
|
|---|
| 100 | LPVOID, pDefaultData,
|
|---|
| 101 | DWORD, wDefaultDataSize)
|
|---|
| 102 | {
|
|---|
| 103 | dprintf(("(%p),stub!\n", pSubKey));
|
|---|
| 104 |
|
|---|
| 105 | return ERROR_SUCCESS; /* return success */
|
|---|
| 106 | }
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 | /*****************************************************************************
|
|---|
| 110 | * Name : DWORD SHRegGetBoolUSValueA
|
|---|
| 111 | * Purpose : unknown
|
|---|
| 112 | * Parameters: unknown
|
|---|
| 113 | * Variables :
|
|---|
| 114 | * Result : unknown
|
|---|
| 115 | * Remark : SHLWAPI.SHRegGetBoolUSValueA
|
|---|
| 116 | * Status : UNTESTED
|
|---|
| 117 | *
|
|---|
| 118 | * Author : Patrick Haller [Wed, 1999/12/29 23:02]
|
|---|
| 119 | *****************************************************************************/
|
|---|
| 120 |
|
|---|
| 121 | ODINFUNCTION5(LONG, SHRegGetBoolUSValueA,
|
|---|
| 122 | LPCSTR, pSubKey,
|
|---|
| 123 | DWORD, arg2,
|
|---|
| 124 | DWORD, arg3,
|
|---|
| 125 | DWORD, arg4,
|
|---|
| 126 | DWORD, arg5)
|
|---|
| 127 | {
|
|---|
| 128 | char szBuffer[264];
|
|---|
| 129 | int iLength;
|
|---|
| 130 |
|
|---|
| 131 | dprintf(("(%p),stub!\n", pSubKey));
|
|---|
| 132 |
|
|---|
| 133 | return ERROR_SUCCESS; /* return success */
|
|---|
| 134 | }
|
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 | /*****************************************************************************
|
|---|
| 138 | * Name : DWORD SHRegGetBoolUSValueW
|
|---|
| 139 | * Purpose : unknown
|
|---|
| 140 | * Parameters: unknown
|
|---|
| 141 | * Variables :
|
|---|
| 142 | * Result : unknown
|
|---|
| 143 | * Remark : SHLWAPI.SHRegGetBoolUSValueW
|
|---|
| 144 | * Status : UNTESTED
|
|---|
| 145 | *
|
|---|
| 146 | * Author : Patrick Haller [Wed, 1999/12/29 23:02]
|
|---|
| 147 | *****************************************************************************/
|
|---|
| 148 |
|
|---|
| 149 | ODINFUNCTION5(LONG, SHRegGetBoolUSValueW,
|
|---|
| 150 | LPCWSTR, pSubKey,
|
|---|
| 151 | DWORD, arg2,
|
|---|
| 152 | DWORD, arg3,
|
|---|
| 153 | DWORD, arg4,
|
|---|
| 154 | DWORD, arg5)
|
|---|
| 155 | {
|
|---|
| 156 | char szBuffer[264];
|
|---|
| 157 | int iLength;
|
|---|
| 158 |
|
|---|
| 159 | dprintf(("(%p),stub!\n", pSubKey));
|
|---|
| 160 |
|
|---|
| 161 | return ERROR_SUCCESS; /* return success */
|
|---|
| 162 | }
|
|---|
| 163 |
|
|---|
| 164 |
|
|---|
| 165 | /*****************************************************************************
|
|---|
| 166 | * Name : LPSTR PathSkipRootA
|
|---|
| 167 | * Purpose : Parses a path, ignoring the drive letter or UNC server/share path parts.
|
|---|
| 168 | * Parameters: LPCSTR pszPath
|
|---|
| 169 | * Variables :
|
|---|
| 170 | * Result : unknown
|
|---|
| 171 | * Remark : SHLWAPI.PathSkipRootA
|
|---|
| 172 | * Status : UNTESTED
|
|---|
| 173 | *
|
|---|
| 174 | * Author : Patrick Haller [Mon, 2000/01/31 23:02]
|
|---|
| 175 | *****************************************************************************/
|
|---|
| 176 |
|
|---|
| 177 | ODINFUNCTION1(LPSTR, PathSkipRootA, LPCSTR, pszPath)
|
|---|
| 178 | {
|
|---|
| 179 | // check if "driveletter:\"
|
|---|
| 180 | if (pszPath[1] == ':')
|
|---|
| 181 | return (LPSTR)(pszPath + 2);
|
|---|
| 182 |
|
|---|
| 183 | // check if UNC-style path
|
|---|
| 184 | if ( (pszPath[0] == '\\') &&
|
|---|
| 185 | (pszPath[1] == '\\') )
|
|---|
| 186 | {
|
|---|
| 187 | LPSTR pszTemp = strchr(pszPath + 2, '\\');
|
|---|
| 188 | if (NULL != pszTemp)
|
|---|
| 189 | // return root part, skip server/share
|
|---|
| 190 | return (LPSTR)pszTemp++;
|
|---|
| 191 | else
|
|---|
| 192 | // UNC syntax validation, return pszPath
|
|---|
| 193 | return (LPSTR)pszTemp;
|
|---|
| 194 | }
|
|---|
| 195 |
|
|---|
| 196 | // else ...
|
|---|
| 197 | return (LPSTR)pszPath;
|
|---|
| 198 | }
|
|---|
| 199 |
|
|---|
| 200 |
|
|---|
| 201 | /*****************************************************************************
|
|---|
| 202 | * Name : LPWSTR PathSkipRootW
|
|---|
| 203 | * Purpose : Parses a path, ignoring the drive letter or UNC server/share path parts.
|
|---|
| 204 | * Parameters: LPCWSTR pszPath
|
|---|
| 205 | * Variables :
|
|---|
| 206 | * Result : unknown
|
|---|
| 207 | * Remark : SHLWAPI.PathSkipRootW
|
|---|
| 208 | * Status : UNTESTED
|
|---|
| 209 | *
|
|---|
| 210 | * Author : Patrick Haller [Mon, 2000/01/31 23:02]
|
|---|
| 211 | *****************************************************************************/
|
|---|
| 212 |
|
|---|
| 213 | ODINFUNCTION1(LPWSTR, PathSkipRootW, LPCWSTR, pszPath)
|
|---|
| 214 | {
|
|---|
| 215 | dprintf(("not implemented"));
|
|---|
| 216 |
|
|---|
| 217 | return (LPWSTR)pszPath;
|
|---|
| 218 | }
|
|---|
| 219 |
|
|---|
| 220 | /*****************************************************************************
|
|---|
| 221 | * Name : ???
|
|---|
| 222 | * Purpose : Unknown (used by explorer.exe)
|
|---|
| 223 | * Parameters: Unknown (wrong)
|
|---|
| 224 | * Variables :
|
|---|
| 225 | * Result : Unknown
|
|---|
| 226 | * Remark :
|
|---|
| 227 | * Status : UNTESTED STUB
|
|---|
| 228 | *
|
|---|
| 229 | * Author : Christoph Bratschi [Wed, 2000/03/29 19:47]
|
|---|
| 230 | *****************************************************************************/
|
|---|
| 231 |
|
|---|
| 232 | ODINFUNCTION1(DWORD,SHLWAPI_8,DWORD,x)
|
|---|
| 233 | {
|
|---|
| 234 | dprintf(("not implemented"));
|
|---|
| 235 |
|
|---|
| 236 | return 0;
|
|---|
| 237 | }
|
|---|
| 238 |
|
|---|
| 239 | /*****************************************************************************
|
|---|
| 240 | * Name : ???
|
|---|
| 241 | * Purpose : Unknown (used by explorer.exe)
|
|---|
| 242 | * Parameters: Unknown (wrong)
|
|---|
| 243 | * Variables :
|
|---|
| 244 | * Result : Unknown
|
|---|
| 245 | * Remark :
|
|---|
| 246 | * Status : UNTESTED STUB
|
|---|
| 247 | *
|
|---|
| 248 | * Author : Christoph Bratschi [Wed, 2000/03/29 19:47]
|
|---|
| 249 | *****************************************************************************/
|
|---|
| 250 |
|
|---|
| 251 | ODINFUNCTION1(DWORD,SHLWAPI_9,DWORD,x)
|
|---|
| 252 | {
|
|---|
| 253 | dprintf(("not implemented"));
|
|---|
| 254 |
|
|---|
| 255 | return 0;
|
|---|
| 256 | }
|
|---|
| 257 |
|
|---|
| 258 | /*****************************************************************************
|
|---|
| 259 | * Name : ???
|
|---|
| 260 | * Purpose : Unknown (used by explorer.exe)
|
|---|
| 261 | * Parameters: Unknown (wrong)
|
|---|
| 262 | * Variables :
|
|---|
| 263 | * Result : Unknown
|
|---|
| 264 | * Remark :
|
|---|
| 265 | * Status : UNTESTED STUB
|
|---|
| 266 | *
|
|---|
| 267 | * Author : Christoph Bratschi [Wed, 2000/03/29 19:47]
|
|---|
| 268 | *****************************************************************************/
|
|---|
| 269 |
|
|---|
| 270 | ODINFUNCTION1(DWORD,SHLWAPI_10,DWORD,x)
|
|---|
| 271 | {
|
|---|
| 272 | dprintf(("not implemented"));
|
|---|
| 273 |
|
|---|
| 274 | return 0;
|
|---|
| 275 | }
|
|---|
| 276 |
|
|---|
| 277 | /*****************************************************************************
|
|---|
| 278 | * Name : ???
|
|---|
| 279 | * Purpose : Unknown (used by explorer.exe)
|
|---|
| 280 | * Parameters: Unknown (wrong)
|
|---|
| 281 | * Variables :
|
|---|
| 282 | * Result : Unknown
|
|---|
| 283 | * Remark :
|
|---|
| 284 | * Status : UNTESTED STUB
|
|---|
| 285 | *
|
|---|
| 286 | * Author : Christoph Bratschi [Wed, 2000/03/29 19:47]
|
|---|
| 287 | *****************************************************************************/
|
|---|
| 288 |
|
|---|
| 289 | ODINFUNCTION1(DWORD,SHLWAPI_16,DWORD,x)
|
|---|
| 290 | {
|
|---|
| 291 | dprintf(("not implemented, explorer.exe will trap now"));
|
|---|
| 292 |
|
|---|
| 293 | return 0;
|
|---|
| 294 | }
|
|---|
| 295 |
|
|---|
| 296 | /*****************************************************************************
|
|---|
| 297 | * Name : PathStripToRootA
|
|---|
| 298 | * Purpose : return root (used by explorer.exe)
|
|---|
| 299 | * Parameters: Unknown (wrong)
|
|---|
| 300 | * Variables :
|
|---|
| 301 | * Result : Unknown
|
|---|
| 302 | * Remark :
|
|---|
| 303 | * Status : UNTESTED STUB
|
|---|
| 304 | *
|
|---|
| 305 | * Author : Christoph Bratschi [Wed, 2000/03/29 19:47]
|
|---|
| 306 | *****************************************************************************/
|
|---|
| 307 |
|
|---|
| 308 | ODINFUNCTION1(LPSTR,PathStripToRootA,LPSTR,pszPath)
|
|---|
| 309 | {
|
|---|
| 310 | dprintf(("not implemented"));
|
|---|
| 311 |
|
|---|
| 312 | return NULL;
|
|---|
| 313 | }
|
|---|
| 314 |
|
|---|
| 315 | /*****************************************************************************
|
|---|
| 316 | * Name : PathStripToRootW
|
|---|
| 317 | * Purpose : return root (used by explorer.exe)
|
|---|
| 318 | * Parameters: Unknown (wrong)
|
|---|
| 319 | * Variables :
|
|---|
| 320 | * Result : Unknown
|
|---|
| 321 | * Remark :
|
|---|
| 322 | * Status : UNTESTED STUB
|
|---|
| 323 | *
|
|---|
| 324 | * Author : Christoph Bratschi [Wed, 2000/03/29 19:47]
|
|---|
| 325 | *****************************************************************************/
|
|---|
| 326 |
|
|---|
| 327 | ODINFUNCTION1(LPSTR,PathStripToRootW,LPSTR,pszPath)
|
|---|
| 328 | {
|
|---|
| 329 | dprintf(("not implemented"));
|
|---|
| 330 |
|
|---|
| 331 | return NULL;
|
|---|
| 332 | }
|
|---|
| 333 |
|
|---|
| 334 | /*****************************************************************************
|
|---|
| 335 | * Name : StrToIntA
|
|---|
| 336 | * Purpose : convert string to integer (used by explorer.exe)
|
|---|
| 337 | * Parameters: Unknown (wrong)
|
|---|
| 338 | * Variables :
|
|---|
| 339 | * Result : Unknown
|
|---|
| 340 | * Remark :
|
|---|
| 341 | * Status : UNTESTED STUB
|
|---|
| 342 | *
|
|---|
| 343 | * Author : Christoph Bratschi [Wed, 2000/03/29 19:47]
|
|---|
| 344 | *****************************************************************************/
|
|---|
| 345 |
|
|---|
| 346 | ODINFUNCTION1(INT,StrToIntA,LPSTR,pszPath)
|
|---|
| 347 | {
|
|---|
| 348 | dprintf(("not implemented"));
|
|---|
| 349 |
|
|---|
| 350 | return NULL;
|
|---|
| 351 | }
|
|---|
| 352 |
|
|---|
| 353 | /*************************************************************************
|
|---|
| 354 | * PathFindExtension [SHELL32.31]
|
|---|
| 355 | *
|
|---|
| 356 | * NOTES
|
|---|
| 357 | * returns pointer to last . in last pathcomponent or at \0.
|
|---|
| 358 | */
|
|---|
| 359 | LPCSTR WINAPI PathFindExtensionA(LPCSTR path)
|
|---|
| 360 | { LPCSTR lastpoint = NULL;
|
|---|
| 361 | TRACE("%p %s\n",path,path);
|
|---|
| 362 | while (*path)
|
|---|
| 363 | { if (*path=='\\'||*path==' ')
|
|---|
| 364 | lastpoint=NULL;
|
|---|
| 365 | if (*path=='.')
|
|---|
| 366 | lastpoint=path;
|
|---|
| 367 | path++;
|
|---|
| 368 | }
|
|---|
| 369 | return lastpoint?lastpoint:path;
|
|---|
| 370 | }
|
|---|
| 371 | LPCWSTR WINAPI PathFindExtensionW(LPCWSTR path)
|
|---|
| 372 | { LPCWSTR lastpoint = NULL;
|
|---|
| 373 | TRACE("(%p %s)\n",path,debugstr_w(path));
|
|---|
| 374 | while (*path)
|
|---|
| 375 | { if (*path==(WCHAR)'\\'||*path==(WCHAR)' ')
|
|---|
| 376 | lastpoint=NULL;
|
|---|
| 377 | if (*path==(WCHAR)'.')
|
|---|
| 378 | lastpoint=path;
|
|---|
| 379 | path++;
|
|---|
| 380 | }
|
|---|
| 381 | return lastpoint?lastpoint:path;
|
|---|
| 382 | }
|
|---|
| 383 |
|
|---|