summaryrefslogtreecommitdiffstats
path: root/private/mvdm/wow32/wres32.c
blob: f5dd30b0d68dbce7c3949908233901a2275ec98e (plain) (blame)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*++
 *
 *  WOW v1.0
 *
 *  Copyright (c) 1991, Microsoft Corporation
 *
 *  WRES32.C
 *  WOW32 16-bit resource support
 *
 *  History:
 *  Created 11-Mar-1991 by Jeff Parsons (jeffpar)
--*/


#include "precomp.h"
#pragma hdrstop

MODNAME(wres32.c);

HANDLE APIENTRY W32FindResource(HANDLE hModule, LPCSTR lpType, LPCSTR lpName, WORD wLang)
{
    PRES p;

    //
    // If hModule is not ours, then make Win32 call and return the
    // result to USER.
    //

    if (LOWORD (hModule) == 0) {
        return (FindResourceEx(hModule, lpType, lpName, wLang));
    }
    else {
        WOW32ASSERT(GETHMOD16(hModule));
        p = FindResource16(GETHMOD16(hModule), (LPSTR)lpName, (LPSTR)lpType);
        return HRES32(p);
    }

}

HANDLE APIENTRY W32LoadResource(HANDLE hModule, HANDLE hResInfo)
{
    PRES p;

    //
    // If hModule is not ours, then make Win32 call and return the
    // result to USER.
    //

    if (ISINST16(hModule) && ISRES16(hResInfo)) {
        WOW32ASSERT(GETHMOD16(hModule));
        p = LoadResource16(GETHMOD16(hModule), GETHRES16(hResInfo));
        return HRES32(p);
    }
    else {
        return LoadResource(hModule, hResInfo);
    }
}


BOOL APIENTRY W32FreeResource(HANDLE hResData, HANDLE hModule)
{

    //
    // If hModule is not ours, then make Win32 call and return the
    // result to USER.
    //

    if ((LOWORD (hModule) != 0) && ISRES16(hResData)) {
        return FreeResource16(GETHRES16(hResData));
    }
    else {
        return (FreeResource(hResData));
    }
}


LPSTR APIENTRY W32LockResource(HANDLE hResData, HANDLE hModule)
{

    //
    // If hModule is not ours, then make Win32 call and return the
    // result to USER.
    //

    if ((LOWORD (hModule) != 0) && ISRES16(hResData)) {
        return LockResource16(GETHRES16(hResData));
    }
    else {
        return (LockResource(hResData));
    }
}


BOOL APIENTRY W32UnlockResource(HANDLE hResData, HANDLE hModule)
{

    //
    // If hModule is not ours, then make Win32 call and return the
    // result to USER.
    //

    if ((LOWORD (hModule) != 0) && ISRES16(hResData)) {
        return UnlockResource16(GETHRES16(hResData));
    }
    else {
        return (UnlockResource(hResData));
    }
}


DWORD APIENTRY W32SizeofResource(HANDLE hModule, HANDLE hResInfo)
{

    //
    // If hModule is not ours, then make Win32 call and return the
    // result to USER.
    //

    if ((LOWORD (hModule) != 0) && ISINST16(hModule) && ISRES16(hResInfo)) {
        WOW32ASSERT(GETHMOD16(hModule));
        return SizeofResource16(GETHMOD16(hModule), GETHRES16(hResInfo));
    }
    else {
        return (SizeofResource(hModule, hResInfo));
    }
}