소스 검색

Unify `IUnknown` COM interface

gingerBill 1 년 전
부모
커밋
7e41340510
2개의 변경된 파일12개의 추가작업 그리고 15개의 파일을 삭제
  1. 9 7
      core/sys/windows/ole32.odin
  2. 3 8
      vendor/directx/dxgi/dxgi.odin

+ 9 - 7
core/sys/windows/ole32.odin

@@ -7,13 +7,13 @@ foreign import "system:Ole32.lib"
 /*
 typedef enum tagCOINIT
 {
-  COINIT_APARTMENTTHREADED  = 0x2,      // Apartment model
+	COINIT_APARTMENTTHREADED  = 0x2,      // Apartment model
 
 #if  (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
-  // These constants are only valid on Windows NT 4.0
-  COINIT_MULTITHREADED      = COINITBASE_MULTITHREADED,
-  COINIT_DISABLE_OLE1DDE    = 0x4,      // Don't use DDE for Ole1 support.
-  COINIT_SPEED_OVER_MEMORY  = 0x8,      // Trade memory for speed.
+	// These constants are only valid on Windows NT 4.0
+	COINIT_MULTITHREADED      = COINITBASE_MULTITHREADED,
+	COINIT_DISABLE_OLE1DDE    = 0x4,      // Don't use DDE for Ole1 support.
+	COINIT_SPEED_OVER_MEMORY  = 0x8,      // Trade memory for speed.
 #endif // DCOM
 } COINIT;
 */
@@ -26,9 +26,11 @@ COINIT :: enum DWORD {
 }
 
 IUnknown :: struct {
-	using Vtbl: ^IUnknownVtbl,
+	using _iunknown_vtable: ^IUnknown_VTable,
 }
-IUnknownVtbl :: struct {
+
+IUnknownVtbl :: IUnknown_VTable
+IUnknown_VTable :: struct {
 	QueryInterface: proc "system" (This: ^IUnknown, riid: REFIID, ppvObject: ^rawptr) -> HRESULT,
 	AddRef:         proc "system" (This: ^IUnknown) -> ULONG,
 	Release:        proc "system" (This: ^IUnknown) -> ULONG,

+ 3 - 8
vendor/directx/dxgi/dxgi.odin

@@ -29,14 +29,9 @@ SIZE                :: win32.SIZE
 WCHAR               :: win32.WCHAR
 DWORD               :: win32.DWORD
 
-IUnknown :: struct {
-	using _iunknown_vtable: ^IUnknown_VTable,
-}
-IUnknown_VTable :: struct {
-	QueryInterface: proc "system" (this: ^IUnknown, riid: ^IID, ppvObject: ^rawptr) -> HRESULT,
-	AddRef:         proc "system" (this: ^IUnknown) -> ULONG,
-	Release:        proc "system" (this: ^IUnknown) -> ULONG,
-}
+IUnknown :: win32.IUnknown
+IUnknown_VTable :: win32.IUnknown_VTable
+LPUNKNOWN :: win32.LPUNKNOWN
 
 @(default_calling_convention="system")
 foreign dxgi {