ReactOS  0.4.11-dev-946-g431643b
winmain.h File Reference
#include <windef.h>
Include dependency graph for winmain.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SETTINGS_INFO
 

Typedefs

typedef SETTINGS_INFOPSETTINGS_INFO
 

Functions

VOID SaveSettings (HWND hwnd)
 
VOID FillDefaultSettings (PSETTINGS_INFO pSettingsInfo)
 
BOOL VerifyInteg (LPCWSTR lpSHA1Hash, LPCWSTR lpFileName)
 

Variables

HWND hMainWnd
 
HINSTANCE hInst
 
INT SelectedEnumType
 
SETTINGS_INFO SettingsInfo
 

Typedef Documentation

◆ PSETTINGS_INFO

Definition at line 24 of file winmain.h.

Function Documentation

◆ FillDefaultSettings()

VOID FillDefaultSettings ( PSETTINGS_INFO  pSettingsInfo)

Definition at line 46 of file winmain.cpp.

Referenced by anonymous_namespace{settingsdlg.cpp}::SettingsDlgProc(), and wWinMain().

47 {
48  ATL::CStringW szDownloadDir;
49  ZeroMemory(pSettingsInfo, sizeof(SETTINGS_INFO));
50 
51  pSettingsInfo->bSaveWndPos = TRUE;
52  pSettingsInfo->bUpdateAtStart = FALSE;
53  pSettingsInfo->bLogEnabled = TRUE;
54 
56  {
57  szDownloadDir.ReleaseBuffer();
58  if (!szDownloadDir.GetEnvironmentVariableW(L"SystemDrive"))
59  {
60  szDownloadDir = L"C:";
61  }
62  }
63  else
64  {
65  szDownloadDir.ReleaseBuffer();
66  }
67 
68  szDownloadDir += L"\\RAPPS Downloads";
70  _countof(pSettingsInfo->szDownloadDir),
71  szDownloadDir.GetString(),
72  szDownloadDir.GetLength() + 1);
73 
74  pSettingsInfo->bDelInstaller = FALSE;
75  pSettingsInfo->Maximized = FALSE;
76  pSettingsInfo->Left = CW_USEDEFAULT;
77  pSettingsInfo->Top = CW_USEDEFAULT;
78  pSettingsInfo->Width = 680;
79  pSettingsInfo->Height = 450;
80 }
int GetLength() const
Definition: atlsimpstr.h:356
BOOL bUpdateAtStart
Definition: winmain.h:8
#define TRUE
Definition: types.h:120
#define _countof(array)
Definition: fontsub.cpp:30
INT Height
Definition: winmain.h:17
#define ZeroMemory
Definition: winbase.h:1635
BOOL Maximized
Definition: winmain.h:13
WCHAR szDownloadDir[MAX_PATH]
Definition: winmain.h:10
void ReleaseBuffer(_In_ int nNewLength=-1)
Definition: atlsimpstr.h:372
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
#define MAX_PATH
Definition: compat.h:26
PCXSTR GetString() const
Definition: atlsimpstr.h:361
static const WCHAR L[]
Definition: oid.c:1087
BOOL bLogEnabled
Definition: winmain.h:9
static void __cdecl CopyChars(_Out_writes_to_(nDestLen, nChars) XCHAR *pchDest, _In_ size_t nDestLen, _In_reads_opt_(nChars) const XCHAR *pchSrc, _In_ int nChars)
Definition: atlsimpstr.h:423
BOOL bDelInstaller
Definition: winmain.h:11
#define CSIDL_PERSONAL
Definition: shlobj.h:1881
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2085
BOOL bSaveWndPos
Definition: winmain.h:7

◆ SaveSettings()

VOID SaveSettings ( HWND  hwnd)

Definition at line 113 of file settings.c.

114 {
115  HKEY hKey = NULL;
116 
118  {
119  TCHAR szBuffer[MAX_PATH];
120 
122  ComboBox_GetText(hWnd, szBuffer, MAX_PATH);
123 
124  if(*szBuffer != '\0')
125  RegSetValueEx(hKey, _T("Font"), 0, REG_SZ, (LPBYTE) szBuffer, (DWORD) MAX_PATH);
126 
128  ComboBox_GetText(hWnd, szBuffer, MAX_PATH);
129 
130  if(*szBuffer != '\0')
131  RegSetValueEx(hKey, _T("CodePage"), 0, REG_SZ, (LPBYTE) szBuffer, (DWORD) MAX_PATH);
132 
133  RegSetValueEx(hKey, _T("Advanced"), 0, REG_DWORD, (LPBYTE)&Settings.IsAdvancedView, (DWORD) sizeof(DWORD));
134 
135  RegCloseKey(hKey);
136  }
137 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define HKEY_CURRENT_USER
Definition: winreg.h:11
HWND hWnd
Definition: settings.c:17
#define ComboBox_GetText(hwndCtl, lpch, cchMax)
Definition: windowsx.h:33
SSSTARS Settings
Definition: settings.c:33
#define IDC_COMBO_CHARSET
Definition: resource.h:21
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
const TCHAR g_szGeneralRegKey[]
Definition: settings.c:16
smooth NULL
Definition: ftsmooth.c:416
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_FONTCOMBO
Definition: resource.h:12
HWND hCharmapDlg
Definition: charmap.c:22
#define REG_DWORD
Definition: sdbapi.c:539
#define RegSetValueEx
Definition: winreg.h:533
#define RegCreateKeyEx
Definition: winreg.h:501
#define REG_SZ
Definition: layer.c:22

◆ VerifyInteg()

BOOL VerifyInteg ( LPCWSTR  lpSHA1Hash,
LPCWSTR  lpFileName 
)

Definition at line 14 of file integrity.cpp.

Referenced by CDownloadManager::ThreadFunc().

15 {
16  BOOL ret = FALSE;
17 
18  /* first off, does it exist at all? */
20 
21  if (file == INVALID_HANDLE_VALUE)
22  return FALSE;
23 
24  /* let's grab the actual file size to organize the mmap'ing rounds */
26  GetFileSizeEx(file, &size);
27 
28  /* retrieve a handle to map the file contents to memory */
30  if (map)
31  {
32  /* map that thing in address space */
33  const unsigned char *file_map = static_cast<const unsigned char *>(MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0));
34  if (file_map)
35  {
36  SHA_CTX ctx;
37  /* initialize the SHA-1 context */
38  A_SHAInit(&ctx);
39 
40  /* feed the data to the cookie monster */
41  A_SHAUpdate(&ctx, file_map, size.LowPart);
42 
43  /* cool, we don't need this anymore */
44  UnmapViewOfFile(file_map);
45 
46  /* we're done, compute the final hash */
47  ULONG sha[5];
48  A_SHAFinal(&ctx, sha);
49 
50  WCHAR buf[(sizeof(sha) * 2) + 1];
51  for (UINT i = 0; i < sizeof(sha); i++)
52  swprintf(buf + 2 * i, L"%02x", ((unsigned char *) sha)[i]);
53  /* does the resulting SHA1 match with the provided one? */
54  if (!_wcsicmp(buf, lpSHA1Hash))
55  ret = TRUE;
56  }
57  CloseHandle(map);
58  }
59  CloseHandle(file);
60  return ret;
61 }
static const WCHAR sha[]
Definition: oid.c:1055
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
void WINAPI A_SHAUpdate(PSHA_CTX, const unsigned char *, UINT)
Definition: sha1.c:128
#define MapViewOfFile
Definition: compat.h:402
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint 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 GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint GLenum GLfloat GLenum GLint GLenum GLsizei GLenum GLboolean GLenum GLdouble GLenum GLfloat GLenum GLenum GLfloat GLenum GLenum GLdouble GLenum GLenum GLint GLenum GLenum GLint GLenum map
Definition: glfuncs.h:124
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
GLenum GLclampf GLint i
Definition: glfuncs.h:14
Definition: addons.c:68
smooth NULL
Definition: ftsmooth.c:416
#define FILE_MAP_READ
Definition: compat.h:427
#define OPEN_EXISTING
Definition: compat.h:426
void WINAPI A_SHAInit(PSHA_CTX)
Definition: sha1.c:102
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizeiptr size
Definition: glext.h:5919
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:401
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned int UINT
Definition: ndis.h:50
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define GetFileSizeEx
Definition: compat.h:414
int ret
static const WCHAR L[]
Definition: oid.c:1087
ULONG LowPart
Definition: typedefs.h:104
#define GENERIC_READ
Definition: compat.h:124
void WINAPI A_SHAFinal(PSHA_CTX, PULONG)
Definition: sha1.c:171
#define PAGE_READONLY
Definition: compat.h:127
#define CreateFileW
Definition: compat.h:400
unsigned int ULONG
Definition: retypes.h:1
#define UnmapViewOfFile
Definition: compat.h:403
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_In_ LPCSTR lpFileName
Definition: winbase.h:3011
Definition: fci.c:126

Variable Documentation

◆ hInst

HINSTANCE hInst

Definition at line 13 of file dxdiag.c.

◆ hMainWnd

HWND hMainWnd

Definition at line 33 of file magnifier.c.

◆ SelectedEnumType

◆ SettingsInfo