summaryrefslogtreecommitdiffstats
path: root/src/windows/leash/VSroutines.c
blob: 63f0b4ae191a7f63ae4c70b57fb7f6835154ddab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <windows.h>
#include <winver.h>

#if 0
//#ifdef USE_VS
#include <vs.h>

#define ININAME	"leash.ini"

int VScheckVersion(HWND hWnd, HANDLE hThisInstance)
{
    VS_Request		vrequest;
    VS_Status		status;
    BOOL		ok_to_continue;
    HCURSOR		hcursor;
    char		szFilename[255];
    char		szVerQ[90];
    char		*cp;
    LPSTR		lpAppVersion;
    LPSTR		lpAppName;
    LONG FAR		*lpLangInfo;
    DWORD		hVersionInfoID;
    DWORD		size;
    GLOBALHANDLE	hVersionInfo;
    LPSTR		lpVersionInfo;
    int			dumint;
    int			retval;

    GetModuleFileName(hThisInstance, (LPSTR)szFilename, 255);
    size = GetFileVersionInfoSize((LPSTR) szFilename, &hVersionInfoID);
    hVersionInfo = GlobalAlloc(GHND, size);
    lpVersionInfo = GlobalLock(hVersionInfo);
    retval = GetFileVersionInfo(szFilename, hVersionInfoID, size,
                                lpVersionInfo);
    retval = VerQueryValue(lpVersionInfo, "\\VarFileInfo\\Translation",
                           (LPSTR FAR *)&lpLangInfo, &dumint);
    wsprintf(szVerQ, "\\StringFileInfo\\%04x%04x\\",
             LOWORD(*lpLangInfo), HIWORD(*lpLangInfo));
    cp = szVerQ + lstrlen(szVerQ);
    lstrcpy(cp, "ProductName");
    retval = VerQueryValue(lpVersionInfo, szVerQ, &lpAppName, &dumint);
    lstrcpy(cp, "ProductVersion");

    retval = VerQueryValue(lpVersionInfo, szVerQ, &lpAppVersion, &dumint);
    hcursor = SetCursor(LoadCursor((HINSTANCE)NULL, IDC_WAIT));
    vrequest = VSFormRequest(lpAppName, lpAppVersion, ININAME, NULL, hWnd,
                             V_CHECK_AND_LOG);
    if ((ok_to_continue = (ReqStatus(vrequest) != V_E_CANCEL))
        && v_complain((status = VSProcessRequest(vrequest)), ININAME))
        WinVSReportRequest(vrequest, hWnd, "Version Server Status Report");
    if (ok_to_continue && status == V_REQUIRED)
        ok_to_continue = FALSE;
    VSDestroyRequest(vrequest);
    SetCursor(hcursor);
    GlobalUnlock(hVersionInfo);
    GlobalFree(hVersionInfo);
    return(ok_to_continue);
}
#else
int VScheckVersion(HWND hWnd, HANDLE hThisInstance)
{
    return(1);
}
#endif