summaryrefslogtreecommitdiffstats
path: root/private/mvdm/wow32/wparam.h
blob: a28afc21ac43e59acaf59dca823e2cc2b32d8c32 (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
/*++ BUILD Version: 0001
 *
 *  WOW v1.0
 *
 *  Copyright (c) 1991, Microsoft Corporation
 *
 *  WPARAM.H
 *  WOW32 16-bit handle alias support
 *
 *  History:
--*/

typedef enum ParamMode {
  PARAM_NONE,
  PARAM_16,
  PARAM_32
} ParamMode;

/* 
 *   FindParamMap
 *
 *      lpFindParam is for wparam.c use (set to NULL)
 *
 *      lParam is either 16-bit or 32-bit memory pointer
 *
 *      fMode is either param_16 or param_32
 *
 */


DWORD FindParamMap(VOID* lpFindParam, DWORD lParam, UINT fMode);

PVOID AddParamMap(DWORD dwPtr32, DWORD dwPtr16);

BOOL DeleteParamMap(DWORD lParam, UINT fMode, BOOL* pfFreePtr);

DWORD GetParam16(DWORD dwParam32);

BOOL W32CheckThunkParamFlag(void);

VOID FreeParamMap(HAND16 htask16);  

// Add dwPtr16 mapping for a parameter, which is allocated 
// size of the buffer is cbExtra and 32-bit pointer to the buffer
// is returned

PVOID AddParamMapEx(DWORD dwPtr16, DWORD cbExtra);

// Update node when pointer is suspect to have been moved
// returns updated pointer (32-bit)
PVOID ParamMapUpdateNode(DWORD dwPtr, UINT fMode, VOID* lpn);

VOID InitParamMap(VOID);

///////////////////////////////////////////////////////////////
//
// This is rather fast and dirty heap allocator
//

typedef struct tagBlkHeader *PBLKHEADER;

typedef struct tagBlkHeader {
    PBLKHEADER pNext;
    DWORD dwSize; // block size 
} BLKHEADER, *PBLKHEADER;

typedef struct tagBlkCache {
	LPBYTE pCache;
#ifdef DEBUG
	PBLKHEADER pCacheHead;
#endif
	PBLKHEADER pCacheFree;
	DWORD dwCacheSize;
	DWORD dwFlags;

} BLKCACHE, *PBLKCACHE;

LPVOID	CacheBlockAllocate	(PBLKCACHE pc, DWORD dwSize);
VOID 	CacheBlockFree		(PBLKCACHE pc, LPVOID lpv);
VOID     CacheBlockInit      (PBLKCACHE pc, DWORD dwCacheSize);


/////////////////////////////////////////////////////////////////