| 1 | /* | 
|---|
| 2 | * The parameters of many functions changes between different OS versions | 
|---|
| 3 | * (NT uses Unicode strings, 95 uses ASCII strings) | 
|---|
| 4 | * | 
|---|
| 5 | * Copyright 1997 Marcus Meissner | 
|---|
| 6 | *           1998 Jürgen Schmied | 
|---|
| 7 | */ | 
|---|
| 8 |  | 
|---|
| 9 | /**************************************************************************** | 
|---|
| 10 | * includes | 
|---|
| 11 | ****************************************************************************/ | 
|---|
| 12 |  | 
|---|
| 13 | #include <odin.h> | 
|---|
| 14 | #include <os2sel.h> | 
|---|
| 15 | #include <odinwrap.h> | 
|---|
| 16 |  | 
|---|
| 17 | ODINDEBUGCHANNEL(SHELL32-SHELLORD) | 
|---|
| 18 |  | 
|---|
| 19 |  | 
|---|
| 20 | #include <string.h> | 
|---|
| 21 | #include <stdio.h> | 
|---|
| 22 | #include "winerror.h" | 
|---|
| 23 | #include "winreg.h" | 
|---|
| 24 | #include "debugtools.h" | 
|---|
| 25 | #include "winnls.h" | 
|---|
| 26 | #include "heap.h" | 
|---|
| 27 |  | 
|---|
| 28 | #include "shlwapi.h" | 
|---|
| 29 | #include "shellapi.h" | 
|---|
| 30 | #include "shlguid.h" | 
|---|
| 31 | #include "shlobj.h" | 
|---|
| 32 | #include "shell32_main.h" | 
|---|
| 33 | #ifdef __WIN32OS2__ | 
|---|
| 34 | #include "wine\undocshell.h" | 
|---|
| 35 | #else | 
|---|
| 36 | #include "undocshell.h" | 
|---|
| 37 | #endif | 
|---|
| 38 |  | 
|---|
| 39 | DEFAULT_DEBUG_CHANNEL(shell); | 
|---|
| 40 |  | 
|---|
| 41 | /************************************************************************* | 
|---|
| 42 | * ParseFieldA                                  [internal] | 
|---|
| 43 | * | 
|---|
| 44 | * copys a field from a ',' delimited string | 
|---|
| 45 | * | 
|---|
| 46 | * first field is nField = 1 | 
|---|
| 47 | */ | 
|---|
| 48 | DWORD WINAPI ParseFieldA( | 
|---|
| 49 | LPCSTR src, | 
|---|
| 50 | DWORD nField, | 
|---|
| 51 | LPSTR dst, | 
|---|
| 52 | DWORD len) | 
|---|
| 53 | { | 
|---|
| 54 | WARN("('%s',0x%08lx,%p,%ld) semi-stub.\n",src,nField,dst,len); | 
|---|
| 55 |  | 
|---|
| 56 | if (!src || !src[0] || !dst || !len) | 
|---|
| 57 | return 0; | 
|---|
| 58 |  | 
|---|
| 59 | /* skip n fields delimited by ',' */ | 
|---|
| 60 | while (nField > 1) | 
|---|
| 61 | { | 
|---|
| 62 | if (*src=='\0') return FALSE; | 
|---|
| 63 | if (*(src++)==',') nField--; | 
|---|
| 64 | } | 
|---|
| 65 |  | 
|---|
| 66 | /* copy part till the next ',' to dst */ | 
|---|
| 67 | while ( *src!='\0' && *src!=',' && (len--)>0 ) *(dst++)=*(src++); | 
|---|
| 68 |  | 
|---|
| 69 | /* finalize the string */ | 
|---|
| 70 | *dst=0x0; | 
|---|
| 71 |  | 
|---|
| 72 | return TRUE; | 
|---|
| 73 | } | 
|---|
| 74 |  | 
|---|
| 75 | /************************************************************************* | 
|---|
| 76 | * ParseFieldW                  [internal] | 
|---|
| 77 | * | 
|---|
| 78 | * copys a field from a ',' delimited string | 
|---|
| 79 | * | 
|---|
| 80 | * first field is nField = 1 | 
|---|
| 81 | */ | 
|---|
| 82 | DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len) | 
|---|
| 83 | { | 
|---|
| 84 | FIXME("(%s,0x%08lx,%p,%ld) stub\n", | 
|---|
| 85 | debugstr_w(src), nField, dst, len); | 
|---|
| 86 | return FALSE; | 
|---|
| 87 | } | 
|---|
| 88 |  | 
|---|
| 89 | /************************************************************************* | 
|---|
| 90 | * ParseField                   [SHELL32.58] | 
|---|
| 91 | */ | 
|---|
| 92 | DWORD WINAPI ParseFieldAW(LPCVOID src, DWORD nField, LPVOID dst, DWORD len) | 
|---|
| 93 | { | 
|---|
| 94 | if (SHELL_OsIsUnicode()) | 
|---|
| 95 | return ParseFieldW(src, nField, dst, len); | 
|---|
| 96 | return ParseFieldA(src, nField, dst, len); | 
|---|
| 97 | } | 
|---|
| 98 |  | 
|---|
| 99 | /************************************************************************* | 
|---|
| 100 | * GetFileNameFromBrowse                        [SHELL32.63] | 
|---|
| 101 | * | 
|---|
| 102 | */ | 
|---|
| 103 | ODINFUNCTION7(BOOL, GetFileNameFromBrowse, | 
|---|
| 104 | HWND, hwndOwner, | 
|---|
| 105 | LPSTR, lpstrFile, | 
|---|
| 106 | DWORD, nMaxFile, | 
|---|
| 107 | LPCSTR, lpstrInitialDir, | 
|---|
| 108 | LPCSTR, lpstrDefExt, | 
|---|
| 109 | LPCSTR, lpstrFilter, | 
|---|
| 110 | LPCSTR, lpstrTitle) | 
|---|
| 111 | { | 
|---|
| 112 | FIXME("(%04x,%s,%ld,%s,%s,%s,%s):stub.\n", | 
|---|
| 113 | hwndOwner, lpstrFile, nMaxFile, lpstrInitialDir, lpstrDefExt, | 
|---|
| 114 | lpstrFilter, lpstrTitle); | 
|---|
| 115 |  | 
|---|
| 116 | /* puts up a Open Dialog and requests input into targetbuf */ | 
|---|
| 117 | /* OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_FILEMUSTEXIST|OFN_unknown */ | 
|---|
| 118 | strcpy(lpstrFile,"x:\\dummy.exe"); | 
|---|
| 119 | return 1; | 
|---|
| 120 | } | 
|---|
| 121 |  | 
|---|
| 122 | /************************************************************************* | 
|---|
| 123 | * SHGetSetSettings                             [SHELL32.68] | 
|---|
| 124 | */ | 
|---|
| 125 | VOID WINAPI SHGetSetSettings(DWORD x, DWORD y, DWORD z) | 
|---|
| 126 | { | 
|---|
| 127 | FIXME("0x%08lx 0x%08lx 0x%08lx\n", x, y, z); | 
|---|
| 128 | } | 
|---|
| 129 |  | 
|---|
| 130 | /************************************************************************* | 
|---|
| 131 | * SHGetSettings                                [SHELL32.@] | 
|---|
| 132 | * | 
|---|
| 133 | * NOTES | 
|---|
| 134 | *  the registry path are for win98 (tested) | 
|---|
| 135 | *  and possibly are the same in nt40 | 
|---|
| 136 | * | 
|---|
| 137 | */ | 
|---|
| 138 | VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask) | 
|---|
| 139 | { | 
|---|
| 140 | HKEY    hKey; | 
|---|
| 141 | DWORD   dwData; | 
|---|
| 142 | DWORD   dwDataSize = sizeof (DWORD); | 
|---|
| 143 |  | 
|---|
| 144 | TRACE("(%p 0x%08lx)\n",lpsfs,dwMask); | 
|---|
| 145 |  | 
|---|
| 146 | if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", | 
|---|
| 147 | 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0)) | 
|---|
| 148 | return; | 
|---|
| 149 |  | 
|---|
| 150 | if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize)) | 
|---|
| 151 | lpsfs->fShowExtensions  = ((dwData == 0) ?  0 : 1); | 
|---|
| 152 |  | 
|---|
| 153 | if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize)) | 
|---|
| 154 | lpsfs->fShowInfoTip  = ((dwData == 0) ?  0 : 1); | 
|---|
| 155 |  | 
|---|
| 156 | if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize)) | 
|---|
| 157 | lpsfs->fDontPrettyPath  = ((dwData == 0) ?  0 : 1); | 
|---|
| 158 |  | 
|---|
| 159 | if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize)) | 
|---|
| 160 | lpsfs->fHideIcons  = ((dwData == 0) ?  0 : 1); | 
|---|
| 161 |  | 
|---|
| 162 | if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize)) | 
|---|
| 163 | lpsfs->fMapNetDrvBtn  = ((dwData == 0) ?  0 : 1); | 
|---|
| 164 |  | 
|---|
| 165 | if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize)) | 
|---|
| 166 | lpsfs->fShowAttribCol  = ((dwData == 0) ?  0 : 1); | 
|---|
| 167 |  | 
|---|
| 168 | if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize)) | 
|---|
| 169 | { if (dwData == 0) | 
|---|
| 170 | { if (SSF_SHOWALLOBJECTS & dwMask)    lpsfs->fShowAllObjects  = 0; | 
|---|
| 171 | if (SSF_SHOWSYSFILES & dwMask)      lpsfs->fShowSysFiles  = 0; | 
|---|
| 172 | } | 
|---|
| 173 | else if (dwData == 1) | 
|---|
| 174 | { if (SSF_SHOWALLOBJECTS & dwMask)    lpsfs->fShowAllObjects  = 1; | 
|---|
| 175 | if (SSF_SHOWSYSFILES & dwMask)      lpsfs->fShowSysFiles  = 0; | 
|---|
| 176 | } | 
|---|
| 177 | else if (dwData == 2) | 
|---|
| 178 | { if (SSF_SHOWALLOBJECTS & dwMask)    lpsfs->fShowAllObjects  = 0; | 
|---|
| 179 | if (SSF_SHOWSYSFILES & dwMask)      lpsfs->fShowSysFiles  = 1; | 
|---|
| 180 | } | 
|---|
| 181 | } | 
|---|
| 182 | RegCloseKey (hKey); | 
|---|
| 183 |  | 
|---|
| 184 | TRACE("-- 0x%04x\n", *(WORD*)lpsfs); | 
|---|
| 185 | } | 
|---|
| 186 |  | 
|---|
| 187 | /************************************************************************* | 
|---|
| 188 | * SHShellFolderView_Message                    [SHELL32.73] | 
|---|
| 189 | * | 
|---|
| 190 | * PARAMETERS | 
|---|
| 191 | *  hwndCabinet defines the explorer cabinet window that contains the | 
|---|
| 192 | *              shellview you need to communicate with | 
|---|
| 193 | *  uMsg        identifying the SFVM enum to perform | 
|---|
| 194 | *  lParam | 
|---|
| 195 | * | 
|---|
| 196 | * NOTES | 
|---|
| 197 | *  Message SFVM_REARRANGE = 1 | 
|---|
| 198 | *    This message gets sent when a column gets clicked to instruct the | 
|---|
| 199 | *    shell view to re-sort the item list. lParam identifies the column | 
|---|
| 200 | *    that was clicked. | 
|---|
| 201 | */ | 
|---|
| 202 | int WINAPI SHShellFolderView_Message( | 
|---|
| 203 | HWND hwndCabinet, | 
|---|
| 204 | DWORD dwMessage, | 
|---|
| 205 | DWORD dwParam) | 
|---|
| 206 | { | 
|---|
| 207 | FIXME("%04x %08lx %08lx stub\n",hwndCabinet, dwMessage, dwParam); | 
|---|
| 208 | return 0; | 
|---|
| 209 | } | 
|---|
| 210 |  | 
|---|
| 211 | /************************************************************************* | 
|---|
| 212 | * RegisterShellHook                            [SHELL32.181] | 
|---|
| 213 | * | 
|---|
| 214 | * PARAMS | 
|---|
| 215 | *      hwnd [I]  window handle | 
|---|
| 216 | *      y    [I]  flag ???? | 
|---|
| 217 | * | 
|---|
| 218 | * NOTES | 
|---|
| 219 | *     exported by ordinal | 
|---|
| 220 | */ | 
|---|
| 221 | BOOL WINAPI RegisterShellHook( | 
|---|
| 222 | HWND hWnd, | 
|---|
| 223 | DWORD dwType) | 
|---|
| 224 | { | 
|---|
| 225 | FIXME("(0x%08x,0x%08lx):stub.\n",hWnd, dwType); | 
|---|
| 226 | return TRUE; | 
|---|
| 227 | } | 
|---|
| 228 | /************************************************************************* | 
|---|
| 229 | * ShellMessageBoxW                             [SHELL32.182] | 
|---|
| 230 | * | 
|---|
| 231 | * Format and output errormessage. | 
|---|
| 232 | * | 
|---|
| 233 | * idText       resource ID of title or LPSTR | 
|---|
| 234 | * idTitle      resource ID of title or LPSTR | 
|---|
| 235 | * | 
|---|
| 236 | * NOTES | 
|---|
| 237 | *     exported by ordinal | 
|---|
| 238 | */ | 
|---|
| 239 | int WINAPIV ShellMessageBoxW( | 
|---|
| 240 | HINSTANCE hInstance, | 
|---|
| 241 | HWND hWnd, | 
|---|
| 242 | LPCWSTR lpText, | 
|---|
| 243 | LPCWSTR lpCaption, | 
|---|
| 244 | UINT uType, | 
|---|
| 245 | ...) | 
|---|
| 246 | { | 
|---|
| 247 | WCHAR   szText[100],szTitle[100]; | 
|---|
| 248 | LPCWSTR pszText = szText, pszTitle = szTitle, pszTemp; | 
|---|
| 249 | va_list args; | 
|---|
| 250 | int     ret; | 
|---|
| 251 |  | 
|---|
| 252 | va_start(args, uType); | 
|---|
| 253 | /* wvsprintfA(buf,fmt, args); */ | 
|---|
| 254 |  | 
|---|
| 255 | TRACE("(%08lx,%08lx,%p,%p,%08x)\n", | 
|---|
| 256 | (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType); | 
|---|
| 257 |  | 
|---|
| 258 | if (!HIWORD(lpCaption)) | 
|---|
| 259 | LoadStringW(hInstance, (DWORD)lpCaption, szTitle, sizeof(szTitle)/sizeof(szTitle[0])); | 
|---|
| 260 | else | 
|---|
| 261 | pszTitle = lpCaption; | 
|---|
| 262 |  | 
|---|
| 263 | if (!HIWORD(lpText)) | 
|---|
| 264 | LoadStringW(hInstance, (DWORD)lpText, szText, sizeof(szText)/sizeof(szText[0])); | 
|---|
| 265 | else | 
|---|
| 266 | pszText = lpText; | 
|---|
| 267 |  | 
|---|
| 268 | FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, | 
|---|
| 269 | pszText, 0, 0, (LPWSTR)&pszTemp, 0, &args); | 
|---|
| 270 |  | 
|---|
| 271 | va_end(args); | 
|---|
| 272 |  | 
|---|
| 273 | ret = MessageBoxW(hWnd,pszTemp,pszTitle,uType); | 
|---|
| 274 | LocalFree((HLOCAL)pszTemp); | 
|---|
| 275 | return ret; | 
|---|
| 276 | } | 
|---|
| 277 |  | 
|---|
| 278 | /************************************************************************* | 
|---|
| 279 | * ShellMessageBoxA                             [SHELL32.183] | 
|---|
| 280 | */ | 
|---|
| 281 | int WINAPIV ShellMessageBoxA( | 
|---|
| 282 | HINSTANCE hInstance, | 
|---|
| 283 | HWND hWnd, | 
|---|
| 284 | LPCSTR lpText, | 
|---|
| 285 | LPCSTR lpCaption, | 
|---|
| 286 | UINT uType, | 
|---|
| 287 | ...) | 
|---|
| 288 | { | 
|---|
| 289 | char    szText[100],szTitle[100]; | 
|---|
| 290 | LPCSTR  pszText = szText, pszTitle = szTitle, pszTemp; | 
|---|
| 291 | va_list args; | 
|---|
| 292 | int     ret; | 
|---|
| 293 |  | 
|---|
| 294 | va_start(args, uType); | 
|---|
| 295 | /* wvsprintfA(buf,fmt, args); */ | 
|---|
| 296 |  | 
|---|
| 297 | TRACE("(%08lx,%08lx,%p,%p,%08x)\n", | 
|---|
| 298 | (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType); | 
|---|
| 299 |  | 
|---|
| 300 | if (!HIWORD(lpCaption)) | 
|---|
| 301 | LoadStringA(hInstance, (DWORD)lpCaption, szTitle, sizeof(szTitle)); | 
|---|
| 302 | else | 
|---|
| 303 | pszTitle = lpCaption; | 
|---|
| 304 |  | 
|---|
| 305 | if (!HIWORD(lpText)) | 
|---|
| 306 | LoadStringA(hInstance, (DWORD)lpText, szText, sizeof(szText)); | 
|---|
| 307 | else | 
|---|
| 308 | pszText = lpText; | 
|---|
| 309 |  | 
|---|
| 310 | FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, | 
|---|
| 311 | pszText, 0, 0, (LPSTR)&pszTemp, 0, &args); | 
|---|
| 312 |  | 
|---|
| 313 | va_end(args); | 
|---|
| 314 |  | 
|---|
| 315 | ret = MessageBoxA(hWnd,pszTemp,pszTitle,uType); | 
|---|
| 316 | LocalFree((HLOCAL)pszTemp); | 
|---|
| 317 | return ret; | 
|---|
| 318 | } | 
|---|
| 319 |  | 
|---|
| 320 | /************************************************************************* | 
|---|
| 321 | * SHFree                                       [SHELL32.195] | 
|---|
| 322 | * | 
|---|
| 323 | * NOTES | 
|---|
| 324 | *     free_ptr() - frees memory using IMalloc | 
|---|
| 325 | *     exported by ordinal | 
|---|
| 326 | */ | 
|---|
| 327 | #define MEM_DEBUG 0 | 
|---|
| 328 |  | 
|---|
| 329 | ODINPROCEDURE1(SHFree, | 
|---|
| 330 | LPVOID, x) | 
|---|
| 331 | { | 
|---|
| 332 | #if MEM_DEBUG | 
|---|
| 333 | WORD len = *(LPWORD)((LPBYTE)x-2); | 
|---|
| 334 |  | 
|---|
| 335 | if ( *(LPWORD)((LPBYTE)x+len) != 0x7384) | 
|---|
| 336 | ERR("MAGIC2!\n"); | 
|---|
| 337 |  | 
|---|
| 338 | if ( (*(LPWORD)((LPBYTE)x-4)) != 0x8271) | 
|---|
| 339 | ERR("MAGIC1!\n"); | 
|---|
| 340 | else | 
|---|
| 341 | memset((LPBYTE)x-4, 0xde, len+6); | 
|---|
| 342 |  | 
|---|
| 343 | TRACE("%p len=%u\n",x, len); | 
|---|
| 344 |  | 
|---|
| 345 | x = (LPBYTE) x - 4; | 
|---|
| 346 | #else | 
|---|
| 347 | TRACE("%p\n",x); | 
|---|
| 348 | #endif | 
|---|
| 349 | HeapFree(GetProcessHeap(), 0, x); | 
|---|
| 350 | } | 
|---|
| 351 |  | 
|---|
| 352 | /************************************************************************* | 
|---|
| 353 | * SHAlloc                                      [SHELL32.196] | 
|---|
| 354 | * | 
|---|
| 355 | * NOTES | 
|---|
| 356 | *     void *task_alloc(DWORD len), uses SHMalloc allocator | 
|---|
| 357 | *     exported by ordinal | 
|---|
| 358 | */ | 
|---|
| 359 | ODINFUNCTION1(LPVOID, SHAlloc, | 
|---|
| 360 | DWORD, len) | 
|---|
| 361 | { | 
|---|
| 362 | LPBYTE ret; | 
|---|
| 363 |  | 
|---|
| 364 | #if MEM_DEBUG | 
|---|
| 365 | ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len+6); | 
|---|
| 366 | #else | 
|---|
| 367 | ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len); | 
|---|
| 368 | #endif | 
|---|
| 369 |  | 
|---|
| 370 | #if MEM_DEBUG | 
|---|
| 371 | *(LPWORD)(ret) = 0x8271; | 
|---|
| 372 | *(LPWORD)(ret+2) = (WORD)len; | 
|---|
| 373 | *(LPWORD)(ret+4+len) = 0x7384; | 
|---|
| 374 | ret += 4; | 
|---|
| 375 | memset(ret, 0xdf, len); | 
|---|
| 376 | #endif | 
|---|
| 377 | TRACE("%lu bytes at %p\n",len, ret); | 
|---|
| 378 | return (LPVOID)ret; | 
|---|
| 379 | } | 
|---|
| 380 |  | 
|---|
| 381 | /************************************************************************* | 
|---|
| 382 | * SHRegisterDragDrop                           [SHELL32.86] | 
|---|
| 383 | * | 
|---|
| 384 | * NOTES | 
|---|
| 385 | *     exported by ordinal | 
|---|
| 386 | */ | 
|---|
| 387 | HRESULT WINAPI SHRegisterDragDrop( | 
|---|
| 388 | HWND hWnd, | 
|---|
| 389 | LPDROPTARGET pDropTarget) | 
|---|
| 390 | { | 
|---|
| 391 | FIXME("(0x%08x,%p):stub.\n", hWnd, pDropTarget); | 
|---|
| 392 | if (GetShellOle()) return pRegisterDragDrop(hWnd, pDropTarget); | 
|---|
| 393 | return 0; | 
|---|
| 394 | } | 
|---|
| 395 |  | 
|---|
| 396 | /************************************************************************* | 
|---|
| 397 | * SHRevokeDragDrop                             [SHELL32.87] | 
|---|
| 398 | * | 
|---|
| 399 | * NOTES | 
|---|
| 400 | *     exported by ordinal | 
|---|
| 401 | */ | 
|---|
| 402 | HRESULT WINAPI SHRevokeDragDrop(HWND hWnd) | 
|---|
| 403 | { | 
|---|
| 404 | FIXME("(0x%08x):stub.\n",hWnd); | 
|---|
| 405 | return 0; | 
|---|
| 406 | } | 
|---|
| 407 |  | 
|---|
| 408 | /************************************************************************* | 
|---|
| 409 | * SHDoDragDrop                                 [SHELL32.88] | 
|---|
| 410 | * | 
|---|
| 411 | * NOTES | 
|---|
| 412 | *     exported by ordinal | 
|---|
| 413 | */ | 
|---|
| 414 | HRESULT WINAPI SHDoDragDrop( | 
|---|
| 415 | HWND hWnd, | 
|---|
| 416 | LPDATAOBJECT lpDataObject, | 
|---|
| 417 | LPDROPSOURCE lpDropSource, | 
|---|
| 418 | DWORD dwOKEffect, | 
|---|
| 419 | LPDWORD pdwEffect) | 
|---|
| 420 | { | 
|---|
| 421 | FIXME("(0x%04x %p %p 0x%08lx %p):stub.\n", | 
|---|
| 422 | hWnd, lpDataObject, lpDropSource, dwOKEffect, pdwEffect); | 
|---|
| 423 | return 0; | 
|---|
| 424 | } | 
|---|
| 425 |  | 
|---|
| 426 | /************************************************************************* | 
|---|
| 427 | * ArrangeWindows                               [SHELL32.184] | 
|---|
| 428 | * | 
|---|
| 429 | */ | 
|---|
| 430 | WORD WINAPI ArrangeWindows( | 
|---|
| 431 | HWND hwndParent, | 
|---|
| 432 | DWORD dwReserved, | 
|---|
| 433 | LPCRECT lpRect, | 
|---|
| 434 | WORD cKids, | 
|---|
| 435 | CONST HWND * lpKids) | 
|---|
| 436 | { | 
|---|
| 437 | FIXME("(0x%08x 0x%08lx %p 0x%04x %p):stub.\n", | 
|---|
| 438 | hwndParent, dwReserved, lpRect, cKids, lpKids); | 
|---|
| 439 | return 0; | 
|---|
| 440 | } | 
|---|
| 441 |  | 
|---|
| 442 | /************************************************************************* | 
|---|
| 443 | * SignalFileOpen                               [SHELL32.103] | 
|---|
| 444 | * | 
|---|
| 445 | * NOTES | 
|---|
| 446 | *     exported by ordinal | 
|---|
| 447 | */ | 
|---|
| 448 | DWORD WINAPI | 
|---|
| 449 | SignalFileOpen (DWORD dwParam1) | 
|---|
| 450 | { | 
|---|
| 451 | FIXME("(0x%08lx):stub.\n", dwParam1); | 
|---|
| 452 |  | 
|---|
| 453 | return 0; | 
|---|
| 454 | } | 
|---|
| 455 |  | 
|---|
| 456 | /************************************************************************* | 
|---|
| 457 | * SHADD_get_policy - helper function for SHAddToRecentDocs | 
|---|
| 458 | * | 
|---|
| 459 | * PARAMETERS | 
|---|
| 460 | *   policy    [IN]  policy name (null termed string) to find | 
|---|
| 461 | *   type      [OUT] ptr to DWORD to receive type | 
|---|
| 462 | *   buffer    [OUT] ptr to area to hold data retrieved | 
|---|
| 463 | *   len       [IN/OUT] ptr to DWORD holding size of buffer and getting | 
|---|
| 464 | *                      length filled | 
|---|
| 465 | * | 
|---|
| 466 | * RETURNS | 
|---|
| 467 | *   result of the SHQueryValueEx call | 
|---|
| 468 | */ | 
|---|
| 469 | static INT SHADD_get_policy(LPSTR policy, LPDWORD type, LPVOID buffer, LPDWORD len) | 
|---|
| 470 | { | 
|---|
| 471 | HKEY Policy_basekey; | 
|---|
| 472 | INT ret; | 
|---|
| 473 |  | 
|---|
| 474 | /* Get the key for the policies location in the registry | 
|---|
| 475 | */ | 
|---|
| 476 | if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, | 
|---|
| 477 | "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", | 
|---|
| 478 | 0, KEY_READ, &Policy_basekey)) { | 
|---|
| 479 |  | 
|---|
| 480 | if (RegOpenKeyExA(HKEY_CURRENT_USER, | 
|---|
| 481 | "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", | 
|---|
| 482 | 0, KEY_READ, &Policy_basekey)) { | 
|---|
| 483 | TRACE("No Explorer Policies location exists. Policy wanted=%s\n", | 
|---|
| 484 | policy); | 
|---|
| 485 | *len = 0; | 
|---|
| 486 | return ERROR_FILE_NOT_FOUND; | 
|---|
| 487 | } | 
|---|
| 488 | } | 
|---|
| 489 |  | 
|---|
| 490 | /* Retrieve the data if it exists | 
|---|
| 491 | */ | 
|---|
| 492 | ret = SHQueryValueExA(Policy_basekey, policy, 0, type, buffer, len); | 
|---|
| 493 | RegCloseKey(Policy_basekey); | 
|---|
| 494 | return ret; | 
|---|
| 495 | } | 
|---|
| 496 |  | 
|---|
| 497 |  | 
|---|
| 498 | /************************************************************************* | 
|---|
| 499 | * SHADD_compare_mru - helper function for SHAddToRecentDocs | 
|---|
| 500 | * | 
|---|
| 501 | * PARAMETERS | 
|---|
| 502 | *   data1     [IN] data being looked for | 
|---|
| 503 | *   data2     [IN] data in MRU | 
|---|
| 504 | *   cbdata    [IN] length from FindMRUData call (not used) | 
|---|
| 505 | * | 
|---|
| 506 | * RETURNS | 
|---|
| 507 | *   position within MRU list that data was added. | 
|---|
| 508 | */ | 
|---|
| 509 | static INT CALLBACK SHADD_compare_mru(LPCVOID data1, LPCVOID data2, DWORD cbData) | 
|---|
| 510 | { | 
|---|
| 511 | return lstrcmpiA(data1, data2); | 
|---|
| 512 | } | 
|---|
| 513 |  | 
|---|
| 514 | /************************************************************************* | 
|---|
| 515 | * SHADD_create_add_mru_data - helper function for SHAddToRecentDocs | 
|---|
| 516 | * | 
|---|
| 517 | * PARAMETERS | 
|---|
| 518 | *   mruhandle    [IN] handle for created MRU list | 
|---|
| 519 | *   doc_name     [IN] null termed pure doc name | 
|---|
| 520 | *   new_lnk_name [IN] null termed path and file name for .lnk file | 
|---|
| 521 | *   buffer       [IN/OUT] 2048 byte area to consturct MRU data | 
|---|
| 522 | *   len          [OUT] ptr to int to receive space used in buffer | 
|---|
| 523 | * | 
|---|
| 524 | * RETURNS | 
|---|
| 525 | *   position within MRU list that data was added. | 
|---|
| 526 | */ | 
|---|
| 527 | static INT SHADD_create_add_mru_data(HANDLE mruhandle, LPSTR doc_name, LPSTR new_lnk_name, | 
|---|
| 528 | LPSTR buffer, INT *len) | 
|---|
| 529 | { | 
|---|
| 530 | LPSTR ptr; | 
|---|
| 531 | INT wlen; | 
|---|
| 532 |  | 
|---|
| 533 | /*FIXME: Document: | 
|---|
| 534 | *  RecentDocs MRU data structure seems to be: | 
|---|
| 535 | *    +0h   document file name w/ terminating 0h | 
|---|
| 536 | *    +nh   short int w/ size of remaining | 
|---|
| 537 | *    +n+2h 02h 30h, or 01h 30h, or 00h 30h  -  unknown | 
|---|
| 538 | *    +n+4h 10 bytes zeros  -   unknown | 
|---|
| 539 | *    +n+eh shortcut file name w/ terminating 0h | 
|---|
| 540 | *    +n+e+nh 3 zero bytes  -  unknown | 
|---|
| 541 | */ | 
|---|
| 542 |  | 
|---|
| 543 | /* Create the MRU data structure for "RecentDocs" | 
|---|
| 544 | */ | 
|---|
| 545 | ptr = buffer; | 
|---|
| 546 | lstrcpyA(ptr, doc_name); | 
|---|
| 547 | ptr += (lstrlenA(buffer) + 1); | 
|---|
| 548 | wlen= lstrlenA(new_lnk_name) + 1 + 12; | 
|---|
| 549 | *((short int*)ptr) = wlen; | 
|---|
| 550 | ptr += 2;   /* step past the length */ | 
|---|
| 551 | *(ptr++) = 0x30;  /* unknown reason */ | 
|---|
| 552 | *(ptr++) = 0;     /* unknown, but can be 0x00, 0x01, 0x02 */ | 
|---|
| 553 | memset(ptr, 0, 10); | 
|---|
| 554 | ptr += 10; | 
|---|
| 555 | lstrcpyA(ptr, new_lnk_name); | 
|---|
| 556 | ptr += (lstrlenA(new_lnk_name) + 1); | 
|---|
| 557 | memset(ptr, 0, 3); | 
|---|
| 558 | ptr += 3; | 
|---|
| 559 | *len = ptr - buffer; | 
|---|
| 560 |  | 
|---|
| 561 | /* Add the new entry into the MRU list | 
|---|
| 562 | */ | 
|---|
| 563 | return pAddMRUData(mruhandle, (LPCVOID)buffer, *len); | 
|---|
| 564 | } | 
|---|
| 565 |  | 
|---|
| 566 | /************************************************************************* | 
|---|
| 567 | * SHAddToRecentDocs                            [SHELL32.@] | 
|---|
| 568 | * | 
|---|
| 569 | * PARAMETERS | 
|---|
| 570 | *   uFlags  [IN] SHARD_PATH or SHARD_PIDL | 
|---|
| 571 | *   pv      [IN] string or pidl, NULL clears the list | 
|---|
| 572 | * | 
|---|
| 573 | * NOTES | 
|---|
| 574 | *     exported by name | 
|---|
| 575 | * | 
|---|
| 576 | * FIXME: ?? MSDN shows this as a VOID | 
|---|
| 577 | */ | 
|---|
| 578 | DWORD WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv) | 
|---|
| 579 | { | 
|---|
| 580 |  | 
|---|
| 581 | #ifndef __WIN32OS2__ | 
|---|
| 582 | /* FIXME: !!! move CREATEMRULIST and flags to header file !!! */ | 
|---|
| 583 | /*        !!! it is in both here and comctl32undoc.c      !!! */ | 
|---|
| 584 | typedef struct tagCREATEMRULIST | 
|---|
| 585 | { | 
|---|
| 586 | DWORD  cbSize;        /* size of struct */ | 
|---|
| 587 | DWORD  nMaxItems;     /* max no. of items in list */ | 
|---|
| 588 | DWORD  dwFlags;       /* see below */ | 
|---|
| 589 | HKEY   hKey;          /* root reg. key under which list is saved */ | 
|---|
| 590 | LPCSTR lpszSubKey;    /* reg. subkey */ | 
|---|
| 591 | PROC   lpfnCompare;   /* item compare proc */ | 
|---|
| 592 | } CREATEMRULIST, *LPCREATEMRULIST; | 
|---|
| 593 |  | 
|---|
| 594 | /* dwFlags */ | 
|---|
| 595 | #define MRUF_STRING_LIST  0 /* list will contain strings */ | 
|---|
| 596 | #define MRUF_BINARY_LIST  1 /* list will contain binary data */ | 
|---|
| 597 | #define MRUF_DELAYED_SAVE 2 /* only save list order to reg. is FreeMRUList */ | 
|---|
| 598 |  | 
|---|
| 599 | /* If list is a string list lpfnCompare has the following prototype | 
|---|
| 600 | * int CALLBACK MRUCompareString(LPCSTR s1, LPCSTR s2) | 
|---|
| 601 | * for binary lists the prototype is | 
|---|
| 602 | * int CALLBACK MRUCompareBinary(LPCVOID data1, LPCVOID data2, DWORD cbData) | 
|---|
| 603 | * where cbData is the no. of bytes to compare. | 
|---|
| 604 | * Need to check what return value means identical - 0? | 
|---|
| 605 | */ | 
|---|
| 606 | #endif | 
|---|
| 607 |  | 
|---|
| 608 | UINT olderrormode; | 
|---|
| 609 | HKEY HCUbasekey; | 
|---|
| 610 | CHAR doc_name[MAX_PATH]; | 
|---|
| 611 | CHAR link_dir[MAX_PATH]; | 
|---|
| 612 | CHAR new_lnk_filepath[MAX_PATH]; | 
|---|
| 613 | CHAR new_lnk_name[MAX_PATH]; | 
|---|
| 614 | IMalloc *ppM; | 
|---|
| 615 | LPITEMIDLIST pidl; | 
|---|
| 616 | HWND hwnd = 0;       /* FIXME:  get real window handle */ | 
|---|
| 617 | INT ret; | 
|---|
| 618 | DWORD data[64], datalen, type; | 
|---|
| 619 |  | 
|---|
| 620 | /*FIXME: Document: | 
|---|
| 621 | *  RecentDocs MRU data structure seems to be: | 
|---|
| 622 | *    +0h   document file name w/ terminating 0h | 
|---|
| 623 | *    +nh   short int w/ size of remaining | 
|---|
| 624 | *    +n+2h 02h 30h, or 01h 30h, or 00h 30h  -  unknown | 
|---|
| 625 | *    +n+4h 10 bytes zeros  -   unknown | 
|---|
| 626 | *    +n+eh shortcut file name w/ terminating 0h | 
|---|
| 627 | *    +n+e+nh 3 zero bytes  -  unknown | 
|---|
| 628 | */ | 
|---|
| 629 |  | 
|---|
| 630 | /* See if we need to do anything. | 
|---|
| 631 | */ | 
|---|
| 632 | datalen = 64; | 
|---|
| 633 | ret=SHADD_get_policy( "NoRecentDocsHistory", &type, &data, &datalen); | 
|---|
| 634 | if ((ret > 0) && (ret != ERROR_FILE_NOT_FOUND)) { | 
|---|
| 635 | ERR("Error %d getting policy \"NoRecentDocsHistory\"\n", ret); | 
|---|
| 636 | return 0; | 
|---|
| 637 | } | 
|---|
| 638 | if (ret == ERROR_SUCCESS) { | 
|---|
| 639 | if (!( (type == REG_DWORD) || | 
|---|
| 640 | ((type == REG_BINARY) && (datalen == 4)) )) { | 
|---|
| 641 | ERR("Error policy data for \"NoRecentDocsHistory\" not formated correctly, type=%ld, len=%ld\n", | 
|---|
| 642 | type, datalen); | 
|---|
| 643 | return 0; | 
|---|
| 644 | } | 
|---|
| 645 |  | 
|---|
| 646 | TRACE("policy value for NoRecentDocsHistory = %08lx\n", data[0]); | 
|---|
| 647 | /* now test the actual policy value */ | 
|---|
| 648 | if ( data[0] != 0) | 
|---|
| 649 | return 0; | 
|---|
| 650 | } | 
|---|
| 651 |  | 
|---|
| 652 | /* Open key to where the necessary info is | 
|---|
| 653 | */ | 
|---|
| 654 | /* FIXME: This should be done during DLL PROCESS_ATTACH (or THREAD_ATTACH) | 
|---|
| 655 | *        and the close should be done during the _DETACH. The resulting | 
|---|
| 656 | *        key is stored in the DLL global data. | 
|---|
| 657 | */ | 
|---|
| 658 | if (RegCreateKeyExA(HKEY_CURRENT_USER, | 
|---|
| 659 | "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer", | 
|---|
| 660 | 0, 0, 0, KEY_READ, 0, &HCUbasekey ,0)) { | 
|---|
| 661 | ERR("Failed to create 'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer'\n"); | 
|---|
| 662 | return 0; | 
|---|
| 663 | } | 
|---|
| 664 |  | 
|---|
| 665 | /* Get path to user's "Recent" directory | 
|---|
| 666 | */ | 
|---|
| 667 | if(SUCCEEDED(SHGetMalloc(&ppM))) { | 
|---|
| 668 | if (SUCCEEDED(SHGetSpecialFolderLocation(hwnd, CSIDL_RECENT, | 
|---|
| 669 | &pidl))) { | 
|---|
| 670 | SHGetPathFromIDListA(pidl, link_dir); | 
|---|
| 671 | IMalloc_Free(ppM, pidl); | 
|---|
| 672 | } | 
|---|
| 673 | else { | 
|---|
| 674 | /* serious issues */ | 
|---|
| 675 | link_dir[0] = 0; | 
|---|
| 676 | ERR("serious issues 1\n"); | 
|---|
| 677 | } | 
|---|
| 678 | IMalloc_Release(ppM); | 
|---|
| 679 | } | 
|---|
| 680 | else { | 
|---|
| 681 | /* serious issues */ | 
|---|
| 682 | link_dir[0] = 0; | 
|---|
| 683 | ERR("serious issues 2\n"); | 
|---|
| 684 | } | 
|---|
| 685 | TRACE("Users Recent dir %s\n", link_dir); | 
|---|
| 686 |  | 
|---|
| 687 | /* If no input, then go clear the lists */ | 
|---|
| 688 | if (!pv) { | 
|---|
| 689 | /* clear user's Recent dir | 
|---|
| 690 | */ | 
|---|
| 691 |  | 
|---|
| 692 | /* FIXME: delete all files in "link_dir" | 
|---|
| 693 | * | 
|---|
| 694 | * while( more files ) { | 
|---|
| 695 | *    lstrcpyA(old_lnk_name, link_dir); | 
|---|
| 696 | *    PathAppendA(old_lnk_name, filenam); | 
|---|
| 697 | *    DeleteFileA(old_lnk_name); | 
|---|
| 698 | * } | 
|---|
| 699 | */ | 
|---|
| 700 | FIXME("should delete all files in %s\\ \n", link_dir); | 
|---|
| 701 |  | 
|---|
| 702 | /* clear MRU list | 
|---|
| 703 | */ | 
|---|
| 704 | /* MS Bug ?? v4.72.3612.1700 of shell32 does the delete against | 
|---|
| 705 | *  HKEY_LOCAL_MACHINE version of ...CurrentVersion\Explorer | 
|---|
| 706 | *  and naturally it fails w/ rc=2. It should do it against | 
|---|
| 707 | *  HKEY_CURRENT_USER which is where it is stored, and where | 
|---|
| 708 | *  the MRU routines expect it!!!! | 
|---|
| 709 | */ | 
|---|
| 710 | RegDeleteKeyA(HCUbasekey, "RecentDocs"); | 
|---|
| 711 | RegCloseKey(HCUbasekey); | 
|---|
| 712 | return 0; | 
|---|
| 713 | } | 
|---|
| 714 |  | 
|---|
| 715 | /* Have data to add, the jobs to be done: | 
|---|
| 716 | *   1. Add document to MRU list in registry "HKCU\Software\ | 
|---|
| 717 | *      Microsoft\Windows\CurrentVersion\Explorer\RecentDocs". | 
|---|
| 718 | *   2. Add shortcut to document in the user's Recent directory | 
|---|
| 719 | *      (CSIDL_RECENT). | 
|---|
| 720 | *   3. Add shortcut to Start menu's Documents submenu. | 
|---|
| 721 | */ | 
|---|
| 722 |  | 
|---|
| 723 | /* Get the pure document name from the input | 
|---|
| 724 | */ | 
|---|
| 725 | if (uFlags & SHARD_PIDL) { | 
|---|
| 726 | SHGetPathFromIDListA((LPCITEMIDLIST) pv, doc_name); | 
|---|
| 727 | } | 
|---|
| 728 | else { | 
|---|
| 729 | lstrcpyA(doc_name, (LPSTR) pv); | 
|---|
| 730 | } | 
|---|
| 731 | TRACE("full document name %s\n", doc_name); | 
|---|
| 732 | PathStripPathA(doc_name);; | 
|---|
| 733 | TRACE("stripped document name %s\n", doc_name); | 
|---|
| 734 |  | 
|---|
| 735 |  | 
|---|
| 736 | /* ***  JOB 1: Update registry for ...\Explorer\RecentDocs list  *** */ | 
|---|
| 737 |  | 
|---|
| 738 | {  /* on input needs: | 
|---|
| 739 | *      doc_name    -  pure file-spec, no path | 
|---|
| 740 | *      link_dir    -  path to the user's Recent directory | 
|---|
| 741 | *      HCUbasekey  -  key of ...Windows\CurrentVersion\Explorer" node | 
|---|
| 742 | * creates: | 
|---|
| 743 | *      new_lnk_name-  pure file-spec, no path for new .lnk file | 
|---|
| 744 | *      new_lnk_filepath | 
|---|
| 745 | *                  -  path and file name of new .lnk file | 
|---|
| 746 | */ | 
|---|
| 747 | CREATEMRULIST mymru; | 
|---|
| 748 | HANDLE mruhandle; | 
|---|
| 749 | INT len, pos, bufused, err; | 
|---|
| 750 | INT i; | 
|---|
| 751 | DWORD attr; | 
|---|
| 752 | CHAR buffer[2048]; | 
|---|
| 753 | CHAR *ptr; | 
|---|
| 754 | CHAR old_lnk_name[MAX_PATH]; | 
|---|
| 755 | short int slen; | 
|---|
| 756 |  | 
|---|
| 757 | mymru.cbSize = sizeof(CREATEMRULIST); | 
|---|
| 758 | mymru.nMaxItems = 15; | 
|---|
| 759 | mymru.dwFlags = MRUF_BINARY_LIST | MRUF_DELAYED_SAVE; | 
|---|
| 760 | mymru.hKey = HCUbasekey; | 
|---|
| 761 | mymru.lpszSubKey = "RecentDocs"; | 
|---|
| 762 | mymru.lpfnCompare = &SHADD_compare_mru; | 
|---|
| 763 | mruhandle = pCreateMRUListA(&mymru); | 
|---|
| 764 | if (!mruhandle) { | 
|---|
| 765 | /* MRU failed */ | 
|---|
| 766 | ERR("MRU processing failed, handle zero\n"); | 
|---|
| 767 | RegCloseKey(HCUbasekey); | 
|---|
| 768 | return 0; | 
|---|
| 769 | } | 
|---|
| 770 | len = lstrlenA(doc_name); | 
|---|
| 771 | pos = pFindMRUData(mruhandle, doc_name, len, 0); | 
|---|
| 772 |  | 
|---|
| 773 | /* Now get the MRU entry that will be replaced | 
|---|
| 774 | * and delete the .lnk file for it | 
|---|
| 775 | */ | 
|---|
| 776 | if ((bufused = pEnumMRUListA(mruhandle, (pos == -1) ? 14 : pos, | 
|---|
| 777 | buffer, 2048)) != -1) { | 
|---|
| 778 | ptr = buffer; | 
|---|
| 779 | ptr += (lstrlenA(buffer) + 1); | 
|---|
| 780 | slen = *((short int*)ptr); | 
|---|
| 781 | ptr += 2;  /* skip the length area */ | 
|---|
| 782 | if (bufused >= slen + (ptr-buffer)) { | 
|---|
| 783 | /* buffer size looks good */ | 
|---|
| 784 | ptr += 12; /* get to string */ | 
|---|
| 785 | len = bufused - (ptr-buffer);  /* get length of buf remaining */ | 
|---|
| 786 | if ((lstrlenA(ptr) > 0) && (lstrlenA(ptr) <= len-1)) { | 
|---|
| 787 | /* appears to be good string */ | 
|---|
| 788 | lstrcpyA(old_lnk_name, link_dir); | 
|---|
| 789 | PathAppendA(old_lnk_name, ptr); | 
|---|
| 790 | if (!DeleteFileA(old_lnk_name)) { | 
|---|
| 791 | if ((attr = GetFileAttributesA(old_lnk_name)) == -1) { | 
|---|
| 792 | if ((err = GetLastError()) != ERROR_FILE_NOT_FOUND) { | 
|---|
| 793 | ERR("Delete for %s failed, err=%d, attr=%08lx\n", | 
|---|
| 794 | old_lnk_name, err, attr); | 
|---|
| 795 | } | 
|---|
| 796 | else { | 
|---|
| 797 | TRACE("old .lnk file %s did not exist\n", | 
|---|
| 798 | old_lnk_name); | 
|---|
| 799 | } | 
|---|
| 800 | } | 
|---|
| 801 | else { | 
|---|
| 802 | ERR("Delete for %s failed, attr=%08lx\n", | 
|---|
| 803 | old_lnk_name, attr); | 
|---|
| 804 | } | 
|---|
| 805 | } | 
|---|
| 806 | else { | 
|---|
| 807 | TRACE("deleted old .lnk file %s\n", old_lnk_name); | 
|---|
| 808 | } | 
|---|
| 809 | } | 
|---|
| 810 | } | 
|---|
| 811 | } | 
|---|
| 812 |  | 
|---|
| 813 | /* Create usable .lnk file name for the "Recent" directory | 
|---|
| 814 | */ | 
|---|
| 815 | wsprintfA(new_lnk_name, "%s.lnk", doc_name); | 
|---|
| 816 | lstrcpyA(new_lnk_filepath, link_dir); | 
|---|
| 817 | PathAppendA(new_lnk_filepath, new_lnk_name); | 
|---|
| 818 | i = 1; | 
|---|
| 819 | olderrormode = SetErrorMode(SEM_FAILCRITICALERRORS); | 
|---|
| 820 | while (GetFileAttributesA(new_lnk_filepath) != -1) { | 
|---|
| 821 | i++; | 
|---|
| 822 | wsprintfA(new_lnk_name, "%s (%u).lnk", doc_name, i); | 
|---|
| 823 | lstrcpyA(new_lnk_filepath, link_dir); | 
|---|
| 824 | PathAppendA(new_lnk_filepath, new_lnk_name); | 
|---|
| 825 | } | 
|---|
| 826 | SetErrorMode(olderrormode); | 
|---|
| 827 | TRACE("new shortcut will be %s\n", new_lnk_filepath); | 
|---|
| 828 |  | 
|---|
| 829 | /* Now add the new MRU entry and data | 
|---|
| 830 | */ | 
|---|
| 831 | pos = SHADD_create_add_mru_data(mruhandle, doc_name, new_lnk_name, | 
|---|
| 832 | buffer, &len); | 
|---|
| 833 | pFreeMRUListA(mruhandle); | 
|---|
| 834 | TRACE("Updated MRU list, new doc is position %d\n", pos); | 
|---|
| 835 | } | 
|---|
| 836 |  | 
|---|
| 837 | /* ***  JOB 2: Create shortcut in user's "Recent" directory  *** */ | 
|---|
| 838 |  | 
|---|
| 839 | {  /* on input needs: | 
|---|
| 840 | *      doc_name    -  pure file-spec, no path | 
|---|
| 841 | *      new_lnk_filepath | 
|---|
| 842 | *                  -  path and file name of new .lnk file | 
|---|
| 843 | *      uFlags[in]  -  flags on call to SHAddToRecentDocs | 
|---|
| 844 | *      pv[in]      -  document path/pidl on call to SHAddToRecentDocs | 
|---|
| 845 | */ | 
|---|
| 846 | IShellLinkA *psl = NULL; | 
|---|
| 847 | IPersistFile *pPf = NULL; | 
|---|
| 848 | HRESULT hres; | 
|---|
| 849 | CHAR desc[MAX_PATH]; | 
|---|
| 850 | WCHAR widelink[MAX_PATH]; | 
|---|
| 851 |  | 
|---|
| 852 | CoInitialize(0); | 
|---|
| 853 |  | 
|---|
| 854 | hres = CoCreateInstance( &CLSID_ShellLink, | 
|---|
| 855 | NULL, | 
|---|
| 856 | CLSCTX_INPROC_SERVER, | 
|---|
| 857 | &IID_IShellLinkA, | 
|---|
| 858 | (LPVOID )&psl); | 
|---|
| 859 | if(SUCCEEDED(hres)) { | 
|---|
| 860 |  | 
|---|
| 861 | hres = IShellLinkA_QueryInterface(psl, &IID_IPersistFile, | 
|---|
| 862 | (LPVOID *)&pPf); | 
|---|
| 863 | if(FAILED(hres)) { | 
|---|
| 864 | /* bombed */ | 
|---|
| 865 | ERR("failed QueryInterface for IPersistFile %08lx\n", hres); | 
|---|
| 866 | goto fail; | 
|---|
| 867 | } | 
|---|
| 868 |  | 
|---|
| 869 | /* Set the document path or pidl */ | 
|---|
| 870 | if (uFlags & SHARD_PIDL) { | 
|---|
| 871 | hres = IShellLinkA_SetIDList(psl, (LPCITEMIDLIST) pv); | 
|---|
| 872 | } else { | 
|---|
| 873 | hres = IShellLinkA_SetPath(psl, (LPCSTR) pv); | 
|---|
| 874 | } | 
|---|
| 875 | if(FAILED(hres)) { | 
|---|
| 876 | /* bombed */ | 
|---|
| 877 | ERR("failed Set{IDList|Path} %08lx\n", hres); | 
|---|
| 878 | goto fail; | 
|---|
| 879 | } | 
|---|
| 880 |  | 
|---|
| 881 | lstrcpyA(desc, "Shortcut to "); | 
|---|
| 882 | lstrcatA(desc, doc_name); | 
|---|
| 883 | hres = IShellLinkA_SetDescription(psl, desc); | 
|---|
| 884 | if(FAILED(hres)) { | 
|---|
| 885 | /* bombed */ | 
|---|
| 886 | ERR("failed SetDescription %08lx\n", hres); | 
|---|
| 887 | goto fail; | 
|---|
| 888 | } | 
|---|
| 889 |  | 
|---|
| 890 | MultiByteToWideChar(CP_ACP, 0, new_lnk_filepath, -1, | 
|---|
| 891 | widelink, MAX_PATH); | 
|---|
| 892 | /* create the short cut */ | 
|---|
| 893 | hres = IPersistFile_Save(pPf, widelink, TRUE); | 
|---|
| 894 | if(FAILED(hres)) { | 
|---|
| 895 | /* bombed */ | 
|---|
| 896 | ERR("failed IPersistFile::Save %08lx\n", hres); | 
|---|
| 897 | IPersistFile_Release(pPf); | 
|---|
| 898 | IShellLinkA_Release(psl); | 
|---|
| 899 | goto fail; | 
|---|
| 900 | } | 
|---|
| 901 | hres = IPersistFile_SaveCompleted(pPf, widelink); | 
|---|
| 902 | IPersistFile_Release(pPf); | 
|---|
| 903 | IShellLinkA_Release(psl); | 
|---|
| 904 | TRACE("shortcut %s has been created, result=%08lx\n", | 
|---|
| 905 | new_lnk_filepath, hres); | 
|---|
| 906 | } | 
|---|
| 907 | else { | 
|---|
| 908 | ERR("CoCreateInstance failed, hres=%08lx\n", hres); | 
|---|
| 909 | } | 
|---|
| 910 | } | 
|---|
| 911 |  | 
|---|
| 912 | fail: | 
|---|
| 913 | CoUninitialize(); | 
|---|
| 914 |  | 
|---|
| 915 | /* all done */ | 
|---|
| 916 | RegCloseKey(HCUbasekey); | 
|---|
| 917 | return 0; | 
|---|
| 918 | } | 
|---|
| 919 |  | 
|---|
| 920 | /************************************************************************* | 
|---|
| 921 | * SHCreateShellFolderViewEx                    [SHELL32.174] | 
|---|
| 922 | * | 
|---|
| 923 | * NOTES | 
|---|
| 924 | *  see IShellFolder::CreateViewObject | 
|---|
| 925 | */ | 
|---|
| 926 | HRESULT WINAPI SHCreateShellFolderViewEx( | 
|---|
| 927 | LPCSHELLFOLDERVIEWINFO psvcbi, /* [in] shelltemplate struct */ | 
|---|
| 928 | LPSHELLVIEW* ppv)              /* [out] IShellView pointer */ | 
|---|
| 929 | { | 
|---|
| 930 | IShellView * psf; | 
|---|
| 931 | HRESULT hRes; | 
|---|
| 932 |  | 
|---|
| 933 | TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=0x%08lx\n", | 
|---|
| 934 | psvcbi->pshf, psvcbi->pidlFolder, psvcbi->lpfnCallback, | 
|---|
| 935 | psvcbi->uViewMode, psvcbi->dwUser); | 
|---|
| 936 |  | 
|---|
| 937 | psf = IShellView_Constructor(psvcbi->pshf); | 
|---|
| 938 |  | 
|---|
| 939 | if (!psf) | 
|---|
| 940 | return E_OUTOFMEMORY; | 
|---|
| 941 |  | 
|---|
| 942 | IShellView_AddRef(psf); | 
|---|
| 943 | hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv); | 
|---|
| 944 | IShellView_Release(psf); | 
|---|
| 945 |  | 
|---|
| 946 | return hRes; | 
|---|
| 947 | } | 
|---|
| 948 | /************************************************************************* | 
|---|
| 949 | *  SHWinHelp                                   [SHELL32.127] | 
|---|
| 950 | * | 
|---|
| 951 | */ | 
|---|
| 952 | HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z) | 
|---|
| 953 | {       FIXME("0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v,w,x,z); | 
|---|
| 954 | return 0; | 
|---|
| 955 | } | 
|---|
| 956 | /************************************************************************* | 
|---|
| 957 | *  SHRunControlPanel [SHELL32.161] | 
|---|
| 958 | * | 
|---|
| 959 | */ | 
|---|
| 960 | HRESULT WINAPI SHRunControlPanel (DWORD x, DWORD z) | 
|---|
| 961 | {       FIXME("0x%08lx 0x%08lx stub\n",x,z); | 
|---|
| 962 | return 0; | 
|---|
| 963 | } | 
|---|
| 964 | /************************************************************************* | 
|---|
| 965 | * ShellExecuteEx                               [SHELL32.291] | 
|---|
| 966 | * | 
|---|
| 967 | */ | 
|---|
| 968 | BOOL WINAPI ShellExecuteExAW (LPVOID sei) | 
|---|
| 969 | {       if (SHELL_OsIsUnicode()) | 
|---|
| 970 | return ShellExecuteExW (sei); | 
|---|
| 971 | return ShellExecuteExA (sei); | 
|---|
| 972 | } | 
|---|
| 973 | /************************************************************************* | 
|---|
| 974 | * ShellExecuteExA                              [SHELL32.292] | 
|---|
| 975 | * | 
|---|
| 976 | * placeholder in the commandline: | 
|---|
| 977 | *      %1 file | 
|---|
| 978 | *      %2 printer | 
|---|
| 979 | *      %3 driver | 
|---|
| 980 | *      %4 port | 
|---|
| 981 | *      %I adress of a global item ID (explorer switch /idlist) | 
|---|
| 982 | *      %L ??? path/url/current file ??? | 
|---|
| 983 | *      %S ??? | 
|---|
| 984 | *      %* all following parameters (see batfile) | 
|---|
| 985 | */ | 
|---|
| 986 | BOOL WINAPI ShellExecuteExA (LPSHELLEXECUTEINFOA sei) | 
|---|
| 987 | {       CHAR szApplicationName[MAX_PATH],szCommandline[MAX_PATH],szPidl[20]; | 
|---|
| 988 | LPSTR pos; | 
|---|
| 989 | int gap, len; | 
|---|
| 990 | STARTUPINFOA  startup; | 
|---|
| 991 | PROCESS_INFORMATION info; | 
|---|
| 992 |  | 
|---|
| 993 | WARN("mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s incomplete\n", | 
|---|
| 994 | sei->fMask, sei->hwnd, sei->lpVerb, sei->lpFile, | 
|---|
| 995 | sei->lpParameters, sei->lpDirectory, sei->nShow, | 
|---|
| 996 | (sei->fMask & SEE_MASK_CLASSNAME) ? sei->lpClass : "not used"); | 
|---|
| 997 |  | 
|---|
| 998 | ZeroMemory(szApplicationName,MAX_PATH); | 
|---|
| 999 | if (sei->lpFile) | 
|---|
| 1000 | strcpy(szApplicationName, sei->lpFile); | 
|---|
| 1001 |  | 
|---|
| 1002 | ZeroMemory(szCommandline,MAX_PATH); | 
|---|
| 1003 | if (sei->lpParameters) | 
|---|
| 1004 | strcpy(szCommandline, sei->lpParameters); | 
|---|
| 1005 |  | 
|---|
| 1006 | if (sei->fMask & (SEE_MASK_CLASSKEY | SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY | | 
|---|
| 1007 | SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT | | 
|---|
| 1008 | SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI | SEE_MASK_UNICODE | | 
|---|
| 1009 | SEE_MASK_NO_CONSOLE | SEE_MASK_ASYNCOK | SEE_MASK_HMONITOR )) | 
|---|
| 1010 | { | 
|---|
| 1011 | FIXME("flags ignored: 0x%08lx\n", sei->fMask); | 
|---|
| 1012 | } | 
|---|
| 1013 |  | 
|---|
| 1014 | /* launch a document by fileclass like 'Wordpad.Document.1' */ | 
|---|
| 1015 | if (sei->fMask & SEE_MASK_CLASSNAME) | 
|---|
| 1016 | { | 
|---|
| 1017 | /* FIXME: szCommandline should not be of a fixed size. Plus MAX_PATH is way too short! */ | 
|---|
| 1018 | /* the commandline contains 'c:\Path\wordpad.exe "%1"' */ | 
|---|
| 1019 | HCR_GetExecuteCommand(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, sizeof(szCommandline)); | 
|---|
| 1020 | /* fixme: get the extension of lpFile, check if it fits to the lpClass */ | 
|---|
| 1021 | TRACE("SEE_MASK_CLASSNAME->'%s'\n", szCommandline); | 
|---|
| 1022 | } | 
|---|
| 1023 |  | 
|---|
| 1024 | /* process the IDList */ | 
|---|
| 1025 | if ( (sei->fMask & SEE_MASK_INVOKEIDLIST) == SEE_MASK_INVOKEIDLIST) /*0x0c*/ | 
|---|
| 1026 | { | 
|---|
| 1027 | SHGetPathFromIDListA (sei->lpIDList,szApplicationName); | 
|---|
| 1028 | TRACE("-- idlist=%p (%s)\n", sei->lpIDList, szApplicationName); | 
|---|
| 1029 | } | 
|---|
| 1030 | else | 
|---|
| 1031 | { | 
|---|
| 1032 | if (sei->fMask & SEE_MASK_IDLIST ) | 
|---|
| 1033 | { | 
|---|
| 1034 | pos = strstr(szCommandline, "%I"); | 
|---|
| 1035 | if (pos) | 
|---|
| 1036 | { | 
|---|
| 1037 | LPVOID pv; | 
|---|
| 1038 | HGLOBAL hmem = SHAllocShared ( sei->lpIDList, ILGetSize(sei->lpIDList), 0); | 
|---|
| 1039 | pv = SHLockShared(hmem,0); | 
|---|
| 1040 | sprintf(szPidl,":%p",pv ); | 
|---|
| 1041 | SHUnlockShared(pv); | 
|---|
| 1042 |  | 
|---|
| 1043 | gap = strlen(szPidl); | 
|---|
| 1044 | len = strlen(pos)-2; | 
|---|
| 1045 | memmove(pos+gap,pos+2,len); | 
|---|
| 1046 | memcpy(pos,szPidl,gap); | 
|---|
| 1047 |  | 
|---|
| 1048 | } | 
|---|
| 1049 | } | 
|---|
| 1050 | } | 
|---|
| 1051 |  | 
|---|
| 1052 | TRACE("execute:'%s','%s'\n",szApplicationName, szCommandline); | 
|---|
| 1053 |  | 
|---|
| 1054 | strcat(szApplicationName, " "); | 
|---|
| 1055 | strcat(szApplicationName, szCommandline); | 
|---|
| 1056 |  | 
|---|
| 1057 | ZeroMemory(&startup,sizeof(STARTUPINFOA)); | 
|---|
| 1058 | startup.cb = sizeof(STARTUPINFOA); | 
|---|
| 1059 |  | 
|---|
| 1060 | if (! CreateProcessA(NULL, szApplicationName, | 
|---|
| 1061 | NULL, NULL, FALSE, 0, | 
|---|
| 1062 | NULL, NULL, &startup, &info)) | 
|---|
| 1063 | { | 
|---|
| 1064 | sei->hInstApp = GetLastError(); | 
|---|
| 1065 | return FALSE; | 
|---|
| 1066 | } | 
|---|
| 1067 |  | 
|---|
| 1068 | sei->hInstApp = 33; | 
|---|
| 1069 |  | 
|---|
| 1070 | /* Give 30 seconds to the app to come up */ | 
|---|
| 1071 | if ( WaitForInputIdle ( info.hProcess, 30000 ) ==  0xFFFFFFFF ) | 
|---|
| 1072 | ERR("WaitForInputIdle failed: Error %ld\n", GetLastError() ); | 
|---|
| 1073 |  | 
|---|
| 1074 | if(sei->fMask & SEE_MASK_NOCLOSEPROCESS) | 
|---|
| 1075 | sei->hProcess = info.hProcess; | 
|---|
| 1076 | else | 
|---|
| 1077 | CloseHandle( info.hProcess ); | 
|---|
| 1078 | CloseHandle( info.hThread ); | 
|---|
| 1079 | return TRUE; | 
|---|
| 1080 | } | 
|---|
| 1081 | /************************************************************************* | 
|---|
| 1082 | * ShellExecuteExW                              [SHELL32.293] | 
|---|
| 1083 | * | 
|---|
| 1084 | */ | 
|---|
| 1085 | BOOL WINAPI ShellExecuteExW (LPSHELLEXECUTEINFOW sei) | 
|---|
| 1086 | {       SHELLEXECUTEINFOA seiA; | 
|---|
| 1087 | DWORD ret; | 
|---|
| 1088 |  | 
|---|
| 1089 | TRACE("%p\n", sei); | 
|---|
| 1090 |  | 
|---|
| 1091 | memcpy(&seiA, sei, sizeof(SHELLEXECUTEINFOA)); | 
|---|
| 1092 |  | 
|---|
| 1093 | if (sei->lpVerb) | 
|---|
| 1094 | seiA.lpVerb = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpVerb); | 
|---|
| 1095 |  | 
|---|
| 1096 | if (sei->lpFile) | 
|---|
| 1097 | seiA.lpFile = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpFile); | 
|---|
| 1098 |  | 
|---|
| 1099 | if (sei->lpParameters) | 
|---|
| 1100 | seiA.lpParameters = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpParameters); | 
|---|
| 1101 |  | 
|---|
| 1102 | if (sei->lpDirectory) | 
|---|
| 1103 | seiA.lpDirectory = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpDirectory); | 
|---|
| 1104 |  | 
|---|
| 1105 | if ((sei->fMask & SEE_MASK_CLASSNAME) && sei->lpClass) | 
|---|
| 1106 | seiA.lpClass = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpClass); | 
|---|
| 1107 | else | 
|---|
| 1108 | seiA.lpClass = NULL; | 
|---|
| 1109 |  | 
|---|
| 1110 | ret = ShellExecuteExA(&seiA); | 
|---|
| 1111 |  | 
|---|
| 1112 | if (seiA.lpVerb)        HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpVerb ); | 
|---|
| 1113 | if (seiA.lpFile)        HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpFile ); | 
|---|
| 1114 | if (seiA.lpParameters)  HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpParameters ); | 
|---|
| 1115 | if (seiA.lpDirectory)   HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpDirectory ); | 
|---|
| 1116 | if (seiA.lpClass)       HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpClass ); | 
|---|
| 1117 |  | 
|---|
| 1118 | return ret; | 
|---|
| 1119 | } | 
|---|
| 1120 |  | 
|---|
| 1121 | static LPUNKNOWN SHELL32_IExplorerInterface=0; | 
|---|
| 1122 | /************************************************************************* | 
|---|
| 1123 | * SHSetInstanceExplorer                        [SHELL32.176] | 
|---|
| 1124 | * | 
|---|
| 1125 | * NOTES | 
|---|
| 1126 | *  Sets the interface | 
|---|
| 1127 | */ | 
|---|
| 1128 | HRESULT WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown) | 
|---|
| 1129 | {       TRACE("%p\n", lpUnknown); | 
|---|
| 1130 | SHELL32_IExplorerInterface = lpUnknown; | 
|---|
| 1131 | return (HRESULT) lpUnknown; | 
|---|
| 1132 | } | 
|---|
| 1133 | /************************************************************************* | 
|---|
| 1134 | * SHGetInstanceExplorer                        [SHELL32.@] | 
|---|
| 1135 | * | 
|---|
| 1136 | * NOTES | 
|---|
| 1137 | *  gets the interface pointer of the explorer and a reference | 
|---|
| 1138 | */ | 
|---|
| 1139 | HRESULT WINAPI SHGetInstanceExplorer (LPUNKNOWN * lpUnknown) | 
|---|
| 1140 | {       TRACE("%p\n", lpUnknown); | 
|---|
| 1141 |  | 
|---|
| 1142 | *lpUnknown = SHELL32_IExplorerInterface; | 
|---|
| 1143 |  | 
|---|
| 1144 | if (!SHELL32_IExplorerInterface) | 
|---|
| 1145 | return E_FAIL; | 
|---|
| 1146 |  | 
|---|
| 1147 | IUnknown_AddRef(SHELL32_IExplorerInterface); | 
|---|
| 1148 | return NOERROR; | 
|---|
| 1149 | } | 
|---|
| 1150 | /************************************************************************* | 
|---|
| 1151 | * SHFreeUnusedLibraries                        [SHELL32.123] | 
|---|
| 1152 | * | 
|---|
| 1153 | * NOTES | 
|---|
| 1154 | *  exported by name | 
|---|
| 1155 | */ | 
|---|
| 1156 | void WINAPI SHFreeUnusedLibraries (void) | 
|---|
| 1157 | { | 
|---|
| 1158 | FIXME("stub\n"); | 
|---|
| 1159 | } | 
|---|
| 1160 | /************************************************************************* | 
|---|
| 1161 | * DAD_SetDragImage                             [SHELL32.136] | 
|---|
| 1162 | * | 
|---|
| 1163 | * NOTES | 
|---|
| 1164 | *  exported by name | 
|---|
| 1165 | */ | 
|---|
| 1166 | BOOL WINAPI DAD_SetDragImage( | 
|---|
| 1167 | HIMAGELIST himlTrack, | 
|---|
| 1168 | LPPOINT lppt) | 
|---|
| 1169 | { | 
|---|
| 1170 | FIXME("%p %p stub\n",himlTrack, lppt); | 
|---|
| 1171 | return 0; | 
|---|
| 1172 | } | 
|---|
| 1173 | /************************************************************************* | 
|---|
| 1174 | * DAD_ShowDragImage                            [SHELL32.137] | 
|---|
| 1175 | * | 
|---|
| 1176 | * NOTES | 
|---|
| 1177 | *  exported by name | 
|---|
| 1178 | */ | 
|---|
| 1179 | BOOL WINAPI DAD_ShowDragImage(BOOL bShow) | 
|---|
| 1180 | { | 
|---|
| 1181 | FIXME("0x%08x stub\n",bShow); | 
|---|
| 1182 | return 0; | 
|---|
| 1183 | } | 
|---|
| 1184 | /************************************************************************* | 
|---|
| 1185 | * ReadCabinetState                             [SHELL32.651] NT 4.0 | 
|---|
| 1186 | * | 
|---|
| 1187 | */ | 
|---|
| 1188 | HRESULT WINAPI ReadCabinetState(DWORD u, DWORD v) | 
|---|
| 1189 | {       FIXME("0x%04lx 0x%04lx stub\n",u,v); | 
|---|
| 1190 | return 0; | 
|---|
| 1191 | } | 
|---|
| 1192 | /************************************************************************* | 
|---|
| 1193 | * WriteCabinetState                            [SHELL32.652] NT 4.0 | 
|---|
| 1194 | * | 
|---|
| 1195 | */ | 
|---|
| 1196 | HRESULT WINAPI WriteCabinetState(DWORD u) | 
|---|
| 1197 | {       FIXME("0x%04lx stub\n",u); | 
|---|
| 1198 | return 0; | 
|---|
| 1199 | } | 
|---|
| 1200 | /************************************************************************* | 
|---|
| 1201 | * FileIconInit                                 [SHELL32.660] | 
|---|
| 1202 | * | 
|---|
| 1203 | */ | 
|---|
| 1204 | BOOL WINAPI FileIconInit(BOOL bFullInit) | 
|---|
| 1205 | {       FIXME("(%s)\n", bFullInit ? "true" : "false"); | 
|---|
| 1206 | return 0; | 
|---|
| 1207 | } | 
|---|
| 1208 | /************************************************************************* | 
|---|
| 1209 | * IsUserAdmin                                  [SHELL32.680] NT 4.0 | 
|---|
| 1210 | * | 
|---|
| 1211 | */ | 
|---|
| 1212 | HRESULT WINAPI IsUserAdmin(void) | 
|---|
| 1213 | {       FIXME("stub\n"); | 
|---|
| 1214 | return TRUE; | 
|---|
| 1215 | } | 
|---|
| 1216 |  | 
|---|
| 1217 | /************************************************************************* | 
|---|
| 1218 | * SHAllocShared                                [SHELL32.520] | 
|---|
| 1219 | * | 
|---|
| 1220 | * NOTES | 
|---|
| 1221 | *  parameter1 is return value from HeapAlloc | 
|---|
| 1222 | *  parameter2 is equal to the size allocated with HeapAlloc | 
|---|
| 1223 | *  parameter3 is return value from GetCurrentProcessId | 
|---|
| 1224 | * | 
|---|
| 1225 | *  the return value is posted as lParam with 0x402 (WM_USER+2) to somewhere | 
|---|
| 1226 | *  WM_USER+2 could be the undocumented CWM_SETPATH | 
|---|
| 1227 | *  the allocated memory contains a pidl | 
|---|
| 1228 | */ | 
|---|
| 1229 | HGLOBAL WINAPI SHAllocShared(LPVOID psrc, DWORD size, DWORD procID) | 
|---|
| 1230 | {       HGLOBAL hmem; | 
|---|
| 1231 | LPVOID pmem; | 
|---|
| 1232 |  | 
|---|
| 1233 | TRACE("ptr=%p size=0x%04lx procID=0x%04lx\n",psrc,size,procID); | 
|---|
| 1234 | hmem = GlobalAlloc(GMEM_FIXED, size); | 
|---|
| 1235 | if (!hmem) | 
|---|
| 1236 | return 0; | 
|---|
| 1237 |  | 
|---|
| 1238 | pmem =  GlobalLock (hmem); | 
|---|
| 1239 |  | 
|---|
| 1240 | if (! pmem) | 
|---|
| 1241 | return 0; | 
|---|
| 1242 |  | 
|---|
| 1243 | memcpy (pmem, psrc, size); | 
|---|
| 1244 | GlobalUnlock(hmem); | 
|---|
| 1245 | return hmem; | 
|---|
| 1246 | } | 
|---|
| 1247 | /************************************************************************* | 
|---|
| 1248 | * SHLockShared                                 [SHELL32.521] | 
|---|
| 1249 | * | 
|---|
| 1250 | * NOTES | 
|---|
| 1251 | *  parameter1 is return value from SHAllocShared | 
|---|
| 1252 | *  parameter2 is return value from GetCurrentProcessId | 
|---|
| 1253 | *  the receiver of (WM_USER+2) trys to lock the HANDLE (?) | 
|---|
| 1254 | *  the returnvalue seems to be a memoryadress | 
|---|
| 1255 | */ | 
|---|
| 1256 | LPVOID WINAPI SHLockShared(HANDLE hmem, DWORD procID) | 
|---|
| 1257 | {       TRACE("handle=0x%04x procID=0x%04lx\n",hmem,procID); | 
|---|
| 1258 | return GlobalLock(hmem); | 
|---|
| 1259 | } | 
|---|
| 1260 | /************************************************************************* | 
|---|
| 1261 | * SHUnlockShared                               [SHELL32.522] | 
|---|
| 1262 | * | 
|---|
| 1263 | * NOTES | 
|---|
| 1264 | *  parameter1 is return value from SHLockShared | 
|---|
| 1265 | */ | 
|---|
| 1266 | BOOL WINAPI SHUnlockShared(LPVOID pv) | 
|---|
| 1267 | { | 
|---|
| 1268 | TRACE("%p\n",pv); | 
|---|
| 1269 | return GlobalUnlock((HANDLE)pv); | 
|---|
| 1270 | } | 
|---|
| 1271 | /************************************************************************* | 
|---|
| 1272 | * SHFreeShared                                 [SHELL32.523] | 
|---|
| 1273 | * | 
|---|
| 1274 | * NOTES | 
|---|
| 1275 | *  parameter1 is return value from SHAllocShared | 
|---|
| 1276 | *  parameter2 is return value from GetCurrentProcessId | 
|---|
| 1277 | */ | 
|---|
| 1278 | BOOL WINAPI SHFreeShared( | 
|---|
| 1279 | HANDLE hMem, | 
|---|
| 1280 | DWORD pid) | 
|---|
| 1281 | { | 
|---|
| 1282 | TRACE("handle=0x%04x 0x%04lx\n",hMem,pid); | 
|---|
| 1283 | return GlobalFree(hMem); | 
|---|
| 1284 | } | 
|---|
| 1285 |  | 
|---|
| 1286 | /************************************************************************* | 
|---|
| 1287 | * SetAppStartingCursor                         [SHELL32.99] | 
|---|
| 1288 | */ | 
|---|
| 1289 | HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v) | 
|---|
| 1290 | {       FIXME("hwnd=0x%04x 0x%04lx stub\n",u,v ); | 
|---|
| 1291 | return 0; | 
|---|
| 1292 | } | 
|---|
| 1293 | /************************************************************************* | 
|---|
| 1294 | * SHLoadOLE                                    [SHELL32.151] | 
|---|
| 1295 | * | 
|---|
| 1296 | */ | 
|---|
| 1297 | HRESULT WINAPI SHLoadOLE(DWORD u) | 
|---|
| 1298 | {       FIXME("0x%04lx stub\n",u); | 
|---|
| 1299 | return S_OK; | 
|---|
| 1300 | } | 
|---|
| 1301 | /************************************************************************* | 
|---|
| 1302 | * DriveType                                    [SHELL32.64] | 
|---|
| 1303 | * | 
|---|
| 1304 | */ | 
|---|
| 1305 | HRESULT WINAPI DriveType(DWORD u) | 
|---|
| 1306 | {       FIXME("0x%04lx stub\n",u); | 
|---|
| 1307 | return 0; | 
|---|
| 1308 | } | 
|---|
| 1309 | /************************************************************************* | 
|---|
| 1310 | * SHAbortInvokeCommand                         [SHELL32.198] | 
|---|
| 1311 | * | 
|---|
| 1312 | */ | 
|---|
| 1313 | HRESULT WINAPI SHAbortInvokeCommand(void) | 
|---|
| 1314 | {       FIXME("stub\n"); | 
|---|
| 1315 | return 1; | 
|---|
| 1316 | } | 
|---|
| 1317 | /************************************************************************* | 
|---|
| 1318 | * SHOutOfMemoryMessageBox                      [SHELL32.126] | 
|---|
| 1319 | * | 
|---|
| 1320 | */ | 
|---|
| 1321 | int WINAPI SHOutOfMemoryMessageBox( | 
|---|
| 1322 | HWND hwndOwner, | 
|---|
| 1323 | LPCSTR lpCaption, | 
|---|
| 1324 | UINT uType) | 
|---|
| 1325 | { | 
|---|
| 1326 | FIXME("0x%04x %s 0x%08x stub\n",hwndOwner, lpCaption, uType); | 
|---|
| 1327 | return 0; | 
|---|
| 1328 | } | 
|---|
| 1329 | /************************************************************************* | 
|---|
| 1330 | * SHFlushClipboard                             [SHELL32.121] | 
|---|
| 1331 | * | 
|---|
| 1332 | */ | 
|---|
| 1333 | HRESULT WINAPI SHFlushClipboard(void) | 
|---|
| 1334 | {       FIXME("stub\n"); | 
|---|
| 1335 | return 1; | 
|---|
| 1336 | } | 
|---|
| 1337 |  | 
|---|
| 1338 | /************************************************************************* | 
|---|
| 1339 | * SHWaitForFileToOpen                          [SHELL32.97] | 
|---|
| 1340 | * | 
|---|
| 1341 | */ | 
|---|
| 1342 | BOOL WINAPI SHWaitForFileToOpen( | 
|---|
| 1343 | LPCITEMIDLIST pidl, | 
|---|
| 1344 | DWORD dwFlags, | 
|---|
| 1345 | DWORD dwTimeout) | 
|---|
| 1346 | { | 
|---|
| 1347 | FIXME("%p 0x%08lx 0x%08lx stub\n", pidl, dwFlags, dwTimeout); | 
|---|
| 1348 | return 0; | 
|---|
| 1349 | } | 
|---|
| 1350 |  | 
|---|
| 1351 | /************************************************************************ | 
|---|
| 1352 | *      @                               [SHELL32.654] | 
|---|
| 1353 | * | 
|---|
| 1354 | * NOTES: first parameter seems to be a pointer (same as passed to WriteCabinetState) | 
|---|
| 1355 | * second one could be a size (0x0c). The size is the same as the structure saved to | 
|---|
| 1356 | * HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState | 
|---|
| 1357 | * I'm (js) guessing: this one is just ReadCabinetState ;-) | 
|---|
| 1358 | */ | 
|---|
| 1359 | HRESULT WINAPI shell32_654 (DWORD x, DWORD y) | 
|---|
| 1360 | {       FIXME("0x%08lx 0x%08lx stub\n",x,y); | 
|---|
| 1361 | return 0; | 
|---|
| 1362 | } | 
|---|
| 1363 |  | 
|---|
| 1364 | /************************************************************************ | 
|---|
| 1365 | *      RLBuildListOfPaths                      [SHELL32.146] | 
|---|
| 1366 | * | 
|---|
| 1367 | * NOTES | 
|---|
| 1368 | *   builds a DPA | 
|---|
| 1369 | */ | 
|---|
| 1370 | DWORD WINAPI RLBuildListOfPaths (void) | 
|---|
| 1371 | {       FIXME("stub\n"); | 
|---|
| 1372 | return 0; | 
|---|
| 1373 | } | 
|---|
| 1374 | /************************************************************************ | 
|---|
| 1375 | *      SHValidateUNC                           [SHELL32.173] | 
|---|
| 1376 | * | 
|---|
| 1377 | */ | 
|---|
| 1378 | HRESULT WINAPI SHValidateUNC (DWORD x, DWORD y, DWORD z) | 
|---|
| 1379 | { | 
|---|
| 1380 | FIXME("0x%08lx 0x%08lx 0x%08lx stub\n",x,y,z); | 
|---|
| 1381 | return 0; | 
|---|
| 1382 | } | 
|---|
| 1383 |  | 
|---|
| 1384 | /************************************************************************ | 
|---|
| 1385 | *      DoEnvironmentSubstA                     [SHELL32.@] | 
|---|
| 1386 | * | 
|---|
| 1387 | */ | 
|---|
| 1388 | HRESULT WINAPI DoEnvironmentSubstA(LPSTR x, LPSTR y) | 
|---|
| 1389 | { | 
|---|
| 1390 | FIXME("(%s, %s) stub\n", debugstr_a(x), debugstr_a(y)); | 
|---|
| 1391 | return 0; | 
|---|
| 1392 | } | 
|---|
| 1393 |  | 
|---|
| 1394 | /************************************************************************ | 
|---|
| 1395 | *      DoEnvironmentSubstW                     [SHELL32.@] | 
|---|
| 1396 | * | 
|---|
| 1397 | */ | 
|---|
| 1398 | HRESULT WINAPI DoEnvironmentSubstW(LPWSTR x, LPWSTR y) | 
|---|
| 1399 | { | 
|---|
| 1400 | FIXME("(%s, %s): stub\n", debugstr_w(x), debugstr_w(y)); | 
|---|
| 1401 | return 0; | 
|---|
| 1402 | } | 
|---|
| 1403 |  | 
|---|
| 1404 | /************************************************************************ | 
|---|
| 1405 | *      DoEnvironmentSubst                      [SHELL32.53] | 
|---|
| 1406 | * | 
|---|
| 1407 | */ | 
|---|
| 1408 | HRESULT WINAPI DoEnvironmentSubstAW(LPVOID x, LPVOID y) | 
|---|
| 1409 | { | 
|---|
| 1410 | if (SHELL_OsIsUnicode()) | 
|---|
| 1411 | return DoEnvironmentSubstW(x, y); | 
|---|
| 1412 | return DoEnvironmentSubstA(x, y); | 
|---|
| 1413 | } | 
|---|
| 1414 |  | 
|---|
| 1415 | /************************************************************************* | 
|---|
| 1416 | *      @                             [SHELL32.243] | 
|---|
| 1417 | * | 
|---|
| 1418 | * Win98+ by-ordinal routine.  In Win98 this routine returns zero and | 
|---|
| 1419 | * does nothing else.  Possibly this does something in NT or SHELL32 5.0? | 
|---|
| 1420 | * | 
|---|
| 1421 | */ | 
|---|
| 1422 |  | 
|---|
| 1423 | BOOL WINAPI shell32_243(DWORD a, DWORD b) | 
|---|
| 1424 | { | 
|---|
| 1425 | return FALSE; | 
|---|
| 1426 | } | 
|---|
| 1427 |  | 
|---|
| 1428 | /************************************************************************* | 
|---|
| 1429 | *      @       [SHELL32.714] | 
|---|
| 1430 | */ | 
|---|
| 1431 | DWORD WINAPI SHELL32_714(LPVOID x) | 
|---|
| 1432 | { | 
|---|
| 1433 | FIXME("(%s)stub\n", debugstr_w(x)); | 
|---|
| 1434 | return 0; | 
|---|
| 1435 | } | 
|---|
| 1436 |  | 
|---|
| 1437 | /************************************************************************* | 
|---|
| 1438 | *      SHAddFromPropSheetExtArray      [SHELL32.167] | 
|---|
| 1439 | */ | 
|---|
| 1440 | DWORD WINAPI SHAddFromPropSheetExtArray(DWORD a, DWORD b, DWORD c) | 
|---|
| 1441 | { | 
|---|
| 1442 | FIXME("(%08lx,%08lx,%08lx)stub\n", a, b, c); | 
|---|
| 1443 | return 0; | 
|---|
| 1444 | } | 
|---|
| 1445 |  | 
|---|
| 1446 | /************************************************************************* | 
|---|
| 1447 | *      SHCreatePropSheetExtArray       [SHELL32.168] | 
|---|
| 1448 | */ | 
|---|
| 1449 | DWORD WINAPI SHCreatePropSheetExtArray(DWORD a, LPCSTR b, DWORD c) | 
|---|
| 1450 | { | 
|---|
| 1451 | FIXME("(%08lx,%s,%08lx)stub\n", a, debugstr_a(b), c); | 
|---|
| 1452 | return 0; | 
|---|
| 1453 | } | 
|---|
| 1454 |  | 
|---|
| 1455 | /************************************************************************* | 
|---|
| 1456 | *      SHReplaceFromPropSheetExtArray  [SHELL32.170] | 
|---|
| 1457 | */ | 
|---|
| 1458 | DWORD WINAPI SHReplaceFromPropSheetExtArray(DWORD a, DWORD b, DWORD c, DWORD d) | 
|---|
| 1459 | { | 
|---|
| 1460 | FIXME("(%08lx,%08lx,%08lx,%08lx)stub\n", a, b, c, d); | 
|---|
| 1461 | return 0; | 
|---|
| 1462 | } | 
|---|
| 1463 |  | 
|---|
| 1464 | /************************************************************************* | 
|---|
| 1465 | *      SHDestroyPropSheetExtArray      [SHELL32.169] | 
|---|
| 1466 | */ | 
|---|
| 1467 | DWORD WINAPI SHDestroyPropSheetExtArray(DWORD a) | 
|---|
| 1468 | { | 
|---|
| 1469 | FIXME("(%08lx)stub\n", a); | 
|---|
| 1470 | return 0; | 
|---|
| 1471 | } | 
|---|
| 1472 |  | 
|---|
| 1473 | /************************************************************************* | 
|---|
| 1474 | *      CIDLData_CreateFromIDArray[SHELL32.83] | 
|---|
| 1475 | * | 
|---|
| 1476 | *  Create IDataObject from PIDLs?? | 
|---|
| 1477 | */ | 
|---|
| 1478 | HRESULT WINAPI CIDLData_CreateFromIDArray( | 
|---|
| 1479 | LPCITEMIDLIST pidlFolder, | 
|---|
| 1480 | DWORD cpidlFiles, | 
|---|
| 1481 | LPCITEMIDLIST *lppidlFiles, | 
|---|
| 1482 | LPDATAOBJECT *ppdataObject) | 
|---|
| 1483 | { | 
|---|
| 1484 | INT i; | 
|---|
| 1485 | HWND hwnd = 0;   /*FIXME: who should be hwnd of owner? set to desktop */ | 
|---|
| 1486 | BOOL boldpidl; | 
|---|
| 1487 |  | 
|---|
| 1488 | #ifndef __WIN32OS2__ | 
|---|
| 1489 | if (TRACE_ON(shell)) { | 
|---|
| 1490 | TRACE("(%p, %ld, %p, %p)\n", pidlFolder, cpidlFiles, | 
|---|
| 1491 | lppidlFiles, ppdataObject); | 
|---|
| 1492 | boldpidl = TRACE_ON(pidl); | 
|---|
| 1493 | __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_shell, FALSE); | 
|---|
| 1494 | __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_pidl, TRUE); | 
|---|
| 1495 | pdump (pidlFolder); | 
|---|
| 1496 | for (i=0; i<cpidlFiles; i++){ | 
|---|
| 1497 | pdump (lppidlFiles[i]); | 
|---|
| 1498 | } | 
|---|
| 1499 | __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_shell, TRUE); | 
|---|
| 1500 | __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_pidl, boldpidl); | 
|---|
| 1501 | } | 
|---|
| 1502 | #endif | 
|---|
| 1503 |  | 
|---|
| 1504 | *ppdataObject = IDataObject_Constructor( hwnd, pidlFolder, | 
|---|
| 1505 | lppidlFiles, cpidlFiles); | 
|---|
| 1506 | if (*ppdataObject) return S_OK; | 
|---|
| 1507 | return E_OUTOFMEMORY; | 
|---|
| 1508 | } | 
|---|