[SOFT386]

- In the interface header soft386.h, do not include other particular headers (windows.h and debug.h). Those must be included by the different applications which also will include soft386.h.
- LPVOID --> PVOID (do it general, not just à-la Win32).
- The .c files include the headers, and each .c files must have its "#define NDEBUG\n#include <debug.h>" lines, to activate (or deactivate here in the example) debugging output.
- In the .c files, include the header windef.h for having the basic types, and temporarily comment out the needed #defines which will be needed if one needs to include other win***.h files. Those will be deleted if they aren't needed at the end.

svn path=/branches/ntvdm/; revision=59766
This commit is contained in:
Hermès Bélusca-Maïto 2013-08-17 21:15:55 +00:00
parent 99302b9d00
commit 2672ec8ee5
4 changed files with 26 additions and 20 deletions

View file

@ -9,11 +9,6 @@
#ifndef _SOFT386_H_
#define _SOFT386_H_
/* INCLUDES *******************************************************************/
#include <windows.h>
#include <debug.h>
/* DEFINES ********************************************************************/
#define SOFT386_NUM_GEN_REGS 8
@ -34,8 +29,7 @@
#define SOFT386_CR0_PG (1 << 31)
struct _SOFT386_STATE;
typedef struct _SOFT386_STATE SOFT386_STATE;
typedef struct _SOFT386_STATE *PSOFT386_STATE;
typedef struct _SOFT386_STATE SOFT386_STATE, *PSOFT386_STATE;
enum _SOFT386_GEN_REGS
{
@ -89,7 +83,7 @@ BOOLEAN
(
PSOFT386_STATE State,
ULONG Address,
LPVOID Buffer,
PVOID Buffer,
ULONG Size
);
@ -99,7 +93,7 @@ BOOLEAN
(
PSOFT386_STATE State,
ULONG Address,
LPVOID Buffer,
PVOID Buffer,
ULONG Size
);
@ -109,7 +103,7 @@ VOID
(
PSOFT386_STATE State,
ULONG Port,
LPVOID Buffer,
PVOID Buffer,
ULONG Size
);
@ -119,7 +113,7 @@ VOID
(
PSOFT386_STATE State,
ULONG Port,
LPVOID Buffer,
PVOID Buffer,
ULONG Size
);
@ -131,7 +125,7 @@ typedef union _SOFT386_REG
UCHAR HighByte;
};
USHORT LowWord;
ULONG Long;
ULONG Long;
} SOFT386_REG, *PSOFT386_REG;
typedef struct _SOFT386_SEG_REG
@ -185,7 +179,7 @@ typedef struct
typedef struct _SOFT386_TABLE_REG
{
USHORT Size;
ULONG Address;
ULONG Address;
} SOFT386_TABLE_REG, *PSOFT386_TABLE_REG;
typedef union _SOFT386_FLAGS_REG

View file

@ -8,8 +8,16 @@
/* INCLUDES *******************************************************************/
// #define WIN32_NO_STATUS
// #define _INC_WINDOWS
#include <windef.h>
#include <soft386.h>
#include "common.h"
// #define NDEBUG
#include <debug.h>
/* PRIVATE FUNCTIONS **********************************************************/
static
@ -100,7 +108,7 @@ Soft386ReadMemory(PSOFT386_STATE State,
else
{
/* Read the memory directly */
RtlMoveMemory(Buffer, (LPVOID)LinearAddress, Size);
RtlMoveMemory(Buffer, (PVOID)LinearAddress, Size);
}
return TRUE;
@ -177,7 +185,7 @@ Soft386WriteMemory(PSOFT386_STATE State,
else
{
/* Write the memory directly */
RtlMoveMemory((LPVOID)LinearAddress, Buffer, Size);
RtlMoveMemory((PVOID)LinearAddress, Buffer, Size);
}
return TRUE;
@ -344,7 +352,7 @@ Soft386LoadSegment(PSOFT386_STATE State, INT Segment, WORD Selector)
else
{
RtlMoveMemory(&GdtEntry,
(LPVOID)(State->Gdtr.Address
(PVOID)(State->Gdtr.Address
+ GET_SEGMENT_INDEX(Selector)),
sizeof(GdtEntry));
}

View file

@ -9,10 +9,6 @@
#ifndef _COMMON_H_
#define _COMMON_H_
/* INCLUDES *******************************************************************/
#include <soft386.h>
/* DEFINES ********************************************************************/
#define GET_SEGMENT_RPL(s) ((s) & 3)

View file

@ -8,8 +8,16 @@
/* INCLUDES *******************************************************************/
// #define WIN32_NO_STATUS
// #define _INC_WINDOWS
#include <windef.h>
#include <soft386.h>
#include "common.h"
// #define NDEBUG
#include <debug.h>
/* DEFINES ********************************************************************/
typedef enum