ReactOS  0.4.13-dev-79-gcd489d8
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 _countof(array)
Definition: fontsub.cpp:30
#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 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 402 of file shell32.cpp.

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

◆ DllGetClassObject()

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

Definition at line 411 of file shell32.cpp.

412 {
413  HRESULT hResult;
414 
415  TRACE("CLSID:%s,IID:%s\n", shdebugstr_guid(&rclsid), shdebugstr_guid(&riid));
416 
417  hResult = gModule.DllGetClassObject(rclsid, riid, ppv);
418  TRACE("-- pointer to class factory: %p\n", *ppv);
419  return hResult;
420 }
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:77
CShell32Module gModule
Definition: shell32.cpp:302

◆ DllGetVersion()

STDAPI DllGetVersion ( DLLVERSIONINFO pdvi)

Definition at line 321 of file shell32.cpp.

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

◆ DllInstall()

HRESULT WINAPI DllInstall ( BOOL  bInstall,
LPCWSTR  cmdline 
)

Definition at line 471 of file shell32.cpp.

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

◆ DllRegisterServer()

STDAPI DllRegisterServer ( void  )

Definition at line 425 of file shell32.cpp.

426 {
427  HRESULT hr;
428 
430  if (FAILED(hr))
431  return hr;
432 
434  if (FAILED(hr))
435  return hr;
436 
438  if (FAILED(hr))
439  return hr;
440 
441  return S_OK;
442 }
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:77
return TRUE
Definition: shell32.cpp:396
#define S_OK
Definition: intsafe.h:59
CShell32Module gModule
Definition: shell32.cpp:302
#define IDR_FOLDEROPTIONS
Definition: shresdef.h:788
HRESULT SHELL_RegisterShellFolders(void) DECLSPEC_HIDDEN
Definition: shellpath.c:2538

◆ DllUnregisterServer()

STDAPI DllUnregisterServer ( void  )

Definition at line 447 of file shell32.cpp.

448 {
449  HRESULT hr;
450 
452  if (FAILED(hr))
453  return hr;
454 
456  if (FAILED(hr))
457  return hr;
458 
459  return S_OK;
460 }
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:77
return TRUE
Definition: shell32.cpp:396
#define S_OK
Definition: intsafe.h:59
CShell32Module gModule
Definition: shell32.cpp:302
#define IDR_FOLDEROPTIONS
Definition: shresdef.h:788
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 369 of file shell32.cpp.

370  {
372  gModule.Init(ObjectMap, hInstance, &LIBID_Shell32);
373 
375 
376  /* get full path to this DLL for IExtractIconW_fnGetIconLocation() */
378  swShell32Name[MAX_PATH - 1] = '\0';
379 
380  /* Initialize comctl32 */
381  INITCOMMONCONTROLSEX InitCtrls;
382  InitCtrls.dwSize = sizeof(INITCOMMONCONTROLSEX);
384  InitCommonControlsEx(&InitCtrls);
385 
386  /* Bad idea, initialization in DllMain! */
388  }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:607
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
void InitChangeNotifications(void)
Definition: changenotify.c:183
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
CShell32Module gModule
Definition: shell32.cpp:302
HINSTANCE shell32_hInstance
Definition: shell32.cpp:358

◆ 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:398
#define TOKEN_WRITE
Definition: setypes.h:899
BOOL WINAPI CreateEnvironmentBlock(OUT LPVOID *lpEnvironment, IN HANDLE hToken, IN BOOL bInherit)
Definition: environment.c:505
static HANDLE hUserToken
Definition: umpnpmgr.c:67
unsigned int BOOL
Definition: ntddk_ex.h:94
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:201
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1168
return TRUE
Definition: shell32.cpp:396
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(), and CShellBrowser::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:77
#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:91

◆ STDAPI_()

STDAPI_ ( BOOL  )

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ dwReason

DWORD dwReason

Definition at line 366 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:366
DWORD LPVOID fImpLoad
Definition: shell32.cpp:367

Definition at line 367 of file shell32.cpp.

◆ gModule

◆ shell32_hInstance

HINSTANCE shell32_hInstance

Definition at line 358 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(), CNewMenu::CreateNewItem(), 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(), CShellLink::OnCommand(), CDefView::OnCreate(), PickIconDlg(), PickIconProc(), Printer_LoadIconsW(), PropSheetProc(), CDefViewBckgrndMenu::QueryContextMenu(), COpenWithMenu::QueryContextMenu(), CRecycleBin::QueryContextMenu(), CNewMenu::QueryContextMenu(), CRecycleBinItemContextMenu::QueryContextMenu(), CShellLink::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(), SIC_Initialize(), CFileDefExt::UpdateFolderIcon(), and CDefView::UpdateStatusbar().

◆ TRUE

return TRUE

Definition at line 396 of file shell32.cpp.

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