Subversion Repositories filter_foundry

Rev

Rev 194 | Rev 214 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
193 daniel-mar 1
/*
2
        This file is part of a common library
3
    Copyright (C) 2002-6 Toby Thain, toby@telegraphics.com.au
4
 
5
    This program is free software; you can redistribute it and/or modify
6
    it under the terms of the GNU General Public License as published by
7
    the Free Software Foundation; either version 2 of the License, or
8
    (at your option) any later version.
9
 
10
    This program is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
    GNU General Public License for more details.
14
 
15
    You should have received a copy of the GNU General Public License
16
    along with this program; if not, write to the Free Software
17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
*/
19
 
20
#include <windows.h>
21
 
22
#include "compat_win.h"
23
 
24
Boolean isWin32NT(void){
25
        OSVERSIONINFO osv;
26
 
27
        osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
28
        return GetVersionEx(&osv) && osv.dwPlatformId == VER_PLATFORM_WIN32_NT;
29
}
30
 
31
// ---------------------------------
32
 
33
typedef HANDLE(__stdcall *f_BeginUpdateResourceA)(
34
  LPCSTR pFileName,
35
  BOOL   bDeleteExistingResources
36
);
37
HANDLE _BeginUpdateResource/*A*/(
38
  LPCSTR pFileName,
39
  BOOL   bDeleteExistingResources
40
) {
41
        HMODULE hLib;
42
        f_BeginUpdateResourceA fBeginUpdateResourceA;
43
        HANDLE res;
44
 
45
        hLib = LoadLibraryA(isWin32NT() ? "KERNEL32.DLL" : "UNICOWS.DLL");
46
        if (!hLib) return 0;
194 daniel-mar 47
        fBeginUpdateResourceA = (f_BeginUpdateResourceA)(void*)GetProcAddress(hLib, "BeginUpdateResourceA");
193 daniel-mar 48
        res = fBeginUpdateResourceA(pFileName, bDeleteExistingResources);
49
        FreeLibrary(hLib);
50
 
51
        return res;
52
}
53
 
54
// ---------------------------------
55
 
56
typedef BOOL(__stdcall *f_EndUpdateResourceA)(
57
  HANDLE hUpdate,
58
  BOOL   fDiscard
59
);
60
 
61
BOOL _EndUpdateResource/*A*/(
62
  HANDLE hUpdate,
63
  BOOL   fDiscard
64
) {
65
        HMODULE hLib;
66
        f_EndUpdateResourceA fEndUpdateResourceA;
67
        BOOL res;
68
 
69
        hLib = LoadLibraryA(isWin32NT() ? "KERNEL32.DLL" : "UNICOWS.DLL");
70
        if (!hLib) return 0;
195 daniel-mar 71
        fEndUpdateResourceA = (f_EndUpdateResourceA)(void*)GetProcAddress(hLib, "EndUpdateResourceA");
193 daniel-mar 72
        res = fEndUpdateResourceA(hUpdate, fDiscard);
73
        FreeLibrary(hLib);
74
 
75
        return res;
76
}
77
 
78
// ---------------------------------
79
 
80
typedef BOOL(__stdcall *f_UpdateResourceA)(
81
  HANDLE hUpdate,
82
  LPCSTR lpType,
83
  LPCSTR lpName,
84
  WORD   wLanguage,
85
  LPVOID lpData,
86
  DWORD  cb
87
);
88
BOOL _UpdateResource/*A*/(
89
  HANDLE hUpdate,
90
  LPCSTR lpType,
91
  LPCSTR lpName,
92
  WORD   wLanguage,
93
  LPVOID lpData,
94
  DWORD  cb
95
) {
96
        HMODULE hLib;
97
        f_UpdateResourceA fUpdateResourceA;
98
        BOOL res;
99
 
100
        hLib = LoadLibraryA(isWin32NT() ? "KERNEL32.DLL" : "UNICOWS.DLL");
101
        if (!hLib) return 0;
195 daniel-mar 102
        fUpdateResourceA = (f_UpdateResourceA)(void*)GetProcAddress(hLib, "UpdateResourceA");
193 daniel-mar 103
        res = fUpdateResourceA(hUpdate, lpType, lpName, wLanguage, lpData, cb);
104
        FreeLibrary(hLib);
105
 
106
        return res;
107
}