ReactOS 0.4.15-dev-8339-g4028de8
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}
#define MAX_PATH
Definition: compat.h:34
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1665
#define swprintf
Definition: precomp.h:40
INT WINAPI GetNumberFormatW(LCID lcid, DWORD dwFlags, LPCWSTR lpszValue, const NUMBERFMTW *lpFormat, LPWSTR lpNumberStr, int cchOut)
Definition: lcformat.c:1212
#define LOCALE_USER_DEFAULT
#define L(x)
Definition: ntvdm.h:50
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define _countof(array)
Definition: sndvol32.h:70
UINT NumDigits
Definition: winnls.h:642
LPWSTR lpDecimalSep
Definition: winnls.h:645
UINT Grouping
Definition: winnls.h:644
UINT NegativeOrder
Definition: winnls.h:647
LPWSTR lpThousandSep
Definition: winnls.h:646
UINT LeadingZero
Definition: winnls.h:643
#define LOCALE_STHOUSAND
Definition: winnls.h:43
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ DllCanUnloadNow()

STDAPI DllCanUnloadNow ( void  )

Definition at line 407 of file shell32.cpp.

408{
409 return gModule.DllCanUnloadNow();
410}
HRESULT DllCanUnloadNow()
Definition: atlbase.h:1030
CShell32Module gModule
Definition: shell32.cpp:307

◆ DllGetClassObject()

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

Definition at line 416 of file shell32.cpp.

417{
418 HRESULT hResult;
419
420 TRACE("CLSID:%s,IID:%s\n", shdebugstr_guid(&rclsid), shdebugstr_guid(&riid));
421
422 hResult = gModule.DllGetClassObject(rclsid, riid, ppv);
423 TRACE("-- pointer to class factory: %p\n", *ppv);
424 return hResult;
425}
HRESULT DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: atlbase.h:1037
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:428
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define TRACE(s)
Definition: solgame.cpp:4

◆ DllGetVersion()

STDAPI DllGetVersion ( DLLVERSIONINFO pdvi)

Definition at line 326 of file shell32.cpp.

327{
328 /* FIXME: shouldn't these values come from the version resource? */
329 if (pdvi->cbSize == sizeof(DLLVERSIONINFO) ||
330 pdvi->cbSize == sizeof(DLLVERSIONINFO2))
331 {
336 if (pdvi->cbSize == sizeof(DLLVERSIONINFO2))
337 {
338 DLLVERSIONINFO2 *pdvi2 = (DLLVERSIONINFO2 *)pdvi;
339
340 pdvi2->dwFlags = 0;
341 pdvi2->ullVersion = MAKEDLLVERULL(WINE_FILEVERSION_MAJOR,
345 }
346 TRACE("%u.%u.%u.%u\n",
347 pdvi->dwMajorVersion, pdvi->dwMinorVersion,
348 pdvi->dwBuildNumber, pdvi->dwPlatformID);
349 return S_OK;
350 }
351 else
352 {
353 WARN("wrong DLLVERSIONINFO size from app\n");
354 return E_INVALIDARG;
355 }
356}
#define WARN(fmt,...)
Definition: precomp.h:61
#define E_INVALIDARG
Definition: ddrawi.h:101
#define S_OK
Definition: intsafe.h:52
#define WINE_FILEVERSION_MINOR
#define WINE_FILEVERSION_PLATFORMID
#define WINE_FILEVERSION_MAJOR
#define WINE_FILEVERSION_BUILD
#define MAKEDLLVERULL(mjr, mnr, bld, qfe)
Definition: shlwapi.h:1982
DWORD dwMajorVersion
Definition: shlwapi.h:1955
DWORD dwBuildNumber
Definition: shlwapi.h:1957
DWORD dwMinorVersion
Definition: shlwapi.h:1956
DWORD dwPlatformID
Definition: shlwapi.h:1958

◆ DllInstall()

HRESULT WINAPI DllInstall ( BOOL  bInstall,
LPCWSTR  cmdline 
)

Definition at line 476 of file shell32.cpp.

477{
478 FIXME("%s %s: stub\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline));
479 return S_OK; /* indicate success */
480}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define debugstr_w
Definition: kernel32.h:32
TCHAR * cmdline
Definition: stretchblt.cpp:32

◆ DllRegisterServer()

STDAPI DllRegisterServer ( void  )

Definition at line 430 of file shell32.cpp.

431{
432 HRESULT hr;
433
435 if (FAILED(hr))
436 return hr;
437
439 if (FAILED(hr))
440 return hr;
441
443 if (FAILED(hr))
444 return hr;
445
446 return S_OK;
447}
HRESULT WINAPI UpdateRegistryFromResource(LPCTSTR lpszRes, BOOL bRegister, struct _ATL_REGMAP_ENTRY *pMapEntries=NULL)
Definition: atlbase.h:489
HRESULT DllRegisterServer(BOOL bRegTypeLib=TRUE)
Definition: atlbase.h:1042
#define NULL
Definition: types.h:112
#define FAILED(hr)
Definition: intsafe.h:51
return TRUE
Definition: shell32.cpp:401
HRESULT SHELL_RegisterShellFolders(void) DECLSPEC_HIDDEN
Definition: shellpath.c:3064
HRESULT hr
Definition: shlfolder.c:183
#define IDR_FOLDEROPTIONS
Definition: shresdef.h:889

◆ DllUnregisterServer()

STDAPI DllUnregisterServer ( void  )

Definition at line 452 of file shell32.cpp.

453{
454 HRESULT hr;
455
457 if (FAILED(hr))
458 return hr;
459
461 if (FAILED(hr))
462 return hr;
463
464 return S_OK;
465}
HRESULT DllUnregisterServer(BOOL bUnRegTypeLib=TRUE)
Definition: atlbase.h:1047
#define FALSE
Definition: types.h:117

◆ 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 374 of file shell32.cpp.

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

◆ 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}
HANDLE hUserToken
Definition: install.c:39
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:294
#define CloseHandle
Definition: compat.h:739
#define wcschr
Definition: compat.h:17
#define GetCurrentProcess()
Definition: compat.h:759
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableW(IN LPCWSTR lpName, IN LPCWSTR lpValue)
Definition: environ.c:259
BOOL WINAPI CreateEnvironmentBlock(OUT LPVOID *lpEnvironment, IN HANDLE hToken, IN BOOL bInherit)
Definition: environment.c:503
unsigned int BOOL
Definition: ntddk_ex.h:94
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202
#define TOKEN_WRITE
Definition: setypes.h:953
#define TOKEN_READ
Definition: setypes.h:951
WCHAR * LPWSTR
Definition: xmlstorage.h:184

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}
const GUID IID_IClassFactory
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
HRESULT IDefClF_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, const IID *riidInst, IClassFactory **theFactory)
Definition: shell32.cpp:200
int32_t * PLONG
Definition: typedefs.h:58
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ STDAPI_()

STDAPI_ ( BOOL  )

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ dwReason

DWORD dwReason

Definition at line 371 of file shell32.cpp.

◆ fImpLoad

DWORD LPVOID fImpLoad
Initial value:
{
TRACE("%p 0x%x %p\n", hInstance, dwReason, fImpLoad)
DWORD LPVOID fImpLoad
Definition: shell32.cpp:372
DWORD dwReason
Definition: shell32.cpp:371

Definition at line 371 of file shell32.cpp.

◆ gModule

◆ shell32_hInstance

HINSTANCE shell32_hInstance

Definition at line 363 of file shell32.cpp.

Referenced by if().

◆ TRUE

return TRUE

Definition at line 401 of file shell32.cpp.

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