- Timestamp:
- Oct 17, 2001, 11:15:22 AM (24 years ago)
- Location:
- trunk/src/shell32
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/shell32/shell.c
r4121 r7085 1 /* $Id: shell.c,v 1. 1 2000-08-30 13:52:53 sandervlExp $ */1 /* $Id: shell.c,v 1.2 2001-10-17 09:15:20 phaller Exp $ */ 2 2 /* 3 3 * Shell Library Functions … … 678 678 OFSTRUCT ofs; 679 679 DWORD sig; 680 HFILE hFile = OpenFile( lpszExeFileName, &ofs, OF_READ );680 HFILE hFile; 681 681 UINT16 iconDirCount = 0,iconCount = 0; 682 682 LPBYTE peimage; … … 685 685 TRACE("(%04x,file %s,start %d,extract %d\n", 686 686 hInstance, lpszExeFileName, nIconIndex, n); 687 688 if( hFile == HFILE_ERROR || !n ) 687 688 if( !n ) 689 return 0; 690 691 hFile = OpenFile( lpszExeFileName, &ofs, OF_READ|OF_EXIST ); 692 if(hFile == HFILE_ERROR) 689 693 return 0; 690 694 -
trunk/src/shell32/shell32_main.c
r5861 r7085 1 /* $Id: shell32_main.c,v 1. 5 2001-06-01 08:22:10 sandervlExp $ */1 /* $Id: shell32_main.c,v 1.6 2001-10-17 09:15:21 phaller Exp $ */ 2 2 /* 3 3 * Shell basics … … 46 46 * CommandLineToArgvW [SHELL32.7] 47 47 */ 48 LPWSTR* WINAPI CommandLineToArgvW(LPWSTR cmdline,LPDWORD numargs) 49 { LPWSTR *argv,s,t; 50 int i; 51 TRACE("\n"); 52 53 /* to get writeable copy */ 54 cmdline = HEAP_strdupW( GetProcessHeap(), 0, cmdline); 55 s=cmdline;i=0; 56 while (*s) 57 { /* space */ 58 if (*s==0x0020) 59 { i++; 60 s++; 61 while (*s && *s==0x0020) 62 s++; 63 continue; 64 } 65 s++; 66 } 67 argv=(LPWSTR*)HeapAlloc( GetProcessHeap(), 0, sizeof(LPWSTR)*(i+1) ); 68 s=t=cmdline; 69 i=0; 70 while (*s) 71 { if (*s==0x0020) 72 { *s=0; 73 argv[i++]=HEAP_strdupW( GetProcessHeap(), 0, t ); 74 *s=0x0020; 75 while (*s && *s==0x0020) 76 s++; 77 t=s; 78 continue; 79 } 80 s++; 81 } 82 if (*t) 83 argv[i++]=(LPWSTR)HEAP_strdupW( GetProcessHeap(), 0, t ); 84 85 HeapFree( GetProcessHeap(), 0, cmdline ); 86 argv[i]=NULL; 87 *numargs=i; 88 return argv; 89 } 90 48 /************************************************************************* 49 * CommandLineToArgvW[SHELL32.@] 50 * 51 * We must interpret the quotes in the command line to rebuild the argv 52 * array correctly: 53 * - arguments are separated by spaces or tabs 54 * - quotes serve as optional argument delimiters 55 * '"a b"' -> 'a b' 56 * - escaped quotes must be converted back to '"' 57 * '\"' -> '"' 58 * - an odd number of '\'s followed by '"' correspond to half that number 59 * of '\' followed by a '"' (extension of the above) 60 * '\\\"' -> '\"' 61 * '\\\\\"' -> '\\"' 62 * - an even number of '\'s followed by a '"' correspond to half that number 63 * of '\', plus a regular quote serving as an argument delimiter (which 64 * means it does not appear in the result) 65 * 'a\\"b c"' -> 'a\b c' 66 * 'a\\\\"b c"' -> 'a\\b c' 67 * - '\' that are not followed by a '"' are copied literally 68 * 'a\b' -> 'a\b' 69 * 'a\\b' -> 'a\\b' 70 * 71 * Note: 72 * '\t' == 0x0009 73 * ' ' == 0x0020 74 * '"' == 0x0022 75 * '\\' == 0x005c 76 */ 77 LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs) 78 { 79 DWORD argc; 80 HGLOBAL hargv; 81 LPWSTR *argv; 82 LPCWSTR cs; 83 LPWSTR arg,s,d; 84 LPWSTR cmdline; 85 int in_quotes,bcount; 86 87 if (*lpCmdline==0) { 88 /* Return the path to the executable */ 89 DWORD size; 90 91 hargv=0; 92 size=16; 93 do { 94 size*=2; 95 hargv=GlobalReAlloc(hargv, size, 0); 96 argv=GlobalLock(hargv); 97 } while (GetModuleFileNameW((HMODULE)0, (LPWSTR)(argv+1), size-sizeof(LPWSTR)) == 0); 98 argv[0]=(LPWSTR)(argv+1); 99 if (numargs) 100 *numargs=2; 101 102 return argv; 103 } 104 105 /* to get a writeable copy */ 106 argc=0; 107 bcount=0; 108 in_quotes=0; 109 cs=lpCmdline; 110 while (1) { 111 if (*cs==0 || ((*cs==0x0009 || *cs==0x0020) && !in_quotes)) { 112 /* space */ 113 argc++; 114 /* skip the remaining spaces */ 115 while (*cs==0x0009 || *cs==0x0020) { 116 cs++; 117 } 118 if (*cs==0) 119 break; 120 bcount=0; 121 continue; 122 } else if (*cs==0x005c) { 123 /* '\', count them */ 124 bcount++; 125 } else if ((*cs==0x0022) && ((bcount & 1)==0)) { 126 /* unescaped '"' */ 127 in_quotes=!in_quotes; 128 bcount=0; 129 } else { 130 /* a regular character */ 131 bcount=0; 132 } 133 cs++; 134 } 135 /* Allocate in a single lump, the string array, and the strings that go with it. 136 * This way the caller can make a single GlobalFree call to free both, as per MSDN. 137 */ 138 hargv=GlobalAlloc(0, argc*sizeof(LPWSTR)+(strlenW(lpCmdline)+1)*sizeof(WCHAR)); 139 argv=GlobalLock(hargv); 140 if (!argv) 141 return NULL; 142 cmdline=(LPWSTR)(argv+argc); 143 strcpyW(cmdline, lpCmdline); 144 145 argc=0; 146 bcount=0; 147 in_quotes=0; 148 arg=d=s=cmdline; 149 while (*s) { 150 if ((*s==0x0009 || *s==0x0020) && !in_quotes) { 151 /* Close the argument and copy it */ 152 *d=0; 153 argv[argc++]=arg; 154 155 /* skip the remaining spaces */ 156 do { 157 s++; 158 } while (*s==0x0009 || *s==0x0020); 159 160 /* Start with a new argument */ 161 arg=d=s; 162 bcount=0; 163 } else if (*s==0x005c) { 164 /* '\\' */ 165 *d++=*s++; 166 bcount++; 167 } else if (*s==0x0022) { 168 /* '"' */ 169 if ((bcount & 1)==0) { 170 /* Preceeded by an even number of '\', this is half that 171 * number of '\', plus a quote which we erase. 172 */ 173 d-=bcount/2; 174 in_quotes=!in_quotes; 175 s++; 176 } else { 177 /* Preceeded by an odd number of '\', this is half that 178 * number of '\' followed by a '"' 179 */ 180 d=d-bcount/2-1; 181 *d++='"'; 182 s++; 183 } 184 bcount=0; 185 } else { 186 /* a regular character */ 187 *d++=*s++; 188 bcount=0; 189 } 190 } 191 if (*arg) { 192 *d='\0'; 193 argv[argc]=arg; 194 } 195 if (numargs) 196 *numargs=argc; 197 198 return argv; 199 } 91 200 92 201 /************************************************************************* … … 373 482 { 374 483 ICONINFO IconInfo; 375 HICON hDupIcon = NULL;484 HICON hDupIcon = 0; 376 485 377 486 TRACE("(%04x, %04x)\n", hInstance, hIcon); … … 546 655 return TRUE; 547 656 case ABM_REMOVE: 548 CloseHandle(data->hWnd); 657 FIXME("ABM_REMOVE broken\n"); 658 /* FIXME: this is wrong; should it be DestroyWindow instead? */ 659 /*CloseHandle(data->hWnd);*/ 549 660 return TRUE; 550 661 case ABM_SETAUTOHIDEBAR: … … 654 765 hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX); 655 766 SendMessageA( hWndCtl, WM_SETREDRAW, 0, 0 ); 767 if (!hIconTitleFont) 768 { 769 LOGFONTA logFont; 770 SystemParametersInfoA( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 ); 771 hIconTitleFont = CreateFontIndirectA( &logFont ); 772 } 656 773 SendMessageA( hWndCtl, WM_SETFONT, hIconTitleFont, 0 ); 657 774 while (*pstr) … … 680 797 case WM_LBTRACKPOINT: 681 798 hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX); 682 if( (INT16)GetKeyState 16( VK_CONTROL ) < 0 )799 if( (INT16)GetKeyState( VK_CONTROL ) < 0 ) 683 800 { if( DragDetect( hWndCtl, *((LPPOINT)&lParam) ) ) 684 801 { INT idx = SendMessageA( hWndCtl, LB_GETCURSEL, 0, 0 ); … … 689 806 690 807 if( pstr ) 691 { HCURSOR 16 hCursor = LoadCursor16( 0, MAKEINTRESOURCE16(OCR_DRAGOBJECT) );808 { HCURSOR hCursor = LoadCursorA( 0, MAKEINTRESOURCEA(OCR_DRAGOBJECT) ); 692 809 SendMessageA( hWndCtl, LB_GETTEXT, (WPARAM)idx, (LPARAM)pstr ); 693 810 SendMessageA( hWndCtl, LB_DELETESTRING, (WPARAM)idx, 0 ); … … 867 984 */ 868 985 void (* WINAPI pDLLInitComctl)(LPVOID); 869 870 LPVOID (* WINAPI pCOMCTL32_Alloc) (INT); 871 BOOL (* WINAPI pCOMCTL32_Free) (LPVOID); 986 LPVOID (* WINAPI pCOMCTL32_Alloc) (INT); 987 BOOL (* WINAPI pCOMCTL32_Free) (LPVOID); 988 989 /* 2001-10-17 @@@PH 990 either me or VAC308 seems to be confused here: 991 if complains about redeclaration of the corresponding functions 992 in commctrl.h 993 994 Even more strangely, all variables "pFunction" are automatically 995 percieved as "Function". 996 */ 997 #if 0 998 HDPA (* WINAPI lpDPA_Create) (INT); 999 INT (* WINAPI lpDPA_InsertPtr) (const HDPA, INT, LPVOID); 1000 BOOL (* WINAPI lpDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM); 1001 LPVOID (* WINAPI lpDPA_GetPtr) (const HDPA, INT); 1002 BOOL (* WINAPI lpDPA_Destroy) (const HDPA); 1003 INT (* WINAPI lpDPA_Search) (const HDPA, LPVOID, INT, PFNDPACOMPARE, LPARAM, UINT); 1004 LPVOID (* WINAPI lpDPA_DeletePtr) (const HDPA hdpa, INT i); 1005 HANDLE (* WINAPI lpCreateMRUListA) (LPVOID lpcml); 1006 DWORD (* WINAPI lpFreeMRUListA) (HANDLE hMRUList); 1007 INT (* WINAPI lpAddMRUData) (HANDLE hList, LPCVOID lpData, DWORD cbData); 1008 INT (* WINAPI lpFindMRUData) (HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum); 1009 INT (* WINAPI lpEnumMRUListA) (HANDLE hList, INT nItemPos, LPVOID lpBuffer, DWORD nBufferSize); 1010 #endif 872 1011 873 1012 static HINSTANCE hComctl32; … … 908 1047 909 1048 /* comctl32 */ 1049 pDLLInitComctl=(void*)GetProcAddress(hComctl32, "InitCommonControlsEx"); 910 1050 pCOMCTL32_Alloc=(void*)GetProcAddress(hComctl32, (LPCSTR)71L); 911 pCOMCTL32_Free=(void*)GetProcAddress(hComctl32, (LPCSTR)73L); 912 913 /* initialize the common controls */ 1051 pCOMCTL32_Free=(void*)GetProcAddress(hComctl32, (LPCSTR)73L); 1052 #if 0 1053 lpDPA_Create=(void*)GetProcAddress(hComctl32, (LPCSTR)328L); 1054 lpDPA_Destroy=(void*)GetProcAddress(hComctl32, (LPCSTR)329L); 1055 lpDPA_GetPtr=(void*)GetProcAddress(hComctl32, (LPCSTR)332L); 1056 lpDPA_InsertPtr=(void*)GetProcAddress(hComctl32, (LPCSTR)334L); 1057 lpDPA_DeletePtr=(void*)GetProcAddress(hComctl32, (LPCSTR)336L); 1058 lpDPA_Sort=(void*)GetProcAddress(hComctl32, (LPCSTR)338L); 1059 lpDPA_Search=(void*)GetProcAddress(hComctl32, (LPCSTR)339L); 1060 lpCreateMRUListA=(void*)GetProcAddress(hComctl32, (LPCSTR)151L /*"CreateMRUListA"*/); 1061 lpFreeMRUListA=(void*)GetProcAddress(hComctl32, (LPCSTR)152L /*"FreeMRUList"*/); 1062 lpAddMRUData=(void*)GetProcAddress(hComctl32, (LPCSTR)167L /*"AddMRUData"*/); 1063 lpFindMRUData=(void*)GetProcAddress(hComctl32, (LPCSTR)169L /*"FindMRUData"*/); 1064 lpEnumMRUListA=(void*)GetProcAddress(hComctl32, (LPCSTR)154L /*"EnumMRUListA"*/); 1065 #endif 1066 /* initialize the common controls */ 1067 if (pDLLInitComctl) 1068 { 1069 pDLLInitComctl(NULL); 1070 } 914 1071 InitCommonControlsEx(NULL); 915 1072 -
trunk/src/shell32/shellole.c
r6709 r7085 40 40 LPSTR aclsid, 41 41 REFCLSID clsid, 42 IUnknown *unknownouter,42 LPUNKNOWN unknownouter, 43 43 REFIID refiid, 44 44 LPVOID *ppv) … … 63 63 } 64 64 else 65 { 65 { 66 CoInitialize(NULL); 66 67 hres = CoCreateInstance(myclsid, unknownouter, CLSCTX_INPROC_SERVER, refiid, ppv); 67 68 } -
trunk/src/shell32/shellord.c
r7014 r7085 481 481 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", 482 482 0, KEY_READ, &Policy_basekey)) { 483 ERR("No Explorer Policies location\n"); 483 TRACE("No Explorer Policies location exists. Policy wanted=%s\n", 484 policy); 484 485 *len = 0; 485 486 return ERROR_FILE_NOT_FOUND; … … 655 656 * key is stored in the DLL global data. 656 657 */ 657 RegOpenKeyExA(HKEY_CURRENT_USER,658 if (RegCreateKeyExA(HKEY_CURRENT_USER, 658 659 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer", 659 0, 660 KEY_READ, 661 &HCUbasekey); 660 0, 0, 0, KEY_READ, 0, &HCUbasekey ,0)) { 661 ERR("Failed to create 'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer'\n"); 662 return 0; 663 } 662 664 663 665 /* Get path to user's "Recent" directory … … 669 671 IMalloc_Free(ppM, pidl); 670 672 } 671 IMalloc_Release(ppM); 673 else { 674 /* serious issues */ 675 link_dir[0] = 0; 676 ERR("serious issues 1\n"); 677 } 678 IMalloc_Release(ppM); 672 679 } 673 680 else { 674 681 /* serious issues */ 675 682 link_dir[0] = 0; 676 ERR("serious issues \n");683 ERR("serious issues 2\n"); 677 684 } 678 685 TRACE("Users Recent dir %s\n", link_dir); … … 1007 1014 /* launch a document by fileclass like 'Wordpad.Document.1' */ 1008 1015 if (sei->fMask & SEE_MASK_CLASSNAME) 1009 { 1016 { 1017 /* FIXME: szCommandline should not be of a fixed size. Plus MAX_PATH is way too short! */ 1010 1018 /* the commandline contains 'c:\Path\wordpad.exe "%1"' */ 1011 HCR_GetExecuteCommand(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, 256);1019 HCR_GetExecuteCommand(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, sizeof(szCommandline)); 1012 1020 /* fixme: get the extension of lpFile, check if it fits to the lpClass */ 1013 1021 TRACE("SEE_MASK_CLASSNAME->'%s'\n", szCommandline); … … 1462 1470 return 0; 1463 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 if (TRACE_ON(shell)) { 1489 TRACE("(%p, %ld, %p, %p)\n", pidlFolder, cpidlFiles, 1490 lppidlFiles, ppdataObject); 1491 boldpidl = TRACE_ON(pidl); 1492 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_shell, FALSE); 1493 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_pidl, TRUE); 1494 pdump (pidlFolder); 1495 for (i=0; i<cpidlFiles; i++){ 1496 pdump (lppidlFiles[i]); 1497 } 1498 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_shell, TRUE); 1499 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_pidl, boldpidl); 1500 } 1501 *ppdataObject = IDataObject_Constructor( hwnd, pidlFolder, 1502 lppidlFiles, cpidlFiles); 1503 if (*ppdataObject) return S_OK; 1504 return E_OUTOFMEMORY; 1505 } -
trunk/src/shell32/shellpath.c
r6709 r7085 337 337 TRACE("path=%s\n",debugstr_w(lpszPath)); 338 338 339 for(i=0; lpszExtensions[i] ; i++)339 for(i=0; lpszExtensions[i][0]; i++) 340 340 #ifdef __WIN32OS2__ 341 341 if (!lstrcmpiW(lpszExtension,lpszExtensions[i])) return TRUE; … … 744 744 "Start Menu" 745 745 }, 746 { /* not known*/747 0, 0,748 NULL, 749 NULL, 750 }, 751 { /* not known*/752 0, 0,753 NULL, 754 NULL, 755 }, 756 { /* not known*/757 0, 0,758 NULL, 759 NULL, 760 }, 761 { /* not known*/746 { /* CSIDL_MYDOCUMENTS */ 747 0, 1, /* FIXME */ 748 NULL, 749 NULL, 750 }, 751 { /* CSIDL_MYMUSIC */ 752 0, 1, /* FIXME */ 753 NULL, 754 NULL, 755 }, 756 { /*CSIDL_MYVIDEO */ 757 0, 1, /* FIXME */ 758 NULL, 759 NULL, 760 }, 761 { /* unassigned */ 762 762 0, 0, 763 763 NULL, … … 824 824 "PrintHood" 825 825 }, 826 { /* not known*/827 0, 0, 826 { /* CSIDL_LOCAL_APPDATA */ 827 0, 0, /* FIXME */ 828 828 NULL, 829 829 NULL, … … 933 933 NULL, 934 934 NULL 935 }, 936 { /* unassigned 32*/ 937 0, 0, 938 NULL, 939 NULL, 940 }, 941 { /* unassigned 33*/ 942 0, 0, 943 NULL, 944 NULL, 945 }, 946 { /* unassigned 34*/ 947 0, 0, 948 NULL, 949 NULL, 950 }, 951 { /* CSIDL_COMMON_MUSIC */ 952 0, 0, /* FIXME */ 953 NULL, 954 NULL, 955 }, 956 { /* CSIDL_COMMON_PICTURES */ 957 0, 0, /* FIXME */ 958 NULL, 959 NULL, 960 }, 961 { /* CSIDL_COMMON_VIDEO */ 962 0, 0, /* FIXME */ 963 NULL, 964 NULL, 965 }, 966 { /* CSIDL_RESOURCES */ 967 0, 0, /* FIXME */ 968 NULL, 969 NULL, 970 }, 971 { /* CSIDL_RESOURCES_LOCALIZED */ 972 0, 0, /* FIXME */ 973 NULL, 974 NULL, 975 }, 976 { /* CSIDL_COMMON_OEM_LINKS */ 977 0, 0, /* FIXME */ 978 NULL, 979 NULL, 980 }, 981 { /* CSIDL_CDBURN_AREA */ 982 0, 0, /* FIXME */ 983 NULL, 984 NULL, 985 }, 986 { /* unassigned 3C */ 987 0, 0, 988 NULL, 989 NULL, 990 }, 991 { /* CSIDL_COMPUTERSNEARME */ 992 0, 0, /* FIXME */ 993 NULL, 994 NULL, 935 995 } 936 996 }; … … 955 1015 TRACE("0x%04x,%p,csidl=%lu,0x%04x\n", hwndOwner,szPath,csidl,bCreate); 956 1016 957 if ((folder > CSIDL_CO NNECTIONS) || (CSIDL_Data[folder].hRootKey == 0))1017 if ((folder > CSIDL_COMPUTERSNEARME) || (CSIDL_Data[folder].hRootKey == 0)) 958 1018 { 959 1019 ERR("folder unknown or not allowed\n"); … … 1071 1131 p = strchr(p+1, '\\'); 1072 1132 } 1133 /* last component must be created too. */ 1134 if (!PathFileExistsA(szBuildPath)) 1135 { 1136 if (!CreateDirectoryA(szBuildPath,NULL)) 1137 { 1138 ERR("Failed to create directory '%s'.\n", szPath); 1139 return FALSE; 1140 } 1141 } 1073 1142 1074 1143 MESSAGE("Created not existing system directory '%s'\n", szPath); -
trunk/src/shell32/shellstub.cpp
r5618 r7085 1 /* $Id: shellstub.cpp,v 1. 3 2001-04-28 13:33:47 sandervlExp $ */1 /* $Id: shellstub.cpp,v 1.4 2001-10-17 09:15:22 phaller Exp $ */ 2 2 3 3 /* … … 41 41 42 42 ODINFUNCTION3(DWORD, SHCreateStdEnumFmtEtc, DWORD, x1, DWORD, x2, DWORD, x3) 43 {44 dprintf(("STUB!"));45 return 0;46 }47 48 ODINFUNCTION4(DWORD, CIDLData_CreateFromIDArray, DWORD, x1, DWORD, x2, DWORD, x3, DWORD, x4)49 43 { 50 44 dprintf(("STUB!")); -
trunk/src/shell32/systray.c
r6709 r7085 109 109 } 110 110 } 111 /* fall thru*/111 /* fall through */ 112 112 113 113 case WM_LBUTTONDBLCLK:
Note:
See TracChangeset
for help on using the changeset viewer.