comparison src/os/win32/ngx_gui.c @ 461:a88a3e4e158f release-0.1.5

nginx-0.1.5-RELEASE import *) Bugfix: on Solaris and Linux there may be too many "recvmsg() returned not enough data" alerts. *) Bugfix: there were the "writev() failed (22: Invalid argument)" errors on Solaris in proxy mode without sendfile. On other platforms that do not support sendfile at all the process got caught in an endless loop. *) Bugfix: segmentation fault on Solaris in proxy mode and using sendfile. *) Bugfix: segmentation fault on Solaris. *) Bugfix: on-line upgrade did not work on Linux. *) Bugfix: the ngx_http_autoindex_module module did not escape the spaces, the quotes, and the percent signs in the directory listing. *) Change: the decrease of the copy operations. *) Feature: the userid_p3p directive.
author Igor Sysoev <igor@sysoev.ru>
date Thu, 11 Nov 2004 14:07:14 +0000
parents
children b1648294f693
comparison
equal deleted inserted replaced
460:5f8319142dfc 461:a88a3e4e158f
1
2 /*
3 * Copyright (C) Igor Sysoev
4 */
5
6
7 #include <ngx_config.h>
8 #include <ngx_core.h>
9
10
11 #define NGX_MAX_TEXT 2048
12
13
14 void ngx_message_box(char *title, ngx_uint_t type, ngx_err_t err,
15 const char *fmt, ...)
16 {
17 va_list args;
18 u_char text[NGX_MAX_TEXT], *p, *last;
19
20 last = text + NGX_MAX_TEXT;
21
22 va_start(args, fmt);
23 p = ngx_vsnprintf(text, NGX_MAX_TEXT, fmt, args);
24 va_end(args);
25
26 if (err) {
27
28 if (p > last - 50) {
29
30 /* leave a space for an error code */
31
32 p = last - 50;
33 *p++ = '.';
34 *p++ = '.';
35 *p++ = '.';
36 }
37
38 if ((unsigned) err >= 0x80000000) {
39 p = ngx_snprintf(p, last - p, " (%Xd: ", err);
40
41 } else {
42 p = ngx_snprintf(p, last - p, " (%d: ", err);
43 }
44
45 p = ngx_strerror_r(err, p, last - p);
46
47 if (p < last) {
48 *p++ = ')';
49 }
50 }
51
52 if (p == last) {
53 p--;
54 }
55
56 *p = '\0';
57
58 MessageBox(NULL, (char *) text, title, type);
59 }
60
61
62 ngx_int_t ngx_system_tray_icon(HWND window, u_long action,
63 HICON icon, u_char *tip)
64 {
65 NOTIFYICONDATA ni;
66
67 ni.cbSize = sizeof(NOTIFYICONDATA);
68 ni.hWnd = window;
69 ni.uID = 0;
70 ni.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP;
71 ni.uCallbackMessage = NGX_WM_TRAY;
72 ni.hIcon = icon;
73
74 if (tip) {
75 ngx_cpystrn((u_char *) ni.szTip, tip, 64);
76 } else {
77 ni.szTip[0] = '\0';
78 }
79
80 if (Shell_NotifyIcon(action, &ni) == 0) {
81 return NGX_ERROR;
82 }
83
84 return NGX_OK;
85 }