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
200
201
202
203
204
205
206
207
|
#include "stdafx.h"
CSteamPasswordEditor::CSteamPasswordEditor(CSteamProto *proto)
: CSteamDlgBase(proto, IDD_PASSWORD_EDITOR, false), m_ok(this, IDOK),
m_password(this, IDC_PASSWORD), m_savePermanently(this, IDC_SAVEPERMANENTLY)
{
m_ok.OnClick = Callback(this, &CSteamPasswordEditor::OnOk);
}
void 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");
}
void CSteamPasswordEditor::OnOk(CCtrlButton*)
{
if (m_proto->password != nullptr)
mir_free(m_proto->password);
m_proto->password = m_password.GetText();
if (m_savePermanently.Enabled())
m_proto->setWString("Password", m_proto->password);
EndDialog(m_hwnd, DIALOG_RESULT_OK);
}
void CSteamPasswordEditor::OnClose()
{
Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "PasswordWindow");
}
/////////////////////////////////////////////////////////////////////////////////
CSteamGuardDialog::CSteamGuardDialog(CSteamProto *proto, const char *domain)
: CSteamDlgBase(proto, IDD_GUARD, false),
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);
}
void 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");
}
void CSteamGuardDialog::OnOk(CCtrlButton*)
{
mir_strncpy(m_guardCode, ptrA(m_text.GetTextA()), _countof(m_guardCode));
EndDialog(m_hwnd, DIALOG_RESULT_OK);
}
void CSteamGuardDialog::OnClose()
{
Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "GuardWindow");
}
const char* CSteamGuardDialog::GetGuardCode()
{
return m_guardCode;
}
/////////////////////////////////////////////////////////////////////////////////
CSteamTwoFactorDialog::CSteamTwoFactorDialog(CSteamProto *proto)
: CSteamDlgBase(proto, IDD_TWOFACTOR, false),
m_ok(this, IDOK),
m_text(this, IDC_TEXT)
{
memset(m_twoFactorCode, 0, sizeof(m_twoFactorCode));
m_ok.OnClick = Callback(this, &CSteamTwoFactorDialog::OnOk);
}
void 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");
}
void CSteamTwoFactorDialog::OnOk(CCtrlButton*)
{
mir_strncpy(m_twoFactorCode, ptrA(m_text.GetTextA()), _countof(m_twoFactorCode));
EndDialog(m_hwnd, DIALOG_RESULT_OK);
}
void CSteamTwoFactorDialog::OnClose()
{
Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "TwoFactorWindow");
}
const char* CSteamTwoFactorDialog::GetTwoFactorCode()
{
return m_twoFactorCode;
}
/////////////////////////////////////////////////////////////////////////////////
CSteamCaptchaDialog::CSteamCaptchaDialog(CSteamProto *proto, BYTE *captchaImage, int captchaImageSize)
: CSteamDlgBase(proto, IDD_CAPTCHA, false),
m_ok(this, IDOK), m_text(this, IDC_TEXT),
m_captchaImage(nullptr)
{
memset(m_captchaText, 0, sizeof(m_captchaText));
m_captchaImageSize = captchaImageSize;
m_captchaImage = (BYTE*)mir_alloc(captchaImageSize);
memcpy(m_captchaImage, captchaImage, captchaImageSize);
m_ok.OnClick = Callback(this, &CSteamCaptchaDialog::OnOk);
}
CSteamCaptchaDialog::~CSteamCaptchaDialog()
{
if(m_captchaImage)
mir_free(m_captchaImage);
}
void 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");
}
void CSteamCaptchaDialog::OnOk(CCtrlButton*)
{
mir_strncpy(m_captchaText, ptrA(m_text.GetTextA()), _countof(m_captchaText));
EndDialog(m_hwnd, DIALOG_RESULT_OK);
}
void CSteamCaptchaDialog::OnClose()
{
Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "CaptchaWindow");
}
INT_PTR CSteamCaptchaDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
if (msg == WM_PAINT)
{
FI_INTERFACE *fei = nullptr;
INT_PTR result = CALLSERVICE_NOTFOUND;
if (ServiceExists(MS_IMG_GETINTERFACE))
result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&fei);
if (fei == nullptr || result != S_OK) {
MessageBox(nullptr, TranslateT("Fatal error, image services not found. Avatar services will be disabled."), TranslateT("Avatar Service"), MB_OK);
return 0;
}
FIMEMORY *stream = fei->FI_OpenMemory(m_captchaImage, m_captchaImageSize);
FREE_IMAGE_FORMAT fif = fei->FI_GetFileTypeFromMemory(stream, 0);
FIBITMAP *bitmap = fei->FI_LoadFromMemory(fif, stream, 0);
fei->FI_CloseMemory(stream);
PAINTSTRUCT ps;
HDC hDC = BeginPaint(m_hwnd, &ps);
//SetStretchBltMode(hDC, COLORONCOLOR);
StretchDIBits(
hDC,
11, 11,
fei->FI_GetWidth(bitmap) - 13,
fei->FI_GetHeight(bitmap),
0, 0,
fei->FI_GetWidth(bitmap),
fei->FI_GetHeight(bitmap),
fei->FI_GetBits(bitmap),
fei->FI_GetInfo(bitmap),
DIB_RGB_COLORS, SRCCOPY);
fei->FI_Unload(bitmap);
//fei->FI_DeInitialise();
EndPaint(m_hwnd, &ps);
return FALSE;
}
CSteamDlgBase::DlgProc(msg, wParam, lParam);
return FALSE;
}
const char* CSteamCaptchaDialog::GetCaptchaText()
{
return m_captchaText;
}
|