ReactOS  0.4.14-dev-593-g1793dcc
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 "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 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
 
#define DROP_FIELD_TOP   (-15)
 
#define DROP_FIELD_HEIGHT   15
 

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)
 
UINT_PTR WINAPI SHAppBarMessage (DWORD msg, PAPPBARDATA data)
 
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.

◆ DROP_FIELD_HEIGHT

#define DROP_FIELD_HEIGHT   15

Definition at line 969 of file shell32_main.c.

◆ DROP_FIELD_TOP

#define DROP_FIELD_TOP   (-15)

Definition at line 968 of file shell32_main.c.

◆ SHGFI_KNOWN_FLAGS

#define SHGFI_KNOWN_FLAGS
Value:
SHGFI_USEFILEATTRIBUTES | SHGFI_ADDOVERLAYS | SHGFI_OVERLAYINDEX | \
SHGFI_ICONLOCATION | SHGFI_EXETYPE | SHGFI_SYSICONINDEX | \
SHGFI_LINKOVERLAY | SHGFI_SELECTED | SHGFI_ATTR_SPECIFIED)
#define SHGFI_SYSICONINDEX
Definition: shellapi.h:169
#define SHGFI_TYPENAME
Definition: shellapi.h:165
#define SHGFI_SELECTED
Definition: shellapi.h:171
#define SHGFI_SMALLICON
Definition: shellapi.h:174
#define SHGFI_PIDL
Definition: shellapi.h:178
#define SHGFI_SHELLICONSIZE
Definition: shellapi.h:177
#define SHGFI_OPENICON
Definition: shellapi.h:176
#define SHGFI_ADDOVERLAYS
Definition: entries.h:77
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:164
#define SHGFI_OVERLAYINDEX
Definition: shellapi.h:161
#define SHGFI_ATTRIBUTES
Definition: shellapi.h:166
#define SHGFI_EXETYPE
Definition: shellapi.h:168
#define SHGFI_ATTR_SPECIFIED
Definition: shellapi.h:172

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

1101 {
1102  switch(msg)
1103  {
1104  case WM_INITDIALOG:
1105  {
1106  const char* const *pstr = SHELL_Authors;
1107 
1108  // Add the authors to the list
1110 
1111  while (*pstr)
1112  {
1113  WCHAR name[64];
1114 
1115  /* authors list is in utf-8 format */
1116  MultiByteToWideChar( CP_UTF8, 0, *pstr, -1, name, sizeof(name)/sizeof(WCHAR) );
1118  pstr++;
1119  }
1120 
1122 
1123  return TRUE;
1124  }
1125  }
1126 
1127  return FALSE;
1128 }
#define TRUE
Definition: types.h:120
#define LB_ADDSTRING
Definition: winuser.h:2013
#define WM_SETREDRAW
Definition: winuser.h:1598
HWND hWnd
Definition: settings.c:17
UINT_PTR WPARAM
Definition: windef.h:207
#define CP_UTF8
Definition: nls.h:20
LONG_PTR LPARAM
Definition: windef.h:208
__wchar_t WCHAR
Definition: xmlstorage.h:180
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
const char *const SHELL_Authors[]
Definition: shell32_main.c:47
#define MultiByteToWideChar
Definition: compat.h:100
#define msg(x)
Definition: auth_time.c:54
Definition: name.c:38
#define IDC_ABOUT_AUTHORS_LISTBOX
Definition: shresdef.h:321
#define WM_INITDIALOG
Definition: winuser.h:1721

Referenced by AboutDlgProc().

◆ AboutDlgProc()

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

Definition at line 1132 of file shell32_main.c.

1133 {
1134  static DWORD cxLogoBmp;
1135  static DWORD cyLogoBmp, cyLineBmp;
1136  static HBITMAP hLogoBmp, hLineBmp;
1137  static HWND hWndAuthors;
1138 
1139  switch(msg)
1140  {
1141  case WM_INITDIALOG:
1142  {
1144 
1145  if (info)
1146  {
1147  const WCHAR szRegKey[] = L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
1148  HKEY hRegKey;
1149  MEMORYSTATUSEX MemStat;
1150  WCHAR szAppTitle[512];
1151  WCHAR szAppTitleTemplate[512];
1152  WCHAR szAuthorsText[20];
1153 
1154  // Preload the ROS bitmap
1157 
1158  if(hLogoBmp && hLineBmp)
1159  {
1160  BITMAP bmpLogo;
1161 
1162  GetObject( hLogoBmp, sizeof(BITMAP), &bmpLogo );
1163 
1164  cxLogoBmp = bmpLogo.bmWidth;
1165  cyLogoBmp = bmpLogo.bmHeight;
1166 
1167  GetObject( hLineBmp, sizeof(BITMAP), &bmpLogo );
1168  cyLineBmp = bmpLogo.bmHeight;
1169  }
1170 
1171  // Set App-specific stuff (icon, app name, szOtherStuff string)
1173 
1174  GetWindowTextW( hWnd, szAppTitleTemplate, sizeof(szAppTitleTemplate) / sizeof(WCHAR) );
1175  swprintf( szAppTitle, szAppTitleTemplate, info->szApp );
1177 
1179  SetDlgItemTextW( hWnd, IDC_ABOUT_OTHERSTUFF, info->szOtherStuff );
1180 
1181  // Set the registered user and organization name
1182  if(RegOpenKeyExW( HKEY_LOCAL_MACHINE, szRegKey, 0, KEY_QUERY_VALUE, &hRegKey ) == ERROR_SUCCESS)
1183  {
1184  SetRegTextData( hWnd, hRegKey, L"RegisteredOwner", IDC_ABOUT_REG_USERNAME );
1185  SetRegTextData( hWnd, hRegKey, L"RegisteredOrganization", IDC_ABOUT_REG_ORGNAME );
1186 
1187  RegCloseKey( hRegKey );
1188  }
1189 
1190  // Set the value for the installed physical memory
1191  MemStat.dwLength = sizeof(MemStat);
1192  if( GlobalMemoryStatusEx(&MemStat) )
1193  {
1194  WCHAR szBuf[12];
1195 
1196  if (MemStat.ullTotalPhys > 1024 * 1024 * 1024)
1197  {
1198  double dTotalPhys;
1199  WCHAR szDecimalSeparator[4];
1200  WCHAR szUnits[3];
1201 
1202  // We're dealing with GBs or more
1203  MemStat.ullTotalPhys /= 1024 * 1024;
1204 
1205  if (MemStat.ullTotalPhys > 1024 * 1024)
1206  {
1207  // We're dealing with TBs or more
1208  MemStat.ullTotalPhys /= 1024;
1209 
1210  if (MemStat.ullTotalPhys > 1024 * 1024)
1211  {
1212  // We're dealing with PBs or more
1213  MemStat.ullTotalPhys /= 1024;
1214 
1215  dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1216  wcscpy( szUnits, L"PB" );
1217  }
1218  else
1219  {
1220  dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1221  wcscpy( szUnits, L"TB" );
1222  }
1223  }
1224  else
1225  {
1226  dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1227  wcscpy( szUnits, L"GB" );
1228  }
1229 
1230  // We need the decimal point of the current locale to display the RAM size correctly
1232  szDecimalSeparator,
1233  sizeof(szDecimalSeparator) / sizeof(WCHAR)) > 0)
1234  {
1235  UCHAR uDecimals;
1236  UINT uIntegral;
1237 
1238  uIntegral = (UINT)dTotalPhys;
1239  uDecimals = (UCHAR)((UINT)(dTotalPhys * 100) - uIntegral * 100);
1240 
1241  // Display the RAM size with 2 decimals
1242  swprintf(szBuf, L"%u%s%02u %s", uIntegral, szDecimalSeparator, uDecimals, szUnits);
1243  }
1244  }
1245  else
1246  {
1247  // We're dealing with MBs, don't show any decimals
1248  swprintf( szBuf, L"%u MB", (UINT)MemStat.ullTotalPhys / 1024 / 1024 );
1249  }
1250 
1252  }
1253 
1254  // Add the Authors dialog
1256  LoadStringW( shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, sizeof(szAuthorsText) / sizeof(WCHAR) );
1257  SetDlgItemTextW( hWnd, IDC_ABOUT_AUTHORS, szAuthorsText );
1258  }
1259 
1260  return TRUE;
1261  }
1262 
1263  case WM_PAINT:
1264  {
1265  if(hLogoBmp && hLineBmp)
1266  {
1267  PAINTSTRUCT ps;
1268  HDC hdc;
1269  HDC hdcMem;
1270  HGDIOBJ hOldObj;
1271 
1272  hdc = BeginPaint(hWnd, &ps);
1274 
1275  if(hdcMem)
1276  {
1277  hOldObj = SelectObject(hdcMem, hLogoBmp);
1278  BitBlt(hdc, 0, 0, cxLogoBmp, cyLogoBmp, hdcMem, 0, 0, SRCCOPY);
1279 
1280  SelectObject(hdcMem, hLineBmp);
1281  BitBlt(hdc, 0, cyLogoBmp, cxLogoBmp, cyLineBmp, hdcMem, 0, 0, SRCCOPY);
1282 
1283  SelectObject(hdcMem, hOldObj);
1284  DeleteDC(hdcMem);
1285  }
1286 
1287  EndPaint(hWnd, &ps);
1288  }
1289  }; break;
1290 
1291  case WM_COMMAND:
1292  {
1293  switch(wParam)
1294  {
1295  case IDOK:
1296  case IDCANCEL:
1297  EndDialog(hWnd, TRUE);
1298  return TRUE;
1299 
1300  case IDC_ABOUT_AUTHORS:
1301  {
1302  static BOOL bShowingAuthors = FALSE;
1303  WCHAR szAuthorsText[20];
1304 
1305  if(bShowingAuthors)
1306  {
1307  LoadStringW( shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, sizeof(szAuthorsText) / sizeof(WCHAR) );
1308  ShowWindow( hWndAuthors, SW_HIDE );
1309  }
1310  else
1311  {
1312  LoadStringW( shell32_hInstance, IDS_SHELL_ABOUT_BACK, szAuthorsText, sizeof(szAuthorsText) / sizeof(WCHAR) );
1313  ShowWindow( hWndAuthors, SW_SHOW );
1314  }
1315 
1316  SetDlgItemTextW( hWnd, IDC_ABOUT_AUTHORS, szAuthorsText );
1317  bShowingAuthors = !bShowingAuthors;
1318  return TRUE;
1319  }
1320  }
1321  }; break;
1322 
1323  case WM_CLOSE:
1324  EndDialog(hWnd, TRUE);
1325  break;
1326  }
1327 
1328  return 0;
1329 }
#define IDB_REACTOS
Definition: shresdef.h:29
#define STM_SETICON
Definition: winuser.h:2074
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDC_ABOUT_OTHERSTUFF
Definition: shresdef.h:313
#define SW_HIDE
Definition: winuser.h:762
#define LOCALE_USER_DEFAULT
static HDC
Definition: imagelist.c:92
#define IDC_ABOUT_APPNAME
Definition: shresdef.h:312
HWND hWnd
Definition: settings.c:17
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
#define IDC_ABOUT_REG_USERNAME
Definition: shresdef.h:314
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
HINSTANCE shell32_hInstance
Definition: misc.cpp:82
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDB_LINEBAR
Definition: shresdef.h:30
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
#define LOCALE_SDECIMAL
Definition: winnls.h:42
#define SW_SHOW
Definition: winuser.h:769
#define IDC_ABOUT_ICON
Definition: shresdef.h:311
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_CLOSE
Definition: winuser.h:1603
#define swprintf(buf, format,...)
Definition: sprintf.c:56
TCHAR szAppTitle[256]
Definition: mplay32.c:27
unsigned long DWORD
Definition: ntddk_ex.h:95
INT_PTR CALLBACK AboutAuthorsDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDD_ABOUT_AUTHORS
Definition: shresdef.h:319
#define GetObject
Definition: wingdi.h:4467
#define WM_PAINT
Definition: winuser.h:1602
#define IDC_ABOUT_AUTHORS
Definition: shresdef.h:320
unsigned char UCHAR
Definition: xmlstorage.h:181
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
HDC hdc
Definition: main.c:9
#define IDS_SHELL_ABOUT_AUTHORS
Definition: shresdef.h:128
#define CreateDialogW(h, n, w, f)
Definition: winuser.h:4256
#define WM_COMMAND
Definition: winuser.h:1722
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1408
BOOL WINAPI DeleteDC(_In_ HDC)
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
Definition: bl.h:1331
unsigned int UINT
Definition: ndis.h:50
#define IMAGE_BITMAP
Definition: winuser.h:211
static VOID SetRegTextData(HWND hWnd, HKEY hKey, LPCWSTR Value, UINT uID)
#define msg(x)
Definition: auth_time.c:54
#define IDC_ABOUT_REG_ORGNAME
Definition: shresdef.h:315
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define IDC_ABOUT_PHYSMEM
Definition: shresdef.h:316
#define LoadImage
Definition: winuser.h:5790
BOOL NTAPI GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer)
Definition: heapmem.c:1272
static HBITMAP
Definition: button.c:44
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDS_SHELL_ABOUT_BACK
Definition: shresdef.h:129
#define IDCANCEL
Definition: winuser.h:825
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define SRCCOPY
Definition: wingdi.h:332
HDC hdcMem
Definition: welcome.c:104
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by ShellAboutW().

◆ CommandLineToArgvW()

LPWSTR* WINAPI CommandLineToArgvW ( LPCWSTR  lpCmdline,
int numargs 
)

Definition at line 76 of file shell32_main.c.

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

Referenced by _tmain(), CmdDebugService(), command_line_to_args(), DisplayApplet(), get_utf8_args(), PrintUIEntryW(), ProcessCmdLine(), ProcessCommandLine(), test_commandline2argv(), test_one_cmdline(), UseCmdParameters(), and wWinMain().

◆ DuplicateIcon()

HICON WINAPI DuplicateIcon ( HINSTANCE  hInstance,
HICON  hIcon 
)

Definition at line 838 of file shell32_main.c.

839 {
841  HICON hDupIcon = 0;
842 
843  TRACE("%p %p\n", hInstance, hIcon);
844 
845  if (GetIconInfo(hIcon, &IconInfo))
846  {
847  hDupIcon = CreateIconIndirect(&IconInfo);
848 
849  /* clean up hbmMask and hbmColor */
852  }
853 
854  return hDupIcon;
855 }
static HICON
Definition: imagelist.c:84
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2014
HINSTANCE hInstance
Definition: charmap.c:20
HBITMAP hbmMask
Definition: winuser.h:3101
HBITMAP hbmColor
Definition: winuser.h:3102
#define TRACE(s)
Definition: solgame.cpp:4
HICON WINAPI CreateIconIndirect(_In_ PICONINFO)
Definition: cursoricon.c:2546
HICON hIcon
Definition: msconfig.c:44
_Out_opt_ PICONINFO IconInfo
Definition: ntuser.h:2267

◆ ExtractIconA()

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

Definition at line 860 of file shell32_main.c.

861 {
862  HICON ret;
863  INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0);
864  LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
865 
866  TRACE("%p %s %d\n", hInstance, lpszFile, nIconIndex);
867 
868  MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len);
869  ret = ExtractIconW(hInstance, lpwstrFile, nIconIndex);
870  HeapFree(GetProcessHeap(), 0, lpwstrFile);
871 
872  return ret;
873 }
static HICON
Definition: imagelist.c:84
#define CP_ACP
Definition: compat.h:99
int32_t INT
Definition: typedefs.h:56
HICON WINAPI ExtractIconW(HINSTANCE hInstance, LPCWSTR lpszFile, UINT nIconIndex)
Definition: shell32_main.c:878
HINSTANCE hInstance
Definition: charmap.c:20
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by test_ExtractIcon().

◆ ExtractIconW()

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

Definition at line 878 of file shell32_main.c.

879 {
880  HICON hIcon = NULL;
881  UINT ret;
883 
884  TRACE("%p %s %d\n", hInstance, debugstr_w(lpszFile), nIconIndex);
885 
886  if (nIconIndex == (UINT)-1)
887  {
888  ret = PrivateExtractIconsW(lpszFile, 0, cx, cy, NULL, NULL, 0, LR_DEFAULTCOLOR);
889  if (ret != (UINT)-1 && ret)
890  return (HICON)(UINT_PTR)ret;
891  return NULL;
892  }
893  else
894  ret = PrivateExtractIconsW(lpszFile, nIconIndex, cx, cy, &hIcon, NULL, 1, LR_DEFAULTCOLOR);
895 
896  if (ret == (UINT)-1)
897  return (HICON)1;
898  else if (ret > 0 && hIcon)
899  return hIcon;
900 
901  return NULL;
902 }
unsigned __int3264 UINT_PTR
Definition: activex.cpp:275
static HICON
Definition: imagelist.c:84
HINSTANCE hInstance
Definition: charmap.c:20
#define debugstr_w
Definition: kernel32.h:32
#define SM_CXICON
Definition: winuser.h:962
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
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)
int WINAPI GetSystemMetrics(_In_ int)
int ret
#define SM_CYICON
Definition: winuser.h:963
HICON hIcon
Definition: msconfig.c:44
unsigned int UINT
Definition: ndis.h:50
_Out_opt_ int * cx
Definition: commctrl.h:581
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077

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

◆ FreeIconList()

void WINAPI FreeIconList ( DWORD  dw)

Definition at line 1396 of file shell32_main.c.

1397 {
1398  FIXME("%x: stub\n",dw);
1399 }
#define FIXME(fmt,...)
Definition: debug.h:110
REFIID LPVOID DWORD dw
Definition: atlbase.h:40

◆ Printer_LoadIconsW()

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

Definition at line 907 of file shell32_main.c.

908 {
909  INT iconindex=IDI_SHELL_PRINTERS_FOLDER;
910 
911  TRACE("(%s, %p, %p)\n", debugstr_w(wsPrinterName), pLargeIcon, pSmallIcon);
912 
913  /* We should check if wsPrinterName is
914  1. the Default Printer or not
915  2. connected or not
916  3. a Local Printer or a Network-Printer
917  and use different Icons
918  */
919  if((wsPrinterName != NULL) && (wsPrinterName[0] != 0))
920  {
921  FIXME("(select Icon by PrinterName %s not implemented)\n", debugstr_w(wsPrinterName));
922  }
923 
924  if(pLargeIcon != NULL)
925  *pLargeIcon = LoadImageW(shell32_hInstance,
926  (LPCWSTR) MAKEINTRESOURCE(iconindex), IMAGE_ICON,
928 
929  if(pSmallIcon != NULL)
930  *pSmallIcon = LoadImageW(shell32_hInstance,
931  (LPCWSTR) MAKEINTRESOURCE(iconindex), IMAGE_ICON,
932  16, 16, LR_DEFAULTCOLOR);
933 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IMAGE_ICON
Definition: winuser.h:212
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
int32_t INT
Definition: typedefs.h:56
#define IDI_SHELL_PRINTERS_FOLDER
Definition: shresdef.h:513
HINSTANCE shell32_hInstance
Definition: misc.cpp:82
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define LR_DEFAULTSIZE
Definition: winuser.h:1084
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077

◆ Printers_RegisterWindowW()

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

Definition at line 941 of file shell32_main.c.

943 {
944  FIXME("(%s, %x, %p (%p), %p (%p)) stub!\n", debugstr_w(wsPrinter), dwType,
945  phClassPidl, (phClassPidl != NULL) ? *(phClassPidl) : NULL,
946  phwnd, (phwnd != NULL) ? *(phwnd) : NULL);
947 
948  return FALSE;
949 }
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416

◆ Printers_UnregisterWindow()

VOID WINAPI Printers_UnregisterWindow ( HANDLE  hClassPidl,
HWND  hwnd 
)

Definition at line 954 of file shell32_main.c.

955 {
956  FIXME("(%p, %p) stub!\n", hClassPidl, hwnd);
957 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define FIXME(fmt,...)
Definition: debug.h:110

◆ SetRegTextData()

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

Definition at line 1075 of file shell32_main.c.

1076 {
1077  DWORD dwBufferSize;
1078  DWORD dwType;
1079  LPWSTR lpBuffer;
1080 
1081  if( RegQueryValueExW(hKey, Value, NULL, &dwType, NULL, &dwBufferSize) == ERROR_SUCCESS )
1082  {
1083  if(dwType == REG_SZ)
1084  {
1085  lpBuffer = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, dwBufferSize);
1086 
1087  if(lpBuffer)
1088  {
1089  if( RegQueryValueExW(hKey, Value, NULL, &dwType, (LPBYTE)lpBuffer, &dwBufferSize) == ERROR_SUCCESS )
1090  {
1091  SetDlgItemTextW(hWnd, uID, lpBuffer);
1092  }
1093 
1095  }
1096  }
1097  }
1098 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
#define ERROR_SUCCESS
Definition: deptool.c:10
HWND hWnd
Definition: settings.c:17
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
unsigned char * LPBYTE
Definition: typedefs.h:52
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
unsigned long DWORD
Definition: ntddk_ex.h:95
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:402
#define REG_SZ
Definition: layer.c:22

Referenced by AboutDlgProc().

◆ SHAppBarMessage()

UINT_PTR WINAPI SHAppBarMessage ( DWORD  msg,
PAPPBARDATA  data 
)

Definition at line 974 of file shell32_main.c.

975 {
976  int width=data->rc.right - data->rc.left;
977  int height=data->rc.bottom - data->rc.top;
978  RECT rec=data->rc;
979 
980  TRACE("msg=%d, data={cb=%d, hwnd=%p, callback=%x, edge=%d, rc=%s, lparam=%lx}\n",
981  msg, data->cbSize, data->hWnd, data->uCallbackMessage, data->uEdge,
982  wine_dbgstr_rect(&data->rc), data->lParam);
983 
984  switch (msg)
985  {
986  case ABM_GETSTATE:
987  return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
988 
989  case ABM_GETTASKBARPOS:
990  GetWindowRect(data->hWnd, &rec);
991  data->rc=rec;
992  return TRUE;
993 
994  case ABM_ACTIVATE:
995  SetActiveWindow(data->hWnd);
996  return TRUE;
997 
998  case ABM_GETAUTOHIDEBAR:
999  return 0; /* pretend there is no autohide bar */
1000 
1001  case ABM_NEW:
1002  /* cbSize, hWnd, and uCallbackMessage are used. All other ignored */
1004  return TRUE;
1005 
1006  case ABM_QUERYPOS:
1007  GetWindowRect(data->hWnd, &(data->rc));
1008  return TRUE;
1009 
1010  case ABM_REMOVE:
1011  FIXME("ABM_REMOVE broken\n");
1012  /* FIXME: this is wrong; should it be DestroyWindow instead? */
1013  /*CloseHandle(data->hWnd);*/
1014  return TRUE;
1015 
1016  case ABM_SETAUTOHIDEBAR:
1017  SetWindowPos(data->hWnd,HWND_TOP,rec.left+1000,rec.top,
1019  return TRUE;
1020 
1021  case ABM_SETPOS:
1022  data->uEdge=(ABE_RIGHT | ABE_LEFT);
1023  SetWindowPos(data->hWnd,HWND_TOP,data->rc.left,data->rc.top,
1025  return TRUE;
1026 
1027  case ABM_WINDOWPOSCHANGED:
1028  return TRUE;
1029  }
1030 
1031  return FALSE;
1032 }
#define ABM_GETAUTOHIDEBAR
Definition: shellapi.h:66
GLint GLint GLsizei width
Definition: gl.h:1546
#define TRUE
Definition: types.h:120
#define ABS_AUTOHIDE
Definition: shellapi.h:21
LONG top
Definition: windef.h:307
#define HWND_TOP
Definition: winuser.h:1193
#define ABM_GETTASKBARPOS
Definition: shellapi.h:64
LONG left
Definition: windef.h:306
#define ABE_LEFT
Definition: shellapi.h:17
#define ABM_ACTIVATE
Definition: shellapi.h:65
HWND WINAPI SetActiveWindow(_In_ HWND)
#define ABM_GETSTATE
Definition: shellapi.h:63
#define FIXME(fmt,...)
Definition: debug.h:110
#define ABE_RIGHT
Definition: shellapi.h:19
#define ABS_ALWAYSONTOP
Definition: shellapi.h:22
#define TRACE(s)
Definition: solgame.cpp:4
const char * wine_dbgstr_rect(const RECT *rect)
#define ABM_NEW
Definition: shellapi.h:59
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define ABM_SETAUTOHIDEBAR
Definition: shellapi.h:67
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define SWP_NOSIZE
Definition: winuser.h:1230
#define ABM_WINDOWPOSCHANGED
Definition: shellapi.h:68
#define SWP_SHOWWINDOW
Definition: winuser.h:1233
#define msg(x)
Definition: auth_time.c:54
#define ABM_QUERYPOS
Definition: shellapi.h:61
#define ABM_REMOVE
Definition: shellapi.h:60
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define ABM_SETPOS
Definition: shellapi.h:62

Referenced by DoAppBarStuff(), test_appbarget(), test_setpos(), and testwindow_setpos().

◆ SHELL_IsShortcut()

BOOL SHELL_IsShortcut ( LPCITEMIDLIST  pidlLast)

Definition at line 378 of file shell32_main.c.

379 {
380  char szTemp[MAX_PATH];
381  HKEY keyCls;
382  BOOL ret = FALSE;
383 
384  if (_ILGetExtension(pidlLast, szTemp, MAX_PATH) &&
385  HCR_MapTypeToValueA(szTemp, szTemp, MAX_PATH, TRUE))
386  {
387  if (ERROR_SUCCESS == RegOpenKeyExA(HKEY_CLASSES_ROOT, szTemp, 0, KEY_QUERY_VALUE, &keyCls))
388  {
389  if (ERROR_SUCCESS == RegQueryValueExA(keyCls, "IsShortcut", NULL, NULL, NULL, NULL))
390  ret = TRUE;
391 
392  RegCloseKey(keyCls);
393  }
394  }
395 
396  return ret;
397 }
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:4023
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3331
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL _ILGetExtension(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2462
#define MAX_PATH
Definition: compat.h:26
BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, LONG len, BOOL bPrependDot)
Definition: classes.c:88
int ret
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#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 1335 of file shell32_main.c.

1336 {
1337  BOOL ret;
1338  LPWSTR appW = NULL, otherW = NULL;
1339  int len;
1340 
1341  if (szApp)
1342  {
1343  len = MultiByteToWideChar(CP_ACP, 0, szApp, -1, NULL, 0);
1344  appW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1345  MultiByteToWideChar(CP_ACP, 0, szApp, -1, appW, len);
1346  }
1347  if (szOtherStuff)
1348  {
1349  len = MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, NULL, 0);
1350  otherW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1351  MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, otherW, len);
1352  }
1353 
1354  ret = ShellAboutW(hWnd, appW, otherW, hIcon);
1355 
1356  HeapFree(GetProcessHeap(), 0, otherW);
1357  HeapFree(GetProcessHeap(), 0, appW);
1358  return ret;
1359 }
#define CP_ACP
Definition: compat.h:99
HWND hWnd
Definition: settings.c:17
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
BOOL WINAPI ShellAboutW(HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HICON hIcon)
GLenum GLsizei len
Definition: glext.h:6722
HICON hIcon
Definition: msconfig.c:44
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ ShellAboutW()

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

Definition at line 1365 of file shell32_main.c.

1367 {
1368  ABOUT_INFO info;
1369  HRSRC hRes;
1370  DLGTEMPLATE *DlgTemplate;
1371  BOOL bRet;
1372 
1373  TRACE("\n");
1374 
1375  // DialogBoxIndirectParamW will be called with the hInstance of the calling application, so we have to preload the dialog template
1377  if(!hRes)
1378  return FALSE;
1379 
1380  DlgTemplate = (DLGTEMPLATE *)LoadResource(shell32_hInstance, hRes);
1381  if(!DlgTemplate)
1382  return FALSE;
1383 
1384  info.szApp = szApp;
1385  info.szOtherStuff = szOtherStuff;
1386  info.hIcon = hIcon ? hIcon : LoadIconW( 0, (LPWSTR)IDI_WINLOGO );
1387 
1389  DlgTemplate, hWnd, AboutDlgProc, (LPARAM)&info );
1390  return bRet;
1391 }
static INT_PTR CALLBACK AboutDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
HWND hWnd
Definition: settings.c:17
#define GetWindowLongPtrW
Definition: winuser.h:4804
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
struct _test_info info[]
Definition: SetCursorPos.c:19
HINSTANCE shell32_hInstance
Definition: misc.cpp:82
unsigned int BOOL
Definition: ntddk_ex.h:94
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
LONG_PTR LPARAM
Definition: windef.h:208
#define RT_DIALOG
Definition: pedump.c:367
#define TRACE(s)
Definition: solgame.cpp:4
#define IDI_WINLOGO
Definition: winuser.h:704
#define IDD_ABOUT
Definition: shresdef.h:310
HICON hIcon
Definition: msconfig.c:44
INT_PTR WINAPI DialogBoxIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define GWLP_HINSTANCE
Definition: winuser.h:850
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by Control_WndProc(), dialog_about(), FrameWndProc(), ie_dialog_about(), MACRO_About(), MAIN_MenuCommand(), MainProc(), OnAbout(), OnCommand(), OSK_About(), ShellAboutA(), ShowAboutBox(), WndProc(), and wWinMain().

◆ SHGetFileInfoA()

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

Definition at line 787 of file shell32_main.c.

790 {
791  INT len;
792  LPWSTR temppath = NULL;
793  LPCWSTR pathW;
794  DWORD_PTR ret;
795  SHFILEINFOW temppsfi;
796 
797  if (flags & SHGFI_PIDL)
798  {
799  /* path contains a pidl */
800  pathW = (LPCWSTR)path;
801  }
802  else
803  {
804  len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
805  temppath = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
806  MultiByteToWideChar(CP_ACP, 0, path, -1, temppath, len);
807  pathW = temppath;
808  }
809 
810  if (psfi)
811  {
812  temppsfi.hIcon = psfi->hIcon;
813  temppsfi.iIcon = psfi->iIcon;
814  temppsfi.dwAttributes = psfi->dwAttributes;
815 
816  ret = SHGetFileInfoW(pathW, dwFileAttributes, &temppsfi, sizeof(temppsfi), flags);
817  psfi->hIcon = temppsfi.hIcon;
818  psfi->iIcon = temppsfi.iIcon;
819  psfi->dwAttributes = temppsfi.dwAttributes;
820 
821  WideCharToMultiByte(CP_ACP, 0, temppsfi.szDisplayName, -1,
822  psfi->szDisplayName, sizeof(psfi->szDisplayName), NULL, NULL);
823 
824  WideCharToMultiByte(CP_ACP, 0, temppsfi.szTypeName, -1,
825  psfi->szTypeName, sizeof(psfi->szTypeName), NULL, NULL);
826  }
827  else
829 
830  HeapFree(GetProcessHeap(), 0, temppath);
831 
832  return ret;
833 }
#define WideCharToMultiByte
Definition: compat.h:101
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
DWORD dwAttributes
Definition: shellapi.h:372
#define CP_ACP
Definition: compat.h:99
WCHAR szTypeName[80]
Definition: shellapi.h:374
int32_t INT
Definition: typedefs.h:56
#define SHGFI_PIDL
Definition: shellapi.h:178
smooth NULL
Definition: ftsmooth.c:416
CHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:366
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:410
GLbitfield flags
Definition: glext.h:7161
int ret
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:373
GLenum GLsizei len
Definition: glext.h:6722
uint32_t DWORD_PTR
Definition: typedefs.h:63
HICON hIcon
Definition: shellapi.h:370
#define MultiByteToWideChar
Definition: compat.h:100
DWORD dwFileAttributes
HICON hIcon
Definition: shellapi.h:363
WCHAR * LPWSTR
Definition: xmlstorage.h:184
DWORD dwAttributes
Definition: shellapi.h:365
CHAR szTypeName[80]
Definition: shellapi.h:367
#define HeapFree(x, y, z)
Definition: compat.h:402

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

412 {
413  WCHAR szLocation[MAX_PATH], szFullPath[MAX_PATH];
414  int iIndex;
415  DWORD_PTR ret = TRUE;
416  DWORD dwAttributes = 0;
417  IShellFolder * psfParent = NULL;
418  IExtractIconW * pei = NULL;
419  LPITEMIDLIST pidlLast = NULL, pidl = NULL;
420  HRESULT hr = S_OK;
421  BOOL IconNotYetLoaded=TRUE;
422  UINT uGilFlags = 0;
423  HIMAGELIST big_icons, small_icons;
424 
425  TRACE("%s fattr=0x%x sfi=%p(attr=0x%08x) size=0x%x flags=0x%x\n",
427  psfi, psfi ? psfi->dwAttributes : 0, sizeofpsfi, flags);
428 
429  if (!path)
430  return FALSE;
431 
432  /* windows initializes these values regardless of the flags */
433  if (psfi != NULL)
434  {
435  psfi->szDisplayName[0] = '\0';
436  psfi->szTypeName[0] = '\0';
437  psfi->hIcon = NULL;
438  }
439 
440  if (!(flags & SHGFI_PIDL))
441  {
442  /* SHGetFileInfo should work with absolute and relative paths */
443  if (PathIsRelativeW(path))
444  {
446  PathCombineW(szFullPath, szLocation, path);
447  }
448  else
449  {
450  lstrcpynW(szFullPath, path, MAX_PATH);
451  }
452  }
453  else
454  {
455  SHGetPathFromIDListW((LPITEMIDLIST)path, szFullPath);
456  }
457 
458  if (flags & SHGFI_EXETYPE)
459  {
460  if (!(flags & SHGFI_SYSICONINDEX))
461  {
463  {
464  return TRUE;
465  }
466  else if (GetFileAttributesW(szFullPath) != INVALID_FILE_ATTRIBUTES)
467  {
468  return shgfi_get_exe_type(szFullPath);
469  }
470  }
471  }
472 
473  /*
474  * psfi is NULL normally to query EXE type. If it is NULL, none of the
475  * below makes sense anyway. Windows allows this and just returns FALSE
476  */
477  if (psfi == NULL)
478  return FALSE;
479 
480  /*
481  * translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES
482  * is not specified.
483  * The pidl functions fail on not existing file names
484  */
485 
486  if (flags & SHGFI_PIDL)
487  {
488  pidl = ILClone((LPCITEMIDLIST)path);
489  }
490  else if (!(flags & SHGFI_USEFILEATTRIBUTES))
491  {
492  hr = SHILCreateFromPathW(szFullPath, &pidl, &dwAttributes);
493  }
494 
496  {
497  /* get the parent shellfolder */
498  if (pidl)
499  {
500  hr = SHBindToParent( pidl, &IID_IShellFolder, (LPVOID*)&psfParent,
501  (LPCITEMIDLIST*)&pidlLast );
502  if (SUCCEEDED(hr))
503  pidlLast = ILClone(pidlLast);
504  else
505  hr = S_OK;
506  ILFree(pidl);
507  }
508  else
509  {
510  ERR("pidl is null!\n");
511  return FALSE;
512  }
513  }
514 
515  /* get the attributes of the child */
516  if (SUCCEEDED(hr) && (flags & SHGFI_ATTRIBUTES))
517  {
518  if (!(flags & SHGFI_ATTR_SPECIFIED))
519  {
520  psfi->dwAttributes = 0xffffffff;
521  }
522  if (psfParent)
523  {
524  IShellFolder_GetAttributesOf(psfParent, 1, (LPCITEMIDLIST*)&pidlLast,
525  &(psfi->dwAttributes));
526  }
527  }
528 
530  {
531  if (flags & SHGFI_ICON)
532  {
533  psfi->dwAttributes = 0;
534  }
535  }
536 
537  /* get the displayname */
538  if (SUCCEEDED(hr) && (flags & SHGFI_DISPLAYNAME))
539  {
541  {
542  lstrcpyW (psfi->szDisplayName, PathFindFileNameW(szFullPath));
543  }
544  else if (psfParent)
545  {
546  STRRET str;
547  hr = IShellFolder_GetDisplayNameOf( psfParent, pidlLast,
548  SHGDN_INFOLDER, &str);
549  StrRetToStrNW (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
550  }
551  }
552 
553  /* get the type name */
554  if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
555  {
556  static const WCHAR szFolder[] = { 'F','o','l','d','e','r',0 };
557  static const WCHAR szFile[] = { 'F','i','l','e',0 };
558  static const WCHAR szSpaceFile[] = { ' ','f','i','l','e',0 };
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, szFolder);
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, szFile, 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, szSpaceFile);
588  }
589  else
590  {
591  lstrcpynW (psfi->szTypeName, szFile, 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 
605  if (flags & SHGFI_LINKOVERLAY)
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 */
624  if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION ))
625  {
626  UINT uDummy,uFlags;
627 
629  {
631  {
633  psfi->iIcon = -IDI_SHELL_FOLDER;
634  }
635  else
636  {
637  WCHAR* szExt;
638  static const WCHAR p1W[] = {'%','1',0};
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(p1W, 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  {
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  static const WCHAR p1W[] = {'%','1',0};
697 
698  psfi->iIcon = 0;
699  szExt = PathFindExtensionW(sTemp);
700  if ( szExt &&
701  HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
702  HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &icon_idx))
703  {
704  if (!lstrcmpW(p1W,sTemp)) /* icon is in the file */
705  strcpyW(sTemp, szFullPath);
706 
707  if (flags & SHGFI_SYSICONINDEX)
708  {
709  psfi->iIcon = SIC_GetIconIndex(sTemp,icon_idx,0);
710  if (psfi->iIcon == -1)
711  psfi->iIcon = 0;
712  }
713  else
714  {
715  UINT ret;
716  if (flags & SHGFI_SMALLICON)
717  ret = PrivateExtractIconsW( sTemp,icon_idx,
720  &psfi->hIcon, 0, 1, 0);
721  else
722  ret = PrivateExtractIconsW( sTemp, icon_idx,
725  &psfi->hIcon, 0, 1, 0);
726  if (ret != 0 && ret != (UINT)-1)
727  {
728  IconNotYetLoaded=FALSE;
729  psfi->iIcon = icon_idx;
730  }
731  }
732  }
733  }
734  }
735  else if (psfParent)
736  {
737  if (!(PidlToSicIndex(psfParent, pidlLast, !(flags & SHGFI_SMALLICON),
738  uGilFlags, &(psfi->iIcon))))
739  {
740  ret = FALSE;
741  }
742  }
743  if (ret && (flags & SHGFI_SYSICONINDEX))
744  {
745  if (flags & SHGFI_SMALLICON)
746  ret = (DWORD_PTR)small_icons;
747  else
748  ret = (DWORD_PTR)big_icons;
749  }
750  }
751 
752  /* icon handle */
753  if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded)
754  {
755  if (flags & SHGFI_SMALLICON)
756  psfi->hIcon = ImageList_GetIcon( small_icons, psfi->iIcon, ILD_NORMAL);
757  else
758  psfi->hIcon = ImageList_GetIcon( big_icons, psfi->iIcon, ILD_NORMAL);
759  }
760 
761  if (flags & ~SHGFI_KNOWN_FLAGS)
762  FIXME("unknown flags %08x\n", flags & ~SHGFI_KNOWN_FLAGS);
763 
764  if (psfParent)
765  IShellFolder_Release(psfParent);
766 
767  if (hr != S_OK)
768  ret = FALSE;
769 
770  SHFree(pidlLast);
771 
772  TRACE ("icon=%p index=0x%08x attr=0x%08x name=%s type=%s ret=0x%08lx\n",
773  psfi->hIcon, psfi->iIcon, psfi->dwAttributes,
775 
776  return ret;
777 }
#define SHGFI_SYSICONINDEX
Definition: shellapi.h:169
#define TRUE
Definition: types.h:120
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1558
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define SHGFI_TYPENAME
Definition: shellapi.h:165
#define SHGFI_SELECTED
Definition: shellapi.h:171
#define DWORD_PTR
Definition: treelist.c:76
HRESULT hr
Definition: shlfolder.c:183
DWORD dwAttributes
Definition: shellapi.h:372
#define CP_ACP
Definition: compat.h:99
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
BOOL HCR_GetIconW(LPCWSTR szClass, LPWSTR szDest, LPCWSTR szName, DWORD len, int *picon_idx)
Definition: classes.c:294
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1280
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:421
WCHAR swShell32Name[MAX_PATH]
Definition: folders.cpp:22
#define SM_CYSMICON
Definition: winuser.h:1003
UINT uFlags
Definition: api.c:59
WCHAR szTypeName[80]
Definition: shellapi.h:374
#define SHGFI_SMALLICON
Definition: shellapi.h:174
DWORD dwAttributes
Definition: vdmdbg.h:34
#define lstrcpynW
Definition: compat.h:405
static DWORD shgfi_get_exe_type(LPCWSTR szFullPath)
Definition: shell32_main.c:309
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:802
#define debugstr_w
Definition: kernel32.h:32
#define SHGFI_PIDL
Definition: shellapi.h:178
#define FIXME(fmt,...)
Definition: debug.h:110
#define SM_CXICON
Definition: winuser.h:962
#define SHGFI_SHELLICONSIZE
Definition: shellapi.h:177
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define SHGFI_OPENICON
Definition: shellapi.h:176
#define SHGFI_ADDOVERLAYS
Definition: entries.h:77
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:389
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:164
BOOL SHELL_IsShortcut(LPCITEMIDLIST pidlLast)
Definition: shell32_main.c:378
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:442
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SHGFI_OVERLAYINDEX
Definition: shellapi.h:161
HICON WINAPI ImageList_GetIcon(HIMAGELIST himl, INT i, UINT fStyle)
Definition: imagelist.c:1963
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
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)
int WINAPI GetSystemMetrics(_In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR szLocation[]
Definition: http.c:111
#define SHGFI_LINKOVERLAY
Definition: shellapi.h:170
BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, LONG len, BOOL bPrependDot)
Definition: classes.c:46
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define SHGFI_USEFILEATTRIBUTES
Definition: shellapi.h:179
GLbitfield flags
Definition: glext.h:7161
#define SM_CXSMICON
Definition: winuser.h:1002
#define SHGFI_ATTRIBUTES
Definition: shellapi.h:166
int ret
#define IDI_SHELL_FOLDER
Definition: shresdef.h:479
#define SM_CYICON
Definition: winuser.h:963
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:373
uint32_t DWORD_PTR
Definition: typedefs.h:63
HICON hIcon
Definition: shellapi.h:370
#define SHGFI_KNOWN_FLAGS
Definition: shell32_main.c:399
BOOL WINAPI Shell_GetImageLists(HIMAGELIST *lpBigList, HIMAGELIST *lpSmallList)
Definition: iconcache.cpp:706
#define ERR(fmt,...)
Definition: debug.h:109
#define SHGFI_ICONLOCATION
Definition: shellapi.h:167
#define S_OK
Definition: intsafe.h:59
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
#define SHGFI_EXETYPE
Definition: shellapi.h:168
#define lstrcpyW
Definition: compat.h:414
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1323
#define SHGFI_ATTR_SPECIFIED
Definition: shellapi.h:172
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242
unsigned int UINT
Definition: ndis.h:50
INT SIC_GetIconIndex(LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags)
Definition: iconcache.cpp:443
#define MultiByteToWideChar
Definition: compat.h:100
HRESULT WINAPI SHILCreateFromPathW(LPCWSTR path, LPITEMIDLIST *ppidl, DWORD *attributes)
Definition: pidl.c:392
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
void _ILGetFileType(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2508
DWORD dwFileAttributes
BOOL PidlToSicIndex(IShellFolder *sh, LPCITEMIDLIST pidl, BOOL bBigIcon, UINT uFlags, int *pIndex)
Definition: iconcache.cpp:732
#define ILD_NORMAL
Definition: commctrl.h:413
#define SHGFI_ICON
Definition: shellapi.h:162
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:189
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
BOOL WINAPI StrRetToStrNW(LPWSTR dest, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl)
Definition: shellstring.c:84
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by FILEDLG95_InitControls(), FILEDLG95_LOOKIN_AddItem(), FILEDLG95_LOOKIN_DrawItem(), GetIcon(), CFileDefExt::InitFileType(), CSendToMenu::LoadAllItems(), CNewMenu::LoadItem(), CShellLink::OnInitDialog(), QueryFileDescription(), SH_GetTargetTypeByPath(), SHCreateFileExtractIconW(), SHGetFileInfoA(), SHGetFileInfoWrapW(), START_TEST(), test_get_file_info(), and test_get_file_info_iconlist().

◆ shgfi_get_exe_type()

static DWORD shgfi_get_exe_type ( LPCWSTR  szFullPath)
static

Definition at line 309 of file shell32_main.c.

310 {
311  BOOL status = FALSE;
312  HANDLE hfile;
313  DWORD BinaryType;
314  IMAGE_DOS_HEADER mz_header;
316  DWORD len;
317  char magic[4];
318 
319  status = GetBinaryTypeW (szFullPath, &BinaryType);
320  if (!status)
321  return 0;
322  if (BinaryType == SCS_DOS_BINARY || BinaryType == SCS_PIF_BINARY)
323  return 0x4d5a;
324 
325  hfile = CreateFileW( szFullPath, GENERIC_READ, FILE_SHARE_READ,
326  NULL, OPEN_EXISTING, 0, 0 );
327  if ( hfile == INVALID_HANDLE_VALUE )
328  return 0;
329 
330  /*
331  * The next section is adapted from MODULE_GetBinaryType, as we need
332  * to examine the image header to get OS and version information. We
333  * know from calling GetBinaryTypeA that the image is valid and either
334  * an NE or PE, so much error handling can be omitted.
335  * Seek to the start of the file and read the header information.
336  */
337 
338  SetFilePointer( hfile, 0, NULL, SEEK_SET );
339  ReadFile( hfile, &mz_header, sizeof(mz_header), &len, NULL );
340 
341  SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
342  ReadFile( hfile, magic, sizeof(magic), &len, NULL );
343  if ( *(DWORD*)magic == IMAGE_NT_SIGNATURE )
344  {
345  SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
346  ReadFile( hfile, &nt, sizeof(nt), &len, NULL );
347  CloseHandle( hfile );
348  /* DLL files are not executable and should return 0 */
350  return 0;
352  {
353  return IMAGE_NT_SIGNATURE |
356  }
357  return IMAGE_NT_SIGNATURE;
358  }
359  else if ( *(WORD*)magic == IMAGE_OS2_SIGNATURE )
360  {
361  IMAGE_OS2_HEADER ne;
362  SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
363  ReadFile( hfile, &ne, sizeof(ne), &len, NULL );
364  CloseHandle( hfile );
365  if (ne.ne_exetyp == 2)
366  return IMAGE_OS2_SIGNATURE | (ne.ne_expver << 16);
367  return 0;
368  }
369  CloseHandle( hfile );
370  return 0;
371 }
#define CloseHandle
Definition: compat.h:406
u32_t magic(void)
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
BOOL WINAPI GetBinaryTypeW(LPCWSTR lpApplicationName, LPDWORD lpBinaryType)
Definition: vdm.c:1235
IMAGE_NT_HEADERS nt
Definition: module.c:50
#define IMAGE_FILE_DLL
Definition: pedump.c:169
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
#define FILE_SHARE_READ
Definition: compat.h:125
DWORD WINAPI DECLSPEC_HOTPATCH SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod)
Definition: fileinfo.c:204
#define SCS_DOS_BINARY
Definition: winbase.h:235
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SCS_PIF_BINARY
Definition: winbase.h:237
smooth NULL
Definition: ftsmooth.c:416
IMAGE_FILE_HEADER FileHeader
Definition: ntddk_ex.h:183
#define OPEN_EXISTING
Definition: compat.h:434
#define IMAGE_NT_SIGNATURE
Definition: pedump.c:93
#define SEEK_SET
Definition: jmemansi.c:26
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define IMAGE_OS2_SIGNATURE
Definition: pedump.c:90
#define GENERIC_READ
Definition: compat.h:124
#define CreateFileW
Definition: compat.h:408
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
#define IMAGE_SUBSYSTEM_WINDOWS_GUI
Definition: ntimage.h:437
Definition: ps.c:97

Referenced by SHGetFileInfoW().

◆ SHHelpShortcuts_RunDLLA()

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

Definition at line 1038 of file shell32_main.c.

1039 {
1040  FIXME("(%x, %x, %x, %x) stub!\n", dwArg1, dwArg2, dwArg3, dwArg4);
1041  return 0;
1042 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ SHHelpShortcuts_RunDLLW()

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

Definition at line 1048 of file shell32_main.c.

1049 {
1050  FIXME("(%x, %x, %x, %x) stub!\n", dwArg1, dwArg2, dwArg3, dwArg4);
1051  return 0;
1052 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ SHLoadInProc()

HRESULT WINAPI SHLoadInProc ( REFCLSID  rclsid)

Definition at line 1059 of file shell32_main.c.

1060 {
1061  void *ptr = NULL;
1062 
1063  TRACE("%s\n", debugstr_guid(rclsid));
1064 
1065  CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,&ptr);
1066  if(ptr)
1067  {
1068  IUnknown * pUnk = ptr;
1069  IUnknown_Release(pUnk);
1070  return S_OK;
1071  }
1072  return DISP_E_MEMBERNOTFOUND;
1073 }
#define DISP_E_MEMBERNOTFOUND
Definition: winerror.h:2512
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define S_OK
Definition: intsafe.h:59
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30

◆ SHLoadNonloadedIconOverlayIdentifiers()

HRESULT WINAPI SHLoadNonloadedIconOverlayIdentifiers ( VOID  )

Definition at line 1404 of file shell32_main.c.

1405 {
1406  FIXME("stub\n");
1407  return S_OK;
1408 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59

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

Referenced by AboutAuthorsDlgProc().