ReactOS  0.4.15-dev-2961-gecb0c09
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
 
#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 OLD_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 976 of file shell32_main.c.

◆ DROP_FIELD_TOP

#define DROP_FIELD_TOP   (-15)

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

1108 {
1109  switch(msg)
1110  {
1111  case WM_INITDIALOG:
1112  {
1113  const char* const *pstr = SHELL_Authors;
1114 
1115  // Add the authors to the list
1117 
1118  while (*pstr)
1119  {
1120  WCHAR name[64];
1121 
1122  /* authors list is in utf-8 format */
1123  MultiByteToWideChar( CP_UTF8, 0, *pstr, -1, name, sizeof(name)/sizeof(WCHAR) );
1125  pstr++;
1126  }
1127 
1129 
1130  return TRUE;
1131  }
1132  }
1133 
1134  return FALSE;
1135 }
#define LB_ADDSTRING
Definition: winuser.h:2013
#define TRUE
Definition: types.h:120
#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
#define FALSE
Definition: types.h:117
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:51
#define MultiByteToWideChar
Definition: compat.h:110
#define msg(x)
Definition: auth_time.c:54
Definition: name.c:38
#define IDC_ABOUT_AUTHORS_LISTBOX
Definition: shresdef.h:353
#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 1139 of file shell32_main.c.

1140 {
1141  static DWORD cxLogoBmp;
1142  static DWORD cyLogoBmp, cyLineBmp;
1143  static HBITMAP hLogoBmp, hLineBmp;
1144  static HWND hWndAuthors;
1145 
1146  switch(msg)
1147  {
1148  case WM_INITDIALOG:
1149  {
1151 
1152  if (info)
1153  {
1154  const WCHAR szRegKey[] = L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
1155  HKEY hRegKey;
1156  MEMORYSTATUSEX MemStat;
1157  WCHAR szAppTitle[512];
1158  WCHAR szAppTitleTemplate[512];
1159  WCHAR szAuthorsText[20];
1160 
1161  // Preload the ROS bitmap
1162  if (IsWindowsServer())
1163  {
1164  // Load Server Bitmap
1166  }
1167  else
1168  {
1169  // Load Workstation Bitmap
1171  }
1173 
1174  if(hLogoBmp && hLineBmp)
1175  {
1176  BITMAP bmpLogo;
1177 
1178  GetObject( hLogoBmp, sizeof(BITMAP), &bmpLogo );
1179 
1180  cxLogoBmp = bmpLogo.bmWidth;
1181  cyLogoBmp = bmpLogo.bmHeight;
1182 
1183  GetObject( hLineBmp, sizeof(BITMAP), &bmpLogo );
1184  cyLineBmp = bmpLogo.bmHeight;
1185  }
1186 
1187  // Set App-specific stuff (icon, app name, szOtherStuff string)
1189 
1190  GetWindowTextW( hWnd, szAppTitleTemplate, sizeof(szAppTitleTemplate) / sizeof(WCHAR) );
1191  swprintf( szAppTitle, szAppTitleTemplate, info->szApp );
1193 
1195 #ifdef __REACTOS__
1196  SetDlgItemTextW( hWnd, IDC_ABOUT_VERSION, info->szOSVersion );
1197 #endif
1198  SetDlgItemTextW( hWnd, IDC_ABOUT_OTHERSTUFF, info->szOtherStuff );
1199 
1200  // Set the registered user and organization name
1201  if(RegOpenKeyExW( HKEY_LOCAL_MACHINE, szRegKey, 0, KEY_QUERY_VALUE, &hRegKey ) == ERROR_SUCCESS)
1202  {
1203  SetRegTextData( hWnd, hRegKey, L"RegisteredOwner", IDC_ABOUT_REG_USERNAME );
1204  SetRegTextData( hWnd, hRegKey, L"RegisteredOrganization", IDC_ABOUT_REG_ORGNAME );
1205 #ifdef __REACTOS__
1208  {
1210  }
1211 #endif
1212 
1213  RegCloseKey( hRegKey );
1214  }
1215 
1216  // Set the value for the installed physical memory
1217  MemStat.dwLength = sizeof(MemStat);
1218  if( GlobalMemoryStatusEx(&MemStat) )
1219  {
1220  WCHAR szBuf[12];
1221 
1222  if (MemStat.ullTotalPhys > 1024 * 1024 * 1024)
1223  {
1224  double dTotalPhys;
1225  WCHAR szDecimalSeparator[4];
1226  WCHAR szUnits[3];
1227 
1228  // We're dealing with GBs or more
1229  MemStat.ullTotalPhys /= 1024 * 1024;
1230 
1231  if (MemStat.ullTotalPhys > 1024 * 1024)
1232  {
1233  // We're dealing with TBs or more
1234  MemStat.ullTotalPhys /= 1024;
1235 
1236  if (MemStat.ullTotalPhys > 1024 * 1024)
1237  {
1238  // We're dealing with PBs or more
1239  MemStat.ullTotalPhys /= 1024;
1240 
1241  dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1242  wcscpy( szUnits, L"PB" );
1243  }
1244  else
1245  {
1246  dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1247  wcscpy( szUnits, L"TB" );
1248  }
1249  }
1250  else
1251  {
1252  dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
1253  wcscpy( szUnits, L"GB" );
1254  }
1255 
1256  // We need the decimal point of the current locale to display the RAM size correctly
1258  szDecimalSeparator,
1259  sizeof(szDecimalSeparator) / sizeof(WCHAR)) > 0)
1260  {
1261  UCHAR uDecimals;
1262  UINT uIntegral;
1263 
1264  uIntegral = (UINT)dTotalPhys;
1265  uDecimals = (UCHAR)((UINT)(dTotalPhys * 100) - uIntegral * 100);
1266 
1267  // Display the RAM size with 2 decimals
1268  swprintf(szBuf, L"%u%s%02u %s", uIntegral, szDecimalSeparator, uDecimals, szUnits);
1269  }
1270  }
1271  else
1272  {
1273  // We're dealing with MBs, don't show any decimals
1274  swprintf( szBuf, L"%u MB", (UINT)MemStat.ullTotalPhys / 1024 / 1024 );
1275  }
1276 
1278  }
1279 
1280  // Add the Authors dialog
1282  LoadStringW( shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, sizeof(szAuthorsText) / sizeof(WCHAR) );
1283  SetDlgItemTextW( hWnd, IDC_ABOUT_AUTHORS, szAuthorsText );
1284  }
1285 
1286  return TRUE;
1287  }
1288 
1289  case WM_PAINT:
1290  {
1291  if(hLogoBmp && hLineBmp)
1292  {
1293  PAINTSTRUCT ps;
1294  HDC hdc;
1295  HDC hdcMem;
1296  HGDIOBJ hOldObj;
1297 
1298  hdc = BeginPaint(hWnd, &ps);
1300 
1301  if(hdcMem)
1302  {
1303  hOldObj = SelectObject(hdcMem, hLogoBmp);
1304  BitBlt(hdc, 0, 0, cxLogoBmp, cyLogoBmp, hdcMem, 0, 0, SRCCOPY);
1305 
1306  SelectObject(hdcMem, hLineBmp);
1307  BitBlt(hdc, 0, cyLogoBmp, cxLogoBmp, cyLineBmp, hdcMem, 0, 0, SRCCOPY);
1308 
1309  SelectObject(hdcMem, hOldObj);
1310  DeleteDC(hdcMem);
1311  }
1312 
1313  EndPaint(hWnd, &ps);
1314  }
1315  }; break;
1316 
1317  case WM_COMMAND:
1318  {
1319  switch(wParam)
1320  {
1321  case IDOK:
1322  case IDCANCEL:
1323  EndDialog(hWnd, TRUE);
1324  return TRUE;
1325 
1326  case IDC_ABOUT_AUTHORS:
1327  {
1328  static BOOL bShowingAuthors = FALSE;
1329  WCHAR szAuthorsText[20];
1330 
1331  if(bShowingAuthors)
1332  {
1333  LoadStringW( shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, sizeof(szAuthorsText) / sizeof(WCHAR) );
1334  ShowWindow( hWndAuthors, SW_HIDE );
1335  }
1336  else
1337  {
1338  LoadStringW( shell32_hInstance, IDS_SHELL_ABOUT_BACK, szAuthorsText, sizeof(szAuthorsText) / sizeof(WCHAR) );
1339  ShowWindow( hWndAuthors, SW_SHOW );
1340  }
1341 
1342  SetDlgItemTextW( hWnd, IDC_ABOUT_AUTHORS, szAuthorsText );
1343  bShowingAuthors = !bShowingAuthors;
1344  return TRUE;
1345  }
1346  }
1347  }; break;
1348 
1349  case WM_CLOSE:
1350  EndDialog(hWnd, TRUE);
1351  break;
1352  }
1353 
1354  return 0;
1355 }
#define IDB_REACTOS_WORKSTATION
Definition: shresdef.h:31
#define STM_SETICON
Definition: winuser.h:2074
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDOK
Definition: winuser.h:824
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDC_ABOUT_OTHERSTUFF
Definition: shresdef.h:344
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
#define LOCALE_USER_DEFAULT
static HDC
Definition: imagelist.c:92
#define IDC_ABOUT_APPNAME
Definition: shresdef.h:341
HWND hWnd
Definition: settings.c:17
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
UINT_PTR WPARAM
Definition: windef.h:207
#define swprintf
Definition: precomp.h:40
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
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:346
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDB_LINEBAR
Definition: shresdef.h:33
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:340
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDB_REACTOS_SERVER
Definition: shresdef.h:32
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDC_ABOUT_REG_TO
Definition: shresdef.h:345
#define WM_CLOSE
Definition: winuser.h:1603
int WINAPI GetWindowTextLengthW(_In_ HWND)
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:351
VERSIONHELPERAPI IsWindowsServer()
#define GetObject
Definition: wingdi.h:4467
#define WM_PAINT
Definition: winuser.h:1602
#define IDC_ABOUT_AUTHORS
Definition: shresdef.h:352
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:136
#define CreateDialogW(h, n, w, f)
Definition: winuser.h:4256
#define WM_COMMAND
Definition: winuser.h:1722
#define IDC_ABOUT_VERSION
Definition: shresdef.h:343
#define shell32_hInstance
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
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:347
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define IDC_ABOUT_PHYSMEM
Definition: shresdef.h:348
#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:137
#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
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
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

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  {
107  LocalFree(argv);
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 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
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
#define LMEM_FIXED
Definition: winbase.h:365
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
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
#define NULL
Definition: types.h:112
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define d
Definition: ke_i.h:81

Referenced by _tmain(), CmdDebugService(), command_line_to_args(), DisplayApplet(), 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 842 of file shell32_main.c.

843 {
845  HICON hDupIcon = 0;
846 
847  TRACE("%p %p\n", hInstance, hIcon);
848 
849  if (GetIconInfo(hIcon, &IconInfo))
850  {
851  hDupIcon = CreateIconIndirect(&IconInfo);
852 
853  /* clean up hbmMask and hbmColor */
856  }
857 
858  return hDupIcon;
859 }
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:2313

◆ ExtractIconA()

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

Definition at line 864 of file shell32_main.c.

865 {
866  HICON ret;
867  INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0);
868  LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
869 
870  TRACE("%p %s %d\n", hInstance, lpszFile, nIconIndex);
871 
872  MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len);
873  ret = ExtractIconW(hInstance, lpwstrFile, nIconIndex);
874  HeapFree(GetProcessHeap(), 0, lpwstrFile);
875 
876  return ret;
877 }
static HICON
Definition: imagelist.c:84
#define CP_ACP
Definition: compat.h:109
int32_t INT
Definition: typedefs.h:58
HICON WINAPI ExtractIconW(HINSTANCE hInstance, LPCWSTR lpszFile, UINT nIconIndex)
Definition: shell32_main.c:882
HINSTANCE hInstance
Definition: charmap.c:20
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by test_ExtractIcon().

◆ ExtractIconW()

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

Definition at line 882 of file shell32_main.c.

883 {
884  HICON hIcon = NULL;
885  UINT ret;
887 
888  TRACE("%p %s %d\n", hInstance, debugstr_w(lpszFile), nIconIndex);
889 
890  if (nIconIndex == (UINT)-1)
891  {
892  ret = PrivateExtractIconsW(lpszFile, 0, cx, cy, NULL, NULL, 0, LR_DEFAULTCOLOR);
893  if (ret != (UINT)-1 && ret)
894  return (HICON)(UINT_PTR)ret;
895  return NULL;
896  }
897  else
898  ret = PrivateExtractIconsW(lpszFile, nIconIndex, cx, cy, &hIcon, NULL, 1, LR_DEFAULTCOLOR);
899 
900  if (ret == (UINT)-1)
901  return (HICON)1;
902  else if (ret > 0 && hIcon)
903  return hIcon;
904 
905  return NULL;
906 }
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:585
#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
#define NULL
Definition: types.h:112
_Out_opt_ int * cx
Definition: commctrl.h:585
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077

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

◆ FreeIconList()

void WINAPI FreeIconList ( DWORD  dw)

Definition at line 1435 of file shell32_main.c.

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

◆ OLD_SHAppBarMessage()

UINT_PTR WINAPI OLD_SHAppBarMessage ( DWORD  msg,
PAPPBARDATA  data 
)

Definition at line 981 of file shell32_main.c.

982 {
983  int width=data->rc.right - data->rc.left;
984  int height=data->rc.bottom - data->rc.top;
985  RECT rec=data->rc;
986 
987  TRACE("msg=%d, data={cb=%d, hwnd=%p, callback=%x, edge=%d, rc=%s, lparam=%lx}\n",
988  msg, data->cbSize, data->hWnd, data->uCallbackMessage, data->uEdge,
989  wine_dbgstr_rect(&data->rc), data->lParam);
990 
991  switch (msg)
992  {
993  case ABM_GETSTATE:
994  return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
995 
996  case ABM_GETTASKBARPOS:
997  GetWindowRect(data->hWnd, &rec);
998  data->rc=rec;
999  return TRUE;
1000 
1001  case ABM_ACTIVATE:
1002  SetActiveWindow(data->hWnd);
1003  return TRUE;
1004 
1005  case ABM_GETAUTOHIDEBAR:
1006  return 0; /* pretend there is no autohide bar */
1007 
1008  case ABM_NEW:
1009  /* cbSize, hWnd, and uCallbackMessage are used. All other ignored */
1011  return TRUE;
1012 
1013  case ABM_QUERYPOS:
1014  GetWindowRect(data->hWnd, &(data->rc));
1015  return TRUE;
1016 
1017  case ABM_REMOVE:
1018  FIXME("ABM_REMOVE broken\n");
1019  /* FIXME: this is wrong; should it be DestroyWindow instead? */
1020  /*CloseHandle(data->hWnd);*/
1021  return TRUE;
1022 
1023  case ABM_SETAUTOHIDEBAR:
1024  SetWindowPos(data->hWnd,HWND_TOP,rec.left+1000,rec.top,
1026  return TRUE;
1027 
1028  case ABM_SETPOS:
1029  data->uEdge=(ABE_RIGHT | ABE_LEFT);
1030  SetWindowPos(data->hWnd,HWND_TOP,data->rc.left,data->rc.top,
1032  return TRUE;
1033 
1034  case ABM_WINDOWPOSCHANGED:
1035  return TRUE;
1036  }
1037 
1038  return FALSE;
1039 }
#define ABM_GETAUTOHIDEBAR
Definition: shellapi.h:66
GLint GLint GLsizei width
Definition: gl.h:1546
#define ABS_AUTOHIDE
Definition: shellapi.h:21
#define TRUE
Definition: types.h:120
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
#define FALSE
Definition: types.h:117
HWND WINAPI SetActiveWindow(_In_ HWND)
#define ABM_GETSTATE
Definition: shellapi.h:63
#define FIXME(fmt,...)
Definition: debug.h:111
#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

◆ Printer_LoadIconsW()

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

Definition at line 911 of file shell32_main.c.

912 {
913  INT iconindex=IDI_SHELL_PRINTERS_FOLDER;
914 
915  TRACE("(%s, %p, %p)\n", debugstr_w(wsPrinterName), pLargeIcon, pSmallIcon);
916 
917  /* We should check if wsPrinterName is
918  1. the Default Printer or not
919  2. connected or not
920  3. a Local Printer or a Network-Printer
921  and use different Icons
922  */
923  if((wsPrinterName != NULL) && (wsPrinterName[0] != 0))
924  {
925  FIXME("(select Icon by PrinterName %s not implemented)\n", debugstr_w(wsPrinterName));
926  }
927 
928  if(pLargeIcon != NULL)
929  *pLargeIcon = LoadImageW(shell32_hInstance,
930  (LPCWSTR) MAKEINTRESOURCE(iconindex), IMAGE_ICON,
932 
933  if(pSmallIcon != NULL)
934  *pSmallIcon = LoadImageW(shell32_hInstance,
935  (LPCWSTR) MAKEINTRESOURCE(iconindex), IMAGE_ICON,
936  16, 16, LR_DEFAULTCOLOR);
937 }
#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:58
#define IDI_SHELL_PRINTERS_FOLDER
Definition: shresdef.h:559
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:111
#define TRACE(s)
Definition: solgame.cpp:4
#define LR_DEFAULTSIZE
Definition: winuser.h:1084
#define shell32_hInstance
#define NULL
Definition: types.h:112
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077

◆ Printers_RegisterWindowW()

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

Definition at line 945 of file shell32_main.c.

947 {
948  FIXME("(%s, %x, %p (%p), %p (%p)) stub!\n", debugstr_w(wsPrinter), dwType,
949  phClassPidl, (phClassPidl != NULL) ? *(phClassPidl) : NULL,
950  phwnd, (phwnd != NULL) ? *(phwnd) : NULL);
951 
952  return FALSE;
953 }
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
#define NULL
Definition: types.h:112

◆ Printers_UnregisterWindow()

VOID WINAPI Printers_UnregisterWindow ( HANDLE  hClassPidl,
HWND  hwnd 
)

Definition at line 958 of file shell32_main.c.

959 {
960  FIXME("(%p, %p) stub!\n", hClassPidl, hwnd);
961 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define FIXME(fmt,...)
Definition: debug.h:111

◆ SetRegTextData()

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

Definition at line 1082 of file shell32_main.c.

1083 {
1084  DWORD dwBufferSize;
1085  DWORD dwType;
1086  LPWSTR lpBuffer;
1087 
1088  if( RegQueryValueExW(hKey, Value, NULL, &dwType, NULL, &dwBufferSize) == ERROR_SUCCESS )
1089  {
1090  if(dwType == REG_SZ)
1091  {
1092  lpBuffer = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, dwBufferSize);
1093 
1094  if(lpBuffer)
1095  {
1096  if( RegQueryValueExW(hKey, Value, NULL, &dwType, (LPBYTE)lpBuffer, &dwBufferSize) == ERROR_SUCCESS )
1097  {
1098  SetDlgItemTextW(hWnd, uID, lpBuffer);
1099  }
1100 
1102  }
1103  }
1104  }
1105 }
#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:53
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
#define GetProcessHeap()
Definition: compat.h:595
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
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594
#define REG_SZ
Definition: layer.c:22

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  {
391  if (ERROR_SUCCESS == RegOpenKeyExA(HKEY_CLASSES_ROOT, szTemp, 0, KEY_QUERY_VALUE, &keyCls))
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 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 ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
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
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL _ILGetExtension(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2476
#define MAX_PATH
Definition: compat.h:34
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 NULL
Definition: types.h:112
#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 1361 of file shell32_main.c.

1362 {
1363  BOOL ret;
1364  LPWSTR appW = NULL, otherW = NULL;
1365  int len;
1366 
1367  if (szApp)
1368  {
1369  len = MultiByteToWideChar(CP_ACP, 0, szApp, -1, NULL, 0);
1370  appW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1371  MultiByteToWideChar(CP_ACP, 0, szApp, -1, appW, len);
1372  }
1373  if (szOtherStuff)
1374  {
1375  len = MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, NULL, 0);
1376  otherW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1377  MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, otherW, len);
1378  }
1379 
1380  ret = ShellAboutW(hWnd, appW, otherW, hIcon);
1381 
1382  HeapFree(GetProcessHeap(), 0, otherW);
1383  HeapFree(GetProcessHeap(), 0, appW);
1384  return ret;
1385 }
#define CP_ACP
Definition: compat.h:109
HWND hWnd
Definition: settings.c:17
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:595
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 NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594

◆ ShellAboutW()

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

Definition at line 1391 of file shell32_main.c.

1393 {
1394  ABOUT_INFO info;
1395  HRSRC hRes;
1396  DLGTEMPLATE *DlgTemplate;
1397  BOOL bRet;
1398 #ifdef __REACTOS__
1399  WCHAR szVersionString[256];
1400  WCHAR szFormat[256];
1401 #endif
1402 
1403  TRACE("\n");
1404 
1405  // DialogBoxIndirectParamW will be called with the hInstance of the calling application, so we have to preload the dialog template
1407  if(!hRes)
1408  return FALSE;
1409 
1410  DlgTemplate = (DLGTEMPLATE *)LoadResource(shell32_hInstance, hRes);
1411  if(!DlgTemplate)
1412  return FALSE;
1413 
1414 #ifdef __REACTOS__
1415  /* Output the version OS kernel strings */
1417  StringCchPrintfW(szVersionString, _countof(szVersionString), szFormat, KERNEL_VERSION_STR, KERNEL_VERSION_BUILD_STR);
1418 #endif
1419 
1420  info.szApp = szApp;
1421 #ifdef __REACTOS__
1422  info.szOSVersion = szVersionString;
1423 #endif
1424  info.szOtherStuff = szOtherStuff;
1425  info.hIcon = hIcon ? hIcon : LoadIconW( 0, (LPWSTR)IDI_WINLOGO );
1426 
1428  DlgTemplate, hWnd, AboutDlgProc, (LPARAM)&info );
1429  return bRet;
1430 }
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
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
#define FALSE
Definition: types.h:117
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
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define IDI_WINLOGO
Definition: winuser.h:704
struct _test_info info[]
Definition: SetCursorPos.c:19
#define IDS_ABOUT_VERSION_STRING
Definition: shresdef.h:342
#define shell32_hInstance
#define IDD_ABOUT
Definition: shresdef.h:339
HICON hIcon
Definition: msconfig.c:44
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
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(), MainWndCommand(), OnAbout(), CDeviceManager::OnCommand(), OnCommand(), OSK_About(), ShellAboutA(), ShowAboutBox(), ShowAboutDlg(), CMainWindow::ShowAboutDlg(), WndProc(), and wWinMain().

◆ SHGetFileInfoA()

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

Definition at line 791 of file shell32_main.c.

794 {
795  INT len;
796  LPWSTR temppath = NULL;
797  LPCWSTR pathW;
798  DWORD_PTR ret;
799  SHFILEINFOW temppsfi;
800 
801  if (flags & SHGFI_PIDL)
802  {
803  /* path contains a pidl */
804  pathW = (LPCWSTR)path;
805  }
806  else
807  {
808  len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
809  temppath = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
810  MultiByteToWideChar(CP_ACP, 0, path, -1, temppath, len);
811  pathW = temppath;
812  }
813 
814  if (psfi)
815  {
816  temppsfi.hIcon = psfi->hIcon;
817  temppsfi.iIcon = psfi->iIcon;
818  temppsfi.dwAttributes = psfi->dwAttributes;
819 
820  ret = SHGetFileInfoW(pathW, dwFileAttributes, &temppsfi, sizeof(temppsfi), flags);
821  psfi->hIcon = temppsfi.hIcon;
822  psfi->iIcon = temppsfi.iIcon;
823  psfi->dwAttributes = temppsfi.dwAttributes;
824 
825  WideCharToMultiByte(CP_ACP, 0, temppsfi.szDisplayName, -1,
826  psfi->szDisplayName, sizeof(psfi->szDisplayName), NULL, NULL);
827 
828  WideCharToMultiByte(CP_ACP, 0, temppsfi.szTypeName, -1,
829  psfi->szTypeName, sizeof(psfi->szTypeName), NULL, NULL);
830  }
831  else
833 
834  HeapFree(GetProcessHeap(), 0, temppath);
835 
836  return ret;
837 }
#define WideCharToMultiByte
Definition: compat.h:111
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
DWORD dwAttributes
Definition: shellapi.h:372
#define CP_ACP
Definition: compat.h:109
WCHAR szTypeName[80]
Definition: shellapi.h:374
int32_t INT
Definition: typedefs.h:58
#define SHGFI_PIDL
Definition: shellapi.h:178
CHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:366
#define GetProcessHeap()
Definition: compat.h:595
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:414
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:65
HICON hIcon
Definition: shellapi.h:370
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
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:594

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;
419  DWORD_PTR ret = TRUE;
420  DWORD dwAttributes = 0;
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 */
447  if (PathIsRelativeW(path))
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  {
459  SHGetPathFromIDListW((LPITEMIDLIST)path, szFullPath);
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 */
520  if (SUCCEEDED(hr) && (flags & SHGFI_ATTRIBUTES))
521  {
522  if (!(flags & SHGFI_ATTR_SPECIFIED))
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 */
542  if (SUCCEEDED(hr) && (flags & SHGFI_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  {
560  static const WCHAR szFolder[] = { 'F','o','l','d','e','r',0 };
561  static const WCHAR szFile[] = { 'F','i','l','e',0 };
562  static const WCHAR szSpaceFile[] = { ' ','f','i','l','e',0 };
563 
565  {
566  char ftype[80];
567 
568  _ILGetFileType(pidlLast, ftype, 80);
569  MultiByteToWideChar(CP_ACP, 0, ftype, -1, psfi->szTypeName, 80 );
570  }
571  else
572  {
574  strcatW (psfi->szTypeName, szFolder);
575  else
576  {
577  WCHAR sTemp[64];
578 
579  lstrcpyW(sTemp,PathFindExtensionW(szFullPath));
580  if (sTemp[0] == 0 || (sTemp[0] == '.' && sTemp[1] == 0))
581  {
582  /* "name" or "name." => "File" */
583  lstrcpynW (psfi->szTypeName, szFile, 64);
584  }
585  else if (!( HCR_MapTypeToValueW(sTemp, sTemp, 64, TRUE) &&
586  HCR_MapTypeToValueW(sTemp, psfi->szTypeName, 80, FALSE )))
587  {
588  if (sTemp[0])
589  {
590  lstrcpynW (psfi->szTypeName, sTemp, 64);
591  strcatW (psfi->szTypeName, szSpaceFile);
592  }
593  else
594  {
595  lstrcpynW (psfi->szTypeName, szFile, 64);
596  }
597  }
598  }
599  }
600  }
601 
602  /* ### icons ###*/
603 
604  Shell_GetImageLists( &big_icons, &small_icons );
605 
606  if (flags & SHGFI_OPENICON)
607  uGilFlags |= GIL_OPENICON;
608 
609  if (flags & SHGFI_LINKOVERLAY)
610  uGilFlags |= GIL_FORSHORTCUT;
611  else if ((flags&SHGFI_ADDOVERLAYS) ||
613  {
614  if (SHELL_IsShortcut(pidlLast))
615  uGilFlags |= GIL_FORSHORTCUT;
616  }
617 
619  FIXME("SHGFI_OVERLAYINDEX unhandled\n");
620 
621  if (flags & SHGFI_SELECTED)
622  FIXME("set icon to selected, stub\n");
623 
625  FIXME("set icon to shell size, stub\n");
626 
627  /* get the iconlocation */
628  if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION ))
629  {
630  UINT uDummy,uFlags;
631 
633  {
635  {
637  psfi->iIcon = -IDI_SHELL_FOLDER;
638  }
639  else
640  {
641  WCHAR* szExt;
642  static const WCHAR p1W[] = {'%','1',0};
643  WCHAR sTemp [MAX_PATH];
644 
645  szExt = PathFindExtensionW(szFullPath);
646  TRACE("szExt=%s\n", debugstr_w(szExt));
647  if ( szExt &&
648  HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
649  HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &psfi->iIcon))
650  {
651  if (lstrcmpW(p1W, sTemp))
652  strcpyW(psfi->szDisplayName, sTemp);
653  else
654  {
655  /* the icon is in the file */
656  strcpyW(psfi->szDisplayName, szFullPath);
657  }
658  }
659  else
660  ret = FALSE;
661  }
662  }
663  else if (psfParent)
664  {
665  hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1,
666  (LPCITEMIDLIST*)&pidlLast, &IID_IExtractIconW,
667  &uDummy, (LPVOID*)&pei);
668  if (SUCCEEDED(hr))
669  {
670  hr = IExtractIconW_GetIconLocation(pei, uGilFlags,
671  szLocation, MAX_PATH, &iIndex, &uFlags);
672 
673  if (uFlags & GIL_NOTFILENAME)
674  ret = FALSE;
675  else
676  {
677  lstrcpyW (psfi->szDisplayName, szLocation);
678  psfi->iIcon = iIndex;
679  }
680  IExtractIconW_Release(pei);
681  }
682  }
683  }
684 
685  /* get icon index (or load icon)*/
687  {
689  {
690  WCHAR sTemp [MAX_PATH];
691  WCHAR * szExt;
692  int icon_idx=0;
693 
694  lstrcpynW(sTemp, szFullPath, MAX_PATH);
695 
698  else
699  {
700  static const WCHAR p1W[] = {'%','1',0};
701 
702  psfi->iIcon = 0;
703  szExt = PathFindExtensionW(sTemp);
704  if ( szExt &&
705  HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
706  HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &icon_idx))
707  {
708  if (!lstrcmpW(p1W,sTemp)) /* icon is in the file */
709  strcpyW(sTemp, szFullPath);
710 
711  if (flags & SHGFI_SYSICONINDEX)
712  {
713  psfi->iIcon = SIC_GetIconIndex(sTemp,icon_idx,0);
714  if (psfi->iIcon == -1)
715  psfi->iIcon = 0;
716  }
717  else
718  {
719  UINT ret;
720  if (flags & SHGFI_SMALLICON)
721  ret = PrivateExtractIconsW( sTemp,icon_idx,
724  &psfi->hIcon, 0, 1, 0);
725  else
726  ret = PrivateExtractIconsW( sTemp, icon_idx,
729  &psfi->hIcon, 0, 1, 0);
730  if (ret != 0 && ret != (UINT)-1)
731  {
732  IconNotYetLoaded=FALSE;
733  psfi->iIcon = icon_idx;
734  }
735  }
736  }
737  }
738  }
739  else if (psfParent)
740  {
741  if (!(PidlToSicIndex(psfParent, pidlLast, !(flags & SHGFI_SMALLICON),
742  uGilFlags, &(psfi->iIcon))))
743  {
744  ret = FALSE;
745  }
746  }
747  if (ret && (flags & SHGFI_SYSICONINDEX))
748  {
749  if (flags & SHGFI_SMALLICON)
750  ret = (DWORD_PTR)small_icons;
751  else
752  ret = (DWORD_PTR)big_icons;
753  }
754  }
755 
756  /* icon handle */
757  if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded)
758  {
759  if (flags & SHGFI_SMALLICON)
760  psfi->hIcon = ImageList_GetIcon( small_icons, psfi->iIcon, ILD_NORMAL);
761  else
762  psfi->hIcon = ImageList_GetIcon( big_icons, psfi->iIcon, ILD_NORMAL);
763  }
764 
765  if (flags & ~SHGFI_KNOWN_FLAGS)
766  FIXME("unknown flags %08x\n", flags & ~SHGFI_KNOWN_FLAGS);
767 
768  if (psfParent)
769  IShellFolder_Release(psfParent);
770 
771  if (hr != S_OK)
772  ret = FALSE;
773 
774  SHFree(pidlLast);
775 
776  TRACE ("icon=%p index=0x%08x attr=0x%08x name=%s type=%s ret=0x%08lx\n",
777  psfi->hIcon, psfi->iIcon, psfi->dwAttributes,
779 
780  return ret;
781 }
#define SHGFI_SYSICONINDEX
Definition: shellapi.h:169
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1578
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 TRUE
Definition: types.h:120
#define CP_ACP
Definition: compat.h:109
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:1294
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:615
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:597
static DWORD shgfi_get_exe_type(LPCWSTR szFullPath)
Definition: shell32_main.c:313
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
if SUCCEEDED(hr)
#define debugstr_w
Definition: kernel32.h:32
#define SHGFI_PIDL
Definition: shellapi.h:178
#define FIXME(fmt,...)
Definition: debug.h:111
#define SM_CXICON
Definition: winuser.h:962
#define SHGFI_SHELLICONSIZE
Definition: shellapi.h:177
const WCHAR * str
#define SHGFI_OPENICON
Definition: shellapi.h:176
#define SHGFI_ADDOVERLAYS
Definition: entries.h:77
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:394
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:164
BOOL SHELL_IsShortcut(LPCITEMIDLIST pidlLast)
Definition: shell32_main.c:382
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
#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:79
#define MAX_PATH
Definition: compat.h:34
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
#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:525
#define SM_CYICON
Definition: winuser.h:963
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:373
uint32_t DWORD_PTR
Definition: typedefs.h:65
HICON hIcon
Definition: shellapi.h:370
#define SHGFI_KNOWN_FLAGS
Definition: shell32_main.c:403
BOOL WINAPI Shell_GetImageLists(HIMAGELIST *lpBigList, HIMAGELIST *lpSmallList)
Definition: iconcache.cpp:706
#define ERR(fmt,...)
Definition: debug.h:110
#define SHGFI_ICONLOCATION
Definition: shellapi.h:167
#define S_OK
Definition: intsafe.h:52
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:608
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1337
#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
#define NULL
Definition: types.h:112
INT SIC_GetIconIndex(LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags)
Definition: iconcache.cpp:443
#define MultiByteToWideChar
Definition: compat.h:110
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:2522
DWORD dwFileAttributes
BOOL PidlToSicIndex(IShellFolder *sh, LPCITEMIDLIST pidl, BOOL bBigIcon, UINT uFlags, int *pIndex)
Definition: iconcache.cpp:732
#define ILD_NORMAL
Definition: commctrl.h:417
#define SHGFI_ICON
Definition: shellapi.h:162
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:194
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
BOOL WINAPI StrRetToStrNW(LPWSTR dest, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl)
Definition: shellstring.c:85

Referenced by AddListViewItems(), 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(), 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  {
365  IMAGE_OS2_HEADER ne;
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:598
u32_t magic(void)
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
BOOL WINAPI GetBinaryTypeW(LPCWSTR lpApplicationName, LPDWORD lpBinaryType)
Definition: vdm.c:1243
IMAGE_NT_HEADERS nt
Definition: module.c:50
#define IMAGE_FILE_DLL
Definition: pedump.c:169
#define FILE_SHARE_READ
Definition: compat.h:136
#define SCS_DOS_BINARY
Definition: winbase.h:235
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SCS_PIF_BINARY
Definition: winbase.h:237
IMAGE_FILE_HEADER FileHeader
Definition: ntddk_ex.h:183
#define OPEN_EXISTING
Definition: compat.h:634
#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:135
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
#define ReadFile(a, b, c, d, e)
Definition: compat.h:601
#define NULL
Definition: types.h:112
#define CreateFileW
Definition: compat.h:600
#define SetFilePointer
Definition: compat.h:602
#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 1045 of file shell32_main.c.

1046 {
1047  FIXME("(%x, %x, %x, %x) stub!\n", dwArg1, dwArg2, dwArg3, dwArg4);
1048  return 0;
1049 }
#define FIXME(fmt,...)
Definition: debug.h:111

◆ SHHelpShortcuts_RunDLLW()

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

Definition at line 1055 of file shell32_main.c.

1056 {
1057  FIXME("(%x, %x, %x, %x) stub!\n", dwArg1, dwArg2, dwArg3, dwArg4);
1058  return 0;
1059 }
#define FIXME(fmt,...)
Definition: debug.h:111

◆ SHLoadInProc()

HRESULT WINAPI SHLoadInProc ( REFCLSID  rclsid)

Definition at line 1066 of file shell32_main.c.

1067 {
1068  void *ptr = NULL;
1069 
1070  TRACE("%s\n", debugstr_guid(rclsid));
1071 
1072  CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,&ptr);
1073  if(ptr)
1074  {
1075  IUnknown * pUnk = ptr;
1076  IUnknown_Release(pUnk);
1077  return S_OK;
1078  }
1079  return DISP_E_MEMBERNOTFOUND;
1080 }
#define DISP_E_MEMBERNOTFOUND
Definition: winerror.h:2512
static PVOID ptr
Definition: dispmode.c:27
#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:52
#define NULL
Definition: types.h:112
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30

◆ SHLoadNonloadedIconOverlayIdentifiers()

HRESULT WINAPI SHLoadNonloadedIconOverlayIdentifiers ( VOID  )

Definition at line 1443 of file shell32_main.c.

1444 {
1445  FIXME("stub\n");
1446  return S_OK;
1447 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define S_OK
Definition: intsafe.h:52

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