ReactOS 0.4.15-dev-7961-gdcf9eb0
ff_memory.h
Go to the documentation of this file.
1/*****************************************************************************
2 * FullFAT - High Performance, Thread-Safe Embedded FAT File-System *
3 * Copyright (C) 2009 James Walmsley (james@worm.me.uk) *
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 3 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, see <http://www.gnu.org/licenses/>. *
17 * *
18 * IMPORTANT NOTICE: *
19 * ================= *
20 * Alternative Licensing is available directly from the Copyright holder, *
21 * (James Walmsley). For more information consult LICENSING.TXT to obtain *
22 * a Commercial license. *
23 * *
24 * See RESTRICTIONS.TXT for extra restrictions on the use of FullFAT. *
25 * *
26 * Removing the above notice is illegal and will invalidate this license. *
27 *****************************************************************************
28 * See http://worm.me.uk/fullfat for more information. *
29 * Or http://fullfat.googlecode.com/ for latest releases and the wiki. *
30 *****************************************************************************/
31
38#ifndef _FF_MEMORY_H_
39#define _FF_MEMORY_H_
40
41#include "ff_config.h"
42#include "ff_types.h"
43
44#ifdef __REACTOS__
45// defined in fullfat.c
46void *FF_Malloc(FF_T_UINT32 allocSize);
47void FF_Free(void *pBuffer);
48#endif
49
50/*
51 HT changed type of aOffset to u32
52*/
53//---------- PROTOTYPES
54
55#if defined(FF_LITTLE_ENDIAN)
56
57typedef struct {
61
62typedef struct {
67} FF_T_LONG;
68
69#elif defined(FF_BIG_ENDIAN)
70
71typedef struct {
72 FF_T_UINT8 u8_1;
73 FF_T_UINT8 u8_0;
75
76typedef struct {
77 FF_T_UINT8 u8_3;
78 FF_T_UINT8 u8_2;
79 FF_T_UINT8 u8_1;
80 FF_T_UINT8 u8_0;
81} FF_T_LONG;
82
83#else
84
85#error Little or Big Endian? - Please set an endianess in ff_config.h
86
87#endif
88
90typedef union {
93} FF_T_UN16;
94
96typedef union {
99} FF_T_UN32;
100
101/* HT inlined these functions:
102 */
103
104#ifdef FF_INLINE_MEMORY_ACCESS
105
107{
108 return (FF_T_UINT8) (pBuffer[aOffset]);
109}
110
112{
114 pBuffer += aOffset;
115 u16.bytes.u8_1 = pBuffer[1];
116 u16.bytes.u8_0 = pBuffer[0];
117 return u16.u16;
118}
119
122 pBuffer += aOffset;
123 u32.bytes.u8_3 = pBuffer[3];
124 u32.bytes.u8_2 = pBuffer[2];
125 u32.bytes.u8_1 = pBuffer[1];
126 u32.bytes.u8_0 = pBuffer[0];
127 return u32.u32;
128}
129
131 pBuffer[aOffset] = Value;
132}
133
136 u16.u16 = Value;
137 pBuffer += aOffset;
138 pBuffer[0] = u16.bytes.u8_0;
139 pBuffer[1] = u16.bytes.u8_1;
140}
141
144 u32.u32 = Value;
145 pBuffer += aOffset;
146 pBuffer[0] = u32.bytes.u8_0;
147 pBuffer[1] = u32.bytes.u8_1;
148 pBuffer[2] = u32.bytes.u8_2;
149 pBuffer[3] = u32.bytes.u8_3;
150}
151
152#else
153
160
161
162#endif
163
164#endif
165
ULONG32 u32
Definition: btrfs.h:14
USHORT u16
Definition: btrfs.h:13
#define FF_INLINE
Definition: ff_config.h:130
FF_T_UINT16 FF_getShort(FF_T_UINT8 *pBuffer, FF_T_UINT32 aOffset)
void FF_putShort(FF_T_UINT8 *pBuffer, FF_T_UINT32 aOffset, FF_T_UINT16 Value)
void FF_putChar(FF_T_UINT8 *pBuffer, FF_T_UINT32 aOffset, FF_T_UINT8 Value)
FF_T_UINT8 FF_getChar(FF_T_UINT8 *pBuffer, FF_T_UINT32 aOffset)
void FF_putLong(FF_T_UINT8 *pBuffer, FF_T_UINT32 aOffset, FF_T_UINT32 Value)
FF_T_UINT32 FF_getLong(FF_T_UINT8 *pBuffer, FF_T_UINT32 aOffset)
unsigned char FF_T_UINT8
8 bit unsigned integer.
Definition: ff_types.h:51
unsigned short FF_T_UINT16
16 bit unsigned integer.
Definition: ff_types.h:56
unsigned long FF_T_UINT32
32 bit unsigned integer.
Definition: ff_types.h:61
PVOID pBuffer
#define u16
Definition: types.h:8
#define u32
Definition: types.h:9
FF_T_UINT8 u8_0
Definition: ff_memory.h:63
FF_T_UINT8 u8_1
Definition: ff_memory.h:64
FF_T_UINT8 u8_3
Definition: ff_memory.h:66
FF_T_UINT8 u8_2
Definition: ff_memory.h:65
FF_T_UINT8 u8_1
Definition: ff_memory.h:59
FF_T_UINT8 u8_0
Definition: ff_memory.h:58
16-bit union.
Definition: ff_memory.h:90
FF_T_SHORT bytes
Definition: ff_memory.h:92
FF_T_UINT16 u16
Definition: ff_memory.h:91
32-bit union.
Definition: ff_memory.h:96
FF_T_LONG bytes
Definition: ff_memory.h:98
FF_T_UINT32 u32
Definition: ff_memory.h:97
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413