30 #ifdef HAVE_SYS_UTSNAME_H 31 # include <sys/utsname.h> 45 #if defined(HAVE_UNAME) 53 BOOL bOsVersionInfoEx;
54 BOOL bSomeError = FALSE;
61 #if defined(HAVE_UNAME) 63 config->
os_name = strdup(un.sysname);
69 ZeroMemory(&osvi,
sizeof(OSVERSIONINFOEX));
70 osvi.dwOSVersionInfoSize =
sizeof(OSVERSIONINFOEX);
71 if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) )
75 osvi.dwOSVersionInfoSize =
sizeof (OSVERSIONINFO);
76 if (! GetVersionEx ( (OSVERSIONINFO *) &osvi) )
78 snprintf(sysname, 64,
"unknown");
84 switch (osvi.dwPlatformId)
86 case VER_PLATFORM_WIN32_NT:
88 if ( osvi.dwMajorVersion <= 4 )
89 snprintf(sysname, 64,
"Microsoft Windows NT");
91 if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 )
92 snprintf(sysname, 64,
"Microsoft Windows 2000");
94 if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
95 snprintf(sysname, 64,
"Microsoft Windows XP");
99 if( bOsVersionInfoEx )
101 if ( osvi.wProductType == VER_NT_WORKSTATION )
103 if( osvi.wSuiteMask & VER_SUITE_PERSONAL )
104 snprintf(release, 64,
"Personal" );
106 snprintf(release, 64,
"Professional" );
109 else if ( osvi.wProductType == VER_NT_SERVER )
111 if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
112 snprintf(release, 64,
"DataCenter Server" );
113 else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
114 snprintf(release, 64,
"Advanced Server" );
116 snprintf(release, 64,
"Server" );
122 char szProductType[80];
125 RegOpenKeyEx( HKEY_LOCAL_MACHINE,
126 "SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
127 0, KEY_QUERY_VALUE, &hKey );
128 RegQueryValueEx( hKey,
"ProductType", NULL, NULL,
129 (LPBYTE) szProductType, &dwBufLen);
131 if ( lstrcmpi(
"WINNT", szProductType) == 0 )
132 snprintf(release, 64,
"Professional" );
133 if ( lstrcmpi(
"LANMANNT", szProductType) == 0 )
134 snprintf(release, 64,
"Server" );
135 if ( lstrcmpi(
"SERVERNT", szProductType) == 0 )
136 snprintf(release, 64,
"Advanced Server" );
140 case VER_PLATFORM_WIN32_WINDOWS:
142 if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
144 snprintf(sysname, 64,
"Microsoft Windows 95");
145 if ( osvi.szCSDVersion[1] ==
'C' || osvi.szCSDVersion[1] ==
'B' )
146 snprintf(release, 64,
"OSR2" );
149 if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)
151 snprintf(sysname, 64,
"Microsoft Windows 98");
152 if ( osvi.szCSDVersion[1] ==
'A' )
153 snprintf(release, 64,
"SE" );
156 if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
158 snprintf(sysname, 64,
"Microsoft Windows Me");
162 case VER_PLATFORM_WIN32s:
164 snprintf(sysname, 64,
"Microsoft Win32s");
169 config->
os_name = strdup(sysname);
193 snprintf(buf, 256,
"%s", config->
os_name);
266 if(mod->
init)
return 0;
pkt_type_t type
packet type
int sm_register_ns(sm_t sm, const char *uri)
register a new global ns
int nad_append_attr(nad_t nad, int ns, const char *name, const char *val)
attach new attr to the last elem
data structures and prototypes for the session manager
void sm_unregister_ns(sm_t sm, const char *uri)
unregister a global ns
pkt_t pkt_tofrom(pkt_t pkt)
swap a packet's to and from attributes
single instance of a module in a chain
void nad_set_attr(nad_t nad, unsigned int elem, int ns, const char *name, const char *val, int vallen)
create, update, or zap any matching attr on this elem
void nad_append_cdata(nad_t nad, const char *cdata, int len, int depth)
append new cdata to the last elem
int init
number of times the module intialiser has been called
struct _mod_iq_version_config_st * mod_iq_version_config_t
int nad_add_namespace(nad_t nad, const char *uri, const char *prefix)
bring a new namespace into scope
void _iq_version_get_os_version(mod_iq_version_config_t config)
int nad_insert_elem(nad_t nad, unsigned int parent, int ns, const char *name, const char *cdata)
shove in a new child elem after the given one
int nad_append_elem(nad_t nad, int ns, const char *name, int depth)
create a new elem on the list
DLLEXPORT int module_init(mod_instance_t mi, const char *arg)
static void _iq_version_disco_extend(mod_instance_t mi, pkt_t pkt)
static mod_ret_t _iq_version_pkt_sm(mod_instance_t mi, pkt_t pkt)
module_t mod
module that this is an instance of
void feature_unregister(sm_t sm, const char *feature)
unregister feature
void * private
module private data
packet summary data wrapper
nad_t nad
nad of the entire packet
void pkt_router(pkt_t pkt)
void feature_register(sm_t sm, const char *feature)
register a feature
packet was unhandled, should be passed to the next module
packet was handled (and freed)
char signature[2048]
server signature
mod_ret_t(* pkt_sm)(mod_instance_t mi, pkt_t pkt)
pkt-sm handler
void(* disco_extend)(mod_instance_t mi, pkt_t pkt)
disco-extend handler
void(* free)(module_t mod)
called when module is freed
mod_ret_t
module return values
static void _iq_version_free(module_t mod)