//Заголоки DDRAW, только те которые нужны для примера

// Для вызова COM объекта использовал функцию из примера USECOM.C--
//Вызова делается так:
//COMMETHOD(<dword; интерфейс COM>,#I<Имя структуры COM интерфейса>.<Имя функции>,<Парметры функции через запятую>);

dword retadr;
stdcall COMETHOD (EAX,EBX,...);
stdcall COMETHOD (EAX,EBX,...)
{
	EDX=EAX;
	EAX=DSDWORD[DSDWORD[EAX]+EBX];
	$pop retadr
	EAX(EDX);
	goto retadr;
}

//Описывем внешнию функцю DirectSound
extern WINAPI "DDRAW.DLL"
{
dword  DirectDrawCreate(DWORD PGUID, lplpDD, pUnkOuter);
}

struct IDirectDraw
{
//-----------------------------
// IUnknown methods
    DWORD QueryInterface;
    DWORD AddRef;
    DWORD Release;
//----------------------------
// IDirectDraw methods
    DWORD    Compact;
    DWORD    CreateClipper;
    DWORD    CreatePalette;
    DWORD    CreateSurface;
    DWORD    DuplicateSurface;
    DWORD    EnumDisplayModes;
    DWORD    EnumSurfaces;
    DWORD    FlipToGDISurface;
    DWORD    GetCaps;
    DWORD    GetDisplayMode;
    DWORD    GetFourCCCodes;
    DWORD    GetGDISurface;
    DWORD    GetMonitorFrequency;
    DWORD    GetScanLine;
    DWORD    GetVerticalBlankStatus;
    DWORD    Initialize;
    DWORD    RestoreDisplayMode;
    DWORD    SetCooperativeLevel;
    DWORD    SetDisplayMode;
    DWORD    WaitForVerticalBlank;
    // Added in the v2 interface
    DWORD    GetAvailableVidMem;
    // Added in the V4 Interface
    DWORD    GetSurfaceFromDC;
    DWORD    RestoreAllSurfaces;
    DWORD    TestCooperativeLevel;
    DWORD    GetDeviceIdentifier;
    // Added in the V7 Interface
    DWORD    StartModeTest;
    DWORD    EvaluateMode;

};

struct IDirectDrawSurface
{
//-----------------------------
// IUnknown methods
    DWORD QueryInterface;
    DWORD AddRef;
    DWORD Release;
//----------------------------
// IDirectDrawSurface7 methods
    DWORD     AddAttachedSurface;
    DWORD     AddOverlayDirtyRect;
    DWORD     Blt;
    DWORD     BltBatch;
    DWORD     BltFast;
    DWORD     DeleteAttachedSurface;
    DWORD     EnumAttachedSurfaces;
    DWORD     EnumOverlayZOrders;
    DWORD     Flip;
    DWORD     GetAttachedSurface;
    DWORD     GetBltStatus;
    DWORD     GetCaps;
    DWORD     GetClipper;
    DWORD     GetColorKey;
    DWORD     GetDC;
    DWORD     GetFlipStatus;
    DWORD     GetOverlayPosition;
    DWORD     GetPalette;
    DWORD     GetPixelFormat;
    DWORD     GetSurfaceDesc;
    DWORD     Initialize;
    DWORD     IsLost;
    DWORD     Lock;
    DWORD     ReleaseDC;
    DWORD     Restore;
    DWORD     SetClipper;
    DWORD     SetColorKey;
    DWORD     SetOverlayPosition;
    DWORD     SetPalette;
    DWORD     Unlock;
    DWORD     UpdateOverlay;
    DWORD     UpdateOverlayDisplay;
    DWORD     UpdateOverlayZOrder;
   // Added in the v2 interface
    DWORD     GetDDInterface;
    DWORD     PageLock;
    DWORD     PageUnlock;
   // Added in the V3 interface
    DWORD     SetSurfaceDesc;
   // Added in the v4 interface
    DWORD     SetPrivateData;
    DWORD     GetPrivateData;
    DWORD     FreePrivateData;
    DWORD     GetUniquenessValue;
    DWORD     ChangeUniquenessValue;
   // Moved Texture7 methods here ***/
    DWORD     SetPriority;
    DWORD     GetPriority;
    DWORD     SetLOD;
    DWORD     GetLOD;
};

struct IDirectDrawClipper
{
//-----------------------------
// IUnknown methods
    DWORD QueryInterface;
    DWORD AddRef;
    DWORD Release;
//----------------------------
// IDirectDrawClipper methods
    DWORD	GetClipList;
    DWORD	GetHWnd;
    DWORD	Initialize;
    DWORD	IsClipListChanged;
    DWORD	SetClipList;
    DWORD	SetHWnd;
};

struct   IDirectDrawPalette
{
//-----------------------------
// IUnknown methods
    DWORD QueryInterface;
    DWORD AddRef;
    DWORD Release;
//----------------------------
//IDirectDrawPalette methods
    DWORD GetCaps;
    DWORD GetEntries;
    DWORD Initialize;
    DWORD SetEntries;
};

struct DDPIXELFORMAT
{
    DWORD 	dwSize;    //size of structure
    DWORD	dwFlags;   //pixel format flags
    DWORD	dwFourCC;  //(FOURCC code)
    union
    {
    DWORD	dwRGBBitCount			; //how many bits per pixel
    DWORD	dwYUVBitCount			; //how many bits per pixel
    DWORD	dwZBufferBitDepth		; //how many total bits/pixel in z buffer (including any stencil bits)
    DWORD	dwAlphaBitDepth			; //how many bits for alpha channels
    DWORD	dwLuminanceBitCount		; //how many bits per pixel
    DWORD	dwBumpBitCount			; //how many bits per "buxel", total
   };
    union
    {
    DWORD	dwRBitMask;         //mask for red bit
    DWORD	dwYBitMask;         //mask for Y bits
    DWORD	dwStencilBitDepth;  //how many stencil bits (note: dwZBufferBitDepth-dwStencilBitDepth is total Z-only bits)
    DWORD	dwLuminanceBitMask; //mask for luminance bits
    DWORD	dwBumpDuBitMask;    //mask for bump map U delta bits
   };
    union
    {
    DWORD      dwGBitMask;          //mask for green bits
    DWORD      dwUBitMask;          //mask for U bits
    DWORD      dwZBitMask;          //mask for Z bits
    DWORD      dwBumpDvBitMask;     //mask for bump map V delta bits
   };
    union
    {
    DWORD      dwBBitMask;                      //mask for blue bits
    DWORD      dwVBitMask;                      //mask for V bits
    DWORD      dwStencilBitMask;                //mask for stencil bits
    DWORD      dwBumpLuminanceBitMask;          //mask for luminance in bump map
   };
    union
    {
    DWORD      dwRGBAlphaBitMask;          //mask for alpha channel
    DWORD      dwYUVAlphaBitMask;          //mask for alpha channel
    DWORD      dwLuminanceAlphaBitMask;    //mask for alpha channel
    DWORD      dwRGBZBitMask;              //mask for Z channel
    DWORD      dwYUVZBitMask;              //mask for Z channel
   };
};

struct DDCOLORKEY
{
    DWORD      dwColorSpaceLowValue;         //be treated as Color Key, inclusive
    DWORD      dwColorSpaceHighValue;        //high boundary of color space that is
};

struct DDSCAPS
{
    DWORD     dwCaps;          //capabilities of surface wanted
};

// DDSCAPS2
struct DDSCAPS2
{
    DWORD     dwCaps;          //capabilities of surface wanted
    DWORD     dwCaps2;
    DWORD     dwCaps3;
    DWORD     dwCaps4;
};

// DDSURFACEDESC
struct DDSURFACEDESC
{
DWORD	dwSize;    //size of the DDSURFACEDESC structure
DWORD	dwFlags;   //determines what fields are valid
DWORD	dwHeight;  //height of surface to be created
DWORD	dwWidth;   //width of input surface

    union
    {
      DWORD  lPitch;            //distance to start of next line (return value only)
      DWORD  dwLinearSize;      //Formless late-allocated optimized surface size
     };

DWORD	dwBackBufferCount;      //number of back buffers requested

    union
    {
      DWORD  dwMipMapCount;     //number of mip-map levels requested
      DWORD  dwZBufferBitDepth; //depth of Z buffer requested
      DWORD  dwRefreshRate;     //refresh rate (used when display mode is described)
    };

DWORD	dwAlphaBitDepth;       //depth of alpha buffer requested
DWORD	dwReserved;            //reserved
DWORD	lpSurface;             //pointer to the associated surface memory

DDCOLORKEY ddckCKDestOverlay;  //color key for destination overlay use
DDCOLORKEY ddckCKDestBlt;      //color key for destination blt use
DDCOLORKEY ddckCKSrcOverlay;   //color key for source overlay use
DDCOLORKEY ddckCKSrcBlt;       //color key for source blt use

DDPIXELFORMAT  ddpfPixelFormat; //pixel format description of the surface
DDSCAPS ddsCaps;
};



//DDBLTFX
//Used to pass override information to the DIRECTDRAWSURFACE callback Blt.
struct DDBLTFX
{
DWORD   dwSize;                 //size of structure
DWORD   dwDDFX;                 //FX operations
DWORD   dwROP;                  //Win32 raster operations
DWORD   dwDDROP;                //Raster operations new for DirectDraw
DWORD   dwRotationAngle;        //Rotation angle for blt
DWORD   dwZBufferOpCode;        //ZBuffer compares
DWORD   dwZBufferLow;           //Low limit of Z buffer
DWORD   dwZBufferHigh;          //High limit of Z buffer
DWORD   dwZBufferBaseDest;      //Destination base value
DWORD   dwZDestConstBitDepth;   //Bit depth used to specify Z constant for destination
    union
    {
	DWORD   dwZDestConst;       //Constant to use as Z buffer for dest
	DWORD   lpDDSZBufferDest;   //LPDIRECTDRAWSURFACE Surface to use as Z buffer for dest
    };

DWORD   dwZSrcConstBitDepth;        //Bit depth used to specify Z constant for source

    union
    {
        DWORD   dwZSrcConst;               //Constant to use as Z buffer for src
        DWORD   lpDDSZBufferSrc;           //LPDIRECTDRAWSURFACE Surface to use as Z buffer for src
    };

DWORD   dwAlphaEdgeBlendBitDepth;          //Bit depth used to specify constant for alpha edge blend
DWORD   dwAlphaEdgeBlend;                  //Alpha for edge blending
DWORD   dwReserved;                        //
DWORD   dwAlphaDestConstBitDepth;          //Bit depth used to specify alpha constant for destination

    union
    {
        DWORD   dwAlphaDestConst;          //Constant to use as Alpha Channel
        DWORD   lpDDSAlphaDest;            //Surface to use as Alpha Channel
    };

DWORD   dwAlphaSrcConstBitDepth;           //Bit depth used to specify alpha constant for source

    union
    {
        DWORD   dwAlphaSrcConst;           //Constant to use as Alpha Channel
        DWORD   lpDDSAlphaSrc;             //Surface to use as Alpha Channel
    };


    union
    {
        DWORD   dwFillColor;               //color in RGB or Palettized
        DWORD   dwFillDepth;               //depth value for z-buffer
        DWORD   dwFillPixel;               //pixel value for RGBA or RGBZ
        DWORD   lpDDSPattern;              //Surface to use as pattern
    };

DDCOLORKEY ddckDestColorkey;                //DestColorkey override
DDCOLORKEY ddckSrcColorkey;                 //SrcColorkey override

}



// DIRECTDRAW WAITFORVERTICALBLANK FLAGS

//return when the vertical blank interval begins
#define  DDWAITVB_BLOCKBEGIN                     0x00000001

// set up an event to trigger when the vertical blank begins
#define  DDWAITVB_BLOCKBEGINEVENT                0x00000002

// return when the vertical blank interval ends and display begins
#define  DDWAITVB_BLOCKEND                       0x00000004



//is the blt to the surface finished?

#define  DDGBS_ISBLTDONE                         0x00000002


// SetCooperativeLevel flags

#define DDSCL_FULLSCREEN            0x00000001
#define DDSCL_ALLOWREBOOT           0x00000002
#define DDSCL_NOWINDOWCHANGES       0x00000004
#define DDSCL_NORMAL	            0x00000008
#define DDSCL_EXCLUSIVE             0x00000010
#define DDSCL_ALLOWMODEX            0x00000040

// Blt flags

#define DDBLT_ALPHADEST 		      0x00000001
#define DDBLT_ALPHADESTCONSTOVERRIDE	      0x00000002
#define DDBLT_ALPHADESTNEG		      0x00000004
#define DDBLT_ALPHADESTSURFACEOVERRIDE	      0x00000008
#define DDBLT_ALPHAEDGEBLEND		      0x00000010
#define DDBLT_ALPHASRC			      0x00000020
#define DDBLT_ALPHASRCCONSTOVERRIDE	      0x00000040
#define DDBLT_ALPHASRCNEG		      0x00000080
#define DDBLT_ALPHASRCSURFACEOVERRIDE	      0x00000100
#define DDBLT_ASYNC			      0x00000200
#define DDBLT_COLORFILL 		      0x00000400
#define DDBLT_DDFX			      0x00000800
#define DDBLT_DDROPS			      0x00001000
#define DDBLT_KEYDEST			      0x00002000
#define DDBLT_KEYDESTOVERRIDE		      0x00004000
#define DDBLT_KEYSRC			      0x00008000
#define DDBLT_KEYSRCOVERRIDE		      0x00010000
#define DDBLT_ROP			      0x00020000
#define DDBLT_ROTATIONANGLE		      0x00040000
#define DDBLT_ZBUFFER			      0x00080000
#define DDBLT_ZBUFFERDESTCONSTOVERRIDE	      0x00100000
#define DDBLT_ZBUFFERDESTOVERRIDE	      0x00200000
#define DDBLT_ZBUFFERSRCCONSTOVERRIDE	      0x00400000
#define DDBLT_ZBUFFERSRCOVERRIDE	      0x00800000
#define DDBLT_WAIT			      0x01000000
#define DDBLT_DEPTHFILL 		      0x02000000

// BltFast flags

#define DDBLTFAST_NOCOLORKEY	      0x00000000
#define DDBLTFAST_SRCCOLORKEY	      0x00000001
#define DDBLTFAST_DESTCOLORKEY	      0x00000002
#define DDBLTFAST_WAIT		      0x00000010

// Flip flags

#define DDFLIP_WAIT        0x00000001
#define DDFLIP_EVEN        0x00000002
#define DDFLIP_ODD         0x00000004

#define DDSD_CAPS	           0x00000001
#define DDSD_HEIGHT	           0x00000002
#define DDSD_WIDTH	           0x00000004
#define DDSD_PITCH	           0x00000008
#define DDSD_BACKBUFFERCOUNT       0x00000020
#define DDSD_ZBUFFERBITDEPTH       0x00000040
#define DDSD_ALPHABITDEPTH         0x00000080
#define DDSD_LPSURFACE	           0x00000800
#define DDSD_PIXELFORMAT           0x00001000
#define DDSD_CKDESTOVERLAY         0x00002000
#define DDSD_CKDESTBLT	           0x00004000
#define DDSD_CKSRCOVERLAY          0x00008000
#define DDSD_CKSRCBLT	           0x00010000
#define DDSD_MIPMAPCOUNT           0x00020000
#define DDSD_REFRESHRATE           0x00040000
#define DDSD_LINEARSIZE            0x00080000
#define DDSD_ALL	           0x000FF9EE

// DirectDrawSurface capability flags

#define DDSCAPS_RESERVED1	         0x00000001
#define DDSCAPS_ALPHA		         0x00000002
#define DDSCAPS_BACKBUFFER	         0x00000004
#define DDSCAPS_COMPLEX 	         0x00000008
#define DDSCAPS_FLIP		         0x00000010
#define DDSCAPS_FRONTBUFFER	         0x00000020
#define DDSCAPS_OFFSCREENPLAIN	         0x00000040
#define DDSCAPS_OVERLAY 	         0x00000080
#define DDSCAPS_PALETTE 	         0x00000100
#define DDSCAPS_PRIMARYSURFACE	         0x00000200
#define DDSCAPS_PRIMARYSURFACELEFT       0x00000400
#define DDSCAPS_SYSTEMMEMORY	         0x00000800
#define DDSCAPS_TEXTURE 	         0x00001000
#define DDSCAPS_3DDEVICE	         0x00002000
#define DDSCAPS_VIDEOMEMORY	         0x00004000
#define DDSCAPS_VISIBLE 	         0x00008000
#define DDSCAPS_WRITEONLY	         0x00010000
#define DDSCAPS_ZBUFFER 	         0x00020000
#define DDSCAPS_OWNDC		         0x00040000
#define DDSCAPS_LIVEVIDEO	         0x00080000
#define DDSCAPS_HWCODEC 	         0x00100000
#define DDSCAPS_MODEX		         0x00200000
#define DDSCAPS_MIPMAP		         0x00400000
#define DDSCAPS_RESERVED2	         0x00800000
#define DDSCAPS_ALLOCONLOAD	         0x04000000
#define DDSCAPS_VIDEOPORT	         0x08000000
#define DDSCAPS_LOCALVIDMEM	         0x10000000
#define DDSCAPS_NONLOCALVIDMEM	         0x20000000
#define DDSCAPS_STANDARDVGAMODE          0x40000000
#define DDSCAPS_OPTIMIZED	         0x80000000

// DirectDrawSurface lock flags

#define DDLOCK_SURFACEMEMORYPTR        0x00000000
#define DDLOCK_WAIT		       0x00000001
#define DDLOCK_EVENT		       0x00000002
#define DDLOCK_READONLY 	       0x00000010
#define DDLOCK_WRITEONLY	       0x00000020
#define DDLOCK_NOSYSLOCK	       0x00000800

// DirectDrawPalette capabilities

#define DDPCAPS_4BIT		         0x00000001
#define DDPCAPS_8BITENTRIES	         0x00000002
#define DDPCAPS_8BIT		         0x00000004
#define DDPCAPS_INITIALIZE	         0x00000008
#define DDPCAPS_PRIMARYSURFACE	         0x00000010
#define DDPCAPS_PRIMARYSURFACELEFT       0x00000020
#define DDPCAPS_ALLOW256	         0x00000040
#define DDPCAPS_VSYNC		         0x00000080
#define DDPCAPS_1BIT		         0x00000100
#define DDPCAPS_2BIT		         0x00000200

// DirectDraw errors

#define DDERR_ALREADYINITIALIZED	       0x88760000+5
#define DDERR_CANNOTATTACHSURFACE	       0x88760000+10
#define DDERR_CANNOTDETACHSURFACE	       0x88760000+20
#define DDERR_CURRENTLYNOTAVAIL 	       0x88760000+40
#define DDERR_EXCEPTION 		       0x88760000+55
#define DDERR_HEIGHTALIGN		       0x88760000+90
#define DDERR_INCOMPATIBLEPRIMARY	       0x88760000+95
#define DDERR_INVALIDCAPS		       0x88760000+100
#define DDERR_INVALIDCLIPLIST		       0x88760000+110
#define DDERR_INVALIDMODE		       0x88760000+120
#define DDERR_INVALIDOBJECT		       0x88760000+130
#define DDERR_INVALIDPIXELFORMAT	       0x88760000+145
#define DDERR_INVALIDRECT		       0x88760000+150
#define DDERR_LOCKEDSURFACES		       0x88760000+160
#define DDERR_NO3D			       0x88760000+170
#define DDERR_NOALPHAHW 		       0x88760000+180
#define DDERR_NOCLIPLIST		       0x88760000+205
#define DDERR_NOCOLORCONVHW		       0x88760000+210
#define DDERR_NOCOOPERATIVELEVELSET	       0x88760000+212
#define DDERR_NOCOLORKEY		       0x88760000+215
#define DDERR_NOCOLORKEYHW		       0x88760000+220
#define DDERR_NODIRECTDRAWSUPPORT	       0x88760000+222
#define DDERR_NOEXCLUSIVEMODE		       0x88760000+225
#define DDERR_NOFLIPHW			       0x88760000+230
#define DDERR_NOGDI			       0x88760000+240
#define DDERR_NOMIRRORHW		       0x88760000+250
#define DDERR_NOTFOUND			       0x88760000+255
#define DDERR_NOOVERLAYHW		       0x88760000+260
#define DDERR_NORASTEROPHW		       0x88760000+280
#define DDERR_NOROTATIONHW		       0x88760000+290
#define DDERR_NOSTRETCHHW		       0x88760000+310
#define DDERR_NOT4BITCOLOR		       0x88760000+316
#define DDERR_NOT4BITCOLORINDEX 	       0x88760000+317
#define DDERR_NOT8BITCOLOR		       0x88760000+320
#define DDERR_NOTEXTUREHW		       0x88760000+330
#define DDERR_NOVSYNCHW 		       0x88760000+335
#define DDERR_NOZBUFFERHW		       0x88760000+340
#define DDERR_NOZOVERLAYHW		       0x88760000+350
#define DDERR_OUTOFCAPS 		       0x88760000+360
#define DDERR_OUTOFVIDEOMEMORY		       0x88760000+380
#define DDERR_OVERLAYCANTCLIP		       0x88760000+382
#define DDERR_OVERLAYCOLORKEYONLYONEACTI       0x88760000+384
#define DDERR_PALETTEBUSY		       0x88760000+387
#define DDERR_COLORKEYNOTSET		       0x88760000+400
#define DDERR_SURFACEALREADYATTACHED	       0x88760000+410
#define DDERR_SURFACEALREADYDEPENDENT	       0x88760000+420
#define DDERR_SURFACEBUSY		       0x88760000+430
#define DDERR_CANTLOCKSURFACE		       0x88760000+435
#define DDERR_SURFACEISOBSCURED 	       0x88760000+440
#define DDERR_SURFACELOST		       0x88760000+450
#define DDERR_SURFACENOTATTACHED	       0x88760000+460
#define DDERR_TOOBIGHEIGHT		       0x88760000+470
#define DDERR_TOOBIGSIZE		       0x88760000+480
#define DDERR_TOOBIGWIDTH		       0x88760000+490
#define DDERR_UNSUPPORTEDFORMAT 	       0x88760000+510
#define DDERR_UNSUPPORTEDMASK		       0x88760000+520
#define DDERR_VERTICALBLANKINPROGRESS	       0x88760000+537
#define DDERR_WASSTILLDRAWING		       0x88760000+540
#define DDERR_XALIGN			       0x88760000+560
#define DDERR_INVALIDDIRECTDRAWGUID	       0x88760000+561
#define DDERR_DIRECTDRAWALREADYCREATED	       0x88760000+562
#define DDERR_NODIRECTDRAWHW		       0x88760000+563
#define DDERR_PRIMARYSURFACEALREADYEXIST       0x88760000+564
#define DDERR_NOEMULATION		       0x88760000+565
#define DDERR_REGIONTOOSMALL		       0x88760000+566
#define DDERR_CLIPPERISUSINGHWND	       0x88760000+567
#define DDERR_NOCLIPPERATTACHED 	       0x88760000+568
#define DDERR_NOHWND			       0x88760000+569
#define DDERR_HWNDSUBCLASSED		       0x88760000+570
#define DDERR_HWNDALREADYSET		       0x88760000+571
#define DDERR_NOPALETTEATTACHED 	       0x88760000+572
#define DDERR_NOPALETTEHW		       0x88760000+573
#define DDERR_BLTFASTCANTCLIP		       0x88760000+574
#define DDERR_NOBLTHW			       0x88760000+575
#define DDERR_NODDROPSHW		       0x88760000+576
#define DDERR_OVERLAYNOTVISIBLE 	       0x88760000+577
#define DDERR_NOOVERLAYDEST		       0x88760000+578
#define DDERR_INVALIDPOSITION		       0x88760000+579
#define DDERR_NOTAOVERLAYSURFACE	       0x88760000+580
#define DDERR_EXCLUSIVEMODEALREADYSET	       0x88760000+581
#define DDERR_NOTFLIPPABLE		       0x88760000+582
#define DDERR_CANTDUPLICATE		       0x88760000+583
#define DDERR_NOTLOCKED 		       0x88760000+584
#define DDERR_CANTCREATEDC		       0x88760000+585
#define DDERR_NODC			       0x88760000+586
#define DDERR_WRONGMODE 		       0x88760000+587
#define DDERR_IMPLICITLYCREATED 	       0x88760000+588
#define DDERR_NOTPALETTIZED		       0x88760000+589
#define DDERR_UNSUPPORTEDMODE		       0x88760000+590
#define DDERR_NOMIPMAPHW		       0x88760000+591
#define DDERR_INVALIDSURFACETYPE	       0x88760000+592
#define DDERR_NOOPTIMIZEHW		       0x88760000+600
#define DDERR_NOTLOADED 		       0x88760000+601
#define DDERR_DCALREADYCREATED		       0x88760000+620
#define DDERR_NONONLOCALVIDMEM		       0x88760000+630
#define DDERR_CANTPAGELOCK		       0x88760000+640
#define DDERR_CANTPAGEUNLOCK		       0x88760000+660
#define DDERR_NOTPAGELOCKED		       0x88760000+680
#define DDERR_MOREDATA			       0x88760000+690
#define DDERR_VIDEONOTACTIVE		       0x88760000+695
#define DDERR_DEVICEDOESNTOWNSURFACE	       0x88760000+699


//DIRECTDRAW PIXELFORMAT FLAGS  -------------------------------------------
// The surface has alpha channel information in the pixel format.

#define DDPF_ALPHAPIXELS                             0x0000001


// The pixel format contains alpha only information

#define DDPF_ALPHA                                   0x0000002


// The FourCC code is valid.

#define DDPF_FOURCC                                  0x0000004


// The surface is 4-bit color indexed.

#define DDPF_PALETTEINDEXED4                         0x0000008


// The surface is indexed into a palette which stores indices
// into the destination surface's 8-bit palette.

#define DDPF_PALETTEINDEXEDTO8                       0x0000010


// The surface is 8-bit color indexed.

#define DDPF_PALETTEINDEXED8                         0x0000020


// The RGB data in the pixel format structure is valid.

#define DDPF_RGB                                     0x0000040


// The surface will accept pixel data in the format specified
// and compress it during the write.

#define DDPF_COMPRESSED                              0x0000080


// The surface will accept RGB data and translate it during
// the write to YUV data.  The format of the data to be written
// will be contained in the pixel format structure.  The #define DDPF_RGB
// flag will be set.

#define DDPF_RGBTOYUV                                0x0000100


// pixel format is YUV - YUV data in pixel format struct is valid

#define DDPF_YUV                                     0x0000200


// pixel format is a z buffer only surface

#define DDPF_ZBUFFER                                 0x0000400


// The surface is 1-bit color indexed.

#define DDPF_PALETTEINDEXED1                         0x0000800


// The surface is 2-bit color indexed.

#define DDPF_PALETTEINDEXED2                         0x0001000


// The surface contains Z information in the pixels

#define DDPF_ZPIXELS				     0x0002000


// The surface contains stencil information along with Z

#define DDPF_STENCILBUFFER			     0x0004000


// Premultiplied alpha format -- the color components have been
// premultiplied by the alpha component.

#define DDPF_ALPHAPREMULT 			     0x0008000



// Luminance data in the pixel format is valid.
// Use this flag for luminance-only or luminance+alpha surfaces,
// the bit depth is then ddpf.dwLuminanceBitCount.

#define DDPF_LUMINANCE                               0x0020000


// Luminance data in the pixel format is valid.
// Use this flag when hanging luminance off bumpmap surfaces,
// the bit mask for the luminance portion of the pixel is then
// ddpf.dwBumpLuminanceBitMask

#define DDPF_BUMPLUMINANCE                           0x0040000


// Bump map dUdV data in the pixel format is valid.

#define DDPF_BUMPDUDV                                0x0080000


#define DD_OK                                        0x0000000
