扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:谢启东编译 来源:天极开发 2007年11月12日
关键字:
1. #include "stdafx.h" 2. #include "TestItDan.h" 3. #include <stdlib.h> 4. #include <stdio.h> 5. #include <windows.h> 6. #define MAX_LOADSTRING 100 7. struct user { 8. wchar_t *name; 9. size_t len; 10. int uid; 11. }; 13. HINSTANCE hInst; 14. TCHAR szTitle[MAX_LOADSTRING]; 15. TCHAR szWindowClass[MAX_LOADSTRING]; 16. TCHAR lpszUserName[16] = L"guest"; 17. TCHAR lpszPassword[16] = L"0123456789abcde"; 18. struct user *userP = (struct user *)0xcdcdcdcdcdcdcdcd; 19. size_t userNameLen = 16; 20. size_t userPasswordLen = 0xffffffff; 25. int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { 26. UNREFERENCED_PARAMETER(hPrevInstance); 27. UNREFERENCED_PARAMETER(lpCmdLine); 28. MSG msg; 29. HACCEL hAccelTable; 30. LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); 31. LoadString(hInstance, IDC_TESTITDAN, szWindowClass, MAX_LOADSTRING); 32. MyRegisterClass(hInstance); 33. userP = (struct user *)malloc(sizeof(user)); 34. if (!InitInstance (hInstance, nCmdShow)) { 35. return FALSE; 36. } 37. hAccelTable =LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_TESTITDAN)); 38. while (GetMessage(&msg, NULL, 0, 0)) { 39. if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { 40. TranslateMessage(&msg); 41. DispatchMessage(&msg); 42. } 43. } 44. return (int) msg.wParam; 45. } 109. INT_PTR CALLBACK GetPassword(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { 110. TCHAR lpszGuestPassword[16] = L"NCC-1701"; 111. UNREFERENCED_PARAMETER(lParam); 112. switch (message) { 113. case WM_INITDIALOG: 114. return (INT_PTR)TRUE; 115. case WM_COMMAND: 116. if (LOWORD(wParam) == IDOK) { 117. EndDialog(hDlg, LOWORD(wParam)); 118. SendDlgItemMessage(hDlg, 119. IDC_EDIT1, 120. EM_GETLINE, 121. (WPARAM) 0, // line 0 122. (LPARAM) lpszPassword 123. ); 124. userP->len = userNameLen; 125. if (wcscmp(lpszPassword, lpszGuestPassword) == 0) { 126. return true; 127. } 128. else { 129. MessageBox(hDlg, 130. (LPCWSTR)L"Invalid Password", 131. (LPCWSTR)L"Login Failed", 132. MB_OK 133. ); 134. } 135. return (INT_PTR)TRUE; 136. } 137. break; 138. } 139. return (INT_PTR)FALSE; 140. } |
&lpszPassword = 0x0040911C &userP = 0x0040913C &userNameLen = 0x00409140 &userPasswordLen = 0x00409144 |
0040911C 30 00 31 00 32 00 33 00 34 00 35 00 36 00 37 00 0040912C 38 00 39 00 61 00 62 00 63 00 64 00 65 00 00 00 0040913C 30 4d 55 00 10 00 00 00 ff ff ff ff 8a 00 07 02 0040914C c6 00 07 02 02 01 07 02 00 00 00 00 01 00 00 00 |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者