1 // SoftEther VPN Source Code - Developer Edition Master Branch 2 // Cedar Communication Module 3 4 5 6 // WinUi.h 7 // User interface code for Win32 8 9 #ifdef OS_WIN32 10 11 #ifndef WINUI_H 12 #define WINUI_H 13 14 #include "Cedar.h" 15 16 #define WINUI_DEBUG_TEXT "@winui_debug.txt" 17 18 #define LV_INSERT_RESET_ALL_ITEM_MIN 500 19 20 #define WINUI_PASSWORD_NULL_USERNAME "NULL" 21 22 #define WINUI_DEFAULT_DIALOG_UNIT_X 7 23 #define WINUI_DEFAULT_DIALOG_UNIT_Y 14 24 25 // Constants 26 #define FREE_REGKEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN Client\\Free Edition Info" 27 #define ONCE_MSG_REGKEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Common" 28 #define ONCE_MSG_REGVALUE "HideMessage_%u" 29 30 #define NICINFO_AUTOCLOSE_TIME_1 (20 * 1000) 31 #define NICINFO_AUTOCLOSE_TIME_2 1800 32 33 extern bool UseAlpha; 34 extern UINT AlphaValue; 35 36 37 // Minimum font size 38 #define WINUI_MIN_FONTSIZE 5 39 40 41 // Macro 42 #define DIALOG DIALOGEX(false) 43 #define DIALOG_WHITE DIALOGEX(true) 44 #define DIALOGEX(white) \ 45 void *param = GetParam(hWnd); \ 46 { \ 47 UINT ret; \ 48 ret = DlgProc(hWnd, msg, wParam, lParam, white); \ 49 if (ret != 0) return ret; \ 50 } 51 52 typedef UINT (__stdcall DIALOG_PROC)(HWND, UINT, WPARAM, LPARAM); 53 54 typedef UINT (WINUI_DIALOG_PROC)(HWND, UINT, WPARAM, LPARAM, void *); 55 56 typedef UINT (WINUI_WIZARD_PROC)(HWND, UINT, WPARAM, LPARAM, WIZARD *, WIZARD_PAGE *, void *); 57 58 59 // Special message to be used for this wizard 60 #define WM_WIZ_BASE (WM_APP + 201) 61 #define WM_WIZ_NEXT (WM_WIZ_BASE + 0) 62 #define WM_WIZ_BACK (WM_WIZ_BASE + 1) 63 #define WM_WIZ_CLOSE (WM_WIZ_BASE + 2) 64 #define WM_WIZ_SHOW (WM_WIZ_BASE + 3) 65 #define WM_WIZ_HIDE (WM_WIZ_BASE + 4) 66 67 68 // Secure operation contents 69 #define WINUI_SECURE_ENUM_OBJECTS 1 // Enumerate objects 70 #define WINUI_SECURE_WRITE_DATA 2 // Write the data 71 #define WINUI_SECURE_READ_DATA 3 // Read the data 72 #define WINUI_SECURE_WRITE_CERT 4 // Write the certificate 73 #define WINUI_SECURE_READ_CERT 5 // Read the certificate 74 #define WINUI_SECURE_WRITE_KEY 6 // Write the secret key 75 #define WINUI_SECURE_SIGN_WITH_KEY 7 // Signature by the private key 76 #define WINUI_SECURE_DELETE_OBJECT 8 // Delete the object 77 #define WINUI_SECURE_DELETE_CERT 9 // Delete the certificate 78 #define WINUI_SECURE_DELETE_KEY 10 // Delete the private key 79 #define WINUI_SECURE_DELETE_DATA 11 // Delete the Data 80 81 // Secure operation structure 82 typedef struct WINUI_SECURE_BATCH 83 { 84 UINT Type; // Type of operation 85 char *Name; // Name 86 bool Private; // Private mode 87 BUF *InputData; // Input data 88 BUF *OutputData; // Output data 89 X *InputX; // Input certificate 90 X *OutputX; // Output certificate 91 K *InputK; // Input secret key 92 LIST *EnumList; // Enumerated list 93 UCHAR OutputSign[4096 / 8]; // Output signature 94 bool Succeed; // Success flag 95 } WINUI_SECURE_BATCH; 96 97 // Status window 98 typedef struct STATUS_WINDOW 99 { 100 HWND hWnd; 101 THREAD *Thread; 102 } STATUS_WINDOW; 103 104 // Batch processing items 105 typedef struct LVB_ITEM 106 { 107 UINT NumStrings; // The number of strings 108 wchar_t **Strings; // String buffer 109 UINT Image; // Image number 110 void *Param; // Parameters 111 } LVB_ITEM; 112 113 // LV insertion batch process 114 typedef struct LVB 115 { 116 LIST *ItemList; // Item list 117 } LVB; 118 119 120 #ifdef WINUI_C 121 122 // Internal code 123 124 // Font 125 typedef struct FONT 126 { 127 UINT Size; // Size 128 bool Bold; // Bold type 129 bool Italic; // Italic type 130 bool UnderLine; // Underline 131 bool StrikeOut; // Strike through 132 char *Name; // Font name 133 HFONT hFont; // Font 134 UINT x, y; // Font size 135 } FONT; 136 137 // Font cache list 138 static LIST *font_list = NULL; 139 140 // Dialog related 141 typedef struct DIALOG_PARAM 142 { 143 bool white; 144 void *param; 145 WINUI_DIALOG_PROC *proc; 146 bool meiryo; 147 LIST *BitmapList; 148 149 WIZARD *wizard; 150 WIZARD_PAGE *wizard_page; 151 WINUI_WIZARD_PROC *wizard_proc; 152 } DIALOG_PARAM; 153 154 // Secure device window related 155 typedef struct SECURE_DEVICE_WINDOW 156 { 157 WINUI_SECURE_BATCH *batch; 158 UINT num_batch; 159 UINT device_id; 160 struct SECURE_DEVICE_THREAD *p; 161 char *default_pin; 162 UINT BitmapId; 163 } SECURE_DEVICE_WINDOW; 164 165 // Thread 166 typedef struct SECURE_DEVICE_THREAD 167 { 168 SECURE_DEVICE_WINDOW *w; 169 HWND hWnd; 170 bool Succeed; 171 wchar_t *ErrorMessage; 172 char *pin; 173 } SECURE_DEVICE_THREAD; 174 175 void StartSecureDevice(HWND hWnd, SECURE_DEVICE_WINDOW *w); 176 177 // Passphrase 178 typedef struct PASSPHRASE_DLG 179 { 180 char pass[MAX_SIZE]; 181 BUF *buf; 182 bool p12; 183 } PASSPHRASE_DLG; 184 185 void PassphraseDlgProcCommand(HWND hWnd, PASSPHRASE_DLG *p); 186 187 // Status window 188 typedef struct STATUS_WINDOW_PARAM 189 { 190 HWND hWnd; 191 SOCK *Sock; 192 THREAD *Thread; 193 wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; 194 } STATUS_WINDOW_PARAM; 195 196 // Certificate display dialog 197 typedef struct CERT_DLG 198 { 199 X *x, *issuer_x; 200 bool ManagerMode; 201 } CERT_DLG; 202 203 204 typedef struct IMAGELIST_ICON 205 { 206 UINT id; 207 HICON hSmallImage; 208 HICON hLargeImage; 209 UINT Index; 210 } IMAGELIST_ICON; 211 212 typedef struct SEARCH_WINDOW_PARAM 213 { 214 wchar_t *caption; 215 HWND hWndFound; 216 } SEARCH_WINDOW_PARAM; 217 218 // Remote connection screen setting 219 typedef struct WINUI_REMOTE 220 { 221 bool flag1; 222 char *RegKeyName; // Registry key name 223 UINT Icon; // Icon 224 wchar_t *Caption; // Caption 225 wchar_t *Title; // Title 226 char *Hostname; // Host name 227 char *DefaultHostname; // Default host name 228 LIST *CandidateList; // Candidate list 229 } WINUI_REMOTE; 230 231 #define CALLBACK __stdcall 232 233 void InitImageList(); 234 void FreeImageList(); 235 IMAGELIST_ICON *LoadIconForImageList(UINT id); 236 int CompareImageListIcon(void *p1, void *p2); 237 BOOL CALLBACK EnumResNameProc(HMODULE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG_PTR lParam); 238 void PrintCertInfo(HWND hWnd, CERT_DLG *p); 239 void CertDlgUpdate(HWND hWnd, CERT_DLG *p); 240 bool CALLBACK SearchWindowEnumProc(HWND hWnd, LPARAM lParam); 241 UINT RemoteDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); 242 void RemoteDlgInit(HWND hWnd, WINUI_REMOTE *r); 243 void RemoteDlgRefresh(HWND hWnd, WINUI_REMOTE *r); 244 void RemoteDlgOnOk(HWND hWnd, WINUI_REMOTE *r); 245 int CALLBACK LvSortProc(LPARAM param1, LPARAM param2, LPARAM sort_param); 246 247 // Icon cache 248 typedef struct ICON_CACHE 249 { 250 UINT id; 251 bool small_icon; 252 HICON hIcon; 253 } ICON_CACHE; 254 255 static LIST *icon_cache_list = NULL; 256 257 // Sort related 258 typedef struct WINUI_LV_SORT 259 { 260 HWND hWnd; 261 UINT id; 262 UINT subitem; 263 bool desc; 264 bool numeric; 265 } WINUI_LV_SORT; 266 267 // Version information 268 typedef struct WINUI_ABOUT 269 { 270 CEDAR *Cedar; 271 wchar_t *ProductName; 272 UINT Bitmap; 273 WINUI_UPDATE *Update; 274 } WINUI_ABOUT; 275 276 UINT AboutDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); 277 void AboutDlgInit(HWND hWnd, WINUI_ABOUT *a); 278 279 #define LED_WIDTH 96 280 #define LED_HEIGHT 16 281 #define LED_FORCE_UPDATE 60000 282 283 // LED 284 struct LED 285 { 286 HDC hDC; 287 HBITMAP hBM; 288 void *Buf; 289 UCHAR px[LED_WIDTH][LED_HEIGHT]; 290 bool Updated; 291 UINT64 LastUpdated; 292 }; 293 294 void LedDrawString(LED *d, char *str, HFONT f); 295 void LedMainDraw(LED *d, HANDLE h); 296 void LedSpecial(LED *d, HANDLE h, UINT n); 297 298 299 // STRING 300 typedef struct STRING_DLG 301 { 302 wchar_t String[MAX_SIZE]; 303 wchar_t *Title; 304 wchar_t *Info; 305 UINT Icon; 306 bool AllowEmpty; 307 bool AllowUnsafe; 308 } STRING_DLG; 309 310 void StringDlgInit(HWND hWnd, STRING_DLG *s); 311 void StringDlgUpdate(HWND hWnd, STRING_DLG *s); 312 313 // PIN code is cached for five minutes 314 #define WINUI_SECUREDEVICE_PIN_CACHE_TIME (5 * 60 * 1000) 315 extern char cached_pin_code[MAX_SIZE]; 316 extern UINT64 cached_pin_code_expires; 317 318 // TCP connection dialog related 319 typedef struct WINCONNECT_DLG_DATA 320 { 321 wchar_t *caption; 322 wchar_t *info; 323 UINT icon_id; 324 UINT timeout; 325 char *hostname; 326 UINT port; 327 bool cancel; 328 SOCK *ret_sock; 329 THREAD *thread; 330 HWND hWnd; 331 char nat_t_svc_name[MAX_SIZE]; 332 UINT nat_t_error_code; 333 bool try_start_ssl; 334 } WINCONNECT_DLG_DATA; 335 336 HBITMAP ResizeBitmap(HBITMAP hSrc, UINT src_x, UINT src_y, UINT dst_x, UINT dst_y); 337 #else 338 typedef struct FONT FONT; 339 #endif // WINUI_C 340 341 // The information screen about the free version 342 typedef struct FREEINFO 343 { 344 char ServerName[MAX_SERVER_STR_LEN + 1]; 345 HWND hWnd; 346 THREAD *Thread; 347 EVENT *Event; 348 } FREEINFO; 349 350 // Message 351 typedef struct ONCEMSG_DLG 352 { 353 UINT Icon; 354 wchar_t *Title; 355 wchar_t *Message; 356 bool ShowCheckbox; 357 bool Checked; 358 UINT MessageHash; 359 bool *halt; 360 } ONCEMSG_DLG; 361 362 // Definition of bad process 363 typedef struct BAD_PROCESS 364 { 365 char *ExeName; 366 char *Title; 367 } BAD_PROCESS; 368 369 // Page in the wizard 370 struct WIZARD_PAGE 371 { 372 UINT Id; 373 UINT Index; 374 WINUI_WIZARD_PROC *Proc; 375 wchar_t *Title; 376 WIZARD *Wizard; 377 378 struct DIALOG_PARAM *DialogParam; 379 HWND hWndPage; 380 bool EnableNext; 381 bool EnableBack; 382 bool EnableClose; 383 bool IsFinish; 384 }; 385 386 // Wizard 387 struct WIZARD 388 { 389 UINT Icon; 390 HWND hWndParent; 391 LIST *Pages; 392 void *Param; 393 UINT Bitmap; 394 wchar_t *Caption; 395 wchar_t *CloseConfirmMsg; 396 bool IsAreoStyle; 397 398 HWND hWndWizard; 399 bool SetCenterFlag; 400 bool ReplaceWindowProcFlag; 401 void *OriginalWindowProc; 402 }; 403 404 // Update notification 405 struct WINUI_UPDATE 406 { 407 wchar_t SoftwareTitle[MAX_SIZE]; 408 char SoftwareName[MAX_SIZE]; 409 UINT64 CurrentDate; 410 UINT CurrentBuild; 411 UINT CurrentVer; 412 char ClientId[128]; 413 char RegKey[MAX_PATH]; 414 UPDATE_CLIENT *UpdateClient; 415 bool UseSuppressFlag; 416 bool CurrentlyDisabled; 417 }; 418 419 // Update notification parameters 420 struct WINUI_UPDATE_DLG_PARAM 421 { 422 WINUI_UPDATE *Update; 423 UINT LatestBuild; 424 UINT64 LatestDate; 425 char *LatestVer; 426 char *Url; 427 volatile bool *halt_flag; 428 bool IsInConfigDialog; 429 }; 430 431 // Registry key to save the update notification settings 432 #define WINUI_UPDATE_REGKEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Check Update\\%s" 433 434 435 // Function prototype 436 void InitWinUi(wchar_t *software_name, char *font, UINT fontsize); 437 void FreeWinUi(); 438 439 WINUI_UPDATE *InitUpdateUi(wchar_t *title, char *name, char *family_name, UINT64 current_date, UINT current_build, UINT current_ver, char *client_id, bool use_suppress_flag); 440 void FreeUpdateUi(WINUI_UPDATE *u); 441 void DisableUpdateUi(WINUI_UPDATE *u); 442 void LoadUpdateUiSetting(WINUI_UPDATE *u, UPDATE_CLIENT_SETTING *s); 443 void SaveUpdateUiSetting(WINUI_UPDATE *u, UPDATE_CLIENT_SETTING *s); 444 void UpdateNotifyProcUi(UPDATE_CLIENT *c, UINT latest_build, UINT64 latest_date, char *latest_ver, char *url, volatile bool *halt_flag, void *param); 445 UINT UpdateNoticeDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); 446 bool ConfigUpdateUi(WINUI_UPDATE *u, HWND hWnd); 447 UINT UpdateConfigDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); 448 449 bool IsThisProcessForeground(); 450 HWND DlgItem(HWND hWnd, UINT id); 451 void SetText(HWND hWnd, UINT id, wchar_t *str); 452 void SetTextInner(HWND hWnd, UINT id, wchar_t *str); 453 void SetTextA(HWND hWnd, UINT id, char *str); 454 wchar_t *GetText(HWND hWnd, UINT id); 455 char *GetTextA(HWND hWnd, UINT id); 456 bool GetTxt(HWND hWnd, UINT id, wchar_t *str, UINT size); 457 bool GetTxtA(HWND hWnd, UINT id, char *str, UINT size); 458 bool IsEnable(HWND hWnd, UINT id); 459 bool IsDisable(HWND hWnd, UINT id); 460 void Enable(HWND hWnd, UINT id); 461 void Disable(HWND hWnd, UINT id); 462 void SetEnable(HWND hWnd, UINT id, bool b); 463 void Close(HWND hWnd); 464 void DoEvents(HWND hWnd); 465 void Refresh(HWND hWnd); 466 UINT GetInt(HWND hWnd, UINT id); 467 void SetInt(HWND hWnd, UINT id, UINT value); 468 void SetIntEx(HWND hWnd, UINT id, UINT value); 469 void Focus(HWND hWnd, UINT id); 470 void FocusEx(HWND hWnd, UINT id); 471 bool IsFocus(HWND hWnd, UINT id); 472 wchar_t *GetClass(HWND hWnd, UINT id); 473 char *GetClassA(HWND hWnd, UINT id); 474 void SelectEdit(HWND hWnd, UINT id); 475 void SetCursorOnRight(HWND hWnd, UINT id); 476 void UnselectEdit(HWND hWnd, UINT id); 477 UINT SendMsg(HWND hWnd, UINT id, UINT msg, WPARAM wParam, LPARAM lParam); 478 bool IsEmpty(HWND hWnd, UINT id); 479 UINT GetTextLen(HWND hWnd, UINT id, bool unicode); 480 UINT GetStyle(HWND hWnd, UINT id); 481 void SetStyle(HWND hWnd, UINT id, UINT style); 482 void RemoveStyle(HWND hWnd, UINT id, UINT style); 483 UINT GetExStyle(HWND hWnd, UINT id); 484 void SetExStyle(HWND hWnd, UINT id, UINT style); 485 void RemoveExStyle(HWND hWnd, UINT id, UINT style); 486 void Hide(HWND hWnd, UINT id); 487 void Show(HWND hWnd, UINT id); 488 void SetShow(HWND hWnd, UINT id, bool b); 489 bool IsHide(HWND hWnd, UINT id); 490 bool IsShow(HWND hWnd, UINT id); 491 void Top(HWND hWnd); 492 void *GetParam(HWND hWnd); 493 void SetParam(HWND hWnd, void *param); 494 UINT DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, bool white_color); 495 UINT DialogInternal(HWND hWnd, UINT id, DIALOG_PROC *proc, void *param); 496 UINT MsgBox(HWND hWnd, UINT flag, wchar_t *msg); 497 UINT MsgBoxEx(HWND hWnd, UINT flag, wchar_t *msg, ...); 498 void FormatText(HWND hWnd, UINT id, ...); 499 void Center(HWND hWnd); 500 void CenterParent(HWND hWnd); 501 void DisableClose(HWND hWnd); 502 void EnableClose(HWND hWnd); 503 void InitFont(); 504 void FreeFont(); 505 int CompareFont(void *p1, void *p2); 506 HFONT GetFont(char *name, UINT size, bool bold, bool italic, bool underline, bool strikeout); 507 double GetTextScalingFactor(); 508 bool CalcFontSize(HFONT hFont, UINT *x, UINT *y); 509 void SetFont(HWND hWnd, UINT id, HFONT hFont); 510 void SetFontEx(HWND hWnd, UINT id, HFONT hFont, bool no_adjust_font_size); 511 void LimitText(HWND hWnd, UINT id, UINT count); 512 void Check(HWND hWnd, UINT id, bool b); 513 bool IsChecked(HWND hWnd, UINT id); 514 void SetIcon(HWND hWnd, UINT id, UINT icon_id); 515 bool SecureDeviceWindow(HWND hWnd, WINUI_SECURE_BATCH *batch, UINT num_batch, UINT device_id, UINT bitmap_id); 516 UINT Dialog(HWND hWnd, UINT id, WINUI_DIALOG_PROC *proc, void *param); 517 UINT DialogEx(HWND hWnd, UINT id, WINUI_DIALOG_PROC *proc, void *param, bool white); 518 UINT DialogEx2(HWND hWnd, UINT id, WINUI_DIALOG_PROC *proc, void *param, bool white, bool meiryo); 519 UINT __stdcall InternalDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 520 UINT SecureDeviceWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); 521 HFONT Font(UINT size, UINT bold); 522 void DlgFont(HWND hWnd, UINT id, UINT size, UINT bold); 523 void OpenAvi(HWND hWnd, UINT id, UINT avi_id); 524 void CloseAvi(HWND hWnd, UINT id); 525 void PlayAvi(HWND hWnd, UINT id, bool repeat); 526 void StopAvi(HWND hWnd, UINT id); 527 void EnableSecureDeviceWindowControls(HWND hWnd, bool enable); 528 void SecureDeviceThread(THREAD *t, void *param); 529 void Command(HWND hWnd, UINT id); 530 wchar_t *OpenDlg(HWND hWnd, wchar_t *filter, wchar_t *title); 531 char *OpenDlgA(HWND hWnd, char *filter, char *title); 532 wchar_t *SaveDlg(HWND hWnd, wchar_t *filter, wchar_t *title, wchar_t *default_name, wchar_t *default_ext); 533 char *SaveDlgA(HWND hWnd, char *filter, char *title, char *default_name, char *default_ext); 534 wchar_t *MakeFilter(wchar_t *str); 535 char *MakeFilterA(char *str); 536 bool PassphraseDlg(HWND hWnd, char *pass, UINT pass_size, BUF *buf, bool p12); 537 UINT PassphraseDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); 538 bool PasswordDlg(HWND hWnd, UI_PASSWORD_DLG *p); 539 void PasswordDlgOnOk(HWND hWnd, UI_PASSWORD_DLG *p); 540 UINT PasswordDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); 541 void PasswordDlgProcChange(HWND hWnd, UI_PASSWORD_DLG *p); 542 UINT CbAddStr(HWND hWnd, UINT id, wchar_t *str, UINT data); 543 UINT CbAddStrA(HWND hWnd, UINT id, char *str, UINT data); 544 UINT CbAddStr9xA(HWND hWnd, UINT id, char *str, UINT data); 545 void CbSelectIndex(HWND hWnd, UINT id, UINT index); 546 UINT CbNum(HWND hWnd, UINT id); 547 UINT CbFindStr(HWND hWnd, UINT id, wchar_t *str); 548 UINT CbFindStr9xA(HWND hWnd, UINT id, char *str); 549 wchar_t *CbGetStr(HWND hWnd, UINT id); 550 UINT CbFindData(HWND hWnd, UINT id, UINT data); 551 UINT CbGetData(HWND hWnd, UINT id, UINT index); 552 void CbSelect(HWND hWnd, UINT id, int data); 553 void CbReset(HWND hWnd, UINT id); 554 void CbSetHeight(HWND hWnd, UINT id, UINT value); 555 UINT CbGetSelectIndex(HWND hWnd, UINT id); 556 UINT CbGetSelect(HWND hWnd, UINT id); 557 void SetRange(HWND hWnd, UINT id, UINT start, UINT end); 558 void SetPos(HWND hWnd, UINT id, UINT pos); 559 void LbReset(HWND hWnd, UINT id); 560 STATUS_WINDOW *StatusPrinterWindowStart(SOCK *s, wchar_t *account_name); 561 void StatusPrinterWindowStop(STATUS_WINDOW *sw); 562 void StatusPrinterWindowPrint(STATUS_WINDOW *sw, wchar_t *str); 563 void StatusPrinterWindowThread(THREAD *thread, void *param); 564 UINT StatusPrinterWindowDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); 565 void CertDlg(HWND hWnd, X *x, X *issuer_x, bool manager); 566 UINT CertDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); 567 void LvInit(HWND hWnd, UINT id); 568 void LvInitEx(HWND hWnd, UINT id, bool no_image); 569 void LvInitEx2(HWND hWnd, UINT id, bool no_image, bool large_icon); 570 void LvReset(HWND hWnd, UINT id); 571 void LvInsertColumn(HWND hWnd, UINT id, UINT index, wchar_t *str, UINT width); 572 UINT GetIcon(UINT icon_id); 573 void LvInsert(HWND hWnd, UINT id, UINT icon, void *param, UINT num_str, ...); 574 UINT LvInsertItem(HWND hWnd, UINT id, UINT icon, void *param, wchar_t *str); 575 UINT LvInsertItemByImageListId(HWND hWnd, UINT id, UINT image, void *param, wchar_t *str); 576 UINT LvInsertItemByImageListIdA(HWND hWnd, UINT id, UINT image, void *param, char *str); 577 void LvSetItem(HWND hWnd, UINT id, UINT index, UINT pos, wchar_t *str); 578 void LvSetItemA(HWND hWnd, UINT id, UINT index, UINT pos, char *str); 579 void LvSetItemParam(HWND hWnd, UINT id, UINT index, void *param); 580 void LvSetItemImageByImageListId(HWND hWnd, UINT id, UINT index, UINT image); 581 void LvDeleteItem(HWND hWnd, UINT id, UINT index); 582 UINT LvNum(HWND hWnd, UINT id); 583 void *LvGetParam(HWND hWnd, UINT id, UINT index); 584 wchar_t *LvGetStr(HWND hWnd, UINT id, UINT index, UINT pos); 585 char *LvGetStrA(HWND hWnd, UINT id, UINT index, UINT pos); 586 UINT LvSearchParam(HWND hWnd, UINT id, void *param); 587 UINT LvSearchStr(HWND hWnd, UINT id, UINT pos, wchar_t *str); 588 UINT LvSearchStrA(HWND hWnd, UINT id, UINT pos, char *str); 589 UINT LvGetSelected(HWND hWnd, UINT id); 590 void *LvGetSelectedParam(HWND hWnd, UINT id); 591 UINT LvGetFocused(HWND hWnd, UINT id); 592 wchar_t *LvGetFocusedStr(HWND hWnd, UINT id, UINT pos); 593 wchar_t *LvGetSelectedStr(HWND hWnd, UINT id, UINT pos); 594 char *LvGetSelectedStrA(HWND hWnd, UINT id, UINT pos); 595 bool LvIsSelected(HWND hWnd, UINT id); 596 UINT LvGetNextMasked(HWND hWnd, UINT id, UINT start); 597 bool LvIsMasked(HWND hWnd, UINT id); 598 bool LvIsSingleSelected(HWND hWnd, UINT id); 599 bool LvIsMultiMasked(HWND hWnd, UINT id); 600 void LvAutoSize(HWND hWnd, UINT id); 601 void LvSelect(HWND hWnd, UINT id, UINT index); 602 void LvSelectByParam(HWND hWnd, UINT id, void *param); 603 void LvSelectAll(HWND hWnd, UINT id); 604 void LvSwitchSelect(HWND hWnd, UINT id); 605 void LvSetView(HWND hWnd, UINT id, bool details); 606 UINT LvGetColumnWidth(HWND hWnd, UINT id, UINT index); 607 void CheckCertDlg(UI_CHECKCERT *p); 608 UINT CheckCertDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); 609 void PrintCheckCertInfo(HWND hWnd, UI_CHECKCERT *p); 610 void ShowDlgDiffWarning(HWND hWnd, UI_CHECKCERT *p); 611 void CheckCertDialogOnOk(HWND hWnd, UI_CHECKCERT *p); 612 bool ConnectErrorDlg(UI_CONNECTERROR_DLG *p); 613 UINT ConnectErrorDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); 614 HINSTANCE GetUiDll(); 615 HICON LoadLargeIconInner(UINT id); 616 HICON LoadSmallIconInner(UINT id); 617 HICON LoadLargeIcon(UINT id); 618 HICON LoadSmallIcon(UINT id); 619 HICON LoadIconEx(UINT id, bool small_icon); 620 void InitIconCache(); 621 void FreeIconCache(); 622 LVB *LvInsertStart(); 623 void LvInsertAdd(LVB *b, UINT icon, void *param, UINT num_str, ...); 624 void LvInsertEnd(LVB *b, HWND hWnd, UINT id); 625 void LvInsertEndEx(LVB *b, HWND hWnd, UINT id, bool force_reset); 626 void LvSetStyle(HWND hWnd, UINT id, UINT style); 627 void LvRemoveStyle(HWND hWnd, UINT id, UINT style); 628 HMENU LoadSubMenu(UINT menu_id, UINT pos, HMENU *parent_menu); 629 UINT GetMenuItemPos(HMENU hMenu, UINT id); 630 void DeleteMenuItem(HMENU hMenu, UINT pos); 631 void SetMenuItemBold(HMENU hMenu, UINT pos, bool bold); 632 wchar_t *GetMenuStr(HMENU hMenu, UINT pos); 633 char *GetMenuStrA(HMENU hMenu, UINT pos); 634 void SetMenuStr(HMENU hMenu, UINT pos, wchar_t *str); 635 void SetMenuStrA(HMENU hMenu, UINT pos, char *str); 636 void RemoveShortcutKeyStrFromMenu(HMENU hMenu); 637 UINT GetMenuNum(HMENU hMenu); 638 void PrintMenu(HWND hWnd, HMENU hMenu); 639 void LvRename(HWND hWnd, UINT id, UINT pos); 640 void LvSetEnhanced(HWND hWnd, UINT id, bool enable); 641 void EditBoxSetEnhanced(HWND hWnd, UINT id, bool enable); 642 void AllowFGWindow(UINT process_id); 643 HWND SearchWindow(wchar_t *caption); 644 char *RemoteDlg(HWND hWnd, char *regkey, UINT icon, wchar_t *caption, wchar_t *title, char *default_host); 645 LIST *ReadCandidateFromReg(UINT root, char *key, char *name); 646 void WriteCandidateToReg(UINT root, char *key, LIST *o, char *name); 647 UINT LvGetColumnNum(HWND hWnd, UINT id); 648 void LvSetItemParamEx(HWND hWnd, UINT id, UINT index, UINT subitem, void *param); 649 void LvSortEx(HWND hWnd, UINT id, UINT subitem, bool desc, bool numeric); 650 void LvSort(HWND hWnd, UINT id, UINT subitem, bool desc); 651 void *LvGetParamEx(HWND hWnd, UINT id, UINT index, UINT subitem); 652 void LvSortHander(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT id); 653 void LvStandardHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT id); 654 void IpSet(HWND hWnd, UINT id, UINT ip); 655 UINT IpGet(HWND hWnd, UINT id); 656 bool IpIsFilled(HWND hWnd, UINT id); 657 UINT IpGetFilledNum(HWND hWnd, UINT id); 658 void About(HWND hWnd, CEDAR *cedar, wchar_t *product_name); 659 void AboutEx(HWND hWnd, CEDAR *cedar, wchar_t *product_name, WINUI_UPDATE *u); 660 wchar_t *StringDlg(HWND hWnd, wchar_t *title, wchar_t *info, wchar_t *def, UINT icon, bool allow_empty, bool allow_unsafe); 661 char *StringDlgA(HWND hWnd, wchar_t *title, wchar_t *info, char *def, UINT icon, bool allow_empty, bool allow_unsafe); 662 UINT StringDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); 663 void InitDialogInternational(HWND hWnd, void *pparam); 664 void AdjustWindowAndControlSize(HWND hWnd, bool *need_resize, double *factor_x, double *factor_y); 665 void AdjustDialogXY(UINT *x, UINT *y, UINT dlgfont_x, UINT dlgfont_y); 666 HFONT GetDialogDefaultFont(); 667 HFONT GetDialogDefaultFontEx(bool meiryo); 668 void InitMenuInternational(HMENU hMenu, char *prefix); 669 void InitMenuInternationalUni(HMENU hMenu, char *prefix); 670 void ShowTcpIpConfigUtil(HWND hWnd, bool util_mode); 671 void ShowCpu64Warning(); 672 UINT Cpu64DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); 673 UINT TcpIpDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); 674 void TcpIpDlgInit(HWND hWnd); 675 void TcpIpDlgUpdate(HWND hWnd); 676 UINT TcpMsgDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); 677 void ShowEasterEgg(HWND hWnd); 678 bool Win32CnCheckAlreadyExists(bool lock); 679 void RegistWindowsFirewallAll(); 680 void RegistWindowsFirewallAllEx(char *dir); 681 void InitVistaWindowTheme(HWND hWnd); 682 void OnceMsg(HWND hWnd, wchar_t *title, wchar_t *message, bool show_checkbox, UINT icon); 683 void OnceMsgEx(HWND hWnd, wchar_t *title, wchar_t *message, bool show_checkbox, UINT icon, bool *halt); 684 UINT GetOnceMsgHash(wchar_t *title, wchar_t *message); 685 UINT OnceMsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); 686 bool CheckBadProcesses(HWND hWnd); 687 BAD_PROCESS *IsBadProcess(char *exe); 688 void ShowBadProcessWarning(HWND hWnd, BAD_PROCESS *bad); 689 void SetFontMeiryo(HWND hWnd, UINT id, UINT font_size); 690 char *GetMeiryoFontName(); 691 void SetFontDefault(HWND hWnd, UINT id); 692 HFONT GetMeiryoFont(); 693 HFONT GetMeiryoFontEx(UINT font_size); 694 HFONT GetMeiryoFontEx2(UINT font_size, bool bold); 695 bool ShowWindowsNetworkConnectionDialog(); 696 SOCK *WinConnectEx3(HWND hWnd, char *server, UINT port, UINT timeout, UINT icon_id, wchar_t *caption, wchar_t *info, UINT *nat_t_error_code, char *nat_t_svc_name, bool try_start_ssl); 697 UINT WinConnectDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); 698 void WinConnectDlgThread(THREAD *thread, void *param); 699 void NicInfo(UI_NICINFO *info); 700 UINT NicInfoProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); 701 void NicInfoInit(HWND hWnd, UI_NICINFO *info); 702 void NicInfoOnTimer(HWND hWnd, UI_NICINFO *info); 703 void NicInfoRefresh(HWND hWnd, UI_NICINFO *info); 704 void NicInfoShowStatus(HWND hWnd, UI_NICINFO *info, wchar_t *msg1, wchar_t *msg2, UINT icon, bool animate); 705 void NicInfoCloseAfterTime(HWND hWnd, UI_NICINFO *info, UINT tick); 706 707 WIZARD *NewWizard(UINT icon, UINT bitmap, wchar_t *caption, void *param); 708 void FreeWizard(WIZARD *w); 709 WIZARD_PAGE *NewWizardPage(UINT id, WINUI_WIZARD_PROC *proc, wchar_t *title); 710 void FreeWizardPage(WIZARD_PAGE *p); 711 void AddWizardPage(WIZARD *w, WIZARD_PAGE *p); 712 WIZARD_PAGE *GetWizardPage(WIZARD *w, UINT id); 713 void *CreateWizardPageInstance(WIZARD *w, WIZARD_PAGE *p); 714 void ShowWizard(HWND hWndParent, WIZARD *w, UINT start_id); 715 void SetWizardButton(WIZARD_PAGE *p, bool enable_next, bool enable_back, bool enable_close, bool is_finish); 716 void SetWizardButtonEx(WIZARD_PAGE *p, bool enable_next, bool enable_back, bool enable_close, bool is_finish, bool shield_icon); 717 void JumpWizard(WIZARD_PAGE *p, UINT next_id); 718 void CloseWizard(WIZARD_PAGE *p); 719 void SetUacIcon(HWND hWnd, UINT id); 720 721 LIST *NewBitmapList(); 722 void FreeBitmapList(LIST *o); 723 724 bool GetBitmapSize(void *bmp, UINT *x, UINT *y); 725 726 bool GetFontParam(HFONT hFont, FONT *f); 727 void AdjustFontSize(HWND hWnd, UINT id); 728 bool IsFontFitInRect(struct FONT *f, UINT width, UINT height, wchar_t *text, UINT format, bool *aborted); 729 730 void ShowTextFile(HWND hWnd, char *filename, wchar_t *caption, UINT icon); 731 732 #endif // WINUI_H 733 734 #endif // OS_WIN32 735