ReactOS 0.4.17-dev-934-g091855f
appcompat.c File Reference
#include "precomp.h"
#include <winreg.h>
#include <winver.h>
#include <commctrl.h>
#include <shlwapi_undoc.h>
Include dependency graph for appcompat.c:

Go to the source code of this file.

Classes

struct  tagFLAGMAP
 
struct  tagAPPCOMPATINFO
 
struct  tagWNDCOMPATINFO
 
struct  tagAPPCOMPATENUM
 
struct  tagLANGANDCODEPAGE
 

Macros

#define MAJOR_VER_ONLY   "\x01"
 
#define PRODUCT_VER_ENGLISH_US_UTF16   "\\StringFileInfo\\040904E4\\ProductVersion"
 
#define PRODUCT_VER_GERMAN_UTF16   "\\StringFileInfo\\040704E4\\ProductVersion"
 
#define PRODUCT_VER_ENGLISH_US_WE   "\\StringFileInfo\\040904B0\\ProductVersion"
 
#define PRODUCT_VER_ENGLISH_US_NEUTRAL   "\\StringFileInfo\\04090000\\ProductVersion"
 
#define PRODUCT_VER_SWEDISH_WE   "\\StringFileInfo\\041D04B0\\ProductVersion"
 
#define SHACF_TO_INIT
 

Typedefs

typedef struct tagFLAGMAP FLAGMAP
 
typedef struct tagFLAGMAP * PFLAGMAP
 
typedef struct tagAPPCOMPATINFO APPCOMPATINFO
 
typedef struct tagAPPCOMPATINFO * PAPPCOMPATINFO
 
typedef struct tagWNDCOMPATINFO WNDCOMPATINFO
 
typedef struct tagWNDCOMPATINFO * PWNDCOMPATINFO
 
typedef struct tagAPPCOMPATENUM APPCOMPATENUM
 
typedef struct tagAPPCOMPATENUM * PAPPCOMPATENUM
 
typedef struct tagLANGANDCODEPAGE LANGANDCODEPAGE
 
typedef struct tagLANGANDCODEPAGE * PLANGANDCODEPAGE
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
static DWORD SHLWAPI_GetMappedFlags (_In_ HKEY hKey, _In_ const FLAGMAP *pEntries, _In_ UINT nEntries)
 
static BOOL CALLBACK SHLWAPI_WndCompatEnumProc (_In_ HWND hWnd, _In_ LPARAM lParam)
 
static HRESULT SHLWAPI_GetModuleVersion (_In_ PCSTR pszFileName, _Out_ PSTR *ppszDest)
 
static BOOL SHLWAPI_DoesModuleVersionMatch (_In_ PCSTR pszFileName, _In_opt_ PCSTR pszVersionPattern)
 
static DWORD SHLWAPI_GetRegistryCompatFlags (_In_ PCSTR pszPath)
 
static DWORD SHLWAPI_InitAppCompat (VOID)
 
DWORD WINAPI SHGetAppCompatFlags (_In_ DWORD dwMask)
 

Variables

static BOOL g_fAppCompatInitialized = FALSE
 
static DWORD g_dwAppCompatFlags = 0
 
static FLAGMAP g_appCompatFlagMaps []
 
static APPCOMPATINFO g_appCompatInfo []
 
static WNDCOMPATINFO g_wndCompatInfo []
 

Macro Definition Documentation

◆ MAJOR_VER_ONLY

#define MAJOR_VER_ONLY   "\x01"

Definition at line 64 of file appcompat.c.

◆ PRODUCT_VER_ENGLISH_US_NEUTRAL

#define PRODUCT_VER_ENGLISH_US_NEUTRAL   "\\StringFileInfo\\04090000\\ProductVersion"

Definition at line 178 of file appcompat.c.

◆ PRODUCT_VER_ENGLISH_US_UTF16

#define PRODUCT_VER_ENGLISH_US_UTF16   "\\StringFileInfo\\040904E4\\ProductVersion"

Definition at line 172 of file appcompat.c.

◆ PRODUCT_VER_ENGLISH_US_WE

#define PRODUCT_VER_ENGLISH_US_WE   "\\StringFileInfo\\040904B0\\ProductVersion"

Definition at line 176 of file appcompat.c.

◆ PRODUCT_VER_GERMAN_UTF16

#define PRODUCT_VER_GERMAN_UTF16   "\\StringFileInfo\\040704E4\\ProductVersion"

Definition at line 174 of file appcompat.c.

◆ PRODUCT_VER_SWEDISH_WE

#define PRODUCT_VER_SWEDISH_WE   "\\StringFileInfo\\041D04B0\\ProductVersion"

Definition at line 180 of file appcompat.c.

◆ SHACF_TO_INIT

#define SHACF_TO_INIT
Value:
( \
)
#define SHACF_OLDREGITEMGDN
#define SHACF_CONTEXTMENU
#define SHACF_LOADCOLUMNHANDLER
#define SHACF_FILEOPENBOGUSCTRLID
#define SHACF_DOCOBJECT
#define SHACF_FILEOPENNEEDSEXT
#define SHACF_FORCELFNIDLIST
#define SHACF_STAROFFICE5PRINTER
#define SHACF_WIN95SHLEXEC
#define SHACF_NOVALIDATEFSIDS
#define SHACF_CORELINTERNETENUM
#define SHACF_MYCOMPUTERFIRST
#define SHACF_ANSIDISPLAYNAMES
#define SHACF_WIN95BINDTOOBJECT
#define SHACF_ANSI
#define SHACF_IGNOREENUMRESET

Definition at line 407 of file appcompat.c.

Typedef Documentation

◆ APPCOMPATENUM

◆ APPCOMPATINFO

◆ FLAGMAP

◆ LANGANDCODEPAGE

◆ PAPPCOMPATENUM

◆ PAPPCOMPATINFO

◆ PFLAGMAP

◆ PLANGANDCODEPAGE

◆ PWNDCOMPATINFO

◆ WNDCOMPATINFO

Function Documentation

◆ SHGetAppCompatFlags()

DWORD WINAPI SHGetAppCompatFlags ( _In_ DWORD  dwMask)

Definition at line 433 of file appcompat.c.

434{
435 TRACE("(0x%lX)\n", dwMask);
436
437 // Initialize and retrieve flags if necessary
438 if (dwMask & SHACF_TO_INIT)
439 {
441 {
442 DWORD dwAppCompatFlags = SHLWAPI_InitAppCompat();
443 InterlockedExchange((PLONG)&g_dwAppCompatFlags, dwAppCompatFlags);
444
445 g_fAppCompatInitialized = TRUE; // Mark as initialized
446 }
447 }
448
449 // Retrieve additional flags if necessary
450 DWORD dwAppCompatFlags = g_dwAppCompatFlags;
451 if (dwAppCompatFlags && (dwMask & (SHACF_UNKNOWN1 | SHACF_UNKNOWN2)))
452 {
453 // Find the target window and its flags using g_wndCompatInfo
455 {
457 };
459
460 // Add the target flags if a match is found
461 if (data.iFound >= 0)
462 dwAppCompatFlags |= g_wndCompatInfo[data.iFound].dwCompatFlags;
463
464 dwAppCompatFlags |= SHACF_UNKNOWN3;
465
466 InterlockedExchange((PLONG)&g_dwAppCompatFlags, dwAppCompatFlags);
467 }
468
469 return dwAppCompatFlags;
470}
#define InterlockedExchange
Definition: armddk.h:54
#define TRUE
Definition: types.h:120
static WNDCOMPATINFO g_wndCompatInfo[]
Definition: appcompat.c:119
static DWORD SHLWAPI_InitAppCompat(VOID)
Definition: appcompat.c:374
static BOOL CALLBACK SHLWAPI_WndCompatEnumProc(_In_ HWND hWnd, _In_ LPARAM lParam)
Definition: appcompat.c:136
static DWORD g_dwAppCompatFlags
Definition: appcompat.c:19
#define SHACF_TO_INIT
Definition: appcompat.c:407
static BOOL g_fAppCompatInitialized
Definition: appcompat.c:17
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LONG_PTR LPARAM
Definition: minwindef.h:175
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)
#define SHACF_UNKNOWN1
#define SHACF_UNKNOWN3
#define SHACF_UNKNOWN2
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwCompatFlags
Definition: appcompat.c:117
int32_t * PLONG
Definition: typedefs.h:58
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1205

Referenced by ShellExecuteA(), and ShellExecuteW().

◆ SHLWAPI_DoesModuleVersionMatch()

static BOOL SHLWAPI_DoesModuleVersionMatch ( _In_ PCSTR  pszFileName,
_In_opt_ PCSTR  pszVersionPattern 
)
static

Definition at line 250 of file appcompat.c.

251{
252 if (!pszVersionPattern)
253 return TRUE;
254
255 PSTR pszModuleVersion = NULL;
256 HRESULT hr = SHLWAPI_GetModuleVersion(pszFileName, &pszModuleVersion);
257 if (FAILED(hr))
258 return FALSE;
259
260 BOOL ret = FALSE;
261 if (pszVersionPattern[0] == MAJOR_VER_ONLY[0]) // Special handling for major version only
262 {
263 // Truncate at comma (',') if present
264 PSTR pchComma = StrChrA(pszModuleVersion, ',');
265 if (pchComma)
266 *pchComma = ANSI_NULL;
267
268 // Truncate at dot ('.') if present
269 PSTR pchDot = StrChrA(pszModuleVersion, '.');
270 if (pchDot)
271 *pchDot = ANSI_NULL;
272
273 ret = (lstrcmpiA(pszModuleVersion, &pszVersionPattern[1]) == 0);
274 }
275 else // Otherwise, perform a normal match
276 {
277 PSTR pchAsterisk = StrChrA(pszVersionPattern, '*'); // Find an asterisk ('*')
278 if (pchAsterisk) // Asterisk found
279 {
280 // Check for a match, ignoring the substring after '*'
281 INT cchPrefix = (INT)(pchAsterisk - pszVersionPattern);
282 if (cchPrefix > 0)
283 ret = (StrCmpNIA(pszModuleVersion, pszVersionPattern, cchPrefix) == 0);
284 }
285
286 if (!ret)
287 ret = (lstrcmpiA(pszModuleVersion, pszVersionPattern) == 0); // Full match
288 }
289
290 LocalFree(pszModuleVersion);
291 return ret;
292}
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
INT WINAPI StrCmpNIA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
Definition: string.c:296
LPSTR WINAPI StrChrA(LPCSTR lpszStr, WORD ch)
Definition: string.c:266
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4133
static HRESULT SHLWAPI_GetModuleVersion(_In_ PCSTR pszFileName, _Out_ PSTR *ppszDest)
Definition: appcompat.c:189
#define MAJOR_VER_ONLY
Definition: appcompat.c:64
return ret
Definition: mutex.c:147
unsigned int BOOL
Definition: ntddk_ex.h:94
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define FAILED(hr)
Definition: intsafe.h:51
#define ANSI_NULL
#define INT
Definition: polytest.cpp:20
char * PSTR
Definition: typedefs.h:51
int32_t INT
Definition: typedefs.h:58
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:44

Referenced by SHLWAPI_GetRegistryCompatFlags(), and SHLWAPI_InitAppCompat().

◆ SHLWAPI_GetMappedFlags()

static DWORD SHLWAPI_GetMappedFlags ( _In_ HKEY  hKey,
_In_ const FLAGMAP *  pEntries,
_In_ UINT  nEntries 
)
static

Definition at line 52 of file appcompat.c.

53{
54 DWORD flags = 0;
55 for (UINT iEntry = 0; iEntry < nEntries; ++iEntry)
56 {
57 DWORD error = SHGetValueA(hKey, NULL, pEntries[iEntry].name, NULL, NULL, NULL);
58 if (error == ERROR_SUCCESS)
59 flags |= pEntries[iEntry].flags;
60 }
61 return flags;
62}
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI SHGetValueA(HKEY hkey, const char *subkey, const char *value, DWORD *type, void *data, DWORD *data_len)
Definition: main.c:2197
FxAutoRegKey hKey
GLbitfield flags
Definition: glext.h:7161
unsigned int UINT
Definition: sysinfo.c:13
#define error(str)
Definition: mkdosfs.c:1605
Definition: name.c:39

Referenced by SHLWAPI_GetRegistryCompatFlags().

◆ SHLWAPI_GetModuleVersion()

static HRESULT SHLWAPI_GetModuleVersion ( _In_ PCSTR  pszFileName,
_Out_ PSTR *  ppszDest 
)
static

Definition at line 189 of file appcompat.c.

190{
191 DWORD dwHandle;
192 PBYTE pbData;
194
195 *ppszDest = NULL;
196
197 // Obtain the version info
199 if (!size)
200 {
201 TRACE("No version info\n");
202 return E_FAIL;
203 }
204 pbData = (PBYTE)LocalAlloc(LPTR, size);
205 if (!pbData)
206 {
207 ERR("E_OUTOFMEMORY\n");
208 return E_OUTOFMEMORY;
209 }
210 GetFileVersionInfoA(pszFileName, dwHandle, size, pbData);
211
212 // Getting the product version
213 HRESULT hr = E_FAIL;
219 {
220 // NOTE: *ppszDest must be freed using LocalFree later
221 *ppszDest = StrDupA((PSTR)pvData);
222 hr = *ppszDest ? S_OK : E_OUTOFMEMORY;
223 }
224 else if (VerQueryValueA(pbData, "\\VarFileInfo\\Translation", &pvData, &size))
225 {
226 PVOID pDataSaved = pvData;
228 for (; (PBYTE)pEntry + sizeof(LANGANDCODEPAGE) <= (PBYTE)pDataSaved + size; ++pEntry)
229 {
231 wnsprintfA(szPath, _countof(szPath), "\\StringFileInfo\\%04X%04X\\ProductVersion",
232 pEntry->wLanguage, pEntry->wCodePage);
233 if (VerQueryValueA(pbData, szPath, &pvData, &size) && size)
234 {
235 // NOTE: *ppszDest must be freed using LocalFree later
236 *ppszDest = StrDupA((PSTR)pvData);
237 hr = *ppszDest ? S_OK : E_OUTOFMEMORY;
238 }
239 }
240 }
241
242 if (FAILED(hr))
243 WARN("hr: 0x%lX\n", hr);
244
245 LocalFree(pbData);
246 return hr;
247}
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_FAIL
Definition: ddrawi.h:102
#define MAX_PATH
Definition: compat.h:34
char *WINAPI StrDupA(const char *str)
Definition: string.c:292
DWORD WINAPI GetFileVersionInfoSizeA(LPCSTR filename, LPDWORD handle)
Definition: version.c:746
BOOL WINAPI VerQueryValueA(LPCVOID pBlock, LPCSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition: version.c:1115
BOOL WINAPI GetFileVersionInfoA(LPCSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: version.c:975
#define PRODUCT_VER_SWEDISH_WE
Definition: appcompat.c:180
#define PRODUCT_VER_ENGLISH_US_WE
Definition: appcompat.c:176
#define PRODUCT_VER_ENGLISH_US_UTF16
Definition: appcompat.c:172
#define PRODUCT_VER_ENGLISH_US_NEUTRAL
Definition: appcompat.c:178
struct tagLANGANDCODEPAGE * PLANGANDCODEPAGE
#define PRODUCT_VER_GERMAN_UTF16
Definition: appcompat.c:174
int WINAPIV wnsprintfA(LPSTR lpOut, int cchLimitIn, LPCSTR lpFmt,...)
Definition: wsprintf.c:547
PLIST_ENTRY pEntry
Definition: fxioqueue.cpp:4484
GLsizeiptr size
Definition: glext.h:5919
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
#define S_OK
Definition: intsafe.h:52
#define LPTR
Definition: minwinbase.h:93
LPCWSTR szPath
Definition: env.c:37
_In_ LPWSTR _In_ DWORD _In_ LPCVOID pvData
Definition: netsh.h:116
BYTE * PBYTE
Definition: pedump.c:66
char CHAR
Definition: pedump.c:57

Referenced by SHLWAPI_DoesModuleVersionMatch().

◆ SHLWAPI_GetRegistryCompatFlags()

static DWORD SHLWAPI_GetRegistryCompatFlags ( _In_ PCSTR  pszPath)
static

Definition at line 295 of file appcompat.c.

296{
297 // Build the path to the "application compatibility" registry key
298 CHAR szText[MAX_PATH];
299 wnsprintfA(szText, _countof(szText),
300 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ShellCompatibility\\Applications\\%s",
301 PathFindFileNameA(pszPath));
302
303 // Open the key
304 HKEY hKey;
305 const REGSAM samDesired = KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS;
306 LSTATUS error = RegOpenKeyExA(HKEY_LOCAL_MACHINE, szText, 0, samDesired, &hKey);
307 if (error != ERROR_SUCCESS)
308 {
309 ERR("error: %lu\n", error);
310 return 0; // Failed
311 }
312
313 // Build the base directory
314 CHAR szBaseDir[MAX_PATH];
315 lstrcpynA(szBaseDir, pszPath, _countof(szBaseDir));
316 PathRemoveFileSpecA(szBaseDir);
317
318 // Search from the registry key
319 DWORD dwCompatFlags = 0;
320 szText[0] = ANSI_NULL; // The first attempt is for the non-subkey path
321 for (DWORD dwIndex = 0; error == ERROR_SUCCESS;)
322 {
323 HKEY hSubKey;
324 error = RegOpenKeyExA(hKey, szText, 0, KEY_QUERY_VALUE, &hSubKey);
325 if (error != ERROR_SUCCESS)
326 break;
327
328 // Get the "RequiredFile" value
329 CHAR szRequired[MAX_PATH];
330 DWORD cbData = sizeof(szRequired);
331 error = SHGetValueA(hSubKey, NULL, "RequiredFile", NULL, szRequired, &cbData);
332 BOOL bValueExists = (error == ERROR_SUCCESS);
333 BOOL bRequiredFileExists = FALSE;
334 if (bValueExists) // Does the "RequiredFile" value exist?
335 {
336 // Build required file path to szText
337 PathCombineA(szText, szBaseDir, szRequired);
338 TRACE("RequiredFile: %s\n", wine_dbgstr_a(szRequired));
339 TRACE("szText: %s\n", wine_dbgstr_a(szText));
340 // Now szText is a full path
341 bRequiredFileExists = (GetFileAttributesA(szText) != INVALID_FILE_ATTRIBUTES);
342 }
343
344 // If the "RequiredFile" value doesn't exist, or the file specified by szText exists:
345 if (!bValueExists || bRequiredFileExists)
346 {
347 // Check the "Version" value if necessary
348 error = SHGetValueA(hSubKey, NULL, "Version", NULL, szText, &cbData);
349 PCSTR pszVersionPattern = ((error == ERROR_SUCCESS) ? szText : NULL);
350 TRACE("pszVersionPattern: %s\n", wine_dbgstr_a(pszVersionPattern));
351
352 // Does the pattern match?
353 if (SHLWAPI_DoesModuleVersionMatch(pszPath, pszVersionPattern))
354 {
355 // Add additional flags from the registry key
356 dwCompatFlags |= SHLWAPI_GetMappedFlags(hSubKey, g_appCompatFlagMaps,
358 }
359 }
360
361 RegCloseKey(hSubKey);
362
363 // Go to the next sub-key
364 ++dwIndex;
365 error = RegEnumKeyA(hKey, dwIndex, szText, _countof(szText));
366 }
367
369
370 return dwCompatFlags;
371}
#define RegCloseKey(hKey)
Definition: registry.h:49
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3298
LONG WINAPI RegEnumKeyA(HKEY hKey, DWORD dwIndex, LPSTR lpName, DWORD cbName)
Definition: reg.c:2368
#define lstrcpynA
Definition: compat.h:751
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:620
BOOL WINAPI PathRemoveFileSpecA(char *path)
Definition: path.c:1084
char *WINAPI PathFindFileNameA(const char *path)
Definition: path.c:1660
static BOOL SHLWAPI_DoesModuleVersionMatch(_In_ PCSTR pszFileName, _In_opt_ PCSTR pszVersionPattern)
Definition: appcompat.c:250
static DWORD SHLWAPI_GetMappedFlags(_In_ HKEY hKey, _In_ const FLAGMAP *pEntries, _In_ UINT nEntries)
Definition: appcompat.c:52
static FLAGMAP g_appCompatFlagMaps[]
Definition: appcompat.c:27
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1022
#define PathCombineA
Definition: pathcch.h:317
_In_opt_ _In_opt_ _In_ _In_ DWORD cbData
Definition: shlwapi.h:761
int int static __inline const char * wine_dbgstr_a(const char *s)
Definition: debug.h:160
const char * PCSTR
Definition: typedefs.h:52
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
ACCESS_MASK REGSAM
Definition: winreg.h:76

Referenced by SHLWAPI_InitAppCompat().

◆ SHLWAPI_InitAppCompat()

static DWORD SHLWAPI_InitAppCompat ( VOID  )
static

Definition at line 374 of file appcompat.c.

375{
376 if (GetProcessVersion(0) >= MAKELONG(0, 5))
377 return 0; // Flags are not needed
378
379 // Get module pathname
380 CHAR szModulePathA[MAX_PATH];
381 if (!GetModuleFileNameA(NULL, szModulePathA, _countof(szModulePathA)))
382 return 0;
383
384 PCSTR pszFileName = PathFindFileNameA(szModulePathA); // Get the file title from the path
385
386 // Search the file title from g_appCompatInfo
387 DWORD dwAppCompatFlags = 0;
388 for (UINT iItem = 0; iItem < _countof(g_appCompatInfo); ++iItem)
389 {
390 const APPCOMPATINFO *pInfo = &g_appCompatInfo[iItem];
391 if (lstrcmpiA(pInfo->pszAppName, pszFileName) == 0 &&
393 {
394 // Found, set the flags
395 dwAppCompatFlags = g_appCompatInfo[iItem].dwCompatFlags;
396 break;
397 }
398 }
399
400 // Add additional flags from the registry
401 dwAppCompatFlags |= SHLWAPI_GetRegistryCompatFlags(pszFileName);
402
403 return dwAppCompatFlags;
404}
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:539
DWORD WINAPI GetProcessVersion(IN DWORD ProcessId)
Definition: proc.c:1659
static DWORD SHLWAPI_GetRegistryCompatFlags(_In_ PCSTR pszPath)
Definition: appcompat.c:295
static APPCOMPATINFO g_appCompatInfo[]
Definition: appcompat.c:74
DWORD dwCompatFlags
Definition: appcompat.c:72
PCSTR pszAppName
Definition: appcompat.c:70
PCSTR pszAppVersion
Definition: appcompat.c:71
#define MAKELONG(a, b)
Definition: typedefs.h:249

Referenced by SHGetAppCompatFlags().

◆ SHLWAPI_WndCompatEnumProc()

static BOOL CALLBACK SHLWAPI_WndCompatEnumProc ( _In_ HWND  hWnd,
_In_ LPARAM  lParam 
)
static

Definition at line 136 of file appcompat.c.

137{
139
140 CHAR szClass[256];
141 if (!pEnum->nItems || !GetClassNameA(hWnd, szClass, _countof(szClass)))
142 return TRUE; // Ignore and continue
143
144 // Search for the target window in pEnum
145 const INT cchClass = lstrlenA(szClass);
146 for (UINT iItem = 0; iItem < pEnum->nItems; ++iItem)
147 {
148 PCSTR pszLengthAndClassName = pEnum->pItems[iItem].pszLengthAndClassName;
149
150 INT cchLength = pszLengthAndClassName[0]; // The first byte represents the length
151 if (cchClass < cchLength)
152 cchLength = cchClass; // Ignore trailing characters
153
154 // Compare the string
155 if (StrCmpNA(szClass, &pszLengthAndClassName[1], cchLength) == 0) // Class name matched
156 {
157 // Get the process ID
160 if (dwProcessId == pEnum->dwProcessId) // Same process
161 {
162 pEnum->iFound = iItem; // Found
163 return FALSE; // Quit enumeration
164 }
165 }
166 }
167
168 return TRUE; // Continue enumeration
169}
HWND hWnd
Definition: settings.c:17
LPARAM lParam
Definition: combotst.c:139
INT WINAPI StrCmpNA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
Definition: string.c:489
struct tagAPPCOMPATENUM * PAPPCOMPATENUM
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
_In_ DWORD dwProcessId
Definition: shlwapi.h:193
int WINAPI GetClassNameA(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPSTR lpClassName, _In_ int nMaxCount)
PWNDCOMPATINFO pItems
Definition: appcompat.c:129
PCSTR pszLengthAndClassName
Definition: appcompat.c:116
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)

Referenced by SHGetAppCompatFlags().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ g_appCompatFlagMaps

FLAGMAP g_appCompatFlagMaps[]
static
Initial value:
=
{
{ SHACF_CONTEXTMENU, "CONTEXTMENU" },
{ SHACF_CORELINTERNETENUM, "CORELINTERNETENUM" },
{ SHACF_OLDCREATEVIEWWND, "OLDCREATEVIEWWND" },
{ SHACF_WIN95DEFVIEW, "WIN95DEFVIEW" },
{ SHACF_DOCOBJECT, "DOCOBJECT" },
{ SHACF_FLUSHNOWAITALWAYS, "FLUSHNOWAITALWAYS" },
{ SHACF_MYCOMPUTERFIRST, "MYCOMPUTERFIRST" },
{ SHACF_OLDREGITEMGDN, "OLDREGITEMGDN" },
{ SHACF_LOADCOLUMNHANDLER, "LOADCOLUMNHANDLER" },
{ SHACF_ANSI, "ANSI" },
{ SHACF_STAROFFICE5PRINTER, "STAROFFICE5PRINTER" },
{ SHACF_NOVALIDATEFSIDS, "NOVALIDATEFSIDS" },
{ SHACF_WIN95SHLEXEC, "WIN95SHLEXEC" },
{ SHACF_FILEOPENNEEDSEXT, "FILEOPENNEEDSEXT" },
{ SHACF_WIN95BINDTOOBJECT, "WIN95BINDTOOBJECT" },
{ SHACF_IGNOREENUMRESET, "IGNOREENUMRESET" },
{ SHACF_ANSIDISPLAYNAMES, "ANSIDISPLAYNAMES" },
{ SHACF_FILEOPENBOGUSCTRLID, "FILEOPENBOGUSCTRLID" },
{ SHACF_FORCELFNIDLIST, "FORCELFNIDLIST" },
}
#define SHACF_WIN95DEFVIEW
#define SHACF_FLUSHNOWAITALWAYS
#define SHACF_OLDCREATEVIEWWND

Definition at line 27 of file appcompat.c.

Referenced by SHLWAPI_GetRegistryCompatFlags().

◆ g_appCompatInfo

APPCOMPATINFO g_appCompatInfo[]
static

Definition at line 74 of file appcompat.c.

Referenced by SHLWAPI_InitAppCompat().

◆ g_dwAppCompatFlags

DWORD g_dwAppCompatFlags = 0
static

Definition at line 19 of file appcompat.c.

Referenced by SHGetAppCompatFlags().

◆ g_fAppCompatInitialized

BOOL g_fAppCompatInitialized = FALSE
static

Definition at line 17 of file appcompat.c.

Referenced by SHGetAppCompatFlags().

◆ g_wndCompatInfo

WNDCOMPATINFO g_wndCompatInfo[]
static
Initial value:
=
{
{ "\x09" "bosa_sdm_", SHACF_UNKNOWN1 | SHACF_UNKNOWN2 },
{ "\x18" "File Open Message Window", SHACF_UNKNOWN1 | SHACF_UNKNOWN2 },
}

Definition at line 119 of file appcompat.c.

Referenced by SHGetAppCompatFlags().