ReactOS 0.4.16-dev-1067-ge98bba2
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)
 
static HRESULT UpdateRegistryFromResource (BOOL Register)
 
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}
wcscpy
#define MAX_PATH
Definition: compat.h:34
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1666
#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:1208
#define LOCALE_USER_DEFAULT
#define L(x)
Definition: ntvdm.h:50
#define _countof(array)
Definition: sndvol32.h:70
UINT NumDigits
Definition: winnls.h:644
LPWSTR lpDecimalSep
Definition: winnls.h:647
UINT Grouping
Definition: winnls.h:646
UINT NegativeOrder
Definition: winnls.h:649
LPWSTR lpThousandSep
Definition: winnls.h:648
UINT LeadingZero
Definition: winnls.h:645
#define LOCALE_STHOUSAND
Definition: winnls.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ DllCanUnloadNow()

STDAPI DllCanUnloadNow ( void  )

Definition at line 409 of file shell32.cpp.

410{
411 return gModule.DllCanUnloadNow();
412}
HRESULT DllCanUnloadNow()
Definition: atlbase.h:1030
CShell32Module gModule
Definition: shell32.cpp:309

◆ DllGetClassObject()

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

Definition at line 418 of file shell32.cpp.

419{
420 HRESULT hResult;
421
422 TRACE("CLSID:%s,IID:%s\n", shdebugstr_guid(&rclsid), shdebugstr_guid(&riid));
423
424 hResult = gModule.DllGetClassObject(rclsid, riid, ppv);
425 TRACE("-- pointer to class factory: %p\n", *ppv);
426 return hResult;
427}
HRESULT DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: atlbase.h:1037
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:438
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 328 of file shell32.cpp.

329{
330 /* FIXME: shouldn't these values come from the version resource? */
331 if (pdvi->cbSize == sizeof(DLLVERSIONINFO) ||
332 pdvi->cbSize == sizeof(DLLVERSIONINFO2))
333 {
338 if (pdvi->cbSize == sizeof(DLLVERSIONINFO2))
339 {
340 DLLVERSIONINFO2 *pdvi2 = (DLLVERSIONINFO2 *)pdvi;
341
342 pdvi2->dwFlags = 0;
343 pdvi2->ullVersion = MAKEDLLVERULL(WINE_FILEVERSION_MAJOR,
347 }
348 TRACE("%u.%u.%u.%u\n",
349 pdvi->dwMajorVersion, pdvi->dwMinorVersion,
350 pdvi->dwBuildNumber, pdvi->dwPlatformID);
351 return S_OK;
352 }
353 else
354 {
355 WARN("wrong DLLVERSIONINFO size from app\n");
356 return E_INVALIDARG;
357 }
358}
#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:2027
DWORD dwMajorVersion
Definition: shlwapi.h:2000
DWORD dwBuildNumber
Definition: shlwapi.h:2002
DWORD dwMinorVersion
Definition: shlwapi.h:2001
DWORD dwPlatformID
Definition: shlwapi.h:2003

◆ DllInstall()

HRESULT WINAPI DllInstall ( BOOL  bInstall,
LPCWSTR  cmdline 
)

Definition at line 489 of file shell32.cpp.

490{
491 FIXME("%s %s: stub\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline));
492 return S_OK; /* indicate success */
493}
#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 445 of file shell32.cpp.

446{
447 HRESULT hr;
448
450 if (FAILED(hr))
451 return hr;
452
454 return hr;
455
457 if (FAILED(hr))
458 return hr;
459
460 return S_OK;
461}
HRESULT DllRegisterServer(BOOL bRegTypeLib=TRUE)
Definition: atlbase.h:1042
#define FAILED(hr)
Definition: intsafe.h:51
return TRUE
Definition: shell32.cpp:403
static HRESULT UpdateRegistryFromResource(BOOL Register)
Definition: shell32.cpp:429
HRESULT SHELL_RegisterShellFolders(void) DECLSPEC_HIDDEN
Definition: shellpath.c:3191
HRESULT hr
Definition: shlfolder.c:183

◆ DllUnregisterServer()

STDAPI DllUnregisterServer ( void  )

Definition at line 466 of file shell32.cpp.

467{
468 HRESULT hr;
469
471 if (FAILED(hr))
472 return hr;
473
475 return hr;
476
477 return S_OK;
478}
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 376 of file shell32.cpp.

377 {
379 gModule.Init(ObjectMap, hInstance, &LIBID_Shell32);
380
382
383 /* get full path to this DLL for IExtractIconW_fnGetIconLocation() */
385 swShell32Name[MAX_PATH - 1] = '\0';
386
387 /* Initialize comctl32 */
388 INITCOMMONCONTROLSEX InitCtrls;
389 InitCtrls.dwSize = sizeof(INITCOMMONCONTROLSEX);
391 InitCommonControlsEx(&InitCtrls);
392
393 /* Bad idea, initialization in DllMain! */
395 }
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:900
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:365

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

◆ UpdateRegistryFromResource()

static HRESULT UpdateRegistryFromResource ( BOOL  Register)
static

Definition at line 429 of file shell32.cpp.

430{
431 static const BYTE resid[] =
432 {
435 };
436 HRESULT hr = S_OK;
437 for (SIZE_T i = 0; i < _countof(resid) && SUCCEEDED(hr); ++i)
439 return hr;
440}
HRESULT WINAPI UpdateRegistryFromResource(LPCTSTR lpszRes, BOOL bRegister, struct _ATL_REGMAP_ENTRY *pMapEntries=NULL)
Definition: atlbase.h:489
#define NULL
Definition: types.h:112
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define IDR_EXPLORER
Definition: shresdef.h:944
#define IDR_FOLDEROPTIONS
Definition: shresdef.h:913
ULONG_PTR SIZE_T
Definition: typedefs.h:80
unsigned char BYTE
Definition: xxhash.c:193

Referenced by DllRegisterServer(), and DllUnregisterServer().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ dwReason

DWORD dwReason

Definition at line 373 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:374
DWORD dwReason
Definition: shell32.cpp:373

Definition at line 373 of file shell32.cpp.

◆ gModule

◆ shell32_hInstance

HINSTANCE shell32_hInstance

Definition at line 365 of file shell32.cpp.

Referenced by if().

◆ TRUE

return TRUE

Definition at line 403 of file shell32.cpp.

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