66 LRESULT CALLBACK
WndProc(HWND, UINT, WPARAM, LPARAM);
69 int WINAPI
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
70 PSTR cmdline,
int iCmdShow)
72 static char appname[] =
"OpenSSL";
78 if (cmdline[0] ==
'\0')
85 wndclass.cbSize =
sizeof(wndclass);
86 wndclass.style = CS_HREDRAW | CS_VREDRAW;
88 wndclass.cbClsExtra = 0;
89 wndclass.cbWndExtra = 0;
90 wndclass.hInstance = hInstance;
91 wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
92 wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
93 wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
94 wndclass.lpszMenuName = NULL;
95 wndclass.lpszClassName = appname;
96 wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
97 RegisterClassEx(&wndclass);
100 WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
101 CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
103 ShowWindow(hwnd, iCmdShow);
107 while (GetMessage(&msg, NULL, 0, 0))
109 TranslateMessage(&msg);
110 DispatchMessage(&msg);
116 LRESULT CALLBACK
WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
121 static int seeded = 0;
126 hdc = BeginPaint(hwnd, &ps);
127 GetClientRect(hwnd, &rect);
128 DrawText(hdc,
"Seeding the PRNG. Please move the mouse!", -1,
129 &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
138 if (RAND_event(iMsg, wParam, lParam) == 1 && seeded == 0)
142 MessageBox(hwnd,
"Couldn't write random file!",
143 "OpenSSL", MB_OK | MB_ICONERROR);
147 return DefWindowProc(hwnd, iMsg, wParam, lParam);