ReactOS 0.4.17-dev-970-gcf0f1a6
shell32_main.c File Reference
#include <wine/config.h>
#include <windef.h>
#include <winbase.h>
#include <shellapi.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <strsafe.h>
#include <winnls.h>
#include "undocshell.h"
#include "pidl.h"
#include "shell32_main.h"
#include "shresdef.h"
#include <wine/debug.h>
#include <wine/unicode.h>
#include <reactos/version.h>
#include <reactos/buildno.h>
#include <reactos/rosbrand.h>
Include dependency graph for shell32_main.c:

Go to the source code of this file.

Classes

struct  ABOUT_INFO
 

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COBJMACROS
 
#define SHGFI_KNOWN_FLAGS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
LPWSTR *WINAPI CommandLineToArgvW (LPCWSTR lpCmdline, int *numargs)
 
static HRESULT SHELL_GetDetailsOfToBuffer (IShellFolder *psf, PCUITEMID_CHILD pidl, UINT col, LPWSTR Buf, UINT cchBuf)
 
static DWORD shgfi_get_exe_type (LPCWSTR szFullPath)
 
BOOL SHELL_IsShortcut (LPCITEMIDLIST pidlLast)
 
DWORD_PTR WINAPI SHGetFileInfoW (LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
 
DWORD_PTR WINAPI SHGetFileInfoA (LPCSTR path, DWORD dwFileAttributes, SHFILEINFOA *psfi, UINT sizeofpsfi, UINT flags)
 
HICON WINAPI DuplicateIcon (HINSTANCE hInstance, HICON hIcon)
 
HICON WINAPI ExtractIconA (HINSTANCE hInstance, LPCSTR lpszFile, UINT nIconIndex)
 
HICON WINAPI ExtractIconW (HINSTANCE hInstance, LPCWSTR lpszFile, UINT nIconIndex)
 
VOID WINAPI Printer_LoadIconsW (LPCWSTR wsPrinterName, HICON *pLargeIcon, HICON *pSmallIcon)
 
BOOL WINAPI Printers_RegisterWindowW (LPCWSTR wsPrinter, DWORD dwType, HANDLE *phClassPidl, HWND *phwnd)
 
VOID WINAPI Printers_UnregisterWindow (HANDLE hClassPidl, HWND hwnd)
 
DWORD WINAPI SHHelpShortcuts_RunDLLA (DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
 
DWORD WINAPI SHHelpShortcuts_RunDLLW (DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
 
HRESULT WINAPI SHLoadInProc (REFCLSID rclsid)
 
static VOID SetRegTextData (HWND hWnd, HKEY hKey, LPCWSTR Value, UINT uID)
 
INT_PTR CALLBACK AboutAuthorsDlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK AboutDlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
BOOL WINAPI ShellAboutA (HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon)
 
BOOL WINAPI ShellAboutW (HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HICON hIcon)
 
void WINAPI FreeIconList (DWORD dw)
 
HRESULT WINAPI SHLoadNonloadedIconOverlayIdentifiers (VOID)
 

Variables

const char *const SHELL_Authors [] = { "Copyright 1993-"COPYRIGHT_YEAR" WINE team", "Copyright 1998-"COPYRIGHT_YEAR" ReactOS Team", 0 }
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 26 of file shell32_main.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 27 of file shell32_main.c.

◆ SHGFI_KNOWN_FLAGS

#define SHGFI_KNOWN_FLAGS
Value:
#define SHGFI_ATTR_SPECIFIED
Definition: shellapi.h:174
#define SHGFI_OPENICON
Definition: shellapi.h:178
#define SHGFI_LINKOVERLAY
Definition: shellapi.h:172
#define SHGFI_SYSICONINDEX
Definition: shellapi.h:171
#define SHGFI_ICONLOCATION
Definition: shellapi.h:169
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:166
#define SHGFI_ICON
Definition: shellapi.h:164
#define SHGFI_TYPENAME
Definition: shellapi.h:167
#define SHGFI_USEFILEATTRIBUTES
Definition: shellapi.h:181
#define SHGFI_ATTRIBUTES
Definition: shellapi.h:168
#define SHGFI_SMALLICON
Definition: shellapi.h:176
#define SHGFI_SELECTED
Definition: shellapi.h:173
#define SHGFI_ADDOVERLAYS
Definition: shellapi.h:162
#define SHGFI_OVERLAYINDEX
Definition: shellapi.h:163
#define SHGFI_PIDL
Definition: shellapi.h:180
#define SHGFI_EXETYPE
Definition: shellapi.h:170
#define SHGFI_SHELLICONSIZE
Definition: shellapi.h:179

Definition at line 420 of file shell32_main.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 25 of file shell32_main.c.

Function Documentation

◆ AboutAuthorsDlgProc()

INT_PTR CALLBACK AboutAuthorsDlgProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1037 of file shell32_main.c.

1038{
1039 switch(msg)
1040 {
1041 case WM_INITDIALOG:
1042 {
1043 const char* const *pstr = SHELL_Authors;
1044
1045 // Add the authors to the list
1047
1048 while (*pstr)
1049 {
1050 WCHAR name[64];
1051
1052 /* authors list is in utf-8 format */
1053 MultiByteToWideChar( CP_UTF8, 0, *pstr, -1, name, sizeof(name)/sizeof(WCHAR) );
1055 pstr++;
1056 }
1057
1059
1060 return TRUE;
1061 }
1062 }
1063
1064 return FALSE;
1065}
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define MultiByteToWideChar
Definition: compat.h:110
LONG_PTR LPARAM
Definition: minwindef.h:175
UINT_PTR WPARAM
Definition: minwindef.h:174
short WCHAR
Definition: pedump.c:58
#define WM_INITDIALOG
Definition: winuser.h:1767
#define LB_ADDSTRING
Definition: winuser.h:2060
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETREDRAW
Definition: winuser.h:1644
#define CP_UTF8
Definition: nls.h:20
const char *const SHELL_Authors[]
Definition: shell32_main.c:51
#define IDC_ABOUT_AUTHORS_LISTBOX
Definition: shresdef.h:424
Definition: name.c:39

Referenced by AboutDlgProc().

◆ AboutDlgProc()

static INT_PTR CALLBACK AboutDlgProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1069 of file shell32_main.c.

1070{
1071#ifdef __REACTOS__
1072
1073 static DWORD cxLogoBmp;
1074 static DWORD cyLogoBmp, cyLineBmp;
1075 static HBITMAP hLogoBmp, hLineBmp;
1076 static HWND hWndAuthors;
1077
1078 switch (msg)
1079 {
1080 case WM_INITDIALOG:
1081 {
1083
1084 if (info)
1085 {
1086 HKEY hRegKey;
1087 MEMORYSTATUSEX MemStat;
1088 WCHAR szAppTitle[512];
1089 WCHAR szAppTitleTemplate[512];
1090 WCHAR szAuthorsText[20];
1091
1092 // Preload the ROS bitmap
1093 HMODULE hBrand = LoadLibraryExW(L"rosbrand.dll", NULL, LOAD_LIBRARY_AS_DATAFILE);
1094 if (hBrand)
1095 {
1096 hLogoBmp = LoadImage(hBrand,
1099 hLineBmp = LoadImage(hBrand,
1102 }
1103
1104 if (hLogoBmp && hLineBmp)
1105 {
1106 BITMAP bmpLogo;
1107
1108 GetObject(hLogoBmp, sizeof(BITMAP), &bmpLogo);
1109
1110 cxLogoBmp = bmpLogo.bmWidth;
1111 cyLogoBmp = bmpLogo.bmHeight;
1112
1113 GetObject(hLineBmp, sizeof(BITMAP), &bmpLogo);
1114 cyLineBmp = bmpLogo.bmHeight;
1115 }
1116
1117 // Set App-specific stuff (icon, app name, szOtherStuff string)
1119
1120 GetWindowTextW(hWnd, szAppTitleTemplate, ARRAY_SIZE(szAppTitleTemplate));
1121 swprintf(szAppTitle, szAppTitleTemplate, info->szApp);
1123
1127
1128 // Set the registered user and organization name
1129 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
1130 0, KEY_QUERY_VALUE, &hRegKey) == ERROR_SUCCESS)
1131 {
1132 SetRegTextData(hWnd, hRegKey, L"RegisteredOwner", IDC_ABOUT_REG_USERNAME);
1133 SetRegTextData(hWnd, hRegKey, L"RegisteredOrganization", IDC_ABOUT_REG_ORGNAME);
1134
1137 {
1139 }
1140
1141 RegCloseKey(hRegKey);
1142 }
1143
1144 // Set the value for the installed physical memory
1145 MemStat.dwLength = sizeof(MemStat);
1146 if (GlobalMemoryStatusEx(&MemStat))
1147 {
1148 WCHAR szBuf[12];
1149
1150 if (MemStat.ullTotalPhys > 1024 * 1024 * 1024)
1151 {
1152 double dTotalPhys;
1153 WCHAR szDecimalSeparator[4];
1154 WCHAR szUnits[3];
1155
1156 // We're dealing with GBs or more
1157 MemStat.ullTotalPhys /= 1024 * 1024;
1158
1159 if (MemStat.ullTotalPhys > 1024 * 1024)
1160 {
1161 // We're dealing with TBs or more
1162 MemStat.ullTotalPhys /= 1024;
1163
1164 if (MemStat.ullTotalPhys > 1024 * 1024)
1165 {
1166 // We're dealing with PBs or more
1167 MemStat.ullTotalPhys /= 1024;
1168
1169 dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1170 wcscpy(szUnits, L"PB");
1171 }
1172 else
1173 {
1174 dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1175 wcscpy(szUnits, L"TB");
1176 }
1177 }
1178 else
1179 {
1180 dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1181 wcscpy(szUnits, L"GB");
1182 }
1183
1184 // We need the decimal point of the current locale to display the RAM size correctly
1186 szDecimalSeparator,
1187 ARRAY_SIZE(szDecimalSeparator)) > 0)
1188 {
1189 UCHAR uDecimals;
1190 UINT uIntegral;
1191
1192 uIntegral = (UINT)dTotalPhys;
1193 uDecimals = (UCHAR)((UINT)(dTotalPhys * 100) - uIntegral * 100);
1194
1195 // Display the RAM size with 2 decimals
1196 swprintf(szBuf, L"%u%s%02u %s", uIntegral, szDecimalSeparator, uDecimals, szUnits);
1197 }
1198 }
1199 else
1200 {
1201 // We're dealing with MBs, don't show any decimals
1202 swprintf(szBuf, L"%u MB", (UINT)MemStat.ullTotalPhys / 1024 / 1024);
1203 }
1204
1206 }
1207
1208 // Add the Authors dialog
1210 LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, ARRAY_SIZE(szAuthorsText));
1211 SetDlgItemTextW(hWnd, IDC_ABOUT_AUTHORS, szAuthorsText);
1212 }
1213
1214 return TRUE;
1215 }
1216
1217 case WM_PAINT:
1218 {
1219 if (hLogoBmp && hLineBmp)
1220 {
1221 PAINTSTRUCT ps;
1222 HDC hdc;
1223 HDC hdcMem;
1224 HGDIOBJ hOldObj;
1225
1226 hdc = BeginPaint(hWnd, &ps);
1228
1229 if (hdcMem)
1230 {
1231 hOldObj = SelectObject(hdcMem, hLogoBmp);
1232 BitBlt(hdc, 0, 0, cxLogoBmp, cyLogoBmp, hdcMem, 0, 0, SRCCOPY);
1233
1234 SelectObject(hdcMem, hLineBmp);
1235 BitBlt(hdc, 0, cyLogoBmp, cxLogoBmp, cyLineBmp, hdcMem, 0, 0, SRCCOPY);
1236
1237 SelectObject(hdcMem, hOldObj);
1239 }
1240
1241 EndPaint(hWnd, &ps);
1242 }
1243 break;
1244 }
1245
1246 case WM_COMMAND:
1247 {
1248 switch(wParam)
1249 {
1250 case IDOK:
1251 case IDCANCEL:
1253 return TRUE;
1254
1255 case IDC_ABOUT_AUTHORS:
1256 {
1257 static BOOL bShowingAuthors = FALSE;
1258 WCHAR szAuthorsText[20];
1259
1260 if (bShowingAuthors)
1261 {
1262 LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, ARRAY_SIZE(szAuthorsText));
1263 ShowWindow(hWndAuthors, SW_HIDE);
1264 }
1265 else
1266 {
1267 LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_BACK, szAuthorsText, ARRAY_SIZE(szAuthorsText));
1268 ShowWindow(hWndAuthors, SW_SHOW);
1269 }
1270
1271 SetDlgItemTextW(hWnd, IDC_ABOUT_AUTHORS, szAuthorsText);
1272 bShowingAuthors = !bShowingAuthors;
1273 return TRUE;
1274 }
1275 }
1276 break;
1277 }
1278
1279 case WM_CLOSE:
1281 break;
1282 }
1283
1284#endif // __REACTOS__
1285
1286 return 0;
1287}
#define shell32_hInstance
#define IDC_ABOUT_ICON
Definition: resource.h:102
#define ARRAY_SIZE(A)
Definition: main.h:20
#define RegCloseKey(hKey)
Definition: registry.h:49
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1675
#define swprintf
Definition: precomp.h:40
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Height *Stride) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Stride)
Definition: common.c:42
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned int UINT
Definition: sysinfo.c:13
BOOL NTAPI GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer)
Definition: heapmem.c:1272
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:91
TCHAR szAppTitle[256]
Definition: mplay32.c:27
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019
#define LOCALE_USER_DEFAULT
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
#define WM_PAINT
Definition: winuser.h:1648
#define SW_HIDE
Definition: winuser.h:779
#define WM_CLOSE
Definition: winuser.h:1649
#define IMAGE_BITMAP
Definition: winuser.h:211
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define STM_SETICON
Definition: winuser.h:2128
#define IDCANCEL
Definition: winuser.h:842
#define WM_COMMAND
Definition: winuser.h:1768
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:841
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define CreateDialogW(h, n, w, f)
Definition: winuser.h:4435
#define LoadImage
Definition: winuser.h:5981
#define LR_DEFAULTCOLOR
Definition: winuser.h:1098
#define SW_SHOW
Definition: winuser.h:786
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define IDB_BRAND_BANNER
Definition: rosbrand.h:8
#define IDB_BRAND_BANNERLINE
Definition: rosbrand.h:9
wcscpy
#define LoadStringW
Definition: utils.h:64
#define UINT
Definition: utils.c:29
INT_PTR CALLBACK AboutAuthorsDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static VOID SetRegTextData(HWND hWnd, HKEY hKey, LPCWSTR Value, UINT uID)
#define IDC_ABOUT_REG_USERNAME
Definition: shresdef.h:417
#define IDC_ABOUT_REG_TO
Definition: shresdef.h:416
#define IDC_ABOUT_PHYSMEM
Definition: shresdef.h:419
#define IDC_ABOUT_APPNAME
Definition: shresdef.h:412
#define IDC_ABOUT_AUTHORS
Definition: shresdef.h:423
#define IDC_ABOUT_REG_ORGNAME
Definition: shresdef.h:418
#define IDC_ABOUT_VERSION
Definition: shresdef.h:414
#define IDC_ABOUT_OTHERSTUFF
Definition: shresdef.h:415
#define IDD_ABOUT_AUTHORS
Definition: shresdef.h:422
#define IDS_SHELL_ABOUT_BACK
Definition: shresdef.h:135
#define IDS_SHELL_ABOUT_AUTHORS
Definition: shresdef.h:134
LONG bmHeight
Definition: wingdi.h:1869
LONG bmWidth
Definition: wingdi.h:1868
unsigned char UCHAR
Definition: typedefs.h:53
HDC hdcMem
Definition: welcome.c:104
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1382
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:338
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define SRCCOPY
Definition: wingdi.h:333
#define GetObject
Definition: wingdi.h:4914
BOOL WINAPI DeleteDC(_In_ HDC)
#define LOCALE_SDECIMAL
Definition: winnls.h:52
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by ShellAboutW().

◆ CommandLineToArgvW()

LPWSTR *WINAPI CommandLineToArgvW ( LPCWSTR  lpCmdline,
int *  numargs 
)

Definition at line 80 of file shell32_main.c.

81{
82 DWORD argc;
83 LPWSTR *argv;
84 LPCWSTR s;
85 LPWSTR d;
87 int qcount,bcount;
88
89 if(!numargs)
90 {
92 return NULL;
93 }
94
95 if (*lpCmdline==0)
96 {
97 /* Return the path to the executable */
98 DWORD len, deslen=MAX_PATH, size;
99
100 size = sizeof(LPWSTR)*2 + deslen*sizeof(WCHAR);
101 for (;;)
102 {
103 if (!(argv = LocalAlloc(LMEM_FIXED, size))) return NULL;
104 len = GetModuleFileNameW(0, (LPWSTR)(argv+2), deslen);
105 if (!len)
106 {
108 return NULL;
109 }
110 if (len < deslen) break;
111 deslen*=2;
112 size = sizeof(LPWSTR)*2 + deslen*sizeof(WCHAR);
113 LocalFree( argv );
114 }
115 argv[0]=(LPWSTR)(argv+2);
116 argv[1]=NULL;
117 *numargs=1;
118
119 return argv;
120 }
121
122 /* --- First count the arguments */
123 argc=1;
124 s=lpCmdline;
125 /* The first argument, the executable path, follows special rules */
126 if (*s=='"')
127 {
128 /* The executable path ends at the next quote, no matter what */
129 s++;
130 while (*s)
131 if (*s++=='"')
132 break;
133 }
134 else
135 {
136 /* The executable path ends at the next space, no matter what */
137 while (*s && !isspace(*s))
138 s++;
139 }
140 /* skip to the first argument, if any */
141 while (isblank(*s))
142 s++;
143 if (*s)
144 argc++;
145
146 /* Analyze the remaining arguments */
147 qcount=bcount=0;
148 while (*s)
149 {
150 if (isblank(*s) && qcount==0)
151 {
152 /* skip to the next argument and count it if any */
153 while (isblank(*s))
154 s++;
155 if (*s)
156 argc++;
157 bcount=0;
158 }
159 else if (*s=='\\')
160 {
161 /* '\', count them */
162 bcount++;
163 s++;
164 }
165 else if (*s=='"')
166 {
167 /* '"' */
168 if ((bcount & 1)==0)
169 qcount++; /* unescaped '"' */
170 s++;
171 bcount=0;
172 /* consecutive quotes, see comment in copying code below */
173 while (*s=='"')
174 {
175 qcount++;
176 s++;
177 }
178 qcount=qcount % 3;
179 if (qcount==2)
180 qcount=0;
181 }
182 else
183 {
184 /* a regular character */
185 bcount=0;
186 s++;
187 }
188 }
189
190 /* Allocate in a single lump, the string array, and the strings that go
191 * with it. This way the caller can make a single LocalFree() call to free
192 * both, as per MSDN.
193 */
194 argv=LocalAlloc(LMEM_FIXED, (argc+1)*sizeof(LPWSTR)+(strlenW(lpCmdline)+1)*sizeof(WCHAR));
195 if (!argv)
196 return NULL;
197 cmdline=(LPWSTR)(argv+argc+1);
198 strcpyW(cmdline, lpCmdline);
199
200 /* --- Then split and copy the arguments */
201 argv[0]=d=cmdline;
202 argc=1;
203 /* The first argument, the executable path, follows special rules */
204 if (*d=='"')
205 {
206 /* The executable path ends at the next quote, no matter what */
207 s=d+1;
208 while (*s)
209 {
210 if (*s=='"')
211 {
212 s++;
213 break;
214 }
215 *d++=*s++;
216 }
217 }
218 else
219 {
220 /* The executable path ends at the next space, no matter what */
221 while (*d && !isspace(*d))
222 d++;
223 s=d;
224 if (*s)
225 s++;
226 }
227 /* close the executable path */
228 *d++=0;
229 /* skip to the first argument and initialize it if any */
230 while (isblank(*s))
231 s++;
232
233 if (!*s)
234 {
235 /* There are no parameters so we are all done */
236 argv[argc]=NULL;
237 *numargs=argc;
238 return argv;
239 }
240
241 /* Split and copy the remaining arguments */
242 argv[argc++]=d;
243 qcount=bcount=0;
244 while (*s)
245 {
246 if (isblank(*s) && qcount==0)
247 {
248 /* close the argument */
249 *d++=0;
250 bcount=0;
251
252 /* skip to the next one and initialize it if any */
253 do {
254 s++;
255 } while (isblank(*s));
256 if (*s)
257 argv[argc++]=d;
258 }
259 else if (*s=='\\')
260 {
261 *d++=*s++;
262 bcount++;
263 }
264 else if (*s=='"')
265 {
266 if ((bcount & 1)==0)
267 {
268 /* Preceded by an even number of '\', this is half that
269 * number of '\', plus a quote which we erase.
270 */
271 d-=bcount/2;
272 qcount++;
273 }
274 else
275 {
276 /* Preceded by an odd number of '\', this is half that
277 * number of '\' followed by a '"'
278 */
279 d=d-bcount/2-1;
280 *d++='"';
281 }
282 s++;
283 bcount=0;
284 /* Now count the number of consecutive quotes. Note that qcount
285 * already takes into account the opening quote if any, as well as
286 * the quote that lead us here.
287 */
288 while (*s=='"')
289 {
290 if (++qcount==3)
291 {
292 *d++='"';
293 qcount=0;
294 }
295 s++;
296 }
297 if (qcount==2)
298 qcount=0;
299 }
300 else
301 {
302 /* a regular character */
303 *d++=*s++;
304 bcount=0;
305 }
306 }
307 *d='\0';
308 argv[argc]=NULL;
309 *numargs=argc;
310
311 return argv;
312}
#define isspace(c)
Definition: acclib.h:69
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
MonoAssembly int argc
Definition: metahost.c:107
int CDECL isblank(int c)
Definition: ctype.c:409
GLdouble s
Definition: gl.h:2039
GLsizeiptr size
Definition: glext.h:5919
GLenum GLsizei len
Definition: glext.h:6722
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define d
Definition: ke_i.h:81
#define LMEM_FIXED
Definition: minwinbase.h:81
#define argv
Definition: mplay32.c:18
TCHAR * cmdline
Definition: stretchblt.cpp:32
const uint16_t * LPCWSTR
Definition: typedefs.h:57
uint16_t * LPWSTR
Definition: typedefs.h:56
#define strlenW(s)
Definition: unicode.h:28
#define strcpyW(d, s)
Definition: unicode.h:29

◆ DuplicateIcon()

HICON WINAPI DuplicateIcon ( HINSTANCE  hInstance,
HICON  hIcon 
)

Definition at line 838 of file shell32_main.c.

839{
841 HICON hDupIcon = 0;
842
843 TRACE("%p %p\n", hInstance, hIcon);
844
846 {
847 hDupIcon = CreateIconIndirect(&IconInfo);
848
849 /* clean up hbmMask and hbmColor */
852 }
853
854 return hDupIcon;
855}
HINSTANCE hInstance
Definition: charmap.c:19
pKey DeleteObject()
_Out_opt_ PICONINFO IconInfo
Definition: ntuser.h:2314
static HICON
Definition: imagelist.c:80
HICON hIcon
Definition: msconfig.c:44
HICON WINAPI CreateIconIndirect(_In_ PICONINFO)
Definition: cursoricon.c:2985
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2414
#define TRACE(s)
Definition: solgame.cpp:4
HBITMAP hbmColor
Definition: winuser.h:3235
HBITMAP hbmMask
Definition: winuser.h:3234

◆ ExtractIconA()

HICON WINAPI ExtractIconA ( HINSTANCE  hInstance,
LPCSTR  lpszFile,
UINT  nIconIndex 
)

Definition at line 860 of file shell32_main.c.

861{
862 HICON ret;
863 INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0);
864 LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
865
866 TRACE("%p %s %d\n", hInstance, lpszFile, nIconIndex);
867
868 MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len);
869 ret = ExtractIconW(hInstance, lpwstrFile, nIconIndex);
870 HeapFree(GetProcessHeap(), 0, lpwstrFile);
871
872 return ret;
873}
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
return ret
Definition: mutex.c:147
HICON WINAPI ExtractIconW(HINSTANCE hInstance, LPCWSTR lpszFile, UINT nIconIndex)
Definition: shell32_main.c:878
int32_t INT
Definition: typedefs.h:58

Referenced by test_ExtractIcon().

◆ ExtractIconW()

HICON WINAPI ExtractIconW ( HINSTANCE  hInstance,
LPCWSTR  lpszFile,
UINT  nIconIndex 
)

Definition at line 878 of file shell32_main.c.

879{
880 HICON hIcon = NULL;
881 UINT ret;
883
884 TRACE("%p %s %d\n", hInstance, debugstr_w(lpszFile), nIconIndex);
885
886 if (nIconIndex == (UINT)-1)
887 {
888 ret = PrivateExtractIconsW(lpszFile, 0, cx, cy, NULL, NULL, 0, LR_DEFAULTCOLOR);
889 if (ret != (UINT)-1 && ret)
890 return (HICON)(UINT_PTR)ret;
891 return NULL;
892 }
893 else
894 ret = PrivateExtractIconsW(lpszFile, nIconIndex, cx, cy, &hIcon, NULL, 1, LR_DEFAULTCOLOR);
895
896 if (ret == (UINT)-1)
897 return (HICON)1;
898 else if (ret > 0 && hIcon)
899 return hIcon;
900
901 return NULL;
902}
#define debugstr_w
Definition: kernel32.h:32
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
UINT WINAPI PrivateExtractIconsW(_In_reads_(MAX_PATH) LPCWSTR szFileName, _In_ int nIconIndex, _In_ int cxIcon, _In_ int cyIcon, _Out_writes_opt_(nIcons) HICON *phicon, _Out_writes_opt_(nIcons) UINT *piconid, _In_ UINT nIcons, _In_ UINT flags)
#define SM_CYICON
Definition: winuser.h:984
#define SM_CXICON
Definition: winuser.h:983
int WINAPI GetSystemMetrics(_In_ int)

Referenced by DlgInitHandler(), ExtractAssociatedIconW(), ExtractIconA(), ExtractIconWrapW(), and test_ExtractIcon().

◆ FreeIconList()

void WINAPI FreeIconList ( DWORD  dw)

Definition at line 1367 of file shell32_main.c.

1368{
1369 FIXME("%x: stub\n",dw);
1370}
#define FIXME(fmt,...)
Definition: precomp.h:53
REFIID LPVOID DWORD_PTR dw
Definition: atlbase.h:40

◆ Printer_LoadIconsW()

VOID WINAPI Printer_LoadIconsW ( LPCWSTR  wsPrinterName,
HICON *  pLargeIcon,
HICON *  pSmallIcon 
)

Definition at line 907 of file shell32_main.c.

908{
910
911 TRACE("(%s, %p, %p)\n", debugstr_w(wsPrinterName), pLargeIcon, pSmallIcon);
912
913 /* We should check if wsPrinterName is
914 1. the Default Printer or not
915 2. connected or not
916 3. a Local Printer or a Network-Printer
917 and use different Icons
918 */
919 if((wsPrinterName != NULL) && (wsPrinterName[0] != 0))
920 {
921 FIXME("(select Icon by PrinterName %s not implemented)\n", debugstr_w(wsPrinterName));
922 }
923
924 if(pLargeIcon != NULL)
925 *pLargeIcon = LoadImageW(shell32_hInstance,
926 (LPCWSTR) MAKEINTRESOURCE(iconindex), IMAGE_ICON,
928
929 if(pSmallIcon != NULL)
930 *pSmallIcon = LoadImageW(shell32_hInstance,
931 (LPCWSTR) MAKEINTRESOURCE(iconindex), IMAGE_ICON,
932 16, 16, LR_DEFAULTCOLOR);
933}
#define IMAGE_ICON
Definition: winuser.h:212
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2572
#define LR_DEFAULTSIZE
Definition: winuser.h:1105
#define IDI_SHELL_PRINTERS_FOLDER
Definition: shresdef.h:629

◆ Printers_RegisterWindowW()

BOOL WINAPI Printers_RegisterWindowW ( LPCWSTR  wsPrinter,
DWORD  dwType,
HANDLE *  phClassPidl,
HWND *  phwnd 
)

Definition at line 941 of file shell32_main.c.

943{
944 FIXME("(%s, %x, %p (%p), %p (%p)) stub!\n", debugstr_w(wsPrinter), dwType,
945 phClassPidl, (phClassPidl != NULL) ? *(phClassPidl) : NULL,
946 phwnd, (phwnd != NULL) ? *(phwnd) : NULL);
947
948 return FALSE;
949}

◆ Printers_UnregisterWindow()

VOID WINAPI Printers_UnregisterWindow ( HANDLE  hClassPidl,
HWND  hwnd 
)

Definition at line 954 of file shell32_main.c.

955{
956 FIXME("(%p, %p) stub!\n", hClassPidl, hwnd);
957}
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

◆ SetRegTextData()

static VOID SetRegTextData ( HWND  hWnd,
HKEY  hKey,
LPCWSTR  Value,
UINT  uID 
)
static

Definition at line 1012 of file shell32_main.c.

1013{
1014 DWORD dwBufferSize;
1015 DWORD dwType;
1017
1018 if( RegQueryValueExW(hKey, Value, NULL, &dwType, NULL, &dwBufferSize) == ERROR_SUCCESS )
1019 {
1020 if(dwType == REG_SZ)
1021 {
1022 lpBuffer = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, dwBufferSize);
1023
1024 if(lpBuffer)
1025 {
1026 if( RegQueryValueExW(hKey, Value, NULL, &dwType, (LPBYTE)lpBuffer, &dwBufferSize) == ERROR_SUCCESS )
1027 {
1029 }
1030
1032 }
1033 }
1034 }
1035}
#define REG_SZ
Definition: layer.c:22
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
FxAutoRegKey hKey
_Out_ LPWSTR lpBuffer
Definition: netsh.h:68
_In_ UINT uID
Definition: shlwapi.h:156
unsigned char * LPBYTE
Definition: typedefs.h:53
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

Referenced by AboutDlgProc().

◆ SHELL_GetDetailsOfToBuffer()

static HRESULT SHELL_GetDetailsOfToBuffer ( IShellFolder *  psf,
PCUITEMID_CHILD  pidl,
UINT  col,
LPWSTR  Buf,
UINT  cchBuf 
)
static

Definition at line 314 of file shell32_main.c.

316{
317 IShellFolder2 *psf2;
318 IShellDetails *psd;
320 HRESULT hr = IShellFolder_QueryInterface(psf, &IID_IShellFolder2, (void**)&psf2);
321 if (SUCCEEDED(hr))
322 {
323 hr = IShellFolder2_GetDetailsOf(psf2, pidl, col, &details);
324 IShellFolder2_Release(psf2);
325 }
326 else if (SUCCEEDED(hr = IShellFolder_QueryInterface(psf, &IID_IShellDetails, (void**)&psd)))
327 {
328 hr = IShellDetails_GetDetailsOf(psd, pidl, col, &details);
330 }
331 if (SUCCEEDED(hr))
332 hr = StrRetToStrNW(Buf, cchBuf, &details.str, pidl) ? S_OK : E_FAIL;
333 return hr;
334}
#define E_FAIL
Definition: ddrawi.h:102
HRESULT hr
Definition: delayimp.cpp:582
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
int details
Definition: msacm.c:1366
_In_ UINT cchBuf
Definition: shlwapi.h:378
BOOL WINAPI StrRetToStrNW(LPWSTR dest, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl)
Definition: shellstring.c:85
#define IShellDetails_Release(p)
Definition: shlobj.h:669
#define IShellDetails_GetDetailsOf(p, a, b, c)
Definition: shlobj.h:671

Referenced by SHGetFileInfoW().

◆ SHELL_IsShortcut()

BOOL SHELL_IsShortcut ( LPCITEMIDLIST  pidlLast)

Definition at line 405 of file shell32_main.c.

406{
407 WCHAR szTemp[MAX_PATH];
408 HKEY keyCls;
409 BOOL ret = FALSE;
410
411 if (_ILGetExtension(pidlLast, szTemp, _countof(szTemp)) &&
413 {
414 ret = RegQueryValueExW(keyCls, L"IsShortcut", NULL, NULL, NULL, NULL) == ERROR_SUCCESS;
415 RegCloseKey(keyCls);
416 }
417 return ret;
418}
BOOL _ILGetExtension(LPCITEMIDLIST pidl, LPWSTR pOut, UINT uOutSize)
Definition: pidl.c:2540
HRESULT HCR_GetProgIdKeyOfExtension(PCWSTR szExtension, PHKEY phKey, BOOL AllowFallback)
Definition: classes.c:55
#define _countof(array)
Definition: sndvol32.h:70

Referenced by SHGetFileInfoW(), and SHMapPIDLToSystemImageListIndex().

◆ ShellAboutA()

BOOL WINAPI ShellAboutA ( HWND  hWnd,
LPCSTR  szApp,
LPCSTR  szOtherStuff,
HICON  hIcon 
)

Definition at line 1293 of file shell32_main.c.

1294{
1295 BOOL ret;
1296 LPWSTR appW = NULL, otherW = NULL;
1297 int len;
1298
1299 if (szApp)
1300 {
1301 len = MultiByteToWideChar(CP_ACP, 0, szApp, -1, NULL, 0);
1302 appW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1303 MultiByteToWideChar(CP_ACP, 0, szApp, -1, appW, len);
1304 }
1305 if (szOtherStuff)
1306 {
1307 len = MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, NULL, 0);
1308 otherW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1309 MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, otherW, len);
1310 }
1311
1312 ret = ShellAboutW(hWnd, appW, otherW, hIcon);
1313
1314 HeapFree(GetProcessHeap(), 0, otherW);
1315 HeapFree(GetProcessHeap(), 0, appW);
1316 return ret;
1317}
BOOL WINAPI ShellAboutW(HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HICON hIcon)

◆ ShellAboutW()

BOOL WINAPI ShellAboutW ( HWND  hWnd,
LPCWSTR  szApp,
LPCWSTR  szOtherStuff,
HICON  hIcon 
)

Definition at line 1323 of file shell32_main.c.

1325{
1327 HRSRC hRes;
1328 DLGTEMPLATE *DlgTemplate;
1329 BOOL bRet;
1330#ifdef __REACTOS__
1331 WCHAR szVersionString[256];
1332 WCHAR szFormat[256];
1333#endif
1334
1335 TRACE("\n");
1336
1337 // DialogBoxIndirectParamW will be called with the hInstance of the calling application, so we have to preload the dialog template
1339 if(!hRes)
1340 return FALSE;
1341
1342 DlgTemplate = (DLGTEMPLATE *)LoadResource(shell32_hInstance, hRes);
1343 if(!DlgTemplate)
1344 return FALSE;
1345
1346#ifdef __REACTOS__
1347 /* Output the version OS kernel strings */
1349 StringCchPrintfW(szVersionString, _countof(szVersionString), szFormat, KERNEL_VERSION_STR, KERNEL_VERSION_BUILD_STR);
1350#endif
1351
1352 info.szApp = szApp;
1353#ifdef __REACTOS__
1354 info.szOSVersion = szVersionString;
1355#endif
1356 info.szOtherStuff = szOtherStuff;
1357 info.hIcon = hIcon ? hIcon : LoadIconW( 0, (LPWSTR)IDI_WINLOGO );
1358
1360 DlgTemplate, hWnd, AboutDlgProc, (LPARAM)&info );
1361 return bRet;
1362}
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
#define RT_DIALOG
Definition: pedump.c:367
#define GetWindowLongPtrW
Definition: winuser.h:4983
INT_PTR WINAPI DialogBoxIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define GWLP_HINSTANCE
Definition: winuser.h:867
#define IDI_WINLOGO
Definition: winuser.h:717
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2444
static INT_PTR CALLBACK AboutDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
#define IDD_ABOUT
Definition: shresdef.h:410
#define IDS_ABOUT_VERSION_STRING
Definition: shresdef.h:413
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530

Referenced by Control_WndProc(), dialog_about(), ie_dialog_about(), MACRO_About(), MAIN_MenuCommand(), MainProc(), MainWndCommand(), OnAbout(), CDeviceManager::OnCommand(), OnCommand(), CMainWindow::OnCommand(), CMainWnd::OnHelpAboutMMC(), OSK_About(), ShellAboutA(), ShowAboutBox(), CMainWindow::ShowAboutDlg(), ShowAboutDlg(), WndProc(), and wWinMain().

◆ SHGetFileInfoA()

DWORD_PTR WINAPI SHGetFileInfoA ( LPCSTR  path,
DWORD  dwFileAttributes,
SHFILEINFOA *  psfi,
UINT  sizeofpsfi,
UINT  flags 
)

Definition at line 787 of file shell32_main.c.

790{
791 INT len;
792 LPWSTR temppath = NULL;
795 SHFILEINFOW temppsfi;
796
797 if (flags & SHGFI_PIDL)
798 {
799 /* path contains a pidl */
800 pathW = (LPCWSTR)path;
801 }
802 else
803 {
804 len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
805 temppath = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
806 MultiByteToWideChar(CP_ACP, 0, path, -1, temppath, len);
807 pathW = temppath;
808 }
809
810 if (psfi)
811 {
812 temppsfi.hIcon = psfi->hIcon;
813 temppsfi.iIcon = psfi->iIcon;
814 temppsfi.dwAttributes = psfi->dwAttributes;
815
816 ret = SHGetFileInfoW(pathW, dwFileAttributes, &temppsfi, sizeof(temppsfi), flags);
817 psfi->hIcon = temppsfi.hIcon;
818 psfi->iIcon = temppsfi.iIcon;
819 psfi->dwAttributes = temppsfi.dwAttributes;
820
822 psfi->szDisplayName, sizeof(psfi->szDisplayName), NULL, NULL);
823
824 WideCharToMultiByte(CP_ACP, 0, temppsfi.szTypeName, -1,
825 psfi->szTypeName, sizeof(psfi->szTypeName), NULL, NULL);
826 }
827 else
829
830 HeapFree(GetProcessHeap(), 0, temppath);
831
832 return ret;
833}
DWORD dwFileAttributes
#define WideCharToMultiByte
Definition: compat.h:111
GLbitfield flags
Definition: glext.h:7161
static const WCHAR pathW[]
Definition: path.c:2368
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:431
CHAR szTypeName[80]
Definition: shellapi.h:381
HICON hIcon
Definition: shellapi.h:377
DWORD dwAttributes
Definition: shellapi.h:379
CHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:380
WCHAR szTypeName[80]
Definition: shellapi.h:388
DWORD dwAttributes
Definition: shellapi.h:386
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:387
HICON hIcon
Definition: shellapi.h:384
uint32_t DWORD_PTR
Definition: typedefs.h:65

Referenced by test_get_file_info(), and test_get_file_info_iconlist().

◆ SHGetFileInfoW()

DWORD_PTR WINAPI SHGetFileInfoW ( LPCWSTR  path,
DWORD  dwFileAttributes,
SHFILEINFOW *  psfi,
UINT  sizeofpsfi,
UINT  flags 
)

Definition at line 431 of file shell32_main.c.

433{
434 WCHAR szLocation[MAX_PATH], szFullPath[MAX_PATH];
435 int iIndex;
438 IShellFolder * psfParent = NULL;
439 IExtractIconW * pei = NULL;
440 LPITEMIDLIST pidlLast = NULL, pidl = NULL, pidlFree = NULL;
441 HRESULT hr = S_OK;
442 BOOL IconNotYetLoaded=TRUE;
443 UINT uGilFlags = 0;
444 HIMAGELIST big_icons, small_icons;
445
446 TRACE("%s fattr=0x%x sfi=%p(attr=0x%08x) size=0x%x flags=0x%x\n",
448 psfi, psfi ? psfi->dwAttributes : 0, sizeofpsfi, flags);
449
450 if (!path)
451 return FALSE;
452
453 /* windows initializes these values regardless of the flags */
454 if (psfi != NULL)
455 {
456 psfi->szDisplayName[0] = '\0';
457 psfi->szTypeName[0] = '\0';
458 psfi->hIcon = NULL;
459 }
460
461 if (!(flags & SHGFI_PIDL))
462 {
463 /* SHGetFileInfo should work with absolute and relative paths */
465 {
466 GetCurrentDirectoryW(MAX_PATH, szLocation);
467 PathCombineW(szFullPath, szLocation, path);
468 }
469 else
470 {
471 lstrcpynW(szFullPath, path, MAX_PATH);
472 }
473
474 if ((flags & SHGFI_TYPENAME) && !PathIsRootW(szFullPath))
475 {
476 HRESULT hr2;
478 {
482 }
485 else
487 if (SUCCEEDED(hr2))
488 {
489 flags &= ~SHGFI_TYPENAME;
491 return ret; /* Bail out early if this was our only operation */
492 }
493 }
494 }
495 else
496 {
498 }
499
500 if (flags & SHGFI_EXETYPE)
501 {
502 if (!(flags & SHGFI_SYSICONINDEX))
503 {
505 {
506 return TRUE;
507 }
508 else if (GetFileAttributesW(szFullPath) != INVALID_FILE_ATTRIBUTES)
509 {
510 return shgfi_get_exe_type(szFullPath);
511 }
512 }
513 }
514
515 /*
516 * psfi is NULL normally to query EXE type. If it is NULL, none of the
517 * below makes sense anyway. Windows allows this and just returns FALSE
518 */
519 if (psfi == NULL)
520 return FALSE;
521
522 /*
523 * translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES
524 * is not specified.
525 * The pidl functions fail on not existing file names
526 */
527
528 if (flags & SHGFI_PIDL)
529 {
530 pidl = (LPITEMIDLIST)path;
531 hr = pidl ? S_OK : E_FAIL;
532 }
533 else
534 {
536 {
538 hr = pidl ? S_OK : E_FAIL;
539 }
540 else
541 {
542 hr = SHILCreateFromPathW(szFullPath, &pidl, &dwAttributes);
543 }
544 pidlFree = pidl;
545 }
546
547 if (SUCCEEDED(hr))
548 {
549 hr = SHBindToParent(pidl, &IID_IShellFolder, (void**)&psfParent, (LPCITEMIDLIST*)&pidlLast);
550 }
551
552 /* get the attributes of the child */
554 {
556 {
557 psfi->dwAttributes = 0xffffffff;
558 }
559 hr = IShellFolder_GetAttributesOf(psfParent, 1, (LPCITEMIDLIST*)&pidlLast, &psfi->dwAttributes);
560 }
561
563 {
564 if (flags & SHGFI_ICON)
565 {
566 psfi->dwAttributes = 0;
567 }
568 }
569
570 /* get the displayname */
572 {
573 STRRET str;
574 psfi->szDisplayName[0] = UNICODE_NULL;
575 hr = IShellFolder_GetDisplayNameOf(psfParent, pidlLast, SHGDN_INFOLDER, &str);
576 if (SUCCEEDED(hr))
577 StrRetToStrNW(psfi->szDisplayName, _countof(psfi->szDisplayName), &str, pidlLast);
578 }
579
580 /* get the type name */
581 if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
582 {
583 /* FIXME: Use IShellFolder2::GetDetailsEx */
584 UINT col = _ILIsDrive(pidlLast) ? 1 : 2; /* SHFSF_COL_TYPE */
585 psfi->szTypeName[0] = UNICODE_NULL;
586 hr = SHELL_GetDetailsOfToBuffer(psfParent, pidlLast, col, psfi->szTypeName, _countof(psfi->szTypeName));
587 }
588
589 /* ### icons ###*/
590
591 Shell_GetImageLists( &big_icons, &small_icons );
592
593 if (flags & SHGFI_OPENICON)
594 uGilFlags |= GIL_OPENICON;
595
597 uGilFlags |= GIL_FORSHORTCUT;
598 else if ((flags&SHGFI_ADDOVERLAYS) ||
600 {
601 if (SHELL_IsShortcut(pidlLast))
602 uGilFlags |= GIL_FORSHORTCUT;
603 }
604
606 FIXME("SHGFI_OVERLAYINDEX unhandled\n");
607
608 if (flags & SHGFI_SELECTED)
609 FIXME("set icon to selected, stub\n");
610
611 /* get the iconlocation */
613 {
614 UINT uDummy,uFlags;
615
617 {
619 {
621 psfi->iIcon = -IDI_SHELL_FOLDER;
622 }
623 else
624 {
625 WCHAR* szExt;
626 WCHAR sTemp [MAX_PATH];
627
628 szExt = PathFindExtensionW(szFullPath);
629 TRACE("szExt=%s\n", debugstr_w(szExt));
630 if ( szExt &&
631 HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
632 HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &psfi->iIcon))
633 {
634 if (lstrcmpW(L"%1", sTemp))
635 strcpyW(psfi->szDisplayName, sTemp);
636 else
637 {
638 /* the icon is in the file */
639 strcpyW(psfi->szDisplayName, szFullPath);
640 }
641 }
642 else
643 ret = FALSE;
644 }
645 }
646 else if (psfParent)
647 {
648 hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1,
649 (LPCITEMIDLIST*)&pidlLast, &IID_IExtractIconW,
650 &uDummy, (LPVOID*)&pei);
651 if (SUCCEEDED(hr))
652 {
653 hr = IExtractIconW_GetIconLocation(pei, uGilFlags,
654 szLocation, MAX_PATH, &iIndex, &uFlags);
655
656 if (uFlags & GIL_NOTFILENAME)
657 ret = FALSE;
658 else
659 {
660 lstrcpyW (psfi->szDisplayName, szLocation);
661 psfi->iIcon = iIndex;
662 }
663 IExtractIconW_Release(pei);
664 }
665 }
666 }
667
668 /* get icon index (or load icon)*/
670 {
672 {
673 WCHAR sTemp [MAX_PATH];
674 WCHAR * szExt;
675 int icon_idx=0;
676
677 lstrcpynW(sTemp, szFullPath, MAX_PATH);
678
681 else
682 {
683 psfi->iIcon = 0;
684 szExt = PathFindExtensionW(sTemp);
685 if ( szExt &&
686 HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
687 HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &icon_idx))
688 {
689 if (!lstrcmpW(L"%1",sTemp)) /* icon is in the file */
690 strcpyW(sTemp, szFullPath);
691
693 {
694 psfi->iIcon = SIC_GetIconIndex(sTemp,icon_idx,0);
695 if (psfi->iIcon == -1)
696 psfi->iIcon = 0;
697 }
698 else
699 {
700 UINT ret;
701 INT cxIcon, cyIcon;
702
703 /* Get icon size */
705 {
707 cxIcon = cyIcon = ShellSmallIconSize;
708 else
709 cxIcon = cyIcon = ShellLargeIconSize;
710 }
711 else
712 {
714 {
717 }
718 else
719 {
720 cxIcon = GetSystemMetrics(SM_CXICON);
721 cyIcon = GetSystemMetrics(SM_CYICON);
722 }
723 }
724
725 ret = PrivateExtractIconsW(sTemp, icon_idx, cxIcon, cyIcon,
726 &psfi->hIcon, 0, 1, 0);
727 if (ret != 0 && ret != (UINT)-1)
728 {
729 IconNotYetLoaded=FALSE;
730 psfi->iIcon = icon_idx;
731 }
732 }
733 }
734 }
735 }
736 else if (psfParent)
737 {
738 if (!(PidlToSicIndex(psfParent, pidlLast, !(flags & SHGFI_SMALLICON),
739 uGilFlags, &(psfi->iIcon))))
740 {
741 ret = FALSE;
742 }
743 }
744 if (ret && (flags & SHGFI_SYSICONINDEX))
745 {
747 ret = (DWORD_PTR)small_icons;
748 else
749 ret = (DWORD_PTR)big_icons;
750 }
751 }
752
753 /* icon handle */
754 if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded)
755 {
757 psfi->hIcon = ImageList_GetIcon( small_icons, psfi->iIcon, ILD_NORMAL);
758 else
759 psfi->hIcon = ImageList_GetIcon( big_icons, psfi->iIcon, ILD_NORMAL);
760 }
761
763 FIXME("unknown flags %08x\n", flags & ~SHGFI_KNOWN_FLAGS);
764
765 if (psfParent)
766 IShellFolder_Release(psfParent);
767 SHFree(pidlFree);
768
769 if (hr != S_OK)
770 ret = FALSE;
771
772 TRACE ("icon=%p index=0x%08x attr=0x%08x name=%s type=%s ret=0x%08lx\n",
773 psfi->hIcon, psfi->iIcon, psfi->dwAttributes,
775
776 return ret;
777}
EXTERN_C HRESULT SHELL32_AssocGetFileDescription(PCWSTR Name, PWSTR Buf, UINT cchBuf)
EXTERN_C HRESULT SHELL32_AssocGetFSDirectoryDescription(PWSTR Buf, UINT cchBuf)
#define IDI_SHELL_FOLDER
Definition: treeview.c:21
UINT uFlags
Definition: api.c:59
HICON WINAPI ImageList_GetIcon(HIMAGELIST himl, INT i, UINT fStyle)
Definition: imagelist.c:1981
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:756
#define lstrcpyW
Definition: compat.h:749
#define lstrcpynW
Definition: compat.h:738
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:636
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
LPWSTR WINAPI PathFindExtensionW(const WCHAR *path)
Definition: path.c:1250
BOOL WINAPI PathIsRelativeW(const WCHAR *path)
Definition: path.c:1006
BOOL WINAPI PathIsRootW(const WCHAR *path)
Definition: path.c:1077
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:370
#define IShellFolder_GetDisplayNameOf
Definition: utils.cpp:13
WCHAR swShell32Name[MAX_PATH]
Definition: folders.cpp:22
INT ShellSmallIconSize
Definition: iconcache.cpp:30
INT SIC_GetIconIndex(LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags)
Definition: iconcache.cpp:474
BOOL PidlToSicIndex(IShellFolder *sh, LPCITEMIDLIST pidl, BOOL bBigIcon, UINT uFlags, int *pIndex)
Definition: iconcache.cpp:715
BOOL WINAPI Shell_GetImageLists(HIMAGELIST *lpBigList, HIMAGELIST *lpSmallList)
Definition: iconcache.cpp:689
INT ShellLargeIconSize
Definition: iconcache.cpp:31
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define UNICODE_NULL
#define PathCombineW
Definition: pathcch.h:318
HRESULT WINAPI SHILCreateFromPathW(LPCWSTR path, LPITEMIDLIST *ppidl, DWORD *attributes)
Definition: pidl.c:404
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1504
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1496
LPITEMIDLIST SHELL32_CreateSimpleIDListFromPath(LPCWSTR pszPath, DWORD dwAttributes)
Definition: pidl.c:1195
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:2139
#define ILD_NORMAL
Definition: commctrl.h:417
#define SM_CYSMICON
Definition: winuser.h:1024
#define SM_CXSMICON
Definition: winuser.h:1023
const WCHAR * str
BOOL HCR_GetIconW(LPCWSTR szClass, LPWSTR szDest, LPCWSTR szName, DWORD len, int *picon_idx)
Definition: classes.c:318
BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, LONG len, BOOL bPrependDot)
Definition: classes.c:82
BOOL SHELL_IsShortcut(LPCITEMIDLIST pidlLast)
Definition: shell32_main.c:405
#define SHGFI_KNOWN_FLAGS
Definition: shell32_main.c:420
static DWORD shgfi_get_exe_type(LPCWSTR szFullPath)
Definition: shell32_main.c:336
static HRESULT SHELL_GetDetailsOfToBuffer(IShellFolder *psf, PCUITEMID_CHILD pidl, UINT col, LPWSTR Buf, UINT cchBuf)
Definition: shell32_main.c:314
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define DWORD_PTR
Definition: treelist.c:76
DWORD dwAttributes
Definition: vdmdbg.h:34
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23

Referenced by AddListViewItems(), CShellMenuCallback::AddOrSetMenuItem(), BrFolder_OnOK(), ClassifyFile(), CFSFolder::CompareIDs(), FILEDLG95_InitControls(), FILEDLG95_LOOKIN_AddItem(), FILEDLG95_LOOKIN_DrawItem(), GetAssocClass(), CZipFolder::GetDetailsOf(), CZipFolder::GetDisplayNameOf(), COpenWithList::GetIcon(), GetItemTypeName(), GetTypeDescriptionByPath(), GetTypeName(), CFileDefExt::InitFileType(), CSearchBar::Invoke(), CSendToMenu::LoadAllItems(), CNewMenu::LoadItem(), CShellLink::OnCommand(), CShellLink::OnInitDialog(), CSearchBar::OnLocationEditChange(), ProcessDirStatsItem(), QueryFileDescription(), SHCreateFileExtractIconW(), SHELL_CreatePropSheetStubWindow(), SHGetFileInfoA(), SHGetFileInfoWrapW(), SHGetPidlInfo(), SHGFI(), START_TEST(), test_get_file_info(), test_get_file_info_iconlist(), and WelcomeDlgProc().

◆ shgfi_get_exe_type()

static DWORD shgfi_get_exe_type ( LPCWSTR  szFullPath)
static

Definition at line 336 of file shell32_main.c.

337{
338 BOOL status = FALSE;
339 HANDLE hfile;
340 DWORD BinaryType;
341 IMAGE_DOS_HEADER mz_header;
343 DWORD len;
344 char magic[4];
345
346 status = GetBinaryTypeW (szFullPath, &BinaryType);
347 if (!status)
348 return 0;
349 if (BinaryType == SCS_DOS_BINARY || BinaryType == SCS_PIF_BINARY)
350 return 0x4d5a;
351
352 hfile = CreateFileW( szFullPath, GENERIC_READ, FILE_SHARE_READ,
353 NULL, OPEN_EXISTING, 0, 0 );
354 if ( hfile == INVALID_HANDLE_VALUE )
355 return 0;
356
357 /*
358 * The next section is adapted from MODULE_GetBinaryType, as we need
359 * to examine the image header to get OS and version information. We
360 * know from calling GetBinaryTypeA that the image is valid and either
361 * an NE or PE, so much error handling can be omitted.
362 * Seek to the start of the file and read the header information.
363 */
364
365 SetFilePointer( hfile, 0, NULL, SEEK_SET );
366 ReadFile( hfile, &mz_header, sizeof(mz_header), &len, NULL );
367
368 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
369 ReadFile( hfile, magic, sizeof(magic), &len, NULL );
370 if ( *(DWORD*)magic == IMAGE_NT_SIGNATURE )
371 {
372 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
373 ReadFile( hfile, &nt, sizeof(nt), &len, NULL );
374 CloseHandle( hfile );
375 /* DLL files are not executable and should return 0 */
377 return 0;
379 {
380 return IMAGE_NT_SIGNATURE |
383 }
384 return IMAGE_NT_SIGNATURE;
385 }
386 else if ( *(WORD*)magic == IMAGE_OS2_SIGNATURE )
387 {
389 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
390 ReadFile( hfile, &ne, sizeof(ne), &len, NULL );
391 CloseHandle( hfile );
392 if (ne.ne_exetyp == 2)
393 return IMAGE_OS2_SIGNATURE | (ne.ne_expver << 16);
394 return 0;
395 }
396 CloseHandle( hfile );
397 return 0;
398}
PIMAGE_NT_HEADERS nt
Definition: delayimp.cpp:445
#define CloseHandle
Definition: compat.h:739
#define OPEN_EXISTING
Definition: compat.h:775
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define SetFilePointer
Definition: compat.h:743
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:741
#define FILE_SHARE_READ
Definition: compat.h:136
BOOL WINAPI GetBinaryTypeW(LPCWSTR lpApplicationName, LPDWORD lpBinaryType)
Definition: vdm.c:1243
unsigned short WORD
Definition: ntddk_ex.h:93
#define SEEK_SET
Definition: jmemansi.c:26
#define IMAGE_SUBSYSTEM_WINDOWS_GUI
Definition: ntimage.h:437
#define IMAGE_NT_SIGNATURE
Definition: pedump.c:93
#define IMAGE_FILE_DLL
Definition: pedump.c:169
#define IMAGE_OS2_SIGNATURE
Definition: pedump.c:90
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
IMAGE_FILE_HEADER FileHeader
Definition: ntddk_ex.h:183
Definition: ps.c:97
#define SCS_PIF_BINARY
Definition: winbase.h:265
#define SCS_DOS_BINARY
Definition: winbase.h:263

Referenced by SHGetFileInfoW().

◆ SHHelpShortcuts_RunDLLA()

DWORD WINAPI SHHelpShortcuts_RunDLLA ( DWORD  dwArg1,
DWORD  dwArg2,
DWORD  dwArg3,
DWORD  dwArg4 
)

Definition at line 975 of file shell32_main.c.

976{
977 FIXME("(%x, %x, %x, %x) stub!\n", dwArg1, dwArg2, dwArg3, dwArg4);
978 return 0;
979}

◆ SHHelpShortcuts_RunDLLW()

DWORD WINAPI SHHelpShortcuts_RunDLLW ( DWORD  dwArg1,
DWORD  dwArg2,
DWORD  dwArg3,
DWORD  dwArg4 
)

Definition at line 985 of file shell32_main.c.

986{
987 FIXME("(%x, %x, %x, %x) stub!\n", dwArg1, dwArg2, dwArg3, dwArg4);
988 return 0;
989}

◆ SHLoadInProc()

HRESULT WINAPI SHLoadInProc ( REFCLSID  rclsid)

Definition at line 996 of file shell32_main.c.

997{
998 void *ptr = NULL;
999
1000 TRACE("%s\n", debugstr_guid(rclsid));
1001
1002 CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,&ptr);
1003 if(ptr)
1004 {
1005 IUnknown * pUnk = ptr;
1006 IUnknown_Release(pUnk);
1007 return S_OK;
1008 }
1009 return DISP_E_MEMBERNOTFOUND;
1010}
const GUID IID_IUnknown
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:41
#define debugstr_guid
Definition: kernel32.h:35
static PVOID ptr
Definition: dispmode.c:27
#define DISP_E_MEMBERNOTFOUND
Definition: winerror.h:3615

◆ SHLoadNonloadedIconOverlayIdentifiers()

HRESULT WINAPI SHLoadNonloadedIconOverlayIdentifiers ( VOID  )

Definition at line 1375 of file shell32_main.c.

1376{
1377 FIXME("stub\n");
1378 return S_OK;
1379}

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ SHELL_Authors

const char* const SHELL_Authors[] = { "Copyright 1993-"COPYRIGHT_YEAR" WINE team", "Copyright 1998-"COPYRIGHT_YEAR" ReactOS Team", 0 }

Definition at line 51 of file shell32_main.c.

Referenced by AboutAuthorsDlgProc().