ReactOS  0.4.15-dev-1206-g731eddf
misc.cpp
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Applications Manager
3  * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE: Misc functions
5  * COPYRIGHT: Copyright 2009 Dmitry Chapyshev (dmitry@reactos.org)
6  * Copyright 2015 Ismael Ferreras Morezuelas (swyterzone+ros@gmail.com)
7  * Copyright 2017 Alexander Shaposhnikov (sanchaez@reactos.org)
8  */
9 #include "rapps.h"
10 
11 #include "misc.h"
12 
13 static HANDLE hLog = NULL;
14 
17 
19 {
20  RECT Rect;
21 
23  return (Rect.right - Rect.left);
24 }
25 
27 {
28  RECT Rect;
29 
31  return (Rect.bottom - Rect.top);
32 }
33 
35 {
36  RECT Rect;
37 
39  return (Rect.right - Rect.left);
40 }
41 
43 {
44  RECT Rect;
45 
47  return (Rect.bottom - Rect.top);
48 }
49 
51 {
52  if (!OpenClipboard(NULL))
53  {
54  return;
55  }
56 
57  HRESULT hr;
58  HGLOBAL ClipBuffer;
59  LPWSTR Buffer;
61 
63  cchBuffer = wcslen(lpszText) + 1;
64  ClipBuffer = GlobalAlloc(GMEM_DDESHARE, cchBuffer * sizeof(WCHAR));
65 
66  Buffer = (PWCHAR) GlobalLock(ClipBuffer);
67  hr = StringCchCopyW(Buffer, cchBuffer, lpszText);
68  GlobalUnlock(ClipBuffer);
69 
70  if (SUCCEEDED(hr))
71  SetClipboardData(CF_UNICODETEXT, ClipBuffer);
72 
74 }
75 
76 VOID ShowPopupMenuEx(HWND hwnd, HWND hwndOwner, UINT MenuID, UINT DefaultItem)
77 {
78  HMENU hMenu = NULL;
79  HMENU hPopupMenu;
80  MENUITEMINFO ItemInfo;
81  POINT pt;
82 
83  if (MenuID)
84  {
85  hMenu = LoadMenuW(hInst, MAKEINTRESOURCEW(MenuID));
86  hPopupMenu = GetSubMenu(hMenu, 0);
87  }
88  else
89  {
90  hPopupMenu = GetMenu(hwnd);
91  }
92 
93  ZeroMemory(&ItemInfo, sizeof(ItemInfo));
94  ItemInfo.cbSize = sizeof(ItemInfo);
95  ItemInfo.fMask = MIIM_STATE;
96 
97  GetMenuItemInfoW(hPopupMenu, DefaultItem, FALSE, &ItemInfo);
98 
99  if (!(ItemInfo.fState & MFS_GRAYED))
100  {
101  SetMenuDefaultItem(hPopupMenu, DefaultItem, FALSE);
102  }
103 
104  GetCursorPos(&pt);
105 
107  TrackPopupMenu(hPopupMenu, 0, pt.x, pt.y, 0, hwndOwner, NULL);
108 
109  if (hMenu)
110  {
111  DestroyMenu(hMenu);
112  }
113 }
114 
115 VOID ShowPopupMenu(HWND hwnd, UINT MenuID, UINT DefaultItem)
116 {
117  ShowPopupMenuEx(hwnd, hMainWnd, MenuID, DefaultItem);
118 }
119 
120 
122 {
123  return StartProcess(const_cast<LPWSTR>(Path.GetString()), Wait);;
124 }
125 
127 {
129  STARTUPINFOW si;
130  DWORD dwRet;
131  MSG msg;
132 
133  ZeroMemory(&si, sizeof(si));
134  si.cb = sizeof(si);
136  si.wShowWindow = SW_SHOW;
137 
138  if (!CreateProcessW(NULL, lpPath, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
139  {
140  return FALSE;
141  }
142 
143  CloseHandle(pi.hThread);
144 
145  if (Wait)
146  {
148  }
149 
150  while (Wait)
151  {
152  dwRet = MsgWaitForMultipleObjects(1, &pi.hProcess, FALSE, INFINITE, QS_ALLEVENTS);
153  if (dwRet == WAIT_OBJECT_0 + 1)
154  {
155  while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
156  {
159  }
160  }
161  else
162  {
163  if (dwRet == WAIT_OBJECT_0 || dwRet == WAIT_FAILED)
164  break;
165  }
166  }
167 
168  CloseHandle(pi.hProcess);
169 
170  if (Wait)
171  {
175  }
176 
177  return TRUE;
178 }
179 
181 {
182  LPWSTR DirectoryStr = Directory.GetBuffer(MAX_PATH);
184  {
185  Directory.ReleaseBuffer();
186  return FALSE;
187  }
188 
189  PathAppendW(DirectoryStr, L"rapps");
190  Directory.ReleaseBuffer();
191 
192  return (CreateDirectoryW(Directory.GetString(), NULL) || GetLastError() == ERROR_ALREADY_EXISTS);
193 }
194 
196 {
198  {
199  return;
200  }
201 
203  DWORD dwCategoryNum = 1;
204  DWORD dwDisp, dwData;
206 
207  if (key.Create(HKEY_LOCAL_MACHINE,
208  L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\ReactOS Application Manager",
210  {
211  return;
212  }
213 
215  {
216  return;
217  }
218 
221 
222  if ((key.SetStringValue(L"EventMessageFile",
223  szPath,
225  && (key.SetStringValue(L"CategoryMessageFile",
226  szPath,
228  && (key.SetDWORDValue(L"TypesSupported",
229  dwData) == ERROR_SUCCESS)
230  && (key.SetDWORDValue(L"CategoryCount",
231  dwCategoryNum) == ERROR_SUCCESS))
232 
233  {
234  hLog = RegisterEventSourceW(NULL, L"ReactOS Application Manager");
235  }
236 
237  key.Close();
238 }
239 
240 
242 {
243  if (hLog)
244  {
246  }
247 }
248 
249 
250 BOOL WriteLogMessage(WORD wType, DWORD dwEventID, LPCWSTR lpMsg)
251 {
253  {
254  return TRUE;
255  }
256 
257  if (!ReportEventW(hLog, wType, 0, dwEventID,
258  NULL, 1, 0, &lpMsg, NULL))
259  {
260  return FALSE;
261  }
262 
263  return TRUE;
264 }
265 
267  const ATL::CStringW& szRegName,
268  BOOL IsUserKey,
269  REGSAM keyWow)
270 {
271  BOOL bHasSucceded = FALSE;
274  ATL::CStringW szPath = ATL::CStringW(L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%ls") + szRegName;
275 
276  if (key.Open(IsUserKey ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE,
277  szPath.GetString(),
278  keyWow | KEY_READ) != ERROR_SUCCESS)
279  {
280  return FALSE;
281  }
282 
283  if (szVersionResult != NULL)
284  {
285  ULONG dwSize = MAX_PATH * sizeof(WCHAR);
286 
287  if (key.QueryStringValue(L"DisplayVersion",
288  szVersion.GetBuffer(MAX_PATH),
289  &dwSize) == ERROR_SUCCESS)
290  {
291  szVersion.ReleaseBuffer();
292  *szVersionResult = szVersion;
293  bHasSucceded = TRUE;
294  }
295  else
296  {
297  szVersion.ReleaseBuffer();
298  }
299  }
300  else
301  {
302  bHasSucceded = TRUE;
303  szVersion.ReleaseBuffer();
304  }
305  key.Close();
306 
307  return bHasSucceded;
308 }
309 
310 BOOL GetInstalledVersion(ATL::CStringW *pszVersion, const ATL::CStringW &szRegName)
311 {
312  return (!szRegName.IsEmpty()
313  && (GetInstalledVersion_WowUser(pszVersion, szRegName, TRUE, KEY_WOW64_32KEY)
314  || GetInstalledVersion_WowUser(pszVersion, szRegName, FALSE, KEY_WOW64_32KEY)
315  || GetInstalledVersion_WowUser(pszVersion, szRegName, TRUE, KEY_WOW64_64KEY)
316  || GetInstalledVersion_WowUser(pszVersion, szRegName, FALSE, KEY_WOW64_64KEY)));
317 }
318 
319 // CConfigParser
320 
321 CConfigParser::CConfigParser(const ATL::CStringW& FileName) : szConfigPath(GetINIFullPath(FileName))
322 {
323  CacheINILocale();
324 }
325 
327 {
328  ATL::CStringW szDir;
329  ATL::CStringW szBuffer;
330 
331  GetStorageDirectory(szDir);
332  szBuffer.Format(L"%ls\\rapps\\%ls", szDir.GetString(), FileName.GetString());
333 
334  return szBuffer;
335 }
336 
338 {
339  // TODO: Set default locale if call fails
340  // find out what is the current system lang code (e.g. "0a") and append it to SectionLocale
343 
346 
347  // turn "Section.0c0a" into "Section.0a", keeping just the neutral lang part
348  if (m_szLocaleID.GetLength() >= 2)
350  else
352 }
353 
355 {
356  DWORD dwResult;
357 
358  LPWSTR ResultStringBuffer = ResultString.GetBuffer(MAX_PATH);
359  // 1st - find localized strings (e.g. "Section.0c0a")
361  KeyName.GetString(),
362  NULL,
363  ResultStringBuffer,
364  MAX_PATH,
366 
367  if (!dwResult)
368  {
369  // 2nd - if they weren't present check for neutral sub-langs/ generic translations (e.g. "Section.0a")
371  KeyName.GetString(),
372  NULL,
373  ResultStringBuffer,
374  MAX_PATH,
376  if (!dwResult)
377  {
378  // 3rd - if they weren't present fallback to standard english strings (just "Section")
379  dwResult = GetPrivateProfileStringW(L"Section",
380  KeyName.GetString(),
381  NULL,
382  ResultStringBuffer,
383  MAX_PATH,
385  }
386  }
387 
388  ResultString.ReleaseBuffer();
389  return (dwResult != 0 ? TRUE : FALSE);
390 }
391 
393 {
395 
396  iResult = 0;
397 
398  // grab the text version of our entry
399  if (!GetString(KeyName, Buffer))
400  return FALSE;
401 
402  if (Buffer.IsEmpty())
403  return FALSE;
404 
405  // convert it to an actual integer
406  iResult = StrToIntW(Buffer.GetString());
407 
408  // we only care about values > 0
409  return (iResult > 0);
410 }
411 // CConfigParser
412 
413 
415 {
416  WCHAR pszPathBuffer[MAX_PATH]; // buffer to store result
417  WCHAR pszPathCopy[MAX_PATH];
418 
419  if (!PathCanonicalizeW(pszPathCopy, pszPath))
420  {
421  return FALSE;
422  }
423 
424  PathRemoveBackslashW(pszPathCopy);
425 
426  if (StringCchCopyW(pszPathBuffer, _countof(pszPathBuffer), pszPathCopy) != S_OK)
427  {
428  return FALSE;
429  }
430 
431  if (!PathAppendW(pszPathBuffer, pszMore))
432  {
433  return FALSE;
434  }
435 
436  size_t PathLen;
437  if (StringCchLengthW(pszPathCopy, _countof(pszPathCopy), &PathLen) != S_OK)
438  {
439  return FALSE;
440  }
441  int CommonPrefixLen = PathCommonPrefixW(pszPathCopy, pszPathBuffer, NULL);
442 
443  if ((unsigned int)CommonPrefixLen != PathLen)
444  {
445  // pszPathBuffer should be a file/folder under pszPath.
446  // but now common prefix len is smaller than length of pszPathCopy
447  // hacking use ".." ?
448  return FALSE;
449  }
450 
451  if (StringCchCopyW(pszPath, MAX_PATH, pszPathBuffer) != S_OK)
452  {
453  return FALSE;
454  }
455 
456  return TRUE;
457 }
458 
459 
460 
462 {
464  {
465  // just return cached result
466  return bIsSys64Result;
467  }
468 
469  SYSTEM_INFO si;
470  typedef void (WINAPI *LPFN_PGNSI)(LPSYSTEM_INFO);
471  LPFN_PGNSI pGetNativeSystemInfo = (LPFN_PGNSI)GetProcAddress(GetModuleHandle(L"kernel32.dll"), "GetNativeSystemInfo");
472  if (pGetNativeSystemInfo)
473  {
474  pGetNativeSystemInfo(&si);
476  {
478  }
479  }
480  else
481  {
483  }
484 
485  bIsSys64ResultCached = TRUE; // next time calling this function, it will directly return bIsSys64Result
486  return bIsSys64Result;
487 }
488 
490 {
491  DEVMODEW pDevMode;
492  INT ColorDepth;
493 
494  pDevMode.dmSize = sizeof(pDevMode);
495  pDevMode.dmDriverExtra = 0;
496 
498  {
499  /* TODO: Error message */
500  return ILC_COLOR;
501  }
502 
503  switch (pDevMode.dmBitsPerPel)
504  {
505  case 32: ColorDepth = ILC_COLOR32; break;
506  case 24: ColorDepth = ILC_COLOR24; break;
507  case 16: ColorDepth = ILC_COLOR16; break;
508  case 8: ColorDepth = ILC_COLOR8; break;
509  case 4: ColorDepth = ILC_COLOR4; break;
510  default: ColorDepth = ILC_COLOR; break;
511  }
512 
513  return ColorDepth;
514 }
515 
516 void UnixTimeToFileTime(DWORD dwUnixTime, LPFILETIME pFileTime)
517 {
518  // Note that LONGLONG is a 64-bit value
519  LONGLONG ll;
520 
521  ll = Int32x32To64(dwUnixTime, 10000000) + 116444736000000000;
522  pFileTime->dwLowDateTime = (DWORD)ll;
523  pFileTime->dwHighDateTime = ll >> 32;
524 }
525 
526 BOOL SearchPatternMatch(LPCWSTR szHaystack, LPCWSTR szNeedle)
527 {
528  if (!*szNeedle)
529  return TRUE;
530  /* TODO: Improve pattern search beyond a simple case-insensitive substring search. */
531  return StrStrIW(szHaystack, szNeedle) != NULL;
532 }
int GetLength() const
Definition: atlsimpstr.h:356
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define ILC_COLOR16
Definition: commctrl.h:352
ATL::CStringW GetINIFullPath(const ATL::CStringW &FileName)
Definition: misc.cpp:326
BOOL WINAPI TranslateMessage(_In_ const MSG *)
ATL::CStringW m_szLocaleID
Definition: misc.h:36
INT WINAPI GetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len, LPCWSTR filename)
Definition: profile.c:1142
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define CloseHandle
Definition: compat.h:598
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
static BOOL bIsSys64ResultCached
Definition: misc.cpp:15
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
int WINAPI PathCommonPrefixW(LPCWSTR lpszFile1, LPCWSTR lpszFile2, LPWSTR achPath)
Definition: path.c:2785
static const INT m_cchLocaleSize
Definition: misc.h:34
BOOL WINAPI PathCanonicalizeW(LPWSTR lpszBuf, LPCWSTR lpszPath)
Definition: path.c:2425
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
#define HKEY_CURRENT_USER
Definition: winreg.h:11
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
CStringT Right(int nCount) const
Definition: cstringt.h:703
WORD dmDriverExtra
Definition: wingdi.h:1620
BOOL SearchPatternMatch(LPCWSTR szHaystack, LPCWSTR szNeedle)
Definition: misc.cpp:526
static HANDLE ULONG_PTR dwData
Definition: file.c:35
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
#define ZeroMemory
Definition: winbase.h:1648
ATL::CStringW m_szCachedINISectionLocaleNeutral
Definition: misc.h:38
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:716
HWND WINAPI SetFocus(_In_opt_ HWND)
LCID WINAPI GetUserDefaultLCID(void)
Definition: lang.c:768
BOOL GetInt(const ATL::CStringW &KeyName, INT &iResult)
Definition: misc.cpp:392
#define LOCALE_ILANGUAGE
Definition: winnls.h:25
void UnixTimeToFileTime(DWORD dwUnixTime, LPFILETIME pFileTime)
Definition: misc.cpp:516
uint16_t * PWCHAR
Definition: typedefs.h:56
DWORD dmBitsPerPel
Definition: wingdi.h:1646
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2635
VOID ShowPopupMenuEx(HWND hwnd, HWND hwndOwner, UINT MenuID, UINT DefaultItem)
Definition: misc.cpp:76
#define DWORD
Definition: nt_native.h:44
int32_t INT
Definition: typedefs.h:58
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
#define ENUM_CURRENT_SETTINGS
Definition: winuser.h:179
#define ILC_COLOR4
Definition: commctrl.h:350
BOOL PathAppendNoDirEscapeW(LPWSTR pszPath, LPCWSTR pszMore)
Definition: misc.cpp:414
BOOL IsSystem64Bit()
Definition: misc.cpp:461
BOOL WINAPI PathAppendW(LPWSTR lpszPath, LPCWSTR lpszAppend)
Definition: path.c:121
ATL::CStringW m_szCachedINISectionLocale
Definition: misc.h:37
INT GetWindowHeight(HWND hwnd)
Definition: misc.cpp:26
#define ILC_COLOR32
Definition: commctrl.h:354
#define PROCESSOR_ARCHITECTURE_IA64
Definition: ketypes.h:111
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
DWORD dwHighDateTime
Definition: mapidefs.h:66
INT GetClientWindowWidth(HWND hwnd)
Definition: misc.cpp:34
void ReleaseBuffer(_In_ int nNewLength=-1)
Definition: atlsimpstr.h:372
#define EVENTLOG_ERROR_TYPE
Definition: winnt_old.h:2701
#define FALSE
Definition: types.h:117
INT GetSystemColorDepth()
Definition: misc.cpp:489
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
INT GetClientWindowHeight(HWND hwnd)
Definition: misc.cpp:42
#define MIIM_STATE
Definition: winuser.h:716
unsigned int BOOL
Definition: ntddk_ex.h:94
LPWSTR WINAPI StrStrIW(LPCWSTR lpszStr, LPCWSTR lpszSearch)
Definition: string.c:384
const ATL::CStringW szConfigPath
Definition: misc.h:40
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
static DWORD cchBuffer
Definition: fusion.c:85
#define ILC_COLOR
Definition: commctrl.h:348
VOID InitLogs()
Definition: misc.cpp:195
#define CF_UNICODETEXT
Definition: constants.h:408
smooth NULL
Definition: ftsmooth.c:416
#define QS_ALLEVENTS
Definition: winuser.h:873
Definition: bufpool.h:45
BOOL WINAPI EnumDisplaySettingsW(LPCWSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEW lpDevMode)
Definition: display.c:408
#define STARTF_USESHOWWINDOW
Definition: winbase.h:472
#define SW_SHOW
Definition: winuser.h:769
VOID CacheINILocale()
Definition: misc.cpp:337
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4595
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_WRITE
Definition: nt_native.h:1031
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
int64_t LONGLONG
Definition: typedefs.h:68
static BOOL bIsSys64Result
Definition: misc.cpp:16
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
INT GetWindowWidth(HWND hwnd)
Definition: misc.cpp:18
#define WAIT_OBJECT_0
Definition: winbase.h:387
DWORD cb
Definition: winbase.h:830
#define EVENTLOG_INFORMATION_TYPE
Definition: winnt_old.h:2703
SETTINGS_INFO SettingsInfo
Definition: winmain.cpp:20
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define EVENTLOG_WARNING_TYPE
Definition: winnt_old.h:2702
static refpint_t pi[]
Definition: server.c:96
LONG HRESULT
Definition: typedefs.h:79
#define _countof(array)
Definition: sndvol32.h:68
#define ILC_COLOR24
Definition: commctrl.h:353
#define CSIDL_LOCAL_APPDATA
Definition: shlobj.h:2039
WORD dmSize
Definition: wingdi.h:1619
#define MAX_PATH
Definition: compat.h:34
#define WINAPI
Definition: msvc.h:6
PCXSTR GetString() const
Definition: atlsimpstr.h:361
static HANDLE hLog
Definition: misc.cpp:13
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WAIT_FAILED
Definition: winbase.h:394
#define PROCESSOR_ARCHITECTURE_AMD64
Definition: ketypes.h:114
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
static LPCWSTR szVersion
Definition: asmcache.c:748
HWND hMainWnd
Definition: magnifier.c:32
static const WCHAR L[]
Definition: oid.c:1250
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define MFS_GRAYED
Definition: winuser.h:746
HKEY key
Definition: reg.c:42
WORD wShowWindow
Definition: winbase.h:842
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
BOOL WINAPI ReportEventW(IN HANDLE hEventLog, IN WORD wType, IN WORD wCategory, IN DWORD dwEventID, IN PSID lpUserSid, IN WORD wNumStrings, IN DWORD dwDataSize, IN LPCWSTR *lpStrings, IN LPVOID lpRawData)
Definition: eventlog.c:1516
LPWSTR WINAPI PathRemoveBackslashW(LPWSTR lpszPath)
Definition: path.c:862
VOID CopyTextToClipboard(LPCWSTR lpszText)
Definition: misc.cpp:50
BOOL WINAPI DestroyMenu(_In_ HMENU)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
BOOL WriteLogMessage(WORD wType, DWORD dwEventID, LPCWSTR lpMsg)
Definition: misc.cpp:250
BOOL GetInstalledVersion(ATL::CStringW *pszVersion, const ATL::CStringW &szRegName)
Definition: misc.cpp:310
bool IsEmpty() const
Definition: atlsimpstr.h:379
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define S_OK
Definition: intsafe.h:51
HINSTANCE hInst
Definition: dxdiag.c:13
PRTL_UNICODE_STRING_BUFFER Path
BOOL bLogEnabled
Definition: settings.h:9
#define GetModuleHandle
Definition: winbase.h:3667
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:2709
BOOL StartProcess(ATL::CStringW &Path, BOOL Wait)
Definition: misc.cpp:121
LPCWSTR szPath
Definition: env.c:35
struct _SYSTEM_INFO * LPSYSTEM_INFO
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
ACCESS_MASK REGSAM
Definition: winreg.h:69
BOOL GetString(const ATL::CStringW &KeyName, ATL::CStringW &ResultString)
Definition: misc.cpp:354
w ll
Definition: byte_order.h:166
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI DeregisterEventSource(IN HANDLE hEventLog)
Definition: eventlog.c:473
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
CConfigParser(const ATL::CStringW &FileName="")
Definition: misc.cpp:321
STRSAFEAPI StringCchLengthW(STRSAFE_LPCWSTR psz, size_t cchMax, size_t *pcchLength)
Definition: strsafe.h:842
INT WINAPI StrToIntW(LPCWSTR lpString)
Definition: string.c:411
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
WORD wProcessorArchitecture
Definition: winbase.h:1135
#define GMEM_DDESHARE
Definition: winbase.h:295
BOOL GetStorageDirectory(ATL::CStringW &Directory)
Definition: misc.cpp:180
#define msg(x)
Definition: auth_time.c:54
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
unsigned int ULONG
Definition: retypes.h:1
#define ILC_COLOR8
Definition: commctrl.h:351
base for all directory entries
Definition: entries.h:138
BOOL WINAPI SetForegroundWindow(_In_ HWND)
CAtlStringW CStringW
Definition: atlstr.h:130
#define GetProcAddress(x, y)
Definition: compat.h:612
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
BOOL WINAPI OpenClipboard(_In_opt_ HWND)
DWORD dwFlags
Definition: winbase.h:841
VOID FreeLogs()
Definition: misc.cpp:241
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define PM_REMOVE
Definition: winuser.h:1182
#define REG_NONE
Definition: nt_native.h:1492
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define INFINITE
Definition: serial.h:102
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
HANDLE WINAPI RegisterEventSourceW(IN LPCWSTR lpUNCServerName, IN LPCWSTR lpSourceName)
Definition: eventlog.c:1295
HMENU WINAPI GetMenu(_In_ HWND)
VOID ShowPopupMenu(HWND hwnd, UINT MenuID, UINT DefaultItem)
Definition: misc.cpp:115
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define Int32x32To64(a, b)
DWORD dwLowDateTime
Definition: mapidefs.h:65
struct Rect Rect
#define SUCCEEDED(hr)
Definition: intsafe.h:49
BOOL GetInstalledVersion_WowUser(ATL::CStringW *szVersionResult, const ATL::CStringW &szRegName, BOOL IsUserKey, REGSAM keyWow)
Definition: misc.cpp:266
Definition: path.c:41
IN BOOLEAN Wait
Definition: fatprocs.h:1538
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12