11/*
22 * Zadig: Automated Driver Installer for USB devices (GUI version)
33 * Networking functionality (web file download, check for update, etc.)
4- * Copyright © 2012-2014 Pete Batard <[email protected] > 4+ * Copyright © 2012-2016 Pete Batard <[email protected] > 55 *
66 * This program is free software: you can redistribute it and/or modify
77 * it under the terms of the GNU General Public License as published by
3131#include <inttypes.h>
3232
3333#include "msapi_utf8.h"
34+ #include "stdfn.h"
3435#include "zadig.h"
3536#include "zadig_registry.h"
3637#include "zadig_resource.h"
@@ -286,8 +287,9 @@ BOOL DownloadFile(const char* url, const char* file, HWND hProgressDialog)
286287 dprintf ("Network is unavailable: %s\n" , WinInetErrorString ());
287288 goto out ;
288289 }
289- _snprintf (agent , ARRAYSIZE (agent ), APPLICATION_NAME "/%d.%d.%d.%d" ,
290- application_version [0 ], application_version [1 ], application_version [2 ], application_version [3 ]);
290+ safe_sprintf (agent , ARRAYSIZE (agent ), APPLICATION_NAME "/%d.%d.%d (Windows NT %d.%d%s)" ,
291+ application_version [0 ], application_version [1 ], application_version [2 ],
292+ nWindowsVersion >> 4 , nWindowsVersion & 0x0F , is_x64 () ? "; WOW64" : "" );
291293 hSession = InternetOpenA (agent , INTERNET_OPEN_TYPE_PRECONFIG , NULL , NULL , 0 );
292294 if (hSession == NULL ) {
293295 dprintf ("Could not open internet session: %s\n" , WinInetErrorString ());
@@ -472,8 +474,9 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
472474 goto out ;
473475 hostname [sizeof (hostname )- 1 ] = 0 ;
474476
475- safe_sprintf (agent , ARRAYSIZE (agent ), APPLICATION_NAME "/%d.%d.%d.%d" ,
476- application_version [0 ], application_version [1 ], application_version [2 ], application_version [3 ]);
477+ safe_sprintf (agent , ARRAYSIZE (agent ), APPLICATION_NAME "/%d.%d.%d (Windows NT %d.%d%s)" ,
478+ application_version [0 ], application_version [1 ], application_version [2 ],
479+ nWindowsVersion >> 4 , nWindowsVersion & 0x0F , is_x64 () ? "; WOW64" : "" );
477480 hSession = InternetOpenA (agent , INTERNET_OPEN_TYPE_PRECONFIG , NULL , NULL , 0 );
478481 if (hSession == NULL )
479482 goto out ;
@@ -518,7 +521,7 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
518521 dwSize = sizeof (dwStatus );
519522 dwStatus = 404 ;
520523 HttpQueryInfoA (hRequest , HTTP_QUERY_STATUS_CODE |HTTP_QUERY_FLAG_NUMBER , (LPVOID )& dwStatus , & dwSize , NULL );
521- if (dwStatus == 200 )
524+ if (dwStatus == 200 )
522525 break ;
523526 InternetCloseHandle (hRequest );
524527 hRequest = NULL ;
@@ -553,7 +556,7 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
553556 if (!force_update_check ) {
554557 if ((local_time > server_time + 600 ) || (local_time < server_time - 600 )) {
555558 dprintf ("IMPORTANT: Your local clock is more than 10 minutes in the %s. Unless you fix this, "
556- APPLICATION_NAME " may not be able to check for updates..." ,
559+ APPLICATION_NAME " may not be able to check for updates..." ,
557560 (local_time > server_time + 600 )?"future" :"past" );
558561 }
559562 }
@@ -576,7 +579,7 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
576579 parse_update (buf , dwTotalSize + 1 );
577580
578581 vuprintf ("UPDATE DATA:\n" );
579- vuprintf (" version: %d.%d.%d.%d (%s)\n" , update .version [0 ], update .version [1 ],
582+ vuprintf (" version: %d.%d.%d.%d (%s)\n" , update .version [0 ], update .version [1 ],
580583 update .version [2 ], update .version [3 ], channel [k ]);
581584 vuprintf (" platform_min: %d.%d\n" , update .platform_min [0 ], update .platform_min [1 ]);
582585 vuprintf (" url: %s\n" , update .download_url );
0 commit comments