1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
#include "stdafx.h"
CSteamPasswordEditor::CSteamPasswordEditor(CSteamProto *proto)
: CSteamDlgBase(proto, IDD_PASSWORD_EDITOR), m_ok(this, IDOK),
m_password(this, IDC_PASSWORD), m_savePermanently(this, IDC_SAVEPERMANENTLY)
{
m_ok.OnClick = Callback(this, &CSteamPasswordEditor::OnOk);
}
bool CSteamPasswordEditor::OnInitDialog()
{
char iconName[100];
mir_snprintf(iconName, "%s_%s", MODULE, "main");
Window_SetIcon_IcoLib(m_hwnd, IcoLib_GetIconHandle(iconName));
SendMessage(m_password.GetHwnd(), EM_LIMITTEXT, 64, 0);
Utils_RestoreWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "PasswordWindow");
return true;
}
void CSteamPasswordEditor::OnOk(CCtrlButton*)
{
m_proto->m_password = m_password.GetText();
if (m_savePermanently.Enabled())
m_proto->setWString("Password", m_proto->m_password);
EndDialog(m_hwnd, DIALOG_RESULT_OK);
}
bool CSteamPasswordEditor::OnClose()
{
Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "PasswordWindow");
return true;
}
/////////////////////////////////////////////////////////////////////////////////
CSteamGuardDialog::CSteamGuardDialog(CSteamProto *proto, const char *domain)
: CSteamDlgBase(proto, IDD_GUARD),
m_ok(this, IDOK),
m_text(this, IDC_TEXT),
m_link(this, IDC_GETDOMAIN, domain)
{
memset(m_guardCode, 0, sizeof(m_guardCode));
mir_strcpy(m_domain, domain);
m_ok.OnClick = Callback(this, &CSteamGuardDialog::OnOk);
}
bool CSteamGuardDialog::OnInitDialog()
{
char iconName[100];
mir_snprintf(iconName, "%s_%s", MODULE, "main");
Window_SetIcon_IcoLib(m_hwnd, IcoLib_GetIconHandle(iconName));
SendMessage(m_text.GetHwnd(), EM_LIMITTEXT, 5, 0);
Utils_RestoreWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "GuardWindow");
return true;
}
void CSteamGuardDialog::OnOk(CCtrlButton*)
{
mir_strncpy(m_guardCode, ptrA(m_text.GetTextA()), _countof(m_guardCode));
EndDialog(m_hwnd, DIALOG_RESULT_OK);
}
bool CSteamGuardDialog::OnClose()
{
Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "GuardWindow");
return true;
}
const char* CSteamGuardDialog::GetGuardCode()
{
return m_guardCode;
}
/////////////////////////////////////////////////////////////////////////////////
CSteamTwoFactorDialog::CSteamTwoFactorDialog(CSteamProto *proto)
: CSteamDlgBase(proto, IDD_TWOFACTOR),
m_ok(this, IDOK),
m_text(this, IDC_TEXT)
{
memset(m_twoFactorCode, 0, sizeof(m_twoFactorCode));
m_ok.OnClick = Callback(this, &CSteamTwoFactorDialog::OnOk);
}
bool CSteamTwoFactorDialog::OnInitDialog()
{
char iconName[100];
mir_snprintf(iconName, "%s_%s", MODULE, "main");
Window_SetIcon_IcoLib(m_hwnd, IcoLib_GetIconHandle(iconName));
SendMessage(m_text.GetHwnd(), EM_LIMITTEXT, 5, 0);
Utils_RestoreWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "TwoFactorWindow");
return true;
}
void CSteamTwoFactorDialog::OnOk(CCtrlButton*)
{
mir_strncpy(m_twoFactorCode, ptrA(m_text.GetTextA()), _countof(m_twoFactorCode));
EndDialog(m_hwnd, DIALOG_RESULT_OK);
}
bool CSteamTwoFactorDialog::OnClose()
{
Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "TwoFactorWindow");
return true;
}
const char* CSteamTwoFactorDialog::GetTwoFactorCode()
{
return m_twoFactorCode;
}
/////////////////////////////////////////////////////////////////////////////////
CSteamCaptchaDialog::CSteamCaptchaDialog(CSteamProto *proto, const uint8_t *captchaImage, size_t captchaImageSize)
: CSteamDlgBase(proto, IDD_CAPTCHA),
m_ok(this, IDOK), m_text(this, IDC_TEXT),
m_captchaImage(nullptr)
{
memset(m_captchaText, 0, sizeof(m_captchaText));
m_captchaImageSize = captchaImageSize;
m_captchaImage = (uint8_t*)mir_alloc(captchaImageSize);
memcpy(m_captchaImage, captchaImage, captchaImageSize);
m_ok.OnClick = Callback(this, &CSteamCaptchaDialog::OnOk);
}
CSteamCaptchaDialog::~CSteamCaptchaDialog()
{
if (m_captchaImage)
mir_free(m_captchaImage);
}
bool CSteamCaptchaDialog::OnInitDialog()
{
char iconName[100];
mir_snprintf(iconName, "%s_%s", MODULE, "main");
Window_SetIcon_IcoLib(m_hwnd, IcoLib_GetIconHandle(iconName));
SendMessage(m_text.GetHwnd(), EM_LIMITTEXT, 6, 0);
Utils_RestoreWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "CaptchaWindow");
return true;
}
void CSteamCaptchaDialog::OnOk(CCtrlButton*)
{
mir_strncpy(m_captchaText, ptrA(m_text.GetTextA()), _countof(m_captchaText));
EndDialog(m_hwnd, DIALOG_RESULT_OK);
}
bool CSteamCaptchaDialog::OnClose()
{
Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "CaptchaWindow");
return true;
}
INT_PTR CSteamCaptchaDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
if (msg == WM_PAINT) {
FIMEMORY *stream = FreeImage_OpenMemory(m_captchaImage, (DWORD)m_captchaImageSize);
FREE_IMAGE_FORMAT fif = FreeImage_GetFileTypeFromMemory(stream, 0);
FIBITMAP *bitmap = FreeImage_LoadFromMemory(fif, stream, 0);
FreeImage_CloseMemory(stream);
PAINTSTRUCT ps;
HDC hDC = BeginPaint(m_hwnd, &ps);
StretchDIBits(
hDC,
11, 11,
FreeImage_GetWidth(bitmap) - 13,
FreeImage_GetHeight(bitmap),
0, 0,
FreeImage_GetWidth(bitmap),
FreeImage_GetHeight(bitmap),
FreeImage_GetBits(bitmap),
FreeImage_GetInfo(bitmap),
DIB_RGB_COLORS, SRCCOPY);
FreeImage_Unload(bitmap);
EndPaint(m_hwnd, &ps);
return FALSE;
}
CSteamDlgBase::DlgProc(msg, wParam, lParam);
return FALSE;
}
const char* CSteamCaptchaDialog::GetCaptchaText()
{
return m_captchaText;
}
|