[Mesa-dev] [PATCH 12/12] st/nine: Align stack for entry points

Axel Davy axel.davy at ens.fr
Sun Feb 7 23:13:19 UTC 2016


For 32 bits, incoming stack is 4-byte aligned.
We need to realign the stack to 16-byte at some point,
or there are issues later (crash with SSE, llvm, etc).

This patch chooses to align the stack at API entry points.

Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
 src/gallium/state_trackers/nine/adapter9.c         |  18 +-
 src/gallium/state_trackers/nine/adapter9.h         |  18 +-
 .../state_trackers/nine/authenticatedchannel9.c    |  10 +-
 .../state_trackers/nine/authenticatedchannel9.h    |  10 +-
 src/gallium/state_trackers/nine/basetexture9.c     |  14 +-
 src/gallium/state_trackers/nine/basetexture9.h     |  14 +-
 src/gallium/state_trackers/nine/buffer9.c          |   4 +-
 src/gallium/state_trackers/nine/buffer9.h          |   4 +-
 src/gallium/state_trackers/nine/cryptosession9.c   |  18 +-
 src/gallium/state_trackers/nine/cryptosession9.h   |  18 +-
 src/gallium/state_trackers/nine/cubetexture9.c     |  10 +-
 src/gallium/state_trackers/nine/cubetexture9.h     |  10 +-
 src/gallium/state_trackers/nine/device9.c          | 232 +++++------
 src/gallium/state_trackers/nine/device9.h          | 232 +++++------
 src/gallium/state_trackers/nine/device9ex.c        |  34 +-
 src/gallium/state_trackers/nine/device9ex.h        |  36 +-
 src/gallium/state_trackers/nine/device9video.c     |   6 +-
 src/gallium/state_trackers/nine/device9video.h     |   6 +-
 src/gallium/state_trackers/nine/indexbuffer9.c     |   6 +-
 src/gallium/state_trackers/nine/indexbuffer9.h     |   6 +-
 src/gallium/state_trackers/nine/iunknown.c         |   8 +-
 src/gallium/state_trackers/nine/iunknown.h         |   9 +-
 src/gallium/state_trackers/nine/nine_alignment.h   |  14 +
 src/gallium/state_trackers/nine/nine_lock.c        | 444 ++++++++++-----------
 .../state_trackers/nine/nineexoverlayextension.c   |   2 +-
 .../state_trackers/nine/nineexoverlayextension.h   |   2 +-
 src/gallium/state_trackers/nine/pixelshader9.c     |   2 +-
 src/gallium/state_trackers/nine/pixelshader9.h     |   2 +-
 src/gallium/state_trackers/nine/query9.c           |   8 +-
 src/gallium/state_trackers/nine/query9.h           |   8 +-
 src/gallium/state_trackers/nine/resource9.c        |  14 +-
 src/gallium/state_trackers/nine/resource9.h        |  14 +-
 src/gallium/state_trackers/nine/stateblock9.c      |   4 +-
 src/gallium/state_trackers/nine/stateblock9.h      |   4 +-
 src/gallium/state_trackers/nine/surface9.c         |  12 +-
 src/gallium/state_trackers/nine/surface9.h         |  12 +-
 src/gallium/state_trackers/nine/swapchain9.c       |  12 +-
 src/gallium/state_trackers/nine/swapchain9.h       |  12 +-
 src/gallium/state_trackers/nine/swapchain9ex.c     |   6 +-
 src/gallium/state_trackers/nine/swapchain9ex.h     |   6 +-
 src/gallium/state_trackers/nine/texture9.c         |  10 +-
 src/gallium/state_trackers/nine/texture9.h         |  10 +-
 src/gallium/state_trackers/nine/vertexbuffer9.c    |   6 +-
 src/gallium/state_trackers/nine/vertexbuffer9.h    |   6 +-
 .../state_trackers/nine/vertexdeclaration9.c       |   2 +-
 .../state_trackers/nine/vertexdeclaration9.h       |   2 +-
 src/gallium/state_trackers/nine/vertexshader9.c    |   2 +-
 src/gallium/state_trackers/nine/vertexshader9.h    |   2 +-
 src/gallium/state_trackers/nine/volume9.c          |  14 +-
 src/gallium/state_trackers/nine/volume9.h          |  14 +-
 src/gallium/state_trackers/nine/volumetexture9.c   |  10 +-
 src/gallium/state_trackers/nine/volumetexture9.h   |  10 +-
 52 files changed, 702 insertions(+), 687 deletions(-)
 create mode 100644 src/gallium/state_trackers/nine/nine_alignment.h

diff --git a/src/gallium/state_trackers/nine/adapter9.c b/src/gallium/state_trackers/nine/adapter9.c
index e677c7b..48e1e44 100644
--- a/src/gallium/state_trackers/nine/adapter9.c
+++ b/src/gallium/state_trackers/nine/adapter9.c
@@ -146,7 +146,7 @@ NineAdapter9_GetScreen( struct NineAdapter9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAdapter9_GetAdapterIdentifier( struct NineAdapter9 *This,
                                    DWORD Flags,
                                    D3DADAPTER_IDENTIFIER9 *pIdentifier )
@@ -182,7 +182,7 @@ backbuffer_format( D3DFORMAT dfmt,
     return FALSE;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAdapter9_CheckDeviceType( struct NineAdapter9 *This,
                               D3DDEVTYPE DevType,
                               D3DFORMAT AdapterFormat,
@@ -241,7 +241,7 @@ display_format( D3DFORMAT fmt,
     return FALSE;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAdapter9_CheckDeviceFormat( struct NineAdapter9 *This,
                                 D3DDEVTYPE DeviceType,
                                 D3DFORMAT AdapterFormat,
@@ -351,7 +351,7 @@ NineAdapter9_CheckDeviceFormat( struct NineAdapter9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAdapter9_CheckDeviceMultiSampleType( struct NineAdapter9 *This,
                                          D3DDEVTYPE DeviceType,
                                          D3DFORMAT SurfaceFormat,
@@ -394,7 +394,7 @@ NineAdapter9_CheckDeviceMultiSampleType( struct NineAdapter9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAdapter9_CheckDepthStencilMatch( struct NineAdapter9 *This,
                                      D3DDEVTYPE DeviceType,
                                      D3DFORMAT AdapterFormat,
@@ -438,7 +438,7 @@ NineAdapter9_CheckDepthStencilMatch( struct NineAdapter9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAdapter9_CheckDeviceFormatConversion( struct NineAdapter9 *This,
                                           D3DDEVTYPE DeviceType,
                                           D3DFORMAT SourceFormat,
@@ -478,7 +478,7 @@ NineAdapter9_CheckDeviceFormatConversion( struct NineAdapter9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
                             D3DDEVTYPE DeviceType,
                             D3DCAPS9 *pCaps )
@@ -934,7 +934,7 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAdapter9_CreateDevice( struct NineAdapter9 *This,
                            UINT RealAdapter,
                            D3DDEVTYPE DeviceType,
@@ -994,7 +994,7 @@ NineAdapter9_CreateDevice( struct NineAdapter9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAdapter9_CreateDeviceEx( struct NineAdapter9 *This,
                              UINT RealAdapter,
                              D3DDEVTYPE DeviceType,
diff --git a/src/gallium/state_trackers/nine/adapter9.h b/src/gallium/state_trackers/nine/adapter9.h
index 2129ec8..aaf7435 100644
--- a/src/gallium/state_trackers/nine/adapter9.h
+++ b/src/gallium/state_trackers/nine/adapter9.h
@@ -67,19 +67,19 @@ NineAdapter9_ctor( struct NineAdapter9 *This,
 void
 NineAdapter9_dtor( struct NineAdapter9 *This );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAdapter9_GetAdapterIdentifier( struct NineAdapter9 *This,
                                    DWORD Flags,
                                    D3DADAPTER_IDENTIFIER9 *pIdentifier );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAdapter9_CheckDeviceType( struct NineAdapter9 *This,
                               D3DDEVTYPE DevType,
                               D3DFORMAT AdapterFormat,
                               D3DFORMAT BackBufferFormat,
                               BOOL bWindowed );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAdapter9_CheckDeviceFormat( struct NineAdapter9 *This,
                                 D3DDEVTYPE DeviceType,
                                 D3DFORMAT AdapterFormat,
@@ -87,7 +87,7 @@ NineAdapter9_CheckDeviceFormat( struct NineAdapter9 *This,
                                 D3DRESOURCETYPE RType,
                                 D3DFORMAT CheckFormat );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAdapter9_CheckDeviceMultiSampleType( struct NineAdapter9 *This,
                                          D3DDEVTYPE DeviceType,
                                          D3DFORMAT SurfaceFormat,
@@ -95,25 +95,25 @@ NineAdapter9_CheckDeviceMultiSampleType( struct NineAdapter9 *This,
                                          D3DMULTISAMPLE_TYPE MultiSampleType,
                                          DWORD *pQualityLevels );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAdapter9_CheckDepthStencilMatch( struct NineAdapter9 *This,
                                      D3DDEVTYPE DeviceType,
                                      D3DFORMAT AdapterFormat,
                                      D3DFORMAT RenderTargetFormat,
                                      D3DFORMAT DepthStencilFormat );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAdapter9_CheckDeviceFormatConversion( struct NineAdapter9 *This,
                                           D3DDEVTYPE DeviceType,
                                           D3DFORMAT SourceFormat,
                                           D3DFORMAT TargetFormat );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
                             D3DDEVTYPE DeviceType,
                             D3DCAPS9 *pCaps );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAdapter9_CreateDevice( struct NineAdapter9 *This,
                            UINT RealAdapter,
                            D3DDEVTYPE DeviceType,
@@ -124,7 +124,7 @@ NineAdapter9_CreateDevice( struct NineAdapter9 *This,
                            ID3DPresentGroup *pPresentationGroup,
                            IDirect3DDevice9 **ppReturnedDeviceInterface );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAdapter9_CreateDeviceEx( struct NineAdapter9 *This,
                              UINT RealAdapter,
                              D3DDEVTYPE DeviceType,
diff --git a/src/gallium/state_trackers/nine/authenticatedchannel9.c b/src/gallium/state_trackers/nine/authenticatedchannel9.c
index 44ad87c..45fca3a 100644
--- a/src/gallium/state_trackers/nine/authenticatedchannel9.c
+++ b/src/gallium/state_trackers/nine/authenticatedchannel9.c
@@ -24,14 +24,14 @@
 
 #define DBG_CHANNEL DBG_AUTHENTICATEDCHANNEL
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAuthenticatedChannel9_GetCertificateSize( struct NineAuthenticatedChannel9 *This,
                                               UINT *pCertificateSize )
 {
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAuthenticatedChannel9_GetCertificate( struct NineAuthenticatedChannel9 *This,
                                           UINT CertifacteSize,
                                           BYTE *ppCertificate )
@@ -39,7 +39,7 @@ NineAuthenticatedChannel9_GetCertificate( struct NineAuthenticatedChannel9 *This
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAuthenticatedChannel9_NegotiateKeyExchange( struct NineAuthenticatedChannel9 *This,
                                                 UINT DataSize,
                                                 void *pData )
@@ -47,7 +47,7 @@ NineAuthenticatedChannel9_NegotiateKeyExchange( struct NineAuthenticatedChannel9
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAuthenticatedChannel9_Query( struct NineAuthenticatedChannel9 *This,
                                  UINT InputSize,
                                  const void *pInput,
@@ -57,7 +57,7 @@ NineAuthenticatedChannel9_Query( struct NineAuthenticatedChannel9 *This,
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAuthenticatedChannel9_Configure( struct NineAuthenticatedChannel9 *This,
                                      UINT InputSize,
                                      const void *pInput,
diff --git a/src/gallium/state_trackers/nine/authenticatedchannel9.h b/src/gallium/state_trackers/nine/authenticatedchannel9.h
index 63cb226..b188482 100644
--- a/src/gallium/state_trackers/nine/authenticatedchannel9.h
+++ b/src/gallium/state_trackers/nine/authenticatedchannel9.h
@@ -35,28 +35,28 @@ NineAuthenticatedChannel9( void *data )
     return (struct NineAuthenticatedChannel9 *)data;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAuthenticatedChannel9_GetCertificateSize( struct NineAuthenticatedChannel9 *This,
                                               UINT *pCertificateSize );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAuthenticatedChannel9_GetCertificate( struct NineAuthenticatedChannel9 *This,
                                           UINT CertifacteSize,
                                           BYTE *ppCertificate );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAuthenticatedChannel9_NegotiateKeyExchange( struct NineAuthenticatedChannel9 *This,
                                                 UINT DataSize,
                                                 void *pData );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAuthenticatedChannel9_Query( struct NineAuthenticatedChannel9 *This,
                                  UINT InputSize,
                                  const void *pInput,
                                  UINT OutputSize,
                                  void *pOutput );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineAuthenticatedChannel9_Configure( struct NineAuthenticatedChannel9 *This,
                                      UINT InputSize,
                                      const void *pInput,
diff --git a/src/gallium/state_trackers/nine/basetexture9.c b/src/gallium/state_trackers/nine/basetexture9.c
index 7a0959a..c4eb813 100644
--- a/src/gallium/state_trackers/nine/basetexture9.c
+++ b/src/gallium/state_trackers/nine/basetexture9.c
@@ -109,7 +109,7 @@ NineBaseTexture9_dtor( struct NineBaseTexture9 *This )
     NineResource9_dtor(&This->base);
 }
 
-DWORD WINAPI
+DWORD NINE_WINAPI
 NineBaseTexture9_SetLOD( struct NineBaseTexture9 *This,
                          DWORD LODNew )
 {
@@ -130,7 +130,7 @@ NineBaseTexture9_SetLOD( struct NineBaseTexture9 *This,
     return old;
 }
 
-DWORD WINAPI
+DWORD NINE_WINAPI
 NineBaseTexture9_GetLOD( struct NineBaseTexture9 *This )
 {
     DBG("This=%p\n", This);
@@ -138,7 +138,7 @@ NineBaseTexture9_GetLOD( struct NineBaseTexture9 *This )
     return This->managed.lod;
 }
 
-DWORD WINAPI
+DWORD NINE_WINAPI
 NineBaseTexture9_GetLevelCount( struct NineBaseTexture9 *This )
 {
     DBG("This=%p\n", This);
@@ -148,7 +148,7 @@ NineBaseTexture9_GetLevelCount( struct NineBaseTexture9 *This )
     return This->base.info.last_level + 1;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineBaseTexture9_SetAutoGenFilterType( struct NineBaseTexture9 *This,
                                        D3DTEXTUREFILTERTYPE FilterType )
 {
@@ -165,7 +165,7 @@ NineBaseTexture9_SetAutoGenFilterType( struct NineBaseTexture9 *This,
     return D3D_OK;
 }
 
-D3DTEXTUREFILTERTYPE WINAPI
+D3DTEXTUREFILTERTYPE NINE_WINAPI
 NineBaseTexture9_GetAutoGenFilterType( struct NineBaseTexture9 *This )
 {
     DBG("This=%p\n", This);
@@ -383,7 +383,7 @@ NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This )
     return D3D_OK;
 }
 
-void WINAPI
+void NINE_WINAPI
 NineBaseTexture9_GenerateMipSubLevels( struct NineBaseTexture9 *This )
 {
     struct pipe_resource *resource;
@@ -580,7 +580,7 @@ NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This,
     return This->view ? D3D_OK : D3DERR_DRIVERINTERNALERROR;
 }
 
-void WINAPI
+void NINE_WINAPI
 NineBaseTexture9_PreLoad( struct NineBaseTexture9 *This )
 {
     DBG("This=%p\n", This);
diff --git a/src/gallium/state_trackers/nine/basetexture9.h b/src/gallium/state_trackers/nine/basetexture9.h
index b19a621..980c4a5 100644
--- a/src/gallium/state_trackers/nine/basetexture9.h
+++ b/src/gallium/state_trackers/nine/basetexture9.h
@@ -72,27 +72,27 @@ NineBaseTexture9_ctor( struct NineBaseTexture9 *This,
 void
 NineBaseTexture9_dtor( struct NineBaseTexture9 *This );
 
-DWORD WINAPI
+DWORD NINE_WINAPI
 NineBaseTexture9_SetLOD( struct NineBaseTexture9 *This,
                          DWORD LODNew );
 
-DWORD WINAPI
+DWORD NINE_WINAPI
 NineBaseTexture9_GetLOD( struct NineBaseTexture9 *This );
 
-DWORD WINAPI
+DWORD NINE_WINAPI
 NineBaseTexture9_GetLevelCount( struct NineBaseTexture9 *This );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineBaseTexture9_SetAutoGenFilterType( struct NineBaseTexture9 *This,
                                        D3DTEXTUREFILTERTYPE FilterType );
 
-D3DTEXTUREFILTERTYPE WINAPI
+D3DTEXTUREFILTERTYPE NINE_WINAPI
 NineBaseTexture9_GetAutoGenFilterType( struct NineBaseTexture9 *This );
 
-void WINAPI
+void NINE_WINAPI
 NineBaseTexture9_GenerateMipSubLevels( struct NineBaseTexture9 *This );
 
-void WINAPI
+void NINE_WINAPI
 NineBaseTexture9_PreLoad( struct NineBaseTexture9 *This );
 
 void
diff --git a/src/gallium/state_trackers/nine/buffer9.c b/src/gallium/state_trackers/nine/buffer9.c
index b4b91ec..82aa000 100644
--- a/src/gallium/state_trackers/nine/buffer9.c
+++ b/src/gallium/state_trackers/nine/buffer9.c
@@ -115,7 +115,7 @@ NineBuffer9_GetResource( struct NineBuffer9 *This )
     return NineResource9_GetResource(&This->base);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineBuffer9_Lock( struct NineBuffer9 *This,
                         UINT OffsetToLock,
                         UINT SizeToLock,
@@ -178,7 +178,7 @@ NineBuffer9_Lock( struct NineBuffer9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineBuffer9_Unlock( struct NineBuffer9 *This )
 {
     DBG("This=%p\n", This);
diff --git a/src/gallium/state_trackers/nine/buffer9.h b/src/gallium/state_trackers/nine/buffer9.h
index 1afd9a9..955b819 100644
--- a/src/gallium/state_trackers/nine/buffer9.h
+++ b/src/gallium/state_trackers/nine/buffer9.h
@@ -60,14 +60,14 @@ NineBuffer9_dtor( struct NineBuffer9 *This );
 struct pipe_resource *
 NineBuffer9_GetResource( struct NineBuffer9 *This );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineBuffer9_Lock( struct NineBuffer9 *This,
                         UINT OffsetToLock,
                         UINT SizeToLock,
                         void **ppbData,
                         DWORD Flags );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineBuffer9_Unlock( struct NineBuffer9 *This );
 
 #endif /* _NINE_BUFFER9_H_ */
diff --git a/src/gallium/state_trackers/nine/cryptosession9.c b/src/gallium/state_trackers/nine/cryptosession9.c
index 2622f2b..c656f72 100644
--- a/src/gallium/state_trackers/nine/cryptosession9.c
+++ b/src/gallium/state_trackers/nine/cryptosession9.c
@@ -24,14 +24,14 @@
 
 #define DBG_CHANNEL DBG_CRYPTOSESSION
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCryptoSession9_GetCertificateSize( struct NineCryptoSession9 *This,
                                        UINT *pCertificateSize )
 {
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCryptoSession9_GetCertificate( struct NineCryptoSession9 *This,
                                    UINT CertifacteSize,
                                    BYTE *ppCertificate )
@@ -39,7 +39,7 @@ NineCryptoSession9_GetCertificate( struct NineCryptoSession9 *This,
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCryptoSession9_NegotiateKeyExchange( struct NineCryptoSession9 *This,
                                          UINT DataSize,
                                          void *pData )
@@ -47,7 +47,7 @@ NineCryptoSession9_NegotiateKeyExchange( struct NineCryptoSession9 *This,
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCryptoSession9_EncryptionBlt( struct NineCryptoSession9 *This,
                                   IDirect3DSurface9 *pSrcSurface,
                                   IDirect3DSurface9 *pDstSurface,
@@ -57,7 +57,7 @@ NineCryptoSession9_EncryptionBlt( struct NineCryptoSession9 *This,
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCryptoSession9_DecryptionBlt( struct NineCryptoSession9 *This,
                                   IDirect3DSurface9 *pSrcSurface,
                                   IDirect3DSurface9 *pDstSurface,
@@ -69,7 +69,7 @@ NineCryptoSession9_DecryptionBlt( struct NineCryptoSession9 *This,
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCryptoSession9_GetSurfacePitch( struct NineCryptoSession9 *This,
                                     IDirect3DSurface9 *pSrcSurface,
                                     UINT *pSurfacePitch )
@@ -77,7 +77,7 @@ NineCryptoSession9_GetSurfacePitch( struct NineCryptoSession9 *This,
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCryptoSession9_StartSessionKeyRefresh( struct NineCryptoSession9 *This,
                                            void *pRandomNumber,
                                            UINT RandomNumberSize )
@@ -85,13 +85,13 @@ NineCryptoSession9_StartSessionKeyRefresh( struct NineCryptoSession9 *This,
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCryptoSession9_FinishSessionKeyRefresh( struct NineCryptoSession9 *This )
 {
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCryptoSession9_GetEncryptionBltKey( struct NineCryptoSession9 *This,
                                         void *pReadbackKey,
                                         UINT KeySize )
diff --git a/src/gallium/state_trackers/nine/cryptosession9.h b/src/gallium/state_trackers/nine/cryptosession9.h
index d1eab72..9904455 100644
--- a/src/gallium/state_trackers/nine/cryptosession9.h
+++ b/src/gallium/state_trackers/nine/cryptosession9.h
@@ -35,28 +35,28 @@ NineCryptoSession9( void *data )
     return (struct NineCryptoSession9 *)data;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCryptoSession9_GetCertificateSize( struct NineCryptoSession9 *This,
                                        UINT *pCertificateSize );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCryptoSession9_GetCertificate( struct NineCryptoSession9 *This,
                                    UINT CertifacteSize,
                                    BYTE *ppCertificate );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCryptoSession9_NegotiateKeyExchange( struct NineCryptoSession9 *This,
                                          UINT DataSize,
                                          void *pData );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCryptoSession9_EncryptionBlt( struct NineCryptoSession9 *This,
                                   IDirect3DSurface9 *pSrcSurface,
                                   IDirect3DSurface9 *pDstSurface,
                                   UINT DstSurfaceSize,
                                   void *pIV );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCryptoSession9_DecryptionBlt( struct NineCryptoSession9 *This,
                                   IDirect3DSurface9 *pSrcSurface,
                                   IDirect3DSurface9 *pDstSurface,
@@ -65,20 +65,20 @@ NineCryptoSession9_DecryptionBlt( struct NineCryptoSession9 *This,
                                   void *pContentKey,
                                   void *pIV );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCryptoSession9_GetSurfacePitch( struct NineCryptoSession9 *This,
                                     IDirect3DSurface9 *pSrcSurface,
                                     UINT *pSurfacePitch );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCryptoSession9_StartSessionKeyRefresh( struct NineCryptoSession9 *This,
                                            void *pRandomNumber,
                                            UINT RandomNumberSize );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCryptoSession9_FinishSessionKeyRefresh( struct NineCryptoSession9 *This );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCryptoSession9_GetEncryptionBltKey( struct NineCryptoSession9 *This,
                                         void *pReadbackKey,
                                         UINT KeySize );
diff --git a/src/gallium/state_trackers/nine/cubetexture9.c b/src/gallium/state_trackers/nine/cubetexture9.c
index 1d39c8f..1100094 100644
--- a/src/gallium/state_trackers/nine/cubetexture9.c
+++ b/src/gallium/state_trackers/nine/cubetexture9.c
@@ -187,7 +187,7 @@ NineCubeTexture9_dtor( struct NineCubeTexture9 *This )
     NineBaseTexture9_dtor(&This->base);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCubeTexture9_GetLevelDesc( struct NineCubeTexture9 *This,
                                UINT Level,
                                D3DSURFACE_DESC *pDesc )
@@ -203,7 +203,7 @@ NineCubeTexture9_GetLevelDesc( struct NineCubeTexture9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCubeTexture9_GetCubeMapSurface( struct NineCubeTexture9 *This,
                                     D3DCUBEMAP_FACES FaceType,
                                     UINT Level,
@@ -225,7 +225,7 @@ NineCubeTexture9_GetCubeMapSurface( struct NineCubeTexture9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCubeTexture9_LockRect( struct NineCubeTexture9 *This,
                            D3DCUBEMAP_FACES FaceType,
                            UINT Level,
@@ -246,7 +246,7 @@ NineCubeTexture9_LockRect( struct NineCubeTexture9 *This,
     return NineSurface9_LockRect(This->surfaces[s], pLockedRect, pRect, Flags);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCubeTexture9_UnlockRect( struct NineCubeTexture9 *This,
                              D3DCUBEMAP_FACES FaceType,
                              UINT Level )
@@ -261,7 +261,7 @@ NineCubeTexture9_UnlockRect( struct NineCubeTexture9 *This,
     return NineSurface9_UnlockRect(This->surfaces[s]);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCubeTexture9_AddDirtyRect( struct NineCubeTexture9 *This,
                                D3DCUBEMAP_FACES FaceType,
                                const RECT *pDirtyRect )
diff --git a/src/gallium/state_trackers/nine/cubetexture9.h b/src/gallium/state_trackers/nine/cubetexture9.h
index 999715c..129789d 100644
--- a/src/gallium/state_trackers/nine/cubetexture9.h
+++ b/src/gallium/state_trackers/nine/cubetexture9.h
@@ -48,18 +48,18 @@ NineCubeTexture9_new( struct NineDevice9 *pDevice,
                       struct NineCubeTexture9 **ppOut,
                       HANDLE *pSharedHandle );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCubeTexture9_GetLevelDesc( struct NineCubeTexture9 *This,
                                UINT Level,
                                D3DSURFACE_DESC *pDesc );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCubeTexture9_GetCubeMapSurface( struct NineCubeTexture9 *This,
                                     D3DCUBEMAP_FACES FaceType,
                                     UINT Level,
                                     IDirect3DSurface9 **ppCubeMapSurface );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCubeTexture9_LockRect( struct NineCubeTexture9 *This,
                            D3DCUBEMAP_FACES FaceType,
                            UINT Level,
@@ -67,12 +67,12 @@ NineCubeTexture9_LockRect( struct NineCubeTexture9 *This,
                            const RECT *pRect,
                            DWORD Flags );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCubeTexture9_UnlockRect( struct NineCubeTexture9 *This,
                              D3DCUBEMAP_FACES FaceType,
                              UINT Level );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineCubeTexture9_AddDirtyRect( struct NineCubeTexture9 *This,
                                D3DCUBEMAP_FACES FaceType,
                                const RECT *pDirtyRect );
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index 805cba5..0c184f7 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -540,7 +540,7 @@ NineDevice9_ResumeRecording( struct NineDevice9 *This )
     }
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_TestCooperativeLevel( struct NineDevice9 *This )
 {
     if (NineSwapChain9_GetOccluded(This->swapchains[0])) {
@@ -553,13 +553,13 @@ NineDevice9_TestCooperativeLevel( struct NineDevice9 *This )
     return D3D_OK;
 }
 
-UINT WINAPI
+UINT NINE_WINAPI
 NineDevice9_GetAvailableTextureMem( struct NineDevice9 *This )
 {
     return This->available_texture_mem;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_EvictManagedResources( struct NineDevice9 *This )
 {
     struct NineBaseTexture9 *tex;
@@ -572,7 +572,7 @@ NineDevice9_EvictManagedResources( struct NineDevice9 *This )
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetDirect3D( struct NineDevice9 *This,
                          IDirect3D9 **ppD3D9 )
 {
@@ -582,7 +582,7 @@ NineDevice9_GetDirect3D( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetDeviceCaps( struct NineDevice9 *This,
                            D3DCAPS9 *pCaps )
 {
@@ -591,7 +591,7 @@ NineDevice9_GetDeviceCaps( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetDisplayMode( struct NineDevice9 *This,
                             UINT iSwapChain,
                             D3DDISPLAYMODE *pMode )
@@ -603,7 +603,7 @@ NineDevice9_GetDisplayMode( struct NineDevice9 *This,
     return NineSwapChain9_GetDisplayMode(This->swapchains[iSwapChain], pMode);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetCreationParameters( struct NineDevice9 *This,
                                    D3DDEVICE_CREATION_PARAMETERS *pParameters )
 {
@@ -612,7 +612,7 @@ NineDevice9_GetCreationParameters( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetCursorProperties( struct NineDevice9 *This,
                                  UINT XHotSpot,
                                  UINT YHotSpot,
@@ -688,7 +688,7 @@ NineDevice9_SetCursorProperties( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-void WINAPI
+void NINE_WINAPI
 NineDevice9_SetCursorPosition( struct NineDevice9 *This,
                                int X,
                                int Y,
@@ -705,7 +705,7 @@ NineDevice9_SetCursorPosition( struct NineDevice9 *This,
         This->cursor.software = ID3DPresent_SetCursorPos(swap->present, &This->cursor.pos) != D3D_OK;
 }
 
-BOOL WINAPI
+BOOL NINE_WINAPI
 NineDevice9_ShowCursor( struct NineDevice9 *This,
                         BOOL bShow )
 {
@@ -720,7 +720,7 @@ NineDevice9_ShowCursor( struct NineDevice9 *This,
     return old;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateAdditionalSwapChain( struct NineDevice9 *This,
                                        D3DPRESENT_PARAMETERS *pPresentationParameters,
                                        IDirect3DSwapChain9 **pSwapChain )
@@ -755,7 +755,7 @@ NineDevice9_CreateAdditionalSwapChain( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetSwapChain( struct NineDevice9 *This,
                           UINT iSwapChain,
                           IDirect3DSwapChain9 **pSwapChain )
@@ -771,13 +771,13 @@ NineDevice9_GetSwapChain( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-UINT WINAPI
+UINT NINE_WINAPI
 NineDevice9_GetNumberOfSwapChains( struct NineDevice9 *This )
 {
     return This->nswapchains;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_Reset( struct NineDevice9 *This,
                    D3DPRESENT_PARAMETERS *pPresentationParameters )
 {
@@ -810,7 +810,7 @@ NineDevice9_Reset( struct NineDevice9 *This,
     return hr;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_Present( struct NineDevice9 *This,
                      const RECT *pSourceRect,
                      const RECT *pDestRect,
@@ -833,7 +833,7 @@ NineDevice9_Present( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetBackBuffer( struct NineDevice9 *This,
                            UINT iSwapChain,
                            UINT iBackBuffer,
@@ -849,7 +849,7 @@ NineDevice9_GetBackBuffer( struct NineDevice9 *This,
                                         iBackBuffer, Type, ppBackBuffer);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetRasterStatus( struct NineDevice9 *This,
                              UINT iSwapChain,
                              D3DRASTER_STATUS *pRasterStatus )
@@ -861,14 +861,14 @@ NineDevice9_GetRasterStatus( struct NineDevice9 *This,
                                           pRasterStatus);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetDialogBoxMode( struct NineDevice9 *This,
                               BOOL bEnableDialogs )
 {
     STUB(D3DERR_INVALIDCALL);
 }
 
-void WINAPI
+void NINE_WINAPI
 NineDevice9_SetGammaRamp( struct NineDevice9 *This,
                           UINT iSwapChain,
                           DWORD Flags,
@@ -887,7 +887,7 @@ NineDevice9_SetGammaRamp( struct NineDevice9 *This,
     }
 }
 
-void WINAPI
+void NINE_WINAPI
 NineDevice9_GetGammaRamp( struct NineDevice9 *This,
                           UINT iSwapChain,
                           D3DGAMMARAMP *pRamp )
@@ -901,7 +901,7 @@ NineDevice9_GetGammaRamp( struct NineDevice9 *This,
         *pRamp = This->swapchains[iSwapChain]->gamma;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateTexture( struct NineDevice9 *This,
                            UINT Width,
                            UINT Height,
@@ -934,7 +934,7 @@ NineDevice9_CreateTexture( struct NineDevice9 *This,
     return hr;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateVolumeTexture( struct NineDevice9 *This,
                                  UINT Width,
                                  UINT Height,
@@ -967,7 +967,7 @@ NineDevice9_CreateVolumeTexture( struct NineDevice9 *This,
     return hr;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateCubeTexture( struct NineDevice9 *This,
                                UINT EdgeLength,
                                UINT Levels,
@@ -999,7 +999,7 @@ NineDevice9_CreateCubeTexture( struct NineDevice9 *This,
     return hr;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateVertexBuffer( struct NineDevice9 *This,
                                 UINT Length,
                                 DWORD Usage,
@@ -1037,7 +1037,7 @@ NineDevice9_CreateVertexBuffer( struct NineDevice9 *This,
     return hr;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateIndexBuffer( struct NineDevice9 *This,
                                UINT Length,
                                DWORD Usage,
@@ -1168,7 +1168,7 @@ create_zs_or_rt_surface(struct NineDevice9 *This,
     return hr;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateRenderTarget( struct NineDevice9 *This,
                                 UINT Width,
                                 UINT Height,
@@ -1186,7 +1186,7 @@ NineDevice9_CreateRenderTarget( struct NineDevice9 *This,
                                    Lockable, ppSurface, pSharedHandle);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateDepthStencilSurface( struct NineDevice9 *This,
                                        UINT Width,
                                        UINT Height,
@@ -1206,7 +1206,7 @@ NineDevice9_CreateDepthStencilSurface( struct NineDevice9 *This,
                                    Discard, ppSurface, pSharedHandle);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_UpdateSurface( struct NineDevice9 *This,
                            IDirect3DSurface9 *pSourceSurface,
                            const RECT *pSourceRect,
@@ -1299,7 +1299,7 @@ NineDevice9_UpdateSurface( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_UpdateTexture( struct NineDevice9 *This,
                            IDirect3DBaseTexture9 *pSourceTexture,
                            IDirect3DBaseTexture9 *pDestinationTexture )
@@ -1428,7 +1428,7 @@ NineDevice9_UpdateTexture( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetRenderTargetData( struct NineDevice9 *This,
                                  IDirect3DSurface9 *pRenderTarget,
                                  IDirect3DSurface9 *pDestSurface )
@@ -1453,7 +1453,7 @@ NineDevice9_GetRenderTargetData( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetFrontBufferData( struct NineDevice9 *This,
                                 UINT iSwapChain,
                                 IDirect3DSurface9 *pDestSurface )
@@ -1468,7 +1468,7 @@ NineDevice9_GetFrontBufferData( struct NineDevice9 *This,
                                              pDestSurface);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_StretchRect( struct NineDevice9 *This,
                          IDirect3DSurface9 *pSourceSurface,
                          const RECT *pSourceRect,
@@ -1672,7 +1672,7 @@ NineDevice9_StretchRect( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_ColorFill( struct NineDevice9 *This,
                        IDirect3DSurface9 *pSurface,
                        const RECT *pRect,
@@ -1739,7 +1739,7 @@ NineDevice9_ColorFill( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateOffscreenPlainSurface( struct NineDevice9 *This,
                                          UINT Width,
                                          UINT Height,
@@ -1772,7 +1772,7 @@ NineDevice9_CreateOffscreenPlainSurface( struct NineDevice9 *This,
     return hr;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetRenderTarget( struct NineDevice9 *This,
                              DWORD RenderTargetIndex,
                              IDirect3DSurface9 *pRenderTarget )
@@ -1811,7 +1811,7 @@ NineDevice9_SetRenderTarget( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetRenderTarget( struct NineDevice9 *This,
                              DWORD RenderTargetIndex,
                              IDirect3DSurface9 **ppRenderTarget )
@@ -1829,7 +1829,7 @@ NineDevice9_GetRenderTarget( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetDepthStencilSurface( struct NineDevice9 *This,
                                     IDirect3DSurface9 *pNewZStencil )
 {
@@ -1842,7 +1842,7 @@ NineDevice9_SetDepthStencilSurface( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetDepthStencilSurface( struct NineDevice9 *This,
                                     IDirect3DSurface9 **ppZStencilSurface )
 {
@@ -1856,7 +1856,7 @@ NineDevice9_GetDepthStencilSurface( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_BeginScene( struct NineDevice9 *This )
 {
     DBG("This=%p\n", This);
@@ -1866,7 +1866,7 @@ NineDevice9_BeginScene( struct NineDevice9 *This )
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_EndScene( struct NineDevice9 *This )
 {
     DBG("This=%p\n", This);
@@ -1875,7 +1875,7 @@ NineDevice9_EndScene( struct NineDevice9 *This )
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_Clear( struct NineDevice9 *This,
                    DWORD Count,
                    const D3DRECT *pRects,
@@ -2037,7 +2037,7 @@ NineDevice9_Clear( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetTransform( struct NineDevice9 *This,
                           D3DTRANSFORMSTATETYPE State,
                           const D3DMATRIX *pMatrix )
@@ -2056,7 +2056,7 @@ NineDevice9_SetTransform( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetTransform( struct NineDevice9 *This,
                           D3DTRANSFORMSTATETYPE State,
                           D3DMATRIX *pMatrix )
@@ -2067,7 +2067,7 @@ NineDevice9_GetTransform( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_MultiplyTransform( struct NineDevice9 *This,
                                D3DTRANSFORMSTATETYPE State,
                                const D3DMATRIX *pMatrix )
@@ -2084,7 +2084,7 @@ NineDevice9_MultiplyTransform( struct NineDevice9 *This,
     return NineDevice9_SetTransform(This, State, &T);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetViewport( struct NineDevice9 *This,
                          const D3DVIEWPORT9 *pViewport )
 {
@@ -2100,7 +2100,7 @@ NineDevice9_SetViewport( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetViewport( struct NineDevice9 *This,
                          D3DVIEWPORT9 *pViewport )
 {
@@ -2108,7 +2108,7 @@ NineDevice9_GetViewport( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetMaterial( struct NineDevice9 *This,
                          const D3DMATERIAL9 *pMaterial )
 {
@@ -2126,7 +2126,7 @@ NineDevice9_SetMaterial( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetMaterial( struct NineDevice9 *This,
                          D3DMATERIAL9 *pMaterial )
 {
@@ -2135,7 +2135,7 @@ NineDevice9_GetMaterial( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetLight( struct NineDevice9 *This,
                       DWORD Index,
                       const D3DLIGHT9 *pLight )
@@ -2184,7 +2184,7 @@ NineDevice9_SetLight( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetLight( struct NineDevice9 *This,
                       DWORD Index,
                       D3DLIGHT9 *pLight )
@@ -2201,7 +2201,7 @@ NineDevice9_GetLight( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_LightEnable( struct NineDevice9 *This,
                          DWORD Index,
                          BOOL Enable )
@@ -2251,7 +2251,7 @@ NineDevice9_LightEnable( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetLightEnable( struct NineDevice9 *This,
                             DWORD Index,
                             BOOL *pEnable )
@@ -2272,7 +2272,7 @@ NineDevice9_GetLightEnable( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetClipPlane( struct NineDevice9 *This,
                           DWORD Index,
                           const float *pPlane )
@@ -2293,7 +2293,7 @@ NineDevice9_SetClipPlane( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetClipPlane( struct NineDevice9 *This,
                           DWORD Index,
                           float *pPlane )
@@ -2364,7 +2364,7 @@ NineDevice9_ResolveZ( struct NineDevice9 *This )
 #define ALPHA_TO_COVERAGE_ENABLE   MAKEFOURCC('A', '2', 'M', '1')
 #define ALPHA_TO_COVERAGE_DISABLE  MAKEFOURCC('A', '2', 'M', '0')
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetRenderState( struct NineDevice9 *This,
                             D3DRENDERSTATETYPE State,
                             DWORD Value )
@@ -2410,7 +2410,7 @@ NineDevice9_SetRenderState( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetRenderState( struct NineDevice9 *This,
                             D3DRENDERSTATETYPE State,
                             DWORD *pValue )
@@ -2421,7 +2421,7 @@ NineDevice9_GetRenderState( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateStateBlock( struct NineDevice9 *This,
                               D3DSTATEBLOCKTYPE Type,
                               IDirect3DStateBlock9 **ppSB )
@@ -2521,7 +2521,7 @@ NineDevice9_CreateStateBlock( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_BeginStateBlock( struct NineDevice9 *This )
 {
     HRESULT hr;
@@ -2541,7 +2541,7 @@ NineDevice9_BeginStateBlock( struct NineDevice9 *This )
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_EndStateBlock( struct NineDevice9 *This,
                            IDirect3DStateBlock9 **ppSB )
 {
@@ -2560,21 +2560,21 @@ NineDevice9_EndStateBlock( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetClipStatus( struct NineDevice9 *This,
                            const D3DCLIPSTATUS9 *pClipStatus )
 {
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetClipStatus( struct NineDevice9 *This,
                            D3DCLIPSTATUS9 *pClipStatus )
 {
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetTexture( struct NineDevice9 *This,
                         DWORD Stage,
                         IDirect3DBaseTexture9 **ppTexture )
@@ -2595,7 +2595,7 @@ NineDevice9_GetTexture( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetTexture( struct NineDevice9 *This,
                         DWORD Stage,
                         IDirect3DBaseTexture9 *pTexture )
@@ -2640,7 +2640,7 @@ NineDevice9_SetTexture( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetTextureStageState( struct NineDevice9 *This,
                                   DWORD Stage,
                                   D3DTEXTURESTAGESTATETYPE Type,
@@ -2656,7 +2656,7 @@ NineDevice9_GetTextureStageState( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetTextureStageState( struct NineDevice9 *This,
                                   DWORD Stage,
                                   D3DTEXTURESTAGESTATETYPE Type,
@@ -2709,7 +2709,7 @@ NineDevice9_SetTextureStageState( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetSamplerState( struct NineDevice9 *This,
                              DWORD Sampler,
                              D3DSAMPLERSTATETYPE Type,
@@ -2727,7 +2727,7 @@ NineDevice9_GetSamplerState( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetSamplerState( struct NineDevice9 *This,
                              DWORD Sampler,
                              D3DSAMPLERSTATETYPE Type,
@@ -2755,7 +2755,7 @@ NineDevice9_SetSamplerState( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_ValidateDevice( struct NineDevice9 *This,
                             DWORD *pNumPasses )
 {
@@ -2795,7 +2795,7 @@ NineDevice9_ValidateDevice( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetPaletteEntries( struct NineDevice9 *This,
                                UINT PaletteNumber,
                                const PALETTEENTRY *pEntries )
@@ -2803,7 +2803,7 @@ NineDevice9_SetPaletteEntries( struct NineDevice9 *This,
     STUB(D3D_OK); /* like wine */
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetPaletteEntries( struct NineDevice9 *This,
                                UINT PaletteNumber,
                                PALETTEENTRY *pEntries )
@@ -2811,21 +2811,21 @@ NineDevice9_GetPaletteEntries( struct NineDevice9 *This,
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetCurrentTexturePalette( struct NineDevice9 *This,
                                       UINT PaletteNumber )
 {
     STUB(D3D_OK); /* like wine */
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetCurrentTexturePalette( struct NineDevice9 *This,
                                       UINT *PaletteNumber )
 {
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetScissorRect( struct NineDevice9 *This,
                             const RECT *pRect )
 {
@@ -2844,7 +2844,7 @@ NineDevice9_SetScissorRect( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetScissorRect( struct NineDevice9 *This,
                             RECT *pRect )
 {
@@ -2856,27 +2856,27 @@ NineDevice9_GetScissorRect( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetSoftwareVertexProcessing( struct NineDevice9 *This,
                                          BOOL bSoftware )
 {
     STUB(D3DERR_INVALIDCALL);
 }
 
-BOOL WINAPI
+BOOL NINE_WINAPI
 NineDevice9_GetSoftwareVertexProcessing( struct NineDevice9 *This )
 {
     return !!(This->params.BehaviorFlags & D3DCREATE_SOFTWARE_VERTEXPROCESSING);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetNPatchMode( struct NineDevice9 *This,
                            float nSegments )
 {
     STUB(D3DERR_INVALIDCALL);
 }
 
-float WINAPI
+float NINE_WINAPI
 NineDevice9_GetNPatchMode( struct NineDevice9 *This )
 {
     STUB(0);
@@ -2898,7 +2898,7 @@ init_draw_info(struct pipe_draw_info *info,
     info->indirect = NULL;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_DrawPrimitive( struct NineDevice9 *This,
                            D3DPRIMITIVETYPE PrimitiveType,
                            UINT StartVertex,
@@ -2923,7 +2923,7 @@ NineDevice9_DrawPrimitive( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_DrawIndexedPrimitive( struct NineDevice9 *This,
                                   D3DPRIMITIVETYPE PrimitiveType,
                                   INT BaseVertexIndex,
@@ -2957,7 +2957,7 @@ NineDevice9_DrawIndexedPrimitive( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_DrawPrimitiveUP( struct NineDevice9 *This,
                              D3DPRIMITIVETYPE PrimitiveType,
                              UINT PrimitiveCount,
@@ -3013,7 +3013,7 @@ NineDevice9_DrawPrimitiveUP( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 *This,
                                     D3DPRIMITIVETYPE PrimitiveType,
                                     UINT MinVertexIndex,
@@ -3105,7 +3105,7 @@ NineDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 *This,
 /* TODO: Write to pDestBuffer directly if vertex declaration contains
  * only f32 formats.
  */
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_ProcessVertices( struct NineDevice9 *This,
                              UINT SrcStartIndex,
                              UINT DestIndex,
@@ -3198,7 +3198,7 @@ out:
     return hr;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateVertexDeclaration( struct NineDevice9 *This,
                                      const D3DVERTEXELEMENT9 *pVertexElements,
                                      IDirect3DVertexDeclaration9 **ppDecl )
@@ -3215,7 +3215,7 @@ NineDevice9_CreateVertexDeclaration( struct NineDevice9 *This,
     return hr;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetVertexDeclaration( struct NineDevice9 *This,
                                   IDirect3DVertexDeclaration9 *pDecl )
 {
@@ -3240,7 +3240,7 @@ NineDevice9_SetVertexDeclaration( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetVertexDeclaration( struct NineDevice9 *This,
                                   IDirect3DVertexDeclaration9 **ppDecl )
 {
@@ -3252,7 +3252,7 @@ NineDevice9_GetVertexDeclaration( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetFVF( struct NineDevice9 *This,
                     DWORD FVF )
 {
@@ -3276,7 +3276,7 @@ NineDevice9_SetFVF( struct NineDevice9 *This,
         This, (IDirect3DVertexDeclaration9 *)vdecl);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetFVF( struct NineDevice9 *This,
                     DWORD *pFVF )
 {
@@ -3284,7 +3284,7 @@ NineDevice9_GetFVF( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateVertexShader( struct NineDevice9 *This,
                                 const DWORD *pFunction,
                                 IDirect3DVertexShader9 **ppShader )
@@ -3301,7 +3301,7 @@ NineDevice9_CreateVertexShader( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetVertexShader( struct NineDevice9 *This,
                              IDirect3DVertexShader9 *pShader )
 {
@@ -3326,7 +3326,7 @@ NineDevice9_SetVertexShader( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetVertexShader( struct NineDevice9 *This,
                              IDirect3DVertexShader9 **ppShader )
 {
@@ -3335,7 +3335,7 @@ NineDevice9_GetVertexShader( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetVertexShaderConstantF( struct NineDevice9 *This,
                                       UINT StartRegister,
                                       const float *pConstantData,
@@ -3372,7 +3372,7 @@ NineDevice9_SetVertexShaderConstantF( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetVertexShaderConstantF( struct NineDevice9 *This,
                                       UINT StartRegister,
                                       float *pConstantData,
@@ -3391,7 +3391,7 @@ NineDevice9_GetVertexShaderConstantF( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetVertexShaderConstantI( struct NineDevice9 *This,
                                       UINT StartRegister,
                                       const int *pConstantData,
@@ -3431,7 +3431,7 @@ NineDevice9_SetVertexShaderConstantI( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetVertexShaderConstantI( struct NineDevice9 *This,
                                       UINT StartRegister,
                                       int *pConstantData,
@@ -3460,7 +3460,7 @@ NineDevice9_GetVertexShaderConstantI( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetVertexShaderConstantB( struct NineDevice9 *This,
                                       UINT StartRegister,
                                       const BOOL *pConstantData,
@@ -3496,7 +3496,7 @@ NineDevice9_SetVertexShaderConstantB( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetVertexShaderConstantB( struct NineDevice9 *This,
                                       UINT StartRegister,
                                       BOOL *pConstantData,
@@ -3515,7 +3515,7 @@ NineDevice9_GetVertexShaderConstantB( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetStreamSource( struct NineDevice9 *This,
                              UINT StreamNumber,
                              IDirect3DVertexBuffer9 *pStreamData,
@@ -3552,7 +3552,7 @@ NineDevice9_SetStreamSource( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetStreamSource( struct NineDevice9 *This,
                              UINT StreamNumber,
                              IDirect3DVertexBuffer9 **ppStreamData,
@@ -3572,7 +3572,7 @@ NineDevice9_GetStreamSource( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetStreamSourceFreq( struct NineDevice9 *This,
                                  UINT StreamNumber,
                                  UINT Setting )
@@ -3606,7 +3606,7 @@ NineDevice9_SetStreamSourceFreq( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetStreamSourceFreq( struct NineDevice9 *This,
                                  UINT StreamNumber,
                                  UINT *pSetting )
@@ -3616,7 +3616,7 @@ NineDevice9_GetStreamSourceFreq( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetIndices( struct NineDevice9 *This,
                         IDirect3DIndexBuffer9 *pIndexData )
 {
@@ -3637,7 +3637,7 @@ NineDevice9_SetIndices( struct NineDevice9 *This,
 /* XXX: wine/d3d9 doesn't have pBaseVertexIndex, and it doesn't make sense
  * here because it's an argument passed to the Draw calls.
  */
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetIndices( struct NineDevice9 *This,
                         IDirect3DIndexBuffer9 **ppIndexData /*,
                         UINT *pBaseVertexIndex */ )
@@ -3647,7 +3647,7 @@ NineDevice9_GetIndices( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreatePixelShader( struct NineDevice9 *This,
                                const DWORD *pFunction,
                                IDirect3DPixelShader9 **ppShader )
@@ -3664,7 +3664,7 @@ NineDevice9_CreatePixelShader( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetPixelShader( struct NineDevice9 *This,
                             IDirect3DPixelShader9 *pShader )
 {
@@ -3694,7 +3694,7 @@ NineDevice9_SetPixelShader( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetPixelShader( struct NineDevice9 *This,
                             IDirect3DPixelShader9 **ppShader )
 {
@@ -3703,7 +3703,7 @@ NineDevice9_GetPixelShader( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetPixelShaderConstantF( struct NineDevice9 *This,
                                      UINT StartRegister,
                                      const float *pConstantData,
@@ -3740,7 +3740,7 @@ NineDevice9_SetPixelShaderConstantF( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetPixelShaderConstantF( struct NineDevice9 *This,
                                      UINT StartRegister,
                                      float *pConstantData,
@@ -3759,7 +3759,7 @@ NineDevice9_GetPixelShaderConstantF( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetPixelShaderConstantI( struct NineDevice9 *This,
                                      UINT StartRegister,
                                      const int *pConstantData,
@@ -3798,7 +3798,7 @@ NineDevice9_SetPixelShaderConstantI( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetPixelShaderConstantI( struct NineDevice9 *This,
                                      UINT StartRegister,
                                      int *pConstantData,
@@ -3827,7 +3827,7 @@ NineDevice9_GetPixelShaderConstantI( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetPixelShaderConstantB( struct NineDevice9 *This,
                                      UINT StartRegister,
                                      const BOOL *pConstantData,
@@ -3863,7 +3863,7 @@ NineDevice9_SetPixelShaderConstantB( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetPixelShaderConstantB( struct NineDevice9 *This,
                                      UINT StartRegister,
                                      BOOL *pConstantData,
@@ -3882,7 +3882,7 @@ NineDevice9_GetPixelShaderConstantB( struct NineDevice9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_DrawRectPatch( struct NineDevice9 *This,
                            UINT Handle,
                            const float *pNumSegs,
@@ -3891,7 +3891,7 @@ NineDevice9_DrawRectPatch( struct NineDevice9 *This,
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_DrawTriPatch( struct NineDevice9 *This,
                           UINT Handle,
                           const float *pNumSegs,
@@ -3900,14 +3900,14 @@ NineDevice9_DrawTriPatch( struct NineDevice9 *This,
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_DeletePatch( struct NineDevice9 *This,
                          UINT Handle )
 {
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateQuery( struct NineDevice9 *This,
                          D3DQUERYTYPE Type,
                          IDirect3DQuery9 **ppQuery )
diff --git a/src/gallium/state_trackers/nine/device9.h b/src/gallium/state_trackers/nine/device9.h
index 34edf0c..f469083 100644
--- a/src/gallium/state_trackers/nine/device9.h
+++ b/src/gallium/state_trackers/nine/device9.h
@@ -196,100 +196,100 @@ NineDevice9_GetCaps( struct NineDevice9 *This );
 
 /*** Direct3D public ***/
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_TestCooperativeLevel( struct NineDevice9 *This );
 
-UINT WINAPI
+UINT NINE_WINAPI
 NineDevice9_GetAvailableTextureMem( struct NineDevice9 *This );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_EvictManagedResources( struct NineDevice9 *This );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetDirect3D( struct NineDevice9 *This,
                          IDirect3D9 **ppD3D9 );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetDeviceCaps( struct NineDevice9 *This,
                            D3DCAPS9 *pCaps );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetDisplayMode( struct NineDevice9 *This,
                             UINT iSwapChain,
                             D3DDISPLAYMODE *pMode );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetCreationParameters( struct NineDevice9 *This,
                                    D3DDEVICE_CREATION_PARAMETERS *pParameters );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetCursorProperties( struct NineDevice9 *This,
                                  UINT XHotSpot,
                                  UINT YHotSpot,
                                  IDirect3DSurface9 *pCursorBitmap );
 
-void WINAPI
+void NINE_WINAPI
 NineDevice9_SetCursorPosition( struct NineDevice9 *This,
                                int X,
                                int Y,
                                DWORD Flags );
 
-BOOL WINAPI
+BOOL NINE_WINAPI
 NineDevice9_ShowCursor( struct NineDevice9 *This,
                         BOOL bShow );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateAdditionalSwapChain( struct NineDevice9 *This,
                                        D3DPRESENT_PARAMETERS *pPresentationParameters,
                                        IDirect3DSwapChain9 **pSwapChain );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetSwapChain( struct NineDevice9 *This,
                           UINT iSwapChain,
                           IDirect3DSwapChain9 **pSwapChain );
 
-UINT WINAPI
+UINT NINE_WINAPI
 NineDevice9_GetNumberOfSwapChains( struct NineDevice9 *This );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_Reset( struct NineDevice9 *This,
                    D3DPRESENT_PARAMETERS *pPresentationParameters );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_Present( struct NineDevice9 *This,
                      const RECT *pSourceRect,
                      const RECT *pDestRect,
                      HWND hDestWindowOverride,
                      const RGNDATA *pDirtyRegion );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetBackBuffer( struct NineDevice9 *This,
                            UINT iSwapChain,
                            UINT iBackBuffer,
                            D3DBACKBUFFER_TYPE Type,
                            IDirect3DSurface9 **ppBackBuffer );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetRasterStatus( struct NineDevice9 *This,
                              UINT iSwapChain,
                              D3DRASTER_STATUS *pRasterStatus );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetDialogBoxMode( struct NineDevice9 *This,
                               BOOL bEnableDialogs );
 
-void WINAPI
+void NINE_WINAPI
 NineDevice9_SetGammaRamp( struct NineDevice9 *This,
                           UINT iSwapChain,
                           DWORD Flags,
                           const D3DGAMMARAMP *pRamp );
 
-void WINAPI
+void NINE_WINAPI
 NineDevice9_GetGammaRamp( struct NineDevice9 *This,
                           UINT iSwapChain,
                           D3DGAMMARAMP *pRamp );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateTexture( struct NineDevice9 *This,
                            UINT Width,
                            UINT Height,
@@ -300,7 +300,7 @@ NineDevice9_CreateTexture( struct NineDevice9 *This,
                            IDirect3DTexture9 **ppTexture,
                            HANDLE *pSharedHandle );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateVolumeTexture( struct NineDevice9 *This,
                                  UINT Width,
                                  UINT Height,
@@ -312,7 +312,7 @@ NineDevice9_CreateVolumeTexture( struct NineDevice9 *This,
                                  IDirect3DVolumeTexture9 **ppVolumeTexture,
                                  HANDLE *pSharedHandle );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateCubeTexture( struct NineDevice9 *This,
                                UINT EdgeLength,
                                UINT Levels,
@@ -322,7 +322,7 @@ NineDevice9_CreateCubeTexture( struct NineDevice9 *This,
                                IDirect3DCubeTexture9 **ppCubeTexture,
                                HANDLE *pSharedHandle );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateVertexBuffer( struct NineDevice9 *This,
                                 UINT Length,
                                 DWORD Usage,
@@ -331,7 +331,7 @@ NineDevice9_CreateVertexBuffer( struct NineDevice9 *This,
                                 IDirect3DVertexBuffer9 **ppVertexBuffer,
                                 HANDLE *pSharedHandle );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateIndexBuffer( struct NineDevice9 *This,
                                UINT Length,
                                DWORD Usage,
@@ -340,7 +340,7 @@ NineDevice9_CreateIndexBuffer( struct NineDevice9 *This,
                                IDirect3DIndexBuffer9 **ppIndexBuffer,
                                HANDLE *pSharedHandle );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateRenderTarget( struct NineDevice9 *This,
                                 UINT Width,
                                 UINT Height,
@@ -351,7 +351,7 @@ NineDevice9_CreateRenderTarget( struct NineDevice9 *This,
                                 IDirect3DSurface9 **ppSurface,
                                 HANDLE *pSharedHandle );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateDepthStencilSurface( struct NineDevice9 *This,
                                        UINT Width,
                                        UINT Height,
@@ -362,29 +362,29 @@ NineDevice9_CreateDepthStencilSurface( struct NineDevice9 *This,
                                        IDirect3DSurface9 **ppSurface,
                                        HANDLE *pSharedHandle );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_UpdateSurface( struct NineDevice9 *This,
                            IDirect3DSurface9 *pSourceSurface,
                            const RECT *pSourceRect,
                            IDirect3DSurface9 *pDestinationSurface,
                            const POINT *pDestPoint );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_UpdateTexture( struct NineDevice9 *This,
                            IDirect3DBaseTexture9 *pSourceTexture,
                            IDirect3DBaseTexture9 *pDestinationTexture );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetRenderTargetData( struct NineDevice9 *This,
                                  IDirect3DSurface9 *pRenderTarget,
                                  IDirect3DSurface9 *pDestSurface );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetFrontBufferData( struct NineDevice9 *This,
                                 UINT iSwapChain,
                                 IDirect3DSurface9 *pDestSurface );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_StretchRect( struct NineDevice9 *This,
                          IDirect3DSurface9 *pSourceSurface,
                          const RECT *pSourceRect,
@@ -392,13 +392,13 @@ NineDevice9_StretchRect( struct NineDevice9 *This,
                          const RECT *pDestRect,
                          D3DTEXTUREFILTERTYPE Filter );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_ColorFill( struct NineDevice9 *This,
                        IDirect3DSurface9 *pSurface,
                        const RECT *pRect,
                        D3DCOLOR color );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateOffscreenPlainSurface( struct NineDevice9 *This,
                                          UINT Width,
                                          UINT Height,
@@ -407,31 +407,31 @@ NineDevice9_CreateOffscreenPlainSurface( struct NineDevice9 *This,
                                          IDirect3DSurface9 **ppSurface,
                                          HANDLE *pSharedHandle );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetRenderTarget( struct NineDevice9 *This,
                              DWORD RenderTargetIndex,
                              IDirect3DSurface9 *pRenderTarget );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetRenderTarget( struct NineDevice9 *This,
                              DWORD RenderTargetIndex,
                              IDirect3DSurface9 **ppRenderTarget );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetDepthStencilSurface( struct NineDevice9 *This,
                                     IDirect3DSurface9 *pNewZStencil );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetDepthStencilSurface( struct NineDevice9 *This,
                                     IDirect3DSurface9 **ppZStencilSurface );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_BeginScene( struct NineDevice9 *This );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_EndScene( struct NineDevice9 *This );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_Clear( struct NineDevice9 *This,
                    DWORD Count,
                    const D3DRECT *pRects,
@@ -440,182 +440,182 @@ NineDevice9_Clear( struct NineDevice9 *This,
                    float Z,
                    DWORD Stencil );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetTransform( struct NineDevice9 *This,
                           D3DTRANSFORMSTATETYPE State,
                           const D3DMATRIX *pMatrix );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetTransform( struct NineDevice9 *This,
                           D3DTRANSFORMSTATETYPE State,
                           D3DMATRIX *pMatrix );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_MultiplyTransform( struct NineDevice9 *This,
                                D3DTRANSFORMSTATETYPE State,
                                const D3DMATRIX *pMatrix );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetViewport( struct NineDevice9 *This,
                          const D3DVIEWPORT9 *pViewport );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetViewport( struct NineDevice9 *This,
                          D3DVIEWPORT9 *pViewport );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetMaterial( struct NineDevice9 *This,
                          const D3DMATERIAL9 *pMaterial );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetMaterial( struct NineDevice9 *This,
                          D3DMATERIAL9 *pMaterial );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetLight( struct NineDevice9 *This,
                       DWORD Index,
                       const D3DLIGHT9 *pLight );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetLight( struct NineDevice9 *This,
                       DWORD Index,
                       D3DLIGHT9 *pLight );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_LightEnable( struct NineDevice9 *This,
                          DWORD Index,
                          BOOL Enable );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetLightEnable( struct NineDevice9 *This,
                             DWORD Index,
                             BOOL *pEnable );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetClipPlane( struct NineDevice9 *This,
                           DWORD Index,
                           const float *pPlane );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetClipPlane( struct NineDevice9 *This,
                           DWORD Index,
                           float *pPlane );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetRenderState( struct NineDevice9 *This,
                             D3DRENDERSTATETYPE State,
                             DWORD Value );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetRenderState( struct NineDevice9 *This,
                             D3DRENDERSTATETYPE State,
                             DWORD *pValue );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateStateBlock( struct NineDevice9 *This,
                               D3DSTATEBLOCKTYPE Type,
                               IDirect3DStateBlock9 **ppSB );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_BeginStateBlock( struct NineDevice9 *This );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_EndStateBlock( struct NineDevice9 *This,
                            IDirect3DStateBlock9 **ppSB );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetClipStatus( struct NineDevice9 *This,
                            const D3DCLIPSTATUS9 *pClipStatus );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetClipStatus( struct NineDevice9 *This,
                            D3DCLIPSTATUS9 *pClipStatus );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetTexture( struct NineDevice9 *This,
                         DWORD Stage,
                         IDirect3DBaseTexture9 **ppTexture );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetTexture( struct NineDevice9 *This,
                         DWORD Stage,
                         IDirect3DBaseTexture9 *pTexture );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetTextureStageState( struct NineDevice9 *This,
                                   DWORD Stage,
                                   D3DTEXTURESTAGESTATETYPE Type,
                                   DWORD *pValue );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetTextureStageState( struct NineDevice9 *This,
                                   DWORD Stage,
                                   D3DTEXTURESTAGESTATETYPE Type,
                                   DWORD Value );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetSamplerState( struct NineDevice9 *This,
                              DWORD Sampler,
                              D3DSAMPLERSTATETYPE Type,
                              DWORD *pValue );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetSamplerState( struct NineDevice9 *This,
                              DWORD Sampler,
                              D3DSAMPLERSTATETYPE Type,
                              DWORD Value );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_ValidateDevice( struct NineDevice9 *This,
                             DWORD *pNumPasses );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetPaletteEntries( struct NineDevice9 *This,
                                UINT PaletteNumber,
                                const PALETTEENTRY *pEntries );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetPaletteEntries( struct NineDevice9 *This,
                                UINT PaletteNumber,
                                PALETTEENTRY *pEntries );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetCurrentTexturePalette( struct NineDevice9 *This,
                                       UINT PaletteNumber );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetCurrentTexturePalette( struct NineDevice9 *This,
                                       UINT *PaletteNumber );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetScissorRect( struct NineDevice9 *This,
                             const RECT *pRect );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetScissorRect( struct NineDevice9 *This,
                             RECT *pRect );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetSoftwareVertexProcessing( struct NineDevice9 *This,
                                          BOOL bSoftware );
 
-BOOL WINAPI
+BOOL NINE_WINAPI
 NineDevice9_GetSoftwareVertexProcessing( struct NineDevice9 *This );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetNPatchMode( struct NineDevice9 *This,
                            float nSegments );
 
-float WINAPI
+float NINE_WINAPI
 NineDevice9_GetNPatchMode( struct NineDevice9 *This );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_DrawPrimitive( struct NineDevice9 *This,
                            D3DPRIMITIVETYPE PrimitiveType,
                            UINT StartVertex,
                            UINT PrimitiveCount );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_DrawIndexedPrimitive( struct NineDevice9 *This,
                                   D3DPRIMITIVETYPE PrimitiveType,
                                   INT BaseVertexIndex,
@@ -624,14 +624,14 @@ NineDevice9_DrawIndexedPrimitive( struct NineDevice9 *This,
                                   UINT startIndex,
                                   UINT primCount );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_DrawPrimitiveUP( struct NineDevice9 *This,
                              D3DPRIMITIVETYPE PrimitiveType,
                              UINT PrimitiveCount,
                              const void *pVertexStreamZeroData,
                              UINT VertexStreamZeroStride );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 *This,
                                     D3DPRIMITIVETYPE PrimitiveType,
                                     UINT MinVertexIndex,
@@ -642,7 +642,7 @@ NineDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 *This,
                                     const void *pVertexStreamZeroData,
                                     UINT VertexStreamZeroStride );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_ProcessVertices( struct NineDevice9 *This,
                              UINT SrcStartIndex,
                              UINT DestIndex,
@@ -651,175 +651,175 @@ NineDevice9_ProcessVertices( struct NineDevice9 *This,
                              IDirect3DVertexDeclaration9 *pVertexDecl,
                              DWORD Flags );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateVertexDeclaration( struct NineDevice9 *This,
                                      const D3DVERTEXELEMENT9 *pVertexElements,
                                      IDirect3DVertexDeclaration9 **ppDecl );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetVertexDeclaration( struct NineDevice9 *This,
                                   IDirect3DVertexDeclaration9 *pDecl );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetVertexDeclaration( struct NineDevice9 *This,
                                   IDirect3DVertexDeclaration9 **ppDecl );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetFVF( struct NineDevice9 *This,
                     DWORD FVF );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetFVF( struct NineDevice9 *This,
                     DWORD *pFVF );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateVertexShader( struct NineDevice9 *This,
                                 const DWORD *pFunction,
                                 IDirect3DVertexShader9 **ppShader );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetVertexShader( struct NineDevice9 *This,
                              IDirect3DVertexShader9 *pShader );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetVertexShader( struct NineDevice9 *This,
                              IDirect3DVertexShader9 **ppShader );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetVertexShaderConstantF( struct NineDevice9 *This,
                                       UINT StartRegister,
                                       const float *pConstantData,
                                       UINT Vector4fCount );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetVertexShaderConstantF( struct NineDevice9 *This,
                                       UINT StartRegister,
                                       float *pConstantData,
                                       UINT Vector4fCount );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetVertexShaderConstantI( struct NineDevice9 *This,
                                       UINT StartRegister,
                                       const int *pConstantData,
                                       UINT Vector4iCount );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetVertexShaderConstantI( struct NineDevice9 *This,
                                       UINT StartRegister,
                                       int *pConstantData,
                                       UINT Vector4iCount );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetVertexShaderConstantB( struct NineDevice9 *This,
                                       UINT StartRegister,
                                       const BOOL *pConstantData,
                                       UINT BoolCount );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetVertexShaderConstantB( struct NineDevice9 *This,
                                       UINT StartRegister,
                                       BOOL *pConstantData,
                                       UINT BoolCount );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetStreamSource( struct NineDevice9 *This,
                              UINT StreamNumber,
                              IDirect3DVertexBuffer9 *pStreamData,
                              UINT OffsetInBytes,
                              UINT Stride );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetStreamSource( struct NineDevice9 *This,
                              UINT StreamNumber,
                              IDirect3DVertexBuffer9 **ppStreamData,
                              UINT *pOffsetInBytes,
                              UINT *pStride );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetStreamSourceFreq( struct NineDevice9 *This,
                                  UINT StreamNumber,
                                  UINT Setting );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetStreamSourceFreq( struct NineDevice9 *This,
                                  UINT StreamNumber,
                                  UINT *pSetting );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetIndices( struct NineDevice9 *This,
                         IDirect3DIndexBuffer9 *pIndexData );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetIndices( struct NineDevice9 *This,
                         IDirect3DIndexBuffer9 **ppIndexData /*,
                         UINT *pBaseVertexIndex */ );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreatePixelShader( struct NineDevice9 *This,
                                const DWORD *pFunction,
                                IDirect3DPixelShader9 **ppShader );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetPixelShader( struct NineDevice9 *This,
                             IDirect3DPixelShader9 *pShader );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetPixelShader( struct NineDevice9 *This,
                             IDirect3DPixelShader9 **ppShader );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetPixelShaderConstantF( struct NineDevice9 *This,
                                      UINT StartRegister,
                                      const float *pConstantData,
                                      UINT Vector4fCount );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetPixelShaderConstantF( struct NineDevice9 *This,
                                      UINT StartRegister,
                                      float *pConstantData,
                                      UINT Vector4fCount );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetPixelShaderConstantI( struct NineDevice9 *This,
                                      UINT StartRegister,
                                      const int *pConstantData,
                                      UINT Vector4iCount );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetPixelShaderConstantI( struct NineDevice9 *This,
                                      UINT StartRegister,
                                      int *pConstantData,
                                      UINT Vector4iCount );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_SetPixelShaderConstantB( struct NineDevice9 *This,
                                      UINT StartRegister,
                                      const BOOL *pConstantData,
                                      UINT BoolCount );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_GetPixelShaderConstantB( struct NineDevice9 *This,
                                      UINT StartRegister,
                                      BOOL *pConstantData,
                                      UINT BoolCount );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_DrawRectPatch( struct NineDevice9 *This,
                            UINT Handle,
                            const float *pNumSegs,
                            const D3DRECTPATCH_INFO *pRectPatchInfo );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_DrawTriPatch( struct NineDevice9 *This,
                           UINT Handle,
                           const float *pNumSegs,
                           const D3DTRIPATCH_INFO *pTriPatchInfo );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_DeletePatch( struct NineDevice9 *This,
                          UINT Handle );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9_CreateQuery( struct NineDevice9 *This,
                          D3DQUERYTYPE Type,
                          IDirect3DQuery9 **ppQuery );
diff --git a/src/gallium/state_trackers/nine/device9ex.c b/src/gallium/state_trackers/nine/device9ex.c
index 11244b1..fd42724 100644
--- a/src/gallium/state_trackers/nine/device9ex.c
+++ b/src/gallium/state_trackers/nine/device9ex.c
@@ -62,7 +62,7 @@ NineDevice9Ex_dtor( struct NineDevice9Ex *This )
     NineDevice9_dtor(&This->base);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_SetConvolutionMonoKernel( struct NineDevice9Ex *This,
                                         UINT width,
                                         UINT height,
@@ -72,7 +72,7 @@ NineDevice9Ex_SetConvolutionMonoKernel( struct NineDevice9Ex *This,
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_ComposeRects( struct NineDevice9Ex *This,
                             IDirect3DSurface9 *pSrc,
                             IDirect3DSurface9 *pDst,
@@ -86,7 +86,7 @@ NineDevice9Ex_ComposeRects( struct NineDevice9Ex *This,
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_PresentEx( struct NineDevice9Ex *This,
                          const RECT *pSourceRect,
                          const RECT *pDestRect,
@@ -111,28 +111,28 @@ NineDevice9Ex_PresentEx( struct NineDevice9Ex *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_GetGPUThreadPriority( struct NineDevice9Ex *This,
                                     INT *pPriority )
 {
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_SetGPUThreadPriority( struct NineDevice9Ex *This,
                                     INT Priority )
 {
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_WaitForVBlank( struct NineDevice9Ex *This,
                              UINT iSwapChain )
 {
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_CheckResourceResidency( struct NineDevice9Ex *This,
                                       IDirect3DResource9 **pResourceArray,
                                       UINT32 NumResources )
@@ -140,21 +140,21 @@ NineDevice9Ex_CheckResourceResidency( struct NineDevice9Ex *This,
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_SetMaximumFrameLatency( struct NineDevice9Ex *This,
                                       UINT MaxLatency )
 {
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_GetMaximumFrameLatency( struct NineDevice9Ex *This,
                                       UINT *pMaxLatency )
 {
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_CheckDeviceState( struct NineDevice9Ex *This,
                                 HWND hDestinationWindow )
 {
@@ -173,7 +173,7 @@ NineDevice9Ex_CheckDeviceState( struct NineDevice9Ex *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_CreateRenderTargetEx( struct NineDevice9Ex *This,
                                     UINT Width,
                                     UINT Height,
@@ -188,7 +188,7 @@ NineDevice9Ex_CreateRenderTargetEx( struct NineDevice9Ex *This,
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_CreateOffscreenPlainSurfaceEx( struct NineDevice9Ex *This,
                                              UINT Width,
                                              UINT Height,
@@ -201,7 +201,7 @@ NineDevice9Ex_CreateOffscreenPlainSurfaceEx( struct NineDevice9Ex *This,
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_CreateDepthStencilSurfaceEx( struct NineDevice9Ex *This,
                                            UINT Width,
                                            UINT Height,
@@ -216,7 +216,7 @@ NineDevice9Ex_CreateDepthStencilSurfaceEx( struct NineDevice9Ex *This,
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_ResetEx( struct NineDevice9Ex *This,
                        D3DPRESENT_PARAMETERS *pPresentationParameters,
                        D3DDISPLAYMODEEX *pFullscreenDisplayMode )
@@ -241,7 +241,7 @@ NineDevice9Ex_ResetEx( struct NineDevice9Ex *This,
     return hr;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_Reset( struct NineDevice9Ex *This,
                      D3DPRESENT_PARAMETERS *pPresentationParameters )
 {
@@ -267,7 +267,7 @@ NineDevice9Ex_Reset( struct NineDevice9Ex *This,
     return hr;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_GetDisplayModeEx( struct NineDevice9Ex *This,
                                 UINT iSwapChain,
                                 D3DDISPLAYMODEEX *pMode,
@@ -284,7 +284,7 @@ NineDevice9Ex_GetDisplayModeEx( struct NineDevice9Ex *This,
     return NineSwapChain9Ex_GetDisplayModeEx(swapchain, pMode, pRotation);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_TestCooperativeLevel( struct NineDevice9Ex *This )
 {
     return D3D_OK;
diff --git a/src/gallium/state_trackers/nine/device9ex.h b/src/gallium/state_trackers/nine/device9ex.h
index 1c7e57e..3306f23 100644
--- a/src/gallium/state_trackers/nine/device9ex.h
+++ b/src/gallium/state_trackers/nine/device9ex.h
@@ -47,14 +47,14 @@ NineDevice9Ex_new( struct pipe_screen *pScreen,
                    struct NineDevice9Ex **ppOut,
                    int minorVersionNum );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_SetConvolutionMonoKernel( struct NineDevice9Ex *This,
                                         UINT width,
                                         UINT height,
                                         float *rows,
                                         float *columns );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_ComposeRects( struct NineDevice9Ex *This,
                             IDirect3DSurface9 *pSrc,
                             IDirect3DSurface9 *pDst,
@@ -65,7 +65,7 @@ NineDevice9Ex_ComposeRects( struct NineDevice9Ex *This,
                             int Xoffset,
                             int Yoffset );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_PresentEx( struct NineDevice9Ex *This,
                          const RECT *pSourceRect,
                          const RECT *pDestRect,
@@ -73,43 +73,43 @@ NineDevice9Ex_PresentEx( struct NineDevice9Ex *This,
                          const RGNDATA *pDirtyRegion,
                          DWORD dwFlags );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_Present( struct NineDevice9Ex *This,
                      const RECT *pSourceRect,
                      const RECT *pDestRect,
                      HWND hDestWindowOverride,
                      const RGNDATA *pDirtyRegion );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_GetGPUThreadPriority( struct NineDevice9Ex *This,
                                     INT *pPriority );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_SetGPUThreadPriority( struct NineDevice9Ex *This,
                                     INT Priority );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_WaitForVBlank( struct NineDevice9Ex *This,
                              UINT iSwapChain );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_CheckResourceResidency( struct NineDevice9Ex *This,
                                       IDirect3DResource9 **pResourceArray,
                                       UINT32 NumResources );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_SetMaximumFrameLatency( struct NineDevice9Ex *This,
                                       UINT MaxLatency );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_GetMaximumFrameLatency( struct NineDevice9Ex *This,
                                       UINT *pMaxLatency );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_CheckDeviceState( struct NineDevice9Ex *This,
                                 HWND hDestinationWindow );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_CreateRenderTargetEx( struct NineDevice9Ex *This,
                                     UINT Width,
                                     UINT Height,
@@ -121,7 +121,7 @@ NineDevice9Ex_CreateRenderTargetEx( struct NineDevice9Ex *This,
                                     HANDLE *pSharedHandle,
                                     DWORD Usage );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_CreateOffscreenPlainSurfaceEx( struct NineDevice9Ex *This,
                                              UINT Width,
                                              UINT Height,
@@ -131,7 +131,7 @@ NineDevice9Ex_CreateOffscreenPlainSurfaceEx( struct NineDevice9Ex *This,
                                              HANDLE *pSharedHandle,
                                              DWORD Usage );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_CreateDepthStencilSurfaceEx( struct NineDevice9Ex *This,
                                            UINT Width,
                                            UINT Height,
@@ -143,22 +143,22 @@ NineDevice9Ex_CreateDepthStencilSurfaceEx( struct NineDevice9Ex *This,
                                            HANDLE *pSharedHandle,
                                            DWORD Usage );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_ResetEx( struct NineDevice9Ex *This,
                        D3DPRESENT_PARAMETERS *pPresentationParameters,
                        D3DDISPLAYMODEEX *pFullscreenDisplayMode );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_Reset( struct NineDevice9Ex *This,
                      D3DPRESENT_PARAMETERS *pPresentationParameters );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_GetDisplayModeEx( struct NineDevice9Ex *This,
                                 UINT iSwapChain,
                                 D3DDISPLAYMODEEX *pMode,
                                 D3DDISPLAYROTATION *pRotation );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Ex_TestCooperativeLevel( struct NineDevice9Ex *This );
 
 #endif /* _NINE_DEVICE9EX_H_ */
diff --git a/src/gallium/state_trackers/nine/device9video.c b/src/gallium/state_trackers/nine/device9video.c
index 65cc6a0..2e8e94a 100644
--- a/src/gallium/state_trackers/nine/device9video.c
+++ b/src/gallium/state_trackers/nine/device9video.c
@@ -24,7 +24,7 @@
 
 #define DBG_CHANNEL DBG_DEVICEVIDEO
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Video_GetContentProtectionCaps( struct NineDevice9Video *This,
                                            const GUID *pCryptoType,
                                            const GUID *pDecodeProfile,
@@ -33,7 +33,7 @@ NineDevice9Video_GetContentProtectionCaps( struct NineDevice9Video *This,
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Video_CreateAuthenticatedChannel( struct NineDevice9Video *This,
                                              D3DAUTHENTICATEDCHANNELTYPE ChannelType,
                                              IDirect3DAuthenticatedChannel9 **ppAuthenticatedChannel,
@@ -42,7 +42,7 @@ NineDevice9Video_CreateAuthenticatedChannel( struct NineDevice9Video *This,
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Video_CreateCryptoSession( struct NineDevice9Video *This,
                                       const GUID *pCryptoType,
                                       const GUID *pDecodeProfile,
diff --git a/src/gallium/state_trackers/nine/device9video.h b/src/gallium/state_trackers/nine/device9video.h
index fc2faeb..d77fd5e 100644
--- a/src/gallium/state_trackers/nine/device9video.h
+++ b/src/gallium/state_trackers/nine/device9video.h
@@ -35,19 +35,19 @@ NineDevice9Video( void *data )
     return (struct NineDevice9Video *)data;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Video_GetContentProtectionCaps( struct NineDevice9Video *This,
                                            const GUID *pCryptoType,
                                            const GUID *pDecodeProfile,
                                            D3DCONTENTPROTECTIONCAPS *pCaps );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Video_CreateAuthenticatedChannel( struct NineDevice9Video *This,
                                              D3DAUTHENTICATEDCHANNELTYPE ChannelType,
                                              IDirect3DAuthenticatedChannel9 **ppAuthenticatedChannel,
                                              HANDLE *pChannelHandle );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineDevice9Video_CreateCryptoSession( struct NineDevice9Video *This,
                                       const GUID *pCryptoType,
                                       const GUID *pDecodeProfile,
diff --git a/src/gallium/state_trackers/nine/indexbuffer9.c b/src/gallium/state_trackers/nine/indexbuffer9.c
index 401fe75..0a31d7e 100644
--- a/src/gallium/state_trackers/nine/indexbuffer9.c
+++ b/src/gallium/state_trackers/nine/indexbuffer9.c
@@ -85,7 +85,7 @@ NineIndexBuffer9_GetResource( struct NineIndexBuffer9 *This )
     return NineBuffer9_GetResource(&This->base);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineIndexBuffer9_Lock( struct NineIndexBuffer9 *This,
                        UINT OffsetToLock,
                        UINT SizeToLock,
@@ -95,13 +95,13 @@ NineIndexBuffer9_Lock( struct NineIndexBuffer9 *This,
     return NineBuffer9_Lock(&This->base, OffsetToLock, SizeToLock, ppbData, Flags);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineIndexBuffer9_Unlock( struct NineIndexBuffer9 *This )
 {
     return NineBuffer9_Unlock(&This->base);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineIndexBuffer9_GetDesc( struct NineIndexBuffer9 *This,
                           D3DINDEXBUFFER_DESC *pDesc )
 {
diff --git a/src/gallium/state_trackers/nine/indexbuffer9.h b/src/gallium/state_trackers/nine/indexbuffer9.h
index f3274b7..4802105 100644
--- a/src/gallium/state_trackers/nine/indexbuffer9.h
+++ b/src/gallium/state_trackers/nine/indexbuffer9.h
@@ -70,17 +70,17 @@ struct pipe_resource *
 NineIndexBuffer9_GetResource( struct NineIndexBuffer9 *This );
 /*** Direct3D public ***/
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineIndexBuffer9_Lock( struct NineIndexBuffer9 *This,
                        UINT OffsetToLock,
                        UINT SizeToLock,
                        void **ppbData,
                        DWORD Flags );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineIndexBuffer9_Unlock( struct NineIndexBuffer9 *This );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineIndexBuffer9_GetDesc( struct NineIndexBuffer9 *This,
                           D3DINDEXBUFFER_DESC *pDesc );
 
diff --git a/src/gallium/state_trackers/nine/iunknown.c b/src/gallium/state_trackers/nine/iunknown.c
index aaf17bf..a28c8b2 100644
--- a/src/gallium/state_trackers/nine/iunknown.c
+++ b/src/gallium/state_trackers/nine/iunknown.c
@@ -51,7 +51,7 @@ NineUnknown_dtor( struct NineUnknown *This )
     FREE(This);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineUnknown_QueryInterface( struct NineUnknown *This,
                             REFIID riid,
                             void **ppvObject )
@@ -75,7 +75,7 @@ NineUnknown_QueryInterface( struct NineUnknown *This,
     return E_NOINTERFACE;
 }
 
-ULONG WINAPI
+ULONG NINE_WINAPI
 NineUnknown_AddRef( struct NineUnknown *This )
 {
     ULONG r;
@@ -94,7 +94,7 @@ NineUnknown_AddRef( struct NineUnknown *This )
     return r;
 }
 
-ULONG WINAPI
+ULONG NINE_WINAPI
 NineUnknown_Release( struct NineUnknown *This )
 {
     if (This->forward)
@@ -117,7 +117,7 @@ NineUnknown_Release( struct NineUnknown *This )
     return r;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineUnknown_GetDevice( struct NineUnknown *This,
                        IDirect3DDevice9 **ppDevice )
 {
diff --git a/src/gallium/state_trackers/nine/iunknown.h b/src/gallium/state_trackers/nine/iunknown.h
index 628d984..57d3dd6 100644
--- a/src/gallium/state_trackers/nine/iunknown.h
+++ b/src/gallium/state_trackers/nine/iunknown.h
@@ -28,6 +28,7 @@
 #include "util/u_memory.h"
 
 #include "guid.h"
+#include "nine_alignment.h"
 #include "nine_debug.h"
 #include "nine_quirk.h"
 
@@ -77,18 +78,18 @@ NineUnknown_dtor( struct NineUnknown *This );
 
 /*** Direct3D public methods ***/
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineUnknown_QueryInterface( struct NineUnknown *This,
                             REFIID riid,
                             void **ppvObject );
 
-ULONG WINAPI
+ULONG NINE_WINAPI
 NineUnknown_AddRef( struct NineUnknown *This );
 
-ULONG WINAPI
+ULONG NINE_WINAPI
 NineUnknown_Release( struct NineUnknown *This );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineUnknown_GetDevice( struct NineUnknown *This,
                        IDirect3DDevice9 **ppDevice );
 
diff --git a/src/gallium/state_trackers/nine/nine_alignment.h b/src/gallium/state_trackers/nine/nine_alignment.h
new file mode 100644
index 0000000..e621014
--- /dev/null
+++ b/src/gallium/state_trackers/nine/nine_alignment.h
@@ -0,0 +1,14 @@
+
+
+#ifndef _NINE_ALIGNMENT_H_
+#define _NINE_ALIGNMENT_H_
+
+#include "pipe/p_compiler.h"
+
+/* Incoming 32 bits calls are 4-byte aligned.
+ * We need to realign them to be able to use
+ * SSE and to work with other libraries (llvm, etc)
+ */
+#define NINE_WINAPI WINAPI PIPE_ALIGN_STACK 
+
+#endif /* _NINE_ALIGNMENT_H_ */
\ No newline at end of file
diff --git a/src/gallium/state_trackers/nine/nine_lock.c b/src/gallium/state_trackers/nine/nine_lock.c
index 42cbb05..6e15cc1 100644
--- a/src/gallium/state_trackers/nine/nine_lock.c
+++ b/src/gallium/state_trackers/nine/nine_lock.c
@@ -49,7 +49,7 @@
 /* Global mutex as described by MSDN */
 pipe_static_mutex(d3dlock_global);
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockAuthenticatedChannel9_GetCertificateSize( struct NineAuthenticatedChannel9 *This,
                                               UINT *pCertificateSize )
 {
@@ -60,7 +60,7 @@ LockAuthenticatedChannel9_GetCertificateSize( struct NineAuthenticatedChannel9 *
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockAuthenticatedChannel9_GetCertificate( struct NineAuthenticatedChannel9 *This,
                                           UINT CertifacteSize,
                                           BYTE *ppCertificate )
@@ -72,7 +72,7 @@ LockAuthenticatedChannel9_GetCertificate( struct NineAuthenticatedChannel9 *This
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockAuthenticatedChannel9_NegotiateKeyExchange( struct NineAuthenticatedChannel9 *This,
                                                 UINT DataSize,
                                                 void *pData )
@@ -84,7 +84,7 @@ LockAuthenticatedChannel9_NegotiateKeyExchange( struct NineAuthenticatedChannel9
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockAuthenticatedChannel9_Query( struct NineAuthenticatedChannel9 *This,
                                  UINT InputSize,
                                  const void *pInput,
@@ -98,7 +98,7 @@ LockAuthenticatedChannel9_Query( struct NineAuthenticatedChannel9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockAuthenticatedChannel9_Configure( struct NineAuthenticatedChannel9 *This,
                                      UINT InputSize,
                                      const void *pInput,
@@ -123,7 +123,7 @@ IDirect3DAuthenticatedChannel9Vtbl LockAuthenticatedChannel9_vtable = {
 };
 
 #if 0
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockResource9_GetDevice( struct NineResource9 *This,
                          IDirect3DDevice9 **ppDevice )
 {
@@ -135,7 +135,7 @@ LockResource9_GetDevice( struct NineResource9 *This,
 }
 #endif
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockResource9_SetPrivateData( struct NineResource9 *This,
                               REFGUID refguid,
                               const void *pData,
@@ -149,7 +149,7 @@ LockResource9_SetPrivateData( struct NineResource9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockResource9_GetPrivateData( struct NineResource9 *This,
                               REFGUID refguid,
                               void *pData,
@@ -162,7 +162,7 @@ LockResource9_GetPrivateData( struct NineResource9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockResource9_FreePrivateData( struct NineResource9 *This,
                                REFGUID refguid )
 {
@@ -173,7 +173,7 @@ LockResource9_FreePrivateData( struct NineResource9 *This,
     return r;
 }
 
-static DWORD WINAPI
+static DWORD NINE_WINAPI
 LockResource9_SetPriority( struct NineResource9 *This,
                            DWORD PriorityNew )
 {
@@ -184,7 +184,7 @@ LockResource9_SetPriority( struct NineResource9 *This,
     return r;
 }
 
-static DWORD WINAPI
+static DWORD NINE_WINAPI
 LockResource9_GetPriority( struct NineResource9 *This )
 {
     DWORD r;
@@ -195,7 +195,7 @@ LockResource9_GetPriority( struct NineResource9 *This )
 }
 
 #if 0
-static void WINAPI
+static void NINE_WINAPI
 LockResource9_PreLoad( struct NineResource9 *This )
 {
     pipe_mutex_lock(d3dlock_global);
@@ -205,7 +205,7 @@ LockResource9_PreLoad( struct NineResource9 *This )
 #endif
 
 #if 0
-static D3DRESOURCETYPE WINAPI
+static D3DRESOURCETYPE NINE_WINAPI
 LockResource9_GetType( struct NineResource9 *This )
 {
     D3DRESOURCETYPE r;
@@ -216,7 +216,7 @@ LockResource9_GetType( struct NineResource9 *This )
 }
 #endif
 
-static DWORD WINAPI
+static DWORD NINE_WINAPI
 LockBaseTexture9_SetLOD( struct NineBaseTexture9 *This,
                          DWORD LODNew )
 {
@@ -227,7 +227,7 @@ LockBaseTexture9_SetLOD( struct NineBaseTexture9 *This,
     return r;
 }
 
-static DWORD WINAPI
+static DWORD NINE_WINAPI
 LockBaseTexture9_GetLOD( struct NineBaseTexture9 *This )
 {
     DWORD r;
@@ -237,7 +237,7 @@ LockBaseTexture9_GetLOD( struct NineBaseTexture9 *This )
     return r;
 }
 
-static DWORD WINAPI
+static DWORD NINE_WINAPI
 LockBaseTexture9_GetLevelCount( struct NineBaseTexture9 *This )
 {
     DWORD r;
@@ -247,7 +247,7 @@ LockBaseTexture9_GetLevelCount( struct NineBaseTexture9 *This )
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockBaseTexture9_SetAutoGenFilterType( struct NineBaseTexture9 *This,
                                        D3DTEXTUREFILTERTYPE FilterType )
 {
@@ -258,7 +258,7 @@ LockBaseTexture9_SetAutoGenFilterType( struct NineBaseTexture9 *This,
     return r;
 }
 
-static D3DTEXTUREFILTERTYPE WINAPI
+static D3DTEXTUREFILTERTYPE NINE_WINAPI
 LockBaseTexture9_GetAutoGenFilterType( struct NineBaseTexture9 *This )
 {
     D3DTEXTUREFILTERTYPE r;
@@ -268,7 +268,7 @@ LockBaseTexture9_GetAutoGenFilterType( struct NineBaseTexture9 *This )
     return r;
 }
 
-static void WINAPI
+static void NINE_WINAPI
 LockBaseTexture9_PreLoad( struct NineBaseTexture9 *This )
 {
     pipe_mutex_lock(d3dlock_global);
@@ -276,7 +276,7 @@ LockBaseTexture9_PreLoad( struct NineBaseTexture9 *This )
     pipe_mutex_unlock(d3dlock_global);
 }
 
-static void WINAPI
+static void NINE_WINAPI
 LockBaseTexture9_GenerateMipSubLevels( struct NineBaseTexture9 *This )
 {
     pipe_mutex_lock(d3dlock_global);
@@ -284,7 +284,7 @@ LockBaseTexture9_GenerateMipSubLevels( struct NineBaseTexture9 *This )
     pipe_mutex_unlock(d3dlock_global);
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockCryptoSession9_GetCertificateSize( struct NineCryptoSession9 *This,
                                        UINT *pCertificateSize )
 {
@@ -295,7 +295,7 @@ LockCryptoSession9_GetCertificateSize( struct NineCryptoSession9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockCryptoSession9_GetCertificate( struct NineCryptoSession9 *This,
                                    UINT CertifacteSize,
                                    BYTE *ppCertificate )
@@ -307,7 +307,7 @@ LockCryptoSession9_GetCertificate( struct NineCryptoSession9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockCryptoSession9_NegotiateKeyExchange( struct NineCryptoSession9 *This,
                                          UINT DataSize,
                                          void *pData )
@@ -319,7 +319,7 @@ LockCryptoSession9_NegotiateKeyExchange( struct NineCryptoSession9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockCryptoSession9_EncryptionBlt( struct NineCryptoSession9 *This,
                                   IDirect3DSurface9 *pSrcSurface,
                                   IDirect3DSurface9 *pDstSurface,
@@ -333,7 +333,7 @@ LockCryptoSession9_EncryptionBlt( struct NineCryptoSession9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockCryptoSession9_DecryptionBlt( struct NineCryptoSession9 *This,
                                   IDirect3DSurface9 *pSrcSurface,
                                   IDirect3DSurface9 *pDstSurface,
@@ -349,7 +349,7 @@ LockCryptoSession9_DecryptionBlt( struct NineCryptoSession9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockCryptoSession9_GetSurfacePitch( struct NineCryptoSession9 *This,
                                     IDirect3DSurface9 *pSrcSurface,
                                     UINT *pSurfacePitch )
@@ -361,7 +361,7 @@ LockCryptoSession9_GetSurfacePitch( struct NineCryptoSession9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockCryptoSession9_StartSessionKeyRefresh( struct NineCryptoSession9 *This,
                                            void *pRandomNumber,
                                            UINT RandomNumberSize )
@@ -373,7 +373,7 @@ LockCryptoSession9_StartSessionKeyRefresh( struct NineCryptoSession9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockCryptoSession9_FinishSessionKeyRefresh( struct NineCryptoSession9 *This )
 {
     HRESULT r;
@@ -383,7 +383,7 @@ LockCryptoSession9_FinishSessionKeyRefresh( struct NineCryptoSession9 *This )
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockCryptoSession9_GetEncryptionBltKey( struct NineCryptoSession9 *This,
                                         void *pReadbackKey,
                                         UINT KeySize )
@@ -411,7 +411,7 @@ IDirect3DCryptoSession9Vtbl LockCryptoSession9_vtable = {
 };
 
 #if 0
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockCubeTexture9_GetLevelDesc( struct NineCubeTexture9 *This,
                                UINT Level,
                                D3DSURFACE_DESC *pDesc )
@@ -425,7 +425,7 @@ LockCubeTexture9_GetLevelDesc( struct NineCubeTexture9 *This,
 #endif
 
 #if 0
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockCubeTexture9_GetCubeMapSurface( struct NineCubeTexture9 *This,
                                     D3DCUBEMAP_FACES FaceType,
                                     UINT Level,
@@ -439,7 +439,7 @@ LockCubeTexture9_GetCubeMapSurface( struct NineCubeTexture9 *This,
 }
 #endif
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockCubeTexture9_LockRect( struct NineCubeTexture9 *This,
                            D3DCUBEMAP_FACES FaceType,
                            UINT Level,
@@ -454,7 +454,7 @@ LockCubeTexture9_LockRect( struct NineCubeTexture9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockCubeTexture9_UnlockRect( struct NineCubeTexture9 *This,
                              D3DCUBEMAP_FACES FaceType,
                              UINT Level )
@@ -466,7 +466,7 @@ LockCubeTexture9_UnlockRect( struct NineCubeTexture9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockCubeTexture9_AddDirtyRect( struct NineCubeTexture9 *This,
                                D3DCUBEMAP_FACES FaceType,
                                const RECT *pDirtyRect )
@@ -503,7 +503,7 @@ IDirect3DCubeTexture9Vtbl LockCubeTexture9_vtable = {
     (void *)LockCubeTexture9_AddDirtyRect
 };
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_TestCooperativeLevel( struct NineDevice9 *This )
 {
     HRESULT r;
@@ -513,7 +513,7 @@ LockDevice9_TestCooperativeLevel( struct NineDevice9 *This )
     return r;
 }
 
-static UINT WINAPI
+static UINT NINE_WINAPI
 LockDevice9_GetAvailableTextureMem( struct NineDevice9 *This )
 {
     UINT r;
@@ -523,7 +523,7 @@ LockDevice9_GetAvailableTextureMem( struct NineDevice9 *This )
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_EvictManagedResources( struct NineDevice9 *This )
 {
     HRESULT r;
@@ -533,7 +533,7 @@ LockDevice9_EvictManagedResources( struct NineDevice9 *This )
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetDirect3D( struct NineDevice9 *This,
                          IDirect3D9 **ppD3D9 )
 {
@@ -545,7 +545,7 @@ LockDevice9_GetDirect3D( struct NineDevice9 *This,
 }
 
 #if 0
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetDeviceCaps( struct NineDevice9 *This,
                            D3DCAPS9 *pCaps )
 {
@@ -557,7 +557,7 @@ LockDevice9_GetDeviceCaps( struct NineDevice9 *This,
 }
 #endif
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetDisplayMode( struct NineDevice9 *This,
                             UINT iSwapChain,
                             D3DDISPLAYMODE *pMode )
@@ -570,7 +570,7 @@ LockDevice9_GetDisplayMode( struct NineDevice9 *This,
 }
 
 #if 0
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetCreationParameters( struct NineDevice9 *This,
                                    D3DDEVICE_CREATION_PARAMETERS *pParameters )
 {
@@ -582,7 +582,7 @@ LockDevice9_GetCreationParameters( struct NineDevice9 *This,
 }
 #endif
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetCursorProperties( struct NineDevice9 *This,
                                  UINT XHotSpot,
                                  UINT YHotSpot,
@@ -595,7 +595,7 @@ LockDevice9_SetCursorProperties( struct NineDevice9 *This,
     return r;
 }
 
-static void WINAPI
+static void NINE_WINAPI
 LockDevice9_SetCursorPosition( struct NineDevice9 *This,
                                int X,
                                int Y,
@@ -606,7 +606,7 @@ LockDevice9_SetCursorPosition( struct NineDevice9 *This,
     pipe_mutex_unlock(d3dlock_global);
 }
 
-static BOOL WINAPI
+static BOOL NINE_WINAPI
 LockDevice9_ShowCursor( struct NineDevice9 *This,
                         BOOL bShow )
 {
@@ -617,7 +617,7 @@ LockDevice9_ShowCursor( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_CreateAdditionalSwapChain( struct NineDevice9 *This,
                                        D3DPRESENT_PARAMETERS *pPresentationParameters,
                                        IDirect3DSwapChain9 **pSwapChain )
@@ -629,7 +629,7 @@ LockDevice9_CreateAdditionalSwapChain( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetSwapChain( struct NineDevice9 *This,
                           UINT iSwapChain,
                           IDirect3DSwapChain9 **pSwapChain )
@@ -641,7 +641,7 @@ LockDevice9_GetSwapChain( struct NineDevice9 *This,
     return r;
 }
 
-static UINT WINAPI
+static UINT NINE_WINAPI
 LockDevice9_GetNumberOfSwapChains( struct NineDevice9 *This )
 {
     UINT r;
@@ -651,7 +651,7 @@ LockDevice9_GetNumberOfSwapChains( struct NineDevice9 *This )
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_Reset( struct NineDevice9 *This,
                    D3DPRESENT_PARAMETERS *pPresentationParameters )
 {
@@ -662,7 +662,7 @@ LockDevice9_Reset( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_Present( struct NineDevice9 *This,
                      const RECT *pSourceRect,
                      const RECT *pDestRect,
@@ -676,7 +676,7 @@ LockDevice9_Present( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetBackBuffer( struct NineDevice9 *This,
                            UINT iSwapChain,
                            UINT iBackBuffer,
@@ -690,7 +690,7 @@ LockDevice9_GetBackBuffer( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetRasterStatus( struct NineDevice9 *This,
                              UINT iSwapChain,
                              D3DRASTER_STATUS *pRasterStatus )
@@ -702,7 +702,7 @@ LockDevice9_GetRasterStatus( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetDialogBoxMode( struct NineDevice9 *This,
                               BOOL bEnableDialogs )
 {
@@ -713,7 +713,7 @@ LockDevice9_SetDialogBoxMode( struct NineDevice9 *This,
     return r;
 }
 
-static void WINAPI
+static void NINE_WINAPI
 LockDevice9_SetGammaRamp( struct NineDevice9 *This,
                           UINT iSwapChain,
                           DWORD Flags,
@@ -724,7 +724,7 @@ LockDevice9_SetGammaRamp( struct NineDevice9 *This,
     pipe_mutex_unlock(d3dlock_global);
 }
 
-static void WINAPI
+static void NINE_WINAPI
 LockDevice9_GetGammaRamp( struct NineDevice9 *This,
                           UINT iSwapChain,
                           D3DGAMMARAMP *pRamp )
@@ -734,7 +734,7 @@ LockDevice9_GetGammaRamp( struct NineDevice9 *This,
     pipe_mutex_unlock(d3dlock_global);
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_CreateTexture( struct NineDevice9 *This,
                            UINT Width,
                            UINT Height,
@@ -752,7 +752,7 @@ LockDevice9_CreateTexture( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_CreateVolumeTexture( struct NineDevice9 *This,
                                  UINT Width,
                                  UINT Height,
@@ -771,7 +771,7 @@ LockDevice9_CreateVolumeTexture( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_CreateCubeTexture( struct NineDevice9 *This,
                                UINT EdgeLength,
                                UINT Levels,
@@ -788,7 +788,7 @@ LockDevice9_CreateCubeTexture( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_CreateVertexBuffer( struct NineDevice9 *This,
                                 UINT Length,
                                 DWORD Usage,
@@ -804,7 +804,7 @@ LockDevice9_CreateVertexBuffer( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_CreateIndexBuffer( struct NineDevice9 *This,
                                UINT Length,
                                DWORD Usage,
@@ -820,7 +820,7 @@ LockDevice9_CreateIndexBuffer( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_CreateRenderTarget( struct NineDevice9 *This,
                                 UINT Width,
                                 UINT Height,
@@ -838,7 +838,7 @@ LockDevice9_CreateRenderTarget( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_CreateDepthStencilSurface( struct NineDevice9 *This,
                                        UINT Width,
                                        UINT Height,
@@ -856,7 +856,7 @@ LockDevice9_CreateDepthStencilSurface( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_UpdateSurface( struct NineDevice9 *This,
                            IDirect3DSurface9 *pSourceSurface,
                            const RECT *pSourceRect,
@@ -870,7 +870,7 @@ LockDevice9_UpdateSurface( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_UpdateTexture( struct NineDevice9 *This,
                            IDirect3DBaseTexture9 *pSourceTexture,
                            IDirect3DBaseTexture9 *pDestinationTexture )
@@ -882,7 +882,7 @@ LockDevice9_UpdateTexture( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetRenderTargetData( struct NineDevice9 *This,
                                  IDirect3DSurface9 *pRenderTarget,
                                  IDirect3DSurface9 *pDestSurface )
@@ -894,7 +894,7 @@ LockDevice9_GetRenderTargetData( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetFrontBufferData( struct NineDevice9 *This,
                                 UINT iSwapChain,
                                 IDirect3DSurface9 *pDestSurface )
@@ -906,7 +906,7 @@ LockDevice9_GetFrontBufferData( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_StretchRect( struct NineDevice9 *This,
                          IDirect3DSurface9 *pSourceSurface,
                          const RECT *pSourceRect,
@@ -921,7 +921,7 @@ LockDevice9_StretchRect( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_ColorFill( struct NineDevice9 *This,
                        IDirect3DSurface9 *pSurface,
                        const RECT *pRect,
@@ -934,7 +934,7 @@ LockDevice9_ColorFill( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_CreateOffscreenPlainSurface( struct NineDevice9 *This,
                                          UINT Width,
                                          UINT Height,
@@ -950,7 +950,7 @@ LockDevice9_CreateOffscreenPlainSurface( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetRenderTarget( struct NineDevice9 *This,
                              DWORD RenderTargetIndex,
                              IDirect3DSurface9 *pRenderTarget )
@@ -962,7 +962,7 @@ LockDevice9_SetRenderTarget( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetRenderTarget( struct NineDevice9 *This,
                              DWORD RenderTargetIndex,
                              IDirect3DSurface9 **ppRenderTarget )
@@ -974,7 +974,7 @@ LockDevice9_GetRenderTarget( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetDepthStencilSurface( struct NineDevice9 *This,
                                     IDirect3DSurface9 *pNewZStencil )
 {
@@ -985,7 +985,7 @@ LockDevice9_SetDepthStencilSurface( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetDepthStencilSurface( struct NineDevice9 *This,
                                     IDirect3DSurface9 **ppZStencilSurface )
 {
@@ -996,7 +996,7 @@ LockDevice9_GetDepthStencilSurface( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_BeginScene( struct NineDevice9 *This )
 {
     HRESULT r;
@@ -1006,7 +1006,7 @@ LockDevice9_BeginScene( struct NineDevice9 *This )
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_EndScene( struct NineDevice9 *This )
 {
     HRESULT r;
@@ -1016,7 +1016,7 @@ LockDevice9_EndScene( struct NineDevice9 *This )
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_Clear( struct NineDevice9 *This,
                    DWORD Count,
                    const D3DRECT *pRects,
@@ -1032,7 +1032,7 @@ LockDevice9_Clear( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetTransform( struct NineDevice9 *This,
                           D3DTRANSFORMSTATETYPE State,
                           const D3DMATRIX *pMatrix )
@@ -1044,7 +1044,7 @@ LockDevice9_SetTransform( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetTransform( struct NineDevice9 *This,
                           D3DTRANSFORMSTATETYPE State,
                           D3DMATRIX *pMatrix )
@@ -1056,7 +1056,7 @@ LockDevice9_GetTransform( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_MultiplyTransform( struct NineDevice9 *This,
                                D3DTRANSFORMSTATETYPE State,
                                const D3DMATRIX *pMatrix )
@@ -1068,7 +1068,7 @@ LockDevice9_MultiplyTransform( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetViewport( struct NineDevice9 *This,
                          const D3DVIEWPORT9 *pViewport )
 {
@@ -1079,7 +1079,7 @@ LockDevice9_SetViewport( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetViewport( struct NineDevice9 *This,
                          D3DVIEWPORT9 *pViewport )
 {
@@ -1090,7 +1090,7 @@ LockDevice9_GetViewport( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetMaterial( struct NineDevice9 *This,
                          const D3DMATERIAL9 *pMaterial )
 {
@@ -1101,7 +1101,7 @@ LockDevice9_SetMaterial( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetMaterial( struct NineDevice9 *This,
                          D3DMATERIAL9 *pMaterial )
 {
@@ -1112,7 +1112,7 @@ LockDevice9_GetMaterial( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetLight( struct NineDevice9 *This,
                       DWORD Index,
                       const D3DLIGHT9 *pLight )
@@ -1124,7 +1124,7 @@ LockDevice9_SetLight( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetLight( struct NineDevice9 *This,
                       DWORD Index,
                       D3DLIGHT9 *pLight )
@@ -1136,7 +1136,7 @@ LockDevice9_GetLight( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_LightEnable( struct NineDevice9 *This,
                          DWORD Index,
                          BOOL Enable )
@@ -1148,7 +1148,7 @@ LockDevice9_LightEnable( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetLightEnable( struct NineDevice9 *This,
                             DWORD Index,
                             BOOL *pEnable )
@@ -1160,7 +1160,7 @@ LockDevice9_GetLightEnable( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetClipPlane( struct NineDevice9 *This,
                           DWORD Index,
                           const float *pPlane )
@@ -1172,7 +1172,7 @@ LockDevice9_SetClipPlane( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetClipPlane( struct NineDevice9 *This,
                           DWORD Index,
                           float *pPlane )
@@ -1184,7 +1184,7 @@ LockDevice9_GetClipPlane( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetRenderState( struct NineDevice9 *This,
                             D3DRENDERSTATETYPE State,
                             DWORD Value )
@@ -1196,7 +1196,7 @@ LockDevice9_SetRenderState( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetRenderState( struct NineDevice9 *This,
                             D3DRENDERSTATETYPE State,
                             DWORD *pValue )
@@ -1208,7 +1208,7 @@ LockDevice9_GetRenderState( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_CreateStateBlock( struct NineDevice9 *This,
                               D3DSTATEBLOCKTYPE Type,
                               IDirect3DStateBlock9 **ppSB )
@@ -1220,7 +1220,7 @@ LockDevice9_CreateStateBlock( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_BeginStateBlock( struct NineDevice9 *This )
 {
     HRESULT r;
@@ -1230,7 +1230,7 @@ LockDevice9_BeginStateBlock( struct NineDevice9 *This )
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_EndStateBlock( struct NineDevice9 *This,
                            IDirect3DStateBlock9 **ppSB )
 {
@@ -1241,7 +1241,7 @@ LockDevice9_EndStateBlock( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetClipStatus( struct NineDevice9 *This,
                            const D3DCLIPSTATUS9 *pClipStatus )
 {
@@ -1252,7 +1252,7 @@ LockDevice9_SetClipStatus( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetClipStatus( struct NineDevice9 *This,
                            D3DCLIPSTATUS9 *pClipStatus )
 {
@@ -1263,7 +1263,7 @@ LockDevice9_GetClipStatus( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetTexture( struct NineDevice9 *This,
                         DWORD Stage,
                         IDirect3DBaseTexture9 **ppTexture )
@@ -1275,7 +1275,7 @@ LockDevice9_GetTexture( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetTexture( struct NineDevice9 *This,
                         DWORD Stage,
                         IDirect3DBaseTexture9 *pTexture )
@@ -1287,7 +1287,7 @@ LockDevice9_SetTexture( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetTextureStageState( struct NineDevice9 *This,
                                   DWORD Stage,
                                   D3DTEXTURESTAGESTATETYPE Type,
@@ -1300,7 +1300,7 @@ LockDevice9_GetTextureStageState( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetTextureStageState( struct NineDevice9 *This,
                                   DWORD Stage,
                                   D3DTEXTURESTAGESTATETYPE Type,
@@ -1313,7 +1313,7 @@ LockDevice9_SetTextureStageState( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetSamplerState( struct NineDevice9 *This,
                              DWORD Sampler,
                              D3DSAMPLERSTATETYPE Type,
@@ -1326,7 +1326,7 @@ LockDevice9_GetSamplerState( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetSamplerState( struct NineDevice9 *This,
                              DWORD Sampler,
                              D3DSAMPLERSTATETYPE Type,
@@ -1339,7 +1339,7 @@ LockDevice9_SetSamplerState( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_ValidateDevice( struct NineDevice9 *This,
                             DWORD *pNumPasses )
 {
@@ -1350,7 +1350,7 @@ LockDevice9_ValidateDevice( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetPaletteEntries( struct NineDevice9 *This,
                                UINT PaletteNumber,
                                const PALETTEENTRY *pEntries )
@@ -1362,7 +1362,7 @@ LockDevice9_SetPaletteEntries( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetPaletteEntries( struct NineDevice9 *This,
                                UINT PaletteNumber,
                                PALETTEENTRY *pEntries )
@@ -1374,7 +1374,7 @@ LockDevice9_GetPaletteEntries( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetCurrentTexturePalette( struct NineDevice9 *This,
                                       UINT PaletteNumber )
 {
@@ -1385,7 +1385,7 @@ LockDevice9_SetCurrentTexturePalette( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetCurrentTexturePalette( struct NineDevice9 *This,
                                       UINT *PaletteNumber )
 {
@@ -1396,7 +1396,7 @@ LockDevice9_GetCurrentTexturePalette( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetScissorRect( struct NineDevice9 *This,
                             const RECT *pRect )
 {
@@ -1407,7 +1407,7 @@ LockDevice9_SetScissorRect( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetScissorRect( struct NineDevice9 *This,
                             RECT *pRect )
 {
@@ -1418,7 +1418,7 @@ LockDevice9_GetScissorRect( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetSoftwareVertexProcessing( struct NineDevice9 *This,
                                          BOOL bSoftware )
 {
@@ -1429,7 +1429,7 @@ LockDevice9_SetSoftwareVertexProcessing( struct NineDevice9 *This,
     return r;
 }
 
-static BOOL WINAPI
+static BOOL NINE_WINAPI
 LockDevice9_GetSoftwareVertexProcessing( struct NineDevice9 *This )
 {
     BOOL r;
@@ -1439,7 +1439,7 @@ LockDevice9_GetSoftwareVertexProcessing( struct NineDevice9 *This )
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetNPatchMode( struct NineDevice9 *This,
                            float nSegments )
 {
@@ -1450,7 +1450,7 @@ LockDevice9_SetNPatchMode( struct NineDevice9 *This,
     return r;
 }
 
-static float WINAPI
+static float NINE_WINAPI
 LockDevice9_GetNPatchMode( struct NineDevice9 *This )
 {
     float r;
@@ -1460,7 +1460,7 @@ LockDevice9_GetNPatchMode( struct NineDevice9 *This )
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_DrawPrimitive( struct NineDevice9 *This,
                            D3DPRIMITIVETYPE PrimitiveType,
                            UINT StartVertex,
@@ -1473,7 +1473,7 @@ LockDevice9_DrawPrimitive( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_DrawIndexedPrimitive( struct NineDevice9 *This,
                                   D3DPRIMITIVETYPE PrimitiveType,
                                   INT BaseVertexIndex,
@@ -1489,7 +1489,7 @@ LockDevice9_DrawIndexedPrimitive( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_DrawPrimitiveUP( struct NineDevice9 *This,
                              D3DPRIMITIVETYPE PrimitiveType,
                              UINT PrimitiveCount,
@@ -1503,7 +1503,7 @@ LockDevice9_DrawPrimitiveUP( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 *This,
                                     D3DPRIMITIVETYPE PrimitiveType,
                                     UINT MinVertexIndex,
@@ -1521,7 +1521,7 @@ LockDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_ProcessVertices( struct NineDevice9 *This,
                              UINT SrcStartIndex,
                              UINT DestIndex,
@@ -1537,7 +1537,7 @@ LockDevice9_ProcessVertices( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_CreateVertexDeclaration( struct NineDevice9 *This,
                                      const D3DVERTEXELEMENT9 *pVertexElements,
                                      IDirect3DVertexDeclaration9 **ppDecl )
@@ -1549,7 +1549,7 @@ LockDevice9_CreateVertexDeclaration( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetVertexDeclaration( struct NineDevice9 *This,
                                   IDirect3DVertexDeclaration9 *pDecl )
 {
@@ -1560,7 +1560,7 @@ LockDevice9_SetVertexDeclaration( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetVertexDeclaration( struct NineDevice9 *This,
                                   IDirect3DVertexDeclaration9 **ppDecl )
 {
@@ -1571,7 +1571,7 @@ LockDevice9_GetVertexDeclaration( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetFVF( struct NineDevice9 *This,
                     DWORD FVF )
 {
@@ -1582,7 +1582,7 @@ LockDevice9_SetFVF( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetFVF( struct NineDevice9 *This,
                     DWORD *pFVF )
 {
@@ -1593,7 +1593,7 @@ LockDevice9_GetFVF( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_CreateVertexShader( struct NineDevice9 *This,
                                 const DWORD *pFunction,
                                 IDirect3DVertexShader9 **ppShader )
@@ -1605,7 +1605,7 @@ LockDevice9_CreateVertexShader( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetVertexShader( struct NineDevice9 *This,
                              IDirect3DVertexShader9 *pShader )
 {
@@ -1616,7 +1616,7 @@ LockDevice9_SetVertexShader( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetVertexShader( struct NineDevice9 *This,
                              IDirect3DVertexShader9 **ppShader )
 {
@@ -1627,7 +1627,7 @@ LockDevice9_GetVertexShader( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetVertexShaderConstantF( struct NineDevice9 *This,
                                       UINT StartRegister,
                                       const float *pConstantData,
@@ -1640,7 +1640,7 @@ LockDevice9_SetVertexShaderConstantF( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetVertexShaderConstantF( struct NineDevice9 *This,
                                       UINT StartRegister,
                                       float *pConstantData,
@@ -1653,7 +1653,7 @@ LockDevice9_GetVertexShaderConstantF( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetVertexShaderConstantI( struct NineDevice9 *This,
                                       UINT StartRegister,
                                       const int *pConstantData,
@@ -1666,7 +1666,7 @@ LockDevice9_SetVertexShaderConstantI( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetVertexShaderConstantI( struct NineDevice9 *This,
                                       UINT StartRegister,
                                       int *pConstantData,
@@ -1679,7 +1679,7 @@ LockDevice9_GetVertexShaderConstantI( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetVertexShaderConstantB( struct NineDevice9 *This,
                                       UINT StartRegister,
                                       const BOOL *pConstantData,
@@ -1692,7 +1692,7 @@ LockDevice9_SetVertexShaderConstantB( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetVertexShaderConstantB( struct NineDevice9 *This,
                                       UINT StartRegister,
                                       BOOL *pConstantData,
@@ -1705,7 +1705,7 @@ LockDevice9_GetVertexShaderConstantB( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetStreamSource( struct NineDevice9 *This,
                              UINT StreamNumber,
                              IDirect3DVertexBuffer9 *pStreamData,
@@ -1719,7 +1719,7 @@ LockDevice9_SetStreamSource( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetStreamSource( struct NineDevice9 *This,
                              UINT StreamNumber,
                              IDirect3DVertexBuffer9 **ppStreamData,
@@ -1733,7 +1733,7 @@ LockDevice9_GetStreamSource( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetStreamSourceFreq( struct NineDevice9 *This,
                                  UINT StreamNumber,
                                  UINT Setting )
@@ -1745,7 +1745,7 @@ LockDevice9_SetStreamSourceFreq( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetStreamSourceFreq( struct NineDevice9 *This,
                                  UINT StreamNumber,
                                  UINT *pSetting )
@@ -1757,7 +1757,7 @@ LockDevice9_GetStreamSourceFreq( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetIndices( struct NineDevice9 *This,
                         IDirect3DIndexBuffer9 *pIndexData )
 {
@@ -1768,7 +1768,7 @@ LockDevice9_SetIndices( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetIndices( struct NineDevice9 *This,
                         IDirect3DIndexBuffer9 **ppIndexData )
 {
@@ -1779,7 +1779,7 @@ LockDevice9_GetIndices( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_CreatePixelShader( struct NineDevice9 *This,
                                const DWORD *pFunction,
                                IDirect3DPixelShader9 **ppShader )
@@ -1791,7 +1791,7 @@ LockDevice9_CreatePixelShader( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetPixelShader( struct NineDevice9 *This,
                             IDirect3DPixelShader9 *pShader )
 {
@@ -1802,7 +1802,7 @@ LockDevice9_SetPixelShader( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetPixelShader( struct NineDevice9 *This,
                             IDirect3DPixelShader9 **ppShader )
 {
@@ -1813,7 +1813,7 @@ LockDevice9_GetPixelShader( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetPixelShaderConstantF( struct NineDevice9 *This,
                                      UINT StartRegister,
                                      const float *pConstantData,
@@ -1826,7 +1826,7 @@ LockDevice9_SetPixelShaderConstantF( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetPixelShaderConstantF( struct NineDevice9 *This,
                                      UINT StartRegister,
                                      float *pConstantData,
@@ -1839,7 +1839,7 @@ LockDevice9_GetPixelShaderConstantF( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetPixelShaderConstantI( struct NineDevice9 *This,
                                      UINT StartRegister,
                                      const int *pConstantData,
@@ -1852,7 +1852,7 @@ LockDevice9_SetPixelShaderConstantI( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetPixelShaderConstantI( struct NineDevice9 *This,
                                      UINT StartRegister,
                                      int *pConstantData,
@@ -1865,7 +1865,7 @@ LockDevice9_GetPixelShaderConstantI( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_SetPixelShaderConstantB( struct NineDevice9 *This,
                                      UINT StartRegister,
                                      const BOOL *pConstantData,
@@ -1878,7 +1878,7 @@ LockDevice9_SetPixelShaderConstantB( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_GetPixelShaderConstantB( struct NineDevice9 *This,
                                      UINT StartRegister,
                                      BOOL *pConstantData,
@@ -1891,7 +1891,7 @@ LockDevice9_GetPixelShaderConstantB( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_DrawRectPatch( struct NineDevice9 *This,
                            UINT Handle,
                            const float *pNumSegs,
@@ -1904,7 +1904,7 @@ LockDevice9_DrawRectPatch( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_DrawTriPatch( struct NineDevice9 *This,
                           UINT Handle,
                           const float *pNumSegs,
@@ -1917,7 +1917,7 @@ LockDevice9_DrawTriPatch( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_DeletePatch( struct NineDevice9 *This,
                          UINT Handle )
 {
@@ -1928,7 +1928,7 @@ LockDevice9_DeletePatch( struct NineDevice9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9_CreateQuery( struct NineDevice9 *This,
                          D3DQUERYTYPE Type,
                          IDirect3DQuery9 **ppQuery )
@@ -2062,7 +2062,7 @@ IDirect3DDevice9Vtbl LockDevice9_vtable = {
     (void *)LockDevice9_CreateQuery
 };
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9Ex_SetConvolutionMonoKernel( struct NineDevice9Ex *This,
                                         UINT width,
                                         UINT height,
@@ -2076,7 +2076,7 @@ LockDevice9Ex_SetConvolutionMonoKernel( struct NineDevice9Ex *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9Ex_ComposeRects( struct NineDevice9Ex *This,
                             IDirect3DSurface9 *pSrc,
                             IDirect3DSurface9 *pDst,
@@ -2094,7 +2094,7 @@ LockDevice9Ex_ComposeRects( struct NineDevice9Ex *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9Ex_PresentEx( struct NineDevice9Ex *This,
                          const RECT *pSourceRect,
                          const RECT *pDestRect,
@@ -2109,7 +2109,7 @@ LockDevice9Ex_PresentEx( struct NineDevice9Ex *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9Ex_GetGPUThreadPriority( struct NineDevice9Ex *This,
                                     INT *pPriority )
 {
@@ -2120,7 +2120,7 @@ LockDevice9Ex_GetGPUThreadPriority( struct NineDevice9Ex *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9Ex_SetGPUThreadPriority( struct NineDevice9Ex *This,
                                     INT Priority )
 {
@@ -2131,7 +2131,7 @@ LockDevice9Ex_SetGPUThreadPriority( struct NineDevice9Ex *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9Ex_WaitForVBlank( struct NineDevice9Ex *This,
                              UINT iSwapChain )
 {
@@ -2142,7 +2142,7 @@ LockDevice9Ex_WaitForVBlank( struct NineDevice9Ex *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9Ex_CheckResourceResidency( struct NineDevice9Ex *This,
                                       IDirect3DResource9 **pResourceArray,
                                       UINT32 NumResources )
@@ -2154,7 +2154,7 @@ LockDevice9Ex_CheckResourceResidency( struct NineDevice9Ex *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9Ex_SetMaximumFrameLatency( struct NineDevice9Ex *This,
                                       UINT MaxLatency )
 {
@@ -2165,7 +2165,7 @@ LockDevice9Ex_SetMaximumFrameLatency( struct NineDevice9Ex *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9Ex_GetMaximumFrameLatency( struct NineDevice9Ex *This,
                                       UINT *pMaxLatency )
 {
@@ -2176,7 +2176,7 @@ LockDevice9Ex_GetMaximumFrameLatency( struct NineDevice9Ex *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9Ex_CheckDeviceState( struct NineDevice9Ex *This,
                                 HWND hDestinationWindow )
 {
@@ -2187,7 +2187,7 @@ LockDevice9Ex_CheckDeviceState( struct NineDevice9Ex *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9Ex_CreateRenderTargetEx( struct NineDevice9Ex *This,
                                     UINT Width,
                                     UINT Height,
@@ -2206,7 +2206,7 @@ LockDevice9Ex_CreateRenderTargetEx( struct NineDevice9Ex *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9Ex_CreateOffscreenPlainSurfaceEx( struct NineDevice9Ex *This,
                                              UINT Width,
                                              UINT Height,
@@ -2223,7 +2223,7 @@ LockDevice9Ex_CreateOffscreenPlainSurfaceEx( struct NineDevice9Ex *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9Ex_CreateDepthStencilSurfaceEx( struct NineDevice9Ex *This,
                                            UINT Width,
                                            UINT Height,
@@ -2242,7 +2242,7 @@ LockDevice9Ex_CreateDepthStencilSurfaceEx( struct NineDevice9Ex *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9Ex_ResetEx( struct NineDevice9Ex *This,
                        D3DPRESENT_PARAMETERS *pPresentationParameters,
                        D3DDISPLAYMODEEX *pFullscreenDisplayMode )
@@ -2254,7 +2254,7 @@ LockDevice9Ex_ResetEx( struct NineDevice9Ex *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9Ex_GetDisplayModeEx( struct NineDevice9Ex *This,
                                 UINT iSwapChain,
                                 D3DDISPLAYMODEEX *pMode,
@@ -2404,7 +2404,7 @@ IDirect3DDevice9ExVtbl LockDevice9Ex_vtable = {
     (void *)LockDevice9Ex_GetDisplayModeEx
 };
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9Video_GetContentProtectionCaps( struct NineDevice9Video *This,
                                            const GUID *pCryptoType,
                                            const GUID *pDecodeProfile,
@@ -2417,7 +2417,7 @@ LockDevice9Video_GetContentProtectionCaps( struct NineDevice9Video *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9Video_CreateAuthenticatedChannel( struct NineDevice9Video *This,
                                              D3DAUTHENTICATEDCHANNELTYPE ChannelType,
                                              IDirect3DAuthenticatedChannel9 **ppAuthenticatedChannel,
@@ -2430,7 +2430,7 @@ LockDevice9Video_CreateAuthenticatedChannel( struct NineDevice9Video *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockDevice9Video_CreateCryptoSession( struct NineDevice9Video *This,
                                       const GUID *pCryptoType,
                                       const GUID *pDecodeProfile,
@@ -2453,7 +2453,7 @@ IDirect3DDevice9VideoVtbl LockDevice9Video_vtable = {
     (void *)LockDevice9Video_CreateCryptoSession
 };
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockIndexBuffer9_Lock( struct NineIndexBuffer9 *This,
                        UINT OffsetToLock,
                        UINT SizeToLock,
@@ -2467,7 +2467,7 @@ LockIndexBuffer9_Lock( struct NineIndexBuffer9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockIndexBuffer9_Unlock( struct NineIndexBuffer9 *This )
 {
     HRESULT r;
@@ -2478,7 +2478,7 @@ LockIndexBuffer9_Unlock( struct NineIndexBuffer9 *This )
 }
 
 #if 0
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockIndexBuffer9_GetDesc( struct NineIndexBuffer9 *This,
                           D3DINDEXBUFFER_DESC *pDesc )
 {
@@ -2508,7 +2508,7 @@ IDirect3DIndexBuffer9Vtbl LockIndexBuffer9_vtable = {
 };
 
 #if 0
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockPixelShader9_GetDevice( struct NinePixelShader9 *This,
                             IDirect3DDevice9 **ppDevice )
 {
@@ -2520,7 +2520,7 @@ LockPixelShader9_GetDevice( struct NinePixelShader9 *This,
 }
 #endif
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockPixelShader9_GetFunction( struct NinePixelShader9 *This,
                               void *pData,
                               UINT *pSizeOfData )
@@ -2541,7 +2541,7 @@ IDirect3DPixelShader9Vtbl LockPixelShader9_vtable = {
 };
 
 #if 0
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockQuery9_GetDevice( struct NineQuery9 *This,
                       IDirect3DDevice9 **ppDevice )
 {
@@ -2554,7 +2554,7 @@ LockQuery9_GetDevice( struct NineQuery9 *This,
 #endif
 
 #if 0
-static D3DQUERYTYPE WINAPI
+static D3DQUERYTYPE NINE_WINAPI
 LockQuery9_GetType( struct NineQuery9 *This )
 {
     D3DQUERYTYPE r;
@@ -2566,7 +2566,7 @@ LockQuery9_GetType( struct NineQuery9 *This )
 #endif
 
 #if 0
-static DWORD WINAPI
+static DWORD NINE_WINAPI
 LockQuery9_GetDataSize( struct NineQuery9 *This )
 {
     DWORD r;
@@ -2577,7 +2577,7 @@ LockQuery9_GetDataSize( struct NineQuery9 *This )
 }
 #endif
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockQuery9_Issue( struct NineQuery9 *This,
                   DWORD dwIssueFlags )
 {
@@ -2588,7 +2588,7 @@ LockQuery9_Issue( struct NineQuery9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockQuery9_GetData( struct NineQuery9 *This,
                     void *pData,
                     DWORD dwSize,
@@ -2613,7 +2613,7 @@ IDirect3DQuery9Vtbl LockQuery9_vtable = {
 };
 
 #if 0
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockStateBlock9_GetDevice( struct NineStateBlock9 *This,
                            IDirect3DDevice9 **ppDevice )
 {
@@ -2625,7 +2625,7 @@ LockStateBlock9_GetDevice( struct NineStateBlock9 *This,
 }
 #endif
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockStateBlock9_Capture( struct NineStateBlock9 *This )
 {
     HRESULT r;
@@ -2635,7 +2635,7 @@ LockStateBlock9_Capture( struct NineStateBlock9 *This )
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockStateBlock9_Apply( struct NineStateBlock9 *This )
 {
     HRESULT r;
@@ -2654,7 +2654,7 @@ IDirect3DStateBlock9Vtbl LockStateBlock9_vtable = {
     (void *)LockStateBlock9_Apply
 };
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockSurface9_GetContainer( struct NineSurface9 *This,
                            REFIID riid,
                            void **ppContainer )
@@ -2667,7 +2667,7 @@ LockSurface9_GetContainer( struct NineSurface9 *This,
 }
 
 #if 0
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockSurface9_GetDesc( struct NineSurface9 *This,
                       D3DSURFACE_DESC *pDesc )
 {
@@ -2679,7 +2679,7 @@ LockSurface9_GetDesc( struct NineSurface9 *This,
 }
 #endif
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockSurface9_LockRect( struct NineSurface9 *This,
                        D3DLOCKED_RECT *pLockedRect,
                        const RECT *pRect,
@@ -2692,7 +2692,7 @@ LockSurface9_LockRect( struct NineSurface9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockSurface9_UnlockRect( struct NineSurface9 *This )
 {
     HRESULT r;
@@ -2702,7 +2702,7 @@ LockSurface9_UnlockRect( struct NineSurface9 *This )
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockSurface9_GetDC( struct NineSurface9 *This,
                     HDC *phdc )
 {
@@ -2713,7 +2713,7 @@ LockSurface9_GetDC( struct NineSurface9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockSurface9_ReleaseDC( struct NineSurface9 *This,
                         HDC hdc )
 {
@@ -2744,7 +2744,7 @@ IDirect3DSurface9Vtbl LockSurface9_vtable = {
     (void *)LockSurface9_ReleaseDC
 };
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockSwapChain9_Present( struct NineSwapChain9 *This,
                         const RECT *pSourceRect,
                         const RECT *pDestRect,
@@ -2759,7 +2759,7 @@ LockSwapChain9_Present( struct NineSwapChain9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockSwapChain9_GetFrontBufferData( struct NineSwapChain9 *This,
                                    IDirect3DSurface9 *pDestSurface )
 {
@@ -2770,7 +2770,7 @@ LockSwapChain9_GetFrontBufferData( struct NineSwapChain9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockSwapChain9_GetBackBuffer( struct NineSwapChain9 *This,
                               UINT iBackBuffer,
                               D3DBACKBUFFER_TYPE Type,
@@ -2783,7 +2783,7 @@ LockSwapChain9_GetBackBuffer( struct NineSwapChain9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockSwapChain9_GetRasterStatus( struct NineSwapChain9 *This,
                                 D3DRASTER_STATUS *pRasterStatus )
 {
@@ -2794,7 +2794,7 @@ LockSwapChain9_GetRasterStatus( struct NineSwapChain9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockSwapChain9_GetDisplayMode( struct NineSwapChain9 *This,
                                D3DDISPLAYMODE *pMode )
 {
@@ -2806,7 +2806,7 @@ LockSwapChain9_GetDisplayMode( struct NineSwapChain9 *This,
 }
 
 #if 0
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockSwapChain9_GetDevice( struct NineSwapChain9 *This,
                           IDirect3DDevice9 **ppDevice )
 {
@@ -2818,7 +2818,7 @@ LockSwapChain9_GetDevice( struct NineSwapChain9 *This,
 }
 #endif
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockSwapChain9_GetPresentParameters( struct NineSwapChain9 *This,
                                      D3DPRESENT_PARAMETERS *pPresentationParameters )
 {
@@ -2842,7 +2842,7 @@ IDirect3DSwapChain9Vtbl LockSwapChain9_vtable = {
     (void *)LockSwapChain9_GetPresentParameters
 };
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockSwapChain9Ex_GetLastPresentCount( struct NineSwapChain9Ex *This,
                                       UINT *pLastPresentCount )
 {
@@ -2853,7 +2853,7 @@ LockSwapChain9Ex_GetLastPresentCount( struct NineSwapChain9Ex *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockSwapChain9Ex_GetPresentStats( struct NineSwapChain9Ex *This,
                                   D3DPRESENTSTATS *pPresentationStatistics )
 {
@@ -2864,7 +2864,7 @@ LockSwapChain9Ex_GetPresentStats( struct NineSwapChain9Ex *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockSwapChain9Ex_GetDisplayModeEx( struct NineSwapChain9Ex *This,
                                    D3DDISPLAYMODEEX *pMode,
                                    D3DDISPLAYROTATION *pRotation )
@@ -2893,7 +2893,7 @@ IDirect3DSwapChain9ExVtbl LockSwapChain9Ex_vtable = {
 };
 
 #if 0
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockTexture9_GetLevelDesc( struct NineTexture9 *This,
                            UINT Level,
                            D3DSURFACE_DESC *pDesc )
@@ -2907,7 +2907,7 @@ LockTexture9_GetLevelDesc( struct NineTexture9 *This,
 #endif
 
 #if 0
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockTexture9_GetSurfaceLevel( struct NineTexture9 *This,
                               UINT Level,
                               IDirect3DSurface9 **ppSurfaceLevel )
@@ -2920,7 +2920,7 @@ LockTexture9_GetSurfaceLevel( struct NineTexture9 *This,
 }
 #endif
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockTexture9_LockRect( struct NineTexture9 *This,
                        UINT Level,
                        D3DLOCKED_RECT *pLockedRect,
@@ -2934,7 +2934,7 @@ LockTexture9_LockRect( struct NineTexture9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockTexture9_UnlockRect( struct NineTexture9 *This,
                          UINT Level )
 {
@@ -2945,7 +2945,7 @@ LockTexture9_UnlockRect( struct NineTexture9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockTexture9_AddDirtyRect( struct NineTexture9 *This,
                            const RECT *pDirtyRect )
 {
@@ -2981,7 +2981,7 @@ IDirect3DTexture9Vtbl LockTexture9_vtable = {
     (void *)LockTexture9_AddDirtyRect
 };
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockVertexBuffer9_Lock( struct NineVertexBuffer9 *This,
                         UINT OffsetToLock,
                         UINT SizeToLock,
@@ -2995,7 +2995,7 @@ LockVertexBuffer9_Lock( struct NineVertexBuffer9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockVertexBuffer9_Unlock( struct NineVertexBuffer9 *This )
 {
     HRESULT r;
@@ -3006,7 +3006,7 @@ LockVertexBuffer9_Unlock( struct NineVertexBuffer9 *This )
 }
 
 #if 0
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockVertexBuffer9_GetDesc( struct NineVertexBuffer9 *This,
                            D3DVERTEXBUFFER_DESC *pDesc )
 {
@@ -3036,7 +3036,7 @@ IDirect3DVertexBuffer9Vtbl LockVertexBuffer9_vtable = {
 };
 
 #if 0
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockVertexDeclaration9_GetDevice( struct NineVertexDeclaration9 *This,
                                   IDirect3DDevice9 **ppDevice )
 {
@@ -3048,7 +3048,7 @@ LockVertexDeclaration9_GetDevice( struct NineVertexDeclaration9 *This,
 }
 #endif
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockVertexDeclaration9_GetDeclaration( struct NineVertexDeclaration9 *This,
                                        D3DVERTEXELEMENT9 *pElement,
                                        UINT *pNumElements )
@@ -3069,7 +3069,7 @@ IDirect3DVertexDeclaration9Vtbl LockVertexDeclaration9_vtable = {
 };
 
 #if 0
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockVertexShader9_GetDevice( struct NineVertexShader9 *This,
                              IDirect3DDevice9 **ppDevice )
 {
@@ -3081,7 +3081,7 @@ LockVertexShader9_GetDevice( struct NineVertexShader9 *This,
 }
 #endif
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockVertexShader9_GetFunction( struct NineVertexShader9 *This,
                                void *pData,
                                UINT *pSizeOfData )
@@ -3102,7 +3102,7 @@ IDirect3DVertexShader9Vtbl LockVertexShader9_vtable = {
 };
 
 #if 0
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockVolume9_GetDevice( struct NineVolume9 *This,
                        IDirect3DDevice9 **ppDevice )
 {
@@ -3114,7 +3114,7 @@ LockVolume9_GetDevice( struct NineVolume9 *This,
 }
 #endif
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockVolume9_SetPrivateData( struct NineVolume9 *This,
                             REFGUID refguid,
                             const void *pData,
@@ -3128,7 +3128,7 @@ LockVolume9_SetPrivateData( struct NineVolume9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockVolume9_GetPrivateData( struct NineVolume9 *This,
                             REFGUID refguid,
                             void *pData,
@@ -3141,7 +3141,7 @@ LockVolume9_GetPrivateData( struct NineVolume9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockVolume9_FreePrivateData( struct NineVolume9 *This,
                              REFGUID refguid )
 {
@@ -3152,7 +3152,7 @@ LockVolume9_FreePrivateData( struct NineVolume9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockVolume9_GetContainer( struct NineVolume9 *This,
                           REFIID riid,
                           void **ppContainer )
@@ -3165,7 +3165,7 @@ LockVolume9_GetContainer( struct NineVolume9 *This,
 }
 
 #if 0
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockVolume9_GetDesc( struct NineVolume9 *This,
                      D3DVOLUME_DESC *pDesc )
 {
@@ -3177,7 +3177,7 @@ LockVolume9_GetDesc( struct NineVolume9 *This,
 }
 #endif
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockVolume9_LockBox( struct NineVolume9 *This,
                      D3DLOCKED_BOX *pLockedVolume,
                      const D3DBOX *pBox,
@@ -3190,7 +3190,7 @@ LockVolume9_LockBox( struct NineVolume9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockVolume9_UnlockBox( struct NineVolume9 *This )
 {
     HRESULT r;
@@ -3215,7 +3215,7 @@ IDirect3DVolume9Vtbl LockVolume9_vtable = {
 };
 
 #if 0
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockVolumeTexture9_GetLevelDesc( struct NineVolumeTexture9 *This,
                                  UINT Level,
                                  D3DVOLUME_DESC *pDesc )
@@ -3229,7 +3229,7 @@ LockVolumeTexture9_GetLevelDesc( struct NineVolumeTexture9 *This,
 #endif
 
 #if 0
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockVolumeTexture9_GetVolumeLevel( struct NineVolumeTexture9 *This,
                                    UINT Level,
                                    IDirect3DVolume9 **ppVolumeLevel )
@@ -3242,7 +3242,7 @@ LockVolumeTexture9_GetVolumeLevel( struct NineVolumeTexture9 *This,
 }
 #endif
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockVolumeTexture9_LockBox( struct NineVolumeTexture9 *This,
                             UINT Level,
                             D3DLOCKED_BOX *pLockedVolume,
@@ -3256,7 +3256,7 @@ LockVolumeTexture9_LockBox( struct NineVolumeTexture9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockVolumeTexture9_UnlockBox( struct NineVolumeTexture9 *This,
                               UINT Level )
 {
@@ -3267,7 +3267,7 @@ LockVolumeTexture9_UnlockBox( struct NineVolumeTexture9 *This,
     return r;
 }
 
-static HRESULT WINAPI
+static HRESULT NINE_WINAPI
 LockVolumeTexture9_AddDirtyBox( struct NineVolumeTexture9 *This,
                                 const D3DBOX *pDirtyBox )
 {
diff --git a/src/gallium/state_trackers/nine/nineexoverlayextension.c b/src/gallium/state_trackers/nine/nineexoverlayextension.c
index 2253f8d..6a4f287 100644
--- a/src/gallium/state_trackers/nine/nineexoverlayextension.c
+++ b/src/gallium/state_trackers/nine/nineexoverlayextension.c
@@ -24,7 +24,7 @@
 
 #define DBG_CHANNEL DBG_OVERLAYEXTENSION
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 Nine9ExOverlayExtension_CheckDeviceOverlayType( struct Nine9ExOverlayExtension *This,
                                                 UINT Adapter,
                                                 D3DDEVTYPE DevType,
diff --git a/src/gallium/state_trackers/nine/nineexoverlayextension.h b/src/gallium/state_trackers/nine/nineexoverlayextension.h
index 1616ed0..f528f1d 100644
--- a/src/gallium/state_trackers/nine/nineexoverlayextension.h
+++ b/src/gallium/state_trackers/nine/nineexoverlayextension.h
@@ -35,7 +35,7 @@ Nine9ExOverlayExtension( void *data )
     return (struct Nine9ExOverlayExtension *)data;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 Nine9ExOverlayExtension_CheckDeviceOverlayType( struct Nine9ExOverlayExtension *This,
                                                 UINT Adapter,
                                                 D3DDEVTYPE DevType,
diff --git a/src/gallium/state_trackers/nine/pixelshader9.c b/src/gallium/state_trackers/nine/pixelshader9.c
index 00be67f..541919c 100644
--- a/src/gallium/state_trackers/nine/pixelshader9.c
+++ b/src/gallium/state_trackers/nine/pixelshader9.c
@@ -116,7 +116,7 @@ NinePixelShader9_dtor( struct NinePixelShader9 *This )
     NineUnknown_dtor(&This->base);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NinePixelShader9_GetFunction( struct NinePixelShader9 *This,
                               void *pData,
                               UINT *pSizeOfData )
diff --git a/src/gallium/state_trackers/nine/pixelshader9.h b/src/gallium/state_trackers/nine/pixelshader9.h
index 6b43181..1fef1c4 100644
--- a/src/gallium/state_trackers/nine/pixelshader9.h
+++ b/src/gallium/state_trackers/nine/pixelshader9.h
@@ -126,7 +126,7 @@ NinePixelShader9_ctor( struct NinePixelShader9 *,
 void
 NinePixelShader9_dtor( struct NinePixelShader9 * );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NinePixelShader9_GetFunction( struct NinePixelShader9 *This,
                               void *pData,
                               UINT *pSizeOfData );
diff --git a/src/gallium/state_trackers/nine/query9.c b/src/gallium/state_trackers/nine/query9.c
index 3afa900..39ac831 100644
--- a/src/gallium/state_trackers/nine/query9.c
+++ b/src/gallium/state_trackers/nine/query9.c
@@ -143,19 +143,19 @@ NineQuery9_dtor( struct NineQuery9 *This )
     NineUnknown_dtor(&This->base);
 }
 
-D3DQUERYTYPE WINAPI
+D3DQUERYTYPE NINE_WINAPI
 NineQuery9_GetType( struct NineQuery9 *This )
 {
     return This->type;
 }
 
-DWORD WINAPI
+DWORD NINE_WINAPI
 NineQuery9_GetDataSize( struct NineQuery9 *This )
 {
     return This->result_size;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineQuery9_Issue( struct NineQuery9 *This,
                   DWORD dwIssueFlags )
 {
@@ -197,7 +197,7 @@ union nine_query_result
     UINT64 u64;
 };
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineQuery9_GetData( struct NineQuery9 *This,
                     void *pData,
                     DWORD dwSize,
diff --git a/src/gallium/state_trackers/nine/query9.h b/src/gallium/state_trackers/nine/query9.h
index 9cc1e31..6397a4c 100644
--- a/src/gallium/state_trackers/nine/query9.h
+++ b/src/gallium/state_trackers/nine/query9.h
@@ -63,17 +63,17 @@ NineQuery9_ctor( struct NineQuery9 *,
 void
 NineQuery9_dtor( struct NineQuery9 * );
 
-D3DQUERYTYPE WINAPI
+D3DQUERYTYPE NINE_WINAPI
 NineQuery9_GetType( struct NineQuery9 *This );
 
-DWORD WINAPI
+DWORD NINE_WINAPI
 NineQuery9_GetDataSize( struct NineQuery9 *This );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineQuery9_Issue( struct NineQuery9 *This,
                   DWORD dwIssueFlags );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineQuery9_GetData( struct NineQuery9 *This,
                     void *pData,
                     DWORD dwSize,
diff --git a/src/gallium/state_trackers/nine/resource9.c b/src/gallium/state_trackers/nine/resource9.c
index b929c50..d01c222 100644
--- a/src/gallium/state_trackers/nine/resource9.c
+++ b/src/gallium/state_trackers/nine/resource9.c
@@ -138,7 +138,7 @@ NineResource9_GetPool( struct NineResource9 *This )
     return This->pool;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineResource9_SetPrivateData( struct NineResource9 *This,
                               REFGUID refguid,
                               const void *pData,
@@ -187,7 +187,7 @@ NineResource9_SetPrivateData( struct NineResource9 *This,
     return D3DERR_DRIVERINTERNALERROR;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineResource9_GetPrivateData( struct NineResource9 *This,
                               REFGUID refguid,
                               void *pData,
@@ -220,7 +220,7 @@ NineResource9_GetPrivateData( struct NineResource9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineResource9_FreePrivateData( struct NineResource9 *This,
                                REFGUID refguid )
 {
@@ -239,7 +239,7 @@ NineResource9_FreePrivateData( struct NineResource9 *This,
     return D3D_OK;
 }
 
-DWORD WINAPI
+DWORD NINE_WINAPI
 NineResource9_SetPriority( struct NineResource9 *This,
                            DWORD PriorityNew )
 {
@@ -254,7 +254,7 @@ NineResource9_SetPriority( struct NineResource9 *This,
     return prev;
 }
 
-DWORD WINAPI
+DWORD NINE_WINAPI
 NineResource9_GetPriority( struct NineResource9 *This )
 {
     if (This->pool != D3DPOOL_MANAGED || This->type == D3DRTYPE_SURFACE)
@@ -264,7 +264,7 @@ NineResource9_GetPriority( struct NineResource9 *This )
 }
 
 /* NOTE: Don't forget to adjust locked vtable if you change this ! */
-void WINAPI
+void NINE_WINAPI
 NineResource9_PreLoad( struct NineResource9 *This )
 {
     if (This->pool != D3DPOOL_MANAGED)
@@ -275,7 +275,7 @@ NineResource9_PreLoad( struct NineResource9 *This )
      */
 }
 
-D3DRESOURCETYPE WINAPI
+D3DRESOURCETYPE NINE_WINAPI
 NineResource9_GetType( struct NineResource9 *This )
 {
     return This->type;
diff --git a/src/gallium/state_trackers/nine/resource9.h b/src/gallium/state_trackers/nine/resource9.h
index 8122257..24a241c 100644
--- a/src/gallium/state_trackers/nine/resource9.h
+++ b/src/gallium/state_trackers/nine/resource9.h
@@ -76,34 +76,34 @@ NineResource9_GetPool( struct NineResource9 *This );
 
 /*** Direct3D public methods ***/
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineResource9_SetPrivateData( struct NineResource9 *This,
                               REFGUID refguid,
                               const void *pData,
                               DWORD SizeOfData,
                               DWORD Flags );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineResource9_GetPrivateData( struct NineResource9 *This,
                               REFGUID refguid,
                               void *pData,
                               DWORD *pSizeOfData );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineResource9_FreePrivateData( struct NineResource9 *This,
                                REFGUID refguid );
 
-DWORD WINAPI
+DWORD NINE_WINAPI
 NineResource9_SetPriority( struct NineResource9 *This,
                            DWORD PriorityNew );
 
-DWORD WINAPI
+DWORD NINE_WINAPI
 NineResource9_GetPriority( struct NineResource9 *This );
 
-void WINAPI
+void NINE_WINAPI
 NineResource9_PreLoad( struct NineResource9 *This );
 
-D3DRESOURCETYPE WINAPI
+D3DRESOURCETYPE NINE_WINAPI
 NineResource9_GetType( struct NineResource9 *This );
 
 #endif /* _NINE_RESOURCE9_H_ */
diff --git a/src/gallium/state_trackers/nine/stateblock9.c b/src/gallium/state_trackers/nine/stateblock9.c
index 4789346..cc368b7 100644
--- a/src/gallium/state_trackers/nine/stateblock9.c
+++ b/src/gallium/state_trackers/nine/stateblock9.c
@@ -470,7 +470,7 @@ nine_state_copy_common_all(struct nine_state *dst,
 /* Capture those bits of current device state that have been changed between
  * BeginStateBlock and EndStateBlock.
  */
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineStateBlock9_Capture( struct NineStateBlock9 *This )
 {
     struct nine_state *dst = &This->state;
@@ -500,7 +500,7 @@ NineStateBlock9_Capture( struct NineStateBlock9 *This )
 }
 
 /* Set state managed by this StateBlock as current device state. */
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineStateBlock9_Apply( struct NineStateBlock9 *This )
 {
     struct nine_state *dst = &This->base.device->state;
diff --git a/src/gallium/state_trackers/nine/stateblock9.h b/src/gallium/state_trackers/nine/stateblock9.h
index a580c6a..ffcc2d9 100644
--- a/src/gallium/state_trackers/nine/stateblock9.h
+++ b/src/gallium/state_trackers/nine/stateblock9.h
@@ -62,10 +62,10 @@ NineStateBlock9_ctor( struct NineStateBlock9 *,
 void
 NineStateBlock9_dtor( struct NineStateBlock9 * );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineStateBlock9_Capture( struct NineStateBlock9 *This );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineStateBlock9_Apply( struct NineStateBlock9 *This );
 
 #endif /* _NINE_STATEBLOCK9_H_ */
diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c
index eaf142b..4c4234b 100644
--- a/src/gallium/state_trackers/nine/surface9.c
+++ b/src/gallium/state_trackers/nine/surface9.c
@@ -225,7 +225,7 @@ NineSurface9_Dump( struct NineSurface9 *This )
 }
 #endif /* DEBUG */
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSurface9_GetContainer( struct NineSurface9 *This,
                            REFIID riid,
                            void **ppContainer )
@@ -258,7 +258,7 @@ NineSurface9_MarkContainerDirty( struct NineSurface9 *This )
     }
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSurface9_GetDesc( struct NineSurface9 *This,
                       D3DSURFACE_DESC *pDesc )
 {
@@ -313,7 +313,7 @@ NineSurface9_GetSystemMemPointer(struct NineSurface9 *This, int x, int y)
     return This->data + (y * This->stride + x_offset);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSurface9_LockRect( struct NineSurface9 *This,
                        D3DLOCKED_RECT *pLockedRect,
                        const RECT *pRect,
@@ -424,7 +424,7 @@ NineSurface9_LockRect( struct NineSurface9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSurface9_UnlockRect( struct NineSurface9 *This )
 {
     DBG("This=%p lock_count=%u\n", This, This->lock_count);
@@ -437,14 +437,14 @@ NineSurface9_UnlockRect( struct NineSurface9 *This )
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSurface9_GetDC( struct NineSurface9 *This,
                     HDC *phdc )
 {
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSurface9_ReleaseDC( struct NineSurface9 *This,
                         HDC hdc )
 {
diff --git a/src/gallium/state_trackers/nine/surface9.h b/src/gallium/state_trackers/nine/surface9.h
index 76156ae..7e8f2d3 100644
--- a/src/gallium/state_trackers/nine/surface9.h
+++ b/src/gallium/state_trackers/nine/surface9.h
@@ -151,29 +151,29 @@ NineSurface9_Dump( struct NineSurface9 *This ) { }
 
 /*** Direct3D public ***/
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSurface9_GetContainer( struct NineSurface9 *This,
                            REFIID riid,
                            void **ppContainer );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSurface9_GetDesc( struct NineSurface9 *This,
                       D3DSURFACE_DESC *pDesc );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSurface9_LockRect( struct NineSurface9 *This,
                        D3DLOCKED_RECT *pLockedRect,
                        const RECT *pRect,
                        DWORD Flags );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSurface9_UnlockRect( struct NineSurface9 *This );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSurface9_GetDC( struct NineSurface9 *This,
                     HDC *phdc );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSurface9_ReleaseDC( struct NineSurface9 *This,
                         HDC hdc );
 
diff --git a/src/gallium/state_trackers/nine/swapchain9.c b/src/gallium/state_trackers/nine/swapchain9.c
index 313fede..1ab339c 100644
--- a/src/gallium/state_trackers/nine/swapchain9.c
+++ b/src/gallium/state_trackers/nine/swapchain9.c
@@ -764,7 +764,7 @@ bypass_rendering:
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSwapChain9_Present( struct NineSwapChain9 *This,
                         const RECT *pSourceRect,
                         const RECT *pDestRect,
@@ -858,7 +858,7 @@ NineSwapChain9_Present( struct NineSwapChain9 *This,
     return hr;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSwapChain9_GetFrontBufferData( struct NineSwapChain9 *This,
                                    IDirect3DSurface9 *pDestSurface )
 {
@@ -911,7 +911,7 @@ NineSwapChain9_GetFrontBufferData( struct NineSwapChain9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSwapChain9_GetBackBuffer( struct NineSwapChain9 *This,
                               UINT iBackBuffer,
                               D3DBACKBUFFER_TYPE Type,
@@ -929,7 +929,7 @@ NineSwapChain9_GetBackBuffer( struct NineSwapChain9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSwapChain9_GetRasterStatus( struct NineSwapChain9 *This,
                                 D3DRASTER_STATUS *pRasterStatus )
 {
@@ -939,7 +939,7 @@ NineSwapChain9_GetRasterStatus( struct NineSwapChain9 *This,
     return ID3DPresent_GetRasterStatus(This->present, pRasterStatus);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSwapChain9_GetDisplayMode( struct NineSwapChain9 *This,
                                D3DDISPLAYMODE *pMode )
 {
@@ -961,7 +961,7 @@ NineSwapChain9_GetDisplayMode( struct NineSwapChain9 *This,
     return hr;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSwapChain9_GetPresentParameters( struct NineSwapChain9 *This,
                                      D3DPRESENT_PARAMETERS *pPresentationParameters )
 {
diff --git a/src/gallium/state_trackers/nine/swapchain9.h b/src/gallium/state_trackers/nine/swapchain9.h
index 4bd74f7..7714cd5 100644
--- a/src/gallium/state_trackers/nine/swapchain9.h
+++ b/src/gallium/state_trackers/nine/swapchain9.h
@@ -109,7 +109,7 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This,
                        D3DPRESENT_PARAMETERS *pParams,
                        D3DDISPLAYMODEEX *mode );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSwapChain9_Present( struct NineSwapChain9 *This,
                         const RECT *pSourceRect,
                         const RECT *pDestRect,
@@ -117,25 +117,25 @@ NineSwapChain9_Present( struct NineSwapChain9 *This,
                         const RGNDATA *pDirtyRegion,
                         DWORD dwFlags );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSwapChain9_GetFrontBufferData( struct NineSwapChain9 *This,
                                    IDirect3DSurface9 *pDestSurface );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSwapChain9_GetBackBuffer( struct NineSwapChain9 *This,
                               UINT iBackBuffer,
                               D3DBACKBUFFER_TYPE Type,
                               IDirect3DSurface9 **ppBackBuffer );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSwapChain9_GetRasterStatus( struct NineSwapChain9 *This,
                                 D3DRASTER_STATUS *pRasterStatus );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSwapChain9_GetDisplayMode( struct NineSwapChain9 *This,
                                D3DDISPLAYMODE *pMode );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSwapChain9_GetPresentParameters( struct NineSwapChain9 *This,
                                      D3DPRESENT_PARAMETERS *pPresentationParameters );
 
diff --git a/src/gallium/state_trackers/nine/swapchain9ex.c b/src/gallium/state_trackers/nine/swapchain9ex.c
index bcf627f..309402c 100644
--- a/src/gallium/state_trackers/nine/swapchain9ex.c
+++ b/src/gallium/state_trackers/nine/swapchain9ex.c
@@ -51,21 +51,21 @@ NineSwapChain9Ex_dtor( struct NineSwapChain9Ex *This )
     NineSwapChain9_dtor(&This->base);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSwapChain9Ex_GetLastPresentCount( struct NineSwapChain9Ex *This,
                                       UINT *pLastPresentCount )
 {
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSwapChain9Ex_GetPresentStats( struct NineSwapChain9Ex *This,
                                   D3DPRESENTSTATS *pPresentationStatistics )
 {
     STUB(D3DERR_INVALIDCALL);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSwapChain9Ex_GetDisplayModeEx( struct NineSwapChain9Ex *This,
                                    D3DDISPLAYMODEEX *pMode,
                                    D3DDISPLAYROTATION *pRotation )
diff --git a/src/gallium/state_trackers/nine/swapchain9ex.h b/src/gallium/state_trackers/nine/swapchain9ex.h
index 075f883..a15d9d2 100644
--- a/src/gallium/state_trackers/nine/swapchain9ex.h
+++ b/src/gallium/state_trackers/nine/swapchain9ex.h
@@ -45,15 +45,15 @@ NineSwapChain9Ex_new( struct NineDevice9 *pDevice,
                       D3DDISPLAYMODEEX *mode,
                       struct NineSwapChain9Ex **ppOut );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSwapChain9Ex_GetLastPresentCount( struct NineSwapChain9Ex *This,
                                       UINT *pLastPresentCount );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSwapChain9Ex_GetPresentStats( struct NineSwapChain9Ex *This,
                                   D3DPRESENTSTATS *pPresentationStatistics );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineSwapChain9Ex_GetDisplayModeEx( struct NineSwapChain9Ex *This,
                                    D3DDISPLAYMODEEX *pMode,
                                    D3DDISPLAYROTATION *pRotation );
diff --git a/src/gallium/state_trackers/nine/texture9.c b/src/gallium/state_trackers/nine/texture9.c
index 6c4569b..3b88e07 100644
--- a/src/gallium/state_trackers/nine/texture9.c
+++ b/src/gallium/state_trackers/nine/texture9.c
@@ -240,7 +240,7 @@ NineTexture9_dtor( struct NineTexture9 *This )
     NineBaseTexture9_dtor(&This->base);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineTexture9_GetLevelDesc( struct NineTexture9 *This,
                            UINT Level,
                            D3DSURFACE_DESC *pDesc )
@@ -254,7 +254,7 @@ NineTexture9_GetLevelDesc( struct NineTexture9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineTexture9_GetSurfaceLevel( struct NineTexture9 *This,
                               UINT Level,
                               IDirect3DSurface9 **ppSurfaceLevel )
@@ -269,7 +269,7 @@ NineTexture9_GetSurfaceLevel( struct NineTexture9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineTexture9_LockRect( struct NineTexture9 *This,
                        UINT Level,
                        D3DLOCKED_RECT *pLockedRect,
@@ -287,7 +287,7 @@ NineTexture9_LockRect( struct NineTexture9 *This,
                                  pRect, Flags);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineTexture9_UnlockRect( struct NineTexture9 *This,
                          UINT Level )
 {
@@ -298,7 +298,7 @@ NineTexture9_UnlockRect( struct NineTexture9 *This,
     return NineSurface9_UnlockRect(This->surfaces[Level]);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineTexture9_AddDirtyRect( struct NineTexture9 *This,
                            const RECT *pDirtyRect )
 {
diff --git a/src/gallium/state_trackers/nine/texture9.h b/src/gallium/state_trackers/nine/texture9.h
index 6f80be9..3911f26 100644
--- a/src/gallium/state_trackers/nine/texture9.h
+++ b/src/gallium/state_trackers/nine/texture9.h
@@ -48,28 +48,28 @@ NineTexture9_new( struct NineDevice9 *pDevice,
                   struct NineTexture9 **ppOut,
                   HANDLE *pSharedHandle );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineTexture9_GetLevelDesc( struct NineTexture9 *This,
                            UINT Level,
                            D3DSURFACE_DESC *pDesc );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineTexture9_GetSurfaceLevel( struct NineTexture9 *This,
                               UINT Level,
                               IDirect3DSurface9 **ppSurfaceLevel );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineTexture9_LockRect( struct NineTexture9 *This,
                        UINT Level,
                        D3DLOCKED_RECT *pLockedRect,
                        const RECT *pRect,
                        DWORD Flags );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineTexture9_UnlockRect( struct NineTexture9 *This,
                          UINT Level );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineTexture9_AddDirtyRect( struct NineTexture9 *This,
                            const RECT *pDirtyRect );
 
diff --git a/src/gallium/state_trackers/nine/vertexbuffer9.c b/src/gallium/state_trackers/nine/vertexbuffer9.c
index 10311b4..7c00b2d 100644
--- a/src/gallium/state_trackers/nine/vertexbuffer9.c
+++ b/src/gallium/state_trackers/nine/vertexbuffer9.c
@@ -68,7 +68,7 @@ NineVertexBuffer9_GetResource( struct NineVertexBuffer9 *This )
     return NineBuffer9_GetResource(&This->base);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVertexBuffer9_Lock( struct NineVertexBuffer9 *This,
                        UINT OffsetToLock,
                        UINT SizeToLock,
@@ -78,13 +78,13 @@ NineVertexBuffer9_Lock( struct NineVertexBuffer9 *This,
     return NineBuffer9_Lock(&This->base, OffsetToLock, SizeToLock, ppbData, Flags);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVertexBuffer9_Unlock( struct NineVertexBuffer9 *This )
 {
     return NineBuffer9_Unlock(&This->base);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVertexBuffer9_GetDesc( struct NineVertexBuffer9 *This,
                            D3DVERTEXBUFFER_DESC *pDesc )
 {
diff --git a/src/gallium/state_trackers/nine/vertexbuffer9.h b/src/gallium/state_trackers/nine/vertexbuffer9.h
index 859402b..6caa9bf 100644
--- a/src/gallium/state_trackers/nine/vertexbuffer9.h
+++ b/src/gallium/state_trackers/nine/vertexbuffer9.h
@@ -62,17 +62,17 @@ NineVertexBuffer9_GetResource( struct NineVertexBuffer9 *This );
 
 /*** Direct3D public ***/
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVertexBuffer9_Lock( struct NineVertexBuffer9 *This,
                         UINT OffsetToLock,
                         UINT SizeToLock,
                         void **ppbData,
                         DWORD Flags );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVertexBuffer9_Unlock( struct NineVertexBuffer9 *This );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVertexBuffer9_GetDesc( struct NineVertexBuffer9 *This,
                            D3DVERTEXBUFFER_DESC *pDesc );
 
diff --git a/src/gallium/state_trackers/nine/vertexdeclaration9.c b/src/gallium/state_trackers/nine/vertexdeclaration9.c
index 36c594b..e478c10 100644
--- a/src/gallium/state_trackers/nine/vertexdeclaration9.c
+++ b/src/gallium/state_trackers/nine/vertexdeclaration9.c
@@ -233,7 +233,7 @@ NineVertexDeclaration9_dtor( struct NineVertexDeclaration9 *This )
     NineUnknown_dtor(&This->base);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVertexDeclaration9_GetDeclaration( struct NineVertexDeclaration9 *This,
                                        D3DVERTEXELEMENT9 *pElement,
                                        UINT *pNumElements )
diff --git a/src/gallium/state_trackers/nine/vertexdeclaration9.h b/src/gallium/state_trackers/nine/vertexdeclaration9.h
index e39f259..9d3b1bd 100644
--- a/src/gallium/state_trackers/nine/vertexdeclaration9.h
+++ b/src/gallium/state_trackers/nine/vertexdeclaration9.h
@@ -73,7 +73,7 @@ NineVertexDeclaration9_ctor( struct NineVertexDeclaration9 *This,
 void
 NineVertexDeclaration9_dtor( struct NineVertexDeclaration9 *This );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVertexDeclaration9_GetDeclaration( struct NineVertexDeclaration9 *This,
                                        D3DVERTEXELEMENT9 *pElement,
                                        UINT *pNumElements );
diff --git a/src/gallium/state_trackers/nine/vertexshader9.c b/src/gallium/state_trackers/nine/vertexshader9.c
index fdfb79a..7978ea8 100644
--- a/src/gallium/state_trackers/nine/vertexshader9.c
+++ b/src/gallium/state_trackers/nine/vertexshader9.c
@@ -123,7 +123,7 @@ NineVertexShader9_dtor( struct NineVertexShader9 *This )
     NineUnknown_dtor(&This->base);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVertexShader9_GetFunction( struct NineVertexShader9 *This,
                                void *pData,
                                UINT *pSizeOfData )
diff --git a/src/gallium/state_trackers/nine/vertexshader9.h b/src/gallium/state_trackers/nine/vertexshader9.h
index 15c3f4f..c89d4a1 100644
--- a/src/gallium/state_trackers/nine/vertexshader9.h
+++ b/src/gallium/state_trackers/nine/vertexshader9.h
@@ -107,7 +107,7 @@ NineVertexShader9_ctor( struct NineVertexShader9 *,
 void
 NineVertexShader9_dtor( struct NineVertexShader9 * );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVertexShader9_GetFunction( struct NineVertexShader9 *This,
                                void *pData,
                                UINT *pSizeOfData );
diff --git a/src/gallium/state_trackers/nine/volume9.c b/src/gallium/state_trackers/nine/volume9.c
index 8504ffa..7d54a7a 100644
--- a/src/gallium/state_trackers/nine/volume9.c
+++ b/src/gallium/state_trackers/nine/volume9.c
@@ -141,7 +141,7 @@ NineVolume9_dtor( struct NineVolume9 *This )
     NineUnknown_dtor(&This->base);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolume9_GetContainer( struct NineVolume9 *This,
                           REFIID riid,
                           void **ppContainer )
@@ -172,7 +172,7 @@ NineVolume9_MarkContainerDirty( struct NineVolume9 *This )
     BASETEX_REGISTER_UPDATE(tex);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolume9_GetDesc( struct NineVolume9 *This,
                      D3DVOLUME_DESC *pDesc )
 {
@@ -212,7 +212,7 @@ NineVolume9_GetSystemMemPointer(struct NineVolume9 *This, int x, int y, int z)
     return This->data + (z * This->layer_stride + y * This->stride + x_offset);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolume9_LockBox( struct NineVolume9 *This,
                      D3DLOCKED_BOX *pLockedVolume,
                      const D3DBOX *pBox,
@@ -306,7 +306,7 @@ NineVolume9_LockBox( struct NineVolume9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolume9_UnlockBox( struct NineVolume9 *This )
 {
     DBG("This=%p lock_count=%u\n", This, This->lock_count);
@@ -441,7 +441,7 @@ NineVolume9_new( struct NineDevice9 *pDevice,
 
 /*** The boring stuff. TODO: Unify with Resource. ***/
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolume9_SetPrivateData( struct NineVolume9 *This,
                             REFGUID refguid,
                             const void *pData,
@@ -488,7 +488,7 @@ NineVolume9_SetPrivateData( struct NineVolume9 *This,
     return D3DERR_DRIVERINTERNALERROR;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolume9_GetPrivateData( struct NineVolume9 *This,
                             REFGUID refguid,
                             void *pData,
@@ -515,7 +515,7 @@ NineVolume9_GetPrivateData( struct NineVolume9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolume9_FreePrivateData( struct NineVolume9 *This,
                              REFGUID refguid )
 {
diff --git a/src/gallium/state_trackers/nine/volume9.h b/src/gallium/state_trackers/nine/volume9.h
index 26ca8a3..2eb19a5 100644
--- a/src/gallium/state_trackers/nine/volume9.h
+++ b/src/gallium/state_trackers/nine/volume9.h
@@ -96,39 +96,39 @@ NineVolume9_UploadSelf( struct NineVolume9 *This,
 
 /*** Direct3D public ***/
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolume9_SetPrivateData( struct NineVolume9 *This,
                             REFGUID refguid,
                             const void *pData,
                             DWORD SizeOfData,
                             DWORD Flags );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolume9_GetPrivateData( struct NineVolume9 *This,
                             REFGUID refguid,
                             void *pData,
                             DWORD *pSizeOfData );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolume9_FreePrivateData( struct NineVolume9 *This,
                              REFGUID refguid );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolume9_GetContainer( struct NineVolume9 *This,
                           REFIID riid,
                           void **ppContainer );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolume9_GetDesc( struct NineVolume9 *This,
                      D3DVOLUME_DESC *pDesc );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolume9_LockBox( struct NineVolume9 *This,
                      D3DLOCKED_BOX *pLockedVolume,
                      const D3DBOX *pBox,
                      DWORD Flags );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolume9_UnlockBox( struct NineVolume9 *This );
 
 #endif /* _NINE_VOLUME9_H_ */
diff --git a/src/gallium/state_trackers/nine/volumetexture9.c b/src/gallium/state_trackers/nine/volumetexture9.c
index 439106d..e70f3c1 100644
--- a/src/gallium/state_trackers/nine/volumetexture9.c
+++ b/src/gallium/state_trackers/nine/volumetexture9.c
@@ -150,7 +150,7 @@ NineVolumeTexture9_dtor( struct NineVolumeTexture9 *This )
     NineBaseTexture9_dtor(&This->base);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolumeTexture9_GetLevelDesc( struct NineVolumeTexture9 *This,
                                  UINT Level,
                                  D3DVOLUME_DESC *pDesc )
@@ -162,7 +162,7 @@ NineVolumeTexture9_GetLevelDesc( struct NineVolumeTexture9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolumeTexture9_GetVolumeLevel( struct NineVolumeTexture9 *This,
                                    UINT Level,
                                    IDirect3DVolume9 **ppVolumeLevel )
@@ -175,7 +175,7 @@ NineVolumeTexture9_GetVolumeLevel( struct NineVolumeTexture9 *This,
     return D3D_OK;
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolumeTexture9_LockBox( struct NineVolumeTexture9 *This,
                             UINT Level,
                             D3DLOCKED_BOX *pLockedVolume,
@@ -191,7 +191,7 @@ NineVolumeTexture9_LockBox( struct NineVolumeTexture9 *This,
                                Flags);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolumeTexture9_UnlockBox( struct NineVolumeTexture9 *This,
                               UINT Level )
 {
@@ -202,7 +202,7 @@ NineVolumeTexture9_UnlockBox( struct NineVolumeTexture9 *This,
     return NineVolume9_UnlockBox(This->volumes[Level]);
 }
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolumeTexture9_AddDirtyBox( struct NineVolumeTexture9 *This,
                                 const D3DBOX *pDirtyBox )
 {
diff --git a/src/gallium/state_trackers/nine/volumetexture9.h b/src/gallium/state_trackers/nine/volumetexture9.h
index b8f250a..dfe564c 100644
--- a/src/gallium/state_trackers/nine/volumetexture9.h
+++ b/src/gallium/state_trackers/nine/volumetexture9.h
@@ -47,28 +47,28 @@ NineVolumeTexture9_new( struct NineDevice9 *pDevice,
                         struct NineVolumeTexture9 **ppOut,
                         HANDLE *pSharedHandle );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolumeTexture9_GetLevelDesc( struct NineVolumeTexture9 *This,
                                  UINT Level,
                                  D3DVOLUME_DESC *pDesc );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolumeTexture9_GetVolumeLevel( struct NineVolumeTexture9 *This,
                                    UINT Level,
                                    IDirect3DVolume9 **ppVolumeLevel );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolumeTexture9_LockBox( struct NineVolumeTexture9 *This,
                             UINT Level,
                             D3DLOCKED_BOX *pLockedVolume,
                             const D3DBOX *pBox,
                             DWORD Flags );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolumeTexture9_UnlockBox( struct NineVolumeTexture9 *This,
                               UINT Level );
 
-HRESULT WINAPI
+HRESULT NINE_WINAPI
 NineVolumeTexture9_AddDirtyBox( struct NineVolumeTexture9 *This,
                                 const D3DBOX *pDirtyBox );
 
-- 
2.7.0



More information about the mesa-dev mailing list