Changeset 5618 for trunk/src/shell32/shelllink.c
- Timestamp:
- Apr 28, 2001, 3:33:49 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/shell32/shelllink.c
r4561 r5618 1 /* $Id: shelllink.c,v 1.2 2000-11-06 10:20:56 sandervl Exp $ */2 1 /* 3 2 * … … 6 5 * 7 6 */ 8 #ifdef __WIN32OS2__ 9 #define ICOM_CINTERFACE 1 10 #include <odin.h> 11 #endif 7 8 #include "config.h" 12 9 13 10 #include <string.h> … … 18 15 #endif 19 16 #include <errno.h> 20 #if ndef __WIN32OS2__21 # include <sys/wait.h>17 #ifdef HAVE_SYS_WAIT_H 18 # include <sys/wait.h> 22 19 #endif 23 24 20 #include "debugtools.h" 25 21 #include "winerror.h" 26 22 #include "winbase.h" 27 23 #include "winnls.h" 24 #include "winreg.h" 28 25 29 26 #include "shlobj.h" 30 #include "wine/winestring.h"31 27 #include "wine/undocshell.h" 32 28 #ifndef __WIN32OS2__ … … 38 34 #include "shell32_main.h" 39 35 #include "shlguid.h" 40 #include "file.h"41 #include "options.h"42 36 43 37 DEFAULT_DEBUG_CHANNEL(shell); … … 355 349 356 350 if (!(hModule = LoadLibraryExA(szFileName, 0, LOAD_LIBRARY_AS_DATAFILE))) 351 { 352 TRACE("LoadLibraryExA (%s) failed, error %ld\n", szFileName, GetLastError()); 357 353 goto error1; 354 } 358 355 359 356 if (nIndex) 357 { 360 358 hResInfo = FindResourceA(hModule, MAKEINTRESOURCEA(nIndex), RT_GROUP_ICONA); 359 TRACE("FindResourceA (%s) called, return 0x%x, error %ld\n", szFileName, hResInfo, GetLastError()); 360 } 361 361 else 362 362 if (EnumResourceNamesA(hModule, RT_GROUP_ICONA, &EnumResNameProc, (LONG) &hResInfo)) 363 { 364 TRACE("EnumResourceNamesA failed, error %ld\n", GetLastError()); 363 365 goto error2; 366 } 364 367 365 368 if (!hResInfo) 369 { 370 TRACE("ExtractFromEXEDLL failed, error %ld\n", GetLastError()); 366 371 goto error2; 372 } 367 373 368 374 if (!(hResData = LoadResource(hModule, hResInfo))) 375 { 376 TRACE("LoadResource failed, error %ld\n", GetLastError()); 369 377 goto error2; 378 } 370 379 if (!(pIconDir = LockResource(hResData))) 380 { 381 TRACE("LockResource failed, error %ld\n", GetLastError()); 371 382 goto error3; 383 } 372 384 373 385 for (i = 0; i < pIconDir->idCount; i++) … … 381 393 382 394 if (!(hResInfo = FindResourceA(hModule, lpName, RT_ICONA))) 395 { 396 TRACE("Second FindResourceA failed, error %ld\n", GetLastError()); 383 397 goto error2; 398 } 384 399 if (!(hResData = LoadResource(hModule, hResInfo))) 400 { 401 TRACE("Second LoadResource failed, error %ld\n", GetLastError()); 385 402 goto error2; 403 } 386 404 if (!(pIcon = LockResource(hResData))) 405 { 406 TRACE("Second LockResource failed, error %ld\n", GetLastError()); 387 407 goto error3; 408 } 388 409 389 410 if(!SaveIconResAsXPM(pIcon, szXPMFileName)) 411 { 412 TRACE("Failed saving icon as XPM, error %ld\n", GetLastError()); 390 413 goto error3; 414 } 391 415 392 416 FreeResource(hResData); … … 461 485 inline static char *get_unix_file_name( const char *dos ) 462 486 { 463 DOS_FULL_NAME path;464 465 if (! DOSFS_GetFullName( dos, FALSE, &path)) return NULL;466 return HEAP_strdupA( GetProcessHeap(), 0, path.long_name);487 char buffer[MAX_PATH]; 488 489 if (!wine_get_unix_file_name( dos, buffer, sizeof(buffer) )) return NULL; 490 return HEAP_strdupA( GetProcessHeap(), 0, buffer ); 467 491 } 468 492 … … 491 515 return NULL; 492 516 } 493 #endif //#ifndef __WIN32OS2__ 494 517 #endif //__WIN32OS2__ 495 518 496 519 static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFileName, BOOL fRemember) … … 505 528 char *work_dir = NULL; 506 529 BOOL bDesktop; 530 HKEY hkey; 507 531 508 532 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface); … … 522 546 return NOERROR; 523 547 #else 524 PROFILE_GetWineIniString( "wine", "ShellLinker", "", buffer, sizeof(buffer) ); 548 buffer[0] = 0; 549 if (!RegOpenKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Wine", 550 0, KEY_ALL_ACCESS, &hkey )) 551 { 552 DWORD type, count = sizeof(buffer); 553 if (RegQueryValueExA( hkey, "ShellLinker", 0, &type, buffer, &count )) buffer[0] = 0; 554 RegCloseKey( hkey ); 555 } 525 556 if (!*buffer) return NOERROR; 526 557 shell_link_app = HEAP_strdupA( GetProcessHeap(), 0, buffer ); … … 571 602 572 603 /* extract the icon */ 573 if (!(icon_name = extract_icon( This->sIcoPath ? This->sIcoPath : This->sPath, 574 This->iIcoNdx ))) goto done; 604 if (!(icon_name = extract_icon( This->sIcoPath && strlen(This->sIcoPath) ? 605 This->sIcoPath : This->sPath, 606 This->iIcoNdx ))) goto done; 607 575 608 576 609 TRACE("linker app='%s' link='%s' mode=%s path='%s' args='%s' icon='%s' workdir='%s' descr='%s'\n", … … 590 623 argv[pos++] = path_name; 591 624 argv[pos++] = bDesktop ? "--desktop" : "--menu"; 592 if (This->sArgs )625 if (This->sArgs && strlen(This->sArgs)) 593 626 { 594 627 argv[pos++] = "--args"; … … 600 633 argv[pos++] = icon_name; 601 634 } 602 if (This->sWorkDir )635 if (This->sWorkDir && strlen(This->sWorkDir)) 603 636 { 604 637 argv[pos++] = "--workdir"; 605 638 argv[pos++] = This->sWorkDir; 606 639 } 607 if (This->sDescription )640 if (This->sDescription && strlen(This->sDescription)) 608 641 { 609 642 argv[pos++] = "--descr"; … … 633 666 HeapFree( GetProcessHeap(), 0, work_dir ); 634 667 return ret; 635 #endif //__WIN32OS2__668 #endif 636 669 } 637 670 … … 1020 1053 ICOM_THIS(IShellLinkImpl, iface); 1021 1054 1022 FIXME("(%p)->()\n",This); 1023 lstrcpynA(pszDir,"c:\\", cchMaxPath); 1055 TRACE("(%p)->(%p len=%u)\n", This, pszDir, cchMaxPath); 1056 1057 lstrcpynA( pszDir, This->sWorkDir ? This->sWorkDir : "", cchMaxPath ); 1058 1024 1059 return NOERROR; 1025 1060 } … … 1041 1076 ICOM_THIS(IShellLinkImpl, iface); 1042 1077 1043 FIXME("(%p)->(%p len=%u)\n",This, pszArgs, cchMaxPath); 1044 lstrcpynA(pszArgs, "", cchMaxPath); 1078 TRACE("(%p)->(%p len=%u)\n", This, pszArgs, cchMaxPath); 1079 1080 lstrcpynA( pszArgs, This->sArgs ? This->sArgs : "", cchMaxPath ); 1081 1045 1082 return NOERROR; 1046 1083 } … … 1097 1134 ICOM_THIS(IShellLinkImpl, iface); 1098 1135 1099 FIXME("(%p)->(%p len=%u iicon=%p)\n",This, pszIconPath, cchIconPath, piIcon); 1100 lstrcpynA(pszIconPath,"shell32.dll",cchIconPath); 1101 *piIcon=1; 1136 TRACE("(%p)->(%p len=%u iicon=%p)\n", This, pszIconPath, cchIconPath, piIcon); 1137 1138 lstrcpynA( pszIconPath, This->sIcoPath ? This->sIcoPath : "", cchIconPath ); 1139 *piIcon = This->iIcoNdx; 1140 1102 1141 return NOERROR; 1103 1142 } … … 1215 1254 1216 1255 FIXME("(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",This, pszFile, cchMaxPath, pfd, fFlags); 1217 lstrcpynAtoW(pszFile,"c:\\foo.bar", cchMaxPath);1256 MultiByteToWideChar( CP_ACP, 0, "c:\\foo.bar", -1, pszFile, cchMaxPath ); 1218 1257 return NOERROR; 1219 1258 } … … 1241 1280 1242 1281 FIXME("(%p)->(%p len=%u)\n",This, pszName, cchMaxName); 1243 lstrcpynAtoW(pszName,"Description, FIXME",cchMaxName);1282 MultiByteToWideChar( CP_ACP, 0, "Description, FIXME", -1, pszName, cchMaxName ); 1244 1283 return NOERROR; 1245 1284 } … … 1263 1302 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1264 1303 1265 FIXME("(%p)->()\n",This); 1266 lstrcpynAtoW(pszDir,"c:\\", cchMaxPath); 1304 TRACE("(%p)->(%p len %u)\n", This, pszDir, cchMaxPath); 1305 1306 MultiByteToWideChar( CP_ACP, 0, This->sWorkDir ? This->sWorkDir : "", -1, pszDir, cchMaxPath ); 1307 1267 1308 return NOERROR; 1268 1309 } … … 1286 1327 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1287 1328 1288 FIXME("(%p)->(%p len=%u)\n",This, pszArgs, cchMaxPath); 1289 lstrcpynAtoW(pszArgs, "", cchMaxPath); 1329 TRACE("(%p)->(%p len=%u)\n", This, pszArgs, cchMaxPath); 1330 1331 MultiByteToWideChar( CP_ACP, 0, This->sArgs ? This->sArgs : "", -1, pszArgs, cchMaxPath ); 1332 1290 1333 return NOERROR; 1291 1334 } … … 1343 1386 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1344 1387 1345 FIXME("(%p)->(%p len=%u iicon=%p)\n",This, pszIconPath, cchIconPath, piIcon); 1346 lstrcpynAtoW(pszIconPath,"shell32.dll",cchIconPath); 1347 *piIcon=1; 1388 TRACE("(%p)->(%p len=%u iicon=%p)\n", This, pszIconPath, cchIconPath, piIcon); 1389 1390 MultiByteToWideChar( CP_ACP, 0, This->sIcoPath ? This->sIcoPath : "", -1, pszIconPath, cchIconPath ); 1391 *piIcon = This->iIcoNdx; 1392 1348 1393 return NOERROR; 1349 1394 }
Note:
See TracChangeset
for help on using the changeset viewer.