ReactOS 0.4.15-dev-5666-gc548b97
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 403 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 1034 of file shell32_main.c.

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

1067{
1068#ifdef __REACTOS__
1069
1070 static DWORD cxLogoBmp;
1071 static DWORD cyLogoBmp, cyLineBmp;
1072 static HBITMAP hLogoBmp, hLineBmp;
1073 static HWND hWndAuthors;
1074
1075 switch (msg)
1076 {
1077 case WM_INITDIALOG:
1078 {
1080
1081 if (info)
1082 {
1083 HKEY hRegKey;
1084 MEMORYSTATUSEX MemStat;
1085 WCHAR szAppTitle[512];
1086 WCHAR szAppTitleTemplate[512];
1087 WCHAR szAuthorsText[20];
1088
1089 // Preload the ROS bitmap
1090 if (IsWindowsServer())
1091 {
1092 // Load Server Bitmap
1094 }
1095 else
1096 {
1097 // Load Workstation Bitmap
1099 }
1101
1102 if (hLogoBmp && hLineBmp)
1103 {
1104 BITMAP bmpLogo;
1105
1106 GetObject(hLogoBmp, sizeof(BITMAP), &bmpLogo);
1107
1108 cxLogoBmp = bmpLogo.bmWidth;
1109 cyLogoBmp = bmpLogo.bmHeight;
1110
1111 GetObject(hLineBmp, sizeof(BITMAP), &bmpLogo);
1112 cyLineBmp = bmpLogo.bmHeight;
1113 }
1114
1115 // Set App-specific stuff (icon, app name, szOtherStuff string)
1117
1118 GetWindowTextW(hWnd, szAppTitleTemplate, ARRAY_SIZE(szAppTitleTemplate));
1119 swprintf(szAppTitle, szAppTitleTemplate, info->szApp);
1121
1125
1126 // Set the registered user and organization name
1127 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
1128 0, KEY_QUERY_VALUE, &hRegKey) == ERROR_SUCCESS)
1129 {
1130 SetRegTextData(hWnd, hRegKey, L"RegisteredOwner", IDC_ABOUT_REG_USERNAME);
1131 SetRegTextData(hWnd, hRegKey, L"RegisteredOrganization", IDC_ABOUT_REG_ORGNAME);
1132
1135 {
1137 }
1138
1139 RegCloseKey(hRegKey);
1140 }
1141
1142 // Set the value for the installed physical memory
1143 MemStat.dwLength = sizeof(MemStat);
1144 if (GlobalMemoryStatusEx(&MemStat))
1145 {
1146 WCHAR szBuf[12];
1147
1148 if (MemStat.ullTotalPhys > 1024 * 1024 * 1024)
1149 {
1150 double dTotalPhys;
1151 WCHAR szDecimalSeparator[4];
1152 WCHAR szUnits[3];
1153
1154 // We're dealing with GBs or more
1155 MemStat.ullTotalPhys /= 1024 * 1024;
1156
1157 if (MemStat.ullTotalPhys > 1024 * 1024)
1158 {
1159 // We're dealing with TBs or more
1160 MemStat.ullTotalPhys /= 1024;
1161
1162 if (MemStat.ullTotalPhys > 1024 * 1024)
1163 {
1164 // We're dealing with PBs or more
1165 MemStat.ullTotalPhys /= 1024;
1166
1167 dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1168 wcscpy(szUnits, L"PB");
1169 }
1170 else
1171 {
1172 dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1173 wcscpy(szUnits, L"TB");
1174 }
1175 }
1176 else
1177 {
1178 dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1179 wcscpy(szUnits, L"GB");
1180 }
1181
1182 // We need the decimal point of the current locale to display the RAM size correctly
1184 szDecimalSeparator,
1185 ARRAY_SIZE(szDecimalSeparator)) > 0)
1186 {
1187 UCHAR uDecimals;
1188 UINT uIntegral;
1189
1190 uIntegral = (UINT)dTotalPhys;
1191 uDecimals = (UCHAR)((UINT)(dTotalPhys * 100) - uIntegral * 100);
1192
1193 // Display the RAM size with 2 decimals
1194 swprintf(szBuf, L"%u%s%02u %s", uIntegral, szDecimalSeparator, uDecimals, szUnits);
1195 }
1196 }
1197 else
1198 {
1199 // We're dealing with MBs, don't show any decimals
1200 swprintf(szBuf, L"%u MB", (UINT)MemStat.ullTotalPhys / 1024 / 1024);
1201 }
1202
1204 }
1205
1206 // Add the Authors dialog
1208 LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, ARRAY_SIZE(szAuthorsText));
1209 SetDlgItemTextW(hWnd, IDC_ABOUT_AUTHORS, szAuthorsText);
1210 }
1211
1212 return TRUE;
1213 }
1214
1215 case WM_PAINT:
1216 {
1217 if (hLogoBmp && hLineBmp)
1218 {
1219 PAINTSTRUCT ps;
1220 HDC hdc;
1221 HDC hdcMem;
1222 HGDIOBJ hOldObj;
1223
1224 hdc = BeginPaint(hWnd, &ps);
1226
1227 if (hdcMem)
1228 {
1229 hOldObj = SelectObject(hdcMem, hLogoBmp);
1230 BitBlt(hdc, 0, 0, cxLogoBmp, cyLogoBmp, hdcMem, 0, 0, SRCCOPY);
1231
1232 SelectObject(hdcMem, hLineBmp);
1233 BitBlt(hdc, 0, cyLogoBmp, cxLogoBmp, cyLineBmp, hdcMem, 0, 0, SRCCOPY);
1234
1235 SelectObject(hdcMem, hOldObj);
1237 }
1238
1239 EndPaint(hWnd, &ps);
1240 }
1241 break;
1242 }
1243
1244 case WM_COMMAND:
1245 {
1246 switch(wParam)
1247 {
1248 case IDOK:
1249 case IDCANCEL:
1251 return TRUE;
1252
1253 case IDC_ABOUT_AUTHORS:
1254 {
1255 static BOOL bShowingAuthors = FALSE;
1256 WCHAR szAuthorsText[20];
1257
1258 if (bShowingAuthors)
1259 {
1260 LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, ARRAY_SIZE(szAuthorsText));
1261 ShowWindow(hWndAuthors, SW_HIDE);
1262 }
1263 else
1264 {
1265 LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_BACK, szAuthorsText, ARRAY_SIZE(szAuthorsText));
1266 ShowWindow(hWndAuthors, SW_SHOW);
1267 }
1268
1269 SetDlgItemTextW(hWnd, IDC_ABOUT_AUTHORS, szAuthorsText);
1270 bShowingAuthors = !bShowingAuthors;
1271 return TRUE;
1272 }
1273 }
1274 break;
1275 }
1276
1277 case WM_CLOSE:
1279 break;
1280 }
1281
1282#endif // __REACTOS__
1283
1284 return 0;
1285}
static BOOL IsWindowsServer()
#define shell32_hInstance
#define ARRAY_SIZE(a)
Definition: main.h:24
#define RegCloseKey(hKey)
Definition: registry.h:47
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:3356
#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:1102
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:354
#define IDC_ABOUT_REG_TO
Definition: shresdef.h:353
#define IDC_ABOUT_ICON
Definition: shresdef.h:348
#define IDB_REACTOS_SERVER
Definition: shresdef.h:32
#define IDC_ABOUT_PHYSMEM
Definition: shresdef.h:356
#define IDB_LINEBAR
Definition: shresdef.h:33
#define IDC_ABOUT_APPNAME
Definition: shresdef.h:349
#define IDC_ABOUT_AUTHORS
Definition: shresdef.h:360
#define IDC_ABOUT_REG_ORGNAME
Definition: shresdef.h:355
#define IDB_REACTOS_WORKSTATION
Definition: shresdef.h:31
#define IDC_ABOUT_VERSION
Definition: shresdef.h:351
#define IDC_ABOUT_OTHERSTUFF
Definition: shresdef.h:352
#define IDD_ABOUT_AUTHORS
Definition: shresdef.h:359
#define IDS_SHELL_ABOUT_BACK
Definition: shresdef.h:137
#define IDS_SHELL_ABOUT_AUTHORS
Definition: shresdef.h:136
Definition: bl.h:1331
HDC hdcMem
Definition: welcome.c:104
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c: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:1610
#define SW_HIDE
Definition: winuser.h:762
#define WM_CLOSE
Definition: winuser.h:1611
#define IMAGE_BITMAP
Definition: winuser.h:211
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define STM_SETICON
Definition: winuser.h:2082
#define IDCANCEL
Definition: winuser.h:825
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:1730
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:824
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:4271
#define LoadImage
Definition: winuser.h:5805
#define LR_DEFAULTCOLOR
Definition: winuser.h:1081
#define SW_SHOW
Definition: winuser.h:769
#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 && *s!=' ' && *s!='\t')
138 s++;
139 }
140 /* skip to the first argument, if any */
141 while (*s==' ' || *s=='\t')
142 s++;
143 if (*s)
144 argc++;
145
146 /* Analyze the remaining arguments */
147 qcount=bcount=0;
148 while (*s)
149 {
150 if ((*s==' ' || *s=='\t') && qcount==0)
151 {
152 /* skip to the next argument and count it if any */
153 while (*s==' ' || *s=='\t')
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 && *d!=' ' && *d!='\t')
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 (*s==' ' || *s=='\t')
231 s++;
232 if (!*s)
233 {
234 /* There are no parameters so we are all done */
235 argv[argc]=NULL;
236 *numargs=argc;
237 return argv;
238 }
239
240 /* Split and copy the remaining arguments */
241 argv[argc++]=d;
242 qcount=bcount=0;
243 while (*s)
244 {
245 if ((*s==' ' || *s=='\t') && qcount==0)
246 {
247 /* close the argument */
248 *d++=0;
249 bcount=0;
250
251 /* skip to the next one and initialize it if any */
252 do {
253 s++;
254 } while (*s==' ' || *s=='\t');
255 if (*s)
256 argv[argc++]=d;
257 }
258 else if (*s=='\\')
259 {
260 *d++=*s++;
261 bcount++;
262 }
263 else if (*s=='"')
264 {
265 if ((bcount & 1)==0)
266 {
267 /* Preceded by an even number of '\', this is half that
268 * number of '\', plus a quote which we erase.
269 */
270 d-=bcount/2;
271 qcount++;
272 }
273 else
274 {
275 /* Preceded by an odd number of '\', this is half that
276 * number of '\' followed by a '"'
277 */
278 d=d-bcount/2-1;
279 *d++='"';
280 }
281 s++;
282 bcount=0;
283 /* Now count the number of consecutive quotes. Note that qcount
284 * already takes into account the opening quote if any, as well as
285 * the quote that lead us here.
286 */
287 while (*s=='"')
288 {
289 if (++qcount==3)
290 {
291 *d++='"';
292 qcount=0;
293 }
294 s++;
295 }
296 if (qcount==2)
297 qcount=0;
298 }
299 else
300 {
301 /* a regular character */
302 *d++=*s++;
303 bcount=0;
304 }
305 }
306 *d='\0';
307 argv[argc]=NULL;
308 *numargs=argc;
309
310 return argv;
311}
static int argc
Definition: ServiceArgs.c:12
#define 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:1373
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#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 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 835 of file shell32_main.c.

836{
838 HICON hDupIcon = 0;
839
840 TRACE("%p %p\n", hInstance, hIcon);
841
843 {
844 hDupIcon = CreateIconIndirect(&IconInfo);
845
846 /* clean up hbmMask and hbmColor */
849 }
850
851 return hDupIcon;
852}
HINSTANCE hInstance
Definition: charmap.c:19
pKey DeleteObject()
_Out_opt_ PICONINFO IconInfo
Definition: ntuser.h:2417
static HICON
Definition: imagelist.c:84
HICON hIcon
Definition: msconfig.c:44
#define TRACE(s)
Definition: solgame.cpp:4
HBITMAP hbmColor
Definition: winuser.h:3117
HBITMAP hbmMask
Definition: winuser.h:3116
HICON WINAPI CreateIconIndirect(_In_ PICONINFO)
Definition: cursoricon.c:2550
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2014

◆ ExtractIconA()

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

Definition at line 857 of file shell32_main.c.

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

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

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

◆ FreeIconList()

void WINAPI FreeIconList ( DWORD  dw)

Definition at line 1365 of file shell32_main.c.

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

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

◆ Printers_RegisterWindowW()

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

Definition at line 938 of file shell32_main.c.

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

◆ Printers_UnregisterWindow()

VOID WINAPI Printers_UnregisterWindow ( HANDLE  hClassPidl,
HWND  hwnd 
)

Definition at line 951 of file shell32_main.c.

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

1010{
1011 DWORD dwBufferSize;
1012 DWORD dwType;
1014
1015 if( RegQueryValueExW(hKey, Value, NULL, &dwType, NULL, &dwBufferSize) == ERROR_SUCCESS )
1016 {
1017 if(dwType == REG_SZ)
1018 {
1019 lpBuffer = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, dwBufferSize);
1020
1021 if(lpBuffer)
1022 {
1023 if( RegQueryValueExW(hKey, Value, NULL, &dwType, (LPBYTE)lpBuffer, &dwBufferSize) == ERROR_SUCCESS )
1024 {
1026 }
1027
1029 }
1030 }
1031 }
1032}
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:4121
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 382 of file shell32_main.c.

383{
384 char szTemp[MAX_PATH];
385 HKEY keyCls;
386 BOOL ret = FALSE;
387
388 if (_ILGetExtension(pidlLast, szTemp, MAX_PATH) &&
389 HCR_MapTypeToValueA(szTemp, szTemp, MAX_PATH, TRUE))
390 {
392 {
393 if (ERROR_SUCCESS == RegQueryValueExA(keyCls, "IsShortcut", NULL, NULL, NULL, NULL))
394 ret = TRUE;
395
396 RegCloseKey(keyCls);
397 }
398 }
399
400 return ret;
401}
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3321
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:4027
BOOL _ILGetExtension(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2487
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 1291 of file shell32_main.c.

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

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

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

787{
788 INT len;
789 LPWSTR temppath = NULL;
790 LPCWSTR pathW;
792 SHFILEINFOW temppsfi;
793
794 if (flags & SHGFI_PIDL)
795 {
796 /* path contains a pidl */
797 pathW = (LPCWSTR)path;
798 }
799 else
800 {
801 len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
802 temppath = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
803 MultiByteToWideChar(CP_ACP, 0, path, -1, temppath, len);
804 pathW = temppath;
805 }
806
807 if (psfi)
808 {
809 temppsfi.hIcon = psfi->hIcon;
810 temppsfi.iIcon = psfi->iIcon;
811 temppsfi.dwAttributes = psfi->dwAttributes;
812
813 ret = SHGetFileInfoW(pathW, dwFileAttributes, &temppsfi, sizeof(temppsfi), flags);
814 psfi->hIcon = temppsfi.hIcon;
815 psfi->iIcon = temppsfi.iIcon;
816 psfi->dwAttributes = temppsfi.dwAttributes;
817
819 psfi->szDisplayName, sizeof(psfi->szDisplayName), NULL, NULL);
820
821 WideCharToMultiByte(CP_ACP, 0, temppsfi.szTypeName, -1,
822 psfi->szTypeName, sizeof(psfi->szTypeName), NULL, NULL);
823 }
824 else
826
827 HeapFree(GetProcessHeap(), 0, temppath);
828
829 return ret;
830}
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:414
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 CZipFolder::GetDetailsOf(), 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 414 of file shell32_main.c.

416{
417 WCHAR szLocation[MAX_PATH], szFullPath[MAX_PATH];
418 int iIndex;
421 IShellFolder * psfParent = NULL;
422 IExtractIconW * pei = NULL;
423 LPITEMIDLIST pidlLast = NULL, pidl = NULL;
424 HRESULT hr = S_OK;
425 BOOL IconNotYetLoaded=TRUE;
426 UINT uGilFlags = 0;
427 HIMAGELIST big_icons, small_icons;
428
429 TRACE("%s fattr=0x%x sfi=%p(attr=0x%08x) size=0x%x flags=0x%x\n",
431 psfi, psfi ? psfi->dwAttributes : 0, sizeofpsfi, flags);
432
433 if (!path)
434 return FALSE;
435
436 /* windows initializes these values regardless of the flags */
437 if (psfi != NULL)
438 {
439 psfi->szDisplayName[0] = '\0';
440 psfi->szTypeName[0] = '\0';
441 psfi->hIcon = NULL;
442 }
443
444 if (!(flags & SHGFI_PIDL))
445 {
446 /* SHGetFileInfo should work with absolute and relative paths */
448 {
449 GetCurrentDirectoryW(MAX_PATH, szLocation);
450 PathCombineW(szFullPath, szLocation, path);
451 }
452 else
453 {
454 lstrcpynW(szFullPath, path, MAX_PATH);
455 }
456 }
457 else
458 {
460 }
461
462 if (flags & SHGFI_EXETYPE)
463 {
464 if (!(flags & SHGFI_SYSICONINDEX))
465 {
467 {
468 return TRUE;
469 }
470 else if (GetFileAttributesW(szFullPath) != INVALID_FILE_ATTRIBUTES)
471 {
472 return shgfi_get_exe_type(szFullPath);
473 }
474 }
475 }
476
477 /*
478 * psfi is NULL normally to query EXE type. If it is NULL, none of the
479 * below makes sense anyway. Windows allows this and just returns FALSE
480 */
481 if (psfi == NULL)
482 return FALSE;
483
484 /*
485 * translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES
486 * is not specified.
487 * The pidl functions fail on not existing file names
488 */
489
490 if (flags & SHGFI_PIDL)
491 {
492 pidl = ILClone((LPCITEMIDLIST)path);
493 }
494 else if (!(flags & SHGFI_USEFILEATTRIBUTES))
495 {
496 hr = SHILCreateFromPathW(szFullPath, &pidl, &dwAttributes);
497 }
498
500 {
501 /* get the parent shellfolder */
502 if (pidl)
503 {
504 hr = SHBindToParent( pidl, &IID_IShellFolder, (LPVOID*)&psfParent,
505 (LPCITEMIDLIST*)&pidlLast );
506 if (SUCCEEDED(hr))
507 pidlLast = ILClone(pidlLast);
508 else
509 hr = S_OK;
510 ILFree(pidl);
511 }
512 else
513 {
514 ERR("pidl is null!\n");
515 return FALSE;
516 }
517 }
518
519 /* get the attributes of the child */
521 {
523 {
524 psfi->dwAttributes = 0xffffffff;
525 }
526 if (psfParent)
527 {
528 IShellFolder_GetAttributesOf(psfParent, 1, (LPCITEMIDLIST*)&pidlLast,
529 &(psfi->dwAttributes));
530 }
531 }
532
534 {
535 if (flags & SHGFI_ICON)
536 {
537 psfi->dwAttributes = 0;
538 }
539 }
540
541 /* get the displayname */
543 {
545 {
546 lstrcpyW (psfi->szDisplayName, PathFindFileNameW(szFullPath));
547 }
548 else if (psfParent)
549 {
550 STRRET str;
551 hr = IShellFolder_GetDisplayNameOf( psfParent, pidlLast,
552 SHGDN_INFOLDER, &str);
553 StrRetToStrNW (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
554 }
555 }
556
557 /* get the type name */
558 if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
559 {
561 {
562 char ftype[80];
563
564 _ILGetFileType(pidlLast, ftype, 80);
565 MultiByteToWideChar(CP_ACP, 0, ftype, -1, psfi->szTypeName, 80 );
566 }
567 else
568 {
570 strcatW (psfi->szTypeName, L"Folder");
571 else
572 {
573 WCHAR sTemp[64];
574
575 lstrcpyW(sTemp,PathFindExtensionW(szFullPath));
576 if (sTemp[0] == 0 || (sTemp[0] == '.' && sTemp[1] == 0))
577 {
578 /* "name" or "name." => "File" */
579 lstrcpynW (psfi->szTypeName, L"File", 64);
580 }
581 else if (!( HCR_MapTypeToValueW(sTemp, sTemp, 64, TRUE) &&
582 HCR_MapTypeToValueW(sTemp, psfi->szTypeName, 80, FALSE )))
583 {
584 if (sTemp[0])
585 {
586 lstrcpynW (psfi->szTypeName, sTemp, 64);
587 strcatW (psfi->szTypeName, L" file");
588 }
589 else
590 {
591 lstrcpynW (psfi->szTypeName, L"File", 64);
592 }
593 }
594 }
595 }
596 }
597
598 /* ### icons ###*/
599
600 Shell_GetImageLists( &big_icons, &small_icons );
601
602 if (flags & SHGFI_OPENICON)
603 uGilFlags |= GIL_OPENICON;
604
606 uGilFlags |= GIL_FORSHORTCUT;
607 else if ((flags&SHGFI_ADDOVERLAYS) ||
609 {
610 if (SHELL_IsShortcut(pidlLast))
611 uGilFlags |= GIL_FORSHORTCUT;
612 }
613
615 FIXME("SHGFI_OVERLAYINDEX unhandled\n");
616
617 if (flags & SHGFI_SELECTED)
618 FIXME("set icon to selected, stub\n");
619
621 FIXME("set icon to shell size, stub\n");
622
623 /* get the iconlocation */
625 {
626 UINT uDummy,uFlags;
627
629 {
631 {
633 psfi->iIcon = -IDI_SHELL_FOLDER;
634 }
635 else
636 {
637 WCHAR* szExt;
638 WCHAR sTemp [MAX_PATH];
639
640 szExt = PathFindExtensionW(szFullPath);
641 TRACE("szExt=%s\n", debugstr_w(szExt));
642 if ( szExt &&
643 HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
644 HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &psfi->iIcon))
645 {
646 if (lstrcmpW(L"%1", sTemp))
647 strcpyW(psfi->szDisplayName, sTemp);
648 else
649 {
650 /* the icon is in the file */
651 strcpyW(psfi->szDisplayName, szFullPath);
652 }
653 }
654 else
655 ret = FALSE;
656 }
657 }
658 else if (psfParent)
659 {
660 hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1,
661 (LPCITEMIDLIST*)&pidlLast, &IID_IExtractIconW,
662 &uDummy, (LPVOID*)&pei);
663 if (SUCCEEDED(hr))
664 {
665 hr = IExtractIconW_GetIconLocation(pei, uGilFlags,
666 szLocation, MAX_PATH, &iIndex, &uFlags);
667
668 if (uFlags & GIL_NOTFILENAME)
669 ret = FALSE;
670 else
671 {
672 lstrcpyW (psfi->szDisplayName, szLocation);
673 psfi->iIcon = iIndex;
674 }
675 IExtractIconW_Release(pei);
676 }
677 }
678 }
679
680 /* get icon index (or load icon)*/
682 {
684 {
685 WCHAR sTemp [MAX_PATH];
686 WCHAR * szExt;
687 int icon_idx=0;
688
689 lstrcpynW(sTemp, szFullPath, MAX_PATH);
690
693 else
694 {
695 psfi->iIcon = 0;
696 szExt = PathFindExtensionW(sTemp);
697 if ( szExt &&
698 HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
699 HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &icon_idx))
700 {
701 if (!lstrcmpW(L"%1",sTemp)) /* icon is in the file */
702 strcpyW(sTemp, szFullPath);
703
705 {
706 psfi->iIcon = SIC_GetIconIndex(sTemp,icon_idx,0);
707 if (psfi->iIcon == -1)
708 psfi->iIcon = 0;
709 }
710 else
711 {
712 UINT ret;
714 ret = PrivateExtractIconsW( sTemp,icon_idx,
717 &psfi->hIcon, 0, 1, 0);
718 else
719 ret = PrivateExtractIconsW( sTemp, icon_idx,
722 &psfi->hIcon, 0, 1, 0);
723 if (ret != 0 && ret != (UINT)-1)
724 {
725 IconNotYetLoaded=FALSE;
726 psfi->iIcon = icon_idx;
727 }
728 }
729 }
730 }
731 }
732 else if (psfParent)
733 {
734 if (!(PidlToSicIndex(psfParent, pidlLast, !(flags & SHGFI_SMALLICON),
735 uGilFlags, &(psfi->iIcon))))
736 {
737 ret = FALSE;
738 }
739 }
740 if (ret && (flags & SHGFI_SYSICONINDEX))
741 {
743 ret = (DWORD_PTR)small_icons;
744 else
745 ret = (DWORD_PTR)big_icons;
746 }
747 }
748
749 /* icon handle */
750 if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded)
751 {
753 psfi->hIcon = ImageList_GetIcon( small_icons, psfi->iIcon, ILD_NORMAL);
754 else
755 psfi->hIcon = ImageList_GetIcon( big_icons, psfi->iIcon, ILD_NORMAL);
756 }
757
759 FIXME("unknown flags %08x\n", flags & ~SHGFI_KNOWN_FLAGS);
760
761 if (psfParent)
762 IShellFolder_Release(psfParent);
763
764 if (hr != S_OK)
765 ret = FALSE;
766
767 SHFree(pidlLast);
768
769 TRACE ("icon=%p index=0x%08x attr=0x%08x name=%s type=%s ret=0x%08lx\n",
770 psfi->hIcon, psfi->iIcon, psfi->dwAttributes,
772
773 return ret;
774}
#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
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:194
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1578
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
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
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:1337
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1294
void _ILGetFileType(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2533
#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:382
#define SHGFI_KNOWN_FLAGS
Definition: shell32_main.c:403
static DWORD shgfi_get_exe_type(LPCWSTR szFullPath)
Definition: shell32_main.c:313
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:1007
#define SM_CXSMICON
Definition: winuser.h:1006

Referenced by CFSDropTarget::_DoDrop(), AddListViewItems(), FILEDLG95_InitControls(), FILEDLG95_LOOKIN_AddItem(), FILEDLG95_LOOKIN_DrawItem(), 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 313 of file shell32_main.c.

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

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

◆ SHHelpShortcuts_RunDLLW()

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

Definition at line 982 of file shell32_main.c.

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

◆ SHLoadInProc()

HRESULT WINAPI SHLoadInProc ( REFCLSID  rclsid)

Definition at line 993 of file shell32_main.c.

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

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

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