comparison src/os/win32/ngx_win32_init.c @ 282:30310107dbc9

nginx-0.0.2-2004-03-09-22:47:07 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 09 Mar 2004 19:47:07 +0000
parents 00cafae0bdf1
children 55e496a8ece3
comparison
equal deleted inserted replaced
281:014292b55158 282:30310107dbc9
15 ngx_wsasend_chain, 15 ngx_wsasend_chain,
16 0 16 0
17 }; 17 };
18 18
19 19
20 typedef struct {
21 WORD wServicePackMinor;
22 WORD wSuiteMask;
23 BYTE wProductType;
24 } ngx_osviex_stub_t;
25
26
20 /* Should these pointers be per protocol ? */ 27 /* Should these pointers be per protocol ? */
21 LPFN_ACCEPTEX acceptex; 28 LPFN_ACCEPTEX acceptex;
22 LPFN_GETACCEPTEXSOCKADDRS getacceptexsockaddrs; 29 LPFN_GETACCEPTEXSOCKADDRS getacceptexsockaddrs;
23 LPFN_TRANSMITFILE transmitfile; 30 LPFN_TRANSMITFILE transmitfile;
24 31
27 static GUID tf_guid = WSAID_TRANSMITFILE; 34 static GUID tf_guid = WSAID_TRANSMITFILE;
28 35
29 36
30 int ngx_os_init(ngx_log_t *log) 37 int ngx_os_init(ngx_log_t *log)
31 { 38 {
32 u_int osviex; 39 u_int osviex;
33 DWORD bytes; 40 DWORD bytes;
34 SOCKET s; 41 SOCKET s;
35 WSADATA wsd; 42 WSADATA wsd;
36 OSVERSIONINFOEX osvi; 43 OSVERSIONINFOEX osvi;
44 ngx_osviex_stub_t *osviex_stub;
37 45
38 /* get Windows version */ 46 /* get Windows version */
39 47
40 ngx_memzero(&osvi, sizeof(OSVERSIONINFOEX)); 48 ngx_memzero(&osvi, sizeof(OSVERSIONINFOEX));
41 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); 49 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
73 81
74 if (osviex) { 82 if (osviex) {
75 ngx_win32_version += osvi.wServicePackMajor * 10 83 ngx_win32_version += osvi.wServicePackMajor * 10
76 + osvi.wServicePackMinor; 84 + osvi.wServicePackMinor;
77 85
86 /*
87 * the MSVC 6.0 SP2 defines wSuiteMask and wProductType
88 * as WORD wReserved[2]
89 */
90 osviex_stub = (ngx_osviex_stub_t *) &osvi.wServicePackMinor;
91
78 ngx_log_error(NGX_LOG_INFO, log, 0, 92 ngx_log_error(NGX_LOG_INFO, log, 0,
79 "OS: %u build:%u, \"%s\", suite:%x, type:%u", 93 "OS: %u build:%u, \"%s\", suite:%x, type:%u",
80 ngx_win32_version, osvi.dwBuildNumber, osvi.szCSDVersion, 94 ngx_win32_version, osvi.dwBuildNumber, osvi.szCSDVersion,
81 osvi.wReserved[0], osvi.wReserved[1]); 95 osviex_stub->wSuiteMask, osviex_stub->wProductType);
82
83 #if 0
84 ngx_log_error(NGX_LOG_INFO, log, 0,
85 "OS: %u build:%u, \"%s\", suite:%x, type:%u",
86 ngx_win32_version, osvi.dwBuildNumber, osvi.szCSDVersion,
87 osvi.wSuiteMask, osvi.wProductType);
88 #endif
89 96
90 } else { 97 } else {
91 if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { 98 if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
92 99
93 /* Win9x build */ 100 /* Win9x build */
119 126
120 if (WSAStartup(MAKEWORD(2,2), &wsd) != 0) { 127 if (WSAStartup(MAKEWORD(2,2), &wsd) != 0) {
121 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno, 128 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
122 "WSAStartup() failed"); 129 "WSAStartup() failed");
123 return NGX_ERROR; 130 return NGX_ERROR;
131 }
132
133 if (ngx_win32_version < NGX_WIN_NT) {
134 return NGX_OK;
124 } 135 }
125 136
126 /* get AcceptEx(), GetAcceptExSockAddrs() and TransmitFile() addresses */ 137 /* get AcceptEx(), GetAcceptExSockAddrs() and TransmitFile() addresses */
127 138
128 s = ngx_socket(AF_INET, SOCK_STREAM, IPPROTO_IP, 0); 139 s = ngx_socket(AF_INET, SOCK_STREAM, IPPROTO_IP, 0);