1
/* $Id: wingenminiupnpcstrings.c,v 1.1 2009/12/10 18:46:15 nanard Exp $ */
3
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
4
* Author: Thomas Bernard
5
* Copyright (c) 2005-2009 Thomas Bernard
6
* This software is subjects to the conditions detailed
7
* in the LICENSE file provided within this distribution */
11
/* This program display the Windows version and is used to
12
* generate the miniupnpcstrings.h
13
* wingenminiupnpcstrings miniupnpcstrings.h.in miniupnpcstrings.h
15
int main(int argc, char * * argv) {
22
The major version number of the operating system. For more information, see Remarks.
24
The minor version number of the operating system. For more information, see Remarks.
26
The build number of the operating system.
28
The operating system platform. This member can be the following value.
30
A null-terminated string, such as "Service Pack 3", that indicates the
31
latest Service Pack installed on the system. If no Service Pack has
32
been installed, the string is empty.
34
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
35
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
39
printf("Windows %lu.%lu Build %lu %s\n",
40
osvi.dwMajorVersion, osvi.dwMinorVersion,
41
osvi.dwBuildNumber, (const char *)&(osvi.szCSDVersion));
44
fin = fopen(argv[1], "r");
46
fprintf(stderr, "Cannot open %s for reading.\n", argv[1]);
49
fout = fopen(argv[2], "w");
51
fprintf(stderr, "Cannot open %s for writing.\n", argv[2]);
55
while(fgets(buffer, sizeof(buffer), fin)) {
56
if(0 == memcmp(buffer, "#define OS_STRING \"OS/version\"", 30)) {
57
sprintf(buffer, "#define OS_STRING \"MSWindows/%ld.%ld.%ld\"\n",
58
osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber);
60
/*fputs(buffer, stdout);*/
66
printf("%d lines written to %s.\n", n, argv[2]);