ReactOS 0.4.16-dev-981-g80eb313
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 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_ADDOVERLAYS
Definition: entries.h:77
#define SHGFI_ATTR_SPECIFIED
Definition: shellapi.h:175
#define SHGFI_OPENICON
Definition: shellapi.h:179
#define SHGFI_LINKOVERLAY
Definition: shellapi.h:173
#define SHGFI_SYSICONINDEX
Definition: shellapi.h:172
#define SHGFI_ICONLOCATION
Definition: shellapi.h:170
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:167
#define SHGFI_ICON
Definition: shellapi.h:165
#define SHGFI_TYPENAME
Definition: shellapi.h:168
#define SHGFI_USEFILEATTRIBUTES
Definition: shellapi.h:182
#define SHGFI_ATTRIBUTES
Definition: shellapi.h:169
#define SHGFI_SMALLICON
Definition: shellapi.h:177
#define SHGFI_SELECTED
Definition: shellapi.h:174
#define SHGFI_OVERLAYINDEX
Definition: shellapi.h:164
#define SHGFI_PIDL
Definition: shellapi.h:181
#define SHGFI_EXETYPE
Definition: shellapi.h:171
#define SHGFI_SHELLICONSIZE
Definition: shellapi.h:180

Definition at line 419 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 1036 of file shell32_main.c.

1037{
1038 switch(msg)
1039 {
1040 case WM_INITDIALOG:
1041 {
1042 const char* const *pstr = SHELL_Authors;
1043
1044 // Add the authors to the list
1046
1047 while (*pstr)
1048 {
1049 WCHAR name[64];
1050
1051 /* authors list is in utf-8 format */
1052 MultiByteToWideChar( CP_UTF8, 0, *pstr, -1, name, sizeof(name)/sizeof(WCHAR) );
1054 pstr++;
1055 }
1056
1058
1059 return TRUE;
1060 }
1061 }
1062
1063 return FALSE;
1064}
#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
#define CP_UTF8
Definition: nls.h:20
const char *const SHELL_Authors[]
Definition: shell32_main.c:50
#define IDC_ABOUT_AUTHORS_LISTBOX
Definition: shresdef.h:410
Definition: name.c:39
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define WM_INITDIALOG
Definition: winuser.h:1750
#define LB_ADDSTRING
Definition: winuser.h:2042
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETREDRAW
Definition: winuser.h:1627
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by AboutDlgProc().

◆ AboutDlgProc()

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

Definition at line 1068 of file shell32_main.c.

1069{
1070#ifdef __REACTOS__
1071
1072 static DWORD cxLogoBmp;
1073 static DWORD cyLogoBmp, cyLineBmp;
1074 static HBITMAP hLogoBmp, hLineBmp;
1075 static HWND hWndAuthors;
1076
1077 switch (msg)
1078 {
1079 case WM_INITDIALOG:
1080 {
1082
1083 if (info)
1084 {
1085 HKEY hRegKey;
1086 MEMORYSTATUSEX MemStat;
1087 WCHAR szAppTitle[512];
1088 WCHAR szAppTitleTemplate[512];
1089 WCHAR szAuthorsText[20];
1090
1091 // Preload the ROS bitmap
1094
1095 if (hLogoBmp && hLineBmp)
1096 {
1097 BITMAP bmpLogo;
1098
1099 GetObject(hLogoBmp, sizeof(BITMAP), &bmpLogo);
1100
1101 cxLogoBmp = bmpLogo.bmWidth;
1102 cyLogoBmp = bmpLogo.bmHeight;
1103
1104 GetObject(hLineBmp, sizeof(BITMAP), &bmpLogo);
1105 cyLineBmp = bmpLogo.bmHeight;
1106 }
1107
1108 // Set App-specific stuff (icon, app name, szOtherStuff string)
1110
1111 GetWindowTextW(hWnd, szAppTitleTemplate, ARRAY_SIZE(szAppTitleTemplate));
1112 swprintf(szAppTitle, szAppTitleTemplate, info->szApp);
1114
1118
1119 // Set the registered user and organization name
1120 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
1121 0, KEY_QUERY_VALUE, &hRegKey) == ERROR_SUCCESS)
1122 {
1123 SetRegTextData(hWnd, hRegKey, L"RegisteredOwner", IDC_ABOUT_REG_USERNAME);
1124 SetRegTextData(hWnd, hRegKey, L"RegisteredOrganization", IDC_ABOUT_REG_ORGNAME);
1125
1128 {
1130 }
1131
1132 RegCloseKey(hRegKey);
1133 }
1134
1135 // Set the value for the installed physical memory
1136 MemStat.dwLength = sizeof(MemStat);
1137 if (GlobalMemoryStatusEx(&MemStat))
1138 {
1139 WCHAR szBuf[12];
1140
1141 if (MemStat.ullTotalPhys > 1024 * 1024 * 1024)
1142 {
1143 double dTotalPhys;
1144 WCHAR szDecimalSeparator[4];
1145 WCHAR szUnits[3];
1146
1147 // We're dealing with GBs or more
1148 MemStat.ullTotalPhys /= 1024 * 1024;
1149
1150 if (MemStat.ullTotalPhys > 1024 * 1024)
1151 {
1152 // We're dealing with TBs or more
1153 MemStat.ullTotalPhys /= 1024;
1154
1155 if (MemStat.ullTotalPhys > 1024 * 1024)
1156 {
1157 // We're dealing with PBs or more
1158 MemStat.ullTotalPhys /= 1024;
1159
1160 dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1161 wcscpy(szUnits, L"PB");
1162 }
1163 else
1164 {
1165 dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1166 wcscpy(szUnits, L"TB");
1167 }
1168 }
1169 else
1170 {
1171 dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1172 wcscpy(szUnits, L"GB");
1173 }
1174
1175 // We need the decimal point of the current locale to display the RAM size correctly
1177 szDecimalSeparator,
1178 ARRAY_SIZE(szDecimalSeparator)) > 0)
1179 {
1180 UCHAR uDecimals;
1181 UINT uIntegral;
1182
1183 uIntegral = (UINT)dTotalPhys;
1184 uDecimals = (UCHAR)((UINT)(dTotalPhys * 100) - uIntegral * 100);
1185
1186 // Display the RAM size with 2 decimals
1187 swprintf(szBuf, L"%u%s%02u %s", uIntegral, szDecimalSeparator, uDecimals, szUnits);
1188 }
1189 }
1190 else
1191 {
1192 // We're dealing with MBs, don't show any decimals
1193 swprintf(szBuf, L"%u MB", (UINT)MemStat.ullTotalPhys / 1024 / 1024);
1194 }
1195
1197 }
1198
1199 // Add the Authors dialog
1201 LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, ARRAY_SIZE(szAuthorsText));
1202 SetDlgItemTextW(hWnd, IDC_ABOUT_AUTHORS, szAuthorsText);
1203 }
1204
1205 return TRUE;
1206 }
1207
1208 case WM_PAINT:
1209 {
1210 if (hLogoBmp && hLineBmp)
1211 {
1212 PAINTSTRUCT ps;
1213 HDC hdc;
1214 HDC hdcMem;
1215 HGDIOBJ hOldObj;
1216
1217 hdc = BeginPaint(hWnd, &ps);
1219
1220 if (hdcMem)
1221 {
1222 hOldObj = SelectObject(hdcMem, hLogoBmp);
1223 BitBlt(hdc, 0, 0, cxLogoBmp, cyLogoBmp, hdcMem, 0, 0, SRCCOPY);
1224
1225 SelectObject(hdcMem, hLineBmp);
1226 BitBlt(hdc, 0, cyLogoBmp, cxLogoBmp, cyLineBmp, hdcMem, 0, 0, SRCCOPY);
1227
1228 SelectObject(hdcMem, hOldObj);
1230 }
1231
1232 EndPaint(hWnd, &ps);
1233 }
1234 break;
1235 }
1236
1237 case WM_COMMAND:
1238 {
1239 switch(wParam)
1240 {
1241 case IDOK:
1242 case IDCANCEL:
1244 return TRUE;
1245
1246 case IDC_ABOUT_AUTHORS:
1247 {
1248 static BOOL bShowingAuthors = FALSE;
1249 WCHAR szAuthorsText[20];
1250
1251 if (bShowingAuthors)
1252 {
1253 LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, ARRAY_SIZE(szAuthorsText));
1254 ShowWindow(hWndAuthors, SW_HIDE);
1255 }
1256 else
1257 {
1258 LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_BACK, szAuthorsText, ARRAY_SIZE(szAuthorsText));
1259 ShowWindow(hWndAuthors, SW_SHOW);
1260 }
1261
1262 SetDlgItemTextW(hWnd, IDC_ABOUT_AUTHORS, szAuthorsText);
1263 bShowingAuthors = !bShowingAuthors;
1264 return TRUE;
1265 }
1266 }
1267 break;
1268 }
1269
1270 case WM_CLOSE:
1272 break;
1273 }
1274
1275#endif // __REACTOS__
1276
1277 return 0;
1278}
#define shell32_hInstance
#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
wcscpy
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1666
#define swprintf
Definition: precomp.h:40
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
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:89
TCHAR szAppTitle[256]
Definition: mplay32.c:27
unsigned int UINT
Definition: ndis.h:50
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define LOCALE_USER_DEFAULT
#define L(x)
Definition: ntvdm.h:50
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
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:403
#define IDC_ABOUT_REG_TO
Definition: shresdef.h:402
#define IDC_ABOUT_ICON
Definition: shresdef.h:397
#define IDB_REACTOS
Definition: shresdef.h:30
#define IDC_ABOUT_PHYSMEM
Definition: shresdef.h:405
#define IDB_LINEBAR
Definition: shresdef.h:31
#define IDC_ABOUT_APPNAME
Definition: shresdef.h:398
#define IDC_ABOUT_AUTHORS
Definition: shresdef.h:409
#define IDC_ABOUT_REG_ORGNAME
Definition: shresdef.h:404
#define IDC_ABOUT_VERSION
Definition: shresdef.h:400
#define IDC_ABOUT_OTHERSTUFF
Definition: shresdef.h:401
#define IDD_ABOUT_AUTHORS
Definition: shresdef.h:408
#define IDS_SHELL_ABOUT_BACK
Definition: shresdef.h:137
#define IDS_SHELL_ABOUT_AUTHORS
Definition: shresdef.h:136
Definition: bl.h:1331
HDC hdcMem
Definition: welcome.c:104
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1394
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:4468
BOOL WINAPI DeleteDC(_In_ HDC)
#define LOCALE_SDECIMAL
Definition: winnls.h:44
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define WM_PAINT
Definition: winuser.h:1631
#define SW_HIDE
Definition: winuser.h:779
#define WM_CLOSE
Definition: winuser.h:1632
#define IMAGE_BITMAP
Definition: winuser.h:211
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define STM_SETICON
Definition: winuser.h:2103
#define IDCANCEL
Definition: winuser.h:842
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define WM_COMMAND
Definition: winuser.h:1751
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:4292
#define LoadImage
Definition: winuser.h:5835
#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)
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by ShellAboutW().

◆ CommandLineToArgvW()

LPWSTR *WINAPI CommandLineToArgvW ( LPCWSTR  lpCmdline,
int numargs 
)

Definition at line 79 of file shell32_main.c.

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

Referenced by _tmain(), CmdDebugService(), command_line_to_args(), DisplayApplet(), DoEntry(), get_utf8_args(), main(), ParseCmdAndExecute(), CCleanMgrModule::ParseCommandLine(), PrintUIEntryW(), ProcessCmdLine(), ProcessCommandLine(), test_commandline2argv(), test_one_cmdline(), and wWinMain().

◆ DuplicateIcon()

HICON WINAPI DuplicateIcon ( HINSTANCE  hInstance,
HICON  hIcon 
)

Definition at line 837 of file shell32_main.c.

838{
840 HICON hDupIcon = 0;
841
842 TRACE("%p %p\n", hInstance, hIcon);
843
845 {
846 hDupIcon = CreateIconIndirect(&IconInfo);
847
848 /* clean up hbmMask and hbmColor */
851 }
852
853 return hDupIcon;
854}
HINSTANCE hInstance
Definition: charmap.c:19
pKey DeleteObject()
_Out_opt_ PICONINFO IconInfo
Definition: ntuser.h:2294
static HICON
Definition: imagelist.c:80
HICON hIcon
Definition: msconfig.c:44
#define TRACE(s)
Definition: solgame.cpp:4
HBITMAP hbmColor
Definition: winuser.h:3138
HBITMAP hbmMask
Definition: winuser.h:3137
HICON WINAPI CreateIconIndirect(_In_ PICONINFO)
Definition: cursoricon.c:2943
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2382

◆ ExtractIconA()

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

Definition at line 859 of file shell32_main.c.

860{
861 HICON ret;
862 INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0);
863 LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
864
865 TRACE("%p %s %d\n", hInstance, lpszFile, nIconIndex);
866
867 MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len);
868 ret = ExtractIconW(hInstance, lpwstrFile, nIconIndex);
869 HeapFree(GetProcessHeap(), 0, lpwstrFile);
870
871 return ret;
872}
#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
HICON WINAPI ExtractIconW(HINSTANCE hInstance, LPCWSTR lpszFile, UINT nIconIndex)
Definition: shell32_main.c:877
int32_t INT
Definition: typedefs.h:58
int ret

Referenced by test_ExtractIcon().

◆ ExtractIconW()

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

Definition at line 877 of file shell32_main.c.

878{
879 HICON hIcon = NULL;
880 UINT ret;
882
883 TRACE("%p %s %d\n", hInstance, debugstr_w(lpszFile), nIconIndex);
884
885 if (nIconIndex == (UINT)-1)
886 {
887 ret = PrivateExtractIconsW(lpszFile, 0, cx, cy, NULL, NULL, 0, LR_DEFAULTCOLOR);
888 if (ret != (UINT)-1 && ret)
889 return (HICON)(UINT_PTR)ret;
890 return NULL;
891 }
892 else
893 ret = PrivateExtractIconsW(lpszFile, nIconIndex, cx, cy, &hIcon, NULL, 1, LR_DEFAULTCOLOR);
894
895 if (ret == (UINT)-1)
896 return (HICON)1;
897 else if (ret > 0 && hIcon)
898 return hIcon;
899
900 return NULL;
901}
#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 1358 of file shell32_main.c.

1359{
1360 FIXME("%x: stub\n",dw);
1361}
#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 906 of file shell32_main.c.

907{
909
910 TRACE("(%s, %p, %p)\n", debugstr_w(wsPrinterName), pLargeIcon, pSmallIcon);
911
912 /* We should check if wsPrinterName is
913 1. the Default Printer or not
914 2. connected or not
915 3. a Local Printer or a Network-Printer
916 and use different Icons
917 */
918 if((wsPrinterName != NULL) && (wsPrinterName[0] != 0))
919 {
920 FIXME("(select Icon by PrinterName %s not implemented)\n", debugstr_w(wsPrinterName));
921 }
922
923 if(pLargeIcon != NULL)
924 *pLargeIcon = LoadImageW(shell32_hInstance,
925 (LPCWSTR) MAKEINTRESOURCE(iconindex), IMAGE_ICON,
927
928 if(pSmallIcon != NULL)
929 *pSmallIcon = LoadImageW(shell32_hInstance,
930 (LPCWSTR) MAKEINTRESOURCE(iconindex), IMAGE_ICON,
931 16, 16, LR_DEFAULTCOLOR);
932}
#define IDI_SHELL_PRINTERS_FOLDER
Definition: shresdef.h:616
#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:2540
#define LR_DEFAULTSIZE
Definition: winuser.h:1105

◆ Printers_RegisterWindowW()

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

Definition at line 940 of file shell32_main.c.

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

◆ Printers_UnregisterWindow()

VOID WINAPI Printers_UnregisterWindow ( HANDLE  hClassPidl,
HWND  hwnd 
)

Definition at line 953 of file shell32_main.c.

954{
955 FIXME("(%p, %p) stub!\n", hClassPidl, hwnd);
956}
_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 1011 of file shell32_main.c.

1012{
1013 DWORD dwBufferSize;
1014 DWORD dwType;
1016
1017 if( RegQueryValueExW(hKey, Value, NULL, &dwType, NULL, &dwBufferSize) == ERROR_SUCCESS )
1018 {
1019 if(dwType == REG_SZ)
1020 {
1021 lpBuffer = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, dwBufferSize);
1022
1023 if(lpBuffer)
1024 {
1025 if( RegQueryValueExW(hKey, Value, NULL, &dwType, (LPBYTE)lpBuffer, &dwBufferSize) == ERROR_SUCCESS )
1026 {
1028 }
1029
1031 }
1032 }
1033 }
1034}
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
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
#define REG_SZ
Definition: layer.c:22
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 313 of file shell32_main.c.

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

Referenced by SHGetFileInfoW().

◆ SHELL_IsShortcut()

BOOL SHELL_IsShortcut ( LPCITEMIDLIST  pidlLast)

Definition at line 404 of file shell32_main.c.

405{
406 WCHAR szTemp[MAX_PATH];
407 HKEY keyCls;
408 BOOL ret = FALSE;
409
410 if (_ILGetExtension(pidlLast, szTemp, _countof(szTemp)) &&
412 {
413 ret = RegQueryValueExW(keyCls, L"IsShortcut", NULL, NULL, NULL, NULL) == ERROR_SUCCESS;
414 RegCloseKey(keyCls);
415 }
416 return ret;
417}
BOOL _ILGetExtension(LPCITEMIDLIST pidl, LPWSTR pOut, UINT uOutSize)
Definition: pidl.c:2496
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 1284 of file shell32_main.c.

1285{
1286 BOOL ret;
1287 LPWSTR appW = NULL, otherW = NULL;
1288 int len;
1289
1290 if (szApp)
1291 {
1292 len = MultiByteToWideChar(CP_ACP, 0, szApp, -1, NULL, 0);
1293 appW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1294 MultiByteToWideChar(CP_ACP, 0, szApp, -1, appW, len);
1295 }
1296 if (szOtherStuff)
1297 {
1298 len = MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, NULL, 0);
1299 otherW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1300 MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, otherW, len);
1301 }
1302
1303 ret = ShellAboutW(hWnd, appW, otherW, hIcon);
1304
1305 HeapFree(GetProcessHeap(), 0, otherW);
1306 HeapFree(GetProcessHeap(), 0, appW);
1307 return ret;
1308}
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 1314 of file shell32_main.c.

1316{
1318 HRSRC hRes;
1319 DLGTEMPLATE *DlgTemplate;
1320 BOOL bRet;
1321#ifdef __REACTOS__
1322 WCHAR szVersionString[256];
1323 WCHAR szFormat[256];
1324#endif
1325
1326 TRACE("\n");
1327
1328 // DialogBoxIndirectParamW will be called with the hInstance of the calling application, so we have to preload the dialog template
1330 if(!hRes)
1331 return FALSE;
1332
1333 DlgTemplate = (DLGTEMPLATE *)LoadResource(shell32_hInstance, hRes);
1334 if(!DlgTemplate)
1335 return FALSE;
1336
1337#ifdef __REACTOS__
1338 /* Output the version OS kernel strings */
1340 StringCchPrintfW(szVersionString, _countof(szVersionString), szFormat, KERNEL_VERSION_STR, KERNEL_VERSION_BUILD_STR);
1341#endif
1342
1343 info.szApp = szApp;
1344#ifdef __REACTOS__
1345 info.szOSVersion = szVersionString;
1346#endif
1347 info.szOtherStuff = szOtherStuff;
1348 info.hIcon = hIcon ? hIcon : LoadIconW( 0, (LPWSTR)IDI_WINLOGO );
1349
1351 DlgTemplate, hWnd, AboutDlgProc, (LPARAM)&info );
1352 return bRet;
1353}
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
static INT_PTR CALLBACK AboutDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
#define IDD_ABOUT
Definition: shresdef.h:396
#define IDS_ABOUT_VERSION_STRING
Definition: shresdef.h:399
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
#define GetWindowLongPtrW
Definition: winuser.h:4840
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:2412

Referenced by Control_WndProc(), dialog_about(), ie_dialog_about(), MACRO_About(), MAIN_MenuCommand(), MainProc(), MainWndCommand(), OnAbout(), CDeviceManager::OnCommand(), OnCommand(), CMainWindow::OnCommand(), 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 786 of file shell32_main.c.

789{
790 INT len;
791 LPWSTR temppath = NULL;
792 LPCWSTR pathW;
794 SHFILEINFOW temppsfi;
795
796 if (flags & SHGFI_PIDL)
797 {
798 /* path contains a pidl */
799 pathW = (LPCWSTR)path;
800 }
801 else
802 {
803 len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
804 temppath = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
805 MultiByteToWideChar(CP_ACP, 0, path, -1, temppath, len);
806 pathW = temppath;
807 }
808
809 if (psfi)
810 {
811 temppsfi.hIcon = psfi->hIcon;
812 temppsfi.iIcon = psfi->iIcon;
813 temppsfi.dwAttributes = psfi->dwAttributes;
814
815 ret = SHGetFileInfoW(pathW, dwFileAttributes, &temppsfi, sizeof(temppsfi), flags);
816 psfi->hIcon = temppsfi.hIcon;
817 psfi->iIcon = temppsfi.iIcon;
818 psfi->dwAttributes = temppsfi.dwAttributes;
819
821 psfi->szDisplayName, sizeof(psfi->szDisplayName), NULL, NULL);
822
823 WideCharToMultiByte(CP_ACP, 0, temppsfi.szTypeName, -1,
824 psfi->szTypeName, sizeof(psfi->szTypeName), NULL, NULL);
825 }
826 else
828
829 HeapFree(GetProcessHeap(), 0, temppath);
830
831 return ret;
832}
DWORD dwFileAttributes
#define WideCharToMultiByte
Definition: compat.h:111
GLbitfield flags
Definition: glext.h:7161
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:430
CHAR szTypeName[80]
Definition: shellapi.h:370
HICON hIcon
Definition: shellapi.h:366
DWORD dwAttributes
Definition: shellapi.h:368
CHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:369
WCHAR szTypeName[80]
Definition: shellapi.h:377
DWORD dwAttributes
Definition: shellapi.h:375
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:376
HICON hIcon
Definition: shellapi.h:373
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 430 of file shell32_main.c.

432{
433 WCHAR szLocation[MAX_PATH], szFullPath[MAX_PATH];
434 int iIndex;
437 IShellFolder * psfParent = NULL;
438 IExtractIconW * pei = NULL;
439 LPITEMIDLIST pidlLast = NULL, pidl = NULL, pidlFree = NULL;
440 HRESULT hr = S_OK;
441 BOOL IconNotYetLoaded=TRUE;
442 UINT uGilFlags = 0;
443 HIMAGELIST big_icons, small_icons;
444
445 TRACE("%s fattr=0x%x sfi=%p(attr=0x%08x) size=0x%x flags=0x%x\n",
447 psfi, psfi ? psfi->dwAttributes : 0, sizeofpsfi, flags);
448
449 if (!path)
450 return FALSE;
451
452 /* windows initializes these values regardless of the flags */
453 if (psfi != NULL)
454 {
455 psfi->szDisplayName[0] = '\0';
456 psfi->szTypeName[0] = '\0';
457 psfi->hIcon = NULL;
458 }
459
460 if (!(flags & SHGFI_PIDL))
461 {
462 /* SHGetFileInfo should work with absolute and relative paths */
464 {
465 GetCurrentDirectoryW(MAX_PATH, szLocation);
466 PathCombineW(szFullPath, szLocation, path);
467 }
468 else
469 {
470 lstrcpynW(szFullPath, path, MAX_PATH);
471 }
472
473 if ((flags & SHGFI_TYPENAME) && !PathIsRootW(szFullPath))
474 {
475 HRESULT hr2;
477 {
481 }
484 else
486 if (SUCCEEDED(hr2))
487 {
488 flags &= ~SHGFI_TYPENAME;
490 return ret; /* Bail out early if this was our only operation */
491 }
492 }
493 }
494 else
495 {
497 }
498
499 if (flags & SHGFI_EXETYPE)
500 {
501 if (!(flags & SHGFI_SYSICONINDEX))
502 {
504 {
505 return TRUE;
506 }
507 else if (GetFileAttributesW(szFullPath) != INVALID_FILE_ATTRIBUTES)
508 {
509 return shgfi_get_exe_type(szFullPath);
510 }
511 }
512 }
513
514 /*
515 * psfi is NULL normally to query EXE type. If it is NULL, none of the
516 * below makes sense anyway. Windows allows this and just returns FALSE
517 */
518 if (psfi == NULL)
519 return FALSE;
520
521 /*
522 * translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES
523 * is not specified.
524 * The pidl functions fail on not existing file names
525 */
526
527 if (flags & SHGFI_PIDL)
528 {
529 pidl = (LPITEMIDLIST)path;
530 hr = pidl ? S_OK : E_FAIL;
531 }
532 else
533 {
535 {
537 hr = pidl ? S_OK : E_FAIL;
538 }
539 else
540 {
541 hr = SHILCreateFromPathW(szFullPath, &pidl, &dwAttributes);
542 }
543 pidlFree = pidl;
544 }
545
546 if (SUCCEEDED(hr))
547 {
548 hr = SHBindToParent(pidl, &IID_IShellFolder, (void**)&psfParent, (LPCITEMIDLIST*)&pidlLast);
549 }
550
551 /* get the attributes of the child */
553 {
555 {
556 psfi->dwAttributes = 0xffffffff;
557 }
558 hr = IShellFolder_GetAttributesOf(psfParent, 1, (LPCITEMIDLIST*)&pidlLast, &psfi->dwAttributes);
559 }
560
562 {
563 if (flags & SHGFI_ICON)
564 {
565 psfi->dwAttributes = 0;
566 }
567 }
568
569 /* get the displayname */
571 {
572 STRRET str;
573 psfi->szDisplayName[0] = UNICODE_NULL;
574 hr = IShellFolder_GetDisplayNameOf(psfParent, pidlLast, SHGDN_INFOLDER, &str);
575 if (SUCCEEDED(hr))
576 StrRetToStrNW(psfi->szDisplayName, _countof(psfi->szDisplayName), &str, pidlLast);
577 }
578
579 /* get the type name */
580 if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
581 {
582 /* FIXME: Use IShellFolder2::GetDetailsEx */
583 UINT col = _ILIsDrive(pidlLast) ? 1 : 2; /* SHFSF_COL_TYPE */
584 psfi->szTypeName[0] = UNICODE_NULL;
585 hr = SHELL_GetDetailsOfToBuffer(psfParent, pidlLast, col, psfi->szTypeName, _countof(psfi->szTypeName));
586 }
587
588 /* ### icons ###*/
589
590 Shell_GetImageLists( &big_icons, &small_icons );
591
592 if (flags & SHGFI_OPENICON)
593 uGilFlags |= GIL_OPENICON;
594
596 uGilFlags |= GIL_FORSHORTCUT;
597 else if ((flags&SHGFI_ADDOVERLAYS) ||
599 {
600 if (SHELL_IsShortcut(pidlLast))
601 uGilFlags |= GIL_FORSHORTCUT;
602 }
603
605 FIXME("SHGFI_OVERLAYINDEX unhandled\n");
606
607 if (flags & SHGFI_SELECTED)
608 FIXME("set icon to selected, stub\n");
609
610 /* get the iconlocation */
612 {
613 UINT uDummy,uFlags;
614
616 {
618 {
620 psfi->iIcon = -IDI_SHELL_FOLDER;
621 }
622 else
623 {
624 WCHAR* szExt;
625 WCHAR sTemp [MAX_PATH];
626
627 szExt = PathFindExtensionW(szFullPath);
628 TRACE("szExt=%s\n", debugstr_w(szExt));
629 if ( szExt &&
630 HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
631 HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &psfi->iIcon))
632 {
633 if (lstrcmpW(L"%1", sTemp))
634 strcpyW(psfi->szDisplayName, sTemp);
635 else
636 {
637 /* the icon is in the file */
638 strcpyW(psfi->szDisplayName, szFullPath);
639 }
640 }
641 else
642 ret = FALSE;
643 }
644 }
645 else if (psfParent)
646 {
647 hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1,
648 (LPCITEMIDLIST*)&pidlLast, &IID_IExtractIconW,
649 &uDummy, (LPVOID*)&pei);
650 if (SUCCEEDED(hr))
651 {
652 hr = IExtractIconW_GetIconLocation(pei, uGilFlags,
653 szLocation, MAX_PATH, &iIndex, &uFlags);
654
655 if (uFlags & GIL_NOTFILENAME)
656 ret = FALSE;
657 else
658 {
659 lstrcpyW (psfi->szDisplayName, szLocation);
660 psfi->iIcon = iIndex;
661 }
662 IExtractIconW_Release(pei);
663 }
664 }
665 }
666
667 /* get icon index (or load icon)*/
669 {
671 {
672 WCHAR sTemp [MAX_PATH];
673 WCHAR * szExt;
674 int icon_idx=0;
675
676 lstrcpynW(sTemp, szFullPath, MAX_PATH);
677
680 else
681 {
682 psfi->iIcon = 0;
683 szExt = PathFindExtensionW(sTemp);
684 if ( szExt &&
685 HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
686 HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &icon_idx))
687 {
688 if (!lstrcmpW(L"%1",sTemp)) /* icon is in the file */
689 strcpyW(sTemp, szFullPath);
690
692 {
693 psfi->iIcon = SIC_GetIconIndex(sTemp,icon_idx,0);
694 if (psfi->iIcon == -1)
695 psfi->iIcon = 0;
696 }
697 else
698 {
699 UINT ret;
700 INT cxIcon, cyIcon;
701
702 /* Get icon size */
704 {
706 cxIcon = cyIcon = ShellSmallIconSize;
707 else
708 cxIcon = cyIcon = ShellLargeIconSize;
709 }
710 else
711 {
713 {
716 }
717 else
718 {
719 cxIcon = GetSystemMetrics(SM_CXICON);
720 cyIcon = GetSystemMetrics(SM_CYICON);
721 }
722 }
723
724 ret = PrivateExtractIconsW(sTemp, icon_idx, cxIcon, cyIcon,
725 &psfi->hIcon, 0, 1, 0);
726 if (ret != 0 && ret != (UINT)-1)
727 {
728 IconNotYetLoaded=FALSE;
729 psfi->iIcon = icon_idx;
730 }
731 }
732 }
733 }
734 }
735 else if (psfParent)
736 {
737 if (!(PidlToSicIndex(psfParent, pidlLast, !(flags & SHGFI_SMALLICON),
738 uGilFlags, &(psfi->iIcon))))
739 {
740 ret = FALSE;
741 }
742 }
743 if (ret && (flags & SHGFI_SYSICONINDEX))
744 {
746 ret = (DWORD_PTR)small_icons;
747 else
748 ret = (DWORD_PTR)big_icons;
749 }
750 }
751
752 /* icon handle */
753 if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded)
754 {
756 psfi->hIcon = ImageList_GetIcon( small_icons, psfi->iIcon, ILD_NORMAL);
757 else
758 psfi->hIcon = ImageList_GetIcon( big_icons, psfi->iIcon, ILD_NORMAL);
759 }
760
762 FIXME("unknown flags %08x\n", flags & ~SHGFI_KNOWN_FLAGS);
763
764 if (psfParent)
765 IShellFolder_Release(psfParent);
766 SHFree(pidlFree);
767
768 if (hr != S_OK)
769 ret = FALSE;
770
771 TRACE ("icon=%p index=0x%08x attr=0x%08x name=%s type=%s ret=0x%08lx\n",
772 psfi->hIcon, psfi->iIcon, psfi->dwAttributes,
774
775 return ret;
776}
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:652
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4243
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
BOOL WINAPI PathIsRootW(LPCWSTR lpszPath)
Definition: path.c:1648
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1585
#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:317
HRESULT WINAPI SHILCreateFromPathW(LPCWSTR path, LPITEMIDLIST *ppidl, DWORD *attributes)
Definition: pidl.c:403
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1462
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1454
LPITEMIDLIST SHELL32_CreateSimpleIDListFromPath(LPCWSTR pszPath, DWORD dwAttributes)
Definition: pidl.c:1188
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:2095
#define ILD_NORMAL
Definition: commctrl.h:417
const WCHAR * str
BOOL HCR_GetIconW(LPCWSTR szClass, LPWSTR szDest, LPCWSTR szName, DWORD len, int *picon_idx)
Definition: classes.c:314
BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, LONG len, BOOL bPrependDot)
Definition: classes.c:82
BOOL SHELL_IsShortcut(LPCITEMIDLIST pidlLast)
Definition: shell32_main.c:404
#define SHGFI_KNOWN_FLAGS
Definition: shell32_main.c:419
static DWORD shgfi_get_exe_type(LPCWSTR szFullPath)
Definition: shell32_main.c:335
static HRESULT SHELL_GetDetailsOfToBuffer(IShellFolder *psf, PCUITEMID_CHILD pidl, UINT col, LPWSTR Buf, UINT cchBuf)
Definition: shell32_main.c:313
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
#define SM_CYSMICON
Definition: winuser.h:1024
#define SM_CXSMICON
Definition: winuser.h:1023

Referenced by AddListViewItems(), CShellMenuCallback::AddOrSetMenuItem(), BrFolder_OnOK(), ClassifyFile(), FILEDLG95_InitControls(), FILEDLG95_LOOKIN_AddItem(), FILEDLG95_LOOKIN_DrawItem(), GetAssocClass(), CZipFolder::GetDetailsOf(), COpenWithList::GetIcon(), GetItemTypeName(), GetTypeDescriptionByPath(), GetTypeName(), CFileDefExt::InitFileType(), CSearchBar::Invoke(), CSendToMenu::LoadAllItems(), CNewMenu::LoadItem(), CShellLink::OnInitDialog(), CSearchBar::OnLocationEditChange(), 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 335 of file shell32_main.c.

336{
337 BOOL status = FALSE;
338 HANDLE hfile;
339 DWORD BinaryType;
340 IMAGE_DOS_HEADER mz_header;
342 DWORD len;
343 char magic[4];
344
345 status = GetBinaryTypeW (szFullPath, &BinaryType);
346 if (!status)
347 return 0;
348 if (BinaryType == SCS_DOS_BINARY || BinaryType == SCS_PIF_BINARY)
349 return 0x4d5a;
350
351 hfile = CreateFileW( szFullPath, GENERIC_READ, FILE_SHARE_READ,
352 NULL, OPEN_EXISTING, 0, 0 );
353 if ( hfile == INVALID_HANDLE_VALUE )
354 return 0;
355
356 /*
357 * The next section is adapted from MODULE_GetBinaryType, as we need
358 * to examine the image header to get OS and version information. We
359 * know from calling GetBinaryTypeA that the image is valid and either
360 * an NE or PE, so much error handling can be omitted.
361 * Seek to the start of the file and read the header information.
362 */
363
364 SetFilePointer( hfile, 0, NULL, SEEK_SET );
365 ReadFile( hfile, &mz_header, sizeof(mz_header), &len, NULL );
366
367 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
368 ReadFile( hfile, magic, sizeof(magic), &len, NULL );
369 if ( *(DWORD*)magic == IMAGE_NT_SIGNATURE )
370 {
371 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
372 ReadFile( hfile, &nt, sizeof(nt), &len, NULL );
373 CloseHandle( hfile );
374 /* DLL files are not executable and should return 0 */
376 return 0;
378 {
379 return IMAGE_NT_SIGNATURE |
382 }
383 return IMAGE_NT_SIGNATURE;
384 }
385 else if ( *(WORD*)magic == IMAGE_OS2_SIGNATURE )
386 {
388 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
389 ReadFile( hfile, &ne, sizeof(ne), &len, NULL );
390 CloseHandle( hfile );
391 if (ne.ne_exetyp == 2)
392 return IMAGE_OS2_SIGNATURE | (ne.ne_expver << 16);
393 return 0;
394 }
395 CloseHandle( hfile );
396 return 0;
397}
#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
IMAGE_NT_HEADERS nt
Definition: module.c:50
#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:266
#define SCS_DOS_BINARY
Definition: winbase.h:264

Referenced by SHGetFileInfoW().

◆ SHHelpShortcuts_RunDLLA()

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

Definition at line 974 of file shell32_main.c.

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

◆ SHHelpShortcuts_RunDLLW()

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

Definition at line 984 of file shell32_main.c.

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

◆ SHLoadInProc()

HRESULT WINAPI SHLoadInProc ( REFCLSID  rclsid)

Definition at line 995 of file shell32_main.c.

996{
997 void *ptr = NULL;
998
999 TRACE("%s\n", debugstr_guid(rclsid));
1000
1001 CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,&ptr);
1002 if(ptr)
1003 {
1004 IUnknown * pUnk = ptr;
1005 IUnknown_Release(pUnk);
1006 return S_OK;
1007 }
1008 return DISP_E_MEMBERNOTFOUND;
1009}
const GUID IID_IUnknown
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
#define debugstr_guid
Definition: kernel32.h:35
static PVOID ptr
Definition: dispmode.c:27
#define DISP_E_MEMBERNOTFOUND
Definition: winerror.h:2512

◆ SHLoadNonloadedIconOverlayIdentifiers()

HRESULT WINAPI SHLoadNonloadedIconOverlayIdentifiers ( VOID  )

Definition at line 1366 of file shell32_main.c.

1367{
1368 FIXME("stub\n");
1369 return S_OK;
1370}

◆ 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 50 of file shell32_main.c.

Referenced by AboutAuthorsDlgProc().