kernel32: Get rid of the last parameter to PROFILE_CopyEntry().
[wine.git] / dlls / shlwapi / shlwapi_main.c
blob04abf30ffc80656ec0445834775e560395d26390
1 /*
2 * SHLWAPI initialisation
4 * Copyright 1998 Marcus Meissner
5 * Copyright 1998 Juergen Schmied (jsch)
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include <stdarg.h>
24 #include "windef.h"
25 #include "winbase.h"
26 #define NO_SHLWAPI_REG
27 #define NO_SHLWAPI_STREAM
28 #include "shlwapi.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(shell);
33 DECLSPEC_HIDDEN HINSTANCE shlwapi_hInstance = 0;
35 /*************************************************************************
36 * SHLWAPI {SHLWAPI}
38 * The Shell Light-Weight API dll provides a large number of utility functions
39 * which are commonly required by Win32 programs. Originally distributed with
40 * Internet Explorer as a free download, it became a core part of Windows when
41 * Internet Explorer was 'integrated' into the O/S with the release of Win98.
43 * All functions exported by ordinal are undocumented by MS. The vast majority
44 * of these are wrappers for Unicode functions that may not exist on early 16
45 * bit platforms. The remainder perform various small tasks and presumably were
46 * added to facilitate code reuse amongst the MS developers.
49 /*************************************************************************
50 * SHLWAPI DllMain
52 * NOTES
53 * calling oleinitialize here breaks some apps.
55 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
57 TRACE("%p 0x%x %p\n", hinstDLL, fdwReason, fImpLoad);
58 switch (fdwReason)
60 case DLL_PROCESS_ATTACH:
61 DisableThreadLibraryCalls(hinstDLL);
62 shlwapi_hInstance = hinstDLL;
63 break;
65 return TRUE;
68 /***********************************************************************
69 * DllGetVersion [SHLWAPI.@]
71 * Retrieve "shlwapi.dll" version information.
73 * PARAMS
74 * pdvi [O] pointer to version information structure.
76 * RETURNS
77 * Success: S_OK. pdvi is updated with the version information
78 * Failure: E_INVALIDARG, if pdvi->cbSize is not set correctly.
80 * NOTES
81 * You may pass either a DLLVERSIONINFO of DLLVERSIONINFO2 structure
82 * as pdvi, provided that the size is set correctly.
83 * Returns version as shlwapi.dll from IE5.01.
85 HRESULT WINAPI DllGetVersion (DLLVERSIONINFO *pdvi)
87 DLLVERSIONINFO2 *pdvi2 = (DLLVERSIONINFO2*)pdvi;
89 TRACE("(%p)\n",pdvi);
91 if (!pdvi)
92 return E_INVALIDARG;
94 switch (pdvi2->info1.cbSize)
96 case sizeof(DLLVERSIONINFO2):
97 pdvi2->dwFlags = 0;
98 pdvi2->ullVersion = MAKEDLLVERULL(6, 0, 2800, 1612);
99 /* Fall through */
100 case sizeof(DLLVERSIONINFO):
101 pdvi2->info1.dwMajorVersion = 6;
102 pdvi2->info1.dwMinorVersion = 0;
103 pdvi2->info1.dwBuildNumber = 2800;
104 pdvi2->info1.dwPlatformID = DLLVER_PLATFORM_WINDOWS;
105 return S_OK;
108 WARN("pdvi->cbSize = %d, unhandled\n", pdvi2->info1.cbSize);
109 return E_INVALIDARG;
112 /*************************************************************************
113 * WhichPlatform() [SHLWAPI.276]
115 UINT WINAPI WhichPlatform(void)
117 static const char szIntegratedBrowser[] = "IntegratedBrowser";
118 static DWORD state = PLATFORM_UNKNOWN;
119 DWORD ret, data, size;
120 HMODULE hshell32;
121 HKEY hKey;
123 if (state)
124 return state;
126 /* If shell32 exports DllGetVersion(), the browser is integrated */
127 state = PLATFORM_BROWSERONLY;
128 hshell32 = LoadLibraryA("shell32.dll");
129 if (hshell32)
131 FARPROC pDllGetVersion;
132 pDllGetVersion = GetProcAddress(hshell32, "DllGetVersion");
133 state = pDllGetVersion ? PLATFORM_INTEGRATED : PLATFORM_BROWSERONLY;
134 FreeLibrary(hshell32);
137 /* Set or delete the key accordingly */
138 ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Internet Explorer", 0, KEY_ALL_ACCESS, &hKey);
139 if (!ret)
141 size = sizeof(data);
142 ret = RegQueryValueExA(hKey, szIntegratedBrowser, 0, 0, (BYTE *)&data, &size);
143 if (!ret && state == PLATFORM_BROWSERONLY)
145 /* Value exists but browser is not integrated */
146 RegDeleteValueA(hKey, szIntegratedBrowser);
148 else if (ret && state == PLATFORM_INTEGRATED)
150 /* Browser is integrated but value does not exist */
151 data = TRUE;
152 RegSetValueExA(hKey, szIntegratedBrowser, 0, REG_DWORD, (BYTE *)&data, sizeof(data));
154 RegCloseKey(hKey);
157 return state;
160 /***********************************************************************
161 * SHGetViewStatePropertyBag [SHLWAPI.515]
163 HRESULT WINAPI SHGetViewStatePropertyBag(PCIDLIST_ABSOLUTE pidl, PCWSTR bag_name, DWORD flags, REFIID riid, void **ppv)
165 FIXME("%p, %s, %#x, %s, %p stub.\n", pidl, debugstr_w(bag_name), flags, debugstr_guid(riid), ppv);
167 return E_NOTIMPL;
170 /*************************************************************************
171 * SHIsLowMemoryMachine [SHLWAPI.@]
173 BOOL WINAPI SHIsLowMemoryMachine(DWORD type)
175 FIXME("%d stub\n", type);
177 return FALSE;