| 1 | /* $Id: shellord.cpp,v 1.5 1999-12-30 00:21:33 phaller Exp $ */ | 
|---|
| 2 | /* | 
|---|
| 3 | * The parameters of many functions changes between different OS versions | 
|---|
| 4 | * (NT uses Unicode strings, 95 uses ASCII strings) | 
|---|
| 5 | * | 
|---|
| 6 | * Copyright 1997 Marcus Meissner | 
|---|
| 7 | *           1998 Jürgen Schmied | 
|---|
| 8 | */ | 
|---|
| 9 |  | 
|---|
| 10 |  | 
|---|
| 11 | /***************************************************************************** | 
|---|
| 12 | * Includes                                                                  * | 
|---|
| 13 | *****************************************************************************/ | 
|---|
| 14 |  | 
|---|
| 15 | #include <string.h> | 
|---|
| 16 | #include <odin.h> | 
|---|
| 17 | #include <odinwrap.h> | 
|---|
| 18 | #include <os2sel.h> | 
|---|
| 19 |  | 
|---|
| 20 | #define ICOM_CINTERFACE 1 | 
|---|
| 21 | #define CINTERFACE 1 | 
|---|
| 22 |  | 
|---|
| 23 | #include "winerror.h" | 
|---|
| 24 | #include "winreg.h" | 
|---|
| 25 | #include "debugtools.h" | 
|---|
| 26 | #include "winnls.h" | 
|---|
| 27 | #include "winversion.h" | 
|---|
| 28 | #include "heap.h" | 
|---|
| 29 |  | 
|---|
| 30 | #include "shellapi.h" | 
|---|
| 31 | #include "shlobj.h" | 
|---|
| 32 | #include "shell32_main.h" | 
|---|
| 33 | #include "wine/undocshell.h" | 
|---|
| 34 | #include "shpolicy.h" | 
|---|
| 35 |  | 
|---|
| 36 | #include <heapstring.h> | 
|---|
| 37 | #include <misc.h> | 
|---|
| 38 | #include <ctype.h> | 
|---|
| 39 | #include <wctype.h> | 
|---|
| 40 | #include <wcstr.h> | 
|---|
| 41 |  | 
|---|
| 42 |  | 
|---|
| 43 | /***************************************************************************** | 
|---|
| 44 | * Local Variables                                                           * | 
|---|
| 45 | *****************************************************************************/ | 
|---|
| 46 |  | 
|---|
| 47 | ODINDEBUGCHANNEL(shell32-shellord) | 
|---|
| 48 |  | 
|---|
| 49 |  | 
|---|
| 50 | /************************************************************************* | 
|---|
| 51 | * SHChangeNotifyRegister                       [SHELL32.2] | 
|---|
| 52 | * | 
|---|
| 53 | * NOTES | 
|---|
| 54 | *   Idlist is an array of structures and Count specifies how many items in the array | 
|---|
| 55 | *   (usually just one I think). | 
|---|
| 56 | */ | 
|---|
| 57 | DWORD WINAPI | 
|---|
| 58 | SHChangeNotifyRegister( | 
|---|
| 59 | HWND hwnd, | 
|---|
| 60 | LONG events1, | 
|---|
| 61 | LONG events2, | 
|---|
| 62 | DWORD msg, | 
|---|
| 63 | int count, | 
|---|
| 64 | IDSTRUCT *idlist) | 
|---|
| 65 | { | 
|---|
| 66 | FIXME("SHChangeNotifyRegister: (0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):stub.\n", | 
|---|
| 67 | hwnd,events1,events2,msg,count,idlist); | 
|---|
| 68 | return 0; | 
|---|
| 69 | } | 
|---|
| 70 | /************************************************************************* | 
|---|
| 71 | * SHChangeNotifyDeregister                     [SHELL32.4] | 
|---|
| 72 | */ | 
|---|
| 73 | DWORD WINAPI | 
|---|
| 74 | SHChangeNotifyDeregister(LONG x1) | 
|---|
| 75 | {       FIXME("(0x%08lx):stub.\n",x1); | 
|---|
| 76 | return 0; | 
|---|
| 77 | } | 
|---|
| 78 | /************************************************************************* | 
|---|
| 79 | * NTSHChangeNotifyRegister                     [SHELL32.640] | 
|---|
| 80 | * NOTES | 
|---|
| 81 | *   Idlist is an array of structures and Count specifies how many items in the array | 
|---|
| 82 | *   (usually just one I think). | 
|---|
| 83 | */ | 
|---|
| 84 | DWORD WINAPI NTSHChangeNotifyRegister( | 
|---|
| 85 | HWND hwnd, | 
|---|
| 86 | LONG events1, | 
|---|
| 87 | LONG events2, | 
|---|
| 88 | DWORD msg, | 
|---|
| 89 | int count, | 
|---|
| 90 | IDSTRUCT *idlist) | 
|---|
| 91 | {       FIXME("(0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):stub.\n", | 
|---|
| 92 | hwnd,events1,events2,msg,count,idlist); | 
|---|
| 93 | return 0; | 
|---|
| 94 | } | 
|---|
| 95 | /************************************************************************* | 
|---|
| 96 | * NTSHChangeNotifyDeregister                   [SHELL32.641] | 
|---|
| 97 | */ | 
|---|
| 98 | DWORD WINAPI NTSHChangeNotifyDeregister(LONG x1) | 
|---|
| 99 | {       FIXME("(0x%08lx):stub.\n",x1); | 
|---|
| 100 | return 0; | 
|---|
| 101 | } | 
|---|
| 102 |  | 
|---|
| 103 | /************************************************************************* | 
|---|
| 104 | * ParseField                                   [SHELL32.58] | 
|---|
| 105 | * | 
|---|
| 106 | */ | 
|---|
| 107 | DWORD WINAPI ParseFieldA(LPCSTR src, DWORD field, LPSTR dst, DWORD len) | 
|---|
| 108 | {       WARN("('%s',0x%08lx,%p,%ld) semi-stub.\n",src,field,dst,len); | 
|---|
| 109 |  | 
|---|
| 110 | if (!src || !src[0] || !dst || !len) | 
|---|
| 111 | return 0; | 
|---|
| 112 |  | 
|---|
| 113 | if (field >1) | 
|---|
| 114 | { field--; | 
|---|
| 115 | while (field) | 
|---|
| 116 | { if (*src==0x0) return FALSE; | 
|---|
| 117 | if (*src==',') field--; | 
|---|
| 118 | src++; | 
|---|
| 119 | } | 
|---|
| 120 | } | 
|---|
| 121 |  | 
|---|
| 122 | while (*src!=0x00 && *src!=',' && len>0) | 
|---|
| 123 | { *dst=*src; dst++, src++; len--; | 
|---|
| 124 | } | 
|---|
| 125 | *dst=0x0; | 
|---|
| 126 |  | 
|---|
| 127 | return TRUE; | 
|---|
| 128 | } | 
|---|
| 129 |  | 
|---|
| 130 | /************************************************************************* | 
|---|
| 131 | * PickIconDlg                                  [SHELL32.62] | 
|---|
| 132 | * | 
|---|
| 133 | */ | 
|---|
| 134 | DWORD WINAPI PickIconDlg(DWORD x,DWORD y,DWORD z,DWORD a) | 
|---|
| 135 | {       FIXME("PickIconDlg(%08lx,%08lx,%08lx,%08lx):stub.\n",x,y,z,a); | 
|---|
| 136 | return 0xffffffff; | 
|---|
| 137 | } | 
|---|
| 138 |  | 
|---|
| 139 | /************************************************************************* | 
|---|
| 140 | * GetFileNameFromBrowse                        [SHELL32.63] | 
|---|
| 141 | * | 
|---|
| 142 | */ | 
|---|
| 143 | DWORD WINAPI GetFileNameFromBrowse(HWND howner, LPSTR targetbuf, DWORD len, DWORD x, LPCSTR suffix, LPCSTR y, LPCSTR cmd) | 
|---|
| 144 | {       FIXME("(%04x,%p,%ld,%08lx,%s,%s,%s):stub.\n", | 
|---|
| 145 | howner,targetbuf,len,x,suffix,y,cmd); | 
|---|
| 146 | /* puts up a Open Dialog and requests input into targetbuf */ | 
|---|
| 147 | /* OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_FILEMUSTEXIST|OFN_unknown */ | 
|---|
| 148 | lstrcpyA(targetbuf,"x:\\dummy.exe"); | 
|---|
| 149 | return 1; | 
|---|
| 150 | } | 
|---|
| 151 |  | 
|---|
| 152 | /************************************************************************* | 
|---|
| 153 | * SHGetSettings                                [SHELL32.68] | 
|---|
| 154 | * | 
|---|
| 155 | * NOTES | 
|---|
| 156 | *  the registry path are for win98 (tested) | 
|---|
| 157 | *  and possibly are the same in nt40 | 
|---|
| 158 | */ | 
|---|
| 159 | void WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask, DWORD dwx) | 
|---|
| 160 | { | 
|---|
| 161 | HKEY    hKey; | 
|---|
| 162 | DWORD   dwData; | 
|---|
| 163 | DWORD   dwDataSize = sizeof (DWORD); | 
|---|
| 164 |  | 
|---|
| 165 | TRACE("(%p 0x%08lx 0x%08lx)\n",lpsfs,dwMask, dwx); | 
|---|
| 166 |  | 
|---|
| 167 | if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", | 
|---|
| 168 | 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0)) | 
|---|
| 169 | return; | 
|---|
| 170 |  | 
|---|
| 171 | if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize)) | 
|---|
| 172 | lpsfs->fShowExtensions  = ((dwData == 0) ?  0 : 1); | 
|---|
| 173 |  | 
|---|
| 174 | if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize)) | 
|---|
| 175 | lpsfs->fShowInfoTip  = ((dwData == 0) ?  0 : 1); | 
|---|
| 176 |  | 
|---|
| 177 | if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize)) | 
|---|
| 178 | lpsfs->fDontPrettyPath  = ((dwData == 0) ?  0 : 1); | 
|---|
| 179 |  | 
|---|
| 180 | if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize)) | 
|---|
| 181 | lpsfs->fHideIcons  = ((dwData == 0) ?  0 : 1); | 
|---|
| 182 |  | 
|---|
| 183 | if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize)) | 
|---|
| 184 | lpsfs->fMapNetDrvBtn  = ((dwData == 0) ?  0 : 1); | 
|---|
| 185 |  | 
|---|
| 186 | if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize)) | 
|---|
| 187 | lpsfs->fShowAttribCol  = ((dwData == 0) ?  0 : 1); | 
|---|
| 188 |  | 
|---|
| 189 | if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize)) | 
|---|
| 190 | { if (dwData == 0) | 
|---|
| 191 | { if (SSF_SHOWALLOBJECTS & dwMask)    lpsfs->fShowAllObjects  = 0; | 
|---|
| 192 | if (SSF_SHOWSYSFILES & dwMask)      lpsfs->fShowSysFiles  = 0; | 
|---|
| 193 | } | 
|---|
| 194 | else if (dwData == 1) | 
|---|
| 195 | { if (SSF_SHOWALLOBJECTS & dwMask)    lpsfs->fShowAllObjects  = 1; | 
|---|
| 196 | if (SSF_SHOWSYSFILES & dwMask)      lpsfs->fShowSysFiles  = 0; | 
|---|
| 197 | } | 
|---|
| 198 | else if (dwData == 2) | 
|---|
| 199 | { if (SSF_SHOWALLOBJECTS & dwMask)    lpsfs->fShowAllObjects  = 0; | 
|---|
| 200 | if (SSF_SHOWSYSFILES & dwMask)      lpsfs->fShowSysFiles  = 1; | 
|---|
| 201 | } | 
|---|
| 202 | } | 
|---|
| 203 | RegCloseKey (hKey); | 
|---|
| 204 |  | 
|---|
| 205 | TRACE("-- 0x%04x\n", *(WORD*)lpsfs); | 
|---|
| 206 | } | 
|---|
| 207 |  | 
|---|
| 208 | /************************************************************************* | 
|---|
| 209 | * SHShellFolderView_Message                    [SHELL32.73] | 
|---|
| 210 | * | 
|---|
| 211 | * PARAMETERS | 
|---|
| 212 | *  hwndCabinet defines the explorer cabinet window that contains the | 
|---|
| 213 | *              shellview you need to communicate with | 
|---|
| 214 | *  uMsg        identifying the SFVM enum to perform | 
|---|
| 215 | *  lParam | 
|---|
| 216 | * | 
|---|
| 217 | * NOTES | 
|---|
| 218 | *  Message SFVM_REARRANGE = 1 | 
|---|
| 219 | *    This message gets sent when a column gets clicked to instruct the | 
|---|
| 220 | *    shell view to re-sort the item list. lParam identifies the column | 
|---|
| 221 | *    that was clicked. | 
|---|
| 222 | */ | 
|---|
| 223 | int WINAPI SHShellFolderView_Message(HWND hwndCabinet,UINT uMsg,LPARAM lParam) | 
|---|
| 224 | { FIXME("%04x %08ux %08lx stub\n",hwndCabinet,uMsg,lParam); | 
|---|
| 225 | return 0; | 
|---|
| 226 | } | 
|---|
| 227 |  | 
|---|
| 228 | /************************************************************************* | 
|---|
| 229 | * OleStrToStrN                                 [SHELL32.78] | 
|---|
| 230 | */ | 
|---|
| 231 | BOOL WINAPI OleStrToStrNA (LPSTR lpStr, INT nStr, LPCWSTR lpOle, INT nOle) | 
|---|
| 232 | { | 
|---|
| 233 | TRACE("%p %x %s %x\n", lpStr, nStr, debugstr_w(lpOle), nOle); | 
|---|
| 234 | return WideCharToMultiByte (0, 0, lpOle, nOle, lpStr, nStr, NULL, NULL); | 
|---|
| 235 | } | 
|---|
| 236 |  | 
|---|
| 237 | BOOL WINAPI OleStrToStrNW (LPWSTR lpwStr, INT nwStr, LPCWSTR lpOle, INT nOle) | 
|---|
| 238 | { | 
|---|
| 239 | TRACE("%p %x %s %x\n", lpwStr, nwStr, debugstr_w(lpOle), nOle); | 
|---|
| 240 |  | 
|---|
| 241 | if (lstrcpynW ( lpwStr, lpOle, nwStr)) | 
|---|
| 242 | { return lstrlenW (lpwStr); | 
|---|
| 243 | } | 
|---|
| 244 | return 0; | 
|---|
| 245 | } | 
|---|
| 246 |  | 
|---|
| 247 | BOOL WINAPI OleStrToStrNAW (LPVOID lpOut, INT nOut, LPCVOID lpIn, INT nIn) | 
|---|
| 248 | { | 
|---|
| 249 | if (VERSION_OsIsUnicode()) | 
|---|
| 250 | return OleStrToStrNW ((LPWSTR)lpOut, nOut, (LPCWSTR)lpIn, nIn); | 
|---|
| 251 | return OleStrToStrNA ((LPSTR)lpOut, nOut, (LPCWSTR)lpIn, nIn); | 
|---|
| 252 | } | 
|---|
| 253 |  | 
|---|
| 254 | /************************************************************************* | 
|---|
| 255 | * StrToOleStrN                                 [SHELL32.79] | 
|---|
| 256 | *  lpMulti, nMulti, nWide [IN] | 
|---|
| 257 | *  lpWide [OUT] | 
|---|
| 258 | */ | 
|---|
| 259 | BOOL WINAPI StrToOleStrNA (LPWSTR lpWide, INT nWide, LPCSTR lpStrA, INT nStr) | 
|---|
| 260 | { | 
|---|
| 261 | TRACE("%p %x %s %x\n", lpWide, nWide, lpStrA, nStr); | 
|---|
| 262 | return MultiByteToWideChar (0, 0, lpStrA, nStr, lpWide, nWide); | 
|---|
| 263 | } | 
|---|
| 264 | BOOL WINAPI StrToOleStrNW (LPWSTR lpWide, INT nWide, LPCWSTR lpStrW, INT nStr) | 
|---|
| 265 | { | 
|---|
| 266 | TRACE("%p %x %s %x\n", lpWide, nWide, debugstr_w(lpStrW), nStr); | 
|---|
| 267 |  | 
|---|
| 268 | if (lstrcpynW (lpWide, lpStrW, nWide)) | 
|---|
| 269 | { return lstrlenW (lpWide); | 
|---|
| 270 | } | 
|---|
| 271 | return 0; | 
|---|
| 272 | } | 
|---|
| 273 |  | 
|---|
| 274 | BOOL WINAPI StrToOleStrNAW (LPWSTR lpWide, INT nWide, LPCVOID lpStr, INT nStr) | 
|---|
| 275 | { | 
|---|
| 276 | if (VERSION_OsIsUnicode()) | 
|---|
| 277 | return StrToOleStrNW (lpWide, nWide, (LPWSTR)lpStr, nStr); | 
|---|
| 278 | return StrToOleStrNA (lpWide, nWide, (LPSTR)lpStr, nStr); | 
|---|
| 279 | } | 
|---|
| 280 |  | 
|---|
| 281 | /************************************************************************* | 
|---|
| 282 | * RegisterShellHook                            [SHELL32.181] | 
|---|
| 283 | * | 
|---|
| 284 | * PARAMS | 
|---|
| 285 | *      hwnd [I]  window handle | 
|---|
| 286 | *      y    [I]  flag ???? | 
|---|
| 287 | * | 
|---|
| 288 | * NOTES | 
|---|
| 289 | *     exported by ordinal | 
|---|
| 290 | */ | 
|---|
| 291 | void WINAPI RegisterShellHook(HWND hwnd, DWORD y) { | 
|---|
| 292 | FIXME("(0x%08x,0x%08lx):stub.\n",hwnd,y); | 
|---|
| 293 | } | 
|---|
| 294 | /************************************************************************* | 
|---|
| 295 | * ShellMessageBoxW                             [SHELL32.182] | 
|---|
| 296 | * | 
|---|
| 297 | * Format and output errormessage. | 
|---|
| 298 | * | 
|---|
| 299 | * idText       resource ID of title or LPSTR | 
|---|
| 300 | * idTitle      resource ID of title or LPSTR | 
|---|
| 301 | * | 
|---|
| 302 | * NOTES | 
|---|
| 303 | *     exported by ordinal | 
|---|
| 304 | */ | 
|---|
| 305 | INT __cdecl | 
|---|
| 306 | ShellMessageBoxW(HMODULE hmod,HWND hwnd,DWORD idText,DWORD idTitle,DWORD uType,LPCVOID arglist) | 
|---|
| 307 | {       WCHAR   szText[100],szTitle[100],szTemp[256]; | 
|---|
| 308 | LPWSTR   pszText = &szText[0], pszTitle = &szTitle[0]; | 
|---|
| 309 | LPVOID  args = &arglist; | 
|---|
| 310 |  | 
|---|
| 311 | TRACE("(%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n",(DWORD)hmod,(DWORD)hwnd,idText,idTitle,uType,arglist); | 
|---|
| 312 |  | 
|---|
| 313 | if (!HIWORD (idTitle)) | 
|---|
| 314 | LoadStringW(hmod,idTitle,pszTitle,100); | 
|---|
| 315 | else | 
|---|
| 316 | pszTitle = (LPWSTR)idTitle; | 
|---|
| 317 |  | 
|---|
| 318 | if (! HIWORD (idText)) | 
|---|
| 319 | LoadStringW(hmod,idText,pszText,100); | 
|---|
| 320 | else | 
|---|
| 321 | pszText = (LPWSTR)idText; | 
|---|
| 322 |  | 
|---|
| 323 | FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, | 
|---|
| 324 | szText, | 
|---|
| 325 | 0, | 
|---|
| 326 | 0, | 
|---|
| 327 | szTemp, | 
|---|
| 328 | 256, | 
|---|
| 329 | (LPDWORD)args); | 
|---|
| 330 | return MessageBoxW(hwnd,szTemp,szTitle,uType); | 
|---|
| 331 | } | 
|---|
| 332 |  | 
|---|
| 333 | /************************************************************************* | 
|---|
| 334 | * ShellMessageBoxA                             [SHELL32.183] | 
|---|
| 335 | */ | 
|---|
| 336 | INT __cdecl | 
|---|
| 337 | ShellMessageBoxA(HMODULE hmod,HWND hwnd,DWORD idText,DWORD idTitle,DWORD uType,LPCVOID arglist) | 
|---|
| 338 | {       char    szText[100],szTitle[100],szTemp[256]; | 
|---|
| 339 | LPSTR   pszText = &szText[0], pszTitle = &szTitle[0]; | 
|---|
| 340 | LPVOID  args = &arglist; | 
|---|
| 341 |  | 
|---|
| 342 | TRACE("(%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n", (DWORD)hmod,(DWORD)hwnd,idText,idTitle,uType,arglist); | 
|---|
| 343 |  | 
|---|
| 344 | if (!HIWORD (idTitle)) | 
|---|
| 345 | LoadStringA(hmod,idTitle,pszTitle,100); | 
|---|
| 346 | else | 
|---|
| 347 | pszTitle = (LPSTR)idTitle; | 
|---|
| 348 |  | 
|---|
| 349 | if (! HIWORD (idText)) | 
|---|
| 350 | LoadStringA(hmod,idText,pszText,100); | 
|---|
| 351 | else | 
|---|
| 352 | pszText = (LPSTR)idText; | 
|---|
| 353 |  | 
|---|
| 354 | FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY ,pszText,0,0,szTemp,256,(LPDWORD)args); | 
|---|
| 355 | return MessageBoxA(hwnd,szTemp,pszTitle,uType); | 
|---|
| 356 | } | 
|---|
| 357 |  | 
|---|
| 358 | /************************************************************************* | 
|---|
| 359 | * SHRestricted                         [SHELL32.100] | 
|---|
| 360 | * | 
|---|
| 361 | * walks through policy table, queries <app> key, <type> value, returns | 
|---|
| 362 | * queried (DWORD) value, and caches it between called to SHInitRestricted | 
|---|
| 363 | * to prevent unnecessary registry access. | 
|---|
| 364 | * | 
|---|
| 365 | * NOTES | 
|---|
| 366 | *     exported by ordinal | 
|---|
| 367 | * | 
|---|
| 368 | * REFERENCES: | 
|---|
| 369 | *     MS System Policy Editor | 
|---|
| 370 | *     98Lite 2.0 (which uses many of these policy keys) http://www.98lite.net/ | 
|---|
| 371 | *     "The Windows 95 Registry", by John Woram, 1996 MIS: Press | 
|---|
| 372 | */ | 
|---|
| 373 | DWORD WINAPI SHRestricted (DWORD pol) { | 
|---|
| 374 | char regstr[256]; | 
|---|
| 375 | HKEY    xhkey; | 
|---|
| 376 | DWORD   retval, polidx, i, datsize = 4; | 
|---|
| 377 |  | 
|---|
| 378 | TRACE("(%08lx)\n",pol); | 
|---|
| 379 |  | 
|---|
| 380 | polidx = -1; | 
|---|
| 381 |  | 
|---|
| 382 | /* scan to see if we know this policy ID */ | 
|---|
| 383 | for (i = 0; i < SHELL_MAX_POLICIES; i++) | 
|---|
| 384 | { | 
|---|
| 385 | if (pol == sh32_policy_table[i].polflags) | 
|---|
| 386 | { | 
|---|
| 387 | polidx = i; | 
|---|
| 388 | break; | 
|---|
| 389 | } | 
|---|
| 390 | } | 
|---|
| 391 |  | 
|---|
| 392 | if (polidx == -1) | 
|---|
| 393 | { | 
|---|
| 394 | /* we don't know this policy, return 0 */ | 
|---|
| 395 | TRACE("unknown policy: (%08lx)\n", pol); | 
|---|
| 396 | return 0; | 
|---|
| 397 | } | 
|---|
| 398 |  | 
|---|
| 399 | /* we have a known policy */ | 
|---|
| 400 | lstrcpyA(regstr, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\"); | 
|---|
| 401 | lstrcatA(regstr, sh32_policy_table[polidx].appstr); | 
|---|
| 402 |  | 
|---|
| 403 | /* first check if this policy has been cached, return it if so */ | 
|---|
| 404 | if (sh32_policy_table[polidx].cache != SHELL_NO_POLICY) | 
|---|
| 405 | { | 
|---|
| 406 | return sh32_policy_table[polidx].cache; | 
|---|
| 407 | } | 
|---|
| 408 |  | 
|---|
| 409 | /* return 0 and don't set the cache if any registry errors occur */ | 
|---|
| 410 | retval = 0; | 
|---|
| 411 | if (RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey) == ERROR_SUCCESS) | 
|---|
| 412 | { | 
|---|
| 413 | if (RegQueryValueExA(xhkey, sh32_policy_table[polidx].keystr, NULL, NULL, (LPBYTE)&retval, &datsize) == ERROR_SUCCESS) | 
|---|
| 414 | { | 
|---|
| 415 | sh32_policy_table[polidx].cache = retval; | 
|---|
| 416 | } | 
|---|
| 417 |  | 
|---|
| 418 | RegCloseKey(xhkey); | 
|---|
| 419 | } | 
|---|
| 420 |  | 
|---|
| 421 | return retval; | 
|---|
| 422 | } | 
|---|
| 423 |  | 
|---|
| 424 | /************************************************************************* | 
|---|
| 425 | *      SHInitRestricted                         [SHELL32.244] | 
|---|
| 426 | * | 
|---|
| 427 | * Win98+ by-ordinal only routine called by Explorer and MSIE 4 and 5. | 
|---|
| 428 | * Inits the policy cache used by SHRestricted to avoid excess | 
|---|
| 429 | * registry access. | 
|---|
| 430 | * | 
|---|
| 431 | * INPUTS | 
|---|
| 432 | * Two inputs: one is a string or NULL.  If non-NULL the pointer | 
|---|
| 433 | * should point to a string containing the following exact text: | 
|---|
| 434 | * "Software\Microsoft\Windows\CurrentVersion\Policies". | 
|---|
| 435 | * The other input is unused. | 
|---|
| 436 | * | 
|---|
| 437 | * NOTES | 
|---|
| 438 | * If the input is non-NULL and does not point to a string containing | 
|---|
| 439 | * that exact text the routine will do nothing. | 
|---|
| 440 | * | 
|---|
| 441 | * If the text does match or the pointer is NULL, then the routine | 
|---|
| 442 | * will init SHRestricted()'s policy cache to all 0xffffffff and | 
|---|
| 443 | * returns 0xffffffff as well. | 
|---|
| 444 | * | 
|---|
| 445 | * I haven't yet run into anything calling this with inputs other than | 
|---|
| 446 | * (NULL, NULL), so I may have the inputs reversed. | 
|---|
| 447 | */ | 
|---|
| 448 |  | 
|---|
| 449 | BOOL WINAPI SHInitRestricted(LPSTR inpRegKey, LPSTR parm2) | 
|---|
| 450 | { | 
|---|
| 451 | int i; | 
|---|
| 452 |  | 
|---|
| 453 | dprintf(("SHELL32:SHELLORD:SHInitRestricted(%p, %p)\n", inpRegKey, parm2)); | 
|---|
| 454 |  | 
|---|
| 455 | /* first check - if input is non-NULL and points to the secret | 
|---|
| 456 | key string, then pass.  Otherwise return 0. | 
|---|
| 457 | */ | 
|---|
| 458 |  | 
|---|
| 459 | if (inpRegKey != (LPSTR)NULL) | 
|---|
| 460 | { | 
|---|
| 461 | if (lstrcmpiA(inpRegKey, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies")) | 
|---|
| 462 | { | 
|---|
| 463 | /* doesn't match, fail */ | 
|---|
| 464 | return 0; | 
|---|
| 465 | } | 
|---|
| 466 | } | 
|---|
| 467 |  | 
|---|
| 468 | /* check passed, init all policy cache entries with SHELL_NO_POLICY */ | 
|---|
| 469 | for (i = 0; i < SHELL_MAX_POLICIES; i++) | 
|---|
| 470 | { | 
|---|
| 471 | sh32_policy_table[i].cache = SHELL_NO_POLICY; | 
|---|
| 472 | } | 
|---|
| 473 |  | 
|---|
| 474 | return SHELL_NO_POLICY; | 
|---|
| 475 | } | 
|---|
| 476 |  | 
|---|
| 477 | /************************************************************************* | 
|---|
| 478 | * SHCreateDirectory                            [SHELL32.165] | 
|---|
| 479 | * | 
|---|
| 480 | * NOTES | 
|---|
| 481 | *  exported by ordinal | 
|---|
| 482 | *  not sure about LPSECURITY_ATTRIBUTES | 
|---|
| 483 | */ | 
|---|
| 484 | DWORD WINAPI SHCreateDirectory(LPSECURITY_ATTRIBUTES sec,LPCSTR path) { | 
|---|
| 485 | TRACE("(%p,%s):stub.\n",sec,path); | 
|---|
| 486 | if (CreateDirectoryA(path,sec)) | 
|---|
| 487 | return TRUE; | 
|---|
| 488 | /* SHChangeNotify(8,1,path,0); */ | 
|---|
| 489 | return FALSE; | 
|---|
| 490 | #if 0 | 
|---|
| 491 | if (SHELL32_79(path,(LPVOID)x)) | 
|---|
| 492 | return 0; | 
|---|
| 493 | FIXME("(%08lx,%s):stub.\n",x,path); | 
|---|
| 494 | return 0; | 
|---|
| 495 | #endif | 
|---|
| 496 | } | 
|---|
| 497 |  | 
|---|
| 498 | /************************************************************************* | 
|---|
| 499 | * SHFree                                       [SHELL32.195] | 
|---|
| 500 | * | 
|---|
| 501 | * NOTES | 
|---|
| 502 | *     free_ptr() - frees memory using IMalloc | 
|---|
| 503 | *     exported by ordinal | 
|---|
| 504 | */ | 
|---|
| 505 | /*#define MEM_DEBUG 1*/ | 
|---|
| 506 | DWORD WINAPI SHFree(LPVOID x) | 
|---|
| 507 | { | 
|---|
| 508 | #ifdef MEM_DEBUG | 
|---|
| 509 | WORD len = *(LPWORD)(x-2); | 
|---|
| 510 |  | 
|---|
| 511 | if ( *(LPWORD)(x+len) != 0x7384) | 
|---|
| 512 | ERR("MAGIC2!\n"); | 
|---|
| 513 |  | 
|---|
| 514 | if ( (*(LPWORD)(x-4)) != 0x8271) | 
|---|
| 515 | ERR("MAGIC1!\n"); | 
|---|
| 516 | else | 
|---|
| 517 | memset(x-4, 0xde, len+6); | 
|---|
| 518 |  | 
|---|
| 519 | TRACE("%p len=%u\n",x, len); | 
|---|
| 520 |  | 
|---|
| 521 | x -= 4; | 
|---|
| 522 | #else | 
|---|
| 523 | TRACE("%p\n",x); | 
|---|
| 524 | #endif | 
|---|
| 525 | return HeapFree(GetProcessHeap(), 0, x); | 
|---|
| 526 | } | 
|---|
| 527 |  | 
|---|
| 528 | /************************************************************************* | 
|---|
| 529 | * SHAlloc                                      [SHELL32.196] | 
|---|
| 530 | * | 
|---|
| 531 | * NOTES | 
|---|
| 532 | *     void *task_alloc(DWORD len), uses SHMalloc allocator | 
|---|
| 533 | *     exported by ordinal | 
|---|
| 534 | */ | 
|---|
| 535 | LPVOID WINAPI SHAlloc(DWORD len) | 
|---|
| 536 | { | 
|---|
| 537 | LPBYTE ret; | 
|---|
| 538 |  | 
|---|
| 539 | #ifdef MEM_DEBUG | 
|---|
| 540 | ret = (LPBYTE) HeapAlloc(GetProcessHeap(),0,len+6); | 
|---|
| 541 | #else | 
|---|
| 542 | ret = (LPBYTE) HeapAlloc(GetProcessHeap(),0,len); | 
|---|
| 543 | #endif | 
|---|
| 544 |  | 
|---|
| 545 | #ifdef MEM_DEBUG | 
|---|
| 546 | *(LPWORD)(ret) = 0x8271; | 
|---|
| 547 | *(LPWORD)(ret+2) = (WORD)len; | 
|---|
| 548 | *(LPWORD)(ret+4+len) = 0x7384; | 
|---|
| 549 | ret += 4; | 
|---|
| 550 | memset(ret, 0xdf, len); | 
|---|
| 551 | #endif | 
|---|
| 552 | TRACE("%lu bytes at %p\n",len, ret); | 
|---|
| 553 | return (LPVOID)ret; | 
|---|
| 554 | } | 
|---|
| 555 |  | 
|---|
| 556 | /************************************************************************* | 
|---|
| 557 | * SHRegisterDragDrop                           [SHELL32.86] | 
|---|
| 558 | * | 
|---|
| 559 | * NOTES | 
|---|
| 560 | *     exported by ordinal | 
|---|
| 561 | */ | 
|---|
| 562 | DWORD WINAPI SHRegisterDragDrop(HWND hWnd,IDropTarget * pDropTarget) | 
|---|
| 563 | { | 
|---|
| 564 | FIXME("(0x%08x,%p):stub.\n", hWnd, pDropTarget); | 
|---|
| 565 | return     RegisterDragDrop(hWnd, pDropTarget); | 
|---|
| 566 | } | 
|---|
| 567 |  | 
|---|
| 568 | /************************************************************************* | 
|---|
| 569 | * SHRevokeDragDrop                             [SHELL32.87] | 
|---|
| 570 | * | 
|---|
| 571 | * NOTES | 
|---|
| 572 | *     exported by ordinal | 
|---|
| 573 | */ | 
|---|
| 574 | DWORD WINAPI SHRevokeDragDrop(DWORD x) { | 
|---|
| 575 | FIXME("(0x%08lx):stub.\n",x); | 
|---|
| 576 | return 0; | 
|---|
| 577 | } | 
|---|
| 578 |  | 
|---|
| 579 | /************************************************************************* | 
|---|
| 580 | * SHDoDragDrop                                 [SHELL32.88] | 
|---|
| 581 | * | 
|---|
| 582 | * NOTES | 
|---|
| 583 | *     exported by ordinal | 
|---|
| 584 | */ | 
|---|
| 585 | DWORD WINAPI SHDoDragDrop(DWORD u, DWORD v, DWORD w, DWORD x, DWORD y, DWORD z) { | 
|---|
| 586 | FIXME("(0x%08lx 0x%08lx 0x%08lx 0x%08lx 0x%08lx 0x%08lx):stub.\n",u,v,w,x,y,z); | 
|---|
| 587 | return 0; | 
|---|
| 588 | } | 
|---|
| 589 |  | 
|---|
| 590 | /************************************************************************* | 
|---|
| 591 | * RunFileDlg                                   [SHELL32.61] | 
|---|
| 592 | * | 
|---|
| 593 | * NOTES | 
|---|
| 594 | *     Original name: RunFileDlg (exported by ordinal) | 
|---|
| 595 | */ | 
|---|
| 596 | DWORD WINAPI | 
|---|
| 597 | RunFileDlg (HWND hwndOwner, DWORD dwParam1, DWORD dwParam2, | 
|---|
| 598 | LPSTR lpszTitle, LPSTR lpszPrompt, UINT uFlags) | 
|---|
| 599 | { | 
|---|
| 600 | FIXME("(0x%08x 0x%lx 0x%lx \"%s\" \"%s\" 0x%x):stub.\n", | 
|---|
| 601 | hwndOwner, dwParam1, dwParam2, lpszTitle, lpszPrompt, uFlags); | 
|---|
| 602 | return 0; | 
|---|
| 603 | } | 
|---|
| 604 |  | 
|---|
| 605 | /************************************************************************* | 
|---|
| 606 | * ExitWindowsDialog                            [SHELL32.60] | 
|---|
| 607 | * | 
|---|
| 608 | * NOTES | 
|---|
| 609 | *     exported by ordinal | 
|---|
| 610 | */ | 
|---|
| 611 | void WINAPI ExitWindowsDialog (HWND hWndOwner) | 
|---|
| 612 | { | 
|---|
| 613 | TRACE("(0x%08x)\n", hWndOwner); | 
|---|
| 614 | if (MessageBoxA( hWndOwner, "Do you want to exit WINE?", "Shutdown", MB_YESNO|MB_ICONQUESTION) == IDOK) | 
|---|
| 615 | { SendMessageA ( hWndOwner, WM_QUIT, 0, 0); | 
|---|
| 616 | } | 
|---|
| 617 | } | 
|---|
| 618 |  | 
|---|
| 619 | /************************************************************************* | 
|---|
| 620 | * ArrangeWindows                               [SHELL32.184] | 
|---|
| 621 | * | 
|---|
| 622 | */ | 
|---|
| 623 | DWORD WINAPI | 
|---|
| 624 | ArrangeWindows (DWORD dwParam1, DWORD dwParam2, DWORD dwParam3, | 
|---|
| 625 | DWORD dwParam4, DWORD dwParam5) | 
|---|
| 626 | { | 
|---|
| 627 | FIXME("(0x%lx 0x%lx 0x%lx 0x%lx 0x%lx):stub.\n", | 
|---|
| 628 | dwParam1, dwParam2, dwParam3, dwParam4, dwParam5); | 
|---|
| 629 | return 0; | 
|---|
| 630 | } | 
|---|
| 631 |  | 
|---|
| 632 | /************************************************************************* | 
|---|
| 633 | * SignalFileOpen                               [SHELL32.103] | 
|---|
| 634 | * | 
|---|
| 635 | * NOTES | 
|---|
| 636 | *     exported by ordinal | 
|---|
| 637 | */ | 
|---|
| 638 | DWORD WINAPI | 
|---|
| 639 | SignalFileOpen (DWORD dwParam1) | 
|---|
| 640 | { | 
|---|
| 641 | FIXME("(0x%08lx):stub.\n", dwParam1); | 
|---|
| 642 |  | 
|---|
| 643 | return 0; | 
|---|
| 644 | } | 
|---|
| 645 |  | 
|---|
| 646 | /************************************************************************* | 
|---|
| 647 | * SHAddToRecentDocs                            [SHELL32.234] | 
|---|
| 648 | * | 
|---|
| 649 | * PARAMETERS | 
|---|
| 650 | *   uFlags  [IN] SHARD_PATH or SHARD_PIDL | 
|---|
| 651 | *   pv      [IN] string or pidl, NULL clears the list | 
|---|
| 652 | * | 
|---|
| 653 | * NOTES | 
|---|
| 654 | *     exported by name | 
|---|
| 655 | */ | 
|---|
| 656 | DWORD WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv) | 
|---|
| 657 | { if (SHARD_PIDL==uFlags) | 
|---|
| 658 | { FIXME("(0x%08x,pidl=%p):stub.\n", uFlags,pv); | 
|---|
| 659 | } | 
|---|
| 660 | else | 
|---|
| 661 | { FIXME("(0x%08x,%s):stub.\n", uFlags,(char*)pv); | 
|---|
| 662 | } | 
|---|
| 663 | return 0; | 
|---|
| 664 | } | 
|---|
| 665 | /************************************************************************* | 
|---|
| 666 | * SHFileOperation                              [SHELL32.242] | 
|---|
| 667 | * | 
|---|
| 668 | */ | 
|---|
| 669 | DWORD WINAPI SHFileOperationAW(DWORD x) | 
|---|
| 670 | {       FIXME("0x%08lx stub\n",x); | 
|---|
| 671 | return 0; | 
|---|
| 672 |  | 
|---|
| 673 | } | 
|---|
| 674 |  | 
|---|
| 675 | /************************************************************************* | 
|---|
| 676 | * SHFileOperationA                             [SHELL32.243] | 
|---|
| 677 | * | 
|---|
| 678 | * NOTES | 
|---|
| 679 | *     exported by name | 
|---|
| 680 | */ | 
|---|
| 681 | DWORD WINAPI SHFileOperationA (LPSHFILEOPSTRUCTA lpFileOp) | 
|---|
| 682 | { FIXME("(%p):stub.\n", lpFileOp); | 
|---|
| 683 | return 1; | 
|---|
| 684 | } | 
|---|
| 685 | /************************************************************************* | 
|---|
| 686 | * SHFileOperationW                             [SHELL32.244] | 
|---|
| 687 | * | 
|---|
| 688 | * NOTES | 
|---|
| 689 | *     exported by name | 
|---|
| 690 | */ | 
|---|
| 691 | DWORD WINAPI SHFileOperationW (LPSHFILEOPSTRUCTW lpFileOp) | 
|---|
| 692 | { FIXME("(%p):stub.\n", lpFileOp); | 
|---|
| 693 | return 1; | 
|---|
| 694 | } | 
|---|
| 695 |  | 
|---|
| 696 | /************************************************************************* | 
|---|
| 697 | * SHChangeNotify                               [SHELL32.239] | 
|---|
| 698 | * | 
|---|
| 699 | * NOTES | 
|---|
| 700 | *     exported by name | 
|---|
| 701 | */ | 
|---|
| 702 | DWORD WINAPI SHChangeNotify ( | 
|---|
| 703 | INT   wEventId,  /* [IN] flags that specifies the event*/ | 
|---|
| 704 | UINT  uFlags,   /* [IN] the meaning of dwItem[1|2]*/ | 
|---|
| 705 | LPCVOID dwItem1, | 
|---|
| 706 | LPCVOID dwItem2) | 
|---|
| 707 | { FIXME("(0x%08x,0x%08ux,%p,%p):stub.\n", wEventId,uFlags,dwItem1,dwItem2); | 
|---|
| 708 | return 0; | 
|---|
| 709 | } | 
|---|
| 710 | /************************************************************************* | 
|---|
| 711 | * SHCreateShellFolderViewEx                    [SHELL32.174] | 
|---|
| 712 | * | 
|---|
| 713 | * NOTES | 
|---|
| 714 | *  see IShellFolder::CreateViewObject | 
|---|
| 715 | */ | 
|---|
| 716 | HRESULT WINAPI SHCreateShellFolderViewEx( | 
|---|
| 717 | LPSHELLVIEWDATA psvcbi, /*[in ] shelltemplate struct*/ | 
|---|
| 718 | LPVOID* ppv)            /*[out] IShellView pointer*/ | 
|---|
| 719 | { | 
|---|
| 720 | IShellView * psf; | 
|---|
| 721 | HRESULT hRes; | 
|---|
| 722 |  | 
|---|
| 723 | TRACE("sf=%p pidl=%p cb=%p mode=0x%08lx parm=0x%08lx\n", | 
|---|
| 724 | psvcbi->pShellFolder, psvcbi->pidl, psvcbi->pCallBack, psvcbi->viewmode, psvcbi->dwUserParam); | 
|---|
| 725 |  | 
|---|
| 726 | psf = IShellView_Constructor(psvcbi->pShellFolder); | 
|---|
| 727 |  | 
|---|
| 728 | if (!psf) | 
|---|
| 729 | return E_OUTOFMEMORY; | 
|---|
| 730 |  | 
|---|
| 731 | IShellView_AddRef(psf); | 
|---|
| 732 | hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv); | 
|---|
| 733 | IShellView_Release(psf); | 
|---|
| 734 |  | 
|---|
| 735 | return hRes; | 
|---|
| 736 | } | 
|---|
| 737 | /************************************************************************* | 
|---|
| 738 | *  SHWinHelp                                   [SHELL32.127] | 
|---|
| 739 | * | 
|---|
| 740 | */ | 
|---|
| 741 | HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z) | 
|---|
| 742 | {       FIXME("0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v,w,x,z); | 
|---|
| 743 | return 0; | 
|---|
| 744 | } | 
|---|
| 745 | /************************************************************************* | 
|---|
| 746 | *  SHRunControlPanel [SHELL32.161] | 
|---|
| 747 | * | 
|---|
| 748 | */ | 
|---|
| 749 | HRESULT WINAPI SHRunControlPanel (DWORD x, DWORD z) | 
|---|
| 750 | {       FIXME("0x%08lx 0x%08lx stub\n",x,z); | 
|---|
| 751 | return 0; | 
|---|
| 752 | } | 
|---|
| 753 | /************************************************************************* | 
|---|
| 754 | * ShellExecuteEx                               [SHELL32.291] | 
|---|
| 755 | * | 
|---|
| 756 | */ | 
|---|
| 757 | BOOL WINAPI ShellExecuteExAW (LPVOID sei) | 
|---|
| 758 | {       if (VERSION_OsIsUnicode()) | 
|---|
| 759 | return ShellExecuteExW ((LPSHELLEXECUTEINFOW)sei); | 
|---|
| 760 | return ShellExecuteExA ((LPSHELLEXECUTEINFOA)sei); | 
|---|
| 761 | } | 
|---|
| 762 | /************************************************************************* | 
|---|
| 763 | * ShellExecuteExA                              [SHELL32.292] | 
|---|
| 764 | * | 
|---|
| 765 | */ | 
|---|
| 766 | BOOL WINAPI ShellExecuteExA (LPSHELLEXECUTEINFOA sei) | 
|---|
| 767 | {       CHAR szApplicationName[MAX_PATH],szCommandline[MAX_PATH],szPidl[20]; | 
|---|
| 768 | LPSTR pos; | 
|---|
| 769 | int gap, len; | 
|---|
| 770 | STARTUPINFOA  startupinfo; | 
|---|
| 771 | PROCESS_INFORMATION processinformation; | 
|---|
| 772 |  | 
|---|
| 773 | WARN("mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s incomplete\n", | 
|---|
| 774 | sei->fMask, sei->hwnd, sei->lpVerb, sei->lpFile, | 
|---|
| 775 | sei->lpParameters, sei->lpDirectory, sei->nShow, | 
|---|
| 776 | (sei->fMask & SEE_MASK_CLASSNAME) ? sei->lpClass : "not used"); | 
|---|
| 777 |  | 
|---|
| 778 | ZeroMemory(szApplicationName,MAX_PATH); | 
|---|
| 779 | if (sei->lpFile) | 
|---|
| 780 | strcpy(szApplicationName, sei->lpFile); | 
|---|
| 781 |  | 
|---|
| 782 | ZeroMemory(szCommandline,MAX_PATH); | 
|---|
| 783 | if (sei->lpParameters) | 
|---|
| 784 | strcpy(szCommandline, sei->lpParameters); | 
|---|
| 785 |  | 
|---|
| 786 | if (sei->fMask & (SEE_MASK_CLASSKEY | SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY | | 
|---|
| 787 | SEE_MASK_NOCLOSEPROCESS | SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT | | 
|---|
| 788 | SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI | SEE_MASK_UNICODE | | 
|---|
| 789 | SEE_MASK_NO_CONSOLE | SEE_MASK_ASYNCOK | SEE_MASK_HMONITOR )) | 
|---|
| 790 | { FIXME("flags ignored: 0x%08lx\n", sei->fMask); | 
|---|
| 791 | } | 
|---|
| 792 |  | 
|---|
| 793 | if (sei->fMask & SEE_MASK_CLASSNAME) | 
|---|
| 794 | { HCR_GetExecuteCommand(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, 256); | 
|---|
| 795 | } | 
|---|
| 796 |  | 
|---|
| 797 | /* process the IDList */ | 
|---|
| 798 | if ( (sei->fMask & SEE_MASK_INVOKEIDLIST) == SEE_MASK_INVOKEIDLIST) /*0x0c*/ | 
|---|
| 799 | { SHGetPathFromIDListA ((LPCITEMIDLIST)sei->lpIDList,szApplicationName); | 
|---|
| 800 | TRACE("-- idlist=%p (%s)\n", sei->lpIDList, szApplicationName); | 
|---|
| 801 | } | 
|---|
| 802 | else | 
|---|
| 803 | { if (sei->fMask & SEE_MASK_IDLIST ) | 
|---|
| 804 | { /* %I is the adress of a global item ID*/ | 
|---|
| 805 | pos = strstr(szCommandline, "%I"); | 
|---|
| 806 | if (pos) | 
|---|
| 807 | { HGLOBAL hmem = SHAllocShared ( sei->lpIDList, ILGetSize((LPCITEMIDLIST)sei->lpIDList), 0); | 
|---|
| 808 | sprintf(szPidl,":%li",(DWORD)SHLockShared(hmem,0) ); | 
|---|
| 809 | SHUnlockShared(hmem); | 
|---|
| 810 |  | 
|---|
| 811 | gap = strlen(szPidl); | 
|---|
| 812 | len = strlen(pos)-2; | 
|---|
| 813 | memmove(pos+gap,pos+2,len); | 
|---|
| 814 | memcpy(pos,szPidl,gap); | 
|---|
| 815 |  | 
|---|
| 816 | } | 
|---|
| 817 | } | 
|---|
| 818 | } | 
|---|
| 819 |  | 
|---|
| 820 | pos = strstr(szCommandline, ",%L");     /* dunno what it means: kill it*/ | 
|---|
| 821 | if (pos) | 
|---|
| 822 | { len = strlen(pos)-2; | 
|---|
| 823 | *pos=0x0; | 
|---|
| 824 | memmove(pos,pos+3,len); | 
|---|
| 825 | } | 
|---|
| 826 |  | 
|---|
| 827 | TRACE("execute: %s %s\n",szApplicationName, szCommandline); | 
|---|
| 828 |  | 
|---|
| 829 | ZeroMemory(&startupinfo,sizeof(STARTUPINFOA)); | 
|---|
| 830 | startupinfo.cb = sizeof(STARTUPINFOA); | 
|---|
| 831 |  | 
|---|
| 832 | return CreateProcessA(szApplicationName[0] ? szApplicationName:NULL, | 
|---|
| 833 | szCommandline[0] ? szCommandline : NULL, | 
|---|
| 834 | NULL, NULL, FALSE, 0, | 
|---|
| 835 | NULL, NULL, &startupinfo, &processinformation); | 
|---|
| 836 |  | 
|---|
| 837 |  | 
|---|
| 838 | } | 
|---|
| 839 | /************************************************************************* | 
|---|
| 840 | * ShellExecuteExW                              [SHELL32.293] | 
|---|
| 841 | * | 
|---|
| 842 | */ | 
|---|
| 843 | BOOL WINAPI ShellExecuteExW (LPSHELLEXECUTEINFOW sei) | 
|---|
| 844 | {       SHELLEXECUTEINFOA seiA; | 
|---|
| 845 | DWORD ret; | 
|---|
| 846 |  | 
|---|
| 847 | TRACE("%p\n", sei); | 
|---|
| 848 |  | 
|---|
| 849 | memcpy(&seiA, sei, sizeof(SHELLEXECUTEINFOA)); | 
|---|
| 850 |  | 
|---|
| 851 | if (sei->lpVerb) | 
|---|
| 852 | seiA.lpVerb = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpVerb); | 
|---|
| 853 |  | 
|---|
| 854 | if (sei->lpFile) | 
|---|
| 855 | seiA.lpFile = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpFile); | 
|---|
| 856 |  | 
|---|
| 857 | if (sei->lpParameters) | 
|---|
| 858 | seiA.lpParameters = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpParameters); | 
|---|
| 859 |  | 
|---|
| 860 | if (sei->lpDirectory) | 
|---|
| 861 | seiA.lpDirectory = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpDirectory); | 
|---|
| 862 |  | 
|---|
| 863 | if ((sei->fMask & SEE_MASK_CLASSNAME) && sei->lpClass) | 
|---|
| 864 | seiA.lpClass = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpClass); | 
|---|
| 865 | else | 
|---|
| 866 | seiA.lpClass = NULL; | 
|---|
| 867 |  | 
|---|
| 868 | ret = ShellExecuteExA(&seiA); | 
|---|
| 869 |  | 
|---|
| 870 | if (seiA.lpVerb)        HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpVerb ); | 
|---|
| 871 | if (seiA.lpFile)        HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpFile ); | 
|---|
| 872 | if (seiA.lpParameters)  HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpParameters ); | 
|---|
| 873 | if (seiA.lpDirectory)   HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpDirectory ); | 
|---|
| 874 | if (seiA.lpClass)       HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpClass ); | 
|---|
| 875 |  | 
|---|
| 876 | return ret; | 
|---|
| 877 | } | 
|---|
| 878 |  | 
|---|
| 879 | static LPUNKNOWN SHELL32_IExplorerInterface=0; | 
|---|
| 880 | /************************************************************************* | 
|---|
| 881 | * SHSetInstanceExplorer                        [SHELL32.176] | 
|---|
| 882 | * | 
|---|
| 883 | * NOTES | 
|---|
| 884 | *  Sets the interface | 
|---|
| 885 | */ | 
|---|
| 886 | HRESULT WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown) | 
|---|
| 887 | {       TRACE("%p\n", lpUnknown); | 
|---|
| 888 | SHELL32_IExplorerInterface = lpUnknown; | 
|---|
| 889 | return (HRESULT) lpUnknown; | 
|---|
| 890 | } | 
|---|
| 891 | /************************************************************************* | 
|---|
| 892 | * SHGetInstanceExplorer                        [SHELL32.256] | 
|---|
| 893 | * | 
|---|
| 894 | * NOTES | 
|---|
| 895 | *  gets the interface pointer of the explorer and a reference | 
|---|
| 896 | */ | 
|---|
| 897 | HRESULT WINAPI SHGetInstanceExplorer (LPUNKNOWN * lpUnknown) | 
|---|
| 898 | {       TRACE("%p\n", lpUnknown); | 
|---|
| 899 |  | 
|---|
| 900 | *lpUnknown = SHELL32_IExplorerInterface; | 
|---|
| 901 |  | 
|---|
| 902 | if (!SHELL32_IExplorerInterface) | 
|---|
| 903 | return E_FAIL; | 
|---|
| 904 |  | 
|---|
| 905 | IUnknown_AddRef(SHELL32_IExplorerInterface); | 
|---|
| 906 | return NOERROR; | 
|---|
| 907 | } | 
|---|
| 908 | /************************************************************************* | 
|---|
| 909 | * SHFreeUnusedLibraries                        [SHELL32.123] | 
|---|
| 910 | * | 
|---|
| 911 | * NOTES | 
|---|
| 912 | *  exported by name | 
|---|
| 913 | */ | 
|---|
| 914 | HRESULT WINAPI SHFreeUnusedLibraries (void) | 
|---|
| 915 | {       FIXME("stub\n"); | 
|---|
| 916 | return TRUE; | 
|---|
| 917 | } | 
|---|
| 918 | /************************************************************************* | 
|---|
| 919 | * DAD_SetDragImage                             [SHELL32.136] | 
|---|
| 920 | * | 
|---|
| 921 | * NOTES | 
|---|
| 922 | *  exported by name | 
|---|
| 923 | */ | 
|---|
| 924 | HRESULT WINAPI DAD_SetDragImage (DWORD u, DWORD v) | 
|---|
| 925 | { FIXME("0x%08lx 0x%08lx stub\n",u, v); | 
|---|
| 926 | return 0; | 
|---|
| 927 | } | 
|---|
| 928 | /************************************************************************* | 
|---|
| 929 | * DAD_ShowDragImage                            [SHELL32.137] | 
|---|
| 930 | * | 
|---|
| 931 | * NOTES | 
|---|
| 932 | *  exported by name | 
|---|
| 933 | */ | 
|---|
| 934 | HRESULT WINAPI DAD_ShowDragImage (DWORD u) | 
|---|
| 935 | { FIXME("0x%08lx stub\n",u); | 
|---|
| 936 | return 0; | 
|---|
| 937 | } | 
|---|
| 938 | /************************************************************************* | 
|---|
| 939 | * SHRegCloseKey                        [NT4.0:SHELL32.505] | 
|---|
| 940 | * | 
|---|
| 941 | */ | 
|---|
| 942 | HRESULT WINAPI SHRegCloseKey (HKEY hkey) | 
|---|
| 943 | {       TRACE("0x%04x\n",hkey); | 
|---|
| 944 | return RegCloseKey( hkey ); | 
|---|
| 945 | } | 
|---|
| 946 | /************************************************************************* | 
|---|
| 947 | * SHRegOpenKeyA                                [SHELL32.506] | 
|---|
| 948 | * | 
|---|
| 949 | */ | 
|---|
| 950 | HRESULT WINAPI SHRegOpenKeyA(HKEY hKey, LPSTR lpSubKey, LPHKEY phkResult) | 
|---|
| 951 | { | 
|---|
| 952 | TRACE("(0x%08x, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult); | 
|---|
| 953 | return RegOpenKeyA(hKey, lpSubKey, phkResult); | 
|---|
| 954 | } | 
|---|
| 955 |  | 
|---|
| 956 | /************************************************************************* | 
|---|
| 957 | * SHRegOpenKeyW                                [NT4.0:SHELL32.507] | 
|---|
| 958 | * | 
|---|
| 959 | */ | 
|---|
| 960 | HRESULT WINAPI SHRegOpenKeyW (HKEY hkey, LPCWSTR lpszSubKey, LPHKEY retkey) | 
|---|
| 961 | {       WARN("0x%04x %s %p\n",hkey,debugstr_w(lpszSubKey),retkey); | 
|---|
| 962 | return RegOpenKeyW( hkey, lpszSubKey, retkey ); | 
|---|
| 963 | } | 
|---|
| 964 | /************************************************************************* | 
|---|
| 965 | * SHRegQueryValueExA                           [SHELL32.509] | 
|---|
| 966 | * | 
|---|
| 967 | */ | 
|---|
| 968 | HRESULT WINAPI SHRegQueryValueExA( | 
|---|
| 969 | HKEY hkey, | 
|---|
| 970 | LPSTR lpValueName, | 
|---|
| 971 | LPDWORD lpReserved, | 
|---|
| 972 | LPDWORD lpType, | 
|---|
| 973 | LPBYTE lpData, | 
|---|
| 974 | LPDWORD lpcbData) | 
|---|
| 975 | { | 
|---|
| 976 | TRACE("0x%04x %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData); | 
|---|
| 977 | return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData); | 
|---|
| 978 | } | 
|---|
| 979 | /************************************************************************* | 
|---|
| 980 | * SHRegQueryValueW                             [NT4.0:SHELL32.510] | 
|---|
| 981 | * | 
|---|
| 982 | */ | 
|---|
| 983 | HRESULT WINAPI SHRegQueryValueW (HKEY hkey, LPWSTR lpszSubKey, | 
|---|
| 984 | LPWSTR lpszData, LPDWORD lpcbData ) | 
|---|
| 985 | {       WARN("0x%04x %s %p %p semi-stub\n", | 
|---|
| 986 | hkey, debugstr_w(lpszSubKey), lpszData, lpcbData); | 
|---|
| 987 | return RegQueryValueW( hkey, lpszSubKey, lpszData, (LPLONG)lpcbData ); | 
|---|
| 988 | } | 
|---|
| 989 |  | 
|---|
| 990 | /************************************************************************* | 
|---|
| 991 | * SHRegQueryValueExW                           [NT4.0:SHELL32.511] | 
|---|
| 992 | * | 
|---|
| 993 | * FIXME | 
|---|
| 994 | *  if the datatype REG_EXPAND_SZ then expand the string and change | 
|---|
| 995 | *  *pdwType to REG_SZ. | 
|---|
| 996 | */ | 
|---|
| 997 | HRESULT WINAPI SHRegQueryValueExW (HKEY hkey, LPWSTR pszValue, LPDWORD pdwReserved, | 
|---|
| 998 | LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData) | 
|---|
| 999 | {       DWORD ret; | 
|---|
| 1000 | WARN("0x%04x %s %p %p %p %p semi-stub\n", | 
|---|
| 1001 | hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData); | 
|---|
| 1002 | ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, (LPBYTE)pvData, pcbData); | 
|---|
| 1003 | return ret; | 
|---|
| 1004 | } | 
|---|
| 1005 |  | 
|---|
| 1006 | /************************************************************************* | 
|---|
| 1007 | * ReadCabinetState                             [NT 4.0:SHELL32.651] | 
|---|
| 1008 | * | 
|---|
| 1009 | */ | 
|---|
| 1010 | HRESULT WINAPI ReadCabinetState(DWORD u, DWORD v) | 
|---|
| 1011 | {       FIXME("0x%04lx 0x%04lx stub\n",u,v); | 
|---|
| 1012 | return 0; | 
|---|
| 1013 | } | 
|---|
| 1014 | /************************************************************************* | 
|---|
| 1015 | * WriteCabinetState                            [NT 4.0:SHELL32.652] | 
|---|
| 1016 | * | 
|---|
| 1017 | */ | 
|---|
| 1018 | HRESULT WINAPI WriteCabinetState(DWORD u) | 
|---|
| 1019 | {       FIXME("0x%04lx stub\n",u); | 
|---|
| 1020 | return 0; | 
|---|
| 1021 | } | 
|---|
| 1022 | /************************************************************************* | 
|---|
| 1023 | * FileIconInit                                 [SHELL32.660] | 
|---|
| 1024 | * | 
|---|
| 1025 | */ | 
|---|
| 1026 | BOOL WINAPI FileIconInit(BOOL bFullInit) | 
|---|
| 1027 | {       FIXME("(%s)\n", bFullInit ? "true" : "false"); | 
|---|
| 1028 | return 0; | 
|---|
| 1029 | } | 
|---|
| 1030 | /************************************************************************* | 
|---|
| 1031 | * IsUserAdmin                                  [NT 4.0:SHELL32.680] | 
|---|
| 1032 | * | 
|---|
| 1033 | */ | 
|---|
| 1034 | HRESULT WINAPI IsUserAdmin(void) | 
|---|
| 1035 | {       FIXME("stub\n"); | 
|---|
| 1036 | return TRUE; | 
|---|
| 1037 | } | 
|---|
| 1038 | /************************************************************************* | 
|---|
| 1039 | * StrRetToStrN                                 [SHELL32.96] | 
|---|
| 1040 | * | 
|---|
| 1041 | * converts a STRRET to a normal string | 
|---|
| 1042 | * | 
|---|
| 1043 | * NOTES | 
|---|
| 1044 | *  the pidl is for STRRET OFFSET | 
|---|
| 1045 | */ | 
|---|
| 1046 | HRESULT WINAPI StrRetToBufA (LPSTRRET src, LPITEMIDLIST pidl, LPSTR dest, DWORD len) | 
|---|
| 1047 | { | 
|---|
| 1048 | return StrRetToStrNA(dest, len, src, pidl); | 
|---|
| 1049 | } | 
|---|
| 1050 |  | 
|---|
| 1051 | HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl) | 
|---|
| 1052 | { | 
|---|
| 1053 | TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl); | 
|---|
| 1054 |  | 
|---|
| 1055 | switch (src->uType) | 
|---|
| 1056 | { | 
|---|
| 1057 | case STRRET_WSTR: | 
|---|
| 1058 | WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, (LPSTR)dest, len, NULL, NULL); | 
|---|
| 1059 | SHFree(src->u.pOleStr); | 
|---|
| 1060 | break; | 
|---|
| 1061 |  | 
|---|
| 1062 | case STRRET_CSTRA: | 
|---|
| 1063 | lstrcpynA((LPSTR)dest, src->u.cStr, len); | 
|---|
| 1064 | break; | 
|---|
| 1065 |  | 
|---|
| 1066 | case STRRET_OFFSETA: | 
|---|
| 1067 | lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len); | 
|---|
| 1068 | break; | 
|---|
| 1069 |  | 
|---|
| 1070 | default: | 
|---|
| 1071 | FIXME("unknown type!\n"); | 
|---|
| 1072 | if (len) | 
|---|
| 1073 | { | 
|---|
| 1074 | *(LPSTR)dest = '\0'; | 
|---|
| 1075 | } | 
|---|
| 1076 | return(FALSE); | 
|---|
| 1077 | } | 
|---|
| 1078 | return S_OK; | 
|---|
| 1079 | } | 
|---|
| 1080 |  | 
|---|
| 1081 | HRESULT WINAPI StrRetToBufW (LPSTRRET src, LPITEMIDLIST pidl, LPWSTR dest, DWORD len) | 
|---|
| 1082 | { | 
|---|
| 1083 | return StrRetToStrNW(dest, len, src, pidl); | 
|---|
| 1084 | } | 
|---|
| 1085 |  | 
|---|
| 1086 | HRESULT WINAPI StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl) | 
|---|
| 1087 | { | 
|---|
| 1088 | TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl); | 
|---|
| 1089 |  | 
|---|
| 1090 | switch (src->uType) | 
|---|
| 1091 | { | 
|---|
| 1092 | case STRRET_WSTR: | 
|---|
| 1093 | lstrcpynW((LPWSTR)dest, src->u.pOleStr, len); | 
|---|
| 1094 | SHFree(src->u.pOleStr); | 
|---|
| 1095 | break; | 
|---|
| 1096 |  | 
|---|
| 1097 | case STRRET_CSTRA: | 
|---|
| 1098 | lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len); | 
|---|
| 1099 | break; | 
|---|
| 1100 |  | 
|---|
| 1101 | case STRRET_OFFSETA: | 
|---|
| 1102 | if (pidl) | 
|---|
| 1103 | { | 
|---|
| 1104 | lstrcpynAtoW((LPWSTR)dest, ((LPSTR)&pidl->mkid)+src->u.uOffset, len); | 
|---|
| 1105 | } | 
|---|
| 1106 | break; | 
|---|
| 1107 |  | 
|---|
| 1108 | default: | 
|---|
| 1109 | FIXME("unknown type!\n"); | 
|---|
| 1110 | if (len) | 
|---|
| 1111 | { *(LPSTR)dest = '\0'; | 
|---|
| 1112 | } | 
|---|
| 1113 | return(FALSE); | 
|---|
| 1114 | } | 
|---|
| 1115 | return S_OK; | 
|---|
| 1116 | } | 
|---|
| 1117 | HRESULT WINAPI StrRetToStrNAW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl) | 
|---|
| 1118 | { | 
|---|
| 1119 | if(VERSION_OsIsUnicode()) | 
|---|
| 1120 | return StrRetToStrNW (dest, len, src, pidl); | 
|---|
| 1121 | return StrRetToStrNA (dest, len, src, pidl); | 
|---|
| 1122 | } | 
|---|
| 1123 |  | 
|---|
| 1124 | /************************************************************************* | 
|---|
| 1125 | * StrChrA                                      [NT 4.0:SHELL32.651] | 
|---|
| 1126 | * | 
|---|
| 1127 | */ | 
|---|
| 1128 | LPSTR WINAPI StrChrA (LPSTR str, CHAR x ) | 
|---|
| 1129 | {       LPSTR ptr=str; | 
|---|
| 1130 |  | 
|---|
| 1131 | do | 
|---|
| 1132 | {  if (*ptr==x) | 
|---|
| 1133 | { return ptr; | 
|---|
| 1134 | } | 
|---|
| 1135 | ptr++; | 
|---|
| 1136 | } while (*ptr); | 
|---|
| 1137 | return NULL; | 
|---|
| 1138 | } | 
|---|
| 1139 |  | 
|---|
| 1140 | /************************************************************************* | 
|---|
| 1141 | * StrChrW                                      [NT 4.0:SHELL32.651] | 
|---|
| 1142 | * | 
|---|
| 1143 | */ | 
|---|
| 1144 | LPWSTR WINAPI StrChrW (LPWSTR str, WCHAR x ) | 
|---|
| 1145 | {       LPWSTR ptr=str; | 
|---|
| 1146 |  | 
|---|
| 1147 | TRACE("%s 0x%04x\n",debugstr_w(str),x); | 
|---|
| 1148 | do | 
|---|
| 1149 | {  if (*ptr==x) | 
|---|
| 1150 | { return ptr; | 
|---|
| 1151 | } | 
|---|
| 1152 | ptr++; | 
|---|
| 1153 | } while (*ptr); | 
|---|
| 1154 | return NULL; | 
|---|
| 1155 | } | 
|---|
| 1156 |  | 
|---|
| 1157 | /************************************************************************* | 
|---|
| 1158 | * StrCmpNIW                                    [NT 4.0:SHELL32.*] | 
|---|
| 1159 | * | 
|---|
| 1160 | */ | 
|---|
| 1161 | INT WINAPI StrCmpNIW ( LPWSTR wstr1, LPWSTR wstr2, INT len) | 
|---|
| 1162 | {       FIXME("%s %s %i stub\n", debugstr_w(wstr1),debugstr_w(wstr2),len); | 
|---|
| 1163 | return 0; | 
|---|
| 1164 | } | 
|---|
| 1165 |  | 
|---|
| 1166 | /************************************************************************* | 
|---|
| 1167 | * StrCmpNIA                                    [NT 4.0:SHELL32.*] | 
|---|
| 1168 | * | 
|---|
| 1169 | */ | 
|---|
| 1170 | INT WINAPI StrCmpNIA ( LPSTR wstr1, LPSTR wstr2, INT len) | 
|---|
| 1171 | {       FIXME("%s %s %i stub\n", wstr1,wstr2,len); | 
|---|
| 1172 | return 0; | 
|---|
| 1173 | } | 
|---|
| 1174 |  | 
|---|
| 1175 | /************************************************************************* | 
|---|
| 1176 | * SHAllocShared                                [SHELL32.520] | 
|---|
| 1177 | * | 
|---|
| 1178 | * NOTES | 
|---|
| 1179 | *  parameter1 is return value from HeapAlloc | 
|---|
| 1180 | *  parameter2 is equal to the size allocated with HeapAlloc | 
|---|
| 1181 | *  parameter3 is return value from GetCurrentProcessId | 
|---|
| 1182 | * | 
|---|
| 1183 | *  the return value is posted as lParam with 0x402 (WM_USER+2) to somewhere | 
|---|
| 1184 | *  WM_USER+2 could be the undocumented CWM_SETPATH | 
|---|
| 1185 | *  the allocated memory contains a pidl | 
|---|
| 1186 | */ | 
|---|
| 1187 | HGLOBAL WINAPI SHAllocShared(LPVOID psrc, DWORD size, DWORD procID) | 
|---|
| 1188 | {       HGLOBAL hmem; | 
|---|
| 1189 | LPVOID pmem; | 
|---|
| 1190 |  | 
|---|
| 1191 | TRACE("ptr=%p size=0x%04lx procID=0x%04lx\n",psrc,size,procID); | 
|---|
| 1192 | hmem = GlobalAlloc(GMEM_FIXED, size); | 
|---|
| 1193 | if (!hmem) | 
|---|
| 1194 | return 0; | 
|---|
| 1195 |  | 
|---|
| 1196 | pmem =  GlobalLock (hmem); | 
|---|
| 1197 |  | 
|---|
| 1198 | if (! pmem) | 
|---|
| 1199 | return 0; | 
|---|
| 1200 |  | 
|---|
| 1201 | memcpy (pmem, psrc, size); | 
|---|
| 1202 | GlobalUnlock(hmem); | 
|---|
| 1203 | return hmem; | 
|---|
| 1204 | } | 
|---|
| 1205 | /************************************************************************* | 
|---|
| 1206 | * SHLockShared                                 [SHELL32.521] | 
|---|
| 1207 | * | 
|---|
| 1208 | * NOTES | 
|---|
| 1209 | *  parameter1 is return value from SHAllocShared | 
|---|
| 1210 | *  parameter2 is return value from GetCurrentProcessId | 
|---|
| 1211 | *  the receiver of (WM_USER+2) trys to lock the HANDLE (?) | 
|---|
| 1212 | *  the returnvalue seems to be a memoryadress | 
|---|
| 1213 | */ | 
|---|
| 1214 | LPVOID WINAPI SHLockShared(HANDLE hmem, DWORD procID) | 
|---|
| 1215 | {       TRACE("handle=0x%04x procID=0x%04lx\n",hmem,procID); | 
|---|
| 1216 | return GlobalLock(hmem); | 
|---|
| 1217 | } | 
|---|
| 1218 | /************************************************************************* | 
|---|
| 1219 | * SHUnlockShared                               [SHELL32.522] | 
|---|
| 1220 | * | 
|---|
| 1221 | * NOTES | 
|---|
| 1222 | *  parameter1 is return value from SHLockShared | 
|---|
| 1223 | */ | 
|---|
| 1224 | BOOL WINAPI SHUnlockShared(HANDLE pmem) | 
|---|
| 1225 | {       TRACE("handle=0x%04x\n",pmem); | 
|---|
| 1226 | return GlobalUnlock(pmem); | 
|---|
| 1227 | } | 
|---|
| 1228 | /************************************************************************* | 
|---|
| 1229 | * SHFreeShared                                 [SHELL32.523] | 
|---|
| 1230 | * | 
|---|
| 1231 | * NOTES | 
|---|
| 1232 | *  parameter1 is return value from SHAllocShared | 
|---|
| 1233 | *  parameter2 is return value from GetCurrentProcessId | 
|---|
| 1234 | */ | 
|---|
| 1235 | HANDLE WINAPI SHFreeShared(HANDLE hmem, DWORD procID) | 
|---|
| 1236 | {       TRACE("handle=0x%04x 0x%04lx\n",hmem,procID); | 
|---|
| 1237 | return GlobalFree(hmem); | 
|---|
| 1238 | } | 
|---|
| 1239 |  | 
|---|
| 1240 | /************************************************************************* | 
|---|
| 1241 | * SetAppStartingCursor                         [SHELL32.99] | 
|---|
| 1242 | * | 
|---|
| 1243 | */ | 
|---|
| 1244 | HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v) | 
|---|
| 1245 | {       FIXME("hwnd=0x%04x 0x%04lx stub\n",u,v ); | 
|---|
| 1246 | return 0; | 
|---|
| 1247 | } | 
|---|
| 1248 | /************************************************************************* | 
|---|
| 1249 | * SHLoadOLE                                    [SHELL32.151] | 
|---|
| 1250 | * | 
|---|
| 1251 | */ | 
|---|
| 1252 | HRESULT WINAPI SHLoadOLE(DWORD u) | 
|---|
| 1253 | {       FIXME("0x%04lx stub\n",u); | 
|---|
| 1254 | return S_OK; | 
|---|
| 1255 | } | 
|---|
| 1256 | /************************************************************************* | 
|---|
| 1257 | * DriveType                                    [SHELL32.64] | 
|---|
| 1258 | * | 
|---|
| 1259 | */ | 
|---|
| 1260 | HRESULT WINAPI DriveType(DWORD u) | 
|---|
| 1261 | {       FIXME("0x%04lx stub\n",u); | 
|---|
| 1262 | return 0; | 
|---|
| 1263 | } | 
|---|
| 1264 | /************************************************************************* | 
|---|
| 1265 | * SHAbortInvokeCommand                         [SHELL32.198] | 
|---|
| 1266 | * | 
|---|
| 1267 | */ | 
|---|
| 1268 | HRESULT WINAPI SHAbortInvokeCommand(void) | 
|---|
| 1269 | {       FIXME("stub\n"); | 
|---|
| 1270 | return 1; | 
|---|
| 1271 | } | 
|---|
| 1272 | /************************************************************************* | 
|---|
| 1273 | * SHOutOfMemoryMessageBox                      [SHELL32.126] | 
|---|
| 1274 | * | 
|---|
| 1275 | */ | 
|---|
| 1276 | HRESULT WINAPI SHOutOfMemoryMessageBox(DWORD u, DWORD v, DWORD w) | 
|---|
| 1277 | {       FIXME("0x%04lx 0x%04lx 0x%04lx stub\n",u,v,w); | 
|---|
| 1278 | return 0; | 
|---|
| 1279 | } | 
|---|
| 1280 | /************************************************************************* | 
|---|
| 1281 | * SHFlushClipboard                             [SHELL32.121] | 
|---|
| 1282 | * | 
|---|
| 1283 | */ | 
|---|
| 1284 | HRESULT WINAPI SHFlushClipboard(void) | 
|---|
| 1285 | {       FIXME("stub\n"); | 
|---|
| 1286 | return 1; | 
|---|
| 1287 | } | 
|---|
| 1288 | /************************************************************************* | 
|---|
| 1289 | * StrRChrA                                     [SHELL32.346] | 
|---|
| 1290 | * | 
|---|
| 1291 | */ | 
|---|
| 1292 | LPSTR WINAPI StrRChrA(LPCSTR lpStart, LPCSTR lpEnd, DWORD wMatch) | 
|---|
| 1293 | { | 
|---|
| 1294 | if (!lpStart) | 
|---|
| 1295 | return NULL; | 
|---|
| 1296 |  | 
|---|
| 1297 | /* if the end not given, search*/ | 
|---|
| 1298 | if (!lpEnd) | 
|---|
| 1299 | { lpEnd=lpStart; | 
|---|
| 1300 | while (*lpEnd) | 
|---|
| 1301 | lpEnd++; | 
|---|
| 1302 | } | 
|---|
| 1303 |  | 
|---|
| 1304 | for (--lpEnd;lpStart <= lpEnd; lpEnd--) | 
|---|
| 1305 | if (*lpEnd==(char)wMatch) | 
|---|
| 1306 | return (LPSTR)lpEnd; | 
|---|
| 1307 |  | 
|---|
| 1308 | return NULL; | 
|---|
| 1309 | } | 
|---|
| 1310 | /************************************************************************* | 
|---|
| 1311 | * StrRChrW                                     [SHELL32.320] | 
|---|
| 1312 | * | 
|---|
| 1313 | */ | 
|---|
| 1314 | LPWSTR WINAPI StrRChrW(LPWSTR lpStart, LPWSTR lpEnd, DWORD wMatch) | 
|---|
| 1315 | {       LPWSTR wptr=NULL; | 
|---|
| 1316 | TRACE("%s %s 0x%04x\n",debugstr_w(lpStart),debugstr_w(lpEnd), (WCHAR)wMatch ); | 
|---|
| 1317 |  | 
|---|
| 1318 | /* if the end not given, search*/ | 
|---|
| 1319 | if (!lpEnd) | 
|---|
| 1320 | { lpEnd=lpStart; | 
|---|
| 1321 | while (*lpEnd) | 
|---|
| 1322 | lpEnd++; | 
|---|
| 1323 | } | 
|---|
| 1324 |  | 
|---|
| 1325 | do | 
|---|
| 1326 | { if (*lpStart==(WCHAR)wMatch) | 
|---|
| 1327 | wptr = lpStart; | 
|---|
| 1328 | lpStart++; | 
|---|
| 1329 | } while ( lpStart<=lpEnd ); | 
|---|
| 1330 | return wptr; | 
|---|
| 1331 | } | 
|---|
| 1332 | /************************************************************************* | 
|---|
| 1333 | * StrFormatByteSize                             [SHLWAPI] | 
|---|
| 1334 | */ | 
|---|
| 1335 | LPSTR WINAPI StrFormatByteSizeA ( DWORD dw, LPSTR pszBuf, UINT cchBuf ) | 
|---|
| 1336 | {       char buf[64]; | 
|---|
| 1337 | TRACE("%lx %p %i\n", dw, pszBuf, cchBuf); | 
|---|
| 1338 | if ( dw<1024L ) | 
|---|
| 1339 | { sprintf (buf,"%3.1f bytes", (FLOAT)dw); | 
|---|
| 1340 | } | 
|---|
| 1341 | else if ( dw<1048576L) | 
|---|
| 1342 | { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024); | 
|---|
| 1343 | } | 
|---|
| 1344 | else if ( dw < 1073741824L) | 
|---|
| 1345 | { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L); | 
|---|
| 1346 | } | 
|---|
| 1347 | else | 
|---|
| 1348 | { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L); | 
|---|
| 1349 | } | 
|---|
| 1350 | lstrcpynA (pszBuf, buf, cchBuf); | 
|---|
| 1351 | return pszBuf; | 
|---|
| 1352 | } | 
|---|
| 1353 | LPWSTR WINAPI StrFormatByteSizeW ( DWORD dw, LPWSTR pszBuf, UINT cchBuf ) | 
|---|
| 1354 | {       char buf[64]; | 
|---|
| 1355 | TRACE("%lx %p %i\n", dw, pszBuf, cchBuf); | 
|---|
| 1356 | if ( dw<1024L ) | 
|---|
| 1357 | { sprintf (buf,"%3.1f bytes", (FLOAT)dw); | 
|---|
| 1358 | } | 
|---|
| 1359 | else if ( dw<1048576L) | 
|---|
| 1360 | { sprintf (buf,"%3.1f KB", (FLOAT)dw/1024); | 
|---|
| 1361 | } | 
|---|
| 1362 | else if ( dw < 1073741824L) | 
|---|
| 1363 | { sprintf (buf,"%3.1f MB", (FLOAT)dw/1048576L); | 
|---|
| 1364 | } | 
|---|
| 1365 | else | 
|---|
| 1366 | { sprintf (buf,"%3.1f GB", (FLOAT)dw/1073741824L); | 
|---|
| 1367 | } | 
|---|
| 1368 | lstrcpynAtoW (pszBuf, buf, cchBuf); | 
|---|
| 1369 | return pszBuf; | 
|---|
| 1370 | } | 
|---|
| 1371 | /************************************************************************* | 
|---|
| 1372 | * SHWaitForFileToOpen                          [SHELL32.97] | 
|---|
| 1373 | * | 
|---|
| 1374 | */ | 
|---|
| 1375 | HRESULT WINAPI SHWaitForFileToOpen(DWORD u, DWORD v, DWORD w) | 
|---|
| 1376 | {       FIXME("0x%04lx 0x%04lx 0x%04lx stub\n",u,v,w); | 
|---|
| 1377 | return 0; | 
|---|
| 1378 | } | 
|---|
| 1379 | /************************************************************************* | 
|---|
| 1380 | * Control_FillCache_RunDLL                     [SHELL32.8] | 
|---|
| 1381 | * | 
|---|
| 1382 | */ | 
|---|
| 1383 | HRESULT WINAPI Control_FillCache_RunDLL(HWND hWnd, HANDLE hModule, DWORD w, DWORD x) | 
|---|
| 1384 | {       FIXME("0x%04x 0x%04x 0x%04lx 0x%04lx stub\n",hWnd, hModule,w,x); | 
|---|
| 1385 | return 0; | 
|---|
| 1386 | } | 
|---|
| 1387 | /************************************************************************* | 
|---|
| 1388 | * RunDLL_CallEntry16                           [SHELL32.122] | 
|---|
| 1389 | * the name is propably wrong | 
|---|
| 1390 | */ | 
|---|
| 1391 | HRESULT WINAPI RunDLL_CallEntry16(DWORD v, DWORD w, DWORD x, DWORD y, DWORD z) | 
|---|
| 1392 | {       FIXME("0x%04lx 0x%04lx 0x%04lx 0x%04lx 0x%04lx stub\n",v,w,x,y,z); | 
|---|
| 1393 | return 0; | 
|---|
| 1394 | } | 
|---|
| 1395 |  | 
|---|
| 1396 | /************************************************************************ | 
|---|
| 1397 | *      shell32_654                             [SHELL32.654] | 
|---|
| 1398 | * | 
|---|
| 1399 | * NOTES: first parameter seems to be a pointer (same as passed to WriteCabinetState) | 
|---|
| 1400 | * second one could be a size (0x0c). The size is the same as the structure saved to | 
|---|
| 1401 | * HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState | 
|---|
| 1402 | * I'm (js) guessing: this one is just ReadCabinetState ;-) | 
|---|
| 1403 | */ | 
|---|
| 1404 | HRESULT WINAPI shell32_654 (DWORD x, DWORD y) | 
|---|
| 1405 | {       FIXME("0x%08lx 0x%08lx stub\n",x,y); | 
|---|
| 1406 | return 0; | 
|---|
| 1407 | } | 
|---|
| 1408 |  | 
|---|
| 1409 | /************************************************************************ | 
|---|
| 1410 | *      RLBuildListOfPaths                      [SHELL32.146] | 
|---|
| 1411 | * | 
|---|
| 1412 | * NOTES | 
|---|
| 1413 | *   builds a DPA | 
|---|
| 1414 | */ | 
|---|
| 1415 | DWORD WINAPI RLBuildListOfPaths (void) | 
|---|
| 1416 | {       FIXME("stub\n"); | 
|---|
| 1417 | return 0; | 
|---|
| 1418 | } | 
|---|
| 1419 | /************************************************************************ | 
|---|
| 1420 | *      StrToOleStr                     [SHELL32.163] | 
|---|
| 1421 | * | 
|---|
| 1422 | */ | 
|---|
| 1423 | int WINAPI StrToOleStrA (LPWSTR lpWideCharStr, LPCSTR lpMultiByteString) | 
|---|
| 1424 | { | 
|---|
| 1425 | TRACE("%p %p(%s)\n", | 
|---|
| 1426 | lpWideCharStr, lpMultiByteString, lpMultiByteString); | 
|---|
| 1427 |  | 
|---|
| 1428 | return MultiByteToWideChar(0, 0, lpMultiByteString, -1, lpWideCharStr, MAX_PATH); | 
|---|
| 1429 |  | 
|---|
| 1430 | } | 
|---|
| 1431 | int WINAPI StrToOleStrW (LPWSTR lpWideCharStr, LPCWSTR lpWString) | 
|---|
| 1432 | { | 
|---|
| 1433 | TRACE("%p %p(%s)\n", | 
|---|
| 1434 | lpWideCharStr, lpWString, debugstr_w(lpWString)); | 
|---|
| 1435 |  | 
|---|
| 1436 | if (lstrcpyW (lpWideCharStr, lpWString )) | 
|---|
| 1437 | { return lstrlenW (lpWideCharStr); | 
|---|
| 1438 | } | 
|---|
| 1439 | return 0; | 
|---|
| 1440 | } | 
|---|
| 1441 |  | 
|---|
| 1442 | BOOL WINAPI StrToOleStrAW (LPWSTR lpWideCharStr, LPCVOID lpString) | 
|---|
| 1443 | { | 
|---|
| 1444 | if (VERSION_OsIsUnicode()) | 
|---|
| 1445 | return StrToOleStrW (lpWideCharStr, (LPCWSTR)lpString); | 
|---|
| 1446 | return StrToOleStrA (lpWideCharStr, (LPCSTR)lpString); | 
|---|
| 1447 | } | 
|---|
| 1448 |  | 
|---|
| 1449 | /************************************************************************ | 
|---|
| 1450 | *      SHValidateUNC                           [SHELL32.173] | 
|---|
| 1451 | * | 
|---|
| 1452 | */ | 
|---|
| 1453 | HRESULT WINAPI SHValidateUNC (DWORD x, DWORD y, DWORD z) | 
|---|
| 1454 | { | 
|---|
| 1455 | FIXME("0x%08lx 0x%08lx 0x%08lx stub\n",x,y,z); | 
|---|
| 1456 | return 0; | 
|---|
| 1457 | } | 
|---|
| 1458 |  | 
|---|
| 1459 | /************************************************************************ | 
|---|
| 1460 | *      DoEnvironmentSubstW                     [SHELL32.53] | 
|---|
| 1461 | * | 
|---|
| 1462 | */ | 
|---|
| 1463 | HRESULT WINAPI DoEnvironmentSubstA(LPSTR x, LPSTR y) | 
|---|
| 1464 | { | 
|---|
| 1465 | FIXME("%p(%s) %p(%s) stub\n", x, x, y, y); | 
|---|
| 1466 | return 0; | 
|---|
| 1467 | } | 
|---|
| 1468 |  | 
|---|
| 1469 | HRESULT WINAPI DoEnvironmentSubstW(LPWSTR x, LPWSTR y) | 
|---|
| 1470 | { | 
|---|
| 1471 | FIXME("%p(%s) %p(%s) stub\n", x, debugstr_w(x), y, debugstr_w(y)); | 
|---|
| 1472 | return 0; | 
|---|
| 1473 | } | 
|---|
| 1474 |  | 
|---|
| 1475 | HRESULT WINAPI DoEnvironmentSubstAW(LPVOID x, LPVOID y) | 
|---|
| 1476 | { | 
|---|
| 1477 | if (VERSION_OsIsUnicode()) | 
|---|
| 1478 | return DoEnvironmentSubstW((LPWSTR)x, (LPWSTR)y); | 
|---|
| 1479 | return DoEnvironmentSubstA((LPSTR)x, (LPSTR)y); | 
|---|
| 1480 | } | 
|---|
| 1481 |  | 
|---|
| 1482 | /************************************************************************* | 
|---|
| 1483 | *      shell32_243                             [SHELL32.243] | 
|---|
| 1484 | * | 
|---|
| 1485 | * Win98+ by-ordinal routine.  In Win98 this routine returns zero and | 
|---|
| 1486 | * does nothing else.  Possibly this does something in NT or SHELL32 5.0? | 
|---|
| 1487 | * | 
|---|
| 1488 | */ | 
|---|
| 1489 |  | 
|---|
| 1490 | BOOL WINAPI shell32_243(DWORD a, DWORD b) | 
|---|
| 1491 | { | 
|---|
| 1492 | return FALSE; | 
|---|
| 1493 | } | 
|---|
| 1494 |  | 
|---|
| 1495 | /************************************************************************ | 
|---|
| 1496 | *      Win32DeleteFile                         [SHELL32.164] | 
|---|
| 1497 | * | 
|---|
| 1498 | * Deletes a file.  Also triggers a change notify if one exists, but | 
|---|
| 1499 | * that mechanism doesn't yet exist in Wine's SHELL32. | 
|---|
| 1500 | * | 
|---|
| 1501 | * FIXME: | 
|---|
| 1502 | * Verified on Win98 / IE 5 (SHELL32 4.72, March 1999 build) to be | 
|---|
| 1503 | * ANSI.  Is this Unicode on NT? | 
|---|
| 1504 | * | 
|---|
| 1505 | */ | 
|---|
| 1506 |  | 
|---|
| 1507 | BOOL WINAPI Win32DeleteFile(LPSTR fName) | 
|---|
| 1508 | { | 
|---|
| 1509 | dprintf(("SHELL32:SHELLORD:Win32DeleteFile %p(%s): partial stub\n", fName, fName)); | 
|---|
| 1510 |  | 
|---|
| 1511 | DeleteFileA(fName); | 
|---|
| 1512 |  | 
|---|
| 1513 | return TRUE; | 
|---|
| 1514 | } | 
|---|
| 1515 |  | 
|---|
| 1516 |  | 
|---|
| 1517 | /***************************************************************************** | 
|---|
| 1518 | * Name      : StrChrIA | 
|---|
| 1519 | * Purpose   : Searches a string for the first occurrence of a character that | 
|---|
| 1520 | *             matches the specified character. The comparison is not case sensitive. | 
|---|
| 1521 | * Parameters: LPCSTR lpStart Address of the string to be searched. | 
|---|
| 1522 | *             TCHAR  wMatch  Character to be used for comparison. | 
|---|
| 1523 | * Variables : | 
|---|
| 1524 | * Result    : Returns the address of the first occurrence of the character in | 
|---|
| 1525 | *             the string if successful, or NULL otherwise. | 
|---|
| 1526 | * Remark    : SHELL32. | 
|---|
| 1527 | * Status    : UNTESTED UNKNOWN | 
|---|
| 1528 | * | 
|---|
| 1529 | * Author    : Patrick Haller [Wed, 1999/12/29 09:00] | 
|---|
| 1530 | *****************************************************************************/ | 
|---|
| 1531 |  | 
|---|
| 1532 | ODINFUNCTION2(LPSTR,  StrChrIA, | 
|---|
| 1533 | LPCSTR, lpStart, | 
|---|
| 1534 | CHAR,   wMatch) | 
|---|
| 1535 | { | 
|---|
| 1536 | LPSTR lpRes; | 
|---|
| 1537 |  | 
|---|
| 1538 | wMatch = tolower(wMatch); | 
|---|
| 1539 | lpRes = strchr(lpStart, wMatch);    // lower case comparsion | 
|---|
| 1540 | if (NULL == lpRes) | 
|---|
| 1541 | { | 
|---|
| 1542 | wMatch = toupper(wMatch); | 
|---|
| 1543 | lpRes = strchr(lpStart, wMatch);  // upper case comparsion | 
|---|
| 1544 | } | 
|---|
| 1545 |  | 
|---|
| 1546 | return lpRes; | 
|---|
| 1547 | } | 
|---|
| 1548 |  | 
|---|
| 1549 |  | 
|---|
| 1550 | /***************************************************************************** | 
|---|
| 1551 | * Name      : StrChrIW | 
|---|
| 1552 | * Purpose   : Searches a string for the first occurrence of a character that | 
|---|
| 1553 | *             matches the specified character. The comparison is not case sensitive. | 
|---|
| 1554 | * Parameters: LPCSTR lpStart Address of the string to be searched. | 
|---|
| 1555 | *             TCHAR  wMatch  Character to be used for comparison. | 
|---|
| 1556 | * Variables : | 
|---|
| 1557 | * Result    : Returns the address of the first occurrence of the character in | 
|---|
| 1558 | *             the string if successful, or NULL otherwise. | 
|---|
| 1559 | * Remark    : SHELL32. | 
|---|
| 1560 | * Status    : UNTESTED UNKNOWN | 
|---|
| 1561 | * | 
|---|
| 1562 | * Author    : Patrick Haller [Wed, 1999/12/29 09:00] | 
|---|
| 1563 | *****************************************************************************/ | 
|---|
| 1564 |  | 
|---|
| 1565 | ODINFUNCTION2(LPWSTR,   StrChrIW, | 
|---|
| 1566 | LPCWSTR, lpStart, | 
|---|
| 1567 | WCHAR,    wMatch) | 
|---|
| 1568 | { | 
|---|
| 1569 | LPWSTR lpRes; | 
|---|
| 1570 |  | 
|---|
| 1571 | wMatch = towlower(wMatch); | 
|---|
| 1572 | lpRes = (WCHAR*)wcschr((const wchar_t*)lpStart, wMatch);    // lower case comparsion | 
|---|
| 1573 | if (NULL == lpRes) | 
|---|
| 1574 | { | 
|---|
| 1575 | wMatch = towupper(wMatch); | 
|---|
| 1576 | lpRes = (WCHAR*)wcschr((const wchar_t*)lpStart, wMatch);  // upper case comparsion | 
|---|
| 1577 | } | 
|---|
| 1578 |  | 
|---|
| 1579 | return lpRes; | 
|---|
| 1580 | } | 
|---|
| 1581 |  | 
|---|
| 1582 |  | 
|---|
| 1583 | /***************************************************************************** | 
|---|
| 1584 | * Name      : StrStrIA | 
|---|
| 1585 | * Purpose   : Finds the first occurrence of a substring within a string. The | 
|---|
| 1586 | *             comparison is not case sensitive. | 
|---|
| 1587 | * Parameters: LPCSTR lpFirst | 
|---|
| 1588 | *             LPCSTR lpSrch | 
|---|
| 1589 | * Variables : | 
|---|
| 1590 | * Result    : Returns the address of the first occurrence of the matching | 
|---|
| 1591 | *             substring if successful, or NULL otherwise. | 
|---|
| 1592 | * Remark    : SHELL32. | 
|---|
| 1593 | * Status    : UNTESTED UNKNOWN | 
|---|
| 1594 | * | 
|---|
| 1595 | * Author    : Patrick Haller [Wed, 1999/12/29 09:00] | 
|---|
| 1596 | *****************************************************************************/ | 
|---|
| 1597 |  | 
|---|
| 1598 | ODINFUNCTION2(LPSTR,  StrStrIA, | 
|---|
| 1599 | LPCSTR, lpFirst, | 
|---|
| 1600 | LPCSTR, lpSrch) | 
|---|
| 1601 | { | 
|---|
| 1602 | char  ch = lpSrch[0];          // look for 1st character | 
|---|
| 1603 | LONG  lLen = lstrlenA(lpSrch); // length of search string | 
|---|
| 1604 | int   iRes;                    // comparsion result | 
|---|
| 1605 |  | 
|---|
| 1606 | do | 
|---|
| 1607 | { | 
|---|
| 1608 | lpFirst = StrChrIA(lpFirst, // find first matching character | 
|---|
| 1609 | ch); | 
|---|
| 1610 | if (NULL == lpFirst)        // not found | 
|---|
| 1611 | return NULL; | 
|---|
| 1612 |  | 
|---|
| 1613 | iRes   = StrCmpNIA((LPSTR)lpFirst, // compare search string | 
|---|
| 1614 | (LPSTR)lpSrch, | 
|---|
| 1615 | lLen); | 
|---|
| 1616 |  | 
|---|
| 1617 | if (0 == iRes)              // Found! | 
|---|
| 1618 | return (LPSTR)lpFirst; | 
|---|
| 1619 |  | 
|---|
| 1620 | lpFirst = CharNextA(lpFirst); // skip to next character | 
|---|
| 1621 | } | 
|---|
| 1622 | while (*lpFirst != 0);        // safe termination | 
|---|
| 1623 |  | 
|---|
| 1624 | return NULL;                  // default result | 
|---|
| 1625 | } | 
|---|
| 1626 |  | 
|---|
| 1627 |  | 
|---|
| 1628 |  | 
|---|
| 1629 | /***************************************************************************** | 
|---|
| 1630 | * Name      : StrStrIW | 
|---|
| 1631 | * Purpose   : Finds the first occurrence of a substring within a string. The | 
|---|
| 1632 | *             comparison is not case sensitive. | 
|---|
| 1633 | * Parameters: LPCWSTR lpFirst | 
|---|
| 1634 | *             LPCWSTR lpSrch | 
|---|
| 1635 | * Variables : | 
|---|
| 1636 | * Result    : Returns the address of the first occurrence of the matching | 
|---|
| 1637 | *             substring if successful, or NULL otherwise. | 
|---|
| 1638 | * Remark    : SHELL32. | 
|---|
| 1639 | * Status    : UNTESTED UNKNOWN | 
|---|
| 1640 | * | 
|---|
| 1641 | * Author    : Patrick Haller [Wed, 1999/12/29 09:00] | 
|---|
| 1642 | *****************************************************************************/ | 
|---|
| 1643 |  | 
|---|
| 1644 | ODINFUNCTION2(LPWSTR,  StrStrIW, | 
|---|
| 1645 | LPCWSTR, lpFirst, | 
|---|
| 1646 | LPCWSTR, lpSrch) | 
|---|
| 1647 | { | 
|---|
| 1648 | WCHAR  ch = lpSrch[0];          // look for 1st character | 
|---|
| 1649 | LONG   lLen = lstrlenW(lpSrch); // length of search string | 
|---|
| 1650 | int   iRes;                    // comparsion result | 
|---|
| 1651 |  | 
|---|
| 1652 | do | 
|---|
| 1653 | { | 
|---|
| 1654 | lpFirst = StrChrIW(lpFirst, // find first matching character | 
|---|
| 1655 | ch); | 
|---|
| 1656 | if (NULL == lpFirst)        // not found | 
|---|
| 1657 | return NULL; | 
|---|
| 1658 |  | 
|---|
| 1659 | iRes   = StrCmpNIW((LPWSTR)lpFirst, // compare search string | 
|---|
| 1660 | (LPWSTR)lpSrch, | 
|---|
| 1661 | lLen); | 
|---|
| 1662 |  | 
|---|
| 1663 | if (0 == iRes)              // Found! | 
|---|
| 1664 | return (LPWSTR)lpFirst; | 
|---|
| 1665 |  | 
|---|
| 1666 | lpFirst = CharNextW(lpFirst); // skip to next character | 
|---|
| 1667 | } | 
|---|
| 1668 | while (*lpFirst != 0);        // safe termination | 
|---|
| 1669 |  | 
|---|
| 1670 | return NULL;                  // default result | 
|---|
| 1671 | } | 
|---|
| 1672 |  | 
|---|
| 1673 |  | 
|---|