Explorar o código

Struct, Interface and param updates.

woollybah %!s(int64=9) %!d(string=hai) anos
pai
achega
642ccef732

+ 26 - 233
directx.mod/d3d.bmx

@@ -569,263 +569,56 @@ Type D3DMATRIX
 End Type
 
 Extern
-	Function bmx_directx_D3DDISPLAYMODE_new:Byte Ptr()
-	Function bmx_directx_D3DDISPLAYMODE_free(handle:Byte Ptr)
-	Function bmx_directx_D3DDISPLAYMODE_GetWidth:Int(handle:Byte Ptr)
-	Function bmx_directx_D3DDISPLAYMODE_GetHeight:Int(handle:Byte Ptr)
-	Function bmx_directx_D3DDISPLAYMODE_GetRefreshRate:Int(handle:Byte Ptr)
-	Function bmx_directx_D3DDISPLAYMODE_GetFormat:Int(handle:Byte Ptr)
+Struct D3DDISPLAYMODE
+	Field Width:UInt
+	Field Height:UInt
+	Field RefreshRate:UInt
+	Field Format:Int
+End Struct
 End Extern
 
-Type D3DDISPLAYMODE
-	Field modePtr:Byte Ptr
-	
-	Method New()
-		modePtr = bmx_directx_D3DDISPLAYMODE_new()
-	End Method
-	
-	Method Delete()
-		If modePtr Then
-			bmx_directx_D3DDISPLAYMODE_free(modePtr)
-			modePtr = Null
-		End If
-	End Method
-	
-	Method GetWidth:Int()
-		Return bmx_directx_D3DDISPLAYMODE_GetWidth(modePtr)
-	End Method
-	
-	Method GetHeight:Int()
-		Return bmx_directx_D3DDISPLAYMODE_GetHeight(modePtr)
-	End Method
-	
-	Method GetRefreshRate:Int()
-		Return bmx_directx_D3DDISPLAYMODE_GetRefreshRate(modePtr)
-	End Method
-	
-	Method GetFormat:Int()
-		Return bmx_directx_D3DDISPLAYMODE_GetFormat(modePtr)
-	End Method
-	
-End Type
-
 Type D3DRASTER_STATUS
 	Field InVBlank
 	Field ScanLine
 End Type
 
+Struct D3DPRESENT_PARAMETERS
 
-Extern
-	Function bmx_directx_D3DPRESENT_PARAMETERS_new:Byte Ptr()
-	Function bmx_directx_D3DPRESENT_PARAMETERS_SetBackBufferWidth(handle:Byte Ptr, BackBufferWidth:Int)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_GetBackBufferWidth:Int(handle:Byte Ptr)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_SetBackBufferHeight(handle:Byte Ptr, BackBufferHeight:Int)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_GetBackBufferHeight:Int(handle:Byte Ptr)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_SetBackBufferFormat(handle:Byte Ptr, BackBufferFormat:Int)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_GetBackBufferFormat:Int(handle:Byte Ptr)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_SetBackBufferCount(handle:Byte Ptr, BackBufferCount:Int)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_GetBackBufferCount:Int(handle:Byte Ptr)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_SetMultiSampleType(handle:Byte Ptr, MultiSampleType:Int)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_GetMultiSampleType:Int(handle:Byte Ptr)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_SetMultiSampleQuality(handle:Byte Ptr, MultiSampleQuality:Int)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_GetMultiSampleQuality:Int(handle:Byte Ptr)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_SetSwapEffect(handle:Byte Ptr, SwapEffect:Int)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_GetSwapEffect:Int(handle:Byte Ptr)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_SethDeviceWindow(handle:Byte Ptr, hDeviceWindow:Byte Ptr)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_GethDeviceWindow:Byte Ptr(handle:Byte Ptr)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_SetWindowed(handle:Byte Ptr, Windowed:Int)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_GetWindowed:Int(handle:Byte Ptr)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_SetEnableAutoDepthStencil(handle:Byte Ptr, EnableAutoDepthStencil:Int)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_GetEnableAutoDepthStencil:Int(handle:Byte Ptr)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_SetAutoDepthStencilFormat(handle:Byte Ptr, AutoDepthStencilFormat:Int)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_GetAutoDepthStencilFormat:Int(handle:Byte Ptr)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_SetFlags(handle:Byte Ptr, Flags:Int)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_GetFlags:Int(handle:Byte Ptr)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_SetFullScreen_RefreshRateInHz(handle:Byte Ptr, FullScreen_RefreshRateInHz:Int)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_GetFullScreen_RefreshRateInHz:Int(handle:Byte Ptr)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_SetPresentationInterval(handle:Byte Ptr, PresentationInterval:Int)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_GetPresentationInterval:Int(handle:Byte Ptr)
-	Function bmx_directx_D3DPRESENT_PARAMETERS_free(handle:Byte Ptr)
-End Extern
-
-Type D3DPRESENT_PARAMETERS
+	Field BackBufferWidth:UInt
+	Field BackBufferHeight:UInt
+	Field BackBufferFormat:Int
+	Field BackBufferCount:UInt
 
-	Field paramPtr:Byte Ptr
-	
-	Method New()
-		paramPtr = bmx_directx_D3DPRESENT_PARAMETERS_new()
-	End Method
-
-	Method SetBackBufferWidth(BackBufferWidth:Int)
-		bmx_directx_D3DPRESENT_PARAMETERS_SetBackBufferWidth(paramPtr, BackBufferWidth)
-	End Method
-	
-	Method GetBackBufferWidth:Int()
-		Return bmx_directx_D3DPRESENT_PARAMETERS_GetBackBufferWidth(paramPtr)
-	End Method
-	
-	Method SetBackBufferHeight(BackBufferHeight:Int)
-		bmx_directx_D3DPRESENT_PARAMETERS_SetBackBufferHeight(paramPtr, BackBufferHeight)
-	End Method
-	
-	Method GetBackBufferHeight:Int()
-		Return bmx_directx_D3DPRESENT_PARAMETERS_GetBackBufferHeight(paramPtr)
-	End Method
-	
-	Method SetBackBufferFormat(BackBufferFormat:Int)
-		bmx_directx_D3DPRESENT_PARAMETERS_SetBackBufferFormat(paramPtr, BackBufferFormat)
-	End Method
-	
-	Method GetBackBufferFormat:Int()
-		Return bmx_directx_D3DPRESENT_PARAMETERS_GetBackBufferFormat(paramPtr)
-	End Method
-	
-	Method SetBackBufferCount(BackBufferCount:Int)
-		bmx_directx_D3DPRESENT_PARAMETERS_SetBackBufferCount(paramPtr, BackBufferCount)
-	End Method
-	
-	Method GetBackBufferCount:Int()
-		Return bmx_directx_D3DPRESENT_PARAMETERS_GetBackBufferCount(paramPtr)
-	End Method
-	
-	Method SetMultiSampleType(MultiSampleType:Int)
-		bmx_directx_D3DPRESENT_PARAMETERS_SetMultiSampleType(paramPtr, MultiSampleType)
-	End Method
-	
-	Method GetMultiSampleType:Int()
-		Return bmx_directx_D3DPRESENT_PARAMETERS_GetMultiSampleType(paramPtr)
-	End Method
-	
-	Method SetMultiSampleQuality(MultiSampleQuality:Int)
-		bmx_directx_D3DPRESENT_PARAMETERS_SetMultiSampleQuality(paramPtr, MultiSampleQuality)
-	End Method
-	
-	Method GetMultiSampleQuality:Int()
-		Return bmx_directx_D3DPRESENT_PARAMETERS_GetMultiSampleQuality(paramPtr)
-	End Method
-	
-	Method SetSwapEffect(SwapEffect:Int)
-		bmx_directx_D3DPRESENT_PARAMETERS_SetSwapEffect(paramPtr, SwapEffect)
-	End Method
-	
-	Method GetSwapEffect:Int()
-		Return bmx_directx_D3DPRESENT_PARAMETERS_GetSwapEffect(paramPtr)
-	End Method
-	
-	Method SethDeviceWindow(hDeviceWindow:Byte Ptr)
-		bmx_directx_D3DPRESENT_PARAMETERS_SethDeviceWindow(paramPtr, hDeviceWindow)
-	End Method
-	
-	Method GethDeviceWindow:Byte Ptr()
-		Return bmx_directx_D3DPRESENT_PARAMETERS_GethDeviceWindow(paramPtr)
-	End Method
-	
-	Method SetWindowed(Windowed:Int)
-		bmx_directx_D3DPRESENT_PARAMETERS_SetWindowed(paramPtr, Windowed)
-	End Method
-	
-	Method GetWindowed:Int()
-		Return bmx_directx_D3DPRESENT_PARAMETERS_GetWindowed(paramPtr)
-	End Method
-	
-	Method SetEnableAutoDepthStencil(EnableAutoDepthStencil:Int)
-		bmx_directx_D3DPRESENT_PARAMETERS_SetEnableAutoDepthStencil(paramPtr, EnableAutoDepthStencil)
-	End Method
-	
-	Method GetEnableAutoDepthStencil:Int()
-		Return bmx_directx_D3DPRESENT_PARAMETERS_GetEnableAutoDepthStencil(paramPtr)
-	End Method
-	
-	Method SetAutoDepthStencilFormat(AutoDepthStencilFormat:Int)
-		bmx_directx_D3DPRESENT_PARAMETERS_SetAutoDepthStencilFormat(paramPtr, AutoDepthStencilFormat)
-	End Method
-	
-	Method GetAutoDepthStencilFormat:Int()
-		Return bmx_directx_D3DPRESENT_PARAMETERS_GetAutoDepthStencilFormat(paramPtr)
-	End Method
-	
-	Method SetFlags(Flags:Int)
-		bmx_directx_D3DPRESENT_PARAMETERS_SetFlags(paramPtr, Flags)
-	End Method
-	
-	Method GetFlags:Int()
-		Return bmx_directx_D3DPRESENT_PARAMETERS_GetFlags(paramPtr)
-	End Method
-	
-	Method SetFullScreen_RefreshRateInHz(FullScreen_RefreshRateInHz:Int)
-		bmx_directx_D3DPRESENT_PARAMETERS_SetFullScreen_RefreshRateInHz(paramPtr, FullScreen_RefreshRateInHz)
-	End Method
-	
-	Method GetFullScreen_RefreshRateInHz:Int()
-		Return bmx_directx_D3DPRESENT_PARAMETERS_GetFullScreen_RefreshRateInHz(paramPtr)
-	End Method
-	
-	Method SetPresentationInterval(PresentationInterval:Int)
-		bmx_directx_D3DPRESENT_PARAMETERS_SetPresentationInterval(paramPtr, PresentationInterval)
-	End Method
-	
-	Method GetPresentationInterval:Int()
-		Return bmx_directx_D3DPRESENT_PARAMETERS_GetPresentationInterval(paramPtr)
-	End Method
-	
-Rem	
-	Field BackBufferWidth
-	Field BackBufferHeight
-	Field BackBufferFormat
-	Field BackBufferCount
+	Field MultiSampleType:Int
+	Field MultiSampleQuality:UInt
 
-	Field MultiSampleType
-	Field MultiSampleQuality
+	Field SwapEffect:Int
+	Field hDeviceWindow:Byte Ptr
+	Field Windowed:Int
+	Field EnableAutoDepthStencil:Int
+	Field AutoDepthStencilFormat:Int
+	Field Flags:UInt
 
-	Field SwapEffect
-	Field hDeviceWindow
-	Field Windowed
-	Field EnableAutoDepthStencil
-	Field AutoDepthStencilFormat
-	Field Flags
-
-	Field FullScreen_RefreshRateInHz
-	Field PresentationInterval
-End Rem	
-	Method Delete()
-		If paramPtr Then
-			bmx_directx_D3DPRESENT_PARAMETERS_free(paramPtr)
-			paramPtr = Null
-		End If
-	End Method
+	Field FullScreen_RefreshRateInHz:UInt
+	Field PresentationInterval:UInt
 	
-End Type
+End Struct
 
 Extern
 	Function bmx_directx_D3DSURFACE_DESC_new:Byte Ptr()
 	Function bmx_directx_D3DSURFACE_DESC_free(handle:Byte Ptr)
 End Extern
 
-Type D3DSURFACE_DESC
-
-	Field descPtr:Byte Ptr
-	
-	Method New()
-		descPtr = bmx_directx_D3DSURFACE_DESC_new()
-	End Method
-
-	Method Delete()
-		If descPtr Then
-			bmx_directx_D3DSURFACE_DESC_free(descPtr)
-			descPtr = Null
-		End If
-	End Method
-Rem
+Struct D3DSURFACE_DESC
 	Field Format
 	Field Type_
 	Field Usage
 	Field Pool
 	Field MultiSampleType
 	Field MultiSampleQuality
-	Field Width
-	Field Height
-End Rem
-End Type
+	Field Width:UInt
+	Field Height:UInt
+End Struct
 
 Type D3DLOCKED_RECT
 	Field Pitch

+ 1 - 1
directx.mod/d3d.cpp

@@ -2,7 +2,7 @@
 #include <windows.h>
 #include "d3d9types.h"
 #include <stdlib.h>
-
+#include <stdio.h>
 extern "C" {
 
 	D3DPRESENT_PARAMETERS * bmx_directx_D3DPRESENT_PARAMETERS_new();

+ 89 - 395
directx.mod/d3d9.bmx

@@ -19,27 +19,29 @@ Type D3DDEVTYPE
 	Const D3DDEVTYPE_FORCE_DWORD = $7fffffff
 End Type
 
-Global nullBaseTexture9:IDirect3DBaseTexture9 = New IDirect3DBaseTexture9
+Global nullBaseTexture9:IDirect3DBaseTexture9' = New IDirect3DBaseTexture9
 
 Extern
 	Function bmx_directx_d3d9_D3DCAPS9_new:Byte Ptr()
 	Function bmx_directx_d3d9_D3DCAPS9_free(handle:Byte Ptr)
 End Extern
 
-Type D3DCAPS9
-	Field capsPtr:Byte Ptr
-	
-	Method New()
-		capsPtr = bmx_directx_d3d9_D3DCAPS9_new()
-	End Method
-	
-	Method Delete()
-		If capsPtr Then
-			bmx_directx_d3d9_D3DCAPS9_free(capsPtr)
-			capsPtr = Null
-		End If
-	End Method
-Rem 
+Struct D3DVSHADERCAPS2_0
+	Field Caps
+	Field DynamicFlowControlDepth
+	Field NumTemps
+	Field StaticFlowControlDepth
+End Struct
+
+Struct D3DPSHADERCAPS2_0
+	Field Caps
+	Field DynamicFlowControlDepth
+	Field NumTemps
+	Field StaticFlowControlDepth
+	Field NumInstructionSlots
+End Struct
+
+Struct D3DCAPS9
 	Field DeviceType	'D3DDEVTYPE
 	Field AdapterOrdinal;
 	Field Caps;
@@ -102,87 +104,28 @@ Rem
 	Field DeclTypes;
 	Field NumSimultaneousRTs;
 	Field StretchRectFilterCaps;
-	'D3DVSHADERCAPS2_0 VS20Caps;
-	Field VS20Caps_Caps;
-	Field VS20Caps_DynamicFlowControlDepth;
-	Field VS20Caps_NumTemps;
-	Field VS20Caps_StaticFlowControlDepth;
-	'D3DPSHADERCAPS2_0 D3DPSHADERCAPS2_0;
-	Field PS20Caps_Caps;
-	Field PS20Caps_DynamicFlowControlDepth;
-	Field PS20Caps_NumTemps;
-	Field PS20Caps_StaticFlowControlDepth;
-	Field PS20Caps_NumInstructionSlots;
+	Field VS20Caps:D3DVSHADERCAPS2_0
+	Field PS20Caps:D3DPSHADERCAPS2_0
 	Field VertexTextureFilterCaps;
 	Field MaxVShaderInstructionsExecuted;
 	Field MaxPShaderInstructionsExecuted;
 	Field MaxVertexShader30InstructionSlots;
 	Field MaxPixelShader30InstructionSlots;
-End Rem
-End Type
+End Struct
 
 Type D3DCLIPSTATUS9
 	Field ClipUnion
 	Field ClipIntersection
 End Type
 
-Extern
-	Function bmx_directx_d3d9_D3DVIEWPORT9_new:Byte Ptr()
-	Function bmx_directx_d3d9_D3DVIEWPORT9_free(handle:Byte Ptr)
-	Function bmx_directx_d3d9_D3DVIEWPORT9_SetX(handle:Byte Ptr, X:Int)
-	Function bmx_directx_d3d9_D3DVIEWPORT9_SetY(handle:Byte Ptr, Y:Int)
-	Function bmx_directx_d3d9_D3DVIEWPORT9_SetWidth(handle:Byte Ptr, Width:Int)
-	Function bmx_directx_d3d9_D3DVIEWPORT9_SetHeight(handle:Byte Ptr, Height:Int)
-	Function bmx_directx_d3d9_D3DVIEWPORT9_SetMinZ(handle:Byte Ptr, MinZ:Float)
-	Function bmx_directx_d3d9_D3DVIEWPORT9_SetMaxZ(handle:Byte Ptr, MaxZ:Float)
-End Extern
-
-Type D3DVIEWPORT9
-	Field vpPtr:Byte Ptr
-	
-	Method New()
-		vpPtr = bmx_directx_d3d9_D3DVIEWPORT9_new()
-	End Method
-	
-	Method Delete()
-		If vpPtr Then
-			bmx_directx_d3d9_D3DVIEWPORT9_free(vpPtr)
-			vpPtr = Null
-		End If
-	End Method
-	
-	Method SetX(X:Int)
-		bmx_directx_d3d9_D3DVIEWPORT9_SetX(vpPtr, X)
-	End Method
-	
-	Method SetY(Y:Int)
-		bmx_directx_d3d9_D3DVIEWPORT9_SetY(vpPtr, Y)
-	End Method
-	
-	Method SetWidth(Width:Int)
-		bmx_directx_d3d9_D3DVIEWPORT9_SetWidth(vpPtr, Width)
-	End Method
-	
-	Method SetHeight(Height:Int)
-		bmx_directx_d3d9_D3DVIEWPORT9_SetHeight(vpPtr, Height)
-	End Method
-	
-	Method SetMinZ(MinZ:Float)
-		bmx_directx_d3d9_D3DVIEWPORT9_SetMinZ(vpPtr, MinZ)
-	End Method
-	
-	Method SetMaxZ(MaxZ:Float)
-		bmx_directx_d3d9_D3DVIEWPORT9_SetMaxZ(vpPtr, MaxZ)
-	End Method
-Rem
+Struct D3DVIEWPORT9
 	Field X
 	Field Y
 	Field Width
 	Field Height
-	Field MinZ#
-	Field MaxZ#
-End Rem
-End Type
+	Field MinZ:Float
+	Field MaxZ:Float
+End Struct
 
 Type D3DMATERIAL9
 	Field Diffuse_r#,Diffuse_g#,Diffuse_b#,Diffuse_a#
@@ -269,31 +212,14 @@ Type D3DADAPTER_IDENTIFIER9
 	End Method	
 End Type
 
-'Extern "win32"
-
-Extern
-	Function bmx_directx_d3d9_IDirect3DQuery9_Issue:Int(handle:Byte Ptr, dwIssueFlags:Int)
-	Function bmx_directx_d3d9_IDirect3DQuery9_GetData:Int(handle:Byte Ptr, pData:Byte Ptr, dwSize:Int, dwGetDataFlags:Int)
-End Extern
-
-Type IDirect3DQuery9 Extends IUnknown
+Extern "win32"
+Interface  IDirect3DQuery9 Extends IUnknown_
 
 	Method GetDevice( ppDevice:IDirect3DDevice9 Var )
-	End Method
-	
 	Method GetType()
-	End Method
-
 	Method GetDataSize()
-	End Method
-
 	Method Issue( dwIssueFlags:Int )
-		Return bmx_directx_d3d9_IDirect3DQuery9_Issue(unknownPtr, dwIssueFlags)
-	End Method
-
 	Method GetData( pData:Byte Ptr,dwSize,dwGetDataFlags )
-		Return bmx_directx_d3d9_IDirect3DQuery9_GetData(unknownPtr, pData, dwSize, dwGetDataFlags)
-	End Method
 
 Rem
 	STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE;
@@ -303,18 +229,13 @@ Rem
 	STDMETHOD(GetData)(THIS_ void* pData,DWORD dwSize,DWORD dwGetDataFlags) PURE;
 End Rem
 
-End Type
+End Interface
 
-Type IDirect3DStateBlock9 Extends IUnknown
-	Method GetDevice(ppDevice:IDirect3DDevice9)
-	End Method
+Interface IDirect3DStateBlock9 Extends IUnknown_
 
+	Method GetDevice(ppDevice:IDirect3DDevice9 Var)
 	Method Capture()
-	End Method
-
 	Method Apply()
-	End Method
-
 
 Rem
 	STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE;
@@ -322,92 +243,53 @@ Rem
 	STDMETHOD(Apply)(THIS) PURE;
 End Rem
 
-End Type
+End Interface
 
-Type IDirect3DPixelShader9 Extends IUnknown
+Interface IDirect3DPixelShader9 Extends IUnknown_
 
 Rem
 	STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE;
 	STDMETHOD(GetFunction)(THIS_ void*,UINT* pSizeOfData) PURE;
 End Rem
 
-End Type
+End Interface 
 
-Type IDirect3DVertexShader9 Extends IUnknown
+Interface IDirect3DVertexShader9 Extends IUnknown_
 
 Rem
 	STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE;
 	STDMETHOD(GetFunction)(THIS_ void*,UINT* pSizeOfData) PURE;
 End Rem
 
-End Type
+End Interface 
 
-Type IDirect3DVertexDeclaration9 Extends IUnknown
+Interface IDirect3DVertexDeclaration9 Extends IUnknown_
 
 Rem
 	STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE;
 	STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9*,UINT* pNumElements) PURE;
 End Rem
 
-End Type
-
-Extern
-	Function bmx_directx_d3d9_IDirect3D9_CreateDevice:Int(handle:Byte Ptr, Adapter:Int,DeviceType:Int,hFocusWindow:Byte Ptr,BehaviorFlags:Int, pPresentationParameters:Byte Ptr, ppReturnedDeviceInterface:Byte Ptr Ptr)
-	Function bmx_directx_d3d9_IDirect3D9_GetDeviceCaps:Int(handle:Byte Ptr, Adapter:Int,DeviceType:Int, pCaps:Byte Ptr)
-	Function bmx_directx_d3d9_IDirect3D9_GetAdapterModeCount:Int(handle:Byte Ptr, Adapter:Int, Format:Int)
-	Function bmx_directx_d3d9_IDirect3D9_EnumAdapterModes:Int(handle:Byte Ptr, Adapter:Int, Format:Int, Mode:Int, pMode:Byte Ptr)
-	Function bmx_directx_d3d9_IDirect3D9_CheckDeviceFormat:Int(handle:Byte Ptr, Adapter:Int, DeviceType:Int, AdapterFormat:Int, Usage:Int, RType:Int, CheckFormat:Int)
+End Interface 
 End Extern
 
-Type IDirect3D9 Extends IUnknown
-Rem
-	Method RegisterSoftwareDevice( pInitializeFunction() )
-	End Method
+Extern "win32"
+Interface IDirect3D9 Extends IUnknown_
 
+	Method RegisterSoftwareDevice( pInitializeFunction() )
 	Method GetAdapterCount()
-	End Method
-
 	Method GetAdapterIdentifier( Adapter,Flags,pIdentifier:Byte Ptr )
-	End Method
-End Rem
 	Method GetAdapterModeCount( Adapter,Format )
-		Return bmx_directx_d3d9_IDirect3D9_GetAdapterModeCount(unknownPtr, Adapter, Format)
-	End Method
-
-	Method EnumAdapterModes( Adapter,Format,Mode,pMode:D3DDISPLAYMODE)
-		Return bmx_directx_d3d9_IDirect3D9_EnumAdapterModes(unknownPtr, Adapter, Format, Mode, pMode.modePtr)
-	End Method
-Rem
-	Method GetAdapterDisplayMode( Adapter,pMode:Byte Ptr )
-	End Method
-
+	Method EnumAdapterModes( Adapter,Format,Mode,pMode:D3DDISPLAYMODE Var)
+	Method GetAdapterDisplayMode( Adapter,pMode:D3DDISPLAYMODE Var)
 	Method CheckDeviceType( iAdapter,DevType,DisplayFormat,BackBufferFormat,bWindowed )
-	End Method
-End Rem
 	Method CheckDeviceFormat( Adapter,DeviceType,AdapterFormat,Usage,RType,CheckFormat )
-		Return bmx_directx_d3d9_IDirect3D9_CheckDeviceFormat(unknownPtr, Adapter, DeviceType, AdapterFormat, Usage, RType, CheckFormat)
-	End Method
-Rem
 	Method CheckDeviceMultiSampleType( Adapter,DeviceType,SurfaceFormat,Windowed,MultiSampleType,pQualityLevels:Int Ptr )
-	End Method
-
 	Method CheckDepthStencilMatch( Adapter,DeviceType,AdapterFormat,RenderTargetFormat,DepthStencilFormat )
-	End Method
-
 	Method CheckDeviceFormatConversion( Adapter,DeviceType,SourceFormat,TargetFormat )
-	End Method
-End Rem
-	Method GetDeviceCaps( Adapter,DeviceType,pCaps:D3DCAPS9)
-		Return bmx_directx_d3d9_IDirect3D9_GetDeviceCaps(unknownPtr, Adapter, DeviceType, pCaps.capsPtr)
-	End Method
-
-'	Method GetAdapterMonitor( Adapter )
-'	End Method
-
-	Method CreateDevice( Adapter:Int,DeviceType:Int,hFocusWindow:Byte Ptr,BehaviorFlags:Int, pPresentationParameters:D3DPRESENT_PARAMETERS,ppReturnedDeviceInterface:IDirect3DDevice9)
-		Return bmx_directx_d3d9_IDirect3D9_CreateDevice(unknownPtr, Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters.paramPtr, Varptr ppReturnedDeviceInterface.unknownPtr)
-	End Method
-
+	Method GetDeviceCaps( Adapter,DeviceType,pCaps:D3DCAPS9 Var)
+	Method GetAdapterMonitor( Adapter )
+	Method CreateDevice( Adapter:Int,DeviceType:Int,hFocusWindow:Byte Ptr,BehaviorFlags:Int, pPresentationParameters:D3DPRESENT_PARAMETERS Var,ppReturnedDeviceInterface:IDirect3DDevice9 Var)
 Rem
 	STDMETHOD(RegisterSoftwareDevice)(THIS_ void* pInitializeFunction) PURE;
 	STDMETHOD_(UINT, GetAdapterCount)(THIS) PURE;
@@ -425,36 +307,13 @@ Rem
 	STDMETHOD(CreateDevice)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface) PURE;
 End Rem
 
-End Type
-
-Extern
-	Function bmx_directx_d3d9_IDirect3DDevice9_CreateQuery:Int(handle:Byte Ptr, Type_:Int, ppQuery:Byte Ptr Ptr)
-	Function bmx_directx_d3d9_IDirect3DDevice9_TestCooperativeLevel:Int(handle:Byte Ptr)
-	Function bmx_directx_d3d9_IDirect3DDevice9_Reset:Int(handle:Byte Ptr, pPresentationParameters:Byte Ptr)
-	Function bmx_directx_d3d9_IDirect3DDevice9_Present:Int(handle:Byte Ptr, pSourceRect:Byte Ptr, pDestRect:Byte Ptr, hDestWindowOverride:Byte Ptr, pDirtyRegion:Byte Ptr)
-	Function bmx_directx_d3d9_IDirect3DDevice9_CreateTexture:Int(handle:Byte Ptr, Width:Int, Height:Int, Levels:Int, Usage:Int, Format:Int, Pool:Int, ppTexture:Byte Ptr Ptr, pSharedHandle:Byte Ptr)
-	Function bmx_directx_d3d9_IDirect3DDevice9_CreateOffscreenPlainSurface:Int(handle:Byte Ptr, Width:Int, Height:Int, Format:Int, Pool:Int, ppSurface:Byte Ptr Ptr, pSharedHandle:Byte Ptr)
-	Function bmx_directx_d3d9_IDirect3DDevice9_GetRenderTarget:Int(handle:Byte Ptr, RenderTargetIndex:Int, pRenderTarget:Byte Ptr Ptr)
-	Function bmx_directx_d3d9_IDirect3DDevice9_BeginScene:Int(handle:Byte Ptr)
-	Function bmx_directx_d3d9_IDirect3DDevice9_EndScene:Int(handle:Byte Ptr)
-	Function bmx_directx_d3d9_IDirect3DDevice9_Clear:Int(handle:Byte Ptr, Count:Int, pRects:Byte Ptr, Flags:Int, Color:Int, Z:Float, Stencil:Int)
-	Function bmx_directx_d3d9_IDirect3DDevice9_SetTransform:Int(handle:Byte Ptr, State:Int, pMatrix:Float Ptr)
-	Function bmx_directx_d3d9_IDirect3DDevice9_SetViewport:Int(handle:Byte Ptr, pViewport:Byte Ptr)
-	Function bmx_directx_d3d9_IDirect3DDevice9_SetRenderState:Int(handle:Byte Ptr, State:Int, Value:Int)
-	Function bmx_directx_d3d9_IDirect3DDevice9_SetTexture:Int(handle:Byte Ptr, Stage:Int, pTexture:Byte Ptr)
-	Function bmx_directx_d3d9_IDirect3DDevice9_SetTextureStageState:Int(handle:Byte Ptr, Stage:Int, Type_:Int, Value:Int)
-	Function bmx_directx_d3d9_IDirect3DDevice9_SetScissorRect:Int(handle:Byte Ptr, pRect:Byte Ptr)
-	Function bmx_directx_d3d9_IDirect3DDevice9_DrawPrimitiveUP:Int(handle:Byte Ptr, PrimitiveType:Int, PrimitiveCount:Int, pVertexStreamZeroData:Byte Ptr, VertexStreamZeroStride:Int)
-	Function bmx_directx_d3d9_IDirect3DDevice9_SetFVF:Int(handle:Byte Ptr, FVF:Int)
-
+End Interface
 End Extern
 
-Type IDirect3DDevice9 Extends IUnknown
+Extern "win32"
+Interface IDirect3DDevice9 Extends IUnknown_
 
 	Method TestCooperativeLevel()
-		Return bmx_directx_d3d9_IDirect3DDevice9_TestCooperativeLevel(unknownPtr)
-	End Method
-Rem
 	Method GetAvailableTextureMem()
 	Method EvictManagedResources()
 	Method GetDirect3D( ppD3D9:IDirect3D9 Var )
@@ -464,29 +323,18 @@ Rem
 	Method SetCursorProperties( XHotSpot,YHotSpot,pCursorBitmap:IDirect3DSurface9 )
 	Method SetCursorPosition( X,Y,Flags )
 	Method ShowCursor( bShow )
-	Method CreateAdditionalSwapChain( pPresentationParameters:Byte Ptr,pSwapChain:IDirect3DSwapChain9 Var )
+	Method CreateAdditionalSwapChain( pPresentationParameters:D3DPRESENT_PARAMETERS Var,pSwapChain:IDirect3DSwapChain9 Var )
 	Method GetSwapChain( iSwapChain,pSwapChain:IDirect3DSwapChain9 Var )
 	Method GetNumberOfSwapChains()
-End Rem
-	Method Reset( pPresentationParameters:D3DPRESENT_PARAMETERS)
-		Return bmx_directx_d3d9_IDirect3DDevice9_Reset(unknownPtr, pPresentationParameters.paramPtr)
-	End Method
-
+	Method Reset( pPresentationParameters:D3DPRESENT_PARAMETERS Var)
 	Method Present( pSourceRect:Byte Ptr,pDestRect:Byte Ptr,hDestWindowOverride:Byte Ptr,pDirtyRegion:Byte Ptr )
-		Return bmx_directx_d3d9_IDirect3DDevice9_Present(unknownPtr, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion)
-	End Method
-Rem
 	Method GetBackBuffer( iSwapChain,iBackBuffer,bType,ppBackBuffer:IDirect3DSurface9 Var )
 	Method GetRasterStatus( iSwapChain,pRasterStatus:Byte Ptr )
 	Method SetDialogBoxMode( bEnableDialogs )
 	Method SetGammaRamp( iSwapChain,Flags,pRamp:Short Ptr )
 	Method GetGammaRamp( iSwapChain,pRamp:Short Ptr )
-End Rem
-	Method CreateTexture( Width,Height,Levels,Usage,Format,Pool,ppTexture:IDirect3DTexture9,pSharedHandle:Byte Ptr )
-		Return bmx_directx_d3d9_IDirect3DDevice9_CreateTexture(unknownPtr, Width, Height, Levels, Usage, Format, Pool, Varptr ppTexture.unknownPtr, pSharedHandle)
-	End Method
-Rem
-	Method CreateVolumeTexture( Width,Height,Depth,Levels,Usage,Format,Pool,ppVolumeTexture:IDirect3DVolumeTexture9,pSharedHandle:Byte Ptr )
+	Method CreateTexture( Width,Height,Levels,Usage,Format,Pool,ppTexture:IDirect3DTexture9 Var,pSharedHandle:Byte Ptr )
+	Method CreateVolumeTexture( Width,Height,Depth,Levels,Usage,Format,Pool,ppVolumeTexture:IDirect3DVolumeTexture9 Var,pSharedHandle:Byte Ptr )
 	Method CreateCubeTexture( EdgeLength,Levels,Usage,Format,Pool,ppTexture:IDirect3DCubeTexture9 Var,pSharedHandle:Byte Ptr )
 	Method CreateVertexBuffer( Length,Usage,FVF,Pool,ppVertexBuffer:IDirect3DVertexBuffer9 Var,pSharedHandle:Byte Ptr )
 	Method CreateIndexBuffer( Length,Usage,Format,Pool,ppIndexBuffer:IDirect3DIndexBuffer9 Var,pSharedHandle:Byte Ptr )
@@ -498,44 +346,18 @@ Rem
 	Method GetFrontBufferData( iSwapChain,pDestSurface:IDirect3DSurface9 )
 	Method StretchRect( pSourceSurface:IDirect3DSurface9,pSourceRect:Byte Ptr,pDestSurface:IDirect3DSurface9,pDestRect:Byte Ptr,Filter )
 	Method ColorFill( pSurface:IDirect3DSurface9,pRect:Byte Ptr,color )
-End Rem
-	Method CreateOffscreenPlainSurface( Width,Height,Format,Pool,ppSurface:IDirect3DSurface9,pSharedHandle:Byte Ptr )
-		Return bmx_directx_d3d9_IDirect3DDevice9_CreateOffscreenPlainSurface(unknownPtr, Width, Height, Format, Pool, Varptr ppSurface.unknownPtr, pSharedHandle)
-	End Method
-Rem
+	Method CreateOffscreenPlainSurface( Width,Height,Format,Pool,ppSurface:IDirect3DSurface9 Var,pSharedHandle:Byte Ptr )
 	Method SetRenderTarget( RenderTargetIndex,pRenderTarget:IDirect3DSurface9 )
-	End Method
-End Rem
 	Method GetRenderTarget( RenderTargetIndex,pRenderTarget:IDirect3DSurface9)
-		Return bmx_directx_d3d9_IDirect3DDevice9_GetRenderTarget(unknownPtr, RenderTargetIndex, Varptr pRenderTarget.unknownPtr)
-	End Method
-Rem
 	Method SetDepthStencilSurface( pNewZStencil:IDirect3DSurface9 )
 	Method GetDepthStencilSurface( ppZStencilSurface:IDirect3DSurface9 Var )
-End Rem
 	Method BeginScene()
-		Return bmx_directx_d3d9_IDirect3DDevice9_BeginScene(unknownPtr)
-	End Method
-	
 	Method EndScene()
-		Return bmx_directx_d3d9_IDirect3DDevice9_EndScene(unknownPtr)
-	End Method
-	
 	Method Clear( Count,pRects:Byte Ptr,Flags,Color,Z#,Stencil )
-		Return bmx_directx_d3d9_IDirect3DDevice9_Clear(unknownPtr, Count, pRects, Flags, Color, Z, Stencil)
-	End Method
-
 	Method SetTransform( State,pMatrix:Float Ptr )
-		Return bmx_directx_d3d9_IDirect3DDevice9_SetTransform(unknownPtr, State, pMatrix)
-	End Method
-Rem
 	Method GetTransform( State,pMatrix:Float Ptr )
 	Method MultiplyTransform( State,pMatrix:Float Ptr )
-End Rem
-	Method SetViewport( pViewport:D3DVIEWPORT9 )
-		Return bmx_directx_d3d9_IDirect3DDevice9_SetViewport(unknownPtr, pViewport.vpPtr)
-	End Method
-Rem
+	Method SetViewport( pViewport:D3DVIEWPORT9 Var )
 	Method GetViewport( pViewport:Byte Ptr )
 	Method SetMaterial( pMaterial:Byte Ptr )
 	Method GetMaterial( pMaterial:Byte Ptr )
@@ -545,11 +367,8 @@ Rem
 	Method GetLightEnable( Index,Enable:Int Ptr )
 	Method SetClipPlane( Index,pPlane:Float Ptr )
 	Method GetClipPlane( Index,pPlane:Float Ptr )
-End Rem
+
 	Method SetRenderState( State,Value )
-		Return bmx_directx_d3d9_IDirect3DDevice9_SetRenderState(unknownPtr, State, Value)
-	End Method
-Rem
 	Method GetRenderState( State,Value Var )
 	Method CreateStateBlock( Type_,ppSB:IDirect3DStateBlock9 Var )
 	Method BeginStateBlock()
@@ -557,17 +376,11 @@ Rem
 	Method SetClipStatus( pClipStatus:Byte Ptr )
 	Method GetClipStatus( pClipStatus:Byte Ptr )
 	Method GetTexture( Stage,ppTexture:IDirect3DBaseTexture9 Var )
-End Rem
+
 	Method SetTexture( Stage,pTexture:IDirect3DBaseTexture9 )
-		Return bmx_directx_d3d9_IDirect3DDevice9_SetTexture(unknownPtr, Stage, pTexture.unknownPtr)
-	End Method
-Rem
 	Method GetTextureStageState( Stage,Type_,pValue Var )
-End Rem
+
 	Method SetTextureStageState( Stage,Type_,Value )
-		Return bmx_directx_d3d9_IDirect3DDevice9_SetTextureStageState(unknownPtr, Stage, Type_, Value)
-	End Method
-Rem
 	Method GetSamplerState( Sampler,Type_,pValue Var )
 	Method SetSamplerState( Sampler,Type_,Value )
 	Method ValidateDevice( pNumPasses:Int Ptr )
@@ -575,11 +388,7 @@ Rem
 	Method GetPaletteEntries( PaletteNumber,pEntries:Byte Ptr )
 	Method SetCurrentTexturePalette( PaletteNumber )
 	Method GetCurrentTexturePalette( PaletteNumber Var )
-End Rem
 	Method SetScissorRect( pRect:Byte Ptr )
-		Return bmx_directx_d3d9_IDirect3DDevice9_SetScissorRect(unknownPtr, pRect)
-	End Method
-Rem
 	Method GetScissorRect( pRect:Byte Ptr )
 	Method SetSoftwareVertexProcessing( bSoftware )
 	Method GetSoftwareVertexProcessing()
@@ -587,21 +396,14 @@ Rem
 	Method GetNPatchMode#()
 	Method DrawPrimitive( PrimitiveType,StartVertex,PrimitiveCount )
 	Method DrawIndexedPrimitive( PrimitiveType,BaseVertexIndex,MinVertexIndex,NumVertices,startIndex,primCount )
-End Rem
+
 	Method DrawPrimitiveUP( PrimitiveType,PrimitiveCount,pVertexStreamZeroData:Byte Ptr,VertexStreamZeroStride )
-		Return bmx_directx_d3d9_IDirect3DDevice9_DrawPrimitiveUP(unknownPtr, PrimitiveType, PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride)
-	End Method
-Rem
 	Method DrawIndexedPrimitiveUP( PrimitiveType,MinVertexIndex,NumVertices,PrimitiveCount,pIndexData:Byte Ptr,IndexDataFormat,pVertexStreamZeroData:Byte Ptr,VertexStreamZeroStride )
 	Method ProcessVertices( SrcStartIndex,DestIndex,VertexCount,pDestBuffer:IDirect3DVertexBuffer9,pVertexDecl:IDirect3DVertexDeclaration9,Flags )
 	Method CreateVertexDeclaration( pVertexElements:Byte Ptr,ppDecl:IDirect3DVertexDeclaration9 Var )
 	Method SetVertexDeclaration( pDecl:IDirect3DVertexDeclaration9 )
 	Method GetVertexDeclaration( ppDecl:IDirect3DVertexDeclaration9 Var )
-End Rem
 	Method SetFVF( FVF )
-		Return bmx_directx_d3d9_IDirect3DDevice9_SetFVF(unknownPtr, FVF)
-	End Method
-Rem
 	Method GetFVF( FVF Var )
 	Method CreateVertexShader( pFunction:Byte Ptr,ppShader:IDirect3DVertexShader9 Var )
 	Method SetVertexShader( pShader:IDirect3DVertexShader9 )
@@ -630,12 +432,10 @@ Rem
 	Method DrawRectPatch( Handle,pNumSegs:Float Ptr,pRectPathInfo:Byte Ptr )
 	Method DrawTriPatch( Handle,pNumSegs:Float Ptr,pTriPatchInfo:Byte Ptr )
 	Method DeletePatch( Handle )
-End Rem
-	Method CreateQuery(Type_:Int, ppQuery:IDirect3DQuery9)
-		Return bmx_directx_d3d9_IDirect3DDevice9_CreateQuery(unknownPtr, Type_, Varptr ppQuery.unknownPtr)
-	End Method
+
+	Method CreateQuery(Type_:Int, ppQuery:IDirect3DQuery9 Var)
+
 Rem
-'Rem
 	STDMETHOD(TestCooperativeLevel)(THIS) PURE;
 	STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE;
 	STDMETHOD(EvictManagedResources)(THIS) PURE;
@@ -755,21 +555,14 @@ Rem
 'End Rem
 End Rem
 
-End Type
+End Interface
 
-Type IDirect3DSwapChain9 Extends IUnknown
+Interface IDirect3DSwapChain9 Extends IUnknown_
 
 	Method Present( pSourceRect:Byte Ptr,pDestRect:Byte Ptr,hDestWindowOverride,pDirtyRegion:Byte Ptr,Flags )
-	End Method
-
 	Method GetFrontBufferData(pDestSurface:IDirect3DSurface9) 
-	End Method
-
 	Method GetBackBuffer(iBackBuffer:Int, Type_:Int,ppBackBuffer:IDirect3DSurface9 Var)
-	End Method
-
 	Method GetRasterStatus(pRasterStatus:Byte Ptr)
-	End Method
 
 Rem
 	STDMETHOD(Present)(THIS_ Const RECT* pSourceRect,Const RECT* pDestRect,HWND hDestWindowOverride,Const RGNDATA* pDirtyRegion,DWORD dwFlags) PURE;
@@ -781,41 +574,18 @@ Rem
 	STDMETHOD(GetPresentParameters)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE;
 End Rem
 
-End Type
+End Interface
 
-Type IDirect3DResource9 Extends IUnknown
+Interface IDirect3DResource9 Extends IUnknown_
 
 	Method GetDevice( ppDevice:IDirect3DDevice9 Var )
-Print "TODO - IDirect3DResource9::GetDevice"
-	End Method
-
 	Method SetPrivateData( refguid:Byte Ptr,pData:Byte Ptr,SizeOfData,Flags )
-Print "TODO - IDirect3DResource9::SetPrivateData"
-	End Method
-
 	Method GetPrivateData( refguid:Byte Ptr,pData:Byte Ptr,pSizeOfData )
-Print "TODO - IDirect3DResource9::GetPrivateData"
-	End Method
-
 	Method FreePrivateData( refguid:Byte Ptr )
-Print "TODO - IDirect3DResource9::FreePrivateData"
-	End Method
-
 	Method SetPriority( PriorityNew )
-Print "TODO - IDirect3DResource9::SetPriority"
-	End Method
-
 	Method GetPriority()
-Print "TODO - IDirect3DResource9::GetPriority"
-	End Method
-
 	Method PreLoad()
-Print "TODO - IDirect3DResource9::PreLoad"
-	End Method
-
 	Method GetType()
-Print "TODO - IDirect3DResource9::GetType"
-	End Method
 
 Rem
 	STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE;
@@ -828,41 +598,18 @@ Rem
 	STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE;
 End Rem
 
-End Type
-
-Extern
-	Function bmx_directx_d3d9_IDirect3DSurface9_LockRect:Int(handle:Byte Ptr, pLockedRect:Byte Ptr, pRect:Byte Ptr, Flags:Int)
-	Function bmx_directx_d3d9_IDirect3DSurface9_UnlockRect:Int(handle:Byte Ptr)
-	Function bmx_directx_d3d9_IDirect3DSurface9_GetDC:Int(handle:Byte Ptr, phdc:Byte Ptr Ptr)
-	Function bmx_directx_d3d9_IDirect3DSurface9_ReleaseDC:Int(handle:Byte Ptr, hdc:Byte Ptr)
-	Function bmx_directx_d3d9_IDirect3DSurface9_GetDesc:Int(handle:Byte Ptr, pDesc:Byte Ptr)
+End Interface
 End Extern
 
-Type IDirect3DSurface9 Extends IDirect3dResource9
+Extern "win32"
+Interface IDirect3DSurface9 Extends IDirect3dResource9
 
 	Method GetContainer( riid:Byte Ptr,ppContainer:Byte Ptr Var )
-Print "TODO - IDirect3DSurface9::GetContainer"
-	End Method
-
-	Method GetDesc( pDesc:D3DSURFACE_DESC )
-		Return bmx_directx_d3d9_IDirect3DSurface9_GetDesc(unknownPtr, pDesc.descPtr)
-	End Method
-
+	Method GetDesc( pDesc:D3DSURFACE_DESC Var )
 	Method LockRect( pLockedRect:Byte Ptr,pRect:Byte Ptr,Flags )
-		Return bmx_directx_d3d9_IDirect3DSurface9_LockRect(unknownPtr, pLockedRect, pRect, Flags)
-	End Method
-
 	Method UnlockRect()
-		Return bmx_directx_d3d9_IDirect3DSurface9_UnlockRect(unknownPtr)
-	End Method
-
 	Method GetDC( phdc:Byte Ptr Var )
-		Return bmx_directx_d3d9_IDirect3DSurface9_GetDC(unknownPtr, Varptr phdc)
-	End Method
-
 	Method ReleaseDC( hdc:Byte Ptr )
-		Return bmx_directx_d3d9_IDirect3DSurface9_ReleaseDC(unknownPtr, hdc)
-	End Method
 
 Rem
 	STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE;
@@ -873,17 +620,12 @@ Rem
 	STDMETHOD(ReleaseDC)(THIS_ HDC hdc) PURE;
 End Rem
  
-End Type
+End Interface
 
-Type IDirect3DVertexBuffer9 Extends IDirect3DResource9
+Interface IDirect3DVertexBuffer9 Extends IDirect3DResource9
 
 	Method Lock( OffsetToLock,SizeToLock,ppbData:Byte Ptr Var,Flags )
-Print "TODO - IDirect3DVertexBuffer9::Lock"
-	End Method
-
 	Method Unlock()
-Print "TODO - IDirect3DVertexBuffer9::Unlock"
-	End Method
 
 Rem
 	STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,void** ppbData,DWORD Flags) PURE;
@@ -891,17 +633,12 @@ Rem
 	STDMETHOD(GetDesc)(THIS_ D3DVERTEXBUFFER_DESC *pDesc) PURE;
 End Rem
 
-End Type
+End Interface
 
-Type IDirect3DIndexBuffer9 Extends IDirect3DResource9
+Interface IDirect3DIndexBuffer9 Extends IDirect3DResource9
 
 	Method Lock( OffsetToLock,SizeToLock,ppbData:Byte Ptr Var,Flags )
-Print "TODO - IDirect3DIndexBuffer9::Lock"
-	End Method
-
 	Method Unlock()
-Print "TODO - IDirect3DIndexBuffer9::Unlock"
-	End Method
 
 Rem
 	STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,void** ppbData,DWORD Flags) PURE;
@@ -909,33 +646,16 @@ Rem
 	STDMETHOD(GetDesc)(THIS_ D3DINDEXBUFFER_DESC *pDesc) PURE;
 End Rem
 
-End Type
+End Interface
 
-Type IDirect3DBaseTexture9 Extends IDirect3DResource9
+Interface IDirect3DBaseTexture9 Extends IDirect3DResource9
 
 	Method SetLOD( LODNew )
-Print "TODO - IDirect3DBaseTexture9::SetLOD"
-	End Method
-
 	Method GetLOD()
-Print "TODO - IDirect3DBaseTexture9::GetLOD"
-	End Method
-
 	Method GetLevelCount()
-Print "TODO - IDirect3DBaseTexture9::GetLevelCount"
-	End Method
-
 	Method SetAutoGenFilterType( FilterType )
-Print "TODO - IDirect3DBaseTexture9::SetAutoGenFilterType"
-	End Method
-
 	Method GetAutoGenFilterType()
-Print "TODO - IDirect3DBaseTexture9::GetAutoGenFilterType"
-	End Method
-
 	Method GenerateMipSubLevels()
-Print "TODO - IDirect3DBaseTexture9::GenerateMipSubLevels"
-	End Method
 
 Rem
 	STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE;
@@ -946,34 +666,17 @@ Rem
 	STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE;
 End Rem
 
-End Type
-
-Extern
-	Function bmx_directx_d3d9_IDirect3DTexture9_GetSurfaceLevel:Int(handle:Byte Ptr, Level:Int, ppSurfaceLevel:Byte Ptr Ptr)
-	Function bmx_directx_d3d9_IDirect3DTexture9_LockRect:Int(handle:Byte Ptr, Level:Int, pLockedRect:Byte Ptr, pRect:Byte Ptr, Flags:Int)
+End Interface
 End Extern
 
-Type IDirect3DTexture9 Extends IDirect3DBaseTexture9
+Extern "win32"
+Interface IDirect3DTexture9 Extends IDirect3DBaseTexture9
 
 	Method GetLevelDesc( Level,pDesc:Byte Ptr )
-Print "TODO - IDirect3DTexture9::GetLevelDesc"
-	End Method
-
-	Method GetSurfaceLevel( Level,ppSurfaceLevel:IDirect3DSurface9)
-		Return bmx_directx_d3d9_IDirect3DTexture9_GetSurfaceLevel(unknownPtr, Level, Varptr ppSurfaceLevel.unknownPtr)
-	End Method
-
+	Method GetSurfaceLevel( Level,ppSurfaceLevel:IDirect3DSurface9 Var)
 	Method LockRect( Level,pLockedRect:Byte Ptr,pRect:Byte Ptr,Flags )
-		Return bmx_directx_d3d9_IDirect3DTexture9_LockRect:Int(unknownPtr, Level, pLockedRect, pRect, Flags)
-	End Method
-
 	Method UnlockRect( Level )
-Print "TODO - IDirect3DTexture9::UnlockRect"
-	End Method
-
 	Method AddDirtyRect( pDirtyRect:Byte Ptr )
-Print "TODO - IDirect3DTexture9::AddDirtyRect"
-	End Method
 
 Rem
 	STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE;
@@ -983,24 +686,15 @@ Rem
 	STDMETHOD(AddDirtyRect)(THIS_ Const RECT* pDirtyRect) PURE;
 End Rem
 
-End Type
+End Interface
 
-Type IDirect3DCubeTexture9 Extends IDirect3DBaseTexture9
+Interface IDirect3DCubeTexture9 Extends IDirect3DBaseTexture9
 
 	Method GetLevelDesc( Level,pDesc:Byte Ptr )
-	End Method
-
 	Method GetCubeMapSurface( FaceType,Level,ppCubeMapSurface:IDirect3DSurface9 Var )
-	End Method
-
 	Method LockRect( FaceType,Level,pLockedRect:Byte Ptr,pRect:Byte Ptr,Flags )
-	End Method
-
 	Method UnlockRect( FaceType,Level )
-	End Method
-
 	Method AddDirtyRect( FaceType,pDirtyRect:Byte Ptr )
-	End Method
 
 Rem
 	STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE;
@@ -1010,9 +704,9 @@ Rem
 	STDMETHOD(AddDirtyRect)(THIS_ D3DCUBEMAP_FACES FaceType,Const RECT* pDirtyRect) PURE;
 End Rem
 
-End Type
+End Interface
 
-Type IDirect3DVolumeTexture9 Extends IDirect3DBaseTexture9
+Interface IDirect3DVolumeTexture9 Extends IDirect3DBaseTexture9
 
 '	Method GetLevelDesc( Level,pDesc:Byte Ptr )
 '	Method GetVolumeLevel( Level,ppVolumeLevel:IDirect3DVolume9 Var )
@@ -1027,23 +721,23 @@ Rem
 	STDMETHOD(AddDirtyBox)(THIS_ Const D3DBOX* pDirtyBox) PURE;
 End Rem
 
-End Type
+End Interface
+End Extern
 
 'End Extern
 Extern
-	Function bmx_directx_d3d9_Direct3DCreate9:Byte Ptr(SDKVersion:Int)
+	Function bmx_directx_d3d9_Direct3DCreate9:IDirect3D9(SDKVersion:Int)
 End Extern
 
 Function Direct3DCreate9:IDirect3D9(SDKVersion:Int)
-	Local id:IDirect3D9 = New IDirect3D9
-	id.unknownPtr = bmx_directx_d3d9_Direct3DCreate9(SDKVersion)
-	If id.unknownPtr Then
+	Local id:IDirect3D9 = bmx_directx_d3d9_Direct3DCreate9(SDKVersion)
+	If id Then
 		Return id
 	End If
 End Function
 
-'Global d3d9Lib:Byte Ptr=LoadLibraryA( "d3d9" )
+'Global _d3d9Lib:Byte Ptr=LoadLibraryW( "d3d9.dll" )
 
-'If Not d3d9Lib Return
+'If Not _d3d9Lib Return
 
 'Global Direct3DCreate9:IDirect3D9( SDKVersion )"win32" = GetProcAddress( d3d9Lib,"Direct3DCreate9" )

+ 5 - 4
directx.mod/d3d9.cpp

@@ -86,8 +86,9 @@ IDirect3D9 * bmx_directx_d3d9_Direct3DCreate9(int SDKVersion) {
 
 int bmx_directx_d3d9_IDirect3D9_CreateDevice(IDirect3D9 * id, int Adapter, int DeviceType, HWND hFocusWindow,
 		int BehaviorFlags, D3DPRESENT_PARAMETERS * pPresentationParameters, IDirect3DDevice9 ** ppReturnedDeviceInterface) {
-
-	return id->CreateDevice(Adapter, static_cast<D3DDEVTYPE>(DeviceType), hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface);
+	int res = id->CreateDevice(Adapter, static_cast<D3DDEVTYPE>(DeviceType), hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface);
+	
+	return res;
 }
 
 int bmx_directx_d3d9_IDirect3D9_GetDeviceCaps(IDirect3D9 * id, int Adapter, int DeviceType, D3DCAPS9 * pCaps) {
@@ -195,7 +196,7 @@ int bmx_directx_d3d9_IDirect3DQuery9_GetData(IDirect3DQuery9 * id, void * pData,
 // ********************************************************
 
 D3DCAPS9 * bmx_directx_d3d9_D3DCAPS9_new() {
-	return (D3DCAPS9*)malloc(sizeof(D3DCAPS9));
+	return (D3DCAPS9*)calloc(1,sizeof(D3DCAPS9));
 }
 
 void bmx_directx_d3d9_D3DCAPS9_free(D3DCAPS9 * caps) {
@@ -205,7 +206,7 @@ void bmx_directx_d3d9_D3DCAPS9_free(D3DCAPS9 * caps) {
 // ********************************************************
 
 D3DVIEWPORT9 * bmx_directx_d3d9_D3DVIEWPORT9_new() {
-	return (D3DVIEWPORT9*)malloc(sizeof(D3DVIEWPORT9));
+	return (D3DVIEWPORT9*)calloc(1,sizeof(D3DVIEWPORT9));
 }
 
 void bmx_directx_d3d9_D3DVIEWPORT9_free(D3DVIEWPORT9 * vp) {

+ 3 - 3
directx.mod/d3d9x.bmx

@@ -5,7 +5,7 @@ Import Pub.Win32
 
 Extern "win32"
 
-Type ID3DXBuffer Extends IUnknown
+Interface ID3DXBuffer_ Extends IUnknown_
 
 	Method GetBufferPointer:Byte Ptr()
 	Method GetBufferSize()
@@ -14,7 +14,7 @@ Rem
     STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE;
     STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE;
 end rem
-End Type
+End Interface
 
 End Extern
 
@@ -22,4 +22,4 @@ Global d3dx9Lib:Byte Ptr=LoadLibraryA( "d3dx9" )
 
 If Not d3dx9Lib Return
 
-Global D3DXAssembleShader( pSrcData:Byte Ptr,SrcDataLen,pDefines:Byte Ptr,pInclude:Byte Ptr,Flags,ppShader:ID3DXBuffer Var,ppErrorMsgs:ID3DXBuffer Var )"win32"=GetProcAddress( d3dx9Lib,"D3DXAssembleShader" )
+Global D3DXAssembleShader( pSrcData:Byte Ptr,SrcDataLen,pDefines:Byte Ptr,pInclude:Byte Ptr,Flags,ppShader:ID3DXBuffer_ Var,ppErrorMsgs:ID3DXBuffer_ Var )"win32"=GetProcAddress( d3dx9Lib,"D3DXAssembleShader" )

+ 26 - 26
directx.mod/dd.bmx

@@ -1267,7 +1267,7 @@ endrem
 
 Extern "win32"
 
-Type IDirectDraw Extends IUnknown
+Interface IDirectDraw Extends IUnknown_
 	Method Compact()
 	Method CreateClipper()
 	Method CreatePalette()
@@ -1310,9 +1310,9 @@ Rem
  STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD,DWORD) PURE;
  STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD, HANDLE ) PURE;
 End Rem
-End Type
+End Interface 
 
-Type IDirectDraw2 Extends IUnknown
+Interface IDirectDraw2 Extends IUnknown_
 
 Rem
  STDMETHOD(Compact)(THIS) PURE;
@@ -1338,9 +1338,9 @@ Rem
  ' Added in the v2 interface
  STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS, LPDWORD, LPDWORD) PURE;
 End Rem
-End Type
+End Interface 
 
-Type IDirectDraw4 Extends IUnknown
+Interface IDirectDraw4 Extends IUnknown_
 Rem
  STDMETHOD(Compact)(THIS) PURE;
  STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;
@@ -1370,9 +1370,9 @@ Rem
  STDMETHOD(TestCooperativeLevel)(THIS) PURE;
  STDMETHOD(GetDeviceIdentifier)(THIS_ LPDDDEVICEIDENTIFIER, DWORD ) PURE;
 End Rem
-End Type
+End Interface 
 
-Type IDirectDraw7 Extends IUnknown
+Interface IDirectDraw7 Extends IUnknown_
 	Method Compact()
 	Method CreateClipper(flags,clipper:Byte Ptr,outer:Byte Ptr)
 	Method CreatePalette()
@@ -1432,18 +1432,18 @@ Rem
  STDMETHOD(StartModeTest)(THIS_ LPSIZE, DWORD, DWORD ) PURE;
  STDMETHOD(EvaluateMode)(THIS_ DWORD, DWORD * ) PURE;
 End Rem
-End Type
+End Interface 
 
-Type IDirectDrawPalette Extends IUnknown
+Interface IDirectDrawPalette Extends IUnknown_
 Rem
  STDMETHOD(GetCaps)(THIS_ LPDWORD) PURE;
  STDMETHOD(GetEntries)(THIS_ DWORD,DWORD,DWORD,LPPALETTEENTRY) PURE;
  STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, DWORD, LPPALETTEENTRY) PURE;
  STDMETHOD(SetEntries)(THIS_ DWORD,DWORD,DWORD,LPPALETTEENTRY) PURE;
 End Rem
-End Type
+End Interface 
 
-Type IDirectDrawClipper Extends IUnknown
+Interface IDirectDrawClipper Extends IUnknown_
 	Method GetClipList(rect:Byte Ptr,region:Byte Ptr,flags)
 	Method GetHWnd()
 	Method Initialize()
@@ -1458,9 +1458,9 @@ Rem
  STDMETHOD(SetClipList)(THIS_ LPRGNDATA,DWORD) PURE;
  STDMETHOD(SetHWnd)(THIS_ DWORD, HWND ) PURE;
 End Rem
-End Type
+End Interface 
 
-Type IDirectDrawSurface Extends IUnknown
+Interface IDirectDrawSurface Extends IUnknown_
 	Method AddAttachedSurface(surface:Byte Ptr)
 	Method AddOverlayDirtyRect(rect:Byte Ptr)
 	Method Blt(destrect:Byte Ptr,srcsurface:Byte Ptr,srcrect:Byte Ptr,flags,blitfx:Byte Ptr)
@@ -1506,9 +1506,9 @@ Rem
  STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD) PURE;
  STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD, LPDIRECTDRAWSURFACE) PURE;
 End Rem
-End Type
+End Interface 
 
-Type IDirectDrawSUrface2 Extends IUnknown
+Interface IDirectDrawSUrface2 Extends IUnknown_
 Rem
  STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE2) PURE;
  STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT) PURE;
@@ -1548,9 +1548,9 @@ Rem
  STDMETHOD(PageLock)(THIS_ DWORD) PURE;
  STDMETHOD(PageUnlock)(THIS_ DWORD) PURE;
 End Rem
-End Type
+End Interface 
 
-Type IDirectDrawSurface3 Extends IUnknown
+Interface IDirectDrawSurface3 Extends IUnknown_
 Rem
  STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE3) PURE;
  STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT) PURE;
@@ -1592,9 +1592,9 @@ Rem
 ' /*** Added in the V3 interface ***/
  STDMETHOD(SetSurfaceDesc)(THIS_ LPDDSURFACEDESC, DWORD) PURE;
 End Rem
-End Type
+End Interface 
 
-Type IDirectDrawSurface4 Extends IUnknown
+Interface IDirectDrawSurface4 Extends IUnknown_
 Rem
  STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE4) PURE;
  STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT) PURE;
@@ -1642,9 +1642,9 @@ Rem
  STDMETHOD(GetUniquenessValue)(THIS_ LPDWORD) PURE;
  STDMETHOD(ChangeUniquenessValue)(THIS) PURE;
 End Rem
-End Type
+End Interface 
 
-Type IDirectDrawSurface7 Extends IUnknown
+Interface IDirectDrawSurface7 Extends IUnknown_
 	Method AddAttachedSurface(surface:Byte Ptr)
 	Method AddOverlayDirtyRect(rect:Byte Ptr)
 	Method Blt(destrect:Byte Ptr,srcsurface:Byte Ptr,srcrect:Byte Ptr,flags,blitfx:Byte Ptr)
@@ -1733,22 +1733,22 @@ Rem
  STDMETHOD(SetLOD)(THIS_ DWORD) PURE;
  STDMETHOD(GetLOD)(THIS_ LPDWORD) PURE;
 End Rem
-End Type
+End Interface 
 
-Type IDirectDrawColorControl Extends IUnknown
+Interface IDirectDrawColorControl Extends IUnknown_
 Rem
 DECLARE_INTERFACE_( IDirectDrawColorControl, IUnknown )
  STDMETHOD(GetColorControls)(THIS_ LPDDCOLORCONTROL) PURE;
  STDMETHOD(SetColorControls)(THIS_ LPDDCOLORCONTROL) PURE;
 End Rem
-End Type
+End Interface 
 
-Type IDirectDrawGammaControl Extends IUnknown
+Interface IDirectDrawGammaControl Extends IUnknown_
 Rem
  STDMETHOD(GetGammaRamp)(THIS_ DWORD, LPDDGAMMARAMP) PURE;
  STDMETHOD(SetGammaRamp)(THIS_ DWORD, LPDDGAMMARAMP) PURE;
 End Rem
-End Type
+End Interface 
 
 End Extern
 

+ 196 - 261
win32.mod/com.bmx

@@ -30,22 +30,15 @@ Extern
 	Function bmx_win32_com_IUnknown_Release:Int(handle:Byte Ptr)
 End Extern
 
-Type IUnknown
-	Field unknownPtr:Byte Ptr
-	
-	Method QueryInterface:Int( riid:Byte Ptr,ppvObj:Byte Ptr Ptr )'="IUnknown_QueryInterface"
-		Return bmx_win32_com_IUnknown_QueryInterface(unknownPtr, riid, ppvObj)
-	End Method
-	
-	Method AddRef:Int()'="IUnknown_AddRef"
-		Return bmx_win32_com_IUnknown_AddRef(unknownPtr)
-	End Method
+Extern "win32"
+Interface IUnknown_
 	
-	Method Release_:Int()'="IUnknown_Release"
-		Return bmx_win32_com_IUnknown_Release(unknownPtr)
-	End Method
-End Type
+	Method QueryInterface:Int( riid:Byte Ptr,ppvObj:IUnknown_ Var)
+	Method AddRef:Int()
+	Method Release_:Int()
 
+End Interface
+End Extern
 
 ' oleautomation
 Extern 
@@ -53,236 +46,179 @@ Function SysAllocStringLen:Short Ptr(bstr:Short Ptr,length)
 Function SysFreeString(bstr:Short Ptr)
 End Extern
 
-Type IDispatch Extends IUnknown
+Extern "win32"
+Interface IDispatch_ Extends IUnknown_
 '	Method QueryInterface( riid:Byte Ptr,ppvObj:Byte Ptr )="IDispatch_QueryInterface"
 '	Method AddRef()="IDispatch_AddRef"
 '	Method Release_()="IDispatch_Release"
 
 	Method lfGetTypeInfoCount(pctinfo:Byte Ptr)'="IDispatch_lfGetTypeInfoCount"
-	End Method
+	
 	
 	Method lfGetTypeInfo(iTInfo,lcid,ITypeInfo:Byte Ptr)'="IDispatch_lfGetTypeInfo"
-	End Method
+	
 	
 	Method lfGetIDsOfNames( riid:Byte Ptr,rgszNames:Byte Ptr Ptr,cNames,lcid,rgDispId:Byte Ptr)'="IDispatch_lfGetIDsOfNames"
-	End Method
+	
 	
 	Method Invoke(dispIdMember:Byte Ptr,riid:Byte Ptr,lcid,wFlags,pDispParams:Byte Ptr,pVarResult:Byte Ptr,pExcepInfo:Byte Ptr,puArgErr:Byte Ptr)'="IDispatch_Invoke"
-	End Method
 	
-End Type
+	
+End Interface
+End Extern
 
 Extern
 	Function bmx_win32_IWebBrowser_get_LocationURL:Int(handle:Byte Ptr, LocationURL:Short Ptr Ptr)
 	Function bmx_win32_IWebBrowser_get_LocationName:Int(handle:Byte Ptr, LocationName:Short Ptr Ptr)
 	Function bmx_win32_IWebBrowser_get_Document:Int(handle:Byte Ptr, ppDisp:Byte Ptr Ptr)
 End Extern
-Type IWebBrowser Extends IDispatch	
+
+Extern "win32"
+Interface IWebBrowser_ Extends IDispatch_	
 	Method lfGoBack()
-	End Method
-	
+		
 	Method lfGoForward()
-	End Method
-
+	
 	Method lfGoHome()
-	End Method
-
+	
 	Method lfGoSearch()
-	End Method
-
+	
 	Method lfNavigate(URL$w,Flags:VARIANT,TargetFrameName:VARIANT,PostData:VARIANT,Headers:Byte Ptr) 'VARIANT)
-	End Method
-
+	
 	Method lfRefresh()
-	End Method
-
+	
 	Method lfRefresh2(Level:Byte Ptr) 'VARIANT)
-	End Method
-
+	
 	Method lfStop()
-	End Method
-
-	Method lfget_Application(ppDisp:IDispatch Ptr Ptr) 
-	End Method
-
-	Method lfget_Parent(ppDisp:IDispatch Ptr Ptr)
-	End Method
-
-	Method lfget_Container(ppDisp:IDispatch Ptr Ptr)
-	End Method
-
-	Method lfget_Document(ppDisp:Byte Ptr Ptr)
-		bmx_win32_IWebBrowser_get_Document(unknownPtr, ppDisp)
-	End Method
+	
+	Method lfget_Application(ppDisp:IDispatch_ Var) 
+	
+	Method lfget_Parent(ppDisp:IDispatch_ Var)
+	
+	Method lfget_Container(ppDisp:IDispatch_ Var)
+	
+	Method lfget_Document(ppDisp:IDispatch_ Var)
+	'	bmx_win32_IWebBrowser_get_Document(unknownPtr, ppDisp)
+	'End Method
 
 	Method lfget_TopLevelContainer(pBool:Short Ptr)
-	End Method
 
 	Method lfget_Type(_Type$w)	
-	End Method
-
+	
 	Method lfget_Left(pl:Int Ptr)
-	End Method
-
+	
 	Method put_Left(Left) 
-	End Method
-
+	
 	Method lfget_Top(pl:Int Ptr)
-	End Method
-
+	
 	Method put_Top(Top)
-	End Method
-
+	
 	Method lfget_Width(pl:Int Ptr)
-	End Method
-
+	
 	Method put_Width(Width)
-	End Method
-
+	
 	Method lfget_Height(pl:Int Ptr)
-	End Method
-
+	
 	Method put_Height(Height)
-	End Method
-
+	
 	Method lfget_LocationName(LocationName:Short Ptr Ptr)
-		Return bmx_win32_IWebBrowser_get_LocationName(unknownPtr, LocationName)
-	End Method
+	'	Return bmx_win32_IWebBrowser_get_LocationName(unknownPtr, LocationName)
+	'End Method
 
 	Method lfget_LocationURL(LocationURL:Short Ptr Ptr)
-		Return bmx_win32_IWebBrowser_get_LocationURL(unknownPtr, LocationURL)
-	End Method
+	'	Return bmx_win32_IWebBrowser_get_LocationURL(unknownPtr, LocationURL)
+	'End Method
 
 	Method lfget_Busy(pBool:Short Ptr)
-	End Method
-
-End Type
+	
+End Interface
 
-Type IWebBrowserApp Extends IWebBrowser
+Interface IWebBrowserApp_ Extends IWebBrowser_
 	Method lfQuit()
-	End Method
-
+	
 	Method lfClientToWindow(pcx:Int Ptr,pcy:Int Ptr) 
-	End Method
-
+	
 	Method lfPutProperty(Property$w,vtValue:Byte Ptr) 'VARIANT)	'simon come here 
-	End Method
-
+	
 	Method lfGetProperty(Property$w,vtValue:Byte Ptr) 'VARIANT) 
-	End Method
-
+	
 	Method lfget_Name(Name:Byte Ptr )
-	End Method
-
+	
 	Method lfget_HWND(pHWND:Int Ptr)
-	End Method
-
+	
 	Method lfget_FullName(FullName:Short Ptr Ptr)
-	End Method
-
+	
 	Method lfget_Path(Path:Short Ptr Ptr)
-	End Method
-
+	
 	Method lfget_Visible(pBool:Short Ptr)
-	End Method
-
+	
 	Method put_Visible(Value:Byte Ptr) 'VARIANT)
-	End Method
-
+	
 	Method lfget_StatusBar(pBool:Short Ptr)
-	End Method
-
+	
 	Method put_StatusBar(Value:Byte Ptr) 'VARIANT)
-	End Method
-
+	
 	Method lfget_StatusText(StatusText:Short Ptr Ptr)
-	End Method
-
+	
 	Method put_StatusText(StatusText$w)
-	End Method
-
+	
 	Method lfget_ToolBar(Value:Int Ptr)
-	End Method
 
 	Method put_ToolBar(Value)
-	End Method
-
+	
 	Method lfget_MenuBar(Value:Byte Ptr) 'VARIANT)
-	End Method
-
+	
 	Method put_MenuBar(Value:Byte Ptr) 'VARIANT)
-	End Method
-
+	
 	Method lfget_FullScreen(pbFullScreen:Byte Ptr) 'VARIANT)
-	End Method
-
+	
 	Method put_FullScreen(bFullScreen:Byte Ptr) 'VARIANT)
-	End Method
-
-End Type
+	
+End Interface
 
-Type IWebBrowser2 Extends IWebBrowserApp
+Interface IWebBrowser2_ Extends IWebBrowserApp_
 	Method lfNavigate2(URL:VARIANT,Flags:VARIANT,TargetFrameName:VARIANT,PostData:VARIANT,Headers:Byte Ptr) 'VARIANT)
-	End Method
-
+	
 	Method lfQueryStatusWB(cmdID,pcmdf)
-	End Method
-
+	
 	Method lfExecWB(cmdID,cmdexecopt,pvaIn:VARIANT,pvaOut:Byte Ptr) 'VARIANT)
-	End Method
-
+	
 	Method lfShowBrowserBar(pvaClsid:VARIANT,pvarShow:VARIANT,pvarSize:Byte Ptr) 'VARIANT)
-	End Method
-
+	
 	Method get_ReadyState(plReadyState:Int Ptr)
-	End Method
-
+	
 	Method lfget_Offline(pbOffline:Short Ptr)
-	End Method
-
+	
 	Method put_Offline(bOffline)
-	End Method
-
+	
 	Method lfget_Silent(pbSilent:Short Ptr)
-	End Method
-
+	
 	Method put_Silent(bSilent)
-	End Method
-
+	
 	Method lfget_RegisterAsBrowser(pbRegister:Short Ptr)
-	End Method
-
+	
 	Method put_RegisterAsBrowser(bRegister)
-	End Method
-
+	
 	Method lfget_RegisterAsDropTarget(pbRegister:Short Ptr)
-	End Method
-
+	
 	Method put_RegisterAsDropTarget(bRegister)
-	End Method
-
+	
 	Method lfget_TheaterMode(pbRegister:Short Ptr) 
-	End Method
-
+	
 	Method put_TheaterMode(bRegister)
-	End Method
-
+	
 	Method lfget_AddressBar(Value:Short Ptr)
-	End Method
-
+	
 	Method put_AddressBar(Value)
-	End Method
-
+	
 	Method lfget_Resizable(Value:Short Ptr)
-	End Method
-
+	
 	Method put_Resizable(Value)
-	End Method
+	
+End Interface
 
-End Type
+Interface IHTMLWindow2_ Extends IDispatch_
 
-Type IHTMLWindow2 Extends IDispatch
-Rem
     Method item(this:Byte Ptr,_variant:Byte Ptr)
     Method get_length(_pint:Int Ptr)
 
@@ -329,7 +265,7 @@ Rem
     Method get_onresize(this:Byte Ptr)
     Method put_onscroll(_variant:Long)
     Method get_onscroll(this:Byte Ptr)
-    Method get_document(IHTMLDocument2:Byte Ptr Ptr)
+    Method get_document(doc:IHTMLDocument2_ Var)
     Method get_event(LPHTMLEVENTOBJ:Byte Ptr)
     Method get__newEnum(IUnknown:Byte Ptr Ptr)
     Method showModalDialog(_bstr:Short Ptr,_variant:Byte Ptr,_variant2:Byte Ptr,_variant3:Byte Ptr)
@@ -353,287 +289,287 @@ Rem
     Method moveBy(_int,_int1)
     Method resizeTo(_int,_int1)
     Method resizeBy(_int,_int1)
-    Method get_external(IDispatch:Byte Ptr Ptr)
-End Rem
-End Type
+    Method get_external(disp:IDispatch_ Var)
+
+End Interface
+
+Interface IHTMLDocument2_ Extends IDispatch_
 
-Type IHTMLDocument2 Extends IDispatch
-Rem 
 	Method get_Script(IDispatch:Byte Ptr Ptr)
-	End Method
+	'End Method
 
 	Method get_all(LPHTMLELEMENTCOLLECTION:Byte Ptr)
-	End Method
+	'End Method
 
 	Method get_body(LPHTMLELEMENT:Byte Ptr)
-	End Method
+	'End Method
 
 	Method get_activeElement(LPHTMLELEMENT:Byte Ptr)
-	End Method
+	'End Method
 
 	Method get_images(LPHTMLELEMENTCOLLECTION:Byte Ptr)
-	End Method
+	'End Method
 
 	Method get_applets(LPHTMLELEMENTCOLLECTION:Byte Ptr)
-	End Method
+	'End Method
 
 	Method get_links(LPHTMLELEMENTCOLLECTION:Byte Ptr)
-	End Method
+	'End Method
 
 	Method get_forms(LPHTMLELEMENTCOLLECTION:Byte Ptr)
-	End Method
+	'End Method
 
 	Method get_anchors(LPHTMLELEMENTCOLLECTION:Byte Ptr)
-	End Method
+	'End Method
 
 	Method put_title(_bstr:Short Ptr)
-	End Method
-End Rem
+	'End Method
+
 	Method get_title(_pbstr:Short Ptr Ptr)
-	End Method
-Rem
+	'End Method
+
 	Method get_scripts(LPHTMLELEMENTCOLLECTION:Byte Ptr)
-	End Method
+'	End Method
 
 	Method put_designMode(_bstr:Short Ptr)
-	End Method
+'	End Method
 
 	Method get_designMode(_pbstr:Short Ptr Ptr)
-	End Method
+'	End Method
 
 	Method get_selection(LPHTMLSELECTIONOBJECT:Byte Ptr)
-	End Method
+'	End Method
 
 	Method get_readyState(_pbstr:Short Ptr Ptr)
-	End Method
+'	End Method
 
 	Method get_frames(LPHTMLFRAMESCOLLECTION:Byte Ptr)
-	End Method
+'	End Method
 
 	Method get_embeds(LPHTMLELEMENTCOLLECTION:Byte Ptr)
-	End Method
+'	End Method
 
 	Method get_plugins(LPHTMLELEMENTCOLLECTION:Byte Ptr)
-	End Method
+'	End Method
 
 	Method put_alinkColor(_variant:Long)
-	End Method
+'	End Method
 
 	Method get_alinkColor(this:Byte Ptr)
-	End Method
+'	End Method
 
 	Method put_bgColor(_variant:Long)
-	End Method
+'	End Method
 
 	Method get_bgColor(this:Byte Ptr)
-	End Method
+'	End Method
 
 	Method put_fgColor(_variant:Long)
-	End Method
+'	End Method
 
 	Method get_fgColor(this:Byte Ptr)
-	End Method
+'	End Method
 
 	Method put_linkColor(_variant:Long)
-	End Method
+'	End Method
 
 	Method get_linkColor(this:Byte Ptr)
-	End Method
+'	End Method
 
 	Method put_vlinkColor(_variant:Long)
-	End Method
+'	End Method
 
 	Method get_vlinkColor(this:Byte Ptr)
-	End Method
+'	End Method
 
 	Method get_referrer(_pbstr:Short Ptr Ptr)
-	End Method
+'	End Method
 
 	Method get_location(LPHTMLLOCATION:Byte Ptr)
-	End Method
+'	End Method
 
 	Method get_lastModified(_pbstr:Short Ptr Ptr)
-	End Method
+'	End Method
 
 	Method put_url(_bstr:Short Ptr)
-	End Method
+'	End Method
 
 	Method get_url(_pbstr:Short Ptr Ptr)
-	End Method
+'	End Method
 
 	Method put_domain(_bstr:Short Ptr)
-	End Method
+'	End Method
 
 	Method get_domain(_pbstr:Short Ptr Ptr)
-	End Method
+'	End Method
 
 	Method put_cookie(_bstr:Short Ptr)
-	End Method
+'	End Method
 
 	Method get_cookie(_pbstr:Short Ptr Ptr)
-	End Method
+'	End Method
 
 	Method put_expands(_variant:Short)
-	End Method
+'	End Method
 
 	Method get_expands(_variant:Short Ptr)
-	End Method
+'	End Method
 
 	Method put_charset(_bstr:Short Ptr)
-	End Method
+'	End Method
 
 	Method get_charset(_pbstr:Short Ptr Ptr)
-	End Method
+'	End Method
 
 	Method put_defaultCharset(_bstr:Short Ptr)
-	End Method
+'	End Method
 
 	Method get_defaultCharset(_pbstr:Short Ptr Ptr)
-	End Method
+'	End Method
 
 	Method get_mimeType(_pbstr:Short Ptr Ptr)
-	End Method
+'	End Method
 
 	Method get_fileSize(_pbstr:Short Ptr Ptr)
-	End Method
+'	End Method
 
 	Method get_fileCreatedDate(_pbstr:Short Ptr Ptr)
-	End Method
+'	End Method
 
 	Method get_fileModifiedDate(_pbstr:Short Ptr Ptr)
-	End Method
+'	End Method
 
 	Method get_fileUpdatedDate(_pbstr:Short Ptr Ptr)
-	End Method
+'	End Method
 
 	Method get_security(_pbstr:Short Ptr Ptr)
-	End Method
+'	End Method
 
 	Method get_protocol(_pbstr:Short Ptr Ptr)
-	End Method
+'	End Method
 
 	Method get_nameProp(_pbstr:Short Ptr Ptr)
-	End Method
+'	End Method
 
 	Method write(SAFEARRAY)
-	End Method
+'	End Method
 
 	Method writeln(SAFEARRAY)
-	End Method
+'	End Method
 
-	Method open(_bstr:Short Ptr,v1:Long,v2:Long,v3:Long,IDispatch:Byte Ptr Ptr)
-	End Method
+	Method open(_bstr:Short Ptr,v1:Long,v2:Long,v3:Long,disp:IDispatch_ Var)
+'	End Method
 
 	Method close()
-	End Method
+'	End Method
 
 	Method clear()
-	End Method
+'	End Method
 
 	Method queryCommandSupported(_bstr:Short Ptr,_variantbool:Short Ptr)
-	End Method
+'	End Method
 
 	Method queryCommandEnabled(_bstr:Short Ptr,_variantbool:Short Ptr)
-	End Method
+'	End Method
 
 	Method queryCommandState(_bstr:Short Ptr,_variantbool:Short Ptr)
-	End Method
+'	End Method
 
 	Method queryCommandIndeterm(_bstr:Short Ptr,_variantbool:Short Ptr)
-	End Method
+'	End Method
 
 	Method queryCommandText(_bstr:Short Ptr,BSTR:Byte Ptr)
-	End Method
+'	End Method
 
 	Method queryCommandValue(_bstr:Short Ptr,_variant:Byte Ptr)
-	End Method
+'	End Method
 
 	Method execCommand(_bstr:Short Ptr,_variantbool:Short,_variant:Long,_variantpbool:Short Ptr)
-	End Method
+'	End Method
 
 	Method execCommandShowHelp(_bstr:Short Ptr,_variantbool:Short Ptr)
-	End Method
+'	End Method
 
 	Method createElement(_bstr:Short Ptr,LPHTMLELEMENT:Byte Ptr)
-	End Method
+'	End Method
 
 	Method put_onhelp(_variant:Long)
-	End Method
+'	End Method
 
 	Method get_onhelp(this:Byte Ptr)
-	End Method
+'	End Method
 
 	Method put_onclick(_variant:Long)
-	End Method
+'	End Method
 
 	Method get_onclick(this:Byte Ptr)
-	End Method
+'	End Method
 
 	Method put_ondblclick(_variant:Long)
-	End Method
+'	End Method
 
 	Method get_ondblclick(this:Byte Ptr)
-	End Method
+'	End Method
 
 	Method put_onkeyup(_variant:Long)
-	End Method
+'	End Method
 
 	Method get_onkeyup(this:Byte Ptr)
-	End Method
+'	End Method
 
 	Method put_onkeydown(_variant:Long)
-	End Method
+'	End Method
 
 	Method get_onkeydown(this:Byte Ptr)
-	End Method
+'	End Method
 
 	Method put_onkeypress(_variant:Long)
-	End Method
+'	End Method
 
 	Method get_onkeypress(this:Byte Ptr)
-	End Method
+'	End Method
 
 	Method put_onmouseup(_variant:Long)
-	End Method
+'	End Method
 
 	Method get_onmouseup(this:Byte Ptr)
-	End Method
+'	End Method
 
 	Method put_onmousedown(_variant:Long)
-	End Method
+'	End Method
 
 	Method get_onmousedown(this:Byte Ptr)
-	End Method
+'	End Method
 
 	Method put_onmousemove(_variant:Long)
-	End Method
+'	End Method
 
 	Method get_onmousemove(this:Byte Ptr)
-	End Method
+'	End Method
 
 	Method put_onmouseout(_variant:Long)
-	End Method
+'	End Method
 
 	Method get_onmouseout(this:Byte Ptr)
-	End Method
+'	End Method
 
 	Method put_onmouseover(_variant:Long)
-	End Method
+'	End Method
 
 	Method get_onmouseover(this:Byte Ptr)
-	End Method
+'	End Method
 
 	Method put_onreadystatechange(_variant:Long)
-	End Method
+'	End Method
 
 	Method get_onreadystatechange(this:Byte Ptr)
-	End Method
+'	End Method
 
 	Method put_onafterupdate(_variant:Long)
-	End Method
+'	End Method
 
 	Method get_onafterupdate(this:Byte Ptr)
-	End Method
+'	End Method
 
 	Method put_onrowexit(_variant:Long)
 	Method get_onrowexit(this:Byte Ptr)
@@ -652,9 +588,8 @@ Rem
 	Method get_onerrorupdate(this:Byte Ptr)
 	Method toString(_pbstr:Short Ptr Ptr)
 	Method createStyleSheet(_bstr:Short Ptr,_int,LPHTMLSTYLESHEET:Byte Ptr)
-End Rem
-End Type
-
+End Interface
+End Extern
 
 Const IUnknown_UUID$="{00000000-0000-0000-C000-000000000046}"
 Const IDispatch_UUID$="{00020400-0000-0000-C000-000000000046}"

+ 1 - 1
win32.mod/com.cpp

@@ -33,7 +33,7 @@ int bmx_win32_com_IUnknown_Release(IUnknown * unk) {
 // ********************************************************
 
 GUID * bmx_win32_GUID_new() {
-	return (GUID *)malloc(sizeof(GUID));
+	return (GUID *)calloc(1,sizeof(GUID));
 }
 
 void bmx_win32_GUID_free(GUID * guid) {

+ 5 - 5
win32.mod/commctrl.bmx

@@ -459,7 +459,7 @@ Extern
 	Function bmx_win32_TVITEMW_SetiImage(handle:Byte Ptr, iImage:Int)
 	Function bmx_win32_TVITEMW_SetiSelectedImage(handle:Byte Ptr, iSelectedImage:Int)
 	Function bmx_win32_TVITEMW_SetcChildren(handle:Byte Ptr, cChildren:Int)
-	Function bmx_win32_TVITEMW_SetlParam(handle:Byte Ptr, lParam:Byte Ptr)
+	Function bmx_win32_TVITEMW_SetlParam(handle:Byte Ptr, lp:LParam)
 	Function bmx_win32_TVITEMW_mask:Uint(handle:Byte Ptr)
 	Function bmx_win32_TVITEMW_hItem:Byte Ptr(handle:Byte Ptr)
 	Function bmx_win32_TVITEMW_pszText:Short Ptr(handle:Byte Ptr)
@@ -520,8 +520,8 @@ Type TVITEMW
 		bmx_win32_TVITEMW_SetcChildren(itemPtr, cChildren)
 	End Method
 	
-	Method SetlParam(lParam:Byte Ptr)
-		bmx_win32_TVITEMW_SetlParam(itemPtr, lParam)
+	Method SetlParam(lp:LParam)
+		bmx_win32_TVITEMW_SetlParam(itemPtr, lp)
 	End Method
 	
 	Method mask:Uint()
@@ -2116,8 +2116,8 @@ Extern
 	Function bmx_win32_NMTREEVIEW_y:Int(handle:Byte Ptr)
 	
 	Function bmx_win32_MSGFILTER_msg:UInt(handle:Byte Ptr)
-	Function bmx_win32_MSGFILTER_wParam:Byte Ptr(handle:Byte Ptr)
-	Function bmx_win32_MSGFILTER_lParam:Byte Ptr(handle:Byte Ptr)
+	Function bmx_win32_MSGFILTER_wParam:WParam(handle:Byte Ptr)
+	Function bmx_win32_MSGFILTER_lParam:LParam(handle:Byte Ptr)
 	Function bmx_win32_MSGFILTER_Setmsg(handle:Byte Ptr, msg:UInt)
 	
 End Extern

+ 3 - 4
win32.mod/commctrl.cpp

@@ -191,8 +191,7 @@ LPWSTR bmx_win32_TOOLINFOW_lpszText(TOOLINFOW * info) {
 // ********************************************************
 
 INITCOMMONCONTROLSEX * bmx_win32_TINITCOMMONCONTROLSEX_new() {
-	INITCOMMONCONTROLSEX * icc = (INITCOMMONCONTROLSEX *)malloc(sizeof(INITCOMMONCONTROLSEX));
-	memset(icc, 0, sizeof(INITCOMMONCONTROLSEX));
+	INITCOMMONCONTROLSEX * icc = (INITCOMMONCONTROLSEX *)calloc(1,sizeof(INITCOMMONCONTROLSEX));
 	icc->dwSize = sizeof(INITCOMMONCONTROLSEX);
 	return icc;
 }
@@ -230,7 +229,7 @@ HIMAGELIST bmx_win32_BUTTON_IMAGELIST_himl(BUTTON_IMAGELIST * list) {
 // ********************************************************
 
 COMBOBOXEXITEMW * bmx_win32_COMBOBOXEXITEMW_new() {
-	return (COMBOBOXEXITEMW *)malloc(sizeof(COMBOBOXEXITEMW));
+	return (COMBOBOXEXITEMW *)calloc(1, sizeof(COMBOBOXEXITEMW));
 }
 
 void bmx_win32_COMBOBOXEXITEMW_free(COMBOBOXEXITEMW * item) {
@@ -278,7 +277,7 @@ void bmx_win32_LVCOLUMNW_free(LVCOLUMNW * col) {
 // ********************************************************
 
 LVITEMW * bmx_win32_LVITEMW_new() {
-	return (LVITEMW *)malloc(sizeof(LVITEMW));
+	return (LVITEMW *)calloc(1, sizeof(LVITEMW));
 }
 
 void bmx_win32_LVITEMW_free(LVITEMW * item) {

+ 5 - 0
win32.mod/gdi32.bmx

@@ -469,6 +469,7 @@ Extern
 	Function bmx_win32_LOGFONTW_lfQuality:Int(handle:Byte Ptr)
 	Function bmx_win32_LOGFONTW_lfPitchAndFamily:Int(handle:Byte Ptr)
 	Function bmx_win32_LOGFONTW_lfFaceName:Int(handle:Byte Ptr)
+	Function bmx_win32_LOGFONTW_size:Int()
 End Extern
 Type LOGFONTW
 	Field fontPtr:Byte Ptr
@@ -490,6 +491,10 @@ Type LOGFONTW
 		fontPtr = Null
 	End Method
 	
+	Function Size:Int()
+		Return bmx_win32_LOGFONTW_size()
+	End Function
+	
 	Function _create:LOGFONTW(fontPtr:Byte Ptr)
 		Local this:LOGFONTW = New LOGFONTW
 		this.Free()

+ 5 - 0
win32.mod/gdi32.cpp

@@ -24,6 +24,7 @@ extern "C" {
 	int bmx_win32_LOGFONTW_lfQuality(LOGFONTW * font);
 	int bmx_win32_LOGFONTW_lfPitchAndFamily(LOGFONTW * font);
 	WCHAR * bmx_win32_LOGFONTW_lfFaceName(LOGFONTW * font);
+	int bmx_win32_LOGFONTW_size();
 
 	TEXTMETRIC * bmx_win32_TEXTMETRIC_new();
 	void bmx_win32_TEXTMETRIC_free(TEXTMETRIC * metric);
@@ -40,6 +41,10 @@ extern "C" {
 
 // ********************************************************
 
+int bmx_win32_LOGFONTW_size() {
+	return sizeof(LOGFONTW);
+}
+
 LOGFONTW * bmx_win32_LOGFONTW_new() {
 	return (LOGFONTW *)calloc(1, sizeof(LOGFONTW));
 }

+ 16 - 16
win32.mod/user32.bmx

@@ -751,8 +751,8 @@ Const WA_CLICKACTIVE=2
 Type MSG
 	Field hWnd:Byte Ptr
 	Field message
-	Field wParam:Byte Ptr
-	Field lParam:Byte Ptr
+	Field wp:WParam
+	Field lp:LParam
 	Field time
 	Field pt_x,pt_y
 End Type
@@ -1137,20 +1137,20 @@ Function RegisterClassA( lpWndClass:Byte Ptr )
 Function RegisterClassW( lpWndClass:Byte Ptr )
 Function CreateWindowExA:Byte Ptr( dwExStyle,lpClassName:Byte Ptr,lpWindowName:Byte Ptr,dwStyle,x,y,nWidth,nHeight,hWndParent,hmenu:Byte Ptr,hInstance:Byte Ptr,lpParam:Byte Ptr )
 Function CreateWindowExW:Byte Ptr( dwExStyle,lpClassName$w,lpWindowName$w,dwStyle,x,y,nWidth,nHeight,hWndParent:Byte Ptr,hmenu:Byte Ptr,hInstance:Byte Ptr,lpParam:Byte Ptr )
-Function DefWindowProcA:Byte Ptr( hWnd:Byte Ptr,MSG:UInt,wParam:Byte Ptr,lParam:Byte Ptr )
-Function DefWindowProcW:Byte Ptr( hWnd:Byte Ptr,MSG:UInt,wParam:Byte Ptr,lParam:Byte Ptr )
+Function DefWindowProcA:Byte Ptr( hWnd:Byte Ptr,MSG:UInt,wp:WParam,lp:LParam)
+Function DefWindowProcW:Byte Ptr( hWnd:Byte Ptr,MSG:UInt,wp:WParam,lp:LParam)
 Function DispatchMessageA( lpMsg:Byte Ptr )
 Function DispatchMessageW( lpMsg:Byte Ptr )
 Function GetMessageA( lpMsg:Byte Ptr,hWnd:Byte Ptr,wMsgFilterMin,wMsgFilterMax )
 Function GetMessageW( lpMsg:Byte Ptr,hWnd:Byte Ptr,wMsgFilterMin,wMsgFilterMax )
 Function PeekMessageA( lpMsg:Byte Ptr,hWnd:Byte Ptr,wMsgFilterMin,wMsgFilterMax,wRemoveMsg )
 Function PeekMessageW( lpMsg:Byte Ptr,hWnd:Byte Ptr,wMsgFilterMin,wMsgFilterMax,wRemoveMsg )
-Function PostMessageA( hWnd:Byte Ptr,MSG,wParam:Byte Ptr,lParam:Byte Ptr )
-Function PostMessageW( hWnd:Byte Ptr,MSG,wParam:Byte Ptr,lParam:Byte Ptr )
-Function SendMessageA( hWnd:Byte Ptr,MSG:UInt,wParam:Byte Ptr,lParam:Byte Ptr )
-Function SendMessageW( hWnd:Byte Ptr,MSG:UInt,wParam:Byte Ptr,lParam:Byte Ptr )
-Function PostThreadMessageA( idThread,Msg,wParam:Byte Ptr,lParam:Byte Ptr )
-Function PostThreadMessageW( idThread,Msg,wParam:Byte Ptr,lParam:Byte Ptr )
+Function PostMessageA( hWnd:Byte Ptr,MSG,wp:WParam,lp:LParam )
+Function PostMessageW( hWnd:Byte Ptr,MSG,wp:WParam,lp:LParam )
+Function SendMessageA( hWnd:Byte Ptr,MSG:UInt,wp:WParam,lp:LParam )
+Function SendMessageW( hWnd:Byte Ptr,MSG:UInt,wp:WParam,lp:LParam )
+Function PostThreadMessageA( idThread,Msg,wp:WParam,lp:LParam )
+Function PostThreadMessageW( idThread,Msg,wp:WParam,lp:LParam )
 Function GetDC:Byte Ptr( hWnd:Byte Ptr )
 Function PostQuitMessage( nExitCode )
 Function TranslateMessage( lpMsg:Byte Ptr )
@@ -1208,8 +1208,8 @@ Function SetClassLongA( hWnd:Byte Ptr,index,newlong )
 Function GetClassLongW( hWnd:Byte Ptr,index )
 Function SetClassLongW( hWnd:Byte Ptr,index,newlong )
 Function IsZoomed( hWnd:Byte Ptr )
-Function CallWindowProcA:Byte Ptr( proc:Byte Ptr,hWnd:Byte Ptr,msg:UInt,wp:Byte Ptr,lp:Byte Ptr )
-Function CallWindowProcW:Byte Ptr( proc:Byte Ptr,hWnd:Byte Ptr,msg:Uint,wp:Byte Ptr,lp:Byte Ptr )
+Function CallWindowProcA:Byte Ptr( proc:Byte Ptr,hWnd:Byte Ptr,msg:UInt,wp:WParam,lp:LParam)
+Function CallWindowProcW:Byte Ptr( proc:Byte Ptr,hWnd:Byte Ptr,msg:Uint,wp:WParam,lp:LParam )
 Function OleInitialize(pvReserved:Byte Ptr)
 Function OleUninitialize()
 Function InitCommonControlsEx(controlsex:Byte Ptr)
@@ -1236,7 +1236,7 @@ Function WindowFromPoint:Byte Ptr( point:Int Ptr )
 Function GetKeyState(vkey)
 
 Function SetWindowsHookExW:Byte Ptr(idHook,lpfn:Byte Ptr,hmod:Byte Ptr,dwThreadId)
-Function CallNextHookEx(hhk:Byte Ptr,ncode,wparam:Byte Ptr,lparam:Byte Ptr)
+Function CallNextHookEx(hhk:Byte Ptr,ncode,wp:WParam,lp:LParam)
 Function UnhookWindowsHookEx(hhk:Byte Ptr)
 
 Function EnableWindow( hWnd:Byte Ptr,enable )
@@ -1245,8 +1245,8 @@ Function IsWindowVisible( hWnd:Byte Ptr )
 Function GetWindowInfo( hWnd:Byte Ptr,winfo:Byte Ptr )
 Function GetCursorPos_( lpPoint:Int Ptr)="GetCursorPos" '"GetCursorPos@4"
 
-Function EnumChildWindows( hWnd:Byte Ptr,lpfn:Byte Ptr,lp:Byte Ptr )
-Function EnumWindows( lpfn:Byte Ptr,lp:Byte Ptr )
+Function EnumChildWindows( hWnd:Byte Ptr,lpfn:Byte Ptr,lp:LParam )
+Function EnumWindows( lpfn:Byte Ptr,lp:LParam )
 
 Function OpenClipboard(hWnd:Byte Ptr)
 Function CloseClipboard()
@@ -1255,7 +1255,7 @@ Function GetClipboardData:Byte Ptr(uFormat:UInt)
 Function EmptyClipboard()
 Function IsClipboardFormatAvailable(format)
 
-Function DefDlgProcW(hDlg:Byte Ptr,Msg:UInt,wParam:Byte Ptr,lParam:Byte Ptr)
+Function DefDlgProcW(hDlg:Byte Ptr,Msg:UInt,wp:WParam,lp:LParam)
 
 Function GetModuleFileNameW:Int( hmodule:Byte Ptr, buffer:Short Ptr, sz:Int)
 Function GetWindowModuleFileNameW:UInt(hwnd:Byte Ptr, lpszFileName:Short Ptr, cchFileNameMax:UInt)

+ 5 - 7
win32.mod/user32.cpp

@@ -75,9 +75,7 @@ extern "C" {
 // ********************************************************
 
 WNDCLASSW * bmx_win32_WNDCLASSW_new() {
-	WNDCLASSW * clas = (WNDCLASSW *)malloc(sizeof(WNDCLASSW));
-	memset(clas, 0, sizeof(WNDCLASSW));
-	return clas;
+	return (WNDCLASSW *)calloc(1,sizeof(WNDCLASSW));
 }
 
 void bmx_win32_WNDCLASSW_free(WNDCLASSW * clas) {
@@ -119,7 +117,7 @@ void bmx_win32_WNDCLASSW_SetcbWndExtra(WNDCLASSW * clas, int cbWndExtra) {
 // ********************************************************
 
 ICONINFO * bmx_win32_ICONINFO_new() {
-	return (ICONINFO *)malloc(sizeof(ICONINFO));
+	return (ICONINFO *)calloc(1,sizeof(ICONINFO));
 }
 
 void bmx_win32_ICONINFO_free(ICONINFO * info) {
@@ -141,7 +139,7 @@ void bmx_win32_ICONINFO_SethbmColor(ICONINFO * info, HBITMAP hbmColor) {
 // ********************************************************
 
 MENUINFO * bmx_win32_MENUINFO_new() {
-	MENUINFO * info = (MENUINFO *)malloc(sizeof(MENUINFO));
+	MENUINFO * info = (MENUINFO *)calloc(1,sizeof(MENUINFO));
 	info->cbSize = sizeof(MENUINFO);
 	return info;
 }
@@ -177,7 +175,7 @@ void bmx_win32_MENUINFO_SetdwMenuData(MENUINFO * info, ULONG_PTR dwMenuData) {
 // ********************************************************
 
 MENUITEMINFOW * bmx_win32_MENUITEMINFOW_new() {
-	MENUITEMINFOW * info = (MENUITEMINFOW *)malloc(sizeof(MENUITEMINFOW));
+	MENUITEMINFOW * info = (MENUITEMINFOW *)calloc(1,sizeof(MENUITEMINFOW));
 	info->cbSize = sizeof(MENUITEMINFOW);
 	return info;
 }
@@ -221,7 +219,7 @@ LPWSTR bmx_win32_MENUITEMINFOW_dwTypeData(MENUITEMINFOW * info) {
 // ********************************************************
 
 SCROLLINFO * bmx_win32_SCROLLINFO_new() {
-	SCROLLINFO * info = (SCROLLINFO *)malloc(sizeof(SCROLLINFO));
+	SCROLLINFO * info = (SCROLLINFO *)calloc(1,sizeof(SCROLLINFO));
 	info->cbSize = sizeof(SCROLLINFO);
 	return info;
 }