ReactOS  0.4.15-dev-313-g8fde48b
shell32.cpp File Reference
#include "precomp.h"
#include "shell32_version.h"
Include dependency graph for shell32.cpp:

Go to the source code of this file.

Classes

struct  IDefClFImpl
 
class  CStartMenuDummy
 
class  CStartMenuDummy::_CreatorClass
 
class  CShell32Module
 

Typedefs

typedef HRESULT(CALLBACKLPFNCREATEINSTANCE) (IUnknown *pUnkOuter, REFIID riid, LPVOID *ppvObject)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
EXTERN_C LPWSTR WINAPI AddCommasW (DWORD lValue, LPWSTR lpNumber)
 
EXTERN_C BOOL WINAPI RegenerateUserEnvironment (LPVOID *lpEnvironment, BOOL bUpdateSelf)
 
HRESULT IDefClF_fnConstructor (LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, const IID *riidInst, IClassFactory **theFactory)
 
HRESULT WINAPI SHCreateDefClassObject (REFIID riid, LPVOID *ppv, LPFNCREATEINSTANCE lpfnCI, LPDWORD pcRefDll, REFIID riidInst)
 
STDAPI DllGetVersion (DLLVERSIONINFO *pdvi)
 
 STDAPI_ (BOOL) DllMain(HINSTANCE hInstance
 
 if (dwReason==DLL_PROCESS_ATTACH)
 
STDAPI DllCanUnloadNow ()
 
STDAPI DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 
STDAPI DllRegisterServer ()
 
STDAPI DllUnregisterServer ()
 
HRESULT WINAPI DllInstall (BOOL bInstall, LPCWSTR cmdline)
 

Variables

CShell32Module gModule
 
HINSTANCE shell32_hInstance
 
DWORD dwReason
 
DWORD LPVOID fImpLoad
 
return TRUE
 

Typedef Documentation

◆ LPFNCREATEINSTANCE

typedef HRESULT(CALLBACK * LPFNCREATEINSTANCE) (IUnknown *pUnkOuter, REFIID riid, LPVOID *ppvObject)

Definition at line 111 of file shell32.cpp.

Function Documentation

◆ AddCommasW()

EXTERN_C LPWSTR WINAPI AddCommasW ( DWORD  lValue,
LPWSTR  lpNumber 
)

Definition at line 33 of file shell32.cpp.

34 {
35  WCHAR szValue[MAX_PATH], szSeparator[8 + 1];
36  NUMBERFMTW numFormat;
37 
40  szSeparator,
41  _countof(szSeparator));
42 
43  numFormat.NumDigits = 0;
44  numFormat.LeadingZero = 0;
45  numFormat.Grouping = 3; // FIXME! Use GetLocaleInfoW with LOCALE_SGROUPING and interpret the result.
46  numFormat.lpDecimalSep = szSeparator;
47  numFormat.lpThousandSep = szSeparator;
48  numFormat.NegativeOrder = 0;
49 
50  swprintf(szValue, L"%lu", lValue);
51 
53  0,
54  szValue,
55  &numFormat,
56  lpNumber,
57  MAX_PATH) != 0)
58  {
59  return lpNumber;
60  }
61 
62  wcscpy(lpNumber, szValue);
63  return lpNumber;
64 }
LPWSTR lpThousandSep
Definition: winnls.h:643
LPWSTR lpDecimalSep
Definition: winnls.h:642
#define LOCALE_USER_DEFAULT
UINT Grouping
Definition: winnls.h:641
UINT NegativeOrder
Definition: winnls.h:644
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
#define LOCALE_STHOUSAND
Definition: winnls.h:43
UINT NumDigits
Definition: winnls.h:639
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:26
#define swprintf(buf, format,...)
Definition: sprintf.c:56
_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
UINT LeadingZero
Definition: winnls.h:640
INT WINAPI GetNumberFormatW(LCID lcid, DWORD dwFlags, LPCWSTR lpszValue, const NUMBERFMTW *lpFormat, LPWSTR lpNumberStr, int cchOut)
Definition: lcformat.c:1198

Referenced by START_TEST().

◆ DllCanUnloadNow()

STDAPI DllCanUnloadNow ( void  )

Definition at line 403 of file shell32.cpp.

404 {
405  return gModule.DllCanUnloadNow();
406 }
HRESULT DllCanUnloadNow()
Definition: atlbase.h:928
CShell32Module gModule
Definition: shell32.cpp:303

◆ DllGetClassObject()

STDAPI DllGetClassObject ( REFCLSID  rclsid,
REFIID  riid,
LPVOID ppv 
)

Definition at line 412 of file shell32.cpp.

413 {
414  HRESULT hResult;
415 
416  TRACE("CLSID:%s,IID:%s\n", shdebugstr_guid(&rclsid), shdebugstr_guid(&riid));
417 
418  hResult = gModule.DllGetClassObject(rclsid, riid, ppv);
419  TRACE("-- pointer to class factory: %p\n", *ppv);
420  return hResult;
421 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:414
HRESULT DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: atlbase.h:935
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:78
CShell32Module gModule
Definition: shell32.cpp:303

◆ DllGetVersion()

STDAPI DllGetVersion ( DLLVERSIONINFO pdvi)

Definition at line 322 of file shell32.cpp.

323 {
324  /* FIXME: shouldn't these values come from the version resource? */
325  if (pdvi->cbSize == sizeof(DLLVERSIONINFO) ||
326  pdvi->cbSize == sizeof(DLLVERSIONINFO2))
327  {
332  if (pdvi->cbSize == sizeof(DLLVERSIONINFO2))
333  {
334  DLLVERSIONINFO2 *pdvi2 = (DLLVERSIONINFO2 *)pdvi;
335 
336  pdvi2->dwFlags = 0;
337  pdvi2->ullVersion = MAKEDLLVERULL(WINE_FILEVERSION_MAJOR,
341  }
342  TRACE("%u.%u.%u.%u\n",
343  pdvi->dwMajorVersion, pdvi->dwMinorVersion,
344  pdvi->dwBuildNumber, pdvi->dwPlatformID);
345  return S_OK;
346  }
347  else
348  {
349  WARN("wrong DLLVERSIONINFO size from app\n");
350  return E_INVALIDARG;
351  }
352 }
DWORD dwMinorVersion
Definition: shlwapi.h:1956
#define WINE_FILEVERSION_PLATFORMID
#define WARN(fmt,...)
Definition: debug.h:112
#define WINE_FILEVERSION_MAJOR
DWORD dwBuildNumber
Definition: shlwapi.h:1957
#define E_INVALIDARG
Definition: ddrawi.h:101
DWORD dwMajorVersion
Definition: shlwapi.h:1955
#define MAKEDLLVERULL(mjr, mnr, bld, qfe)
Definition: shlwapi.h:1982
#define TRACE(s)
Definition: solgame.cpp:4
#define WINE_FILEVERSION_MINOR
#define WINE_FILEVERSION_BUILD
DWORD dwPlatformID
Definition: shlwapi.h:1958
#define S_OK
Definition: intsafe.h:59

◆ DllInstall()

HRESULT WINAPI DllInstall ( BOOL  bInstall,
LPCWSTR  cmdline 
)

Definition at line 472 of file shell32.cpp.

473 {
474  FIXME("%s %s: stub\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline));
475  return S_OK; /* indicate success */
476 }
TCHAR * cmdline
Definition: stretchblt.cpp:32
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
#define S_OK
Definition: intsafe.h:59

◆ DllRegisterServer()

STDAPI DllRegisterServer ( void  )

Definition at line 426 of file shell32.cpp.

427 {
428  HRESULT hr;
429 
431  if (FAILED(hr))
432  return hr;
433 
435  if (FAILED(hr))
436  return hr;
437 
439  if (FAILED(hr))
440  return hr;
441 
442  return S_OK;
443 }
HRESULT DllRegisterServer(BOOL bRegTypeLib=TRUE)
Definition: atlbase.h:940
HRESULT hr
Definition: shlfolder.c:183
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI UpdateRegistryFromResource(LPCTSTR lpszRes, BOOL bRegister, struct _ATL_REGMAP_ENTRY *pMapEntries=NULL)
Definition: atlbase.h:439
LONG HRESULT
Definition: typedefs.h:78
return TRUE
Definition: shell32.cpp:397
#define S_OK
Definition: intsafe.h:59
CShell32Module gModule
Definition: shell32.cpp:303
#define IDR_FOLDEROPTIONS
Definition: shresdef.h:805
HRESULT SHELL_RegisterShellFolders(void) DECLSPEC_HIDDEN
Definition: shellpath.c:2681

◆ DllUnregisterServer()

STDAPI DllUnregisterServer ( void  )

Definition at line 448 of file shell32.cpp.

449 {
450  HRESULT hr;
451 
453  if (FAILED(hr))
454  return hr;
455 
457  if (FAILED(hr))
458  return hr;
459 
460  return S_OK;
461 }
HRESULT hr
Definition: shlfolder.c:183
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI UpdateRegistryFromResource(LPCTSTR lpszRes, BOOL bRegister, struct _ATL_REGMAP_ENTRY *pMapEntries=NULL)
Definition: atlbase.h:439
LONG HRESULT
Definition: typedefs.h:78
return TRUE
Definition: shell32.cpp:397
#define S_OK
Definition: intsafe.h:59
CShell32Module gModule
Definition: shell32.cpp:303
#define IDR_FOLDEROPTIONS
Definition: shresdef.h:805
HRESULT DllUnregisterServer(BOOL bUnRegTypeLib=TRUE)
Definition: atlbase.h:945

◆ IDefClF_fnConstructor()

HRESULT IDefClF_fnConstructor ( LPFNCREATEINSTANCE  lpfnCI,
PLONG  pcRefDll,
const IID riidInst,
IClassFactory **  theFactory 
)

Definition at line 200 of file shell32.cpp.

201 {
202  return ShellObjectCreatorInit<IDefClFImpl>(lpfnCI, pcRefDll, riidInst, IID_PPV_ARG(IClassFactory, theFactory));
203 }
LPFNCREATEINSTANCE lpfnCI
Definition: shellole.c:61
#define IID_PPV_ARG(Itype, ppType)

Referenced by SHCreateDefClassObject().

◆ if()

Definition at line 370 of file shell32.cpp.

371  {
373  gModule.Init(ObjectMap, hInstance, &LIBID_Shell32);
374 
376 
377  /* get full path to this DLL for IExtractIconW_fnGetIconLocation() */
379  swShell32Name[MAX_PATH - 1] = '\0';
380 
381  /* Initialize comctl32 */
382  INITCOMMONCONTROLSEX InitCtrls;
383  InitCtrls.dwSize = sizeof(INITCOMMONCONTROLSEX);
385  InitCommonControlsEx(&InitCtrls);
386 
387  /* Bad idea, initialization in DllMain! */
389  }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
EXTERN_C void InitChangeNotifications(void)
WCHAR swShell32Name[MAX_PATH]
Definition: folders.cpp:22
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
HRESULT Init(_ATL_OBJMAP_ENTRY *p, HINSTANCE, const GUID *plibid)
Definition: atlbase.h:797
HINSTANCE hInstance
Definition: charmap.c:20
#define ICC_WIN95_CLASSES
Definition: commctrl.h:66
#define ICC_USEREX_CLASSES
Definition: commctrl.h:68
#define ICC_DATE_CLASSES
Definition: commctrl.h:67
#define MAX_PATH
Definition: compat.h:26
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
CShell32Module gModule
Definition: shell32.cpp:303
HINSTANCE shell32_hInstance
Definition: shell32.cpp:359

◆ RegenerateUserEnvironment()

EXTERN_C BOOL WINAPI RegenerateUserEnvironment ( LPVOID lpEnvironment,
BOOL  bUpdateSelf 
)

Definition at line 71 of file shell32.cpp.

72 {
75  return FALSE;
76 
77  BOOL bResult = CreateEnvironmentBlock(lpEnvironment, hUserToken, TRUE);
78  if (!bResult || !lpEnvironment)
79  {
81  return FALSE;
82  }
83 
84  if (bUpdateSelf)
85  {
86  LPWSTR pszz = (LPWSTR)*lpEnvironment;
87  if (!pszz)
88  return FALSE;
89 
90  while (*pszz)
91  {
92  size_t cch = wcslen(pszz);
93  LPWSTR pchEqual = wcschr(pszz, L'=');
94  if (pchEqual)
95  {
96  CStringW strName(pszz, pchEqual - pszz);
97  SetEnvironmentVariableW(strName, pchEqual + 1);
98  }
99  pszz += cch + 1;
100  }
101  }
102 
104 
105  return bResult;
106 }
#define CloseHandle
Definition: compat.h:407
#define TOKEN_WRITE
Definition: setypes.h:899
BOOL WINAPI CreateEnvironmentBlock(OUT LPVOID *lpEnvironment, IN HANDLE hToken, IN BOOL bInherit)
Definition: environment.c:505
unsigned int BOOL
Definition: ntddk_ex.h:94
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:201
HANDLE hUserToken
Definition: install.c:39
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
return TRUE
Definition: shell32.cpp:397
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableW(IN LPCWSTR lpName, IN LPCWSTR lpValue)
Definition: environ.c:259
static const WCHAR L[]
Definition: oid.c:1250
#define TOKEN_READ
Definition: setypes.h:897
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by CDesktopBrowser::OnSettingChange().

◆ SHCreateDefClassObject()

HRESULT WINAPI SHCreateDefClassObject ( REFIID  riid,
LPVOID ppv,
LPFNCREATEINSTANCE  lpfnCI,
LPDWORD  pcRefDll,
REFIID  riidInst 
)

Definition at line 208 of file shell32.cpp.

214 {
215  IClassFactory *pcf;
216  HRESULT hResult;
217 
218  TRACE("%s %p %p %p %s\n", shdebugstr_guid(&riid), ppv, lpfnCI, pcRefDll, shdebugstr_guid(&riidInst));
219 
221  return E_NOINTERFACE;
222  hResult = IDefClF_fnConstructor(lpfnCI, (PLONG)pcRefDll, &riidInst, &pcf);
223  if (FAILED(hResult))
224  return hResult;
225  *ppv = pcf;
226  return S_OK;
227 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:414
LPFNCREATEINSTANCE lpfnCI
Definition: shellole.c:61
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:78
#define S_OK
Definition: intsafe.h:59
HRESULT IDefClF_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, const IID *riidInst, IClassFactory **theFactory)
Definition: shell32.cpp:200
const GUID IID_IClassFactory
signed int * PLONG
Definition: retypes.h:5
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96

◆ STDAPI_()

STDAPI_ ( BOOL  )

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ dwReason

DWORD dwReason

Definition at line 367 of file shell32.cpp.

◆ fImpLoad

DWORD LPVOID fImpLoad
Initial value:
{
TRACE("%p 0x%x %p\n", hInstance, dwReason, fImpLoad)
HINSTANCE hInstance
Definition: charmap.c:20
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwReason
Definition: shell32.cpp:367
DWORD LPVOID fImpLoad
Definition: shell32.cpp:368

Definition at line 368 of file shell32.cpp.

◆ gModule

◆ shell32_hInstance

HINSTANCE shell32_hInstance

Definition at line 359 of file shell32.cpp.

Referenced by CFSDropTarget::_GetEffectFromMenu(), CFSDropTarget::_GetUniqueFileName(), _ILGetFileType(), _InsertMenuItemW(), _SetOperationTitle(), _SHGetDefaultValue(), AboutDlgProc(), ActionDlg_OnBrowse(), COpenWithMenu::AddChooseProgramItem(), CDefaultContextMenu::AddStaticContextMenusToMenu(), COpenWithDialog::Browse(), BrsFolder_NewFolder(), ConfirmDialog(), Control_CreateListView(), Control_DoInterface(), Control_WndProc(), Control_WndProc_Create(), CFileDefExt::CountFolderAndFiles(), CNewMenu::CreateNewFolder(), CShellLink::CreateShortcutIcon(), do_error_dialog(), CDefaultContextMenu::DoCreateNewFolder(), DrivesContextMenuCallback(), EditTypeDlg_OnCommand(), CDrvDefExt::ExtraPageProc(), FileTypesDlg_DoList(), FileTypesDlg_InitListView(), CDefView::FillEditMenu(), CDefView::FillViewMenu(), FolderOptionsFileTypesDlg(), FormatDriveDlg(), FormatExCB(), GeneralDlg_UpdateIcons(), CControlPanelFolder::GetDetailsOf(), CRecycleBin::GetDetailsOf(), CDrivesFolder::GetDisplayNameOf(), GetDriveNameWithLetter(), GetFileTypeIconsEx(), HCR_GetClassNameA(), HCR_GetClassNameW(), if(), COpenWithDialog::Init(), CFileDefExt::InitFileAttr(), CDrvDefExt::InitGeneralPage(), CFileDefExt::InitGeneralPage(), CDesktopBrowser::Initialize(), CNewMenu::Initialize(), InitializeFormatDriveDlg(), InitializeRecycleBinDlg(), CFileDefExt::InitOpensWithField(), InsertDefaultClusterSizeForFs(), CNewMenu::InsertShellNewItems(), COpenWithDialog::IsNoOpen(), LogoffWindowsDialog(), CNewMenu::NewItemByNonCommand(), CShellLink::OnCommand(), CDefView::OnCreate(), PickIconDlg(), PickIconProc(), Printer_LoadIconsW(), PropSheetProc(), CDefViewBckgrndMenu::QueryContextMenu(), COpenWithMenu::QueryContextMenu(), CRecycleBin::QueryContextMenu(), CNewMenu::QueryContextMenu(), CRecycleBinItemContextMenu::QueryContextMenu(), RegisterComponent(), RunDlgProc(), RunFileDlg(), SetFileTypeEntryDefaultIcon(), SH_CreatePropertySheetPage(), SH_FormatByteSize(), SH_ShowRecycleBinProperties(), SHBrowseForFolderW(), SHCreateDirectoryExW(), SHELL_ConfirmDialogW(), SHELL_ConfirmIDs(), SHELL_ConfirmMsgBox(), ShellAboutW(), ShellExecCmdLine(), SHEmptyRecycleBinW(), SHFormatDrive(), SHOpenWithDialog(), ShowFolderOptionsDialog(), SHWinHelp(), SIC_Initialize(), CFileDefExt::UpdateFolderIcon(), and CDefView::UpdateStatusbar().

◆ TRUE

return TRUE

Definition at line 397 of file shell32.cpp.

Referenced by DllRegisterServer(), DllUnregisterServer(), and RegenerateUserEnvironment().