ReactOS 0.4.15-dev-8434-g155a7c7
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 <versionhelpers.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 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: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_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 404 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 1032 of file shell32_main.c.

1033{
1034 switch(msg)
1035 {
1036 case WM_INITDIALOG:
1037 {
1038 const char* const *pstr = SHELL_Authors;
1039
1040 // Add the authors to the list
1042
1043 while (*pstr)
1044 {
1045 WCHAR name[64];
1046
1047 /* authors list is in utf-8 format */
1048 MultiByteToWideChar( CP_UTF8, 0, *pstr, -1, name, sizeof(name)/sizeof(WCHAR) );
1050 pstr++;
1051 }
1052
1054
1055 return TRUE;
1056 }
1057 }
1058
1059 return FALSE;
1060}
#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:51
#define IDC_ABOUT_AUTHORS_LISTBOX
Definition: shresdef.h:387
Definition: name.c:39
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define WM_INITDIALOG
Definition: winuser.h:1739
#define LB_ADDSTRING
Definition: winuser.h:2031
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETREDRAW
Definition: winuser.h:1616
__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 1064 of file shell32_main.c.

1065{
1066#ifdef __REACTOS__
1067
1068 static DWORD cxLogoBmp;
1069 static DWORD cyLogoBmp, cyLineBmp;
1070 static HBITMAP hLogoBmp, hLineBmp;
1071 static HWND hWndAuthors;
1072
1073 switch (msg)
1074 {
1075 case WM_INITDIALOG:
1076 {
1078
1079 if (info)
1080 {
1081 HKEY hRegKey;
1082 MEMORYSTATUSEX MemStat;
1083 WCHAR szAppTitle[512];
1084 WCHAR szAppTitleTemplate[512];
1085 WCHAR szAuthorsText[20];
1086
1087 // Preload the ROS bitmap
1088 if (IsWindowsServer())
1089 {
1090 // Load Server Bitmap
1092 }
1093 else
1094 {
1095 // Load Workstation Bitmap
1097 }
1099
1100 if (hLogoBmp && hLineBmp)
1101 {
1102 BITMAP bmpLogo;
1103
1104 GetObject(hLogoBmp, sizeof(BITMAP), &bmpLogo);
1105
1106 cxLogoBmp = bmpLogo.bmWidth;
1107 cyLogoBmp = bmpLogo.bmHeight;
1108
1109 GetObject(hLineBmp, sizeof(BITMAP), &bmpLogo);
1110 cyLineBmp = bmpLogo.bmHeight;
1111 }
1112
1113 // Set App-specific stuff (icon, app name, szOtherStuff string)
1115
1116 GetWindowTextW(hWnd, szAppTitleTemplate, ARRAY_SIZE(szAppTitleTemplate));
1117 swprintf(szAppTitle, szAppTitleTemplate, info->szApp);
1119
1123
1124 // Set the registered user and organization name
1125 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
1126 0, KEY_QUERY_VALUE, &hRegKey) == ERROR_SUCCESS)
1127 {
1128 SetRegTextData(hWnd, hRegKey, L"RegisteredOwner", IDC_ABOUT_REG_USERNAME);
1129 SetRegTextData(hWnd, hRegKey, L"RegisteredOrganization", IDC_ABOUT_REG_ORGNAME);
1130
1133 {
1135 }
1136
1137 RegCloseKey(hRegKey);
1138 }
1139
1140 // Set the value for the installed physical memory
1141 MemStat.dwLength = sizeof(MemStat);
1142 if (GlobalMemoryStatusEx(&MemStat))
1143 {
1144 WCHAR szBuf[12];
1145
1146 if (MemStat.ullTotalPhys > 1024 * 1024 * 1024)
1147 {
1148 double dTotalPhys;
1149 WCHAR szDecimalSeparator[4];
1150 WCHAR szUnits[3];
1151
1152 // We're dealing with GBs or more
1153 MemStat.ullTotalPhys /= 1024 * 1024;
1154
1155 if (MemStat.ullTotalPhys > 1024 * 1024)
1156 {
1157 // We're dealing with TBs or more
1158 MemStat.ullTotalPhys /= 1024;
1159
1160 if (MemStat.ullTotalPhys > 1024 * 1024)
1161 {
1162 // We're dealing with PBs or more
1163 MemStat.ullTotalPhys /= 1024;
1164
1165 dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1166 wcscpy(szUnits, L"PB");
1167 }
1168 else
1169 {
1170 dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1171 wcscpy(szUnits, L"TB");
1172 }
1173 }
1174 else
1175 {
1176 dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1177 wcscpy(szUnits, L"GB");
1178 }
1179
1180 // We need the decimal point of the current locale to display the RAM size correctly
1182 szDecimalSeparator,
1183 ARRAY_SIZE(szDecimalSeparator)) > 0)
1184 {
1185 UCHAR uDecimals;
1186 UINT uIntegral;
1187
1188 uIntegral = (UINT)dTotalPhys;
1189 uDecimals = (UCHAR)((UINT)(dTotalPhys * 100) - uIntegral * 100);
1190
1191 // Display the RAM size with 2 decimals
1192 swprintf(szBuf, L"%u%s%02u %s", uIntegral, szDecimalSeparator, uDecimals, szUnits);
1193 }
1194 }
1195 else
1196 {
1197 // We're dealing with MBs, don't show any decimals
1198 swprintf(szBuf, L"%u MB", (UINT)MemStat.ullTotalPhys / 1024 / 1024);
1199 }
1200
1202 }
1203
1204 // Add the Authors dialog
1206 LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, ARRAY_SIZE(szAuthorsText));
1207 SetDlgItemTextW(hWnd, IDC_ABOUT_AUTHORS, szAuthorsText);
1208 }
1209
1210 return TRUE;
1211 }
1212
1213 case WM_PAINT:
1214 {
1215 if (hLogoBmp && hLineBmp)
1216 {
1217 PAINTSTRUCT ps;
1218 HDC hdc;
1219 HDC hdcMem;
1220 HGDIOBJ hOldObj;
1221
1222 hdc = BeginPaint(hWnd, &ps);
1224
1225 if (hdcMem)
1226 {
1227 hOldObj = SelectObject(hdcMem, hLogoBmp);
1228 BitBlt(hdc, 0, 0, cxLogoBmp, cyLogoBmp, hdcMem, 0, 0, SRCCOPY);
1229
1230 SelectObject(hdcMem, hLineBmp);
1231 BitBlt(hdc, 0, cyLogoBmp, cxLogoBmp, cyLineBmp, hdcMem, 0, 0, SRCCOPY);
1232
1233 SelectObject(hdcMem, hOldObj);
1235 }
1236
1237 EndPaint(hWnd, &ps);
1238 }
1239 break;
1240 }
1241
1242 case WM_COMMAND:
1243 {
1244 switch(wParam)
1245 {
1246 case IDOK:
1247 case IDCANCEL:
1249 return TRUE;
1250
1251 case IDC_ABOUT_AUTHORS:
1252 {
1253 static BOOL bShowingAuthors = FALSE;
1254 WCHAR szAuthorsText[20];
1255
1256 if (bShowingAuthors)
1257 {
1258 LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, ARRAY_SIZE(szAuthorsText));
1259 ShowWindow(hWndAuthors, SW_HIDE);
1260 }
1261 else
1262 {
1263 LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_BACK, szAuthorsText, ARRAY_SIZE(szAuthorsText));
1264 ShowWindow(hWndAuthors, SW_SHOW);
1265 }
1266
1267 SetDlgItemTextW(hWnd, IDC_ABOUT_AUTHORS, szAuthorsText);
1268 bShowingAuthors = !bShowingAuthors;
1269 return TRUE;
1270 }
1271 }
1272 break;
1273 }
1274
1275 case WM_CLOSE:
1277 break;
1278 }
1279
1280#endif // __REACTOS__
1281
1282 return 0;
1283}
static BOOL IsWindowsServer()
#define shell32_hInstance
#define ARRAY_SIZE(A)
Definition: main.h:33
#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
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:1665
#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:92
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
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
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
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:380
#define IDC_ABOUT_REG_TO
Definition: shresdef.h:379
#define IDC_ABOUT_ICON
Definition: shresdef.h:374
#define IDB_REACTOS_SERVER
Definition: shresdef.h:32
#define IDC_ABOUT_PHYSMEM
Definition: shresdef.h:382
#define IDB_LINEBAR
Definition: shresdef.h:33
#define IDC_ABOUT_APPNAME
Definition: shresdef.h:375
#define IDC_ABOUT_AUTHORS
Definition: shresdef.h:386
#define IDC_ABOUT_REG_ORGNAME
Definition: shresdef.h:381
#define IDB_REACTOS_WORKSTATION
Definition: shresdef.h:31
#define IDC_ABOUT_VERSION
Definition: shresdef.h:377
#define IDC_ABOUT_OTHERSTUFF
Definition: shresdef.h:378
#define IDD_ABOUT_AUTHORS
Definition: shresdef.h:385
#define IDS_SHELL_ABOUT_BACK
Definition: shresdef.h:139
#define IDS_SHELL_ABOUT_AUTHORS
Definition: shresdef.h:138
Definition: bl.h:1331
HDC hdcMem
Definition: welcome.c:104
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1384
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:42
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define WM_PAINT
Definition: winuser.h:1620
#define SW_HIDE
Definition: winuser.h:768
#define WM_CLOSE
Definition: winuser.h:1621
#define IMAGE_BITMAP
Definition: winuser.h:211
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define STM_SETICON
Definition: winuser.h:2092
#define IDCANCEL
Definition: winuser.h:831
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:1740
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:830
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:4281
#define LoadImage
Definition: winuser.h:5824
#define LR_DEFAULTCOLOR
Definition: winuser.h:1087
#define SW_SHOW
Definition: winuser.h:775
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define MAKEINTRESOURCE
Definition: winuser.h:591
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 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}
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:368
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(), PrintUIEntryW(), ProcessCmdLine(), ProcessCommandLine(), test_commandline2argv(), test_one_cmdline(), and wWinMain().

◆ DuplicateIcon()

HICON WINAPI DuplicateIcon ( HINSTANCE  hInstance,
HICON  hIcon 
)

Definition at line 833 of file shell32_main.c.

834{
836 HICON hDupIcon = 0;
837
838 TRACE("%p %p\n", hInstance, hIcon);
839
841 {
842 hDupIcon = CreateIconIndirect(&IconInfo);
843
844 /* clean up hbmMask and hbmColor */
847 }
848
849 return hDupIcon;
850}
HINSTANCE hInstance
Definition: charmap.c:19
pKey DeleteObject()
_Out_opt_ PICONINFO IconInfo
Definition: ntuser.h:2294
static HICON
Definition: imagelist.c:84
HICON hIcon
Definition: msconfig.c:44
#define TRACE(s)
Definition: solgame.cpp:4
HBITMAP hbmColor
Definition: winuser.h:3127
HBITMAP hbmMask
Definition: winuser.h:3126
HICON WINAPI CreateIconIndirect(_In_ PICONINFO)
Definition: cursoricon.c:2625
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2089

◆ ExtractIconA()

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

Definition at line 855 of file shell32_main.c.

856{
857 HICON ret;
858 INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0);
859 LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
860
861 TRACE("%p %s %d\n", hInstance, lpszFile, nIconIndex);
862
863 MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len);
864 ret = ExtractIconW(hInstance, lpwstrFile, nIconIndex);
865 HeapFree(GetProcessHeap(), 0, lpwstrFile);
866
867 return ret;
868}
#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:873
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 873 of file shell32_main.c.

874{
875 HICON hIcon = NULL;
876 UINT ret;
878
879 TRACE("%p %s %d\n", hInstance, debugstr_w(lpszFile), nIconIndex);
880
881 if (nIconIndex == (UINT)-1)
882 {
883 ret = PrivateExtractIconsW(lpszFile, 0, cx, cy, NULL, NULL, 0, LR_DEFAULTCOLOR);
884 if (ret != (UINT)-1 && ret)
885 return (HICON)(UINT_PTR)ret;
886 return NULL;
887 }
888 else
889 ret = PrivateExtractIconsW(lpszFile, nIconIndex, cx, cy, &hIcon, NULL, 1, LR_DEFAULTCOLOR);
890
891 if (ret == (UINT)-1)
892 return (HICON)1;
893 else if (ret > 0 && hIcon)
894 return hIcon;
895
896 return NULL;
897}
#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:973
#define SM_CXICON
Definition: winuser.h:972
int WINAPI GetSystemMetrics(_In_ int)

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

◆ FreeIconList()

void WINAPI FreeIconList ( DWORD  dw)

Definition at line 1363 of file shell32_main.c.

1364{
1365 FIXME("%x: stub\n",dw);
1366}
#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 902 of file shell32_main.c.

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

◆ Printers_RegisterWindowW()

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

Definition at line 936 of file shell32_main.c.

938{
939 FIXME("(%s, %x, %p (%p), %p (%p)) stub!\n", debugstr_w(wsPrinter), dwType,
940 phClassPidl, (phClassPidl != NULL) ? *(phClassPidl) : NULL,
941 phwnd, (phwnd != NULL) ? *(phwnd) : NULL);
942
943 return FALSE;
944}

◆ Printers_UnregisterWindow()

VOID WINAPI Printers_UnregisterWindow ( HANDLE  hClassPidl,
HWND  hwnd 
)

Definition at line 949 of file shell32_main.c.

950{
951 FIXME("(%p, %p) stub!\n", hClassPidl, hwnd);
952}
_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 1007 of file shell32_main.c.

1008{
1009 DWORD dwBufferSize;
1010 DWORD dwType;
1012
1013 if( RegQueryValueExW(hKey, Value, NULL, &dwType, NULL, &dwBufferSize) == ERROR_SUCCESS )
1014 {
1015 if(dwType == REG_SZ)
1016 {
1017 lpBuffer = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, dwBufferSize);
1018
1019 if(lpBuffer)
1020 {
1021 if( RegQueryValueExW(hKey, Value, NULL, &dwType, (LPBYTE)lpBuffer, &dwBufferSize) == ERROR_SUCCESS )
1022 {
1024 }
1025
1027 }
1028 }
1029 }
1030}
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_IsShortcut()

BOOL SHELL_IsShortcut ( LPCITEMIDLIST  pidlLast)

Definition at line 383 of file shell32_main.c.

384{
385 WCHAR szTemp[MAX_PATH];
386 HKEY keyCls;
387 BOOL ret = FALSE;
388
389 if (_ILGetExtension(pidlLast, szTemp, _countof(szTemp)) &&
390 HCR_MapTypeToValueW(szTemp, szTemp, _countof(szTemp), TRUE))
391 {
393 {
394 if (ERROR_SUCCESS == RegQueryValueExW(keyCls, L"IsShortcut", NULL, NULL, NULL, NULL))
395 ret = TRUE;
396
397 RegCloseKey(keyCls);
398 }
399 }
400
401 return ret;
402}
BOOL _ILGetExtension(LPCITEMIDLIST pidl, LPWSTR pOut, UINT uOutSize)
Definition: pidl.c:2454
BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, LONG len, BOOL bPrependDot)
Definition: classes.c:49
#define _countof(array)
Definition: sndvol32.h:70
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by SHGetFileInfoW(), and SHMapPIDLToSystemImageListIndex().

◆ ShellAboutA()

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

Definition at line 1289 of file shell32_main.c.

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

1321{
1323 HRSRC hRes;
1324 DLGTEMPLATE *DlgTemplate;
1325 BOOL bRet;
1326#ifdef __REACTOS__
1327 WCHAR szVersionString[256];
1328 WCHAR szFormat[256];
1329#endif
1330
1331 TRACE("\n");
1332
1333 // DialogBoxIndirectParamW will be called with the hInstance of the calling application, so we have to preload the dialog template
1335 if(!hRes)
1336 return FALSE;
1337
1338 DlgTemplate = (DLGTEMPLATE *)LoadResource(shell32_hInstance, hRes);
1339 if(!DlgTemplate)
1340 return FALSE;
1341
1342#ifdef __REACTOS__
1343 /* Output the version OS kernel strings */
1345 StringCchPrintfW(szVersionString, _countof(szVersionString), szFormat, KERNEL_VERSION_STR, KERNEL_VERSION_BUILD_STR);
1346#endif
1347
1348 info.szApp = szApp;
1349#ifdef __REACTOS__
1350 info.szOSVersion = szVersionString;
1351#endif
1352 info.szOtherStuff = szOtherStuff;
1353 info.hIcon = hIcon ? hIcon : LoadIconW( 0, (LPWSTR)IDI_WINLOGO );
1354
1356 DlgTemplate, hWnd, AboutDlgProc, (LPARAM)&info );
1357 return bRet;
1358}
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:373
#define IDS_ABOUT_VERSION_STRING
Definition: shresdef.h:376
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
#define GetWindowLongPtrW
Definition: winuser.h:4829
INT_PTR WINAPI DialogBoxIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define GWLP_HINSTANCE
Definition: winuser.h:856
#define IDI_WINLOGO
Definition: winuser.h:709
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2119

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

785{
786 INT len;
787 LPWSTR temppath = NULL;
788 LPCWSTR pathW;
790 SHFILEINFOW temppsfi;
791
792 if (flags & SHGFI_PIDL)
793 {
794 /* path contains a pidl */
795 pathW = (LPCWSTR)path;
796 }
797 else
798 {
799 len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
800 temppath = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
801 MultiByteToWideChar(CP_ACP, 0, path, -1, temppath, len);
802 pathW = temppath;
803 }
804
805 if (psfi)
806 {
807 temppsfi.hIcon = psfi->hIcon;
808 temppsfi.iIcon = psfi->iIcon;
809 temppsfi.dwAttributes = psfi->dwAttributes;
810
811 ret = SHGetFileInfoW(pathW, dwFileAttributes, &temppsfi, sizeof(temppsfi), flags);
812 psfi->hIcon = temppsfi.hIcon;
813 psfi->iIcon = temppsfi.iIcon;
814 psfi->dwAttributes = temppsfi.dwAttributes;
815
817 psfi->szDisplayName, sizeof(psfi->szDisplayName), NULL, NULL);
818
819 WideCharToMultiByte(CP_ACP, 0, temppsfi.szTypeName, -1,
820 psfi->szTypeName, sizeof(psfi->szTypeName), NULL, NULL);
821 }
822 else
824
825 HeapFree(GetProcessHeap(), 0, temppath);
826
827 return ret;
828}
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:415
CHAR szTypeName[80]
Definition: shellapi.h:369
HICON hIcon
Definition: shellapi.h:365
DWORD dwAttributes
Definition: shellapi.h:367
CHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:368
WCHAR szTypeName[80]
Definition: shellapi.h:376
DWORD dwAttributes
Definition: shellapi.h:374
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:375
HICON hIcon
Definition: shellapi.h:372
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 415 of file shell32_main.c.

417{
418 WCHAR szLocation[MAX_PATH], szFullPath[MAX_PATH];
419 int iIndex;
422 IShellFolder * psfParent = NULL;
423 IExtractIconW * pei = NULL;
424 LPITEMIDLIST pidlLast = NULL, pidl = NULL;
425 HRESULT hr = S_OK;
426 BOOL IconNotYetLoaded=TRUE;
427 UINT uGilFlags = 0;
428 HIMAGELIST big_icons, small_icons;
429
430 TRACE("%s fattr=0x%x sfi=%p(attr=0x%08x) size=0x%x flags=0x%x\n",
432 psfi, psfi ? psfi->dwAttributes : 0, sizeofpsfi, flags);
433
434 if (!path)
435 return FALSE;
436
437 /* windows initializes these values regardless of the flags */
438 if (psfi != NULL)
439 {
440 psfi->szDisplayName[0] = '\0';
441 psfi->szTypeName[0] = '\0';
442 psfi->hIcon = NULL;
443 }
444
445 if (!(flags & SHGFI_PIDL))
446 {
447 /* SHGetFileInfo should work with absolute and relative paths */
449 {
450 GetCurrentDirectoryW(MAX_PATH, szLocation);
451 PathCombineW(szFullPath, szLocation, path);
452 }
453 else
454 {
455 lstrcpynW(szFullPath, path, MAX_PATH);
456 }
457 }
458 else
459 {
461 }
462
463 if (flags & SHGFI_EXETYPE)
464 {
465 if (!(flags & SHGFI_SYSICONINDEX))
466 {
468 {
469 return TRUE;
470 }
471 else if (GetFileAttributesW(szFullPath) != INVALID_FILE_ATTRIBUTES)
472 {
473 return shgfi_get_exe_type(szFullPath);
474 }
475 }
476 }
477
478 /*
479 * psfi is NULL normally to query EXE type. If it is NULL, none of the
480 * below makes sense anyway. Windows allows this and just returns FALSE
481 */
482 if (psfi == NULL)
483 return FALSE;
484
485 /*
486 * translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES
487 * is not specified.
488 * The pidl functions fail on not existing file names
489 */
490
491 if (flags & SHGFI_PIDL)
492 {
493 pidl = ILClone((LPCITEMIDLIST)path);
494 }
495 else if (!(flags & SHGFI_USEFILEATTRIBUTES))
496 {
497 hr = SHILCreateFromPathW(szFullPath, &pidl, &dwAttributes);
498 }
499
501 {
502 /* get the parent shellfolder */
503 if (pidl)
504 {
505 hr = SHBindToParent( pidl, &IID_IShellFolder, (LPVOID*)&psfParent,
506 (LPCITEMIDLIST*)&pidlLast );
507 if (SUCCEEDED(hr))
508 pidlLast = ILClone(pidlLast);
509 else
510 hr = S_OK;
511 ILFree(pidl);
512 }
513 else
514 {
515 ERR("pidl is null!\n");
516 return FALSE;
517 }
518 }
519
520 /* get the attributes of the child */
522 {
524 {
525 psfi->dwAttributes = 0xffffffff;
526 }
527 if (psfParent)
528 {
529 IShellFolder_GetAttributesOf(psfParent, 1, (LPCITEMIDLIST*)&pidlLast,
530 &(psfi->dwAttributes));
531 }
532 }
533
535 {
536 if (flags & SHGFI_ICON)
537 {
538 psfi->dwAttributes = 0;
539 }
540 }
541
542 /* get the displayname */
544 {
546 {
547 lstrcpyW (psfi->szDisplayName, PathFindFileNameW(szFullPath));
548 }
549 else if (psfParent)
550 {
551 STRRET str;
552 hr = IShellFolder_GetDisplayNameOf( psfParent, pidlLast,
553 SHGDN_INFOLDER, &str);
554 StrRetToStrNW (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
555 }
556 }
557
558 /* get the type name */
559 if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
560 {
562 {
563 _ILGetFileType(pidlLast, psfi->szTypeName, _countof(psfi->szTypeName));
564 }
565 else
566 {
568 strcatW (psfi->szTypeName, L"Folder");
569 else
570 {
571 WCHAR sTemp[64];
572
573 lstrcpyW(sTemp,PathFindExtensionW(szFullPath));
574 if (sTemp[0] == 0 || (sTemp[0] == '.' && sTemp[1] == 0))
575 {
576 /* "name" or "name." => "File" */
577 lstrcpynW (psfi->szTypeName, L"File", 64);
578 }
579 else if (!( HCR_MapTypeToValueW(sTemp, sTemp, 64, TRUE) &&
580 HCR_MapTypeToValueW(sTemp, psfi->szTypeName, 80, FALSE )))
581 {
582 if (sTemp[0])
583 {
584 lstrcpynW (psfi->szTypeName, sTemp, 64);
585 strcatW (psfi->szTypeName, L" file");
586 }
587 else
588 {
589 lstrcpynW (psfi->szTypeName, L"File", 64);
590 }
591 }
592 }
593 }
594 }
595
596 /* ### icons ###*/
597
598 Shell_GetImageLists( &big_icons, &small_icons );
599
600 if (flags & SHGFI_OPENICON)
601 uGilFlags |= GIL_OPENICON;
602
604 uGilFlags |= GIL_FORSHORTCUT;
605 else if ((flags&SHGFI_ADDOVERLAYS) ||
607 {
608 if (SHELL_IsShortcut(pidlLast))
609 uGilFlags |= GIL_FORSHORTCUT;
610 }
611
613 FIXME("SHGFI_OVERLAYINDEX unhandled\n");
614
615 if (flags & SHGFI_SELECTED)
616 FIXME("set icon to selected, stub\n");
617
619 FIXME("set icon to shell size, stub\n");
620
621 /* get the iconlocation */
623 {
624 UINT uDummy,uFlags;
625
627 {
629 {
631 psfi->iIcon = -IDI_SHELL_FOLDER;
632 }
633 else
634 {
635 WCHAR* szExt;
636 WCHAR sTemp [MAX_PATH];
637
638 szExt = PathFindExtensionW(szFullPath);
639 TRACE("szExt=%s\n", debugstr_w(szExt));
640 if ( szExt &&
641 HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
642 HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &psfi->iIcon))
643 {
644 if (lstrcmpW(L"%1", sTemp))
645 strcpyW(psfi->szDisplayName, sTemp);
646 else
647 {
648 /* the icon is in the file */
649 strcpyW(psfi->szDisplayName, szFullPath);
650 }
651 }
652 else
653 ret = FALSE;
654 }
655 }
656 else if (psfParent)
657 {
658 hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1,
659 (LPCITEMIDLIST*)&pidlLast, &IID_IExtractIconW,
660 &uDummy, (LPVOID*)&pei);
661 if (SUCCEEDED(hr))
662 {
663 hr = IExtractIconW_GetIconLocation(pei, uGilFlags,
664 szLocation, MAX_PATH, &iIndex, &uFlags);
665
666 if (uFlags & GIL_NOTFILENAME)
667 ret = FALSE;
668 else
669 {
670 lstrcpyW (psfi->szDisplayName, szLocation);
671 psfi->iIcon = iIndex;
672 }
673 IExtractIconW_Release(pei);
674 }
675 }
676 }
677
678 /* get icon index (or load icon)*/
680 {
682 {
683 WCHAR sTemp [MAX_PATH];
684 WCHAR * szExt;
685 int icon_idx=0;
686
687 lstrcpynW(sTemp, szFullPath, MAX_PATH);
688
691 else
692 {
693 psfi->iIcon = 0;
694 szExt = PathFindExtensionW(sTemp);
695 if ( szExt &&
696 HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
697 HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &icon_idx))
698 {
699 if (!lstrcmpW(L"%1",sTemp)) /* icon is in the file */
700 strcpyW(sTemp, szFullPath);
701
703 {
704 psfi->iIcon = SIC_GetIconIndex(sTemp,icon_idx,0);
705 if (psfi->iIcon == -1)
706 psfi->iIcon = 0;
707 }
708 else
709 {
710 UINT ret;
712 ret = PrivateExtractIconsW( sTemp,icon_idx,
715 &psfi->hIcon, 0, 1, 0);
716 else
717 ret = PrivateExtractIconsW( sTemp, icon_idx,
720 &psfi->hIcon, 0, 1, 0);
721 if (ret != 0 && ret != (UINT)-1)
722 {
723 IconNotYetLoaded=FALSE;
724 psfi->iIcon = icon_idx;
725 }
726 }
727 }
728 }
729 }
730 else if (psfParent)
731 {
732 if (!(PidlToSicIndex(psfParent, pidlLast, !(flags & SHGFI_SMALLICON),
733 uGilFlags, &(psfi->iIcon))))
734 {
735 ret = FALSE;
736 }
737 }
738 if (ret && (flags & SHGFI_SYSICONINDEX))
739 {
741 ret = (DWORD_PTR)small_icons;
742 else
743 ret = (DWORD_PTR)big_icons;
744 }
745 }
746
747 /* icon handle */
748 if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded)
749 {
751 psfi->hIcon = ImageList_GetIcon( small_icons, psfi->iIcon, ILD_NORMAL);
752 else
753 psfi->hIcon = ImageList_GetIcon( big_icons, psfi->iIcon, ILD_NORMAL);
754 }
755
757 FIXME("unknown flags %08x\n", flags & ~SHGFI_KNOWN_FLAGS);
758
759 if (psfParent)
760 IShellFolder_Release(psfParent);
761
762 if (hr != S_OK)
763 ret = FALSE;
764
765 SHFree(pidlLast);
766
767 TRACE ("icon=%p index=0x%08x attr=0x%08x name=%s type=%s ret=0x%08lx\n",
768 psfi->hIcon, psfi->iIcon, psfi->dwAttributes,
770
771 return ret;
772}
#define IDI_SHELL_FOLDER
Definition: treeview.c:36
#define ERR(fmt,...)
Definition: precomp.h:57
UINT uFlags
Definition: api.c:59
HICON WINAPI ImageList_GetIcon(HIMAGELIST himl, INT i, UINT fStyle)
Definition: imagelist.c:1963
#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:4242
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:394
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1579
#define IShellFolder_GetDisplayNameOf
Definition: utils.cpp:13
WCHAR swShell32Name[MAX_PATH]
Definition: folders.cpp:22
INT SIC_GetIconIndex(LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags)
Definition: iconcache.cpp:440
BOOL PidlToSicIndex(IShellFolder *sh, LPCITEMIDLIST pidl, BOOL bBigIcon, UINT uFlags, int *pIndex)
Definition: iconcache.cpp:709
BOOL WINAPI Shell_GetImageLists(HIMAGELIST *lpBigList, HIMAGELIST *lpSmallList)
Definition: iconcache.cpp:683
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define PathCombineW
Definition: pathcch.h:317
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:940
HRESULT WINAPI SHILCreateFromPathW(LPCWSTR path, LPITEMIDLIST *ppidl, DWORD *attributes)
Definition: pidl.c:401
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1350
void _ILGetFileType(LPCITEMIDLIST pidl, LPWSTR pOut, UINT uOutSize)
Definition: pidl.c:2500
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1342
#define ILD_NORMAL
Definition: commctrl.h:417
#define strcatW(d, s)
Definition: unicode.h:36
const WCHAR * str
BOOL HCR_GetIconW(LPCWSTR szClass, LPWSTR szDest, LPCWSTR szName, DWORD len, int *picon_idx)
Definition: classes.c:297
BOOL SHELL_IsShortcut(LPCITEMIDLIST pidlLast)
Definition: shell32_main.c:383
#define SHGFI_KNOWN_FLAGS
Definition: shell32_main.c:404
static DWORD shgfi_get_exe_type(LPCWSTR szFullPath)
Definition: shell32_main.c:314
BOOL WINAPI StrRetToStrNW(LPWSTR dest, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl)
Definition: shellstring.c:85
HRESULT hr
Definition: shlfolder.c:183
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:1013
#define SM_CXSMICON
Definition: winuser.h:1012

Referenced by AddListViewItems(), CShellMenuCallback::AddOrSetMenuItem(), BrFolder_GetIcon(), BrFolder_OnOK(), FILEDLG95_InitControls(), FILEDLG95_LOOKIN_AddItem(), FILEDLG95_LOOKIN_DrawItem(), GetAssocClass(), CZipFolder::GetDetailsOf(), COpenWithList::GetIcon(), CFileDefExt::InitFileType(), CSendToMenu::LoadAllItems(), CNewMenu::LoadItem(), CShellBrowser::OnAddToFavorites(), CShellLink::OnInitDialog(), QueryFileDescription(), RecycleBin5File_RecycleBinFile_GetTypeName(), SH_GetTargetTypeByPath(), SHCreateFileExtractIconW(), SHGetFileInfoA(), SHGetFileInfoWrapW(), 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 314 of file shell32_main.c.

315{
316 BOOL status = FALSE;
317 HANDLE hfile;
318 DWORD BinaryType;
319 IMAGE_DOS_HEADER mz_header;
321 DWORD len;
322 char magic[4];
323
324 status = GetBinaryTypeW (szFullPath, &BinaryType);
325 if (!status)
326 return 0;
327 if (BinaryType == SCS_DOS_BINARY || BinaryType == SCS_PIF_BINARY)
328 return 0x4d5a;
329
330 hfile = CreateFileW( szFullPath, GENERIC_READ, FILE_SHARE_READ,
331 NULL, OPEN_EXISTING, 0, 0 );
332 if ( hfile == INVALID_HANDLE_VALUE )
333 return 0;
334
335 /*
336 * The next section is adapted from MODULE_GetBinaryType, as we need
337 * to examine the image header to get OS and version information. We
338 * know from calling GetBinaryTypeA that the image is valid and either
339 * an NE or PE, so much error handling can be omitted.
340 * Seek to the start of the file and read the header information.
341 */
342
343 SetFilePointer( hfile, 0, NULL, SEEK_SET );
344 ReadFile( hfile, &mz_header, sizeof(mz_header), &len, NULL );
345
346 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
347 ReadFile( hfile, magic, sizeof(magic), &len, NULL );
348 if ( *(DWORD*)magic == IMAGE_NT_SIGNATURE )
349 {
350 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
351 ReadFile( hfile, &nt, sizeof(nt), &len, NULL );
352 CloseHandle( hfile );
353 /* DLL files are not executable and should return 0 */
355 return 0;
357 {
358 return IMAGE_NT_SIGNATURE |
361 }
362 return IMAGE_NT_SIGNATURE;
363 }
364 else if ( *(WORD*)magic == IMAGE_OS2_SIGNATURE )
365 {
367 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
368 ReadFile( hfile, &ne, sizeof(ne), &len, NULL );
369 CloseHandle( hfile );
370 if (ne.ne_exetyp == 2)
371 return IMAGE_OS2_SIGNATURE | (ne.ne_expver << 16);
372 return 0;
373 }
374 CloseHandle( hfile );
375 return 0;
376}
#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
u32_t magic(void)
#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:240
#define SCS_DOS_BINARY
Definition: winbase.h:238

Referenced by SHGetFileInfoW().

◆ SHHelpShortcuts_RunDLLA()

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

Definition at line 970 of file shell32_main.c.

971{
972 FIXME("(%x, %x, %x, %x) stub!\n", dwArg1, dwArg2, dwArg3, dwArg4);
973 return 0;
974}

◆ SHHelpShortcuts_RunDLLW()

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

Definition at line 980 of file shell32_main.c.

981{
982 FIXME("(%x, %x, %x, %x) stub!\n", dwArg1, dwArg2, dwArg3, dwArg4);
983 return 0;
984}

◆ SHLoadInProc()

HRESULT WINAPI SHLoadInProc ( REFCLSID  rclsid)

Definition at line 991 of file shell32_main.c.

992{
993 void *ptr = NULL;
994
995 TRACE("%s\n", debugstr_guid(rclsid));
996
997 CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,&ptr);
998 if(ptr)
999 {
1000 IUnknown * pUnk = ptr;
1001 IUnknown_Release(pUnk);
1002 return S_OK;
1003 }
1004 return DISP_E_MEMBERNOTFOUND;
1005}
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 1371 of file shell32_main.c.

1372{
1373 FIXME("stub\n");
1374 return S_OK;
1375}

◆ 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().