ReactOS 0.4.15-dev-7670-g69b08be
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:171
#define SHGFI_OPENICON
Definition: shellapi.h:175
#define SHGFI_LINKOVERLAY
Definition: shellapi.h:169
#define SHGFI_SYSICONINDEX
Definition: shellapi.h:168
#define SHGFI_ICONLOCATION
Definition: shellapi.h:166
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:163
#define SHGFI_ICON
Definition: shellapi.h:161
#define SHGFI_TYPENAME
Definition: shellapi.h:164
#define SHGFI_USEFILEATTRIBUTES
Definition: shellapi.h:178
#define SHGFI_ATTRIBUTES
Definition: shellapi.h:165
#define SHGFI_SMALLICON
Definition: shellapi.h:173
#define SHGFI_SELECTED
Definition: shellapi.h:170
#define SHGFI_OVERLAYINDEX
Definition: shellapi.h:160
#define SHGFI_PIDL
Definition: shellapi.h:177
#define SHGFI_EXETYPE
Definition: shellapi.h:167
#define SHGFI_SHELLICONSIZE
Definition: shellapi.h:176

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

1036{
1037 switch(msg)
1038 {
1039 case WM_INITDIALOG:
1040 {
1041 const char* const *pstr = SHELL_Authors;
1042
1043 // Add the authors to the list
1045
1046 while (*pstr)
1047 {
1048 WCHAR name[64];
1049
1050 /* authors list is in utf-8 format */
1051 MultiByteToWideChar( CP_UTF8, 0, *pstr, -1, name, sizeof(name)/sizeof(WCHAR) );
1053 pstr++;
1054 }
1055
1057
1058 return TRUE;
1059 }
1060 }
1061
1062 return FALSE;
1063}
#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:369
Definition: name.c:39
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define WM_INITDIALOG
Definition: winuser.h:1738
#define LB_ADDSTRING
Definition: winuser.h:2030
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETREDRAW
Definition: winuser.h:1615
__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 1067 of file shell32_main.c.

1068{
1069#ifdef __REACTOS__
1070
1071 static DWORD cxLogoBmp;
1072 static DWORD cyLogoBmp, cyLineBmp;
1073 static HBITMAP hLogoBmp, hLineBmp;
1074 static HWND hWndAuthors;
1075
1076 switch (msg)
1077 {
1078 case WM_INITDIALOG:
1079 {
1081
1082 if (info)
1083 {
1084 HKEY hRegKey;
1085 MEMORYSTATUSEX MemStat;
1086 WCHAR szAppTitle[512];
1087 WCHAR szAppTitleTemplate[512];
1088 WCHAR szAuthorsText[20];
1089
1090 // Preload the ROS bitmap
1091 if (IsWindowsServer())
1092 {
1093 // Load Server Bitmap
1095 }
1096 else
1097 {
1098 // Load Workstation Bitmap
1100 }
1102
1103 if (hLogoBmp && hLineBmp)
1104 {
1105 BITMAP bmpLogo;
1106
1107 GetObject(hLogoBmp, sizeof(BITMAP), &bmpLogo);
1108
1109 cxLogoBmp = bmpLogo.bmWidth;
1110 cyLogoBmp = bmpLogo.bmHeight;
1111
1112 GetObject(hLineBmp, sizeof(BITMAP), &bmpLogo);
1113 cyLineBmp = bmpLogo.bmHeight;
1114 }
1115
1116 // Set App-specific stuff (icon, app name, szOtherStuff string)
1118
1119 GetWindowTextW(hWnd, szAppTitleTemplate, ARRAY_SIZE(szAppTitleTemplate));
1120 swprintf(szAppTitle, szAppTitleTemplate, info->szApp);
1122
1126
1127 // Set the registered user and organization name
1128 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
1129 0, KEY_QUERY_VALUE, &hRegKey) == ERROR_SUCCESS)
1130 {
1131 SetRegTextData(hWnd, hRegKey, L"RegisteredOwner", IDC_ABOUT_REG_USERNAME);
1132 SetRegTextData(hWnd, hRegKey, L"RegisteredOrganization", IDC_ABOUT_REG_ORGNAME);
1133
1136 {
1138 }
1139
1140 RegCloseKey(hRegKey);
1141 }
1142
1143 // Set the value for the installed physical memory
1144 MemStat.dwLength = sizeof(MemStat);
1145 if (GlobalMemoryStatusEx(&MemStat))
1146 {
1147 WCHAR szBuf[12];
1148
1149 if (MemStat.ullTotalPhys > 1024 * 1024 * 1024)
1150 {
1151 double dTotalPhys;
1152 WCHAR szDecimalSeparator[4];
1153 WCHAR szUnits[3];
1154
1155 // We're dealing with GBs or more
1156 MemStat.ullTotalPhys /= 1024 * 1024;
1157
1158 if (MemStat.ullTotalPhys > 1024 * 1024)
1159 {
1160 // We're dealing with TBs or more
1161 MemStat.ullTotalPhys /= 1024;
1162
1163 if (MemStat.ullTotalPhys > 1024 * 1024)
1164 {
1165 // We're dealing with PBs or more
1166 MemStat.ullTotalPhys /= 1024;
1167
1168 dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1169 wcscpy(szUnits, L"PB");
1170 }
1171 else
1172 {
1173 dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1174 wcscpy(szUnits, L"TB");
1175 }
1176 }
1177 else
1178 {
1179 dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1180 wcscpy(szUnits, L"GB");
1181 }
1182
1183 // We need the decimal point of the current locale to display the RAM size correctly
1185 szDecimalSeparator,
1186 ARRAY_SIZE(szDecimalSeparator)) > 0)
1187 {
1188 UCHAR uDecimals;
1189 UINT uIntegral;
1190
1191 uIntegral = (UINT)dTotalPhys;
1192 uDecimals = (UCHAR)((UINT)(dTotalPhys * 100) - uIntegral * 100);
1193
1194 // Display the RAM size with 2 decimals
1195 swprintf(szBuf, L"%u%s%02u %s", uIntegral, szDecimalSeparator, uDecimals, szUnits);
1196 }
1197 }
1198 else
1199 {
1200 // We're dealing with MBs, don't show any decimals
1201 swprintf(szBuf, L"%u MB", (UINT)MemStat.ullTotalPhys / 1024 / 1024);
1202 }
1203
1205 }
1206
1207 // Add the Authors dialog
1209 LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, ARRAY_SIZE(szAuthorsText));
1210 SetDlgItemTextW(hWnd, IDC_ABOUT_AUTHORS, szAuthorsText);
1211 }
1212
1213 return TRUE;
1214 }
1215
1216 case WM_PAINT:
1217 {
1218 if (hLogoBmp && hLineBmp)
1219 {
1220 PAINTSTRUCT ps;
1221 HDC hdc;
1222 HDC hdcMem;
1223 HGDIOBJ hOldObj;
1224
1225 hdc = BeginPaint(hWnd, &ps);
1227
1228 if (hdcMem)
1229 {
1230 hOldObj = SelectObject(hdcMem, hLogoBmp);
1231 BitBlt(hdc, 0, 0, cxLogoBmp, cyLogoBmp, hdcMem, 0, 0, SRCCOPY);
1232
1233 SelectObject(hdcMem, hLineBmp);
1234 BitBlt(hdc, 0, cyLogoBmp, cxLogoBmp, cyLineBmp, hdcMem, 0, 0, SRCCOPY);
1235
1236 SelectObject(hdcMem, hOldObj);
1238 }
1239
1240 EndPaint(hWnd, &ps);
1241 }
1242 break;
1243 }
1244
1245 case WM_COMMAND:
1246 {
1247 switch(wParam)
1248 {
1249 case IDOK:
1250 case IDCANCEL:
1252 return TRUE;
1253
1254 case IDC_ABOUT_AUTHORS:
1255 {
1256 static BOOL bShowingAuthors = FALSE;
1257 WCHAR szAuthorsText[20];
1258
1259 if (bShowingAuthors)
1260 {
1261 LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, ARRAY_SIZE(szAuthorsText));
1262 ShowWindow(hWndAuthors, SW_HIDE);
1263 }
1264 else
1265 {
1266 LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_BACK, szAuthorsText, ARRAY_SIZE(szAuthorsText));
1267 ShowWindow(hWndAuthors, SW_SHOW);
1268 }
1269
1270 SetDlgItemTextW(hWnd, IDC_ABOUT_AUTHORS, szAuthorsText);
1271 bShowingAuthors = !bShowingAuthors;
1272 return TRUE;
1273 }
1274 }
1275 break;
1276 }
1277
1278 case WM_CLOSE:
1280 break;
1281 }
1282
1283#endif // __REACTOS__
1284
1285 return 0;
1286}
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:3362
#define swprintf
Definition: precomp.h:40
static VOID NTAPI 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:49
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
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1108
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:362
#define IDC_ABOUT_REG_TO
Definition: shresdef.h:361
#define IDC_ABOUT_ICON
Definition: shresdef.h:356
#define IDB_REACTOS_SERVER
Definition: shresdef.h:32
#define IDC_ABOUT_PHYSMEM
Definition: shresdef.h:364
#define IDB_LINEBAR
Definition: shresdef.h:33
#define IDC_ABOUT_APPNAME
Definition: shresdef.h:357
#define IDC_ABOUT_AUTHORS
Definition: shresdef.h:368
#define IDC_ABOUT_REG_ORGNAME
Definition: shresdef.h:363
#define IDB_REACTOS_WORKSTATION
Definition: shresdef.h:31
#define IDC_ABOUT_VERSION
Definition: shresdef.h:359
#define IDC_ABOUT_OTHERSTUFF
Definition: shresdef.h:360
#define IDD_ABOUT_AUTHORS
Definition: shresdef.h:367
#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:1412
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
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:1619
#define SW_HIDE
Definition: winuser.h:767
#define WM_CLOSE
Definition: winuser.h:1620
#define IMAGE_BITMAP
Definition: winuser.h:211
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define STM_SETICON
Definition: winuser.h:2091
#define IDCANCEL
Definition: winuser.h:830
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:1739
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:829
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:4280
#define LoadImage
Definition: winuser.h:5814
#define LR_DEFAULTCOLOR
Definition: winuser.h:1086
#define SW_SHOW
Definition: winuser.h:774
#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:28
#define strcpyW(d, s)
Definition: unicode.h:29
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 836 of file shell32_main.c.

837{
839 HICON hDupIcon = 0;
840
841 TRACE("%p %p\n", hInstance, hIcon);
842
844 {
845 hDupIcon = CreateIconIndirect(&IconInfo);
846
847 /* clean up hbmMask and hbmColor */
850 }
851
852 return hDupIcon;
853}
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:3126
HBITMAP hbmMask
Definition: winuser.h:3125
HICON WINAPI CreateIconIndirect(_In_ PICONINFO)
Definition: cursoricon.c:2564
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2028

◆ ExtractIconA()

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

Definition at line 858 of file shell32_main.c.

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

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

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

◆ FreeIconList()

void WINAPI FreeIconList ( DWORD  dw)

Definition at line 1366 of file shell32_main.c.

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

◆ Printer_LoadIconsW()

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

Definition at line 905 of file shell32_main.c.

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

◆ Printers_RegisterWindowW()

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

Definition at line 939 of file shell32_main.c.

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

◆ Printers_UnregisterWindow()

VOID WINAPI Printers_UnregisterWindow ( HANDLE  hClassPidl,
HWND  hwnd 
)

Definition at line 952 of file shell32_main.c.

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

1011{
1012 DWORD dwBufferSize;
1013 DWORD dwType;
1015
1016 if( RegQueryValueExW(hKey, Value, NULL, &dwType, NULL, &dwBufferSize) == ERROR_SUCCESS )
1017 {
1018 if(dwType == REG_SZ)
1019 {
1020 lpBuffer = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, dwBufferSize);
1021
1022 if(lpBuffer)
1023 {
1024 if( RegQueryValueExW(hKey, Value, NULL, &dwType, (LPBYTE)lpBuffer, &dwBufferSize) == ERROR_SUCCESS )
1025 {
1027 }
1028
1030 }
1031 }
1032 }
1033}
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:4132
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 char szTemp[MAX_PATH];
386 HKEY keyCls;
387 BOOL ret = FALSE;
388
389 if (_ILGetExtension(pidlLast, szTemp, MAX_PATH) &&
390 HCR_MapTypeToValueA(szTemp, szTemp, MAX_PATH, TRUE))
391 {
393 {
394 if (ERROR_SUCCESS == RegQueryValueExA(keyCls, "IsShortcut", NULL, NULL, NULL, NULL))
395 ret = TRUE;
396
397 RegCloseKey(keyCls);
398 }
399 }
400
401 return ret;
402}
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3327
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4038
BOOL _ILGetExtension(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2502
BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, LONG len, BOOL bPrependDot)
Definition: classes.c:88
#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 1292 of file shell32_main.c.

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

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

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

788{
789 INT len;
790 LPWSTR temppath = NULL;
791 LPCWSTR pathW;
793 SHFILEINFOW temppsfi;
794
795 if (flags & SHGFI_PIDL)
796 {
797 /* path contains a pidl */
798 pathW = (LPCWSTR)path;
799 }
800 else
801 {
802 len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
803 temppath = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
804 MultiByteToWideChar(CP_ACP, 0, path, -1, temppath, len);
805 pathW = temppath;
806 }
807
808 if (psfi)
809 {
810 temppsfi.hIcon = psfi->hIcon;
811 temppsfi.iIcon = psfi->iIcon;
812 temppsfi.dwAttributes = psfi->dwAttributes;
813
814 ret = SHGetFileInfoW(pathW, dwFileAttributes, &temppsfi, sizeof(temppsfi), flags);
815 psfi->hIcon = temppsfi.hIcon;
816 psfi->iIcon = temppsfi.iIcon;
817 psfi->dwAttributes = temppsfi.dwAttributes;
818
820 psfi->szDisplayName, sizeof(psfi->szDisplayName), NULL, NULL);
821
822 WideCharToMultiByte(CP_ACP, 0, temppsfi.szTypeName, -1,
823 psfi->szTypeName, sizeof(psfi->szTypeName), NULL, NULL);
824 }
825 else
827
828 HeapFree(GetProcessHeap(), 0, temppath);
829
830 return ret;
831}
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:366
HICON hIcon
Definition: shellapi.h:362
DWORD dwAttributes
Definition: shellapi.h:364
CHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:365
WCHAR szTypeName[80]
Definition: shellapi.h:373
DWORD dwAttributes
Definition: shellapi.h:371
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:372
HICON hIcon
Definition: shellapi.h:369
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 char ftype[80];
564
565 _ILGetFileType(pidlLast, ftype, 80);
566 MultiByteToWideChar(CP_ACP, 0, ftype, -1, psfi->szTypeName, 80 );
567 }
568 else
569 {
571 strcatW (psfi->szTypeName, L"Folder");
572 else
573 {
574 WCHAR sTemp[64];
575
576 lstrcpyW(sTemp,PathFindExtensionW(szFullPath));
577 if (sTemp[0] == 0 || (sTemp[0] == '.' && sTemp[1] == 0))
578 {
579 /* "name" or "name." => "File" */
580 lstrcpynW (psfi->szTypeName, L"File", 64);
581 }
582 else if (!( HCR_MapTypeToValueW(sTemp, sTemp, 64, TRUE) &&
583 HCR_MapTypeToValueW(sTemp, psfi->szTypeName, 80, FALSE )))
584 {
585 if (sTemp[0])
586 {
587 lstrcpynW (psfi->szTypeName, sTemp, 64);
588 strcatW (psfi->szTypeName, L" file");
589 }
590 else
591 {
592 lstrcpynW (psfi->szTypeName, L"File", 64);
593 }
594 }
595 }
596 }
597 }
598
599 /* ### icons ###*/
600
601 Shell_GetImageLists( &big_icons, &small_icons );
602
603 if (flags & SHGFI_OPENICON)
604 uGilFlags |= GIL_OPENICON;
605
607 uGilFlags |= GIL_FORSHORTCUT;
608 else if ((flags&SHGFI_ADDOVERLAYS) ||
610 {
611 if (SHELL_IsShortcut(pidlLast))
612 uGilFlags |= GIL_FORSHORTCUT;
613 }
614
616 FIXME("SHGFI_OVERLAYINDEX unhandled\n");
617
618 if (flags & SHGFI_SELECTED)
619 FIXME("set icon to selected, stub\n");
620
622 FIXME("set icon to shell size, stub\n");
623
624 /* get the iconlocation */
626 {
627 UINT uDummy,uFlags;
628
630 {
632 {
634 psfi->iIcon = -IDI_SHELL_FOLDER;
635 }
636 else
637 {
638 WCHAR* szExt;
639 WCHAR sTemp [MAX_PATH];
640
641 szExt = PathFindExtensionW(szFullPath);
642 TRACE("szExt=%s\n", debugstr_w(szExt));
643 if ( szExt &&
644 HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
645 HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &psfi->iIcon))
646 {
647 if (lstrcmpW(L"%1", sTemp))
648 strcpyW(psfi->szDisplayName, sTemp);
649 else
650 {
651 /* the icon is in the file */
652 strcpyW(psfi->szDisplayName, szFullPath);
653 }
654 }
655 else
656 ret = FALSE;
657 }
658 }
659 else if (psfParent)
660 {
661 hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1,
662 (LPCITEMIDLIST*)&pidlLast, &IID_IExtractIconW,
663 &uDummy, (LPVOID*)&pei);
664 if (SUCCEEDED(hr))
665 {
666 hr = IExtractIconW_GetIconLocation(pei, uGilFlags,
667 szLocation, MAX_PATH, &iIndex, &uFlags);
668
669 if (uFlags & GIL_NOTFILENAME)
670 ret = FALSE;
671 else
672 {
673 lstrcpyW (psfi->szDisplayName, szLocation);
674 psfi->iIcon = iIndex;
675 }
676 IExtractIconW_Release(pei);
677 }
678 }
679 }
680
681 /* get icon index (or load icon)*/
683 {
685 {
686 WCHAR sTemp [MAX_PATH];
687 WCHAR * szExt;
688 int icon_idx=0;
689
690 lstrcpynW(sTemp, szFullPath, MAX_PATH);
691
694 else
695 {
696 psfi->iIcon = 0;
697 szExt = PathFindExtensionW(sTemp);
698 if ( szExt &&
699 HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
700 HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &icon_idx))
701 {
702 if (!lstrcmpW(L"%1",sTemp)) /* icon is in the file */
703 strcpyW(sTemp, szFullPath);
704
706 {
707 psfi->iIcon = SIC_GetIconIndex(sTemp,icon_idx,0);
708 if (psfi->iIcon == -1)
709 psfi->iIcon = 0;
710 }
711 else
712 {
713 UINT ret;
715 ret = PrivateExtractIconsW( sTemp,icon_idx,
718 &psfi->hIcon, 0, 1, 0);
719 else
720 ret = PrivateExtractIconsW( sTemp, icon_idx,
723 &psfi->hIcon, 0, 1, 0);
724 if (ret != 0 && ret != (UINT)-1)
725 {
726 IconNotYetLoaded=FALSE;
727 psfi->iIcon = icon_idx;
728 }
729 }
730 }
731 }
732 }
733 else if (psfParent)
734 {
735 if (!(PidlToSicIndex(psfParent, pidlLast, !(flags & SHGFI_SMALLICON),
736 uGilFlags, &(psfi->iIcon))))
737 {
738 ret = FALSE;
739 }
740 }
741 if (ret && (flags & SHGFI_SYSICONINDEX))
742 {
744 ret = (DWORD_PTR)small_icons;
745 else
746 ret = (DWORD_PTR)big_icons;
747 }
748 }
749
750 /* icon handle */
751 if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded)
752 {
754 psfi->hIcon = ImageList_GetIcon( small_icons, psfi->iIcon, ILD_NORMAL);
755 else
756 psfi->hIcon = ImageList_GetIcon( big_icons, psfi->iIcon, ILD_NORMAL);
757 }
758
760 FIXME("unknown flags %08x\n", flags & ~SHGFI_KNOWN_FLAGS);
761
762 if (psfParent)
763 IShellFolder_Release(psfParent);
764
765 if (hr != S_OK)
766 ret = FALSE;
767
768 SHFree(pidlLast);
769
770 TRACE ("icon=%p index=0x%08x attr=0x%08x name=%s type=%s ret=0x%08lx\n",
771 psfi->hIcon, psfi->iIcon, psfi->dwAttributes,
773
774 return ret;
775}
#define IDI_SHELL_FOLDER
Definition: treeview.c:36
#define ERR(fmt,...)
Definition: debug.h:110
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
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
WCHAR swShell32Name[MAX_PATH]
Definition: folders.cpp:22
INT SIC_GetIconIndex(LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags)
Definition: iconcache.cpp:443
BOOL PidlToSicIndex(IShellFolder *sh, LPCITEMIDLIST pidl, BOOL bBigIcon, UINT uFlags, int *pIndex)
Definition: iconcache.cpp:726
BOOL WINAPI Shell_GetImageLists(HIMAGELIST *lpBigList, HIMAGELIST *lpSmallList)
Definition: iconcache.cpp:700
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define PathCombineW
Definition: pathcch.h:317
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:929
HRESULT WINAPI SHILCreateFromPathW(LPCWSTR path, LPITEMIDLIST *ppidl, DWORD *attributes)
Definition: pidl.c:392
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1352
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1344
void _ILGetFileType(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2548
#define ILD_NORMAL
Definition: commctrl.h:417
#define strcatW(d, s)
Definition: unicode.h:30
const WCHAR * str
BOOL HCR_GetIconW(LPCWSTR szClass, LPWSTR szDest, LPCWSTR szName, DWORD len, int *picon_idx)
Definition: classes.c:288
BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, LONG len, BOOL bPrependDot)
Definition: classes.c:46
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:1012
#define SM_CXSMICON
Definition: winuser.h:1011

Referenced by CFSDropTarget::_DoDrop(), AddListViewItems(), FILEDLG95_InitControls(), FILEDLG95_LOOKIN_AddItem(), FILEDLG95_LOOKIN_DrawItem(), CZipFolder::GetDetailsOf(), GetIcon(), COpenWithList::GetIcon(), CFileDefExt::InitFileType(), CSendToMenu::LoadAllItems(), CNewMenu::LoadItem(), CShellLink::OnInitDialog(), QueryFileDescription(), RecycleBin5File_RecycleBinFile_GetTypeName(), SH_GetTargetTypeByPath(), SHCreateFileExtractIconW(), SHGetFileInfoA(), SHGetFileInfoWrapW(), 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 973 of file shell32_main.c.

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

◆ SHHelpShortcuts_RunDLLW()

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

Definition at line 983 of file shell32_main.c.

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

◆ SHLoadInProc()

HRESULT WINAPI SHLoadInProc ( REFCLSID  rclsid)

Definition at line 994 of file shell32_main.c.

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

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

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